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 C522342AE5; Fri, 12 May 2023 14:35:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5585C42D1A; Fri, 12 May 2023 14:35:49 +0200 (CEST) Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) by mails.dpdk.org (Postfix) with ESMTP id CCAB540DF6 for ; Thu, 11 May 2023 18:03:29 +0200 (CEST) Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3942c6584f0so736071b6e.3 for ; Thu, 11 May 2023 09:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netgate.com; s=google; t=1683821009; x=1686413009; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=Ueo5Av5ST3sM/BlWtvdlsoxDPq3x71IHePHYCp9Yvmo=; b=rL/wQSoj9bxtaiWhPXtrMetdmNNG6xa8nnn6qdlJ0WiagKMeNSD+wJHLgPBWjhgBAr EYS1G59yTLeTMMVo16ZlNmjuYKtBMGmPwI8R0Sa1cHCFpdrizSayDN9+rQ9pi1qTbXsF mBgI2dhjEwSVmurAGEnQn3Jp3TZ2OeHRztUIA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683821009; x=1686413009; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ueo5Av5ST3sM/BlWtvdlsoxDPq3x71IHePHYCp9Yvmo=; b=hr/AEmXeqt2k7RkJ/8K1Qtx8rc1y/1b5ySeUUs4AEOLXPLJl4tRSGZlQUQJxDXlQYC adKPx6x6XKz6FsezG3NKiy+V6EONtmMAXMcpIGLTfgtVQOxqUu09t3TnUm34f4x8Okdq OdFxdadDa4qYfPQM8o5Ei7mpBISUsNjBQAU8g/gXMiF6coiUlne7vWeMOlQ8BWOjL5ys 1ax4hnAN5u8wVS5ccgofnVwL/Bcat5OxRN4NtY1fPsj2FYI1/MFwBv2HyvyjD1SmPWHW kUqXItV1849KrbY0935CB51BM6gW00prw9+c2w5vVyogK9uDMMDKIX6p9WQVUCh3IEFe Rfsg== X-Gm-Message-State: AC+VfDwLelgdlTjtNXvijDNIijKbWP8jEQchBN0XI+btXjSa50mIBWQ+ WpjdPjDU57fOcETzZLS6vFeaqg== X-Google-Smtp-Source: ACHHUZ4NsEQKyDMs70M1RRsbtRgqdLSNlnLs1pvmu+durhmgOmZspZP+0lF9X43mcQeD2TYyIkvqXw== X-Received: by 2002:a05:6870:d2ac:b0:184:3308:881d with SMTP id d44-20020a056870d2ac00b001843308881dmr11058208oae.40.1683821007689; Thu, 11 May 2023 09:03:27 -0700 (PDT) Received: from smtpclient.apple ([136.49.177.169]) by smtp.gmail.com with ESMTPSA id v20-20020a056870e29400b001723f29f6e2sm6680331oad.37.2023.05.11.09.03.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 May 2023 09:03:27 -0700 (PDT) From: Matthew Smith Message-Id: <703A97AB-7E1C-4C67-874F-E8BE5747988E@netgate.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_59D94F80-8594-4E85-8C42-43D03D719BF7" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: Re: [PATCH v4] net/i40e: support enable/disable source pruning Date: Thu, 11 May 2023 11:03:26 -0500 In-Reply-To: <20230419052456.62752-1-mingjinx.ye@intel.com> Cc: "dev@dpdk.org" , "Yang, Qiming" , "Zhou, YidingX" , "Zhang, Yuying" , "Xing, Beilei" To: "Ye, MingjinX" References: <20230417015140.40421-1-mingjinx.ye@intel.com> <20230419052456.62752-1-mingjinx.ye@intel.com> X-Mailer: Apple Mail (2.3696.120.41.1.3) X-Mailman-Approved-At: Fri, 12 May 2023 14:35:48 +0200 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 --Apple-Mail=_59D94F80-8594-4E85-8C42-43D03D719BF7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 19, 2023, at 12:24 AM, Ye, MingjinX = wrote: >=20 > VRRP advertisement packets are dropped on i40e PF device because > when a MAC address is added to a device, packets originating from > that MAC address are dropped. > This patch fixes the bug by disabling source pruning by default, > and adds a PMD specific API to enable/disable source pruning. >=20 > Bugzilla ID: 648 >=20 > Signed-off-by: Mingjin Ye > --- > v3: The i40e specific commands are moved to > drivers/net/i40e/i40e_testpmd.c. > -- > v4: Modify the commit log. > --- > drivers/net/i40e/i40e_ethdev.c | 43 ++++++++++++++++ > drivers/net/i40e/i40e_ethdev.h | 1 + > drivers/net/i40e/i40e_testpmd.c | 88 +++++++++++++++++++++++++++++++++ > drivers/net/i40e/rte_pmd_i40e.c | 20 ++++++++ > drivers/net/i40e/rte_pmd_i40e.h | 17 +++++++ > drivers/net/i40e/version.map | 1 + > 6 files changed, 170 insertions(+) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c = b/drivers/net/i40e/i40e_ethdev.c > index cb0070f94b..90d8e5a8bc 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -5647,6 +5647,46 @@ i40e_enable_pf_lb(struct i40e_pf *pf) > hw->aq.asq_last_status); > } >=20 > +/* i40e_pf_set_source_prune > + * @pf: pointer to the pf structure > + * @on: Enable/disable source prune > + * > + * set source prune on pf > + */ > +int > +i40e_pf_set_source_prune(struct i40e_pf *pf, int on) > +{ > + struct i40e_hw *hw =3D I40E_PF_TO_HW(pf); > + struct i40e_vsi_context ctxt; > + int ret; > + > + memset(&ctxt, 0, sizeof(ctxt)); > + ctxt.seid =3D pf->main_vsi_seid; > + ctxt.pf_num =3D hw->pf_id; > + ret =3D i40e_aq_get_vsi_params(hw, &ctxt, NULL); > + if (ret) { > + PMD_DRV_LOG(ERR, "cannot get pf vsi config, err %d, = aq_err %d", > + ret, hw->aq.asq_last_status); > + return ret; > + } > + ctxt.flags =3D I40E_AQ_VSI_TYPE_PF; > + ctxt.info.valid_sections =3D > + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); > + if (on) > + ctxt.info.switch_id &=3D > + = ~rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB); > + else > + ctxt.info.switch_id |=3D > + = rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB); > + > + ret =3D i40e_aq_update_vsi_params(hw, &ctxt, NULL); > + if (ret) > + PMD_DRV_LOG(ERR, "update vsi switch failed, = aq_err=3D%d", > + hw->aq.asq_last_status); > + > + return ret; > +} > + > /* Setup a VSI */ > struct i40e_vsi * > i40e_vsi_setup(struct i40e_pf *pf, > @@ -5704,6 +5744,9 @@ i40e_vsi_setup(struct i40e_pf *pf, > } > } >=20 > + /* source prune is disabled to support VRRP in default*/ > + i40e_pf_set_source_prune(pf, 0); > + > vsi =3D rte_zmalloc("i40e_vsi", sizeof(struct i40e_vsi), 0); > if (!vsi) { > PMD_DRV_LOG(ERR, "Failed to allocate memory for vsi"); > diff --git a/drivers/net/i40e/i40e_ethdev.h = b/drivers/net/i40e/i40e_ethdev.h > index 9b806d130e..6f65d5e0ac 100644 > --- a/drivers/net/i40e/i40e_ethdev.h > +++ b/drivers/net/i40e/i40e_ethdev.h > @@ -1430,6 +1430,7 @@ int i40e_pf_calc_configured_queues_num(struct = i40e_pf *pf); > int i40e_pf_reset_rss_reta(struct i40e_pf *pf); > int i40e_pf_reset_rss_key(struct i40e_pf *pf); > int i40e_pf_config_rss(struct i40e_pf *pf); > +int i40e_pf_set_source_prune(struct i40e_pf *pf, int on); > int i40e_set_rss_key(struct i40e_vsi *vsi, uint8_t *key, uint8_t = key_len); > int i40e_set_rss_lut(struct i40e_vsi *vsi, uint8_t *lut, uint16_t = lut_size); > int i40e_vf_representor_init(struct rte_eth_dev *ethdev, void = *init_params); > diff --git a/drivers/net/i40e/i40e_testpmd.c = b/drivers/net/i40e/i40e_testpmd.c > index 7be9fea5b0..b6ef5d6e42 100644 > --- a/drivers/net/i40e/i40e_testpmd.c > +++ b/drivers/net/i40e/i40e_testpmd.c > @@ -2446,6 +2446,84 @@ static cmdline_parse_inst_t = cmd_ptype_mapping_update =3D { > }, > }; >=20 > +/* *** configure source prune for port *** */ > +struct cmd_config_src_prune_result { > + cmdline_fixed_string_t port; > + cmdline_fixed_string_t keyword; > + cmdline_fixed_string_t port_all; /* valid if "allports" = argument =3D=3D 1 */ > + uint16_t port_id; /* valid if "allports" = argument =3D=3D 0 */ > + cmdline_fixed_string_t item; > + cmdline_fixed_string_t enable; > +}; > + > +static void cmd_config_pf_src_prune_parsed(void *parsed_result, > + __rte_unused struct cmdline = *cl, > + void *allports) > +{ > + struct cmd_config_src_prune_result *res =3D parsed_result; > + uint8_t enable; > + uint16_t i; > + > + if (!strcmp(res->enable, "on")) > + enable =3D 1; > + else > + enable =3D 0; > + > + /* all ports */ > + if (allports) { > + RTE_ETH_FOREACH_DEV(i) > + rte_pmd_i40e_set_pf_src_prune(i, enable); > + } else { > + rte_pmd_i40e_set_pf_src_prune(res->port_id, enable); > + } > +} > + > +static cmdline_parse_token_string_t cmd_config_src_prune_port =3D > + TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result, = port, "port"); > +static cmdline_parse_token_string_t cmd_config_src_prune_keyword =3D > + TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result, = keyword, > + "config"); > +static cmdline_parse_token_string_t cmd_config_src_prune_portall =3D > + TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result, = port_all, > + "all"); > +static cmdline_parse_token_num_t cmd_config_src_prune_port_id =3D > + TOKEN_NUM_INITIALIZER(struct cmd_config_src_prune_result, = port_id, > + RTE_UINT16); > +static cmdline_parse_token_string_t cmd_config_src_prune_item =3D > + TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result, > + item, "i40e_src_prune"); > +static cmdline_parse_token_string_t cmd_config_src_prune_enable =3D > + TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result, = enable, > + "on#off"); > + > +static cmdline_parse_inst_t cmd_config_src_prune_all =3D { > + .f =3D cmd_config_pf_src_prune_parsed, > + .data =3D (void *)1, > + .help_str =3D "port config all i40e_src_prune on|off: Set = source pruning on all pf ports.", > + .tokens =3D { > + (void *)&cmd_config_src_prune_port, > + (void *)&cmd_config_src_prune_keyword, > + (void *)&cmd_config_src_prune_portall, > + (void *)&cmd_config_src_prune_item, > + (void *)&cmd_config_src_prune_enable, > + NULL, > + }, > +}; > + > +static cmdline_parse_inst_t cmd_config_src_prune_specific =3D { > + .f =3D cmd_config_pf_src_prune_parsed, > + .data =3D (void *)0, > + .help_str =3D "port config i40e_src_prune on|off: = Set source pruning on specific pf port.", > + .tokens =3D { > + (void *)&cmd_config_src_prune_port, > + (void *)&cmd_config_src_prune_keyword, > + (void *)&cmd_config_src_prune_port_id, > + (void *)&cmd_config_src_prune_item, > + (void *)&cmd_config_src_prune_enable, > + NULL, > + }, > +}; > + > static struct testpmd_driver_commands i40e_cmds =3D { > .commands =3D { > { > @@ -2592,6 +2670,16 @@ static struct testpmd_driver_commands i40e_cmds = =3D { > " (pctype_id_0[,pctype_id_1]*) (flow_type_id)\n" > " Update a flow type to pctype mapping item on a = port\n", > }, > + { > + &cmd_config_src_prune_all, > + "port config all i40e_src_prune (on|off)\n" > + " Set source pruning on pf port all.\n" > + }, > + { > + &cmd_config_src_prune_specific, > + "port config (port_id) i40e_src_prune (on|off)\n" > + " Set source pruning on pf port_id.\n" > + }, > { NULL, NULL }, > }, > }; > diff --git a/drivers/net/i40e/rte_pmd_i40e.c = b/drivers/net/i40e/rte_pmd_i40e.c > index 35829a1eea..9d39984ea1 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.c > +++ b/drivers/net/i40e/rte_pmd_i40e.c > @@ -3282,3 +3282,23 @@ rte_pmd_i40e_set_switch_dev(uint16_t port_id, = struct rte_eth_dev *switch_dev) >=20 > return 0; > } > + > +int > +rte_pmd_i40e_set_pf_src_prune(uint16_t port, uint8_t on) > +{ > + struct rte_eth_dev *dev; > + struct i40e_pf *pf; > + int ret; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > + > + dev =3D &rte_eth_devices[port]; > + > + if (!is_i40e_supported(dev)) > + return -ENOTSUP; > + > + pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); > + > + ret =3D i40e_pf_set_source_prune(pf, on); > + return ret; > +} > diff --git a/drivers/net/i40e/rte_pmd_i40e.h = b/drivers/net/i40e/rte_pmd_i40e.h > index 4cb21c3713..a802f989e9 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.h > +++ b/drivers/net/i40e/rte_pmd_i40e.h > @@ -1134,6 +1134,23 @@ __rte_experimental > int > rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev = *switch_dev); >=20 > +/** > + * Enable/Disable source prune on all the PF. > + * > + * @param port > + * The port identifier of the Ethernet device. > + * @param on > + * 1 - Enable source prune. > + * 0 - Disable source prune. > + * @return > + * - (0) if successful. > + * - (-ENODEV) if *port* invalid. > + * - (-EINVAL) if bad parameter. > + */ > +__rte_experimental > +int rte_pmd_i40e_set_pf_src_prune(uint16_t port, > + uint8_t on); > + > #ifdef __cplusplus > } > #endif > diff --git a/drivers/net/i40e/version.map = b/drivers/net/i40e/version.map > index 561db50eac..51e1ac4f06 100644 > --- a/drivers/net/i40e/version.map > +++ b/drivers/net/i40e/version.map > @@ -46,4 +46,5 @@ EXPERIMENTAL { > rte_pmd_i40e_get_fdir_stats; > rte_pmd_i40e_set_gre_key_len; > rte_pmd_i40e_set_switch_dev; > + rte_pmd_i40e_set_pf_src_prune; > }; > =E2=80=94 > 2.25.1 >=20 The patch appears to correct the issue reported in bug 648. Tested-by: Matthew Smith > --Apple-Mail=_59D94F80-8594-4E85-8C42-43D03D719BF7 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On = Apr 19, 2023, at 12:24 AM, Ye, MingjinX <mingjinx.ye@intel.com> wrote:

VRRP = advertisement packets are dropped on i40e PF device because
when a MAC address is added to a device, packets originating = from
that MAC address are dropped.
This = patch fixes the bug by disabling source pruning by default,
and adds a PMD specific API to enable/disable source = pruning.

Bugzilla ID: 648

Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
v3: The i40e specific commands are moved to
drivers/net/i40e/i40e_testpmd.c.
--
v4: Modify the commit log.
---
= drivers/net/i40e/i40e_ethdev.c  | 43 ++++++++++++++++
= drivers/net/i40e/i40e_ethdev.h  |  1 +
= drivers/net/i40e/i40e_testpmd.c | 88 = +++++++++++++++++++++++++++++++++
= drivers/net/i40e/rte_pmd_i40e.c | 20 ++++++++
= drivers/net/i40e/rte_pmd_i40e.h | 17 +++++++
= drivers/net/i40e/version.map    |  1 +
= 6 files changed, 170 insertions(+)

diff = --git a/drivers/net/i40e/i40e_ethdev.c = b/drivers/net/i40e/i40e_ethdev.c
index = cb0070f94b..90d8e5a8bc 100644
--- = a/drivers/net/i40e/i40e_ethdev.c
+++ = b/drivers/net/i40e/i40e_ethdev.c
@@ -5647,6 +5647,46 @@ = i40e_enable_pf_lb(struct i40e_pf *pf)
=             &n= bsp;           &nbs= p;  hw->aq.asq_last_status);
}

+/* i40e_pf_set_source_prune
+ * = @pf: pointer to the pf structure
+ * @on: Enable/disable = source prune
+ *
+ * set source prune on = pf
+ */
+int
+i40e_pf_set_source_prune(struct i40e_pf *pf, int on)
+{
+       struct = i40e_hw *hw =3D I40E_PF_TO_HW(pf);
+ =       struct i40e_vsi_context ctxt;
+       int ret;
+
+ =       memset(&ctxt, 0, = sizeof(ctxt));
+ =       ctxt.seid =3D = pf->main_vsi_seid;
+ =       ctxt.pf_num =3D hw->pf_id;
+       ret =3D = i40e_aq_get_vsi_params(hw, &ctxt, NULL);
+ =       if (ret) {
+ =             &n= bsp; PMD_DRV_LOG(ERR, "cannot get pf vsi config, err %d, aq_err = %d",
+ =             &n= bsp;           &nbs= p; ret, hw->aq.asq_last_status);
+ =             &n= bsp; return ret;
+ =       }
+ =       ctxt.flags =3D = I40E_AQ_VSI_TYPE_PF;
+ =       ctxt.info.valid_sections =3D
+ =             &n= bsp; rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID);
+=       if (on)
+ =             &n= bsp; ctxt.info.switch_id &=3D
+ =             &n= bsp;         ~rte_cpu_to_le_1= 6(I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB);
+ =       else
+ =             &n= bsp; ctxt.info.switch_id |=3D
+ =             &n= bsp;         rte_cpu_to_le_16= (I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB);
+
+ =       ret =3D = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+ =       if (ret)
+ =             &n= bsp; PMD_DRV_LOG(ERR, "update vsi switch failed, aq_err=3D%d",
+ =             &n= bsp;           &nbs= p; hw->aq.asq_last_status);
+
+ =       return ret;
+}
+
/* Setup a VSI */
struct = i40e_vsi *
i40e_vsi_setup(struct i40e_pf *pf,
@@ -5704,6 +5744,9 @@ i40e_vsi_setup(struct i40e_pf *pf,
=             &n= bsp;  }
=        }

+=       /* source prune is disabled to = support VRRP in default*/
+ =       i40e_pf_set_source_prune(pf, 0);
+
=        vsi =3D = rte_zmalloc("i40e_vsi", sizeof(struct i40e_vsi), 0);
=        if (!vsi) {
=             &n= bsp;  PMD_DRV_LOG(ERR, "Failed to allocate memory for = vsi");
diff --git a/drivers/net/i40e/i40e_ethdev.h = b/drivers/net/i40e/i40e_ethdev.h
index = 9b806d130e..6f65d5e0ac 100644
--- = a/drivers/net/i40e/i40e_ethdev.h
+++ = b/drivers/net/i40e/i40e_ethdev.h
@@ -1430,6 +1430,7 @@ int = i40e_pf_calc_configured_queues_num(struct i40e_pf *pf);
= int i40e_pf_reset_rss_reta(struct i40e_pf *pf);
int = i40e_pf_reset_rss_key(struct i40e_pf *pf);
int = i40e_pf_config_rss(struct i40e_pf *pf);
+int = i40e_pf_set_source_prune(struct i40e_pf *pf, int on);
int = i40e_set_rss_key(struct i40e_vsi *vsi, uint8_t *key, uint8_t = key_len);
int i40e_set_rss_lut(struct i40e_vsi *vsi, = uint8_t *lut, uint16_t lut_size);
int = i40e_vf_representor_init(struct rte_eth_dev *ethdev, void = *init_params);
diff --git = a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c
index 7be9fea5b0..b6ef5d6e42 100644
--- = a/drivers/net/i40e/i40e_testpmd.c
+++ = b/drivers/net/i40e/i40e_testpmd.c
@@ -2446,6 +2446,84 @@ = static cmdline_parse_inst_t cmd_ptype_mapping_update =3D {
=        },
};

+/* *** configure source prune for port *** = */
+struct cmd_config_src_prune_result {
+ =       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t = keyword;
+ =       cmdline_fixed_string_t port_all; /* = valid if "allports" argument =3D=3D 1 */
+ =       uint16_t port_id; =             &n= bsp;  /* valid if "allports" argument =3D=3D 0 */
+       cmdline_fixed_string_t = item;
+ =       cmdline_fixed_string_t enable;
+};
+
+static void = cmd_config_pf_src_prune_parsed(void *parsed_result,
+ =             &n= bsp;           &nbs= p;            =  __rte_unused struct cmdline *cl,
+ =             &n= bsp;           &nbs= p;            =  void *allports)
+{
+ =       struct cmd_config_src_prune_result = *res =3D parsed_result;
+ =       uint8_t enable;
+ =       uint16_t i;
+
+       if = (!strcmp(res->enable, "on"))
+ =             &n= bsp; enable =3D 1;
+ =       else
+ =             &n= bsp; enable =3D 0;
+
+ =       /* all ports */
+ =       if (allports) {
+ =             &n= bsp; RTE_ETH_FOREACH_DEV(i)
+ =             &n= bsp;         rte_pmd_i40e_set= _pf_src_prune(i, enable);
+ =       } else {
+ =             &n= bsp; rte_pmd_i40e_set_pf_src_prune(res->port_id, enable);
+       }
+}
+
+static cmdline_parse_token_string_t = cmd_config_src_prune_port =3D
+ =       TOKEN_STRING_INITIALIZER(struct = cmd_config_src_prune_result, port, "port");
+static = cmdline_parse_token_string_t cmd_config_src_prune_keyword =3D
+ =       TOKEN_STRING_INITIALIZER(struct = cmd_config_src_prune_result, keyword,
+ =             &n= bsp;           &nbs= p;      "config");
+static = cmdline_parse_token_string_t cmd_config_src_prune_portall =3D
+ =       TOKEN_STRING_INITIALIZER(struct = cmd_config_src_prune_result, port_all,
+ =             &n= bsp;           &nbs= p;      "all");
+static = cmdline_parse_token_num_t cmd_config_src_prune_port_id =3D
+=       TOKEN_NUM_INITIALIZER(struct = cmd_config_src_prune_result, port_id,
+ =             &n= bsp;           &nbs= p;   RTE_UINT16);
+static = cmdline_parse_token_string_t cmd_config_src_prune_item =3D
+=       TOKEN_STRING_INITIALIZER(struct = cmd_config_src_prune_result,
+ =             &n= bsp;         item, = "i40e_src_prune");
+static cmdline_parse_token_string_t = cmd_config_src_prune_enable =3D
+ =       TOKEN_STRING_INITIALIZER(struct = cmd_config_src_prune_result, enable,
+ =             &n= bsp;           &nbs= p;      "on#off");
+
+static cmdline_parse_inst_t cmd_config_src_prune_all =3D = {
+       .f =3D = cmd_config_pf_src_prune_parsed,
+ =       .data =3D (void *)1,
+ =       .help_str =3D "port config all = i40e_src_prune on|off: Set source pruning on all pf ports.",
+       .tokens =3D {
+ =             &n= bsp; (void *)&cmd_config_src_prune_port,
+ =             &n= bsp; (void *)&cmd_config_src_prune_keyword,
+ =             &n= bsp; (void *)&cmd_config_src_prune_portall,
+ =             &n= bsp; (void *)&cmd_config_src_prune_item,
+ =             &n= bsp; (void *)&cmd_config_src_prune_enable,
+ =             &n= bsp; NULL,
+ =       },
+};
+
+static cmdline_parse_inst_t = cmd_config_src_prune_specific =3D {
+ =       .f =3D = cmd_config_pf_src_prune_parsed,
+ =       .data =3D (void *)0,
+ =       .help_str =3D "port config = <port_id> i40e_src_prune on|off: Set source pruning on specific pf = port.",
+       .tokens =3D = {
+ =             &n= bsp; (void *)&cmd_config_src_prune_port,
+ =             &n= bsp; (void *)&cmd_config_src_prune_keyword,
+ =             &n= bsp; (void *)&cmd_config_src_prune_port_id,
+ =             &n= bsp; (void *)&cmd_config_src_prune_item,
+ =             &n= bsp; (void *)&cmd_config_src_prune_enable,
+ =             &n= bsp; NULL,
+ =       },
+};
+
static struct testpmd_driver_commands = i40e_cmds =3D {
=        .commands =3D {
=        {
@@ -2592,6 = +2670,16 @@ static struct testpmd_driver_commands i40e_cmds =3D {
=             &n= bsp;  " (pctype_id_0[,pctype_id_1]*) (flow_type_id)\n"
=             &n= bsp;  "    Update a flow type to pctype mapping = item on a port\n",
=        },
+ =       {
+ =             &n= bsp; &cmd_config_src_prune_all,
+ =             &n= bsp; "port config all i40e_src_prune (on|off)\n"
+ =             &n= bsp; "    Set source pruning on pf port all.\n"
+       },
+ =       {
+ =             &n= bsp; &cmd_config_src_prune_specific,
+ =             &n= bsp; "port config (port_id) i40e_src_prune (on|off)\n"
+ =             &n= bsp; "    Set source pruning on pf port_id.\n"
+       },
=        { NULL, NULL },
=        },
};
diff --git a/drivers/net/i40e/rte_pmd_i40e.c = b/drivers/net/i40e/rte_pmd_i40e.c
index = 35829a1eea..9d39984ea1 100644
--- = a/drivers/net/i40e/rte_pmd_i40e.c
+++ = b/drivers/net/i40e/rte_pmd_i40e.c
@@ -3282,3 +3282,23 @@ = rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev = *switch_dev)

=        return 0;
}
+
+int
+rte_pmd_i40e_set_pf_src_prune(uint16_t port, uint8_t on)
+{
+       struct = rte_eth_dev *dev;
+ =       struct i40e_pf *pf;
+ =       int ret;
+
+ =       RTE_ETH_VALID_PORTID_OR_ERR_RET(port, = -ENODEV);
+
+ =       dev =3D = &rte_eth_devices[port];
+
+ =       if (!is_i40e_supported(dev))
+ =             &n= bsp; return -ENOTSUP;
+
+ =       pf =3D = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+       ret =3D = i40e_pf_set_source_prune(pf, on);
+ =       return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h = b/drivers/net/i40e/rte_pmd_i40e.h
index = 4cb21c3713..a802f989e9 100644
--- = a/drivers/net/i40e/rte_pmd_i40e.h
+++ = b/drivers/net/i40e/rte_pmd_i40e.h
@@ -1134,6 +1134,23 @@ = __rte_experimental
int
= rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev = *switch_dev);

+/**
+ * = Enable/Disable source prune on all the PF.
+ *
+ * @param port
+ *    The port = identifier of the Ethernet device.
+ * @param on
+ *    1 - Enable source prune.
+ = *    0 - Disable source prune.
+ * = @return
+ *   - (0) if successful.
+= *   - (-ENODEV) if *port* invalid.
+ * =   - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int = rte_pmd_i40e_set_pf_src_prune(uint16_t port,
+ =             &n= bsp;           &nbs= p;      uint8_t on);
+
#ifdef __cplusplus
}
#endif
diff --git a/drivers/net/i40e/version.map = b/drivers/net/i40e/version.map
index = 561db50eac..51e1ac4f06 100644
--- = a/drivers/net/i40e/version.map
+++ = b/drivers/net/i40e/version.map
@@ -46,4 +46,5 @@ = EXPERIMENTAL {
=        rte_pmd_i40e_get_fdir_stats;
=        rte_pmd_i40e_set_gre_key_len; =        rte_pmd_i40e_set_switch_dev;
+ =       rte_pmd_i40e_set_pf_src_prune;
};
=E2=80=94
2.25.1


The patch appears to correct the issue reported in = bug 648.

Tested-by: Matthew Smith = <mgsmith@netgate.com>

= --Apple-Mail=_59D94F80-8594-4E85-8C42-43D03D719BF7--