From 32b0d28145ef610bf34fadc076a6ffb7e4f075cd Mon Sep 17 00:00:00 2001 From: hselasky Date: Tue, 8 Aug 2017 11:49:36 +0000 Subject: [PATCH] Make sure the received IP header gets 32-bit aligned for short packets in the mlx5en(4) driver. MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c index 4d29b2397e64..7c490deba86d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c @@ -355,9 +355,11 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) rq->stats.wqe_err++; goto wq_ll_pop; } - - if (MHLEN >= byte_cnt && + if ((MHLEN - MLX5E_NET_IP_ALIGN) >= byte_cnt && (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { + /* get IP header aligned */ + mb->m_data += MLX5E_NET_IP_ALIGN; + bcopy(rq->mbuf[wqe_counter].data, mtod(mb, caddr_t), byte_cnt); } else {