}
/**
- * Ethernet device configuration.
- *
- * Prepare the driver for a given number of TX and RX queues.
+ * DPDK callback for Ethernet device configuration.
*
* @param dev
* Pointer to Ethernet device structure.
*
* @return
- * 0 on success, errno value on failure.
+ * 0 on success, negative errno value on failure.
*/
-static int
-dev_configure(struct rte_eth_dev *dev)
+int
+mlx5_dev_configure(struct rte_eth_dev *dev)
{
struct priv *priv = dev->data->dev_private;
unsigned int rxqs_n = dev->data->nb_rx_queues;
j = 0;
}
return 0;
-}
-
-/**
- * DPDK callback for Ethernet device configuration.
- *
- * @param dev
- * Pointer to Ethernet device structure.
- *
- * @return
- * 0 on success, negative errno value on failure.
- */
-int
-mlx5_dev_configure(struct rte_eth_dev *dev)
-{
- struct priv *priv = dev->data->dev_private;
- int ret;
- priv_lock(priv);
- ret = dev_configure(dev);
- assert(ret >= 0);
- priv_unlock(priv);
- return -ret;
}
/**
char ifname[IF_NAMESIZE];
info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-
- priv_lock(priv);
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
info->hash_key_size = priv->rss_conf.rss_key_len;
info->speed_capa = priv->link_speed_capa;
info->flow_type_rss_offloads = ~MLX5_RSS_HF_MASK;
- priv_unlock(priv);
}
+/**
+ * Get supported packet types.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ *
+ * @return
+ * A pointer to the supported Packet types array.
+ */
const uint32_t *
mlx5_dev_supported_ptypes_get(struct rte_eth_dev *dev)
{
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * 0 on success, -1 on error.
*/
static int
mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev)
struct rte_eth_link dev_link;
int link_speed = 0;
- /* priv_lock() is not taken to allow concurrent calls. */
-
if (priv_ifreq(priv, SIOCGIFFLAGS, &ifr)) {
WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(errno));
return -1;
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * 0 on success, -1 on error.
*/
static int
mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev)
* Pointer to Ethernet device structure.
* @param wait_to_complete
* Wait for request completion (ignored).
+ *
+ * @return
+ * 0 on success, -1 on error.
*/
int
mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
struct priv *priv = dev->data->dev_private;
int ret;
- priv_lock(priv);
ret = priv_link_update(priv, wait_to_complete);
- priv_unlock(priv);
return ret;
}
uint16_t kern_mtu;
int ret = 0;
- priv_lock(priv);
ret = priv_get_mtu(priv, &kern_mtu);
if (ret)
goto out;
priv->mtu = mtu;
DEBUG("adapter port %u MTU set to %u", priv->port, mtu);
}
- priv_unlock(priv);
return 0;
out:
ret = errno;
WARN("cannot set port %u MTU to %u: %s", priv->port, mtu,
strerror(ret));
- priv_unlock(priv);
assert(ret >= 0);
return -ret;
}
int ret;
ifr.ifr_data = (void *)ðpause;
- priv_lock(priv);
if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) {
ret = errno;
WARN("ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM)"
strerror(ret));
goto out;
}
-
fc_conf->autoneg = ethpause.autoneg;
if (ethpause.rx_pause && ethpause.tx_pause)
fc_conf->mode = RTE_FC_FULL;
else
fc_conf->mode = RTE_FC_NONE;
ret = 0;
-
out:
- priv_unlock(priv);
assert(ret >= 0);
return -ret;
}
ethpause.tx_pause = 1;
else
ethpause.tx_pause = 0;
-
- priv_lock(priv);
if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) {
ret = errno;
WARN("ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
goto out;
}
ret = 0;
-
out:
- priv_unlock(priv);
assert(ret >= 0);
return -ret;
}
struct priv *priv = dev->data->dev_private;
int ret;
- while (!priv_trylock(priv)) {
- /* Alarm is being canceled. */
- if (priv->pending_alarm == 0)
- return;
- rte_pause();
- }
priv->pending_alarm = 0;
ret = priv_link_status_update(priv);
- priv_unlock(priv);
if (!ret)
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
}
struct priv *priv = dev->data->dev_private;
uint32_t events;
- priv_lock(priv);
events = priv_dev_status_handler(priv);
- priv_unlock(priv);
if (events & (1 << RTE_ETH_EVENT_INTR_LSC))
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
if (events & (1 << RTE_ETH_EVENT_INTR_RMV))
struct rte_eth_dev *dev = cb_arg;
struct priv *priv = dev->data->dev_private;
- priv_lock(priv);
priv_socket_handle(priv);
- priv_unlock(priv);
}
/**
rte_intr_callback_register(&priv->intr_handle,
mlx5_dev_interrupt_handler, dev);
}
-
rc = priv_socket_init(priv);
if (!rc && priv->primary_socket) {
priv->intr_handle_socket.fd = priv->primary_socket;
struct priv *priv = dev->data->dev_private;
int err;
- priv_lock(priv);
err = priv_dev_set_link(priv, 0);
- priv_unlock(priv);
return err;
}
struct priv *priv = dev->data->dev_private;
int err;
- priv_lock(priv);
err = priv_dev_set_link(priv, 1);
- priv_unlock(priv);
return err;
}