"set link-down port (port_id)\n"
" Set link down for a port.\n\n"
- "E-tag set insertion on port-tag-id (value)"
- " port (port_id) vf (vf_id)\n"
- " Enable E-tag insertion for a VF on a port\n\n"
-
- "E-tag set insertion off port (port_id) vf (vf_id)\n"
- " Disable E-tag insertion for a VF on a port\n\n"
-
- "E-tag set stripping (on|off) port (port_id)\n"
- " Enable/disable E-tag stripping on a port\n\n"
-
- "E-tag set forwarding (on|off) port (port_id)\n"
- " Enable/disable E-tag based forwarding"
- " on a port\n\n"
-
"ddp add (port_id) (profile_path[,backup_profile_path])\n"
" Load a profile package on a port\n\n"
"port (port_id) (rxq|txq) (queue_id) setup\n"
" Setup a rx/tx queue of port X.\n\n"
- "port config (port_id|all) l2-tunnel E-tag"
- " (enable|disable)\n"
- " Enable/disable the E-tag support.\n\n"
-
"port config (port_id) pctype mapping reset\n"
" Reset flow type to pctype mapping on a port\n\n"
},
};
-/* l2 tunnel config
- * only support E-tag now.
- */
-
-static enum rte_eth_tunnel_type
-str2fdir_l2_tunnel_type(char *string)
-{
- uint32_t i = 0;
-
- static const struct {
- char str[32];
- enum rte_eth_tunnel_type type;
- } l2_tunnel_type_str[] = {
- {"E-tag", RTE_L2_TUNNEL_TYPE_E_TAG},
- };
-
- for (i = 0; i < RTE_DIM(l2_tunnel_type_str); i++) {
- if (!strcmp(l2_tunnel_type_str[i].str, string))
- return l2_tunnel_type_str[i].type;
- }
- return RTE_TUNNEL_TYPE_NONE;
-}
-
-/* Enable/disable l2 tunnel */
-struct cmd_config_l2_tunnel_en_dis_result {
- cmdline_fixed_string_t port;
- cmdline_fixed_string_t config;
- cmdline_fixed_string_t all;
- portid_t id;
- cmdline_fixed_string_t l2_tunnel;
- cmdline_fixed_string_t l2_tunnel_type;
- cmdline_fixed_string_t en_dis;
-};
-
-cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_port =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_l2_tunnel_en_dis_result,
- port, "port");
-cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_config =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_l2_tunnel_en_dis_result,
- config, "config");
-cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_all_str =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_l2_tunnel_en_dis_result,
- all, "all");
-cmdline_parse_token_num_t cmd_config_l2_tunnel_en_dis_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_config_l2_tunnel_en_dis_result,
- id, UINT16);
-cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_l2_tunnel =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_l2_tunnel_en_dis_result,
- l2_tunnel, "l2-tunnel");
-cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_l2_tunnel_type =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_l2_tunnel_en_dis_result,
- l2_tunnel_type, "E-tag");
-cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_en_dis =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_l2_tunnel_en_dis_result,
- en_dis, "enable#disable");
-
-/* enable/disable l2 tunnel for all ports */
-static void
-cmd_config_l2_tunnel_en_dis_all_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_config_l2_tunnel_en_dis_result *res = parsed_result;
- struct rte_eth_l2_tunnel_conf entry;
- portid_t pid;
- uint8_t en;
-
- entry.l2_tunnel_type = str2fdir_l2_tunnel_type(res->l2_tunnel_type);
-
- if (!strcmp("enable", res->en_dis))
- en = 1;
- else
- en = 0;
-
- RTE_ETH_FOREACH_DEV(pid) {
- rte_eth_dev_l2_tunnel_offload_set(pid,
- &entry,
- ETH_L2_TUNNEL_ENABLE_MASK,
- en);
- }
-}
-
-cmdline_parse_inst_t cmd_config_l2_tunnel_en_dis_all = {
- .f = cmd_config_l2_tunnel_en_dis_all_parsed,
- .data = NULL,
- .help_str = "port config all l2-tunnel E-tag enable|disable",
- .tokens = {
- (void *)&cmd_config_l2_tunnel_en_dis_port,
- (void *)&cmd_config_l2_tunnel_en_dis_config,
- (void *)&cmd_config_l2_tunnel_en_dis_all_str,
- (void *)&cmd_config_l2_tunnel_en_dis_l2_tunnel,
- (void *)&cmd_config_l2_tunnel_en_dis_l2_tunnel_type,
- (void *)&cmd_config_l2_tunnel_en_dis_en_dis,
- NULL,
- },
-};
-
-/* enable/disable l2 tunnel for a port */
-static void
-cmd_config_l2_tunnel_en_dis_specific_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_config_l2_tunnel_en_dis_result *res =
- parsed_result;
- struct rte_eth_l2_tunnel_conf entry;
-
- if (port_id_is_invalid(res->id, ENABLED_WARN))
- return;
-
- entry.l2_tunnel_type = str2fdir_l2_tunnel_type(res->l2_tunnel_type);
-
- if (!strcmp("enable", res->en_dis))
- rte_eth_dev_l2_tunnel_offload_set(res->id,
- &entry,
- ETH_L2_TUNNEL_ENABLE_MASK,
- 1);
- else
- rte_eth_dev_l2_tunnel_offload_set(res->id,
- &entry,
- ETH_L2_TUNNEL_ENABLE_MASK,
- 0);
-}
-
-cmdline_parse_inst_t cmd_config_l2_tunnel_en_dis_specific = {
- .f = cmd_config_l2_tunnel_en_dis_specific_parsed,
- .data = NULL,
- .help_str = "port config <port_id> l2-tunnel E-tag enable|disable",
- .tokens = {
- (void *)&cmd_config_l2_tunnel_en_dis_port,
- (void *)&cmd_config_l2_tunnel_en_dis_config,
- (void *)&cmd_config_l2_tunnel_en_dis_id,
- (void *)&cmd_config_l2_tunnel_en_dis_l2_tunnel,
- (void *)&cmd_config_l2_tunnel_en_dis_l2_tunnel_type,
- (void *)&cmd_config_l2_tunnel_en_dis_en_dis,
- NULL,
- },
-};
-
-/* E-tag configuration */
-
-/* Common result structure for all E-tag configuration */
-struct cmd_config_e_tag_result {
- cmdline_fixed_string_t e_tag;
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t insertion;
- cmdline_fixed_string_t stripping;
- cmdline_fixed_string_t forwarding;
- cmdline_fixed_string_t filter;
- cmdline_fixed_string_t add;
- cmdline_fixed_string_t del;
- cmdline_fixed_string_t on;
- cmdline_fixed_string_t off;
- cmdline_fixed_string_t on_off;
- cmdline_fixed_string_t port_tag_id;
- uint32_t port_tag_id_val;
- cmdline_fixed_string_t e_tag_id;
- uint16_t e_tag_id_val;
- cmdline_fixed_string_t dst_pool;
- uint8_t dst_pool_val;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t vf;
- uint8_t vf_id;
-};
-
-/* Common CLI fields for all E-tag configuration */
-cmdline_parse_token_string_t cmd_config_e_tag_e_tag =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- e_tag, "E-tag");
-cmdline_parse_token_string_t cmd_config_e_tag_set =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- set, "set");
-cmdline_parse_token_string_t cmd_config_e_tag_insertion =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- insertion, "insertion");
-cmdline_parse_token_string_t cmd_config_e_tag_stripping =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- stripping, "stripping");
-cmdline_parse_token_string_t cmd_config_e_tag_forwarding =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- forwarding, "forwarding");
-cmdline_parse_token_string_t cmd_config_e_tag_filter =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- filter, "filter");
-cmdline_parse_token_string_t cmd_config_e_tag_add =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- add, "add");
-cmdline_parse_token_string_t cmd_config_e_tag_del =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- del, "del");
-cmdline_parse_token_string_t cmd_config_e_tag_on =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- on, "on");
-cmdline_parse_token_string_t cmd_config_e_tag_off =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- off, "off");
-cmdline_parse_token_string_t cmd_config_e_tag_on_off =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- on_off, "on#off");
-cmdline_parse_token_string_t cmd_config_e_tag_port_tag_id =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- port_tag_id, "port-tag-id");
-cmdline_parse_token_num_t cmd_config_e_tag_port_tag_id_val =
- TOKEN_NUM_INITIALIZER
- (struct cmd_config_e_tag_result,
- port_tag_id_val, UINT32);
-cmdline_parse_token_string_t cmd_config_e_tag_e_tag_id =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- e_tag_id, "e-tag-id");
-cmdline_parse_token_num_t cmd_config_e_tag_e_tag_id_val =
- TOKEN_NUM_INITIALIZER
- (struct cmd_config_e_tag_result,
- e_tag_id_val, UINT16);
-cmdline_parse_token_string_t cmd_config_e_tag_dst_pool =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- dst_pool, "dst-pool");
-cmdline_parse_token_num_t cmd_config_e_tag_dst_pool_val =
- TOKEN_NUM_INITIALIZER
- (struct cmd_config_e_tag_result,
- dst_pool_val, UINT8);
-cmdline_parse_token_string_t cmd_config_e_tag_port =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- port, "port");
-cmdline_parse_token_num_t cmd_config_e_tag_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_config_e_tag_result,
- port_id, UINT16);
-cmdline_parse_token_string_t cmd_config_e_tag_vf =
- TOKEN_STRING_INITIALIZER
- (struct cmd_config_e_tag_result,
- vf, "vf");
-cmdline_parse_token_num_t cmd_config_e_tag_vf_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_config_e_tag_result,
- vf_id, UINT8);
-
-/* E-tag insertion configuration */
-static void
-cmd_config_e_tag_insertion_en_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_config_e_tag_result *res =
- parsed_result;
- struct rte_eth_l2_tunnel_conf entry;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
- entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
- entry.tunnel_id = res->port_tag_id_val;
- entry.vf_id = res->vf_id;
- rte_eth_dev_l2_tunnel_offload_set(res->port_id,
- &entry,
- ETH_L2_TUNNEL_INSERTION_MASK,
- 1);
-}
-
-static void
-cmd_config_e_tag_insertion_dis_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_config_e_tag_result *res =
- parsed_result;
- struct rte_eth_l2_tunnel_conf entry;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
- entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
- entry.vf_id = res->vf_id;
-
- rte_eth_dev_l2_tunnel_offload_set(res->port_id,
- &entry,
- ETH_L2_TUNNEL_INSERTION_MASK,
- 0);
-}
-
-cmdline_parse_inst_t cmd_config_e_tag_insertion_en = {
- .f = cmd_config_e_tag_insertion_en_parsed,
- .data = NULL,
- .help_str = "E-tag ... : E-tag insertion enable",
- .tokens = {
- (void *)&cmd_config_e_tag_e_tag,
- (void *)&cmd_config_e_tag_set,
- (void *)&cmd_config_e_tag_insertion,
- (void *)&cmd_config_e_tag_on,
- (void *)&cmd_config_e_tag_port_tag_id,
- (void *)&cmd_config_e_tag_port_tag_id_val,
- (void *)&cmd_config_e_tag_port,
- (void *)&cmd_config_e_tag_port_id,
- (void *)&cmd_config_e_tag_vf,
- (void *)&cmd_config_e_tag_vf_id,
- NULL,
- },
-};
-
-cmdline_parse_inst_t cmd_config_e_tag_insertion_dis = {
- .f = cmd_config_e_tag_insertion_dis_parsed,
- .data = NULL,
- .help_str = "E-tag ... : E-tag insertion disable",
- .tokens = {
- (void *)&cmd_config_e_tag_e_tag,
- (void *)&cmd_config_e_tag_set,
- (void *)&cmd_config_e_tag_insertion,
- (void *)&cmd_config_e_tag_off,
- (void *)&cmd_config_e_tag_port,
- (void *)&cmd_config_e_tag_port_id,
- (void *)&cmd_config_e_tag_vf,
- (void *)&cmd_config_e_tag_vf_id,
- NULL,
- },
-};
-
-/* E-tag stripping configuration */
-static void
-cmd_config_e_tag_stripping_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_config_e_tag_result *res =
- parsed_result;
- struct rte_eth_l2_tunnel_conf entry;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
- entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
-
- if (!strcmp(res->on_off, "on"))
- rte_eth_dev_l2_tunnel_offload_set
- (res->port_id,
- &entry,
- ETH_L2_TUNNEL_STRIPPING_MASK,
- 1);
- else
- rte_eth_dev_l2_tunnel_offload_set
- (res->port_id,
- &entry,
- ETH_L2_TUNNEL_STRIPPING_MASK,
- 0);
-}
-
-cmdline_parse_inst_t cmd_config_e_tag_stripping_en_dis = {
- .f = cmd_config_e_tag_stripping_parsed,
- .data = NULL,
- .help_str = "E-tag ... : E-tag stripping enable/disable",
- .tokens = {
- (void *)&cmd_config_e_tag_e_tag,
- (void *)&cmd_config_e_tag_set,
- (void *)&cmd_config_e_tag_stripping,
- (void *)&cmd_config_e_tag_on_off,
- (void *)&cmd_config_e_tag_port,
- (void *)&cmd_config_e_tag_port_id,
- NULL,
- },
-};
-
-/* E-tag forwarding configuration */
-static void
-cmd_config_e_tag_forwarding_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_config_e_tag_result *res = parsed_result;
- struct rte_eth_l2_tunnel_conf entry;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
- entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
-
- if (!strcmp(res->on_off, "on"))
- rte_eth_dev_l2_tunnel_offload_set
- (res->port_id,
- &entry,
- ETH_L2_TUNNEL_FORWARDING_MASK,
- 1);
- else
- rte_eth_dev_l2_tunnel_offload_set
- (res->port_id,
- &entry,
- ETH_L2_TUNNEL_FORWARDING_MASK,
- 0);
-}
-
-cmdline_parse_inst_t cmd_config_e_tag_forwarding_en_dis = {
- .f = cmd_config_e_tag_forwarding_parsed,
- .data = NULL,
- .help_str = "E-tag ... : E-tag forwarding enable/disable",
- .tokens = {
- (void *)&cmd_config_e_tag_e_tag,
- (void *)&cmd_config_e_tag_set,
- (void *)&cmd_config_e_tag_forwarding,
- (void *)&cmd_config_e_tag_on_off,
- (void *)&cmd_config_e_tag_port,
- (void *)&cmd_config_e_tag_port_id,
- NULL,
- },
-};
-
/* vf vlan anti spoof configuration */
/* Common result structure for vf vlan anti spoof */
(cmdline_parse_inst_t *)&cmd_set_port_meter_stats_mask,
(cmdline_parse_inst_t *)&cmd_show_port_meter_stats,
(cmdline_parse_inst_t *)&cmd_mcast_addr,
- (cmdline_parse_inst_t *)&cmd_config_l2_tunnel_en_dis_all,
- (cmdline_parse_inst_t *)&cmd_config_l2_tunnel_en_dis_specific,
- (cmdline_parse_inst_t *)&cmd_config_e_tag_insertion_en,
- (cmdline_parse_inst_t *)&cmd_config_e_tag_insertion_dis,
- (cmdline_parse_inst_t *)&cmd_config_e_tag_stripping_en_dis,
- (cmdline_parse_inst_t *)&cmd_config_e_tag_forwarding_en_dis,
(cmdline_parse_inst_t *)&cmd_set_vf_vlan_anti_spoof,
(cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof,
(cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq,
const struct timespec *timestamp);
static void ixgbevf_dev_interrupt_handler(void *param);
-static int ixgbe_dev_l2_tunnel_offload_set
- (struct rte_eth_dev *dev,
- struct rte_eth_l2_tunnel_conf *l2_tunnel,
- uint32_t mask,
- uint8_t en);
-
static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
struct rte_eth_udp_tunnel *udp_tunnel);
static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
.timesync_adjust_time = ixgbe_timesync_adjust_time,
.timesync_read_time = ixgbe_timesync_read_time,
.timesync_write_time = ixgbe_timesync_write_time,
- .l2_tunnel_offload_set = ixgbe_dev_l2_tunnel_offload_set,
.udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add,
.udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del,
.tm_ops_get = ixgbe_tm_ops_get,
return 0;
}
-/* Enable l2 tunnel */
-static int
-ixgbe_dev_l2_tunnel_enable(struct rte_eth_dev *dev,
- enum rte_eth_tunnel_type l2_tunnel_type)
-{
- int ret = 0;
- struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct ixgbe_l2_tn_info *l2_tn_info =
- IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private);
-
- switch (l2_tunnel_type) {
- case RTE_L2_TUNNEL_TYPE_E_TAG:
- l2_tn_info->e_tag_en = TRUE;
- ret = ixgbe_e_tag_enable(hw);
- break;
- default:
- PMD_DRV_LOG(ERR, "Invalid tunnel type");
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
-/* Disable e-tag tunnel */
-static int
-ixgbe_e_tag_disable(struct ixgbe_hw *hw)
-{
- uint32_t etag_etype;
-
- if (hw->mac.type != ixgbe_mac_X550 &&
- hw->mac.type != ixgbe_mac_X550EM_x &&
- hw->mac.type != ixgbe_mac_X550EM_a) {
- return -ENOTSUP;
- }
-
- etag_etype = IXGBE_READ_REG(hw, IXGBE_ETAG_ETYPE);
- etag_etype &= ~IXGBE_ETAG_ETYPE_VALID;
- IXGBE_WRITE_REG(hw, IXGBE_ETAG_ETYPE, etag_etype);
- IXGBE_WRITE_FLUSH(hw);
-
- return 0;
-}
-
-/* Disable l2 tunnel */
-static int
-ixgbe_dev_l2_tunnel_disable(struct rte_eth_dev *dev,
- enum rte_eth_tunnel_type l2_tunnel_type)
-{
- int ret = 0;
- struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct ixgbe_l2_tn_info *l2_tn_info =
- IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private);
-
- switch (l2_tunnel_type) {
- case RTE_L2_TUNNEL_TYPE_E_TAG:
- l2_tn_info->e_tag_en = FALSE;
- ret = ixgbe_e_tag_disable(hw);
- break;
- default:
- PMD_DRV_LOG(ERR, "Invalid tunnel type");
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
static int
ixgbe_e_tag_filter_del(struct rte_eth_dev *dev,
struct rte_eth_l2_tunnel_conf *l2_tunnel)
return ret;
}
-/* Enable l2 tunnel forwarding */
-static int
-ixgbe_dev_l2_tunnel_forwarding_enable
- (struct rte_eth_dev *dev,
- enum rte_eth_tunnel_type l2_tunnel_type)
-{
- struct ixgbe_l2_tn_info *l2_tn_info =
- IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private);
- int ret = 0;
-
- switch (l2_tunnel_type) {
- case RTE_L2_TUNNEL_TYPE_E_TAG:
- l2_tn_info->e_tag_fwd_en = TRUE;
- ret = ixgbe_e_tag_forwarding_en_dis(dev, 1);
- break;
- default:
- PMD_DRV_LOG(ERR, "Invalid tunnel type");
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
-/* Disable l2 tunnel forwarding */
-static int
-ixgbe_dev_l2_tunnel_forwarding_disable
- (struct rte_eth_dev *dev,
- enum rte_eth_tunnel_type l2_tunnel_type)
-{
- struct ixgbe_l2_tn_info *l2_tn_info =
- IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private);
- int ret = 0;
-
- switch (l2_tunnel_type) {
- case RTE_L2_TUNNEL_TYPE_E_TAG:
- l2_tn_info->e_tag_fwd_en = FALSE;
- ret = ixgbe_e_tag_forwarding_en_dis(dev, 0);
- break;
- default:
- PMD_DRV_LOG(ERR, "Invalid tunnel type");
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
-static int
-ixgbe_e_tag_insertion_en_dis(struct rte_eth_dev *dev,
- struct rte_eth_l2_tunnel_conf *l2_tunnel,
- bool en)
-{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
- int ret = 0;
- uint32_t vmtir, vmvir;
- struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-
- if (l2_tunnel->vf_id >= pci_dev->max_vfs) {
- PMD_DRV_LOG(ERR,
- "VF id %u should be less than %u",
- l2_tunnel->vf_id,
- pci_dev->max_vfs);
- return -EINVAL;
- }
-
- if (hw->mac.type != ixgbe_mac_X550 &&
- hw->mac.type != ixgbe_mac_X550EM_x &&
- hw->mac.type != ixgbe_mac_X550EM_a) {
- return -ENOTSUP;
- }
-
- if (en)
- vmtir = l2_tunnel->tunnel_id;
- else
- vmtir = 0;
-
- IXGBE_WRITE_REG(hw, IXGBE_VMTIR(l2_tunnel->vf_id), vmtir);
-
- vmvir = IXGBE_READ_REG(hw, IXGBE_VMVIR(l2_tunnel->vf_id));
- vmvir &= ~IXGBE_VMVIR_TAGA_MASK;
- if (en)
- vmvir |= IXGBE_VMVIR_TAGA_ETAG_INSERT;
- IXGBE_WRITE_REG(hw, IXGBE_VMVIR(l2_tunnel->vf_id), vmvir);
-
- return ret;
-}
-
-/* Enable l2 tunnel tag insertion */
-static int
-ixgbe_dev_l2_tunnel_insertion_enable(struct rte_eth_dev *dev,
- struct rte_eth_l2_tunnel_conf *l2_tunnel)
-{
- int ret = 0;
-
- switch (l2_tunnel->l2_tunnel_type) {
- case RTE_L2_TUNNEL_TYPE_E_TAG:
- ret = ixgbe_e_tag_insertion_en_dis(dev, l2_tunnel, 1);
- break;
- default:
- PMD_DRV_LOG(ERR, "Invalid tunnel type");
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
-/* Disable l2 tunnel tag insertion */
-static int
-ixgbe_dev_l2_tunnel_insertion_disable
- (struct rte_eth_dev *dev,
- struct rte_eth_l2_tunnel_conf *l2_tunnel)
-{
- int ret = 0;
-
- switch (l2_tunnel->l2_tunnel_type) {
- case RTE_L2_TUNNEL_TYPE_E_TAG:
- ret = ixgbe_e_tag_insertion_en_dis(dev, l2_tunnel, 0);
- break;
- default:
- PMD_DRV_LOG(ERR, "Invalid tunnel type");
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
-static int
-ixgbe_e_tag_stripping_en_dis(struct rte_eth_dev *dev,
- bool en)
-{
- int ret = 0;
- uint32_t qde;
- struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-
- if (hw->mac.type != ixgbe_mac_X550 &&
- hw->mac.type != ixgbe_mac_X550EM_x &&
- hw->mac.type != ixgbe_mac_X550EM_a) {
- return -ENOTSUP;
- }
-
- qde = IXGBE_READ_REG(hw, IXGBE_QDE);
- if (en)
- qde |= IXGBE_QDE_STRIP_TAG;
- else
- qde &= ~IXGBE_QDE_STRIP_TAG;
- qde &= ~IXGBE_QDE_READ;
- qde |= IXGBE_QDE_WRITE;
- IXGBE_WRITE_REG(hw, IXGBE_QDE, qde);
-
- return ret;
-}
-
-/* Enable l2 tunnel tag stripping */
-static int
-ixgbe_dev_l2_tunnel_stripping_enable
- (struct rte_eth_dev *dev,
- enum rte_eth_tunnel_type l2_tunnel_type)
-{
- int ret = 0;
-
- switch (l2_tunnel_type) {
- case RTE_L2_TUNNEL_TYPE_E_TAG:
- ret = ixgbe_e_tag_stripping_en_dis(dev, 1);
- break;
- default:
- PMD_DRV_LOG(ERR, "Invalid tunnel type");
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
-/* Disable l2 tunnel tag stripping */
-static int
-ixgbe_dev_l2_tunnel_stripping_disable
- (struct rte_eth_dev *dev,
- enum rte_eth_tunnel_type l2_tunnel_type)
-{
- int ret = 0;
-
- switch (l2_tunnel_type) {
- case RTE_L2_TUNNEL_TYPE_E_TAG:
- ret = ixgbe_e_tag_stripping_en_dis(dev, 0);
- break;
- default:
- PMD_DRV_LOG(ERR, "Invalid tunnel type");
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
-/* Enable/disable l2 tunnel offload functions */
-static int
-ixgbe_dev_l2_tunnel_offload_set
- (struct rte_eth_dev *dev,
- struct rte_eth_l2_tunnel_conf *l2_tunnel,
- uint32_t mask,
- uint8_t en)
-{
- int ret = 0;
-
- if (l2_tunnel == NULL)
- return -EINVAL;
-
- ret = -EINVAL;
- if (mask & ETH_L2_TUNNEL_ENABLE_MASK) {
- if (en)
- ret = ixgbe_dev_l2_tunnel_enable(
- dev,
- l2_tunnel->l2_tunnel_type);
- else
- ret = ixgbe_dev_l2_tunnel_disable(
- dev,
- l2_tunnel->l2_tunnel_type);
- }
-
- if (mask & ETH_L2_TUNNEL_INSERTION_MASK) {
- if (en)
- ret = ixgbe_dev_l2_tunnel_insertion_enable(
- dev,
- l2_tunnel);
- else
- ret = ixgbe_dev_l2_tunnel_insertion_disable(
- dev,
- l2_tunnel);
- }
-
- if (mask & ETH_L2_TUNNEL_STRIPPING_MASK) {
- if (en)
- ret = ixgbe_dev_l2_tunnel_stripping_enable(
- dev,
- l2_tunnel->l2_tunnel_type);
- else
- ret = ixgbe_dev_l2_tunnel_stripping_disable(
- dev,
- l2_tunnel->l2_tunnel_type);
- }
-
- if (mask & ETH_L2_TUNNEL_FORWARDING_MASK) {
- if (en)
- ret = ixgbe_dev_l2_tunnel_forwarding_enable(
- dev,
- l2_tunnel->l2_tunnel_type);
- else
- ret = ixgbe_dev_l2_tunnel_forwarding_disable(
- dev,
- l2_tunnel->l2_tunnel_type);
- }
-
- return ret;
-}
-
static int
ixgbe_update_vxlan_port(struct ixgbe_hw *hw,
uint16_t port)