Skip to contentSkip to conversation

add selecting different GRE key length

PATCH Superseded Helin Zhang 3 participants 23 messages Sep 24, 2015 – Nov 3, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

cover add selecting different GRE key length

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(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/2 i40e: add selecting GRE key length

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.

---
 drivers/net/i40e/i40e_ethdev.c  | 86 +++++++++++++++++++++++++++++++++++++++--
 lib/librte_ether/rte_eth_ctrl.h | 20 ++++++++++
 2 files changed, 103 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.c +83 -3
index 77e6906..b88a2f0 100644
@@ -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;
lib/librte_ether/rte_eth_ctrl.h +20 -0
index a7f2ee7..78f5cd1 100644
@@ -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. */
 
Signature · 1 line
1.9.3
#2 lore raw

PATCH 2/2 app/testpmd: add test commands for selecting different GRE key sizes

In reply to Helin Zhang

Test commands are added to support selecting differnt length of GRE key.

---
 app/test-pmd/cmdline.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
app/test-pmd/cmdline.c +52 -0
index 06bc26e..50003c8 100644
@@ -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,
Signature · 1 line
1.9.3
#3 lore raw

v2 cover add selecting different GRE key length

In reply to 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 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(-)
Signature · 1 line
1.9.3
#4 lore raw

PATCH v2 1/2 i40e: add selecting GRE key length

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.

---
 drivers/net/i40e/i40e_ethdev.c  | 87 +++++++++++++++++++++++++++++++++++++++--
 lib/librte_ether/rte_eth_ctrl.h | 20 ++++++++++
 2 files changed, 104 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.c +84 -3
index 9bf7898..8cca74b 100644
@@ -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;
lib/librte_ether/rte_eth_ctrl.h +20 -0
index 4ba86ee..d02a68e 100644
@@ -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. */
 
Signature · 1 line
1.9.3
#5 lore raw

PATCH v2 2/2 app/testpmd: add test commands for selecting different GRE key sizes

In reply to Helin Zhang

Test commands are added to support selecting differnt length of GRE key.

---
 app/test-pmd/cmdline.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
app/test-pmd/cmdline.c +52 -0
index a71b200..fef0011 100644
@@ -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,
Signature · 1 line
1.9.3
#7 lore raw

PATCH v3 1/3 i40e: add selecting GRE key length

In reply to Helin Zhang

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.

---
 drivers/net/i40e/i40e_ethdev.c  | 87 +++++++++++++++++++++++++++++++++++++++--
 lib/librte_ether/rte_eth_ctrl.h | 20 ++++++++++
 2 files changed, 104 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.c +84 -3
index fb262a5..8de8aee 100644
@@ -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;
lib/librte_ether/rte_eth_ctrl.h +20 -0
index 11829f1..651a00c 100644
@@ -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. */
 
Signature · 1 line
1.9.3
#8 lore raw

PATCH v3 2/3 app/testpmd: add test commands for selecting different GRE key sizes

In reply to Helin Zhang

Test commands are added to support selecting differnt length of GRE key.

---
 app/test-pmd/cmdline.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
app/test-pmd/cmdline.c +52 -0
index 1a2cb7d..cd49637 100644
@@ -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,
Signature · 1 line
1.9.3
#6 lore raw

v3 cover add selecting different GRE key length

In reply to 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 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(-)
Signature · 1 line
1.9.3
#9 lore raw

PATCH v3 3/3 doc: update release notes and testpmd guide

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.

---
 doc/guides/rel_notes/release_2_2.rst        |  2 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +++++++++++
 2 files changed, 13 insertions(+)
doc/guides/rel_notes/release_2_2.rst +2 -0
index 8fc8917..7b4b97e 100644
@@ -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
 ---------------
doc/guides/testpmd_app_ug/testpmd_funcs.rst +11 -0
index f5951c0..5ed7c66 100644
@@ -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
Signature · 1 line
1.9.3
#10 lore raw

Re: [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.

Thanks for explaining the logic to others

2015-10-29 14:18, Helin Zhang:

Quoted 5 lines

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.

#11 lore raw

Re: [PATCH v3 3/3] doc: update release notes and testpmd guide

Quoted 10 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Thursday, October 29, 2015 3:48 PM
To: Zhang, Helin
Cc: [email protected]; Pei, Yulong
Subject: Re: [dpdk-dev] [PATCH v3 3/3] doc: update release notes and testpmd guide

Quoted 6 lines

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

Quoted 9 lines

Thanks for explaining the logic to others

2015-10-29 14:18, Helin Zhang:

Quoted 5 lines

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.

#12 lore raw

v4 cover add selecting different GRE key length

In reply to 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 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(-)
Signature · 1 line
1.9.3
#13 lore raw

PATCH v4 1/2 i40e: add selecting GRE key length

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.

---
 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.

doc/guides/rel_notes/release_2_2.rst +2 -0
index 2a54ce6..4f36f96 100644
@@ -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
 ---------------
drivers/net/i40e/i40e_ethdev.c +84 -3

112 lines not on this page · raw message

lib/librte_ether/rte_eth_ctrl.h +20 -0
index 3dc10db..b415491 100644
@@ -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. */
 
Signature · 1 line
1.9.3
#14 lore raw

PATCH v4 2/2 app/testpmd: add test commands for selecting different GRE key sizes

In reply to Helin Zhang

Test commands are added to support selecting differnt length of GRE key.

---
 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.

app/test-pmd/cmdline.c +52 -0
index 1a2cb7d..cd49637 100644
@@ -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,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +11 -0
index f5951c0..5ed7c66 100644
@@ -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
Signature · 1 line
1.9.3
Acked-by on the v4 series
#15 lore raw
In reply to Helin Zhang

-----Original Message-----
From: Zhang, Helin
Sent: Friday, October 30, 2015 12:54 PM
To: [email protected]
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

#16 lore raw

v5 cover add selecting different GRE key length

In reply to 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 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(-)
Signature · 1 line
1.9.3
#17 lore raw

PATCH v5 1/2 i40e: add selecting GRE key length

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.

---
 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(-)
doc/guides/rel_notes/release_2_2.rst +2 -0
index f42f0d4..5286233 100644
@@ -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
 ---------------
drivers/net/i40e/i40e_ethdev.c +84 -3

112 lines not on this page · raw message

lib/librte_ether/rte_eth_ctrl.h +20 -0
index ae73c36..f71669c 100644
@@ -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. */
 
Signature · 1 line
1.9.3
#18 lore raw

PATCH v5 2/2 app/testpmd: add test commands for selecting different GRE key sizes

In reply to Helin Zhang

Test commands are added to support selecting differnt length of GRE key.

---
 app/test-pmd/cmdline.c                      | 52 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++++
 2 files changed, 63 insertions(+)
app/test-pmd/cmdline.c +52 -0
index 6a384a2..1018379 100644
@@ -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,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +11 -0
index 75b0a57..957f889 100644
@@ -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
Signature · 1 line
1.9.3
#19 lore raw

v6 cover add selecting different GRE key length

In reply to 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".

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(-)
Signature · 1 line
1.9.3
#20 lore raw

PATCH v6 1/2 i40e: add selecting GRE key length

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.

---
 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(-)
doc/guides/rel_notes/release_2_2.rst +2 -0
index bbca629..1954170 100644
@@ -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
 ---------------
drivers/net/i40e/i40e_ethdev.c +84 -3

112 lines not on this page · raw message

lib/librte_ether/rte_eth_ctrl.h +20 -0
index ae73c36..f71669c 100644
@@ -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. */
 
Signature · 1 line
1.9.3
#21 lore raw

PATCH v6 2/2 app/testpmd: add test commands for selecting different GRE key sizes

In reply to Helin Zhang

Test commands are added to support selecting differnt length of GRE key.

---
 app/test-pmd/cmdline.c                      | 52 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++++
 2 files changed, 63 insertions(+)
app/test-pmd/cmdline.c +52 -0
index 6a384a2..1018379 100644
@@ -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,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +11 -0
index 75b0a57..957f889 100644
@@ -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
Signature · 1 line
1.9.3
#22 lore raw
In reply to Helin Zhang

2015-11-04 00:28, Helin Zhang:

Quoted 4 lines

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