@@ -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
@@ -1662,10 +1663,27 @@ process_packets(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **bufs,
16621663 ff_traffic .rx_bytes += rte_pktmbuf_pkt_len (rtem );
16631664 }
16641665
1665- if (!pkts_from_ring && packet_dispatcher ) {
1666- uint64_t cur_tsc = rte_rdtsc ();
1667- int ret = (* packet_dispatcher )(data , & len , queue_id , nb_queues );
1668- usr_cb_tsc += rte_rdtsc () - cur_tsc ;
1666+ if (!pkts_from_ring && (packet_dispatcher || packet_dispatcher_with_context )) {
1667+ uint64_t cur_tsc ;
1668+ int ret ;
1669+ if (packet_dispatcher ) {
1670+ cur_tsc = rte_rdtsc ();
1671+ ret = (* packet_dispatcher )(data , & len , queue_id , nb_queues );
1672+ usr_cb_tsc += rte_rdtsc () - cur_tsc ;
1673+ } else if (packet_dispatcher_with_context ) {
1674+ struct ff_dispatcher_context ctx ;
1675+ if (rtem -> ol_flags & RTE_MBUF_F_RX_VLAN_STRIPPED ) {
1676+ ctx .vlan .stripped = 1 ;
1677+ ctx .vlan .vlan_tci = rte_cpu_to_be_16 (rtem -> vlan_tci );
1678+ } else {
1679+ ctx .vlan .stripped = 0 ;
1680+ ctx .vlan .vlan_tci = 0 ;
1681+ }
1682+ cur_tsc = rte_rdtsc ();
1683+ ret = (* packet_dispatcher_with_context )(data , & len , queue_id , nb_queues , ctx );
1684+ usr_cb_tsc += rte_rdtsc () - cur_tsc ;
1685+ }
1686+
16691687 if (ret == FF_DISPATCH_RESPONSE ) {
16701688 rte_pktmbuf_pkt_len (rtem ) = rte_pktmbuf_data_len (rtem ) = len ;
16711689 /*
@@ -2818,6 +2836,12 @@ ff_regist_packet_dispatcher(dispatch_func_t func)
28182836 packet_dispatcher = func ;
28192837}
28202838
2839+ void
2840+ ff_regist_packet_dispatcher_context (dispatch_func_context_t func )
2841+ {
2842+ packet_dispatcher_with_context = func ;
2843+ }
2844+
28212845uint64_t
28222846ff_get_tsc_ns ()
28232847{
0 commit comments