1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 /* Copyright (C) 2023 Corigine, Inc */
3 
4 #include <net/xfrm.h>
5 
6 #include "../nfp_net.h"
7 #include "nfdk.h"
8 
9 u64 nfp_nfdk_ipsec_tx(u64 flags, struct sk_buff *skb)
10 {
11 	struct xfrm_state *x = xfrm_input_state(skb);
12 	struct iphdr *iph = ip_hdr(skb);
13 
14 	if (x->xso.dev && (x->xso.dev->features & NETIF_F_HW_ESP_TX_CSUM)) {
15 		if (iph->version == 4)
16 			flags |= NFDK_DESC_TX_L3_CSUM;
17 		flags |= NFDK_DESC_TX_L4_CSUM;
18 	}
19 
20 	return flags;
21 }
22