mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
xfrm: Add ESN support for IPSec HW offload
This patch adds ESN support to IPsec device offload. Adding new xfrm device operation to synchronize device ESN. Signed-off-by: Yossef Efraim <[email protected]> Signed-off-by: Shannon Nelson <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
This commit is contained in:
parent
4f7d58517f
commit
50bd870a9e
5 changed files with 27 additions and 2 deletions
|
|
@ -147,8 +147,8 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
|
|||
if (!x->type_offload)
|
||||
return -EINVAL;
|
||||
|
||||
/* We don't yet support UDP encapsulation, TFC padding and ESN. */
|
||||
if (x->encap || x->tfcpad || (x->props.flags & XFRM_STATE_ESN))
|
||||
/* We don't yet support UDP encapsulation and TFC padding. */
|
||||
if (x->encap || x->tfcpad)
|
||||
return -EINVAL;
|
||||
|
||||
dev = dev_get_by_index(net, xuo->ifindex);
|
||||
|
|
@ -178,6 +178,13 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (x->props.flags & XFRM_STATE_ESN &&
|
||||
!dev->xfrmdev_ops->xdo_dev_state_advance_esn) {
|
||||
xso->dev = NULL;
|
||||
dev_put(dev);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
xso->dev = dev;
|
||||
xso->num_exthdrs = 1;
|
||||
xso->flags = xuo->flags;
|
||||
|
|
|
|||
|
|
@ -551,6 +551,8 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq)
|
|||
bitnr = replay_esn->replay_window - (diff - pos);
|
||||
}
|
||||
|
||||
xfrm_dev_state_advance_esn(x);
|
||||
|
||||
nr = bitnr >> 5;
|
||||
bitnr = bitnr & 0x1F;
|
||||
replay_esn->bmp[nr] |= (1U << bitnr);
|
||||
|
|
|
|||
Loading…
Reference in a new issue