int
mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu)
{
+ int err;
+ uint32_t curr_mtu;
struct mlx5_priv *priv;
mlx5_context_st *context_obj;
}
priv = dev->data->dev_private;
context_obj = (mlx5_context_st *)priv->sh->cdev->ctx;
- *mtu = context_obj->mlx5_dev.mtu_bytes;
+
+ err = mlx5_glue->devx_get_mtu(context_obj, &curr_mtu);
+ if (err != 0) {
+ DRV_LOG(WARNING, "Could not get the MTU!");
+ return err;
+ }
+ *mtu = (uint16_t)curr_mtu;
+
return 0;
}
int
mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
{
- RTE_SET_USED(dev);
- RTE_SET_USED(mtu);
- return -ENOTSUP;
+ int err;
+ struct mlx5_priv *priv;
+ mlx5_context_st *context_obj;
+
+ if (!dev) {
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+ priv = dev->data->dev_private;
+ context_obj = (mlx5_context_st *)priv->sh->cdev->ctx;
+
+ err = mlx5_glue->devx_set_mtu(context_obj, mtu);
+ if (err != 0) {
+ DRV_LOG(WARNING, "Could not set the MTU!");
+ return err;
+ }
+ return 0;
}
/*
void
mlx5_os_stats_init(struct rte_eth_dev *dev)
{
- RTE_SET_USED(dev);
+ struct mlx5_priv *priv = dev->data->dev_private;
+ struct mlx5_stats_ctrl *stats_ctrl = &priv->stats_ctrl;
+ int ret;
+
+ /* Copy to base at first time. */
+ ret = mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
+ if (ret)
+ DRV_LOG(ERR, "port %u cannot read device counters: %s",
+ dev->data->port_id, strerror(rte_errno));
+ stats_ctrl->imissed = 0;
}
/**