DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH RFC 2/6] i40e: reconfigure the hardware to support QinQ stripping/insertion
Date: Tue,  5 May 2015 10:32:19 +0800	[thread overview]
Message-ID: <1430793143-3610-3-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1430793143-3610-1-git-send-email-helin.zhang@intel.com>

Reconfiguration is needed to support QinQ stripping and insertion,
as hardware does not support them by default.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 48 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 43762f2..9b4bf06 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -211,6 +211,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 				void *arg);
 static void i40e_configure_registers(struct i40e_hw *hw);
 static void i40e_hw_init(struct i40e_hw *hw);
+static int i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi);
 
 static const struct rte_pci_id pci_id_i40e_map[] = {
 #define RTE_PCI_DEV_ID_DECL_I40E(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
@@ -3055,6 +3056,7 @@ i40e_vsi_setup(struct i40e_pf *pf,
 		 * macvlan filter which is expected and cannot be removed.
 		 */
 		i40e_update_default_filter_setting(vsi);
+		i40e_config_qinq(hw, vsi);
 	} else if (type == I40E_VSI_SRIOV) {
 		memset(&ctxt, 0, sizeof(ctxt));
 		/**
@@ -3095,6 +3097,8 @@ i40e_vsi_setup(struct i40e_pf *pf,
 		 * Since VSI is not created yet, only configure parameter,
 		 * will add vsi below.
 		 */
+
+		i40e_config_qinq(hw, vsi);
 	} else if (type == I40E_VSI_VMDQ2) {
 		memset(&ctxt, 0, sizeof(ctxt));
 		/*
@@ -5714,3 +5718,47 @@ i40e_configure_registers(struct i40e_hw *hw)
 			"0x%"PRIx32, reg_table[i].val, reg_table[i].addr);
 	}
 }
+
+#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
+static int
+i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi)
+{
+	uint32_t reg;
+	int ret;
+
+	if (vsi->vsi_id >= I40E_MAX_NUM_VSIS) {
+		PMD_DRV_LOG(ERR, "VSI ID exceeds the maximum");
+		return -EINVAL;
+	}
+
+	/* Configure for double VLAN RX stripping */
+	reg = I40E_READ_REG(hw, I40E_VSI_TSR(vsi->vsi_id));
+	if ((reg & I40E_VSI_TSR_QINQ_CONFIG) != I40E_VSI_TSR_QINQ_CONFIG) {
+		reg |= I40E_VSI_TSR_QINQ_CONFIG;
+		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;
+		}
+	}
+
+	/* Configure for double VLAN TX insertion */
+	reg = I40E_READ_REG(hw, I40E_VSI_L2TAGSTXVALID(vsi->vsi_id));
+	if ((reg & 0xff) != I40E_VSI_L2TAGSTXVALID_QINQ) {
+		reg = I40E_VSI_L2TAGSTXVALID_QINQ;
+		ret = i40e_aq_debug_write_register(hw,
+			I40E_VSI_L2TAGSTXVALID(vsi->vsi_id), reg, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to update "
+				"VSI_L2TAGSTXVALID[%d]", vsi->vsi_id);
+			return I40E_ERR_CONFIG;
+		}
+	}
+
+	return 0;
+}
-- 
1.9.3

  parent reply	other threads:[~2015-05-05  2:32 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05  2:32 [dpdk-dev] [PATCH RFC 0/6] support of QinQ stripping and insertion of i40e Helin Zhang
2015-05-05  2:32 ` [dpdk-dev] [PATCH RFC 1/6] mbuf: update mbuf structure for QinQ support Helin Zhang
2015-05-05 11:04   ` Ananyev, Konstantin
2015-05-05 15:42     ` Chilikin, Andrey
2015-05-05 22:37       ` Ananyev, Konstantin
2015-05-06  4:07         ` Zhang, Helin
2015-05-06  4:06     ` Zhang, Helin
2015-05-06  8:39       ` Bruce Richardson
2015-05-06  8:48         ` Zhang, Helin
2015-05-05  2:32 ` Helin Zhang [this message]
2015-05-05  2:32 ` [dpdk-dev] [PATCH RFC 3/6] i40e: support of QinQ stripping/insertion in RX/TX Helin Zhang
2015-05-05  2:32 ` [dpdk-dev] [PATCH RFC 4/6] ethdev: add QinQ offload capability flags Helin Zhang
2015-05-05  2:32 ` [dpdk-dev] [PATCH RFC 5/6] i40e: update of " Helin Zhang
2015-05-05  2:32 ` [dpdk-dev] [PATCH RFC 6/6] app/testpmd: support of QinQ stripping and insertion Helin Zhang
2015-05-26  8:36 ` [dpdk-dev] [PATCH 0/5] support i40e " Helin Zhang
2015-05-26  8:36   ` [dpdk-dev] [PATCH 1/5] ixgbe: remove a discarded source line Helin Zhang
2015-06-01  8:50     ` Olivier MATZ
2015-06-02  1:45       ` Zhang, Helin
2015-05-26  8:36   ` [dpdk-dev] [PATCH 2/5] mbuf: use the reserved 16 bits for double vlan Helin Zhang
2015-05-26 14:55     ` Stephen Hemminger
2015-05-26 15:00       ` Zhang, Helin
2015-05-26 15:02       ` Ananyev, Konstantin
2015-05-26 15:35         ` Stephen Hemminger
2015-05-26 15:46           ` Ananyev, Konstantin
2015-05-27  1:07             ` Zhang, Helin
2015-06-01  8:50     ` Olivier MATZ
2015-06-02  2:37       ` Zhang, Helin
2015-05-26  8:36   ` [dpdk-dev] [PATCH 3/5] i40e: support double vlan stripping and insertion Helin Zhang
2015-06-01  8:50     ` Olivier MATZ
2015-06-02  2:45       ` Zhang, Helin
2015-05-26  8:36   ` [dpdk-dev] [PATCH 4/5] i40evf: add supported offload capability flags Helin Zhang
2015-05-26  8:36   ` [dpdk-dev] [PATCH 5/5] app/testpmd: add test cases for qinq stripping and insertion Helin Zhang
2015-06-02  3:16   ` [dpdk-dev] [PATCH v2 0/6] support i40e QinQ " Helin Zhang
2015-06-02  3:16     ` [dpdk-dev] [PATCH v2 1/6] ixgbe: remove a discarded source line Helin Zhang
2015-06-02  3:16     ` [dpdk-dev] [PATCH v2 2/6] mbuf: use the reserved 16 bits for double vlan Helin Zhang
2015-06-02  3:16     ` [dpdk-dev] [PATCH v2 3/6] i40e: support double vlan stripping and insertion Helin Zhang
2015-06-02  3:16     ` [dpdk-dev] [PATCH v2 4/6] i40evf: add supported offload capability flags Helin Zhang
2015-06-02  3:16     ` [dpdk-dev] [PATCH v2 5/6] app/testpmd: add test cases for qinq stripping and insertion Helin Zhang
2015-06-02  3:16     ` [dpdk-dev] [PATCH v2 6/6] examples/ipv4_multicast: support double vlan " Helin Zhang
2015-06-02  7:37     ` [dpdk-dev] [PATCH v2 0/6] support i40e QinQ " Liu, Jijiang
2015-06-08  7:32       ` Cao, Min
2015-06-08  7:40     ` Olivier MATZ
2015-06-11  7:03     ` [dpdk-dev] [PATCH v3 0/7] " Helin Zhang
2015-06-11  7:03       ` [dpdk-dev] [PATCH v3 1/7] ixgbe: remove a discarded source line Helin Zhang
2015-06-11  7:03       ` [dpdk-dev] [PATCH v3 2/7] mbuf: use the reserved 16 bits for double vlan Helin Zhang
2015-06-25  8:31         ` Zhang, Helin
2015-06-28 20:36           ` Thomas Monjalon
2015-06-30  7:33             ` Olivier MATZ
2015-06-11  7:03       ` [dpdk-dev] [PATCH v3 3/7] i40e: support double vlan stripping and insertion Helin Zhang
2015-06-11  7:03       ` [dpdk-dev] [PATCH v3 4/7] i40evf: add supported offload capability flags Helin Zhang
2015-06-11  7:03       ` [dpdk-dev] [PATCH v3 5/7] app/testpmd: add test cases for qinq stripping and insertion Helin Zhang
2015-06-11  7:03       ` [dpdk-dev] [PATCH v3 6/7] examples/ipv4_multicast: support double vlan " Helin Zhang
2015-06-11  7:04       ` [dpdk-dev] [PATCH v3 7/7] doc: update testpmd command Helin Zhang
2015-06-11  7:25       ` [dpdk-dev] [PATCH v3 0/7] support i40e QinQ stripping and insertion Wu, Jingjing
2015-07-07 14:43         ` Thomas Monjalon

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=1430793143-3610-3-git-send-email-helin.zhang@intel.com \
    --to=helin.zhang@intel.com \
    --cc=dev@dpdk.org \
    /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).