Comments inline. Regards Sunil Kumar Kori
>-----Original Message----- >From: pbhagavat...@marvell.com <pbhagavat...@marvell.com> >Sent: Tuesday, March 24, 2020 6:05 PM >To: Jerin Jacob Kollanukkaran <jer...@marvell.com>; Marko Kovacevic ><marko.kovace...@intel.com>; Ori Kam <or...@mellanox.com>; Bruce >Richardson <bruce.richard...@intel.com>; Radu Nicolau ><radu.nico...@intel.com>; Akhil Goyal <akhil.go...@nxp.com>; Tomasz >Kantecki <tomasz.kante...@intel.com>; Sunil Kumar Kori ><sk...@marvell.com>; Pavan Nikhilesh Bhagavatula ><pbhagavat...@marvell.com>; John McNamara ><john.mcnam...@intel.com> >Cc: dev@dpdk.org >Subject: [dpdk-dev] [PATCH] examples/l2fwd-event: add option to configure >port pairs > >From: Pavan Nikhilesh <pbhagavat...@marvell.com> > >Current l2fwd-event application statically configures adjacent ports as >destination ports for forwarding the traffic. > >Add a config option to pass the forwarding port pair mapping which allows >the user to configure forwarding port mapping. > >If no config argument is specified, destination port map is not changed and >traffic gets forwarded with existing mapping. > >To align port/queue configuration of each lcore with destination port map, >port/queue configuration of each lcore gets modified when config option is >specificed. > >Ex: ./l2fwd-event -c 0xff -- -p 0x3f -q 2 --config="(0,3)(1,4)(2,5)" > >With above config option, traffic received from portid = 0 gets forwarded to >port = 3 and vice versa, similarly traffic gets forwarded on other port pairs >(1,4) and (2,5). > Is this config required to be updated for l2fwd also ? >Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com> >--- >updating enabled, diff --git a/examples/l2fwd-event/l2fwd_common.h >b/examples/l2fwd-event/l2fwd_common.h >index 7e33ee749..4e8b2fe14 100644 >--- a/examples/l2fwd-event/l2fwd_common.h >+++ b/examples/l2fwd-event/l2fwd_common.h >@@ -69,6 +69,7 @@ struct l2fwd_resources { > uint8_t sched_type; > uint8_t mac_updating; > uint8_t rx_queue_per_lcore; >+ uint8_t port_pairs; It can be changed to bool. > uint16_t nb_rxd; > uint16_t nb_txd; > uint32_t enabled_port_mask; >diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c >index 89a6bb9a4..92890d1ae 100644 >--- a/examples/l2fwd-event/main.c >+++ b/examples/l2fwd-event/main.c >@@ -2,6 +2,8 @@ > * Copyright(C) 2019 Marvell International Ltd. > */ > >+#include <rte_string_fns.h> >+ > #include "l2fwd_event.h" > #include "l2fwd_poll.h" > >@@ -22,7 +24,9 @@ l2fwd_event_usage(const char *prgname) > " Default mode = eventdev\n" > " --eventq-sched: Event queue schedule type, ordered, atomic or >parallel.\n" > " Default: atomic\n" >- " Valid only if --mode=eventdev\n\n", >+ " Valid only if --mode=eventdev\n" >+ " --config: Configure forwarding port pair mapping\n" >+ " Default: alternate port pairs\n\n", > prgname); > } > >+l2fwd_event_parse_args(int argc, char **argv, struct l2fwd_resources >+*rsrc) > { > int mac_updating = 1; > struct option lgopts[] = { >@@ -134,12 +202,18 @@ l2fwd_event_parse_args(int argc, char **argv, > > CMD_LINE_OPT_MODE_NUM}, > { CMD_LINE_OPT_EVENTQ_SCHED, required_argument, NULL, > > CMD_LINE_OPT_EVENTQ_SCHED_NUM}, >+ { CMD_LINE_OPT_PORT_PAIR_CONF, required_argument, >NULL, >+ > CMD_LINE_OPT_PORT_PAIR_CONF_NUM}, > {NULL, 0, 0, 0} > }; > int opt, ret, timer_secs; > char *prgname = argv[0]; >- char **argvopt; >+ uint16_t port_id; > int option_index; >+ char **argvopt; New line is required. >+ /* reset l2fwd_dst_ports */ >+ for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++) >+ rsrc->dst_ports[port_id] = UINT32_MAX; > > argvopt = argv;