diff options
author | Tom Herbert <therbert@google.com> | 2015-01-12 20:00:37 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-14 15:20:04 -0500 |
commit | a2b12f3c7ac1ea43ae646db74faf0b56c2bba563 (patch) | |
tree | 4d2e38b8b963db38a3cff21ec16cf2e4e16a27ed /net/ipv4 | |
parent | d823ab68fbb0fa504a2490bd499ac921bdf497d8 (diff) |
udp: pass udp_offload struct to UDP gro callbacks
This patch introduces udp_offload_callbacks which has the same
GRO functions (but not a GSO function) as offload_callbacks,
except there is an argument to a udp_offload struct passed to
gro_receive and gro_complete functions. This additional argument
can be used to retrieve the per port structure of the encapsulation
for use in gro processing (mostly by doing container_of on the
structure).
Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/fou.c | 12 | ||||
-rw-r--r-- | net/ipv4/geneve.c | 6 | ||||
-rw-r--r-- | net/ipv4/udp_offload.c | 7 |
3 files changed, 17 insertions, 8 deletions
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index 2197c36f722f..3bc0cf07661c 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c | |||
@@ -174,7 +174,8 @@ drop: | |||
174 | } | 174 | } |
175 | 175 | ||
176 | static struct sk_buff **fou_gro_receive(struct sk_buff **head, | 176 | static struct sk_buff **fou_gro_receive(struct sk_buff **head, |
177 | struct sk_buff *skb) | 177 | struct sk_buff *skb, |
178 | struct udp_offload *uoff) | ||
178 | { | 179 | { |
179 | const struct net_offload *ops; | 180 | const struct net_offload *ops; |
180 | struct sk_buff **pp = NULL; | 181 | struct sk_buff **pp = NULL; |
@@ -195,7 +196,8 @@ out_unlock: | |||
195 | return pp; | 196 | return pp; |
196 | } | 197 | } |
197 | 198 | ||
198 | static int fou_gro_complete(struct sk_buff *skb, int nhoff) | 199 | static int fou_gro_complete(struct sk_buff *skb, int nhoff, |
200 | struct udp_offload *uoff) | ||
199 | { | 201 | { |
200 | const struct net_offload *ops; | 202 | const struct net_offload *ops; |
201 | u8 proto = NAPI_GRO_CB(skb)->proto; | 203 | u8 proto = NAPI_GRO_CB(skb)->proto; |
@@ -254,7 +256,8 @@ static struct guehdr *gue_gro_remcsum(struct sk_buff *skb, unsigned int off, | |||
254 | } | 256 | } |
255 | 257 | ||
256 | static struct sk_buff **gue_gro_receive(struct sk_buff **head, | 258 | static struct sk_buff **gue_gro_receive(struct sk_buff **head, |
257 | struct sk_buff *skb) | 259 | struct sk_buff *skb, |
260 | struct udp_offload *uoff) | ||
258 | { | 261 | { |
259 | const struct net_offload **offloads; | 262 | const struct net_offload **offloads; |
260 | const struct net_offload *ops; | 263 | const struct net_offload *ops; |
@@ -360,7 +363,8 @@ out: | |||
360 | return pp; | 363 | return pp; |
361 | } | 364 | } |
362 | 365 | ||
363 | static int gue_gro_complete(struct sk_buff *skb, int nhoff) | 366 | static int gue_gro_complete(struct sk_buff *skb, int nhoff, |
367 | struct udp_offload *uoff) | ||
364 | { | 368 | { |
365 | const struct net_offload **offloads; | 369 | const struct net_offload **offloads; |
366 | struct guehdr *guehdr = (struct guehdr *)(skb->data + nhoff); | 370 | struct guehdr *guehdr = (struct guehdr *)(skb->data + nhoff); |
diff --git a/net/ipv4/geneve.c b/net/ipv4/geneve.c index 23744c7a9718..9568594ca2f1 100644 --- a/net/ipv4/geneve.c +++ b/net/ipv4/geneve.c | |||
@@ -147,7 +147,8 @@ static int geneve_hlen(struct genevehdr *gh) | |||
147 | } | 147 | } |
148 | 148 | ||
149 | static struct sk_buff **geneve_gro_receive(struct sk_buff **head, | 149 | static struct sk_buff **geneve_gro_receive(struct sk_buff **head, |
150 | struct sk_buff *skb) | 150 | struct sk_buff *skb, |
151 | struct udp_offload *uoff) | ||
151 | { | 152 | { |
152 | struct sk_buff *p, **pp = NULL; | 153 | struct sk_buff *p, **pp = NULL; |
153 | struct genevehdr *gh, *gh2; | 154 | struct genevehdr *gh, *gh2; |
@@ -211,7 +212,8 @@ out: | |||
211 | return pp; | 212 | return pp; |
212 | } | 213 | } |
213 | 214 | ||
214 | static int geneve_gro_complete(struct sk_buff *skb, int nhoff) | 215 | static int geneve_gro_complete(struct sk_buff *skb, int nhoff, |
216 | struct udp_offload *uoff) | ||
215 | { | 217 | { |
216 | struct genevehdr *gh; | 218 | struct genevehdr *gh; |
217 | struct packet_offload *ptype; | 219 | struct packet_offload *ptype; |
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index d3e537ef6b7f..d10f6f4ead27 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c | |||
@@ -339,7 +339,8 @@ unflush: | |||
339 | skb_gro_pull(skb, sizeof(struct udphdr)); /* pull encapsulating udp header */ | 339 | skb_gro_pull(skb, sizeof(struct udphdr)); /* pull encapsulating udp header */ |
340 | skb_gro_postpull_rcsum(skb, uh, sizeof(struct udphdr)); | 340 | skb_gro_postpull_rcsum(skb, uh, sizeof(struct udphdr)); |
341 | NAPI_GRO_CB(skb)->proto = uo_priv->offload->ipproto; | 341 | NAPI_GRO_CB(skb)->proto = uo_priv->offload->ipproto; |
342 | pp = uo_priv->offload->callbacks.gro_receive(head, skb); | 342 | pp = uo_priv->offload->callbacks.gro_receive(head, skb, |
343 | uo_priv->offload); | ||
343 | 344 | ||
344 | out_unlock: | 345 | out_unlock: |
345 | rcu_read_unlock(); | 346 | rcu_read_unlock(); |
@@ -395,7 +396,9 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff) | |||
395 | 396 | ||
396 | if (uo_priv != NULL) { | 397 | if (uo_priv != NULL) { |
397 | NAPI_GRO_CB(skb)->proto = uo_priv->offload->ipproto; | 398 | NAPI_GRO_CB(skb)->proto = uo_priv->offload->ipproto; |
398 | err = uo_priv->offload->callbacks.gro_complete(skb, nhoff + sizeof(struct udphdr)); | 399 | err = uo_priv->offload->callbacks.gro_complete(skb, |
400 | nhoff + sizeof(struct udphdr), | ||
401 | uo_priv->offload); | ||
399 | } | 402 | } |
400 | 403 | ||
401 | rcu_read_unlock(); | 404 | rcu_read_unlock(); |