Thread (13 messages) flat view 13 messages, 3 authors, 2014-01-09

Re: [PATCH net-next V3 1/3] net: Add GRO support for UDP encapsulating protocols

From: Or Gerlitz <hidden>
Date: 2014-01-09 06:25:49

On 08/01/2014 23:58, Tom Herbert wrote:
quoted
+static struct sk_buff **udp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
quoted
+{
+       struct list_head *ohead = &udp_offload_base;
+       struct udp_offload *poffload;
+       struct sk_buff *p, **pp = NULL;
+       struct udphdr *uh, *uh2;
+       unsigned int hlen, off;
+       int flush = 1;
+
+       if (NAPI_GRO_CB(skb)->udp_mark ||
+           (!skb->encapsulation && skb->ip_summed != CHECKSUM_COMPLETE))
+               goto out;
+
+       /* mark that this skb passed once through the udp gro layer */
+       NAPI_GRO_CB(skb)->udp_mark = 1;
+
+       off  = skb_gro_offset(skb);
+       hlen = off + sizeof(*uh);
+       uh   = skb_gro_header_fast(skb, off);
+       if (skb_gro_header_hard(skb, hlen)) {
+               uh = skb_gro_header_slow(skb, hlen, off);
+               if (unlikely(!uh))
+                       goto out;
+       }
+
+       rcu_read_lock();
+       list_for_each_entry_rcu(poffload, ohead, list) {
+               if (poffload->port != uh->dest || !poffload->callbacks.gro_receive)
Is gro_receive == NULL ever valid? Maybe we can assert on registration instead of checking on every packet.
I see your point, however, the offload structure contains entries for 
both gro and  gso, asserting on registration could somehow limit the use 
cases, isn't that?

Maybe make this poffload->port == uh->dest and goto "flush = 0". Check below that list end was reached becomes unnecessary.
Sure, will use goto "flush = 0" and if we didn't  go there we'll go to 
out_unlock
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help