diff options
author | Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> | 2015-06-01 21:55:06 +0900 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-01 16:50:52 -0700 |
commit | 66e5133f19e901a044fa5eaeeb6ecff4545839e5 (patch) | |
tree | 02419230bb0e8cf4545acdd7fbee4369d1b76095 /include/linux/if_vlan.h | |
parent | 661b689bbd2e9392c3d9935e791af75ddbc455dc (diff) | |
download | linux-66e5133f19e901a044fa5eaeeb6ecff4545839e5.tar.gz linux-66e5133f19e901a044fa5eaeeb6ecff4545839e5.tar.bz2 linux-66e5133f19e901a044fa5eaeeb6ecff4545839e5.zip |
vlan: Add GRO support for non hardware accelerated vlan
Currently packets with non-hardware-accelerated vlan cannot be handled
by GRO. This causes low performance for 802.1ad and stacked vlan, as their
vlan tags are currently not stripped by hardware.
This patch adds GRO support for non-hardware-accelerated vlan and
improves receive performance of them.
Test Environment:
vlan device (.1Q) on vlan device (.1ad) on ixgbe (82599)
Result:
- Before
$ netperf -t TCP_STREAM -H 192.168.20.2 -l 60
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
87380 16384 16384 60.00 5233.17
Rx side CPU usage:
%usr %sys %irq %soft %idle
0.27 58.03 0.00 41.70 0.00
- After
$ netperf -t TCP_STREAM -H 192.168.20.2 -l 60
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
87380 16384 16384 60.00 7586.85
Rx side CPU usage:
%usr %sys %irq %soft %idle
0.50 25.83 0.00 59.53 14.14
[ Register VLAN offloads with priority 10 -DaveM ]
Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/if_vlan.h')
-rw-r--r-- | include/linux/if_vlan.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index a40d29846ac2..67ce5bd3b56a 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -628,4 +628,24 @@ static inline netdev_features_t vlan_features_check(const struct sk_buff *skb, return features; } +/** + * compare_vlan_header - Compare two vlan headers + * @h1: Pointer to vlan header + * @h2: Pointer to vlan header + * + * Compare two vlan headers, returns 0 if equal. + * + * Please note that alignment of h1 & h2 are only guaranteed to be 16 bits. + */ +static inline unsigned long compare_vlan_header(const struct vlan_hdr *h1, + const struct vlan_hdr *h2) +{ +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) + return *(u32 *)h1 ^ *(u32 *)h2; +#else + return ((__force u32)h1->h_vlan_TCI ^ (__force u32)h2->h_vlan_TCI) | + ((__force u32)h1->h_vlan_encapsulated_proto ^ + (__force u32)h2->h_vlan_encapsulated_proto); +#endif +} #endif /* !(_LINUX_IF_VLAN_H_) */ |