DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] i40e: enable extended tag
Date: Mon, 21 Dec 2015 10:38:04 +0800	[thread overview]
Message-ID: <1450665486-8335-2-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1450665486-8335-1-git-send-email-helin.zhang@intel.com>

PCIe feature of 'Extended Tag' is important for 40G performance.
It adds its enabling during each port initialization, to ensure
the high performance.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 doc/guides/rel_notes/release_2_3.rst |  5 +++
 drivers/net/i40e/i40e_ethdev.c       | 67 ++++++++++++++++++++++++++++++++++--
 2 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst
index 99de186..efd258b 100644
--- a/doc/guides/rel_notes/release_2_3.rst
+++ b/doc/guides/rel_notes/release_2_3.rst
@@ -4,6 +4,11 @@ DPDK Release 2.3
 New Features
 ------------
 
+* **i40e: Enabled extended tag.**
+
+  It enabled extended tag by checking and writing corresponding PCI config
+  space bytes, to boost the performance.
+
 
 Resolved Issues
 ---------------
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index bf6220d..973aca8 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -273,6 +273,17 @@
 #define I40E_INSET_IPV6_TC_MASK       0x0009F00FUL
 #define I40E_INSET_IPV6_NEXT_HDR_MASK 0x000C00FFUL
 
+/* PCI offset for querying capability */
+#define PCI_DEV_CAP_REG            0xA4
+/* PCI offset for enabling/disabling Extended Tag */
+#define PCI_DEV_CTRL_REG           0xA8
+/* Bit mask of Extended Tag capability */
+#define PCI_DEV_CAP_EXT_TAG_MASK   0x20
+/* Bit shift of Extended Tag enable/disable */
+#define PCI_DEV_CTRL_EXT_TAG_SHIFT 8
+/* Bit mask of Extended Tag enable/disable */
+#define PCI_DEV_CTRL_EXT_TAG_MASK  (1 << PCI_DEV_CTRL_EXT_TAG_SHIFT)
+
 static int eth_i40e_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_i40e_dev_uninit(struct rte_eth_dev *eth_dev);
 static int i40e_dev_configure(struct rte_eth_dev *dev);
@@ -386,7 +397,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 static int i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
 				  struct rte_eth_dcb_info *dcb_info);
 static void i40e_configure_registers(struct i40e_hw *hw);
-static void i40e_hw_init(struct i40e_hw *hw);
+static void i40e_hw_init(struct rte_eth_dev *dev);
 static int i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi);
 static int i40e_mirror_rule_set(struct rte_eth_dev *dev,
 			struct rte_eth_mirror_conf *mirror_conf,
@@ -765,7 +776,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	i40e_clear_hw(hw);
 
 	/* Initialize the hardware */
-	i40e_hw_init(hw);
+	i40e_hw_init(dev);
 
 	/* Reset here to make sure all is clean for each PF */
 	ret = i40e_pf_reset(hw);
@@ -7262,13 +7273,63 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 }
 
 /*
+ * Check and enable Extended Tag.
+ * Enabling Extended Tag is important for 40G performance.
+ */
+static int
+i40e_enable_extended_tag(struct rte_eth_dev *dev)
+{
+	uint32_t buf = 0;
+	int ret;
+
+	ret = rte_eal_pci_read_config(dev->pci_dev, &buf, sizeof(buf),
+				      PCI_DEV_CAP_REG);
+	if (ret < 0) {
+		PMD_DRV_LOG(ERR, "Failed to read PCI offset 0x%x",
+			    PCI_DEV_CAP_REG);
+		return -1;
+	}
+	if (!(buf & PCI_DEV_CAP_EXT_TAG_MASK)) {
+		PMD_DRV_LOG(ERR, "Does not support Extended Tag");
+		return -1;
+	}
+
+	buf = 0;
+	ret = rte_eal_pci_read_config(dev->pci_dev, &buf, sizeof(buf),
+				      PCI_DEV_CTRL_REG);
+	if (ret < 0) {
+		PMD_DRV_LOG(ERR, "Failed to read PCI offset 0x%x",
+			    PCI_DEV_CTRL_REG);
+		return -1;
+	}
+	if (buf & PCI_DEV_CTRL_EXT_TAG_MASK) {
+		PMD_DRV_LOG(DEBUG, "Extended Tag has already been enabled");
+		return 0;
+	}
+	buf |= PCI_DEV_CTRL_EXT_TAG_MASK;
+	ret = rte_eal_pci_write_config(dev->pci_dev, &buf, sizeof(buf),
+				       PCI_DEV_CTRL_REG);
+	if (ret < 0) {
+		PMD_DRV_LOG(ERR, "Failed to write PCI offset 0x%x",
+			    PCI_DEV_CTRL_REG);
+		return -1;
+	}
+
+	return 0;
+}
+
+/*
  * As some registers wouldn't be reset unless a global hardware reset,
  * hardware initialization is needed to put those registers into an
  * expected initial state.
  */
 static void
-i40e_hw_init(struct i40e_hw *hw)
+i40e_hw_init(struct rte_eth_dev *dev)
 {
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	i40e_enable_extended_tag(dev);
+
 	/* clear the PF Queue Filter control register */
 	I40E_WRITE_REG(hw, I40E_PFQF_CTL_0, 0);
 
-- 
1.9.3

  reply	other threads:[~2015-12-21  2:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21  2:38 [dpdk-dev] [PATCH 0/3] " Helin Zhang
2015-12-21  2:38 ` Helin Zhang [this message]
2016-01-22  1:34   ` [dpdk-dev] [PATCH 1/3] " Wu, Jingjing
2016-01-22 10:26   ` Thomas Monjalon
2016-01-24  3:25     ` Zhang, Helin
2016-01-25  9:16       ` Thomas Monjalon
2016-01-26  0:29         ` Zhang, Helin
2015-12-21  2:38 ` [dpdk-dev] [PATCH 2/3] eal: remove pci config of " Helin Zhang
2016-02-22  3:59   ` [dpdk-dev] [PATCH v2 0/3] enable extended tag for i40e Helin Zhang
2016-02-22  3:59     ` [dpdk-dev] [PATCH v2 1/3] i40e: enable extended tag Helin Zhang
2016-02-23 10:44       ` Bruce Richardson
2016-02-24  0:39         ` Zhang, Helin
2016-02-22  3:59     ` [dpdk-dev] [PATCH v2 2/3] eal: remove pci config of " Helin Zhang
2016-03-08 17:05       ` Thomas Monjalon
2016-02-22  3:59     ` [dpdk-dev] [PATCH v2 3/3] igb_uio: deprecate sys files Helin Zhang
2016-03-08 17:48       ` Thomas Monjalon
2016-03-08 18:02       ` Thomas Monjalon
2016-02-22  5:52     ` [dpdk-dev] [PATCH v2 0/3] enable extended tag for i40e Wu, Jingjing
2016-03-08 18:38     ` [dpdk-dev] [PATCH v3 " Thomas Monjalon
2016-03-08 18:38       ` [dpdk-dev] [PATCH v3 1/3] i40e: enable extended tag Thomas Monjalon
2016-03-08 18:38       ` [dpdk-dev] [PATCH v3 2/3] pci: remove config of " Thomas Monjalon
2016-03-08 18:38       ` [dpdk-dev] [PATCH v3 3/3] igb_uio: deprecate " Thomas Monjalon
2016-03-08 18:41       ` [dpdk-dev] [PATCH v3 0/3] enable extended tag for i40e Thomas Monjalon
2016-03-09  0:48         ` Zhang, Helin
2016-03-09  0:50           ` Thomas Monjalon
2016-03-09  0:52           ` Thomas Monjalon
2015-12-21  2:38 ` [dpdk-dev] [PATCH 3/3] igb_uio: remove sys files for setting pci config space Helin Zhang
2015-12-21 18:57   ` Stephen Hemminger
2016-02-22  6:31 ` [dpdk-dev] [PATCH v2 0/3] enable extended tag for i40e Helin Zhang
2016-02-22  6:31   ` [dpdk-dev] [PATCH v2 1/3] i40e: enable extended tag Helin Zhang
2016-02-22  6:31   ` [dpdk-dev] [PATCH v2 2/3] eal: remove pci config of " Helin Zhang
2016-02-22  6:31   ` [dpdk-dev] [PATCH v2 3/3] igb_uio: deprecate sys files Helin Zhang

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=1450665486-8335-2-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).