> -----Original Message----- > From: Rakesh Kudurumalla > Sent: Friday, December 15, 2023 2:46 PM > To: Sunil Kumar Kori ; Rakesh Kudurumalla > > Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran ; Nithin > Kumar Dabilpuram > Subject: [PATCH v5 3/3] app/graph: implement port forward usecase > > Added portforward usecase.In this usecase packets received Rx port is > forwarded to respective Tx port. > > Signed-off-by: Rakesh Kudurumalla > --- > app/graph/ethdev.c | 13 ++ > app/graph/ethdev.h | 1 + > app/graph/examples/l2fwd.cli | 41 +++++ > app/graph/examples/l2fwd_pcap.cli | 37 +++++ > app/graph/graph.c | 8 +- > app/graph/l2fwd.c | 152 +++++++++++++++++++ > app/graph/l2fwd.h | 11 ++ > app/graph/meson.build | 1 + > app/graph/module_api.h | 1 + > doc/guides/tools/graph.rst | 27 ++++ > doc/guides/tools/img/graph-usecase-l2fwd.svg | 92 +++++++++++ > 11 files changed, 383 insertions(+), 1 deletion(-) create mode 100644 > app/graph/examples/l2fwd.cli create mode 100644 > app/graph/examples/l2fwd_pcap.cli create mode 100644 > app/graph/l2fwd.c create mode 100644 app/graph/l2fwd.h create mode > 100644 doc/guides/tools/img/graph-usecase-l2fwd.svg > > diff --git a/app/graph/ethdev.c b/app/graph/ethdev.c index > bb502a6134..9a89bd3e1d 100644 > --- a/app/graph/ethdev.c > +++ b/app/graph/ethdev.c > @@ -76,6 +76,19 @@ ethdev_port_by_id(uint16_t port_id) > return NULL; > } > > +int16_t > +find_txport_by_rxport(uint16_t portid_rx) { > + int portid = -EINVAL; > + struct ethdev *port; > + > + port = ethdev_port_by_id(portid_rx); > + if (port) > + portid = port->tx_port_id; > + > + return portid; > +} > + > void * > ethdev_mempool_list_by_portid(uint16_t portid) { diff --git > a/app/graph/ethdev.h b/app/graph/ethdev.h index > 836052046b..946e14d801 100644 > --- a/app/graph/ethdev.h > +++ b/app/graph/ethdev.h > @@ -33,6 +33,7 @@ extern uint32_t enabled_port_mask; > > void ethdev_start(void); > void ethdev_stop(void); > +int16_t find_txport_by_rxport(uint16_t portid_rx); This function is exposed to other modules in application. Please align this name with other function's name. > void *ethdev_mempool_list_by_portid(uint16_t portid); int16_t > ethdev_portid_by_ip4(uint32_t ip, uint32_t mask); int16_t > ethdev_portid_by_ip6(uint8_t *ip, uint8_t *mask); diff --git > > @@ -110,6 +124,12 @@ For current use case, following routing table is > used: > On the successful execution of ``l3fwd.cli`` or ``l3fwd_pcap.cli``, user > needs to send traffic with mentioned DIP. > > +``l2fwd.cli`` and ``l2fwd_pcap.cli`` creates setup with two network > ports. > +Packet received on one port is forwarded to other port. > + > +On the successful execution of ``l2fwd.cli`` or ``l2fwd_pcap.cli``, > +user needs to send traffic on RX port. > + This is para is not needed. > 2.25.1