X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fmlx5%2Fmlx5_nl.c;h=50cd32a09ed075c95db5a5b858c5c451252399aa;hb=538da7a1cad25fbdffe298c8ca76fc4dbd262d1b;hp=fd9226bddf9fdc053d2a738f503c31c5f21b1269;hpb=bbfad6427bf3a577d7c095a724568ab170d49fd2;p=dpdk.git diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index fd9226bddf..50cd32a09e 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -80,7 +80,7 @@ /* Add/remove MAC address through Netlink */ struct mlx5_nl_mac_addr { - struct ether_addr (*mac)[]; + struct rte_ether_addr (*mac)[]; /**< MAC address handled by the device. */ int mac_n; /**< Number of addresses in the array. */ }; @@ -340,7 +340,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) #ifndef NDEBUG char m[18]; - ether_format_addr(m, 18, RTA_DATA(attribute)); + rte_ether_format_addr(m, 18, RTA_DATA(attribute)); DRV_LOG(DEBUG, "bridge MAC address %s", m); #endif memcpy(&(*data->mac)[data->mac_n++], @@ -365,7 +365,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct ether_addr (*mac)[], +mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr (*mac)[], int *mac_n) { struct mlx5_priv *priv = dev->data->dev_private; @@ -424,7 +424,7 @@ error: * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, int add) { struct mlx5_priv *priv = dev->data->dev_private; @@ -496,7 +496,7 @@ error: * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -524,7 +524,7 @@ mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -542,7 +542,7 @@ mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, void mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) { - struct ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; + struct rte_ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; int macs_n = 0; int i; int ret; @@ -555,14 +555,14 @@ mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) /* Verify the address is not in the array yet. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) - if (is_same_ether_addr(&macs[i], + if (rte_is_same_ether_addr(&macs[i], &dev->data->mac_addrs[j])) break; if (j != MLX5_MAX_MAC_ADDRESSES) continue; /* Find the first entry available. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) { - if (is_zero_ether_addr(&dev->data->mac_addrs[j])) { + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[j])) { dev->data->mac_addrs[j] = macs[i]; break; } @@ -583,7 +583,7 @@ mlx5_nl_mac_addr_flush(struct rte_eth_dev *dev) int i; for (i = MLX5_MAX_MAC_ADDRESSES - 1; i >= 0; --i) { - struct ether_addr *m = &dev->data->mac_addrs[i]; + struct rte_ether_addr *m = &dev->data->mac_addrs[i]; if (BITFIELD_ISSET(priv->mac_own, i)) mlx5_nl_mac_addr_remove(dev, m, i); @@ -887,12 +887,11 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg) struct mlx5_switch_info info = { .master = 0, .representor = 0, - .port_name_new = 0, + .name_type = MLX5_PHYS_PORT_NAME_TYPE_NOTSET, .port_name = 0, .switch_id = 0, }; size_t off = NLMSG_LENGTH(sizeof(struct ifinfomsg)); - bool port_name_set = false; bool switch_id_set = false; bool num_vf_set = false; @@ -910,9 +909,7 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg) num_vf_set = true; break; case IFLA_PHYS_PORT_NAME: - port_name_set = - mlx5_translate_port_name((char *)payload, - &info); + mlx5_translate_port_name((char *)payload, &info); break; case IFLA_PHYS_SWITCH_ID: info.switch_id = 0; @@ -926,17 +923,8 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg) off += RTA_ALIGN(ra->rta_len); } if (switch_id_set) { - if (info.port_name_new) { - /* New representors naming schema. */ - if (port_name_set) { - info.master = (info.port_name == -1); - info.representor = (info.port_name != -1); - } - } else { - /* Legacy representors naming schema. */ - info.master = (!port_name_set || num_vf_set); - info.representor = port_name_set && !num_vf_set; - } + /* We have some E-Switch configuration. */ + mlx5_nl_check_switch_info(num_vf_set, &info); } assert(!(info.master && info.representor)); memcpy(arg, &info, sizeof(info));