[2.6.23.y][PATCH] atl1: fix frame length bug
>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/
[PATCH 03/10] atl1: fix broken TSO
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, ¶m.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, ¶m); 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
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
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
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
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
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 10/10] atl1: reduce forward declarations
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
[PATCH 07/10] atl1: use netif_msg
Use netif_msg_* for console messages emitted by the driver. Add a parameter to allow control of messaging at driver startup, and also add the ability to control it with ethtool. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Acked-by: Chris Snook <[EMAIL PROTECTED]> --- drivers/net/atlx/atl1.c | 155 +-- drivers/net/atlx/atl1.h |2 +- 2 files changed, 111 insertions(+), 46 deletions(-) diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 9929822..51eca23 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c @@ -100,6 +100,13 @@ static const struct pci_device_id atl1_pci_tbl[] = { }; MODULE_DEVICE_TABLE(pci, atl1_pci_tbl); +static const u32 atl1_default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE | + NETIF_MSG_LINK | NETIF_MSG_TIMER | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP; + +static int debug = -1; +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "Message level (0=none,...,16=all)"); + /* * atl1_sw_init - Initialize general software structures (struct atl1_adapter) * @adapter: board private structure to initialize @@ -217,7 +224,9 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter) size = sizeof(struct atl1_buffer) * (tpd_ring->count + rfd_ring->count); tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL); if (unlikely(!tpd_ring->buffer_info)) { - dev_err(&pdev->dev, "kzalloc failed , size = D%d\n", size); + if (netif_msg_drv(adapter)) + dev_err(&pdev->dev, "kzalloc failed , size = D%d\n", + size); goto err_nomem; } rfd_ring->buffer_info = @@ -239,7 +248,8 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter) ring_header->desc = pci_alloc_consistent(pdev, ring_header->size, &ring_header->dma); if (unlikely(!ring_header->desc)) { - dev_err(&pdev->dev, "pci_alloc_consistent failed\n"); + if (netif_msg_drv(adapter)) + dev_err(&pdev->dev, "pci_alloc_consistent failed\n"); goto err_nomem; } @@ -472,7 +482,8 @@ static u32 atl1_check_link(struct atl1_adapter *adapter) /* link down */ if (netif_carrier_ok(netdev)) { /* old link state: Up */ - dev_info(&adapter->pdev->dev, "link is down\n"); + if (netif_msg_link(adapter)) + dev_info(&adapter->pdev->dev, "link is down\n"); adapter->link_speed = SPEED_0; netif_carrier_off(netdev); netif_stop_queue(netdev); @@ -515,11 +526,12 @@ static u32 atl1_check_link(struct atl1_adapter *adapter) adapter->link_speed = speed; adapter->link_duplex = duplex; atl1_setup_mac_ctrl(adapter); - dev_info(&adapter->pdev->dev, - "%s link is up %d Mbps %s\n", - netdev->name, adapter->link_speed, - adapter->link_duplex == FULL_DUPLEX ? - "full duplex" : "half duplex"); + if (netif_msg_link(adapter)) + dev_info(&adapter->pdev->dev, + "%s link is up %d Mbps %s\n", + netdev->name, adapter->link_speed, + adapter->link_duplex == FULL_DUPLEX ? + "full duplex" : "half duplex"); } if (!netif_carrier_ok(netdev)) { /* Link down -> Up */ @@ -583,7 +595,8 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu) if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || (max_frame > MAX_JUMBO_FRAME_SIZE)) { - dev_warn(&adapter->pdev->dev, "invalid MTU setting\n"); + if (netif_msg_link(adapter)) + dev_warn(&adapter->pdev->dev, "invalid MTU setting\n"); return -EINVAL; } @@ -997,8 +1010,9 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter, if (rrd->err_flg & (ERR_FLAG_CRC | ERR_FLAG_TRUNC | ERR_FLAG_CODE | ERR_FLAG_OV)) { adapter->hw_csum_err++; - dev_printk(KERN_DEBUG, &pdev->dev, - "rx checksum error\n"); +
[PATCH 09/10] atl1: make functions static
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. * */ -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)) +
[PATCH 00/10] atl1: move to atlx and update for 2.6.25
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/
Re: MM kernels 2.6.24-rc*-mm*, 2.6.24-mm1: gnome-terminal stuck in tty_poll
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: Allow (O=...) from file
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
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: [PATCH 09/26] atl1: refactor tx processing
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
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
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 25/26] [REVISED] atl1: add NAPI support
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) +
Allow (O=...) from file
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/
Re: Allow (O=...) from file
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/
[2.6.22.y][PATCH] atl1: disable broken 64-bit DMA
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 0/5] atl1: additional patches for 2.6.23
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
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
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
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
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 = &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
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] atl1: use spin_trylock_irqsave()
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/
Re: [PATCH] Add suport for Marvell 88SE6121 in pata_marvell
Jose Alberto Reguero wrote: Marvell 88SE6121 [snip] --- linux-2.6.20-rc3/drivers/ata/pata_marvell.c 2007-01-01 01:53:20.0 +0100 +++ linux-2.6.20-rc3.new/drivers/ata/pata_marvell.c 2007-01-06 12:33:03.0 +0100 @@ -49,7 +49,7 @@ [snip] Works-for-me: Jay Cliburn <[EMAIL PROTECTED]> The following dmesg snippet after applying the patch shows life from the hitherto unsupported device: (I connected an unpartitioned SATA HDD to it.) == [ 39.789326] PCI: Setting latency timer of device :06:00.0 to 64 [ 39.789436] ata3: PATA max UDMA/100 cmd 0xEC00 ctl 0xE882 bmdma 0xE400 irq 28 [ 39.789541] ata4: PATA max UDMA/133 cmd 0xE800 ctl 0xE482 bmdma 0xE408 irq 28 [ 39.789559] scsi2 : pata_marvell [ 39.790121] BAR5:00:02 01:7F 02:22 03:CA 04:00 05:00 06:00 07:00 08:00 09:00 0A:00 0B:00 0C:07 0D:00 0E:00 0F:00 [ 39.790152] ata3: port disabled. ignoring. [ 39.790154] ata3: reset failed, giving up [ 39.790161] scsi3 : pata_marvell [ 39.790589] BAR5:00:02 01:7F 02:22 03:CA 04:00 05:00 06:00 07:00 08:00 09:00 0A:00 0B:00 0C:07 0D:00 0E:00 0F:00 [ 39.958055] ATA: abnormal status 0x7F on port 0xE807 [ 39.968869] ATA: abnormal status 0x7F on port 0xE807 [ 39.979450] ata4.00: ATA-7, max UDMA/133, 488397168 sectors: LBA48 [ 39.979453] ata4.00: ata4: dev 0 multi count 16 [ 39.987443] ata4.00: configured for UDMA/133 [ 39.987628] scsi 3:0:0:0: Direct-Access ATA WDC WD2500KS-00M 02.0 PQ: 0 ANSI: 5 [ 39.988524] SCSI device sdb: 488397168 512-byte hdwr sectors (250059 MB) [ 39.988546] sdb: Write Protect is off [ 39.988548] sdb: Mode Sense: 00 3a 00 00 [ 39.988583] SCSI device sdb: write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 39.988695] SCSI device sdb: 488397168 512-byte hdwr sectors (250059 MB) [ 39.988713] sdb: Write Protect is off [ 39.988715] sdb: Mode Sense: 00 3a 00 00 [ 39.988749] SCSI device sdb: write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 39.988781] sdb: unknown partition table [ 39.994867] sd 3:0:0:0: Attached scsi disk sdb [ 39.994990] sd 3:0:0:0: Attached scsi generic sg1 type 0 This is the relevant portion of lspci: == 06:00.0 SATA controller: Marvell Technology Group Ltd. Unknown device 6121 (rev b0) (prog-if 8f) Subsystem: ASUSTeK Computer Inc. Unknown device 8212 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- Latency: 0, Cache Line Size: 64 bytes Interrupt: pin A routed to IRQ 28 Region 0: I/O ports at ec00 [size=8] Region 1: I/O ports at e880 [size=4] Region 2: I/O ports at e800 [size=8] Region 3: I/O ports at e480 [size=4] Region 4: I/O ports at e400 [size=16] Region 5: Memory at fbeffc00 (32-bit, non-prefetchable) [size=1K] Capabilities: [48] Power Management version 2 Flags: PMEClk- DSI- D1+ D2- AuxCurrent=0mA PME(D0+,D1+,D2-,D3hot+,D3cold-) Status: D0 PME-Enable- DSel=0 DScale=1 PME- Capabilities: [50] Message Signalled Interrupts: 64bit- Queue=0/0 Enable - Address: Data: Capabilities: [e0] Express Legacy Endpoint IRQ 0 Device: Supported: MaxPayload 128 bytes, PhantFunc 0, ExtTag- Device: Latency L0s unlimited, L1 unlimited Device: AtnBtn- AtnInd- PwrInd- Device: Errors: Correctable- Non-Fatal- Fatal- Unsupported- Device: RlxdOrd- ExtTag- PhantFunc- AuxPwr+ NoSnoop- Device: MaxPayload 128 bytes, MaxReadReq 512 bytes Link: Supported Speed 2.5Gb/s, Width x1, ASPM L0s, Port 1 Link: Latency L0s <256ns, L1 unlimited Link: ASPM Disabled RCB 64 bytes CommClk- ExtSynch- Link: Speed 2.5Gb/s, Width x1 00: ab 11 21 61 07 01 10 00 b0 8f 06 01 10 00 00 00 10: 01 ec 00 00 81 e8 00 00 01 e8 00 00 81 e4 00 00 20: 01 e4 00 00 00 fc ef fb 00 00 00 00 43 10 12 82 30: 00 00 00 00 48 00 00 00 00 00 00 00 0b 01 00 00 40: 24 c9 c0 00 1f 80 00 00 01 50 02 5a 00 20 00 13 50: 05 e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60: 58 c4 21 40 b0 00 00 00 00 00 00 00 00 00 00 00 70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e0: 10 00 11 00 c0 0f 18 00 00 24 08 00 11 a4 03 01 f0: 00 00 11 10 00 00 00 00 00 00 00 00 00 00 00 00 - To unsubscribe from this list: send the line "unsubscribe lin
Re: [PATCH 2/4] atl1: Header files for Attansic L1 driver
Christoph Hellwig wrote: On Wed, Jan 10, 2007 at 06:41:37PM -0600, Jay Cliburn wrote: +struct csum_param { + unsigned buf_len:14; + unsigned dma_int:1; + unsigned pkt_int:1; + u16 valan_tag; + unsigned eop:1; + /* command */ + unsigned coalese:1; + unsigned ins_vlag:1; + unsigned custom_chksum:1; + unsigned segment:1; + unsigned ip_chksum:1; + unsigned tcp_chksum:1; + unsigned udp_chksum:1; + /* packet state */ + unsigned vlan_tagged:1; + unsigned eth_type:1; + unsigned iphl:4; + unsigned:2; + unsigned payload_offset:8; + unsigned xsum_offset:8; +} _ATL1_ATTRIB_PACK_; Bitfields should not be used for hardware datastructures ever. Please convert this to explicit masking and shifting. +/* formerly ATL1_WRITE_REG */ +static inline void atl1_write32(const struct atl1_hw *hw, int reg, u32 val) +{ +writel(val, hw->hw_addr + reg); +} + +/* formerly ATL1_READ_REG */ +static inline u32 atl1_read32(const struct atl1_hw *hw, int reg) +{ +return readl(hw->hw_addr + reg); +} Just kill all these wrappers. Also you probably want to convert to pci_iomap + ioread*/iowrite*. Christoph et al., I've incorporated all your comments except the two shown above. I killed the indicated atl1_write*/atl1_read* wrappers, but I'm not yet familiar enough with pci_iomap/iowrite*/ioread* to make that particular conversion, and I'm having trouble getting the bitfield struct converted to shift/mask semantics (No matter how hard I try, I keep breaking the transmit side of the adapter). I'd like to plead for relief on these two items and submit a new version of the driver containing all your other comments. I need help from a more experienced netdev hacker, and in my mind, the best way to do that is to get the driver in the kernel so more people can use it and contribute changes and make improvements. I welcome any comments on the rationality of this approach. 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 2/4] atl1: Header files for Attansic L1 driver
Francois Romieu wrote: Jay Cliburn <[EMAIL PROTECTED]> : [...] I welcome any comments on the rationality of this approach. An URL for the current version of the patch would be welcome too :o) Sorry. Forgot to do that. The current version may be found here: ftp://hogchain.net/pub/linux/m2v/attansic/kernel_driver/atl1-2.0.4/atl1-2.0.4-linux-2.6.20.rc5.patch.bz2 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 0/4] atl1: Attansic L1 ethernet driver
This is the latest submittal of the patchset providing support for the Attansic L1 gigabit ethernet adapter. This patchset is built against kernel version 2.6.20-rc5. This version incorporates all comments from: Christoph Hellwig: http://lkml.org/lkml/2007/1/11/43 http://lkml.org/lkml/2007/1/11/45 http://lkml.org/lkml/2007/1/11/48 http://lkml.org/lkml/2007/1/11/49 Jeff Garzik: http://lkml.org/lkml/2007/1/18/233 Many thanks to both for reviewing the driver. The monolithic version of this patchset may be found at: ftp://hogchain.net/pub/linux/attansic/kernel_driver/atl1-2.0.5-linux-2.6.20.rc5.patch.bz2 As a reminder, this driver is a modified version of the Attansic reference driver for the L1 ethernet adapter. Attansic has granted permission for its inclusion in the mainline kernel. This patchset contains: drivers/net/Kconfig | 11 + drivers/net/Makefile|1 + drivers/net/atl1/Makefile |2 + drivers/net/atl1/atl1.h | 288 + drivers/net/atl1/atl1_ethtool.c | 436 +++ drivers/net/atl1/atl1_hw.c | 728 drivers/net/atl1/atl1_hw.h | 965 +++ drivers/net/atl1/atl1_main.c| 2490 drivers/net/atl1/atl1_param.c | 223 9 files changed, 5144 insertions(+), 0 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/4] atl1: Build files for Attansic L1 driver
From: Jay Cliburn <[EMAIL PROTECTED]> From: Chris Snook <[EMAIL PROTECTED]> This patch contains the build files for the Attansic L1 gigabit ethernet adapter driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- Kconfig | 11 +++ Makefile |1 + atl1/Makefile |2 ++ 3 files changed, 14 insertions(+) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 8aa8dd0..0bb3c1e 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2348,6 +2348,17 @@ config QLA3XXX To compile this driver as a module, choose M here: the module will be called qla3xxx. +config ATL1 + tristate "Attansic L1 Gigabit Ethernet support (EXPERIMENTAL)" + depends on NET_PCI && PCI && EXPERIMENTAL + select CRC32 + select MII + help + This driver supports the Attansic L1 gigabit ethernet adapter. + + To compile this driver as a module, choose M here. The module + will be called atl1. + endmenu # diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 4c0d4e5..d0beced 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_IXGB) += ixgb/ obj-$(CONFIG_CHELSIO_T1) += chelsio/ obj-$(CONFIG_EHEA) += ehea/ obj-$(CONFIG_BONDING) += bonding/ +obj-$(CONFIG_ATL1) += atl1/ obj-$(CONFIG_GIANFAR) += gianfar_driver.o gianfar_driver-objs := gianfar.o \ diff --git a/drivers/net/atl1/Makefile b/drivers/net/atl1/Makefile new file mode 100644 index 000..a6b707e --- /dev/null +++ b/drivers/net/atl1/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_ATL1) += atl1.o +atl1-y += atl1_main.o atl1_hw.o atl1_ethtool.o atl1_param.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/
[PATCH 2/4] atl1: Header files for Attansic L1 driver
From: Jay Cliburn <[EMAIL PROTECTED]> From: Chris Snook <[EMAIL PROTECTED]> This patch contains the header files needed by the Attansic L1 gigabit ethernet adapter driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- atl1.h| 288 ++ atl1_hw.h | 965 ++ 2 files changed, 1253 insertions(+) diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h new file mode 100644 index 000..1d13e8f --- /dev/null +++ b/drivers/net/atl1/atl1.h @@ -0,0 +1,288 @@ +/** + * 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. + **/ + +#ifndef _ATL1_H_ +#define _ATL1_H_ + +#include +#include +#include + +#include "atl1_hw.h" + +/* function prototypes needed by multiple files */ +s32 atl1_up(struct atl1_adapter *adapter); +void atl1_down(struct atl1_adapter *adapter); +int atl1_reset(struct atl1_adapter *adapter); +s32 atl1_setup_ring_resources(struct atl1_adapter *adapter); +void atl1_free_ring_resources(struct atl1_adapter *adapter); + +struct atl1_adapter; + +#define ATL1_MAX_INTR 3 + +#define ATL1_DEFAULT_TPD 256 +#define ATL1_MAX_TPD 1023 +#define ATL1_MIN_TPD 64 +#define ATL1_DEFAULT_RFD 512 +#define ATL1_MIN_RFD 128 +#define ATL1_MAX_RFD 2047 + +#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) +#define ATL1_TPD_DESC(R, i)ATL1_GET_DESC(R, i, struct tx_packet_desc) +#define ATL1_RRD_DESC(R, i)ATL1_GET_DESC(R, i, struct rx_return_desc) + +/** + * 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. + **/ + +/** + * wrapper around a pointer to a socket buffer, + * so a DMA handle can be stored along with the buffer + **/ +struct atl1_buffer { + struct sk_buff *skb; + u16 length; + u16 alloced; + dma_addr_t dma; +}; + +#define MAX_TX_BUF_LEN 0x3000 /* 12KB */ + +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 */ + u16 count; /* number of descriptors in the ring */ + + u16 hw_idx; /* hardware index */ + atomic_t next_to_clean; + atomic_t next_to_use; + struct atl1_buffer *buffer_info; +}; + +struct atl1_rfd_ring { + void *desc; + dma_addr_t dma; + u16 size; + u16 count; + atomic_t next_to_use; + u16 next_to_clean; + struct atl1_buffer *buffer_info; +}; + +struct atl1_rrd_ring { + void *desc; + dma_addr_t dma; + unsigned int size; + u16 count; + u16 next_to_use; + atomic_t next_to_clean; +}; + +struct atl1_ring_header { + /* pointer to the descriptor ring memory */ + void *desc; + /* physical adress of the descriptor ring */ + dma_addr_t dma; + /* length of descriptor ring in bytes */ + unsigned int size; +}; + +struct atl1_cmb { + struct coals_msg_block *cmb; + dma_addr_t dma; +}; + +struct atl1_smb { + struct stats_msg_block *smb; + dma_addr_t dma; +}; + +/* Statistics counters */ +struct atl1_sft_stats { + u64 rx_packets; + u64 tx_packets; + u64 rx_bytes; + u64 tx_bytes; + u64 multicast; + u64 collisions; + u64 rx_errors; + u64 rx_length_errors; + u64 rx_crc_errors; + u64 rx_frame_errors; + u64 rx_fifo_errors; + u64 rx_missed_errors; + u64 tx_errors; +
[PATCH 4/4] atl1: Ancillary C files for Attansic L1 driver
From: Jay Cliburn <[EMAIL PROTECTED]> From: Chris Snook <[EMAIL PROTECTED]> This patch contains auxiliary C files for the Attansic L1 gigabit ethernet adapter driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- atl1_ethtool.c | 436 ++ atl1_hw.c | 728 + atl1_param.c | 223 + 3 files changed, 1387 insertions(+) diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c new file mode 100644 index 000..4c6e505 --- /dev/null +++ b/drivers/net/atl1/atl1_ethtool.c @@ -0,0 +1,436 @@ +/** + * 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. + **/ + +#include +#include +#include +#include +#include +#include + +#include "atl1.h" + + +extern char atl1_driver_name[]; +extern char atl1_driver_version[]; + +struct atl1_stats { + char stat_string[ETH_GSTRING_LEN]; + int sizeof_stat; + int stat_offset; +}; + +#define ATL1_STAT(m) sizeof(((struct atl1_adapter *)0)->m), \ + offsetof(struct atl1_adapter, m) + +static struct atl1_stats atl1_gstrings_stats[] = { + {"rx_packets", ATL1_STAT(soft_stats.rx_packets)}, + {"tx_packets", ATL1_STAT(soft_stats.tx_packets)}, + {"rx_bytes", ATL1_STAT(soft_stats.rx_bytes)}, + {"tx_bytes", ATL1_STAT(soft_stats.tx_bytes)}, + {"rx_errors", ATL1_STAT(soft_stats.rx_errors)}, + {"tx_errors", ATL1_STAT(soft_stats.tx_errors)}, + {"rx_dropped", ATL1_STAT(net_stats.rx_dropped)}, + {"tx_dropped", ATL1_STAT(net_stats.tx_dropped)}, + {"multicast", ATL1_STAT(soft_stats.multicast)}, + {"collisions", ATL1_STAT(soft_stats.collisions)}, + {"rx_length_errors", ATL1_STAT(soft_stats.rx_length_errors)}, + {"rx_over_errors", ATL1_STAT(soft_stats.rx_missed_errors)}, + {"rx_crc_errors", ATL1_STAT(soft_stats.rx_crc_errors)}, + {"rx_frame_errors", ATL1_STAT(soft_stats.rx_frame_errors)}, + {"rx_fifo_errors", ATL1_STAT(soft_stats.rx_fifo_errors)}, + {"rx_missed_errors", ATL1_STAT(soft_stats.rx_missed_errors)}, + {"tx_aborted_errors", ATL1_STAT(soft_stats.tx_aborted_errors)}, + {"tx_carrier_errors", ATL1_STAT(soft_stats.tx_carrier_errors)}, + {"tx_fifo_errors", ATL1_STAT(soft_stats.tx_fifo_errors)}, + {"tx_window_errors", ATL1_STAT(soft_stats.tx_window_errors)}, + {"tx_abort_exce_coll", ATL1_STAT(soft_stats.excecol)}, + {"tx_abort_late_coll", ATL1_STAT(soft_stats.latecol)}, + {"tx_deferred_ok", ATL1_STAT(soft_stats.deffer)}, + {"tx_single_coll_ok", ATL1_STAT(soft_stats.scc)}, + {"tx_multi_coll_ok", ATL1_STAT(soft_stats.mcc)}, + {"tx_underun", ATL1_STAT(soft_stats.tx_underun)}, + {"tx_trunc", ATL1_STAT(soft_stats.tx_trunc)}, + {"tx_pause", ATL1_STAT(soft_stats.tx_pause)}, + {"rx_pause", ATL1_STAT(soft_stats.rx_pause)}, + {"rx_rrd_ov", ATL1_STAT(soft_stats.rx_rrd_ov)}, + {"rx_trunc", ATL1_STAT(soft_stats.rx_trunc)} +}; + +static void atl1_get_ethtool_stats(struct net_device *netdev, + struct ethtool_stats *stats, u64 *data) +{ + struct atl1_adapter *adapter = netdev_priv(netdev); + int i; + char *p; + + for (i = 0; i < ARRAY_SIZE(atl1_gstrings_stats); i++) { + p = (char *)adapter+atl1_gstrings_stats[i].stat_offset; + data[i] = (atl1_gstrings_stats[i].sizeof_stat == + sizeof(u64)) ? *(u64 *)p : *(u32 *)p; + } + +} + +static int atl1_get_stats_count(struct net_dev
Re: [PATCH 4/4] atl1: Ancillary C files for Attansic L1 driver
Randy Dunlap wrote: On Sun, 21 Jan 2007 15:07:37 -0600 Jay Cliburn wrote: [snip] + value = ioread16(hw->hw_addr + REG_PCIE_CAP_LIST); + return ((value & 0xFF00) == 0x6C00) ? 0 : 1; Are there defines or enums for these? Fewer magic numbers would be nice/helpful/readable. [snip] + s32 ret; + ret = atl1_write_phy_reg(hw, 29, 0x0029); Fewer magic numbers? Unfortunately, we don't have a spec. This is how the vendor coded it. [snip] + +int enable_msi; +module_param(enable_msi, int, 0444); +MODULE_PARM_DESC(enable_msi, "Enable PCI MSI"); Hm, I thought that we didn't want individual drivers having MSI config options... Luca? This one was yours IIRC. Care to chime in? Randy, thank you for the review. 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 3/4] atl1: Main C file for Attansic L1 driver
Arjan, thank you very much for reviewing the driver. Arjan van de Ven wrote: On Sun, 2007-01-21 at 15:06 -0600, Jay Cliburn wrote: [snip] +void atl1_irq_disable(struct atl1_adapter *adapter) +{ + atomic_inc(&adapter->irq_sem); + iowrite32(0, adapter->hw.hw_addr + REG_IMR); + synchronize_irq(adapter->pdev->irq); +} doesn't this want a PCI posting flush? I'm also a bit sceptical about irq_sem ... PCI posting flush will be added. Would you mind elaborating on your skepticism about irq_sem? +/** + * When ACPI resume on some VIA MotherBoard, the Interrupt Disable bit/0x400 + * on PCI Command register is disable. + * The function enable this bit. + * Brackett, 2006/03/15 + */ +static void atl1_via_workaround(struct atl1_adapter *adapter) +{ + unsigned long value; + + value = ioread16(adapter->hw.hw_addr + PCI_COMMAND); + if (value & PCI_COMMAND_INTX_DISABLE) + value &= ~PCI_COMMAND_INTX_DISABLE; + iowrite32(value, adapter->hw.hw_addr + PCI_COMMAND); +} hmm I wonder if this shouldn't be a more generic PCI level quirk, not so much a driver level quirk... The vendor put this code here, and we're loathe to remove it unless absolutely necessary. Is it okay with you if we leave it? 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 0/4] atl1: Attansic L1 ethernet driver
Jeff Garzik wrote: OK, I have merged the monolithic patch into jgarzik/netdev-2.6.git#atl1. Once I'm done merging patches tonight, I will merge this new 'atl1' branch into the 'ALL' meta-branch, which will auto-propagate this driver into Andrew Morton's -mm for testing. For future driver updates, please send a patch rather than the full driver diff. Perhaps a dumb question, but when can I begin submitting differential patches? Now? I'd like to incorporate some of Arjan's and Randy's comments. Thank you very much for accepting the driver. 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: [RFC: -mm patch] drivers/net/atl1/: possible cleanups
On Tue, 6 Feb 2007 23:12:29 +0100 Adrian Bunk <[EMAIL PROTECTED]> wrote: > On Mon, Jan 29, 2007 at 08:45:28PM -0800, Andrew Morton wrote: > >... > > Changes since 2.6.20-rc6-mm2: > >... > > git-netdev-all.patch > >... > > git trees > >... > > > This patch contains the following possible cleanups: > - move extern declarations to atl1.h > - make needlessly global code static Adrian, The atl1 driver currently follows this development pathway: developer -> netdev#atl1 -> netdev#ALL -> -mm Your patch is just a little bit out ahead of us. Some of your suggested changes are already in the pipeline; we're just waiting for Jeff to merge netdev#atl1 into netdev#ALL. Should be soon. > > Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> > > --- > > BTW: Can we get a MAINTAINERS entry for this driver? Already submitted to netdev#atl1. http://lkml.org/lkml/2007/2/3/174 > > drivers/net/atl1/atl1.h |6 -- > drivers/net/atl1/atl1_ethtool.c |3 --- > drivers/net/atl1/atl1_hw.c |6 ++ > drivers/net/atl1/atl1_main.c|8 +++- > drivers/net/atl1/atl1_param.c |4 +--- > 5 files changed, 10 insertions(+), 17 deletions(-) > > --- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1.h.old > 2007-02-06 07:55:58.0 +0100 +++ > linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1.h 2007-02-06 > 08:19:50.0 +0100 @@ -34,8 +34,10 @@ s32 atl1_up(struct > atl1_adapter *adapter); void atl1_down(struct atl1_adapter *adapter); > int atl1_reset(struct atl1_adapter *adapter); > -s32 atl1_setup_ring_resources(struct atl1_adapter *adapter); > -void atl1_free_ring_resources(struct atl1_adapter *adapter); > + > +extern char atl1_driver_name[]; > +extern char atl1_driver_version[]; netdev#atl1 already has this change. The rest of these I'll bundle up and submit to netdev#atl1, too. Will that work for you? > +extern const struct ethtool_ops atl1_ethtool_ops; > > struct atl1_adapter; > > --- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_hw.c.old > 2007-02-06 07:52:20.0 +0100 +++ > linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_hw.c 2007-02-06 > 07:56:22.0 +0100 @@ -31,8 +31,6 @@ #include "atl1.h" > > > -extern char atl1_driver_name[]; > - > /** > * Reset the transmit and receive units; mask and clear all > interrupts. > * hw - Struct containing variables accessed by shared code > @@ -209,7 +207,7 @@ > * get_permanent_address > * return 0 if get valid mac address, > **/ > -int atl1_get_permanent_address(struct atl1_hw *hw) > +static int atl1_get_permanent_address(struct atl1_hw *hw) > { > u32 addr[2]; > u32 i, control; > @@ -602,7 +600,7 @@ > return ret_val; > } > > -struct atl1_spi_flash_dev flash_table[] = { > +static struct atl1_spi_flash_dev flash_table[] = { > /* MFR_NAME WRSR READ PRGM WREN WRDI RDSR RDID > SECTOR_ERASE CHIP_ERASE */ {"Atmel", 0x00, 0x03, 0x02, 0x06, 0x04, > 0x05, 0x15, 0x52,0x62}, {"SST", 0x01, 0x03, 0x02, 0x06, > 0x04, 0x05, 0x90, 0x20,0x60}, --- > linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_ethtool.c.old > 2007-02-06 07:57:04.0 +0100 +++ > linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_ethtool.c > 2007-02-06 07:57:10.0 +0100 @@ -31,9 +31,6 @@ #include > "atl1.h" > -extern char atl1_driver_name[]; > -extern char atl1_driver_version[]; > - > struct atl1_stats { > char stat_string[ETH_GSTRING_LEN]; > int sizeof_stat; > --- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_param.c.old > 2007-02-06 07:57:18.0 +0100 +++ > linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_param.c2007-02-06 > 08:16:39.0 +0100 @@ -26,8 +26,6 @@ #include > #include "atl1.h" > > -extern char atl1_driver_name[]; > - > /** > * This is the only thing that needs to be changed to adjust the > * maximum number of ports that the driver can manage. > @@ -68,7 +66,7 @@ > module_param_array_named(flash_vendor, flash_vendor, int, > &num_flash_vendor, 0); MODULE_PARM_DESC(flash_vendor, "SPI flash > vendor"); > -int enable_msi; > +static int enable_msi; > module_param(enable_msi, int, 0444); > MODULE_PARM_DESC(enable_msi, "Enable PCI MSI"); > > --- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c.old > 2007-02-06 07:58:37.0 +0100 +++ > linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c 2007-02-06 > 08:15:51.0 +0100 @@ -95,8 +95,6 @@ MODULE_LICENSE("GPL"); > MODULE_VERSION(DRIVER_VERSION); > > -extern struct ethtool_ops atl1_ethtool_ops; > - > /** > * atl1_pci_tbl - PCI Device ID Table > **/ > @@ -178,7 +176,7 @@ > * > * 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; > @@ -1221,7 +1219,7 @@ > * atl1_irq_disable - Mask off interrupt generation on the NIC > * @adapter: board priv
[PATCH netdev#atl1 1/1] atl1: clean up extern, global scope declarations
From: Jay Cliburn <[EMAIL PROTECTED]> atl1: move extern to header file; make some global code static Move an extern declaration to a header file. Make needlessly global functions static. Noticed by Adrian Bunk. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1.h |1 + drivers/net/atl1/atl1_ethtool.c |2 +- drivers/net/atl1/atl1_hw.c |4 ++-- drivers/net/atl1/atl1_main.c|4 +--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h index 3ff978b..b1c6034 100644 --- a/drivers/net/atl1/atl1.h +++ b/drivers/net/atl1/atl1.h @@ -38,6 +38,7 @@ void atl1_free_ring_resources(struct atl1_adapter *adapter); extern char atl1_driver_name[]; extern char atl1_driver_version[]; +extern const struct ethtool_ops atl1_ethtool_ops; struct atl1_adapter; diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c index 01c2348..c11c277 100644 --- a/drivers/net/atl1/atl1_ethtool.c +++ b/drivers/net/atl1/atl1_ethtool.c @@ -318,7 +318,7 @@ static void atl1_get_ringparam(struct net_device *netdev, ring->rx_jumbo_pending = 0; } -static int atl1_set_ringparam (struct net_device *netdev, +static int atl1_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) { struct atl1_adapter *adapter = netdev_priv(netdev); diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c index a5e92e7..08b2d78 100644 --- a/drivers/net/atl1/atl1_hw.c +++ b/drivers/net/atl1/atl1_hw.c @@ -206,7 +206,7 @@ static bool atl1_spi_read(struct atl1_hw *hw, u32 addr, u32 *buf) * get_permanent_address * return 0 if get valid mac address, */ -int atl1_get_permanent_address(struct atl1_hw *hw) +static int atl1_get_permanent_address(struct atl1_hw *hw) { u32 addr[2]; u32 i, control; @@ -592,7 +592,7 @@ static s32 atl1_setup_link(struct atl1_hw *hw) return ret_val; } -struct atl1_spi_flash_dev flash_table[] = { +static struct atl1_spi_flash_dev flash_table[] = { /* MFR_NAME WRSR READ PRGM WREN WRDI RDSR RDID SECTOR_ERASE CHIP_ERASE */ {"Atmel", 0x00, 0x03, 0x02, 0x06, 0x04, 0x05, 0x15, 0x52,0x62}, {"SST", 0x01, 0x03, 0x02, 0x06, 0x04, 0x05, 0x90, 0x20,0x60}, diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 9a3fb86..6655640 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -96,8 +96,6 @@ MODULE_DESCRIPTION("Attansic 1000M Ethernet Network Driver"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRIVER_VERSION); -extern struct ethtool_ops atl1_ethtool_ops; - /* * atl1_pci_tbl - PCI Device ID Table */ @@ -1205,7 +1203,7 @@ static u32 atl1_configure(struct atl1_adapter *adapter) * atl1_irq_disable - Mask off interrupt generation on the NIC * @adapter: board private structure */ -void atl1_irq_disable(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); - 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/6] atl1: bugfix, cleanup, enhancement
Jeff, Please accept the following patchset for the atl1 network device driver. * Drop unnecessary NET_PCI config * Fix incorrect hash table address * Read MAC address from register * Remove unused define * Add Attansic L1 device id to pci_ids * Bump version number This patchset contains changes to the following files. drivers/net/Kconfig |2 +- drivers/net/atl1/atl1_hw.c | 37 + drivers/net/atl1/atl1_main.c |5 ++--- include/linux/pci_ids.h |1 + 4 files changed, 25 insertions(+), 20 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/6] atl1: drop NET_PCI from Kconfig
From: Jay Cliburn <[EMAIL PROTECTED]> The atl1 driver doesn't need NET_PCI. Remove it from Kconfig. Noticed by Chad Sprouse. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- drivers/net/Kconfig |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 0bb3c1e..1b624b4 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2350,7 +2350,7 @@ config QLA3XXX config ATL1 tristate "Attansic L1 Gigabit Ethernet support (EXPERIMENTAL)" - depends on NET_PCI && PCI && EXPERIMENTAL + depends on PCI && EXPERIMENTAL select CRC32 select MII help - 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/6] atl1: fix bad ioread address
From: Al Viro <[EMAIL PROTECTED]> An ioread32 statement reads the wrong address. Fix it. Signed-off-by: Al Viro <[EMAIL PROTECTED]> Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_hw.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c index 08b2d78..e28707a 100644 --- a/drivers/net/atl1/atl1_hw.c +++ b/drivers/net/atl1/atl1_hw.c @@ -357,7 +357,7 @@ void atl1_hash_set(struct atl1_hw *hw, u32 hash_value) */ hash_reg = (hash_value >> 31) & 0x1; hash_bit = (hash_value >> 26) & 0x1F; - mta = ioread32((hw + REG_RX_HASH_TABLE) + (hash_reg << 2)); + mta = ioread32((hw->hw_addr + REG_RX_HASH_TABLE) + (hash_reg << 2)); mta |= (1 << hash_bit); iowrite32(mta, (hw->hw_addr + REG_RX_HASH_TABLE) + (hash_reg << 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/6] atl1: read MAC address from register
From: Jay Cliburn <[EMAIL PROTECTED]> On some Asus motherboards containing the L1 NIC, the MAC address is written by the BIOS directly to the MAC register during POST, and is not stored in eeprom. If we don't succeed in fetching the MAC address from eeprom or spi, try reading it directly from the MAC register. Suggested by Xiong Huang. And do some cleanup while we've got the hood up... Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_hw.c | 35 --- 1 files changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c index e28707a..314dbaa 100644 --- a/drivers/net/atl1/atl1_hw.c +++ b/drivers/net/atl1/atl1_hw.c @@ -243,14 +243,8 @@ static int atl1_get_permanent_address(struct atl1_hw *hw) i += 4; } -/* - * The following 2 lines are the Attansic originals. Saving for posterity. - * *(u32 *) & eth_addr[2] = LONGSWAP(addr[0]); - * *(u16 *) & eth_addr[0] = SHORTSWAP(*(u16 *) & addr[1]); - */ - *(u32 *) & eth_addr[2] = swab32(addr[0]); - *(u16 *) & eth_addr[0] = swab16(*(u16 *) & addr[1]); - + *(u32 *) ð_addr[2] = swab32(addr[0]); + *(u16 *) ð_addr[0] = swab16(*(u16 *) &addr[1]); if (is_valid_ether_addr(eth_addr)) { memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); return 0; @@ -281,17 +275,28 @@ static int atl1_get_permanent_address(struct atl1_hw *hw) i += 4; } -/* - * The following 2 lines are the Attansic originals. Saving for posterity. - * *(u32 *) & eth_addr[2] = LONGSWAP(addr[0]); - * *(u16 *) & eth_addr[0] = SHORTSWAP(*(u16 *) & addr[1]); - */ - *(u32 *) & eth_addr[2] = swab32(addr[0]); - *(u16 *) & eth_addr[0] = swab16(*(u16 *) & addr[1]); + *(u32 *) ð_addr[2] = swab32(addr[0]); + *(u16 *) ð_addr[0] = swab16(*(u16 *) &addr[1]); if (is_valid_ether_addr(eth_addr)) { memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); return 0; } + + /* +* On some motherboards, the MAC address is written by the +* BIOS directly to the MAC register during POST, and is +* not stored in eeprom. If all else thus far has failed +* to fetch the permanent MAC address, try reading it directly. +*/ + addr[0] = ioread32(hw->hw_addr + REG_MAC_STA_ADDR); + addr[1] = ioread16(hw->hw_addr + (REG_MAC_STA_ADDR + 4)); + *(u32 *) ð_addr[2] = swab32(addr[0]); + *(u16 *) ð_addr[0] = swab16(*(u16 *) &addr[1]); + if (is_valid_ether_addr(eth_addr)) { + memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); + return 0; + } + return 1; } - 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/6] atl1: remove unused define
From: Chris Snook <[EMAIL PROTECTED]> Remove unused define from atl1_main.c. Signed-off-by: Chris Snook <[EMAIL PROTECTED]> Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_main.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 6655640..abce97e 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -82,7 +82,6 @@ #include "atl1.h" -#define RUN_REALTIME 0 #define DRIVER_VERSION "2.0.6" char atl1_driver_name[] = "atl1"; - 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/6] atl1: add L1 device id to pci_ids, then use it
From: Chris Snook <[EMAIL PROTECTED]> Add device id for the Attansic L1 chip to pci_ids.h, then use it. Signed-off-by: Chris Snook <[EMAIL PROTECTED]> Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_main.c |2 +- include/linux/pci_ids.h |1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index abce97e..09f3375 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -99,7 +99,7 @@ MODULE_VERSION(DRIVER_VERSION); * atl1_pci_tbl - PCI Device ID Table */ static const struct pci_device_id atl1_pci_tbl[] = { - {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, 0x1048)}, + {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1)}, /* required last entry */ {0,} }; diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 68a7be9..bd21933 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2067,6 +2067,7 @@ #define PCI_DEVICE_ID_TDI_EHCI 0x0101 #define PCI_VENDOR_ID_ATTANSIC 0x1969 +#define PCI_DEVICE_ID_ATTANSIC_L1 0x1048 #define PCI_VENDOR_ID_JMICRON 0x197B #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 - 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 6/6] atl1: bump version number
From: Jay Cliburn <[EMAIL PROTECTED]> Bump the version number. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_main.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 09f3375..6567348 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -82,7 +82,7 @@ #include "atl1.h" -#define DRIVER_VERSION "2.0.6" +#define DRIVER_VERSION "2.0.7" char atl1_driver_name[] = "atl1"; static const char atl1_driver_string[] = "Attansic L1 Ethernet Network Driver"; - 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 4/4] atl1: Ancillary C files for Attansic L1 driver
Luca Tettamanti wrote: [snip] Anyway... Unconditionally enable MSI in atl1 driver. Also remove some useless #ifdef since pci_{en,dis}able_msi() are no-op when MSI support is not configured in. Signed-off-by: Luca Tettamanti <[EMAIL PROTECTED]> Acked-by: Jay Cliburn <[EMAIL PROTECTED]> I tested this patch today. Works fine on my Asus M2V mainboard (Via K8T890). Here are the eth0 entries in /proc/interrupts before and after the patch. BEFORE:36: 93 322091 IO-APIC-fasteoi eth0 AFTER: 2298: 85 7289 PCI-MSI-edge eth0 Jeff, shall I add this to the larger patch I'm working on for submittal later this weekend, or do you just add it directly to netdev? (I prefer to do the former if it's okay with you.) Jay --- Patch against current netdev tree. drivers/net/atl1/atl1.h |1 - drivers/net/atl1/atl1_main.c | 22 +++--- drivers/net/atl1/atl1_param.c | 13 - 3 files changed, 7 insertions(+), 29 deletions(-) diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h index 1d13e8f..0b30e1c 100644 --- a/drivers/net/atl1/atl1.h +++ b/drivers/net/atl1/atl1.h @@ -281,7 +281,6 @@ struct atl1_adapter { struct atl1_smb smb; struct atl1_cmb cmb; - int enable_msi; u32 pci_state[16]; }; diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index c0b1555..68e6cd1 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -1793,18 +1793,12 @@ s32 atl1_up(struct atl1_adapter *adapter) goto err_up; } -#ifdef CONFIG_PCI_MSI - if (adapter->enable_msi) { - err = pci_enable_msi(adapter->pdev); - if (err) { - dev_info(&adapter->pdev->dev, "Unable to enable MSI: %d\n", err); - adapter->enable_msi = 0; - } - } -#endif - if (!adapter->enable_msi) + err = pci_enable_msi(adapter->pdev); + if (err) { + dev_info(&adapter->pdev->dev, "Unable to enable MSI: %d\n", err); irq_flags |= IRQF_SHARED; - + } + err = request_irq(adapter->pdev->irq, &atl1_intr, irq_flags, netdev->name, netdev); if (unlikely(err)) @@ -1821,6 +1815,7 @@ s32 atl1_up(struct atl1_adapter *adapter) free_irq(adapter->pdev->irq, netdev); err_up: + pci_disable_msi(adapter->pdev); /* free rx_buffers */ atl1_clean_rx_ring(adapter); return err; @@ -1836,10 +1831,7 @@ void atl1_down(struct atl1_adapter *adapter) atl1_irq_disable(adapter); free_irq(adapter->pdev->irq, netdev); -#ifdef CONFIG_PCI_MSI - if (adapter->enable_msi) - pci_disable_msi(adapter->pdev); -#endif + pci_disable_msi(adapter->pdev); atl1_reset_hw(&adapter->hw); adapter->cmb.cmb->int_stats = 0; diff --git a/drivers/net/atl1/atl1_param.c b/drivers/net/atl1/atl1_param.c index 4732f43..caa2d83 100644 --- a/drivers/net/atl1/atl1_param.c +++ b/drivers/net/atl1/atl1_param.c @@ -68,10 +68,6 @@ static int num_flash_vendor = 0; module_param_array_named(flash_vendor, flash_vendor, int, &num_flash_vendor, 0); MODULE_PARM_DESC(flash_vendor, "SPI flash vendor"); -int enable_msi; -module_param(enable_msi, int, 0444); -MODULE_PARM_DESC(enable_msi, "Enable PCI MSI"); - #define DEFAULT_INT_MOD_CNT100 /* 200us */ #define MAX_INT_MOD_CNT65000 #define MIN_INT_MOD_CNT50 @@ -211,13 +207,4 @@ void __devinit atl1_check_options(struct atl1_adapter *adapter) adapter->hw.flash_vendor = (u8) (opt.def); } } - - { /* PCI MSI usage */ - -#ifdef CONFIG_PCI_MSI - adapter->enable_msi = enable_msi; -#else - adapter->enable_msi = 0; -#endif - } } - 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 4/4] atl1: Ancillary C files for Attansic L1 driver
Jeff Garzik wrote: As a driver maintainer, you need to patch sets, and submit them in a timely fashion to me. Note I said patch set, not patch, in following with Rule #3 from Documentation/SubmittingPatches. Also make sure to review http://linux.yyz.us/patch-format.html Understood. Both references reviewed. Thanks. Sorry, but one last question... These two patches generated overnight by Andrew: Message-Id: <[EMAIL PROTECTED]> Subject: + git-netdev-all-atl1-pm-fix.patch added to -mm tree and Message-Id: <[EMAIL PROTECTED]> Subject: + git-netdev-all-atl1-build-fix.patch added to -mm tree Do I include these in my patch set that I submit to you, or do you apply them to netdev directly? 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 2.6.20-rc5 1/4] atl1: unconditionally enable MSI
From: Luca Tettamanti <[EMAIL PROTECTED]> Unconditionally enable MSI in atl1 driver. Also remove some useless #ifdef since pci_{en,dis}able_msi() are no-op when MSI support is not configured in. Signed-off-by: Luca Tettamanti <[EMAIL PROTECTED]> Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1.h |1 - drivers/net/atl1/atl1_main.c | 22 +++--- drivers/net/atl1/atl1_param.c | 13 - 3 files changed, 7 insertions(+), 29 deletions(-) diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h index 1d13e8f..0b30e1c 100644 --- a/drivers/net/atl1/atl1.h +++ b/drivers/net/atl1/atl1.h @@ -281,7 +281,6 @@ struct atl1_adapter { struct atl1_smb smb; struct atl1_cmb cmb; - int enable_msi; u32 pci_state[16]; }; diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index c0b1555..68e6cd1 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -1793,18 +1793,12 @@ s32 atl1_up(struct atl1_adapter *adapter) goto err_up; } -#ifdef CONFIG_PCI_MSI - if (adapter->enable_msi) { - err = pci_enable_msi(adapter->pdev); - if (err) { - dev_info(&adapter->pdev->dev, "Unable to enable MSI: %d\n", err); - adapter->enable_msi = 0; - } - } -#endif - if (!adapter->enable_msi) + err = pci_enable_msi(adapter->pdev); + if (err) { + dev_info(&adapter->pdev->dev, "Unable to enable MSI: %d\n", err); irq_flags |= IRQF_SHARED; - + } + err = request_irq(adapter->pdev->irq, &atl1_intr, irq_flags, netdev->name, netdev); if (unlikely(err)) @@ -1821,6 +1815,7 @@ s32 atl1_up(struct atl1_adapter *adapter) free_irq(adapter->pdev->irq, netdev); err_up: + pci_disable_msi(adapter->pdev); /* free rx_buffers */ atl1_clean_rx_ring(adapter); return err; @@ -1836,10 +1831,7 @@ void atl1_down(struct atl1_adapter *adapter) atl1_irq_disable(adapter); free_irq(adapter->pdev->irq, netdev); -#ifdef CONFIG_PCI_MSI - if (adapter->enable_msi) - pci_disable_msi(adapter->pdev); -#endif + pci_disable_msi(adapter->pdev); atl1_reset_hw(&adapter->hw); adapter->cmb.cmb->int_stats = 0; diff --git a/drivers/net/atl1/atl1_param.c b/drivers/net/atl1/atl1_param.c index 4732f43..caa2d83 100644 --- a/drivers/net/atl1/atl1_param.c +++ b/drivers/net/atl1/atl1_param.c @@ -68,10 +68,6 @@ static int num_flash_vendor = 0; module_param_array_named(flash_vendor, flash_vendor, int, &num_flash_vendor, 0); MODULE_PARM_DESC(flash_vendor, "SPI flash vendor"); -int enable_msi; -module_param(enable_msi, int, 0444); -MODULE_PARM_DESC(enable_msi, "Enable PCI MSI"); - #define DEFAULT_INT_MOD_CNT100 /* 200us */ #define MAX_INT_MOD_CNT65000 #define MIN_INT_MOD_CNT50 @@ -211,13 +207,4 @@ void __devinit atl1_check_options(struct atl1_adapter *adapter) adapter->hw.flash_vendor = (u8) (opt.def); } } - - { /* PCI MSI usage */ - -#ifdef CONFIG_PCI_MSI - adapter->enable_msi = enable_msi; -#else - adapter->enable_msi = 0; -#endif - } } Luca -- Inquietudine sintetica Solo, davanti all'ignoto Tienimi stretto a te - 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.6.20-rc5 2/4] atl1: add missing include dma-mapping.h
From: Jay Cliburn <[EMAIL PROTECTED]> Include dma-mapphing.h to provide DMA_32BIT_MASK and DMA_64BIT_MASK. Discovered by and modification suggested by Andrew Morton. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_main.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 68e6cd1..a9e02d1 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include - 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.6.20-rc5 3/4] atl1: properly use CONFIG_PM
From: Jay Cliburn <[EMAIL PROTECTED]> Fix power management by properly using ifdef CONFIG_PM. Discovered by and modification suggested by Andrew Morton. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_main.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index a9e02d1..1045325 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -2345,6 +2345,7 @@ static void __devexit atl1_remove(struct pci_dev *pdev) pci_disable_device(pdev); } +#ifdef CONFIG_PM static int atl1_suspend(struct pci_dev *pdev, pm_message_t state) { struct net_device *netdev = pci_get_drvdata(pdev); @@ -2438,6 +2439,10 @@ static int atl1_resume(struct pci_dev *pdev) return 0; } +#else +#define atl1_suspend NULL +#define atl1_resume NULL +#endif static struct pci_driver atl1_driver = { .name = atl1_driver_name, @@ -2446,10 +2451,8 @@ static struct pci_driver atl1_driver = { .remove = __devexit_p(atl1_remove), /* Power Managment Hooks */ /* probably broken right now -- CHS */ -#ifdef CONFIG_PM .suspend = atl1_suspend, .resume = atl1_resume -#endif }; /** - 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.6.20-rc5 4/4] atl1: incorporate reviewer comments
From: Jay Cliburn <[EMAIL PROTECTED]> Incorporate reviewer comments from: Randy Dunlap, http://lkml.org/lkml/2007/1/21/157 Arjan van de Ven, http://lkml.org/lkml/2007/1/22/21 Francois Romieu, http://lkml.org/lkml/2007/1/22/49 Fixup to follow coding standards, remove MII defines already found in mii.h, remove unneeded code, make atl1_clear_phy_int() irq safe. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h index 0b30e1c..cc18016 100644 --- a/drivers/net/atl1/atl1.h +++ b/drivers/net/atl1/atl1.h @@ -1,4 +1,4 @@ -/** +/* * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. * Copyright(c) 2006 Chris Snook <[EMAIL PROTECTED]> * Copyright(c) 2006 Jay Cliburn <[EMAIL PROTECTED]> @@ -19,14 +19,13 @@ * 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. - **/ + */ #ifndef _ATL1_H_ #define _ATL1_H_ #include #include -#include #include "atl1_hw.h" @@ -37,6 +36,9 @@ int atl1_reset(struct atl1_adapter *adapter); s32 atl1_setup_ring_resources(struct atl1_adapter *adapter); void atl1_free_ring_resources(struct atl1_adapter *adapter); +extern char atl1_driver_name[]; +extern char atl1_driver_version[]; + struct atl1_adapter; #define ATL1_MAX_INTR 3 @@ -53,17 +55,17 @@ struct atl1_adapter; #define ATL1_TPD_DESC(R, i)ATL1_GET_DESC(R, i, struct tx_packet_desc) #define ATL1_RRD_DESC(R, i)ATL1_GET_DESC(R, i, struct rx_return_desc) -/** +/* * 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. - **/ + */ -/** +/* * wrapper around a pointer to a socket buffer, * so a DMA handle can be stored along with the buffer - **/ + */ struct atl1_buffer { struct sk_buff *skb; u16 length; @@ -78,7 +80,6 @@ struct atl1_tpd_ring { dma_addr_t dma; /* physical adress of the descriptor ring */ u16 size; /* length of descriptor ring in bytes */ u16 count; /* number of descriptors in the ring */ - u16 hw_idx; /* hardware index */ atomic_t next_to_clean; atomic_t next_to_use; @@ -105,12 +106,9 @@ struct atl1_rrd_ring { }; struct atl1_ring_header { - /* pointer to the descriptor ring memory */ - void *desc; - /* physical adress of the descriptor ring */ - dma_addr_t dma; - /* length of descriptor ring in bytes */ - unsigned int size; + 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 */ }; struct atl1_cmb { @@ -143,16 +141,15 @@ struct atl1_sft_stats { u64 tx_window_errors; u64 tx_carrier_errors; - u64 tx_pause; /* The number of Pause packet transmitted. */ - u64 excecol;/* The number of transmit packets aborted due to excessive collisions. */ - u64 deffer; /* The number of packets transmitted that is deferred. */ - u64 scc;/* The number of packets subsequently transmitted successfully with a single prior collision. */ - u64 mcc;/* The number of packets subsequently transmitted successfully with multiple prior collisions. */ - u64 latecol;/* The number of packets transmitted with late collisions. */ - u64 tx_underun; /* The number of transmit packets aborted due to transmit FIFO underrun, or TRD FIFO underrun */ - u64 tx_trunc; /* The number of transmit packets truncated due to size exceeding MTU, regardless if it is truncated by Selene or not. -* (The name is not really reflects the meaning in this case here.) */ - u64 rx_pause; /* The number of Pause packet received. */ + u64 tx_pause; /* num Pause packet transmitted. */ + u64 excecol;/* num tx packets aborted due to excessive collisions. */ + u64 deffer; /* num deferred tx packets */ + u64 scc;/* num packets subsequently transmitted successfully w/ single prior collision. */ + u64 mcc;/* num packets subsequently transmitted successfully w/ multiple prior collisions. */ + u64 latecol;/* num tx packets w/ late collisions. */ + u64 tx_underun; /* num tx packets aborted due to transmit FIFO underrun, or TRD FIFO underrun */ + u64 tx_
Re: [PATCH 2.6.20-rc5 1/4] atl1: unconditionally enable MSI
The subject line on all four of the current crop of atl1 patches is incorrect; they were generated against *2.6.20-rc6*, not rc5. I apologize for the error. 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_main: pci_module_int returns to haunt us
Alan wrote: Perhaps Adrian would care to simply delete the pci_module_init ancient compat code so nobody else can inadvertently merge a driver that uses it. Signed-off-by: Alan Cox <[EMAIL PROTECTED]> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c --- linux.vanilla-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c 2007-01-31 14:20:41.0 + +++ linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c 2007-01-31 15:25:29.083361224 + @@ -2482,12 +2482,9 @@ **/ static int __init atl1_init_module(void) { - int ret; printk(KERN_INFO "%s - version %s\n", atl1_driver_string, DRIVER_VERSION); printk(KERN_INFO "%s\n", atl1_copyright); - ret = pci_module_init(&atl1_driver); - - return ret; + return pci_register_driver(&atl1_driver); } module_init(atl1_init_module); Ack. As expected, works fine. 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/
[PATCH 2.6.20-rc7 1/2] atl1: get rid of pci_module_init
From: Jay Cliburn <[EMAIL PROTECTED]> pci_module_init is deprecated. Use pci_register_driver instead. Discovered by and modification suggested by Alan Cox. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_main.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 0afa9c1..793c43b 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -2461,12 +2461,9 @@ static void __exit atl1_exit_module(void) */ static int __init atl1_init_module(void) { - int ret; printk(KERN_INFO "%s - version %s\n", atl1_driver_string, DRIVER_VERSION); printk(KERN_INFO "%s\n", atl1_copyright); - ret = pci_module_init(&atl1_driver); - - return ret; + return pci_register_driver(&atl1_driver); } module_init(atl1_init_module); - 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.6.20-rc7 2/2] atl1: add ethtool set ring params functionality
From: Jay Cliburn <[EMAIL PROTECTED]> Fix up some constants relating to max and min ring descriptor counts. Also add functionality to enable ethtool to set tx and rx ring parameters. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1.h |4 +- drivers/net/atl1/atl1_ethtool.c | 78 ++- 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h index cc18016..da4bf87 100644 --- a/drivers/net/atl1/atl1.h +++ b/drivers/net/atl1/atl1.h @@ -44,11 +44,11 @@ struct atl1_adapter; #define ATL1_MAX_INTR 3 #define ATL1_DEFAULT_TPD 256 -#define ATL1_MAX_TPD 1023 +#define ATL1_MAX_TPD 1024 #define ATL1_MIN_TPD 64 #define ATL1_DEFAULT_RFD 512 #define ATL1_MIN_RFD 128 -#define ATL1_MAX_RFD 2047 +#define ATL1_MAX_RFD 2048 #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) diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c index 8ce4d06..b7cd7b3 100644 --- a/drivers/net/atl1/atl1_ethtool.c +++ b/drivers/net/atl1/atl1_ethtool.c @@ -308,8 +308,8 @@ static void atl1_get_ringparam(struct net_device *netdev, struct atl1_tpd_ring *txdr = &adapter->tpd_ring; struct atl1_rfd_ring *rxdr = &adapter->rfd_ring; - ring->rx_max_pending = 2048; - ring->tx_max_pending = 1024; + ring->rx_max_pending = ATL1_MAX_RFD; + ring->tx_max_pending = ATL1_MAX_TPD; ring->rx_mini_max_pending = 0; ring->rx_jumbo_max_pending = 0; ring->rx_pending = rxdr->count; @@ -318,6 +318,79 @@ static void atl1_get_ringparam(struct net_device *netdev, ring->rx_jumbo_pending = 0; } +static int atl1_set_ringparam (struct net_device *netdev, + struct ethtool_ringparam *ring) +{ + struct atl1_adapter *adapter = netdev_priv(netdev); + struct atl1_tpd_ring *tpdr = &adapter->tpd_ring; + struct atl1_rrd_ring *rrdr = &adapter->rrd_ring; + struct atl1_rfd_ring *rfdr = &adapter->rfd_ring; + + struct atl1_tpd_ring tpd_old, tpd_new; + struct atl1_rfd_ring rfd_old, rfd_new; + struct atl1_rrd_ring rrd_old, rrd_new; + struct atl1_ring_header rhdr_old, rhdr_new; + int err; + + tpd_old = adapter->tpd_ring; + rfd_old = adapter->rfd_ring; + rrd_old = adapter->rrd_ring; + rhdr_old = adapter->ring_header; + + if (netif_running(adapter->netdev)) + atl1_down(adapter); + + rfdr->count = (u16) max(ring->rx_pending, (u32) ATL1_MIN_RFD); + rfdr->count = rfdr->count > ATL1_MAX_RFD ? ATL1_MAX_RFD : + rfdr->count; + rfdr->count = (rfdr->count + 3) & ~3; + rrdr->count = rfdr->count; + + tpdr->count = (u16) max(ring->tx_pending, (u32) ATL1_MIN_TPD); + tpdr->count = tpdr->count > ATL1_MAX_TPD ? ATL1_MAX_TPD : + tpdr->count; + tpdr->count = (tpdr->count + 3) & ~3; + + if (netif_running(adapter->netdev)) { + /* try to get new resources before deleting old */ + err = atl1_setup_ring_resources(adapter); + if (err) + goto err_setup_ring; + + /* +* save the new, restore the old in order to free it, +* then restore the new back again +*/ + + rfd_new = adapter->rfd_ring; + rrd_new = adapter->rrd_ring; + tpd_new = adapter->tpd_ring; + rhdr_new = adapter->ring_header; + adapter->rfd_ring = rfd_old; + adapter->rrd_ring = rrd_old; + adapter->tpd_ring = tpd_old; + adapter->ring_header = rhdr_old; + atl1_free_ring_resources(adapter); + adapter->rfd_ring = rfd_new; + adapter->rrd_ring = rrd_new; + adapter->tpd_ring = tpd_new; + adapter->ring_header = rhdr_new; + + err = atl1_up(adapter); + if (err) + return err; + } + return 0; + +err_setup_ring: + adapter->rfd_ring = rfd_old; + adapter->rrd_ring = rrd_old; + adapter->tpd_ring = tpd_old; + adapter->ring_header = rhdr_old; + atl1_up(adapter); + return err; +} + static void atl1_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *epause) { @@ -417,6 +490,7 @@ const struct ethtool_ops atl1_ethtool_ops = { .get_wol= atl1_get_wol, .set_wol
[PATCH netdev#atl1 0/3] atl1: fix whitespace, add maintainers and pci_ids
This set of patches completes the final bit of tidying up in the Attansic ethernet driver. Sorry for nickel-and-diming you, Jeff, but this really should be the end of it for awhile. Summary: 1. Clean up whitespace damage. 2. Add a maintainers entry. 3. Add a pci_ids entry. --- MAINTAINERS | 10 +++ drivers/net/atl1/atl1.h | 12 ++-- drivers/net/atl1/atl1_ethtool.c | 120 +++--- drivers/net/atl1/atl1_hw.h | 14 ++-- drivers/net/atl1/atl1_main.c| 137 +++ drivers/net/atl1/atl1_param.c | 22 +++--- include/linux/pci_ids.h |2 + 7 files changed, 200 insertions(+), 117 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 netdev#atl1 1/3] atl1: remove whitespace damage
From: Jay Cliburn <[EMAIL PROTECTED]> atl1: fix whitespace damage Remove trailing whitespace and spaces preceding tabs. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1.h |8 +- drivers/net/atl1/atl1_ethtool.c | 42 ++-- drivers/net/atl1/atl1_hw.h | 14 ++-- drivers/net/atl1/atl1_main.c| 130 +++--- drivers/net/atl1/atl1_param.c | 22 +++--- 5 files changed, 108 insertions(+), 108 deletions(-) diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h index da4bf87..3ff978b 100644 --- a/drivers/net/atl1/atl1.h +++ b/drivers/net/atl1/atl1.h @@ -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. diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c index b7cd7b3..01c2348 100644 --- a/drivers/net/atl1/atl1_ethtool.c +++ b/drivers/net/atl1/atl1_ethtool.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. @@ -93,7 +93,7 @@ static int atl1_get_stats_count(struct net_device *netdev) return ARRAY_SIZE(atl1_gstrings_stats); } -static int atl1_get_settings(struct net_device *netdev, +static int atl1_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) { struct atl1_adapter *adapter = netdev_priv(netdev); @@ -142,11 +142,11 @@ static int atl1_get_settings(struct net_device *netdev, ecmd->autoneg = AUTONEG_ENABLE; else ecmd->autoneg = AUTONEG_DISABLE; - + return 0; } -static int atl1_set_settings(struct net_device *netdev, +static int atl1_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) { struct atl1_adapter *adapter = netdev_priv(netdev); @@ -156,7 +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", + printk(KERN_DEBUG "%s: ethtool shutting down adapter\n", atl1_driver_name); atl1_down(adapter); } @@ -176,7 +176,7 @@ static int atl1_set_settings(struct net_device *netdev, } else if (ecmd->speed == SPEED_100) { if (ecmd->duplex == DUPLEX_FULL) { hw->media_type = MEDIA_TYPE_100M_FULL; - } else + } else hw->media_type = MEDIA_TYPE_100M_HALF; } else { if (ecmd->duplex == DUPLEX_FULL) @@ -206,8 +206,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 s
[PATCH netdev#atl1 2/3] maintainers: add atl1 maintainers
From: Jay Cliburn <[EMAIL PROTECTED]> MAINTAINERS: add atl1 maintainers Add a maintainers entry for atl1. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- MAINTAINERS | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 465e083..825ea74 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -590,6 +590,16 @@ M: [EMAIL PROTECTED] W: http://www.coraid.com/support/linux S: Supported +ATL1 ETHERNET DRIVER +P: Jay Cliburn +M: [EMAIL PROTECTED] +P: Chris Snook +M: [EMAIL PROTECTED] +L: [EMAIL PROTECTED] +W: http://sourceforge.net/projects/atl1 +W: http://atl1.sourceforge.net +S: Maintained + ATM P: Chas Williams M: [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/
[PATCH netdev#atl1 3/3] pci_ids: add Attansic vendor id
From: Jay Cliburn <[EMAIL PROTECTED]> pci_ids: add Attansic vendor id Add Attansic to pci_ids and use the ID in the driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_main.c |2 +- include/linux/pci_ids.h |2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index b037ebc..9a3fb86 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c @@ -102,7 +102,7 @@ extern struct ethtool_ops atl1_ethtool_ops; * atl1_pci_tbl - PCI Device ID Table */ static const struct pci_device_id atl1_pci_tbl[] = { - {PCI_DEVICE(0x1969, 0x1048)}, + {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, 0x1048)}, /* required last entry */ {0,} }; diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 3d1d210..68a7be9 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2066,6 +2066,8 @@ #define PCI_VENDOR_ID_TDI 0x192E #define PCI_DEVICE_ID_TDI_EHCI 0x0101 +#define PCI_VENDOR_ID_ATTANSIC 0x1969 + #define PCI_VENDOR_ID_JMICRON 0x197B #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 #define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 - 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: [BUG] commit 3c517a61, slab: better fallback allocation behavior
Christoph Lameter wrote: Ahh. Fallback_alloc() does not do the check for GFP_WAIT as done in cache_grow(). Thus interrupts are disabled when we call kmem_getpages() which results in the failure. Duplicate the handling of GFP_WAIT in cache_grow(). Jay could you try this patch? The patch seems to fix the bug. I've been running about an hour with it now, and I haven't seen any error messages. Prior to the patch, I'd see the messages within a few minutes of starting a login session. 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 2/4] atl1: Header files for Attansic L1 driver
From: Jay Cliburn <[EMAIL PROTECTED]> From: Chris Snook <[EMAIL PROTECTED]> This patch contains the header files needed by the Attansic L1 gigabit ethernet adapter driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- atl1.h| 266 +++ atl1_hw.h | 1053 ++ 2 files changed, 1319 insertions(+) diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h new file mode 100644 index 000..9578104 --- /dev/null +++ b/drivers/net/atl1/atl1.h @@ -0,0 +1,266 @@ +/** + * atl1.h - atl1 main header + * + * 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. + **/ + +#ifndef _ATL1_H_ +#define _ATL1_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "atl1_hw.h" + +#ifdef NETIF_F_TSO +#include +#endif + +#ifdef SIOCGMIIPHY +#include +#endif + +#ifdef SIOCETHTOOL +#include +#endif + +#define BAR_0 0 + +/* function prototypes needed by multiple files */ +s32 atl1_up(struct atl1_adapter *adapter); +void atl1_down(struct atl1_adapter *adapter); +int atl1_reset(struct atl1_adapter *adapter); +s32 atl1_setup_ring_resources(struct atl1_adapter *adapter); +void atl1_free_ring_resources(struct atl1_adapter *adapter); + +struct atl1_adapter; + +#define ATL1_MAX_INTR 3 + +#define ATL1_DEFAULT_TPD 256 +#define ATL1_MAX_TPD 1023 +#define ATL1_MIN_TPD 64 +#define ATL1_DEFAULT_RFD 512 +#define ATL1_MIN_RFD 128 +#define ATL1_MAX_RFD 2047 + +#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) +#define ATL1_TPD_DESC(R, i)ATL1_GET_DESC(R, i, struct tx_packet_desc) +#define ATL1_RRD_DESC(R, i)ATL1_GET_DESC(R, i, struct rx_return_desc) + +#define usec_delay(x) udelay(x) +#ifndef msec_delay +#define msec_delay(x) do { if(in_interrupt()) { \ + /* Don't mdelay in interrupt context!*/ \ + BUG(); \ + } else { \ + msleep(x); \ + }} while(0) +/** + * 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. + **/ +#define msec_delay_irq(x) mdelay(x) +#endif + +/** + * wrapper around a pointer to a socket buffer, + * so a DMA handle can be stored along with the buffer + **/ +struct atl1_buffer { + struct sk_buff *skb; + u16 length; + u16 alloced; + dma_addr_t dma; +}; + +#define MAX_TX_BUF_LEN 0x3000 /* 12KB */ + +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 */ + u16 count; /* number of descriptors in the ring */ + + u16 hw_idx; /* hardware index */ + atomic_t next_to_clean; + atomic_t next_to_use; + struct atl1_buffer *buffer_info; +}; + +struct atl1_rfd_ring { + void *desc; + dma_addr_t dma; + u16 size; + u16 count; + atomic_t next_to_use; + u16 next_to_clean; + struct atl1_buffer *buffer_info; +}; + +struct atl1_rrd_ring { + void *desc; + dma_addr_t dma; + unsigned int size; + u16 count; + u16 next_to_use; + atomic_t next_to_clean; +}; + +struct atl1_ring_header { + /* pointer to the descriptor ring memory */ + void *desc; + /* physical adress of the descriptor ring */ +
[PATCH 1/4] atl1: Build files for Attansic L1 driver
From: Jay Cliburn <[EMAIL PROTECTED]> From: Chris Snook <[EMAIL PROTECTED]> This patch contains the build files for the Attansic L1 gigabit ethernet adapter driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- Kconfig | 11 +++ Makefile |1 + atl1/Makefile | 30 ++ 3 files changed, 42 insertions(+) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 8aa8dd0..92a5efe 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2348,6 +2348,17 @@ config QLA3XXX To compile this driver as a module, choose M here: the module will be called qla3xxx. +config ATL1 + tristate "Attansic(R) L1 Gigabit Ethernet support (EXPERIMENTAL)" + depends on NET_PCI && PCI && EXPERIMENTAL + select CRC32 + select MII + help + This driver supports Attansic L1 gigabit ethernet adapter. + + To compile this driver as a module, choose M here. The module + will be called atl1. + endmenu # diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 4c0d4e5..d0beced 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_IXGB) += ixgb/ obj-$(CONFIG_CHELSIO_T1) += chelsio/ obj-$(CONFIG_EHEA) += ehea/ obj-$(CONFIG_BONDING) += bonding/ +obj-$(CONFIG_ATL1) += atl1/ obj-$(CONFIG_GIANFAR) += gianfar_driver.o gianfar_driver-objs := gianfar.o \ diff --git a/drivers/net/atl1/Makefile b/drivers/net/atl1/Makefile new file mode 100644 index 000..1a10b91 --- /dev/null +++ b/drivers/net/atl1/Makefile @@ -0,0 +1,30 @@ + +# +# Attansic L1 gigabit ethernet driver +# Copyright(c) 2005 - 2006 Attansic Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". +# + + +# +# Makefile for the Attansic L1 gigabit ethernet driver +# + +obj-$(CONFIG_ATL1) += atl1.o + +atl1-objs := atl1_main.o atl1_hw.o atl1_ethtool.o atl1_param.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/
[PATCH 4/4] atl1: Ancillary C files for Attansic L1 driver
From: Jay Cliburn <[EMAIL PROTECTED]> From: Chris Snook <[EMAIL PROTECTED]> This patch contains auxiliary C files for the Attansic L1 gigabit ethernet adapter driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- atl1_ethtool.c | 528 + atl1_hw.c | 797 + atl1_param.c | 223 +++ 3 files changed, 1548 insertions(+) diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c new file mode 100644 index 000..4d454b2 --- /dev/null +++ b/drivers/net/atl1/atl1_ethtool.c @@ -0,0 +1,528 @@ +/** + * atl1_ethtool.c - atl1 ethtool support + * + * 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. + **/ + +#include +#include + +#include "atl1.h" + + +extern char atl1_driver_name[]; +extern char atl1_driver_version[]; + +struct atl1_stats { + char stat_string[ETH_GSTRING_LEN]; + int sizeof_stat; + int stat_offset; +}; + +#define ATL1_STAT(m) sizeof(((struct atl1_adapter *)0)->m), \ + offsetof(struct atl1_adapter, m) + +static struct atl1_stats atl1_gstrings_stats[] = { + {"rx_packets", ATL1_STAT(soft_stats.rx_packets)}, + {"tx_packets", ATL1_STAT(soft_stats.tx_packets)}, + {"rx_bytes", ATL1_STAT(soft_stats.rx_bytes)}, + {"tx_bytes", ATL1_STAT(soft_stats.tx_bytes)}, + {"rx_errors", ATL1_STAT(soft_stats.rx_errors)}, + {"tx_errors", ATL1_STAT(soft_stats.tx_errors)}, + {"rx_dropped", ATL1_STAT(net_stats.rx_dropped)}, + {"tx_dropped", ATL1_STAT(net_stats.tx_dropped)}, + {"multicast", ATL1_STAT(soft_stats.multicast)}, + {"collisions", ATL1_STAT(soft_stats.collisions)}, + {"rx_length_errors", ATL1_STAT(soft_stats.rx_length_errors)}, + {"rx_over_errors", ATL1_STAT(soft_stats.rx_missed_errors)}, + {"rx_crc_errors", ATL1_STAT(soft_stats.rx_crc_errors)}, + {"rx_frame_errors", ATL1_STAT(soft_stats.rx_frame_errors)}, + {"rx_fifo_errors", ATL1_STAT(soft_stats.rx_fifo_errors)}, + {"rx_missed_errors", ATL1_STAT(soft_stats.rx_missed_errors)}, + {"tx_aborted_errors", ATL1_STAT(soft_stats.tx_aborted_errors)}, + {"tx_carrier_errors", ATL1_STAT(soft_stats.tx_carrier_errors)}, + {"tx_fifo_errors", ATL1_STAT(soft_stats.tx_fifo_errors)}, + {"tx_window_errors", ATL1_STAT(soft_stats.tx_window_errors)}, + {"tx_abort_exce_coll", ATL1_STAT(soft_stats.excecol)}, + {"tx_abort_late_coll", ATL1_STAT(soft_stats.latecol)}, + {"tx_deferred_ok", ATL1_STAT(soft_stats.deffer)}, + {"tx_single_coll_ok", ATL1_STAT(soft_stats.scc)}, + {"tx_multi_coll_ok", ATL1_STAT(soft_stats.mcc)}, + {"tx_underun", ATL1_STAT(soft_stats.tx_underun)}, + {"tx_trunc", ATL1_STAT(soft_stats.tx_trunc)}, + {"tx_pause", ATL1_STAT(soft_stats.tx_pause)}, + {"rx_pause", ATL1_STAT(soft_stats.rx_pause)}, + {"rx_rrd_ov", ATL1_STAT(soft_stats.rx_rrd_ov)}, + {"rx_trunc", ATL1_STAT(soft_stats.rx_trunc)} +}; + +#define ATL1_STATS_LEN sizeof(atl1_gstrings_stats) / sizeof(struct atl1_stats) + +static void atl1_get_ethtool_stats(struct net_device *netdev, + struct ethtool_stats *stats, u64 *data) +{ + struct atl1_adapter *adapter = netdev_priv(netdev); + int i; + char *p; + + for (i = 0; i < ATL1_STATS_LEN; i++) { + p = (char *)adapter+atl1_gstrings_stats[i].stat_offset; + data[i] = (atl1_gstrings_stats[i].sizeof_stat == + sizeof(u64)) ? *(u64 *)p : *(u32
[PATCH 0/4] atl1: Attansic L1 ethernet driver
This is the latest submittal of the patchset providing support for the Attansic L1 gigabit ethernet adapter. This patchset is built against kernel version 2.6.20-rc4 current git as of 20070109. The monolithic version of this patchset may be found at: ftp://hogchain.net/pub/linux/m2v/attansic/kernel_driver/atl1-2.0.3/atl1-2.0.3-linux-2.6.20.rc4.patch.bz2 As a reminder, this driver is a modified version of the Attansic reference driver for the L1 ethernet adapter. Attansic has granted permission for its inclusion in the mainline kernel. Changes for this version include: * Incorporation of previous comments from Arnd Bergmann, Alan Cox, and Jan Engelhardt. * Conversion to the new workqueue method. * Addition of MSI support (thanks to Luca Tettamanti). NOTES: 1. TSO is broken (order of magnitude decrease in Tx peformance as compared to Rx performance) and therefore the feature has been disabled until it's fixed. We have not been able to find the source of the problem in the driver itself, so we've requested that Attansic take a look at the hardware. We've not yet heard back from them. We encourage any experienced netdev folks to take a look at the TSO code and let us know if you see the problem. 2. Given the download statistics from Sourceforge (current home of the driver) and hogchain.net (the original home of the driver), we believe the driver to be in use by dozens, if not hundreds, of users. We've received remarkably few bug reports: a couple of typos and and the TSO performance issue. This patch contains: drivers/net/Kconfig | 11 + drivers/net/Makefile|1 + drivers/net/atl1/Makefile | 30 + drivers/net/atl1/atl1.h | 266 + drivers/net/atl1/atl1_ethtool.c | 528 + drivers/net/atl1/atl1_hw.c | 797 + drivers/net/atl1/atl1_hw.h | 1053 + drivers/net/atl1/atl1_main.c| 2464 +++ drivers/net/atl1/atl1_param.c | 223 9 files changed, 5373 insertions(+), 0 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/
Re: [PATCH 2/4] atl1: Header files for Attansic L1 driver
On Thu, Jan 11, 2007 at 09:27:04AM +, Christoph Hellwig wrote: > On Wed, Jan 10, 2007 at 06:41:37PM -0600, Jay Cliburn wrote: > > +/** > > + * atl1.h - atl1 main header > > Please remove these kind of comments, they get out of date far too soon > and don't really help anything. (Also everywhere else in the driver) Is your concern here with the filename portion of the comment only, or with the entire comment including the copyright and other material? 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 2/4] atl1: Header files for Attansic L1 driver
From: Jay Cliburn <[EMAIL PROTECTED]> This patch contains the header files needed by the Attansic L1 gigabit ethernet adapter driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- atl1.h | 251 ++ atl1_hw.h| 991 +++ atl1_osdep.h | 78 3 files changed, 1320 insertions(+) diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h new file mode 100644 index 000..95a5fa1 --- /dev/null +++ b/drivers/net/atl1/atl1.h @@ -0,0 +1,251 @@ +/** atl1.h - atl1 main header + +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. +*/ + +#ifndef _ATL1_H_ +#define _ATL1_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "atl1_hw.h" + +#ifdef NETIF_F_TSO +#include +#endif + +#ifdef SIOCGMIIPHY +#include +#endif + +#ifdef SIOCETHTOOL +#include +#endif + +#ifdef NETIF_F_HW_VLAN_TX +#include +#endif + +#define BAR_0 0 + +#defineLBYTESWAP( a ) ( ( ( (a) & 0x00ff00ff ) << 8 ) | ( ( (a) & 0xff00ff00 ) >> 8 ) ) +#defineLONGSWAP( a ) ( ( LBYTESWAP( a ) << 16 ) | ( LBYTESWAP( a ) >> 16 ) ) +#defineSHORTSWAP( a ) ( ( (a) << 8 ) | ( (a) >> 8 ) ) + +struct at_adapter; + +#define AT_MAX_INTR3 + +#define AT_DEFAULT_TPD 256 +#define AT_MAX_TPD 1023 +#define AT_MIN_TPD 64 +#define AT_DEFAULT_RFD 512 +#define AT_MIN_RFD 128 +#define AT_MAX_RFD 2047 + +#define AT_DESC_UNUSED(R) \ + R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ + (R)->next_to_clean - (R)->next_to_use - 1) + +#define AT_DESC_USED(R) \ + (((R)->next_to_clean > (R)->next_to_use) ? \ + ((R)->count+(R)->next_to_use-(R)->next_to_clean+1) : \ + ((R)->next_to_use-(R)->next_to_clean+1)) + +#define AT_GET_DESC(R, i, type)(&(((type *)((R)->desc))[i])) +#define AT_RFD_DESC(R, i) AT_GET_DESC(R, i, struct rx_free_desc) +#define AT_TPD_DESC(R, i) AT_GET_DESC(R, i, struct tx_packet_desc) +#define AT_RRD_DESC(R, i) AT_GET_DESC(R, i, struct rx_return_desc) + +/** wrapper around a pointer to a socket buffer, + * so a DMA handle can be stored along with the buffer + */ +struct at_buffer { + struct sk_buff *skb; + u16 length; + u16 alloced; + dma_addr_t dma; +}; + +#define MAX_TX_BUF_LEN 0x3000 /* 12KB */ + +struct at_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 */ + u16 count; /* number of descriptors in the ring */ + + u16 hw_idx; /* hardware index */ + atomic_t next_to_clean; + atomic_t next_to_use; + struct at_buffer *buffer_info; +}; + +struct at_rfd_ring { + void *desc; + dma_addr_t dma; + u16 size; + u16 count; + atomic_t next_to_use; + u16 next_to_clean; + struct at_buffer *buffer_info; +}; + +struct at_rrd_ring { + void *desc; + dma_addr_t dma; + unsigned int size; + u16 count; + u16 next_to_use; + atomic_t next_to_clean; +}; + +struct at_ring_header { + /* pointer to the descriptor ring memory */ + void *desc; + /* physical adress of the descriptor ring */ + dma_addr_t dma; + /* length of descriptor ring in bytes */ + unsigned int size; +}; + +struct at_cmb { + struct coals_msg_block *cmb; + dma_addr_t dma; +}; + +struct at_smb { + struct stats_msg_block *smb; + dma_addr_t dma; +}; + +/* Statistics counters */ +struct at_sft_stats { + u64 rx_packets; + u64 tx_packets; + u64 rx_bytes; + u64 tx_bytes; + u64
[PATCH 0/4] atl1: Revised Attansic L1 ethernet driver
Based upon feedback from Stephen Hemminger and Francois Romieu, please consider this resubmitted patchset that provides support for the Attansic L1 gigabit ethernet adapter. This patchset is built against 2.6.19-rc6. The original patchset was submitted 20060927. The monolithic version of this patchset may be found at: ftp://hogchain.net/pub/linux/m2v/attansic/kernel_driver/atl1-2.0.2/atl1-2.0.2-kernel2.6.19.rc6.patch.bz2 As a reminder, this driver a modified version of the Attansic reference driver for the L1 ethernet adapter. Attansic has granted permission for its inclusion in the mainline kernel. The patch contains: Kconfig | 12 Makefile|1 atl1/Makefile | 30 atl1/atl1.h | 251 + atl1/atl1_ethtool.c | 530 ++ atl1/atl1_hw.c | 840 + atl1/atl1_hw.h | 991 atl1/atl1_main.c| 2551 atl1/atl1_osdep.h | 78 + atl1/atl1_param.c | 203 10 files changed, 5487 insertions(+) - 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/4] atl1: Build files for Attansic L1 driver
From: Jay Cliburn <[EMAIL PROTECTED]> This patch contains the build files for the Attansic L1 gigabit ethernet adapter driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- Kconfig | 12 Makefile |1 + atl1/Makefile | 30 ++ 3 files changed, 43 insertions(+) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 6e863aa..f503d10 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2329,6 +2329,18 @@ config QLA3XXX To compile this driver as a module, choose M here: the module will be called qla3xxx. +config ATL1 + tristate "Attansic(R) L1 Gigabit Ethernet support (EXPERIMENTAL)" + depends on NET_PCI && PCI && EXPERIMENTAL + select CRC32 + select MII + ---help--- + This driver supports Attansic L1 gigabit ethernet adapter. + + To compile this driver as a module, choose M here. The module + will be called atl1. + + endmenu # diff --git a/drivers/net/Makefile b/drivers/net/Makefile index f270bc4..b839af8 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_IXGB) += ixgb/ obj-$(CONFIG_CHELSIO_T1) += chelsio/ obj-$(CONFIG_EHEA) += ehea/ obj-$(CONFIG_BONDING) += bonding/ +obj-$(CONFIG_ATL1) += atl1/ obj-$(CONFIG_GIANFAR) += gianfar_driver.o gianfar_driver-objs := gianfar.o \ diff --git a/drivers/net/atl1/Makefile b/drivers/net/atl1/Makefile new file mode 100644 index 000..1a10b91 --- /dev/null +++ b/drivers/net/atl1/Makefile @@ -0,0 +1,30 @@ + +# +# Attansic L1 gigabit ethernet driver +# Copyright(c) 2005 - 2006 Attansic Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". +# + + +# +# Makefile for the Attansic L1 gigabit ethernet driver +# + +obj-$(CONFIG_ATL1) += atl1.o + +atl1-objs := atl1_main.o atl1_hw.o atl1_ethtool.o atl1_param.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/
[PATCH 4/4] atl1: Ancillary C files for Attansic L1 driver
From: Jay Cliburn <[EMAIL PROTECTED]> This patch contains auxiliary C files for the Attansic L1 gigabit ethernet adapter driver. Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- atl1_ethtool.c | 530 +++ atl1_hw.c | 840 + atl1_param.c | 203 + 3 files changed, 1573 insertions(+) diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c new file mode 100644 index 000..36da53a --- /dev/null +++ b/drivers/net/atl1/atl1_ethtool.c @@ -0,0 +1,530 @@ +/** atl1_ethtool.c - atl1 ethtool support + +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. +*/ + +#include + +#include "atl1.h" + +#ifdef SIOCETHTOOL +#include + +extern char at_driver_name[]; +extern char at_driver_version[]; +extern s32 at_up(struct at_adapter *adapter); +extern void at_down(struct at_adapter *adapter); +extern void at_reset(struct at_adapter *adapter); +extern s32 at_setup_ring_resources(struct at_adapter *adapter); +extern void at_free_ring_resources(struct at_adapter *adapter); +extern s32 at_phy_setup_autoneg_adv(struct at_hw *hw); +extern s32 at_write_phy_reg(struct at_hw *hw, u32 reg_addr, u16 phy_data); +extern s32 at_get_speed_and_duplex(struct at_hw *hw, u16 * speed, u16 * duplex); + +#ifdef ETHTOOL_GSTATS +struct at_stats { + char stat_string[ETH_GSTRING_LEN]; + int sizeof_stat; + int stat_offset; +}; + +#define AT_STAT(m) sizeof(((struct at_adapter *)0)->m), \ + offsetof(struct at_adapter, m) + +static struct at_stats at_gstrings_stats[] = { + {"rx_packets", AT_STAT(soft_stats.rx_packets)}, + {"tx_packets", AT_STAT(soft_stats.tx_packets)}, + {"rx_bytes", AT_STAT(soft_stats.rx_bytes)}, + {"tx_bytes", AT_STAT(soft_stats.tx_bytes)}, + {"rx_errors", AT_STAT(soft_stats.rx_errors)}, + {"tx_errors", AT_STAT(soft_stats.tx_errors)}, + {"rx_dropped", AT_STAT(net_stats.rx_dropped)}, + {"tx_dropped", AT_STAT(net_stats.tx_dropped)}, + {"multicast", AT_STAT(soft_stats.multicast)}, + {"collisions", AT_STAT(soft_stats.collisions)}, + {"rx_length_errors", AT_STAT(soft_stats.rx_length_errors)}, + {"rx_over_errors", AT_STAT(soft_stats.rx_missed_errors)}, + {"rx_crc_errors", AT_STAT(soft_stats.rx_crc_errors)}, + {"rx_frame_errors", AT_STAT(soft_stats.rx_frame_errors)}, + {"rx_fifo_errors", AT_STAT(soft_stats.rx_fifo_errors)}, + {"rx_missed_errors", AT_STAT(soft_stats.rx_missed_errors)}, + {"tx_aborted_errors", AT_STAT(soft_stats.tx_aborted_errors)}, + {"tx_carrier_errors", AT_STAT(soft_stats.tx_carrier_errors)}, + {"tx_fifo_errors", AT_STAT(soft_stats.tx_fifo_errors)}, + {"tx_window_errors", AT_STAT(soft_stats.tx_window_errors)}, + {"tx_abort_exce_coll", AT_STAT(soft_stats.excecol)}, + {"tx_abort_late_coll", AT_STAT(soft_stats.latecol)}, + {"tx_deferred_ok", AT_STAT(soft_stats.deffer)}, + {"tx_single_coll_ok", AT_STAT(soft_stats.scc)}, + {"tx_multi_coll_ok", AT_STAT(soft_stats.mcc)}, + {"tx_underun", AT_STAT(soft_stats.tx_underun)}, + {"tx_trunc", AT_STAT(soft_stats.tx_trunc)}, + {"tx_pause", AT_STAT(soft_stats.tx_pause)}, + {"rx_pause", AT_STAT(soft_stats.rx_pause)}, + {"rx_rrd_ov", AT_STAT(soft_stats.rx_rrd_ov)}, + {"rx_trunc", AT_STAT(soft_stats.rx_trunc)} +}; + +#define AT_STATS_LEN sizeof(at_gstrings_stats) / sizeof(struct at_stats) +#endif /* ETHTOOL_GSTATS */ + +static int at_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) +{ + struct at_adapter *adapter = netdev_priv(netdev); + struct at_hw *hw = &ad
Re: [PATCH 0/4] atl1: Revised Attansic L1 ethernet driver
Luca Tettamanti wrote: Got the board, done some basic testing: so far so good :) The controller also supports MSI and (at least with my chipset - G965) it works fine: 218: 80649 0 PCI-MSI-edge eth1 which is nice, otherwise it ends up sharing the IRQ with SATA and USB. I also have a small patch: Thanks for the patch. We'll add it for the next version. FYI, TSO performance is _really_ bad; your tx speed will drop dramatically with TSO on (and it's on by default). I haven't yet been able to find the problem. If you want to improve tx performance, turn off TSO with ethtool. 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
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
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: Attansic L1 page corruption
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
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&forum_name=atl1-devel Asus P5K (LGA775): 2 reports of lockups http://sourceforge.net/mailarchive/forum.php?thread_name=467E7E34.4010603%40gmail.com&forum_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/
[stable][PATCH] pci: quirk disable MSI on via vt3351
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
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: Problem with atl1 and msi in kernel 2.6.22-rc3
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
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/
[PATCH 0/5] atl1: miscellaneous cleanup and code reorganization
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
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
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-> -
[PATCH 2/5] atl1: header file cleanup
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 3/5] atl1: cleanup atl1_main
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&m=116398508500553&w=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 + -
Re: APIC error on 32-bit kernel
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] atl1: disable 64bit DMA
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/
How to enable dev_dbg messaging
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] pci-quirks: disable MSI on RS400-200 and RS480, take #2
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
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: APIC error on 32-bit kernel
[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
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/
[PATCH] atl1: remove unnecessary crc inversion
From: Jay Cliburn <[EMAIL PROTECTED]> The original vendor driver contained a private ether_crc_le() function that produced an inverted crc. When we changed to the kernel version of ether_crc_le(), we neglected to undo the inversion. Let's do it now. Discovered by and patch proffered by Jose Alberto Reguero. Signed-off-by: Jose Alberto Reguero <[EMAIL PROTECTED]> Signed-off-by: Jay Cliburn <[EMAIL PROTECTED]> --- drivers/net/atl1/atl1_hw.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c index 314dbaa..69482e0 100644 --- a/drivers/net/atl1/atl1_hw.c +++ b/drivers/net/atl1/atl1_hw.c @@ -334,7 +334,6 @@ u32 atl1_hash_mc_addr(struct atl1_hw *hw, u8 *mc_addr) int i; crc32 = ether_crc_le(6, mc_addr); - crc32 = ~crc32; for (i = 0; i < 32; i++) value |= (((crc32 >> i) & 1) << (31 - i)); - 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.21-rc5: known regressions with patches
On Wed, 28 Mar 2007 01:00:24 +0200 Adrian Bunk <[EMAIL PROTECTED]> wrote: > Subject: atl1 net driver: problem with sockets > References : http://lkml.org/lkml/2007/3/21/248 > Submitter : Jose Alberto Reguero <[EMAIL PROTECTED]> > Patch : http://marc.info/?l=linux-netdev&m=117502041808665&w=2 > Status : patch available Patch submitted to netdev. http://lkml.org/lkml/2007/3/27/321 Best, 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 0/2] atl1: minor cleanup
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
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
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_de