},
};
-/* *** GLOBAL CONFIG *** */
-struct cmd_global_config_result {
- cmdline_fixed_string_t cmd;
- portid_t port_id;
- cmdline_fixed_string_t cfg_type;
- uint8_t len;
-};
-
-static void
-cmd_global_config_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_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);
-#ifdef RTE_NET_I40E
- if (ret == -ENOTSUP)
- ret = rte_pmd_i40e_set_gre_key_len(res->port_id, res->len);
-#endif
- 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,
- UINT16);
-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 <key_len>",
- .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;
(cmdline_parse_inst_t *)&cmd_vf_mac_addr_filter,
(cmdline_parse_inst_t *)&cmd_queue_rate_limit,
(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,
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;
-}
-
/* Set the symmetric hash enable configurations per port */
static void
i40e_set_symmetric_hash_enable_per_port(struct i40e_hw *hw, uint8_t enable)
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_FDIR:
ret = i40e_fdir_ctrl_func(dev, filter_op, arg);
break;
uint16_t queue; /**< Queue assigned to when match*/
};
-/**
- * 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. */