Skip to content

Commit ef01622

Browse files
bharatpotnurirleon
authored andcommitted
RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size
Commit 'c2ed5611afd7' has increased the cpl_t5_pass_accept_rpl{} structure size by 8B to avoid roundup. cpl_t5_pass_accept_rpl{} is a HW specific structure and increasing its size will lead to unwanted adapter errors. Current commit reverts the cpl_t5_pass_accept_rpl{} back to its original and allocates zeroed skb buffer there by avoiding the memset for iss field. Reorder code to minimize chip type checks. Fixes: c2ed561 ("iw_cxgb4: Use memset_startat() for cpl_t5_pass_accept_rpl") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Potnuri Bharat Teja <[email protected]> Signed-off-by: Rahul Lakkireddy <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 4b83c3c commit ef01622

File tree

2 files changed

+10
-17
lines changed
  • drivers

2 files changed

+10
-17
lines changed

drivers/infiniband/hw/cxgb4/cm.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,31 +2468,24 @@ static int accept_cr(struct c4iw_ep *ep, struct sk_buff *skb,
24682468
opt2 |= CCTRL_ECN_V(1);
24692469
}
24702470

2471-
skb_get(skb);
2472-
rpl = cplhdr(skb);
24732471
if (!is_t4(adapter_type)) {
2474-
BUILD_BUG_ON(sizeof(*rpl5) != roundup(sizeof(*rpl5), 16));
2475-
skb_trim(skb, sizeof(*rpl5));
2476-
rpl5 = (void *)rpl;
2477-
INIT_TP_WR(rpl5, ep->hwtid);
2478-
} else {
2479-
skb_trim(skb, sizeof(*rpl));
2480-
INIT_TP_WR(rpl, ep->hwtid);
2481-
}
2482-
OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL,
2483-
ep->hwtid));
2484-
2485-
if (CHELSIO_CHIP_VERSION(adapter_type) > CHELSIO_T4) {
24862472
u32 isn = (prandom_u32() & ~7UL) - 1;
2473+
2474+
skb = get_skb(skb, roundup(sizeof(*rpl5), 16), GFP_KERNEL);
2475+
rpl5 = __skb_put_zero(skb, roundup(sizeof(*rpl5), 16));
2476+
rpl = (void *)rpl5;
2477+
INIT_TP_WR_CPL(rpl5, CPL_PASS_ACCEPT_RPL, ep->hwtid);
24872478
opt2 |= T5_OPT_2_VALID_F;
24882479
opt2 |= CONG_CNTRL_V(CONG_ALG_TAHOE);
24892480
opt2 |= T5_ISS_F;
2490-
rpl5 = (void *)rpl;
2491-
memset_after(rpl5, 0, iss);
24922481
if (peer2peer)
24932482
isn += 4;
24942483
rpl5->iss = cpu_to_be32(isn);
24952484
pr_debug("iss %u\n", be32_to_cpu(rpl5->iss));
2485+
} else {
2486+
skb = get_skb(skb, sizeof(*rpl), GFP_KERNEL);
2487+
rpl = __skb_put_zero(skb, sizeof(*rpl));
2488+
INIT_TP_WR_CPL(rpl, CPL_PASS_ACCEPT_RPL, ep->hwtid);
24962489
}
24972490

24982491
rpl->opt0 = cpu_to_be64(opt0);

drivers/net/ethernet/chelsio/cxgb4/t4_msg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ struct cpl_t5_pass_accept_rpl {
497497
__be32 opt2;
498498
__be64 opt0;
499499
__be32 iss;
500-
__be32 rsvd[3];
500+
__be32 rsvd;
501501
};
502502

503503
struct cpl_act_open_req {

0 commit comments

Comments
 (0)