From: Bruce Richardson <bruce.richardson@intel.com>
To: Beilei Xing <beilei.xing@intel.com>
Cc: wenzhuo.lu@intel.com, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] e1000: configure VLAN TPID
Date: Wed, 15 Jun 2016 12:03:59 +0100 [thread overview]
Message-ID: <20160615110359.GE10172@bricha3-MOBL3> (raw)
In-Reply-To: <1464922755-2888-1-git-send-email-beilei.xing@intel.com>
On Fri, Jun 03, 2016 at 10:59:15AM +0800, Beilei Xing wrote:
> This patch enables configuring the ether types of both inner and
> outer VLANs. Note that outer TPID of single VLAN and inner TPID of
> double VLAN are read only.
>
Commit message does not actually match the code, and I there is something
very strange about the code, see my comments below.
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> ---
> v2 changes:
> Modify return value. Cause inner tpid is not supported by single vlan,
> return -ENOTSUP.
> Add return value. If want to set inner TPID of double vlan or set outer
> tpid of single vlan, return -ENOTSUP.
>
> drivers/net/e1000/igb_ethdev.c | 38 +++++++++++++++++++++++++++++++++++---
> 1 file changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index f0921ee..5d37e2c 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -86,6 +86,14 @@
> #define E1000_INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)
> #define E1000_TSAUXC_DISABLE_SYSTIME 0x80000000
>
> +/* CTRL_EXT bit mask*/
> +#define E1000_CTRL_EXT_EXT_VLAN (1 << 26)
> +
> +/* VLAN Ether Type bit mask */
> +#define E1000_VET_VET_EXT 0xFFFF0000
> +
No need for a blank line here. Update the comment above to refer to both
mask and shift values and put them on one line after the other.
> +#define E1000_VET_VET_EXT_SHIFT 16
> +
> static int eth_igb_configure(struct rte_eth_dev *dev);
> static int eth_igb_start(struct rte_eth_dev *dev);
> static void eth_igb_stop(struct rte_eth_dev *dev);
> @@ -2237,13 +2245,37 @@ eth_igb_vlan_tpid_set(struct rte_eth_dev *dev,
> {
> struct e1000_hw *hw =
> E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> - uint32_t reg = ETHER_TYPE_VLAN;
> + uint32_t reg;
> + uint32_t qinq;
> int ret = 0;
>
> + qinq = E1000_READ_REG(hw, E1000_CTRL_EXT);
> + qinq &= E1000_CTRL_EXT_EXT_VLAN;
> +
> switch (vlan_type) {
> case ETH_VLAN_TYPE_INNER:
> - reg |= (tpid << 16);
> - E1000_WRITE_REG(hw, E1000_VET, reg);
> + if (qinq) {
> + ret = -ENOTSUP;
> + PMD_DRV_LOG(WARNING,
> + "Inner vlan ether type is read-only\n");
> + } else {
> + ret = -ENOTSUP;
> + PMD_DRV_LOG(ERR, "Inner type is not supported"
> + " by single vlan\n");
> + }
> + break;
Both branches of the if statment return -ENOTSUP and do not do anything to
set any VLAN parameters. This means that although we have the ability to
set the outer vlan, we can no longer set the inner type. This contradicts what
the commit message says.
> + case ETH_VLAN_TYPE_OUTER:
> + if (qinq) {
> + reg = E1000_READ_REG(hw, E1000_VET);
> + reg = (reg & (~E1000_VET_VET_EXT)) |
> + ((uint32_t)tpid << E1000_VET_VET_EXT_SHIFT);
> + E1000_WRITE_REG(hw, E1000_VET, reg);
> + } else {
> + ret = -ENOTSUP;
> + PMD_DRV_LOG(WARNING,
> + "Single vlan ether type is read-only\n");
> + }
> +
So according to the code, the only time you can change a vlan ether type is
to set the outer type for qinq? If this is the correct behaviour, please update
the commit title and message accordingly.
> break;
> default:
> ret = -EINVAL;
> --
> 2.5.0
>
Regards,
/Bruce
next prev parent reply other threads:[~2016-06-15 11:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 8:55 [dpdk-dev] [PATCH] " Beilei Xing
2016-06-02 6:43 ` Wang, Xiao W
2016-06-03 3:10 ` Xing, Beilei
2016-06-03 2:59 ` [dpdk-dev] [PATCH v2] " Beilei Xing
2016-06-03 3:59 ` Wang, Xiao W
2016-06-15 11:03 ` Bruce Richardson [this message]
2016-06-16 1:40 ` Xing, Beilei
2016-06-16 3:15 ` [dpdk-dev] [PATCH v3] " Beilei Xing
2016-06-16 6:57 ` Lu, Wenzhuo
2016-06-16 9:42 ` Bruce Richardson
2016-06-16 13:36 ` [dpdk-dev] [PATCH v4] " Beilei Xing
2016-06-16 13:59 ` Zhang, Helin
2016-06-24 9:59 ` Bruce Richardson
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=20160615110359.GE10172@bricha3-MOBL3 \
--to=bruce.richardson@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=wenzhuo.lu@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).