Netdev List
 help / color / mirror / Atom feed
* [PATCH 0/6] VXLAN fixes
From: Stephen Hemminger @ 2012-10-09 17:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

These fix some bugs found in followup testing with VXLAN.

^ permalink raw reply

* [PATCH 2/6] vxlan: use ip_route_output
From: Stephen Hemminger @ 2012-10-09 17:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20121009175637.048993312@vyatta.com>

[-- Attachment #1: vxlan-route-output.patch --]
[-- Type: text/plain, Size: 1057 bytes --]

Select source address for VXLAN packet based on route destination
and don't lie to route code: VXLAN is not GRE.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/vxlan.c	2012-10-09 10:48:56.546879617 -0700
+++ b/drivers/net/vxlan.c	2012-10-09 10:49:01.334832146 -0700
@@ -676,9 +676,11 @@ static netdev_tx_t vxlan_xmit(struct sk_
 
 	hash = skb_get_rxhash(skb);
 
-	rt = ip_route_output_gre(dev_net(dev), &fl4, dst,
-				 vxlan->saddr, vxlan->vni,
-				 RT_TOS(tos), vxlan->link);
+	fl4.flowi4_oif = vxlan->link;
+	fl4.flowi4_tos = RT_TOS(tos);
+	fl4.daddr = dst;
+	fl4.saddr = vxlan->saddr;
+	rt = ip_route_output_key(dev_net(dev), &fl4);
 	if (IS_ERR(rt)) {
 		netdev_dbg(dev, "no route to %pI4\n", &dst);
 		dev->stats.tx_carrier_errors++;
@@ -720,7 +722,7 @@ static netdev_tx_t vxlan_xmit(struct sk_
 	iph->frag_off	= df;
 	iph->protocol	= IPPROTO_UDP;
 	iph->tos	= vxlan_ecn_encap(tos, old_iph, skb);
-	iph->daddr	= fl4.daddr;
+	iph->daddr	= dst;
 	iph->saddr	= fl4.saddr;
 	iph->ttl	= ttl ? : ip4_dst_hoplimit(&rt->dst);
 

^ permalink raw reply

* [PATCH 4/6] VXLAN bases source UDP port based on flow to help the receiver to be able to load balance based on outer header flow.
From: Stephen Hemminger @ 2012-10-09 17:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20121009175637.048993312@vyatta.com>

[-- Attachment #1: vxlan-port-range.patch --]
[-- Type: text/plain, Size: 5757 bytes --]

This patch restricts the port range to the normal UDP local
ports, and allows overriding via configruation.

It also uses jhash of Ethernet header when looking at flows
with out know L3 header.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/net/vxlan.c     |   62 ++++++++++++++++++++++++++++++++++++++++++++----
 include/linux/if_link.h |    6 ++++
 2 files changed, 63 insertions(+), 5 deletions(-)

--- a/drivers/net/vxlan.c	2012-10-09 10:49:05.318792637 -0700
+++ b/drivers/net/vxlan.c	2012-10-09 10:49:08.238763697 -0700
@@ -106,6 +106,8 @@ struct vxlan_dev {
 	__be32	          gaddr;	/* multicast group */
 	__be32		  saddr;	/* source address */
 	unsigned int      link;		/* link to multicast over */
+	__u16		  port_min;	/* source port range */
+	__u16		  port_max;
 	__u8		  tos;		/* TOS override */
 	__u8		  ttl;
 	bool		  learn;
@@ -650,12 +652,29 @@ static void vxlan_set_owner(struct net_d
 	skb->destructor = vxlan_sock_free;
 }
 
+/* Compute source port for outgoing packet
+ *   first choice to use L4 flow hash since it will spread
+ *     better and maybe available from hardware
+ *   secondary choice is to use jhash on the Ethernet header
+ */
+static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb)
+{
+	unsigned int range = (vxlan->port_max - vxlan->port_min) + 1;
+	u32 hash;
+
+	hash = skb_get_rxhash(skb);
+	if (!hash)
+		hash = jhash(skb->data, 2 * ETH_ALEN,
+			     (__force u32) skb->protocol);
+
+	return (((u64) hash * range) >> 32) + vxlan->port_min;
+}
+
 /* Transmit local packets over Vxlan
  *
  * Outer IP header inherits ECN and DF from inner header.
  * Outer UDP destination is the VXLAN assigned port.
- *           source port is based on hash of flow if available
- *                       otherwise use a random value
+ *           source port is based on hash of flow
  */
 static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 {
@@ -667,8 +686,8 @@ static netdev_tx_t vxlan_xmit(struct sk_
 	struct udphdr *uh;
 	struct flowi4 fl4;
 	unsigned int pkt_len = skb->len;
-	u32 hash;
 	__be32 dst;
+	__u16 src_port;
 	__be16 df = 0;
 	__u8 tos, ttl;
 	int err;
@@ -691,7 +710,7 @@ static netdev_tx_t vxlan_xmit(struct sk_
 	if (tos == 1)
 		tos = vxlan_get_dsfield(old_iph, skb);
 
-	hash = skb_get_rxhash(skb);
+	src_port = vxlan_src_port(vxlan, skb);
 
 	fl4.flowi4_oif = vxlan->link;
 	fl4.flowi4_tos = RT_TOS(tos);
@@ -726,7 +745,7 @@ static netdev_tx_t vxlan_xmit(struct sk_
 	uh = udp_hdr(skb);
 
 	uh->dest = htons(vxlan_port);
-	uh->source = hash ? :random32();
+	uh->source = htons(src_port);
 
 	uh->len = htons(skb->len);
 	uh->check = 0;
@@ -954,6 +973,7 @@ static void vxlan_setup(struct net_devic
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	unsigned h;
+	int low, high;
 
 	eth_hw_addr_random(dev);
 	ether_setup(dev);
@@ -973,6 +993,10 @@ static void vxlan_setup(struct net_devic
 	vxlan->age_timer.function = vxlan_cleanup;
 	vxlan->age_timer.data = (unsigned long) vxlan;
 
+	inet_get_local_port_range(&low, &high);
+	vxlan->port_min = low;
+	vxlan->port_max = high;
+
 	vxlan->dev = dev;
 
 	for (h = 0; h < FDB_HASH_SIZE; ++h)
@@ -989,6 +1013,7 @@ static const struct nla_policy vxlan_pol
 	[IFLA_VXLAN_LEARNING]	= { .type = NLA_U8 },
 	[IFLA_VXLAN_AGEING]	= { .type = NLA_U32 },
 	[IFLA_VXLAN_LIMIT]	= { .type = NLA_U32 },
+	[IFLA_VXLAN_PORT_RANGE] = { .len  = sizeof(struct ifla_vxlan_port_range) },
 };
 
 static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[])
@@ -1021,6 +1046,18 @@ static int vxlan_validate(struct nlattr
 			return -EADDRNOTAVAIL;
 		}
 	}
+
+	if (data[IFLA_VXLAN_PORT_RANGE]) {
+		const struct ifla_vxlan_port_range *p
+			= nla_data(data[IFLA_VXLAN_PORT_RANGE]);
+
+		if ((int)(ntohs(p->high) - ntohs(p->low)) < 1) {
+			pr_debug("port range %u .. %u not valid\n",
+				 ntohs(p->low), ntohs(p->high));
+			return -EINVAL;
+		}
+	}
+
 	return 0;
 }
 
@@ -1071,6 +1108,13 @@ static int vxlan_newlink(struct net *net
 	if (data[IFLA_VXLAN_LIMIT])
 		vxlan->addrmax = nla_get_u32(data[IFLA_VXLAN_LIMIT]);
 
+	if (data[IFLA_VXLAN_PORT_RANGE]) {
+		const struct ifla_vxlan_port_range *p
+			= nla_data(data[IFLA_VXLAN_PORT_RANGE]);
+		vxlan->port_min = ntohs(p->low);
+		vxlan->port_max = ntohs(p->high);
+	}
+
 	err = register_netdevice(dev);
 	if (!err)
 		hlist_add_head_rcu(&vxlan->hlist, vni_head(net, vxlan->vni));
@@ -1099,12 +1143,17 @@ static size_t vxlan_get_size(const struc
 		nla_total_size(sizeof(__u8)) +	/* IFLA_VXLAN_LEARNING */
 		nla_total_size(sizeof(__u32)) +	/* IFLA_VXLAN_AGEING */
 		nla_total_size(sizeof(__u32)) +	/* IFLA_VXLAN_LIMIT */
+		nla_total_size(sizeof(struct ifla_vxlan_port_range)) +
 		0;
 }
 
 static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
 {
 	const struct vxlan_dev *vxlan = netdev_priv(dev);
+	struct ifla_vxlan_port_range ports = {
+		.low =  htons(vxlan->port_min),
+		.high = htons(vxlan->port_max),
+	};
 
 	if (nla_put_u32(skb, IFLA_VXLAN_ID, vxlan->vni))
 		goto nla_put_failure;
@@ -1125,6 +1174,9 @@ static int vxlan_fill_info(struct sk_buf
 	    nla_put_u32(skb, IFLA_VXLAN_LIMIT, vxlan->addrmax))
 		goto nla_put_failure;
 
+	if (nla_put(skb, IFLA_VXLAN_PORT_RANGE, sizeof(ports), &ports))
+		goto nla_put_failure;
+
 	return 0;
 
 nla_put_failure:
--- a/include/linux/if_link.h	2012-10-09 10:35:01.403159162 -0700
+++ b/include/linux/if_link.h	2012-10-09 10:49:08.238763697 -0700
@@ -284,10 +284,16 @@ enum {
 	IFLA_VXLAN_LEARNING,
 	IFLA_VXLAN_AGEING,
 	IFLA_VXLAN_LIMIT,
+	IFLA_VXLAN_PORT_RANGE,
 	__IFLA_VXLAN_MAX
 };
 #define IFLA_VXLAN_MAX	(__IFLA_VXLAN_MAX - 1)
 
+struct ifla_vxlan_port_range {
+	__be16	low;
+	__be16	high;
+};
+
 /* SR-IOV virtual function management section */
 
 enum {

^ permalink raw reply

* [PATCH 6/6] vxlan: fix receive checksum handling
From: Stephen Hemminger @ 2012-10-09 17:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20121009175637.048993312@vyatta.com>

[-- Attachment #1: vxlan-checksum.patch --]
[-- Type: text/plain, Size: 1198 bytes --]

The VXLAN drive was trying to use postpull_rcsum to allow receive checksum
offload to work on drivers using CHECKSUM_COMPLETE method. But this
doesn't work correctly. Just force full receive checksum on received
packet.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/vxlan.c	2012-10-09 10:49:19.830648777 -0700
+++ b/drivers/net/vxlan.c	2012-10-09 10:49:30.982538112 -0700
@@ -537,7 +537,6 @@ static int vxlan_udp_encap_recv(struct s
 	}
 
 	__skb_pull(skb, sizeof(struct vxlanhdr));
-	skb_postpull_rcsum(skb, eth_hdr(skb), sizeof(struct vxlanhdr));
 
 	/* Is this VNI defined? */
 	vni = ntohl(vxh->vx_vni) >> 8;
@@ -556,7 +555,6 @@ static int vxlan_udp_encap_recv(struct s
 	/* Re-examine inner Ethernet packet */
 	oip = ip_hdr(skb);
 	skb->protocol = eth_type_trans(skb, vxlan->dev);
-	skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
 
 	/* Ignore packet loops (and multicast echo) */
 	if (compare_ether_addr(eth_hdr(skb)->h_source,
@@ -568,6 +566,7 @@ static int vxlan_udp_encap_recv(struct s
 
 	__skb_tunnel_rx(skb, vxlan->dev);
 	skb_reset_network_header(skb);
+	skb->ip_summed = CHECKSUM_NONE;
 
 	err = IP_ECN_decapsulate(oip, skb);
 	if (unlikely(err)) {

^ permalink raw reply

* [PATCH 1/6] vxlan: minor output refactoring
From: Stephen Hemminger @ 2012-10-09 17:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20121009175637.048993312@vyatta.com>

[-- Attachment #1: vxlan-dst.patch --]
[-- Type: text/plain, Size: 1722 bytes --]

Move code to find destination to a small function.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/vxlan.c	2012-10-09 10:34:57.000000000 -0700
+++ b/drivers/net/vxlan.c	2012-10-09 10:48:56.546879617 -0700
@@ -621,6 +621,18 @@ static inline u8 vxlan_ecn_encap(u8 tos,
 	return INET_ECN_encapsulate(tos, inner);
 }
 
+static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb)
+{
+	const struct ethhdr *eth = (struct ethhdr *) skb->data;
+	struct vxlan_fdb *f;
+
+	if (is_multicast_ether_addr(eth->h_dest) ||
+	    (f = vxlan_find_mac(vxlan, eth->h_dest)) == NULL)
+		return vxlan->gaddr;
+	else
+		return f->remote_ip;
+}
+
 /* Transmit local packets over Vxlan
  *
  * Outer IP header inherits ECN and DF from inner header.
@@ -632,13 +644,11 @@ static netdev_tx_t vxlan_xmit(struct sk_
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct rtable *rt;
-	const struct ethhdr *eth;
 	const struct iphdr *old_iph;
 	struct iphdr *iph;
 	struct vxlanhdr *vxh;
 	struct udphdr *uh;
 	struct flowi4 fl4;
-	struct vxlan_fdb *f;
 	unsigned int pkt_len = skb->len;
 	u32 hash;
 	__be32 dst;
@@ -646,21 +656,16 @@ static netdev_tx_t vxlan_xmit(struct sk_
 	__u8 tos, ttl;
 	int err;
 
+	dst = vxlan_find_dst(vxlan, skb);
+	if (!dst)
+		goto drop;
+
 	/* Need space for new headers (invalidates iph ptr) */
 	if (skb_cow_head(skb, VXLAN_HEADROOM))
 		goto drop;
 
-	eth = (void *)skb->data;
 	old_iph = ip_hdr(skb);
 
-	if (!is_multicast_ether_addr(eth->h_dest) &&
-	    (f = vxlan_find_mac(vxlan, eth->h_dest)))
-		dst = f->remote_ip;
-	else if (vxlan->gaddr) {
-		dst = vxlan->gaddr;
-	} else
-		goto drop;
-
 	ttl = vxlan->ttl;
 	if (!ttl && IN_MULTICAST(ntohl(dst)))
 		ttl = 1;

^ permalink raw reply

* [PATCH 5/6] vxlan: add additional headroom
From: Stephen Hemminger @ 2012-10-09 17:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20121009175637.048993312@vyatta.com>

[-- Attachment #1: vxlan-more-headroom.patch --]
[-- Type: text/plain, Size: 542 bytes --]

Tell upper layer protocols to allocate skb with additional headroom.
This avoids allocation and copy in local packet sends.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/vxlan.c	2012-10-09 10:49:08.238763697 -0700
+++ b/drivers/net/vxlan.c	2012-10-09 10:49:19.830648777 -0700
@@ -977,6 +977,7 @@ static void vxlan_setup(struct net_devic
 
 	eth_hw_addr_random(dev);
 	ether_setup(dev);
+	dev->hard_header_len = ETH_HLEN + VXLAN_HEADROOM;
 
 	dev->netdev_ops = &vxlan_netdev_ops;
 	dev->destructor = vxlan_free;

^ permalink raw reply

* [PATCH 3/6] vxlan: associate with tunnel socket on xmit
From: Stephen Hemminger @ 2012-10-09 17:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20121009175637.048993312@vyatta.com>

[-- Attachment #1: vxlan-owner.patch --]
[-- Type: text/plain, Size: 1213 bytes --]

When tunnelling a skb, associate it with the tunnel socket.
This allows paramaters set on tunnel socket (like multicast loop
flag), to be picked up by ip_output.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/vxlan.c	2012-10-09 10:49:01.334832146 -0700
+++ b/drivers/net/vxlan.c	2012-10-09 10:49:05.318792637 -0700
@@ -633,6 +633,23 @@ static __be32 vxlan_find_dst(struct vxla
 		return f->remote_ip;
 }
 
+static void vxlan_sock_free(struct sk_buff *skb)
+{
+	sock_put(skb->sk);
+}
+
+/* On transmit, associate with the tunnel socket */
+static void vxlan_set_owner(struct net_device *dev, struct sk_buff *skb)
+{
+	struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
+	struct sock *sk = vn->sock->sk;
+
+	skb_orphan(skb);
+	sock_hold(sk);
+	skb->sk = sk;
+	skb->destructor = vxlan_sock_free;
+}
+
 /* Transmit local packets over Vxlan
  *
  * Outer IP header inherits ECN and DF from inner header.
@@ -726,6 +743,8 @@ static netdev_tx_t vxlan_xmit(struct sk_
 	iph->saddr	= fl4.saddr;
 	iph->ttl	= ttl ? : ip4_dst_hoplimit(&rt->dst);
 
+	vxlan_set_owner(dev, skb);
+
 	/* See __IPTUNNEL_XMIT */
 	skb->ip_summed = CHECKSUM_NONE;
 	ip_select_ident(iph, &rt->dst, NULL);

^ permalink raw reply

* Re: [PATCH 4/6] VXLAN bases source UDP port based on flow to help the receiver to be able to load balance based on outer header flow.
From: Stephen Hemminger @ 2012-10-09 18:07 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20121009175714.682992341@vyatta.com>

Commit message messed up by quilt on this one, do you want to fix
or should I resubmit?

^ permalink raw reply

* Re: [PATCH 4/6] VXLAN bases source UDP port based on flow to help the receiver to be able to load balance based on outer header flow.
From: David Miller @ 2012-10-09 18:14 UTC (permalink / raw)
  To: shemminger; +Cc: netdev
In-Reply-To: <20121009110754.57f229da@nehalam.linuxnetplumber.net>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Tue, 9 Oct 2012 11:07:54 -0700

> Commit message messed up by quilt on this one, do you want to fix
> or should I resubmit?

I can take care of it.

 

^ permalink raw reply

* Re: [PATCH 1/6] vxlan: minor output refactoring
From: Joe Perches @ 2012-10-09 18:27 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20121009175714.462171246@vyatta.com>

On Tue, 2012-10-09 at 10:56 -0700, Stephen Hemminger wrote:
> +static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb)
> +{
> +       const struct ethhdr *eth = (struct ethhdr *) skb->data;
> +       struct vxlan_fdb *f;
> +
> +       if (is_multicast_ether_addr(eth->h_dest) ||
> +           (f = vxlan_find_mac(vxlan, eth->h_dest)) == NULL)
> +               return vxlan->gaddr;
> +       else
> +               return f->remote_ip;
> +}

Bikeshedding:

This might be simpler to read with a few more lines like:

static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb)
{
	const struct ethhdr *eth = (const struct ethhdr *)skb->data;
	struct vxlan_fdb *f;

	if (is_multicast_ether_addr(eth->h_dest))
		return vxlan->gaddr;

	f = vxlan_find_mac(vxlan, eth->h_dest);
	if (!f)
		return vxlan->gaddr;

	return f->remote_ip;
}

^ permalink raw reply

* Re: [PATCH 1/6] vxlan: minor output refactoring
From: Stephen Hemminger @ 2012-10-09 18:29 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Miller, netdev
In-Reply-To: <1349807275.2386.14.camel@joe-AO722>

On Tue, 09 Oct 2012 11:27:55 -0700
Joe Perches <joe@perches.com> wrote:

> On Tue, 2012-10-09 at 10:56 -0700, Stephen Hemminger wrote:
> > +static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb)
> > +{
> > +       const struct ethhdr *eth = (struct ethhdr *) skb->data;
> > +       struct vxlan_fdb *f;
> > +
> > +       if (is_multicast_ether_addr(eth->h_dest) ||
> > +           (f = vxlan_find_mac(vxlan, eth->h_dest)) == NULL)
> > +               return vxlan->gaddr;
> > +       else
> > +               return f->remote_ip;
> > +}
> 
> Bikeshedding:
> 
> This might be simpler to read with a few more lines like:
> 
> static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb)
> {
> 	const struct ethhdr *eth = (const struct ethhdr *)skb->data;
> 	struct vxlan_fdb *f;
> 
> 	if (is_multicast_ether_addr(eth->h_dest))
> 		return vxlan->gaddr;
> 
> 	f = vxlan_find_mac(vxlan, eth->h_dest);
> 	if (!f)
> 		return vxlan->gaddr;
> 
> 	return f->remote_ip;
> }
> 

Maybe. Doesn't really matter that much.

^ permalink raw reply

* Re: [PATCH 4/6] VXLAN bases source UDP port based on flow to help the receiver to be able to load balance based on outer header flow.
From: Ben Hutchings @ 2012-10-09 18:38 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20121009175714.682992341@vyatta.com>

On Tue, 2012-10-09 at 10:56 -0700, Stephen Hemminger wrote:
> This patch restricts the port range to the normal UDP local
> ports, and allows overriding via configruation.
> 
> It also uses jhash of Ethernet header when looking at flows
> with out know L3 header.
[...]
> +/* Compute source port for outgoing packet
> + *   first choice to use L4 flow hash since it will spread
> + *     better and maybe available from hardware
> + *   secondary choice is to use jhash on the Ethernet header
> + */
> +static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb)
> +{
> +	unsigned int range = (vxlan->port_max - vxlan->port_min) + 1;
> +	u32 hash;
> +
> +	hash = skb_get_rxhash(skb);
> +	if (!hash)
> +		hash = jhash(skb->data, 2 * ETH_ALEN,
> +			     (__force u32) skb->protocol);
> +
> +	return (((u64) hash * range) >> 32) + vxlan->port_min;
> +}
[...]
> @@ -1021,6 +1046,18 @@ static int vxlan_validate(struct nlattr
>  			return -EADDRNOTAVAIL;
>  		}
>  	}
> +
> +	if (data[IFLA_VXLAN_PORT_RANGE]) {
> +		const struct ifla_vxlan_port_range *p
> +			= nla_data(data[IFLA_VXLAN_PORT_RANGE]);
> +
> +		if ((int)(ntohs(p->high) - ntohs(p->low)) < 1) {
[...]

This seems to be off-by-one - both bounds are inclusive so they can be
equal.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* pull request: wireless 2012-10-09
From: John W. Linville @ 2012-10-09 18:38 UTC (permalink / raw)
  To: davem; +Cc: linux-wireless, netdev, linux-kernel

commit c3e7724b6bc2f25e46c38dbe68f09d71fafeafb8

Dave,

Here is a batch of fixes intended for 3.7...

Amitkumar Karwar provides a couple of mwifiex fixes to correctly
report some reason codes for certain connection failures.  He also
provides a fix to cleanup after a scanning failure.  Bing Zhao rounds
that out with another mwifiex scanning fix.

Daniel Golle gives us a fix for a copy/paste error in rt2x00.

Felix Fietkau brings a couple of ath9k fixes related to suspend/resume,
and a couple of fixes to prevent memory leaks in ath9k and mac80211.

Ronald Wahl sends a carl9170 fix for a sleep in softirq context.

Thomas Pedersen reorders some code to prevent drv_get_tsf from being
called while holding a spinlock, now that it can sleep.

Finally, Wei Yongjun prevents a NULL pointer dereference in the
ath5k driver.

Please let me know if there are problems!

Thanks,

John

---

The following changes since commit 6825a26c2dc21eb4f8df9c06d3786ddec97cf53b:

  ipv6: release reference of ip6_null_entry's dst entry in __ip6_del_rt (2012-10-04 16:00:07 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git tags/master-2012-10-08

for you to fetch changes up to c3e7724b6bc2f25e46c38dbe68f09d71fafeafb8:

  mac80211: use ieee80211_free_txskb to fix possible skb leaks (2012-10-08 15:06:05 -0400)

----------------------------------------------------------------
Amitkumar Karwar (3):
      mwifiex: reset scan_processing flag in failure cases
      mwifiex: update cfg80211 with correct reason code when association fails
      mwifiex: update cfg80211 with correct reason code when connection is lost

Bing Zhao (1):
      mwifiex: return -EBUSY if scan request cannot be honored

Daniel Golle (1):
      rt2x00/rt3352: Fix lnagain assignment to use register 66.

Felix Fietkau (4):
      ath9k: fix ASPM initialization on resume
      ath9k: improve suspend/resume reliability
      ath9k: use ieee80211_free_txskb
      mac80211: use ieee80211_free_txskb to fix possible skb leaks

Ronald Wahl (1):
      carl9170: fix sleep in softirq context

Thomas Pedersen (1):
      mac80211: call drv_get_tsf() in sleepable context

Wei Yongjun (1):
      ath5k: fix potential NULL pointer dereference in ath5k_beacon_update()

 drivers/net/wireless/ath/ath5k/base.c        |  3 +-
 drivers/net/wireless/ath/ath9k/beacon.c      |  2 +-
 drivers/net/wireless/ath/ath9k/hw.c          |  5 +++
 drivers/net/wireless/ath/ath9k/hw.h          |  1 +
 drivers/net/wireless/ath/ath9k/main.c        | 15 +++-----
 drivers/net/wireless/ath/ath9k/pci.c         |  7 ++++
 drivers/net/wireless/ath/ath9k/xmit.c        | 53 +++++++++++++++-------------
 drivers/net/wireless/ath/carl9170/carl9170.h |  1 +
 drivers/net/wireless/ath/carl9170/main.c     | 29 ++++++++-------
 drivers/net/wireless/mwifiex/cfg80211.c      | 27 ++++++++++----
 drivers/net/wireless/mwifiex/join.c          |  6 ++--
 drivers/net/wireless/mwifiex/main.h          |  2 +-
 drivers/net/wireless/mwifiex/scan.c          | 38 +++++++++++---------
 drivers/net/wireless/mwifiex/sta_cmdresp.c   |  4 +--
 drivers/net/wireless/mwifiex/sta_event.c     | 31 ++++++++++------
 drivers/net/wireless/rt2x00/rt2800lib.c      |  4 +--
 net/mac80211/mesh_sync.c                     |  3 +-
 net/mac80211/status.c                        |  4 +--
 net/mac80211/tx.c                            | 22 ++++++------
 19 files changed, 151 insertions(+), 106 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 9fd6d9a..9f31cfa 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1804,7 +1804,7 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
 	int ret;
 	struct ath5k_hw *ah = hw->priv;
-	struct ath5k_vif *avf = (void *)vif->drv_priv;
+	struct ath5k_vif *avf;
 	struct sk_buff *skb;
 
 	if (WARN_ON(!vif)) {
@@ -1819,6 +1819,7 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 		goto out;
 	}
 
+	avf = (void *)vif->drv_priv;
 	ath5k_txbuf_free_skb(ah, avf->bbuf);
 	avf->bbuf->skb = skb;
 	ret = ath5k_beacon_setup(ah, avf->bbuf);
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 76f07d8..1b48414 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -120,7 +120,7 @@ static void ath9k_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
 
 	if (ath_tx_start(hw, skb, &txctl) != 0) {
 		ath_dbg(common, XMIT, "CABQ TX failed\n");
-		dev_kfree_skb_any(skb);
+		ieee80211_free_txskb(hw, skb);
 	}
 }
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index f9a6ec5..8e1559a 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1450,9 +1450,14 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
 	REG_WRITE(ah, AR_RTC_FORCE_WAKE,
 		  AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT);
 
+	if (!ah->reset_power_on)
+		type = ATH9K_RESET_POWER_ON;
+
 	switch (type) {
 	case ATH9K_RESET_POWER_ON:
 		ret = ath9k_hw_set_reset_power_on(ah);
+		if (!ret)
+			ah->reset_power_on = true;
 		break;
 	case ATH9K_RESET_WARM:
 	case ATH9K_RESET_COLD:
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 566a4ce..dbc1b7a 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -741,6 +741,7 @@ struct ath_hw {
 	u32 rfkill_polarity;
 	u32 ah_flags;
 
+	bool reset_power_on;
 	bool htc_reset_init;
 
 	enum nl80211_iftype opmode;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 31ab82e..dd45edf 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -639,8 +639,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
 		ath_err(common,
 			"Unable to reset hardware; reset status %d (freq %u MHz)\n",
 			r, curchan->center_freq);
-		spin_unlock_bh(&sc->sc_pcu_lock);
-		goto mutex_unlock;
+		ah->reset_power_on = false;
 	}
 
 	/* Setup our intr mask. */
@@ -665,11 +664,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	clear_bit(SC_OP_INVALID, &sc->sc_flags);
 	sc->sc_ah->is_monitoring = false;
 
-	if (!ath_complete_reset(sc, false)) {
-		r = -EIO;
-		spin_unlock_bh(&sc->sc_pcu_lock);
-		goto mutex_unlock;
-	}
+	if (!ath_complete_reset(sc, false))
+		ah->reset_power_on = false;
 
 	if (ah->led_pin >= 0) {
 		ath9k_hw_cfg_output(ah, ah->led_pin,
@@ -688,12 +684,11 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en)
 		common->bus_ops->extn_synch_en(common);
 
-mutex_unlock:
 	mutex_unlock(&sc->mutex);
 
 	ath9k_ps_restore(sc);
 
-	return r;
+	return 0;
 }
 
 static void ath9k_tx(struct ieee80211_hw *hw,
@@ -770,7 +765,7 @@ static void ath9k_tx(struct ieee80211_hw *hw,
 
 	return;
 exit:
-	dev_kfree_skb_any(skb);
+	ieee80211_free_txskb(hw, skb);
 }
 
 static void ath9k_stop(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 0e630a9..f088f4b 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -324,6 +324,10 @@ static int ath_pci_suspend(struct device *device)
 static int ath_pci_resume(struct device *device)
 {
 	struct pci_dev *pdev = to_pci_dev(device);
+	struct ieee80211_hw *hw = pci_get_drvdata(pdev);
+	struct ath_softc *sc = hw->priv;
+	struct ath_hw *ah = sc->sc_ah;
+	struct ath_common *common = ath9k_hw_common(ah);
 	u32 val;
 
 	/*
@@ -335,6 +339,9 @@ static int ath_pci_resume(struct device *device)
 	if ((val & 0x0000ff00) != 0)
 		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
 
+	ath_pci_aspm_init(common);
+	ah->reset_power_on = false;
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 36618e3..378bd70 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -66,8 +66,7 @@ static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
 					   struct ath_txq *txq,
 					   struct ath_atx_tid *tid,
-					   struct sk_buff *skb,
-					   bool dequeue);
+					   struct sk_buff *skb);
 
 enum {
 	MCS_HT20,
@@ -176,7 +175,15 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
 		fi = get_frame_info(skb);
 		bf = fi->bf;
 
-		if (bf && fi->retries) {
+		if (!bf) {
+			bf = ath_tx_setup_buffer(sc, txq, tid, skb);
+			if (!bf) {
+				ieee80211_free_txskb(sc->hw, skb);
+				continue;
+			}
+		}
+
+		if (fi->retries) {
 			list_add_tail(&bf->list, &bf_head);
 			ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
 			ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
@@ -785,10 +792,13 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
 		fi = get_frame_info(skb);
 		bf = fi->bf;
 		if (!fi->bf)
-			bf = ath_tx_setup_buffer(sc, txq, tid, skb, true);
+			bf = ath_tx_setup_buffer(sc, txq, tid, skb);
 
-		if (!bf)
+		if (!bf) {
+			__skb_unlink(skb, &tid->buf_q);
+			ieee80211_free_txskb(sc->hw, skb);
 			continue;
+		}
 
 		bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
 		seqno = bf->bf_state.seqno;
@@ -1731,9 +1741,11 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
 		return;
 	}
 
-	bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
-	if (!bf)
+	bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
+	if (!bf) {
+		ieee80211_free_txskb(sc->hw, skb);
 		return;
+	}
 
 	bf->bf_state.bf_type = BUF_AMPDU;
 	INIT_LIST_HEAD(&bf_head);
@@ -1757,11 +1769,6 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
 	struct ath_buf *bf;
 
 	bf = fi->bf;
-	if (!bf)
-		bf = ath_tx_setup_buffer(sc, txq, tid, skb, false);
-
-	if (!bf)
-		return;
 
 	INIT_LIST_HEAD(&bf_head);
 	list_add_tail(&bf->list, &bf_head);
@@ -1839,8 +1846,7 @@ u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
 					   struct ath_txq *txq,
 					   struct ath_atx_tid *tid,
-					   struct sk_buff *skb,
-					   bool dequeue)
+					   struct sk_buff *skb)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_frame_info *fi = get_frame_info(skb);
@@ -1852,7 +1858,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
 	bf = ath_tx_get_buffer(sc);
 	if (!bf) {
 		ath_dbg(common, XMIT, "TX buffers are full\n");
-		goto error;
+		return NULL;
 	}
 
 	ATH_TXBUF_RESET(bf);
@@ -1881,18 +1887,12 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
 		ath_err(ath9k_hw_common(sc->sc_ah),
 			"dma_mapping_error() on TX\n");
 		ath_tx_return_buffer(sc, bf);
-		goto error;
+		return NULL;
 	}
 
 	fi->bf = bf;
 
 	return bf;
-
-error:
-	if (dequeue)
-		__skb_unlink(skb, &tid->buf_q);
-	dev_kfree_skb_any(skb);
-	return NULL;
 }
 
 /* FIXME: tx power */
@@ -1921,9 +1921,14 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
 		 */
 		ath_tx_send_ampdu(sc, tid, skb, txctl);
 	} else {
-		bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
-		if (!bf)
+		bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
+		if (!bf) {
+			if (txctl->paprd)
+				dev_kfree_skb_any(skb);
+			else
+				ieee80211_free_txskb(sc->hw, skb);
 			return;
+		}
 
 		bf->bf_state.bfs_paprd = txctl->paprd;
 
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h
index 2aa4a59..2df17f1 100644
--- a/drivers/net/wireless/ath/carl9170/carl9170.h
+++ b/drivers/net/wireless/ath/carl9170/carl9170.h
@@ -303,6 +303,7 @@ struct ar9170 {
 	unsigned long queue_stop_timeout[__AR9170_NUM_TXQ];
 	unsigned long max_queue_stop_timeout[__AR9170_NUM_TXQ];
 	bool needs_full_reset;
+	bool force_usb_reset;
 	atomic_t pending_restarts;
 
 	/* interface mode settings */
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 67997b3..25a1e2f 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -465,27 +465,26 @@ static void carl9170_restart_work(struct work_struct *work)
 {
 	struct ar9170 *ar = container_of(work, struct ar9170,
 					 restart_work);
-	int err;
+	int err = -EIO;
 
 	ar->usedkeys = 0;
 	ar->filter_state = 0;
 	carl9170_cancel_worker(ar);
 
 	mutex_lock(&ar->mutex);
-	err = carl9170_usb_restart(ar);
-	if (net_ratelimit()) {
-		if (err) {
-			dev_err(&ar->udev->dev, "Failed to restart device "
-				" (%d).\n", err);
-		 } else {
-			dev_info(&ar->udev->dev, "device restarted "
-				 "successfully.\n");
+	if (!ar->force_usb_reset) {
+		err = carl9170_usb_restart(ar);
+		if (net_ratelimit()) {
+			if (err)
+				dev_err(&ar->udev->dev, "Failed to restart device (%d).\n", err);
+			else
+				dev_info(&ar->udev->dev, "device restarted successfully.\n");
 		}
 	}
-
 	carl9170_zap_queues(ar);
 	mutex_unlock(&ar->mutex);
-	if (!err) {
+
+	if (!err && !ar->force_usb_reset) {
 		ar->restart_counter++;
 		atomic_set(&ar->pending_restarts, 0);
 
@@ -526,10 +525,10 @@ void carl9170_restart(struct ar9170 *ar, const enum carl9170_restart_reasons r)
 	if (!ar->registered)
 		return;
 
-	if (IS_ACCEPTING_CMD(ar) && !ar->needs_full_reset)
-		ieee80211_queue_work(ar->hw, &ar->restart_work);
-	else
-		carl9170_usb_reset(ar);
+	if (!IS_ACCEPTING_CMD(ar) || ar->needs_full_reset)
+		ar->force_usb_reset = true;
+
+	ieee80211_queue_work(ar->hw, &ar->restart_work);
 
 	/*
 	 * At this point, the device instance might have vanished/disabled.
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 2691620..0679458 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1596,8 +1596,9 @@ done:
 		}
 	}
 
-	if (mwifiex_bss_start(priv, bss, &req_ssid))
-		return -EFAULT;
+	ret = mwifiex_bss_start(priv, bss, &req_ssid);
+	if (ret)
+		return ret;
 
 	if (mode == NL80211_IFTYPE_ADHOC) {
 		/* Inform the BSS information to kernel, otherwise
@@ -1652,9 +1653,19 @@ done:
 			"info: association to bssid %pM failed\n",
 			priv->cfg_bssid);
 		memset(priv->cfg_bssid, 0, ETH_ALEN);
+
+		if (ret > 0)
+			cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
+						NULL, 0, NULL, 0, ret,
+						GFP_KERNEL);
+		else
+			cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
+						NULL, 0, NULL, 0,
+						WLAN_STATUS_UNSPECIFIED_FAILURE,
+						GFP_KERNEL);
 	}
 
-	return ret;
+	return 0;
 }
 
 /*
@@ -1802,7 +1813,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 {
 	struct net_device *dev = request->wdev->netdev;
 	struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
-	int i, offset;
+	int i, offset, ret;
 	struct ieee80211_channel *chan;
 	struct ieee_types_header *ie;
 
@@ -1855,8 +1866,12 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 
 		priv->user_scan_cfg->chan_list[i].scan_time = 0;
 	}
-	if (mwifiex_scan_networks(priv, priv->user_scan_cfg))
-		return -EFAULT;
+
+	ret = mwifiex_scan_networks(priv, priv->user_scan_cfg);
+	if (ret) {
+		dev_err(priv->adapter->dev, "scan failed: %d\n", ret);
+		return ret;
+	}
 
 	if (request->ie && request->ie_len) {
 		for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) {
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 82e63ce..7b0858a 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -1180,16 +1180,18 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
 	struct mwifiex_adapter *adapter = priv->adapter;
 	struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result;
 	struct mwifiex_bssdescriptor *bss_desc;
+	u16 reason_code;
 
 	adhoc_result = &resp->params.adhoc_result;
 
 	bss_desc = priv->attempted_bss_desc;
 
 	/* Join result code 0 --> SUCCESS */
-	if (le16_to_cpu(resp->result)) {
+	reason_code = le16_to_cpu(resp->result);
+	if (reason_code) {
 		dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n");
 		if (priv->media_connected)
-			mwifiex_reset_connect_state(priv);
+			mwifiex_reset_connect_state(priv, reason_code);
 
 		memset(&priv->curr_bss_params.bss_descriptor,
 		       0x00, sizeof(struct mwifiex_bssdescriptor));
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index bfb3fa6..c2d0ab1 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -847,7 +847,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
 				 struct mwifiex_bssdescriptor *bss_desc);
 int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
 				 struct host_cmd_ds_command *resp);
-void mwifiex_reset_connect_state(struct mwifiex_private *priv);
+void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason);
 u8 mwifiex_band_to_radio_type(u8 band);
 int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
 int mwifiex_adhoc_start(struct mwifiex_private *priv,
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index e36a759..00b658d 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1296,7 +1296,7 @@ mwifiex_radio_type_to_band(u8 radio_type)
 int mwifiex_scan_networks(struct mwifiex_private *priv,
 			  const struct mwifiex_user_scan_cfg *user_scan_in)
 {
-	int ret = 0;
+	int ret;
 	struct mwifiex_adapter *adapter = priv->adapter;
 	struct cmd_ctrl_node *cmd_node;
 	union mwifiex_scan_cmd_config_tlv *scan_cfg_out;
@@ -1309,25 +1309,26 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
 	unsigned long flags;
 
 	if (adapter->scan_processing) {
-		dev_dbg(adapter->dev, "cmd: Scan already in process...\n");
-		return ret;
+		dev_err(adapter->dev, "cmd: Scan already in process...\n");
+		return -EBUSY;
 	}
 
-	spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
-	adapter->scan_processing = true;
-	spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
-
 	if (priv->scan_block) {
-		dev_dbg(adapter->dev,
+		dev_err(adapter->dev,
 			"cmd: Scan is blocked during association...\n");
-		return ret;
+		return -EBUSY;
 	}
 
+	spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
+	adapter->scan_processing = true;
+	spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
+
 	scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv),
 								GFP_KERNEL);
 	if (!scan_cfg_out) {
 		dev_err(adapter->dev, "failed to alloc scan_cfg_out\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto done;
 	}
 
 	buf_size = sizeof(struct mwifiex_chan_scan_param_set) *
@@ -1336,7 +1337,8 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
 	if (!scan_chan_list) {
 		dev_err(adapter->dev, "failed to alloc scan_chan_list\n");
 		kfree(scan_cfg_out);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto done;
 	}
 
 	mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config,
@@ -1364,14 +1366,16 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
 			spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
 					       flags);
 		}
-	} else {
-		spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
-		adapter->scan_processing = true;
-		spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
 	}
 
 	kfree(scan_cfg_out);
 	kfree(scan_chan_list);
+done:
+	if (ret) {
+		spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
+		adapter->scan_processing = false;
+		spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
+	}
 	return ret;
 }
 
@@ -1430,8 +1434,8 @@ int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
 			ret = mwifiex_is_network_compatible(priv, bss_desc,
 							    priv->bss_mode);
 			if (ret)
-				dev_err(priv->adapter->dev, "cannot find ssid "
-					"%s\n", bss_desc->ssid.ssid);
+				dev_err(priv->adapter->dev,
+					"Incompatible network settings\n");
 			break;
 		default:
 			ret = 0;
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index e380171..09e6a26 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -545,7 +545,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
 	if (!memcmp(resp->params.deauth.mac_addr,
 		    &priv->curr_bss_params.bss_descriptor.mac_address,
 		    sizeof(resp->params.deauth.mac_addr)))
-		mwifiex_reset_connect_state(priv);
+		mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
 
 	return 0;
 }
@@ -558,7 +558,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
 static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv,
 					  struct host_cmd_ds_command *resp)
 {
-	mwifiex_reset_connect_state(priv);
+	mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
 	return 0;
 }
 
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c
index aafde30..8132119 100644
--- a/drivers/net/wireless/mwifiex/sta_event.c
+++ b/drivers/net/wireless/mwifiex/sta_event.c
@@ -41,7 +41,7 @@
  *      - Sends a disconnect event to upper layers/applications.
  */
 void
-mwifiex_reset_connect_state(struct mwifiex_private *priv)
+mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code)
 {
 	struct mwifiex_adapter *adapter = priv->adapter;
 
@@ -117,10 +117,10 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv)
 	priv->media_connected = false;
 	dev_dbg(adapter->dev,
 		"info: successfully disconnected from %pM: reason code %d\n",
-		priv->cfg_bssid, WLAN_REASON_DEAUTH_LEAVING);
+		priv->cfg_bssid, reason_code);
 	if (priv->bss_mode == NL80211_IFTYPE_STATION) {
-		cfg80211_disconnected(priv->netdev, WLAN_REASON_DEAUTH_LEAVING,
-				      NULL, 0, GFP_KERNEL);
+		cfg80211_disconnected(priv->netdev, reason_code, NULL, 0,
+				      GFP_KERNEL);
 	}
 	memset(priv->cfg_bssid, 0, ETH_ALEN);
 
@@ -186,7 +186,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
 	struct mwifiex_adapter *adapter = priv->adapter;
 	int ret = 0;
 	u32 eventcause = adapter->event_cause;
-	u16 ctrl;
+	u16 ctrl, reason_code;
 
 	switch (eventcause) {
 	case EVENT_DUMMY_HOST_WAKEUP_SIGNAL:
@@ -204,22 +204,31 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
 	case EVENT_DEAUTHENTICATED:
 		dev_dbg(adapter->dev, "event: Deauthenticated\n");
 		adapter->dbg.num_event_deauth++;
-		if (priv->media_connected)
-			mwifiex_reset_connect_state(priv);
+		if (priv->media_connected) {
+			reason_code =
+				le16_to_cpu(*(__le16 *)adapter->event_body);
+			mwifiex_reset_connect_state(priv, reason_code);
+		}
 		break;
 
 	case EVENT_DISASSOCIATED:
 		dev_dbg(adapter->dev, "event: Disassociated\n");
 		adapter->dbg.num_event_disassoc++;
-		if (priv->media_connected)
-			mwifiex_reset_connect_state(priv);
+		if (priv->media_connected) {
+			reason_code =
+				le16_to_cpu(*(__le16 *)adapter->event_body);
+			mwifiex_reset_connect_state(priv, reason_code);
+		}
 		break;
 
 	case EVENT_LINK_LOST:
 		dev_dbg(adapter->dev, "event: Link lost\n");
 		adapter->dbg.num_event_link_lost++;
-		if (priv->media_connected)
-			mwifiex_reset_connect_state(priv);
+		if (priv->media_connected) {
+			reason_code =
+				le16_to_cpu(*(__le16 *)adapter->event_body);
+			mwifiex_reset_connect_state(priv, reason_code);
+		}
 		break;
 
 	case EVENT_PS_SLEEP:
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 540c94f..01dc889 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2252,9 +2252,9 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 	 */
 	if (rt2x00_rt(rt2x00dev, RT3352)) {
 		rt2800_bbp_write(rt2x00dev, 27, 0x0);
-		rt2800_bbp_write(rt2x00dev, 62, 0x26 + rt2x00dev->lna_gain);
+		rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain);
 		rt2800_bbp_write(rt2x00dev, 27, 0x20);
-		rt2800_bbp_write(rt2x00dev, 62, 0x26 + rt2x00dev->lna_gain);
+		rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain);
 	} else {
 		rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
 		rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c
index accfa00..a16b7b4 100644
--- a/net/mac80211/mesh_sync.c
+++ b/net/mac80211/mesh_sync.c
@@ -56,7 +56,6 @@ void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata)
 	u64 tsfdelta;
 
 	spin_lock_bh(&ifmsh->sync_offset_lock);
-
 	if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) {
 		msync_dbg(sdata, "TBTT : max clockdrift=%lld; adjusting\n",
 			  (long long) ifmsh->sync_offset_clockdrift_max);
@@ -69,11 +68,11 @@ void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata)
 		tsfdelta = -beacon_int_fraction;
 		ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction;
 	}
+	spin_unlock_bh(&ifmsh->sync_offset_lock);
 
 	tsf = drv_get_tsf(local, sdata);
 	if (tsf != -1ULL)
 		drv_set_tsf(local, sdata, tsf + tsfdelta);
-	spin_unlock_bh(&ifmsh->sync_offset_lock);
 }
 
 static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 2ce8973..3af0cc4 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -34,7 +34,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
 		skb_queue_len(&local->skb_queue_unreliable);
 	while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT &&
 	       (skb = skb_dequeue(&local->skb_queue_unreliable))) {
-		dev_kfree_skb_irq(skb);
+		ieee80211_free_txskb(hw, skb);
 		tmp--;
 		I802_DEBUG_INC(local->tx_status_drop);
 	}
@@ -159,7 +159,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
 			   "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n",
 			   skb_queue_len(&sta->tx_filtered[ac]),
 			   !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies);
-	dev_kfree_skb(skb);
+	ieee80211_free_txskb(&local->hw, skb);
 }
 
 static void ieee80211_check_pending_bar(struct sta_info *sta, u8 *addr, u8 tid)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e0e0d1d..c9bf83f 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -354,7 +354,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
 			total += skb_queue_len(&sta->ps_tx_buf[ac]);
 			if (skb) {
 				purged++;
-				dev_kfree_skb(skb);
+				ieee80211_free_txskb(&local->hw, skb);
 				break;
 			}
 		}
@@ -466,7 +466,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
 			ps_dbg(tx->sdata,
 			       "STA %pM TX buffer for AC %d full - dropping oldest frame\n",
 			       sta->sta.addr, ac);
-			dev_kfree_skb(old);
+			ieee80211_free_txskb(&local->hw, old);
 		} else
 			tx->local->total_ps_buffered++;
 
@@ -1103,7 +1103,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
 		spin_unlock(&tx->sta->lock);
 
 		if (purge_skb)
-			dev_kfree_skb(purge_skb);
+			ieee80211_free_txskb(&tx->local->hw, purge_skb);
 	}
 
 	/* reset session timer */
@@ -1214,7 +1214,7 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local,
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
 		if (WARN_ON_ONCE(q >= local->hw.queues)) {
 			__skb_unlink(skb, skbs);
-			dev_kfree_skb(skb);
+			ieee80211_free_txskb(&local->hw, skb);
 			continue;
 		}
 #endif
@@ -1356,7 +1356,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
 	if (unlikely(res == TX_DROP)) {
 		I802_DEBUG_INC(tx->local->tx_handlers_drop);
 		if (tx->skb)
-			dev_kfree_skb(tx->skb);
+			ieee80211_free_txskb(&tx->local->hw, tx->skb);
 		else
 			__skb_queue_purge(&tx->skbs);
 		return -1;
@@ -1393,7 +1393,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
 	res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
 
 	if (unlikely(res_prepare == TX_DROP)) {
-		dev_kfree_skb(skb);
+		ieee80211_free_txskb(&local->hw, skb);
 		goto out;
 	} else if (unlikely(res_prepare == TX_QUEUED)) {
 		goto out;
@@ -1465,7 +1465,7 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
 	headroom = max_t(int, 0, headroom);
 
 	if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) {
-		dev_kfree_skb(skb);
+		ieee80211_free_txskb(&local->hw, skb);
 		rcu_read_unlock();
 		return;
 	}
@@ -2050,8 +2050,10 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 		head_need += IEEE80211_ENCRYPT_HEADROOM;
 		head_need += local->tx_headroom;
 		head_need = max_t(int, 0, head_need);
-		if (ieee80211_skb_resize(sdata, skb, head_need, true))
-			goto fail;
+		if (ieee80211_skb_resize(sdata, skb, head_need, true)) {
+			ieee80211_free_txskb(&local->hw, skb);
+			return NETDEV_TX_OK;
+		}
 	}
 
 	if (encaps_data) {
@@ -2184,7 +2186,7 @@ void ieee80211_tx_pending(unsigned long data)
 			struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 
 			if (WARN_ON(!info->control.vif)) {
-				kfree_skb(skb);
+				ieee80211_free_txskb(&local->hw, skb);
 				continue;
 			}
 
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply related

* Re: [PATCH V1 2/3] net/mlx4_core: Read HCA frequency and map internal clock
From: Or Gerlitz @ 2012-10-09 19:31 UTC (permalink / raw)
  To: Joe Perches; +Cc: Or Gerlitz, davem, netdev, Eugenia Emantayev
In-Reply-To: <1349801661.2386.8.camel@joe-AO722>

On Tue, Oct 9, 2012 at 6:54 PM, Joe Perches <joe@perches.com> wrote:
> On Tue, 2012-10-09 at 17:20 +0200, Or Gerlitz wrote:
>> Read HCA frequency, read PCI clock bar and offset, map internal clock to PCI bar.
>
> trivial comments below:
>
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
> []
>> @@ -1193,8 +1195,31 @@ static void unmap_bf_area(struct mlx4_dev *dev)
>>               io_mapping_free(mlx4_priv(dev)->bf_mapping);
>>  }
>>
>> +static int map_internal_clock(struct mlx4_dev *dev)
>> +{
>> +     struct mlx4_priv *priv = mlx4_priv(dev);
>> +
>> +     priv->clock_mapping = ioremap(pci_resource_start(dev->pdev,
>> +                             priv->fw.clock_bar) +
>> +                             priv->fw.clock_offset, MLX4_CLOCK_SIZE);
>
> I think this is misleading indentation style.

sure, we know what needs to be here, I was under a probably
misconception that checkpatch --strict catches this, thanks for
pointing out


> Perhaps this'd be nicer as something like:
>
>         priv->clock_mapping =
>                 ioremap(pci_resource_start(dev->pdev, priv->fw.clock_bar) +
>                         priv->fw.clock_offset, MLX4_CLOCK_SIZE);
>
> []
>
>> +                     /* In case we got HCA frequency 0 - disable timestamping
>> +                      * to avoid dividing by zero
>> +                      */
>> +                     if (!dev->caps.hca_core_clock) {
>> +                             dev->caps.flags2 &= ~MLX4_DEV_CAP_FLAG2_TS;
>> +                             mlx4_err(dev, "HCA frequency is 0. " \
>> +                                      "Timestamping is not supported.");
>
> These are missing terminating newlines.

OK, will fix


> Please don't split format strings like this.  It's hard to grep.
> Especially please don't use unnecessary line continuations.
> The compiler will concatenate these strings without the \.
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: 3.4.1 and 3.5-rc1 Packet lost at 250Mb/s
From: Nieścierowicz Adam @ 2012-10-09 19:56 UTC (permalink / raw)
  To: Andre Tomt; +Cc: Eric Dumazet, Netdev
In-Reply-To: <5072CE29.5010504@tomt.net>

W dniu 08.10.2012 14:59, Andre Tomt napisał(a):

> On 08. okt. 2012 14:32, Andre Tomt wrote:
>
>> On 08. okt. 2012 14:13, Eric Dumazet wrote:
>>
>>> On Mon, 2012-10-08 at 14:00 +0200, Andre Tomt wrote:
>>>
>>>> On 08. okt. 2012 12:49, Nieścierowicz Adam wrote:
>>>>
>>>>> W dniu 08.10.2012 11:47, Eric Dumazet napisał(a):
>>>>>
>>>>>> Anyway you dont say where are drops, (ifconfig give us very few
>>>>>> drops)
>>>>> you can see no losses(drop), but a temporary decline in traffic
>>>>> on the interface to 0kb/s
>>>> This sounds very familiar, could it be something similar to:
>>>> http://marc.info/?l=linux-netdev&m=134594936016796&w=3 [1] The 
>>>> chip
>>>> seems to be of the same family (though not model)
>>> Yes, but Adam says 3.4.1 already has a problem, while commit
>>> 2cb7a9cc008c25dc03314de563c00c107b3e5432 is in 3.5 only. Since Adam
>>> uses Intel e1000e, it could be the BQL related problem.
>> The other chips have had DMA burst flag enabled for longer, so that 
>> he
>> sees the same problem in 3.4 while I'm not makes sense. Hmm, as 3.4 
>> is
>> when BQL went in (IIRC) it seems very likely that this BQL issue is 
>> the
>> problem for both of us.
>
> To clarify; I think the DMA burst flag in the driver triggers the BQL
> related issue. Judging by the patchwork link for wthresh=1 this seems
> very related indeed.
>
> Removing the FLAG2_DMA_BURST flag for 82574 in the driver works for 
> me.
> Adam, it might be worth testing out a build on your system too with 
> the
> flag removed. If you try the attached patch (for 3.6, probably OK for
> 3.5) and the problem dissapears, we are probably at least talking 
> about
> the same bug.

after applying the patch everything looks good, no visible loss

Do you expect to correct the bug in mainline?

^ permalink raw reply

* Re: [PATCH net] e1000e: Change wthresh to 1 to avoid possible Tx stalls.
From: Eric Dumazet @ 2012-10-09 21:02 UTC (permalink / raw)
  To: Jesse Brandeburg; +Cc: Frank Reppin, netdev, Jeff Kirsher, e1000-devel
In-Reply-To: <20121009103629.0000569a@unknown>

On Tue, 2012-10-09 at 10:36 -0700, Jesse Brandeburg wrote:
> > > > Jesse did not share any performance numbers with me, I am sure he can
> > > > give some background tomorrow when he is back online.
> > > > 
> > > > I am working on an alternative patch now and should have something to
> > > > share tomorrow.
> > > Please allow me to ask if there's any progess here?
> > > 
> > > I've tried 3.5.4 a couple of days ago on a SuperMicro X8SIE-LN4 (82574L)
> > > and could still observe severe latency (up to 3000ms) spikes.
> > > 
> > > Applying Hiroakis suggested patch did fix this for me as well.
> > > [please note as well that I didn't had this issue in any 3.4.x kernel
> > > before - so +1 for fixing the regression]
> 
> I'm not sure what went wrong internally here that this hasn't been
> fixed, and I'm personally embarrassed.  I am working on it until I have
> a patch/solution.
> 
> currently am trying to reproduce the issue, am in some weird how to
> use BQL limbo, the lack of documentation on user usage of BQL is slowing
> me down.
> 

BQL is blocking qdisc from delivering additional packet to TX as long as
previous packets were not completed. Not sure what you want to know
about BQL.

> Hints or clues (I'm trying to follow the repro steps mentioned in
> some related threads) are appreciated.


Problem is BQL depends on TX completion being done in a reasonable time.

It seems e1000e can hold an skb in TX ring for up to 3000ms (not
reasonable it seems)

Aggregation / coalescing is fine, as long as we dont hold a packet too
long, in case no other packet follows.

^ permalink raw reply

* Re: [PATCH net] e1000e: Change wthresh to 1 to avoid possible Tx stalls.
From: Andre Tomt @ 2012-10-09 22:48 UTC (permalink / raw)
  To: Jesse Brandeburg
  Cc: Eric Dumazet, Frank Reppin, netdev, Jeff Kirsher, e1000-devel
In-Reply-To: <20121009103629.0000569a@unknown>

On 09. okt. 2012 19:36, Jesse Brandeburg wrote:
> I'm not sure what went wrong internally here that this hasn't been
> fixed, and I'm personally embarrassed.  I am working on it until I have
> a patch/solution.
>
> currently am trying to reproduce the issue, am in some weird how to
> use BQL limbo, the lack of documentation on user usage of BQL is slowing
> me down.
>
> Hints or clues (I'm trying to follow the repro steps mentioned in
> some related threads) are appreciated.

I found it simplest to reproduce when doing forwarding, and *not* 
saturating the interface doing the TX. 100Mbps forwarding on gigabit 
link triggered it in seconds. Doing gigabit forwarding speeds (~980Mbps) 
did not trigger anything.

Setup looked somewhat like this, GE beeing gigabit link, FE 100Mbps;

reciever PC (iperf -s)
     |
     GE
     |
    eth0   <- TX lockups
router with 2*e1000e
    eth1
     |
     GE
     |
switch
     |
     FE
     |
source PC (iperf -c recieverPC)

I don't recall all the details anymore, but I'm fairly certain I didnt 
use any non-default qdiscs to reproduce - eg just pfifo_fast (usually 
doing fq_codel though).

For the bug to manifest itself was somewhat dependent on GRO and TSO in 
kernel 3.5, but with 3.6 it didnt matter anymore (at least the rc's).

^ permalink raw reply

* [PATCH net] netfilter: nf_conntrack: fix rt_gateway checks for h323
From: Julian Anastasov @ 2012-10-09 23:00 UTC (permalink / raw)
  To: netfilter-devel; +Cc: netdev

	After the change "Adjust semantics of rt->rt_gateway"
(commit f8126f1d51) we should properly match the nexthop when
destinations are directly connected because rt_gateway can be 0.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
---

	This patch needs a closer look from the Netfilter team.

	It restores the check as it was committed originally,
i.e. to compare nexthops. I'm not sure what is the desired logic,
it can depend on the following:

- two directly connected hosts (rt_gateway=0) can be from different
subnets or not

- one party A is the gateway (rt_gateway=0), another party uses
this gateway (rt_gateway=A)

	May be someone that knows this code better can comment
if the check should be different.

 net/netfilter/nf_conntrack_h323_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c
index 1b30b0d..962795e 100644
--- a/net/netfilter/nf_conntrack_h323_main.c
+++ b/net/netfilter/nf_conntrack_h323_main.c
@@ -753,7 +753,8 @@ static int callforward_do_filter(const union nf_inet_addr *src,
 				   flowi4_to_flowi(&fl1), false)) {
 			if (!afinfo->route(&init_net, (struct dst_entry **)&rt2,
 					   flowi4_to_flowi(&fl2), false)) {
-				if (rt1->rt_gateway == rt2->rt_gateway &&
+				if (rt_nexthop(rt1, fl1.daddr) ==
+				    rt_nexthop(rt2, fl2.daddr) &&
 				    rt1->dst.dev  == rt2->dst.dev)
 					ret = 1;
 				dst_release(&rt2->dst);
-- 
1.7.3.4

^ permalink raw reply related

* [net:master 6/7] mdio-gpio.c:(.text+0x58): multiple definition of `of_mdiobus_register'
From: Fengguang Wu @ 2012-10-09 23:28 UTC (permalink / raw)
  To: Mark Brown; +Cc: netdev

Hi Mark,

FYI, kernel build failed on

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
head:   5175a5e76bbdf20a614fb47ce7a38f0f39e70226
commit: 4085a7f0a09c73ef3e9de113c9f04d78c79be645 [6/7] netdev/phy: Prototype of_mdio_find_bus()
config: i386-allyesconfig

All error/warnings:

drivers/net/phy/mdio-gpio.o: In function `of_mdiobus_register':
mdio-gpio.c:(.text+0x58): multiple definition of `of_mdiobus_register'
drivers/net/phy/libphy.o:(.text+0x23d7): first defined here
drivers/net/phy/mdio-gpio.o: In function `of_phy_find_device':
mdio-gpio.c:(.text+0x67): multiple definition of `of_phy_find_device'
drivers/net/phy/libphy.o:(.text+0x23e6): first defined here
drivers/net/phy/mdio-gpio.o: In function `of_phy_connect':
mdio-gpio.c:(.text+0x73): multiple definition of `of_phy_connect'
drivers/net/phy/libphy.o:(.text+0x23f2): first defined here
drivers/net/phy/mdio-gpio.o: In function `of_phy_connect_fixed_link':
mdio-gpio.c:(.text+0x7f): multiple definition of `of_phy_connect_fixed_link'
drivers/net/phy/libphy.o:(.text+0x23fe): first defined here
drivers/net/phy/mdio-gpio.o: In function `of_mdio_find_bus':
mdio-gpio.c:(.text+0x8b): multiple definition of `of_mdio_find_bus'
drivers/net/phy/libphy.o:(.text+0x240a): first defined here

---
0-DAY kernel build testing backend         Open Source Technology Center
Fengguang Wu, Yuanhan Liu                              Intel Corporation

^ permalink raw reply

* [GIT] Networking
From: David Miller @ 2012-10-10  1:26 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel


1) UAPI changes for networking from David Howells

2) A netlink dump is an operation we can sleep within, and
   therefore we need to make sure the dump provider module
   doesn't disappear on us meanwhile.  Fix from Gao Feng.

3) Now that tunnels support GRO, we have to be more careful
   in skb_gro_reset_offset() otherwise we OOPS, from Eric
   Dumazet.

4) We can end up processing packets for VLANs we aren't
   actually configured to be on, fix from Florian Zumbiehl.

5) Fix routing cache removal regression in redirects and IPVS.  The core
   issue on the IPVS side is that it wants to rewrite who the nexthop
   is and we have to explicitly accomodate that case.  From Julian
   Anastasov.

6) Error code return fixes all over the networking drivers from
   Peter Senna Tschudin.

7) Fix routing cache removal regressions in IPSEC, from Steffen
   Klassert.

8) Fix deadlock in RDS during pings, from Jeff Liu.

9) Neighbour packet queue can trigger skb_under_panic() because we
   do not reset the network header of the SKB in the right spot.
   From Ramesh Nagappa.

Please pull, thanks a lot!

The following changes since commit 547b1e81afe3119f7daf702cc03b158495535a25:

  Fix staging driver use of VM_RESERVED (2012-10-09 21:06:41 +0900)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master

for you to fetch changes up to 5175a5e76bbdf20a614fb47ce7a38f0f39e70226:

  RDS: fix rds-ping spinlock recursion (2012-10-09 13:57:23 -0400)

----------------------------------------------------------------
Ajit Khaparde (1):
      be2net: Remove code that stops further access to BE NIC based on UE bits

Alexander Duyck (1):
      ixgbe/ixgbevf: Limit maximum jumbo frame size to 9.5K to avoid Tx hangs

Bruce Allan (1):
      e1000e: add device IDs for i218

Dan Carpenter (2):
      cxgb4: allocate enough data in t4_memory_rw()
      farsync: fix support for over 30 cards

David Howells (10):
      UAPI: (Scripted) Disintegrate include/linux/caif
      UAPI: (Scripted) Disintegrate include/linux/isdn
      UAPI: (Scripted) Disintegrate include/linux/netfilter
      UAPI: (Scripted) Disintegrate include/linux/netfilter/ipset
      UAPI: (Scripted) Disintegrate include/linux/netfilter_arp
      UAPI: (Scripted) Disintegrate include/linux/netfilter_bridge
      UAPI: (Scripted) Disintegrate include/linux/netfilter_ipv4
      UAPI: (Scripted) Disintegrate include/linux/netfilter_ipv6
      UAPI: (Scripted) Disintegrate include/linux/tc_act
      UAPI: (Scripted) Disintegrate include/linux/tc_ematch

David S. Miller (3):
      Merge git://git.kernel.org/.../torvalds/linux
      Merge tag 'disintegrate-net-20121009' of git://git.infradead.org/users/dhowells/linux-headers
      Merge tag 'disintegrate-isdn-20121009' of git://git.infradead.org/users/dhowells/linux-headers

Eric Dumazet (5):
      net: remove skb recycling
      ipv6: GRO should be ECN friendly
      net: gro: fix a potential crash in skb_gro_reset_offset
      net: gro: selective flush of packets
      ipv6: gro: fix PV6_GRO_CB(skb)->proto problem

Florian Zumbiehl (1):
      vlan: don't deliver frames for unknown vlans to protocols

Gao feng (2):
      netlink: add reference of module in netlink_dump_start
      infiniband: pass rdma_cm module to netlink_dump_start

Graham Gower (1):
      skge: Add DMA mask quirk for Marvell 88E8001 on ASUS P5NSLI motherboard

Greg Rose (1):
      ixgbevf: Set the netdev number of Tx queues

Haicheng Li (1):
      pch_gbe: Fix build error by selecting all the possible dependencies.

Julian Anastasov (6):
      ipv4: fix sending of redirects
      ipv4: fix forwarding for strict source routes
      ipv4: make sure nh_pcpu_rth_output is always allocated
      ipv4: introduce rt_uses_gateway
      ipv4: Add FLOWI_FLAG_KNOWN_NH
      ipvs: fix ARP resolving for direct routing mode

Mark Brown (1):
      netdev/phy: Prototype of_mdio_find_bus()

Michael Neuling (1):
      net: fix typo in freescale/ucc_geth.c

Peter Senna Tschudin (18):
      drivers/net/ethernet/dec/tulip/dmfe.c: fix error return code
      drivers/net/ethernet/natsemi/natsemi.c: fix error return code
      drivers/net/ethernet/sis/sis900.c: fix error return code
      drivers/net/irda/irtty-sir.c: fix error return code
      drivers/net/irda/mcs7780.c: fix error return code
      drivers/net/irda/pxaficp_ir.c: fix error return code
      drivers/net/irda/sa1100_ir.c: fix error return code
      drivers/net/irda/sh_irda.c: fix error return code
      drivers/net/irda/sh_sir.c: fix error return code
      drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c: fix error return code
      drivers/net/ethernet/amd/amd8111e.c: fix error return code
      drivers/net/ethernet/amd/au1000_eth.c: fix error return code
      drivers/net/ethernet/natsemi/xtsonic.c: fix error return code
      drivers/net/ethernet/renesas/sh_eth.c: fix error return code
      drivers/net/ethernet/sun/niu.c: fix error return code
      drivers/net/ethernet/sun/sungem.c: fix error return code
      drivers/net/ethernet/marvell/skge.c: fix error return code
      drivers/net/ethernet/marvell/sky2.c: fix error return code

Steffen Klassert (3):
      ipv4: Always invalidate or update the route on pmtu events
      ipv4: Don't create nh exeption when the device mtu is smaller than the reported pmtu
      ipv4: Don't report stale pmtu values to userspace

Stephen Hemminger (1):
      vxlan: fix more sparse warnings

Vipul Pandya (1):
      cxgb4: Address various sparse warnings

Wei Yongjun (2):
      vxlan: remove unused including <linux/version.h>
      ptp: use list_move instead of list_del/list_add

jeff.liu (1):
      RDS: fix rds-ping spinlock recursion

ramesh.nagappa@gmail.com (1):
      net: Fix skb_under_panic oops in neigh_resolve_output

 drivers/infiniband/core/cma.c                                  |   3 +-
 drivers/infiniband/core/netlink.c                              |   1 +
 drivers/net/ethernet/amd/amd8111e.c                            |   2 +
 drivers/net/ethernet/amd/au1000_eth.c                          |  10 +-
 drivers/net/ethernet/calxeda/xgmac.c                           |  19 +--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h                     |   1 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c                |  54 +++++----
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c                     |  15 ++-
 drivers/net/ethernet/dec/tulip/dmfe.c                          |  12 +-
 drivers/net/ethernet/emulex/benet/be_main.c                    |   7 +-
 drivers/net/ethernet/freescale/gianfar.c                       |  27 +----
 drivers/net/ethernet/freescale/gianfar.h                       |   2 -
 drivers/net/ethernet/freescale/ucc_geth.c                      |  29 +----
 drivers/net/ethernet/freescale/ucc_geth.h                      |   2 -
 drivers/net/ethernet/intel/e1000e/hw.h                         |   2 +
 drivers/net/ethernet/intel/e1000e/netdev.c                     |   2 +
 drivers/net/ethernet/intel/ixgbe/ixgbe.h                       |   2 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf.h                   |   2 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c              |   7 ++
 drivers/net/ethernet/marvell/mv643xx_eth.c                     |  18 +--
 drivers/net/ethernet/marvell/skge.c                            |  13 +-
 drivers/net/ethernet/marvell/sky2.c                            |   5 +-
 drivers/net/ethernet/natsemi/natsemi.c                         |   4 +-
 drivers/net/ethernet/natsemi/xtsonic.c                         |   1 +
 drivers/net/ethernet/oki-semi/pch_gbe/Kconfig                  |   3 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c               |   3 +-
 drivers/net/ethernet/realtek/8139cp.c                          |   2 +-
 drivers/net/ethernet/renesas/sh_eth.c                          |   1 +
 drivers/net/ethernet/sfc/ptp.c                                 |   9 +-
 drivers/net/ethernet/sis/sis900.c                              |   4 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac.h                   |   1 -
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c              |  20 +--
 drivers/net/ethernet/sun/niu.c                                 |   1 +
 drivers/net/ethernet/sun/sungem.c                              |   3 +-
 drivers/net/irda/irtty-sir.c                                   |   4 +-
 drivers/net/irda/mcs7780.c                                     |   4 +-
 drivers/net/irda/pxaficp_ir.c                                  |   4 +-
 drivers/net/irda/sa1100_ir.c                                   |   4 +-
 drivers/net/irda/sh_irda.c                                     |   4 +-
 drivers/net/irda/sh_sir.c                                      |   5 +-
 drivers/net/phy/mdio_bus.c                                     |   1 +
 drivers/net/vxlan.c                                            |   5 +-
 drivers/net/wan/farsync.c                                      |   2 +-
 include/linux/caif/Kbuild                                      |   2 -
 include/linux/if_vlan.h                                        |   8 +-
 include/linux/isdn/Kbuild                                      |   1 -
 include/linux/netdevice.h                                      |  19 +--
 include/linux/netfilter/Kbuild                                 |  77 ------------
 include/linux/netfilter/ipset/Kbuild                           |   4 -
 include/linux/netfilter/ipset/ip_set.h                         | 225 +---------------------------------
 include/linux/netfilter/ipset/ip_set_bitmap.h                  |  11 +-
 include/linux/netfilter/ipset/ip_set_hash.h                    |  19 +--
 include/linux/netfilter/ipset/ip_set_list.h                    |  19 +--
 include/linux/netfilter/nf_conntrack_common.h                  | 115 +-----------------
 include/linux/netfilter/nf_conntrack_ftp.h                     |  16 +--
 include/linux/netfilter/nf_conntrack_tcp.h                     |  49 +-------
 include/linux/netfilter/nfnetlink.h                            |  55 +--------
 include/linux/netfilter/nfnetlink_acct.h                       |  25 +---
 include/linux/netfilter/x_tables.h                             | 186 +---------------------------
 include/linux/netfilter/xt_hashlimit.h                         |  71 +----------
 include/linux/netfilter/xt_physdev.h                           |  21 +---
 include/linux/netfilter_arp/Kbuild                             |   2 -
 include/linux/netfilter_arp/arp_tables.h                       | 200 +-----------------------------
 include/linux/netfilter_bridge/Kbuild                          |  18 ---
 include/linux/netfilter_bridge/ebt_802_3.h                     |  61 +---------
 include/linux/netfilter_bridge/ebtables.h                      | 255 +--------------------------------------
 include/linux/netfilter_ipv4/Kbuild                            |  10 --
 include/linux/netfilter_ipv4/ip_tables.h                       | 218 +--------------------------------
 include/linux/netfilter_ipv6/Kbuild                            |  12 --
 include/linux/netfilter_ipv6/ip6_tables.h                      | 256 +--------------------------------------
 include/linux/netlink.h                                        |  20 ++-
 include/linux/skbuff.h                                         |  24 ----
 include/linux/tc_act/Kbuild                                    |   7 --
 include/linux/tc_ematch/Kbuild                                 |   4 -
 include/net/flow.h                                             |   1 +
 include/net/route.h                                            |   3 +-
 include/rdma/rdma_netlink.h                                    |   1 +
 include/uapi/linux/caif/Kbuild                                 |   2 +
 include/{ => uapi}/linux/caif/caif_socket.h                    |   0
 include/{ => uapi}/linux/caif/if_caif.h                        |   0
 include/uapi/linux/isdn/Kbuild                                 |   1 +
 include/{ => uapi}/linux/isdn/capicmd.h                        |   0
 include/uapi/linux/netfilter/Kbuild                            |  76 ++++++++++++
 include/uapi/linux/netfilter/ipset/Kbuild                      |   4 +
 include/uapi/linux/netfilter/ipset/ip_set.h                    | 231 +++++++++++++++++++++++++++++++++++
 include/uapi/linux/netfilter/ipset/ip_set_bitmap.h             |  13 ++
 include/uapi/linux/netfilter/ipset/ip_set_hash.h               |  21 ++++
 include/uapi/linux/netfilter/ipset/ip_set_list.h               |  21 ++++
 include/uapi/linux/netfilter/nf_conntrack_common.h             | 117 ++++++++++++++++++
 include/uapi/linux/netfilter/nf_conntrack_ftp.h                |  18 +++
 include/{ => uapi}/linux/netfilter/nf_conntrack_sctp.h         |   0
 include/uapi/linux/netfilter/nf_conntrack_tcp.h                |  51 ++++++++
 include/{ => uapi}/linux/netfilter/nf_conntrack_tuple_common.h |   0
 include/{ => uapi}/linux/netfilter/nf_nat.h                    |   0
 include/uapi/linux/netfilter/nfnetlink.h                       |  56 +++++++++
 include/uapi/linux/netfilter/nfnetlink_acct.h                  |  27 +++++
 include/{ => uapi}/linux/netfilter/nfnetlink_compat.h          |   0
 include/{ => uapi}/linux/netfilter/nfnetlink_conntrack.h       |   0
 include/{ => uapi}/linux/netfilter/nfnetlink_cthelper.h        |   0
 include/{ => uapi}/linux/netfilter/nfnetlink_cttimeout.h       |   0
 include/{ => uapi}/linux/netfilter/nfnetlink_log.h             |   0
 include/{ => uapi}/linux/netfilter/nfnetlink_queue.h           |   0
 include/uapi/linux/netfilter/x_tables.h                        | 187 ++++++++++++++++++++++++++++
 include/{ => uapi}/linux/netfilter/xt_AUDIT.h                  |   0
 include/{ => uapi}/linux/netfilter/xt_CHECKSUM.h               |   0
 include/{ => uapi}/linux/netfilter/xt_CLASSIFY.h               |   0
 include/{ => uapi}/linux/netfilter/xt_CONNMARK.h               |   0
 include/{ => uapi}/linux/netfilter/xt_CONNSECMARK.h            |   0
 include/{ => uapi}/linux/netfilter/xt_CT.h                     |   0
 include/{ => uapi}/linux/netfilter/xt_DSCP.h                   |   0
 include/{ => uapi}/linux/netfilter/xt_IDLETIMER.h              |   0
 include/{ => uapi}/linux/netfilter/xt_LED.h                    |   0
 include/{ => uapi}/linux/netfilter/xt_LOG.h                    |   0
 include/{ => uapi}/linux/netfilter/xt_MARK.h                   |   0
 include/{ => uapi}/linux/netfilter/xt_NFLOG.h                  |   0
 include/{ => uapi}/linux/netfilter/xt_NFQUEUE.h                |   0
 include/{ => uapi}/linux/netfilter/xt_RATEEST.h                |   0
 include/{ => uapi}/linux/netfilter/xt_SECMARK.h                |   0
 include/{ => uapi}/linux/netfilter/xt_TCPMSS.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_TCPOPTSTRIP.h            |   0
 include/{ => uapi}/linux/netfilter/xt_TEE.h                    |   0
 include/{ => uapi}/linux/netfilter/xt_TPROXY.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_addrtype.h               |   0
 include/{ => uapi}/linux/netfilter/xt_cluster.h                |   0
 include/{ => uapi}/linux/netfilter/xt_comment.h                |   0
 include/{ => uapi}/linux/netfilter/xt_connbytes.h              |   0
 include/{ => uapi}/linux/netfilter/xt_connlimit.h              |   0
 include/{ => uapi}/linux/netfilter/xt_connmark.h               |   0
 include/{ => uapi}/linux/netfilter/xt_conntrack.h              |   0
 include/{ => uapi}/linux/netfilter/xt_cpu.h                    |   0
 include/{ => uapi}/linux/netfilter/xt_dccp.h                   |   0
 include/{ => uapi}/linux/netfilter/xt_devgroup.h               |   0
 include/{ => uapi}/linux/netfilter/xt_dscp.h                   |   0
 include/{ => uapi}/linux/netfilter/xt_ecn.h                    |   0
 include/{ => uapi}/linux/netfilter/xt_esp.h                    |   0
 include/uapi/linux/netfilter/xt_hashlimit.h                    |  73 +++++++++++
 include/{ => uapi}/linux/netfilter/xt_helper.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_iprange.h                |   0
 include/{ => uapi}/linux/netfilter/xt_ipvs.h                   |   0
 include/{ => uapi}/linux/netfilter/xt_length.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_limit.h                  |   0
 include/{ => uapi}/linux/netfilter/xt_mac.h                    |   0
 include/{ => uapi}/linux/netfilter/xt_mark.h                   |   0
 include/{ => uapi}/linux/netfilter/xt_multiport.h              |   0
 include/{ => uapi}/linux/netfilter/xt_nfacct.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_osf.h                    |   0
 include/{ => uapi}/linux/netfilter/xt_owner.h                  |   0
 include/uapi/linux/netfilter/xt_physdev.h                      |  23 ++++
 include/{ => uapi}/linux/netfilter/xt_pkttype.h                |   0
 include/{ => uapi}/linux/netfilter/xt_policy.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_quota.h                  |   0
 include/{ => uapi}/linux/netfilter/xt_rateest.h                |   0
 include/{ => uapi}/linux/netfilter/xt_realm.h                  |   0
 include/{ => uapi}/linux/netfilter/xt_recent.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_sctp.h                   |   0
 include/{ => uapi}/linux/netfilter/xt_set.h                    |   0
 include/{ => uapi}/linux/netfilter/xt_socket.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_state.h                  |   0
 include/{ => uapi}/linux/netfilter/xt_statistic.h              |   0
 include/{ => uapi}/linux/netfilter/xt_string.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_tcpmss.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_tcpudp.h                 |   0
 include/{ => uapi}/linux/netfilter/xt_time.h                   |   0
 include/{ => uapi}/linux/netfilter/xt_u32.h                    |   0
 include/uapi/linux/netfilter_arp/Kbuild                        |   2 +
 include/uapi/linux/netfilter_arp/arp_tables.h                  | 206 +++++++++++++++++++++++++++++++
 include/{ => uapi}/linux/netfilter_arp/arpt_mangle.h           |   0
 include/uapi/linux/netfilter_bridge/Kbuild                     |  18 +++
 include/uapi/linux/netfilter_bridge/ebt_802_3.h                |  62 ++++++++++
 include/{ => uapi}/linux/netfilter_bridge/ebt_among.h          |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_arp.h            |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_arpreply.h       |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_ip.h             |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_ip6.h            |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_limit.h          |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_log.h            |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_mark_m.h         |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_mark_t.h         |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_nat.h            |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_nflog.h          |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_pkttype.h        |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_redirect.h       |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_stp.h            |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_ulog.h           |   0
 include/{ => uapi}/linux/netfilter_bridge/ebt_vlan.h           |   0
 include/uapi/linux/netfilter_bridge/ebtables.h                 | 268 +++++++++++++++++++++++++++++++++++++++++
 include/uapi/linux/netfilter_ipv4/Kbuild                       |  10 ++
 include/uapi/linux/netfilter_ipv4/ip_tables.h                  | 229 +++++++++++++++++++++++++++++++++++
 include/{ => uapi}/linux/netfilter_ipv4/ipt_CLUSTERIP.h        |   0
 include/{ => uapi}/linux/netfilter_ipv4/ipt_ECN.h              |   0
 include/{ => uapi}/linux/netfilter_ipv4/ipt_LOG.h              |   0
 include/{ => uapi}/linux/netfilter_ipv4/ipt_REJECT.h           |   0
 include/{ => uapi}/linux/netfilter_ipv4/ipt_TTL.h              |   0
 include/{ => uapi}/linux/netfilter_ipv4/ipt_ULOG.h             |   0
 include/{ => uapi}/linux/netfilter_ipv4/ipt_ah.h               |   0
 include/{ => uapi}/linux/netfilter_ipv4/ipt_ecn.h              |   0
 include/{ => uapi}/linux/netfilter_ipv4/ipt_ttl.h              |   0
 include/uapi/linux/netfilter_ipv6/Kbuild                       |  12 ++
 include/uapi/linux/netfilter_ipv6/ip6_tables.h                 | 267 ++++++++++++++++++++++++++++++++++++++++
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_HL.h              |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_LOG.h             |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_NPT.h             |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_REJECT.h          |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_ah.h              |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_frag.h            |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_hl.h              |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_ipv6header.h      |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_mh.h              |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_opts.h            |   0
 include/{ => uapi}/linux/netfilter_ipv6/ip6t_rt.h              |   0
 include/uapi/linux/tc_act/Kbuild                               |   7 ++
 include/{ => uapi}/linux/tc_act/tc_csum.h                      |   0
 include/{ => uapi}/linux/tc_act/tc_gact.h                      |   0
 include/{ => uapi}/linux/tc_act/tc_ipt.h                       |   0
 include/{ => uapi}/linux/tc_act/tc_mirred.h                    |   0
 include/{ => uapi}/linux/tc_act/tc_nat.h                       |   0
 include/{ => uapi}/linux/tc_act/tc_pedit.h                     |   0
 include/{ => uapi}/linux/tc_act/tc_skbedit.h                   |   0
 include/uapi/linux/tc_ematch/Kbuild                            |   4 +
 include/{ => uapi}/linux/tc_ematch/tc_em_cmp.h                 |   0
 include/{ => uapi}/linux/tc_ematch/tc_em_meta.h                |   0
 include/{ => uapi}/linux/tc_ematch/tc_em_nbyte.h               |   0
 include/{ => uapi}/linux/tc_ematch/tc_em_text.h                |   0
 net/8021q/vlan_core.c                                          |  10 +-
 net/core/dev.c                                                 |  59 ++++++---
 net/core/neighbour.c                                           |   6 +-
 net/core/skbuff.c                                              |  47 --------
 net/ipv4/fib_frontend.c                                        |   3 +-
 net/ipv4/fib_semantics.c                                       |   2 +
 net/ipv4/inet_connection_sock.c                                |   4 +-
 net/ipv4/ip_forward.c                                          |   2 +-
 net/ipv4/ip_output.c                                           |   4 +-
 net/ipv4/route.c                                               | 146 ++++++++++++----------
 net/ipv4/xfrm4_policy.c                                        |   1 +
 net/ipv6/af_inet6.c                                            |  22 ++--
 net/netfilter/ipvs/ip_vs_xmit.c                                |   6 +-
 net/netlink/af_netlink.c                                       |  29 +++--
 net/rds/send.c                                                 |   2 +-
 238 files changed, 2392 insertions(+), 2292 deletions(-)
 rename include/{ => uapi}/linux/caif/caif_socket.h (100%)
 rename include/{ => uapi}/linux/caif/if_caif.h (100%)
 rename include/{ => uapi}/linux/isdn/capicmd.h (100%)
 create mode 100644 include/uapi/linux/netfilter/ipset/ip_set.h
 create mode 100644 include/uapi/linux/netfilter/ipset/ip_set_bitmap.h
 create mode 100644 include/uapi/linux/netfilter/ipset/ip_set_hash.h
 create mode 100644 include/uapi/linux/netfilter/ipset/ip_set_list.h
 create mode 100644 include/uapi/linux/netfilter/nf_conntrack_common.h
 create mode 100644 include/uapi/linux/netfilter/nf_conntrack_ftp.h
 rename include/{ => uapi}/linux/netfilter/nf_conntrack_sctp.h (100%)
 create mode 100644 include/uapi/linux/netfilter/nf_conntrack_tcp.h
 rename include/{ => uapi}/linux/netfilter/nf_conntrack_tuple_common.h (100%)
 rename include/{ => uapi}/linux/netfilter/nf_nat.h (100%)
 create mode 100644 include/uapi/linux/netfilter/nfnetlink.h
 create mode 100644 include/uapi/linux/netfilter/nfnetlink_acct.h
 rename include/{ => uapi}/linux/netfilter/nfnetlink_compat.h (100%)
 rename include/{ => uapi}/linux/netfilter/nfnetlink_conntrack.h (100%)
 rename include/{ => uapi}/linux/netfilter/nfnetlink_cthelper.h (100%)
 rename include/{ => uapi}/linux/netfilter/nfnetlink_cttimeout.h (100%)
 rename include/{ => uapi}/linux/netfilter/nfnetlink_log.h (100%)
 rename include/{ => uapi}/linux/netfilter/nfnetlink_queue.h (100%)
 create mode 100644 include/uapi/linux/netfilter/x_tables.h
 rename include/{ => uapi}/linux/netfilter/xt_AUDIT.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_CHECKSUM.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_CLASSIFY.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_CONNMARK.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_CONNSECMARK.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_CT.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_DSCP.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_IDLETIMER.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_LED.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_LOG.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_MARK.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_NFLOG.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_NFQUEUE.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_RATEEST.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_SECMARK.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_TCPMSS.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_TCPOPTSTRIP.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_TEE.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_TPROXY.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_addrtype.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_cluster.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_comment.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_connbytes.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_connlimit.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_connmark.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_conntrack.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_cpu.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_dccp.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_devgroup.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_dscp.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_ecn.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_esp.h (100%)
 create mode 100644 include/uapi/linux/netfilter/xt_hashlimit.h
 rename include/{ => uapi}/linux/netfilter/xt_helper.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_iprange.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_ipvs.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_length.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_limit.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_mac.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_mark.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_multiport.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_nfacct.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_osf.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_owner.h (100%)
 create mode 100644 include/uapi/linux/netfilter/xt_physdev.h
 rename include/{ => uapi}/linux/netfilter/xt_pkttype.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_policy.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_quota.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_rateest.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_realm.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_recent.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_sctp.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_set.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_socket.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_state.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_statistic.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_string.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_tcpmss.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_tcpudp.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_time.h (100%)
 rename include/{ => uapi}/linux/netfilter/xt_u32.h (100%)
 create mode 100644 include/uapi/linux/netfilter_arp/arp_tables.h
 rename include/{ => uapi}/linux/netfilter_arp/arpt_mangle.h (100%)
 create mode 100644 include/uapi/linux/netfilter_bridge/ebt_802_3.h
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_among.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_arp.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_arpreply.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_ip.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_ip6.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_limit.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_log.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_mark_m.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_mark_t.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_nat.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_nflog.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_pkttype.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_redirect.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_stp.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_ulog.h (100%)
 rename include/{ => uapi}/linux/netfilter_bridge/ebt_vlan.h (100%)
 create mode 100644 include/uapi/linux/netfilter_bridge/ebtables.h
 create mode 100644 include/uapi/linux/netfilter_ipv4/ip_tables.h
 rename include/{ => uapi}/linux/netfilter_ipv4/ipt_CLUSTERIP.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv4/ipt_ECN.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv4/ipt_LOG.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv4/ipt_REJECT.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv4/ipt_TTL.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv4/ipt_ULOG.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv4/ipt_ah.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv4/ipt_ecn.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv4/ipt_ttl.h (100%)
 create mode 100644 include/uapi/linux/netfilter_ipv6/ip6_tables.h
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_HL.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_LOG.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_NPT.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_REJECT.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_ah.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_frag.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_hl.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_ipv6header.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_mh.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_opts.h (100%)
 rename include/{ => uapi}/linux/netfilter_ipv6/ip6t_rt.h (100%)
 rename include/{ => uapi}/linux/tc_act/tc_csum.h (100%)
 rename include/{ => uapi}/linux/tc_act/tc_gact.h (100%)
 rename include/{ => uapi}/linux/tc_act/tc_ipt.h (100%)
 rename include/{ => uapi}/linux/tc_act/tc_mirred.h (100%)
 rename include/{ => uapi}/linux/tc_act/tc_nat.h (100%)
 rename include/{ => uapi}/linux/tc_act/tc_pedit.h (100%)
 rename include/{ => uapi}/linux/tc_act/tc_skbedit.h (100%)
 rename include/{ => uapi}/linux/tc_ematch/tc_em_cmp.h (100%)
 rename include/{ => uapi}/linux/tc_ematch/tc_em_meta.h (100%)
 rename include/{ => uapi}/linux/tc_ematch/tc_em_nbyte.h (100%)
 rename include/{ => uapi}/linux/tc_ematch/tc_em_text.h (100%)

^ permalink raw reply

* Re: [PATCH net] e1000e: Change wthresh to 1 to avoid possible Tx stalls.
From: Frank Reppin @ 2012-10-10  1:25 UTC (permalink / raw)
  To: Jesse Brandeburg; +Cc: netdev, Jeff Kirsher, e1000-devel
In-Reply-To: <5074A9CA.50308@tomt.net>

On 10.10.2012 00:48, Andre Tomt wrote:
> On 09. okt. 2012 19:36, Jesse Brandeburg wrote:
[...]
>> Hints or clues (I'm trying to follow the repro steps mentioned in
>> some related threads) are appreciated.
In our scenario - the SuperMicro X8SIE-LN4 acts
as a router.

eth0 -> uplink
eth1 -> core servers network 192.168.a.b/24
eth2 -> developer employees network 192.168.c.d/24

eth1 and eth2 are hooked into (two different) HP2510-24G
switches (they both show no errors at all).

The switch connected to eth2 connects a bunch of
developers doing day-2-day stuff (commits/checkouts/documentation/
listening to stream music/surfing/email) and the such.

Continously running a ping from ie. 192.168.c.d/24 to
192.168.a.b/24 visualizes those spikes (mostly triplets, where
the first echo reply is quite high and the two following replies
are each around 50 percent faster - but mostly still >500ms) - whenever 
these spikes happen, it feels like the whole net 'stalls'.
Just like Denys Fedoryshchenko stated in

http://www.mail-archive.com/e1000-devel@lists.sourceforge.net/msg05517.html

HTH,
Frank Reppin

-- 
43rd Law of Computing:
         Anything that can go wr
fortune: Segmentation violation -- Core dumped

^ permalink raw reply

* Re: [net:master 6/7] mdio-gpio.c:(.text+0x58): multiple definition of `of_mdiobus_register'
From: Mark Brown @ 2012-10-10  1:36 UTC (permalink / raw)
  To: Fengguang Wu; +Cc: netdev
In-Reply-To: <20121009232818.GB9331@localhost>

On Wed, Oct 10, 2012 at 07:28:18AM +0800, Fengguang Wu wrote:
> Hi Mark,
> 
> FYI, kernel build failed on
> 
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
> head:   5175a5e76bbdf20a614fb47ce7a38f0f39e70226
> commit: 4085a7f0a09c73ef3e9de113c9f04d78c79be645 [6/7] netdev/phy: Prototype of_mdio_find_bus()
> config: i386-allyesconfig
> 
> All error/warnings:
> 
> drivers/net/phy/mdio-gpio.o: In function `of_mdiobus_register':
> mdio-gpio.c:(.text+0x58): multiple definition of `of_mdiobus_register'
> drivers/net/phy/libphy.o:(.text+0x23d7): first defined here
> drivers/net/phy/mdio-gpio.o: In function `of_phy_find_device':

Hrm, I can't see how that would occur due to this patch unless
!CONFIG_OF is selected which I wouldn't expect from allyesconfig, the
!CONFIG_OF stubs in the header are buggy as they aren't static.  There
is a bug there, though - I'll send a patch for that.

^ permalink raw reply

* Re: [PATCH 2/5] pktgen: set different default min_pkt_size for different protocols
From: Cong Wang @ 2012-10-10  2:19 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20121009.135531.554326230925730938.davem@davemloft.net>

On Tue, 2012-10-09 at 13:55 -0400, David Miller wrote:
> From: Cong Wang <amwang@redhat.com>
> Date: Tue,  9 Oct 2012 18:05:28 +0800
> 
> > ETH_ZLEN is too small for IPv6, so this default value is not
> > suitable.
> > 
> > Cc: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Cong Wang <amwang@redhat.com>
> 
> pkt_dev->max_pkt_size is no longer being initialized.
> 
> At least set it to whatever you compute in pkt_dev->min_pkt_size

Oops, I forgot it. Will send an updated version.

Thanks!

^ permalink raw reply

* Re: [PATCH 12/12] usbnet: make device out of suspend before calling usbnet_read/write_cmd
From: Ming Lei @ 2012-10-10  2:33 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: David S. Miller, Greg Kroah-Hartman,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <2913414.gCAxlQ38lG-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>

On Tue, Oct 9, 2012 at 4:50 PM, Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org> wrote:
> This is awkward to use in suspend()/resume()
> Could you make both versions available?

Good catch, thanks for your review.

As far as I can think of, the mutex_is_locked() trick can solve the problem.

How about the attached patch?

Thanks,
--
Ming Lei

--
>From 5c417db4ba2fd13091067104e5afe4554750be11 Mon Sep 17 00:00:00 2001
From: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Date: Tue, 2 Oct 2012 13:46:56 +0800
Subject: [PATCH] usbnet: make device out of suspend before calling
 usbnet_read/write_cmd

This patche gets the runtime PM reference count before calling
usb_control_msg, and puts it after completion of the
usb_control_msg, so that the usb control message can always be
sent to one active device.

Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/usb/smsc75xx.c |    5 +++++
 drivers/net/usb/smsc95xx.c |    5 +++++
 drivers/net/usb/usbnet.c   |   16 ++++++++++++++++
 include/linux/usb/usbnet.h |    1 +
 4 files changed, 27 insertions(+)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 1baa53a..3d43c4d 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -1153,6 +1153,7 @@ static int smsc75xx_suspend(struct usb_interface
*intf, pm_message_t message)
 	ret = usbnet_suspend(intf, message);
 	check_warn_return(ret, "usbnet_suspend error");

+	mutex_lock(&dev->pm_mutex);
 	/* if no wol options set, enter lowest power SUSPEND2 mode */
 	if (!(pdata->wolopts & SUPPORTED_WAKE)) {
 		netdev_info(dev->net, "entering SUSPEND2 mode");
@@ -1183,6 +1184,7 @@ static int smsc75xx_suspend(struct usb_interface
*intf, pm_message_t message)

 		ret = smsc75xx_write_reg(dev, PMT_CTL, val);
 		check_warn_return(ret, "Error writing PMT_CTL");
+		mutex_unlock(&dev->pm_mutex);

 		return 0;
 	}
@@ -1254,6 +1256,7 @@ static int smsc75xx_suspend(struct usb_interface
*intf, pm_message_t message)
 	check_warn_return(ret, "Error reading PMT_CTL");

 	smsc75xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
+	mutex_unlock(&dev->pm_mutex);

 	return 0;
 }
@@ -1265,6 +1268,7 @@ static int smsc75xx_resume(struct usb_interface *intf)
 	int ret;
 	u32 val;

+	mutex_lock(&dev->pm_mutex);
 	if (pdata->wolopts & WAKE_MAGIC) {
 		netdev_info(dev->net, "resuming from SUSPEND0");

@@ -1302,6 +1306,7 @@ static int smsc75xx_resume(struct usb_interface *intf)

 	ret = smsc75xx_wait_ready(dev);
 	check_warn_return(ret, "device not ready in smsc75xx_resume");
+	mutex_unlock(&dev->pm_mutex);

 	return usbnet_resume(intf);
 }
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 1730f75..5202e55e 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1015,6 +1015,7 @@ static int smsc95xx_suspend(struct usb_interface
*intf, pm_message_t message)
 	ret = usbnet_suspend(intf, message);
 	check_warn_return(ret, "usbnet_suspend error");

+	mutex_lock(&dev->pm_mutex);
 	/* if no wol options set, enter lowest power SUSPEND2 mode */
 	if (!(pdata->wolopts & SUPPORTED_WAKE)) {
 		netdev_info(dev->net, "entering SUSPEND2 mode");
@@ -1045,6 +1046,7 @@ static int smsc95xx_suspend(struct usb_interface
*intf, pm_message_t message)

 		ret = smsc95xx_write_reg(dev, PM_CTRL, val);
 		check_warn_return(ret, "Error writing PM_CTRL");
+		mutex_unlock(&dev->pm_mutex);

 		return 0;
 	}
@@ -1110,6 +1112,7 @@ static int smsc95xx_suspend(struct usb_interface
*intf, pm_message_t message)
 	check_warn_return(ret, "Error reading PM_CTRL");

 	smsc95xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
+	mutex_unlock(&dev->pm_mutex);

 	return 0;
 }
@@ -1123,6 +1126,7 @@ static int smsc95xx_resume(struct usb_interface *intf)

 	BUG_ON(!dev);

+	mutex_lock(&dev->pm_mutex);
 	if (pdata->wolopts & WAKE_MAGIC) {
 		smsc95xx_clear_feature(dev, USB_DEVICE_REMOTE_WAKEUP);

@@ -1145,6 +1149,7 @@ static int smsc95xx_resume(struct usb_interface *intf)
 		ret = smsc95xx_write_reg(dev, PM_CTRL, val);
 		check_warn_return(ret, "Error writing PM_CTRL");
 	}
+	mutex_unlock(&dev->pm_mutex);

 	return usbnet_resume(intf);
 	check_warn_return(ret, "usbnet_resume error");
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3b51554..9c872a0 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1401,6 +1401,7 @@ usbnet_probe (struct usb_interface *udev, const
struct usb_device_id *prod)
 	dev->delay.data = (unsigned long) dev;
 	init_timer (&dev->delay);
 	mutex_init (&dev->phy_mutex);
+	mutex_init (&dev->pm_mutex);

 	dev->net = net;
 	strcpy (net->name, "usb%d");
@@ -1516,11 +1517,13 @@ int usbnet_suspend (struct usb_interface
*intf, pm_message_t message)
 	struct usbnet		*dev = usb_get_intfdata(intf);

 	if (!dev->suspend_count++) {
+		mutex_lock(&dev->pm_mutex);
 		spin_lock_irq(&dev->txq.lock);
 		/* don't autosuspend while transmitting */
 		if (dev->txq.qlen && PMSG_IS_AUTO(message)) {
 			dev->suspend_count--;
 			spin_unlock_irq(&dev->txq.lock);
+			mutex_unlock(&dev->pm_mutex);
 			return -EBUSY;
 		} else {
 			set_bit(EVENT_DEV_ASLEEP, &dev->flags);
@@ -1539,6 +1542,7 @@ int usbnet_suspend (struct usb_interface *intf,
pm_message_t message)
 		 * wake the device
 		 */
 		netif_device_attach (dev->net);
+		mutex_unlock(&dev->pm_mutex);
 	}
 	return 0;
 }
@@ -1552,6 +1556,7 @@ int usbnet_resume (struct usb_interface *intf)
 	int                     retval;

 	if (!--dev->suspend_count) {
+		mutex_lock(&dev->pm_mutex);
 		/* resume interrupt URBs */
 		if (dev->interrupt && test_bit(EVENT_DEV_OPEN, &dev->flags))
 			usb_submit_urb(dev->interrupt, GFP_NOIO);
@@ -1587,6 +1592,7 @@ int usbnet_resume (struct usb_interface *intf)
 				netif_tx_wake_all_queues(dev->net);
 			tasklet_schedule (&dev->bh);
 		}
+		mutex_unlock(&dev->pm_mutex);
 	}
 	return 0;
 }
@@ -1598,6 +1604,7 @@ int usbnet_read_cmd(struct usbnet *dev, u8 cmd,
u8 reqtype,
 {
 	void *buf = NULL;
 	int err = -ENOMEM;
+	int autopm = !mutex_is_locked(&dev->pm_mutex);

 	netdev_dbg(dev->net, "usbnet_read_cmd cmd=0x%02x reqtype=%02x"
 		   " value=0x%04x index=0x%04x size=%d\n",
@@ -1609,9 +1616,13 @@ int usbnet_read_cmd(struct usbnet *dev, u8 cmd,
u8 reqtype,
 			goto out;
 	}

+	if (autopm)
+		usb_autopm_get_interface(dev->intf);
 	err = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
 			      cmd, reqtype, value, index, buf, size,
 			      USB_CTRL_GET_TIMEOUT);
+	if (autopm)
+		usb_autopm_put_interface(dev->intf);
 	if (err > 0 && err <= size)
 		memcpy(data, buf, err);
 	kfree(buf);
@@ -1625,6 +1636,7 @@ int usbnet_write_cmd(struct usbnet *dev, u8 cmd,
u8 reqtype,
 {
 	void *buf = NULL;
 	int err = -ENOMEM;
+	int autopm = !mutex_is_locked(&dev->pm_mutex);

 	netdev_dbg(dev->net, "usbnet_write_cmd cmd=0x%02x reqtype=%02x"
 		   " value=0x%04x index=0x%04x size=%d\n",
@@ -1636,9 +1648,13 @@ int usbnet_write_cmd(struct usbnet *dev, u8
cmd, u8 reqtype,
 			goto out;
 	}

+	if (autopm)
+		usb_autopm_get_interface(dev->intf);
 	err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
 			      cmd, reqtype, value, index, buf, size,
 			      USB_CTRL_SET_TIMEOUT);
+	if (autopm)
+		usb_autopm_put_interface(dev->intf);
 	kfree(buf);

 out:
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 32a57dd..3b56e5a 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -33,6 +33,7 @@ struct usbnet {
 	wait_queue_head_t	*wait;
 	struct mutex		phy_mutex;
 	unsigned char		suspend_count;
+	struct mutex		pm_mutex;

 	/* i/o info: pipes etc */
 	unsigned		in, out;
-- 
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [PATCH 01/12] usbnet: introduce usbnet 3 command helpers
From: Ming Lei @ 2012-10-10  3:19 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: David S. Miller, Greg Kroah-Hartman, netdev, linux-usb
In-Reply-To: <1765908.3QOFSVW2eC@linux-lqwf.site>

On Tue, Oct 9, 2012 at 4:47 PM, Oliver Neukum <oneukum@suse.de> wrote:
>
> Using GFP_KERNEL you preclude using those in resume() and error handling.
> Please pass a gfp_t parameter.

IMO, it is not a big deal because generally only several bytes are to be
allocated inside these helpers.

If you still think the problem should be considered, another candidate fix
is to take GFP_NOIO during system suspend/resume, and take GFP_KERNEL
in other situations.

Thanks,
--
Ming Lei

^ permalink raw reply


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