net/mlx5: support yellow meter action for hierarchy tag rule
[dpdk.git] / drivers / net / mlx5 / windows / mlx5_ethdev_os.c
index 359f73d..f975265 100644 (file)
@@ -85,6 +85,8 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[MLX5_NAMESIZE])
 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;
 
@@ -94,7 +96,14 @@ mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu)
        }
        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;
 }
 
@@ -112,9 +121,23 @@ mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu)
 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;
 }
 
 /*
@@ -203,7 +226,16 @@ mlx5_os_get_stats_n(struct rte_eth_dev *dev)
 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;
 }
 
 /**