Re: MM kernels 2.6.24-rc*-mm*, 2.6.24-mm1: gnome-terminal stuck in tty_poll

2008-02-07 Thread Jay Cliburn
On Thu, 07 Feb 2008 21:24:47 +0100
Peter Zijlstra <[EMAIL PROTECTED]> wrote:

> 
> On Thu, 2008-02-07 at 20:49 +0100, Peter Zijlstra wrote:
> > On Wed, 2008-02-06 at 18:23 -0800, Andrew Morton wrote:
> > > On Wed, 06 Feb 2008 20:10:50 -0600 "J. K. Cliburn"
> > > <[EMAIL PROTECTED]> wrote:
> > > 
> > > > Zan Lynx wrote:
> > > > 
> > > > > gnome-terminal gets stuck.
> > > > 
> > > > I began seeing this very thing around 2.6.24 time.  (Fedora 8,
> > > > vanilla kernel.)  I could usually cause the gnome terminal to
> > > > hang if I rapidly resized the window while executing make
> > > > check-headers.
> 
> Weird, .24 proper doesn't have that patch. 

Yeah, my reference to "around 2.6.24 time" was simply a gross
demarcation along the passage of time rather than an indictment of
2.6.24 itself.

I began noticing gnome-terminal hangs during kernel builds a couple of
weeks ago, but I ignored them, thinking it'd be fixed with a Fedora
package update.  When that didn't happen, I began looking for the
culprit in the kernel in earnest this past Saturday.

> What exact fedora kernel was that (so I can look at it).

I didn't use a Fedora kernel; I bisected Linus' git current as of
Saturday Feb 2, using 2.6.24 as the "good" side of the bisect.  It took
the better part of two days to whittle down the throng, but by Sunday
night I'd settled on the 37bb6cb4 hrtimer commit.  My last act before
going to bed that night was to reset the bisect, revert the commit, and
rebuild.  I couldn't get gnome-terminal to hang using that rebuilt
kernel.

The next morning I went out of town for a couple of days, only to return
to find my workstation dead after some weather-related power outages.
I just got it back online tonight.

> Which is even weirder, because the provided trace indicates
> schedule_timeout()

The trace isn't from me; it's from Zan.  He's running -mm, I'm not, if
that makes a difference.

> 
> Call Trace:
>  [schedule_timeout+149/208] schedule_timeout+0x95/0xd0
>  [] schedule_timeout+0x95/0xd0
>  [tty_poll+145/160] tty_poll+0x91/0xa0
>  [] tty_poll+0x91/0xa0
>  [do_sys_poll+617/880] do_sys_poll+0x269/0x370
>  [] do_sys_poll+0x269/0x370
>  [__pollwait+0/304] __pollwait+0x0/0x130
>  [] __pollwait+0x0/0x130

Now that my computer is back on the air again, I'll be happy to help
track this down.  Just tell me what to do.

Jay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: MM kernels 2.6.24-rc*-mm*, 2.6.24-mm1: gnome-terminal stuck in tty_poll

2008-02-07 Thread Jay Cliburn
On Thu, 07 Feb 2008 21:24:47 +0100
Peter Zijlstra [EMAIL PROTECTED] wrote:

 
 On Thu, 2008-02-07 at 20:49 +0100, Peter Zijlstra wrote:
  On Wed, 2008-02-06 at 18:23 -0800, Andrew Morton wrote:
   On Wed, 06 Feb 2008 20:10:50 -0600 J. K. Cliburn
   [EMAIL PROTECTED] wrote:
   
Zan Lynx wrote:

 gnome-terminal gets stuck.

I began seeing this very thing around 2.6.24 time.  (Fedora 8,
vanilla kernel.)  I could usually cause the gnome terminal to
hang if I rapidly resized the window while executing make
check-headers.
 
 Weird, .24 proper doesn't have that patch. 

Yeah, my reference to around 2.6.24 time was simply a gross
demarcation along the passage of time rather than an indictment of
2.6.24 itself.

I began noticing gnome-terminal hangs during kernel builds a couple of
weeks ago, but I ignored them, thinking it'd be fixed with a Fedora
package update.  When that didn't happen, I began looking for the
culprit in the kernel in earnest this past Saturday.

 What exact fedora kernel was that (so I can look at it).

I didn't use a Fedora kernel; I bisected Linus' git current as of
Saturday Feb 2, using 2.6.24 as the good side of the bisect.  It took
the better part of two days to whittle down the throng, but by Sunday
night I'd settled on the 37bb6cb4 hrtimer commit.  My last act before
going to bed that night was to reset the bisect, revert the commit, and
rebuild.  I couldn't get gnome-terminal to hang using that rebuilt
kernel.

The next morning I went out of town for a couple of days, only to return
to find my workstation dead after some weather-related power outages.
I just got it back online tonight.

 Which is even weirder, because the provided trace indicates
 schedule_timeout()

The trace isn't from me; it's from Zan.  He's running -mm, I'm not, if
that makes a difference.

 
 Call Trace:
  [schedule_timeout+149/208] schedule_timeout+0x95/0xd0
  [8057dde5] schedule_timeout+0x95/0xd0
  [tty_poll+145/160] tty_poll+0x91/0xa0
  [80430f11] tty_poll+0x91/0xa0
  [do_sys_poll+617/880] do_sys_poll+0x269/0x370
  [802bbe69] do_sys_poll+0x269/0x370
  [__pollwait+0/304] __pollwait+0x0/0x130
  [802bcb30] __pollwait+0x0/0x130

Now that my computer is back on the air again, I'll be happy to help
track this down.  Just tell me what to do.

Jay
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/10] atl1: move to atlx and update for 2.6.25

2008-02-02 Thread Jay Cliburn
In preparation for a future atl2 driver for the Atheros L2 10/100 chip,
we propose to move the existing atl1 driver to a new directory
(drivers/net/atlx), then split out functions and definitions that both
atl1 and atl2 can share.  The final structure will look like this:

drivers/net/atl1deleted
drivers/net/atlxnew
drivers/net/atlx/atl1.c atl1-specific functions
drivers/net/atlx/atl1.h atl1-specific definitions
drivers/net/atlx/atlx.c atl1-atl2 shared functions
drivers/net/atlx/atlx.h atl1-atl2 shared definitions

The first two patches submitted in this patchset accomplish the
relocation by moving the atl1 driver over to drivers/net/atlx, then
splitting out shareable functions and definitions.  Some transitory
hackery will be present until the atl2 merge.  Please overlook it for
now.

The remaining 8 patches provide some cleanup and minor functionality
changes, the most important of which is a fix to our long-broken TSO
capability.

The "conform to vendor driver" patches submitted on 31 December 2007
have been dropped.

Table of contents:
---
0001-atl1-relocate-atl1-driver-to-drivers-net-atlx.patch
0002-atl1-move-common-functions-to-atlx-files.patch
0003-atl1-fix-broken-TSO.patch
0004-atl1-add-ethtool-register-dump.patch
0005-atl1-simplify-tx-packet-descriptor.patch
0006-atl1-use-csum_start.patch
0007-atl1-use-netif_msg.patch
0008-atl1-print-debug-info-if-rrd-error.patch
0009-atl1-make-functions-static.patch
0010-atl1-reduce-forward-declarations.patch


Summary diffstat:
---
 drivers/net/Makefile  |2 +-
 drivers/net/atl1/Makefile |2 -
 drivers/net/atl1/atl1.h   |  286 
 drivers/net/atl1/atl1_ethtool.c   |  505 --
 drivers/net/atl1/atl1_hw.c|  720 -
 drivers/net/atl1/atl1_hw.h|  946 ---
 drivers/net/atl1/atl1_param.c |  203 ---
 drivers/net/atlx/Makefile |1 +
 drivers/net/{atl1/atl1_main.c => atlx/atl1.c} | 2118
+++-- drivers/net/atlx/atl1.h
|  796 ++ drivers/net/atlx/atlx.c   |  433
+ drivers/net/atlx/atlx.h   |  506 ++
 12 files changed, 3352 insertions(+), 3166 deletions(-)
 delete mode 100644 drivers/net/atl1/Makefile
 delete mode 100644 drivers/net/atl1/atl1.h
 delete mode 100644 drivers/net/atl1/atl1_ethtool.c
 delete mode 100644 drivers/net/atl1/atl1_hw.c
 delete mode 100644 drivers/net/atl1/atl1_hw.h
 delete mode 100644 drivers/net/atl1/atl1_param.c
 create mode 100644 drivers/net/atlx/Makefile
 rename drivers/net/{atl1/atl1_main.c => atlx/atl1.c} (57%)
 create mode 100644 drivers/net/atlx/atl1.h
 create mode 100644 drivers/net/atlx/atlx.c
 create mode 100644 drivers/net/atlx/atlx.h

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/10] atl1: make functions static

2008-02-02 Thread Jay Cliburn
Make needlessly global functions static.  In a couple of cases this
requires removing forward declarations and reordering functions.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
Acked-by: Chris Snook <[EMAIL PROTECTED]>
---
 drivers/net/atlx/atl1.c |  101 ---
 drivers/net/atlx/atl1.h |3 -
 2 files changed, 51 insertions(+), 53 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 4e4cb23..6f4a1d5 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -211,7 +211,7 @@ static int atl1_mii_ioctl(struct net_device *netdev, struct 
ifreq *ifr, int cmd)
  *
  * Return 0 on success, negative on failure
  */
-s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
+static s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
 {
struct atl1_tpd_ring *tpd_ring = >tpd_ring;
struct atl1_rfd_ring *rfd_ring = >rfd_ring;
@@ -402,7 +402,7 @@ static void atl1_clean_tx_ring(struct atl1_adapter *adapter)
  *
  * Free all transmit software resources
  */
-void atl1_free_ring_resources(struct atl1_adapter *adapter)
+static void atl1_free_ring_resources(struct atl1_adapter *adapter)
 {
struct pci_dev *pdev = adapter->pdev;
struct atl1_tpd_ring *tpd_ring = >tpd_ring;
@@ -580,40 +580,6 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
return 0;
 }
 
-/*
- * atl1_change_mtu - Change the Maximum Transfer Unit
- * @netdev: network interface device structure
- * @new_mtu: new value for maximum frame size
- *
- * Returns 0 on success, negative on failure
- */
-static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
-{
-   struct atl1_adapter *adapter = netdev_priv(netdev);
-   int old_mtu = netdev->mtu;
-   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
-
-   if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
-   (max_frame > MAX_JUMBO_FRAME_SIZE)) {
-   if (netif_msg_link(adapter))
-   dev_warn(>pdev->dev, "invalid MTU setting\n");
-   return -EINVAL;
-   }
-
-   adapter->hw.max_frame_size = max_frame;
-   adapter->hw.tx_jumbo_task_th = (max_frame + 7) >> 3;
-   adapter->rx_buffer_len = (max_frame + 7) & ~7;
-   adapter->hw.rx_jumbo_th = adapter->rx_buffer_len / 8;
-
-   netdev->mtu = new_mtu;
-   if ((old_mtu != new_mtu) && netif_running(netdev)) {
-   atl1_down(adapter);
-   atl1_up(adapter);
-   }
-
-   return 0;
-}
-
 static void set_flow_ctrl_old(struct atl1_adapter *adapter)
 {
u32 hi, lo, value;
@@ -1794,19 +1760,8 @@ static void atl1_phy_config(unsigned long data)
  * assert again and again.
  * 
  */
-static void atl1_tx_timeout_task(struct work_struct *work)
-{
-   struct atl1_adapter *adapter =
-   container_of(work, struct atl1_adapter, tx_timeout_task);
-   struct net_device *netdev = adapter->netdev;
 
-   netif_device_detach(netdev);
-   atl1_down(adapter);
-   atl1_up(adapter);
-   netif_device_attach(netdev);
-}
-
-int atl1_reset(struct atl1_adapter *adapter)
+static int atl1_reset(struct atl1_adapter *adapter)
 {
int ret;
ret = atl1_reset_hw(>hw);
@@ -1815,7 +1770,7 @@ int atl1_reset(struct atl1_adapter *adapter)
return atl1_init_hw(>hw);
 }
 
-s32 atl1_up(struct atl1_adapter *adapter)
+static s32 atl1_up(struct atl1_adapter *adapter)
 {
struct net_device *netdev = adapter->netdev;
int err;
@@ -1860,7 +1815,7 @@ err_up:
return err;
 }
 
-void atl1_down(struct atl1_adapter *adapter)
+static void atl1_down(struct atl1_adapter *adapter)
 {
struct net_device *netdev = adapter->netdev;
 
@@ -1883,6 +1838,52 @@ void atl1_down(struct atl1_adapter *adapter)
atl1_clean_rx_ring(adapter);
 }
 
+static void atl1_tx_timeout_task(struct work_struct *work)
+{
+   struct atl1_adapter *adapter =
+   container_of(work, struct atl1_adapter, tx_timeout_task);
+   struct net_device *netdev = adapter->netdev;
+
+   netif_device_detach(netdev);
+   atl1_down(adapter);
+   atl1_up(adapter);
+   netif_device_attach(netdev);
+}
+
+/*
+ * atl1_change_mtu - Change the Maximum Transfer Unit
+ * @netdev: network interface device structure
+ * @new_mtu: new value for maximum frame size
+ *
+ * Returns 0 on success, negative on failure
+ */
+static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
+{
+   struct atl1_adapter *adapter = netdev_priv(netdev);
+   int old_mtu = netdev->mtu;
+   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
+
+   if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
+   (max_frame > MAX_JUMBO_FRAME_SIZE)) {
+   if (netif_msg_link(adapter))
+   dev_warn(>pdev->dev, "invalid M

[PATCH 10/10] atl1: reduce forward declarations

2008-02-02 Thread Jay Cliburn
Rearrange functions to allow removal of some forward declarations.
Make certain global functions static along the way.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
Acked-by: Chris Snook <[EMAIL PROTECTED]>
---
 drivers/net/atlx/atl1.c | 1406 +++---
 drivers/net/atlx/atl1.h |   10 -
 2 files changed, 703 insertions(+), 713 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 6f4a1d5..240db84 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -108,6 +108,709 @@ module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "Message level (0=none,...,16=all)");
 
 /*
+ * Reset the transmit and receive units; mask and clear all interrupts.
+ * hw - Struct containing variables accessed by shared code
+ * return : 0  or  idle status (if error)
+ */
+static s32 atl1_reset_hw(struct atl1_hw *hw)
+{
+   struct pci_dev *pdev = hw->back->pdev;
+   struct atl1_adapter *adapter = hw->back;
+   u32 icr;
+   int i;
+
+   /*
+* Clear Interrupt mask to stop board from generating
+* interrupts & Clear any pending interrupt events
+*/
+   /*
+* iowrite32(0, hw->hw_addr + REG_IMR);
+* iowrite32(0x, hw->hw_addr + REG_ISR);
+*/
+
+   /*
+* Issue Soft Reset to the MAC.  This will reset the chip's
+* transmit, receive, DMA.  It will not effect
+* the current PCI configuration.  The global reset bit is self-
+* clearing, and should clear within a microsecond.
+*/
+   iowrite32(MASTER_CTRL_SOFT_RST, hw->hw_addr + REG_MASTER_CTRL);
+   ioread32(hw->hw_addr + REG_MASTER_CTRL);
+
+   iowrite16(1, hw->hw_addr + REG_PHY_ENABLE);
+   ioread16(hw->hw_addr + REG_PHY_ENABLE);
+
+   /* delay about 1ms */
+   msleep(1);
+
+   /* Wait at least 10ms for All module to be Idle */
+   for (i = 0; i < 10; i++) {
+   icr = ioread32(hw->hw_addr + REG_IDLE_STATUS);
+   if (!icr)
+   break;
+   /* delay 1 ms */
+   msleep(1);
+   /* FIXME: still the right way to do this? */
+   cpu_relax();
+   }
+
+   if (icr) {
+   if (netif_msg_hw(adapter))
+   dev_dbg(>dev, "ICR = 0x%x\n", icr);
+   return icr;
+   }
+
+   return 0;
+}
+
+/* function about EEPROM
+ *
+ * check_eeprom_exist
+ * return 0 if eeprom exist
+ */
+static int atl1_check_eeprom_exist(struct atl1_hw *hw)
+{
+   u32 value;
+   value = ioread32(hw->hw_addr + REG_SPI_FLASH_CTRL);
+   if (value & SPI_FLASH_CTRL_EN_VPD) {
+   value &= ~SPI_FLASH_CTRL_EN_VPD;
+   iowrite32(value, hw->hw_addr + REG_SPI_FLASH_CTRL);
+   }
+
+   value = ioread16(hw->hw_addr + REG_PCIE_CAP_LIST);
+   return ((value & 0xFF00) == 0x6C00) ? 0 : 1;
+}
+
+static bool atl1_read_eeprom(struct atl1_hw *hw, u32 offset, u32 *p_value)
+{
+   int i;
+   u32 control;
+
+   if (offset & 3)
+   /* address do not align */
+   return false;
+
+   iowrite32(0, hw->hw_addr + REG_VPD_DATA);
+   control = (offset & VPD_CAP_VPD_ADDR_MASK) << VPD_CAP_VPD_ADDR_SHIFT;
+   iowrite32(control, hw->hw_addr + REG_VPD_CAP);
+   ioread32(hw->hw_addr + REG_VPD_CAP);
+
+   for (i = 0; i < 10; i++) {
+   msleep(2);
+   control = ioread32(hw->hw_addr + REG_VPD_CAP);
+   if (control & VPD_CAP_VPD_FLAG)
+   break;
+   }
+   if (control & VPD_CAP_VPD_FLAG) {
+   *p_value = ioread32(hw->hw_addr + REG_VPD_DATA);
+   return true;
+   }
+   /* timeout */
+   return false;
+}
+
+/*
+ * Reads the value from a PHY register
+ * hw - Struct containing variables accessed by shared code
+ * reg_addr - address of the PHY register to read
+ */
+s32 atl1_read_phy_reg(struct atl1_hw *hw, u16 reg_addr, u16 *phy_data)
+{
+   u32 val;
+   int i;
+
+   val = ((u32) (reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT |
+   MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 <<
+   MDIO_CLK_SEL_SHIFT;
+   iowrite32(val, hw->hw_addr + REG_MDIO_CTRL);
+   ioread32(hw->hw_addr + REG_MDIO_CTRL);
+
+   for (i = 0; i < MDIO_WAIT_TIMES; i++) {
+   udelay(2);
+   val = ioread32(hw->hw_addr + REG_MDIO_CTRL);
+   if (!(val & (MDIO_START | MDIO_BUSY)))
+   break;
+   }
+   if (!(val & (MDIO_START | MDIO_BUSY))) {
+   *phy_data = (u16) val;
+   return 0;
+   }
+   return ATLX_ERR_PHY;
+}
+
+#define CUSTOM_SPI_CS_SETUP2
+#define CUSTOM_SPI_CLK_HI  2
+#define CUSTOM_SPI_CLK_LO 

[PATCH 06/10] atl1: use csum_start

2008-02-02 Thread Jay Cliburn
Use skb->csum_start for tx checksum offload preparation. Also swap
the variables css and cso so they hold the intended values of csum
start and offset, respectively.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
Acked-by: Chris Snook <[EMAIL PROTECTED]>
---
 drivers/net/atlx/atl1.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index f4add3c..9929822 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1347,16 +1347,17 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, 
struct sk_buff *skb,
u8 css, cso;
 
if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
-   cso = skb_transport_offset(skb);
-   css = cso + skb->csum_offset;
-   if (unlikely(cso & 0x1)) {
+   css = (u8) (skb->csum_start - skb_headroom(skb));
+   cso = css + (u8) skb->csum_offset;
+   if (unlikely(css & 0x1)) {
+   /* L1 hardware requires an even number here */
dev_printk(KERN_DEBUG, >pdev->dev,
"payload offset not an even number\n");
return -1;
}
-   ptpd->word3 |= (cso & TPD_PLOADOFFSET_MASK) <<
+   ptpd->word3 |= (css & TPD_PLOADOFFSET_MASK) <<
TPD_PLOADOFFSET_SHIFT;
-   ptpd->word3 |= (css & TPD_CCSUMOFFSET_MASK) <<
+   ptpd->word3 |= (cso & TPD_CCSUMOFFSET_MASK) <<
TPD_CCSUMOFFSET_SHIFT;
ptpd->word3 |= 1 << TPD_CUST_CSUM_EN_SHIFT;
return true;
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/10] atl1: simplify tx packet descriptor

2008-02-02 Thread Jay Cliburn
The transmit packet descriptor consists of four 32-bit words, with word 3
upper bits overloaded depending upon the condition of its bits 3 and 4.
The driver currently duplicates all word 2 and some word 3 register bit
definitions unnecessarily and also uses a set of nested structures in its
definition of the TPD without good cause. This patch adds a lengthy
comment describing the TPD, eliminates duplicate TPD bit definitions,
and simplifies the TPD structure itself. It also expands the TSO check
to correctly handle custom checksum versus TSO processing using the revised
TPD definitions. Finally, shorten some variable names in the transmit
processing path to reduce line lengths, rename some variables to better
describe their purpose (e.g., nseg versus m), and add a comment or two
to better describe what the code is doing.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
Acked-by: Chris Snook <[EMAIL PROTECTED]>
---
 drivers/net/atlx/atl1.c |  265 +--
 drivers/net/atlx/atl1.h |  201 +++-
 2 files changed, 246 insertions(+), 220 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 1f564f0..f4add3c 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1259,8 +1259,6 @@ static void atl1_intr_tx(struct atl1_adapter *adapter)
dev_kfree_skb_irq(buffer_info->skb);
buffer_info->skb = NULL;
}
-   tpd->buffer_addr = 0;
-   tpd->desc.data = 0;
 
if (++sw_tpd_next_to_clean == tpd_ring->count)
sw_tpd_next_to_clean = 0;
@@ -1282,48 +1280,69 @@ static u16 atl1_tpd_avail(struct atl1_tpd_ring 
*tpd_ring)
 }
 
 static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
-struct tso_param *tso)
+   struct tx_packet_desc *ptpd)
 {
-   /* We enter this function holding a spinlock. */
-   u8 ipofst;
+   /* spinlock held */
+   u8 hdr_len, ip_off;
+   u32 real_len;
int err;
 
if (skb_shinfo(skb)->gso_size) {
if (skb_header_cloned(skb)) {
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (unlikely(err))
-   return err;
+   return -1;
}
 
if (skb->protocol == ntohs(ETH_P_IP)) {
struct iphdr *iph = ip_hdr(skb);
 
-   iph->tot_len = 0;
+   real_len = (((unsigned char *)iph - skb->data) +
+   ntohs(iph->tot_len));
+   if (real_len < skb->len)
+   pskb_trim(skb, real_len);
+   hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
+   if (skb->len == hdr_len) {
+   iph->check = 0;
+   tcp_hdr(skb)->check =
+   ~csum_tcpudp_magic(iph->saddr,
+   iph->daddr, tcp_hdrlen(skb),
+   IPPROTO_TCP, 0);
+   ptpd->word3 |= (iph->ihl & TPD_IPHL_MASK) <<
+   TPD_IPHL_SHIFT;
+   ptpd->word3 |= ((tcp_hdrlen(skb) >> 2) &
+   TPD_TCPHDRLEN_MASK) <<
+   TPD_TCPHDRLEN_SHIFT;
+   ptpd->word3 |= 1 << TPD_IP_CSUM_SHIFT;
+   ptpd->word3 |= 1 << TPD_TCP_CSUM_SHIFT;
+   return 1;
+   }
+
iph->check = 0;
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
-   iph->daddr, 0, IPPROTO_TCP, 0);
-   ipofst = skb_network_offset(skb);
-   if (ipofst != ETH_HLEN) /* 802.3 frame */
-   tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT;
-
-   tso->tsopl |= (iph->ihl &
-   TSO_PARAM_IPHL_MASK) << TSO_PARAM_IPHL_SHIFT;
-   tso->tsopl |= ((tcp_hdrlen(skb) >> 2) &
-   TSO_PARAM_TCPHDRLEN_MASK) <<
-   TSO_PARAM_TCPHDRLEN_SHIFT;
-   tso->tsopl |= (skb_shinfo(skb)->gso_size &
-   TSO_PARAM_MSS_MASK) << TSO_PARAM_MSS_SHIFT;
-   tso->tsopl |= 1 << TSO_PARAM_IPCKSUM_SHIFT;
-   tso->tsopl |= 1 << TSO_PARAM_TCPCKSUM_SHIFT;
-   

[PATCH 08/10] atl1: print debug info if rrd error

2008-02-02 Thread Jay Cliburn
Add some debug printks if we encounter a potentially bad receive
return descriptor.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
Acked-by: Chris Snook <[EMAIL PROTECTED]>
---
 drivers/net/atlx/atl1.c |   26 ++
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 51eca23..4e4cb23 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1144,14 +1144,32 @@ chk_rrd:
/* check rrd status */
if (likely(rrd->num_buf == 1))
goto rrd_ok;
+   else if (netif_msg_rx_err(adapter)) {
+   dev_printk(KERN_DEBUG, >pdev->dev,
+   "unexpected RRD buffer count\n");
+   dev_printk(KERN_DEBUG, >pdev->dev,
+   "rx_buf_len = %d\n",
+   adapter->rx_buffer_len);
+   dev_printk(KERN_DEBUG, >pdev->dev,
+   "RRD num_buf = %d\n",
+   rrd->num_buf);
+   dev_printk(KERN_DEBUG, >pdev->dev,
+   "RRD pkt_len = %d\n",
+   rrd->xsz.xsum_sz.pkt_size);
+   dev_printk(KERN_DEBUG, >pdev->dev,
+   "RRD pkt_flg = 0x%08X\n",
+   rrd->pkt_flg);
+   dev_printk(KERN_DEBUG, >pdev->dev,
+   "RRD err_flg = 0x%08X\n",
+   rrd->err_flg);
+   dev_printk(KERN_DEBUG, >pdev->dev,
+   "RRD vlan_tag = 0x%08X\n",
+   rrd->vlan_tag);
+   }
 
/* rrd seems to be bad */
if (unlikely(i-- > 0)) {
/* rrd may not be DMAed completely */
-   if (netif_msg_rx_err(adapter))
-   dev_printk(KERN_DEBUG,
-   >pdev->dev,
-   "unexpected RRD count\n");
udelay(1);
goto chk_rrd;
}
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/10] atl1: relocate atl1 driver to /drivers/net/atlx

2008-02-02 Thread Jay Cliburn
In preparation for a future Atheros L2 NIC driver (called atl2), relocate
the atl1 driver into a new /drivers/net/atlx directory that will ultimately
be shared with the future atl2 driver.

Signed-off-by: Chris Snook <[EMAIL PROTECTED]>
Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/Makefile  |2 +-
 drivers/net/{atl1 => atlx}/Makefile   |0 
 drivers/net/{atl1 => atlx}/atl1.h |0 
 drivers/net/{atl1 => atlx}/atl1_ethtool.c |0 
 drivers/net/{atl1 => atlx}/atl1_hw.c  |0 
 drivers/net/{atl1 => atlx}/atl1_hw.h  |0 
 drivers/net/{atl1 => atlx}/atl1_main.c|0 
 drivers/net/{atl1 => atlx}/atl1_param.c   |0 
 8 files changed, 1 insertions(+), 1 deletions(-)
 rename drivers/net/{atl1 => atlx}/Makefile (100%)
 rename drivers/net/{atl1 => atlx}/atl1.h (100%)
 rename drivers/net/{atl1 => atlx}/atl1_ethtool.c (100%)
 rename drivers/net/{atl1 => atlx}/atl1_hw.c (100%)
 rename drivers/net/{atl1 => atlx}/atl1_hw.h (100%)
 rename drivers/net/{atl1 => atlx}/atl1_main.c (100%)
 rename drivers/net/{atl1 => atlx}/atl1_param.c (100%)

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 9fc7794..ae11d5e 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -15,7 +15,7 @@ obj-$(CONFIG_CHELSIO_T3) += cxgb3/
 obj-$(CONFIG_EHEA) += ehea/
 obj-$(CONFIG_CAN) += can/
 obj-$(CONFIG_BONDING) += bonding/
-obj-$(CONFIG_ATL1) += atl1/
+obj-$(CONFIG_ATL1) += atlx/
 obj-$(CONFIG_GIANFAR) += gianfar_driver.o
 obj-$(CONFIG_TEHUTI) += tehuti.o
 
diff --git a/drivers/net/atl1/Makefile b/drivers/net/atlx/Makefile
similarity index 100%
rename from drivers/net/atl1/Makefile
rename to drivers/net/atlx/Makefile
diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atlx/atl1.h
similarity index 100%
rename from drivers/net/atl1/atl1.h
rename to drivers/net/atlx/atl1.h
diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atlx/atl1_ethtool.c
similarity index 100%
rename from drivers/net/atl1/atl1_ethtool.c
rename to drivers/net/atlx/atl1_ethtool.c
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atlx/atl1_hw.c
similarity index 100%
rename from drivers/net/atl1/atl1_hw.c
rename to drivers/net/atlx/atl1_hw.c
diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atlx/atl1_hw.h
similarity index 100%
rename from drivers/net/atl1/atl1_hw.h
rename to drivers/net/atlx/atl1_hw.h
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atlx/atl1_main.c
similarity index 100%
rename from drivers/net/atl1/atl1_main.c
rename to drivers/net/atlx/atl1_main.c
diff --git a/drivers/net/atl1/atl1_param.c b/drivers/net/atlx/atl1_param.c
similarity index 100%
rename from drivers/net/atl1/atl1_param.c
rename to drivers/net/atlx/atl1_param.c
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/10] atl1: add ethtool register dump

2008-02-02 Thread Jay Cliburn
Add the ethtool register dump option to the atl1 driver.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
Acked-by: Chris Snook <[EMAIL PROTECTED]>
---
 drivers/net/atlx/atl1.c |   53 +++
 drivers/net/atlx/atl1.h |1 +
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 8a26dad..1f564f0 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -2513,6 +2513,57 @@ static int atl1_set_wol(struct net_device *netdev,
return 0;
 }
 
+static int atl1_get_regs_len(struct net_device *netdev)
+{
+   return ATL1_REG_COUNT * sizeof(u32);
+}
+
+static void atl1_get_regs(struct net_device *netdev, struct ethtool_regs *regs,
+   void *p)
+{
+   struct atl1_adapter *adapter = netdev_priv(netdev);
+   struct atl1_hw *hw = >hw;
+   unsigned int i;
+   u32 *regbuf = p;
+
+   for (i = 0; i < ATL1_REG_COUNT; i++) {
+   /*
+* This switch statement avoids reserved regions
+* of register space.
+*/
+   switch (i) {
+   case 6 ... 9:
+   case 14:
+   case 29 ... 31:
+   case 34 ... 63:
+   case 75 ... 127:
+   case 136 ... 1023:
+   case 1027 ... 1087:
+   case 1091 ... 1151:
+   case 1194 ... 1195:
+   case 1200 ... 1201:
+   case 1206 ... 1213:
+   case 1216 ... 1279:
+   case 1290 ... 1311:
+   case 1323 ... 1343:
+   case 1358 ... 1359:
+   case 1368 ... 1375:
+   case 1378 ... 1383:
+   case 1388 ... 1391:
+   case 1393 ... 1395:
+   case 1402 ... 1403:
+   case 1410 ... 1471:
+   case 1522 ... 1535:
+   /* reserved region; don't read it */
+   regbuf[i] = 0;
+   break;
+   default:
+   /* unreserved region */
+   regbuf[i] = ioread32(hw->hw_addr + (i * sizeof(u32)));
+   }
+   }
+}
+
 static void atl1_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring)
 {
@@ -2703,6 +2754,8 @@ const struct ethtool_ops atl1_ethtool_ops = {
.get_drvinfo= atl1_get_drvinfo,
.get_wol= atl1_get_wol,
.set_wol= atl1_set_wol,
+   .get_regs_len   = atl1_get_regs_len,
+   .get_regs   = atl1_get_regs,
.get_ringparam  = atl1_get_ringparam,
.set_ringparam  = atl1_set_ringparam,
.get_pauseparam = atl1_get_pauseparam,
diff --git a/drivers/net/atlx/atl1.h b/drivers/net/atlx/atl1.h
index 538948d..30c5a8d 100644
--- a/drivers/net/atlx/atl1.h
+++ b/drivers/net/atlx/atl1.h
@@ -584,6 +584,7 @@ enum atl1_dma_req_block {
 #define ATL1_DEFAULT_RFD   512
 #define ATL1_MIN_RFD   128
 #define ATL1_MAX_RFD   2048
+#define ATL1_REG_COUNT 1538
 
 #define ATL1_GET_DESC(R, i, type)  (&(((type *)((R)->desc))[i]))
 #define ATL1_RFD_DESC(R, i)ATL1_GET_DESC(R, i, struct rx_free_desc)
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/10] atl1: fix broken TSO

2008-02-02 Thread Jay Cliburn
The L1 tx packet descriptor expects TCP Header Length to be expressed as a
number of 32-bit dwords.  The atl1 driver uses tcp_hdrlen() to populate the
field, but tcp_hdrlen() returns the header length in bytes, not in dwords.
Add a shift to convert tcp_hdrlen() to dwords when we write it to the tpd.

Also, some of our bit assignments are made to the wrong tpd words.  Change
those to the correct words.

Finally, since all this fixes TSO, enable TSO by default.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
Acked-by: Chris Snook <[EMAIL PROTECTED]>
---
 drivers/net/atlx/atl1.c |   29 +++--
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index a84c97c..8a26dad 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -36,7 +36,6 @@
  * A very incomplete list of things that need to be dealt with:
  *
  * TODO:
- * Fix TSO; tx performance is horrible with TSO enabled.
  * Wake on LAN.
  * Add more ethtool functions.
  * Fix abstruse irq enable/disable condition described here:
@@ -1308,8 +1307,8 @@ static int atl1_tso(struct atl1_adapter *adapter, struct 
sk_buff *skb,
tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT;
 
tso->tsopl |= (iph->ihl &
-   CSUM_PARAM_IPHL_MASK) << CSUM_PARAM_IPHL_SHIFT;
-   tso->tsopl |= (tcp_hdrlen(skb) &
+   TSO_PARAM_IPHL_MASK) << TSO_PARAM_IPHL_SHIFT;
+   tso->tsopl |= ((tcp_hdrlen(skb) >> 2) &
TSO_PARAM_TCPHDRLEN_MASK) <<
TSO_PARAM_TCPHDRLEN_SHIFT;
tso->tsopl |= (skb_shinfo(skb)->gso_size &
@@ -1472,8 +1471,8 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, 
int count,
tpd->desc.tso.tsopl = descr->tso.tsopl;
tpd->buffer_addr = cpu_to_le64(buffer_info->dma);
tpd->desc.data = descr->data;
-   tpd->desc.csum.csumpu |= (cpu_to_le16(buffer_info->length) &
-   CSUM_PARAM_BUFLEN_MASK) << CSUM_PARAM_BUFLEN_SHIFT;
+   tpd->desc.tso.tsopu |= (cpu_to_le16(buffer_info->length) &
+   TSO_PARAM_BUFLEN_MASK) << TSO_PARAM_BUFLEN_SHIFT;
 
val = (descr->tso.tsopl >> TSO_PARAM_SEGMENT_SHIFT) &
TSO_PARAM_SEGMENT_MASK;
@@ -1481,7 +1480,7 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, 
int count,
tpd->desc.tso.tsopl |= 1 << TSO_PARAM_HDRFLAG_SHIFT;
 
if (j == (count - 1))
-   tpd->desc.csum.csumpl |= 1 << CSUM_PARAM_EOP_SHIFT;
+   tpd->desc.tso.tsopl |= 1 << TSO_PARAM_EOP_SHIFT;
 
if (++tpd_next_to_use == tpd_ring->count)
tpd_next_to_use = 0;
@@ -1574,9 +1573,9 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct 
net_device *netdev)
vlan_tag = vlan_tx_tag_get(skb);
vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) |
((vlan_tag >> 9) & 0x8);
-   param.csum.csumpl |= 1 << CSUM_PARAM_INSVLAG_SHIFT;
-   param.csum.csumpu |= (vlan_tag & CSUM_PARAM_VALANTAG_MASK) <<
-   CSUM_PARAM_VALAN_SHIFT;
+   param.tso.tsopl |= 1 << TSO_PARAM_INSVLAG_SHIFT;
+   param.tso.tsopu |= (vlan_tag & TSO_PARAM_VLANTAG_MASK) <<
+   TSO_PARAM_VLAN_SHIFT;
}
 
tso = atl1_tso(adapter, skb, );
@@ -1595,8 +1594,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct 
net_device *netdev)
}
}
 
-   val = (param.csum.csumpl >> CSUM_PARAM_SEGMENT_SHIFT) &
-   CSUM_PARAM_SEGMENT_MASK;
+   val = (param.tso.tsopl >> TSO_PARAM_SEGMENT_SHIFT) &
+   TSO_PARAM_SEGMENT_MASK;
atl1_tx_map(adapter, skb, 1 == val);
atl1_tx_queue(adapter, count, );
netdev->trans_start = jiffies;
@@ -2091,13 +2090,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
netdev->features = NETIF_F_HW_CSUM;
netdev->features |= NETIF_F_SG;
netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
-
-   /*
-* FIXME - Until tso performance gets fixed, disable the feature.
-* Enable it with ethtool -K if desired.
-*/
-   /* netdev->features |= NETIF_F_TSO; */
-
+   netdev->features |= NETIF_F_TSO;
netdev->features |= NETIF_F_LLTX;
 
/*
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/10] atl1: fix broken TSO

2008-02-02 Thread Jay Cliburn
The L1 tx packet descriptor expects TCP Header Length to be expressed as a
number of 32-bit dwords.  The atl1 driver uses tcp_hdrlen() to populate the
field, but tcp_hdrlen() returns the header length in bytes, not in dwords.
Add a shift to convert tcp_hdrlen() to dwords when we write it to the tpd.

Also, some of our bit assignments are made to the wrong tpd words.  Change
those to the correct words.

Finally, since all this fixes TSO, enable TSO by default.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
Acked-by: Chris Snook [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c |   29 +++--
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index a84c97c..8a26dad 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -36,7 +36,6 @@
  * A very incomplete list of things that need to be dealt with:
  *
  * TODO:
- * Fix TSO; tx performance is horrible with TSO enabled.
  * Wake on LAN.
  * Add more ethtool functions.
  * Fix abstruse irq enable/disable condition described here:
@@ -1308,8 +1307,8 @@ static int atl1_tso(struct atl1_adapter *adapter, struct 
sk_buff *skb,
tso-tsopl |= 1  TSO_PARAM_ETHTYPE_SHIFT;
 
tso-tsopl |= (iph-ihl 
-   CSUM_PARAM_IPHL_MASK)  CSUM_PARAM_IPHL_SHIFT;
-   tso-tsopl |= (tcp_hdrlen(skb) 
+   TSO_PARAM_IPHL_MASK)  TSO_PARAM_IPHL_SHIFT;
+   tso-tsopl |= ((tcp_hdrlen(skb)  2) 
TSO_PARAM_TCPHDRLEN_MASK) 
TSO_PARAM_TCPHDRLEN_SHIFT;
tso-tsopl |= (skb_shinfo(skb)-gso_size 
@@ -1472,8 +1471,8 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, 
int count,
tpd-desc.tso.tsopl = descr-tso.tsopl;
tpd-buffer_addr = cpu_to_le64(buffer_info-dma);
tpd-desc.data = descr-data;
-   tpd-desc.csum.csumpu |= (cpu_to_le16(buffer_info-length) 
-   CSUM_PARAM_BUFLEN_MASK)  CSUM_PARAM_BUFLEN_SHIFT;
+   tpd-desc.tso.tsopu |= (cpu_to_le16(buffer_info-length) 
+   TSO_PARAM_BUFLEN_MASK)  TSO_PARAM_BUFLEN_SHIFT;
 
val = (descr-tso.tsopl  TSO_PARAM_SEGMENT_SHIFT) 
TSO_PARAM_SEGMENT_MASK;
@@ -1481,7 +1480,7 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, 
int count,
tpd-desc.tso.tsopl |= 1  TSO_PARAM_HDRFLAG_SHIFT;
 
if (j == (count - 1))
-   tpd-desc.csum.csumpl |= 1  CSUM_PARAM_EOP_SHIFT;
+   tpd-desc.tso.tsopl |= 1  TSO_PARAM_EOP_SHIFT;
 
if (++tpd_next_to_use == tpd_ring-count)
tpd_next_to_use = 0;
@@ -1574,9 +1573,9 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct 
net_device *netdev)
vlan_tag = vlan_tx_tag_get(skb);
vlan_tag = (vlan_tag  4) | (vlan_tag  13) |
((vlan_tag  9)  0x8);
-   param.csum.csumpl |= 1  CSUM_PARAM_INSVLAG_SHIFT;
-   param.csum.csumpu |= (vlan_tag  CSUM_PARAM_VALANTAG_MASK) 
-   CSUM_PARAM_VALAN_SHIFT;
+   param.tso.tsopl |= 1  TSO_PARAM_INSVLAG_SHIFT;
+   param.tso.tsopu |= (vlan_tag  TSO_PARAM_VLANTAG_MASK) 
+   TSO_PARAM_VLAN_SHIFT;
}
 
tso = atl1_tso(adapter, skb, param.tso);
@@ -1595,8 +1594,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct 
net_device *netdev)
}
}
 
-   val = (param.csum.csumpl  CSUM_PARAM_SEGMENT_SHIFT) 
-   CSUM_PARAM_SEGMENT_MASK;
+   val = (param.tso.tsopl  TSO_PARAM_SEGMENT_SHIFT) 
+   TSO_PARAM_SEGMENT_MASK;
atl1_tx_map(adapter, skb, 1 == val);
atl1_tx_queue(adapter, count, param);
netdev-trans_start = jiffies;
@@ -2091,13 +2090,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
netdev-features = NETIF_F_HW_CSUM;
netdev-features |= NETIF_F_SG;
netdev-features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
-
-   /*
-* FIXME - Until tso performance gets fixed, disable the feature.
-* Enable it with ethtool -K if desired.
-*/
-   /* netdev-features |= NETIF_F_TSO; */
-
+   netdev-features |= NETIF_F_TSO;
netdev-features |= NETIF_F_LLTX;
 
/*
-- 
1.5.3.8

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


[PATCH 04/10] atl1: add ethtool register dump

2008-02-02 Thread Jay Cliburn
Add the ethtool register dump option to the atl1 driver.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
Acked-by: Chris Snook [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c |   53 +++
 drivers/net/atlx/atl1.h |1 +
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 8a26dad..1f564f0 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -2513,6 +2513,57 @@ static int atl1_set_wol(struct net_device *netdev,
return 0;
 }
 
+static int atl1_get_regs_len(struct net_device *netdev)
+{
+   return ATL1_REG_COUNT * sizeof(u32);
+}
+
+static void atl1_get_regs(struct net_device *netdev, struct ethtool_regs *regs,
+   void *p)
+{
+   struct atl1_adapter *adapter = netdev_priv(netdev);
+   struct atl1_hw *hw = adapter-hw;
+   unsigned int i;
+   u32 *regbuf = p;
+
+   for (i = 0; i  ATL1_REG_COUNT; i++) {
+   /*
+* This switch statement avoids reserved regions
+* of register space.
+*/
+   switch (i) {
+   case 6 ... 9:
+   case 14:
+   case 29 ... 31:
+   case 34 ... 63:
+   case 75 ... 127:
+   case 136 ... 1023:
+   case 1027 ... 1087:
+   case 1091 ... 1151:
+   case 1194 ... 1195:
+   case 1200 ... 1201:
+   case 1206 ... 1213:
+   case 1216 ... 1279:
+   case 1290 ... 1311:
+   case 1323 ... 1343:
+   case 1358 ... 1359:
+   case 1368 ... 1375:
+   case 1378 ... 1383:
+   case 1388 ... 1391:
+   case 1393 ... 1395:
+   case 1402 ... 1403:
+   case 1410 ... 1471:
+   case 1522 ... 1535:
+   /* reserved region; don't read it */
+   regbuf[i] = 0;
+   break;
+   default:
+   /* unreserved region */
+   regbuf[i] = ioread32(hw-hw_addr + (i * sizeof(u32)));
+   }
+   }
+}
+
 static void atl1_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring)
 {
@@ -2703,6 +2754,8 @@ const struct ethtool_ops atl1_ethtool_ops = {
.get_drvinfo= atl1_get_drvinfo,
.get_wol= atl1_get_wol,
.set_wol= atl1_set_wol,
+   .get_regs_len   = atl1_get_regs_len,
+   .get_regs   = atl1_get_regs,
.get_ringparam  = atl1_get_ringparam,
.set_ringparam  = atl1_set_ringparam,
.get_pauseparam = atl1_get_pauseparam,
diff --git a/drivers/net/atlx/atl1.h b/drivers/net/atlx/atl1.h
index 538948d..30c5a8d 100644
--- a/drivers/net/atlx/atl1.h
+++ b/drivers/net/atlx/atl1.h
@@ -584,6 +584,7 @@ enum atl1_dma_req_block {
 #define ATL1_DEFAULT_RFD   512
 #define ATL1_MIN_RFD   128
 #define ATL1_MAX_RFD   2048
+#define ATL1_REG_COUNT 1538
 
 #define ATL1_GET_DESC(R, i, type)  type *)((R)-desc))[i]))
 #define ATL1_RFD_DESC(R, i)ATL1_GET_DESC(R, i, struct rx_free_desc)
-- 
1.5.3.8

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


[PATCH 01/10] atl1: relocate atl1 driver to /drivers/net/atlx

2008-02-02 Thread Jay Cliburn
In preparation for a future Atheros L2 NIC driver (called atl2), relocate
the atl1 driver into a new /drivers/net/atlx directory that will ultimately
be shared with the future atl2 driver.

Signed-off-by: Chris Snook [EMAIL PROTECTED]
Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/Makefile  |2 +-
 drivers/net/{atl1 = atlx}/Makefile   |0 
 drivers/net/{atl1 = atlx}/atl1.h |0 
 drivers/net/{atl1 = atlx}/atl1_ethtool.c |0 
 drivers/net/{atl1 = atlx}/atl1_hw.c  |0 
 drivers/net/{atl1 = atlx}/atl1_hw.h  |0 
 drivers/net/{atl1 = atlx}/atl1_main.c|0 
 drivers/net/{atl1 = atlx}/atl1_param.c   |0 
 8 files changed, 1 insertions(+), 1 deletions(-)
 rename drivers/net/{atl1 = atlx}/Makefile (100%)
 rename drivers/net/{atl1 = atlx}/atl1.h (100%)
 rename drivers/net/{atl1 = atlx}/atl1_ethtool.c (100%)
 rename drivers/net/{atl1 = atlx}/atl1_hw.c (100%)
 rename drivers/net/{atl1 = atlx}/atl1_hw.h (100%)
 rename drivers/net/{atl1 = atlx}/atl1_main.c (100%)
 rename drivers/net/{atl1 = atlx}/atl1_param.c (100%)

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 9fc7794..ae11d5e 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -15,7 +15,7 @@ obj-$(CONFIG_CHELSIO_T3) += cxgb3/
 obj-$(CONFIG_EHEA) += ehea/
 obj-$(CONFIG_CAN) += can/
 obj-$(CONFIG_BONDING) += bonding/
-obj-$(CONFIG_ATL1) += atl1/
+obj-$(CONFIG_ATL1) += atlx/
 obj-$(CONFIG_GIANFAR) += gianfar_driver.o
 obj-$(CONFIG_TEHUTI) += tehuti.o
 
diff --git a/drivers/net/atl1/Makefile b/drivers/net/atlx/Makefile
similarity index 100%
rename from drivers/net/atl1/Makefile
rename to drivers/net/atlx/Makefile
diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atlx/atl1.h
similarity index 100%
rename from drivers/net/atl1/atl1.h
rename to drivers/net/atlx/atl1.h
diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atlx/atl1_ethtool.c
similarity index 100%
rename from drivers/net/atl1/atl1_ethtool.c
rename to drivers/net/atlx/atl1_ethtool.c
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atlx/atl1_hw.c
similarity index 100%
rename from drivers/net/atl1/atl1_hw.c
rename to drivers/net/atlx/atl1_hw.c
diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atlx/atl1_hw.h
similarity index 100%
rename from drivers/net/atl1/atl1_hw.h
rename to drivers/net/atlx/atl1_hw.h
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atlx/atl1_main.c
similarity index 100%
rename from drivers/net/atl1/atl1_main.c
rename to drivers/net/atlx/atl1_main.c
diff --git a/drivers/net/atl1/atl1_param.c b/drivers/net/atlx/atl1_param.c
similarity index 100%
rename from drivers/net/atl1/atl1_param.c
rename to drivers/net/atlx/atl1_param.c
-- 
1.5.3.8

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


[PATCH 08/10] atl1: print debug info if rrd error

2008-02-02 Thread Jay Cliburn
Add some debug printks if we encounter a potentially bad receive
return descriptor.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
Acked-by: Chris Snook [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c |   26 ++
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 51eca23..4e4cb23 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1144,14 +1144,32 @@ chk_rrd:
/* check rrd status */
if (likely(rrd-num_buf == 1))
goto rrd_ok;
+   else if (netif_msg_rx_err(adapter)) {
+   dev_printk(KERN_DEBUG, adapter-pdev-dev,
+   unexpected RRD buffer count\n);
+   dev_printk(KERN_DEBUG, adapter-pdev-dev,
+   rx_buf_len = %d\n,
+   adapter-rx_buffer_len);
+   dev_printk(KERN_DEBUG, adapter-pdev-dev,
+   RRD num_buf = %d\n,
+   rrd-num_buf);
+   dev_printk(KERN_DEBUG, adapter-pdev-dev,
+   RRD pkt_len = %d\n,
+   rrd-xsz.xsum_sz.pkt_size);
+   dev_printk(KERN_DEBUG, adapter-pdev-dev,
+   RRD pkt_flg = 0x%08X\n,
+   rrd-pkt_flg);
+   dev_printk(KERN_DEBUG, adapter-pdev-dev,
+   RRD err_flg = 0x%08X\n,
+   rrd-err_flg);
+   dev_printk(KERN_DEBUG, adapter-pdev-dev,
+   RRD vlan_tag = 0x%08X\n,
+   rrd-vlan_tag);
+   }
 
/* rrd seems to be bad */
if (unlikely(i--  0)) {
/* rrd may not be DMAed completely */
-   if (netif_msg_rx_err(adapter))
-   dev_printk(KERN_DEBUG,
-   adapter-pdev-dev,
-   unexpected RRD count\n);
udelay(1);
goto chk_rrd;
}
-- 
1.5.3.8

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


[PATCH 06/10] atl1: use csum_start

2008-02-02 Thread Jay Cliburn
Use skb-csum_start for tx checksum offload preparation. Also swap
the variables css and cso so they hold the intended values of csum
start and offset, respectively.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
Acked-by: Chris Snook [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index f4add3c..9929822 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1347,16 +1347,17 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, 
struct sk_buff *skb,
u8 css, cso;
 
if (likely(skb-ip_summed == CHECKSUM_PARTIAL)) {
-   cso = skb_transport_offset(skb);
-   css = cso + skb-csum_offset;
-   if (unlikely(cso  0x1)) {
+   css = (u8) (skb-csum_start - skb_headroom(skb));
+   cso = css + (u8) skb-csum_offset;
+   if (unlikely(css  0x1)) {
+   /* L1 hardware requires an even number here */
dev_printk(KERN_DEBUG, adapter-pdev-dev,
payload offset not an even number\n);
return -1;
}
-   ptpd-word3 |= (cso  TPD_PLOADOFFSET_MASK) 
+   ptpd-word3 |= (css  TPD_PLOADOFFSET_MASK) 
TPD_PLOADOFFSET_SHIFT;
-   ptpd-word3 |= (css  TPD_CCSUMOFFSET_MASK) 
+   ptpd-word3 |= (cso  TPD_CCSUMOFFSET_MASK) 
TPD_CCSUMOFFSET_SHIFT;
ptpd-word3 |= 1  TPD_CUST_CSUM_EN_SHIFT;
return true;
-- 
1.5.3.8

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


[PATCH 05/10] atl1: simplify tx packet descriptor

2008-02-02 Thread Jay Cliburn
The transmit packet descriptor consists of four 32-bit words, with word 3
upper bits overloaded depending upon the condition of its bits 3 and 4.
The driver currently duplicates all word 2 and some word 3 register bit
definitions unnecessarily and also uses a set of nested structures in its
definition of the TPD without good cause. This patch adds a lengthy
comment describing the TPD, eliminates duplicate TPD bit definitions,
and simplifies the TPD structure itself. It also expands the TSO check
to correctly handle custom checksum versus TSO processing using the revised
TPD definitions. Finally, shorten some variable names in the transmit
processing path to reduce line lengths, rename some variables to better
describe their purpose (e.g., nseg versus m), and add a comment or two
to better describe what the code is doing.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
Acked-by: Chris Snook [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c |  265 +--
 drivers/net/atlx/atl1.h |  201 +++-
 2 files changed, 246 insertions(+), 220 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 1f564f0..f4add3c 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1259,8 +1259,6 @@ static void atl1_intr_tx(struct atl1_adapter *adapter)
dev_kfree_skb_irq(buffer_info-skb);
buffer_info-skb = NULL;
}
-   tpd-buffer_addr = 0;
-   tpd-desc.data = 0;
 
if (++sw_tpd_next_to_clean == tpd_ring-count)
sw_tpd_next_to_clean = 0;
@@ -1282,48 +1280,69 @@ static u16 atl1_tpd_avail(struct atl1_tpd_ring 
*tpd_ring)
 }
 
 static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
-struct tso_param *tso)
+   struct tx_packet_desc *ptpd)
 {
-   /* We enter this function holding a spinlock. */
-   u8 ipofst;
+   /* spinlock held */
+   u8 hdr_len, ip_off;
+   u32 real_len;
int err;
 
if (skb_shinfo(skb)-gso_size) {
if (skb_header_cloned(skb)) {
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (unlikely(err))
-   return err;
+   return -1;
}
 
if (skb-protocol == ntohs(ETH_P_IP)) {
struct iphdr *iph = ip_hdr(skb);
 
-   iph-tot_len = 0;
+   real_len = (((unsigned char *)iph - skb-data) +
+   ntohs(iph-tot_len));
+   if (real_len  skb-len)
+   pskb_trim(skb, real_len);
+   hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
+   if (skb-len == hdr_len) {
+   iph-check = 0;
+   tcp_hdr(skb)-check =
+   ~csum_tcpudp_magic(iph-saddr,
+   iph-daddr, tcp_hdrlen(skb),
+   IPPROTO_TCP, 0);
+   ptpd-word3 |= (iph-ihl  TPD_IPHL_MASK) 
+   TPD_IPHL_SHIFT;
+   ptpd-word3 |= ((tcp_hdrlen(skb)  2) 
+   TPD_TCPHDRLEN_MASK) 
+   TPD_TCPHDRLEN_SHIFT;
+   ptpd-word3 |= 1  TPD_IP_CSUM_SHIFT;
+   ptpd-word3 |= 1  TPD_TCP_CSUM_SHIFT;
+   return 1;
+   }
+
iph-check = 0;
tcp_hdr(skb)-check = ~csum_tcpudp_magic(iph-saddr,
-   iph-daddr, 0, IPPROTO_TCP, 0);
-   ipofst = skb_network_offset(skb);
-   if (ipofst != ETH_HLEN) /* 802.3 frame */
-   tso-tsopl |= 1  TSO_PARAM_ETHTYPE_SHIFT;
-
-   tso-tsopl |= (iph-ihl 
-   TSO_PARAM_IPHL_MASK)  TSO_PARAM_IPHL_SHIFT;
-   tso-tsopl |= ((tcp_hdrlen(skb)  2) 
-   TSO_PARAM_TCPHDRLEN_MASK) 
-   TSO_PARAM_TCPHDRLEN_SHIFT;
-   tso-tsopl |= (skb_shinfo(skb)-gso_size 
-   TSO_PARAM_MSS_MASK)  TSO_PARAM_MSS_SHIFT;
-   tso-tsopl |= 1  TSO_PARAM_IPCKSUM_SHIFT;
-   tso-tsopl |= 1  TSO_PARAM_TCPCKSUM_SHIFT;
-   tso-tsopl |= 1  TSO_PARAM_SEGMENT_SHIFT;
-   return true;
+   iph-daddr, 0, IPPROTO_TCP, 0);
+   ip_off = (unsigned char *)iph -
+   (unsigned char *) skb_network_header(skb

[PATCH 10/10] atl1: reduce forward declarations

2008-02-02 Thread Jay Cliburn
Rearrange functions to allow removal of some forward declarations.
Make certain global functions static along the way.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
Acked-by: Chris Snook [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c | 1406 +++---
 drivers/net/atlx/atl1.h |   10 -
 2 files changed, 703 insertions(+), 713 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 6f4a1d5..240db84 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -108,6 +108,709 @@ module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, Message level (0=none,...,16=all));
 
 /*
+ * Reset the transmit and receive units; mask and clear all interrupts.
+ * hw - Struct containing variables accessed by shared code
+ * return : 0  or  idle status (if error)
+ */
+static s32 atl1_reset_hw(struct atl1_hw *hw)
+{
+   struct pci_dev *pdev = hw-back-pdev;
+   struct atl1_adapter *adapter = hw-back;
+   u32 icr;
+   int i;
+
+   /*
+* Clear Interrupt mask to stop board from generating
+* interrupts  Clear any pending interrupt events
+*/
+   /*
+* iowrite32(0, hw-hw_addr + REG_IMR);
+* iowrite32(0x, hw-hw_addr + REG_ISR);
+*/
+
+   /*
+* Issue Soft Reset to the MAC.  This will reset the chip's
+* transmit, receive, DMA.  It will not effect
+* the current PCI configuration.  The global reset bit is self-
+* clearing, and should clear within a microsecond.
+*/
+   iowrite32(MASTER_CTRL_SOFT_RST, hw-hw_addr + REG_MASTER_CTRL);
+   ioread32(hw-hw_addr + REG_MASTER_CTRL);
+
+   iowrite16(1, hw-hw_addr + REG_PHY_ENABLE);
+   ioread16(hw-hw_addr + REG_PHY_ENABLE);
+
+   /* delay about 1ms */
+   msleep(1);
+
+   /* Wait at least 10ms for All module to be Idle */
+   for (i = 0; i  10; i++) {
+   icr = ioread32(hw-hw_addr + REG_IDLE_STATUS);
+   if (!icr)
+   break;
+   /* delay 1 ms */
+   msleep(1);
+   /* FIXME: still the right way to do this? */
+   cpu_relax();
+   }
+
+   if (icr) {
+   if (netif_msg_hw(adapter))
+   dev_dbg(pdev-dev, ICR = 0x%x\n, icr);
+   return icr;
+   }
+
+   return 0;
+}
+
+/* function about EEPROM
+ *
+ * check_eeprom_exist
+ * return 0 if eeprom exist
+ */
+static int atl1_check_eeprom_exist(struct atl1_hw *hw)
+{
+   u32 value;
+   value = ioread32(hw-hw_addr + REG_SPI_FLASH_CTRL);
+   if (value  SPI_FLASH_CTRL_EN_VPD) {
+   value = ~SPI_FLASH_CTRL_EN_VPD;
+   iowrite32(value, hw-hw_addr + REG_SPI_FLASH_CTRL);
+   }
+
+   value = ioread16(hw-hw_addr + REG_PCIE_CAP_LIST);
+   return ((value  0xFF00) == 0x6C00) ? 0 : 1;
+}
+
+static bool atl1_read_eeprom(struct atl1_hw *hw, u32 offset, u32 *p_value)
+{
+   int i;
+   u32 control;
+
+   if (offset  3)
+   /* address do not align */
+   return false;
+
+   iowrite32(0, hw-hw_addr + REG_VPD_DATA);
+   control = (offset  VPD_CAP_VPD_ADDR_MASK)  VPD_CAP_VPD_ADDR_SHIFT;
+   iowrite32(control, hw-hw_addr + REG_VPD_CAP);
+   ioread32(hw-hw_addr + REG_VPD_CAP);
+
+   for (i = 0; i  10; i++) {
+   msleep(2);
+   control = ioread32(hw-hw_addr + REG_VPD_CAP);
+   if (control  VPD_CAP_VPD_FLAG)
+   break;
+   }
+   if (control  VPD_CAP_VPD_FLAG) {
+   *p_value = ioread32(hw-hw_addr + REG_VPD_DATA);
+   return true;
+   }
+   /* timeout */
+   return false;
+}
+
+/*
+ * Reads the value from a PHY register
+ * hw - Struct containing variables accessed by shared code
+ * reg_addr - address of the PHY register to read
+ */
+s32 atl1_read_phy_reg(struct atl1_hw *hw, u16 reg_addr, u16 *phy_data)
+{
+   u32 val;
+   int i;
+
+   val = ((u32) (reg_addr  MDIO_REG_ADDR_MASK))  MDIO_REG_ADDR_SHIFT |
+   MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 
+   MDIO_CLK_SEL_SHIFT;
+   iowrite32(val, hw-hw_addr + REG_MDIO_CTRL);
+   ioread32(hw-hw_addr + REG_MDIO_CTRL);
+
+   for (i = 0; i  MDIO_WAIT_TIMES; i++) {
+   udelay(2);
+   val = ioread32(hw-hw_addr + REG_MDIO_CTRL);
+   if (!(val  (MDIO_START | MDIO_BUSY)))
+   break;
+   }
+   if (!(val  (MDIO_START | MDIO_BUSY))) {
+   *phy_data = (u16) val;
+   return 0;
+   }
+   return ATLX_ERR_PHY;
+}
+
+#define CUSTOM_SPI_CS_SETUP2
+#define CUSTOM_SPI_CLK_HI  2
+#define CUSTOM_SPI_CLK_LO  2
+#define CUSTOM_SPI_CS_HOLD 2
+#define CUSTOM_SPI_CS_HI   3
+
+static bool atl1_spi_read(struct atl1_hw *hw, u32 addr, u32 *buf)
+{
+   int i;
+   u32 value;
+
+   iowrite32(0, hw-hw_addr

[PATCH 09/10] atl1: make functions static

2008-02-02 Thread Jay Cliburn
Make needlessly global functions static.  In a couple of cases this
requires removing forward declarations and reordering functions.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
Acked-by: Chris Snook [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c |  101 ---
 drivers/net/atlx/atl1.h |3 -
 2 files changed, 51 insertions(+), 53 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 4e4cb23..6f4a1d5 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -211,7 +211,7 @@ static int atl1_mii_ioctl(struct net_device *netdev, struct 
ifreq *ifr, int cmd)
  *
  * Return 0 on success, negative on failure
  */
-s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
+static s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
 {
struct atl1_tpd_ring *tpd_ring = adapter-tpd_ring;
struct atl1_rfd_ring *rfd_ring = adapter-rfd_ring;
@@ -402,7 +402,7 @@ static void atl1_clean_tx_ring(struct atl1_adapter *adapter)
  *
  * Free all transmit software resources
  */
-void atl1_free_ring_resources(struct atl1_adapter *adapter)
+static void atl1_free_ring_resources(struct atl1_adapter *adapter)
 {
struct pci_dev *pdev = adapter-pdev;
struct atl1_tpd_ring *tpd_ring = adapter-tpd_ring;
@@ -580,40 +580,6 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
return 0;
 }
 
-/*
- * atl1_change_mtu - Change the Maximum Transfer Unit
- * @netdev: network interface device structure
- * @new_mtu: new value for maximum frame size
- *
- * Returns 0 on success, negative on failure
- */
-static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
-{
-   struct atl1_adapter *adapter = netdev_priv(netdev);
-   int old_mtu = netdev-mtu;
-   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
-
-   if ((max_frame  ETH_ZLEN + ETH_FCS_LEN) ||
-   (max_frame  MAX_JUMBO_FRAME_SIZE)) {
-   if (netif_msg_link(adapter))
-   dev_warn(adapter-pdev-dev, invalid MTU setting\n);
-   return -EINVAL;
-   }
-
-   adapter-hw.max_frame_size = max_frame;
-   adapter-hw.tx_jumbo_task_th = (max_frame + 7)  3;
-   adapter-rx_buffer_len = (max_frame + 7)  ~7;
-   adapter-hw.rx_jumbo_th = adapter-rx_buffer_len / 8;
-
-   netdev-mtu = new_mtu;
-   if ((old_mtu != new_mtu)  netif_running(netdev)) {
-   atl1_down(adapter);
-   atl1_up(adapter);
-   }
-
-   return 0;
-}
-
 static void set_flow_ctrl_old(struct atl1_adapter *adapter)
 {
u32 hi, lo, value;
@@ -1794,19 +1760,8 @@ static void atl1_phy_config(unsigned long data)
  * assert again and again.
  * /vendor comment
  */
-static void atl1_tx_timeout_task(struct work_struct *work)
-{
-   struct atl1_adapter *adapter =
-   container_of(work, struct atl1_adapter, tx_timeout_task);
-   struct net_device *netdev = adapter-netdev;
 
-   netif_device_detach(netdev);
-   atl1_down(adapter);
-   atl1_up(adapter);
-   netif_device_attach(netdev);
-}
-
-int atl1_reset(struct atl1_adapter *adapter)
+static int atl1_reset(struct atl1_adapter *adapter)
 {
int ret;
ret = atl1_reset_hw(adapter-hw);
@@ -1815,7 +1770,7 @@ int atl1_reset(struct atl1_adapter *adapter)
return atl1_init_hw(adapter-hw);
 }
 
-s32 atl1_up(struct atl1_adapter *adapter)
+static s32 atl1_up(struct atl1_adapter *adapter)
 {
struct net_device *netdev = adapter-netdev;
int err;
@@ -1860,7 +1815,7 @@ err_up:
return err;
 }
 
-void atl1_down(struct atl1_adapter *adapter)
+static void atl1_down(struct atl1_adapter *adapter)
 {
struct net_device *netdev = adapter-netdev;
 
@@ -1883,6 +1838,52 @@ void atl1_down(struct atl1_adapter *adapter)
atl1_clean_rx_ring(adapter);
 }
 
+static void atl1_tx_timeout_task(struct work_struct *work)
+{
+   struct atl1_adapter *adapter =
+   container_of(work, struct atl1_adapter, tx_timeout_task);
+   struct net_device *netdev = adapter-netdev;
+
+   netif_device_detach(netdev);
+   atl1_down(adapter);
+   atl1_up(adapter);
+   netif_device_attach(netdev);
+}
+
+/*
+ * atl1_change_mtu - Change the Maximum Transfer Unit
+ * @netdev: network interface device structure
+ * @new_mtu: new value for maximum frame size
+ *
+ * Returns 0 on success, negative on failure
+ */
+static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
+{
+   struct atl1_adapter *adapter = netdev_priv(netdev);
+   int old_mtu = netdev-mtu;
+   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
+
+   if ((max_frame  ETH_ZLEN + ETH_FCS_LEN) ||
+   (max_frame  MAX_JUMBO_FRAME_SIZE)) {
+   if (netif_msg_link(adapter))
+   dev_warn(adapter-pdev-dev, invalid MTU setting\n);
+   return -EINVAL;
+   }
+
+   adapter-hw.max_frame_size = max_frame

[PATCH 00/10] atl1: move to atlx and update for 2.6.25

2008-02-02 Thread Jay Cliburn
In preparation for a future atl2 driver for the Atheros L2 10/100 chip,
we propose to move the existing atl1 driver to a new directory
(drivers/net/atlx), then split out functions and definitions that both
atl1 and atl2 can share.  The final structure will look like this:

drivers/net/atl1deleted
drivers/net/atlxnew
drivers/net/atlx/atl1.c atl1-specific functions
drivers/net/atlx/atl1.h atl1-specific definitions
drivers/net/atlx/atlx.c atl1-atl2 shared functions
drivers/net/atlx/atlx.h atl1-atl2 shared definitions

The first two patches submitted in this patchset accomplish the
relocation by moving the atl1 driver over to drivers/net/atlx, then
splitting out shareable functions and definitions.  Some transitory
hackery will be present until the atl2 merge.  Please overlook it for
now.

The remaining 8 patches provide some cleanup and minor functionality
changes, the most important of which is a fix to our long-broken TSO
capability.

The conform to vendor driver patches submitted on 31 December 2007
have been dropped.

Table of contents:
---
0001-atl1-relocate-atl1-driver-to-drivers-net-atlx.patch
0002-atl1-move-common-functions-to-atlx-files.patch
0003-atl1-fix-broken-TSO.patch
0004-atl1-add-ethtool-register-dump.patch
0005-atl1-simplify-tx-packet-descriptor.patch
0006-atl1-use-csum_start.patch
0007-atl1-use-netif_msg.patch
0008-atl1-print-debug-info-if-rrd-error.patch
0009-atl1-make-functions-static.patch
0010-atl1-reduce-forward-declarations.patch


Summary diffstat:
---
 drivers/net/Makefile  |2 +-
 drivers/net/atl1/Makefile |2 -
 drivers/net/atl1/atl1.h   |  286 
 drivers/net/atl1/atl1_ethtool.c   |  505 --
 drivers/net/atl1/atl1_hw.c|  720 -
 drivers/net/atl1/atl1_hw.h|  946 ---
 drivers/net/atl1/atl1_param.c |  203 ---
 drivers/net/atlx/Makefile |1 +
 drivers/net/{atl1/atl1_main.c = atlx/atl1.c} | 2118
+++-- drivers/net/atlx/atl1.h
|  796 ++ drivers/net/atlx/atlx.c   |  433
+ drivers/net/atlx/atlx.h   |  506 ++
 12 files changed, 3352 insertions(+), 3166 deletions(-)
 delete mode 100644 drivers/net/atl1/Makefile
 delete mode 100644 drivers/net/atl1/atl1.h
 delete mode 100644 drivers/net/atl1/atl1_ethtool.c
 delete mode 100644 drivers/net/atl1/atl1_hw.c
 delete mode 100644 drivers/net/atl1/atl1_hw.h
 delete mode 100644 drivers/net/atl1/atl1_param.c
 create mode 100644 drivers/net/atlx/Makefile
 rename drivers/net/{atl1/atl1_main.c = atlx/atl1.c} (57%)
 create mode 100644 drivers/net/atlx/atl1.h
 create mode 100644 drivers/net/atlx/atlx.c
 create mode 100644 drivers/net/atlx/atlx.h

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


[2.6.23.y][PATCH] atl1: fix frame length bug

2008-01-30 Thread Jay Cliburn
>From de0e1eddb6a4dd7673f84c472812b062aaea2f39 Mon Sep 17 00:00:00 2001
From: Jay Cliburn <[EMAIL PROTECTED]>
Date: Wed, 30 Jan 2008 19:21:10 -0600
Subject: [PATCH] atl1: fix frame length bug

Upstream commit: 2a49128f0a6edee337174ea341c1d6d7565be350

The driver sets up the hardware to accept a frame with max length
equal to MTU + Ethernet header + FCS + VLAN tag, but we neglect to
add the VLAN tag size to the ingress buffer.  When a VLAN-tagged
frame arrives, the hardware passes it, but bad things happen
because the buffer is too small.  This patch fixes that.

Thanks to David Harris for reporting the bug and testing the fix.

Tested-by: David Harris <[EMAIL PROTECTED]>
Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_main.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index f23e13c..d2d4730 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -121,7 +121,7 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
struct atl1_hw *hw = >hw;
struct net_device *netdev = adapter->netdev;
 
-   hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
+   hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
 
adapter->wol = 0;
@@ -689,7 +689,7 @@ static int atl1_change_mtu(struct net_device *netdev, int 
new_mtu)
 {
struct atl1_adapter *adapter = netdev_priv(netdev);
int old_mtu = netdev->mtu;
-   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
+   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
 
if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
(max_frame > MAX_JUMBO_FRAME_SIZE)) {
@@ -854,8 +854,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
/* set Interrupt Clear Timer */
iowrite16(adapter->ict, hw->hw_addr + REG_CMBDISDMA_TIMER);
 
-   /* set MTU, 4 : VLAN */
-   iowrite32(hw->max_frame_size + 4, hw->hw_addr + REG_MTU);
+   /* set max frame size hw will accept */
+   iowrite32(hw->max_frame_size, hw->hw_addr + REG_MTU);
 
/* jumbo size & rrd retirement timer */
value = (((u32) hw->rx_jumbo_th & RXQ_JMBOSZ_TH_MASK)
-- 
1.5.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[2.6.23.y][PATCH] atl1: fix frame length bug

2008-01-30 Thread Jay Cliburn
From de0e1eddb6a4dd7673f84c472812b062aaea2f39 Mon Sep 17 00:00:00 2001
From: Jay Cliburn [EMAIL PROTECTED]
Date: Wed, 30 Jan 2008 19:21:10 -0600
Subject: [PATCH] atl1: fix frame length bug

Upstream commit: 2a49128f0a6edee337174ea341c1d6d7565be350

The driver sets up the hardware to accept a frame with max length
equal to MTU + Ethernet header + FCS + VLAN tag, but we neglect to
add the VLAN tag size to the ingress buffer.  When a VLAN-tagged
frame arrives, the hardware passes it, but bad things happen
because the buffer is too small.  This patch fixes that.

Thanks to David Harris for reporting the bug and testing the fix.

Tested-by: David Harris [EMAIL PROTECTED]
Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_main.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index f23e13c..d2d4730 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -121,7 +121,7 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
struct atl1_hw *hw = adapter-hw;
struct net_device *netdev = adapter-netdev;
 
-   hw-max_frame_size = netdev-mtu + ETH_HLEN + ETH_FCS_LEN;
+   hw-max_frame_size = netdev-mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
hw-min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
 
adapter-wol = 0;
@@ -689,7 +689,7 @@ static int atl1_change_mtu(struct net_device *netdev, int 
new_mtu)
 {
struct atl1_adapter *adapter = netdev_priv(netdev);
int old_mtu = netdev-mtu;
-   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
+   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
 
if ((max_frame  ETH_ZLEN + ETH_FCS_LEN) ||
(max_frame  MAX_JUMBO_FRAME_SIZE)) {
@@ -854,8 +854,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
/* set Interrupt Clear Timer */
iowrite16(adapter-ict, hw-hw_addr + REG_CMBDISDMA_TIMER);
 
-   /* set MTU, 4 : VLAN */
-   iowrite32(hw-max_frame_size + 4, hw-hw_addr + REG_MTU);
+   /* set max frame size hw will accept */
+   iowrite32(hw-max_frame_size, hw-hw_addr + REG_MTU);
 
/* jumbo size  rrd retirement timer */
value = (((u32) hw-rx_jumbo_th  RXQ_JMBOSZ_TH_MASK)
-- 
1.5.3.7

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


Re: [PATCH 09/26] atl1: refactor tx processing

2008-01-24 Thread Jay Cliburn
On Tue, 22 Jan 2008 18:31:09 -0600
Jay Cliburn <[EMAIL PROTECTED]> wrote:

> On Tue, 22 Jan 2008 04:58:17 -0500
> Jeff Garzik <[EMAIL PROTECTED]> wrote:
> 
[...]
> > for such a huge patch, this description is very tiny.  [describe]
> > what is refactored, and why.

Is this one any better?



>From df475e2eea401f9dc18ca23dab538b99fb9e710c Mon Sep 17 00:00:00 2001
From: Jay Cliburn <[EMAIL PROTECTED]>
Date: Wed, 23 Jan 2008 21:36:36 -0600
Subject: [PATCH] atl1: simplify tx packet descriptor

The transmit packet descriptor consists of four 32-bit words, with word 3
upper bits overloaded depending upon the condition of its bits 3 and 4.
The driver currently duplicates all word 2 and some word 3 register bit
definitions unnecessarily and also uses a set of nested structures in its
definition of the TPD without good cause. This patch adds a lengthy
comment describing the TPD, eliminates duplicate TPD bit definitions,
and simplifies the TPD structure itself. It also expands the TSO check
to correctly handle custom checksum versus TSO processing using the revised
TPD definitions. Finally, shorten some variable names in the transmit
processing path to reduce line lengths, rename some variables to better
describe their purpose (e.g., nseg versus m), and add a comment or two
to better describe what the code is doing.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atlx/atl1.c |  265 +--
 drivers/net/atlx/atl1.h |  201 +++-
 2 files changed, 246 insertions(+), 220 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 1f564f0..f4add3c 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1259,8 +1259,6 @@ static void atl1_intr_tx(struct atl1_adapter *adapter)
dev_kfree_skb_irq(buffer_info->skb);
buffer_info->skb = NULL;
}
-   tpd->buffer_addr = 0;
-   tpd->desc.data = 0;
 
if (++sw_tpd_next_to_clean == tpd_ring->count)
sw_tpd_next_to_clean = 0;
@@ -1282,48 +1280,69 @@ static u16 atl1_tpd_avail(struct atl1_tpd_ring 
*tpd_ring)
 }
 
 static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
-struct tso_param *tso)
+   struct tx_packet_desc *ptpd)
 {
-   /* We enter this function holding a spinlock. */
-   u8 ipofst;
+   /* spinlock held */
+   u8 hdr_len, ip_off;
+   u32 real_len;
int err;
 
if (skb_shinfo(skb)->gso_size) {
if (skb_header_cloned(skb)) {
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (unlikely(err))
-   return err;
+   return -1;
}
 
if (skb->protocol == ntohs(ETH_P_IP)) {
struct iphdr *iph = ip_hdr(skb);
 
-   iph->tot_len = 0;
+   real_len = (((unsigned char *)iph - skb->data) +
+   ntohs(iph->tot_len));
+   if (real_len < skb->len)
+   pskb_trim(skb, real_len);
+   hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
+   if (skb->len == hdr_len) {
+   iph->check = 0;
+   tcp_hdr(skb)->check =
+   ~csum_tcpudp_magic(iph->saddr,
+   iph->daddr, tcp_hdrlen(skb),
+   IPPROTO_TCP, 0);
+   ptpd->word3 |= (iph->ihl & TPD_IPHL_MASK) <<
+   TPD_IPHL_SHIFT;
+   ptpd->word3 |= ((tcp_hdrlen(skb) >> 2) &
+   TPD_TCPHDRLEN_MASK) <<
+   TPD_TCPHDRLEN_SHIFT;
+   ptpd->word3 |= 1 << TPD_IP_CSUM_SHIFT;
+   ptpd->word3 |= 1 << TPD_TCP_CSUM_SHIFT;
+   return 1;
+   }
+
iph->check = 0;
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
-   iph->daddr, 0, IPPROTO_TCP, 0);
-   ipofst = skb_network_offset(skb);
-   if (ipofst != ETH_HLEN) /* 802.3 frame */
-   tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT;
-
-   tso->tsopl |= (iph->ihl &
-   TSO_PARAM_IPHL_MASK) << TSO_PARAM_IPHL_SHIFT;
-   tso->tsopl |= ((tcp_hdrlen(skb) 

Re: [PATCH 09/26] atl1: refactor tx processing

2008-01-24 Thread Jay Cliburn
On Tue, 22 Jan 2008 18:31:09 -0600
Jay Cliburn [EMAIL PROTECTED] wrote:

 On Tue, 22 Jan 2008 04:58:17 -0500
 Jeff Garzik [EMAIL PROTECTED] wrote:
 
[...]
  for such a huge patch, this description is very tiny.  [describe]
  what is refactored, and why.

Is this one any better?



From df475e2eea401f9dc18ca23dab538b99fb9e710c Mon Sep 17 00:00:00 2001
From: Jay Cliburn [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 21:36:36 -0600
Subject: [PATCH] atl1: simplify tx packet descriptor

The transmit packet descriptor consists of four 32-bit words, with word 3
upper bits overloaded depending upon the condition of its bits 3 and 4.
The driver currently duplicates all word 2 and some word 3 register bit
definitions unnecessarily and also uses a set of nested structures in its
definition of the TPD without good cause. This patch adds a lengthy
comment describing the TPD, eliminates duplicate TPD bit definitions,
and simplifies the TPD structure itself. It also expands the TSO check
to correctly handle custom checksum versus TSO processing using the revised
TPD definitions. Finally, shorten some variable names in the transmit
processing path to reduce line lengths, rename some variables to better
describe their purpose (e.g., nseg versus m), and add a comment or two
to better describe what the code is doing.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c |  265 +--
 drivers/net/atlx/atl1.h |  201 +++-
 2 files changed, 246 insertions(+), 220 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 1f564f0..f4add3c 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1259,8 +1259,6 @@ static void atl1_intr_tx(struct atl1_adapter *adapter)
dev_kfree_skb_irq(buffer_info-skb);
buffer_info-skb = NULL;
}
-   tpd-buffer_addr = 0;
-   tpd-desc.data = 0;
 
if (++sw_tpd_next_to_clean == tpd_ring-count)
sw_tpd_next_to_clean = 0;
@@ -1282,48 +1280,69 @@ static u16 atl1_tpd_avail(struct atl1_tpd_ring 
*tpd_ring)
 }
 
 static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
-struct tso_param *tso)
+   struct tx_packet_desc *ptpd)
 {
-   /* We enter this function holding a spinlock. */
-   u8 ipofst;
+   /* spinlock held */
+   u8 hdr_len, ip_off;
+   u32 real_len;
int err;
 
if (skb_shinfo(skb)-gso_size) {
if (skb_header_cloned(skb)) {
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (unlikely(err))
-   return err;
+   return -1;
}
 
if (skb-protocol == ntohs(ETH_P_IP)) {
struct iphdr *iph = ip_hdr(skb);
 
-   iph-tot_len = 0;
+   real_len = (((unsigned char *)iph - skb-data) +
+   ntohs(iph-tot_len));
+   if (real_len  skb-len)
+   pskb_trim(skb, real_len);
+   hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
+   if (skb-len == hdr_len) {
+   iph-check = 0;
+   tcp_hdr(skb)-check =
+   ~csum_tcpudp_magic(iph-saddr,
+   iph-daddr, tcp_hdrlen(skb),
+   IPPROTO_TCP, 0);
+   ptpd-word3 |= (iph-ihl  TPD_IPHL_MASK) 
+   TPD_IPHL_SHIFT;
+   ptpd-word3 |= ((tcp_hdrlen(skb)  2) 
+   TPD_TCPHDRLEN_MASK) 
+   TPD_TCPHDRLEN_SHIFT;
+   ptpd-word3 |= 1  TPD_IP_CSUM_SHIFT;
+   ptpd-word3 |= 1  TPD_TCP_CSUM_SHIFT;
+   return 1;
+   }
+
iph-check = 0;
tcp_hdr(skb)-check = ~csum_tcpudp_magic(iph-saddr,
-   iph-daddr, 0, IPPROTO_TCP, 0);
-   ipofst = skb_network_offset(skb);
-   if (ipofst != ETH_HLEN) /* 802.3 frame */
-   tso-tsopl |= 1  TSO_PARAM_ETHTYPE_SHIFT;
-
-   tso-tsopl |= (iph-ihl 
-   TSO_PARAM_IPHL_MASK)  TSO_PARAM_IPHL_SHIFT;
-   tso-tsopl |= ((tcp_hdrlen(skb)  2) 
-   TSO_PARAM_TCPHDRLEN_MASK) 
-   TSO_PARAM_TCPHDRLEN_SHIFT;
-   tso-tsopl |= (skb_shinfo(skb)-gso_size 
-   TSO_PARAM_MSS_MASK)  TSO_PARAM_MSS_SHIFT

Re: [PATCH 06/26] atl1: update initialization parameters

2008-01-22 Thread Jay Cliburn
On Tue, 22 Jan 2008 04:56:11 -0500
Jeff Garzik <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] wrote:
> > From: Jay Cliburn <[EMAIL PROTECTED]>
> > 
> > Update initialization parameters to match the current vendor driver
> > version 1.2.40.2.

[...]

> ACK without any better knowledge...  but is any addition insight 
> available at all?

No, sorry Jeff.  I simply took the vendor's current driver and matched
his initialization settings.  I can only assume he discovered these
values through lab testing.

For this and the other "conform to vendor driver" patches in this set, I
thought it important to have the in-tree driver match the vendor driver
as closely as possible.  The primary motivations are (1) my belief that
he's in a better position to test the NIC, and (2) to be able to go to
him for assistance occasionally and not be rejected because of
significant differences between his and our drivers.

Jay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/26] atl1: refactor tx processing

2008-01-22 Thread Jay Cliburn
On Tue, 22 Jan 2008 04:58:17 -0500
Jeff Garzik <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] wrote:
> > From: Jay Cliburn <[EMAIL PROTECTED]>
> > 
> > Refactor tx processing to use a less convoluted tx packet
> > descriptor and to conform generally with the vendor's current
> > version 1.2.40.2.
> > 
> > Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
> > ---
> >  drivers/net/atlx/atl1.c |  265
> > +--
> > drivers/net/atlx/atl1.h |  201 +++-
> > 2 files changed, 246 insertions(+), 220 deletions(-)
> 
> for such a huge patch, this description is very tiny.  [describe]
> what is refactored, and why.

Okay, I'll go back and rework the offending descriptions for this and
the other patches in this set.

> what does "less convoluted" mean?

I should have written "simpler," I suppose.

Before:
===
struct tso_param {
u32 tsopu;  /* tso_param upper word */
u32 tsopl;  /* tso_param lower word */
};

struct csum_param {
u32 csumpu; /* csum_param upper word */
u32 csumpl; /* csum_param lower word */
};

union tpd_descr {
u64 data;
struct csum_param csum;
struct tso_param tso;
};

struct tx_packet_desc {
__le64 buffer_addr;
union tpd_descr desc;
};


After:
==
struct tx_packet_desc {
__le64 buffer_addr;
__le32 word2;
__le32 word3;
};

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/26] atl1: refactor tx processing

2008-01-22 Thread Jay Cliburn
On Tue, 22 Jan 2008 04:58:17 -0500
Jeff Garzik [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] wrote:
  From: Jay Cliburn [EMAIL PROTECTED]
  
  Refactor tx processing to use a less convoluted tx packet
  descriptor and to conform generally with the vendor's current
  version 1.2.40.2.
  
  Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
  ---
   drivers/net/atlx/atl1.c |  265
  +--
  drivers/net/atlx/atl1.h |  201 +++-
  2 files changed, 246 insertions(+), 220 deletions(-)
 
 for such a huge patch, this description is very tiny.  [describe]
 what is refactored, and why.

Okay, I'll go back and rework the offending descriptions for this and
the other patches in this set.

 what does less convoluted mean?

I should have written simpler, I suppose.

Before:
===
struct tso_param {
u32 tsopu;  /* tso_param upper word */
u32 tsopl;  /* tso_param lower word */
};

struct csum_param {
u32 csumpu; /* csum_param upper word */
u32 csumpl; /* csum_param lower word */
};

union tpd_descr {
u64 data;
struct csum_param csum;
struct tso_param tso;
};

struct tx_packet_desc {
__le64 buffer_addr;
union tpd_descr desc;
};


After:
==
struct tx_packet_desc {
__le64 buffer_addr;
__le32 word2;
__le32 word3;
};

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


Re: [PATCH 06/26] atl1: update initialization parameters

2008-01-22 Thread Jay Cliburn
On Tue, 22 Jan 2008 04:56:11 -0500
Jeff Garzik [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] wrote:
  From: Jay Cliburn [EMAIL PROTECTED]
  
  Update initialization parameters to match the current vendor driver
  version 1.2.40.2.

[...]

 ACK without any better knowledge...  but is any addition insight 
 available at all?

No, sorry Jeff.  I simply took the vendor's current driver and matched
his initialization settings.  I can only assume he discovered these
values through lab testing.

For this and the other conform to vendor driver patches in this set, I
thought it important to have the in-tree driver match the vendor driver
as closely as possible.  The primary motivations are (1) my belief that
he's in a better position to test the NIC, and (2) to be able to go to
him for assistance occasionally and not be rejected because of
significant differences between his and our drivers.

Jay
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 25/26] [REVISED] atl1: add NAPI support

2008-01-01 Thread Jay Cliburn
Thanks for your comments Stephen and Joonwoo.  Here's the revised
version of the atl1 NAPI patch.



>From 9c3a8944220287671f983557099bc329f02fda9b Mon Sep 17 00:00:00 2001
From: Jay Cliburn <[EMAIL PROTECTED]>
Date: Tue, 1 Jan 2008 11:55:24 -0600
Subject: [PATCH 25/26] atl1: add NAPI support

Add support for NAPI.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/Kconfig |   14 +
 drivers/net/atlx/atl1.c |  125 +++
 drivers/net/atlx/atl1.h |   19 +++
 drivers/net/atlx/atlx.h |7 ++-
 4 files changed, 132 insertions(+), 33 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d9107e5..095629f 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2371,6 +2371,20 @@ config ATL1
  To compile this driver as a module, choose M here.  The module
  will be called atl1.
 
+config ATL1_NAPI
+   bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
+   depends on ATL1 && EXPERIMENTAL
+   help
+ NAPI is a new driver API designed to reduce CPU and interrupt load
+ when the driver is receiving lots of packets from the card. It is
+ still somewhat experimental and thus not yet enabled by default.
+
+ If your estimated Rx load is 10kpps or more, or if the card will be
+ deployed on potentially unfriendly networks (e.g. in a firewall),
+ then say Y here.
+
+ If in doubt, say N.
+
 endif # NETDEV_1000
 
 #
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 8b4aa94..88ff000 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -754,13 +754,6 @@ static void atl1_set_mac_addr(struct atl1_hw *hw)
iowrite32(value, (hw->hw_addr + REG_MAC_STA_ADDR) + (1 << 2));
 }
 
-static int atl1_alloc_queues(struct atl1_adapter *adapter)
-{
-   /* temporary placeholder function for NAPI */
-
-   return 0;
-}
-
 /*
  * atl1_sw_init - Initialize general software structures (struct atl1_adapter)
  * @adapter: board private structure to initialize
@@ -769,7 +762,6 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
 {
struct atl1_hw *hw = >hw;
struct net_device *netdev = adapter->netdev;
-   int err;
 
hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
@@ -811,13 +803,6 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
hw->cmb_tx_timer = 256; /* about 512us */
hw->smb_timer = 10; /* about 200ms */
 
-   err = atl1_alloc_queues(adapter);
-   if (err) {
-   dev_printk(KERN_DEBUG, >pdev->dev,
-   "unable to allocate memory for queues\n");
-   return -ENOMEM;
-   }
-
spin_lock_init(>lock);
spin_lock_init(>mb_lock);
set_bit(__ATL1_DOWN, >flags);
@@ -1209,9 +1194,8 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
}
 
/* autoneg, insert timer to reconfig phy */
-   if (!test_and_set_bit(0, >cfg_phy)) {
+   if (!test_and_set_bit(0, >cfg_phy))
mod_timer(>phy_config_timer, jiffies + 5 * HZ);
-   }
 
return 0;
 }
@@ -1699,18 +1683,21 @@ next:
return num_alloc;
 }
 
-static void atl1_clean_rx_irq(struct atl1_adapter *adapter)
+#ifdef CONFIG_ATL1_NAPI
+static int atl1_clean_rx_irq(struct atl1_adapter *adapter, int work_to_do)
+#else
+static int atl1_clean_rx_irq(struct atl1_adapter *adapter)
+#endif
 {
struct net_device *netdev = adapter->netdev;
-   int i, count;
+   int i, count = 0;
u16 length, rrd_next_to_clean;
struct atl1_rfd_ring *rfd_ring = >rfd_ring;
struct atl1_rrd_ring *rrd_ring = >rrd_ring;
struct atl1_buffer *buffer_info;
struct rx_return_desc *rrd;
struct sk_buff *skb;
-
-   count = 0;
+   int work_done = 0;
 
rrd_next_to_clean = (u16) atomic_read(_ring->next_to_clean);
 
@@ -1809,6 +1796,18 @@ rrd_ok:
atl1_rx_checksum(adapter, rrd, skb);
skb->protocol = eth_type_trans(skb, adapter->netdev);
 
+#ifdef CONFIG_ATL1_NAPI
+   if (adapter->vlgrp && (rrd->pkt_flg & PACKET_FLAG_VLAN_INS)) {
+   u16 vlan_tag = (rrd->vlan_tag >> 4) |
+   ((rrd->vlan_tag & 7) << 13) |
+   ((rrd->vlan_tag & 8) << 9);
+   vlan_hwaccel_receive_skb(skb, adapter->vlgrp, vlan_tag);
+   } else
+   netif_receive_skb(skb);
+
+   if (++work_done >= work_to_do)
+   break;
+#else
if (adapter->vlgrp && (rrd->pkt_flg & PACKET_FLAG_VLAN_INS)) {
 

Re: [PATCH 25/26] [REVISED] atl1: add NAPI support

2008-01-01 Thread Jay Cliburn
Thanks for your comments Stephen and Joonwoo.  Here's the revised
version of the atl1 NAPI patch.



From 9c3a8944220287671f983557099bc329f02fda9b Mon Sep 17 00:00:00 2001
From: Jay Cliburn [EMAIL PROTECTED]
Date: Tue, 1 Jan 2008 11:55:24 -0600
Subject: [PATCH 25/26] atl1: add NAPI support

Add support for NAPI.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/Kconfig |   14 +
 drivers/net/atlx/atl1.c |  125 +++
 drivers/net/atlx/atl1.h |   19 +++
 drivers/net/atlx/atlx.h |7 ++-
 4 files changed, 132 insertions(+), 33 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d9107e5..095629f 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2371,6 +2371,20 @@ config ATL1
  To compile this driver as a module, choose M here.  The module
  will be called atl1.
 
+config ATL1_NAPI
+   bool Use Rx Polling (NAPI) (EXPERIMENTAL)
+   depends on ATL1  EXPERIMENTAL
+   help
+ NAPI is a new driver API designed to reduce CPU and interrupt load
+ when the driver is receiving lots of packets from the card. It is
+ still somewhat experimental and thus not yet enabled by default.
+
+ If your estimated Rx load is 10kpps or more, or if the card will be
+ deployed on potentially unfriendly networks (e.g. in a firewall),
+ then say Y here.
+
+ If in doubt, say N.
+
 endif # NETDEV_1000
 
 #
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 8b4aa94..88ff000 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -754,13 +754,6 @@ static void atl1_set_mac_addr(struct atl1_hw *hw)
iowrite32(value, (hw-hw_addr + REG_MAC_STA_ADDR) + (1  2));
 }
 
-static int atl1_alloc_queues(struct atl1_adapter *adapter)
-{
-   /* temporary placeholder function for NAPI */
-
-   return 0;
-}
-
 /*
  * atl1_sw_init - Initialize general software structures (struct atl1_adapter)
  * @adapter: board private structure to initialize
@@ -769,7 +762,6 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
 {
struct atl1_hw *hw = adapter-hw;
struct net_device *netdev = adapter-netdev;
-   int err;
 
hw-max_frame_size = netdev-mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
hw-min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
@@ -811,13 +803,6 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
hw-cmb_tx_timer = 256; /* about 512us */
hw-smb_timer = 10; /* about 200ms */
 
-   err = atl1_alloc_queues(adapter);
-   if (err) {
-   dev_printk(KERN_DEBUG, adapter-pdev-dev,
-   unable to allocate memory for queues\n);
-   return -ENOMEM;
-   }
-
spin_lock_init(adapter-lock);
spin_lock_init(adapter-mb_lock);
set_bit(__ATL1_DOWN, adapter-flags);
@@ -1209,9 +1194,8 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
}
 
/* autoneg, insert timer to reconfig phy */
-   if (!test_and_set_bit(0, adapter-cfg_phy)) {
+   if (!test_and_set_bit(0, adapter-cfg_phy))
mod_timer(adapter-phy_config_timer, jiffies + 5 * HZ);
-   }
 
return 0;
 }
@@ -1699,18 +1683,21 @@ next:
return num_alloc;
 }
 
-static void atl1_clean_rx_irq(struct atl1_adapter *adapter)
+#ifdef CONFIG_ATL1_NAPI
+static int atl1_clean_rx_irq(struct atl1_adapter *adapter, int work_to_do)
+#else
+static int atl1_clean_rx_irq(struct atl1_adapter *adapter)
+#endif
 {
struct net_device *netdev = adapter-netdev;
-   int i, count;
+   int i, count = 0;
u16 length, rrd_next_to_clean;
struct atl1_rfd_ring *rfd_ring = adapter-rfd_ring;
struct atl1_rrd_ring *rrd_ring = adapter-rrd_ring;
struct atl1_buffer *buffer_info;
struct rx_return_desc *rrd;
struct sk_buff *skb;
-
-   count = 0;
+   int work_done = 0;
 
rrd_next_to_clean = (u16) atomic_read(rrd_ring-next_to_clean);
 
@@ -1809,6 +1796,18 @@ rrd_ok:
atl1_rx_checksum(adapter, rrd, skb);
skb-protocol = eth_type_trans(skb, adapter-netdev);
 
+#ifdef CONFIG_ATL1_NAPI
+   if (adapter-vlgrp  (rrd-pkt_flg  PACKET_FLAG_VLAN_INS)) {
+   u16 vlan_tag = (rrd-vlan_tag  4) |
+   ((rrd-vlan_tag  7)  13) |
+   ((rrd-vlan_tag  8)  9);
+   vlan_hwaccel_receive_skb(skb, adapter-vlgrp, vlan_tag);
+   } else
+   netif_receive_skb(skb);
+
+   if (++work_done = work_to_do)
+   break;
+#else
if (adapter-vlgrp  (rrd-pkt_flg  PACKET_FLAG_VLAN_INS)) {
u16 vlan_tag = (rrd-vlan_tag  4) |
((rrd-vlan_tag  7)  13) |
@@ -1816,6 +1815,7 @@ rrd_ok

Re: Allow (O=...) from file

2007-12-08 Thread Jay Cliburn
On Sat, 8 Dec 2007 21:14:09 +0100
Sam Ravnborg <[EMAIL PROTECTED]> wrote:

> Jay - can I ask you to try out following patch.

Hello Sam,

Yes, your patch works for me.

Thank you very much.

> diff --git a/Makefile b/Makefile
> index a5252f4..7fb1a2c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -118,9 +118,6 @@ saved-output := $(KBUILD_OUTPUT)
>  KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
>  $(if $(KBUILD_OUTPUT),, \
>   $(error output directory "$(saved-output)" does not exist))
> -# Check that OUTPUT directory is not the same as where we have
> kernel src -$(if $(filter-out $(KBUILD_OUTPUT),$(shell /bin/pwd)),, \
> - $(error Output directory (O=...) specifies kernel src dir))
>  
>  PHONY += $(MAKECMDGOALS) sub-make
>  
> diff --git a/scripts/mkmakefile b/scripts/mkmakefile
> index ee39fac..9ad1bd7 100644
> --- a/scripts/mkmakefile
> +++ b/scripts/mkmakefile
> @@ -11,6 +11,12 @@
>  
>  
>  test ! -r $2/Makefile -o -O $2/Makefile || exit 0
> +# Only overwrite automatically generated Makefiles
> +# (so we do not overwrite kernel Makefile)
> +if ! grep -q Automatically $2/Makefile
> +then
> + exit 0
> +fi
>  echo "  GEN $2/Makefile"
>  
>  cat << EOF > $2/Makefile
> --
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Allow (O=...) from file

2007-12-08 Thread Jay Cliburn
On Sat, 8 Dec 2007 21:14:09 +0100
Sam Ravnborg [EMAIL PROTECTED] wrote:

 Jay - can I ask you to try out following patch.

Hello Sam,

Yes, your patch works for me.

Thank you very much.

 diff --git a/Makefile b/Makefile
 index a5252f4..7fb1a2c 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -118,9 +118,6 @@ saved-output := $(KBUILD_OUTPUT)
  KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT)  /bin/pwd)
  $(if $(KBUILD_OUTPUT),, \
   $(error output directory $(saved-output) does not exist))
 -# Check that OUTPUT directory is not the same as where we have
 kernel src -$(if $(filter-out $(KBUILD_OUTPUT),$(shell /bin/pwd)),, \
 - $(error Output directory (O=...) specifies kernel src dir))
  
  PHONY += $(MAKECMDGOALS) sub-make
  
 diff --git a/scripts/mkmakefile b/scripts/mkmakefile
 index ee39fac..9ad1bd7 100644
 --- a/scripts/mkmakefile
 +++ b/scripts/mkmakefile
 @@ -11,6 +11,12 @@
  
  
  test ! -r $2/Makefile -o -O $2/Makefile || exit 0
 +# Only overwrite automatically generated Makefiles
 +# (so we do not overwrite kernel Makefile)
 +if ! grep -q Automatically $2/Makefile
 +then
 + exit 0
 +fi
  echo   GEN $2/Makefile
  
  cat  EOF  $2/Makefile
 --
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Allow (O=...) from file

2007-12-06 Thread Jay Cliburn
On Thu, 6 Dec 2007 15:57:38 +0100 (CET)
Jan Engelhardt <[EMAIL PROTECTED]> wrote:

> 
> On Dec 4 2007 21:04, Jay Cliburn wrote:
> >
> >This piece of the top-level Makefile in current git causes an
> >out-of-tree driver Makefile to fail.
> >
> >101 ifdef O
> >102   ifeq ("$(origin O)", "command line")
> >103 KBUILD_OUTPUT := $(O)
> >104   endif
> >105 endif
> 
> Should not it just use the usual boilerplate?
> 
> kdir := /lib/modules/$(shell uname -r)/build
> all:
>   make -C ${kdir} M=$$PWD

Yep, that certainly works, but I was using a vendor-provided Makefile
that employs O=...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Allow (O=...) from file

2007-12-06 Thread Jay Cliburn
On Thu, 6 Dec 2007 15:57:38 +0100 (CET)
Jan Engelhardt [EMAIL PROTECTED] wrote:

 
 On Dec 4 2007 21:04, Jay Cliburn wrote:
 
 This piece of the top-level Makefile in current git causes an
 out-of-tree driver Makefile to fail.
 
 101 ifdef O
 102   ifeq ($(origin O), command line)
 103 KBUILD_OUTPUT := $(O)
 104   endif
 105 endif
 
 Should not it just use the usual boilerplate?
 
 kdir := /lib/modules/$(shell uname -r)/build
 all:
   make -C ${kdir} M=$$PWD

Yep, that certainly works, but I was using a vendor-provided Makefile
that employs O=...
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Allow (O=...) from file

2007-12-05 Thread Jay Cliburn
On Wed, 5 Dec 2007 22:00:03 +0100
Sam Ravnborg <[EMAIL PROTECTED]> wrote:

> On Tue, Dec 04, 2007 at 09:04:33PM -0600, Jay Cliburn wrote:
> > Sam,
> > 
> > This piece of the top-level Makefile in current git causes an
> > out-of-tree driver Makefile to fail.
> > 
> > 101 ifdef O
> > 102   ifeq ("$(origin O)", "command line")
> > 103 KBUILD_OUTPUT := $(O)
> > 104   endif
> > 105 endif
> > 
> > The out-of-tree driver Makefile contains an O=... directive that
> > (correctly) does _not_ specify the kernel source dir, and apparently
> > isn't overridden by the command line either. If in the above
> > Makefile snippet I change "command line" to "file", my out-of-tree
> > make succeeds. What do you think about allowing O= to come from a
> > file in addition to the command line?
> 
> When you change "command line" to "file" you actually makes kbuild
> ignore the O=... value which is why it succeeds.

I'm puzzled by your statement.  Isn't the opposite true?  When using
"command line", doesn't the following happen?

1. My makefile sets O=/foo
2. My makefile invokes your makefile with O=/foo
3. Your makefile ignores my O=/foo because it requires O=/foo to
originate from the command line
4. KBUILD_OUTPUT never gets set to /foo and we hit the error

OTOH, if I use "file":
1. My makefile sets O=/foo
2. My makefile invokes your makefile with O=/foo
3. Your makefile accepts my O=/foo because it requires O=/foo to
originate from another makefile
4. KBUILD_OUTPUT gets set to /foo and my make succeeds

This all used to work the last time I tried it, which was sometime
during 2.6.23 development, IIRC.  Isn't the current structure going to
break just about all out-of-tree driver builds?

Jay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Allow (O=...) from file

2007-12-05 Thread Jay Cliburn
On Wed, 5 Dec 2007 22:00:03 +0100
Sam Ravnborg [EMAIL PROTECTED] wrote:

 On Tue, Dec 04, 2007 at 09:04:33PM -0600, Jay Cliburn wrote:
  Sam,
  
  This piece of the top-level Makefile in current git causes an
  out-of-tree driver Makefile to fail.
  
  101 ifdef O
  102   ifeq ($(origin O), command line)
  103 KBUILD_OUTPUT := $(O)
  104   endif
  105 endif
  
  The out-of-tree driver Makefile contains an O=... directive that
  (correctly) does _not_ specify the kernel source dir, and apparently
  isn't overridden by the command line either. If in the above
  Makefile snippet I change command line to file, my out-of-tree
  make succeeds. What do you think about allowing O= to come from a
  file in addition to the command line?
 
 When you change command line to file you actually makes kbuild
 ignore the O=... value which is why it succeeds.

I'm puzzled by your statement.  Isn't the opposite true?  When using
command line, doesn't the following happen?

1. My makefile sets O=/foo
2. My makefile invokes your makefile with O=/foo
3. Your makefile ignores my O=/foo because it requires O=/foo to
originate from the command line
4. KBUILD_OUTPUT never gets set to /foo and we hit the error

OTOH, if I use file:
1. My makefile sets O=/foo
2. My makefile invokes your makefile with O=/foo
3. Your makefile accepts my O=/foo because it requires O=/foo to
originate from another makefile
4. KBUILD_OUTPUT gets set to /foo and my make succeeds

This all used to work the last time I tried it, which was sometime
during 2.6.23 development, IIRC.  Isn't the current structure going to
break just about all out-of-tree driver builds?

Jay
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Allow (O=...) from file

2007-12-04 Thread Jay Cliburn
Sam,

This piece of the top-level Makefile in current git causes an
out-of-tree driver Makefile to fail.

101 ifdef O
102   ifeq ("$(origin O)", "command line")
103 KBUILD_OUTPUT := $(O)
104   endif
105 endif

The out-of-tree driver Makefile contains an O=... directive that
(correctly) does _not_ specify the kernel source dir, and apparently
isn't overridden by the command line either. If in the above Makefile
snippet I change "command line" to "file", my out-of-tree make
succeeds. What do you think about allowing O= to come from a file in
addition to the command line?

Here are my attempts:

[EMAIL PROTECTED] atl1-2.0.7-20071202]$ make
make -C /lib/modules/2.6.24-rc3/source O=/lib/modules/2.6.24-rc3/build 
SUBDIRS=/home/jcliburn/atl1/atl1-2.0.7-20071202 modules
make[1]: Entering directory `/home/jcliburn/kernel-work/netdev/netdev-2.6.git'
Makefile:119: *** Output directory (O=...) specifies kernel src dir.  Stop.
make[1]: Leaving directory `/home/jcliburn/kernel-work/netdev/netdev-2.6.git'
make: *** [default] Error 2

[EMAIL PROTECTED] atl1-2.0.7-20071202]$ make O=/lib/modules/2.6.24-rc3/build
make -C /lib/modules/2.6.24-rc3/source O=/lib/modules/2.6.24-rc3/build 
SUBDIRS=/home/jcliburn/atl1/atl1-2.0.7-20071202 modules
make[1]: Entering directory `/home/jcliburn/kernel-work/netdev/netdev-2.6.git'
Makefile:119: *** Output directory (O=...) specifies kernel src dir.  Stop.
make[1]: Leaving directory `/home/jcliburn/kernel-work/netdev/netdev-2.6.git'
make: *** [default] Error 2

Thanks for your help.

Jay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Allow (O=...) from file

2007-12-04 Thread Jay Cliburn
Sam,

This piece of the top-level Makefile in current git causes an
out-of-tree driver Makefile to fail.

101 ifdef O
102   ifeq ($(origin O), command line)
103 KBUILD_OUTPUT := $(O)
104   endif
105 endif

The out-of-tree driver Makefile contains an O=... directive that
(correctly) does _not_ specify the kernel source dir, and apparently
isn't overridden by the command line either. If in the above Makefile
snippet I change command line to file, my out-of-tree make
succeeds. What do you think about allowing O= to come from a file in
addition to the command line?

Here are my attempts:

[EMAIL PROTECTED] atl1-2.0.7-20071202]$ make
make -C /lib/modules/2.6.24-rc3/source O=/lib/modules/2.6.24-rc3/build 
SUBDIRS=/home/jcliburn/atl1/atl1-2.0.7-20071202 modules
make[1]: Entering directory `/home/jcliburn/kernel-work/netdev/netdev-2.6.git'
Makefile:119: *** Output directory (O=...) specifies kernel src dir.  Stop.
make[1]: Leaving directory `/home/jcliburn/kernel-work/netdev/netdev-2.6.git'
make: *** [default] Error 2

[EMAIL PROTECTED] atl1-2.0.7-20071202]$ make O=/lib/modules/2.6.24-rc3/build
make -C /lib/modules/2.6.24-rc3/source O=/lib/modules/2.6.24-rc3/build 
SUBDIRS=/home/jcliburn/atl1/atl1-2.0.7-20071202 modules
make[1]: Entering directory `/home/jcliburn/kernel-work/netdev/netdev-2.6.git'
Makefile:119: *** Output directory (O=...) specifies kernel src dir.  Stop.
make[1]: Leaving directory `/home/jcliburn/kernel-work/netdev/netdev-2.6.git'
make: *** [default] Error 2

Thanks for your help.

Jay
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[2.6.22.y][PATCH] atl1: disable broken 64-bit DMA

2007-11-24 Thread Jay Cliburn
atl1: disable broken 64-bit DMA

[ Upstream commit: 5f08e46b621a769e52a9545a23ab1d5fb2aec1d4 ]

The L1 network chip can DMA to 64-bit addresses, but multiple descriptor
rings share a single register for the high 32 bits of their address, so
only a single, aligned, 4 GB physical address range can be used at a time.
As a result, we need to confine the driver to a 32-bit DMA mask, otherwise
we see occasional data corruption errors in systems containing 4 or more
gigabytes of RAM.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
Cc: Luca Tettamanti <[EMAIL PROTECTED]>
Cc: Chris Snook <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_main.c |   25 +
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6862c11..1b7a5a8 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -2097,21 +2097,26 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
struct net_device *netdev;
struct atl1_adapter *adapter;
static int cards_found = 0;
-   bool pci_using_64 = true;
int err;
 
err = pci_enable_device(pdev);
if (err)
return err;
 
-   err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
+   /*
+* The atl1 chip can DMA to 64-bit addresses, but it uses a single
+* shared register for the high 32 bits, so only a single, aligned,
+* 4 GB physical address range can be used at a time.
+*
+* Supporting 64-bit DMA on this hardware is more trouble than it's
+* worth.  It is far easier to limit to 32-bit DMA than update
+* various kernel subsystems to support the mechanics required by a
+* fixed-high-32-bit system.
+*/
+   err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (err) {
-   err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
-   if (err) {
-   dev_err(>dev, "no usable DMA configuration\n");
-   goto err_dma;
-   }
-   pci_using_64 = false;
+   dev_err(>dev, "no usable DMA configuration\n");
+   goto err_dma;
}
/* Mark all PCI regions associated with PCI device
 * pdev as being reserved by owner atl1_driver_name
@@ -2176,7 +2181,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
 
netdev->ethtool_ops = _ethtool_ops;
adapter->bd_number = cards_found;
-   adapter->pci_using_64 = pci_using_64;
 
/* setup the private structure */
err = atl1_sw_init(adapter);
@@ -2193,9 +2197,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
 */
/* netdev->features |= NETIF_F_TSO; */
 
-   if (pci_using_64)
-   netdev->features |= NETIF_F_HIGHDMA;
-
netdev->features |= NETIF_F_LLTX;
 
/*
-- 
1.5.3.3

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[2.6.22.y][PATCH] atl1: disable broken 64-bit DMA

2007-11-24 Thread Jay Cliburn
atl1: disable broken 64-bit DMA

[ Upstream commit: 5f08e46b621a769e52a9545a23ab1d5fb2aec1d4 ]

The L1 network chip can DMA to 64-bit addresses, but multiple descriptor
rings share a single register for the high 32 bits of their address, so
only a single, aligned, 4 GB physical address range can be used at a time.
As a result, we need to confine the driver to a 32-bit DMA mask, otherwise
we see occasional data corruption errors in systems containing 4 or more
gigabytes of RAM.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
Cc: Luca Tettamanti [EMAIL PROTECTED]
Cc: Chris Snook [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_main.c |   25 +
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6862c11..1b7a5a8 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -2097,21 +2097,26 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
struct net_device *netdev;
struct atl1_adapter *adapter;
static int cards_found = 0;
-   bool pci_using_64 = true;
int err;
 
err = pci_enable_device(pdev);
if (err)
return err;
 
-   err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
+   /*
+* The atl1 chip can DMA to 64-bit addresses, but it uses a single
+* shared register for the high 32 bits, so only a single, aligned,
+* 4 GB physical address range can be used at a time.
+*
+* Supporting 64-bit DMA on this hardware is more trouble than it's
+* worth.  It is far easier to limit to 32-bit DMA than update
+* various kernel subsystems to support the mechanics required by a
+* fixed-high-32-bit system.
+*/
+   err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (err) {
-   err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
-   if (err) {
-   dev_err(pdev-dev, no usable DMA configuration\n);
-   goto err_dma;
-   }
-   pci_using_64 = false;
+   dev_err(pdev-dev, no usable DMA configuration\n);
+   goto err_dma;
}
/* Mark all PCI regions associated with PCI device
 * pdev as being reserved by owner atl1_driver_name
@@ -2176,7 +2181,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
 
netdev-ethtool_ops = atl1_ethtool_ops;
adapter-bd_number = cards_found;
-   adapter-pci_using_64 = pci_using_64;
 
/* setup the private structure */
err = atl1_sw_init(adapter);
@@ -2193,9 +2197,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
 */
/* netdev-features |= NETIF_F_TSO; */
 
-   if (pci_using_64)
-   netdev-features |= NETIF_F_HIGHDMA;
-
netdev-features |= NETIF_F_LLTX;
 
/*
-- 
1.5.3.3

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


[PATCH] atl1: use spin_trylock_irqsave()

2007-07-31 Thread Jay Cliburn
From: Ingo Molnar <[EMAIL PROTECTED]>

use the simpler spin_trylock_irqsave() API to get the adapter lock.

[ this is also a fix for -rt where adapter->lock is a sleeping lock. ]

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_main.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 56f6389..3c1984e 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1704,10 +1704,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct 
net_device *netdev)
}
}
 
-   local_irq_save(flags);
-   if (!spin_trylock(>lock)) {
+   if (!spin_trylock_irqsave(>lock, flags)) {
/* Can't get lock - tell upper layer to requeue */
-   local_irq_restore(flags);
dev_printk(KERN_DEBUG, >pdev->dev, "tx locked\n");
return NETDEV_TX_LOCKED;
}
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] atl1: use spin_trylock_irqsave()

2007-07-31 Thread Jay Cliburn
From: Ingo Molnar [EMAIL PROTECTED]

use the simpler spin_trylock_irqsave() API to get the adapter lock.

[ this is also a fix for -rt where adapter-lock is a sleeping lock. ]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_main.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 56f6389..3c1984e 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1704,10 +1704,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct 
net_device *netdev)
}
}
 
-   local_irq_save(flags);
-   if (!spin_trylock(adapter-lock)) {
+   if (!spin_trylock_irqsave(adapter-lock, flags)) {
/* Can't get lock - tell upper layer to requeue */
-   local_irq_restore(flags);
dev_printk(KERN_DEBUG, adapter-pdev-dev, tx locked\n);
return NETDEV_TX_LOCKED;
}
-- 
1.5.2.2

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


[PATCH 5/5] atl1: use kernel provided ethernet length constants

2007-07-19 Thread Jay Cliburn
Use constants already provided by the kernel for ethernet related lengths.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_hw.h   |5 -
 drivers/net/atl1/atl1_main.c |   13 +++--
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atl1/atl1_hw.h
index f0d7e82..939aa0f 100644
--- a/drivers/net/atl1/atl1_hw.h
+++ b/drivers/net/atl1/atl1_hw.h
@@ -680,11 +680,6 @@ void atl1_check_options(struct atl1_adapter *adapter);
 #define AUTONEG_ADVERTISE_10_100_ALL   0x000F  /* All 10/100 speeds */
 #define AUTONEG_ADVERTISE_10_ALL   0x0003  /* 10Mbps Full & Half speeds */
 
-/* The size (in bytes) of a ethernet packet */
-#define ENET_HEADER_SIZE   14
-#define MAXIMUM_ETHERNET_FRAME_SIZE1518/* with FCS */
-#define MINIMUM_ETHERNET_FRAME_SIZE64  /* with FCS */
-#define ETHERNET_FCS_SIZE  4
 #define MAX_JUMBO_FRAME_SIZE   0x2800
 
 #define PHY_AUTO_NEG_TIME  45  /* 4.5 Seconds */
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6aa2dc3..993ed2a 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -59,6 +59,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -120,8 +121,8 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
struct atl1_hw *hw = >hw;
struct net_device *netdev = adapter->netdev;
 
-   hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
-   hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
+   hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
+   hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
 
adapter->wol = 0;
adapter->rx_buffer_len = (hw->max_frame_size + 7) & ~7;
@@ -688,9 +689,9 @@ static int atl1_change_mtu(struct net_device *netdev, int 
new_mtu)
 {
struct atl1_adapter *adapter = netdev_priv(netdev);
int old_mtu = netdev->mtu;
-   int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
+   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
 
-   if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
+   if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
(max_frame > MAX_JUMBO_FRAME_SIZE)) {
dev_warn(>pdev->dev, "invalid MTU setting\n");
return -EINVAL;
@@ -1337,7 +1338,7 @@ rrd_ok:
skb = buffer_info->skb;
length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size);
 
-   skb_put(skb, length - ETHERNET_FCS_SIZE);
+   skb_put(skb, length - ETH_FCS_LEN);
 
/* Receive Checksum Offload */
atl1_rx_checksum(adapter, rrd, skb);
@@ -1456,7 +1457,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct 
sk_buff *skb,
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
iph->daddr, 0, IPPROTO_TCP, 0);
ipofst = skb_network_offset(skb);
-   if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */
+   if (ipofst != ETH_HLEN) /* 802.3 frame */
tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT;
 
tso->tsopl |= (iph->ihl &
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] atl1: fix typo in dma_req_block

2007-07-19 Thread Jay Cliburn
s/dam/dma

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_hw.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atl1/atl1_hw.h
index 100c09c..f0d7e82 100644
--- a/drivers/net/atl1/atl1_hw.h
+++ b/drivers/net/atl1/atl1_hw.h
@@ -929,8 +929,8 @@ enum atl1_dma_req_block {
atl1_dma_req_128 = 0,
atl1_dma_req_256 = 1,
atl1_dma_req_512 = 2,
-   atl1_dam_req_1024 = 3,
-   atl1_dam_req_2048 = 4,
+   atl1_dma_req_1024 = 3,
+   atl1_dma_req_2048 = 4,
atl1_dma_req_4096 = 5
 };
 
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] atl1: fix typo in DMA engine setup

2007-07-19 Thread Jay Cliburn
The DMA engine setup contains a typo that can result in an incorrect
dmaw_block setting.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_main.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 79d60e1..3b8f633 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -908,8 +908,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
/* config DMA Engine */
value = u32) hw->dmar_block) & DMA_CTRL_DMAR_BURST_LEN_MASK)
<< DMA_CTRL_DMAR_BURST_LEN_SHIFT) |
-   u32) hw->dmaw_block) & DMA_CTRL_DMAR_BURST_LEN_MASK)
-   << DMA_CTRL_DMAR_BURST_LEN_SHIFT) | DMA_CTRL_DMAR_EN |
+   u32) hw->dmaw_block) & DMA_CTRL_DMAW_BURST_LEN_MASK)
+   << DMA_CTRL_DMAW_BURST_LEN_SHIFT) | DMA_CTRL_DMAR_EN |
DMA_CTRL_DMAW_EN;
value |= (u32) hw->dma_ord;
if (atl1_rcb_128 == hw->rcb_value)
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] atl1: change cmb write threshold

2007-07-19 Thread Jay Cliburn
Change the threshold number of descriptors used to trigger CMB writes.
The vendor reports that under certain conditions this will reduce the
number of unnecessary tx interrupts and improve rx performance.

This change is lifted directly from vendor version 1.2.40.2 of the L1
driver.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_main.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 3b8f633..6aa2dc3 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -917,7 +917,10 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
iowrite32(value, hw->hw_addr + REG_DMA_CTRL);
 
/* config CMB / SMB */
-   value = hw->cmb_rrd | ((u32) hw->cmb_tpd << 16);
+   value = (hw->cmb_tpd > adapter->tpd_ring.count) ?
+   hw->cmb_tpd : adapter->tpd_ring.count;
+   value <<= 16;
+   value |= hw->cmb_rrd;
iowrite32(value, hw->hw_addr + REG_CMB_WRITE_TH);
value = hw->cmb_rx_timer | ((u32) hw->cmb_tx_timer << 16);
iowrite32(value, hw->hw_addr + REG_CMB_WRITE_TIMER);
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/5] atl1: additional patches for 2.6.23

2007-07-19 Thread Jay Cliburn
Please accept the following patches for the atl1 driver.  Thanks.

atl1: use kernel provided ethernet length constants
atl1: fix typo in dma_req_block
atl1: change cmb write threshold
atl1: fix typo in DMA engine setup
atl1: change tpd_avail function name

 drivers/net/atl1/atl1_hw.h   |9 ++---
 drivers/net/atl1/atl1_main.c |   26 +++---
 2 files changed, 17 insertions(+), 18 deletions(-)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] atl1: change tpd_avail function name

2007-07-19 Thread Jay Cliburn
Change tpd_avail() to atl1_tpd_avail().

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_main.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index fd1e156..79d60e1 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1422,7 +1422,7 @@ static void atl1_intr_tx(struct atl1_adapter *adapter)
netif_wake_queue(adapter->netdev);
 }
 
-static u16 tpd_avail(struct atl1_tpd_ring *tpd_ring)
+static u16 atl1_tpd_avail(struct atl1_tpd_ring *tpd_ring)
 {
u16 next_to_clean = atomic_read(_ring->next_to_clean);
u16 next_to_use = atomic_read(_ring->next_to_use);
@@ -1708,7 +1708,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct 
net_device *netdev)
return NETDEV_TX_LOCKED;
}
 
-   if (tpd_avail(>tpd_ring) < count) {
+   if (atl1_tpd_avail(>tpd_ring) < count) {
/* not enough descriptors */
netif_stop_queue(netdev);
spin_unlock_irqrestore(>lock, flags);
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/5] atl1: additional patches for 2.6.23

2007-07-19 Thread Jay Cliburn
Please accept the following patches for the atl1 driver.  Thanks.

atl1: use kernel provided ethernet length constants
atl1: fix typo in dma_req_block
atl1: change cmb write threshold
atl1: fix typo in DMA engine setup
atl1: change tpd_avail function name

 drivers/net/atl1/atl1_hw.h   |9 ++---
 drivers/net/atl1/atl1_main.c |   26 +++---
 2 files changed, 17 insertions(+), 18 deletions(-)
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] atl1: change tpd_avail function name

2007-07-19 Thread Jay Cliburn
Change tpd_avail() to atl1_tpd_avail().

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_main.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index fd1e156..79d60e1 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1422,7 +1422,7 @@ static void atl1_intr_tx(struct atl1_adapter *adapter)
netif_wake_queue(adapter-netdev);
 }
 
-static u16 tpd_avail(struct atl1_tpd_ring *tpd_ring)
+static u16 atl1_tpd_avail(struct atl1_tpd_ring *tpd_ring)
 {
u16 next_to_clean = atomic_read(tpd_ring-next_to_clean);
u16 next_to_use = atomic_read(tpd_ring-next_to_use);
@@ -1708,7 +1708,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct 
net_device *netdev)
return NETDEV_TX_LOCKED;
}
 
-   if (tpd_avail(adapter-tpd_ring)  count) {
+   if (atl1_tpd_avail(adapter-tpd_ring)  count) {
/* not enough descriptors */
netif_stop_queue(netdev);
spin_unlock_irqrestore(adapter-lock, flags);
-- 
1.5.2.2

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


[PATCH 2/5] atl1: fix typo in DMA engine setup

2007-07-19 Thread Jay Cliburn
The DMA engine setup contains a typo that can result in an incorrect
dmaw_block setting.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_main.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 79d60e1..3b8f633 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -908,8 +908,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
/* config DMA Engine */
value = u32) hw-dmar_block)  DMA_CTRL_DMAR_BURST_LEN_MASK)
 DMA_CTRL_DMAR_BURST_LEN_SHIFT) |
-   u32) hw-dmaw_block)  DMA_CTRL_DMAR_BURST_LEN_MASK)
-DMA_CTRL_DMAR_BURST_LEN_SHIFT) | DMA_CTRL_DMAR_EN |
+   u32) hw-dmaw_block)  DMA_CTRL_DMAW_BURST_LEN_MASK)
+DMA_CTRL_DMAW_BURST_LEN_SHIFT) | DMA_CTRL_DMAR_EN |
DMA_CTRL_DMAW_EN;
value |= (u32) hw-dma_ord;
if (atl1_rcb_128 == hw-rcb_value)
-- 
1.5.2.2

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


[PATCH 3/5] atl1: change cmb write threshold

2007-07-19 Thread Jay Cliburn
Change the threshold number of descriptors used to trigger CMB writes.
The vendor reports that under certain conditions this will reduce the
number of unnecessary tx interrupts and improve rx performance.

This change is lifted directly from vendor version 1.2.40.2 of the L1
driver.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_main.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 3b8f633..6aa2dc3 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -917,7 +917,10 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
iowrite32(value, hw-hw_addr + REG_DMA_CTRL);
 
/* config CMB / SMB */
-   value = hw-cmb_rrd | ((u32) hw-cmb_tpd  16);
+   value = (hw-cmb_tpd  adapter-tpd_ring.count) ?
+   hw-cmb_tpd : adapter-tpd_ring.count;
+   value = 16;
+   value |= hw-cmb_rrd;
iowrite32(value, hw-hw_addr + REG_CMB_WRITE_TH);
value = hw-cmb_rx_timer | ((u32) hw-cmb_tx_timer  16);
iowrite32(value, hw-hw_addr + REG_CMB_WRITE_TIMER);
-- 
1.5.2.2

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


[PATCH 5/5] atl1: use kernel provided ethernet length constants

2007-07-19 Thread Jay Cliburn
Use constants already provided by the kernel for ethernet related lengths.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_hw.h   |5 -
 drivers/net/atl1/atl1_main.c |   13 +++--
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atl1/atl1_hw.h
index f0d7e82..939aa0f 100644
--- a/drivers/net/atl1/atl1_hw.h
+++ b/drivers/net/atl1/atl1_hw.h
@@ -680,11 +680,6 @@ void atl1_check_options(struct atl1_adapter *adapter);
 #define AUTONEG_ADVERTISE_10_100_ALL   0x000F  /* All 10/100 speeds */
 #define AUTONEG_ADVERTISE_10_ALL   0x0003  /* 10Mbps Full  Half speeds */
 
-/* The size (in bytes) of a ethernet packet */
-#define ENET_HEADER_SIZE   14
-#define MAXIMUM_ETHERNET_FRAME_SIZE1518/* with FCS */
-#define MINIMUM_ETHERNET_FRAME_SIZE64  /* with FCS */
-#define ETHERNET_FCS_SIZE  4
 #define MAX_JUMBO_FRAME_SIZE   0x2800
 
 #define PHY_AUTO_NEG_TIME  45  /* 4.5 Seconds */
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6aa2dc3..993ed2a 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -59,6 +59,7 @@
 #include linux/skbuff.h
 #include linux/etherdevice.h
 #include linux/if_vlan.h
+#include linux/if_ether.h
 #include linux/irqreturn.h
 #include linux/workqueue.h
 #include linux/timer.h
@@ -120,8 +121,8 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
struct atl1_hw *hw = adapter-hw;
struct net_device *netdev = adapter-netdev;
 
-   hw-max_frame_size = netdev-mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
-   hw-min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
+   hw-max_frame_size = netdev-mtu + ETH_HLEN + ETH_FCS_LEN;
+   hw-min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
 
adapter-wol = 0;
adapter-rx_buffer_len = (hw-max_frame_size + 7)  ~7;
@@ -688,9 +689,9 @@ static int atl1_change_mtu(struct net_device *netdev, int 
new_mtu)
 {
struct atl1_adapter *adapter = netdev_priv(netdev);
int old_mtu = netdev-mtu;
-   int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
+   int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
 
-   if ((max_frame  MINIMUM_ETHERNET_FRAME_SIZE) ||
+   if ((max_frame  ETH_ZLEN + ETH_FCS_LEN) ||
(max_frame  MAX_JUMBO_FRAME_SIZE)) {
dev_warn(adapter-pdev-dev, invalid MTU setting\n);
return -EINVAL;
@@ -1337,7 +1338,7 @@ rrd_ok:
skb = buffer_info-skb;
length = le16_to_cpu(rrd-xsz.xsum_sz.pkt_size);
 
-   skb_put(skb, length - ETHERNET_FCS_SIZE);
+   skb_put(skb, length - ETH_FCS_LEN);
 
/* Receive Checksum Offload */
atl1_rx_checksum(adapter, rrd, skb);
@@ -1456,7 +1457,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct 
sk_buff *skb,
tcp_hdr(skb)-check = ~csum_tcpudp_magic(iph-saddr,
iph-daddr, 0, IPPROTO_TCP, 0);
ipofst = skb_network_offset(skb);
-   if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */
+   if (ipofst != ETH_HLEN) /* 802.3 frame */
tso-tsopl |= 1  TSO_PARAM_ETHTYPE_SHIFT;
 
tso-tsopl |= (iph-ihl 
-- 
1.5.2.2

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


[PATCH 4/5] atl1: fix typo in dma_req_block

2007-07-19 Thread Jay Cliburn
s/dam/dma

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_hw.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atl1/atl1_hw.h
index 100c09c..f0d7e82 100644
--- a/drivers/net/atl1/atl1_hw.h
+++ b/drivers/net/atl1/atl1_hw.h
@@ -929,8 +929,8 @@ enum atl1_dma_req_block {
atl1_dma_req_128 = 0,
atl1_dma_req_256 = 1,
atl1_dma_req_512 = 2,
-   atl1_dam_req_1024 = 3,
-   atl1_dam_req_2048 = 4,
+   atl1_dma_req_1024 = 3,
+   atl1_dma_req_2048 = 4,
atl1_dma_req_4096 = 5
 };
 
-- 
1.5.2.2

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


[PATCH 3/5] atl1: cleanup atl1_main

2007-07-15 Thread Jay Cliburn
Fix indentation, remove dead code, improve some comments, change dev_dbg to
dev_printk.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_main.c |  278 +-
 1 files changed, 137 insertions(+), 141 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6c8cf98..b40f1c7 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -38,7 +38,7 @@
  * TODO:
  * Fix TSO; tx performance is horrible with TSO enabled.
  * Wake on LAN.
- * Add more ethtool functions, including set ring parameters.
+ * Add more ethtool functions.
  * Fix abstruse irq enable/disable condition described here:
  * http://marc.theaimsgroup.com/?l=linux-netdev=116398508500553=2
  *
@@ -191,19 +191,22 @@ s32 atl1_setup_ring_resources(struct atl1_adapter 
*adapter)
goto err_nomem;
}
rfd_ring->buffer_info =
-   (struct atl1_buffer *)(tpd_ring->buffer_info + tpd_ring->count);
+   (struct atl1_buffer *)(tpd_ring->buffer_info + tpd_ring->count);
 
-   /* real ring DMA buffer */
-   ring_header->size = size = sizeof(struct tx_packet_desc) *
-   tpd_ring->count
-   + sizeof(struct rx_free_desc) * rfd_ring->count
-   + sizeof(struct rx_return_desc) * rrd_ring->count
-   + sizeof(struct coals_msg_block)
-   + sizeof(struct stats_msg_block)
-   + 40;   /* "40: for 8 bytes align" huh? -- CHS */
+   /* real ring DMA buffer
+* each ring/block may need up to 8 bytes for alignment, hence the
+* additional 40 bytes tacked onto the end.
+*/
+   ring_header->size = size =
+   sizeof(struct tx_packet_desc) * tpd_ring->count
+   + sizeof(struct rx_free_desc) * rfd_ring->count
+   + sizeof(struct rx_return_desc) * rrd_ring->count
+   + sizeof(struct coals_msg_block)
+   + sizeof(struct stats_msg_block)
+   + 40;
 
ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
-   _header->dma);
+   _header->dma);
if (unlikely(!ring_header->desc)) {
dev_err(>dev, "pci_alloc_consistent failed\n");
goto err_nomem;
@@ -227,7 +230,6 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
rfd_ring->desc = (u8 *) tpd_ring->desc + (tpd_ring->size + offset);
rfd_ring->size = sizeof(struct rx_free_desc) * rfd_ring->count;
rfd_ring->next_to_clean = 0;
-   /* rfd_ring->next_to_use = rfd_ring->count - 1; */
atomic_set(_ring->next_to_use, 0);
 
/* init RRD ring */
@@ -243,16 +245,16 @@ s32 atl1_setup_ring_resources(struct atl1_adapter 
*adapter)
adapter->cmb.dma = rrd_ring->dma + rrd_ring->size;
offset = (adapter->cmb.dma & 0x7) ? (8 - (adapter->cmb.dma & 0x7)) : 0;
adapter->cmb.dma += offset;
-   adapter->cmb.cmb =
-   (struct coals_msg_block *) ((u8 *) rrd_ring->desc +
-  (rrd_ring->size + offset));
+   adapter->cmb.cmb = (struct coals_msg_block *)
+   ((u8 *) rrd_ring->desc + (rrd_ring->size + offset));
 
/* init SMB */
adapter->smb.dma = adapter->cmb.dma + sizeof(struct coals_msg_block);
offset = (adapter->smb.dma & 0x7) ? (8 - (adapter->smb.dma & 0x7)) : 0;
adapter->smb.dma += offset;
adapter->smb.smb = (struct stats_msg_block *)
-   ((u8 *) adapter->cmb.cmb + (sizeof(struct coals_msg_block) + 
offset));
+   ((u8 *) adapter->cmb.cmb +
+   (sizeof(struct coals_msg_block) + offset));
 
return ATL1_SUCCESS;
 
@@ -291,25 +293,19 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
adapter->soft_stats.rx_bytes += smb->rx_byte_cnt;
adapter->soft_stats.tx_bytes += smb->tx_byte_cnt;
adapter->soft_stats.multicast += smb->rx_mcast;
-   adapter->soft_stats.collisions += (smb->tx_1_col +
-  smb->tx_2_col * 2 +
-  smb->tx_late_col +
-  smb->tx_abort_col *
-  adapter->hw.max_retry);
+   adapter->soft_stats.collisions += (smb->tx_1_col + smb->tx_2_col * 2 +
+   smb->tx_late_col + smb->tx_abort_col * adapter->hw.max_retry);
 
/* Rx Errors */
-   adapter->soft_stats.rx_errors += (smb->rx_frag +
- smb->rx_fcs_err +
- smb->rx_len_err +
-   

[PATCH 2/5] atl1: header file cleanup

2007-07-15 Thread Jay Cliburn
Remove unused structure members, improve comments, break long comment lines,
rename a constant to be consistent with others in the file.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1.h  |  155 ++
 drivers/net/atl1/atl1_main.c |   20 +++---
 2 files changed, 90 insertions(+), 85 deletions(-)

diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h
index a769e7b..991c8b9 100644
--- a/drivers/net/atl1/atl1.h
+++ b/drivers/net/atl1/atl1.h
@@ -43,6 +43,7 @@ extern const struct ethtool_ops atl1_ethtool_ops;
 struct atl1_adapter;
 
 #define ATL1_MAX_INTR  3
+#define ATL1_MAX_TX_BUF_LEN0x3000  /* 12288 bytes */
 
 #define ATL1_DEFAULT_TPD   256
 #define ATL1_MAX_TPD   1024
@@ -57,29 +58,45 @@ struct atl1_adapter;
 #define ATL1_RRD_DESC(R, i)ATL1_GET_DESC(R, i, struct rx_return_desc)
 
 /*
+ * This detached comment is preserved for documentation purposes only.
+ * It was originally attached to some code that got deleted, but seems
+ * important enough to keep around...
+ *
+ * 
  * Some workarounds require millisecond delays and are run during interrupt
  * context.  Most notably, when establishing link, the phy may need tweaking
  * but cannot process phy register reads/writes faster than millisecond
  * intervals...and we establish link due to a "link status change" interrupt.
+ * 
+ */
+
+/*
+ * atl1_ring_header represents a single, contiguous block of DMA space
+ * mapped for the three descriptor rings (tpd, rfd, rrd) and the two
+ * message blocks (cmb, smb) described below
  */
+struct atl1_ring_header {
+   void *desc; /* virtual address */
+   dma_addr_t dma; /* physical address*/
+   unsigned int size;  /* length in bytes */
+};
 
 /*
- * wrapper around a pointer to a socket buffer,
- * so a DMA handle can be stored along with the buffer
+ * atl1_buffer is wrapper around a pointer to a socket buffer
+ * so a DMA handle can be stored along with the skb
  */
 struct atl1_buffer {
-   struct sk_buff *skb;
-   u16 length;
-   u16 alloced;
+   struct sk_buff *skb;/* socket buffer */
+   u16 length; /* rx buffer length */
+   u16 alloced;/* 1 if skb allocated */
dma_addr_t dma;
 };
 
-#define MAX_TX_BUF_LEN 0x3000  /* 12KB */
-
+/* transmit packet descriptor (tpd) ring */
 struct atl1_tpd_ring {
-   void *desc; /* pointer to the descriptor ring memory */
-   dma_addr_t dma; /* physical adress of the descriptor ring */
-   u16 size;   /* length of descriptor ring in bytes */
+   void *desc; /* descriptor ring virtual address */
+   dma_addr_t dma; /* descriptor ring physical address */
+   u16 size;   /* descriptor ring length in bytes */
u16 count;  /* number of descriptors in the ring */
u16 hw_idx; /* hardware index */
atomic_t next_to_clean;
@@ -87,36 +104,34 @@ struct atl1_tpd_ring {
struct atl1_buffer *buffer_info;
 };
 
+/* receive free descriptor (rfd) ring */
 struct atl1_rfd_ring {
-   void *desc;
-   dma_addr_t dma;
-   u16 size;
-   u16 count;
+   void *desc; /* descriptor ring virtual address */
+   dma_addr_t dma; /* descriptor ring physical address */
+   u16 size;   /* descriptor ring length in bytes */
+   u16 count;  /* number of descriptors in the ring */
atomic_t next_to_use;
u16 next_to_clean;
struct atl1_buffer *buffer_info;
 };
 
+/* receive return descriptor (rrd) ring */
 struct atl1_rrd_ring {
-   void *desc;
-   dma_addr_t dma;
-   unsigned int size;
-   u16 count;
+   void *desc; /* descriptor ring virtual address */
+   dma_addr_t dma; /* descriptor ring physical address */
+   unsigned int size;  /* descriptor ring length in bytes */
+   u16 count;  /* number of descriptors in the ring */
u16 next_to_use;
atomic_t next_to_clean;
 };
 
-struct atl1_ring_header {
-   void *desc; /* pointer to the descriptor ring memory */
-   dma_addr_t dma; /* physical adress of the descriptor ring */
-   unsigned int size;  /* length of descriptor ring in bytes */
-};
-
+/* coalescing message block (cmb) */
 struct atl1_cmb {
struct coals_msg_block *cmb;
dma_addr_t dma;
 };
 
+/* statistics message block (smb) */
 struct atl1_smb {
struct stats_msg_block *smb;
dma_addr_t dma;
@@ -141,24 +156,26 @@ struct atl1_sft_stats {
u64 tx_aborted_errors;
u64 tx_window_errors;
u64 tx_carrier_errors;
-
-   u64 tx_pause;   /* num Pause packet transmitted. */
-   u64 excecol;/* num tx packets aborted due to excessive 
collisions. */
- 

[PATCH 1/5] atl1: remove irq_sem

2007-07-15 Thread Jay Cliburn
Remove unnecessary irq_sem code.

Signed-off-by: Chris Snook <[EMAIL PROTECTED]>
Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1.h  |1 -
 drivers/net/atl1/atl1_main.c |6 ++
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h
index b1c6034..a769e7b 100644
--- a/drivers/net/atl1/atl1.h
+++ b/drivers/net/atl1/atl1.h
@@ -236,7 +236,6 @@ struct atl1_adapter {
u16 link_speed;
u16 link_duplex;
spinlock_t lock;
-   atomic_t irq_sem;
struct work_struct tx_timeout_task;
struct work_struct link_chg_task;
struct work_struct pcie_dma_to_rst_task;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 3bb40dd..ef12dba 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -162,7 +162,6 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
hw->cmb_tx_timer = 1;   /* about 2us */
hw->smb_timer = 10; /* about 200ms */
 
-   atomic_set(>irq_sem, 0);
spin_lock_init(>lock);
spin_lock_init(>mb_lock);
 
@@ -268,8 +267,8 @@ err_nomem:
  */
 static void atl1_irq_enable(struct atl1_adapter *adapter)
 {
-   if (likely(!atomic_dec_and_test(>irq_sem)))
-   iowrite32(IMR_NORMAL_MASK, adapter->hw.hw_addr + REG_IMR);
+   iowrite32(IMR_NORMAL_MASK, adapter->hw.hw_addr + REG_IMR);
+   ioread32(adapter->hw.hw_addr + REG_IMR);
 }
 
 static void atl1_clear_phy_int(struct atl1_adapter *adapter)
@@ -1195,7 +1194,6 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
  */
 static void atl1_irq_disable(struct atl1_adapter *adapter)
 {
-   atomic_inc(>irq_sem);
iowrite32(0, adapter->hw.hw_addr + REG_IMR);
ioread32(adapter->hw.hw_addr + REG_IMR);
synchronize_irq(adapter->pdev->irq);
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] atl1: fix excessively indented code

2007-07-15 Thread Jay Cliburn
Move excessively indented code to separate functions.  Also move ring
pointer initialization to its own function.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_main.c |   86 -
 1 files changed, 50 insertions(+), 36 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index b40f1c7..67ddf8d 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -220,8 +220,6 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
tpd_ring->dma += offset;
tpd_ring->desc = (u8 *) ring_header->desc + offset;
tpd_ring->size = sizeof(struct tx_packet_desc) * tpd_ring->count;
-   atomic_set(_ring->next_to_use, 0);
-   atomic_set(_ring->next_to_clean, 0);
 
/* init RFD ring */
rfd_ring->dma = tpd_ring->dma + tpd_ring->size;
@@ -229,8 +227,7 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
rfd_ring->dma += offset;
rfd_ring->desc = (u8 *) tpd_ring->desc + (tpd_ring->size + offset);
rfd_ring->size = sizeof(struct rx_free_desc) * rfd_ring->count;
-   rfd_ring->next_to_clean = 0;
-   atomic_set(_ring->next_to_use, 0);
+
 
/* init RRD ring */
rrd_ring->dma = rfd_ring->dma + rfd_ring->size;
@@ -238,8 +235,7 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
rrd_ring->dma += offset;
rrd_ring->desc = (u8 *) rfd_ring->desc + (rfd_ring->size + offset);
rrd_ring->size = sizeof(struct rx_return_desc) * rrd_ring->count;
-   rrd_ring->next_to_use = 0;
-   atomic_set(_ring->next_to_clean, 0);
+
 
/* init CMB */
adapter->cmb.dma = rrd_ring->dma + rrd_ring->size;
@@ -263,6 +259,22 @@ err_nomem:
return -ENOMEM;
 }
 
+void atl1_init_ring_ptrs(struct atl1_adapter *adapter)
+{
+   struct atl1_tpd_ring *tpd_ring = >tpd_ring;
+   struct atl1_rfd_ring *rfd_ring = >rfd_ring;
+   struct atl1_rrd_ring *rrd_ring = >rrd_ring;
+
+   atomic_set(_ring->next_to_use, 0);
+   atomic_set(_ring->next_to_clean, 0);
+
+   rfd_ring->next_to_clean = 0;
+   atomic_set(_ring->next_to_use, 0);
+
+   rrd_ring->next_to_use = 0;
+   atomic_set(_ring->next_to_clean, 0);
+}
+
 /*
  * atl1_irq_enable - Enable default interrupt generation settings
  * @adapter: board private structure
@@ -472,6 +484,31 @@ next:
return num_alloc;
 }
 
+static void atl1_clean_alloc_flag(struct atl1_adapter *adapter,
+   struct rx_return_desc *rrd, u16 offset)
+{
+   struct atl1_rfd_ring *rfd_ring = >rfd_ring;
+
+   while (rfd_ring->next_to_clean != (rrd->buf_indx + offset)) {
+   rfd_ring->buffer_info[rfd_ring->next_to_clean].alloced = 0;
+   if (++rfd_ring->next_to_clean == rfd_ring->count) {
+   rfd_ring->next_to_clean = 0;
+   }
+   }
+}
+
+static void atl1_update_rfd_index(struct atl1_adapter *adapter,
+   struct rx_return_desc *rrd)
+{
+   u16 num_buf;
+
+   num_buf = (rrd->xsz.xsum_sz.pkt_size + adapter->rx_buffer_len - 1) /
+   adapter->rx_buffer_len;
+   if (rrd->num_buf == num_buf)
+   /* clean alloc flag for bad rrd */
+   atl1_clean_alloc_flag(adapter, rrd, num_buf);
+}
+
 static void atl1_intr_rx(struct atl1_adapter *adapter)
 {
int i, count;
@@ -509,26 +546,8 @@ chk_rrd:
dev_printk(KERN_DEBUG, >pdev->dev,
"bad RRD\n");
/* see if update RFD index */
-   if (rrd->num_buf > 1) {
-   u16 num_buf;
-   num_buf =
-   (rrd->xsz.xsum_sz.pkt_size +
-adapter->rx_buffer_len -
-1) / adapter->rx_buffer_len;
-   if (rrd->num_buf == num_buf) {
-   /* clean alloc flag for bad rrd */
-   while (rfd_ring->next_to_clean !=
-  (rrd->buf_indx + num_buf)) {
-   rfd_ring->buffer_info[rfd_ring->
- 
next_to_clean].alloced = 0;
-   if (++rfd_ring->next_to_clean ==
-   rfd_ring->count) {
-   rfd_ring->
-   next_to_clean = 0;
-   }
-   

[PATCH 0/5] atl1: miscellaneous cleanup and code reorganization

2007-07-15 Thread Jay Cliburn
Please accept the following patches for the atl1 driver.

atl1: remove irq_sem
atl1: header file cleanup
atl1: cleanup atl1_main
atl1: fix excessively indented code
atl1: reorder atl1_main functions

 drivers/net/atl1/atl1.h  |  156 ++--
 drivers/net/atl1/atl1_main.c | 2176 +-
 2 files changed, 1172 insertions(+), 1160 deletions(-)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/5] atl1: miscellaneous cleanup and code reorganization

2007-07-15 Thread Jay Cliburn
Please accept the following patches for the atl1 driver.

atl1: remove irq_sem
atl1: header file cleanup
atl1: cleanup atl1_main
atl1: fix excessively indented code
atl1: reorder atl1_main functions

 drivers/net/atl1/atl1.h  |  156 ++--
 drivers/net/atl1/atl1_main.c | 2176 +-
 2 files changed, 1172 insertions(+), 1160 deletions(-)

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


[PATCH 1/5] atl1: remove irq_sem

2007-07-15 Thread Jay Cliburn
Remove unnecessary irq_sem code.

Signed-off-by: Chris Snook [EMAIL PROTECTED]
Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1.h  |1 -
 drivers/net/atl1/atl1_main.c |6 ++
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h
index b1c6034..a769e7b 100644
--- a/drivers/net/atl1/atl1.h
+++ b/drivers/net/atl1/atl1.h
@@ -236,7 +236,6 @@ struct atl1_adapter {
u16 link_speed;
u16 link_duplex;
spinlock_t lock;
-   atomic_t irq_sem;
struct work_struct tx_timeout_task;
struct work_struct link_chg_task;
struct work_struct pcie_dma_to_rst_task;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 3bb40dd..ef12dba 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -162,7 +162,6 @@ static int __devinit atl1_sw_init(struct atl1_adapter 
*adapter)
hw-cmb_tx_timer = 1;   /* about 2us */
hw-smb_timer = 10; /* about 200ms */
 
-   atomic_set(adapter-irq_sem, 0);
spin_lock_init(adapter-lock);
spin_lock_init(adapter-mb_lock);
 
@@ -268,8 +267,8 @@ err_nomem:
  */
 static void atl1_irq_enable(struct atl1_adapter *adapter)
 {
-   if (likely(!atomic_dec_and_test(adapter-irq_sem)))
-   iowrite32(IMR_NORMAL_MASK, adapter-hw.hw_addr + REG_IMR);
+   iowrite32(IMR_NORMAL_MASK, adapter-hw.hw_addr + REG_IMR);
+   ioread32(adapter-hw.hw_addr + REG_IMR);
 }
 
 static void atl1_clear_phy_int(struct atl1_adapter *adapter)
@@ -1195,7 +1194,6 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
  */
 static void atl1_irq_disable(struct atl1_adapter *adapter)
 {
-   atomic_inc(adapter-irq_sem);
iowrite32(0, adapter-hw.hw_addr + REG_IMR);
ioread32(adapter-hw.hw_addr + REG_IMR);
synchronize_irq(adapter-pdev-irq);
-- 
1.5.2.2

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


[PATCH 4/5] atl1: fix excessively indented code

2007-07-15 Thread Jay Cliburn
Move excessively indented code to separate functions.  Also move ring
pointer initialization to its own function.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_main.c |   86 -
 1 files changed, 50 insertions(+), 36 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index b40f1c7..67ddf8d 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -220,8 +220,6 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
tpd_ring-dma += offset;
tpd_ring-desc = (u8 *) ring_header-desc + offset;
tpd_ring-size = sizeof(struct tx_packet_desc) * tpd_ring-count;
-   atomic_set(tpd_ring-next_to_use, 0);
-   atomic_set(tpd_ring-next_to_clean, 0);
 
/* init RFD ring */
rfd_ring-dma = tpd_ring-dma + tpd_ring-size;
@@ -229,8 +227,7 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
rfd_ring-dma += offset;
rfd_ring-desc = (u8 *) tpd_ring-desc + (tpd_ring-size + offset);
rfd_ring-size = sizeof(struct rx_free_desc) * rfd_ring-count;
-   rfd_ring-next_to_clean = 0;
-   atomic_set(rfd_ring-next_to_use, 0);
+
 
/* init RRD ring */
rrd_ring-dma = rfd_ring-dma + rfd_ring-size;
@@ -238,8 +235,7 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
rrd_ring-dma += offset;
rrd_ring-desc = (u8 *) rfd_ring-desc + (rfd_ring-size + offset);
rrd_ring-size = sizeof(struct rx_return_desc) * rrd_ring-count;
-   rrd_ring-next_to_use = 0;
-   atomic_set(rrd_ring-next_to_clean, 0);
+
 
/* init CMB */
adapter-cmb.dma = rrd_ring-dma + rrd_ring-size;
@@ -263,6 +259,22 @@ err_nomem:
return -ENOMEM;
 }
 
+void atl1_init_ring_ptrs(struct atl1_adapter *adapter)
+{
+   struct atl1_tpd_ring *tpd_ring = adapter-tpd_ring;
+   struct atl1_rfd_ring *rfd_ring = adapter-rfd_ring;
+   struct atl1_rrd_ring *rrd_ring = adapter-rrd_ring;
+
+   atomic_set(tpd_ring-next_to_use, 0);
+   atomic_set(tpd_ring-next_to_clean, 0);
+
+   rfd_ring-next_to_clean = 0;
+   atomic_set(rfd_ring-next_to_use, 0);
+
+   rrd_ring-next_to_use = 0;
+   atomic_set(rrd_ring-next_to_clean, 0);
+}
+
 /*
  * atl1_irq_enable - Enable default interrupt generation settings
  * @adapter: board private structure
@@ -472,6 +484,31 @@ next:
return num_alloc;
 }
 
+static void atl1_clean_alloc_flag(struct atl1_adapter *adapter,
+   struct rx_return_desc *rrd, u16 offset)
+{
+   struct atl1_rfd_ring *rfd_ring = adapter-rfd_ring;
+
+   while (rfd_ring-next_to_clean != (rrd-buf_indx + offset)) {
+   rfd_ring-buffer_info[rfd_ring-next_to_clean].alloced = 0;
+   if (++rfd_ring-next_to_clean == rfd_ring-count) {
+   rfd_ring-next_to_clean = 0;
+   }
+   }
+}
+
+static void atl1_update_rfd_index(struct atl1_adapter *adapter,
+   struct rx_return_desc *rrd)
+{
+   u16 num_buf;
+
+   num_buf = (rrd-xsz.xsum_sz.pkt_size + adapter-rx_buffer_len - 1) /
+   adapter-rx_buffer_len;
+   if (rrd-num_buf == num_buf)
+   /* clean alloc flag for bad rrd */
+   atl1_clean_alloc_flag(adapter, rrd, num_buf);
+}
+
 static void atl1_intr_rx(struct atl1_adapter *adapter)
 {
int i, count;
@@ -509,26 +546,8 @@ chk_rrd:
dev_printk(KERN_DEBUG, adapter-pdev-dev,
bad RRD\n);
/* see if update RFD index */
-   if (rrd-num_buf  1) {
-   u16 num_buf;
-   num_buf =
-   (rrd-xsz.xsum_sz.pkt_size +
-adapter-rx_buffer_len -
-1) / adapter-rx_buffer_len;
-   if (rrd-num_buf == num_buf) {
-   /* clean alloc flag for bad rrd */
-   while (rfd_ring-next_to_clean !=
-  (rrd-buf_indx + num_buf)) {
-   rfd_ring-buffer_info[rfd_ring-
- 
next_to_clean].alloced = 0;
-   if (++rfd_ring-next_to_clean ==
-   rfd_ring-count) {
-   rfd_ring-
-   next_to_clean = 0;
-   }
-   }
-   }
-   }
+   if (rrd-num_buf  1)
+   atl1_update_rfd_index(adapter, rrd);
 
/* update rrd

[PATCH 2/5] atl1: header file cleanup

2007-07-15 Thread Jay Cliburn
Remove unused structure members, improve comments, break long comment lines,
rename a constant to be consistent with others in the file.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1.h  |  155 ++
 drivers/net/atl1/atl1_main.c |   20 +++---
 2 files changed, 90 insertions(+), 85 deletions(-)

diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h
index a769e7b..991c8b9 100644
--- a/drivers/net/atl1/atl1.h
+++ b/drivers/net/atl1/atl1.h
@@ -43,6 +43,7 @@ extern const struct ethtool_ops atl1_ethtool_ops;
 struct atl1_adapter;
 
 #define ATL1_MAX_INTR  3
+#define ATL1_MAX_TX_BUF_LEN0x3000  /* 12288 bytes */
 
 #define ATL1_DEFAULT_TPD   256
 #define ATL1_MAX_TPD   1024
@@ -57,29 +58,45 @@ struct atl1_adapter;
 #define ATL1_RRD_DESC(R, i)ATL1_GET_DESC(R, i, struct rx_return_desc)
 
 /*
+ * This detached comment is preserved for documentation purposes only.
+ * It was originally attached to some code that got deleted, but seems
+ * important enough to keep around...
+ *
+ * begin detached comment
  * Some workarounds require millisecond delays and are run during interrupt
  * context.  Most notably, when establishing link, the phy may need tweaking
  * but cannot process phy register reads/writes faster than millisecond
  * intervals...and we establish link due to a link status change interrupt.
+ * end detached comment
+ */
+
+/*
+ * atl1_ring_header represents a single, contiguous block of DMA space
+ * mapped for the three descriptor rings (tpd, rfd, rrd) and the two
+ * message blocks (cmb, smb) described below
  */
+struct atl1_ring_header {
+   void *desc; /* virtual address */
+   dma_addr_t dma; /* physical address*/
+   unsigned int size;  /* length in bytes */
+};
 
 /*
- * wrapper around a pointer to a socket buffer,
- * so a DMA handle can be stored along with the buffer
+ * atl1_buffer is wrapper around a pointer to a socket buffer
+ * so a DMA handle can be stored along with the skb
  */
 struct atl1_buffer {
-   struct sk_buff *skb;
-   u16 length;
-   u16 alloced;
+   struct sk_buff *skb;/* socket buffer */
+   u16 length; /* rx buffer length */
+   u16 alloced;/* 1 if skb allocated */
dma_addr_t dma;
 };
 
-#define MAX_TX_BUF_LEN 0x3000  /* 12KB */
-
+/* transmit packet descriptor (tpd) ring */
 struct atl1_tpd_ring {
-   void *desc; /* pointer to the descriptor ring memory */
-   dma_addr_t dma; /* physical adress of the descriptor ring */
-   u16 size;   /* length of descriptor ring in bytes */
+   void *desc; /* descriptor ring virtual address */
+   dma_addr_t dma; /* descriptor ring physical address */
+   u16 size;   /* descriptor ring length in bytes */
u16 count;  /* number of descriptors in the ring */
u16 hw_idx; /* hardware index */
atomic_t next_to_clean;
@@ -87,36 +104,34 @@ struct atl1_tpd_ring {
struct atl1_buffer *buffer_info;
 };
 
+/* receive free descriptor (rfd) ring */
 struct atl1_rfd_ring {
-   void *desc;
-   dma_addr_t dma;
-   u16 size;
-   u16 count;
+   void *desc; /* descriptor ring virtual address */
+   dma_addr_t dma; /* descriptor ring physical address */
+   u16 size;   /* descriptor ring length in bytes */
+   u16 count;  /* number of descriptors in the ring */
atomic_t next_to_use;
u16 next_to_clean;
struct atl1_buffer *buffer_info;
 };
 
+/* receive return descriptor (rrd) ring */
 struct atl1_rrd_ring {
-   void *desc;
-   dma_addr_t dma;
-   unsigned int size;
-   u16 count;
+   void *desc; /* descriptor ring virtual address */
+   dma_addr_t dma; /* descriptor ring physical address */
+   unsigned int size;  /* descriptor ring length in bytes */
+   u16 count;  /* number of descriptors in the ring */
u16 next_to_use;
atomic_t next_to_clean;
 };
 
-struct atl1_ring_header {
-   void *desc; /* pointer to the descriptor ring memory */
-   dma_addr_t dma; /* physical adress of the descriptor ring */
-   unsigned int size;  /* length of descriptor ring in bytes */
-};
-
+/* coalescing message block (cmb) */
 struct atl1_cmb {
struct coals_msg_block *cmb;
dma_addr_t dma;
 };
 
+/* statistics message block (smb) */
 struct atl1_smb {
struct stats_msg_block *smb;
dma_addr_t dma;
@@ -141,24 +156,26 @@ struct atl1_sft_stats {
u64 tx_aborted_errors;
u64 tx_window_errors;
u64 tx_carrier_errors;
-
-   u64 tx_pause;   /* num Pause packet transmitted. */
-   u64 excecol;/* num tx packets aborted due to excessive 
collisions

[PATCH 3/5] atl1: cleanup atl1_main

2007-07-15 Thread Jay Cliburn
Fix indentation, remove dead code, improve some comments, change dev_dbg to
dev_printk.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_main.c |  278 +-
 1 files changed, 137 insertions(+), 141 deletions(-)

diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6c8cf98..b40f1c7 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -38,7 +38,7 @@
  * TODO:
  * Fix TSO; tx performance is horrible with TSO enabled.
  * Wake on LAN.
- * Add more ethtool functions, including set ring parameters.
+ * Add more ethtool functions.
  * Fix abstruse irq enable/disable condition described here:
  * http://marc.theaimsgroup.com/?l=linux-netdevm=116398508500553w=2
  *
@@ -191,19 +191,22 @@ s32 atl1_setup_ring_resources(struct atl1_adapter 
*adapter)
goto err_nomem;
}
rfd_ring-buffer_info =
-   (struct atl1_buffer *)(tpd_ring-buffer_info + tpd_ring-count);
+   (struct atl1_buffer *)(tpd_ring-buffer_info + tpd_ring-count);
 
-   /* real ring DMA buffer */
-   ring_header-size = size = sizeof(struct tx_packet_desc) *
-   tpd_ring-count
-   + sizeof(struct rx_free_desc) * rfd_ring-count
-   + sizeof(struct rx_return_desc) * rrd_ring-count
-   + sizeof(struct coals_msg_block)
-   + sizeof(struct stats_msg_block)
-   + 40;   /* 40: for 8 bytes align huh? -- CHS */
+   /* real ring DMA buffer
+* each ring/block may need up to 8 bytes for alignment, hence the
+* additional 40 bytes tacked onto the end.
+*/
+   ring_header-size = size =
+   sizeof(struct tx_packet_desc) * tpd_ring-count
+   + sizeof(struct rx_free_desc) * rfd_ring-count
+   + sizeof(struct rx_return_desc) * rrd_ring-count
+   + sizeof(struct coals_msg_block)
+   + sizeof(struct stats_msg_block)
+   + 40;
 
ring_header-desc = pci_alloc_consistent(pdev, ring_header-size,
-   ring_header-dma);
+   ring_header-dma);
if (unlikely(!ring_header-desc)) {
dev_err(pdev-dev, pci_alloc_consistent failed\n);
goto err_nomem;
@@ -227,7 +230,6 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
rfd_ring-desc = (u8 *) tpd_ring-desc + (tpd_ring-size + offset);
rfd_ring-size = sizeof(struct rx_free_desc) * rfd_ring-count;
rfd_ring-next_to_clean = 0;
-   /* rfd_ring-next_to_use = rfd_ring-count - 1; */
atomic_set(rfd_ring-next_to_use, 0);
 
/* init RRD ring */
@@ -243,16 +245,16 @@ s32 atl1_setup_ring_resources(struct atl1_adapter 
*adapter)
adapter-cmb.dma = rrd_ring-dma + rrd_ring-size;
offset = (adapter-cmb.dma  0x7) ? (8 - (adapter-cmb.dma  0x7)) : 0;
adapter-cmb.dma += offset;
-   adapter-cmb.cmb =
-   (struct coals_msg_block *) ((u8 *) rrd_ring-desc +
-  (rrd_ring-size + offset));
+   adapter-cmb.cmb = (struct coals_msg_block *)
+   ((u8 *) rrd_ring-desc + (rrd_ring-size + offset));
 
/* init SMB */
adapter-smb.dma = adapter-cmb.dma + sizeof(struct coals_msg_block);
offset = (adapter-smb.dma  0x7) ? (8 - (adapter-smb.dma  0x7)) : 0;
adapter-smb.dma += offset;
adapter-smb.smb = (struct stats_msg_block *)
-   ((u8 *) adapter-cmb.cmb + (sizeof(struct coals_msg_block) + 
offset));
+   ((u8 *) adapter-cmb.cmb +
+   (sizeof(struct coals_msg_block) + offset));
 
return ATL1_SUCCESS;
 
@@ -291,25 +293,19 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
adapter-soft_stats.rx_bytes += smb-rx_byte_cnt;
adapter-soft_stats.tx_bytes += smb-tx_byte_cnt;
adapter-soft_stats.multicast += smb-rx_mcast;
-   adapter-soft_stats.collisions += (smb-tx_1_col +
-  smb-tx_2_col * 2 +
-  smb-tx_late_col +
-  smb-tx_abort_col *
-  adapter-hw.max_retry);
+   adapter-soft_stats.collisions += (smb-tx_1_col + smb-tx_2_col * 2 +
+   smb-tx_late_col + smb-tx_abort_col * adapter-hw.max_retry);
 
/* Rx Errors */
-   adapter-soft_stats.rx_errors += (smb-rx_frag +
- smb-rx_fcs_err +
- smb-rx_len_err +
- smb-rx_sz_ov +
- smb-rx_rxf_ov +
- smb-rx_rrd_ov + smb-rx_align_err);
+   adapter-soft_stats.rx_errors += (smb-rx_frag + smb-rx_fcs_err +
+   smb-rx_len_err + smb-rx_sz_ov + smb-rx_rxf_ov

How to enable dev_dbg messaging

2007-06-29 Thread Jay Cliburn
How do I turn on dev_dbg messaging in the kernel?  I can get
printk(KERN_DEBUG ...) to work just fine, but I don't know how to
enable dev_dbg.

Thanks,
Jay
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


How to enable dev_dbg messaging

2007-06-29 Thread Jay Cliburn
How do I turn on dev_dbg messaging in the kernel?  I can get
printk(KERN_DEBUG ...) to work just fine, but I don't know how to
enable dev_dbg.

Thanks,
Jay
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] atl1: disable 64bit DMA

2007-06-26 Thread Jay Cliburn
On Mon, 25 Jun 2007 23:18:55 +0200
Luca Tettamanti <[EMAIL PROTECTED]> wrote:

> Il Mon, Jun 25, 2007 at 07:42:44AM -0500, Jay Cliburn ha scritto: 
> > Jay L. T. Cornwall wrote:
> > >Jay Cliburn wrote:
> > >
> > >>For reasons not yet clear to me, it appears the L1 driver has a
> > >>bug or the device itself has trouble with DMA in high memory.
> > >>This patch, drafted by Luca Tettamanti, is being explored as a
> > >>workaround.  I'd be interested to know if it fixes your problem.
> > >
> > >Yes, it certainly seems to. Now running with this patch and 4GB
> > >active, I've transferred about 15GB with no problem so far. It
> > >usually oopses after a GB or two.
> > >
> > >I guess it's not an ideal solution, architecturally speaking, but
> > >it's a good deal better than an unstable driver. If there's any
> > >other patches you'd like me to test or traces to capture, I'm
> > >happy to help out. Otherwise I'll run with this one for now since
> > >it does the job!
> > 
> > Okay Jay, thanks.
> > 
> > Luca, would you please submit your patch to Jeff Garzik and netdev?
> 
> Hi Jeff,
> a couple of users reported hard lockups when using L1 NICs on machines
> with 4GB or more of RAM. We're still waiting official confirmation
> from the vendor, but it seems that L1 has problems doing DMA to/from
> high memory (physical address above the 4GB limit). Passing 32bit DMA
> mask cures the problem.
> 
> Signed-Off-By: Luca Tettamanti <[EMAIL PROTECTED]>
> 
> ---
> I think that the patch should be included in 2.6.22.
> 
>  drivers/net/atl1/atl1_main.c |   15 +++
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/atl1/atl1_main.c
> b/drivers/net/atl1/atl1_main.c index 6862c11..a730f15 100644
> --- a/drivers/net/atl1/atl1_main.c
> +++ b/drivers/net/atl1/atl1_main.c
> @@ -2097,21 +2097,16 @@ static int __devinit atl1_probe(struct
> pci_dev *pdev, struct net_device *netdev;
>   struct atl1_adapter *adapter;
>   static int cards_found = 0;
> - bool pci_using_64 = true;
>   int err;
>  
>   err = pci_enable_device(pdev);
>   if (err)
>   return err;
>  
> - err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
> + err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
>   if (err) {
> - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
> - if (err) {
> - dev_err(>dev, "no usable DMA
> configuration\n");
> - goto err_dma;
> - }
> - pci_using_64 = false;
> + dev_err(>dev, "no usable DMA configuration\n");
> + goto err_dma;
>   }
>   /* Mark all PCI regions associated with PCI device
>* pdev as being reserved by owner atl1_driver_name
> @@ -2176,7 +2171,6 @@ static int __devinit atl1_probe(struct pci_dev
> *pdev, 
>   netdev->ethtool_ops = _ethtool_ops;
>   adapter->bd_number = cards_found;
> - adapter->pci_using_64 = pci_using_64;
>  
>   /* setup the private structure */
>   err = atl1_sw_init(adapter);
> @@ -2193,9 +2187,6 @@ static int __devinit atl1_probe(struct pci_dev
> *pdev, */
>   /* netdev->features |= NETIF_F_TSO; */
>  
> - if (pci_using_64)
> - netdev->features |= NETIF_F_HIGHDMA;
> -
>   netdev->features |= NETIF_F_LLTX;
>  
>   /*

Acked-by: Jay Cliburn <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] atl1: disable 64bit DMA

2007-06-26 Thread Jay Cliburn
On Mon, 25 Jun 2007 23:18:55 +0200
Luca Tettamanti [EMAIL PROTECTED] wrote:

 Il Mon, Jun 25, 2007 at 07:42:44AM -0500, Jay Cliburn ha scritto: 
  Jay L. T. Cornwall wrote:
  Jay Cliburn wrote:
  
  For reasons not yet clear to me, it appears the L1 driver has a
  bug or the device itself has trouble with DMA in high memory.
  This patch, drafted by Luca Tettamanti, is being explored as a
  workaround.  I'd be interested to know if it fixes your problem.
  
  Yes, it certainly seems to. Now running with this patch and 4GB
  active, I've transferred about 15GB with no problem so far. It
  usually oopses after a GB or two.
  
  I guess it's not an ideal solution, architecturally speaking, but
  it's a good deal better than an unstable driver. If there's any
  other patches you'd like me to test or traces to capture, I'm
  happy to help out. Otherwise I'll run with this one for now since
  it does the job!
  
  Okay Jay, thanks.
  
  Luca, would you please submit your patch to Jeff Garzik and netdev?
 
 Hi Jeff,
 a couple of users reported hard lockups when using L1 NICs on machines
 with 4GB or more of RAM. We're still waiting official confirmation
 from the vendor, but it seems that L1 has problems doing DMA to/from
 high memory (physical address above the 4GB limit). Passing 32bit DMA
 mask cures the problem.
 
 Signed-Off-By: Luca Tettamanti [EMAIL PROTECTED]
 
 ---
 I think that the patch should be included in 2.6.22.
 
  drivers/net/atl1/atl1_main.c |   15 +++
  1 file changed, 3 insertions(+), 12 deletions(-)
 
 diff --git a/drivers/net/atl1/atl1_main.c
 b/drivers/net/atl1/atl1_main.c index 6862c11..a730f15 100644
 --- a/drivers/net/atl1/atl1_main.c
 +++ b/drivers/net/atl1/atl1_main.c
 @@ -2097,21 +2097,16 @@ static int __devinit atl1_probe(struct
 pci_dev *pdev, struct net_device *netdev;
   struct atl1_adapter *adapter;
   static int cards_found = 0;
 - bool pci_using_64 = true;
   int err;
  
   err = pci_enable_device(pdev);
   if (err)
   return err;
  
 - err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
 + err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
   if (err) {
 - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
 - if (err) {
 - dev_err(pdev-dev, no usable DMA
 configuration\n);
 - goto err_dma;
 - }
 - pci_using_64 = false;
 + dev_err(pdev-dev, no usable DMA configuration\n);
 + goto err_dma;
   }
   /* Mark all PCI regions associated with PCI device
* pdev as being reserved by owner atl1_driver_name
 @@ -2176,7 +2171,6 @@ static int __devinit atl1_probe(struct pci_dev
 *pdev, 
   netdev-ethtool_ops = atl1_ethtool_ops;
   adapter-bd_number = cards_found;
 - adapter-pci_using_64 = pci_using_64;
  
   /* setup the private structure */
   err = atl1_sw_init(adapter);
 @@ -2193,9 +2187,6 @@ static int __devinit atl1_probe(struct pci_dev
 *pdev, */
   /* netdev-features |= NETIF_F_TSO; */
  
 - if (pci_using_64)
 - netdev-features |= NETIF_F_HIGHDMA;
 -
   netdev-features |= NETIF_F_LLTX;
  
   /*

Acked-by: Jay Cliburn [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] atl1: disable 64bit DMA

2007-06-25 Thread Jay Cliburn
On Mon, 25 Jun 2007 17:57:20 -0400
Chris Snook <[EMAIL PROTECTED]> wrote:

> Jay L. T. Cornwall wrote:
> > Chris Snook wrote:
> > 
> >> What boards have we seen this on?  It's quite possible this is:
> > 
> > I can reproduce on an Asus P5K with a Core 2 Duo E6600.
> > 
> > lspci identifies the controller as:
> >   02:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit
> >   Ethernet Adapter (rev b0)
> > 
> > dmesg notes the PCI-DMA mapping implementation:
> >   PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
> > 
> 
> I had a hunch this was on Intel.  I'd rather just disable this when
> swiotlb is in use, unless we get more complaints.  It's probably
> ultimately a BIOS quirk anyway.

So far we have reports from both camps:

Asus M2N8-VMX (AM2):1 report of lockup
http://sourceforge.net/mailarchive/forum.php?thread_name=46780384.063603.26165%40m12-15.163.com_name=atl1-devel

Asus P5K (LGA775):  2 reports of lockups
http://sourceforge.net/mailarchive/forum.php?thread_name=467E7E34.4010603%40gmail.com_name=atl1-devel
http://lkml.org/lkml/2007/6/25/107

The common denominator in these reports is 4GB RAM.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Attansic L1 page corruption

2007-06-25 Thread Jay Cliburn

Jay L. T. Cornwall wrote:

Jay Cliburn wrote:


For reasons not yet clear to me, it appears the L1 driver has a bug or
the device itself has trouble with DMA in high memory.  This patch,
drafted by Luca Tettamanti, is being explored as a workaround.  I'd be
interested to know if it fixes your problem.


Yes, it certainly seems to. Now running with this patch and 4GB active,
I've transferred about 15GB with no problem so far. It usually oopses
after a GB or two.

I guess it's not an ideal solution, architecturally speaking, but it's a
good deal better than an unstable driver. If there's any other patches
you'd like me to test or traces to capture, I'm happy to help out.
Otherwise I'll run with this one for now since it does the job!


Okay Jay, thanks.

Luca, would you please submit your patch to Jeff Garzik and netdev?

Jay

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Attansic L1 page corruption

2007-06-25 Thread Jay Cliburn

Jay L. T. Cornwall wrote:

Jay Cliburn wrote:


For reasons not yet clear to me, it appears the L1 driver has a bug or
the device itself has trouble with DMA in high memory.  This patch,
drafted by Luca Tettamanti, is being explored as a workaround.  I'd be
interested to know if it fixes your problem.


Yes, it certainly seems to. Now running with this patch and 4GB active,
I've transferred about 15GB with no problem so far. It usually oopses
after a GB or two.

I guess it's not an ideal solution, architecturally speaking, but it's a
good deal better than an unstable driver. If there's any other patches
you'd like me to test or traces to capture, I'm happy to help out.
Otherwise I'll run with this one for now since it does the job!


Okay Jay, thanks.

Luca, would you please submit your patch to Jeff Garzik and netdev?

Jay

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


Re: [PATCH] atl1: disable 64bit DMA

2007-06-25 Thread Jay Cliburn
On Mon, 25 Jun 2007 17:57:20 -0400
Chris Snook [EMAIL PROTECTED] wrote:

 Jay L. T. Cornwall wrote:
  Chris Snook wrote:
  
  What boards have we seen this on?  It's quite possible this is:
  
  I can reproduce on an Asus P5K with a Core 2 Duo E6600.
  
  lspci identifies the controller as:
02:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit
Ethernet Adapter (rev b0)
  
  dmesg notes the PCI-DMA mapping implementation:
PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
  
 
 I had a hunch this was on Intel.  I'd rather just disable this when
 swiotlb is in use, unless we get more complaints.  It's probably
 ultimately a BIOS quirk anyway.

So far we have reports from both camps:

Asus M2N8-VMX (AM2):1 report of lockup
http://sourceforge.net/mailarchive/forum.php?thread_name=46780384.063603.26165%40m12-15.163.comforum_name=atl1-devel

Asus P5K (LGA775):  2 reports of lockups
http://sourceforge.net/mailarchive/forum.php?thread_name=467E7E34.4010603%40gmail.comforum_name=atl1-devel
http://lkml.org/lkml/2007/6/25/107

The common denominator in these reports is 4GB RAM.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 2.6.22-rc5: pdflush oops under heavy disk load

2007-06-24 Thread Jay Cliburn
On Sun, 24 Jun 2007 21:31:36 +0100
"Jay L. T. Cornwall" <[EMAIL PROTECTED]> wrote:

> Jay Cliburn wrote:
> 
> >> The common factor here seems to be the buffer_head circular list
> >> leading to invalid pointers in bh->b_this_page.
> >>
> >> I'm beginning to suspect the Attansic L1 Gigabit Etherner driver
> >> (marked as EXPERIMENTAL in 2.6.22-rc5). I can't reproduce these
> >> panics on disk-to-disk copies or SCP across the localhost
> >> interface. However, SCP from a server onto either of two different
> >> HDDs hits these oopses fairly quickly.
> 
> > How much RAM is installed in your machine?  If it's 4GB or more,
> > does your problem go away if you boot with mem=3000M?
> 
> Intriguing. Yes, this machine has 4GB of RAM. If I boot with mem=3000M
> the problem does indeed go away - I can't induce an oops even after
> transferring tens of GB across the interface.
> 
> I'm not sure I follow why that would be the case, except that it
> relates to pci_map_page behaviour. But I guess you have an inkling?
> 

For reasons not yet clear to me, it appears the L1 driver has a bug or
the device itself has trouble with DMA in high memory.  This patch,
drafted by Luca Tettamanti, is being explored as a workaround.  I'd be
interested to know if it fixes your problem.

[Aside: For future reference, [EMAIL PROTECTED] is a
mailing list devoted to L1 driver development.]

Jay



diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6862c11..a600601 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -2104,15 +2104,12 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
if (err)
return err;
 
-   err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
+   err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (err) {
-   err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
-   if (err) {
-   dev_err(>dev, "no usable DMA configuration\n");
-   goto err_dma;
-   }
-   pci_using_64 = false;
+   dev_err(>dev, "no usable DMA configuration\n");
+   goto err_dma;
}
+   pci_using_64 = false;
/* Mark all PCI regions associated with PCI device
 * pdev as being reserved by owner atl1_driver_name
 */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 2.6.22-rc5: pdflush oops under heavy disk load

2007-06-24 Thread Jay Cliburn
On Sat, 23 Jun 2007 13:14:40 +0100
"Jay L. T. Cornwall" <[EMAIL PROTECTED]> wrote:


> The common factor here seems to be the buffer_head circular list
> leading to invalid pointers in bh->b_this_page.
> 
> I'm beginning to suspect the Attansic L1 Gigabit Etherner driver
> (marked as EXPERIMENTAL in 2.6.22-rc5). I can't reproduce these
> panics on disk-to-disk copies or SCP across the localhost interface.
> However, SCP from a server onto either of two different HDDs hits
> these oopses fairly quickly.

How much RAM is installed in your machine?  If it's 4GB or more, does
your problem go away if you boot with mem=3000M?

Jay
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 2.6.22-rc5: pdflush oops under heavy disk load

2007-06-24 Thread Jay Cliburn
On Sat, 23 Jun 2007 13:14:40 +0100
Jay L. T. Cornwall [EMAIL PROTECTED] wrote:


 The common factor here seems to be the buffer_head circular list
 leading to invalid pointers in bh-b_this_page.
 
 I'm beginning to suspect the Attansic L1 Gigabit Etherner driver
 (marked as EXPERIMENTAL in 2.6.22-rc5). I can't reproduce these
 panics on disk-to-disk copies or SCP across the localhost interface.
 However, SCP from a server onto either of two different HDDs hits
 these oopses fairly quickly.

How much RAM is installed in your machine?  If it's 4GB or more, does
your problem go away if you boot with mem=3000M?

Jay
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 2.6.22-rc5: pdflush oops under heavy disk load

2007-06-24 Thread Jay Cliburn
On Sun, 24 Jun 2007 21:31:36 +0100
Jay L. T. Cornwall [EMAIL PROTECTED] wrote:

 Jay Cliburn wrote:
 
  The common factor here seems to be the buffer_head circular list
  leading to invalid pointers in bh-b_this_page.
 
  I'm beginning to suspect the Attansic L1 Gigabit Etherner driver
  (marked as EXPERIMENTAL in 2.6.22-rc5). I can't reproduce these
  panics on disk-to-disk copies or SCP across the localhost
  interface. However, SCP from a server onto either of two different
  HDDs hits these oopses fairly quickly.
 
  How much RAM is installed in your machine?  If it's 4GB or more,
  does your problem go away if you boot with mem=3000M?
 
 Intriguing. Yes, this machine has 4GB of RAM. If I boot with mem=3000M
 the problem does indeed go away - I can't induce an oops even after
 transferring tens of GB across the interface.
 
 I'm not sure I follow why that would be the case, except that it
 relates to pci_map_page behaviour. But I guess you have an inkling?
 

For reasons not yet clear to me, it appears the L1 driver has a bug or
the device itself has trouble with DMA in high memory.  This patch,
drafted by Luca Tettamanti, is being explored as a workaround.  I'd be
interested to know if it fixes your problem.

[Aside: For future reference, [EMAIL PROTECTED] is a
mailing list devoted to L1 driver development.]

Jay



diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6862c11..a600601 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -2104,15 +2104,12 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
if (err)
return err;
 
-   err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
+   err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (err) {
-   err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
-   if (err) {
-   dev_err(pdev-dev, no usable DMA configuration\n);
-   goto err_dma;
-   }
-   pci_using_64 = false;
+   dev_err(pdev-dev, no usable DMA configuration\n);
+   goto err_dma;
}
+   pci_using_64 = false;
/* Mark all PCI regions associated with PCI device
 * pdev as being reserved by owner atl1_driver_name
 */

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


Re: Problem with atl1 and msi in kernel 2.6.22-rc3

2007-05-30 Thread Jay Cliburn
On Wed, 30 May 2007 15:07:39 -0700
Greg KH <[EMAIL PROTECTED]> wrote:

> Sorry, I'm catching up on PCI stuff right now (am traveling in Tokyo
> right now, gotta love jet lag...)
> 
> thanks for your patience.

Thanks a lot for the note, Greg.  I appreciate it.  I'll be patient.

Jay
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Problem with atl1 and msi in kernel 2.6.22-rc3

2007-05-30 Thread Jay Cliburn
On Wed, 30 May 2007 02:00:25 +0200
Jose Alberto Reguero <[EMAIL PROTECTED]> wrote:

> I have problems with a M2V motherboard and atl1 driver with msi and
> kernel 2.6.22-rc3. With kernel 2.6.21 I had no problems.
> I must add in drivers/pci/quirks.c (line 1723):
> 
>  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, 
> quirk_disable_msi);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0xe238,
> quirk_disable_msi);
> 
> to disable msi in the atl1.

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

A more general solution is to disable MSI for the VIA VT3351 (used by
the Asus M2V).  I attempted to do this in the -stable tree with
http://lkml.org/lkml/2007/5/26/167, but it was shot down because the
patch isn't upstream yet.

Unfortunately, I can't submit it upstream because the enabling
patch hasn't yet been applied upstream by the PCI maintainer. My
request for info on the status of the patch went unanswered.
http://lkml.org/lkml/2007/5/19/74

The enabling patch was submitted by Tejun Heo 9 May.
http://lkml.org/lkml/2007/5/9/213

It was applied to -stable (2.6.21.2) 23 May.
http://lkml.org/lkml/2007/5/23/385

It has not yet been applied upstream.  When it is, I'll push the atl1
MSI patch.

Jay

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Problem with atl1 and msi in kernel 2.6.22-rc3

2007-05-30 Thread Jay Cliburn
On Wed, 30 May 2007 15:07:39 -0700
Greg KH [EMAIL PROTECTED] wrote:

 Sorry, I'm catching up on PCI stuff right now (am traveling in Tokyo
 right now, gotta love jet lag...)
 
 thanks for your patience.

Thanks a lot for the note, Greg.  I appreciate it.  I'll be patient.

Jay
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Problem with atl1 and msi in kernel 2.6.22-rc3

2007-05-30 Thread Jay Cliburn
On Wed, 30 May 2007 02:00:25 +0200
Jose Alberto Reguero [EMAIL PROTECTED] wrote:

 I have problems with a M2V motherboard and atl1 driver with msi and
 kernel 2.6.22-rc3. With kernel 2.6.21 I had no problems.
 I must add in drivers/pci/quirks.c (line 1723):
 
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, 
 quirk_disable_msi);
 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0xe238,
 quirk_disable_msi);
 
 to disable msi in the atl1.

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

A more general solution is to disable MSI for the VIA VT3351 (used by
the Asus M2V).  I attempted to do this in the -stable tree with
http://lkml.org/lkml/2007/5/26/167, but it was shot down because the
patch isn't upstream yet.

Unfortunately, I can't submit it upstream because the enabling
patch hasn't yet been applied upstream by the PCI maintainer. My
request for info on the status of the patch went unanswered.
http://lkml.org/lkml/2007/5/19/74

The enabling patch was submitted by Tejun Heo 9 May.
http://lkml.org/lkml/2007/5/9/213

It was applied to -stable (2.6.21.2) 23 May.
http://lkml.org/lkml/2007/5/23/385

It has not yet been applied upstream.  When it is, I'll push the atl1
MSI patch.

Jay

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


Re: [stable][PATCH] pci: quirk disable MSI on via vt3351

2007-05-26 Thread Jay Cliburn
On Sun, 27 May 2007 02:20:52 +0200
Adrian Bunk <[EMAIL PROTECTED]> wrote:

> On Sat, May 26, 2007 at 05:01:04PM -0500, Jay Cliburn wrote:
> > 
> > The Via VT3351 APIC does not play well with MSI and unleashes a
> > flood of APIC errors when MSI is used to deliver interrupts.  The
> > problem was recently exposed when the atl1 network device driver,
> > which enables MSI by default, stimulated APIC errors on an Asus M2V
> > mainboard, which employs the Via VT3351.
> > See http://bugzilla.kernel.org/show_bug.cgi?id=8472 for additional
> > details on this bug.
> >...
> 
> Please get patches included in Linus' tree _before_ submitting them
> for -stable.
> 
> Adding a fix to 2.6.21 that is not yet in 2.6.22-rc would create a 
> regression in 2.6.22.

Okay, thanks Adrian.  I didn't realize I was making a mistake.  I've
been waiting for the below patch to make it upstream, but it landed
in stable first, so I guess there's a regression as you indicate.  My
patch depends upon this one.


Subject: [patch 41/69] pci-quirks: disable MSI on RS400-200 and RS480
Date: Mon, 21 May 2007 12:16:53 -0700
Sender: [EMAIL PROTECTED]
User-Agent: quilt/0.46-1

-stable review patch.  If anyone has any objections, please let us know.
-

From: Tejun Heo <[EMAIL PROTECTED]>

MSI doesn't work on RS400-200 and RS480 requiring pci=nomsi kernel boot
parameter for ahci to work.  This patch renames quirk_svw_msi() to
quirk_disable_all_msi() and use it to disable MSI on those chips.

  http://thread.gmane.org/gmane.linux.ide/17820
  http://thread.gmane.org/gmane.linux.ide/17516
  https://bugzilla.novell.com/show_bug.cgi?id=263893

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Cc: Matí-as Alejandro Torres <[EMAIL PROTECTED]>
Cc: Greg K-H <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Chris Wright <[EMAIL PROTECTED]>
---

 drivers/pci/quirks.c |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

--- linux-2.6.21.1.orig/drivers/pci/quirks.c
+++ linux-2.6.21.1/drivers/pci/quirks.c
@@ -1737,18 +1737,20 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_N
quirk_nvidia_ck804_pcie_aer_ext_cap);
 
 #ifdef CONFIG_PCI_MSI
-/* The Serverworks PCI-X chipset does not support MSI. We cannot
easily rely
- * on setting PCI_BUS_FLAGS_NO_MSI in its bus flags because there are
actually
- * some other busses controlled by the chipset even if Linux is not
aware of it.
- * Instead of setting the flag on all busses in the machine, simply
disable MSI
- * globally.
+/* Some chipsets do not support MSI. We cannot easily rely on setting
+ * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
+ * some other busses controlled by the chipset even if Linux is not
+ * aware of it.  Instead of setting the flag on all busses in the
+ * machine, simply disable MSI globally.
  */
-static void __init quirk_svw_msi(struct pci_dev *dev)
+static void __init quirk_disable_all_msi(struct pci_dev *dev)
 {
pci_no_msi();
printk(KERN_WARNING "PCI: MSI quirk detected. MSI
deactivated.\n"); }
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_svw_msi);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,
PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480,
quirk_disable_all_msi); /* Disable MSI on chipsets that are known to
not support it */ static void __devinit quirk_disable_msi(struct
pci_dev *dev)

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[stable][PATCH] pci: quirk disable MSI on via vt3351

2007-05-26 Thread Jay Cliburn

The Via VT3351 APIC does not play well with MSI and unleashes a flood
of APIC errors when MSI is used to deliver interrupts.  The problem
was recently exposed when the atl1 network device driver, which enables
MSI by default, stimulated APIC errors on an Asus M2V mainboard, which
employs the Via VT3351.
See http://bugzilla.kernel.org/show_bug.cgi?id=8472 for additional
details on this bug.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/pci/quirks.c|1 +
 include/linux/pci_ids.h |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 5af9125..e2d81af 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1751,6 +1751,7 @@ static void __init quirk_disable_all_msi(struct pci_dev 
*dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, 
PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, 
quirk_disable_all_msi);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, 
quirk_disable_all_msi);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, 
quirk_disable_all_msi);
 
 /* Disable MSI on chipsets that are known to not support it */
 static void __devinit quirk_disable_msi(struct pci_dev *dev)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 600308f..2a0a70d 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1287,6 +1287,7 @@
 #define PCI_DEVICE_ID_VIA_P4M800CE 0x0314
 #define PCI_DEVICE_ID_VIA_P4M890   0x0327
 #define PCI_DEVICE_ID_VIA_VT3336   0x0336
+#define PCI_DEVICE_ID_VIA_VT3351   0x0351
 #define PCI_DEVICE_ID_VIA_8371_0   0x0391
 #define PCI_DEVICE_ID_VIA_8501_0   0x0501
 #define PCI_DEVICE_ID_VIA_82C561   0x0561

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[stable][PATCH] pci: quirk disable MSI on via vt3351

2007-05-26 Thread Jay Cliburn

The Via VT3351 APIC does not play well with MSI and unleashes a flood
of APIC errors when MSI is used to deliver interrupts.  The problem
was recently exposed when the atl1 network device driver, which enables
MSI by default, stimulated APIC errors on an Asus M2V mainboard, which
employs the Via VT3351.
See http://bugzilla.kernel.org/show_bug.cgi?id=8472 for additional
details on this bug.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/pci/quirks.c|1 +
 include/linux/pci_ids.h |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 5af9125..e2d81af 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1751,6 +1751,7 @@ static void __init quirk_disable_all_msi(struct pci_dev 
*dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, 
PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, 
quirk_disable_all_msi);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, 
quirk_disable_all_msi);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, 
quirk_disable_all_msi);
 
 /* Disable MSI on chipsets that are known to not support it */
 static void __devinit quirk_disable_msi(struct pci_dev *dev)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 600308f..2a0a70d 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1287,6 +1287,7 @@
 #define PCI_DEVICE_ID_VIA_P4M800CE 0x0314
 #define PCI_DEVICE_ID_VIA_P4M890   0x0327
 #define PCI_DEVICE_ID_VIA_VT3336   0x0336
+#define PCI_DEVICE_ID_VIA_VT3351   0x0351
 #define PCI_DEVICE_ID_VIA_8371_0   0x0391
 #define PCI_DEVICE_ID_VIA_8501_0   0x0501
 #define PCI_DEVICE_ID_VIA_82C561   0x0561

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


Re: [stable][PATCH] pci: quirk disable MSI on via vt3351

2007-05-26 Thread Jay Cliburn
On Sun, 27 May 2007 02:20:52 +0200
Adrian Bunk [EMAIL PROTECTED] wrote:

 On Sat, May 26, 2007 at 05:01:04PM -0500, Jay Cliburn wrote:
  
  The Via VT3351 APIC does not play well with MSI and unleashes a
  flood of APIC errors when MSI is used to deliver interrupts.  The
  problem was recently exposed when the atl1 network device driver,
  which enables MSI by default, stimulated APIC errors on an Asus M2V
  mainboard, which employs the Via VT3351.
  See http://bugzilla.kernel.org/show_bug.cgi?id=8472 for additional
  details on this bug.
 ...
 
 Please get patches included in Linus' tree _before_ submitting them
 for -stable.
 
 Adding a fix to 2.6.21 that is not yet in 2.6.22-rc would create a 
 regression in 2.6.22.

Okay, thanks Adrian.  I didn't realize I was making a mistake.  I've
been waiting for the below patch to make it upstream, but it landed
in stable first, so I guess there's a regression as you indicate.  My
patch depends upon this one.


Subject: [patch 41/69] pci-quirks: disable MSI on RS400-200 and RS480
Date: Mon, 21 May 2007 12:16:53 -0700
Sender: [EMAIL PROTECTED]
User-Agent: quilt/0.46-1

-stable review patch.  If anyone has any objections, please let us know.
-

From: Tejun Heo [EMAIL PROTECTED]

MSI doesn't work on RS400-200 and RS480 requiring pci=nomsi kernel boot
parameter for ahci to work.  This patch renames quirk_svw_msi() to
quirk_disable_all_msi() and use it to disable MSI on those chips.

  http://thread.gmane.org/gmane.linux.ide/17820
  http://thread.gmane.org/gmane.linux.ide/17516
  https://bugzilla.novell.com/show_bug.cgi?id=263893

Signed-off-by: Tejun Heo [EMAIL PROTECTED]
Cc: Matí-as Alejandro Torres [EMAIL PROTECTED]
Cc: Greg K-H [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Chris Wright [EMAIL PROTECTED]
---

 drivers/pci/quirks.c |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

--- linux-2.6.21.1.orig/drivers/pci/quirks.c
+++ linux-2.6.21.1/drivers/pci/quirks.c
@@ -1737,18 +1737,20 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_N
quirk_nvidia_ck804_pcie_aer_ext_cap);
 
 #ifdef CONFIG_PCI_MSI
-/* The Serverworks PCI-X chipset does not support MSI. We cannot
easily rely
- * on setting PCI_BUS_FLAGS_NO_MSI in its bus flags because there are
actually
- * some other busses controlled by the chipset even if Linux is not
aware of it.
- * Instead of setting the flag on all busses in the machine, simply
disable MSI
- * globally.
+/* Some chipsets do not support MSI. We cannot easily rely on setting
+ * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
+ * some other busses controlled by the chipset even if Linux is not
+ * aware of it.  Instead of setting the flag on all busses in the
+ * machine, simply disable MSI globally.
  */
-static void __init quirk_svw_msi(struct pci_dev *dev)
+static void __init quirk_disable_all_msi(struct pci_dev *dev)
 {
pci_no_msi();
printk(KERN_WARNING PCI: MSI quirk detected. MSI
deactivated.\n); }
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_svw_msi);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,
PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480,
quirk_disable_all_msi); /* Disable MSI on chipsets that are known to
not support it */ static void __devinit quirk_disable_msi(struct
pci_dev *dev)

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


Re: [PATCH] pci-quirks: disable MSI on RS400-200 and RS480, take #2

2007-05-19 Thread Jay Cliburn
Can someone (Greg K-H?) tell me the status of the below patch?  Is it
planned for 2.6.22?  It looks like a useful generic "let's disable msi
on board x" that I might want to use for the atl1 network driver.

Thanks,
Jay

On Wed, 09 May 2007 14:23:02 +0200
Tejun Heo <[EMAIL PROTECTED]> wrote:

> MSI doesn't work on RS400-200 and RS480 requiring pci=nomsi kernel
> boot parameter for ahci to work.  This patch renames quirk_svw_msi()
> to quirk_disable_all_msi() and use it to disable MSI on those chips.
> 
>   http://thread.gmane.org/gmane.linux.ide/17820
>   http://thread.gmane.org/gmane.linux.ide/17516
>   https://bugzilla.novell.com/show_bug.cgi?id=263893
> 
> Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
> Cc: Matí­as Alejandro Torres <[EMAIL PROTECTED]>
> ---
> Okay, this is the fixed version and should probably included in
> -stable too as there have been quite some number of reports which got
> resolved by adding 'pci=nomsi'.  Verified by Matí­as Alejandro Torres.
> 
> Thanks.
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 3411483..1e3070e 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -1624,18 +1624,20 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_N
>   quirk_nvidia_ck804_pcie_aer_ext_cap);
>  
>  #ifdef CONFIG_PCI_MSI
> -/* The Serverworks PCI-X chipset does not support MSI. We cannot
> easily rely
> - * on setting PCI_BUS_FLAGS_NO_MSI in its bus flags because there
> are actually
> - * some other busses controlled by the chipset even if Linux is not
> aware of it.
> - * Instead of setting the flag on all busses in the machine, simply
> disable MSI
> - * globally.
> +/* Some chipsets do not support MSI. We cannot easily rely on setting
> + * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
> + * some other busses controlled by the chipset even if Linux is not
> + * aware of it.  Instead of setting the flag on all busses in the
> + * machine, simply disable MSI globally.
>   */
> -static void __init quirk_svw_msi(struct pci_dev *dev)
> +static void __init quirk_disable_all_msi(struct pci_dev *dev)
>  {
>   pci_no_msi();
>   printk(KERN_WARNING "PCI: MSI quirk detected. MSI
> deactivated.\n"); }
> -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
> PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_svw_msi);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
> PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,
> PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480,
> quirk_disable_all_msi); /* Disable MSI on chipsets that are known to
> not support it */ static void __devinit quirk_disable_msi(struct
> pci_dev *dev) - To unsubscribe from this list: send the line
> "unsubscribe linux-kernel" in the body of a message to
> [EMAIL PROTECTED] More majordomo info at
> http://vger.kernel.org/majordomo-info.html Please read the FAQ at
> http://www.tux.org/lkml/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pci-quirks: disable MSI on RS400-200 and RS480, take #2

2007-05-19 Thread Jay Cliburn
Can someone (Greg K-H?) tell me the status of the below patch?  Is it
planned for 2.6.22?  It looks like a useful generic let's disable msi
on board x that I might want to use for the atl1 network driver.

Thanks,
Jay

On Wed, 09 May 2007 14:23:02 +0200
Tejun Heo [EMAIL PROTECTED] wrote:

 MSI doesn't work on RS400-200 and RS480 requiring pci=nomsi kernel
 boot parameter for ahci to work.  This patch renames quirk_svw_msi()
 to quirk_disable_all_msi() and use it to disable MSI on those chips.
 
   http://thread.gmane.org/gmane.linux.ide/17820
   http://thread.gmane.org/gmane.linux.ide/17516
   https://bugzilla.novell.com/show_bug.cgi?id=263893
 
 Signed-off-by: Tejun Heo [EMAIL PROTECTED]
 Cc: Matí­as Alejandro Torres [EMAIL PROTECTED]
 ---
 Okay, this is the fixed version and should probably included in
 -stable too as there have been quite some number of reports which got
 resolved by adding 'pci=nomsi'.  Verified by Matí­as Alejandro Torres.
 
 Thanks.
 
 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
 index 3411483..1e3070e 100644
 --- a/drivers/pci/quirks.c
 +++ b/drivers/pci/quirks.c
 @@ -1624,18 +1624,20 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_N
   quirk_nvidia_ck804_pcie_aer_ext_cap);
  
  #ifdef CONFIG_PCI_MSI
 -/* The Serverworks PCI-X chipset does not support MSI. We cannot
 easily rely
 - * on setting PCI_BUS_FLAGS_NO_MSI in its bus flags because there
 are actually
 - * some other busses controlled by the chipset even if Linux is not
 aware of it.
 - * Instead of setting the flag on all busses in the machine, simply
 disable MSI
 - * globally.
 +/* Some chipsets do not support MSI. We cannot easily rely on setting
 + * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
 + * some other busses controlled by the chipset even if Linux is not
 + * aware of it.  Instead of setting the flag on all busses in the
 + * machine, simply disable MSI globally.
   */
 -static void __init quirk_svw_msi(struct pci_dev *dev)
 +static void __init quirk_disable_all_msi(struct pci_dev *dev)
  {
   pci_no_msi();
   printk(KERN_WARNING PCI: MSI quirk detected. MSI
 deactivated.\n); }
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
 PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_svw_msi);
 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
 PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,
 PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480,
 quirk_disable_all_msi); /* Disable MSI on chipsets that are known to
 not support it */ static void __devinit quirk_disable_msi(struct
 pci_dev *dev) - To unsubscribe from this list: send the line
 unsubscribe linux-kernel in the body of a message to
 [EMAIL PROTECTED] More majordomo info at
 http://vger.kernel.org/majordomo-info.html Please read the FAQ at
 http://www.tux.org/lkml/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: APIC error on 32-bit kernel

2007-05-12 Thread Jay Cliburn
Thank you very much for looking at this, Len.


On Fri, 11 May 2007 23:28:58 -0400
Len Brown <[EMAIL PROTECTED]> wrote:

> > > [   94.754852] APIC error on CPU0: 08(40)
> > > [   94.806045] APIC error on CPU0: 40(08)
> 
> /* Here is what the APIC error bits mean:
>0: Send CS error
>1: Receive CS error
>2: Send accept error
>3: Receive accept error
>4: Reserved
>5: Send illegal vector
>6: Received illegal vector
>7: Illegal register address
> */
> 
> So the 40 means the APIC got an illegal vector.
> Certainly this is consistent with the fact that
> the errors start when a specific device is being
> used.  I assume that device is using MSI?

Yes, the device is using MSI.

> Curious that it is different in 32-bit and 64-bit mode.

Agreed, although I had one user back in March report APIC errors on the
Asus M2V board while running Debian x86_64.  I personally have never
encountered the problem under a 64-bit kernel, but I admit that just
might be random luck.


> > > We also do not see this problem on Intel-based motherboards, with
> > > either 32- or 64-bit kernels.
> > 
> > A full raft of documentation -- including acpidump and
> > linux-firmware-kit output, console capture, kernel config, lspci
> > -vvxxx (with apic=debug boot option), dmesg, and /proc/interrupts
> > -- is available at http://www.hogchain.net/m2v/apic-problem/
> 
> 
> [06Dh 109  2]  Boot Architecture Flags : 0003
> 
> for what it is worth, the bit in ACPI that is used to
> disable MSI support is not set -- so as  far as the BIOS
> is concerned, this system should support MSI.
> 
> Is it an add-in card, or lan-on-motherboard?

This is a PCIe LAN-on-motherboard.

My goal is to understand whether this is a problem in the atl1 driver,
or a problem on the motherboard.  If it's the former, obviously I want
to fix it.  If it's the latter, then I want to disable MSI in the driver
when we discover we're running on this motherboard.

Thanks again for taking time to look at this.  Any advice or hints you
provide will be greatly appreciated.

Jay
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: APIC error on 32-bit kernel

2007-05-12 Thread Jay Cliburn
Thank you very much for looking at this, Len.


On Fri, 11 May 2007 23:28:58 -0400
Len Brown [EMAIL PROTECTED] wrote:

   [   94.754852] APIC error on CPU0: 08(40)
   [   94.806045] APIC error on CPU0: 40(08)
 
 /* Here is what the APIC error bits mean:
0: Send CS error
1: Receive CS error
2: Send accept error
3: Receive accept error
4: Reserved
5: Send illegal vector
6: Received illegal vector
7: Illegal register address
 */
 
 So the 40 means the APIC got an illegal vector.
 Certainly this is consistent with the fact that
 the errors start when a specific device is being
 used.  I assume that device is using MSI?

Yes, the device is using MSI.

 Curious that it is different in 32-bit and 64-bit mode.

Agreed, although I had one user back in March report APIC errors on the
Asus M2V board while running Debian x86_64.  I personally have never
encountered the problem under a 64-bit kernel, but I admit that just
might be random luck.


   We also do not see this problem on Intel-based motherboards, with
   either 32- or 64-bit kernels.
  
  A full raft of documentation -- including acpidump and
  linux-firmware-kit output, console capture, kernel config, lspci
  -vvxxx (with apic=debug boot option), dmesg, and /proc/interrupts
  -- is available at http://www.hogchain.net/m2v/apic-problem/
 
 
 [06Dh 109  2]  Boot Architecture Flags : 0003
 
 for what it is worth, the bit in ACPI that is used to
 disable MSI support is not set -- so as  far as the BIOS
 is concerned, this system should support MSI.
 
 Is it an add-in card, or lan-on-motherboard?

This is a PCIe LAN-on-motherboard.

My goal is to understand whether this is a problem in the atl1 driver,
or a problem on the motherboard.  If it's the former, obviously I want
to fix it.  If it's the latter, then I want to disable MSI in the driver
when we discover we're running on this motherboard.

Thanks again for taking time to look at this.  Any advice or hints you
provide will be greatly appreciated.

Jay
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pci-quirks: disable MSI on RS400-200 and RS480, take #2

2007-05-09 Thread Jay Cliburn

Jeff Garzik wrote:

Chuck Ebbert wrote:

Tejun Heo wrote:

FWIW several distros have turned off MSI by default and added
a "pci=msi" option to enable it.

Yeah, it seem to cause a lot of problems on certain chips but I think
the correct path is to add PCI quirks for those.  Most MSI problems I've
seen are on these ATI chips.  Do you happen to know any other?


We had devices that didn't do MSI right, e.g. forcedeth and others I
can't recall now.


AFAIK that's a broken diagnosis.   It's the system, not the device, that 
is problematic.




In the case of the Attansic L1 ethernet driver, here's what we see:

chipset kernel arch MSI functionality
=== === =
Intel 945G/ICH7 x86_64  yes
Intel 945G/ICH7 i386yes
Via K8T890  x86_64  yes
Via K8T890  i386no

I still don't know why, but we get a flood of APIC errors after starting the 
atl1 driver on a Via K8T890 board (Asus M2V, for example) under a 32-bit kernel, 
and *only* under a 32-bit kernel.


http://lkml.org/lkml/2007/4/8/68

Supporting files and such at ftp://ftp.hogchain.net/pub/linux/m2v/apic-problem

Any hints heartily welcomed...

Jay

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pci-quirks: disable MSI on RS400-200 and RS480, take #2

2007-05-09 Thread Jay Cliburn

Jeff Garzik wrote:

Chuck Ebbert wrote:

Tejun Heo wrote:

FWIW several distros have turned off MSI by default and added
a pci=msi option to enable it.

Yeah, it seem to cause a lot of problems on certain chips but I think
the correct path is to add PCI quirks for those.  Most MSI problems I've
seen are on these ATI chips.  Do you happen to know any other?


We had devices that didn't do MSI right, e.g. forcedeth and others I
can't recall now.


AFAIK that's a broken diagnosis.   It's the system, not the device, that 
is problematic.




In the case of the Attansic L1 ethernet driver, here's what we see:

chipset kernel arch MSI functionality
=== === =
Intel 945G/ICH7 x86_64  yes
Intel 945G/ICH7 i386yes
Via K8T890  x86_64  yes
Via K8T890  i386no

I still don't know why, but we get a flood of APIC errors after starting the 
atl1 driver on a Via K8T890 board (Asus M2V, for example) under a 32-bit kernel, 
and *only* under a 32-bit kernel.


http://lkml.org/lkml/2007/4/8/68

Supporting files and such at ftp://ftp.hogchain.net/pub/linux/m2v/apic-problem

Any hints heartily welcomed...

Jay

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


[PATCH 1/2] atl1: use dev_printk macros

2007-04-29 Thread Jay Cliburn
Use dev_printk macros for PCI related errors, warnings, debug and info
console messages.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_ethtool.c |   19 +++--
 drivers/net/atl1/atl1_hw.c  |   22 +--
 drivers/net/atl1/atl1_main.c|   83 +-
 drivers/net/atl1/atl1_param.c   |   31 +++
 4 files changed, 68 insertions(+), 87 deletions(-)

diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c
index c11c277..1f616c5 100644
--- a/drivers/net/atl1/atl1_ethtool.c
+++ b/drivers/net/atl1/atl1_ethtool.c
@@ -156,8 +156,7 @@ static int atl1_set_settings(struct net_device *netdev,
u16 old_media_type = hw->media_type;
 
if (netif_running(adapter->netdev)) {
-   printk(KERN_DEBUG "%s: ethtool shutting down adapter\n",
-   atl1_driver_name);
+   dev_dbg(>pdev->dev, "ethtool shutting down adapter\n");
atl1_down(adapter);
}
 
@@ -166,9 +165,8 @@ static int atl1_set_settings(struct net_device *netdev,
else {
if (ecmd->speed == SPEED_1000) {
if (ecmd->duplex != DUPLEX_FULL) {
-   printk(KERN_WARNING
-  "%s: can't force to 1000M half duplex\n",
-   atl1_driver_name);
+   dev_warn(>pdev->dev,
+   "can't force to 1000M half duplex\n");
ret_val = -EINVAL;
goto exit_sset;
}
@@ -206,9 +204,8 @@ static int atl1_set_settings(struct net_device *netdev,
}
if (atl1_phy_setup_autoneg_adv(hw)) {
ret_val = -EINVAL;
-   printk(KERN_WARNING
-   "%s: invalid ethtool speed/duplex setting\n",
-   atl1_driver_name);
+   dev_warn(>pdev->dev,
+   "invalid ethtool speed/duplex setting\n");
goto exit_sset;
}
if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR ||
@@ -239,12 +236,10 @@ exit_sset:
hw->media_type = old_media_type;
 
if (netif_running(adapter->netdev)) {
-   printk(KERN_DEBUG "%s: ethtool starting adapter\n",
-   atl1_driver_name);
+   dev_dbg(>pdev->dev, "ethtool starting adapter\n");
atl1_up(adapter);
} else if (!ret_val) {
-   printk(KERN_DEBUG "%s: ethtool resetting adapter\n",
-   atl1_driver_name);
+   dev_dbg(>pdev->dev, "ethtool resetting adapter\n");
atl1_reset(adapter);
}
return ret_val;
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 69482e0..5b9dd3c 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -38,6 +38,7 @@
  */
 s32 atl1_reset_hw(struct atl1_hw *hw)
 {
+   struct pci_dev *pdev = hw->back->pdev;
u32 icr;
int i;
 
@@ -74,7 +75,7 @@ s32 atl1_reset_hw(struct atl1_hw *hw)
}
 
if (icr) {
-   printk (KERN_DEBUG "icr = %x\n", icr); 
+   dev_dbg(>dev, "ICR = 0x%x\n", icr);
return icr;
}
 
@@ -437,6 +438,7 @@ s32 atl1_phy_enter_power_saving(struct atl1_hw *hw)
  */
 static s32 atl1_phy_reset(struct atl1_hw *hw)
 {
+   struct pci_dev *pdev = hw->back->pdev;
s32 ret_val;
u16 phy_data;
 
@@ -468,8 +470,7 @@ static s32 atl1_phy_reset(struct atl1_hw *hw)
u32 val;
int i;
/* pcie serdes link may be down! */
-   printk(KERN_DEBUG "%s: autoneg caused pcie phy link down\n", 
-   atl1_driver_name);
+   dev_dbg(>dev, "pcie phy link down\n");
 
for (i = 0; i < 25; i++) {
msleep(1);
@@ -479,9 +480,7 @@ static s32 atl1_phy_reset(struct atl1_hw *hw)
}
 
if ((val & (MDIO_START | MDIO_BUSY)) != 0) {
-   printk(KERN_WARNING 
-   "%s: pcie link down at least for 25ms\n", 
-   atl1_driver_name);
+   dev_warn(>dev, "pcie link down at least 25ms\n");
return ret_val;
}
}
@@ -571,6 +570,7 @@ s32 atl1_phy_setup_autoneg_adv(struct atl1_hw *hw)
  */
 static s32 atl1_setup_link(struct atl1_hw *hw)
 {
+   struct pci_dev *pdev = hw->back->pdev;
s32 ret_val;
 
/*
@@ -581,15 +581,13 @@ static s32 atl1_setup_link(struct atl1_hw *hw)
 

[PATCH 0/2] atl1: minor cleanup

2007-04-29 Thread Jay Cliburn

Please accept the following trivial patches to the atl1 driver.

- use dev_printk macros
- fix whitespace damage

 drivers/net/atl1/atl1_ethtool.c |   19 +++--
 drivers/net/atl1/atl1_hw.c  |   44 ++---
 drivers/net/atl1/atl1_main.c|   83 +-
 drivers/net/atl1/atl1_param.c   |   31 +++
 4 files changed, 79 insertions(+), 98 deletions(-)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] atl1: fix whitespace damage

2007-04-29 Thread Jay Cliburn
Remove trailing whitespace and spaces preceding tabs.

Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]>
---
 drivers/net/atl1/atl1_hw.c |   22 +++---
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 5b9dd3c..ef886bd 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -2,20 +2,20 @@
  * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
  * Copyright(c) 2006 Chris Snook <[EMAIL PROTECTED]>
  * Copyright(c) 2006 Jay Cliburn <[EMAIL PROTECTED]>
- * 
+ *
  * Derived from Intel e1000 driver
  * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
  * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * this program; if not, write to the Free Software Foundation, Inc., 59
  * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -42,9 +42,9 @@ s32 atl1_reset_hw(struct atl1_hw *hw)
u32 icr;
int i;
 
-   /* 
+   /*
 * Clear Interrupt mask to stop board from generating
-* interrupts & Clear any pending interrupt events 
+* interrupts & Clear any pending interrupt events
 */
/*
 * iowrite32(0, hw->hw_addr + REG_IMR);
@@ -137,8 +137,8 @@ s32 atl1_read_phy_reg(struct atl1_hw *hw, u16 reg_addr, u16 
*phy_data)
int i;
 
val = ((u32) (reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT |
-   MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 <<
-   MDIO_CLK_SEL_SHIFT;
+   MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 <<
+   MDIO_CLK_SEL_SHIFT;
iowrite32(val, hw->hw_addr + REG_MDIO_CTRL);
ioread32(hw->hw_addr + REG_MDIO_CTRL);
 
@@ -205,7 +205,7 @@ static bool atl1_spi_read(struct atl1_hw *hw, u32 addr, u32 
*buf)
 
 /*
  * get_permanent_address
- * return 0 if get valid mac address, 
+ * return 0 if get valid mac address,
  */
 static int atl1_get_permanent_address(struct atl1_hw *hw)
 {
@@ -302,7 +302,7 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
 }
 
 /*
- * Reads the adapter's MAC address from the EEPROM 
+ * Reads the adapter's MAC address from the EEPROM
  * hw - Struct containing variables accessed by shared code
  */
 s32 atl1_read_mac_addr(struct atl1_hw *hw)
@@ -629,7 +629,7 @@ static void atl1_init_flash_opcode(struct atl1_hw *hw)
  * Performs basic configuration of the adapter.
  * hw - Struct containing variables accessed by shared code
  * Assumes that the controller has previously been reset and is in a
- * post-reset uninitialized state. Initializes multicast table, 
+ * post-reset uninitialized state. Initializes multicast table,
  * and  Calls routines to setup link
  * Leaves the transmit and receive units disabled and uninitialized.
  */
-- 
1.5.0.6

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] atl1: minor cleanup

2007-04-29 Thread Jay Cliburn

Please accept the following trivial patches to the atl1 driver.

- use dev_printk macros
- fix whitespace damage

 drivers/net/atl1/atl1_ethtool.c |   19 +++--
 drivers/net/atl1/atl1_hw.c  |   44 ++---
 drivers/net/atl1/atl1_main.c|   83 +-
 drivers/net/atl1/atl1_param.c   |   31 +++
 4 files changed, 79 insertions(+), 98 deletions(-)
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] atl1: fix whitespace damage

2007-04-29 Thread Jay Cliburn
Remove trailing whitespace and spaces preceding tabs.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_hw.c |   22 +++---
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 5b9dd3c..ef886bd 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -2,20 +2,20 @@
  * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
  * Copyright(c) 2006 Chris Snook [EMAIL PROTECTED]
  * Copyright(c) 2006 Jay Cliburn [EMAIL PROTECTED]
- * 
+ *
  * Derived from Intel e1000 driver
  * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
  * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * this program; if not, write to the Free Software Foundation, Inc., 59
  * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -42,9 +42,9 @@ s32 atl1_reset_hw(struct atl1_hw *hw)
u32 icr;
int i;
 
-   /* 
+   /*
 * Clear Interrupt mask to stop board from generating
-* interrupts  Clear any pending interrupt events 
+* interrupts  Clear any pending interrupt events
 */
/*
 * iowrite32(0, hw-hw_addr + REG_IMR);
@@ -137,8 +137,8 @@ s32 atl1_read_phy_reg(struct atl1_hw *hw, u16 reg_addr, u16 
*phy_data)
int i;
 
val = ((u32) (reg_addr  MDIO_REG_ADDR_MASK))  MDIO_REG_ADDR_SHIFT |
-   MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 
-   MDIO_CLK_SEL_SHIFT;
+   MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 
+   MDIO_CLK_SEL_SHIFT;
iowrite32(val, hw-hw_addr + REG_MDIO_CTRL);
ioread32(hw-hw_addr + REG_MDIO_CTRL);
 
@@ -205,7 +205,7 @@ static bool atl1_spi_read(struct atl1_hw *hw, u32 addr, u32 
*buf)
 
 /*
  * get_permanent_address
- * return 0 if get valid mac address, 
+ * return 0 if get valid mac address,
  */
 static int atl1_get_permanent_address(struct atl1_hw *hw)
 {
@@ -302,7 +302,7 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
 }
 
 /*
- * Reads the adapter's MAC address from the EEPROM 
+ * Reads the adapter's MAC address from the EEPROM
  * hw - Struct containing variables accessed by shared code
  */
 s32 atl1_read_mac_addr(struct atl1_hw *hw)
@@ -629,7 +629,7 @@ static void atl1_init_flash_opcode(struct atl1_hw *hw)
  * Performs basic configuration of the adapter.
  * hw - Struct containing variables accessed by shared code
  * Assumes that the controller has previously been reset and is in a
- * post-reset uninitialized state. Initializes multicast table, 
+ * post-reset uninitialized state. Initializes multicast table,
  * and  Calls routines to setup link
  * Leaves the transmit and receive units disabled and uninitialized.
  */
-- 
1.5.0.6

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


[PATCH 1/2] atl1: use dev_printk macros

2007-04-29 Thread Jay Cliburn
Use dev_printk macros for PCI related errors, warnings, debug and info
console messages.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atl1/atl1_ethtool.c |   19 +++--
 drivers/net/atl1/atl1_hw.c  |   22 +--
 drivers/net/atl1/atl1_main.c|   83 +-
 drivers/net/atl1/atl1_param.c   |   31 +++
 4 files changed, 68 insertions(+), 87 deletions(-)

diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c
index c11c277..1f616c5 100644
--- a/drivers/net/atl1/atl1_ethtool.c
+++ b/drivers/net/atl1/atl1_ethtool.c
@@ -156,8 +156,7 @@ static int atl1_set_settings(struct net_device *netdev,
u16 old_media_type = hw-media_type;
 
if (netif_running(adapter-netdev)) {
-   printk(KERN_DEBUG %s: ethtool shutting down adapter\n,
-   atl1_driver_name);
+   dev_dbg(adapter-pdev-dev, ethtool shutting down adapter\n);
atl1_down(adapter);
}
 
@@ -166,9 +165,8 @@ static int atl1_set_settings(struct net_device *netdev,
else {
if (ecmd-speed == SPEED_1000) {
if (ecmd-duplex != DUPLEX_FULL) {
-   printk(KERN_WARNING
-  %s: can't force to 1000M half duplex\n,
-   atl1_driver_name);
+   dev_warn(adapter-pdev-dev,
+   can't force to 1000M half duplex\n);
ret_val = -EINVAL;
goto exit_sset;
}
@@ -206,9 +204,8 @@ static int atl1_set_settings(struct net_device *netdev,
}
if (atl1_phy_setup_autoneg_adv(hw)) {
ret_val = -EINVAL;
-   printk(KERN_WARNING
-   %s: invalid ethtool speed/duplex setting\n,
-   atl1_driver_name);
+   dev_warn(adapter-pdev-dev,
+   invalid ethtool speed/duplex setting\n);
goto exit_sset;
}
if (hw-media_type == MEDIA_TYPE_AUTO_SENSOR ||
@@ -239,12 +236,10 @@ exit_sset:
hw-media_type = old_media_type;
 
if (netif_running(adapter-netdev)) {
-   printk(KERN_DEBUG %s: ethtool starting adapter\n,
-   atl1_driver_name);
+   dev_dbg(adapter-pdev-dev, ethtool starting adapter\n);
atl1_up(adapter);
} else if (!ret_val) {
-   printk(KERN_DEBUG %s: ethtool resetting adapter\n,
-   atl1_driver_name);
+   dev_dbg(adapter-pdev-dev, ethtool resetting adapter\n);
atl1_reset(adapter);
}
return ret_val;
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 69482e0..5b9dd3c 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -38,6 +38,7 @@
  */
 s32 atl1_reset_hw(struct atl1_hw *hw)
 {
+   struct pci_dev *pdev = hw-back-pdev;
u32 icr;
int i;
 
@@ -74,7 +75,7 @@ s32 atl1_reset_hw(struct atl1_hw *hw)
}
 
if (icr) {
-   printk (KERN_DEBUG icr = %x\n, icr); 
+   dev_dbg(pdev-dev, ICR = 0x%x\n, icr);
return icr;
}
 
@@ -437,6 +438,7 @@ s32 atl1_phy_enter_power_saving(struct atl1_hw *hw)
  */
 static s32 atl1_phy_reset(struct atl1_hw *hw)
 {
+   struct pci_dev *pdev = hw-back-pdev;
s32 ret_val;
u16 phy_data;
 
@@ -468,8 +470,7 @@ static s32 atl1_phy_reset(struct atl1_hw *hw)
u32 val;
int i;
/* pcie serdes link may be down! */
-   printk(KERN_DEBUG %s: autoneg caused pcie phy link down\n, 
-   atl1_driver_name);
+   dev_dbg(pdev-dev, pcie phy link down\n);
 
for (i = 0; i  25; i++) {
msleep(1);
@@ -479,9 +480,7 @@ static s32 atl1_phy_reset(struct atl1_hw *hw)
}
 
if ((val  (MDIO_START | MDIO_BUSY)) != 0) {
-   printk(KERN_WARNING 
-   %s: pcie link down at least for 25ms\n, 
-   atl1_driver_name);
+   dev_warn(pdev-dev, pcie link down at least 25ms\n);
return ret_val;
}
}
@@ -571,6 +570,7 @@ s32 atl1_phy_setup_autoneg_adv(struct atl1_hw *hw)
  */
 static s32 atl1_setup_link(struct atl1_hw *hw)
 {
+   struct pci_dev *pdev = hw-back-pdev;
s32 ret_val;
 
/*
@@ -581,15 +581,13 @@ static s32 atl1_setup_link(struct atl1_hw *hw)
 */
ret_val = atl1_phy_setup_autoneg_adv(hw);
if (ret_val) {
-   printk(KERN_DEBUG %s: error setting up autonegotiation\n, 
-   atl1_driver_name);
+   dev_dbg(pdev-dev, error setting up autonegotiation

Re: APIC error on 32-bit kernel

2007-04-09 Thread Jay Cliburn

Chuck Ebbert wrote:


Where is the text of the oops?


In one of the files on the website I referenced.  Here's the text...

[  173.584000] APIC error on CPU1: 08(08)
[  173.665000] APIC error on CPU0: 08(08)
[  173.665000] APIC error on CPU1: 08(08)
[  173.746000] APIC error on CPU0: 08(08)
[  173.746000] APIC error on CPU1: 08(08)
[  173.827000] APIC error on CPU0: 08(08)
[  173.827000] APIC error on CPU1: 08(08)
[  173.908000] APIC error on CPU0: 08(08)
[  173.908000] APIC error on CPU1: 08(08)
[  173.989000] APIC error on CPU0: 08(08)
[  173.989000] APIC error on CPU1: 08(08)

pinged my router somewhere along about here...

[  174.069000] BUG: unable to handle kernel NULL pointer 
dereference<1>BUG: unable to 0

[  174.069000]  printing eip:
[  174.069000] 
[  174.069000] *pde = 1feb8067
[  174.069000] Oops:  [#1]
[  174.069000] SMP
[  174.069000] Modules linked in: nf_conntrack_netbios_ns ipt_REJECT 
nf_conntrack_ipv4d

[  174.069000] CPU:1
[  174.069000] EIP:0060:[<>]Not tainted VLI
[  174.069000] EFLAGS: 00010006   (2.6.21-rc5-git1 #1)
[  174.069000] EIP is at 0x0
[  174.069000] eax: 00a0   ebx: dfe99f98   ecx: c07bb000   edx: c074de00
[  174.069000] esi: 00a0   edi:    ebp:    esp: c07bbffc
[  174.069000] ds: 007b   es: 007b   fs: 00d8  gs: 0033  ss: 0068
[  174.069000] Process beagled-helper (pid: 3393, ti=c07bb000 
task=dfe28270 task.ti=df)

[  174.069000] Stack: c040704b
[  174.069000] Call Trace:
[  174.069000]  [] do_IRQ+0xac/0xd1
[  174.069000]  [] common_interrupt+0x2e/0x34
[  174.069000]  ===
[  174.069000] Code:  Bad EIP value.
[  174.069000] EIP: [<>] 0x0 SS:ESP 0068:c07bbffc
[  174.069000] Kernel panic - not syncing: Fatal exception in interrupt
[  174.069000] BUG: at arch/i386/kernel/smp.c:546 smp_call_function()
[  174.069000]  [] smp_call_function+0x5c/0xc8
[  174.069000]  [] do_unblank_screen+0x2a/0x120
[  174.069000]  [] smp_send_stop+0x1b/0x2e
[  174.069000]  [] panic+0x54/0xf2
[  174.069000]  [] die+0x1f8/0x22c
[  174.069000]  [] do_page_fault+0x40c/0x4df
[  174.069000]  [] do_page_fault+0x0/0x4df
[  174.069000]  [] error_code+0x7c/0x84
[  174.069000]  [] do_IRQ+0xac/0xd1
[  174.069000]  [] common_interrupt+0x2e/0x34
[  174.069000]  ===
[  174.069000]  at virtual address 
[  174.069000]  printing eip:
[  174.069000] 
[  174.069000] *pde = 20bd3067
[  174.069000] Oops:  [#2]
[  174.069000] SMP
[  174.069000] Modules linked in: nf_conntrack_netbios_ns ipt_REJECT 
nf_conntrack_ipv4d

[  174.069000] CPU:0
[  174.069000] EIP:0060:[<>]Not tainted VLI
[  174.069000] EFLAGS: 00010087   (2.6.21-rc5-git1 #1)
[  174.069000] EIP is at 0x0
[  174.069000] eax: 00a0   ebx: c0753f74   ecx: c07ba000   edx: c074de00
[  174.069000] esi: 00a0   edi:    ebp:    esp: c07baffc
[  174.069000] ds: 007b   es: 007b   fs: 00d8  gs:   ss: 0068
[  174.069000] Process swapper (pid: 0, ti=c07ba000 task=c07094c0 
task.ti=c0753000)

[  174.069000] Stack: c040704b
[  174.069000] Call Trace:
[  174.069000]  [] do_IRQ+0xac/0xd1
[  174.069000]  [] common_interrupt+0x2e/0x34
[  174.069000]  [] default_idle+0x3d/0x54
[  174.069000]  [] cpu_idle+0xa3/0xbc
[  174.069000]  [] start_kernel+0x45d/0x465
[  174.069000]  [] unknown_bootoption+0x0/0x202
[  174.069000]  ===
[  174.069000] Code:  Bad EIP value.
[  174.069000] EIP: [<>] 0x0 SS:ESP 0068:c07baffc
[  174.069000] Kernel panic - not syncing: Fatal exception in interrupt

Short hang, then spontaneous reboot.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: APIC error on 32-bit kernel

2007-04-09 Thread Jay Cliburn

Chuck Ebbert wrote:


Where is the text of the oops?


In one of the files on the website I referenced.  Here's the text...

[  173.584000] APIC error on CPU1: 08(08)
[  173.665000] APIC error on CPU0: 08(08)
[  173.665000] APIC error on CPU1: 08(08)
[  173.746000] APIC error on CPU0: 08(08)
[  173.746000] APIC error on CPU1: 08(08)
[  173.827000] APIC error on CPU0: 08(08)
[  173.827000] APIC error on CPU1: 08(08)
[  173.908000] APIC error on CPU0: 08(08)
[  173.908000] APIC error on CPU1: 08(08)
[  173.989000] APIC error on CPU0: 08(08)
[  173.989000] APIC error on CPU1: 08(08)

pinged my router somewhere along about here...

[  174.069000] BUG: unable to handle kernel NULL pointer 
dereference1BUG: unable to 0

[  174.069000]  printing eip:
[  174.069000] 
[  174.069000] *pde = 1feb8067
[  174.069000] Oops:  [#1]
[  174.069000] SMP
[  174.069000] Modules linked in: nf_conntrack_netbios_ns ipt_REJECT 
nf_conntrack_ipv4d

[  174.069000] CPU:1
[  174.069000] EIP:0060:[]Not tainted VLI
[  174.069000] EFLAGS: 00010006   (2.6.21-rc5-git1 #1)
[  174.069000] EIP is at 0x0
[  174.069000] eax: 00a0   ebx: dfe99f98   ecx: c07bb000   edx: c074de00
[  174.069000] esi: 00a0   edi:    ebp:    esp: c07bbffc
[  174.069000] ds: 007b   es: 007b   fs: 00d8  gs: 0033  ss: 0068
[  174.069000] Process beagled-helper (pid: 3393, ti=c07bb000 
task=dfe28270 task.ti=df)

[  174.069000] Stack: c040704b
[  174.069000] Call Trace:
[  174.069000]  [c040704b] do_IRQ+0xac/0xd1
[  174.069000]  [c040580e] common_interrupt+0x2e/0x34
[  174.069000]  ===
[  174.069000] Code:  Bad EIP value.
[  174.069000] EIP: [] 0x0 SS:ESP 0068:c07bbffc
[  174.069000] Kernel panic - not syncing: Fatal exception in interrupt
[  174.069000] BUG: at arch/i386/kernel/smp.c:546 smp_call_function()
[  174.069000]  [c0417b4f] smp_call_function+0x5c/0xc8
[  174.069000]  [c054052e] do_unblank_screen+0x2a/0x120
[  174.069000]  [c0417bd6] smp_send_stop+0x1b/0x2e
[  174.069000]  [c04271ca] panic+0x54/0xf2
[  174.069000]  [c04062c5] die+0x1f8/0x22c
[  174.069000]  [c0623d13] do_page_fault+0x40c/0x4df
[  174.069000]  [c0623907] do_page_fault+0x0/0x4df
[  174.069000]  [c0622574] error_code+0x7c/0x84
[  174.069000]  [c040704b] do_IRQ+0xac/0xd1
[  174.069000]  [c040580e] common_interrupt+0x2e/0x34
[  174.069000]  ===
[  174.069000]  at virtual address 
[  174.069000]  printing eip:
[  174.069000] 
[  174.069000] *pde = 20bd3067
[  174.069000] Oops:  [#2]
[  174.069000] SMP
[  174.069000] Modules linked in: nf_conntrack_netbios_ns ipt_REJECT 
nf_conntrack_ipv4d

[  174.069000] CPU:0
[  174.069000] EIP:0060:[]Not tainted VLI
[  174.069000] EFLAGS: 00010087   (2.6.21-rc5-git1 #1)
[  174.069000] EIP is at 0x0
[  174.069000] eax: 00a0   ebx: c0753f74   ecx: c07ba000   edx: c074de00
[  174.069000] esi: 00a0   edi:    ebp:    esp: c07baffc
[  174.069000] ds: 007b   es: 007b   fs: 00d8  gs:   ss: 0068
[  174.069000] Process swapper (pid: 0, ti=c07ba000 task=c07094c0 
task.ti=c0753000)

[  174.069000] Stack: c040704b
[  174.069000] Call Trace:
[  174.069000]  [c040704b] do_IRQ+0xac/0xd1
[  174.069000]  [c040580e] common_interrupt+0x2e/0x34
[  174.069000]  [c0403c74] default_idle+0x3d/0x54
[  174.069000]  [c040339b] cpu_idle+0xa3/0xbc
[  174.069000]  [c0758a37] start_kernel+0x45d/0x465
[  174.069000]  [c07581ae] unknown_bootoption+0x0/0x202
[  174.069000]  ===
[  174.069000] Code:  Bad EIP value.
[  174.069000] EIP: [] 0x0 SS:ESP 0068:c07baffc
[  174.069000] Kernel panic - not syncing: Fatal exception in interrupt

Short hang, then spontaneous reboot.


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


Re: APIC error on 32-bit kernel

2007-04-08 Thread Jay Cliburn
[Adding linux-kernel to the cc list, hoping for wider exposure.]

On Fri, 23 Mar 2007 20:08:17 -0500
Jay Cliburn <[EMAIL PROTECTED]> wrote:

> We're trying to track down the source of a problem that occurs
> whenever the atl1 network driver is activated on a 32-bit 2.6.21-rc4

and -rc5, -rc6, 2.6.20.x, 2.6.19.3, and probably others.

> We can load the driver just fine, but whenever we activate the
> network, we see APIC errors (a sample of them are shown here,
> captured from a serial console):
> 
> [EMAIL PROTECTED] ~]# echo 8 > /proc/sys/kernel/printk
> [EMAIL PROTECTED] ~]# [   93.942012] process `sysctl' is using deprecated
> sysctl (sysc.
> [   94.396609] atl1: eth0 link is up 1000 Mbps full duplex
> [   94.498887] APIC error on CPU0: 00(08)
> [   94.498534] APIC error on CPU1: 00(08)
> [   94.550079] APIC error on CPU0: 08(08)
> [   94.549725] APIC error on CPU1: 08(08)
> [   94.600915] APIC error on CPU1: 08(08)
> [   94.601276] APIC error on CPU0: 08(08)
> [   94.652108] APIC error on CPU1: 08(08)
> [   94.652470] APIC error on CPU0: 08(08)
> [   94.703659] APIC error on CPU0: 08(08)
> [   94.703305] APIC error on CPU1: 08(08)
> [   94.754852] APIC error on CPU0: 08(40)
> [   94.806045] APIC error on CPU0: 40(08)
> [   94.805692] APIC error on CPU1: 08(08)
> [   94.857238] APIC error on CPU0: 08(08)
> [   94.856884] APIC error on CPU1: 08(08)
> [   94.908432] APIC error on CPU0: 08(08)
> [   94.908078] APIC error on CPU1: 08(08)
> [snip, more of the same]
> [   98.901156] APIC error on CPU1: 08(08)
> [   98.952702] APIC error on CPU0: 08(08)
> [   98.952349] APIC error on CPU1: 08(08)
> [   99.003895] APIC error on CPU0: 08(08)
> [   99.003542] APIC error on CPU1: 08(08)
> 
> The machine hangs for about 5-10 seconds, then spontaneously reboots
> without further console output.

I can prompt an oops by pinging my router while the apic errors are
scrolling by.

> 
> This is an Asus M2V (Via K8T890) motherboard.
> 
> The problem does not occur on a 32-bit kernel if we boot with
> pci=nomsi, and it doesn't occur at all on a 64-bit kernel on the same
> motherboard.
> 
> We also do not see this problem on Intel-based motherboards, with
> either 32- or 64-bit kernels.

A full raft of documentation -- including acpidump and
linux-firmware-kit output, console capture, kernel config, lspci -vvxxx
(with apic=debug boot option), dmesg, and /proc/interrupts -- is
available at http://www.hogchain.net/m2v/apic-problem/

If this is a motherboard problem, that's fine; I'd just like to know
the details so I tell users something more than "it's a motherboard
problem."

Thanks,
Jay
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: APIC error on 32-bit kernel

2007-04-08 Thread Jay Cliburn
[Adding linux-kernel to the cc list, hoping for wider exposure.]

On Fri, 23 Mar 2007 20:08:17 -0500
Jay Cliburn [EMAIL PROTECTED] wrote:

 We're trying to track down the source of a problem that occurs
 whenever the atl1 network driver is activated on a 32-bit 2.6.21-rc4

and -rc5, -rc6, 2.6.20.x, 2.6.19.3, and probably others.

 We can load the driver just fine, but whenever we activate the
 network, we see APIC errors (a sample of them are shown here,
 captured from a serial console):
 
 [EMAIL PROTECTED] ~]# echo 8  /proc/sys/kernel/printk
 [EMAIL PROTECTED] ~]# [   93.942012] process `sysctl' is using deprecated
 sysctl (sysc.
 [   94.396609] atl1: eth0 link is up 1000 Mbps full duplex
 [   94.498887] APIC error on CPU0: 00(08)
 [   94.498534] APIC error on CPU1: 00(08)
 [   94.550079] APIC error on CPU0: 08(08)
 [   94.549725] APIC error on CPU1: 08(08)
 [   94.600915] APIC error on CPU1: 08(08)
 [   94.601276] APIC error on CPU0: 08(08)
 [   94.652108] APIC error on CPU1: 08(08)
 [   94.652470] APIC error on CPU0: 08(08)
 [   94.703659] APIC error on CPU0: 08(08)
 [   94.703305] APIC error on CPU1: 08(08)
 [   94.754852] APIC error on CPU0: 08(40)
 [   94.806045] APIC error on CPU0: 40(08)
 [   94.805692] APIC error on CPU1: 08(08)
 [   94.857238] APIC error on CPU0: 08(08)
 [   94.856884] APIC error on CPU1: 08(08)
 [   94.908432] APIC error on CPU0: 08(08)
 [   94.908078] APIC error on CPU1: 08(08)
 [snip, more of the same]
 [   98.901156] APIC error on CPU1: 08(08)
 [   98.952702] APIC error on CPU0: 08(08)
 [   98.952349] APIC error on CPU1: 08(08)
 [   99.003895] APIC error on CPU0: 08(08)
 [   99.003542] APIC error on CPU1: 08(08)
 
 The machine hangs for about 5-10 seconds, then spontaneously reboots
 without further console output.

I can prompt an oops by pinging my router while the apic errors are
scrolling by.

 
 This is an Asus M2V (Via K8T890) motherboard.
 
 The problem does not occur on a 32-bit kernel if we boot with
 pci=nomsi, and it doesn't occur at all on a 64-bit kernel on the same
 motherboard.
 
 We also do not see this problem on Intel-based motherboards, with
 either 32- or 64-bit kernels.

A full raft of documentation -- including acpidump and
linux-firmware-kit output, console capture, kernel config, lspci -vvxxx
(with apic=debug boot option), dmesg, and /proc/interrupts -- is
available at http://www.hogchain.net/m2v/apic-problem/

If this is a motherboard problem, that's fine; I'd just like to know
the details so I tell users something more than it's a motherboard
problem.

Thanks,
Jay
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   >