* Miscellaneous control operations for mlx4 driver.
*/
-#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <linux/ethtool.h>
#include <rte_bus_pci.h>
#include <rte_errno.h>
-#include <rte_ethdev_driver.h>
+#include <ethdev_driver.h>
#include <rte_ether.h>
#include <rte_flow.h>
#include <rte_pci.h>
* Pointer to Ethernet device structure.
* @param toggle
* Toggle to set.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
*/
-static void
+static int
mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
{
struct mlx4_priv *priv = dev->data->dev_private;
const char *mode;
struct rte_flow_error error;
+ int ret;
switch (toggle) {
case RXMODE_TOGGLE_PROMISC_OFF:
default:
mode = "undefined";
}
- if (!mlx4_flow_sync(priv, &error))
- return;
+
+ ret = mlx4_flow_sync(priv, &error);
+ if (!ret)
+ return 0;
+
ERROR("cannot toggle %s mode (code %d, \"%s\"),"
" flow error type %d, cause %p, message: %s",
mode, rte_errno, strerror(rte_errno), error.type, error.cause,
error.message ? error.message : "(unspecified)");
+ return ret;
}
/**
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
*/
-void
+int
mlx4_promiscuous_enable(struct rte_eth_dev *dev)
{
- mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
+ return mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
}
/**
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
*/
-void
+int
mlx4_promiscuous_disable(struct rte_eth_dev *dev)
{
- mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);
+ return mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);
}
/**
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
*/
-void
+int
mlx4_allmulticast_enable(struct rte_eth_dev *dev)
{
- mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_ALLMULTI_ON);
+ return mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_ALLMULTI_ON);
}
/**
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
*/
-void
+int
mlx4_allmulticast_disable(struct rte_eth_dev *dev)
{
- mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_ALLMULTI_OFF);
+ return mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_ALLMULTI_OFF);
}
/**
* @param[out] info
* Info structure output buffer.
*/
-void
+int
mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
{
struct mlx4_priv *priv = dev->data->dev_private;
*/
max = ((priv->device_attr.max_cq > priv->device_attr.max_qp) ?
priv->device_attr.max_qp : priv->device_attr.max_cq);
- /* If max >= 65535 then max = 0, max_rx_queues is uint16_t. */
- if (max >= 65535)
- max = 65535;
+ /* max_rx_queues is uint16_t. */
+ max = RTE_MIN(max, (unsigned int)UINT16_MAX);
info->max_rx_queues = max;
info->max_tx_queues = max;
info->max_mac_addrs = RTE_DIM(priv->mac);
ETH_LINK_SPEED_40G |
ETH_LINK_SPEED_56G;
info->flow_type_rss_offloads = mlx4_conv_rss_types(priv, 0, 1);
+
+ return 0;
}
/**
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * alwasy 0 on success
*/
-void
+int
mlx4_stats_reset(struct rte_eth_dev *dev)
{
unsigned int i;
.idx = txq->stats.idx,
};
}
+
+ return 0;
}
/**
fc_conf->mode = RTE_FC_NONE;
ret = 0;
out:
- assert(ret >= 0);
+ MLX4_ASSERT(ret >= 0);
return -ret;
}
}
ret = 0;
out:
- assert(ret >= 0);
+ MLX4_ASSERT(ret >= 0);
return -ret;
}