public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: jgg@nvidia.com, zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org
Cc: Bob Pearson <rpearsonhpe@gmail.com>
Subject: [PATCH 6/7] RDMA/rxe: Add parameters to control checking/generating ICRC
Date: Tue, 29 Jun 2021 15:14:11 -0500	[thread overview]
Message-ID: <20210629201412.28306-7-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20210629201412.28306-1-rpearsonhpe@gmail.com>

Add module parameters rxe_must_check_icrc and rxe_must_generat_icrc which
default to 1 and which suppresses checking/generating ICRC if set to 0.
The parameter is displayed in /sys as "check_icrc" or "generate_icrc".

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe.c      | 9 +++++++++
 drivers/infiniband/sw/rxe/rxe.h      | 4 ++++
 drivers/infiniband/sw/rxe/rxe_net.c  | 3 ++-
 drivers/infiniband/sw/rxe/rxe_recv.c | 8 +++++---
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c
index 8e0f9c489cab..08de3ef9f1f2 100644
--- a/drivers/infiniband/sw/rxe/rxe.c
+++ b/drivers/infiniband/sw/rxe/rxe.c
@@ -15,6 +15,15 @@ MODULE_LICENSE("Dual BSD/GPL");
 
 bool rxe_initialized;
 
+/* If set to false these parameters disable checking and/or generating
+ * the packet ICRC
+ */
+bool rxe_must_check_icrc = true;
+module_param_named(check_icrc, rxe_must_check_icrc, bool, 0660);
+
+bool rxe_must_generate_icrc = true;
+module_param_named(generate_icrc, rxe_must_generate_icrc, bool, 0660);
+
 /* free resources for a rxe device all objects created for this device must
  * have been destroyed
  */
diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h
index 1bb3fb618bf5..a5083a924a6f 100644
--- a/drivers/infiniband/sw/rxe/rxe.h
+++ b/drivers/infiniband/sw/rxe/rxe.h
@@ -13,6 +13,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/skbuff.h>
 
 #include <rdma/ib_verbs.h>
@@ -39,6 +40,9 @@
 
 #define RXE_ROCE_V2_SPORT		(0xc000)
 
+extern bool rxe_must_check_icrc;
+extern bool rxe_must_generate_icrc;
+
 extern bool rxe_initialized;
 
 void rxe_set_mtu(struct rxe_dev *rxe, unsigned int dev_mtu);
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 3860281a3a90..4d109e5b33ff 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -434,7 +434,8 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
 		goto drop;
 	}
 
-	rxe_icrc_generate(skb, pkt);
+	if (rxe_must_generate_icrc)
+		rxe_icrc_generate(skb, pkt);
 
 	if (pkt->mask & RXE_LOOPBACK_MASK) {
 		memcpy(SKB_TO_PKT(skb), pkt, sizeof(*pkt));
diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
index 8582b3163e2c..01d425b3991e 100644
--- a/drivers/infiniband/sw/rxe/rxe_recv.c
+++ b/drivers/infiniband/sw/rxe/rxe_recv.c
@@ -382,9 +382,11 @@ void rxe_rcv(struct sk_buff *skb)
 	if (unlikely(err))
 		goto drop;
 
-	err = rxe_icrc_check(skb);
-	if (unlikely(err))
-		goto drop;
+	if (rxe_must_check_icrc) {
+		err = rxe_icrc_check(skb);
+		if (unlikely(err))
+			goto drop;
+	}
 
 	rxe_counter_inc(rxe, RXE_CNT_RCVD_PKTS);
 
-- 
2.30.2


  parent reply	other threads:[~2021-06-29 20:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 20:14 [PATCH 0/7] RDMA/rxe: Cleanup ICRC Bob Pearson
2021-06-29 20:14 ` [PATCH 1/5] RDMA/rxe: Move ICRC checking to a subroutine Bob Pearson
2021-06-29 20:14 ` [PATCH 2/5] RDMA/rxe: Move rxe_xmit_packet " Bob Pearson
2021-06-29 20:14 ` [PATCH 3/5] RDMA/rxe: Move ICRC generation " Bob Pearson
2021-06-29 20:14 ` [PATCH 4/5] RDMA/rxe: Move rxe_crc32 " Bob Pearson
2021-06-29 20:14 ` [PATCH 5/5] RDMA/rxe: Move crc32 init code to rxe_icrc.c Bob Pearson
2021-06-30  4:09   ` Zhu Yanjun
2021-06-30  4:13     ` Pearson, Robert B
2021-07-01  3:38   ` kernel test robot
2021-06-29 20:14 ` Bob Pearson [this message]
2021-06-29 20:14 ` [PATCH 7/7] RDMA/rxe: Extend ICRC to support nonlinear skbs Bob Pearson
2021-06-29 20:16   ` Bob Pearson
2021-06-29 20:17   ` Bob Pearson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210629201412.28306-7-rpearsonhpe@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox