Re: [patch 09/11] b44: fix eeprom endianess issue

2006-09-27 Thread Johannes Berg
On Tue, 2006-09-26 at 13:00 -0400, Jeff Garzik wrote:

 False.  It's already fixed endian.  It's just not the endian you like.

No, that's where you're wrong. It isn't fixed endian. It's CPU endian,
and the thing overlays a u8 array over CPU endian, hence it's not fixed.

johannes
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tc related lockdep warning.

2006-09-27 Thread Jarek Poplawski
On Tue, Sep 26, 2006 at 05:20:34PM -0400, Dave Jones wrote:
 On Tue, Sep 26, 2006 at 06:15:21PM +0200, Patrick McHardy wrote:
   Patrick McHardy wrote:
jamal wrote:

   Yes, that looks plausible. Can you try making those changes and see if
   the warning is gone?

   
I think this points to a bigger brokeness caused by the move of
dev-qdisc to RCU. It means destruction of filters and actions doesn't
necessarily happens in user-context and thus not protected by the rtnl
anymore.
   
   I looked into this and we indeed still have lots of problems from that
   broken RCU patch. Basically all locking (qdiscs, classifiers, actions,
   estimators) assumes that updates are only done in process context and
   thus read_lock doesn't need bottem half protection. Quite a few things
   also assume that updates only happen under the RTNL and don't need
   any further protection if not used during packet processing.
   
   Instead of fixing all this I suggest something like this (untested)
   patch instead. Since only the dev-qdisc pointer is protected by RCU,
   but enqueue and the qdisc tree are still protected by dev-qdisc_lock,
   we can perform destruction of the tree immediately and only do the
   final free in the rcu callback, as long as we make sure not to enqueue
   anything to a half-way destroyed qdisc.
 
 With this patch, I get no lockdep warnings, but the machine locks up 
 completely.
 I hooked up a serial console, and found this..
...

Sorry for my not humble and simplistic opinion, but I'd dare
to remind you are changing stable version and even without
this lockups this patch would look very serious. Why don't
try to restore not-rcu version of qdisc_destroy which looks
not lot to do.

Jarek P.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PKT_SCHED] cls_basic: Use unsigned int when generating handle

2006-09-27 Thread Nordlund Kim (Nokia-NET/Helsinki)


On Tue, 26 Sep 2006, ext Thomas Graf wrote:
 You're right, 0x8000 - 1 is already positive. Ignore the patch.

basic_change() won't work without this patch if we compile the
kernel with the GCC version in RHEL5...

gcc version 4.1.1 20060817 (Red Hat 4.1.1-18)

which optimizes the code like this (objdump -S inttest.c) ...

int main()
{
   0:   55  push   %ebp
   1:   89 e5   mov%esp,%ebp
  int i = 0x8000;
  do {
printf(KERN_ERR in do %d\n, i);
   3:   68 00 00 00 80  push   $0x8000
   8:   68 00 00 00 00  push   $0x0
   d:   e8 fc ff ff ff  call   e main+0xe
  } while (--i  0);
  printf(KERN_ERR out of do %d\n, i);
  12:   68 00 00 00 80  push   $0x8000
  17:   68 0a 00 00 00  push   $0xa
  1c:   e8 fc ff ff ff  call   1d main+0x1d
  return 0;
}
  21:   31 c0   xor%eax,%eax
  23:   c9  leave
  24:   c3  ret

# ./inttest
in do -2147483648
out of do -2147483648

gcc -m32 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs 
-fno-strict-aliasing -fno-common -Wstrict-prototypes -Wundef 
-Werror-implicit-function-declaration  -fno-stack-protector -Os 
-fno-omit-frame-pointer -fno-optimize-sibling-calls 
-fasynchronous-unwind-tables -g -pipe -msoft-float 
-fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts  
-mpreferred-stack-boundary=2  -march=i686 -mtune=generic 
-mtune=generic -mregparm=3 -ffreestanding 
-Wdeclaration-after-statement -Wno-pointer-sign   -c -o 
inttest.o inttest.c

So I would suggest to apply this patch to be compatible with the
GCC version in RHEL5, and simply to make code clearer (to the
intended idea).

--KimN


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PKT_SCHED] cls_basic: Use unsigned int when generating handle

2006-09-27 Thread Thomas Graf
* Nordlund Kim (Nokia-NET/Helsinki) [EMAIL PROTECTED] 2006-09-27 11:50
 basic_change() won't work without this patch if we compile the
 kernel with the GCC version in RHEL5...
 
 gcc version 4.1.1 20060817 (Red Hat 4.1.1-18)
 
 which optimizes the code like this (objdump -S inttest.c) ...
 
 int main()
 {
0:   55  push   %ebp
1:   89 e5   mov%esp,%ebp
   int i = 0x8000;
   do {
 printf(KERN_ERR in do %d\n, i);
3:   68 00 00 00 80  push   $0x8000
8:   68 00 00 00 00  push   $0x0
d:   e8 fc ff ff ff  call   e main+0xe
   } while (--i  0);
   printf(KERN_ERR out of do %d\n, i);
   12:   68 00 00 00 80  push   $0x8000
   17:   68 0a 00 00 00  push   $0xa
   1c:   e8 fc ff ff ff  call   1d main+0x1d
   return 0;
 }
   21:   31 c0   xor%eax,%eax
   23:   c9  leave
   24:   c3  ret
 
 # ./inttest
 in do -2147483648
 out of do -2147483648

Very interesting, naturally I tried the same after Patrick's
comment but gcc 20060901 produced code as expected, thus
staying in the loop. But now after specifying -Os gcc seems
to turn on some optimziation which produces the same code as
above.

I'm not sure I understand this optimization :-)

 So I would suggest to apply this patch to be compatible with the
 GCC version in RHEL5, and simply to make code clearer (to the
 intended idea).

Yes.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PKT_SCHED] cls_basic: Use unsigned int when generating handle

2006-09-27 Thread Patrick McHardy
Thomas Graf wrote:
 * Nordlund Kim (Nokia-NET/Helsinki) [EMAIL PROTECTED] 2006-09-27 11:50
 
So I would suggest to apply this patch to be compatible with the
GCC version in RHEL5, and simply to make code clearer (to the
intended idea).
 
 
 Yes.

I don't care much about this small change, but I think bugs
should be fixed where they originate. If RH's gcc miscompiles
this with -Os I wouldn't trust it anyway, and the easy way to
fix it seems to be to deactivate CONFIG_CC_OPTIMIZE_FOR_SIZE,
which even includes a big warning of broken compilers.
What about the similar code in u32 and cbq?

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tc related lockdep warning.

2006-09-27 Thread Patrick McHardy
Jarek Poplawski wrote:
 Sorry for my not humble and simplistic opinion, but I'd dare
 to remind you are changing stable version and even without
 this lockups this patch would look very serious. Why don't
 try to restore not-rcu version of qdisc_destroy which looks
 not lot to do.

I'm trying to restore the original rules, while keeping the
loopback optimization. That should be safe once I figure out
whats causing the crash.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PKT_SCHED] cls_basic: Use unsigned int when generating handle

2006-09-27 Thread Thomas Graf
* Patrick McHardy [EMAIL PROTECTED] 2006-09-27 11:44
 Thomas Graf wrote:
  * Nordlund Kim (Nokia-NET/Helsinki) [EMAIL PROTECTED] 2006-09-27 11:50
  
 So I would suggest to apply this patch to be compatible with the
 GCC version in RHEL5, and simply to make code clearer (to the
 intended idea).
  
  
  Yes.
 
 I don't care much about this small change, but I think bugs
 should be fixed where they originate.

Absolutely, I'm not even sure who's fault it really is. When
writing that code I must have expected gcc to correctly
underflow which might have been a wrong assumption.

I think it doesn't matter whether this is a gcc bug or not,
having this code part wort with gcc 4.1 is a good thing anyway.

 If RH's gcc miscompiles
 this with -Os I wouldn't trust it anyway, and the easy way to
 fix it seems to be to deactivate CONFIG_CC_OPTIMIZE_FOR_SIZE,
 which even includes a big warning of broken compilers.

gcc = 4.1 seems to produce this code with either -Os or -O2
so the range of affected useres might in fact be bigger.

 What about the similar code in u32 and cbq?

Not affected by this.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tc related lockdep warning.

2006-09-27 Thread Patrick McHardy
Dave Jones wrote:
 With this patch, I get no lockdep warnings, but the machine locks up 
 completely.
 I hooked up a serial console, and found this..
 
 
 u32 classifier
 Performance counters on
 input device check on 
 Actions configured 
 BUG: warning at net/sched/sch_htb.c:395/htb_safe_rb_erase()

I can't reproduce this, could you send me your tc script please?
Did you do anything to trigger this?
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] neighbour.c, pneigh_get_next() skips published entry

2006-09-27 Thread Herbert Xu
Philip Craig [EMAIL PROTECTED] wrote:
 
 It is faster to reproduce with a smaller block size.
 I haven't looked in detail to find the cause, but I did notice that
 neigh_seq_start() does a pos_minus_one adjustment, and neigh_seq_next()
 does not.

Yeah I can reproduce this now.  I think you actually sent me
the instructions before but I didn't get around to testing it.
Sorry about that.

I'll look into this.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PKT_SCHED] cls_basic: Use unsigned int when generating handle

2006-09-27 Thread Nordlund Kim (Nokia-NET/Helsinki)


On Wed, 27 Sep 2006, ext Thomas Graf wrote:

 gcc = 4.1 seems to produce this code with either -Os or -O2
 so the range of affected useres might in fact be bigger.

I believe gcc = 4.1 is just updating to match ISO/IEC 9899:1999: 
This piece of code crosses undefined behaviour as defined in

3.4.3
1 undefined behavior
behavior, upon use of a nonportable or erroneous program construct or
of erroneous data,
for which this International Standard imposes no requirements
2 NOTE Possible undefined behavior ranges from ignoring the situation
completely with unpredictable
results, to behaving during translation or program execution in a
documented manner characteristic of the
environment (with or without the issuance of a diagnostic message),
to terminating a translation or
execution (with the issuance of a diagnostic message).
3 EXAMPLE An example of undefined behavior is the behavior on integer
overflow.

For undefined types there is no overflow:

6.2.5 Types

9 The range of nonnegative values of a signed integer type is a
subrange of the
corresponding unsigned integer type, and the representation of the
same value in each
type is the same.31) A computation involving unsigned operands can
never overflow,
because a result that cannot be represented by the resulting unsigned
integer type is
reduced modulo the number that is one greater than the largest value
that can be
represented by the resulting type.

But for signed types it falls under this:

6.5 Expressions
5 If an exceptional condition occurs during the evaluation of an
expression (that is, if the
result is not mathematically defined or not in the range of
representable values for its
type), the behavior is undefined.

Already the initial assignment of 0x8000 to int falls under this:

6.3.1.3 Signed and unsigned integers
1 When a value with integer type is converted to another integer type
other than _Bool, if
the value can be represented by the new type, it is unchanged.
2 Otherwise, if the new type is unsigned, the value is converted by
repeatedly adding or
subtracting one more than the maximum value that can be represented
in the new type
until the value is in the range of the new type.49)
3 Otherwise, the new type is signed and the value cannot be
represented in it; either the
result is implementation-defined or an implementation-defined signal
is raised.

Of course it can be argued whether the gcc optimization is sane. But it
seems not to be wrong, and there is no justification for writing the code
to be unspecified.

--KimN



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tc related lockdep warning.

2006-09-27 Thread Patrick McHardy
Dave Jones wrote:
 With this patch, I get no lockdep warnings, but the machine locks up 
 completely.
 I hooked up a serial console, and found this..
 
 
 u32 classifier
 Performance counters on
 input device check on 
 Actions configured 
 BUG: warning at net/sched/sch_htb.c:395/htb_safe_rb_erase()
 
 Call Trace:
  [8026f79b] show_trace+0xae/0x336
  [8026fa38] dump_stack+0x15/0x17
  [8860a171] :sch_htb:htb_safe_rb_erase+0x3b/0x55

I found the reason for this, it was an unrelated bug. I've attached
the latest version of the locking fixes and the fix for the HTB bug.
Can you please try again?


[NET_SCHED]: HTB: fix incorrect use of RB_EMPTY_NODE

Fix incorrect use of RB_EMPTY_NODE in htb_safe_rb_erase, which makes it
skip nodes within the rbtree instead of nodes not in the tree, resulting
in crashes later on.

The root cause for this seems to be the very counter-intuitive behaviour
of the RB_EMPTY_NODE macro, which returns _false_ when the node is empty.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]

---
commit 9a0cd6d60280d88c38791844c87548d45cf6f2c2
tree fdf4f4a46fb088d957322006828af557b8ce594a
parent 7e4720201ad44ace85a443f41d668a62a737e7d0
author Patrick McHardy [EMAIL PROTECTED] Wed, 27 Sep 2006 13:27:24 +0200
committer Patrick McHardy [EMAIL PROTECTED] Wed, 27 Sep 2006 13:27:24 +0200

 net/sched/sch_htb.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index bb3ddd4..6c058e3 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -391,7 +391,7 @@ static inline void htb_add_class_to_row(
 /* If this triggers, it is a bug in this code, but it need not be fatal */
 static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root)
 {
-   if (RB_EMPTY_NODE(rb)) {
+   if (!RB_EMPTY_NODE(rb)) {
WARN_ON(1);
} else {
rb_erase(rb, root);

[NET_SCHED]: Fix fallout from dev-qdisc RCU change

The move of qdisc destruction to a rcu callback broke locking in the
entire qdisc layer by invalidating previously valid assumptions about
the context in which changes to the qdisc tree occur.

The two assumptions were:

- since changes only happen in process context, read_lock doesn't need
  bottem half protection. Now invalid since destruction of inner qdiscs,
  classifiers, actions and estimators happens in the RCU callback unless
  they're manually deleted, resulting in dead-locks when read_lock in
  process context is interrupted by write_lock_bh in bottem half context.

- since changes only happen under the RTNL, no additional locking is
  necessary for data not used during packet processing (f.e. u32_list).
  Again, since destruction now happens in the RCU callback, this assumption
  is not valid anymore, causing races while using this data, which can
  result in corruption or use-after-free.

Instead of fixing this by disabling bottem halfs everywhere and adding
new locks/refcounting, this patch makes these assumptions valid again by
moving destruction back to process context. Since only the dev-qdisc
pointer is protected by RCU, but -enqueue and the qdisc tree are still
protected by dev-qdisc_lock, destruction of the tree can be performed
immediately and only the final free needs to happen in the rcu callback
to make sure dev_queue_xmit doesn't access already freed memory.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]

---
commit fe5b95bfcde98ca2e32b4274c93889cdd1fbc040
tree 951a0d83d91b15dbe55a41366e0fe01966fec7ed
parent 9a0cd6d60280d88c38791844c87548d45cf6f2c2
author Patrick McHardy [EMAIL PROTECTED] Wed, 27 Sep 2006 13:57:18 +0200
committer Patrick McHardy [EMAIL PROTECTED] Wed, 27 Sep 2006 13:57:18 +0200

 net/core/dev.c  |   14 ++
 net/sched/cls_api.c |4 +--
 net/sched/sch_api.c |   16 ++-
 net/sched/sch_generic.c |   66 +++
 4 files changed, 39 insertions(+), 61 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 14de297..4d891be 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1480,14 +1480,16 @@ #endif
if (q-enqueue) {
/* Grab device queue */
spin_lock(dev-queue_lock);
+   q = dev-qdisc;
+   if (q-enqueue) {
+   rc = q-enqueue(skb, q);
+   qdisc_run(dev);
+   spin_unlock(dev-queue_lock);
 
-   rc = q-enqueue(skb, q);
-
-   qdisc_run(dev);
-
+   rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc;
+   goto out;
+   }
spin_unlock(dev-queue_lock);
-   rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc;
-   goto out;
}
 
/* The device has no queue. Common case for software devices:
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 7e14f14..37a1840 100644
--- a/net/sched/cls_api.c
+++ 

Re: softmac mtu

2006-09-27 Thread Jiri Benc
On Mon, 25 Sep 2006 16:01:32 -0400, John W. Linville wrote:
 On Mon, Sep 25, 2006 at 07:17:31PM +, Matthieu CASTET wrote:
  So why a special mtu handler is not implemented in 802.11 stack :
  - 802.11 stack doesn't support bigger packet
  - 802.11 stack doesn't support very bigger packet (with
  802.11 fragmentation)
  - 802.11 writers were lazy
 
 I suspect the latter...patches welcome! :-)

d80211 supports larger MTU.

 Jiri

-- 
Jiri Benc
SUSE Labs
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread David Acker

Stephen Hemminger wrote:

On Tue, 26 Sep 2006 17:55:34 -0400
Jeff Garzik [EMAIL PROTECTED] wrote:


Stephen Hemminger wrote:

The mii-tool utility seems to be abandoned and unmaintained?

Here is a version that does standard 1000baseT support.
http://developer.osdl.org/shemminger/prototypes/mii-tool.tar.bz2
Not really.  I would rather leave it as-is, and deprecate it in favor of 
ethtool.




It does make a handy debug tool when driver isn't doing MII correctly.



mii-tool supports some things that ethtool does not.  mii-tool -A lets 
you set the advertised speeds and can include a list of speeds.  The 
closest ethtool seems to have is ethtool -s but that seems to just set 
the advertised speed to a single value only.


We have instances where we want to limit the link of the ethernet port 
to no higher then 10 Mbps full duplex but also advertise support for 
half duplex.


With mii-tool we can do the command below and work with a half duplex 
hub and a full duplex switch.

mii-tool -A 10baseT-FD,10baseT-HD eth0

Meanwhile if I use ethtool like the command below I will not work with a 
half duplex only hub.

ethtool -s eth0 speed 10 duplex full autoneg on

Perhaps the speed part of ethtool -s should take a list of speeds like 
mii-tool does.


-Ack
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/1] atl1: New driver, Attansic L1 Gigabit Ethernet

2006-09-27 Thread Jay Cliburn
Apologies:  I neglected to cc netdev on the initial message.

Attansic L1 Gigabit Ethernet device driver.

Background:
Earlier this year I purchased an Asus M2V mainboard that contains 
an onboard Attansic L1 Gigabit Ethernet NIC.  The mainboard was 
delivered with an accompanying CD containing driver source code for 
the NIC.  Upon inspection, it was clear this source code was derived 
by Attansic in large part from the Intel e1000 driver.  Following 
Stephen Hemminger's advice provided in netdev email, I contacted 
Attansic and requested clarification on some confusing licensing
language and for permission to submit this driver for addition 
to the kernel.  To my surprise, Attansic consented[1].

Disclaimer:
I am not a netdev developer, and because of that there is a great deal 
about the inner workings of the driver I'm submitting here that I 
don't understand.  I've tried to make the driver look structurally 
like others found in drivers/net, but some things I just left alone 
in the interest of not breaking things.

I have combined the Attansic NIC driver's multiple C source files and
header files into a single C file and a single header file, and have
attempted to apply kernel coding standards to the files.  It compiles
cleanly and functions properly in 2.6.18-git7 under very rudimentary
IPv4, IPv6, and ethtool testing.  The patches were generated against 
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
pulled 20060926.

Please accept this driver for consideration for inclusion in the
kernel.  Hopefully it will simplify the computing experience of
other Linux users of mainboards that contain this device.

Best regards,
Jay Cliburn
[EMAIL PROTECTED]

[1] Permission message from Attansic:

X-Account-Key: account2
X-UIDL: [EMAIL PROTECTED]
X-Mozilla-Status: 0001
X-Mozilla-Status2: 
Return-Path: [EMAIL PROTECTED]
Received: from ibm06aec.bellsouth.net ([59.120.59.148])
  by imf04aec.mail.bellsouth.net with ESMTP
  id [EMAIL PROTECTED]
  for [EMAIL PROTECTED]; Sun, 3 Sep 2006 21:13:36 -0400
Received: from twhqmg01.attansic.com ([59.120.59.148])
  by ibm06aec.bellsouth.net with ESMTP
  id [EMAIL PROTECTED]
  for [EMAIL PROTECTED]; Sun, 3 Sep 2006 21:13:36 -0400
Received: from cnshm01.attansic.com (cnshm01.attansic.com [192.168.39.11])
by twhqmg01.attansic.com (Postfix) with ESMTP id 73D3B282BF1
for [EMAIL PROTECTED]; Mon,  4 Sep 2006 09:13:00 +0800 (CST)
Received: from xhuang (xxsun.shanghai.attansic.com [192.168.37.13] (may be 
forged))
(authenticated bits=0)
by cnshm01.attansic.com (8.12.11.20060308/8.12.11) with ESMTP id 
k841ChxD015007
for [EMAIL PROTECTED]; Mon, 4 Sep 2006 09:12:57 +0800
Message-Id: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
From: Huang Xiong [EMAIL PROTECTED]
To: 'Jay Cliburn' [EMAIL PROTECTED]
Subject: 
=?gb2312?B?tPC4tDogW1NFQ09ORCBSRVFVRVNUXSBSZTogR1BMIGFuZCBhdGwxIGRyaXY=?=
=?gb2312?B?ZXI=?=
Date: Mon, 4 Sep 2006 09:12:56 +0800
Organization: attansic
MIME-Version: 1.0
Content-Type: text/plain;
charset=gb2312
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Office Outlook, Build 11.0.6353
In-Reply-To: [EMAIL PROTECTED]
Thread-Index: AcbN+qA1xcZCiSkTSe+Fb93lmuAM5ABxHdRA
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-attansic.com-MailScanner-Information: Please contact the ISP for more 
information
X-attansic.com-MailScanner: Found to be clean
X-attansic.com-MailScanner-From: [EMAIL PROTECTED]
X-Spam-Status: No

Thank you!
You can change MODULE_LICENSE() as you want.


BR
Xiong

 -=D3=CA=BC=FE=D4=AD=BC=FE-
 =B7=A2=BC=FE=C8=CB: Jay Cliburn [mailto:[EMAIL PROTECTED]
 =B7=A2=CB=CD=CA=B1=BC=E4: 2006=C4=EA9=D4=C22=C8=D5 3:12
 =CA=D5=BC=FE=C8=CB: [EMAIL PROTECTED]
 =B3=AD=CB=CD: Jay Cliburn
 =D6=F7=CC=E2: [SECOND REQUEST] Re: GPL and atl1 driver

 The driver referenced below was created in large part from an existing
 Intel GPL network device driver.  As such, it is therefore a derived
 work from a GPL source program.

 Please modify the copyright and MODULE_LICENSE declarations in the
 source code so we can incorporate the driver into the Linux source tree.

 Thank you very much for your attention in this matter.

 Best regards,
 Jay Cliburn

 Jay Cliburn wrote:
 Hello Xiong,

 I'm interested in having the Attansic L1 Gigabit Ethernet driver added
 to the Linux kernel.  However, the MODULE_LICENSE() declaration in
 at_main.c does not specify GPL, but instead specifies ATTANSIC. Thus
 even though the LICENSE file declares the driver to be GPL, the
 MODULE_LICENSE declarations embedded in the source code do not.

 May I please request that Attansic release the driver under GPL so we
 can add it to the kernel?
 
 Thank you very much.
 
 Respectfully,
 Jay Cliburn

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo 

Re: softmac mtu

2006-09-27 Thread castet . matthieu
Hi,

Selon Jiri Benc [EMAIL PROTECTED]:

 On Mon, 25 Sep 2006 16:01:32 -0400, John W. Linville wrote:
  On Mon, Sep 25, 2006 at 07:17:31PM +, Matthieu CASTET wrote:
   So why a special mtu handler is not implemented in 802.11 stack :
   - 802.11 stack doesn't support bigger packet
   - 802.11 stack doesn't support very bigger packet (with
   802.11 fragmentation)
   - 802.11 writers were lazy
 
  I suspect the latter...patches welcome! :-)

 d80211 supports larger MTU.

I have a patch for 802.11 linux stack.
It works for mtu like 2000 but if the packet is fragmented (with mtu = 3000 for
example) my usb dongle (zd1211) crash (doesn't work anymore until I replug it).
I need to investigate a bit.

Also I wonder what should be the max mtu.

Matthieu
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Advertise PPPoE MTU / avoid memory leak.

2006-09-27 Thread Michal Ostrowski
This is not currently supported.

Looking at the RFC, this is an issue that must be solved in the pppoe
plugin that performs the PPPoE negotiation/discovery.  The kernel code
that runs the regular session traffic should be able to adjust (with
minimal or no changes) as it does not depend on a hardcoded MTU.



-- 
Michal Ostrowski [EMAIL PROTECTED]

On Tue, 2006-09-26 at 09:32 +0300, Pekka Savola wrote:
 Speaking of PPPoE and MTU, does Linux support recently-published RFC 
 4638:
 
Accommodating a Maximum Transit Unit/Maximum Receive Unit (MTU/MRU)
 Greater Than 1492 in the
   Point-to-Point Protocol over Ethernet (PPPoE)
 
 On Sat, 23 Sep 2006, [EMAIL PROTECTED] wrote:
  PPPoE must advertise the underlying device's MTU via the ppp channel
  descriptor structure, as multilink functionality depends on it.
 
  __pppoe_xmit must free any skb it allocates if there is an error
  submitting the skb downstream.
 
  Signed-off-by: Michal Ostrowski [EMAIL PROTECTED]
  ---
  drivers/net/pppoe.c |5 -
  1 files changed, 4 insertions(+), 1 deletions(-)
 
  diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
  index 475dc93..b4dc516 100644
  --- a/drivers/net/pppoe.c
  +++ b/drivers/net/pppoe.c
  @@ -600,6 +600,7 @@ static int pppoe_connect(struct socket *
  po-chan.hdrlen = (sizeof(struct pppoe_hdr) +
 dev-hard_header_len);
 
  +   po-chan.mtu = dev-mtu - sizeof(struct pppoe_hdr);
  po-chan.private = sk;
  po-chan.ops = pppoe_chan_ops;
 
  @@ -831,7 +832,7 @@ static int __pppoe_xmit(struct sock *sk,
  struct pppoe_hdr *ph;
  int headroom = skb_headroom(skb);
  int data_len = skb-len;
  -   struct sk_buff *skb2;
  +   struct sk_buff *skb2 = NULL;
 
  if (sock_flag(sk, SOCK_DEAD) || !(sk-sk_state  PPPOX_CONNECTED))
  goto abort;
  @@ -887,6 +888,8 @@ static int __pppoe_xmit(struct sock *sk,
  return 1;
 
  abort:
  +   if (skb2)
  +   kfree_skb(skb2);
  return 0;
  }
 
 
 

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tc related lockdep warning.

2006-09-27 Thread Ismail Donmez
27 Eyl 2006 Çar 13:14 tarihinde şunları yazmıştınız:
 Dave Jones wrote:
  With this patch, I get no lockdep warnings, but the machine locks up
  completely. I hooked up a serial console, and found this..
 
 
  u32 classifier
  Performance counters on
  input device check on
  Actions configured
  BUG: warning at net/sched/sch_htb.c:395/htb_safe_rb_erase()

 I can't reproduce this, could you send me your tc script please?
 Did you do anything to trigger this?

Using sabishape[1] with latest linux-2.6 git tree I can reproduce this. Just 
running sabishape -i eth1 -u 50 -d 240 freezes whole box.

[1] http://www.sabi.co.uk/Proj/Small/sabishape-2.1.tar.gz

Regards,
ismail

-- 
They that can give up essential liberty to obtain a little temporary safety 
deserve neither liberty nor safety.
-- Benjamin Franklin
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread Auke Kok

David Acker wrote:

Stephen Hemminger wrote:

On Tue, 26 Sep 2006 17:55:34 -0400
Jeff Garzik [EMAIL PROTECTED] wrote:


Stephen Hemminger wrote:

The mii-tool utility seems to be abandoned and unmaintained?

Here is a version that does standard 1000baseT support.
http://developer.osdl.org/shemminger/prototypes/mii-tool.tar.bz2
Not really.  I would rather leave it as-is, and deprecate it in favor 
of ethtool.




It does make a handy debug tool when driver isn't doing MII correctly.



mii-tool supports some things that ethtool does not.  mii-tool -A lets 
you set the advertised speeds and can include a list of speeds.  The 
closest ethtool seems to have is ethtool -s but that seems to just set 
the advertised speed to a single value only.


We sent a patch for this to Jeff recently that allows setting of 'arbitrary' 
speeds. Unfortunately the interface is rather crude but it works (for e1000, 
and possibly all other nics) to set any combination of advertised speeds.


e.g. `ethtool -s eth0 advertise 0x0f` advertises all non-gigabit speeds

I haven't seen the patch merged yet upstream though.

Cheers,

Auke



We have instances where we want to limit the link of the ethernet port 
to no higher then 10 Mbps full duplex but also advertise support for 
half duplex.


With mii-tool we can do the command below and work with a half duplex 
hub and a full duplex switch.

mii-tool -A 10baseT-FD,10baseT-HD eth0

Meanwhile if I use ethtool like the command below I will not work with a 
half duplex only hub.

ethtool -s eth0 speed 10 duplex full autoneg on

Perhaps the speed part of ethtool -s should take a list of speeds like 
mii-tool does.


-Ack

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: simplify microsecond rtt sampling

2006-09-27 Thread John Heffner
Okay, this patch is junk (never trust compile-tested code).  Will send 
something better soon.


  -John


John Heffner wrote:

About commit 2d2abbab63f6726a147ae61ada39bf2c9ee0db9a:

It looks like this patch bypassed the enforcement of Karn's algorithm in 
tcp_ack_no_tstamp() for the purposes of usec RTT sampling used by 
congestion control modules.  This will give them bad RTT data when there 
are retransmits.  I haven't actually observed this, but it seems like it 
would be the case. ;)  Please correct me if I'm wrong.


Here's a patch that should be a fix.



Signed-off-by: John Heffner [EMAIL PROTECTED]




diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 159fa3f..725c868 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2306,8 +2306,6 @@ static int tcp_clean_rtx_queue(struct so
seq_rtt = -1;
} else if (seq_rtt  0) {
seq_rtt = now - scb-when;
-   if (rtt_sample)
-   (*rtt_sample)(sk, tcp_usrtt(skb));
}
if (sacked  TCPCB_SACKED_ACKED)
tp-sacked_out -= tcp_skb_pcount(skb);
@@ -2320,8 +2318,6 @@ static int tcp_clean_rtx_queue(struct so
}
} else if (seq_rtt  0) {
seq_rtt = now - scb-when;
-   if (rtt_sample)
-   (*rtt_sample)(sk, tcp_usrtt(skb));
}
tcp_dec_pcount_approx(tp-fackets_out, skb);
tcp_packets_out_dec(tp, skb);
@@ -2333,6 +2329,8 @@ static int tcp_clean_rtx_queue(struct so
if (ackedFLAG_ACKED) {
tcp_ack_update_rtt(sk, acked, seq_rtt);
tcp_ack_packets_out(sk, tp);
+   if (rtt_sample  !(acked  FLAG_RETRANS_DATA_ACKED))
+   (*rtt_sample)(sk, tcp_usrtt(skb));
 
 		if (icsk-icsk_ca_ops-pkts_acked)

icsk-icsk_ca_ops-pkts_acked(sk, pkts_acked);


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.18 0/9] NetXen: 1G/10G Ethernet Driver

2006-09-27 Thread Amit S. Kale

Hi All,

We have incorporated feedbacks which we received since last post. I'll be 
sending updated patchset wrt 2.6.18 in subsequent emails.


Thanks,
-Amit

Signed-off-by: Amit S. Kale [EMAIL PROTECTED]

 MAINTAINERS  |7
 drivers/net/Kconfig  |5
 drivers/net/Makefile |1
 drivers/net/netxen/Makefile  |   35
 drivers/net/netxen/netxen_nic.h  |  910 
 drivers/net/netxen/netxen_nic_ethtool.c  |  715 +++
 drivers/net/netxen/netxen_nic_hdr.h  |  618 
 drivers/net/netxen/netxen_nic_hw.c   |  936 +
 drivers/net/netxen/netxen_nic_hw.h   |  480 +
 drivers/net/netxen/netxen_nic_init.c | 1143 +++
 drivers/net/netxen/netxen_nic_ioctl.h|   75 ++
 drivers/net/netxen/netxen_nic_isr.c  |  221 +
 drivers/net/netxen/netxen_nic_main.c | 1116 ++
 drivers/net/netxen/netxen_nic_niu.c  |  800 +
 drivers/net/netxen/netxen_nic_phan_reg.h |  195 +
 15 files changed, 7257 insertions(+)
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] softmac: Fix WX and association related races

2006-09-27 Thread Michael Buesch
This fixes some race conditions in the WirelessExtension
handling and association handling code.

Signed-off-by: Michael Buesch [EMAIL PROTECTED]

---

Hi John,

Please apply this fo wireless-2.6 and push it with your
next push of bugfixes.
There are other theoretical raceconditions possible in softmac
related to scanning and assoc code. But I don't really want to fix
these, as I think they:
1) are not triggerable in real world conditions.
2) are not exploitable to do some bad attacks, etc...
3) require _huge_ changes to softmac, and I don't really
   want to spend more effort into softmac any longer.
This patch fixes some real-world exploitable bugs, so better
fix them to have working wireless until d80211 is ready for
prime-time.

btw: d80211 might have similiar race conditions like this.

Larry, once this patch settled a little bit and enough people
tested it, you might want to try pushing it into -stable (although
it's big...)


Index: wireless-2.6/include/net/ieee80211softmac.h
===
--- wireless-2.6.orig/include/net/ieee80211softmac.h2006-09-25 
17:02:08.0 +0200
+++ wireless-2.6/include/net/ieee80211softmac.h 2006-09-27 16:39:17.0 
+0200
@@ -63,13 +63,11 @@ struct ieee80211softmac_wpa {
 
 /*
  * Information about association
- *
- * Do we need a lock for this?
- * We only ever use this structure inlined
- * into our global struct. I've used its lock,
- * but maybe we need a local one here?
  */
 struct ieee80211softmac_assoc_info {
+
+   struct mutex mutex;
+
/*
 * This is the requested ESSID. It is written
 * only by the WX handlers.
@@ -99,12 +97,13 @@ struct ieee80211softmac_assoc_info {
 *
 * bssfixed is used for SIOCSIWAP.
 */
-   u8 static_essid:1,
-  short_preamble_available:1,
-  associating:1,
-  assoc_wait:1,
-  bssvalid:1,
-  bssfixed:1;
+   u8 static_essid;
+   u8 short_preamble_available;
+   u8 associating;
+   u8 associated;
+   u8 assoc_wait;
+   u8 bssvalid;
+   u8 bssfixed;
 
/* Scan retries remaining */
int scan_retry;
@@ -229,12 +228,10 @@ struct ieee80211softmac_device {
/* private stuff follows */
/* this lock protects this structure */
spinlock_t lock;
-   
-   /* couple of flags */
-   u8 scanning:1, /* protects scanning from being done multiple times at 
once */
-  associated:1,
-  running:1;
-   
+
+   u8 running; /* SoftMAC started? */
+   u8 scanning;
+
struct ieee80211softmac_scaninfo *scaninfo;
struct ieee80211softmac_assoc_info associnfo;
struct ieee80211softmac_bss_info bssinfo;
@@ -250,7 +247,7 @@ struct ieee80211softmac_device {
 
/* we need to keep a list of network structs we copied */
struct list_head network_list;
-   
+
/* This must be the last item so that it points to the data
 * allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -295,7 +292,7 @@ static inline u8 ieee80211softmac_sugges
 {
struct ieee80211softmac_txrates *txrates = mac-txrates;
 
-   if (!mac-associated)
+   if (!mac-associnfo.associated)
return txrates-mgt_mcast_rate;
 
/* We are associated, sending unicast frame */
Index: wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c
===
--- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_assoc.c
2006-09-17 15:21:53.0 +0200
+++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c 2006-09-27 
17:10:08.0 +0200
@@ -48,7 +48,7 @@ ieee80211softmac_assoc(struct ieee80211s
dprintk(KERN_INFO PFX sent association request!\n);
 
spin_lock_irqsave(mac-lock, flags);
-   mac-associated = 0; /* just to make sure */
+   mac-associnfo.associated = 0; /* just to make sure */
 
/* Set a timer for timeout */
/* FIXME: make timeout configurable */
@@ -62,24 +62,22 @@ ieee80211softmac_assoc_timeout(void *d)
 {
struct ieee80211softmac_device *mac = (struct ieee80211softmac_device 
*)d;
struct ieee80211softmac_network *n;
-   unsigned long flags;
 
-   spin_lock_irqsave(mac-lock, flags);
+   mutex_lock(mac-associnfo.mutex);
/* we might race against ieee80211softmac_handle_assoc_response,
 * so make sure only one of us does something */
-   if (!mac-associnfo.associating) {
-   spin_unlock_irqrestore(mac-lock, flags);
-   return;
-   }
+   if (!mac-associnfo.associating)
+   goto out;
mac-associnfo.associating = 0;
mac-associnfo.bssvalid = 0;
-   mac-associated = 0;
+   mac-associnfo.associated = 0;
 
n = ieee80211softmac_get_network_by_bssid_locked(mac, 
mac-associnfo.bssid);
-   

[PATCH 2.6.18 1/9] NetXen: Makefile and driver main file

2006-09-27 Thread Amit S. Kale

diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/MAINTAINERS linux-2.6.18/MAINTAINERS
--- linux-2.6.18.orig/MAINTAINERS   2006-09-25 02:28:24.0 -0700
+++ linux-2.6.18/MAINTAINERS2006-09-25 05:02:37.0 -0700
@@ -2060,6 +2060,13 @@ L:   netdev@vger.kernel.org
 T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
 S: Maintained

+NETXEN (1/10) GbE SUPPORT
+P: Amit S. Kale
+M: [EMAIL PROTECTED]
+L: netdev@vger.kernel.org
+W: http://www.netxen.com
+S: Supported
+
 IPVS
 P: Wensong Zhang
 M: [EMAIL PROTECTED]
diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/Kconfig linux-2.6.18/drivers/net/Kconfig
--- linux-2.6.18.orig/drivers/net/Kconfig   2006-09-25 02:28:22.0 
-0700
+++ linux-2.6.18/drivers/net/Kconfig2006-09-25 05:03:43.0 -0700
@@ -2399,6 +2399,11 @@ config MYRI10GE
  file:Documentation/networking/net-modules.txt.  The module
  will be called myri10ge.

+config NETXEN_NIC
+   tristate NetXen Multi port (1/10) Gigabit Ethernet NIC
+   help
+ This enables the support for NetXen's Gigabit Ethernet card.
+
 endmenu

 source drivers/net/tokenring/Kconfig
diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/Makefile linux-2.6.18/drivers/net/Makefile
--- linux-2.6.18.orig/drivers/net/Makefile  2006-09-25 02:28:22.0 
-0700
+++ linux-2.6.18/drivers/net/Makefile   2006-09-25 05:04:07.0 -0700
@@ -219,3 +219,4 @@ obj-$(CONFIG_NETCONSOLE) += netconsole.o

 obj-$(CONFIG_FS_ENET) += fs_enet/

+obj-$(CONFIG_NETXEN_NIC) += netxen/
diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/Makefile 
linux-2.6.18/drivers/net/netxen/Makefile
--- linux-2.6.18.orig/drivers/net/netxen/Makefile   1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/Makefile2006-09-25 05:04:07.0 
-0700
@@ -0,0 +1,35 @@
+# Copyright (C) 2003 - 2006 NetXen, Inc.
+# All rights reserved.
+# 
+# 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., 59 Temple Place - Suite 330, Boston,
+# MA  02111-1307, USA.
+# 
+# The full GNU General Public License is included in this distribution

+# in the file called LICENSE.
+# 
+# Contact Information:

+#[EMAIL PROTECTED]
+# NetXen,
+# 3965 Freedom Circle, Fourth floor,
+# Santa Clara, CA 95054
+#
+# Makefile for the NetXen NIC Driver
+#
+
+
+obj-$(CONFIG_NETXEN_NIC) := netxen_nic.o
+
+netxen_nic-y := netxen_nic_hw.o netxen_nic_main.o netxen_nic_init.o \
+   netxen_nic_isr.o netxen_nic_ethtool.o netxen_nic_niu.o
diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/netxen_nic_main.c 
linux-2.6.18/drivers/net/netxen/netxen_nic_main.c
--- linux-2.6.18.orig/drivers/net/netxen/netxen_nic_main.c  1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/netxen_nic_main.c   2006-09-25 
05:04:07.0 -0700
@@ -0,0 +1,1116 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * 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., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ *
+ *
+ *  Main source file for NetXen NIC Driver on Linux
+ *
+ */
+
+#include netxen_nic_hw.h
+
+#include netxen_nic.h
+#define DEFINE_GLOBAL_RECV_CRB
+#include netxen_nic_phan_reg.h
+#include netxen_nic_ioctl.h
+
+MODULE_DESCRIPTION(NetXen Multi port (1/10) Gigabit Network 

[PATCH 2.6.18 2/9] NetXen: Hardware access routines

2006-09-27 Thread Amit S. Kale

diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/netxen_nic_hw.c 
linux-2.6.18/drivers/net/netxen/netxen_nic_hw.c
--- linux-2.6.18.orig/drivers/net/netxen/netxen_nic_hw.c1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/netxen_nic_hw.c 2006-09-25 
05:04:07.0 -0700
@@ -0,0 +1,936 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * 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., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ *
+ *
+ * Source file for NIC routines to access the Phantom hardware
+ *
+ */
+
+#include netxen_nic.h
+#include netxen_nic_hw.h
+#include netxen_nic_phan_reg.h
+
+/*  PCI Windowing for DDR regions.  */
+
+#define ADDR_IN_RANGE(addr, low, high) \
+   (((addr) = (high))  ((addr) = (low)))
+
+#define NETXEN_FLASH_BASE  (BOOTLD_START)
+#define NETXEN_PHANTOM_MEM_BASE(NETXEN_FLASH_BASE)
+#define NETXEN_MAX_MTU 8000
+#define NETXEN_MIN_MTU  64
+#define NETXEN_ETH_FCS_SIZE 4
+#define NETXEN_ENET_HEADER_SIZE 14
+#define NETXEN_WINDOW_ONE 0x200/* CRB Window: bit 25 of CRB address */
+#define NETXEN_FIRMWARE_LEN((16 * 1024) / 4)
+#define NETXEN_NIU_HDRSIZE (0x1  6)
+#define NETXEN_NIU_TLRSIZE (0x1  5)
+
+unsigned long netxen_nic_pci_set_window(void __iomem * pci_base,
+   unsigned long long addr);
+void netxen_free_hw_resources(struct netxen_adapter *adapter);
+
+int netxen_nic_set_mac(struct net_device *netdev, void *p)
+{
+   struct netxen_port *port = netdev_priv(netdev);
+   struct netxen_adapter *adapter = port-adapter;
+   struct sockaddr *addr = p;
+
+   if (netif_running(netdev))
+   return -EBUSY;
+
+   if (!is_valid_ether_addr(addr-sa_data))
+   return -EADDRNOTAVAIL;
+
+   DPRINTK(INFO, valid ether addr\n);
+   memcpy(netdev-dev_addr, addr-sa_data, netdev-addr_len);
+
+   if (adapter-ops-macaddr_set)
+   adapter-ops-macaddr_set(port, addr-sa_data);
+
+   return 0;
+}
+
+/*
+ * netxen_nic_set_multi - Multicast
+ */
+void netxen_nic_set_multi(struct net_device *netdev)
+{
+   struct netxen_port *port = netdev_priv(netdev);
+   struct netxen_adapter *adapter = port-adapter;
+   struct dev_mc_list *mc_ptr;
+   __le32 netxen_mac_addr_cntl_data = 0;
+
+   mc_ptr = netdev-mc_list;
+   if (netdev-flags  IFF_PROMISC) {
+   if (adapter-ops-set_promisc)
+   adapter-ops-set_promisc(adapter,
+ port-portnum,
+ NETXEN_NIU_PROMISC_MODE);
+   } else {
+   if (adapter-ops-unset_promisc)
+   adapter-ops-unset_promisc(adapter,
+   port-portnum,
+   
NETXEN_NIU_NON_PROMISC_MODE);
+   }
+   if (adapter-ahw.board_type == NETXEN_NIC_XGBE) {
+   netxen_nic_mcr_set_mode_select(netxen_mac_addr_cntl_data, 0x03);
+   netxen_nic_mcr_set_id_pool0(netxen_mac_addr_cntl_data, 0x00);
+   netxen_nic_mcr_set_id_pool1(netxen_mac_addr_cntl_data, 0x00);
+   netxen_nic_mcr_set_id_pool2(netxen_mac_addr_cntl_data, 0x00);
+   netxen_nic_mcr_set_id_pool3(netxen_mac_addr_cntl_data, 0x00);
+   netxen_nic_mcr_set_enable_xtnd0(netxen_mac_addr_cntl_data);
+   netxen_nic_mcr_set_enable_xtnd1(netxen_mac_addr_cntl_data);
+   netxen_nic_mcr_set_enable_xtnd2(netxen_mac_addr_cntl_data);
+   netxen_nic_mcr_set_enable_xtnd3(netxen_mac_addr_cntl_data);
+   } else {
+   netxen_nic_mcr_set_mode_select(netxen_mac_addr_cntl_data, 0x00);
+   netxen_nic_mcr_set_id_pool0(netxen_mac_addr_cntl_data, 0x00);
+   netxen_nic_mcr_set_id_pool1(netxen_mac_addr_cntl_data, 0x01);
+   netxen_nic_mcr_set_id_pool2(netxen_mac_addr_cntl_data, 0x02);
+   

Re: [d80211 patch 1/1] setting bss freq and phymode using rx_status

2006-09-27 Thread Jiri Benc
On Mon, 25 Sep 2006 10:15:28 -0700, mabbas wrote:
 actaully we dont even need local-conf.channel. rx_status-channel holds 
 the channel
 we physically received the frame on. channel hold the value from ds. if 
 they are not equal then
 adjust freq. Attached is the modified patch

Applied to my tree. Thanks for the patch!

 Jiri

-- 
Jiri Benc
SUSE Labs
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Patch] Remove unnecessary check in net/sunrpc/svcsock.c

2006-09-27 Thread Eric Sesterhenn
hi,

coverity spotted this one as possible dereference in the dprintk(),
but since there is only one caller of svc_create_socket(), which always
passes a valid sin, we dont need this check.

Signed-off-by: Eric Sesterhenn [EMAIL PROTECTED]

--- linux-2.6.18-git7/net/sunrpc/svcsock.c.orig 2006-09-27 16:06:53.0 
+0200
+++ linux-2.6.18-git7/net/sunrpc/svcsock.c  2006-09-27 16:07:09.0 
+0200
@@ -1393,14 +1393,12 @@ svc_create_socket(struct svc_serv *serv,
if ((error = sock_create_kern(PF_INET, type, protocol, sock))  0)
return error;
 
-   if (sin != NULL) {
-   if (type == SOCK_STREAM)
-   sock-sk-sk_reuse = 1; /* allow address reuse */
-   error = kernel_bind(sock, (struct sockaddr *) sin,
-   sizeof(*sin));
-   if (error  0)
-   goto bummer;
-   }
+   if (type == SOCK_STREAM)
+   sock-sk-sk_reuse = 1; /* allow address reuse */
+   error = kernel_bind(sock, (struct sockaddr *) sin,
+   sizeof(*sin));
+   if (error  0)
+   goto bummer;
 
if (protocol == IPPROTO_TCP) {
if ((error = kernel_listen(sock, 64))  0)


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.18 4/9] NetXen: intr routines and niu handling

2006-09-27 Thread Amit S. Kale

diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/netxen_nic_isr.c 
linux-2.6.18/drivers/net/netxen/netxen_nic_isr.c
--- linux-2.6.18.orig/drivers/net/netxen/netxen_nic_isr.c   1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/netxen_nic_isr.c2006-09-25 
05:04:07.0 -0700
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * 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., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ */
+
+#include linux/netdevice.h
+#include linux/delay.h
+
+#include netxen_nic.h
+#include netxen_nic_hw.h
+#include netxen_nic_phan_reg.h
+
+/*
+ * netxen_nic_get_stats - Get System Network Statistics
+ * @netdev: network interface device structure
+ */
+struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
+{
+   struct netxen_port *port = netdev_priv(netdev);
+   struct net_device_stats *stats = port-net_stats;
+
+   memset(stats, 0, sizeof(*stats));
+
+   /* total packets received   */
+   stats-rx_packets = port-stats.no_rcv;
+   /* total packets transmitted*/
+   stats-tx_packets = port-stats.xmitedframes + port-stats.xmitfinished;
+   /* total bytes received */
+   stats-rx_bytes = port-stats.rxbytes;
+   /* total bytes transmitted  */
+   stats-tx_bytes = port-stats.txbytes;
+   /* bad packets received */
+   stats-rx_errors = port-stats.rcvdbadskb;
+   /* packet transmit problems */
+   stats-tx_errors = port-stats.nocmddescriptor;
+   /* no space in linux buffers*/
+   stats-rx_dropped = port-stats.updropped;
+   /* no space available in linux  */
+   stats-tx_dropped = port-stats.txdropped;
+
+   return stats;
+}
+
+void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno,
+u32 link)
+{
+   struct netxen_port *pport = adapter-port[portno];
+   struct net_device *netdev = pport-netdev;
+
+   if (link)
+   netif_carrier_on(netdev);
+   else
+   netif_carrier_off(netdev);
+}
+
+void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
+   u32 enable)
+{
+   __le32 int_src;
+   struct netxen_port *port;
+
+   /*  This should clear the interrupt source */
+   if (adapter-ops-phy_read)
+   adapter-ops-phy_read(adapter, portno,
+  NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS,
+  int_src);
+   if (int_src == 0) {
+   DPRINTK(INFO, No phy interrupts for port #%d\n, portno);
+   return;
+   }
+   if (adapter-ops-disable_phy_interrupts)
+   adapter-ops-disable_phy_interrupts(adapter, portno);
+
+   port = adapter-port[portno];
+
+   if (netxen_get_phy_int_jabber(int_src))
+   DPRINTK(INFO, NetXen: %s Jabber interrupt \n,
+   port-netdev-name);
+
+   if (netxen_get_phy_int_polarity_changed(int_src))
+   DPRINTK(INFO, NetXen: %s POLARITY CHANGED int \n,
+   port-netdev-name);
+
+   if (netxen_get_phy_int_energy_detect(int_src))
+   DPRINTK(INFO, NetXen: %s ENERGY DETECT INT \n,
+   port-netdev-name);
+
+   if (netxen_get_phy_int_downshift(int_src))
+   DPRINTK(INFO, NetXen: %s DOWNSHIFT INT \n,
+   port-netdev-name);
+   /* write it down later.. */
+   if ((netxen_get_phy_int_speed_changed(int_src))
+   || (netxen_get_phy_int_link_status_changed(int_src))) {
+   __le32 status;
+
+   DPRINTK(INFO, NetXen: %s SPEED CHANGED OR
+LINK STATUS CHANGED \n, port-netdev-name);
+
+   if (adapter-ops-phy_read
+adapter-ops-phy_read(adapter, portno,
+ 
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
+ status) == 0) {

[PATCH 2.6.18 3/9] NetXen: hw initialization routines

2006-09-27 Thread Amit S. Kale

diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/netxen_nic_init.c 
linux-2.6.18/drivers/net/netxen/netxen_nic_init.c
--- linux-2.6.18.orig/drivers/net/netxen/netxen_nic_init.c  1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/netxen_nic_init.c   2006-09-25 
05:04:07.0 -0700
@@ -0,0 +1,1143 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * 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., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ *
+ *
+ * Source file for NIC routines to initialize the Phantom Hardware
+ *
+ */
+
+#include linux/netdevice.h
+#include linux/delay.h
+#include netxen_nic.h
+#include netxen_nic_hw.h
+#include netxen_nic_ioctl.h
+#include netxen_nic_phan_reg.h
+
+struct crb_addr_pair {
+   long addr;
+   long data;
+};
+
+#define NETXEN_MAX_CRB_XFORM 60
+static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM];
+#define NETXEN_ADDR_ERROR ((unsigned long ) 0x )
+
+#define crb_addr_transform(name) \
+   crb_addr_xform[NETXEN_HW_PX_MAP_CRB_##name] = \
+   NETXEN_HW_CRB_HUB_AGT_ADR_##name  20
+
+static inline void
+netxen_nic_locked_write_reg(struct netxen_adapter *adapter,
+   unsigned long off, int *data)
+{
+   void __iomem *addr = (adapter-ahw.pci_base + off);
+   writel(*data, addr);
+}
+
+static void crb_addr_transform_setup(void)
+{
+   crb_addr_transform(XDMA);
+   crb_addr_transform(TIMR);
+   crb_addr_transform(SRE);
+   crb_addr_transform(SQN3);
+   crb_addr_transform(SQN2);
+   crb_addr_transform(SQN1);
+   crb_addr_transform(SQN0);
+   crb_addr_transform(SQS3);
+   crb_addr_transform(SQS2);
+   crb_addr_transform(SQS1);
+   crb_addr_transform(SQS0);
+   crb_addr_transform(RPMX7);
+   crb_addr_transform(RPMX6);
+   crb_addr_transform(RPMX5);
+   crb_addr_transform(RPMX4);
+   crb_addr_transform(RPMX3);
+   crb_addr_transform(RPMX2);
+   crb_addr_transform(RPMX1);
+   crb_addr_transform(RPMX0);
+   crb_addr_transform(ROMUSB);
+   crb_addr_transform(SN);
+   crb_addr_transform(QMN);
+   crb_addr_transform(QMS);
+   crb_addr_transform(PGNI);
+   crb_addr_transform(PGND);
+   crb_addr_transform(PGN3);
+   crb_addr_transform(PGN2);
+   crb_addr_transform(PGN1);
+   crb_addr_transform(PGN0);
+   crb_addr_transform(PGSI);
+   crb_addr_transform(PGSD);
+   crb_addr_transform(PGS3);
+   crb_addr_transform(PGS2);
+   crb_addr_transform(PGS1);
+   crb_addr_transform(PGS0);
+   crb_addr_transform(PS);
+   crb_addr_transform(PH);
+   crb_addr_transform(NIU);
+   crb_addr_transform(I2Q);
+   crb_addr_transform(EG);
+   crb_addr_transform(MN);
+   crb_addr_transform(MS);
+   crb_addr_transform(CAS2);
+   crb_addr_transform(CAS1);
+   crb_addr_transform(CAS0);
+   crb_addr_transform(CAM);
+   crb_addr_transform(C2C1);
+   crb_addr_transform(C2C0);
+}
+
+int netxen_init_firmware(struct netxen_adapter *adapter)
+{
+   u32 state = 0, loops = 0, err = 0;
+
+   /* Window 1 call */
+   state = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
+
+   if (state == PHAN_INITIALIZE_ACK)
+   return 0;
+
+   while (state != PHAN_INITIALIZE_COMPLETE  loops  2000) {
+   udelay(100);
+   /* Window 1 call */
+   state = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
+
+   loops++;
+   }
+   if (loops = 2000) {
+   printk(KERN_ERR Cmd Peg initialization not complete:%x.\n,
+  state);
+   err = -EIO;
+   return err;
+   }
+   /* Window 1 call */
+   writel(PHAN_INITIALIZE_ACK,
+  NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
+
+   return err;
+}
+
+void netxen_initialize_adapter_sw(struct netxen_adapter *adapter)
+{
+   int ctxid, ring;
+   u32 i;
+   u32 num_rx_bufs = 0;
+   struct 

[PATCH 2.6.18 5/9] NetXen: ethtool interface

2006-09-27 Thread Amit S. Kale

diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/netxen_nic_ethtool.c 
linux-2.6.18/drivers/net/netxen/netxen_nic_ethtool.c
--- linux-2.6.18.orig/drivers/net/netxen/netxen_nic_ethtool.c   1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/netxen_nic_ethtool.c2006-09-25 
05:04:07.0 -0700
@@ -0,0 +1,715 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * 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., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ *
+ *
+ * ethtool support for netxen nic
+ *
+ */
+
+#include linux/types.h
+#include asm/uaccess.h
+#include linux/pci.h
+#include asm/io.h
+#include linux/netdevice.h
+#include linux/ethtool.h
+#include linux/version.h
+
+#include netxen_nic_hw.h
+#include netxen_nic.h
+#include netxen_nic_phan_reg.h
+#include netxen_nic_ioctl.h
+
+struct netxen_nic_stats {
+   char stat_string[ETH_GSTRING_LEN];
+   int sizeof_stat;
+   int stat_offset;
+};
+
+#define NETXEN_NIC_STAT(m) sizeof(((struct netxen_port *)0)-m), \
+   offsetof(struct netxen_port, m)
+
+static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = {
+   {rcvd_bad_skb, NETXEN_NIC_STAT(stats.rcvdbadskb)},
+   {xmit_called, NETXEN_NIC_STAT(stats.xmitcalled)},
+   {xmited_frames, NETXEN_NIC_STAT(stats.xmitedframes)},
+   {xmit_finished, NETXEN_NIC_STAT(stats.xmitfinished)},
+   {bad_skb_len, NETXEN_NIC_STAT(stats.badskblen)},
+   {no_cmd_desc, NETXEN_NIC_STAT(stats.nocmddescriptor)},
+   {polled, NETXEN_NIC_STAT(stats.polled)},
+   {uphappy, NETXEN_NIC_STAT(stats.uphappy)},
+   {updropped, NETXEN_NIC_STAT(stats.updropped)},
+   {uplcong, NETXEN_NIC_STAT(stats.uplcong)},
+   {uphcong, NETXEN_NIC_STAT(stats.uphcong)},
+   {upmcong, NETXEN_NIC_STAT(stats.upmcong)},
+   {updunno, NETXEN_NIC_STAT(stats.updunno)},
+   {skb_freed, NETXEN_NIC_STAT(stats.skbfreed)},
+   {tx_dropped, NETXEN_NIC_STAT(stats.txdropped)},
+   {tx_null_skb, NETXEN_NIC_STAT(stats.txnullskb)},
+   {csummed, NETXEN_NIC_STAT(stats.csummed)},
+   {no_rcv, NETXEN_NIC_STAT(stats.no_rcv)},
+   {rx_bytes, NETXEN_NIC_STAT(stats.rxbytes)},
+   {tx_bytes, NETXEN_NIC_STAT(stats.txbytes)},
+};
+
+#define NETXEN_NIC_STATS_LEN   \
+   sizeof(netxen_nic_gstrings_stats) / sizeof(struct netxen_nic_stats)
+
+static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
+   Register_Test_offline, EEPROM_Test_offline,
+   Interrupt_Test_offline, Loopback_Test_offline,
+   Link_Test_on_offline
+};
+
+#define NETXEN_NIC_TEST_LEN sizeof(netxen_nic_gstrings_test) / ETH_GSTRING_LEN
+
+#define NETXEN_NIC_REGS_COUNT 42
+#define NETXEN_NIC_REGS_LEN (NETXEN_NIC_REGS_COUNT * sizeof(__le32))
+#define NETXEN_MAX_EEPROM_LEN   1024
+
+static int netxen_nic_get_eeprom_len(struct net_device *dev)
+{
+   struct netxen_port *port = netdev_priv(dev);
+   struct netxen_adapter *adapter = port-adapter;
+   int n;
+
+   if ((netxen_rom_fast_read(adapter, 0, n) == 0)
+(n  NETXEN_ROM_ROUNDUP)) {
+   n = ~NETXEN_ROM_ROUNDUP;
+   if (n  NETXEN_MAX_EEPROM_LEN)
+   return n;
+   }
+   return 0;
+}
+
+static void
+netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
+{
+   struct netxen_port *port = netdev_priv(dev);
+   struct netxen_adapter *adapter = port-adapter;
+   uint32_t fw_major = 0;
+   uint32_t fw_minor = 0;
+   uint32_t fw_build = 0;
+
+   strncpy(drvinfo-driver, netxen_nic, 32);
+   strncpy(drvinfo-version, NETXEN_NIC_LINUX_VERSIONID, 32);
+   fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
+ NETXEN_FW_VERSION_MAJOR));
+   fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter,
+ NETXEN_FW_VERSION_MINOR));
+   fw_build = readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB));
+   sprintf(drvinfo-fw_version, %d.%d.%d, fw_major, 

[PATCH 2.6.18 6/9] NetXen: Main header file

2006-09-27 Thread Amit S. Kale

diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/netxen_nic.h 
linux-2.6.18/drivers/net/netxen/netxen_nic.h
--- linux-2.6.18.orig/drivers/net/netxen/netxen_nic.h   1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/netxen_nic.h2006-09-25 
05:04:07.0 -0700
@@ -0,0 +1,910 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * 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., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ */
+
+#ifndef _NETXEN_NIC_H_
+#define _NETXEN_NIC_H_
+
+#include linux/config.h
+#include linux/module.h
+#include linux/kernel.h
+#include linux/types.h
+#include linux/compiler.h
+#include linux/slab.h
+#include linux/delay.h
+#include linux/init.h
+#include linux/ioport.h
+#include linux/pci.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/ip.h
+#include linux/in.h
+#include linux/tcp.h
+#include linux/skbuff.h
+#include linux/version.h
+
+#include linux/ethtool.h
+#include linux/mii.h
+#include linux/interrupt.h
+#include linux/timer.h
+
+#include linux/mm.h
+#include linux/mman.h
+
+#include asm/system.h
+#include asm/io.h
+#include asm/byteorder.h
+#include asm/uaccess.h
+#include asm/pgtable.h
+
+#include netxen_nic_hw.h
+
+#define NETXEN_NIC_BUILD_NO 232
+#define _NETXEN_NIC_LINUX_MAJOR 2
+#define _NETXEN_NIC_LINUX_MINOR 3
+#define _NETXEN_NIC_LINUX_SUBVERSION 57
+#define NETXEN_NIC_LINUX_VERSIONID  2.3.57
+#define NETXEN_NIC_FW_VERSIONID 2.3.57
+
+#define RCV_DESC_RINGSIZE  \
+   (sizeof(struct rcv_desc) * adapter-max_rx_desc_count)
+#define STATUS_DESC_RINGSIZE   \
+   (sizeof(struct status_desc)* adapter-max_rx_desc_count)
+#define TX_RINGSIZE\
+   (sizeof(struct netxen_cmd_buffer) * adapter-max_tx_desc_count)
+#define RCV_BUFFSIZE   \
+   (sizeof(struct netxen_rx_buffer) * rcv_desc-max_rx_desc_count)
+#define find_diff_among(a,b,range) ((a)(b)?((b)-(a)):((b)+(range)-(a)))
+
+#define NETXEN_NETDEV_STATUS 0x1
+
+#define ADDR_IN_WINDOW1(off)   \
+   ((off  NETXEN_CRB_PCIX_HOST2)  (off  NETXEN_CRB_MAX)) ? 1 : 0
+
+/* 
+ * normalize a 64MB crb address to 32MB PCI window 
+ * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1

+ */
+#define NETXEN_CRB_NORMALIZE(adapter, reg) \
+   ((adapter)-ahw.pci_base + (reg) \
+   - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST)
+
+#define MAX_RX_BUFFER_LENGTH   2000
+#define MAX_RX_JUMBO_BUFFER_LENGTH 9046
+#define RX_DMA_MAP_LEN (MAX_RX_BUFFER_LENGTH - NET_IP_ALIGN)
+#define RX_JUMBO_DMA_MAP_LEN   \
+   (MAX_RX_JUMBO_BUFFER_LENGTH - NET_IP_ALIGN)
+#define NETXEN_ROM_ROUNDUP 0x8000ULL
+
+/*
+ * Maximum number of ring contexts
+ */
+#define MAX_RING_CTX 1
+
+/* Opcodes to be used with the commands */
+enum {
+   TX_ETHER_PKT = 0x01,
+/* The following opcodes are for IP checksum   */
+   TX_TCP_PKT,
+   TX_UDP_PKT,
+   TX_IP_PKT,
+   TX_TCP_LSO,
+   TX_IPSEC,
+   TX_IPSEC_CMD
+};
+
+/* The following opcodes are for internal consumption. */
+#define NETXEN_CONTROL_OP  0x10
+#define PEGNET_REQUEST 0x11
+
+#defineMAX_NUM_CARDS   4
+
+#define MAX_BUFFERS_PER_CMD32
+
+/*
+ * Following are the states of the Phantom. Phantom will set them and
+ * Host will read to check if the fields are correct.
+ */
+#define PHAN_INITIALIZE_START  0xff00
+#define PHAN_INITIALIZE_FAILED 0x
+#define PHAN_INITIALIZE_COMPLETE   0xff01
+
+/* Host writes the following to notify that it has done the init-handshake */
+#define PHAN_INITIALIZE_ACK0xf00f
+
+#define NUM_RCV_DESC_RINGS 2   /* No of Rcv Descriptor contexts */
+
+/* descriptor types */
+#define RCV_DESC_NORMAL0x01
+#define RCV_DESC_JUMBO 0x02
+#define RCV_DESC_NORMAL_CTXID  0
+#define RCV_DESC_JUMBO_CTXID   1
+
+#define RCV_DESC_TYPE(ID) \
+   ((ID == RCV_DESC_JUMBO_CTXID) ? RCV_DESC_JUMBO : RCV_DESC_NORMAL)
+
+#define MAX_CMD_DESCRIPTORS1024
+#define MAX_RCV_DESCRIPTORS32768

[PATCH 9/14] d80211: allow vlan interfaces to receive ToDS frames

2006-09-27 Thread Jiri Benc
From: David Kimdon [EMAIL PROTECTED]

Interfaces of type IEEE80211_IF_TYPE_VLAN are similar to AP
interfaces. One difference is stations are bound to a particular
vlan interface after authentication/association based on
management policy (for example a radius server).

Interfaces of type IEEE80211_IF_TYPE_VLAN need to be able to
receive ToDS frames.

Signed-off-by: David Kimdon [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

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

c220ae6162f23935ebc141b6734ecad1ab435294
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 76ecad8..4fee86c 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -2374,7 +2374,8 @@ ieee80211_rx_h_data(struct ieee80211_txr
memcpy(dst, hdr-addr3, ETH_ALEN);
memcpy(src, hdr-addr2, ETH_ALEN);
 
-   if (unlikely(sdata-type != IEEE80211_IF_TYPE_AP)) {
+   if (unlikely(sdata-type != IEEE80211_IF_TYPE_AP 
+sdata-type != IEEE80211_IF_TYPE_VLAN)) {
printk(KERN_DEBUG %s: dropped ToDS frame (BSSID=
   MAC_FMT  SA= MAC_FMT  DA= MAC_FMT )\n,
   dev-name, MAC_ARG(hdr-addr1),
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/14] d80211: LED triggers

2006-09-27 Thread Jiri Benc
From: Johannes Berg [EMAIL PROTECTED]

This patch makes d80211 export LED triggers for rx/tx and introduces
functions to allow device drivers to query the trigger names for setting
default triggers. It also cleans up the Makefile LED related stuff.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 include/net/d80211.h   |   40 ++-
 net/d80211/Kconfig |9 
 net/d80211/Makefile|   10 ++---
 net/d80211/ieee80211.c |   28 -
 net/d80211/ieee80211_dev.c |1 
 net/d80211/ieee80211_i.h   |6 ++-
 net/d80211/ieee80211_led.c |   93 
 net/d80211/ieee80211_led.h |   32 +++
 8 files changed, 166 insertions(+), 53 deletions(-)
 create mode 100644 net/d80211/ieee80211_led.h

fc0f9a5915098ff5e405b80db3134fa9dd55ee9b
diff --git a/include/net/d80211.h b/include/net/d80211.h
index 36c58b4..a80f48b 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -703,6 +703,36 @@ struct net_device *ieee80211_alloc_hw(si
  * function. */
 int ieee80211_register_hw(struct net_device *dev, struct ieee80211_hw *hw);
 
+/* driver can use this and ieee80211_get_rx_led_name to get the
+ * name of the registered LEDs after ieee80211_register_hw
+ * was called.
+ * This is useful to set the default trigger on the LED class
+ * device that your driver should export for each LED the device
+ * has, that way the default behaviour will be as expected but
+ * the user can still change it/turn off the LED etc.
+ */
+#ifdef CONFIG_D80211_LEDS
+extern char *__ieee80211_get_tx_led_name(struct net_device *dev);
+extern char *__ieee80211_get_rx_led_name(struct net_device *dev);
+#endif
+static inline char *ieee80211_get_tx_led_name(struct net_device *dev)
+{
+#ifdef CONFIG_D80211_LEDS
+   return __ieee80211_get_tx_led_name(dev);
+#else
+   return NULL;
+#endif
+}
+
+static inline char *ieee80211_get_rx_led_name(struct net_device *dev)
+{
+#ifdef CONFIG_D80211_LEDS
+   return __ieee80211_get_rx_led_name(dev);
+#else
+   return NULL;
+#endif
+}
+
 /* This function is allowed to update hardware configuration (e.g., list of
  * supported operation modes and rates). */
 int ieee80211_update_hw(struct net_device *dev, struct ieee80211_hw *hw);
@@ -903,16 +933,6 @@ enum {
IEEE80211_TEST_PARAM_TX_ANT_SEL_RAW = 5,
 };
 
-/* ieee80211_tx_led called with state == 1 when the first frame is queued
- *   with state == 0 when the last frame is transmitted and tx queue is empty
- */
-void ieee80211_tx_led(int state, struct net_device *dev);
-/* ieee80211_rx_led is called each time frame is received, state is not used
- * (== 2)
- */
-void ieee80211_rx_led(int state, struct net_device *dev);
-
-
 /* IEEE 802.11 defines */
 
 #define FCS_LEN 4
diff --git a/net/d80211/Kconfig b/net/d80211/Kconfig
index 2f3c0a3..0f07d41 100644
--- a/net/d80211/Kconfig
+++ b/net/d80211/Kconfig
@@ -7,6 +7,15 @@ config D80211
This option enables the hardware independent IEEE 802.11
networking stack.
 
+config D80211_LEDS
+   bool Enable LED triggers
+   depends on D80211
+   select NEW_LEDS
+   select LEDS_TRIGGERS
+   ---help---
+   This option enables a few LED triggers for different
+   packet receive/transmit events.
+
 config D80211_DEBUG
bool Enable debugging output
depends on D80211
diff --git a/net/d80211/Makefile b/net/d80211/Makefile
index c21e882..2a2a0c6 100644
--- a/net/d80211/Makefile
+++ b/net/d80211/Makefile
@@ -1,5 +1,7 @@
 obj-$(CONFIG_D80211) += 80211.o rate_control.o
 
+80211-objs-$(CONFIG_D80211_LEDS) += ieee80211_led.o
+
 80211-objs := \
ieee80211.o \
ieee80211_ioctl.o \
@@ -15,13 +17,9 @@ obj-$(CONFIG_D80211) += 80211.o rate_con
michael.o \
tkip.o \
aes_ccm.o \
-   wme.o
+   wme.o \
+   $(80211-objs-y)
 
 ifeq ($(CONFIG_NET_SCHED),)
   80211-objs += fifo_qdisc.o
 endif
-
-ifeq ($(CONFIG_D80211_LEDS),y)
-  80211-objs += ieee80211_led.o
-endif
-
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 4d989e2..1ef2707 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -31,7 +31,7 @@ #include wpa.h
 #include tkip.h
 #include wme.h
 #include aes_ccm.h
-
+#include ieee80211_led.h
 
 /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
 /* Ethernet-II snap header (RFC1042 for most EtherTypes) */
@@ -1180,11 +1180,7 @@ static int __ieee80211_tx(struct ieee802
ret = local-hw-tx(local-mdev, skb, control);
if (ret)
return IEEE80211_TX_AGAIN;
-#ifdef IEEE80211_LEDS
-   if (local-tx_led_counter++ == 0) {
-   ieee80211_tx_led(1, local-mdev);
-   }
-#endif /* IEEE80211_LEDS */
+   ieee80211_led_tx(local, 1);
}
if (tx-u.tx.extra_frag) {
control-use_rts_cts = 0;
@@ -1209,11 +1205,7 @@ #endif /* 

[PATCH 11/14] d80211: use list_for_each_entry{,_safe}

2006-09-27 Thread Jiri Benc
From: Johannes Berg [EMAIL PROTECTED]

This patch changes (hopefully!) all occurrences in d80211 of
list_for_each to list_for_each_entry (and _safe variants where they were
used before).

Signed-off-by: Johannes Berg [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c   |   33 -
 net/d80211/ieee80211_dev.c   |6 ++
 net/d80211/ieee80211_ioctl.c |   32 +++-
 net/d80211/ieee80211_sta.c   |   24 ++--
 net/d80211/sta_info.c|   13 -
 5 files changed, 35 insertions(+), 73 deletions(-)

871e88d24ff80e9521da300fd5c80e521b869ac9
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 4fee86c..4d989e2 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -945,13 +945,12 @@ static void purge_old_ps_buffers(struct 
 {
int total = 0, purged = 0;
struct sk_buff *skb;
-   struct list_head *ptr;
+   struct ieee80211_sub_if_data *sdata;
+   struct sta_info *sta;
 
spin_lock_bh(local-sub_if_lock);
-   list_for_each(ptr, local-sub_if_list) {
+   list_for_each_entry(sdata, local-sub_if_list, list) {
struct ieee80211_if_ap *ap;
-   struct ieee80211_sub_if_data *sdata =
-   list_entry(ptr, struct ieee80211_sub_if_data, list);
if (sdata-dev == local-mdev ||
sdata-type != IEEE80211_IF_TYPE_AP)
continue;
@@ -966,9 +965,7 @@ static void purge_old_ps_buffers(struct 
spin_unlock_bh(local-sub_if_lock);
 
spin_lock_bh(local-sta_lock);
-   list_for_each(ptr, local-sta_list) {
-   struct sta_info *sta =
-   list_entry(ptr, struct sta_info, list);
+   list_for_each_entry(sta, local-sta_list, list) {
skb = skb_dequeue(sta-ps_tx_buf);
if (skb) {
purged++;
@@ -3829,16 +3826,15 @@ ieee80211_rx_h_if_stats(struct ieee80211
 static void ieee80211_stat_refresh(unsigned long data)
 {
struct ieee80211_local *local = (struct ieee80211_local *) data;
-struct list_head *ptr, *n;
+   struct sta_info *sta;
+   struct ieee80211_sub_if_data *sdata;
 
if (!local-stat_time)
return;
 
/* go through all stations */
spin_lock_bh(local-sta_lock);
-   list_for_each(ptr, local-sta_list) {
-   struct sta_info *sta =
-   list_entry(ptr, struct sta_info, list);
+   list_for_each_entry(sta, local-sta_list, list) {
sta-channel_use = (sta-channel_use_raw / local-stat_time) /
CHAN_UTIL_PER_10MS;
sta-channel_use_raw = 0;
@@ -3846,14 +3842,11 @@ static void ieee80211_stat_refresh(unsig
spin_unlock_bh(local-sta_lock);
 
/* go through all subinterfaces */
-   list_for_each_safe(ptr, n, local-sub_if_list) {
-   struct ieee80211_sub_if_data *sdata =
-   list_entry(ptr, struct ieee80211_sub_if_data, list);
+   list_for_each_entry(sdata, local-sub_if_list, list) {
 sdata-channel_use = (sdata-channel_use_raw /
  local-stat_time) / CHAN_UTIL_PER_10MS;
 sdata-channel_use_raw = 0;
-
-}
+   }
 
/* hardware interface */
local-channel_use = (local-channel_use_raw /
@@ -4563,7 +4556,7 @@ EXPORT_SYMBOL(ieee80211_update_hw);
 void ieee80211_unregister_hw(struct net_device *dev)
 {
struct ieee80211_local *local = dev-ieee80211_ptr;
-struct list_head *ptr, *n;
+   struct ieee80211_sub_if_data *sdata, *tmp;
int i;
 
 tasklet_disable(local-tasklet);
@@ -4576,11 +4569,9 @@ void ieee80211_unregister_hw(struct net_
 
sysfs_remove_link(local-class_dev.kobj, master);
 
-   list_for_each_safe(ptr, n, local-sub_if_list) {
-   struct ieee80211_sub_if_data *sdata =
-   list_entry(ptr, struct ieee80211_sub_if_data, list);
+   list_for_each_entry_safe(sdata, tmp, local-sub_if_list, list)
__ieee80211_if_del(local, sdata);
-   }
+
rtnl_unlock();
 
if (local-rate_limit)
diff --git a/net/d80211/ieee80211_dev.c b/net/d80211/ieee80211_dev.c
index 6c6ca91..69d8ada 100644
--- a/net/d80211/ieee80211_dev.c
+++ b/net/d80211/ieee80211_dev.c
@@ -38,7 +38,6 @@ static struct ieee80211_dev_list *__ieee
 
 int ieee80211_dev_alloc_index(struct ieee80211_local *local)
 {
-   struct list_head *i;
struct ieee80211_dev_list *dev_item, *new;
int index = 0;
 
@@ -47,14 +46,13 @@ int ieee80211_dev_alloc_index(struct iee
return -ENOMEM;
new-local = local;
spin_lock(dev_list_lock);
-   list_for_each(i, dev_list) {
-   dev_item = list_entry(i, struct ieee80211_dev_list, list);
+   

[PATCH 8/14] d80211: fix WEP on big endian cpus

2006-09-27 Thread Jiri Benc
From: Michael Wu [EMAIL PROTECTED]

This patch fixes the endian issues with the ICV in WEP, as pointed out by
David Kimdon [EMAIL PROTECTED], and uses __le32 where
appropriate to make things clear.

Signed-off-by: Michael Wu [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/wep.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

adcdddba34181486f2a1b402f39d66fe05f42595
diff --git a/net/d80211/wep.c b/net/d80211/wep.c
index c3e4728..22c2e53 100644
--- a/net/d80211/wep.c
+++ b/net/d80211/wep.c
@@ -120,10 +120,10 @@ void ieee80211_wep_encrypt_data(struct c
size_t klen, u8 *data, size_t data_len)
 {
struct scatterlist sg;
-   u32 *icv;
+   __le32 *icv;
 
-   icv = (u32 *)(data + data_len);
-   *icv = ~crc32_le(~0, data, data_len);
+   icv = (__le32 *)(data + data_len);
+   *icv = cpu_to_le32(~crc32_le(~0, data, data_len));
 
crypto_cipher_setkey(tfm, rc4key, klen);
sg.page = virt_to_page(data);
@@ -187,7 +187,7 @@ int ieee80211_wep_decrypt_data(struct cr
   size_t klen, u8 *data, size_t data_len)
 {
struct scatterlist sg;
-   u32 crc;
+   __le32 crc;
 
crypto_cipher_setkey(tfm, rc4key, klen);
sg.page = virt_to_page(data);
@@ -195,7 +195,7 @@ int ieee80211_wep_decrypt_data(struct cr
sg.length = data_len + WEP_ICV_LEN;
crypto_cipher_decrypt(tfm, sg, sg, sg.length);
 
-   crc = ~crc32_le(~0, data, data_len);
+   crc = cpu_to_le32(~crc32_le(~0, data, data_len));
if (memcmp(crc, data + data_len, WEP_ICV_LEN) != 0)
/* ICV mismatch */
return -1;
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/14] d80211: pull request

2006-09-27 Thread Jiri Benc
Please pull from
git://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git up
to obtain following patches:

David Kimdon:
  d80211: fix multiple device ap support
  d80211: Fix type of prism2_hostapd_param crypt.alg
  d80211: allow vlan interfaces to receive ToDS frames

Hong Liu:
  d80211: fix wpa_supplicant reassoc problem
  d80211: add hardware scan callback
  d80211: fix iwconfig key [x] behavior

Jiri Benc:
  d80211: fix invalid pointer dereference

Johannes Berg:
  d80211: use BUILD_BUG_ON
  d80211: clean up those huge else if statements
  d80211: use list_for_each_entry{,_safe}
  d80211: LED triggers

Michael Wu:
  d80211: fix WEP on big endian cpus

Mohamed Abbas:
  d80211: diplay supported rates in readable format
  d80211: getting wrong freq value if we did hardware scan

 include/net/d80211.h |   46 ++
 net/d80211/Kconfig   |9 
 net/d80211/Makefile  |   10 ++--
 net/d80211/hostapd_ioctl.h   |2 -
 net/d80211/ieee80211.c   |   73 ++--
 net/d80211/ieee80211_dev.c   |7 +--
 net/d80211/ieee80211_i.h |6 ++
 net/d80211/ieee80211_iface.c |2 -
 net/d80211/ieee80211_ioctl.c |  108 +-
 net/d80211/ieee80211_led.c   |   93 ++--
 net/d80211/ieee80211_led.h   |   32 
 net/d80211/ieee80211_sta.c   |  107 +++---
 net/d80211/sta_info.c|   26 +-
 net/d80211/wep.c |   10 ++--
 14 files changed, 324 insertions(+), 207 deletions(-)

-- 
Jiri Benc
SUSE Labs
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.18 7/9] NetXen: hw access routines header file

2006-09-27 Thread Amit S. Kale

diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/netxen_nic_hw.h 
linux-2.6.18/drivers/net/netxen/netxen_nic_hw.h
--- linux-2.6.18.orig/drivers/net/netxen/netxen_nic_hw.h1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/netxen_nic_hw.h 2006-09-25 
05:04:07.0 -0700
@@ -0,0 +1,480 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * 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., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ *
+ *
+ * Structures, enums, and macros for the MAC
+ *
+ */
+
+#ifndef __NETXEN_NIC_HW_H_
+#define __NETXEN_NIC_HW_H_
+
+#include netxen_nic_hdr.h
+
+/* Hardware memory size of 128 meg */
+#define NETXEN_MEMADDR_MAX (128 * 1024 * 1024)
+
+#ifndef readq
+static inline u64 readq(void __iomem * addr)
+{
+   return readl(addr) | (((u64) readl(addr + 4))  32LL);
+}
+#endif
+
+#ifndef writeq
+static inline void writeq(u64 val, void __iomem * addr)
+{
+   writel(((u32) (val)), (addr));
+   writel(((u32) (val  32)), (addr + 4));
+}
+#endif
+
+static inline void netxen_nic_hw_block_write64(u64 __iomem * data_ptr,
+  u64 __iomem * addr,
+  int num_words)
+{
+   int num;
+   for (num = 0; num  num_words; num++) {
+   writeq(readq((void __iomem *)data_ptr), addr);
+   addr++;
+   data_ptr++;
+   }
+}
+
+static inline void netxen_nic_hw_block_read64(u64 __iomem * data_ptr,
+ u64 __iomem * addr, int num_words)
+{
+   int num;
+   for (num = 0; num  num_words; num++) {
+   writeq(readq((void __iomem *)addr), data_ptr);
+   addr++;
+   data_ptr++;
+   }
+
+}
+
+struct netxen_adapter;
+
+#define NETXEN_PCI_MAPSIZE_BYTES  (NETXEN_PCI_MAPSIZE  20)
+
+#define NETXEN_NIC_LOCKED_READ_REG(X, Y)   \
+   addr = (adapter-ahw.pci_base + X); \
+   *(u32 *)Y = readl((void __iomem*) addr);
+
+struct netxen_port;
+void netxen_nic_set_link_parameters(struct netxen_port *port);
+void netxen_nic_flash_print(struct netxen_adapter *adapter);
+int netxen_nic_hw_write_wx(struct netxen_adapter *adapter, u64 off,
+  void *data, int len);
+void netxen_crb_writelit_adapter(struct netxen_adapter *adapter,
+unsigned long off, int data);
+int netxen_nic_hw_read_wx(struct netxen_adapter *adapter, u64 off,
+ void *data, int len);
+
+typedef u8 netxen_ethernet_macaddr_t[6];
+
+/* Nibble or Byte mode for phy interface (GbE mode only) */
+typedef enum {
+   NETXEN_NIU_10_100_MB = 0,
+   NETXEN_NIU_1000_MB
+} netxen_niu_gbe_ifmode_t;
+
+#define _netxen_crb_get_bit(var, bit)  ((var  bit)  0x1)
+
+/*
+ * NIU GB MAC Config Register 0 (applies to GB0, GB1, GB2, GB3)
+ *
+ * Bit 0 : enable_tx = 1:enable frame xmit, 0:disable
+ * Bit 1 : tx_synced = R/O: xmit enable synched to xmit stream
+ * Bit 2 : enable_rx = 1:enable frame recv, 0:disable
+ * Bit 3 : rx_synced = R/O: recv enable synched to recv stream
+ * Bit 4 : tx_flowctl = 1:enable pause frame generation, 0:disable
+ * Bit 5 : rx_flowctl = 1:act on recv'd pause frames, 0:ignore
+ * Bit 8 : loopback = 1:loop MAC xmits to MAC recvs, 0:normal
+ * Bit 16: tx_reset_pb = 1:reset frame xmit protocol blk, 0:no-op
+ * Bit 17: rx_reset_pb = 1:reset frame recv protocol blk, 0:no-op
+ * Bit 18: tx_reset_mac = 1:reset data/ctl multiplexer blk, 0:no-op
+ * Bit 19: rx_reset_mac = 1:reset ctl frames  timers blk, 0:no-op
+ * Bit 31: soft_reset = 1:reset the MAC and the SERDES, 0:no-op
+ */
+
+#define netxen_gb_enable_tx(config_word)   \
+   set_bit(0, (unsigned long*)(config_word))
+#define netxen_gb_enable_rx(config_word)   \
+   set_bit(2, (unsigned long*)(config_word))
+#define netxen_gb_tx_flowctl(config_word)  \
+   set_bit(4, (unsigned long*)(config_word))
+#define 

[PATCH 10/14] d80211: fix iwconfig key [x] behavior

2006-09-27 Thread Jiri Benc
From: Hong Liu [EMAIL PROTECTED]

iwconfig key [x] behavior is not correctly handled in the stack, also
modify the giwencode method to show the key info.

Signed-off-by: Hong Liu [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211_ioctl.c |   32 +---
 1 files changed, 21 insertions(+), 11 deletions(-)

ad8c3766f67df906ff45143d393c924ad7297471
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index 34fdf40..b47a014 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -2867,9 +2867,10 @@ static int ieee80211_ioctl_siwencode(str
if (!sdata-default_key)
idx = 0;
else for (i = 0; i  NUM_DEFAULT_KEYS; i++) {
-   if (sdata-default_key == sdata-keys[i])
+   if (sdata-default_key == sdata-keys[i]) {
idx = i;
-   break;
+   break;
+   }
}
if (idx  0)
return -EINVAL;
@@ -2880,16 +2881,21 @@ static int ieee80211_ioctl_siwencode(str
alg = ALG_NONE;
else if (erq-length == 0) {
/* No key data - just set the default TX key index */
-   sdata-default_key = sdata-keys[idx];
+   if (sdata-default_key != sdata-keys[idx]) {
+   if (sdata-default_key)
+   ieee80211_key_sysfs_remove_default(sdata);
+   sdata-default_key = sdata-keys[idx];
+   if (sdata-default_key)
+   ieee80211_key_sysfs_add_default(sdata);
+   }
+   return 0;
}
 
return ieee80211_set_encryption(
dev, bcaddr,
-   idx, erq-length == 0 ? ALG_NONE : ALG_WEP,
+   idx, alg,
!sdata-default_key,
NULL, keybuf, erq-length);
-
-   return 0;
 }
 
 
@@ -2908,9 +2914,10 @@ static int ieee80211_ioctl_giwencode(str
if (!sdata-default_key)
idx = 0;
else for (i = 0; i  NUM_DEFAULT_KEYS; i++) {
-   if (sdata-default_key == sdata-keys[i])
+   if (sdata-default_key == sdata-keys[i]) {
idx = i;
-   break;
+   break;
+   }
}
if (idx  0)
return -EINVAL;
@@ -2925,7 +2932,9 @@ static int ieee80211_ioctl_giwencode(str
return 0;
}
 
-   erq-length = 0;
+   memcpy(key, sdata-keys[idx]-key,
+  min((int)erq-length, sdata-keys[idx]-keylen));
+   erq-length = sdata-keys[idx]-keylen;
erq-flags |= IW_ENCODE_ENABLED;
 
return 0;
@@ -3054,9 +3063,10 @@ static int ieee80211_ioctl_siwencodeext(
if (!sdata-default_key)
idx = 0;
else for (i = 0; i  NUM_DEFAULT_KEYS; i++) {
-   if (sdata-default_key == sdata-keys[i])
+   if (sdata-default_key == sdata-keys[i]) {
idx = i;
-   break;
+   break;
+   }
}
if (idx  0)
return -EINVAL;
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/14] d80211: fix wpa_supplicant reassoc problem

2006-09-27 Thread Jiri Benc
From: Hong Liu [EMAIL PROTECTED]

After key negotiation completed using wpa_supplicant, wpa_supplicant
can't reassoc with the AP if we reboot the AP. It always fails at the
4-way handshake.
The problem is the key info is not cleared correctly. Thus when
wpa_supplicant send the EAPOL-KEY packet, the d80211 stack finds the old
key and uses it to encrypt the packet.

The patch removes the sta_info when we disassociate with AP.

Signed-off-by: Hong Liu [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211_sta.c |2 ++
 net/d80211/sta_info.c  |8 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

25a49e579344602c14e4cf79fa95098b01e7cf27
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index a933d92..557ba17 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -710,6 +710,8 @@ static void ieee80211_associated(struct 
   range\n,
   dev-name, MAC_ARG(ifsta-bssid));
disassoc = 1;
+   sta_info_free(sta, 0);
+   ifsta-probereq_poll = 0;
} else {
ieee80211_send_probe_req(dev, ifsta-bssid,
 local-scan_ssid,
diff --git a/net/d80211/sta_info.c b/net/d80211/sta_info.c
index 622b234..5edbd0c 100644
--- a/net/d80211/sta_info.c
+++ b/net/d80211/sta_info.c
@@ -197,6 +197,12 @@ #ifdef CONFIG_D80211_VERBOSE_DEBUG
   local-mdev-name, MAC_ARG(sta-addr));
 #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 
+   if (sta-key) {
+   ieee80211_key_sysfs_remove(sta-key);
+   ieee80211_key_free(sta-key);
+   sta-key = NULL;
+   }
+
rate_control_remove_sta_attrs(local, sta-rate_ctrl_priv, sta-kobj);
ieee80211_sta_sysfs_remove(sta);
 
@@ -244,8 +250,6 @@ void sta_info_free(struct sta_info *sta,
kfree(key);
}
}
-   ieee80211_key_free(sta-key);
-   sta-key = NULL;
} else if (sta-key_idx_compression != HW_KEY_IDX_INVALID) {
struct ieee80211_key_conf conf;
memset(conf, 0, sizeof(conf));
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/14] d80211: add hardware scan callback

2006-09-27 Thread Jiri Benc
From: Hong Liu [EMAIL PROTECTED]

Add hardware scan callback to support cards like ipw3945 which
implements the scan command in firmware.

Signed-off-by: Hong Liu [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 include/net/d80211.h   |6 ++
 net/d80211/ieee80211_sta.c |   47 ++--
 2 files changed, 38 insertions(+), 15 deletions(-)

5b1756ecb9786baeb5127ca60cf0b3431e1d0e84
diff --git a/include/net/d80211.h b/include/net/d80211.h
index 42fdbf7..36c58b4 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -600,6 +600,10 @@ struct ieee80211_hw {
 int (*passive_scan)(struct net_device *dev, int state,
 struct ieee80211_scan_conf *conf);
 
+   /* Ask the hardware to service the scan request, no need to start
+* the scan state machine in stack. */
+   int (*hw_scan)(struct net_device *dev, u8 *ssid, size_t len);
+
 /* return low-level statistics */
int (*get_stats)(struct net_device *dev,
 struct ieee80211_low_level_stats *stats);
@@ -863,6 +867,8 @@ struct dev_mc_list *ieee80211_get_mc_lis
 struct ieee80211_conf *
 ieee80211_get_hw_conf(struct net_device *dev);
 
+/* called by driver to notify scan status completed */
+void ieee80211_scan_completed(struct net_device *dev);
 
 /* Return a pointer to the low-level private data area for the given device. */
 void * ieee80211_dev_hw_data(struct net_device *dev);
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 557ba17..1f60a22 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -2410,6 +2410,29 @@ static int ieee80211_active_scan(struct 
 }
 
 
+void ieee80211_scan_completed(struct net_device *dev)
+{
+   struct ieee80211_local *local = dev-ieee80211_ptr;
+   struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+   union iwreq_data wrqu;
+
+   printk(KERN_DEBUG %s: scan completed\n, dev-name);
+   local-sta_scanning = 0;
+   local-last_scan_completed = jiffies;
+
+   memset(wrqu, 0, sizeof(wrqu));
+   wireless_send_event(dev, SIOCGIWSCAN, wrqu, NULL);
+
+   if (sdata-type == IEEE80211_IF_TYPE_IBSS) {
+   struct ieee80211_if_sta *ifsta = sdata-u.sta;
+   if (!ifsta-bssid_set ||
+   (!ifsta-state == IEEE80211_IBSS_JOINED 
+   !ieee80211_sta_active_ibss(dev)))
+   ieee80211_sta_find_ibss(dev, ifsta);
+   }
+}
+EXPORT_SYMBOL(ieee80211_scan_completed);
+
 static void ieee80211_sta_scan_work(void *ptr)
 {
struct net_device *dev = ptr;
@@ -2418,7 +2441,6 @@ static void ieee80211_sta_scan_work(void
struct ieee80211_hw_modes *mode;
struct ieee80211_channel *chan;
int skip;
-   union iwreq_data wrqu;
unsigned long next_delay = 0;
 
if (!local-sta_scanning)
@@ -2435,20 +2457,8 @@ static void ieee80211_sta_scan_work(void
   operational channel after scan\n,
   dev-name);
}
-   printk(KERN_DEBUG %s: scan completed\n, dev-name);
-   local-sta_scanning = 0;
-   local-last_scan_completed = jiffies;
-   memset(wrqu, 0, sizeof(wrqu));
-   wireless_send_event(dev, SIOCGIWSCAN, wrqu, NULL);
-   if (sdata-type == IEEE80211_IF_TYPE_IBSS) {
-   struct ieee80211_sub_if_data *sdata =
-   IEEE80211_DEV_TO_SUB_IF(dev);
-   struct ieee80211_if_sta *ifsta = sdata-u.sta;
-   if (!ifsta-bssid_set ||
-   (ifsta-state == IEEE80211_IBSS_JOINED 
-!ieee80211_sta_active_ibss(dev)))
-   ieee80211_sta_find_ibss(dev, ifsta);
-   }
+
+   ieee80211_scan_completed(dev);
return;
}
skip = !(local-enabled_modes  (1  mode-mode));
@@ -2549,6 +2559,13 @@ int ieee80211_sta_req_scan(struct net_de
 
printk(KERN_DEBUG %s: starting scan\n, dev-name);
 
+   if (local-hw-hw_scan) {
+   int rc = local-hw-hw_scan(dev, ssid, ssid_len);
+   if (!rc)
+   local-sta_scanning = 1;
+   return rc;
+   }
+
ieee80211_sta_save_oper_chan(dev);
 
local-sta_scanning = 1;
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/14] d80211: use BUILD_BUG_ON

2006-09-27 Thread Jiri Benc
From: Johannes Berg [EMAIL PROTECTED]

This patch makes d80211 use BUILD_BUG_ON instead of checking at module
initialisation time. This check really is only interesting while you
hack since if the module was built, then it's either an 'always true' or
'always false' comparison, hence useless to do it at runtime.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c |9 ++---
 1 files changed, 2 insertions(+), 7 deletions(-)

156023b8efbec8a72f7077934d7b12cf1d00fb95
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 320272c..76ecad8 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4799,13 +4799,8 @@ static int __init ieee80211_init(void)
struct sk_buff *skb;
int ret;
 
-   if (sizeof(struct ieee80211_tx_packet_data)  (sizeof(skb-cb))) {
-   printk(80211: ieee80211_tx_packet_data is bigger 
-  than the skb-cb (%d  %d)\n,
-  (int) sizeof(struct ieee80211_tx_packet_data),
-  (int) sizeof(skb-cb));
-   return -EINVAL;
-   }
+   BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data)  sizeof(skb-cb));
+
if ((ret = ieee80211_sysfs_init())) {
printk(KERN_WARNING ieee80211_init: sysfs initialization 
   failed\n);
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/14] d80211: clean up those huge else if statements

2006-09-27 Thread Jiri Benc
From: Johannes Berg [EMAIL PROTECTED]

This patch replaces the if (...) else if (...) else if (...) ...
statements I complained about earlier with switches.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211_ioctl.c |   44 +-
 1 files changed, 22 insertions(+), 22 deletions(-)

361d9a9f51633c7128158d90a05a3b6cc43ee444
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index 89a58e3..34fdf40 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -1000,11 +1000,13 @@ static int ieee80211_ioctl_add_if(struct
 int left = param_len - ((u8 *) pos - (u8 *) param);
struct net_device *new_dev;
int res;
+   struct hostapd_if_wds *wds;
+   struct hostapd_if_bss *bss;
 
printk(KERN_WARNING PRISM2_HOSTAPD_ADD_IF ioctl is deprecated!);
-if (param-u.if_info.type == HOSTAP_IF_WDS) {
-struct hostapd_if_wds *wds =
-   (struct hostapd_if_wds *) param-u.if_info.data;
+   switch (param-u.if_info.type) {
+   case HOSTAP_IF_WDS:
+   wds = (struct hostapd_if_wds *) param-u.if_info.data;
 
 if (left  sizeof(struct hostapd_if_wds))
 return -EPROTO;
@@ -1018,7 +1020,7 @@ static int ieee80211_ioctl_add_if(struct
__ieee80211_if_del(dev-ieee80211_ptr,
   IEEE80211_DEV_TO_SUB_IF(new_dev));
return res;
-   } else if (param-u.if_info.type == HOSTAP_IF_VLAN) {
+   case HOSTAP_IF_VLAN:
if (left  sizeof(struct hostapd_if_vlan))
return -EPROTO;
 
@@ -1033,9 +1035,8 @@ #if 0
   IEEE80211_DEV_TO_SUB_IF(new_dev));
 #endif
return res;
-} else if (param-u.if_info.type == HOSTAP_IF_BSS) {
-struct hostapd_if_bss *bss =
-   (struct hostapd_if_bss *) param-u.if_info.data;
+   case HOSTAP_IF_BSS:
+   bss = (struct hostapd_if_bss *) param-u.if_info.data;
 
 if (left  sizeof(struct hostapd_if_bss))
 return -EPROTO;
@@ -1046,12 +1047,7 @@ #endif
ieee80211_if_set_type(new_dev, IEEE80211_IF_TYPE_AP);
memcpy(new_dev-dev_addr, bss-bssid, ETH_ALEN);
return 0;
-} else if (param-u.if_info.type == HOSTAP_IF_STA) {
-#if 0
-struct hostapd_if_sta *sta =
-   (struct hostapd_if_sta *) param-u.if_info.data;
-#endif
-
+   case HOSTAP_IF_STA:
 if (left  sizeof(struct hostapd_if_sta))
 return -EPROTO;
 
@@ -1060,34 +1056,38 @@ #endif
return res;
ieee80211_if_set_type(new_dev, IEEE80211_IF_TYPE_STA);
return 0;
-   } else
-return -EINVAL;
+   default:
+   return -EINVAL;
+   }
 
return 0;
 }
 
-
 static int ieee80211_ioctl_remove_if(struct net_device *dev,
 struct prism2_hostapd_param *param)
 {
unsigned int type;
 
-   if (param-u.if_info.type == HOSTAP_IF_WDS) {
+   switch (param-u.if_info.type) {
+   case HOSTAP_IF_WDS:
type = IEEE80211_IF_TYPE_WDS;
-   } else if (param-u.if_info.type == HOSTAP_IF_VLAN) {
+   break;
+   case HOSTAP_IF_VLAN:
type = IEEE80211_IF_TYPE_VLAN;
-   } else if (param-u.if_info.type == HOSTAP_IF_BSS) {
+   break;
+   case HOSTAP_IF_BSS:
type = IEEE80211_IF_TYPE_AP;
-   } else if (param-u.if_info.type == HOSTAP_IF_STA) {
+   break;
+   case HOSTAP_IF_STA:
type = IEEE80211_IF_TYPE_STA;
-   } else {
+   break;
+   default:
return -EINVAL;
}
 
return ieee80211_if_remove(dev, param-u.if_info.name, type);
 }
 
-
 static int ieee80211_ioctl_update_if(struct net_device *dev,
 struct prism2_hostapd_param *param,
 int param_len)
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/14] d80211: getting wrong freq value if we did hardware scan

2006-09-27 Thread Jiri Benc
From: Mohamed Abbas [EMAIL PROTECTED]

This patch modify d80211 to fix getting wrong frequency value
for scan implemented in hardware. With harware scan we might get
beacon of a network that is on different channel that in
local-conf.channel causing set freq to wrong value.

Signed-off-by: Mohamed Abbas [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211_sta.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

a5b4c8adb19c9d5d8b6c9b187ae6b2351e74e4a1
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 2e82405..dd95ce8 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1541,12 +1541,12 @@ #endif
}
 
 
-   bss-hw_mode = local-conf.phymode;
+   bss-hw_mode = rx_status-phymode;
bss-channel = channel;
-   bss-freq = local-conf.freq;
-   if (channel != local-conf.channel 
-   (local-conf.phymode == MODE_IEEE80211G ||
-local-conf.phymode == MODE_IEEE80211B) 
+   bss-freq = rx_status-freq;
+   if (channel != rx_status-channel 
+   (bss-hw_mode == MODE_IEEE80211G ||
+bss-hw_mode == MODE_IEEE80211B) 
channel = 1  channel = 14) {
static const int freq_list[] = {
2412, 2417, 2422, 2427, 2432, 2437, 2442,
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/14] d80211: fix multiple device ap support

2006-09-27 Thread Jiri Benc
From: David Kimdon [EMAIL PROTECTED]

Another fix to the interpretation of dev_alloc_name() return value.
dev_alloc_name() returns the number of the unit assigned or a negative
errno code.

Signed-off-by: David Kimdon [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211_iface.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

51539cf2d4fd958fa9a5ea282a9b7272353d0a49
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index bdff4cd..0a10c86 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -122,7 +122,7 @@ int ieee80211_if_add_mgmt(struct net_dev
if (!ndev)
return -ENOMEM;
ret = dev_alloc_name(ndev, wmgmt%d);
-   if (ret)
+   if (ret  0)
goto fail;
 
ndev-ieee80211_ptr = local;
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/14] d80211: Fix type of prism2_hostapd_param crypt.alg

2006-09-27 Thread Jiri Benc
From: David Kimdon [EMAIL PROTECTED]

crypt.alg is a string, use the correct type.

Signed-off-by: David Kimdon [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/hostapd_ioctl.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

2c9c2aa6731a429574a987c26769466a19373359
diff --git a/net/d80211/hostapd_ioctl.h b/net/d80211/hostapd_ioctl.h
index 7c7305c..d302790 100644
--- a/net/d80211/hostapd_ioctl.h
+++ b/net/d80211/hostapd_ioctl.h
@@ -207,7 +207,7 @@ #define IEEE80211_STA_DYNAMIC_ENC BIT(0)
u32 last_ack_rssi;
} get_info_sta;
struct {
-   u8 alg[HOSTAP_CRYPT_ALG_NAME_LEN];
+   char alg[HOSTAP_CRYPT_ALG_NAME_LEN];
u32 flags;
u32 err;
u8 idx;
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/14] d80211: diplay supported rates in readable format

2006-09-27 Thread Jiri Benc
From: mabbas [EMAIL PROTECTED]

This patch modify d80211 to report supported rates in readable
format in iwlist scan command.

Signed-off-by: Mohamed Abbas [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211_sta.c |   24 +++-
 1 files changed, 15 insertions(+), 9 deletions(-)

f99ee9c93d75118c2dc54085ff2218407bd8601c
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 1f60a22..92cbad7 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -2733,15 +2733,21 @@ ieee80211_sta_scan_result(struct net_dev
current_ev = iwe_stream_add_point(current_ev, end_buf, iwe,
  buf);
 
-   p = buf;
-   p += sprintf(p, supp_rates=);
-   for (i = 0; i  bss-supp_rates_len; i++)
-   p+= sprintf(p, %02x, bss-supp_rates[i]);
-   memset(iwe, 0, sizeof(iwe));
-   iwe.cmd = IWEVCUSTOM;
-   iwe.u.data.length = strlen(buf);
-   current_ev = iwe_stream_add_point(current_ev, end_buf, iwe,
- buf);
+   /* dispaly all support rates in readable format */
+   p = current_ev + IW_EV_LCP_LEN;
+   iwe.cmd = SIOCGIWRATE;
+   /* Those two flags are ignored... */
+   iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+
+   for (i = 0; i  bss-supp_rates_len; i++) {
+   iwe.u.bitrate.value = ((bss-supp_rates[i] 
+   0x7f) * 50);
+   p = iwe_stream_add_value(current_ev, p,
+   end_buf, iwe, IW_EV_PARAM_LEN);
+   }
+   /* Check if we added any rate */
+   if((p - current_ev)  IW_EV_LCP_LEN)
+   current_ev = p;
 
kfree(buf);
break;
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/14] d80211: fix invalid pointer dereference

2006-09-27 Thread Jiri Benc
When deleted_sta_list is nonempty and sta_list is empty in
sta_info_proc_add_task, an invalid sta pointer is dereferenced.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/sta_info.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

388092c43ba32071c0102c28e2cf43c0dc782566
diff --git a/net/d80211/sta_info.c b/net/d80211/sta_info.c
index 9397c48..a326c4a 100644
--- a/net/d80211/sta_info.c
+++ b/net/d80211/sta_info.c
@@ -354,13 +354,14 @@ static void sta_info_proc_add_task(void 
}
 
while (1) {
+   sta = NULL;
spin_lock_bh(local-sta_lock);
-   list_for_each_entry_safe(sta, tmp, local-sta_list, list) {
-   if (!sta-sysfs_registered) {
+   list_for_each_entry(tmp, local-sta_list, list) {
+   if (!tmp-sysfs_registered) {
+   sta = tmp;
__sta_info_get(sta);
break;
}
-   sta = NULL;
}
spin_unlock_bh(local-sta_lock);
 
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.18 8/9] NetXen: Header file and ioctl header file

2006-09-27 Thread Amit S. Kale

diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/netxen_nic_hdr.h 
linux-2.6.18/drivers/net/netxen/netxen_nic_hdr.h
--- linux-2.6.18.orig/drivers/net/netxen/netxen_nic_hdr.h   1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/netxen_nic_hdr.h2006-09-25 
05:04:07.0 -0700
@@ -0,0 +1,618 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * 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., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ */
+
+#ifndef __NETXEN_NIC_HDR_H_
+#define __NETXEN_NIC_HDR_H_
+
+#include linux/module.h
+#include linux/kernel.h
+#include linux/config.h
+#include linux/version.h
+
+#include asm/semaphore.h
+#include linux/spinlock.h
+#include asm/irq.h
+#include linux/init.h
+#include linux/errno.h
+#include linux/pci.h
+#include linux/types.h
+#include asm/uaccess.h
+#include asm/string.h  /* for memset */
+
+/*
+ * The basic unit of access when reading/writing control registers.
+ */
+
+typedef __le32 netxen_crbword_t;   /* single word in CRB space */
+
+enum {
+   NETXEN_HW_H0_CH_HUB_ADR = 0x05,
+   NETXEN_HW_H1_CH_HUB_ADR = 0x0E,
+   NETXEN_HW_H2_CH_HUB_ADR = 0x03,
+   NETXEN_HW_H3_CH_HUB_ADR = 0x01,
+   NETXEN_HW_H4_CH_HUB_ADR = 0x06,
+   NETXEN_HW_H5_CH_HUB_ADR = 0x07,
+   NETXEN_HW_H6_CH_HUB_ADR = 0x08
+};
+
+/*  Hub 0 */
+enum {
+   NETXEN_HW_MN_CRB_AGT_ADR = 0x15,
+   NETXEN_HW_MS_CRB_AGT_ADR = 0x25
+};
+
+/*  Hub 1 */
+enum {
+   NETXEN_HW_PS_CRB_AGT_ADR = 0x73,
+   NETXEN_HW_SS_CRB_AGT_ADR = 0x20,
+   NETXEN_HW_RPMX3_CRB_AGT_ADR = 0x0b,
+   NETXEN_HW_QMS_CRB_AGT_ADR = 0x00,
+   NETXEN_HW_SQGS0_CRB_AGT_ADR = 0x01,
+   NETXEN_HW_SQGS1_CRB_AGT_ADR = 0x02,
+   NETXEN_HW_SQGS2_CRB_AGT_ADR = 0x03,
+   NETXEN_HW_SQGS3_CRB_AGT_ADR = 0x04,
+   NETXEN_HW_C2C0_CRB_AGT_ADR = 0x58,
+   NETXEN_HW_C2C1_CRB_AGT_ADR = 0x59,
+   NETXEN_HW_C2C2_CRB_AGT_ADR = 0x5a,
+   NETXEN_HW_RPMX2_CRB_AGT_ADR = 0x0a,
+   NETXEN_HW_RPMX4_CRB_AGT_ADR = 0x0c,
+   NETXEN_HW_RPMX7_CRB_AGT_ADR = 0x0f,
+   NETXEN_HW_RPMX9_CRB_AGT_ADR = 0x12,
+   NETXEN_HW_SMB_CRB_AGT_ADR = 0x18
+};
+
+/*  Hub 2 */
+enum {
+   NETXEN_HW_NIU_CRB_AGT_ADR = 0x31,
+   NETXEN_HW_I2C0_CRB_AGT_ADR = 0x19,
+   NETXEN_HW_I2C1_CRB_AGT_ADR = 0x29,
+
+   NETXEN_HW_SN_CRB_AGT_ADR = 0x10,
+   NETXEN_HW_I2Q_CRB_AGT_ADR = 0x20,
+   NETXEN_HW_LPC_CRB_AGT_ADR = 0x22,
+   NETXEN_HW_ROMUSB_CRB_AGT_ADR = 0x21,
+   NETXEN_HW_QM_CRB_AGT_ADR = 0x66,
+   NETXEN_HW_SQG0_CRB_AGT_ADR = 0x60,
+   NETXEN_HW_SQG1_CRB_AGT_ADR = 0x61,
+   NETXEN_HW_SQG2_CRB_AGT_ADR = 0x62,
+   NETXEN_HW_SQG3_CRB_AGT_ADR = 0x63,
+   NETXEN_HW_RPMX1_CRB_AGT_ADR = 0x09,
+   NETXEN_HW_RPMX5_CRB_AGT_ADR = 0x0d,
+   NETXEN_HW_RPMX6_CRB_AGT_ADR = 0x0e,
+   NETXEN_HW_RPMX8_CRB_AGT_ADR = 0x11
+};
+
+/*  Hub 3 */
+enum {
+   NETXEN_HW_PH_CRB_AGT_ADR = 0x1A,
+   NETXEN_HW_SRE_CRB_AGT_ADR = 0x50,
+   NETXEN_HW_EG_CRB_AGT_ADR = 0x51,
+   NETXEN_HW_RPMX0_CRB_AGT_ADR = 0x08
+};
+
+/*  Hub 4 */
+enum {
+   NETXEN_HW_PEGN0_CRB_AGT_ADR = 0x40,
+   NETXEN_HW_PEGN1_CRB_AGT_ADR,
+   NETXEN_HW_PEGN2_CRB_AGT_ADR,
+   NETXEN_HW_PEGN3_CRB_AGT_ADR,
+   NETXEN_HW_PEGNI_CRB_AGT_ADR,
+   NETXEN_HW_PEGND_CRB_AGT_ADR,
+   NETXEN_HW_PEGNC_CRB_AGT_ADR,
+   NETXEN_HW_PEGR0_CRB_AGT_ADR,
+   NETXEN_HW_PEGR1_CRB_AGT_ADR,
+   NETXEN_HW_PEGR2_CRB_AGT_ADR,
+   NETXEN_HW_PEGR3_CRB_AGT_ADR
+};
+
+/*  Hub 5 */
+enum {
+   NETXEN_HW_PEGS0_CRB_AGT_ADR = 0x40,
+   NETXEN_HW_PEGS1_CRB_AGT_ADR,
+   NETXEN_HW_PEGS2_CRB_AGT_ADR,
+   NETXEN_HW_PEGS3_CRB_AGT_ADR,
+   NETXEN_HW_PEGSI_CRB_AGT_ADR,
+   NETXEN_HW_PEGSD_CRB_AGT_ADR,
+   NETXEN_HW_PEGSC_CRB_AGT_ADR
+};
+
+/*  Hub 6 */
+enum {
+   NETXEN_HW_CAS0_CRB_AGT_ADR = 0x46,
+   NETXEN_HW_CAS1_CRB_AGT_ADR = 0x47,
+   NETXEN_HW_CAS2_CRB_AGT_ADR = 0x48,
+   NETXEN_HW_CAS3_CRB_AGT_ADR = 0x49,
+   NETXEN_HW_NCM_CRB_AGT_ADR = 0x16,
+ 

[PATCH] d80211: fix is_ieee80211_device

2006-09-27 Thread Jiri Benc
The is_ieee80211_device function must ensure that the passed net_device
belongs to the hardware device we are working with.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---
 net/d80211/ieee80211.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

--- dscape.orig/net/d80211/ieee80211.c
+++ dscape/net/d80211/ieee80211.c
@@ -1123,9 +1123,10 @@ __ieee80211_tx_prepare(struct ieee80211_
 
 }
 
-static int inline is_ieee80211_device(struct net_device *dev)
+static int inline is_ieee80211_device(struct net_device *dev,
+ struct net_device *master)
 {
-   return (dev-ieee80211_ptr != NULL);
+   return (dev-ieee80211_ptr == master-ieee80211_ptr);
 }
 
 /* Device in tx-dev has a reference added; use dev_put(tx-dev) when
@@ -1140,7 +1141,7 @@ static void inline ieee80211_tx_prepare(
 
pkt_data = (struct ieee80211_tx_packet_data *)skb-cb;
dev = dev_get_by_index(pkt_data-ifindex);
-   if (unlikely(dev  !is_ieee80211_device(dev))) {
+   if (unlikely(dev  !is_ieee80211_device(dev, mdev))) {
dev_put(dev);
dev = NULL;
}
@@ -1395,7 +1396,7 @@ static int ieee80211_master_start_xmit(s
 
if (pkt_data-ifindex)
odev = dev_get_by_index(pkt_data-ifindex);
-   if (unlikely(odev  !is_ieee80211_device(odev))) {
+   if (unlikely(odev  !is_ieee80211_device(odev, dev))) {
dev_put(odev);
odev = NULL;
}


-- 
Jiri Benc
SUSE Labs
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.18 9/9] NetXen: CRB reg definitions

2006-09-27 Thread Amit S. Kale

diff -Narup -X linux-2.6.18.orig/Documentation/dontdiff 
linux-2.6.18.orig/drivers/net/netxen/netxen_nic_phan_reg.h 
linux-2.6.18/drivers/net/netxen/netxen_nic_phan_reg.h
--- linux-2.6.18.orig/drivers/net/netxen/netxen_nic_phan_reg.h  1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18/drivers/net/netxen/netxen_nic_phan_reg.h   2006-09-25 
05:04:07.0 -0700
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * 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., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ */
+
+#ifndef __NIC_PHAN_REG_H_
+#define __NIC_PHAN_REG_H_
+
+/* 
+ * CRB Registers or queue message done only at initialization time.

+ */
+
+/*
+ * The following 2 are the base adresses for the CRB registers and their
+ * offsets will be added to get addresses for the index addresses.
+ */
+#define NIC_CRB_BASE_PORT1 NETXEN_CAM_RAM(0x200)
+#define NIC_CRB_BASE_PORT2 NETXEN_CAM_RAM(0x250)
+
+#define NETXEN_NIC_REG(X)  (NIC_CRB_BASE_PORT1+(X))
+
+/*
+ * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address
+ * which can be read by the Phantom host to get producer/consumer indexes from
+ * Phantom/Casper. If it is not HOST_SHARED_MEMORY, then the following
+ * registers will be used for the addresses of the ring's shared memory
+ * on the Phantom.
+ */
+
+#define CRB_PHAN_CNTRL_LO_OFFSET   NETXEN_NIC_REG(0x00)
+#define CRB_PHAN_CNTRL_HI_OFFSET   NETXEN_NIC_REG(0x04)
+
+/* point to the indexes */
+#define CRB_CMD_PRODUCER_OFFSETNETXEN_NIC_REG(0x08)
+#define CRB_CMD_CONSUMER_OFFSETNETXEN_NIC_REG(0x0c)
+
+/* address of command descriptors in the host memory */
+#define CRB_HOST_CMD_ADDR_HI   NETXEN_NIC_REG(0x30)
+#define CRB_HOST_CMD_ADDR_LO   NETXEN_NIC_REG(0x34)
+
+/* The following 4 CRB registers are for doing performance coal */
+#define CRB_CMD_INTR_LOOP  NETXEN_NIC_REG(0x38)
+#define CRB_CMD_DMA_LOOP   NETXEN_NIC_REG(0x3c)
+#define CRB_RCV_INTR_LOOP  NETXEN_NIC_REG(0x40)
+#define CRB_RCV_DMA_LOOP   NETXEN_NIC_REG(0x44)
+
+/* Needed by the host to find out the state of Phantom's initialization */
+#define CRB_ENABLE_TX_INTR NETXEN_NIC_REG(0x4c)
+#define CRB_CMDPEG_STATE   NETXEN_NIC_REG(0x50)
+#define CRB_CMDPEG_CMDRING NETXEN_NIC_REG(0x54)
+
+/* Interrupt coalescing parameters */
+#define CRB_GLOBAL_INT_COALNETXEN_NIC_REG(0x80)
+#define CRB_INT_COAL_MODE  NETXEN_NIC_REG(0x84)
+#define CRB_MAX_RCV_BUFS   NETXEN_NIC_REG(0x88)
+#define CRB_TX_INT_THRESHOLD   NETXEN_NIC_REG(0x8c)
+#define CRB_RX_PKT_TIMER   NETXEN_NIC_REG(0x90)
+#define CRB_TX_PKT_TIMER   NETXEN_NIC_REG(0x94)
+#define CRB_RX_PKT_CNT NETXEN_NIC_REG(0x98)
+#define CRB_RX_TMR_CNT NETXEN_NIC_REG(0x9c)
+
+/* Register for communicating XG link status */
+#define CRB_XG_STATE   NETXEN_NIC_REG(0xa0)
+
+/* Debug registers for controlling NIC pkt gen agent */
+#define CRB_AGENT_GO   NETXEN_NIC_REG(0xb0)
+#define CRB_AGENT_TX_SIZE  NETXEN_NIC_REG(0xb4)
+#define CRB_AGENT_TX_TYPE  NETXEN_NIC_REG(0xb8)
+#define CRB_AGENT_TX_ADDR  NETXEN_NIC_REG(0xbc)
+#define CRB_AGENT_TX_MSS   NETXEN_NIC_REG(0xc0)
+
+/* Debug registers for observing NIC performance */
+#define CRB_TX_STATE   NETXEN_NIC_REG(0xd0)
+#define CRB_TX_COUNT   NETXEN_NIC_REG(0xd4)
+#define CRB_RX_STATE   NETXEN_NIC_REG(0xd8)
+
+/* CRB registers per Rcv Descriptor ring */
+struct netxen_rcv_desc_crb {
+   u32 crb_rcv_producer_offset __attribute__ ((aligned(512)));
+   u32 crb_rcv_consumer_offset;
+   u32 crb_globalrcv_ring;
+};
+
+/*
+ * CRB registers used by the receive peg logic. One instance of these
+ * needs to be instantiated per instance of the receive peg.
+ */
+
+struct netxen_recv_crb {
+   struct netxen_rcv_desc_crb 

Re: mii-tool gigabit support.

2006-09-27 Thread Jeff Kirsher

On 9/27/06, Auke Kok [EMAIL PROTECTED] wrote:

David Acker wrote:

 mii-tool supports some things that ethtool does not.  mii-tool -A lets
 you set the advertised speeds and can include a list of speeds.  The
 closest ethtool seems to have is ethtool -s but that seems to just set
 the advertised speed to a single value only.

We sent a patch for this to Jeff recently that allows setting of 'arbitrary'
speeds. Unfortunately the interface is rather crude but it works (for e1000,
and possibly all other nics) to set any combination of advertised speeds.

e.g. `ethtool -s eth0 advertise 0x0f` advertises all non-gigabit speeds

I haven't seen the patch merged yet upstream though.

Cheers,

Auke


 We have instances where we want to limit the link of the ethernet port
 to no higher then 10 Mbps full duplex but also advertise support for
 half duplex.

 With mii-tool we can do the command below and work with a half duplex
 hub and a full duplex switch.
 mii-tool -A 10baseT-FD,10baseT-HD eth0

 Meanwhile if I use ethtool like the command below I will not work with a
 half duplex only hub.
 ethtool -s eth0 speed 10 duplex full autoneg on

 Perhaps the speed part of ethtool -s should take a list of speeds like
 mii-tool does.

 -Ack


Garzik has ACK and pulled in the ethtool patch which allows you to set
multiple auto-negotiation advertised speeds.

--
Cheers,
Jeff
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] softmac: Fix WX and association related races

2006-09-27 Thread Larry Finger

Michael Buesch wrote:

This fixes some race conditions in the WirelessExtension
handling and association handling code.

Signed-off-by: Michael Buesch [EMAIL PROTECTED]

---


This patch doesn't apply.


Index: wireless-2.6/net/ieee80211/softmac/ieee80211softmac_wx.c
===
--- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_wx.c   
2006-09-17 15:21:53.0 +0200
+++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_wx.c2006-09-27 
16:49:25.0 +0200
@@ -73,13 +73,14 @@ ieee80211softmac_wx_set_essid(struct net
struct ieee80211softmac_network *n;
struct ieee80211softmac_auth_queue_item *authptr;
int length = 0;
-   unsigned long flags;
+
+   mutex_lock(sm-associnfo.mutex);
 
 	/* Check if we're already associating to this or another network

 * If it's another network, cancel and start over with our new network
 * If it's our network, ignore the change, we're already doing it!
 */
-   if((sm-associnfo.associating || sm-associated) 
+   if((sm-associnfo.associating || sm-associnfo.associated) 
   (data-essid.flags  data-essid.length  extra)) {

   ^

The marked stuff is not in my copy of wireless-2.6. Is mine hosed?

Larry


/* Get the associating network */
n = ieee80211softmac_get_network_by_bssid(sm, 
sm-associnfo.bssid);
@@ -87,10 +88,9 @@ ieee80211softmac_wx_set_essid(struct net
   !memcmp(n-essid.data, extra, n-essid.len)) {
dprintk(KERN_INFO PFX Already associating or associated to 
MAC_FMT\n,
MAC_ARG(sm-associnfo.bssid));
-   return 0;
+   goto out;
} else {
dprintk(KERN_INFO PFX Canceling existing associate 
request!\n);
-   spin_lock_irqsave(sm-lock,flags);
/* Cancel assoc work */
cancel_delayed_work(sm-associnfo.work);
/* We don't have to do this, but it's a little cleaner 
*/
@@ -98,14 +98,13 @@ ieee80211softmac_wx_set_essid(struct net
cancel_delayed_work(authptr-work);
sm-associnfo.bssvalid = 0;
sm-associnfo.bssfixed = 0;
-   spin_unlock_irqrestore(sm-lock,flags);
flush_scheduled_work();
+   sm-associnfo.associating = 0;
+   sm-associnfo.associated = 0;
}
}
 
 
-	spin_lock_irqsave(sm-lock, flags);

-
sm-associnfo.static_essid = 0;
sm-associnfo.assoc_wait = 0;
 
@@ -121,10 +120,12 @@ ieee80211softmac_wx_set_essid(struct net

 * If applicable, we have already copied the data in */
sm-associnfo.req_essid.len = length;
 
+	sm-associnfo.associating = 1;

/* queue lower level code to do work (if necessary) */
schedule_work(sm-associnfo.work);
+out:
+   mutex_unlock(sm-associnfo.mutex);
 
-	spin_unlock_irqrestore(sm-lock, flags);

return 0;
 }
 EXPORT_SYMBOL_GPL(ieee80211softmac_wx_set_essid);
@@ -136,10 +137,8 @@ ieee80211softmac_wx_get_essid(struct net
  char *extra)
 {
struct ieee80211softmac_device *sm = ieee80211_priv(net_dev);
-   unsigned long flags;
 
-	/* avoid getting inconsistent information */

-   spin_lock_irqsave(sm-lock, flags);
+   mutex_lock(sm-associnfo.mutex);
/* If all fails, return ANY (empty) */
data-essid.length = 0;
data-essid.flags = 0;  /* active */
@@ -152,12 +151,13 @@ ieee80211softmac_wx_get_essid(struct net
}

/* If we're associating/associated, return that */
-   if (sm-associated || sm-associnfo.associating) {
+   if (sm-associnfo.associated || sm-associnfo.associating) {
data-essid.length = sm-associnfo.associate_essid.len;
data-essid.flags = 1;  /* active */
memcpy(extra, sm-associnfo.associate_essid.data, 
sm-associnfo.associate_essid.len);
}
-   spin_unlock_irqrestore(sm-lock, flags);
+   mutex_unlock(sm-associnfo.mutex);
+
return 0;
 }
 EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_essid);
@@ -322,15 +322,15 @@ ieee80211softmac_wx_get_wap(struct net_d
 {
struct ieee80211softmac_device *mac = ieee80211_priv(net_dev);
int err = 0;
-   unsigned long flags;
 
-	spin_lock_irqsave(mac-lock, flags);

+   mutex_lock(mac-associnfo.mutex);
if (mac-associnfo.bssvalid)
memcpy(data-ap_addr.sa_data, mac-associnfo.bssid, ETH_ALEN);
else
memset(data-ap_addr.sa_data, 0xff, ETH_ALEN);
data-ap_addr.sa_family = ARPHRD_ETHER;
-   spin_unlock_irqrestore(mac-lock, flags);
+   

Re: [take19 0/4] kevent: Generic event handling mechanism.

2006-09-27 Thread Evgeniy Polyakov
On Wed, Sep 20, 2006 at 01:35:47PM +0400, Evgeniy Polyakov ([EMAIL PROTECTED]) 
wrote:
 
 Generic event handling mechanism.
 
 Consider for inclusion.

I have been told in private what is signal masks about - just to wait
until either signal or given condition is ready, but in that case just 
add additional kevent user like AIO complete or netwrok notification 
and wait until either requested events are ready or signal is triggered.

-- 
Evgeniy Polyakov
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread Rick Jones
With mii-tool we can do the command below and work with a half duplex 
hub and a full duplex switch.

mii-tool -A 10baseT-FD,10baseT-HD eth0


Why, and how often, is that really necessary?

rick jones
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] skge: fiber support

2006-09-27 Thread Stephen Hemminger
On Wed, 27 Sep 2006 13:26:46 -0400
Michael Stone [EMAIL PROTECTED] wrote:

 Hmm. Yesterday I did some nfs testing (simple dd of a big file) with the 
 skge driver and got about 700+Mbps. I ran the same test today and got 
 160Mbps. I rebooted the client and got 700+Mbps again. About half an 
 hour later, down to 160Mbps again. Server  client were both idle, and 
 the server didn't change (no reboots). For reference, the sk98lin gets 
 around 600Mbps, consistently.
 
 Mike Stone

That's surprising, memory leak? dropped packets?

-- 
Stephen Hemminger [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread Auke Kok

Rick Jones wrote:
With mii-tool we can do the command below and work with a half duplex 
hub and a full duplex switch.

mii-tool -A 10baseT-FD,10baseT-HD eth0


Why, and how often, is that really necessary?


This is a bit of a hypothetical discussion of course, but I can imagine a lot 
of users with 100mbit switches in their homes (imagine all the DSL/cable 
routers out there...) that want to stop their nic from attempting to negotiate 
1000mbit.


Another scenario: forcing the NIC to negotiate only full-duplex speeds. Not 
only fun if you try it against a hub, but possibly useful.


For us it's much more interesting because we try every damn impossible 
configuration anyway and see what gives (or breaks).


Anyway, a patch to make ethtool do this was merged as Jeff Kirsher pointed out, 
so you can do this now with ethool too.


Cheers,

Auke
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread Rick Jones

Auke Kok wrote:

Rick Jones wrote:

With mii-tool we can do the command below and work with a half duplex 
hub and a full duplex switch.

mii-tool -A 10baseT-FD,10baseT-HD eth0



Why, and how often, is that really necessary?



This is a bit of a hypothetical discussion of course, but I can imagine 
a lot of users with 100mbit switches in their homes (imagine all the 
DSL/cable routers out there...) that want to stop their nic from 
attempting to negotiate 1000mbit.


That would be covered by autosense right?  IIRC there haven't been issues with 
speed sensing, just duplex negotiation right?


Another scenario: forcing the NIC to negotiate only full-duplex speeds. 
Not only fun if you try it against a hub, but possibly useful.


For us it's much more interesting because we try every damn impossible 
configuration anyway and see what gives (or breaks).


Anyway, a patch to make ethtool do this was merged as Jeff Kirsher 
pointed out, so you can do this now with ethool too.


I'm just worried (as in Fear Uncertainty and Doubt) that having people set the 
allowed things to negotiate isn't really any more robust than stright-up 
hardcodes and perpetuates the (IMO) myth that one shouldn't autoneg on general 
principle.


rick



Cheers,

Auke


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] softmac: Fix WX and association related races

2006-09-27 Thread Michael Buesch
On Wednesday 27 September 2006 18:18, Larry Finger wrote:
 Michael Buesch wrote:
  This fixes some race conditions in the WirelessExtension
  handling and association handling code.
  
  Signed-off-by: Michael Buesch [EMAIL PROTECTED]
  
  ---
 
 This patch doesn't apply.

Oh, linville merged stuff on the 25th. That's the day I updated
my tree to do this patch. But seems like I did it just before
the merge.
Who could suspect that linville merges something. :D
*me runs away*

Anyway. Here's an updated patch.


Index: wireless-2.6/include/net/ieee80211softmac.h
===
--- wireless-2.6.orig/include/net/ieee80211softmac.h2006-09-27 
19:34:20.0 +0200
+++ wireless-2.6/include/net/ieee80211softmac.h 2006-09-27 19:36:39.0 
+0200
@@ -63,13 +63,11 @@ struct ieee80211softmac_wpa {
 
 /*
  * Information about association
- *
- * Do we need a lock for this?
- * We only ever use this structure inlined
- * into our global struct. I've used its lock,
- * but maybe we need a local one here?
  */
 struct ieee80211softmac_assoc_info {
+
+   struct mutex mutex;
+
/*
 * This is the requested ESSID. It is written
 * only by the WX handlers.
@@ -99,12 +97,13 @@ struct ieee80211softmac_assoc_info {
 *
 * bssfixed is used for SIOCSIWAP.
 */
-   u8 static_essid:1,
-  short_preamble_available:1,
-  associating:1,
-  assoc_wait:1,
-  bssvalid:1,
-  bssfixed:1;
+   u8 static_essid;
+   u8 short_preamble_available;
+   u8 associating;
+   u8 associated;
+   u8 assoc_wait;
+   u8 bssvalid;
+   u8 bssfixed;
 
/* Scan retries remaining */
int scan_retry;
@@ -229,12 +228,10 @@ struct ieee80211softmac_device {
/* private stuff follows */
/* this lock protects this structure */
spinlock_t lock;
-   
-   /* couple of flags */
-   u8 scanning:1, /* protects scanning from being done multiple times at 
once */
-  associated:1,
-  running:1;
-   
+
+   u8 running; /* SoftMAC started? */
+   u8 scanning;
+
struct ieee80211softmac_scaninfo *scaninfo;
struct ieee80211softmac_assoc_info associnfo;
struct ieee80211softmac_bss_info bssinfo;
@@ -250,7 +247,7 @@ struct ieee80211softmac_device {
 
/* we need to keep a list of network structs we copied */
struct list_head network_list;
-   
+
/* This must be the last item so that it points to the data
 * allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -295,7 +292,7 @@ static inline u8 ieee80211softmac_sugges
 {
struct ieee80211softmac_txrates *txrates = mac-txrates;
 
-   if (!mac-associated)
+   if (!mac-associnfo.associated)
return txrates-mgt_mcast_rate;
 
/* We are associated, sending unicast frame */
Index: wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c
===
--- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_assoc.c
2006-09-27 19:34:20.0 +0200
+++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c 2006-09-27 
19:36:39.0 +0200
@@ -48,7 +48,7 @@ ieee80211softmac_assoc(struct ieee80211s
dprintk(KERN_INFO PFX sent association request!\n);
 
spin_lock_irqsave(mac-lock, flags);
-   mac-associated = 0; /* just to make sure */
+   mac-associnfo.associated = 0; /* just to make sure */
 
/* Set a timer for timeout */
/* FIXME: make timeout configurable */
@@ -62,24 +62,22 @@ ieee80211softmac_assoc_timeout(void *d)
 {
struct ieee80211softmac_device *mac = (struct ieee80211softmac_device 
*)d;
struct ieee80211softmac_network *n;
-   unsigned long flags;
 
-   spin_lock_irqsave(mac-lock, flags);
+   mutex_lock(mac-associnfo.mutex);
/* we might race against ieee80211softmac_handle_assoc_response,
 * so make sure only one of us does something */
-   if (!mac-associnfo.associating) {
-   spin_unlock_irqrestore(mac-lock, flags);
-   return;
-   }
+   if (!mac-associnfo.associating)
+   goto out;
mac-associnfo.associating = 0;
mac-associnfo.bssvalid = 0;
-   mac-associated = 0;
+   mac-associnfo.associated = 0;
 
n = ieee80211softmac_get_network_by_bssid_locked(mac, 
mac-associnfo.bssid);
-   spin_unlock_irqrestore(mac-lock, flags);
 
dprintk(KERN_INFO PFX assoc request timed out!\n);
ieee80211softmac_call_events(mac, 
IEEE80211SOFTMAC_EVENT_ASSOCIATE_TIMEOUT, n);
+out:
+   mutex_unlock(mac-associnfo.mutex);
 }
 
 void
@@ -93,7 +91,7 @@ ieee80211softmac_disassoc(struct ieee802
 
netif_carrier_off(mac-dev);
 
-   mac-associated = 0;
+   mac-associnfo.associated = 0;
mac-associnfo.bssvalid = 

Re: [PATCH] skge: fiber support

2006-09-27 Thread Stephen Hemminger
On Wed, 27 Sep 2006 13:59:02 -0400
Michael Stone [EMAIL PROTECTED] wrote:

 On Wed, Sep 27, 2006 at 10:34:15AM -0700, Stephen Hemminger wrote:
 That's surprising, memory leak? dropped packets?
 
 I'm open to suggestions on debugging it. It seems fairly repeatable 
 about half an hour after startup.
 
 Mike Stone

I'll run a longer test with SK card (Ebay) to E1000.

-- 
Stephen Hemminger [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] skge: fiber support

2006-09-27 Thread Michael Stone

On Wed, Sep 27, 2006 at 10:34:15AM -0700, Stephen Hemminger wrote:

That's surprising, memory leak? dropped packets?


I'm open to suggestions on debugging it. It seems fairly repeatable 
about half an hour after startup.


Mike Stone
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread Maciej W. Rozycki
On Wed, 27 Sep 2006, Rick Jones wrote:

  Another scenario: forcing the NIC to negotiate only full-duplex speeds. Not
  only fun if you try it against a hub, but possibly useful.
[...]
 I'm just worried (as in Fear Uncertainty and Doubt) that having people set the
 allowed things to negotiate isn't really any more robust than stright-up
 hardcodes and perpetuates the (IMO) myth that one shouldn't autoneg on general
 principle.

 Older equipment, which may still be in use here and there, allowed 
full-duplex operation, but no auto-negotiation.  The duplex setting was 
either fixed or selectable in a system-specific manner.  In such a case 
you certainly want your modern other end to be forced to full-duplex, but 
still let it detect the link speed, so that you do not have to do 
reconfiguration whenever you move a link between a 10base-T and a 
100base-Tx port.

  Maciej
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread Auke Kok

Maciej W. Rozycki wrote:

On Wed, 27 Sep 2006, Rick Jones wrote:


Another scenario: forcing the NIC to negotiate only full-duplex speeds. Not
only fun if you try it against a hub, but possibly useful.

[...]

I'm just worried (as in Fear Uncertainty and Doubt) that having people set the
allowed things to negotiate isn't really any more robust than stright-up
hardcodes and perpetuates the (IMO) myth that one shouldn't autoneg on general
principle.


 Older equipment, which may still be in use here and there, allowed 
full-duplex operation, but no auto-negotiation.  The duplex setting was 
either fixed or selectable in a system-specific manner.  In such a case 
you certainly want your modern other end to be forced to full-duplex, but 
still let it detect the link speed, so that you do not have to do 
reconfiguration whenever you move a link between a 10base-T and a 
100base-Tx port.


in this case the new addition to ethtool will not help as it only changes the 
modes that the NIC will advertise. In this specific case you will need to turn 
of advertising/autonegotiation and force a speed/duplex pair anyway.


Advertising all half-duplex modes to a partner that does not do autonegotiation 
is (by spec I think) an unsupported configuration (i.e. undetermined behaviour).


That's nothing new.

Auke
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] spidernet: Use pci_dma_mapping_error()

2006-09-27 Thread Olof Johansson
A driver shouldn't compare to DMA_ERROR_CODE directly, use
pci_dma_mapping_error() instead.


Signed-off-by: Olof Johansson [EMAIL PROTECTED]

Index: linux-2.6/drivers/net/spider_net.c
===
--- linux-2.6.orig/drivers/net/spider_net.c
+++ linux-2.6/drivers/net/spider_net.c
@@ -317,7 +317,7 @@ spider_net_init_chain(struct spider_net_
 SPIDER_NET_DESCR_SIZE,
 direction);
 
-   if (buf == DMA_ERROR_CODE)
+   if (pci_dma_mapping_error(buf))
goto iommu_error;
 
descr-bus_addr = buf;
@@ -420,7 +420,7 @@ spider_net_prepare_rx_descr(struct spide
buf = pci_map_single(card-pdev, descr-skb-data,
SPIDER_NET_MAX_FRAME, PCI_DMA_FROMDEVICE);
descr-buf_addr = buf;
-   if (buf == DMA_ERROR_CODE) {
+   if (pci_dma_mapping_error(buf)) {
dev_kfree_skb_any(descr-skb);
if (netif_msg_rx_err(card)  net_ratelimit())
pr_err(Could not iommu-map rx buffer\n);
@@ -649,7 +649,7 @@ spider_net_prepare_tx_descr(struct spide
dma_addr_t buf;
 
buf = pci_map_single(card-pdev, skb-data, skb-len, PCI_DMA_TODEVICE);
-   if (buf == DMA_ERROR_CODE) {
+   if (pci_dma_mapping_error(buf)) {
if (netif_msg_tx_err(card)  net_ratelimit())
pr_err(could not iommu-map packet (%p, %i). 
  Dropping packet\n, skb-data, skb-len);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread dean gaudet
On Tue, 26 Sep 2006, Stephen Hemminger wrote:

 The mii-tool utility seems to be abandoned and unmaintained?
 
 Here is a version that does standard 1000baseT support.
   http://developer.osdl.org/shemminger/prototypes/mii-tool.tar.bz2

cool that's bugged me for a while...

there's an off-by-1 for the non-verbose basic output -- you need register 
10 but only read up to register 9.  patch below.

tested on various mobos with e1000, tg3, skge.

oh, two of my tyans show this (one e1000 one tg3):

  product info: vendor 00:08:18, model 25 rev 0

but i'm not physically at the boards so i can't find the PHY to see what 
model it is.

-dean


Index: mii-tool/mii-tool.c
===
--- mii-tool.orig/mii-tool.c2006-09-26 14:44:56.0 -0700
+++ mii-tool/mii-tool.c 2006-09-27 12:05:03.0 -0700
@@ -233,7 +233,7 @@
 /* Some bits in the BMSR are latched, but we can't rely on being
the only reader, so only the current values are meaningful */
 mdio_read(sock, MII_BMSR);
-for (i = 0; i  ((verbose  1) ? 32 : 10); i++)
+for (i = 0; i  ((verbose  1) ? 32 : MII_BASIC_MAX); i++)
mii_val[i] = mdio_read(sock, i);
 
 if (mii_val[MII_BMCR] == 0x) {
Index: mii-tool/mii.h
===
--- mii-tool.orig/mii.h 2006-09-26 14:44:59.0 -0700
+++ mii-tool/mii.h  2006-09-27 12:05:56.0 -0700
@@ -94,4 +94,7 @@
 #define   MII_LPA2_1000FULL0x0800
 #define   MII_LPA2_1000HALF0x0400
 
+/* Last register we need for show_basic_mii() */
+#define MII_BASIC_MAX  (MII_STAT1000+1)
+
 #endif /* _LINUX_MII_H */
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread dean gaudet
On Tue, 26 Sep 2006, Jeff Garzik wrote:

 Stephen Hemminger wrote:
  The mii-tool utility seems to be abandoned and unmaintained?
  
  Here is a version that does standard 1000baseT support.
  http://developer.osdl.org/shemminger/prototypes/mii-tool.tar.bz2
 
 Not really.  I would rather leave it as-is, and deprecate it in favor of
 ethtool.

is there some ethtool (version 5) option i'm missing that will give a nice 
concise link negotation state report like mii-tool does?

on e1000 it seems i can find this info only via the -d option, which dumps 
a lot of other info.

on skge -d doesn't seem to dump the negotiation state.

on tg3 -d doesn't even interpret the registers...

maybe it's just that i haven't had caffeine but i think i've tried every 
reporting option i can find on the man page and can't find link 
negotiation state.

-dean
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread Stephen Hemminger
On Wed, 27 Sep 2006 12:24:59 -0700 (PDT)
dean gaudet [EMAIL PROTECTED] wrote:

 On Tue, 26 Sep 2006, Jeff Garzik wrote:
 
  Stephen Hemminger wrote:
   The mii-tool utility seems to be abandoned and unmaintained?
   
   Here is a version that does standard 1000baseT support.
 http://developer.osdl.org/shemminger/prototypes/mii-tool.tar.bz2
  
  Not really.  I would rather leave it as-is, and deprecate it in favor of
  ethtool.
 
 is there some ethtool (version 5) option i'm missing that will give a nice 
 concise link negotation state report like mii-tool does?
 
 on e1000 it seems i can find this info only via the -d option, which dumps 
 a lot of other info.
 
 on skge -d doesn't seem to dump the negotiation state.


Not possible because the PHY registers are accessed indirectly.

 on tg3 -d doesn't even interpret the registers...
 
 maybe it's just that i haven't had caffeine but i think i've tried every 
 reporting option i can find on the man page and can't find link 
 negotiation state.
 
 -dean


-- 
Stephen Hemminger [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread dean gaudet
On Wed, 27 Sep 2006, Auke Kok wrote:

 dean gaudet wrote:
  On Tue, 26 Sep 2006, Jeff Garzik wrote:
  
   Stephen Hemminger wrote:
The mii-tool utility seems to be abandoned and unmaintained?

Here is a version that does standard 1000baseT support.
http://developer.osdl.org/shemminger/prototypes/mii-tool.tar.bz2
   Not really.  I would rather leave it as-is, and deprecate it in favor of
   ethtool.
  
  is there some ethtool (version 5) option i'm missing that will give a nice
  concise link negotation state report like mii-tool does?
 
 how about `ethtool ethX` ? It doesn't report what happened during negotiotion
 but it shows status and advertised/autonegotiated/supported modes

well now don't i feel dumb, i didn't even try running it without an 
option.  yes must be the lack of caffeine.  thanks.

-dean
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread Auke Kok

dean gaudet wrote:

On Tue, 26 Sep 2006, Jeff Garzik wrote:


Stephen Hemminger wrote:

The mii-tool utility seems to be abandoned and unmaintained?

Here is a version that does standard 1000baseT support.
http://developer.osdl.org/shemminger/prototypes/mii-tool.tar.bz2

Not really.  I would rather leave it as-is, and deprecate it in favor of
ethtool.


is there some ethtool (version 5) option i'm missing that will give a nice 
concise link negotation state report like mii-tool does?


how about `ethtool ethX` ? It doesn't report what happened during negotiotion 
but it shows status and advertised/autonegotiated/supported modes


on e1000 it seems i can find this info only via the -d option, which dumps 
a lot of other info.


on skge -d doesn't seem to dump the negotiation state.

on tg3 -d doesn't even interpret the registers...

maybe it's just that i haven't had caffeine but i think i've tried every 
reporting option i can find on the man page and can't find link 
negotiation state.


dumping registers in readable format is an extension that needs to be 
implemented per driver. Not all nics have done this - we just did it ourselves 
for ixgb, and I saw skge/sky2 just fly by this week.


Cheers,

Auke



-dean
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH 1/3] enable bonding to enslave non ARPHRD_ETHER netdevices

2006-09-27 Thread Or Gerlitz

On 9/26/06, Jay Vosburgh [EMAIL PROTECTED] wrote:

Or Gerlitz [EMAIL PROTECTED] wrote:
[...]
+   bond-dev-mtu  = new_active-dev-mtu;

This won't generate a NETDEV_CHANGEMTU notifier event.


What is actually the trigger for the event with the current impl? is
the code that actually calls dev_set_mtu() on the bonding device or
dev_set_mtu() itself?



[...]
+  /* bonding netdevices are created with ether_setup, so when the
+   * slave type is not ARPHRD_ETHER there is a need to override
+   * some of the type dependent attributes/functions
+   */
+  if (new_active  new_active-dev-type != ARPHRD_ETHER)
+  bond_setup_by_slave(bond, new_active);
+



In this case, if the bond has one slave that's ARPHRD_ETHER and
one that's not, when the active changes from the non-ARPHRD_ETHER slave
to the ARPHRD_ETHER slave, it won't call bond_setup_by_slave() to switch
the hard_header, rebuild_header, et al, back to the ARPHRD_ETHER
settings.


OK. First, under the assumption that one may enslave ARPHRD_ETHER and
non-ARPHRD_ETHER devices in the same bond, you are correct and the
patch is not complete here.

However, putting devices from different types in the same bond
requires a switch that **both** HW NICs/ports associated with the each
of the netdevices can talk to. If there is no such switch, then the
only possible config is two isolated networks/switches where each
NIC/type is connected to a switch supporting this type so  a local
failure/failover on some node requires the whole subset of nodes
talking to this one to do failover. So if the relation (i,j) which
holds if node i talks to node j does not impose a disjoint partition
on the set of all N nodes, you just can't do this bonding scheme.

Practically, talking on IPoIB vs. IPoETH (ie slave devices of type
ARPHRD_INFINIBAND vs slaves of type ARPHRD_ETHER) to have an IPoIB
slave talk to IPoETH slave you need an IB to Ethernet IP router
(actually IPoIB to IPoETH bridge) in the middle where the IB switch
should be connected to the IB ports of the bridge and the Ethernet
switch to the Ethernet ports of the bridge. All in all, it is a
configuration i think we can avoid supporting.

So at the bottom line, i would go on enhancing my patch not to allow
bonding together devices of different types or at least if you don't
mind, not to allow putting ARPHRD_INFINIBAND with
non-ARPHRD_INFINIBAND devices in the same bond.

Or.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] [PATCH 3/3] enable IP multicast when bonding IPoIB devices

2006-09-27 Thread Or Gerlitz

On 9/27/06, Jay Vosburgh [EMAIL PROTECTED] wrote:

Or Gerlitz [EMAIL PROTECTED] wrote:

+  /* XXX set the bond dev type and addr len such that the net core code
+  * (eg arp_mc_map() in net/ipv4/arp.c) would correctly process multicast
+  * groups set ***before*** the first enslaveness
+  */
+  bond_dev-type = bonding_dev_type;
+  bond_dev-addr_len = bonding_dev_addrlen;

I've been thinking about this a little bit more.  The system is
understandably not set up to deal with this situation, since normal
devices won't ever change their hardware type.

You almost want to have some kind of call to induce a reload
from scratch of the multicast filter settings (along with whatever else
might be necessary to alter the hardware type on the fly), to be called
by bonding at the time the first slave is added (since slave adds happen
in user context, and can therefore hold rtnl as required by most of the
multicast address handling code).  That seems less hassle than having to
specify the hardware type and address length at module load time.


I agree that it would be better to avoid doing it this way.


A side effect of this is that bonds would have to be restricted
to consisting only of slaves of one hardware type, since slave changes
(and thus hardware type changes) aren't necessarily restricted to user
context.


I have addressed the point of putting slaves of different types (and
specifically slave of type ARPHRD_INFINIBAND with slave of other type
in the same bond) in the thead that goes with patch 1/3, let close it
there...


Other random thoughts on how to resolve this include modifying
bonding to accept slaves when the master is down (which would also
require changes to the initscripts that normally configure bonding), so
that the initial setting of the, e.g., 224.0.0.1 multicast hardware
address happens to the already-changed hardware type.


OK, this is a direction i would like to check. Can be nice if you
provide me with a 1-2 liner of directions on what need to be changed
to enable bonding to accept slaves when it down.

Or.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/23] e1000: gather hardware bit tweaks.

2006-09-27 Thread Auke Kok

Jeff Garzik wrote:

Kok, Auke wrote:

Several hardware bits were set all over the driver and have been
consolidated into a single function.



diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 9422864..a143b49 100644


Overall this is a positive change.  However, NAK'd for two superficial 
reasons:


1) the comments are completely useless.  We can see from reading the 
code what the comments tell us.  What the comments DON'T tell us are (a) 
a description of the bit being set, and (b) why that bit is being set.


2) the easy-for-humans-to-read notation for bit setting is

(1  n)

not a hex constant.


reworked and added a whole bunch of comments. Here's what goes into the queue 
instead:

the only part changed relative to my original submission is the new 
e1000_initialize_hardware_bits function.


Auke

---


e1000: gather hardware bit tweaks.

From: Jeff Kirsher [EMAIL PROTECTED]

Several hardware bits were set all over the driver and have been
consolidated into a single function.

Signed-off-by: Jeff Kirsher [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_hw.c   |  155 ++--
 drivers/net/e1000/e1000_hw.h   |1
 drivers/net/e1000/e1000_main.c |   24 +++---
 3 files changed, 142 insertions(+), 38 deletions(-)

diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 6ec5cdd..dceaf5b 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -61,6 +61,7 @@ static int32_t e1000_id_led_init(struct
 static int32_t e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, uint32_t 
cnf_base_addr, uint32_t cnf_size);

 static int32_t e1000_init_lcd_from_nvm(struct e1000_hw *hw);
 static void e1000_init_rx_addrs(struct e1000_hw *hw);
+static void e1000_initialize_hardware_bits(struct e1000_hw *hw);
 static boolean_t e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw);
 static int32_t e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw);
 static int32_t e1000_mng_enable_host_if(struct e1000_hw *hw);
@@ -716,6 +717,123 @@ e1000_reset_hw(struct e1000_hw *hw)
 }

 /**
+ *
+ * Initialize a number of hardware-dependent bits
+ *
+ * hw: Struct containing variables accessed by shared code
+ *
+ * This function contains hardware limitation workarounds for PCI-E adapters
+ *
+ */
+static void
+e1000_initialize_hardware_bits(struct e1000_hw *hw)
+{
+if ((hw-mac_type = e1000_82571)  (!hw-initialize_hw_bits_disable)) {
+/* Settings common to all PCI-express silicon */
+uint32_t reg_ctrl, reg_ctrl_ext;
+uint32_t reg_tarc0, reg_tarc1;
+uint32_t reg_tctl;
+uint32_t reg_txdctl, reg_txdctl1;
+
+/* link autonegotiation/sync workarounds */
+reg_tarc0 = E1000_READ_REG(hw, TARC0);
+reg_tarc0 = ~((1  30)|(1  29)|(1  28)|(1  27));
+
+/* Enable not-done TX descriptor counting */
+reg_txdctl = E1000_READ_REG(hw, TXDCTL);
+reg_txdctl |= E1000_TXDCTL_COUNT_DESC;
+E1000_WRITE_REG(hw, TXDCTL, reg_txdctl);
+reg_txdctl1 = E1000_READ_REG(hw, TXDCTL1);
+reg_txdctl1 |= E1000_TXDCTL_COUNT_DESC;
+E1000_WRITE_REG(hw, TXDCTL1, reg_txdctl1);
+
+switch (hw-mac_type) {
+case e1000_82571:
+case e1000_82572:
+/* Clear PHY TX compatible mode bits */
+reg_tarc1 = E1000_READ_REG(hw, TARC1);
+reg_tarc1 = ~((1  30)|(1  29));
+
+/* link autonegotiation/sync workarounds */
+reg_tarc0 |= ((1  26)|(1  25)|(1  24)|(1  23));
+
+/* TX ring control fixes */
+reg_tarc1 |= ((1  26)|(1  25)|(1  24));
+
+/* Multiple read bit is reversed polarity */
+reg_tctl = E1000_READ_REG(hw, TCTL);
+if (reg_tctl  E1000_TCTL_MULR)
+reg_tarc1 = ~(1  28);
+else
+reg_tarc1 |= (1  28);
+
+E1000_WRITE_REG(hw, TARC1, reg_tarc1);
+break;
+case e1000_82573:
+reg_ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
+reg_ctrl_ext = ~(1  23);
+reg_ctrl_ext |= (1  22);
+
+/* TX byte count fix */
+reg_ctrl = E1000_READ_REG(hw, CTRL);
+reg_ctrl = ~(1  29);
+
+E1000_WRITE_REG(hw, CTRL_EXT, reg_ctrl_ext);
+E1000_WRITE_REG(hw, CTRL, reg_ctrl);
+break;
+case e1000_80003es2lan:
+/* improve small packet performace for fiber/serdes */
+if ((hw-media_type == e1000_media_type_fiber) ||
+(hw-media_type == e1000_media_type_internal_serdes)) {
+reg_tarc0 = ~(1  20);
+}
+

Re: [PATCH 08/23] e1000: add multicast stats counters

2006-09-27 Thread Auke Kok

Jeff Garzik wrote:

cramerj wrote:

Williams, Mitch A wrote:

+{ rx_broadcast, E1000_STAT(stats.bprc) }, +{
tx_broadcast, E1000_STAT(stats.bptc) }, +{ rx_multicast,
E1000_STAT(stats.mprc) }, +{ tx_multicast,
E1000_STAT(stats.mptc) }, { rx_errors,
E1000_STAT(net_stats.rx_errors) }, { tx_errors,
E1000_STAT(net_stats.tx_errors) }, { tx_dropped,
E1000_STAT(net_stats.tx_dropped) },
NAK -- you also need to remove the standard net stats, which are 
exported elsewhere
Jeff, can you please explain the reason for this NAK a little more? 
Neither Auke nor I understand why you rejected the patch.


This patch just adds the display of a few more stats in Ethtool.  It 
doesn't affect any other counters, and is really just a convenience 
feature.  I added this to the driver because of a customer request.
Adding those stats is fine.  You guys just need to remove the existing 
mess first.


Since we have 1-to-1 mapping of some of our statistics registers to the 
net_stats, we could s/net_stats/stats/.  However, there are a few 
net_stats (e.g. net_stats.rx_errors) that encapsulate more than one e1000

statistic register of which we don't have a private stat member defined.

For those statistics, is it really necessary to add another stat structure
just to rm net_stats from that list we pass to ethtool?  At best, it
would look something like this...

{ foo_count, E1000_STAT(stats.foo) }, - { rx_errors,
E1000_STAT(net_stats.rx_errors) }, + { rx_errors,
E1000_STAT(eth_stats.rx_errors) }, { bar_count, E1000_STAT(stats.bar) },


If so, well, OK.  I'm just scratching my head as to why it's a mess 
as-is.


The ethtool get-stats sub ioctl has _always_ been for exporting _only_ 
NIC-private statistics.


So, no, there is no inherent connection between adding multicast stats and
removing ones that should have never been in the list.  But if I don't put
my foot down, this will never get corrected.


okay, here's my offer - we fix it as much as we can. I realize that it may not
be enough but I doubt that removeing stats makes people happy. I suggest that
we take one step in the right direction and another one later if we must.

this is in my queue.

Auke

---

e1000: add multicast stats counters

From: Mitch Williams [EMAIL PROTECTED]

Add 4 multicast and broadcast hardware counters (rx/tx), and eliminate
as many non-hardware counters as possible.

Signed-off-by: Mitch Williams [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_ethtool.c |   32 ++--
 drivers/net/e1000/e1000_hw.h  |4 +++-
 drivers/net/e1000/e1000_main.c|9 -
 3 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethtool.c 
/drivers/net/e1000/e1000_ethtool.c
index 858c14d..9791b8a 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -56,26 +56,30 @@ struct e1000_stats {
 #define E1000_STAT(m) sizeof(((struct e1000_adapter *)0)-m), \
  offsetof(struct e1000_adapter, m)
 static const struct e1000_stats e1000_gstrings_stats[] = {
-   { rx_packets, E1000_STAT(net_stats.rx_packets) },
-   { tx_packets, E1000_STAT(net_stats.tx_packets) },
-   { rx_bytes, E1000_STAT(net_stats.rx_bytes) },
-   { tx_bytes, E1000_STAT(net_stats.tx_bytes) },
-   { rx_errors, E1000_STAT(net_stats.rx_errors) },
-   { tx_errors, E1000_STAT(net_stats.tx_errors) },
+   { rx_packets, E1000_STAT(stats.gprc) },
+   { tx_packets, E1000_STAT(stats.gptc) },
+   { rx_bytes, E1000_STAT(stats.gorcl) },
+   { tx_bytes, E1000_STAT(stats.gotcl) },
+   { rx_broadcast, E1000_STAT(stats.bprc) },
+   { tx_broadcast, E1000_STAT(stats.bptc) },
+   { rx_multicast, E1000_STAT(stats.mprc) },
+   { tx_multicast, E1000_STAT(stats.mptc) },
+   { rx_errors, E1000_STAT(stats.rxerrc) },
+   { tx_errors, E1000_STAT(stats.txerrc) },
{ tx_dropped, E1000_STAT(net_stats.tx_dropped) },
-   { multicast, E1000_STAT(net_stats.multicast) },
-   { collisions, E1000_STAT(net_stats.collisions) },
-   { rx_length_errors, E1000_STAT(net_stats.rx_length_errors) },
+   { multicast, E1000_STAT(stats.mprc) },
+   { collisions, E1000_STAT(stats.colc) },
+   { rx_length_errors, E1000_STAT(stats.rlerrc) },
{ rx_over_errors, E1000_STAT(net_stats.rx_over_errors) },
-   { rx_crc_errors, E1000_STAT(net_stats.rx_crc_errors) },
+   { rx_crc_errors, E1000_STAT(stats.crcerrs) },
{ rx_frame_errors, E1000_STAT(net_stats.rx_frame_errors) },
{ rx_no_buffer_count, E1000_STAT(stats.rnbc) },
-   { rx_missed_errors, E1000_STAT(net_stats.rx_missed_errors) },
-   { tx_aborted_errors, E1000_STAT(net_stats.tx_aborted_errors) },
-   { tx_carrier_errors, E1000_STAT(net_stats.tx_carrier_errors) },
+   { rx_missed_errors, E1000_STAT(stats.mpc) },
+   { tx_aborted_errors, E1000_STAT(stats.ecol) },
+   { tx_carrier_errors, 

Re: [RFC] [PATCH 3/3] enable IP multicast when bonding IPoIB devices

2006-09-27 Thread Or Gerlitz

On 9/26/06, Stephen Hemminger [EMAIL PROTECTED] wrote:

On Tue, 26 Sep 2006 13:18:09 +0300 (IDT)
Or Gerlitz [EMAIL PROTECTED] wrote:



 +module_param(bonding_dev_type,int, 0644);
 +module_param(bonding_dev_addrlen, int, 0644);



Do you really want to allow changing these values after module load?
If not replace 0644 with 0


Nope, they are ment to be used only at load time, thanks for the
comment. Howeve, as i mentioned this patch is temporal workaround to
allow for have IP multicast supported when bondiong non ARPHRD_ETHER
devices. I am seeking better ways to do that.

Or.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mii-tool gigabit support.

2006-09-27 Thread David Acker

Rick Jones wrote:
With mii-tool we can do the command below and work with a half duplex 
hub and a full duplex switch.

mii-tool -A 10baseT-FD,10baseT-HD eth0


Why, and how often, is that really necessary?

rick jones



Take a wifi router with only 802.11b radios and ethernet chips that do 
not support handling DMA to host memory.  In this case receives from 
ethernet cost a lot since the packets must be read into host memory by 
the CPU (instead of written there by the adapter).  Also, receiving 100 
Mbit in when you only have 802.11b pipes out isn't terrible useful.  UDP 
blasts from ethernet can hog the CPU and with some NICs cause soft lockups.


We could just set it to 10Mbit half duplex always but two 802.11b radios 
can saturate that with bidirectional traffic.  We have seen failures to 
send due to collisions.  Thus, we would like to be able advertise 10Mb 
full and half duplex so that we can get the appropriate speed when that 
the neighbor device supports.  We have seen various ethernet switches or 
NICs (like IP video cameras with ethernet) that will not run 10Mb full 
duplex but will do 100Mb full or 10Mb half.


We want it to be configurable at run time since sometimes the same 
software may run on a system that has 802.11G radios and and perhaps 
more capable ethernet devices.  We can detect our situation in our 
startup script and adjust the advertised speeds down only when needed.


-Ack
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/9][TG3]: Improve ASF heartbeat.

2006-09-27 Thread Michael Chan
[TG3]: Improve ASF heartbeat.

Change to a different ASF heartbeat message code to improve
reliability.

There were some reports of unintended resets on real time kernels
where the timer may be slow and cause the heartbeat to be late.
Netpoll will also have the same problem because the timer irq will
be unavailable.

Using the new heartbeat code, the ASF firmware will also check the
ring condition before resetting the chip when the heartbeat is
expiring.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 4eef798..6af8ebc 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -6690,13 +6690,29 @@ static void tg3_timer(unsigned long __op
tp-timer_counter = tp-timer_multiplier;
}
 
-   /* Heartbeat is only sent once every 2 seconds.  */
+   /* Heartbeat is only sent once every 2 seconds.
+*
+* The heartbeat is to tell the ASF firmware that the host
+* driver is still alive.  In the event that the OS crashes,
+* ASF needs to reset the hardware to free up the FIFO space
+* that may be filled with rx packets destined for the host.
+* If the FIFO is full, ASF will no longer function properly.
+*
+* Unintended resets have been reported on real time kernels
+* where the timer doesn't run on time.  Netpoll will also have
+* same problem.
+*
+* The new FWCMD_NICDRV_ALIVE3 command tells the ASF firmware
+* to check the ring condition when the heartbeat is expiring
+* before doing the reset.  This will prevent most unintended
+* resets.
+*/
if (!--tp-asf_counter) {
if (tp-tg3_flags  TG3_FLAG_ENABLE_ASF) {
u32 val;
 
tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX,
- FWCMD_NICDRV_ALIVE2);
+ FWCMD_NICDRV_ALIVE3);
tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4);
/* 5 seconds timeout */
tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5);
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index f9c81ba..f7462c2 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1537,6 +1537,7 @@
 #define  FWCMD_NICDRV_FIX_DMAR  0x0005
 #define  FWCMD_NICDRV_FIX_DMAW  0x0006
 #define  FWCMD_NICDRV_ALIVE20x000d
+#define  FWCMD_NICDRV_ALIVE30x000e
 #define NIC_SRAM_FW_CMD_LEN_MBOX   0x0b7c
 #define NIC_SRAM_FW_CMD_DATA_MBOX  0x0b80
 #define NIC_SRAM_FW_ASF_STATUS_MBOX0x0c00


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9][TG3]: Add basic 5906 support.

2006-09-27 Thread Michael Chan
[TG3]: Add basic 5906 support.

Add support for the new 5709 device.  This is a new 10/100 Mbps chip.
The mailbox access and firmware interface are quite different from
all other tg3 chips.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index eafca2a..2b062d7 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -199,6 +199,8 @@ static struct pci_device_id tg3_pci_tbl[
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780S)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5781)},
+   {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5906)},
+   {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5906M)},
{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)},
@@ -426,6 +428,16 @@ static void tg3_write32_tx_mbox(struct t
readl(mbox);
 }
 
+static u32 tg3_read32_mbox_5906(struct tg3 *tp, u32 off)
+{
+   return (readl(tp-regs + off + GRCMBOX_BASE));
+}
+
+static void tg3_write32_mbox_5906(struct tg3 *tp, u32 off, u32 val)
+{
+   writel(val, tp-regs + off + GRCMBOX_BASE);
+}
+
 #define tw32_mailbox(reg, val) tp-write32_mbox(tp, reg, val)
 #define tw32_mailbox_f(reg, val)   tw32_mailbox_flush(tp, (reg), (val))
 #define tw32_rx_mbox(reg, val) tp-write32_rx_mbox(tp, reg, val)
@@ -441,6 +453,10 @@ static void tg3_write_mem(struct tg3 *tp
 {
unsigned long flags;
 
+   if ((GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5906) 
+   (off = NIC_SRAM_STATS_BLK)  (off  NIC_SRAM_TX_BUFFER_DESC))
+   return;
+
spin_lock_irqsave(tp-indirect_lock, flags);
if (tp-tg3_flags  TG3_FLAG_SRAM_USE_CONFIG) {
pci_write_config_dword(tp-pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
@@ -462,6 +478,12 @@ static void tg3_read_mem(struct tg3 *tp,
 {
unsigned long flags;
 
+   if ((GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5906) 
+   (off = NIC_SRAM_STATS_BLK)  (off  NIC_SRAM_TX_BUFFER_DESC)) {
+   *val = 0;
+   return;
+   }
+
spin_lock_irqsave(tp-indirect_lock, flags);
if (tp-tg3_flags  TG3_FLAG_SRAM_USE_CONFIG) {
pci_write_config_dword(tp-pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
@@ -491,6 +513,9 @@ static inline void tg3_cond_int(struct t
if (!(tp-tg3_flags  TG3_FLAG_TAGGED_STATUS) 
(tp-hw_status-status  SD_STATUS_UPDATED))
tw32(GRC_LOCAL_CTRL, tp-grc_local_ctrl | GRC_LCLCTRL_SETINT);
+   else
+   tw32(HOSTCC_MODE, tp-coalesce_mode |
+(HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW));
 }
 
 static void tg3_enable_ints(struct tg3 *tp)
@@ -656,6 +681,10 @@ static int tg3_writephy(struct tg3 *tp, 
unsigned int loops;
int ret;
 
+   if (GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5906 
+   (reg == MII_TG3_CTRL || reg == MII_TG3_AUX_CTRL))
+   return 0;
+
if ((tp-mi_mode  MAC_MI_MODE_AUTO_POLL) != 0) {
tw32_f(MAC_MI_MODE,
 (tp-mi_mode  ~MAC_MI_MODE_AUTO_POLL));
@@ -1207,7 +1236,12 @@ static int tg3_set_power_state(struct tg
tg3_setup_phy(tp, 0);
}
 
-   if (!(tp-tg3_flags  TG3_FLAG_ENABLE_ASF)) {
+   if (GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5906) {
+   u32 val;
+
+   val = tr32(GRC_VCPU_EXT_CTRL);
+   tw32(GRC_VCPU_EXT_CTRL, val | GRC_VCPU_EXT_CTRL_DISABLE_WOL);
+   } else if (!(tp-tg3_flags  TG3_FLAG_ENABLE_ASF)) {
int i;
u32 val;
 
@@ -4667,6 +4701,15 @@ static int tg3_poll_fw(struct tg3 *tp)
int i;
u32 val;
 
+   if (GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5906) {
+   for (i = 0; i  400; i++) {
+   if (tr32(VCPU_STATUS)  VCPU_STATUS_INIT_DONE)
+   return 0;
+   udelay(10);
+   }
+   return -ENODEV;
+   }
+
/* Wait for firmware initialization to complete. */
for (i = 0; i  10; i++) {
tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, val);
@@ -4735,6 +4778,12 @@ static int tg3_chip_reset(struct tg3 *tp
}
}
 
+   if (GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5906) {
+   tw32(VCPU_STATUS, tr32(VCPU_STATUS) | VCPU_STATUS_DRV_RESET);
+   tw32(GRC_VCPU_EXT_CTRL,
+tr32(GRC_VCPU_EXT_CTRL)  ~GRC_VCPU_EXT_CTRL_HALT_CPU);
+   }
+
if (tp-tg3_flags2  TG3_FLG2_5705_PLUS)
val |= GRC_MISC_CFG_KEEP_GPHY_POWER;
tw32(GRC_MISC_CFG, val);
@@ -5066,6 +5115,12 @@ static int tg3_halt_cpu(struct tg3 *tp, 
BUG_ON(offset == 

[PATCH 7/9][TG3]: Add 5709 PHY support.

2006-09-27 Thread Michael Chan
[TG3]: Add 5709 PHY support.

Add support for the 5709 10/100 PHY.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 2b062d7..23f5744 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1035,6 +1035,24 @@ out:
 phy_reg | MII_TG3_EXT_CTRL_FIFO_ELASTIC);
}
 
+   if (GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5906) {
+   u32 phy_reg;
+
+   /* adjust output voltage */
+   tg3_writephy(tp, MII_TG3_EPHY_PTEST, 0x12);
+
+   if (!tg3_readphy(tp, MII_TG3_EPHY_TEST, phy_reg)) {
+   u32 phy_reg2;
+
+   tg3_writephy(tp, MII_TG3_EPHY_TEST,
+phy_reg | MII_TG3_EPHY_SHADOW_EN);
+   /* Enable auto-MDIX */
+   if (!tg3_readphy(tp, 0x10, phy_reg2))
+   tg3_writephy(tp, 0x10, phy_reg2 | 0x4000);
+   tg3_writephy(tp, MII_TG3_EPHY_TEST, phy_reg);
+   }
+   }
+
tg3_phy_set_wirespeed(tp);
return 0;
 }
@@ -1151,8 +1169,11 @@ static void tg3_power_down_phy(struct tg
if (tp-tg3_flags2  TG3_FLG2_PHY_SERDES)
return;
 
-   tg3_writephy(tp, MII_TG3_EXT_CTRL, MII_TG3_EXT_CTRL_FORCE_LED_OFF);
-   tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2);
+   if (GET_ASIC_REV(tp-pci_chip_rev_id) != ASIC_REV_5906) {
+   tg3_writephy(tp, MII_TG3_EXT_CTRL,
+MII_TG3_EXT_CTRL_FORCE_LED_OFF);
+   tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2);
+   }
 
/* The PHY should not be powered down on some chips because
 * of bugs.
@@ -1505,6 +1526,13 @@ static void tg3_aux_stat_to_speed_duplex
break;
 
default:
+   if (GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5906) {
+   *speed = (val  MII_TG3_AUX_STAT_100) ? SPEED_100 :
+SPEED_10;
+   *duplex = (val  MII_TG3_AUX_STAT_FULL) ? DUPLEX_FULL :
+ DUPLEX_HALF;
+   break;
+   }
*speed = SPEED_INVALID;
*duplex = DUPLEX_INVALID;
break;
@@ -1787,7 +1815,7 @@ static int tg3_setup_copper_phy(struct t
 
if (tp-tg3_flags  TG3_FLAG_USE_MI_INTERRUPT)
tg3_writephy(tp, MII_TG3_IMASK, ~MII_TG3_INT_LINKCHG);
-   else
+   else if (GET_ASIC_REV(tp-pci_chip_rev_id) != ASIC_REV_5906)
tg3_writephy(tp, MII_TG3_IMASK, ~0);
 
if (GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5700 ||
@@ -6552,7 +6580,8 @@ static int tg3_reset_hw(struct tg3 *tp, 
if (err)
return err;
 
-   if (!(tp-tg3_flags2  TG3_FLG2_PHY_SERDES)) {
+   if (!(tp-tg3_flags2  TG3_FLG2_PHY_SERDES) 
+   GET_ASIC_REV(tp-pci_chip_rev_id) != ASIC_REV_5906) {
u32 tmp;
 
/* Clear CRC stats. */
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 2f5e00c..9259d12 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1624,6 +1624,7 @@
 #define MII_TG3_DSP_RW_PORT0x15 /* DSP coefficient read/write port 
*/
 
 #define MII_TG3_DSP_ADDRESS0x17 /* DSP address register */
+#define MII_TG3_EPHY_PTEST 0x17 /* 5906 PHY register */
 
 #define MII_TG3_AUX_CTRL   0x18 /* auxilliary control register */
 
@@ -1637,6 +1638,8 @@
 #define MII_TG3_AUX_STAT_100FULL   0x0500
 #define MII_TG3_AUX_STAT_1000HALF  0x0600
 #define MII_TG3_AUX_STAT_1000FULL  0x0700
+#define MII_TG3_AUX_STAT_100   0x0008
+#define MII_TG3_AUX_STAT_FULL  0x0001
 
 #define MII_TG3_ISTAT  0x1a /* IRQ status register */
 #define MII_TG3_IMASK  0x1b /* IRQ mask register */
@@ -1647,6 +1650,9 @@
 #define MII_TG3_INT_DUPLEXCHG  0x0008
 #define MII_TG3_INT_ANEG_PAGE_RX   0x0400
 
+#define MII_TG3_EPHY_TEST  0x1f /* 5906 PHY register */
+#define MII_TG3_EPHY_SHADOW_EN 0x80
+
 /* 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


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PATCH] e100, e1000, ixgb updates for #upstream

2006-09-27 Thread Auke Kok


Hi,

Here are updated updates targeted to branch #upstream-fixes from netdev-2.6, 
including
fixes to e100, e1000 and ixgb.

Changes from last weeks submission:
1) removed taint flag setting when eeprom csum fails (e100)
2) added CONFIG_PM wrappers around .suspend mthod (e1000)
3) added comments and (1  n) for hardware bit spanking function (e1000)
4) keep flow control enum (e1000)
5) clean up ethtool stats as much as possible to use real HW counters (e1000)
6) add patch from linas Vepstas (e1000, PCI_D3 etc state symbols)
7) add patch from Vasily Averin (e1000, memleak in e1000_set_ringparam)


Please pull from:

git pull git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream

these patches are against
  netdev-2.6#upstream 8aca23103c2ed2cf158adbe92f4f17ee69463d1a

Cheers,

Auke


---
 drivers/net/e100.c|   82 +-
 drivers/net/e1000/LICENSE |  339 ---
 drivers/net/e1000/Makefile|   35 -
 drivers/net/e1000/e1000.h |   59 --
 drivers/net/e1000/e1000_ethtool.c |  150 ++---
 drivers/net/e1000/e1000_hw.c  | 1076 +-
 drivers/net/e1000/e1000_hw.h  |   86 +--
 drivers/net/e1000/e1000_main.c|  277 ++---
 drivers/net/e1000/e1000_osdep.h   |   35 -
 drivers/net/e1000/e1000_param.c   |   47 -
 drivers/net/ixgb/Makefile |   38 -
 drivers/net/ixgb/ixgb.h   |   38 -
 drivers/net/ixgb/ixgb_ee.c|   36 -
 drivers/net/ixgb/ixgb_ee.h|   36 -
 drivers/net/ixgb/ixgb_ethtool.c   |   36 -
 drivers/net/ixgb/ixgb_hw.c|   36 -
 drivers/net/ixgb/ixgb_hw.h|   36 -
 drivers/net/ixgb/ixgb_ids.h   |   36 -
 drivers/net/ixgb/ixgb_main.c  |   46 -
 drivers/net/ixgb/ixgb_osdep.h |   36 -
 drivers/net/ixgb/ixgb_param.c |   36 -
 21 files changed, 1108 insertions(+), 1488 deletions(-)

---

Summary:

---


Auke Kok [EMAIL PROTECTED]:
 e100, e1000, ixgb: update copyright header and remove LICENSE
 e100, e1000, ixgb: Fix an impossible memory overwrite bug
 e1000: keep .suspend and .resume driver methods in CONFIG_PM
 e100: rework WoL and shutdown handling
 e1000: driver state fixes (race fix)
 ixgb: convert to netdev_priv(netdev)
 e100, e1000, ixgb: increment version numbers

Bruce Allan [EMAIL PROTECTED]:
 e1000: Jumbo frames fixes for 82573
 e1000: handle manageability for pci-e adapters at PHY powerdown
 e1000: don't strip vlan ID if 8021q claims it

Jeff Kirsher [EMAIL PROTECTED]:
 e1000: rename flow control symbols
 e1000: add enums for several link properties
 e1000: allow ethtool to pass arbitrary speed advertisment
 e1000: Fix MANC detection for PCIE adapters
 e1000: gather hardware bit tweaks.
 e1000: add PCI-E capability detection code
 e1000: reduce RAR entries available for ICH8
 e1000: rework polarity, NVM, eeprom code and fixes.

Jesse Brandeburg [EMAIL PROTECTED]:
 e100: Add debugging code for cb cleaning.
 e1000: Maybe stop TX if not enough free descriptors
 ixgb: combine more rx descriptors to improve performance

Linas Vepstas [EMAIL PROTECTED]:
 e1000: Janitor: Use #defined values for literals

Mitch Williams [EMAIL PROTECTED]:
 e1000: add multicast stats counters

Nicholas Nunley [EMAIL PROTECTED]:
 e1000: remove unused code and make symbols static

Vasily Averin [EMAIL PROTECTED]:
 e1000: possible memory leak in e1000_set_ringparam
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/9][TG3]: Update version and reldate.

2006-09-27 Thread Michael Chan
[TG3]: Update version and reldate.

Update version to 3.66.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 21843de..c25ba27 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -68,8 +68,8 @@
 
 #define DRV_MODULE_NAMEtg3
 #define PFX DRV_MODULE_NAME: 
-#define DRV_MODULE_VERSION 3.65
-#define DRV_MODULE_RELDATE August 07, 2006
+#define DRV_MODULE_VERSION 3.66
+#define DRV_MODULE_RELDATE September 23, 2006
 
 #define TG3_DEF_MAC_MODE   0
 #define TG3_DEF_RX_MODE0


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/9][TG3]: PHY fixes.

2006-09-27 Thread Michael Chan
[TG3]: PHY fixes.

Some PHY related fixes:

1. Fix Serdes WoL.
2. Fix loopback test on 10/100 only devices.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 6af8ebc..14e9645 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1117,6 +1117,12 @@ static void tg3_nvram_unlock(struct tg3 
 
 static void tg3_power_down_phy(struct tg3 *tp)
 {
+   if (tp-tg3_flags2  TG3_FLG2_PHY_SERDES)
+   return;
+
+   tg3_writephy(tp, MII_TG3_EXT_CTRL, MII_TG3_EXT_CTRL_FORCE_LED_OFF);
+   tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2);
+
/* The PHY should not be powered down on some chips because
 * of bugs.
 */
@@ -1223,7 +1229,10 @@ static int tg3_set_power_state(struct tg
tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x5a);
udelay(40);
 
-   mac_mode = MAC_MODE_PORT_MODE_MII;
+   if (tp-tg3_flags2  TG3_FLG2_MII_SERDES)
+   mac_mode = MAC_MODE_PORT_MODE_GMII;
+   else
+   mac_mode = MAC_MODE_PORT_MODE_MII;
 
if (GET_ASIC_REV(tp-pci_chip_rev_id) != ASIC_REV_5700 
||
!(tp-tg3_flags  TG3_FLAG_WOL_SPEED_100MB))
@@ -1301,15 +1310,8 @@ static int tg3_set_power_state(struct tg
}
 
if (!(tp-tg3_flags  TG3_FLAG_WOL_ENABLE) 
-   !(tp-tg3_flags  TG3_FLAG_ENABLE_ASF)) {
-   /* Turn off the PHY */
-   if (!(tp-tg3_flags2  TG3_FLG2_PHY_SERDES)) {
-   tg3_writephy(tp, MII_TG3_EXT_CTRL,
-MII_TG3_EXT_CTRL_FORCE_LED_OFF);
-   tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2);
-   tg3_power_down_phy(tp);
-   }
-   }
+   !(tp-tg3_flags  TG3_FLAG_ENABLE_ASF))
+   tg3_power_down_phy(tp);
 
tg3_frob_aux_power(tp);
 
@@ -7889,7 +7891,7 @@ static int tg3_set_wol(struct net_device
if (wol-wolopts  ~WAKE_MAGIC)
return -EINVAL;
if ((wol-wolopts  WAKE_MAGIC) 
-   tp-tg3_flags2  TG3_FLG2_PHY_SERDES 
+   tp-tg3_flags2  TG3_FLG2_ANY_SERDES 
!(tp-tg3_flags  TG3_FLAG_SERDES_WOL_CAP))
return -EINVAL;
 
@@ -8573,12 +8575,22 @@ static int tg3_run_loopback(struct tg3 *
return 0;
 
mac_mode = (tp-mac_mode  ~MAC_MODE_PORT_MODE_MASK) |
-  MAC_MODE_PORT_INT_LPBACK | MAC_MODE_LINK_POLARITY |
-  MAC_MODE_PORT_MODE_GMII;
+  MAC_MODE_PORT_INT_LPBACK | MAC_MODE_LINK_POLARITY;
+   if (tp-tg3_flags  TG3_FLAG_10_100_ONLY)
+   mac_mode |= MAC_MODE_PORT_MODE_MII;
+   else
+   mac_mode |= MAC_MODE_PORT_MODE_GMII;
tw32(MAC_MODE, mac_mode);
} else if (loopback_mode == TG3_PHY_LOOPBACK) {
-   tg3_writephy(tp, MII_BMCR, BMCR_LOOPBACK | BMCR_FULLDPLX |
-  BMCR_SPEED1000);
+   u32 val;
+
+   val = BMCR_LOOPBACK | BMCR_FULLDPLX;
+   if (tp-tg3_flags  TG3_FLAG_10_100_ONLY)
+   val |= BMCR_SPEED100;
+   else
+   val |= BMCR_SPEED1000;
+
+   tg3_writephy(tp, MII_BMCR, val);
udelay(40);
/* reset to prevent losing 1st rx packet intermittently */
if (tp-tg3_flags2  TG3_FLG2_MII_SERDES) {
@@ -8587,7 +8599,11 @@ static int tg3_run_loopback(struct tg3 *
tw32_f(MAC_RX_MODE, tp-rx_mode);
}
mac_mode = (tp-mac_mode  ~MAC_MODE_PORT_MODE_MASK) |
-  MAC_MODE_LINK_POLARITY | MAC_MODE_PORT_MODE_GMII;
+  MAC_MODE_LINK_POLARITY;
+   if (tp-tg3_flags  TG3_FLAG_10_100_ONLY)
+   mac_mode |= MAC_MODE_PORT_MODE_MII;
+   else
+   mac_mode |= MAC_MODE_PORT_MODE_GMII;
if ((tp-phy_id  PHY_ID_MASK) == PHY_ID_BCM5401) {
mac_mode = ~MAC_MODE_LINK_POLARITY;
tg3_writephy(tp, MII_TG3_EXT_CTRL,
@@ -8636,7 +8652,8 @@ static int tg3_run_loopback(struct tg3 *
 
udelay(10);
 
-   for (i = 0; i  10; i++) {
+   /* 250 usec to allow enough time on some 10/100 Mbps devices.  */
+   for (i = 0; i  25; i++) {
tw32_f(HOSTCC_MODE, tp-coalesce_mode | HOSTCC_MODE_ENABLE |
   HOSTCC_MODE_NOW);
 


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/9][TG3]: Add 5709 self-test support.

2006-09-27 Thread Michael Chan
[TG3]: Add 5709 self-test support.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 23f5744..21843de 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -3615,8 +3615,7 @@ static irqreturn_t tg3_test_isr(int irq,
 
if ((sblk-status  SD_STATUS_UPDATED) ||
!(tr32(TG3PCI_PCISTATE)  PCISTATE_INT_NOT_ACTIVE)) {
-   tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
-0x0001);
+   tg3_disable_ints(tp);
return IRQ_RETVAL(1);
}
return IRQ_RETVAL(0);
@@ -6860,8 +6859,7 @@ static int tg3_request_irq(struct tg3 *t
 static int tg3_test_interrupt(struct tg3 *tp)
 {
struct net_device *dev = tp-dev;
-   int err, i;
-   u32 int_mbox = 0;
+   int err, i, intr_ok = 0;
 
if (!netif_running(dev))
return -ENODEV;
@@ -6882,10 +6880,18 @@ static int tg3_test_interrupt(struct tg3
   HOSTCC_MODE_NOW);
 
for (i = 0; i  5; i++) {
+   u32 int_mbox, misc_host_ctrl;
+
int_mbox = tr32_mailbox(MAILBOX_INTERRUPT_0 +
TG3_64BIT_REG_LOW);
-   if (int_mbox != 0)
+   misc_host_ctrl = tr32(TG3PCI_MISC_HOST_CTRL);
+
+   if ((int_mbox != 0) ||
+   (misc_host_ctrl  MISC_HOST_CTRL_MASK_PCI_INT)) {
+   intr_ok = 1;
break;
+   }
+
msleep(10);
}
 
@@ -6898,7 +6904,7 @@ static int tg3_test_interrupt(struct tg3
if (err)
return err;
 
-   if (int_mbox != 0)
+   if (intr_ok)
return 0;
 
return -EIO;
@@ -8288,6 +8294,8 @@ static void tg3_get_ethtool_stats (struc
 
 #define NVRAM_TEST_SIZE 0x100
 #define NVRAM_SELFBOOT_FORMAT1_SIZE 0x14
+#define NVRAM_SELFBOOT_HW_SIZE 0x20
+#define NVRAM_SELFBOOT_DATA_SIZE 0x1c
 
 static int tg3_test_nvram(struct tg3 *tp)
 {
@@ -8299,12 +8307,14 @@ static int tg3_test_nvram(struct tg3 *tp
 
if (magic == TG3_EEPROM_MAGIC)
size = NVRAM_TEST_SIZE;
-   else if ((magic  0xff00) == 0xa500) {
+   else if ((magic  TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) {
if ((magic  0xe0) == 0x20)
size = NVRAM_SELFBOOT_FORMAT1_SIZE;
else
return 0;
-   } else
+   } else if ((magic  TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW)
+   size = NVRAM_SELFBOOT_HW_SIZE;
+   else
return -EIO;
 
buf = kmalloc(size, GFP_KERNEL);
@@ -8323,7 +8333,8 @@ static int tg3_test_nvram(struct tg3 *tp
goto out;
 
/* Selfboot format */
-   if (cpu_to_be32(buf[0]) != TG3_EEPROM_MAGIC) {
+   if ((cpu_to_be32(buf[0])  TG3_EEPROM_MAGIC_FW_MSK) ==
+   TG3_EEPROM_MAGIC_FW) {
u8 *buf8 = (u8 *) buf, csum8 = 0;
 
for (i = 0; i  size; i++)
@@ -8338,6 +8349,51 @@ static int tg3_test_nvram(struct tg3 *tp
goto out;
}
 
+   if ((cpu_to_be32(buf[0])  TG3_EEPROM_MAGIC_HW_MSK) ==
+   TG3_EEPROM_MAGIC_HW) {
+   u8 data[NVRAM_SELFBOOT_DATA_SIZE];
+   u8 parity[NVRAM_SELFBOOT_DATA_SIZE];
+   u8 *buf8 = (u8 *) buf;
+   int j, k;
+
+   /* Separate the parity bits and the data bytes.  */
+   for (i = 0, j = 0, k = 0; i  NVRAM_SELFBOOT_HW_SIZE; i++) {
+   if ((i == 0) || (i == 8)) {
+   int l;
+   u8 msk;
+
+   for (l = 0, msk = 0x80; l  7; l++, msk = 1)
+   parity[k++] = buf8[i]  msk;
+   i++;
+   }
+   else if (i == 16) {
+   int l;
+   u8 msk;
+
+   for (l = 0, msk = 0x20; l  6; l++, msk = 1)
+   parity[k++] = buf8[i]  msk;
+   i++;
+
+   for (l = 0, msk = 0x80; l  8; l++, msk = 1)
+   parity[k++] = buf8[i]  msk;
+   i++;
+   }
+   data[j++] = buf8[i];
+   }
+
+   err = -EIO;
+   for (i = 0; i  NVRAM_SELFBOOT_DATA_SIZE; i++) {
+   u8 hw8 = hweight8(data[i]);
+
+   if ((hw8  0x1)  parity[i])
+   goto out;
+   else if (!(hw8  0x1)  !parity[i])
+   goto out;
+   }
+   err = 0;
+   goto out;
+   }
+
/* Bootstrap checksum at offset 0x10 */
csum = calc_crc((unsigned char 

[PATCH 1/9][TG3]: Improve 5704S autoneg.

2006-09-27 Thread Michael Chan
[TG3]: Improve 5704S autoneg.

Improve 5704S autoneg logic by using a serdes_counter field to keep
track of the transient states.  This eliminates a 200 msec busy
loop in the code.  Autoneg will take its course without the driver
busy waiting for it to finish.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index aaf45b9..4eef798 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2406,24 +2406,27 @@ static int tg3_setup_fiber_hw_autoneg(st
expected_sg_dig_ctrl |= (1  12);
 
if (sg_dig_ctrl != expected_sg_dig_ctrl) {
+   if ((tp-tg3_flags2  TG3_FLG2_PARALLEL_DETECT) 
+   tp-serdes_counter 
+   ((mac_status  (MAC_STATUS_PCS_SYNCED |
+   MAC_STATUS_RCVD_CFG)) ==
+MAC_STATUS_PCS_SYNCED)) {
+   tp-serdes_counter--;
+   current_link_up = 1;
+   goto out;
+   }
+restart_autoneg:
if (workaround)
tw32_f(MAC_SERDES_CFG, serdes_cfg | 0xc011000);
tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl | (1  30));
udelay(5);
tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl);
 
-   tp-tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED;
+   tp-serdes_counter = SERDES_AN_TIMEOUT_5704S;
+   tp-tg3_flags2 = ~TG3_FLG2_PARALLEL_DETECT;
} else if (mac_status  (MAC_STATUS_PCS_SYNCED |
 MAC_STATUS_SIGNAL_DET)) {
-   int i;
-
-   /* Giver time to negotiate (~200ms) */
-   for (i = 0; i  4; i++) {
-   sg_dig_status = tr32(SG_DIG_STATUS);
-   if (sg_dig_status  (0x3))
-   break;
-   udelay(5);
-   }
+   sg_dig_status = tr32(SG_DIG_STATUS);
mac_status = tr32(MAC_STATUS);
 
if ((sg_dig_status  (1  1)) 
@@ -2439,10 +2442,11 @@ static int tg3_setup_fiber_hw_autoneg(st
 
tg3_setup_flow_control(tp, local_adv, remote_adv);
current_link_up = 1;
-   tp-tg3_flags2 = ~TG3_FLG2_PHY_JUST_INITTED;
+   tp-serdes_counter = 0;
+   tp-tg3_flags2 = ~TG3_FLG2_PARALLEL_DETECT;
} else if (!(sg_dig_status  (1  1))) {
-   if (tp-tg3_flags2  TG3_FLG2_PHY_JUST_INITTED)
-   tp-tg3_flags2 = ~TG3_FLG2_PHY_JUST_INITTED;
+   if (tp-serdes_counter)
+   tp-serdes_counter--;
else {
if (workaround) {
u32 val = serdes_cfg;
@@ -2466,9 +2470,17 @@ static int tg3_setup_fiber_hw_autoneg(st
!(mac_status  MAC_STATUS_RCVD_CFG)) {
tg3_setup_flow_control(tp, 0, 0);
current_link_up = 1;
-   }
+   tp-tg3_flags2 |=
+   TG3_FLG2_PARALLEL_DETECT;
+   tp-serdes_counter =
+   SERDES_PARALLEL_DET_TIMEOUT;
+   } else
+   goto restart_autoneg;
}
}
+   } else {
+   tp-serdes_counter = SERDES_AN_TIMEOUT_5704S;
+   tp-tg3_flags2 = ~TG3_FLG2_PARALLEL_DETECT;
}
 
 out:
@@ -2599,14 +2611,16 @@ static int tg3_setup_fiber_phy(struct tg
MAC_STATUS_CFG_CHANGED));
udelay(5);
if ((tr32(MAC_STATUS)  (MAC_STATUS_SYNC_CHANGED |
-MAC_STATUS_CFG_CHANGED)) == 0)
+MAC_STATUS_CFG_CHANGED |
+MAC_STATUS_LNKSTATE_CHANGED)) == 0)
break;
}
 
mac_status = tr32(MAC_STATUS);
if ((mac_status  MAC_STATUS_PCS_SYNCED) == 0) {
current_link_up = 0;
-   if (tp-link_config.autoneg == AUTONEG_ENABLE) {
+   if (tp-link_config.autoneg == AUTONEG_ENABLE 
+   tp-serdes_counter == 0) {
tw32_f(MAC_MODE, (tp-mac_mode |
  MAC_MODE_SEND_CONFIGS));
udelay(1);
@@ -2711,7 +2725,7 @@ static int tg3_setup_fiber_mii_phy(struc
tg3_writephy(tp, MII_BMCR, bmcr);
 
tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED);
-   tp-tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED;
+   tp-serdes_counter = 

[PATCH 5/9][TG3]: Add tg3_poll_fw().

2006-09-27 Thread Michael Chan
[TG3]: Add tg3_poll_fw().

Put the firmware polling logic into a separate function.  This makes
the code cleaner.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index d443b73..eafca2a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -4662,6 +4662,35 @@ static void tg3_write_sig_legacy(struct 
}
 }
 
+static int tg3_poll_fw(struct tg3 *tp)
+{
+   int i;
+   u32 val;
+
+   /* Wait for firmware initialization to complete. */
+   for (i = 0; i  10; i++) {
+   tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, val);
+   if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
+   break;
+   udelay(10);
+   }
+
+   /* Chip might not be fitted with firmware.  Some Sun onboard
+* parts are configured like that.  So don't signal the timeout
+* of the above loop as an error, but do report the lack of
+* running firmware once.
+*/
+   if (i = 10 
+   !(tp-tg3_flags2  TG3_FLG2_NO_FWARE_REPORTED)) {
+   tp-tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
+
+   printk(KERN_INFO PFX %s: No firmware running.\n,
+  tp-dev-name);
+   }
+
+   return 0;
+}
+
 static void tg3_stop_fw(struct tg3 *);
 
 /* tp-lock is held. */
@@ -4669,7 +4698,7 @@ static int tg3_chip_reset(struct tg3 *tp
 {
u32 val;
void (*write_op)(struct tg3 *, u32, u32);
-   int i;
+   int err;
 
tg3_nvram_lock(tp);
 
@@ -4829,26 +4858,9 @@ static int tg3_chip_reset(struct tg3 *tp
tw32_f(MAC_MODE, 0);
udelay(40);
 
-   /* Wait for firmware initialization to complete. */
-   for (i = 0; i  10; i++) {
-   tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, val);
-   if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
-   break;
-   udelay(10);
-   }
-
-   /* Chip might not be fitted with firmare.  Some Sun onboard
-* parts are configured like that.  So don't signal the timeout
-* of the above loop as an error, but do report the lack of
-* running firmware once.
-*/
-   if (i = 10 
-   !(tp-tg3_flags2  TG3_FLG2_NO_FWARE_REPORTED)) {
-   tp-tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
-
-   printk(KERN_INFO PFX %s: No firmware running.\n,
-  tp-dev-name);
-   }
+   err = tg3_poll_fw(tp);
+   if (err)
+   return err;
 
if ((tp-tg3_flags2  TG3_FLG2_PCI_EXPRESS) 
tp-pci_chip_rev_id != CHIPREV_ID_5750_A0) {


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/9][TG3]: Add 5722 and 5756 support.

2006-09-27 Thread Michael Chan
[TG3]: Add 5722 and 5756 support.

Add IDs to support 5722 and 5756.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 14e9645..d443b73 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -173,6 +173,7 @@ static struct pci_device_id tg3_pci_tbl[
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5705F)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5720)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5721)},
+   {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5722)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750M)},
@@ -187,6 +188,7 @@ static struct pci_device_id tg3_pci_tbl[
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5754M)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755M)},
+   {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5756)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M)},
@@ -11273,6 +11275,7 @@ static char * __devinit tg3_phy_string(s
case PHY_ID_BCM5780:return 5780;
case PHY_ID_BCM5755:return 5755;
case PHY_ID_BCM5787:return 5787;
+   case PHY_ID_BCM5756:return 5722/5756;
case PHY_ID_BCM8002:return 8002/serdes;
case 0: return serdes;
default:return unknown;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index f7462c2..feed13d 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2282,6 +2282,7 @@ struct tg3 {
 #define PHY_ID_BCM5780 0x60008350
 #define PHY_ID_BCM5755 0xbc050cc0
 #define PHY_ID_BCM5787 0xbc050ce0
+#define PHY_ID_BCM5756 0xbc050ed0
 #define PHY_ID_BCM8002 0x60010140
 #define PHY_ID_INVALID 0x
 #define PHY_ID_REV_MASK0x000f
@@ -2308,7 +2309,8 @@ struct tg3 {
 (X) == PHY_ID_BCM5705 || (X) == PHY_ID_BCM5750 || \
 (X) == PHY_ID_BCM5752 || (X) == PHY_ID_BCM5714 || \
 (X) == PHY_ID_BCM5780 || (X) == PHY_ID_BCM5787 || \
-(X) == PHY_ID_BCM5755 || (X) == PHY_ID_BCM8002)
+(X) == PHY_ID_BCM5755 || (X) == PHY_ID_BCM5756 || \
+(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 6a1e098..d9e75be 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1905,6 +1905,7 @@
 #define PCI_DEVICE_ID_TIGON3_5705_20x1654
 #define PCI_DEVICE_ID_TIGON3_5720  0x1658
 #define PCI_DEVICE_ID_TIGON3_5721  0x1659
+#define PCI_DEVICE_ID_TIGON3_5722  0x165a
 #define PCI_DEVICE_ID_TIGON3_5705M 0x165d
 #define PCI_DEVICE_ID_TIGON3_5705M_2   0x165e
 #define PCI_DEVICE_ID_TIGON3_5714  0x1668
@@ -1914,6 +1915,7 @@
 #define PCI_DEVICE_ID_TIGON3_5705F 0x166e
 #define PCI_DEVICE_ID_TIGON3_5754M 0x1672
 #define PCI_DEVICE_ID_TIGON3_5755M 0x1673
+#define PCI_DEVICE_ID_TIGON3_5756  0x1674
 #define PCI_DEVICE_ID_TIGON3_5750  0x1676
 #define PCI_DEVICE_ID_TIGON3_5751  0x1677
 #define PCI_DEVICE_ID_TIGON3_5715  0x1678


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] atl1: Attansic L1 Gigabit Ethernet driver

2006-09-27 Thread Stephen Hemminger
Oh boy, another vendor driver to shred.

On Wed, 27 Sep 2006 08:23:45 -0500
Jay Cliburn [EMAIL PROTECTED] wrote:

 Full patch for the Attansic L1 gigabit ethernet driver.
 
 Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
 
  drivers/net/Kconfig |9 
  drivers/net/Makefile|1 
  drivers/net/atl1.c  | 5519 
 +++
  drivers/net/atl1.h  | 1598 ++
  include/linux/pci_ids.h |3 
  5 files changed, 7130 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
 index 6315477..b735b68 100644
 --- a/drivers/net/Kconfig
 +++ b/drivers/net/Kconfig
 @@ -2248,6 +2248,15 @@ config SPIDER_NET
 This driver supports the Gigabit Ethernet chips present on the
 Cell Processor-Based Blades from IBM.
  
 +config ATTANSIC_L1
 +tristate Attansic L1 gigabit ethernet support
 +depends on PCI
 +help
 +  This driver supports the Attansic L1 gigabit Ethernet device.
 +
 +  To compile this driver as a module, choose M here: the module
 +  will be called atl1.  This is recommended.
 +
  config GIANFAR
   tristate Gianfar Ethernet
   depends on 85xx || 83xx || PPC_86xx
 diff --git a/drivers/net/Makefile b/drivers/net/Makefile
 index f270bc4..e1fcb86 100644
 --- a/drivers/net/Makefile
 +++ b/drivers/net/Makefile
 @@ -69,6 +69,7 @@ obj-$(CONFIG_VIA_RHINE) += via-rhine.o
  obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o
  obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o
  obj-$(CONFIG_RIONET) += rionet.o
 +obj-$(CONFIG_ATTANSIC_L1) += atl1.o
  
  #
  # end link order section
 diff --git a/drivers/net/atl1.c b/drivers/net/atl1.c
 new file mode 100644
 index 000..ab87071
 --- /dev/null
 +++ b/drivers/net/atl1.c
 @@ -0,0 +1,5519 @@
 +/*
 + * atl1.c: Attansic L1 gigabit ethernet driver.
 + *
 + * This code is derived from the Attansic reference driver (copyright message
 + * below) provided to Jay Cliburn for addition to the Linux kernel.
 + *
 + * The code has been merged into one source file and cleaned up to follow
 + * Linux coding style.
 + *
 + * The changes are (c) Copyright 2006, Jay Cliburn ([EMAIL PROTECTED])
 + *
 + * This source has not been verified for use in safety critical systems.
 + *
 + * Please direct inquiries about the revamped driver to the linux-kernel
 + * mail list, not to Attansic.
 + *
 + * Original code:
 + *
 + * Copyright (c) 1999-2005 Attansic Corporation ([EMAIL PROTECTED])
 + *
 + * 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.
 + *
 + * Author: Xiong Huang
 + *
 + * MODULE_LICENSE(GPL);


Why bury this in a comment?
 + *
 + */
 +
 +
 +#include linux/module.h
 +#include linux/types.h
 +#include linux/init.h
 +#include linux/mm.h
 +#include linux/errno.h
 +#include linux/ioport.h
 +#include linux/pci.h
 +#include linux/kernel.h
 +#include linux/netdevice.h
 +#include linux/etherdevice.h
 +#include linux/skbuff.h
 +#include linux/delay.h
 +#include linux/timer.h
 +#include linux/slab.h
 +#include linux/interrupt.h
 +#include linux/string.h
 +#include asm/io.h
 +#include linux/reboot.h
 +#include linux/ethtool.h
 +#include linux/mii.h
 +#include linux/in.h
 +#include linux/ip.h
 +#include linux/tcp.h
 +#include linux/udp.h
 +#include linux/version.h
 +
 +
 +/* The following header files were provided in the original
 + * source code, but apparently weren't needed for compilation.
 + * They're left here for posterity.
 + */
 +/* #include linux/sched.h */
 +/* #include linux/pagemap.h */
 +/* #include linux/list.h */
 +/* #include linux/stddef.h */
 +/* #include linux/config.h */
 +/* #include linux/vmalloc.h */
 +/* #include linux/capability.h */
 +/* #include asm/byteorder.h */
 +/* #include asm/bitops.h */
 +/* #include asm/irq.h */
 +/* #include net/pkt_sched.h */
 +
 +#include atl1.h
 +
 +#define RUN_REALTIME 0
 +#define DRV_VERSION 0.1.40.6
 +
 +char at_driver_name[] = atl1;
 +char at_driver_string[] = Attansic L1 Ethernet Network Driver;
 +char at_driver_version[] = DRV_VERSION;
 +char at_copyright[] = Copyright (C) 1999-2005 Attansic Corporation.;

static const char...

 +
 +MODULE_AUTHOR(Attansic Corporation);
 +MODULE_DESCRIPTION(Attansic L1 1000M Ethernet Network Driver);
 +MODULE_LICENSE(GPL);
 +MODULE_VERSION(DRV_VERSION);
 +
 +static struct pci_device_id at_pci_tbl[] = {
 + { PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1,
 +   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
 + {0,}
 +};

use PCI_DEVICE macro

 +
 +MODULE_DEVICE_TABLE(pci, at_pci_tbl);
 +
 +/* This 

Re: [PATCH 5/9][TG3]: Add tg3_poll_fw().

2006-09-27 Thread Jeff Garzik

Michael Chan wrote:

+   /* Chip might not be fitted with firmware.  Some Sun onboard
+* parts are configured like that.  So don't signal the timeout
+* of the above loop as an error, but do report the lack of
+* running firmware once.
+*/
+   if (i = 10 
+   !(tp-tg3_flags2  TG3_FLG2_NO_FWARE_REPORTED)) {
+   tp-tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
+
+   printk(KERN_INFO PFX %s: No firmware running.\n,
+  tp-dev-name);
+   }
+
+   return 0;


You need to actually return failure, for the failure case.

Currently, this function is written to return an error code, but always 
returns zero.


Jeff



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/9][TG3]: Add tg3_poll_fw().

2006-09-27 Thread Michael Chan
On Wed, 2006-09-27 at 16:47 -0400, Jeff Garzik wrote:
 Michael Chan wrote:
  +   /* Chip might not be fitted with firmware.  Some Sun onboard
  +* parts are configured like that.  So don't signal the timeout
  +* of the above loop as an error, but do report the lack of
  +* running firmware once.
  +*/
  +   if (i = 10 
  +   !(tp-tg3_flags2  TG3_FLG2_NO_FWARE_REPORTED)) {
  +   tp-tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
  +
  +   printk(KERN_INFO PFX %s: No firmware running.\n,
  +  tp-dev-name);
  +   }
  +
  +   return 0;
 
 You need to actually return failure, for the failure case.
 
 Currently, this function is written to return an error code, but always 
 returns zero.
 
It's actually not a failure.  It was decided that we'll just print a
message once and continue.  Some SUN onboard chips do not have firmware.

In the next patch (6/9) where we support a new chip with a new firmware
polling method, it can return -ENODEV.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Bug#389804: mii-tool gigabit support. (fwd)

2006-09-27 Thread Bernd Eckenfels
On Wed, Sep 27, 2006 at 12:27:48PM -0700, dean gaudet wrote:
 Package: net-tools
 Version: 1.60-17
 
 the version of mii-tool referenced below (plus the patch below) provides 
 support for more mii types, and more importantly, allows it to report 
 1000baseT link states (which are otherwise misreported as 100baseT).
 
 please upgrade the version in net-tools... thanks!

thanks, I have added that to HEAD of net-tools CVS, will also be in next
debian package version.

cvs: http://net-tools.berlios.de

 On Tue, 26 Sep 2006, Stephen Hemminger wrote:
  The mii-tool utility seems to be abandoned and unmaintained?
  
  Here is a version that does standard 1000baseT support.
  http://developer.osdl.org/shemminger/prototypes/mii-tool.tar.bz2
...
 +for (i = 0; i  ((verbose  1) ? 32 : MII_BASIC_MAX); i++)
...
-- 
  (OO) -- [EMAIL PROTECTED] --
 ( .. )[EMAIL PROTECTED],linux.de,debian.org}  http://www.eckes.org/
  o--o   1024D/E383CD7E  [EMAIL PROTECTED]  v:+497211603874  f:+49721151516129
(OO)  When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl!
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] softmac: Fix WX and association related races

2006-09-27 Thread Christian
And a second try seems to hint at some acpi problems on the acer:
bcm43xx: Device resumed.
PM: Writing back config space on device :06:09.0 at offset f (was 34001ff, 
writing 5c0010b)
PM: Writing back config space on device :06:09.0 at offset e (was 0, 
writing 24fc)
PM: Writing back config space on device :06:09.0 at offset d (was 0, 
writing 2400)
PM: Writing back config space on device :06:09.0 at offset c (was 0, 
writing 20fc)
PM: Writing back config space on device :06:09.0 at offset b (was 0, 
writing 2000)
PM: Writing back config space on device :06:09.0 at offset a (was 0, 
writing 53fff000)
PM: Writing back config space on device :06:09.0 at offset 9 (was 0, 
writing 5200)
PM: Writing back config space on device :06:09.0 at offset 8 (was 0, 
writing 51fff000)
PM: Writing back config space on device :06:09.0 at offset 7 (was 0, 
writing 5000)
PM: Writing back config space on device :06:09.0 at offset 6 (was 0, 
writing b00a0706)
PM: Writing back config space on device :06:09.0 at offset 4 (was 0, 
writing c0308000)
PM: Writing back config space on device :06:09.0 at offset 3 (was 82, 
writing 82a810)
PM: Writing back config space on device :06:09.0 at offset 1 (was 210, 
writing 217)
ACPI: PCI Interrupt :06:09.0[A] - Link [LNKH] - GSI 11 (level, low) - 
IRQ 11
PM: Writing back config space on device :06:09.2 at offset f (was 4030300, 
writing 403030b)
PM: Writing back config space on device :06:09.2 at offset 5 (was 0, 
writing c030)
PM: Writing back config space on device :06:09.2 at offset 4 (was 0, 
writing c0309000)
PM: Writing back config space on device :06:09.2 at offset 3 (was 80, 
writing 804008)
PM: Writing back config space on device :06:09.2 at offset 1 (was 210, 
writing 2100016)
PM: Writing back config space on device :06:09.3 at offset f (was 40701ff, 
writing 407010b)
PM: Writing back config space on device :06:09.3 at offset 4 (was 0, 
writing c0306000)
PM: Writing back config space on device :06:09.3 at offset 3 (was 80, 
writing 804008)
PM: Writing back config space on device :06:09.3 at offset 1 (was 210, 
writing 212)
ACPI: PCI Interrupt :06:09.3[A] - Link [LNKH] - GSI 11 (level, low) - 
IRQ 11
Restarting tasks...7ACPI: read EC, OB not full
ACPI Exception (evregion-0424): AE_TIME, Returned by Handler for 
[EmbeddedControl] [20060707]
ACPI Exception (dswexec-0458): AE_TIME, While resolving operands for 
[OpcodeName unavailable] [20060707]
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.ACAD._PSR] 
(Node 810001fba690), AE_TIME
ACPI Exception (acpi_ac-0096): AE_TIME, Error reading AC Adapter state 
[20060707]
 done
ohci_hcd: 2005 April 22 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI)
ACPI: PCI Interrupt :00:13.0[A] - Link [LNKD] - GSI 10 (level, low) - 
IRQ 10
ohci_hcd :00:13.0: OHCI Host Controller
ohci_hcd :00:13.0: new USB bus registered, assigned bus number 2
ohci_hcd :00:13.0: irq 10, io mem 0xc000
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 4 ports detected
ACPI: PCI Interrupt :00:13.1[A] - Link [LNKD] - GSI 10 (level, low) - 
IRQ 10
ohci_hcd :00:13.1: OHCI Host Controller
ohci_hcd :00:13.1: new USB bus registered, assigned bus number 3
ohci_hcd :00:13.1: irq 10, io mem 0xc0001000
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 4 ports detected
Synaptics Touchpad, model: 1, fw: 5.9, id: 0x126eb1, caps: 0xa04713/0x4000
input: SynPS/2 Synaptics TouchPad as /class/input/input8
tg3.c:v3.65 (August 07, 2006)
ACPI: PCI Interrupt :05:00.0[A] - Link [LNKC] - GSI 10 (level, low) - 
IRQ 10
PCI: Setting latency timer of device :05:00.0 to 64
eth0: Tigon3 [partno(BCM95789) rev 4101 PHY(5750)] (PCI Express) 
10/100/1000BaseT Ethernet 00:c0:9f:b7:77:f3
eth0: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[0] Split[0] WireSpeed[1] TSOcap[1]
eth0: dma_rwctrl[7618] dma_mask[64-bit]
usb 3-2: new full speed USB device using ohci_hcd and address 2
usb 3-2: configuration #1 chosen from 1 choice
input: Bluetooth HID Boot Protocol Device as /class/input/input9
bcm43xx: Radio turned off
bcm43xx: DMA-32 0x0200 (RX) max used slots: 0/64
bcm43xx: DMA-32 0x02A0 (TX) max used slots: 0/512
bcm43xx: DMA-32 0x0280 (TX) max used slots: 0/512
bcm43xx: DMA-32 0x0260 (TX) max used slots: 0/512
bcm43xx: DMA-32 0x0240 (TX) max used slots: 0/512
bcm43xx: DMA-32 0x0220 (TX) max used slots: 2/512
bcm43xx: ASSERTION FAILED (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) 
at: 
drivers/net/wireless/bcm43xx/bcm43xx_main.c:1848:bcm43xx_interrupt_handler()
bcm43xx: DMA-32 0x0200 (TX) max used slots: 0/512
bcm43xx driver
ACPI: PCI Interrupt :06:02.0[A] - Link [LNKF] - GSI 11 (level, low) - 
IRQ 11
bcm43xx: Chip ID 0x4318, rev 0x2
bcm43xx: Number of cores: 4
bcm43xx: Core 0: ID 0x800, rev 0xd, vendor 0x4243, enabled
bcm43xx: Core 1: 

Re: [PATCH] softmac: Fix WX and association related races

2006-09-27 Thread Christian

Actually, I dont need the rmmod/modprobe of the module, I just need to do 
a /et   c/init.d/net.eth1 restart. So maybe just an isssue with wpa_supplicant 
or a missing ifconfig eth1 up?



Chris


On Wednesday 27 September 2006 19:50, Michael Buesch wrote:
 On Wednesday 27 September 2006 18:18, Larry Finger wrote:
  Michael Buesch wrote:
   This fixes some race conditions in the WirelessExtension
   handling and association handling code.
  
   Signed-off-by: Michael Buesch [EMAIL PROTECTED]
  
   ---
 
  This patch doesn't apply.

 Oh, linville merged stuff on the 25th. That's the day I updated
 my tree to do this patch. But seems like I did it just before
 the merge.
 Who could suspect that linville merges something. :D
 *me runs away*

 Anyway. Here's an updated patch.


 Index: wireless-2.6/include/net/ieee80211softmac.h
 ===
 --- wireless-2.6.orig/include/net/ieee80211softmac.h  2006-09-27
 19:34:20.0 +0200 +++
 wireless-2.6/include/net/ieee80211softmac.h   2006-09-27 19:36:39.0
 +0200 @@ -63,13 +63,11 @@ struct ieee80211softmac_wpa {

  /*
   * Information about association
 - *
 - * Do we need a lock for this?
 - * We only ever use this structure inlined
 - * into our global struct. I've used its lock,
 - * but maybe we need a local one here?
   */
  struct ieee80211softmac_assoc_info {
 +
 + struct mutex mutex;
 +
   /*
* This is the requested ESSID. It is written
* only by the WX handlers.
 @@ -99,12 +97,13 @@ struct ieee80211softmac_assoc_info {
*
* bssfixed is used for SIOCSIWAP.
*/
 - u8 static_essid:1,
 -short_preamble_available:1,
 -associating:1,
 -assoc_wait:1,
 -bssvalid:1,
 -bssfixed:1;
 + u8 static_essid;
 + u8 short_preamble_available;
 + u8 associating;
 + u8 associated;
 + u8 assoc_wait;
 + u8 bssvalid;
 + u8 bssfixed;

   /* Scan retries remaining */
   int scan_retry;
 @@ -229,12 +228,10 @@ struct ieee80211softmac_device {
   /* private stuff follows */
   /* this lock protects this structure */
   spinlock_t lock;
 -
 - /* couple of flags */
 - u8 scanning:1, /* protects scanning from being done multiple times at
 once */ -associated:1,
 -running:1;
 -
 +
 + u8 running; /* SoftMAC started? */
 + u8 scanning;
 +
   struct ieee80211softmac_scaninfo *scaninfo;
   struct ieee80211softmac_assoc_info associnfo;
   struct ieee80211softmac_bss_info bssinfo;
 @@ -250,7 +247,7 @@ struct ieee80211softmac_device {

   /* we need to keep a list of network structs we copied */
   struct list_head network_list;
 -
 +
   /* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
   u8 priv[0];
 @@ -295,7 +292,7 @@ static inline u8 ieee80211softmac_sugges
  {
   struct ieee80211softmac_txrates *txrates = mac-txrates;

 - if (!mac-associated)
 + if (!mac-associnfo.associated)
   return txrates-mgt_mcast_rate;

   /* We are associated, sending unicast frame */
 Index: wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c
 ===
 ---
 wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_assoc.c  
 2006-09-27
 19:34:20.0 +0200 +++
 wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c   2006-09-27
 19:36:39.0 +0200 @@ -48,7 +48,7 @@ ieee80211softmac_assoc(struct
 ieee80211s
   dprintk(KERN_INFO PFX sent association request!\n);

   spin_lock_irqsave(mac-lock, flags);
 - mac-associated = 0; /* just to make sure */
 + mac-associnfo.associated = 0; /* just to make sure */

   /* Set a timer for timeout */
   /* FIXME: make timeout configurable */
 @@ -62,24 +62,22 @@ ieee80211softmac_assoc_timeout(void *d)
  {
   struct ieee80211softmac_device *mac = (struct ieee80211softmac_device
 *)d; struct ieee80211softmac_network *n;
 - unsigned long flags;

 - spin_lock_irqsave(mac-lock, flags);
 + mutex_lock(mac-associnfo.mutex);
   /* we might race against ieee80211softmac_handle_assoc_response,
* so make sure only one of us does something */
 - if (!mac-associnfo.associating) {
 - spin_unlock_irqrestore(mac-lock, flags);
 - return;
 - }
 + if (!mac-associnfo.associating)
 + goto out;
   mac-associnfo.associating = 0;
   mac-associnfo.bssvalid = 0;
 - mac-associated = 0;
 + mac-associnfo.associated = 0;

   n = ieee80211softmac_get_network_by_bssid_locked(mac,
 mac-associnfo.bssid); -  spin_unlock_irqrestore(mac-lock, flags);

   dprintk(KERN_INFO PFX assoc request timed out!\n);
   ieee80211softmac_call_events(mac,
 IEEE80211SOFTMAC_EVENT_ASSOCIATE_TIMEOUT, n); +out:
 + mutex_unlock(mac-associnfo.mutex);
  }

  

Re: [PATCH] spidernet: Use pci_dma_mapping_error()

2006-09-27 Thread Jeff Garzik

applied

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/8] sky2: gigabit full duplex negotiation

2006-09-27 Thread Jeff Garzik

applied 1-8

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add NETPOLL Support to SB1250 driver

2006-09-27 Thread Jeff Garzik

Manish Lachwani wrote:

Hello!

Attached patch adds NETPOLL support for the Sibyte Network driver.

Thanks,
Manish Lachwani




Source: MontaVista Software, Inc. | Manish Lachwani [EMAIL PROTECTED]

NETPOLL support for Sibyte MAC



ACK patch, NAK patch format.

Most importantly, it uses attachments and doesn't include a 
Signed-off-by line.


Read Documentation/SubmittingPatches and 
http://linux.yyz.us/patch-format.html


Jeff


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ethtool: add sky2 register dump

2006-09-27 Thread Jeff Garzik

Stephen Hemminger wrote:

Add support for sky2 register dump, put it in a common file
for both skge and sky2.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


You should know this by now:  separate out logical changes into multiple 
patches.


When renaming a file AND making changes to it, your changes are 
completely obscured by the rename.


First patch should do the rename, but not change existing code.  Second 
patch should include any code updates you wish to make.


ACK changes, NAK in present form.


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PATCH] e100, e1000, ixgb updates for #upstream

2006-09-27 Thread Jeff Garzik

Auke Kok wrote:


Hi,

Here are updated updates targeted to branch #upstream-fixes from 
netdev-2.6, including

fixes to e100, e1000 and ixgb.

Changes from last weeks submission:
1) removed taint flag setting when eeprom csum fails (e100)
2) added CONFIG_PM wrappers around .suspend mthod (e1000)
3) added comments and (1  n) for hardware bit spanking function (e1000)
4) keep flow control enum (e1000)
5) clean up ethtool stats as much as possible to use real HW counters 
(e1000)

6) add patch from linas Vepstas (e1000, PCI_D3 etc state symbols)
7) add patch from Vasily Averin (e1000, memleak in e1000_set_ringparam)


Please pull from:

git pull git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream


pulled


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


netdev-2.6.git rebased

2006-09-27 Thread Jeff Garzik
Just an FYI:  I rebased netdev#ALL and netdev#e100-sbit branches.  All 
other branches (master, upstream) behave as normal.


Jeff


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] softmac: Fix WX and association related races

2006-09-27 Thread Benjamin Herrenschmidt
On Wed, 2006-09-27 at 17:26 +0200, Michael Buesch wrote:
 This fixes some race conditions in the WirelessExtension
 handling and association handling code.

Unlike the previous patch, this one doesn't apply on top of 2.6.18
(which I'm using as a basis for testing, along with Larry big bcm43xx
patch).

Ben.

 Signed-off-by: Michael Buesch [EMAIL PROTECTED]
 
 ---
 
 Hi John,
 
 Please apply this fo wireless-2.6 and push it with your
 next push of bugfixes.
 There are other theoretical raceconditions possible in softmac
 related to scanning and assoc code. But I don't really want to fix
 these, as I think they:
 1) are not triggerable in real world conditions.
 2) are not exploitable to do some bad attacks, etc...
 3) require _huge_ changes to softmac, and I don't really
want to spend more effort into softmac any longer.
 This patch fixes some real-world exploitable bugs, so better
 fix them to have working wireless until d80211 is ready for
 prime-time.
 
 btw: d80211 might have similiar race conditions like this.
 
 Larry, once this patch settled a little bit and enough people
 tested it, you might want to try pushing it into -stable (although
 it's big...)
 
 
 Index: wireless-2.6/include/net/ieee80211softmac.h
 ===
 --- wireless-2.6.orig/include/net/ieee80211softmac.h  2006-09-25 
 17:02:08.0 +0200
 +++ wireless-2.6/include/net/ieee80211softmac.h   2006-09-27 
 16:39:17.0 +0200
 @@ -63,13 +63,11 @@ struct ieee80211softmac_wpa {
  
  /*
   * Information about association
 - *
 - * Do we need a lock for this?
 - * We only ever use this structure inlined
 - * into our global struct. I've used its lock,
 - * but maybe we need a local one here?
   */
  struct ieee80211softmac_assoc_info {
 +
 + struct mutex mutex;
 +
   /*
* This is the requested ESSID. It is written
* only by the WX handlers.
 @@ -99,12 +97,13 @@ struct ieee80211softmac_assoc_info {
*
* bssfixed is used for SIOCSIWAP.
*/
 - u8 static_essid:1,
 -short_preamble_available:1,
 -associating:1,
 -assoc_wait:1,
 -bssvalid:1,
 -bssfixed:1;
 + u8 static_essid;
 + u8 short_preamble_available;
 + u8 associating;
 + u8 associated;
 + u8 assoc_wait;
 + u8 bssvalid;
 + u8 bssfixed;
  
   /* Scan retries remaining */
   int scan_retry;
 @@ -229,12 +228,10 @@ struct ieee80211softmac_device {
   /* private stuff follows */
   /* this lock protects this structure */
   spinlock_t lock;
 - 
 - /* couple of flags */
 - u8 scanning:1, /* protects scanning from being done multiple times at 
 once */
 -associated:1,
 -running:1;
 - 
 +
 + u8 running; /* SoftMAC started? */
 + u8 scanning;
 +
   struct ieee80211softmac_scaninfo *scaninfo;
   struct ieee80211softmac_assoc_info associnfo;
   struct ieee80211softmac_bss_info bssinfo;
 @@ -250,7 +247,7 @@ struct ieee80211softmac_device {
  
   /* we need to keep a list of network structs we copied */
   struct list_head network_list;
 - 
 +
   /* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
   u8 priv[0];
 @@ -295,7 +292,7 @@ static inline u8 ieee80211softmac_sugges
  {
   struct ieee80211softmac_txrates *txrates = mac-txrates;
  
 - if (!mac-associated)
 + if (!mac-associnfo.associated)
   return txrates-mgt_mcast_rate;
  
   /* We are associated, sending unicast frame */
 Index: wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c
 ===
 --- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_assoc.c  
 2006-09-17 15:21:53.0 +0200
 +++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c   
 2006-09-27 17:10:08.0 +0200
 @@ -48,7 +48,7 @@ ieee80211softmac_assoc(struct ieee80211s
   dprintk(KERN_INFO PFX sent association request!\n);
  
   spin_lock_irqsave(mac-lock, flags);
 - mac-associated = 0; /* just to make sure */
 + mac-associnfo.associated = 0; /* just to make sure */
  
   /* Set a timer for timeout */
   /* FIXME: make timeout configurable */
 @@ -62,24 +62,22 @@ ieee80211softmac_assoc_timeout(void *d)
  {
   struct ieee80211softmac_device *mac = (struct ieee80211softmac_device 
 *)d;
   struct ieee80211softmac_network *n;
 - unsigned long flags;
  
 - spin_lock_irqsave(mac-lock, flags);
 + mutex_lock(mac-associnfo.mutex);
   /* we might race against ieee80211softmac_handle_assoc_response,
* so make sure only one of us does something */
 - if (!mac-associnfo.associating) {
 - spin_unlock_irqrestore(mac-lock, flags);
 - return;
 - }
 + if (!mac-associnfo.associating)
 + goto out;
   

Re: [PATCH] softmac: Fix WX and association related races

2006-09-27 Thread Benjamin Herrenschmidt
On Wed, 2006-09-27 at 19:50 +0200, Michael Buesch wrote:
 On Wednesday 27 September 2006 18:18, Larry Finger wrote:
  Michael Buesch wrote:
   This fixes some race conditions in the WirelessExtension
   handling and association handling code.
   
   Signed-off-by: Michael Buesch [EMAIL PROTECTED]
   
   ---
  
  This patch doesn't apply.
 
 Oh, linville merged stuff on the 25th. That's the day I updated
 my tree to do this patch. But seems like I did it just before
 the merge.
 Who could suspect that linville merges something. :D
 *me runs away*
 
 Anyway. Here's an updated patch.

Which still doesn't apply to 2.6.18.

I won't try some random other git tree to test things, it's simply not
feasible for me and we need something we can give to distros to backport
so they have something remotely stable (I'm thinking for example about
the upcoming ubuntu edgy which is coming out soon an a 2.6.17 base).

Ben.


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] ethtool: spelling fix

2006-09-27 Thread Stephen Hemminger
Fix my bogus spelling.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
---
 marvell.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/marvell.c b/marvell.c
index 373ebcf..c44fea3 100644
--- a/marvell.c
+++ b/marvell.c
@@ -68,9 +68,9 @@ static void dump_queue(const char *name,
printf(Status   0x%08X\n, d-status);
printf(Timestamp0x%08X\n, d-timestamp);
if (rx) {
-   printf(Csum1  Offset %4d Positon   %d\n,
+   printf(Csum1  Offset %4d Position  %d\n,
   d-csum1, d-csum1_start);
-   printf(Csum2  Offset %4d Positon   %d\n,
+   printf(Csum2  Offset %4d Position  %d\n,
   d-csum2, d-csum2_start);
} else
printf(Csum Start 0x%04X Pos %4d Write %d\n,
-- 
1.4.1

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] ethtool: move skge.c to marvell.c

2006-09-27 Thread Stephen Hemminger

The code will be common for skge and sky2

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
---
 Makefile.am |2 -
 marvell.c   |  189 +++
 skge.c  |  189 ---
 3 files changed, 190 insertions(+), 190 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c78eecf..97ad512 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,7 +7,7 @@ sbin_PROGRAMS = ethtool
 ethtool_SOURCES = ethtool.c ethtool-copy.h ethtool-util.h  \
  amd8111e.c de2104x.c e100.c e1000.c   \
  fec_8xx.c ibm_emac.c ixgb.c natsemi.c \
- pcnet32.c realtek.c tg3.c skge.c
+ pcnet32.c realtek.c tg3.c marvell.c
 
 dist-hook:
cp $(top_srcdir)/ethtool.spec $(distdir)
diff --git a/marvell.c b/marvell.c
new file mode 100644
index 000..23282f5
--- /dev/null
+++ b/marvell.c
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2004
+ *  Stephen Hemminger [EMAIL PROTECTED]
+ */
+
+#include stdio.h
+
+#include ethtool-util.h
+
+static void dump_addr(int n, const u8 *a)
+{
+   int i;
+
+   printf(Addr %d, n);
+   for (i = 0; i  6; i++)
+   printf(%02X%c, a[i], i == 5 ? '\n' : ' ');
+}
+
+static void dump_timer(const char *name, const void *p)
+{
+   const u8 *a = p;
+   const u32 *r = p;
+
+   printf(%s\n, name);
+   printf(\tInit 0x%08X Value 0x%08X\n, r[0], r[1]);
+   printf(\tTest 0x%02X   Control 0x%02X\n, a[8], a[9]);
+}
+
+static void dump_queue(const char *name, const void *a, int rx)
+{
+   struct desc {
+   u_int32_t   ctl;
+   u_int32_t   next;
+   u_int32_t   data_lo;
+   u_int32_t   data_hi;
+   u_int32_t   status;
+   u_int32_t   timestamp;
+   u_int16_t   csum2;
+   u_int16_t   csum1;
+   u_int16_t   csum2_start;
+   u_int16_t   csum1_start;
+   u_int32_t   addr_lo;
+   u_int32_t   addr_hi;
+   u_int32_t   count_lo;
+   u_int32_t   count_hi;
+   u_int32_t   byte_count;
+   u_int32_t   csr;
+   u_int32_t   flag;
+   };
+   const struct desc *d = a;
+
+   printf(\n%s\n, name);
+   printf(---\n);
+   printf(Descriptor Address   0x%08X%08X\n,
+  d-addr_hi, d-addr_lo);
+   printf(Address Counter  0x%08X%08X\n,
+  d-count_hi, d-count_lo);
+   printf(Current Byte Counter %d\n, d-byte_count);
+   printf(BMU Control/Status   0x%08X\n, d-csr);
+   printf(Flag  FIFO Address  0x%08X\n, d-flag);
+   printf(\n);
+   printf(Control  0x%08X\n, d-ctl);
+   printf(Next 0x%08X\n, d-next);
+   printf(Data 0x%08X%08X\n,
+  d-data_hi, d-data_lo);
+   printf(Status   0x%08X\n, d-status);
+   printf(Timestamp0x%08X\n, d-timestamp);
+   if (rx) {
+   printf(Csum1  Offset %4d Positon   %d\n,
+  d-csum1, d-csum1_start);
+   printf(Csum2  Offset %4d Positon   %d\n,
+  d-csum2, d-csum2_start);
+   } else
+   printf(Csum Start 0x%04X Pos %4d Write %d\n,
+  d-csum1, d-csum2_start, d-csum1_start);
+
+}
+
+static void dump_ram(const char *name, const void *p)
+{
+   const u32 *r = p;
+
+   printf(\n%s\n, name);
+   printf(---\n);
+   printf(Start Address0x%08X\n, r[0]);
+   printf(End Address  0x%08X\n, r[1]);
+   printf(Write Pointer0x%08X\n, r[2]);
+   printf(Read Pointer 0x%08X\n, r[3]);
+   printf(Upper Threshold/Pause Packets0x%08X\n, r[4]);
+   printf(Lower Threshold/Pause Packets0x%08X\n, r[5]);
+   printf(Upper Threshold/High Priority0x%08X\n, r[6]);
+   printf(Lower Threshold/High Priority0x%08X\n, r[7]);
+   printf(Packet Counter   0x%08X\n, r[8]);
+   printf(Level0x%08X\n, r[9]);
+   printf(Test 0x%08X\n, r[10]);
+}
+
+static void dump_fifo(const char *name, const void *p)
+{
+   const u32 *r = p;
+
+   printf(\n%s\n, name);
+   printf(---\n);
+   printf(End Address  0x%08X\n, r[0]);
+   printf(Write Pointer0x%08X\n, r[1]);
+   printf(Read Pointer 0x%08X\n, r[2]);
+   printf(Packet Counter 

[PATCH 2/4] ethtool: sky2 support

2006-09-27 Thread Stephen Hemminger

Add full support for sky2 chip

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
---
 ethtool-util.h |3 +
 ethtool.c  |1 
 marvell.c  |  204 +---
 3 files changed, 183 insertions(+), 25 deletions(-)

diff --git a/ethtool-util.h b/ethtool-util.h
index 0e6fce2..0909a5a 100644
--- a/ethtool-util.h
+++ b/ethtool-util.h
@@ -51,4 +51,7 @@ int tg3_dump_regs(struct ethtool_drvinfo
 /* SysKonnect Gigabit (Genesis and Yukon) */
 int skge_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
 
+/* SysKonnect Gigabit (Yukon2) */
+int sky2_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
+
 #endif
diff --git a/ethtool.c b/ethtool.c
index 2363b3b..b783248 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -957,6 +957,7 @@ static struct {
{ ibm_emac, ibm_emac_dump_regs },
{ tg3, tg3_dump_regs },
{ skge, skge_dump_regs },
+   { sky2, sky2_dump_regs },
 };
 
 static int dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
diff --git a/marvell.c b/marvell.c
index 23282f5..08fdbd9 100644
--- a/marvell.c
+++ b/marvell.c
@@ -1,5 +1,7 @@
 /*
- * Copyright (C) 2004
+ * Code to dump Marvell SysKonnect registers for skge and sky2 drivers.
+ *
+ * Copyright (C) 2004, 2006
  *  Stephen Hemminger [EMAIL PROTECTED]
  */
 
@@ -111,6 +113,48 @@ static void dump_fifo(const char *name, 
dump_timer(LED, p + 0x20);
 }
 
+static void dump_mac(const u8 *r)
+{
+   printf(\nMAC Addresses\n);
+   printf(---\n);
+   dump_addr(1, r + 0x100);
+   dump_addr(2, r + 0x108);
+   dump_addr(3, r + 0x110);
+   printf(\n);
+
+   printf(Connector type   0x%02X\n, r[0x118]);
+   printf(PMD type 0x%02X\n, r[0x119]);
+   printf(Configuration0x%02X\n, r[0x11a]);
+   printf(Chip Revision0x%02X\n, r[0x11b]);
+}
+   
+static void dump_gma(const char *name, const u8 *r)
+{
+   int i;
+
+   printf(%12s address: , name);
+   for (i = 0; i  3; i++) {
+   u16 a = *(u16 *)(r + i * 4);
+   printf( %02X %02X, a  0xff, (a  8)  0xff);
+   }
+   printf(\n);
+}
+
+static void dump_gmac(const char *name, const u8 *data)
+{
+   printf(\n%s\n, name);
+   printf(Status   0x%04X\n, *(u16 *) data);
+   printf(Control  0x%04X\n, *(u16 *) (data + 4));
+   printf(Transmit 0x%04X\n, *(u16 *) (data + 8));
+   printf(Receive  0x%04X\n, *(u16 *) (data + 0xc));
+   printf(Transmit flow control0x%04X\n, *(u16 *) (data + 0x10));
+   printf(Transmit parameter   0x%04X\n, *(u16 *) (data + 0x14));
+   printf(Serial mode  0x%04X\n, *(u16 *) (data + 0x18));
+
+   dump_gma(Source, data + 0x1c);
+   dump_gma(Physical, data + 0x28);
+}
+
 int skge_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 {
const u32 *r = (const u32 *) regs-data;
@@ -138,21 +182,8 @@ int skge_dump_regs(struct ethtool_drvinf
printf(CSR Sync Queue 2 0x%08X\n, r[28]);
}
 
-   printf(\nMAC Address\n);
-   printf(-\n);
-   dump_addr(1, regs-data + 0x100);
-   dump_addr(2, regs-data + 0x108);
-   dump_addr(3, regs-data + 0x110);
-   printf(\n);
-
-   printf(Connector type 0x%02X\n,
-  regs-data[0x118]);
-   printf(PMD type   0x%02X\n,
-  regs-data[0x119]);
-   printf(Configuration  0x%02X\n,
-  regs-data[0x11a]);
-   printf(Chip Revision  0x%02X\n,
-  regs-data[0x11b]);
+   dump_mac(regs-data);
+   dump_gmac(GMAC 1, regs-data + 0x2800);
 
dump_timer(Timer, regs-data + 0x130);
dump_timer(IRQ Moderation, regs-data +0x140);
@@ -161,24 +192,24 @@ int skge_dump_regs(struct ethtool_drvinf
dump_queue(Receive Queue 1, regs-data +0x400, 1);
dump_queue(Sync Transmit Queue 1, regs-data +0x600, 0);
dump_queue(Async Transmit Queue 1, regs-data +0x680, 0);
-   if (dual) {
-   dump_queue(Receive Queue 2, regs-data +0x480, 1);
-   dump_queue(Async Transmit Queue 2, regs-data +0x780, 0);
-   dump_queue(Sync Transmit Queue 2, regs-data +0x700, 0);
-   }
 
dump_ram(Receive RAMbuffer 1, regs-data+0x800);
dump_ram(Sync Transmit RAMbuffer 1, regs-data+0xa00);
dump_ram(Async Transmit RAMbuffer 1, regs-data+0xa80);
+
+   dump_fifo(Receive MAC FIFO 1, regs-data+0xc00);
+   dump_fifo(Transmit MAC FIFO 1, regs-data+0xd00);
if (dual) {
+   dump_gmac(GMAC 1, regs-data + 0x2800);
+
+   dump_queue(Receive Queue 2, regs-data +0x480, 1);
+   dump_queue(Async Transmit Queue 2, 

[PATCH 3/4] ethtool: don't show sync queue's on skge/sky2

2006-09-27 Thread Stephen Hemminger
Remove printout of synchronous transmit queue info because
it is unused by the driver.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
---
 marvell.c |   22 +++---
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/marvell.c b/marvell.c
index 08fdbd9..373ebcf 100644
--- a/marvell.c
+++ b/marvell.c
@@ -174,12 +174,12 @@ int skge_dump_regs(struct ethtool_drvinf
printf(\nBus Management Unit\n);
printf(---\n);
printf(CSR Receive Queue 1  0x%08X\n, r[24]);
-   printf(CSR Sync Queue 1 0x%08X\n, r[26]);
+// printf(CSR Sync Queue 1 0x%08X\n, r[26]);
printf(CSR Async Queue 10x%08X\n, r[27]);
if (dual) {
printf(CSR Receive Queue 2  0x%08X\n, r[25]);
printf(CSR Async Queue 20x%08X\n, r[29]);
-   printf(CSR Sync Queue 2 0x%08X\n, r[28]);
+// printf(CSR Sync Queue 2 0x%08X\n, r[28]);
}
 
dump_mac(regs-data);
@@ -190,11 +190,11 @@ int skge_dump_regs(struct ethtool_drvinf
dump_timer(Blink Source, regs-data +0x170);
 
dump_queue(Receive Queue 1, regs-data +0x400, 1);
-   dump_queue(Sync Transmit Queue 1, regs-data +0x600, 0);
+// dump_queue(Sync Transmit Queue 1, regs-data +0x600, 0);
dump_queue(Async Transmit Queue 1, regs-data +0x680, 0);
 
dump_ram(Receive RAMbuffer 1, regs-data+0x800);
-   dump_ram(Sync Transmit RAMbuffer 1, regs-data+0xa00);
+// dump_ram(Sync Transmit RAMbuffer 1, regs-data+0xa00);
dump_ram(Async Transmit RAMbuffer 1, regs-data+0xa80);
 
dump_fifo(Receive MAC FIFO 1, regs-data+0xc00);
@@ -204,10 +204,10 @@ int skge_dump_regs(struct ethtool_drvinf
 
dump_queue(Receive Queue 2, regs-data +0x480, 1);
dump_queue(Async Transmit Queue 2, regs-data +0x780, 0);
-   dump_queue(Sync Transmit Queue 2, regs-data +0x700, 0);
+// dump_queue(Sync Transmit Queue 2, regs-data +0x700, 0);
 
dump_ram(Receive RAMbuffer 2, regs-data+0x880);
-   dump_ram(Sync Transmit RAMbuffer 2, regs-data+0xb00);
+// dump_ram(Sync Transmit RAMbuffer 2, regs-data+0xb00);
dump_ram(Async Transmit RAMbuffer 21, regs-data+0xb80);
 
dump_fifo(Receive MAC FIFO 2, regs-data+0xc80);
@@ -282,14 +282,14 @@ int sky2_dump_regs(struct ethtool_drvinf
printf(\nBus Management Unit\n);
printf(---\n);
printf(CSR Receive Queue 1  0x%08X\n, r[24]);
-   printf(CSR Sync Queue 1 0x%08X\n, r[26]);
+// printf(CSR Sync Queue 1 0x%08X\n, r[26]);
printf(CSR Async Queue 10x%08X\n, r[27]);
 
dual = (regs-data[0x11e]  2) != 0;
if (dual) {
printf(CSR Receive Queue 2  0x%08X\n, r[25]);
printf(CSR Async Queue 20x%08X\n, r[29]);
-   printf(CSR Sync Queue 2 0x%08X\n, r[28]);
+// printf(CSR Sync Queue 2 0x%08X\n, r[28]);
}
 
dump_mac(regs-data);
@@ -324,17 +324,17 @@ int sky2_dump_regs(struct ethtool_drvinf
dump_timer(ISR, regs-data + 0xed0);
 
dump_queue2(Receive Queue 1, regs-data +0x400, 1);
-   dump_queue(Sync Transmit Queue 1, regs-data +0x600, 0);
+// dump_queue(Sync Transmit Queue 1, regs-data +0x600, 0);
dump_queue2(Async Transmit Queue 1, regs-data +0x680, 0);
 
 
dump_ram(Receive RAMbuffer 1, regs-data+0x800);
-   dump_ram(Sync Transmit RAMbuffer 1, regs-data+0xa00);
+// dump_ram(Sync Transmit RAMbuffer 1, regs-data+0xa00);
dump_ram(Async Transmit RAMbuffer 1, regs-data+0xa80);
 
if (dual) {
dump_ram(Receive RAMbuffer 2, regs-data+0x880);
-   dump_ram(Sync Transmit RAMbuffer 2, regs-data+0xb00);
+// dump_ram(Sync Transmit RAMbuffer 2, regs-data+0xb00);
dump_ram(Async Transmit RAMbuffer 21, regs-data+0xb80);
dump_gmac(GMAC 2, regs-data + 0x3800);
}
-- 
1.4.1

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >