* [dpdk-dev] [PATCH 0/2] add selecting different GRE key length
@ 2015-09-24 7:16 Helin Zhang
2015-09-24 7:16 ` [dpdk-dev] [PATCH 1/2] i40e: add selecting " Helin Zhang
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Helin Zhang @ 2015-09-24 7:16 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
By default, only 3 bytes of GRE key will be used for hash or filter
calculation. Here adds a workaround for selecting 3 or 4 bytes of GRE
key for that purpose.
Helin Zhang (2):
i40e: add selecting GRE key length
app/testpmd: add test commands for selecting different GRE key sizes
app/test-pmd/cmdline.c | 52 +++++++++++++++++++++++++
drivers/net/i40e/i40e_ethdev.c | 86 +++++++++++++++++++++++++++++++++++++++--
lib/librte_ether/rte_eth_ctrl.h | 20 ++++++++++
3 files changed, 155 insertions(+), 3 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH 1/2] i40e: add selecting GRE key length
2015-09-24 7:16 [dpdk-dev] [PATCH 0/2] add selecting different GRE key length Helin Zhang
@ 2015-09-24 7:16 ` Helin Zhang
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
2 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-09-24 7:16 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH 2/2] app/testpmd: add test commands for selecting different GRE key sizes
2015-09-24 7:16 [dpdk-dev] [PATCH 0/2] add selecting different GRE key length Helin Zhang
2015-09-24 7:16 ` [dpdk-dev] [PATCH 1/2] i40e: add selecting " Helin Zhang
@ 2015-09-24 7:16 ` Helin Zhang
2015-10-20 6:18 ` [dpdk-dev] [PATCH v2 0/2] add selecting different GRE key length Helin Zhang
2 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-09-24 7:16 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
Test commands are added to support selecting differnt length of
GRE key.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
app/test-pmd/cmdline.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 06bc26e..50003c8 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6623,6 +6623,57 @@ cmdline_parse_inst_t cmd_tunnel_udp_config = {
},
};
+/* *** GLOBAL CONFIG *** */
+struct cmd_global_config_result {
+ cmdline_fixed_string_t cmd;
+ uint8_t port_id;
+ cmdline_fixed_string_t cfg_type;
+ uint8_t len;
+};
+
+static void
+cmd_global_config_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_global_config_result *res = parsed_result;
+ struct rte_eth_global_cfg conf;
+ int ret;
+
+ memset(&conf, 0, sizeof(conf));
+ conf.cfg_type = RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN;
+ conf.cfg.gre_key_len = res->len;
+ ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_NONE,
+ RTE_ETH_FILTER_SET, &conf);
+ if (ret != 0)
+ printf("Global config error\n");
+}
+
+cmdline_parse_token_string_t cmd_global_config_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result, cmd,
+ "global_config");
+cmdline_parse_token_num_t cmd_global_config_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result, port_id, UINT8);
+cmdline_parse_token_string_t cmd_global_config_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result,
+ cfg_type, "gre-key-len");
+cmdline_parse_token_num_t cmd_global_config_gre_key_len =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result,
+ len, UINT8);
+
+cmdline_parse_inst_t cmd_global_config = {
+ .f = cmd_global_config_parsed,
+ .data = (void *)NULL,
+ .help_str = "global_config <port_id> gre-key-len <number>",
+ .tokens = {
+ (void *)&cmd_global_config_cmd,
+ (void *)&cmd_global_config_port_id,
+ (void *)&cmd_global_config_type,
+ (void *)&cmd_global_config_gre_key_len,
+ NULL,
+ },
+};
+
/* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */
struct cmd_set_mirror_mask_result {
cmdline_fixed_string_t set;
@@ -9122,6 +9173,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
(cmdline_parse_inst_t *)&cmd_tunnel_filter,
(cmdline_parse_inst_t *)&cmd_tunnel_udp_config,
+ (cmdline_parse_inst_t *)&cmd_global_config,
(cmdline_parse_inst_t *)&cmd_set_mirror_mask,
(cmdline_parse_inst_t *)&cmd_set_mirror_link,
(cmdline_parse_inst_t *)&cmd_reset_mirror_rule,
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v2 0/2] add selecting different GRE key length
2015-09-24 7:16 [dpdk-dev] [PATCH 0/2] add selecting different GRE key length Helin Zhang
2015-09-24 7:16 ` [dpdk-dev] [PATCH 1/2] i40e: add selecting " Helin Zhang
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 ` Helin Zhang
2015-10-20 6:18 ` [dpdk-dev] [PATCH v2 1/2] i40e: add selecting " Helin Zhang
` (2 more replies)
2 siblings, 3 replies; 23+ messages in thread
From: Helin Zhang @ 2015-10-20 6:18 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
By default, only 3 bytes of GRE key will be used for hash or FD
calculation. Here adds selecting 3 or 4 bytes of GRE key for those
purpose.
Note that these patches are based on another patch set
of "[PATCH v4 0/2] i40e: RSS/FD granularity configuration"!
v2 changes:
Updated with RSS/FD granularity code.
Helin Zhang (2):
i40e: add selecting GRE key length
app/testpmd: add test commands for selecting different GRE key sizes
app/test-pmd/cmdline.c | 52 ++++++++++++++++++++++++
drivers/net/i40e/i40e_ethdev.c | 87 +++++++++++++++++++++++++++++++++++++++--
lib/librte_ether/rte_eth_ctrl.h | 20 ++++++++++
3 files changed, 156 insertions(+), 3 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] i40e: add selecting GRE key length
2015-10-20 6:18 ` [dpdk-dev] [PATCH v2 0/2] add selecting different GRE key length Helin Zhang
@ 2015-10-20 6:18 ` 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
2 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-10-20 6:18 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
By default, only first 3 bytes of GRE key will be used for hash or
FD calculation. With these changes, it can select 3 or 4 bytes of
GRE key for hash or FD 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 | 87 +++++++++++++++++++++++++++++++++++++++--
lib/librte_ether/rte_eth_ctrl.h | 20 ++++++++++
2 files changed, 104 insertions(+), 3 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 9bf7898..8cca74b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5333,7 +5333,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");
@@ -5365,9 +5365,85 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,
return 0;
}
+#define I40E_GL_PRS_FVBM_MSK_ENA 0x80000000
+#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 | I40E_GL_PRS_FVBM_MSK_ENA;
+ } else if (len == 4) {
+ reg = val & ~I40E_GL_PRS_FVBM_MSK_ENA;
+ } 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);
@@ -5382,6 +5458,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;
@@ -6392,6 +6469,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 4ba86ee..d02a68e 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] app/testpmd: add test commands for selecting different GRE key sizes
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 ` Helin Zhang
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 0/3] add selecting different GRE key length Helin Zhang
2 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-10-20 6:18 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
Test commands are added to support selecting differnt length of GRE key.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
app/test-pmd/cmdline.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a71b200..fef0011 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6623,6 +6623,57 @@ cmdline_parse_inst_t cmd_tunnel_udp_config = {
},
};
+/* *** GLOBAL CONFIG *** */
+struct cmd_global_config_result {
+ cmdline_fixed_string_t cmd;
+ uint8_t port_id;
+ cmdline_fixed_string_t cfg_type;
+ uint8_t len;
+};
+
+static void
+cmd_global_config_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_global_config_result *res = parsed_result;
+ struct rte_eth_global_cfg conf;
+ int ret;
+
+ memset(&conf, 0, sizeof(conf));
+ conf.cfg_type = RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN;
+ conf.cfg.gre_key_len = res->len;
+ ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_NONE,
+ RTE_ETH_FILTER_SET, &conf);
+ if (ret != 0)
+ printf("Global config error\n");
+}
+
+cmdline_parse_token_string_t cmd_global_config_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result, cmd,
+ "global_config");
+cmdline_parse_token_num_t cmd_global_config_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result, port_id, UINT8);
+cmdline_parse_token_string_t cmd_global_config_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result,
+ cfg_type, "gre-key-len");
+cmdline_parse_token_num_t cmd_global_config_gre_key_len =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result,
+ len, UINT8);
+
+cmdline_parse_inst_t cmd_global_config = {
+ .f = cmd_global_config_parsed,
+ .data = (void *)NULL,
+ .help_str = "global_config <port_id> gre-key-len <number>",
+ .tokens = {
+ (void *)&cmd_global_config_cmd,
+ (void *)&cmd_global_config_port_id,
+ (void *)&cmd_global_config_type,
+ (void *)&cmd_global_config_gre_key_len,
+ NULL,
+ },
+};
+
/* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */
struct cmd_set_mirror_mask_result {
cmdline_fixed_string_t set;
@@ -9202,6 +9253,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
(cmdline_parse_inst_t *)&cmd_tunnel_filter,
(cmdline_parse_inst_t *)&cmd_tunnel_udp_config,
+ (cmdline_parse_inst_t *)&cmd_global_config,
(cmdline_parse_inst_t *)&cmd_set_mirror_mask,
(cmdline_parse_inst_t *)&cmd_set_mirror_link,
(cmdline_parse_inst_t *)&cmd_reset_mirror_rule,
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v3 0/3] add selecting different GRE key length
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 ` Helin Zhang
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 1/3] i40e: add selecting " Helin Zhang
` (3 more replies)
2 siblings, 4 replies; 23+ messages in thread
From: Helin Zhang @ 2015-10-29 6:18 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
By default, only 3 bytes of GRE key will be used for hash or FD
calculation. Here adds selecting 3 or 4 bytes of GRE key for those
purpose.
Note that these patches are based on another patch set of
"[PATCH v6 0/2] i40e: RSS/FD granularity configuration".
v2 changes:
Updated with RSS/FD granularity code.
v3 changes:
Updated with RSS/FD granularity code.
Updated documentation.
Helin Zhang (3):
i40e: add selecting GRE key length
app/testpmd: add test commands for selecting different GRE key sizes
doc: update release notes and testpmd guide
app/test-pmd/cmdline.c | 52 +++++++++++++++++
doc/guides/rel_notes/release_2_2.rst | 2 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++
drivers/net/i40e/i40e_ethdev.c | 87 ++++++++++++++++++++++++++++-
lib/librte_ether/rte_eth_ctrl.h | 20 +++++++
5 files changed, 169 insertions(+), 3 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v3 1/3] i40e: add selecting GRE key length
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 0/3] add selecting different GRE key length Helin Zhang
@ 2015-10-29 6:18 ` 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
` (2 subsequent siblings)
3 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-10-29 6:18 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
By default, only first 3 bytes of GRE key will be used for hash or
FD calculation. With these changes, it can select 3 or 4 bytes of
GRE key for hash or FD 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 | 87 +++++++++++++++++++++++++++++++++++++++--
lib/librte_ether/rte_eth_ctrl.h | 20 ++++++++++
2 files changed, 104 insertions(+), 3 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index fb262a5..8de8aee 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5339,7 +5339,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");
@@ -5371,9 +5371,85 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,
return 0;
}
+#define I40E_GL_PRS_FVBM_MSK_ENA 0x80000000
+#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 | I40E_GL_PRS_FVBM_MSK_ENA;
+ } else if (len == 4) {
+ reg = val & ~I40E_GL_PRS_FVBM_MSK_ENA;
+ } 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);
@@ -5388,6 +5464,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;
@@ -6386,6 +6463,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 11829f1..651a00c 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v3 2/3] app/testpmd: add test commands for selecting different GRE key sizes
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 ` Helin Zhang
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 3/3] doc: update release notes and testpmd guide Helin Zhang
2015-10-30 4:54 ` [dpdk-dev] [PATCH v4 0/2] add selecting different GRE key length Helin Zhang
3 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-10-29 6:18 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
Test commands are added to support selecting differnt length of GRE key.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
app/test-pmd/cmdline.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 1a2cb7d..cd49637 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6645,6 +6645,57 @@ cmdline_parse_inst_t cmd_tunnel_udp_config = {
},
};
+/* *** GLOBAL CONFIG *** */
+struct cmd_global_config_result {
+ cmdline_fixed_string_t cmd;
+ uint8_t port_id;
+ cmdline_fixed_string_t cfg_type;
+ uint8_t len;
+};
+
+static void
+cmd_global_config_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_global_config_result *res = parsed_result;
+ struct rte_eth_global_cfg conf;
+ int ret;
+
+ memset(&conf, 0, sizeof(conf));
+ conf.cfg_type = RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN;
+ conf.cfg.gre_key_len = res->len;
+ ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_NONE,
+ RTE_ETH_FILTER_SET, &conf);
+ if (ret != 0)
+ printf("Global config error\n");
+}
+
+cmdline_parse_token_string_t cmd_global_config_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result, cmd,
+ "global_config");
+cmdline_parse_token_num_t cmd_global_config_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result, port_id, UINT8);
+cmdline_parse_token_string_t cmd_global_config_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result,
+ cfg_type, "gre-key-len");
+cmdline_parse_token_num_t cmd_global_config_gre_key_len =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result,
+ len, UINT8);
+
+cmdline_parse_inst_t cmd_global_config = {
+ .f = cmd_global_config_parsed,
+ .data = (void *)NULL,
+ .help_str = "global_config <port_id> gre-key-len <number>",
+ .tokens = {
+ (void *)&cmd_global_config_cmd,
+ (void *)&cmd_global_config_port_id,
+ (void *)&cmd_global_config_type,
+ (void *)&cmd_global_config_gre_key_len,
+ NULL,
+ },
+};
+
/* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */
struct cmd_set_mirror_mask_result {
cmdline_fixed_string_t set;
@@ -9484,6 +9535,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
(cmdline_parse_inst_t *)&cmd_tunnel_filter,
(cmdline_parse_inst_t *)&cmd_tunnel_udp_config,
+ (cmdline_parse_inst_t *)&cmd_global_config,
(cmdline_parse_inst_t *)&cmd_set_mirror_mask,
(cmdline_parse_inst_t *)&cmd_set_mirror_link,
(cmdline_parse_inst_t *)&cmd_reset_mirror_rule,
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v3 3/3] doc: update release notes and testpmd guide
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 ` Helin Zhang
2015-10-29 7:48 ` Thomas Monjalon
2015-10-30 4:54 ` [dpdk-dev] [PATCH v4 0/2] add selecting different GRE key length Helin Zhang
3 siblings, 1 reply; 23+ messages in thread
From: Helin Zhang @ 2015-10-29 6:18 UTC (permalink / raw)
To: dev; +Cc: yulong.pei
Update release notes with the newly added feature of selecting
different GRE key length for input set, and testpmd guide with
newly added commands for that.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
doc/guides/rel_notes/release_2_2.rst | 2 ++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 8fc8917..7b4b97e 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -25,6 +25,8 @@ New Features
* **Added RSS/FD input set granularity on Intel X710/XL710.**
+* **Added selecting different GRE key length for input set on Intel X710/XL710.**
+
Resolved Issues
---------------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f5951c0..5ed7c66 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1810,3 +1810,14 @@ Set the input set for Fdir::
For example to add source IP to FD input set for flow type of ipv4 on port 0::
testpmd> set_fdir_input_set 0 ipv4 src-ipv4 add
+
+global_config
+~~~~~~~~~~~~~
+
+Set different GRE key length for input set::
+
+ global_config (port_id) gre-key-len (number in bytes)
+
+For example to set GRE key length for input set to 4 bytes on port 0::
+
+ testpmd> global_config 0 gre-key-len 4
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH v3 3/3] doc: update release notes and testpmd guide
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
0 siblings, 1 reply; 23+ messages in thread
From: Thomas Monjalon @ 2015-10-29 7:48 UTC (permalink / raw)
To: Helin Zhang; +Cc: dev
Hi Helin,
Please avoid making a commit for doc only.
These changes are related to some code changes and must be atomic.
For next time, please update the release notes in the patch adding the
feature (i40e here) and the testpmd doc in the testpmd patch.
Thanks for explaining the logic to others
2015-10-29 14:18, Helin Zhang:
> Update release notes with the newly added feature of selecting
> different GRE key length for input set, and testpmd guide with
> newly added commands for that.
>
> Signed-off-by: Helin Zhang <helin.zhang@intel.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH v3 3/3] doc: update release notes and testpmd guide
2015-10-29 7:48 ` Thomas Monjalon
@ 2015-10-29 8:43 ` Zhang, Helin
0 siblings, 0 replies; 23+ messages in thread
From: Zhang, Helin @ 2015-10-29 8:43 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Thursday, October 29, 2015 3:48 PM
> To: Zhang, Helin
> Cc: dev@dpdk.org; Pei, Yulong
> Subject: Re: [dpdk-dev] [PATCH v3 3/3] doc: update release notes and testpmd
> guide
>
> Hi Helin,
>
> Please avoid making a commit for doc only.
> These changes are related to some code changes and must be atomic.
> For next time, please update the release notes in the patch adding the feature
> (i40e here) and the testpmd doc in the testpmd patch.
Good to learn that! Thank you for the guidance!
Helin
>
> Thanks for explaining the logic to others
>
> 2015-10-29 14:18, Helin Zhang:
> > Update release notes with the newly added feature of selecting
> > different GRE key length for input set, and testpmd guide with newly
> > added commands for that.
> >
> > Signed-off-by: Helin Zhang <helin.zhang@intel.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v4 0/2] add selecting different GRE key length
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 0/3] add selecting different GRE key length Helin Zhang
` (2 preceding siblings ...)
2015-10-29 6:18 ` [dpdk-dev] [PATCH v3 3/3] doc: update release notes and testpmd guide Helin Zhang
@ 2015-10-30 4:54 ` Helin Zhang
2015-10-30 4:54 ` [dpdk-dev] [PATCH v4 1/2] i40e: add selecting " Helin Zhang
` (3 more replies)
3 siblings, 4 replies; 23+ messages in thread
From: Helin Zhang @ 2015-10-30 4:54 UTC (permalink / raw)
To: dev
By default, only 3 bytes of GRE key will be used for hash or FD
calculation. Here adds selecting 3 or 4 bytes of GRE key for those
purpose.
Note that these patches are based on another patch set of
"[PATCH v7 0/2] i40e: RSS/FD granularity configuration".
v2 changes:
Updated with RSS/FD granularity code.
v3 changes:
Updated with RSS/FD granularity code.
Updated documentation.
v4 changes:
Added the update of release note and testpmd guide to the code
patches separately.
Updated with RSS/FD granularity code v7.
Helin Zhang (2):
i40e: add selecting GRE key length
app/testpmd: add test commands for selecting different GRE key sizes
app/test-pmd/cmdline.c | 52 +++++++++++++++++
doc/guides/rel_notes/release_2_2.rst | 2 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++
drivers/net/i40e/i40e_ethdev.c | 87 ++++++++++++++++++++++++++++-
lib/librte_ether/rte_eth_ctrl.h | 20 +++++++
5 files changed, 169 insertions(+), 3 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v4 1/2] i40e: add selecting GRE key length
2015-10-30 4:54 ` [dpdk-dev] [PATCH v4 0/2] add selecting different GRE key length Helin Zhang
@ 2015-10-30 4:54 ` 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
` (2 subsequent siblings)
3 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-10-30 4:54 UTC (permalink / raw)
To: dev
By default, only first 3 bytes of GRE key will be used for hash or
FD calculation. With these changes, it can select 3 or 4 bytes of
GRE key for hash or FD calculation.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
doc/guides/rel_notes/release_2_2.rst | 2 +
drivers/net/i40e/i40e_ethdev.c | 87 ++++++++++++++++++++++++++++++++++--
lib/librte_ether/rte_eth_ctrl.h | 20 +++++++++
3 files changed, 106 insertions(+), 3 deletions(-)
v4 changes:
Added the release notes update to this patch directly.
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 2a54ce6..4f36f96 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -33,6 +33,8 @@ New Features
* **Added RSS/FD input set granularity on Intel X710/XL710.**
+* **Added selecting different GRE key length for input set on Intel X710/XL710.**
+
Resolved Issues
---------------
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index fb262a5..8de8aee 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5339,7 +5339,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");
@@ -5371,9 +5371,85 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,
return 0;
}
+#define I40E_GL_PRS_FVBM_MSK_ENA 0x80000000
+#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 | I40E_GL_PRS_FVBM_MSK_ENA;
+ } else if (len == 4) {
+ reg = val & ~I40E_GL_PRS_FVBM_MSK_ENA;
+ } 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);
@@ -5388,6 +5464,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;
@@ -6386,6 +6463,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 3dc10db..b415491 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 1 /** < Max length of input set. */
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v4 2/2] app/testpmd: add test commands for selecting different GRE key sizes
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 ` 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
3 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-10-30 4:54 UTC (permalink / raw)
To: dev
Test commands are added to support selecting differnt length of GRE key.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
app/test-pmd/cmdline.c | 52 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++++
2 files changed, 63 insertions(+)
v4 changes:
Added testpmd guide update to this patch directly.
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 1a2cb7d..cd49637 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6645,6 +6645,57 @@ cmdline_parse_inst_t cmd_tunnel_udp_config = {
},
};
+/* *** GLOBAL CONFIG *** */
+struct cmd_global_config_result {
+ cmdline_fixed_string_t cmd;
+ uint8_t port_id;
+ cmdline_fixed_string_t cfg_type;
+ uint8_t len;
+};
+
+static void
+cmd_global_config_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_global_config_result *res = parsed_result;
+ struct rte_eth_global_cfg conf;
+ int ret;
+
+ memset(&conf, 0, sizeof(conf));
+ conf.cfg_type = RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN;
+ conf.cfg.gre_key_len = res->len;
+ ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_NONE,
+ RTE_ETH_FILTER_SET, &conf);
+ if (ret != 0)
+ printf("Global config error\n");
+}
+
+cmdline_parse_token_string_t cmd_global_config_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result, cmd,
+ "global_config");
+cmdline_parse_token_num_t cmd_global_config_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result, port_id, UINT8);
+cmdline_parse_token_string_t cmd_global_config_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result,
+ cfg_type, "gre-key-len");
+cmdline_parse_token_num_t cmd_global_config_gre_key_len =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result,
+ len, UINT8);
+
+cmdline_parse_inst_t cmd_global_config = {
+ .f = cmd_global_config_parsed,
+ .data = (void *)NULL,
+ .help_str = "global_config <port_id> gre-key-len <number>",
+ .tokens = {
+ (void *)&cmd_global_config_cmd,
+ (void *)&cmd_global_config_port_id,
+ (void *)&cmd_global_config_type,
+ (void *)&cmd_global_config_gre_key_len,
+ NULL,
+ },
+};
+
/* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */
struct cmd_set_mirror_mask_result {
cmdline_fixed_string_t set;
@@ -9484,6 +9535,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
(cmdline_parse_inst_t *)&cmd_tunnel_filter,
(cmdline_parse_inst_t *)&cmd_tunnel_udp_config,
+ (cmdline_parse_inst_t *)&cmd_global_config,
(cmdline_parse_inst_t *)&cmd_set_mirror_mask,
(cmdline_parse_inst_t *)&cmd_set_mirror_link,
(cmdline_parse_inst_t *)&cmd_reset_mirror_rule,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f5951c0..5ed7c66 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1810,3 +1810,14 @@ Set the input set for Fdir::
For example to add source IP to FD input set for flow type of ipv4 on port 0::
testpmd> set_fdir_input_set 0 ipv4 src-ipv4 add
+
+global_config
+~~~~~~~~~~~~~
+
+Set different GRE key length for input set::
+
+ global_config (port_id) gre-key-len (number in bytes)
+
+For example to set GRE key length for input set to 4 bytes on port 0::
+
+ testpmd> global_config 0 gre-key-len 4
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/2] add selecting different GRE key length
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 ` Tao, Zhe
2015-11-02 15:07 ` [dpdk-dev] [PATCH v5 " Helin Zhang
3 siblings, 0 replies; 23+ messages in thread
From: Tao, Zhe @ 2015-10-30 5:37 UTC (permalink / raw)
To: Zhang, Helin, dev
-----Original Message-----
From: Zhang, Helin
Sent: Friday, October 30, 2015 12:54 PM
To: dev@dpdk.org
Cc: Chilikin, Andrey; Pei, Yulong; Liu, Yong; Wu, Jingjing; Zhang, Helin
Subject: [PATCH v4 0/2] add selecting different GRE key length
By default, only 3 bytes of GRE key will be used for hash or FD calculation. Here adds selecting 3 or 4 bytes of GRE key for those purpose.
Note that these patches are based on another patch set of "[PATCH v7 0/2] i40e: RSS/FD granularity configuration".
v2 changes:
Updated with RSS/FD granularity code.
v3 changes:
Updated with RSS/FD granularity code.
Updated documentation.
v4 changes:
Added the update of release note and testpmd guide to the code patches separately.
Updated with RSS/FD granularity code v7.
Helin Zhang (2):
i40e: add selecting GRE key length
app/testpmd: add test commands for selecting different GRE key sizes
app/test-pmd/cmdline.c | 52 +++++++++++++++++
doc/guides/rel_notes/release_2_2.rst | 2 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++
drivers/net/i40e/i40e_ethdev.c | 87 ++++++++++++++++++++++++++++-
lib/librte_ether/rte_eth_ctrl.h | 20 +++++++
5 files changed, 169 insertions(+), 3 deletions(-)
--
1.9.3
Acked-by: Zhe Tao <zhe.tao@intel.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v5 0/2] add selecting different GRE key length
2015-10-30 4:54 ` [dpdk-dev] [PATCH v4 0/2] add selecting different GRE key length Helin Zhang
` (2 preceding siblings ...)
2015-10-30 5:37 ` [dpdk-dev] [PATCH v4 0/2] add selecting different GRE key length Tao, Zhe
@ 2015-11-02 15:07 ` Helin Zhang
2015-11-02 15:07 ` [dpdk-dev] [PATCH v5 1/2] i40e: add selecting " Helin Zhang
` (2 more replies)
3 siblings, 3 replies; 23+ messages in thread
From: Helin Zhang @ 2015-11-02 15:07 UTC (permalink / raw)
To: dev
By default, only 3 bytes of GRE key will be used for hash or FD calculation.
Here adds selecting 3 or 4 bytes of GRE key for those purpose.
Note that these patches are based on another patch set of
"[PATCH v8 0/2] i40e: RSS/FD granularity configuration".
v2 changes:
Updated with RSS/FD granularity code.
v3 changes:
Updated with RSS/FD granularity code.
Updated documentation.
v4 changes:
Added the update of release note and testpmd guide to the code patches separately.
Updated with RSS/FD granularity code v7.
v5 changes:
Updated with RSS/FD granularity code v8.
Helin Zhang (2):
i40e: add selecting GRE key length
app/testpmd: add test commands for selecting different GRE key sizes
app/test-pmd/cmdline.c | 52 +++++++++++++++++
doc/guides/rel_notes/release_2_2.rst | 2 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++
drivers/net/i40e/i40e_ethdev.c | 87 ++++++++++++++++++++++++++++-
lib/librte_ether/rte_eth_ctrl.h | 20 +++++++
5 files changed, 169 insertions(+), 3 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v5 1/2] i40e: add selecting GRE key length
2015-11-02 15:07 ` [dpdk-dev] [PATCH v5 " Helin Zhang
@ 2015-11-02 15:07 ` 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
2 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-11-02 15:07 UTC (permalink / raw)
To: dev
By default, only first 3 bytes of GRE key will be used for hash or FD
calculation. With these changes, it can select 3 or 4 bytes of GRE key
for hash or FD calculation.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
doc/guides/rel_notes/release_2_2.rst | 2 +
drivers/net/i40e/i40e_ethdev.c | 87 ++++++++++++++++++++++++++++++++++--
lib/librte_ether/rte_eth_ctrl.h | 20 +++++++++
3 files changed, 106 insertions(+), 3 deletions(-)
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index f42f0d4..5286233 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -61,6 +61,8 @@ New Features
* **Added RSS/FD input set granularity on Intel X710/XL710.**
+* **Added selecting different GRE key length for input set on Intel X710/XL710.**
+
Resolved Issues
---------------
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 75c368f..3c11a2e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5597,7 +5597,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");
@@ -5629,9 +5629,85 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,
return 0;
}
+#define I40E_GL_PRS_FVBM_MSK_ENA 0x80000000
+#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 | I40E_GL_PRS_FVBM_MSK_ENA;
+ } else if (len == 4) {
+ reg = val & ~I40E_GL_PRS_FVBM_MSK_ENA;
+ } 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);
@@ -5646,6 +5722,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;
@@ -6639,6 +6716,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 ae73c36..f71669c 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v5 2/2] app/testpmd: add test commands for selecting different GRE key sizes
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 ` Helin Zhang
2015-11-03 16:28 ` [dpdk-dev] [PATCH v6 0/2] add selecting different GRE key length Helin Zhang
2 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-11-02 15:07 UTC (permalink / raw)
To: dev
Test commands are added to support selecting differnt length of GRE key.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
app/test-pmd/cmdline.c | 52 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++++
2 files changed, 63 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 6a384a2..1018379 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6739,6 +6739,57 @@ cmdline_parse_inst_t cmd_tunnel_udp_config = {
},
};
+/* *** GLOBAL CONFIG *** */
+struct cmd_global_config_result {
+ cmdline_fixed_string_t cmd;
+ uint8_t port_id;
+ cmdline_fixed_string_t cfg_type;
+ uint8_t len;
+};
+
+static void
+cmd_global_config_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_global_config_result *res = parsed_result;
+ struct rte_eth_global_cfg conf;
+ int ret;
+
+ memset(&conf, 0, sizeof(conf));
+ conf.cfg_type = RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN;
+ conf.cfg.gre_key_len = res->len;
+ ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_NONE,
+ RTE_ETH_FILTER_SET, &conf);
+ if (ret != 0)
+ printf("Global config error\n");
+}
+
+cmdline_parse_token_string_t cmd_global_config_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result, cmd,
+ "global_config");
+cmdline_parse_token_num_t cmd_global_config_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result, port_id, UINT8);
+cmdline_parse_token_string_t cmd_global_config_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result,
+ cfg_type, "gre-key-len");
+cmdline_parse_token_num_t cmd_global_config_gre_key_len =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result,
+ len, UINT8);
+
+cmdline_parse_inst_t cmd_global_config = {
+ .f = cmd_global_config_parsed,
+ .data = (void *)NULL,
+ .help_str = "global_config <port_id> gre-key-len <number>",
+ .tokens = {
+ (void *)&cmd_global_config_cmd,
+ (void *)&cmd_global_config_port_id,
+ (void *)&cmd_global_config_type,
+ (void *)&cmd_global_config_gre_key_len,
+ NULL,
+ },
+};
+
/* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */
struct cmd_set_mirror_mask_result {
cmdline_fixed_string_t set;
@@ -9579,6 +9630,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
(cmdline_parse_inst_t *)&cmd_tunnel_filter,
(cmdline_parse_inst_t *)&cmd_tunnel_udp_config,
+ (cmdline_parse_inst_t *)&cmd_global_config,
(cmdline_parse_inst_t *)&cmd_set_mirror_mask,
(cmdline_parse_inst_t *)&cmd_set_mirror_link,
(cmdline_parse_inst_t *)&cmd_reset_mirror_rule,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 75b0a57..957f889 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1812,3 +1812,14 @@ Set the input set for Fdir::
For example to add source IP to FD input set for flow type of ipv4 on port 0::
testpmd> set_fdir_input_set 0 ipv4 src-ipv4 add
+
+global_config
+~~~~~~~~~~~~~
+
+Set different GRE key length for input set::
+
+ global_config (port_id) gre-key-len (number in bytes)
+
+For example to set GRE key length for input set to 4 bytes on port 0::
+
+ testpmd> global_config 0 gre-key-len 4
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v6 0/2] add selecting different GRE key length
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 ` Helin Zhang
2015-11-03 16:28 ` [dpdk-dev] [PATCH v6 1/2] i40e: add selecting " Helin Zhang
` (2 more replies)
2 siblings, 3 replies; 23+ messages in thread
From: Helin Zhang @ 2015-11-03 16:28 UTC (permalink / raw)
To: dev
By default, only 3 bytes of GRE key will be used for hash or FD calculation.
Here adds selecting 3 or 4 bytes of GRE key for those purpose.
Note that these patches are based on another patch set of
"[PATCH v9 0/2] i40e: RSS/FD granularity configuration".
v2 changes:
Updated with RSS/FD granularity code.
v3 changes:
Updated with RSS/FD granularity code.
Updated documentation.
v4 changes:
Added the update of release note and testpmd guide to the code patches separately.
Updated with RSS/FD granularity code v7.
v5 changes:
Updated with RSS/FD granularity code v8.
v6 changes:
Updated with RSS/FD granularity code v9.
Helin Zhang (2):
i40e: add selecting GRE key length
app/testpmd: add test commands for selecting different GRE key sizes
app/test-pmd/cmdline.c | 52 +++++++++++++++++
doc/guides/rel_notes/release_2_2.rst | 2 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++
drivers/net/i40e/i40e_ethdev.c | 87 ++++++++++++++++++++++++++++-
lib/librte_ether/rte_eth_ctrl.h | 20 +++++++
5 files changed, 169 insertions(+), 3 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v6 1/2] i40e: add selecting GRE key length
2015-11-03 16:28 ` [dpdk-dev] [PATCH v6 0/2] add selecting different GRE key length Helin Zhang
@ 2015-11-03 16:28 ` 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
2 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-11-03 16:28 UTC (permalink / raw)
To: dev
By default, only first 3 bytes of GRE key will be used for hash or
FD calculation. With these changes, it can select 3 or 4 bytes of
GRE key for hash or FD calculation.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
doc/guides/rel_notes/release_2_2.rst | 2 +
drivers/net/i40e/i40e_ethdev.c | 87 ++++++++++++++++++++++++++++++++++--
lib/librte_ether/rte_eth_ctrl.h | 20 +++++++++
3 files changed, 106 insertions(+), 3 deletions(-)
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index bbca629..1954170 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -81,6 +81,8 @@ New Features
* **Added RSS/FD input set granularity on Intel X710/XL710.**
+* **Added selecting different GRE key length for input set on Intel X710/XL710.**
+
Resolved Issues
---------------
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index e8fd7f1..6408e8d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5911,7 +5911,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");
@@ -5943,9 +5943,85 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,
return 0;
}
+#define I40E_GL_PRS_FVBM_MSK_ENA 0x80000000
+#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 | I40E_GL_PRS_FVBM_MSK_ENA;
+ } else if (len == 4) {
+ reg = val & ~I40E_GL_PRS_FVBM_MSK_ENA;
+ } 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);
@@ -5960,6 +6036,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;
@@ -6953,6 +7030,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 ae73c36..f71669c 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v6 2/2] app/testpmd: add test commands for selecting different GRE key sizes
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 ` Helin Zhang
2015-11-03 23:38 ` [dpdk-dev] [PATCH v6 0/2] add selecting different GRE key length Thomas Monjalon
2 siblings, 0 replies; 23+ messages in thread
From: Helin Zhang @ 2015-11-03 16:28 UTC (permalink / raw)
To: dev
Test commands are added to support selecting differnt length of GRE key.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
app/test-pmd/cmdline.c | 52 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++++
2 files changed, 63 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 6a384a2..1018379 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6739,6 +6739,57 @@ cmdline_parse_inst_t cmd_tunnel_udp_config = {
},
};
+/* *** GLOBAL CONFIG *** */
+struct cmd_global_config_result {
+ cmdline_fixed_string_t cmd;
+ uint8_t port_id;
+ cmdline_fixed_string_t cfg_type;
+ uint8_t len;
+};
+
+static void
+cmd_global_config_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_global_config_result *res = parsed_result;
+ struct rte_eth_global_cfg conf;
+ int ret;
+
+ memset(&conf, 0, sizeof(conf));
+ conf.cfg_type = RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN;
+ conf.cfg.gre_key_len = res->len;
+ ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_NONE,
+ RTE_ETH_FILTER_SET, &conf);
+ if (ret != 0)
+ printf("Global config error\n");
+}
+
+cmdline_parse_token_string_t cmd_global_config_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result, cmd,
+ "global_config");
+cmdline_parse_token_num_t cmd_global_config_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result, port_id, UINT8);
+cmdline_parse_token_string_t cmd_global_config_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_global_config_result,
+ cfg_type, "gre-key-len");
+cmdline_parse_token_num_t cmd_global_config_gre_key_len =
+ TOKEN_NUM_INITIALIZER(struct cmd_global_config_result,
+ len, UINT8);
+
+cmdline_parse_inst_t cmd_global_config = {
+ .f = cmd_global_config_parsed,
+ .data = (void *)NULL,
+ .help_str = "global_config <port_id> gre-key-len <number>",
+ .tokens = {
+ (void *)&cmd_global_config_cmd,
+ (void *)&cmd_global_config_port_id,
+ (void *)&cmd_global_config_type,
+ (void *)&cmd_global_config_gre_key_len,
+ NULL,
+ },
+};
+
/* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */
struct cmd_set_mirror_mask_result {
cmdline_fixed_string_t set;
@@ -9579,6 +9630,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
(cmdline_parse_inst_t *)&cmd_tunnel_filter,
(cmdline_parse_inst_t *)&cmd_tunnel_udp_config,
+ (cmdline_parse_inst_t *)&cmd_global_config,
(cmdline_parse_inst_t *)&cmd_set_mirror_mask,
(cmdline_parse_inst_t *)&cmd_set_mirror_link,
(cmdline_parse_inst_t *)&cmd_reset_mirror_rule,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 75b0a57..957f889 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1812,3 +1812,14 @@ Set the input set for Fdir::
For example to add source IP to FD input set for flow type of ipv4 on port 0::
testpmd> set_fdir_input_set 0 ipv4 src-ipv4 add
+
+global_config
+~~~~~~~~~~~~~
+
+Set different GRE key length for input set::
+
+ global_config (port_id) gre-key-len (number in bytes)
+
+For example to set GRE key length for input set to 4 bytes on port 0::
+
+ testpmd> global_config 0 gre-key-len 4
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH v6 0/2] add selecting different GRE key length
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 ` Thomas Monjalon
2 siblings, 0 replies; 23+ messages in thread
From: Thomas Monjalon @ 2015-11-03 23:38 UTC (permalink / raw)
To: Helin Zhang; +Cc: dev
2015-11-04 00:28, Helin Zhang:
> By default, only 3 bytes of GRE key will be used for hash or FD calculation.
> Here adds selecting 3 or 4 bytes of GRE key for those purpose.
> Note that these patches are based on another patch set of
> "[PATCH v9 0/2] i40e: RSS/FD granularity configuration".
Applied, thanks
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2015-11-03 23:41 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-24 7:16 [dpdk-dev] [PATCH 0/2] add selecting different GRE key length Helin Zhang
2015-09-24 7:16 ` [dpdk-dev] [PATCH 1/2] i40e: add selecting " Helin Zhang
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
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).