diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-24 10:15:13 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-24 10:15:13 -0700 |
commit | a319a2773a13bab56a0d0b3744ba8703324313b5 (patch) | |
tree | f02c86acabd1031439fd422a167784007e84ebb1 /drivers/net/cassini.c | |
parent | e18fa700c9a31360bc8f193aa543b7ef7b39a06b (diff) | |
parent | 183798799216fad36c7219fe8d4d6dee6b8fa755 (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (217 commits)
net/ieee80211: fix more crypto-related build breakage
[PATCH] Spidernet: add ethtool -S (show statistics)
[NET] GT96100: Delete bitrotting ethernet driver
[PATCH] mv643xx_eth: restrict to 32-bit PPC_MULTIPLATFORM
[PATCH] Cirrus Logic ep93xx ethernet driver
r8169: the MMIO region of the 8167 stands behin BAR#1
e1000, ixgb: Remove pointless wrappers
[PATCH] Remove powerpc specific parts of 3c509 driver
[PATCH] s2io: Switch to pci_get_device
[PATCH] gt96100: move to pci_get_device API
[PATCH] ehea: bugfix for register access functions
[PATCH] e1000 disable device on PCI error
drivers/net/phy/fixed: #if 0 some incomplete code
drivers/net: const-ify ethtool_ops declarations
[PATCH] ethtool: allow const ethtool_ops
[PATCH] sky2: big endian
[PATCH] sky2: fiber support
[PATCH] sky2: tx pause bug fix
drivers/net: Trim trailing whitespace
[PATCH] ehea: IBM eHEA Ethernet Device Driver
...
Manually resolved conflicts in drivers/net/ixgb/ixgb_main.c and
drivers/net/sky2.c related to CHECKSUM_HW/CHECKSUM_PARTIAL changes by
commit 84fa7933a33f806bbbaae6775e87459b1ec584c0 that just happened to be
next to unrelated changes in this update.
Diffstat (limited to 'drivers/net/cassini.c')
-rw-r--r-- | drivers/net/cassini.c | 540 |
1 files changed, 270 insertions, 270 deletions
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 558fdb8ad2d..7694365092f 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c @@ -43,7 +43,7 @@ * -- on page reclamation, the driver swaps the page with a spare page. * if that page is still in use, it frees its reference to that page, * and allocates a new page for use. otherwise, it just recycles the - * the page. + * the page. * * NOTE: cassini can parse the header. however, it's not worth it * as long as the network stack requires a header copy. @@ -60,10 +60,10 @@ * interrupts, but the INT# assignment needs to be set up properly by * the BIOS and conveyed to the driver. PCI BIOSes don't know how to do * that. also, the two descriptor rings are designed to distinguish between - * encrypted and non-encrypted packets, but we use them for buffering + * encrypted and non-encrypted packets, but we use them for buffering * instead. * - * by default, the selective clear mask is set up to process rx packets. + * by default, the selective clear mask is set up to process rx packets. */ @@ -112,7 +112,7 @@ #endif /* select which firmware to use */ -#define USE_HP_WORKAROUND +#define USE_HP_WORKAROUND #define HP_WORKAROUND_DEFAULT /* select which firmware to use as default */ #define CAS_HP_ALT_FIRMWARE cas_prog_null /* alternate firmware */ @@ -168,7 +168,7 @@ #define STOP_TRIES_PHY 1000 #define STOP_TRIES 5000 -/* specify a minimum frame size to deal with some fifo issues +/* specify a minimum frame size to deal with some fifo issues * max mtu == 2 * page size - ethernet header - 64 - swivel = * 2 * page_size - 0x50 */ @@ -207,7 +207,7 @@ MODULE_PARM_DESC(link_mode, "default link mode"); * being confused and never showing a link status of "up." */ #define DEFAULT_LINKDOWN_TIMEOUT 5 -/* +/* * Value in seconds, for user input. */ static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT; @@ -249,7 +249,7 @@ static inline void cas_lock_tx(struct cas *cp) { int i; - for (i = 0; i < N_TX_RINGS; i++) + for (i = 0; i < N_TX_RINGS; i++) spin_lock(&cp->tx_lock[i]); } @@ -278,8 +278,8 @@ static inline void cas_unlock_tx(struct cas *cp) { int i; - for (i = N_TX_RINGS; i > 0; i--) - spin_unlock(&cp->tx_lock[i - 1]); + for (i = N_TX_RINGS; i > 0; i--) + spin_unlock(&cp->tx_lock[i - 1]); } static inline void cas_unlock_all(struct cas *cp) @@ -316,7 +316,7 @@ static void cas_disable_irq(struct cas *cp, const int ring) #ifdef USE_PCI_INTD case 3: #endif - writel(INTRN_MASK_CLEAR_ALL | INTRN_MASK_RX_EN, + writel(INTRN_MASK_CLEAR_ALL | INTRN_MASK_RX_EN, cp->regs + REG_PLUS_INTRN_MASK(ring)); break; #endif @@ -415,7 +415,7 @@ static inline void cas_entropy_reset(struct cas *cp) if ((cp->cas_flags & CAS_FLAG_ENTROPY_DEV) == 0) return; - writel(BIM_LOCAL_DEV_PAD | BIM_LOCAL_DEV_PROM | BIM_LOCAL_DEV_EXT, + writel(BIM_LOCAL_DEV_PAD | BIM_LOCAL_DEV_PROM | BIM_LOCAL_DEV_EXT, cp->regs + REG_BIM_LOCAL_DEV_EN); writeb(ENTROPY_RESET_STC_MODE, cp->regs + REG_ENTROPY_RESET); writeb(0x55, cp->regs + REG_ENTROPY_RAND_REG); @@ -426,7 +426,7 @@ static inline void cas_entropy_reset(struct cas *cp) #endif } -/* access to the phy. the following assumes that we've initialized the MIF to +/* access to the phy. the following assumes that we've initialized the MIF to * be in frame rather than bit-bang mode */ static u16 cas_phy_read(struct cas *cp, int reg) @@ -439,7 +439,7 @@ static u16 cas_phy_read(struct cas *cp, int reg) cmd |= CAS_BASE(MIF_FRAME_REG_ADDR, reg); cmd |= MIF_FRAME_TURN_AROUND_MSB; writel(cmd, cp->regs + REG_MIF_FRAME); - + /* poll for completion */ while (limit-- > 0) { udelay(10); @@ -461,7 +461,7 @@ static int cas_phy_write(struct cas *cp, int reg, u16 val) cmd |= MIF_FRAME_TURN_AROUND_MSB; cmd |= val & MIF_FRAME_DATA_MASK; writel(cmd, cp->regs + REG_MIF_FRAME); - + /* poll for completion */ while (limit-- > 0) { udelay(10); @@ -474,7 +474,7 @@ static int cas_phy_write(struct cas *cp, int reg, u16 val) static void cas_phy_powerup(struct cas *cp) { - u16 ctl = cas_phy_read(cp, MII_BMCR); + u16 ctl = cas_phy_read(cp, MII_BMCR); if ((ctl & BMCR_PDOWN) == 0) return; @@ -484,7 +484,7 @@ static void cas_phy_powerup(struct cas *cp) static void cas_phy_powerdown(struct cas *cp) { - u16 ctl = cas_phy_read(cp, MII_BMCR); + u16 ctl = cas_phy_read(cp, MII_BMCR); if (ctl & BMCR_PDOWN) return; @@ -495,7 +495,7 @@ static void cas_phy_powerdown(struct cas *cp) /* cp->lock held. note: the last put_page will free the buffer */ static int cas_page_free(struct cas *cp, cas_page_t *page) { - pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, + pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, PCI_DMA_FROMDEVICE); cas_buffer_dec(page); __free_pages(page->buffer, cp->page_order); @@ -507,7 +507,7 @@ static int cas_page_free(struct cas *cp, cas_page_t *page) #define RX_USED_ADD(x, y) ((x)->used += (y)) #define RX_USED_SET(x, y) ((x)->used = (y)) #else -#define RX_USED_ADD(x, y) +#define RX_USED_ADD(x, y) #define RX_USED_SET(x, y) #endif @@ -602,7 +602,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags) list_splice(&cp->rx_inuse_list, &list); INIT_LIST_HEAD(&cp->rx_inuse_list); spin_unlock(&cp->rx_inuse_lock); - + list_for_each_safe(elem, tmp, &list) { cas_page_t *page = list_entry(elem, cas_page_t, list); @@ -627,7 +627,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags) list_splice(&list, &cp->rx_inuse_list); spin_unlock(&cp->rx_inuse_lock); } - + spin_lock(&cp->rx_spare_lock); needed = cp->rx_spares_needed; spin_unlock(&cp->rx_spare_lock); @@ -639,7 +639,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags) i = 0; while (i < needed) { cas_page_t *spare = cas_page_alloc(cp, flags); - if (!spare) + if (!spare) break; list_add(&spare->list, &list); i++; @@ -695,12 +695,12 @@ static cas_page_t *cas_page_dequeue(struct cas *cp) static void cas_mif_poll(struct cas *cp, const int enable) { u32 cfg; - - cfg = readl(cp->regs + REG_MIF_CFG); + + cfg = readl(cp->regs + REG_MIF_CFG); cfg &= (MIF_CFG_MDIO_0 | MIF_CFG_MDIO_1); if (cp->phy_type & CAS_PHY_MII_MDIO1) - cfg |= MIF_CFG_PHY_SELECT; + cfg |= MIF_CFG_PHY_SELECT; /* poll and interrupt on link status change. */ if (enable) { @@ -708,8 +708,8 @@ static void cas_mif_poll(struct cas *cp, const int enable) cfg |= CAS_BASE(MIF_CFG_POLL_REG, MII_BMSR); cfg |= CAS_BASE(MIF_CFG_POLL_PHY, cp->phy_addr); } - writel((enable) ? ~(BMSR_LSTATUS | BMSR_ANEGCOMPLETE) : 0xFFFF, - cp->regs + REG_MIF_MASK); + writel((enable) ? ~(BMSR_LSTATUS | BMSR_ANEGCOMPLETE) : 0xFFFF, + cp->regs + REG_MIF_MASK); writel(cfg, cp->regs + REG_MIF_CFG); } @@ -759,7 +759,7 @@ start_aneg: /* * WTZ: If the old state was link_up, we turn off the carrier * to replicate everything we do elsewhere on a link-down - * event when we were already in a link-up state.. + * event when we were already in a link-up state.. */ if (oldstate == link_up) netif_carrier_off(cp->dev); @@ -767,7 +767,7 @@ start_aneg: /* * WTZ: This branch will simply schedule a full reset after * we explicitly changed link modes in an ioctl. See if this - * fixes the link-problems we were having for forced mode. + * fixes the link-problems we were having for forced mode. */ atomic_inc(&cp->reset_task_pending); atomic_inc(&cp->reset_task_pending_all); @@ -795,7 +795,7 @@ start_aneg: } else { cas_mif_poll(cp, 0); ctl = cas_phy_read(cp, MII_BMCR); - ctl &= ~(BMCR_FULLDPLX | BMCR_SPEED100 | + ctl &= ~(BMCR_FULLDPLX | BMCR_SPEED100 | CAS_BMCR_SPEED1000 | BMCR_ANENABLE); ctl |= cp->link_cntl; if (ctl & BMCR_ANENABLE) { @@ -818,7 +818,7 @@ static int cas_reset_mii_phy(struct cas *cp) { int limit = STOP_TRIES_PHY; u16 val; - + cas_phy_write(cp, MII_BMCR, BMCR_RESET); udelay(100); while (limit--) { @@ -901,17 +901,17 @@ static void cas_phy_init(struct cas *cp) val = cas_phy_read(cp, BROADCOM_MII_REG4); if (val & 0x0080) { /* link workaround */ - cas_phy_write(cp, BROADCOM_MII_REG4, + cas_phy_write(cp, BROADCOM_MII_REG4, val & ~0x0080); } - + } else if (cp->cas_flags & CAS_FLAG_SATURN) { - writel((cp->phy_type & CAS_PHY_MII_MDIO0) ? - SATURN_PCFG_FSI : 0x0, + writel((cp->phy_type & CAS_PHY_MII_MDIO0) ? + SATURN_PCFG_FSI : 0x0, cp->regs + REG_SATURN_PCFG); /* load firmware to address 10Mbps auto-negotiation - * issue. NOTE: this will need to be changed if the + * issue. NOTE: this will need to be changed if the * default firmware gets fixed. */ if (PHY_NS_DP83065 == cp->phy_id) { @@ -930,9 +930,9 @@ static void cas_phy_init(struct cas *cp) cas_phy_read(cp, MII_ADVERTISE) | (ADVERTISE_10HALF | ADVERTISE_10FULL | ADVERTISE_100HALF | ADVERTISE_100FULL | - CAS_ADVERTISE_PAUSE | + CAS_ADVERTISE_PAUSE | CAS_ADVERTISE_ASYM_PAUSE)); - + if (cp->cas_flags & CAS_FLAG_1000MB_CAP) { /* make sure that we don't advertise half * duplex to avoid a chip issue @@ -963,7 +963,7 @@ static void cas_phy_init(struct cas *cp) limit = STOP_TRIES; while (limit-- > 0) { udelay(10); - if ((readl(cp->regs + REG_PCS_MII_CTRL) & + if ((readl(cp->regs + REG_PCS_MII_CTRL) & PCS_MII_RESET) == 0) break; } @@ -980,7 +980,7 @@ static void cas_phy_init(struct cas *cp) /* Advertise all capabilities except half-duplex. */ val = readl(cp->regs + REG_PCS_MII_ADVERT); val &= ~PCS_MII_ADVERT_HD; - val |= (PCS_MII_ADVERT_FD | PCS_MII_ADVERT_SYM_PAUSE | + val |= (PCS_MII_ADVERT_FD | PCS_MII_ADVERT_SYM_PAUSE | PCS_MII_ADVERT_ASYM_PAUSE); writel(val, cp->regs + REG_PCS_MII_ADVERT); @@ -1014,7 +1014,7 @@ static int cas_pcs_link_check(struct cas *cp) PCS_MII_STATUS_REMOTE_FAULT)) == (PCS_MII_STATUS_AUTONEG_COMP | PCS_MII_STATUS_REMOTE_FAULT)) { if (netif_msg_link(cp)) - printk(KERN_INFO "%s: PCS RemoteFault\n", + printk(KERN_INFO "%s: PCS RemoteFault\n", cp->dev->name); } @@ -1033,7 +1033,7 @@ static int cas_pcs_link_check(struct cas *cp) if (cp->opened) { cp->lstate = link_up; cp->link_transition = LINK_TRANSITION_LINK_UP; - + cas_set_link_modes(cp); netif_carrier_on(cp->dev); } @@ -1044,8 +1044,8 @@ static int cas_pcs_link_check(struct cas *cp) cp->link_transition != LINK_TRANSITION_REQUESTED_RESET && !cp->link_transition_jiffies_valid) { /* - * force a reset, as a workaround for the - * link-failure problem. May want to move this to a + * force a reset, as a workaround for the + * link-failure problem. May want to move this to a * point a bit earlier in the sequence. If we had * generated a reset a short time ago, we'll wait for * the link timer to check the status until a @@ -1103,17 +1103,17 @@ static int cas_pcs_link_check(struct cas *cp) return retval; } -static int cas_pcs_interrupt(struct net_device *dev, +static int cas_pcs_interrupt(struct net_device *dev, struct cas *cp, u32 status) { u32 stat = readl(cp->regs + REG_PCS_INTR_STATUS); - if ((stat & PCS_INTR_STATUS_LINK_CHANGE) == 0) + if ((stat & PCS_INTR_STATUS_LINK_CHANGE) == 0) return 0; return cas_pcs_link_check(cp); } -static int cas_txmac_interrupt(struct net_device *dev, +static int cas_txmac_interrupt(struct net_device *dev, struct cas *cp, u32 status) { u32 txmac_stat = readl(cp->regs + REG_MAC_TX_STATUS); @@ -1168,7 +1168,7 @@ static int cas_txmac_interrupt(struct net_device *dev, return 0; } -static void cas_load_firmware(struct cas *cp, cas_hp_inst_t *firmware) +static void cas_load_firmware(struct cas *cp, cas_hp_inst_t *firmware) { cas_hp_inst_t *inst; u32 val; @@ -1203,12 +1203,12 @@ static void cas_load_firmware(struct cas *cp, cas_hp_inst_t *firmware) static void cas_init_rx_dma(struct cas *cp) { - u64 desc_dma = cp->block_dvma; + u64 desc_dma = cp->block_dvma; u32 val; int i, size; /* rx free descriptors */ - val = CAS_BASE(RX_CFG_SWIVEL, RX_SWIVEL_OFF_VAL); + val = CAS_BASE(RX_CFG_SWIVEL, RX_SWIVEL_OFF_VAL); val |= CAS_BASE(RX_CFG_DESC_RING, RX_DESC_RINGN_INDEX(0)); val |= CAS_BASE(RX_CFG_COMP_RING, RX_COMP_RINGN_INDEX(0)); if ((N_RX_DESC_RINGS > 1) && @@ -1216,27 +1216,27 @@ static void cas_init_rx_dma(struct cas *cp) val |= CAS_BASE(RX_CFG_DESC_RING1, RX_DESC_RINGN_INDEX(1)); writel(val, cp->regs + REG_RX_CFG); - val = (unsigned long) cp->init_rxds[0] - + val = (unsigned long) cp->init_rxds[0] - (unsigned long) cp->init_block; writel((desc_dma + val) >> 32, cp->regs + REG_RX_DB_HI); writel((desc_dma + val) & 0xffffffff, cp->regs + REG_RX_DB_LOW); writel(RX_DESC_RINGN_SIZE(0) - 4, cp->regs + REG_RX_KICK); if (cp->cas_flags & CAS_FLAG_REG_PLUS) { - /* rx desc 2 is for IPSEC packets. however, + /* rx desc 2 is for IPSEC packets. however, * we don't it that for that purpose. */ - val = (unsigned long) cp->init_rxds[1] - + val = (unsigned long) cp->init_rxds[1] - (unsigned long) cp->init_block; writel((desc_dma + val) >> 32, cp->regs + REG_PLUS_RX_DB1_HI); - writel((desc_dma + val) & 0xffffffff, cp->regs + + writel((desc_dma + val) & 0xffffffff, cp->regs + REG_PLUS_RX_DB1_LOW); - writel(RX_DESC_RINGN_SIZE(1) - 4, cp->regs + + writel(RX_DESC_RINGN_SIZE(1) - 4, cp->regs + REG_PLUS_RX_KICK1); } - + /* rx completion registers */ - val = (unsigned long) cp->init_rxcs[0] - + val = (unsigned long) cp->init_rxcs[0] - (unsigned long) cp->init_block; writel((desc_dma + val) >> 32, cp->regs + REG_RX_CB_HI); writel((desc_dma + val) & 0xffffffff, cp->regs + REG_RX_CB_LOW); @@ -1244,11 +1244,11 @@ static void cas_init_rx_dma(struct cas *cp) if (cp->cas_flags & CAS_FLAG_REG_PLUS) { /* rx comp 2-4 */ for (i = 1; i < MAX_RX_COMP_RINGS; i++) { - val = (unsigned long) cp->init_rxcs[i] - + val = (unsigned long) cp->init_rxcs[i] - (unsigned long) cp->init_block; - writel((desc_dma + val) >> 32, cp->regs + + writel((desc_dma + val) >> 32, cp->regs + REG_PLUS_RX_CBN_HI(i)); - writel((desc_dma + val) & 0xffffffff, cp->regs + + writel((desc_dma + val) & 0xffffffff, cp->regs + REG_PLUS_RX_CBN_LOW(i)); } } @@ -1265,21 +1265,21 @@ static void cas_init_rx_dma(struct cas *cp) /* 2 is different from 3 and 4 */ if (N_RX_COMP_RINGS > 1) - writel(INTR_RX_DONE_ALT | INTR_RX_BUF_UNAVAIL_1, + writel(INTR_RX_DONE_ALT | INTR_RX_BUF_UNAVAIL_1, cp->regs + REG_PLUS_ALIASN_CLEAR(1)); - for (i = 2; i < N_RX_COMP_RINGS; i++) - writel(INTR_RX_DONE_ALT, + for (i = 2; i < N_RX_COMP_RINGS; i++) + writel(INTR_RX_DONE_ALT, cp->regs + REG_PLUS_ALIASN_CLEAR(i)); } /* set up pause thresholds */ val = CAS_BASE(RX_PAUSE_THRESH_OFF, cp->rx_pause_off / RX_PAUSE_THRESH_QUANTUM); - val |= CAS_BASE(RX_PAUSE_THRESH_ON, + val |= CAS_BASE(RX_PAUSE_THRESH_ON, cp->rx_pause_on / RX_PAUSE_THRESH_QUANTUM); writel(val, cp->regs + REG_RX_PAUSE_THRESH); - + /* zero out dma reassembly buffers */ for (i = 0; i < 64; i++) { writel(i, cp->regs + REG_RX_TABLE_ADDR); @@ -1318,7 +1318,7 @@ static void cas_init_rx_dma(struct cas *cp) * this should be tunable. */ writel(0x0, cp->regs + REG_RX_RED); - + /* receive page sizes. default == 2K (0x800) */ val = 0; if (cp->page_size == 0x1000) @@ -1327,7 +1327,7 @@ static void cas_init_rx_dma(struct cas *cp) val = 0x2; else if (cp->page_size == 0x4000) val = 0x3; - + /* round mtu + offset. constrain to page size. */ size = cp->dev->mtu + 64; if (size > cp->page_size) @@ -1344,11 +1344,11 @@ static void cas_init_rx_dma(struct cas *cp) cp->mtu_stride = 1 << (i + 10); val = CAS_BASE(RX_PAGE_SIZE, val); - val |= CAS_BASE(RX_PAGE_SIZE_MTU_STRIDE, i); + val |= CAS_BASE(RX_PAGE_SIZE_MTU_STRIDE, i); val |= CAS_BASE(RX_PAGE_SIZE_MTU_COUNT, cp->page_size >> (i + 10)); val |= CAS_BASE(RX_PAGE_SIZE_MTU_OFF, 0x1); writel(val, cp->regs + REG_RX_PAGE_SIZE); - + /* enable the header parser if desired */ if (CAS_HP_FIRMWARE == cas_prog_null) return; @@ -1362,7 +1362,7 @@ static void cas_init_rx_dma(struct cas *cp) static inline void cas_rxc_init(struct cas_rx_comp *rxc) { memset(rxc, 0, sizeof(*rxc)); - rxc->word4 = cpu_to_le64(RX_COMP4_ZERO); + rxc->word4 = cpu_to_le64(RX_COMP4_ZERO); } /* NOTE: we use the ENC RX DESC ring for spares. the rx_page[0,1] @@ -1385,9 +1385,9 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index) } return new; } - + /* this needs to be changed if we actually use the ENC RX DESC ring */ -static cas_page_t *cas_page_swap(struct cas *cp, const int ring, +static cas_page_t *cas_page_swap(struct cas *cp, const int ring, const int index) { cas_page_t **page0 = cp->rx_pages[0]; @@ -1400,7 +1400,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring, page1[index] = page0[index]; page0[index] = new; } - } + } RX_USED_SET(page0[index], 0); return page0[index]; } @@ -1424,11 +1424,11 @@ static void cas_clean_rxds(struct cas *cp) for (i = 0; i < size; i++) { cas_page_t *page = cas_page_swap(cp, 0, i); rxd[i].buffer = cpu_to_le64(page->dma_addr); - rxd[i].index = cpu_to_le64(CAS_BASE(RX_INDEX_NUM, i) | + rxd[i].index = cpu_to_le64(CAS_BASE(RX_INDEX_NUM, i) | CAS_BASE(RX_INDEX_RING, 0)); } - cp->rx_old[0] = RX_DESC_RINGN_SIZE(0) - 4; + cp->rx_old[0] = RX_DESC_RINGN_SIZE(0) - 4; cp->rx_last[0] = 0; cp->cas_flags &= ~CAS_FLAG_RXD_POST(0); } @@ -1533,7 +1533,7 @@ static int cas_rxmac_interrupt(struct net_device *dev, struct cas *cp, /* these are all rollovers */ spin_lock(&cp->stat_lock[0]); - if (stat & MAC_RX_ALIGN_ERR) + if (stat & MAC_RX_ALIGN_ERR) cp->net_stats[0].rx_frame_errors += 0x10000; if (stat & MAC_RX_CRC_ERR) @@ -1579,12 +1579,12 @@ static int cas_mac_interrupt(struct net_device *dev, struct cas *cp, return 0; } - + /* Must be invoked under cp->lock. */ static inline int cas_mdio_link_not_up(struct cas *cp) { u16 val; - + switch (cp->lstate) { case link_force_ret: if (netif_msg_link(cp)) @@ -1595,7 +1595,7 @@ static inline int cas_mdio_link_not_up(struct cas *cp) cp->lstate = link_force_ok; cp->link_transition = LINK_TRANSITION_LINK_CONFIG; break; - + case link_aneg: val = cas_phy_read(cp, MII_BMCR); @@ -1604,7 +1604,7 @@ static inline int cas_mdio_link_not_up(struct cas *cp) */ val &= ~(BMCR_ANRESTART | BMCR_ANENABLE); val |= BMCR_FULLDPLX; - val |= (cp->cas_flags & CAS_FLAG_1000MB_CAP) ? + val |= (cp->cas_flags & CAS_FLAG_1000MB_CAP) ? CAS_BMCR_SPEED1000 : BMCR_SPEED100; cas_phy_write(cp, MII_BMCR, val); cp->timer_ticks = 5; @@ -1646,11 +1646,11 @@ static int cas_mii_link_check(struct cas *cp, const u16 bmsr) if (bmsr & BMSR_LSTATUS) { /* Ok, here we got a link. If we had it due to a forced - * fallback, and we were configured for autoneg, we + * fallback, and we were configured for autoneg, we * retry a short autoneg pass. If you know your hub is * broken, use ethtool ;) */ - if ((cp->lstate == link_force_try) && + if ((cp->lstate == link_force_try) && (cp->link_cntl & BMCR_ANENABLE)) { cp->lstate = link_force_ret; cp->link_transition = LINK_TRANSITION_LINK_CONFIG; @@ -1690,10 +1690,10 @@ static int cas_mii_link_check(struct cas *cp, const u16 bmsr) printk(KERN_INFO "%s: Link down\n", cp->dev->name); restart = 1; - + } else if (++cp->timer_ticks > 10) cas_mdio_link_not_up(cp); - + return restart; } @@ -1908,7 +1908,7 @@ static inline void cas_tx_ringN(struct cas *cp, int ring, int limit) skbs[entry] = NULL; cp->tx_tiny_use[ring][entry].nbufs = 0; - + for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) { struct cas_tx_desc *txd = txds + entry; @@ -1923,7 +1923,7 @@ static inline void cas_tx_ringN(struct cas *cp, int ring, int limit) if (cp->tx_tiny_use[ring][entry].used) { cp->tx_tiny_use[ring][entry].used = 0; entry = TX_DESC_NEXT(ring, entry); - } + } } spin_lock(&cp->stat_lock[ring]); @@ -1964,14 +1964,14 @@ static void cas_tx(struct net_device *dev, struct cas *cp, #else limit = readl(cp->regs + REG_TX_COMPN(ring)); #endif - if (cp->tx_old[ring] != limit) + if (cp->tx_old[ring] != limit) cas_tx_ringN(cp, ring, limit); } } -static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, - int entry, const u64 *words, +static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, + int entry, const u64 *words, struct sk_buff **skbref) { int dlen, hlen, len, i, alloclen; @@ -1979,19 +1979,19 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, struct cas_page *page; struct sk_buff *skb; void *addr, *crcaddr; - char *p; + char *p; hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]); dlen = CAS_VAL(RX_COMP1_DATA_SIZE, words[0]); len = hlen + dlen; - if (RX_COPY_ALWAYS || (words[2] & RX_COMP3_SMALL_PKT)) + if (RX_COPY_ALWAYS || (words[2] & RX_COMP3_SMALL_PKT)) alloclen = len; - else + else alloclen = max(hlen, RX_COPY_MIN); skb = dev_alloc_skb(alloclen + swivel + cp->crc_size); - if (skb == NULL) + if (skb == NULL) return -1; *skbref = skb; @@ -2003,7 +2003,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, if (hlen) { /* always copy header pages */ i = CAS_VAL(RX_COMP2_HDR_INDEX, words[1]); page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)]; - off = CAS_VAL(RX_COMP2_HDR_OFF, words[1]) * 0x100 + + off = CAS_VAL(RX_COMP2_HDR_OFF, words[1]) * 0x100 + swivel; i = hlen; @@ -2019,7 +2019,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, RX_USED_ADD(page, 0x100); p += hlen; swivel = 0; - } + } if (alloclen < (hlen + dlen)) { @@ -2070,7 +2070,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, frag->page = page->buffer; frag->page_offset = off; frag->size = hlen - swivel; - + /* any more data? */ if ((words[0] & RX_COMP1_SPLIT_PKT) && ((dlen -= hlen) > 0)) { hlen = dlen; @@ -2078,8 +2078,8 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, i = CAS_VAL(RX_COMP2_NEXT_INDEX, words[1]); page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)]; - pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr, - hlen + cp->crc_size, + pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr, + hlen + cp->crc_size, PCI_DMA_FROMDEVICE); pci_dma_sync_single_for_device(cp->pdev, page->dma_addr, hlen + cp->crc_size, @@ -2087,7 +2087,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, skb_shinfo(skb)->nr_frags++; skb->data_len += hlen; - skb->len += hlen; + skb->len += hlen; frag++; get_page(page->buffer); @@ -2134,14 +2134,14 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, RX_USED_ADD(page, cp->mtu_stride); else RX_USED_ADD(page, i); - + /* any more data? */ if ((words[0] & RX_COMP1_SPLIT_PKT) && ((dlen -= hlen) > 0)) { p += hlen; i = CAS_VAL(RX_COMP2_NEXT_INDEX, words[1]); page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)]; - pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr, - dlen + cp->crc_size, + pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr, + dlen + cp->crc_size, PCI_DMA_FROMDEVICE); addr = cas_page_map(page->buffer); memcpy(p, addr, dlen + cp->crc_size); @@ -2149,7 +2149,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, dlen + cp->crc_size, PCI_DMA_FROMDEVICE); cas_page_unmap(addr); - RX_USED_ADD(page, dlen + cp->crc_size); + RX_USED_ADD(page, dlen + cp->crc_size); } end_copy_pkt: if (cp->crc_size) { @@ -2174,7 +2174,7 @@ end_copy_pkt: /* we can handle up to 64 rx flows at a time. we do the same thing - * as nonreassm except that we batch up the buffers. + * as nonreassm except that we batch up the buffers. * NOTE: we currently just treat each flow as a bunch of packets that * we pass up. a better way would be to coalesce the packets * into a jumbo packet. to do that, we need to do the following: @@ -2184,7 +2184,7 @@ end_copy_pkt: * data length and merge the checksums. * 3) on flow release, fix up the header. * 4) make sure the higher layer doesn't care. - * because packets get coalesced, we shouldn't run into fragment count + * because packets get coalesced, we shouldn't run into fragment count * issues. */ static inline void cas_rx_flow_pkt(struct cas *cp, const u64 *words, @@ -2192,8 +2192,8 @@ static inline void cas_rx_flow_pkt(struct cas *cp, const u64 *words, { int flowid = CAS_VAL(RX_COMP3_FLOWID, words[2]) & (N_RX_FLOWS - 1); struct sk_buff_head *flow = &cp->rx_flows[flowid]; - - /* this is protected at a higher layer, so no need to + + /* this is protected at a higher layer, so no need to * do any additional locking here. stick the buffer * at the end. */ @@ -2218,19 +2218,19 @@ static void cas_post_page(struct cas *cp, const int ring, const int index) new = cas_page_swap(cp, ring, index); cp->init_rxds[ring][entry].buffer = cpu_to_le64(new->dma_addr); cp->init_rxds[ring][entry].index = - cpu_to_le64(CAS_BASE(RX_INDEX_NUM, index) | + cpu_to_le64(CAS_BASE(RX_INDEX_NUM, index) | CAS_BASE(RX_INDEX_RING, ring)); entry = RX_DESC_ENTRY(ring, entry + 1); cp->rx_old[ring] = entry; - + if (entry % 4) return; if (ring == 0) writel(entry, cp->regs + REG_RX_KICK); else if ((N_RX_DESC_RINGS > 1) && - (cp->cas_flags & CAS_FLAG_REG_PLUS)) + (cp->cas_flags & CAS_FLAG_REG_PLUS)) writel(entry, cp->regs + REG_PLUS_RX_KICK1); } @@ -2249,7 +2249,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) cp->dev->name, ring, entry); cluster = -1; - count = entry & 0x3; + count = entry & 0x3; last = RX_DESC_ENTRY(ring, num ? entry + num - 4: entry - 4); released = 0; while (entry != last) { @@ -2257,12 +2257,12 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) if (cas_buffer_count(page[entry]) > 1) { cas_page_t *new = cas_page_dequeue(cp); if (!new) { - /* let the timer know that we need to + /* let the timer know that we need to * do this again */ cp->cas_flags |= CAS_FLAG_RXD_POST(ring); if (!timer_pending(&cp->link_timer)) - mod_timer(&cp->link_timer, jiffies + + mod_timer(&cp->link_timer, jiffies + CAS_LINK_FAST_TIMEOUT); cp->rx_old[ring] = entry; cp->rx_last[ring] = num ? num - released : 0; @@ -2271,10 +2271,10 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) spin_lock(&cp->rx_inuse_lock); list_add(&page[entry]->list, &cp->rx_inuse_list); spin_unlock(&cp->rx_inuse_lock); - cp->init_rxds[ring][entry].buffer = + cp->init_rxds[ring][entry].buffer = cpu_to_le64(new->dma_addr); page[entry] = new; - + } if (++count == 4) { @@ -2286,13 +2286,13 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) } cp->rx_old[ring] = entry; - if (cluster < 0) + if (cluster < 0) return 0; if (ring == 0) writel(cluster, cp->regs + REG_RX_KICK); else if ((N_RX_DESC_RINGS > 1) && - (cp->cas_flags & CAS_FLAG_REG_PLUS)) + (cp->cas_flags & CAS_FLAG_REG_PLUS)) writel(cluster, cp->regs + REG_PLUS_RX_KICK1); return 0; } @@ -2301,14 +2301,14 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) /* process a completion ring. packets are set up in three basic ways: * small packets: should be copied header + data in single buffer. * large packets: header and data in a single buffer. - * split packets: header in a separate buffer from data. + * split packets: header in a separate buffer from data. * data may be in multiple pages. data may be > 256 - * bytes but in a single page. + * bytes but in a single page. * * NOTE: RX page posting is done in this routine as well. while there's * the capability of using multiple RX completion rings, it isn't * really worthwhile due to the fact that the page posting will - * force serialization on the single descriptor ring. + * force serialization on the single descriptor ring. */ static int cas_rx_ringN(struct cas *cp, int ring, int budget) { @@ -2319,7 +2319,7 @@ static int cas_rx_ringN(struct cas *cp, int ring, int budget) if (netif_msg_intr(cp)) printk(KERN_DEBUG "%s: rx[%d] interrupt, done: %d/%d\n", cp->dev->name, ring, - readl(cp->regs + REG_RX_COMP_HEAD), + readl(cp->regs + REG_RX_COMP_HEAD), cp->rx_new[ring]); entry = cp->rx_new[ring]; @@ -2375,7 +2375,7 @@ static int cas_rx_ringN(struct cas *cp, int ring, int budget) */ if (RX_DONT_BATCH || (type == 0x2)) { /* non-reassm: these always get released */ - cas_skb_release(skb); + cas_skb_release(skb); } else { cas_rx_flow_pkt(cp, words, skb); } @@ -2396,7 +2396,7 @@ static int cas_rx_ringN(struct cas *cp, int ring, int budget) i = CAS_VAL(RX_INDEX_NUM, i); cas_post_page(cp, dring, i); } - + if (words[0] & RX_COMP1_RELEASE_DATA) { i = CAS_VAL(RX_COMP1_DATA_INDEX, words[0]); dring = CAS_VAL(RX_INDEX_RING, i); @@ -2412,7 +2412,7 @@ static int cas_rx_ringN(struct cas *cp, int ring, int budget) } /* skip to the next entry */ - entry = RX_COMP_ENTRY(ring, entry + 1 + + entry = RX_COMP_ENTRY(ring, entry + 1 + CAS_VAL(RX_COMP1_SKIP, words[0])); #ifdef USE_NAPI if (budget && (npackets >= budget)) @@ -2436,12 +2436,12 @@ static void cas_post_rxcs_ringN(struct net_device *dev, int last, entry; last = cp->rx_cur[ring]; - entry = cp->rx_new[ring]; + entry = cp->rx_new[ring]; if (netif_msg_intr(cp)) printk(KERN_DEBUG "%s: rxc[%d] interrupt, done: %d/%d\n", dev->name, ring, readl(cp->regs + REG_RX_COMP_HEAD), entry); - + /* zero and re-mark descriptors */ while (last != entry) { cas_rxc_init(rxc + last); @@ -2451,21 +2451,21 @@ static void cas_post_rxcs_ringN(struct net_device *dev, if (ring == 0) writel(last, cp->regs + REG_RX_COMP_TAIL); - else if (cp->cas_flags & CAS_FLAG_REG_PLUS) + else if (cp->cas_flags & CAS_FLAG_REG_PLUS) writel(last, cp->regs + REG_PLUS_RX_COMPN_TAIL(ring)); } -/* cassini can use all four PCI interrupts for the completion ring. +/* cassini can use all four PCI interrupts for the completion ring. * rings 3 and 4 are identical */ #if defined(USE_PCI_INTC) || defined(USE_PCI_INTD) -static inline void cas_handle_irqN(struct net_device *dev, +static inline void cas_handle_irqN(struct net_device *dev, struct cas *cp, const u32 status, const int ring) { - if (status & (INTR_RX_COMP_FULL_ALT | INTR_RX_COMP_AF_ALT)) + if (status & (INTR_RX_COMP_FULL_ALT | INTR_RX_COMP_AF_ALT)) cas_post_rxcs_ringN(dev, cp, ring); } @@ -2505,7 +2505,7 @@ static irqreturn_t cas_interruptN(int irq, void *dev_id, struct pt_regs *regs) static inline void cas_handle_irq1(struct cas *cp, const u32 status) { if (status & INTR_RX_BUF_UNAVAIL_1) { - /* Frame arrived, no free RX buffers available. + /* Frame arrived, no free RX buffers available. * NOTE: we can get this on a link transition. */ cas_post_rxds_ringN(cp, 1, 0); spin_lock(&cp->stat_lock[1]); @@ -2513,8 +2513,8 @@ static inline void cas_handle_irq1(struct cas *cp, const u32 status) spin_unlock(&cp->stat_lock[1]); } - if (status & INTR_RX_BUF_AE_1) - cas_post_rxds_ringN(cp, 1, RX_DESC_RINGN_SIZE(1) - + if (status & INTR_RX_BUF_AE_1) + cas_post_rxds_ringN(cp, 1, RX_DESC_RINGN_SIZE(1) - RX_AE_FREEN_VAL(1)); if (status & (INTR_RX_COMP_AF | INTR_RX_COMP_FULL)) @@ -2558,7 +2558,7 @@ static inline void cas_handle_irq(struct net_device *dev, cas_abnormal_irq(dev, cp, status); if (status & INTR_RX_BUF_UNAVAIL) { - /* Frame arrived, no free RX buffers available. + /* Frame arrived, no free RX buffers available. * NOTE: we can get this on a link transition. */ cas_post_rxds_ringN(cp, 0, 0); @@ -2625,7 +2625,7 @@ static int cas_poll(struct net_device *dev, int *budget) todo = min(*budget, dev->quota); /* to make sure we're fair with the work we loop through each - * ring N_RX_COMP_RING times with a request of + * ring N_RX_COMP_RING times with a request of * todo / N_RX_COMP_RINGS */ enable_intr = 1; @@ -2784,13 +2784,13 @@ static void cas_write_txd(struct cas *cp, int ring, int entry, txd->buffer = cpu_to_le64(mapping); } -static inline void *tx_tiny_buf(struct cas *cp, const int ring, +static inline void *tx_tiny_buf(struct cas *cp, const int ring, const int entry) { return cp->tx_tiny_bufs[ring] + TX_TINY_BUF_LEN*entry; } -static inline dma_addr_t tx_tiny_map(struct cas *cp, const int ring, +static inline dma_addr_t tx_tiny_map(struct cas *cp, const int ring, const int entry, const int tentry) { cp->tx_tiny_use[ring][tentry].nbufs++; @@ -2798,7 +2798,7 @@ static inline dma_addr_t tx_tiny_map(struct cas *cp, const int ring, return cp->tx_tiny_dvma[ring] + TX_TINY_BUF_LEN*entry; } -static inline int cas_xmit_tx_ringN(struct cas *cp, int ring, +static inline int cas_xmit_tx_ringN(struct cas *cp, int ring, |