From: Beilei Xing <beilei.xing@intel.com>
To: helin.zhang@intel.com
Cc: dev@dpdk.org, Beilei Xing <beilei.xing@intel.com>
Subject: [dpdk-dev] [PATCH v4] e1000: configure VLAN TPID
Date: Thu, 16 Jun 2016 21:36:28 +0800 [thread overview]
Message-ID: <1466084188-23579-1-git-send-email-beilei.xing@intel.com> (raw)
In-Reply-To: <1466046930-11021-1-git-send-email-beilei.xing@intel.com>
This patch enables configuring the outer TPID for double VLAN.
Note that all other TPID values are read only.
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
v4 changes:
Optimize the code to be more readable.
v3 changes:
Update commit log and comments.
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 | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index f0921ee..0ed95c8 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -86,6 +86,13 @@
#define E1000_INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)
#define E1000_TSAUXC_DISABLE_SYSTIME 0x80000000
+/* External VLAN Enable bit mask */
+#define E1000_CTRL_EXT_EXT_VLAN (1 << 26)
+
+/* External VLAN Ether Type bit mask and shift */
+#define E1000_VET_VET_EXT 0xFFFF0000
+#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,21 +2244,25 @@ 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;
- int ret = 0;
+ uint32_t reg, qinq;
+
+ 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);
+ /* only outer TPID of double VLAN can be configured*/
+ if (qinq && vlan_type == ETH_VLAN_TYPE_OUTER) {
+ 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);
- break;
- default:
- ret = -EINVAL;
- PMD_DRV_LOG(ERR, "Unsupported vlan type %d\n", vlan_type);
- break;
+
+ return 0;
}
- return ret;
+ /* all other TPID values are read-only*/
+ PMD_DRV_LOG(ERR, "Not supported");
+
+ return -ENOTSUP;
}
static void
--
2.5.0
next prev parent reply other threads:[~2016-06-16 13:36 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
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 ` Beilei Xing [this message]
2016-06-16 13:59 ` [dpdk-dev] [PATCH v4] " 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=1466084188-23579-1-git-send-email-beilei.xing@intel.com \
--to=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=helin.zhang@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).