From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Cc: yulong.pei@intel.com
Subject: [dpdk-dev] [PATCH 1/2] i40e: add selecting GRE key length
Date: Thu, 24 Sep 2015 15:16:18 +0800 [thread overview]
Message-ID: <1443078979-20774-2-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1443078979-20774-1-git-send-email-helin.zhang@intel.com>
By default, only first 3 bytes of GRE key will be used for hash or
filter calculation. With these changes, it can select 3 or 4 bytes
of GRE key for hash calculation.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 86 +++++++++++++++++++++++++++++++++++++++--
lib/librte_ether/rte_eth_ctrl.h | 20 ++++++++++
2 files changed, 103 insertions(+), 3 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 77e6906..b88a2f0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5328,7 +5328,7 @@ i40e_pf_config_rss(struct i40e_pf *pf)
static int
i40e_tunnel_filter_param_check(struct i40e_pf *pf,
- struct rte_eth_tunnel_filter_conf *filter)
+ struct rte_eth_tunnel_filter_conf *filter)
{
if (pf == NULL || filter == NULL) {
PMD_DRV_LOG(ERR, "Invalid parameter");
@@ -5360,9 +5360,84 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,
return 0;
}
+#define I40E_GL_PRS_FVBM(_i) (0x00269760 + ((_i) * 4))
static int
-i40e_tunnel_filter_handle(struct rte_eth_dev *dev, enum rte_filter_op filter_op,
- void *arg)
+i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len)
+{
+ uint32_t val, reg;
+ int ret = -EINVAL;
+
+ val = I40E_READ_REG(hw, I40E_GL_PRS_FVBM(2));
+ PMD_DRV_LOG(DEBUG, "Read original GL_PRS_FVBM with 0x%08x\n", val);
+
+ if (len == 3) {
+ reg = val | 0x80000000;
+ } else if (len == 4) {
+ reg = val & ~0x80000000;
+ } else {
+ PMD_DRV_LOG(ERR, "Unsupported GRE key length of %u", len);
+ return ret;
+ }
+
+ if (reg != val) {
+ ret = i40e_aq_debug_write_register(hw, I40E_GL_PRS_FVBM(2),
+ reg, NULL);
+ if (ret != 0)
+ return ret;
+ } else {
+ ret = 0;
+ }
+ PMD_DRV_LOG(DEBUG, "Read modified GL_PRS_FVBM with 0x%08x\n",
+ I40E_READ_REG(hw, I40E_GL_PRS_FVBM(2)));
+
+ return ret;
+}
+
+static int
+i40e_dev_global_config_set(struct i40e_hw *hw, struct rte_eth_global_cfg *cfg)
+{
+ int ret = -EINVAL;
+
+ if (!hw || !cfg)
+ return -EINVAL;
+
+ switch (cfg->cfg_type) {
+ case RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN:
+ ret = i40e_dev_set_gre_key_len(hw, cfg->cfg.gre_key_len);
+ break;
+ default:
+ PMD_DRV_LOG(ERR, "Unknown config type %u", cfg->cfg_type);
+ break;
+ }
+
+ return ret;
+}
+
+static int
+i40e_filter_ctrl_global_config(struct rte_eth_dev *dev,
+ enum rte_filter_op filter_op,
+ void *arg)
+{
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ int ret = I40E_ERR_PARAM;
+
+ switch (filter_op) {
+ case RTE_ETH_FILTER_SET:
+ ret = i40e_dev_global_config_set(hw,
+ (struct rte_eth_global_cfg *)arg);
+ break;
+ default:
+ PMD_DRV_LOG(ERR, "unknown operation %u", filter_op);
+ break;
+ }
+
+ return ret;
+}
+
+static int
+i40e_tunnel_filter_handle(struct rte_eth_dev *dev,
+ enum rte_filter_op filter_op,
+ void *arg)
{
struct rte_eth_tunnel_filter_conf *filter;
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -5377,6 +5452,7 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev, enum rte_filter_op filter_op,
case RTE_ETH_FILTER_NOP:
if (!(pf->flags & I40E_FLAG_VXLAN))
ret = I40E_NOT_SUPPORTED;
+ break;
case RTE_ETH_FILTER_ADD:
ret = i40e_dev_tunnel_filter_set(pf, filter, 1);
break;
@@ -6268,6 +6344,10 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
return -EINVAL;
switch (filter_type) {
+ case RTE_ETH_FILTER_NONE:
+ /* For global configuration */
+ ret = i40e_filter_ctrl_global_config(dev, filter_op, arg);
+ break;
case RTE_ETH_FILTER_HASH:
ret = i40e_hash_filter_ctrl(dev, filter_op, arg);
break;
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index a7f2ee7..78f5cd1 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -295,6 +295,26 @@ struct rte_eth_tunnel_filter_conf {
uint16_t queue_id; /** < queue number. */
};
+/**
+ * Global eth device configuration type.
+ */
+enum rte_eth_global_cfg_type {
+ RTE_ETH_GLOBAL_CFG_TYPE_UNKNOWN = 0,
+ RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN,
+ RTE_ETH_GLOBAL_CFG_TYPE_MAX,
+};
+
+/**
+ * Global eth device configuration.
+ */
+struct rte_eth_global_cfg {
+ enum rte_eth_global_cfg_type cfg_type; /**< Global config type. */
+ union {
+ uint8_t gre_key_len; /**< Valid GRE key length in byte. */
+ uint64_t reserved; /**< Reserve space for future use. */
+ } cfg;
+};
+
#define RTE_ETH_FDIR_MAX_FLEXLEN 16 /** < Max length of flexbytes. */
#define RTE_ETH_INSET_SIZE_MAX 128 /** < Max length of input set. */
--
1.9.3
next prev parent reply other threads:[~2015-09-24 7:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 7:16 [dpdk-dev] [PATCH 0/2] add selecting different " Helin Zhang
2015-09-24 7:16 ` Helin Zhang [this message]
2015-09-24 7:16 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add test commands for selecting different GRE key sizes Helin Zhang
2015-10-20 6:18 ` [dpdk-dev] [PATCH v2 0/2] add selecting different GRE key length Helin Zhang
2015-10-20 6:18 ` [dpdk-dev] [PATCH v2 1/2] i40e: add selecting " Helin Zhang
2015-10-20 6:18 ` [dpdk-dev] [PATCH v2 2/2] app/testpmd: add test commands for selecting different GRE key sizes Helin Zhang
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 0/3] add selecting different GRE key length Helin Zhang
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 1/3] i40e: add selecting " Helin Zhang
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 2/3] app/testpmd: add test commands for selecting different GRE key sizes Helin Zhang
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 3/3] doc: update release notes and testpmd guide Helin Zhang
2015-10-29 7:48 ` Thomas Monjalon
2015-10-29 8:43 ` Zhang, Helin
2015-10-30 4:54 ` [dpdk-dev] [PATCH v4 0/2] add selecting different GRE key length Helin Zhang
2015-10-30 4:54 ` [dpdk-dev] [PATCH v4 1/2] i40e: add selecting " Helin Zhang
2015-10-30 4:54 ` [dpdk-dev] [PATCH v4 2/2] app/testpmd: add test commands for selecting different GRE key sizes Helin Zhang
2015-10-30 5:37 ` [dpdk-dev] [PATCH v4 0/2] add selecting different GRE key length Tao, Zhe
2015-11-02 15:07 ` [dpdk-dev] [PATCH v5 " Helin Zhang
2015-11-02 15:07 ` [dpdk-dev] [PATCH v5 1/2] i40e: add selecting " Helin Zhang
2015-11-02 15:07 ` [dpdk-dev] [PATCH v5 2/2] app/testpmd: add test commands for selecting different GRE key sizes Helin Zhang
2015-11-03 16:28 ` [dpdk-dev] [PATCH v6 0/2] add selecting different GRE key length Helin Zhang
2015-11-03 16:28 ` [dpdk-dev] [PATCH v6 1/2] i40e: add selecting " Helin Zhang
2015-11-03 16:28 ` [dpdk-dev] [PATCH v6 2/2] app/testpmd: add test commands for selecting different GRE key sizes Helin Zhang
2015-11-03 23:38 ` [dpdk-dev] [PATCH v6 0/2] add selecting different GRE key length 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=1443078979-20774-2-git-send-email-helin.zhang@intel.com \
--to=helin.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=yulong.pei@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).