mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
xfrm: prefer secpath_set over secpath_dup
secpath_set is a wrapper for secpath_dup that will not perform an allocation if the secpath attached to the skb has a reference count of one, i.e., it doesn't need to be COW'ed. Also, secpath_dup doesn't attach the secpath to the skb, it leaves this to the caller. Use secpath_set in places that immediately assign the return value to skb. This allows to remove skb->sp without touching these spots again. secpath_dup can eventually be removed in followup patch. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a053c86649
commit
a84e3f5333
5 changed files with 19 additions and 17 deletions
|
@ -1161,6 +1161,7 @@ void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring,
|
|||
struct xfrm_state *xs = NULL;
|
||||
struct ipv6hdr *ip6 = NULL;
|
||||
struct iphdr *ip4 = NULL;
|
||||
struct sec_path *sp;
|
||||
void *daddr;
|
||||
__be32 spi;
|
||||
u8 *c_hdr;
|
||||
|
@ -1200,12 +1201,12 @@ void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring,
|
|||
if (unlikely(!xs))
|
||||
return;
|
||||
|
||||
skb->sp = secpath_dup(skb->sp);
|
||||
if (unlikely(!skb->sp))
|
||||
sp = secpath_set(skb);
|
||||
if (unlikely(!sp))
|
||||
return;
|
||||
|
||||
skb->sp->xvec[skb->sp->len++] = xs;
|
||||
skb->sp->olen++;
|
||||
sp->xvec[sp->len++] = xs;
|
||||
sp->olen++;
|
||||
xo = xfrm_offload(skb);
|
||||
xo->flags = CRYPTO_DONE;
|
||||
xo->status = CRYPTO_SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue