mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-05 20:30:41 +00:00

The csum flag of IPsec packet are set repeatedly. Therefore, the csum
flag set of IPsec and non-IPsec packet need to be distinguished.
As the ipv6 header does not have a csum field, so l3-csum flag is not
required to be set for ipv6 case.
Fixes: 436396f26d
("nfp: support IPsec offloading for NFP3800")
Signed-off-by: Huanhuan Wang <huanhuan.wang@corigine.com>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
22 lines
486 B
C
22 lines
486 B
C
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
|
/* Copyright (C) 2023 Corigine, Inc */
|
|
|
|
#include <net/xfrm.h>
|
|
|
|
#include "../nfp_net.h"
|
|
#include "nfdk.h"
|
|
|
|
u64 nfp_nfdk_ipsec_tx(u64 flags, struct sk_buff *skb)
|
|
{
|
|
struct xfrm_state *x = xfrm_input_state(skb);
|
|
struct iphdr *iph = ip_hdr(skb);
|
|
|
|
if (x->xso.dev && (x->xso.dev->features & NETIF_F_HW_ESP_TX_CSUM)) {
|
|
if (iph->version == 4)
|
|
flags |= NFDK_DESC_TX_L3_CSUM;
|
|
flags |= NFDK_DESC_TX_L4_CSUM;
|
|
}
|
|
|
|
return flags;
|
|
}
|