net/mlx5: fix secondary process verification

Since the secondary process has its own devops, function which cannot be
called by the secondary don't need anymore to verify which process is
calling it.

Fixes: 87ec44ce1651 ("net/mlx5: add operations for secondary process")
Cc: stable@dpdk.org

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
This commit is contained in:
Nélio Laranjeiro 2017-11-23 10:22:33 +01:00 committed by Ferruh Yigit
parent 01d79216e6
commit 51e7fa8d20
8 changed files with 1 additions and 61 deletions

View File

@ -158,7 +158,6 @@ mlx5_alloc_verbs_buf(size_t size, void *data)
size_t alignment = sysconf(_SC_PAGESIZE); size_t alignment = sysconf(_SC_PAGESIZE);
assert(data != NULL); assert(data != NULL);
assert(!mlx5_is_secondary());
ret = rte_malloc_socket(__func__, size, alignment, ret = rte_malloc_socket(__func__, size, alignment,
priv->dev->device->numa_node); priv->dev->device->numa_node);
DEBUG("Extern alloc size: %lu, align: %lu: %p", size, alignment, ret); DEBUG("Extern alloc size: %lu, align: %lu: %p", size, alignment, ret);
@ -177,7 +176,6 @@ static void
mlx5_free_verbs_buf(void *ptr, void *data __rte_unused) mlx5_free_verbs_buf(void *ptr, void *data __rte_unused)
{ {
assert(data != NULL); assert(data != NULL);
assert(!mlx5_is_secondary());
DEBUG("Extern free request: %p", ptr); DEBUG("Extern free request: %p", ptr);
rte_free(ptr); rte_free(ptr);
} }
@ -687,7 +685,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
mlx5_dev[idx].ports |= test; mlx5_dev[idx].ports |= test;
if (mlx5_is_secondary()) { if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
/* from rte_ethdev.c */ /* from rte_ethdev.c */
char name[RTE_ETH_NAME_MAX_LEN]; char name[RTE_ETH_NAME_MAX_LEN];

View File

@ -118,18 +118,6 @@ struct ethtool_link_settings {
#define ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT 39 #define ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT 39
#endif #endif
/**
* 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. * Get interface name from private structure.
* *
@ -634,9 +622,6 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
struct priv *priv = dev->data->dev_private; struct priv *priv = dev->data->dev_private;
int ret; int ret;
if (mlx5_is_secondary())
return -E_RTE_SECONDARY;
priv_lock(priv); priv_lock(priv);
ret = dev_configure(dev); ret = dev_configure(dev);
assert(ret >= 0); assert(ret >= 0);
@ -937,9 +922,6 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
uint16_t kern_mtu; uint16_t kern_mtu;
int ret = 0; int ret = 0;
if (mlx5_is_secondary())
return -E_RTE_SECONDARY;
priv_lock(priv); priv_lock(priv);
ret = priv_get_mtu(priv, &kern_mtu); ret = priv_get_mtu(priv, &kern_mtu);
if (ret) if (ret)
@ -987,9 +969,6 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
}; };
int ret; int ret;
if (mlx5_is_secondary())
return -E_RTE_SECONDARY;
ifr.ifr_data = (void *)&ethpause; ifr.ifr_data = (void *)&ethpause;
priv_lock(priv); priv_lock(priv);
if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) { if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) {
@ -1038,9 +1017,6 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
}; };
int ret; int ret;
if (mlx5_is_secondary())
return -E_RTE_SECONDARY;
ifr.ifr_data = (void *)&ethpause; ifr.ifr_data = (void *)&ethpause;
ethpause.autoneg = fc_conf->autoneg; ethpause.autoneg = fc_conf->autoneg;
if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) || if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||
@ -1302,7 +1278,6 @@ priv_dev_interrupt_handler_install(struct priv *priv, struct rte_eth_dev *dev)
{ {
int rc, flags; int rc, flags;
assert(!mlx5_is_secondary());
assert(priv->ctx->async_fd > 0); assert(priv->ctx->async_fd > 0);
flags = fcntl(priv->ctx->async_fd, F_GETFL); flags = fcntl(priv->ctx->async_fd, F_GETFL);
rc = fcntl(priv->ctx->async_fd, F_SETFL, flags | O_NONBLOCK); rc = fcntl(priv->ctx->async_fd, F_SETFL, flags | O_NONBLOCK);

View File

@ -93,8 +93,6 @@ priv_get_mac(struct priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN])
void void
mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
{ {
if (mlx5_is_secondary())
return;
assert(index < MLX5_MAX_MAC_ADDRESSES); assert(index < MLX5_MAX_MAC_ADDRESSES);
memset(&dev->data->mac_addrs[index], 0, sizeof(struct ether_addr)); memset(&dev->data->mac_addrs[index], 0, sizeof(struct ether_addr));
if (!dev->data->promiscuous && !dev->data->all_multicast) if (!dev->data->promiscuous && !dev->data->all_multicast)
@ -124,8 +122,6 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac,
int ret = 0; int ret = 0;
(void)vmdq; (void)vmdq;
if (mlx5_is_secondary())
return 0;
assert(index < MLX5_MAX_MAC_ADDRESSES); assert(index < MLX5_MAX_MAC_ADDRESSES);
/* First, make sure this address isn't already configured. */ /* First, make sure this address isn't already configured. */
for (i = 0; (i != MLX5_MAX_MAC_ADDRESSES); ++i) { for (i = 0; (i != MLX5_MAX_MAC_ADDRESSES); ++i) {
@ -154,8 +150,6 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac,
void void
mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
{ {
if (mlx5_is_secondary())
return;
DEBUG("%p: setting primary MAC address", (void *)dev); DEBUG("%p: setting primary MAC address", (void *)dev);
mlx5_mac_addr_add(dev, mac_addr, 0, 0); mlx5_mac_addr_add(dev, mac_addr, 0, 0);
} }

View File

@ -274,7 +274,6 @@ mlx5_dev_rss_reta_update(struct rte_eth_dev *dev,
int ret; int ret;
struct priv *priv = dev->data->dev_private; struct priv *priv = dev->data->dev_private;
assert(!mlx5_is_secondary());
priv_lock(priv); priv_lock(priv);
ret = priv_dev_rss_reta_update(priv, reta_conf, reta_size); ret = priv_dev_rss_reta_update(priv, reta_conf, reta_size);
priv_unlock(priv); priv_unlock(priv);

View File

@ -60,8 +60,6 @@
void void
mlx5_promiscuous_enable(struct rte_eth_dev *dev) mlx5_promiscuous_enable(struct rte_eth_dev *dev)
{ {
if (mlx5_is_secondary())
return;
dev->data->promiscuous = 1; dev->data->promiscuous = 1;
mlx5_traffic_restart(dev); mlx5_traffic_restart(dev);
} }
@ -75,8 +73,6 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
void void
mlx5_promiscuous_disable(struct rte_eth_dev *dev) mlx5_promiscuous_disable(struct rte_eth_dev *dev)
{ {
if (mlx5_is_secondary())
return;
dev->data->promiscuous = 0; dev->data->promiscuous = 0;
mlx5_traffic_restart(dev); mlx5_traffic_restart(dev);
} }
@ -90,8 +86,6 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
void void
mlx5_allmulticast_enable(struct rte_eth_dev *dev) mlx5_allmulticast_enable(struct rte_eth_dev *dev)
{ {
if (mlx5_is_secondary())
return;
dev->data->all_multicast = 1; dev->data->all_multicast = 1;
mlx5_traffic_restart(dev); mlx5_traffic_restart(dev);
} }
@ -105,8 +99,6 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
void void
mlx5_allmulticast_disable(struct rte_eth_dev *dev) mlx5_allmulticast_disable(struct rte_eth_dev *dev)
{ {
if (mlx5_is_secondary())
return;
dev->data->all_multicast = 0; dev->data->all_multicast = 0;
mlx5_traffic_restart(dev); mlx5_traffic_restart(dev);
} }

View File

@ -242,8 +242,6 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
int ret = 0; int ret = 0;
(void)conf; (void)conf;
if (mlx5_is_secondary())
return -E_RTE_SECONDARY;
priv_lock(priv); priv_lock(priv);
if (!rte_is_power_of_2(desc)) { if (!rte_is_power_of_2(desc)) {
desc = 1 << log2above(desc); desc = 1 << log2above(desc);
@ -294,9 +292,6 @@ mlx5_rx_queue_release(void *dpdk_rxq)
struct mlx5_rxq_ctrl *rxq_ctrl; struct mlx5_rxq_ctrl *rxq_ctrl;
struct priv *priv; struct priv *priv;
if (mlx5_is_secondary())
return;
if (rxq == NULL) if (rxq == NULL)
return; return;
rxq_ctrl = container_of(rxq, struct mlx5_rxq_ctrl, rxq); rxq_ctrl = container_of(rxq, struct mlx5_rxq_ctrl, rxq);
@ -327,7 +322,6 @@ priv_rx_intr_vec_enable(struct priv *priv)
unsigned int count = 0; unsigned int count = 0;
struct rte_intr_handle *intr_handle = priv->dev->intr_handle; struct rte_intr_handle *intr_handle = priv->dev->intr_handle;
assert(!mlx5_is_secondary());
if (!priv->dev->data->dev_conf.intr_conf.rxq) if (!priv->dev->data->dev_conf.intr_conf.rxq)
return 0; return 0;
priv_rx_intr_vec_disable(priv); priv_rx_intr_vec_disable(priv);

View File

@ -132,9 +132,6 @@ mlx5_dev_start(struct rte_eth_dev *dev)
struct mlx5_mr *mr = NULL; struct mlx5_mr *mr = NULL;
int err; int err;
if (mlx5_is_secondary())
return -E_RTE_SECONDARY;
dev->data->dev_started = 1; dev->data->dev_started = 1;
priv_lock(priv); priv_lock(priv);
err = priv_flow_create_drop_queue(priv); err = priv_flow_create_drop_queue(priv);
@ -213,9 +210,6 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
struct priv *priv = dev->data->dev_private; struct priv *priv = dev->data->dev_private;
struct mlx5_mr *mr; struct mlx5_mr *mr;
if (mlx5_is_secondary())
return;
priv_lock(priv); priv_lock(priv);
dev->data->dev_started = 0; dev->data->dev_started = 0;
/* Prevent crashes when queues are still in use. */ /* Prevent crashes when queues are still in use. */

View File

@ -142,9 +142,6 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
container_of(txq, struct mlx5_txq_ctrl, txq); container_of(txq, struct mlx5_txq_ctrl, txq);
int ret = 0; int ret = 0;
if (mlx5_is_secondary())
return -E_RTE_SECONDARY;
priv_lock(priv); priv_lock(priv);
if (desc <= MLX5_TX_COMP_THRESH) { if (desc <= MLX5_TX_COMP_THRESH) {
WARN("%p: number of descriptors requested for TX queue %u" WARN("%p: number of descriptors requested for TX queue %u"
@ -203,9 +200,6 @@ mlx5_tx_queue_release(void *dpdk_txq)
struct priv *priv; struct priv *priv;
unsigned int i; unsigned int i;
if (mlx5_is_secondary())
return;
if (txq == NULL) if (txq == NULL)
return; return;
txq_ctrl = container_of(txq, struct mlx5_txq_ctrl, txq); txq_ctrl = container_of(txq, struct mlx5_txq_ctrl, txq);