net/mlx5: support Sub-Function
[dpdk.git] / drivers / net / mlx5 / linux / mlx5_ethdev_os.c
index 4365c55..f34133e 100644 (file)
@@ -128,6 +128,17 @@ struct ethtool_link_settings {
 #define ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT 2 /* 66 - 64 */
 #endif
 
+/* Get interface index from SubFunction device name. */
+int
+mlx5_auxiliary_get_ifindex(const char *sf_name)
+{
+       char if_name[IF_NAMESIZE] = { 0 };
+
+       if (mlx5_auxiliary_get_child_name(sf_name, "/net",
+                                         if_name, sizeof(if_name)) != 0)
+               return -rte_errno;
+       return if_nametoindex(if_name);
+}
 
 /**
  * Get interface name from private structure.
@@ -346,7 +357,7 @@ mlx5_find_master_dev(struct rte_eth_dev *dev)
        priv = dev->data->dev_private;
        domain_id = priv->domain_id;
        MLX5_ASSERT(priv->representor);
-       MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) {
+       MLX5_ETH_FOREACH_DEV(port_id, dev->device) {
                struct mlx5_priv *opriv =
                        rte_eth_devices[port_id].data->dev_private;
                if (opriv &&
@@ -1193,7 +1204,7 @@ mlx5_get_module_info(struct rte_eth_dev *dev,
        };
        int ret = 0;
 
-       if (!dev || !modinfo) {
+       if (!dev) {
                DRV_LOG(WARNING, "missing argument, cannot get module info");
                rte_errno = EINVAL;
                return -rte_errno;
@@ -1227,7 +1238,7 @@ int mlx5_get_module_eeprom(struct rte_eth_dev *dev,
        struct ifreq ifr;
        int ret = 0;
 
-       if (!dev || !info) {
+       if (!dev) {
                DRV_LOG(WARNING, "missing argument, cannot get module eeprom");
                rte_errno = EINVAL;
                return -rte_errno;
@@ -1619,4 +1630,3 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])
        memcpy(mac, request.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN);
        return 0;
 }
-