Index: sys/dev/mlx5/mlx5_en/en.h =================================================================== --- sys/dev/mlx5/mlx5_en/en.h +++ sys/dev/mlx5/mlx5_en/en.h @@ -141,6 +141,7 @@ m(+1, u64 rx_broadcast_bytes, "rx_broadcast_bytes", "Received broadcast bytes") \ m(+1, u64 tx_broadcast_packets, "tx_broadcast_packets", "Transmitted broadcast packets") \ m(+1, u64 tx_broadcast_bytes, "tx_broadcast_bytes", "Transmitted broadcast bytes") \ + m(+1, u64 rx_out_of_buffer, "rx_out_of_buffer", "Receive out of buffer, no recv wqes events") \ /* SW counters */ \ m(+1, u64 tso_packets, "tso_packets", "Transmitted TSO packets") \ m(+1, u64 tso_bytes, "tso_bytes", "Transmitted TSO bytes") \ @@ -161,6 +162,7 @@ struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_VPORT_STATS(MLX5E_STATS_VAR) + u32 rx_out_of_buffer_prev; }; #define MLX5E_PPORT_IEEE802_3_STATS(m) \ @@ -265,17 +267,13 @@ m(+1, u64 rs_corrected_symbols_lane3, "rs_corrected_symbols_lane3", \ "FEC corrected symbol counter lane 3") \ -#define MLX5E_PPORT_Q_CONTERS(m) \ - m(+1, u64 out_of_rx_buffer, "out_of_rx_buffer", "out of rx buffers aka no recv wqes events") - /* * Make sure to update mlx5e_update_pport_counters() * when adding a new MLX5E_PPORT_STATS block */ #define MLX5E_PPORT_STATS(m) \ MLX5E_PPORT_IEEE802_3_STATS(m) \ - MLX5E_PPORT_RFC2819_STATS(m) \ - MLX5E_PPORT_Q_CONTERS(m) + MLX5E_PPORT_RFC2819_STATS(m) #define MLX5E_PORT_STATS_DEBUG(m) \ MLX5E_PPORT_RFC2819_STATS_DEBUG(m) \ Index: sys/dev/mlx5/mlx5_en/mlx5_en_main.c =================================================================== --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -378,7 +378,7 @@ u64 sw_lro_flushed = 0; u64 rx_csum_none = 0; u64 rx_wqe_err = 0; - u32 out_of_rx_buffer = 0; + u32 rx_out_of_buffer = 0; int i; int j; @@ -440,6 +440,16 @@ memset(out, 0, outlen); + /* get number of out-of-buffer drops first */ + if (mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, + &rx_out_of_buffer)) + goto free_out; + + /* accumulate difference into a 64-bit counter */ + s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - s->rx_out_of_buffer_prev); + s->rx_out_of_buffer_prev = rx_out_of_buffer; + + /* get port statistics */ if (mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen)) goto free_out; @@ -485,7 +495,8 @@ s->rx_packets = s->rx_unicast_packets + s->rx_multicast_packets + - s->rx_broadcast_packets; + s->rx_broadcast_packets - + s->rx_out_of_buffer; s->rx_bytes = s->rx_unicast_bytes + s->rx_multicast_bytes + @@ -503,10 +514,14 @@ s->tx_csum_offload = s->tx_packets - tx_offload_none; s->rx_csum_good = s->rx_packets - s->rx_csum_none; + /* Update per port counters */ + mlx5e_update_pport_counters(priv); + #if (__FreeBSD_version < 1100000) /* no get_counters interface in fbsd 10 */ ifp->if_ipackets = s->rx_packets; ifp->if_ierrors = s->rx_error_packets; + ifp->if_iqdrops = s->rx_out_of_buffer; ifp->if_opackets = s->tx_packets; ifp->if_oerrors = s->tx_error_packets; ifp->if_snd.ifq_drops = s->tx_queue_dropped; @@ -514,12 +529,6 @@ ifp->if_obytes = s->tx_bytes; #endif - mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, - &out_of_rx_buffer); - - /* Update per port counters */ - mlx5e_update_pport_counters(priv); - priv->stats.pport.out_of_rx_buffer = (u64)out_of_rx_buffer; free_out: kvfree(out); PRIV_UNLOCK(priv); @@ -2178,6 +2187,9 @@ case IFCOUNTER_IERRORS: retval = priv->stats.vport.rx_error_packets; break; + case IFCOUNTER_IQDROPS: + retval = priv->stats.vport.rx_out_of_buffer; + break; case IFCOUNTER_OPACKETS: retval = priv->stats.vport.tx_packets; break;