net/mlx5: fix secondary process verification
[dpdk.git] / drivers / net / mlx5 / mlx5_ethdev.c
index a3cef68..ca9ad0f 100644 (file)
@@ -118,33 +118,6 @@ struct ethtool_link_settings {
 #define ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT 39
 #endif
 
-/**
- * Return private structure associated with an Ethernet device.
- *
- * @param dev
- *   Pointer to Ethernet device structure.
- *
- * @return
- *   Pointer to private structure.
- */
-struct priv *
-mlx5_get_priv(struct rte_eth_dev *dev)
-{
-       return dev->data->dev_private;
-}
-
-/**
- * Check if running as a secondary process.
- *
- * @return
- *   Nonzero if running as a secondary process.
- */
-inline int
-mlx5_is_secondary(void)
-{
-       return rte_eal_process_type() == RTE_PROC_SECONDARY;
-}
-
 /**
  * Get interface name from private structure.
  *
@@ -649,9 +622,6 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
        struct priv *priv = dev->data->dev_private;
        int ret;
 
-       if (mlx5_is_secondary())
-               return -E_RTE_SECONDARY;
-
        priv_lock(priv);
        ret = dev_configure(dev);
        assert(ret >= 0);
@@ -670,7 +640,7 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
 void
 mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
 {
-       struct priv *priv = mlx5_get_priv(dev);
+       struct priv *priv = dev->data->dev_private;
        unsigned int max;
        char ifname[IF_NAMESIZE];
 
@@ -761,7 +731,7 @@ mlx5_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 static int
 mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, int wait_to_complete)
 {
-       struct priv *priv = mlx5_get_priv(dev);
+       struct priv *priv = dev->data->dev_private;
        struct ethtool_cmd edata = {
                .cmd = ETHTOOL_GSET /* Deprecated since Linux v4.5. */
        };
@@ -827,7 +797,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, int wait_to_complete)
 static int
 mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
 {
-       struct priv *priv = mlx5_get_priv(dev);
+       struct priv *priv = dev->data->dev_private;
        struct ethtool_link_settings gcmd = { .cmd = ETHTOOL_GLINKSETTINGS };
        struct ifreq ifr;
        struct rte_eth_link dev_link;
@@ -952,9 +922,6 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
        uint16_t kern_mtu;
        int ret = 0;
 
-       if (mlx5_is_secondary())
-               return -E_RTE_SECONDARY;
-
        priv_lock(priv);
        ret = priv_get_mtu(priv, &kern_mtu);
        if (ret)
@@ -1002,9 +969,6 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
        };
        int ret;
 
-       if (mlx5_is_secondary())
-               return -E_RTE_SECONDARY;
-
        ifr.ifr_data = (void *)&ethpause;
        priv_lock(priv);
        if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) {
@@ -1053,9 +1017,6 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
        };
        int ret;
 
-       if (mlx5_is_secondary())
-               return -E_RTE_SECONDARY;
-
        ifr.ifr_data = (void *)&ethpause;
        ethpause.autoneg = fc_conf->autoneg;
        if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||
@@ -1317,7 +1278,6 @@ priv_dev_interrupt_handler_install(struct priv *priv, struct rte_eth_dev *dev)
 {
        int rc, flags;
 
-       assert(!mlx5_is_secondary());
        assert(priv->ctx->async_fd > 0);
        flags = fcntl(priv->ctx->async_fd, F_GETFL);
        rc = fcntl(priv->ctx->async_fd, F_SETFL, flags | O_NONBLOCK);