Commit 1995876a authored by Steffen Klassert's avatar Steffen Klassert

xfrm: Add a dummy network device for napi.

This patch adds a dummy network device so that we can
use gro_cells for IPsec GRO. With this, we handle IPsec
GRO with no impact on the generic networking code.
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent f991bb9d
...@@ -21,6 +21,9 @@ static struct kmem_cache *secpath_cachep __read_mostly; ...@@ -21,6 +21,9 @@ static struct kmem_cache *secpath_cachep __read_mostly;
static DEFINE_SPINLOCK(xfrm_input_afinfo_lock); static DEFINE_SPINLOCK(xfrm_input_afinfo_lock);
static struct xfrm_input_afinfo __rcu *xfrm_input_afinfo[NPROTO]; static struct xfrm_input_afinfo __rcu *xfrm_input_afinfo[NPROTO];
static struct gro_cells gro_cells;
static struct net_device xfrm_napi_dev;
int xfrm_input_register_afinfo(struct xfrm_input_afinfo *afinfo) int xfrm_input_register_afinfo(struct xfrm_input_afinfo *afinfo)
{ {
int err = 0; int err = 0;
...@@ -371,7 +374,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) ...@@ -371,7 +374,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
if (decaps) { if (decaps) {
skb_dst_drop(skb); skb_dst_drop(skb);
netif_rx(skb); gro_cells_receive(&gro_cells, skb);
return 0; return 0;
} else { } else {
return x->inner_mode->afinfo->transport_finish(skb, async); return x->inner_mode->afinfo->transport_finish(skb, async);
...@@ -394,6 +397,13 @@ EXPORT_SYMBOL(xfrm_input_resume); ...@@ -394,6 +397,13 @@ EXPORT_SYMBOL(xfrm_input_resume);
void __init xfrm_input_init(void) void __init xfrm_input_init(void)
{ {
int err;
init_dummy_netdev(&xfrm_napi_dev);
err = gro_cells_init(&gro_cells, &xfrm_napi_dev);
if (err)
gro_cells.cells = NULL;
secpath_cachep = kmem_cache_create("secpath_cache", secpath_cachep = kmem_cache_create("secpath_cache",
sizeof(struct sec_path), sizeof(struct sec_path),
0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment