DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] e1000: configure VLAN TPID
@ 2016-04-21  8:55 Beilei Xing
  2016-06-02  6:43 ` Wang, Xiao W
  2016-06-03  2:59 ` [dpdk-dev] [PATCH v2] " Beilei Xing
  0 siblings, 2 replies; 13+ messages in thread
From: Beilei Xing @ 2016-04-21  8:55 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Beilei Xing

This patch enables configuring the ether types of both inner and
outer VLANs. Note that TPID of single or inner VLAN is read only.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/e1000/igb_ethdev.c | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index e0053fe..c957fbe 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
+
+#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);
@@ -2242,13 +2250,33 @@ 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)
+			PMD_DRV_LOG(WARNING,
+				    "inner vlan ether type is read-only\n");
+		else {
+			PMD_DRV_LOG(ERR, "not set QinQ on yet\n");
+			ret = -EIO;
+		}
+		break;
+	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
+			PMD_DRV_LOG(WARNING,
+				    "single vlan ether type is read-only\n");
+
 		break;
 	default:
 		ret = -EINVAL;
-- 
2.5.0

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

end of thread, other threads:[~2016-06-24  9:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-21  8:55 [dpdk-dev] [PATCH] e1000: configure VLAN TPID 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     ` [dpdk-dev] [PATCH v4] " Beilei Xing
2016-06-16 13:59       ` Zhang, Helin
2016-06-24  9:59         ` Bruce Richardson

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).