Count number of times transmit ring is out of buffers in mlx5en(4).

Differential Revision:	https://reviews.freebsd.org/D24273
MFC after:	1 week
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2020-04-06 09:41:22 +00:00
parent 36c1a37655
commit f504949065
2 changed files with 8 additions and 2 deletions

View File

@ -627,6 +627,7 @@ struct mlx5e_rq_stats {
m(+1, u64, csum_offload_none, "csum_offload_none", "Transmitted packets") \ m(+1, u64, csum_offload_none, "csum_offload_none", "Transmitted packets") \
m(+1, u64, defragged, "defragged", "Transmitted packets") \ m(+1, u64, defragged, "defragged", "Transmitted packets") \
m(+1, u64, dropped, "dropped", "Transmitted packets") \ m(+1, u64, dropped, "dropped", "Transmitted packets") \
m(+1, u64, enobuf, "enobuf", "Transmitted packets") \
m(+1, u64, nop, "nop", "Transmitted packets") m(+1, u64, nop, "nop", "Transmitted packets")
#define MLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT)) #define MLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT))

View File

@ -401,6 +401,7 @@ mlx5e_sq_dump_xmit(struct mlx5e_sq *sq, struct mlx5e_xmit_args *parg, struct mbu
/* return ENOBUFS if the queue is full */ /* return ENOBUFS if the queue is full */
if (unlikely(!mlx5e_sq_has_room_for(sq, xsegs))) { if (unlikely(!mlx5e_sq_has_room_for(sq, xsegs))) {
sq->stats.enobuf++;
bus_dmamap_unload(sq->dma_tag, sq->mbuf[pi].dma_map); bus_dmamap_unload(sq->dma_tag, sq->mbuf[pi].dma_map);
m_freem(mb); m_freem(mb);
*mbp = NULL; /* safety clear */ *mbp = NULL; /* safety clear */
@ -493,8 +494,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
top: top:
#endif #endif
/* Return ENOBUFS if the queue is full */ /* Return ENOBUFS if the queue is full */
if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) {
sq->stats.enobuf++;
return (ENOBUFS); return (ENOBUFS);
}
/* Align SQ edge with NOPs to avoid WQE wrap around */ /* Align SQ edge with NOPs to avoid WQE wrap around */
pi = ((~sq->pc) & sq->wq.sz_m1); pi = ((~sq->pc) & sq->wq.sz_m1);
@ -502,8 +505,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
/* Send one multi NOP message instead of many */ /* Send one multi NOP message instead of many */
mlx5e_send_nop(sq, (pi + 1) * MLX5_SEND_WQEBB_NUM_DS); mlx5e_send_nop(sq, (pi + 1) * MLX5_SEND_WQEBB_NUM_DS);
pi = ((~sq->pc) & sq->wq.sz_m1); pi = ((~sq->pc) & sq->wq.sz_m1);
if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) {
sq->stats.enobuf++;
return (ENOMEM); return (ENOMEM);
}
} }
#ifdef KERN_TLS #ifdef KERN_TLS