patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ
@ 2020-07-24  7:01 Wei Zhao
  2020-07-24  8:01 ` Zhao1, Wei
  2020-07-24  8:37 ` [dpdk-stable] [dpdk-dev] " Yang, Qiming
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Zhao @ 2020-07-24  7:01 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, Wei Zhao

This patch enable i40e outer vlan strip on and off in QinQ
mode with mask bit of DEV_RX_OFFLOAD_QINQ_STRIP, users can
use "vlan set qinq_strip on 0" to enable or "vlan set
qinq_strip on 0" to disable i40e outer vlan strip when
try with testpmd app.

Fixes: 4861cde46116 (i40e: new poll mode driver)

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 45 +++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 05d5f2861..f5be6606c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -48,6 +48,8 @@
 #define ETH_I40E_VF_MSG_CFG		"vf_msg_cfg"
 
 #define I40E_CLEAR_PXE_WAIT_MS     200
+#define I40E_VSI_TSR_QINQ_STRIP		0x4010
+#define I40E_VSI_TSR(_i)	(0x00050800 + ((_i) * 4))
 
 /* Maximun number of capability elements */
 #define I40E_MAX_CAP_ELE_NUM       128
@@ -3968,6 +3970,39 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
 	return ret;
 }
 
+/* Configure outer vlan stripping on or off in QinQ mode */
+static int
+i40e_vsi_config_outer_vlan_stripping(struct i40e_vsi *vsi, bool on)
+{
+	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
+	int ret = I40E_SUCCESS;
+	uint32_t reg;
+
+	if (vsi->vsi_id >= I40E_MAX_NUM_VSIS) {
+		PMD_DRV_LOG(ERR, "VSI ID exceeds the maximum");
+		return -EINVAL;
+	}
+
+	/* Configure for outer VLAN RX stripping */
+	reg = I40E_READ_REG(hw, I40E_VSI_TSR(vsi->vsi_id));
+
+	if (on)
+		reg |= I40E_VSI_TSR_QINQ_STRIP;
+	else
+		reg &= ~I40E_VSI_TSR_QINQ_STRIP;
+
+	ret = i40e_aq_debug_write_register(hw,
+						   I40E_VSI_TSR(vsi->vsi_id),
+						   reg, NULL);
+	if (ret < 0) {
+		PMD_DRV_LOG(ERR, "Failed to update VSI_TSR[%d]",
+				    vsi->vsi_id);
+		return I40E_ERR_CONFIG;
+	}
+
+	return ret;
+}
+
 static int
 i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 {
@@ -4004,6 +4039,14 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 			i40e_vsi_config_double_vlan(vsi, FALSE);
 	}
 
+	if (mask & ETH_QINQ_STRIP_MASK) {
+		/* Enable or disable outer VLAN stripping */
+		if (rxmode->offloads & DEV_RX_OFFLOAD_QINQ_STRIP)
+			i40e_vsi_config_outer_vlan_stripping(vsi, TRUE);
+		else
+			i40e_vsi_config_outer_vlan_stripping(vsi, FALSE);
+	}
+
 	return 0;
 }
 
@@ -6178,6 +6221,7 @@ i40e_dev_init_vlan(struct rte_eth_dev *dev)
 
 	/* Apply vlan offload setting */
 	mask = ETH_VLAN_STRIP_MASK |
+	       ETH_QINQ_STRIP_MASK |
 	       ETH_VLAN_FILTER_MASK |
 	       ETH_VLAN_EXTEND_MASK;
 	ret = i40e_vlan_offload_set(dev, mask);
@@ -10872,7 +10916,6 @@ i40e_configure_registers(struct i40e_hw *hw)
 	}
 }
 
-#define I40E_VSI_TSR(_i)            (0x00050800 + ((_i) * 4))
 #define I40E_VSI_TSR_QINQ_CONFIG    0xc030
 #define I40E_VSI_L2TAGSTXVALID(_i)  (0x00042800 + ((_i) * 4))
 #define I40E_VSI_L2TAGSTXVALID_QINQ 0xab
-- 
2.19.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ
  2020-07-24  7:01 [dpdk-stable] [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ Wei Zhao
@ 2020-07-24  8:01 ` Zhao1, Wei
  2020-07-24  8:37 ` [dpdk-stable] [dpdk-dev] " Yang, Qiming
  1 sibling, 0 replies; 4+ messages in thread
From: Zhao1, Wei @ 2020-07-24  8:01 UTC (permalink / raw)
  To: dev; +Cc: stable, Zhang, Qi Z, Guo, Jia, Xing, Beilei

Add maintainers.


> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Friday, July 24, 2020 3:02 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> <wei.zhao1@intel.com>
> Subject: [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ
> 
> This patch enable i40e outer vlan strip on and off in QinQ mode with mask bit of
> DEV_RX_OFFLOAD_QINQ_STRIP, users can use "vlan set qinq_strip on 0" to
> enable or "vlan set qinq_strip on 0" to disable i40e outer vlan strip when try
> with testpmd app.
> 
> Fixes: 4861cde46116 (i40e: new poll mode driver)
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 45 +++++++++++++++++++++++++++++++++-
>  1 file changed, 44 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 05d5f2861..f5be6606c 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -48,6 +48,8 @@
>  #define ETH_I40E_VF_MSG_CFG		"vf_msg_cfg"
> 
>  #define I40E_CLEAR_PXE_WAIT_MS     200
> +#define I40E_VSI_TSR_QINQ_STRIP		0x4010
> +#define I40E_VSI_TSR(_i)	(0x00050800 + ((_i) * 4))
> 
>  /* Maximun number of capability elements */
>  #define I40E_MAX_CAP_ELE_NUM       128
> @@ -3968,6 +3970,39 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
>  	return ret;
>  }
> 
> +/* Configure outer vlan stripping on or off in QinQ mode */ static int
> +i40e_vsi_config_outer_vlan_stripping(struct i40e_vsi *vsi, bool on) {
> +	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
> +	int ret = I40E_SUCCESS;
> +	uint32_t reg;
> +
> +	if (vsi->vsi_id >= I40E_MAX_NUM_VSIS) {
> +		PMD_DRV_LOG(ERR, "VSI ID exceeds the maximum");
> +		return -EINVAL;
> +	}
> +
> +	/* Configure for outer VLAN RX stripping */
> +	reg = I40E_READ_REG(hw, I40E_VSI_TSR(vsi->vsi_id));
> +
> +	if (on)
> +		reg |= I40E_VSI_TSR_QINQ_STRIP;
> +	else
> +		reg &= ~I40E_VSI_TSR_QINQ_STRIP;
> +
> +	ret = i40e_aq_debug_write_register(hw,
> +						   I40E_VSI_TSR(vsi->vsi_id),
> +						   reg, NULL);
> +	if (ret < 0) {
> +		PMD_DRV_LOG(ERR, "Failed to update VSI_TSR[%d]",
> +				    vsi->vsi_id);
> +		return I40E_ERR_CONFIG;
> +	}
> +
> +	return ret;
> +}
> +
>  static int
>  i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)  { @@ -4004,6
> +4039,14 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
>  			i40e_vsi_config_double_vlan(vsi, FALSE);
>  	}
> 
> +	if (mask & ETH_QINQ_STRIP_MASK) {
> +		/* Enable or disable outer VLAN stripping */
> +		if (rxmode->offloads & DEV_RX_OFFLOAD_QINQ_STRIP)
> +			i40e_vsi_config_outer_vlan_stripping(vsi, TRUE);
> +		else
> +			i40e_vsi_config_outer_vlan_stripping(vsi, FALSE);
> +	}
> +
>  	return 0;
>  }
> 
> @@ -6178,6 +6221,7 @@ i40e_dev_init_vlan(struct rte_eth_dev *dev)
> 
>  	/* Apply vlan offload setting */
>  	mask = ETH_VLAN_STRIP_MASK |
> +	       ETH_QINQ_STRIP_MASK |
>  	       ETH_VLAN_FILTER_MASK |
>  	       ETH_VLAN_EXTEND_MASK;
>  	ret = i40e_vlan_offload_set(dev, mask); @@ -10872,7 +10916,6 @@
> i40e_configure_registers(struct i40e_hw *hw)
>  	}
>  }
> 
> -#define I40E_VSI_TSR(_i)            (0x00050800 + ((_i) * 4))
>  #define I40E_VSI_TSR_QINQ_CONFIG    0xc030
>  #define I40E_VSI_L2TAGSTXVALID(_i)  (0x00042800 + ((_i) * 4))  #define
> I40E_VSI_L2TAGSTXVALID_QINQ 0xab
> --
> 2.19.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ
  2020-07-24  7:01 [dpdk-stable] [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ Wei Zhao
  2020-07-24  8:01 ` Zhao1, Wei
@ 2020-07-24  8:37 ` " Yang, Qiming
  2020-07-25  0:19   ` Zhang, Qi Z
  1 sibling, 1 reply; 4+ messages in thread
From: Yang, Qiming @ 2020-07-24  8:37 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable, Zhang, Qi Z, Zhao1, Wei



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Wei Zhao
> Sent: Friday, July 24, 2020 15:02
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> <wei.zhao1@intel.com>
> Subject: [dpdk-dev] [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ
> 
> This patch enable i40e outer vlan strip on and off in QinQ mode with mask bit
> of DEV_RX_OFFLOAD_QINQ_STRIP, users can use "vlan set qinq_strip on 0"
> to enable or "vlan set qinq_strip on 0" to disable i40e outer vlan strip when
> try with testpmd app.
> 
> Fixes: 4861cde46116 (i40e: new poll mode driver)
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 45
> +++++++++++++++++++++++++++++++++-
>  1 file changed, 44 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 05d5f2861..f5be6606c 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -48,6 +48,8 @@
>  #define ETH_I40E_VF_MSG_CFG		"vf_msg_cfg"
> 
>  #define I40E_CLEAR_PXE_WAIT_MS     200
> +#define I40E_VSI_TSR_QINQ_STRIP		0x4010
> +#define I40E_VSI_TSR(_i)	(0x00050800 + ((_i) * 4))
> 
>  /* Maximun number of capability elements */
>  #define I40E_MAX_CAP_ELE_NUM       128
> @@ -3968,6 +3970,39 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
>  	return ret;
>  }
> 
> +/* Configure outer vlan stripping on or off in QinQ mode */ static int
> +i40e_vsi_config_outer_vlan_stripping(struct i40e_vsi *vsi, bool on) {
> +	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
> +	int ret = I40E_SUCCESS;
> +	uint32_t reg;
> +
> +	if (vsi->vsi_id >= I40E_MAX_NUM_VSIS) {
> +		PMD_DRV_LOG(ERR, "VSI ID exceeds the maximum");
> +		return -EINVAL;
> +	}
> +
> +	/* Configure for outer VLAN RX stripping */
> +	reg = I40E_READ_REG(hw, I40E_VSI_TSR(vsi->vsi_id));
> +
> +	if (on)
> +		reg |= I40E_VSI_TSR_QINQ_STRIP;
> +	else
> +		reg &= ~I40E_VSI_TSR_QINQ_STRIP;
> +
> +	ret = i40e_aq_debug_write_register(hw,
> +						   I40E_VSI_TSR(vsi->vsi_id),
> +						   reg, NULL);
> +	if (ret < 0) {
> +		PMD_DRV_LOG(ERR, "Failed to update VSI_TSR[%d]",
> +				    vsi->vsi_id);
> +		return I40E_ERR_CONFIG;
> +	}
> +
> +	return ret;
> +}
> +
>  static int
>  i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)  { @@ -4004,6
> +4039,14 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
>  			i40e_vsi_config_double_vlan(vsi, FALSE);
>  	}
> 
> +	if (mask & ETH_QINQ_STRIP_MASK) {
> +		/* Enable or disable outer VLAN stripping */
> +		if (rxmode->offloads & DEV_RX_OFFLOAD_QINQ_STRIP)
> +			i40e_vsi_config_outer_vlan_stripping(vsi, TRUE);
> +		else
> +			i40e_vsi_config_outer_vlan_stripping(vsi, FALSE);
> +	}
> +
>  	return 0;
>  }
> 
> @@ -6178,6 +6221,7 @@ i40e_dev_init_vlan(struct rte_eth_dev *dev)
> 
>  	/* Apply vlan offload setting */
>  	mask = ETH_VLAN_STRIP_MASK |
> +	       ETH_QINQ_STRIP_MASK |
>  	       ETH_VLAN_FILTER_MASK |
>  	       ETH_VLAN_EXTEND_MASK;
>  	ret = i40e_vlan_offload_set(dev, mask); @@ -10872,7 +10916,6 @@
> i40e_configure_registers(struct i40e_hw *hw)
>  	}
>  }
> 
> -#define I40E_VSI_TSR(_i)            (0x00050800 + ((_i) * 4))
>  #define I40E_VSI_TSR_QINQ_CONFIG    0xc030
>  #define I40E_VSI_L2TAGSTXVALID(_i)  (0x00042800 + ((_i) * 4))  #define
> I40E_VSI_L2TAGSTXVALID_QINQ 0xab
> --
> 2.19.1

Reviewed-by: Qiming Yang <Qiming.yang@intel.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ
  2020-07-24  8:37 ` [dpdk-stable] [dpdk-dev] " Yang, Qiming
@ 2020-07-25  0:19   ` Zhang, Qi Z
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2020-07-25  0:19 UTC (permalink / raw)
  To: Yang, Qiming, Zhao1, Wei, dev; +Cc: stable, Zhao1, Wei



> -----Original Message-----
> From: Yang, Qiming <qiming.yang@intel.com>
> Sent: Friday, July 24, 2020 4:38 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> <wei.zhao1@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ
> 
> 
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Wei Zhao
> > Sent: Friday, July 24, 2020 15:02
> > To: dev@dpdk.org
> > Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> > <wei.zhao1@intel.com>
> > Subject: [dpdk-dev] [PATCH] net/i40e: enable i40e outer VLAN strip in
> > QinQ
> >
> > This patch enable i40e outer vlan strip on and off in QinQ mode with
> > mask bit of DEV_RX_OFFLOAD_QINQ_STRIP, users can use "vlan set qinq_strip
> on 0"
> > to enable or "vlan set qinq_strip on 0" to disable i40e outer vlan
> > strip when try with testpmd app.
> >
> > Fixes: 4861cde46116 (i40e: new poll mode driver)
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > ---
> >  drivers/net/i40e/i40e_ethdev.c | 45
> > +++++++++++++++++++++++++++++++++-
> >  1 file changed, 44 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 05d5f2861..f5be6606c 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -48,6 +48,8 @@
> >  #define ETH_I40E_VF_MSG_CFG"vf_msg_cfg"
> >
> >  #define I40E_CLEAR_PXE_WAIT_MS     200
> > +#define I40E_VSI_TSR_QINQ_STRIP0x4010 #define
> > +I40E_VSI_TSR(_i)(0x00050800 + ((_i) * 4))
> >
> >  /* Maximun number of capability elements */
> >  #define I40E_MAX_CAP_ELE_NUM       128
> > @@ -3968,6 +3970,39 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
> > return ret;  }
> >
> > +/* Configure outer vlan stripping on or off in QinQ mode */ static
> > +int i40e_vsi_config_outer_vlan_stripping(struct i40e_vsi *vsi, bool
> > +on) { struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); int ret =
> > +I40E_SUCCESS; uint32_t reg;
> > +
> > +if (vsi->vsi_id >= I40E_MAX_NUM_VSIS) { PMD_DRV_LOG(ERR, "VSI ID
> > +exceeds the maximum"); return -EINVAL; }
> > +
> > +/* Configure for outer VLAN RX stripping */ reg = I40E_READ_REG(hw,
> > +I40E_VSI_TSR(vsi->vsi_id));
> > +
> > +if (on)
> > +reg |= I40E_VSI_TSR_QINQ_STRIP;
> > +else
> > +reg &= ~I40E_VSI_TSR_QINQ_STRIP;
> > +
> > +ret = i40e_aq_debug_write_register(hw,
> > +   I40E_VSI_TSR(vsi->vsi_id),
> > +   reg, NULL);
> > +if (ret < 0) {
> > +PMD_DRV_LOG(ERR, "Failed to update VSI_TSR[%d]",
> > +    vsi->vsi_id);
> > +return I40E_ERR_CONFIG;
> > +}
> > +
> > +return ret;
> > +}
> > +
> >  static int
> >  i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)  { @@
> > -4004,6
> > +4039,14 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
> >  i40e_vsi_config_double_vlan(vsi, FALSE);  }
> >
> > +if (mask & ETH_QINQ_STRIP_MASK) {
> > +/* Enable or disable outer VLAN stripping */ if (rxmode->offloads &
> > +DEV_RX_OFFLOAD_QINQ_STRIP) i40e_vsi_config_outer_vlan_stripping(vsi,
> > +TRUE); else i40e_vsi_config_outer_vlan_stripping(vsi, FALSE); }
> > +
> >  return 0;
> >  }
> >
> > @@ -6178,6 +6221,7 @@ i40e_dev_init_vlan(struct rte_eth_dev *dev)
> >
> >  /* Apply vlan offload setting */
> >  mask = ETH_VLAN_STRIP_MASK |
> > +       ETH_QINQ_STRIP_MASK |
> >         ETH_VLAN_FILTER_MASK |
> >         ETH_VLAN_EXTEND_MASK;
> >  ret = i40e_vlan_offload_set(dev, mask); @@ -10872,7 +10916,6 @@
> > i40e_configure_registers(struct i40e_hw *hw)  }  }
> >
> > -#define I40E_VSI_TSR(_i)            (0x00050800 + ((_i) * 4))
> >  #define I40E_VSI_TSR_QINQ_CONFIG    0xc030
> >  #define I40E_VSI_L2TAGSTXVALID(_i)  (0x00042800 + ((_i) * 4))
> > #define I40E_VSI_L2TAGSTXVALID_QINQ 0xab
> > --
> > 2.19.1
> 
> Reviewed-by: Qiming Yang <Qiming.yang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24  7:01 [dpdk-stable] [PATCH] net/i40e: enable i40e outer VLAN strip in QinQ Wei Zhao
2020-07-24  8:01 ` Zhao1, Wei
2020-07-24  8:37 ` [dpdk-stable] [dpdk-dev] " Yang, Qiming
2020-07-25  0:19   ` Zhang, Qi Z

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox