@@ -125,6 +125,7 @@ static pcblddr_func_t pcblddr_fun;
125125
126126static struct rte_ring * * dispatch_ring [RTE_MAX_ETHPORTS ];
127127static dispatch_func_t packet_dispatcher ;
128+ static dispatch_func_context_t packet_dispatcher_with_context ;
128129
129130static uint16_t rss_reta_size [RTE_MAX_ETHPORTS ];
130131
@@ -1614,10 +1615,27 @@ process_packets(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **bufs,
16141615 ff_traffic .rx_bytes += rte_pktmbuf_pkt_len (rtem );
16151616 }
16161617
1617- if (!pkts_from_ring && packet_dispatcher ) {
1618- uint64_t cur_tsc = rte_rdtsc ();
1619- int ret = (* packet_dispatcher )(data , & len , queue_id , nb_queues );
1620- usr_cb_tsc += rte_rdtsc () - cur_tsc ;
1618+ if (!pkts_from_ring && (packet_dispatcher || packet_dispatcher_with_context )) {
1619+ uint64_t cur_tsc ;
1620+ int ret ;
1621+ if (packet_dispatcher ) {
1622+ cur_tsc = rte_rdtsc ();
1623+ ret = (* packet_dispatcher )(data , & len , queue_id , nb_queues );
1624+ usr_cb_tsc += rte_rdtsc () - cur_tsc ;
1625+ } else if (packet_dispatcher_with_context ) {
1626+ struct ff_dispatcher_context ctx ;
1627+ if (rtem -> ol_flags & RTE_MBUF_F_RX_VLAN_STRIPPED ) {
1628+ ctx .vlan .stripped = 1 ;
1629+ ctx .vlan .vlan_tci = rte_cpu_to_be_16 (rtem -> vlan_tci );
1630+ } else {
1631+ ctx .vlan .stripped = 0 ;
1632+ ctx .vlan .vlan_tci = 0 ;
1633+ }
1634+ cur_tsc = rte_rdtsc ();
1635+ ret = (* packet_dispatcher_with_context )(data , & len , queue_id , nb_queues , ctx );
1636+ usr_cb_tsc += rte_rdtsc () - cur_tsc ;
1637+ }
1638+
16211639 if (ret == FF_DISPATCH_RESPONSE ) {
16221640 rte_pktmbuf_pkt_len (rtem ) = rte_pktmbuf_data_len (rtem ) = len ;
16231641 /*
@@ -2772,6 +2790,12 @@ ff_regist_packet_dispatcher(dispatch_func_t func)
27722790 packet_dispatcher = func ;
27732791}
27742792
2793+ void
2794+ ff_regist_packet_dispatcher_context (dispatch_func_context_t func )
2795+ {
2796+ packet_dispatcher_with_context = func ;
2797+ }
2798+
27752799uint64_t
27762800ff_get_tsc_ns ()
27772801{
0 commit comments