All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rohit Maheshwari <rohitm@chelsio.com>
To: kuba@kernel.org, netdev@vger.kernel.org, davem@davemloft.net
Cc: secdev@chelsio.com, Rohit Maheshwari <rohitm@chelsio.com>
Subject: [net v6 03/12] ch_ktls: Update cheksum information
Date: Mon,  9 Nov 2020 16:21:33 +0530	[thread overview]
Message-ID: <20201109105142.15398-4-rohitm@chelsio.com> (raw)
In-Reply-To: <20201109105142.15398-1-rohitm@chelsio.com>

Checksum update was missing in the WR.

Fixes: 429765a149f1 ("chcr: handle partial end part of a record")
Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
---
 .../chelsio/inline_crypto/ch_ktls/chcr_ktls.c     | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
index 447aec7ae954..b7a3e757ee72 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
@@ -959,6 +959,7 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
 	struct iphdr *ip;
 	int credits;
 	u8 buf[150];
+	u64 cntrl1;
 	void *pos;
 
 	iplen = skb_network_header_len(skb);
@@ -997,22 +998,28 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
 			   TXPKT_PF_V(tx_info->adap->pf));
 	cpl->pack = 0;
 	cpl->len = htons(pktlen);
-	/* checksum offload */
-	cpl->ctrl1 = 0;
-
-	pos = cpl + 1;
 
 	memcpy(buf, skb->data, pktlen);
 	if (tx_info->ip_family == AF_INET) {
 		/* we need to correct ip header len */
 		ip = (struct iphdr *)(buf + maclen);
 		ip->tot_len = htons(pktlen - maclen);
+		cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP);
 #if IS_ENABLED(CONFIG_IPV6)
 	} else {
 		ip6 = (struct ipv6hdr *)(buf + maclen);
 		ip6->payload_len = htons(pktlen - maclen - iplen);
+		cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP6);
 #endif
 	}
+
+	cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |
+		  TXPKT_IPHDR_LEN_V(iplen);
+	/* checksum offload */
+	cpl->ctrl1 = cpu_to_be64(cntrl1);
+
+	pos = cpl + 1;
+
 	/* now take care of the tcp header, if fin is not set then clear push
 	 * bit as well, and if fin is set, it will be sent at the last so we
 	 * need to update the tcp sequence number as per the last packet.
-- 
2.18.1


  parent reply	other threads:[~2020-11-09 10:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 10:51 [net v6 00/12] cxgb4/ch_ktls: Fixes in nic tls code Rohit Maheshwari
2020-11-09 10:51 ` [net v6 01/12] cxgb4/ch_ktls: decrypted bit is not enough Rohit Maheshwari
2020-11-09 10:51 ` [net v6 02/12] ch_ktls: Correction in finding correct length Rohit Maheshwari
2020-11-09 10:51 ` Rohit Maheshwari [this message]
2020-11-09 10:51 ` [net v6 04/12] cxgb4/ch_ktls: creating skbs causes panic Rohit Maheshwari
2020-11-09 10:51 ` [net v6 05/12] ch_ktls: Correction in trimmed_len calculation Rohit Maheshwari
2020-11-09 10:51 ` [net v6 06/12] ch_ktls: missing handling of header alone Rohit Maheshwari
2020-11-09 10:51 ` [net v6 07/12] ch_ktls: Correction in middle record handling Rohit Maheshwari
2020-11-09 10:51 ` [net v6 08/12] ch_ktls: packet handling prior to start marker Rohit Maheshwari
2020-11-09 10:51 ` [net v6 09/12] ch_ktls: don't free skb before sending FIN Rohit Maheshwari
2020-11-09 10:51 ` [net v6 10/12] ch_ktls/cxgb4: handle partial tag alone SKBs Rohit Maheshwari
2020-11-09 10:51 ` [net v6 11/12] ch_ktls: tcb update fails sometimes Rohit Maheshwari
2020-11-09 10:51 ` [net v6 12/12] ch_ktls: stop the txq if reaches threshold Rohit Maheshwari
2020-11-12  0:37 ` [net v6 00/12] cxgb4/ch_ktls: Fixes in nic tls code Jakub Kicinski

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=20201109105142.15398-4-rohitm@chelsio.com \
    --to=rohitm@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=secdev@chelsio.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.