Skip to content

Commit 32188be

Browse files
Bharat Bhushandavem330
authored andcommitted
cn10k-ipsec: Allow ipsec crypto offload for skb with SA
Allow to use hardware offload for outbound ipsec crypto mode if security association (SA) is set for a given skb. Signed-off-by: Bharat Bhushan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6a77a15 commit 32188be

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,24 @@ static void cn10k_ipsec_del_state(struct xfrm_state *x)
746746
queue_work(pf->ipsec.sa_workq, &pf->ipsec.sa_work);
747747
}
748748

749+
static bool cn10k_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
750+
{
751+
if (x->props.family == AF_INET) {
752+
/* Offload with IPv4 options is not supported yet */
753+
if (ip_hdr(skb)->ihl > 5)
754+
return false;
755+
} else {
756+
/* Offload with IPv6 extension headers is not support yet */
757+
if (ipv6_ext_hdr(ipv6_hdr(skb)->nexthdr))
758+
return false;
759+
}
760+
return true;
761+
}
762+
749763
static const struct xfrmdev_ops cn10k_ipsec_xfrmdev_ops = {
750764
.xdo_dev_state_add = cn10k_ipsec_add_state,
751765
.xdo_dev_state_delete = cn10k_ipsec_del_state,
766+
.xdo_dev_offload_ok = cn10k_ipsec_offload_ok,
752767
};
753768

754769
static void cn10k_ipsec_sa_wq_handler(struct work_struct *work)

0 commit comments

Comments
 (0)