Netdev List
 help / color / mirror / Atom feed
* Re: [Bugme-new] [Bug 30462] New: High cpu usage when someone sends many ipv6 udp packages
From: David Miller @ 2011-03-05  1:21 UTC (permalink / raw)
  To: akpm; +Cc: netdev, bugzilla-daemon, bugme-daemon, ernstp
In-Reply-To: <20110304171506.0e27cde1.akpm@linux-foundation.org>

From: Andrew Morton <akpm@linux-foundation.org>
Date: Fri, 4 Mar 2011 17:15:06 -0800

>> The following ipv6 related changes were introduced between -rc2 and -rc3 that I
>> can see. The "Revert 'administrative down' address handling changes." looked
>> big...
>>       ipv6: Always clone offlink routes.
>>       ipv6: Revert 'administrative down' address handling changes.

Can we narrow it down to which of those two changes introduced the
regression?

We have another issue, still open, which is caused by the first
change, so maybe try reverting that one first.

Thanks.

^ permalink raw reply

* Re: FYI: tftp-hpa breaks when used on secondary ip addresses
From: H. Peter Anvin @ 2011-03-05  1:31 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: netdev, Joel Sing, David Miller
In-Reply-To: <m1sjv2qt68.fsf@fess.ebiederm.org>

On 03/04/2011 04:58 PM, Eric W. Biederman wrote:
> 
> Which if fails now if you happen to be running tftp-hpa on a secondary
> ip address on the same subnet as your first ip.  Because pref_source
> in the routing table points at the first ip.
> 
> The change in kernel behavior appears to be from the commit below to
> honor the preferred source address in local connections.
> 

If this is done for all local connections (as opposed to the ones that
have been configured explicitly by the administrator to behave that
way), that's a massive lossage.  Not only does a large number of
applications use this trick to determine if an address is local (e.g.
allowing bypass) -- it is pretty much the only portable way to do it --
but it would cause applications which expect to get a reply back from
the same address they sent a request to to completely fall on their face.

tftp-hpa needs this information in order to handle clients that send
their initial request to a broadcast (or multicast) address.

> This all seems very fuzzy to me and mostly this appears to be a bug in
> tftp-hpa but since I tracked it down I figured I would let everyone
> know what happened.

This seems like a broken change to me, or at the very least having
seriously unintended consequences.

	-hpa

^ permalink raw reply

* Re: bonding can't change to another slave if you ifdown the active slave
From: Andy Gospodarek @ 2011-03-05  2:53 UTC (permalink / raw)
  To: Weiping Pan; +Cc: netdev, bonding-devel, Linda Wang
In-Reply-To: <4D704B35.20700@gmail.com>

On Fri, Mar 04, 2011 at 10:15:17AM +0800, Weiping Pan wrote:
> Hi,
>
> I'm doing some Linux bonding driver test, and I find a problem in
> balance-rr mode.
> That's it can't change to another slave if you ifdown the active slave.
> Any comments are warmly welcomed!
>
> regards
> Weiping Pan
>
> My host is Fedora 14, and I install VirtualBox (4.0.2), and enable 4
> nics for the guest system.

Does this mean you are passing 4 NICs from your host to your guest
(maybe via direct pci-device assignment to the guest) or are you
creating 4 virtual devices on the host that are in a bridge group on the
host?

[...]
> [root@localhost ~]# ifconfig eth7 down

This is not a great way to test link failure with bonding.  The best way
is to actually pull the cable so the interface is truly down.

> [root@localhost ~]# dmesg
> [  304.496463] bonding: Ethernet Channel Bonding Driver: v3.6.0
> (September 26, 2009)
> [  304.496468] bonding: MII link monitoring set to 100 ms
> [  353.527680] ADDRCONF(NETDEV_UP): bond0: link is not ready
> [  355.321626] e1000: eth7 NIC Link is Up 1000 Mbps Full Duplex, Flow
> Control: RX
> [  355.322250] bonding: bond0: enslaving eth7 as an active interface
> with an up link.
> [  355.323503] ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
> [  365.394052] bond0: no IPv6 routers present
> [  510.913797] e1000: eth8 NIC Link is Up 1000 Mbps Full Duplex, Flow
> Control: RX
> [  510.917312] bonding: bond0: enslaving eth8 as an active interface
> with an up link.
> [  592.208534] bonding: bond0: link status definitely down for interface
> eth7, disabling it

I suspect I know, but what does /proc/net/bonding/bond0 look like?

[...]
> And meanwhile,
> [root@localhost ~]# tcpdump -i bond0 -p arp
> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
> listening on bond0, link-type EN10MB (Ethernet), capture size 65535 bytes
> 02:46:56.983092 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:46:57.984040 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:46:58.988442 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:00.987340 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:01.988136 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:02.990033 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:04.985086 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:05.992368 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:06.996727 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:17.231106 ARP, Request who-has dhcp-65-32.nay.redhat.com tell
> dhcp-65-180.nay.redhat.com, length 46
> ^C
> 10 packets captured
> 10 packets received by filter
> 0 packets dropped by kernel
>
>

What does a tcpdump on eth0 look like?  I'm curious if these arp
requests make it there or if the responses are the frames being dropped
(possibly by the connected bridge/switch).

^ permalink raw reply

* Lacking to initialize "IP6CB(skb)->nhoff" for ipv6 transmission ?
From: Eduardo Panisset @ 2011-03-05  3:59 UTC (permalink / raw)
  To: netdev

Hi,

Im using iptables for marking outgoing packets and then divert them to
specific routing tables.
Whenever a flow matches a rule into mangle table it is marked properly
and reaches over the function ip6_route_me_harder.
That function ends up calling xfrm_decode_session and in particular
_decode_session6 for v6 flows.
The latter uses "IP6CB(skb)->nhoff" for locating nextheader value but
on my debugs it was presenting a weird value (96) instead of the
expected (6), since it was a TCP flow.
So I made the decision of initializing "IP6CB(skb)->nhoff" (with the
value offset(struct ipv6hdr, nexthdr) ) in "ip6_xmit" function and
then the (6) started to be shown and the (96) value did not appeared
anymore.
Is this proceeding correct ? (and then that would be a kernel bug ?)

Rgds,
Eduardo Panisset.

^ permalink raw reply

* Re: FYI: tftp-hpa breaks when used on secondary ip addresses
From: David Miller @ 2011-03-05  4:58 UTC (permalink / raw)
  To: hpa; +Cc: ebiederm, netdev, jsing
In-Reply-To: <4D719254.8000903@zytor.com>

From: "H. Peter Anvin" <hpa@zytor.com>
Date: Fri, 04 Mar 2011 17:31:00 -0800

> If this is done for all local connections (as opposed to the ones that
> have been configured explicitly by the administrator to behave that
> way), that's a massive lossage.  Not only does a large number of
> applications use this trick to determine if an address is local (e.g.
> allowing bypass) -- it is pretty much the only portable way to do it --
> but it would cause applications which expect to get a reply back from
> the same address they sent a request to to completely fall on their face.

Actually this is what SOL_IP, IP_PKTINFO, was created for.  Even glibc
uses it.

^ permalink raw reply

* [PATCH] ipv4: Get peer more cheaply in rt_init_metrics().
From: David Miller @ 2011-03-05  5:26 UTC (permalink / raw)
  To: netdev


We know this is a new route object, so doing atomics and
stuff makes no sense at all.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/route.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6c87403..9794a2c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1759,9 +1759,9 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
 	if (rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)
 		create = 1;
 
-	rt_bind_peer(rt, create);
-	peer = rt->peer;
+	rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create);
 	if (peer) {
+		rt->rt_peer_genid = rt_peer_genid();
 		if (inet_metrics_new(peer))
 			memcpy(peer->metrics, fi->fib_metrics,
 			       sizeof(u32) * RTAX_MAX);
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH] ipv4: Use passed-in protocol in ip_route_newports().
From: David Miller @ 2011-03-05  5:35 UTC (permalink / raw)
  To: netdev


Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/route.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/net/route.h b/include/net/route.h
index 60daf74..8905d90 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -217,7 +217,7 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
 				    .fl4_dst = rt->fl.fl4_dst,
 				    .fl4_src = rt->fl.fl4_src,
 				    .fl4_tos = rt->fl.fl4_tos,
-				    .proto = rt->fl.proto,
+				    .proto = protocol,
 				    .fl_ip_sport = sport,
 				    .fl_ip_dport = dport };
 
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH] ipv4: Set rt->rt_iif more sanely on output routes.
From: David Miller @ 2011-03-05  5:36 UTC (permalink / raw)
  To: netdev


rt->rt_iif is only ever inspected on input routes, for example DCCP
uses this to populate a route lookup flow key when generating replies
to another packet.

Therefore, setting it to anything other than zero on output routes
makes no sense.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/route.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 9794a2c..602473c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2381,7 +2381,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
 	rth->fl.mark    = oldflp->mark;
 	rth->rt_dst	= fl->fl4_dst;
 	rth->rt_src	= fl->fl4_src;
-	rth->rt_iif	= oldflp->oif ? : dev_out->ifindex;
+	rth->rt_iif	= 0;
 	/* get references to the devices that are to be hold by the routing
 	   cache entry */
 	rth->dst.dev	= dev_out;
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH] ipv4: Remove flowi from struct rtable.
From: David Miller @ 2011-03-05  6:12 UTC (permalink / raw)
  To: netdev


The only necessary parts are the src/dst addresses, the
interface indexes, the TOS, and the mark.

The rest is unnecessary bloat, which amounts to nearly
50 bytes on 64-bit.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/route.h     |   22 ++++---
 net/ipv4/icmp.c         |    2 +-
 net/ipv4/ipmr.c         |   52 +++++++++++++----
 net/ipv4/route.c        |  153 +++++++++++++++++++++++++---------------------
 net/ipv4/xfrm4_policy.c |    7 ++-
 net/sched/cls_route.c   |    2 +-
 net/sched/em_meta.c     |    2 +-
 7 files changed, 146 insertions(+), 94 deletions(-)

diff --git a/include/net/route.h b/include/net/route.h
index 8905d90..9257f5f 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -53,16 +53,20 @@ struct fib_info;
 struct rtable {
 	struct dst_entry	dst;
 
-	/* Cache lookup keys */
-	struct flowi		fl;
+	/* Lookup key. */
+	__be32			rt_key_dst;
+	__be32			rt_key_src;
 
 	int			rt_genid;
 	unsigned		rt_flags;
 	__u16			rt_type;
+	__u8			rt_tos;
 
 	__be32			rt_dst;	/* Path destination	*/
 	__be32			rt_src;	/* Path source		*/
 	int			rt_iif;
+	int			rt_oif;
+	__u32			rt_mark;
 
 	/* Info on neighbour */
 	__be32			rt_gateway;
@@ -76,12 +80,12 @@ struct rtable {
 
 static inline bool rt_is_input_route(struct rtable *rt)
 {
-	return rt->fl.iif != 0;
+	return rt->rt_iif != 0;
 }
 
 static inline bool rt_is_output_route(struct rtable *rt)
 {
-	return rt->fl.iif == 0;
+	return rt->rt_iif == 0;
 }
 
 struct ip_rt_acct {
@@ -212,11 +216,11 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
 					       __be16 dport, struct sock *sk)
 {
 	if (sport != orig_sport || dport != orig_dport) {
-		struct flowi fl = { .oif = rt->fl.oif,
-				    .mark = rt->fl.mark,
-				    .fl4_dst = rt->fl.fl4_dst,
-				    .fl4_src = rt->fl.fl4_src,
-				    .fl4_tos = rt->fl.fl4_tos,
+		struct flowi fl = { .oif = rt->rt_oif,
+				    .mark = rt->rt_mark,
+				    .fl4_dst = rt->rt_key_dst,
+				    .fl4_src = rt->rt_key_src,
+				    .fl4_tos = rt->rt_tos,
 				    .proto = protocol,
 				    .fl_ip_sport = sport,
 				    .fl_ip_dport = dport };
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 994a785..1771ce6 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -563,7 +563,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
 		rcu_read_lock();
 		if (rt_is_input_route(rt) &&
 		    net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr)
-			dev = dev_get_by_index_rcu(net, rt->fl.iif);
+			dev = dev_get_by_index_rcu(net, rt->rt_iif);
 
 		if (dev)
 			saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK);
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 26ca2f2..9d5f634 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1813,12 +1813,22 @@ int ip_mr_input(struct sk_buff *skb)
 	if (IPCB(skb)->flags & IPSKB_FORWARDED)
 		goto dont_forward;
 
-	err = ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt);
-	if (err < 0) {
-		kfree_skb(skb);
-		return err;
+	{
+		struct rtable *rt = skb_rtable(skb);
+		struct flowi fl = {
+			.fl4_dst = rt->rt_key_dst,
+			.fl4_src = rt->rt_key_src,
+			.fl4_tos = rt->rt_tos,
+			.oif = rt->rt_oif,
+			.iif = rt->rt_iif,
+			.mark = rt->rt_mark,
+		};
+		err = ipmr_fib_lookup(net, &fl, &mrt);
+		if (err < 0) {
+			kfree_skb(skb);
+			return err;
+		}
 	}
-
 	if (!local) {
 		if (IPCB(skb)->opt.router_alert) {
 			if (ip_call_ra_chain(skb))
@@ -1946,9 +1956,19 @@ int pim_rcv_v1(struct sk_buff *skb)
 
 	pim = igmp_hdr(skb);
 
-	if (ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt) < 0)
-		goto drop;
-
+	{
+		struct rtable *rt = skb_rtable(skb);
+		struct flowi fl = {
+			.fl4_dst = rt->rt_key_dst,
+			.fl4_src = rt->rt_key_src,
+			.fl4_tos = rt->rt_tos,
+			.oif = rt->rt_oif,
+			.iif = rt->rt_iif,
+			.mark = rt->rt_mark,
+		};
+		if (ipmr_fib_lookup(net, &fl, &mrt) < 0)
+			goto drop;
+	}
 	if (!mrt->mroute_do_pim ||
 	    pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
 		goto drop;
@@ -1978,9 +1998,19 @@ static int pim_rcv(struct sk_buff *skb)
 	     csum_fold(skb_checksum(skb, 0, skb->len, 0))))
 		goto drop;
 
-	if (ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt) < 0)
-		goto drop;
-
+	{
+		struct rtable *rt = skb_rtable(skb);
+		struct flowi fl = {
+			.fl4_dst = rt->rt_key_dst,
+			.fl4_src = rt->rt_key_src,
+			.fl4_tos = rt->rt_tos,
+			.oif = rt->rt_oif,
+			.iif = rt->rt_iif,
+			.mark = rt->rt_mark,
+		};
+		if (ipmr_fib_lookup(net, &fl, &mrt) < 0)
+			goto drop;
+	}
 	if (__pim_rcv(mrt, skb, sizeof(*pim))) {
 drop:
 		kfree_skb(skb);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 602473c..92a24ea 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -424,7 +424,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
 			dst_metric(&r->dst, RTAX_WINDOW),
 			(int)((dst_metric(&r->dst, RTAX_RTT) >> 3) +
 			      dst_metric(&r->dst, RTAX_RTTVAR)),
-			r->fl.fl4_tos,
+			r->rt_tos,
 			r->dst.hh ? atomic_read(&r->dst.hh->hh_refcnt) : -1,
 			r->dst.hh ? (r->dst.hh->hh_output ==
 				       dev_queue_xmit) : 0,
@@ -711,22 +711,22 @@ static inline bool rt_caching(const struct net *net)
 		net->ipv4.sysctl_rt_cache_rebuild_count;
 }
 
-static inline bool compare_hash_inputs(const struct flowi *fl1,
-					const struct flowi *fl2)
+static inline bool compare_hash_inputs(const struct rtable *rt1,
+				       const struct rtable *rt2)
 {
-	return ((((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) |
-		((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) |
-		(fl1->iif ^ fl2->iif)) == 0);
+	return ((((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) |
+		((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) |
+		(rt1->rt_iif ^ rt2->rt_iif)) == 0);
 }
 
-static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
+static inline int compare_keys(struct rtable *rt1, struct rtable *rt2)
 {
-	return (((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) |
-		((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) |
-		(fl1->mark ^ fl2->mark) |
-		(*(u16 *)&fl1->fl4_tos ^ *(u16 *)&fl2->fl4_tos) |
-		(fl1->oif ^ fl2->oif) |
-		(fl1->iif ^ fl2->iif)) == 0;
+	return (((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) |
+		((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) |
+		(rt1->rt_mark ^ rt2->rt_mark) |
+		(rt1->rt_tos ^ rt2->rt_tos) |
+		(rt1->rt_oif ^ rt2->rt_oif) |
+		(rt1->rt_iif ^ rt2->rt_iif)) == 0;
 }
 
 static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
@@ -813,7 +813,7 @@ static int has_noalias(const struct rtable *head, const struct rtable *rth)
 	const struct rtable *aux = head;
 
 	while (aux != rth) {
-		if (compare_hash_inputs(&aux->fl, &rth->fl))
+		if (compare_hash_inputs(aux, rth))
 			return 0;
 		aux = rcu_dereference_protected(aux->dst.rt_next, 1);
 	}
@@ -1073,7 +1073,7 @@ restart:
 			rt_free(rth);
 			continue;
 		}
-		if (compare_keys(&rth->fl, &rt->fl) && compare_netns(rth, rt)) {
+		if (compare_keys(rth, rt) && compare_netns(rth, rt)) {
 			/* Put it first */
 			*rthp = rth->dst.rt_next;
 			/*
@@ -1136,7 +1136,7 @@ restart:
 			rt_emergency_hash_rebuild(net);
 			spin_unlock_bh(rt_hash_lock_addr(hash));
 
-			hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src,
+			hash = rt_hash(rt->rt_key_dst, rt->rt_key_src,
 					ifindex, rt_genid(net));
 			goto restart;
 		}
@@ -1344,12 +1344,12 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
 			ip_rt_put(rt);
 			ret = NULL;
 		} else if (rt->rt_flags & RTCF_REDIRECTED) {
-			unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src,
-						rt->fl.oif,
+			unsigned hash = rt_hash(rt->rt_key_dst, rt->rt_key_src,
+						rt->rt_oif,
 						rt_genid(dev_net(dst->dev)));
 #if RT_CACHE_DEBUG >= 1
 			printk(KERN_DEBUG "ipv4_negative_advice: redirect to %pI4/%02x dropped\n",
-				&rt->rt_dst, rt->fl.fl4_tos);
+				&rt->rt_dst, rt->rt_tos);
 #endif
 			rt_del(hash, rt);
 			ret = NULL;
@@ -1697,8 +1697,17 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt)
 	if (rt_is_output_route(rt))
 		src = rt->rt_src;
 	else {
+		struct flowi fl = {
+			.fl4_dst = rt->rt_key_dst,
+			.fl4_src = rt->rt_key_src,
+			.fl4_tos = rt->rt_tos,
+			.oif = rt->rt_oif,
+			.iif = rt->rt_iif,
+			.mark = rt->rt_mark,
+		};
+
 		rcu_read_lock();
-		if (fib_lookup(dev_net(rt->dst.dev), &rt->fl, &res) == 0)
+		if (fib_lookup(dev_net(rt->dst.dev), &fl, &res) == 0)
 			src = FIB_RES_PREFSRC(res);
 		else
 			src = inet_select_addr(rt->dst.dev, rt->rt_gateway,
@@ -1748,7 +1757,8 @@ static unsigned int ipv4_default_mtu(const struct dst_entry *dst)
 	return mtu;
 }
 
-static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
+static void rt_init_metrics(struct rtable *rt, const struct flowi *oldflp,
+			    struct fib_info *fi)
 {
 	struct inet_peer *peer;
 	int create = 0;
@@ -1756,7 +1766,7 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
 	/* If a peer entry exists for this destination, we must hook
 	 * it up in order to get at cached metrics.
 	 */
-	if (rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)
+	if (oldflp && (oldflp->flags & FLOWI_FLAG_PRECOW_METRICS))
 		create = 1;
 
 	rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create);
@@ -1783,7 +1793,8 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
 	}
 }
 
-static void rt_set_nexthop(struct rtable *rt, const struct fib_result *res,
+static void rt_set_nexthop(struct rtable *rt, const struct flowi *oldflp,
+			   const struct fib_result *res,
 			   struct fib_info *fi, u16 type, u32 itag)
 {
 	struct dst_entry *dst = &rt->dst;
@@ -1792,7 +1803,7 @@ static void rt_set_nexthop(struct rtable *rt, const struct fib_result *res,
 		if (FIB_RES_GW(*res) &&
 		    FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK)
 			rt->rt_gateway = FIB_RES_GW(*res);
-		rt_init_metrics(rt, fi);
+		rt_init_metrics(rt, oldflp, fi);
 #ifdef CONFIG_IP_ROUTE_CLASSID
 		dst->tclassid = FIB_RES_NH(*res).nh_tclassid;
 #endif
@@ -1861,20 +1872,19 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 
 	rth->dst.output = ip_rt_bug;
 
-	rth->fl.fl4_dst	= daddr;
+	rth->rt_key_dst	= daddr;
 	rth->rt_dst	= daddr;
-	rth->fl.fl4_tos	= tos;
-	rth->fl.mark    = skb->mark;
-	rth->fl.fl4_src	= saddr;
+	rth->rt_tos	= tos;
+	rth->rt_mark    = skb->mark;
+	rth->rt_key_src	= saddr;
 	rth->rt_src	= saddr;
 #ifdef CONFIG_IP_ROUTE_CLASSID
 	rth->dst.tclassid = itag;
 #endif
-	rth->rt_iif	=
-	rth->fl.iif	= dev->ifindex;
+	rth->rt_iif	= dev->ifindex;
 	rth->dst.dev	= init_net.loopback_dev;
 	dev_hold(rth->dst.dev);
-	rth->fl.oif	= 0;
+	rth->rt_oif	= 0;
 	rth->rt_gateway	= daddr;
 	rth->rt_spec_dst= spec_dst;
 	rth->rt_genid	= rt_genid(dev_net(dev));
@@ -1999,25 +2009,24 @@ static int __mkroute_input(struct sk_buff *skb,
 		goto cleanup;
 	}
 
-	rth->fl.fl4_dst	= daddr;
+	rth->rt_key_dst	= daddr;
 	rth->rt_dst	= daddr;
-	rth->fl.fl4_tos	= tos;
-	rth->fl.mark    = skb->mark;
-	rth->fl.fl4_src	= saddr;
+	rth->rt_tos	= tos;
+	rth->rt_mark    = skb->mark;
+	rth->rt_key_src	= saddr;
 	rth->rt_src	= saddr;
 	rth->rt_gateway	= daddr;
-	rth->rt_iif 	=
-		rth->fl.iif	= in_dev->dev->ifindex;
+	rth->rt_iif 	= in_dev->dev->ifindex;
 	rth->dst.dev	= (out_dev)->dev;
 	dev_hold(rth->dst.dev);
-	rth->fl.oif 	= 0;
+	rth->rt_oif 	= 0;
 	rth->rt_spec_dst= spec_dst;
 
 	rth->dst.input = ip_forward;
 	rth->dst.output = ip_output;
 	rth->rt_genid = rt_genid(dev_net(rth->dst.dev));
 
-	rt_set_nexthop(rth, res, res->fi, res->type, itag);
+	rt_set_nexthop(rth, NULL, res, res->fi, res->type, itag);
 
 	rth->rt_flags = flags;
 
@@ -2172,17 +2181,16 @@ local_input:
 	rth->dst.output= ip_rt_bug;
 	rth->rt_genid = rt_genid(net);
 
-	rth->fl.fl4_dst	= daddr;
+	rth->rt_key_dst	= daddr;
 	rth->rt_dst	= daddr;
-	rth->fl.fl4_tos	= tos;
-	rth->fl.mark    = skb->mark;
-	rth->fl.fl4_src	= saddr;
+	rth->rt_tos	= tos;
+	rth->rt_mark    = skb->mark;
+	rth->rt_key_src	= saddr;
 	rth->rt_src	= saddr;
 #ifdef CONFIG_IP_ROUTE_CLASSID
 	rth->dst.tclassid = itag;
 #endif
-	rth->rt_iif	=
-	rth->fl.iif	= dev->ifindex;
+	rth->rt_iif	= dev->ifindex;
 	rth->dst.dev	= net->loopback_dev;
 	dev_hold(rth->dst.dev);
 	rth->rt_gateway	= daddr;
@@ -2261,12 +2269,12 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 
 	for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
 	     rth = rcu_dereference(rth->dst.rt_next)) {
-		if ((((__force u32)rth->fl.fl4_dst ^ (__force u32)daddr) |
-		     ((__force u32)rth->fl.fl4_src ^ (__force u32)saddr) |
-		     (rth->fl.iif ^ iif) |
-		     rth->fl.oif |
-		     (rth->fl.fl4_tos ^ tos)) == 0 &&
-		    rth->fl.mark == skb->mark &&
+		if ((((__force u32)rth->rt_key_dst ^ (__force u32)daddr) |
+		     ((__force u32)rth->rt_key_src ^ (__force u32)saddr) |
+		     (rth->rt_iif ^ iif) |
+		     rth->rt_oif |
+		     (rth->rt_tos ^ tos)) == 0 &&
+		    rth->rt_mark == skb->mark &&
 		    net_eq(dev_net(rth->dst.dev), net) &&
 		    !rt_is_expired(rth)) {
 			if (noref) {
@@ -2374,11 +2382,11 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
 	if (!rth)
 		return ERR_PTR(-ENOBUFS);
 
-	rth->fl.fl4_dst	= oldflp->fl4_dst;
-	rth->fl.fl4_tos	= tos;
-	rth->fl.fl4_src	= oldflp->fl4_src;
-	rth->fl.oif	= oldflp->oif;
-	rth->fl.mark    = oldflp->mark;
+	rth->rt_key_dst	= oldflp->fl4_dst;
+	rth->rt_tos	= tos;
+	rth->rt_key_src	= oldflp->fl4_src;
+	rth->rt_oif	= oldflp->oif;
+	rth->rt_mark    = oldflp->mark;
 	rth->rt_dst	= fl->fl4_dst;
 	rth->rt_src	= fl->fl4_src;
 	rth->rt_iif	= 0;
@@ -2416,7 +2424,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
 #endif
 	}
 
-	rt_set_nexthop(rth, res, fi, type, 0);
+	rt_set_nexthop(rth, oldflp, res, fi, type, 0);
 
 	rth->rt_flags = flags;
 	return rth;
@@ -2629,12 +2637,12 @@ struct rtable *__ip_route_output_key(struct net *net, const struct flowi *flp)
 	rcu_read_lock_bh();
 	for (rth = rcu_dereference_bh(rt_hash_table[hash].chain); rth;
 		rth = rcu_dereference_bh(rth->dst.rt_next)) {
-		if (rth->fl.fl4_dst == flp->fl4_dst &&
-		    rth->fl.fl4_src == flp->fl4_src &&
+		if (rth->rt_key_dst == flp->fl4_dst &&
+		    rth->rt_key_src == flp->fl4_src &&
 		    rt_is_output_route(rth) &&
-		    rth->fl.oif == flp->oif &&
-		    rth->fl.mark == flp->mark &&
-		    !((rth->fl.fl4_tos ^ flp->fl4_tos) &
+		    rth->rt_oif == flp->oif &&
+		    rth->rt_mark == flp->mark &&
+		    !((rth->rt_tos ^ flp->fl4_tos) &
 			    (IPTOS_RT_MASK | RTO_ONLINK)) &&
 		    net_eq(dev_net(rth->dst.dev), net) &&
 		    !rt_is_expired(rth)) {
@@ -2693,7 +2701,12 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
 		if (new->dev)
 			dev_hold(new->dev);
 
-		rt->fl = ort->fl;
+		rt->rt_key_dst = ort->rt_key_dst;
+		rt->rt_key_src = ort->rt_key_src;
+		rt->rt_tos = ort->rt_tos;
+		rt->rt_iif = ort->rt_iif;
+		rt->rt_oif = ort->rt_oif;
+		rt->rt_mark = ort->rt_mark;
 
 		rt->rt_genid = rt_genid(net);
 		rt->rt_flags = ort->rt_flags;
@@ -2756,7 +2769,7 @@ static int rt_fill_info(struct net *net,
 	r->rtm_family	 = AF_INET;
 	r->rtm_dst_len	= 32;
 	r->rtm_src_len	= 0;
-	r->rtm_tos	= rt->fl.fl4_tos;
+	r->rtm_tos	= rt->rt_tos;
 	r->rtm_table	= RT_TABLE_MAIN;
 	NLA_PUT_U32(skb, RTA_TABLE, RT_TABLE_MAIN);
 	r->rtm_type	= rt->rt_type;
@@ -2768,9 +2781,9 @@ static int rt_fill_info(struct net *net,
 
 	NLA_PUT_BE32(skb, RTA_DST, rt->rt_dst);
 
-	if (rt->fl.fl4_src) {
+	if (rt->rt_key_src) {
 		r->rtm_src_len = 32;
-		NLA_PUT_BE32(skb, RTA_SRC, rt->fl.fl4_src);
+		NLA_PUT_BE32(skb, RTA_SRC, rt->rt_key_src);
 	}
 	if (rt->dst.dev)
 		NLA_PUT_U32(skb, RTA_OIF, rt->dst.dev->ifindex);
@@ -2780,7 +2793,7 @@ static int rt_fill_info(struct net *net,
 #endif
 	if (rt_is_input_route(rt))
 		NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_spec_dst);
-	else if (rt->rt_src != rt->fl.fl4_src)
+	else if (rt->rt_src != rt->rt_key_src)
 		NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_src);
 
 	if (rt->rt_dst != rt->rt_gateway)
@@ -2789,8 +2802,8 @@ static int rt_fill_info(struct net *net,
 	if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0)
 		goto nla_put_failure;
 
-	if (rt->fl.mark)
-		NLA_PUT_BE32(skb, RTA_MARK, rt->fl.mark);
+	if (rt->rt_mark)
+		NLA_PUT_BE32(skb, RTA_MARK, rt->rt_mark);
 
 	error = rt->dst.error;
 	expires = (rt->peer && rt->peer->pmtu_expires) ?
@@ -2824,7 +2837,7 @@ static int rt_fill_info(struct net *net,
 			}
 		} else
 #endif
-			NLA_PUT_U32(skb, RTA_IIF, rt->fl.iif);
+			NLA_PUT_U32(skb, RTA_IIF, rt->rt_iif);
 	}
 
 	if (rtnl_put_cacheinfo(skb, &rt->dst, id, ts, tsage,
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 45b8214..c70c42e 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -70,7 +70,12 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
 {
 	struct rtable *rt = (struct rtable *)xdst->route;
 
-	xdst->u.rt.fl = *fl;
+	rt->rt_key_dst = fl->fl4_dst;
+	rt->rt_key_src = fl->fl4_src;
+	rt->rt_tos = fl->fl4_tos;
+	rt->rt_iif = fl->iif;
+	rt->rt_oif = fl->oif;
+	rt->rt_mark = fl->mark;
 
 	xdst->u.dst.dev = dev;
 	dev_hold(dev);
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index d580cdf..a9079053 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -143,7 +143,7 @@ static int route4_classify(struct sk_buff *skb, struct tcf_proto *tp,
 	if (head == NULL)
 		goto old_method;
 
-	iif = ((struct rtable *)dst)->fl.iif;
+	iif = ((struct rtable *)dst)->rt_iif;
 
 	h = route4_fastmap_hash(id, iif);
 	if (id == head->fastmap[h].id &&
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index e5e1747..a4de67e 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -264,7 +264,7 @@ META_COLLECTOR(int_rtiif)
 	if (unlikely(skb_rtable(skb) == NULL))
 		*err = -1;
 	else
-		dst->value = skb_rtable(skb)->fl.iif;
+		dst->value = skb_rtable(skb)->rt_iif;
 }
 
 /**************************************************************************
-- 
1.7.4.1


^ permalink raw reply related

* Re: [PATCH] ipv4: Get peer more cheaply in rt_init_metrics().
From: Eric Dumazet @ 2011-03-05  6:46 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20110304.212636.226786422.davem@davemloft.net>

Le vendredi 04 mars 2011 à 21:26 -0800, David Miller  écrit :
> We know this is a new route object, so doing atomics and
> stuff makes no sense at all.
> 
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  net/ipv4/route.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 6c87403..9794a2c 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1759,9 +1759,9 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
>  	if (rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)
>  		create = 1;
>  
> -	rt_bind_peer(rt, create);
> -	peer = rt->peer;
> +	rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create);
>  	if (peer) {
> +		rt->rt_peer_genid = rt_peer_genid();
>  		if (inet_metrics_new(peer))
>  			memcpy(peer->metrics, fi->fib_metrics,
>  			       sizeof(u32) * RTAX_MAX);

Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>



^ permalink raw reply

* Re: [PATCH] ipv4: Use passed-in protocol in ip_route_newports().
From: Eric Dumazet @ 2011-03-05  6:49 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20110304.213553.71108798.davem@davemloft.net>

Le vendredi 04 mars 2011 à 21:35 -0800, David Miller a écrit :
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  include/net/route.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/include/net/route.h b/include/net/route.h
> index 60daf74..8905d90 100644
> --- a/include/net/route.h
> +++ b/include/net/route.h
> @@ -217,7 +217,7 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
>  				    .fl4_dst = rt->fl.fl4_dst,
>  				    .fl4_src = rt->fl.fl4_src,
>  				    .fl4_tos = rt->fl.fl4_tos,
> -				    .proto = rt->fl.proto,
> +				    .proto = protocol,
>  				    .fl_ip_sport = sport,
>  				    .fl_ip_dport = dport };
>  

Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>




^ permalink raw reply

* Re: [PATCH] ipv4: Set rt->rt_iif more sanely on output routes.
From: Eric Dumazet @ 2011-03-05  6:52 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20110304.213625.104050222.davem@davemloft.net>

Le vendredi 04 mars 2011 à 21:36 -0800, David Miller a écrit :
> rt->rt_iif is only ever inspected on input routes, for example DCCP
> uses this to populate a route lookup flow key when generating replies
> to another packet.
> 
> Therefore, setting it to anything other than zero on output routes
> makes no sense.
> 
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  net/ipv4/route.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 9794a2c..602473c 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -2381,7 +2381,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
>  	rth->fl.mark    = oldflp->mark;
>  	rth->rt_dst	= fl->fl4_dst;
>  	rth->rt_src	= fl->fl4_src;
> -	rth->rt_iif	= oldflp->oif ? : dev_out->ifindex;
> +	rth->rt_iif	= 0;
>  	/* get references to the devices that are to be hold by the routing
>  	   cache entry */
>  	rth->dst.dev	= dev_out;

Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>



^ permalink raw reply

* Re: [PATCH] ipv4: Remove flowi from struct rtable.
From: Eric Dumazet @ 2011-03-05  6:59 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20110304.221214.189707201.davem@davemloft.net>

Le vendredi 04 mars 2011 à 22:12 -0800, David Miller a écrit :
> The only necessary parts are the src/dst addresses, the
> interface indexes, the TOS, and the mark.
> 
> The rest is unnecessary bloat, which amounts to nearly
> 50 bytes on 64-bit.
> 
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---



> +		struct rtable *rt = skb_rtable(skb);
> +		struct flowi fl = {
> +			.fl4_dst = rt->rt_key_dst,
> +			.fl4_src = rt->rt_key_src,
> +			.fl4_tos = rt->rt_tos,
> +			.oif = rt->rt_oif,
> +			.iif = rt->rt_iif,
> +			.mark = rt->rt_mark,
> +		};

Eventually we could have a helper for this, as this is done three times
in this file. Or maybe you have further plans for ipmr ?



^ permalink raw reply

* [PATCH] ixgbe: fix for 82599 erratum on Header Splitting
From: Jeff Kirsher @ 2011-03-05  7:06 UTC (permalink / raw)
  To: gregkh; +Cc: Don Skidmore, stable, netdev, Jeff Kirsher

From: Don Skidmore <donald.c.skidmore@intel.com>

We have found a hardware erratum on 82599 hardware that can lead to
unpredictable behavior when Header Splitting mode is enabled.  So
we are no longer enabling this feature on affected hardware.

Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ixgbe/ixgbe_main.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a873c5d..67d1d97 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2131,6 +2131,10 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 	/* Decide whether to use packet split mode or not */
 	adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED;
 
+	/* Disable packet split due to 82599 erratum #45 */
+	if (hw->mac.type == ixgbe_mac_82599EB)
+		adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED;
+
 	/* Set the RX buffer length according to the mode */
 	if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) {
 		rx_buf_len = IXGBE_RX_HDR_SIZE;
-- 
1.7.4


^ permalink raw reply related

* Re: [PATCH] ipv4: Remove flowi from struct rtable.
From: David Miller @ 2011-03-05  7:09 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1299308388.2758.71.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 05 Mar 2011 07:59:48 +0100

> Eventually we could have a helper for this, as this is done three times
> in this file. Or maybe you have further plans for ipmr ?

No immediate plans, so yes I'll make a helper, good idea.

^ permalink raw reply

* [PATCH] ethtool: remove mask for Auto in advertise section
From: Jeff Kirsher @ 2011-03-05  7:27 UTC (permalink / raw)
  To: bhutchings; +Cc: Emil Tantilov, netdev, Jeff Kirsher

From: Emil Tantilov <emil.s.tantilov@intel.com>

The mask for Auto in the advertise section is incorrect for any interface
that supports speeds > 1000Mbps. Since the description already states that
the mask can be a combination of the supported values it's probably better
to just remove it. 'Auto' was misleading anyway.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 ethtool.8.in |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/ethtool.8.in b/ethtool.8.in
index 0ee91a0..d7bcc51 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -516,8 +516,6 @@ a hexadecimal value using one or a combination of the following values:
 .BR "0x8000" "   2500 Full" "(not supported by IEEE standards)"
 .TP 3
 .BR "0x1000" "   10000 Full"
-.TP 3
-.BR "0x03F" "    Auto"
 .PD
 .RE
 .TP
-- 
1.7.4


^ permalink raw reply related

* Re: [PATCH] ixgbe: fix for 82599 erratum on Header Splitting
From: Greg KH @ 2011-03-05  7:44 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: Don Skidmore, stable, netdev
In-Reply-To: <1299308767-28735-1-git-send-email-jeffrey.t.kirsher@intel.com>

On Fri, Mar 04, 2011 at 11:06:07PM -0800, Jeff Kirsher wrote:
> From: Don Skidmore <donald.c.skidmore@intel.com>
> 
> We have found a hardware erratum on 82599 hardware that can lead to
> unpredictable behavior when Header Splitting mode is enabled.  So
> we are no longer enabling this feature on affected hardware.
> 
> Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
> Tested-by: Stephen Ko <stephen.s.ko@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_main.c |    4 ++++

I'm confused, why did you just send this patch to me?

What am I supposed to do with it?

greg k-h

^ permalink raw reply

* Re: [PATCH] ixgbe: fix for 82599 erratum on Header Splitting
From: Jeff Kirsher @ 2011-03-05  7:51 UTC (permalink / raw)
  To: Greg KH; +Cc: Skidmore, Donald C, stable@kernel.org, netdev@vger.kernel.org
In-Reply-To: <20110305074419.GA19596@suse.de>

[-- Attachment #1: Type: text/plain, Size: 963 bytes --]

On Fri, 2011-03-04 at 23:44 -0800, Greg KH wrote:
> On Fri, Mar 04, 2011 at 11:06:07PM -0800, Jeff Kirsher wrote:
> > From: Don Skidmore <donald.c.skidmore@intel.com>
> > 
> > We have found a hardware erratum on 82599 hardware that can lead to
> > unpredictable behavior when Header Splitting mode is enabled.  So
> > we are no longer enabling this feature on affected hardware.
> > 
> > Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
> > Tested-by: Stephen Ko <stephen.s.ko@intel.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_main.c |    4 ++++
> 
> I'm confused, why did you just send this patch to me?
> 
> What am I supposed to do with it?
> 
> greg k-h

This is the fix for ixgbe (that Ben and others pointed out) which has
been accepted into Linus's tree which did not apply to stable-2.6.32
tree.  This is the updated patch that apply's to the stable-2.6.32 tree.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply

* Re: [PATCH] ixgbe: fix for 82599 erratum on Header Splitting
From: Greg KH @ 2011-03-05  7:59 UTC (permalink / raw)
  To: Jeff Kirsher
  Cc: Skidmore, Donald C, stable@kernel.org, netdev@vger.kernel.org
In-Reply-To: <1299311467.26413.31.camel@jtkirshe-MOBL1>

On Fri, Mar 04, 2011 at 11:51:07PM -0800, Jeff Kirsher wrote:
> On Fri, 2011-03-04 at 23:44 -0800, Greg KH wrote:
> > On Fri, Mar 04, 2011 at 11:06:07PM -0800, Jeff Kirsher wrote:
> > > From: Don Skidmore <donald.c.skidmore@intel.com>
> > > 
> > > We have found a hardware erratum on 82599 hardware that can lead to
> > > unpredictable behavior when Header Splitting mode is enabled.  So
> > > we are no longer enabling this feature on affected hardware.
> > > 
> > > Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
> > > Tested-by: Stephen Ko <stephen.s.ko@intel.com>
> > > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> > > ---
> > >  drivers/net/ixgbe/ixgbe_main.c |    4 ++++
> > 
> > I'm confused, why did you just send this patch to me?
> > 
> > What am I supposed to do with it?
> > 
> > greg k-h
> 
> This is the fix for ixgbe (that Ben and others pointed out) which has
> been accepted into Linus's tree which did not apply to stable-2.6.32
> tree.  This is the updated patch that apply's to the stable-2.6.32 tree.

How nice, but why didn't you say so in the first place?  Am I really
supposed to remember the hundreds of stable patches I handle every week?

Oh, I need the git commit id of it as well, care to resend this with
that and the proper "please apply this for the .32 longterm tree"
message so I can?

If so, I'll queue it up for the after-next .32-longterm release.

thanks,

greg k-h

^ permalink raw reply

* tun routing is broken [was: tun: Failed to create tun sysfs files]
From: Jiri Slaby @ 2011-03-05  8:04 UTC (permalink / raw)
  To: David Miller; +Cc: Jiri Slaby, linux-kernel, akpm, mm-commits, netdev, maxk
In-Reply-To: <4D70B2DC.2000005@gmail.com>

On 03/04/2011 10:37 AM, Jiri Slaby wrote:
> On 03/04/2011 10:06 AM, David Miller wrote:
>> From: Jiri Slaby <jslaby@suse.cz>
>> Date: Fri, 04 Mar 2011 09:56:09 +0100
>>
>>> On 03/03/2011 01:52 AM, akpm@linux-foundation.org wrote:
>>>> The mm-of-the-moment snapshot 2011-03-02-16-52 has been uploaded to
>>>
>>> Hi, I'm seeing this with tun (also with earlier versions):
>>
>> The name of the attribute was changed to netdev_group in order to
>> fix this problem, in fact quite some time ago.
>>
>> See the last entry of the net_class_attributes array in
>> net/core/net-sysfs.c, if it isn't called "netdev_group"
>> something is awry.
> 
> <idiocy>
> Aha, sorry for the noise, I booted the old kernel.
> </idiocy>

Ok, so I booted the new kernel, and tun is broken there completely. If I
try to ping a vpn peer:
...
capget(0x20080522, 0, NULL)             = 0
capset(0x20080522, 0, {0, 0, 0})        = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(1025),
sin_addr=inet_addr("10.20.11.1")}, 16) = -1 EINVAL (Invalid argument)

the route is:
10.20.11.1 dev tun0  proto kernel  scope link  src 10.20.11.33

When I try to ping a router on eth0 10.0.28.10, it works as expected.

Maybe the changes in ipv4 routing cause this? But my amateur eyes can't
see any breakage there...

Now I'm back in mmotm 2011-02-10-16-26 and it works, indeed.

regards,
-- 
js
suse labs

^ permalink raw reply

* Re: [PATCH] ixgbe: fix for 82599 erratum on Header Splitting
From: Jeff Kirsher @ 2011-03-05  8:06 UTC (permalink / raw)
  To: Greg KH; +Cc: Skidmore, Donald C, stable@kernel.org, netdev@vger.kernel.org
In-Reply-To: <20110305075926.GA19706@suse.de>

[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]

On Fri, 2011-03-04 at 23:59 -0800, Greg KH wrote:
> On Fri, Mar 04, 2011 at 11:51:07PM -0800, Jeff Kirsher wrote:
> > On Fri, 2011-03-04 at 23:44 -0800, Greg KH wrote:
> > > On Fri, Mar 04, 2011 at 11:06:07PM -0800, Jeff Kirsher wrote:
> > > > From: Don Skidmore <donald.c.skidmore@intel.com>
> > > > 
> > > > We have found a hardware erratum on 82599 hardware that can lead to
> > > > unpredictable behavior when Header Splitting mode is enabled.  So
> > > > we are no longer enabling this feature on affected hardware.
> > > > 
> > > > Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
> > > > Tested-by: Stephen Ko <stephen.s.ko@intel.com>
> > > > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> > > > ---
> > > >  drivers/net/ixgbe/ixgbe_main.c |    4 ++++
> > > 
> > > I'm confused, why did you just send this patch to me?
> > > 
> > > What am I supposed to do with it?
> > > 
> > > greg k-h
> > 
> > This is the fix for ixgbe (that Ben and others pointed out) which has
> > been accepted into Linus's tree which did not apply to stable-2.6.32
> > tree.  This is the updated patch that apply's to the stable-2.6.32 tree.
> 
> How nice, but why didn't you say so in the first place?  Am I really
> supposed to remember the hundreds of stable patches I handle every week?

Sorry, I sent you/stable an email saying that I would send you an
updated patch that would apply to stable-2.6.32.  I know you deal with a
number of patches, so I apologize.

> 
> Oh, I need the git commit id of it as well, care to resend this with
> that and the proper "please apply this for the .32 longterm tree"
> message so I can?
> 

Heres is the commit info:
commit a124339ad28389093ed15eca990d39c51c5736cc
Author: Don Skidmore <donald.c.skidmore@intel.com>
Date:   Tue Jan 18 22:53:47 2011 +0000


> If so, I'll queue it up for the after-next .32-longterm release.
> 

I can resend the entire patch submission again, with the info provided,
if necessary.

> thanks,
> 
> greg k-h



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply

* Re: tun routing is broken
From: David Miller @ 2011-03-05  8:10 UTC (permalink / raw)
  To: jslaby; +Cc: jirislaby, linux-kernel, akpm, mm-commits, netdev, maxk
In-Reply-To: <4D71EE86.6030309@suse.cz>

From: Jiri Slaby <jslaby@suse.cz>
Date: Sat, 05 Mar 2011 09:04:22 +0100

> Ok, so I booted the new kernel, and tun is broken there completely. If I
> try to ping a vpn peer:

-mm tree is missing this fix which went in yesterday.  Please if
you are going to be testing networking a lot, test against net-next-2.6
instead of Andrew's tree which invariable lags behind:

--------------------
ipv4: Fix __ip_dev_find() to use ifa_local instead of ifa_address.

Reported-by: Stephen Hemminger <shemminger@vyatta.com>
Reported-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/devinet.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 9038928..ff53860 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -111,7 +111,7 @@ static inline unsigned int inet_addr_hash(struct net *net, __be32 addr)
 
 static void inet_hash_insert(struct net *net, struct in_ifaddr *ifa)
 {
-	unsigned int hash = inet_addr_hash(net, ifa->ifa_address);
+	unsigned int hash = inet_addr_hash(net, ifa->ifa_local);
 
 	spin_lock(&inet_addr_hash_lock);
 	hlist_add_head_rcu(&ifa->hash, &inet_addr_lst[hash]);
@@ -146,7 +146,7 @@ struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref)
 
 		if (!net_eq(dev_net(dev), net))
 			continue;
-		if (ifa->ifa_address == addr) {
+		if (ifa->ifa_local == addr) {
 			result = dev;
 			break;
 		}
-- 
1.7.4.1




^ permalink raw reply related

* Re: tun routing is broken
From: Jiri Slaby @ 2011-03-05  8:17 UTC (permalink / raw)
  To: David Miller; +Cc: Jiri Slaby, linux-kernel, akpm, mm-commits, netdev, maxk
In-Reply-To: <20110305.001022.183044112.davem@davemloft.net>

On 03/05/2011 09:10 AM, David Miller wrote:
> From: Jiri Slaby <jslaby@suse.cz>
> Date: Sat, 05 Mar 2011 09:04:22 +0100
> 
>> Ok, so I booted the new kernel, and tun is broken there completely. If I
>> try to ping a vpn peer:
> 
> -mm tree is missing this fix which went in yesterday.  Please if
> you are going to be testing networking a lot, test against net-next-2.6
> instead of Andrew's tree which invariable lags behind:

I'm not testing networking, I'm just using my desktop :). (And
next/master is mostly unusable for these needs. In comparison to mmotm
which is some kind of a "release".)

> --------------------
> ipv4: Fix __ip_dev_find() to use ifa_local instead of ifa_address.

It would be great to have a References: tag or better changelog. Then I
would give the commit a shot. The way it is I ignored it when looking at
next/master inside net/ipv4/ changes for commits to test.

Going to boot with this change.

> Reported-by: Stephen Hemminger <shemminger@vyatta.com>
> Reported-by: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  net/ipv4/devinet.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 9038928..ff53860 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -111,7 +111,7 @@ static inline unsigned int inet_addr_hash(struct net *net, __be32 addr)
>  
>  static void inet_hash_insert(struct net *net, struct in_ifaddr *ifa)
>  {
> -	unsigned int hash = inet_addr_hash(net, ifa->ifa_address);
> +	unsigned int hash = inet_addr_hash(net, ifa->ifa_local);
>  
>  	spin_lock(&inet_addr_hash_lock);
>  	hlist_add_head_rcu(&ifa->hash, &inet_addr_lst[hash]);
> @@ -146,7 +146,7 @@ struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref)
>  
>  		if (!net_eq(dev_net(dev), net))
>  			continue;
> -		if (ifa->ifa_address == addr) {
> +		if (ifa->ifa_local == addr) {
>  			result = dev;
>  			break;
>  		}

thanks,
-- 
js
suse labs

^ permalink raw reply

* Re: tun routing is broken
From: Jiri Slaby @ 2011-03-05  8:26 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: David Miller, linux-kernel, akpm, mm-commits, netdev, maxk
In-Reply-To: <4D71F194.9010402@suse.cz>

On 03/05/2011 09:17 AM, Jiri Slaby wrote:
>> ipv4: Fix __ip_dev_find() to use ifa_local instead of ifa_address.
> 
> It would be great to have a References: tag or better changelog. Then I
> would give the commit a shot. The way it is I ignored it when looking at
> next/master inside net/ipv4/ changes for commits to test.
> 
> Going to boot with this change.

Yes, it works.

thanks,
-- 
js
suse labs

^ permalink raw reply

* [patch net-next-2.6 4/8] bonding: wrap slave state work
From: Jiri Pirko @ 2011-03-05  8:29 UTC (permalink / raw)
  To: netdev
  Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
	andy
In-Reply-To: <1299313794-5218-1-git-send-email-jpirko@redhat.com>

transfers slave->state into slave->backup (that it's going to transfer
into bitfield. Introduce wrapper inlines to do the work with it.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/bonding/bond_3ad.c   |    2 +-
 drivers/net/bonding/bond_main.c  |   36 ++++++++++++++++++------------------
 drivers/net/bonding/bond_sysfs.c |    2 +-
 drivers/net/bonding/bonding.h    |   31 ++++++++++++++++++++++++++-----
 4 files changed, 46 insertions(+), 25 deletions(-)

diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 1024ae1..047af0b 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -246,7 +246,7 @@ static inline void __enable_port(struct port *port)
  */
 static inline int __port_is_enabled(struct port *port)
 {
-	return port->slave->state == BOND_STATE_ACTIVE;
+	return bond_is_active_slave(port->slave);
 }
 
 /**
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7923184..62020a7 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1872,7 +1872,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 		break;
 	case BOND_MODE_TLB:
 	case BOND_MODE_ALB:
-		new_slave->state = BOND_STATE_ACTIVE;
+		bond_set_active_slave(new_slave);
 		bond_set_slave_inactive_flags(new_slave);
 		bond_select_active_slave(bond);
 		break;
@@ -1880,7 +1880,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 		pr_debug("This slave is always active in trunk mode\n");
 
 		/* always active in trunk mode */
-		new_slave->state = BOND_STATE_ACTIVE;
+		bond_set_active_slave(new_slave);
 
 		/* In trunking mode there is little meaning to curr_active_slave
 		 * anyway (it holds no special properties of the bond device),
@@ -1918,7 +1918,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 
 	pr_info("%s: enslaving %s as a%s interface with a%s link.\n",
 		bond_dev->name, slave_dev->name,
-		new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup",
+		bond_is_active_slave(new_slave) ? "n active" : " backup",
 		new_slave->link != BOND_LINK_DOWN ? "n up" : " down");
 
 	/* enslave is successful */
@@ -2016,7 +2016,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
 
 	pr_info("%s: releasing %s interface %s\n",
 		bond_dev->name,
-		(slave->state == BOND_STATE_ACTIVE) ? "active" : "backup",
+		bond_is_active_slave(slave) ? "active" : "backup",
 		slave_dev->name);
 
 	oldcurrent = bond->curr_active_slave;
@@ -2357,7 +2357,7 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
 			res = 0;
 			strcpy(info->slave_name, slave->dev->name);
 			info->link = slave->link;
-			info->state = slave->state;
+			info->state = bond_slave_state(slave);
 			info->link_failure_count = slave->link_failure_count;
 			break;
 		}
@@ -2396,7 +2396,7 @@ static int bond_miimon_inspect(struct bonding *bond)
 					bond->dev->name,
 					(bond->params.mode ==
 					 BOND_MODE_ACTIVEBACKUP) ?
-					((slave->state == BOND_STATE_ACTIVE) ?
+					(bond_is_active_slave(slave) ?
 					 "active " : "backup ") : "",
 					slave->dev->name,
 					bond->params.downdelay * bond->params.miimon);
@@ -2487,13 +2487,13 @@ static void bond_miimon_commit(struct bonding *bond)
 
 			if (bond->params.mode == BOND_MODE_8023AD) {
 				/* prevent it from being the active one */
-				slave->state = BOND_STATE_BACKUP;
+				bond_set_backup_slave(slave);
 			} else if (bond->params.mode != BOND_MODE_ACTIVEBACKUP) {
 				/* make it immediately active */
-				slave->state = BOND_STATE_ACTIVE;
+				bond_set_active_slave(slave);
 			} else if (slave != bond->primary_slave) {
 				/* prevent it from being the active one */
-				slave->state = BOND_STATE_BACKUP;
+				bond_set_backup_slave(slave);
 			}
 
 			bond_update_speed_duplex(slave);
@@ -2871,7 +2871,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
 	memcpy(&tip, arp_ptr, 4);
 
 	pr_debug("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n",
-		 bond->dev->name, slave->dev->name, slave->state,
+		 bond->dev->name, slave->dev->name, bond_slave_state(slave),
 		 bond->params.arp_validate, slave_do_arp_validate(bond, slave),
 		 &sip, &tip);
 
@@ -2883,7 +2883,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
 	 * the active, through one switch, the router, then the other
 	 * switch before reaching the backup.
 	 */
-	if (slave->state == BOND_STATE_ACTIVE)
+	if (bond_is_active_slave(slave))
 		bond_validate_arp(bond, slave, sip, tip);
 	else
 		bond_validate_arp(bond, slave, tip, sip);
@@ -2945,7 +2945,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
 				slave->dev->last_rx + delta_in_ticks)) {
 
 				slave->link  = BOND_LINK_UP;
-				slave->state = BOND_STATE_ACTIVE;
+				bond_set_active_slave(slave);
 
 				/* primary_slave has no meaning in round-robin
 				 * mode. the window of a slave being up and
@@ -2978,7 +2978,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
 				slave->dev->last_rx + 2 * delta_in_ticks)) {
 
 				slave->link  = BOND_LINK_DOWN;
-				slave->state = BOND_STATE_BACKUP;
+				bond_set_backup_slave(slave);
 
 				if (slave->link_failure_count < UINT_MAX)
 					slave->link_failure_count++;
@@ -3072,7 +3072,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
 		 * gives each slave a chance to tx/rx traffic
 		 * before being taken out
 		 */
-		if (slave->state == BOND_STATE_BACKUP &&
+		if (!bond_is_active_slave(slave) &&
 		    !bond->current_arp_slave &&
 		    !time_in_range(jiffies,
 			slave_last_rx(bond, slave) - delta_in_ticks,
@@ -3089,7 +3089,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
 		 *    the bond has an IP address)
 		 */
 		trans_start = dev_trans_start(slave->dev);
-		if ((slave->state == BOND_STATE_ACTIVE) &&
+		if (bond_is_active_slave(slave) &&
 		    (!time_in_range(jiffies,
 			trans_start - delta_in_ticks,
 			trans_start + 2 * delta_in_ticks) ||
@@ -4446,7 +4446,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
 	bond_for_each_slave_from(bond, slave, i, start_at) {
 		if (IS_UP(slave->dev) &&
 		    (slave->link == BOND_LINK_UP) &&
-		    (slave->state == BOND_STATE_ACTIVE)) {
+		    bond_is_active_slave(slave)) {
 			res = bond_dev_queue_xmit(bond, skb, slave->dev);
 			break;
 		}
@@ -4523,7 +4523,7 @@ static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
 	bond_for_each_slave_from(bond, slave, i, start_at) {
 		if (IS_UP(slave->dev) &&
 		    (slave->link == BOND_LINK_UP) &&
-		    (slave->state == BOND_STATE_ACTIVE)) {
+		    bond_is_active_slave(slave)) {
 			res = bond_dev_queue_xmit(bond, skb, slave->dev);
 			break;
 		}
@@ -4564,7 +4564,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev)
 	bond_for_each_slave_from(bond, slave, i, start_at) {
 		if (IS_UP(slave->dev) &&
 		    (slave->link == BOND_LINK_UP) &&
-		    (slave->state == BOND_STATE_ACTIVE)) {
+		    bond_is_active_slave(slave)) {
 			if (tx_dev) {
 				struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
 				if (!skb2) {
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 05e0ae5..344d23f 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1579,7 +1579,7 @@ static ssize_t bonding_store_slaves_active(struct device *d,
 	}
 
 	bond_for_each_slave(bond, slave, i) {
-		if (slave->state == BOND_STATE_BACKUP) {
+		if (!bond_is_active_slave(slave)) {
 			if (new_value)
 				slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
 			else
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index ddee62f..8a3718b 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -53,7 +53,7 @@
 		    (((slave)->dev->flags & IFF_UP)  && \
 		     netif_running((slave)->dev)     && \
 		     ((slave)->link == BOND_LINK_UP) && \
-		     ((slave)->state == BOND_STATE_ACTIVE))
+		     bond_is_active_slave(slave))
 
 
 #define USES_PRIMARY(mode)				\
@@ -190,7 +190,8 @@ struct slave {
 	unsigned long last_arp_rx;
 	s8     link;    /* one of BOND_LINK_XXXX */
 	s8     new_link;
-	s8     state;   /* one of BOND_STATE_XXXX */
+	u8     backup;	/* indicates backup slave. Value corresponds with
+			   BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
 	u32    original_mtu;
 	u32    link_failure_count;
 	u8     perm_hwaddr[ETH_ALEN];
@@ -302,6 +303,26 @@ static inline bool bond_is_lb(const struct bonding *bond)
 		bond->params.mode == BOND_MODE_ALB);
 }
 
+static inline void bond_set_active_slave(struct slave *slave)
+{
+	slave->backup = 0;
+}
+
+static inline void bond_set_backup_slave(struct slave *slave)
+{
+	slave->backup = 1;
+}
+
+static inline int bond_slave_state(struct slave *slave)
+{
+	return slave->backup;
+}
+
+static inline bool bond_is_active_slave(struct slave *slave)
+{
+	return !bond_slave_state(slave);
+}
+
 #define BOND_PRI_RESELECT_ALWAYS	0
 #define BOND_PRI_RESELECT_BETTER	1
 #define BOND_PRI_RESELECT_FAILURE	2
@@ -319,7 +340,7 @@ static inline bool bond_is_lb(const struct bonding *bond)
 static inline int slave_do_arp_validate(struct bonding *bond,
 					struct slave *slave)
 {
-	return bond->params.arp_validate & (1 << slave->state);
+	return bond->params.arp_validate & (1 << bond_slave_state(slave));
 }
 
 static inline unsigned long slave_last_rx(struct bonding *bond,
@@ -351,14 +372,14 @@ static inline void bond_set_slave_inactive_flags(struct slave *slave)
 {
 	struct bonding *bond = netdev_priv(slave->dev->master);
 	if (!bond_is_lb(bond))
-		slave->state = BOND_STATE_BACKUP;
+		bond_set_backup_slave(slave);
 	if (!bond->params.all_slaves_active)
 		slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
 }
 
 static inline void bond_set_slave_active_flags(struct slave *slave)
 {
-	slave->state = BOND_STATE_ACTIVE;
+	bond_set_active_slave(slave);
 	slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
 }
 
-- 
1.7.4


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox