Index: sys/dev/mlx5/mlx5_en/mlx5_en_tx.c =================================================================== --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -394,17 +394,15 @@ /* check if there are no segments */ if (unlikely(xsegs == 0)) { bus_dmamap_unload(sq->dma_tag, sq->mbuf[pi].dma_map); - m_freem(mb); - *mbp = NULL; /* safety clear */ - return (0); + err = 0; + goto tx_drop; } /* return ENOBUFS if the queue is full */ if (unlikely(!mlx5e_sq_has_room_for(sq, xsegs))) { bus_dmamap_unload(sq->dma_tag, sq->mbuf[pi].dma_map); - m_freem(mb); - *mbp = NULL; /* safety clear */ - return (ENOBUFS); + err = ENOBUFS; + goto tx_drop; } wqe = mlx5_wq_cyc_get_wqe(&sq->wq, pi); @@ -792,6 +790,7 @@ if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || READ_ONCE(sq->running) == 0)) { m_freem(mb); + sq->stats.dropped++; return (ENETDOWN); } @@ -799,6 +798,7 @@ if (mlx5e_sq_xmit(sq, &mb) != 0) { /* NOTE: m_freem() is NULL safe */ m_freem(mb); + sq->stats.dropped++; err = ENOBUFS; }