Commit 2634d064 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6:
  MACB: clear transmit buffers properly on transmit underrun
  3c359 endianness annotations and fixes
  fec_mpc52xx: write in C...
  3c574 and 3c589 endianness fixes (.24?)
  rrunner: use offsetof() instead of homegrown insanity
  r8169 endianness
  dl2k endianness fixes (.24 fodder?)
  yellowfin: annotations and fixes (.24 fodder?)
  asix fixes
  cycx: annotations and fixes (.24 fodder?)
  typhoon: trivial endianness annotations
  typhoon: memory corruptor on big-endian if TSO is enabled
  typhoon: missed rx overruns on big-endian
  typhoon: set_settings broken on big-endian
  typhoon: missing le32_to_cpu() in get_drvinfo
  typhoon: endianness bug in tx/rx byte counters
  ipw2200: prevent alloc of unspecified size on stack
  iwlwifi: fix possible priv->mutex deadlock during suspend
  p54: add Kconfig description
  rtl8187: Add USB ID for Sitecom WL-168 v1 001
parents c63f7020 bdcba151
...@@ -332,7 +332,7 @@ parse_eeprom (struct net_device *dev) ...@@ -332,7 +332,7 @@ parse_eeprom (struct net_device *dev)
#endif #endif
/* Read eeprom */ /* Read eeprom */
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
((u16 *) sromdata)[i] = le16_to_cpu (read_eeprom (ioaddr, i)); ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom (ioaddr, i));
} }
#ifdef MEM_MAPPING #ifdef MEM_MAPPING
ioaddr = dev->base_addr; ioaddr = dev->base_addr;
...@@ -516,7 +516,7 @@ rio_timer (unsigned long data) ...@@ -516,7 +516,7 @@ rio_timer (unsigned long data)
PCI_DMA_FROMDEVICE)); PCI_DMA_FROMDEVICE));
} }
np->rx_ring[entry].fraginfo |= np->rx_ring[entry].fraginfo |=
cpu_to_le64 (np->rx_buf_sz) << 48; cpu_to_le64((u64)np->rx_buf_sz << 48);
np->rx_ring[entry].status = 0; np->rx_ring[entry].status = 0;
} /* end for */ } /* end for */
} /* end if */ } /* end if */
...@@ -584,11 +584,11 @@ alloc_list (struct net_device *dev) ...@@ -584,11 +584,11 @@ alloc_list (struct net_device *dev)
cpu_to_le64 ( pci_map_single ( cpu_to_le64 ( pci_map_single (
np->pdev, skb->data, np->rx_buf_sz, np->pdev, skb->data, np->rx_buf_sz,
PCI_DMA_FROMDEVICE)); PCI_DMA_FROMDEVICE));
np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48);
} }
/* Set RFDListPtr */ /* Set RFDListPtr */
writel (cpu_to_le32 (np->rx_ring_dma), dev->base_addr + RFDListPtr0); writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0);
writel (0, dev->base_addr + RFDListPtr1); writel (0, dev->base_addr + RFDListPtr1);
return; return;
...@@ -620,15 +620,14 @@ start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -620,15 +620,14 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)
} }
#endif #endif
if (np->vlan) { if (np->vlan) {
tfc_vlan_tag = tfc_vlan_tag = VLANTagInsert |
cpu_to_le64 (VLANTagInsert) | ((u64)np->vlan << 32) |
(cpu_to_le64 (np->vlan) << 32) | ((u64)skb->priority << 45);
(cpu_to_le64 (skb->priority) << 45);
} }
txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data, txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data,
skb->len, skb->len,
PCI_DMA_TODEVICE)); PCI_DMA_TODEVICE));
txdesc->fraginfo |= cpu_to_le64 (skb->len) << 48; txdesc->fraginfo |= cpu_to_le64((u64)skb->len << 48);
/* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode
* Work around: Always use 1 descriptor in 10Mbps mode */ * Work around: Always use 1 descriptor in 10Mbps mode */
...@@ -708,6 +707,11 @@ rio_interrupt (int irq, void *dev_instance) ...@@ -708,6 +707,11 @@ rio_interrupt (int irq, void *dev_instance)
return IRQ_RETVAL(handled); return IRQ_RETVAL(handled);
} }
static inline dma_addr_t desc_to_dma(struct netdev_desc *desc)
{
return le64_to_cpu(desc->fraginfo) & DMA_48BIT_MASK;
}
static void static void
rio_free_tx (struct net_device *dev, int irq) rio_free_tx (struct net_device *dev, int irq)
{ {
...@@ -725,11 +729,11 @@ rio_free_tx (struct net_device *dev, int irq) ...@@ -725,11 +729,11 @@ rio_free_tx (struct net_device *dev, int irq)
while (entry != np->cur_tx) { while (entry != np->cur_tx) {
struct sk_buff *skb; struct sk_buff *skb;
if (!(np->tx_ring[entry].status & TFDDone)) if (!(np->tx_ring[entry].status & cpu_to_le64(TFDDone)))
break; break;
skb = np->tx_skbuff[entry]; skb = np->tx_skbuff[entry];
pci_unmap_single (np->pdev, pci_unmap_single (np->pdev,
np->tx_ring[entry].fraginfo & DMA_48BIT_MASK, desc_to_dma(&np->tx_ring[entry]),
skb->len, PCI_DMA_TODEVICE); skb->len, PCI_DMA_TODEVICE);
if (irq) if (irq)
dev_kfree_skb_irq (skb); dev_kfree_skb_irq (skb);
...@@ -831,13 +835,14 @@ receive_packet (struct net_device *dev) ...@@ -831,13 +835,14 @@ receive_packet (struct net_device *dev)
int pkt_len; int pkt_len;
u64 frame_status; u64 frame_status;
if (!(desc->status & RFDDone) || if (!(desc->status & cpu_to_le64(RFDDone)) ||
!(desc->status & FrameStart) || !(desc->status & FrameEnd)) !(desc->status & cpu_to_le64(FrameStart)) ||
!(desc->status & cpu_to_le64(FrameEnd)))
break; break;
/* Chip omits the CRC. */ /* Chip omits the CRC. */
pkt_len = le64_to_cpu (desc->status & 0xffff); frame_status = le64_to_cpu(desc->status);
frame_status = le64_to_cpu (desc->status); pkt_len = frame_status & 0xffff;
if (--cnt < 0) if (--cnt < 0)
break; break;
/* Update rx error statistics, drop packet. */ /* Update rx error statistics, drop packet. */
...@@ -857,15 +862,14 @@ receive_packet (struct net_device *dev) ...@@ -857,15 +862,14 @@ receive_packet (struct net_device *dev)
/* Small skbuffs for short packets */ /* Small skbuffs for short packets */
if (pkt_len > copy_thresh) { if (pkt_len > copy_thresh) {
pci_unmap_single (np->pdev, pci_unmap_single (np->pdev,
desc->fraginfo & DMA_48BIT_MASK, desc_to_dma(desc),
np->rx_buf_sz, np->rx_buf_sz,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
skb_put (skb = np->rx_skbuff[entry], pkt_len); skb_put (skb = np->rx_skbuff[entry], pkt_len);
np->rx_skbuff[entry] = NULL; np->rx_skbuff[entry] = NULL;
} else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) {
pci_dma_sync_single_for_cpu(np->pdev, pci_dma_sync_single_for_cpu(np->pdev,
desc->fraginfo & desc_to_dma(desc),
DMA_48BIT_MASK,
np->rx_buf_sz, np->rx_buf_sz,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
/* 16 byte align the IP header */ /* 16 byte align the IP header */
...@@ -875,8 +879,7 @@ receive_packet (struct net_device *dev) ...@@ -875,8 +879,7 @@ receive_packet (struct net_device *dev)
pkt_len); pkt_len);
skb_put (skb, pkt_len); skb_put (skb, pkt_len);
pci_dma_sync_single_for_device(np->pdev, pci_dma_sync_single_for_device(np->pdev,
desc->fraginfo & desc_to_dma(desc),
DMA_48BIT_MASK,
np->rx_buf_sz, np->rx_buf_sz,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
} }
...@@ -919,7 +922,7 @@ receive_packet (struct net_device *dev) ...@@ -919,7 +922,7 @@ receive_packet (struct net_device *dev)
PCI_DMA_FROMDEVICE)); PCI_DMA_FROMDEVICE));
} }
np->rx_ring[entry].fraginfo |= np->rx_ring[entry].fraginfo |=
cpu_to_le64 (np->rx_buf_sz) << 48; cpu_to_le64((u64)np->rx_buf_sz << 48);
np->rx_ring[entry].status = 0; np->rx_ring[entry].status = 0;
entry = (entry + 1) % RX_RING_SIZE; entry = (entry + 1) % RX_RING_SIZE;
} }
...@@ -1121,7 +1124,7 @@ set_multicast (struct net_device *dev) ...@@ -1121,7 +1124,7 @@ set_multicast (struct net_device *dev)
hash_table[0] = hash_table[1] = 0; hash_table[0] = hash_table[1] = 0;
/* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */
hash_table[1] |= cpu_to_le32(0x02000000); hash_table[1] |= 0x02000000;
if (dev->flags & IFF_PROMISC) { if (dev->flags & IFF_PROMISC) {
/* Receive all frames promiscuously. */ /* Receive all frames promiscuously. */
rx_mode = ReceiveAllFrames; rx_mode = ReceiveAllFrames;
...@@ -1762,7 +1765,7 @@ rio_close (struct net_device *dev) ...@@ -1762,7 +1765,7 @@ rio_close (struct net_device *dev)
skb = np->rx_skbuff[i]; skb = np->rx_skbuff[i];
if (skb) { if (skb) {
pci_unmap_single(np->pdev, pci_unmap_single(np->pdev,
np->rx_ring[i].fraginfo & DMA_48BIT_MASK, desc_to_dma(&np->rx_ring[i]),
skb->len, PCI_DMA_FROMDEVICE); skb->len, PCI_DMA_FROMDEVICE);
dev_kfree_skb (skb); dev_kfree_skb (skb);
np->rx_skbuff[i] = NULL; np->rx_skbuff[i] = NULL;
...@@ -1772,7 +1775,7 @@ rio_close (struct net_device *dev) ...@@ -1772,7 +1775,7 @@ rio_close (struct net_device *dev)
skb = np->tx_skbuff[i]; skb = np->tx_skbuff[i];
if (skb) { if (skb) {
pci_unmap_single(np->pdev, pci_unmap_single(np->pdev,
np->tx_ring[i].fraginfo & DMA_48BIT_MASK, desc_to_dma(&np->tx_ring[i]),
skb->len, PCI_DMA_TODEVICE); skb->len, PCI_DMA_TODEVICE);
dev_kfree_skb (skb); dev_kfree_skb (skb);
np->tx_skbuff[i] = NULL; np->tx_skbuff[i] = NULL;
......
...@@ -633,9 +633,9 @@ struct mii_data { ...@@ -633,9 +633,9 @@ struct mii_data {
/* The Rx and Tx buffer descriptors. */ /* The Rx and Tx buffer descriptors. */
struct netdev_desc { struct netdev_desc {
u64 next_desc; __le64 next_desc;
u64 status; __le64 status;
u64 fraginfo; __le64 fraginfo;
}; };
#define PRIV_ALIGN 15 /* Required alignment mask */ #define PRIV_ALIGN 15 /* Required alignment mask */
......
...@@ -568,8 +568,9 @@ static void mpc52xx_fec_reset_stats(struct net_device *dev) ...@@ -568,8 +568,9 @@ static void mpc52xx_fec_reset_stats(struct net_device *dev)
struct mpc52xx_fec __iomem *fec = priv->fec; struct mpc52xx_fec __iomem *fec = priv->fec;
out_be32(&fec->mib_control, FEC_MIB_DISABLE); out_be32(&fec->mib_control, FEC_MIB_DISABLE);
memset_io(&fec->rmon_t_drop, 0, (__force u32)&fec->reserved10 - memset_io(&fec->rmon_t_drop, 0,
(__force u32)&fec->rmon_t_drop); offsetof(struct mpc52xx_fec, reserved10) -
offsetof(struct mpc52xx_fec, rmon_t_drop));
out_be32(&fec->mib_control, 0); out_be32(&fec->mib_control, 0);
memset(&dev->stats, 0, sizeof(dev->stats)); memset(&dev->stats, 0, sizeof(dev->stats));
......
...@@ -307,8 +307,31 @@ static void macb_tx(struct macb *bp) ...@@ -307,8 +307,31 @@ static void macb_tx(struct macb *bp)
(unsigned long)status); (unsigned long)status);
if (status & MACB_BIT(UND)) { if (status & MACB_BIT(UND)) {
int i;
printk(KERN_ERR "%s: TX underrun, resetting buffers\n", printk(KERN_ERR "%s: TX underrun, resetting buffers\n",
bp->dev->name); bp->dev->name);
head = bp->tx_head;
/*Mark all the buffer as used to avoid sending a lost buffer*/
for (i = 0; i < TX_RING_SIZE; i++)
bp->tx_ring[i].ctrl = MACB_BIT(TX_USED);
/* free transmit buffer in upper layer*/
for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) {
struct ring_info *rp = &bp->tx_skb[tail];
struct sk_buff *skb = rp->skb;
BUG_ON(skb == NULL);
rmb();
dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
DMA_TO_DEVICE);
rp->skb = NULL;
dev_kfree_skb_irq(skb);
}
bp->tx_head = bp->tx_tail = 0; bp->tx_head = bp->tx_tail = 0;
} }
......
...@@ -337,15 +337,15 @@ static int tc574_config(struct pcmcia_device *link) ...@@ -337,15 +337,15 @@ static int tc574_config(struct pcmcia_device *link)
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
tuple_t tuple; tuple_t tuple;
unsigned short buf[32]; __le16 buf[32];
int last_fn, last_ret, i, j; int last_fn, last_ret, i, j;
kio_addr_t ioaddr; kio_addr_t ioaddr;
u16 *phys_addr; __be16 *phys_addr;
char *cardname; char *cardname;
union wn3_config config; union wn3_config config;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
phys_addr = (u16 *)dev->dev_addr; phys_addr = (__be16 *)dev->dev_addr;
DEBUG(0, "3c574_config(0x%p)\n", link); DEBUG(0, "3c574_config(0x%p)\n", link);
...@@ -378,12 +378,12 @@ static int tc574_config(struct pcmcia_device *link) ...@@ -378,12 +378,12 @@ static int tc574_config(struct pcmcia_device *link)
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
pcmcia_get_tuple_data(link, &tuple); pcmcia_get_tuple_data(link, &tuple);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(buf[i]); phys_addr[i] = htons(le16_to_cpu(buf[i]));
} else { } else {
EL3WINDOW(0); EL3WINDOW(0);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
if (phys_addr[0] == 0x6060) { if (phys_addr[0] == htons(0x6060)) {
printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx"
"-0x%03lx\n", dev->base_addr, dev->base_addr+15); "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
goto failed; goto failed;
......
...@@ -251,7 +251,8 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -251,7 +251,8 @@ static int tc589_config(struct pcmcia_device *link)
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
tuple_t tuple; tuple_t tuple;
u16 buf[32], *phys_addr; __le16 buf[32];
__be16 *phys_addr;
int last_fn, last_ret, i, j, multi = 0, fifo; int last_fn, last_ret, i, j, multi = 0, fifo;
kio_addr_t ioaddr; kio_addr_t ioaddr;
char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
...@@ -259,7 +260,7 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -259,7 +260,7 @@ static int tc589_config(struct pcmcia_device *link)
DEBUG(0, "3c589_config(0x%p)\n", link); DEBUG(0, "3c589_config(0x%p)\n", link);
phys_addr = (u16 *)dev->dev_addr; phys_addr = (__be16 *)dev->dev_addr;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.TupleData = (cisdata_t *)buf; tuple.TupleData = (cisdata_t *)buf;
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
...@@ -298,11 +299,11 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -298,11 +299,11 @@ static int tc589_config(struct pcmcia_device *link)
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
pcmcia_get_tuple_data(link, &tuple); pcmcia_get_tuple_data(link, &tuple);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(buf[i]); phys_addr[i] = htons(le16_to_cpu(buf[i]));
} else { } else {
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(read_eeprom(ioaddr, i)); phys_addr[i] = htons(read_eeprom(ioaddr, i));
if (phys_addr[0] == 0x6060) { if (phys_addr[0] == htons(0x6060)) {
printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx" printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx"
"-0x%03lx\n", dev->base_addr, dev->base_addr+15); "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
goto failed; goto failed;
......
...@@ -2211,7 +2211,7 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu) ...@@ -2211,7 +2211,7 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu)
static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
{ {
desc->addr = 0x0badbadbadbadbadull; desc->addr = cpu_to_le64(0x0badbadbadbadbadull);
desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask);
} }
...@@ -2835,7 +2835,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, ...@@ -2835,7 +2835,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
} }
/* Work around for AMD plateform. */ /* Work around for AMD plateform. */
if ((desc->opts2 & 0xfffe000) && if ((desc->opts2 & cpu_to_le32(0xfffe000)) &&
(tp->mac_version == RTL_GIGA_MAC_VER_05)) { (tp->mac_version == RTL_GIGA_MAC_VER_05)) {
desc->opts2 = 0; desc->opts2 = 0;
cur_rx++; cur_rx++;
......
...@@ -294,7 +294,6 @@ static int rr_reset(struct net_device *dev) ...@@ -294,7 +294,6 @@ static int rr_reset(struct net_device *dev)
{ {
struct rr_private *rrpriv; struct rr_private *rrpriv;
struct rr_regs __iomem *regs; struct rr_regs __iomem *regs;
struct eeprom *hw = NULL;
u32 start_pc; u32 start_pc;
int i; int i;
...@@ -381,7 +380,8 @@ static int rr_reset(struct net_device *dev) ...@@ -381,7 +380,8 @@ static int rr_reset(struct net_device *dev)
writel(RBURST_64|WBURST_64, &regs->PciState); writel(RBURST_64|WBURST_64, &regs->PciState);
wmb(); wmb();
start_pc = rr_read_eeprom_word(rrpriv, &hw->rncd_info.FwStart); start_pc = rr_read_eeprom_word(rrpriv,
offsetof(struct eeprom, rncd_info.FwStart));
#if (DEBUG > 1) #if (DEBUG > 1)
printk("%s: Executing firmware at address 0x%06x\n", printk("%s: Executing firmware at address 0x%06x\n",
...@@ -438,12 +438,12 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv, ...@@ -438,12 +438,12 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
* it to our CPU byte-order. * it to our CPU byte-order.
*/ */
static u32 rr_read_eeprom_word(struct rr_private *rrpriv, static u32 rr_read_eeprom_word(struct rr_private *rrpriv,
void * offset) size_t offset)
{ {
u32 word; __be32 word;
if ((rr_read_eeprom(rrpriv, (unsigned long)offset, if ((rr_read_eeprom(rrpriv, offset,
(char *)&word, 4) == 4)) (unsigned char *)&word, 4) == 4))
return be32_to_cpu(word); return be32_to_cpu(word);
return 0; return 0;
} }
...@@ -510,7 +510,6 @@ static int __devinit rr_init(struct net_device *dev) ...@@ -510,7 +510,6 @@ static int __devinit rr_init(struct net_device *dev)
{ {
struct rr_private *rrpriv; struct rr_private *rrpriv;
struct rr_regs __iomem *regs; struct rr_regs __iomem *regs;
struct eeprom *hw = NULL;
u32 sram_size, rev; u32 sram_size, rev;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
...@@ -545,14 +544,14 @@ static int __devinit rr_init(struct net_device *dev) ...@@ -545,14 +544,14 @@ static int __devinit rr_init(struct net_device *dev)
* other method I've seen. -VAL * other method I've seen. -VAL
*/ */
*(u16 *)(dev->dev_addr) = *(__be16 *)(dev->dev_addr) =
htons(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA)); htons(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA)));
*(u32 *)(dev->dev_addr+2) = *(__be32 *)(dev->dev_addr+2) =
htonl(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA[4])); htonl(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA[4])));
printk(" MAC: %s\n", print_mac(mac, dev->dev_addr)); printk(" MAC: %s\n", print_mac(mac, dev->dev_addr));
sram_size = rr_read_eeprom_word(rrpriv, (void *)8); sram_size = rr_read_eeprom_word(rrpriv, 8);
printk(" SRAM size 0x%06x\n", sram_size); printk(" SRAM size 0x%06x\n", sram_size);
return 0; return 0;
...@@ -1477,11 +1476,10 @@ static int rr_load_firmware(struct net_device *dev) ...@@ -1477,11 +1476,10 @@ static int rr_load_firmware(struct net_device *dev)
{ {
struct rr_private *rrpriv; struct rr_private *rrpriv;
struct rr_regs __iomem *regs; struct rr_regs __iomem *regs;
unsigned long eptr, segptr; size_t eptr, segptr;
int i, j; int i, j;
u32 localctrl, sptr, len, tmp; u32 localctrl, sptr, len, tmp;
u32 p2len, p2size, nr_seg, revision, io, sram_size; u32 p2len, p2size, nr_seg, revision, io, sram_size;
struct eeprom *hw = NULL;
rrpriv = netdev_priv(dev); rrpriv = netdev_priv(dev);
regs = rrpriv->regs; regs = rrpriv->regs;
...@@ -1509,7 +1507,7 @@ static int rr_load_firmware(struct net_device *dev) ...@@ -1509,7 +1507,7 @@ static int rr_load_firmware(struct net_device *dev)
*/ */
io = readl(&regs->ExtIo); io = readl(&regs->ExtIo);
writel(0, &regs->ExtIo); writel(0, &regs->ExtIo);
sram_size = rr_read_eeprom_word(rrpriv, (void *)8); sram_size = rr_read_eeprom_word(rrpriv, 8);
for (i = 200; i < sram_size / 4; i++){ for (i = 200; i < sram_size / 4; i++){
writel(i * 4, &regs->WinBase); writel(i * 4, &regs->WinBase);
...@@ -1520,13 +1518,13 @@ static int rr_load_firmware(struct net_device *dev) ...@@ -1520,13 +1518,13 @@ static int rr_load_firmware(struct net_device *dev)
writel(io, &regs->ExtIo); writel(io, &regs->ExtIo);
mb(); mb();
eptr = (unsigned long)rr_read_eeprom_word(rrpriv, eptr = rr_read_eeprom_word(rrpriv,
&hw->rncd_info.AddrRunCodeSegs); offsetof(struct eeprom, rncd_info.AddrRunCodeSegs));
eptr = ((eptr & 0x1fffff) >> 3); eptr = ((eptr & 0x1fffff) >> 3);
p2len = rr_read_eeprom_word(rrpriv, (void *)(0x83*4)); p2len = rr_read_eeprom_word(rrpriv, 0x83*4);
p2len = (p2len << 2); p2len = (p2len << 2);
p2size = rr_read_eeprom_word(rrpriv, (void *)(0x84*4)); p2size = rr_read_eeprom_word(rrpriv, 0x84*4);
p2size = ((p2size & 0x1fffff) >> 3); p2size = ((p2size & 0x1fffff) >> 3);
if ((eptr < p2size) || (eptr > (p2size + p2len))){ if ((eptr < p2size) || (eptr > (p2size + p2len))){
...@@ -1534,7 +1532,8 @@ static int rr_load_firmware(struct net_device *dev) ...@@ -1534,7 +1532,8 @@ static int rr_load_firmware(struct net_device *dev)
goto out; goto out;
} }
revision = rr_read_eeprom_word(rrpriv, &hw->manf.HeaderFmt); revision = rr_read_eeprom_word(rrpriv,
offsetof(struct eeprom, manf.HeaderFmt));
if (revision != 1){ if (revision != 1){
printk("%s: invalid firmware format (%i)\n", printk("%s: invalid firmware format (%i)\n",
...@@ -1542,18 +1541,18 @@ static int rr_load_firmware(struct net_device *dev) ...@@ -1542,18 +1541,18 @@ static int rr_load_firmware(struct net_device *dev)
goto out; goto out;
} }
nr_seg = rr_read_eeprom_word(rrpriv, (void *)eptr); nr_seg = rr_read_eeprom_word(rrpriv, eptr);
eptr +=4; eptr +=4;
#if (DEBUG > 1) #if (DEBUG > 1)
printk("%s: nr_seg %i\n", dev->name, nr_seg); printk("%s: nr_seg %i\n", dev->name, nr_seg);
#endif #endif
for (i = 0; i < nr_seg; i++){ for (i = 0; i < nr_seg; i++){
sptr = rr_read_eeprom_word(rrpriv, (void *)eptr); sptr = rr_read_eeprom_word(rrpriv, eptr);
eptr += 4; eptr += 4;
len = rr_read_eeprom_word(rrpriv, (void *)eptr); len = rr_read_eeprom_word(rrpriv, eptr);
eptr += 4; eptr += 4;
segptr = (unsigned long)rr_read_eeprom_word(rrpriv, (void *)eptr); segptr = rr_read_eeprom_word(rrpriv, eptr);
segptr = ((segptr & 0x1fffff) >> 3); segptr = ((segptr & 0x1fffff) >> 3);
eptr += 4; eptr += 4;
#if (DEBUG > 1) #if (DEBUG > 1)
...@@ -1561,7 +1560,7 @@ static int rr_load_firmware(struct net_device *dev) ...@@ -1561,7 +1560,7 @@ static int rr_load_firmware(struct net_device *dev)
dev->name, i, sptr, len, segptr); dev->name, i, sptr, len, segptr);
#endif #endif
for (j = 0; j < len; j++){ for (j = 0; j < len; j++){
tmp = rr_read_eeprom_word(rrpriv, (void *)segptr); tmp = rr_read_eeprom_word(rrpriv, segptr);
writel(sptr, &regs->WinBase); writel(sptr, &regs->WinBase);
mb(); mb();
writel(tmp, &regs->WinData); writel(tmp, &regs->WinData);
......
...@@ -838,7 +838,7 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv, ...@@ -838,7 +838,7 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
unsigned long offset, unsigned long offset,
unsigned char *buf, unsigned char *buf,
unsigned long length); unsigned long length);
static u32 rr_read_eeprom_word(struct rr_private *rrpriv, void * offset); static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset);
static int rr_load_firmware(struct net_device *dev); static int rr_load_firmware(struct net_device *dev);
static inline void rr_raz_tx(struct rr_private *, struct net_device *); static inline void rr_raz_tx(struct rr_private *, struct net_device *);
static inline void rr_raz_rx(struct rr_private *, struct net_device *); static inline void rr_raz_rx(struct rr_private *, struct net_device *);
......
This diff is collapsed.
...@@ -156,19 +156,19 @@ ...@@ -156,19 +156,19 @@
#define HOSTERRINT (1<<1) #define HOSTERRINT (1<<1)
/* Receive descriptor bits */ /* Receive descriptor bits */
#define RXOVERRUN (1<<19) #define RXOVERRUN cpu_to_le32(1<<19)
#define RXFC (1<<21) #define RXFC cpu_to_le32(1<<21)
#define RXAR (1<<22) #define RXAR cpu_to_le32(1<<22)
#define RXUPDCOMPLETE (1<<23) #define RXUPDCOMPLETE cpu_to_le32(1<<23)
#define RXUPDFULL (1<<24) #define RXUPDFULL cpu_to_le32(1<<24)
#define RXUPLASTFRAG (1<<31) #define RXUPLASTFRAG cpu_to_le32(1<<31)
/* Transmit descriptor bits */ /* Transmit descriptor bits */
#define TXDNCOMPLETE (1<<16) #define TXDNCOMPLETE cpu_to_le32(1<<16)
#define TXTXINDICATE (1<<27) #define TXTXINDICATE cpu_to_le32(1<<27)
#define TXDPDEMPTY (1<<29) #define TXDPDEMPTY cpu_to_le32(1<<29)
#define TXDNINDICATE (1<<31) #define TXDNINDICATE cpu_to_le32(1<<31)
#define TXDNFRAGLAST (1<<31) #define TXDNFRAGLAST cpu_to_le32(1<<31)
/* Interrupts to Acknowledge */ /* Interrupts to Acknowledge */
#define LATCH_ACK 1 #define LATCH_ACK 1
...@@ -232,17 +232,17 @@ ...@@ -232,17 +232,17 @@
/* 3c359 data structures */ /* 3c359 data structures */
struct xl_tx_desc { struct xl_tx_desc {
u32 dnnextptr ; __le32 dnnextptr;
u32 framestartheader ; __le32 framestartheader;
u32 buffer ; __le32 buffer;
u32 buffer_length ; __le32 buffer_length;
}; };
struct xl_rx_desc { struct xl_rx_desc {
u32 upnextptr ; __le32 upnextptr;
u32 framestatus ; __le32 framestatus;
u32 upfragaddr ; __le32 upfragaddr;
u32 upfraglen ; __le32 upfraglen;
}; };
struct xl_private { struct xl_private {
......
...@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID;
first_txd->numDesc = 0; first_txd->numDesc = 0;
first_txd->len = 0; first_txd->len = 0;
first_txd->addr = (u64)((unsigned long) skb) & 0xffffffff; first_txd->tx_addr = (u64)((unsigned long) skb);
first_txd->addrHi = (u64)((unsigned long) skb) >> 32;
first_txd->processFlags = 0; first_txd->processFlags = 0;
if(skb->ip_summed == CHECKSUM_PARTIAL) { if(skb->ip_summed == CHECKSUM_PARTIAL) {
...@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
txd->len = cpu_to_le16(skb->len); txd->len = cpu_to_le16(skb->len);
txd->addr = cpu_to_le32(skb_dma); txd->frag.addr = cpu_to_le32(skb_dma);
txd->addrHi = 0; txd->frag.addrHi = 0;
first_txd->numDesc++; first_txd->numDesc++;
} else { } else {
int i, len; int i, len;
...@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
txd->len = cpu_to_le16(len); txd->len = cpu_to_le16(len);
txd->addr = cpu_to_le32(skb_dma); txd->frag.addr = cpu_to_le32(skb_dma);
txd->addrHi = 0; txd->frag.addrHi = 0;
first_txd->numDesc++; first_txd->numDesc++;
for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) { for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
...@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
txd->len = cpu_to_le16(len); txd->len = cpu_to_le16(len);
txd->addr = cpu_to_le32(skb_dma); txd->frag.addr = cpu_to_le32(skb_dma);
txd->addrHi = 0; txd->frag.addrHi = 0;
first_txd->numDesc++; first_txd->numDesc++;
} }
} }
...@@ -977,12 +976,12 @@ typhoon_do_get_stats(struct typhoon *tp) ...@@ -977,12 +976,12 @@ typhoon_do_get_stats(struct typhoon *tp)
* ethtool_ops->get_{strings,stats}() * ethtool_ops->get_{strings,stats}()
*/ */
stats->tx_packets = le32_to_cpu(s->txPackets); stats->tx_packets = le32_to_cpu(s->txPackets);
stats->tx_bytes = le32_to_cpu(s->txBytes); stats->tx_bytes = le64_to_cpu(s->txBytes);
stats->tx_errors = le32_to_cpu(s->txCarrierLost); stats->tx_errors = le32_to_cpu(s->txCarrierLost);
stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost); stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost);
stats->collisions = le32_to_cpu(s->txMultipleCollisions); stats->collisions = le32_to_cpu(s->txMultipleCollisions);
stats->rx_packets = le32_to_cpu(s->rxPacketsGood); stats->rx_packets = le32_to_cpu(s->rxPacketsGood);
stats->rx_bytes = le32_to_cpu(s->rxBytesGood); stats->rx_bytes = le64_to_cpu(s->rxBytesGood);
stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns); stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns);
stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) + stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) +
le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors); le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors);
...@@ -1056,7 +1055,7 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) ...@@ -1056,7 +1055,7 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
strcpy(info->fw_version, "Unknown runtime"); strcpy(info->fw_version, "Unknown runtime");
} else { } else {
u32 sleep_ver = xp_resp[0].parm2; u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2);
snprintf(info->fw_version, 32, "%02x.%03x.%03x", snprintf(info->fw_version, 32, "%02x.%03x.%03x",
sleep_ver >> 24, (sleep_ver >> 12) & 0xfff, sleep_ver >> 24, (sleep_ver >> 12) & 0xfff,
sleep_ver & 0xfff); sleep_ver & 0xfff);
...@@ -1157,7 +1156,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -1157,7 +1156,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
} }
INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT); INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT);
xp_cmd.parm1 = cpu_to_le16(xcvr); xp_cmd.parm1 = xcvr;
err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL);
if(err < 0) if(err < 0)
goto out; goto out;
...@@ -1320,7 +1319,7 @@ typhoon_init_interface(struct typhoon *tp) ...@@ -1320,7 +1319,7 @@ typhoon_init_interface(struct typhoon *tp)
tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY; tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY;
tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY; tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY;
tp->txlo_dma_addr = iface->txLoAddr; tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr);
tp->card_state = Sleeping; tp->card_state = Sleeping;
smp_wmb(); smp_wmb();
...@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp) ...@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp)
u8 *image_data; u8 *image_data;
void *dpage; void *dpage;
dma_addr_t dpage_dma; dma_addr_t dpage_dma;
unsigned int csum; __sum16 csum;
u32 irqEnabled; u32 irqEnabled;
u32 irqMasked; u32 irqMasked;
u32 numSections; u32 numSections;
...@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp) ...@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp)
* summing. Fortunately, due to the properties of * summing. Fortunately, due to the properties of
* the checksum, we can do this once, at the end. * the checksum, we can do this once, at the end.
*/ */
csum = csum_partial_copy_nocheck(image_data, dpage, csum = csum_fold(csum_partial_copy_nocheck(image_data,
len, 0); dpage, len,
csum = csum_fold(csum); 0));
csum = le16_to_cpu(csum);
iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH);
iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM); iowrite32(le16_to_cpu((__force __le16)csum),
ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
iowrite32(load_addr, iowrite32(load_addr,
ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); ioaddr + TYPHOON_REG_BOOT_DEST_ADDR);
iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI);
...@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing, ...@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing,
if(type == TYPHOON_TX_DESC) { if(type == TYPHOON_TX_DESC) {
/* This tx_desc describes a packet. /* This tx_desc describes a packet.
*/ */
unsigned long ptr = tx->addr | ((u64)tx->addrHi << 32); unsigned long ptr = tx->tx_addr;
struct sk_buff *skb = (struct sk_buff *) ptr; struct sk_buff *skb = (struct sk_buff *) ptr;
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
} else if(type == TYPHOON_FRAG_DESC) { } else if(type == TYPHOON_FRAG_DESC) {
/* This tx_desc describes a memory mapping. Free it. /* This tx_desc describes a memory mapping. Free it.
*/ */
skb_dma = (dma_addr_t) le32_to_cpu(tx->addr); skb_dma = (dma_addr_t) le32_to_cpu(tx->frag.addr);
dma_len = le16_to_cpu(tx->len); dma_len = le16_to_cpu(tx->len);
pci_unmap_single(tp->pdev, skb_dma, dma_len, pci_unmap_single(tp->pdev, skb_dma, dma_len,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
...@@ -1596,7 +1595,7 @@ typhoon_recycle_rx_skb(struct typhoon *tp, u32 idx) ...@@ -1596,7 +1595,7 @@ typhoon_recycle_rx_skb(struct typhoon *tp, u32 idx)
struct rx_free *r; struct rx_free *r;
if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
indexes->rxBuffCleared) { le32_to_cpu(indexes->rxBuffCleared)) {
/* no room in ring, just drop the skb /* no room in ring, just drop the skb
*/ */
dev_kfree_skb_any(rxb->skb); dev_kfree_skb_any(rxb->skb);
...@@ -1627,7 +1626,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx) ...@@ -1627,7 +1626,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx)
rxb->skb = NULL; rxb->skb = NULL;
if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
indexes->rxBuffCleared) le32_to_cpu(indexes->rxBuffCleared))
return -ENOMEM; return -ENOMEM;
skb = dev_alloc_skb(PKT_BUF_SZ); skb = dev_alloc_skb(PKT_BUF_SZ);
......
...@@ -73,7 +73,7 @@ struct typhoon_indexes { ...@@ -73,7 +73,7 @@ struct typhoon_indexes {
volatile __le32 txLoCleared; volatile __le32 txLoCleared;
volatile __le32 txHiCleared; volatile __le32 txHiCleared;
volatile __le32 rxLoReady; volatile __le32 rxLoReady;
volatile __u32 rxBuffCleared; /* AV: really? */ volatile __le32 rxBuffCleared;
volatile __le32 cmdCleared; volatile __le32 cmdCleared;
volatile __le32 respReady; volatile __le32 respReady;
volatile __le32 rxHiReady; volatile __le32 rxHiReady;
...@@ -166,8 +166,13 @@ struct tx_desc { ...@@ -166,8 +166,13 @@ struct tx_desc {
#define TYPHOON_DESC_VALID 0x80 #define TYPHOON_DESC_VALID 0x80
u8 numDesc; u8 numDesc;
__le16 len; __le16 len;
u32 addr; union {
u32 addrHi; struct {
__le32 addr;
__le32 addrHi;
} frag;
u64 tx_addr; /* opaque for hardware, for TX_DESC */
};
__le32 processFlags; __le32 processFlags;
#define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) #define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001)
#define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) #define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002)
...@@ -240,8 +245,8 @@ struct rx_desc { ...@@ -240,8 +245,8 @@ struct rx_desc {
u8 flags; u8 flags;
u8 numDesc; u8 numDesc;
__le16 frameLen; __le16 frameLen;
u32 addr; u32 addr; /* opaque, comes from virtAddr */
u32 addrHi; u32 addrHi; /* opaque, comes from virtAddrHi */
__le32 rxStatus; __le32 rxStatus;
#define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) #define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000)
#define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) #define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001)
......
This diff is collapsed.
...@@ -503,7 +503,7 @@ static int cycx_netdevice_init(struct net_device *dev) ...@@ -503,7 +503,7 @@ static int cycx_netdevice_init(struct net_device *dev)
dev->addr_len = 0; /* hardware address length */ dev->addr_len = 0; /* hardware address length */
if (!chan->svc) if (!chan->svc)
*(u16*)dev->dev_addr = htons(chan->lcn); *(__be16*)dev->dev_addr = htons(chan->lcn);
/* Initialize hardware parameters (just for reference) */ /* Initialize hardware parameters (just for reference) */
dev->irq = wandev->irq; dev->irq = wandev->irq;
...@@ -565,7 +565,7 @@ static int cycx_netdevice_hard_header(struct sk_buff *skb, ...@@ -565,7 +565,7 @@ static int cycx_netdevice_hard_header(struct sk_buff *skb,
const void *daddr, const void *saddr, const void *daddr, const void *saddr,
unsigned len) unsigned len)
{ {
skb->protocol = type; skb->protocol = htons(type);
return dev->hard_header_len; return dev->hard_header_len;
} }
...@@ -600,15 +600,15 @@ static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb, ...@@ -600,15 +600,15 @@ static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
struct cycx_device *card = chan->card; struct cycx_device *card = chan->card;
if (!chan->svc) if (!chan->svc)
chan->protocol = skb->protocol; chan->protocol = ntohs(skb->protocol);
if (card->wandev.state != WAN_CONNECTED) if (card->wandev.state != WAN_CONNECTED)
++chan->ifstats.tx_dropped; ++chan->ifstats.tx_dropped;
else if (chan->svc && chan->protocol && else if (chan->svc && chan->protocol &&
chan->protocol != skb->protocol) { chan->protocol != ntohs(skb->protocol)) {
printk(KERN_INFO printk(KERN_INFO
"%s: unsupported Ethertype 0x%04X on interface %s!\n", "%s: unsupported Ethertype 0x%04X on interface %s!\n",
card->devname, skb->protocol, dev->name); card->devname, ntohs(skb->protocol), dev->name);
++chan->ifstats.tx_errors; ++chan->ifstats.tx_errors;
} else if (chan->protocol == ETH_P_IP) { } else if (chan->protocol == ETH_P_IP) {
switch (chan->state) { switch (chan->state) {
...@@ -1401,7 +1401,7 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state) ...@@ -1401,7 +1401,7 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state)
switch (state) { switch (state) {
case WAN_CONNECTED: case WAN_CONNECTED:
string_state = "connected!"; string_state = "connected!";
*(u16*)dev->dev_addr = htons(chan->lcn); *(__be16*)dev->dev_addr = htons(chan->lcn);
netif_wake_queue(dev); netif_wake_queue(dev);
reset_timer(dev); reset_timer(dev);
......
...@@ -587,15 +587,66 @@ config ADM8211 ...@@ -587,15 +587,66 @@ config ADM8211
config P54_COMMON config P54_COMMON
tristate "Softmac Prism54 support" tristate "Softmac Prism54 support"
depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL
---help---
This is common code for isl38xx based cards.
This module does nothing by itself - the USB/PCI frontends
also need to be enabled in order to support any devices.
These devices require softmac firmware which can be found at
http://prism54.org/
If you choose to build a module, it'll be called p54common.
config P54_USB config P54_USB
tristate "Prism54 USB support" tristate "Prism54 USB support"
depends on P54_COMMON && USB depends on P54_COMMON && USB
select CRC32 select CRC32
---help---
This driver is for USB isl38xx based wireless cards.
These are USB based adapters found in devices such as:
3COM 3CRWE254G72
SMC 2862W-G
Accton 802.11g WN4501 USB
Siemens Gigaset USB
Netgear WG121
Netgear WG111
Medion 40900, Roper Europe
Shuttle PN15, Airvast WM168g, IOGear GWU513
Linksys WUSB54G
Linksys WUSB54G Portable
DLink DWL-G120 Spinnaker
DLink DWL-G122
Belkin F5D7050 ver 1000
Cohiba Proto board
SMC 2862W-G version 2
U.S. Robotics U5 802.11g Adapter
FUJITSU E-5400 USB D1700
Sagem XG703A
DLink DWL-G120 Cohiba
Spinnaker Proto board
Linksys WUSB54AG
Inventel UR054G
Spinnaker DUT
These devices require softmac firmware which can be found at
http://prism54.org/
If you choose to build a module, it'll be called p54usb.
config P54_PCI config P54_PCI
tristate "Prism54 PCI support" tristate "Prism54 PCI support"
depends on P54_COMMON && PCI depends on P54_COMMON && PCI
---help---
This driver is for PCI isl38xx based wireless cards.
This driver supports most devices that are supported by the
fullmac prism54 driver plus many devices which are not
supported by the fullmac driver/firmware.
This driver requires softmac firmware which can be found at
http://prism54.org/
If you choose to build a module, it'll be called p54pci.
source "drivers/net/wireless/iwlwifi/Kconfig" source "drivers/net/wireless/iwlwifi/Kconfig"
source "drivers/net/wireless/hostap/Kconfig" source "drivers/net/wireless/hostap/Kconfig"
......
...@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d, ...@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d,
{ {
struct ipw_priv *priv = dev_get_drvdata(d); struct ipw_priv *priv = dev_get_drvdata(d);
u32 log_len = ipw_get_event_log_len(priv); u32 log_len = ipw_get_event_log_len(priv);
struct ipw_event log[log_len]; u32 log_size;
struct ipw_event *log;
u32 len = 0, i; u32 len = 0, i;
/* not using min() because of its strict type checking */
log_size = PAGE_SIZE / sizeof(*log) > log_len ?
sizeof(*log) * log_len : PAGE_SIZE;
log = kzalloc(log_size, GFP_KERNEL);
if (!log) {
IPW_ERROR("Unable to allocate memory for log\n");
return 0;
}
log_len = log_size / sizeof(*log);
ipw_capture_event_log(priv, log_len, log); ipw_capture_event_log(priv, log_len, log);
len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len);
...@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d, ...@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d,
"\n%08X%08X%08X", "\n%08X%08X%08X",
log[i].time, log[i].event, log[i].data); log[i].time, log[i].event, log[i].data);
len += snprintf(buf + len, PAGE_SIZE - len, "\n"); len += snprintf(buf + len, PAGE_SIZE - len, "\n");
kfree(log);
return len; return len;
} }
......
...@@ -6246,8 +6246,6 @@ static void __iwl_down(struct iwl_priv *priv) ...@@ -6246,8 +6246,6 @@ static void __iwl_down(struct iwl_priv *priv)
/* Unblock any waiting calls */ /* Unblock any waiting calls */
wake_up_interruptible_all(&priv->wait_command_queue); wake_up_interruptible_all(&priv->wait_command_queue);
iwl_cancel_deferred_work(priv);
/* Wipe out the EXIT_PENDING status bit if we are not actually /* Wipe out the EXIT_PENDING status bit if we are not actually
* exiting the module */ * exiting the module */
if (!exit_pending) if (!exit_pending)
...@@ -6322,6 +6320,8 @@ static void iwl_down(struct iwl_priv *priv) ...@@ -6322,6 +6320,8 @@ static void iwl_down(struct iwl_priv *priv)
mutex_lock(&priv->mutex); mutex_lock(&priv->mutex);
__iwl_down(priv); __iwl_down(priv);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
iwl_cancel_deferred_work(priv);
} }
#define MAX_HW_RESTARTS 5 #define MAX_HW_RESTARTS 5
...@@ -8580,10 +8580,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) ...@@ -8580,10 +8580,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
mutex_lock(&priv->mutex);
set_bit(STATUS_EXIT_PENDING, &priv->status); set_bit(STATUS_EXIT_PENDING, &priv->status);
__iwl_down(priv);
mutex_unlock(&priv->mutex); iwl_down(priv);
/* Free MAC hash list for ADHOC */ /* Free MAC hash list for ADHOC */
for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
...@@ -8642,12 +8641,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -8642,12 +8641,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
struct iwl_priv *priv = pci_get_drvdata(pdev); struct iwl_priv *priv = pci_get_drvdata(pdev);
mutex_lock(&priv->mutex);
set_bit(STATUS_IN_SUSPEND, &priv->status); set_bit(STATUS_IN_SUSPEND, &priv->status);
/* Take down the device; powers it off, etc. */ /* Take down the device; powers it off, etc. */
__iwl_down(priv); iwl_down(priv);
if (priv->mac80211_registered) if (priv->mac80211_registered)
ieee80211_stop_queues(priv->hw); ieee80211_stop_queues(priv->hw);
...@@ -8656,8 +8653,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -8656,8 +8653,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
pci_disable_device(pdev); pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
mutex_unlock(&priv->mutex);
return 0; return 0;
} }
...@@ -8715,8 +8710,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) ...@@ -8715,8 +8710,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
printk(KERN_INFO "Coming out of suspend...\n"); printk(KERN_INFO "Coming out of suspend...\n");
mutex_lock(&priv->mutex);
pci_set_power_state(pdev, PCI_D0); pci_set_power_state(pdev, PCI_D0);
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
pci_restore_state(pdev); pci_restore_state(pdev);
...@@ -8730,7 +8723,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) ...@@ -8730,7 +8723,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
pci_write_config_byte(pdev, 0x41, 0x00); pci_write_config_byte(pdev, 0x41, 0x00);
iwl_resume(priv); iwl_resume(priv);
mutex_unlock(&priv->mutex);
return 0; return 0;
} }
......
...@@ -6601,8 +6601,6 @@ static void __iwl_down(struct iwl_priv *priv) ...@@ -6601,8 +6601,6 @@ static void __iwl_down(struct iwl_priv *priv)
/* Unblock any waiting calls */ /* Unblock any waiting calls */
wake_up_interruptible_all(&priv->wait_command_queue); wake_up_interruptible_all(&priv->wait_command_queue);
iwl_cancel_deferred_work(priv);
/* Wipe out the EXIT_PENDING status bit if we are not actually /* Wipe out the EXIT_PENDING status bit if we are not actually
* exiting the module */ * exiting the module */
if (!exit_pending) if (!exit_pending)
...@@ -6677,6 +6675,8 @@ static void iwl_down(struct iwl_priv *priv) ...@@ -6677,6 +6675,8 @@ static void iwl_down(struct iwl_priv *priv)
mutex_lock(&priv->mutex); mutex_lock(&priv->mutex);
__iwl_down(priv); __iwl_down(priv);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
iwl_cancel_deferred_work(priv);
} }
#define MAX_HW_RESTARTS 5 #define MAX_HW_RESTARTS 5
...@@ -9174,10 +9174,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) ...@@ -9174,10 +9174,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
mutex_lock(&priv->mutex);
set_bit(STATUS_EXIT_PENDING, &priv->status); set_bit(STATUS_EXIT_PENDING, &priv->status);
__iwl_down(priv);
mutex_unlock(&priv->mutex); iwl_down(priv);
/* Free MAC hash list for ADHOC */ /* Free MAC hash list for ADHOC */
for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
...@@ -9236,12 +9235,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -9236,12 +9235,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
struct iwl_priv *priv = pci_get_drvdata(pdev); struct iwl_priv *priv = pci_get_drvdata(pdev);
mutex_lock(&priv->mutex);
set_bit(STATUS_IN_SUSPEND, &priv->status); set_bit(STATUS_IN_SUSPEND, &priv->status);
/* Take down the device; powers it off, etc. */ /* Take down the device; powers it off, etc. */
__iwl_down(priv); iwl_down(priv);
if (priv->mac80211_registered) if (priv->mac80211_registered)
ieee80211_stop_queues(priv->hw); ieee80211_stop_queues(priv->hw);
...@@ -9250,8 +9247,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -9250,8 +9247,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
pci_disable_device(pdev); pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
mutex_unlock(&priv->mutex);
return 0; return 0;
} }
...@@ -9309,8 +9304,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) ...@@ -9309,8 +9304,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
printk(KERN_INFO "Coming out of suspend...\n"); printk(KERN_INFO "Coming out of suspend...\n");
mutex_lock(&priv->mutex);
pci_set_power_state(pdev, PCI_D0); pci_set_power_state(pdev, PCI_D0);
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
pci_restore_state(pdev); pci_restore_state(pdev);
...@@ -9324,7 +9317,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) ...@@ -9324,7 +9317,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
pci_write_config_byte(pdev, 0x41, 0x00); pci_write_config_byte(pdev, 0x41, 0x00);
iwl_resume(priv); iwl_resume(priv);
mutex_unlock(&priv->mutex);
return 0; return 0;
} }
......
...@@ -38,6 +38,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = { ...@@ -38,6 +38,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
{USB_DEVICE(0x0846, 0x6a00)}, {USB_DEVICE(0x0846, 0x6a00)},
/* HP */ /* HP */
{USB_DEVICE(0x03f0, 0xca02)}, {USB_DEVICE(0x03f0, 0xca02)},
/* Sitecom */
{USB_DEVICE(0x0df6, 0x000d)},
{} {}
}; };
......
...@@ -265,10 +265,10 @@ enum yellowfin_offsets { ...@@ -265,10 +265,10 @@ enum yellowfin_offsets {
/* The Yellowfin Rx and Tx buffer descriptors. /* The Yellowfin Rx and Tx buffer descriptors.
Elements are written as 32 bit for endian portability. */ Elements are written as 32 bit for endian portability. */
struct yellowfin_desc { struct yellowfin_desc {
u32 dbdma_cmd; __le32 dbdma_cmd;
u32 addr; __le32 addr;
u32 branch_addr; __le32 branch_addr;
u32 result_status; __le32 result_status;
}; };
struct tx_status_words { struct tx_status_words {
...@@ -922,7 +922,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance) ...@@ -922,7 +922,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
dev->stats.tx_packets++; dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
/* Free the original skb. */ /* Free the original skb. */
pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr, pci_unmap_single(yp->pci_dev, le32_to_cpu(yp->tx_ring[entry].addr),
skb->len, PCI_DMA_TODEVICE); skb->len, PCI_DMA_TODEVICE);
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
yp->tx_skbuff[entry] = NULL; yp->tx_skbuff[entry] = NULL;
...@@ -1056,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev) ...@@ -1056,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev)
if(!desc->result_status) if(!desc->result_status)
break; break;
pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr, pci_dma_sync_single_for_cpu(yp->pci_dev, le32_to_cpu(desc->addr),
yp->rx_buf_sz, PCI_DMA_FROMDEVICE); yp->rx_buf_sz, PCI_DMA_FROMDEVICE);
desc_status = le32_to_cpu(desc->result_status) >> 16; desc_status = le32_to_cpu(desc->result_status) >> 16;
buf_addr = rx_skb->data; buf_addr = rx_skb->data;
data_size = (le32_to_cpu(desc->dbdma_cmd) - data_size = (le32_to_cpu(desc->dbdma_cmd) -
le32_to_cpu(desc->result_status)) & 0xffff; le32_to_cpu(desc->result_status)) & 0xffff;
frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2]))); frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2])));
if (yellowfin_debug > 4) if (yellowfin_debug > 4)
printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n",
frame_status); frame_status);
...@@ -1123,7 +1123,7 @@ static int yellowfin_rx(struct net_device *dev) ...@@ -1123,7 +1123,7 @@ static int yellowfin_rx(struct net_device *dev)
if (pkt_len > rx_copybreak) { if (pkt_len > rx_copybreak) {
skb_put(skb = rx_skb, pkt_len); skb_put(skb = rx_skb, pkt_len);
pci_unmap_single(yp->pci_dev, pci_unmap_single(yp->pci_dev,
yp->rx_ring[entry].addr, le32_to_cpu(yp->rx_ring[entry].addr),
yp->rx_buf_sz, yp->rx_buf_sz,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
yp->rx_skbuff[entry] = NULL; yp->rx_skbuff[entry] = NULL;
...@@ -1134,9 +1134,10 @@ static int yellowfin_rx(struct net_device *dev) ...@@ -1134,9 +1134,10 @@ static int yellowfin_rx(struct net_device *dev)
skb_reserve(skb, 2); /* 16 byte align the IP header */ skb_reserve(skb, 2); /* 16 byte align the IP header */
skb_copy_to_linear_data(skb, rx_skb->data, pkt_len); skb_copy_to_linear_data(skb, rx_skb->data, pkt_len);
skb_put(skb, pkt_len); skb_put(skb, pkt_len);
pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, pci_dma_sync_single_for_device(yp->pci_dev,
yp->rx_buf_sz, le32_to_cpu(desc->addr),
PCI_DMA_FROMDEVICE); yp->rx_buf_sz,
PCI_DMA_FROMDEVICE);
} }
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
...@@ -1252,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev) ...@@ -1252,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev)
/* Free all the skbuffs in the Rx queue. */ /* Free all the skbuffs in the Rx queue. */
for (i = 0; i < RX_RING_SIZE; i++) { for (i = 0; i < RX_RING_SIZE; i++) {
yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP);
yp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ yp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
if (yp->rx_skbuff[i]) { if (yp->rx_skbuff[i]) {
dev_kfree_skb(yp->rx_skbuff[i]); dev_kfree_skb(yp->rx_skbuff[i]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment