Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2] vxlan: Allow setting unicast address to the group address
From: Atzm Watanabe @ 2013-04-10  8:52 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger

This patch allows setting unicast address to the VXLAN group address.
It allows that VXLAN can be used as peer-to-peer tunnel without
multicast.

Signed-off-by: Atzm Watanabe <atzm@stratosphere.co.jp>
---
 ip/iplink_vxlan.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 1025326..cfe324c 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -66,9 +66,6 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 		} else if (!matches(*argv, "group")) {
 			NEXT_ARG();
 			gaddr = get_addr32(*argv);
-
-			if (!IN_MULTICAST(ntohl(gaddr)))
-				invarg("invald group address", *argv);
 		} else if (!matches(*argv, "local")) {
 			NEXT_ARG();
 			if (strcmp(*argv, "any"))
-- 
1.8.1.5

^ permalink raw reply related

* [PATCH] vxlan: Allow setting unicast address to the group address
From: Atzm Watanabe @ 2013-04-10  8:52 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Stephen Hemminger

This patch allows setting unicast address to the VXLAN group address.
It allows that VXLAN can be used as peer-to-peer tunnel without
multicast.

Signed-off-by: Atzm Watanabe <atzm@stratosphere.co.jp>
---
 drivers/net/vxlan.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 9a64715..9e105f9 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -106,7 +106,7 @@ struct vxlan_dev {
 	struct hlist_node hlist;
 	struct net_device *dev;
 	__u32		  vni;		/* virtual network id */
-	__be32	          gaddr;	/* multicast group */
+	__be32	          gaddr;	/* group address */
 	__be32		  saddr;	/* source address */
 	unsigned int      link;		/* link to multicast over */
 	__u16		  port_min;	/* source port range */
@@ -1189,7 +1189,7 @@ static int vxlan_open(struct net_device *dev)
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	int err;
 
-	if (vxlan->gaddr) {
+	if (IN_MULTICAST(ntohl(vxlan->gaddr))) {
 		err = vxlan_join_group(dev);
 		if (err)
 			return err;
@@ -1223,7 +1223,7 @@ static int vxlan_stop(struct net_device *dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 
-	if (vxlan->gaddr)
+	if (IN_MULTICAST(ntohl(vxlan->gaddr)))
 		vxlan_leave_group(dev);
 
 	del_timer_sync(&vxlan->age_timer);
@@ -1347,14 +1347,6 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[])
 			return -ERANGE;
 	}
 
-	if (data[IFLA_VXLAN_GROUP]) {
-		__be32 gaddr = nla_get_be32(data[IFLA_VXLAN_GROUP]);
-		if (!IN_MULTICAST(ntohl(gaddr))) {
-			pr_debug("group address is not IPv4 multicast\n");
-			return -EADDRNOTAVAIL;
-		}
-	}
-
 	if (data[IFLA_VXLAN_PORT_RANGE]) {
 		const struct ifla_vxlan_port_range *p
 			= nla_data(data[IFLA_VXLAN_PORT_RANGE]);
-- 
1.8.1.5

^ permalink raw reply related

* [PATCH] stmmac: prevent interrupt loop with MMC RX IPC Counter
From: Christian Ruppert @ 2013-04-10  7:56 UTC (permalink / raw)
  To: netdev; +Cc: Giuseppe Cavallaro, Christian Ruppert
In-Reply-To: <511E51A9.9020908@st.com>

If the DesignWare MAC is synthesised with MMC RX IPC Counter, an unmanaged
and unacknowledged interrupt is generated after some time of operation.

This patch masks the undesired interrupts.

Signed-off-by: Christian Ruppert <christian.ruppert@abilis.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 drivers/net/ethernet/stmicro/stmmac/mmc_core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
index 0c74a70..50617c5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
@@ -149,6 +149,7 @@ void dwmac_mmc_intr_all_mask(void __iomem *ioaddr)
 {
 	writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_INTR_MASK);
 	writel(MMC_DEFAULT_MASK, ioaddr + MMC_TX_INTR_MASK);
+	writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_IPC_INTR_MASK);
 }
 
 /* This reads the MAC core counters (if actaully supported).
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH 1/2 v4] usbnet: allow status interrupt URB to always be active
From: Oliver Neukum @ 2013-04-10  7:23 UTC (permalink / raw)
  To: Dan Williams
  Cc: Ming Lei, Elina Pasheva, Network Development, linux-usb,
	Rory Filer, Phil Sutter
In-Reply-To: <1365548547.23372.2.camel@dcbw.foobar.com>

On Tuesday 09 April 2013 18:02:27 Dan Williams wrote:
> Some drivers (sierra_net) need the status interrupt URB
> active even when the device is closed, because they receive
> custom indications from firmware.  Add functions to refcount
> the status interrupt URB submit/kill operation so that
> sub-drivers and the generic driver don't fight over whether
> the status interrupt URB is active or not.
> 
> A sub-driver can call usbnet_status_start() at any time, but
> the URB is only submitted the first time the function is
> called.  Likewise, when the sub-driver is done with the URB,
> it calls usbnet_status_stop() but the URB is only killed when
> all users have stopped it.  The URB is still killed and
> re-submitted for suspend/resume, as before, with the same
> refcount it had at suspend.
> 
> Signed-off-by: Dan Williams <dcbw@redhat.com>
> ---
>  drivers/net/usb/usbnet.c   | 79 ++++++++++++++++++++++++++++++++++++++++++----
>  include/linux/usb/usbnet.h |  5 +++
>  2 files changed, 77 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index 51f3192..e8b363a 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -42,7 +42,7 @@
>  #include <linux/workqueue.h>
>  #include <linux/mii.h>
>  #include <linux/usb.h>
> -#include <linux/usb/usbnet.h>
> +#include "usbnet.h"
>  #include <linux/slab.h>
>  #include <linux/kernel.h>
>  #include <linux/pm_runtime.h>
> @@ -252,6 +252,70 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf)
>  	return 0;
>  }
>  
> +/* Submit the interrupt URB if it hasn't been submitted yet */
> +static int __usbnet_status_start(struct usbnet *dev, gfp_t mem_flags,
> +					bool force)
> +{
> +	int ret = 0;
> +	bool submit = false;
> +
> +	if (!dev->interrupt)
> +		return 0;
> +
> +	mutex_lock(&dev->interrupt_mutex);
> +
> +	if (force) {

That design means that interrupt_count isn't accurate if force is used.
That is extremely ugly.

> +		/* Only submit now if the URB was previously submitted */
> +		if (dev->interrupt_count)
> +			submit = true;
> +	} else if (++dev->interrupt_count == 1)
> +		submit = true;
> +
> +	if (submit)
> +		ret = usb_submit_urb(dev->interrupt, mem_flags);
> +
> +	dev_dbg(&dev->udev->dev, "incremented interrupt URB count to %d\n",
> +		dev->interrupt_count);
> +	mutex_unlock(&dev->interrupt_mutex);
> +	return ret;
> +}
> +
> +int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags)
> +{
> +	/* Only drivers that implement a status hook should call this */
> +	BUG_ON(dev->interrupt == NULL);
> +
> +	if (test_bit(EVENT_DEV_ASLEEP, &dev->flags))
> +		return -EINVAL;

This looks like a race condition.

> +	return __usbnet_status_start(dev, mem_flags, false);
> +}
> +EXPORT_SYMBOL_GPL(usbnet_status_start);
> +
> +/* Kill the interrupt URB if all submitters want it killed */
> +static void __usbnet_status_stop(struct usbnet *dev, bool force)
> +{
> +	if (dev->interrupt) {
> +		mutex_lock(&dev->interrupt_mutex);
> +		if (!force)
> +			BUG_ON(dev->interrupt_count == 0);
> +
> +		if (force || --dev->interrupt_count == 0)
> +			usb_kill_urb(dev->interrupt);

Why so complicated? If it may be on, kill it unconditionally.

> +
> +		dev_dbg(&dev->udev->dev,
> +			"decremented interrupt URB count to %d\n",
> +			dev->interrupt_count);
> +		mutex_unlock(&dev->interrupt_mutex);
> +	}
> +}
> +

	Regards
		Oliver

^ permalink raw reply

* [PATCH] ipconfig: stop ip-config if disabled method directed
From: Takashi Yoshii @ 2013-04-10  7:23 UTC (permalink / raw)
  To: netdev

Hi,

Looks insignificant, but a misusage of kernel level auto configuration
results in an invalid ipv4 address set.
That is a kind of corner case, but I think it is be better sanitizing
 the input a bit more for our simple in_aton().
--

CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=n
Command line: ip=dhcp
result in false ip address 62.0.0.0 set.

If directed autoconf method is not compiled into the kernel,
ip-config should be terminated.

Signed-off-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com>
---
 net/ipv4/ipconfig.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index bf6c5cf..6401aac 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1586,6 +1586,16 @@ static int __init ip_auto_config_setup(char *addrs)
 	if (ic_proto_name(addrs))
 		return 1;
 
+	/* This mean the kernel is not configured to have the method. */
+	if (strcmp(addrs, "dhcp") == 0 ||
+	    strcmp(addrs, "bootp") == 0 ||
+	    strcmp(addrs, "rarp") == 0 ||
+	    strcmp(addrs, "both") == 0) {
+		pr_warn("IP-Config: autoconf [%s] not compiled in\n", addrs);
+		ic_enable = 0;
+		return 1;
+	}
+
 	/* If no static IP is given, turn off autoconfig and bail.  */
 	if (*addrs == 0 ||
 	    strcmp(addrs, "off") == 0 ||
-- 
1.8.1.5

^ permalink raw reply related

* Re: [PATCH 2/2 v4] sierra_net: keep status interrupt URB active
From: Oliver Neukum @ 2013-04-10  7:15 UTC (permalink / raw)
  To: Dan Williams
  Cc: Ming Lei, Elina Pasheva, Network Development, linux-usb,
	Rory Filer, Phil Sutter
In-Reply-To: <1365548751.23372.6.camel@dcbw.foobar.com>

On Tuesday 09 April 2013 18:05:51 Dan Williams wrote:
> The driver and firmware sync up through SYNC messages, and the
> firmware's affirmative reply to these SYNC messages appears to be the
> "Reset" indication received via the status interrupt endpoint.  Thus the
> driver needs the status interrupt endpoint always active so that the
> Reset indication can be received even if the netdev is closed, which is
> the case right after device insertion.

WHat about suspend/resume?

	Regards
		Oliver

^ permalink raw reply

* Re: [PATCH v2] MPLS: Add limited GSO support
From: Simon Horman @ 2013-04-10  6:21 UTC (permalink / raw)
  To: Jesse Gross; +Cc: dev@openvswitch.org, netdev, Jarno Rajahalme, Pravin B Shelar
In-Reply-To: <20130405010738.GS29203@verge.net.au>

I would really appreciate some feedback from people on netdev
on the issues described at the bottom of this thread.

On Fri, Apr 05, 2013 at 10:07:38AM +0900, Simon Horman wrote:
> On Thu, Apr 04, 2013 at 10:20:47AM -0700, Jesse Gross wrote:
> > On Wed, Apr 3, 2013 at 5:55 PM, Simon Horman <horms@verge.net.au> wrote:
> > > On Wed, Apr 03, 2013 at 05:44:17PM -0700, Jesse Gross wrote:
> > >> On Wed, Apr 3, 2013 at 5:28 PM, Simon Horman <horms@verge.net.au> wrote:
> > >> > On Wed, Apr 03, 2013 at 04:51:38PM -0700, Jesse Gross wrote:
> > >> >> On Wed, Apr 3, 2013 at 2:11 AM, Simon Horman <horms@verge.net.au> wrote:
> > >> >> > In the case where a non-MPLS packet is recieved and an MPLS stack is
> > >> >> > added it may well be the case that the original skb is GSO but the
> > >> >> > NIC used for transmit does not support GSO of MPLS packets.
> > >> >> >
> > >> >> > The aim of this code is to provide GSO in software for MPLS packets
> > >> >> > whose skbs are GSO.
> > >> >> >
> > >> >> > When an implementation adds an MPLS stack to a non-MPLS packet it should do
> > >> >> > the following to skb metadata:
> > >> >> >
> > >> >> > * Set skb_mac_header(skb)->protocol to the new MPLS ethertype.
> > >> >> >   That is, either ETH_P_MPLS_UC or ETH_P_MPLS_MC.
> > >> >> >
> > >> >> > * Leave skb->protocol as the old non-MPLS ethertype.
> > >> >> >
> > >> >> > * Set skb->encapsulation = 1.
> > >> >> >
> > >> >> >   This may not strictly be necessary as I believe that checking
> > >> >> >   skb_mac_header(skb)->protocol and skb->protocol should be necessary and
> > >> >> >   sufficient.
> > >> >> >
> > >> >> >   However, it does seem to fit nicely with the current implementation of
> > >> >> >   dev_hard_start_xmit() where the more expensive check of
> > >> >> >   skb_mac_header(skb)->protocol may be guarded by an existing check of
> > >> >> >   skb->encapsulation.
> > >> >> >
> > >> >> > One aspect of this patch that I am unsure about is the modification I have
> > >> >> > made to skb_segment(). This seems to be necessary as checskum accelearation
> > >> >> > may no longer be possible as the packet has changed to be MPLS from some
> > >> >> > other packet type which may have been supported by the hardware in use.
> > >> >> >
> > >> >> > I will post a patch, "[PATCH v3.24] datapath: Add basic MPLS support to
> > >> >> > kernel" which adds MPLS support to the kernel datapath of Open vSwtich.
> > >> >> > That patch sets the above requirements in
> > >> >> > datapath/actions.c:set_ethertype() and was used to exercise the MPLS GSO
> > >> >> > code. The datapath patch is against the Open vSwtich tree but it is
> > >> >> > intended that it be added to the Open vSwtich code present in the mainline
> > >> >> > Linux kernel at some point.
> > >> >> >
> > >> >> > Suggested by Jesse Gross. Based heavily on "v4 GRE: Add TCP segmentation
> > >> >> > offload for GRE" by Pravin B Shelar.
> > >> >> >
> > >> >> > Cc: Jesse Gross <jesse@nicira.com>
> > >> >> > Cc: Pravin B Shelar <pshelar@nicira.com>
> > >> >> > Signed-off-by: Simon Horman <horms@verge.net.au>
> > >> >>
> > >> >> MPLS is very similar to both the Ethernet header and vlans in that GSO
> > >> >> only requires replication without any modification.  That means that
> > >> >> if we look at the mac_len as containing all three then we can just
> > >> >> copy it without any special knowledge.  I don't know that we carefully
> > >> >> maintain mac_len in all places but you are already doing that in your
> > >> >> MPLS patches.
> > >> >
> > >> > At least for the cases that I am aware of I think that mac_len is
> > >> > predictable. But I'm a little unsure of what you are getting at here.
> > >>
> > >> If you have the MAC len then you don't need any new MPLS code here at
> > >> all; just replicate the whole thing onto each packet.
> > >
> > > The MAC len is set to cover everything up to the top of the MPLS stack.
> > > So it seems that something needs to be done to account for the length
> > > of the MPLS stack.
> > >
> > > Are you suggesting that if Open vSwtich set up the MAC len to extend
> > > to the end of the MPLS stack then mpls_gro_segment() would not be necessary?
> > 
> > Something along those lines.  I think this is very similar to the
> > skb->protocol discussion (and likely influenced by the outcome of
> > that).  MPLS is a little weird with respect to the existing layer
> > pointers but if we can find a good definition then I think that the
> > GSO code should be pretty minimal.
> 
> Thanks, I understand.
> 
> Mainly for the benefit of those who have not been exposed to MPLS (for Open
> vSwtich) I will summarise how I see the problem with the layer pointers and
> protocol values in relation to MPLS.
> 
> 
> Basically MPLS sits between L2 and L3, and is sometimes referred to as
> L2.5.  Currently the code makes use of the network_header in the skb to
> point to the top of the MPLS label stack. But arguably it could just as
> validly be used to point to the bottom of the MPLS label stack, where the
> (non-MPLS) L3 data lies.
> 
> Up until now it has seemed to be more important to know where the top of
> the MPLS label stack is, so using the network_header for that purpose has
> worked out quite well in the Open vSwtich code that uses it ("[PATCH v3.24]
> datapath: Add basic MPLS support to kernel").
> 
> We now see a situation where it would be useful to just know where the
> bottom of the MPLS label stack lies.
> 
> 
> The issue regarding skb->protocol and skb_mac_header(skb)->protocol is
> that when an MPLS push occurs on a previously non-MPLS packet the
> protocol is changed to either MPLS multicast or MPLS unicast. And more
> importantly, the MPLS label stack entry doesn't include the old protocol
> so it is no longer present anywhere in the packet. From an implementation
> point of view this is a critical difference between MPLS and VLANs.
> 
> The way that Open vSwitch currently implements MPLS push results in:
> 
> * skb_mac_header(skb)->protocol set to the new, MPLS, protocol
> * skb->protocol left as the old, (in the case relating to GSO non-MPLS),
>   protocol
> 
> The MPLS GSO code I posted uses this information, plus the fact that
> skb->encapsulation = 1 (not strictly necessary, I think), to determine
> if MPLS GSO segmentation should be performed.
> 
> 
> Jesse has suggested that there would be no need for MPLS GSO segmentation
> code, or that at the very least it would be smaller, if the skb was set up
> more cleverly, with skb->mac_len and skb->network_header corresponding to
> the bottom of the MPLS label stack. This appears to tie into any decision
> about the treatment of skb_mac_header(skb)->protocol and skb->protocol.
> --
> 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: [PATCH 1/2] crypto: add CMAC support to CryptoAPI
From: Herbert Xu @ 2013-04-10  3:32 UTC (permalink / raw)
  To: Jussi Kivilinna
  Cc: linux-crypto, Steffen Klassert, netdev, Tom St Denis,
	David S. Miller
In-Reply-To: <20130408074844.6866.90093.stgit@localhost6.localdomain6>

On Mon, Apr 08, 2013 at 10:48:44AM +0300, Jussi Kivilinna wrote:
> Patch adds support for NIST recommended block cipher mode CMAC to CryptoAPI.
> 
> This work is based on Tom St Denis' earlier patch,
>  http://marc.info/?l=linux-crypto-vger&m=135877306305466&w=2
> 
> Cc: Tom St Denis <tstdenis@elliptictech.com>
> Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Both patches applied.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* [BUG] Fatal exception in interrupt - nf_nat_cleanup_conntrack during IPv6 tests
From: CAI Qian @ 2013-04-10  3:17 UTC (permalink / raw)
  To: netdev; +Cc: stable, LKML
In-Reply-To: <605030311.1990960.1365563720663.JavaMail.root@redhat.com>

Just hit this very often during IPv6 tests in both the latest stable
and mainline kernel.

[ 3597.179161] general protection fault: 0000 [#1] SMP  
[ 3597.206166] Modules linked in: btrfs(F) zlib_deflate(F) vfat(F) fat(F) nfs_layout_nfsv41_files(F) nfsv4(F) auth_rpcgss(F) nfsv3(F) nfs_acl(F) nfsv2(F) nfs(F) lockd(F) sunrpc(F) fscache(F) nfnetlink_log(F) nfnetlink(F) bluetooth(F) rfkill(F) arc4(F) md4(F) nls_utf8(F) cifs(F) dns_resolver(F) nf_tproxy_core(F) nls_koi8_u(F) nls_cp932(F) ts_kmp(F) sctp(F) nf_conntrack_netbios_ns(F) nf_conntrack_broadcast(F) ipt_MASQUERADE(F) ip6table_mangle(F) ip6t_REJECT(F) nf_conntrack_ipv6(F) nf_defrag_ipv6(F) nf_nat_ipv4(F-) nf_nat(F) iptable_mangle(F) ipt_REJECT(F) nf_conntrack_ipv4(F) nf_defrag_ipv4(F) xt_conntrack(F) nf_conntrack(F) ebtable_filter(F) ebtables(F) ip6table_filter(F) ip6_tables(F) iptable_filter(F) ip_tables(F) sg(F) coretemp(F) ixgbe(F) kvm_intel(F) kvm(F) ptp(F) iTCO_wdt(F) iTCO_vend
 or_support(F) crc32c_intel(F) pps_core(F) mdio(F) ghash_clmulni_intel(F) e1000e(F) lpc_ich(F) dca(F) hpilo(F) hpwdt(F) mfd_core(F) pcspkr(F) serio_raw(F) microcode(F) xfs(F) libcrc32c(F) ata_generic(F) mgag200(F) i2c_algo_bit(F) pata_acpi(F) drm_kms_helper(F) sd_mod(F) crc_t10dif(F) ttm(F) ata_piix(F) drm(F) hpsa(F) libata(F) i2c_core(F) dm_mirror(F) dm_region_hash(F) dm_log(F) dm_mod(F) [last unloaded: iptable_nat] 
[ 3597.750154] CPU 3  
[ 3597.759743] Pid: 0, comm: swapper/3 Tainted: GF            3.8.5+ #1 HP ProLiant DL120 G7 
[ 3597.804861] RIP: 0010:[<ffffffffa03227f2>]  [<ffffffffa03227f2>] nf_nat_cleanup_conntrack+0x42/0x70 [nf_nat] 
[ 3597.855207] RSP: 0018:ffff880202c63d40  EFLAGS: 00010246 
[ 3597.881350] RAX: 0000000000000000 RBX: ffff8801ac7bec28 RCX: ffff8801d0eedbe0 
[ 3597.917226] RDX: dead000000200200 RSI: 0000000000000011 RDI: ffffffffa03265b8 
[ 3597.952432] RBP: ffff880202c63d50 R08: 000003451753e1c0 R09: dead000000200200 
[ 3597.989578] R10: 0000000000000000 R11: 0000000000000004 R12: ffff8801ac7beba8 
[ 3598.026430] R13: ffff8801d0eedb58 R14: ffffffffa02fe6a0 R15: ffff8801d0eedb58 
[ 3598.061575] FS:  0000000000000000(0000) GS:ffff880202c60000(0000) knlGS:0000000000000000 
[ 3598.102232] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033 
[ 3598.131044] CR2: 000000000280e508 CR3: 00000000018f2000 CR4: 00000000000407e0 
[ 3598.166274] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 
[ 3598.202110] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 
[ 3598.238221] Process swapper/3 (pid: 0, threadinfo ffff8801ffaee000, task ffff8801ffaf5010) 
[ 3598.282292] Stack: 
[ 3598.292908]  0000000000000000 0000000000000001 ffff880202c63d80 ffffffffa0305bb4 
[ 3598.332820]  ffffffff8161646d ffff8801d0eedb58 ffffffff819a5d40 0000000000000100 
[ 3598.371541]  ffff880202c63da0 ffffffffa02fd3fe ffff8801d0eedb58 ffffffff819a5d40 
[ 3598.409036] Call Trace: 
[ 3598.421036]  <IRQ>  
[ 3598.430467]  [<ffffffffa0305bb4>] __nf_ct_ext_destroy+0x44/0x60 [nf_conntrack] 
[ 3598.467970]  [<ffffffff8161646d>] ? notifier_call_chain+0x4d/0x70 
[ 3598.499191]  [<ffffffffa02fd3fe>] nf_conntrack_free+0x2e/0x70 [nf_conntrack] 
[ 3598.534121]  [<ffffffffa02febed>] destroy_conntrack+0xbd/0x110 [nf_conntrack] 
[ 3598.569981]  [<ffffffff81532187>] nf_conntrack_destroy+0x17/0x20 
[ 3598.599579]  [<ffffffffa02fe77c>] death_by_timeout+0xdc/0x1b0 [nf_conntrack] 
[ 3598.634842]  [<ffffffffa02fe6a0>] ? kill_report+0x180/0x180 [nf_conntrack] 
[ 3598.669352]  [<ffffffff81070c9a>] call_timer_fn+0x3a/0x120 
[ 3598.696383]  [<ffffffffa02fe6a0>] ? kill_report+0x180/0x180 [nf_conntrack] 
[ 3598.730896]  [<ffffffff814bbe40>] ? cpufreq_p4_target+0x130/0x130 
[ 3598.762416]  [<ffffffff81072a2e>] run_timer_softirq+0x1fe/0x2b0 
[ 3598.793980]  [<ffffffff814bbe40>] ? cpufreq_p4_target+0x130/0x130 
[ 3598.826872]  [<ffffffff8106a8f0>] __do_softirq+0xd0/0x210 
[ 3598.855564]  [<ffffffff8101b883>] ? native_sched_clock+0x13/0x80 
[ 3598.887548]  [<ffffffff814bbe40>] ? cpufreq_p4_target+0x130/0x130 
[ 3598.920717]  [<ffffffff8161bddc>] call_softirq+0x1c/0x30 
[ 3598.947948]  [<ffffffff810162a5>] do_softirq+0x75/0xb0 
[ 3598.973283]  [<ffffffff8106abc5>] irq_exit+0xb5/0xc0 
[ 3598.998710]  [<ffffffff8161c75e>] smp_apic_timer_interrupt+0x6e/0x99 
[ 3599.030033]  [<ffffffff8161b69d>] apic_timer_interrupt+0x6d/0x80 
[ 3599.060308]  <EOI>  
[ 3599.069737]  [<ffffffff814bc830>] ? cpuidle_wrap_enter+0x50/0xa0 
[ 3599.100918]  [<ffffffff814bc829>] ? cpuidle_wrap_enter+0x49/0xa0 
[ 3599.130548]  [<ffffffff814bc890>] cpuidle_enter_tk+0x10/0x20 
[ 3599.158994]  [<ffffffff814bc4c9>] cpuidle_idle_call+0xa9/0x260 
[ 3599.187843]  [<ffffffff8101d3cf>] cpu_idle+0xaf/0x120 
[ 3599.213581]  [<ffffffff815fc461>] start_secondary+0x255/0x257 
[ 3599.241868] Code: 83 ec 08 0f b6 58 11 84 db 74 43 48 01 c3 48 83 7b 20 00 74 39 48 c7 c7 b8 65 32 a0 e8 98 fc 2e e1 48 8b 03 48 8b 53 08 48 85 c0 <48> 89 02 74 04 48 89 50 08 48 ba 00 02 20 00 00 00 ad de 48 c7  
[ 3599.337037] RIP  [<ffffffffa03227f2>] nf_nat_cleanup_conntrack+0x42/0x70 [nf_nat] 
[ 3599.378020]  RSP <ffff880202c63d40> 
[ 3599.402446] bad: scheduling from the idle thread! 
[ 3599.428245] Pid: 0, comm: swapper/3 Tainted: GF            3.8.5+ #1 
[ 3599.463162] Call Trace: 
[ 3599.476367]  <IRQ>  [<ffffffff8109b47f>] dequeue_task_idle+0x2f/0x40 
[ 3599.508112]  [<ffffffff810947de>] dequeue_task+0x8e/0xa0 
[ 3599.535485]  [<ffffffff81095223>] deactivate_task+0x23/0x30 
[ 3599.563276]  [<ffffffff81610d49>] __schedule+0x599/0x7b0 
[ 3599.590450]  [<ffffffff8101b8f9>] ? sched_clock+0x9/0x10 
[ 3599.616588]  [<ffffffff81611289>] schedule+0x29/0x70 
[ 3599.641650]  [<ffffffff8160f7a3>] schedule_timeout+0x163/0x2b0 
[ 3599.670525]  [<ffffffff8106ab91>] ? irq_exit+0x81/0xc0 
[ 3599.696649]  [<ffffffff81071710>] ? __internal_add_timer+0x130/0x130 
[ 3599.728262]  [<ffffffff8160f90e>] schedule_timeout_uninterruptible+0x1e/0x20 
[ 3599.763734]  [<ffffffff81073160>] msleep+0x20/0x30 
[ 3599.787466]  [<ffffffffa009beff>] mga_crtc_dpms+0x10f/0x1b0 [mgag200] 
[ 3599.820051]  [<ffffffffa009bdf0>] ? mga_encoder_destroy+0x30/0x30 [mgag200] 
[ 3599.854791]  [<ffffffffa00c39e2>] drm_helper_connector_dpms+0x72/0x130 [drm_kms_helper] 
[ 3599.897275]  [<ffffffffa00c2090>] drm_fb_helper_dpms.isra.14+0xa0/0xf0 [drm_kms_helper] 
[ 3599.941004]  [<ffffffffa00c2126>] drm_fb_helper_blank+0x46/0x80 [drm_kms_helper] 
[ 3599.980813]  [<ffffffff81342656>] fb_blank+0x56/0xc0 
[ 3600.008422]  [<ffffffff8134f70b>] fbcon_blank+0x22b/0x2e0 
[ 3600.037769]  [<ffffffff81063849>] ? console_unlock+0x1e9/0x3f0 
[ 3600.069907]  [<ffffffff810716f3>] ? __internal_add_timer+0x113/0x130 
[ 3600.101532]  [<ffffffff81071d00>] ? internal_add_timer+0x20/0x50 
[ 3600.131757]  [<ffffffff81073041>] ? mod_timer+0x131/0x210 
[ 3600.158302]  [<ffffffff813c3474>] do_unblank_screen+0xb4/0x1e0 
[ 3600.187752]  [<ffffffff813c35b0>] unblank_screen+0x10/0x20 
[ 3600.214798]  [<ffffffff813066c9>] bust_spinlocks+0x19/0x40 
[ 3600.242523]  [<ffffffff816135cf>] oops_end+0x3f/0xe0 
[ 3600.266990]  [<ffffffff81017848>] die+0x58/0x90 
[ 3600.290099]  [<ffffffffa02fe6a0>] ? kill_report+0x180/0x180 [nf_conntrack] 
[ 3600.324031]  [<ffffffff8161309a>] do_general_protection+0xda/0x160 
[ 3600.355466]  [<ffffffff81612a28>] general_protection+0x28/0x30 
[ 3600.385088]  [<ffffffffa02fe6a0>] ? kill_report+0x180/0x180 [nf_conntrack] 
[ 3600.419965]  [<ffffffffa03227f2>] ? nf_nat_cleanup_conntrack+0x42/0x70 [nf_nat] 
[ 3600.457872]  [<ffffffffa0305bb4>] __nf_ct_ext_destroy+0x44/0x60 [nf_conntrack] 
[ 3600.496919]  [<ffffffff8161646d>] ? notifier_call_chain+0x4d/0x70 
[ 3600.531231]  [<ffffffffa02fd3fe>] nf_conntrack_free+0x2e/0x70 [nf_conntrack] 
[ 3600.569264]  [<ffffffffa02febed>] destroy_conntrack+0xbd/0x110 [nf_conntrack] 
[ 3600.608912]  [<ffffffff81532187>] nf_conntrack_destroy+0x17/0x20 
[ 3600.638505]  [<ffffffffa02fe77c>] death_by_timeout+0xdc/0x1b0 [nf_conntrack] 
[ 3600.673851]  [<ffffffffa02fe6a0>] ? kill_report+0x180/0x180 [nf_conntrack] 
[ 3600.708435]  [<ffffffff81070c9a>] call_timer_fn+0x3a/0x120 
[ 3600.735880]  [<ffffffffa02fe6a0>] ? kill_report+0x180/0x180 [nf_conntrack] 
[ 3600.770429]  [<ffffffff814bbe40>] ? cpufreq_p4_target+0x130/0x130 
[ 3600.800481]  [<ffffffff81072a2e>] run_timer_softirq+0x1fe/0x2b0 
[ 3600.830378]  [<ffffffff814bbe40>] ? cpufreq_p4_target+0x130/0x130 
[ 3600.860402]  [<ffffffff8106a8f0>] __do_softirq+0xd0/0x210 
[ 3600.887542]  [<ffffffff8101b883>] ? native_sched_clock+0x13/0x80 
[ 3600.917405]  [<ffffffff814bbe40>] ? cpufreq_p4_target+0x130/0x130 
[ 3600.948576]  [<ffffffff8161bddc>] call_softirq+0x1c/0x30 
[ 3600.975042]  [<ffffffff810162a5>] do_softirq+0x75/0xb0 
[ 3601.001068]  [<ffffffff8106abc5>] irq_exit+0xb5/0xc0 
[ 3601.026576]  [<ffffffff8161c75e>] smp_apic_timer_interrupt+0x6e/0x99 
[ 3601.061371]  [<ffffffff8161b69d>] apic_timer_interrupt+0x6d/0x80 
[ 3601.093649]  <EOI>  [<ffffffff814bc830>] ? cpuidle_wrap_enter+0x50/0xa0 
[ 3601.129895]  [<ffffffff814bc829>] ? cpuidle_wrap_enter+0x49/0xa0 
[ 3601.161286]  [<ffffffff814bc890>] cpuidle_enter_tk+0x10/0x20 
[ 3601.189765]  [<ffffffff814bc4c9>] cpuidle_idle_call+0xa9/0x260 
[ 3601.218496]  [<ffffffff8101d3cf>] cpu_idle+0xaf/0x120 
[ 3601.243956]  [<ffffffff815fc461>] start_secondary+0x255/0x257 
[ 3601.273220] BUG: unable to handle kernel NULL pointer dereference at           (null) 
[ 3601.312563] IP: [<          (null)>]           (null) 
[ 3601.337599] PGD 1b9d80067 PUD 1e62d2067 PMD 0  
[ 3601.360361] Oops: 0010 [#2] SMP  
[ 3601.376324] Modules linked in: btrfs(F) zlib_deflate(F) vfat(F) fat(F) nfs_layout_nfsv41_files(F) nfsv4(F) auth_rpcgss(F) nfsv3(F) nfs_acl(F) nfsv2(F) nfs(F) lockd(F) sunrpc(F) fscache(F) nfnetlink_log(F) nfnetlink(F) bluetooth(F) rfkill(F) arc4(F) md4(F) nls_utf8(F) cifs(F) dns_resolver(F) nf_tproxy_core(F) nls_koi8_u(F) nls_cp932(F) ts_kmp(F) sctp(F) nf_conntrack_netbios_ns(F) nf_conntrack_broadcast(F) ipt_MASQUERADE(F) ip6table_mangle(F) ip6t_REJECT(F) nf_conntrack_ipv6(F) nf_defrag_ipv6(F) nf_nat_ipv4(F-) nf_nat(F) iptable_mangle(F) ipt_REJECT(F) nf_conntrack_ipv4(F) nf_defrag_ipv4(F) xt_conntrack(F) nf_conntrack(F) ebtable_filter(F) ebtables(F) ip6table_filter(F) ip6_tables(F) iptable_filter(F) ip_tables(F) sg(F) coretemp(F) ixgbe(F) kvm_intel(F) kvm(F) ptp(F) iTCO_wdt(F) iTCO_vend
 or_support(F) crc32c_intel(F) pps_core(F) mdio(F) ghash_clmulni_intel(F) e1000e(F) lpc_ich(F) dca(F) hpilo(F) hpwdt(F) mfd_core(F) pcspkr(F) serio_raw(F) microcode(F) xfs(F) libcrc32c(F) ata_generic(F) mgag200(F) i2c_algo_bit(F) pata_acpi(F) drm_kms_helper(F) sd_mod(F) crc_t10dif(F) ttm(F) ata_piix(F) drm(F) hpsa(F) libata(F) i2c_core(F) dm_mirror(F) dm_region_hash(F) dm_log(F) dm_mod(F) [last unloaded: iptable_nat] 
[ 3601.922124] CPU 3  
[ 3601.931628] Pid: 63862, comm: grep Tainted: GF            3.8.5+ #1 HP ProLiant DL120 G7 
[ 3601.973462] RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null) 
[ 3602.010902] RSP: 0000:ffff8801b04efcf0  EFLAGS: 00010046 
[ 3602.037249] RAX: ffffffff81631ac0 RBX: ffff8801ffaf5010 RCX: 000000001048f4fc 
[ 3602.073506] RDX: 0000000000000005 RSI: ffff8801ffaf5010 RDI: ffff880202c74180 
[ 3602.112346] RBP: ffff8801b04efd18 R08: 0000000000000000 R09: 0000000000000000 
[ 3602.150489] R10: 0000000000000000 R11: 000000000000bbe2 R12: ffff880202c74180 
[ 3602.189458] R13: 0000000000000005 R14: 0000000000000246 R15: ffff880202c74180 
[ 3602.227532] FS:  00007fe849139740(0000) GS:ffff880202c60000(0000) knlGS:0000000000000000 
[ 3602.270418] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033 
[ 3602.298692] CR2: 0000000000000000 CR3: 00000001ea35d000 CR4: 00000000000407e0 
[ 3602.334682] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 
[ 3602.370618] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 
[ 3602.407160] Process grep (pid: 63862, threadinfo ffff8801b04ee000, task ffff8801ff9fb560) 
[ 3602.448654] Stack: 
[ 3602.458587]  ffffffff81094856 ffff8801fb5406c0 ffff8801ffaf5010 ffff880202c74180 
[ 3602.496119]  0000000000000000 ffff8801b04efd28 ffffffff810951f3 ffff8801b04efd48 
[ 3602.533501]  ffffffff8109564c ffff8801ffaf5010 ffff8801ffaf57f4 ffff8801b04efda8 
[ 3602.569906] Call Trace: 
[ 3602.582433]  [<ffffffff81094856>] ? enqueue_task+0x66/0x80 
[ 3602.609676]  [<ffffffff810951f3>] activate_task+0x23/0x30 
[ 3602.636830]  [<ffffffff8109564c>] ttwu_do_activate.constprop.78+0x3c/0x70 
[ 3602.672787]  [<ffffffff81097cbc>] try_to_wake_up+0x1dc/0x2d0 
[ 3602.703479]  [<ffffffff81071710>] ? __internal_add_timer+0x130/0x130 
[ 3602.737967]  [<ffffffff81097e17>] wake_up_process+0x27/0x50 
[ 3602.767596]  [<ffffffff8107171e>] process_timeout+0xe/0x10 
[ 3602.796510]  [<ffffffff81070c9a>] call_timer_fn+0x3a/0x120 
[ 3602.823533]  [<ffffffff81071710>] ? __internal_add_timer+0x130/0x130 
[ 3602.855717]  [<ffffffff81072a2e>] run_timer_softirq+0x1fe/0x2b0 
[ 3602.885014]  [<ffffffff8106a8f0>] __do_softirq+0xd0/0x210 
[ 3602.912611]  [<ffffffff8101b883>] ? native_sched_clock+0x13/0x80 
[ 3602.942503]  [<ffffffff8161bddc>] call_softirq+0x1c/0x30 
[ 3602.969510]  [<ffffffff810162a5>] do_softirq+0x75/0xb0 
[ 3602.994957]  [<ffffffff8106abc5>] irq_exit+0xb5/0xc0 
[ 3603.020036]  [<ffffffff8161c75e>] smp_apic_timer_interrupt+0x6e/0x99 
[ 3603.051018]  [<ffffffff8161b69d>] apic_timer_interrupt+0x6d/0x80 
[ 3603.081602] Code:  Bad RIP value. 
[ 3603.097893] RIP  [<          (null)>]           (null) 
[ 3603.123740]  RSP <ffff8801b04efcf0> 
[ 3603.140928] CR2: 0000000000000000 
[ 3603.157190] ---[ end trace 62e555f1b47d35f6 ]--- 
[ 3603.181234] Kernel panic - not syncing: Fatal exception in interrupt 

CAI Qian

^ permalink raw reply

* [PATCH 2/2 v4] sierra_net: keep status interrupt URB active
From: Dan Williams @ 2013-04-09 23:05 UTC (permalink / raw)
  To: Ming Lei
  Cc: Oliver Neukum, Elina Pasheva, Network Development, linux-usb,
	Rory Filer, Phil Sutter
In-Reply-To: <1365548547.23372.2.camel@dcbw.foobar.com>

The driver and firmware sync up through SYNC messages, and the
firmware's affirmative reply to these SYNC messages appears to be the
"Reset" indication received via the status interrupt endpoint.  Thus the
driver needs the status interrupt endpoint always active so that the
Reset indication can be received even if the netdev is closed, which is
the case right after device insertion.

Signed-off-by: Dan Williams <dcbw@redhat.com>
---
 drivers/net/usb/sierra_net.c | 40 ++++++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index 79ab243..c707225 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -44,7 +44,7 @@ static const char driver_name[] = "sierra_net";
 #include <net/ip.h>
 #include <net/udp.h>
 #include <asm/unaligned.h>
-#include <linux/usb/usbnet.h>
+#include "usbnet.h"
 
 #define SWI_USB_REQUEST_GET_FW_ATTR	0x06
 #define SWI_GET_FW_ATTR_MASK		0x08
@@ -427,6 +427,13 @@ static void sierra_net_dosync(struct usbnet *dev)
 
 	dev_dbg(&dev->udev->dev, "%s", __func__);
 
+	/* The SIERRA_NET_HIP_MSYNC_ID command appears to request that the
+	 * firmware restart itself.  After restarting, the modem will respond
+	 * with the SIERRA_NET_HIP_RESTART_ID indication.  The driver continues
+	 * sending MSYNC commands every few seconds until it receives the
+	 * RESTART event from the firmware
+	 */
+
 	/* tell modem we are ready */
 	status = sierra_net_send_sync(dev);
 	if (status < 0)
@@ -705,6 +712,9 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
 	/* set context index initially to 0 - prepares tx hdr template */
 	sierra_net_set_ctx_index(priv, 0);
 
+	/* prepare sync message template */
+	memcpy(priv->sync_msg, sync_tmplate, sizeof(priv->sync_msg));
+
 	/* decrease the rx_urb_size and max_tx_size to 4k on USB 1.1 */
 	dev->rx_urb_size  = SIERRA_NET_RX_URB_SIZE;
 	if (dev->udev->speed != USB_SPEED_HIGH)
@@ -740,11 +750,6 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
 		kfree(priv);
 		return -ENODEV;
 	}
-	/* prepare sync message from template */
-	memcpy(priv->sync_msg, sync_tmplate, sizeof(priv->sync_msg));
-
-	/* initiate the sync sequence */
-	sierra_net_dosync(dev);
 
 	return 0;
 }
@@ -767,8 +772,9 @@ static void sierra_net_unbind(struct usbnet *dev, struct usb_interface *intf)
 		netdev_err(dev->net,
 			"usb_control_msg failed, status %d\n", status);
 
-	sierra_net_set_private(dev, NULL);
+	usbnet_status_stop(dev);
 
+	sierra_net_set_private(dev, NULL);
 	kfree(priv);
 }
 
@@ -909,6 +915,24 @@ static const struct driver_info sierra_net_info_direct_ip = {
 	.tx_fixup = sierra_net_tx_fixup,
 };
 
+static int
+sierra_net_probe(struct usb_interface *udev, const struct usb_device_id *prod)
+{
+	int ret;
+
+	ret = usbnet_probe(udev, prod);
+	if (ret == 0) {
+		struct usbnet *dev = usb_get_intfdata(udev);
+
+		ret = usbnet_status_start(dev, GFP_KERNEL);
+		if (ret == 0) {
+			/* Interrupt URB now set up; initiate sync sequence */
+			sierra_net_dosync(dev);
+		}
+	}
+	return ret;
+}
+
 #define DIRECT_IP_DEVICE(vend, prod) \
 	{USB_DEVICE_INTERFACE_NUMBER(vend, prod, 7), \
 	.driver_info = (unsigned long)&sierra_net_info_direct_ip}, \
@@ -931,7 +955,7 @@ MODULE_DEVICE_TABLE(usb, products);
 static struct usb_driver sierra_net_driver = {
 	.name = "sierra_net",
 	.id_table = products,
-	.probe = usbnet_probe,
+	.probe = sierra_net_probe,
 	.disconnect = usbnet_disconnect,
 	.suspend = usbnet_suspend,
 	.resume = usbnet_resume,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 1/2 v4] usbnet: allow status interrupt URB to always be active
From: Dan Williams @ 2013-04-09 23:02 UTC (permalink / raw)
  To: Ming Lei
  Cc: Oliver Neukum, Elina Pasheva, Network Development, linux-usb,
	Rory Filer, Phil Sutter
In-Reply-To: <1364832288.3059.12.camel@dcbw.foobar.com>

Some drivers (sierra_net) need the status interrupt URB
active even when the device is closed, because they receive
custom indications from firmware.  Add functions to refcount
the status interrupt URB submit/kill operation so that
sub-drivers and the generic driver don't fight over whether
the status interrupt URB is active or not.

A sub-driver can call usbnet_status_start() at any time, but
the URB is only submitted the first time the function is
called.  Likewise, when the sub-driver is done with the URB,
it calls usbnet_status_stop() but the URB is only killed when
all users have stopped it.  The URB is still killed and
re-submitted for suspend/resume, as before, with the same
refcount it had at suspend.

Signed-off-by: Dan Williams <dcbw@redhat.com>
---
 drivers/net/usb/usbnet.c   | 79 ++++++++++++++++++++++++++++++++++++++++++----
 include/linux/usb/usbnet.h |  5 +++
 2 files changed, 77 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 51f3192..e8b363a 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -42,7 +42,7 @@
 #include <linux/workqueue.h>
 #include <linux/mii.h>
 #include <linux/usb.h>
-#include <linux/usb/usbnet.h>
+#include "usbnet.h"
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/pm_runtime.h>
@@ -252,6 +252,70 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf)
 	return 0;
 }
 
+/* Submit the interrupt URB if it hasn't been submitted yet */
+static int __usbnet_status_start(struct usbnet *dev, gfp_t mem_flags,
+					bool force)
+{
+	int ret = 0;
+	bool submit = false;
+
+	if (!dev->interrupt)
+		return 0;
+
+	mutex_lock(&dev->interrupt_mutex);
+
+	if (force) {
+		/* Only submit now if the URB was previously submitted */
+		if (dev->interrupt_count)
+			submit = true;
+	} else if (++dev->interrupt_count == 1)
+		submit = true;
+
+	if (submit)
+		ret = usb_submit_urb(dev->interrupt, mem_flags);
+
+	dev_dbg(&dev->udev->dev, "incremented interrupt URB count to %d\n",
+		dev->interrupt_count);
+	mutex_unlock(&dev->interrupt_mutex);
+	return ret;
+}
+
+int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags)
+{
+	/* Only drivers that implement a status hook should call this */
+	BUG_ON(dev->interrupt == NULL);
+
+	if (test_bit(EVENT_DEV_ASLEEP, &dev->flags))
+		return -EINVAL;
+
+	return __usbnet_status_start(dev, mem_flags, false);
+}
+EXPORT_SYMBOL_GPL(usbnet_status_start);
+
+/* Kill the interrupt URB if all submitters want it killed */
+static void __usbnet_status_stop(struct usbnet *dev, bool force)
+{
+	if (dev->interrupt) {
+		mutex_lock(&dev->interrupt_mutex);
+		if (!force)
+			BUG_ON(dev->interrupt_count == 0);
+
+		if (force || --dev->interrupt_count == 0)
+			usb_kill_urb(dev->interrupt);
+
+		dev_dbg(&dev->udev->dev,
+			"decremented interrupt URB count to %d\n",
+			dev->interrupt_count);
+		mutex_unlock(&dev->interrupt_mutex);
+	}
+}
+
+void usbnet_status_stop(struct usbnet *dev)
+{
+	__usbnet_status_stop(dev, false);
+}
+EXPORT_SYMBOL_GPL(usbnet_status_stop);
+
 /* Passes this packet up the stack, updating its accounting.
  * Some link protocols batch packets, so their rx_fixup paths
  * can return clones as well as just modify the original skb.
@@ -725,7 +789,7 @@ int usbnet_stop (struct net_device *net)
 	if (!(info->flags & FLAG_AVOID_UNLINK_URBS))
 		usbnet_terminate_urbs(dev);
 
-	usb_kill_urb(dev->interrupt);
+	usbnet_status_stop(dev);
 
 	usbnet_purge_paused_rxq(dev);
 
@@ -787,7 +851,7 @@ int usbnet_open (struct net_device *net)
 
 	/* start any status interrupt transfer */
 	if (dev->interrupt) {
-		retval = usb_submit_urb (dev->interrupt, GFP_KERNEL);
+		retval = usbnet_status_start(dev, GFP_KERNEL);
 		if (retval < 0) {
 			netif_err(dev, ifup, dev->net,
 				  "intr submit %d\n", retval);
@@ -1430,6 +1494,8 @@ 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->interrupt_mutex);
+	dev->interrupt_count = 0;
 
 	dev->net = net;
 	strcpy (net->name, "usb%d");
@@ -1565,7 +1631,7 @@ int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
 		 */
 		netif_device_detach (dev->net);
 		usbnet_terminate_urbs(dev);
-		usb_kill_urb(dev->interrupt);
+		__usbnet_status_stop(dev, true);
 
 		/*
 		 * reattach so runtime management can use and
@@ -1585,9 +1651,8 @@ int usbnet_resume (struct usb_interface *intf)
 	int                     retval;
 
 	if (!--dev->suspend_count) {
-		/* resume interrupt URBs */
-		if (dev->interrupt && test_bit(EVENT_DEV_OPEN, &dev->flags))
-			usb_submit_urb(dev->interrupt, GFP_NOIO);
+		/* resume interrupt URBs if they were submitted at suspend */
+		__usbnet_status_start(dev, GFP_NOIO, true);
 
 		spin_lock_irq(&dev->txq.lock);
 		while ((res = usb_get_from_anchor(&dev->deferred))) {
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 0e5ac93..d71f44c 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -56,6 +56,8 @@ struct usbnet {
 	struct sk_buff_head	done;
 	struct sk_buff_head	rxq_pause;
 	struct urb		*interrupt;
+	unsigned		interrupt_count;
+	struct mutex            interrupt_mutex;
 	struct usb_anchor	deferred;
 	struct tasklet_struct	bh;
 
@@ -246,4 +248,7 @@ extern int usbnet_nway_reset(struct net_device *net);
 
 extern int usbnet_manage_power(struct usbnet *, int);
 
+int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags);
+void usbnet_status_stop(struct usbnet *dev);
+
 #endif /* __LINUX_USB_USBNET_H */
-- 
1.8.1.4

^ permalink raw reply related

* Re:Just read your email and this is my response.
From: Barr Guillermo Chavez Esq @ 2013-04-09 18:41 UTC (permalink / raw)





Kindly bear with me for contacting you this way.Mr name is Mr Guillermo
Chavez and am writing you to kindly reply me once you get this message it
is about one of my late friend who died in the ongoing war in SYRIA he was
in the engineering an oil legal dealer who was also my client and i his
legal Lawyer to his business, i will explain further if you show your
interest by responding to me through this my personal email
(gchavez2013@aim.com)

^ permalink raw reply

* Re: [PATCH net-next] tg3: Use bool not int
From: David Miller @ 2013-04-09 21:08 UTC (permalink / raw)
  To: mchan; +Cc: joe, nsujir, netdev
In-Reply-To: <1365541211.2200.7.camel@LTIRV-MCHAN1.corp.ad.broadcom.com>

From: "Michael Chan" <mchan@broadcom.com>
Date: Tue, 9 Apr 2013 14:00:11 -0700

> On Tue, 2013-04-09 at 13:18 -0700, Joe Perches wrote:
>> Using bool can make code more readable.
>> 
>> Convert uses and tests of int to bool.
>> 
>> This also makes a comparison of tg3->link_up
>> (itself bool) a bool comparison instead of int.
>> 
>> Reorder stack variable declarations to make
>> bool fit declaration holes where appropriate.
>> 
>> $ size drivers/net/ethernet/broadcom/tg3.o*
>>    text    data     bss     dec     hex filename
>>  169958   27249   58896  256103   3e867 drivers/net/ethernet/broadcom/tg3.o.new
>>  169968   27249   58896  256113   3e871 drivers/net/ethernet/broadcom/tg3.o.old
>> 
>> Signed-off-by: Joe Perches <joe@perches.com> 
> 
> Thanks.
> 
> Reviewed-by: Michael Chan <mchan@broadcom.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next 07/11] tg3: Add support for link flap avoidance
From: David Miller @ 2013-04-09 21:07 UTC (permalink / raw)
  To: nsujir; +Cc: netdev, mchan
In-Reply-To: <5164811C.2030005@broadcom.com>

From: "Nithin Nayak Sujir" <nsujir@broadcom.com>
Date: Tue, 9 Apr 2013 13:59:08 -0700

> On 04/09/2013 12:15 PM, David Miller wrote:
>> From: "Nithin Nayak Sujir" <nsujir@broadcom.com>
>> Date: Tue, 9 Apr 2013 11:48:07 -0700
>>
>> If we force a PHY reset due to EEE changes, will the ASF traffic
>> disruption warning message be emitted?
> 
> No, the message is not emitted. There are a couple of reasons for
> this.
> 
> 1. The intent of the message is to warn on user initiated operations
> that cause a link flap.
> 
> 2. The link flap due to EEE mismatch and force reset is possible the
> very first time the system is powered on. It's reasonable to expect
> the link to be in flux till the driver is in sync.
> 
> After the 1st time the EEE mismatch can only happen if the user
> modfies it via ethtool. tg3 does not yet support the set_eee ethtool
> handler. When we implement that, we will add the warning there similar
> to the other ethtool op handlers.

Ok, thanks for the explanation.

^ permalink raw reply

* Re: [PATCH net-next] tg3: Use bool not int
From: Michael Chan @ 2013-04-09 21:00 UTC (permalink / raw)
  To: Joe Perches; +Cc: Nithin Nayak Sujir, davem, netdev
In-Reply-To: <1365538694.18072.8.camel@joe-AO722>

On Tue, 2013-04-09 at 13:18 -0700, Joe Perches wrote:
> Using bool can make code more readable.
> 
> Convert uses and tests of int to bool.
> 
> This also makes a comparison of tg3->link_up
> (itself bool) a bool comparison instead of int.
> 
> Reorder stack variable declarations to make
> bool fit declaration holes where appropriate.
> 
> $ size drivers/net/ethernet/broadcom/tg3.o*
>    text    data     bss     dec     hex filename
>  169958   27249   58896  256103   3e867 drivers/net/ethernet/broadcom/tg3.o.new
>  169968   27249   58896  256113   3e871 drivers/net/ethernet/broadcom/tg3.o.old
> 
> Signed-off-by: Joe Perches <joe@perches.com> 

Thanks.

Reviewed-by: Michael Chan <mchan@broadcom.com>

^ permalink raw reply

* Re: [PATCH net-next 07/11] tg3: Add support for link flap avoidance
From: Nithin Nayak Sujir @ 2013-04-09 20:59 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, mchan
In-Reply-To: <20130409.151540.1097356797775302170.davem@davemloft.net>



On 04/09/2013 12:15 PM, David Miller wrote:
> From: "Nithin Nayak Sujir" <nsujir@broadcom.com>
> Date: Tue, 9 Apr 2013 11:48:07 -0700
>
>> This patch and the following two patches add support for link flap avoidance
>> by maintaining the link on power down. This feature is required for
>> management capable devices to have the management connection
>> uninterrupted on driver reload, reboot and interface up/down.
>>
>> A second NVRAM setting is 1G_ON_VAUX_OK (off by default). This adds
>> support for gigabit link speed when device is on auxiliary power.
>>
>> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
>> Signed-off-by: Michael Chan <mchan@broadcom.com>
>
> Looks good, all applied, thanks.
>
> If we force a PHY reset due to EEE changes, will the ASF traffic
> disruption warning message be emitted?

No, the message is not emitted. There are a couple of reasons for this.

1. The intent of the message is to warn on user initiated operations that cause 
a link flap.

2. The link flap due to EEE mismatch and force reset is possible the very first 
time the system is powered on. It's reasonable to expect the link to be in flux 
till the driver is in sync.


After the 1st time the EEE mismatch can only happen if the user modfies it via 
ethtool. tg3 does not yet support the set_eee ethtool handler. When we implement 
that, we will add the warning there similar to the other ethtool op handlers.


> --
> 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: [PATCH net-next 3/3] net: ipv6: only invalidate previously tokenized addresses
From: Hannes Frederic Sowa @ 2013-04-09 20:38 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, netdev
In-Reply-To: <1365515236-7154-4-git-send-email-dborkman@redhat.com>

On Tue, Apr 09, 2013 at 03:47:16PM +0200, Daniel Borkmann wrote:
> Instead of invalidating all IPv6 addresses with global scope
> when one decides to use IPv6 tokens, we should only invalidate
> previous tokens and leave the rest intact until they expire
> eventually (or are intact forever). For doing this less greedy
> approach, we're adding a bool at the end of inet6_ifaddr structure
> instead, for two reasons: i) per-inet6_ifaddr flag space is
> already used up, making it wider might not be a good idea,
> since ii) also we do not necessarily need to export this
> information into user space.
> 
> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

^ permalink raw reply

* Re: [PATCH net-next 2/3] net: ipv6: also allow token to be set when device not ready
From: Hannes Frederic Sowa @ 2013-04-09 20:37 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, netdev
In-Reply-To: <1365515236-7154-3-git-send-email-dborkman@redhat.com>

On Tue, Apr 09, 2013 at 03:47:15PM +0200, Daniel Borkmann wrote:
> When we set the iftoken in inet6_set_iftoken(), we return -EINVAL
> when the device does not have flag IF_READY. This is however not
> necessary and rather an artificial usability barrier, since we
> simply can set the token despite that, and in case the device is
> ready, we just send out our rs, otherwise ifup et al. will do
> this for us anyway.
> 
> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

^ permalink raw reply

* Re: [PATCH net-next 1/3] net: ipv6: minor: use in6addr_any in token init
From: Hannes Frederic Sowa @ 2013-04-09 20:37 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, netdev
In-Reply-To: <1365515236-7154-2-git-send-email-dborkman@redhat.com>

On Tue, Apr 09, 2013 at 03:47:14PM +0200, Daniel Borkmann wrote:
> Since we check for !ipv6_addr_any(&in6_dev->token) in
> addrconf_prefix_rcv(), make the token initialization on
> device setup more intuitive by using in6addr_any as an
> initializer.
> 
> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

^ permalink raw reply

* [PATCH 2/2] bonding: IFF_BONDING is not stripped on enslave failure
From: Nikolay Aleksandrov @ 2013-04-09 20:17 UTC (permalink / raw)
  To: netdev; +Cc: andy, fubar, davem
In-Reply-To: <1365538644-1502-1-git-send-email-nikolay@redhat.com>

While enslaving a new device and after IFF_BONDING flag is set, in case
of failure it is not stripped from the device's priv_flags while
cleaning up, which could lead to other problems.
Cleaning at err_close because the flag is set after dev_open().

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
 drivers/net/bonding/bond_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9995ddc..0d9ee48 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1906,6 +1906,7 @@ err_detach:
 	write_unlock_bh(&bond->lock);
 
 err_close:
+	slave_dev->priv_flags &= ~IFF_BONDING;
 	dev_close(slave_dev);
 
 err_unset_master:
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 1/2] bonding: fix netdev event NULL pointer dereference
From: Nikolay Aleksandrov @ 2013-04-09 20:17 UTC (permalink / raw)
  To: netdev; +Cc: andy, fubar, davem

In commit 471cb5a33dcbd7c529684a2ac7ba4451414ee4a7 ("bonding: remove
usage of dev->master") a bug was introduced which causes a NULL pointer
dereference. If a bond device is in mode 6 (ALB) and a slave is added
it will dereference a NULL pointer in bond_slave_netdev_event().
This is because in bond_enslave we have bond_alb_init_slave() which
changes the MAC address of the slave and causes a NETDEV_CHANGEADDR.
Then we have in bond_slave_netdev_event():
        struct slave *slave = bond_slave_get_rtnl(slave_dev);
        struct bonding *bond = slave->bond;
bond_slave_get_rtnl() dereferences slave_dev->rx_handler_data which at
that time is NULL since netdev_rx_handler_register() is called later.

This is fixed by checking if slave is NULL before dereferencing it.

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
 drivers/net/bonding/bond_main.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 171b10f..9995ddc 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3168,11 +3168,21 @@ static int bond_slave_netdev_event(unsigned long event,
 				   struct net_device *slave_dev)
 {
 	struct slave *slave = bond_slave_get_rtnl(slave_dev);
-	struct bonding *bond = slave->bond;
-	struct net_device *bond_dev = slave->bond->dev;
+	struct bonding *bond;
+	struct net_device *bond_dev;
 	u32 old_speed;
 	u8 old_duplex;
 
+	/*
+	 * A netdev event can be generated while enslaving a device
+	 * before netdev_rx_handler_register is called in which case
+	 * slave will be NULL
+	 */
+	if (!slave)
+		return NOTIFY_DONE;
+	bond_dev = slave->bond->dev;
+	bond = slave->bond;
+
 	switch (event) {
 	case NETDEV_UNREGISTER:
 		if (bond->setup_by_slave)
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH net-next] tg3: Use bool not int
From: Joe Perches @ 2013-04-09 20:18 UTC (permalink / raw)
  To: Nithin Nayak Sujir; +Cc: davem, netdev, mchan
In-Reply-To: <1365533291-5672-1-git-send-email-nsujir@broadcom.com>

Using bool can make code more readable.

Convert uses and tests of int to bool.

This also makes a comparison of tg3->link_up
(itself bool) a bool comparison instead of int.

Reorder stack variable declarations to make
bool fit declaration holes where appropriate.

$ size drivers/net/ethernet/broadcom/tg3.o*
   text	   data	    bss	    dec	    hex	filename
 169958	  27249	  58896	 256103	  3e867	drivers/net/ethernet/broadcom/tg3.o.new
 169968	  27249	  58896	 256113	  3e871	drivers/net/ethernet/broadcom/tg3.o.old

Signed-off-by: Joe Perches <joe@perches.com>
---

Reduces allyesconfig object size 10 bytes! (wow!!)

 drivers/net/ethernet/broadcom/tg3.c | 157 ++++++++++++++++++------------------
 1 file changed, 80 insertions(+), 77 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 0fe6444..ce98572 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -2228,7 +2228,7 @@ static void tg3_phy_toggle_apd(struct tg3 *tp, bool enable)
 	tg3_writephy(tp, MII_TG3_MISC_SHDW, reg);
 }
 
-static void tg3_phy_toggle_automdix(struct tg3 *tp, int enable)
+static void tg3_phy_toggle_automdix(struct tg3 *tp, bool enable)
 {
 	u32 phy;
 
@@ -2320,7 +2320,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
 	tg3_phy_toggle_auxctl_smdsp(tp, false);
 }
 
-static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
+static void tg3_phy_eee_adjust(struct tg3 *tp, bool current_link_up)
 {
 	u32 val;
 
@@ -2330,7 +2330,7 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
 	tp->setlpicnt = 0;
 
 	if (tp->link_config.autoneg == AUTONEG_ENABLE &&
-	    current_link_up == 1 &&
+	    current_link_up &&
 	    tp->link_config.active_duplex == DUPLEX_FULL &&
 	    (tp->link_config.active_speed == SPEED_100 ||
 	     tp->link_config.active_speed == SPEED_1000)) {
@@ -2352,7 +2352,7 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
 	}
 
 	if (!tp->setlpicnt) {
-		if (current_link_up == 1 &&
+		if (current_link_up &&
 		   !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
 			tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0000);
 			tg3_phy_toggle_auxctl_smdsp(tp, false);
@@ -2705,7 +2705,7 @@ out:
 	if (tg3_chip_rev_id(tp) == CHIPREV_ID_5762_A0)
 		tg3_phydsp_write(tp, 0xffb, 0x4000);
 
-	tg3_phy_toggle_automdix(tp, 1);
+	tg3_phy_toggle_automdix(tp, true);
 	tg3_phy_set_wirespeed(tp);
 	return 0;
 }
@@ -3851,7 +3851,7 @@ static int tg3_load_tso_firmware(struct tg3 *tp)
 
 
 /* tp->lock is held. */
-static void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
+static void __tg3_set_mac_addr(struct tg3 *tp, bool skip_mac_1)
 {
 	u32 addr_high, addr_low;
 	int i;
@@ -3914,7 +3914,7 @@ static int tg3_power_up(struct tg3 *tp)
 	return err;
 }
 
-static int tg3_setup_phy(struct tg3 *, int);
+static int tg3_setup_phy(struct tg3 *, bool);
 
 static int tg3_power_down_prepare(struct tg3 *tp)
 {
@@ -3986,7 +3986,7 @@ static int tg3_power_down_prepare(struct tg3 *tp)
 			tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER;
 
 		if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES))
-			tg3_setup_phy(tp, 0);
+			tg3_setup_phy(tp, false);
 	}
 
 	if (tg3_asic_rev(tp) == ASIC_REV_5906) {
@@ -4583,7 +4583,7 @@ static bool tg3_phy_copper_fetch_rmtadv(struct tg3 *tp, u32 *rmtadv)
 	return true;
 }
 
-static bool tg3_test_and_report_link_chg(struct tg3 *tp, int curr_link_up)
+static bool tg3_test_and_report_link_chg(struct tg3 *tp, bool curr_link_up)
 {
 	if (curr_link_up != tp->link_up) {
 		if (curr_link_up) {
@@ -4613,9 +4613,9 @@ static void tg3_clear_mac_status(struct tg3 *tp)
 	udelay(40);
 }
 
-static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
+static int tg3_setup_copper_phy(struct tg3 *tp, bool force_reset)
 {
-	int current_link_up;
+	bool current_link_up;
 	u32 bmsr, val;
 	u32 lcl_adv, rmt_adv;
 	u16 current_speed;
@@ -4642,7 +4642,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
 		tg3_readphy(tp, MII_BMSR, &bmsr);
 		if (!tg3_readphy(tp, MII_BMSR, &bmsr) &&
 		    !(bmsr & BMSR_LSTATUS))
-			force_reset = 1;
+			force_reset = true;
 	}
 	if (force_reset)
 		tg3_phy_reset(tp);
@@ -4706,7 +4706,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
 			tg3_writephy(tp, MII_TG3_EXT_CTRL, 0);
 	}
 
-	current_link_up = 0;
+	current_link_up = false;
 	current_speed = SPEED_UNKNOWN;
 	current_duplex = DUPLEX_UNKNOWN;
 	tp->phy_flags &= ~TG3_PHYFLG_MDIX_STATE;
@@ -4771,7 +4771,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
 			    eee_config_ok &&
 			    tg3_phy_copper_an_config_ok(tp, &lcl_adv) &&
 			    tg3_phy_copper_fetch_rmtadv(tp, &rmt_adv))
-				current_link_up = 1;
+				current_link_up = true;
 
 			/* EEE settings changes take effect only after a phy
 			 * reset.  If we have skipped a reset due to Link Flap
@@ -4785,11 +4785,11 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
 			if (!(bmcr & BMCR_ANENABLE) &&
 			    tp->link_config.speed == current_speed &&
 			    tp->link_config.duplex == current_duplex) {
-				current_link_up = 1;
+				current_link_up = true;
 			}
 		}
 
-		if (current_link_up == 1 &&
+		if (current_link_up &&
 		    tp->link_config.active_duplex == DUPLEX_FULL) {
 			u32 reg, bit;
 
@@ -4809,11 +4809,11 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
 	}
 
 relink:
-	if (current_link_up == 0 || (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) {
+	if (!current_link_up || (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) {
 		tg3_phy_copper_begin(tp);
 
 		if (tg3_flag(tp, ROBOSWITCH)) {
-			current_link_up = 1;
+			current_link_up = true;
 			/* FIXME: when BCM5325 switch is used use 100 MBit/s */
 			current_speed = SPEED_1000;
 			current_duplex = DUPLEX_FULL;
@@ -4824,11 +4824,11 @@ relink:
 		tg3_readphy(tp, MII_BMSR, &bmsr);
 		if ((!tg3_readphy(tp, MII_BMSR, &bmsr) && (bmsr & BMSR_LSTATUS)) ||
 		    (tp->mac_mode & MAC_MODE_PORT_INT_LPBACK))
-			current_link_up = 1;
+			current_link_up = true;
 	}
 
 	tp->mac_mode &= ~MAC_MODE_PORT_MODE_MASK;
-	if (current_link_up == 1) {
+	if (current_link_up) {
 		if (tp->link_config.active_speed == SPEED_100 ||
 		    tp->link_config.active_speed == SPEED_10)
 			tp->mac_mode |= MAC_MODE_PORT_MODE_MII;
@@ -4864,7 +4864,7 @@ relink:
 		tp->mac_mode |= MAC_MODE_HALF_DUPLEX;
 
 	if (tg3_asic_rev(tp) == ASIC_REV_5700) {
-		if (current_link_up == 1 &&
+		if (current_link_up &&
 		    tg3_5700_link_polarity(tp, tp->link_config.active_speed))
 			tp->mac_mode |= MAC_MODE_LINK_POLARITY;
 		else
@@ -4895,7 +4895,7 @@ relink:
 	udelay(40);
 
 	if (tg3_asic_rev(tp) == ASIC_REV_5700 &&
-	    current_link_up == 1 &&
+	    current_link_up &&
 	    tp->link_config.active_speed == SPEED_1000 &&
 	    (tg3_flag(tp, PCIX_MODE) || tg3_flag(tp, PCI_HIGH_SPEED))) {
 		udelay(120);
@@ -5335,19 +5335,19 @@ static void tg3_init_bcm8002(struct tg3 *tp)
 	tg3_writephy(tp, 0x10, 0x8011);
 }
 
-static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status)
+static bool tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status)
 {
 	u16 flowctrl;
+	bool current_link_up;
 	u32 sg_dig_ctrl, sg_dig_status;
 	u32 serdes_cfg, expected_sg_dig_ctrl;
 	int workaround, port_a;
-	int current_link_up;
 
 	serdes_cfg = 0;
 	expected_sg_dig_ctrl = 0;
 	workaround = 0;
 	port_a = 1;
-	current_link_up = 0;
+	current_link_up = false;
 
 	if (tg3_chip_rev_id(tp) != CHIPREV_ID_5704_A0 &&
 	    tg3_chip_rev_id(tp) != CHIPREV_ID_5704_A1) {
@@ -5378,7 +5378,7 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status)
 		}
 		if (mac_status & MAC_STATUS_PCS_SYNCED) {
 			tg3_setup_flow_control(tp, 0, 0);
-			current_link_up = 1;
+			current_link_up = true;
 		}
 		goto out;
 	}
@@ -5399,7 +5399,7 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status)
 				    MAC_STATUS_RCVD_CFG)) ==
 		     MAC_STATUS_PCS_SYNCED)) {
 			tp->serdes_counter--;
-			current_link_up = 1;
+			current_link_up = true;
 			goto out;
 		}
 restart_autoneg:
@@ -5434,7 +5434,7 @@ restart_autoneg:
 					   mii_adv_to_ethtool_adv_x(remote_adv);
 
 			tg3_setup_flow_control(tp, local_adv, remote_adv);
-			current_link_up = 1;
+			current_link_up = true;
 			tp->serdes_counter = 0;
 			tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
 		} else if (!(sg_dig_status & SG_DIG_AUTONEG_COMPLETE)) {
@@ -5462,7 +5462,7 @@ restart_autoneg:
 				if ((mac_status & MAC_STATUS_PCS_SYNCED) &&
 				    !(mac_status & MAC_STATUS_RCVD_CFG)) {
 					tg3_setup_flow_control(tp, 0, 0);
-					current_link_up = 1;
+					current_link_up = true;
 					tp->phy_flags |=
 						TG3_PHYFLG_PARALLEL_DETECT;
 					tp->serdes_counter =
@@ -5480,9 +5480,9 @@ out:
 	return current_link_up;
 }
 
-static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status)
+static bool tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status)
 {
-	int current_link_up = 0;
+	bool current_link_up = false;
 
 	if (!(mac_status & MAC_STATUS_PCS_SYNCED))
 		goto out;
@@ -5509,7 +5509,7 @@ static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status)
 
 			tg3_setup_flow_control(tp, local_adv, remote_adv);
 
-			current_link_up = 1;
+			current_link_up = true;
 		}
 		for (i = 0; i < 30; i++) {
 			udelay(20);
@@ -5524,15 +5524,15 @@ static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status)
 		}
 
 		mac_status = tr32(MAC_STATUS);
-		if (current_link_up == 0 &&
+		if (!current_link_up &&
 		    (mac_status & MAC_STATUS_PCS_SYNCED) &&
 		    !(mac_status & MAC_STATUS_RCVD_CFG))
-			current_link_up = 1;
+			current_link_up = true;
 	} else {
 		tg3_setup_flow_control(tp, 0, 0);
 
 		/* Forcing 1000FD link up. */
-		current_link_up = 1;
+		current_link_up = true;
 
 		tw32_f(MAC_MODE, (tp->mac_mode | MAC_MODE_SEND_CONFIGS));
 		udelay(40);
@@ -5545,13 +5545,13 @@ out:
 	return current_link_up;
 }
 
-static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset)
+static int tg3_setup_fiber_phy(struct tg3 *tp, bool force_reset)
 {
 	u32 orig_pause_cfg;
 	u16 orig_active_speed;
 	u8 orig_active_duplex;
 	u32 mac_status;
-	int current_link_up;
+	bool current_link_up;
 	int i;
 
 	orig_pause_cfg = tp->link_config.active_flowctrl;
@@ -5588,7 +5588,7 @@ static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset)
 	tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED);
 	udelay(40);
 
-	current_link_up = 0;
+	current_link_up = false;
 	tp->link_config.rmt_adv = 0;
 	mac_status = tr32(MAC_STATUS);
 
@@ -5613,7 +5613,7 @@ static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset)
 
 	mac_status = tr32(MAC_STATUS);
 	if ((mac_status & MAC_STATUS_PCS_SYNCED) == 0) {
-		current_link_up = 0;
+		current_link_up = false;
 		if (tp->link_config.autoneg == AUTONEG_ENABLE &&
 		    tp->serdes_counter == 0) {
 			tw32_f(MAC_MODE, (tp->mac_mode |
@@ -5623,7 +5623,7 @@ static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset)
 		}
 	}
 
-	if (current_link_up == 1) {
+	if (current_link_up) {
 		tp->link_config.active_speed = SPEED_1000;
 		tp->link_config.active_duplex = DUPLEX_FULL;
 		tw32(MAC_LED_CTRL, (tp->led_ctrl |
@@ -5648,12 +5648,13 @@ static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset)
 	return 0;
 }
 
-static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
+static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset)
 {
-	int current_link_up = 0, err = 0;
+	int err = 0;
 	u32 bmsr, bmcr;
 	u16 current_speed = SPEED_UNKNOWN;
 	u8 current_duplex = DUPLEX_UNKNOWN;
+	bool current_link_up = false;
 	u32 local_adv, remote_adv, sgsr;
 
 	if ((tg3_asic_rev(tp) == ASIC_REV_5719 ||
@@ -5669,7 +5670,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
 		if (!(sgsr & SERDES_TG3_LINK_UP)) {
 			tp->mac_mode |= MAC_MODE_PORT_MODE_GMII;
 		} else {
-			current_link_up = 1;
+			current_link_up = true;
 			if (sgsr & SERDES_TG3_SPEED_1000) {
 				current_speed = SPEED_1000;
 				tp->mac_mode |= MAC_MODE_PORT_MODE_GMII;
@@ -5789,7 +5790,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
 
 	if (bmsr & BMSR_LSTATUS) {
 		current_speed = SPEED_1000;
-		current_link_up = 1;
+		current_link_up = true;
 		if (bmcr & BMCR_FULLDPLX)
 			current_duplex = DUPLEX_FULL;
 		else
@@ -5816,13 +5817,13 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
 			} else if (!tg3_flag(tp, 5780_CLASS)) {
 				/* Link is up via parallel detect */
 			} else {
-				current_link_up = 0;
+				current_link_up = false;
 			}
 		}
 	}
 
 fiber_setup_done:
-	if (current_link_up == 1 && current_duplex == DUPLEX_FULL)
+	if (current_link_up && current_duplex == DUPLEX_FULL)
 		tg3_setup_flow_control(tp, local_adv, remote_adv);
 
 	tp->mac_mode &= ~MAC_MODE_HALF_DUPLEX;
@@ -5901,7 +5902,7 @@ static void tg3_serdes_parallel_detect(struct tg3 *tp)
 	}
 }
 
-static int tg3_setup_phy(struct tg3 *tp, int force_reset)
+static int tg3_setup_phy(struct tg3 *tp, bool force_reset)
 {
 	u32 val;
 	int err;
@@ -6802,7 +6803,7 @@ static void tg3_poll_link(struct tg3 *tp)
 				      MAC_STATUS_LNKSTATE_CHANGED));
 				udelay(40);
 			} else
-				tg3_setup_phy(tp, 0);
+				tg3_setup_phy(tp, false);
 			spin_unlock(&tp->lock);
 		}
 	}
@@ -7899,7 +7900,7 @@ static int tg3_phy_lpbk_set(struct tg3 *tp, u32 speed, bool extlpbk)
 	u32 val, bmcr, mac_mode, ptest = 0;
 
 	tg3_phy_toggle_apd(tp, false);
-	tg3_phy_toggle_automdix(tp, 0);
+	tg3_phy_toggle_automdix(tp, false);
 
 	if (extlpbk && tg3_phy_set_extloopbk(tp))
 		return -EIO;
@@ -8007,7 +8008,7 @@ static void tg3_set_loopback(struct net_device *dev, netdev_features_t features)
 		spin_lock_bh(&tp->lock);
 		tg3_mac_loopback(tp, false);
 		/* Force link status check */
-		tg3_setup_phy(tp, 1);
+		tg3_setup_phy(tp, true);
 		spin_unlock_bh(&tp->lock);
 		netdev_info(dev, "Internal MAC loopback mode disabled.\n");
 	}
@@ -8518,7 +8519,7 @@ err_out:
 /* To stop a block, clear the enable bit and poll till it
  * clears.  tp->lock is held.
  */
-static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, int silent)
+static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, bool silent)
 {
 	unsigned int i;
 	u32 val;
@@ -8562,7 +8563,7 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, int
 }
 
 /* tp->lock is held. */
-static int tg3_abort_hw(struct tg3 *tp, int silent)
+static int tg3_abort_hw(struct tg3 *tp, bool silent)
 {
 	int i, err;
 
@@ -8952,7 +8953,7 @@ static void tg3_get_nstats(struct tg3 *, struct rtnl_link_stats64 *);
 static void tg3_get_estats(struct tg3 *, struct tg3_ethtool_stats *);
 
 /* tp->lock is held. */
-static int tg3_halt(struct tg3 *tp, int kind, int silent)
+static int tg3_halt(struct tg3 *tp, int kind, bool silent)
 {
 	int err;
 
@@ -8963,7 +8964,7 @@ static int tg3_halt(struct tg3 *tp, int kind, int silent)
 	tg3_abort_hw(tp, silent);
 	err = tg3_chip_reset(tp);
 
-	__tg3_set_mac_addr(tp, 0);
+	__tg3_set_mac_addr(tp, false);
 
 	tg3_write_sig_legacy(tp, kind);
 	tg3_write_sig_post_reset(tp, kind);
@@ -8987,7 +8988,8 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
 {
 	struct tg3 *tp = netdev_priv(dev);
 	struct sockaddr *addr = p;
-	int err = 0, skip_mac_1 = 0;
+	int err = 0;
+	bool skip_mac_1 = false;
 
 	if (!is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;
@@ -9008,7 +9010,7 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
 		/* Skip MAC addr 1 if ASF is using it. */
 		if ((addr0_high != addr1_high || addr0_low != addr1_low) &&
 		    !(addr1_high == 0 && addr1_low == 0))
-			skip_mac_1 = 1;
+			skip_mac_1 = true;
 	}
 	spin_lock_bh(&tp->lock);
 	__tg3_set_mac_addr(tp, skip_mac_1);
@@ -9427,7 +9429,7 @@ static void tg3_rss_write_indir_tbl(struct tg3 *tp)
 }
 
 /* tp->lock is held. */
-static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
+static int tg3_reset_hw(struct tg3 *tp, bool reset_phy)
 {
 	u32 val, rdmac_mode;
 	int i, err, limit;
@@ -9820,7 +9822,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 	tg3_rings_reset(tp);
 
 	/* Initialize MAC address and backoff seed. */
-	__tg3_set_mac_addr(tp, 0);
+	__tg3_set_mac_addr(tp, false);
 
 	/* MTU + ethernet header + FCS + optional VLAN tag */
 	tw32(MAC_RX_MTU_SIZE,
@@ -10271,7 +10273,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 		if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
 			tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER;
 
-		err = tg3_setup_phy(tp, 0);
+		err = tg3_setup_phy(tp, false);
 		if (err)
 			return err;
 
@@ -10351,7 +10353,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 /* Called at device open time to get the chip ready for
  * packet processing.  Invoked with tp->lock held.
  */
-static int tg3_init_hw(struct tg3 *tp, int reset_phy)
+static int tg3_init_hw(struct tg3 *tp, bool reset_phy)
 {
 	tg3_switch_clocks(tp);
 
@@ -10612,7 +10614,7 @@ static void tg3_timer(unsigned long __opaque)
 				phy_event = 1;
 
 			if (phy_event)
-				tg3_setup_phy(tp, 0);
+				tg3_setup_phy(tp, false);
 		} else if (tg3_flag(tp, POLL_SERDES)) {
 			u32 mac_stat = tr32(MAC_STATUS);
 			int need_setup = 0;
@@ -10635,7 +10637,7 @@ static void tg3_timer(unsigned long __opaque)
 					tw32_f(MAC_MODE, tp->mac_mode);
 					udelay(40);
 				}
-				tg3_setup_phy(tp, 0);
+				tg3_setup_phy(tp, false);
 			}
 		} else if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) &&
 			   tg3_flag(tp, 5780_CLASS)) {
@@ -10721,7 +10723,7 @@ static void tg3_timer_stop(struct tg3 *tp)
 /* Restart hardware after configuration changes, self-test, etc.
  * Invoked with tp->lock held.
  */
-static int tg3_restart_hw(struct tg3 *tp, int reset_phy)
+static int tg3_restart_hw(struct tg3 *tp, bool reset_phy)
 	__releases(tp->lock)
 	__acquires(tp->lock)
 {
@@ -10771,7 +10773,7 @@ static void tg3_reset_task(struct work_struct *work)
 	}
 
 	tg3_halt(tp, RESET_KIND_SHUTDOWN, 0);
-	err = tg3_init_hw(tp, 1);
+	err = tg3_init_hw(tp, true);
 	if (err)
 		goto out;
 
@@ -10941,7 +10943,7 @@ static int tg3_test_msi(struct tg3 *tp)
 	tg3_full_lock(tp, 1);
 
 	tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
-	err = tg3_init_hw(tp, 1);
+	err = tg3_init_hw(tp, true);
 
 	tg3_full_unlock(tp);
 
@@ -11814,7 +11816,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 	tg3_warn_mgmt_link_flap(tp);
 
 	if (netif_running(dev))
-		tg3_setup_phy(tp, 1);
+		tg3_setup_phy(tp, true);
 
 	tg3_full_unlock(tp);
 
@@ -11970,7 +11972,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
 
 	if (netif_running(dev)) {
 		tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
-		err = tg3_restart_hw(tp, 0);
+		err = tg3_restart_hw(tp, false);
 		if (!err)
 			tg3_netif_start(tp);
 	}
@@ -12094,7 +12096,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
 
 		if (netif_running(dev)) {
 			tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
-			err = tg3_restart_hw(tp, 0);
+			err = tg3_restart_hw(tp, false);
 			if (!err)
 				tg3_netif_start(tp);
 		}
@@ -13164,7 +13166,7 @@ static int tg3_test_loopback(struct tg3 *tp, u64 *data, bool do_extlpbk)
 		goto done;
 	}
 
-	err = tg3_reset_hw(tp, 1);
+	err = tg3_reset_hw(tp, true);
 	if (err) {
 		data[TG3_MAC_LOOPB_TEST] = TG3_LOOPBACK_FAILED;
 		data[TG3_PHY_LOOPB_TEST] = TG3_LOOPBACK_FAILED;
@@ -13331,7 +13333,7 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
 		tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
 		if (netif_running(dev)) {
 			tg3_flag_set(tp, INIT_COMPLETE);
-			err2 = tg3_restart_hw(tp, 1);
+			err2 = tg3_restart_hw(tp, true);
 			if (!err2)
 				tg3_netif_start(tp);
 		}
@@ -13648,7 +13650,8 @@ static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp,
 static int tg3_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct tg3 *tp = netdev_priv(dev);
-	int err, reset_phy = 0;
+	int err;
+	bool reset_phy = false;
 
 	if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU(tp))
 		return -EINVAL;
@@ -13675,7 +13678,7 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu)
 	 * breaks all requests to 256 bytes.
 	 */
 	if (tg3_asic_rev(tp) == ASIC_REV_57766)
-		reset_phy = 1;
+		reset_phy = true;
 
 	err = tg3_restart_hw(tp, reset_phy);
 
@@ -16575,7 +16578,7 @@ out:
 }
 
 static int tg3_do_test_dma(struct tg3 *tp, u32 *buf, dma_addr_t buf_dma,
-			   int size, int to_device)
+			   int size, bool to_device)
 {
 	struct tg3_internal_buffer_desc test_desc;
 	u32 sram_dma_descs;
@@ -16775,7 +16778,7 @@ static int tg3_test_dma(struct tg3 *tp)
 			p[i] = i;
 
 		/* Send the buffer to the chip. */
-		ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 1);
+		ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, true);
 		if (ret) {
 			dev_err(&tp->pdev->dev,
 				"%s: Buffer write failed. err = %d\n",
@@ -16798,7 +16801,7 @@ static int tg3_test_dma(struct tg3 *tp)
 		}
 #endif
 		/* Now read it back. */
-		ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 0);
+		ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, false);
 		if (ret) {
 			dev_err(&tp->pdev->dev, "%s: Buffer read failed. "
 				"err = %d\n", __func__, ret);
@@ -17479,7 +17482,7 @@ static int tg3_suspend(struct device *device)
 		tg3_full_lock(tp, 0);
 
 		tg3_flag_set(tp, INIT_COMPLETE);
-		err2 = tg3_restart_hw(tp, 1);
+		err2 = tg3_restart_hw(tp, true);
 		if (err2)
 			goto out;
 
@@ -17653,7 +17656,7 @@ static void tg3_io_resume(struct pci_dev *pdev)
 
 	tg3_full_lock(tp, 0);
 	tg3_flag_set(tp, INIT_COMPLETE);
-	err = tg3_restart_hw(tp, 1);
+	err = tg3_restart_hw(tp, true);
 	if (err) {
 		tg3_full_unlock(tp);
 		netdev_err(netdev, "Cannot restart hardware after reset.\n");

^ permalink raw reply related

* Re: linked list corruption/use after free on bonding unload.
From: Dave Jones @ 2013-04-09 19:42 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20130409.153831.1917719597139130549.davem@davemloft.net>

On Tue, Apr 09, 2013 at 03:38:31PM -0400, David Miller wrote:
 > From: Dave Jones <davej@redhat.com>
 > Date: Tue, 9 Apr 2013 14:50:02 -0400
 > 
 > > Just hit this while doing a load/unload test of various modules.
 > > No bonding configuration had been set up, just the module loaded.
 > 
 > What tree?

v3.9-rc6-13-gf011a08

 > We recently had to revert a bonding "fix" and implement it differently.
 > So Linus's tree could cause this oops on bonding unload but 'net'
 > won't.

ah, sounds promising. I'll retest when your next push lands.

thanks,
	Dave

^ permalink raw reply

* Re: linked list corruption/use after free on bonding unload.
From: David Miller @ 2013-04-09 19:38 UTC (permalink / raw)
  To: davej; +Cc: netdev
In-Reply-To: <20130409185002.GA3784@redhat.com>

From: Dave Jones <davej@redhat.com>
Date: Tue, 9 Apr 2013 14:50:02 -0400

> Just hit this while doing a load/unload test of various modules.
> No bonding configuration had been set up, just the module loaded.

What tree?

We recently had to revert a bonding "fix" and implement it differently.
So Linus's tree could cause this oops on bonding unload but 'net'
won't.

^ permalink raw reply

* linked list corruption/use after free on bonding unload.
From: Dave Jones @ 2013-04-09 18:50 UTC (permalink / raw)
  To: netdev

Just hit this while doing a load/unload test of various modules.
No bonding configuration had been set up, just the module loaded.

bonding: bond0: released all slaves
------------[ cut here ]------------
WARNING: at lib/list_debug.c:93 __list_del_entry+0xa1/0xd0()
Hardware name: GA-MA78GM-S2H
list_del corruption. prev->next should be ffff88005b420be8, but was 6b6b6b6b6b6b6b6b
Pid: 3886605, comm: modprobe Not tainted 3.9.0-rc6+ #19
Call Trace:
 [<ffffffff810450a5>] warn_slowpath_common+0x75/0xa0
 [<ffffffff8104511c>] warn_slowpath_fmt+0x4c/0x50
 [<ffffffff816b8502>] ? printk+0x67/0x69
 [<ffffffff81353df1>] __list_del_entry+0xa1/0xd0
 [<ffffffff81353e2d>] list_del+0xd/0x30
 [<ffffffffa14c444b>] bond_uninit+0x6b/0xd0 [bonding]
 [<ffffffff81581560>] rollback_registered_many+0x150/0x210
 [<ffffffff81581749>] unregister_netdevice_many+0x19/0x60
 [<ffffffff8159427e>] __rtnl_link_unregister+0x6e/0xb0
 [<ffffffff815942e3>] rtnl_link_unregister+0x23/0x30
 [<ffffffffa14ce96b>] bonding_exit+0x2d/0x6c2 [bonding]
 [<ffffffff810c5bc5>] sys_delete_module+0x165/0x2f0
 [<ffffffff810b6ac5>] ? trace_hardirqs_on_caller+0x115/0x1a0
 [<ffffffff8134b18e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
 [<ffffffff816cdcc2>] system_call_fastpath+0x16/0x1b
---[ end trace ffa4539b4be32cfa ]---

^ 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