ibmveth: Remove condition to recompute TCP header checksum.

[ Upstream commit 51e7a66666 ]

In some OVS environments the TCP pseudo header checksum may need to be
recomputed. Currently this is only done when the interface instance is
configured for "Trunk Mode". We found the issue also occurs in some
Kubernetes environments, these environments do not use "Trunk Mode",
therefor the condition is removed.

Performance tests with this change show only a fractional decrease in
throughput (< 0.2%).

Fixes: 7525de2516 ("ibmveth: Set CHECKSUM_PARTIAL if NULL TCP CSUM.")
Signed-off-by: David Wilder <dwilder@us.ibm.com>
Reviewed-by: Nick Child <nnac123@linux.ibm.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
David Wilder 2023-09-26 16:42:51 -05:00 коммит произвёл Greg Kroah-Hartman
Родитель 5a899e2ce8
Коммит 0c9cf5e880
1 изменённых файлов: 12 добавлений и 13 удалений

Просмотреть файл

@ -1297,24 +1297,23 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,
* the user space for finding a flow. During this process, OVS computes * the user space for finding a flow. During this process, OVS computes
* checksum on the first packet when CHECKSUM_PARTIAL flag is set. * checksum on the first packet when CHECKSUM_PARTIAL flag is set.
* *
* So, re-compute TCP pseudo header checksum when configured for * So, re-compute TCP pseudo header checksum.
* trunk mode.
*/ */
if (iph_proto == IPPROTO_TCP) { if (iph_proto == IPPROTO_TCP) {
struct tcphdr *tcph = (struct tcphdr *)(skb->data + iphlen); struct tcphdr *tcph = (struct tcphdr *)(skb->data + iphlen);
if (tcph->check == 0x0000) { if (tcph->check == 0x0000) {
/* Recompute TCP pseudo header checksum */ /* Recompute TCP pseudo header checksum */
if (adapter->is_active_trunk) { tcphdrlen = skb->len - iphlen;
tcphdrlen = skb->len - iphlen; if (skb_proto == ETH_P_IP)
if (skb_proto == ETH_P_IP) tcph->check =
tcph->check = ~csum_tcpudp_magic(iph->saddr,
~csum_tcpudp_magic(iph->saddr, iph->daddr, tcphdrlen, iph_proto, 0);
iph->daddr, tcphdrlen, iph_proto, 0); else if (skb_proto == ETH_P_IPV6)
else if (skb_proto == ETH_P_IPV6) tcph->check =
tcph->check = ~csum_ipv6_magic(&iph6->saddr,
~csum_ipv6_magic(&iph6->saddr, &iph6->daddr, tcphdrlen, iph_proto, 0);
&iph6->daddr, tcphdrlen, iph_proto, 0);
}
/* Setup SKB fields for checksum offload */ /* Setup SKB fields for checksum offload */
skb_partial_csum_set(skb, iphlen, skb_partial_csum_set(skb, iphlen,
offsetof(struct tcphdr, check)); offsetof(struct tcphdr, check));