summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_ethdev.c
diff options
context:
space:
mode:
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>2019-07-21 14:56:41 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-07-23 14:31:36 +0200
commitff45f462b87debf8f8034e5df0e4c2b7fe162559 (patch)
treeb09f3c74b4e33546779c562cca8d7b4d53ddd7fa /drivers/net/mlx5/mlx5_ethdev.c
parentfa2e14d4921a2c4a1268231e72ccd73d1e7e58fc (diff)
downloaddpdk-next-eventdev-ff45f462b87debf8f8034e5df0e4c2b7fe162559.zip
dpdk-next-eventdev-ff45f462b87debf8f8034e5df0e4c2b7fe162559.tar.gz
dpdk-next-eventdev-ff45f462b87debf8f8034e5df0e4c2b7fe162559.tar.xz
net/mlx5: revert Netlink socket sharing
This reverts commit e28111ac9864af09e826241a915dfff87a9c00ad. The netlink requests are replaced by ifindex caching and not needed anymore. Fixes: e28111ac9864 ("net/mlx5: fix master device Netlink socket sharing") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_ethdev.c')
-rw-r--r--drivers/net/mlx5/mlx5_ethdev.c109
1 files changed, 3 insertions, 106 deletions
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index dfd9e97..9629cfb 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -240,51 +240,6 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])
}
/**
- * Get interface name for the specified device, uses the extra base
- * device resources to perform Netlink requests.
- *
- * This is a port representor-aware version of mlx5_get_master_ifname().
- *
- * @param[in] base
- * Pointer to Ethernet device to use Netlink socket from
- * to perfrom requests.
- * @param[in] dev
- * Pointer to Ethernet device.
- * @param[out] ifname
- * Interface name output buffer.
- *
- * @return
- * 0 on success, a negative errno value otherwise and rte_errno is set.
- */
-int
-mlx5_get_ifname_base(const struct rte_eth_dev *base,
- const struct rte_eth_dev *dev,
- char (*ifname)[IF_NAMESIZE])
-{
- struct mlx5_priv *priv = dev->data->dev_private;
- struct mlx5_priv *priv_base = base->data->dev_private;
- unsigned int ifindex;
-
- assert(priv);
- assert(priv->sh);
- assert(priv_base);
- ifindex = priv_base->nl_socket_rdma >= 0 ?
- mlx5_nl_ifindex(priv_base->nl_socket_rdma,
- priv->sh->ibdev_name,
- priv->ibv_port) : 0;
- if (!ifindex) {
- if (!priv->representor)
- return mlx5_get_master_ifname(priv->sh->ibdev_path,
- ifname);
- rte_errno = ENXIO;
- return -rte_errno;
- }
- if (if_indextoname(ifindex, &(*ifname)[0]))
- return 0;
- rte_errno = errno;
- return -rte_errno;
-}
-/**
* Get the interface index from device name.
*
* @param[in] dev
@@ -346,51 +301,6 @@ error:
}
/**
- * Perform ifreq ioctl() on specified Ethernet device,
- * ifindex, name and other attributes are requested
- * on the base device to avoid specified device Netlink
- * socket sharing (this is not thread-safe).
- *
- * @param[in] base
- * Pointer to Ethernet device to get dev attributes.
- * @param[in] dev
- * Pointer to Ethernet device to perform ioctl.
- * @param req
- * Request number to pass to ioctl().
- * @param[out] ifr
- * Interface request structure output buffer.
- *
- * @return
- * 0 on success, a negative errno value otherwise and rte_errno is set.
- */
-int
-mlx5_ifreq_base(const struct rte_eth_dev *base,
- const struct rte_eth_dev *dev,
- int req, struct ifreq *ifr)
-{
- int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
- int ret = 0;
-
- if (sock == -1) {
- rte_errno = errno;
- return -rte_errno;
- }
- ret = mlx5_get_ifname_base(base, dev, &ifr->ifr_name);
- if (ret)
- goto error;
- ret = ioctl(sock, req, ifr);
- if (ret == -1) {
- rte_errno = errno;
- goto error;
- }
- close(sock);
- return 0;
-error:
- close(sock);
- return -rte_errno;
-}
-
-/**
* Get device MTU.
*
* @param dev
@@ -872,15 +782,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
ifr = (struct ifreq) {
.ifr_data = (void *)&edata,
};
- /*
- * Use special version of mlx5_ifreq()
- * to get master device name with local
- * device Netlink socket. Using master
- * device Netlink socket is not thread
- * safe.
- */
- ret = mlx5_ifreq_base(dev, master,
- SIOCETHTOOL, &ifr);
+ ret = mlx5_ifreq(master, SIOCETHTOOL, &ifr);
}
}
if (ret) {
@@ -977,12 +879,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
ifr = (struct ifreq) {
.ifr_data = (void *)&gcmd,
};
- /*
- * Avoid using master Netlink socket.
- * This is not thread-safe.
- */
- ret = mlx5_ifreq_base(dev, master,
- SIOCETHTOOL, &ifr);
+ ret = mlx5_ifreq(master, SIOCETHTOOL, &ifr);
}
}
if (ret) {
@@ -1003,7 +900,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
*ecmd = gcmd;
ifr.ifr_data = (void *)ecmd;
- ret = mlx5_ifreq_base(dev, master ? master : dev, SIOCETHTOOL, &ifr);
+ ret = mlx5_ifreq(master ? master : dev, SIOCETHTOOL, &ifr);
if (ret) {
DRV_LOG(DEBUG,
"port %u ioctl(SIOCETHTOOL,"