DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Cc: Helin Zhang <helin.zhang@intel.com>
Subject: [dpdk-dev] [PATCH 05/15] i40e/base: fixup Geneve VNI for HW use
Date: Thu,  5 May 2016 16:53:34 +0800	[thread overview]
Message-ID: <1462438424-22574-6-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1462438424-22574-1-git-send-email-helin.zhang@intel.com>

The hardware doesn't layout the Geneve VNI quite the same
as the VxLAN VNI, so it needs to adjust it before sending
through the AQ commands as the workaround.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 drivers/net/i40e/base/i40e_common.c | 35 ++++++++++++++++++++++++++++++++++-
 drivers/net/i40e/base/i40e_osdep.h  |  7 +++++++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index f7dff12..e958099 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -5422,6 +5422,35 @@ void i40e_add_filter_to_drop_tx_flow_control_frames(struct i40e_hw *hw,
 }
 
 /**
+ * i40e_fix_up_geneve_vni - adjust Geneve VNI for HW issue
+ * @filters: list of cloud filters
+ * @filter_count: length of list
+ *
+ * There's an issue in the device where the Geneve VNI layout needs
+ * to be shifted 1 byte over from the VxLAN VNI
+ **/
+STATIC void i40e_fix_up_geneve_vni(
+	struct i40e_aqc_add_remove_cloud_filters_element_data *filters,
+	u8 filter_count)
+{
+	struct i40e_aqc_add_remove_cloud_filters_element_data *f = filters;
+	int i;
+
+	for (i = 0; i < filter_count; i++) {
+		u16 tnl_type;
+		u32 ti;
+
+		tnl_type = (le16_to_cpu(f[i].flags) &
+			   I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK) >>
+			   I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT;
+		if (tnl_type == I40E_AQC_ADD_CLOUD_TNL_TYPE_GENEVE) {
+			ti = le32_to_cpu(f[i].tenant_id);
+			f[i].tenant_id = cpu_to_le32(ti << 8);
+		}
+	}
+}
+
+/**
  * i40e_aq_add_cloud_filters
  * @hw: pointer to the hardware structure
  * @seid: VSI seid to add cloud filters from
@@ -5441,8 +5470,8 @@ enum i40e_status_code i40e_aq_add_cloud_filters(struct i40e_hw *hw,
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_add_remove_cloud_filters *cmd =
 	(struct i40e_aqc_add_remove_cloud_filters *)&desc.params.raw;
-	u16 buff_len;
 	enum i40e_status_code status;
+	u16 buff_len;
 
 	i40e_fill_default_direct_cmd_desc(&desc,
 					  i40e_aqc_opc_add_cloud_filters);
@@ -5453,6 +5482,8 @@ enum i40e_status_code i40e_aq_add_cloud_filters(struct i40e_hw *hw,
 	cmd->num_filters = filter_count;
 	cmd->seid = CPU_TO_LE16(seid);
 
+	i40e_fix_up_geneve_vni(filters, filter_count);
+
 	status = i40e_asq_send_command(hw, &desc, filters, buff_len, NULL);
 
 	return status;
@@ -5490,6 +5521,8 @@ enum i40e_status_code i40e_aq_remove_cloud_filters(struct i40e_hw *hw,
 	cmd->num_filters = filter_count;
 	cmd->seid = CPU_TO_LE16(seid);
 
+	i40e_fix_up_geneve_vni(filters, filter_count);
+
 	status = i40e_asq_send_command(hw, &desc, filters, buff_len, NULL);
 
 	return status;
diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h
index 8c84ed8..38e7ba5 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -204,6 +204,13 @@ struct i40e_virt_mem {
 #define LE32_TO_CPU(c) rte_le_to_cpu_32(c)
 #define LE64_TO_CPU(k) rte_le_to_cpu_64(k)
 
+#define cpu_to_le16(o) rte_cpu_to_le_16(o)
+#define cpu_to_le32(s) rte_cpu_to_le_32(s)
+#define cpu_to_le64(h) rte_cpu_to_le_64(h)
+#define le16_to_cpu(a) rte_le_to_cpu_16(a)
+#define le32_to_cpu(c) rte_le_to_cpu_32(c)
+#define le64_to_cpu(k) rte_le_to_cpu_64(k)
+
 /* SW spinlock */
 struct i40e_spinlock {
 	rte_spinlock_t spinlock;
-- 
2.5.0

  parent reply	other threads:[~2016-05-05  8:54 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05  8:53 [dpdk-dev] [PATCH 00/15] i40e base driver update Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 01/15] i40e/base: remove HMC AQ APIs Helin Zhang
2016-05-09 16:14   ` Bruce Richardson
2016-05-09 16:16     ` Bruce Richardson
2016-05-05  8:53 ` [dpdk-dev] [PATCH 02/15] i40e/base: refactor NVM update status info Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 03/15] i40e/base: refactor NVM update event handling Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 04/15] i40e/base: code style fixes Helin Zhang
2016-05-05  8:53 ` Helin Zhang [this message]
2016-05-10 15:53   ` [dpdk-dev] [PATCH 05/15] i40e/base: fixup Geneve VNI for HW use Bruce Richardson
2016-05-05  8:53 ` [dpdk-dev] [PATCH 06/15] i40e/base: expose mirroring config Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 07/15] i40e/base: fix problematic mirror rule ID check Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 08/15] i40e/base: add new devices Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 09/15] i40e/base: fix the number of MSIX vector Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 10/15] i40e/base: fix debug output Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 11/15] i40e/base: add more device capabilities Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 12/15] i40e/base: increase supported AQ API version Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 13/15] i40e/base: add input set mask definitions Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 14/15] i40e/base: add RSS config to virtual channel Helin Zhang
2016-05-05  8:53 ` [dpdk-dev] [PATCH 15/15] i40e/base: add capability of disabling all link Helin Zhang
2016-05-24  6:22 ` [dpdk-dev] [PATCH v2 00/15] i40e base driver update Helin Zhang
2016-05-24  6:22   ` [dpdk-dev] [PATCH v2 01/15] i40e/base: remove HMC AQ APIs Helin Zhang
2016-06-02  2:08     ` Gu, YongjieX
2016-06-14 10:14     ` Bruce Richardson
2016-05-24  6:22   ` [dpdk-dev] [PATCH v2 02/15] i40e/base: move field of NVM update status info Helin Zhang
2016-05-24  6:22   ` [dpdk-dev] [PATCH v2 03/15] i40e/base: refactor NVM update command processing Helin Zhang
2016-05-24  6:22   ` [dpdk-dev] [PATCH v2 04/15] i40e/base: trim the code Helin Zhang
2016-06-14 10:16     ` Bruce Richardson
2016-05-24  6:22   ` [dpdk-dev] [PATCH v2 05/15] i40e/base: fixup Geneve VNI for HW use Helin Zhang
2016-06-14 10:25     ` Bruce Richardson
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 06/15] i40e/base: expose mirroring config Helin Zhang
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 07/15] i40e/base: fix problematic mirror rule ID check Helin Zhang
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 08/15] i40e/base: add new devices Helin Zhang
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 09/15] i40e/base: fix the number of MSIX vector Helin Zhang
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 10/15] i40e/base: fix debug output Helin Zhang
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 11/15] i40e/base: add more device capabilities Helin Zhang
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 12/15] i40e/base: increase supported AQ API version Helin Zhang
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 13/15] i40e/base: add input set mask definitions Helin Zhang
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 14/15] i40e/base: add RSS config to virtual channel Helin Zhang
2016-05-24  6:23   ` [dpdk-dev] [PATCH v2 15/15] i40e/base: add capability of disabling all link Helin Zhang
2016-06-14 13:48     ` Bruce Richardson
2016-06-06  7:53   ` [dpdk-dev] [PATCH v2 00/15] i40e base driver update Lu, Wenzhuo
2016-06-14 14:01     ` 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=1462438424-22574-6-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).