* [PATCH for-rc] RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size
@ 2022-08-09 18:41 Rahul Lakkireddy
2022-08-09 22:59 ` Kees Cook
2022-08-16 13:21 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Rahul Lakkireddy @ 2022-08-09 18:41 UTC (permalink / raw)
To: linux-rdma
Cc: netdev, jgg, leonro, davem, kuba, edumazet, pabeni, keescook, bharat
From: Potnuri Bharat Teja <bharat@chelsio.com>
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: c2ed5611afd7 ("iw_cxgb4: Use memset_startat() for cpl_t5_pass_accept_rpl")
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
drivers/infiniband/hw/cxgb4/cm.c | 25 ++++++++-------------
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 2 +-
2 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index c16017f6e8db..14392c942f49 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -2468,31 +2468,24 @@ static int accept_cr(struct c4iw_ep *ep, struct sk_buff *skb,
opt2 |= CCTRL_ECN_V(1);
}
- skb_get(skb);
- rpl = cplhdr(skb);
if (!is_t4(adapter_type)) {
- BUILD_BUG_ON(sizeof(*rpl5) != roundup(sizeof(*rpl5), 16));
- skb_trim(skb, sizeof(*rpl5));
- rpl5 = (void *)rpl;
- INIT_TP_WR(rpl5, ep->hwtid);
- } else {
- skb_trim(skb, sizeof(*rpl));
- INIT_TP_WR(rpl, ep->hwtid);
- }
- OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL,
- ep->hwtid));
-
- if (CHELSIO_CHIP_VERSION(adapter_type) > CHELSIO_T4) {
u32 isn = (prandom_u32() & ~7UL) - 1;
+
+ skb = get_skb(skb, roundup(sizeof(*rpl5), 16), GFP_KERNEL);
+ rpl5 = __skb_put_zero(skb, roundup(sizeof(*rpl5), 16));
+ rpl = (void *)rpl5;
+ INIT_TP_WR_CPL(rpl5, CPL_PASS_ACCEPT_RPL, ep->hwtid);
opt2 |= T5_OPT_2_VALID_F;
opt2 |= CONG_CNTRL_V(CONG_ALG_TAHOE);
opt2 |= T5_ISS_F;
- rpl5 = (void *)rpl;
- memset_after(rpl5, 0, iss);
if (peer2peer)
isn += 4;
rpl5->iss = cpu_to_be32(isn);
pr_debug("iss %u\n", be32_to_cpu(rpl5->iss));
+ } else {
+ skb = get_skb(skb, sizeof(*rpl), GFP_KERNEL);
+ rpl = __skb_put_zero(skb, sizeof(*rpl));
+ INIT_TP_WR_CPL(rpl, CPL_PASS_ACCEPT_RPL, ep->hwtid);
}
rpl->opt0 = cpu_to_be64(opt0);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
index 26433a62d7f0..fed5f93bf620 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
@@ -497,7 +497,7 @@ struct cpl_t5_pass_accept_rpl {
__be32 opt2;
__be64 opt0;
__be32 iss;
- __be32 rsvd[3];
+ __be32 rsvd;
};
struct cpl_act_open_req {
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH for-rc] RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size
2022-08-09 18:41 [PATCH for-rc] RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size Rahul Lakkireddy
@ 2022-08-09 22:59 ` Kees Cook
2022-08-16 13:21 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2022-08-09 22:59 UTC (permalink / raw)
To: Rahul Lakkireddy
Cc: linux-rdma, netdev, jgg, leonro, davem, kuba, edumazet, pabeni, bharat
On Wed, Aug 10, 2022 at 12:11:18AM +0530, Rahul Lakkireddy wrote:
> From: Potnuri Bharat Teja <bharat@chelsio.com>
>
> 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: c2ed5611afd7 ("iw_cxgb4: Use memset_startat() for cpl_t5_pass_accept_rpl")
> Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Thanks for the better solution!
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH for-rc] RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size
2022-08-09 18:41 [PATCH for-rc] RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size Rahul Lakkireddy
2022-08-09 22:59 ` Kees Cook
@ 2022-08-16 13:21 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-08-16 13:21 UTC (permalink / raw)
To: Rahul Lakkireddy
Cc: linux-rdma, netdev, jgg, davem, kuba, edumazet, pabeni, keescook, bharat
On Wed, Aug 10, 2022 at 12:11:18AM +0530, Rahul Lakkireddy wrote:
> From: Potnuri Bharat Teja <bharat@chelsio.com>
>
> 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: c2ed5611afd7 ("iw_cxgb4: Use memset_startat() for cpl_t5_pass_accept_rpl")
> Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> ---
> drivers/infiniband/hw/cxgb4/cm.c | 25 ++++++++-------------
> drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 2 +-
> 2 files changed, 10 insertions(+), 17 deletions(-)
>
Thanks, applied to -rc.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-16 13:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-09 18:41 [PATCH for-rc] RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size Rahul Lakkireddy
2022-08-09 22:59 ` Kees Cook
2022-08-16 13:21 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).