[PATCH] NET : force a cache line split in hh_cache in SMP

2006-12-08 Thread Eric Dumazet

hh_lock was converted from rwlock to seqlock by Stephen.

To have a 100% benefit of this change, I suggest to place read mostly fields 
of hh_cache in a separate cache line, because hh_refcnt may be changed quite 
frequently on some busy machines.


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

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 631cec4..6be767c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -193,7 +193,14 @@ struct hh_cache
 {
struct hh_cache *hh_next;   /* Next entry*/
atomic_thh_refcnt;  /* number of users   */
-   __be16  hh_type;/* protocol identifier, f.e ETH_P_IP
+/*
+ * We want hh_output, hh_len, hh_lock and hh_data be a in a separate
+ * cache line on SMP.
+ * They are mostly read, but hh_refcnt may be changed quite frequently,
+ * incurring cache line ping pongs.
+ */
+   __be16  hh_type cacheline_aligned_in_smp;
+   /* protocol identifier, f.e ETH_P_IP
  *  NOTE:  For VLANs, this will be the
  *  encapuslated type. --BLG
  */


Re: [PATCH] NET : force a cache line split in hh_cache in SMP

2006-12-08 Thread David Miller
From: Eric Dumazet [EMAIL PROTECTED]
Date: Fri, 08 Dec 2006 09:06:32 +0100

 hh_lock was converted from rwlock to seqlock by Stephen.
 
 To have a 100% benefit of this change, I suggest to place read mostly fields 
 of hh_cache in a separate cache line, because hh_refcnt may be changed quite 
 frequently on some busy machines.
 
 Signed-off-by: Eric Dumazet [EMAIL PROTECTED]

Applied, thanks Eric.
-
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] [XFRM] Fix XFRMGRP_REPORT to use correct multicast group

2006-12-08 Thread David Miller
From: jamal [EMAIL PROTECTED]
Date: Thu, 07 Dec 2006 19:14:58 -0500

 Against net-2.6 but should probably go into anything stable that has
 reports already.

Applied, thanks for this fix Jamal.  I'll push it to -stable.
-
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


how to change the initial queue descipline to netem?

2006-12-08 Thread Jie Xu

the main problem is that how to create a netem queue?
just replace the fifo_fast in dev_activate() failed
-
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][NET_SCHED] sch_cbq: deactivating when grafting, purging etc.

2006-12-08 Thread David Miller
From: Patrick McHardy [EMAIL PROTECTED]
Date: Thu, 30 Nov 2006 13:22:47 +0100

 Jarek Poplawski wrote:
  [NET_SCHED] sch_cbq:
  
  [PATCH 2.6.19-rc6 with Fix endless loops set of patches]
  
  - P. McHardy's Fix endless loops patch supplement
(cbq_graft, cbq_qlen_notify, cbq_delete, cbq_class_ops)
  
  - deactivating of active classes when q.qlen drops to zero
(cbq_drop)
  
  - a redundant instruction removed from cbq_deactivate_class
  
  PS: probably htb_deactivate in htb_delete and
  cbq_deactivate_class in cbq_delete are also
  redundant now.
 
 This looks good, thanks.

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][NET_SCHED] sch_htb: turn intermediate classes into leaves

2006-12-08 Thread David Miller
From: Patrick McHardy [EMAIL PROTECTED]
Date: Thu, 30 Nov 2006 14:12:32 +0100

 Jarek Poplawski wrote:
  On Thu, Nov 30, 2006 at 01:26:34PM +0100, Patrick McHardy wrote:
  
 Jarek Poplawski wrote:
 
 [NET_SCHED] sch_htb:
 
 [PATCH 2.6.19-rc6 with Fix endless loops set of patches]
 
 - turn intermediate classes into leaves again when their
   last child is deleted (struct htb_class changed)
 
 Looks good to me too, but it still seems to be missing
 class level adjustment after deletion. The classification
 function refuses to queue packets to classes with level  0.
  
  
  +static void htb_parent_to_leaf(struct htb_class *cl, struct Qdisc *new_q)
  +{
  +   struct htb_class *parent = cl-parent;
  +
  +   BUG_TRAP(!cl-level  cl-un.leaf.q  !cl-prio_activity);
  +
  +   parent-level = 0;
  
  I've thought this is enough, but probably you mean something
  else? 
 
 I missed that, thanks.

Patch applied, 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: 'embedded people' and the 'embedded world' (was: Re: [RFC patch] driver for the Opencores Ethernet Controller)

2006-12-08 Thread Robert Schwebel
Lennert,

On Tue, Dec 05, 2006 at 01:29:36AM +0100, Lennert Buytenhek wrote:
 BTW (and this is not specifically directed to you.)

One cannot say this loud enough.

Acked-By: Robert Schwebel [EMAIL PROTECTED]

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
 Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9

-
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


[IPROUTE2 PATCH][XFRM] update xfrm monitoring to use nl_mgrp

2006-12-08 Thread jamal
Stephen,
I will wait until you sync all these patches ive sent; then send a
couple more then i will be done.

cheers,
jamal
[XFRM] update xfrm monitoring to use nl_mgrp

Signed-off-by: J Hadi Salim [EMAIL PROTECTED]

---
commit 738a5222776694ff22083e54a8f3efb6a013694e
tree 70937ae0b6a80d98d08b4a627fdf7b61f62bdf66
parent 1326d6a1eb107e3b9ea7a3254e621dd3f827bb4d
author Jamal Hadi Salim [EMAIL PROTECTED] Thu, 07 Dec 2006 20:54:50 -0500
committer Jamal Hadi Salim [EMAIL PROTECTED] Thu, 07 Dec 2006 20:54:50 -0500

 ip/xfrm_monitor.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c
index b2014b4..925e229 100644
--- a/ip/xfrm_monitor.c
+++ b/ip/xfrm_monitor.c
@@ -292,17 +292,17 @@ int do_xfrm_monitor(int argc, char **argv)
}
 
if (lacquire)
-   groups |= XFRMGRP_ACQUIRE;
+   groups |= nl_mgrp(XFRMNLGRP_ACQUIRE);
if (lexpire)
-   groups |= XFRMGRP_EXPIRE;
+   groups |= nl_mgrp(XFRMNLGRP_EXPIRE);
if (lsa)
-   groups |= XFRMGRP_SA;
+   groups |= nl_mgrp(XFRMNLGRP_SA);
if (lpolicy)
-   groups |= XFRMGRP_POLICY;
+   groups |= nl_mgrp(XFRMNLGRP_POLICY);
if (laevent)
-   groups |= (1   (XFRMNLGRP_AEVENTS - 1));
+   groups |= nl_mgrp(XFRMNLGRP_AEVENTS);
if (lreport)
-   groups |= XFRMGRP_REPORT;
+   groups |= nl_mgrp(XFRMNLGRP_REPORT);
 
if (file) {
FILE *fp;


Re: Marvell Libertas wifi

2006-12-08 Thread Dan Williams
On Fri, 2006-12-08 at 01:03 -0500, Alex Deucher wrote:
 On 12/7/06, Dan Williams [EMAIL PROTECTED] wrote:
  On Thu, 2006-12-07 at 12:32 -0500, Alex Deucher wrote:
   I just wanted to check on the status of the libertas driver from
   Marvell for the OLPC project.  I haven't really been able to find out
 
  The driver needs quite a bit of love.  It's only been used for embedded
  devices so far and has quite a few NDIS-isms sprinkled throughout.  It's
  also something like 30,000 LoC, which is completely bogus.  There's no
  reason it should be that large given that it's a FullMAC-type part.
 
  We're slowly working on cleaning it up for submission to the kernel.
  That process will probably take until after the holidays.  We are
  removing unused code/defines, cleaning up WEXT compliance, making
  operations like association and scanning asynchronous, converting
  private IOCTLs to debugfs, fixing the power-saving code, and adding
  draft 802.11s wireless mesh functionality to the firmware and the
  driver.
 
  Are you developing a device based on the 8388?  AFAIK, the chip does not
  appear in any consumer devices that are generally available to the
  public, and certainly isn't sold to Linksys or DLink for consumer USB
  dongles.  It does show up in embedded situations like the Nokia N80
  mobile phone and a few other small gadgets like that.
 
   much about this driver other than the commits to the olpc and
   infradead libertas git trees.  The olpc laptop uses the usb interface
 
  Correct; the 8388 module is connected directly to the USB traces coming
  out of the 5536 Geode companion chip on the OLPC motherboard.
 
   and that seems to be what is supported at the moment (although some
   comments in the code allude to pci and sdio interfaces as well).  Does
 
  Yes; the part evidently has other interface variants, though code for
  those variants was not provided in the initial driver sources which
  Marvell GPL-ed in April.
 
   anyone know what the plan is for merging this driver into mainline?
   What about pci support?  Did Marvell donate any code for the PCI
   interface? If not how hard would it be to add PCI support?  I
 
  No code for PCI was donated, and we don't have any 8388 PCI cards at
  OLPC.
 
   requested databooks from Marvell months ago, but never got anywhere.
   I'd like to see better support for this chip and would be willing to
   help out.  Any updates would be much appreciated.
 
  Be aware that I _think_ there are a few chips in the Libertas line; we
  are using the 8388.  The current driver only supports that specific
  part.
 
  That said, if you've got hardware, we'd love patches, certainly accept
  patches that provided PCI support and fixed bugs in the driver.  We may
  also be able to provide USB 8388 reference dongles for people willing to
  help out with the development of the driver.
 
 
 Yes, that appears to be the case.  I just wasn't sure how
 similar/dissimilar they are.  I have a 11ab:1fa7 on my motherboard,
 and I've seen quite a few Marvel chips floating around on cardbus and
 pci cards.  I'm hoping the cores are pretty similar and one could just
 add some pci glue to make the olpc driver work.  Does anyone at the
 olpc have any contacts at Marvell that could clarify the situation or
 might know if they are willing to release the code for the pci
 variants, etc.?

What's the numbers on the chip?  We know that the _8338_ part (which
may/may not be part of the Libertas family, we're not sure) doesn't
work, and that's shipping on USB dongles from Linksys.  If you could get
a bit more info off the surface of the chip, that would help.  The 8338
part, for example, has a different firmware load sequence and a
different sized RAM than the 8388 which we're using, and is incompatible
with the current driver.

Dan

 Thanks,
 
 Alex
 
  Cheers,
  Dan
 
   Thanks,
  
   Alex
  
   PS, please CC: me on replies as I'm not on this list.

-
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] MACB: Use struct delayed_work instead of struct work_struct

2006-12-08 Thread Haavard Skinnemoen
The macb driver calls schedule_delayed_work() and friends, so we need
to use a struct delayed_work along with it. The conversion was
explained by David Howells on lkml Dec 5 2006:

http://lkml.org/lkml/2006/12/5/269

Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED]
---
 drivers/net/macb.c |6 +++---
 drivers/net/macb.h |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index bd0ce98..3496d19 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -267,9 +267,9 @@ static void macb_update_stats(struct mac
*p += readl(reg);
 }
 
-static void macb_periodic_task(void *arg)
+static void macb_periodic_task(struct work_struct *work)
 {
-   struct macb *bp = arg;
+   struct macb *bp = container_of(work, struct macb, periodic_task.work);
 
macb_update_stats(bp);
macb_check_media(bp, 1, 0);
@@ -1088,7 +1088,7 @@ static int __devinit macb_probe(struct p
 
dev-base_addr = regs-start;
 
-   INIT_WORK(bp-periodic_task, macb_periodic_task, bp);
+   INIT_DELAYED_WORK(bp-periodic_task, macb_periodic_task);
mutex_init(bp-mdio_mutex);
init_completion(bp-mdio_complete);
 
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index 8c253db..e3fcb2e 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -377,7 +377,7 @@ struct macb {
 
unsigned intrx_pending, tx_pending;
 
-   struct work_struct  periodic_task;
+   struct delayed_work periodic_task;
 
struct mutexmdio_mutex;
struct completion   mdio_complete;
-- 
1.4.3.3

-
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] MACB: Use __raw register access

2006-12-08 Thread Haavard Skinnemoen
Since macb is a chip-internal device, use __raw_readl and
__raw_writel instead of readl/writel. This will perform native-endian
accesses, which is the right thing to do on both AVR32 and ARM devices.

Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED]
---
 drivers/net/macb.c |2 +-
 drivers/net/macb.h |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 3496d19..25b559b 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -264,7 +264,7 @@ static void macb_update_stats(struct mac
WARN_ON((unsigned long)(end - p - 1) != (MACB_TPF - MACB_PFR) / 4);
 
for(; p  end; p++, reg++)
-   *p += readl(reg);
+   *p += __raw_readl(reg);
 }
 
 static void macb_periodic_task(struct work_struct *work)
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index e3fcb2e..27bf0ae 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -250,9 +250,9 @@
 
 /* Register access macros */
 #define macb_readl(port,reg)   \
-   readl((port)-regs + MACB_##reg)
+   __raw_readl((port)-regs + MACB_##reg)
 #define macb_writel(port,reg,value)\
-   writel((value), (port)-regs + MACB_##reg)
+   __raw_writel((value), (port)-regs + MACB_##reg)
 
 struct dma_desc {
u32 addr;
-- 
1.4.3.3

-
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: [NETLINK]: Restore API compatibility of address and neighbour bits

2006-12-08 Thread Stefan Rompf
Hi Thomas,

Am Donnerstag, 7. Dezember 2006 11:55 schrieb Thomas Graf:

 --- net-2.6.orig/include/linux/rtnetlink.h2006-12-07 11:25:29.0
 +0100 +++ net-2.6/include/linux/rtnetlink.h   2006-12-07 11:32:25.0
 +0100 @@ -3,6 +3,8 @@

  #include linux/netlink.h
  #include linux/if_link.h
 +#include linux/if_addr.h
 +#include linux/neighbour.h

  /
   *   Routing/neighbour discovery messages.

The _RTA and _PAYLOAD-macros are also part of userspace headers and need to be
restored. Both dhcpclient and quagga need at least IFA_RTA and IFLA_RTA to
compile, but there may be more macros than in the following patch. You may want
to look at keepalived, iproute, ...

Stefan

--- linux-2.6.19/include/linux/if_addr.h.orig   2006-12-08 14:08:29.0 
+0100
+++ linux-2.6.19/include/linux/if_addr.h2006-12-08 15:16:59.0 
+0100
@@ -52,4 +52,12 @@
__u32   tstamp; /* updated timestamp, hundredths of seconds */
 };
 
+#ifndef __KERNEL__
+
+/* Userspace header compatibility */
+#define IFA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct 
ifaddrmsg
+#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg))
+
+#endif
+
 #endif
--- linux-2.6.19/include/linux/if_link.h.orig   2006-12-08 14:08:29.0 
+0100
+++ linux-2.6.19/include/linux/if_link.h2006-12-08 15:16:47.0 
+0100
@@ -133,4 +133,12 @@
__u32   retrans_time;
 };
 
+#ifndef __KERNEL__
+
+/* Userspace header compatibility */
+#define IFLA_RTA(r)  ((struct rtattr*)(((char*)(r)) + 
NLMSG_ALIGN(sizeof(struct ifinfomsg
+#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
+
+#endif
+
 #endif /* _LINUX_IF_LINK_H */


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


[PATCH] myri10ge: pci msi and express state save/restore

2006-12-08 Thread Stephen Hemminger
The PCI MSI and express state are already saved and restored by the
current versions of pci_save_state/pci_restore_state.
Therefore it should no longer be necessary for the driver to do it.
This patch has not been tested on the hardware.

On suspend, handle pci_set_power_state errors, and on resume
handle failures in pci_resume_state().

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

---
 drivers/net/myri10ge/myri10ge.c |   48 +---
 1 file changed, 11 insertions(+), 37 deletions(-)

--- pci-x.orig/drivers/net/myri10ge/myri10ge.c
+++ pci-x/drivers/net/myri10ge/myri10ge.c
@@ -2481,34 +2481,6 @@ static void myri10ge_select_firmware(str
}
 }
 
-static void myri10ge_save_state(struct myri10ge_priv *mgp)
-{
-   struct pci_dev *pdev = mgp-pdev;
-   int cap;
-
-   pci_save_state(pdev);
-   /* now save PCIe and MSI state that Linux will not
-* save for us */
-   cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
-   pci_read_config_dword(pdev, cap + PCI_EXP_DEVCTL, mgp-devctl);
-   cap = pci_find_capability(pdev, PCI_CAP_ID_MSI);
-   pci_read_config_word(pdev, cap + PCI_MSI_FLAGS, mgp-msi_flags);
-}
-
-static void myri10ge_restore_state(struct myri10ge_priv *mgp)
-{
-   struct pci_dev *pdev = mgp-pdev;
-   int cap;
-
-   /* restore PCIe and MSI state that linux will not */
-   cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
-   pci_write_config_dword(pdev, cap + PCI_CAP_ID_EXP, mgp-devctl);
-   cap = pci_find_capability(pdev, PCI_CAP_ID_MSI);
-   pci_write_config_word(pdev, cap + PCI_MSI_FLAGS, mgp-msi_flags);
-
-   pci_restore_state(pdev);
-}
-
 #ifdef CONFIG_PM
 
 static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state)
@@ -2530,10 +2502,10 @@ static int myri10ge_suspend(struct pci_d
}
myri10ge_dummy_rdma(mgp, 0);
free_irq(pdev-irq, mgp);
-   myri10ge_save_state(mgp);
+   pci_save_state(pdev);
pci_disable_device(pdev);
-   pci_set_power_state(pdev, pci_choose_state(pdev, state));
-   return 0;
+
+   return pci_set_power_state(pdev, pci_choose_state(pdev, state));
 }
 
 static int myri10ge_resume(struct pci_dev *pdev)
@@ -2555,12 +2527,14 @@ static int myri10ge_resume(struct pci_de
   mgp-dev-name);
return -EIO;
}
-   myri10ge_restore_state(mgp);
+   status = pci_restore_state(pdev);
+   if (status)
+   return status;
 
status = pci_enable_device(pdev);
-   if (status  0) {
+   if (status) {
dev_err(pdev-dev, failed to enable device\n);
-   return -EIO;
+   return status;
}
 
pci_set_master(pdev);
@@ -2577,7 +2551,7 @@ static int myri10ge_resume(struct pci_de
 
/* Save configuration space to be restored if the
 * nic resets due to a parity error */
-   myri10ge_save_state(mgp);
+   pci_save_state(pdev);
 
if (netif_running(netdev)) {
rtnl_lock();
@@ -2639,7 +2613,7 @@ static void myri10ge_watchdog(void *arg)
 * when the driver was loaded, or the last time the
 * nic was resumed from power saving mode.
 */
-   myri10ge_restore_state(mgp);
+   pci_restore_state(mgp-pdev);
} else {
/* if we get back -1's from our slot, perhaps somebody
 * powered off our card.  Don't try to reset it in
@@ -2880,7 +2854,7 @@ static int myri10ge_probe(struct pci_dev
 
/* Save configuration space to be restored if the
 * nic resets due to a parity error */
-   myri10ge_save_state(mgp);
+   pci_save_state(pdev);
 
/* Setup the watchdog timer */
setup_timer(mgp-watchdog_timer, myri10ge_watchdog_timer,
-
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] myri10ge: pci msi and express state save/restore

2006-12-08 Thread Brice Goglin
It looks ok to me, except that you should also remove devctl and
msi_flags from myri10ge_priv since these fields were only used in the
functions that are dropped by this patch.

However, I won't be able to test the patch on real hardware within the
next days...

Thanks a lot!
Brice




Stephen Hemminger wrote:
 The PCI MSI and express state are already saved and restored by the
 current versions of pci_save_state/pci_restore_state.
 Therefore it should no longer be necessary for the driver to do it.
 This patch has not been tested on the hardware.

 On suspend, handle pci_set_power_state errors, and on resume
 handle failures in pci_resume_state().

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

 ---
  drivers/net/myri10ge/myri10ge.c |   48 
 +---
  1 file changed, 11 insertions(+), 37 deletions(-)
   

-
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: [NETLINK]: Restore API compatibility of address and neighbour bits

2006-12-08 Thread Jim Gifford
I have seen issues with some version of unifdef remove any instance of 
__KERNEL__, is the #ifndef __KERNEL__ really necessary. Has anyone 
tested to make sure the install_headers will not accidently remove this?


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


Fw: [Bug 7635] New: ioctl(fd,TCSBRK,1) on socket yields EFAULT, expected EINVAL/ENOTTY

2006-12-08 Thread Stephen Hemminger


Begin forwarded message:

Date: Tue, 5 Dec 2006 08:55:19 -0800
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [Bug 7635] New: ioctl(fd,TCSBRK,1) on socket yields EFAULT, expected 
EINVAL/ENOTTY


http://bugzilla.kernel.org/show_bug.cgi?id=7635

   Summary: ioctl(fd,TCSBRK,1) on socket yields EFAULT, expected
EINVAL/ENOTTY
Kernel Version: 2.6.15
Status: NEW
  Severity: normal
 Owner: [EMAIL PROTECTED]
 Submitter: [EMAIL PROTECTED]


Most recent kernel where this bug did *NOT* occur: unknown
Distribution: Ubuntu Dapper, but confirmed from some others distros as well.
Hardware environment: Fujitsu Siemens Lifebook C1110, i686 centrino laptop
Software environment: ubuntu Gnome desktop, sshd, netcat

Problem description:
ioctl(TCSBRK) yields EFAULT when invoked on a socket.  An error is to
be expected, but not an address error, which is an indication of a serious
fault. EINVAL or ENOTTY are typical and acceptable errno values as the
following summary shows
(and EOPNOTSUPP also seems possible on Darwin Mac OS X).

This bug affects tcdrain(3), because tcdrain(fd) is equivalent to
ioctl(fd,TCSBRK,1) on Linux and Solaris.

ioctl(TCSBRK,1) errno
pty 0
pipe22/EINVAL
/dev/null   25/ENOTTY
reg_file25/ENOTTY
socket  14/EFAULT

kernel version:
Linux version 2.6.15-27-686 ([EMAIL PROTECTED]) (gcc version 4.0.3 (Ubuntu
4.0.3-1ubuntu5)) #1 SMP PREEMPT Sat Sep 16 02:13:27 UTC 2006

Steps to reproduce:
/* tcdrain() returns EFAULT (a serious error) on sockets
 * tcdrain() is equivalent to ioctl(TCSBRK) on Linux and Solaris
 */
#include sys/ioctl.h
#include termios.h/* TCSBRK is 0x5409 */
#include errno.h
#include string.h
#include stdio.h

int main () {
  int i;
  for (i=0; i=2; i++) {
int retval, save;
errno = 0;
retval = ioctl(i,TCSBRK,1);
save = errno;
/* printf(ioctl(%d,TCSBRK,1)=(%d,%d)\n,i,retval,save); */
printf(ioctl(%d,TCSBRK,1)=(%d,%d=%s)\n,i,retval,save,
   save ? strerror(save) : );
  }
  return 0;
}

sample output:
$ ~/Bugs/ioctl-tcsbrk
ioctl(0,TCSBRK,1)=(0,0=)
ioctl(1,TCSBRK,1)=(0,0=)
ioctl(2,TCSBRK,1)=(0,0=)
$ ~/Bugs/ioctl-tcsbrk | cat
ioctl(0,TCSBRK,1)=(0,0=)
ioctl(1,TCSBRK,1)=(-1,22=Invalid argument)
ioctl(2,TCSBRK,1)=(0,0=)
$ ~/Bugs/ioctl-tcsbrk  /dev/null
ioctl(0,TCSBRK,1)=(-1,25=Inappropriate ioctl for device)
ioctl(1,TCSBRK,1)=(0,0=)
ioctl(2,TCSBRK,1)=(0,0=)
$ ~/Bugs/ioctl-tcsbrk  ~/Bugs/ioctl-tcsbrk
ioctl(0,TCSBRK,1)=(-1,25=Inappropriate ioctl for device)
ioctl(1,TCSBRK,1)=(0,0=)
ioctl(2,TCSBRK,1)=(0,0=)

$ nc -l -p 5 -c ~/Bugs/ioctl-tcsbrk
$ telnet localhost 5
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
ioctl(0,TCSBRK,1)=(-1,14=Bad address)
ioctl(1,TCSBRK,1)=(-1,14=Bad address)
ioctl(2,TCSBRK,1)=(-1,14=Bad address)
Connection closed by foreign host.

/proc/cpuinfo:
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 13
model name  : Intel(R) Pentium(R) M processor 1.60GHz
stepping: 6
cpu MHz : 1600.175
cache size  : 2048 KB
fdiv_bug: no
hlt_bug : no
f00f_bug: no
coma_bug: no
fpu : yes
fpu_exception   : yes
cpuid level : 2
wp  : yes
flags   : fpu vme de pse tsc msr mce cx8 apic sep mtrr pge mca cmov pat 
clflush
dts acpi mmx fxsr sse sse2 ss tm pbe est tm2
bogomips: 1201.01

$ lsmod (shortened a little)
Module  Size  Used by
acpi_sbs   20172  0 
i2c_acpi_ec 5120  1 acpi_sbs
i2c_core   22848  1 i2c_acpi_ec
battery 9988  1 acpi_sbs
ac  5220  1 acpi_sbs
thermal13768  0 
fan 4836  0 
button  6704  0 
ipw2200   113548  0 
ieee80211  38952  1 ipw2200
...
8139too29056  0 
nls_utf82240  0 
nls_cp437   5888  0 
vfat   14496  0 
fat55548  1 vfat
sg 40160  0 
sd_mod 20448  0 
usb_storage79648  0 
scsi_mod  145960  3 sg,sd_mod,usb_storage
joydev 10432  0 
rfcomm 43604  0 
l2cap  28192  5 rfcomm
bluetooth  54212  4 rfcomm,l2cap
i915   21664  1 
drm78484  2 i915
ppdev   9668  0 
speedstep_centrino  8752  1 
cpufreq_powersave   1920  0 
cpufreq_stats   6688  0 
cpufreq_userspace   6496  1 
cpufreq_ondemand7752  0 
cpufreq_conservative 9000  0 
freq_table  4928  2 speedstep_centrino,cpufreq_stats
tc1100_wmi  6884  0 
video  16324  0 
container   4608  0 
pcc_acpi   12416  0 
sony_acpi   5580  0 
dev_acpi   11236  0 
hotkey 11492  0 
ipv6

Re: [NETLINK]: Restore API compatibility of address and neighbour bits

2006-12-08 Thread Mike Frysinger
On Friday 08 December 2006 12:33, Jim Gifford wrote:
 I have seen issues with some version of unifdef remove any instance of
 __KERNEL__

so use a version of unifdef that isnt broken ?
-mike


pgpsiyqaE9CFU.pgp
Description: PGP signature


Re: Marvell Libertas wifi

2006-12-08 Thread Alex Deucher

On 12/8/06, Dan Williams [EMAIL PROTECTED] wrote:

On Fri, 2006-12-08 at 01:03 -0500, Alex Deucher wrote:
 On 12/7/06, Dan Williams [EMAIL PROTECTED] wrote:
  On Thu, 2006-12-07 at 12:32 -0500, Alex Deucher wrote:
   I just wanted to check on the status of the libertas driver from
   Marvell for the OLPC project.  I haven't really been able to find out
 
  The driver needs quite a bit of love.  It's only been used for embedded
  devices so far and has quite a few NDIS-isms sprinkled throughout.  It's
  also something like 30,000 LoC, which is completely bogus.  There's no
  reason it should be that large given that it's a FullMAC-type part.
 
  We're slowly working on cleaning it up for submission to the kernel.
  That process will probably take until after the holidays.  We are
  removing unused code/defines, cleaning up WEXT compliance, making
  operations like association and scanning asynchronous, converting
  private IOCTLs to debugfs, fixing the power-saving code, and adding
  draft 802.11s wireless mesh functionality to the firmware and the
  driver.
 
  Are you developing a device based on the 8388?  AFAIK, the chip does not
  appear in any consumer devices that are generally available to the
  public, and certainly isn't sold to Linksys or DLink for consumer USB
  dongles.  It does show up in embedded situations like the Nokia N80
  mobile phone and a few other small gadgets like that.
 
   much about this driver other than the commits to the olpc and
   infradead libertas git trees.  The olpc laptop uses the usb interface
 
  Correct; the 8388 module is connected directly to the USB traces coming
  out of the 5536 Geode companion chip on the OLPC motherboard.
 
   and that seems to be what is supported at the moment (although some
   comments in the code allude to pci and sdio interfaces as well).  Does
 
  Yes; the part evidently has other interface variants, though code for
  those variants was not provided in the initial driver sources which
  Marvell GPL-ed in April.
 
   anyone know what the plan is for merging this driver into mainline?
   What about pci support?  Did Marvell donate any code for the PCI
   interface? If not how hard would it be to add PCI support?  I
 
  No code for PCI was donated, and we don't have any 8388 PCI cards at
  OLPC.
 
   requested databooks from Marvell months ago, but never got anywhere.
   I'd like to see better support for this chip and would be willing to
   help out.  Any updates would be much appreciated.
 
  Be aware that I _think_ there are a few chips in the Libertas line; we
  are using the 8388.  The current driver only supports that specific
  part.
 
  That said, if you've got hardware, we'd love patches, certainly accept
  patches that provided PCI support and fixed bugs in the driver.  We may
  also be able to provide USB 8388 reference dongles for people willing to
  help out with the development of the driver.
 

 Yes, that appears to be the case.  I just wasn't sure how
 similar/dissimilar they are.  I have a 11ab:1fa7 on my motherboard,
 and I've seen quite a few Marvel chips floating around on cardbus and
 pci cards.  I'm hoping the cores are pretty similar and one could just
 add some pci glue to make the olpc driver work.  Does anyone at the
 olpc have any contacts at Marvell that could clarify the situation or
 might know if they are willing to release the code for the pci
 variants, etc.?

What's the numbers on the chip?  We know that the _8338_ part (which
may/may not be part of the Libertas family, we're not sure) doesn't
work, and that's shipping on USB dongles from Linksys.  If you could get
a bit more info off the surface of the chip, that would help.  The 8338
part, for example, has a different firmware load sequence and a
different sized RAM than the 8388 which we're using, and is incompatible
with the current driver.


According to the pciids.sf.net, it's a 88W8310 and 88W8000G
[Libertas] 802.11g client chipset.  I'll try and pry the RF shield
off in the next couple days to see if I can get the number off the cip
itself.

Alex



Dan

 Thanks,

 Alex

  Cheers,
  Dan
 
   Thanks,
  
   Alex
  
   PS, please CC: me on replies as I'm not on this list.



-
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: how to change the initial queue descipline to netem?

2006-12-08 Thread Stephen Hemminger
On Fri, 8 Dec 2006 16:14:23 +0800
Jie Xu [EMAIL PROTECTED] wrote:

 the main problem is that how to create a netem queue?
 just replace the fifo_fast in dev_activate() failed
 -
 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

Look at the wiki, you can replace the queue after setting up netem.
http://linux-net.osdl.org/index.php/Netem
The initial default is a variant of FIFO with time ordering.
-
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 04/26] rt2x00: EEPROM 93Cx6

2006-12-08 Thread Ivo van Doorn
On Sunday 03 December 2006 19:39, Michael Wu wrote:
 On Sunday 03 December 2006 13:19, Ivo van Doorn wrote:
  rt2400pci, rt2500pci and rt61pci share exactly the
  same code for the eeprom reading. The only difference
  is that rt61pci has a slightly different register reading
  approach. In any case we have a lot of duplicate code.
  Create a new module eeprom_93cx6 inside the rt2x00 folder
  and make rt2x00 use that.
 Interesting. adm8211 has code to read 93C66 and 93C46 eeproms, and it looks 
 similar, albeit smaller and simpler, to your 93cx6 reading code. However, it 
 looks like your new eeprom reading code is general enough for adm8211 to use 
 too. I'll have to try it..

I have checked the adm80211 code as well, it seems to behave quite the same,
with the most notable difference the fact that adm80211 writes the READ_OPCODE
and the word index within a single command, while in eeprom_93cx6 this is
split into 2 seperate write commands.
I have not yet tested the exact impact for rt2x00 devices when they would 
combine
the write commands, but if that has no impact (or the adm80211 suffers no impact
when the write commands are being split) then rt2x00 and adm80211 could indeed
share the eeprom_93cx6 module.
If eeprom_93cx6 is moved to the /lib folder of the kernel, should it be 
approved by
a different maintainer first?

Ivo
-
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] chelsio: working NAPI

2006-12-08 Thread Stephen Hemminger
This driver tries to enable/disable NAPI at runtime, but 
does so in an unsafe manner, and the NAPI interrupt handling is
a mess. Replace it with a compile time selected NAPI implementation.

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

---
 drivers/net/Kconfig |8 +++
 drivers/net/chelsio/cxgb2.c |   23 ++--
 drivers/net/chelsio/sge.c   |  113 ++--
 drivers/net/chelsio/sge.h   |4 +
 4 files changed, 66 insertions(+), 82 deletions(-)

--- chelsio.orig/drivers/net/chelsio/sge.c
+++ chelsio/drivers/net/chelsio/sge.c
@@ -1413,16 +1413,20 @@ static int sge_rx(struct sge *sge, struc
 
if (unlikely(adapter-vlan_grp  p-vlan_valid)) {
st-vlan_xtract++;
-   if (adapter-params.sge.polling)
+#ifdef CONFIG_CHELSIO_T1_NAPI
vlan_hwaccel_receive_skb(skb, adapter-vlan_grp,
 ntohs(p-vlan));
-   else
+#else
vlan_hwaccel_rx(skb, adapter-vlan_grp,
ntohs(p-vlan));
-   } else if (adapter-params.sge.polling)
+#endif
+   } else {
+#ifdef CONFIG_CHELSIO_T1_NAPI
netif_receive_skb(skb);
-   else
+#else
netif_rx(skb);
+#endif
+   }
return 0;
 }
 
@@ -1572,6 +1576,7 @@ static int process_responses(struct adap
return budget;
 }
 
+#ifdef CONFIG_CHELSIO_T1_NAPI
 /*
  * A simpler version of process_responses() that handles only pure (i.e.,
  * non data-carrying) responses.  Such respones are too light-weight to justify
@@ -1619,92 +1624,76 @@ static int process_pure_responses(struct
  * or protection from interrupts as data interrupts are off at this point and
  * other adapter interrupts do not interfere.
  */
-static int t1_poll(struct net_device *dev, int *budget)
+int t1_poll(struct net_device *dev, int *budget)
 {
struct adapter *adapter = dev-priv;
int effective_budget = min(*budget, dev-quota);
-
int work_done = process_responses(adapter, effective_budget);
+
*budget -= work_done;
dev-quota -= work_done;
 
if (work_done = effective_budget)
return 1;
 
+   spin_lock_irq(adapter-async_lock);
__netif_rx_complete(dev);
-
-   /*
-* Because we don't atomically flush the following write it is
-* possible that in very rare cases it can reach the device in a way
-* that races with a new response being written plus an error interrupt
-* causing the NAPI interrupt handler below to return unhandled status
-* to the OS.  To protect against this would require flushing the write
-* and doing both the write and the flush with interrupts off.  Way too
-* expensive and unjustifiable given the rarity of the race.
-*/
writel(adapter-sge-respQ.cidx, adapter-regs + A_SG_SLEEPING);
-   return 0;
-}
+   writel(adapter-slow_intr_mask | F_PL_INTR_SGE_DATA,
+  adapter-regs + A_PL_ENABLE);
+   spin_unlock_irq(adapter-async_lock);
 
-/*
- * Returns true if the device is already scheduled for polling.
- */
-static inline int napi_is_scheduled(struct net_device *dev)
-{
-   return test_bit(__LINK_STATE_RX_SCHED, dev-state);
+   return 0;
 }
 
 /*
  * NAPI version of the main interrupt handler.
  */
-static irqreturn_t t1_interrupt_napi(int irq, void *data)
+irqreturn_t t1_interrupt(int irq, void *data)
 {
-   int handled;
struct adapter *adapter = data;
+   struct net_device *dev = adapter-sge-netdev;
struct sge *sge = adapter-sge;
-   struct respQ *q = adapter-sge-respQ;
+   u32 cause;
+   int handled = 0;
 
-   /*
-* Clear the SGE_DATA interrupt first thing.  Normally the NAPI
-* handler has control of the response queue and the interrupt handler
-* can look at the queue reliably only once it knows NAPI is off.
-* We can't wait that long to clear the SGE_DATA interrupt because we
-* could race with t1_poll rearming the SGE interrupt, so we need to
-* clear the interrupt speculatively and really early on.
-*/
-   writel(F_PL_INTR_SGE_DATA, adapter-regs + A_PL_CAUSE);
+   cause = readl(adapter-regs + A_PL_CAUSE);
+   if (cause == 0 || cause == ~0)
+   return IRQ_NONE;
 
spin_lock(adapter-async_lock);
-   if (!napi_is_scheduled(sge-netdev)) {
+   if (cause  F_PL_INTR_SGE_DATA) {
+   struct respQ *q = adapter-sge-respQ;
struct respQ_e *e = q-entries[q-cidx];
 
-   if (e-GenerationBit == q-genbit) {
-   if (e-DataValid ||
-   process_pure_responses(adapter, e)) {
-   if 
(likely(__netif_rx_schedule_prep(sge-netdev)))
-   __netif_rx_schedule(sge-netdev);
-   else if 

Re: [Devel] Re: Network virtualization/isolation

2006-12-08 Thread Eric W. Biederman
Herbert Poetzl [EMAIL PROTECTED] writes:

 But, ok, it is not the real point to argue so much imho and waste our
 time instead of doing things.

 well, IMHO better talk (and think) first, then implement
 something ... not the other way round, and then start
 fixing up the mess ...

Well we need a bit of both.

This is thankfully not exported to user space, so as long as our
implementation is correct it doesn't much matter.

I do agree with the point that context may make sense.  I have
yet to be convinced though.

Eric
-
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: [NETLINK]: Restore API compatibility of address and neighbour bits

2006-12-08 Thread David Miller
From: Stefan Rompf [EMAIL PROTECTED]
Date: Fri, 8 Dec 2006 15:25:18 +0100 (MET)

 The _RTA and _PAYLOAD-macros are also part of userspace headers and need to be
 restored. Both dhcpclient and quagga need at least IFA_RTA and IFLA_RTA to
 compile, but there may be more macros than in the following patch. You may 
 want
 to look at keepalived, iproute, ...

Those are not coming back, sorry.  They are really broken
and usage is extremely discouraged.

iproute got fixed, dhcpclient and friends should get fixed to not use
them either

-
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 7635] New: ioctl(fd,TCSBRK,1) on socket yields EFAULT, expected EINVAL/ENOTTY

2006-12-08 Thread David Miller
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Fri, 8 Dec 2006 09:50:55 -0800

 ioctl(TCSBRK,1)   errno
 pty   0
 pipe  22/EINVAL
 /dev/null 25/ENOTTY
 reg_file  25/ENOTTY
 socket14/EFAULT

If you call a TTY ioctl on a socket, it might not work, don't
you think?

ioctl values are numbered in the namespace of the object they are
called upon, so an ioctl of value X can mean something different for a
TTY than it does for socket.

You're passing a garbage pointer to whatever socket ioctl happens
to be aliased to the same value as TCSBRK on your platform.
-
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: [NETLINK]: Restore API compatibility of address and neighbour bits

2006-12-08 Thread Daniel Jacobowitz
On Fri, Dec 08, 2006 at 01:33:34PM -0800, David Miller wrote:
 From: Stefan Rompf [EMAIL PROTECTED]
 Date: Fri, 8 Dec 2006 15:25:18 +0100 (MET)
 
  The _RTA and _PAYLOAD-macros are also part of userspace headers and need to 
  be
  restored. Both dhcpclient and quagga need at least IFA_RTA and IFLA_RTA to
  compile, but there may be more macros than in the following patch. You may 
  want
  to look at keepalived, iproute, ...
 
 Those are not coming back, sorry.  They are really broken
 and usage is extremely discouraged.
 
 iproute got fixed, dhcpclient and friends should get fixed to not use
 them either

Does this mean glibc should also?

-- 
Daniel Jacobowitz
CodeSourcery
-
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: [NETLINK]: Restore API compatibility of address and neighbour bits

2006-12-08 Thread David Miller
From: Daniel Jacobowitz [EMAIL PROTECTED]
Date: Fri, 8 Dec 2006 16:36:14 -0500

 On Fri, Dec 08, 2006 at 01:33:34PM -0800, David Miller wrote:
  From: Stefan Rompf [EMAIL PROTECTED]
  Date: Fri, 8 Dec 2006 15:25:18 +0100 (MET)
  
   The _RTA and _PAYLOAD-macros are also part of userspace headers and need 
   to be
   restored. Both dhcpclient and quagga need at least IFA_RTA and IFLA_RTA to
   compile, but there may be more macros than in the following patch. You 
   may want
   to look at keepalived, iproute, ...
  
  Those are not coming back, sorry.  They are really broken
  and usage is extremely discouraged.
  
  iproute got fixed, dhcpclient and friends should get fixed to not use
  them either
 
 Does this mean glibc should also?

GLIBC does not use them.
-
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: [NETLINK]: Restore API compatibility of address and neighbour bits

2006-12-08 Thread Daniel Jacobowitz
On Fri, Dec 08, 2006 at 01:47:52PM -0800, David Miller wrote:
The _RTA and _PAYLOAD-macros are also part of userspace headers and 
need to be
restored. Both dhcpclient and quagga need at least IFA_RTA and IFLA_RTA 
to
compile, but there may be more macros than in the following patch. You 
may want
to look at keepalived, iproute, ...

 GLIBC does not use them.

Aren't these the ones you're talking about?

sysdeps/unix/sysv/linux/check_pf.c:   struct rtattr *rta = 
IFA_RTA (ifam);
sysdeps/unix/sysv/linux/if_index.c:   struct rtattr *rta = IFLA_RTA 
(ifim);
sysdeps/unix/sysv/linux/ifaddrs.c:struct rtattr *rta = IFLA_RTA 
(ifim);
sysdeps/unix/sysv/linux/ifaddrs.c:struct rtattr *rta = IFLA_RTA 
(ifim);
sysdeps/unix/sysv/linux/ifaddrs.c:struct rtattr *rta = IFA_RTA 
(ifam);

sysdeps/unix/sysv/linux/if_index.c:   size_t rtasize = IFLA_PAYLOAD 
(nlh);
sysdeps/unix/sysv/linux/if_index.c:   size_t rta_payload = 
RTA_PAYLOAD (rta);
sysdeps/unix/sysv/linux/ifaddrs.c:size_t rtasize = IFLA_PAYLOAD 
(nlh);
sysdeps/unix/sysv/linux/ifaddrs.c:size_t rta_payload = 
RTA_PAYLOAD (rta);
sysdeps/unix/sysv/linux/ifaddrs.c:size_t rtasize = IFLA_PAYLOAD 
(nlh);
sysdeps/unix/sysv/linux/ifaddrs.c:size_t rta_payload = 
RTA_PAYLOAD (rta);
sysdeps/unix/sysv/linux/ifaddrs.c:size_t rtasize = IFA_PAYLOAD 
(nlh);
sysdeps/unix/sysv/linux/ifaddrs.c:size_t rta_payload = 
RTA_PAYLOAD (rta);

-- 
Daniel Jacobowitz
CodeSourcery
-
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 7635] New: ioctl(fd,TCSBRK,1) on socket yields EFAULT, expected EINVAL/ENOTTY

2006-12-08 Thread Stephen Hemminger
On Fri, 08 Dec 2006 13:36:33 -0800 (PST)
David Miller [EMAIL PROTECTED] wrote:

 From: Stephen Hemminger [EMAIL PROTECTED]
 Date: Fri, 8 Dec 2006 09:50:55 -0800
 
  ioctl(TCSBRK,1) errno
  pty 0
  pipe22/EINVAL
  /dev/null   25/ENOTTY
  reg_file25/ENOTTY
  socket  14/EFAULT
 
 If you call a TTY ioctl on a socket, it might not work, don't
 you think?
 
 ioctl values are numbered in the namespace of the object they are
 called upon, so an ioctl of value X can mean something different for a
 TTY than it does for socket.

That is not true on BSD or other unix standardish ioctl's.
There are no conflicts between the TIOC... values and the SIOC... values

 You're passing a garbage pointer to whatever socket ioctl happens
 to be aliased to the same value as TCSBRK on your platform.

It's not the garbage pointer. 

Seems like one of those annoying standards compliance test
return value bugs that shouldn't really hit an application.
-- 
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: [openib-general] [RFC] [PATCH V2 0/3] bonding support foroperation over IPoIB

2006-12-08 Thread Or Gerlitz

On 12/8/06, Carl Yang (caryang) [EMAIL PROTECTED] wrote:

Can you please forward me (or to the email alias) an example bonding
sysfs script which can be used to set bonding to work with patches 1-3?


Sure, i did it along with sending the patches, you can the thing here:
http://marc.theaimsgroup.com/?l=linux-netdevm=116488445829045w=2

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


Re: [PATCH 3/16] Spidernet RX Locking

2006-12-08 Thread Benjamin Herrenschmidt
A spinlock is expensive in the fast path, which is why Jeff says it's
invasive.

 spider_net_decode_one_descr() is called from
 spider_net_poll() (which is the netdev-poll callback)
 and also from spider_net_handle_rxram_full(). 
 
 The rxramfull routine is called from a tasklet that
 is fired off after a RX ram full interrupt is receved.
 This interrupt is generated when the hardware runs out
 of space to store incoming packets. We are seeing this
 interrupt fire when the CPU is heavily loaded, and a
 lot of traffic is being fired at the device.

How often does that interrupt happen in that case ?

A better approach is to keep the fast path (ie. poll()) lockless, and in
handle_rxram_full(), the slow path, protect against poll using
netif_disable_poll(). Though that means using a work queue, not a
tasklet, since it needs to schedule.

  and what other 
  non-sledgehammer approaches were discarded before arriving at this one?
 
 Well, I'm not that good at kernel programming, so I guess
 I did not perceive this as a sledgehammer.  And alternative
 approach is to simply ignore the rxramfull interrupt entirely,
 and depend on poll() do all the work.   I'll try this shortly.

or you can schedule rx work from the rxramfull interrupt after setting a
something bad happened flag. Then, poll can check this flag and do the
right thing.

Ben.


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


[PATCH 04/22] e1000: display FC link properties

2006-12-08 Thread Kok, Auke

Previously there was no way of determining the actual flow control
properties of a link state. We display them at link up to provide
this information as some other drivers do. Ethtool needs probably
to add this status information.

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

 drivers/net/e1000/e1000_main.c |   15 +++
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 73f3a85..fae30c7 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2454,15 +2454,22 @@ e1000_watchdog(unsigned long data)
 
if (link) {
if (!netif_carrier_ok(netdev)) {
+   uint32_t ctrl;
boolean_t txb2b = 1;
e1000_get_speed_and_duplex(adapter-hw,
   adapter-link_speed,
   adapter-link_duplex);
 
-   DPRINTK(LINK, INFO, NIC Link is Up %d Mbps %s\n,
-  adapter-link_speed,
-  adapter-link_duplex == FULL_DUPLEX ?
-  Full Duplex : Half Duplex);
+   ctrl = E1000_READ_REG(adapter-hw, CTRL);
+   DPRINTK(LINK, INFO, NIC Link is Up %d Mbps %s, 
+   Flow Control: %s\n,
+   adapter-link_speed,
+   adapter-link_duplex == FULL_DUPLEX ?
+   Full Duplex : Half Duplex,
+   ((ctrl  E1000_CTRL_TFCE)  (ctrl 
+   E1000_CTRL_RFCE)) ? RX/TX : ((ctrl 
+   E1000_CTRL_RFCE) ? RX : ((ctrl 
+   E1000_CTRL_TFCE) ? TX : None )));
 
/* tweak tx_queue_len according to speed/duplex
 * and adjust the timeout factor */



---
Auke Kok [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 02/22] ixgb: Maybe stop TX if not enough free descriptors

2006-12-08 Thread Kok, Auke

A similar patch to commit 65c7973fa5b46b024f38be208aa477e8daf9a603
but now for ixgb.

Cc: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/ixgb/ixgb.h |1 +
 drivers/net/ixgb/ixgb_ethtool.c |1 +
 drivers/net/ixgb/ixgb_main.c|   37 ++---
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 50ffe90..f4aba43 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -171,6 +171,7 @@ struct ixgb_adapter {
 
/* TX */
struct ixgb_desc_ring tx_ring cacheline_aligned_in_smp;
+   unsigned int restart_queue;
unsigned long timeo_start;
uint32_t tx_cmd_type;
uint64_t hw_csum_tx_good;
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index cd22523..82c044d 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -79,6 +79,7 @@ static struct ixgb_stats ixgb_gstrings_s
{tx_window_errors, IXGB_STAT(net_stats.tx_window_errors)},
{tx_deferred_ok, IXGB_STAT(stats.dc)},
{tx_timeout_count, IXGB_STAT(tx_timeout_count) },
+   {tx_restart_queue, IXGB_STAT(restart_queue) },
{rx_long_length_errors, IXGB_STAT(stats.roc)},
{rx_short_length_errors, IXGB_STAT(stats.ruc)},
 #ifdef NETIF_F_TSO
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index ebc9d71..9522d5e 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1414,6 +1414,37 @@ ixgb_tx_queue(struct ixgb_adapter *adapt
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,
+  struct ixgb_desc_ring *tx_ring, int size)
+{
+   if (likely(IXGB_DESC_UNUSED(tx_ring) = size))
+   return 0;
+   return __ixgb_maybe_stop_tx(netdev, size);
+}
+
+
 /* Tx Descriptors needed, worst case */
 #define TXD_USE_COUNT(S) (((S)  IXGB_MAX_TXD_PWR) + \
 (((S)  (IXGB_MAX_DATA_PER_TXD - 1)) ? 1 : 0))
@@ -1447,7 +1478,8 @@ ixgb_xmit_frame(struct sk_buff *skb, str
spin_lock_irqsave(adapter-tx_lock, flags);
 #endif
 
-   if(unlikely(IXGB_DESC_UNUSED(adapter-tx_ring)  DESC_NEEDED)) {
+   if (unlikely(ixgb_maybe_stop_tx(netdev, adapter-tx_ring,
+ DESC_NEEDED))) {
netif_stop_queue(netdev);
spin_unlock_irqrestore(adapter-tx_lock, flags);
return NETDEV_TX_BUSY;
@@ -1485,8 +1517,7 @@ ixgb_xmit_frame(struct sk_buff *skb, str
 
 #ifdef NETIF_F_LLTX
/* Make sure there is space in the ring for the next send. */
-   if(unlikely(IXGB_DESC_UNUSED(adapter-tx_ring)  DESC_NEEDED))
-   netif_stop_queue(netdev);
+   ixgb_maybe_stop_tx(netdev, adapter-tx_ring, DESC_NEEDED);
 
spin_unlock_irqrestore(adapter-tx_lock, flags);
 



---
Auke Kok [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 03/22] ixgb: Write RA register high word first, increment version

2006-12-08 Thread Kok, Auke

We need to disable the AV bit before flushing the low register.

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

 drivers/net/ixgb/ixgb_hw.c   |3 ++-
 drivers/net/ixgb/ixgb_main.c |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index 02089b6..ecbf458 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -399,8 +399,9 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)
/* Zero out the other 15 receive addresses. */
DEBUGOUT(Clearing RAR[1-15]\n);
for(i = 1; i  IXGB_RAR_ENTRIES; i++) {
-   IXGB_WRITE_REG_ARRAY(hw, RA, (i  1), 0);
+   /* Write high reg first to disable the AV bit first */
IXGB_WRITE_REG_ARRAY(hw, RA, ((i  1) + 1), 0);
+   IXGB_WRITE_REG_ARRAY(hw, RA, (i  1), 0);
}
 
return;
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 9522d5e..d70accb 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -36,7 +36,7 @@ static char ixgb_driver_string[] = Inte
 #else
 #define DRIVERNAPI -NAPI
 #endif
-#define DRV_VERSION1.0.117-k2DRIVERNAPI
+#define DRV_VERSION1.0.126-k2DRIVERNAPI
 char ixgb_driver_version[] = DRV_VERSION;
 static char ixgb_copyright[] = Copyright (c) 1999-2006 Intel Corporation.;
 



---
Auke Kok [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 01/22] e1000: Fix early TSO completion

2006-12-08 Thread Kok, Auke

This fix was already merged in commit 96f9c2e277768099479fbed7c3b69c294b1fadef
but reverted in commit 989316ddfeafd0e8fb51a4d811383769ad62637a. After
stresstesting we found that the fix does not add new regressions and
works around a TX hang spotted by several users.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/ixgb/ixgb_main.c |   21 +++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index e628126..ebc9d71 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1287,6 +1287,9 @@ ixgb_tx_map(struct ixgb_adapter *adapter
struct ixgb_buffer *buffer_info;
int len = skb-len;
unsigned int offset = 0, size, count = 0, i;
+#ifdef NETIF_F_TSO
+   unsigned int mss = skb_shinfo(skb)-gso_size;
+#endif
 
unsigned int nr_frags = skb_shinfo(skb)-nr_frags;
unsigned int f;
@@ -1298,6 +1301,12 @@ ixgb_tx_map(struct ixgb_adapter *adapter
while(len) {
buffer_info = tx_ring-buffer_info[i];
size = min(len, IXGB_MAX_DATA_PER_TXD);
+#ifdef NETIF_F_TSO
+   /* 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;
+#endif
buffer_info-length = size;
WARN_ON(buffer_info-dma != 0);
buffer_info-dma =
@@ -1324,6 +1333,13 @@ ixgb_tx_map(struct ixgb_adapter *adapter
while(len) {
buffer_info = tx_ring-buffer_info[i];
size = min(len, IXGB_MAX_DATA_PER_TXD);
+#ifdef NETIF_F_TSO
+   /* 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;
+#endif
buffer_info-length = size;
buffer_info-dma =
pci_map_page(adapter-pdev,
@@ -1401,8 +1417,9 @@ ixgb_tx_queue(struct ixgb_adapter *adapt
 /* Tx Descriptors needed, worst case */
 #define TXD_USE_COUNT(S) (((S)  IXGB_MAX_TXD_PWR) + \
 (((S)  (IXGB_MAX_DATA_PER_TXD - 1)) ? 1 : 0))
-#define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD) + \
-   MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1
+#define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD) /* skb-date */ + \
+   MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1 /* for context */ \
+   + 1 /* one more needed for sentinel TSO workaround */
 
 static int
 ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)



---
Auke Kok [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 00/22] ixgb, e1000 fixes

2006-12-08 Thread Kok, Auke

Hi,

This patch series contains exclusively fixes for ixgb and e1000. Most
importantly, it addresses two issues in the recently merged msi interrupt
handler and dynamic itr code, as well as some major manageability
feature handling code.

These patches apply against netdev-2.6 #upstream-linus commit
0ae851352a87db3f829511816a2da227860bf585. Please pull:

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

to receive them.

Cheers,

Auke

---
Bruce Allan [EMAIL PROTECTED]:
 e1000: Fix PBA allocation calculations
 e1000: set max frame size before enabling new link settings

Jesse Brandeburg [EMAIL PROTECTED]:
 e1000: Fix early TSO completion
 ixgb: Maybe stop TX if not enough free descriptors
 e1000: dynamic itr code fixes
 e1000: minor tso ipv6 cleanups
 e1000: omit stats for broken counter in 82543
 e1000: Fix all manageability workarounds
 e1000: Make copybreak parameter changeable by user.
 e1000: Fire a link even interrupt instead of a watchdog at init.
 e1000: Fix powerdown link loss when forced to gig speed
 e1000: disable TSO when debugging slab
 e1000: always turn on receives on esb2
 e1000: simplify msi specific interrupt handler
 e1000: Rewrite parm handling code to warn when forcing autoneg to gig only.
 e1000: Don't set tipg (fiber) timings for pci-e adapters to fix fiber 
output
 e1000: Fix poor quad port performance with NAPI

Jeff Kirsher [EMAIL PROTECTED]:
 e1000: For older adapters, we know that the pci bus type is pci.

Auke Kok [EMAIL PROTECTED]:
 e1000: display FC link properties
 e1000: Version increment 7.3.20-k2 and minor cleanups

Aaron Salter [EMAIL PROTECTED]:
 ixgb: Write RA register high word first, increment version

---
 drivers/net/e1000/e1000.h |7 +-
 drivers/net/e1000/e1000_ethtool.c |3 +
 drivers/net/e1000/e1000_hw.c  |   59 +++---
 drivers/net/e1000/e1000_hw.h  |2 +
 drivers/net/e1000/e1000_main.c|  455 -
 drivers/net/e1000/e1000_osdep.h   |9 +-
 drivers/net/e1000/e1000_param.c   |   19 +-
 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  |   60 +-
 11 files changed, 398 insertions(+), 221 deletions(-)


---
Auke Kok [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 06/22] e1000: minor tso ipv6 cleanups

2006-12-08 Thread Kok, Auke

Zero descriptor ip_config field and use skb_shinfo to detect IPV6 packet.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index f39b244..dc76e01 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2780,7 +2780,7 @@ e1000_tso(struct e1000_adapter *adapter,
cmd_length = E1000_TXD_CMD_IP;
ipcse = skb-h.raw - skb-data - 1;
 #ifdef NETIF_F_TSO6
-   } else if (skb-protocol == htons(ETH_P_IPV6)) {
+   } else if (skb_shinfo(skb)-gso_type == SKB_GSO_TCPV6) {
skb-nh.ipv6h-payload_len = 0;
skb-h.th-check =
~csum_ipv6_magic(skb-nh.ipv6h-saddr,
@@ -2843,6 +2843,7 @@ e1000_tx_csum(struct e1000_adapter *adap
buffer_info = tx_ring-buffer_info[i];
context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
 
+   context_desc-lower_setup.ip_config = 0;
context_desc-upper_setup.tcp_fields.tucss = css;
context_desc-upper_setup.tcp_fields.tucso = css + 
skb-csum_offset;
context_desc-upper_setup.tcp_fields.tucse = 0;



---
Auke Kok [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 15/22] e1000: simplify msi specific interrupt handler

2006-12-08 Thread Kok, Auke

Simplify the msi interrupt handler to avoid issues with delayed ICR reads.
This avoids adapter specific problems at the cost of some performance.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000.h  |1 -
 drivers/net/e1000/e1000_main.c |   60 +---
 2 files changed, 19 insertions(+), 42 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index f091042..8e7acb0 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -257,7 +257,6 @@ struct e1000_adapter {
spinlock_t tx_queue_lock;
 #endif
atomic_t irq_sem;
-   unsigned int detect_link;
unsigned int total_tx_bytes;
unsigned int total_tx_packets;
unsigned int total_rx_bytes;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 67fc379..cb6b732 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3778,8 +3778,8 @@ e1000_update_stats(struct e1000_adapter 
  * @data: pointer to a network interface device structure
  **/
 
-static
-irqreturn_t e1000_intr_msi(int irq, void *data)
+static irqreturn_t
+e1000_intr_msi(int irq, void *data)
 {
struct net_device *netdev = data;
struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -3787,49 +3787,27 @@ irqreturn_t e1000_intr_msi(int irq, void
 #ifndef CONFIG_E1000_NAPI
int i;
 #endif
+   uint32_t icr = E1000_READ_REG(hw, ICR);
 
-   /* this code avoids the read of ICR but has to get 1000 interrupts
-* at every link change event before it will notice the change */
-   if (++adapter-detect_link = 1000) {
-   uint32_t icr = E1000_READ_REG(hw, ICR);
 #ifdef CONFIG_E1000_NAPI
-   /* read ICR disables interrupts using IAM, so keep up with our
-* enable/disable accounting */
-   atomic_inc(adapter-irq_sem);
+   /* read ICR disables interrupts using IAM, so keep up with our
+* enable/disable accounting */
+   atomic_inc(adapter-irq_sem);
 #endif
-   adapter-detect_link = 0;
-   if ((icr  (E1000_ICR_RXSEQ | E1000_ICR_LSC)) 
-   (icr  E1000_ICR_INT_ASSERTED)) {
-   hw-get_link_status = 1;
-   /* 80003ES2LAN workaround--
-   * For packet buffer work-around on link down event;
-   * disable receives here in the ISR and
-   * reset adapter in watchdog
-   */
-   if (netif_carrier_ok(netdev) 
-   (adapter-hw.mac_type == e1000_80003es2lan)) {
-   /* disable receives */
-   uint32_t rctl = E1000_READ_REG(hw, RCTL);
-   E1000_WRITE_REG(hw, RCTL, rctl  
~E1000_RCTL_EN);
-   }
-   /* guard against interrupt when we're going down */
-   if (!test_bit(__E1000_DOWN, adapter-flags))
-   mod_timer(adapter-watchdog_timer,
- jiffies + 1);
+   if (icr  (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
+   hw-get_link_status = 1;
+   /* 80003ES2LAN workaround-- For packet buffer work-around on
+* link down event; disable receives here in the ISR and reset
+* adapter in watchdog */
+   if (netif_carrier_ok(netdev) 
+   (adapter-hw.mac_type == e1000_80003es2lan)) {
+   /* disable receives */
+   uint32_t rctl = E1000_READ_REG(hw, RCTL);
+   E1000_WRITE_REG(hw, RCTL, rctl  ~E1000_RCTL_EN);
}
-   } else {
-   E1000_WRITE_REG(hw, ICR, (0x  ~(E1000_ICR_RXSEQ |
-E1000_ICR_LSC)));
-   /* bummer we have to flush here, but things break otherwise as
-* some event appears to be lost or delayed and throughput
-* drops.  In almost all tests this flush is un-necessary */
-   E1000_WRITE_FLUSH(hw);
-#ifdef CONFIG_E1000_NAPI
-   /* Interrupt Auto-Mask (IAM)...upon writing ICR, interrupts are
-* masked.  No need for the IMC write, but it does mean we
-* should account for it ASAP. */
-   atomic_inc(adapter-irq_sem);
-#endif
+   /* guard against interrupt when we're going down */
+   if (!test_bit(__E1000_DOWN, adapter-flags))
+   mod_timer(adapter-watchdog_timer, jiffies + 1);
}
 
 #ifdef CONFIG_E1000_NAPI



---
Auke Kok [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  

[PATCH 14/22] e1000: always turn on receives on esb2

2006-12-08 Thread Kok, Auke

In rare occasions, esb2 systems would end up started without the RX
unit being turned on. Add a check that runs post-init to make sure.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 12f9f61..67fc379 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2673,6 +2673,13 @@ e1000_watchdog(unsigned long data)
netif_wake_queue(netdev);
mod_timer(adapter-phy_info_timer, jiffies + 2 * HZ);
adapter-smartspeed = 0;
+   } else {
+   /* make sure the receive unit is started */
+   if (adapter-hw.mac_type == e1000_80003es2lan) {
+   struct e1000_hw *hw = adapter-hw;
+   uint32_t rctl = E1000_READ_REG(hw, RCTL);
+   E1000_WRITE_REG(hw, RCTL, rctl | E1000_RCTL_EN);
+   }
}
} else {
if (netif_carrier_ok(netdev)) {



---
Auke Kok [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 22/22] # This series applies on GIT commit 0ae851352a87db3f829511816a2da227860bf585

2006-12-08 Thread Kok, Auke

00_ixgb_sentinel.patch
01_ixgb_maybe_stop_tx.patch
02_ixgb_reorder_write.patch
03_e1000_add_fc_detect_printout.patch
04_e1000_itr_fixups.patch
05_e1000_cosmetic_csum_changes.patch
06_e1000_fix_tx_carrier_errors.patch
07_e1000_init_release_manageability.patch
08_e1000_pba_calc.patch
09_e1000_copybreak_size_parm.patch
10_e1000_fire_link_event.patch
11_e1000_phy_link_power_mode.patch
12_e1000_debug_slab_82544.patch
13_e1000_start_rx_unit.patch
14_e1000_msi_intr_fixes.patch
15_e1000_gig_full_forcing.patch
16_e1000_set_framesiz_before_reset.patch
17_e1000_set_type_to_pci.patch
18_e1000_tipg_type.patch
19_e1000_e1000_clean_tx_irq.patch
20_e1000_cleanups_version.patch
---

 0 files changed, 0 insertions(+), 0 deletions(-)




---
Auke Kok [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 20/22] e1000: Fix poor quad port performance with NAPI

2006-12-08 Thread Kok, Auke

This fix attempts to solve a customer reported issue with NAPI enabled
e1000 having bad performance when transmitting simultaneously on
four ports.  The issue comes down to an interaction between NAPI
hardware interrupt balancing, and the driver rescheduling poll on
the same processor.

We try to fix by allowing the driver to re-enable interrupts sooner
instead of polling one more time, when there was recently all the
work completed in cleanup.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |   25 -
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 1a2b052..458aa38 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3826,7 +3826,7 @@ e1000_intr_msi(int irq, void *data)
 
for (i = 0; i  E1000_MAX_INTR; i++)
if (unlikely(!adapter-clean_rx(adapter, adapter-rx_ring) 
-  !e1000_clean_tx_irq(adapter, adapter-tx_ring)))
+  e1000_clean_tx_irq(adapter, adapter-tx_ring)))
break;
 
if (likely(adapter-itr_setting  3))
@@ -3979,7 +3979,7 @@ e1000_clean(struct net_device *poll_dev,
poll_dev-quota -= work_done;
 
/* If no Tx and not enough Rx work done, exit the polling mode */
-   if ((!tx_cleaned  (work_done == 0)) ||
+   if ((tx_cleaned  (work_done  work_to_do)) ||
   !netif_running(poll_dev)) {
 quit_polling:
if (likely(adapter-itr_setting  3))
@@ -4009,7 +4009,7 @@ e1000_clean_tx_irq(struct e1000_adapter 
 #ifdef CONFIG_E1000_NAPI
unsigned int count = 0;
 #endif
-   boolean_t cleaned = FALSE;
+   boolean_t cleaned = TRUE;
unsigned int total_tx_bytes=0, total_tx_packets=0;
 
i = tx_ring-next_to_clean;
@@ -4025,13 +4025,17 @@ e1000_clean_tx_irq(struct e1000_adapter 
if (cleaned) {
struct sk_buff *skb = buffer_info-skb;
 #ifdef NETIF_F_TSO
-   unsigned int segs = skb_shinfo(skb)-gso_segs;
-   if (segs)
-   total_tx_packets += segs;
-#endif
-
+   unsigned int segs, bytecount;
+   segs = skb_shinfo(skb)-gso_segs ?: 1;
+   /* multiply data chunks by size of headers */
+   bytecount = ((segs - 1) * skb_headlen(skb)) +
+   skb-len;
+   total_tx_packets += segs;
+   total_tx_bytes += bytecount;
+#else
total_tx_packets++;
total_tx_bytes += skb-len;
+#endif
}
e1000_unmap_and_free_tx_resource(adapter, buffer_info);
tx_desc-upper.data = 0;
@@ -4044,7 +4048,10 @@ e1000_clean_tx_irq(struct e1000_adapter 
 #ifdef CONFIG_E1000_NAPI
 #define E1000_TX_WEIGHT 64
/* weight of a sort for tx, to avoid endless transmit cleanup */
-   if (count++ == E1000_TX_WEIGHT) break;
+   if (count++ == E1000_TX_WEIGHT) {
+   cleaned = FALSE;
+   break;
+   }
 #endif
}
 



---
Auke Kok [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 07/22] e1000: omit stats for broken counter in 82543

2006-12-08 Thread Kok, Auke

82543 does not count tx_carrier_errors properly in FD mode.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index dc76e01..7639b4d 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3592,7 +3592,12 @@ e1000_update_stats(struct e1000_adapter 
adapter-net_stats.tx_errors = adapter-stats.txerrc;
adapter-net_stats.tx_aborted_errors = adapter-stats.ecol;
adapter-net_stats.tx_window_errors = adapter-stats.latecol;
-   adapter-net_stats.tx_carrier_errors = adapter-stats.tncrs;
+   if (adapter-hw.mac_type == e1000_82543 
+   adapter-link_duplex == FULL_DUPLEX) {
+   adapter-net_stats.tx_carrier_errors = 0;
+   adapter-stats.tncrs = 0;
+   } else
+   adapter-net_stats.tx_carrier_errors = adapter-stats.tncrs;
 
/* Tx Dropped needs to be maintained elsewhere */
 



---
Auke Kok [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 09/22] e1000: Fix PBA allocation calculations

2006-12-08 Thread Kok, Auke

Assign the PBA to be large enough to contain at least 2 jumbo frames on
all adapters. This dramatically increases performance on several adapters
and fixes TX performance degradation issues where the PBA was misallocated
in the old algorithm.

Signed-off-by: Bruce Allan [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |  100 ++--
 1 files changed, 86 insertions(+), 14 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 0d8fd01..a7dba40 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -662,16 +662,34 @@ e1000_reinit_locked(struct e1000_adapter
 void
 e1000_reset(struct e1000_adapter *adapter)
 {
-   uint32_t pba, manc;
+   uint32_t pba = 0, tx_space, min_tx_space, min_rx_space;
uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF;
+   boolean_t legacy_pba_adjust = FALSE;
 
/* Repartition Pba for greater than 9k mtu
 * To take effect CTRL.RST is required.
 */
 
switch (adapter-hw.mac_type) {
+   case e1000_82542_rev2_0:
+   case e1000_82542_rev2_1:
+   case e1000_82543:
+   case e1000_82544:
+   case e1000_82540:
+   case e1000_82541:
+   case e1000_82541_rev_2:
+   legacy_pba_adjust = TRUE;
+   pba = E1000_PBA_48K;
+   break;
+   case e1000_82545:
+   case e1000_82545_rev_3:
+   case e1000_82546:
+   case e1000_82546_rev_3:
+   pba = E1000_PBA_48K;
+   break;
case e1000_82547:
case e1000_82547_rev_2:
+   legacy_pba_adjust = TRUE;
pba = E1000_PBA_30K;
break;
case e1000_82571:
@@ -680,27 +698,81 @@ e1000_reset(struct e1000_adapter *adapte
pba = E1000_PBA_38K;
break;
case e1000_82573:
-   pba = E1000_PBA_12K;
+#define E1000_PBA_20K 0x0014
+   pba = E1000_PBA_20K;
break;
case e1000_ich8lan:
pba = E1000_PBA_8K;
-   break;
-   default:
-   pba = E1000_PBA_48K;
+   case e1000_undefined:
+   case e1000_num_macs:
break;
}
 
-   if ((adapter-hw.mac_type != e1000_82573) 
-  (adapter-netdev-mtu  E1000_RXBUFFER_8192))
-   pba -= 8; /* allocate more FIFO for Tx */
+   if (legacy_pba_adjust == TRUE) {
+   if (adapter-netdev-mtu  E1000_RXBUFFER_8192)
+   pba -= 8; /* allocate more FIFO for Tx */
 
+   if (adapter-hw.mac_type == e1000_82547) {
+   adapter-tx_fifo_head = 0;
+   adapter-tx_head_addr = pba  E1000_TX_HEAD_ADDR_SHIFT;
+   adapter-tx_fifo_size =
+   (E1000_PBA_40K - pba)  E1000_PBA_BYTES_SHIFT;
+   atomic_set(adapter-tx_fifo_stall, 0);
+   }
+   } else if (adapter-hw.max_frame_size  MAXIMUM_ETHERNET_FRAME_SIZE) {
+   /* adjust PBA for jumbo frames */
+   E1000_WRITE_REG(adapter-hw, PBA, pba);
+
+   /* To maintain wire speed transmits, the Tx FIFO should be
+* large enough to accomodate two full transmit packets,
+* rounded up to the next 1KB and expressed in KB.  Likewise,
+* the Rx FIFO should be large enough to accomodate at least
+* one full receive packet and is similarly rounded up and
+* expressed in KB. */
+   pba = E1000_READ_REG(adapter-hw, PBA);
+   /* upper 16 bits has Tx packet buffer allocation size in KB */
+   tx_space = pba  16;
+   /* lower 16 bits has Rx packet buffer allocation size in KB */
+   pba = 0x;
+   /* don't include ethernet FCS because hardware appends/strips */
+   min_tx_space =
+   min_rx_space = adapter-netdev-mtu + ENET_HEADER_SIZE +
+  VLAN_TAG_SIZE;
+   min_tx_space *= 2;
+   E1000_ROUNDUP(min_tx_space, 1024);
+   min_tx_space = 10;
+   E1000_ROUNDUP(min_rx_space, 1024);
+   min_rx_space = 10;
+
+   /* If current Tx allocation is less than the min Tx FIFO size,
+* and the min Tx FIFO size is less than the current Rx FIFO
+* allocation, take space away from current Rx allocation */
+   if (tx_space  min_tx_space 
+   ((min_tx_space - tx_space)  pba)) {
+   pba = pba - (min_tx_space - tx_space);
 
-   if (adapter-hw.mac_type == e1000_82547) {
-   adapter-tx_fifo_head = 0;
-   adapter-tx_head_addr = pba  E1000_TX_HEAD_ADDR_SHIFT;
-   adapter-tx_fifo_size =
-   (E1000_PBA_40K - pba)  

[PATCH 05/22] e1000: dynamic itr code fixes

2006-12-08 Thread Kok, Auke

The dynamic interrupt rate control patches omitted proper counting
for jumbo's and TSO. We also  out the lower bits of a user-provided
hardcoded itr setting beccause they are used for control.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c  |   52 ++-
 drivers/net/e1000/e1000_param.c |4 ++-
 2 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index fae30c7..f39b244 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2635,29 +2635,38 @@ static unsigned int e1000_update_itr(str
if (packets == 0)
goto update_itr_done;
 
-
switch (itr_setting) {
case lowest_latency:
-   if ((packets  5)  (bytes  512))
+   /* handle TSO and jumbo frames */
+   if (bytes/packets  8000)
+   retval = bulk_latency;
+   else if ((packets  5)  (bytes  512)) {
retval = low_latency;
+   }
break;
case low_latency:  /* 50 usec aka 2 ints/s */
if (bytes  1) {
-   if ((packets  10) ||
-((bytes/packets)  1200))
+   /* this if handles the TSO accounting */
+   if (bytes/packets  8000) {
retval = bulk_latency;
-   else if ((packets  35))
+   } else if ((packets  10) || ((bytes/packets)  1200)) {
+   retval = bulk_latency;
+   } else if ((packets  35)) {
retval = lowest_latency;
-   } else if (packets = 2  bytes  512)
+   }
+   } else if (bytes/packets  2000) {
+   retval = bulk_latency;
+   } else if (packets = 2  bytes  512) {
retval = lowest_latency;
+   }
break;
case bulk_latency: /* 250 usec aka 4000 ints/s */
if (bytes  25000) {
-   if (packets  35)
-   retval = low_latency;
-   } else {
-   if (bytes  6000)
+   if (packets  35) {
retval = low_latency;
+   }
+   } else if (bytes  6000) {
+   retval = low_latency;
}
break;
}
@@ -2686,17 +2695,20 @@ static void e1000_set_itr(struct e1000_a
adapter-tx_itr,
adapter-total_tx_packets,
adapter-total_tx_bytes);
+   /* conservative mode (itr 3) eliminates the lowest_latency setting */
+   if (adapter-itr_setting == 3  adapter-tx_itr == lowest_latency)
+   adapter-tx_itr = low_latency;
+
adapter-rx_itr = e1000_update_itr(adapter,
adapter-rx_itr,
adapter-total_rx_packets,
adapter-total_rx_bytes);
+   /* conservative mode (itr 3) eliminates the lowest_latency setting */
+   if (adapter-itr_setting == 3  adapter-rx_itr == lowest_latency)
+   adapter-rx_itr = low_latency;
 
current_itr = max(adapter-rx_itr, adapter-tx_itr);
 
-   /* conservative mode eliminates the lowest_latency setting */
-   if (current_itr == lowest_latency  (adapter-itr_setting == 3))
-   current_itr = low_latency;
-
switch (current_itr) {
/* counts and packets in update_itr are dependent on these numbers */
case lowest_latency:
@@ -3875,11 +3887,15 @@ e1000_clean_tx_irq(struct e1000_adapter 
cleaned = (i == eop);
 
if (cleaned) {
-   /* this packet count is wrong for TSO but has a
-* tendency to make dynamic ITR change more
-* towards bulk */
+   struct sk_buff *skb = buffer_info-skb;
+#ifdef NETIF_F_TSO
+   unsigned int segs = skb_shinfo(skb)-gso_segs;
+   if (segs)
+   total_tx_packets += segs;
+#endif
+
total_tx_packets++;
-   total_tx_bytes += buffer_info-skb-len;
+   total_tx_bytes += skb-len;
}
e1000_unmap_and_free_tx_resource(adapter, buffer_info);
tx_desc-upper.data = 0;
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index cbfcd7f..cf2a279 

[PATCH 13/22] e1000: disable TSO when debugging slab

2006-12-08 Thread Kok, Auke

CONFIG_DEBUG_SLAB kills TSO on the 82544, so we're better off turing TSO
off in this rare case, assuming performance is not an issue for people
running slab debugging.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 9ddcadd..12f9f61 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -998,6 +998,12 @@ 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;



---
Auke Kok [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 19/22] e1000: Don't set tipg (fiber) timings for pci-e adapters to fix fiber output

2006-12-08 Thread Kok, Auke

the driver has (ancient) code for messing with TIPG from the 82542 days.
Unfortunately this code was running on our current adapters and setting
TIPG for fiber to be +1 over the copper value.  This caused 1.45Mpps
to be sent instead of 1.487Mpps.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 34ceff1..1a2b052 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1669,9 +1669,9 @@ e1000_configure_tx(struct e1000_adapter 
}
 
/* Set the default values for the Tx Inter Packet Gap timer */
-
-   if (hw-media_type == e1000_media_type_fiber ||
-   hw-media_type == e1000_media_type_internal_serdes)
+   if (adapter-hw.mac_type = e1000_82547_rev_2 
+   (hw-media_type == e1000_media_type_fiber ||
+hw-media_type == e1000_media_type_internal_serdes))
tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
else
tipg = DEFAULT_82543_TIPG_IPGT_COPPER;



---
Auke Kok [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 21/22] e1000: Version increment 7.3.20-k2 and minor cleanups

2006-12-08 Thread Kok, Auke

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

 drivers/net/e1000/e1000.h   |6 +
 drivers/net/e1000/e1000_hw.c|   52 +++
 drivers/net/e1000/e1000_hw.h|1 +
 drivers/net/e1000/e1000_main.c  |9 +++
 drivers/net/e1000/e1000_osdep.h |9 +--
 5 files changed, 32 insertions(+), 45 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 8e7acb0..7c48680 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -61,6 +61,7 @@
 #include linux/ip.h
 #ifdef NETIF_F_TSO6
 #include linux/ipv6.h
+#include net/ip6_checksum.h
 #endif
 #include linux/tcp.h
 #include linux/udp.h
@@ -85,11 +86,7 @@ struct e1000_adapter;
 
 #include e1000_hw.h
 
-#ifdef DBG
-#define E1000_DBG(args...) printk(KERN_DEBUG e1000:  args)
-#else
 #define E1000_DBG(args...)
-#endif
 
 #define E1000_ERR(args...) printk(KERN_ERR e1000:  args)
 
@@ -361,5 +358,4 @@ enum e1000_state_t {
__E1000_RESETTING,
__E1000_DOWN
 };
-
 #endif /* _E1000_H_ */
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 4ad6a11..9a295e0 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -718,8 +718,6 @@ e1000_reset_hw(struct e1000_hw *hw)
  *
  * hw: Struct containing variables accessed by shared code
  *
- * This function contains hardware limitation workarounds for PCI-E adapters
- *
  */
 static void
 e1000_initialize_hardware_bits(struct e1000_hw *hw)
@@ -731,14 +729,15 @@ e1000_initialize_hardware_bits(struct e1
 uint32_t reg_tctl;
 uint32_t reg_txdctl, reg_txdctl1;
 
-/* link autonegotiation/sync workarounds */
 reg_tarc0 = E1000_READ_REG(hw, TARC0);
+/* link autonegotiation/sync workarounds */
 reg_tarc0 = ~((1  30)|(1  29)|(1  28)|(1  27));
 
-/* Enable not-done TX descriptor counting */
 reg_txdctl = E1000_READ_REG(hw, TXDCTL);
+/* Enable not-done TX descriptor counting */
 reg_txdctl |= E1000_TXDCTL_COUNT_DESC;
 E1000_WRITE_REG(hw, TXDCTL, reg_txdctl);
+
 reg_txdctl1 = E1000_READ_REG(hw, TXDCTL1);
 reg_txdctl1 |= E1000_TXDCTL_COUNT_DESC;
 E1000_WRITE_REG(hw, TXDCTL1, reg_txdctl1);
@@ -746,18 +745,18 @@ e1000_initialize_hardware_bits(struct e1
 switch (hw-mac_type) {
 case e1000_82571:
 case e1000_82572:
-/* Clear PHY TX compatible mode bits */
 reg_tarc1 = E1000_READ_REG(hw, TARC1);
+reg_tctl = E1000_READ_REG(hw, TCTL);
+
+/* Clear PHY TX compatible mode bits */
 reg_tarc1 = ~((1  30)|(1  29));
 
 /* link autonegotiation/sync workarounds */
 reg_tarc0 |= ((1  26)|(1  25)|(1  24)|(1  23));
-
 /* TX ring control fixes */
 reg_tarc1 |= ((1  26)|(1  25)|(1  24));
 
 /* Multiple read bit is reversed polarity */
-reg_tctl = E1000_READ_REG(hw, TCTL);
 if (reg_tctl  E1000_TCTL_MULR)
 reg_tarc1 = ~(1  28);
 else
@@ -767,18 +766,18 @@ e1000_initialize_hardware_bits(struct e1
 break;
 case e1000_82573:
 reg_ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
+reg_ctrl = E1000_READ_REG(hw, CTRL);
+
 reg_ctrl_ext = ~(1  23);
 reg_ctrl_ext |= (1  22);
-
 /* TX byte count fix */
-reg_ctrl = E1000_READ_REG(hw, CTRL);
 reg_ctrl = ~(1  29);
 
 E1000_WRITE_REG(hw, CTRL_EXT, reg_ctrl_ext);
 E1000_WRITE_REG(hw, CTRL, reg_ctrl);
 break;
 case e1000_80003es2lan:
-/* improve small packet performace for fiber/serdes */
+/* improve small packet performance for fiber/serdes */
 if ((hw-media_type == e1000_media_type_fiber) ||
 (hw-media_type == e1000_media_type_internal_serdes)) {
 reg_tarc0 = ~(1  20);
@@ -800,7 +799,6 @@ e1000_initialize_hardware_bits(struct e1
 ((hw-device_id != E1000_DEV_ID_ICH8_IGP_M_AMT) 
  (hw-device_id != E1000_DEV_ID_ICH8_IGP_M)))
 reg_tarc0 |= ((1  29)|(1  28));
-
 reg_ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
 reg_ctrl_ext |= (1  22);
 E1000_WRITE_REG(hw, CTRL_EXT, reg_ctrl_ext);
@@ -808,15 +806,16 @@ e1000_initialize_hardware_bits(struct e1
 /* workaround TX hang with TSO=on */
 reg_tarc0 |= ((1  27)|(1  26)|(1  24)|(1  23));
 
-/* Multiple read bit is reversed polarity */
-reg_tctl = E1000_READ_REG(hw, TCTL);
 reg_tarc1 = E1000_READ_REG(hw, TARC1);
+reg_tctl = 

[PATCH 12/22] e1000: Fix powerdown link loss when forced to gig speed

2006-12-08 Thread Kok, Auke

disable phy power mode to prevent the NIC from attempting to autoneg
to i10/100mbit when running in forced gig mode as it would lose link at
shutdown. This allows you to force gig speed and still use WoL/IPMI
after shutdow.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index c5c764f..9ddcadd 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -819,6 +819,20 @@ e1000_reset(struct e1000_adapter *adapte
if (e1000_init_hw(adapter-hw))
DPRINTK(PROBE, ERR, Hardware Error\n);
e1000_update_mng_vlan(adapter);
+
+   /* if (adapter-hwflags  HWFLAGS_PHY_PWR_BIT) { */
+   if (adapter-hw.mac_type = e1000_82544 
+   adapter-hw.mac_type = e1000_82547_rev_2 
+   adapter-hw.autoneg == 1 
+   adapter-hw.autoneg_advertised == ADVERTISE_1000_FULL) {
+   uint32_t ctrl = E1000_READ_REG(adapter-hw, CTRL);
+   /* clear phy power management bit if we are in gig only mode,
+* which if enabled will attempt negotiation to 100Mb, which
+* can cause a loss of link at power off or driver unload */
+   ctrl = ~E1000_CTRL_SWDPIN3;
+   E1000_WRITE_REG(adapter-hw, CTRL, ctrl);
+   }
+
/* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
E1000_WRITE_REG(adapter-hw, VET, ETHERNET_IEEE_VLAN_TYPE);
 



---
Auke Kok [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 08/22] e1000: Fix all manageability workarounds

2006-12-08 Thread Kok, Auke

Several bugs existed in how we handle various manageability issues and
workarounds. We consolidate all release and init code in two single
functions and call them from appropriate locations. This fixes several
BMC packet redirect issues and powerup/down hiccups.

Add 3 extra packet redirect counters for tracking purposes to make sure
we can test that all packets arrive properly.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_ethtool.c |3 +
 drivers/net/e1000/e1000_hw.c  |5 +
 drivers/net/e1000/e1000_hw.h  |1 
 drivers/net/e1000/e1000_main.c|  135 +
 4 files changed, 83 insertions(+), 61 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index da459f7..fb96c87 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -100,6 +100,9 @@ static const struct e1000_stats e1000_gs
{ rx_csum_offload_errors, E1000_STAT(hw_csum_err) },
{ rx_header_split, E1000_STAT(rx_hdr_split) },
{ alloc_rx_buff_failed, E1000_STAT(alloc_rx_buff_failed) },
+   { tx_smbus, E1000_STAT(stats.mgptc) },
+   { rx_smbus, E1000_STAT(stats.mgprc) },
+   { dropped_smbus, E1000_STAT(stats.mgpdc) },
 };
 
 #define E1000_QUEUE_STATS_LEN 0
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 3655d90..23826c7 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -7817,9 +7817,8 @@ e1000_enable_mng_pass_thru(struct e1000_
 fwsm = E1000_READ_REG(hw, FWSM);
 factps = E1000_READ_REG(hw, FACTPS);
 
-if (((fwsm  E1000_FWSM_MODE_MASK) ==
-(e1000_mng_mode_pt  E1000_FWSM_MODE_SHIFT)) 
-(factps  E1000_FACTPS_MNGCG))
+if fwsm  E1000_FWSM_MODE_MASK)  E1000_FWSM_MODE_SHIFT) ==
+   e1000_mng_mode_pt)  !(factps  E1000_FACTPS_MNGCG))
 return TRUE;
 } else
 if ((manc  E1000_MANC_SMBUS_EN)  !(manc  E1000_MANC_ASF_EN))
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 3321fb1..fd15f62 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1301,6 +1301,7 @@ struct e1000_ffvt_entry {
 #define E1000_82542_RSSIR   E1000_RSSIR
 #define E1000_82542_KUMCTRLSTA E1000_KUMCTRLSTA
 #define E1000_82542_SW_FW_SYNC E1000_SW_FW_SYNC
+#define E1000_82542_MANC2H  E1000_MANC2H
 
 /* Statistics counters collected by the MAC */
 struct e1000_hw_stats {
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 7639b4d..0d8fd01 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -464,6 +464,53 @@ e1000_get_hw_control(struct e1000_adapte
}
 }
 
+static void
+e1000_init_manageability(struct e1000_adapter *adapter)
+{
+   if (adapter-en_mng_pt) {
+   uint32_t manc2h = E1000_READ_REG(adapter-hw, MANC2H);
+   uint32_t manc = E1000_READ_REG(adapter-hw, MANC);
+
+   /* disable hardware interception of ARP */
+   manc = ~(E1000_MANC_ARP_EN);
+
+   /* enable receiving management packets to the host */
+   /* this will probably generate destination unreachable messages
+* from the host OS, but the packets will be handled on SMBUS */
+   if (adapter-hw.mac_type = e1000_82571) {
+   manc |= E1000_MANC_EN_MNG2HOST;
+#define E1000_MNG2HOST_PORT_623 (1  5)
+#define E1000_MNG2HOST_PORT_664 (1  6)
+   manc2h |= E1000_MNG2HOST_PORT_623;
+   manc2h |= E1000_MNG2HOST_PORT_664;
+   E1000_WRITE_REG(adapter-hw, MANC2H, manc2h);
+   }
+
+   E1000_WRITE_REG(adapter-hw, MANC, manc);
+   }
+}
+
+static void
+e1000_release_manageability(struct e1000_adapter *adapter)
+{
+   if (adapter-en_mng_pt) {
+   uint32_t manc = E1000_READ_REG(adapter-hw, MANC);
+
+   /* re-enable hardware interception of ARP */
+   manc |= E1000_MANC_ARP_EN;
+
+   if (adapter-hw.mac_type = e1000_82571)
+   manc = ~E1000_MANC_EN_MNG2HOST;
+
+   /* don't explicitly have to mess with MANC2H since
+* MANC has an enable disable that gates MANC2H */
+
+   /* XXX stop the hardware watchdog ? */
+
+   E1000_WRITE_REG(adapter-hw, MANC, manc);
+   }
+}
+
 int
 e1000_up(struct e1000_adapter *adapter)
 {
@@ -475,6 +522,7 @@ e1000_up(struct e1000_adapter *adapter)
e1000_set_multi(netdev);
 
e1000_restore_vlan(adapter);
+   e1000_init_manageability(adapter);
 
e1000_configure_tx(adapter);
e1000_setup_rctl(adapter);
@@ -705,14 +753,7 @@ e1000_reset(struct e1000_adapter *adapte
phy_data);
   

[PATCH 16/22] e1000: Rewrite parm handling code to warn when forcing autoneg to gig only.

2006-12-08 Thread Kok, Auke

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_param.c |   15 +++
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index cf2a279..f8862e2 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -760,22 +760,13 @@ e1000_check_copper_options(struct e1000_
case SPEED_1000:
DPRINTK(PROBE, INFO, 1000 Mbps Speed specified without 
Duplex\n);
-   DPRINTK(PROBE, INFO,
-   Using Autonegotiation at 1000 Mbps 
-   Full Duplex only\n);
-   adapter-hw.autoneg = adapter-fc_autoneg = 1;
-   adapter-hw.autoneg_advertised = ADVERTISE_1000_FULL;
-   break;
+   goto full_duplex_only;
case SPEED_1000 + HALF_DUPLEX:
DPRINTK(PROBE, INFO,
Half Duplex is not supported at 1000 Mbps\n);
-   DPRINTK(PROBE, INFO,
-   Using Autonegotiation at 1000 Mbps 
-   Full Duplex only\n);
-   adapter-hw.autoneg = adapter-fc_autoneg = 1;
-   adapter-hw.autoneg_advertised = ADVERTISE_1000_FULL;
-   break;
+   /* fall through */
case SPEED_1000 + FULL_DUPLEX:
+full_duplex_only:
DPRINTK(PROBE, INFO,
   Using Autonegotiation at 1000 Mbps Full Duplex only\n);
adapter-hw.autoneg = adapter-fc_autoneg = 1;



---
Auke Kok [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 11/22] e1000: Fire a link even interrupt instead of a watchdog at init.

2006-12-08 Thread Kok, Auke

Instead of calling a watchdog event we let our interrupt handler
cascade a link event. This allows us to spot link up immediately
after _up() without racing against a new watchdog.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 0ebd8e2..c5c764f 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -558,7 +558,8 @@ e1000_up(struct e1000_adapter *adapter)
 
clear_bit(__E1000_DOWN, adapter-flags);
 
-   mod_timer(adapter-watchdog_timer, jiffies + 2 * HZ);
+   /* fire a link change interrupt to start the watchdog */
+   E1000_WRITE_REG(adapter-hw, ICS, E1000_ICS_LSC);
return 0;
 }
 



---
Auke Kok [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 17/22] e1000: set max frame size before enabling new link settings

2006-12-08 Thread Kok, Auke

Signed-off-by: Bruce Allan [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index cb6b732..34ceff1 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3584,12 +3584,11 @@ e1000_change_mtu(struct net_device *netd
adapter-rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
 
netdev-mtu = new_mtu;
+   adapter-hw.max_frame_size = max_frame;
 
if (netif_running(netdev))
e1000_reinit_locked(adapter);
 
-   adapter-hw.max_frame_size = max_frame;
-
return 0;
 }
 



---
Auke Kok [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: [Bug 7635] New: ioctl(fd,TCSBRK,1) on socket yields EFAULT, expected EINVAL/ENOTTY

2006-12-08 Thread David Miller
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Fri, 8 Dec 2006 14:00:21 -0800

 That is not true on BSD or other unix standardish ioctl's.
 There are no conflicts between the TIOC... values and the SIOC... values

There is absolutely nothing that we can do about this under
Linux without breaking every single application out there.

We allocated these values a long long time ago, before we
got the idea that we should perhaps use some kind of
macro system (as we mostly do now) to keep the values from
conflicting.

 Seems like one of those annoying standards compliance test
 return value bugs that shouldn't really hit an application.

Being non-compliant, and being unable to become compliant,
it actually a feature and a huge weight off of our shoulders,
don't you think?  :-)
-
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: [NETLINK]: Restore API compatibility of address and neighbour bits

2006-12-08 Thread David Miller
From: Daniel Jacobowitz [EMAIL PROTECTED]
Date: Fri, 8 Dec 2006 16:52:06 -0500

 On Fri, Dec 08, 2006 at 01:47:52PM -0800, David Miller wrote:
 The _RTA and _PAYLOAD-macros are also part of userspace headers and 
 need to be
 restored. Both dhcpclient and quagga need at least IFA_RTA and 
 IFLA_RTA to
 compile, but there may be more macros than in the following patch. 
 You may want
 to look at keepalived, iproute, ...
 
  GLIBC does not use them.
 
 Aren't these the ones you're talking about?
 
 sysdeps/unix/sysv/linux/check_pf.c:   struct rtattr *rta = 
 IFA_RTA (ifam);

hohum... guess we'll need to bring back that crap too...

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


Re: [PATCH 04/26] rt2x00: EEPROM 93Cx6

2006-12-08 Thread Michael Wu
On Friday 08 December 2006 13:56, Ivo van Doorn wrote:
 I have checked the adm80211 code as well, it seems to behave quite the
 same, with the most notable difference the fact that adm80211 writes the
 READ_OPCODE and the word index within a single command, while in
 eeprom_93cx6 this is split into 2 seperate write commands.
 I have not yet tested the exact impact for rt2x00 devices when they would
 combine the write commands, but if that has no impact (or the adm80211
 suffers no impact when the write commands are being split) then rt2x00 and
 adm80211 could indeed share the eeprom_93cx6 module.
Hm, which way is the correct way? (is there a correct way?)

 If eeprom_93cx6 is moved to the /lib folder of the kernel, should it be
 approved by a different maintainer first?

I don't think so, but I'm not sure. BTW, I think there can actually be another 
user of this code. Take a look at drivers/scsi/aic7xxx/aic7xxx_93cx6.c

I'm not sure who the maintainer for this is. Should be okay to just have 
adm8211 and rt2x00 using eeprom_93cx6 for now, unless you have a spare 
aic7xxx supported device lying around. ;)

Thanks,
-Michael Wu


pgp1CpsZWtBaz.pgp
Description: PGP signature


Re: [Devel] Re: Network virtualization/isolation

2006-12-08 Thread Herbert Poetzl
On Fri, Dec 08, 2006 at 12:57:49PM -0700, Eric W. Biederman wrote:
 Herbert Poetzl [EMAIL PROTECTED] writes:
 
  But, ok, it is not the real point to argue so much imho 
  and waste our time instead of doing things.

  well, IMHO better talk (and think) first, then implement
  something ... not the other way round, and then start
  fixing up the mess ...
 
 Well we need a bit of both.

hmm, are 'we' in a hurry here?

until recently, 'Linux' (mainline) didn't even want
to hear about OS Level virtualization, now there
is a rush to quickly get 'something' in, not knowing
or caring if it is usable at all?

I think there are a lot of 'potential users' for
this kind of virtualization, and so 'we' can test
almost all aspects outside of mainline, and once
we know the stuff works as expected, then we can
integrate it ...

the UTS namespace was something 'we all' had already
implemented in this (or a very similar) way, and in
one or two interations, it should actually work as 
expected. nevertheless, it was one of the simplest
spaces ...

we do not yet know the details for the IPC namespace,
as IPC is not that easy to check as UTS, and 'we'
haven't gotten real world feedback on that yet ...

so personally I think we should start some serious
testing on the upcoming namespaces, and we should
continue discussing the various approaches, until
'we' can agree on the (almost) 'perfect' solution

 This is thankfully not exported to user space, so as long 
 as our implementation is correct it doesn't much matter.

that's something I do not really agree with, stuff
integrated into the kernel should be well designed
and it should be tested ...

best,
Herbert

 I do agree with the point that context may make sense. 
 I have yet to be convinced though.
 
 Eric
-
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: [Devel] Re: Network virtualization/isolation

2006-12-08 Thread Andrew Morton
On Sat, 9 Dec 2006 04:50:02 +0100
Herbert Poetzl [EMAIL PROTECTED] wrote:

 On Fri, Dec 08, 2006 at 12:57:49PM -0700, Eric W. Biederman wrote:
  Herbert Poetzl [EMAIL PROTECTED] writes:
  
   But, ok, it is not the real point to argue so much imho 
   and waste our time instead of doing things.
 
   well, IMHO better talk (and think) first, then implement
   something ... not the other way round, and then start
   fixing up the mess ...
  
  Well we need a bit of both.
 
 hmm, are 'we' in a hurry here?
 
 until recently, 'Linux' (mainline) didn't even want
 to hear about OS Level virtualization, now there
 is a rush to quickly get 'something' in, not knowing
 or caring if it is usable at all?

It's actually happening quite gradually and carefully.

 I think there are a lot of 'potential users' for
 this kind of virtualization, and so 'we' can test
 almost all aspects outside of mainline, and once
 we know the stuff works as expected, then we can
 integrate it ...
 
 the UTS namespace was something 'we all' had already
 implemented in this (or a very similar) way, and in
 one or two interations, it should actually work as 
 expected. nevertheless, it was one of the simplest
 spaces ...
 
 we do not yet know the details for the IPC namespace,
 as IPC is not that easy to check as UTS, and 'we'
 haven't gotten real world feedback on that yet ...

We are very dependent upon all stakeholders including yourself to review,
test and comment upon this infrastructure as it is proposed and merged.
If something is proposed which will not suit your requirements then it
is important that we hear about it, in detail, at the earliest possible time.

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: [Devel] Re: Network virtualization/isolation

2006-12-08 Thread Herbert Poetzl
On Fri, Dec 08, 2006 at 10:13:48PM -0800, Andrew Morton wrote:
 On Sat, 9 Dec 2006 04:50:02 +0100
 Herbert Poetzl [EMAIL PROTECTED] wrote:
 
  On Fri, Dec 08, 2006 at 12:57:49PM -0700, Eric W. Biederman wrote:
   Herbert Poetzl [EMAIL PROTECTED] writes:
   
But, ok, it is not the real point to argue so much imho 
and waste our time instead of doing things.
  
well, IMHO better talk (and think) first, then implement
something ... not the other way round, and then start
fixing up the mess ...
   
   Well we need a bit of both.
  
  hmm, are 'we' in a hurry here?
  
  until recently, 'Linux' (mainline) didn't even want
  to hear about OS Level virtualization, now there
  is a rush to quickly get 'something' in, not knowing
  or caring if it is usable at all?
 
 It's actually happening quite gradually and carefully.

hmm, I must have missed a testing phase for the
IPC namespace then, not that I think it is broken
(well, maybe it is, we do not know yet)

  I think there are a lot of 'potential users' for
  this kind of virtualization, and so 'we' can test
  almost all aspects outside of mainline, and once
  we know the stuff works as expected, then we can
  integrate it ...
  
  the UTS namespace was something 'we all' had already
  implemented in this (or a very similar) way, and in
  one or two interations, it should actually work as 
  expected. nevertheless, it was one of the simplest
  spaces ...
  
  we do not yet know the details for the IPC namespace,
  as IPC is not that easy to check as UTS, and 'we'
  haven't gotten real world feedback on that yet ...
 
 We are very dependent upon all stakeholders including yourself 
 to review, test and comment upon this infrastructure as it is 
 proposed and merged. If something is proposed which will not 
 suit your requirements then it is important that we hear about 
 it, in detail, at the earliest possible time.

okay, good to hear that I'm still considered a stakeholder 

will try to focus the feedback and cc as many folks
as possible, as it seems that some feedback is lost
on the way upstream ...

best,
Herbert

 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


[PATCH] d80211: remove pkt_type/pkt_probe_resp

2006-12-08 Thread Michael Wu
d80211: remove pkt_type/pkt_probe_resp

Nobody uses pkt_type, and the information can be obtained from the
header. This removes it and the associated code that keeps tracks of it.

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

 include/net/d80211.h   |1 -
 net/d80211/ieee80211.c |7 ---
 net/d80211/ieee80211_i.h   |3 +--
 net/d80211/ieee80211_sta.c |   17 +++--
 4 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/include/net/d80211.h b/include/net/d80211.h
index 30980e1..f7f6318 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -135,7 +135,6 @@ struct ieee80211_low_level_stats {
 #define HW_KEY_IDX_INVALID -1
 
 struct ieee80211_tx_control {
-   enum { PKT_NORMAL = 0, PKT_PROBE_RESP } pkt_type;
int tx_rate; /* Transmit rate, given as the hw specific value for the
  * rate (from struct ieee80211_rate) */
int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 6e10db5..5ea51a5 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1395,8 +1395,6 @@ static int ieee80211_master_start_xmit(s
control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS;
if (pkt_data-do_not_encrypt)
control.flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
-   control.pkt_type =
-   pkt_data-pkt_probe_resp ? PKT_PROBE_RESP : PKT_NORMAL;
if (pkt_data-requeue)
control.flags |= IEEE80211_TXCTL_REQUEUE;
control.queue = pkt_data-queue;
@@ -1628,10 +1626,6 @@ ieee80211_mgmt_start_xmit(struct sk_buff
 pkt_data-ifindex = sdata-dev-ifindex;
pkt_data-mgmt_iface = (sdata-type == IEEE80211_IF_TYPE_MGMT);
 
-   if ((fc  IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT 
-   (fc  IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP)
-   pkt_data-pkt_probe_resp = 1;
-
skb-priority = 20; /* use hardcoded priority for mgmt TX queue */
skb-dev = sdata-local-mdev;
 
@@ -4050,7 +4044,6 @@ static void ieee80211_remove_tx_extra(st
pkt_data-mgmt_iface = (control-type == IEEE80211_IF_TYPE_MGMT);
pkt_data-req_tx_status = !!(control-flags  
IEEE80211_TXCTL_REQ_TX_STATUS);
pkt_data-do_not_encrypt = !!(control-flags  
IEEE80211_TXCTL_DO_NOT_ENCRYPT);
-   pkt_data-pkt_probe_resp = (control-pkt_type == PKT_PROBE_RESP);
pkt_data-requeue = !!(control-flags  IEEE80211_TXCTL_REQUEUE);
pkt_data-queue = control-queue;
 
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index ef303da..02fbdea 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -155,10 +155,9 @@ struct ieee80211_tx_packet_data {
unsigned long jiffies;
unsigned int req_tx_status:1;
unsigned int do_not_encrypt:1;
-   unsigned int pkt_probe_resp:1;
unsigned int requeue:1;
-   unsigned int queue:4;
unsigned int mgmt_iface:1;
+   unsigned int queue:4;
 };
 
 struct ieee80211_tx_stored_packet {
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 04bd5cd..7594022 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -384,7 +384,7 @@ static void ieee80211_set_associated(str
 
 
 static void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
-int encrypt, int probe_resp)
+int encrypt)
 {
struct ieee80211_sub_if_data *sdata;
struct ieee80211_tx_packet_data *pkt_data;
@@ -398,8 +398,6 @@ static void ieee80211_sta_tx(struct net_
pkt_data-ifindex = sdata-dev-ifindex;
pkt_data-mgmt_iface = (sdata-type == IEEE80211_IF_TYPE_MGMT);
pkt_data-do_not_encrypt = !encrypt;
-   if (probe_resp)
-   pkt_data-pkt_probe_resp = 1;
 
dev_queue_xmit(skb);
 }
@@ -436,7 +434,7 @@ static void ieee80211_send_auth(struct n
if (extra)
memcpy(skb_put(skb, extra_len), extra, extra_len);
 
-   ieee80211_sta_tx(dev, skb, encrypt, 0);
+   ieee80211_sta_tx(dev, skb, encrypt);
 }
 
 
@@ -573,7 +571,7 @@ static void ieee80211_send_assoc(struct
if (ifsta-assocreq_ies)
memcpy(ifsta-assocreq_ies, ies, ifsta-assocreq_ies_len);
 
-   ieee80211_sta_tx(dev, skb, 0, 0);
+   ieee80211_sta_tx(dev, skb, 0);
 }
 
 
@@ -600,7 +598,7 @@ static void ieee80211_send_deauth(struct
skb_put(skb, 2);
mgmt-u.deauth.reason_code = cpu_to_le16(reason);
 
-   ieee80211_sta_tx(dev, skb, 0, 0);
+   ieee80211_sta_tx(dev, skb, 0);
 }
 
 
@@ -627,7 +625,7 @@ static void ieee80211_send_disassoc(stru
skb_put(skb, 2);
mgmt-u.disassoc.reason_code = cpu_to_le16(reason);
 
-   ieee80211_sta_tx(dev, skb, 0, 0);
+   ieee80211_sta_tx(dev, skb, 0);
 }
 
 
@@ -803,7 +801,7 @@ static void ieee80211_send_probe_req(str
*pos = rate-rate / 5;

Re: [PATCH 3/10] cxgb3 - HW access routines - part 1

2006-12-08 Thread Jan Engelhardt

On Dec 7 2006 19:25, [EMAIL PROTECTED] wrote:
+void t3_set_reg_field(struct adapter *adapter, unsigned int addr, u32 mask,
+u32 val)
+{
+  u32 v = t3_read_reg(adapter, addr)  ~mask;
+
+  t3_write_reg(adapter, addr, v | val);
+  (void)t3_read_reg(adapter, addr);   /* flush */
+}

Drop casts to void. (Also elsewhere)

+int t3_mc7_bd_read(struct mc7 *mc7, unsigned int start, unsigned int n,
+ u64 * buf)
+{
+  static int shift[] = { 0, 0, 16, 24 };
+  static int step[] = { 0, 32, 16, 8 };

Unless these are modified during operation of this driver, make it const.

+/*
+ * Partial EEPROM Vital Product Data structure.  Includes only the ID and
+ * VPD-R sections.
+ */
+struct t3_vpd {
+  u8 id_tag;
+  u8 id_len[2];
+  u8 id_data[16];
+  u8 vpdr_tag;
+  u8 vpdr_len[2];
+   VPD_ENTRY(pn, 16); /* part number */
+   VPD_ENTRY(ec, 16); /* EC level */
+   VPD_ENTRY(sn, 16); /* serial number */

s/^\t /\t/;

+static int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
+{
+  int i, addr, ret;
+  struct t3_vpd vpd;
+
+  /*
+   * Card information is normally at VPD_BASE but some early cards had
+   * it at 0.
+   */
+  ret = t3_seeprom_read(adapter, VPD_BASE, (u32 *)  vpd);
+  if (ret)
+  return ret;
+  addr = vpd.id_tag == 0x82 ? VPD_BASE : 0;
+
+  for (i = 0; i  sizeof(vpd); i += 4) {
+  ret = t3_seeprom_read(adapter, addr + i,
+(u32 *) ((u8 *)  vpd + i));

Randy Dunlap just submitted an updated CodingStyle - in short: vpd -
you may want to take a look at it later on.

+static int sf1_read(struct adapter *adapter, unsigned int byte_cnt, int cont,
+  u32 * valp)
 ^

+int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size)
+{
+  u32 csum;
+  unsigned int i;
+  const u32 *p = (const u32 *)fw_data;
+  int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR  16;
+
+  if (size  3)
+  return -EINVAL;
+  if (size  FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR)
+  return -EFBIG;
+
+  for (csum = 0, i = 0; i  size / sizeof(csum); i++)
+  csum += ntohl(p[i]);

Does this checksum have bear resemblance to the IPv4 checksum?

+  if (csum != 0x) {
+  CH_ERR(%s: corrupted firmware image, checksum %u\n,
+ adapter-name, csum);
+  return -EINVAL;
+  }
+
+  ret = t3_flash_erase_sectors(adapter, fw_sector, fw_sector);
+  if (ret)
+  goto out;
+
+  size -= 8;  /* trim off version and checksum */
+  for (addr = FW_FLASH_BOOT_ADDR; size;) {
+  unsigned int chunk_size = min(size, 256U);

No need for the U.

+static void pci_intr_handler(struct adapter *adapter)
+{
+  static struct intr_info pcix1_intr_info[] = {
+  {F_MSTDETPARERR, PCI master detected parity error, -1, 1},
+  {F_SIGTARABT, PCI signaled target abort, -1, 1},

constify if possible (also elsewhere)




-`J'
-- 
-
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 0/10] cxgb3: Chelsio T3 1G/10G ethernet device driver

2006-12-08 Thread Stephen Hemminger
Minor style stuff (that can be fixed later).
1) /* C style comments */ are preferred over // C++ style
2) Please use C99 style structure initializers especially for OS
   interface structures like ops for MII.
-
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/10] cxgb3 - scatter gather engine

2006-12-08 Thread Stephen Hemminger
The NAPI code in the cxgb2 driver was a mess (see patch today), don't know if
cxgb3 could use the similar brain surgery..


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


[PATCH] 2.6 driver for Silan SC92031 (second try)

2006-12-08 Thread Cesar Eduardo Barros
From: Cesar Eduardo Barros [EMAIL PROTECTED]

This is a driver for the Silan SC92031/Rsltek 8139D NIC chip.

This chip is found on at least one counterfeit Encore ENL832-TX-RENT
NIC [1], which came with a mini-CD with the 2.4 driver. A slightly
older version of the driver was found at [2]. The main difference
between them is that the newer one has a small bugfix in the RX path,
a lot of gratuitous renaming of functions, all the printable strings
changed to show as a Rsltek 8139D [sic], and a PCI ID of 8139 instead
of 2031. The driver on this patch is a rewrite of the vendor drivers
(based mostly on the older one).

This patch is against 2.6.19; it is currently being used on a 2.6.17 [3]
kernel on one of my boxes (Ubuntu x86-64 vendor kernel, with the driver
compiled as a out-of-tree module), and compiles on 2.6.19 without any
errors or warnings.

Changes from the previous patch sent to netdev:
- Use MMIO instead of PIO
- Changed TX bounce buffers allocation
- Use skb_copy_and_csum_dev
- Several small bug fixes
- Tested for more than just a few minutes each time

[1] See http://www.encore-usa.com/faq.php under ENL832-TX-RENT for more
information
[2] Look for SL_LINUX.ZIP (which is really a .tar.gz) at
http://broadbandforum.in/dataone_Intex_LAN_cardlinux-t4207-s15.html
[3] To compile on 2.6.17, simply add back the last argument to the
interrupt handler in two places, and copy the boolean declarations
from 2.6.19

Signed-off-by: Cesar Eduardo Barros [EMAIL PROTECTED]

---

diff -uprN -X linux-2.6.19.orig/Documentation/dontdiff 
linux-2.6.19.orig/drivers/net/Kconfig linux-2.6.19/drivers/net/Kconfig
--- linux-2.6.19.orig/drivers/net/Kconfig   2006-11-29 19:57:37.0 
-0200
+++ linux-2.6.19/drivers/net/Kconfig2006-12-02 18:50:23.0 -0200
@@ -1777,6 +1777,18 @@ config LAN_SAA9730
  workstations.
  See http://www.semiconductors.philips.com/pip/SAA9730_flyer_1.

+config SC92031
+   tristate Silan SC92031 PCI Fast Ethernet Adapter driver (EXPERIMENTAL)
+   depends on NET_PCI  PCI  EXPERIMENTAL
+   select CRC32
+   ---help---
+ This is a driver for the Fast Ethernet PCI network cards based on
+ the Silan SC92031 chip (sometimes also called Rsltek 8139D). If you
+ have one of these, say Y here.
+
+ To compile this driver as a module, choose M here: the module
+ will be called sc92031.  This is recommended.
+
 config NET_POCKET
bool Pocket and portable adapters
depends on NET_ETHERNET  PARPORT
diff -uprN -X linux-2.6.19.orig/Documentation/dontdiff 
linux-2.6.19.orig/drivers/net/Makefile linux-2.6.19/drivers/net/Makefile
--- linux-2.6.19.orig/drivers/net/Makefile  2006-11-29 19:57:37.0 
-0200
+++ linux-2.6.19/drivers/net/Makefile   2006-12-02 18:50:23.0 -0200
@@ -160,6 +160,7 @@ obj-$(CONFIG_APRICOT) += 82596.o
 obj-$(CONFIG_LASI_82596) += lasi_82596.o
 obj-$(CONFIG_MVME16x_NET) += 82596.o
 obj-$(CONFIG_BVME6000_NET) += 82596.o
+obj-$(CONFIG_SC92031) += sc92031.o

 # This is also a 82596 and should probably be merged
 obj-$(CONFIG_LP486E) += lp486e.o
diff -uprN -X linux-2.6.19.orig/Documentation/dontdiff 
linux-2.6.19.orig/drivers/net/sc92031.c linux-2.6.19/drivers/net/sc92031.c
--- linux-2.6.19.orig/drivers/net/sc92031.c 1969-12-31 21:00:00.0 
-0300
+++ linux-2.6.19/drivers/net/sc92031.c  2006-12-08 17:41:56.0 -0200
@@ -0,0 +1,1583 @@
+/*  Silan SC92031 PCI Fast Ethernet Adapter driver
+ *
+ *  Based on vendor drivers:
+ *  Silan Fast Ethernet Netcard Driver:
+ *MODULE_AUTHOR (gaoyonghong);
+ *MODULE_DESCRIPTION (SILAN Fast Ethernet driver);
+ *MODULE_LICENSE(GPL);
+ *  8139D Fast Ethernet driver:
+ *(C) 2002 by gaoyonghong
+ *MODULE_AUTHOR (gaoyonghong);
+ *MODULE_DESCRIPTION (Rsltek 8139D PCI Fast Ethernet Adapter driver);
+ *MODULE_LICENSE(GPL);
+ *  Both are almost identical and seem to be based on pci-skeleton.c
+ *
+ *  Rewritten for 2.6 by Cesar Eduardo Barros
+ */
+
+/* Note about set_mac_address: I don't know how to change the hardware
+ * matching, so you need to enable IFF_PROMISC when using it.
+ */
+
+#include linux/module.h
+#include linux/kernel.h
+#include linux/delay.h
+#include linux/pci.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/ethtool.h
+#include linux/crc32.h
+
+#define PCI_VENDOR_ID_SILAN0x1904
+#define PCI_DEVICE_ID_SILAN_SC920310x2031
+#define PCI_DEVICE_ID_SILAN_8139D  0x8139
+
+#define SC92031_NAME sc92031
+#define SC92031_DESCRIPTION Silan SC92031 PCI Fast Ethernet Adapter driver
+#define SC92031_VERSION 2.0b
+
+/* BAR 0 is MMIO, BAR 1 is PIO */
+#ifndef SC92031_USE_BAR
+#define SC92031_USE_BAR 0
+#endif
+
+/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). */
+static int multicast_filter_limit = 64;
+module_param(multicast_filter_limit, int, 0);
+MODULE_PARM_DESC(multicast_filter_limit,
+   Maximum number of filtered 

Re: [PATCH] 2.6 driver for Silan SC92031 (second try)

2006-12-08 Thread Andrew Morton
On Fri, 08 Dec 2006 18:17:06 -0200
Cesar Eduardo Barros [EMAIL PROTECTED] wrote:

 From: Cesar Eduardo Barros [EMAIL PROTECTED]
 
 This is a driver for the Silan SC92031/Rsltek 8139D NIC chip.
 
 ...

 +config SC92031
 + depends on NET_PCI  PCI  EXPERIMENTAL
 + select CRC32

 ...

 + } while(unlikely(cmpxchg(priv-intr_status,

You'll have the arm maintainer after you with a pointy stick.

cmpxchg is only available on certain architectures.  It would be acceptable
to make this driver depend on X86 (or something).  Better to rewrite this
code so it doesn't use cmpxchg.
-
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