Skip to content

Commit b8d9114

Browse files
khalidm96Saeed Mahameed
authored andcommitted
net/mlx5e: Fix wrong calculation of header index in HW_GRO
The HW doesn't wrap the CQE.shampo.header_index field according to the headers buffer size, instead it always increases it until reaching overflow of u16 size. Thus the mlx5e_handle_rx_cqe_mpwrq_shampo handler should mask the CQE header_index field to find the actual header index in the headers buffer. Fixes: f97d5c2 ("net/mlx5e: Add handle SHAMPO cqe support") Signed-off-by: Khalid Manaa <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 880b517 commit b8d9114

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ static inline u16 mlx5e_txqsq_get_next_pi(struct mlx5e_txqsq *sq, u16 size)
167167
return pi;
168168
}
169169

170+
static inline u16 mlx5e_shampo_get_cqe_header_index(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
171+
{
172+
return be16_to_cpu(cqe->shampo.header_entry_index) & (rq->mpwqe.shampo->hd_per_wq - 1);
173+
}
174+
170175
struct mlx5e_shampo_umr {
171176
u16 len;
172177
};

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ static void mlx5e_shampo_update_ipv6_udp_hdr(struct mlx5e_rq *rq, struct ipv6hdr
11171117
static void mlx5e_shampo_update_fin_psh_flags(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
11181118
struct tcphdr *skb_tcp_hd)
11191119
{
1120-
u16 header_index = be16_to_cpu(cqe->shampo.header_entry_index);
1120+
u16 header_index = mlx5e_shampo_get_cqe_header_index(rq, cqe);
11211121
struct tcphdr *last_tcp_hd;
11221122
void *last_hd_addr;
11231123

@@ -1973,7 +1973,7 @@ mlx5e_free_rx_shampo_hd_entry(struct mlx5e_rq *rq, u16 header_index)
19731973
static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
19741974
{
19751975
u16 data_bcnt = mpwrq_get_cqe_byte_cnt(cqe) - cqe->shampo.header_size;
1976-
u16 header_index = be16_to_cpu(cqe->shampo.header_entry_index);
1976+
u16 header_index = mlx5e_shampo_get_cqe_header_index(rq, cqe);
19771977
u32 wqe_offset = be32_to_cpu(cqe->shampo.data_offset);
19781978
u16 cstrides = mpwrq_get_cqe_consumed_strides(cqe);
19791979
u32 data_offset = wqe_offset & (PAGE_SIZE - 1);

0 commit comments

Comments
 (0)