Re: BUG: soft lockup detected on CPU#0! (2.6.18.2 plus hacks)

2007-01-09 Thread Jarek Poplawski
On Mon, Jan 08, 2007 at 10:03:50AM -0800, Stephen Hemminger wrote:
 On Mon, 08 Jan 2007 08:57:10 -0800
 Ben Greear [EMAIL PROTECTED] wrote:
 
  Jarek Poplawski wrote:
   On Fri, Jan 05, 2007 at 12:33:43PM -0800, Ben Greear wrote:
   ...
 
   So, I do believe this was the problem we were hitting, and it seems 
   fixed.
   
  
   Congratulations!
  
   But I can see one strange thing in vlan.c:
  
   /* Must be invoked with RCU read lock (no preempt) */
   static struct vlan_group *__vlan_find_group(int real_dev_ifindex)
   ...
* Must be invoked with RCU read lock (no preempt)
*/
   struct net_device *__find_vlan_dev(struct net_device *real_dev,
   ...
  
   But later in this file no sign of disabling preemption
   for these calls and for hlist_add_head_rcu and hlist_del_rcu.
  
   I can't imagine how this works?
 
 Preempt is already disabled on the receive path.

I'm not sure you're talking about the same thing -
there is blocking possible inside register_vlan_dev
and unregister_vlan_dev, grp pointer is held during
this blocking - I've thought it's only possible in
sleepable RCU...

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: [PATCH] INET: fix incorrect inet_sock-is_icsk assignment

2007-01-09 Thread Jarek Poplawski
On Mon, Jan 08, 2007 at 09:47:29AM -0500, Paul Moore wrote:
...
 I guess it all depends on who is reading it ;)

Sure! I only had a feeling your way is maybe slightly
less often used so I wanted some opinion.

 Personally, I don't care too 
 much either way as long as it is fixed.

Yes, you've done great work, no doubt. But if you
consider this code will probably become classical
and will be read, quoted and teached next 1000
years, then the style could matter...

Cheers,
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: kernel BUG in eth_alloc_tx_desc_index at drivers/net/mv643xx_eth.c:1069!

2007-01-09 Thread Thibaut VARENE

On 1/9/07, Jarek Poplawski [EMAIL PROTECTED] wrote:

On Tue, Jan 09, 2007 at 11:27:59AM +0100, Thibaut VARENE wrote:
...
 I suspected both and changed both the disk and the ram for quality
 parts, that I tested afterwards. Both passed thorough tests.

You wrote about half an hour, so overheating was also
considered, I presume.


Yes, but since it works fine with the other NIC... :)


 Finally, using the other NIC on the box (a VIA Rhine II, 100Mbps),
 works absolutely fine.

So it looks like the card/driver (or maybe this specimen?).


I'm suspecting the driver, but I'm not a specialist :)
It's true that this particular card specimen could be damaged even
though that seems a bit unlikely.

HTH

T-Bone

--
Thibaut VARENE
http://www.parisc-linux.org/~varenet/
-
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: kernel BUG in eth_alloc_tx_desc_index at drivers/net/mv643xx_eth.c:1069!

2007-01-09 Thread Jarek Poplawski
On Tue, Jan 09, 2007 at 11:56:59AM +0100, Thibaut VARENE wrote:
...
 I'm suspecting the driver, but I'm not a specialist :)

No problem, me also!

I've also suspected the driver, looked at the
code, found nothing yet (as expected), but this
info about exception in malloc, introduces some
doubts...  

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: kernel BUG in eth_alloc_tx_desc_index at drivers/net/mv643xx_eth.c:1069!

2007-01-09 Thread Jarek Poplawski
On Tue, Jan 09, 2007 at 11:27:59AM +0100, Thibaut VARENE wrote:
...
 I suspected both and changed both the disk and the ram for quality
 parts, that I tested afterwards. Both passed thorough tests.
 
 Finally, using the other NIC on the box (a VIA Rhine II, 100Mbps),
 works absolutely fine.

If you are not tired, I'd suggest two more tests:

- as above but with NIC set to 100Mbps also,

- long downloading but without nfs e.g. ftp
(btw. there were some patches after 2.6.19
for rpc memory races).

Jarek P.

PS: Maintainers were cc-ed, I hope?
-
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/5] s390: qeth driver fixes

2007-01-09 Thread Frank Pavlic
Sorry for the trouble and also thank you very much
for having done the extra work. I made the patches
using git-format-patch so seems that I have to review
them more carefully or I still haven't understand to use
git-format-patch properly. 
In any case I will read the documents you mentioned 
once again to keep such points in mind...


Frank

On Tue, Jan 09, 2007 at 02:23:23AM -0500, Jeff Garzik wrote:
 Frank Pavlic wrote:
 Hi ,
 
 please apply following 5 patches for s390 network device drivers.
 Sorry for the fifth patch containing some lines which just remove
 whitespaces. Another patch will follow in the next couple of days
 with more whitespace and coding style cleanups in drivers/s390/net.
 
 Thank you
 
 Frank
 
 [PATCH 1/5] s390: qeth driver fixes
 
 From: Frank Blaschka [EMAIL PROTECTED]
 From: Ursula Braun [EMAIL PROTECTED]
 - VLAN header reordering did not work on packets
   received through qeth interface in layer 2 mode.
   This caused dhcpcd not to work with VLAN devices.
  - set qeth performance statistics initally inactive
 
 Signed-off-by: Frank Pavlic [EMAIL PROTECTED]
 
 applied patches 1-4 of 5.  patch #5 failed to apply, and also, it's not
 really appropriate for the current release candidate bugfix window.
 
 Also:
 
 1) Please include notes to me and reviewers following the --- marker.
  Everything before the --- is copied /verbatim/ into the kernel
 changelog.  Everything after ---, except the patch itself, is ignored.
 
 I had to hand-edit each of your patches, to remove the Hi , ... Frank
 paragraph and the [PATCH 1/5] S390: ... from the body of each email.
 
 2) Your subject line should be more descriptive.  The subject line is
 used to generate a one-line summary.  You can see how your subject lines
 are vague:
 
   [PATCH] s390: qeth driver fixes
   [PATCH] s390: qeth driver fixes
   [PATCH] s390: qeth driver fixes
 
 Here, I had to hand-edit each email subject line to be more descriptive.
 
 3) In general, review 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
-
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/5] s390: qeth driver fixes

2007-01-09 Thread Jeff Garzik

Frank Pavlic wrote:

Sorry for the trouble and also thank you very much
for having done the extra work. I made the patches
using git-format-patch so seems that I have to review
them more carefully or I still haven't understand to use
git-format-patch properly. 
In any case I will read the documents you mentioned 
once again to keep such points in mind...


If you are using git, maybe its as simple as checking in each patch with 
a unique first-line (== one-line summary)?


Also, if you so choose, you are welcome to submit changes directly via 
git to me, just like Martin Schwidefsky does with the main S/390 changes.


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: Using 802.11x wireless usb device on MIPS platform

2007-01-09 Thread Ralf Baechle
On Tue, Jan 09, 2007 at 10:52:14AM +0800, colin wrote:

 I have used two 802.11x wireless usb devices successfully on MIPS platform.
 One is realtek 8187 and the other one is ralink 2571.
 I would like to put them into kernel tree and then I found that there are
 not many 802.11x devices supported in Linux.

If you want to submit a driver to the kernel, please post it to
[EMAIL PROTECTED]  Don't expect a driver to be just accepted; it
will go through a thorough review and after all the issues have been
resolved it will be accepted.

 Moreover, there is no any wireless usb device supported.

Wireless support under Linux is suffering from several problems:

 o some core require microcode to be loaded but the vendor does not
   give such permission.
 o lack of documentation, sometimes for paranoid or bogus legal reasons or
   intellectual property concerns.

At times it really seems vendors are working to maximize pain for the user ...

 It is also very strange that 8187 and 2571 both have their own ieee802.11x
 stack and crypt drivers. It seems that Linux doesn't offer them.
 I am wondering why Linux is so complex in 802.11x.

Well, for one thing because 802.11 is complex.  The Linux wireless support
has gone through several generations; some of the wireless work was for
one or the other reason never integrated in the kernel.org kernel.

  Ralf
-
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] INET: fix incorrect inet_sock-is_icsk assignment

2007-01-09 Thread Paul Moore
On Tuesday 09 January 2007 3:43 am, Jarek Poplawski wrote:
 ... But if you consider this code will probably become classical
 and will be read, quoted and teached next 1000 years, then the style
 could matter... 

This from the guy who believes Justin Timberlake rocks! ;)

All right, you convinced me, I'll send out a patch to the patch later today.

-- 
paul moore
linux security @ hp
-
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] INET: fix incorrect inet_sock-is_icsk assignment

2007-01-09 Thread Arnaldo Carvalho de Melo

On 1/9/07, Paul Moore [EMAIL PROTECTED] wrote:

On Tuesday 09 January 2007 3:43 am, Jarek Poplawski wrote:
 ... But if you consider this code will probably become classical
 and will be read, quoted and teached next 1000 years, then the style
 could matter...

This from the guy who believes Justin Timberlake rocks! ;)

All right, you convinced me, I'll send out a patch to the patch later today.


/me grins

I see I don't have to worry that much with style nitpicking, keep it up!

- Arnaldo
-
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


RED + ECN not working

2007-01-09 Thread rbj2
Hello,

I have been trying to get the RED qdisc and ECN to work for the past few weeks
and all my experiments have failed. Here is the setup I am using. 

Src -- R1 -- R2 -- Dst

Between Src and R1 is a 100Mbps link and between R1 and R2 a 10Mbps link. I set 
up
the qdisc at R1 as follows

tc qdisc add dev eth3 root handle 1: prio
tc qdisc add dev eth3 parent 1:1 handle 10: sfq
tc qdisc add dev eth3 parent 1:2 handle 20: sfq
tc qdisc add dev eth3 parent 1:3 handle 30: red limit 1 min 3000 max 5000
avpkt 1000 burst 5 probability 0.5 bandwidth 256kbit ecn

I also inserted printk statments inside the code to print the calculate queue 
average (RED param), the 
backlog (Qdisc param) and the queue length (sk_buff_head param). I also 
inserted print statements for 
each action of RED i.e. DONT_MARK, PROB_MARK, HARD_MARK and DROP.

For the purpose of my experiments, I transferred a 25 MB file. I also did 100 
simultaneous TCP 
transfers for 2 mins using ipref. In all cases none of the packets were either 
marked or dropped by the 
RED code. This was verified by the print statements in the logs. For all runs, 
qavg and backlog were 0 
and qlen was 1. 

I have even tried classless red and got same results. Does anyone know whether 
RED+ECN work ? Any 
tests and setups that someone has used and got successful results ? I would 
really appreciate any input 
or suggestions on this.

Thanks,
Rahul.
-
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: kernel BUG in eth_alloc_tx_desc_index at drivers/net/mv643xx_eth.c:1069!

2007-01-09 Thread Thibaut VARENE

On 1/9/07, Jarek Poplawski [EMAIL PROTECTED] wrote:

On Tue, Jan 09, 2007 at 11:27:59AM +0100, Thibaut VARENE wrote:
...
 I suspected both and changed both the disk and the ram for quality
 parts, that I tested afterwards. Both passed thorough tests.

 Finally, using the other NIC on the box (a VIA Rhine II, 100Mbps),
 works absolutely fine.

If you are not tired, I'd suggest two more tests:


I volunteered to help :)

For the sake of testing up-to-date code, I performed the following
tests with 2.6.20-rc4.

First test was the usual nfs video playback. Crashdump is
panic-2.6.20-rc4-nfs.txt. Went down in about 20mn.


- as above but with NIC set to 100Mbps also,


Couldn't crash the machine (or at least it didn't happen in the time
frame I was willing to wait for doing ftp downloads, ~20mn). One note
though:

The throughput of the card was terribly sucky when set in 100-FD: I
couldn't get more than 5,5MB/s doing ftp get writing to /dev/null (to
rule out disk perf), ie, half the max link speed, though the /only/
thing I changed in the setup was the link speed (same switch - made
sure it properly detected link speed/duplex, same file server, same
everything else).

When configured in 1000-FD, still writing to /dev/null I could get
about 60MB/s. Again half link speed, but there, I suppose that the
remote fileserver couldn't pull data faster from the disks :)


- long downloading but without nfs e.g. ftp


That was fast and easy. In 1000-FD, I took down the box in 2s (after
downloading 90MB). Crashdump is panic-2.6.20-rc4-ftp.txt


(btw. there were some patches after 2.6.19
for rpc memory races).


It seems that's something else. I think I also reproduced the bug
while surfing the internet with firefox, but I didn't have serial line
hooked to capture a dump, unfortunately.


PS: Maintainers were cc-ed, I hope?


Now they are :)

HTH

T-Bone

--
Thibaut VARENE
http://www.parisc-linux.org/~varenet/
Debian GNU/Linux 4.0 Alucard ttyS0  

Alucard login: [ cut here ] 
kernel BUG at drivers/net/mv643xx_eth.c:1071!   
Oops: Exception in kernel mode, sig: 5 [#1] 
PREEMPT 
Modules linked in: eeprom sbp2 scsi_mod eth1394 uhci_hcd ohci1394 parport_pc pae
NIP: C0210B40 LR: C02126DC CTR: C0212620
REGS: da247ac0 TRAP: 0700   Not tainted  (2.6.20-rc4)   
MSR: 00021032 ME,IR,DR  CR: 28222488  XER:    
TASK = db82a050[1780] 'ncftp' THREAD: da246000  
GPR00:  DA247B70 DB82A050 CFB14260 CFB14000 000B DED5FD72   
GPR08: 0819 0001 1000 081A 48222422 10056CD0 28004422 C03D9BF8  
GPR16:    DA246000 0001 CFB142BC 9032   
GPR24:   C03E CFB14000 C0212620 DEDFD160 CFB14260 DED5FD40  
NIP [C0210B40] eth_alloc_tx_desc_index+0x44/0x50
LR [C02126DC] mv643xx_eth_start_xmit+0xbc/0x3b8 
Call Trace: 
[DA247B70] [DED5FD70] 0xded5fd70 (unreliable)   
[DA247BB0] [C029F258] dev_hard_start_xmit+0x1d4/0x2c8   
[DA247BD0] [C02A1BF4] dev_queue_xmit+0x2bc/0x334
[DA247BF0] [C02BC8A8] ip_output+0x120/0x244 
[DA247C10] [C02BD8DC] ip_queue_xmit+0x17c/0x408 
[DA247C80] [C02CEB1C] tcp_transmit_skb+0x358/0x7bc  
[DA247CC0] [C02CBF80] __tcp_ack_snd_check+0x64/0xbc 
[DA247CD0] [C02CDA94] tcp_rcv_established+0x5d4/0x980   
[DA247D00] [C02D4764] tcp_v4_do_rcv+0xe0/0x3c0  
[DA247D30] [C0294B58] release_sock+0x7c/0xf4
[DA247D50] [C02C5C1C] tcp_recvmsg+0x4c8/0xbcc   
[DA247DB0] [C0294490] sock_common_recvmsg+0x3c/0x60 
[DA247DD0] [C02920E4] sock_aio_read+0x10c/0x114 
[DA247E30] [C006F210] do_sync_read+0xc4/0x138   
[DA247EF0] [C006FECC] vfs_read+0x19c/0x1a4  
[DA247F10] [C00702E4] sys_read+0x4c/0x90
[DA247F40] [C00122EC] ret_from_syscall+0x0/0x38 
--- Exception: c01 at 0xff5ba98 
LR = 0x10032fc0 
Instruction dump: 

[PATCH] INET: style updates for the inet_sock-is_icsk assignment fix

2007-01-09 Thread Paul Moore
A quick patch to change the inet_sock-is_icsk assignment to better fit with
existing kernel coding style.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
Cc: Jarek Poplawski [EMAIL PROTECTED]
Cc: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/ipv4/af_inet.c  |2 +-
 net/ipv6/af_inet6.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: net-2.6.20_bugfix_2/net/ipv4/af_inet.c
===
--- net-2.6.20_bugfix_2.orig/net/ipv4/af_inet.c
+++ net-2.6.20_bugfix_2/net/ipv4/af_inet.c
@@ -305,7 +305,7 @@ lookup_protocol:
sk-sk_reuse = 1;
 
inet = inet_sk(sk);
-   inet-is_icsk = (INET_PROTOSW_ICSK  answer_flags) == INET_PROTOSW_ICSK;
+   inet-is_icsk = (INET_PROTOSW_ICSK  answer_flags) != 0;
 
if (SOCK_RAW == sock-type) {
inet-num = protocol;
Index: net-2.6.20_bugfix_2/net/ipv6/af_inet6.c
===
--- net-2.6.20_bugfix_2.orig/net/ipv6/af_inet6.c
+++ net-2.6.20_bugfix_2/net/ipv6/af_inet6.c
@@ -171,7 +171,7 @@ lookup_protocol:
sk-sk_reuse = 1;
 
inet = inet_sk(sk);
-   inet-is_icsk = (INET_PROTOSW_ICSK  answer_flags) == INET_PROTOSW_ICSK;
+   inet-is_icsk = (INET_PROTOSW_ICSK  answer_flags) != 0;
 
if (SOCK_RAW == sock-type) {
inet-num = protocol;

--
paul moore
linux security @ hp

-
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 3/3] chelsio: more rx speedup

2007-01-09 Thread Stephen Hemminger
On Tue, 9 Jan 2007 09:42:03 +0100
Ingo Oeser [EMAIL PROTECTED] wrote:

 Hi Stephen,
 
 Stephen Hemminger schrieb:
  --- netdev-2.6.orig/drivers/net/chelsio/sge.c
  +++ netdev-2.6/drivers/net/chelsio/sge.c
 [...]
  @@ -1043,45 +1046,42 @@ static void recycle_fl_buf(struct freelQ
* be copied but there is no memory for the copy.
*/
   static inline struct sk_buff *get_packet(struct pci_dev *pdev,
  -struct freelQ *fl, unsigned int len,
  -int dma_pad, int skb_pad,
  -unsigned int copy_thres,
  -unsigned int drop_thres)
  +struct freelQ *fl, unsigned int len)
   {
  struct sk_buff *skb;
  -   struct freelQ_ce *ce = fl-centries[fl-cidx];
  +   const struct freelQ_ce *ce = fl-centries[fl-cidx];
   
  -   if (len  copy_thres) {
  -   skb = alloc_skb(len + skb_pad, GFP_ATOMIC);
  -   if (likely(skb != NULL)) {
  -   skb_reserve(skb, skb_pad);
  -   skb_put(skb, len);
  -   pci_dma_sync_single_for_cpu(pdev,
  -   pci_unmap_addr(ce, dma_addr),
  -   pci_unmap_len(ce, dma_len),
  -   PCI_DMA_FROMDEVICE);
  -   memcpy(skb-data, ce-skb-data + dma_pad, len);
  -   pci_dma_sync_single_for_device(pdev,
  +   if (len  copybreak) {
  +   skb = alloc_skb(len + 2, GFP_ATOMIC);
  +   if (!skb)
  +   goto use_orig_buf;
  +
  +   skb_reserve(skb, 2);/* align IP header */
 
 Please use NET_IP_ALIGN here:

Wrong, NET_IP_ALIGN is intended to deal with platforms where alignment of DMA 
is more
important of alignment of structures.  Therefore if data is copied, it should
always be 2.

 
 + skb = alloc_skb(len + NET_IP_ALIGN, GFP_ATOMIC);
 + if (!skb)
 + goto use_orig_buf;
 +
 + skb_reserve(skb, NET_IP_ALIGN);
 
  +   skb_put(skb, len);
  +   pci_dma_sync_single_for_cpu(pdev,
  pci_unmap_addr(ce, dma_addr),
  pci_unmap_len(ce, dma_len),
  PCI_DMA_FROMDEVICE);
  -   } else if (!drop_thres)
  -   goto use_orig_buf;
  -
  +   memcpy(skb-data, ce-skb-data, len);
  +   pci_dma_sync_single_for_device(pdev,
  +  pci_unmap_addr(ce, dma_addr),
  +  pci_unmap_len(ce, dma_len),
  +  PCI_DMA_FROMDEVICE);
  recycle_fl_buf(fl, fl-cidx);
  return skb;
  }
   
  -   if (fl-credits  drop_thres) {
  +use_orig_buf:
  +   if (fl-credits  2) {
 
 Why 2? What does this magic number mean?

No idea, it was there in the original. (as a parameter).

-- 
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


[PATCH] Fix phy_read/write redefinition errors in ucc_geth_phy.c

2007-01-09 Thread timur
From: Timur Tabi [EMAIL PROTECTED]

The local versions of phy_read() and phy_write() in ucc_geth_phy.c conflict
with the prototypes in include/linux/phy.h, so this patch renames them, 
moves them to the top of the file (while eliminating the redundant prototype),
and makes them static.

Signed-off-by: Timur Tabi [EMAIL PROTECTED]
Signed-off-by: Kumar Gala [EMAIL PROTECTED]

---
 drivers/net/ucc_geth_phy.c |  134 ++--
 1 files changed, 66 insertions(+), 68 deletions(-)

diff --git a/drivers/net/ucc_geth_phy.c b/drivers/net/ucc_geth_phy.c
index 5360ec0..3c86592 100644
--- a/drivers/net/ucc_geth_phy.c
+++ b/drivers/net/ucc_geth_phy.c
@@ -68,8 +68,31 @@ static int gbit_config_aneg(struct ugeth
 static int genmii_config_aneg(struct ugeth_mii_info *mii_info);
 static int genmii_update_link(struct ugeth_mii_info *mii_info);
 static int genmii_read_status(struct ugeth_mii_info *mii_info);
-u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum);
-void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val);
+
+static u16 ucc_geth_phy_read(struct ugeth_mii_info *mii_info, u16 regnum)
+{
+   u16 retval;
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+   retval = mii_info-mdio_read(mii_info-dev, mii_info-mii_id, regnum);
+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+
+   return retval;
+}
+
+static void ucc_geth_phy_write(struct ugeth_mii_info *mii_info, u16 regnum, 
u16 val)
+{
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+   mii_info-mdio_write(mii_info-dev, mii_info-mii_id, regnum, val);
+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+}
 
 /* Write value to the PHY for this device to the register at regnum, */
 /* waiting until the write is done before it returns.  All PHY */
@@ -184,7 +207,7 @@ static void config_genmii_advert(struct
advertise = mii_info-advertising;
 
/* Setup standard advertisement */
-   adv = phy_read(mii_info, MII_ADVERTISE);
+   adv = ucc_geth_phy_read(mii_info, MII_ADVERTISE);
adv = ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
if (advertise  ADVERTISED_10baseT_Half)
adv |= ADVERTISE_10HALF;
@@ -194,7 +217,7 @@ static void config_genmii_advert(struct
adv |= ADVERTISE_100HALF;
if (advertise  ADVERTISED_100baseT_Full)
adv |= ADVERTISE_100FULL;
-   phy_write(mii_info, MII_ADVERTISE, adv);
+   ucc_geth_phy_write(mii_info, MII_ADVERTISE, adv);
 }
 
 static void genmii_setup_forced(struct ugeth_mii_info *mii_info)
@@ -204,7 +227,7 @@ static void genmii_setup_forced(struct u
 
ugphy_vdbg(%s: IN, __FUNCTION__);
 
-   ctrl = phy_read(mii_info, MII_BMCR);
+   ctrl = ucc_geth_phy_read(mii_info, MII_BMCR);
 
ctrl =
~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_SPEED1000 | BMCR_ANENABLE);
@@ -234,7 +257,7 @@ static void genmii_setup_forced(struct u
break;
}
 
-   phy_write(mii_info, MII_BMCR, ctrl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctrl);
 }
 
 /* Enable and Restart Autonegotiation */
@@ -244,9 +267,9 @@ static void genmii_restart_aneg(struct u
 
ugphy_vdbg(%s: IN, __FUNCTION__);
 
-   ctl = phy_read(mii_info, MII_BMCR);
+   ctl = ucc_geth_phy_read(mii_info, MII_BMCR);
ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
-   phy_write(mii_info, MII_BMCR, ctl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctl);
 }
 
 static int gbit_config_aneg(struct ugeth_mii_info *mii_info)
@@ -261,14 +284,14 @@ static int gbit_config_aneg(struct ugeth
config_genmii_advert(mii_info);
advertise = mii_info-advertising;
 
-   adv = phy_read(mii_info, MII_1000BASETCONTROL);
+   adv = ucc_geth_phy_read(mii_info, MII_1000BASETCONTROL);
adv = ~(MII_1000BASETCONTROL_FULLDUPLEXCAP |
 MII_1000BASETCONTROL_HALFDUPLEXCAP);
if (advertise  SUPPORTED_1000baseT_Half)
adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP;
if (advertise  SUPPORTED_1000baseT_Full)
adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP;
-   phy_write(mii_info, MII_1000BASETCONTROL, adv);
+   ucc_geth_phy_write(mii_info, MII_1000BASETCONTROL, adv);
 
/* Start/Restart aneg */
genmii_restart_aneg(mii_info);
@@ -298,10 +321,10 @@ static int genmii_update_link(struct uge
ugphy_vdbg(%s: IN, __FUNCTION__);
 
/* Do a fake read */
-   phy_read(mii_info, MII_BMSR);
+   ucc_geth_phy_read(mii_info, MII_BMSR);
 
/* Read link and autonegotiation status */
-   status = phy_read(mii_info, MII_BMSR);
+   status = ucc_geth_phy_read(mii_info, MII_BMSR);
if ((status  BMSR_LSTATUS) == 0)

[PATCH] Update ucc_geth.c for new workqueue structure

2007-01-09 Thread timur
From: Timur Tabi [EMAIL PROTECTED]

The workqueue interface changed with David Howell's patch on 11/22/2006
(SHA 65f27f38446e1976cc98fd3004b110fedcddd189).  Several drivers were
updated with that patch to handle the new interface, but ucc_geth.c
was not one of them.  This patch updates ucc_geth.c to support the new
model.

A compiler warning in set_mac_addr() was also fixed.

Signed-off-by: Timur Tabi [EMAIL PROTECTED]
Signed-off-by: Kumar Gala [EMAIL PROTECTED]

---
 drivers/net/ucc_geth.c |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 1f05511..d33bb0c 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -29,6 +29,7 @@
 #include linux/fsl_devices.h
 #include linux/ethtool.h
 #include linux/mii.h
+#include linux/workqueue.h
 
 #include asm/of_platform.h
 #include asm/uaccess.h
@@ -472,7 +473,7 @@ static void put_enet_addr_container(stru
kfree(enet_addr_cont);
 }
 
-static int set_mac_addr(__be16 __iomem *reg, u8 *mac)
+static void set_mac_addr(__be16 __iomem *reg, u8 *mac)
 {
out_be16(reg[0], ((u16)mac[5]  8) | mac[4]);
out_be16(reg[1], ((u16)mac[3]  8) | mac[2]);
@@ -3918,10 +3919,11 @@ static irqreturn_t phy_interrupt(int irq
 }
 
 /* Scheduled by the phy_interrupt/timer to handle PHY changes */
-static void ugeth_phy_change(void *data)
+static void ugeth_phy_change(struct work_struct *work)
 {
-   struct net_device *dev = (struct net_device *)data;
-   struct ucc_geth_private *ugeth = netdev_priv(dev);
+   struct ucc_geth_private *ugeth =
+   container_of(work, struct ucc_geth_private, tq);
+   struct net_device *dev = ugeth-dev;
struct ucc_geth *ug_regs;
int result = 0;
 
@@ -4078,7 +4080,7 @@ static int ucc_geth_open(struct net_devi
 #endif /* CONFIG_UGETH_NAPI */
 
/* Set up the PHY change work queue */
-   INIT_WORK(ugeth-tq, ugeth_phy_change, dev);
+   INIT_WORK(ugeth-tq, ugeth_phy_change);
 
init_timer(ugeth-phy_info_timer);
ugeth-phy_info_timer.function = ugeth_phy_startup_timer;
-- 
1.4.4

-
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] INET: style updates for the inet_sock-is_icsk assignment fix

2007-01-09 Thread Arnaldo Carvalho de Melo

On 1/9/07, Paul Moore [EMAIL PROTECTED] wrote:

A quick patch to change the inet_sock-is_icsk assignment to better fit with
existing kernel coding style.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
Cc: Jarek Poplawski [EMAIL PROTECTED]
Cc: Arnaldo Carvalho de Melo [EMAIL PROTECTED]


Signed-off-by: Arnaldo Carvalho de Melo [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: Using 802.11x wireless usb device on MIPS platform

2007-01-09 Thread Michael Wu
On Tuesday 09 January 2007 09:09, Ralf Baechle wrote:
 On Tue, Jan 09, 2007 at 10:52:14AM +0800, colin wrote:
  I have used two 802.11x wireless usb devices successfully on MIPS
  platform. One is realtek 8187 and the other one is ralink 2571.
  I would like to put them into kernel tree and then I found that there are
  not many 802.11x devices supported in Linux.

Please see the wireless-dev tree. There is a driver for the ralink 2571 in 
there which will be merged along with a number of other wireless drivers when 
the devicescape 802.11 (d80211) wireless stack is sufficiently polished. New 
softmac wireless drivers should be based on that stack if possible. I am 
working on a d80211 version of the rtl8187/rtl8185 driver right now, which is 
I think is the last linux 802.11g driver which needs to be ported.

-Michael Wu


pgpLv2C3LmE6G.pgp
Description: PGP signature


[PATCH] [SCTP]: Fix err_hdr assignment in sctp_init_cause.

2007-01-09 Thread Sridhar Samudrala
[SCTP]: Fix err_hdr assignment in sctp_init_cause.

The subh-err_hdr should point to the error header, not the data.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
Signed-off-by: Sridhar Samudrala [EMAIL PROTECTED]

---
 net/sctp/sm_make_chunk.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index f0bbe36..167d888 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -124,8 +124,8 @@ void  sctp_init_cause(struct sctp_chunk *chunk, __be16 
cause_code,
padlen = len % 4;
err.length  = htons(len);
len += padlen;
-   sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), err);
-   chunk-subh.err_hdr = sctp_addto_chunk(chunk, paylen, payload);
+   chunk-subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), 
err);
+   sctp_addto_chunk(chunk, paylen, payload);
 }

 /* 3.3.2 Initiation (INIT) (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


fixing opt-ack DoS against TCP stack

2007-01-09 Thread Gavin McCullagh
Hi,

recently, a few of us came up with a novel (or so we thought) DoS attack
against TCP.  We spent some time implementing and testing it and found it
to work worryingly well.

It turns out that we are not the first to come across this attack.  Rob
Sherwood and colleagues in Maryland were a year or two ahead of us.  They
have published a paper entitled Misbehaving TCP Receivers Can Cause
Internet-Wide Congestion Collapse.

http://www.cs.umd.edu/~capveg/optack/optack-ccs05.pdf
http://www.cs.umd.edu/~capveg/
http://www.kb.cert.org/vuls/id/102014

Linux appears not to have implemented any fix for this vulnerability,
although Rob Sherwood wrote a patch against 2.4.24.

http://www.cs.umd.edu/~capveg/optack/optack.patch

There seems to be a brief mention of it on the fedora-security list but I
can't find much discussion of it in linux circles otherwise.

http://www.spinics.net/linux/fedora/fedora-security/msg00426.html
http://www.securityfocus.com/bid/15468/

Is there some reason that this fix was not accepted or has this just
slipped under people's radars?  Should some fix not be implemented?  The
issue seems even more severe with the larger buffer sizes now in use.

Gavin

-
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: kernel BUG in eth_alloc_tx_desc_index at drivers/net/mv643xx_eth.c:1069!

2007-01-09 Thread Dale Farnsworth
On Tue, Jan 09, 2007 at 06:44:49PM +0100, Thibaut VARENE wrote:
 On 1/9/07, Jarek Poplawski [EMAIL PROTECTED] wrote:
 On Tue, Jan 09, 2007 at 11:27:59AM +0100, Thibaut VARENE wrote:
 ...
  I suspected both and changed both the disk and the ram for quality
  parts, that I tested afterwards. Both passed thorough tests.
 
  Finally, using the other NIC on the box (a VIA Rhine II, 100Mbps),
  works absolutely fine.
 
 If you are not tired, I'd suggest two more tests:
 
 I volunteered to help :)

Thank you Thibaut.  Please try the following patch:

From: Dale Farnsworth [EMAIL PROTECTED]

Reserve one unused descriptor in the TX ring
to facilitate testing for when the ring is full.

---

Signed-off-by: Dale Farnsworth [EMAIL PROTECTED]

 drivers/net/mv643xx_eth.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 9997081..72f82ba 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -289,7 +289,7 @@ static void mv643xx_eth_tx_timeout_task(
eth_port_reset(mp-port_num);
eth_port_start(dev);
 
-   if (mp-tx_ring_size - mp-tx_desc_count = MAX_DESCS_PER_SKB)
+   if (mp-tx_ring_size - mp-tx_desc_count  MAX_DESCS_PER_SKB)
netif_wake_queue(dev);
 }
 
@@ -356,7 +356,7 @@ static void mv643xx_eth_free_completed_t
struct mv643xx_private *mp = netdev_priv(dev);
 
if (mv643xx_eth_free_tx_descs(dev, 0) 
-   mp-tx_ring_size - mp-tx_desc_count = MAX_DESCS_PER_SKB)
+   mp-tx_ring_size - mp-tx_desc_count  MAX_DESCS_PER_SKB)
netif_wake_queue(dev);
 }
 
@@ -536,7 +536,7 @@ static irqreturn_t mv643xx_eth_int_handl
   ETH_TX_QUEUES_ENABLED);
if (!netif_carrier_ok(dev)) {
netif_carrier_on(dev);
-   if (mp-tx_ring_size - mp-tx_desc_count =
+   if (mp-tx_ring_size - mp-tx_desc_count 
MAX_DESCS_PER_SKB)
netif_wake_queue(dev);
}
@@ -1194,7 +1194,7 @@ static int mv643xx_eth_start_xmit(struct
BUG_ON(netif_queue_stopped(dev));
BUG_ON(skb == NULL);
 
-   if (mp-tx_ring_size - mp-tx_desc_count  MAX_DESCS_PER_SKB) {
+   if (mp-tx_ring_size - mp-tx_desc_count = MAX_DESCS_PER_SKB) {
printk(KERN_ERR %s: transmit with queue full\n, dev-name);
netif_stop_queue(dev);
return 1;
@@ -1216,7 +1216,7 @@ static int mv643xx_eth_start_xmit(struct
stats-tx_packets++;
dev-trans_start = jiffies;
 
-   if (mp-tx_ring_size - mp-tx_desc_count  MAX_DESCS_PER_SKB)
+   if (mp-tx_ring_size - mp-tx_desc_count = MAX_DESCS_PER_SKB)
netif_stop_queue(dev);
 
spin_unlock_irqrestore(mp-lock, flags);
-
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/3] myri10ge minor updates for 2.6.20

2007-01-09 Thread Brice Goglin
Hi Jeff,

These should be the last 3 patches to finalize myri10ge version 1.2.0:
1. myri10ge: make wc_fifo usage load-time tunable
2. myri10ge: check that we can get an irq
3. myri10ge: update driver version to 1.2.0

Please apply to 2.6.20.
thanks,
Brice

-
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/3] myri10ge: update driver version to 1.2.0

2007-01-09 Thread Brice Goglin
Driver is now at version 1.2.0.

Signed-off-by: Brice Goglin [EMAIL PROTECTED]
---
 drivers/net/myri10ge/myri10ge.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-rc/drivers/net/myri10ge/myri10ge.c
===
--- linux-rc.orig/drivers/net/myri10ge/myri10ge.c   2007-01-09 
19:30:27.0 +0100
+++ linux-rc/drivers/net/myri10ge/myri10ge.c2007-01-09 19:30:30.0 
+0100
@@ -71,7 +71,7 @@
 #include myri10ge_mcp.h
 #include myri10ge_mcp_gen_header.h
 
-#define MYRI10GE_VERSION_STR 1.1.0
+#define MYRI10GE_VERSION_STR 1.2.0
 
 MODULE_DESCRIPTION(Myricom 10G driver (10GbE));
 MODULE_AUTHOR(Maintainer: [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


[PATCH 1/3] myri10ge: make wc_fifo usage load-time tunable

2007-01-09 Thread Brice Goglin
Under some circumstances, using WC without the WC fifo is faster.
So we make it possible to tune wc_fifo with a module parameter.

Signed-off-by: Brice Goglin [EMAIL PROTECTED]
---
 drivers/net/myri10ge/myri10ge.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: linux-rc/drivers/net/myri10ge/myri10ge.c
===
--- linux-rc.orig/drivers/net/myri10ge/myri10ge.c   2007-01-07 
16:57:45.0 +0100
+++ linux-rc/drivers/net/myri10ge/myri10ge.c2007-01-09 19:30:43.0 
+0100
@@ -274,6 +274,10 @@
 module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(myri10ge_fill_thresh, Number of empty rx slots allowed\n);
 
+static int myri10ge_wcfifo = 1;
+module_param(myri10ge_wcfifo, int, S_IRUGO);
+MODULE_PARM_DESC(myri10ge_wcfifo, Enable WC Fifo when WC is enabled\n);
+
 #define MYRI10GE_FW_OFFSET 1024*1024
 #define MYRI10GE_HIGHPART_TO_U32(X) \
 (sizeof (X) == 8) ? ((u32)((u64)(X)  32)) : (0)
@@ -1714,7 +1718,7 @@
goto abort_with_irq;
}
 
-   if (mgp-mtrr = 0) {
+   if (myri10ge_wcfifo  mgp-mtrr = 0) {
mgp-tx.wc_fifo = (u8 __iomem *) mgp-sram + MXGEFW_ETH_SEND_4;
mgp-rx_small.wc_fifo =
(u8 __iomem *) mgp-sram + MXGEFW_ETH_RECV_SMALL;


-
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/3] myri10ge: check that we can get an irq

2007-01-09 Thread Brice Goglin
Now that IRQ allocation is done in myri10ge_open(), we want to still
check when loading the driver that IRQ allocation could succeed later.

Additionaly, we fix the initialization and printing of netdev-irq.

Signed-off-by: Brice Goglin [EMAIL PROTECTED]
---
 drivers/net/myri10ge/myri10ge.c |   15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

Index: linux-rc/drivers/net/myri10ge/myri10ge.c
===
--- linux-rc.orig/drivers/net/myri10ge/myri10ge.c   2007-01-09 
19:30:00.0 +0100
+++ linux-rc/drivers/net/myri10ge/myri10ge.c2007-01-09 19:30:41.0 
+0100
@@ -2882,7 +2882,6 @@
netdev-hard_start_xmit = myri10ge_xmit;
netdev-get_stats = myri10ge_get_stats;
netdev-base_addr = mgp-iomem_base;
-   netdev-irq = pdev-irq;
netdev-change_mtu = myri10ge_change_mtu;
netdev-set_multicast_list = myri10ge_set_multicast_list;
netdev-set_mac_address = myri10ge_set_mac_address;
@@ -2892,6 +2891,15 @@
netdev-poll = myri10ge_poll;
netdev-weight = myri10ge_napi_weight;
 
+   /* make sure we can get an irq, and that MSI can be
+* setup (if available).  Also ensure netdev-irq
+* is set to correct value if MSI is enabled */
+   status = myri10ge_request_irq(mgp);
+   if (status != 0)
+   goto abort_with_firmware;
+   netdev-irq = pdev-irq;
+   myri10ge_free_irq(mgp);
+
/* Save configuration space to be restored if the
 * nic resets due to a parity error */
pci_save_state(pdev);
@@ -2907,8 +2915,9 @@
dev_err(pdev-dev, register_netdev failed: %d\n, status);
goto abort_with_state;
}
-   dev_info(dev, %d, tx bndry %d, fw %s, WC %s\n,
-pdev-irq, mgp-tx.boundary, mgp-fw_name,
+   dev_info(dev, %s IRQ %d, tx bndry %d, fw %s, WC %s\n,
+(mgp-msi_enabled ? MSI : xPIC),
+netdev-irq, mgp-tx.boundary, mgp-fw_name,
 (mgp-mtrr = 0 ? Enabled : Disabled));
 
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: kernel BUG in eth_alloc_tx_desc_index at drivers/net/mv643xx_eth.c:1069!

2007-01-09 Thread Thibaut VARENE

On 1/9/07, Dale Farnsworth [EMAIL PROTECTED] wrote:

On Tue, Jan 09, 2007 at 06:44:49PM +0100, Thibaut VARENE wrote:
 On 1/9/07, Jarek Poplawski [EMAIL PROTECTED] wrote:
 On Tue, Jan 09, 2007 at 11:27:59AM +0100, Thibaut VARENE wrote:
 ...
  I suspected both and changed both the disk and the ram for quality
  parts, that I tested afterwards. Both passed thorough tests.
 
  Finally, using the other NIC on the box (a VIA Rhine II, 100Mbps),
  works absolutely fine.
 
 If you are not tired, I'd suggest two more tests:

 I volunteered to help :)

Thank you Thibaut.  Please try the following patch:

From: Dale Farnsworth [EMAIL PROTECTED]

Reserve one unused descriptor in the TX ring
to facilitate testing for when the ring is full.


Dale,

tried it and unfortunately:

Alucard login: [ cut here ]
kernel BUG at drivers/net/mv643xx_eth.c:1071!
Oops: Exception in kernel mode, sig: 5 [#1]
PREEMPT
Modules linked in: eeprom sbp2 scsi_mod eth1394 uhci_hcd vt8231 ohci1394 ieee13t
NIP: C0210B40 LR: C02126DC CTR: C0212620
REGS: dd2d7b40 TRAP: 0700   Not tainted  (2.6.20-rc4)
MSR: 00021032 ME,IR,DR  CR: 28242488  XER: 
TASK = da03c640[1775] 'ncftp' THREAD: dd2d6000
GPR00:  DD2D7BF0 DA03C640 CFB16260 CFB16000 000B DF79FDD2 
GPR08: 0BA9 0001 1000 0BAA 28242482 10056CD0 28004422 C03D9BF8
GPR16:    DD2D6000 0001 CFB162BC 9032 
GPR24: 05A8  C03E CFB16000 C0212620 CFCB3260 CFB16260 DF79FDA0
NIP [C0210B40] eth_alloc_tx_desc_index+0x44/0x50
LR [C02126DC] mv643xx_eth_start_xmit+0xbc/0x3b8
Call Trace:
[DD2D7BF0] [DF79FDD0] 0xdf79fdd0 (unreliable)
[DD2D7C30] [C029F258] dev_hard_start_xmit+0x1d4/0x2c8
[DD2D7C50] [C02A1BF4] dev_queue_xmit+0x2bc/0x334
[DD2D7C70] [C02BC8A8] ip_output+0x120/0x244
[DD2D7C90] [C02BD8DC] ip_queue_xmit+0x17c/0x408
[DD2D7D00] [C02CEB1C] tcp_transmit_skb+0x358/0x7bc
[DD2D7D40] [C02C2FC0] tcp_cleanup_rbuf+0xb8/0x158
[DD2D7D50] [C02C5C14] tcp_recvmsg+0x4c0/0xbcc
[DD2D7DB0] [C0294490] sock_common_recvmsg+0x3c/0x60
[DD2D7DD0] [C02920E4] sock_aio_read+0x10c/0x114
[DD2D7E30] [C006F210] do_sync_read+0xc4/0x138
[DD2D7EF0] [C006FECC] vfs_read+0x19c/0x1a4
[DD2D7F10] [C00702E4] sys_read+0x4c/0x90
[DD2D7F40] [C00122EC] ret_from_syscall+0x0/0x38
--- Exception: c01 at 0xff5ba98
   LR = 0x10032fc0
Instruction dump:
5400fffe 0f00 81030020 81230024 39680001 7c0b53d6 7c0051d6 7d605850
7d694a78 91630020 7d290034 5529d97e 0f09 7d034378 4e800020 2f840001
0Kernel panic - not syncing: Fatal exception in interrupt
0Rebooting in 180 seconds..4atkbd.c: Spurious ACK on isa0060/serio0. Some .
atkbd.c: Spurious ACK on isa0060/serio0. Some program might be trying access ha.
atkbd.c: Spurious ACK on isa0060/serio0. Some program might be trying access ha.
-
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/12] forcedeth: optimized routines

2007-01-09 Thread Ayaz Abdulla
This patch breaks up the routines into two versions, one for legacy 
descriptor versions (ver 1 and ver 2) and one for desc ver 3. This will 
make the new desc functions more leaner and further reductions will be 
made in next few patches.


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-08 10:47:16.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-08 10:46:59.0 -0500
@@ -1307,50 +1307,57 @@
 static int nv_alloc_rx(struct net_device *dev)
 {
struct fe_priv *np = netdev_priv(dev);
-   union ring_type less_rx;
+   struct ring_desc* less_rx;
 
-   if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
-   less_rx.orig = np-get_rx.orig;
-   if (less_rx.orig-- == np-first_rx.orig)
-   less_rx.orig = np-last_rx.orig;
-   } else {
-   less_rx.ex = np-get_rx.ex;
-   if (less_rx.ex-- == np-first_rx.ex)
-   less_rx.ex = np-last_rx.ex;
-   }
+   less_rx = np-get_rx.orig;
+   if (less_rx-- == np-first_rx.orig)
+   less_rx = np-last_rx.orig;
 
-   while (1) {
-   struct sk_buff *skb;
-
-   if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
-   if (np-put_rx.orig == less_rx.orig)
-   break;
+   while (np-put_rx.orig != less_rx) {
+   struct sk_buff *skb = dev_alloc_skb(np-rx_buf_sz + 
NV_RX_ALLOC_PAD);
+   if (skb) {
+   skb-dev = dev;
+   np-put_rx_ctx-skb = skb;
+   np-put_rx_ctx-dma = pci_map_single(np-pci_dev, 
skb-data,
+
skb-end-skb-data, PCI_DMA_FROMDEVICE);
+   np-put_rx_ctx-dma_len = skb-end-skb-data;
+   np-put_rx.orig-buf = cpu_to_le32(np-put_rx_ctx-dma);
+   wmb();
+   np-put_rx.orig-flaglen = cpu_to_le32(np-rx_buf_sz | 
NV_RX_AVAIL);
+   if (np-put_rx.orig++ == np-last_rx.orig)
+   np-put_rx.orig = np-first_rx.orig;
+   if (np-put_rx_ctx++ == np-last_rx_ctx)
+   np-put_rx_ctx = np-first_rx_ctx;
} else {
-   if (np-put_rx.ex == less_rx.ex)
-   break;
+   return 1;
}
+   }
+   return 0;
+}
+
+static int nv_alloc_rx_optimized(struct net_device *dev)
+{
+   struct fe_priv *np = netdev_priv(dev);
+   struct ring_desc_ex* less_rx;
+
+   less_rx = np-get_rx.ex;
+   if (less_rx-- == np-first_rx.ex)
+   less_rx = np-last_rx.ex;
 
-   skb = dev_alloc_skb(np-rx_buf_sz + NV_RX_ALLOC_PAD);
+   while (np-put_rx.ex != less_rx) {
+   struct sk_buff *skb = dev_alloc_skb(np-rx_buf_sz + 
NV_RX_ALLOC_PAD);
if (skb) {
skb-dev = dev;
np-put_rx_ctx-skb = skb;
np-put_rx_ctx-dma = pci_map_single(np-pci_dev, 
skb-data,
 
skb-end-skb-data, PCI_DMA_FROMDEVICE);
np-put_rx_ctx-dma_len = skb-end-skb-data;
-   if (np-desc_ver == DESC_VER_1 || np-desc_ver == 
DESC_VER_2) {
-   np-put_rx.orig-buf = 
cpu_to_le32(np-put_rx_ctx-dma);
-   wmb();
-   np-put_rx.orig-flaglen = 
cpu_to_le32(np-rx_buf_sz | NV_RX_AVAIL);
-   if (np-put_rx.orig++ == np-last_rx.orig)
-   np-put_rx.orig = np-first_rx.orig;
-   } else {
-   np-put_rx.ex-bufhigh = 
cpu_to_le64(np-put_rx_ctx-dma)  32;
-   np-put_rx.ex-buflow = 
cpu_to_le64(np-put_rx_ctx-dma)  0x0;
-   wmb();
-   np-put_rx.ex-flaglen = 
cpu_to_le32(np-rx_buf_sz | NV_RX2_AVAIL);
-   if (np-put_rx.ex++ == np-last_rx.ex)
-   np-put_rx.ex = np-first_rx.ex;
-   }
+   np-put_rx.ex-bufhigh = 
cpu_to_le64(np-put_rx_ctx-dma)  32;
+   np-put_rx.ex-buflow = 
cpu_to_le64(np-put_rx_ctx-dma)  0x0;
+   wmb();
+   np-put_rx.ex-flaglen = cpu_to_le32(np-rx_buf_sz | 
NV_RX2_AVAIL);
+   if (np-put_rx.ex++ == np-last_rx.ex)
+   np-put_rx.ex = np-first_rx.ex;
if (np-put_rx_ctx++ == np-last_rx_ctx)
np-put_rx_ctx = np-first_rx_ctx;
} else {
@@ -1374,6 +1381,7 @@
 {
struct net_device *dev = (struct 

[PATCH 0/12] forcedeth optimizations

2007-01-09 Thread Ayaz Abdulla
This set of patches contains optimizations for the forcedeth driver that 
help reduce CPU utilization and increase throughput, especially for 
small packet sizes.


The main changes include ring accessing, tx locking, optimizing code 
branches, remove descriptor checks in data paths, reducing memory 
accesses, etc.


Please provide feedback and comments.
[Note that some patches might not have apparent benefits by themselves. 
Some patches are just stepping stones for following patches]


Thanks,
Ayaz

-
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/12] forcedeth: tx data path optimization

2007-01-09 Thread Ayaz Abdulla
This patch optimizes the tx data paths and cleans up the code (removes 
vlan from descr1/2 since only valid for desc3, changes to make code 
easier to read, etc).


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-08 14:05:28.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-08 14:05:19.0 -0500
@@ -1563,7 +1563,6 @@
u32 size = skb-len-skb-data_len;
u32 entries = (size  NV_TX2_TSO_MAX_SHIFT) + ((size  
(NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
u32 empty_slots;
-   u32 tx_flags_vlan = 0;
struct ring_desc* put_tx;
struct ring_desc* start_tx;
struct ring_desc* prev_tx;
@@ -1576,7 +1575,7 @@
}
 
empty_slots = nv_get_empty_tx_slots(np);
-   if (empty_slots = entries) {
+   if (unlikely(empty_slots = entries)) {
spin_lock_irq(np-lock);
netif_stop_queue(dev);
np-tx_stop = 1;
@@ -1596,12 +1595,13 @@
np-put_tx_ctx-dma_len = bcnt;
put_tx-buf = cpu_to_le32(np-put_tx_ctx-dma);
put_tx-flaglen = cpu_to_le32((bcnt-1) | tx_flags);
+
tx_flags = np-tx_flags;
offset += bcnt;
size -= bcnt;
-   if (put_tx++ == np-last_tx.orig)
+   if (unlikely(put_tx++ == np-last_tx.orig))
put_tx = np-first_tx.orig;
-   if (np-put_tx_ctx++ == np-last_tx_ctx)
+   if (unlikely(np-put_tx_ctx++ == np-last_tx_ctx))
np-put_tx_ctx = np-first_tx_ctx;
} while (size);
 
@@ -1618,14 +1618,14 @@
np-put_tx_ctx-dma = pci_map_page(np-pci_dev, 
frag-page, frag-page_offset+offset, bcnt,
   PCI_DMA_TODEVICE);
np-put_tx_ctx-dma_len = bcnt;
-
put_tx-buf = cpu_to_le32(np-put_tx_ctx-dma);
put_tx-flaglen = cpu_to_le32((bcnt-1) | tx_flags);
+
offset += bcnt;
size -= bcnt;
-   if (put_tx++ == np-last_tx.orig)
+   if (unlikely(put_tx++ == np-last_tx.orig))
put_tx = np-first_tx.orig;
-   if (np-put_tx_ctx++ == np-last_tx_ctx)
+   if (unlikely(np-put_tx_ctx++ == np-last_tx_ctx))
np-put_tx_ctx = np-first_tx_ctx;
} while (size);
}
@@ -1642,11 +1642,6 @@
tx_flags_extra = skb-ip_summed == CHECKSUM_PARTIAL ?
 NV_TX2_CHECKSUM_L3 | NV_TX2_CHECKSUM_L4 : 0;
 
-   /* vlan tag */
-   if (np-vlangrp  vlan_tx_tag_present(skb)) {
-   tx_flags_vlan = NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb);
-   }
-
spin_lock_irq(np-lock);
 
/* set tx flags */
@@ -1669,7 +1664,6 @@
 
dev-trans_start = jiffies;
writel(NVREG_TXRXCTL_KICK|np-txrxctl_bits, get_hwbase(dev) + 
NvRegTxRxControl);
-   pci_push(get_hwbase(dev));
return NETDEV_TX_OK;
 }
 
@@ -1677,7 +1671,7 @@
 {
struct fe_priv *np = netdev_priv(dev);
u32 tx_flags = 0;
-   u32 tx_flags_extra = NV_TX2_LASTPACKET;
+   u32 tx_flags_extra;
unsigned int fragments = skb_shinfo(skb)-nr_frags;
unsigned int i;
u32 offset = 0;
@@ -1685,7 +1679,6 @@
u32 size = skb-len-skb-data_len;
u32 entries = (size  NV_TX2_TSO_MAX_SHIFT) + ((size  
(NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
u32 empty_slots;
-   u32 tx_flags_vlan = 0;
struct ring_desc_ex* put_tx;
struct ring_desc_ex* start_tx;
struct ring_desc_ex* prev_tx;
@@ -1698,7 +1691,7 @@
}
 
empty_slots = nv_get_empty_tx_slots(np);
-   if (empty_slots = entries) {
+   if (unlikely(empty_slots = entries)) {
spin_lock_irq(np-lock);
netif_stop_queue(dev);
np-tx_stop = 1;
@@ -1719,12 +1712,13 @@
put_tx-bufhigh = cpu_to_le64(np-put_tx_ctx-dma)  32;
put_tx-buflow = cpu_to_le64(np-put_tx_ctx-dma)  0x0;
put_tx-flaglen = cpu_to_le32((bcnt-1) | tx_flags);
-   tx_flags = np-tx_flags;
+
+   tx_flags = NV_TX2_VALID;
offset += bcnt;
size -= bcnt;
-   if (put_tx++ == np-last_tx.ex)
+   if (unlikely(put_tx++ == np-last_tx.ex))
put_tx = np-first_tx.ex;
-   if (np-put_tx_ctx++ == np-last_tx_ctx)
+   if (unlikely(np-put_tx_ctx++ == np-last_tx_ctx))
np-put_tx_ctx = np-first_tx_ctx;
} while (size);
 
@@ -1741,21 +1735,21 @@
np-put_tx_ctx-dma = pci_map_page(np-pci_dev, 
frag-page, frag-page_offset+offset, bcnt,
   PCI_DMA_TODEVICE);
  

[PATCH 8/12] forcedeth: rx data path optimization

2007-01-09 Thread Ayaz Abdulla

This patch optimizes the rx data paths and cleans up the code.

Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-08 14:06:32.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-08 14:18:37.0 -0500
@@ -1317,9 +1317,9 @@
np-put_rx.orig-buf = cpu_to_le32(np-put_rx_ctx-dma);
wmb();
np-put_rx.orig-flaglen = cpu_to_le32(np-rx_buf_sz | 
NV_RX_AVAIL);
-   if (np-put_rx.orig++ == np-last_rx.orig)
+   if (unlikely(np-put_rx.orig++ == np-last_rx.orig))
np-put_rx.orig = np-first_rx.orig;
-   if (np-put_rx_ctx++ == np-last_rx_ctx)
+   if (unlikely(np-put_rx_ctx++ == np-last_rx_ctx))
np-put_rx_ctx = np-first_rx_ctx;
} else {
return 1;
@@ -1349,9 +1349,9 @@
np-put_rx.ex-buflow = 
cpu_to_le64(np-put_rx_ctx-dma)  0x0;
wmb();
np-put_rx.ex-flaglen = cpu_to_le32(np-rx_buf_sz | 
NV_RX2_AVAIL);
-   if (np-put_rx.ex++ == np-last_rx.ex)
+   if (unlikely(np-put_rx.ex++ == np-last_rx.ex))
np-put_rx.ex = np-first_rx.ex;
-   if (np-put_rx_ctx++ == np-last_rx_ctx)
+   if (unlikely(np-put_rx_ctx++ == np-last_rx_ctx))
np-put_rx_ctx = np-first_rx_ctx;
} else {
return 1;
@@ -2046,24 +2046,17 @@
 {
struct fe_priv *np = netdev_priv(dev);
u32 flags;
-   u32 vlanflags = 0;
-   int count;
-
-   for (count = 0; count  limit; ++count) {
-   struct sk_buff *skb;
-   int len;
-
-   if (np-get_rx.orig == np-put_rx.orig)
-   break;  /* we scanned the whole ring - do not continue 
*/
-   flags = le32_to_cpu(np-get_rx.orig-flaglen);
-   len = nv_descr_getlength(np-get_rx.orig, np-desc_ver);
+   u32 rx_processed_cnt = 0;
+   struct sk_buff *skb;
+   int len;
+
+   while((np-get_rx.orig != np-put_rx.orig) 
+ !((flags = le32_to_cpu(np-get_rx.orig-flaglen))  NV_RX_AVAIL) 

+   (rx_processed_cnt++  limit)) {
 
dprintk(KERN_DEBUG %s: nv_rx_process: flags 0x%x.\n,
dev-name, flags);
 
-   if (flags  NV_RX_AVAIL)
-   break;  /* still owned by hardware, */
-
/*
 * the packet is for us - immediately tear down the pci mapping.
 * TODO: check if a prefetch of the first cacheline improves
@@ -2087,99 +2080,80 @@
}
/* look at what we actually got: */
if (np-desc_ver == DESC_VER_1) {
-   if (!(flags  NV_RX_DESCRIPTORVALID)) {
-   dev_kfree_skb(skb);
-   goto next_pkt;
-   }
-
-   if (flags  NV_RX_ERROR) {
-   if (flags  NV_RX_MISSEDFRAME) {
-   np-stats.rx_missed_errors++;
-   np-stats.rx_errors++;
-   dev_kfree_skb(skb);
-   goto next_pkt;
-   }
-   if (flags  
(NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) {
-   np-stats.rx_errors++;
-   dev_kfree_skb(skb);
-   goto next_pkt;
-   }
-   if (flags  NV_RX_CRCERR) {
-   np-stats.rx_crc_errors++;
-   np-stats.rx_errors++;
-   dev_kfree_skb(skb);
-   goto next_pkt;
-   }
-   if (flags  NV_RX_OVERFLOW) {
-   np-stats.rx_over_errors++;
-   np-stats.rx_errors++;
-   dev_kfree_skb(skb);
-   goto next_pkt;
-   }
-   if (flags  NV_RX_ERROR4) {
-   len = nv_getlen(dev, skb-data, len);
-   if (len  0) {
+   if (likely(flags  NV_RX_DESCRIPTORVALID)) {
+   len = flags  LEN_MASK_V1;
+   if (unlikely(flags  NV_RX_ERROR)) {
+   if (flags  NV_RX_ERROR4) {
+   

[PATCH 10/12] forcedeth: tx max work

2007-01-09 Thread Ayaz Abdulla
This patch adds a limit to how much tx work can be done in each 
iteration of tx processing.


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-08 20:34:35.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-08 20:35:22.0 -0500
@@ -1859,14 +1859,15 @@
}
 }
 
-static void nv_tx_done_optimized(struct net_device *dev)
+static void nv_tx_done_optimized(struct net_device *dev, int limit)
 {
struct fe_priv *np = netdev_priv(dev);
u32 flags;
struct ring_desc_ex* orig_get_tx = np-get_tx.ex;
 
while ((np-get_tx.ex != np-put_tx.ex) 
-  !((flags = le32_to_cpu(np-get_tx.ex-flaglen))  NV_TX_VALID)) {
+  !((flags = le32_to_cpu(np-get_tx.ex-flaglen))  NV_TX_VALID) 
+  (limit--  0)) {
 
dprintk(KERN_DEBUG %s: nv_tx_done_optimized: flags 0x%x.\n,
dev-name, flags);
@@ -1973,7 +1974,7 @@
if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2)
nv_tx_done(dev);
else
-   nv_tx_done_optimized(dev);
+   nv_tx_done_optimized(dev, np-tx_ring_size);
 
/* 3) if there are dead entries: clear everything */
if (np-get_tx_ctx != np-put_tx_ctx) {
@@ -2899,7 +2900,7 @@
break;
 
spin_lock(np-lock);
-   nv_tx_done_optimized(dev);
+   nv_tx_done_optimized(dev, TX_WORK_PER_LOOP);
spin_unlock(np-lock);
 
 #ifdef CONFIG_FORCEDETH_NAPI
@@ -3006,7 +3007,7 @@
break;
 
spin_lock_irqsave(np-lock, flags);
-   nv_tx_done_optimized(dev);
+   nv_tx_done_optimized(dev, TX_WORK_PER_LOOP);
spin_unlock_irqrestore(np-lock, flags);
 
if (unlikely(events  (NVREG_IRQ_TX_ERR))) {


[PATCH 11/12] forcedeth: statistics supported

2007-01-09 Thread Ayaz Abdulla
This patch introduces hw statistics for older devices that supported it. 
It breaks up the counters supported into separate versions.


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-08 20:35:53.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-08 20:36:17.0 -0500
@@ -173,9 +173,10 @@
 #define DEV_HAS_MSI_X   0x0080  /* device supports MSI-X */
 #define DEV_HAS_POWER_CNTRL 0x0100  /* device supports power savings */
 #define DEV_HAS_PAUSEFRAME_TX   0x0200  /* device supports tx pause frames */
-#define DEV_HAS_STATISTICS  0x0400  /* device supports hw statistics */
-#define DEV_HAS_TEST_EXTENDED   0x0800  /* device supports extended diagnostic 
test */
-#define DEV_HAS_MGMT_UNIT   0x1000  /* device supports management unit */
+#define DEV_HAS_STATISTICS_V1   0x0400  /* device supports hw statistics 
version 1 */
+#define DEV_HAS_STATISTICS_V2   0x0800  /* device supports hw statistics 
version 2 */
+#define DEV_HAS_TEST_EXTENDED   0x1000  /* device supports extended diagnostic 
test */
+#define DEV_HAS_MGMT_UNIT   0x2000  /* device supports management unit */
 
 enum {
NvRegIrqStatus = 0x000,
@@ -487,7 +488,8 @@
 
 /* Miscelaneous hardware related defines: */
 #define NV_PCI_REGSZ_VER1  0x270
-#define NV_PCI_REGSZ_VER2  0x604
+#define NV_PCI_REGSZ_VER2  0x2d4
+#define NV_PCI_REGSZ_VER3  0x604
 
 /* various timeout delays: all in usec */
 #define NV_TXRX_RESET_DELAY4
@@ -605,9 +607,6 @@
{ tx_carrier_errors },
{ tx_excess_deferral },
{ tx_retry_error },
-   { tx_deferral },
-   { tx_packets },
-   { tx_pause },
{ rx_frame_error },
{ rx_extra_byte },
{ rx_late_collision },
@@ -620,11 +619,17 @@
{ rx_unicast },
{ rx_multicast },
{ rx_broadcast },
+   { rx_packets },
+   { rx_errors_total },
+   { tx_errors_total },
+
+   /* version 2 stats */
+   { tx_deferral },
+   { tx_packets },
{ rx_bytes },
+   { tx_pause },
{ rx_pause },
-   { rx_drop_frame },
-   { rx_packets },
-   { rx_errors_total }
+   { rx_drop_frame }
 };
 
 struct nv_ethtool_stats {
@@ -637,9 +642,6 @@
u64 tx_carrier_errors;
u64 tx_excess_deferral;
u64 tx_retry_error;
-   u64 tx_deferral;
-   u64 tx_packets;
-   u64 tx_pause;
u64 rx_frame_error;
u64 rx_extra_byte;
u64 rx_late_collision;
@@ -652,13 +654,22 @@
u64 rx_unicast;
u64 rx_multicast;
u64 rx_broadcast;
+   u64 rx_packets;
+   u64 rx_errors_total;
+   u64 tx_errors_total;
+
+   /* version 2 stats */
+   u64 tx_deferral;
+   u64 tx_packets;
u64 rx_bytes;
+   u64 tx_pause;
u64 rx_pause;
u64 rx_drop_frame;
-   u64 rx_packets;
-   u64 rx_errors_total;
 };
 
+#define NV_DEV_STATISTICS_V2_COUNT (sizeof(struct 
nv_ethtool_stats)/sizeof(u64))
+#define NV_DEV_STATISTICS_V1_COUNT (NV_DEV_STATISTICS_V2_COUNT - 6)
+
 /* diagnostics */
 #define NV_TEST_COUNT_BASE 3
 #define NV_TEST_COUNT_EXTENDED 4
@@ -1275,6 +1286,61 @@
pci_push(base);
 }
 
+static void nv_get_hw_stats(struct net_device *dev)
+{
+   struct fe_priv *np = netdev_priv(dev);
+   u8 __iomem *base = get_hwbase(dev);
+
+   np-estats.tx_bytes += readl(base + NvRegTxCnt);
+   np-estats.tx_zero_rexmt += readl(base + NvRegTxZeroReXmt);
+   np-estats.tx_one_rexmt += readl(base + NvRegTxOneReXmt);
+   np-estats.tx_many_rexmt += readl(base + NvRegTxManyReXmt);
+   np-estats.tx_late_collision += readl(base + NvRegTxLateCol);
+   np-estats.tx_fifo_errors += readl(base + NvRegTxUnderflow);
+   np-estats.tx_carrier_errors += readl(base + NvRegTxLossCarrier);
+   np-estats.tx_excess_deferral += readl(base + NvRegTxExcessDef);
+   np-estats.tx_retry_error += readl(base + NvRegTxRetryErr);
+   np-estats.rx_frame_error += readl(base + NvRegRxFrameErr);
+   np-estats.rx_extra_byte += readl(base + NvRegRxExtraByte);
+   np-estats.rx_late_collision += readl(base + NvRegRxLateCol);
+   np-estats.rx_runt += readl(base + NvRegRxRunt);
+   np-estats.rx_frame_too_long += readl(base + NvRegRxFrameTooLong);
+   np-estats.rx_over_errors += readl(base + NvRegRxOverflow);
+   np-estats.rx_crc_errors += readl(base + NvRegRxFCSErr);
+   np-estats.rx_frame_align_error += readl(base + NvRegRxFrameAlignErr);
+   np-estats.rx_length_error += readl(base + NvRegRxLenErr);
+   np-estats.rx_unicast += readl(base + NvRegRxUnicast);
+   np-estats.rx_multicast += readl(base + NvRegRxMulticast);
+   np-estats.rx_broadcast += readl(base + NvRegRxBroadcast);
+   np-estats.rx_packets =
+   np-estats.rx_unicast +
+   np-estats.rx_multicast +
+   np-estats.rx_broadcast;
+   np-estats.rx_errors_total =
+   

[PATCH 12/12] forcedeth: statistics optimization

2007-01-09 Thread Ayaz Abdulla
This patch optimizes the data paths that can support hw counters. It 
removes the sw counted statistics.


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-08 18:32:08.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-08 18:42:58.0 -0500
@@ -1351,10 +1351,19 @@
 {
struct fe_priv *np = netdev_priv(dev);
 
-   /* It seems that the nic always generates interrupts and doesn't
-* accumulate errors internally. Thus the current values in np-stats
-* are already up to date.
-*/
+   /* If the nic supports hw counters then retrieve latest values */
+   if (np-driver_data  (DEV_HAS_STATISTICS_V1|DEV_HAS_STATISTICS_V2)) {
+   nv_get_hw_stats(dev);
+
+   /* copy to net_device stats */
+   np-stats.tx_bytes = np-estats.tx_bytes;
+   np-stats.tx_fifo_errors = np-estats.tx_fifo_errors;
+   np-stats.tx_carrier_errors = np-estats.tx_carrier_errors;
+   np-stats.rx_crc_errors = np-estats.rx_crc_errors;
+   np-stats.rx_over_errors = np-estats.rx_over_errors;
+   np-stats.rx_errors = np-estats.rx_errors_total;
+   np-stats.tx_errors = np-estats.tx_errors_total;
+   }
return np-stats;
 }
 
@@ -1944,16 +1953,8 @@
np-get_tx_ctx-dma = 0;
 
if (flags  NV_TX2_LASTPACKET) {
-   if (flags  NV_TX2_ERROR) {
-   if (flags  NV_TX2_UNDERFLOW)
-   np-stats.tx_fifo_errors++;
-   if (flags  NV_TX2_CARRIERLOST)
-   np-stats.tx_carrier_errors++;
-   np-stats.tx_errors++;
-   } else {
+   if (!(flags  NV_TX2_ERROR))
np-stats.tx_packets++;
-   np-stats.tx_bytes += np-get_tx_ctx-skb-len;
-   }
dev_kfree_skb_any(np-get_tx_ctx-skb);
np-get_tx_ctx-skb = NULL;
}
@@ -2290,7 +2291,6 @@
if (flags  NV_RX2_ERROR4) {
len = nv_getlen(dev, skb-data, len);
if (len  0) {
-   np-stats.rx_errors++;
dev_kfree_skb(skb);
goto next_pkt;
}
@@ -2303,11 +2303,6 @@
}
/* the rest are hard errors */
else {
-   if (flags  NV_RX2_CRCERR)
-   np-stats.rx_crc_errors++;
-   if (flags  NV_RX2_OVERFLOW)
-   np-stats.rx_over_errors++;
-   np-stats.rx_errors++;
dev_kfree_skb(skb);
goto next_pkt;
}


[PATCH 1/12] forcedeth: dma access

2007-01-09 Thread Ayaz Abdulla
This patch allows the hardware to fetch the tx and rx ring descriptors 
with 64 bytes per access instead of 32 bytes.


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-07 15:10:15.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-07 15:10:28.0 -0500
@@ -304,8 +304,8 @@
 #define NVREG_TXRXCTL_RESET0x0010
 #define NVREG_TXRXCTL_RXCHECK  0x0400
 #define NVREG_TXRXCTL_DESC_1   0
-#define NVREG_TXRXCTL_DESC_2   0x02100
-#define NVREG_TXRXCTL_DESC_3   0x02200
+#define NVREG_TXRXCTL_DESC_2   0x002100
+#define NVREG_TXRXCTL_DESC_3   0xc02200
 #define NVREG_TXRXCTL_VLANSTRIP 0x00040
 #define NVREG_TXRXCTL_VLANINS  0x00080
NvRegTxRingPhysAddrHigh = 0x148,


[PATCH 3/12] forcedeth: tx locking

2007-01-09 Thread Ayaz Abdulla
This patch reduces the amount of code within the lock to only the 
critical sections.


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-07 22:30:08.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-07 22:30:02.0 -0500
@@ -1569,12 +1569,11 @@
   ((skb_shinfo(skb)-frags[i].size  
(NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
}
 
-   spin_lock_irq(np-lock);
-
empty_slots = nv_get_empty_tx_slots(np);
if ((empty_slots - np-tx_limit_stop) = entries) {
-   spin_unlock_irq(np-lock);
+   spin_lock_irq(np-lock);
netif_stop_queue(dev);
+   spin_unlock_irq(np-lock);
return NETDEV_TX_BUSY;
}
 
@@ -1669,6 +1668,8 @@
tx_flags_vlan = NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb);
}
 
+   spin_lock_irq(np-lock);
+
/* set tx flags */
if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
start_tx.orig-flaglen |= cpu_to_le32(tx_flags | 
tx_flags_extra);
@@ -1679,6 +1680,7 @@
np-put_tx.ex = put_tx.ex;
}
 
+   spin_unlock_irq(np-lock);
 
dprintk(KERN_DEBUG %s: nv_start_xmit: entries %d queued for 
transmission. tx_flags_extra: %x\n,
dev-name, entries, tx_flags_extra);
@@ -1693,7 +1695,6 @@
}
 
dev-trans_start = jiffies;
-   spin_unlock_irq(np-lock);
writel(NVREG_TXRXCTL_KICK|np-txrxctl_bits, get_hwbase(dev) + 
NvRegTxRxControl);
pci_push(get_hwbase(dev));
return NETDEV_TX_OK;


[PATCH 2/12] forcedeth: ring access

2007-01-09 Thread Ayaz Abdulla
This patch modifys ring access by using pointers. This avoids computing 
the current index and avoids accessing the base address of the rings.


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-08 13:31:01.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-08 13:30:55.0 -0500
@@ -691,6 +691,12 @@
{ 0,0 }
 };
 
+struct nv_skb_map {
+   struct sk_buff *skb;
+   dma_addr_t dma;
+   unsigned int dma_len;
+};
+
 /*
  * SMP locking:
  * All hardware access under dev-priv-lock, except the performance
@@ -741,10 +747,12 @@
/* rx specific fields.
 * Locking: Within irq hander or disable_irq+spin_lock(np-lock);
 */
+   union ring_type get_rx, put_rx, first_rx, last_rx;
+   struct nv_skb_map *get_rx_ctx, *put_rx_ctx;
+   struct nv_skb_map *first_rx_ctx, *last_rx_ctx;
+   struct nv_skb_map *rx_skb;
+
union ring_type rx_ring;
-   unsigned int cur_rx, refill_rx;
-   struct sk_buff **rx_skbuff;
-   dma_addr_t *rx_dma;
unsigned int rx_buf_sz;
unsigned int pkt_limit;
struct timer_list oom_kick;
@@ -761,11 +769,12 @@
/*
 * tx specific fields.
 */
+   union ring_type get_tx, put_tx, first_tx, last_tx;
+   struct nv_skb_map *get_tx_ctx, *put_tx_ctx;
+   struct nv_skb_map *first_tx_ctx, *last_tx_ctx;
+   struct nv_skb_map *tx_skb;
+
union ring_type tx_ring;
-   unsigned int next_tx, nic_tx;
-   struct sk_buff **tx_skbuff;
-   dma_addr_t *tx_dma;
-   unsigned int *tx_dma_len;
u32 tx_flags;
int tx_ring_size;
int tx_limit_start;
@@ -921,16 +930,10 @@
pci_free_consistent(np-pci_dev, sizeof(struct 
ring_desc_ex) * (np-rx_ring_size + np-tx_ring_size),
np-rx_ring.ex, np-ring_addr);
}
-   if (np-rx_skbuff)
-   kfree(np-rx_skbuff);
-   if (np-rx_dma)
-   kfree(np-rx_dma);
-   if (np-tx_skbuff)
-   kfree(np-tx_skbuff);
-   if (np-tx_dma)
-   kfree(np-tx_dma);
-   if (np-tx_dma_len)
-   kfree(np-tx_dma_len);
+   if (np-rx_skb)
+   kfree(np-rx_skb);
+   if (np-tx_skb)
+   kfree(np-tx_skb);
 }
 
 static int using_multi_irqs(struct net_device *dev)
@@ -1304,43 +1307,60 @@
 static int nv_alloc_rx(struct net_device *dev)
 {
struct fe_priv *np = netdev_priv(dev);
-   unsigned int refill_rx = np-refill_rx;
-   int nr;
+   union ring_type less_rx;
 
-   while (np-cur_rx != refill_rx) {
+   if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
+   less_rx.orig = np-get_rx.orig;
+   if (less_rx.orig-- == np-first_rx.orig)
+   less_rx.orig = np-last_rx.orig;
+   } else {
+   less_rx.ex = np-get_rx.ex;
+   if (less_rx.ex-- == np-first_rx.ex)
+   less_rx.ex = np-last_rx.ex;
+   }
+
+   while (1) {
struct sk_buff *skb;
 
-   nr = refill_rx % np-rx_ring_size;
-   if (np-rx_skbuff[nr] == NULL) {
+   if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
+   if (np-put_rx.orig == less_rx.orig)
+   break;
+   } else {
+   if (np-put_rx.ex == less_rx.ex)
+   break;
+   }
+
+   if (np-put_rx_ctx-skb == NULL) {
 
skb = dev_alloc_skb(np-rx_buf_sz + NV_RX_ALLOC_PAD);
if (!skb)
-   break;
+   return 1;
 
skb-dev = dev;
-   np-rx_skbuff[nr] = skb;
+   np-put_rx_ctx-skb = skb;
} else {
-   skb = np-rx_skbuff[nr];
+   skb = np-put_rx_ctx-skb;
}
-   np-rx_dma[nr] = pci_map_single(np-pci_dev, skb-data,
+   np-put_rx_ctx-dma = pci_map_single(np-pci_dev, skb-data,
skb-end-skb-data, PCI_DMA_FROMDEVICE);
+   np-put_rx_ctx-dma_len = skb-end-skb-data;
if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
-   np-rx_ring.orig[nr].buf = cpu_to_le32(np-rx_dma[nr]);
+   np-put_rx.orig-buf = cpu_to_le32(np-put_rx_ctx-dma);
wmb();
-   np-rx_ring.orig[nr].flaglen = 
cpu_to_le32(np-rx_buf_sz | NV_RX_AVAIL);
+   np-put_rx.orig-flaglen = cpu_to_le32(np-rx_buf_sz | 
NV_RX_AVAIL);
+   if (np-put_rx.orig++ == np-last_rx.orig)
+   np-put_rx.orig = np-first_rx.orig;
} else {
-   np-rx_ring.ex[nr].bufhigh = 

[PATCH 4/12] forcedeth: rx skb recycle

2007-01-09 Thread Ayaz Abdulla
This patch removes the code that recycled the skb on error. This will 
help in reducing the branches in the main data paths.


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-07 22:31:14.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-07 23:07:19.0 -0500
@@ -1330,36 +1330,32 @@
break;
}
 
-   if (np-put_rx_ctx-skb == NULL) {
-
-   skb = dev_alloc_skb(np-rx_buf_sz + NV_RX_ALLOC_PAD);
-   if (!skb)
-   return 1;
-
+   skb = dev_alloc_skb(np-rx_buf_sz + NV_RX_ALLOC_PAD);
+   if (skb) {
skb-dev = dev;
np-put_rx_ctx-skb = skb;
+   np-put_rx_ctx-dma = pci_map_single(np-pci_dev, 
skb-data,
+
skb-end-skb-data, PCI_DMA_FROMDEVICE);
+   np-put_rx_ctx-dma_len = skb-end-skb-data;
+   if (np-desc_ver == DESC_VER_1 || np-desc_ver == 
DESC_VER_2) {
+   np-put_rx.orig-buf = 
cpu_to_le32(np-put_rx_ctx-dma);
+   wmb();
+   np-put_rx.orig-flaglen = 
cpu_to_le32(np-rx_buf_sz | NV_RX_AVAIL);
+   if (np-put_rx.orig++ == np-last_rx.orig)
+   np-put_rx.orig = np-first_rx.orig;
+   } else {
+   np-put_rx.ex-bufhigh = 
cpu_to_le64(np-put_rx_ctx-dma)  32;
+   np-put_rx.ex-buflow = 
cpu_to_le64(np-put_rx_ctx-dma)  0x0;
+   wmb();
+   np-put_rx.ex-flaglen = 
cpu_to_le32(np-rx_buf_sz | NV_RX2_AVAIL);
+   if (np-put_rx.ex++ == np-last_rx.ex)
+   np-put_rx.ex = np-first_rx.ex;
+   }
+   if (np-put_rx_ctx++ == np-last_rx_ctx)
+   np-put_rx_ctx = np-first_rx_ctx;
} else {
-   skb = np-put_rx_ctx-skb;
-   }
-   np-put_rx_ctx-dma = pci_map_single(np-pci_dev, skb-data,
-   skb-end-skb-data, PCI_DMA_FROMDEVICE);
-   np-put_rx_ctx-dma_len = skb-end-skb-data;
-   if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
-   np-put_rx.orig-buf = cpu_to_le32(np-put_rx_ctx-dma);
-   wmb();
-   np-put_rx.orig-flaglen = cpu_to_le32(np-rx_buf_sz | 
NV_RX_AVAIL);
-   if (np-put_rx.orig++ == np-last_rx.orig)
-   np-put_rx.orig = np-first_rx.orig;
-   } else {
-   np-put_rx.ex-bufhigh = 
cpu_to_le64(np-put_rx_ctx-dma)  32;
-   np-put_rx.ex-buflow = 
cpu_to_le64(np-put_rx_ctx-dma)  0x0;
-   wmb();
-   np-put_rx.ex-flaglen = cpu_to_le32(np-rx_buf_sz | 
NV_RX2_AVAIL);
-   if (np-put_rx.ex++ == np-last_rx.ex)
-   np-put_rx.ex = np-first_rx.ex;
+   return 1;
}
-   if (np-put_rx_ctx++ == np-last_rx_ctx)
-   np-put_rx_ctx = np-first_rx_ctx;
}
return 0;
 }
@@ -1948,6 +1944,8 @@
pci_unmap_single(np-pci_dev, np-get_rx_ctx-dma,
np-get_rx_ctx-dma_len,
PCI_DMA_FROMDEVICE);
+   skb = np-get_rx_ctx-skb;
+   np-get_rx_ctx-skb = NULL;
 
{
int j;
@@ -1955,39 +1953,46 @@
for (j=0; j64; j++) {
if ((j%16) == 0)
dprintk(\n%03x:, j);
-   dprintk( %02x, ((unsigned 
char*)np-get_rx_ctx-skb-data)[j]);
+   dprintk( %02x, ((unsigned 
char*)skb-data)[j]);
}
dprintk(\n);
}
/* look at what we actually got: */
if (np-desc_ver == DESC_VER_1) {
-   if (!(flags  NV_RX_DESCRIPTORVALID))
+   if (!(flags  NV_RX_DESCRIPTORVALID)) {
+   dev_kfree_skb(skb);
goto next_pkt;
+   }
 
if (flags  NV_RX_ERROR) {
if (flags  NV_RX_MISSEDFRAME) {
np-stats.rx_missed_errors++;
np-stats.rx_errors++;
+   dev_kfree_skb(skb);
goto next_pkt;
 

[PATCH 6/12] forcedeth: tx limiting

2007-01-09 Thread Ayaz Abdulla
This patch optimizes the logic for tx limiting. It adds a flag to check 
on the completion side instead of recalculating the number of empty 
slots. Also, it removes the fields that were previous used for limiting 
since they have no value.


Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]

--- orig/drivers/net/forcedeth.c2007-01-08 11:12:15.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-08 11:12:10.0 -0500
@@ -518,12 +518,6 @@
 #define TX_RING_MIN64
 #define RING_MAX_DESC_VER_11024
 #define RING_MAX_DESC_VER_2_3  16384
-/*
- * Difference between the get and put pointers for the tx ring.
- * This is used to throttle the amount of data outstanding in the
- * tx ring.
- */
-#define TX_LIMIT_DIFFERENCE1
 
 /* rx/tx mac addr + type + vlan + align + slack*/
 #define NV_RX_HEADERS  (64)
@@ -777,8 +771,7 @@
union ring_type tx_ring;
u32 tx_flags;
int tx_ring_size;
-   int tx_limit_start;
-   int tx_limit_stop;
+   int tx_stop;
 
/* vlan fields */
struct vlan_group *vlangrp;
@@ -1583,9 +1576,10 @@
}
 
empty_slots = nv_get_empty_tx_slots(np);
-   if ((empty_slots - np-tx_limit_stop) = entries) {
+   if (empty_slots = entries) {
spin_lock_irq(np-lock);
netif_stop_queue(dev);
+   np-tx_stop = 1;
spin_unlock_irq(np-lock);
return NETDEV_TX_BUSY;
}
@@ -1704,9 +1698,10 @@
}
 
empty_slots = nv_get_empty_tx_slots(np);
-   if ((empty_slots - np-tx_limit_stop) = entries) {
+   if (empty_slots = entries) {
spin_lock_irq(np-lock);
netif_stop_queue(dev);
+   np-tx_stop = 1;
spin_unlock_irq(np-lock);
return NETDEV_TX_BUSY;
}
@@ -1813,6 +1808,7 @@
struct fe_priv *np = netdev_priv(dev);
u32 flags;
struct sk_buff *skb;
+   struct ring_desc* orig_get_tx = np-get_tx.orig;
 
while (np-get_tx.orig != np-put_tx.orig) {
flags = le32_to_cpu(np-get_tx.orig-flaglen);
@@ -1858,8 +1854,10 @@
if (np-get_tx_ctx++ == np-last_tx_ctx)
np-get_tx_ctx = np-first_tx_ctx;
}
-   if (nv_get_empty_tx_slots(np)  np-tx_limit_start)
+   if ((np-tx_stop == 1)  (np-get_tx.orig != orig_get_tx)) {
+   np-tx_stop = 0;
netif_wake_queue(dev);
+   }
 }
 
 static void nv_tx_done_optimized(struct net_device *dev)
@@ -1867,6 +1865,7 @@
struct fe_priv *np = netdev_priv(dev);
u32 flags;
struct sk_buff *skb;
+   struct ring_desc_ex* orig_get_tx = np-get_tx.ex;
 
while (np-get_tx.ex == np-put_tx.ex) {
flags = le32_to_cpu(np-get_tx.ex-flaglen);
@@ -1895,8 +1894,10 @@
if (np-get_tx_ctx++ == np-last_tx_ctx)
np-get_tx_ctx = np-first_tx_ctx;
}
-   if (nv_get_empty_tx_slots(np)  np-tx_limit_start)
+   if ((np-tx_stop == 1)  (np-get_tx.ex != orig_get_tx)) {
+   np-tx_stop = 0;
netif_wake_queue(dev);
+   }
 }
 
 /*
@@ -4001,8 +4002,6 @@
/* set new values */
np-rx_ring_size = ring-rx_pending;
np-tx_ring_size = ring-tx_pending;
-   np-tx_limit_stop = TX_LIMIT_DIFFERENCE;
-   np-tx_limit_start = TX_LIMIT_DIFFERENCE;
if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
np-rx_ring.orig = (struct ring_desc*)rxtx_ring;
np-tx_ring.orig = np-rx_ring.orig[np-rx_ring_size];
@@ -4967,8 +4966,6 @@
 
np-rx_ring_size = RX_RING_DEFAULT;
np-tx_ring_size = TX_RING_DEFAULT;
-   np-tx_limit_stop = TX_LIMIT_DIFFERENCE;
-   np-tx_limit_start = TX_LIMIT_DIFFERENCE;
 
if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
np-rx_ring.orig = pci_alloc_consistent(pci_dev,


[PATCH 9/12] forcedeth: irq data path optimization

2007-01-09 Thread Ayaz Abdulla

This patch optimizes the irq data paths and cleans up the code.

Signed-Off-By: Ayaz Abdulla [EMAIL PROTECTED]


--- orig/drivers/net/forcedeth.c2007-01-08 20:33:47.0 -0500
+++ new/drivers/net/forcedeth.c 2007-01-08 20:33:39.0 -0500
@@ -2777,7 +2777,6 @@
events = readl(base + NvRegMSIXIrqStatus)  
NVREG_IRQSTAT_MASK;
writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus);
}
-   pci_push(base);
dprintk(KERN_DEBUG %s: irq: %08x\n, dev-name, events);
if (!(events  np-irqmask))
break;
@@ -2786,22 +2785,46 @@
nv_tx_done(dev);
spin_unlock(np-lock);
 
-   if (events  NVREG_IRQ_LINK) {
+#ifdef CONFIG_FORCEDETH_NAPI
+   if (events  NVREG_IRQ_RX_ALL) {
+   netif_rx_schedule(dev);
+
+   /* Disable furthur receive irq's */
+   spin_lock(np-lock);
+   np-irqmask = ~NVREG_IRQ_RX_ALL;
+
+   if (np-msi_flags  NV_MSI_X_ENABLED)
+   writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask);
+   else
+   writel(np-irqmask, base + NvRegIrqMask);
+   spin_unlock(np-lock);
+   }
+#else
+   if (nv_rx_process(dev, dev-weight)) {
+   if (unlikely(nv_alloc_rx(dev))) {
+   spin_lock(np-lock);
+   if (!np-in_shutdown)
+   mod_timer(np-oom_kick, jiffies + 
OOM_REFILL);
+   spin_unlock(np-lock);
+   }
+   }
+#endif
+   if (unlikely(events  NVREG_IRQ_LINK)) {
spin_lock(np-lock);
nv_link_irq(dev);
spin_unlock(np-lock);
}
-   if (np-need_linktimer  time_after(jiffies, 
np-link_timeout)) {
+   if (unlikely(np-need_linktimer  time_after(jiffies, 
np-link_timeout))) {
spin_lock(np-lock);
nv_linkchange(dev);
spin_unlock(np-lock);
np-link_timeout = jiffies + LINK_TIMEOUT;
}
-   if (events  (NVREG_IRQ_TX_ERR)) {
+   if (unlikely(events  (NVREG_IRQ_TX_ERR))) {
dprintk(KERN_DEBUG %s: received irq with events 0x%x. 
Probably TX fail.\n,
dev-name, events);
}
-   if (events  (NVREG_IRQ_UNKNOWN)) {
+   if (unlikely(events  (NVREG_IRQ_UNKNOWN))) {
printk(KERN_DEBUG %s: received irq with unknown events 
0x%x. Please report\n,
dev-name, events);
}
@@ -2822,30 +2845,7 @@
spin_unlock(np-lock);
break;
}
-#ifdef CONFIG_FORCEDETH_NAPI
-   if (events  NVREG_IRQ_RX_ALL) {
-   netif_rx_schedule(dev);
-
-   /* Disable furthur receive irq's */
-   spin_lock(np-lock);
-   np-irqmask = ~NVREG_IRQ_RX_ALL;
-
-   if (np-msi_flags  NV_MSI_X_ENABLED)
-   writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask);
-   else
-   writel(np-irqmask, base + NvRegIrqMask);
-   spin_unlock(np-lock);
-   }
-#else
-   nv_rx_process(dev, dev-weight);
-   if (nv_alloc_rx(dev)) {
-   spin_lock(np-lock);
-   if (!np-in_shutdown)
-   mod_timer(np-oom_kick, jiffies + OOM_REFILL);
-   spin_unlock(np-lock);
-   }
-#endif
-   if (i  max_interrupt_work) {
+   if (unlikely(i  max_interrupt_work)) {
spin_lock(np-lock);
/* disable interrupts on the nic */
if (!(np-msi_flags  NV_MSI_X_ENABLED))
@@ -2869,6 +2869,13 @@
return IRQ_RETVAL(i);
 }
 
+#define TX_WORK_PER_LOOP  64
+#define RX_WORK_PER_LOOP  64
+/**
+ * All _optimized functions are used to help increase performance
+ * (reduce CPU and increase throughput). They use descripter version 3,
+ * compiler directives, and reduce memory accesses.
+ */
 static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
 {
struct net_device *dev = (struct net_device *) data;
@@ -2887,7 +2894,6 @@
events = readl(base + NvRegMSIXIrqStatus)  
NVREG_IRQSTAT_MASK;
writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus);
}
-   pci_push(base);
 

Re: [patch]net/xfrm:fix crash in ipsec audit logging

2007-01-09 Thread Joy Latten
On Tue, 2006-12-26 at 13:37 -0500, jamal wrote:
On Tue, 2006-26-12 at 18:56 +0100, Ingo Molnar wrote:
 
 
  +   xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
  +  AUDIT_MAC_IPSEC_DELSPD, delete, xp, NULL);
  +
  if (!delete) {
  struct sk_buff *resp_skb;
 
 
 You could move the call into the else from above if (!delete) maybe?
 Otherwise you have to add back the if (delete) check since that
 function could be used to either retrieve (which is not subject to an
 audit) or delete an xp.
 
 cheers,
 jamal
  

My apologies as I am just reading my email.

Yes, I think in the else part of the if (!delete).

I also added a check to xfrm_audit_log() such that if both xfrm
and policy are NULL, we return. There isn't anything to audit
since we are only auditing creation and deletion of xfrm and 
policy.

Ingo, could you try this patch and let me know if everything works ok
for you. I have built and test in my environment, but not tested as
you are using it.  

Regards,
Joy

Signed-off-by: Joy Latten [EMAIL PROTECTED]

--

diff -urpN linux-2.6.19.orig/net/xfrm/xfrm_policy.c 
linux-2.6.19/net/xfrm/xfrm_policy.c
--- linux-2.6.19.orig/net/xfrm/xfrm_policy.c2007-01-02 14:24:14.0 
-0600
+++ linux-2.6.19/net/xfrm/xfrm_policy.c 2007-01-02 14:28:24.0 -0600
@@ -2003,6 +2003,9 @@ void xfrm_audit_log(uid_t auid, u32 sid,
if (audit_enabled == 0)
return;
 
+   if ((x == NULL)  (xp == NULL))
+   return;
+
audit_buf = audit_log_start(current-audit_context, GFP_ATOMIC, type);
if (audit_buf == NULL)
return;
diff -urpN linux-2.6.19.orig/net/xfrm/xfrm_user.c 
linux-2.6.19/net/xfrm/xfrm_user.c
--- linux-2.6.19.orig/net/xfrm/xfrm_user.c  2007-01-02 14:24:14.0 
-0600
+++ linux-2.6.19/net/xfrm/xfrm_user.c   2007-01-02 14:28:14.0 -0600
@@ -1268,10 +1268,6 @@ static int xfrm_get_policy(struct sk_buf
xp = xfrm_policy_bysel_ctx(type, p-dir, p-sel, tmp.security, 
delete);
security_xfrm_policy_free(tmp);
}
-   if (delete)
-   xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
-  AUDIT_MAC_IPSEC_DELSPD, (xp) ? 1 : 0, xp, NULL);
-
if (xp == NULL)
return -ENOENT;
 
@@ -1289,6 +1285,10 @@ static int xfrm_get_policy(struct sk_buf
} else {
if ((err = security_xfrm_policy_delete(xp)) != 0)
goto out;
+
+   xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
+  AUDIT_MAC_IPSEC_DELSPD, (xp) ? 1 : 0, xp, NULL);
+
c.data.byid = p-index;
c.event = nlh-nlmsg_type;
c.seq = nlh-nlmsg_seq;

. 
-
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] d80211: don't symlink empty default keys

2007-01-09 Thread Jan Kiszka
This gets rid of annoying

wlan0: cannot create symlink to default key

in my syslog with latest rt2x00. The patch takes care that in case of
(key/old_key == NULL  set_tx_key) the existing default key symlink is
removed correctly. Moreover, it tests for key!=NULL before trying to register
a new default link.

Signed-off-by: Jan Kiszka [EMAIL PROTECTED]

---
 ieee80211/ieee80211_ioctl.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: rt2x00/ieee80211/ieee80211_ioctl.c
===
--- rt2x00.orig/ieee80211/ieee80211_ioctl.c
+++ rt2x00/ieee80211/ieee80211_ioctl.c
@@ -629,7 +629,7 @@ static int ieee80211_set_encryption(stru
}
kfree(keyconf);
 
-   if (key  sdata-default_key == key) {
+   if (set_tx_key || (key  sdata-default_key == key)) {
ieee80211_key_sysfs_remove_default(sdata);
sdata-default_key = NULL;
}
@@ -673,7 +673,7 @@ static int ieee80211_set_encryption(stru
}
}
 
-   if (old_key  sdata-default_key == old_key) {
+   if (set_tx_key || (old_key  sdata-default_key == old_key)) {
ieee80211_key_sysfs_remove_default(sdata);
sdata-default_key = NULL;
}
@@ -700,7 +700,7 @@ static int ieee80211_set_encryption(stru
 
if (set_tx_key || (!sta  !sdata-default_key  key)) {
sdata-default_key = key;
-   if (ieee80211_key_sysfs_add_default(sdata))
+   if (key  ieee80211_key_sysfs_add_default(sdata))
printk(KERN_WARNING %s: cannot create symlink to 
   default key\n, dev-name);
if (local-ops-set_key_idx 




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] [SCTP]: Fix err_hdr assignment in sctp_init_cause.

2007-01-09 Thread David Miller
From: Sridhar Samudrala [EMAIL PROTECTED]
Date: Tue, 09 Jan 2007 11:26:49 -0800

 [SCTP]: Fix err_hdr assignment in sctp_init_cause.
 
 The subh-err_hdr should point to the error header, not the data.
 
 Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
 Signed-off-by: Sridhar Samudrala [EMAIL PROTECTED]

Applied, thanks Sridahr.

Do we need this for the 2.6.x -stable branches too?

Thanks again.
-
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] INET: style updates for the inet_sock-is_icsk assignment fix

2007-01-09 Thread David Miller
From: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
Date: Tue, 9 Jan 2007 16:45:12 -0200

 On 1/9/07, Paul Moore [EMAIL PROTECTED] wrote:
  A quick patch to change the inet_sock-is_icsk assignment to better fit with
  existing kernel coding style.
 
  Signed-off-by: Paul Moore [EMAIL PROTECTED]
  Cc: Jarek Poplawski [EMAIL PROTECTED]
  Cc: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
 
 Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]

Ok, the style police win :)
-
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] devinet: inetdev_init out label moved after RCU assignment

2007-01-09 Thread David Miller
From: Herbert Xu [EMAIL PROTECTED]
Date: Fri, 5 Jan 2007 22:23:53 +1100

 On Fri, Jan 05, 2007 at 12:19:10PM +0100, Jarek Poplawski wrote:
  
  Why me? (I didn't spoil this!)
 
 You spotted the problem, so it's only fair that you get the credit :)
 
  Subject: [PATCH] devinet: inetdev_init out label moved after RCU assignment
  
  inetdev_init out label moved after RCU assignment
  (final suggestion by Herbert Xu)
  
  Signed-off-by: Jarek Poplawski [EMAIL PROTECTED]
 
 Thanks, looks good to me.

Applied, thanks everyone.
-
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] d80211: don't symlink empty default keys

2007-01-09 Thread Jan Kiszka
Jan Kiszka wrote:
 This gets rid of annoying
 
 wlan0: cannot create symlink to default key
 
 in my syslog with latest rt2x00. The patch takes care that in case of
 (key/old_key == NULL  set_tx_key) the existing default key symlink is
 removed correctly. Moreover, it tests for key!=NULL before trying to register
 a new default link.
 

Grr, just noticed that the subject was still only reflecting one part of
the patch. Let's call it fix default key symlink creation/cleanup.

Jan



signature.asc
Description: OpenPGP digital signature


[PATCH 1/1] bonding: eliminate RTNL assertion spew

2007-01-09 Thread Andy Gospodarek

These changes eliminate the messages indicating that the rtnetlink lock
isn't held when bonding tries to change the MAC address of an interface.
These calls generally come from timer-pops, but also from sysfs events
since neither hold the rtnl lock.  

The spew generally looks something like this:

RTNL: assertion failed at net/core/fib_rules.c (391)
 [c028d12e] fib_rules_event+0x3a/0xeb
 [c02da576] notifier_call_chain+0x19/0x29
 [c0280ce6] dev_set_mac_address+0x46/0x4b
 [f8a2a686] alb_set_slave_mac_addr+0x5d/0x88 [bonding]
 [f8a2aa7e] alb_swap_mac_addr+0x88/0x134 [bonding]
 [f8a25ed9] bond_change_active_slave+0x1a1/0x2c5 [bonding]
 [f8a262e8] bond_select_active_slave+0xa8/0xe1 [bonding]
 [f8a27ecb] bond_mii_monitor+0x3af/0x3fd [bonding]
 [c0121896] run_workqueue+0x85/0xc5
 [f8a27b1c] bond_mii_monitor+0x0/0x3fd [bonding]
 [c0121d83] worker_thread+0xe8/0x119
 [c079] default_wake_function+0x0/0xc
 [c0121c9b] worker_thread+0x0/0x119
 [c0124099] kthread+0xad/0xd8
 [c0123fec] kthread+0x0/0xd8
 .

This patch was mostly inspired from parts of some potential bonding
updates Jay Vosburgh [EMAIL PROTECTED] and I discussed in December, so
he deserves most of the credit for the idea.

I've tested it on several systems and it works as I expect.  Deadlocks
between the rtnl and global bond lock are avoided since we drop the
global bond lock before taking the rtnl lock.


Signed-off-by: Andy Gospodarek [EMAIL PROTECTED]
---

 bond_alb.c   |   16 +++-
 bond_alb.h   |2 +-
 bond_main.c  |   32 +---
 bond_sysfs.c |8 
 bonding.h|7 +--
 5 files changed, 42 insertions(+), 23 deletions(-)

diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 3292316..150b787 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1557,13 +1557,14 @@ void bond_alb_handle_link_change(struct 
  * bond_alb_handle_active_change - assign new curr_active_slave
  * @bond: our bonding struct
  * @new_slave: new slave to assign
+ * @rtnl_locked: current rtnl lock status 
  *
  * Set the bond-curr_active_slave to @new_slave and handle
  * mac address swapping and promiscuity changes as needed.
  *
  * Caller must hold bond curr_slave_lock for write (or bond lock for write)
  */
-void bond_alb_handle_active_change(struct bonding *bond, struct slave 
*new_slave)
+void bond_alb_handle_active_change(struct bonding *bond, struct slave 
*new_slave, int rtnl_locked)
 {
struct slave *swap_slave;
int i;
@@ -1585,6 +1586,7 @@ void bond_alb_handle_active_change(struc
return;
}
 
+
/* set the new curr_active_slave to the bonds mac address
 * i.e. swap mac addresses of old curr_active_slave and new 
curr_active_slave
 */
@@ -1600,6 +1602,12 @@ void bond_alb_handle_active_change(struc
}
}
 
+   /* need to hold rtnl_lock here, but unlock at least bond lock  */
+   if (!rtnl_locked) {
+   write_unlock_bh(bond-lock);
+   rtnl_lock();
+   }
+
/* curr_active_slave must be set before calling alb_swap_mac_addr */
if (swap_slave) {
/* swap mac address */
@@ -1611,6 +1619,12 @@ void bond_alb_handle_active_change(struc
/* fasten bond mac on new current slave */
alb_send_learning_packets(new_slave, bond-dev-dev_addr);
}
+
+   /* drop rtnl_lock, take back others */
+   if (!rtnl_locked) {
+   rtnl_unlock();
+   write_lock_bh(bond-lock);
+   }
 }
 
 int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h
index 28f2a2f..af72dd8 100644
--- a/drivers/net/bonding/bond_alb.h
+++ b/drivers/net/bonding/bond_alb.h
@@ -123,7 +123,7 @@ void bond_alb_deinitialize(struct bondin
 int bond_alb_init_slave(struct bonding *bond, struct slave *slave);
 void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave);
 void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, 
char link);
-void bond_alb_handle_active_change(struct bonding *bond, struct slave 
*new_slave);
+void bond_alb_handle_active_change(struct bonding *bond, struct slave 
*new_slave, int rtnl_locked);
 int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev);
 void bond_alb_monitor(struct bonding *bond);
 int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6482aed..0134dd0 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1029,6 +1029,7 @@ static struct slave *bond_find_best_slav
  * change_active_interface - change the active slave into the specified one
  * @bond: our bonding struct
  * @new: the new slave to make the active one
+ * @rtnl_locked: current rtnl lock status
  *
  * Set the new slave to the 

Re: [PATCH 1/1] bonding: eliminate RTNL assertion spew

2007-01-09 Thread Stephen Hemminger
On Tue, 9 Jan 2007 17:59:01 -0500
Andy Gospodarek [EMAIL PROTECTED] wrote:

 
 These changes eliminate the messages indicating that the rtnetlink lock
 isn't held when bonding tries to change the MAC address of an interface.
 These calls generally come from timer-pops, but also from sysfs events
 since neither hold the rtnl lock.  
 
 The spew generally looks something like this:
 
 RTNL: assertion failed at net/core/fib_rules.c (391)
  [c028d12e] fib_rules_event+0x3a/0xeb
  [c02da576] notifier_call_chain+0x19/0x29
  [c0280ce6] dev_set_mac_address+0x46/0x4b
  [f8a2a686] alb_set_slave_mac_addr+0x5d/0x88 [bonding]
  [f8a2aa7e] alb_swap_mac_addr+0x88/0x134 [bonding]
  [f8a25ed9] bond_change_active_slave+0x1a1/0x2c5 [bonding]
  [f8a262e8] bond_select_active_slave+0xa8/0xe1 [bonding]
  [f8a27ecb] bond_mii_monitor+0x3af/0x3fd [bonding]
  [c0121896] run_workqueue+0x85/0xc5
  [f8a27b1c] bond_mii_monitor+0x0/0x3fd [bonding]
  [c0121d83] worker_thread+0xe8/0x119
  [c079] default_wake_function+0x0/0xc
  [c0121c9b] worker_thread+0x0/0x119
  [c0124099] kthread+0xad/0xd8
  [c0123fec] kthread+0x0/0xd8
  .
 
 This patch was mostly inspired from parts of some potential bonding
 updates Jay Vosburgh [EMAIL PROTECTED] and I discussed in December, so
 he deserves most of the credit for the idea.
 
 I've tested it on several systems and it works as I expect.  Deadlocks
 between the rtnl and global bond lock are avoided since we drop the
 global bond lock before taking the rtnl lock.
 


This seems like the ugly way to do it. Couldn't you just change figure out
how to acquire RTNL first. It wouldn't hurt to acquire it in the monitor
routine even if you don't need it.

Conditional locking is a bad road to start down.
-
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] bonding: eliminate RTNL assertion spew

2007-01-09 Thread Jeff Garzik

Andy Gospodarek wrote:

-void bond_alb_handle_active_change(struct bonding *bond, struct slave 
*new_slave)
+void bond_alb_handle_active_change(struct bonding *bond, struct slave 
*new_slave, int rtnl_locked)
 {
struct slave *swap_slave;
int i;


Although this is not a direct NAK (haven't read the full patch yet), 
conditional locking behavior like this is /very/ fragile, and in Linux 
is generally discouraged.  Vendor drivers in particular have a history 
of constantly getting this wrong, and it makes locking more difficult to 
review.


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 1/1] bonding: eliminate RTNL assertion spew

2007-01-09 Thread Andy Gospodarek
On Tue, Jan 09, 2007 at 06:13:55PM -0500, Jeff Garzik wrote:
 Andy Gospodarek wrote:
 -void bond_alb_handle_active_change(struct bonding *bond, struct slave 
 *new_slave)
 +void bond_alb_handle_active_change(struct bonding *bond, struct slave 
 *new_slave, int rtnl_locked)
  {
  struct slave *swap_slave;
  int i;
 
 Although this is not a direct NAK (haven't read the full patch yet), 
 conditional locking behavior like this is /very/ fragile, and in Linux 
 is generally discouraged.  Vendor drivers in particular have a history 
 of constantly getting this wrong, and it makes locking more difficult to 
 review.
 
   Jeff
 

I'd be happy to propose something that doesn't do conditional locking
like this.  I saw this route as a way to take the rtnl lock only when it
was absolutely necessary.  After spending some time trying to get it
right I can understand why it is so discouraged.  I'd also rather not
provide a 'bad example' for how to do things. :-)

If others are OK with it, I'd be happy to propose a patch like Stephen
suggested where the lock is taken in the mii/arp monitor routines.
Though the locking would be unnecessary in some cases it would be much
cleaner and easier to maintain.

-
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 3/3] chelsio: more rx speedup

2007-01-09 Thread Divy Le Ray

Stephen Hemminger wrote:

On Tue, 9 Jan 2007 09:42:03 +0100
Ingo Oeser [EMAIL PROTECTED] wrote:

  

Hi Stephen,

Stephen Hemminger schrieb:


--- netdev-2.6.orig/drivers/net/chelsio/sge.c
+++ netdev-2.6/drivers/net/chelsio/sge.c
  

[...]


@@ -1043,45 +1046,42 @@ static void recycle_fl_buf(struct freelQ
  * be copied but there is no memory for the copy.
  */
 static inline struct sk_buff *get_packet(struct pci_dev *pdev,
-struct freelQ *fl, unsigned int len,
-int dma_pad, int skb_pad,
-unsigned int copy_thres,
-unsigned int drop_thres)
+struct freelQ *fl, unsigned int len)
 {
struct sk_buff *skb;
-   struct freelQ_ce *ce = fl-centries[fl-cidx];
+   const struct freelQ_ce *ce = fl-centries[fl-cidx];
 
-	if (len  copy_thres) {

-   skb = alloc_skb(len + skb_pad, GFP_ATOMIC);
-   if (likely(skb != NULL)) {
-   skb_reserve(skb, skb_pad);
-   skb_put(skb, len);
-   pci_dma_sync_single_for_cpu(pdev,
-   pci_unmap_addr(ce, dma_addr),
-   pci_unmap_len(ce, dma_len),
-   PCI_DMA_FROMDEVICE);
-   memcpy(skb-data, ce-skb-data + dma_pad, len);
-   pci_dma_sync_single_for_device(pdev,
+   if (len  copybreak) {
+   skb = alloc_skb(len + 2, GFP_ATOMIC);
+   if (!skb)
+   goto use_orig_buf;
+
+   skb_reserve(skb, 2);/* align IP header */
  

Please use NET_IP_ALIGN here:



Wrong, NET_IP_ALIGN is intended to deal with platforms where alignment of DMA 
is more
important of alignment of structures.  Therefore if data is copied, it should
always be 2.

  

+   skb = alloc_skb(len + NET_IP_ALIGN, GFP_ATOMIC);
+   if (!skb)
+   goto use_orig_buf;
+
+   skb_reserve(skb, NET_IP_ALIGN);



+   skb_put(skb, len);
+   pci_dma_sync_single_for_cpu(pdev,
pci_unmap_addr(ce, dma_addr),
pci_unmap_len(ce, dma_len),
PCI_DMA_FROMDEVICE);
-   } else if (!drop_thres)
-   goto use_orig_buf;
-
+   memcpy(skb-data, ce-skb-data, len);
+   pci_dma_sync_single_for_device(pdev,
+  pci_unmap_addr(ce, dma_addr),
+  pci_unmap_len(ce, dma_len),
+  PCI_DMA_FROMDEVICE);
recycle_fl_buf(fl, fl-cidx);
return skb;
}
 
-	if (fl-credits  drop_thres) {

+use_orig_buf:
+   if (fl-credits  2) {
  

Why 2? What does this magic number mean?



No idea, it was there in the original. (as a parameter).

  
The T2 HW behaves nicely when it is guaranteed to have 2 available 
entries in the rx free list.


Cheers,
Divy
-
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: Question on advanced routing and/or virtual routers.

2007-01-09 Thread Ben Greear

Brendan Cully wrote:


I started something like this a while ago (posted at
[EMAIL PROTECTED] with a couple of replies
by Thomas Graf, but I can't seem to find it in the archives) but then
dropped the ball. It seems to work fairly well with a one-line kernel
patch to allow route lookup before the local address check. Oh, and I
didn't get traceroute working quite right either - I think there was
some trick to finding the source address for the generated reply.

I've got some info and code here: http://dsg.cs.ubc.ca/~brendan/remus/


Thanks for the pointers!

I took a look at this, and I think I'm starting to understand it.
But, I am not sure why the patch is needed.  I was thinking that something
like this should cause packets entering a particular interface to use
a particular routing table.  However, this does not seem to work for me
(without the patch).  I have yet to try with the patch.

I'm using my re-direct device patch, which is a pair of network devices
that act like two ethernet interfaces connected with a cross-over cable.
So, when you tx on A, the pkt is RX'd on B.

I am trying to set up two 'routers':

router 1001:
 rddA2:  10.0.3.1/24  -- connects to rddA1, which is in router 2
 rddC1:  10.0.4.1/24  -- connects to rest of world...unused currently

router 1002:
 rddA1:  10.0.3.2/24  -- connects to rddA2 in router 1
 rddB1:  10.0.2.1/24  -- connects to private network...unused currently


I want any packets received on the rddA1 and rddB1 interfaces to use routing 
table 1002,
and those received on rddA2 and rddC1 to use routing table 1001.

It appears that the ping-response packets are using the local table,
so matching by incoming device does not appear to be working as I expected.
The ping requests are going out the right interface, so I think that matching
on source IP addr is working.

My ip route related commands:

ip ru del from 10.0.3.1 lookup 1001
ip ru del from 0/0 lookup 1001
ip ru del from 10.0.4.1 lookup 1001
ip ru del from 0/0 lookup 1001
ip ru del from 10.0.2.1 lookup 1002
ip ru del from 0/0 lookup 1002
ip ru del from 10.0.3.2 lookup 1002
ip ru del from 0/0 lookup 1002
ip link set rddC1 down
ip link set rddC1 up
ip addr flush dev rddC1
ip addr add 10.0.4.1/24 broadcast 10.0.4.255 dev rddC1
ip rule add iif rddC1 lookup 1001
ip rule add from 10.0.4.1/32 table 1001
ip route add 10.0.4.0/24 via 10.0.4.2 table 1001
ip link set rddA2 down
ip link set rddA2 up
ip addr flush dev rddA2
ip addr add 10.0.3.1/24 broadcast 10.0.3.255 dev rddA2
ip rule add iif rddA2 lookup 1001
ip rule add from 10.0.3.1/32 table 1001
ip route add 10.0.3.0/24 via 10.0.3.2 table 1001
ip link set rddA1 down
ip link set rddA1 up
ip addr flush dev rddA1
ip addr add 10.0.3.2/24 broadcast 10.0.3.255 dev rddA1
ip rule add iif rddA1 lookup 1002
ip rule add from 10.0.3.2/32 table 1002
ip route add 10.0.3.0/24 via 10.0.3.1 table 1002
ip link set rddB1 down
ip link set rddB1 up
ip addr flush dev rddB1
ip addr add 10.0.2.1/24 broadcast 10.0.2.255 dev rddB1
ip rule add iif rddB1 lookup 1002
ip rule add from 10.0.2.1/32 table 1002
ip route add 10.0.2.0/24 via 10.0.2.2 table 1002
[EMAIL PROTECTED] ~]# ping -I 10.0.3.1 10.0.3.2
PING 10.0.3.2 (10.0.3.2) from 10.0.3.1 : 56(84) bytes of data.
64 bytes from 10.0.3.2: icmp_seq=1 ttl=64 time=0.079 ms
64 bytes from 10.0.3.2: icmp_seq=2 ttl=64 time=0.062 ms
64 bytes from 10.0.3.2: icmp_seq=3 ttl=64 time=0.065 ms
64 bytes from 10.0.3.2: icmp_seq=4 ttl=64 time=0.062 ms

rddA2 Link encap:Ethernet  HWaddr 00:19:DC:3A:39:50
  inet addr:10.0.3.1  Bcast:10.0.3.255  Mask:255.255.255.0
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:1 errors:0 dropped:0 overruns:0 frame:0
  TX packets:45 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  RX bytes:42 (42.0 b)  TX bytes:4186 (4.0 KiB)

[EMAIL PROTECTED] ~]# ifconfig rddA1
rddA1 Link encap:Ethernet  HWaddr 00:62:D5:12:AF:31
  inet addr:10.0.3.2  Bcast:10.0.3.255  Mask:255.255.255.0
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:45 errors:0 dropped:0 overruns:0 frame:0
  TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  RX bytes:4186 (4.0 KiB)  TX bytes:42 (42.0 b)


For other's benefit, here is the patch suggested by Mr. Cully:


--- net/ipv4/fib_rules.c.orig   2005-08-02 16:19:50.441632971 -0700
+++ net/ipv4/fib_rules.c2005-08-02 16:20:06.844088253 -0700
@@ -94,6 +94,7 @@
 static struct fib_rule local_rule = {
.r_next =   main_rule,
.r_clntref =ATOMIC_INIT(2),
+   .r_preference = 0x100,
.r_table =  RT_TABLE_LOCAL,
.r_action = RTN_UNICAST,
 };


Thanks,
Ben


--
Ben Greear [EMAIL PROTECTED]
Candela Technologies Inc  http://www.candelatech.com

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

[PACKET]: Add PACKET_AUXDATA cmsg

2007-01-09 Thread Herbert Xu
Hi Dave:

[PACKET]: Add optional checksum computation for recvmsg

This patch is needed to make ISC's DHCP server (and probably other
DHCP servers/clients using AF_PACKET) to be able to serve another
client on the same Xen host.

The problem is that packets between different domains on the same
Xen host only have partial checksums.  Unfortunately this piece of
information is not passed along in AF_PACKET unless you're using
the mmap interface.  Since dhcpd doesn't support packet-mmap, UDP
packets from the same host come out with apparently bogus checksums.

This patch adds a mechanism for AF_PACKET recvmsg(2) to return the
status along with the packet.  It does so by adding a new cmsg that
contains this information along with some other relevant data such
as the original packet length.

I didn't include the time stamp information since there is already
a cmsg for that.

This patch also changes the mmap code to set the CSUMNOTREADY flag
on all packets instead of just outoing packets on cooked sockets.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]

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
--
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 99393ef..f3de05c 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -41,6 +41,7 @@ struct sockaddr_ll
 #define PACKET_RX_RING 5
 #define PACKET_STATISTICS  6
 #define PACKET_COPY_THRESH 7
+#define PACKET_AUXDATA 8
 
 struct tpacket_stats
 {
@@ -48,6 +49,15 @@ struct tpacket_stats
unsigned inttp_drops;
 };
 
+struct tpacket_auxdata
+{
+   __u32   tp_status;
+   __u32   tp_len;
+   __u32   tp_snaplen;
+   __u16   tp_mac;
+   __u16   tp_net;
+};
+
 struct tpacket_hdr
 {
unsigned long   tp_status;
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index da73e8a..dab117e 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -200,7 +200,8 @@ struct packet_sock {
 #endif
struct packet_type  prot_hook;
spinlock_t  bind_lock;
-   charrunning;/* prot_hook is attached*/
+   unsigned intrunning:1,  /* prot_hook is attached*/
+   auxdata:1;
int ifindex;/* bound device */
__be16  num;
 #ifdef CONFIG_PACKET_MULTICAST
@@ -214,6 +215,8 @@ struct packet_sock {
 #endif
 };
 
+#define PACKET_SKB_CB(__skb)   ((struct tpacket_auxdata *)((__skb)-cb))
+
 #ifdef CONFIG_PACKET_MMAP
 
 static inline char *packet_lookup_frame(struct packet_sock *po, unsigned int 
position)
@@ -468,6 +471,7 @@ static int packet_rcv(struct sk_buff *skb, struct 
net_device *dev, struct packet
u8 * skb_head = skb-data;
int skb_len = skb-len;
unsigned snaplen;
+   struct tpacket_auxdata *aux;
 
if (skb-pkt_type == PACKET_LOOPBACK)
goto drop;
@@ -526,6 +530,15 @@ static int packet_rcv(struct sk_buff *skb, struct 
net_device *dev, struct packet
if (dev-hard_header_parse)
sll-sll_halen = dev-hard_header_parse(skb, sll-sll_addr);
 
+   aux = PACKET_SKB_CB(skb);
+   aux-tp_status = TP_STATUS_USER;
+   if (skb-ip_summed == CHECKSUM_PARTIAL)
+   aux-tp_status |= TP_STATUS_CSUMNOTREADY;
+   aux-tp_len = skb-len;
+   aux-tp_snaplen = snaplen;
+   aux-tp_mac = 0;
+   aux-tp_net = skb-nh.raw - skb-data;
+
if (pskb_trim(skb, snaplen))
goto drop_n_acct;
 
@@ -585,11 +598,12 @@ static int tpacket_rcv(struct sk_buff *skb, struct 
net_device *dev, struct packe
else if (skb-pkt_type == PACKET_OUTGOING) {
/* Special case: outgoing packets have ll header at 
head */
skb_pull(skb, skb-nh.raw - skb-data);
-   if (skb-ip_summed == CHECKSUM_PARTIAL)
-   status |= TP_STATUS_CSUMNOTREADY;
}
}
 
+   if (skb-ip_summed == CHECKSUM_PARTIAL)
+   status |= TP_STATUS_CSUMNOTREADY;
+
snaplen = skb-len;
 
if (run_filter(skb, sk, snaplen)  0)
@@ -1119,6 +1133,11 @@ static int packet_recvmsg(struct kiocb *iocb, struct 
socket *sock,
if (msg-msg_name)
memcpy(msg-msg_name, skb-cb, msg-msg_namelen);
 
+   if (pkt_sk(sk)-auxdata) {
+   struct tpacket_auxdata *aux = PACKET_SKB_CB(skb);
+   put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(*aux), aux);
+   }
+
/*
 *  Free or return the buffer as appropriate. Again this
 *  hides all the races and re-entrancy issues from us.
@@ -1317,6 +1336,7 @@ static int
 packet_setsockopt(struct 

Re: [PATCH] Re: [BUG KERNEL 2.6.20-rc1] ftp: get or put stops during file-transfer

2007-01-09 Thread David Miller
From: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Date: Tue, 09 Jan 2007 14:22:44 +0900 (JST)

 Dave, please apply.  Thank you.
 
 In article [EMAIL PROTECTED] (at Tue, 9 Jan 2007 07:11:39 +0200), Craig 
 Schlenter [EMAIL PROTECTED] says:
 
  All credit goes to Komuro [EMAIL PROTECTED] for tracking
  this down. The patch is untested but it looks *cough* obviously
  correct.
  
  Signed-off-by: Craig Schlenter [EMAIL PROTECTED]
 Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

Applied, thanks everyone.
-
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 patches, updated] net driver fixes

2007-01-09 Thread Jeff Garzik

[resend; updated with a few more bug fixes, since yesterday]

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus

to receive the following updates:

 drivers/net/chelsio/my3126.c|5 +-
 drivers/net/e1000/e1000_main.c  |6 -
 drivers/net/forcedeth.c |  111 ++--
 drivers/net/ixgb/ixgb.h |1 +
 drivers/net/ixgb/ixgb_ethtool.c |1 +
 drivers/net/ixgb/ixgb_hw.c  |3 +-
 drivers/net/ixgb/ixgb_main.c|   57 +-
 drivers/net/pcmcia/pcnet_cs.c   |2 +
 drivers/net/qla3xxx.c   |   38 ---
 drivers/net/wireless/ipw2100.c  |2 +-
 drivers/s390/net/Kconfig|5 +-
 drivers/s390/net/qeth.h |2 +-
 drivers/s390/net/qeth_main.c|  217 +--
 include/net/ieee80211.h |2 +-
 14 files changed, 236 insertions(+), 216 deletions(-)

Aaron Salter (1):
  ixgb: Write RA register high word first, increment version

Ayaz Abdulla (1):
  forcedeth: sideband management fix

Frank Blaschka (3):
  s390: qeth driver fixes: VLAN hdr, perf stats
  s390: qeth driver fixes: packet socket
  s390: qeth driver fixes: atomic context fixups

Frank Pavlic (1):
  s390: iucv Kconfig help description changes

Heiko Carstens (1):
  qeth: fix uaccess handling and get rid of unused variable

Jeff Garzik (1):
  Revert e1000: disable TSO on the 82544 with slab debugging

Jesse Brandeburg (2):
  ixgb: Fix early TSO completion
  ixgb: Maybe stop TX if not enough free descriptors

Komuro (1):
  pcnet_cs : add new id

Ron Mercer (2):
  qla3xxx: Remove NETIF_F_LLTX from driver features.
  qla3xxx: Add delay to NVRAM register access.

Stephen Hemminger (1):
  chelsio: error path fix

Zhu Yi (2):
  ieee80211: WLAN_GET_SEQ_SEQ fix (select correct region)
  ipw2100: Fix dropping fragmented small packet problem

diff --git a/drivers/net/chelsio/my3126.c b/drivers/net/chelsio/my3126.c
index c7731b6..82fed1d 100644
--- a/drivers/net/chelsio/my3126.c
+++ b/drivers/net/chelsio/my3126.c
@@ -170,9 +170,10 @@ static struct cphy *my3126_phy_create(adapter_t *adapter,
 {
struct cphy *cphy = kzalloc(sizeof (*cphy), GFP_KERNEL);
 
-   if (cphy)
-   cphy_init(cphy, adapter, phy_addr, my3126_ops, mdio_ops);
+   if (!cphy)
+   return NULL;
 
+   cphy_init(cphy, adapter, phy_addr, my3126_ops, mdio_ops);
INIT_DELAYED_WORK(cphy-phy_update, my3216_poll);
cphy-bmsr = 0;
 
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4c1ff75..c6259c7 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -995,12 +995,6 @@ e1000_probe(struct pci_dev *pdev,
   (adapter-hw.mac_type != e1000_82547))
netdev-features |= NETIF_F_TSO;
 
-#ifdef CONFIG_DEBUG_SLAB
-   /* 82544's work arounds do not play nicely with DEBUG SLAB */
-   if (adapter-hw.mac_type == e1000_82544)
-   netdev-features = ~NETIF_F_TSO;
-#endif
-
 #ifdef NETIF_F_TSO6
if (adapter-hw.mac_type  e1000_82547_rev_2)
netdev-features |= NETIF_F_TSO6;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 2f48fe9..93f2b7a 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -234,6 +234,7 @@ enum {
 #define NVREG_XMITCTL_HOST_SEMA_MASK   0xf000
 #define NVREG_XMITCTL_HOST_SEMA_ACQ0xf000
 #define NVREG_XMITCTL_HOST_LOADED  0x4000
+#define NVREG_XMITCTL_TX_PATH_EN   0x0100
NvRegTransmitterStatus = 0x088,
 #define NVREG_XMITSTAT_BUSY0x01
 
@@ -249,6 +250,7 @@ enum {
 #define NVREG_OFFLOAD_NORMAL   RX_NIC_BUFSIZE
NvRegReceiverControl = 0x094,
 #define NVREG_RCVCTL_START 0x01
+#define NVREG_RCVCTL_RX_PATH_EN0x0100
NvRegReceiverStatus = 0x98,
 #define NVREG_RCVSTAT_BUSY 0x01
 
@@ -1169,16 +1171,21 @@ static void nv_start_rx(struct net_device *dev)
 {
struct fe_priv *np = netdev_priv(dev);
u8 __iomem *base = get_hwbase(dev);
+   u32 rx_ctrl = readl(base + NvRegReceiverControl);
 
dprintk(KERN_DEBUG %s: nv_start_rx\n, dev-name);
/* Already running? Stop it. */
-   if (readl(base + NvRegReceiverControl)  NVREG_RCVCTL_START) {
-   writel(0, base + NvRegReceiverControl);
+   if ((readl(base + NvRegReceiverControl)  NVREG_RCVCTL_START)  
!np-mac_in_use) {
+   rx_ctrl = ~NVREG_RCVCTL_START;
+   writel(rx_ctrl, base + NvRegReceiverControl);
pci_push(base);
}
writel(np-linkspeed, base + NvRegLinkSpeed);
pci_push(base);
-   writel(NVREG_RCVCTL_START, base + NvRegReceiverControl);
+rx_ctrl |= NVREG_RCVCTL_START;
+if (np-mac_in_use)
+   rx_ctrl = ~NVREG_RCVCTL_RX_PATH_EN;
+   writel(rx_ctrl, base + NvRegReceiverControl);

Re: [PATCH 1/10] cxgb3 - main header files

2007-01-09 Thread Divy Le Ray

Jeff Garzik wrote:

Divy Le Ray wrote:

From: Divy Le Ray [EMAIL PROTECTED]

This patch implements the main header files of
the Chelsio T3 network driver.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]


Once you think it's ready, email me a URL to a single patch that adds 
the driver to the latest linux-2.6.git kernel.  Include in the email a 
description of the driver and signed-off-by line, which will get 
directly included in the git changelog.


Adding new drivers is a bit special, because we want to merge it as a 
single changeset, but that would create a patch too large to review on 
the common kernel mailing lists.

Jeff,

You can grab the monolithic patch at this URL:
http://service.chelsio.com/kernel.org/cxgb3.patch.bz2

This patch adds support for the latest 1G/10G Chelsio adapter, T3.
It is required by the T3 RDMA driver Steve Wise submitted.

Here is a brief description of its content:

drivers/net/cxgb3/adapter.h,
drivers/net/cxgb3/common.h,
drivers/net/cxgb3/cxgb3_ioctl.h,
drivers/net/cxgb3/firmware_exports.h:
   main header files

drivers/net/cxgb3/cxgb3_main.c
   main source file

drivers/net/cxgb3/t3_hw.c
   HW access routines

drivers/net/cxgb3/sge.c,
drivers/net/cxgb3/sge_defs.h
   scatter/gather engine

drivers/net/cxgb3/ael1002.c,
drivers/net/cxgb3/mc5.c,
drivers/net/cxgb3/vsc8211.c,
drivers/net/cxgb3/xgmac.c
   on board memory, MAC and PHY management

drivers/net/cxgb3/cxgb3_ctl_defs.h,
drivers/net/cxgb3/cxgb3_defs.h,
drivers/net/cxgb3/cxgb3_offload.h,
drivers/net/cxgb3/l2t.h, drivers/net/cxgb3/t3_cpl.h,
drivers/net/cxgb3/t3cdev.h
   offload operations header files

drivers/net/cxgb3/cxgb3_offload.c,
drivers/net/cxgb3/l2t.c
   offload capabilities

drivers/net/cxgb3/regs.h
   register definitions

drivers/net/Kconfig
drivers/net/Makefile
drivers/net/cxgb3/Makefile
drivers/net/cxgb3/version.h
   build files and versioning

Signed-off-by: Divy Le Ray [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: [git patches, updated] net driver fixes

2007-01-09 Thread Josef Sipek
On Tue, Jan 09, 2007 at 04:50:59AM -0500, Jeff Garzik wrote:
...
 diff --git a/drivers/net/chelsio/my3126.c b/drivers/net/chelsio/my3126.c
 index c7731b6..82fed1d 100644
 --- a/drivers/net/chelsio/my3126.c
 +++ b/drivers/net/chelsio/my3126.c
 @@ -170,9 +170,10 @@ static struct cphy *my3126_phy_create(adapter_t *adapter,
  {
   struct cphy *cphy = kzalloc(sizeof (*cphy), GFP_KERNEL);
  
 - if (cphy)
 - cphy_init(cphy, adapter, phy_addr, my3126_ops, mdio_ops);
 + if (!cphy)
 + return NULL;
  
 + cphy_init(cphy, adapter, phy_addr, my3126_ops, mdio_ops);
   INIT_DELAYED_WORK(cphy-phy_update, my3216_poll);
   cphy-bmsr = 0;
  
 diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
 index 4c1ff75..c6259c7 100644
 --- a/drivers/net/e1000/e1000_main.c
 +++ b/drivers/net/e1000/e1000_main.c
 @@ -995,12 +995,6 @@ e1000_probe(struct pci_dev *pdev,
  (adapter-hw.mac_type != e1000_82547))
   netdev-features |= NETIF_F_TSO;
  
 -#ifdef CONFIG_DEBUG_SLAB
 - /* 82544's work arounds do not play nicely with DEBUG SLAB */
 - if (adapter-hw.mac_type == e1000_82544)
 - netdev-features = ~NETIF_F_TSO;
 -#endif
 -
  #ifdef NETIF_F_TSO6
   if (adapter-hw.mac_type  e1000_82547_rev_2)
   netdev-features |= NETIF_F_TSO6;
 diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
 index 2f48fe9..93f2b7a 100644
 --- a/drivers/net/forcedeth.c
 +++ b/drivers/net/forcedeth.c
 @@ -234,6 +234,7 @@ enum {
  #define NVREG_XMITCTL_HOST_SEMA_MASK 0xf000
  #define NVREG_XMITCTL_HOST_SEMA_ACQ  0xf000
  #define NVREG_XMITCTL_HOST_LOADED0x4000
 +#define NVREG_XMITCTL_TX_PATH_EN 0x0100
   NvRegTransmitterStatus = 0x088,
  #define NVREG_XMITSTAT_BUSY  0x01
  
 @@ -249,6 +250,7 @@ enum {
  #define NVREG_OFFLOAD_NORMAL RX_NIC_BUFSIZE
   NvRegReceiverControl = 0x094,
  #define NVREG_RCVCTL_START   0x01
 +#define NVREG_RCVCTL_RX_PATH_EN  0x0100
   NvRegReceiverStatus = 0x98,
  #define NVREG_RCVSTAT_BUSY   0x01
  
 @@ -1169,16 +1171,21 @@ static void nv_start_rx(struct net_device *dev)
  {
   struct fe_priv *np = netdev_priv(dev);
   u8 __iomem *base = get_hwbase(dev);
 + u32 rx_ctrl = readl(base + NvRegReceiverControl);
  
   dprintk(KERN_DEBUG %s: nv_start_rx\n, dev-name);
   /* Already running? Stop it. */
 - if (readl(base + NvRegReceiverControl)  NVREG_RCVCTL_START) {
 - writel(0, base + NvRegReceiverControl);
 + if ((readl(base + NvRegReceiverControl)  NVREG_RCVCTL_START)  
 !np-mac_in_use) {
 + rx_ctrl = ~NVREG_RCVCTL_START;
 + writel(rx_ctrl, base + NvRegReceiverControl);
   pci_push(base);
   }
   writel(np-linkspeed, base + NvRegLinkSpeed);
   pci_push(base);
 - writel(NVREG_RCVCTL_START, base + NvRegReceiverControl);
 +rx_ctrl |= NVREG_RCVCTL_START;
 +if (np-mac_in_use)
 + rx_ctrl = ~NVREG_RCVCTL_RX_PATH_EN;
 + writel(rx_ctrl, base + NvRegReceiverControl);
   dprintk(KERN_DEBUG %s: nv_start_rx to duplex %d, speed 0x%08x.\n,
   dev-name, np-duplex, np-linkspeed);
   pci_push(base);

Bad indentation.

 --- a/drivers/net/ixgb/ixgb_main.c
 +++ b/drivers/net/ixgb/ixgb_main.c
...
 @@ -1324,6 +1330,13 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct 
 sk_buff *skb,
   while(len) {
   buffer_info = tx_ring-buffer_info[i];
   size = min(len, IXGB_MAX_DATA_PER_TXD);
 +
 + /* Workaround for premature desc write-backs
 +  * in TSO mode.  Append 4-byte sentinel desc */
 + if (unlikely(mss  !nr_frags  size == len
 +   size  8))
 + size -= 4;
 +

The condition could be on one line.

   buffer_info-length = size;
   buffer_info-dma =
   pci_map_page(adapter-pdev,
 @@ -1398,11 +1411,43 @@ ixgb_tx_queue(struct ixgb_adapter *adapter, int 
 count, int vlan_id,int tx_flags)
   IXGB_WRITE_REG(adapter-hw, TDT, i);
  }
  
 +static int __ixgb_maybe_stop_tx(struct net_device *netdev, int size)
 +{
 + struct ixgb_adapter *adapter = netdev_priv(netdev);
 + struct ixgb_desc_ring *tx_ring = adapter-tx_ring;
 +
 + netif_stop_queue(netdev);
 + /* Herbert's original patch had:
 +  *  smp_mb__after_netif_stop_queue();
 +  * but since that doesn't exist yet, just open code it. */
 + smp_mb();
 +
 + /* We need to check again in a case another CPU has just
 +  * made room available. */
 + if (likely(IXGB_DESC_UNUSED(tx_ring)  size))
 + return -EBUSY;
 +
 + /* A reprieve! */
 + netif_start_queue(netdev);
 + ++adapter-restart_queue;
 + return 0;
 +}
 +
 +static int ixgb_maybe_stop_tx(struct net_device *netdev,
 +  

Re: [PATCH 1/10] cxgb3 - main header files

2007-01-09 Thread Jeff Garzik

Divy Le Ray wrote:

Jeff Garzik wrote:

Divy Le Ray wrote:

From: Divy Le Ray [EMAIL PROTECTED]

This patch implements the main header files of
the Chelsio T3 network driver.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]


Once you think it's ready, email me a URL to a single patch that adds 
the driver to the latest linux-2.6.git kernel.  Include in the email a 
description of the driver and signed-off-by line, which will get 
directly included in the git changelog.


Adding new drivers is a bit special, because we want to merge it as a 
single changeset, but that would create a patch too large to review on 
the common kernel mailing lists.

Jeff,

You can grab the monolithic patch at this URL:
http://service.chelsio.com/kernel.org/cxgb3.patch.bz2


this is in my queue, thanks.  Sorry I didn't indicate that earlier.

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: [BUG KERNEL 2.6.20-rc1] ftp: get or put stops during file-transfer

2007-01-09 Thread Komuro
On Thu, 4 Jan 2007 14:23:30 +0200
Craig Schlenter [EMAIL PROTECTED] wrote:


  --- linux-2.6.20-rc3/net/ipv4/tcp_ipv4.c.orig   2007-01-03 
  11:50:04.0 +0900
  +++ linux-2.6.20-rc3/net/ipv4/tcp_ipv4.c2007-01-03 15:30:44.0 
  +0900
  @@ -648,7 +648,7 @@ static void tcp_v4_send_ack(struct tcp_t
 TCPOLEN_TIMESTAMP);
  rep.opt[1] = htonl(tcp_time_stamp);
  rep.opt[2] = htonl(ts);
  -   arg.iov[0].iov_len = TCPOLEN_TSTAMP_ALIGNED;
  +   arg.iov[0].iov_len = sizeof(rep);
 
 Perhaps this was supposed to be
 arg.iov[0].iov_len += TCPOLEN_TSTAMP_ALIGNED;
 
 That's what the ipv6 stuff does in places.

It works properly.
Thanks!


Best Regards
Komuro

-
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/10] cxgb3 - main header files

2007-01-09 Thread Roland Dreier
   You can grab the monolithic patch at this URL:
   http://service.chelsio.com/kernel.org/cxgb3.patch.bz2
  
  this is in my queue, thanks.  Sorry I didn't indicate that earlier.

When do you plan to merge it?  For 2.6.20 or .21?

I'm trying to understand when the RDMA stuff that depends on the
ethernet driver can be merged.

Thanks,
  Roland
-
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/10] cxgb3 - main header files

2007-01-09 Thread Jeff Garzik

Roland Dreier wrote:

   You can grab the monolithic patch at this URL:
   http://service.chelsio.com/kernel.org/cxgb3.patch.bz2
  
  this is in my queue, thanks.  Sorry I didn't indicate that earlier.


When do you plan to merge it?  For 2.6.20 or .21?


The time for adding new stuff to 2.6.20 is /long/ past.  We stop adding 
things like new drivers when Linus releases 2.6.X-rc1.


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 1/10] cxgb3 - main header files

2007-01-09 Thread Roland Dreier
  The time for adding new stuff to 2.6.20 is /long/ past.  We stop
  adding things like new drivers when Linus releases 2.6.X-rc1.

Well, in the past I think new drivers have been added after the merge
window, given that there's no chance of regressions (old kernel == no
support for device X, so even if the new driver is buggy it's no worse
than the old kernel).  (eg a quick git scan shows commit 0f64478c
added a USB driver between 2.6.19-rc2 and 2.6.19-rc3, and I'm sure you
can find lots of other examples)

Anyway, you answered my question.  I wasn't pushing to include the
driver now, I just wanted to know what you were planning to do.

Thanks.

 - R.
-
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 -MM] e1000: rewrite hardware initialization code

2007-01-09 Thread Auke Kok


Andrew, All,

This patch contains a major rewrite to the e1000 driver that groups and separates e1000 
hardware by chipset family. It abstracts the hardware specific code into an API that 
will allow us to continue to maintain the complex e1000 driver and add new hardware 
support to it without touching code that affects older chipsets. It de-complexifies a 
significant part of the e1000 driver.


This is the first and largest part of e1000 changes that have been long overdue. Thanks 
to Jeb Cramer working on this, as well as our validation team, this code is getting 
ready for general consumption. We hope to get started on adding a better way of handling 
feature flags and workarounds to the complex e1000 driver quickly.


We're submitting this code to -mm for obvious reasons: we are still testing the code and 
want the community feedback on this large change, while giving the linux community an 
early chance to test and use the new driver before it goes mainstream.


The patch addresses the following issues:

* separates hardware-specific code by chipset family and provides a single API for all 
chipsets (effectively a lib-e1000)

* maintains a single driver for the user, no external changes
* will allow the user in the future to select specific hardware support instead 
of all

Some cosmetic changes were also made. This driver adds more header and code files to 
separate the new parts of the code (chipsets, api, nvm, mac  phy layers). All 
whitespace was changed to linux indentation and integer data types were converted to 
{u,s}{8,16,32,64} types instead of uintNN_t types.


The total size of the patch is 1.2mb plaintext, and too large to post to any of the 
lists. I've provided several ways of receiving the patch:


(1)
git-pull git://lost.foo-projects.org/~ahkok/git/linux-2.6 e1000

The patch here applies against 2.6.20-rc3-mm1.

(2)
http://foo-projects.org/~sofar/e1000_hw_init_layer_rewrite.patch (1.2mb)
or
http://foo-projects.org/~sofar/e1000_hw_init_layer_rewrite.patch.bz2  (162k)


I'll gladly e-mail the patch to anyone who wishes to receive it by e-mail.

Andrew, please pull from our git tree listed above to receive the patch. I expect in the 
coming few weeks to provide updates to this patch as issues that come up are resolved.


Cheers,

Auke



---
e1000: rewrite of HW code library

From: Jeb Cramer [EMAIL PROTECTED]

This rewrite of the hardware initialization code splits up the driver
low-level initialization code per chipset family. Several families exist
with different initialization code per chipset, revision, and this allows
us later to select only enable certain devices in the driver. The current
code enables all previous drivers and thus doesn't change anything to the
user, but is radically different internally.

Mac and phy layers are also split, and everything is grouped in an API
layer that the driver uses to interface the hardware.

Support was added for a PCI-e 4-port Fibre version of the PRO/1000 PT quad
port adapter (device 0x10a5). MTU changes on a downed interface require
a phy commit to enact the new size immediately.

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

 drivers/net/e1000/Makefile|   19
 drivers/net/e1000/e1000.h |   95
 drivers/net/e1000/e1000_80003es2lan.c | 1330 +
 drivers/net/e1000/e1000_80003es2lan.h |   89
 drivers/net/e1000/e1000_82540.c   |  586 ++
 drivers/net/e1000/e1000_82541.c   | 1164 
 drivers/net/e1000/e1000_82541.h   |   86
 drivers/net/e1000/e1000_82542.c   |  466 ++
 drivers/net/e1000/e1000_82543.c   | 1397 +
 drivers/net/e1000/e1000_82543.h   |   45
 drivers/net/e1000/e1000_82571.c   | 1132 
 drivers/net/e1000/e1000_82571.h   |   42
 drivers/net/e1000/e1000_api.c | 1077 
 drivers/net/e1000/e1000_api.h |  159 +
 drivers/net/e1000/e1000_defines.h | 1289 +
 drivers/net/e1000/e1000_ethtool.c |  470 +-
 drivers/net/e1000/e1000_hw.c  | 9038 -
 drivers/net/e1000/e1000_hw.h  | 3859 ++
 drivers/net/e1000/e1000_ich8lan.c | 2353 +
 drivers/net/e1000/e1000_ich8lan.h |  108
 drivers/net/e1000/e1000_mac.c | 1921 +++
 drivers/net/e1000/e1000_mac.h |   84
 drivers/net/e1000/e1000_main.c| 1002 ++--
 drivers/net/e1000/e1000_manage.c  |  387 +
 drivers/net/e1000/e1000_manage.h  |   83
 drivers/net/e1000/e1000_nvm.c |  860 +++
 drivers/net/e1000/e1000_nvm.h |   61
 drivers/net/e1000/e1000_osdep.h   |   56
 drivers/net/e1000/e1000_param.c   |  115
 drivers/net/e1000/e1000_phy.c | 1932 +++
 drivers/net/e1000/e1000_phy.h |  157 +
 drivers/net/e1000/e1000_regs.h|  236 +
 32 files changed, 18538 insertions(+), 13160 deletions(-)
-
To unsubscribe from this list: send the line unsubscribe netdev in

Re: [PATCH -MM] e1000: rewrite hardware initialization code

2007-01-09 Thread Stephen Hemminger
On Tue, 09 Jan 2007 09:36:29 -0800
Auke Kok [EMAIL PROTECTED] wrote:

 
 Andrew, All,
 
 This patch contains a major rewrite to the e1000 driver that groups and 
 separates e1000 
 hardware by chipset family. It abstracts the hardware specific code into an 
 API that 
 will allow us to continue to maintain the complex e1000 driver and add new 
 hardware 
 support to it without touching code that affects older chipsets. 

Thats good. but:

   drivers/net/e1000/Makefile|   19
   drivers/net/e1000/e1000.h |   95
   drivers/net/e1000/e1000_80003es2lan.c | 1330 +
   drivers/net/e1000/e1000_80003es2lan.h |   89
   drivers/net/e1000/e1000_82540.c   |  586 ++
   drivers/net/e1000/e1000_82541.c   | 1164 
   drivers/net/e1000/e1000_82541.h   |   86
   drivers/net/e1000/e1000_82542.c   |  466 ++
   drivers/net/e1000/e1000_82543.c   | 1397 +
   drivers/net/e1000/e1000_82543.h   |   45
   drivers/net/e1000/e1000_82571.c   | 1132 
   drivers/net/e1000/e1000_82571.h   |   42
   drivers/net/e1000/e1000_api.c | 1077 
   drivers/net/e1000/e1000_api.h |  159 +
   drivers/net/e1000/e1000_defines.h | 1289 +
   drivers/net/e1000/e1000_ethtool.c |  470 +-
   drivers/net/e1000/e1000_hw.c  | 9038 
 -
   drivers/net/e1000/e1000_hw.h  | 3859 ++
   drivers/net/e1000/e1000_ich8lan.c | 2353 +
   drivers/net/e1000/e1000_ich8lan.h |  108
   drivers/net/e1000/e1000_mac.c | 1921 +++
   drivers/net/e1000/e1000_mac.h |   84
   drivers/net/e1000/e1000_main.c| 1002 ++--
   drivers/net/e1000/e1000_manage.c  |  387 +
   drivers/net/e1000/e1000_manage.h  |   83
   drivers/net/e1000/e1000_nvm.c |  860 +++
   drivers/net/e1000/e1000_nvm.h |   61
   drivers/net/e1000/e1000_osdep.h   |   56
   drivers/net/e1000/e1000_param.c   |  115
   drivers/net/e1000/e1000_phy.c | 1932 +++
   drivers/net/e1000/e1000_phy.h |  157 +
   drivers/net/e1000/e1000_regs.h|  236 +
   32 files changed, 18538 insertions(+), 13160 deletions(-)

Is lots of little files really progress?

-- 
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 -MM] e1000: rewrite hardware initialization code

2007-01-09 Thread Andrew Morton
On Tue, 09 Jan 2007 09:36:29 -0800
Auke Kok [EMAIL PROTECTED] wrote:

  git-pull git://lost.foo-projects.org/~ahkok/git/linux-2.6 e1000

That tree appears to be based on the -mm git tree?

That's a somewhat unusual thing to do - a tree which is based on current
Linus mainline would be preferred, please.  Or on Jeff's netdev tree.

Thanks.
-
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 -MM] e1000: rewrite hardware initialization code

2007-01-09 Thread Auke Kok

Stephen Hemminger wrote:

On Tue, 09 Jan 2007 09:36:29 -0800
Auke Kok [EMAIL PROTECTED] wrote:


Andrew, All,

This patch contains a major rewrite to the e1000 driver that groups and separates e1000 
hardware by chipset family. It abstracts the hardware specific code into an API that 
will allow us to continue to maintain the complex e1000 driver and add new hardware 
support to it without touching code that affects older chipsets. 


Thats good. but:


  drivers/net/e1000/Makefile|   19
  drivers/net/e1000/e1000.h |   95
  drivers/net/e1000/e1000_80003es2lan.c | 1330 +
  drivers/net/e1000/e1000_80003es2lan.h |   89
  drivers/net/e1000/e1000_82540.c   |  586 ++
  drivers/net/e1000/e1000_82541.c   | 1164 
  drivers/net/e1000/e1000_82541.h   |   86
  drivers/net/e1000/e1000_82542.c   |  466 ++
  drivers/net/e1000/e1000_82543.c   | 1397 +
  drivers/net/e1000/e1000_82543.h   |   45
  drivers/net/e1000/e1000_82571.c   | 1132 
  drivers/net/e1000/e1000_82571.h   |   42
  drivers/net/e1000/e1000_api.c | 1077 
  drivers/net/e1000/e1000_api.h |  159 +
  drivers/net/e1000/e1000_defines.h | 1289 +
  drivers/net/e1000/e1000_ethtool.c |  470 +-
  drivers/net/e1000/e1000_hw.c  | 9038 -
  drivers/net/e1000/e1000_hw.h  | 3859 ++
  drivers/net/e1000/e1000_ich8lan.c | 2353 +
  drivers/net/e1000/e1000_ich8lan.h |  108
  drivers/net/e1000/e1000_mac.c | 1921 +++
  drivers/net/e1000/e1000_mac.h |   84
  drivers/net/e1000/e1000_main.c| 1002 ++--
  drivers/net/e1000/e1000_manage.c  |  387 +
  drivers/net/e1000/e1000_manage.h  |   83
  drivers/net/e1000/e1000_nvm.c |  860 +++
  drivers/net/e1000/e1000_nvm.h |   61
  drivers/net/e1000/e1000_osdep.h   |   56
  drivers/net/e1000/e1000_param.c   |  115
  drivers/net/e1000/e1000_phy.c | 1932 +++
  drivers/net/e1000/e1000_phy.h |  157 +
  drivers/net/e1000/e1000_regs.h|  236 +
  32 files changed, 18538 insertions(+), 13160 deletions(-)


Is lots of little files really progress?



I can think of a few files that we could merge myself, but we really wanted to get away 
from the two large (e1000_hw) files that we had, which was far worse.


We're open to suggestions as to reduce the amount of files, but since e1000 has it's own 
subdirectory, and supports a large amount of files, I think we're in the right direction 
with the amount. We approached it this from a rather superfluous amount of files 
standpoint knowing we can merge some later anyway.


One thing we've contemplated ourselves was to merge the smaller .h files into the .c 
files where applicable, so your comment goes duly noted


Thanks,

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 -MM] e1000: rewrite hardware initialization code

2007-01-09 Thread Auke Kok

Andrew Morton wrote:

On Tue, 09 Jan 2007 09:36:29 -0800
Auke Kok [EMAIL PROTECTED] wrote:


 git-pull git://lost.foo-projects.org/~ahkok/git/linux-2.6 e1000


That tree appears to be based on the -mm git tree?

That's a somewhat unusual thing to do - a tree which is based on current
Linus mainline would be preferred, please.  Or on Jeff's netdev tree.


those are not in sync atm, but I'll get you one against Jeff's upstream tree, that'll 
take a minute, or five.


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 -MM] e1000: rewrite hardware initialization code

2007-01-09 Thread Randy Dunlap
On Tue, 09 Jan 2007 20:16:27 +0100 Krzysztof Halasa wrote:

 Auke Kok [EMAIL PROTECTED] writes:
 
   drivers/net/e1000/Makefile|   19
   drivers/net/e1000/e1000.h |   95
   drivers/net/e1000/e1000_80003es2lan.c | 1330 +
   drivers/net/e1000/e1000_80003es2lan.h |   89
   drivers/net/e1000/e1000_82540.c   |  586 ++
   drivers/net/e1000/e1000_82541.c   | 1164 
   drivers/net/e1000/e1000_82541.h   |   86
   drivers/net/e1000/e1000_82542.c   |  466 ++
   drivers/net/e1000/e1000_82543.c   | 1397 +
   drivers/net/e1000/e1000_82543.h   |   45
   drivers/net/e1000/e1000_82571.c   | 1132 
   drivers/net/e1000/e1000_82571.h   |   42
 
 Perhaps the e1000_ prefix could be dropped as redundant?
 -- 

Yes, that suggestion would agree with what Linus told us about
usb file names 7 years ago.  (huh?  that long?)

---
~Randy
-
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


[IPv6] PROBLEM? Network unreachable despite correct route

2007-01-09 Thread Bernhard Schmidt
Hi,

I'm having a really ugly problem I'm trying to pinpoint, but failed so
far. I'm neither completely convinced it is not related to my local
setup(s), nor do I have any clue how this might be caused.

I have several boxes with native IPv6 connectivity at various places.
Some of them show symptoms of a lost default route for small periods of
time (10-15 seconds several times a day). By symptoms I mean

- traceroute6 from the affected box to any other host dies immediately
  (the network unreachable does not come from the first hop (the
  upstream router), but from the local stack itself)

- a local running OpenVPN 2.1_rc1b with UDPv6 transport patched in shows
  the following output in the syslog file

  Tue Jan  9 16:48:28 2007 write UDPv6 []: Network is unreachable
  (code=101)

- mtr from the outside to the machine shows that the affected box does
  not respond anymore, while the hop before (the router) is clean.

- new connects to the box (e.g. ssh) from the outside are stuck (packets
  get lost, since I'm running my client with tcp_retries=1 I get a
  timeout

At the same time, established ssh connections to the box work fine. I
can do ip -6 route and it shows the default route, both preferred and
valid lifetime not exceeded (far from that). 

The systems I'm observing this are:

- Dell PowerEdge 750 (P4 with HT), Debian Etch, self compiled kernel
  2.6.17.11, connected (e1000) to two upstream Cisco 7200, default route
  is learned from RIPng (Quagga), static addresses

- Dell OptiPlex GXsomething (P4 with HT, Single Core), SuSE 10.2,
  distribution kernel 2.6.18.5-3-default, connected (tg3) to one
  upstream Cisco 6500/Sup720, default route learned through stateless
  autoconfiguration (RA)

- self built AMD Athlon64 (x86_64), Ubuntu Edgy, Distribution kernel
  2.6.17-10-generic, connected (forcedeth) to an upstream Linux box
  (2.6.20-rc3), default route learned through stateless
  autoconfiguration (RA) as well.

My current believe is that this is an regression introduced in 2.6.17.
I have searched for several weeks now why box #1 (the PowerEdge) shows
signs of unreachability in the monitoring, but could not find any clue
(or verify any reachability problems when I got the monitoring alert).
At the same time, a sibling (same hardware, same switch, same network
segment, route also learned through Quagga, but different kernel (2.6.16))
of this box did not show any symptoms, so I ruled out the local network.

Also, I upgraded box #2 from SuSE 10.1 (distribution kernel
2.6.16-something) to SuSE 10.2 yesterday. While it was running the
OpenVPN/UDPv6 daemon the whole time, there has been exactly _one_
occurence of the Network is unreachable message in the past two weeks
before the upgrade (and I can correlate this message with network
maintainance where the VPN endpoint was indeed unreachable). Since the
upgrade, I have at least 50 lines of that sort in syslog (in about a
day).

It is pretty hard to trace this. It seems to appear very seldom, it is
not long and I cannot predict the time where it happens by doing more
network load or anything else on that machine. IPv4 is fine and without
loss in all cases. All network components are dual-stacked, so if there
was an L2 issue between the router and the host it would affect IPv4 as
well.

Is anyone aware of any issue which might cause this? I've upgraded the
PowerEdge to 2.6.19.1 now, but it is too early to tell whether this
problem still exists. Does anyone recall a bugreport and maybe a fix for
it? A patch or a link to a changeset would be even better, so I could
report that to SuSE and Ubuntu to have it included in future kernels. 

Thanks,
Bernhard
-
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 -MM] e1000: rewrite hardware initialization code

2007-01-09 Thread Auke Kok

Randy Dunlap wrote:

On Tue, 09 Jan 2007 20:16:27 +0100 Krzysztof Halasa wrote:


Auke Kok [EMAIL PROTECTED] writes:


 drivers/net/e1000/Makefile|   19
 drivers/net/e1000/e1000.h |   95
 drivers/net/e1000/e1000_80003es2lan.c | 1330 +
 drivers/net/e1000/e1000_80003es2lan.h |   89
 drivers/net/e1000/e1000_82540.c   |  586 ++
 drivers/net/e1000/e1000_82541.c   | 1164 
 drivers/net/e1000/e1000_82541.h   |   86
 drivers/net/e1000/e1000_82542.c   |  466 ++
 drivers/net/e1000/e1000_82543.c   | 1397 +
 drivers/net/e1000/e1000_82543.h   |   45
 drivers/net/e1000/e1000_82571.c   | 1132 
 drivers/net/e1000/e1000_82571.h   |   42

Perhaps the e1000_ prefix could be dropped as redundant?
--


Yes, that suggestion would agree with what Linus told us about
usb file names 7 years ago.  (huh?  that long?)



You'll have to excuse me that I don't remember that anymore, but I'll note the 
suggestion and see what the team thinks.


Thanks,

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 -MM] e1000: rewrite hardware initialization code

2007-01-09 Thread Krzysztof Halasa
Auke Kok [EMAIL PROTECTED] writes:

  drivers/net/e1000/Makefile|   19
  drivers/net/e1000/e1000.h |   95
  drivers/net/e1000/e1000_80003es2lan.c | 1330 +
  drivers/net/e1000/e1000_80003es2lan.h |   89
  drivers/net/e1000/e1000_82540.c   |  586 ++
  drivers/net/e1000/e1000_82541.c   | 1164 
  drivers/net/e1000/e1000_82541.h   |   86
  drivers/net/e1000/e1000_82542.c   |  466 ++
  drivers/net/e1000/e1000_82543.c   | 1397 +
  drivers/net/e1000/e1000_82543.h   |   45
  drivers/net/e1000/e1000_82571.c   | 1132 
  drivers/net/e1000/e1000_82571.h   |   42

Perhaps the e1000_ prefix could be dropped as redundant?
-- 
Krzysztof Halasa
-
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 -MM] e1000: rewrite hardware initialization code

2007-01-09 Thread Auke Kok

Andrew Morton wrote:

On Tue, 09 Jan 2007 09:36:29 -0800
Auke Kok [EMAIL PROTECTED] wrote:


 git-pull git://lost.foo-projects.org/~ahkok/git/linux-2.6 e1000


That tree appears to be based on the -mm git tree?

That's a somewhat unusual thing to do - a tree which is based on current
Linus mainline would be preferred, please.  Or on Jeff's netdev tree.



An updated patch is available from git, and applies against netdev-2.6's upstream branch 
(as of commit 77aab8bf22042d1658d4adbca8b71779e7f2d0ff )


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

Again, also available per http:

http://foo-projects.org/~sofar/e1000_hw_init_layer_rewrite-v2-upstream.patch

http://foo-projects.org/~sofar/e1000_hw_init_layer_rewrite-v2-upstream.patch.bz2

This version contains a few minor adjustments and updates to the one posted earlier this 
morning (and replaces that patch):


1) 82541 bitmask issue
2) 80003es2lan timeout value fix
3) added some more kdoc headers to functions
4) removed #ifdef NETIF_F_TSO6 forgotten by cleanup patch

I hope this patch works for everyone, please let me know if there are still 
problems.

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


[PATCH 1/5] fixing errors handling during pci_driver resume stage [net]

2007-01-09 Thread Dmitriy Monakhov
network pci drivers have to return correct error code during resume stage in
case of errors.
Signed-off-by: Dmitriy Monakhov [EMAIL PROTECTED]
-
diff --git a/Makefile b/Makefile
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 80bdcf8..ed06e48 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -823,11 +823,18 @@ static int vortex_resume(struct pci_dev
 {
struct net_device *dev = pci_get_drvdata(pdev);
struct vortex_private *vp = netdev_priv(dev);
+   int err;
 
if (dev  vp) {
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
-   pci_enable_device(pdev);
+   err = pci_enable_device(pdev);
+   if (err) {
+   dev_err(pdev-dev, Cannot enable PCI device, 
+aborting.\n);
+   return err;
+   }
+
pci_set_master(pdev);
if (request_irq(dev-irq, vp-full_bus_master_rx ?
boomerang_interrupt : vortex_interrupt, 
IRQF_SHARED, dev-name, dev)) {
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 5eb2ec6..a88b346 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -2315,16 +2315,25 @@ static int b44_resume(struct pci_dev *pd
 {
struct net_device *dev = pci_get_drvdata(pdev);
struct b44 *bp = netdev_priv(dev);
+   int err;
 
pci_restore_state(pdev);
-   pci_enable_device(pdev);
+   err = pci_enable_device(pdev);
+   if (err) {
+   dev_err(pdev-dev, Cannot enable PCI device, aborting.\n);
+   return err;
+   }
+
pci_set_master(pdev);
 
if (!netif_running(dev))
return 0;
 
-   if (request_irq(dev-irq, b44_interrupt, IRQF_SHARED, dev-name, dev))
+   if (request_irq(dev-irq, b44_interrupt, IRQF_SHARED, dev-name, dev)) {
printk(KERN_ERR PFX %s: request_irq failed\n, dev-name);
+   pci_disable_device(pdev);
+   return -EBUSY;
+   }
 
spin_lock_irq(bp-lock);
 
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index e28bb1e..698f974 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -2292,10 +2292,16 @@ static int eepro100_resume(struct pci_de
struct net_device *dev = pci_get_drvdata (pdev);
struct speedo_private *sp = netdev_priv(dev);
void __iomem *ioaddr = sp-regs;
+   int err;
 
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
-   pci_enable_device(pdev);
+   err = pci_enable_device(pdev);
+   if (err) {
+   dev_err(pdev-dev, Cannot enable PCI device, aborting.\n);
+   return err;
+   }
+
pci_set_master(pdev);
 
if (!netif_running(dev))
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index ffa0afd..57a8f36 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -3195,13 +3195,20 @@ static int natsemi_resume (struct pci_de
 {
struct net_device *dev = pci_get_drvdata (pdev);
struct netdev_private *np = netdev_priv(dev);
+   int err;
 
rtnl_lock();
if (netif_device_present(dev))
goto out;
if (netif_running(dev)) {
BUG_ON(!np-hands_off);
-   pci_enable_device(pdev);
+   err = pci_enable_device(pdev);
+   if (err) {
+   dev_err(pdev-dev, Cannot enable PCI device, 
+   aborting.\n);
+   return err;
+   }
+
/*  pci_power_on(pdev); */
 
natsemi_reset(dev);
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index 589785d..e8aea03 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -670,10 +670,15 @@ static int ne2k_pci_suspend (struct pci_
 static int ne2k_pci_resume (struct pci_dev *pdev)
 {
struct net_device *dev = pci_get_drvdata (pdev);
+   int err;
 
pci_set_power_state(pdev, 0);
pci_restore_state(pdev);
-   pci_enable_device(pdev);
+   err = pci_enable_device(pdev);
+   if (err) {
+   dev_err(pdev-dev, Cannot enable PCI device, aborting.\n);
+   return err;
+   }
NS8390_init(dev, 1);
netif_device_attach(dev);
 
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 92d11b9..c9de11f 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -5125,7 +5125,12 @@ static int skge_resume(struct pci_dev *p
 
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
-   pci_enable_device(pdev);
+   ret = pci_enable_device(pdev);
+   if (ret) {
+   dev_err(pdev-dev, Cannot enable PCI device, aborting.\n);
+   return ret;
+   }
+
pci_set_master(pdev);
if (pAC-GIni.GIMacsFound == 2)
ret = 

[PATCH 2/5] fixing errors handling during pci_driver resume stage [ata]

2007-01-09 Thread Dmitriy Monakhov
ata pci drivers have to return correct error code during resume stage in
case of errors.
Signed-off-by: Dmitriy Monakhov [EMAIL PROTECTED]
-
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index b517d24..0656334 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1372,7 +1372,9 @@ static int ahci_pci_device_resume(struct
void __iomem *mmio = host-mmio_base;
int rc;
 
-   ata_pci_device_do_resume(pdev);
+   rc = ata_pci_device_do_resume(pdev);
+   if (rc)
+   return rc;
 
if (pdev-dev.power.power_state.event == PM_EVENT_SUSPEND) {
rc = ahci_reset_controller(mmio, pdev);
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 0d51d13..3d6729d 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6221,12 +6221,19 @@ void ata_pci_device_do_suspend(struct pc
}
 }
 
-void ata_pci_device_do_resume(struct pci_dev *pdev)
+int ata_pci_device_do_resume(struct pci_dev *pdev)
 {
+   int ret = 0; 
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
-   pci_enable_device(pdev);
+   ret = pci_enable_device(pdev);
+   if (ret) {
+   dev_err(pdev-dev, Cannot enable PCI device, aborting.\n);
+   return ret;
+   }
+   
pci_set_master(pdev);
+   return ret;
 }
 
 int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
@@ -6246,8 +6253,10 @@ int ata_pci_device_suspend(struct pci_de
 int ata_pci_device_resume(struct pci_dev *pdev)
 {
struct ata_host *host = dev_get_drvdata(pdev-dev);
+   int err;
 
-   ata_pci_device_do_resume(pdev);
+   if ((err = ata_pci_device_do_resume(pdev)))
+   return err;
ata_host_resume(host);
return 0;
 }
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 7808d03..8451143 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -710,8 +710,12 @@ err_out:
 static int sil_pci_device_resume(struct pci_dev *pdev)
 {
struct ata_host *host = dev_get_drvdata(pdev-dev);
+   int err;
+
+   err = ata_pci_device_do_resume(pdev);
+   if (err)
+   return err;
 
-   ata_pci_device_do_resume(pdev);
sil_init_controller(pdev, host-n_ports, host-ports[0]-flags,
host-mmio_base);
ata_host_resume(host);
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 5aa288d..be6971a 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1200,8 +1200,11 @@ static int sil24_pci_device_resume(struc
 {
struct ata_host *host = dev_get_drvdata(pdev-dev);
struct sil24_host_priv *hpriv = host-private_data;
+   int err;
 
-   ata_pci_device_do_resume(pdev);
+   err = ata_pci_device_do_resume(pdev);
+   if (err)
+   return err;
 
if (pdev-dev.power.power_state.event == PM_EVENT_SUSPEND)
writel(HOST_CTRL_GLOBAL_RST, hpriv-host_base + HOST_CTRL);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ab27548..283ca72 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -719,7 +719,7 @@ extern int ata_pci_init_one (struct pci_
 unsigned int n_ports);
 extern void ata_pci_remove_one (struct pci_dev *pdev);
 extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
-extern void ata_pci_device_do_resume(struct pci_dev *pdev);
+extern int ata_pci_device_do_resume(struct pci_dev *pdev);
 extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
 extern int ata_pci_device_resume(struct pci_dev *pdev);
 extern int ata_pci_clear_simplex(struct pci_dev *pdev);


[PATCH 3/5] fixing errors handling during pci_driver resume stage [fusion]

2007-01-09 Thread Dmitriy Monakhov
fusion pci drivers have to return correct error code during resume stage in
case of errors.
Signed-off-by: Dmitriy Monakhov [EMAIL PROTECTED]
-
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 6e068cf..51a3621 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1524,7 +1524,7 @@ mpt_resume(struct pci_dev *pdev)
 {
MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
u32 device_state = pdev-current_state;
-   int recovery_state;
+   int recovery_state, err;
 
printk(MYIOC_s_INFO_FMT
pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n,
@@ -1532,7 +1532,11 @@ mpt_resume(struct pci_dev *pdev)
 
pci_set_power_state(pdev, 0);
pci_restore_state(pdev);
-   pci_enable_device(pdev);
+   err = pci_enable_device(pdev);
+   if (err) {
+   dev_err(pdev-dev, Cannot enable PCI device, aborting.\n);
+   return err;
+   }
 
/* enable interrupts */
CHIPREG_WRITE32(ioc-chip-IntMask, MPI_HIM_DIM);
diff --git a/drivers/message/fusion/mptscsih.c 
b/drivers/message/fusion/mptscsih.c
index 2c72c36..5324866 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1120,8 +1120,10 @@ mptscsih_resume(struct pci_dev *pdev)
MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
struct Scsi_Host*host = ioc-sh;
MPT_SCSI_HOST   *hd;
+   int err;
 
-   mpt_resume(pdev);
+   if ((err = mpt_resume(pdev)))
+   return err;
 
if(!host)
return 0;


[PATCH 5/5] fixing errors handling during pci_driver resume stage [serial]

2007-01-09 Thread Dmitriy Monakhov
serial pci drivers have to return correct error code during resume stage in
case of errors.
Signed-off-by: Dmitriy Monakhov [EMAIL PROTECTED]
-
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index 78c0a26..1e14906 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -392,6 +392,7 @@ static int parport_serial_pci_suspend(st
 static int parport_serial_pci_resume(struct pci_dev *dev)
 {
struct parport_serial_private *priv = pci_get_drvdata(dev);
+   int err;
 
pci_set_power_state(dev, PCI_D0);
pci_restore_state(dev);
@@ -399,7 +400,11 @@ static int parport_serial_pci_resume(str
/*
 * The device may have been disabled.  Re-enable it.
 */
-   pci_enable_device(dev);
+   err = pci_enable_device(dev);
+   if (err) {
+   dev_err(dev-dev, Cannot enable PCI device, aborting.\n);
+   return err;
+   }
 
if (priv-serial)
pciserial_resume_ports(priv-serial);
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 52e2e64..e26e4a6 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -1805,6 +1805,7 @@ static int pciserial_suspend_one(struct
 static int pciserial_resume_one(struct pci_dev *dev)
 {
struct serial_private *priv = pci_get_drvdata(dev);
+   int err;
 
pci_set_power_state(dev, PCI_D0);
pci_restore_state(dev);
@@ -1813,7 +1814,12 @@ static int pciserial_resume_one(struct p
/*
 * The device may have been disabled.  Re-enable it.
 */
-   pci_enable_device(dev);
+   err = pci_enable_device(dev);
+   if (err) {
+   dev_err(dev-dev, Cannot enable PCI device, 
+   aborting.\n);
+   return err;
+   }
 
pciserial_resume_ports(priv);
}
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index 7186a82..583cdc8 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -1132,12 +1132,19 @@ static int pciserial_txx9_suspend_one(st
 static int pciserial_txx9_resume_one(struct pci_dev *dev)
 {
int line = (int)(long)pci_get_drvdata(dev);
+   int err;
 
pci_set_power_state(dev, PCI_D0);
pci_restore_state(dev);
 
if (line) {
-   pci_enable_device(dev);
+   err = pci_enable_device(dev);
+   if (err) {
+   dev_err(dev-dev, Cannot enable PCI device, 
+   aborting.\n);
+   return err;
+   }
+
serial_txx9_resume_port(line);
}
return 0;


[PATCH 4/5] fixing errors handling during pci_driver resume stage [misc]

2007-01-09 Thread Dmitriy Monakhov
pci drivers have to return correct error code during resume stage in
case of errors.
Signed-off-by: Dmitriy Monakhov [EMAIL PROTECTED]
-
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index ff80937..a426905 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -394,10 +394,16 @@ static int sc1200_suspend (struct pci_de
 static int sc1200_resume (struct pci_dev *dev)
 {
ide_hwif_t  *hwif = NULL;
+   int err;
 
pci_set_power_state(dev, PCI_D0);   // bring chip back from sleep 
state
dev-current_state = PM_EVENT_ON;
-   pci_enable_device(dev);
+   err = pci_enable_device(dev);
+   if (err) {
+   dev_err(dev-dev, Cannot enable PCI device, aborting.\n);
+   return err;
+   }
+
//
// loop over all interfaces that are part of this pci device:
//
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index 2ab7add..d659ad9 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -274,10 +274,15 @@ static int tifm_7xx1_suspend(struct pci_
 static int tifm_7xx1_resume(struct pci_dev *dev)
 {
struct tifm_adapter *fm = pci_get_drvdata(dev);
-   unsigned long flags;
+   unsigned long flags, err;
 
pci_restore_state(dev);
-pci_enable_device(dev);
+   err = pci_enable_device(dev);
+   if (err) {
+   dev_err(dev-dev, Cannot enable PCI device, aborting.\n);
+   return err;
+   }
+
 pci_set_power_state(dev, PCI_D0);
 pci_set_master(dev);
 
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index c2d13d7..736f74c 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -1109,7 +1109,11 @@ static int sdhci_resume (struct pci_dev
 
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
-   pci_enable_device(pdev);
+   ret = pci_enable_device(pdev);
+   if (ret) {
+   dev_err(pdev-dev, Cannot enable PCI device, aborting.\n);
+   return ret;
+   }
 
for (i = 0;i  chip-num_slots;i++) {
if (!chip-hosts[i])
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index 1fd97f7..4428ffa 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -199,7 +199,8 @@ superio_init(struct pci_dev *pcidev)
pci_write_config_word (pdev, PCI_COMMAND, word);
 
pci_set_master (pdev);
-   pci_enable_device(pdev);
+   if (pci_enable_device(pdev))
+   return;
 
/*
 * Next project is programming the onboard interrupt controllers.
@@ -275,6 +276,7 @@ superio_init(struct pci_dev *pcidev)
SUPERIO, (void *)sio)) {
 
printk(KERN_ERR PFX could not get irq\n);
+   pci_disable_device(pdev);
BUG();
return;
}


Re: [PATCH 5/5] fixing errors handling during pci_driver resume stage [serial]

2007-01-09 Thread Russell King
On Tue, Jan 09, 2007 at 12:01:58PM +0300, Dmitriy Monakhov wrote:
 serial pci drivers have to return correct error code during resume stage in
 case of errors.

Sigh.  *hate* *hate* *hate*.

 diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
 index 52e2e64..e26e4a6 100644
 --- a/drivers/serial/8250_pci.c
 +++ b/drivers/serial/8250_pci.c
 @@ -1805,6 +1805,7 @@ static int pciserial_suspend_one(struct
  static int pciserial_resume_one(struct pci_dev *dev)
  {
   struct serial_private *priv = pci_get_drvdata(dev);
 + int err;
  
   pci_set_power_state(dev, PCI_D0);
   pci_restore_state(dev);
 @@ -1813,7 +1814,12 @@ static int pciserial_resume_one(struct p
   /*
* The device may have been disabled.  Re-enable it.
*/
 - pci_enable_device(dev);
 + err = pci_enable_device(dev);
 + if (err) {
 + dev_err(dev-dev, Cannot enable PCI device, 
 + aborting.\n);
 + return err;
 + }
  
   pciserial_resume_ports(priv);
   }

So if pci_enable_device() fails, what do we do with the still suspended
serial port?  Does it clean up that state?  Probably not.

Look, merely going around bunging this stupid oh lets propagate the
error crap into the kernel doesn't actually fix _anything_.  In fact
it potentially _hides_ the warnings produced by __must_check which
give a hint that _something_ needs to be done to _properly_ fix the
problem.

And by properly, I mean not just merely propagating the error.

In this particular case, the above may result in resources not being
freed.

-- 
Russell King
 Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
-
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/5] fixing errors handling during pci_driver resume stage [serial]

2007-01-09 Thread Dmitriy Monakhov
Russell King [EMAIL PROTECTED] writes:

 On Tue, Jan 09, 2007 at 12:01:58PM +0300, Dmitriy Monakhov wrote:
 serial pci drivers have to return correct error code during resume stage in
 case of errors.

 Sigh.  *hate* *hate* *hate*.

 diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
 index 52e2e64..e26e4a6 100644
 --- a/drivers/serial/8250_pci.c
 +++ b/drivers/serial/8250_pci.c
 @@ -1805,6 +1805,7 @@ static int pciserial_suspend_one(struct
  static int pciserial_resume_one(struct pci_dev *dev)
  {
  struct serial_private *priv = pci_get_drvdata(dev);
 +int err;
  
  pci_set_power_state(dev, PCI_D0);
  pci_restore_state(dev);
 @@ -1813,7 +1814,12 @@ static int pciserial_resume_one(struct p
  /*
   * The device may have been disabled.  Re-enable it.
   */
 -pci_enable_device(dev);
 +err = pci_enable_device(dev);
 +if (err) {
 +dev_err(dev-dev, Cannot enable PCI device, 
 +aborting.\n);
 +return err;
 +}
  
  pciserial_resume_ports(priv);
  }

 So if pci_enable_device() fails, what do we do with the still suspended
 serial port?  Does it clean up that state?  Probably not.

 Look, merely going around bunging this stupid oh lets propagate the
 error crap into the kernel doesn't actually fix _anything_.  In fact
 it potentially _hides_ the warnings produced by __must_check which
 give a hint that _something_ needs to be done to _properly_ fix the
 problem.

 And by properly, I mean not just merely propagating the error.

 In this particular case, the above may result in resources not being
 freed.
Yep 100% true. But the question is _HOW_? We want shutdown not enabled device.
Is it safe just call pciserial_remove_ports() for this device? 

 -- 
 Russell King
  Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
  maintainer of:
 -
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/

-
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/5] fixing errors handling during pci_driver resume stage [net]

2007-01-09 Thread Stephen Hemminger
On Tue, 09 Jan 2007 12:01:14 +0300
Dmitriy Monakhov [EMAIL PROTECTED] wrote:

 network pci drivers have to return correct error code during resume stage in
 case of errors.
 Signed-off-by: Dmitriy Monakhov [EMAIL PROTECTED]
 -

Please don't introduce one dev_err() call into a device driver if all the other
error printout's use a different interface.

-- 
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: [IPv6] PROBLEM? Network unreachable despite correct route

2007-01-09 Thread Bernhard Schmidt
On Tue, Jan 09, 2007 at 08:36:24PM +0100, Bernhard Schmidt wrote:

Hi,

I did some additional testing

 I'm having a really ugly problem I'm trying to pinpoint, but failed so
 far. I'm neither completely convinced it is not related to my local
 setup(s), nor do I have any clue how this might be caused.
[...]
 - Dell OptiPlex GXsomething (P4 with HT, Single Core), SuSE 10.2,
   distribution kernel 2.6.18.5-3-default, connected (tg3) to one
   upstream Cisco 6500/Sup720, default route learned through stateless
   autoconfiguration (RA)

Running tcpdump on this (target) box shows that ICMPv6 echo requests
(which is what mtr sends to the target box) are received by the box, but
not replied to

01:02:09.884692 IP6 2001:a60:f001:1:218:f3ff:fe66:  
2001:4ca0:0:f000:211:43ff:fe7e:: ICMP6, echo request, seq 54173, length 64
01:02:09.884706 IP6 2001:4ca0:0:f000:211:43ff:fe7e:  
2001:a60:f001:1:218:f3ff:fe66:: ICMP6, echo reply, seq 54173, length 64
01:02:10.428063 IP6 2001:a60:f001:1:218:f3ff:fe66:  
2001:4ca0:0:f000:211:43ff:fe7e:: ICMP6, echo request, seq 55453, length 64
01:02:11.056871 IP6 2001:a60:f001:1:218:f3ff:fe66:  
2001:4ca0:0:f000:211:43ff:fe7e:: ICMP6, echo request, seq 56733, length 64
01:02:11.700772 IP6 2001:a60:f001:1:218:f3ff:fe66:  
2001:4ca0:0:f000:211:43ff:fe7e:: ICMP6, echo request, seq 58013, length 64
[...]
01:02:17.301169 IP6 2001:a60:f001:1:218:f3ff:fe66:  
2001:4ca0:0:f000:211:43ff:fe7e:: ICMP6, echo request, seq 3998, length 64
01:02:17.941020 IP6 2001:a60:f001:1:218:f3ff:fe66:  
2001:4ca0:0:f000:211:43ff:fe7e:: ICMP6, echo request, seq 5278, length 64
01:02:18.581037 IP6 2001:a60:f001:1:218:f3ff:fe66:  
2001:4ca0:0:f000:211:43ff:fe7e:: ICMP6, echo request, seq 6558, length 64
01:02:18.581050 IP6 2001:4ca0:0:f000:211:43ff:fe7e:  
2001:a60:f001:1:218:f3ff:fe66:: ICMP6, echo reply, seq 6558, length 64

while this is happening, the SSH session (between the very same hosts) is
perfectly fine. ip6_tables.ko is not loaded, there is no other ICMPv6 packet
(e.g. neighbor solicitation or router advertisement) anywhere near the
beginning of my problem. Incoming TCP SYN (an additional SSH session I
tried to establish when I saw the box was not responding) are also 
visible on the interface, but not answered.

01:18:35.638744 IP6 2001:a60:f001:1:218:f3ff:fe66:.57045  
2001:4ca0:0:f000:211:43ff:fe7e:.22: SWE 1448406153:1448406153(0) win 5760 
mss 1440,sackOK,timestamp 13958554 0,nop,wscale 2
01:18:35.701523 IP6 2001:a60:f001:1:218:f3ff:fe66:  
2001:4ca0:0:f000:211:43ff:fe7e:: ICMP6, echo request, seq 41148, length 64
01:18:36.328728 IP6 2001:a60:f001:1:218:f3ff:fe66:  
2001:4ca0:0:f000:211:43ff:fe7e:: ICMP6, echo request, seq 42428, length 64

I managed to pull ip -6 route, ip -6 neigh and ip -6 addr while the box
was not responding:

ip -6 route:
2001:4ca0:0:f000::/64 dev eth0  proto kernel  metric 256  expires 86322sec mtu 
1500 advmss 1440 fragtimeout 4294967295
fe80::/64 dev eth0  metric 256  expires 21225804sec mtu 1500 advmss 1440 
fragtimeout 4294967295
ff00::/8 dev eth0  metric 256  expires 21225804sec mtu 1500 advmss 1440 
fragtimeout 4294967295
default via fe80::2d0:4ff:fe12:2400 dev eth0  proto kernel  metric 1024  
expires 1717sec mtu 1500 advmss 1440 fragtimeout 64
unreachable default dev lo  proto none  metric -1  error -101 fragtimeout 255

ip -6 neigh:
fe80::2d0:4ff:fe12:2400 dev eth0 lladdr 00:d0:04:12:24:00 router REACHABLE

ip -6 addr:
2: eth0: BROADCAST,MULTICAST,NOTRAILERS,UP,1 mtu 1500 qlen 1000
inet6 2001:4ca0:0:f000:211:43ff:fe7e:/64 scope global dynamic 
   valid_lft 86318sec preferred_lft 14318sec
inet6 fe80::211:43ff:fe7e:/64 scope link 
   valid_lft forever preferred_lft forever

Nothing in dmesg or any file in /var/log (except the notorious Network
is unreachable messages from OpenVPN).

I was wrong before by the way, some outgoing connections from the affected
machine still work, I was able to ping6, traceroute6 and telnet. At least
on this particular machine, I am very sure I have seen Network unreachable
on outgoing connects at some point.

I'll try to downgrade this machine to 2.6.16 (and eventually upgrade to 
2.6.19.1) and have a look whether the problem is gone.

 - Dell PowerEdge 750 (P4 with HT), Debian Etch, self compiled kernel
   2.6.17.11, connected (e1000) to two upstream Cisco 7200, default route
   is learned from RIPng (Quagga), static addresses

Still too soon to be absolutely sure, but I think the problem is gone
since the upgrade to 2.6.19.1.

Regards,
Bernhard
-
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] d80211: Fix __ieee80211_if_del on live interfaces

2007-01-09 Thread Michael Wu
d80211: Fix __ieee80211_if_del on live interfaces

ieee80211_if_reinit is called in __ieee80211_if_del, which clears the
contents of sdata-u. After that, unregister_netdevice is called. If the
interface is still up, unregister_netdevice will end up calling dev-stop,
and dev-stop expects the contents of sdata-u to be valid. Bad things
typically happen at this point.

This patch fixes that by setting dev-uninit to ieee80211_if_reinit and
eliminating the call to ieee80211_if_reinit in __ieee80211_if_del. This
allows ieee80211_if_reinit to be called at a safer time. It also allows
the removal of the call to ieee80211_if_shutdown in ieee80211_if_reinit
because ieee80211_if_reinit now will never be called while the interface
is up.

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

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

diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 964fe45..2f1dce5 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4324,6 +4324,7 @@ void ieee80211_if_setup(struct net_devic
dev-open = ieee80211_open;
dev-stop = ieee80211_stop;
dev-tx_queue_len = 0;
+   dev-uninit = ieee80211_if_reinit;
dev-destructor = ieee80211_if_free;
 }
 
@@ -4338,6 +4339,7 @@ void ieee80211_if_mgmt_setup(struct net_
dev-type = ARPHRD_IEEE80211_PRISM;
dev-hard_header_parse = header_parse_80211;
dev-tx_queue_len = 0;
+   dev-uninit = ieee80211_if_reinit;
dev-destructor = ieee80211_if_free;
 }
 
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index cac0dd5..3b2d259 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -234,9 +234,6 @@ void ieee80211_if_reinit(struct net_devi
sdata-keys[i] = NULL;
}
 
-   /* Shouldn't be necessary but won't hurt */
-   ieee80211_if_shutdown(dev);
-
switch (sdata-type) {
case IEEE80211_IF_TYPE_AP: {
/* Remove all virtual interfaces that use this BSS
@@ -311,7 +308,6 @@ void __ieee80211_if_del(struct ieee80211
 {
struct net_device *dev = sdata-dev;
 
-   ieee80211_if_reinit(dev);
list_del(sdata-list);
ieee80211_sysfs_remove_netdevice(dev);
unregister_netdevice(dev);


pgpalZ3hw8dLv.pgp
Description: PGP signature


d80211: 80211n

2007-01-09 Thread mohamed Abbas

is there any one working on the implementation of 11n to d80211 stack?
I have been trying to add 11n support to d80211 stack and wondering if
someone else doing the same so we can coordinate our work. I was able
to parse and add IE information, handling Rx aggregation and handling
11n action frame.
-
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/RFC 01/10] Implement local diversion of IPv4 skbs

2007-01-09 Thread Patrick McHardy
KOVACS Krisztian wrote:
 The input path for non-local bound sockets requires diverting certain
 packets locally, even if their destination IP address is not
 considered local. We achieve this by assigning a specially crafted dst
 entry to these skbs, and optionally also attaching a socket to the skb
 so that the upper layer code does not need to redo the socket lookup.
 
 We also have to be able to differentiate between these fake entries
 and real entries in the cache: it is perfectly legal that the
 diversion is done only for certain TCP or UDP packets and not for all
 packets of the flow. Since these special dst entries are used only by
 the iptables tproxy code, and that code uses exclusively these
 entries, simply flagging these entries as DST_DIVERTED is OK. All
 other cache lookup paths skip diverted entries, while our new
 ip_divert_local() function uses exclusively diverted dst entries.
 
 Signed-off-by: KOVACS Krisztian [EMAIL PROTECTED]
 
 ---
 
  include/net/dst.h   |1 
  include/net/route.h |2 +
  net/ipv4/route.c|  106 
 +++
  3 files changed, 108 insertions(+), 1 deletions(-)
 
 diff --git a/include/net/dst.h b/include/net/dst.h
 index 62b7e75..72b712c 100644
 --- a/include/net/dst.h
 +++ b/include/net/dst.h
 @@ -50,6 +50,7 @@ #define DST_NOXFRM  2
  #define DST_NOPOLICY 4
  #define DST_NOHASH   8
  #define DST_BALANCED0x10
 +#define DST_DIVERTED 0x20
   unsigned long   lastuse;
   unsigned long   expires;
  
 diff --git a/include/net/route.h b/include/net/route.h
 index 486e37a..ee52393 100644
 --- a/include/net/route.h
 +++ b/include/net/route.h
 @@ -126,6 +126,8 @@ extern intip_rt_ioctl(unsigned int cmd
  extern void  ip_rt_get_source(u8 *src, struct rtable *rt);
  extern int   ip_rt_dump(struct sk_buff *skb,  struct 
 netlink_callback *cb);
  
 +extern int   ip_divert_local(struct sk_buff *skb, const struct 
 in_device *in, struct sock *sk);
 +
  struct in_ifaddr;
  extern void fib_add_ifaddr(struct in_ifaddr *);
  
 diff --git a/net/ipv4/route.c b/net/ipv4/route.c
 index 2daa0dc..537b976 100644
 --- a/net/ipv4/route.c
 +++ b/net/ipv4/route.c
 @@ -942,9 +942,11 @@ restart:
   while ((rth = *rthp) != NULL) {
  #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
   if (!(rth-u.dst.flags  DST_BALANCED) 
 + ((rt-u.dst.flags  DST_DIVERTED) == (rth-u.dst.flags  
 DST_DIVERTED)) 
   compare_keys(rth-fl, rt-fl)) {
  #else
 - if (compare_keys(rth-fl, rt-fl)) {
 + if (((rt-u.dst.flags  DST_DIVERTED) == (rth-u.dst.flags  
 DST_DIVERTED)) 
 + compare_keys(rth-fl, rt-fl)) {
  #endif
   /* Put it first */
   *rthp = rth-u.rt_next;
 @@ -1166,6 +1168,7 @@ void ip_rt_redirect(__be32 old_gw, __be3
   if (rth-fl.fl4_dst != daddr ||
   rth-fl.fl4_src != skeys[i] ||
   rth-fl.oif != ikeys[k] ||
 + (rth-u.dst.flags  DST_DIVERTED) ||
   rth-fl.iif != 0) {
   rthp = rth-u.rt_next;
   continue;
 @@ -1526,6 +1529,105 @@ static int ip_rt_bug(struct sk_buff *skb
   return 0;
  }
  
 +static void ip_divert_free_sock(struct sk_buff *skb)
 +{
 + struct sock *sk = skb-sk;
 +
 + skb-sk = NULL;
 + skb-destructor = NULL;
 + sock_put(sk);
 +}
 +
 +int ip_divert_local(struct sk_buff *skb, const struct in_device *in, struct 
 sock *sk)
 +{
 + struct iphdr *iph = skb-nh.iph;
 + struct rtable *rth, *rtres;
 + unsigned hash;
 + const int iif = in-dev-ifindex;
 + u_int8_t tos;
 + int err;
 +
 + /* look up hash first */
 + tos = iph-tos  IPTOS_RT_MASK;
 + hash = rt_hash_code(iph-daddr, iph-saddr ^ (iif  5));
 +
 + rcu_read_lock();
 + for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
 +  rth = rcu_dereference(rth-u.rt_next)) {
 + if (rth-fl.fl4_dst == iph-daddr 
 + rth-fl.fl4_src == iph-saddr 
 + rth-fl.iif == iif 
 + rth-fl.oif == 0 
 + rth-fl.mark == skb-mark 
 + (rth-u.dst.flags  DST_DIVERTED) 
 + rth-fl.fl4_tos == tos) {

Mark and tos look unnecessary here since they don't affect the further
processing of the packet.

 + rth-u.dst.lastuse = jiffies;
 + dst_hold(rth-u.dst);
 + rth-u.dst.__use++;
 + RT_CACHE_STAT_INC(in_hit);
 + rcu_read_unlock();
 +
 + dst_release(skb-dst);
 + skb-dst = (struct dst_entry*)rth;
 +
 + if (sk) {
 + sock_hold(sk);
 + 

Re: [PATCH/RFC 05/10] Remove local address check on IP output

2007-01-09 Thread Patrick McHardy
KOVACS Krisztian wrote:
 ip_route_output() contains a check to make sure that no flows with
 non-local source IP addresses are routed. Unfortunately this check
 makes it completely impossible to use non-local bound sockets as no
 outbound packets will make through the stack.
 
 This patch moves the interface lookup to the multicast-specific code
 path as that is the only real user of the interface data looked up.
 
 Signed-off-by: KOVACS Krisztian [EMAIL PROTECTED]
 
 ---
 
  net/ipv4/route.c |   13 +
  1 files changed, 5 insertions(+), 8 deletions(-)
 
 diff --git a/net/ipv4/route.c b/net/ipv4/route.c
 index 537b976..bb1158a 100644
 --- a/net/ipv4/route.c
 +++ b/net/ipv4/route.c
 @@ -2498,11 +2498,6 @@ #endif
   ZERONET(oldflp-fl4_src))
   goto out;
  
 - /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
 - dev_out = ip_dev_find(oldflp-fl4_src);
 - if (dev_out == NULL)
 - goto out;
 -

I'm not sure how exactly this is used by applications, but couldn't you
restrict this to sockets without freebind?
-
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


[IPSEC] flow: Cache negative results

2007-01-09 Thread Herbert Xu
Hi:

[IPSEC] flow: Cache negative security checks

This patch causes security policy denials to be cached instead of
causing a relookup every time.  This is OK because we already cache
positive security policy results which is strictly worse as far as
security is concerned.  In particular, if the security system (not
IPsec policies but the rules under security/) changes such that a
positive result turns negative (denial), we will ignore it and
continue to allow traffic through based on the cached policy.

So if the security folks actually care about this, they'd need to
flush the flow cache whenever a relevant change is made to the
security database.  Whether this is done or not does not affect
this patch.

Given that we do want to cache positive results even in the presence
of SELinux (otherwise we might as well disable flow.c entirely), it
is natural to cache negative results too.

This patch also happens to fix a nasty bug where if an expiring
flow entry that's not at the head happens to trigger a security
denial, all entries before it are removed from the cache and
leaked.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]

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
--
diff --git a/net/core/flow.c b/net/core/flow.c
index d137f97..b0d1777 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -197,12 +197,16 @@ void *flow_cache_lookup(struct flowi *key, u16 family, u8 
dir,
if (fle-genid == atomic_read(flow_cache_genid)) {
void *ret = fle-object;
 
-   if (ret)
+   if (fle-object_ref)
atomic_inc(fle-object_ref);
local_bh_enable();
 
return ret;
}
+
+   if (fle-object_ref)
+   atomic_dec(fle-object_ref);
+   fle-object_ref = NULL;
break;
}
}
@@ -218,7 +222,7 @@ void *flow_cache_lookup(struct flowi *key, u16 family, u8 
dir,
fle-family = family;
fle-dir = dir;
memcpy(fle-key, key, sizeof(*key));
-   fle-object = NULL;
+   fle-object_ref = NULL;
flow_count(cpu)++;
}
}
@@ -230,28 +234,20 @@ nocache:
atomic_t *obj_ref;
 
err = resolver(key, family, dir, obj, obj_ref);
+   if (err)
+   obj = ERR_PTR(err);
 
if (fle) {
-   if (err) {
-   /* Force security policy check on next lookup */
-   *head = fle-next;
-   flow_entry_kill(cpu, fle);
-   } else {
-   fle-genid = atomic_read(flow_cache_genid);
+   fle-object = obj;
+   fle-genid = atomic_read(flow_cache_genid);
 
-   if (fle-object)
-   atomic_dec(fle-object_ref);
-
-   fle-object = obj;
+   if (!err  obj) {
fle-object_ref = obj_ref;
-   if (obj)
-   atomic_inc(fle-object_ref);
+   atomic_inc(obj_ref);
}
}
local_bh_enable();
 
-   if (err)
-   obj = ERR_PTR(err);
return obj;
}
 }
-
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/10] cxgb3 - main header files

2007-01-09 Thread Steve Wise
Roland,

The T3 Ethernet driver is queued for inclusion into Jeff's tree.  

How do you want to merge in the RDMA driver?  I can give you a single
monolithic patch if you want.  

We also need to decide on the ib_req_notify_cq() issue.  


Steve.



On Tue, 2007-01-09 at 05:28 -0500, Jeff Garzik wrote:
 Divy Le Ray wrote:
  Jeff Garzik wrote:
  Divy Le Ray wrote:
  From: Divy Le Ray [EMAIL PROTECTED]
 
  This patch implements the main header files of
  the Chelsio T3 network driver.
 
  Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
 
  Once you think it's ready, email me a URL to a single patch that adds 
  the driver to the latest linux-2.6.git kernel.  Include in the email a 
  description of the driver and signed-off-by line, which will get 
  directly included in the git changelog.
 
  Adding new drivers is a bit special, because we want to merge it as a 
  single changeset, but that would create a patch too large to review on 
  the common kernel mailing lists.
  Jeff,
  
  You can grab the monolithic patch at this URL:
  http://service.chelsio.com/kernel.org/cxgb3.patch.bz2
 
 this is in my queue, thanks.  Sorry I didn't indicate that earlier.
 
   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 1/10] cxgb3 - main header files

2007-01-09 Thread Michael S. Tsirkin
 We also need to decide on the ib_req_notify_cq() issue.  

Let's clarify - do you oppose doing copy_from_user from a fixed
address passed in during setup?

If OK with you, this seems the best way as it is the least controversial
and least disruptive one.

-- 
MST
-
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/10] cxgb3 - main header files

2007-01-09 Thread Steve Wise
On Tue, 2007-01-09 at 15:57 +0200, Michael S. Tsirkin wrote:
  We also need to decide on the ib_req_notify_cq() issue.  
 
 Let's clarify - do you oppose doing copy_from_user from a fixed
 address passed in during setup?
 

So far its been you and I arguing over this issue.  Before I go
implement it and retest everything, I'd like some indication that anyone
else thinks its the right thing to do vs adding the extra parameter to
ib_req_notify_cq().

 If OK with you, this seems the best way as it is the least controversial
 and least disruptive one.
 

In the interest of expediting this I'll go implement it...

Steve.




-
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: [openib-general] [PATCH 1/10] cxgb3 - main header files

2007-01-09 Thread Caitlin Bestler
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Michael S. Tsirkin
 Sent: Tuesday, January 09, 2007 5:57 AM
 To: Steve Wise
 Cc: netdev@vger.kernel.org; Roland Dreier; Divy Le Ray; 
 linux-kernel@vger.kernel.org; openib-general
 Subject: Re: [openib-general] [PATCH 1/10] cxgb3 - main header files
 
  We also need to decide on the ib_req_notify_cq() issue.  
 
 Let's clarify - do you oppose doing copy_from_user from a 
 fixed address passed in during setup?
 
 If OK with you, this seems the best way as it is the least 
 controversial and least disruptive one.
 
To clarfiy my understanding of this issue:

A device MAY implement ib_req_notify_cq by updating
a location directly from user mode. Any of the techniques
that apply to other user allocated objects, such as 
the Send Queue, can be applied here.

Even those the proposed changes would be about as
low impact and benign as possible, the fact that there
are valid solutions without an API changes leans heavily
towards using those solutions.

-
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: [openib-general] [PATCH 1/10] cxgb3 - main header files

2007-01-09 Thread Steve Wise

 
 In the interest of expediting this I'll go implement it...
 
 Steve.
 

Here it is.  I think this is the correct way to solve the issue (now
that I've implemented it :).  This is a delta from the driver patch
series just for reviewing purposes.


commit e6053f2aee764b21e28cbb19f52995cb413cf733
Author: Steve Wise [EMAIL PROTECTED]
Date:   Tue Jan 9 13:06:13 2007 -0600

Chelsio-specific solution for copying in the user cq_index.

- at cq_create time, user lib passes in the address of its cq rptr u32.
- kernel saves this address in the iwch_cq struct.
- kernel copies in the rptr value in iwch_req_notify_cq().

Signed-off-by: Steve Wise [EMAIL PROTECTED]

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c 
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index ab99202..28be418 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -143,6 +143,7 @@ static struct ib_cq *iwch_create_cq(stru
struct iwch_dev *rhp;
struct iwch_cq *chp;
struct iwch_create_cq_resp uresp;
+   struct iwch_create_cq_req ureq;
 
PDBG(%s ib_dev %p entries %d\n, __FUNCTION__, ibdev, entries);
rhp = to_iwch_dev(ibdev);
@@ -150,6 +151,14 @@ static struct ib_cq *iwch_create_cq(stru
if (!chp)
return ERR_PTR(-ENOMEM);
 
+   if (context) {
+   if (ib_copy_from_udata(ureq, udata, sizeof (ureq))) {
+   kfree(chp);
+   return ERR_PTR(-EFAULT);
+   }
+   chp-user_rptr_addr = (u32 *)(unsigned long)ureq.user_rptr_addr;
+   }
+
if (t3a_device(rhp)) {
 
/*
@@ -269,15 +278,14 @@ static int iwch_resize_cq(struct ib_cq *
return ret;
 }
 
-static int iwch_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify,
-  struct ib_udata *udata)
+static int iwch_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
 {
struct iwch_dev *rhp;
struct iwch_cq *chp;
enum t3_cq_opcode cq_op;
int err;
unsigned long flag;
-   struct iwch_req_notify_cq ucmd;
+   u32 rptr;
 
chp = to_iwch_cq(ibcq);
rhp = chp-rhp;
@@ -285,11 +293,11 @@ static int iwch_arm_cq(struct ib_cq *ibc
cq_op = CQ_ARM_SE;
else
cq_op = CQ_ARM_AN;
-   if (udata  t3b_device(rhp)) {
-   if (ib_copy_from_udata(ucmd, udata, sizeof ucmd))
+   if (chp-user_rptr_addr) {
+   if (get_user(rptr, chp-user_rptr_addr))
return -EFAULT;
spin_lock_irqsave(chp-lock, flag);
-   chp-cq.rptr = ucmd.rptr;
+   chp-cq.rptr = rptr;
} else
spin_lock_irqsave(chp-lock, flag);
PDBG(%s rptr 0x%x\n, __FUNCTION__, chp-cq.rptr);
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.h 
b/drivers/infiniband/hw/cxgb3/iwch_provider.h
index f339427..d9d94e3 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.h
@@ -105,6 +105,7 @@ struct iwch_cq {
spinlock_t lock;
atomic_t refcnt;
wait_queue_head_t wait;
+   u32 *user_rptr_addr;
 };
 
 static inline struct iwch_cq *to_iwch_cq(struct ib_cq *ibcq)
diff --git a/drivers/infiniband/hw/cxgb3/iwch_user.h 
b/drivers/infiniband/hw/cxgb3/iwch_user.h
index 4e4b9c9..e8ff061 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_user.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_user.h
@@ -42,6 +42,9 @@ #define IWCH_UVERBS_ABI_VERSION   1
  * In particular do not use pointer types -- pass pointers in __u64
  * instead.
  */
+struct iwch_create_cq_req {
+   __u64 user_rptr_addr;
+};
 
 struct iwch_create_cq_resp {
__u64 physaddr; 
@@ -61,8 +64,4 @@ struct iwch_create_qp_resp {
 struct iwch_reg_user_mr_resp {
__u32 pbl_addr;
 };
-
-struct iwch_req_notify_cq {
-   __u32 rptr;
-};
 #endif





-
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