__be64 RFC_2819_counters[NUM_RFC_2819_COUNTERS];
 };
 
+static const char qcounter_stats_strings[][ETH_GSTRING_LEN] = {
+       "rx_out_of_buffer",
+};
+
+struct mlx5e_qcounter_stats {
+       u32 rx_out_of_buffer;
+#define NUM_Q_COUNTERS 1
+};
+
 static const char rq_stats_strings[][ETH_GSTRING_LEN] = {
        "packets",
        "bytes",
 struct mlx5e_stats {
        struct mlx5e_vport_stats   vport;
        struct mlx5e_pport_stats   pport;
+       struct mlx5e_qcounter_stats qcnt;
 };
 
 struct mlx5e_params {
        struct net_device         *netdev;
        struct mlx5e_stats         stats;
        struct mlx5e_tstamp        tstamp;
+       u16 q_counter;
 };
 
 #define MLX5E_NET_IP_ALIGN 2
 
        },
 };
 
+#define MLX5E_NUM_Q_CNTRS(priv) (NUM_Q_COUNTERS * (!!priv->q_counter))
+
 static int mlx5e_get_sset_count(struct net_device *dev, int sset)
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
        switch (sset) {
        case ETH_SS_STATS:
                return NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS +
+                      MLX5E_NUM_Q_CNTRS(priv) +
                       priv->params.num_channels * NUM_RQ_STATS +
                       priv->params.num_channels * priv->params.num_tc *
                                                   NUM_SQ_STATS;
                        strcpy(data + (idx++) * ETH_GSTRING_LEN,
                               vport_strings[i]);
 
+               /* Q counters */
+               for (i = 0; i < MLX5E_NUM_Q_CNTRS(priv); i++)
+                       strcpy(data + (idx++) * ETH_GSTRING_LEN,
+                              qcounter_stats_strings[i]);
+
                /* PPORT counters */
                for (i = 0; i < NUM_PPORT_COUNTERS; i++)
                        strcpy(data + (idx++) * ETH_GSTRING_LEN,
        for (i = 0; i < NUM_VPORT_COUNTERS; i++)
                data[idx++] = ((u64 *)&priv->stats.vport)[i];
 
+       for (i = 0; i < MLX5E_NUM_Q_CNTRS(priv); i++)
+               data[idx++] = ((u32 *)&priv->stats.qcnt)[i];
+
        for (i = 0; i < NUM_PPORT_COUNTERS; i++)
                data[idx++] = be64_to_cpu(((__be64 *)&priv->stats.pport)[i]);
 
 
        kvfree(out);
 }
 
+static void mlx5e_update_q_counter(struct mlx5e_priv *priv)
+{
+       struct mlx5e_qcounter_stats *qcnt = &priv->stats.qcnt;
+
+       if (!priv->q_counter)
+               return;
+
+       mlx5_core_query_out_of_buffer(priv->mdev, priv->q_counter,
+                                     &qcnt->rx_out_of_buffer);
+}
+
 void mlx5e_update_stats(struct mlx5e_priv *priv)
 {
        struct mlx5_core_dev *mdev = priv->mdev;
                               s->rx_csum_sw;
 
        mlx5e_update_pport_counters(priv);
+       mlx5e_update_q_counter(priv);
+
 free_out:
        kvfree(out);
 }
        MLX5_SET(wq, wq, log_wq_stride,    ilog2(sizeof(struct mlx5e_rx_wqe)));
        MLX5_SET(wq, wq, log_wq_sz,        priv->params.log_rq_size);
        MLX5_SET(wq, wq, pd,               priv->pdn);
+       MLX5_SET(rqc, rqc, counter_set_id, priv->q_counter);
 
        param->wq.buf_numa_node = dev_to_node(&priv->mdev->pdev->dev);
        param->wq.linear = 1;
        return err;
 }
 
+static void mlx5e_create_q_counter(struct mlx5e_priv *priv)
+{
+       struct mlx5_core_dev *mdev = priv->mdev;
+       int err;
+
+       err = mlx5_core_alloc_q_counter(mdev, &priv->q_counter);
+       if (err) {
+               mlx5_core_warn(mdev, "alloc queue counter failed, %d\n", err);
+               priv->q_counter = 0;
+       }
+}
+
+static void mlx5e_destroy_q_counter(struct mlx5e_priv *priv)
+{
+       if (!priv->q_counter)
+               return;
+
+       mlx5_core_dealloc_q_counter(priv->mdev, priv->q_counter);
+}
+
 static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
 {
        struct net_device *netdev;
                goto err_destroy_tirs;
        }
 
+       mlx5e_create_q_counter(priv);
+
        mlx5e_init_eth_addr(priv);
 
        mlx5e_vxlan_init(priv);
 
        err = mlx5e_tc_init(priv);
        if (err)
-               goto err_destroy_flow_tables;
+               goto err_dealloc_q_counters;
 
 #ifdef CONFIG_MLX5_CORE_EN_DCB
        mlx5e_dcbnl_ieee_setets_core(priv, &priv->params.ets);
 err_tc_cleanup:
        mlx5e_tc_cleanup(priv);
 
-err_destroy_flow_tables:
+err_dealloc_q_counters:
+       mlx5e_destroy_q_counter(priv);
        mlx5e_destroy_flow_tables(priv);
 
 err_destroy_tirs:
        unregister_netdev(netdev);
        mlx5e_tc_cleanup(priv);
        mlx5e_vxlan_cleanup(priv);
+       mlx5e_destroy_q_counter(priv);
        mlx5e_destroy_flow_tables(priv);
        mlx5e_destroy_tirs(priv);
        mlx5e_destroy_rqt(priv, MLX5E_SINGLE_RQ_RQT);