linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gatis Peisenieks <gatis@mikrotik.com>
To: chris.snook@gmail.com, davem@davemloft.net, kuba@kernel.org,
	hkallweit1@gmail.com, jesse.brandeburg@intel.com,
	dchickles@marvell.com, tully@mikrotik.com,
	eric.dumazet@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Gatis Peisenieks <gatis@mikrotik.com>
Subject: [PATCH net-next 4/4] atl1c: enable rx csum offload on Mikrotik 10/25G NIC
Date: Mon, 19 Apr 2021 17:34:49 +0300	[thread overview]
Message-ID: <20210419143449.751852-5-gatis@mikrotik.com> (raw)
In-Reply-To: <20210419143449.751852-1-gatis@mikrotik.com>

Mikrotik 10/25G NIC supports hw checksum verification on rx for
IP/IPv6 + TCP/UDP packets. HW checksum offload helps reduce host
cpu load.

This enables the csum offload specifically for Mikrotik 10/25G NIC
as other HW supported by the driver is known to have problems with it.

TCP iperf3 to Threadripper 3960X with NIC improved 16.5 -> 20.0 Gbps
with mtu=1500.

Signed-off-by: Gatis Peisenieks <gatis@mikrotik.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c.h      | 2 ++
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h b/drivers/net/ethernet/atheros/atl1c/atl1c.h
index 3fda7eb3bd69..9d70cb7544f1 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h
@@ -241,6 +241,8 @@ struct atl1c_tpd_ext_desc {
 #define RRS_PACKET_PROT_IS_IPV6_ONLY(word) \
 	((((word) >> RRS_PROT_ID_SHIFT) & RRS_PROT_ID_MASK) == 6)
 
+#define RRS_MT_PROT_ID_TCPUDP	BIT(19)
+
 struct atl1c_recv_ret_status {
 	__le32  word0;
 	__le32	rss_hash;
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 920e408ce7b4..9795657d6f58 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1670,6 +1670,11 @@ static irqreturn_t atl1c_intr(int irq, void *data)
 static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter,
 		  struct sk_buff *skb, struct atl1c_recv_ret_status *prrs)
 {
+	if (adapter->hw.nic_type == athr_mt) {
+		if (prrs->word3 & RRS_MT_PROT_ID_TCPUDP)
+			skb->ip_summed = CHECKSUM_UNNECESSARY;
+		return;
+	}
 	/*
 	 * The pid field in RRS in not correct sometimes, so we
 	 * cannot figure out if the packet is fragmented or not,
-- 
2.31.1


  parent reply	other threads:[~2021-04-19 14:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 14:34 [PATCH net-next 0/4] atl1c: support for Mikrotik 10/25G NIC features Gatis Peisenieks
2021-04-19 14:34 ` [PATCH net-next 1/4] atl1c: show correct link speed on Mikrotik 10/25G NIC Gatis Peisenieks
2021-04-19 14:34 ` [PATCH net-next 2/4] atl1c: improve performance by avoiding unnecessary pcie writes on xmit Gatis Peisenieks
2021-04-19 14:34 ` [PATCH net-next 3/4] atl1c: adjust max mtu according to Mikrotik 10/25G NIC ability Gatis Peisenieks
2021-04-19 14:34 ` Gatis Peisenieks [this message]
2021-05-11 19:05 [PATCH net-next 0/4] atl1c: support for Mikrotik 10/25G NIC features Gatis Peisenieks
2021-05-11 19:05 ` [PATCH net-next 4/4] atl1c: enable rx csum offload on Mikrotik 10/25G NIC Gatis Peisenieks

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=20210419143449.751852-5-gatis@mikrotik.com \
    --to=gatis@mikrotik.com \
    --cc=chris.snook@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dchickles@marvell.com \
    --cc=eric.dumazet@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tully@mikrotik.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;
as well as URLs for NNTP newsgroup(s).