1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 /* Copyright (C) 2018 Netronome Systems, Inc */
3 /* Copyright (C) 2021 Corigine, Inc */
7 #include "../nfp_net.h"
10 void nfp_nfd3_ipsec_tx(struct nfp_nfd3_tx_desc
*txd
, struct sk_buff
*skb
)
12 struct xfrm_state
*x
= xfrm_input_state(skb
);
13 struct xfrm_offload
*xo
= xfrm_offload(skb
);
14 struct iphdr
*iph
= ip_hdr(skb
);
17 if (x
->xso
.dev
&& (x
->xso
.dev
->features
& NETIF_F_HW_ESP_TX_CSUM
)) {
18 txd
->flags
|= NFD3_DESC_TX_CSUM
;
20 if (iph
->version
== 4)
21 txd
->flags
|= NFD3_DESC_TX_IP4_CSUM
;
23 if (x
->props
.mode
== XFRM_MODE_TRANSPORT
)
25 else if (x
->props
.mode
== XFRM_MODE_TUNNEL
)
26 l4_proto
= xo
->inner_ipproto
;
32 txd
->flags
|= NFD3_DESC_TX_UDP_CSUM
;
35 txd
->flags
|= NFD3_DESC_TX_TCP_CSUM
;