Netdev List
 help / color / mirror / Atom feed
* [PATCH 2/6] Convert balance-rr transmit to new locking
From: Jay Vosburgh @ 2007-10-11  4:14 UTC (permalink / raw)
  To: netdev, jgarzik; +Cc: andy, Jay Vosburgh
In-Reply-To: <11920760502756-git-send-email-fubar@us.ibm.com>

	Change locking in balance-rr transmit processing to use a free
running counter to determine which slave to transmit on.  Instead, a
free-running counter is maintained, and modulo arithmetic used to select
a slave for transmit.

	This removes lock operations from the TX path, and eliminates
a deadlock introduced by the conversion to work queues.

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
 drivers/net/bonding/bond_main.c |   25 ++++++++++++-------------
 drivers/net/bonding/bonding.h   |    1 +
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 28ae961..4541a1b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3928,8 +3928,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
 {
 	struct bonding *bond = bond_dev->priv;
 	struct slave *slave, *start_at;
-	int i;
-	int res = 1;
+	int i, slave_no, res = 1;
 
 	read_lock(&bond->lock);
 
@@ -3937,29 +3936,29 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
 		goto out;
 	}
 
-	read_lock(&bond->curr_slave_lock);
-	slave = start_at = bond->curr_active_slave;
-	read_unlock(&bond->curr_slave_lock);
+	/*
+	 * Concurrent TX may collide on rr_tx_counter; we accept that
+	 * as being rare enough not to justify using an atomic op here
+	 */
+	slave_no = bond->rr_tx_counter++ % bond->slave_cnt;
 
-	if (!slave) {
-		goto out;
+	bond_for_each_slave(bond, slave, i) {
+		slave_no--;
+		if (slave_no < 0) {
+			break;
+		}
 	}
 
+	start_at = slave;
 	bond_for_each_slave_from(bond, slave, i, start_at) {
 		if (IS_UP(slave->dev) &&
 		    (slave->link == BOND_LINK_UP) &&
 		    (slave->state == BOND_STATE_ACTIVE)) {
 			res = bond_dev_queue_xmit(bond, skb, slave->dev);
-
-			write_lock(&bond->curr_slave_lock);
-			bond->curr_active_slave = slave->next;
-			write_unlock(&bond->curr_slave_lock);
-
 			break;
 		}
 	}
 
-
 out:
 	if (res) {
 		/* no suitable interface, frame not sent */
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 4986d0f..e7c3671 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -183,6 +183,7 @@ struct bonding {
 	rwlock_t lock;
 	rwlock_t curr_slave_lock;
 	s8       kill_timers;
+	u16      rr_tx_counter;
 	struct   net_device_stats stats;
 #ifdef CONFIG_PROC_FS
 	struct   proc_dir_entry *proc_entry;
-- 
1.5.3.1


^ permalink raw reply related

* [PATCH 0/6] bonding workqueue and lock rework
From: Jay Vosburgh @ 2007-10-11  4:14 UTC (permalink / raw)
  To: netdev, jgarzik; +Cc: andy

	Following are patches to update the locking used in the bonding
driver.  This involves two basic changes: conversion from timers to
workqueues for the various periodic monitor functions, and conversion of
locking.  These patches should resolve the majority of locking and
might sleep related warnings that occur during certain operations.

	The workqueue conversion is fairly straightforward, and
substitutes workqueue driven events for the existing timer driven events.

	The locking changes are of two types: first, changes to resolve
deadlocks created by the conversion to workqueues, and second, changes to
make the locking more correct, which generally involves holding RTNL and
no other locks during specific operations.  Some of the RTNL-related
changes are fairly extensive, and involve either conditional locking or
releasing and reacquiring locks in order to obey lock ordering
constraints.

	These changes were developed and extensively tested by Andy
Gospodarek <andy@greyhouse.net> and myself over the last few months.

	Patches are relative to netdev-2.6#upstream.

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com


^ permalink raw reply

* Re: [PATCH 3/5] cleanup 3rd argument in netlink_sendskb
From: David Miller @ 2007-10-11  4:14 UTC (permalink / raw)
  To: den; +Cc: netdev, kuznet, devel, containers
In-Reply-To: <20071005144623.GA7085@iris.sw.ru>

From: "Denis V. Lunev" <den@openvz.org>
Date: Fri, 5 Oct 2007 18:46:23 +0400

> netlink_sendskb does not use third argument. Clean it and save a couple of
> bytes.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>

Applied.

^ permalink raw reply

* Re: [PATCH 2/5] make netlink processing routines semi-synchronious (inspired by rtnl) v2
From: David Miller @ 2007-10-11  4:13 UTC (permalink / raw)
  To: den; +Cc: netdev, kuznet
In-Reply-To: <20071005144510.GA7061@iris.sw.ru>

From: "Denis V. Lunev" <den@openvz.org>
Date: Fri, 5 Oct 2007 18:45:10 +0400

> The code in netfilter/nfnetlink.c and in ./net/netlink/genetlink.c looks
> like outdated copy/paste from rtnetlink.c. Push them into sync with the
> original.
> 
> Changes from v1:
> - deleted comment in nfnetlink_rcv_msg by request of Patrick McHardy
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Acked-by: Patrick McHardy <kaber@trash.net>

Applied.

^ permalink raw reply

* Re: [PATCH 1/5] rtnl_unlock cleanups
From: David Miller @ 2007-10-11  4:13 UTC (permalink / raw)
  To: den; +Cc: devel, containers, kuznet, netdev
In-Reply-To: <20071005144414.GA7050@iris.sw.ru>

From: "Denis V. Lunev" <den@openvz.org>
Date: Fri, 5 Oct 2007 18:44:14 +0400

> There is no need to process outstanding netlink user->kernel packets
> during rtnl_unlock now. There is no rtnl_trylock in the rtnetlink_rcv
> anymore.
> 
> Normal code path is the following:
> netlink_sendmsg
>    netlink_unicast
>        netlink_sendskb
>            skb_queue_tail
>            netlink_data_ready
>                rtnetlink_rcv
>                    mutex_lock(&rtnl_mutex);
>                    netlink_run_queue(sk, qlen, &rtnetlink_rcv_msg);
>                    mutex_unlock(&rtnl_mutex);
> 
> So, it is possible, that packets can be present in the rtnl->sk_receive_queue
> during rtnl_unlock, but there is no need to process them at that moment as
> rtnetlink_rcv for that packet is pending.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>

Applied.

^ permalink raw reply

* Re: [PATCH] Fix typos in comments in netlink.h
From: David Miller @ 2007-10-11  4:10 UTC (permalink / raw)
  To: linkfanel; +Cc: netdev
In-Reply-To: <20071005060940.GA18427@via.ecp.fr>

From: Pierre Ynard <linkfanel@yahoo.fr>
Date: Fri, 5 Oct 2007 08:09:40 +0200

> This patch fixes a few typos in comments in include/net/netlink.h
> 
> Signed-off-by: Pierre Ynard <linkfanel@yahoo.fr>

Applied, thanks.

^ permalink raw reply

* Re: authenc compile warnings in current net-2.6.24
From: Herbert Xu @ 2007-10-11  3:26 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, socketcan, netdev, Linux Crypto Mailing List
In-Reply-To: <20071011032330.GA14165@gondor.apana.org.au>

On Thu, Oct 11, 2007 at 11:23:30AM +0800, Herbert Xu wrote:
>
> Yeah I've added a fix in the cryptodev tree.

Oh and here's the actual patch.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
1cd6038ce42447f9a32e6d138af0b69ad56ea627
diff --git a/crypto/authenc.c b/crypto/authenc.c
index 0b29a6a..126a529 100644
--- a/crypto/authenc.c
+++ b/crypto/authenc.c
@@ -84,8 +84,8 @@ static int crypto_authenc_hash(struct aead_request *req)
 		.tfm = auth,
 	};
 	u8 *hash = aead_request_ctx(req);
-	struct scatterlist *dst;
-	unsigned int cryptlen;
+	struct scatterlist *dst = req->dst;
+	unsigned int cryptlen = req->cryptlen;
 	int err;
 
 	hash = (u8 *)ALIGN((unsigned long)hash + crypto_hash_alignmask(auth), 
@@ -100,8 +100,6 @@ static int crypto_authenc_hash(struct aead_request *req)
 	if (err)
 		goto auth_unlock;
 
-	cryptlen = req->cryptlen;
-	dst = req->dst;
 	err = crypto_hash_update(&desc, dst, cryptlen);
 	if (err)
 		goto auth_unlock;
@@ -159,8 +157,8 @@ static int crypto_authenc_verify(struct aead_request *req)
 	};
 	u8 *ohash = aead_request_ctx(req);
 	u8 *ihash;
-	struct scatterlist *src;
-	unsigned int cryptlen;
+	struct scatterlist *src = req->src;
+	unsigned int cryptlen = req->cryptlen;
 	unsigned int authsize;
 	int err;
 
@@ -177,8 +175,6 @@ static int crypto_authenc_verify(struct aead_request *req)
 	if (err)
 		goto auth_unlock;
 
-	cryptlen = req->cryptlen;
-	src = req->src;
 	err = crypto_hash_update(&desc, src, cryptlen);
 	if (err)
 		goto auth_unlock;

^ permalink raw reply related

* Re: authenc compile warnings in current net-2.6.24
From: Herbert Xu @ 2007-10-11  3:23 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, socketcan, netdev
In-Reply-To: <20071010.162528.91758998.davem@davemloft.net>

On Wed, Oct 10, 2007 at 04:25:28PM -0700, David Miller wrote:
>
> It's just not smart enough to see that cryptlen's initialization
> and it's use in the auth_unlock label path are both protected
> by 'err' being non-zero.
> 
> To be honest I don't know of any compiler which commits enough
> flow variable analysis to support doing %100 accurate warnings
> in situations like this.
> 
> Since the compiler is unlikely to do so, I think we should fix
> it somehow because useless warnings just distract.

Yeah I've added a fix in the cryptodev tree.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <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

* Re: PROBLEM: skb_clone SMP race?
From: Herbert Xu @ 2007-10-11  2:06 UTC (permalink / raw)
  To: Santiago Font Arquer; +Cc: netdev
In-Reply-To: <dfad5c650710100200s1369fd96x50ffc5fbffb2e6d9@mail.gmail.com>

Santiago Font Arquer <sfa.linux@gmail.com> wrote:
>
>   If an skb with fast clone available (first "if" true) has
> references in different CPUs (skb->users>1) (I do not find explicit
> checks for this to be impossible), if skb_clone is called
> simultaneously over that skb, both callers can get the same clone (the
> "fast" clone) and different problems follow: wrong "clone_skb->users"
> (1 as expected by the caller, but it should be, to be true, 2),
> fclone_ref set to 3 involving further problems, ...

Fast clones are only used by TCP where the original skb is
never given to the outside world.  This plus the fact that
a given TCP socket is single-threaded makes it safe.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <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

* Re: [PATCH][BNX2X] round three - sparse warnings.
From: Stephen Hemminger @ 2007-10-11  1:54 UTC (permalink / raw)
  To: Eliezer Tamir
  Cc: davem@davemloft.net, netdev@vger.kernel.org, jeff@garzik.org,
	Michael Chan
In-Reply-To: <470D2D7E.8080507@broadcom.com>

Please fix these...

  CHECK   drivers/net/bnx2x.c
drivers/net/bnx2x_asm.h:62:2: warning: cast removes address space of expression
drivers/net/bnx2x_asm.h:62:2: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_asm.h:62:2:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_asm.h:62:2:    got unsigned char [usertype] *
drivers/net/bnx2x_asm.h:988:2: warning: cast removes address space of expression
drivers/net/bnx2x_asm.h:988:2: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_asm.h:988:2:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_asm.h:988:2:    got unsigned char [usertype] *
drivers/net/bnx2x_asm.h:2300:2: warning: cast removes address space of expression
drivers/net/bnx2x_asm.h:2300:2: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_asm.h:2300:2:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_asm.h:2300:2:    got unsigned char [usertype] *
drivers/net/bnx2x_asm.h:3087:2: warning: cast removes address space of expression
drivers/net/bnx2x_asm.h:3087:2: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_asm.h:3087:2:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_asm.h:3087:2:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:13:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:13:1: warning: incorrect type in argument 1 (different address spaces)
drivers/net/bnx2x_init_values.h:13:1:    expected void const volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:13:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:14:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:14:1: warning: incorrect type in argument 1 (different address spaces)
drivers/net/bnx2x_init_values.h:14:1:    expected void const volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:14:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:15:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:15:1: warning: incorrect type in argument 1 (different address spaces)
drivers/net/bnx2x_init_values.h:15:1:    expected void const volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:15:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:16:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:16:1: warning: incorrect type in argument 1 (different address spaces)
drivers/net/bnx2x_init_values.h:16:1:    expected void const volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:16:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:17:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:17:1: warning: incorrect type in argument 1 (different address spaces)
drivers/net/bnx2x_init_values.h:17:1:    expected void const volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:17:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:18:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:18:1: warning: incorrect type in argument 1 (different address spaces)
drivers/net/bnx2x_init_values.h:18:1:    expected void const volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:18:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:19:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:19:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:19:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:19:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:20:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:20:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:20:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:20:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:21:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:21:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:21:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:21:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:22:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:22:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:22:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:22:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:23:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:23:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:23:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:23:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:24:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:24:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:24:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:24:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:25:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:25:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:25:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:25:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:26:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:26:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:26:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:26:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:27:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:27:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:27:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:27:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:28:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:28:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:28:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:28:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:29:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:29:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:29:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:29:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:30:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:30:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:30:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:30:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:31:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:31:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:31:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:31:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:32:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:32:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:32:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:32:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:33:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:33:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:33:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:33:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:34:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:34:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:34:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:34:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:35:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:35:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:35:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:35:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:36:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:36:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:36:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:36:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:37:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:37:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:37:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:37:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:38:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:38:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:38:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:38:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:39:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:39:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:39:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:39:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:40:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:40:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:40:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:40:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:41:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:41:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:41:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:41:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:42:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:42:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:42:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:42:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:43:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:43:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:43:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:43:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:44:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:44:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:44:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:44:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:45:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:45:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:45:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:45:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:46:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:46:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:46:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:46:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:47:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:47:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:47:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:47:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:48:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:48:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:48:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:48:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:49:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:49:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:49:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:49:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:50:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:50:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:50:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:50:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:58:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:58:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:58:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:58:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:66:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:66:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:66:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:66:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:74:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:74:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:74:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:74:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:82:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:82:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:82:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:82:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:90:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:90:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:90:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:90:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:98:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:98:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:98:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:98:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:106:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:106:1: warning: incorrect type in argument 2 (different address spaces)
drivers/net/bnx2x_init_values.h:106:1:    expected void volatile [noderef] <asn:2>*addr
drivers/net/bnx2x_init_values.h:106:1:    got unsigned char [usertype] *
drivers/net/bnx2x_init_values.h:141:1: warning: cast removes address space of expression
drivers/net/bnx2x_init_values.h:141:1: warning: too many warnings

^ permalink raw reply

* Re: [RFC PATCH] [TCP]: Fix lost_retrans loop vs fastpath problems
From: TAKANO Ryousei @ 2007-10-11  1:55 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: netdev, davem, shemminger
In-Reply-To: <119193240269-git-send-email-ilpo.jarvinen@helsinki.fi>

From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Subject: [RFC PATCH] [TCP]: Fix lost_retrans loop vs fastpath problems
Date: Tue,  9 Oct 2007 15:20:01 +0300

> Detection implemented with lost_retrans must work also when
> fastpath is taken, yet most of the queue is skipped including
> (very likely) those retransmitted skb's we're interested in.
> This problem appeared when the hints got added, which removed
> a need to always walk over the whole write queue head.
> Therefore decicion for the lost_retrans worker loop entry must
> be separated from the sacktag processing more than it was
> necessary before.
> 
> It turns out to be problematic to optimize the worker loop
> very heavily because ack_seqs of skb may have a number of
> discontinuity points. Maybe similar approach as currently is
> implemented could be attempted but that's becoming more and
> more complex because the trend is towards less skb walking
> in sacktag marker.
> 
> Maybe after(highest_sack_end_seq, tp->high_seq) checking is not
> sufficiently accurate and causes entry too often in no-work-to-do
> cases. Since that's not known, I've separated solution to that
> from this patch.
> 
> Noticed because of report against a related problem from TAKANO
> Ryousei <takano@axe-inc.co.jp>. He also provided a patch to
> that part of the problem. This patch includes solution to it
> (though this patch has to use somewhat different placement).
> TAKANO's description and patch is available here:
> 
>   http://marc.info/?l=linux-netdev&m=119149311913288&w=2
> 
> ...In short, TAKANO's problem is that end_seq the loop is using
> not necessarily the largest SACK block's end_seq because the
> current ACK may still have higher SACK blocks which are later
> by the loop.
> 
Thanks Ilpo!  I am trying to evaluate this patch. But, I got 
a kernel panic at net_rx_action() in our experimental setting.
I am using the net-2.6.24 kernel _without_ this patch. 
(I will post a bug report separately).
Anyway, I will report the result as soon as possible.

Ryousei Takano

^ permalink raw reply

* RE: [PATCH net-2.6.24] s2io: sparse warnings fix (rev2)
From: Ramkrishna Vepa @ 2007-10-11  1:27 UTC (permalink / raw)
  To: Stephen Hemminger, Jeff Garzik
  Cc: David S. Miller, Ramkrishna Vepa, Rastapur Santosh,
	Sivakumar Subramani, Sreenivasa Honnur, netdev
In-Reply-To: <20071005123921.137a9e4e@freepuppy.rosehill>

Stephen,

> Fix warnings from sparse checker about shadowed definition and
improperly
> formatted ethtool_strings.
> 
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
> 
> ---
>   CHECK   drivers/net/s2io.c
> - * lro: Specifies whether to enable Large Receive Offload (LRO) or
not.
> + * lro_enable: Specifies whether to enable Large Receive Offload
(LRO) or
> not.
This change is not required since the name is not changed. Rest looks
fine.

Ram

^ permalink raw reply

* Re: [PATCH][BNX2X] round three
From: Stephen Hemminger @ 2007-10-11  1:28 UTC (permalink / raw)
  To: Eliezer Tamir
  Cc: davem@davemloft.net, netdev@vger.kernel.org, jeff@garzik.org,
	Michael Chan
In-Reply-To: <470D2D7E.8080507@broadcom.com>

Minor formatting nits reported by checkpatch.pl script:

WARNING: braces {} are not necessary for single statement blocks
#506: FILE: drivers/net/bnx2x.c:451:
+	if (REG_RD(bp, GRCBASE_HC, addr) != val) {
+		BNX2X_ERR("BUG! proper val not read from IGU!\n");
+	}

WARNING: braces {} are not necessary for single statement blocks
#709: FILE: drivers/net/bnx2x.c:654:
+	if (unlikely(bp->panic)) {
+		return;
+	}

WARNING: braces {} are not necessary for single statement blocks
#736: FILE: drivers/net/bnx2x.c:681:
+		if (done == work) {
+			break;
+		}

WARNING: braces {} are not necessary for single statement blocks
#754: FILE: drivers/net/bnx2x.c:699:
+		if ((netif_queue_stopped(bp->dev)) &&
+		    (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3)) {
+			netif_wake_queue(bp->dev);
+		}

WARNING: no space between function name and open parenthesis '('
#777: FILE: drivers/net/bnx2x.c:722:
+	case (RAMROD_CMD_ID_ETH_PORT_SETUP | BNX2X_STATE_OPENING_WAIT4_PORT):

WARNING: no space between function name and open parenthesis '('
#782: FILE: drivers/net/bnx2x.c:727:
+	case (RAMROD_CMD_ID_ETH_HALT | BNX2X_STATE_CLOSING_WAIT4_HALT):

WARNING: no space between function name and open parenthesis '('
#788: FILE: drivers/net/bnx2x.c:733:
+	case (RAMROD_CMD_ID_ETH_PORT_DEL | BNX2X_STATE_CLOSING_WAIT4_DELETE):

WARNING: no space between function name and open parenthesis '('
#793: FILE: drivers/net/bnx2x.c:738:
+	case (RAMROD_CMD_ID_ETH_SET_MAC | BNX2X_STATE_OPEN):

WARNING: braces {} are not necessary for single statement blocks
#812: FILE: drivers/net/bnx2x.c:757:
+	if (unlikely(skb == NULL)) {
+		return -ENOMEM;
+	}

WARNING: braces {} are not necessary for single statement blocks
#873: FILE: drivers/net/bnx2x.c:818:
+	if (unlikely(bp->panic)) {
+		return 0;
+	}

WARNING: braces {} are not necessary for single statement blocks
#879: FILE: drivers/net/bnx2x.c:824:
+	if ((hw_comp_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) {
+		hw_comp_cons++;
+	}

WARNING: braces {} are not necessary for single statement blocks
#1018: FILE: drivers/net/bnx2x.c:963:
+		if ((cqe->fast_path_cqe.pars_flags.flags
+		     & PARSING_FLAGS_NUMBER_OF_NESTED_VLANS)
+		    && (bp->vlgrp != 0)) {
+			vlan_hwaccel_receive_skb(skb, bp->vlgrp,
+						 cqe->fast_path_cqe.vlan_tag);
+		} else

WARNING: braces {} are not necessary for single statement blocks
#1069: FILE: drivers/net/bnx2x.c:1014:
+	if (unlikely(bp->panic)) {
+		return IRQ_HANDLED;
+	}

WARNING: braces {} are not necessary for single statement blocks
#1096: FILE: drivers/net/bnx2x.c:1041:
+	if (unlikely(bp->panic)) {
+		return IRQ_HANDLED;
+	}

WARNING: braces {} are not necessary for single statement blocks
#1118: FILE: drivers/net/bnx2x.c:1063:
+		if (!status) {
+			return IRQ_HANDLED;
+		}

WARNING: braces {} are not necessary for single statement blocks
#1127: FILE: drivers/net/bnx2x.c:1072:
+		if (!status) {
+			return IRQ_HANDLED;
+		}

WARNING: braces {} are not necessary for single statement blocks
#1489: FILE: drivers/net/bnx2x.c:1434:
+		if (rd_val == val) {
+			return 0;
+		}

WARNING: braces {} are not necessary for single statement blocks
#1549: FILE: drivers/net/bnx2x.c:1494:
+		if (bp->req_flow_ctrl == FLOW_CTRL_AUTO) {
+			bp->flow_ctrl = FLOW_CTRL_BOTH;
+		}

WARNING: braces {} are not necessary for single statement blocks
#1661: FILE: drivers/net/bnx2x.c:1606:
+			if (gp_status & MDIO_AN_CL73_OR_37_COMPLETE) {
+				bp->link_status |=
+					LINK_STATUS_AUTO_NEGOTIATE_COMPLETE;
+			}

WARNING: braces {} are not necessary for single statement blocks
#1665: FILE: drivers/net/bnx2x.c:1610:
+			if (bp->autoneg & AUTONEG_PARALLEL) {
+				bp->link_status |=
+					LINK_STATUS_PARALLEL_DETECTION_USED;
+			}

WARNING: braces {} are not necessary for single statement blocks
#1671: FILE: drivers/net/bnx2x.c:1616:
+		if (bp->flow_ctrl & FLOW_CTRL_TX) {
+		       bp->link_status |= LINK_STATUS_TX_FLOW_CONTROL_ENABLED;
+		}

WARNING: braces {} are not necessary for single statement blocks
#1674: FILE: drivers/net/bnx2x.c:1619:
+		if (bp->flow_ctrl & FLOW_CTRL_RX) {
+		       bp->link_status |= LINK_STATUS_RX_FLOW_CONTROL_ENABLED;
+		}

WARNING: braces {} are not necessary for single statement blocks
#1871: FILE: drivers/net/bnx2x.c:1816:
+	if (bp->flow_ctrl & FLOW_CTRL_TX) {
+		val |= 0x800000;
+	}

WARNING: braces {} are not necessary for single statement blocks
#1898: FILE: drivers/net/bnx2x.c:1843:
+	if (bp->flow_ctrl & FLOW_CTRL_RX) {
+		val |= 0x20;
+	}

WARNING: braces {} are not necessary for single statement blocks
#1953: FILE: drivers/net/bnx2x.c:1898:
+	if (bp->flow_ctrl & FLOW_CTRL_TX) {
+		val = 1;
+	}

WARNING: braces {} are not necessary for single statement blocks
#2053: FILE: drivers/net/bnx2x.c:1998:
+		if (bp->flow_ctrl & FLOW_CTRL_RX) {
+			bnx2x_bits_en(bp, emac_base, EMAC_REG_EMAC_RX_MODE,
+				      EMAC_RX_MODE_FLOW_EN);
+		}

WARNING: braces {} are not necessary for single statement blocks
#2060: FILE: drivers/net/bnx2x.c:2005:
+		if (bp->flow_ctrl & FLOW_CTRL_TX) {
+			bnx2x_bits_en(bp, emac_base, EMAC_REG_EMAC_TX_MODE,
+				      EMAC_TX_MODE_EXT_PAUSE_EN);
+		}

WARNING: braces {} are not necessary for single statement blocks
#2100: FILE: drivers/net/bnx2x.c:2045:
+	if (bp->flow_ctrl & FLOW_CTRL_TX) {
+		val = 1;
+	}

WARNING: braces {} are not necessary for single statement blocks
#2153: FILE: drivers/net/bnx2x.c:2098:
+	if (bp->duplex == DUPLEX_HALF) {
+		mode |= EMAC_MODE_HALF_DUPLEX;
+	}

WARNING: braces {} are not necessary for single statement blocks
#2218: FILE: drivers/net/bnx2x.c:2163:
+	if (bp->flow_ctrl & FLOW_CTRL_RX) {
+		pause = 1;
+	}

WARNING: braces {} are not necessary for single statement blocks
#2273: FILE: drivers/net/bnx2x.c:2218:
+	if (!nomcp) {
+		SHMEM_WR(bp, drv_fw_mb[bp->port].link_status,
+			 bp->link_status);
+	}

ERROR: no space before that close parenthesis ')'
#2380: FILE: drivers/net/bnx2x.c:2325:
+	);

WARNING: braces {} are not necessary for single statement blocks
#2410: FILE: drivers/net/bnx2x.c:2355:
+				if (!(bp->phy_flags & PHY_SGMII_FLAG)) {
+					bnx2x_set_sgmii_tx_driver(bp);
+				}/* Not SGMII */

WARNING: braces {} are not necessary for single statement blocks
#2645: FILE: drivers/net/bnx2x.c:2590:
+	if (bp->req_duplex == DUPLEX_FULL) {
+		reg_val |= MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX;
+	}

WARNING: braces {} are not necessary for single statement blocks
#2659: FILE: drivers/net/bnx2x.c:2604:
+		if (bp->req_line_speed == SPEED_10000) {
+			reg_val |=
+				MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_10G_CX4;
+		}

WARNING: braces {} are not necessary for single statement blocks
#2675: FILE: drivers/net/bnx2x.c:2620:
+	if (bp->advertising & ADVERTISED_2500baseT_Full) {
+		val |= MDIO_OVER_1G_UP1_2_5G;
+	}

WARNING: braces {} are not necessary for single statement blocks
#2678: FILE: drivers/net/bnx2x.c:2623:
+	if (bp->advertising & ADVERTISED_10000baseT_Full) {
+		val |= MDIO_OVER_1G_UP1_10G;
+	}

WARNING: braces {} are not necessary for single statement blocks
#2789: FILE: drivers/net/bnx2x.c:2734:
+		if (bp->req_duplex == DUPLEX_FULL) {
+			mii_control |=
+				MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX;
+		}

WARNING: braces {} are not necessary for single statement blocks
#2991: FILE: drivers/net/bnx2x.c:2936:
+	if (bp->phy_flags & PHY_XGXS_FLAG) {
+		bnx2x_set_master_ln(bp);
+	}

WARNING: braces {} are not necessary for single statement blocks
#3007: FILE: drivers/net/bnx2x.c:2952:
+	if (bp->req_autoneg & AUTONEG_SPEED) {
+		bnx2x_set_parallel_detection(bp);
+	}

WARNING: no space between function name and open parenthesis '('
#3159: FILE: drivers/net/bnx2x.c:3104:
+static void bnx2x_set_xgxs_loopback (struct bnx2x *bp, int is_10g)

WARNING: braces {} are not necessary for single statement blocks
#3226: FILE: drivers/net/bnx2x.c:3171:
+	if (unlikely(bp->panic)) {
+		return -EIO;
+	}

ERROR: no space after that open parenthesis '('
#3273: FILE: drivers/net/bnx2x.c:3218:
+static int bnx2x_lock_alr( struct bnx2x *bp)

WARNING: braces {} are not necessary for single statement blocks
#3284: FILE: drivers/net/bnx2x.c:3229:
+		if (val & (1L << 31)) {
+			break;
+		}

ERROR: trailing whitespace
#3314: FILE: drivers/net/bnx2x.c:3259:
+^I$

WARNING: braces {} are not necessary for single statement blocks
#3381: FILE: drivers/net/bnx2x.c:3326:
+		if (asserted & ATTN_SW_TIMER_4_FUNC0) {
+			DP(NETIF_MSG_HW, "ATTN_SW_TIMER_4_FUNC!\n");
+		}

WARNING: braces {} are not necessary for single statement blocks
#3384: FILE: drivers/net/bnx2x.c:3329:
+		if (asserted & GPIO_2_FUNC0) {
+			DP(NETIF_MSG_HW, "GPIO_2_FUNC!\n");
+		}

WARNING: braces {} are not necessary for single statement blocks
#3387: FILE: drivers/net/bnx2x.c:3332:
+		if (asserted & GPIO_3_FUNC0) {
+			DP(NETIF_MSG_HW, "GPIO_3_FUNC!\n");
+		}

WARNING: braces {} are not necessary for single statement blocks
#3390: FILE: drivers/net/bnx2x.c:3335:
+		if (asserted & GPIO_4_FUNC0) {
+			DP(NETIF_MSG_HW, "GPIO_4_FUNC!\n");
+		}

WARNING: braces {} are not necessary for single statement blocks
#3399: FILE: drivers/net/bnx2x.c:3344:
+		if (asserted & ATTN_GENERAL_ATTN_2) {
+			DP(NETIF_MSG_HW, "ATTN_GENERAL_ATTN_2!\n");
+		}

WARNING: braces {} are not necessary for single statement blocks
#3402: FILE: drivers/net/bnx2x.c:3347:
+		if (asserted & ATTN_GENERAL_ATTN_3) {
+			DP(NETIF_MSG_HW, "ATTN_GENERAL_ATTN_3!\n");
+		}

WARNING: braces {} are not necessary for single statement blocks
#3412: FILE: drivers/net/bnx2x.c:3357:
+	if (asserted & (ATTN_NIG_FOR_FUNC0 | ATTN_NIG_FOR_FUNC1)) {
+		REG_WR(bp, GRCBASE_NIG, nig_mask_addr, bp->nig_mask);
+	}

WARNING: braces {} are not necessary for single statement blocks
#3482: FILE: drivers/net/bnx2x.c:3427:
+				if (val & 0x2) {
+					BNX2X_ERR("FATAL error from DORQ\n");
+				}

WARNING: braces {} are not necessary for single statement blocks
#3494: FILE: drivers/net/bnx2x.c:3439:
+				if (val & 0x18000) {
+					BNX2X_ERR("FATAL error from PXP\n");
+				}

WARNING: braces {} are not necessary for single statement blocks
#3554: FILE: drivers/net/bnx2x.c:3499:
+	if (~(attn_bits ^ attn_ack) & (attn_bits ^ attn_state)) {
+		BNX2X_ERR("bad attention state\n");
+	}

WARNING: braces {} are not necessary for single statement blocks
#3559: FILE: drivers/net/bnx2x.c:3504:
+	if (asserted) {
+		bnx2x_attn_int_asserted(bp, asserted);
+	}

WARNING: braces {} are not necessary for single statement blocks
#3563: FILE: drivers/net/bnx2x.c:3508:
+	if (deasserted) {
+		bnx2x_attn_int_deasserted(bp, deasserted);
+	}

WARNING: braces {} are not necessary for single statement blocks
#3580: FILE: drivers/net/bnx2x.c:3525:
+	if (status == 0) {
+		BNX2X_ERR("spurious slowpath interrupt!\n");
+	}

WARNING: braces {} are not necessary for single statement blocks
#3592: FILE: drivers/net/bnx2x.c:3537:
+	if (status & 0x2) {
+		bp->stat_pending = 0;
+	}

WARNING: braces {} are not necessary for single statement blocks
#3623: FILE: drivers/net/bnx2x.c:3568:
+	if (unlikely(bp->panic)) {
+		return IRQ_HANDLED;
+	}

WARNING: braces {} are not necessary for single statement blocks
#3926: FILE: drivers/net/bnx2x.c:3871:
+		while (bp->stats_state != STATS_STATE_DISABLE) {
+			msleep(100);
+		}

WARNING: braces {} are not necessary for single statement blocks
#4234: FILE: drivers/net/bnx2x.c:4179:
+	if (bp->msglevel & NETIF_MSG_TIMER) {
+		printk(KERN_DEBUG "%s:\n"
+		       KERN_DEBUG "  tx avail (%4x)  tx hc idx (%x)"
+				  "  tx pkt (%lx)\n"
+		       KERN_DEBUG "  rx usage (%4x)  rx hc idx (%x)"
+				  "  rx pkt (%lx)\n"
+		       KERN_DEBUG "  %s (Xoff events %u)  brb drops %u\n"
+		       KERN_DEBUG "  tstats: no_buff_discard %u"
+				  "  errors_discard %u  mac_filter_discard %u"
+				  "  xxovrflow_discard %u  ttl0_discard %u\n",
+		       bp->dev->name, bnx2x_tx_avail(bp->fp),
+		       *bp->fp->tx_cons_sb, bp->dev->stats.tx_packets,
+		       (u16)(*bp->fp->rx_cons_sb - bp->fp->rx_comp_cons),
+		       *bp->fp->rx_cons_sb, bp->dev->stats.rx_packets,
+		       netif_queue_stopped(bp->dev)? "Xoff" : "Xon",
+		       bp->slowpath->eth_stats.driver_xoff,
+		       bp->slowpath->eth_stats.brb_discard,
+		       bp->slowpath->eth_stats.no_buff_discard,
+		       bp->slowpath->eth_stats.errors_discard,
+		       bp->slowpath->eth_stats.mac_filter_discard,
+		       bp->slowpath->eth_stats.xxoverflow_discard,
+		       bp->slowpath->eth_stats.ttl0_discard);
+	}

WARNING: braces {} are not necessary for single statement blocks
#4264: FILE: drivers/net/bnx2x.c:4209:
+	if (unlikely(bp->panic)) {
+		return;
+	}

WARNING: braces {} are not necessary for single statement blocks
#4269: FILE: drivers/net/bnx2x.c:4214:
+	if (bp->fw_mb) {
+		REG_WR32(bp, GRCBASE_DMAE,
+			 (bp->port ? DMAE_REGISTERS_GO_C13 :
+				     DMAE_REGISTERS_GO_C12), 1);
+	}

WARNING: braces {} are not necessary for single statement blocks
#4332: FILE: drivers/net/bnx2x.c:4277:
+		if ((drv_pulse != mcp_pulse) &&
+		    (drv_pulse != ((mcp_pulse + 1) & MCP_PULSE_SEQ_MASK))) {
+			BNX2X_ERR("drv_pulse (0x%x) != mcp_pulse (0x%x)\n",
+				  drv_pulse, mcp_pulse);
+		}

WARNING: braces {} are not necessary for single statement blocks
#4374: FILE: drivers/net/bnx2x.c:4319:
+	for (index = 0; index < HC_USTORM_SB_NUM_INDICES; index++) {
+		REG_WR16(bp, BAR_USTRORM_INTMEM,
+			 USTORM_SB_HC_DISABLE_OFFSET(port, id, index), 0x1);
+	}

WARNING: braces {} are not necessary for single statement blocks
#4390: FILE: drivers/net/bnx2x.c:4335:
+	for (index = 0; index < HC_CSTORM_SB_NUM_INDICES; index++) {
+		REG_WR16(bp, BAR_CSTRORM_INTMEM,
+			 CSTORM_SB_HC_DISABLE_OFFSET(port, id, index), 0x1);
+	}

WARNING: braces {} are not necessary for single statement blocks
#4458: FILE: drivers/net/bnx2x.c:4403:
+	for (index = 0; index < HC_USTORM_DEF_SB_NUM_INDICES; index++) {
+		REG_WR16(bp, BAR_USTRORM_INTMEM,
+			 USTORM_DEF_SB_HC_DISABLE_OFFSET(port, index), 0x1);
+	}

WARNING: braces {} are not necessary for single statement blocks
#4476: FILE: drivers/net/bnx2x.c:4421:
+	for (index = 0; index < HC_CSTORM_DEF_SB_NUM_INDICES; index++) {
+		REG_WR16(bp, BAR_CSTRORM_INTMEM,
+			 CSTORM_DEF_SB_HC_DISABLE_OFFSET(port, index), 0x1);
+	}

WARNING: braces {} are not necessary for single statement blocks
#4494: FILE: drivers/net/bnx2x.c:4439:
+	for (index = 0; index < HC_TSTORM_DEF_SB_NUM_INDICES; index++) {
+		REG_WR16(bp, BAR_TSTRORM_INTMEM,
+			 TSTORM_DEF_SB_HC_DISABLE_OFFSET(port, index), 0x1);
+	}

WARNING: braces {} are not necessary for single statement blocks
#4512: FILE: drivers/net/bnx2x.c:4457:
+	for (index = 0; index < HC_XSTORM_DEF_SB_NUM_INDICES; index++) {
+		REG_WR16(bp, BAR_XSTRORM_INTMEM,
+			 XSTORM_DEF_SB_HC_DISABLE_OFFSET(port, index), 0x1);
+	}

WARNING: multiple assignments should be avoided
#4566: FILE: drivers/net/bnx2x.c:4511:
+		fp->last_alloc = fp->next_free = 0;

WARNING: multiple assignments should be avoided
#4594: FILE: drivers/net/bnx2x.c:4539:
+		fp->rx_comp_cons = ring_prod = 0;

WARNING: multiple assignments should be avoided
#4606: FILE: drivers/net/bnx2x.c:4551:
+		fp->rx_bd_prod = fp->rx_comp_prod = ring_prod;

WARNING: multiple assignments should be avoided
#4607: FILE: drivers/net/bnx2x.c:4552:
+		fp->rx_pkt = fp->rx_calls = 0;

WARNING: braces {} are not necessary for single statement blocks
#5072: FILE: drivers/net/bnx2x.c:5017:
+		if (val == 0x10) {
+			break;
+		}

WARNING: braces {} are not necessary for single statement blocks
#5088: FILE: drivers/net/bnx2x.c:5033:
+		if (val == 0x1) {
+			break;
+		}

WARNING: braces {} are not necessary for single statement blocks
#5119: FILE: drivers/net/bnx2x.c:5064:
+	for (i = 0; i < 10; i++) {
+		bnx2x_lb_pckt(bp);
+	}

WARNING: braces {} are not necessary for single statement blocks
#5135: FILE: drivers/net/bnx2x.c:5080:
+		if (val == 0xb0) {
+			break;
+		}

WARNING: braces {} are not necessary for single statement blocks
#5149: FILE: drivers/net/bnx2x.c:5094:
+	if (val != 0x2) {
+		BNX2X_ERR("PRS timeout val = 0x%x\n", val);
+	}

WARNING: braces {} are not necessary for single statement blocks
#5161: FILE: drivers/net/bnx2x.c:5106:
+	if (val != 0x3) {
+		BNX2X_ERR("PRS timeout val = 0x%x\n", val);
+	}

WARNING: braces {} are not necessary for single statement blocks
#5165: FILE: drivers/net/bnx2x.c:5110:
+	for (i = 0; i < 11; i++) {
+		REG_RD(bp, GRCBASE_NIG, NIG_REGISTERS_INGRESS_EOP_LB_FIFO);
+	}

WARNING: braces {} are not necessary for single statement blocks
#5394: FILE: drivers/net/bnx2x.c:5339:
+		if (sizeof(union cdu_context) != 1024) {
+			printk(KERN_ALERT PFX "please adjust the size of"
+			       " cdu_context(%ld)\n",
+			       (long)sizeof(union cdu_context));
+		}

WARNING: braces {} are not necessary for single statement blocks
#5415: FILE: drivers/net/bnx2x.c:5360:
+		if (CHIP_REV_IS_SLOW(bp)) {
+			msleep(200);
+		}

WARNING: braces {} are not necessary for single statement blocks
#5713: FILE: drivers/net/bnx2x.c:5658:
+		for (word = 0; word < 8; word++) {
+			data[word] = htonl(REG_RD(bp, GRCBASE_MCP,
+						  MCP_REG_MCPR_SCRATCH +
+						  offset + 4*word));
+		}

WARNING: braces {} are not necessary for single statement blocks
#5741: FILE: drivers/net/bnx2x.c:5686:
+	if (CHIP_REV_IS_SLOW(bp)) {
+		msleep(900);
+	}

WARNING: braces {} are not necessary for single statement blocks
#5909: FILE: drivers/net/bnx2x.c:5854:
+	for (i = 0; i < 16*1024; i += 64) {
+		*(u64 *)((char *)bp->t2 + i + 56) = bp->t2_mapping + i + 64;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6044: FILE: drivers/net/bnx2x.c:5989:
+			if (rc) {
+				return -1;
+			}

WARNING: braces {} are not necessary for single statement blocks
#6056: FILE: drivers/net/bnx2x.c:6001:
+				if (rc) {
+					goto out_irq;
+				}

WARNING: braces {} are not necessary for single statement blocks
#6066: FILE: drivers/net/bnx2x.c:6011:
+		if (rc) {
+			return -1;
+		}

WARNING: braces {} are not necessary for single statement blocks
#6167: FILE: drivers/net/bnx2x.c:6112:
+		if (i++ == 5000) {
+			return -EBUSY;
+		}

WARNING: braces {} are not necessary for single statement blocks
#6213: FILE: drivers/net/bnx2x.c:6158:
+		if (rc) {
+			goto out_error;
+		}

WARNING: braces {} are not necessary for single statement blocks
#6229: FILE: drivers/net/bnx2x.c:6174:
+	if (rc) {
+		goto out_skbs;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6237: FILE: drivers/net/bnx2x.c:6182:
+		if (!rc) {
+			goto int_disable;
+		}

WARNING: braces {} are not necessary for single statement blocks
#6258: FILE: drivers/net/bnx2x.c:6203:
+	if (rc) {
+		goto stop_netif;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6271: FILE: drivers/net/bnx2x.c:6216:
+		if (bp->flags & USING_MSIX_FLAG) {
+			printk(KERN_INFO PFX "%s: using MSI-X\n",
+			       bp->dev->name);
+		}

WARNING: braces {} are not necessary for single statement blocks
#6366: FILE: drivers/net/bnx2x.c:6311:
+	while (bp->stat_pending && (bp->spq_left != MAX_SPQ_PENDING)) {
+		msleep(1);
+	}

WARNING: braces {} are not necessary for single statement blocks
#6404: FILE: drivers/net/bnx2x.c:6349:
+	if (rc) {
+		goto error;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6439: FILE: drivers/net/bnx2x.c:6384:
+	if (!nomcp) {
+		bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE);
+	}

WARNING: braces {} are not necessary for single statement blocks
#6580: FILE: drivers/net/bnx2x.c:6525:
+	if (!(bp->speed_cap_mask &
+	      PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF)) {
+		bp->supported &= ~SUPPORTED_10baseT_Half;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6584: FILE: drivers/net/bnx2x.c:6529:
+	if (!(bp->speed_cap_mask &
+	      PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL)) {
+		bp->supported &= ~SUPPORTED_10baseT_Full;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6588: FILE: drivers/net/bnx2x.c:6533:
+	if (!(bp->speed_cap_mask &
+	      PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF)) {
+		bp->supported &= ~SUPPORTED_100baseT_Half;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6592: FILE: drivers/net/bnx2x.c:6537:
+	if (!(bp->speed_cap_mask &
+	      PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL)) {
+		bp->supported &= ~SUPPORTED_100baseT_Full;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6596: FILE: drivers/net/bnx2x.c:6541:
+	if (!(bp->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) {
+		bp->supported &= ~(SUPPORTED_1000baseT_Half |
+				   SUPPORTED_1000baseT_Full);
+	}

WARNING: braces {} are not necessary for single statement blocks
#6600: FILE: drivers/net/bnx2x.c:6545:
+	if (!(bp->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)) {
+		bp->supported &= ~SUPPORTED_2500baseT_Full;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6603: FILE: drivers/net/bnx2x.c:6548:
+	if (!(bp->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) {
+		bp->supported &= ~SUPPORTED_10000baseT_Full;
+	}

WARNING: braces {} are not necessary for single statement blocks
#6818: FILE: drivers/net/bnx2x.c:6763:
+	if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
+		!= (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) {
+		BNX2X_ERR("MCP validity signature bad\n");
+	}

WARNING: multiple assignments should be avoided
#6880: FILE: drivers/net/bnx2x.c:6825:
+		bp->bc_ver = val = ((SHMEM_RD(bp, dev_info.bc_rev)) >> 8);

WARNING: braces {} are not necessary for single statement blocks
#6973: FILE: drivers/net/bnx2x.c:6918:
+		if (!(bp->supported & SUPPORTED_TP)) {
+			return -EINVAL;
+		}

WARNING: braces {} are not necessary for single statement blocks
#6984: FILE: drivers/net/bnx2x.c:6929:
+		if (!(bp->supported & SUPPORTED_FIBRE)) {
+			return -EINVAL;
+		}

WARNING: braces {} are not necessary for single statement blocks
#7012: FILE: drivers/net/bnx2x.c:6957:
+				if (!(bp->supported &
+						SUPPORTED_10baseT_Full)) {
+					return -EINVAL;
+				}

WARNING: braces {} are not necessary for single statement blocks
#7019: FILE: drivers/net/bnx2x.c:6964:
+				if (!(bp->supported &
+						SUPPORTED_10baseT_Half)) {
+					return -EINVAL;
+				}

WARNING: braces {} are not necessary for single statement blocks
#7030: FILE: drivers/net/bnx2x.c:6975:
+				if (!(bp->supported &
+						SUPPORTED_100baseT_Full)) {
+					return -EINVAL;
+				}

WARNING: braces {} are not necessary for single statement blocks
#7037: FILE: drivers/net/bnx2x.c:6982:
+				if (!(bp->supported &
+						SUPPORTED_100baseT_Half)) {
+					return -EINVAL;
+				}

WARNING: braces {} are not necessary for single statement blocks
#7047: FILE: drivers/net/bnx2x.c:6992:
+			if (cmd->duplex != DUPLEX_FULL) {
+				return -EINVAL;
+			}

WARNING: braces {} are not necessary for single statement blocks
#7050: FILE: drivers/net/bnx2x.c:6995:
+			if (!(bp->supported & SUPPORTED_1000baseT_Full)) {
+				return -EINVAL;
+			}

WARNING: braces {} are not necessary for single statement blocks
#7058: FILE: drivers/net/bnx2x.c:7003:
+			if (cmd->duplex != DUPLEX_FULL) {
+				return -EINVAL;
+			}

WARNING: braces {} are not necessary for single statement blocks
#7061: FILE: drivers/net/bnx2x.c:7006:
+			if (!(bp->supported & SUPPORTED_2500baseT_Full)) {
+				return -EINVAL;
+			}

WARNING: braces {} are not necessary for single statement blocks
#7069: FILE: drivers/net/bnx2x.c:7014:
+			if (cmd->duplex != DUPLEX_FULL) {
+				return -EINVAL;
+			}

WARNING: braces {} are not necessary for single statement blocks
#7072: FILE: drivers/net/bnx2x.c:7017:
+			if (!(bp->supported & SUPPORTED_10000baseT_Full)) {
+				return -EINVAL;
+			}

WARNING: braces {} are not necessary for single statement blocks
#7202: FILE: drivers/net/bnx2x.c:7147:
+		if (val & (MCPR_NVM_SW_ARB_ARB_ARB1 << port)) {
+			break;
+		}

WARNING: braces {} are not necessary for single statement blocks
#7234: FILE: drivers/net/bnx2x.c:7179:
+		if (!(val & (MCPR_NVM_SW_ARB_ARB_ARB1 << port))) {
+			break;
+		}

WARNING: braces {} are not necessary for single statement blocks
#7345: FILE: drivers/net/bnx2x.c:7290:
+	if (rc) {
+		return rc;
+	}

WARNING: braces {} are not necessary for single statement blocks
#7457: FILE: drivers/net/bnx2x.c:7402:
+	if (rc) {
+		return rc;
+	}

WARNING: braces {} are not necessary for single statement blocks
#7517: FILE: drivers/net/bnx2x.c:7462:
+	if (rc) {
+		return rc;
+	}

WARNING: braces {} are not necessary for single statement blocks
#7603: FILE: drivers/net/bnx2x.c:7548:
+	if (netif_running(bp->dev)) {
+		bnx2x_update_coalesce(bp);
+	}

WARNING: braces {} are not necessary for single statement blocks
#7632: FILE: drivers/net/bnx2x.c:7577:
+	if ((ering->rx_pending > MAX_RX_AVAIL) ||
+	    (ering->tx_pending > MAX_TX_AVAIL) ||
+	    (ering->tx_pending <= MAX_SKB_FRAGS + 4)) {
+
+		return -EINVAL;
+	}

WARNING: braces {} are not necessary for single statement blocks
#7948: FILE: drivers/net/bnx2x.c:7893:
+	if (bp->link_up) {
+		bnx2x_leds_set(bp, bp->line_speed);
+	}

WARNING: braces {} are not necessary for single statement blocks
#8017: FILE: drivers/net/bnx2x.c:7962:
+		if (bp->wol) {
+			pmcsr |= PCI_PM_CTRL_PME_ENABLE;
+		}

WARNING: braces {} are not necessary for single statement blocks
#8049: FILE: drivers/net/bnx2x.c:7994:
+	if (dev->flags & IFF_PROMISC) {
+		rx_mode = BNX2X_RX_MODE_PROMISC;
+
+	} else if (dev->flags & IFF_ALLMULTI ||

WARNING: braces {} are not necessary for single statement blocks
#8135: FILE: drivers/net/bnx2x.c:8080:
+	if (*fp->tx_cons_sb != fp->tx_pkt_cons) {
+		bnx2x_tx_int(fp, budget);
+	}

WARNING: braces {} are not necessary for single statement blocks
#8139: FILE: drivers/net/bnx2x.c:8084:
+	if (*fp->rx_cons_sb != fp->rx_comp_cons) {
+		work_done = bnx2x_rx_int(fp, budget);
+	}

WARNING: braces {} are not necessary for single statement blocks
#8173: FILE: drivers/net/bnx2x.c:8118:
+	if (unlikely(bp->panic)) {
+		return NETDEV_TX_BUSY;
+	}

WARNING: braces {} are not necessary for single statement blocks
#8267: FILE: drivers/net/bnx2x.c:8212:
+	else {
+		txbd->vlan = pkt_prod;
+	}

WARNING: multiple assignments should be avoided
#8277: FILE: drivers/net/bnx2x.c:8222:
+	txbd->nbd = nbd = skb_shinfo(skb)->nr_frags + ((pbd == NULL)? 1 : 2);

WARNING: braces {} are not necessary for single statement blocks
#8398: FILE: drivers/net/bnx2x.c:8343:
+	if (pbd) {
+		DP(NETIF_MSG_TX_QUEUED,
+		   "PBD @%p  ip_data %x  ip_hlen %u  ip_id %u  lso_mss %u"
+		   "  tcp_flags %x  xsum %x  seq %u  hlen %u\n",
+		   pbd, pbd->global_data, pbd->ip_hlen, pbd->ip_id,
+		   pbd->lso_mss, pbd->tcp_flags, pbd->tcp_pseudo_csum,
+		   pbd->tcp_send_seq, pbd->total_hlen);
+	}

WARNING: braces {} are not necessary for single statement blocks
#8507: FILE: drivers/net/bnx2x.c:8452:
+		if (!capable(CAP_NET_ADMIN)) {
+			return -EPERM;
+		}

WARNING: braces {} are not necessary for single statement blocks
#8556: FILE: drivers/net/bnx2x.c:8501:
+	if (!bp->panic) {
+		bnx2x_panic();
+	}

WARNING: multiple assignments should be avoided
#8696: FILE: drivers/net/bnx2x.c:8641:
+	dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0);

WARNING: braces {} are not necessary for single statement blocks
#8921: FILE: drivers/net/bnx2x.c:8866:
+	if (!rc) {
+		return rc;
+	}

WARNING: braces {} are not necessary for single statement blocks
#8945: FILE: drivers/net/bnx2x.c:8890:
+	if (rc) {
+		return rc;
+	}

CHECK: spinlock_t definition without comment
#9486: FILE: drivers/net/bnx2x.h:508:
+	spinlock_t		spq_lock;  /* Used to serialize slowpath

ERROR: need a space before the open brace '{'
#9824: FILE: drivers/net/bnx2x.h:846:
+	do{ \

ERROR: need consistent spacing around '+' (ctx:VxW)
#19015: FILE: drivers/net/bnx2x_hsi.h:4129:
+#define GENERAL_ATTEN_WORD(atten_name) ((94+ atten_name) / 32)
                                            ^

ERROR: no space before that close parenthesis ')'
#19016: FILE: drivers/net/bnx2x_hsi.h:4130:
+#define GENERAL_ATTEN_OFFSET(atten_name) (1 << ((94 + atten_name) % 32 ))

ERROR: trailing whitespace
#21068: FILE: drivers/net/bnx2x_init.h:10:
+ */         $

ERROR: Macros with complex values should be enclosed in parenthesis
#21196: FILE: drivers/net/bnx2x_init.h:138:
+#define INIT_INTERNAL0_MEM_WR(block_bar, block, reg, \
+			      part, hw, value, off, len) \

WARNING: braces {} are not necessary for single statement blocks
#21307: FILE: drivers/net/bnx2x_init.h:249:
+	for (i = 0; i < 4; i++) {
+		DMAE_CLR(bp, storms[i], 0UL, STORM_INTMEM_SIZE / 4);
+	}

ERROR: need a space after that close brace '}'
#21329: FILE: drivers/net/bnx2x_init.h:271:
+	{{ 8 , 64 , 25}, { 16 , 64 , 25}, { 32 , 64 , 25}, { 64 , 64 , 41}},

ERROR: need a space after that close brace '}'
#21330: FILE: drivers/net/bnx2x_init.h:272:
+	{{ 4 , 8 , 4},   { 4 , 8 , 4},    { 4 , 8 , 4},    { 4 , 8 , 4}},

ERROR: need a space after that close brace '}'
#21331: FILE: drivers/net/bnx2x_init.h:273:
+	{{ 4 , 3 , 3},   { 4 , 3 , 3},    { 4 , 3 , 3},    { 4 , 3 , 3}},

ERROR: need a space after that close brace '}'
#21332: FILE: drivers/net/bnx2x_init.h:274:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 16 , 3 , 11},  { 16 , 3 , 11}},

ERROR: need a space after that close brace '}'
#21333: FILE: drivers/net/bnx2x_init.h:275:
+	{{ 8 , 64 , 25}, { 16 , 64 , 25}, { 32 , 64 , 25}, { 64 , 64 , 41}},

ERROR: need a space after that close brace '}'
#21334: FILE: drivers/net/bnx2x_init.h:276:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 64 , 3 , 41}},

ERROR: need a space after that close brace '}'
#21335: FILE: drivers/net/bnx2x_init.h:277:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 64 , 3 , 41}},

ERROR: need a space after that close brace '}'
#21336: FILE: drivers/net/bnx2x_init.h:278:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 64 , 3 , 41}},

ERROR: need a space after that close brace '}'
#21337: FILE: drivers/net/bnx2x_init.h:279:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 64 , 3 , 41}},

ERROR: need a space after that close brace '}'
#21338: FILE: drivers/net/bnx2x_init.h:280:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21339: FILE: drivers/net/bnx2x_init.h:281:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21340: FILE: drivers/net/bnx2x_init.h:282:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21341: FILE: drivers/net/bnx2x_init.h:283:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21342: FILE: drivers/net/bnx2x_init.h:284:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21343: FILE: drivers/net/bnx2x_init.h:285:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21344: FILE: drivers/net/bnx2x_init.h:286:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21345: FILE: drivers/net/bnx2x_init.h:287:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21346: FILE: drivers/net/bnx2x_init.h:288:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21347: FILE: drivers/net/bnx2x_init.h:289:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21348: FILE: drivers/net/bnx2x_init.h:290:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21349: FILE: drivers/net/bnx2x_init.h:291:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21350: FILE: drivers/net/bnx2x_init.h:292:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21351: FILE: drivers/net/bnx2x_init.h:293:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21352: FILE: drivers/net/bnx2x_init.h:294:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21353: FILE: drivers/net/bnx2x_init.h:295:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21354: FILE: drivers/net/bnx2x_init.h:296:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21355: FILE: drivers/net/bnx2x_init.h:297:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21356: FILE: drivers/net/bnx2x_init.h:298:
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 32 , 3 , 21},  { 32 , 3 , 21}},

ERROR: need a space after that close brace '}'
#21357: FILE: drivers/net/bnx2x_init.h:299:
+	{{ 8 , 64 , 25}, { 16 , 64 , 41}, { 32 , 64 , 81}, { 64 , 64 , 120}}};

ERROR: need a space after that close brace '}'
#21360: FILE: drivers/net/bnx2x_init.h:302:
+	{{ 4 , 6 , 3},   { 4 , 6 , 3},    { 4 , 6 , 3}},

ERROR: need a space after that close brace '}'
#21361: FILE: drivers/net/bnx2x_init.h:303:
+	{{ 4 , 2 , 3},   { 4 , 2 , 3},    { 4 , 2 , 3}},

ERROR: need a space after that close brace '}'
#21362: FILE: drivers/net/bnx2x_init.h:304:
+	{{ 8 , 2 , 6},   { 16 , 2 , 11},  { 16 , 2 , 11}},

ERROR: need a space after that close brace '}'
#21363: FILE: drivers/net/bnx2x_init.h:305:
+	{{ 8 , 2 , 6},   { 16 , 2 , 11},  { 32 , 2 , 21}},

ERROR: need a space after that close brace '}'
#21364: FILE: drivers/net/bnx2x_init.h:306:
+	{{ 8 , 2 , 6},   { 16 , 2 , 11},  { 32 , 2 , 21}},

ERROR: need a space after that close brace '}'
#21365: FILE: drivers/net/bnx2x_init.h:307:
+	{{ 8 , 2 , 6},   { 16 , 2 , 11},  { 32 , 2 , 21}},

ERROR: need a space after that close brace '}'
#21366: FILE: drivers/net/bnx2x_init.h:308:
+	{{ 8 , 64 , 25}, { 16 , 64 , 25}, { 32 , 64 , 25}},

ERROR: need a space after that close brace '}'
#21367: FILE: drivers/net/bnx2x_init.h:309:
+	{{ 8 , 2 , 6},   { 16 , 2 , 11},  { 16 , 2 , 11}},

ERROR: need a space after that close brace '}'
#21368: FILE: drivers/net/bnx2x_init.h:310:
+	{{ 8 , 2 , 6},   { 16 , 2 , 11},  { 16 , 2 , 11}},

ERROR: need a space after that close brace '}'
#21369: FILE: drivers/net/bnx2x_init.h:311:
+	{{ 8 , 9 , 6},   { 16 , 9 , 11},  { 32 , 9 , 21}},

ERROR: need a space after that close brace '}'
#21370: FILE: drivers/net/bnx2x_init.h:312:
+	{{ 8 , 47 , 19}, { 16 , 47 , 19}, { 32 , 47 , 21}},

ERROR: need a space after that close brace '}'
#21371: FILE: drivers/net/bnx2x_init.h:313:
+	{{ 8 , 9 , 6},   { 16 , 9 , 11},  { 16 , 9 , 11}},

ERROR: need a space after that close brace '}'
#21372: FILE: drivers/net/bnx2x_init.h:314:
+	{{ 8 , 64 , 25}, { 16 , 64 , 41}, { 32 , 64 , 81}}};

ERROR: need a space after that close brace '}'
#21430: FILE: drivers/net/bnx2x_init.h:372:
+		PXP2_REGISTERS_PSWRQ_BW_UB28}};

ERROR: need a space after that close brace '}'
#21456: FILE: drivers/net/bnx2x_init.h:398:
+		PXP2_REGISTERS_RQ_BW_WR_UBOUND30}};

ERROR: no space before that close parenthesis ')'
#21573: FILE: drivers/net/bnx2x_init.h:515:
+	for (i = 0; i < 8; i++ ) {

WARNING: braces {} are not necessary for single statement blocks
#21604: FILE: drivers/net/bnx2x_init.h:546:
+	for (i = 0; i < 8; i++) {
+		crc_res |= (NewCRC[i] << i);
+	}

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

^ permalink raw reply

* Re: e100 problems in .23rc8 ?
From: Herbert Xu @ 2007-10-11  1:25 UTC (permalink / raw)
  To: Dave Jones; +Cc: Kok, Auke, netdev, esandeen, dmack
In-Reply-To: <20071011003638.GA27174@redhat.com>

On Wed, Oct 10, 2007 at 08:36:38PM -0400, Dave Jones wrote:
> 
> The e1000 changes you reference above, is this the changeset you mean?
> 
> commit 416b5d10afdc797c21c457ade3714e8f2f75edd9
> Author: Auke Kok <auke-jan.h.kok@intel.com>
> Date:   Fri Jun 1 10:22:39 2007 -0700
> 
>     e1000: disable polling before registering netdevice

Yep.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <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

* Re: [PATCH 0/5] tg3: Add 5761 support
From: David Miller @ 2007-10-11  1:04 UTC (permalink / raw)
  To: mcarlson; +Cc: netdev, andy, mchan
In-Reply-To: <1192063518.4878.182.camel@teletran1>

From: "Matt Carlson" <mcarlson@broadcom.com>
Date: Wed, 10 Oct 2007 17:45:16 -0700

> The following patchset adds support for the 5761 device and enables WOL
> by default if out-of-box WOL is enabled in the NVRAM.  The 5761 patches
> were tested against preproduction hardware.

All applied, thanks Matt.

^ permalink raw reply

* Re: [PATCH][MIPS][6/6] AR7: leds driver
From: Matteo Croce @ 2007-10-11  1:01 UTC (permalink / raw)
  To: linux-mips
  Cc: Eugene Konev, netdev, davem, kuznet, pekkas, jmorris, yoshfuji,
	kaber, Andrew Morton, Jeff Garzik
In-Reply-To: <200710110248.33028.technoboy85@gmail.com>

The new led driver, uses leds-gpio now

Signed-off-by: Matteo Croce <technoboy85@gmail.com>
Signed-off-by: Nicolas Thill <nico@openwrt.org>

diff --git a/drivers/leds/leds-ar7.c b/drivers/leds/leds-ar7.c
new file mode 100644
index 0000000..72b958a
--- /dev/null
+++ b/drivers/leds/leds-ar7.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2007 Nicolas Thill <nico@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <gpio.h>
+
+#define DRVNAME "ar7-leds"
+#define LONGNAME "TI AR7 LEDs driver"
+#define AR7_GPIO_BIT_STATUS_LED 8
+
+MODULE_AUTHOR("Nicolas Thill <nico@openwrt.org>");
+MODULE_DESCRIPTION(LONGNAME);
+MODULE_LICENSE("GPL");
+
+static void ar7_status_led_set(struct led_classdev *pled,
+		enum led_brightness value)
+{
+	gpio_set_value(AR7_GPIO_BIT_STATUS_LED, value ? 0 : 1);
+}
+
+static struct led_classdev ar7_status_led = {
+	.name		= "ar7:status",
+	.brightness_set	= ar7_status_led_set,
+};
+
+#ifdef CONFIG_PM
+static int ar7_leds_suspend(struct platform_device *dev,
+		pm_message_t state)
+{
+	led_classdev_suspend(&ar7_status_led);
+	return 0;
+}
+
+static int ar7_leds_resume(struct platform_device *dev)
+{
+	led_classdev_resume(&ar7_status_led);
+	return 0;
+}
+#else /* CONFIG_PM */
+#define ar7_leds_suspend NULL
+#define ar7_leds_resume NULL
+#endif /* CONFIG_PM */
+
+static int ar7_leds_probe(struct platform_device *pdev)
+{
+	int rc;
+
+	rc = led_classdev_register(&pdev->dev, &ar7_status_led);
+	if (rc < 0)
+		goto out;
+
+	ar7_gpio_enable(AR7_GPIO_BIT_STATUS_LED);
+	gpio_direction_output(AR7_GPIO_BIT_STATUS_LED, 0);
+
+out:
+	return rc;
+}
+
+static int ar7_leds_remove(struct platform_device *pdev)
+{
+	led_classdev_unregister(&ar7_status_led);
+
+	return 0;
+}
+
+static struct platform_device *ar7_leds_device;
+
+static struct platform_driver ar7_leds_driver = {
+	.probe		= ar7_leds_probe,
+	.remove		= ar7_leds_remove,
+	.suspend	= ar7_leds_suspend,
+	.resume		= ar7_leds_resume,
+	.driver		= {
+		.name		= DRVNAME,
+	},
+};
+
+static int __init ar7_leds_init(void)
+{
+	int rc;
+
+	ar7_leds_device = platform_device_alloc(DRVNAME, -1);
+	if (!ar7_leds_device)
+		return -ENOMEM;
+
+	rc = platform_device_add(ar7_leds_device);
+	if (rc < 0)
+		goto out_put;
+
+	rc = platform_driver_register(&ar7_leds_driver);
+	if (rc < 0)
+		goto out_put;
+
+	goto out;
+
+out_put:
+	platform_device_put(ar7_leds_device);
+out:
+	return rc;
+}
+
+static void __exit ar7_leds_exit(void)
+{
+	platform_driver_unregister(&ar7_leds_driver);
+	platform_device_unregister(ar7_leds_device);
+}
+
+module_init(ar7_leds_init);
+module_exit(ar7_leds_exit);

^ permalink raw reply related

* Re: [PATCH][BNX2X] round three
From: David Miller @ 2007-10-11  0:59 UTC (permalink / raw)
  To: eliezert; +Cc: netdev, jeff, mchan
In-Reply-To: <470D2D7E.8080507@broadcom.com>

From: "Eliezer Tamir" <eliezert@broadcom.com>
Date: Wed, 10 Oct 2007 21:52:30 +0200

> Eliezer Tamir wrote:
> > The full patch is available at:
> > Net_sys_anon@ftp://ftp1.broadcom.com/0001-BNX2X-0.40.10a-net-2.6.24.patch
> 
> Just when I thought I have beaten the line beast.
> (or maybe it's just too much work and not enough sleep.)
> 
> the right links are of course:
> ftp://Net_sys_anon@ftp1.broadcom.com/0001-BNX2X-0.40.10a-net-2.6.24.patch
> 
> and
> ftp://Net_sys_anon@ftp1.broadcom.com/0001-BNX2X-0.40.10a-net-2.6.24.patch.gz

I was going to add this to the tree for 2.6.24 but there is simply
too much super-ugly stuff in this driver for me to do so.

bnx2x_hsi.h is a complete mess, it seems to be a concatenation of
several internal header files automatically generated by some
program.  It also defines datastructures for which no tabbing
or coding style has been applied, like this

+struct drv_fw_mb_t
+{
+u32 drv_mb_header;

This is why we hate machine generated register lists and similar
things. They are awful to read by human beings, the very people who
might need to read this to work on helping to fix a bug.

I always type every register offset and bit definition in by hand and
make them properly tabbed and look pleasant to human beings who might
have to stare at it.

+#ifndef __ETH_CONSTANTS_H_
+#define __ETH_CONSTANTS_H_
...
+#ifndef __MICROCODE_CONSTANTS_H_
+#define __MICROCODE_CONSTANTS_H_

All in one header file...  Barf...

+static const struct arb_line read_arb_data[NUM_RD_Q][MAX_RD_ORD + 1] = {
+	{{ 8 , 64 , 25}, { 16 , 64 , 25}, { 32 , 64 , 25}, { 64 , 64 , 41}},
+	{{ 4 , 8 , 4},   { 4 , 8 , 4},    { 4 , 8 , 4},    { 4 , 8 , 4}},
+	{{ 4 , 3 , 3},   { 4 , 3 , 3},    { 4 , 3 , 3},    { 4 , 3 , 3}},
+	{{ 8 , 3 , 6},   { 16 , 3 , 11},  { 16 , 3 , 11},  { 16 , 3 , 11}},
+	{{ 8 , 64 , 25}, { 16 , 64 , 25}, { 32 , 64 , 25}, { 64 , 64 , 41}},

Magic constants, what do they mean?

+static const u32 EVST_TSEM_FAST_MEMORY_COMMON_MEMORY_INIT_ASIC_7[] = {
+0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 ...
+0x0, 0x0, 0x0, 0x1};

All zeros with a trailing one, remove this table and just program this
sequence by hand.  This table serves nothing but to waste unswappable
kernel memory.  I don't care if they are dependent upon firmware
changes.

There are tons of tables like this, fix them.

+static const u32 EVST_TSEM_FAST_MEMORY_PORT0_MEMORY_INIT_ASIC_27[] = {
+0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+0xffffffff, 0xffffffff};

What do these magic constant masks mean?

+static const u32 EVST_CDU_L1TT_COMMON_MEMORY_INIT_HARDWARE[] = {
+0xfffffff3, 0x314fffff, 0xc30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0xcf3c,

Magic constants, what are they?

+static const u32 EVST_CDU_MATT_COMMON_MEMORY_INIT_HARDWARE[] = {
+0xa0000, 0x700a0, 0x28110, 0xb8138, 0x201f0, 0x10210, 0xf0220, 0x10310,
+0x80000, 0x80080, 0x28100, 0xb8128, 0x201e0, 0x10200, 0x70210, 0x20280,

Similarly.

+INIT_REG_WR(TSDM, TSDM_REGISTERS_ENABLE_IN1, 0X7FFFFFF, COMMON, INIT_HARDWARE);
+INIT_REG_WR(TSDM, TSDM_REGISTERS_ENABLE_IN2, 0X3F, COMMON, INIT_HARDWARE);
+INIT_REG_WR(TSDM, TSDM_REGISTERS_ENABLE_OUT1, 0X7FFFFFF, COMMON, INIT_HARDWARE);
+INIT_REG_WR(TSDM, TSDM_REGISTERS_ENABLE_OUT2, 0XF, COMMON, INIT_HARDWARE);

Magic undocumented constants.

+static const u32 EVST_TCM_XX_DESCR_TABLE_COMMON_MEMORY_INIT_HARDWARE[] = {
+0x10000, 0x204c0, 0x30980, 0x40e40, 0x51300, 0x617c0, 0x71c80, 0x82140,
+0x92600, 0xa2ac0, 0xb2f80, 0xc3440, 0xd3900, 0xe3dc0, 0xf4280, 0x104740,
+0x114c00, 0x1250c0, 0x135580, 0x145a40, 0x155f00, 0x1663c0, 0x176880, 0x186d40,
+0x197200, 0x1a76c0, 0x1b7b80, 0x1c8040, 0x1d8500, 0x1e89c0, 0x1f8e80,
+0x209340};

More of same.

Look, there is zero way I'm adding a driver that's written like this
to the tree.

We've set high standards for these sorts of issues in previous
Broadcom network chip drivers and we're not about to start regressing
in this area.

I don't care if it's easier for you guys to run some program which
autogenerates tables than to code it up cleanly into C function
statements which purposefully program each element of the hardware.

This huge header file full of register programming magic goes way
beyond the limits of "reasonable" and has to go.

If that big concatenated header file shows up in the next submission
I'm not even going to review it, so please don't waste my time in
this way.

Thanks.

^ permalink raw reply

* [PATCH 4/5] tg3: WOL defaults
From: Matt Carlson @ 2007-10-11  0:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, andy, Michael Chan

This patch enables WOL by default if out-of-box WOL is enabled in the
NVRAM.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 3af93b5..8967bc3 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10412,8 +10412,12 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
 			tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT;
 			tp->tg3_flags2 |= TG3_FLG2_IS_NIC;
 		}
-		if (tr32(VCPU_CFGSHDW) & VCPU_CFGSHDW_ASPM_DBNC)
+		val = tr32(VCPU_CFGSHDW);
+		if (val & VCPU_CFGSHDW_ASPM_DBNC)
 			tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
+		if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
+		    (val & VCPU_CFGSHDW_WOL_MAGPKT))
+			tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
 		return;
 	}
 
@@ -10536,6 +10540,10 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
 		    !(nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL))
 			tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
 
+		if (tp->tg3_flags & TG3_FLAG_WOL_CAP &&
+		    nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)
+			tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
+
 		if (cfg2 & (1 << 17))
 			tp->tg3_flags2 |= TG3_FLG2_CAPACITIVE_COUPLING;
 
@@ -11454,11 +11462,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
 		tp->rx_std_max_post = 8;
 
-	/* By default, disable wake-on-lan.  User can change this
-	 * using ETHTOOL_SWOL.
-	 */
-	tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE;
-
 	if (tp->tg3_flags & TG3_FLAG_ASPM_WORKAROUND)
 		tp->pwrmgmt_thresh = tr32(PCIE_PWR_MGMT_THRESH) &
 				     PCIE_PWR_MGMT_L1_THRESH_MSK;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index d1f5fa3..6dbdad2 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1151,6 +1151,8 @@
 #define  VCPU_STATUS_DRV_RESET		 0x08000000
 
 #define VCPU_CFGSHDW			0x00005104
+#define  VCPU_CFGSHDW_WOL_ENABLE	 0x00000001
+#define  VCPU_CFGSHDW_WOL_MAGPKT	 0x00000004
 #define  VCPU_CFGSHDW_ASPM_DBNC		 0x00001000
 
 /* Mailboxes */



^ permalink raw reply related

* [PATCH 2/5] tg3: Add 5761 APE support
From: Matt Carlson @ 2007-10-11  0:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, andy, Michael Chan

This patch adds support for the new APE block, present in 5761 chips.
APE stands for Application Processing Engine.  The primary function of
the APE is to process manageability traffic, such as ASF.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 3200c9c..5b6c1b2 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -314,6 +314,16 @@ static u32 tg3_read32(struct tg3 *tp, u32 off)
 	return (readl(tp->regs + off));
 }
 
+static void tg3_ape_write32(struct tg3 *tp, u32 off, u32 val)
+{
+	writel(val, tp->aperegs + off);
+}
+
+static u32 tg3_ape_read32(struct tg3 *tp, u32 off)
+{
+	return (readl(tp->aperegs + off));
+}
+
 static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
 {
 	unsigned long flags;
@@ -500,6 +510,73 @@ static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
 	spin_unlock_irqrestore(&tp->indirect_lock, flags);
 }
 
+static void tg3_ape_lock_init(struct tg3 *tp)
+{
+	int i;
+
+	/* Make sure the driver hasn't any stale locks. */
+	for (i = 0; i < 8; i++)
+		tg3_ape_write32(tp, TG3_APE_LOCK_GRANT + 4 * i,
+				APE_LOCK_GRANT_DRIVER);
+}
+
+static int tg3_ape_lock(struct tg3 *tp, int locknum)
+{
+	int i, off;
+	int ret = 0;
+	u32 status;
+
+	if (!(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE))
+		return 0;
+
+	switch (locknum) {
+		case TG3_APE_LOCK_MEM:
+			break;
+		default:
+			return -EINVAL;
+	}
+
+	off = 4 * locknum;
+
+	tg3_ape_write32(tp, TG3_APE_LOCK_REQ + off, APE_LOCK_REQ_DRIVER);
+
+	/* Wait for up to 1 millisecond to acquire lock. */
+	for (i = 0; i < 100; i++) {
+		status = tg3_ape_read32(tp, TG3_APE_LOCK_GRANT + off);
+		if (status == APE_LOCK_GRANT_DRIVER)
+			break;
+		udelay(10);
+	}
+
+	if (status != APE_LOCK_GRANT_DRIVER) {
+		/* Revoke the lock request. */
+		tg3_ape_write32(tp, TG3_APE_LOCK_GRANT + off,
+				APE_LOCK_GRANT_DRIVER);
+
+		ret = -EBUSY;
+	}
+
+	return ret;
+}
+
+static void tg3_ape_unlock(struct tg3 *tp, int locknum)
+{
+	int off;
+
+	if (!(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE))
+		return;
+
+	switch (locknum) {
+		case TG3_APE_LOCK_MEM:
+			break;
+		default:
+			return;
+	}
+
+	off = 4 * locknum;
+	tg3_ape_write32(tp, TG3_APE_LOCK_GRANT + off, APE_LOCK_GRANT_DRIVER);
+}
+
 static void tg3_disable_ints(struct tg3 *tp)
 {
 	tw32(TG3PCI_MISC_HOST_CTRL,
@@ -1448,7 +1525,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
 	}
 
 	if (!(tp->tg3_flags & TG3_FLAG_WOL_ENABLE) &&
-	    !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF))
+	    !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) &&
+	    !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE))
 		tg3_power_down_phy(tp);
 
 	tg3_frob_aux_power(tp);
@@ -4726,6 +4804,80 @@ static void tg3_disable_nvram_access(struct tg3 *tp)
 	}
 }
 
+static void tg3_ape_send_event(struct tg3 *tp, u32 event)
+{
+	int i;
+	u32 apedata;
+
+	apedata = tg3_ape_read32(tp, TG3_APE_SEG_SIG);
+	if (apedata != APE_SEG_SIG_MAGIC)
+		return;
+
+	apedata = tg3_ape_read32(tp, TG3_APE_FW_STATUS);
+	if (apedata != APE_FW_STATUS_READY)
+		return;
+
+	/* Wait for up to 1 millisecond for APE to service previous event. */
+	for (i = 0; i < 10; i++) {
+		if (tg3_ape_lock(tp, TG3_APE_LOCK_MEM))
+			return;
+
+		apedata = tg3_ape_read32(tp, TG3_APE_EVENT_STATUS);
+
+		if (!(apedata & APE_EVENT_STATUS_EVENT_PENDING))
+			tg3_ape_write32(tp, TG3_APE_EVENT_STATUS,
+					event | APE_EVENT_STATUS_EVENT_PENDING);
+
+		tg3_ape_unlock(tp, TG3_APE_LOCK_MEM);
+
+		if (!(apedata & APE_EVENT_STATUS_EVENT_PENDING))
+			break;
+
+		udelay(100);
+	}
+
+	if (!(apedata & APE_EVENT_STATUS_EVENT_PENDING))
+		tg3_ape_write32(tp, TG3_APE_EVENT, APE_EVENT_1);
+}
+
+static void tg3_ape_driver_state_change(struct tg3 *tp, int kind)
+{
+	u32 event;
+	u32 apedata;
+
+	if (!(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE))
+		return;
+
+	switch (kind) {
+		case RESET_KIND_INIT:
+			tg3_ape_write32(tp, TG3_APE_HOST_SEG_SIG,
+					APE_HOST_SEG_SIG_MAGIC);
+			tg3_ape_write32(tp, TG3_APE_HOST_SEG_LEN,
+					APE_HOST_SEG_LEN_MAGIC);
+			apedata = tg3_ape_read32(tp, TG3_APE_HOST_INIT_COUNT);
+			tg3_ape_write32(tp, TG3_APE_HOST_INIT_COUNT, ++apedata);
+			tg3_ape_write32(tp, TG3_APE_HOST_DRIVER_ID,
+					APE_HOST_DRIVER_ID_MAGIC);
+			tg3_ape_write32(tp, TG3_APE_HOST_BEHAVIOR,
+					APE_HOST_BEHAV_NO_PHYLOCK);
+
+			event = APE_EVENT_STATUS_STATE_START;
+			break;
+		case RESET_KIND_SHUTDOWN:
+			event = APE_EVENT_STATUS_STATE_UNLOAD;
+			break;
+		case RESET_KIND_SUSPEND:
+			event = APE_EVENT_STATUS_STATE_SUSPEND;
+			break;
+		default:
+			return;
+	}
+
+	event |= APE_EVENT_STATUS_DRIVER_EVNT | APE_EVENT_STATUS_STATE_CHNGE;
+
+	tg3_ape_send_event(tp, event);
+}
+
 /* tp->lock is held. */
 static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind)
 {
@@ -4753,6 +4905,10 @@ static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind)
 			break;
 		};
 	}
+
+	if (kind == RESET_KIND_INIT ||
+	    kind == RESET_KIND_SUSPEND)
+		tg3_ape_driver_state_change(tp, kind);
 }
 
 /* tp->lock is held. */
@@ -4774,6 +4930,9 @@ static void tg3_write_sig_post_reset(struct tg3 *tp, int kind)
 			break;
 		};
 	}
+
+	if (kind == RESET_KIND_SHUTDOWN)
+		tg3_ape_driver_state_change(tp, kind);
 }
 
 /* tp->lock is held. */
@@ -4864,6 +5023,10 @@ static void tg3_restore_pci_state(struct tg3 *tp)
 	if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 &&
 	    (tp->tg3_flags & TG3_FLAG_PCIX_MODE))
 		val |= PCISTATE_RETRY_SAME_DMA;
+	/* Allow reads and writes to the APE register and memory space. */
+	if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)
+		val |= PCISTATE_ALLOW_APE_CTLSPC_WR |
+		       PCISTATE_ALLOW_APE_SHMEM_WR;
 	pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, val);
 
 	pci_write_config_dword(tp->pdev, TG3PCI_COMMAND, tp->pci_cmd);
@@ -5092,7 +5255,8 @@ static int tg3_chip_reset(struct tg3 *tp)
 /* tp->lock is held. */
 static void tg3_stop_fw(struct tg3 *tp)
 {
-	if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) {
+	if ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) &&
+	   !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) {
 		u32 val;
 		int i;
 
@@ -6173,6 +6337,16 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 		tw32(TG3PCI_PCISTATE, val);
 	}
 
+	if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
+		/* Allow reads and writes to the
+		 * APE register and memory space.
+		 */
+		val = tr32(TG3PCI_PCISTATE);
+		val |= PCISTATE_ALLOW_APE_CTLSPC_WR |
+		       PCISTATE_ALLOW_APE_SHMEM_WR;
+		tw32(TG3PCI_PCISTATE, val);
+	}
+
 	if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5704_BX) {
 		/* Enable some hw fixes.  */
 		val = tr32(TG3PCI_MSI_DATA);
@@ -6780,6 +6954,10 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 		break;
 	};
 
+	/* Write our heartbeat update interval to APE. */
+	tg3_ape_write32(tp, TG3_APE_HOST_HEARTBEAT_INT_MS,
+			APE_HOST_HEARTBEAT_INT_DISABLE);
+
 	tg3_write_sig_post_reset(tp, RESET_KIND_INIT);
 
 	return 0;
@@ -10302,6 +10480,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
 			if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)
 				tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE;
 		}
+		if (nic_cfg & NIC_SRAM_DATA_CFG_APE_ENABLE)
+			tp->tg3_flags3 |= TG3_FLG3_ENABLE_APE;
 		if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES &&
 		    !(nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL))
 			tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
@@ -10334,7 +10514,8 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
 	 * firwmare access to the PHY hardware.
 	 */
 	err = 0;
-	if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) {
+	if ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) ||
+	    (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) {
 		hw_phy_id = hw_phy_id_masked = PHY_ID_INVALID;
 	} else {
 		/* Now read the physical PHY_ID from the chip and verify
@@ -10381,6 +10562,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
 	}
 
 	if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) &&
+	    !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) &&
 	    !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
 		u32 bmsr, adv_reg, tg3_ctrl, mask;
 
@@ -10972,6 +11154,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 	 */
 	tg3_get_eeprom_hw_cfg(tp);
 
+	if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
+		/* Allow reads and writes to the
+		 * APE register and memory space.
+		 */
+		pci_state_reg |= PCISTATE_ALLOW_APE_CTLSPC_WR |
+				 PCISTATE_ALLOW_APE_SHMEM_WR;
+		pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE,
+				       pci_state_reg);
+	}
+
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784)
 		tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT;
 
@@ -12165,13 +12357,35 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 
 	tg3_init_coal(tp);
 
+	if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
+		if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
+			printk(KERN_ERR PFX "Cannot find proper PCI device "
+			       "base address for APE, aborting.\n");
+			err = -ENODEV;
+			goto err_out_iounmap;
+		}
+
+		tg3reg_base = pci_resource_start(pdev, 2);
+		tg3reg_len = pci_resource_len(pdev, 2);
+
+		tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len);
+		if (tp->aperegs == 0UL) {
+			printk(KERN_ERR PFX "Cannot map APE registers, "
+			       "aborting.\n");
+			err = -ENOMEM;
+			goto err_out_iounmap;
+		}
+
+		tg3_ape_lock_init(tp);
+	}
+
 	pci_set_drvdata(pdev, dev);
 
 	err = register_netdev(dev);
 	if (err) {
 		printk(KERN_ERR PFX "Cannot register net device, "
 		       "aborting.\n");
-		goto err_out_iounmap;
+		goto err_out_apeunmap;
 	}
 
 	printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %s Ethernet ",
@@ -12204,6 +12418,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 
 	return 0;
 
+err_out_apeunmap:
+	if (tp->aperegs) {
+		iounmap(tp->aperegs);
+		tp->aperegs = NULL;
+	}
+
 err_out_iounmap:
 	if (tp->regs) {
 		iounmap(tp->regs);
@@ -12231,6 +12451,10 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
 
 		flush_scheduled_work();
 		unregister_netdev(dev);
+		if (tp->aperegs) {
+			iounmap(tp->aperegs);
+			tp->aperegs = NULL;
+		}
 		if (tp->regs) {
 			iounmap(tp->regs);
 			tp->regs = NULL;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 88d08f3..632c2f0 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -192,6 +192,8 @@
 #define  PCISTATE_ROM_RETRY_ENABLE	 0x00000040
 #define  PCISTATE_FLAT_VIEW		 0x00000100
 #define  PCISTATE_RETRY_SAME_DMA	 0x00002000
+#define  PCISTATE_ALLOW_APE_CTLSPC_WR	 0x00010000
+#define  PCISTATE_ALLOW_APE_SHMEM_WR	 0x00020000
 #define TG3PCI_CLOCK_CTRL		0x00000074
 #define  CLOCK_CTRL_CORECLK_DISABLE	 0x00000200
 #define  CLOCK_CTRL_RXCLK_DISABLE	 0x00000400
@@ -1560,6 +1562,7 @@
 #define  NIC_SRAM_DATA_CFG_MINI_PCI		 0x00001000
 #define  NIC_SRAM_DATA_CFG_FIBER_WOL		 0x00004000
 #define  NIC_SRAM_DATA_CFG_NO_GPIO2		 0x00100000
+#define  NIC_SRAM_DATA_CFG_APE_ENABLE		 0x00200000
 
 #define NIC_SRAM_DATA_VER			0x00000b5c
 #define  NIC_SRAM_DATA_VER_SHIFT		 16
@@ -1688,6 +1691,47 @@
 #define MII_TG3_TEST1_TRIM_EN		0x0010
 #define MII_TG3_TEST1_CRC_EN		0x8000
 
+/* APE registers.  Accessible through BAR1 */
+#define TG3_APE_EVENT			0x000c
+#define  APE_EVENT_1			 0x00000001
+#define TG3_APE_LOCK_REQ		0x002c
+#define  APE_LOCK_REQ_DRIVER		 0x00001000
+#define TG3_APE_LOCK_GRANT		0x004c
+#define  APE_LOCK_GRANT_DRIVER		 0x00001000
+#define TG3_APE_SEG_SIG			0x4000
+#define  APE_SEG_SIG_MAGIC		 0x41504521
+
+/* APE shared memory.  Accessible through BAR1 */
+#define TG3_APE_FW_STATUS		0x400c
+#define  APE_FW_STATUS_READY		 0x00000100
+#define TG3_APE_HOST_SEG_SIG		0x4200
+#define  APE_HOST_SEG_SIG_MAGIC		 0x484f5354
+#define TG3_APE_HOST_SEG_LEN		0x4204
+#define  APE_HOST_SEG_LEN_MAGIC		 0x0000001c
+#define TG3_APE_HOST_INIT_COUNT		0x4208
+#define TG3_APE_HOST_DRIVER_ID		0x420c
+#define  APE_HOST_DRIVER_ID_MAGIC	 0xf0035100
+#define TG3_APE_HOST_BEHAVIOR		0x4210
+#define  APE_HOST_BEHAV_NO_PHYLOCK	 0x00000001
+#define TG3_APE_HOST_HEARTBEAT_INT_MS	0x4214
+#define  APE_HOST_HEARTBEAT_INT_DISABLE	 0
+#define  APE_HOST_HEARTBEAT_INT_5SEC	 5000
+#define TG3_APE_HOST_HEARTBEAT_COUNT	0x4218
+
+#define TG3_APE_EVENT_STATUS		0x4300
+
+#define  APE_EVENT_STATUS_DRIVER_EVNT	 0x00000010
+#define  APE_EVENT_STATUS_STATE_CHNGE	 0x00000500
+#define  APE_EVENT_STATUS_STATE_START	 0x00010000
+#define  APE_EVENT_STATUS_STATE_UNLOAD	 0x00020000
+#define  APE_EVENT_STATUS_STATE_WOL	 0x00030000
+#define  APE_EVENT_STATUS_STATE_SUSPEND	 0x00040000
+#define  APE_EVENT_STATUS_EVENT_PENDING	 0x80000000
+
+/* APE convenience enumerations. */
+#define TG3_APE_LOCK_MEM                4
+
+
 /* There are two ways to manage the TX descriptors on the tigon3.
  * Either the descriptors are in host DMA'able memory, or they
  * exist only in the cards on-chip SRAM.  All 16 send bds are under
@@ -2163,6 +2207,7 @@ struct tg3 {
 	void				(*write32_mbox) (struct tg3 *, u32,
 							 u32);
 	void __iomem			*regs;
+	void __iomem			*aperegs;
 	struct net_device		*dev;
 	struct pci_dev			*pdev;
 
@@ -2290,6 +2335,7 @@ struct tg3 {
 #define TG3_FLG2_PHY_ADJUST_TRIM	0x80000000
 	u32				tg3_flags3;
 #define TG3_FLG3_NO_NVRAM_ADDR_TRANS	0x00000001
+#define TG3_FLG3_ENABLE_APE		0x00000002
 
 	struct timer_list		timer;
 	u16				timer_counter;



^ permalink raw reply related

* [PATCH 1/5] tg3: Add new 5761 NVRAM decode routines
From: Matt Carlson @ 2007-10-11  0:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, andy, Michael Chan

This patch adds a new 5761-specific NVRAM strapping decode routine.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 1e0c9e0..3200c9c 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -9581,6 +9581,81 @@ static void __devinit tg3_get_5787_nvram_info(struct tg3 *tp)
 	}
 }
 
+static void __devinit tg3_get_5761_nvram_info(struct tg3 *tp)
+{
+	u32 nvcfg1, protect = 0;
+
+	nvcfg1 = tr32(NVRAM_CFG1);
+
+	/* NVRAM protection for TPM */
+	if (nvcfg1 & (1 << 27)) {
+		tp->tg3_flags2 |= TG3_FLG2_PROTECTED_NVRAM;
+		protect = 1;
+	}
+
+	nvcfg1 &= NVRAM_CFG1_5752VENDOR_MASK;
+	switch (nvcfg1) {
+		case FLASH_5761VENDOR_ATMEL_ADB021D:
+		case FLASH_5761VENDOR_ATMEL_ADB041D:
+		case FLASH_5761VENDOR_ATMEL_ADB081D:
+		case FLASH_5761VENDOR_ATMEL_ADB161D:
+		case FLASH_5761VENDOR_ATMEL_MDB021D:
+		case FLASH_5761VENDOR_ATMEL_MDB041D:
+		case FLASH_5761VENDOR_ATMEL_MDB081D:
+		case FLASH_5761VENDOR_ATMEL_MDB161D:
+			tp->nvram_jedecnum = JEDEC_ATMEL;
+			tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
+			tp->tg3_flags2 |= TG3_FLG2_FLASH;
+			tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS;
+			tp->nvram_pagesize = 256;
+			break;
+		case FLASH_5761VENDOR_ST_A_M45PE20:
+		case FLASH_5761VENDOR_ST_A_M45PE40:
+		case FLASH_5761VENDOR_ST_A_M45PE80:
+		case FLASH_5761VENDOR_ST_A_M45PE16:
+		case FLASH_5761VENDOR_ST_M_M45PE20:
+		case FLASH_5761VENDOR_ST_M_M45PE40:
+		case FLASH_5761VENDOR_ST_M_M45PE80:
+		case FLASH_5761VENDOR_ST_M_M45PE16:
+			tp->nvram_jedecnum = JEDEC_ST;
+			tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
+			tp->tg3_flags2 |= TG3_FLG2_FLASH;
+			tp->nvram_pagesize = 256;
+			break;
+	}
+
+	if (protect) {
+		tp->nvram_size = tr32(NVRAM_ADDR_LOCKOUT);
+	} else {
+		switch (nvcfg1) {
+			case FLASH_5761VENDOR_ATMEL_ADB161D:
+			case FLASH_5761VENDOR_ATMEL_MDB161D:
+			case FLASH_5761VENDOR_ST_A_M45PE16:
+			case FLASH_5761VENDOR_ST_M_M45PE16:
+				tp->nvram_size = 0x100000;
+				break;
+			case FLASH_5761VENDOR_ATMEL_ADB081D:
+			case FLASH_5761VENDOR_ATMEL_MDB081D:
+			case FLASH_5761VENDOR_ST_A_M45PE80:
+			case FLASH_5761VENDOR_ST_M_M45PE80:
+				tp->nvram_size = 0x80000;
+				break;
+			case FLASH_5761VENDOR_ATMEL_ADB041D:
+			case FLASH_5761VENDOR_ATMEL_MDB041D:
+			case FLASH_5761VENDOR_ST_A_M45PE40:
+			case FLASH_5761VENDOR_ST_M_M45PE40:
+				tp->nvram_size = 0x40000;
+				break;
+			case FLASH_5761VENDOR_ATMEL_ADB021D:
+			case FLASH_5761VENDOR_ATMEL_MDB021D:
+			case FLASH_5761VENDOR_ST_A_M45PE20:
+			case FLASH_5761VENDOR_ST_M_M45PE20:
+				tp->nvram_size = 0x20000;
+				break;
+		}
+	}
+}
+
 static void __devinit tg3_get_5906_nvram_info(struct tg3 *tp)
 {
 	tp->nvram_jedecnum = JEDEC_ATMEL;
@@ -9623,6 +9698,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
 		else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
 			 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784)
 			tg3_get_5787_nvram_info(tp);
+		else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
+			tg3_get_5761_nvram_info(tp);
 		else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
 			tg3_get_5906_nvram_info(tp);
 		else
@@ -9700,6 +9777,7 @@ static u32 tg3_nvram_phys_addr(struct tg3 *tp, u32 addr)
 	if ((tp->tg3_flags & TG3_FLAG_NVRAM) &&
 	    (tp->tg3_flags & TG3_FLAG_NVRAM_BUFFERED) &&
 	    (tp->tg3_flags2 & TG3_FLG2_FLASH) &&
+	   !(tp->tg3_flags3 & TG3_FLG3_NO_NVRAM_ADDR_TRANS) &&
 	    (tp->nvram_jedecnum == JEDEC_ATMEL))
 
 		addr = ((addr / tp->nvram_pagesize) <<
@@ -9714,6 +9792,7 @@ static u32 tg3_nvram_logical_addr(struct tg3 *tp, u32 addr)
 	if ((tp->tg3_flags & TG3_FLAG_NVRAM) &&
 	    (tp->tg3_flags & TG3_FLAG_NVRAM_BUFFERED) &&
 	    (tp->tg3_flags2 & TG3_FLG2_FLASH) &&
+	   !(tp->tg3_flags3 & TG3_FLG3_NO_NVRAM_ADDR_TRANS) &&
 	    (tp->nvram_jedecnum == JEDEC_ATMEL))
 
 		addr = ((addr >> ATMEL_AT45DB0X1B_PAGE_POS) *
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index d8e829f..88d08f3 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -124,6 +124,7 @@
 #define   ASIC_REV_5906			 0x0c
 #define   ASIC_REV_USE_PROD_ID_REG	 0x0f
 #define   ASIC_REV_5784			 0x5784
+#define   ASIC_REV_5761			 0x5761
 #define  GET_CHIP_REV(CHIP_REV_ID)	((CHIP_REV_ID) >> 8)
 #define   CHIPREV_5700_AX		 0x70
 #define   CHIPREV_5700_BX		 0x71
@@ -1463,6 +1464,22 @@
 #define  FLASH_5787VENDOR_ATMEL_EEPROM_376KHZ	 0x03000002
 #define  FLASH_5787VENDOR_MICRO_EEPROM_64KHZ	 0x03000000
 #define  FLASH_5787VENDOR_MICRO_EEPROM_376KHZ	 0x02000000
+#define  FLASH_5761VENDOR_ATMEL_MDB021D	 0x00800003
+#define  FLASH_5761VENDOR_ATMEL_MDB041D	 0x00800000
+#define  FLASH_5761VENDOR_ATMEL_MDB081D	 0x00800002
+#define  FLASH_5761VENDOR_ATMEL_MDB161D	 0x00800001
+#define  FLASH_5761VENDOR_ATMEL_ADB021D	 0x00000003
+#define  FLASH_5761VENDOR_ATMEL_ADB041D	 0x00000000
+#define  FLASH_5761VENDOR_ATMEL_ADB081D	 0x00000002
+#define  FLASH_5761VENDOR_ATMEL_ADB161D	 0x00000001
+#define  FLASH_5761VENDOR_ST_M_M45PE20	 0x02800001
+#define  FLASH_5761VENDOR_ST_M_M45PE40	 0x02800000
+#define  FLASH_5761VENDOR_ST_M_M45PE80	 0x02800002
+#define  FLASH_5761VENDOR_ST_M_M45PE16	 0x02800003
+#define  FLASH_5761VENDOR_ST_A_M45PE20	 0x02000001
+#define  FLASH_5761VENDOR_ST_A_M45PE40	 0x02000000
+#define  FLASH_5761VENDOR_ST_A_M45PE80	 0x02000002
+#define  FLASH_5761VENDOR_ST_A_M45PE16	 0x02000003
 #define  NVRAM_CFG1_5752PAGE_SIZE_MASK	 0x70000000
 #define  FLASH_5752PAGE_SIZE_256	 0x00000000
 #define  FLASH_5752PAGE_SIZE_512	 0x10000000
@@ -1493,9 +1510,11 @@
 #define  ACCESS_ENABLE			 0x00000001
 #define  ACCESS_WR_ENABLE		 0x00000002
 #define NVRAM_WRITE1			0x00007028
-/* 0x702c --> 0x7400 unused */
+/* 0x702c unused */
+
+#define NVRAM_ADDR_LOCKOUT		0x00007030
+/* 0x7034 --> 0x7c00 unused */
 
-/* 0x7400 --> 0x7c00 unused */
 #define PCIE_TRANSACTION_CFG		0x00007c04
 #define PCIE_TRANS_CFG_1SHOT_MSI	 0x20000000
 #define PCIE_TRANS_CFG_LOM		 0x00000020
@@ -2269,6 +2288,8 @@ struct tg3 {
 #define TG3_FLG2_PHY_JITTER_BUG		0x20000000
 #define TG3_FLG2_NO_FWARE_REPORTED	0x40000000
 #define TG3_FLG2_PHY_ADJUST_TRIM	0x80000000
+	u32				tg3_flags3;
+#define TG3_FLG3_NO_NVRAM_ADDR_TRANS	0x00000001
 
 	struct timer_list		timer;
 	u16				timer_counter;



^ permalink raw reply related

* [PATCH 5/5] tg3: Update version to 3.83
From: Matt Carlson @ 2007-10-11  0:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, andy, Michael Chan

Update to version 3.83.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 8967bc3..fa8f6c0 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
 
 #define DRV_MODULE_NAME		"tg3"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"3.82"
-#define DRV_MODULE_RELDATE	"October 5, 2007"
+#define DRV_MODULE_VERSION	"3.83"
+#define DRV_MODULE_RELDATE	"October 10, 2007"
 
 #define TG3_DEF_MAC_MODE	0
 #define TG3_DEF_RX_MODE		0



^ permalink raw reply related

* [PATCH 0/5] tg3: Add 5761 support
From: Matt Carlson @ 2007-10-11  0:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, andy, Michael Chan

The following patchset adds support for the 5761 device and enables WOL
by default if out-of-box WOL is enabled in the NVRAM.  The 5761 patches
were tested against preproduction hardware.


^ permalink raw reply

* [PATCH 3/5] tg3: Add 5761 support
From: Matt Carlson @ 2007-10-11  0:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, andy, Michael Chan

This patch adds rest of the miscellaneous code required to support the
5761.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 5b6c1b2..3af93b5 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -200,6 +200,8 @@ static struct pci_device_id tg3_pci_tbl[] = {
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5906M)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5784)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5764)},
+	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5761)},
+	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5761E)},
 	{PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)},
 	{PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)},
 	{PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)},
@@ -5087,7 +5089,8 @@ static int tg3_chip_reset(struct tg3 *tp)
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
-	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784)
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
 		tw32(GRC_FASTBOOT_PC, 0);
 
 	/*
@@ -6363,7 +6366,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 	if (err)
 		return err;
 
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784) {
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5761) {
 		/* This value is determined during the probe time DMA
 		 * engine test, tg3_test_dma.
 		 */
@@ -6769,7 +6773,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 	/* Enable host coalescing bug fix */
 	if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) ||
 	    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) ||
-	    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784))
+	    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784) ||
+	    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761))
 		val |= (1 << 29);
 
 	tw32_f(WDMAC_MODE, val);
@@ -6797,7 +6802,13 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 	tw32(RCVDCC_MODE, RCVDCC_MODE_ENABLE | RCVDCC_MODE_ATTN_ENABLE);
 	if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
 		tw32(MBFREE_MODE, MBFREE_MODE_ENABLE);
-	tw32(SNDDATAC_MODE, SNDDATAC_MODE_ENABLE);
+
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
+		tw32(SNDDATAC_MODE,
+		     SNDDATAC_MODE_ENABLE | SNDDATAC_MODE_CDELAY);
+	else
+		tw32(SNDDATAC_MODE, SNDDATAC_MODE_ENABLE);
+
 	tw32(SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE);
 	tw32(RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB);
 	tw32(RCVDBDI_MODE, RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ);
@@ -6824,7 +6835,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 	udelay(100);
 
 	tp->rx_mode = RX_MODE_ENABLE;
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
 		tp->rx_mode |= RX_MODE_IPV6_CSUM_ENABLE;
 
 	tw32_f(MAC_RX_MODE, tp->rx_mode);
@@ -8368,10 +8380,12 @@ static int tg3_set_tso(struct net_device *dev, u32 value)
 	}
 	if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) &&
 	    (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)) {
-		if (value)
+		if (value) {
 			dev->features |= NETIF_F_TSO6;
-		else
-			dev->features &= ~NETIF_F_TSO6;
+			if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
+				dev->features |= NETIF_F_TSO_ECN;
+		} else
+			dev->features &= ~(NETIF_F_TSO6 | NETIF_F_TSO_ECN);
 	}
 	return ethtool_op_set_tso(dev, value);
 }
@@ -8550,7 +8564,8 @@ static int tg3_set_tx_csum(struct net_device *dev, u32 data)
 
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
-	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784)
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
 		ethtool_op_set_tx_ipv6_csum(dev, data);
 	else
 		ethtool_op_set_tx_csum(dev, data);
@@ -9047,7 +9062,8 @@ static int tg3_test_memory(struct tg3 *tp)
 	if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) {
 		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
 		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
-		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784)
+		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
 			mem_tbl = mem_tbl_5755;
 		else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
 			mem_tbl = mem_tbl_5906;
@@ -9244,6 +9260,7 @@ out:
 static int tg3_test_loopback(struct tg3 *tp)
 {
 	int err = 0;
+	u32 cpmuctrl = 0;
 
 	if (!netif_running(tp->dev))
 		return TG3_LOOPBACK_FAILED;
@@ -9252,8 +9269,40 @@ static int tg3_test_loopback(struct tg3 *tp)
 	if (err)
 		return TG3_LOOPBACK_FAILED;
 
+	if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) {
+		int i;
+		u32 status;
+
+		tw32(TG3_CPMU_MUTEX_REQ, CPMU_MUTEX_REQ_DRIVER);
+
+		/* Wait for up to 40 microseconds to acquire lock. */
+		for (i = 0; i < 4; i++) {
+			status = tr32(TG3_CPMU_MUTEX_GNT);
+			if (status == CPMU_MUTEX_GNT_DRIVER)
+				break;
+			udelay(10);
+		}
+
+		if (status != CPMU_MUTEX_GNT_DRIVER)
+			return TG3_LOOPBACK_FAILED;
+
+		cpmuctrl = tr32(TG3_CPMU_CTRL);
+
+		/* Turn off power management based on link speed. */
+		tw32(TG3_CPMU_CTRL,
+		     cpmuctrl & ~CPMU_CTRL_LINK_SPEED_MODE);
+	}
+
 	if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK))
 		err |= TG3_MAC_LOOPBACK_FAILED;
+
+	if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) {
+		tw32(TG3_CPMU_CTRL, cpmuctrl);
+
+		/* Release the mutex */
+		tw32(TG3_CPMU_MUTEX_GNT, CPMU_MUTEX_GNT_DRIVER);
+	}
+
 	if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) {
 		if (tg3_run_loopback(tp, TG3_PHY_LOOPBACK))
 			err |= TG3_PHY_LOOPBACK_FAILED;
@@ -10192,6 +10241,7 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len,
 		    (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5755) &&
 		    (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5787) &&
 		    (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784) &&
+		    (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5761) &&
 		    (tp->nvram_jedecnum == JEDEC_ST) &&
 		    (nvram_cmd & NVRAM_CMD_FIRST)) {
 
@@ -10941,6 +10991,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 ||
 	    (tp->tg3_flags2 & TG3_FLG2_5780_CLASS))
 		tp->tg3_flags2 |= TG3_FLG2_5750_PLUS;
@@ -10961,6 +11012,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
 		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
 		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
 		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
 			tp->tg3_flags2 |= TG3_FLG2_HW_TSO_2;
 			tp->tg3_flags2 |= TG3_FLG2_1SHOT_MSI;
@@ -10979,6 +11031,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5755 &&
 	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5787 &&
 	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5761 &&
 	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)
 		tp->tg3_flags2 |= TG3_FLG2_JUMBO_CAPABLE;
 
@@ -11164,7 +11217,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 				       pci_state_reg);
 	}
 
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784)
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
 		tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT;
 
 	/* Set up tp->grc_local_ctrl before calling tg3_set_power_state().
@@ -11234,7 +11288,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 	if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) {
 		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
 		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
-		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784) {
+		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
 			if (tp->pdev->device != PCI_DEVICE_ID_TIGON3_5756 &&
 			    tp->pdev->device != PCI_DEVICE_ID_TIGON3_5722)
 				tp->tg3_flags2 |= TG3_FLG2_PHY_JITTER_BUG;
@@ -11378,6 +11433,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
 		tp->dev->hard_start_xmit = tg3_start_xmit;
 	else
@@ -12002,6 +12058,7 @@ static char * __devinit tg3_phy_string(struct tg3 *tp)
 	case PHY_ID_BCM5784:	return "5784";
 	case PHY_ID_BCM5756:	return "5722/5756";
 	case PHY_ID_BCM5906:	return "5906";
+	case PHY_ID_BCM5761:	return "5761";
 	case PHY_ID_BCM8002:	return "8002/serdes";
 	case 0:			return "serdes";
 	default:		return "unknown";
@@ -12304,6 +12361,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 		if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) &&
 		    (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906))
 			dev->features |= NETIF_F_TSO6;
+		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
+			dev->features |= NETIF_F_TSO_ECN;
 	}
 
 
@@ -12345,7 +12404,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 		dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
 		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
-		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784)
+		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
 			dev->features |= NETIF_F_IPV6_CSUM;
 
 		tp->tg3_flags |= TG3_FLAG_RX_CHECKSUMS;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 632c2f0..d1f5fa3 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -666,6 +666,7 @@
 #define SNDDATAC_MODE			0x00001000
 #define  SNDDATAC_MODE_RESET		 0x00000001
 #define  SNDDATAC_MODE_ENABLE		 0x00000002
+#define  SNDDATAC_MODE_CDELAY		 0x00000010
 /* 0x1004 --> 0x1400 unused */
 
 /* Send BD ring selector */
@@ -854,7 +855,14 @@
 #define TG3_CPMU_CTRL			0x00003600
 #define  CPMU_CTRL_LINK_IDLE_MODE	 0x00000200
 #define  CPMU_CTRL_LINK_AWARE_MODE	 0x00000400
-/* 0x3604 --> 0x3800 unused */
+#define  CPMU_CTRL_LINK_SPEED_MODE	 0x00004000
+/* 0x3604 --> 0x365c unused */
+
+#define TG3_CPMU_MUTEX_REQ		0x0000365c
+#define  CPMU_MUTEX_REQ_DRIVER		 0x00001000
+#define TG3_CPMU_MUTEX_GNT		0x00003660
+#define  CPMU_MUTEX_GNT_DRIVER		 0x00001000
+/* 0x3664 --> 0x3800 unused */
 
 /* Mbuf cluster free registers */
 #define MBFREE_MODE			0x00003800
@@ -2394,6 +2402,7 @@ struct tg3 {
 #define PHY_ID_BCM5787			0xbc050ce0
 #define PHY_ID_BCM5756			0xbc050ed0
 #define PHY_ID_BCM5784			0xbc050fa0
+#define PHY_ID_BCM5761			0xbc050fd0
 #define PHY_ID_BCM5906			0xdc00ac40
 #define PHY_ID_BCM8002			0x60010140
 #define PHY_ID_INVALID			0xffffffff
@@ -2423,7 +2432,8 @@ struct tg3 {
 	 (X) == PHY_ID_BCM5752 || (X) == PHY_ID_BCM5714 || \
 	 (X) == PHY_ID_BCM5780 || (X) == PHY_ID_BCM5787 || \
 	 (X) == PHY_ID_BCM5755 || (X) == PHY_ID_BCM5756 || \
-	 (X) == PHY_ID_BCM5906 || (X) == PHY_ID_BCM8002)
+	 (X) == PHY_ID_BCM5906 || (X) == PHY_ID_BCM5761 || \
+	 (X) == PHY_ID_BCM8002)
 
 	struct tg3_hw_stats		*hw_stats;
 	dma_addr_t			stats_mapping;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 6f5fa39..27363bf 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1950,6 +1950,8 @@
 #define PCI_DEVICE_ID_TIGON3_5751M	0x167d
 #define PCI_DEVICE_ID_TIGON3_5751F	0x167e
 #define PCI_DEVICE_ID_TIGON3_5787F	0x167f
+#define PCI_DEVICE_ID_TIGON3_5761E	0x1680
+#define PCI_DEVICE_ID_TIGON3_5761	0x1681
 #define PCI_DEVICE_ID_TIGON3_5764	0x1684
 #define PCI_DEVICE_ID_TIGON3_5787M	0x1693
 #define PCI_DEVICE_ID_TIGON3_5782	0x1696



^ permalink raw reply related

* Re: [PATCH 2/2] ip: local port range robustness
From: David Miller @ 2007-10-11  0:43 UTC (permalink / raw)
  To: shemminger; +Cc: netdev
In-Reply-To: <20071011000042.692751658@linux-foundation.org>

From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Wed, 10 Oct 2007 17:00:22 -0700

> Expansion of original idea from Denis V. Lunev <den@openvz.org>
> 
> Add robustness and locking to the local_port_range sysctl.
> 1. Enforce that low < high when setting.
> 2. Use seqlock to ensure atomic update.
> 
> The locking might seem like overkill, but there are
> cases where sysadmin might want to change value in the
> middle of a DoS attack.
> 
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

Applied.

^ permalink raw reply

* Re: [PATCH 1/2] SCTP: port randomization
From: David Miller @ 2007-10-11  0:43 UTC (permalink / raw)
  To: shemminger; +Cc: netdev
In-Reply-To: <20071011000042.624753621@linux-foundation.org>

From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Wed, 10 Oct 2007 17:00:21 -0700

> Add port randomization rather than a simple fixed rover
> for use with SCTP.  This makes it act similar to TCP, UDP, DCCP
> when allocating ports.
> 
> No longer need port_alloc_lock as well (suggestion by Brian Haley).
> 
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

Applied.

^ 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