Skip to content

Commit 86716b5

Browse files
rmchelsiokuba-moo
authored andcommitted
ch_ktls: Update cheksum information
Checksum update was missing in the WR. Fixes: 429765a ("chcr: handle partial end part of a record") Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent b1b5cb1 commit 86716b5

File tree

1 file changed

+11
-4
lines changed
  • drivers/net/ethernet/chelsio/inline_crypto/ch_ktls

1 file changed

+11
-4
lines changed

drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c

+11-4
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
959959
struct iphdr *ip;
960960
int credits;
961961
u8 buf[150];
962+
u64 cntrl1;
962963
void *pos;
963964

964965
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,
997998
TXPKT_PF_V(tx_info->adap->pf));
998999
cpl->pack = 0;
9991000
cpl->len = htons(pktlen);
1000-
/* checksum offload */
1001-
cpl->ctrl1 = 0;
1002-
1003-
pos = cpl + 1;
10041001

10051002
memcpy(buf, skb->data, pktlen);
10061003
if (tx_info->ip_family == AF_INET) {
10071004
/* we need to correct ip header len */
10081005
ip = (struct iphdr *)(buf + maclen);
10091006
ip->tot_len = htons(pktlen - maclen);
1007+
cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP);
10101008
#if IS_ENABLED(CONFIG_IPV6)
10111009
} else {
10121010
ip6 = (struct ipv6hdr *)(buf + maclen);
10131011
ip6->payload_len = htons(pktlen - maclen - iplen);
1012+
cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP6);
10141013
#endif
10151014
}
1015+
1016+
cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |
1017+
TXPKT_IPHDR_LEN_V(iplen);
1018+
/* checksum offload */
1019+
cpl->ctrl1 = cpu_to_be64(cntrl1);
1020+
1021+
pos = cpl + 1;
1022+
10161023
/* now take care of the tcp header, if fin is not set then clear push
10171024
* bit as well, and if fin is set, it will be sent at the last so we
10181025
* need to update the tcp sequence number as per the last packet.

0 commit comments

Comments
 (0)