When the extension to be added is already present, the only
skb field we may need to update is 'extensions': we can reorder
the code and avoid a branch.
v1 -> v2:
- be sure to flag the newly added extension as active
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
if (!new)
return NULL;
- if (__skb_ext_exist(new, id)) {
- if (old != new)
- skb->extensions = new;
+ if (__skb_ext_exist(new, id))
goto set_active;
- }
newoff = new->chunks;
} else {
newlen = newoff + skb_ext_type_len[id];
new->chunks = newlen;
new->offset[id] = newoff;
- skb->extensions = new;
set_active:
+ skb->extensions = new;
skb->active_extensions |= 1 << id;
return skb_ext_get_ptr(new, id);
}