From: "Yang, Qiming" <qiming.yang@intel.com>
To: "Zhao1, Wei" <wei.zhao1@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "stable@dpdk.org" <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
Date: Fri, 24 Jul 2020 08:37:33 +0000 [thread overview]
Message-ID: <BN6PR11MB001767C30BB63AF64B85FA4DE5770@BN6PR11MB0017.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200724070137.10003-1-wei.zhao1@intel.com>
> -----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>
next prev parent reply other threads:[~2020-07-24 8:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 7:01 Wei Zhao
2020-07-24 8:01 ` Zhao1, Wei
2020-07-24 8:37 ` Yang, Qiming [this message]
2020-07-25 0:19 ` Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BN6PR11MB001767C30BB63AF64B85FA4DE5770@BN6PR11MB0017.namprd11.prod.outlook.com \
--to=qiming.yang@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=stable@dpdk.org \
--cc=wei.zhao1@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).