X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fmlx5%2Fmlx5_ethdev.c;h=708e3a33696a46dff41acbb19e6a4e10f43bea39;hb=151cbe3aabf9e1a71e02827e5e1ff0814275019a;hp=1ffb13cf2eccb4987810ce2731cd903a18d5ea4f;hpb=cb95feefdd03e0a4104cc707a881e29f0421fa68;p=dpdk.git diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 1ffb13cf2e..708e3a3369 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -23,6 +23,7 @@ #include #include "mlx5_rxtx.h" +#include "mlx5_rx.h" #include "mlx5_autoconf.h" /** @@ -42,7 +43,10 @@ mlx5_ifindex(const struct rte_eth_dev *dev) MLX5_ASSERT(priv); MLX5_ASSERT(priv->if_index); - ifindex = priv->bond_ifindex > 0 ? priv->bond_ifindex : priv->if_index; + if (priv->master && priv->sh->bond.ifindex > 0) + ifindex = priv->sh->bond.ifindex; + else + ifindex = priv->if_index; if (!ifindex) rte_errno = ENXIO; return ifindex; @@ -330,33 +334,6 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) if (priv->representor) { uint16_t port_id; - if (priv->pf_bond >= 0) { - /* - * Switch port ID is opaque value with driver defined - * format. Push the PF index in bonding configurations - * in upper four bits of port ID. If we get too many - * representors (more than 4K) or PFs (more than 15) - * this approach must be reconsidered. - */ - /* Switch port ID for VF representors: 0 - 0xFFE */ - if ((info->switch_info.port_id != 0xffff && - info->switch_info.port_id >= - ((1 << MLX5_PORT_ID_BONDING_PF_SHIFT) - 1)) || - priv->pf_bond > MLX5_PORT_ID_BONDING_PF_MASK) { - DRV_LOG(ERR, "can't update switch port ID" - " for bonding device"); - MLX5_ASSERT(false); - return -ENODEV; - } - /* - * Switch port ID for Host PF representor - * (representor_id is -1) , set to 0xFFF - */ - if (info->switch_info.port_id == 0xffff) - info->switch_info.port_id = 0xfff; - info->switch_info.port_id |= - priv->pf_bond << MLX5_PORT_ID_BONDING_PF_SHIFT; - } MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private; @@ -387,12 +364,15 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) * * @param info * Port switch info. + * @param hpf_type + * Use this type if port is HPF. * * @return * Encoded representor ID. */ uint16_t -mlx5_representor_id_encode(const struct mlx5_switch_info *info) +mlx5_representor_id_encode(const struct mlx5_switch_info *info, + enum rte_eth_representor_type hpf_type) { enum rte_eth_representor_type type = RTE_ETH_REPRESENTOR_VF; uint16_t repr = info->port_name; @@ -401,8 +381,10 @@ mlx5_representor_id_encode(const struct mlx5_switch_info *info) return UINT16_MAX; if (info->name_type == MLX5_PHYS_PORT_NAME_TYPE_PFSF) type = RTE_ETH_REPRESENTOR_SF; - if (info->name_type == MLX5_PHYS_PORT_NAME_TYPE_PFHPF) + if (info->name_type == MLX5_PHYS_PORT_NAME_TYPE_PFHPF) { + type = hpf_type; repr = UINT16_MAX; + } return MLX5_REPRESENTOR_ID(info->pf_num, type, repr); } @@ -427,7 +409,7 @@ mlx5_representor_info_get(struct rte_eth_dev *dev, struct rte_eth_representor_info *info) { struct mlx5_priv *priv = dev->data->dev_private; - int n_type = 3; /* Number of representor types, VF, HPF and SF. */ + int n_type = 4; /* Representor types, VF, HPF@VF, SF and HPF@SF. */ int n_pf = 2; /* Number of PFs. */ int i = 0, pf; @@ -448,7 +430,7 @@ mlx5_representor_info_get(struct rte_eth_dev *dev, snprintf(info->ranges[i].name, sizeof(info->ranges[i].name), "pf%dvf", pf); i++; - /* HPF range. */ + /* HPF range of VF type. */ info->ranges[i].type = RTE_ETH_REPRESENTOR_VF; info->ranges[i].controller = 0; info->ranges[i].pf = pf; @@ -472,6 +454,18 @@ mlx5_representor_info_get(struct rte_eth_dev *dev, snprintf(info->ranges[i].name, sizeof(info->ranges[i].name), "pf%dsf", pf); i++; + /* HPF range of SF type. */ + info->ranges[i].type = RTE_ETH_REPRESENTOR_SF; + info->ranges[i].controller = 0; + info->ranges[i].pf = pf; + info->ranges[i].vf = UINT16_MAX; + info->ranges[i].id_base = + MLX5_REPRESENTOR_ID(pf, info->ranges[i].type, -1); + info->ranges[i].id_end = + MLX5_REPRESENTOR_ID(pf, info->ranges[i].type, -1); + snprintf(info->ranges[i].name, + sizeof(info->ranges[i].name), "pf%dsf", pf); + i++; } out: return n_type * n_pf;