Thread (34 messages) flat view 34 messages, 6 authors, 2014-01-09

Re: [PATCH net-next V2 3/3] net: Add GRO support for vxlan traffic

From: Or Gerlitz <hidden>
Date: 2014-01-07 19:43:07

On Tue, Jan 7, 2014 at 8:08 PM, Tom Herbert [off-list ref] wrote:
On Tue, Jan 7, 2014 at 7:29 AM, Or Gerlitz [off-list ref] wrote:
quoted
+static struct sk_buff **vxlan_gro_receive(struct sk_buff **head, struct sk_buff *skb)
+{
+       struct sk_buff *p, **pp = NULL;
+       struct vxlanhdr *vh, *vh2;
+       struct ethhdr *eh;
+       unsigned int hlen, off, off_eth;
+       const struct packet_offload *ptype;
+       __be16 type;
+       int flush = 1;
+
+       off  = skb_gro_offset(skb);
+       hlen = off + sizeof(*vh);
+       vh   = skb_gro_header_fast(skb, off);
+       if (skb_gro_header_hard(skb, hlen)) {
+               vh = skb_gro_header_slow(skb, hlen, off);
+               if (unlikely(!vh))
+                       goto out;
+       }
+
+       flush = 0;
+
+       for (p = *head; p; p = p->next) {
+               if (!NAPI_GRO_CB(p)->same_flow)
+                       continue;
+
+               vh2 = (struct vxlanhdr   *)(p->data + off);
+               if (vh->vx_vni ^ vh2->vx_vni) {
Why ^ instead of != ?
The XOR approach is very popular in the GRO stack, e.g see the IPv4 chain
of inet_gro_receive() && tcp_gro_receive(), I guess this might relates
to more efficient assembly code for ^ vs. != and/or the fast/elegant
transitive nature of that operator
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help