On Tue, Sep 27, 2022 at 8:18 AM Feifei Wang <feifei.wa...@arm.com> wrote: > > Enable direct rearm mode in l3fwd. Users can use parameters: > '--direct-rearm=(rx_portid,rx_queueid,tx_portid,tx_queueid)' > to enable direct rearm. > > Suggested-by: Honnappa Nagarahalli <honnappa.nagaraha...@arm.com> > Signed-off-by: Feifei Wang <feifei.wa...@arm.com> > Reviewed-by: Ruifeng Wang <ruifeng.w...@arm.com> > Reviewed-by: Honnappa Nagarahalli <honnappa.nagaraha...@arm.com> > --- > examples/l3fwd/l3fwd.h | 12 +++++ > examples/l3fwd/l3fwd_lpm.c | 22 +++++++++ > examples/l3fwd/main.c | 94 +++++++++++++++++++++++++++++++++++++- > 3 files changed, 127 insertions(+), 1 deletion(-) > > diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h > index 40b5f32a9e..db097e344c 100644 > --- a/examples/l3fwd/l3fwd.h > +++ b/examples/l3fwd/l3fwd.h > @@ -57,6 +57,10 @@ > #endif > #define HASH_ENTRY_NUMBER_DEFAULT 16 > > +/* MAX number of direct rearm mapping entry */ > +#define MAX_DIRECT_REARM_ENTRY_NUMBER 16 > +#define MAX_DIRECT_REARM_QUEUE_PER_PORT 8 > + > struct parm_cfg { > const char *rule_ipv4_name; > const char *rule_ipv6_name; > @@ -114,6 +118,14 @@ extern struct parm_cfg parm_config; > > extern struct acl_algorithms acl_alg[]; > > +/* Used in direct rearm mode */ > +extern bool enabled_direct_rearm; > +extern uint8_t direct_rearm_entry_number; > +extern bool > queue_enabled_direct_rearm[RTE_MAX_ETHPORTS][MAX_DIRECT_REARM_QUEUE_PER_PORT]; > +extern uint16_t > direct_rearm_map_tx_port[RTE_MAX_ETHPORTS][MAX_DIRECT_REARM_QUEUE_PER_PORT]; > +extern uint16_t > direct_rearm_map_tx_queue[RTE_MAX_ETHPORTS][MAX_DIRECT_REARM_QUEUE_PER_PORT]; > +extern uint8_t > direct_rearm_entry_idx[RTE_MAX_ETHPORTS][MAX_DIRECT_REARM_QUEUE_PER_PORT]; > + > /* Send burst of packets on an output interface */ > static inline int > send_burst(struct lcore_conf *qconf, uint16_t n, uint16_t port) > diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c > index 22d7f61a42..973fe70aae 100644 > --- a/examples/l3fwd/l3fwd_lpm.c > +++ b/examples/l3fwd/l3fwd_lpm.c > @@ -150,6 +150,8 @@ lpm_main_loop(__rte_unused void *dummy)
> @@ -205,6 +221,12 @@ lpm_main_loop(__rte_unused void *dummy) > for (i = 0; i < n_rx_q; ++i) { > portid = qconf->rx_queue_list[i].port_id; > queueid = qconf->rx_queue_list[i].queue_id; > + > + if (queue_enabled_direct_rearm[portid][queueid]) { IMO, We should not change fastpath code that impacts performance on other targets for a feature which has a very constraint use case. Also need for expressing [1], kind of defeat the purpose LPM table populated. IMO, If we need to add a test case for this API, testpmd would be an ideal place with a dedicated fwd_engine just for this. [1] > + " --direct-rearm (rx_port, rx_queue, tx_port, tx_queue): Put > Tx queue sw-ring buffers into Rx queue\n"