From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5A17AA00C2; Mon, 22 Aug 2022 07:31:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33B3B41132; Mon, 22 Aug 2022 07:31:30 +0200 (CEST) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by mails.dpdk.org (Postfix) with ESMTP id 521B2410FA for ; Mon, 22 Aug 2022 07:31:28 +0200 (CEST) Received: by mail-io1-f52.google.com with SMTP id z72so7473022iof.12 for ; Sun, 21 Aug 2022 22:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20210112.gappssmtp.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc; bh=9LteuDdzJPnC7YIbrFNR4OxUQVRBDTb4wFsym7NLM+k=; b=1AqVUdp9yjmHqUkWYJvfWLRR/jftfwj9uBFdisCMrmNms9t105GkYP7YB3kTfdJ3ib tlA7/6x5Np9JGlyMGi/UoC1Fh3OjVSSmW8mHOR8MuXl27rngYleQ1USQTP24ggm85kJ2 IbaRXXwXAcMcNOqhR1e/dTFC/Lsj0Sk8Ul1FJouu3IsyBcN3NK+QBpGEmAkb6XMhUIv/ TyO615wO7DxU5+sTVamX7WsEyXrMVhj08NLjDYBvJEMBErruibZTSsvijIxmJ45IELKy xn0OJcZDSIhU5Lti389AqTfqdkCSQsjEiZRAPk3kkCUCUS0isrDdE9+3zq85HhqzxX0r D8ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc; bh=9LteuDdzJPnC7YIbrFNR4OxUQVRBDTb4wFsym7NLM+k=; b=MQ9xHgVnHXGuv+sYK2g1UVEtzxg/1rrvGbE5br8sy9PsQfQbsf2wmW62TYsuhK1L1s Cpvm93txN0h4HkLCyMu6w2x2Jqccf62Oeq9xKnpa+t3mYpZpDnCncZboiWNJpUJEIXA6 TuxFAH6j94yI200Ho8g6X2Ky9zQove5QtrYG6tUUL3u+mRxZLqWbid/bdz/Az0Gh9n4q c+d0Z1jWy956Xsq3mzbbvILqE1pV6M0KR7I5ZbfDmOqwLXXXTbBzwig/nQ7ffakPbSMS qj85FGe2Pnz+gc8l6Cshba2IUd/Z5Hxww7mih4OxiOztbEa3L02Rnq1ZV0vBvha/UPDK E6Uw== X-Gm-Message-State: ACgBeo38su7vi4GbgDP4Q3fFhc8v+pbbt78+zUox2OX9Fp/LrIRga1Jd 0KiM7szPznY/N4QVSVXyQZETK70I3FlGsJlbB66932ikAkt9SA== X-Google-Smtp-Source: AA6agR4cJc6g6xKh2XXxD9f1d4mHZ9wE7yEKM1R9D99vw5tTP/iWKn0kxIbJqDrYXr4D0Rn7kxvmQIniPjYxdiUU5ag= X-Received: by 2002:a05:6638:f85:b0:349:be20:eebf with SMTP id h5-20020a0566380f8500b00349be20eebfmr4290295jal.72.1661146287484; Sun, 21 Aug 2022 22:31:27 -0700 (PDT) MIME-Version: 1.0 References: <20220525055042.123144-1-jawad.hussain@emumba.com> <20220811094508.97467-1-jawad.hussain@emumba.com> In-Reply-To: <20220811094508.97467-1-jawad.hussain@emumba.com> From: Muhammad Jawad Hussain Date: Mon, 22 Aug 2022 10:31:16 +0500 Message-ID: Subject: Re: [PATCH v2] examples/ethtool: adds promiscuous mode functionality To: dev@dpdk.org Content-Type: multipart/alternative; boundary="00000000000062c8fa05e6cdc296" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --00000000000062c8fa05e6cdc296 Content-Type: text/plain; charset="UTF-8" Hi, The following test is failing on my patch and its is not related to my changes, can u please re-run it. test: ci/iol-x86_64-unit-testing Thanks Regards, Jawad On Thu, Aug 11, 2022 at 2:45 PM Muhammad Jawad Hussain < jawad.hussain@emumba.com> wrote: > ethtool did not have promiscuous mode functioality previously > which is needed for viewing broadcast and multicast packets. > This patch allows user to turn on/off promiscuous mode on > each port through command line. > > Signed-off-by: Muhammad Jawad Hussain > --- > doc/guides/sample_app_ug/ethtool.rst | 1 + > examples/ethtool/ethtool-app/ethapp.c | 79 ++++++++++++++++++++++++++- > examples/ethtool/lib/rte_ethtool.c | 24 ++++++++ > examples/ethtool/lib/rte_ethtool.h | 2 + > 4 files changed, 104 insertions(+), 2 deletions(-) > > diff --git a/doc/guides/sample_app_ug/ethtool.rst > b/doc/guides/sample_app_ug/ethtool.rst > index 159e9e0639..6edd9940b8 100644 > --- a/doc/guides/sample_app_ug/ethtool.rst > +++ b/doc/guides/sample_app_ug/ethtool.rst > @@ -54,6 +54,7 @@ they do as follows: > * ``regs``: Dump port register(s) to file > * ``ringparam``: Get/set ring parameters > * ``rxmode``: Toggle port Rx mode > +* ``set promisc``: Enable/Disable promiscuous mode on ports > * ``stop``: Stop port > * ``validate``: Check that given MAC address is valid unicast address > * ``vlan``: Add/remove VLAN id > diff --git a/examples/ethtool/ethtool-app/ethapp.c > b/examples/ethtool/ethtool-app/ethapp.c > index 78e86534e8..f89e4c4cf0 100644 > --- a/examples/ethtool/ethtool-app/ethapp.c > +++ b/examples/ethtool/ethtool-app/ethapp.c > @@ -13,8 +13,16 @@ > #include "ethapp.h" > > #define EEPROM_DUMP_CHUNKSIZE 1024 > - > - > +typedef uint16_t portid_t; > + > +/* *** PROMISC_MODE *** */ > +struct cmd_set_promisc_mode_result { > + cmdline_fixed_string_t set; > + cmdline_fixed_string_t promisc; > + cmdline_fixed_string_t port_all; /* valid if "allports" argument > == 1 */ > + uint16_t port_num; /* valid if "allports" argument > == 0 */ > + cmdline_fixed_string_t mode; > +}; > struct pcmd_get_params { > cmdline_fixed_string_t cmd; > }; > @@ -133,6 +141,22 @@ cmdline_parse_token_string_t pcmd_vlan_token_mode = > cmdline_parse_token_num_t pcmd_vlan_token_vid = > TOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, vid, RTE_UINT16); > > +/* promisc mode */ > + > +cmdline_parse_token_string_t cmd_setpromisc_set = > + TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result, set, > "set"); > +cmdline_parse_token_string_t cmd_setpromisc_promisc = > + TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result, > promisc, > + "promisc"); > +cmdline_parse_token_string_t cmd_setpromisc_portall = > + TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result, > port_all, > + "all"); > +cmdline_parse_token_num_t cmd_setpromisc_portnum = > + TOKEN_NUM_INITIALIZER(struct cmd_set_promisc_mode_result, port_num, > + RTE_UINT16); > +cmdline_parse_token_string_t cmd_setpromisc_mode = > + TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result, mode, > + "on#off"); > > static void > pcmd_quit_callback(__rte_unused void *ptr_params, > @@ -142,6 +166,30 @@ pcmd_quit_callback(__rte_unused void *ptr_params, > cmdline_quit(ctx); > } > > +static void pcmd_set_promisc_mode_parsed(void *ptr_params, > + __rte_unused struct cmdline *ctx, > + void *allports) > +{ > + struct cmd_set_promisc_mode_result *res = ptr_params; > + int enable; > + portid_t i; > + if (!strcmp(res->mode, "on")) > + enable = 1; > + else > + enable = 0; > + > + /* all ports */ > + if (allports) { > + RTE_ETH_FOREACH_DEV(i) > + eth_set_promisc_mode(i, enable); > + } else { > + eth_set_promisc_mode(res->port_num, enable); > + } > + if (enable) > + printf("Promisc mode Enabled\n"); > + else > + printf("Promisc mode Disabled\n"); > +} > > static void > pcmd_drvinfo_callback(__rte_unused void *ptr_params, > @@ -869,6 +917,31 @@ cmdline_parse_inst_t pcmd_vlan = { > }, > }; > > +cmdline_parse_inst_t cmd_set_promisc_mode_all = { > + .f = pcmd_set_promisc_mode_parsed, > + .data = (void *)1, > + .help_str = "set promisc all \n Set promisc mode for > all ports", > + .tokens = { > + (void *)&cmd_setpromisc_set, > + (void *)&cmd_setpromisc_promisc, > + (void *)&cmd_setpromisc_portall, > + (void *)&cmd_setpromisc_mode, > + NULL, > + }, > +}; > + > +cmdline_parse_inst_t cmd_set_promisc_mode_one = { > + .f = pcmd_set_promisc_mode_parsed, > + .data = (void *)0, > + .help_str = "set promisc \n Set promisc mode > on port_id", > + .tokens = { > + (void *)&cmd_setpromisc_set, > + (void *)&cmd_setpromisc_promisc, > + (void *)&cmd_setpromisc_portnum, > + (void *)&cmd_setpromisc_mode, > + NULL, > + }, > +}; > > cmdline_parse_ctx_t list_prompt_commands[] = { > (cmdline_parse_inst_t *)&pcmd_drvinfo, > @@ -886,6 +959,8 @@ cmdline_parse_ctx_t list_prompt_commands[] = { > (cmdline_parse_inst_t *)&pcmd_ringparam, > (cmdline_parse_inst_t *)&pcmd_ringparam_set, > (cmdline_parse_inst_t *)&pcmd_rxmode, > + (cmdline_parse_inst_t *)&cmd_set_promisc_mode_one, > + (cmdline_parse_inst_t *)&cmd_set_promisc_mode_all, > (cmdline_parse_inst_t *)&pcmd_stop, > (cmdline_parse_inst_t *)&pcmd_validate, > (cmdline_parse_inst_t *)&pcmd_vlan, > diff --git a/examples/ethtool/lib/rte_ethtool.c > b/examples/ethtool/lib/rte_ethtool.c > index ffaad96498..2fb47471cb 100644 > --- a/examples/ethtool/lib/rte_ethtool.c > +++ b/examples/ethtool/lib/rte_ethtool.c > @@ -18,6 +18,30 @@ > #define PKTPOOL_CACHE 32 > > > +int > +eth_set_promisc_mode(uint16_t port, int enable) > +{ > + int ret; > + > + > + if (enable) > + ret = rte_eth_promiscuous_enable(port); > + else > + ret = rte_eth_promiscuous_disable(port); > + > + if (ret != 0) { > + fprintf(stderr, > + "Error during %s promiscuous mode for port %u: > %s\n", > + enable ? "enabling" : "disabling", > + port, rte_strerror(-ret)); > + return 0; > + } else > + return 1; > +} > + > + > + > + > int > rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo) > { > diff --git a/examples/ethtool/lib/rte_ethtool.h > b/examples/ethtool/lib/rte_ethtool.h > index d27e0102b1..2b19907b4d 100644 > --- a/examples/ethtool/lib/rte_ethtool.h > +++ b/examples/ethtool/lib/rte_ethtool.h > @@ -408,6 +408,8 @@ int rte_ethtool_get_ringparam(uint16_t port_id, > int rte_ethtool_set_ringparam(uint16_t port_id, > struct ethtool_ringparam *ring_param); > > +int > +eth_set_promisc_mode(uint16_t port, int enable); > > #ifdef __cplusplus > } > -- > 2.32.0 > > --00000000000062c8fa05e6cdc296 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
The following test is failing on my patch and its = is not related to my changes, can u please re-run it.
test:=C2=A0=
ci/iol-x86_64-unit-testing

Thanks

Regards,
Jawad

=
On Thu= , Aug 11, 2022 at 2:45 PM Muhammad Jawad Hussain <jawad.hussain@emumba.com> wrote:
ethtool did not have promiscu= ous mode functioality previously
which is needed for viewing broadcast and multicast packets.
This patch allows user to turn on/off promiscuous mode on
each port through command line.

Signed-off-by: Muhammad Jawad Hussain <jawad.hussain@emumba.com>
---
=C2=A0doc/guides/sample_app_ug/ethtool.rst=C2=A0 |=C2=A0 1 +
=C2=A0examples/ethtool/ethtool-app/ethapp.c | 79 ++++++++++++++++++++++++++= -
=C2=A0examples/ethtool/lib/rte_ethtool.c=C2=A0 =C2=A0 | 24 ++++++++
=C2=A0examples/ethtool/lib/rte_ethtool.h=C2=A0 =C2=A0 |=C2=A0 2 +
=C2=A04 files changed, 104 insertions(+), 2 deletions(-)

diff --git a/doc/guides/sample_app_ug/ethtool.rst b/doc/guides/sample_app_u= g/ethtool.rst
index 159e9e0639..6edd9940b8 100644
--- a/doc/guides/sample_app_ug/ethtool.rst
+++ b/doc/guides/sample_app_ug/ethtool.rst
@@ -54,6 +54,7 @@ they do as follows:
=C2=A0* ``regs``: Dump port register(s) to file
=C2=A0* ``ringparam``: Get/set ring parameters
=C2=A0* ``rxmode``: Toggle port Rx mode
+* ``set promisc``: Enable/Disable promiscuous mode on ports
=C2=A0* ``stop``: Stop port
=C2=A0* ``validate``: Check that given MAC address is valid unicast address=
=C2=A0* ``vlan``: Add/remove VLAN id
diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethto= ol-app/ethapp.c
index 78e86534e8..f89e4c4cf0 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -13,8 +13,16 @@
=C2=A0#include "ethapp.h"

=C2=A0#define EEPROM_DUMP_CHUNKSIZE 1024
-
-
+typedef uint16_t portid_t;
+
+/* *** PROMISC_MODE *** */
+struct cmd_set_promisc_mode_result {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0cmdline_fixed_string_t set;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0cmdline_fixed_string_t promisc;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0cmdline_fixed_string_t port_all; /* valid if &q= uot;allports" argument =3D=3D 1 */
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uint16_t port_num;=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0/* valid if "allports" argument =3D=3D= 0 */
+=C2=A0 =C2=A0 =C2=A0 =C2=A0cmdline_fixed_string_t mode;
+};
=C2=A0struct pcmd_get_params {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cmdline_fixed_string_t cmd;
=C2=A0};
@@ -133,6 +141,22 @@ cmdline_parse_token_string_t pcmd_vlan_token_mode =3D<= br> =C2=A0cmdline_parse_token_num_t pcmd_vlan_token_vid =3D
=C2=A0 =C2=A0 =C2=A0 =C2=A0 TOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, = vid, RTE_UINT16);

+/* promisc mode */
+
+cmdline_parse_token_string_t cmd_setpromisc_set =3D
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TOKEN_STRING_INITIALIZER(struct cmd_set_promisc= _mode_result, set, "set");
+cmdline_parse_token_string_t cmd_setpromisc_promisc =3D
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TOKEN_STRING_INITIALIZER(struct cmd_set_promisc= _mode_result, promisc,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "promisc");
+cmdline_parse_token_string_t cmd_setpromisc_portall =3D
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TOKEN_STRING_INITIALIZER(struct cmd_set_promisc= _mode_result, port_all,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "all");
+cmdline_parse_token_num_t cmd_setpromisc_portnum =3D
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TOKEN_NUM_INITIALIZER(struct cmd_set_promisc_mo= de_result, port_num,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_UINT16);
+cmdline_parse_token_string_t cmd_setpromisc_mode =3D
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TOKEN_STRING_INITIALIZER(struct cmd_set_promisc= _mode_result, mode,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "on#off");

=C2=A0static void
=C2=A0pcmd_quit_callback(__rte_unused void *ptr_params,
@@ -142,6 +166,30 @@ pcmd_quit_callback(__rte_unused void *ptr_params,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cmdline_quit(ctx);
=C2=A0}

+static void pcmd_set_promisc_mode_parsed(void *ptr_params,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__rte_unu= sed struct cmdline *ctx,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0void *all= ports)
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct cmd_set_promisc_mode_result *res =3D ptr= _params;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int enable;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0portid_t i;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!strcmp(res->mode, "on"))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0enable =3D 1;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0enable =3D 0;
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* all ports */
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (allports) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_ETH_FOREACH_DEV= (i)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0eth_set_promisc_mode(i, enable);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0} else {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0eth_set_promisc_mod= e(res->port_num, enable);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (enable)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("Promis= c mode Enabled\n");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("Promis= c mode Disabled\n");
+}

=C2=A0static void
=C2=A0pcmd_drvinfo_callback(__rte_unused void *ptr_params,
@@ -869,6 +917,31 @@ cmdline_parse_inst_t pcmd_vlan =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 },
=C2=A0};

+cmdline_parse_inst_t cmd_set_promisc_mode_all =3D {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.f =3D pcmd_set_promisc_mode_parsed,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.data =3D (void *)1,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.help_str =3D "set promisc all <on|off&= gt;\n=C2=A0 =C2=A0 =C2=A0Set promisc mode for all ports",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.tokens =3D {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(void *)&cmd_se= tpromisc_set,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(void *)&cmd_se= tpromisc_promisc,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(void *)&cmd_se= tpromisc_portall,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(void *)&cmd_se= tpromisc_mode,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0},
+};
+
+cmdline_parse_inst_t cmd_set_promisc_mode_one =3D {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.f =3D pcmd_set_promisc_mode_parsed,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.data =3D (void *)0,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.help_str =3D "set promisc <port_id>= <on|off>\n=C2=A0 =C2=A0 =C2=A0Set promisc mode on port_id",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.tokens =3D {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(void *)&cmd_se= tpromisc_set,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(void *)&cmd_se= tpromisc_promisc,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(void *)&cmd_se= tpromisc_portnum,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(void *)&cmd_se= tpromisc_mode,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0},
+};

=C2=A0cmdline_parse_ctx_t list_prompt_commands[] =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_drvinfo,
@@ -886,6 +959,8 @@ cmdline_parse_ctx_t list_prompt_commands[] =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_ringparam, =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_ringparam_set= ,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_rxmode,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(cmdline_parse_inst_t *)&cmd_set_promisc_mo= de_one,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(cmdline_parse_inst_t *)&cmd_set_promisc_mo= de_all,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_stop,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_validate,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_vlan,
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_= ethtool.c
index ffaad96498..2fb47471cb 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -18,6 +18,30 @@
=C2=A0#define PKTPOOL_CACHE 32


+int
+eth_set_promisc_mode(uint16_t port, int enable)
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int ret;
+
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (enable)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ret =3D rte_eth_pro= miscuous_enable(port);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ret =3D rte_eth_pro= miscuous_disable(port);
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret !=3D 0) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fprintf(stderr,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0"Error during %s promiscuous mode for port %u: %s\n", +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0enable ? "enabling" : "disabling",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0port, rte_strerror(-ret));
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0return 0;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0} else
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1;
+}
+
+
+
+
=C2=A0int
=C2=A0rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drv= info)
=C2=A0{
diff --git a/examples/ethtool/lib/rte_ethtool.h b/examples/ethtool/lib/rte_= ethtool.h
index d27e0102b1..2b19907b4d 100644
--- a/examples/ethtool/lib/rte_ethtool.h
+++ b/examples/ethtool/lib/rte_ethtool.h
@@ -408,6 +408,8 @@ int rte_ethtool_get_ringparam(uint16_t port_id,
=C2=A0int rte_ethtool_set_ringparam(uint16_t port_id,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct ethtool_ringparam *ring_param);

+int
+eth_set_promisc_mode(uint16_t port, int enable);

=C2=A0#ifdef __cplusplus
=C2=A0}
--
2.32.0

--00000000000062c8fa05e6cdc296--