[v2] net/i40e: support enabling/disabling source pruning

Message ID 20230130080916.77274-1-ke1x.zhang@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Qi Zhang
Headers
Series [v2] net/i40e: support enabling/disabling source pruning |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation fail ninja build failure
ci/Intel-compilation fail Compilation issues
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance fail Performance Testing issues
ci/github-robot: build fail github build: failed
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing fail Testing issues
ci/iol-aarch64-unit-testing warning Testing issues
ci/iol-aarch64-compile-testing fail Testing issues
ci/iol-testing fail Testing issues
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Zhang, Ke1X Jan. 30, 2023, 8:09 a.m. UTC
  VRRP advertisement packets are dropped on i40e PF devices because
when a MAC address is added to a device, packets originating from
that MAC address are dropped.

This patch adds a PMD specific API to enable/disable source
pruning to fix above issue.

Bugzilla ID: 648

Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
---
 app/test-pmd/cmdline.c          | 84 +++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c  | 43 +++++++++++++++++
 drivers/net/i40e/i40e_ethdev.h  |  1 +
 drivers/net/i40e/rte_pmd_i40e.c | 20 ++++++++
 drivers/net/i40e/rte_pmd_i40e.h | 16 +++++++
 5 files changed, 164 insertions(+)
  

Comments

Morten Brørup Jan. 30, 2023, 8:41 a.m. UTC | #1
> From: Ke Zhang [mailto:ke1x.zhang@intel.com]
> Sent: Monday, 30 January 2023 09.09
> 
> VRRP advertisement packets are dropped on i40e PF devices because
> when a MAC address is added to a device, packets originating from
> that MAC address are dropped.
> 
> This patch adds a PMD specific API to enable/disable source
> pruning to fix above issue.
> 
> Bugzilla ID: 648
> 
> Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
> ---

This fixes what I considered a bug in the driver, so source pruning is now disabled by default. Thank you.

Acked-by: Morten Brørup <mb@smartsharesystems.com>

Should rte_pmd_i40e_set_src_prune be added to a maps file? (I'm not sure about a PMD specific APIs, so please check.)
  
David Marchand Jan. 30, 2023, 8:58 a.m. UTC | #2
On Mon, Jan 30, 2023 at 9:23 AM Ke Zhang <ke1x.zhang@intel.com> wrote:
>
> VRRP advertisement packets are dropped on i40e PF devices because
> when a MAC address is added to a device, packets originating from
> that MAC address are dropped.
>
> This patch adds a PMD specific API to enable/disable source
> pruning to fix above issue.
>
> Bugzilla ID: 648
>
> Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
> ---
>  app/test-pmd/cmdline.c          | 84 +++++++++++++++++++++++++++++++++
>  drivers/net/i40e/i40e_ethdev.c  | 43 +++++++++++++++++
>  drivers/net/i40e/i40e_ethdev.h  |  1 +
>  drivers/net/i40e/rte_pmd_i40e.c | 20 ++++++++
>  drivers/net/i40e/rte_pmd_i40e.h | 16 +++++++
>  5 files changed, 164 insertions(+)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index cb8c174020..76a574affd 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -776,6 +776,9 @@ static void cmd_help_long_parsed(void *parsed_result,
>
>                         "port cleanup (port_id) txq (queue_id) (free_cnt)\n"
>                         "    Cleanup txq mbufs for a specific Tx queue\n\n"
> +
> +                       "port config (port_id|all) src_prune (on|off)\n"
> +                       "    Set source prune on port_id, or all.\n\n"
>                 );
>         }
>

- This seems i40e specific, please move to drivers/net/i40e/i40e_testpmd.c.

- Besides, I would prefer that something in the command name clearly
states this is driver (here, i40e) specific.
Like "port config XX i40e_src_prune" or maybe the other way around,
start with a "driver i40e" prefix.

Maybe others have an opinion.
  
Zhang, Ke1X Jan. 31, 2023, 3:28 a.m. UTC | #3
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Monday, January 30, 2023 4:58 PM
> To: Zhang, Ke1X <ke1x.zhang@intel.com>; mb@smartsharesystems.com;
> thomas@monjalon.net; ferruh.yigit@amd.com
> Cc: dev@dpdk.org; Matz, Olivier <olivier.matz@6wind.com>; Zhang, Yuying
> <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Subject: Re: [PATCH v2] net/i40e: support enabling/disabling source pruning
> 
> On Mon, Jan 30, 2023 at 9:23 AM Ke Zhang <ke1x.zhang@intel.com> wrote:
> >
> > VRRP advertisement packets are dropped on i40e PF devices because
> when
> > a MAC address is added to a device, packets originating from that MAC
> > address are dropped.
> >
> > This patch adds a PMD specific API to enable/disable source pruning to
> > fix above issue.
> >
> > Bugzilla ID: 648
> >
> > Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
> > ---
> >  app/test-pmd/cmdline.c          | 84
> +++++++++++++++++++++++++++++++++
> >  drivers/net/i40e/i40e_ethdev.c  | 43 +++++++++++++++++
> > drivers/net/i40e/i40e_ethdev.h  |  1 +
> > drivers/net/i40e/rte_pmd_i40e.c | 20 ++++++++
> > drivers/net/i40e/rte_pmd_i40e.h | 16 +++++++
> >  5 files changed, 164 insertions(+)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > cb8c174020..76a574affd 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -776,6 +776,9 @@ static void cmd_help_long_parsed(void
> > *parsed_result,
> >
> >                         "port cleanup (port_id) txq (queue_id) (free_cnt)\n"
> >                         "    Cleanup txq mbufs for a specific Tx queue\n\n"
> > +
> > +                       "port config (port_id|all) src_prune (on|off)\n"
> > +                       "    Set source prune on port_id, or all.\n\n"
> >                 );
> >         }
> >
> 
> - This seems i40e specific, please move to drivers/net/i40e/i40e_testpmd.c.
> 
> - Besides, I would prefer that something in the command name clearly states
> this is driver (here, i40e) specific.
> Like "port config XX i40e_src_prune" or maybe the other way around, start
> with a "driver i40e" prefix.
> 
> Maybe others have an opinion.
> 
> 
> --
> David Marchand

Thanks for your comments, this command could be used for other Intel NIC like ice,
And It is only finished for i40e in this story: https://jira.devtools.intel.com/browse/DPDK-29564
  
Thomas Monjalon Feb. 1, 2023, 11:11 a.m. UTC | #4
31/01/2023 04:28, Zhang, Ke1X:
> From: David Marchand <david.marchand@redhat.com>
> > On Mon, Jan 30, 2023 at 9:23 AM Ke Zhang <ke1x.zhang@intel.com> wrote:
> > >
> > > VRRP advertisement packets are dropped on i40e PF devices because
> > when
> > > a MAC address is added to a device, packets originating from that MAC
> > > address are dropped.
> > >
> > > This patch adds a PMD specific API to enable/disable source pruning to
> > > fix above issue.
> > >
> > > Bugzilla ID: 648
> > >
> > > Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
> > > ---
> > >  app/test-pmd/cmdline.c          | 84
> > +++++++++++++++++++++++++++++++++
> > >  drivers/net/i40e/i40e_ethdev.c  | 43 +++++++++++++++++
> > > drivers/net/i40e/i40e_ethdev.h  |  1 +
> > > drivers/net/i40e/rte_pmd_i40e.c | 20 ++++++++
> > > drivers/net/i40e/rte_pmd_i40e.h | 16 +++++++
> > >  5 files changed, 164 insertions(+)
> > >
> > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > > cb8c174020..76a574affd 100644
> > > --- a/app/test-pmd/cmdline.c
> > > +++ b/app/test-pmd/cmdline.c
> > > @@ -776,6 +776,9 @@ static void cmd_help_long_parsed(void
> > > *parsed_result,
> > >
> > >                         "port cleanup (port_id) txq (queue_id) (free_cnt)\n"
> > >                         "    Cleanup txq mbufs for a specific Tx queue\n\n"
> > > +
> > > +                       "port config (port_id|all) src_prune (on|off)\n"
> > > +                       "    Set source prune on port_id, or all.\n\n"
> > >                 );
> > >         }
> > >
> > 
> > - This seems i40e specific, please move to drivers/net/i40e/i40e_testpmd.c.
> > 
> > - Besides, I would prefer that something in the command name clearly states
> > this is driver (here, i40e) specific.
> > Like "port config XX i40e_src_prune" or maybe the other way around, start
> > with a "driver i40e" prefix.
> > 
> > Maybe others have an opinion.
> > 
> > 
> > --
> > David Marchand
> 
> Thanks for your comments, this command could be used for other Intel NIC like ice,
> And It is only finished for i40e in this story: https://jira.devtools.intel.com/browse/DPDK-29564

Only Intel has access to this URL.

On the principle, you should not update testpmd commands in a patch for i40e.
We add testpmd commands when adding new features in ethdev.

Here specifically, you are adding rte_pmd_i40e_set_src_prune()
with a vague explanation: "Enable/Disable source prune on all the PF."
Without more information, I cannot judge whether the feature is generic or not.
So for now, this is a nack.
  
Zhang, Ke1X Feb. 7, 2023, 1:40 a.m. UTC | #5
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, February 1, 2023 7:11 PM
> To: David Marchand <david.marchand@redhat.com>;
> mb@smartsharesystems.com; ferruh.yigit@amd.com; Zhang, Ke1X
> <ke1x.zhang@intel.com>
> Cc: dev@dpdk.org; Matz, Olivier <olivier.matz@6wind.com>; Zhang, Yuying
> <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Subject: Re: [PATCH v2] net/i40e: support enabling/disabling source pruning
> 
> 31/01/2023 04:28, Zhang, Ke1X:
> > From: David Marchand <david.marchand@redhat.com>
> > > On Mon, Jan 30, 2023 at 9:23 AM Ke Zhang <ke1x.zhang@intel.com>
> wrote:
> > > >
> > > > VRRP advertisement packets are dropped on i40e PF devices because
> > > when
> > > > a MAC address is added to a device, packets originating from that
> > > > MAC address are dropped.
> > > >
> > > > This patch adds a PMD specific API to enable/disable source
> > > > pruning to fix above issue.
> > > >
> > > > Bugzilla ID: 648
> > > >
> > > > Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
> > > > ---
> > > >  app/test-pmd/cmdline.c          | 84
> > > +++++++++++++++++++++++++++++++++
> > > >  drivers/net/i40e/i40e_ethdev.c  | 43 +++++++++++++++++
> > > > drivers/net/i40e/i40e_ethdev.h  |  1 +
> > > > drivers/net/i40e/rte_pmd_i40e.c | 20 ++++++++
> > > > drivers/net/i40e/rte_pmd_i40e.h | 16 +++++++
> > > >  5 files changed, 164 insertions(+)
> > > >
> > > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > > > cb8c174020..76a574affd 100644
> > > > --- a/app/test-pmd/cmdline.c
> > > > +++ b/app/test-pmd/cmdline.c
> > > > @@ -776,6 +776,9 @@ static void cmd_help_long_parsed(void
> > > > *parsed_result,
> > > >
> > > >                         "port cleanup (port_id) txq (queue_id) (free_cnt)\n"
> > > >                         "    Cleanup txq mbufs for a specific Tx queue\n\n"
> > > > +
> > > > +                       "port config (port_id|all) src_prune (on|off)\n"
> > > > +                       "    Set source prune on port_id, or all.\n\n"
> > > >                 );
> > > >         }
> > > >
> > >
> > > - This seems i40e specific, please move to
> drivers/net/i40e/i40e_testpmd.c.
> > >
> > > - Besides, I would prefer that something in the command name clearly
> > > states this is driver (here, i40e) specific.
> > > Like "port config XX i40e_src_prune" or maybe the other way around,
> > > start with a "driver i40e" prefix.
> > >
> > > Maybe others have an opinion.
> > >
> > >
> > > --
> > > David Marchand
> >
> > Thanks for your comments, this command could be used for other Intel
> > NIC like ice, And It is only finished for i40e in this story:
> > https://jira.devtools.intel.com/browse/DPDK-29564
> 
> Only Intel has access to this URL.
> 
> On the principle, you should not update testpmd commands in a patch for
> i40e.
> We add testpmd commands when adding new features in ethdev.
> 
> Here specifically, you are adding rte_pmd_i40e_set_src_prune() with a
> vague explanation: "Enable/Disable source prune on all the PF."
> Without more information, I cannot judge whether the feature is generic or
> not.
> So for now, this is a nack.
> 
Thanks for your comments, this feature is only for intel NIC.
Would you please share a solution for this case?
Thanks.
  
Thomas Monjalon Feb. 7, 2023, 8:35 a.m. UTC | #6
07/02/2023 02:40, Zhang, Ke1X:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 31/01/2023 04:28, Zhang, Ke1X:
> > > From: David Marchand <david.marchand@redhat.com>
> > > > On Mon, Jan 30, 2023 at 9:23 AM Ke Zhang <ke1x.zhang@intel.com>
> > wrote:
> > > > >
> > > > > VRRP advertisement packets are dropped on i40e PF devices because
> > > > when
> > > > > a MAC address is added to a device, packets originating from that
> > > > > MAC address are dropped.
> > > > >
> > > > > This patch adds a PMD specific API to enable/disable source
> > > > > pruning to fix above issue.
> > > > >
> > > > > Bugzilla ID: 648
> > > > >
> > > > > Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
> > > > > ---
> > > > >  app/test-pmd/cmdline.c          | 84
> > > > +++++++++++++++++++++++++++++++++
> > > > >  drivers/net/i40e/i40e_ethdev.c  | 43 +++++++++++++++++
> > > > > drivers/net/i40e/i40e_ethdev.h  |  1 +
> > > > > drivers/net/i40e/rte_pmd_i40e.c | 20 ++++++++
> > > > > drivers/net/i40e/rte_pmd_i40e.h | 16 +++++++
> > > > >  5 files changed, 164 insertions(+)
> > > > >
> > > > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > > > > cb8c174020..76a574affd 100644
> > > > > --- a/app/test-pmd/cmdline.c
> > > > > +++ b/app/test-pmd/cmdline.c
> > > > > @@ -776,6 +776,9 @@ static void cmd_help_long_parsed(void
> > > > > *parsed_result,
> > > > >
> > > > >                         "port cleanup (port_id) txq (queue_id) (free_cnt)\n"
> > > > >                         "    Cleanup txq mbufs for a specific Tx queue\n\n"
> > > > > +
> > > > > +                       "port config (port_id|all) src_prune (on|off)\n"
> > > > > +                       "    Set source prune on port_id, or all.\n\n"
> > > > >                 );
> > > > >         }
> > > > >
> > > >
> > > > - This seems i40e specific, please move to
> > drivers/net/i40e/i40e_testpmd.c.
> > > >
> > > > - Besides, I would prefer that something in the command name clearly
> > > > states this is driver (here, i40e) specific.
> > > > Like "port config XX i40e_src_prune" or maybe the other way around,
> > > > start with a "driver i40e" prefix.
> > > >
> > > > Maybe others have an opinion.
> > > >
> > > >
> > > > --
> > > > David Marchand
> > >
> > > Thanks for your comments, this command could be used for other Intel
> > > NIC like ice, And It is only finished for i40e in this story:
> > > https://jira.devtools.intel.com/browse/DPDK-29564
> > 
> > Only Intel has access to this URL.
> > 
> > On the principle, you should not update testpmd commands in a patch for
> > i40e.
> > We add testpmd commands when adding new features in ethdev.
> > 
> > Here specifically, you are adding rte_pmd_i40e_set_src_prune() with a
> > vague explanation: "Enable/Disable source prune on all the PF."
> > Without more information, I cannot judge whether the feature is generic or
> > not.
> > So for now, this is a nack.
> > 
> Thanks for your comments, this feature is only for intel NIC.
> Would you please share a solution for this case?

Host testpmd code in your driver directory
with a command name starting with the name of your driver: "i40e port ...".
You can look at what is done for mlx5 in drivers/net/mlx5/mlx5_testpmd.c
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index cb8c174020..76a574affd 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -776,6 +776,9 @@  static void cmd_help_long_parsed(void *parsed_result,
 
 			"port cleanup (port_id) txq (queue_id) (free_cnt)\n"
 			"    Cleanup txq mbufs for a specific Tx queue\n\n"
+
+			"port config (port_id|all) src_prune (on|off)\n"
+			"    Set source prune on port_id, or all.\n\n"
 		);
 	}
 
@@ -1619,6 +1622,84 @@  static cmdline_parse_inst_t cmd_config_loopback_specific = {
 	},
 };
 
+/* *** 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 == 1 */
+	uint16_t port_num;               /* valid if "allports" argument == 0 */
+	cmdline_fixed_string_t item;
+	cmdline_fixed_string_t enable;
+};
+
+static void cmd_config_src_prune_parsed(void *parsed_result,
+					__rte_unused struct cmdline *cl,
+					void *allports)
+{
+	struct cmd_config_src_prune_result *res = parsed_result;
+	int enable;
+	portid_t i;
+
+	if (!strcmp(res->enable, "on"))
+		enable = 1;
+	else
+		enable = 0;
+
+	/* all ports */
+	if (allports) {
+		RTE_ETH_FOREACH_DEV(i)
+			rte_pmd_i40e_set_src_prune(i, enable);
+	} else {
+		rte_pmd_i40e_set_src_prune(res->port_num, enable);
+	}
+}
+
+static cmdline_parse_token_string_t cmd_config_src_prune_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result, port, "port");
+static cmdline_parse_token_string_t cmd_config_src_prune_keyword =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result, keyword,
+				 "config");
+static cmdline_parse_token_string_t cmd_config_src_prune_portall =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result, port_all,
+				 "all");
+static cmdline_parse_token_num_t cmd_config_src_prune_portnum =
+	TOKEN_NUM_INITIALIZER(struct cmd_config_src_prune_result, port_num,
+			      RTE_UINT16);
+static cmdline_parse_token_string_t cmd_config_src_prune_item =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result,
+			item, "src_prune");
+static cmdline_parse_token_string_t cmd_config_src_prune_enable =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_src_prune_result, enable,
+				 "on#off");
+
+static cmdline_parse_inst_t cmd_config_src_prune_all = {
+	.f = cmd_config_src_prune_parsed,
+	.data = (void *)1,
+	.help_str = "port config all src_prune (on|off): Set source prune on all ports.",
+	.tokens = {
+		(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 = {
+	.f = cmd_config_src_prune_parsed,
+	.data = (void *)0,
+	.help_str = "port config all src_prune (on|off): Set source prune on specific port.",
+	.tokens = {
+		(void *)&cmd_config_src_prune_port,
+		(void *)&cmd_config_src_prune_keyword,
+		(void *)&cmd_config_src_prune_portnum,
+		(void *)&cmd_config_src_prune_item,
+		(void *)&cmd_config_src_prune_enable,
+		NULL,
+	},
+};
+
 /* *** configure txq/rxq, txd/rxd *** */
 struct cmd_config_rx_tx {
 	cmdline_fixed_string_t port;
@@ -12731,6 +12812,8 @@  static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_config_speed_specific,
 	(cmdline_parse_inst_t *)&cmd_config_loopback_all,
 	(cmdline_parse_inst_t *)&cmd_config_loopback_specific,
+	(cmdline_parse_inst_t *)&cmd_config_src_prune_all,
+	(cmdline_parse_inst_t *)&cmd_config_src_prune_specific,
 	(cmdline_parse_inst_t *)&cmd_config_rx_tx,
 	(cmdline_parse_inst_t *)&cmd_config_mtu,
 	(cmdline_parse_inst_t *)&cmd_config_max_pkt_len,
@@ -12850,6 +12933,7 @@  static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_operate_bpf_unld_parse,
 #endif
 	(cmdline_parse_inst_t *)&cmd_config_tx_metadata_specific,
+
 	(cmdline_parse_inst_t *)&cmd_show_tx_metadata,
 	(cmdline_parse_inst_t *)&cmd_show_rx_tx_desc_status,
 	(cmdline_parse_inst_t *)&cmd_show_rx_queue_desc_used_count,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7726a89d99..0f993b958e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5634,6 +5634,46 @@  i40e_enable_pf_lb(struct i40e_pf *pf)
 			    hw->aq.asq_last_status);
 }
 
+/* i40e_set_pf_source_prune
+ * @pf: pointer to the pf structure
+ * @on: Enable/disable source prune
+ *
+ * set source prune on pf
+ */
+int
+i40e_set_pf_source_prune(struct i40e_pf *pf, int on)
+{
+	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	ctxt.seid = pf->main_vsi_seid;
+	ctxt.pf_num = hw->pf_id;
+	ret = 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 = I40E_AQ_VSI_TYPE_PF;
+	ctxt.info.valid_sections =
+		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID);
+	if (on)
+		ctxt.info.switch_id &=
+			~rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB);
+	else
+		ctxt.info.switch_id |=
+			rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB);
+
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret)
+		PMD_DRV_LOG(ERR, "update vsi switch failed, aq_err=%d",
+			    hw->aq.asq_last_status);
+
+	return ret;
+}
+
 /* Setup a VSI */
 struct i40e_vsi *
 i40e_vsi_setup(struct i40e_pf *pf,
@@ -5691,6 +5731,9 @@  i40e_vsi_setup(struct i40e_pf *pf,
 		}
 	}
 
+	/* source prune is disabled to support VRRP in default*/
+	i40e_set_pf_source_prune(pf, 0);
+
 	vsi = 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 7c4cc44a27..df1591584b 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -1427,6 +1427,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_set_pf_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/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index 35829a1eea..b9fc3c24a1 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -445,6 +445,26 @@  rte_pmd_i40e_set_tx_loopback(uint16_t port, uint8_t on)
 	return ret;
 }
 
+int
+rte_pmd_i40e_set_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 = &rte_eth_devices[port];
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	ret = i40e_set_pf_source_prune(pf, on);
+	return ret;
+}
+
 int
 rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on)
 {
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 4cb21c3713..76c9296413 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -400,6 +400,22 @@  int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint16_t port,
 int rte_pmd_i40e_set_tx_loopback(uint16_t port,
 				 uint8_t on);
 
+/**
+ * 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.
+ */
+int rte_pmd_i40e_set_src_prune(uint16_t port,
+				 uint8_t on);
+
 /**
  * Enable/Disable VF unicast promiscuous mode.
  *