aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2011-08-14 15:45:04 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-17 23:06:03 -0400
commit792df22cd0499b4e662d4618b0008fdcfef8b04e (patch)
treeec980bfc5b5bf79b0c171e23656012887d6c3092
parentf1deab502206ab7e4470334b7738383c76e4ddd9 (diff)
rps: Some minor cleanup in get_rps_cpus
Use some variables for clarity and extensibility. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/dev.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index d22ffd722ee3..6578d9483043 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2528,15 +2528,17 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
2528 const struct ipv6hdr *ip6; 2528 const struct ipv6hdr *ip6;
2529 const struct iphdr *ip; 2529 const struct iphdr *ip;
2530 u8 ip_proto; 2530 u8 ip_proto;
2531 u32 addr1, addr2, ihl; 2531 u32 addr1, addr2;
2532 u16 proto;
2532 union { 2533 union {
2533 u32 v32; 2534 u32 v32;
2534 u16 v16[2]; 2535 u16 v16[2];
2535 } ports; 2536 } ports;
2536 2537
2537 nhoff = skb_network_offset(skb); 2538 nhoff = skb_network_offset(skb);
2539 proto = skb->protocol;
2538 2540
2539 switch (skb->protocol) { 2541 switch (proto) {
2540 case __constant_htons(ETH_P_IP): 2542 case __constant_htons(ETH_P_IP):
2541 if (!pskb_may_pull(skb, sizeof(*ip) + nhoff)) 2543 if (!pskb_may_pull(skb, sizeof(*ip) + nhoff))
2542 goto done; 2544 goto done;
@@ -2548,7 +2550,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
2548 ip_proto = ip->protocol; 2550 ip_proto = ip->protocol;
2549 addr1 = (__force u32) ip->saddr; 2551 addr1 = (__force u32) ip->saddr;
2550 addr2 = (__force u32) ip->daddr; 2552 addr2 = (__force u32) ip->daddr;
2551 ihl = ip->ihl; 2553 nhoff += ip->ihl * 4;
2552 break; 2554 break;
2553 case __constant_htons(ETH_P_IPV6): 2555 case __constant_htons(ETH_P_IPV6):
2554 if (!pskb_may_pull(skb, sizeof(*ip6) + nhoff)) 2556 if (!pskb_may_pull(skb, sizeof(*ip6) + nhoff))
@@ -2558,7 +2560,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
2558 ip_proto = ip6->nexthdr; 2560 ip_proto = ip6->nexthdr;
2559 addr1 = (__force u32) ip6->saddr.s6_addr32[3]; 2561 addr1 = (__force u32) ip6->saddr.s6_addr32[3];
2560 addr2 = (__force u32) ip6->daddr.s6_addr32[3]; 2562 addr2 = (__force u32) ip6->daddr.s6_addr32[3];
2561 ihl = (40 >> 2); 2563 nhoff += 40;
2562 break; 2564 break;
2563 default: 2565 default:
2564 goto done; 2566 goto done;
@@ -2567,7 +2569,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
2567 ports.v32 = 0; 2569 ports.v32 = 0;
2568 poff = proto_ports_offset(ip_proto); 2570 poff = proto_ports_offset(ip_proto);
2569 if (poff >= 0) { 2571 if (poff >= 0) {
2570 nhoff += ihl * 4 + poff; 2572 nhoff += poff;
2571 if (pskb_may_pull(skb, nhoff + 4)) { 2573 if (pskb_may_pull(skb, nhoff + 4)) {
2572 ports.v32 = * (__force u32 *) (skb->data + nhoff); 2574 ports.v32 = * (__force u32 *) (skb->data + nhoff);
2573 if (ports.v16[1] < ports.v16[0]) 2575 if (ports.v16[1] < ports.v16[0])