diff options
Diffstat (limited to 'drivers/net')
174 files changed, 4715 insertions, 765 deletions
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index 3e00fa8ea65f..4a7c32895be5 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c | |||
@@ -832,7 +832,9 @@ static int corkscrew_open(struct net_device *dev) | |||
832 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 832 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
833 | vp->rx_ring[i].addr = isa_virt_to_bus(skb->data); | 833 | vp->rx_ring[i].addr = isa_virt_to_bus(skb->data); |
834 | } | 834 | } |
835 | vp->rx_ring[i - 1].next = isa_virt_to_bus(&vp->rx_ring[0]); /* Wrap the ring. */ | 835 | if (i != 0) |
836 | vp->rx_ring[i - 1].next = | ||
837 | isa_virt_to_bus(&vp->rx_ring[0]); /* Wrap the ring. */ | ||
836 | outl(isa_virt_to_bus(&vp->rx_ring[0]), ioaddr + UpListPtr); | 838 | outl(isa_virt_to_bus(&vp->rx_ring[0]), ioaddr + UpListPtr); |
837 | } | 839 | } |
838 | if (vp->full_bus_master_tx) { /* Boomerang bus master Tx. */ | 840 | if (vp->full_bus_master_tx) { /* Boomerang bus master Tx. */ |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index c34aee91250b..c20416850948 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -2721,13 +2721,15 @@ dump_tx_ring(struct net_device *dev) | |||
2721 | &vp->tx_ring[vp->dirty_tx % TX_RING_SIZE]); | 2721 | &vp->tx_ring[vp->dirty_tx % TX_RING_SIZE]); |
2722 | issue_and_wait(dev, DownStall); | 2722 | issue_and_wait(dev, DownStall); |
2723 | for (i = 0; i < TX_RING_SIZE; i++) { | 2723 | for (i = 0; i < TX_RING_SIZE; i++) { |
2724 | pr_err(" %d: @%p length %8.8x status %8.8x\n", i, | 2724 | unsigned int length; |
2725 | &vp->tx_ring[i], | 2725 | |
2726 | #if DO_ZEROCOPY | 2726 | #if DO_ZEROCOPY |
2727 | le32_to_cpu(vp->tx_ring[i].frag[0].length), | 2727 | length = le32_to_cpu(vp->tx_ring[i].frag[0].length); |
2728 | #else | 2728 | #else |
2729 | le32_to_cpu(vp->tx_ring[i].length), | 2729 | length = le32_to_cpu(vp->tx_ring[i].length); |
2730 | #endif | 2730 | #endif |
2731 | pr_err(" %d: @%p length %8.8x status %8.8x\n", | ||
2732 | i, &vp->tx_ring[i], length, | ||
2731 | le32_to_cpu(vp->tx_ring[i].status)); | 2733 | le32_to_cpu(vp->tx_ring[i].status)); |
2732 | } | 2734 | } |
2733 | if (!stalled) | 2735 | if (!stalled) |
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 8ae72ec14456..0e2ba21d4441 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -908,6 +908,7 @@ static const struct net_device_ops rtl8139_netdev_ops = { | |||
908 | .ndo_open = rtl8139_open, | 908 | .ndo_open = rtl8139_open, |
909 | .ndo_stop = rtl8139_close, | 909 | .ndo_stop = rtl8139_close, |
910 | .ndo_get_stats = rtl8139_get_stats, | 910 | .ndo_get_stats = rtl8139_get_stats, |
911 | .ndo_change_mtu = eth_change_mtu, | ||
911 | .ndo_validate_addr = eth_validate_addr, | 912 | .ndo_validate_addr = eth_validate_addr, |
912 | .ndo_set_mac_address = rtl8139_set_mac_address, | 913 | .ndo_set_mac_address = rtl8139_set_mac_address, |
913 | .ndo_start_xmit = rtl8139_start_xmit, | 914 | .ndo_start_xmit = rtl8139_start_xmit, |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index c155bd3ec9f1..5f6509a5f640 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1729,6 +1729,13 @@ config KS8842 | |||
1729 | help | 1729 | help |
1730 | This platform driver is for Micrel KSZ8842 chip. | 1730 | This platform driver is for Micrel KSZ8842 chip. |
1731 | 1731 | ||
1732 | config KS8851 | ||
1733 | tristate "Micrel KS8851 SPI" | ||
1734 | depends on SPI | ||
1735 | select MII | ||
1736 | help | ||
1737 | SPI driver for Micrel KS8851 SPI attached network chip. | ||
1738 | |||
1732 | config VIA_RHINE | 1739 | config VIA_RHINE |
1733 | tristate "VIA Rhine support" | 1740 | tristate "VIA Rhine support" |
1734 | depends on NET_PCI && PCI | 1741 | depends on NET_PCI && PCI |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 4b58a59f211b..ead8cab3cfe1 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -88,6 +88,7 @@ obj-$(CONFIG_SKGE) += skge.o | |||
88 | obj-$(CONFIG_SKY2) += sky2.o | 88 | obj-$(CONFIG_SKY2) += sky2.o |
89 | obj-$(CONFIG_SKFP) += skfp/ | 89 | obj-$(CONFIG_SKFP) += skfp/ |
90 | obj-$(CONFIG_KS8842) += ks8842.o | 90 | obj-$(CONFIG_KS8842) += ks8842.o |
91 | obj-$(CONFIG_KS8851) += ks8851.o | ||
91 | obj-$(CONFIG_VIA_RHINE) += via-rhine.o | 92 | obj-$(CONFIG_VIA_RHINE) += via-rhine.o |
92 | obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o | 93 | obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o |
93 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o | 94 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o |
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index 85a18175730b..08787f5a22a3 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c | |||
@@ -569,16 +569,8 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
569 | 569 | ||
570 | #ifdef DEBUG_DRIVER | 570 | #ifdef DEBUG_DRIVER |
571 | /* dump the packet */ | 571 | /* dump the packet */ |
572 | { | 572 | print_hex_dump(KERN_DEBUG, "skb->data: ", DUMP_PREFIX_NONE, |
573 | int i; | 573 | 16, 1, skb->data, 64, true); |
574 | |||
575 | for (i = 0; i < 64; i++) { | ||
576 | if ((i % 16) == 0) | ||
577 | printk("\n" KERN_DEBUG); | ||
578 | printk ("%2.2x ", skb->data [i]); | ||
579 | } | ||
580 | printk("\n"); | ||
581 | } | ||
582 | #endif | 574 | #endif |
583 | entry = lp->tx_new & lp->tx_ring_mod_mask; | 575 | entry = lp->tx_new & lp->tx_ring_mod_mask; |
584 | ib->btx_ring [entry].length = (-skblen) | 0xf000; | 576 | ib->btx_ring [entry].length = (-skblen) | 0xf000; |
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index d6d4ab3b430c..7d227cdab9f8 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c | |||
@@ -158,15 +158,12 @@ module_exit(arcnet_exit); | |||
158 | void arcnet_dump_skb(struct net_device *dev, | 158 | void arcnet_dump_skb(struct net_device *dev, |
159 | struct sk_buff *skb, char *desc) | 159 | struct sk_buff *skb, char *desc) |
160 | { | 160 | { |
161 | int i; | 161 | char hdr[32]; |
162 | 162 | ||
163 | printk(KERN_DEBUG "%6s: skb dump (%s) follows:", dev->name, desc); | 163 | /* dump the packet */ |
164 | for (i = 0; i < skb->len; i++) { | 164 | snprintf(hdr, sizeof(hdr), "%6s:%s skb->data:", dev->name, desc); |
165 | if (i % 16 == 0) | 165 | print_hex_dump(KERN_DEBUG, hdr, DUMP_PREFIX_OFFSET, |
166 | printk("\n" KERN_DEBUG "[%04X] ", i); | 166 | 16, 1, skb->data, skb->len, true); |
167 | printk("%02X ", ((u_char *) skb->data)[i]); | ||
168 | } | ||
169 | printk("\n"); | ||
170 | } | 167 | } |
171 | 168 | ||
172 | EXPORT_SYMBOL(arcnet_dump_skb); | 169 | EXPORT_SYMBOL(arcnet_dump_skb); |
@@ -184,6 +181,7 @@ static void arcnet_dump_packet(struct net_device *dev, int bufnum, | |||
184 | int i, length; | 181 | int i, length; |
185 | unsigned long flags = 0; | 182 | unsigned long flags = 0; |
186 | static uint8_t buf[512]; | 183 | static uint8_t buf[512]; |
184 | char hdr[32]; | ||
187 | 185 | ||
188 | /* hw.copy_from_card expects IRQ context so take the IRQ lock | 186 | /* hw.copy_from_card expects IRQ context so take the IRQ lock |
189 | to keep it single threaded */ | 187 | to keep it single threaded */ |
@@ -197,14 +195,10 @@ static void arcnet_dump_packet(struct net_device *dev, int bufnum, | |||
197 | /* if the offset[0] byte is nonzero, this is a 256-byte packet */ | 195 | /* if the offset[0] byte is nonzero, this is a 256-byte packet */ |
198 | length = (buf[2] ? 256 : 512); | 196 | length = (buf[2] ? 256 : 512); |
199 | 197 | ||
200 | printk(KERN_DEBUG "%6s: packet dump (%s) follows:", dev->name, desc); | 198 | /* dump the packet */ |
201 | for (i = 0; i < length; i++) { | 199 | snprintf(hdr, sizeof(hdr), "%6s:%s packet dump:", dev->name, desc); |
202 | if (i % 16 == 0) | 200 | print_hex_dump(KERN_DEBUG, hdr, DUMP_PREFIX_OFFSET, |
203 | printk("\n" KERN_DEBUG "[%04X] ", i); | 201 | 16, 1, buf, length, true); |
204 | printk("%02X ", buf[i]); | ||
205 | } | ||
206 | printk("\n"); | ||
207 | |||
208 | } | 202 | } |
209 | 203 | ||
210 | #else | 204 | #else |
diff --git a/drivers/net/arm/Kconfig b/drivers/net/arm/Kconfig index 2895db13bfa4..c37ee9e6b67b 100644 --- a/drivers/net/arm/Kconfig +++ b/drivers/net/arm/Kconfig | |||
@@ -63,3 +63,11 @@ config IXP4XX_ETH | |||
63 | help | 63 | help |
64 | Say Y here if you want to use built-in Ethernet ports | 64 | Say Y here if you want to use built-in Ethernet ports |
65 | on IXP4xx processor. | 65 | on IXP4xx processor. |
66 | |||
67 | config W90P910_ETH | ||
68 | tristate "Nuvoton w90p910 Ethernet support" | ||
69 | depends on ARM && ARCH_W90X900 | ||
70 | select PHYLIB | ||
71 | help | ||
72 | Say Y here if you want to use built-in Ethernet ports | ||
73 | on w90p910 processor. | ||
diff --git a/drivers/net/arm/Makefile b/drivers/net/arm/Makefile index 811a3ccd14c1..303171f589e6 100644 --- a/drivers/net/arm/Makefile +++ b/drivers/net/arm/Makefile | |||
@@ -11,3 +11,4 @@ obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o | |||
11 | obj-$(CONFIG_ARM_KS8695_ETHER) += ks8695net.o | 11 | obj-$(CONFIG_ARM_KS8695_ETHER) += ks8695net.o |
12 | obj-$(CONFIG_EP93XX_ETH) += ep93xx_eth.o | 12 | obj-$(CONFIG_EP93XX_ETH) += ep93xx_eth.o |
13 | obj-$(CONFIG_IXP4XX_ETH) += ixp4xx_eth.o | 13 | obj-$(CONFIG_IXP4XX_ETH) += ixp4xx_eth.o |
14 | obj-$(CONFIG_W90P910_ETH) += w90p910_ether.o | ||
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index 2e7419a61191..5041d10bae9d 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
@@ -1228,7 +1228,6 @@ static int at91ether_resume(struct platform_device *pdev) | |||
1228 | #endif | 1228 | #endif |
1229 | 1229 | ||
1230 | static struct platform_driver at91ether_driver = { | 1230 | static struct platform_driver at91ether_driver = { |
1231 | .probe = at91ether_probe, | ||
1232 | .remove = __devexit_p(at91ether_remove), | 1231 | .remove = __devexit_p(at91ether_remove), |
1233 | .suspend = at91ether_suspend, | 1232 | .suspend = at91ether_suspend, |
1234 | .resume = at91ether_resume, | 1233 | .resume = at91ether_resume, |
@@ -1240,7 +1239,7 @@ static struct platform_driver at91ether_driver = { | |||
1240 | 1239 | ||
1241 | static int __init at91ether_init(void) | 1240 | static int __init at91ether_init(void) |
1242 | { | 1241 | { |
1243 | return platform_driver_register(&at91ether_driver); | 1242 | return platform_driver_probe(&at91ether_driver, at91ether_probe); |
1244 | } | 1243 | } |
1245 | 1244 | ||
1246 | static void __exit at91ether_exit(void) | 1245 | static void __exit at91ether_exit(void) |
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c index 6f42ad728915..3fe09876e76d 100644 --- a/drivers/net/arm/ixp4xx_eth.c +++ b/drivers/net/arm/ixp4xx_eth.c | |||
@@ -1142,7 +1142,9 @@ static const struct net_device_ops ixp4xx_netdev_ops = { | |||
1142 | .ndo_start_xmit = eth_xmit, | 1142 | .ndo_start_xmit = eth_xmit, |
1143 | .ndo_set_multicast_list = eth_set_mcast_list, | 1143 | .ndo_set_multicast_list = eth_set_mcast_list, |
1144 | .ndo_do_ioctl = eth_ioctl, | 1144 | .ndo_do_ioctl = eth_ioctl, |
1145 | 1145 | .ndo_change_mtu = eth_change_mtu, | |
1146 | .ndo_set_mac_address = eth_mac_addr, | ||
1147 | .ndo_validate_addr = eth_validate_addr, | ||
1146 | }; | 1148 | }; |
1147 | 1149 | ||
1148 | static int __devinit eth_init_one(struct platform_device *pdev) | 1150 | static int __devinit eth_init_one(struct platform_device *pdev) |
diff --git a/drivers/net/arm/w90p910_ether.c b/drivers/net/arm/w90p910_ether.c new file mode 100644 index 000000000000..616fb7985a34 --- /dev/null +++ b/drivers/net/arm/w90p910_ether.c | |||
@@ -0,0 +1,1105 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008-2009 Nuvoton technology corporation. | ||
3 | * | ||
4 | * Wan ZongShun <mcuos.com@gmail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation;version 2 of the License. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/mii.h> | ||
15 | #include <linux/netdevice.h> | ||
16 | #include <linux/etherdevice.h> | ||
17 | #include <linux/skbuff.h> | ||
18 | #include <linux/ethtool.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/clk.h> | ||
21 | |||
22 | #define DRV_MODULE_NAME "w90p910-emc" | ||
23 | #define DRV_MODULE_VERSION "0.1" | ||
24 | |||
25 | /* Ethernet MAC Registers */ | ||
26 | #define REG_CAMCMR 0x00 | ||
27 | #define REG_CAMEN 0x04 | ||
28 | #define REG_CAMM_BASE 0x08 | ||
29 | #define REG_CAML_BASE 0x0c | ||
30 | #define REG_TXDLSA 0x88 | ||
31 | #define REG_RXDLSA 0x8C | ||
32 | #define REG_MCMDR 0x90 | ||
33 | #define REG_MIID 0x94 | ||
34 | #define REG_MIIDA 0x98 | ||
35 | #define REG_FFTCR 0x9C | ||
36 | #define REG_TSDR 0xa0 | ||
37 | #define REG_RSDR 0xa4 | ||
38 | #define REG_DMARFC 0xa8 | ||
39 | #define REG_MIEN 0xac | ||
40 | #define REG_MISTA 0xb0 | ||
41 | #define REG_CTXDSA 0xcc | ||
42 | #define REG_CTXBSA 0xd0 | ||
43 | #define REG_CRXDSA 0xd4 | ||
44 | #define REG_CRXBSA 0xd8 | ||
45 | |||
46 | /* mac controller bit */ | ||
47 | #define MCMDR_RXON 0x01 | ||
48 | #define MCMDR_ACP (0x01 << 3) | ||
49 | #define MCMDR_SPCRC (0x01 << 5) | ||
50 | #define MCMDR_TXON (0x01 << 8) | ||
51 | #define MCMDR_FDUP (0x01 << 18) | ||
52 | #define MCMDR_ENMDC (0x01 << 19) | ||
53 | #define MCMDR_OPMOD (0x01 << 20) | ||
54 | #define SWR (0x01 << 24) | ||
55 | |||
56 | /* cam command regiser */ | ||
57 | #define CAMCMR_AUP 0x01 | ||
58 | #define CAMCMR_AMP (0x01 << 1) | ||
59 | #define CAMCMR_ABP (0x01 << 2) | ||
60 | #define CAMCMR_CCAM (0x01 << 3) | ||
61 | #define CAMCMR_ECMP (0x01 << 4) | ||
62 | #define CAM0EN 0x01 | ||
63 | |||
64 | /* mac mii controller bit */ | ||
65 | #define MDCCR (0x0a << 20) | ||
66 | #define PHYAD (0x01 << 8) | ||
67 | #define PHYWR (0x01 << 16) | ||
68 | #define PHYBUSY (0x01 << 17) | ||
69 | #define PHYPRESP (0x01 << 18) | ||
70 | #define CAM_ENTRY_SIZE 0x08 | ||
71 | |||
72 | /* rx and tx status */ | ||
73 | #define TXDS_TXCP (0x01 << 19) | ||
74 | #define RXDS_CRCE (0x01 << 17) | ||
75 | #define RXDS_PTLE (0x01 << 19) | ||
76 | #define RXDS_RXGD (0x01 << 20) | ||
77 | #define RXDS_ALIE (0x01 << 21) | ||
78 | #define RXDS_RP (0x01 << 22) | ||
79 | |||
80 | /* mac interrupt status*/ | ||
81 | #define MISTA_EXDEF (0x01 << 19) | ||
82 | #define MISTA_TXBERR (0x01 << 24) | ||
83 | #define MISTA_TDU (0x01 << 23) | ||
84 | #define MISTA_RDU (0x01 << 10) | ||
85 | #define MISTA_RXBERR (0x01 << 11) | ||
86 | |||
87 | #define ENSTART 0x01 | ||
88 | #define ENRXINTR 0x01 | ||
89 | #define ENRXGD (0x01 << 4) | ||
90 | #define ENRXBERR (0x01 << 11) | ||
91 | #define ENTXINTR (0x01 << 16) | ||
92 | #define ENTXCP (0x01 << 18) | ||
93 | #define ENTXABT (0x01 << 21) | ||
94 | #define ENTXBERR (0x01 << 24) | ||
95 | #define ENMDC (0x01 << 19) | ||
96 | #define PHYBUSY (0x01 << 17) | ||
97 | #define MDCCR_VAL 0xa00000 | ||
98 | |||
99 | /* rx and tx owner bit */ | ||
100 | #define RX_OWEN_DMA (0x01 << 31) | ||
101 | #define RX_OWEN_CPU (~(0x03 << 30)) | ||
102 | #define TX_OWEN_DMA (0x01 << 31) | ||
103 | #define TX_OWEN_CPU (~(0x01 << 31)) | ||
104 | |||
105 | /* tx frame desc controller bit */ | ||
106 | #define MACTXINTEN 0x04 | ||
107 | #define CRCMODE 0x02 | ||
108 | #define PADDINGMODE 0x01 | ||
109 | |||
110 | /* fftcr controller bit */ | ||
111 | #define TXTHD (0x03 << 8) | ||
112 | #define BLENGTH (0x01 << 20) | ||
113 | |||
114 | /* global setting for driver */ | ||
115 | #define RX_DESC_SIZE 50 | ||
116 | #define TX_DESC_SIZE 10 | ||
117 | #define MAX_RBUFF_SZ 0x600 | ||
118 | #define MAX_TBUFF_SZ 0x600 | ||
119 | #define TX_TIMEOUT 50 | ||
120 | #define DELAY 1000 | ||
121 | #define CAM0 0x0 | ||
122 | |||
123 | static int w90p910_mdio_read(struct net_device *dev, int phy_id, int reg); | ||
124 | |||
125 | struct w90p910_rxbd { | ||
126 | unsigned int sl; | ||
127 | unsigned int buffer; | ||
128 | unsigned int reserved; | ||
129 | unsigned int next; | ||
130 | }; | ||
131 | |||
132 | struct w90p910_txbd { | ||
133 | unsigned int mode; | ||
134 | unsigned int buffer; | ||
135 | unsigned int sl; | ||
136 | unsigned int next; | ||
137 | }; | ||
138 | |||
139 | struct recv_pdesc { | ||
140 | struct w90p910_rxbd desclist[RX_DESC_SIZE]; | ||
141 | char recv_buf[RX_DESC_SIZE][MAX_RBUFF_SZ]; | ||
142 | }; | ||
143 | |||
144 | struct tran_pdesc { | ||
145 | struct w90p910_txbd desclist[TX_DESC_SIZE]; | ||
146 | char tran_buf[RX_DESC_SIZE][MAX_TBUFF_SZ]; | ||
147 | }; | ||
148 | |||
149 | struct w90p910_ether { | ||
150 | struct recv_pdesc *rdesc; | ||
151 | struct recv_pdesc *rdesc_phys; | ||
152 | struct tran_pdesc *tdesc; | ||
153 | struct tran_pdesc *tdesc_phys; | ||
154 | struct net_device_stats stats; | ||
155 | struct platform_device *pdev; | ||
156 | struct sk_buff *skb; | ||
157 | struct clk *clk; | ||
158 | struct clk *rmiiclk; | ||
159 | struct mii_if_info mii; | ||
160 | struct timer_list check_timer; | ||
161 | void __iomem *reg; | ||
162 | unsigned int rxirq; | ||
163 | unsigned int txirq; | ||
164 | unsigned int cur_tx; | ||
165 | unsigned int cur_rx; | ||
166 | unsigned int finish_tx; | ||
167 | unsigned int rx_packets; | ||
168 | unsigned int rx_bytes; | ||
169 | unsigned int start_tx_ptr; | ||
170 | unsigned int start_rx_ptr; | ||
171 | unsigned int linkflag; | ||
172 | spinlock_t lock; | ||
173 | }; | ||
174 | |||
175 | static void update_linkspeed_register(struct net_device *dev, | ||
176 | unsigned int speed, unsigned int duplex) | ||
177 | { | ||
178 | struct w90p910_ether *ether = netdev_priv(dev); | ||
179 | unsigned int val; | ||
180 | |||
181 | val = __raw_readl(ether->reg + REG_MCMDR); | ||
182 | |||
183 | if (speed == SPEED_100) { | ||
184 | /* 100 full/half duplex */ | ||
185 | if (duplex == DUPLEX_FULL) { | ||
186 | val |= (MCMDR_OPMOD | MCMDR_FDUP); | ||
187 | } else { | ||
188 | val |= MCMDR_OPMOD; | ||
189 | val &= ~MCMDR_FDUP; | ||
190 | } | ||
191 | } else { | ||
192 | /* 10 full/half duplex */ | ||
193 | if (duplex == DUPLEX_FULL) { | ||
194 | val |= MCMDR_FDUP; | ||
195 | val &= ~MCMDR_OPMOD; | ||
196 | } else { | ||
197 | val &= ~(MCMDR_FDUP | MCMDR_OPMOD); | ||
198 | } | ||
199 | } | ||
200 | |||
201 | __raw_writel(val, ether->reg + REG_MCMDR); | ||
202 | } | ||
203 | |||
204 | static void update_linkspeed(struct net_device *dev) | ||
205 | { | ||
206 | struct w90p910_ether *ether = netdev_priv(dev); | ||
207 | struct platform_device *pdev; | ||
208 | unsigned int bmsr, bmcr, lpa, speed, duplex; | ||
209 | |||
210 | pdev = ether->pdev; | ||
211 | |||
212 | if (!mii_link_ok(ðer->mii)) { | ||
213 | ether->linkflag = 0x0; | ||
214 | netif_carrier_off(dev); | ||
215 | dev_warn(&pdev->dev, "%s: Link down.\n", dev->name); | ||
216 | return; | ||
217 | } | ||
218 | |||
219 | if (ether->linkflag == 1) | ||
220 | return; | ||
221 | |||
222 | bmsr = w90p910_mdio_read(dev, ether->mii.phy_id, MII_BMSR); | ||
223 | bmcr = w90p910_mdio_read(dev, ether->mii.phy_id, MII_BMCR); | ||
224 | |||
225 | if (bmcr & BMCR_ANENABLE) { | ||
226 | if (!(bmsr & BMSR_ANEGCOMPLETE)) | ||
227 | return; | ||
228 | |||
229 | lpa = w90p910_mdio_read(dev, ether->mii.phy_id, MII_LPA); | ||
230 | |||
231 | if ((lpa & LPA_100FULL) || (lpa & LPA_100HALF)) | ||
232 | speed = SPEED_100; | ||
233 | else | ||
234 | speed = SPEED_10; | ||
235 | |||
236 | if ((lpa & LPA_100FULL) || (lpa & LPA_10FULL)) | ||
237 | duplex = DUPLEX_FULL; | ||
238 | else | ||
239 | duplex = DUPLEX_HALF; | ||
240 | |||
241 | } else { | ||
242 | speed = (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10; | ||
243 | duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF; | ||
244 | } | ||
245 | |||
246 | update_linkspeed_register(dev, speed, duplex); | ||
247 | |||
248 | dev_info(&pdev->dev, "%s: Link now %i-%s\n", dev->name, speed, | ||
249 | (duplex == DUPLEX_FULL) ? "FullDuplex" : "HalfDuplex"); | ||
250 | ether->linkflag = 0x01; | ||
251 | |||
252 | netif_carrier_on(dev); | ||
253 | } | ||
254 | |||
255 | static void w90p910_check_link(unsigned long dev_id) | ||
256 | { | ||
257 | struct net_device *dev = (struct net_device *) dev_id; | ||
258 | struct w90p910_ether *ether = netdev_priv(dev); | ||
259 | |||
260 | update_linkspeed(dev); | ||
261 | mod_timer(ðer->check_timer, jiffies + msecs_to_jiffies(1000)); | ||
262 | } | ||
263 | |||
264 | static void w90p910_write_cam(struct net_device *dev, | ||
265 | unsigned int x, unsigned char *pval) | ||
266 | { | ||
267 | struct w90p910_ether *ether = netdev_priv(dev); | ||
268 | unsigned int msw, lsw; | ||
269 | |||
270 | msw = (pval[0] << 24) | (pval[1] << 16) | (pval[2] << 8) | pval[3]; | ||
271 | |||
272 | lsw = (pval[4] << 24) | (pval[5] << 16); | ||
273 | |||
274 | __raw_writel(lsw, ether->reg + REG_CAML_BASE + x * CAM_ENTRY_SIZE); | ||
275 | __raw_writel(msw, ether->reg + REG_CAMM_BASE + x * CAM_ENTRY_SIZE); | ||
276 | } | ||
277 | |||
278 | static void w90p910_init_desc(struct net_device *dev) | ||
279 | { | ||
280 | struct w90p910_ether *ether; | ||
281 | struct w90p910_txbd *tdesc, *tdesc_phys; | ||
282 | struct w90p910_rxbd *rdesc, *rdesc_phys; | ||
283 | unsigned int i, j; | ||
284 | |||
285 | ether = netdev_priv(dev); | ||
286 | |||
287 | ether->tdesc = (struct tran_pdesc *) | ||
288 | dma_alloc_coherent(NULL, sizeof(struct tran_pdesc), | ||
289 | (dma_addr_t *) ðer->tdesc_phys, GFP_KERNEL); | ||
290 | |||
291 | ether->rdesc = (struct recv_pdesc *) | ||
292 | dma_alloc_coherent(NULL, sizeof(struct recv_pdesc), | ||
293 | (dma_addr_t *) ðer->rdesc_phys, GFP_KERNEL); | ||
294 | |||
295 | for (i = 0; i < TX_DESC_SIZE; i++) { | ||
296 | tdesc = &(ether->tdesc->desclist[i]); | ||
297 | |||
298 | j = ((i + 1) / TX_DESC_SIZE); | ||
299 | |||
300 | if (j != 0) { | ||
301 | tdesc_phys = &(ether->tdesc_phys->desclist[0]); | ||
302 | ether->start_tx_ptr = (unsigned int)tdesc_phys; | ||
303 | tdesc->next = (unsigned int)ether->start_tx_ptr; | ||
304 | } else { | ||
305 | tdesc_phys = &(ether->tdesc_phys->desclist[i+1]); | ||
306 | tdesc->next = (unsigned int)tdesc_phys; | ||
307 | } | ||
308 | |||
309 | tdesc->buffer = (unsigned int)ether->tdesc_phys->tran_buf[i]; | ||
310 | tdesc->sl = 0; | ||
311 | tdesc->mode = 0; | ||
312 | } | ||
313 | |||
314 | for (i = 0; i < RX_DESC_SIZE; i++) { | ||
315 | rdesc = &(ether->rdesc->desclist[i]); | ||
316 | |||
317 | j = ((i + 1) / RX_DESC_SIZE); | ||
318 | |||
319 | if (j != 0) { | ||
320 | rdesc_phys = &(ether->rdesc_phys->desclist[0]); | ||
321 | ether->start_rx_ptr = (unsigned int)rdesc_phys; | ||
322 | rdesc->next = (unsigned int)ether->start_rx_ptr; | ||
323 | } else { | ||
324 | rdesc_phys = &(ether->rdesc_phys->desclist[i+1]); | ||
325 | rdesc->next = (unsigned int)rdesc_phys; | ||
326 | } | ||
327 | |||
328 | rdesc->sl = RX_OWEN_DMA; | ||
329 | rdesc->buffer = (unsigned int)ether->rdesc_phys->recv_buf[i]; | ||
330 | } | ||
331 | } | ||
332 | |||
333 | static void w90p910_set_fifo_threshold(struct net_device *dev) | ||
334 | { | ||
335 | struct w90p910_ether *ether = netdev_priv(dev); | ||
336 | unsigned int val; | ||
337 | |||
338 | val = TXTHD | BLENGTH; | ||
339 | __raw_writel(val, ether->reg + REG_FFTCR); | ||
340 | } | ||
341 | |||
342 | static void w90p910_return_default_idle(struct net_device *dev) | ||
343 | { | ||
344 | struct w90p910_ether *ether = netdev_priv(dev); | ||
345 | unsigned int val; | ||
346 | |||
347 | val = __raw_readl(ether->reg + REG_MCMDR); | ||
348 | val |= SWR; | ||
349 | __raw_writel(val, ether->reg + REG_MCMDR); | ||
350 | } | ||
351 | |||
352 | static void w90p910_trigger_rx(struct net_device *dev) | ||
353 | { | ||
354 | struct w90p910_ether *ether = netdev_priv(dev); | ||
355 | |||
356 | __raw_writel(ENSTART, ether->reg + REG_RSDR); | ||
357 | } | ||
358 | |||
359 | static void w90p910_trigger_tx(struct net_device *dev) | ||
360 | { | ||
361 | struct w90p910_ether *ether = netdev_priv(dev); | ||
362 | |||
363 | __raw_writel(ENSTART, ether->reg + REG_TSDR); | ||
364 | } | ||
365 | |||
366 | static void w90p910_enable_mac_interrupt(struct net_device *dev) | ||
367 | { | ||
368 | struct w90p910_ether *ether = netdev_priv(dev); | ||
369 | unsigned int val; | ||
370 | |||
371 | val = ENTXINTR | ENRXINTR | ENRXGD | ENTXCP; | ||
372 | val |= ENTXBERR | ENRXBERR | ENTXABT; | ||
373 | |||
374 | __raw_writel(val, ether->reg + REG_MIEN); | ||
375 | } | ||
376 | |||
377 | static void w90p910_get_and_clear_int(struct net_device *dev, | ||
378 | unsigned int *val) | ||
379 | { | ||
380 | struct w90p910_ether *ether = netdev_priv(dev); | ||
381 | |||
382 | *val = __raw_readl(ether->reg + REG_MISTA); | ||
383 | __raw_writel(*val, ether->reg + REG_MISTA); | ||
384 | } | ||
385 | |||
386 | static void w90p910_set_global_maccmd(struct net_device *dev) | ||
387 | { | ||
388 | struct w90p910_ether *ether = netdev_priv(dev); | ||
389 | unsigned int val; | ||
390 | |||
391 | val = __raw_readl(ether->reg + REG_MCMDR); | ||
392 | val |= MCMDR_SPCRC | MCMDR_ENMDC | MCMDR_ACP | ENMDC; | ||
393 | __raw_writel(val, ether->reg + REG_MCMDR); | ||
394 | } | ||
395 | |||
396 | static void w90p910_enable_cam(struct net_device *dev) | ||
397 | { | ||
398 | struct w90p910_ether *ether = netdev_priv(dev); | ||
399 | unsigned int val; | ||
400 | |||
401 | w90p910_write_cam(dev, CAM0, dev->dev_addr); | ||
402 | |||
403 | val = __raw_readl(ether->reg + REG_CAMEN); | ||
404 | val |= CAM0EN; | ||
405 | __raw_writel(val, ether->reg + REG_CAMEN); | ||
406 | } | ||
407 | |||
408 | static void w90p910_enable_cam_command(struct net_device *dev) | ||
409 | { | ||
410 | struct w90p910_ether *ether = netdev_priv(dev); | ||
411 | unsigned int val; | ||
412 | |||
413 | val = CAMCMR_ECMP | CAMCMR_ABP | CAMCMR_AMP; | ||
414 | __raw_writel(val, ether->reg + REG_CAMCMR); | ||
415 | } | ||
416 | |||
417 | static void w90p910_enable_tx(struct net_device *dev, unsigned int enable) | ||
418 | { | ||
419 | struct w90p910_ether *ether = netdev_priv(dev); | ||
420 | unsigned int val; | ||
421 | |||
422 | val = __raw_readl(ether->reg + REG_MCMDR); | ||
423 | |||
424 | if (enable) | ||
425 | val |= MCMDR_TXON; | ||
426 | else | ||
427 | val &= ~MCMDR_TXON; | ||
428 | |||
429 | __raw_writel(val, ether->reg + REG_MCMDR); | ||
430 | } | ||
431 | |||
432 | static void w90p910_enable_rx(struct net_device *dev, unsigned int enable) | ||
433 | { | ||
434 | struct w90p910_ether *ether = netdev_priv(dev); | ||
435 | unsigned int val; | ||
436 | |||
437 | val = __raw_readl(ether->reg + REG_MCMDR); | ||
438 | |||
439 | if (enable) | ||
440 | val |= MCMDR_RXON; | ||
441 | else | ||
442 | val &= ~MCMDR_RXON; | ||
443 | |||
444 | __raw_writel(val, ether->reg + REG_MCMDR); | ||
445 | } | ||
446 | |||
447 | static void w90p910_set_curdest(struct net_device *dev) | ||
448 | { | ||
449 | struct w90p910_ether *ether = netdev_priv(dev); | ||
450 | |||
451 | __raw_writel(ether->start_rx_ptr, ether->reg + REG_RXDLSA); | ||
452 | __raw_writel(ether->start_tx_ptr, ether->reg + REG_TXDLSA); | ||
453 | } | ||
454 | |||
455 | static void w90p910_reset_mac(struct net_device *dev) | ||
456 | { | ||
457 | struct w90p910_ether *ether = netdev_priv(dev); | ||
458 | |||
459 | spin_lock(ðer->lock); | ||
460 | |||
461 | w90p910_enable_tx(dev, 0); | ||
462 | w90p910_enable_rx(dev, 0); | ||
463 | w90p910_set_fifo_threshold(dev); | ||
464 | w90p910_return_default_idle(dev); | ||
465 | |||
466 | if (!netif_queue_stopped(dev)) | ||
467 | netif_stop_queue(dev); | ||
468 | |||
469 | w90p910_init_desc(dev); | ||
470 | |||
471 | dev->trans_start = jiffies; | ||
472 | ether->cur_tx = 0x0; | ||
473 | ether->finish_tx = 0x0; | ||
474 | ether->cur_rx = 0x0; | ||
475 | |||
476 | w90p910_set_curdest(dev); | ||
477 | w90p910_enable_cam(dev); | ||
478 | w90p910_enable_cam_command(dev); | ||
479 | w90p910_enable_mac_interrupt(dev); | ||
480 | w90p910_enable_tx(dev, 1); | ||
481 | w90p910_enable_rx(dev, 1); | ||
482 | w90p910_trigger_tx(dev); | ||
483 | w90p910_trigger_rx(dev); | ||
484 | |||
485 | dev->trans_start = jiffies; | ||
486 | |||
487 | if (netif_queue_stopped(dev)) | ||
488 | netif_wake_queue(dev); | ||
489 | |||
490 | spin_unlock(ðer->lock); | ||
491 | } | ||
492 | |||
493 | static void w90p910_mdio_write(struct net_device *dev, | ||
494 | int phy_id, int reg, int data) | ||
495 | { | ||
496 | struct w90p910_ether *ether = netdev_priv(dev); | ||
497 | struct platform_device *pdev; | ||
498 | unsigned int val, i; | ||
499 | |||
500 | pdev = ether->pdev; | ||
501 | |||
502 | __raw_writel(data, ether->reg + REG_MIID); | ||
503 | |||
504 | val = (phy_id << 0x08) | reg; | ||
505 | val |= PHYBUSY | PHYWR | MDCCR_VAL; | ||
506 | __raw_writel(val, ether->reg + REG_MIIDA); | ||
507 | |||
508 | for (i = 0; i < DELAY; i++) { | ||
509 | if ((__raw_readl(ether->reg + REG_MIIDA) & PHYBUSY) == 0) | ||
510 | break; | ||
511 | } | ||
512 | |||
513 | if (i == DELAY) | ||
514 | dev_warn(&pdev->dev, "mdio write timed out\n"); | ||
515 | } | ||
516 | |||
517 | static int w90p910_mdio_read(struct net_device *dev, int phy_id, int reg) | ||
518 | { | ||
519 | struct w90p910_ether *ether = netdev_priv(dev); | ||
520 | struct platform_device *pdev; | ||
521 | unsigned int val, i, data; | ||
522 | |||
523 | pdev = ether->pdev; | ||
524 | |||
525 | val = (phy_id << 0x08) | reg; | ||
526 | val |= PHYBUSY | MDCCR_VAL; | ||
527 | __raw_writel(val, ether->reg + REG_MIIDA); | ||
528 | |||
529 | for (i = 0; i < DELAY; i++) { | ||
530 | if ((__raw_readl(ether->reg + REG_MIIDA) & PHYBUSY) == 0) | ||
531 | break; | ||
532 | } | ||
533 | |||
534 | if (i == DELAY) { | ||
535 | dev_warn(&pdev->dev, "mdio read timed out\n"); | ||
536 | data = 0xffff; | ||
537 | } else { | ||
538 | data = __raw_readl(ether->reg + REG_MIID); | ||
539 | } | ||
540 | |||
541 | return data; | ||
542 | } | ||
543 | |||
544 | static int set_mac_address(struct net_device *dev, void *addr) | ||
545 | { | ||
546 | struct sockaddr *address = addr; | ||
547 | |||
548 | if (!is_valid_ether_addr(address->sa_data)) | ||
549 | return -EADDRNOTAVAIL; | ||
550 | |||
551 | memcpy(dev->dev_addr, address->sa_data, dev->addr_len); | ||
552 | w90p910_write_cam(dev, CAM0, dev->dev_addr); | ||
553 | |||
554 | return 0; | ||
555 | } | ||
556 | |||
557 | static int w90p910_ether_close(struct net_device *dev) | ||
558 | { | ||
559 | struct w90p910_ether *ether = netdev_priv(dev); | ||
560 | |||
561 | dma_free_writecombine(NULL, sizeof(struct w90p910_rxbd), | ||
562 | ether->rdesc, (dma_addr_t)ether->rdesc_phys); | ||
563 | dma_free_writecombine(NULL, sizeof(struct w90p910_txbd), | ||
564 | ether->tdesc, (dma_addr_t)ether->tdesc_phys); | ||
565 | |||
566 | netif_stop_queue(dev); | ||
567 | |||
568 | del_timer_sync(ðer->check_timer); | ||
569 | clk_disable(ether->rmiiclk); | ||
570 | clk_disable(ether->clk); | ||
571 | |||
572 | free_irq(ether->txirq, dev); | ||
573 | free_irq(ether->rxirq, dev); | ||
574 | |||
575 | return 0; | ||
576 | } | ||
577 | |||
578 | static struct net_device_stats *w90p910_ether_stats(struct net_device *dev) | ||
579 | { | ||
580 | struct w90p910_ether *ether; | ||
581 | |||
582 | ether = netdev_priv(dev); | ||
583 | |||
584 | return ðer->stats; | ||
585 | } | ||
586 | |||
587 | static int w90p910_send_frame(struct net_device *dev, | ||
588 | unsigned char *data, int length) | ||
589 | { | ||
590 | struct w90p910_ether *ether; | ||
591 | struct w90p910_txbd *txbd; | ||
592 | struct platform_device *pdev; | ||
593 | unsigned char *buffer; | ||
594 | |||
595 | ether = netdev_priv(dev); | ||
596 | pdev = ether->pdev; | ||
597 | |||
598 | txbd = ðer->tdesc->desclist[ether->cur_tx]; | ||
599 | buffer = ether->tdesc->tran_buf[ether->cur_tx]; | ||
600 | if (length > 1514) { | ||
601 | dev_err(&pdev->dev, "send data %d bytes, check it\n", length); | ||
602 | length = 1514; | ||
603 | } | ||
604 | |||
605 | txbd->sl = length & 0xFFFF; | ||
606 | |||
607 | memcpy(buffer, data, length); | ||
608 | |||
609 | txbd->mode = TX_OWEN_DMA | PADDINGMODE | CRCMODE | MACTXINTEN; | ||
610 | |||
611 | w90p910_enable_tx(dev, 1); | ||
612 | |||
613 | w90p910_trigger_tx(dev); | ||
614 | |||
615 | ether->cur_tx = (ether->cur_tx+1) % TX_DESC_SIZE; | ||
616 | txbd = ðer->tdesc->desclist[ether->cur_tx]; | ||
617 | |||
618 | dev->trans_start = jiffies; | ||
619 | |||
620 | if (txbd->mode & TX_OWEN_DMA) | ||
621 | netif_stop_queue(dev); | ||
622 | |||
623 | return 0; | ||
624 | } | ||
625 | |||
626 | static int w90p910_ether_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
627 | { | ||
628 | struct w90p910_ether *ether = netdev_priv(dev); | ||
629 | |||
630 | if (!(w90p910_send_frame(dev, skb->data, skb->len))) { | ||
631 | ether->skb = skb; | ||
632 | dev_kfree_skb_irq(skb); | ||
633 | return 0; | ||
634 | } | ||
635 | return -1; | ||
636 | } | ||
637 | |||
638 | static irqreturn_t w90p910_tx_interrupt(int irq, void *dev_id) | ||
639 | { | ||
640 | struct w90p910_ether *ether; | ||
641 | struct w90p910_txbd *txbd; | ||
642 | struct platform_device *pdev; | ||
643 | struct tran_pdesc *tran_pdesc; | ||
644 | struct net_device *dev; | ||
645 | unsigned int cur_entry, entry, status; | ||
646 | |||
647 | dev = (struct net_device *)dev_id; | ||
648 | ether = netdev_priv(dev); | ||
649 | pdev = ether->pdev; | ||
650 | |||
651 | spin_lock(ðer->lock); | ||
652 | |||
653 | w90p910_get_and_clear_int(dev, &status); | ||
654 | |||
655 | cur_entry = __raw_readl(ether->reg + REG_CTXDSA); | ||
656 | |||
657 | tran_pdesc = ether->tdesc_phys; | ||
658 | entry = (unsigned int)(&tran_pdesc->desclist[ether->finish_tx]); | ||
659 | |||
660 | while (entry != cur_entry) { | ||
661 | txbd = ðer->tdesc->desclist[ether->finish_tx]; | ||
662 | |||
663 | ether->finish_tx = (ether->finish_tx + 1) % TX_DESC_SIZE; | ||
664 | |||
665 | if (txbd->sl & TXDS_TXCP) { | ||
666 | ether->stats.tx_packets++; | ||
667 | ether->stats.tx_bytes += txbd->sl & 0xFFFF; | ||
668 | } else { | ||
669 | ether->stats.tx_errors++; | ||
670 | } | ||
671 | |||
672 | txbd->sl = 0x0; | ||
673 | txbd->mode = 0x0; | ||
674 | |||
675 | if (netif_queue_stopped(dev)) | ||
676 | netif_wake_queue(dev); | ||
677 | |||
678 | entry = (unsigned int)(&tran_pdesc->desclist[ether->finish_tx]); | ||
679 | } | ||
680 | |||
681 | if (status & MISTA_EXDEF) { | ||
682 | dev_err(&pdev->dev, "emc defer exceed interrupt\n"); | ||
683 | } else if (status & MISTA_TXBERR) { | ||
684 | dev_err(&pdev->dev, "emc bus error interrupt\n"); | ||
685 | w90p910_reset_mac(dev); | ||
686 | } else if (status & MISTA_TDU) { | ||
687 | if (netif_queue_stopped(dev)) | ||
688 | netif_wake_queue(dev); | ||
689 | } | ||
690 | |||
691 | spin_unlock(ðer->lock); | ||
692 | |||
693 | return IRQ_HANDLED; | ||
694 | } | ||
695 | |||
696 | static void netdev_rx(struct net_device *dev) | ||
697 | { | ||
698 | struct w90p910_ether *ether; | ||
699 | struct w90p910_rxbd *rxbd; | ||
700 | struct platform_device *pdev; | ||
701 | struct recv_pdesc *rdesc_phys; | ||
702 | struct sk_buff *skb; | ||
703 | unsigned char *data; | ||
704 | unsigned int length, status, val, entry; | ||
705 | |||
706 | ether = netdev_priv(dev); | ||
707 | pdev = ether->pdev; | ||
708 | rdesc_phys = ether->rdesc_phys; | ||
709 | |||
710 | rxbd = ðer->rdesc->desclist[ether->cur_rx]; | ||
711 | |||
712 | do { | ||
713 | val = __raw_readl(ether->reg + REG_CRXDSA); | ||
714 | entry = (unsigned int)&rdesc_phys->desclist[ether->cur_rx]; | ||
715 | |||
716 | if (val == entry) | ||
717 | break; | ||
718 | |||
719 | status = rxbd->sl; | ||
720 | length = status & 0xFFFF; | ||
721 | |||
722 | if (status & RXDS_RXGD) { | ||
723 | data = ether->rdesc->recv_buf[ether->cur_rx]; | ||
724 | skb = dev_alloc_skb(length+2); | ||
725 | if (!skb) { | ||
726 | dev_err(&pdev->dev, "get skb buffer error\n"); | ||
727 | ether->stats.rx_dropped++; | ||
728 | return; | ||
729 | } | ||
730 | |||
731 | skb->dev = dev; | ||
732 | skb_reserve(skb, 2); | ||
733 | skb_put(skb, length); | ||
734 | skb_copy_to_linear_data(skb, data, length); | ||
735 | skb->protocol = eth_type_trans(skb, dev); | ||
736 | ether->stats.rx_packets++; | ||
737 | ether->stats.rx_bytes += length; | ||
738 | netif_rx(skb); | ||
739 | } else { | ||
740 | ether->stats.rx_errors++; | ||
741 | |||
742 | if (status & RXDS_RP) { | ||
743 | dev_err(&pdev->dev, "rx runt err\n"); | ||
744 | ether->stats.rx_length_errors++; | ||
745 | } else if (status & RXDS_CRCE) { | ||
746 | dev_err(&pdev->dev, "rx crc err\n"); | ||
747 | ether->stats.rx_crc_errors++; | ||
748 | } | ||
749 | |||
750 | if (status & RXDS_ALIE) { | ||
751 | dev_err(&pdev->dev, "rx aligment err\n"); | ||
752 | ether->stats.rx_frame_errors++; | ||
753 | } else if (status & RXDS_PTLE) { | ||
754 | dev_err(&pdev->dev, "rx longer err\n"); | ||
755 | ether->stats.rx_over_errors++; | ||
756 | } | ||
757 | } | ||
758 | |||
759 | rxbd->sl = RX_OWEN_DMA; | ||
760 | rxbd->reserved = 0x0; | ||
761 | ether->cur_rx = (ether->cur_rx+1) % RX_DESC_SIZE; | ||
762 | rxbd = ðer->rdesc->desclist[ether->cur_rx]; | ||
763 | |||
764 | dev->last_rx = jiffies; | ||
765 | } while (1); | ||
766 | } | ||
767 | |||
768 | static irqreturn_t w90p910_rx_interrupt(int irq, void *dev_id) | ||
769 | { | ||
770 | struct net_device *dev; | ||
771 | struct w90p910_ether *ether; | ||
772 | struct platform_device *pdev; | ||
773 | unsigned int status; | ||
774 | |||
775 | dev = (struct net_device *)dev_id; | ||
776 | ether = netdev_priv(dev); | ||
777 | pdev = ether->pdev; | ||
778 | |||
779 | spin_lock(ðer->lock); | ||
780 | |||
781 | w90p910_get_and_clear_int(dev, &status); | ||
782 | |||
783 | if (status & MISTA_RDU) { | ||
784 | netdev_rx(dev); | ||
785 | |||
786 | w90p910_trigger_rx(dev); | ||
787 | |||
788 | spin_unlock(ðer->lock); | ||
789 | return IRQ_HANDLED; | ||
790 | } else if (status & MISTA_RXBERR) { | ||
791 | dev_err(&pdev->dev, "emc rx bus error\n"); | ||
792 | w90p910_reset_mac(dev); | ||
793 | } | ||
794 | |||
795 | netdev_rx(dev); | ||
796 | spin_unlock(ðer->lock); | ||
797 | return IRQ_HANDLED; | ||
798 | } | ||
799 | |||
800 | static int w90p910_ether_open(struct net_device *dev) | ||
801 | { | ||
802 | struct w90p910_ether *ether; | ||
803 | struct platform_device *pdev; | ||
804 | |||
805 | ether = netdev_priv(dev); | ||
806 | pdev = ether->pdev; | ||
807 | |||
808 | w90p910_reset_mac(dev); | ||
809 | w90p910_set_fifo_threshold(dev); | ||
810 | w90p910_set_curdest(dev); | ||
811 | w90p910_enable_cam(dev); | ||
812 | w90p910_enable_cam_command(dev); | ||
813 | w90p910_enable_mac_interrupt(dev); | ||
814 | w90p910_set_global_maccmd(dev); | ||
815 | w90p910_enable_rx(dev, 1); | ||
816 | |||
817 | ether->rx_packets = 0x0; | ||
818 | ether->rx_bytes = 0x0; | ||
819 | |||
820 | if (request_irq(ether->txirq, w90p910_tx_interrupt, | ||
821 | 0x0, pdev->name, dev)) { | ||
822 | dev_err(&pdev->dev, "register irq tx failed\n"); | ||
823 | return -EAGAIN; | ||
824 | } | ||
825 | |||
826 | if (request_irq(ether->rxirq, w90p910_rx_interrupt, | ||
827 | 0x0, pdev->name, dev)) { | ||
828 | dev_err(&pdev->dev, "register irq rx failed\n"); | ||
829 | return -EAGAIN; | ||
830 | } | ||
831 | |||
832 | mod_timer(ðer->check_timer, jiffies + msecs_to_jiffies(1000)); | ||
833 | netif_start_queue(dev); | ||
834 | w90p910_trigger_rx(dev); | ||
835 | |||
836 | dev_info(&pdev->dev, "%s is OPENED\n", dev->name); | ||
837 | |||
838 | return 0; | ||
839 | } | ||
840 | |||
841 | static void w90p910_ether_set_multicast_list(struct net_device *dev) | ||
842 | { | ||
843 | struct w90p910_ether *ether; | ||
844 | unsigned int rx_mode; | ||
845 | |||
846 | ether = netdev_priv(dev); | ||
847 | |||
848 | if (dev->flags & IFF_PROMISC) | ||
849 | rx_mode = CAMCMR_AUP | CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; | ||
850 | else if ((dev->flags & IFF_ALLMULTI) || dev->mc_list) | ||
851 | rx_mode = CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; | ||
852 | else | ||
853 | rx_mode = CAMCMR_ECMP | CAMCMR_ABP; | ||
854 | __raw_writel(rx_mode, ether->reg + REG_CAMCMR); | ||
855 | } | ||
856 | |||
857 | static int w90p910_ether_ioctl(struct net_device *dev, | ||
858 | struct ifreq *ifr, int cmd) | ||
859 | { | ||
860 | struct w90p910_ether *ether = netdev_priv(dev); | ||
861 | struct mii_ioctl_data *data = if_mii(ifr); | ||
862 | |||
863 | return generic_mii_ioctl(ðer->mii, data, cmd, NULL); | ||
864 | } | ||
865 | |||
866 | static void w90p910_get_drvinfo(struct net_device *dev, | ||
867 | struct ethtool_drvinfo *info) | ||
868 | { | ||
869 | strcpy(info->driver, DRV_MODULE_NAME); | ||
870 | strcpy(info->version, DRV_MODULE_VERSION); | ||
871 | } | ||
872 | |||
873 | static int w90p910_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
874 | { | ||
875 | struct w90p910_ether *ether = netdev_priv(dev); | ||
876 | return mii_ethtool_gset(ðer->mii, cmd); | ||
877 | } | ||
878 | |||
879 | static int w90p910_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
880 | { | ||
881 | struct w90p910_ether *ether = netdev_priv(dev); | ||
882 | return mii_ethtool_sset(ðer->mii, cmd); | ||
883 | } | ||
884 | |||
885 | static int w90p910_nway_reset(struct net_device *dev) | ||
886 | { | ||
887 | struct w90p910_ether *ether = netdev_priv(dev); | ||
888 | return mii_nway_restart(ðer->mii); | ||
889 | } | ||
890 | |||
891 | static u32 w90p910_get_link(struct net_device *dev) | ||
892 | { | ||
893 | struct w90p910_ether *ether = netdev_priv(dev); | ||
894 | return mii_link_ok(ðer->mii); | ||
895 | } | ||
896 | |||
897 | static const struct ethtool_ops w90p910_ether_ethtool_ops = { | ||
898 | .get_settings = w90p910_get_settings, | ||
899 | .set_settings = w90p910_set_settings, | ||
900 | .get_drvinfo = w90p910_get_drvinfo, | ||
901 | .nway_reset = w90p910_nway_reset, | ||
902 | .get_link = w90p910_get_link, | ||
903 | }; | ||
904 | |||
905 | static const struct net_device_ops w90p910_ether_netdev_ops = { | ||
906 | .ndo_open = w90p910_ether_open, | ||
907 | .ndo_stop = w90p910_ether_close, | ||
908 | .ndo_start_xmit = w90p910_ether_start_xmit, | ||
909 | .ndo_get_stats = w90p910_ether_stats, | ||
910 | .ndo_set_multicast_list = w90p910_ether_set_multicast_list, | ||
911 | .ndo_set_mac_address = set_mac_address, | ||
912 | .ndo_do_ioctl = w90p910_ether_ioctl, | ||
913 | .ndo_validate_addr = eth_validate_addr, | ||
914 | .ndo_change_mtu = eth_change_mtu, | ||
915 | }; | ||
916 | |||
917 | static void __init get_mac_address(struct net_device *dev) | ||
918 | { | ||
919 | struct w90p910_ether *ether = netdev_priv(dev); | ||
920 | struct platform_device *pdev; | ||
921 | char addr[6]; | ||
922 | |||
923 | pdev = ether->pdev; | ||
924 | |||
925 | addr[0] = 0x00; | ||
926 | addr[1] = 0x02; | ||
927 | addr[2] = 0xac; | ||
928 | addr[3] = 0x55; | ||
929 | addr[4] = 0x88; | ||
930 | addr[5] = 0xa8; | ||
931 | |||
932 | if (is_valid_ether_addr(addr)) | ||
933 | memcpy(dev->dev_addr, &addr, 0x06); | ||
934 | else | ||
935 | dev_err(&pdev->dev, "invalid mac address\n"); | ||
936 | } | ||
937 | |||
938 | static int w90p910_ether_setup(struct net_device *dev) | ||
939 | { | ||
940 | struct w90p910_ether *ether = netdev_priv(dev); | ||
941 | |||
942 | ether_setup(dev); | ||
943 | dev->netdev_ops = &w90p910_ether_netdev_ops; | ||
944 | dev->ethtool_ops = &w90p910_ether_ethtool_ops; | ||
945 | |||
946 | dev->tx_queue_len = 16; | ||
947 | dev->dma = 0x0; | ||
948 | dev->watchdog_timeo = TX_TIMEOUT; | ||
949 | |||
950 | get_mac_address(dev); | ||
951 | |||
952 | spin_lock_init(ðer->lock); | ||
953 | |||
954 | ether->cur_tx = 0x0; | ||
955 | ether->cur_rx = 0x0; | ||
956 | ether->finish_tx = 0x0; | ||
957 | ether->linkflag = 0x0; | ||
958 | ether->mii.phy_id = 0x01; | ||
959 | ether->mii.phy_id_mask = 0x1f; | ||
960 | ether->mii.reg_num_mask = 0x1f; | ||
961 | ether->mii.dev = dev; | ||
962 | ether->mii.mdio_read = w90p910_mdio_read; | ||
963 | ether->mii.mdio_write = w90p910_mdio_write; | ||
964 | |||
965 | setup_timer(ðer->check_timer, w90p910_check_link, | ||
966 | (unsigned long)dev); | ||
967 | |||
968 | return 0; | ||
969 | } | ||
970 | |||
971 | static int __devinit w90p910_ether_probe(struct platform_device *pdev) | ||
972 | { | ||
973 | struct w90p910_ether *ether; | ||
974 | struct net_device *dev; | ||
975 | struct resource *res; | ||
976 | int error; | ||
977 | |||
978 | dev = alloc_etherdev(sizeof(struct w90p910_ether)); | ||
979 | if (!dev) | ||
980 | return -ENOMEM; | ||
981 | |||
982 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
983 | if (res == NULL) { | ||
984 | dev_err(&pdev->dev, "failed to get I/O memory\n"); | ||
985 | error = -ENXIO; | ||
986 | goto failed_free; | ||
987 | } | ||
988 | |||
989 | res = request_mem_region(res->start, resource_size(res), pdev->name); | ||
990 | if (res == NULL) { | ||
991 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | ||
992 | error = -EBUSY; | ||
993 | goto failed_free; | ||
994 | } | ||
995 | |||
996 | ether = netdev_priv(dev); | ||
997 | |||
998 | ether->reg = ioremap(res->start, resource_size(res)); | ||
999 | if (ether->reg == NULL) { | ||
1000 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | ||
1001 | error = -ENXIO; | ||
1002 | goto failed_free_mem; | ||
1003 | } | ||
1004 | |||
1005 | ether->txirq = platform_get_irq(pdev, 0); | ||
1006 | if (ether->txirq < 0) { | ||
1007 | dev_err(&pdev->dev, "failed to get ether tx irq\n"); | ||
1008 | error = -ENXIO; | ||
1009 | goto failed_free_io; | ||
1010 | } | ||
1011 | |||
1012 | ether->rxirq = platform_get_irq(pdev, 1); | ||
1013 | if (ether->rxirq < 0) { | ||
1014 | dev_err(&pdev->dev, "failed to get ether rx irq\n"); | ||
1015 | error = -ENXIO; | ||
1016 | goto failed_free_txirq; | ||
1017 | } | ||
1018 | |||
1019 | platform_set_drvdata(pdev, dev); | ||
1020 | |||
1021 | ether->clk = clk_get(&pdev->dev, NULL); | ||
1022 | if (IS_ERR(ether->clk)) { | ||
1023 | dev_err(&pdev->dev, "failed to get ether clock\n"); | ||
1024 | error = PTR_ERR(ether->clk); | ||
1025 | goto failed_free_rxirq; | ||
1026 | } | ||
1027 | |||
1028 | ether->rmiiclk = clk_get(&pdev->dev, "RMII"); | ||
1029 | if (IS_ERR(ether->rmiiclk)) { | ||
1030 | dev_err(&pdev->dev, "failed to get ether clock\n"); | ||
1031 | error = PTR_ERR(ether->rmiiclk); | ||
1032 | goto failed_put_clk; | ||
1033 | } | ||
1034 | |||
1035 | ether->pdev = pdev; | ||
1036 | |||
1037 | w90p910_ether_setup(dev); | ||
1038 | |||
1039 | error = register_netdev(dev); | ||
1040 | if (error != 0) { | ||
1041 | dev_err(&pdev->dev, "Regiter EMC w90p910 FAILED\n"); | ||
1042 | error = -ENODEV; | ||
1043 | goto failed_put_rmiiclk; | ||
1044 | } | ||
1045 | |||
1046 | return 0; | ||
1047 | failed_put_rmiiclk: | ||
1048 | clk_put(ether->rmiiclk); | ||
1049 | failed_put_clk: | ||
1050 | clk_put(ether->clk); | ||
1051 | failed_free_rxirq: | ||
1052 | free_irq(ether->rxirq, pdev); | ||
1053 | platform_set_drvdata(pdev, NULL); | ||
1054 | failed_free_txirq: | ||
1055 | free_irq(ether->txirq, pdev); | ||
1056 | failed_free_io: | ||
1057 | iounmap(ether->reg); | ||
1058 | failed_free_mem: | ||
1059 | release_mem_region(res->start, resource_size(res)); | ||
1060 | failed_free: | ||
1061 | free_netdev(dev); | ||
1062 | return error; | ||
1063 | } | ||
1064 | |||
1065 | static int __devexit w90p910_ether_remove(struct platform_device *pdev) | ||
1066 | { | ||
1067 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1068 | struct w90p910_ether *ether = netdev_priv(dev); | ||
1069 | |||
1070 | unregister_netdev(dev); | ||
1071 | clk_put(ether->rmiiclk); | ||
1072 | clk_put(ether->clk); | ||
1073 | del_timer_sync(ðer->check_timer); | ||
1074 | platform_set_drvdata(pdev, NULL); | ||
1075 | free_netdev(dev); | ||
1076 | return 0; | ||
1077 | } | ||
1078 | |||
1079 | static struct platform_driver w90p910_ether_driver = { | ||
1080 | .probe = w90p910_ether_probe, | ||
1081 | .remove = __devexit_p(w90p910_ether_remove), | ||
1082 | .driver = { | ||
1083 | .name = "w90p910-emc", | ||
1084 | .owner = THIS_MODULE, | ||
1085 | }, | ||
1086 | }; | ||
1087 | |||
1088 | static int __init w90p910_ether_init(void) | ||
1089 | { | ||
1090 | return platform_driver_register(&w90p910_ether_driver); | ||
1091 | } | ||
1092 | |||
1093 | static void __exit w90p910_ether_exit(void) | ||
1094 | { | ||
1095 | platform_driver_unregister(&w90p910_ether_driver); | ||
1096 | } | ||
1097 | |||
1098 | module_init(w90p910_ether_init); | ||
1099 | module_exit(w90p910_ether_exit); | ||
1100 | |||
1101 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); | ||
1102 | MODULE_DESCRIPTION("w90p910 MAC driver!"); | ||
1103 | MODULE_LICENSE("GPL"); | ||
1104 | MODULE_ALIAS("platform:w90p910-emc"); | ||
1105 | |||
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index 18b566ad4fd1..cf30e278f182 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c | |||
@@ -318,7 +318,7 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr) | |||
318 | pos3 = mca_read_stored_pos( slot, 3 ); | 318 | pos3 = mca_read_stored_pos( slot, 3 ); |
319 | pos4 = mca_read_stored_pos( slot, 4 ); | 319 | pos4 = mca_read_stored_pos( slot, 4 ); |
320 | 320 | ||
321 | for (l_i = 0; l_i < 0x09; l_i++) | 321 | for (l_i = 0; l_i < 8; l_i++) |
322 | if (( pos3 & 0x07) == at1700_ioaddr_pattern[l_i]) | 322 | if (( pos3 & 0x07) == at1700_ioaddr_pattern[l_i]) |
323 | break; | 323 | break; |
324 | ioaddr = at1700_mca_probe_list[l_i]; | 324 | ioaddr = at1700_mca_probe_list[l_i]; |
diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h index e1658ef3fcdf..2a1120ad2e74 100644 --- a/drivers/net/atl1c/atl1c.h +++ b/drivers/net/atl1c/atl1c.h | |||
@@ -188,14 +188,14 @@ struct atl1c_tpd_ext_desc { | |||
188 | #define RRS_HDS_TYPE_DATA 2 | 188 | #define RRS_HDS_TYPE_DATA 2 |
189 | 189 | ||
190 | #define RRS_IS_NO_HDS_TYPE(flag) \ | 190 | #define RRS_IS_NO_HDS_TYPE(flag) \ |
191 | (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == 0) | 191 | ((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == 0) |
192 | 192 | ||
193 | #define RRS_IS_HDS_HEAD(flag) \ | 193 | #define RRS_IS_HDS_HEAD(flag) \ |
194 | (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \ | 194 | ((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == \ |
195 | RRS_HDS_TYPE_HEAD) | 195 | RRS_HDS_TYPE_HEAD) |
196 | 196 | ||
197 | #define RRS_IS_HDS_DATA(flag) \ | 197 | #define RRS_IS_HDS_DATA(flag) \ |
198 | (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \ | 198 | ((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == \ |
199 | RRS_HDS_TYPE_DATA) | 199 | RRS_HDS_TYPE_DATA) |
200 | 200 | ||
201 | /* rrs word 3 bit 0:31 */ | 201 | /* rrs word 3 bit 0:31 */ |
@@ -245,7 +245,7 @@ struct atl1c_tpd_ext_desc { | |||
245 | #define RRS_PACKET_TYPE_802_3 1 | 245 | #define RRS_PACKET_TYPE_802_3 1 |
246 | #define RRS_PACKET_TYPE_ETH 0 | 246 | #define RRS_PACKET_TYPE_ETH 0 |
247 | #define RRS_PACKET_IS_ETH(word) \ | 247 | #define RRS_PACKET_IS_ETH(word) \ |
248 | (((word) >> RRS_PACKET_TYPE_SHIFT) & RRS_PACKET_TYPE_MASK == \ | 248 | ((((word) >> RRS_PACKET_TYPE_SHIFT) & RRS_PACKET_TYPE_MASK) == \ |
249 | RRS_PACKET_TYPE_ETH) | 249 | RRS_PACKET_TYPE_ETH) |
250 | #define RRS_RXD_IS_VALID(word) \ | 250 | #define RRS_RXD_IS_VALID(word) \ |
251 | ((((word) >> RRS_RXD_UPDATED_SHIFT) & RRS_RXD_UPDATED_MASK) == 1) | 251 | ((((word) >> RRS_RXD_UPDATED_SHIFT) & RRS_RXD_UPDATED_MASK) == 1) |
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c index cd547a205fb9..a383122679de 100644 --- a/drivers/net/atl1c/atl1c_main.c +++ b/drivers/net/atl1c/atl1c_main.c | |||
@@ -1689,7 +1689,7 @@ static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que, | |||
1689 | if (likely(RRS_RXD_IS_VALID(rrs->word3))) { | 1689 | if (likely(RRS_RXD_IS_VALID(rrs->word3))) { |
1690 | rfd_num = (rrs->word0 >> RRS_RX_RFD_CNT_SHIFT) & | 1690 | rfd_num = (rrs->word0 >> RRS_RX_RFD_CNT_SHIFT) & |
1691 | RRS_RX_RFD_CNT_MASK; | 1691 | RRS_RX_RFD_CNT_MASK; |
1692 | if (unlikely(rfd_num) != 1) | 1692 | if (unlikely(rfd_num != 1)) |
1693 | /* TODO support mul rfd*/ | 1693 | /* TODO support mul rfd*/ |
1694 | if (netif_msg_rx_err(adapter)) | 1694 | if (netif_msg_rx_err(adapter)) |
1695 | dev_warn(&pdev->dev, | 1695 | dev_warn(&pdev->dev, |
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c index c734b1983ec1..204db961029e 100644 --- a/drivers/net/atlx/atl2.c +++ b/drivers/net/atlx/atl2.c | |||
@@ -2071,7 +2071,7 @@ static int atl2_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
2071 | if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE)) | 2071 | if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE)) |
2072 | return -EOPNOTSUPP; | 2072 | return -EOPNOTSUPP; |
2073 | 2073 | ||
2074 | if (wol->wolopts & (WAKE_MCAST|WAKE_BCAST|WAKE_MCAST)) | 2074 | if (wol->wolopts & (WAKE_UCAST | WAKE_BCAST | WAKE_MCAST)) |
2075 | return -EOPNOTSUPP; | 2075 | return -EOPNOTSUPP; |
2076 | 2076 | ||
2077 | /* these settings will always override what we currently have */ | 2077 | /* these settings will always override what we currently have */ |
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h index b02e805c1db3..29c33c709c6d 100644 --- a/drivers/net/benet/be_hw.h +++ b/drivers/net/benet/be_hw.h | |||
@@ -55,6 +55,10 @@ | |||
55 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_MASK 0x7 /* bits 26 - 28 */ | 55 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_MASK 0x7 /* bits 26 - 28 */ |
56 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT 26 | 56 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT 26 |
57 | 57 | ||
58 | /********* ISR0 Register offset **********/ | ||
59 | #define CEV_ISR0_OFFSET 0xC18 | ||
60 | #define CEV_ISR_SIZE 4 | ||
61 | |||
58 | /********* Event Q door bell *************/ | 62 | /********* Event Q door bell *************/ |
59 | #define DB_EQ_OFFSET DB_CQ_OFFSET | 63 | #define DB_EQ_OFFSET DB_CQ_OFFSET |
60 | #define DB_EQ_RING_ID_MASK 0x1FF /* bits 0 - 8 */ | 64 | #define DB_EQ_RING_ID_MASK 0x1FF /* bits 0 - 8 */ |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 308eb09ca56b..dea3155688bb 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -667,7 +667,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter, | |||
667 | struct be_queue_info *rxq = &adapter->rx_obj.q; | 667 | struct be_queue_info *rxq = &adapter->rx_obj.q; |
668 | struct be_rx_page_info *page_info; | 668 | struct be_rx_page_info *page_info; |
669 | u16 rxq_idx, i, num_rcvd, j; | 669 | u16 rxq_idx, i, num_rcvd, j; |
670 | u32 pktsize, hdr_len, curr_frag_len; | 670 | u32 pktsize, hdr_len, curr_frag_len, size; |
671 | u8 *start; | 671 | u8 *start; |
672 | 672 | ||
673 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); | 673 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); |
@@ -708,12 +708,13 @@ static void skb_fill_rx_data(struct be_adapter *adapter, | |||
708 | } | 708 | } |
709 | 709 | ||
710 | /* More frags present for this completion */ | 710 | /* More frags present for this completion */ |
711 | pktsize -= curr_frag_len; /* account for above copied frag */ | 711 | size = pktsize; |
712 | for (i = 1, j = 0; i < num_rcvd; i++) { | 712 | for (i = 1, j = 0; i < num_rcvd; i++) { |
713 | size -= curr_frag_len; | ||
713 | index_inc(&rxq_idx, rxq->len); | 714 | index_inc(&rxq_idx, rxq->len); |
714 | page_info = get_rx_page_info(adapter, rxq_idx); | 715 | page_info = get_rx_page_info(adapter, rxq_idx); |
715 | 716 | ||
716 | curr_frag_len = min(pktsize, rx_frag_size); | 717 | curr_frag_len = min(size, rx_frag_size); |
717 | 718 | ||
718 | /* Coalesce all frags from the same physical page in one slot */ | 719 | /* Coalesce all frags from the same physical page in one slot */ |
719 | if (page_info->page_offset == 0) { | 720 | if (page_info->page_offset == 0) { |
@@ -731,7 +732,6 @@ static void skb_fill_rx_data(struct be_adapter *adapter, | |||
731 | skb_shinfo(skb)->frags[j].size += curr_frag_len; | 732 | skb_shinfo(skb)->frags[j].size += curr_frag_len; |
732 | skb->len += curr_frag_len; | 733 | skb->len += curr_frag_len; |
733 | skb->data_len += curr_frag_len; | 734 | skb->data_len += curr_frag_len; |
734 | pktsize -= curr_frag_len; | ||
735 | 735 | ||
736 | memset(page_info, 0, sizeof(*page_info)); | 736 | memset(page_info, 0, sizeof(*page_info)); |
737 | } | 737 | } |
@@ -1274,15 +1274,17 @@ static irqreturn_t be_intx(int irq, void *dev) | |||
1274 | { | 1274 | { |
1275 | struct be_adapter *adapter = dev; | 1275 | struct be_adapter *adapter = dev; |
1276 | struct be_ctrl_info *ctrl = &adapter->ctrl; | 1276 | struct be_ctrl_info *ctrl = &adapter->ctrl; |
1277 | int rx, tx; | 1277 | int isr; |
1278 | 1278 | ||
1279 | tx = event_handle(ctrl, &adapter->tx_eq); | 1279 | isr = ioread32(ctrl->csr + CEV_ISR0_OFFSET + |
1280 | rx = event_handle(ctrl, &adapter->rx_eq); | 1280 | ctrl->pci_func * CEV_ISR_SIZE); |
1281 | if (!isr) | ||
1282 | return IRQ_NONE; | ||
1281 | 1283 | ||
1282 | if (rx || tx) | 1284 | event_handle(ctrl, &adapter->tx_eq); |
1283 | return IRQ_HANDLED; | 1285 | event_handle(ctrl, &adapter->rx_eq); |
1284 | else | 1286 | |
1285 | return IRQ_NONE; | 1287 | return IRQ_HANDLED; |
1286 | } | 1288 | } |
1287 | 1289 | ||
1288 | static irqreturn_t be_msix_rx(int irq, void *dev) | 1290 | static irqreturn_t be_msix_rx(int irq, void *dev) |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 9578a3dfac01..206144f2470f 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -428,10 +428,11 @@ bmac_init_phy(struct net_device *dev) | |||
428 | printk(KERN_DEBUG "phy registers:"); | 428 | printk(KERN_DEBUG "phy registers:"); |
429 | for (addr = 0; addr < 32; ++addr) { | 429 | for (addr = 0; addr < 32; ++addr) { |
430 | if ((addr & 7) == 0) | 430 | if ((addr & 7) == 0) |
431 | printk("\n" KERN_DEBUG); | 431 | printk(KERN_DEBUG); |
432 | printk(" %.4x", bmac_mif_read(dev, addr)); | 432 | printk(KERN_CONT " %.4x", bmac_mif_read(dev, addr)); |
433 | } | 433 | } |
434 | printk("\n"); | 434 | printk(KERN_CONT "\n"); |
435 | |||
435 | if (bp->is_bmac_plus) { | 436 | if (bp->is_bmac_plus) { |
436 | unsigned int capable, ctrl; | 437 | unsigned int capable, ctrl; |
437 | 438 | ||
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h index 8678457849f9..85a737c5c23f 100644 --- a/drivers/net/bnx2x.h +++ b/drivers/net/bnx2x.h | |||
@@ -902,6 +902,8 @@ struct bnx2x { | |||
902 | u16 rx_quick_cons_trip; | 902 | u16 rx_quick_cons_trip; |
903 | u16 rx_ticks_int; | 903 | u16 rx_ticks_int; |
904 | u16 rx_ticks; | 904 | u16 rx_ticks; |
905 | /* Maximal coalescing timeout in us */ | ||
906 | #define BNX2X_MAX_COALESCE_TOUT (0xf0*12) | ||
905 | 907 | ||
906 | u32 lin_cnt; | 908 | u32 lin_cnt; |
907 | 909 | ||
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c index ed648acef7cf..2ee581a2cdec 100644 --- a/drivers/net/bnx2x_link.c +++ b/drivers/net/bnx2x_link.c | |||
@@ -4212,13 +4212,14 @@ static void bnx2x_turn_off_sf(struct bnx2x *bp, u8 port) | |||
4212 | u8 bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 driver_loaded, | 4212 | u8 bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 driver_loaded, |
4213 | u8 *version, u16 len) | 4213 | u8 *version, u16 len) |
4214 | { | 4214 | { |
4215 | struct bnx2x *bp = params->bp; | 4215 | struct bnx2x *bp; |
4216 | u32 ext_phy_type = 0; | 4216 | u32 ext_phy_type = 0; |
4217 | u32 spirom_ver = 0; | 4217 | u32 spirom_ver = 0; |
4218 | u8 status = 0 ; | 4218 | u8 status = 0 ; |
4219 | 4219 | ||
4220 | if (version == NULL || params == NULL) | 4220 | if (version == NULL || params == NULL) |
4221 | return -EINVAL; | 4221 | return -EINVAL; |
4222 | bp = params->bp; | ||
4222 | 4223 | ||
4223 | spirom_ver = REG_RD(bp, params->shmem_base + | 4224 | spirom_ver = REG_RD(bp, params->shmem_base + |
4224 | offsetof(struct shmem_region, | 4225 | offsetof(struct shmem_region, |
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 951714a7f90a..c36a5f33739f 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -484,8 +484,9 @@ static void bnx2x_fw_dump(struct bnx2x *bp) | |||
484 | 484 | ||
485 | mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104); | 485 | mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104); |
486 | mark = ((mark + 0x3) & ~0x3); | 486 | mark = ((mark + 0x3) & ~0x3); |
487 | printk(KERN_ERR PFX "begin fw dump (mark 0x%x)\n" KERN_ERR, mark); | 487 | printk(KERN_ERR PFX "begin fw dump (mark 0x%x)\n", mark); |
488 | 488 | ||
489 | printk(KERN_ERR PFX); | ||
489 | for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) { | 490 | for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) { |
490 | for (word = 0; word < 8; word++) | 491 | for (word = 0; word < 8; word++) |
491 | data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + | 492 | data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + |
@@ -500,7 +501,7 @@ static void bnx2x_fw_dump(struct bnx2x *bp) | |||
500 | data[8] = 0x0; | 501 | data[8] = 0x0; |
501 | printk(KERN_CONT "%s", (char *)data); | 502 | printk(KERN_CONT "%s", (char *)data); |
502 | } | 503 | } |
503 | printk("\n" KERN_ERR PFX "end of fw dump\n"); | 504 | printk(KERN_ERR PFX "end of fw dump\n"); |
504 | } | 505 | } |
505 | 506 | ||
506 | static void bnx2x_panic_dump(struct bnx2x *bp) | 507 | static void bnx2x_panic_dump(struct bnx2x *bp) |
@@ -4434,7 +4435,7 @@ static void bnx2x_update_coalesce(struct bnx2x *bp) | |||
4434 | REG_WR16(bp, BAR_USTRORM_INTMEM + | 4435 | REG_WR16(bp, BAR_USTRORM_INTMEM + |
4435 | USTORM_SB_HC_DISABLE_OFFSET(port, sb_id, | 4436 | USTORM_SB_HC_DISABLE_OFFSET(port, sb_id, |
4436 | U_SB_ETH_RX_CQ_INDEX), | 4437 | U_SB_ETH_RX_CQ_INDEX), |
4437 | bp->rx_ticks ? 0 : 1); | 4438 | (bp->rx_ticks/12) ? 0 : 1); |
4438 | 4439 | ||
4439 | /* HC_INDEX_C_ETH_TX_CQ_CONS */ | 4440 | /* HC_INDEX_C_ETH_TX_CQ_CONS */ |
4440 | REG_WR8(bp, BAR_CSTRORM_INTMEM + | 4441 | REG_WR8(bp, BAR_CSTRORM_INTMEM + |
@@ -4444,7 +4445,7 @@ static void bnx2x_update_coalesce(struct bnx2x *bp) | |||
4444 | REG_WR16(bp, BAR_CSTRORM_INTMEM + | 4445 | REG_WR16(bp, BAR_CSTRORM_INTMEM + |
4445 | CSTORM_SB_HC_DISABLE_OFFSET(port, sb_id, | 4446 | CSTORM_SB_HC_DISABLE_OFFSET(port, sb_id, |
4446 | C_SB_ETH_TX_CQ_INDEX), | 4447 | C_SB_ETH_TX_CQ_INDEX), |
4447 | bp->tx_ticks ? 0 : 1); | 4448 | (bp->tx_ticks/12) ? 0 : 1); |
4448 | } | 4449 | } |
4449 | } | 4450 | } |
4450 | 4451 | ||
@@ -7354,7 +7355,7 @@ static void bnx2x_reset_task(struct work_struct *work) | |||
7354 | #ifdef BNX2X_STOP_ON_ERROR | 7355 | #ifdef BNX2X_STOP_ON_ERROR |
7355 | BNX2X_ERR("reset task called but STOP_ON_ERROR defined" | 7356 | BNX2X_ERR("reset task called but STOP_ON_ERROR defined" |
7356 | " so reset not done to allow debug dump,\n" | 7357 | " so reset not done to allow debug dump,\n" |
7357 | KERN_ERR " you will need to reboot when done\n"); | 7358 | " you will need to reboot when done\n"); |
7358 | return; | 7359 | return; |
7359 | #endif | 7360 | #endif |
7360 | 7361 | ||
@@ -9069,12 +9070,12 @@ static int bnx2x_set_coalesce(struct net_device *dev, | |||
9069 | struct bnx2x *bp = netdev_priv(dev); | 9070 | struct bnx2x *bp = netdev_priv(dev); |
9070 | 9071 | ||
9071 | bp->rx_ticks = (u16) coal->rx_coalesce_usecs; | 9072 | bp->rx_ticks = (u16) coal->rx_coalesce_usecs; |
9072 | if (bp->rx_ticks > 3000) | 9073 | if (bp->rx_ticks > BNX2X_MAX_COALESCE_TOUT) |
9073 | bp->rx_ticks = 3000; | 9074 | bp->rx_ticks = BNX2X_MAX_COALESCE_TOUT; |
9074 | 9075 | ||
9075 | bp->tx_ticks = (u16) coal->tx_coalesce_usecs; | 9076 | bp->tx_ticks = (u16) coal->tx_coalesce_usecs; |
9076 | if (bp->tx_ticks > 0x3000) | 9077 | if (bp->tx_ticks > BNX2X_MAX_COALESCE_TOUT) |
9077 | bp->tx_ticks = 0x3000; | 9078 | bp->tx_ticks = BNX2X_MAX_COALESCE_TOUT; |
9078 | 9079 | ||
9079 | if (netif_running(dev)) | 9080 | if (netif_running(dev)) |
9080 | bnx2x_update_coalesce(bp); | 9081 | bnx2x_update_coalesce(bp); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index d927f71af8a3..aa1be1feceed 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1459,8 +1459,16 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1459 | * ether type (eg ARPHRD_ETHER and ARPHRD_INFINIBAND) share the same bond | 1459 | * ether type (eg ARPHRD_ETHER and ARPHRD_INFINIBAND) share the same bond |
1460 | */ | 1460 | */ |
1461 | if (bond->slave_cnt == 0) { | 1461 | if (bond->slave_cnt == 0) { |
1462 | if (slave_dev->type != ARPHRD_ETHER) | 1462 | if (bond_dev->type != slave_dev->type) { |
1463 | bond_setup_by_slave(bond_dev, slave_dev); | 1463 | dev_close(bond_dev); |
1464 | pr_debug("%s: change device type from %d to %d\n", | ||
1465 | bond_dev->name, bond_dev->type, slave_dev->type); | ||
1466 | if (slave_dev->type != ARPHRD_ETHER) | ||
1467 | bond_setup_by_slave(bond_dev, slave_dev); | ||
1468 | else | ||
1469 | ether_setup(bond_dev); | ||
1470 | dev_open(bond_dev); | ||
1471 | } | ||
1464 | } else if (bond_dev->type != slave_dev->type) { | 1472 | } else if (bond_dev->type != slave_dev->type) { |
1465 | pr_err(DRV_NAME ": %s ether type (%d) is different " | 1473 | pr_err(DRV_NAME ": %s ether type (%d) is different " |
1466 | "from other slaves (%d), can not enslave it.\n", | 1474 | "from other slaves (%d), can not enslave it.\n", |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 574daddc21bf..9e4283aff828 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -346,7 +346,7 @@ void can_restart(unsigned long data) | |||
346 | skb = dev_alloc_skb(sizeof(struct can_frame)); | 346 | skb = dev_alloc_skb(sizeof(struct can_frame)); |
347 | if (skb == NULL) { | 347 | if (skb == NULL) { |
348 | err = -ENOMEM; | 348 | err = -ENOMEM; |
349 | goto out; | 349 | goto restart; |
350 | } | 350 | } |
351 | skb->dev = dev; | 351 | skb->dev = dev; |
352 | skb->protocol = htons(ETH_P_CAN); | 352 | skb->protocol = htons(ETH_P_CAN); |
@@ -361,13 +361,13 @@ void can_restart(unsigned long data) | |||
361 | stats->rx_packets++; | 361 | stats->rx_packets++; |
362 | stats->rx_bytes += cf->can_dlc; | 362 | stats->rx_bytes += cf->can_dlc; |
363 | 363 | ||
364 | restart: | ||
364 | dev_dbg(dev->dev.parent, "restarted\n"); | 365 | dev_dbg(dev->dev.parent, "restarted\n"); |
365 | priv->can_stats.restarts++; | 366 | priv->can_stats.restarts++; |
366 | 367 | ||
367 | /* Now restart the device */ | 368 | /* Now restart the device */ |
368 | err = priv->do_set_mode(dev, CAN_MODE_START); | 369 | err = priv->do_set_mode(dev, CAN_MODE_START); |
369 | 370 | ||
370 | out: | ||
371 | netif_carrier_on(dev); | 371 | netif_carrier_on(dev); |
372 | if (err) | 372 | if (err) |
373 | dev_err(dev->dev.parent, "Error %d during restart", err); | 373 | dev_err(dev->dev.parent, "Error %d during restart", err); |
@@ -473,6 +473,10 @@ int open_candev(struct net_device *dev) | |||
473 | return -EINVAL; | 473 | return -EINVAL; |
474 | } | 474 | } |
475 | 475 | ||
476 | /* Switch carrier on if device was stopped while in bus-off state */ | ||
477 | if (!netif_carrier_ok(dev)) | ||
478 | netif_carrier_on(dev); | ||
479 | |||
476 | setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev); | 480 | setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev); |
477 | 481 | ||
478 | return 0; | 482 | return 0; |
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 571f133a8fec..08ebee79d8a6 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -63,7 +63,6 @@ | |||
63 | #include <linux/can.h> | 63 | #include <linux/can.h> |
64 | #include <linux/can/dev.h> | 64 | #include <linux/can/dev.h> |
65 | #include <linux/can/error.h> | 65 | #include <linux/can/error.h> |
66 | #include <linux/can/dev.h> | ||
67 | 66 | ||
68 | #include "sja1000.h" | 67 | #include "sja1000.h" |
69 | 68 | ||
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 4d1515f45ba2..4869d77cbe91 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -227,7 +227,7 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type, | |||
227 | } | 227 | } |
228 | 228 | ||
229 | rcu_read_lock(); | 229 | rcu_read_lock(); |
230 | ulp_ops = rcu_dereference(cp->ulp_ops[CNIC_ULP_ISCSI]); | 230 | ulp_ops = rcu_dereference(cnic_ulp_tbl[CNIC_ULP_ISCSI]); |
231 | if (ulp_ops) | 231 | if (ulp_ops) |
232 | ulp_ops->iscsi_nl_send_msg(cp->dev, msg_type, buf, len); | 232 | ulp_ops->iscsi_nl_send_msg(cp->dev, msg_type, buf, len); |
233 | rcu_read_unlock(); | 233 | rcu_read_unlock(); |
@@ -319,6 +319,20 @@ static int cnic_abort_prep(struct cnic_sock *csk) | |||
319 | return 0; | 319 | return 0; |
320 | } | 320 | } |
321 | 321 | ||
322 | static void cnic_uio_stop(void) | ||
323 | { | ||
324 | struct cnic_dev *dev; | ||
325 | |||
326 | read_lock(&cnic_dev_lock); | ||
327 | list_for_each_entry(dev, &cnic_dev_list, list) { | ||
328 | struct cnic_local *cp = dev->cnic_priv; | ||
329 | |||
330 | if (cp->cnic_uinfo) | ||
331 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); | ||
332 | } | ||
333 | read_unlock(&cnic_dev_lock); | ||
334 | } | ||
335 | |||
322 | int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops) | 336 | int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops) |
323 | { | 337 | { |
324 | struct cnic_dev *dev; | 338 | struct cnic_dev *dev; |
@@ -390,6 +404,9 @@ int cnic_unregister_driver(int ulp_type) | |||
390 | } | 404 | } |
391 | read_unlock(&cnic_dev_lock); | 405 | read_unlock(&cnic_dev_lock); |
392 | 406 | ||
407 | if (ulp_type == CNIC_ULP_ISCSI) | ||
408 | cnic_uio_stop(); | ||
409 | |||
393 | rcu_assign_pointer(cnic_ulp_tbl[ulp_type], NULL); | 410 | rcu_assign_pointer(cnic_ulp_tbl[ulp_type], NULL); |
394 | 411 | ||
395 | mutex_unlock(&cnic_lock); | 412 | mutex_unlock(&cnic_lock); |
@@ -632,7 +649,6 @@ static void cnic_free_resc(struct cnic_dev *dev) | |||
632 | int i = 0; | 649 | int i = 0; |
633 | 650 | ||
634 | if (cp->cnic_uinfo) { | 651 | if (cp->cnic_uinfo) { |
635 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); | ||
636 | while (cp->uio_dev != -1 && i < 15) { | 652 | while (cp->uio_dev != -1 && i < 15) { |
637 | msleep(100); | 653 | msleep(100); |
638 | i++; | 654 | i++; |
@@ -1057,6 +1073,9 @@ static void cnic_ulp_stop(struct cnic_dev *dev) | |||
1057 | struct cnic_local *cp = dev->cnic_priv; | 1073 | struct cnic_local *cp = dev->cnic_priv; |
1058 | int if_type; | 1074 | int if_type; |
1059 | 1075 | ||
1076 | if (cp->cnic_uinfo) | ||
1077 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); | ||
1078 | |||
1060 | rcu_read_lock(); | 1079 | rcu_read_lock(); |
1061 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { | 1080 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { |
1062 | struct cnic_ulp_ops *ulp_ops; | 1081 | struct cnic_ulp_ops *ulp_ops; |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 3eee666a9cd2..55445f980f9c 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -1524,6 +1524,7 @@ static void net_timeout(struct net_device *dev) | |||
1524 | static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | 1524 | static int net_send_packet(struct sk_buff *skb, struct net_device *dev) |
1525 | { | 1525 | { |
1526 | struct net_local *lp = netdev_priv(dev); | 1526 | struct net_local *lp = netdev_priv(dev); |
1527 | unsigned long flags; | ||
1527 | 1528 | ||
1528 | if (net_debug > 3) { | 1529 | if (net_debug > 3) { |
1529 | printk("%s: sent %d byte packet of type %x\n", | 1530 | printk("%s: sent %d byte packet of type %x\n", |
@@ -1535,7 +1536,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1535 | ask the chip to start transmitting before the | 1536 | ask the chip to start transmitting before the |
1536 | whole packet has been completely uploaded. */ | 1537 | whole packet has been completely uploaded. */ |
1537 | 1538 | ||
1538 | spin_lock_irq(&lp->lock); | 1539 | spin_lock_irqsave(&lp->lock, flags); |
1539 | netif_stop_queue(dev); | 1540 | netif_stop_queue(dev); |
1540 | 1541 | ||
1541 | /* initiate a transmit sequence */ | 1542 | /* initiate a transmit sequence */ |
@@ -1549,13 +1550,13 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1549 | * we're waiting for TxOk, so return 1 and requeue this packet. | 1550 | * we're waiting for TxOk, so return 1 and requeue this packet. |
1550 | */ | 1551 | */ |
1551 | 1552 | ||
1552 | spin_unlock_irq(&lp->lock); | 1553 | spin_unlock_irqrestore(&lp->lock, flags); |
1553 | if (net_debug) printk("cs89x0: Tx buffer not free!\n"); | 1554 | if (net_debug) printk("cs89x0: Tx buffer not free!\n"); |
1554 | return NETDEV_TX_BUSY; | 1555 | return NETDEV_TX_BUSY; |
1555 | } | 1556 | } |
1556 | /* Write the contents of the packet */ | 1557 | /* Write the contents of the packet */ |
1557 | writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1); | 1558 | writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1); |
1558 | spin_unlock_irq(&lp->lock); | 1559 | spin_unlock_irqrestore(&lp->lock, flags); |
1559 | lp->stats.tx_bytes += skb->len; | 1560 | lp->stats.tx_bytes += skb->len; |
1560 | dev->trans_start = jiffies; | 1561 | dev->trans_start = jiffies; |
1561 | dev_kfree_skb (skb); | 1562 | dev_kfree_skb (skb); |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 538dda4422dc..fb5df5c6203e 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -642,8 +642,7 @@ static int setup_sge_qsets(struct adapter *adap) | |||
642 | struct port_info *pi = netdev_priv(dev); | 642 | struct port_info *pi = netdev_priv(dev); |
643 | 643 | ||
644 | pi->qs = &adap->sge.qs[pi->first_qset]; | 644 | pi->qs = &adap->sge.qs[pi->first_qset]; |
645 | for (j = pi->first_qset; j < pi->first_qset + pi->nqsets; | 645 | for (j = 0; j < pi->nqsets; ++j, ++qset_idx) { |
646 | ++j, ++qset_idx) { | ||
647 | set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO); | 646 | set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO); |
648 | err = t3_sge_alloc_qset(adap, qset_idx, 1, | 647 | err = t3_sge_alloc_qset(adap, qset_idx, 1, |
649 | (adap->flags & USING_MSIX) ? qset_idx + 1 : | 648 | (adap->flags & USING_MSIX) ? qset_idx + 1 : |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 2df8fb0af701..12fd446f9895 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -1820,11 +1820,19 @@ static int emac_dev_setmac_addr(struct net_device *ndev, void *addr) | |||
1820 | struct device *emac_dev = &priv->ndev->dev; | 1820 | struct device *emac_dev = &priv->ndev->dev; |
1821 | struct sockaddr *sa = addr; | 1821 | struct sockaddr *sa = addr; |
1822 | 1822 | ||
1823 | if (!is_valid_ether_addr(sa->sa_data)) | ||
1824 | return -EINVAL; | ||
1825 | |||
1823 | /* Store mac addr in priv and rx channel and set it in EMAC hw */ | 1826 | /* Store mac addr in priv and rx channel and set it in EMAC hw */ |
1824 | memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len); | 1827 | memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len); |
1825 | memcpy(rxch->mac_addr, sa->sa_data, ndev->addr_len); | ||
1826 | memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len); | 1828 | memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len); |
1827 | emac_setmac(priv, EMAC_DEF_RX_CH, rxch->mac_addr); | 1829 | |
1830 | /* If the interface is down - rxch is NULL. */ | ||
1831 | /* MAC address is configured only after the interface is enabled. */ | ||
1832 | if (netif_running(ndev)) { | ||
1833 | memcpy(rxch->mac_addr, sa->sa_data, ndev->addr_len); | ||
1834 | emac_setmac(priv, EMAC_DEF_RX_CH, rxch->mac_addr); | ||
1835 | } | ||
1828 | 1836 | ||
1829 | if (netif_msg_drv(priv)) | 1837 | if (netif_msg_drv(priv)) |
1830 | dev_notice(emac_dev, "DaVinci EMAC: emac_dev_setmac_addr %pM\n", | 1838 | dev_notice(emac_dev, "DaVinci EMAC: emac_dev_setmac_addr %pM\n", |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 895d72143ee0..4b6a219fecea 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -268,8 +268,9 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
268 | printk(KERN_INFO "tx_coalesce:\t%d packets\n", | 268 | printk(KERN_INFO "tx_coalesce:\t%d packets\n", |
269 | tx_coalesce); | 269 | tx_coalesce); |
270 | if (np->coalesce) | 270 | if (np->coalesce) |
271 | printk(KERN_INFO "rx_coalesce:\t%d packets\n" | 271 | printk(KERN_INFO |
272 | KERN_INFO "rx_timeout: \t%d ns\n", | 272 | "rx_coalesce:\t%d packets\n" |
273 | "rx_timeout: \t%d ns\n", | ||
273 | np->rx_coalesce, np->rx_timeout*640); | 274 | np->rx_coalesce, np->rx_timeout*640); |
274 | if (np->vlan) | 275 | if (np->vlan) |
275 | printk(KERN_INFO "vlan(id):\t%d\n", np->vlan); | 276 | printk(KERN_INFO "vlan(id):\t%d\n", np->vlan); |
@@ -1522,9 +1523,9 @@ mii_get_media (struct net_device *dev) | |||
1522 | printk (KERN_INFO "Operating at 10 Mbps, "); | 1523 | printk (KERN_INFO "Operating at 10 Mbps, "); |
1523 | } | 1524 | } |
1524 | if (bmcr & MII_BMCR_DUPLEX_MODE) { | 1525 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1525 | printk ("Full duplex\n"); | 1526 | printk (KERN_CONT "Full duplex\n"); |
1526 | } else { | 1527 | } else { |
1527 | printk ("Half duplex\n"); | 1528 | printk (KERN_CONT "Half duplex\n"); |
1528 | } | 1529 | } |
1529 | } | 1530 | } |
1530 | if (np->tx_flow) | 1531 | if (np->tx_flow) |
@@ -1614,9 +1615,9 @@ mii_set_media (struct net_device *dev) | |||
1614 | } | 1615 | } |
1615 | if (np->full_duplex) { | 1616 | if (np->full_duplex) { |
1616 | bmcr |= MII_BMCR_DUPLEX_MODE; | 1617 | bmcr |= MII_BMCR_DUPLEX_MODE; |
1617 | printk ("Full duplex\n"); | 1618 | printk (KERN_CONT "Full duplex\n"); |
1618 | } else { | 1619 | } else { |
1619 | printk ("Half duplex\n"); | 1620 | printk (KERN_CONT "Half duplex\n"); |
1620 | } | 1621 | } |
1621 | #if 0 | 1622 | #if 0 |
1622 | /* Set 1000BaseT Master/Slave setting */ | 1623 | /* Set 1000BaseT Master/Slave setting */ |
@@ -1669,9 +1670,9 @@ mii_get_media_pcs (struct net_device *dev) | |||
1669 | __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR); | 1670 | __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR); |
1670 | printk (KERN_INFO "Operating at 1000 Mbps, "); | 1671 | printk (KERN_INFO "Operating at 1000 Mbps, "); |
1671 | if (bmcr & MII_BMCR_DUPLEX_MODE) { | 1672 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1672 | printk ("Full duplex\n"); | 1673 | printk (KERN_CONT "Full duplex\n"); |
1673 | } else { | 1674 | } else { |
1674 | printk ("Half duplex\n"); | 1675 | printk (KERN_CONT "Half duplex\n"); |
1675 | } | 1676 | } |
1676 | } | 1677 | } |
1677 | if (np->tx_flow) | 1678 | if (np->tx_flow) |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index efa680f4b8dd..41b648a67fec 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1897,6 +1897,9 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
1897 | 1897 | ||
1898 | if (ioread8(&nic->csr->scb.status) & rus_no_res) | 1898 | if (ioread8(&nic->csr->scb.status) & rus_no_res) |
1899 | nic->ru_running = RU_SUSPENDED; | 1899 | nic->ru_running = RU_SUSPENDED; |
1900 | pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr, | ||
1901 | sizeof(struct rfd), | ||
1902 | PCI_DMA_BIDIRECTIONAL); | ||
1900 | return -ENODATA; | 1903 | return -ENODATA; |
1901 | } | 1904 | } |
1902 | 1905 | ||
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index 8890c97e1120..c0f185beb8bc 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
@@ -238,6 +238,7 @@ | |||
238 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ | 238 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ |
239 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ | 239 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ |
240 | #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ | 240 | #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ |
241 | #define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */ | ||
241 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ | 242 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ |
242 | 243 | ||
243 | /* Constants used to interpret the masked PCI-X bus speed. */ | 244 | /* Constants used to interpret the masked PCI-X bus speed. */ |
@@ -575,6 +576,8 @@ | |||
575 | #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ | 576 | #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ |
576 | #define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ | 577 | #define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ |
577 | 578 | ||
579 | #define PHY_CONTROL_LB 0x4000 /* PHY Loopback bit */ | ||
580 | |||
578 | /* NVM Control */ | 581 | /* NVM Control */ |
579 | #define E1000_EECD_SK 0x00000001 /* NVM Clock */ | 582 | #define E1000_EECD_SK 0x00000001 /* NVM Clock */ |
580 | #define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ | 583 | #define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 163c1c0cfee7..fd44d9f90769 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -215,6 +215,7 @@ enum e1e_registers { | |||
215 | E1000_SWSM = 0x05B50, /* SW Semaphore */ | 215 | E1000_SWSM = 0x05B50, /* SW Semaphore */ |
216 | E1000_FWSM = 0x05B54, /* FW Semaphore */ | 216 | E1000_FWSM = 0x05B54, /* FW Semaphore */ |
217 | E1000_SWSM2 = 0x05B58, /* Driver-only SW semaphore */ | 217 | E1000_SWSM2 = 0x05B58, /* Driver-only SW semaphore */ |
218 | E1000_CRC_OFFSET = 0x05F50, /* CRC Offset register */ | ||
218 | E1000_HICR = 0x08F00, /* Host Interface Control */ | 219 | E1000_HICR = 0x08F00, /* Host Interface Control */ |
219 | }; | 220 | }; |
220 | 221 | ||
@@ -302,6 +303,9 @@ enum e1e_registers { | |||
302 | #define E1000_KMRNCTRLSTA_REN 0x00200000 | 303 | #define E1000_KMRNCTRLSTA_REN 0x00200000 |
303 | #define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ | 304 | #define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ |
304 | #define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ | 305 | #define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ |
306 | #define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 | ||
307 | #define E1000_KMRNCTRLSTA_K1_ENABLE 0x140E | ||
308 | #define E1000_KMRNCTRLSTA_K1_DISABLE 0x1400 | ||
305 | 309 | ||
306 | #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 | 310 | #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 |
307 | #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ | 311 | #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 9e23f50fb9cd..d56c7473144a 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -338,6 +338,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
338 | { | 338 | { |
339 | struct e1000_nvm_info *nvm = &hw->nvm; | 339 | struct e1000_nvm_info *nvm = &hw->nvm; |
340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
341 | union ich8_hws_flash_status hsfsts; | ||
341 | u32 gfpreg; | 342 | u32 gfpreg; |
342 | u32 sector_base_addr; | 343 | u32 sector_base_addr; |
343 | u32 sector_end_addr; | 344 | u32 sector_end_addr; |
@@ -374,6 +375,20 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
374 | /* Adjust to word count */ | 375 | /* Adjust to word count */ |
375 | nvm->flash_bank_size /= sizeof(u16); | 376 | nvm->flash_bank_size /= sizeof(u16); |
376 | 377 | ||
378 | /* | ||
379 | * Make sure the flash bank size does not overwrite the 4k | ||
380 | * sector ranges. We may have 64k allotted to us but we only care | ||
381 | * about the first 2 4k sectors. Therefore, if we have anything less | ||
382 | * than 64k set in the HSFSTS register, we will reduce the bank size | ||
383 | * down to 4k and let the rest remain unused. If berasesz == 3, then | ||
384 | * we are working in 64k mode. Otherwise we are not. | ||
385 | */ | ||
386 | if (nvm->flash_bank_size > E1000_ICH8_SHADOW_RAM_WORDS) { | ||
387 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); | ||
388 | if (hsfsts.hsf_status.berasesz != 3) | ||
389 | nvm->flash_bank_size = E1000_ICH8_SHADOW_RAM_WORDS; | ||
390 | } | ||
391 | |||
377 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; | 392 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; |
378 | 393 | ||
379 | /* Clear shadow ram */ | 394 | /* Clear shadow ram */ |
@@ -446,6 +461,95 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter) | |||
446 | return 0; | 461 | return 0; |
447 | } | 462 | } |
448 | 463 | ||
464 | /** | ||
465 | * e1000_check_for_copper_link_ich8lan - Check for link (Copper) | ||
466 | * @hw: pointer to the HW structure | ||
467 | * | ||
468 | * Checks to see of the link status of the hardware has changed. If a | ||
469 | * change in link status has been detected, then we read the PHY registers | ||
470 | * to get the current speed/duplex if link exists. | ||
471 | **/ | ||
472 | static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) | ||
473 | { | ||
474 | struct e1000_mac_info *mac = &hw->mac; | ||
475 | s32 ret_val; | ||
476 | bool link; | ||
477 | |||
478 | /* | ||
479 | * We only want to go out to the PHY registers to see if Auto-Neg | ||
480 | * has completed and/or if our link status has changed. The | ||
481 | * get_link_status flag is set upon receiving a Link Status | ||
482 | * Change or Rx Sequence Error interrupt. | ||
483 | */ | ||
484 | if (!mac->get_link_status) { | ||
485 | ret_val = 0; | ||
486 | goto out; | ||
487 | } | ||
488 | |||
489 | if (hw->mac.type == e1000_pchlan) { | ||
490 | ret_val = e1000e_write_kmrn_reg(hw, | ||
491 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
492 | E1000_KMRNCTRLSTA_K1_ENABLE); | ||
493 | if (ret_val) | ||
494 | goto out; | ||
495 | } | ||
496 | |||
497 | /* | ||
498 | * First we want to see if the MII Status Register reports | ||
499 | * link. If so, then we want to get the current speed/duplex | ||
500 | * of the PHY. | ||
501 | */ | ||
502 | ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); | ||
503 | if (ret_val) | ||
504 | goto out; | ||
505 | |||
506 | if (!link) | ||
507 | goto out; /* No link detected */ | ||
508 | |||
509 | mac->get_link_status = false; | ||
510 | |||
511 | if (hw->phy.type == e1000_phy_82578) { | ||
512 | ret_val = e1000_link_stall_workaround_hv(hw); | ||
513 | if (ret_val) | ||
514 | goto out; | ||
515 | } | ||
516 | |||
517 | /* | ||
518 | * Check if there was DownShift, must be checked | ||
519 | * immediately after link-up | ||
520 | */ | ||
521 | e1000e_check_downshift(hw); | ||
522 | |||
523 | /* | ||
524 | * If we are forcing speed/duplex, then we simply return since | ||
525 | * we have already determined whether we have link or not. | ||
526 | */ | ||
527 | if (!mac->autoneg) { | ||
528 | ret_val = -E1000_ERR_CONFIG; | ||
529 | goto out; | ||
530 | } | ||
531 | |||
532 | /* | ||
533 | * Auto-Neg is enabled. Auto Speed Detection takes care | ||
534 | * of MAC speed/duplex configuration. So we only need to | ||
535 | * configure Collision Distance in the MAC. | ||
536 | */ | ||
537 | e1000e_config_collision_dist(hw); | ||
538 | |||
539 | /* | ||
540 | * Configure Flow Control now that Auto-Neg has completed. | ||
541 | * First, we need to restore the desired flow control | ||
542 | * settings because we may have had to re-autoneg with a | ||
543 | * different link partner. | ||
544 | */ | ||
545 | ret_val = e1000e_config_fc_after_link_up(hw); | ||
546 | if (ret_val) | ||
547 | hw_dbg(hw, "Error configuring flow control\n"); | ||
548 | |||
549 | out: | ||
550 | return ret_val; | ||
551 | } | ||
552 | |||
449 | static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) | 553 | static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) |
450 | { | 554 | { |
451 | struct e1000_hw *hw = &adapter->hw; | 555 | struct e1000_hw *hw = &adapter->hw; |
@@ -694,6 +798,38 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) | |||
694 | } | 798 | } |
695 | 799 | ||
696 | /** | 800 | /** |
801 | * e1000_lan_init_done_ich8lan - Check for PHY config completion | ||
802 | * @hw: pointer to the HW structure | ||
803 | * | ||
804 | * Check the appropriate indication the MAC has finished configuring the | ||
805 | * PHY after a software reset. | ||
806 | **/ | ||
807 | static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw) | ||
808 | { | ||
809 | u32 data, loop = E1000_ICH8_LAN_INIT_TIMEOUT; | ||
810 | |||
811 | /* Wait for basic configuration completes before proceeding */ | ||
812 | do { | ||
813 | data = er32(STATUS); | ||
814 | data &= E1000_STATUS_LAN_INIT_DONE; | ||
815 | udelay(100); | ||
816 | } while ((!data) && --loop); | ||
817 | |||
818 | /* | ||
819 | * If basic configuration is incomplete before the above loop | ||
820 | * count reaches 0, loading the configuration from NVM will | ||
821 | * leave the PHY in a bad state possibly resulting in no link. | ||
822 | */ | ||
823 | if (loop == 0) | ||
824 | hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); | ||
825 | |||
826 | /* Clear the Init Done bit for the next init event */ | ||
827 | data = er32(STATUS); | ||
828 | data &= ~E1000_STATUS_LAN_INIT_DONE; | ||
829 | ew32(STATUS, data); | ||
830 | } | ||
831 | |||
832 | /** | ||
697 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset | 833 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset |
698 | * @hw: pointer to the HW structure | 834 | * @hw: pointer to the HW structure |
699 | * | 835 | * |
@@ -707,13 +843,15 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
707 | u32 i; | 843 | u32 i; |
708 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; | 844 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; |
709 | s32 ret_val; | 845 | s32 ret_val; |
710 | u16 loop = E1000_ICH8_LAN_INIT_TIMEOUT; | ||
711 | u16 word_addr, reg_data, reg_addr, phy_page = 0; | 846 | u16 word_addr, reg_data, reg_addr, phy_page = 0; |
712 | 847 | ||
713 | ret_val = e1000e_phy_hw_reset_generic(hw); | 848 | ret_val = e1000e_phy_hw_reset_generic(hw); |
714 | if (ret_val) | 849 | if (ret_val) |
715 | return ret_val; | 850 | return ret_val; |
716 | 851 | ||
852 | /* Allow time for h/w to get to a quiescent state after reset */ | ||
853 | mdelay(10); | ||
854 | |||
717 | if (hw->mac.type == e1000_pchlan) { | 855 | if (hw->mac.type == e1000_pchlan) { |
718 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | 856 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); |
719 | if (ret_val) | 857 | if (ret_val) |
@@ -741,26 +879,8 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
741 | if (!(data & sw_cfg_mask)) | 879 | if (!(data & sw_cfg_mask)) |
742 | return 0; | 880 | return 0; |
743 | 881 | ||
744 | /* Wait for basic configuration completes before proceeding*/ | 882 | /* Wait for basic configuration completes before proceeding */ |
745 | do { | 883 | e1000_lan_init_done_ich8lan(hw); |
746 | data = er32(STATUS); | ||
747 | data &= E1000_STATUS_LAN_INIT_DONE; | ||
748 | udelay(100); | ||
749 | } while ((!data) && --loop); | ||
750 | |||
751 | /* | ||
752 | * If basic configuration is incomplete before the above loop | ||
753 | * count reaches 0, loading the configuration from NVM will | ||
754 | * leave the PHY in a bad state possibly resulting in no link. | ||
755 | */ | ||
756 | if (loop == 0) { | ||
757 | hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); | ||
758 | } | ||
759 | |||
760 | /* Clear the Init Done bit for the next init event */ | ||
761 | data = er32(STATUS); | ||
762 | data &= ~E1000_STATUS_LAN_INIT_DONE; | ||
763 | ew32(STATUS, data); | ||
764 | 884 | ||
765 | /* | 885 | /* |
766 | * Make sure HW does not configure LCD from PHY | 886 | * Make sure HW does not configure LCD from PHY |
@@ -961,12 +1081,14 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
961 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; | 1081 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; |
962 | ew32(PHY_CTRL, phy_ctrl); | 1082 | ew32(PHY_CTRL, phy_ctrl); |
963 | 1083 | ||
1084 | if (phy->type != e1000_phy_igp_3) | ||
1085 | return 0; | ||
1086 | |||
964 | /* | 1087 | /* |
965 | * Call gig speed drop workaround on LPLU before accessing | 1088 | * Call gig speed drop workaround on LPLU before accessing |
966 | * any PHY registers | 1089 | * any PHY registers |
967 | */ | 1090 | */ |
968 | if ((hw->mac.type == e1000_ich8lan) && | 1091 | if (hw->mac.type == e1000_ich8lan) |
969 | (hw->phy.type == e1000_phy_igp_3)) | ||
970 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1092 | e1000e_gig_downshift_workaround_ich8lan(hw); |
971 | 1093 | ||
972 | /* When LPLU is enabled, we should disable SmartSpeed */ | 1094 | /* When LPLU is enabled, we should disable SmartSpeed */ |
@@ -979,6 +1101,9 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
979 | phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; | 1101 | phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; |
980 | ew32(PHY_CTRL, phy_ctrl); | 1102 | ew32(PHY_CTRL, phy_ctrl); |
981 | 1103 | ||
1104 | if (phy->type != e1000_phy_igp_3) | ||
1105 | return 0; | ||
1106 | |||
982 | /* | 1107 | /* |
983 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used | 1108 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
984 | * during Dx states where the power conservation is most | 1109 | * during Dx states where the power conservation is most |
@@ -1038,6 +1163,10 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
1038 | if (!active) { | 1163 | if (!active) { |
1039 | phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; | 1164 | phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; |
1040 | ew32(PHY_CTRL, phy_ctrl); | 1165 | ew32(PHY_CTRL, phy_ctrl); |
1166 | |||
1167 | if (phy->type != e1000_phy_igp_3) | ||
1168 | return 0; | ||
1169 | |||
1041 | /* | 1170 | /* |
1042 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used | 1171 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
1043 | * during Dx states where the power conservation is most | 1172 | * during Dx states where the power conservation is most |
@@ -1073,12 +1202,14 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
1073 | phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; | 1202 | phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; |
1074 | ew32(PHY_CTRL, phy_ctrl); | 1203 | ew32(PHY_CTRL, phy_ctrl); |
1075 | 1204 | ||
1205 | if (phy->type != e1000_phy_igp_3) | ||
1206 | return 0; | ||
1207 | |||
1076 | /* | 1208 | /* |
1077 | * Call gig speed drop workaround on LPLU before accessing | 1209 | * Call gig speed drop workaround on LPLU before accessing |
1078 | * any PHY registers | 1210 | * any PHY registers |
1079 | */ | 1211 | */ |
1080 | if ((hw->mac.type == e1000_ich8lan) && | 1212 | if (hw->mac.type == e1000_ich8lan) |
1081 | (hw->phy.type == e1000_phy_igp_3)) | ||
1082 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1213 | e1000e_gig_downshift_workaround_ich8lan(hw); |
1083 | 1214 | ||
1084 | /* When LPLU is enabled, we should disable SmartSpeed */ | 1215 | /* When LPLU is enabled, we should disable SmartSpeed */ |
@@ -1905,7 +2036,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
1905 | break; | 2036 | break; |
1906 | case 1: | 2037 | case 1: |
1907 | sector_size = ICH_FLASH_SEG_SIZE_4K; | 2038 | sector_size = ICH_FLASH_SEG_SIZE_4K; |
1908 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_4K; | 2039 | iteration = 1; |
1909 | break; | 2040 | break; |
1910 | case 2: | 2041 | case 2: |
1911 | if (hw->mac.type == e1000_ich9lan) { | 2042 | if (hw->mac.type == e1000_ich9lan) { |
@@ -1917,7 +2048,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
1917 | break; | 2048 | break; |
1918 | case 3: | 2049 | case 3: |
1919 | sector_size = ICH_FLASH_SEG_SIZE_64K; | 2050 | sector_size = ICH_FLASH_SEG_SIZE_64K; |
1920 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_64K; | 2051 | iteration = 1; |
1921 | break; | 2052 | break; |
1922 | default: | 2053 | default: |
1923 | return -E1000_ERR_NVM; | 2054 | return -E1000_ERR_NVM; |
@@ -2143,6 +2274,12 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2143 | ctrl = er32(CTRL); | 2274 | ctrl = er32(CTRL); |
2144 | 2275 | ||
2145 | if (!e1000_check_reset_block(hw)) { | 2276 | if (!e1000_check_reset_block(hw)) { |
2277 | /* Clear PHY Reset Asserted bit */ | ||
2278 | if (hw->mac.type >= e1000_pchlan) { | ||
2279 | u32 status = er32(STATUS); | ||
2280 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
2281 | } | ||
2282 | |||
2146 | /* | 2283 | /* |
2147 | * PHY HW reset requires MAC CORE reset at the same | 2284 | * PHY HW reset requires MAC CORE reset at the same |
2148 | * time to make sure the interface between MAC and the | 2285 | * time to make sure the interface between MAC and the |
@@ -2156,23 +2293,34 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2156 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); | 2293 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); |
2157 | msleep(20); | 2294 | msleep(20); |
2158 | 2295 | ||
2159 | if (!ret_val) { | 2296 | if (!ret_val) |
2160 | /* release the swflag because it is not reset by | ||
2161 | * hardware reset | ||
2162 | */ | ||
2163 | e1000_release_swflag_ich8lan(hw); | 2297 | e1000_release_swflag_ich8lan(hw); |
2164 | } | ||
2165 | 2298 | ||
2166 | ret_val = e1000e_get_auto_rd_done(hw); | 2299 | if (ctrl & E1000_CTRL_PHY_RST) |
2167 | if (ret_val) { | 2300 | ret_val = hw->phy.ops.get_cfg_done(hw); |
2168 | /* | 2301 | |
2169 | * When auto config read does not complete, do not | 2302 | if (hw->mac.type >= e1000_ich10lan) { |
2170 | * return with an error. This can happen in situations | 2303 | e1000_lan_init_done_ich8lan(hw); |
2171 | * where there is no eeprom and prevents getting link. | 2304 | } else { |
2172 | */ | 2305 | ret_val = e1000e_get_auto_rd_done(hw); |
2173 | hw_dbg(hw, "Auto Read Done did not complete\n"); | 2306 | if (ret_val) { |
2307 | /* | ||
2308 | * When auto config read does not complete, do not | ||
2309 | * return with an error. This can happen in situations | ||
2310 | * where there is no eeprom and prevents getting link. | ||
2311 | */ | ||
2312 | hw_dbg(hw, "Auto Read Done did not complete\n"); | ||
2313 | } | ||
2174 | } | 2314 | } |
2175 | 2315 | ||
2316 | /* | ||
2317 | * For PCH, this write will make sure that any noise | ||
2318 | * will be detected as a CRC error and be dropped rather than show up | ||
2319 | * as a bad packet to the DMA engine. | ||
2320 | */ | ||
2321 | if (hw->mac.type == e1000_pchlan) | ||
2322 | ew32(CRC_OFFSET, 0x65656565); | ||
2323 | |||
2176 | ew32(IMC, 0xffffffff); | 2324 | ew32(IMC, 0xffffffff); |
2177 | icr = er32(ICR); | 2325 | icr = er32(ICR); |
2178 | 2326 | ||
@@ -2222,6 +2370,18 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) | |||
2222 | for (i = 0; i < mac->mta_reg_count; i++) | 2370 | for (i = 0; i < mac->mta_reg_count; i++) |
2223 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); | 2371 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); |
2224 | 2372 | ||
2373 | /* | ||
2374 | * The 82578 Rx buffer will stall if wakeup is enabled in host and | ||
2375 | * the ME. Reading the BM_WUC register will clear the host wakeup bit. | ||
2376 | * Reset the phy after disabling host wakeup to reset the Rx buffer. | ||
2377 | */ | ||
2378 | if (hw->phy.type == e1000_phy_82578) { | ||
2379 | hw->phy.ops.read_phy_reg(hw, BM_WUC, &i); | ||
2380 | ret_val = e1000_phy_hw_reset_ich8lan(hw); | ||
2381 | if (ret_val) | ||
2382 | return ret_val; | ||
2383 | } | ||
2384 | |||
2225 | /* Setup link and flow control */ | 2385 | /* Setup link and flow control */ |
2226 | ret_val = e1000_setup_link_ich8lan(hw); | 2386 | ret_val = e1000_setup_link_ich8lan(hw); |
2227 | 2387 | ||
@@ -2254,16 +2414,6 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) | |||
2254 | ew32(CTRL_EXT, ctrl_ext); | 2414 | ew32(CTRL_EXT, ctrl_ext); |
2255 | 2415 | ||
2256 | /* | 2416 | /* |
2257 | * The 82578 Rx buffer will stall if wakeup is enabled in host and | ||
2258 | * the ME. Reading the BM_WUC register will clear the host wakeup bit. | ||
2259 | * Reset the phy after disabling host wakeup to reset the Rx buffer. | ||
2260 | */ | ||
2261 | if (hw->phy.type == e1000_phy_82578) { | ||
2262 | e1e_rphy(hw, BM_WUC, &i); | ||
2263 | e1000e_phy_hw_reset_generic(hw); | ||
2264 | } | ||
2265 | |||
2266 | /* | ||
2267 | * Clear all of the statistics registers (clear on read). It is | 2417 | * Clear all of the statistics registers (clear on read). It is |
2268 | * important that we do this after we have tried to establish link | 2418 | * important that we do this after we have tried to establish link |
2269 | * because the symbol error count will increment wildly if there | 2419 | * because the symbol error count will increment wildly if there |
@@ -2485,6 +2635,14 @@ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed, | |||
2485 | if (ret_val) | 2635 | if (ret_val) |
2486 | return ret_val; | 2636 | return ret_val; |
2487 | 2637 | ||
2638 | if ((hw->mac.type == e1000_pchlan) && (*speed == SPEED_1000)) { | ||
2639 | ret_val = e1000e_write_kmrn_reg(hw, | ||
2640 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
2641 | E1000_KMRNCTRLSTA_K1_DISABLE); | ||
2642 | if (ret_val) | ||
2643 | return ret_val; | ||
2644 | } | ||
2645 | |||
2488 | if ((hw->mac.type == e1000_ich8lan) && | 2646 | if ((hw->mac.type == e1000_ich8lan) && |
2489 | (hw->phy.type == e1000_phy_igp_3) && | 2647 | (hw->phy.type == e1000_phy_igp_3) && |
2490 | (*speed == SPEED_1000)) { | 2648 | (*speed == SPEED_1000)) { |
@@ -2850,6 +3008,16 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) | |||
2850 | { | 3008 | { |
2851 | u32 bank = 0; | 3009 | u32 bank = 0; |
2852 | 3010 | ||
3011 | if (hw->mac.type >= e1000_pchlan) { | ||
3012 | u32 status = er32(STATUS); | ||
3013 | |||
3014 | if (status & E1000_STATUS_PHYRA) | ||
3015 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
3016 | else | ||
3017 | hw_dbg(hw, | ||
3018 | "PHY Reset Asserted not set - needs delay\n"); | ||
3019 | } | ||
3020 | |||
2853 | e1000e_get_cfg_done(hw); | 3021 | e1000e_get_cfg_done(hw); |
2854 | 3022 | ||
2855 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ | 3023 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ |
@@ -2921,7 +3089,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) | |||
2921 | static struct e1000_mac_operations ich8_mac_ops = { | 3089 | static struct e1000_mac_operations ich8_mac_ops = { |
2922 | .id_led_init = e1000e_id_led_init, | 3090 | .id_led_init = e1000e_id_led_init, |
2923 | .check_mng_mode = e1000_check_mng_mode_ich8lan, | 3091 | .check_mng_mode = e1000_check_mng_mode_ich8lan, |
2924 | .check_for_link = e1000e_check_for_copper_link, | 3092 | .check_for_link = e1000_check_for_copper_link_ich8lan, |
2925 | /* cleanup_led dependent on mac type */ | 3093 | /* cleanup_led dependent on mac type */ |
2926 | .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, | 3094 | .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, |
2927 | .get_bus_info = e1000_get_bus_info_ich8lan, | 3095 | .get_bus_info = e1000_get_bus_info_ich8lan, |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index be6d9e990374..99ba2b8a2a05 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -378,12 +378,6 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw) | |||
378 | 378 | ||
379 | mac->get_link_status = 0; | 379 | mac->get_link_status = 0; |
380 | 380 | ||
381 | if (hw->phy.type == e1000_phy_82578) { | ||
382 | ret_val = e1000_link_stall_workaround_hv(hw); | ||
383 | if (ret_val) | ||
384 | return ret_val; | ||
385 | } | ||
386 | |||
387 | /* | 381 | /* |
388 | * Check if there was DownShift, must be checked | 382 | * Check if there was DownShift, must be checked |
389 | * immediately after link-up | 383 | * immediately after link-up |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index e23459cf3d0e..994401fd0664 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -1531,7 +1531,12 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, | |||
1531 | */ | 1531 | */ |
1532 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); | 1532 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); |
1533 | if (ret_val) | 1533 | if (ret_val) |
1534 | break; | 1534 | /* |
1535 | * If the first read fails, another entity may have | ||
1536 | * ownership of the resources, wait and try again to | ||
1537 | * see if they have relinquished the resources yet. | ||
1538 | */ | ||
1539 | udelay(usec_interval); | ||
1535 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); | 1540 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); |
1536 | if (ret_val) | 1541 | if (ret_val) |
1537 | break; | 1542 | break; |
@@ -2737,6 +2742,11 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) | |||
2737 | if (hw->phy.type != e1000_phy_82578) | 2742 | if (hw->phy.type != e1000_phy_82578) |
2738 | goto out; | 2743 | goto out; |
2739 | 2744 | ||
2745 | /* Do not apply workaround if in PHY loopback bit 14 set */ | ||
2746 | hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &data); | ||
2747 | if (data & PHY_CONTROL_LB) | ||
2748 | goto out; | ||
2749 | |||
2740 | /* check if link is up and at 1Gbps */ | 2750 | /* check if link is up and at 1Gbps */ |
2741 | ret_val = hw->phy.ops.read_phy_reg(hw, BM_CS_STATUS, &data); | 2751 | ret_val = hw->phy.ops.read_phy_reg(hw, BM_CS_STATUS, &data); |
2742 | if (ret_val) | 2752 | if (ret_val) |
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index cc2ab6412c73..4f7003485348 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c | |||
@@ -1784,7 +1784,7 @@ int __init init_module(void) | |||
1784 | printk(KERN_INFO "eepro_init_module: Auto-detecting boards (May God protect us...)\n"); | 1784 | printk(KERN_INFO "eepro_init_module: Auto-detecting boards (May God protect us...)\n"); |
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | for (i = 0; io[i] != -1 && i < MAX_EEPRO; i++) { | 1787 | for (i = 0; i < MAX_EEPRO && io[i] != -1; i++) { |
1788 | dev = alloc_etherdev(sizeof(struct eepro_local)); | 1788 | dev = alloc_etherdev(sizeof(struct eepro_local)); |
1789 | if (!dev) | 1789 | if (!dev) |
1790 | break; | 1790 | break; |
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index 1686dca28748..1f016d66684a 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c | |||
@@ -1474,13 +1474,13 @@ static void eexp_hw_init586(struct net_device *dev) | |||
1474 | outw(0x0000, ioaddr + 0x800c); | 1474 | outw(0x0000, ioaddr + 0x800c); |
1475 | outw(0x0000, ioaddr + 0x800e); | 1475 | outw(0x0000, ioaddr + 0x800e); |
1476 | 1476 | ||
1477 | for (i = 0; i < (sizeof(start_code)); i+=32) { | 1477 | for (i = 0; i < ARRAY_SIZE(start_code) * 2; i+=32) { |
1478 | int j; | 1478 | int j; |
1479 | outw(i, ioaddr + SM_PTR); | 1479 | outw(i, ioaddr + SM_PTR); |
1480 | for (j = 0; j < 16; j+=2) | 1480 | for (j = 0; j < 16 && (i+j)/2 < ARRAY_SIZE(start_code); j+=2) |
1481 | outw(start_code[(i+j)/2], | 1481 | outw(start_code[(i+j)/2], |
1482 | ioaddr+0x4000+j); | 1482 | ioaddr+0x4000+j); |
1483 | for (j = 0; j < 16; j+=2) | 1483 | for (j = 0; j < 16 && (i+j+16)/2 < ARRAY_SIZE(start_code); j+=2) |
1484 | outw(start_code[(i+j+16)/2], | 1484 | outw(start_code[(i+j+16)/2], |
1485 | ioaddr+0x8000+j); | 1485 | ioaddr+0x8000+j); |
1486 | } | 1486 | } |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 78952f8324e2..fa311a950996 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | 41 | ||
42 | #define DRV_NAME "ehea" | 42 | #define DRV_NAME "ehea" |
43 | #define DRV_VERSION "EHEA_0101" | 43 | #define DRV_VERSION "EHEA_0102" |
44 | 44 | ||
45 | /* eHEA capability flags */ | 45 | /* eHEA capability flags */ |
46 | #define DLPAR_PORT_ADD_REM 1 | 46 | #define DLPAR_PORT_ADD_REM 1 |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 147c4b088fb3..977c3d358279 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -1545,6 +1545,9 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr) | |||
1545 | { | 1545 | { |
1546 | int ret, i; | 1546 | int ret, i; |
1547 | 1547 | ||
1548 | if (pr->qp) | ||
1549 | netif_napi_del(&pr->napi); | ||
1550 | |||
1548 | ret = ehea_destroy_qp(pr->qp); | 1551 | ret = ehea_destroy_qp(pr->qp); |
1549 | 1552 | ||
1550 | if (!ret) { | 1553 | if (!ret) { |
@@ -3080,7 +3083,9 @@ static const struct net_device_ops ehea_netdev_ops = { | |||
3080 | .ndo_poll_controller = ehea_netpoll, | 3083 | .ndo_poll_controller = ehea_netpoll, |
3081 | #endif | 3084 | #endif |
3082 | .ndo_get_stats = ehea_get_stats, | 3085 | .ndo_get_stats = ehea_get_stats, |
3086 | .ndo_change_mtu = eth_change_mtu, | ||
3083 | .ndo_set_mac_address = ehea_set_mac_addr, | 3087 | .ndo_set_mac_address = ehea_set_mac_addr, |
3088 | .ndo_validate_addr = eth_validate_addr, | ||
3084 | .ndo_set_multicast_list = ehea_set_multicast_list, | 3089 | .ndo_set_multicast_list = ehea_set_multicast_list, |
3085 | .ndo_change_mtu = ehea_change_mtu, | 3090 | .ndo_change_mtu = ehea_change_mtu, |
3086 | .ndo_vlan_rx_register = ehea_vlan_rx_register, | 3091 | .ndo_vlan_rx_register = ehea_vlan_rx_register, |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index b60e27dfcfa7..88d7ebf31220 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -338,8 +338,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, | |||
338 | #ifndef MODULE | 338 | #ifndef MODULE |
339 | static int printed_version; | 339 | static int printed_version; |
340 | if (!printed_version++) | 340 | if (!printed_version++) |
341 | printk (KERN_INFO "%s" KERN_INFO "%s", | 341 | printk(KERN_INFO "%s%s", version, version2); |
342 | version, version2); | ||
343 | #endif | 342 | #endif |
344 | 343 | ||
345 | card_idx++; | 344 | card_idx++; |
@@ -1600,7 +1599,7 @@ static int __init epic_init (void) | |||
1600 | { | 1599 | { |
1601 | /* when a module, this is printed whether or not devices are found in probe */ | 1600 | /* when a module, this is printed whether or not devices are found in probe */ |
1602 | #ifdef MODULE | 1601 | #ifdef MODULE |
1603 | printk (KERN_INFO "%s" KERN_INFO "%s", | 1602 | printk (KERN_INFO "%s%s", |
1604 | version, version2); | 1603 | version, version2); |
1605 | #endif | 1604 | #endif |
1606 | 1605 | ||
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 891be28a7d4f..160655d24581 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c | |||
@@ -584,7 +584,8 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev, | |||
584 | if (np->flags == HAS_MII_XCVR) { | 584 | if (np->flags == HAS_MII_XCVR) { |
585 | int phy, phy_idx = 0; | 585 | int phy, phy_idx = 0; |
586 | 586 | ||
587 | for (phy = 1; phy < 32 && phy_idx < 4; phy++) { | 587 | for (phy = 1; phy < 32 && phy_idx < ARRAY_SIZE(np->phys); |
588 | phy++) { | ||
588 | int mii_status = mdio_read(dev, phy, 1); | 589 | int mii_status = mdio_read(dev, phy, 1); |
589 | 590 | ||
590 | if (mii_status != 0xffff && mii_status != 0x0000) { | 591 | if (mii_status != 0xffff && mii_status != 0x0000) { |
@@ -1209,17 +1210,20 @@ static void fealnx_tx_timeout(struct net_device *dev) | |||
1209 | unsigned long flags; | 1210 | unsigned long flags; |
1210 | int i; | 1211 | int i; |
1211 | 1212 | ||
1212 | printk(KERN_WARNING "%s: Transmit timed out, status %8.8x," | 1213 | printk(KERN_WARNING |
1213 | " resetting...\n", dev->name, ioread32(ioaddr + ISR)); | 1214 | "%s: Transmit timed out, status %8.8x, resetting...\n", |
1215 | dev->name, ioread32(ioaddr + ISR)); | ||
1214 | 1216 | ||
1215 | { | 1217 | { |
1216 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); | 1218 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); |
1217 | for (i = 0; i < RX_RING_SIZE; i++) | 1219 | for (i = 0; i < RX_RING_SIZE; i++) |
1218 | printk(" %8.8x", (unsigned int) np->rx_ring[i].status); | 1220 | printk(KERN_CONT " %8.8x", |
1219 | printk("\n" KERN_DEBUG " Tx ring %p: ", np->tx_ring); | 1221 | (unsigned int) np->rx_ring[i].status); |
1222 | printk(KERN_CONT "\n"); | ||
1223 | printk(KERN_DEBUG " Tx ring %p: ", np->tx_ring); | ||
1220 | for (i = 0; i < TX_RING_SIZE; i++) | 1224 | for (i = 0; i < TX_RING_SIZE; i++) |
1221 | printk(" %4.4x", np->tx_ring[i].status); | 1225 | printk(KERN_CONT " %4.4x", np->tx_ring[i].status); |
1222 | printk("\n"); | 1226 | printk(KERN_CONT "\n"); |
1223 | } | 1227 | } |
1224 | 1228 | ||
1225 | spin_lock_irqsave(&np->lock, flags); | 1229 | spin_lock_irqsave(&np->lock, flags); |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 0f19b743749b..d4b98074b1b7 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -1642,6 +1642,7 @@ static const struct net_device_ops fec_netdev_ops = { | |||
1642 | .ndo_stop = fec_enet_close, | 1642 | .ndo_stop = fec_enet_close, |
1643 | .ndo_start_xmit = fec_enet_start_xmit, | 1643 | .ndo_start_xmit = fec_enet_start_xmit, |
1644 | .ndo_set_multicast_list = set_multicast_list, | 1644 | .ndo_set_multicast_list = set_multicast_list, |
1645 | .ndo_change_mtu = eth_change_mtu, | ||
1645 | .ndo_validate_addr = eth_validate_addr, | 1646 | .ndo_validate_addr = eth_validate_addr, |
1646 | .ndo_tx_timeout = fec_timeout, | 1647 | .ndo_tx_timeout = fec_timeout, |
1647 | .ndo_set_mac_address = fec_set_mac_address, | 1648 | .ndo_set_mac_address = fec_set_mac_address, |
diff --git a/drivers/net/fec.h b/drivers/net/fec.h index 30b7dd671336..cc47f3f057c7 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h | |||
@@ -46,12 +46,12 @@ | |||
46 | 46 | ||
47 | #else | 47 | #else |
48 | 48 | ||
49 | #define FEC_ECNTRL; 0x000 /* Ethernet control reg */ | 49 | #define FEC_ECNTRL 0x000 /* Ethernet control reg */ |
50 | #define FEC_IEVENT; 0x004 /* Interrupt even reg */ | 50 | #define FEC_IEVENT 0x004 /* Interrupt even reg */ |
51 | #define FEC_IMASK; 0x008 /* Interrupt mask reg */ | 51 | #define FEC_IMASK 0x008 /* Interrupt mask reg */ |
52 | #define FEC_IVEC; 0x00c /* Interrupt vec status reg */ | 52 | #define FEC_IVEC 0x00c /* Interrupt vec status reg */ |
53 | #define FEC_R_DES_ACTIVE; 0x010 /* Receive descriptor reg */ | 53 | #define FEC_R_DES_ACTIVE 0x010 /* Receive descriptor reg */ |
54 | #define FEC_X_DES_ACTIVE; 0x01c /* Transmit descriptor reg */ | 54 | #define FEC_X_DES_ACTIVE 0x014 /* Transmit descriptor reg */ |
55 | #define FEC_MII_DATA 0x040 /* MII manage frame reg */ | 55 | #define FEC_MII_DATA 0x040 /* MII manage frame reg */ |
56 | #define FEC_MII_SPEED 0x044 /* MII speed control reg */ | 56 | #define FEC_MII_SPEED 0x044 /* MII speed control reg */ |
57 | #define FEC_R_BOUND 0x08c /* FIFO receive bound reg */ | 57 | #define FEC_R_BOUND 0x08c /* FIFO receive bound reg */ |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 1094d292630f..3b4e0766c7b2 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -3514,11 +3514,13 @@ static irqreturn_t nv_nic_irq(int foo, void *data) | |||
3514 | nv_msi_workaround(np); | 3514 | nv_msi_workaround(np); |
3515 | 3515 | ||
3516 | #ifdef CONFIG_FORCEDETH_NAPI | 3516 | #ifdef CONFIG_FORCEDETH_NAPI |
3517 | napi_schedule(&np->napi); | 3517 | if (napi_schedule_prep(&np->napi)) { |
3518 | 3518 | /* | |
3519 | /* Disable furthur irq's | 3519 | * Disable further irq's (msix not enabled with napi) |
3520 | (msix not enabled with napi) */ | 3520 | */ |
3521 | writel(0, base + NvRegIrqMask); | 3521 | writel(0, base + NvRegIrqMask); |
3522 | __napi_schedule(&np->napi); | ||
3523 | } | ||
3522 | 3524 | ||
3523 | #else | 3525 | #else |
3524 | do | 3526 | do |
@@ -3615,12 +3617,13 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data) | |||
3615 | nv_msi_workaround(np); | 3617 | nv_msi_workaround(np); |
3616 | 3618 | ||
3617 | #ifdef CONFIG_FORCEDETH_NAPI | 3619 | #ifdef CONFIG_FORCEDETH_NAPI |
3618 | napi_schedule(&np->napi); | 3620 | if (napi_schedule_prep(&np->napi)) { |
3619 | 3621 | /* | |
3620 | /* Disable furthur irq's | 3622 | * Disable further irq's (msix not enabled with napi) |
3621 | (msix not enabled with napi) */ | 3623 | */ |
3622 | writel(0, base + NvRegIrqMask); | 3624 | writel(0, base + NvRegIrqMask); |
3623 | 3625 | __napi_schedule(&np->napi); | |
3626 | } | ||
3624 | #else | 3627 | #else |
3625 | do | 3628 | do |
3626 | { | 3629 | { |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index b892c3ad9a74..2bc2d2b20644 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -754,17 +754,16 @@ static int fs_init_phy(struct net_device *dev) | |||
754 | fep->oldlink = 0; | 754 | fep->oldlink = 0; |
755 | fep->oldspeed = 0; | 755 | fep->oldspeed = 0; |
756 | fep->oldduplex = -1; | 756 | fep->oldduplex = -1; |
757 | if(fep->fpi->phy_node) | 757 | |
758 | phydev = of_phy_connect(dev, fep->fpi->phy_node, | 758 | phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0, |
759 | &fs_adjust_link, 0, | 759 | PHY_INTERFACE_MODE_MII); |
760 | PHY_INTERFACE_MODE_MII); | 760 | if (!phydev) { |
761 | else { | 761 | phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link, |
762 | printk("No phy bus ID specified in BSP code\n"); | 762 | PHY_INTERFACE_MODE_MII); |
763 | return -EINVAL; | ||
764 | } | 763 | } |
765 | if (IS_ERR(phydev)) { | 764 | if (!phydev) { |
766 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 765 | dev_err(&dev->dev, "Could not attach to PHY\n"); |
767 | return PTR_ERR(phydev); | 766 | return -ENODEV; |
768 | } | 767 | } |
769 | 768 | ||
770 | fep->phydev = phydev; | 769 | fep->phydev = phydev; |
@@ -1005,6 +1004,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev, | |||
1005 | goto out_free_fpi; | 1004 | goto out_free_fpi; |
1006 | } | 1005 | } |
1007 | 1006 | ||
1007 | SET_NETDEV_DEV(ndev, &ofdev->dev); | ||
1008 | dev_set_drvdata(&ofdev->dev, ndev); | 1008 | dev_set_drvdata(&ofdev->dev, ndev); |
1009 | 1009 | ||
1010 | fep = netdev_priv(ndev); | 1010 | fep = netdev_priv(ndev); |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 4ae1d259fced..f8ffcbf0bc39 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -156,6 +156,8 @@ static const struct net_device_ops gfar_netdev_ops = { | |||
156 | .ndo_tx_timeout = gfar_timeout, | 156 | .ndo_tx_timeout = gfar_timeout, |
157 | .ndo_do_ioctl = gfar_ioctl, | 157 | .ndo_do_ioctl = gfar_ioctl, |
158 | .ndo_vlan_rx_register = gfar_vlan_rx_register, | 158 | .ndo_vlan_rx_register = gfar_vlan_rx_register, |
159 | .ndo_set_mac_address = eth_mac_addr, | ||
160 | .ndo_validate_addr = eth_validate_addr, | ||
159 | #ifdef CONFIG_NET_POLL_CONTROLLER | 161 | #ifdef CONFIG_NET_POLL_CONTROLLER |
160 | .ndo_poll_controller = gfar_netpoll, | 162 | .ndo_poll_controller = gfar_netpoll, |
161 | #endif | 163 | #endif |
@@ -262,15 +264,6 @@ static int gfar_of_init(struct net_device *dev) | |||
262 | priv->device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET; | 264 | priv->device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET; |
263 | 265 | ||
264 | priv->phy_node = of_parse_phandle(np, "phy-handle", 0); | 266 | priv->phy_node = of_parse_phandle(np, "phy-handle", 0); |
265 | if (!priv->phy_node) { | ||
266 | u32 *fixed_link; | ||
267 | |||
268 | fixed_link = (u32 *)of_get_property(np, "fixed-link", NULL); | ||
269 | if (!fixed_link) { | ||
270 | err = -ENODEV; | ||
271 | goto err_out; | ||
272 | } | ||
273 | } | ||
274 | 267 | ||
275 | /* Find the TBI PHY. If it's not there, we don't support SGMII */ | 268 | /* Find the TBI PHY. If it's not there, we don't support SGMII */ |
276 | priv->tbi_node = of_parse_phandle(np, "tbi-handle", 0); | 269 | priv->tbi_node = of_parse_phandle(np, "tbi-handle", 0); |
@@ -657,13 +650,14 @@ static int init_phy(struct net_device *dev) | |||
657 | 650 | ||
658 | interface = gfar_get_interface(dev); | 651 | interface = gfar_get_interface(dev); |
659 | 652 | ||
660 | if (priv->phy_node) { | 653 | priv->phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 0, |
661 | priv->phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, | 654 | interface); |
662 | 0, interface); | 655 | if (!priv->phydev) |
663 | if (!priv->phydev) { | 656 | priv->phydev = of_phy_connect_fixed_link(dev, &adjust_link, |
664 | dev_err(&dev->dev, "error: Could not attach to PHY\n"); | 657 | interface); |
665 | return -ENODEV; | 658 | if (!priv->phydev) { |
666 | } | 659 | dev_err(&dev->dev, "could not attach to PHY\n"); |
660 | return -ENODEV; | ||
667 | } | 661 | } |
668 | 662 | ||
669 | if (interface == PHY_INTERFACE_MODE_SGMII) | 663 | if (interface == PHY_INTERFACE_MODE_SGMII) |
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index dbf06e9313cc..2234118eedbb 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
@@ -366,9 +366,8 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals | |||
366 | return -EINVAL; | 366 | return -EINVAL; |
367 | } | 367 | } |
368 | 368 | ||
369 | priv->rxic = mk_ic_value( | 369 | priv->rxic = mk_ic_value(cvals->rx_max_coalesced_frames, |
370 | gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs), | 370 | gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs)); |
371 | cvals->rx_max_coalesced_frames); | ||
372 | 371 | ||
373 | /* Set up tx coalescing */ | 372 | /* Set up tx coalescing */ |
374 | if ((cvals->tx_coalesce_usecs == 0) || | 373 | if ((cvals->tx_coalesce_usecs == 0) || |
@@ -390,9 +389,8 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals | |||
390 | return -EINVAL; | 389 | return -EINVAL; |
391 | } | 390 | } |
392 | 391 | ||
393 | priv->txic = mk_ic_value( | 392 | priv->txic = mk_ic_value(cvals->tx_max_coalesced_frames, |
394 | gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs), | 393 | gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs)); |
395 | cvals->tx_max_coalesced_frames); | ||
396 | 394 | ||
397 | gfar_write(&priv->regs->rxic, 0); | 395 | gfar_write(&priv->regs->rxic, 0); |
398 | if (priv->rxcoalescing) | 396 | if (priv->rxcoalescing) |
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index 9d5b62cb30f7..d62378cbc149 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c | |||
@@ -173,8 +173,8 @@ static int tx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; | |||
173 | 173 | ||
174 | static const char version[] __devinitconst = | 174 | static const char version[] __devinitconst = |
175 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n" | 175 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n" |
176 | KERN_INFO " Some modifications by Eric kasten <kasten@nscl.msu.edu>\n" | 176 | " Some modifications by Eric kasten <kasten@nscl.msu.edu>\n" |
177 | KERN_INFO " Further modifications by Keith Underwood <keithu@parl.clemson.edu>\n"; | 177 | " Further modifications by Keith Underwood <keithu@parl.clemson.edu>\n"; |
178 | 178 | ||
179 | 179 | ||
180 | /* IP_MF appears to be only defined in <netinet/ip.h>, however, | 180 | /* IP_MF appears to be only defined in <netinet/ip.h>, however, |
@@ -1080,11 +1080,14 @@ static void hamachi_tx_timeout(struct net_device *dev) | |||
1080 | { | 1080 | { |
1081 | printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); | 1081 | printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); |
1082 | for (i = 0; i < RX_RING_SIZE; i++) | 1082 | for (i = 0; i < RX_RING_SIZE; i++) |
1083 | printk(" %8.8x", le32_to_cpu(hmp->rx_ring[i].status_n_length)); | 1083 | printk(KERN_CONT " %8.8x", |
1084 | printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); | 1084 | le32_to_cpu(hmp->rx_ring[i].status_n_length)); |
1085 | printk(KERN_CONT "\n"); | ||
1086 | printk(KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); | ||
1085 | for (i = 0; i < TX_RING_SIZE; i++) | 1087 | for (i = 0; i < TX_RING_SIZE; i++) |
1086 | printk(" %4.4x", le32_to_cpu(hmp->tx_ring[i].status_n_length)); | 1088 | printk(KERN_CONT " %4.4x", |
1087 | printk("\n"); | 1089 | le32_to_cpu(hmp->tx_ring[i].status_n_length)); |
1090 | printk(KERN_CONT "\n"); | ||
1088 | } | 1091 | } |
1089 | 1092 | ||
1090 | /* Reinit the hardware and make sure the Rx and Tx processes | 1093 | /* Reinit the hardware and make sure the Rx and Tx processes |
@@ -1753,13 +1756,13 @@ static int hamachi_close(struct net_device *dev) | |||
1753 | 1756 | ||
1754 | #ifdef __i386__ | 1757 | #ifdef __i386__ |
1755 | if (hamachi_debug > 2) { | 1758 | if (hamachi_debug > 2) { |
1756 | printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n", | 1759 | printk(KERN_DEBUG " Tx ring at %8.8x:\n", |
1757 | (int)hmp->tx_ring_dma); | 1760 | (int)hmp->tx_ring_dma); |
1758 | for (i = 0; i < TX_RING_SIZE; i++) | 1761 | for (i = 0; i < TX_RING_SIZE; i++) |
1759 | printk(" %c #%d desc. %8.8x %8.8x.\n", | 1762 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x.\n", |
1760 | readl(ioaddr + TxCurPtr) == (long)&hmp->tx_ring[i] ? '>' : ' ', | 1763 | readl(ioaddr + TxCurPtr) == (long)&hmp->tx_ring[i] ? '>' : ' ', |
1761 | i, hmp->tx_ring[i].status_n_length, hmp->tx_ring[i].addr); | 1764 | i, hmp->tx_ring[i].status_n_length, hmp->tx_ring[i].addr); |
1762 | printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", | 1765 | printk(KERN_DEBUG " Rx ring %8.8x:\n", |
1763 | (int)hmp->rx_ring_dma); | 1766 | (int)hmp->rx_ring_dma); |
1764 | for (i = 0; i < RX_RING_SIZE; i++) { | 1767 | for (i = 0; i < RX_RING_SIZE; i++) { |
1765 | printk(KERN_DEBUG " %c #%d desc. %4.4x %8.8x\n", | 1768 | printk(KERN_DEBUG " %c #%d desc. %4.4x %8.8x\n", |
@@ -1770,7 +1773,7 @@ static int hamachi_close(struct net_device *dev) | |||
1770 | u16 *addr = (u16 *) | 1773 | u16 *addr = (u16 *) |
1771 | hmp->rx_skbuff[i]->data; | 1774 | hmp->rx_skbuff[i]->data; |
1772 | int j; | 1775 | int j; |
1773 | 1776 | printk(KERN_DEBUG "Addr: "); | |
1774 | for (j = 0; j < 0x50; j++) | 1777 | for (j = 0; j < 0x50; j++) |
1775 | printk(" %4.4x", addr[j]); | 1778 | printk(" %4.4x", addr[j]); |
1776 | printk("\n"); | 1779 | printk("\n"); |
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 155160052c8b..981ab530e9ac 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * devices like TTY. It interfaces between a raw TTY and the | 3 | * devices like TTY. It interfaces between a raw TTY and the |
4 | * kernel's AX.25 protocol layers. | 4 | * kernel's AX.25 protocol layers. |
5 | * | 5 | * |
6 | * Authors: Andreas Könsgen <ajk@iehk.rwth-aachen.de> | 6 | * Authors: Andreas Könsgen <ajk@comnets.uni-bremen.de> |
7 | * Ralf Baechle DL5RB <ralf@linux-mips.org> | 7 | * Ralf Baechle DL5RB <ralf@linux-mips.org> |
8 | * | 8 | * |
9 | * Quite a lot of stuff "stolen" by Joerg Reuter from slip.c, written by | 9 | * Quite a lot of stuff "stolen" by Joerg Reuter from slip.c, written by |
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index 5e4b7afd0683..352703255bba 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c | |||
@@ -68,7 +68,7 @@ static const char paranoia_str[] = KERN_ERR | |||
68 | 68 | ||
69 | static const char bc_drvname[] = "baycom_epp"; | 69 | static const char bc_drvname[] = "baycom_epp"; |
70 | static const char bc_drvinfo[] = KERN_INFO "baycom_epp: (C) 1998-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 70 | static const char bc_drvinfo[] = KERN_INFO "baycom_epp: (C) 1998-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
71 | KERN_INFO "baycom_epp: version 0.7 compiled " __TIME__ " " __DATE__ "\n"; | 71 | "baycom_epp: version 0.7 compiled " __TIME__ " " __DATE__ "\n"; |
72 | 72 | ||
73 | /* --------------------------------------------------------------------- */ | 73 | /* --------------------------------------------------------------------- */ |
74 | 74 | ||
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c index 2e6fc4dc74b1..5f5af9a606f8 100644 --- a/drivers/net/hamradio/baycom_par.c +++ b/drivers/net/hamradio/baycom_par.c | |||
@@ -102,7 +102,7 @@ | |||
102 | 102 | ||
103 | static const char bc_drvname[] = "baycom_par"; | 103 | static const char bc_drvname[] = "baycom_par"; |
104 | static const char bc_drvinfo[] = KERN_INFO "baycom_par: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 104 | static const char bc_drvinfo[] = KERN_INFO "baycom_par: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
105 | KERN_INFO "baycom_par: version 0.9 compiled " __TIME__ " " __DATE__ "\n"; | 105 | "baycom_par: version 0.9 compiled " __TIME__ " " __DATE__ "\n"; |
106 | 106 | ||
107 | /* --------------------------------------------------------------------- */ | 107 | /* --------------------------------------------------------------------- */ |
108 | 108 | ||
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index b6a816e60c0f..aa4488e871b2 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c | |||
@@ -91,7 +91,7 @@ | |||
91 | 91 | ||
92 | static const char bc_drvname[] = "baycom_ser_fdx"; | 92 | static const char bc_drvname[] = "baycom_ser_fdx"; |
93 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_fdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 93 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_fdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
94 | KERN_INFO "baycom_ser_fdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; | 94 | "baycom_ser_fdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; |
95 | 95 | ||
96 | /* --------------------------------------------------------------------- */ | 96 | /* --------------------------------------------------------------------- */ |
97 | 97 | ||
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c index 3bcc57acbe6d..88c593596020 100644 --- a/drivers/net/hamradio/baycom_ser_hdx.c +++ b/drivers/net/hamradio/baycom_ser_hdx.c | |||
@@ -79,7 +79,7 @@ | |||
79 | 79 | ||
80 | static const char bc_drvname[] = "baycom_ser_hdx"; | 80 | static const char bc_drvname[] = "baycom_ser_hdx"; |
81 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_hdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 81 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_hdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
82 | KERN_INFO "baycom_ser_hdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; | 82 | "baycom_ser_hdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; |
83 | 83 | ||
84 | /* --------------------------------------------------------------------- */ | 84 | /* --------------------------------------------------------------------- */ |
85 | 85 | ||
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c index 1d5379de6900..8d76cb89dbd6 100644 --- a/drivers/net/ibm_newemac/rgmii.c +++ b/drivers/net/ibm_newemac/rgmii.c | |||
@@ -188,11 +188,12 @@ void rgmii_put_mdio(struct of_device *ofdev, int input) | |||
188 | void rgmii_detach(struct of_device *ofdev, int input) | 188 | void rgmii_detach(struct of_device *ofdev, int input) |
189 | { | 189 | { |
190 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 190 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
191 | struct rgmii_regs __iomem *p = dev->base; | 191 | struct rgmii_regs __iomem *p; |
192 | |||
193 | mutex_lock(&dev->lock); | ||
194 | 192 | ||
195 | BUG_ON(!dev || dev->users == 0); | 193 | BUG_ON(!dev || dev->users == 0); |
194 | p = dev->base; | ||
195 | |||
196 | mutex_lock(&dev->lock); | ||
196 | 197 | ||
197 | RGMII_DBG(dev, "detach(%d)" NL, input); | 198 | RGMII_DBG(dev, "detach(%d)" NL, input); |
198 | 199 | ||
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index efd9be214885..ac28dd5a4fd1 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
@@ -190,6 +190,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) | |||
190 | phy->ops.write_reg = igb_write_phy_reg_igp; | 190 | phy->ops.write_reg = igb_write_phy_reg_igp; |
191 | } | 191 | } |
192 | 192 | ||
193 | /* set lan id */ | ||
194 | hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >> | ||
195 | E1000_STATUS_FUNC_SHIFT; | ||
196 | |||
193 | /* Set phy->phy_addr and phy->id. */ | 197 | /* Set phy->phy_addr and phy->id. */ |
194 | ret_val = igb_get_phy_id_82575(hw); | 198 | ret_val = igb_get_phy_id_82575(hw); |
195 | if (ret_val) | 199 | if (ret_val) |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index be480292aba1..adb09d32625d 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -127,14 +127,48 @@ static void igb_restore_vlan(struct igb_adapter *); | |||
127 | static void igb_ping_all_vfs(struct igb_adapter *); | 127 | static void igb_ping_all_vfs(struct igb_adapter *); |
128 | static void igb_msg_task(struct igb_adapter *); | 128 | static void igb_msg_task(struct igb_adapter *); |
129 | static int igb_rcv_msg_from_vf(struct igb_adapter *, u32); | 129 | static int igb_rcv_msg_from_vf(struct igb_adapter *, u32); |
130 | static inline void igb_set_rah_pool(struct e1000_hw *, int , int); | ||
131 | static void igb_set_mc_list_pools(struct igb_adapter *, int, u16); | 130 | static void igb_set_mc_list_pools(struct igb_adapter *, int, u16); |
132 | static void igb_vmm_control(struct igb_adapter *); | 131 | static void igb_vmm_control(struct igb_adapter *); |
133 | static inline void igb_set_vmolr(struct e1000_hw *, int); | ||
134 | static inline int igb_set_vf_rlpml(struct igb_adapter *, int, int); | ||
135 | static int igb_set_vf_mac(struct igb_adapter *adapter, int, unsigned char *); | 132 | static int igb_set_vf_mac(struct igb_adapter *adapter, int, unsigned char *); |
136 | static void igb_restore_vf_multicasts(struct igb_adapter *adapter); | 133 | static void igb_restore_vf_multicasts(struct igb_adapter *adapter); |
137 | 134 | ||
135 | static inline void igb_set_vmolr(struct e1000_hw *hw, int vfn) | ||
136 | { | ||
137 | u32 reg_data; | ||
138 | |||
139 | reg_data = rd32(E1000_VMOLR(vfn)); | ||
140 | reg_data |= E1000_VMOLR_BAM | /* Accept broadcast */ | ||
141 | E1000_VMOLR_ROPE | /* Accept packets matched in UTA */ | ||
142 | E1000_VMOLR_ROMPE | /* Accept packets matched in MTA */ | ||
143 | E1000_VMOLR_AUPE | /* Accept untagged packets */ | ||
144 | E1000_VMOLR_STRVLAN; /* Strip vlan tags */ | ||
145 | wr32(E1000_VMOLR(vfn), reg_data); | ||
146 | } | ||
147 | |||
148 | static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size, | ||
149 | int vfn) | ||
150 | { | ||
151 | struct e1000_hw *hw = &adapter->hw; | ||
152 | u32 vmolr; | ||
153 | |||
154 | vmolr = rd32(E1000_VMOLR(vfn)); | ||
155 | vmolr &= ~E1000_VMOLR_RLPML_MASK; | ||
156 | vmolr |= size | E1000_VMOLR_LPE; | ||
157 | wr32(E1000_VMOLR(vfn), vmolr); | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | static inline void igb_set_rah_pool(struct e1000_hw *hw, int pool, int entry) | ||
163 | { | ||
164 | u32 reg_data; | ||
165 | |||
166 | reg_data = rd32(E1000_RAH(entry)); | ||
167 | reg_data &= ~E1000_RAH_POOL_MASK; | ||
168 | reg_data |= E1000_RAH_POOL_1 << pool;; | ||
169 | wr32(E1000_RAH(entry), reg_data); | ||
170 | } | ||
171 | |||
138 | #ifdef CONFIG_PM | 172 | #ifdef CONFIG_PM |
139 | static int igb_suspend(struct pci_dev *, pm_message_t); | 173 | static int igb_suspend(struct pci_dev *, pm_message_t); |
140 | static int igb_resume(struct pci_dev *); | 174 | static int igb_resume(struct pci_dev *); |
@@ -5418,43 +5452,6 @@ static void igb_io_resume(struct pci_dev *pdev) | |||
5418 | igb_get_hw_control(adapter); | 5452 | igb_get_hw_control(adapter); |
5419 | } | 5453 | } |
5420 | 5454 | ||
5421 | static inline void igb_set_vmolr(struct e1000_hw *hw, int vfn) | ||
5422 | { | ||
5423 | u32 reg_data; | ||
5424 | |||
5425 | reg_data = rd32(E1000_VMOLR(vfn)); | ||
5426 | reg_data |= E1000_VMOLR_BAM | /* Accept broadcast */ | ||
5427 | E1000_VMOLR_ROPE | /* Accept packets matched in UTA */ | ||
5428 | E1000_VMOLR_ROMPE | /* Accept packets matched in MTA */ | ||
5429 | E1000_VMOLR_AUPE | /* Accept untagged packets */ | ||
5430 | E1000_VMOLR_STRVLAN; /* Strip vlan tags */ | ||
5431 | wr32(E1000_VMOLR(vfn), reg_data); | ||
5432 | } | ||
5433 | |||
5434 | static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size, | ||
5435 | int vfn) | ||
5436 | { | ||
5437 | struct e1000_hw *hw = &adapter->hw; | ||
5438 | u32 vmolr; | ||
5439 | |||
5440 | vmolr = rd32(E1000_VMOLR(vfn)); | ||
5441 | vmolr &= ~E1000_VMOLR_RLPML_MASK; | ||
5442 | vmolr |= size | E1000_VMOLR_LPE; | ||
5443 | wr32(E1000_VMOLR(vfn), vmolr); | ||
5444 | |||
5445 | return 0; | ||
5446 | } | ||
5447 | |||
5448 | static inline void igb_set_rah_pool(struct e1000_hw *hw, int pool, int entry) | ||
5449 | { | ||
5450 | u32 reg_data; | ||
5451 | |||
5452 | reg_data = rd32(E1000_RAH(entry)); | ||
5453 | reg_data &= ~E1000_RAH_POOL_MASK; | ||
5454 | reg_data |= E1000_RAH_POOL_1 << pool;; | ||
5455 | wr32(E1000_RAH(entry), reg_data); | ||
5456 | } | ||
5457 | |||
5458 | static void igb_set_mc_list_pools(struct igb_adapter *adapter, | 5455 | static void igb_set_mc_list_pools(struct igb_adapter *adapter, |
5459 | int entry_count, u16 total_rar_filters) | 5456 | int entry_count, u16 total_rar_filters) |
5460 | { | 5457 | { |
diff --git a/drivers/net/igbvf/vf.c b/drivers/net/igbvf/vf.c index 2a4faf9ade69..a9a61efa964c 100644 --- a/drivers/net/igbvf/vf.c +++ b/drivers/net/igbvf/vf.c | |||
@@ -274,6 +274,8 @@ static s32 e1000_set_vfta_vf(struct e1000_hw *hw, u16 vid, bool set) | |||
274 | 274 | ||
275 | err = mbx->ops.read_posted(hw, msgbuf, 2); | 275 | err = mbx->ops.read_posted(hw, msgbuf, 2); |
276 | 276 | ||
277 | msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS; | ||
278 | |||
277 | /* if nacked the vlan was rejected */ | 279 | /* if nacked the vlan was rejected */ |
278 | if (!err && (msgbuf[0] == (E1000_VF_SET_VLAN | E1000_VT_MSGTYPE_NACK))) | 280 | if (!err && (msgbuf[0] == (E1000_VF_SET_VLAN | E1000_VT_MSGTYPE_NACK))) |
279 | err = -E1000_ERR_MAC_INIT; | 281 | err = -E1000_ERR_MAC_INIT; |
@@ -317,6 +319,8 @@ static void e1000_rar_set_vf(struct e1000_hw *hw, u8 * addr, u32 index) | |||
317 | if (!ret_val) | 319 | if (!ret_val) |
318 | ret_val = mbx->ops.read_posted(hw, msgbuf, 3); | 320 | ret_val = mbx->ops.read_posted(hw, msgbuf, 3); |
319 | 321 | ||
322 | msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS; | ||
323 | |||
320 | /* if nacked the address was rejected, use "perm_addr" */ | 324 | /* if nacked the address was rejected, use "perm_addr" */ |
321 | if (!ret_val && | 325 | if (!ret_val && |
322 | (msgbuf[0] == (E1000_VF_SET_MAC_ADDR | E1000_VT_MSGTYPE_NACK))) | 326 | (msgbuf[0] == (E1000_VF_SET_MAC_ADDR | E1000_VT_MSGTYPE_NACK))) |
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index d53aa9582137..20f9bc626688 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/tty.h> | 31 | #include <linux/tty.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
36 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
37 | 36 | ||
diff --git a/drivers/net/isa-skeleton.c b/drivers/net/isa-skeleton.c index 73585fd8f29f..d12377b84358 100644 --- a/drivers/net/isa-skeleton.c +++ b/drivers/net/isa-skeleton.c | |||
@@ -430,7 +430,8 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
430 | * hardware interrupt handler. Queue flow control is | 430 | * hardware interrupt handler. Queue flow control is |
431 | * thus managed under this lock as well. | 431 | * thus managed under this lock as well. |
432 | */ | 432 | */ |
433 | spin_lock_irq(&np->lock); | 433 | unsigned long flags; |
434 | spin_lock_irqsave(&np->lock, flags); | ||
434 | 435 | ||
435 | add_to_tx_ring(np, skb, length); | 436 | add_to_tx_ring(np, skb, length); |
436 | dev->trans_start = jiffies; | 437 | dev->trans_start = jiffies; |
@@ -446,7 +447,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
446 | * is when the transmit statistics are updated. | 447 | * is when the transmit statistics are updated. |
447 | */ | 448 | */ |
448 | 449 | ||
449 | spin_unlock_irq(&np->lock); | 450 | spin_unlock_irqrestore(&np->lock, flags); |
450 | #else | 451 | #else |
451 | /* This is the case for older hardware which takes | 452 | /* This is the case for older hardware which takes |
452 | * a single transmit buffer at a time, and it is | 453 | * a single transmit buffer at a time, and it is |
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index cd22323cfd22..e11d83d5852b 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -96,6 +96,8 @@ | |||
96 | #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0x0000e000 | 96 | #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0x0000e000 |
97 | #define IXGBE_TX_FLAGS_VLAN_SHIFT 16 | 97 | #define IXGBE_TX_FLAGS_VLAN_SHIFT 16 |
98 | 98 | ||
99 | #define IXGBE_MAX_RSC_INT_RATE 162760 | ||
100 | |||
99 | /* wrapper around a pointer to a socket buffer, | 101 | /* wrapper around a pointer to a socket buffer, |
100 | * so a DMA handle can be stored along with the buffer */ | 102 | * so a DMA handle can be stored along with the buffer */ |
101 | struct ixgbe_tx_buffer { | 103 | struct ixgbe_tx_buffer { |
@@ -327,6 +329,7 @@ struct ixgbe_adapter { | |||
327 | #define IXGBE_FLAG_IN_SFP_MOD_TASK (u32)(1 << 25) | 329 | #define IXGBE_FLAG_IN_SFP_MOD_TASK (u32)(1 << 25) |
328 | #define IXGBE_FLAG_FDIR_HASH_CAPABLE (u32)(1 << 26) | 330 | #define IXGBE_FLAG_FDIR_HASH_CAPABLE (u32)(1 << 26) |
329 | #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 27) | 331 | #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 27) |
332 | #define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 28) | ||
330 | #define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 29) | 333 | #define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 29) |
331 | 334 | ||
332 | u32 flags2; | 335 | u32 flags2; |
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index b9923047ce11..522c03bc1dad 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
@@ -50,6 +50,51 @@ static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, | |||
50 | u8 *eeprom_data); | 50 | u8 *eeprom_data); |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * ixgbe_set_pcie_completion_timeout - set pci-e completion timeout | ||
54 | * @hw: pointer to the HW structure | ||
55 | * | ||
56 | * The defaults for 82598 should be in the range of 50us to 50ms, | ||
57 | * however the hardware default for these parts is 500us to 1ms which is less | ||
58 | * than the 10ms recommended by the pci-e spec. To address this we need to | ||
59 | * increase the value to either 10ms to 250ms for capability version 1 config, | ||
60 | * or 16ms to 55ms for version 2. | ||
61 | **/ | ||
62 | void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw) | ||
63 | { | ||
64 | struct ixgbe_adapter *adapter = hw->back; | ||
65 | u32 gcr = IXGBE_READ_REG(hw, IXGBE_GCR); | ||
66 | u16 pcie_devctl2; | ||
67 | |||
68 | /* only take action if timeout value is defaulted to 0 */ | ||
69 | if (gcr & IXGBE_GCR_CMPL_TMOUT_MASK) | ||
70 | goto out; | ||
71 | |||
72 | /* | ||
73 | * if capababilities version is type 1 we can write the | ||
74 | * timeout of 10ms to 250ms through the GCR register | ||
75 | */ | ||
76 | if (!(gcr & IXGBE_GCR_CAP_VER2)) { | ||
77 | gcr |= IXGBE_GCR_CMPL_TMOUT_10ms; | ||
78 | goto out; | ||
79 | } | ||
80 | |||
81 | /* | ||
82 | * for version 2 capabilities we need to write the config space | ||
83 | * directly in order to set the completion timeout value for | ||
84 | * 16ms to 55ms | ||
85 | */ | ||
86 | pci_read_config_word(adapter->pdev, | ||
87 | IXGBE_PCI_DEVICE_CONTROL2, &pcie_devctl2); | ||
88 | pcie_devctl2 |= IXGBE_PCI_DEVICE_CONTROL2_16ms; | ||
89 | pci_write_config_word(adapter->pdev, | ||
90 | IXGBE_PCI_DEVICE_CONTROL2, pcie_devctl2); | ||
91 | out: | ||
92 | /* disable completion timeout resend */ | ||
93 | gcr &= ~IXGBE_GCR_CMPL_TMOUT_RESEND; | ||
94 | IXGBE_WRITE_REG(hw, IXGBE_GCR, gcr); | ||
95 | } | ||
96 | |||
97 | /** | ||
53 | * ixgbe_get_pcie_msix_count_82598 - Gets MSI-X vector count | 98 | * ixgbe_get_pcie_msix_count_82598 - Gets MSI-X vector count |
54 | * @hw: pointer to hardware structure | 99 | * @hw: pointer to hardware structure |
55 | * | 100 | * |
@@ -153,6 +198,26 @@ out: | |||
153 | } | 198 | } |
154 | 199 | ||
155 | /** | 200 | /** |
201 | * ixgbe_start_hw_82598 - Prepare hardware for Tx/Rx | ||
202 | * @hw: pointer to hardware structure | ||
203 | * | ||
204 | * Starts the hardware using the generic start_hw function. | ||
205 | * Then set pcie completion timeout | ||
206 | **/ | ||
207 | s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw) | ||
208 | { | ||
209 | s32 ret_val = 0; | ||
210 | |||
211 | ret_val = ixgbe_start_hw_generic(hw); | ||
212 | |||
213 | /* set the completion timeout for interface */ | ||
214 | if (ret_val == 0) | ||
215 | ixgbe_set_pcie_completion_timeout(hw); | ||
216 | |||
217 | return ret_val; | ||
218 | } | ||
219 | |||
220 | /** | ||
156 | * ixgbe_get_link_capabilities_82598 - Determines link capabilities | 221 | * ixgbe_get_link_capabilities_82598 - Determines link capabilities |
157 | * @hw: pointer to hardware structure | 222 | * @hw: pointer to hardware structure |
158 | * @speed: pointer to link speed | 223 | * @speed: pointer to link speed |
@@ -1085,7 +1150,7 @@ out: | |||
1085 | static struct ixgbe_mac_operations mac_ops_82598 = { | 1150 | static struct ixgbe_mac_operations mac_ops_82598 = { |
1086 | .init_hw = &ixgbe_init_hw_generic, | 1151 | .init_hw = &ixgbe_init_hw_generic, |
1087 | .reset_hw = &ixgbe_reset_hw_82598, | 1152 | .reset_hw = &ixgbe_reset_hw_82598, |
1088 | .start_hw = &ixgbe_start_hw_generic, | 1153 | .start_hw = &ixgbe_start_hw_82598, |
1089 | .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic, | 1154 | .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic, |
1090 | .get_media_type = &ixgbe_get_media_type_82598, | 1155 | .get_media_type = &ixgbe_get_media_type_82598, |
1091 | .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82598, | 1156 | .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82598, |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index d56890f5c9d5..1c7265732900 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -106,8 +106,6 @@ static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) | |||
106 | { | 106 | { |
107 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 107 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
108 | 108 | ||
109 | DPRINTK(DRV, INFO, "Get DCB Admin Mode.\n"); | ||
110 | |||
111 | return !!(adapter->flags & IXGBE_FLAG_DCB_ENABLED); | 109 | return !!(adapter->flags & IXGBE_FLAG_DCB_ENABLED); |
112 | } | 110 | } |
113 | 111 | ||
@@ -116,8 +114,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
116 | u8 err = 0; | 114 | u8 err = 0; |
117 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 115 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
118 | 116 | ||
119 | DPRINTK(DRV, INFO, "Set DCB Admin Mode.\n"); | ||
120 | |||
121 | if (state > 0) { | 117 | if (state > 0) { |
122 | /* Turn on DCB */ | 118 | /* Turn on DCB */ |
123 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) | 119 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) |
@@ -138,7 +134,23 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
138 | adapter->hw.fc.requested_mode = ixgbe_fc_none; | 134 | adapter->hw.fc.requested_mode = ixgbe_fc_none; |
139 | } | 135 | } |
140 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; | 136 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; |
137 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | ||
138 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
139 | adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | ||
140 | } | ||
141 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | 141 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; |
142 | #ifdef IXGBE_FCOE | ||
143 | /* Turn on FCoE offload */ | ||
144 | if ((adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) && | ||
145 | (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))) { | ||
146 | adapter->flags |= IXGBE_FLAG_FCOE_ENABLED; | ||
147 | adapter->ring_feature[RING_F_FCOE].indices = | ||
148 | IXGBE_FCRETA_SIZE; | ||
149 | netdev->features |= NETIF_F_FCOE_CRC; | ||
150 | netdev->features |= NETIF_F_FSO; | ||
151 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; | ||
152 | } | ||
153 | #endif /* IXGBE_FCOE */ | ||
142 | ixgbe_init_interrupt_scheme(adapter); | 154 | ixgbe_init_interrupt_scheme(adapter); |
143 | if (netif_running(netdev)) | 155 | if (netif_running(netdev)) |
144 | netdev->netdev_ops->ndo_open(netdev); | 156 | netdev->netdev_ops->ndo_open(netdev); |
@@ -154,6 +166,20 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
154 | adapter->dcb_cfg.pfc_mode_enable = false; | 166 | adapter->dcb_cfg.pfc_mode_enable = false; |
155 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; | 167 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; |
156 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; | 168 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; |
169 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) | ||
170 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
171 | |||
172 | #ifdef IXGBE_FCOE | ||
173 | /* Turn off FCoE offload */ | ||
174 | if (adapter->flags & (IXGBE_FLAG_FCOE_CAPABLE | | ||
175 | IXGBE_FLAG_FCOE_ENABLED)) { | ||
176 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; | ||
177 | adapter->ring_feature[RING_F_FCOE].indices = 0; | ||
178 | netdev->features &= ~NETIF_F_FCOE_CRC; | ||
179 | netdev->features &= ~NETIF_F_FSO; | ||
180 | netdev->fcoe_ddp_xid = 0; | ||
181 | } | ||
182 | #endif /* IXGBE_FCOE */ | ||
157 | ixgbe_init_interrupt_scheme(adapter); | 183 | ixgbe_init_interrupt_scheme(adapter); |
158 | if (netif_running(netdev)) | 184 | if (netif_running(netdev)) |
159 | netdev->netdev_ops->ndo_open(netdev); | 185 | netdev->netdev_ops->ndo_open(netdev); |
@@ -169,6 +195,8 @@ static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev, | |||
169 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 195 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
170 | int i, j; | 196 | int i, j; |
171 | 197 | ||
198 | memset(perm_addr, 0xff, MAX_ADDR_LEN); | ||
199 | |||
172 | for (i = 0; i < netdev->addr_len; i++) | 200 | for (i = 0; i < netdev->addr_len; i++) |
173 | perm_addr[i] = adapter->hw.mac.perm_addr[i]; | 201 | perm_addr[i] = adapter->hw.mac.perm_addr[i]; |
174 | 202 | ||
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 0f7b6a3a2e68..79144e950a34 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1830,7 +1830,6 @@ static int ixgbe_wol_exclusion(struct ixgbe_adapter *adapter, | |||
1830 | break; | 1830 | break; |
1831 | default: | 1831 | default: |
1832 | wol->supported = 0; | 1832 | wol->supported = 0; |
1833 | retval = 0; | ||
1834 | } | 1833 | } |
1835 | 1834 | ||
1836 | return retval; | 1835 | return retval; |
@@ -1976,7 +1975,10 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
1976 | * any other value means disable eitr, which is best | 1975 | * any other value means disable eitr, which is best |
1977 | * served by setting the interrupt rate very high | 1976 | * served by setting the interrupt rate very high |
1978 | */ | 1977 | */ |
1979 | adapter->eitr_param = IXGBE_MAX_INT_RATE; | 1978 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) |
1979 | adapter->eitr_param = IXGBE_MAX_RSC_INT_RATE; | ||
1980 | else | ||
1981 | adapter->eitr_param = IXGBE_MAX_INT_RATE; | ||
1980 | adapter->itr_setting = 0; | 1982 | adapter->itr_setting = 0; |
1981 | } | 1983 | } |
1982 | 1984 | ||
@@ -2000,13 +2002,13 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data) | |||
2000 | 2002 | ||
2001 | ethtool_op_set_flags(netdev, data); | 2003 | ethtool_op_set_flags(netdev, data); |
2002 | 2004 | ||
2003 | if (!(adapter->flags & IXGBE_FLAG2_RSC_CAPABLE)) | 2005 | if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) |
2004 | return 0; | 2006 | return 0; |
2005 | 2007 | ||
2006 | /* if state changes we need to update adapter->flags and reset */ | 2008 | /* if state changes we need to update adapter->flags and reset */ |
2007 | if ((!!(data & ETH_FLAG_LRO)) != | 2009 | if ((!!(data & ETH_FLAG_LRO)) != |
2008 | (!!(adapter->flags & IXGBE_FLAG2_RSC_ENABLED))) { | 2010 | (!!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))) { |
2009 | adapter->flags ^= IXGBE_FLAG2_RSC_ENABLED; | 2011 | adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED; |
2010 | if (netif_running(netdev)) | 2012 | if (netif_running(netdev)) |
2011 | ixgbe_reinit_locked(adapter); | 2013 | ixgbe_reinit_locked(adapter); |
2012 | else | 2014 | else |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 5588ef493a3d..110c65ab5cb5 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/in.h> | 34 | #include <linux/in.h> |
35 | #include <linux/ip.h> | 35 | #include <linux/ip.h> |
36 | #include <linux/tcp.h> | 36 | #include <linux/tcp.h> |
37 | #include <linux/pkt_sched.h> | ||
37 | #include <linux/ipv6.h> | 38 | #include <linux/ipv6.h> |
38 | #include <net/checksum.h> | 39 | #include <net/checksum.h> |
39 | #include <net/ip6_checksum.h> | 40 | #include <net/ip6_checksum.h> |
@@ -510,8 +511,11 @@ static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector, | |||
510 | * @skb: skb currently being received and modified | 511 | * @skb: skb currently being received and modified |
511 | **/ | 512 | **/ |
512 | static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter, | 513 | static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter, |
513 | u32 status_err, struct sk_buff *skb) | 514 | union ixgbe_adv_rx_desc *rx_desc, |
515 | struct sk_buff *skb) | ||
514 | { | 516 | { |
517 | u32 status_err = le32_to_cpu(rx_desc->wb.upper.status_error); | ||
518 | |||
515 | skb->ip_summed = CHECKSUM_NONE; | 519 | skb->ip_summed = CHECKSUM_NONE; |
516 | 520 | ||
517 | /* Rx csum disabled */ | 521 | /* Rx csum disabled */ |
@@ -529,6 +533,16 @@ static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter, | |||
529 | return; | 533 | return; |
530 | 534 | ||
531 | if (status_err & IXGBE_RXDADV_ERR_TCPE) { | 535 | if (status_err & IXGBE_RXDADV_ERR_TCPE) { |
536 | u16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; | ||
537 | |||
538 | /* | ||
539 | * 82599 errata, UDP frames with a 0 checksum can be marked as | ||
540 | * checksum errors. | ||
541 | */ | ||
542 | if ((pkt_info & IXGBE_RXDADV_PKTTYPE_UDP) && | ||
543 | (adapter->hw.mac.type == ixgbe_mac_82599EB)) | ||
544 | return; | ||
545 | |||
532 | adapter->hw_csum_rx_error++; | 546 | adapter->hw_csum_rx_error++; |
533 | return; | 547 | return; |
534 | } | 548 | } |
@@ -766,7 +780,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
766 | prefetch(next_rxd); | 780 | prefetch(next_rxd); |
767 | cleaned_count++; | 781 | cleaned_count++; |
768 | 782 | ||
769 | if (adapter->flags & IXGBE_FLAG2_RSC_CAPABLE) | 783 | if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) |
770 | rsc_count = ixgbe_get_rsc_count(rx_desc); | 784 | rsc_count = ixgbe_get_rsc_count(rx_desc); |
771 | 785 | ||
772 | if (rsc_count) { | 786 | if (rsc_count) { |
@@ -802,7 +816,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
802 | goto next_desc; | 816 | goto next_desc; |
803 | } | 817 | } |
804 | 818 | ||
805 | ixgbe_rx_checksum(adapter, staterr, skb); | 819 | ixgbe_rx_checksum(adapter, rx_desc, skb); |
806 | 820 | ||
807 | /* probably a little skewed due to removing CRC */ | 821 | /* probably a little skewed due to removing CRC */ |
808 | total_rx_bytes += skb->len; | 822 | total_rx_bytes += skb->len; |
@@ -2022,7 +2036,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2022 | IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(0), psrtype); | 2036 | IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(0), psrtype); |
2023 | } | 2037 | } |
2024 | } else { | 2038 | } else { |
2025 | if (!(adapter->flags & IXGBE_FLAG2_RSC_ENABLED) && | 2039 | if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) && |
2026 | (netdev->mtu <= ETH_DATA_LEN)) | 2040 | (netdev->mtu <= ETH_DATA_LEN)) |
2027 | rx_buf_len = MAXIMUM_ETHERNET_VLAN_SIZE; | 2041 | rx_buf_len = MAXIMUM_ETHERNET_VLAN_SIZE; |
2028 | else | 2042 | else |
@@ -2151,7 +2165,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2151 | IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl); | 2165 | IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl); |
2152 | } | 2166 | } |
2153 | 2167 | ||
2154 | if (adapter->flags & IXGBE_FLAG2_RSC_ENABLED) { | 2168 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { |
2155 | /* Enable 82599 HW-RSC */ | 2169 | /* Enable 82599 HW-RSC */ |
2156 | for (i = 0; i < adapter->num_rx_queues; i++) { | 2170 | for (i = 0; i < adapter->num_rx_queues; i++) { |
2157 | j = adapter->rx_ring[i].reg_idx; | 2171 | j = adapter->rx_ring[i].reg_idx; |
@@ -2697,19 +2711,23 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
2697 | 2711 | ||
2698 | /* | 2712 | /* |
2699 | * For hot-pluggable SFP+ devices, a new SFP+ module may have | 2713 | * For hot-pluggable SFP+ devices, a new SFP+ module may have |
2700 | * arrived before interrupts were enabled. We need to kick off | 2714 | * arrived before interrupts were enabled but after probe. Such |
2701 | * the SFP+ module setup first, then try to bring up link. | 2715 | * devices wouldn't have their type identified yet. We need to |
2716 | * kick off the SFP+ module setup first, then try to bring up link. | ||
2702 | * If we're not hot-pluggable SFP+, we just need to configure link | 2717 | * If we're not hot-pluggable SFP+, we just need to configure link |
2703 | * and bring it up. | 2718 | * and bring it up. |
2704 | */ | 2719 | */ |
2705 | err = hw->phy.ops.identify(hw); | 2720 | if (hw->phy.type == ixgbe_phy_unknown) { |
2706 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 2721 | err = hw->phy.ops.identify(hw); |
2707 | dev_err(&adapter->pdev->dev, "failed to initialize because " | 2722 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
2708 | "an unsupported SFP+ module type was detected.\n" | 2723 | /* |
2709 | "Reload the driver after installing a supported " | 2724 | * Take the device down and schedule the sfp tasklet |
2710 | "module.\n"); | 2725 | * which will unregister_netdev and log it. |
2711 | ixgbe_down(adapter); | 2726 | */ |
2712 | return err; | 2727 | ixgbe_down(adapter); |
2728 | schedule_work(&adapter->sfp_config_module_task); | ||
2729 | return err; | ||
2730 | } | ||
2713 | } | 2731 | } |
2714 | 2732 | ||
2715 | if (ixgbe_is_sfp(hw)) { | 2733 | if (ixgbe_is_sfp(hw)) { |
@@ -3126,7 +3144,11 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter) | |||
3126 | #endif | 3144 | #endif |
3127 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3145 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3128 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); | 3146 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); |
3129 | ixgbe_set_rss_queues(adapter); | 3147 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3148 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3149 | ixgbe_set_fdir_queues(adapter); | ||
3150 | else | ||
3151 | ixgbe_set_rss_queues(adapter); | ||
3130 | } | 3152 | } |
3131 | /* adding FCoE rx rings to the end */ | 3153 | /* adding FCoE rx rings to the end */ |
3132 | f->mask = adapter->num_rx_queues; | 3154 | f->mask = adapter->num_rx_queues; |
@@ -3384,7 +3406,12 @@ static inline bool ixgbe_cache_ring_fcoe(struct ixgbe_adapter *adapter) | |||
3384 | } | 3406 | } |
3385 | #endif /* CONFIG_IXGBE_DCB */ | 3407 | #endif /* CONFIG_IXGBE_DCB */ |
3386 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3408 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3387 | ixgbe_cache_ring_rss(adapter); | 3409 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3410 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3411 | ixgbe_cache_ring_fdir(adapter); | ||
3412 | else | ||
3413 | ixgbe_cache_ring_rss(adapter); | ||
3414 | |||
3388 | fcoe_i = f->mask; | 3415 | fcoe_i = f->mask; |
3389 | } | 3416 | } |
3390 | for (i = 0; i < f->indices; i++, fcoe_i++) | 3417 | for (i = 0; i < f->indices; i++, fcoe_i++) |
@@ -3724,7 +3751,7 @@ static void ixgbe_sfp_task(struct work_struct *work) | |||
3724 | if ((hw->phy.type == ixgbe_phy_nl) && | 3751 | if ((hw->phy.type == ixgbe_phy_nl) && |
3725 | (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { | 3752 | (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { |
3726 | s32 ret = hw->phy.ops.identify_sfp(hw); | 3753 | s32 ret = hw->phy.ops.identify_sfp(hw); |
3727 | if (ret) | 3754 | if (ret == IXGBE_ERR_SFP_NOT_PRESENT) |
3728 | goto reschedule; | 3755 | goto reschedule; |
3729 | ret = hw->phy.ops.reset(hw); | 3756 | ret = hw->phy.ops.reset(hw); |
3730 | if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 3757 | if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
@@ -3785,16 +3812,17 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
3785 | adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82598; | 3812 | adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82598; |
3786 | } else if (hw->mac.type == ixgbe_mac_82599EB) { | 3813 | } else if (hw->mac.type == ixgbe_mac_82599EB) { |
3787 | adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599; | 3814 | adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599; |
3788 | adapter->flags |= IXGBE_FLAG2_RSC_CAPABLE; | 3815 | adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE; |
3789 | adapter->flags |= IXGBE_FLAG2_RSC_ENABLED; | 3816 | adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; |
3790 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; | 3817 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; |
3791 | adapter->ring_feature[RING_F_FDIR].indices = | 3818 | adapter->ring_feature[RING_F_FDIR].indices = |
3792 | IXGBE_MAX_FDIR_INDICES; | 3819 | IXGBE_MAX_FDIR_INDICES; |
3793 | adapter->atr_sample_rate = 20; | 3820 | adapter->atr_sample_rate = 20; |
3794 | adapter->fdir_pballoc = 0; | 3821 | adapter->fdir_pballoc = 0; |
3795 | #ifdef IXGBE_FCOE | 3822 | #ifdef IXGBE_FCOE |
3796 | adapter->flags |= IXGBE_FLAG_FCOE_ENABLED; | 3823 | adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE; |
3797 | adapter->ring_feature[RING_F_FCOE].indices = IXGBE_FCRETA_SIZE; | 3824 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; |
3825 | adapter->ring_feature[RING_F_FCOE].indices = 0; | ||
3798 | #endif /* IXGBE_FCOE */ | 3826 | #endif /* IXGBE_FCOE */ |
3799 | } | 3827 | } |
3800 | 3828 | ||
@@ -4534,13 +4562,17 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work) | |||
4534 | u32 err; | 4562 | u32 err; |
4535 | 4563 | ||
4536 | adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; | 4564 | adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; |
4565 | |||
4566 | /* Time for electrical oscillations to settle down */ | ||
4567 | msleep(100); | ||
4537 | err = hw->phy.ops.identify_sfp(hw); | 4568 | err = hw->phy.ops.identify_sfp(hw); |
4569 | |||
4538 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 4570 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
4539 | dev_err(&adapter->pdev->dev, "failed to initialize because " | 4571 | dev_err(&adapter->pdev->dev, "failed to initialize because " |
4540 | "an unsupported SFP+ module type was detected.\n" | 4572 | "an unsupported SFP+ module type was detected.\n" |
4541 | "Reload the driver after installing a supported " | 4573 | "Reload the driver after installing a supported " |
4542 | "module.\n"); | 4574 | "module.\n"); |
4543 | ixgbe_down(adapter); | 4575 | unregister_netdev(adapter->netdev); |
4544 | return; | 4576 | return; |
4545 | } | 4577 | } |
4546 | hw->mac.ops.setup_sfp(hw); | 4578 | hw->mac.ops.setup_sfp(hw); |
@@ -5108,9 +5140,6 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
5108 | int count = 0; | 5140 | int count = 0; |
5109 | unsigned int f; | 5141 | unsigned int f; |
5110 | 5142 | ||
5111 | r_idx = skb->queue_mapping; | ||
5112 | tx_ring = &adapter->tx_ring[r_idx]; | ||
5113 | |||
5114 | if (adapter->vlgrp && vlan_tx_tag_present(skb)) { | 5143 | if (adapter->vlgrp && vlan_tx_tag_present(skb)) { |
5115 | tx_flags |= vlan_tx_tag_get(skb); | 5144 | tx_flags |= vlan_tx_tag_get(skb); |
5116 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 5145 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
@@ -5120,11 +5149,19 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
5120 | tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT; | 5149 | tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT; |
5121 | tx_flags |= IXGBE_TX_FLAGS_VLAN; | 5150 | tx_flags |= IXGBE_TX_FLAGS_VLAN; |
5122 | } else if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 5151 | } else if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
5123 | tx_flags |= (skb->queue_mapping << 13); | 5152 | if (skb->priority != TC_PRIO_CONTROL) { |
5124 | tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT; | 5153 | tx_flags |= (skb->queue_mapping << 13); |
5125 | tx_flags |= IXGBE_TX_FLAGS_VLAN; | 5154 | tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT; |
5155 | tx_flags |= IXGBE_TX_FLAGS_VLAN; | ||
5156 | } else { | ||
5157 | skb->queue_mapping = | ||
5158 | adapter->ring_feature[RING_F_DCB].indices-1; | ||
5159 | } | ||
5126 | } | 5160 | } |
5127 | 5161 | ||
5162 | r_idx = skb->queue_mapping; | ||
5163 | tx_ring = &adapter->tx_ring[r_idx]; | ||
5164 | |||
5128 | if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && | 5165 | if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && |
5129 | (skb->protocol == htons(ETH_P_FCOE))) | 5166 | (skb->protocol == htons(ETH_P_FCOE))) |
5130 | tx_flags |= IXGBE_TX_FLAGS_FCOE; | 5167 | tx_flags |= IXGBE_TX_FLAGS_FCOE; |
@@ -5323,12 +5360,19 @@ static int ixgbe_del_sanmac_netdev(struct net_device *dev) | |||
5323 | static void ixgbe_netpoll(struct net_device *netdev) | 5360 | static void ixgbe_netpoll(struct net_device *netdev) |
5324 | { | 5361 | { |
5325 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 5362 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
5363 | int i; | ||
5326 | 5364 | ||
5327 | disable_irq(adapter->pdev->irq); | ||
5328 | adapter->flags |= IXGBE_FLAG_IN_NETPOLL; | 5365 | adapter->flags |= IXGBE_FLAG_IN_NETPOLL; |
5329 | ixgbe_intr(adapter->pdev->irq, netdev); | 5366 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { |
5367 | int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; | ||
5368 | for (i = 0; i < num_q_vectors; i++) { | ||
5369 | struct ixgbe_q_vector *q_vector = adapter->q_vector[i]; | ||
5370 | ixgbe_msix_clean_many(0, q_vector); | ||
5371 | } | ||
5372 | } else { | ||
5373 | ixgbe_intr(adapter->pdev->irq, netdev); | ||
5374 | } | ||
5330 | adapter->flags &= ~IXGBE_FLAG_IN_NETPOLL; | 5375 | adapter->flags &= ~IXGBE_FLAG_IN_NETPOLL; |
5331 | enable_irq(adapter->pdev->irq); | ||
5332 | } | 5376 | } |
5333 | #endif | 5377 | #endif |
5334 | 5378 | ||
@@ -5563,29 +5607,18 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
5563 | #endif | 5607 | #endif |
5564 | 5608 | ||
5565 | #ifdef IXGBE_FCOE | 5609 | #ifdef IXGBE_FCOE |
5566 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { | 5610 | if (adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) { |
5567 | if (hw->mac.ops.get_device_caps) { | 5611 | if (hw->mac.ops.get_device_caps) { |
5568 | hw->mac.ops.get_device_caps(hw, &device_caps); | 5612 | hw->mac.ops.get_device_caps(hw, &device_caps); |
5569 | if (!(device_caps & IXGBE_DEVICE_CAPS_FCOE_OFFLOADS)) { | 5613 | if (device_caps & IXGBE_DEVICE_CAPS_FCOE_OFFLOADS) |
5570 | netdev->features |= NETIF_F_FCOE_CRC; | 5614 | adapter->flags &= ~IXGBE_FLAG_FCOE_CAPABLE; |
5571 | netdev->features |= NETIF_F_FSO; | ||
5572 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; | ||
5573 | DPRINTK(DRV, INFO, "FCoE enabled, " | ||
5574 | "disabling Flow Director\n"); | ||
5575 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
5576 | adapter->flags &= | ||
5577 | ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | ||
5578 | adapter->atr_sample_rate = 0; | ||
5579 | } else { | ||
5580 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; | ||
5581 | } | ||
5582 | } | 5615 | } |
5583 | } | 5616 | } |
5584 | #endif /* IXGBE_FCOE */ | 5617 | #endif /* IXGBE_FCOE */ |
5585 | if (pci_using_dac) | 5618 | if (pci_using_dac) |
5586 | netdev->features |= NETIF_F_HIGHDMA; | 5619 | netdev->features |= NETIF_F_HIGHDMA; |
5587 | 5620 | ||
5588 | if (adapter->flags & IXGBE_FLAG2_RSC_ENABLED) | 5621 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) |
5589 | netdev->features |= NETIF_F_LRO; | 5622 | netdev->features |= NETIF_F_LRO; |
5590 | 5623 | ||
5591 | /* make sure the EEPROM is good */ | 5624 | /* make sure the EEPROM is good */ |
@@ -5627,7 +5660,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
5627 | adapter->wol = 0; | 5660 | adapter->wol = 0; |
5628 | break; | 5661 | break; |
5629 | } | 5662 | } |
5630 | device_init_wakeup(&adapter->pdev->dev, true); | ||
5631 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | 5663 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); |
5632 | 5664 | ||
5633 | /* pick up the PCI bus settings for reporting later */ | 5665 | /* pick up the PCI bus settings for reporting later */ |
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c index 453e966762f0..9ecad17522c3 100644 --- a/drivers/net/ixgbe/ixgbe_phy.c +++ b/drivers/net/ixgbe/ixgbe_phy.c | |||
@@ -60,6 +60,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw) | |||
60 | 60 | ||
61 | if (hw->phy.type == ixgbe_phy_unknown) { | 61 | if (hw->phy.type == ixgbe_phy_unknown) { |
62 | for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) { | 62 | for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) { |
63 | hw->phy.mdio.prtad = phy_addr; | ||
63 | if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) { | 64 | if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) { |
64 | ixgbe_get_phy_id(hw); | 65 | ixgbe_get_phy_id(hw); |
65 | hw->phy.type = | 66 | hw->phy.type = |
@@ -68,6 +69,8 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw) | |||
68 | break; | 69 | break; |
69 | } | 70 | } |
70 | } | 71 | } |
72 | /* clear value if nothing found */ | ||
73 | hw->phy.mdio.prtad = 0; | ||
71 | } else { | 74 | } else { |
72 | status = 0; | 75 | status = 0; |
73 | } | 76 | } |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index fa87309dc087..be90eb4575f6 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -718,6 +718,12 @@ | |||
718 | #define IXGBE_ECC_STATUS_82599 0x110E0 | 718 | #define IXGBE_ECC_STATUS_82599 0x110E0 |
719 | #define IXGBE_BAR_CTRL_82599 0x110F4 | 719 | #define IXGBE_BAR_CTRL_82599 0x110F4 |
720 | 720 | ||
721 | /* PCI Express Control */ | ||
722 | #define IXGBE_GCR_CMPL_TMOUT_MASK 0x0000F000 | ||
723 | #define IXGBE_GCR_CMPL_TMOUT_10ms 0x00001000 | ||
724 | #define IXGBE_GCR_CMPL_TMOUT_RESEND 0x00010000 | ||
725 | #define IXGBE_GCR_CAP_VER2 0x00040000 | ||
726 | |||
721 | /* Time Sync Registers */ | 727 | /* Time Sync Registers */ |
722 | #define IXGBE_TSYNCRXCTL 0x05188 /* Rx Time Sync Control register - RW */ | 728 | #define IXGBE_TSYNCRXCTL 0x05188 /* Rx Time Sync Control register - RW */ |
723 | #define IXGBE_TSYNCTXCTL 0x08C00 /* Tx Time Sync Control register - RW */ | 729 | #define IXGBE_TSYNCTXCTL 0x08C00 /* Tx Time Sync Control register - RW */ |
@@ -1521,6 +1527,7 @@ | |||
1521 | 1527 | ||
1522 | /* PCI Bus Info */ | 1528 | /* PCI Bus Info */ |
1523 | #define IXGBE_PCI_LINK_STATUS 0xB2 | 1529 | #define IXGBE_PCI_LINK_STATUS 0xB2 |
1530 | #define IXGBE_PCI_DEVICE_CONTROL2 0xC8 | ||
1524 | #define IXGBE_PCI_LINK_WIDTH 0x3F0 | 1531 | #define IXGBE_PCI_LINK_WIDTH 0x3F0 |
1525 | #define IXGBE_PCI_LINK_WIDTH_1 0x10 | 1532 | #define IXGBE_PCI_LINK_WIDTH_1 0x10 |
1526 | #define IXGBE_PCI_LINK_WIDTH_2 0x20 | 1533 | #define IXGBE_PCI_LINK_WIDTH_2 0x20 |
@@ -1531,6 +1538,7 @@ | |||
1531 | #define IXGBE_PCI_LINK_SPEED_5000 0x2 | 1538 | #define IXGBE_PCI_LINK_SPEED_5000 0x2 |
1532 | #define IXGBE_PCI_HEADER_TYPE_REGISTER 0x0E | 1539 | #define IXGBE_PCI_HEADER_TYPE_REGISTER 0x0E |
1533 | #define IXGBE_PCI_HEADER_TYPE_MULTIFUNC 0x80 | 1540 | #define IXGBE_PCI_HEADER_TYPE_MULTIFUNC 0x80 |
1541 | #define IXGBE_PCI_DEVICE_CONTROL2_16ms 0x0005 | ||
1534 | 1542 | ||
1535 | /* Number of 100 microseconds we wait for PCI Express master disable */ | 1543 | /* Number of 100 microseconds we wait for PCI Express master disable */ |
1536 | #define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800 | 1544 | #define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800 |
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index d12106b47bf2..2f286091394d 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c | |||
@@ -229,6 +229,7 @@ static int __init jazz_sonic_probe(struct platform_device *pdev) | |||
229 | lp = netdev_priv(dev); | 229 | lp = netdev_priv(dev); |
230 | lp->device = &pdev->dev; | 230 | lp->device = &pdev->dev; |
231 | SET_NETDEV_DEV(dev, &pdev->dev); | 231 | SET_NETDEV_DEV(dev, &pdev->dev); |
232 | platform_set_drvdata(pdev, dev); | ||
232 | 233 | ||
233 | netdev_boot_setup_check(dev); | 234 | netdev_boot_setup_check(dev); |
234 | 235 | ||
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c new file mode 100644 index 000000000000..9a1dea60c1c4 --- /dev/null +++ b/drivers/net/ks8851.c | |||
@@ -0,0 +1,1322 @@ | |||
1 | /* drivers/net/ks8651.c | ||
2 | * | ||
3 | * Copyright 2009 Simtec Electronics | ||
4 | * http://www.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #define DEBUG | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/netdevice.h> | ||
17 | #include <linux/etherdevice.h> | ||
18 | #include <linux/ethtool.h> | ||
19 | #include <linux/cache.h> | ||
20 | #include <linux/crc32.h> | ||
21 | #include <linux/mii.h> | ||
22 | |||
23 | #include <linux/spi/spi.h> | ||
24 | |||
25 | #include "ks8851.h" | ||
26 | |||
27 | /** | ||
28 | * struct ks8851_rxctrl - KS8851 driver rx control | ||
29 | * @mchash: Multicast hash-table data. | ||
30 | * @rxcr1: KS_RXCR1 register setting | ||
31 | * @rxcr2: KS_RXCR2 register setting | ||
32 | * | ||
33 | * Representation of the settings needs to control the receive filtering | ||
34 | * such as the multicast hash-filter and the receive register settings. This | ||
35 | * is used to make the job of working out if the receive settings change and | ||
36 | * then issuing the new settings to the worker that will send the necessary | ||
37 | * commands. | ||
38 | */ | ||
39 | struct ks8851_rxctrl { | ||
40 | u16 mchash[4]; | ||
41 | u16 rxcr1; | ||
42 | u16 rxcr2; | ||
43 | }; | ||
44 | |||
45 | /** | ||
46 | * union ks8851_tx_hdr - tx header data | ||
47 | * @txb: The header as bytes | ||
48 | * @txw: The header as 16bit, little-endian words | ||
49 | * | ||
50 | * A dual representation of the tx header data to allow | ||
51 | * access to individual bytes, and to allow 16bit accesses | ||
52 | * with 16bit alignment. | ||
53 | */ | ||
54 | union ks8851_tx_hdr { | ||
55 | u8 txb[6]; | ||
56 | __le16 txw[3]; | ||
57 | }; | ||
58 | |||
59 | /** | ||
60 | * struct ks8851_net - KS8851 driver private data | ||
61 | * @netdev: The network device we're bound to | ||
62 | * @spidev: The spi device we're bound to. | ||
63 | * @lock: Lock to ensure that the device is not accessed when busy. | ||
64 | * @statelock: Lock on this structure for tx list. | ||
65 | * @mii: The MII state information for the mii calls. | ||
66 | * @rxctrl: RX settings for @rxctrl_work. | ||
67 | * @tx_work: Work queue for tx packets | ||
68 | * @irq_work: Work queue for servicing interrupts | ||
69 | * @rxctrl_work: Work queue for updating RX mode and multicast lists | ||
70 | * @txq: Queue of packets for transmission. | ||
71 | * @spi_msg1: pre-setup SPI transfer with one message, @spi_xfer1. | ||
72 | * @spi_msg2: pre-setup SPI transfer with two messages, @spi_xfer2. | ||
73 | * @txh: Space for generating packet TX header in DMA-able data | ||
74 | * @rxd: Space for receiving SPI data, in DMA-able space. | ||
75 | * @txd: Space for transmitting SPI data, in DMA-able space. | ||
76 | * @msg_enable: The message flags controlling driver output (see ethtool). | ||
77 | * @fid: Incrementing frame id tag. | ||
78 | * @rc_ier: Cached copy of KS_IER. | ||
79 | * @rc_rxqcr: Cached copy of KS_RXQCR. | ||
80 | * | ||
81 | * The @lock ensures that the chip is protected when certain operations are | ||
82 | * in progress. When the read or write packet transfer is in progress, most | ||
83 | * of the chip registers are not ccessible until the transfer is finished and | ||
84 | * the DMA has been de-asserted. | ||
85 | * | ||
86 | * The @statelock is used to protect information in the structure which may | ||
87 | * need to be accessed via several sources, such as the network driver layer | ||
88 | * or one of the work queues. | ||
89 | * | ||
90 | * We align the buffers we may use for rx/tx to ensure that if the SPI driver | ||
91 | * wants to DMA map them, it will not have any problems with data the driver | ||
92 | * modifies. | ||
93 | */ | ||
94 | struct ks8851_net { | ||
95 | struct net_device *netdev; | ||
96 | struct spi_device *spidev; | ||
97 | struct mutex lock; | ||
98 | spinlock_t statelock; | ||
99 | |||
100 | union ks8851_tx_hdr txh ____cacheline_aligned; | ||
101 | u8 rxd[8]; | ||
102 | u8 txd[8]; | ||
103 | |||
104 | u32 msg_enable ____cacheline_aligned; | ||
105 | u16 tx_space; | ||
106 | u8 fid; | ||
107 | |||
108 | u16 rc_ier; | ||
109 | u16 rc_rxqcr; | ||
110 | |||
111 | struct mii_if_info mii; | ||
112 | struct ks8851_rxctrl rxctrl; | ||
113 | |||
114 | struct work_struct tx_work; | ||
115 | struct work_struct irq_work; | ||
116 | struct work_struct rxctrl_work; | ||
117 | |||
118 | struct sk_buff_head txq; | ||
119 | |||
120 | struct spi_message spi_msg1; | ||
121 | struct spi_message spi_msg2; | ||
122 | struct spi_transfer spi_xfer1; | ||
123 | struct spi_transfer spi_xfer2[2]; | ||
124 | }; | ||
125 | |||
126 | static int msg_enable; | ||
127 | |||
128 | #define ks_info(_ks, _msg...) dev_info(&(_ks)->spidev->dev, _msg) | ||
129 | #define ks_warn(_ks, _msg...) dev_warn(&(_ks)->spidev->dev, _msg) | ||
130 | #define ks_dbg(_ks, _msg...) dev_dbg(&(_ks)->spidev->dev, _msg) | ||
131 | #define ks_err(_ks, _msg...) dev_err(&(_ks)->spidev->dev, _msg) | ||
132 | |||
133 | /* shift for byte-enable data */ | ||
134 | #define BYTE_EN(_x) ((_x) << 2) | ||
135 | |||
136 | /* turn register number and byte-enable mask into data for start of packet */ | ||
137 | #define MK_OP(_byteen, _reg) (BYTE_EN(_byteen) | (_reg) << (8+2) | (_reg) >> 6) | ||
138 | |||
139 | /* SPI register read/write calls. | ||
140 | * | ||
141 | * All these calls issue SPI transactions to access the chip's registers. They | ||
142 | * all require that the necessary lock is held to prevent accesses when the | ||
143 | * chip is busy transfering packet data (RX/TX FIFO accesses). | ||
144 | */ | ||
145 | |||
146 | /** | ||
147 | * ks8851_wrreg16 - write 16bit register value to chip | ||
148 | * @ks: The chip state | ||
149 | * @reg: The register address | ||
150 | * @val: The value to write | ||
151 | * | ||
152 | * Issue a write to put the value @val into the register specified in @reg. | ||
153 | */ | ||
154 | static void ks8851_wrreg16(struct ks8851_net *ks, unsigned reg, unsigned val) | ||
155 | { | ||
156 | struct spi_transfer *xfer = &ks->spi_xfer1; | ||
157 | struct spi_message *msg = &ks->spi_msg1; | ||
158 | __le16 txb[2]; | ||
159 | int ret; | ||
160 | |||
161 | txb[0] = cpu_to_le16(MK_OP(reg & 2 ? 0xC : 0x03, reg) | KS_SPIOP_WR); | ||
162 | txb[1] = cpu_to_le16(val); | ||
163 | |||
164 | xfer->tx_buf = txb; | ||
165 | xfer->rx_buf = NULL; | ||
166 | xfer->len = 4; | ||
167 | |||
168 | ret = spi_sync(ks->spidev, msg); | ||
169 | if (ret < 0) | ||
170 | ks_err(ks, "spi_sync() failed\n"); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * ks8851_rx_1msg - select whether to use one or two messages for spi read | ||
175 | * @ks: The device structure | ||
176 | * | ||
177 | * Return whether to generate a single message with a tx and rx buffer | ||
178 | * supplied to spi_sync(), or alternatively send the tx and rx buffers | ||
179 | * as separate messages. | ||
180 | * | ||
181 | * Depending on the hardware in use, a single message may be more efficient | ||
182 | * on interrupts or work done by the driver. | ||
183 | * | ||
184 | * This currently always returns true until we add some per-device data passed | ||
185 | * from the platform code to specify which mode is better. | ||
186 | */ | ||
187 | static inline bool ks8851_rx_1msg(struct ks8851_net *ks) | ||
188 | { | ||
189 | return true; | ||
190 | } | ||
191 | |||
192 | /** | ||
193 | * ks8851_rdreg - issue read register command and return the data | ||
194 | * @ks: The device state | ||
195 | * @op: The register address and byte enables in message format. | ||
196 | * @rxb: The RX buffer to return the result into | ||
197 | * @rxl: The length of data expected. | ||
198 | * | ||
199 | * This is the low level read call that issues the necessary spi message(s) | ||
200 | * to read data from the register specified in @op. | ||
201 | */ | ||
202 | static void ks8851_rdreg(struct ks8851_net *ks, unsigned op, | ||
203 | u8 *rxb, unsigned rxl) | ||
204 | { | ||
205 | struct spi_transfer *xfer; | ||
206 | struct spi_message *msg; | ||
207 | __le16 *txb = (__le16 *)ks->txd; | ||
208 | u8 *trx = ks->rxd; | ||
209 | int ret; | ||
210 | |||
211 | txb[0] = cpu_to_le16(op | KS_SPIOP_RD); | ||
212 | |||
213 | if (ks8851_rx_1msg(ks)) { | ||
214 | msg = &ks->spi_msg1; | ||
215 | xfer = &ks->spi_xfer1; | ||
216 | |||
217 | xfer->tx_buf = txb; | ||
218 | xfer->rx_buf = trx; | ||
219 | xfer->len = rxl + 2; | ||
220 | } else { | ||
221 | msg = &ks->spi_msg2; | ||
222 | xfer = ks->spi_xfer2; | ||
223 | |||
224 | xfer->tx_buf = txb; | ||
225 | xfer->rx_buf = NULL; | ||
226 | xfer->len = 2; | ||
227 | |||
228 | xfer++; | ||
229 | xfer->tx_buf = NULL; | ||
230 | xfer->rx_buf = trx; | ||
231 | xfer->len = rxl; | ||
232 | } | ||
233 | |||
234 | ret = spi_sync(ks->spidev, msg); | ||
235 | if (ret < 0) | ||
236 | ks_err(ks, "read: spi_sync() failed\n"); | ||
237 | else if (ks8851_rx_1msg(ks)) | ||
238 | memcpy(rxb, trx + 2, rxl); | ||
239 | else | ||
240 | memcpy(rxb, trx, rxl); | ||
241 | } | ||
242 | |||
243 | /** | ||
244 | * ks8851_rdreg8 - read 8 bit register from device | ||
245 | * @ks: The chip information | ||
246 | * @reg: The register address | ||
247 | * | ||
248 | * Read a 8bit register from the chip, returning the result | ||
249 | */ | ||
250 | static unsigned ks8851_rdreg8(struct ks8851_net *ks, unsigned reg) | ||
251 | { | ||
252 | u8 rxb[1]; | ||
253 | |||
254 | ks8851_rdreg(ks, MK_OP(1 << (reg & 3), reg), rxb, 1); | ||
255 | return rxb[0]; | ||
256 | } | ||
257 | |||
258 | /** | ||
259 | * ks8851_rdreg16 - read 16 bit register from device | ||
260 | * @ks: The chip information | ||
261 | * @reg: The register address | ||
262 | * | ||
263 | * Read a 16bit register from the chip, returning the result | ||
264 | */ | ||
265 | static unsigned ks8851_rdreg16(struct ks8851_net *ks, unsigned reg) | ||
266 | { | ||
267 | __le16 rx = 0; | ||
268 | |||
269 | ks8851_rdreg(ks, MK_OP(reg & 2 ? 0xC : 0x3, reg), (u8 *)&rx, 2); | ||
270 | return le16_to_cpu(rx); | ||
271 | } | ||
272 | |||
273 | /** | ||
274 | * ks8851_rdreg32 - read 32 bit register from device | ||
275 | * @ks: The chip information | ||
276 | * @reg: The register address | ||
277 | * | ||
278 | * Read a 32bit register from the chip. | ||
279 | * | ||
280 | * Note, this read requires the address be aligned to 4 bytes. | ||
281 | */ | ||
282 | static unsigned ks8851_rdreg32(struct ks8851_net *ks, unsigned reg) | ||
283 | { | ||
284 | __le32 rx = 0; | ||
285 | |||
286 | WARN_ON(reg & 3); | ||
287 | |||
288 | ks8851_rdreg(ks, MK_OP(0xf, reg), (u8 *)&rx, 4); | ||
289 | return le32_to_cpu(rx); | ||
290 | } | ||
291 | |||
292 | /** | ||
293 | * ks8851_soft_reset - issue one of the soft reset to the device | ||
294 | * @ks: The device state. | ||
295 | * @op: The bit(s) to set in the GRR | ||
296 | * | ||
297 | * Issue the relevant soft-reset command to the device's GRR register | ||
298 | * specified by @op. | ||
299 | * | ||
300 | * Note, the delays are in there as a caution to ensure that the reset | ||
301 | * has time to take effect and then complete. Since the datasheet does | ||
302 | * not currently specify the exact sequence, we have chosen something | ||
303 | * that seems to work with our device. | ||
304 | */ | ||
305 | static void ks8851_soft_reset(struct ks8851_net *ks, unsigned op) | ||
306 | { | ||
307 | ks8851_wrreg16(ks, KS_GRR, op); | ||
308 | mdelay(1); /* wait a short time to effect reset */ | ||
309 | ks8851_wrreg16(ks, KS_GRR, 0); | ||
310 | mdelay(1); /* wait for condition to clear */ | ||
311 | } | ||
312 | |||
313 | /** | ||
314 | * ks8851_write_mac_addr - write mac address to device registers | ||
315 | * @dev: The network device | ||
316 | * | ||
317 | * Update the KS8851 MAC address registers from the address in @dev. | ||
318 | * | ||
319 | * This call assumes that the chip is not running, so there is no need to | ||
320 | * shutdown the RXQ process whilst setting this. | ||
321 | */ | ||
322 | static int ks8851_write_mac_addr(struct net_device *dev) | ||
323 | { | ||
324 | struct ks8851_net *ks = netdev_priv(dev); | ||
325 | u16 *mcp = (u16 *)dev->dev_addr; | ||
326 | |||
327 | mutex_lock(&ks->lock); | ||
328 | |||
329 | ks8851_wrreg16(ks, KS_MARL, mcp[0]); | ||
330 | ks8851_wrreg16(ks, KS_MARM, mcp[1]); | ||
331 | ks8851_wrreg16(ks, KS_MARH, mcp[2]); | ||
332 | |||
333 | mutex_unlock(&ks->lock); | ||
334 | |||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | /** | ||
339 | * ks8851_init_mac - initialise the mac address | ||
340 | * @ks: The device structure | ||
341 | * | ||
342 | * Get or create the initial mac address for the device and then set that | ||
343 | * into the station address register. Currently we assume that the device | ||
344 | * does not have a valid mac address in it, and so we use random_ether_addr() | ||
345 | * to create a new one. | ||
346 | * | ||
347 | * In future, the driver should check to see if the device has an EEPROM | ||
348 | * attached and whether that has a valid ethernet address in it. | ||
349 | */ | ||
350 | static void ks8851_init_mac(struct ks8851_net *ks) | ||
351 | { | ||
352 | struct net_device *dev = ks->netdev; | ||
353 | |||
354 | random_ether_addr(dev->dev_addr); | ||
355 | ks8851_write_mac_addr(dev); | ||
356 | } | ||
357 | |||
358 | /** | ||
359 | * ks8851_irq - device interrupt handler | ||
360 | * @irq: Interrupt number passed from the IRQ hnalder. | ||
361 | * @pw: The private word passed to register_irq(), our struct ks8851_net. | ||
362 | * | ||
363 | * Disable the interrupt from happening again until we've processed the | ||
364 | * current status by scheduling ks8851_irq_work(). | ||
365 | */ | ||
366 | static irqreturn_t ks8851_irq(int irq, void *pw) | ||
367 | { | ||
368 | struct ks8851_net *ks = pw; | ||
369 | |||
370 | disable_irq_nosync(irq); | ||
371 | schedule_work(&ks->irq_work); | ||
372 | return IRQ_HANDLED; | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * ks8851_rdfifo - read data from the receive fifo | ||
377 | * @ks: The device state. | ||
378 | * @buff: The buffer address | ||
379 | * @len: The length of the data to read | ||
380 | * | ||
381 | * Issue an RXQ FIFO read command and read the @len ammount of data from | ||
382 | * the FIFO into the buffer specified by @buff. | ||
383 | */ | ||
384 | static void ks8851_rdfifo(struct ks8851_net *ks, u8 *buff, unsigned len) | ||
385 | { | ||
386 | struct spi_transfer *xfer = ks->spi_xfer2; | ||
387 | struct spi_message *msg = &ks->spi_msg2; | ||
388 | u8 txb[1]; | ||
389 | int ret; | ||
390 | |||
391 | if (netif_msg_rx_status(ks)) | ||
392 | ks_dbg(ks, "%s: %d@%p\n", __func__, len, buff); | ||
393 | |||
394 | /* set the operation we're issuing */ | ||
395 | txb[0] = KS_SPIOP_RXFIFO; | ||
396 | |||
397 | xfer->tx_buf = txb; | ||
398 | xfer->rx_buf = NULL; | ||
399 | xfer->len = 1; | ||
400 | |||
401 | xfer++; | ||
402 | xfer->rx_buf = buff; | ||
403 | xfer->tx_buf = NULL; | ||
404 | xfer->len = len; | ||
405 | |||
406 | ret = spi_sync(ks->spidev, msg); | ||
407 | if (ret < 0) | ||
408 | ks_err(ks, "%s: spi_sync() failed\n", __func__); | ||
409 | } | ||
410 | |||
411 | /** | ||
412 | * ks8851_dbg_dumpkkt - dump initial packet contents to debug | ||
413 | * @ks: The device state | ||
414 | * @rxpkt: The data for the received packet | ||
415 | * | ||
416 | * Dump the initial data from the packet to dev_dbg(). | ||
417 | */ | ||
418 | static void ks8851_dbg_dumpkkt(struct ks8851_net *ks, u8 *rxpkt) | ||
419 | { | ||
420 | ks_dbg(ks, "pkt %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x\n", | ||
421 | rxpkt[4], rxpkt[5], rxpkt[6], rxpkt[7], | ||
422 | rxpkt[8], rxpkt[9], rxpkt[10], rxpkt[11], | ||
423 | rxpkt[12], rxpkt[13], rxpkt[14], rxpkt[15]); | ||
424 | } | ||
425 | |||
426 | /** | ||
427 | * ks8851_rx_pkts - receive packets from the host | ||
428 | * @ks: The device information. | ||
429 | * | ||
430 | * This is called from the IRQ work queue when the system detects that there | ||
431 | * are packets in the receive queue. Find out how many packets there are and | ||
432 | * read them from the FIFO. | ||
433 | */ | ||
434 | static void ks8851_rx_pkts(struct ks8851_net *ks) | ||
435 | { | ||
436 | struct sk_buff *skb; | ||
437 | unsigned rxfc; | ||
438 | unsigned rxlen; | ||
439 | unsigned rxstat; | ||
440 | u32 rxh; | ||
441 | u8 *rxpkt; | ||
442 | |||
443 | rxfc = ks8851_rdreg8(ks, KS_RXFC); | ||
444 | |||
445 | if (netif_msg_rx_status(ks)) | ||
446 | ks_dbg(ks, "%s: %d packets\n", __func__, rxfc); | ||
447 | |||
448 | /* Currently we're issuing a read per packet, but we could possibly | ||
449 | * improve the code by issuing a single read, getting the receive | ||
450 | * header, allocating the packet and then reading the packet data | ||
451 | * out in one go. | ||
452 | * | ||
453 | * This form of operation would require us to hold the SPI bus' | ||
454 | * chipselect low during the entie transaction to avoid any | ||
455 | * reset to the data stream comming from the chip. | ||
456 | */ | ||
457 | |||
458 | for (; rxfc != 0; rxfc--) { | ||
459 | rxh = ks8851_rdreg32(ks, KS_RXFHSR); | ||
460 | rxstat = rxh & 0xffff; | ||
461 | rxlen = rxh >> 16; | ||
462 | |||
463 | if (netif_msg_rx_status(ks)) | ||
464 | ks_dbg(ks, "rx: stat 0x%04x, len 0x%04x\n", | ||
465 | rxstat, rxlen); | ||
466 | |||
467 | /* the length of the packet includes the 32bit CRC */ | ||
468 | |||
469 | /* set dma read address */ | ||
470 | ks8851_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI | 0x00); | ||
471 | |||
472 | /* start the packet dma process, and set auto-dequeue rx */ | ||
473 | ks8851_wrreg16(ks, KS_RXQCR, | ||
474 | ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE); | ||
475 | |||
476 | if (rxlen > 0) { | ||
477 | skb = netdev_alloc_skb(ks->netdev, rxlen + 2 + 8); | ||
478 | if (!skb) { | ||
479 | /* todo - dump frame and move on */ | ||
480 | } | ||
481 | |||
482 | /* two bytes to ensure ip is aligned, and four bytes | ||
483 | * for the status header and 4 bytes of garbage */ | ||
484 | skb_reserve(skb, 2 + 4 + 4); | ||
485 | |||
486 | rxpkt = skb_put(skb, rxlen - 4) - 8; | ||
487 | |||
488 | /* align the packet length to 4 bytes, and add 4 bytes | ||
489 | * as we're getting the rx status header as well */ | ||
490 | ks8851_rdfifo(ks, rxpkt, ALIGN(rxlen, 4) + 8); | ||
491 | |||
492 | if (netif_msg_pktdata(ks)) | ||
493 | ks8851_dbg_dumpkkt(ks, rxpkt); | ||
494 | |||
495 | skb->protocol = eth_type_trans(skb, ks->netdev); | ||
496 | netif_rx(skb); | ||
497 | |||
498 | ks->netdev->stats.rx_packets++; | ||
499 | ks->netdev->stats.rx_bytes += rxlen - 4; | ||
500 | } | ||
501 | |||
502 | ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); | ||
503 | } | ||
504 | } | ||
505 | |||
506 | /** | ||
507 | * ks8851_irq_work - work queue handler for dealing with interrupt requests | ||
508 | * @work: The work structure that was scheduled by schedule_work() | ||
509 | * | ||
510 | * This is the handler invoked when the ks8851_irq() is called to find out | ||
511 | * what happened, as we cannot allow ourselves to sleep whilst waiting for | ||
512 | * anything other process has the chip's lock. | ||
513 | * | ||
514 | * Read the interrupt status, work out what needs to be done and then clear | ||
515 | * any of the interrupts that are not needed. | ||
516 | */ | ||
517 | static void ks8851_irq_work(struct work_struct *work) | ||
518 | { | ||
519 | struct ks8851_net *ks = container_of(work, struct ks8851_net, irq_work); | ||
520 | unsigned status; | ||
521 | unsigned handled = 0; | ||
522 | |||
523 | mutex_lock(&ks->lock); | ||
524 | |||
525 | status = ks8851_rdreg16(ks, KS_ISR); | ||
526 | |||
527 | if (netif_msg_intr(ks)) | ||
528 | dev_dbg(&ks->spidev->dev, "%s: status 0x%04x\n", | ||
529 | __func__, status); | ||
530 | |||
531 | if (status & IRQ_LCI) { | ||
532 | /* should do something about checking link status */ | ||
533 | handled |= IRQ_LCI; | ||
534 | } | ||
535 | |||
536 | if (status & IRQ_LDI) { | ||
537 | u16 pmecr = ks8851_rdreg16(ks, KS_PMECR); | ||
538 | pmecr &= ~PMECR_WKEVT_MASK; | ||
539 | ks8851_wrreg16(ks, KS_PMECR, pmecr | PMECR_WKEVT_LINK); | ||
540 | |||
541 | handled |= IRQ_LDI; | ||
542 | } | ||
543 | |||
544 | if (status & IRQ_RXPSI) | ||
545 | handled |= IRQ_RXPSI; | ||
546 | |||
547 | if (status & IRQ_TXI) { | ||
548 | handled |= IRQ_TXI; | ||
549 | |||
550 | /* no lock here, tx queue should have been stopped */ | ||
551 | |||
552 | /* update our idea of how much tx space is available to the | ||
553 | * system */ | ||
554 | ks->tx_space = ks8851_rdreg16(ks, KS_TXMIR); | ||
555 | |||
556 | if (netif_msg_intr(ks)) | ||
557 | ks_dbg(ks, "%s: txspace %d\n", __func__, ks->tx_space); | ||
558 | } | ||
559 | |||
560 | if (status & IRQ_RXI) | ||
561 | handled |= IRQ_RXI; | ||
562 | |||
563 | if (status & IRQ_SPIBEI) { | ||
564 | dev_err(&ks->spidev->dev, "%s: spi bus error\n", __func__); | ||
565 | handled |= IRQ_SPIBEI; | ||
566 | } | ||
567 | |||
568 | ks8851_wrreg16(ks, KS_ISR, handled); | ||
569 | |||
570 | if (status & IRQ_RXI) { | ||
571 | /* the datasheet says to disable the rx interrupt during | ||
572 | * packet read-out, however we're masking the interrupt | ||
573 | * from the device so do not bother masking just the RX | ||
574 | * from the device. */ | ||
575 | |||
576 | ks8851_rx_pkts(ks); | ||
577 | } | ||
578 | |||
579 | /* if something stopped the rx process, probably due to wanting | ||
580 | * to change the rx settings, then do something about restarting | ||
581 | * it. */ | ||
582 | if (status & IRQ_RXPSI) { | ||
583 | struct ks8851_rxctrl *rxc = &ks->rxctrl; | ||
584 | |||
585 | /* update the multicast hash table */ | ||
586 | ks8851_wrreg16(ks, KS_MAHTR0, rxc->mchash[0]); | ||
587 | ks8851_wrreg16(ks, KS_MAHTR1, rxc->mchash[1]); | ||
588 | ks8851_wrreg16(ks, KS_MAHTR2, rxc->mchash[2]); | ||
589 | ks8851_wrreg16(ks, KS_MAHTR3, rxc->mchash[3]); | ||
590 | |||
591 | ks8851_wrreg16(ks, KS_RXCR2, rxc->rxcr2); | ||
592 | ks8851_wrreg16(ks, KS_RXCR1, rxc->rxcr1); | ||
593 | } | ||
594 | |||
595 | mutex_unlock(&ks->lock); | ||
596 | |||
597 | if (status & IRQ_TXI) | ||
598 | netif_wake_queue(ks->netdev); | ||
599 | |||
600 | enable_irq(ks->netdev->irq); | ||
601 | } | ||
602 | |||
603 | /** | ||
604 | * calc_txlen - calculate size of message to send packet | ||
605 | * @len: Lenght of data | ||
606 | * | ||
607 | * Returns the size of the TXFIFO message needed to send | ||
608 | * this packet. | ||
609 | */ | ||
610 | static inline unsigned calc_txlen(unsigned len) | ||
611 | { | ||
612 | return ALIGN(len + 4, 4); | ||
613 | } | ||
614 | |||
615 | /** | ||
616 | * ks8851_wrpkt - write packet to TX FIFO | ||
617 | * @ks: The device state. | ||
618 | * @txp: The sk_buff to transmit. | ||
619 | * @irq: IRQ on completion of the packet. | ||
620 | * | ||
621 | * Send the @txp to the chip. This means creating the relevant packet header | ||
622 | * specifying the length of the packet and the other information the chip | ||
623 | * needs, such as IRQ on completion. Send the header and the packet data to | ||
624 | * the device. | ||
625 | */ | ||
626 | static void ks8851_wrpkt(struct ks8851_net *ks, struct sk_buff *txp, bool irq) | ||
627 | { | ||
628 | struct spi_transfer *xfer = ks->spi_xfer2; | ||
629 | struct spi_message *msg = &ks->spi_msg2; | ||
630 | unsigned fid = 0; | ||
631 | int ret; | ||
632 | |||
633 | if (netif_msg_tx_queued(ks)) | ||
634 | dev_dbg(&ks->spidev->dev, "%s: skb %p, %d@%p, irq %d\n", | ||
635 | __func__, txp, txp->len, txp->data, irq); | ||
636 | |||
637 | fid = ks->fid++; | ||
638 | fid &= TXFR_TXFID_MASK; | ||
639 | |||
640 | if (irq) | ||
641 | fid |= TXFR_TXIC; /* irq on completion */ | ||
642 | |||
643 | /* start header at txb[1] to align txw entries */ | ||
644 | ks->txh.txb[1] = KS_SPIOP_TXFIFO; | ||
645 | ks->txh.txw[1] = cpu_to_le16(fid); | ||
646 | ks->txh.txw[2] = cpu_to_le16(txp->len); | ||
647 | |||
648 | xfer->tx_buf = &ks->txh.txb[1]; | ||
649 | xfer->rx_buf = NULL; | ||
650 | xfer->len = 5; | ||
651 | |||
652 | xfer++; | ||
653 | xfer->tx_buf = txp->data; | ||
654 | xfer->rx_buf = NULL; | ||
655 | xfer->len = ALIGN(txp->len, 4); | ||
656 | |||
657 | ret = spi_sync(ks->spidev, msg); | ||
658 | if (ret < 0) | ||
659 | ks_err(ks, "%s: spi_sync() failed\n", __func__); | ||
660 | } | ||
661 | |||
662 | /** | ||
663 | * ks8851_done_tx - update and then free skbuff after transmitting | ||
664 | * @ks: The device state | ||
665 | * @txb: The buffer transmitted | ||
666 | */ | ||
667 | static void ks8851_done_tx(struct ks8851_net *ks, struct sk_buff *txb) | ||
668 | { | ||
669 | struct net_device *dev = ks->netdev; | ||
670 | |||
671 | dev->stats.tx_bytes += txb->len; | ||
672 | dev->stats.tx_packets++; | ||
673 | |||
674 | dev_kfree_skb(txb); | ||
675 | } | ||
676 | |||
677 | /** | ||
678 | * ks8851_tx_work - process tx packet(s) | ||
679 | * @work: The work strucutre what was scheduled. | ||
680 | * | ||
681 | * This is called when a number of packets have been scheduled for | ||
682 | * transmission and need to be sent to the device. | ||
683 | */ | ||
684 | static void ks8851_tx_work(struct work_struct *work) | ||
685 | { | ||
686 | struct ks8851_net *ks = container_of(work, struct ks8851_net, tx_work); | ||
687 | struct sk_buff *txb; | ||
688 | bool last = false; | ||
689 | |||
690 | mutex_lock(&ks->lock); | ||
691 | |||
692 | while (!last) { | ||
693 | txb = skb_dequeue(&ks->txq); | ||
694 | last = skb_queue_empty(&ks->txq); | ||
695 | |||
696 | ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA); | ||
697 | ks8851_wrpkt(ks, txb, last); | ||
698 | ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); | ||
699 | ks8851_wrreg16(ks, KS_TXQCR, TXQCR_METFE); | ||
700 | |||
701 | ks8851_done_tx(ks, txb); | ||
702 | } | ||
703 | |||
704 | mutex_unlock(&ks->lock); | ||
705 | } | ||
706 | |||
707 | /** | ||
708 | * ks8851_set_powermode - set power mode of the device | ||
709 | * @ks: The device state | ||
710 | * @pwrmode: The power mode value to write to KS_PMECR. | ||
711 | * | ||
712 | * Change the power mode of the chip. | ||
713 | */ | ||
714 | static void ks8851_set_powermode(struct ks8851_net *ks, unsigned pwrmode) | ||
715 | { | ||
716 | unsigned pmecr; | ||
717 | |||
718 | if (netif_msg_hw(ks)) | ||
719 | ks_dbg(ks, "setting power mode %d\n", pwrmode); | ||
720 | |||
721 | pmecr = ks8851_rdreg16(ks, KS_PMECR); | ||
722 | pmecr &= ~PMECR_PM_MASK; | ||
723 | pmecr |= pwrmode; | ||
724 | |||
725 | ks8851_wrreg16(ks, KS_PMECR, pmecr); | ||
726 | } | ||
727 | |||
728 | /** | ||
729 | * ks8851_net_open - open network device | ||
730 | * @dev: The network device being opened. | ||
731 | * | ||
732 | * Called when the network device is marked active, such as a user executing | ||
733 | * 'ifconfig up' on the device. | ||
734 | */ | ||
735 | static int ks8851_net_open(struct net_device *dev) | ||
736 | { | ||
737 | struct ks8851_net *ks = netdev_priv(dev); | ||
738 | |||
739 | /* lock the card, even if we may not actually be doing anything | ||
740 | * else at the moment */ | ||
741 | mutex_lock(&ks->lock); | ||
742 | |||
743 | if (netif_msg_ifup(ks)) | ||
744 | ks_dbg(ks, "opening %s\n", dev->name); | ||
745 | |||
746 | /* bring chip out of any power saving mode it was in */ | ||
747 | ks8851_set_powermode(ks, PMECR_PM_NORMAL); | ||
748 | |||
749 | /* issue a soft reset to the RX/TX QMU to put it into a known | ||
750 | * state. */ | ||
751 | ks8851_soft_reset(ks, GRR_QMU); | ||
752 | |||
753 | /* setup transmission parameters */ | ||
754 | |||
755 | ks8851_wrreg16(ks, KS_TXCR, (TXCR_TXE | /* enable transmit process */ | ||
756 | TXCR_TXPE | /* pad to min length */ | ||
757 | TXCR_TXCRC | /* add CRC */ | ||
758 | TXCR_TXFCE)); /* enable flow control */ | ||
759 | |||
760 | /* auto-increment tx data, reset tx pointer */ | ||
761 | ks8851_wrreg16(ks, KS_TXFDPR, TXFDPR_TXFPAI); | ||
762 | |||
763 | /* setup receiver control */ | ||
764 | |||
765 | ks8851_wrreg16(ks, KS_RXCR1, (RXCR1_RXPAFMA | /* from mac filter */ | ||
766 | RXCR1_RXFCE | /* enable flow control */ | ||
767 | RXCR1_RXBE | /* broadcast enable */ | ||
768 | RXCR1_RXUE | /* unicast enable */ | ||
769 | RXCR1_RXE)); /* enable rx block */ | ||
770 | |||
771 | /* transfer entire frames out in one go */ | ||
772 | ks8851_wrreg16(ks, KS_RXCR2, RXCR2_SRDBL_FRAME); | ||
773 | |||
774 | /* set receive counter timeouts */ | ||
775 | ks8851_wrreg16(ks, KS_RXDTTR, 1000); /* 1ms after first frame to IRQ */ | ||
776 | ks8851_wrreg16(ks, KS_RXDBCTR, 4096); /* >4Kbytes in buffer to IRQ */ | ||
777 | ks8851_wrreg16(ks, KS_RXFCTR, 10); /* 10 frames to IRQ */ | ||
778 | |||
779 | ks->rc_rxqcr = (RXQCR_RXFCTE | /* IRQ on frame count exceeded */ | ||
780 | RXQCR_RXDBCTE | /* IRQ on byte count exceeded */ | ||
781 | RXQCR_RXDTTE); /* IRQ on time exceeded */ | ||
782 | |||
783 | ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); | ||
784 | |||
785 | /* clear then enable interrupts */ | ||
786 | |||
787 | #define STD_IRQ (IRQ_LCI | /* Link Change */ \ | ||
788 | IRQ_TXI | /* TX done */ \ | ||
789 | IRQ_RXI | /* RX done */ \ | ||
790 | IRQ_SPIBEI | /* SPI bus error */ \ | ||
791 | IRQ_TXPSI | /* TX process stop */ \ | ||
792 | IRQ_RXPSI) /* RX process stop */ | ||
793 | |||
794 | ks->rc_ier = STD_IRQ; | ||
795 | ks8851_wrreg16(ks, KS_ISR, STD_IRQ); | ||
796 | ks8851_wrreg16(ks, KS_IER, STD_IRQ); | ||
797 | |||
798 | netif_start_queue(ks->netdev); | ||
799 | |||
800 | if (netif_msg_ifup(ks)) | ||
801 | ks_dbg(ks, "network device %s up\n", dev->name); | ||
802 | |||
803 | mutex_unlock(&ks->lock); | ||
804 | return 0; | ||
805 | } | ||
806 | |||
807 | /** | ||
808 | * ks8851_net_stop - close network device | ||
809 | * @dev: The device being closed. | ||
810 | * | ||
811 | * Called to close down a network device which has been active. Cancell any | ||
812 | * work, shutdown the RX and TX process and then place the chip into a low | ||
813 | * power state whilst it is not being used. | ||
814 | */ | ||
815 | static int ks8851_net_stop(struct net_device *dev) | ||
816 | { | ||
817 | struct ks8851_net *ks = netdev_priv(dev); | ||
818 | |||
819 | if (netif_msg_ifdown(ks)) | ||
820 | ks_info(ks, "%s: shutting down\n", dev->name); | ||
821 | |||
822 | netif_stop_queue(dev); | ||
823 | |||
824 | mutex_lock(&ks->lock); | ||
825 | |||
826 | /* stop any outstanding work */ | ||
827 | flush_work(&ks->irq_work); | ||
828 | flush_work(&ks->tx_work); | ||
829 | flush_work(&ks->rxctrl_work); | ||
830 | |||
831 | /* turn off the IRQs and ack any outstanding */ | ||
832 | ks8851_wrreg16(ks, KS_IER, 0x0000); | ||
833 | ks8851_wrreg16(ks, KS_ISR, 0xffff); | ||
834 | |||
835 | /* shutdown RX process */ | ||
836 | ks8851_wrreg16(ks, KS_RXCR1, 0x0000); | ||
837 | |||
838 | /* shutdown TX process */ | ||
839 | ks8851_wrreg16(ks, KS_TXCR, 0x0000); | ||
840 | |||
841 | /* set powermode to soft power down to save power */ | ||
842 | ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN); | ||
843 | |||
844 | /* ensure any queued tx buffers are dumped */ | ||
845 | while (!skb_queue_empty(&ks->txq)) { | ||
846 | struct sk_buff *txb = skb_dequeue(&ks->txq); | ||
847 | |||
848 | if (netif_msg_ifdown(ks)) | ||
849 | ks_dbg(ks, "%s: freeing txb %p\n", __func__, txb); | ||
850 | |||
851 | dev_kfree_skb(txb); | ||
852 | } | ||
853 | |||
854 | mutex_unlock(&ks->lock); | ||
855 | return 0; | ||
856 | } | ||
857 | |||
858 | /** | ||
859 | * ks8851_start_xmit - transmit packet | ||
860 | * @skb: The buffer to transmit | ||
861 | * @dev: The device used to transmit the packet. | ||
862 | * | ||
863 | * Called by the network layer to transmit the @skb. Queue the packet for | ||
864 | * the device and schedule the necessary work to transmit the packet when | ||
865 | * it is free. | ||
866 | * | ||
867 | * We do this to firstly avoid sleeping with the network device locked, | ||
868 | * and secondly so we can round up more than one packet to transmit which | ||
869 | * means we can try and avoid generating too many transmit done interrupts. | ||
870 | */ | ||
871 | static int ks8851_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
872 | { | ||
873 | struct ks8851_net *ks = netdev_priv(dev); | ||
874 | unsigned needed = calc_txlen(skb->len); | ||
875 | int ret = NETDEV_TX_OK; | ||
876 | |||
877 | if (netif_msg_tx_queued(ks)) | ||
878 | ks_dbg(ks, "%s: skb %p, %d@%p\n", __func__, | ||
879 | skb, skb->len, skb->data); | ||
880 | |||
881 | spin_lock(&ks->statelock); | ||
882 | |||
883 | if (needed > ks->tx_space) { | ||
884 | netif_stop_queue(dev); | ||
885 | ret = NETDEV_TX_BUSY; | ||
886 | } else { | ||
887 | ks->tx_space -= needed; | ||
888 | skb_queue_tail(&ks->txq, skb); | ||
889 | } | ||
890 | |||
891 | spin_unlock(&ks->statelock); | ||
892 | schedule_work(&ks->tx_work); | ||
893 | |||
894 | return ret; | ||
895 | } | ||
896 | |||
897 | /** | ||
898 | * ks8851_rxctrl_work - work handler to change rx mode | ||
899 | * @work: The work structure this belongs to. | ||
900 | * | ||
901 | * Lock the device and issue the necessary changes to the receive mode from | ||
902 | * the network device layer. This is done so that we can do this without | ||
903 | * having to sleep whilst holding the network device lock. | ||
904 | * | ||
905 | * Since the recommendation from Micrel is that the RXQ is shutdown whilst the | ||
906 | * receive parameters are programmed, we issue a write to disable the RXQ and | ||
907 | * then wait for the interrupt handler to be triggered once the RXQ shutdown is | ||
908 | * complete. The interrupt handler then writes the new values into the chip. | ||
909 | */ | ||
910 | static void ks8851_rxctrl_work(struct work_struct *work) | ||
911 | { | ||
912 | struct ks8851_net *ks = container_of(work, struct ks8851_net, rxctrl_work); | ||
913 | |||
914 | mutex_lock(&ks->lock); | ||
915 | |||
916 | /* need to shutdown RXQ before modifying filter parameters */ | ||
917 | ks8851_wrreg16(ks, KS_RXCR1, 0x00); | ||
918 | |||
919 | mutex_unlock(&ks->lock); | ||
920 | } | ||
921 | |||
922 | static void ks8851_set_rx_mode(struct net_device *dev) | ||
923 | { | ||
924 | struct ks8851_net *ks = netdev_priv(dev); | ||
925 | struct ks8851_rxctrl rxctrl; | ||
926 | |||
927 | memset(&rxctrl, 0, sizeof(rxctrl)); | ||
928 | |||
929 | if (dev->flags & IFF_PROMISC) { | ||
930 | /* interface to receive everything */ | ||
931 | |||
932 | rxctrl.rxcr1 = RXCR1_RXAE | RXCR1_RXINVF; | ||
933 | } else if (dev->flags & IFF_ALLMULTI) { | ||
934 | /* accept all multicast packets */ | ||
935 | |||
936 | rxctrl.rxcr1 = (RXCR1_RXME | RXCR1_RXAE | | ||
937 | RXCR1_RXPAFMA | RXCR1_RXMAFMA); | ||
938 | } else if (dev->flags & IFF_MULTICAST && dev->mc_count > 0) { | ||
939 | struct dev_mc_list *mcptr = dev->mc_list; | ||
940 | u32 crc; | ||
941 | int i; | ||
942 | |||
943 | /* accept some multicast */ | ||
944 | |||
945 | for (i = dev->mc_count; i > 0; i--) { | ||
946 | crc = ether_crc(ETH_ALEN, mcptr->dmi_addr); | ||
947 | crc >>= (32 - 6); /* get top six bits */ | ||
948 | |||
949 | rxctrl.mchash[crc >> 4] |= (1 << (crc & 0xf)); | ||
950 | mcptr = mcptr->next; | ||
951 | } | ||
952 | |||
953 | rxctrl.rxcr1 = RXCR1_RXME | RXCR1_RXAE | RXCR1_RXPAFMA; | ||
954 | } else { | ||
955 | /* just accept broadcast / unicast */ | ||
956 | rxctrl.rxcr1 = RXCR1_RXPAFMA; | ||
957 | } | ||
958 | |||
959 | rxctrl.rxcr1 |= (RXCR1_RXUE | /* unicast enable */ | ||
960 | RXCR1_RXBE | /* broadcast enable */ | ||
961 | RXCR1_RXE | /* RX process enable */ | ||
962 | RXCR1_RXFCE); /* enable flow control */ | ||
963 | |||
964 | rxctrl.rxcr2 |= RXCR2_SRDBL_FRAME; | ||
965 | |||
966 | /* schedule work to do the actual set of the data if needed */ | ||
967 | |||
968 | spin_lock(&ks->statelock); | ||
969 | |||
970 | if (memcmp(&rxctrl, &ks->rxctrl, sizeof(rxctrl)) != 0) { | ||
971 | memcpy(&ks->rxctrl, &rxctrl, sizeof(ks->rxctrl)); | ||
972 | schedule_work(&ks->rxctrl_work); | ||
973 | } | ||
974 | |||
975 | spin_unlock(&ks->statelock); | ||
976 | } | ||
977 | |||
978 | static int ks8851_set_mac_address(struct net_device *dev, void *addr) | ||
979 | { | ||
980 | struct sockaddr *sa = addr; | ||
981 | |||
982 | if (netif_running(dev)) | ||
983 | return -EBUSY; | ||
984 | |||
985 | if (!is_valid_ether_addr(sa->sa_data)) | ||
986 | return -EADDRNOTAVAIL; | ||
987 | |||
988 | memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN); | ||
989 | return ks8851_write_mac_addr(dev); | ||
990 | } | ||
991 | |||
992 | static int ks8851_net_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | ||
993 | { | ||
994 | struct ks8851_net *ks = netdev_priv(dev); | ||
995 | |||
996 | if (!netif_running(dev)) | ||
997 | return -EINVAL; | ||
998 | |||
999 | return generic_mii_ioctl(&ks->mii, if_mii(req), cmd, NULL); | ||
1000 | } | ||
1001 | |||
1002 | static const struct net_device_ops ks8851_netdev_ops = { | ||
1003 | .ndo_open = ks8851_net_open, | ||
1004 | .ndo_stop = ks8851_net_stop, | ||
1005 | .ndo_do_ioctl = ks8851_net_ioctl, | ||
1006 | .ndo_start_xmit = ks8851_start_xmit, | ||
1007 | .ndo_set_mac_address = ks8851_set_mac_address, | ||
1008 | .ndo_set_rx_mode = ks8851_set_rx_mode, | ||
1009 | .ndo_change_mtu = eth_change_mtu, | ||
1010 | .ndo_validate_addr = eth_validate_addr, | ||
1011 | }; | ||
1012 | |||
1013 | /* ethtool support */ | ||
1014 | |||
1015 | static void ks8851_get_drvinfo(struct net_device *dev, | ||
1016 | struct ethtool_drvinfo *di) | ||
1017 | { | ||
1018 | strlcpy(di->driver, "KS8851", sizeof(di->driver)); | ||
1019 | strlcpy(di->version, "1.00", sizeof(di->version)); | ||
1020 | strlcpy(di->bus_info, dev_name(dev->dev.parent), sizeof(di->bus_info)); | ||
1021 | } | ||
1022 | |||
1023 | static u32 ks8851_get_msglevel(struct net_device *dev) | ||
1024 | { | ||
1025 | struct ks8851_net *ks = netdev_priv(dev); | ||
1026 | return ks->msg_enable; | ||
1027 | } | ||
1028 | |||
1029 | static void ks8851_set_msglevel(struct net_device *dev, u32 to) | ||
1030 | { | ||
1031 | struct ks8851_net *ks = netdev_priv(dev); | ||
1032 | ks->msg_enable = to; | ||
1033 | } | ||
1034 | |||
1035 | static int ks8851_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
1036 | { | ||
1037 | struct ks8851_net *ks = netdev_priv(dev); | ||
1038 | return mii_ethtool_gset(&ks->mii, cmd); | ||
1039 | } | ||
1040 | |||
1041 | static int ks8851_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
1042 | { | ||
1043 | struct ks8851_net *ks = netdev_priv(dev); | ||
1044 | return mii_ethtool_sset(&ks->mii, cmd); | ||
1045 | } | ||
1046 | |||
1047 | static u32 ks8851_get_link(struct net_device *dev) | ||
1048 | { | ||
1049 | struct ks8851_net *ks = netdev_priv(dev); | ||
1050 | return mii_link_ok(&ks->mii); | ||
1051 | } | ||
1052 | |||
1053 | static int ks8851_nway_reset(struct net_device *dev) | ||
1054 | { | ||
1055 | struct ks8851_net *ks = netdev_priv(dev); | ||
1056 | return mii_nway_restart(&ks->mii); | ||
1057 | } | ||
1058 | |||
1059 | static const struct ethtool_ops ks8851_ethtool_ops = { | ||
1060 | .get_drvinfo = ks8851_get_drvinfo, | ||
1061 | .get_msglevel = ks8851_get_msglevel, | ||
1062 | .set_msglevel = ks8851_set_msglevel, | ||
1063 | .get_settings = ks8851_get_settings, | ||
1064 | .set_settings = ks8851_set_settings, | ||
1065 | .get_link = ks8851_get_link, | ||
1066 | .nway_reset = ks8851_nway_reset, | ||
1067 | }; | ||
1068 | |||
1069 | /* MII interface controls */ | ||
1070 | |||
1071 | /** | ||
1072 | * ks8851_phy_reg - convert MII register into a KS8851 register | ||
1073 | * @reg: MII register number. | ||
1074 | * | ||
1075 | * Return the KS8851 register number for the corresponding MII PHY register | ||
1076 | * if possible. Return zero if the MII register has no direct mapping to the | ||
1077 | * KS8851 register set. | ||
1078 | */ | ||
1079 | static int ks8851_phy_reg(int reg) | ||
1080 | { | ||
1081 | switch (reg) { | ||
1082 | case MII_BMCR: | ||
1083 | return KS_P1MBCR; | ||
1084 | case MII_BMSR: | ||
1085 | return KS_P1MBSR; | ||
1086 | case MII_PHYSID1: | ||
1087 | return KS_PHY1ILR; | ||
1088 | case MII_PHYSID2: | ||
1089 | return KS_PHY1IHR; | ||
1090 | case MII_ADVERTISE: | ||
1091 | return KS_P1ANAR; | ||
1092 | case MII_LPA: | ||
1093 | return KS_P1ANLPR; | ||
1094 | } | ||
1095 | |||
1096 | return 0x0; | ||
1097 | } | ||
1098 | |||
1099 | /** | ||
1100 | * ks8851_phy_read - MII interface PHY register read. | ||
1101 | * @dev: The network device the PHY is on. | ||
1102 | * @phy_addr: Address of PHY (ignored as we only have one) | ||
1103 | * @reg: The register to read. | ||
1104 | * | ||
1105 | * This call reads data from the PHY register specified in @reg. Since the | ||
1106 | * device does not support all the MII registers, the non-existant values | ||
1107 | * are always returned as zero. | ||
1108 | * | ||
1109 | * We return zero for unsupported registers as the MII code does not check | ||
1110 | * the value returned for any error status, and simply returns it to the | ||
1111 | * caller. The mii-tool that the driver was tested with takes any -ve error | ||
1112 | * as real PHY capabilities, thus displaying incorrect data to the user. | ||
1113 | */ | ||
1114 | static int ks8851_phy_read(struct net_device *dev, int phy_addr, int reg) | ||
1115 | { | ||
1116 | struct ks8851_net *ks = netdev_priv(dev); | ||
1117 | int ksreg; | ||
1118 | int result; | ||
1119 | |||
1120 | ksreg = ks8851_phy_reg(reg); | ||
1121 | if (!ksreg) | ||
1122 | return 0x0; /* no error return allowed, so use zero */ | ||
1123 | |||
1124 | mutex_lock(&ks->lock); | ||
1125 | result = ks8851_rdreg16(ks, ksreg); | ||
1126 | mutex_unlock(&ks->lock); | ||
1127 | |||
1128 | return result; | ||
1129 | } | ||
1130 | |||
1131 | static void ks8851_phy_write(struct net_device *dev, | ||
1132 | int phy, int reg, int value) | ||
1133 | { | ||
1134 | struct ks8851_net *ks = netdev_priv(dev); | ||
1135 | int ksreg; | ||
1136 | |||
1137 | ksreg = ks8851_phy_reg(reg); | ||
1138 | if (ksreg) { | ||
1139 | mutex_lock(&ks->lock); | ||
1140 | ks8851_wrreg16(ks, ksreg, value); | ||
1141 | mutex_unlock(&ks->lock); | ||
1142 | } | ||
1143 | } | ||
1144 | |||
1145 | /** | ||
1146 | * ks8851_read_selftest - read the selftest memory info. | ||
1147 | * @ks: The device state | ||
1148 | * | ||
1149 | * Read and check the TX/RX memory selftest information. | ||
1150 | */ | ||
1151 | static int ks8851_read_selftest(struct ks8851_net *ks) | ||
1152 | { | ||
1153 | unsigned both_done = MBIR_TXMBF | MBIR_RXMBF; | ||
1154 | int ret = 0; | ||
1155 | unsigned rd; | ||
1156 | |||
1157 | rd = ks8851_rdreg16(ks, KS_MBIR); | ||
1158 | |||
1159 | if ((rd & both_done) != both_done) { | ||
1160 | ks_warn(ks, "Memory selftest not finished\n"); | ||
1161 | return 0; | ||
1162 | } | ||
1163 | |||
1164 | if (rd & MBIR_TXMBFA) { | ||
1165 | ks_err(ks, "TX memory selftest fail\n"); | ||
1166 | ret |= 1; | ||
1167 | } | ||
1168 | |||
1169 | if (rd & MBIR_RXMBFA) { | ||
1170 | ks_err(ks, "RX memory selftest fail\n"); | ||
1171 | ret |= 2; | ||
1172 | } | ||
1173 | |||
1174 | return 0; | ||
1175 | } | ||
1176 | |||
1177 | /* driver bus management functions */ | ||
1178 | |||
1179 | static int __devinit ks8851_probe(struct spi_device *spi) | ||
1180 | { | ||
1181 | struct net_device *ndev; | ||
1182 | struct ks8851_net *ks; | ||
1183 | int ret; | ||
1184 | |||
1185 | ndev = alloc_etherdev(sizeof(struct ks8851_net)); | ||
1186 | if (!ndev) { | ||
1187 | dev_err(&spi->dev, "failed to alloc ethernet device\n"); | ||
1188 | return -ENOMEM; | ||
1189 | } | ||
1190 | |||
1191 | spi->bits_per_word = 8; | ||
1192 | |||
1193 | ks = netdev_priv(ndev); | ||
1194 | |||
1195 | ks->netdev = ndev; | ||
1196 | ks->spidev = spi; | ||
1197 | ks->tx_space = 6144; | ||
1198 | |||
1199 | mutex_init(&ks->lock); | ||
1200 | spin_lock_init(&ks->statelock); | ||
1201 | |||
1202 | INIT_WORK(&ks->tx_work, ks8851_tx_work); | ||
1203 | INIT_WORK(&ks->irq_work, ks8851_irq_work); | ||
1204 | INIT_WORK(&ks->rxctrl_work, ks8851_rxctrl_work); | ||
1205 | |||
1206 | /* initialise pre-made spi transfer messages */ | ||
1207 | |||
1208 | spi_message_init(&ks->spi_msg1); | ||
1209 | spi_message_add_tail(&ks->spi_xfer1, &ks->spi_msg1); | ||
1210 | |||
1211 | spi_message_init(&ks->spi_msg2); | ||
1212 | spi_message_add_tail(&ks->spi_xfer2[0], &ks->spi_msg2); | ||
1213 | spi_message_add_tail(&ks->spi_xfer2[1], &ks->spi_msg2); | ||
1214 | |||
1215 | /* setup mii state */ | ||
1216 | ks->mii.dev = ndev; | ||
1217 | ks->mii.phy_id = 1, | ||
1218 | ks->mii.phy_id_mask = 1; | ||
1219 | ks->mii.reg_num_mask = 0xf; | ||
1220 | ks->mii.mdio_read = ks8851_phy_read; | ||
1221 | ks->mii.mdio_write = ks8851_phy_write; | ||
1222 | |||
1223 | dev_info(&spi->dev, "message enable is %d\n", msg_enable); | ||
1224 | |||
1225 | /* set the default message enable */ | ||
1226 | ks->msg_enable = netif_msg_init(msg_enable, (NETIF_MSG_DRV | | ||
1227 | NETIF_MSG_PROBE | | ||
1228 | NETIF_MSG_LINK)); | ||
1229 | |||
1230 | skb_queue_head_init(&ks->txq); | ||
1231 | |||
1232 | SET_ETHTOOL_OPS(ndev, &ks8851_ethtool_ops); | ||
1233 | SET_NETDEV_DEV(ndev, &spi->dev); | ||
1234 | |||
1235 | dev_set_drvdata(&spi->dev, ks); | ||
1236 | |||
1237 | ndev->if_port = IF_PORT_100BASET; | ||
1238 | ndev->netdev_ops = &ks8851_netdev_ops; | ||
1239 | ndev->irq = spi->irq; | ||
1240 | |||
1241 | /* simple check for a valid chip being connected to the bus */ | ||
1242 | |||
1243 | if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { | ||
1244 | dev_err(&spi->dev, "failed to read device ID\n"); | ||
1245 | ret = -ENODEV; | ||
1246 | goto err_id; | ||
1247 | } | ||
1248 | |||
1249 | ks8851_read_selftest(ks); | ||
1250 | ks8851_init_mac(ks); | ||
1251 | |||
1252 | ret = request_irq(spi->irq, ks8851_irq, IRQF_TRIGGER_LOW, | ||
1253 | ndev->name, ks); | ||
1254 | if (ret < 0) { | ||
1255 | dev_err(&spi->dev, "failed to get irq\n"); | ||
1256 | goto err_irq; | ||
1257 | } | ||
1258 | |||
1259 | ret = register_netdev(ndev); | ||
1260 | if (ret) { | ||
1261 | dev_err(&spi->dev, "failed to register network device\n"); | ||
1262 | goto err_netdev; | ||
1263 | } | ||
1264 | |||
1265 | dev_info(&spi->dev, "revision %d, MAC %pM, IRQ %d\n", | ||
1266 | CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)), | ||
1267 | ndev->dev_addr, ndev->irq); | ||
1268 | |||
1269 | return 0; | ||
1270 | |||
1271 | |||
1272 | err_netdev: | ||
1273 | free_irq(ndev->irq, ndev); | ||
1274 | |||
1275 | err_id: | ||
1276 | err_irq: | ||
1277 | free_netdev(ndev); | ||
1278 | return ret; | ||
1279 | } | ||
1280 | |||
1281 | static int __devexit ks8851_remove(struct spi_device *spi) | ||
1282 | { | ||
1283 | struct ks8851_net *priv = dev_get_drvdata(&spi->dev); | ||
1284 | |||
1285 | if (netif_msg_drv(priv)) | ||
1286 | dev_info(&spi->dev, "remove"); | ||
1287 | |||
1288 | unregister_netdev(priv->netdev); | ||
1289 | free_irq(spi->irq, priv); | ||
1290 | free_netdev(priv->netdev); | ||
1291 | |||
1292 | return 0; | ||
1293 | } | ||
1294 | |||
1295 | static struct spi_driver ks8851_driver = { | ||
1296 | .driver = { | ||
1297 | .name = "ks8851", | ||
1298 | .owner = THIS_MODULE, | ||
1299 | }, | ||
1300 | .probe = ks8851_probe, | ||
1301 | .remove = __devexit_p(ks8851_remove), | ||
1302 | }; | ||
1303 | |||
1304 | static int __init ks8851_init(void) | ||
1305 | { | ||
1306 | return spi_register_driver(&ks8851_driver); | ||
1307 | } | ||
1308 | |||
1309 | static void __exit ks8851_exit(void) | ||
1310 | { | ||
1311 | spi_unregister_driver(&ks8851_driver); | ||
1312 | } | ||
1313 | |||
1314 | module_init(ks8851_init); | ||
1315 | module_exit(ks8851_exit); | ||
1316 | |||
1317 | MODULE_DESCRIPTION("KS8851 Network driver"); | ||
1318 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | ||
1319 | MODULE_LICENSE("GPL"); | ||
1320 | |||
1321 | module_param_named(message, msg_enable, int, 0); | ||
1322 | MODULE_PARM_DESC(message, "Message verbosity level (0=none, 31=all)"); | ||
diff --git a/drivers/net/ks8851.h b/drivers/net/ks8851.h new file mode 100644 index 000000000000..85abe147afbf --- /dev/null +++ b/drivers/net/ks8851.h | |||
@@ -0,0 +1,296 @@ | |||
1 | /* drivers/net/ks8851.h | ||
2 | * | ||
3 | * Copyright 2009 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * KS8851 register definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #define KS_CCR 0x08 | ||
14 | #define CCR_EEPROM (1 << 9) | ||
15 | #define CCR_SPI (1 << 8) | ||
16 | #define CCR_32PIN (1 << 0) | ||
17 | |||
18 | /* MAC address registers */ | ||
19 | #define KS_MARL 0x10 | ||
20 | #define KS_MARM 0x12 | ||
21 | #define KS_MARH 0x14 | ||
22 | |||
23 | #define KS_OBCR 0x20 | ||
24 | #define OBCR_ODS_16mA (1 << 6) | ||
25 | |||
26 | #define KS_EEPCR 0x22 | ||
27 | #define EEPCR_EESA (1 << 4) | ||
28 | #define EEPCR_EESB (1 << 3) | ||
29 | #define EEPCR_EEDO (1 << 2) | ||
30 | #define EEPCR_EESCK (1 << 1) | ||
31 | #define EEPCR_EECS (1 << 0) | ||
32 | |||
33 | #define KS_MBIR 0x24 | ||
34 | #define MBIR_TXMBF (1 << 12) | ||
35 | #define MBIR_TXMBFA (1 << 11) | ||
36 | #define MBIR_RXMBF (1 << 4) | ||
37 | #define MBIR_RXMBFA (1 << 3) | ||
38 | |||
39 | #define KS_GRR 0x26 | ||
40 | #define GRR_QMU (1 << 1) | ||
41 | #define GRR_GSR (1 << 0) | ||
42 | |||
43 | #define KS_WFCR 0x2A | ||
44 | #define WFCR_MPRXE (1 << 7) | ||
45 | #define WFCR_WF3E (1 << 3) | ||
46 | #define WFCR_WF2E (1 << 2) | ||
47 | #define WFCR_WF1E (1 << 1) | ||
48 | #define WFCR_WF0E (1 << 0) | ||
49 | |||
50 | #define KS_WF0CRC0 0x30 | ||
51 | #define KS_WF0CRC1 0x32 | ||
52 | #define KS_WF0BM0 0x34 | ||
53 | #define KS_WF0BM1 0x36 | ||
54 | #define KS_WF0BM2 0x38 | ||
55 | #define KS_WF0BM3 0x3A | ||
56 | |||
57 | #define KS_WF1CRC0 0x40 | ||
58 | #define KS_WF1CRC1 0x42 | ||
59 | #define KS_WF1BM0 0x44 | ||
60 | #define KS_WF1BM1 0x46 | ||
61 | #define KS_WF1BM2 0x48 | ||
62 | #define KS_WF1BM3 0x4A | ||
63 | |||
64 | #define KS_WF2CRC0 0x50 | ||
65 | #define KS_WF2CRC1 0x52 | ||
66 | #define KS_WF2BM0 0x54 | ||
67 | #define KS_WF2BM1 0x56 | ||
68 | #define KS_WF2BM2 0x58 | ||
69 | #define KS_WF2BM3 0x5A | ||
70 | |||
71 | #define KS_WF3CRC0 0x60 | ||
72 | #define KS_WF3CRC1 0x62 | ||
73 | #define KS_WF3BM0 0x64 | ||
74 | #define KS_WF3BM1 0x66 | ||
75 | #define KS_WF3BM2 0x68 | ||
76 | #define KS_WF3BM3 0x6A | ||
77 | |||
78 | #define KS_TXCR 0x70 | ||
79 | #define TXCR_TCGICMP (1 << 8) | ||
80 | #define TXCR_TCGUDP (1 << 7) | ||
81 | #define TXCR_TCGTCP (1 << 6) | ||
82 | #define TXCR_TCGIP (1 << 5) | ||
83 | #define TXCR_FTXQ (1 << 4) | ||
84 | #define TXCR_TXFCE (1 << 3) | ||
85 | #define TXCR_TXPE (1 << 2) | ||
86 | #define TXCR_TXCRC (1 << 1) | ||
87 | #define TXCR_TXE (1 << 0) | ||
88 | |||
89 | #define KS_TXSR 0x72 | ||
90 | #define TXSR_TXLC (1 << 13) | ||
91 | #define TXSR_TXMC (1 << 12) | ||
92 | #define TXSR_TXFID_MASK (0x3f << 0) | ||
93 | #define TXSR_TXFID_SHIFT (0) | ||
94 | #define TXSR_TXFID_GET(_v) (((_v) >> 0) & 0x3f) | ||
95 | |||
96 | #define KS_RXCR1 0x74 | ||
97 | #define RXCR1_FRXQ (1 << 15) | ||
98 | #define RXCR1_RXUDPFCC (1 << 14) | ||
99 | #define RXCR1_RXTCPFCC (1 << 13) | ||
100 | #define RXCR1_RXIPFCC (1 << 12) | ||
101 | #define RXCR1_RXPAFMA (1 << 11) | ||
102 | #define RXCR1_RXFCE (1 << 10) | ||
103 | #define RXCR1_RXEFE (1 << 9) | ||
104 | #define RXCR1_RXMAFMA (1 << 8) | ||
105 | #define RXCR1_RXBE (1 << 7) | ||
106 | #define RXCR1_RXME (1 << 6) | ||
107 | #define RXCR1_RXUE (1 << 5) | ||
108 | #define RXCR1_RXAE (1 << 4) | ||
109 | #define RXCR1_RXINVF (1 << 1) | ||
110 | #define RXCR1_RXE (1 << 0) | ||
111 | |||
112 | #define KS_RXCR2 0x76 | ||
113 | #define RXCR2_SRDBL_MASK (0x7 << 5) | ||
114 | #define RXCR2_SRDBL_SHIFT (5) | ||
115 | #define RXCR2_SRDBL_4B (0x0 << 5) | ||
116 | #define RXCR2_SRDBL_8B (0x1 << 5) | ||
117 | #define RXCR2_SRDBL_16B (0x2 << 5) | ||
118 | #define RXCR2_SRDBL_32B (0x3 << 5) | ||
119 | #define RXCR2_SRDBL_FRAME (0x4 << 5) | ||
120 | #define RXCR2_IUFFP (1 << 4) | ||
121 | #define RXCR2_RXIUFCEZ (1 << 3) | ||
122 | #define RXCR2_UDPLFE (1 << 2) | ||
123 | #define RXCR2_RXICMPFCC (1 << 1) | ||
124 | #define RXCR2_RXSAF (1 << 0) | ||
125 | |||
126 | #define KS_TXMIR 0x78 | ||
127 | |||
128 | #define KS_RXFHSR 0x7C | ||
129 | #define RXFSHR_RXFV (1 << 15) | ||
130 | #define RXFSHR_RXICMPFCS (1 << 13) | ||
131 | #define RXFSHR_RXIPFCS (1 << 12) | ||
132 | #define RXFSHR_RXTCPFCS (1 << 11) | ||
133 | #define RXFSHR_RXUDPFCS (1 << 10) | ||
134 | #define RXFSHR_RXBF (1 << 7) | ||
135 | #define RXFSHR_RXMF (1 << 6) | ||
136 | #define RXFSHR_RXUF (1 << 5) | ||
137 | #define RXFSHR_RXMR (1 << 4) | ||
138 | #define RXFSHR_RXFT (1 << 3) | ||
139 | #define RXFSHR_RXFTL (1 << 2) | ||
140 | #define RXFSHR_RXRF (1 << 1) | ||
141 | #define RXFSHR_RXCE (1 << 0) | ||
142 | |||
143 | #define KS_RXFHBCR 0x7E | ||
144 | #define KS_TXQCR 0x80 | ||
145 | #define TXQCR_AETFE (1 << 2) | ||
146 | #define TXQCR_TXQMAM (1 << 1) | ||
147 | #define TXQCR_METFE (1 << 0) | ||
148 | |||
149 | #define KS_RXQCR 0x82 | ||
150 | #define RXQCR_RXDTTS (1 << 12) | ||
151 | #define RXQCR_RXDBCTS (1 << 11) | ||
152 | #define RXQCR_RXFCTS (1 << 10) | ||
153 | #define RXQCR_RXIPHTOE (1 << 9) | ||
154 | #define RXQCR_RXDTTE (1 << 7) | ||
155 | #define RXQCR_RXDBCTE (1 << 6) | ||
156 | #define RXQCR_RXFCTE (1 << 5) | ||
157 | #define RXQCR_ADRFE (1 << 4) | ||
158 | #define RXQCR_SDA (1 << 3) | ||
159 | #define RXQCR_RRXEF (1 << 0) | ||
160 | |||
161 | #define KS_TXFDPR 0x84 | ||
162 | #define TXFDPR_TXFPAI (1 << 14) | ||
163 | #define TXFDPR_TXFP_MASK (0x7ff << 0) | ||
164 | #define TXFDPR_TXFP_SHIFT (0) | ||
165 | |||
166 | #define KS_RXFDPR 0x86 | ||
167 | #define RXFDPR_RXFPAI (1 << 14) | ||
168 | |||
169 | #define KS_RXDTTR 0x8C | ||
170 | #define KS_RXDBCTR 0x8E | ||
171 | |||
172 | #define KS_IER 0x90 | ||
173 | #define KS_ISR 0x92 | ||
174 | #define IRQ_LCI (1 << 15) | ||
175 | #define IRQ_TXI (1 << 14) | ||
176 | #define IRQ_RXI (1 << 13) | ||
177 | #define IRQ_RXOI (1 << 11) | ||
178 | #define IRQ_TXPSI (1 << 9) | ||
179 | #define IRQ_RXPSI (1 << 8) | ||
180 | #define IRQ_TXSAI (1 << 6) | ||
181 | #define IRQ_RXWFDI (1 << 5) | ||
182 | #define IRQ_RXMPDI (1 << 4) | ||
183 | #define IRQ_LDI (1 << 3) | ||
184 | #define IRQ_EDI (1 << 2) | ||
185 | #define IRQ_SPIBEI (1 << 1) | ||
186 | #define IRQ_DEDI (1 << 0) | ||
187 | |||
188 | #define KS_RXFCTR 0x9C | ||
189 | #define KS_RXFC 0x9D | ||
190 | #define RXFCTR_RXFC_MASK (0xff << 8) | ||
191 | #define RXFCTR_RXFC_SHIFT (8) | ||
192 | #define RXFCTR_RXFC_GET(_v) (((_v) >> 8) & 0xff) | ||
193 | #define RXFCTR_RXFCT_MASK (0xff << 0) | ||
194 | #define RXFCTR_RXFCT_SHIFT (0) | ||
195 | |||
196 | #define KS_TXNTFSR 0x9E | ||
197 | |||
198 | #define KS_MAHTR0 0xA0 | ||
199 | #define KS_MAHTR1 0xA2 | ||
200 | #define KS_MAHTR2 0xA4 | ||
201 | #define KS_MAHTR3 0xA6 | ||
202 | |||
203 | #define KS_FCLWR 0xB0 | ||
204 | #define KS_FCHWR 0xB2 | ||
205 | #define KS_FCOWR 0xB4 | ||
206 | |||
207 | #define KS_CIDER 0xC0 | ||
208 | #define CIDER_ID 0x8870 | ||
209 | #define CIDER_REV_MASK (0x7 << 1) | ||
210 | #define CIDER_REV_SHIFT (1) | ||
211 | #define CIDER_REV_GET(_v) (((_v) >> 1) & 0x7) | ||
212 | |||
213 | #define KS_CGCR 0xC6 | ||
214 | |||
215 | #define KS_IACR 0xC8 | ||
216 | #define IACR_RDEN (1 << 12) | ||
217 | #define IACR_TSEL_MASK (0x3 << 10) | ||
218 | #define IACR_TSEL_SHIFT (10) | ||
219 | #define IACR_TSEL_MIB (0x3 << 10) | ||
220 | #define IACR_ADDR_MASK (0x1f << 0) | ||
221 | #define IACR_ADDR_SHIFT (0) | ||
222 | |||
223 | #define KS_IADLR 0xD0 | ||
224 | #define KS_IAHDR 0xD2 | ||
225 | |||
226 | #define KS_PMECR 0xD4 | ||
227 | #define PMECR_PME_DELAY (1 << 14) | ||
228 | #define PMECR_PME_POL (1 << 12) | ||
229 | #define PMECR_WOL_WAKEUP (1 << 11) | ||
230 | #define PMECR_WOL_MAGICPKT (1 << 10) | ||
231 | #define PMECR_WOL_LINKUP (1 << 9) | ||
232 | #define PMECR_WOL_ENERGY (1 << 8) | ||
233 | #define PMECR_AUTO_WAKE_EN (1 << 7) | ||
234 | #define PMECR_WAKEUP_NORMAL (1 << 6) | ||
235 | #define PMECR_WKEVT_MASK (0xf << 2) | ||
236 | #define PMECR_WKEVT_SHIFT (2) | ||
237 | #define PMECR_WKEVT_GET(_v) (((_v) >> 2) & 0xf) | ||
238 | #define PMECR_WKEVT_ENERGY (0x1 << 2) | ||
239 | #define PMECR_WKEVT_LINK (0x2 << 2) | ||
240 | #define PMECR_WKEVT_MAGICPKT (0x4 << 2) | ||
241 | #define PMECR_WKEVT_FRAME (0x8 << 2) | ||
242 | #define PMECR_PM_MASK (0x3 << 0) | ||
243 | #define PMECR_PM_SHIFT (0) | ||
244 | #define PMECR_PM_NORMAL (0x0 << 0) | ||
245 | #define PMECR_PM_ENERGY (0x1 << 0) | ||
246 | #define PMECR_PM_SOFTDOWN (0x2 << 0) | ||
247 | #define PMECR_PM_POWERSAVE (0x3 << 0) | ||
248 | |||
249 | /* Standard MII PHY data */ | ||
250 | #define KS_P1MBCR 0xE4 | ||
251 | #define KS_P1MBSR 0xE6 | ||
252 | #define KS_PHY1ILR 0xE8 | ||
253 | #define KS_PHY1IHR 0xEA | ||
254 | #define KS_P1ANAR 0xEC | ||
255 | #define KS_P1ANLPR 0xEE | ||
256 | |||
257 | #define KS_P1SCLMD 0xF4 | ||
258 | #define P1SCLMD_LEDOFF (1 << 15) | ||
259 | #define P1SCLMD_TXIDS (1 << 14) | ||
260 | #define P1SCLMD_RESTARTAN (1 << 13) | ||
261 | #define P1SCLMD_DISAUTOMDIX (1 << 10) | ||
262 | #define P1SCLMD_FORCEMDIX (1 << 9) | ||
263 | #define P1SCLMD_AUTONEGEN (1 << 7) | ||
264 | #define P1SCLMD_FORCE100 (1 << 6) | ||
265 | #define P1SCLMD_FORCEFDX (1 << 5) | ||
266 | #define P1SCLMD_ADV_FLOW (1 << 4) | ||
267 | #define P1SCLMD_ADV_100BT_FDX (1 << 3) | ||
268 | #define P1SCLMD_ADV_100BT_HDX (1 << 2) | ||
269 | #define P1SCLMD_ADV_10BT_FDX (1 << 1) | ||
270 | #define P1SCLMD_ADV_10BT_HDX (1 << 0) | ||
271 | |||
272 | #define KS_P1CR 0xF6 | ||
273 | #define P1CR_HP_MDIX (1 << 15) | ||
274 | #define P1CR_REV_POL (1 << 13) | ||
275 | #define P1CR_OP_100M (1 << 10) | ||
276 | #define P1CR_OP_FDX (1 << 9) | ||
277 | #define P1CR_OP_MDI (1 << 7) | ||
278 | #define P1CR_AN_DONE (1 << 6) | ||
279 | #define P1CR_LINK_GOOD (1 << 5) | ||
280 | #define P1CR_PNTR_FLOW (1 << 4) | ||
281 | #define P1CR_PNTR_100BT_FDX (1 << 3) | ||
282 | #define P1CR_PNTR_100BT_HDX (1 << 2) | ||
283 | #define P1CR_PNTR_10BT_FDX (1 << 1) | ||
284 | #define P1CR_PNTR_10BT_HDX (1 << 0) | ||
285 | |||
286 | /* TX Frame control */ | ||
287 | |||
288 | #define TXFR_TXIC (1 << 15) | ||
289 | #define TXFR_TXFID_MASK (0x3f << 0) | ||
290 | #define TXFR_TXFID_SHIFT (0) | ||
291 | |||
292 | /* SPI frame opcodes */ | ||
293 | #define KS_SPIOP_RD (0x00) | ||
294 | #define KS_SPIOP_WR (0x40) | ||
295 | #define KS_SPIOP_RXFIFO (0x80) | ||
296 | #define KS_SPIOP_TXFIFO (0xC0) | ||
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index acd143da161d..61eabcac734c 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c | |||
@@ -179,7 +179,7 @@ static const struct net_device_ops macsonic_netdev_ops = { | |||
179 | .ndo_set_mac_address = eth_mac_addr, | 179 | .ndo_set_mac_address = eth_mac_addr, |
180 | }; | 180 | }; |
181 | 181 | ||
182 | static int __init macsonic_init(struct net_device *dev) | 182 | static int __devinit macsonic_init(struct net_device *dev) |
183 | { | 183 | { |
184 | struct sonic_local* lp = netdev_priv(dev); | 184 | struct sonic_local* lp = netdev_priv(dev); |
185 | 185 | ||
@@ -223,7 +223,7 @@ static int __init macsonic_init(struct net_device *dev) | |||
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
225 | 225 | ||
226 | static int __init mac_onboard_sonic_ethernet_addr(struct net_device *dev) | 226 | static int __devinit mac_onboard_sonic_ethernet_addr(struct net_device *dev) |
227 | { | 227 | { |
228 | struct sonic_local *lp = netdev_priv(dev); | 228 | struct sonic_local *lp = netdev_priv(dev); |
229 | const int prom_addr = ONBOARD_SONIC_PROM_BASE; | 229 | const int prom_addr = ONBOARD_SONIC_PROM_BASE; |
@@ -288,7 +288,7 @@ static int __init mac_onboard_sonic_ethernet_addr(struct net_device *dev) | |||
288 | } else return 0; | 288 | } else return 0; |
289 | } | 289 | } |
290 | 290 | ||
291 | static int __init mac_onboard_sonic_probe(struct net_device *dev) | 291 | static int __devinit mac_onboard_sonic_probe(struct net_device *dev) |
292 | { | 292 | { |
293 | /* Bwahahaha */ | 293 | /* Bwahahaha */ |
294 | static int once_is_more_than_enough; | 294 | static int once_is_more_than_enough; |
@@ -409,7 +409,7 @@ static int __init mac_onboard_sonic_probe(struct net_device *dev) | |||
409 | return macsonic_init(dev); | 409 | return macsonic_init(dev); |
410 | } | 410 | } |
411 | 411 | ||
412 | static int __init mac_nubus_sonic_ethernet_addr(struct net_device *dev, | 412 | static int __devinit mac_nubus_sonic_ethernet_addr(struct net_device *dev, |
413 | unsigned long prom_addr, | 413 | unsigned long prom_addr, |
414 | int id) | 414 | int id) |
415 | { | 415 | { |
@@ -424,7 +424,7 @@ static int __init mac_nubus_sonic_ethernet_addr(struct net_device *dev, | |||
424 | return 0; | 424 | return 0; |
425 | } | 425 | } |
426 | 426 | ||
427 | static int __init macsonic_ident(struct nubus_dev *ndev) | 427 | static int __devinit macsonic_ident(struct nubus_dev *ndev) |
428 | { | 428 | { |
429 | if (ndev->dr_hw == NUBUS_DRHW_ASANTE_LC && | 429 | if (ndev->dr_hw == NUBUS_DRHW_ASANTE_LC && |
430 | ndev->dr_sw == NUBUS_DRSW_SONIC_LC) | 430 | ndev->dr_sw == NUBUS_DRSW_SONIC_LC) |
@@ -449,7 +449,7 @@ static int __init macsonic_ident(struct nubus_dev *ndev) | |||
449 | return -1; | 449 | return -1; |
450 | } | 450 | } |
451 | 451 | ||
452 | static int __init mac_nubus_sonic_probe(struct net_device *dev) | 452 | static int __devinit mac_nubus_sonic_probe(struct net_device *dev) |
453 | { | 453 | { |
454 | static int slots; | 454 | static int slots; |
455 | struct nubus_dev* ndev = NULL; | 455 | struct nubus_dev* ndev = NULL; |
@@ -562,7 +562,7 @@ static int __init mac_nubus_sonic_probe(struct net_device *dev) | |||
562 | return macsonic_init(dev); | 562 | return macsonic_init(dev); |
563 | } | 563 | } |
564 | 564 | ||
565 | static int __init mac_sonic_probe(struct platform_device *pdev) | 565 | static int __devinit mac_sonic_probe(struct platform_device *pdev) |
566 | { | 566 | { |
567 | struct net_device *dev; | 567 | struct net_device *dev; |
568 | struct sonic_local *lp; | 568 | struct sonic_local *lp; |
@@ -575,6 +575,7 @@ static int __init mac_sonic_probe(struct platform_device *pdev) | |||
575 | lp = netdev_priv(dev); | 575 | lp = netdev_priv(dev); |
576 | lp->device = &pdev->dev; | 576 | lp->device = &pdev->dev; |
577 | SET_NETDEV_DEV(dev, &pdev->dev); | 577 | SET_NETDEV_DEV(dev, &pdev->dev); |
578 | platform_set_drvdata(pdev, dev); | ||
578 | 579 | ||
579 | /* This will catch fatal stuff like -ENOMEM as well as success */ | 580 | /* This will catch fatal stuff like -ENOMEM as well as success */ |
580 | err = mac_onboard_sonic_probe(dev); | 581 | err = mac_onboard_sonic_probe(dev); |
diff --git a/drivers/net/mlx4/cmd.c b/drivers/net/mlx4/cmd.c index 2845a0560b84..65ec77dc31f5 100644 --- a/drivers/net/mlx4/cmd.c +++ b/drivers/net/mlx4/cmd.c | |||
@@ -80,7 +80,9 @@ enum { | |||
80 | /* Bad management packet (silently discarded): */ | 80 | /* Bad management packet (silently discarded): */ |
81 | CMD_STAT_BAD_PKT = 0x30, | 81 | CMD_STAT_BAD_PKT = 0x30, |
82 | /* More outstanding CQEs in CQ than new CQ size: */ | 82 | /* More outstanding CQEs in CQ than new CQ size: */ |
83 | CMD_STAT_BAD_SIZE = 0x40 | 83 | CMD_STAT_BAD_SIZE = 0x40, |
84 | /* Multi Function device support required: */ | ||
85 | CMD_STAT_MULTI_FUNC_REQ = 0x50, | ||
84 | }; | 86 | }; |
85 | 87 | ||
86 | enum { | 88 | enum { |
@@ -128,6 +130,7 @@ static int mlx4_status_to_errno(u8 status) | |||
128 | [CMD_STAT_LAM_NOT_PRE] = -EAGAIN, | 130 | [CMD_STAT_LAM_NOT_PRE] = -EAGAIN, |
129 | [CMD_STAT_BAD_PKT] = -EINVAL, | 131 | [CMD_STAT_BAD_PKT] = -EINVAL, |
130 | [CMD_STAT_BAD_SIZE] = -ENOMEM, | 132 | [CMD_STAT_BAD_SIZE] = -ENOMEM, |
133 | [CMD_STAT_MULTI_FUNC_REQ] = -EACCES, | ||
131 | }; | 134 | }; |
132 | 135 | ||
133 | if (status >= ARRAY_SIZE(trans_table) || | 136 | if (status >= ARRAY_SIZE(trans_table) || |
diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c index 091f99052c91..86467b444ac6 100644 --- a/drivers/net/mlx4/en_ethtool.c +++ b/drivers/net/mlx4/en_ethtool.c | |||
@@ -220,7 +220,7 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
220 | { | 220 | { |
221 | cmd->autoneg = AUTONEG_DISABLE; | 221 | cmd->autoneg = AUTONEG_DISABLE; |
222 | cmd->supported = SUPPORTED_10000baseT_Full; | 222 | cmd->supported = SUPPORTED_10000baseT_Full; |
223 | cmd->advertising = SUPPORTED_10000baseT_Full; | 223 | cmd->advertising = ADVERTISED_1000baseT_Full; |
224 | if (netif_carrier_ok(dev)) { | 224 | if (netif_carrier_ok(dev)) { |
225 | cmd->speed = SPEED_10000; | 225 | cmd->speed = SPEED_10000; |
226 | cmd->duplex = DUPLEX_FULL; | 226 | cmd->duplex = DUPLEX_FULL; |
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c index 08c43f2ae72b..5a88b3f57693 100644 --- a/drivers/net/mlx4/en_tx.c +++ b/drivers/net/mlx4/en_tx.c | |||
@@ -249,6 +249,7 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv, | |||
249 | pci_unmap_page(mdev->pdev, | 249 | pci_unmap_page(mdev->pdev, |
250 | (dma_addr_t) be64_to_cpu(data->addr), | 250 | (dma_addr_t) be64_to_cpu(data->addr), |
251 | frag->size, PCI_DMA_TODEVICE); | 251 | frag->size, PCI_DMA_TODEVICE); |
252 | ++data; | ||
252 | } | 253 | } |
253 | } | 254 | } |
254 | /* Stamp the freed descriptor */ | 255 | /* Stamp the freed descriptor */ |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 018348c01193..dac621b1e9fc 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -729,7 +729,10 @@ static int mlx4_init_hca(struct mlx4_dev *dev) | |||
729 | 729 | ||
730 | err = mlx4_QUERY_FW(dev); | 730 | err = mlx4_QUERY_FW(dev); |
731 | if (err) { | 731 | if (err) { |
732 | mlx4_err(dev, "QUERY_FW command failed, aborting.\n"); | 732 | if (err == -EACCES) |
733 | mlx4_info(dev, "non-primary physical function, skipping.\n"); | ||
734 | else | ||
735 | mlx4_err(dev, "QUERY_FW command failed, aborting.\n"); | ||
733 | return err; | 736 | return err; |
734 | } | 737 | } |
735 | 738 | ||
@@ -1285,6 +1288,7 @@ static struct pci_device_id mlx4_pci_table[] = { | |||
1285 | { PCI_VDEVICE(MELLANOX, 0x6750) }, /* MT25408 "Hermon" EN 10GigE PCIe gen2 */ | 1288 | { PCI_VDEVICE(MELLANOX, 0x6750) }, /* MT25408 "Hermon" EN 10GigE PCIe gen2 */ |
1286 | { PCI_VDEVICE(MELLANOX, 0x6372) }, /* MT25458 ConnectX EN 10GBASE-T 10GigE */ | 1289 | { PCI_VDEVICE(MELLANOX, 0x6372) }, /* MT25458 ConnectX EN 10GBASE-T 10GigE */ |
1287 | { PCI_VDEVICE(MELLANOX, 0x675a) }, /* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */ | 1290 | { PCI_VDEVICE(MELLANOX, 0x675a) }, /* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */ |
1291 | { PCI_VDEVICE(MELLANOX, 0x6764) }, /* MT26468 ConnectX EN 10GigE PCIe gen2*/ | ||
1288 | { 0, } | 1292 | { 0, } |
1289 | }; | 1293 | }; |
1290 | 1294 | ||
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index c9bfe4eea189..78c088331f57 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -130,8 +130,8 @@ static int full_duplex[MAX_UNITS]; | |||
130 | static const char version[] __devinitconst = | 130 | static const char version[] __devinitconst = |
131 | KERN_INFO DRV_NAME " dp8381x driver, version " | 131 | KERN_INFO DRV_NAME " dp8381x driver, version " |
132 | DRV_VERSION ", " DRV_RELDATE "\n" | 132 | DRV_VERSION ", " DRV_RELDATE "\n" |
133 | KERN_INFO " originally by Donald Becker <becker@scyld.com>\n" | 133 | " originally by Donald Becker <becker@scyld.com>\n" |
134 | KERN_INFO " 2.4.x kernel port by Jeff Garzik, Tjeerd Mulder\n"; | 134 | " 2.4.x kernel port by Jeff Garzik, Tjeerd Mulder\n"; |
135 | 135 | ||
136 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 136 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
137 | MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver"); | 137 | MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver"); |
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 5c3e242428f1..992dbfffdb05 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -321,7 +321,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | if (ei_debug && version_printed++ == 0) | 323 | if (ei_debug && version_printed++ == 0) |
324 | printk(KERN_INFO "%s" KERN_INFO "%s", version1, version2); | 324 | printk(KERN_INFO "%s%s", version1, version2); |
325 | 325 | ||
326 | printk(KERN_INFO "NE*000 ethercard probe at %#3lx:", ioaddr); | 326 | printk(KERN_INFO "NE*000 ethercard probe at %#3lx:", ioaddr); |
327 | 327 | ||
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 970cedeb5f37..f86e05047d19 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -60,7 +60,18 @@ | |||
60 | #define _NETXEN_NIC_LINUX_SUBVERSION 30 | 60 | #define _NETXEN_NIC_LINUX_SUBVERSION 30 |
61 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.30" | 61 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.30" |
62 | 62 | ||
63 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 16) + ((b) << 8) + (c)) | 63 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) |
64 | #define _major(v) (((v) >> 24) & 0xff) | ||
65 | #define _minor(v) (((v) >> 16) & 0xff) | ||
66 | #define _build(v) ((v) & 0xffff) | ||
67 | |||
68 | /* version in image has weird encoding: | ||
69 | * 7:0 - major | ||
70 | * 15:8 - minor | ||
71 | * 31:16 - build (little endian) | ||
72 | */ | ||
73 | #define NETXEN_DECODE_VERSION(v) \ | ||
74 | NETXEN_VERSION_CODE(((v) & 0xff), (((v) >> 8) & 0xff), ((v) >> 16)) | ||
64 | 75 | ||
65 | #define NETXEN_NUM_FLASH_SECTORS (64) | 76 | #define NETXEN_NUM_FLASH_SECTORS (64) |
66 | #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) | 77 | #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) |
@@ -199,6 +210,7 @@ | |||
199 | #define NETXEN_CTX_SIGNATURE 0xdee0 | 210 | #define NETXEN_CTX_SIGNATURE 0xdee0 |
200 | #define NETXEN_CTX_SIGNATURE_V2 0x0002dee0 | 211 | #define NETXEN_CTX_SIGNATURE_V2 0x0002dee0 |
201 | #define NETXEN_CTX_RESET 0xbad0 | 212 | #define NETXEN_CTX_RESET 0xbad0 |
213 | #define NETXEN_CTX_D3_RESET 0xacc0 | ||
202 | #define NETXEN_RCV_PRODUCER(ringid) (ringid) | 214 | #define NETXEN_RCV_PRODUCER(ringid) (ringid) |
203 | 215 | ||
204 | #define PHAN_PEG_RCV_INITIALIZED 0xff01 | 216 | #define PHAN_PEG_RCV_INITIALIZED 0xff01 |
@@ -614,6 +626,7 @@ struct netxen_new_user_info { | |||
614 | #define NX_P2_MN_ROMIMAGE 0 | 626 | #define NX_P2_MN_ROMIMAGE 0 |
615 | #define NX_P3_CT_ROMIMAGE 1 | 627 | #define NX_P3_CT_ROMIMAGE 1 |
616 | #define NX_P3_MN_ROMIMAGE 2 | 628 | #define NX_P3_MN_ROMIMAGE 2 |
629 | #define NX_FLASH_ROMIMAGE 3 | ||
617 | 630 | ||
618 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */ | 631 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */ |
619 | 632 | ||
@@ -761,6 +774,8 @@ struct nx_host_tx_ring { | |||
761 | u32 crb_cmd_consumer; | 774 | u32 crb_cmd_consumer; |
762 | u32 num_desc; | 775 | u32 num_desc; |
763 | 776 | ||
777 | struct netdev_queue *txq; | ||
778 | |||
764 | struct netxen_cmd_buffer *cmd_buf_arr; | 779 | struct netxen_cmd_buffer *cmd_buf_arr; |
765 | struct cmd_desc_type0 *desc_head; | 780 | struct cmd_desc_type0 *desc_head; |
766 | dma_addr_t phys_addr; | 781 | dma_addr_t phys_addr; |
@@ -1243,7 +1258,7 @@ struct netxen_adapter { | |||
1243 | u32 resv3; | 1258 | u32 resv3; |
1244 | 1259 | ||
1245 | u8 has_link_events; | 1260 | u8 has_link_events; |
1246 | u8 resv1; | 1261 | u8 fw_type; |
1247 | u16 tx_context_id; | 1262 | u16 tx_context_id; |
1248 | u16 mtu; | 1263 | u16 mtu; |
1249 | u16 is_up; | 1264 | u16 is_up; |
@@ -1387,6 +1402,7 @@ void netxen_free_adapter_offload(struct netxen_adapter *adapter); | |||
1387 | int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); | 1402 | int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); |
1388 | int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); | 1403 | int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); |
1389 | int netxen_load_firmware(struct netxen_adapter *adapter); | 1404 | int netxen_load_firmware(struct netxen_adapter *adapter); |
1405 | int netxen_need_fw_reset(struct netxen_adapter *adapter); | ||
1390 | void netxen_request_firmware(struct netxen_adapter *adapter); | 1406 | void netxen_request_firmware(struct netxen_adapter *adapter); |
1391 | void netxen_release_firmware(struct netxen_adapter *adapter); | 1407 | void netxen_release_firmware(struct netxen_adapter *adapter); |
1392 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); | 1408 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); |
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index 4754f5cffad0..9f8ae4719e2f 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c | |||
@@ -684,10 +684,8 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter) | |||
684 | goto err_out_free; | 684 | goto err_out_free; |
685 | } else { | 685 | } else { |
686 | err = netxen_init_old_ctx(adapter); | 686 | err = netxen_init_old_ctx(adapter); |
687 | if (err) { | 687 | if (err) |
688 | netxen_free_hw_resources(adapter); | 688 | goto err_out_free; |
689 | return err; | ||
690 | } | ||
691 | } | 689 | } |
692 | 690 | ||
693 | return 0; | 691 | return 0; |
@@ -708,15 +706,18 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter) | |||
708 | int port = adapter->portnum; | 706 | int port = adapter->portnum; |
709 | 707 | ||
710 | if (adapter->fw_major >= 4) { | 708 | if (adapter->fw_major >= 4) { |
711 | nx_fw_cmd_destroy_tx_ctx(adapter); | ||
712 | nx_fw_cmd_destroy_rx_ctx(adapter); | 709 | nx_fw_cmd_destroy_rx_ctx(adapter); |
710 | nx_fw_cmd_destroy_tx_ctx(adapter); | ||
713 | } else { | 711 | } else { |
714 | netxen_api_lock(adapter); | 712 | netxen_api_lock(adapter); |
715 | NXWR32(adapter, CRB_CTX_SIGNATURE_REG(port), | 713 | NXWR32(adapter, CRB_CTX_SIGNATURE_REG(port), |
716 | NETXEN_CTX_RESET | port); | 714 | NETXEN_CTX_D3_RESET | port); |
717 | netxen_api_unlock(adapter); | 715 | netxen_api_unlock(adapter); |
718 | } | 716 | } |
719 | 717 | ||
718 | /* Allow dma queues to drain after context reset */ | ||
719 | msleep(20); | ||
720 | |||
720 | recv_ctx = &adapter->recv_ctx; | 721 | recv_ctx = &adapter->recv_ctx; |
721 | 722 | ||
722 | if (recv_ctx->hwctx != NULL) { | 723 | if (recv_ctx->hwctx != NULL) { |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 3cc047844af3..824103675648 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -853,6 +853,7 @@ enum { | |||
853 | #define NX_PEG_TUNE_CAPABILITY (NETXEN_CAM_RAM(0x02c)) | 853 | #define NX_PEG_TUNE_CAPABILITY (NETXEN_CAM_RAM(0x02c)) |
854 | 854 | ||
855 | #define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14) | 855 | #define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14) |
856 | #define NETXEN_PEG_ALIVE_COUNTER (NETXEN_CAM_RAM(0xb0)) | ||
856 | 857 | ||
857 | #define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC))) | 858 | #define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC))) |
858 | #define ISR_LEGACY_INT_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200) | 859 | #define ISR_LEGACY_INT_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200) |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index ce3b89d2cbb6..b9123d445c96 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -461,13 +461,14 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter, | |||
461 | i = 0; | 461 | i = 0; |
462 | 462 | ||
463 | tx_ring = adapter->tx_ring; | 463 | tx_ring = adapter->tx_ring; |
464 | netif_tx_lock_bh(adapter->netdev); | 464 | __netif_tx_lock_bh(tx_ring->txq); |
465 | 465 | ||
466 | producer = tx_ring->producer; | 466 | producer = tx_ring->producer; |
467 | consumer = tx_ring->sw_consumer; | 467 | consumer = tx_ring->sw_consumer; |
468 | 468 | ||
469 | if (nr_desc >= find_diff_among(producer, consumer, tx_ring->num_desc)) { | 469 | if (nr_desc >= netxen_tx_avail(tx_ring)) { |
470 | netif_tx_unlock_bh(adapter->netdev); | 470 | netif_tx_stop_queue(tx_ring->txq); |
471 | __netif_tx_unlock_bh(tx_ring->txq); | ||
471 | return -EBUSY; | 472 | return -EBUSY; |
472 | } | 473 | } |
473 | 474 | ||
@@ -490,7 +491,7 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter, | |||
490 | 491 | ||
491 | netxen_nic_update_cmd_producer(adapter, tx_ring); | 492 | netxen_nic_update_cmd_producer(adapter, tx_ring); |
492 | 493 | ||
493 | netif_tx_unlock_bh(adapter->netdev); | 494 | __netif_tx_unlock_bh(tx_ring->txq); |
494 | 495 | ||
495 | return 0; | 496 | return 0; |
496 | } | 497 | } |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 055bb61d6e77..7acf204e38c9 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -184,6 +184,13 @@ void netxen_free_sw_resources(struct netxen_adapter *adapter) | |||
184 | kfree(recv_ctx->rds_rings); | 184 | kfree(recv_ctx->rds_rings); |
185 | 185 | ||
186 | skip_rds: | 186 | skip_rds: |
187 | if (recv_ctx->sds_rings == NULL) | ||
188 | goto skip_sds; | ||
189 | |||
190 | for(ring = 0; ring < adapter->max_sds_rings; ring++) | ||
191 | recv_ctx->sds_rings[ring].consumer = 0; | ||
192 | |||
193 | skip_sds: | ||
187 | if (adapter->tx_ring == NULL) | 194 | if (adapter->tx_ring == NULL) |
188 | return; | 195 | return; |
189 | 196 | ||
@@ -214,6 +221,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) | |||
214 | adapter->tx_ring = tx_ring; | 221 | adapter->tx_ring = tx_ring; |
215 | 222 | ||
216 | tx_ring->num_desc = adapter->num_txd; | 223 | tx_ring->num_desc = adapter->num_txd; |
224 | tx_ring->txq = netdev_get_tx_queue(netdev, 0); | ||
217 | 225 | ||
218 | cmd_buf_arr = vmalloc(TX_BUFF_RINGSIZE(tx_ring)); | 226 | cmd_buf_arr = vmalloc(TX_BUFF_RINGSIZE(tx_ring)); |
219 | if (cmd_buf_arr == NULL) { | 227 | if (cmd_buf_arr == NULL) { |
@@ -684,11 +692,84 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
684 | } | 692 | } |
685 | 693 | ||
686 | int | 694 | int |
695 | netxen_need_fw_reset(struct netxen_adapter *adapter) | ||
696 | { | ||
697 | u32 count, old_count; | ||
698 | u32 val, version, major, minor, build; | ||
699 | int i, timeout; | ||
700 | u8 fw_type; | ||
701 | |||
702 | /* NX2031 firmware doesn't support heartbit */ | ||
703 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
704 | return 1; | ||
705 | |||
706 | /* last attempt had failed */ | ||
707 | if (NXRD32(adapter, CRB_CMDPEG_STATE) == PHAN_INITIALIZE_FAILED) | ||
708 | return 1; | ||
709 | |||
710 | old_count = count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); | ||
711 | |||
712 | for (i = 0; i < 10; i++) { | ||
713 | |||
714 | timeout = msleep_interruptible(200); | ||
715 | if (timeout) { | ||
716 | NXWR32(adapter, CRB_CMDPEG_STATE, | ||
717 | PHAN_INITIALIZE_FAILED); | ||
718 | return -EINTR; | ||
719 | } | ||
720 | |||
721 | count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); | ||
722 | if (count != old_count) | ||
723 | break; | ||
724 | } | ||
725 | |||
726 | /* firmware is dead */ | ||
727 | if (count == old_count) | ||
728 | return 1; | ||
729 | |||
730 | /* check if we have got newer or different file firmware */ | ||
731 | if (adapter->fw) { | ||
732 | |||
733 | const struct firmware *fw = adapter->fw; | ||
734 | |||
735 | val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_VERSION_OFFSET]); | ||
736 | version = NETXEN_DECODE_VERSION(val); | ||
737 | |||
738 | major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR); | ||
739 | minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR); | ||
740 | build = NXRD32(adapter, NETXEN_FW_VERSION_SUB); | ||
741 | |||
742 | if (version > NETXEN_VERSION_CODE(major, minor, build)) | ||
743 | return 1; | ||
744 | |||
745 | if (version == NETXEN_VERSION_CODE(major, minor, build)) { | ||
746 | |||
747 | val = NXRD32(adapter, NETXEN_MIU_MN_CONTROL); | ||
748 | fw_type = (val & 0x4) ? | ||
749 | NX_P3_CT_ROMIMAGE : NX_P3_MN_ROMIMAGE; | ||
750 | |||
751 | if (adapter->fw_type != fw_type) | ||
752 | return 1; | ||
753 | } | ||
754 | } | ||
755 | |||
756 | return 0; | ||
757 | } | ||
758 | |||
759 | static char *fw_name[] = { | ||
760 | "nxromimg.bin", "nx3fwct.bin", "nx3fwmn.bin", "flash", | ||
761 | }; | ||
762 | |||
763 | int | ||
687 | netxen_load_firmware(struct netxen_adapter *adapter) | 764 | netxen_load_firmware(struct netxen_adapter *adapter) |
688 | { | 765 | { |
689 | u64 *ptr64; | 766 | u64 *ptr64; |
690 | u32 i, flashaddr, size; | 767 | u32 i, flashaddr, size; |
691 | const struct firmware *fw = adapter->fw; | 768 | const struct firmware *fw = adapter->fw; |
769 | struct pci_dev *pdev = adapter->pdev; | ||
770 | |||
771 | dev_info(&pdev->dev, "loading firmware from %s\n", | ||
772 | fw_name[adapter->fw_type]); | ||
692 | 773 | ||
693 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | 774 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) |
694 | NXWR32(adapter, NETXEN_ROMUSB_GLB_CAS_RST, 1); | 775 | NXWR32(adapter, NETXEN_ROMUSB_GLB_CAS_RST, 1); |
@@ -756,7 +837,7 @@ static int | |||
756 | netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) | 837 | netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) |
757 | { | 838 | { |
758 | __le32 val; | 839 | __le32 val; |
759 | u32 major, minor, build, ver, min_ver, bios; | 840 | u32 ver, min_ver, bios; |
760 | struct pci_dev *pdev = adapter->pdev; | 841 | struct pci_dev *pdev = adapter->pdev; |
761 | const struct firmware *fw = adapter->fw; | 842 | const struct firmware *fw = adapter->fw; |
762 | 843 | ||
@@ -768,21 +849,18 @@ netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) | |||
768 | return -EINVAL; | 849 | return -EINVAL; |
769 | 850 | ||
770 | val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_VERSION_OFFSET]); | 851 | val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_VERSION_OFFSET]); |
771 | major = (__force u32)val & 0xff; | ||
772 | minor = ((__force u32)val >> 8) & 0xff; | ||
773 | build = (__force u32)val >> 16; | ||
774 | 852 | ||
775 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | 853 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) |
776 | min_ver = NETXEN_VERSION_CODE(4, 0, 216); | 854 | min_ver = NETXEN_VERSION_CODE(4, 0, 216); |
777 | else | 855 | else |
778 | min_ver = NETXEN_VERSION_CODE(3, 4, 216); | 856 | min_ver = NETXEN_VERSION_CODE(3, 4, 216); |
779 | 857 | ||
780 | ver = NETXEN_VERSION_CODE(major, minor, build); | 858 | ver = NETXEN_DECODE_VERSION(val); |
781 | 859 | ||
782 | if ((major > _NETXEN_NIC_LINUX_MAJOR) || (ver < min_ver)) { | 860 | if ((_major(ver) > _NETXEN_NIC_LINUX_MAJOR) || (ver < min_ver)) { |
783 | dev_err(&pdev->dev, | 861 | dev_err(&pdev->dev, |
784 | "%s: firmware version %d.%d.%d unsupported\n", | 862 | "%s: firmware version %d.%d.%d unsupported\n", |
785 | fwname, major, minor, build); | 863 | fwname, _major(ver), _minor(ver), _build(ver)); |
786 | return -EINVAL; | 864 | return -EINVAL; |
787 | } | 865 | } |
788 | 866 | ||
@@ -798,22 +876,21 @@ netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) | |||
798 | if (netxen_rom_fast_read(adapter, | 876 | if (netxen_rom_fast_read(adapter, |
799 | NX_FW_VERSION_OFFSET, (int *)&val)) | 877 | NX_FW_VERSION_OFFSET, (int *)&val)) |
800 | return -EIO; | 878 | return -EIO; |
801 | major = (__force u32)val & 0xff; | 879 | val = NETXEN_DECODE_VERSION(val); |
802 | minor = ((__force u32)val >> 8) & 0xff; | 880 | if (val > ver) { |
803 | build = (__force u32)val >> 16; | 881 | dev_info(&pdev->dev, "%s: firmware is older than flash\n", |
804 | if (NETXEN_VERSION_CODE(major, minor, build) > ver) | 882 | fwname); |
805 | return -EINVAL; | 883 | return -EINVAL; |
884 | } | ||
806 | 885 | ||
807 | NXWR32(adapter, NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | 886 | NXWR32(adapter, NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); |
808 | return 0; | 887 | return 0; |
809 | } | 888 | } |
810 | 889 | ||
811 | static char *fw_name[] = { "nxromimg.bin", "nx3fwct.bin", "nx3fwmn.bin" }; | ||
812 | |||
813 | void netxen_request_firmware(struct netxen_adapter *adapter) | 890 | void netxen_request_firmware(struct netxen_adapter *adapter) |
814 | { | 891 | { |
815 | u32 capability, flashed_ver; | 892 | u32 capability, flashed_ver; |
816 | int fw_type; | 893 | u8 fw_type; |
817 | struct pci_dev *pdev = adapter->pdev; | 894 | struct pci_dev *pdev = adapter->pdev; |
818 | int rc = 0; | 895 | int rc = 0; |
819 | 896 | ||
@@ -830,6 +907,8 @@ request_mn: | |||
830 | 907 | ||
831 | netxen_rom_fast_read(adapter, | 908 | netxen_rom_fast_read(adapter, |
832 | NX_FW_VERSION_OFFSET, (int *)&flashed_ver); | 909 | NX_FW_VERSION_OFFSET, (int *)&flashed_ver); |
910 | flashed_ver = NETXEN_DECODE_VERSION(flashed_ver); | ||
911 | |||
833 | if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) { | 912 | if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) { |
834 | capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY); | 913 | capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY); |
835 | if (capability & NX_PEG_TUNE_MN_PRESENT) { | 914 | if (capability & NX_PEG_TUNE_MN_PRESENT) { |
@@ -838,6 +917,10 @@ request_mn: | |||
838 | } | 917 | } |
839 | } | 918 | } |
840 | 919 | ||
920 | fw_type = NX_FLASH_ROMIMAGE; | ||
921 | adapter->fw = NULL; | ||
922 | goto done; | ||
923 | |||
841 | request_fw: | 924 | request_fw: |
842 | rc = request_firmware(&adapter->fw, fw_name[fw_type], &pdev->dev); | 925 | rc = request_firmware(&adapter->fw, fw_name[fw_type], &pdev->dev); |
843 | if (rc != 0) { | 926 | if (rc != 0) { |
@@ -846,6 +929,7 @@ request_fw: | |||
846 | goto request_mn; | 929 | goto request_mn; |
847 | } | 930 | } |
848 | 931 | ||
932 | fw_type = NX_FLASH_ROMIMAGE; | ||
849 | adapter->fw = NULL; | 933 | adapter->fw = NULL; |
850 | goto done; | 934 | goto done; |
851 | } | 935 | } |
@@ -859,16 +943,13 @@ request_fw: | |||
859 | goto request_mn; | 943 | goto request_mn; |
860 | } | 944 | } |
861 | 945 | ||
946 | fw_type = NX_FLASH_ROMIMAGE; | ||
862 | adapter->fw = NULL; | 947 | adapter->fw = NULL; |
863 | goto done; | 948 | goto done; |
864 | } | 949 | } |
865 | 950 | ||
866 | done: | 951 | done: |
867 | if (adapter->fw) | 952 | adapter->fw_type = fw_type; |
868 | dev_info(&pdev->dev, "loading firmware from file %s\n", | ||
869 | fw_name[fw_type]); | ||
870 | else | ||
871 | dev_info(&pdev->dev, "loading firmware from flash\n"); | ||
872 | } | 953 | } |
873 | 954 | ||
874 | 955 | ||
@@ -1327,10 +1408,10 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter) | |||
1327 | smp_mb(); | 1408 | smp_mb(); |
1328 | 1409 | ||
1329 | if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) { | 1410 | if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) { |
1330 | netif_tx_lock(netdev); | 1411 | __netif_tx_lock(tx_ring->txq, smp_processor_id()); |
1331 | if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH) | 1412 | if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH) |
1332 | netif_wake_queue(netdev); | 1413 | netif_wake_queue(netdev); |
1333 | netif_tx_unlock(netdev); | 1414 | __netif_tx_unlock(tx_ring->txq); |
1334 | } | 1415 | } |
1335 | } | 1416 | } |
1336 | /* | 1417 | /* |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 2919a2d12bf4..3cd8cfcf627b 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -215,13 +215,13 @@ netxen_napi_disable(struct netxen_adapter *adapter) | |||
215 | 215 | ||
216 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 216 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
217 | sds_ring = &recv_ctx->sds_rings[ring]; | 217 | sds_ring = &recv_ctx->sds_rings[ring]; |
218 | napi_disable(&sds_ring->napi); | ||
219 | netxen_nic_disable_int(sds_ring); | 218 | netxen_nic_disable_int(sds_ring); |
220 | synchronize_irq(sds_ring->irq); | 219 | napi_synchronize(&sds_ring->napi); |
220 | napi_disable(&sds_ring->napi); | ||
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) | 224 | static int nx_set_dma_mask(struct netxen_adapter *adapter) |
225 | { | 225 | { |
226 | struct pci_dev *pdev = adapter->pdev; | 226 | struct pci_dev *pdev = adapter->pdev; |
227 | uint64_t mask, cmask; | 227 | uint64_t mask, cmask; |
@@ -229,19 +229,17 @@ static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) | |||
229 | adapter->pci_using_dac = 0; | 229 | adapter->pci_using_dac = 0; |
230 | 230 | ||
231 | mask = DMA_BIT_MASK(32); | 231 | mask = DMA_BIT_MASK(32); |
232 | /* | ||
233 | * Consistent DMA mask is set to 32 bit because it cannot be set to | ||
234 | * 35 bits. For P3 also leave it at 32 bits for now. Only the rings | ||
235 | * come off this pool. | ||
236 | */ | ||
237 | cmask = DMA_BIT_MASK(32); | 232 | cmask = DMA_BIT_MASK(32); |
238 | 233 | ||
234 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | ||
239 | #ifndef CONFIG_IA64 | 235 | #ifndef CONFIG_IA64 |
240 | if (revision_id >= NX_P3_B0) | ||
241 | mask = DMA_BIT_MASK(39); | ||
242 | else if (revision_id == NX_P2_C1) | ||
243 | mask = DMA_BIT_MASK(35); | 236 | mask = DMA_BIT_MASK(35); |
244 | #endif | 237 | #endif |
238 | } else { | ||
239 | mask = DMA_BIT_MASK(39); | ||
240 | cmask = mask; | ||
241 | } | ||
242 | |||
245 | if (pci_set_dma_mask(pdev, mask) == 0 && | 243 | if (pci_set_dma_mask(pdev, mask) == 0 && |
246 | pci_set_consistent_dma_mask(pdev, cmask) == 0) { | 244 | pci_set_consistent_dma_mask(pdev, cmask) == 0) { |
247 | adapter->pci_using_dac = 1; | 245 | adapter->pci_using_dac = 1; |
@@ -256,7 +254,7 @@ static int | |||
256 | nx_update_dma_mask(struct netxen_adapter *adapter) | 254 | nx_update_dma_mask(struct netxen_adapter *adapter) |
257 | { | 255 | { |
258 | int change, shift, err; | 256 | int change, shift, err; |
259 | uint64_t mask, old_mask; | 257 | uint64_t mask, old_mask, old_cmask; |
260 | struct pci_dev *pdev = adapter->pdev; | 258 | struct pci_dev *pdev = adapter->pdev; |
261 | 259 | ||
262 | change = 0; | 260 | change = 0; |
@@ -272,14 +270,29 @@ nx_update_dma_mask(struct netxen_adapter *adapter) | |||
272 | 270 | ||
273 | if (change) { | 271 | if (change) { |
274 | old_mask = pdev->dma_mask; | 272 | old_mask = pdev->dma_mask; |
273 | old_cmask = pdev->dev.coherent_dma_mask; | ||
274 | |||
275 | mask = (1ULL<<(32+shift)) - 1; | 275 | mask = (1ULL<<(32+shift)) - 1; |
276 | 276 | ||
277 | err = pci_set_dma_mask(pdev, mask); | 277 | err = pci_set_dma_mask(pdev, mask); |
278 | if (err) | 278 | if (err) |
279 | return pci_set_dma_mask(pdev, old_mask); | 279 | goto err_out; |
280 | |||
281 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | ||
282 | |||
283 | err = pci_set_consistent_dma_mask(pdev, mask); | ||
284 | if (err) | ||
285 | goto err_out; | ||
286 | } | ||
287 | dev_info(&pdev->dev, "using %d-bit dma mask\n", 32+shift); | ||
280 | } | 288 | } |
281 | 289 | ||
282 | return 0; | 290 | return 0; |
291 | |||
292 | err_out: | ||
293 | pci_set_dma_mask(pdev, old_mask); | ||
294 | pci_set_consistent_dma_mask(pdev, old_cmask); | ||
295 | return err; | ||
283 | } | 296 | } |
284 | 297 | ||
285 | static void netxen_check_options(struct netxen_adapter *adapter) | 298 | static void netxen_check_options(struct netxen_adapter *adapter) |
@@ -718,6 +731,10 @@ netxen_start_firmware(struct netxen_adapter *adapter, int request_fw) | |||
718 | if (request_fw) | 731 | if (request_fw) |
719 | netxen_request_firmware(adapter); | 732 | netxen_request_firmware(adapter); |
720 | 733 | ||
734 | err = netxen_need_fw_reset(adapter); | ||
735 | if (err <= 0) | ||
736 | return err; | ||
737 | |||
721 | if (first_boot != 0x55555555) { | 738 | if (first_boot != 0x55555555) { |
722 | NXWR32(adapter, CRB_CMDPEG_STATE, 0); | 739 | NXWR32(adapter, CRB_CMDPEG_STATE, 0); |
723 | netxen_pinit_from_rom(adapter, 0); | 740 | netxen_pinit_from_rom(adapter, 0); |
@@ -829,11 +846,11 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) | |||
829 | 846 | ||
830 | adapter->ahw.linkup = 0; | 847 | adapter->ahw.linkup = 0; |
831 | 848 | ||
832 | netxen_napi_enable(adapter); | ||
833 | |||
834 | if (adapter->max_sds_rings > 1) | 849 | if (adapter->max_sds_rings > 1) |
835 | netxen_config_rss(adapter, 1); | 850 | netxen_config_rss(adapter, 1); |
836 | 851 | ||
852 | netxen_napi_enable(adapter); | ||
853 | |||
837 | if (adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION) | 854 | if (adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION) |
838 | netxen_linkevent_request(adapter, 1); | 855 | netxen_linkevent_request(adapter, 1); |
839 | else | 856 | else |
@@ -847,8 +864,9 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) | |||
847 | static void | 864 | static void |
848 | netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | 865 | netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) |
849 | { | 866 | { |
867 | spin_lock(&adapter->tx_clean_lock); | ||
850 | netif_carrier_off(netdev); | 868 | netif_carrier_off(netdev); |
851 | netif_stop_queue(netdev); | 869 | netif_tx_disable(netdev); |
852 | 870 | ||
853 | if (adapter->stop_port) | 871 | if (adapter->stop_port) |
854 | adapter->stop_port(adapter); | 872 | adapter->stop_port(adapter); |
@@ -859,9 +877,10 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | |||
859 | netxen_napi_disable(adapter); | 877 | netxen_napi_disable(adapter); |
860 | 878 | ||
861 | netxen_release_tx_buffers(adapter); | 879 | netxen_release_tx_buffers(adapter); |
880 | spin_unlock(&adapter->tx_clean_lock); | ||
862 | 881 | ||
863 | FLUSH_SCHEDULED_WORK(); | ||
864 | del_timer_sync(&adapter->watchdog_timer); | 882 | del_timer_sync(&adapter->watchdog_timer); |
883 | FLUSH_SCHEDULED_WORK(); | ||
865 | } | 884 | } |
866 | 885 | ||
867 | 886 | ||
@@ -939,8 +958,8 @@ err_out_free_sw: | |||
939 | static void | 958 | static void |
940 | netxen_nic_detach(struct netxen_adapter *adapter) | 959 | netxen_nic_detach(struct netxen_adapter *adapter) |
941 | { | 960 | { |
942 | netxen_release_rx_buffers(adapter); | ||
943 | netxen_free_hw_resources(adapter); | 961 | netxen_free_hw_resources(adapter); |
962 | netxen_release_rx_buffers(adapter); | ||
944 | netxen_nic_free_irq(adapter); | 963 | netxen_nic_free_irq(adapter); |
945 | netxen_free_sw_resources(adapter); | 964 | netxen_free_sw_resources(adapter); |
946 | 965 | ||
@@ -1000,7 +1019,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1000 | revision_id = pdev->revision; | 1019 | revision_id = pdev->revision; |
1001 | adapter->ahw.revision_id = revision_id; | 1020 | adapter->ahw.revision_id = revision_id; |
1002 | 1021 | ||
1003 | err = nx_set_dma_mask(adapter, revision_id); | 1022 | err = nx_set_dma_mask(adapter); |
1004 | if (err) | 1023 | if (err) |
1005 | goto err_out_free_netdev; | 1024 | goto err_out_free_netdev; |
1006 | 1025 | ||
@@ -1529,10 +1548,12 @@ static int netxen_nic_check_temp(struct netxen_adapter *adapter) | |||
1529 | printk(KERN_ALERT | 1548 | printk(KERN_ALERT |
1530 | "%s: Device temperature %d degrees C exceeds" | 1549 | "%s: Device temperature %d degrees C exceeds" |
1531 | " maximum allowed. Hardware has been shut down.\n", | 1550 | " maximum allowed. Hardware has been shut down.\n", |
1532 | netxen_nic_driver_name, temp_val); | 1551 | netdev->name, temp_val); |
1552 | |||
1553 | netif_device_detach(netdev); | ||
1554 | netxen_nic_down(adapter, netdev); | ||
1555 | netxen_nic_detach(adapter); | ||
1533 | 1556 | ||
1534 | netif_carrier_off(netdev); | ||
1535 | netif_stop_queue(netdev); | ||
1536 | rv = 1; | 1557 | rv = 1; |
1537 | } else if (temp_state == NX_TEMP_WARN) { | 1558 | } else if (temp_state == NX_TEMP_WARN) { |
1538 | if (adapter->temp == NX_TEMP_NORMAL) { | 1559 | if (adapter->temp == NX_TEMP_NORMAL) { |
@@ -1540,13 +1561,13 @@ static int netxen_nic_check_temp(struct netxen_adapter *adapter) | |||
1540 | "%s: Device temperature %d degrees C " | 1561 | "%s: Device temperature %d degrees C " |
1541 | "exceeds operating range." | 1562 | "exceeds operating range." |
1542 | " Immediate action needed.\n", | 1563 | " Immediate action needed.\n", |
1543 | netxen_nic_driver_name, temp_val); | 1564 | netdev->name, temp_val); |
1544 | } | 1565 | } |
1545 | } else { | 1566 | } else { |
1546 | if (adapter->temp == NX_TEMP_WARN) { | 1567 | if (adapter->temp == NX_TEMP_WARN) { |
1547 | printk(KERN_INFO | 1568 | printk(KERN_INFO |
1548 | "%s: Device temperature is now %d degrees C" | 1569 | "%s: Device temperature is now %d degrees C" |
1549 | " in normal range.\n", netxen_nic_driver_name, | 1570 | " in normal range.\n", netdev->name, |
1550 | temp_val); | 1571 | temp_val); |
1551 | } | 1572 | } |
1552 | } | 1573 | } |
@@ -1619,7 +1640,7 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1619 | struct netxen_adapter *adapter = | 1640 | struct netxen_adapter *adapter = |
1620 | container_of(work, struct netxen_adapter, watchdog_task); | 1641 | container_of(work, struct netxen_adapter, watchdog_task); |
1621 | 1642 | ||
1622 | if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter)) | 1643 | if (netxen_nic_check_temp(adapter)) |
1623 | return; | 1644 | return; |
1624 | 1645 | ||
1625 | if (!adapter->has_link_events) | 1646 | if (!adapter->has_link_events) |
@@ -1641,6 +1662,9 @@ static void netxen_tx_timeout_task(struct work_struct *work) | |||
1641 | struct netxen_adapter *adapter = | 1662 | struct netxen_adapter *adapter = |
1642 | container_of(work, struct netxen_adapter, tx_timeout_task); | 1663 | container_of(work, struct netxen_adapter, tx_timeout_task); |
1643 | 1664 | ||
1665 | if (!netif_running(adapter->netdev)) | ||
1666 | return; | ||
1667 | |||
1644 | printk(KERN_ERR "%s %s: transmit timeout, resetting.\n", | 1668 | printk(KERN_ERR "%s %s: transmit timeout, resetting.\n", |
1645 | netxen_nic_driver_name, adapter->netdev->name); | 1669 | netxen_nic_driver_name, adapter->netdev->name); |
1646 | 1670 | ||
@@ -1753,7 +1777,8 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) | |||
1753 | 1777 | ||
1754 | if ((work_done < budget) && tx_complete) { | 1778 | if ((work_done < budget) && tx_complete) { |
1755 | napi_complete(&sds_ring->napi); | 1779 | napi_complete(&sds_ring->napi); |
1756 | netxen_nic_enable_int(sds_ring); | 1780 | if (netif_running(adapter->netdev)) |
1781 | netxen_nic_enable_int(sds_ring); | ||
1757 | } | 1782 | } |
1758 | 1783 | ||
1759 | return work_done; | 1784 | return work_done; |
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index 8c1f6988f398..89f7b2ad5231 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c | |||
@@ -105,7 +105,7 @@ IVc. Errata | |||
105 | 105 | ||
106 | static char version[] __devinitdata = | 106 | static char version[] __devinitdata = |
107 | KERN_INFO NETDRV_DRIVER_LOAD_MSG "\n" | 107 | KERN_INFO NETDRV_DRIVER_LOAD_MSG "\n" |
108 | KERN_INFO " Support available from http://foo.com/bar/baz.html\n"; | 108 | " Support available from http://foo.com/bar/baz.html\n"; |
109 | 109 | ||
110 | /* define to 1 to enable PIO instead of MMIO */ | 110 | /* define to 1 to enable PIO instead of MMIO */ |
111 | #undef USE_IO_OPS | 111 | #undef USE_IO_OPS |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index ec7cf5ac4f05..690b9c76d34e 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -156,6 +156,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev); | |||
156 | static int el3_rx(struct net_device *dev); | 156 | static int el3_rx(struct net_device *dev); |
157 | static int el3_close(struct net_device *dev); | 157 | static int el3_close(struct net_device *dev); |
158 | static void el3_tx_timeout(struct net_device *dev); | 158 | static void el3_tx_timeout(struct net_device *dev); |
159 | static void set_rx_mode(struct net_device *dev); | ||
159 | static void set_multicast_list(struct net_device *dev); | 160 | static void set_multicast_list(struct net_device *dev); |
160 | static const struct ethtool_ops netdev_ethtool_ops; | 161 | static const struct ethtool_ops netdev_ethtool_ops; |
161 | 162 | ||
@@ -488,8 +489,7 @@ static void tc589_reset(struct net_device *dev) | |||
488 | /* Switch to register set 1 for normal use. */ | 489 | /* Switch to register set 1 for normal use. */ |
489 | EL3WINDOW(1); | 490 | EL3WINDOW(1); |
490 | 491 | ||
491 | /* Accept b-cast and phys addr only. */ | 492 | set_rx_mode(dev); |
492 | outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD); | ||
493 | outw(StatsEnable, ioaddr + EL3_CMD); /* Turn on statistics. */ | 493 | outw(StatsEnable, ioaddr + EL3_CMD); /* Turn on statistics. */ |
494 | outw(RxEnable, ioaddr + EL3_CMD); /* Enable the receiver. */ | 494 | outw(RxEnable, ioaddr + EL3_CMD); /* Enable the receiver. */ |
495 | outw(TxEnable, ioaddr + EL3_CMD); /* Enable transmitter. */ | 495 | outw(TxEnable, ioaddr + EL3_CMD); /* Enable transmitter. */ |
@@ -700,7 +700,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
700 | if (fifo_diag & 0x2000) { | 700 | if (fifo_diag & 0x2000) { |
701 | /* Rx underrun */ | 701 | /* Rx underrun */ |
702 | tc589_wait_for_completion(dev, RxReset); | 702 | tc589_wait_for_completion(dev, RxReset); |
703 | set_multicast_list(dev); | 703 | set_rx_mode(dev); |
704 | outw(RxEnable, ioaddr + EL3_CMD); | 704 | outw(RxEnable, ioaddr + EL3_CMD); |
705 | } | 705 | } |
706 | outw(AckIntr | AdapterFailure, ioaddr + EL3_CMD); | 706 | outw(AckIntr | AdapterFailure, ioaddr + EL3_CMD); |
@@ -905,14 +905,11 @@ static int el3_rx(struct net_device *dev) | |||
905 | return 0; | 905 | return 0; |
906 | } | 906 | } |
907 | 907 | ||
908 | static void set_multicast_list(struct net_device *dev) | 908 | static void set_rx_mode(struct net_device *dev) |
909 | { | 909 | { |
910 | struct el3_private *lp = netdev_priv(dev); | ||
911 | struct pcmcia_device *link = lp->p_dev; | ||
912 | unsigned int ioaddr = dev->base_addr; | 910 | unsigned int ioaddr = dev->base_addr; |
913 | u16 opts = SetRxFilter | RxStation | RxBroadcast; | 911 | u16 opts = SetRxFilter | RxStation | RxBroadcast; |
914 | 912 | ||
915 | if (!pcmcia_dev_present(link)) return; | ||
916 | if (dev->flags & IFF_PROMISC) | 913 | if (dev->flags & IFF_PROMISC) |
917 | opts |= RxMulticast | RxProm; | 914 | opts |= RxMulticast | RxProm; |
918 | else if (dev->mc_count || (dev->flags & IFF_ALLMULTI)) | 915 | else if (dev->mc_count || (dev->flags & IFF_ALLMULTI)) |
@@ -920,6 +917,16 @@ static void set_multicast_list(struct net_device *dev) | |||
920 | outw(opts, ioaddr + EL3_CMD); | 917 | outw(opts, ioaddr + EL3_CMD); |
921 | } | 918 | } |
922 | 919 | ||
920 | static void set_multicast_list(struct net_device *dev) | ||
921 | { | ||
922 | struct el3_private *priv = netdev_priv(dev); | ||
923 | unsigned long flags; | ||
924 | |||
925 | spin_lock_irqsave(&priv->lock, flags); | ||
926 | set_rx_mode(dev); | ||
927 | spin_unlock_irqrestore(&priv->lock, flags); | ||
928 | } | ||
929 | |||
923 | static int el3_close(struct net_device *dev) | 930 | static int el3_close(struct net_device *dev) |
924 | { | 931 | { |
925 | struct el3_private *lp = netdev_priv(dev); | 932 | struct el3_private *lp = netdev_priv(dev); |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index f51944b28cfa..06618af1a468 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -298,14 +298,11 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
298 | 298 | ||
299 | strcpy(info->node.dev_name, dev->name); | 299 | strcpy(info->node.dev_name, dev->name); |
300 | 300 | ||
301 | printk(KERN_INFO "%s: port %#3lx, irq %d,", | 301 | printk(KERN_INFO |
302 | dev->name, dev->base_addr, dev->irq); | 302 | "%s: port %#3lx, irq %d, mmio %#5lx, sram %#5lx, hwaddr=%pM\n", |
303 | printk (" mmio %#5lx,", (u_long)ti->mmio); | 303 | dev->name, dev->base_addr, dev->irq, |
304 | printk (" sram %#5lx,", (u_long)ti->sram_base << 12); | 304 | (u_long)ti->mmio, (u_long)(ti->sram_base << 12), |
305 | printk ("\n" KERN_INFO " hwaddr="); | 305 | dev->dev_addr); |
306 | for (i = 0; i < TR_ALEN; i++) | ||
307 | printk("%02X", dev->dev_addr[i]); | ||
308 | printk("\n"); | ||
309 | return 0; | 306 | return 0; |
310 | 307 | ||
311 | cs_failed: | 308 | cs_failed: |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 02ef63ed1f99..36de91baf238 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1425,15 +1425,12 @@ static void BuildLAF(int *ladrf, int *adr) | |||
1425 | ladrf[byte] |= (1 << (hashcode & 7)); | 1425 | ladrf[byte] |= (1 << (hashcode & 7)); |
1426 | 1426 | ||
1427 | #ifdef PCMCIA_DEBUG | 1427 | #ifdef PCMCIA_DEBUG |
1428 | if (pc_debug > 2) { | 1428 | if (pc_debug > 2) |
1429 | printk(KERN_DEBUG " adr ="); | 1429 | printk(KERN_DEBUG " adr =%pM\n", adr); |
1430 | for (i = 0; i < 6; i++) | 1430 | printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode); |
1431 | printk(" %02X", adr[i]); | 1431 | for (i = 0; i < 8; i++) |
1432 | printk("\n" KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63]" | 1432 | printk(KERN_CONT " %02X", ladrf[i]); |
1433 | " =", hashcode); | 1433 | printk(KERN_CONT "\n"); |
1434 | for (i = 0; i < 8; i++) | ||
1435 | printk(" %02X", ladrf[i]); | ||
1436 | printk("\n"); | ||
1437 | } | 1434 | } |
1438 | #endif | 1435 | #endif |
1439 | } /* BuildLAF */ | 1436 | } /* BuildLAF */ |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 652a36888361..9ef1c1bfa83d 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1727,6 +1727,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1727 | PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50), | 1727 | PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50), |
1728 | PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110), | 1728 | PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110), |
1729 | PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941), | 1729 | PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941), |
1730 | PCMCIA_DEVICE_PROD_ID12("RIOS Systems Co.", "PC CARD3 ETHERNET", 0x7dd33481, 0x10b41826), | ||
1730 | PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df), | 1731 | PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df), |
1731 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0), | 1732 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0), |
1732 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd), | 1733 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd), |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 1c35e1d637a0..a646a445fda9 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -485,7 +485,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
485 | &new_ring_dma_addr); | 485 | &new_ring_dma_addr); |
486 | if (new_tx_ring == NULL) { | 486 | if (new_tx_ring == NULL) { |
487 | if (netif_msg_drv(lp)) | 487 | if (netif_msg_drv(lp)) |
488 | printk("\n" KERN_ERR | 488 | printk(KERN_ERR |
489 | "%s: Consistent memory allocation failed.\n", | 489 | "%s: Consistent memory allocation failed.\n", |
490 | dev->name); | 490 | dev->name); |
491 | return; | 491 | return; |
@@ -496,7 +496,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
496 | GFP_ATOMIC); | 496 | GFP_ATOMIC); |
497 | if (!new_dma_addr_list) { | 497 | if (!new_dma_addr_list) { |
498 | if (netif_msg_drv(lp)) | 498 | if (netif_msg_drv(lp)) |
499 | printk("\n" KERN_ERR | 499 | printk(KERN_ERR |
500 | "%s: Memory allocation failed.\n", dev->name); | 500 | "%s: Memory allocation failed.\n", dev->name); |
501 | goto free_new_tx_ring; | 501 | goto free_new_tx_ring; |
502 | } | 502 | } |
@@ -505,7 +505,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
505 | GFP_ATOMIC); | 505 | GFP_ATOMIC); |
506 | if (!new_skb_list) { | 506 | if (!new_skb_list) { |
507 | if (netif_msg_drv(lp)) | 507 | if (netif_msg_drv(lp)) |
508 | printk("\n" KERN_ERR | 508 | printk(KERN_ERR |
509 | "%s: Memory allocation failed.\n", dev->name); | 509 | "%s: Memory allocation failed.\n", dev->name); |
510 | goto free_new_lists; | 510 | goto free_new_lists; |
511 | } | 511 | } |
@@ -563,7 +563,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
563 | &new_ring_dma_addr); | 563 | &new_ring_dma_addr); |
564 | if (new_rx_ring == NULL) { | 564 | if (new_rx_ring == NULL) { |
565 | if (netif_msg_drv(lp)) | 565 | if (netif_msg_drv(lp)) |
566 | printk("\n" KERN_ERR | 566 | printk(KERN_ERR |
567 | "%s: Consistent memory allocation failed.\n", | 567 | "%s: Consistent memory allocation failed.\n", |
568 | dev->name); | 568 | dev->name); |
569 | return; | 569 | return; |
@@ -574,7 +574,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
574 | GFP_ATOMIC); | 574 | GFP_ATOMIC); |
575 | if (!new_dma_addr_list) { | 575 | if (!new_dma_addr_list) { |
576 | if (netif_msg_drv(lp)) | 576 | if (netif_msg_drv(lp)) |
577 | printk("\n" KERN_ERR | 577 | printk(KERN_ERR |
578 | "%s: Memory allocation failed.\n", dev->name); | 578 | "%s: Memory allocation failed.\n", dev->name); |
579 | goto free_new_rx_ring; | 579 | goto free_new_rx_ring; |
580 | } | 580 | } |
@@ -583,7 +583,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
583 | GFP_ATOMIC); | 583 | GFP_ATOMIC); |
584 | if (!new_skb_list) { | 584 | if (!new_skb_list) { |
585 | if (netif_msg_drv(lp)) | 585 | if (netif_msg_drv(lp)) |
586 | printk("\n" KERN_ERR | 586 | printk(KERN_ERR |
587 | "%s: Memory allocation failed.\n", dev->name); | 587 | "%s: Memory allocation failed.\n", dev->name); |
588 | goto free_new_lists; | 588 | goto free_new_lists; |
589 | } | 589 | } |
@@ -1611,8 +1611,11 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1611 | if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 | 1611 | if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 |
1612 | && pcnet32_dwio_check(ioaddr)) { | 1612 | && pcnet32_dwio_check(ioaddr)) { |
1613 | a = &pcnet32_dwio; | 1613 | a = &pcnet32_dwio; |
1614 | } else | 1614 | } else { |
1615 | if (pcnet32_debug & NETIF_MSG_PROBE) | ||
1616 | printk(KERN_ERR PFX "No access methods\n"); | ||
1615 | goto err_release_region; | 1617 | goto err_release_region; |
1618 | } | ||
1616 | } | 1619 | } |
1617 | 1620 | ||
1618 | chip_version = | 1621 | chip_version = |
@@ -1719,7 +1722,9 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1719 | ret = -ENOMEM; | 1722 | ret = -ENOMEM; |
1720 | goto err_release_region; | 1723 | goto err_release_region; |
1721 | } | 1724 | } |
1722 | SET_NETDEV_DEV(dev, &pdev->dev); | 1725 | |
1726 | if (pdev) | ||
1727 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
1723 | 1728 | ||
1724 | if (pcnet32_debug & NETIF_MSG_PROBE) | 1729 | if (pcnet32_debug & NETIF_MSG_PROBE) |
1725 | printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr); | 1730 | printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr); |
@@ -1766,38 +1771,38 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1766 | /* Version 0x2623 and 0x2624 */ | 1771 | /* Version 0x2623 and 0x2624 */ |
1767 | if (((chip_version + 1) & 0xfffe) == 0x2624) { | 1772 | if (((chip_version + 1) & 0xfffe) == 0x2624) { |
1768 | i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */ | 1773 | i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */ |
1769 | printk("\n" KERN_INFO " tx_start_pt(0x%04x):", i); | 1774 | printk(KERN_INFO " tx_start_pt(0x%04x):", i); |
1770 | switch (i >> 10) { | 1775 | switch (i >> 10) { |
1771 | case 0: | 1776 | case 0: |
1772 | printk(" 20 bytes,"); | 1777 | printk(KERN_CONT " 20 bytes,"); |
1773 | break; | 1778 | break; |
1774 | case 1: | 1779 | case 1: |
1775 | printk(" 64 bytes,"); | 1780 | printk(KERN_CONT " 64 bytes,"); |
1776 | break; | 1781 | break; |
1777 | case 2: | 1782 | case 2: |
1778 | printk(" 128 bytes,"); | 1783 | printk(KERN_CONT " 128 bytes,"); |
1779 | break; | 1784 | break; |
1780 | case 3: | 1785 | case 3: |
1781 | printk("~220 bytes,"); | 1786 | printk(KERN_CONT "~220 bytes,"); |
1782 | break; | 1787 | break; |
1783 | } | 1788 | } |
1784 | i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */ | 1789 | i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */ |
1785 | printk(" BCR18(%x):", i & 0xffff); | 1790 | printk(KERN_CONT " BCR18(%x):", i & 0xffff); |
1786 | if (i & (1 << 5)) | 1791 | if (i & (1 << 5)) |
1787 | printk("BurstWrEn "); | 1792 | printk(KERN_CONT "BurstWrEn "); |
1788 | if (i & (1 << 6)) | 1793 | if (i & (1 << 6)) |
1789 | printk("BurstRdEn "); | 1794 | printk(KERN_CONT "BurstRdEn "); |
1790 | if (i & (1 << 7)) | 1795 | if (i & (1 << 7)) |
1791 | printk("DWordIO "); | 1796 | printk(KERN_CONT "DWordIO "); |
1792 | if (i & (1 << 11)) | 1797 | if (i & (1 << 11)) |
1793 | printk("NoUFlow "); | 1798 | printk(KERN_CONT "NoUFlow "); |
1794 | i = a->read_bcr(ioaddr, 25); | 1799 | i = a->read_bcr(ioaddr, 25); |
1795 | printk("\n" KERN_INFO " SRAMSIZE=0x%04x,", i << 8); | 1800 | printk(KERN_INFO " SRAMSIZE=0x%04x,", i << 8); |
1796 | i = a->read_bcr(ioaddr, 26); | 1801 | i = a->read_bcr(ioaddr, 26); |
1797 | printk(" SRAM_BND=0x%04x,", i << 8); | 1802 | printk(KERN_CONT " SRAM_BND=0x%04x,", i << 8); |
1798 | i = a->read_bcr(ioaddr, 27); | 1803 | i = a->read_bcr(ioaddr, 27); |
1799 | if (i & (1 << 14)) | 1804 | if (i & (1 << 14)) |
1800 | printk("LowLatRx"); | 1805 | printk(KERN_CONT "LowLatRx"); |
1801 | } | 1806 | } |
1802 | } | 1807 | } |
1803 | 1808 | ||
@@ -1818,7 +1823,6 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1818 | 1823 | ||
1819 | spin_lock_init(&lp->lock); | 1824 | spin_lock_init(&lp->lock); |
1820 | 1825 | ||
1821 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
1822 | lp->name = chipname; | 1826 | lp->name = chipname; |
1823 | lp->shared_irq = shared; | 1827 | lp->shared_irq = shared; |
1824 | lp->tx_ring_size = TX_RING_SIZE; /* default tx ring size */ | 1828 | lp->tx_ring_size = TX_RING_SIZE; /* default tx ring size */ |
@@ -1852,12 +1856,6 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1852 | ((cards_found >= MAX_UNITS) || full_duplex[cards_found])) | 1856 | ((cards_found >= MAX_UNITS) || full_duplex[cards_found])) |
1853 | lp->options |= PCNET32_PORT_FD; | 1857 | lp->options |= PCNET32_PORT_FD; |
1854 | 1858 | ||
1855 | if (!a) { | ||
1856 | if (pcnet32_debug & NETIF_MSG_PROBE) | ||
1857 | printk(KERN_ERR PFX "No access methods\n"); | ||
1858 | ret = -ENODEV; | ||
1859 | goto err_free_consistent; | ||
1860 | } | ||
1861 | lp->a = *a; | 1859 | lp->a = *a; |
1862 | 1860 | ||
1863 | /* prior to register_netdev, dev->name is not yet correct */ | 1861 | /* prior to register_netdev, dev->name is not yet correct */ |
@@ -1973,14 +1971,13 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1973 | 1971 | ||
1974 | return 0; | 1972 | return 0; |
1975 | 1973 | ||
1976 | err_free_ring: | 1974 | err_free_ring: |
1977 | pcnet32_free_ring(dev); | 1975 | pcnet32_free_ring(dev); |
1978 | err_free_consistent: | ||
1979 | pci_free_consistent(lp->pci_dev, sizeof(*lp->init_block), | 1976 | pci_free_consistent(lp->pci_dev, sizeof(*lp->init_block), |
1980 | lp->init_block, lp->init_dma_addr); | 1977 | lp->init_block, lp->init_dma_addr); |
1981 | err_free_netdev: | 1978 | err_free_netdev: |
1982 | free_netdev(dev); | 1979 | free_netdev(dev); |
1983 | err_release_region: | 1980 | err_release_region: |
1984 | release_region(ioaddr, PCNET32_TOTAL_SIZE); | 1981 | release_region(ioaddr, PCNET32_TOTAL_SIZE); |
1985 | return ret; | 1982 | return ret; |
1986 | } | 1983 | } |
@@ -1996,7 +1993,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
1996 | &lp->tx_ring_dma_addr); | 1993 | &lp->tx_ring_dma_addr); |
1997 | if (lp->tx_ring == NULL) { | 1994 | if (lp->tx_ring == NULL) { |
1998 | if (netif_msg_drv(lp)) | 1995 | if (netif_msg_drv(lp)) |
1999 | printk("\n" KERN_ERR PFX | 1996 | printk(KERN_ERR PFX |
2000 | "%s: Consistent memory allocation failed.\n", | 1997 | "%s: Consistent memory allocation failed.\n", |
2001 | name); | 1998 | name); |
2002 | return -ENOMEM; | 1999 | return -ENOMEM; |
@@ -2008,7 +2005,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2008 | &lp->rx_ring_dma_addr); | 2005 | &lp->rx_ring_dma_addr); |
2009 | if (lp->rx_ring == NULL) { | 2006 | if (lp->rx_ring == NULL) { |
2010 | if (netif_msg_drv(lp)) | 2007 | if (netif_msg_drv(lp)) |
2011 | printk("\n" KERN_ERR PFX | 2008 | printk(KERN_ERR PFX |
2012 | "%s: Consistent memory allocation failed.\n", | 2009 | "%s: Consistent memory allocation failed.\n", |
2013 | name); | 2010 | name); |
2014 | return -ENOMEM; | 2011 | return -ENOMEM; |
@@ -2018,7 +2015,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2018 | GFP_ATOMIC); | 2015 | GFP_ATOMIC); |
2019 | if (!lp->tx_dma_addr) { | 2016 | if (!lp->tx_dma_addr) { |
2020 | if (netif_msg_drv(lp)) | 2017 | if (netif_msg_drv(lp)) |
2021 | printk("\n" KERN_ERR PFX | 2018 | printk(KERN_ERR PFX |
2022 | "%s: Memory allocation failed.\n", name); | 2019 | "%s: Memory allocation failed.\n", name); |
2023 | return -ENOMEM; | 2020 | return -ENOMEM; |
2024 | } | 2021 | } |
@@ -2027,7 +2024,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2027 | GFP_ATOMIC); | 2024 | GFP_ATOMIC); |
2028 | if (!lp->rx_dma_addr) { | 2025 | if (!lp->rx_dma_addr) { |
2029 | if (netif_msg_drv(lp)) | 2026 | if (netif_msg_drv(lp)) |
2030 | printk("\n" KERN_ERR PFX | 2027 | printk(KERN_ERR PFX |
2031 | "%s: Memory allocation failed.\n", name); | 2028 | "%s: Memory allocation failed.\n", name); |
2032 | return -ENOMEM; | 2029 | return -ENOMEM; |
2033 | } | 2030 | } |
@@ -2036,7 +2033,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2036 | GFP_ATOMIC); | 2033 | GFP_ATOMIC); |
2037 | if (!lp->tx_skbuff) { | 2034 | if (!lp->tx_skbuff) { |
2038 | if (netif_msg_drv(lp)) | 2035 | if (netif_msg_drv(lp)) |
2039 | printk("\n" KERN_ERR PFX | 2036 | printk(KERN_ERR PFX |
2040 | "%s: Memory allocation failed.\n", name); | 2037 | "%s: Memory allocation failed.\n", name); |
2041 | return -ENOMEM; | 2038 | return -ENOMEM; |
2042 | } | 2039 | } |
@@ -2045,7 +2042,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2045 | GFP_ATOMIC); | 2042 | GFP_ATOMIC); |
2046 | if (!lp->rx_skbuff) { | 2043 | if (!lp->rx_skbuff) { |
2047 | if (netif_msg_drv(lp)) | 2044 | if (netif_msg_drv(lp)) |
2048 | printk("\n" KERN_ERR PFX | 2045 | printk(KERN_ERR PFX |
2049 | "%s: Memory allocation failed.\n", name); | 2046 | "%s: Memory allocation failed.\n", name); |
2050 | return -ENOMEM; | 2047 | return -ENOMEM; |
2051 | } | 2048 | } |
@@ -2089,6 +2086,7 @@ static void pcnet32_free_ring(struct net_device *dev) | |||
2089 | static int pcnet32_open(struct net_device *dev) | 2086 | static int pcnet32_open(struct net_device *dev) |
2090 | { | 2087 | { |
2091 | struct pcnet32_private *lp = netdev_priv(dev); | 2088 | struct pcnet32_private *lp = netdev_priv(dev); |
2089 | struct pci_dev *pdev = lp->pci_dev; | ||
2092 | unsigned long ioaddr = dev->base_addr; | 2090 | unsigned long ioaddr = dev->base_addr; |
2093 | u16 val; | 2091 | u16 val; |
2094 | int i; | 2092 | int i; |
@@ -2149,9 +2147,9 @@ static int pcnet32_open(struct net_device *dev) | |||
2149 | lp->a.write_csr(ioaddr, 124, val); | 2147 | lp->a.write_csr(ioaddr, 124, val); |
2150 | 2148 | ||
2151 | /* Allied Telesyn AT 2700/2701 FX are 100Mbit only and do not negotiate */ | 2149 | /* Allied Telesyn AT 2700/2701 FX are 100Mbit only and do not negotiate */ |
2152 | if (lp->pci_dev->subsystem_vendor == PCI_VENDOR_ID_AT && | 2150 | if (pdev && pdev->subsystem_vendor == PCI_VENDOR_ID_AT && |
2153 | (lp->pci_dev->subsystem_device == PCI_SUBDEVICE_ID_AT_2700FX || | 2151 | (pdev->subsystem_device == PCI_SUBDEVICE_ID_AT_2700FX || |
2154 | lp->pci_dev->subsystem_device == PCI_SUBDEVICE_ID_AT_2701FX)) { | 2152 | pdev->subsystem_device == PCI_SUBDEVICE_ID_AT_2701FX)) { |
2155 | if (lp->options & PCNET32_PORT_ASEL) { | 2153 | if (lp->options & PCNET32_PORT_ASEL) { |
2156 | lp->options = PCNET32_PORT_FD | PCNET32_PORT_100; | 2154 | lp->options = PCNET32_PORT_FD | PCNET32_PORT_100; |
2157 | if (netif_msg_link(lp)) | 2155 | if (netif_msg_link(lp)) |
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c index 33984b737233..22cdd451fb82 100644 --- a/drivers/net/phy/mdio-gpio.c +++ b/drivers/net/phy/mdio-gpio.c | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #ifdef CONFIG_OF_GPIO | 31 | #ifdef CONFIG_OF_GPIO |
32 | #include <linux/of_gpio.h> | 32 | #include <linux/of_gpio.h> |
33 | #include <linux/of_mdio.h> | ||
33 | #include <linux/of_platform.h> | 34 | #include <linux/of_platform.h> |
34 | #endif | 35 | #endif |
35 | 36 | ||
@@ -81,13 +82,12 @@ static struct mdiobb_ops mdio_gpio_ops = { | |||
81 | .get_mdio_data = mdio_get, | 82 | .get_mdio_data = mdio_get, |
82 | }; | 83 | }; |
83 | 84 | ||
84 | static int __devinit mdio_gpio_bus_init(struct device *dev, | 85 | static struct mii_bus * __devinit mdio_gpio_bus_init(struct device *dev, |
85 | struct mdio_gpio_platform_data *pdata, | 86 | struct mdio_gpio_platform_data *pdata, |
86 | int bus_id) | 87 | int bus_id) |
87 | { | 88 | { |
88 | struct mii_bus *new_bus; | 89 | struct mii_bus *new_bus; |
89 | struct mdio_gpio_info *bitbang; | 90 | struct mdio_gpio_info *bitbang; |
90 | int ret = -ENOMEM; | ||
91 | int i; | 91 | int i; |
92 | 92 | ||
93 | bitbang = kzalloc(sizeof(*bitbang), GFP_KERNEL); | 93 | bitbang = kzalloc(sizeof(*bitbang), GFP_KERNEL); |
@@ -104,8 +104,6 @@ static int __devinit mdio_gpio_bus_init(struct device *dev, | |||
104 | 104 | ||
105 | new_bus->name = "GPIO Bitbanged MDIO", | 105 | new_bus->name = "GPIO Bitbanged MDIO", |
106 | 106 | ||
107 | ret = -ENODEV; | ||
108 | |||
109 | new_bus->phy_mask = pdata->phy_mask; | 107 | new_bus->phy_mask = pdata->phy_mask; |
110 | new_bus->irq = pdata->irqs; | 108 | new_bus->irq = pdata->irqs; |
111 | new_bus->parent = dev; | 109 | new_bus->parent = dev; |
@@ -129,15 +127,8 @@ static int __devinit mdio_gpio_bus_init(struct device *dev, | |||
129 | 127 | ||
130 | dev_set_drvdata(dev, new_bus); | 128 | dev_set_drvdata(dev, new_bus); |
131 | 129 | ||
132 | ret = mdiobus_register(new_bus); | 130 | return new_bus; |
133 | if (ret) | ||
134 | goto out_free_all; | ||
135 | |||
136 | return 0; | ||
137 | 131 | ||
138 | out_free_all: | ||
139 | dev_set_drvdata(dev, NULL); | ||
140 | gpio_free(bitbang->mdio); | ||
141 | out_free_mdc: | 132 | out_free_mdc: |
142 | gpio_free(bitbang->mdc); | 133 | gpio_free(bitbang->mdc); |
143 | out_free_bus: | 134 | out_free_bus: |
@@ -145,30 +136,47 @@ out_free_bus: | |||
145 | out_free_bitbang: | 136 | out_free_bitbang: |
146 | kfree(bitbang); | 137 | kfree(bitbang); |
147 | out: | 138 | out: |
148 | return ret; | 139 | return NULL; |
149 | } | 140 | } |
150 | 141 | ||
151 | static void __devexit mdio_gpio_bus_destroy(struct device *dev) | 142 | static void __devinit mdio_gpio_bus_deinit(struct device *dev) |
152 | { | 143 | { |
153 | struct mii_bus *bus = dev_get_drvdata(dev); | 144 | struct mii_bus *bus = dev_get_drvdata(dev); |
154 | struct mdio_gpio_info *bitbang = bus->priv; | 145 | struct mdio_gpio_info *bitbang = bus->priv; |
155 | 146 | ||
156 | mdiobus_unregister(bus); | ||
157 | free_mdio_bitbang(bus); | ||
158 | dev_set_drvdata(dev, NULL); | 147 | dev_set_drvdata(dev, NULL); |
159 | gpio_free(bitbang->mdc); | ||
160 | gpio_free(bitbang->mdio); | 148 | gpio_free(bitbang->mdio); |
149 | gpio_free(bitbang->mdc); | ||
150 | free_mdio_bitbang(bus); | ||
161 | kfree(bitbang); | 151 | kfree(bitbang); |
162 | } | 152 | } |
163 | 153 | ||
154 | static void __devexit mdio_gpio_bus_destroy(struct device *dev) | ||
155 | { | ||
156 | struct mii_bus *bus = dev_get_drvdata(dev); | ||
157 | |||
158 | mdiobus_unregister(bus); | ||
159 | mdio_gpio_bus_deinit(dev); | ||
160 | } | ||
161 | |||
164 | static int __devinit mdio_gpio_probe(struct platform_device *pdev) | 162 | static int __devinit mdio_gpio_probe(struct platform_device *pdev) |
165 | { | 163 | { |
166 | struct mdio_gpio_platform_data *pdata = pdev->dev.platform_data; | 164 | struct mdio_gpio_platform_data *pdata = pdev->dev.platform_data; |
165 | struct mii_bus *new_bus; | ||
166 | int ret; | ||
167 | 167 | ||
168 | if (!pdata) | 168 | if (!pdata) |
169 | return -ENODEV; | 169 | return -ENODEV; |
170 | 170 | ||
171 | return mdio_gpio_bus_init(&pdev->dev, pdata, pdev->id); | 171 | new_bus = mdio_gpio_bus_init(&pdev->dev, pdata, pdev->id); |
172 | if (!new_bus) | ||
173 | return -ENODEV; | ||
174 | |||
175 | ret = mdiobus_register(new_bus); | ||
176 | if (ret) | ||
177 | mdio_gpio_bus_deinit(&pdev->dev); | ||
178 | |||
179 | return ret; | ||
172 | } | 180 | } |
173 | 181 | ||
174 | static int __devexit mdio_gpio_remove(struct platform_device *pdev) | 182 | static int __devexit mdio_gpio_remove(struct platform_device *pdev) |
@@ -179,29 +187,12 @@ static int __devexit mdio_gpio_remove(struct platform_device *pdev) | |||
179 | } | 187 | } |
180 | 188 | ||
181 | #ifdef CONFIG_OF_GPIO | 189 | #ifdef CONFIG_OF_GPIO |
182 | static void __devinit add_phy(struct mdio_gpio_platform_data *pdata, | ||
183 | struct device_node *np) | ||
184 | { | ||
185 | const u32 *data; | ||
186 | int len, id, irq; | ||
187 | |||
188 | data = of_get_property(np, "reg", &len); | ||
189 | if (!data || len != 4) | ||
190 | return; | ||
191 | |||
192 | id = *data; | ||
193 | pdata->phy_mask &= ~(1 << id); | ||
194 | |||
195 | irq = of_irq_to_resource(np, 0, NULL); | ||
196 | if (irq) | ||
197 | pdata->irqs[id] = irq; | ||
198 | } | ||
199 | 190 | ||
200 | static int __devinit mdio_ofgpio_probe(struct of_device *ofdev, | 191 | static int __devinit mdio_ofgpio_probe(struct of_device *ofdev, |
201 | const struct of_device_id *match) | 192 | const struct of_device_id *match) |
202 | { | 193 | { |
203 | struct device_node *np = NULL; | ||
204 | struct mdio_gpio_platform_data *pdata; | 194 | struct mdio_gpio_platform_data *pdata; |
195 | struct mii_bus *new_bus; | ||
205 | int ret; | 196 | int ret; |
206 | 197 | ||
207 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | 198 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); |
@@ -215,14 +206,18 @@ static int __devinit mdio_ofgpio_probe(struct of_device *ofdev, | |||
215 | 206 | ||
216 | ret = of_get_gpio(ofdev->node, 1); | 207 | ret = of_get_gpio(ofdev->node, 1); |
217 | if (ret < 0) | 208 | if (ret < 0) |
218 | goto out_free; | 209 | goto out_free; |
219 | pdata->mdio = ret; | 210 | pdata->mdio = ret; |
220 | 211 | ||
221 | while ((np = of_get_next_child(ofdev->node, np))) | 212 | new_bus = mdio_gpio_bus_init(&ofdev->dev, pdata, pdata->mdc); |
222 | if (!strcmp(np->type, "ethernet-phy")) | 213 | if (!new_bus) |
223 | add_phy(pdata, np); | 214 | return -ENODEV; |
224 | 215 | ||
225 | return mdio_gpio_bus_init(&ofdev->dev, pdata, pdata->mdc); | 216 | ret = of_mdiobus_register(new_bus, ofdev->node); |
217 | if (ret) | ||
218 | mdio_gpio_bus_deinit(&ofdev->dev); | ||
219 | |||
220 | return ret; | ||
226 | 221 | ||
227 | out_free: | 222 | out_free: |
228 | kfree(pdata); | 223 | kfree(pdata); |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 61755cbd978e..eda94fcd4065 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -928,13 +928,32 @@ static void phy_state_machine(struct work_struct *work) | |||
928 | * Otherwise, it's 0, and we're | 928 | * Otherwise, it's 0, and we're |
929 | * still waiting for AN */ | 929 | * still waiting for AN */ |
930 | if (err > 0) { | 930 | if (err > 0) { |
931 | phydev->state = PHY_RUNNING; | 931 | err = phy_read_status(phydev); |
932 | if (err) | ||
933 | break; | ||
934 | |||
935 | if (phydev->link) { | ||
936 | phydev->state = PHY_RUNNING; | ||
937 | netif_carrier_on(phydev->attached_dev); | ||
938 | } else | ||
939 | phydev->state = PHY_NOLINK; | ||
940 | phydev->adjust_link(phydev->attached_dev); | ||
932 | } else { | 941 | } else { |
933 | phydev->state = PHY_AN; | 942 | phydev->state = PHY_AN; |
934 | phydev->link_timeout = PHY_AN_TIMEOUT; | 943 | phydev->link_timeout = PHY_AN_TIMEOUT; |
935 | } | 944 | } |
936 | } else | 945 | } else { |
937 | phydev->state = PHY_RUNNING; | 946 | err = phy_read_status(phydev); |
947 | if (err) | ||
948 | break; | ||
949 | |||
950 | if (phydev->link) { | ||
951 | phydev->state = PHY_RUNNING; | ||
952 | netif_carrier_on(phydev->attached_dev); | ||
953 | } else | ||
954 | phydev->state = PHY_NOLINK; | ||
955 | phydev->adjust_link(phydev->attached_dev); | ||
956 | } | ||
938 | break; | 957 | break; |
939 | } | 958 | } |
940 | 959 | ||
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index eba937c46376..b10fedd82143 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -134,8 +134,10 @@ int phy_scan_fixups(struct phy_device *phydev) | |||
134 | 134 | ||
135 | err = fixup->run(phydev); | 135 | err = fixup->run(phydev); |
136 | 136 | ||
137 | if (err < 0) | 137 | if (err < 0) { |
138 | mutex_unlock(&phy_fixup_lock); | ||
138 | return err; | 139 | return err; |
140 | } | ||
139 | } | 141 | } |
140 | } | 142 | } |
141 | mutex_unlock(&phy_fixup_lock); | 143 | mutex_unlock(&phy_fixup_lock); |
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 7a62f781fef2..2ca8b0d84ee2 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -270,6 +270,9 @@ static const struct net_device_ops plip_netdev_ops = { | |||
270 | .ndo_stop = plip_close, | 270 | .ndo_stop = plip_close, |
271 | .ndo_start_xmit = plip_tx_packet, | 271 | .ndo_start_xmit = plip_tx_packet, |
272 | .ndo_do_ioctl = plip_ioctl, | 272 | .ndo_do_ioctl = plip_ioctl, |
273 | .ndo_change_mtu = eth_change_mtu, | ||
274 | .ndo_set_mac_address = eth_mac_addr, | ||
275 | .ndo_validate_addr = eth_validate_addr, | ||
273 | }; | 276 | }; |
274 | 277 | ||
275 | /* Entry point of PLIP driver. | 278 | /* Entry point of PLIP driver. |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 17c116bb332c..6de8399d6dd9 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -356,6 +356,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
356 | if (!skb_queue_empty(&ap->rqueue)) | 356 | if (!skb_queue_empty(&ap->rqueue)) |
357 | tasklet_schedule(&ap->tsk); | 357 | tasklet_schedule(&ap->tsk); |
358 | ap_put(ap); | 358 | ap_put(ap); |
359 | tty_unthrottle(tty); | ||
359 | } | 360 | } |
360 | 361 | ||
361 | static void | 362 | static void |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 639d11bc444e..cd37d739ac74 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -1384,7 +1384,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1384 | 1384 | ||
1385 | /* create a fragment for each channel */ | 1385 | /* create a fragment for each channel */ |
1386 | bits = B; | 1386 | bits = B; |
1387 | while (nfree > 0 && len > 0) { | 1387 | while (len > 0) { |
1388 | list = list->next; | 1388 | list = list->next; |
1389 | if (list == &ppp->channels) { | 1389 | if (list == &ppp->channels) { |
1390 | i = 0; | 1390 | i = 0; |
@@ -1431,29 +1431,31 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1431 | *otherwise divide it according to the speed | 1431 | *otherwise divide it according to the speed |
1432 | *of the channel we are going to transmit on | 1432 | *of the channel we are going to transmit on |
1433 | */ | 1433 | */ |
1434 | if (pch->speed == 0) { | 1434 | if (nfree > 0) { |
1435 | flen = totlen/nfree ; | 1435 | if (pch->speed == 0) { |
1436 | if (nbigger > 0) { | 1436 | flen = totlen/nfree ; |
1437 | flen++; | 1437 | if (nbigger > 0) { |
1438 | nbigger--; | 1438 | flen++; |
1439 | } | 1439 | nbigger--; |
1440 | } else { | 1440 | } |
1441 | flen = (((totfree - nzero)*(totlen + hdrlen*totfree)) / | 1441 | } else { |
1442 | ((totspeed*totfree)/pch->speed)) - hdrlen; | 1442 | flen = (((totfree - nzero)*(totlen + hdrlen*totfree)) / |
1443 | if (nbigger > 0) { | 1443 | ((totspeed*totfree)/pch->speed)) - hdrlen; |
1444 | flen += ((totfree - nzero)*pch->speed)/totspeed; | 1444 | if (nbigger > 0) { |
1445 | nbigger -= ((totfree - nzero)*pch->speed)/ | 1445 | flen += ((totfree - nzero)*pch->speed)/totspeed; |
1446 | nbigger -= ((totfree - nzero)*pch->speed)/ | ||
1446 | totspeed; | 1447 | totspeed; |
1448 | } | ||
1447 | } | 1449 | } |
1450 | nfree--; | ||
1448 | } | 1451 | } |
1449 | nfree--; | ||
1450 | 1452 | ||
1451 | /* | 1453 | /* |
1452 | *check if we are on the last channel or | 1454 | *check if we are on the last channel or |
1453 | *we exceded the lenght of the data to | 1455 | *we exceded the lenght of the data to |
1454 | *fragment | 1456 | *fragment |
1455 | */ | 1457 | */ |
1456 | if ((nfree == 0) || (flen > len)) | 1458 | if ((nfree <= 0) || (flen > len)) |
1457 | flen = len; | 1459 | flen = len; |
1458 | /* | 1460 | /* |
1459 | *it is not worth to tx on slow channels: | 1461 | *it is not worth to tx on slow channels: |
@@ -1467,7 +1469,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1467 | continue; | 1469 | continue; |
1468 | } | 1470 | } |
1469 | 1471 | ||
1470 | mtu = pch->chan->mtu + 2 - hdrlen; | 1472 | mtu = pch->chan->mtu - hdrlen; |
1471 | if (mtu < 4) | 1473 | if (mtu < 4) |
1472 | mtu = 4; | 1474 | mtu = 4; |
1473 | if (flen > mtu) | 1475 | if (flen > mtu) |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index aa3d39f38e22..d2fa2db13586 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -397,6 +397,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
397 | if (!skb_queue_empty(&ap->rqueue)) | 397 | if (!skb_queue_empty(&ap->rqueue)) |
398 | tasklet_schedule(&ap->tsk); | 398 | tasklet_schedule(&ap->tsk); |
399 | sp_put(ap); | 399 | sp_put(ap); |
400 | tty_unthrottle(tty); | ||
400 | } | 401 | } |
401 | 402 | ||
402 | static void | 403 | static void |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index f0031f1f97e5..5f2090233d7b 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -1063,6 +1063,7 @@ static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1063 | else { | 1063 | else { |
1064 | int hash = hash_item(po->pppoe_pa.sid, po->pppoe_pa.remote); | 1064 | int hash = hash_item(po->pppoe_pa.sid, po->pppoe_pa.remote); |
1065 | 1065 | ||
1066 | po = NULL; | ||
1066 | while (++hash < PPPOE_HASH_SIZE) { | 1067 | while (++hash < PPPOE_HASH_SIZE) { |
1067 | po = pn->hash_table[hash]; | 1068 | po = pn->hash_table[hash]; |
1068 | if (po) | 1069 | if (po) |
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index e7935d09c896..e0f9219a0aea 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -2680,6 +2680,7 @@ out_unregister_pppol2tp_proto: | |||
2680 | static void __exit pppol2tp_exit(void) | 2680 | static void __exit pppol2tp_exit(void) |
2681 | { | 2681 | { |
2682 | unregister_pppox_proto(PX_PROTO_OL2TP); | 2682 | unregister_pppox_proto(PX_PROTO_OL2TP); |
2683 | unregister_pernet_gen_device(pppol2tp_net_id, &pppol2tp_net_ops); | ||
2683 | proto_unregister(&pppol2tp_sk_proto); | 2684 | proto_unregister(&pppol2tp_sk_proto); |
2684 | } | 2685 | } |
2685 | 2686 | ||
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c index d1a5fb4d6acb..a3932c9f3406 100644 --- a/drivers/net/ps3_gelic_net.c +++ b/drivers/net/ps3_gelic_net.c | |||
@@ -1411,6 +1411,7 @@ static const struct net_device_ops gelic_netdevice_ops = { | |||
1411 | .ndo_set_multicast_list = gelic_net_set_multi, | 1411 | .ndo_set_multicast_list = gelic_net_set_multi, |
1412 | .ndo_change_mtu = gelic_net_change_mtu, | 1412 | .ndo_change_mtu = gelic_net_change_mtu, |
1413 | .ndo_tx_timeout = gelic_net_tx_timeout, | 1413 | .ndo_tx_timeout = gelic_net_tx_timeout, |
1414 | .ndo_set_mac_address = eth_mac_addr, | ||
1414 | .ndo_validate_addr = eth_validate_addr, | 1415 | .ndo_validate_addr = eth_validate_addr, |
1415 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1416 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1416 | .ndo_poll_controller = gelic_net_poll_controller, | 1417 | .ndo_poll_controller = gelic_net_poll_controller, |
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index b6b3ca9bdb21..6932b08d746b 100644 --- a/drivers/net/ps3_gelic_wireless.c +++ b/drivers/net/ps3_gelic_wireless.c | |||
@@ -2707,6 +2707,7 @@ static const struct net_device_ops gelic_wl_netdevice_ops = { | |||
2707 | .ndo_set_multicast_list = gelic_net_set_multi, | 2707 | .ndo_set_multicast_list = gelic_net_set_multi, |
2708 | .ndo_change_mtu = gelic_net_change_mtu, | 2708 | .ndo_change_mtu = gelic_net_change_mtu, |
2709 | .ndo_tx_timeout = gelic_net_tx_timeout, | 2709 | .ndo_tx_timeout = gelic_net_tx_timeout, |
2710 | .ndo_set_mac_address = eth_mac_addr, | ||
2710 | .ndo_validate_addr = eth_validate_addr, | 2711 | .ndo_validate_addr = eth_validate_addr, |
2711 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2712 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2712 | .ndo_poll_controller = gelic_net_poll_controller, | 2713 | .ndo_poll_controller = gelic_net_poll_controller, |
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index 156e02e8905d..6ed5317ab1c0 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -1607,6 +1607,8 @@ int ql_mb_get_fw_state(struct ql_adapter *qdev); | |||
1607 | int ql_cam_route_initialize(struct ql_adapter *qdev); | 1607 | int ql_cam_route_initialize(struct ql_adapter *qdev); |
1608 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); | 1608 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); |
1609 | int ql_mb_about_fw(struct ql_adapter *qdev); | 1609 | int ql_mb_about_fw(struct ql_adapter *qdev); |
1610 | void ql_link_on(struct ql_adapter *qdev); | ||
1611 | void ql_link_off(struct ql_adapter *qdev); | ||
1610 | 1612 | ||
1611 | #if 1 | 1613 | #if 1 |
1612 | #define QL_ALL_DUMP | 1614 | #define QL_ALL_DUMP |
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c index 37c99fe79770..eb6a9ee640ed 100644 --- a/drivers/net/qlge/qlge_ethtool.c +++ b/drivers/net/qlge/qlge_ethtool.c | |||
@@ -59,7 +59,7 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev) | |||
59 | cqicb->pkt_delay = | 59 | cqicb->pkt_delay = |
60 | cpu_to_le16(qdev->tx_max_coalesced_frames); | 60 | cpu_to_le16(qdev->tx_max_coalesced_frames); |
61 | cqicb->flags = FLAGS_LI; | 61 | cqicb->flags = FLAGS_LI; |
62 | status = ql_write_cfg(qdev, cqicb, sizeof(cqicb), | 62 | status = ql_write_cfg(qdev, cqicb, sizeof(*cqicb), |
63 | CFG_LCQ, rx_ring->cq_id); | 63 | CFG_LCQ, rx_ring->cq_id); |
64 | if (status) { | 64 | if (status) { |
65 | QPRINTK(qdev, IFUP, ERR, | 65 | QPRINTK(qdev, IFUP, ERR, |
@@ -82,7 +82,7 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev) | |||
82 | cqicb->pkt_delay = | 82 | cqicb->pkt_delay = |
83 | cpu_to_le16(qdev->rx_max_coalesced_frames); | 83 | cpu_to_le16(qdev->rx_max_coalesced_frames); |
84 | cqicb->flags = FLAGS_LI; | 84 | cqicb->flags = FLAGS_LI; |
85 | status = ql_write_cfg(qdev, cqicb, sizeof(cqicb), | 85 | status = ql_write_cfg(qdev, cqicb, sizeof(*cqicb), |
86 | CFG_LCQ, rx_ring->cq_id); | 86 | CFG_LCQ, rx_ring->cq_id); |
87 | if (status) { | 87 | if (status) { |
88 | QPRINTK(qdev, IFUP, ERR, | 88 | QPRINTK(qdev, IFUP, ERR, |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 90d1f76c0e8b..5768af17f168 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -214,6 +214,10 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | |||
214 | return -ENOMEM; | 214 | return -ENOMEM; |
215 | } | 215 | } |
216 | 216 | ||
217 | status = ql_sem_spinlock(qdev, SEM_ICB_MASK); | ||
218 | if (status) | ||
219 | return status; | ||
220 | |||
217 | status = ql_wait_cfg(qdev, bit); | 221 | status = ql_wait_cfg(qdev, bit); |
218 | if (status) { | 222 | if (status) { |
219 | QPRINTK(qdev, IFUP, ERR, | 223 | QPRINTK(qdev, IFUP, ERR, |
@@ -221,12 +225,8 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | |||
221 | goto exit; | 225 | goto exit; |
222 | } | 226 | } |
223 | 227 | ||
224 | status = ql_sem_spinlock(qdev, SEM_ICB_MASK); | ||
225 | if (status) | ||
226 | goto exit; | ||
227 | ql_write32(qdev, ICB_L, (u32) map); | 228 | ql_write32(qdev, ICB_L, (u32) map); |
228 | ql_write32(qdev, ICB_H, (u32) (map >> 32)); | 229 | ql_write32(qdev, ICB_H, (u32) (map >> 32)); |
229 | ql_sem_unlock(qdev, SEM_ICB_MASK); /* does flush too */ | ||
230 | 230 | ||
231 | mask = CFG_Q_MASK | (bit << 16); | 231 | mask = CFG_Q_MASK | (bit << 16); |
232 | value = bit | (q_id << CFG_Q_SHIFT); | 232 | value = bit | (q_id << CFG_Q_SHIFT); |
@@ -237,6 +237,7 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | |||
237 | */ | 237 | */ |
238 | status = ql_wait_cfg(qdev, bit); | 238 | status = ql_wait_cfg(qdev, bit); |
239 | exit: | 239 | exit: |
240 | ql_sem_unlock(qdev, SEM_ICB_MASK); /* does flush too */ | ||
240 | pci_unmap_single(qdev->pdev, map, size, direction); | 241 | pci_unmap_single(qdev->pdev, map, size, direction); |
241 | return status; | 242 | return status; |
242 | } | 243 | } |
@@ -412,6 +413,57 @@ exit: | |||
412 | return status; | 413 | return status; |
413 | } | 414 | } |
414 | 415 | ||
416 | /* Set or clear MAC address in hardware. We sometimes | ||
417 | * have to clear it to prevent wrong frame routing | ||
418 | * especially in a bonding environment. | ||
419 | */ | ||
420 | static int ql_set_mac_addr(struct ql_adapter *qdev, int set) | ||
421 | { | ||
422 | int status; | ||
423 | char zero_mac_addr[ETH_ALEN]; | ||
424 | char *addr; | ||
425 | |||
426 | if (set) { | ||
427 | addr = &qdev->ndev->dev_addr[0]; | ||
428 | QPRINTK(qdev, IFUP, DEBUG, | ||
429 | "Set Mac addr %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
430 | addr[0], addr[1], addr[2], addr[3], | ||
431 | addr[4], addr[5]); | ||
432 | } else { | ||
433 | memset(zero_mac_addr, 0, ETH_ALEN); | ||
434 | addr = &zero_mac_addr[0]; | ||
435 | QPRINTK(qdev, IFUP, DEBUG, | ||
436 | "Clearing MAC address on %s\n", | ||
437 | qdev->ndev->name); | ||
438 | } | ||
439 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); | ||
440 | if (status) | ||
441 | return status; | ||
442 | status = ql_set_mac_addr_reg(qdev, (u8 *) addr, | ||
443 | MAC_ADDR_TYPE_CAM_MAC, qdev->func * MAX_CQ); | ||
444 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); | ||
445 | if (status) | ||
446 | QPRINTK(qdev, IFUP, ERR, "Failed to init mac " | ||
447 | "address.\n"); | ||
448 | return status; | ||
449 | } | ||
450 | |||
451 | void ql_link_on(struct ql_adapter *qdev) | ||
452 | { | ||
453 | QPRINTK(qdev, LINK, ERR, "%s: Link is up.\n", | ||
454 | qdev->ndev->name); | ||
455 | netif_carrier_on(qdev->ndev); | ||
456 | ql_set_mac_addr(qdev, 1); | ||
457 | } | ||
458 | |||
459 | void ql_link_off(struct ql_adapter *qdev) | ||
460 | { | ||
461 | QPRINTK(qdev, LINK, ERR, "%s: Link is down.\n", | ||
462 | qdev->ndev->name); | ||
463 | netif_carrier_off(qdev->ndev); | ||
464 | ql_set_mac_addr(qdev, 0); | ||
465 | } | ||
466 | |||
415 | /* Get a specific frame routing value from the CAM. | 467 | /* Get a specific frame routing value from the CAM. |
416 | * Used for debug and reg dump. | 468 | * Used for debug and reg dump. |
417 | */ | 469 | */ |
@@ -1628,7 +1680,7 @@ static void ql_process_mac_tx_intr(struct ql_adapter *qdev, | |||
1628 | tx_ring = &qdev->tx_ring[mac_rsp->txq_idx]; | 1680 | tx_ring = &qdev->tx_ring[mac_rsp->txq_idx]; |
1629 | tx_ring_desc = &tx_ring->q[mac_rsp->tid]; | 1681 | tx_ring_desc = &tx_ring->q[mac_rsp->tid]; |
1630 | ql_unmap_send(qdev, tx_ring_desc, tx_ring_desc->map_cnt); | 1682 | ql_unmap_send(qdev, tx_ring_desc, tx_ring_desc->map_cnt); |
1631 | qdev->stats.tx_bytes += tx_ring_desc->map_cnt; | 1683 | qdev->stats.tx_bytes += (tx_ring_desc->skb)->len; |
1632 | qdev->stats.tx_packets++; | 1684 | qdev->stats.tx_packets++; |
1633 | dev_kfree_skb(tx_ring_desc->skb); | 1685 | dev_kfree_skb(tx_ring_desc->skb); |
1634 | tx_ring_desc->skb = NULL; | 1686 | tx_ring_desc->skb = NULL; |
@@ -1660,13 +1712,13 @@ static void ql_process_mac_tx_intr(struct ql_adapter *qdev, | |||
1660 | /* Fire up a handler to reset the MPI processor. */ | 1712 | /* Fire up a handler to reset the MPI processor. */ |
1661 | void ql_queue_fw_error(struct ql_adapter *qdev) | 1713 | void ql_queue_fw_error(struct ql_adapter *qdev) |
1662 | { | 1714 | { |
1663 | netif_carrier_off(qdev->ndev); | 1715 | ql_link_off(qdev); |
1664 | queue_delayed_work(qdev->workqueue, &qdev->mpi_reset_work, 0); | 1716 | queue_delayed_work(qdev->workqueue, &qdev->mpi_reset_work, 0); |
1665 | } | 1717 | } |
1666 | 1718 | ||
1667 | void ql_queue_asic_error(struct ql_adapter *qdev) | 1719 | void ql_queue_asic_error(struct ql_adapter *qdev) |
1668 | { | 1720 | { |
1669 | netif_carrier_off(qdev->ndev); | 1721 | ql_link_off(qdev); |
1670 | ql_disable_interrupts(qdev); | 1722 | ql_disable_interrupts(qdev); |
1671 | /* Clear adapter up bit to signal the recovery | 1723 | /* Clear adapter up bit to signal the recovery |
1672 | * process that it shouldn't kill the reset worker | 1724 | * process that it shouldn't kill the reset worker |
@@ -2104,7 +2156,7 @@ static int qlge_send(struct sk_buff *skb, struct net_device *ndev) | |||
2104 | } | 2156 | } |
2105 | tx_ring_desc = &tx_ring->q[tx_ring->prod_idx]; | 2157 | tx_ring_desc = &tx_ring->q[tx_ring->prod_idx]; |
2106 | mac_iocb_ptr = tx_ring_desc->queue_entry; | 2158 | mac_iocb_ptr = tx_ring_desc->queue_entry; |
2107 | memset((void *)mac_iocb_ptr, 0, sizeof(mac_iocb_ptr)); | 2159 | memset((void *)mac_iocb_ptr, 0, sizeof(*mac_iocb_ptr)); |
2108 | 2160 | ||
2109 | mac_iocb_ptr->opcode = OPCODE_OB_MAC_IOCB; | 2161 | mac_iocb_ptr->opcode = OPCODE_OB_MAC_IOCB; |
2110 | mac_iocb_ptr->tid = tx_ring_desc->index; | 2162 | mac_iocb_ptr->tid = tx_ring_desc->index; |
@@ -2743,7 +2795,7 @@ static int ql_start_tx_ring(struct ql_adapter *qdev, struct tx_ring *tx_ring) | |||
2743 | 2795 | ||
2744 | ql_init_tx_ring(qdev, tx_ring); | 2796 | ql_init_tx_ring(qdev, tx_ring); |
2745 | 2797 | ||
2746 | err = ql_write_cfg(qdev, wqicb, sizeof(wqicb), CFG_LRQ, | 2798 | err = ql_write_cfg(qdev, wqicb, sizeof(*wqicb), CFG_LRQ, |
2747 | (u16) tx_ring->wq_id); | 2799 | (u16) tx_ring->wq_id); |
2748 | if (err) { | 2800 | if (err) { |
2749 | QPRINTK(qdev, IFUP, ERR, "Failed to load tx_ring.\n"); | 2801 | QPRINTK(qdev, IFUP, ERR, "Failed to load tx_ring.\n"); |
@@ -3008,7 +3060,7 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
3008 | int i; | 3060 | int i; |
3009 | u8 *hash_id = (u8 *) ricb->hash_cq_id; | 3061 | u8 *hash_id = (u8 *) ricb->hash_cq_id; |
3010 | 3062 | ||
3011 | memset((void *)ricb, 0, sizeof(ricb)); | 3063 | memset((void *)ricb, 0, sizeof(*ricb)); |
3012 | 3064 | ||
3013 | ricb->base_cq = qdev->rss_ring_first_cq_id | RSS_L4K; | 3065 | ricb->base_cq = qdev->rss_ring_first_cq_id | RSS_L4K; |
3014 | ricb->flags = | 3066 | ricb->flags = |
@@ -3030,7 +3082,7 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
3030 | 3082 | ||
3031 | QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n"); | 3083 | QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n"); |
3032 | 3084 | ||
3033 | status = ql_write_cfg(qdev, ricb, sizeof(ricb), CFG_LR, 0); | 3085 | status = ql_write_cfg(qdev, ricb, sizeof(*ricb), CFG_LR, 0); |
3034 | if (status) { | 3086 | if (status) { |
3035 | QPRINTK(qdev, IFUP, ERR, "Failed to load RICB.\n"); | 3087 | QPRINTK(qdev, IFUP, ERR, "Failed to load RICB.\n"); |
3036 | return status; | 3088 | return status; |
@@ -3039,25 +3091,40 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
3039 | return status; | 3091 | return status; |
3040 | } | 3092 | } |
3041 | 3093 | ||
3042 | /* Initialize the frame-to-queue routing. */ | 3094 | static int ql_clear_routing_entries(struct ql_adapter *qdev) |
3043 | static int ql_route_initialize(struct ql_adapter *qdev) | ||
3044 | { | 3095 | { |
3045 | int status = 0; | 3096 | int i, status = 0; |
3046 | int i; | ||
3047 | 3097 | ||
3048 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); | 3098 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); |
3049 | if (status) | 3099 | if (status) |
3050 | return status; | 3100 | return status; |
3051 | |||
3052 | /* Clear all the entries in the routing table. */ | 3101 | /* Clear all the entries in the routing table. */ |
3053 | for (i = 0; i < 16; i++) { | 3102 | for (i = 0; i < 16; i++) { |
3054 | status = ql_set_routing_reg(qdev, i, 0, 0); | 3103 | status = ql_set_routing_reg(qdev, i, 0, 0); |
3055 | if (status) { | 3104 | if (status) { |
3056 | QPRINTK(qdev, IFUP, ERR, | 3105 | QPRINTK(qdev, IFUP, ERR, |
3057 | "Failed to init routing register for CAM packets.\n"); | 3106 | "Failed to init routing register for CAM " |
3058 | goto exit; | 3107 | "packets.\n"); |
3108 | break; | ||
3059 | } | 3109 | } |
3060 | } | 3110 | } |
3111 | ql_sem_unlock(qdev, SEM_RT_IDX_MASK); | ||
3112 | return status; | ||
3113 | } | ||
3114 | |||
3115 | /* Initialize the frame-to-queue routing. */ | ||
3116 | static int ql_route_initialize(struct ql_adapter *qdev) | ||
3117 | { | ||
3118 | int status = 0; | ||
3119 | |||
3120 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); | ||
3121 | if (status) | ||
3122 | return status; | ||
3123 | |||
3124 | /* Clear all the entries in the routing table. */ | ||
3125 | status = ql_clear_routing_entries(qdev); | ||
3126 | if (status) | ||
3127 | goto exit; | ||
3061 | 3128 | ||
3062 | status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1); | 3129 | status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1); |
3063 | if (status) { | 3130 | if (status) { |
@@ -3096,14 +3163,15 @@ exit: | |||
3096 | 3163 | ||
3097 | int ql_cam_route_initialize(struct ql_adapter *qdev) | 3164 | int ql_cam_route_initialize(struct ql_adapter *qdev) |
3098 | { | 3165 | { |
3099 | int status; | 3166 | int status, set; |
3100 | 3167 | ||
3101 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); | 3168 | /* If check if the link is up and use to |
3102 | if (status) | 3169 | * determine if we are setting or clearing |
3103 | return status; | 3170 | * the MAC address in the CAM. |
3104 | status = ql_set_mac_addr_reg(qdev, (u8 *) qdev->ndev->perm_addr, | 3171 | */ |
3105 | MAC_ADDR_TYPE_CAM_MAC, qdev->func * MAX_CQ); | 3172 | set = ql_read32(qdev, STS); |
3106 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); | 3173 | set &= qdev->port_link_up; |
3174 | status = ql_set_mac_addr(qdev, set); | ||
3107 | if (status) { | 3175 | if (status) { |
3108 | QPRINTK(qdev, IFUP, ERR, "Failed to init mac address.\n"); | 3176 | QPRINTK(qdev, IFUP, ERR, "Failed to init mac address.\n"); |
3109 | return status; | 3177 | return status; |
@@ -3210,9 +3278,17 @@ static int ql_adapter_reset(struct ql_adapter *qdev) | |||
3210 | { | 3278 | { |
3211 | u32 value; | 3279 | u32 value; |
3212 | int status = 0; | 3280 | int status = 0; |
3213 | unsigned long end_jiffies = jiffies + | 3281 | unsigned long end_jiffies; |
3214 | max((unsigned long)1, usecs_to_jiffies(30)); | ||
3215 | 3282 | ||
3283 | /* Clear all the entries in the routing table. */ | ||
3284 | status = ql_clear_routing_entries(qdev); | ||
3285 | if (status) { | ||
3286 | QPRINTK(qdev, IFUP, ERR, "Failed to clear routing bits.\n"); | ||
3287 | return status; | ||
3288 | } | ||
3289 | |||
3290 | end_jiffies = jiffies + | ||
3291 | max((unsigned long)1, usecs_to_jiffies(30)); | ||
3216 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); | 3292 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); |
3217 | 3293 | ||
3218 | do { | 3294 | do { |
@@ -3252,7 +3328,7 @@ static int ql_adapter_down(struct ql_adapter *qdev) | |||
3252 | int i, status = 0; | 3328 | int i, status = 0; |
3253 | struct rx_ring *rx_ring; | 3329 | struct rx_ring *rx_ring; |
3254 | 3330 | ||
3255 | netif_carrier_off(qdev->ndev); | 3331 | ql_link_off(qdev); |
3256 | 3332 | ||
3257 | /* Don't kill the reset worker thread if we | 3333 | /* Don't kill the reset worker thread if we |
3258 | * are in the process of recovery. | 3334 | * are in the process of recovery. |
@@ -3319,8 +3395,12 @@ static int ql_adapter_up(struct ql_adapter *qdev) | |||
3319 | } | 3395 | } |
3320 | set_bit(QL_ADAPTER_UP, &qdev->flags); | 3396 | set_bit(QL_ADAPTER_UP, &qdev->flags); |
3321 | ql_alloc_rx_buffers(qdev); | 3397 | ql_alloc_rx_buffers(qdev); |
3322 | if ((ql_read32(qdev, STS) & qdev->port_init)) | 3398 | /* If the port is initialized and the |
3323 | netif_carrier_on(qdev->ndev); | 3399 | * link is up the turn on the carrier. |
3400 | */ | ||
3401 | if ((ql_read32(qdev, STS) & qdev->port_init) && | ||
3402 | (ql_read32(qdev, STS) & qdev->port_link_up)) | ||
3403 | ql_link_on(qdev); | ||
3324 | ql_enable_interrupts(qdev); | 3404 | ql_enable_interrupts(qdev); |
3325 | ql_enable_all_completion_interrupts(qdev); | 3405 | ql_enable_all_completion_interrupts(qdev); |
3326 | netif_tx_start_all_queues(qdev->ndev); | 3406 | netif_tx_start_all_queues(qdev->ndev); |
@@ -3346,11 +3426,6 @@ static int ql_get_adapter_resources(struct ql_adapter *qdev) | |||
3346 | return -ENOMEM; | 3426 | return -ENOMEM; |
3347 | } | 3427 | } |
3348 | status = ql_request_irq(qdev); | 3428 | status = ql_request_irq(qdev); |
3349 | if (status) | ||
3350 | goto err_irq; | ||
3351 | return status; | ||
3352 | err_irq: | ||
3353 | ql_free_mem_resources(qdev); | ||
3354 | return status; | 3429 | return status; |
3355 | } | 3430 | } |
3356 | 3431 | ||
@@ -3414,7 +3489,7 @@ static int ql_configure_rings(struct ql_adapter *qdev) | |||
3414 | 3489 | ||
3415 | for (i = 0; i < qdev->tx_ring_count; i++) { | 3490 | for (i = 0; i < qdev->tx_ring_count; i++) { |
3416 | tx_ring = &qdev->tx_ring[i]; | 3491 | tx_ring = &qdev->tx_ring[i]; |
3417 | memset((void *)tx_ring, 0, sizeof(tx_ring)); | 3492 | memset((void *)tx_ring, 0, sizeof(*tx_ring)); |
3418 | tx_ring->qdev = qdev; | 3493 | tx_ring->qdev = qdev; |
3419 | tx_ring->wq_id = i; | 3494 | tx_ring->wq_id = i; |
3420 | tx_ring->wq_len = qdev->tx_ring_size; | 3495 | tx_ring->wq_len = qdev->tx_ring_size; |
@@ -3430,7 +3505,7 @@ static int ql_configure_rings(struct ql_adapter *qdev) | |||
3430 | 3505 | ||
3431 | for (i = 0; i < qdev->rx_ring_count; i++) { | 3506 | for (i = 0; i < qdev->rx_ring_count; i++) { |
3432 | rx_ring = &qdev->rx_ring[i]; | 3507 | rx_ring = &qdev->rx_ring[i]; |
3433 | memset((void *)rx_ring, 0, sizeof(rx_ring)); | 3508 | memset((void *)rx_ring, 0, sizeof(*rx_ring)); |
3434 | rx_ring->qdev = qdev; | 3509 | rx_ring->qdev = qdev; |
3435 | rx_ring->cq_id = i; | 3510 | rx_ring->cq_id = i; |
3436 | rx_ring->cpu = i % cpu_cnt; /* CPU to run handler on. */ | 3511 | rx_ring->cpu = i % cpu_cnt; /* CPU to run handler on. */ |
@@ -3789,7 +3864,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
3789 | int pos, err = 0; | 3864 | int pos, err = 0; |
3790 | u16 val16; | 3865 | u16 val16; |
3791 | 3866 | ||
3792 | memset((void *)qdev, 0, sizeof(qdev)); | 3867 | memset((void *)qdev, 0, sizeof(*qdev)); |
3793 | err = pci_enable_device(pdev); | 3868 | err = pci_enable_device(pdev); |
3794 | if (err) { | 3869 | if (err) { |
3795 | dev_err(&pdev->dev, "PCI device enable failed.\n"); | 3870 | dev_err(&pdev->dev, "PCI device enable failed.\n"); |
@@ -3976,7 +4051,7 @@ static int __devinit qlge_probe(struct pci_dev *pdev, | |||
3976 | pci_disable_device(pdev); | 4051 | pci_disable_device(pdev); |
3977 | return err; | 4052 | return err; |
3978 | } | 4053 | } |
3979 | netif_carrier_off(ndev); | 4054 | ql_link_off(qdev); |
3980 | ql_display_dev_info(ndev); | 4055 | ql_display_dev_info(ndev); |
3981 | cards_found++; | 4056 | cards_found++; |
3982 | return 0; | 4057 | return 0; |
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 71afbf8b9c50..6685bd97da91 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -238,7 +238,7 @@ static void ql_link_up(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
238 | &qdev->mpi_port_cfg_work, 0); | 238 | &qdev->mpi_port_cfg_work, 0); |
239 | } | 239 | } |
240 | 240 | ||
241 | netif_carrier_on(qdev->ndev); | 241 | ql_link_on(qdev); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) | 244 | static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) |
@@ -251,7 +251,7 @@ static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
251 | if (status) | 251 | if (status) |
252 | QPRINTK(qdev, DRV, ERR, "Link down AEN broken!\n"); | 252 | QPRINTK(qdev, DRV, ERR, "Link down AEN broken!\n"); |
253 | 253 | ||
254 | netif_carrier_off(qdev->ndev); | 254 | ql_link_off(qdev); |
255 | } | 255 | } |
256 | 256 | ||
257 | static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp) | 257 | static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp) |
@@ -849,7 +849,7 @@ void ql_mpi_idc_work(struct work_struct *work) | |||
849 | case MB_CMD_PORT_RESET: | 849 | case MB_CMD_PORT_RESET: |
850 | case MB_CMD_SET_PORT_CFG: | 850 | case MB_CMD_SET_PORT_CFG: |
851 | case MB_CMD_STOP_FW: | 851 | case MB_CMD_STOP_FW: |
852 | netif_carrier_off(qdev->ndev); | 852 | ql_link_off(qdev); |
853 | /* Signal the resulting link up AEN | 853 | /* Signal the resulting link up AEN |
854 | * that the frame routing and mac addr | 854 | * that the frame routing and mac addr |
855 | * needs to be set. | 855 | * needs to be set. |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index ed63d23a6452..961b5397a531 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -49,8 +49,8 @@ | |||
49 | #include <asm/processor.h> | 49 | #include <asm/processor.h> |
50 | 50 | ||
51 | #define DRV_NAME "r6040" | 51 | #define DRV_NAME "r6040" |
52 | #define DRV_VERSION "0.23" | 52 | #define DRV_VERSION "0.24" |
53 | #define DRV_RELDATE "05May2009" | 53 | #define DRV_RELDATE "08Jul2009" |
54 | 54 | ||
55 | /* PHY CHIP Address */ | 55 | /* PHY CHIP Address */ |
56 | #define PHY1_ADDR 1 /* For MAC1 */ | 56 | #define PHY1_ADDR 1 /* For MAC1 */ |
@@ -704,8 +704,11 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id) | |||
704 | /* Read MISR status and clear */ | 704 | /* Read MISR status and clear */ |
705 | status = ioread16(ioaddr + MISR); | 705 | status = ioread16(ioaddr + MISR); |
706 | 706 | ||
707 | if (status == 0x0000 || status == 0xffff) | 707 | if (status == 0x0000 || status == 0xffff) { |
708 | /* Restore RDC MAC interrupt */ | ||
709 | iowrite16(misr, ioaddr + MIER); | ||
708 | return IRQ_NONE; | 710 | return IRQ_NONE; |
711 | } | ||
709 | 712 | ||
710 | /* RX interrupt request */ | 713 | /* RX interrupt request */ |
711 | if (status & RX_INTS) { | 714 | if (status & RX_INTS) { |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 4b53b58d75fc..b82780d805f5 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -2060,8 +2060,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2060 | } | 2060 | } |
2061 | } | 2061 | } |
2062 | 2062 | ||
2063 | pci_set_master(pdev); | ||
2064 | |||
2065 | /* ioremap MMIO region */ | 2063 | /* ioremap MMIO region */ |
2066 | ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE); | 2064 | ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE); |
2067 | if (!ioaddr) { | 2065 | if (!ioaddr) { |
@@ -2089,6 +2087,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2089 | 2087 | ||
2090 | RTL_W16(IntrStatus, 0xffff); | 2088 | RTL_W16(IntrStatus, 0xffff); |
2091 | 2089 | ||
2090 | pci_set_master(pdev); | ||
2091 | |||
2092 | /* Identify chip attached to board */ | 2092 | /* Identify chip attached to board */ |
2093 | rtl8169_get_mac_version(tp, ioaddr); | 2093 | rtl8169_get_mac_version(tp, ioaddr); |
2094 | 2094 | ||
@@ -3874,6 +3874,15 @@ static void rtl_shutdown(struct pci_dev *pdev) | |||
3874 | spin_unlock_irq(&tp->lock); | 3874 | spin_unlock_irq(&tp->lock); |
3875 | 3875 | ||
3876 | if (system_state == SYSTEM_POWER_OFF) { | 3876 | if (system_state == SYSTEM_POWER_OFF) { |
3877 | /* WoL fails with some 8168 when the receiver is disabled. */ | ||
3878 | if (tp->features & RTL_FEATURE_WOL) { | ||
3879 | pci_clear_master(pdev); | ||
3880 | |||
3881 | RTL_W8(ChipCmd, CmdRxEnb); | ||
3882 | /* PCI commit */ | ||
3883 | RTL_R8(ChipCmd); | ||
3884 | } | ||
3885 | |||
3877 | pci_wake_from_d3(pdev, true); | 3886 | pci_wake_from_d3(pdev, true); |
3878 | pci_set_power_state(pdev, PCI_D3hot); | 3887 | pci_set_power_state(pdev, PCI_D3hot); |
3879 | } | 3888 | } |
diff --git a/drivers/net/s6gmac.c b/drivers/net/s6gmac.c index 5345e47b35ac..4525cbe8dd69 100644 --- a/drivers/net/s6gmac.c +++ b/drivers/net/s6gmac.c | |||
@@ -793,7 +793,7 @@ static inline int s6gmac_phy_start(struct net_device *dev) | |||
793 | struct s6gmac *pd = netdev_priv(dev); | 793 | struct s6gmac *pd = netdev_priv(dev); |
794 | int i = 0; | 794 | int i = 0; |
795 | struct phy_device *p = NULL; | 795 | struct phy_device *p = NULL; |
796 | while ((!(p = pd->mii.bus->phy_map[i])) && (i < PHY_MAX_ADDR)) | 796 | while ((i < PHY_MAX_ADDR) && (!(p = pd->mii.bus->phy_map[i]))) |
797 | i++; | 797 | i++; |
798 | p = phy_connect(dev, dev_name(&p->dev), &s6gmac_adjust_link, 0, | 798 | p = phy_connect(dev, dev_name(&p->dev), &s6gmac_adjust_link, 0, |
799 | PHY_INTERFACE_MODE_RGMII); | 799 | PHY_INTERFACE_MODE_RGMII); |
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c index 18821f217e19..e3156c97bb58 100644 --- a/drivers/net/sc92031.c +++ b/drivers/net/sc92031.c | |||
@@ -1593,6 +1593,7 @@ out: | |||
1593 | static struct pci_device_id sc92031_pci_device_id_table[] __devinitdata = { | 1593 | static struct pci_device_id sc92031_pci_device_id_table[] __devinitdata = { |
1594 | { PCI_DEVICE(PCI_VENDOR_ID_SILAN, 0x2031) }, | 1594 | { PCI_DEVICE(PCI_VENDOR_ID_SILAN, 0x2031) }, |
1595 | { PCI_DEVICE(PCI_VENDOR_ID_SILAN, 0x8139) }, | 1595 | { PCI_DEVICE(PCI_VENDOR_ID_SILAN, 0x8139) }, |
1596 | { PCI_DEVICE(0x1088, 0x2031) }, | ||
1596 | { 0, } | 1597 | { 0, } |
1597 | }; | 1598 | }; |
1598 | MODULE_DEVICE_TABLE(pci, sc92031_pci_device_id_table); | 1599 | MODULE_DEVICE_TABLE(pci, sc92031_pci_device_id_table); |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 60d502eef4fc..543af2044f40 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -3854,8 +3854,10 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
3854 | skge->speed = -1; | 3854 | skge->speed = -1; |
3855 | skge->advertising = skge_supported_modes(hw); | 3855 | skge->advertising = skge_supported_modes(hw); |
3856 | 3856 | ||
3857 | if (device_may_wakeup(&hw->pdev->dev)) | 3857 | if (device_can_wakeup(&hw->pdev->dev)) { |
3858 | skge->wol = wol_supported(hw) & WAKE_MAGIC; | 3858 | skge->wol = wol_supported(hw) & WAKE_MAGIC; |
3859 | device_set_wakeup_enable(&hw->pdev->dev, skge->wol); | ||
3860 | } | ||
3859 | 3861 | ||
3860 | hw->dev[port] = dev; | 3862 | hw->dev[port] = dev; |
3861 | 3863 | ||
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index daf961ab68bc..0a551d8f5d95 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -1151,14 +1151,7 @@ stopped: | |||
1151 | 1151 | ||
1152 | /* reset the Rx prefetch unit */ | 1152 | /* reset the Rx prefetch unit */ |
1153 | sky2_write32(hw, Y2_QADDR(rxq, PREF_UNIT_CTRL), PREF_UNIT_RST_SET); | 1153 | sky2_write32(hw, Y2_QADDR(rxq, PREF_UNIT_CTRL), PREF_UNIT_RST_SET); |
1154 | 1154 | mmiowb(); | |
1155 | /* Reset the RAM Buffer receive queue */ | ||
1156 | sky2_write8(hw, RB_ADDR(rxq, RB_CTRL), RB_RST_SET); | ||
1157 | |||
1158 | /* Reset Rx MAC FIFO */ | ||
1159 | sky2_write8(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), GMF_RST_SET); | ||
1160 | |||
1161 | sky2_read8(hw, B0_CTST); | ||
1162 | } | 1155 | } |
1163 | 1156 | ||
1164 | /* Clean out receive buffer area, assumes receiver hardware stopped */ | 1157 | /* Clean out receive buffer area, assumes receiver hardware stopped */ |
@@ -1495,6 +1488,8 @@ static int sky2_up(struct net_device *dev) | |||
1495 | sky2_set_vlan_mode(hw, port, sky2->vlgrp != NULL); | 1488 | sky2_set_vlan_mode(hw, port, sky2->vlgrp != NULL); |
1496 | #endif | 1489 | #endif |
1497 | 1490 | ||
1491 | sky2->restarting = 0; | ||
1492 | |||
1498 | err = sky2_rx_start(sky2); | 1493 | err = sky2_rx_start(sky2); |
1499 | if (err) | 1494 | if (err) |
1500 | goto err_out; | 1495 | goto err_out; |
@@ -1507,6 +1502,9 @@ static int sky2_up(struct net_device *dev) | |||
1507 | 1502 | ||
1508 | sky2_set_multicast(dev); | 1503 | sky2_set_multicast(dev); |
1509 | 1504 | ||
1505 | /* wake queue incase we are restarting */ | ||
1506 | netif_wake_queue(dev); | ||
1507 | |||
1510 | if (netif_msg_ifup(sky2)) | 1508 | if (netif_msg_ifup(sky2)) |
1511 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); | 1509 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); |
1512 | return 0; | 1510 | return 0; |
@@ -1540,6 +1538,8 @@ static inline int tx_dist(unsigned tail, unsigned head) | |||
1540 | /* Number of list elements available for next tx */ | 1538 | /* Number of list elements available for next tx */ |
1541 | static inline int tx_avail(const struct sky2_port *sky2) | 1539 | static inline int tx_avail(const struct sky2_port *sky2) |
1542 | { | 1540 | { |
1541 | if (unlikely(sky2->restarting)) | ||
1542 | return 0; | ||
1543 | return sky2->tx_pending - tx_dist(sky2->tx_cons, sky2->tx_prod); | 1543 | return sky2->tx_pending - tx_dist(sky2->tx_cons, sky2->tx_prod); |
1544 | } | 1544 | } |
1545 | 1545 | ||
@@ -1825,11 +1825,9 @@ static int sky2_down(struct net_device *dev) | |||
1825 | if (netif_msg_ifdown(sky2)) | 1825 | if (netif_msg_ifdown(sky2)) |
1826 | printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); | 1826 | printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); |
1827 | 1827 | ||
1828 | /* Disable port IRQ */ | 1828 | /* explicitly shut off tx incase we're restarting */ |
1829 | imask = sky2_read32(hw, B0_IMSK); | 1829 | sky2->restarting = 1; |
1830 | imask &= ~portirq_msk[port]; | 1830 | netif_tx_disable(dev); |
1831 | sky2_write32(hw, B0_IMSK, imask); | ||
1832 | sky2_read32(hw, B0_IMSK); | ||
1833 | 1831 | ||
1834 | /* Force flow control off */ | 1832 | /* Force flow control off */ |
1835 | sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); | 1833 | sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); |
@@ -1870,8 +1868,6 @@ static int sky2_down(struct net_device *dev) | |||
1870 | 1868 | ||
1871 | sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), RB_RST_SET); | 1869 | sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), RB_RST_SET); |
1872 | 1870 | ||
1873 | sky2_rx_stop(sky2); | ||
1874 | |||
1875 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); | 1871 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); |
1876 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); | 1872 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); |
1877 | 1873 | ||
@@ -1881,6 +1877,14 @@ static int sky2_down(struct net_device *dev) | |||
1881 | sky2_write32(hw, STAT_ISR_TIMER_CNT, 0); | 1877 | sky2_write32(hw, STAT_ISR_TIMER_CNT, 0); |
1882 | sky2_read8(hw, STAT_ISR_TIMER_CTRL); | 1878 | sky2_read8(hw, STAT_ISR_TIMER_CTRL); |
1883 | 1879 | ||
1880 | sky2_rx_stop(sky2); | ||
1881 | |||
1882 | /* Disable port IRQ */ | ||
1883 | imask = sky2_read32(hw, B0_IMSK); | ||
1884 | imask &= ~portirq_msk[port]; | ||
1885 | sky2_write32(hw, B0_IMSK, imask); | ||
1886 | sky2_read32(hw, B0_IMSK); | ||
1887 | |||
1884 | synchronize_irq(hw->pdev->irq); | 1888 | synchronize_irq(hw->pdev->irq); |
1885 | napi_synchronize(&hw->napi); | 1889 | napi_synchronize(&hw->napi); |
1886 | 1890 | ||
@@ -2366,7 +2370,7 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) | |||
2366 | { | 2370 | { |
2367 | struct sky2_port *sky2 = netdev_priv(dev); | 2371 | struct sky2_port *sky2 = netdev_priv(dev); |
2368 | 2372 | ||
2369 | if (netif_running(dev)) { | 2373 | if (likely(netif_running(dev) && !sky2->restarting)) { |
2370 | netif_tx_lock(dev); | 2374 | netif_tx_lock(dev); |
2371 | sky2_tx_complete(sky2, last); | 2375 | sky2_tx_complete(sky2, last); |
2372 | netif_tx_unlock(dev); | 2376 | netif_tx_unlock(dev); |
@@ -4290,6 +4294,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
4290 | spin_lock_init(&sky2->phy_lock); | 4294 | spin_lock_init(&sky2->phy_lock); |
4291 | sky2->tx_pending = TX_DEF_PENDING; | 4295 | sky2->tx_pending = TX_DEF_PENDING; |
4292 | sky2->rx_pending = RX_DEF_PENDING; | 4296 | sky2->rx_pending = RX_DEF_PENDING; |
4297 | sky2->restarting = 0; | ||
4293 | 4298 | ||
4294 | hw->dev[port] = dev; | 4299 | hw->dev[port] = dev; |
4295 | 4300 | ||
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index b5549c9e5107..4486b066b43f 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -2051,6 +2051,7 @@ struct sky2_port { | |||
2051 | u8 duplex; /* DUPLEX_HALF, DUPLEX_FULL */ | 2051 | u8 duplex; /* DUPLEX_HALF, DUPLEX_FULL */ |
2052 | u8 rx_csum; | 2052 | u8 rx_csum; |
2053 | u8 wol; | 2053 | u8 wol; |
2054 | u8 restarting; | ||
2054 | enum flow_control flow_mode; | 2055 | enum flow_control flow_mode; |
2055 | enum flow_control flow_status; | 2056 | enum flow_control flow_status; |
2056 | 2057 | ||
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index fdcbaf8dfa73..1c70e999cc50 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -1774,6 +1774,7 @@ static const struct net_device_ops smc_netdev_ops = { | |||
1774 | .ndo_start_xmit = smc_hard_start_xmit, | 1774 | .ndo_start_xmit = smc_hard_start_xmit, |
1775 | .ndo_tx_timeout = smc_timeout, | 1775 | .ndo_tx_timeout = smc_timeout, |
1776 | .ndo_set_multicast_list = smc_set_multicast_list, | 1776 | .ndo_set_multicast_list = smc_set_multicast_list, |
1777 | .ndo_change_mtu = eth_change_mtu, | ||
1777 | .ndo_validate_addr = eth_validate_addr, | 1778 | .ndo_validate_addr = eth_validate_addr, |
1778 | .ndo_set_mac_address = eth_mac_addr, | 1779 | .ndo_set_mac_address = eth_mac_addr, |
1779 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1780 | #ifdef CONFIG_NET_POLL_CONTROLLER |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index f1f773b17fe1..57a159fac99f 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -186,7 +186,8 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
186 | #define SMC_outsb(a, r, p, l) writesb((a) + (r), p, (l)) | 186 | #define SMC_outsb(a, r, p, l) writesb((a) + (r), p, (l)) |
187 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | 187 | #define SMC_IRQ_FLAGS (-1) /* from resource */ |
188 | 188 | ||
189 | #elif defined(CONFIG_MACH_LOGICPD_PXA270) | 189 | #elif defined(CONFIG_MACH_LOGICPD_PXA270) \ |
190 | || defined(CONFIG_MACH_NOMADIK_8815NHK) | ||
190 | 191 | ||
191 | #define SMC_CAN_USE_8BIT 0 | 192 | #define SMC_CAN_USE_8BIT 0 |
192 | #define SMC_CAN_USE_16BIT 1 | 193 | #define SMC_CAN_USE_16BIT 1 |
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index b60639bd181b..94b6d2658ddc 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
@@ -1779,6 +1779,7 @@ static const struct net_device_ops smsc911x_netdev_ops = { | |||
1779 | .ndo_get_stats = smsc911x_get_stats, | 1779 | .ndo_get_stats = smsc911x_get_stats, |
1780 | .ndo_set_multicast_list = smsc911x_set_multicast_list, | 1780 | .ndo_set_multicast_list = smsc911x_set_multicast_list, |
1781 | .ndo_do_ioctl = smsc911x_do_ioctl, | 1781 | .ndo_do_ioctl = smsc911x_do_ioctl, |
1782 | .ndo_change_mtu = eth_change_mtu, | ||
1782 | .ndo_validate_addr = eth_validate_addr, | 1783 | .ndo_validate_addr = eth_validate_addr, |
1783 | .ndo_set_mac_address = smsc911x_set_mac_address, | 1784 | .ndo_set_mac_address = smsc911x_set_mac_address, |
1784 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1785 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -1938,7 +1939,7 @@ static int __devexit smsc911x_drv_remove(struct platform_device *pdev) | |||
1938 | if (!res) | 1939 | if (!res) |
1939 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1940 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1940 | 1941 | ||
1941 | release_mem_region(res->start, res->end - res->start); | 1942 | release_mem_region(res->start, resource_size(res)); |
1942 | 1943 | ||
1943 | iounmap(pdata->ioaddr); | 1944 | iounmap(pdata->ioaddr); |
1944 | 1945 | ||
@@ -1976,7 +1977,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
1976 | retval = -ENODEV; | 1977 | retval = -ENODEV; |
1977 | goto out_0; | 1978 | goto out_0; |
1978 | } | 1979 | } |
1979 | res_size = res->end - res->start + 1; | 1980 | res_size = resource_size(res); |
1980 | 1981 | ||
1981 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 1982 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
1982 | if (!irq_res) { | 1983 | if (!irq_res) { |
@@ -2104,7 +2105,7 @@ out_unmap_io_3: | |||
2104 | out_free_netdev_2: | 2105 | out_free_netdev_2: |
2105 | free_netdev(dev); | 2106 | free_netdev(dev); |
2106 | out_release_io_1: | 2107 | out_release_io_1: |
2107 | release_mem_region(res->start, res->end - res->start); | 2108 | release_mem_region(res->start, resource_size(res)); |
2108 | out_0: | 2109 | out_0: |
2109 | return retval; | 2110 | return retval; |
2110 | } | 2111 | } |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 838cce8b8fff..669253c7bd41 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -180,7 +180,7 @@ static int full_duplex[MAX_UNITS] = {0, }; | |||
180 | /* These identify the driver base version and may not be removed. */ | 180 | /* These identify the driver base version and may not be removed. */ |
181 | static const char version[] __devinitconst = | 181 | static const char version[] __devinitconst = |
182 | KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" | 182 | KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" |
183 | KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; | 183 | " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; |
184 | 184 | ||
185 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 185 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
186 | MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver"); | 186 | MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver"); |
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 545f81b34ad7..d1521c3875b2 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -1698,13 +1698,13 @@ static int netdev_close(struct net_device *dev) | |||
1698 | 1698 | ||
1699 | #ifdef __i386__ | 1699 | #ifdef __i386__ |
1700 | if (netif_msg_hw(np)) { | 1700 | if (netif_msg_hw(np)) { |
1701 | printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n", | 1701 | printk(KERN_DEBUG " Tx ring at %8.8x:\n", |
1702 | (int)(np->tx_ring_dma)); | 1702 | (int)(np->tx_ring_dma)); |
1703 | for (i = 0; i < TX_RING_SIZE; i++) | 1703 | for (i = 0; i < TX_RING_SIZE; i++) |
1704 | printk(" #%d desc. %4.4x %8.8x %8.8x.\n", | 1704 | printk(KERN_DEBUG " #%d desc. %4.4x %8.8x %8.8x.\n", |
1705 | i, np->tx_ring[i].status, np->tx_ring[i].frag[0].addr, | 1705 | i, np->tx_ring[i].status, np->tx_ring[i].frag[0].addr, |
1706 | np->tx_ring[i].frag[0].length); | 1706 | np->tx_ring[i].frag[0].length); |
1707 | printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", | 1707 | printk(KERN_DEBUG " Rx ring %8.8x:\n", |
1708 | (int)(np->rx_ring_dma)); | 1708 | (int)(np->rx_ring_dma)); |
1709 | for (i = 0; i < /*RX_RING_SIZE*/4 ; i++) { | 1709 | for (i = 0; i < /*RX_RING_SIZE*/4 ; i++) { |
1710 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", | 1710 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", |
diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c index a82fb2aca4cb..f1e5e4542c2a 100644 --- a/drivers/net/sunvnet.c +++ b/drivers/net/sunvnet.c | |||
@@ -1016,7 +1016,9 @@ static const struct net_device_ops vnet_ops = { | |||
1016 | .ndo_open = vnet_open, | 1016 | .ndo_open = vnet_open, |
1017 | .ndo_stop = vnet_close, | 1017 | .ndo_stop = vnet_close, |
1018 | .ndo_set_multicast_list = vnet_set_rx_mode, | 1018 | .ndo_set_multicast_list = vnet_set_rx_mode, |
1019 | .ndo_change_mtu = eth_change_mtu, | ||
1019 | .ndo_set_mac_address = vnet_set_mac_addr, | 1020 | .ndo_set_mac_address = vnet_set_mac_addr, |
1021 | .ndo_validate_addr = eth_validate_addr, | ||
1020 | .ndo_tx_timeout = vnet_tx_timeout, | 1022 | .ndo_tx_timeout = vnet_tx_timeout, |
1021 | .ndo_change_mtu = vnet_change_mtu, | 1023 | .ndo_change_mtu = vnet_change_mtu, |
1022 | .ndo_start_xmit = vnet_start_xmit, | 1024 | .ndo_start_xmit = vnet_start_xmit, |
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c index 9d896116cf76..08a6c41c1599 100644 --- a/drivers/net/tokenring/ibmtr.c +++ b/drivers/net/tokenring/ibmtr.c | |||
@@ -1912,7 +1912,7 @@ static int __init ibmtr_init(void) | |||
1912 | 1912 | ||
1913 | find_turbo_adapters(io); | 1913 | find_turbo_adapters(io); |
1914 | 1914 | ||
1915 | for (i = 0; io[i] && (i < IBMTR_MAX_ADAPTERS); i++) { | 1915 | for (i = 0; i < IBMTR_MAX_ADAPTERS && io[i]; i++) { |
1916 | struct net_device *dev; | 1916 | struct net_device *dev; |
1917 | irq[i] = 0; | 1917 | irq[i] = 0; |
1918 | mem[i] = 0; | 1918 | mem[i] = 0; |
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 0f78f99f9b20..7030bd5e9848 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c | |||
@@ -1132,7 +1132,9 @@ static int tsi108_get_mac(struct net_device *dev) | |||
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | if (!is_valid_ether_addr(dev->dev_addr)) { | 1134 | if (!is_valid_ether_addr(dev->dev_addr)) { |
1135 | printk("KERN_ERR: word1: %08x, word2: %08x\n", word1, word2); | 1135 | printk(KERN_ERR |
1136 | "%s: Invalid MAC address. word1: %08x, word2: %08x\n", | ||
1137 | dev->name, word1, word2); | ||
1136 | return -EINVAL; | 1138 | return -EINVAL; |
1137 | } | 1139 | } |
1138 | 1140 | ||
@@ -1201,8 +1203,8 @@ static void tsi108_set_rx_mode(struct net_device *dev) | |||
1201 | __set_bit(hash, &data->mc_hash[0]); | 1203 | __set_bit(hash, &data->mc_hash[0]); |
1202 | } else { | 1204 | } else { |
1203 | printk(KERN_ERR | 1205 | printk(KERN_ERR |
1204 | "%s: got multicast address of length %d " | 1206 | "%s: got multicast address of length %d instead of 6.\n", |
1205 | "instead of 6.\n", dev->name, | 1207 | dev->name, |
1206 | mc->dmi_addrlen); | 1208 | mc->dmi_addrlen); |
1207 | } | 1209 | } |
1208 | 1210 | ||
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 81f054dbb88d..ef49744a5085 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -944,9 +944,10 @@ static void de_set_media (struct de_private *de) | |||
944 | macmode &= ~FullDuplex; | 944 | macmode &= ~FullDuplex; |
945 | 945 | ||
946 | if (netif_msg_link(de)) { | 946 | if (netif_msg_link(de)) { |
947 | printk(KERN_INFO "%s: set link %s\n" | 947 | printk(KERN_INFO |
948 | KERN_INFO "%s: mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n" | 948 | "%s: set link %s\n" |
949 | KERN_INFO "%s: set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", | 949 | "%s: mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n" |
950 | "%s: set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", | ||
950 | de->dev->name, media_name[media], | 951 | de->dev->name, media_name[media], |
951 | de->dev->name, dr32(MacMode), dr32(SIAStatus), | 952 | de->dev->name, dr32(MacMode), dr32(SIAStatus), |
952 | dr32(CSR13), dr32(CSR14), dr32(CSR15), | 953 | dr32(CSR13), dr32(CSR14), dr32(CSR15), |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index eb72d2e9ab3d..acfdccd44567 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -5059,7 +5059,7 @@ mii_get_phy(struct net_device *dev) | |||
5059 | if ((id == 0) || (id == 65535)) continue; /* Valid ID? */ | 5059 | if ((id == 0) || (id == 65535)) continue; /* Valid ID? */ |
5060 | for (j=0; j<limit; j++) { /* Search PHY table */ | 5060 | for (j=0; j<limit; j++) { /* Search PHY table */ |
5061 | if (id != phy_info[j].id) continue; /* ID match? */ | 5061 | if (id != phy_info[j].id) continue; /* ID match? */ |
5062 | for (k=0; lp->phy[k].id && (k < DE4X5_MAX_PHY); k++); | 5062 | for (k=0; k < DE4X5_MAX_PHY && lp->phy[k].id; k++); |
5063 | if (k < DE4X5_MAX_PHY) { | 5063 | if (k < DE4X5_MAX_PHY) { |
5064 | memcpy((char *)&lp->phy[k], | 5064 | memcpy((char *)&lp->phy[k], |
5065 | (char *)&phy_info[j], sizeof(struct phy_table)); | 5065 | (char *)&phy_info[j], sizeof(struct phy_table)); |
@@ -5072,7 +5072,7 @@ mii_get_phy(struct net_device *dev) | |||
5072 | break; | 5072 | break; |
5073 | } | 5073 | } |
5074 | if ((j == limit) && (i < DE4X5_MAX_MII)) { | 5074 | if ((j == limit) && (i < DE4X5_MAX_MII)) { |
5075 | for (k=0; lp->phy[k].id && (k < DE4X5_MAX_PHY); k++); | 5075 | for (k=0; k < DE4X5_MAX_PHY && lp->phy[k].id; k++); |
5076 | lp->phy[k].addr = i; | 5076 | lp->phy[k].addr = i; |
5077 | lp->phy[k].id = id; | 5077 | lp->phy[k].id = id; |
5078 | lp->phy[k].spd.reg = GENERIC_REG; /* ANLPA register */ | 5078 | lp->phy[k].spd.reg = GENERIC_REG; /* ANLPA register */ |
@@ -5091,7 +5091,7 @@ mii_get_phy(struct net_device *dev) | |||
5091 | purgatory: | 5091 | purgatory: |
5092 | lp->active = 0; | 5092 | lp->active = 0; |
5093 | if (lp->phy[0].id) { /* Reset the PHY devices */ | 5093 | if (lp->phy[0].id) { /* Reset the PHY devices */ |
5094 | for (k=0; lp->phy[k].id && (k < DE4X5_MAX_PHY); k++) { /*For each PHY*/ | 5094 | for (k=0; k < DE4X5_MAX_PHY && lp->phy[k].id; k++) { /*For each PHY*/ |
5095 | mii_wr(MII_CR_RST, MII_CR, lp->phy[k].addr, DE4X5_MII); | 5095 | mii_wr(MII_CR_RST, MII_CR, lp->phy[k].addr, DE4X5_MII); |
5096 | while (mii_rd(MII_CR, lp->phy[k].addr, DE4X5_MII) & MII_CR_RST); | 5096 | while (mii_rd(MII_CR, lp->phy[k].addr, DE4X5_MII) & MII_CR_RST); |
5097 | 5097 | ||
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 2abb5d3becc6..99a63649f4fc 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -570,16 +570,18 @@ static void tulip_tx_timeout(struct net_device *dev) | |||
570 | (unsigned int)tp->rx_ring[i].buffer2, | 570 | (unsigned int)tp->rx_ring[i].buffer2, |
571 | buf[0], buf[1], buf[2]); | 571 | buf[0], buf[1], buf[2]); |
572 | for (j = 0; buf[j] != 0xee && j < 1600; j++) | 572 | for (j = 0; buf[j] != 0xee && j < 1600; j++) |
573 | if (j < 100) printk(" %2.2x", buf[j]); | 573 | if (j < 100) |
574 | printk(" j=%d.\n", j); | 574 | printk(KERN_CONT " %2.2x", buf[j]); |
575 | printk(KERN_CONT " j=%d.\n", j); | ||
575 | } | 576 | } |
576 | printk(KERN_DEBUG " Rx ring %8.8x: ", (int)tp->rx_ring); | 577 | printk(KERN_DEBUG " Rx ring %8.8x: ", (int)tp->rx_ring); |
577 | for (i = 0; i < RX_RING_SIZE; i++) | 578 | for (i = 0; i < RX_RING_SIZE; i++) |
578 | printk(" %8.8x", (unsigned int)tp->rx_ring[i].status); | 579 | printk(KERN_CONT " %8.8x", |
579 | printk("\n" KERN_DEBUG " Tx ring %8.8x: ", (int)tp->tx_ring); | 580 | (unsigned int)tp->rx_ring[i].status); |
581 | printk(KERN_DEBUG " Tx ring %8.8x: ", (int)tp->tx_ring); | ||
580 | for (i = 0; i < TX_RING_SIZE; i++) | 582 | for (i = 0; i < TX_RING_SIZE; i++) |
581 | printk(" %8.8x", (unsigned int)tp->tx_ring[i].status); | 583 | printk(KERN_CONT " %8.8x", (unsigned int)tp->tx_ring[i].status); |
582 | printk("\n"); | 584 | printk(KERN_CONT "\n"); |
583 | } | 585 | } |
584 | #endif | 586 | #endif |
585 | 587 | ||
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 842b1a2c40d4..0f15773dae52 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -142,7 +142,7 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; | |||
142 | static const char version[] __initconst = | 142 | static const char version[] __initconst = |
143 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " | 143 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " |
144 | DRV_RELDATE " Donald Becker <becker@scyld.com>\n" | 144 | DRV_RELDATE " Donald Becker <becker@scyld.com>\n" |
145 | KERN_INFO " http://www.scyld.com/network/drivers.html\n"; | 145 | " http://www.scyld.com/network/drivers.html\n"; |
146 | 146 | ||
147 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 147 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
148 | MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver"); | 148 | MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver"); |
@@ -939,7 +939,7 @@ static void tx_timeout(struct net_device *dev) | |||
939 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); | 939 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); |
940 | for (i = 0; i < RX_RING_SIZE; i++) | 940 | for (i = 0; i < RX_RING_SIZE; i++) |
941 | printk(" %8.8x", (unsigned int)np->rx_ring[i].status); | 941 | printk(" %8.8x", (unsigned int)np->rx_ring[i].status); |
942 | printk("\n"KERN_DEBUG" Tx ring %p: ", np->tx_ring); | 942 | printk(KERN_DEBUG" Tx ring %p: ", np->tx_ring); |
943 | for (i = 0; i < TX_RING_SIZE; i++) | 943 | for (i = 0; i < TX_RING_SIZE; i++) |
944 | printk(" %8.8x", np->tx_ring[i].status); | 944 | printk(" %8.8x", np->tx_ring[i].status); |
945 | printk("\n"); | 945 | printk("\n"); |
@@ -1520,7 +1520,7 @@ static int netdev_close(struct net_device *dev) | |||
1520 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x.\n", | 1520 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x.\n", |
1521 | i, np->tx_ring[i].length, | 1521 | i, np->tx_ring[i].length, |
1522 | np->tx_ring[i].status, np->tx_ring[i].buffer1); | 1522 | np->tx_ring[i].status, np->tx_ring[i].buffer1); |
1523 | printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", | 1523 | printk(KERN_DEBUG " Rx ring %8.8x:\n", |
1524 | (int)np->rx_ring); | 1524 | (int)np->rx_ring); |
1525 | for (i = 0; i < RX_RING_SIZE; i++) { | 1525 | for (i = 0; i < RX_RING_SIZE; i++) { |
1526 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", | 1526 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 11a0ba47b677..027f7aba26af 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -486,12 +486,14 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait) | |||
486 | { | 486 | { |
487 | struct tun_file *tfile = file->private_data; | 487 | struct tun_file *tfile = file->private_data; |
488 | struct tun_struct *tun = __tun_get(tfile); | 488 | struct tun_struct *tun = __tun_get(tfile); |
489 | struct sock *sk = tun->sk; | 489 | struct sock *sk; |
490 | unsigned int mask = 0; | 490 | unsigned int mask = 0; |
491 | 491 | ||
492 | if (!tun) | 492 | if (!tun) |
493 | return POLLERR; | 493 | return POLLERR; |
494 | 494 | ||
495 | sk = tun->sk; | ||
496 | |||
495 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); | 497 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); |
496 | 498 | ||
497 | poll_wait(file, &tun->socket.wait, wait); | 499 | poll_wait(file, &tun->socket.wait, wait); |
@@ -1324,20 +1326,22 @@ static int tun_chr_close(struct inode *inode, struct file *file) | |||
1324 | struct tun_file *tfile = file->private_data; | 1326 | struct tun_file *tfile = file->private_data; |
1325 | struct tun_struct *tun; | 1327 | struct tun_struct *tun; |
1326 | 1328 | ||
1327 | |||
1328 | rtnl_lock(); | ||
1329 | tun = __tun_get(tfile); | 1329 | tun = __tun_get(tfile); |
1330 | if (tun) { | 1330 | if (tun) { |
1331 | DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name); | 1331 | struct net_device *dev = tun->dev; |
1332 | |||
1333 | DBG(KERN_INFO "%s: tun_chr_close\n", dev->name); | ||
1332 | 1334 | ||
1333 | __tun_detach(tun); | 1335 | __tun_detach(tun); |
1334 | 1336 | ||
1335 | /* If desireable, unregister the netdevice. */ | 1337 | /* If desireable, unregister the netdevice. */ |
1336 | if (!(tun->flags & TUN_PERSIST)) | 1338 | if (!(tun->flags & TUN_PERSIST)) { |
1337 | unregister_netdevice(tun->dev); | 1339 | rtnl_lock(); |
1338 | 1340 | if (dev->reg_state == NETREG_REGISTERED) | |
1341 | unregister_netdevice(dev); | ||
1342 | rtnl_unlock(); | ||
1343 | } | ||
1339 | } | 1344 | } |
1340 | rtnl_unlock(); | ||
1341 | 1345 | ||
1342 | tun = tfile->tun; | 1346 | tun = tfile->tun; |
1343 | if (tun) | 1347 | if (tun) |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 40c6eba775ce..3b957e6412ee 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -1590,13 +1590,13 @@ static int init_phy(struct net_device *dev) | |||
1590 | priv->oldspeed = 0; | 1590 | priv->oldspeed = 0; |
1591 | priv->oldduplex = -1; | 1591 | priv->oldduplex = -1; |
1592 | 1592 | ||
1593 | if (!ug_info->phy_node) | ||
1594 | return 0; | ||
1595 | |||
1596 | phydev = of_phy_connect(dev, ug_info->phy_node, &adjust_link, 0, | 1593 | phydev = of_phy_connect(dev, ug_info->phy_node, &adjust_link, 0, |
1597 | priv->phy_interface); | 1594 | priv->phy_interface); |
1595 | if (!phydev) | ||
1596 | phydev = of_phy_connect_fixed_link(dev, &adjust_link, | ||
1597 | priv->phy_interface); | ||
1598 | if (!phydev) { | 1598 | if (!phydev) { |
1599 | printk("%s: Could not attach to PHY\n", dev->name); | 1599 | dev_err(&dev->dev, "Could not attach to PHY\n"); |
1600 | return -ENODEV; | 1600 | return -ENODEV; |
1601 | } | 1601 | } |
1602 | 1602 | ||
@@ -3608,9 +3608,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3608 | struct ucc_geth_private *ugeth = NULL; | 3608 | struct ucc_geth_private *ugeth = NULL; |
3609 | struct ucc_geth_info *ug_info; | 3609 | struct ucc_geth_info *ug_info; |
3610 | struct resource res; | 3610 | struct resource res; |
3611 | struct device_node *phy; | ||
3612 | int err, ucc_num, max_speed = 0; | 3611 | int err, ucc_num, max_speed = 0; |
3613 | const u32 *fixed_link; | ||
3614 | const unsigned int *prop; | 3612 | const unsigned int *prop; |
3615 | const char *sprop; | 3613 | const char *sprop; |
3616 | const void *mac_addr; | 3614 | const void *mac_addr; |
@@ -3708,15 +3706,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3708 | 3706 | ||
3709 | ug_info->uf_info.regs = res.start; | 3707 | ug_info->uf_info.regs = res.start; |
3710 | ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); | 3708 | ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); |
3711 | fixed_link = of_get_property(np, "fixed-link", NULL); | 3709 | |
3712 | if (fixed_link) { | 3710 | ug_info->phy_node = of_parse_phandle(np, "phy-handle", 0); |
3713 | phy = NULL; | ||
3714 | } else { | ||
3715 | phy = of_parse_phandle(np, "phy-handle", 0); | ||
3716 | if (phy == NULL) | ||
3717 | return -ENODEV; | ||
3718 | } | ||
3719 | ug_info->phy_node = phy; | ||
3720 | 3711 | ||
3721 | /* Find the TBI PHY node. If it's not there, we don't support SGMII */ | 3712 | /* Find the TBI PHY node. If it's not there, we don't support SGMII */ |
3722 | ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0); | 3713 | ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0); |
@@ -3725,7 +3716,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3725 | prop = of_get_property(np, "phy-connection-type", NULL); | 3716 | prop = of_get_property(np, "phy-connection-type", NULL); |
3726 | if (!prop) { | 3717 | if (!prop) { |
3727 | /* handle interface property present in old trees */ | 3718 | /* handle interface property present in old trees */ |
3728 | prop = of_get_property(phy, "interface", NULL); | 3719 | prop = of_get_property(ug_info->phy_node, "interface", NULL); |
3729 | if (prop != NULL) { | 3720 | if (prop != NULL) { |
3730 | phy_interface = enet_to_phy_interface[*prop]; | 3721 | phy_interface = enet_to_phy_interface[*prop]; |
3731 | max_speed = enet_to_speed[*prop]; | 3722 | max_speed = enet_to_speed[*prop]; |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index a906d3998131..c47237c2d638 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -369,4 +369,12 @@ config USB_NET_INT51X1 | |||
369 | (Powerline Communications) solution with an Intellon | 369 | (Powerline Communications) solution with an Intellon |
370 | INT51x1/INT5200 chip, like the "devolo dLan duo". | 370 | INT51x1/INT5200 chip, like the "devolo dLan duo". |
371 | 371 | ||
372 | config USB_CDC_PHONET | ||
373 | tristate "CDC Phonet support" | ||
374 | depends on PHONET | ||
375 | help | ||
376 | Choose this option to support the Phonet interface to a Nokia | ||
377 | cellular modem, as found on most Nokia handsets with the | ||
378 | "PC suite" USB profile. | ||
379 | |||
372 | endmenu | 380 | endmenu |
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile index b870b0b1cbe0..e17afb78f372 100644 --- a/drivers/net/usb/Makefile +++ b/drivers/net/usb/Makefile | |||
@@ -21,4 +21,5 @@ obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o | |||
21 | obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o | 21 | obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o |
22 | obj-$(CONFIG_USB_USBNET) += usbnet.o | 22 | obj-$(CONFIG_USB_USBNET) += usbnet.o |
23 | obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o | 23 | obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o |
24 | obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o | ||
24 | 25 | ||
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c new file mode 100644 index 000000000000..792af72da8ac --- /dev/null +++ b/drivers/net/usb/cdc-phonet.c | |||
@@ -0,0 +1,461 @@ | |||
1 | /* | ||
2 | * phonet.c -- USB CDC Phonet host driver | ||
3 | * | ||
4 | * Copyright (C) 2008-2009 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Author: Rémi Denis-Courmont | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Â See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/usb.h> | ||
26 | #include <linux/usb/cdc.h> | ||
27 | #include <linux/netdevice.h> | ||
28 | #include <linux/if_arp.h> | ||
29 | #include <linux/if_phonet.h> | ||
30 | |||
31 | #define PN_MEDIA_USB 0x1B | ||
32 | |||
33 | static const unsigned rxq_size = 17; | ||
34 | |||
35 | struct usbpn_dev { | ||
36 | struct net_device *dev; | ||
37 | |||
38 | struct usb_interface *intf, *data_intf; | ||
39 | struct usb_device *usb; | ||
40 | unsigned int tx_pipe, rx_pipe; | ||
41 | u8 active_setting; | ||
42 | u8 disconnected; | ||
43 | |||
44 | unsigned tx_queue; | ||
45 | spinlock_t tx_lock; | ||
46 | |||
47 | spinlock_t rx_lock; | ||
48 | struct sk_buff *rx_skb; | ||
49 | struct urb *urbs[0]; | ||
50 | }; | ||
51 | |||
52 | static void tx_complete(struct urb *req); | ||
53 | static void rx_complete(struct urb *req); | ||
54 | |||
55 | /* | ||
56 | * Network device callbacks | ||
57 | */ | ||
58 | static int usbpn_xmit(struct sk_buff *skb, struct net_device *dev) | ||
59 | { | ||
60 | struct usbpn_dev *pnd = netdev_priv(dev); | ||
61 | struct urb *req = NULL; | ||
62 | unsigned long flags; | ||
63 | int err; | ||
64 | |||
65 | if (skb->protocol != htons(ETH_P_PHONET)) | ||
66 | goto drop; | ||
67 | |||
68 | req = usb_alloc_urb(0, GFP_ATOMIC); | ||
69 | if (!req) | ||
70 | goto drop; | ||
71 | usb_fill_bulk_urb(req, pnd->usb, pnd->tx_pipe, skb->data, skb->len, | ||
72 | tx_complete, skb); | ||
73 | req->transfer_flags = URB_ZERO_PACKET; | ||
74 | err = usb_submit_urb(req, GFP_ATOMIC); | ||
75 | if (err) { | ||
76 | usb_free_urb(req); | ||
77 | goto drop; | ||
78 | } | ||
79 | |||
80 | spin_lock_irqsave(&pnd->tx_lock, flags); | ||
81 | pnd->tx_queue++; | ||
82 | if (pnd->tx_queue >= dev->tx_queue_len) | ||
83 | netif_stop_queue(dev); | ||
84 | spin_unlock_irqrestore(&pnd->tx_lock, flags); | ||
85 | return 0; | ||
86 | |||
87 | drop: | ||
88 | dev_kfree_skb(skb); | ||
89 | dev->stats.tx_dropped++; | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | static void tx_complete(struct urb *req) | ||
94 | { | ||
95 | struct sk_buff *skb = req->context; | ||
96 | struct net_device *dev = skb->dev; | ||
97 | struct usbpn_dev *pnd = netdev_priv(dev); | ||
98 | |||
99 | switch (req->status) { | ||
100 | case 0: | ||
101 | dev->stats.tx_bytes += skb->len; | ||
102 | break; | ||
103 | |||
104 | case -ENOENT: | ||
105 | case -ECONNRESET: | ||
106 | case -ESHUTDOWN: | ||
107 | dev->stats.tx_aborted_errors++; | ||
108 | default: | ||
109 | dev->stats.tx_errors++; | ||
110 | dev_dbg(&dev->dev, "TX error (%d)\n", req->status); | ||
111 | } | ||
112 | dev->stats.tx_packets++; | ||
113 | |||
114 | spin_lock(&pnd->tx_lock); | ||
115 | pnd->tx_queue--; | ||
116 | netif_wake_queue(dev); | ||
117 | spin_unlock(&pnd->tx_lock); | ||
118 | |||
119 | dev_kfree_skb_any(skb); | ||
120 | usb_free_urb(req); | ||
121 | } | ||
122 | |||
123 | static int rx_submit(struct usbpn_dev *pnd, struct urb *req, gfp_t gfp_flags) | ||
124 | { | ||
125 | struct net_device *dev = pnd->dev; | ||
126 | struct page *page; | ||
127 | int err; | ||
128 | |||
129 | page = __netdev_alloc_page(dev, gfp_flags); | ||
130 | if (!page) | ||
131 | return -ENOMEM; | ||
132 | |||
133 | usb_fill_bulk_urb(req, pnd->usb, pnd->rx_pipe, page_address(page), | ||
134 | PAGE_SIZE, rx_complete, dev); | ||
135 | req->transfer_flags = 0; | ||
136 | err = usb_submit_urb(req, gfp_flags); | ||
137 | if (unlikely(err)) { | ||
138 | dev_dbg(&dev->dev, "RX submit error (%d)\n", err); | ||
139 | netdev_free_page(dev, page); | ||
140 | } | ||
141 | return err; | ||
142 | } | ||
143 | |||
144 | static void rx_complete(struct urb *req) | ||
145 | { | ||
146 | struct net_device *dev = req->context; | ||
147 | struct usbpn_dev *pnd = netdev_priv(dev); | ||
148 | struct page *page = virt_to_page(req->transfer_buffer); | ||
149 | struct sk_buff *skb; | ||
150 | unsigned long flags; | ||
151 | |||
152 | switch (req->status) { | ||
153 | case 0: | ||
154 | spin_lock_irqsave(&pnd->rx_lock, flags); | ||
155 | skb = pnd->rx_skb; | ||
156 | if (!skb) { | ||
157 | skb = pnd->rx_skb = netdev_alloc_skb(dev, 12); | ||
158 | if (likely(skb)) { | ||
159 | /* Can't use pskb_pull() on page in IRQ */ | ||
160 | memcpy(skb_put(skb, 1), page_address(page), 1); | ||
161 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | ||
162 | page, 1, req->actual_length); | ||
163 | page = NULL; | ||
164 | } | ||
165 | } else { | ||
166 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | ||
167 | page, 0, req->actual_length); | ||
168 | page = NULL; | ||
169 | } | ||
170 | if (req->actual_length < PAGE_SIZE) | ||
171 | pnd->rx_skb = NULL; /* Last fragment */ | ||
172 | else | ||
173 | skb = NULL; | ||
174 | spin_unlock_irqrestore(&pnd->rx_lock, flags); | ||
175 | if (skb) { | ||
176 | skb->protocol = htons(ETH_P_PHONET); | ||
177 | skb_reset_mac_header(skb); | ||
178 | __skb_pull(skb, 1); | ||
179 | skb->dev = dev; | ||
180 | dev->stats.rx_packets++; | ||
181 | dev->stats.rx_bytes += skb->len; | ||
182 | |||
183 | netif_rx(skb); | ||
184 | } | ||
185 | goto resubmit; | ||
186 | |||
187 | case -ENOENT: | ||
188 | case -ECONNRESET: | ||
189 | case -ESHUTDOWN: | ||
190 | req = NULL; | ||
191 | break; | ||
192 | |||
193 | case -EOVERFLOW: | ||
194 | dev->stats.rx_over_errors++; | ||
195 | dev_dbg(&dev->dev, "RX overflow\n"); | ||
196 | break; | ||
197 | |||
198 | case -EILSEQ: | ||
199 | dev->stats.rx_crc_errors++; | ||
200 | break; | ||
201 | } | ||
202 | |||
203 | dev->stats.rx_errors++; | ||
204 | resubmit: | ||
205 | if (page) | ||
206 | netdev_free_page(dev, page); | ||
207 | if (req) | ||
208 | rx_submit(pnd, req, GFP_ATOMIC); | ||
209 | } | ||
210 | |||
211 | static int usbpn_close(struct net_device *dev); | ||
212 | |||
213 | static int usbpn_open(struct net_device *dev) | ||
214 | { | ||
215 | struct usbpn_dev *pnd = netdev_priv(dev); | ||
216 | int err; | ||
217 | unsigned i; | ||
218 | unsigned num = pnd->data_intf->cur_altsetting->desc.bInterfaceNumber; | ||
219 | |||
220 | err = usb_set_interface(pnd->usb, num, pnd->active_setting); | ||
221 | if (err) | ||
222 | return err; | ||
223 | |||
224 | for (i = 0; i < rxq_size; i++) { | ||
225 | struct urb *req = usb_alloc_urb(0, GFP_KERNEL); | ||
226 | |||
227 | if (!req || rx_submit(pnd, req, GFP_KERNEL)) { | ||
228 | usbpn_close(dev); | ||
229 | return -ENOMEM; | ||
230 | } | ||
231 | pnd->urbs[i] = req; | ||
232 | } | ||
233 | |||
234 | netif_wake_queue(dev); | ||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | static int usbpn_close(struct net_device *dev) | ||
239 | { | ||
240 | struct usbpn_dev *pnd = netdev_priv(dev); | ||
241 | unsigned i; | ||
242 | unsigned num = pnd->data_intf->cur_altsetting->desc.bInterfaceNumber; | ||
243 | |||
244 | netif_stop_queue(dev); | ||
245 | |||
246 | for (i = 0; i < rxq_size; i++) { | ||
247 | struct urb *req = pnd->urbs[i]; | ||
248 | |||
249 | if (!req) | ||
250 | continue; | ||
251 | usb_kill_urb(req); | ||
252 | usb_free_urb(req); | ||
253 | pnd->urbs[i] = NULL; | ||
254 | } | ||
255 | |||
256 | return usb_set_interface(pnd->usb, num, !pnd->active_setting); | ||
257 | } | ||
258 | |||
259 | static int usbpn_set_mtu(struct net_device *dev, int new_mtu) | ||
260 | { | ||
261 | if ((new_mtu < PHONET_MIN_MTU) || (new_mtu > PHONET_MAX_MTU)) | ||
262 | return -EINVAL; | ||
263 | |||
264 | dev->mtu = new_mtu; | ||
265 | return 0; | ||
266 | } | ||
267 | |||
268 | static const struct net_device_ops usbpn_ops = { | ||
269 | .ndo_open = usbpn_open, | ||
270 | .ndo_stop = usbpn_close, | ||
271 | .ndo_start_xmit = usbpn_xmit, | ||
272 | .ndo_change_mtu = usbpn_set_mtu, | ||
273 | }; | ||
274 | |||
275 | static void usbpn_setup(struct net_device *dev) | ||
276 | { | ||
277 | dev->features = 0; | ||
278 | dev->netdev_ops = &usbpn_ops, | ||
279 | dev->header_ops = &phonet_header_ops; | ||
280 | dev->type = ARPHRD_PHONET; | ||
281 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | ||
282 | dev->mtu = PHONET_MAX_MTU; | ||
283 | dev->hard_header_len = 1; | ||
284 | dev->dev_addr[0] = PN_MEDIA_USB; | ||
285 | dev->addr_len = 1; | ||
286 | dev->tx_queue_len = 3; | ||
287 | |||
288 | dev->destructor = free_netdev; | ||
289 | } | ||
290 | |||
291 | /* | ||
292 | * USB driver callbacks | ||
293 | */ | ||
294 | static struct usb_device_id usbpn_ids[] = { | ||
295 | { | ||
296 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | ||
297 | | USB_DEVICE_ID_MATCH_INT_CLASS | ||
298 | | USB_DEVICE_ID_MATCH_INT_SUBCLASS, | ||
299 | .idVendor = 0x0421, /* Nokia */ | ||
300 | .bInterfaceClass = USB_CLASS_COMM, | ||
301 | .bInterfaceSubClass = 0xFE, | ||
302 | }, | ||
303 | { }, | ||
304 | }; | ||
305 | |||
306 | MODULE_DEVICE_TABLE(usb, usbpn_ids); | ||
307 | |||
308 | static struct usb_driver usbpn_driver; | ||
309 | |||
310 | int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id) | ||
311 | { | ||
312 | static const char ifname[] = "usbpn%d"; | ||
313 | const struct usb_cdc_union_desc *union_header = NULL; | ||
314 | const struct usb_cdc_header_desc *phonet_header = NULL; | ||
315 | const struct usb_host_interface *data_desc; | ||
316 | struct usb_interface *data_intf; | ||
317 | struct usb_device *usbdev = interface_to_usbdev(intf); | ||
318 | struct net_device *dev; | ||
319 | struct usbpn_dev *pnd; | ||
320 | u8 *data; | ||
321 | int len, err; | ||
322 | |||
323 | data = intf->altsetting->extra; | ||
324 | len = intf->altsetting->extralen; | ||
325 | while (len >= 3) { | ||
326 | u8 dlen = data[0]; | ||
327 | if (dlen < 3) | ||
328 | return -EINVAL; | ||
329 | |||
330 | /* bDescriptorType */ | ||
331 | if (data[1] == USB_DT_CS_INTERFACE) { | ||
332 | /* bDescriptorSubType */ | ||
333 | switch (data[2]) { | ||
334 | case USB_CDC_UNION_TYPE: | ||
335 | if (union_header || dlen < 5) | ||
336 | break; | ||
337 | union_header = | ||
338 | (struct usb_cdc_union_desc *)data; | ||
339 | break; | ||
340 | case 0xAB: | ||
341 | if (phonet_header || dlen < 5) | ||
342 | break; | ||
343 | phonet_header = | ||
344 | (struct usb_cdc_header_desc *)data; | ||
345 | break; | ||
346 | } | ||
347 | } | ||
348 | data += dlen; | ||
349 | len -= dlen; | ||
350 | } | ||
351 | |||
352 | if (!union_header || !phonet_header) | ||
353 | return -EINVAL; | ||
354 | |||
355 | data_intf = usb_ifnum_to_if(usbdev, union_header->bSlaveInterface0); | ||
356 | if (data_intf == NULL) | ||
357 | return -ENODEV; | ||
358 | /* Data interface has one inactive and one active setting */ | ||
359 | if (data_intf->num_altsetting != 2) | ||
360 | return -EINVAL; | ||
361 | if (data_intf->altsetting[0].desc.bNumEndpoints == 0 | ||
362 | && data_intf->altsetting[1].desc.bNumEndpoints == 2) | ||
363 | data_desc = data_intf->altsetting + 1; | ||
364 | else | ||
365 | if (data_intf->altsetting[0].desc.bNumEndpoints == 2 | ||
366 | && data_intf->altsetting[1].desc.bNumEndpoints == 0) | ||
367 | data_desc = data_intf->altsetting; | ||
368 | else | ||
369 | return -EINVAL; | ||
370 | |||
371 | dev = alloc_netdev(sizeof(*pnd) + sizeof(pnd->urbs[0]) * rxq_size, | ||
372 | ifname, usbpn_setup); | ||
373 | if (!dev) | ||
374 | return -ENOMEM; | ||
375 | |||
376 | pnd = netdev_priv(dev); | ||
377 | SET_NETDEV_DEV(dev, &intf->dev); | ||
378 | netif_stop_queue(dev); | ||
379 | |||
380 | pnd->dev = dev; | ||
381 | pnd->usb = usb_get_dev(usbdev); | ||
382 | pnd->intf = intf; | ||
383 | pnd->data_intf = data_intf; | ||
384 | spin_lock_init(&pnd->tx_lock); | ||
385 | spin_lock_init(&pnd->rx_lock); | ||
386 | /* Endpoints */ | ||
387 | if (usb_pipein(data_desc->endpoint[0].desc.bEndpointAddress)) { | ||
388 | pnd->rx_pipe = usb_rcvbulkpipe(usbdev, | ||
389 | data_desc->endpoint[0].desc.bEndpointAddress); | ||
390 | pnd->tx_pipe = usb_sndbulkpipe(usbdev, | ||
391 | data_desc->endpoint[1].desc.bEndpointAddress); | ||
392 | } else { | ||
393 | pnd->rx_pipe = usb_rcvbulkpipe(usbdev, | ||
394 | data_desc->endpoint[1].desc.bEndpointAddress); | ||
395 | pnd->tx_pipe = usb_sndbulkpipe(usbdev, | ||
396 | data_desc->endpoint[0].desc.bEndpointAddress); | ||
397 | } | ||
398 | pnd->active_setting = data_desc - data_intf->altsetting; | ||
399 | |||
400 | err = usb_driver_claim_interface(&usbpn_driver, data_intf, pnd); | ||
401 | if (err) | ||
402 | goto out; | ||
403 | |||
404 | /* Force inactive mode until the network device is brought UP */ | ||
405 | usb_set_interface(usbdev, union_header->bSlaveInterface0, | ||
406 | !pnd->active_setting); | ||
407 | usb_set_intfdata(intf, pnd); | ||
408 | |||
409 | err = register_netdev(dev); | ||
410 | if (err) { | ||
411 | usb_driver_release_interface(&usbpn_driver, data_intf); | ||
412 | goto out; | ||
413 | } | ||
414 | |||
415 | dev_dbg(&dev->dev, "USB CDC Phonet device found\n"); | ||
416 | return 0; | ||
417 | |||
418 | out: | ||
419 | usb_set_intfdata(intf, NULL); | ||
420 | free_netdev(dev); | ||
421 | return err; | ||
422 | } | ||
423 | |||
424 | static void usbpn_disconnect(struct usb_interface *intf) | ||
425 | { | ||
426 | struct usbpn_dev *pnd = usb_get_intfdata(intf); | ||
427 | struct usb_device *usb = pnd->usb; | ||
428 | |||
429 | if (pnd->disconnected) | ||
430 | return; | ||
431 | |||
432 | pnd->disconnected = 1; | ||
433 | usb_driver_release_interface(&usbpn_driver, | ||
434 | (pnd->intf == intf) ? pnd->data_intf : pnd->intf); | ||
435 | unregister_netdev(pnd->dev); | ||
436 | usb_put_dev(usb); | ||
437 | } | ||
438 | |||
439 | static struct usb_driver usbpn_driver = { | ||
440 | .name = "cdc_phonet", | ||
441 | .probe = usbpn_probe, | ||
442 | .disconnect = usbpn_disconnect, | ||
443 | .id_table = usbpn_ids, | ||
444 | }; | ||
445 | |||
446 | static int __init usbpn_init(void) | ||
447 | { | ||
448 | return usb_register(&usbpn_driver); | ||
449 | } | ||
450 | |||
451 | static void __exit usbpn_exit(void) | ||
452 | { | ||
453 | usb_deregister(&usbpn_driver); | ||
454 | } | ||
455 | |||
456 | module_init(usbpn_init); | ||
457 | module_exit(usbpn_exit); | ||
458 | |||
459 | MODULE_AUTHOR("Remi Denis-Courmont"); | ||
460 | MODULE_DESCRIPTION("USB CDC Phonet host interface"); | ||
461 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c index cd35d50e46d4..45cebfb302cf 100644 --- a/drivers/net/usb/cdc_eem.c +++ b/drivers/net/usb/cdc_eem.c | |||
@@ -311,7 +311,7 @@ static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
311 | * bmCRC = 0 : CRC = 0xDEADBEEF | 311 | * bmCRC = 0 : CRC = 0xDEADBEEF |
312 | */ | 312 | */ |
313 | if (header & BIT(14)) | 313 | if (header & BIT(14)) |
314 | crc2 = ~crc32_le(~0, skb2->data, len); | 314 | crc2 = ~crc32_le(~0, skb2->data, skb2->len); |
315 | else | 315 | else |
316 | crc2 = 0xdeadbeef; | 316 | crc2 = 0xdeadbeef; |
317 | 317 | ||
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index e01314789718..1f9ec29fce50 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c | |||
@@ -999,6 +999,9 @@ static const struct net_device_ops kaweth_netdev_ops = { | |||
999 | .ndo_tx_timeout = kaweth_tx_timeout, | 999 | .ndo_tx_timeout = kaweth_tx_timeout, |
1000 | .ndo_set_multicast_list = kaweth_set_rx_mode, | 1000 | .ndo_set_multicast_list = kaweth_set_rx_mode, |
1001 | .ndo_get_stats = kaweth_netdev_stats, | 1001 | .ndo_get_stats = kaweth_netdev_stats, |
1002 | .ndo_change_mtu = eth_change_mtu, | ||
1003 | .ndo_set_mac_address = eth_mac_addr, | ||
1004 | .ndo_validate_addr = eth_validate_addr, | ||
1002 | }; | 1005 | }; |
1003 | 1006 | ||
1004 | static int kaweth_probe( | 1007 | static int kaweth_probe( |
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index 73acbd244aa1..631d269ac980 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
@@ -1493,6 +1493,9 @@ static const struct net_device_ops pegasus_netdev_ops = { | |||
1493 | .ndo_set_multicast_list = pegasus_set_multicast, | 1493 | .ndo_set_multicast_list = pegasus_set_multicast, |
1494 | .ndo_get_stats = pegasus_netdev_stats, | 1494 | .ndo_get_stats = pegasus_netdev_stats, |
1495 | .ndo_tx_timeout = pegasus_tx_timeout, | 1495 | .ndo_tx_timeout = pegasus_tx_timeout, |
1496 | .ndo_change_mtu = eth_change_mtu, | ||
1497 | .ndo_set_mac_address = eth_mac_addr, | ||
1498 | .ndo_validate_addr = eth_validate_addr, | ||
1496 | }; | 1499 | }; |
1497 | 1500 | ||
1498 | static struct usb_driver pegasus_driver = { | 1501 | static struct usb_driver pegasus_driver = { |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index d3489a3c4c03..88c30a58b4bd 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -621,6 +621,7 @@ static const struct net_device_ops rhine_netdev_ops = { | |||
621 | .ndo_start_xmit = rhine_start_tx, | 621 | .ndo_start_xmit = rhine_start_tx, |
622 | .ndo_get_stats = rhine_get_stats, | 622 | .ndo_get_stats = rhine_get_stats, |
623 | .ndo_set_multicast_list = rhine_set_rx_mode, | 623 | .ndo_set_multicast_list = rhine_set_rx_mode, |
624 | .ndo_change_mtu = eth_change_mtu, | ||
624 | .ndo_validate_addr = eth_validate_addr, | 625 | .ndo_validate_addr = eth_validate_addr, |
625 | .ndo_set_mac_address = eth_mac_addr, | 626 | .ndo_set_mac_address = eth_mac_addr, |
626 | .ndo_do_ioctl = netdev_ioctl, | 627 | .ndo_do_ioctl = netdev_ioctl, |
diff --git a/drivers/net/wan/hd64570.c b/drivers/net/wan/hd64570.c index 223238de475c..1ea1ef6c3b96 100644 --- a/drivers/net/wan/hd64570.c +++ b/drivers/net/wan/hd64570.c | |||
@@ -584,8 +584,9 @@ static void sca_dump_rings(struct net_device *dev) | |||
584 | sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); | 584 | sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); |
585 | for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) | 585 | for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) |
586 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); | 586 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); |
587 | printk(KERN_CONT "\n"); | ||
587 | 588 | ||
588 | printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " | 589 | printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " |
589 | "last=%u %sactive", | 590 | "last=%u %sactive", |
590 | sca_inw(get_dmac_tx(port) + CDAL, card), | 591 | sca_inw(get_dmac_tx(port) + CDAL, card), |
591 | sca_inw(get_dmac_tx(port) + EDAL, card), | 592 | sca_inw(get_dmac_tx(port) + EDAL, card), |
diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c index 497b003d7239..f099c34a3ae2 100644 --- a/drivers/net/wan/hd64572.c +++ b/drivers/net/wan/hd64572.c | |||
@@ -529,8 +529,9 @@ static void sca_dump_rings(struct net_device *dev) | |||
529 | sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in"); | 529 | sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in"); |
530 | for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++) | 530 | for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++) |
531 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); | 531 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); |
532 | printk(KERN_CONT "\n"); | ||
532 | 533 | ||
533 | printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " | 534 | printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " |
534 | "last=%u %sactive", | 535 | "last=%u %sactive", |
535 | sca_inl(get_dmac_tx(port) + CDAL, card), | 536 | sca_inl(get_dmac_tx(port) + CDAL, card), |
536 | sca_inl(get_dmac_tx(port) + EDAL, card), | 537 | sca_inl(get_dmac_tx(port) + EDAL, card), |
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 3fb9dbc88a1a..d14e95a08d66 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c | |||
@@ -326,11 +326,9 @@ sbni_pci_probe( struct net_device *dev ) | |||
326 | } | 326 | } |
327 | 327 | ||
328 | if (pci_irq_line <= 0 || pci_irq_line >= nr_irqs) | 328 | if (pci_irq_line <= 0 || pci_irq_line >= nr_irqs) |
329 | printk( KERN_WARNING " WARNING: The PCI BIOS assigned " | 329 | printk( KERN_WARNING |
330 | "this PCI card to IRQ %d, which is unlikely " | 330 | " WARNING: The PCI BIOS assigned this PCI card to IRQ %d, which is unlikely to work!.\n" |
331 | "to work!.\n" | 331 | " You should use the PCI BIOS setup to assign a valid IRQ line.\n", |
332 | KERN_WARNING " You should use the PCI BIOS " | ||
333 | "setup to assign a valid IRQ line.\n", | ||
334 | pci_irq_line ); | 332 | pci_irq_line ); |
335 | 333 | ||
336 | /* avoiding re-enable dual adapters */ | 334 | /* avoiding re-enable dual adapters */ |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index c70604f0329e..8ce5e4cee168 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -5918,20 +5918,19 @@ static int airo_set_essid(struct net_device *dev, | |||
5918 | readSsidRid(local, &SSID_rid); | 5918 | readSsidRid(local, &SSID_rid); |
5919 | 5919 | ||
5920 | /* Check if we asked for `any' */ | 5920 | /* Check if we asked for `any' */ |
5921 | if(dwrq->flags == 0) { | 5921 | if (dwrq->flags == 0) { |
5922 | /* Just send an empty SSID list */ | 5922 | /* Just send an empty SSID list */ |
5923 | memset(&SSID_rid, 0, sizeof(SSID_rid)); | 5923 | memset(&SSID_rid, 0, sizeof(SSID_rid)); |
5924 | } else { | 5924 | } else { |
5925 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; | 5925 | unsigned index = (dwrq->flags & IW_ENCODE_INDEX) - 1; |
5926 | 5926 | ||
5927 | /* Check the size of the string */ | 5927 | /* Check the size of the string */ |
5928 | if(dwrq->length > IW_ESSID_MAX_SIZE) { | 5928 | if (dwrq->length > IW_ESSID_MAX_SIZE) |
5929 | return -E2BIG ; | 5929 | return -E2BIG ; |
5930 | } | 5930 | |
5931 | /* Check if index is valid */ | 5931 | /* Check if index is valid */ |
5932 | if((index < 0) || (index >= 4)) { | 5932 | if (index >= ARRAY_SIZE(SSID_rid.ssids)) |
5933 | return -EINVAL; | 5933 | return -EINVAL; |
5934 | } | ||
5935 | 5934 | ||
5936 | /* Set the SSID */ | 5935 | /* Set the SSID */ |
5937 | memset(SSID_rid.ssids[index].ssid, 0, | 5936 | memset(SSID_rid.ssids[index].ssid, 0, |
@@ -6819,7 +6818,7 @@ static int airo_set_txpow(struct net_device *dev, | |||
6819 | return -EINVAL; | 6818 | return -EINVAL; |
6820 | } | 6819 | } |
6821 | clear_bit (FLAG_RADIO_OFF, &local->flags); | 6820 | clear_bit (FLAG_RADIO_OFF, &local->flags); |
6822 | for (i = 0; cap_rid.txPowerLevels[i] && (i < 8); i++) | 6821 | for (i = 0; i < 8 && cap_rid.txPowerLevels[i]; i++) |
6823 | if (v == cap_rid.txPowerLevels[i]) { | 6822 | if (v == cap_rid.txPowerLevels[i]) { |
6824 | readConfigRid(local, 1); | 6823 | readConfigRid(local, 1); |
6825 | local->config.txPower = v; | 6824 | local->config.txPower = v; |
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig index d26e7b485315..eb0337c49546 100644 --- a/drivers/net/wireless/ath/Kconfig +++ b/drivers/net/wireless/ath/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config ATH_COMMON | 1 | config ATH_COMMON |
2 | tristate "Atheros Wireless Cards" | 2 | tristate "Atheros Wireless Cards" |
3 | depends on WLAN_80211 | ||
3 | depends on ATH5K || ATH9K || AR9170_USB | 4 | depends on ATH5K || ATH9K || AR9170_USB |
4 | 5 | ||
5 | source "drivers/net/wireless/ath/ath5k/Kconfig" | 6 | source "drivers/net/wireless/ath/ath5k/Kconfig" |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index ea045151f953..029c1bc7468f 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -2970,6 +2970,9 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2970 | if (modparam_nohwcrypt) | 2970 | if (modparam_nohwcrypt) |
2971 | return -EOPNOTSUPP; | 2971 | return -EOPNOTSUPP; |
2972 | 2972 | ||
2973 | if (sc->opmode == NL80211_IFTYPE_AP) | ||
2974 | return -EOPNOTSUPP; | ||
2975 | |||
2973 | switch (key->alg) { | 2976 | switch (key->alg) { |
2974 | case ALG_WEP: | 2977 | case ALG_WEP: |
2975 | case ALG_TKIP: | 2978 | case ALG_TKIP: |
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index 1aeafb511ddd..aad259b4c197 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -478,6 +478,18 @@ void ath9k_ani_reset(struct ath_hw *ah) | |||
478 | "Reset ANI state opmode %u\n", ah->opmode); | 478 | "Reset ANI state opmode %u\n", ah->opmode); |
479 | ah->stats.ast_ani_reset++; | 479 | ah->stats.ast_ani_reset++; |
480 | 480 | ||
481 | if (ah->opmode == NL80211_IFTYPE_AP) { | ||
482 | /* | ||
483 | * ath9k_hw_ani_control() will only process items set on | ||
484 | * ah->ani_function | ||
485 | */ | ||
486 | if (IS_CHAN_2GHZ(chan)) | ||
487 | ah->ani_function = (ATH9K_ANI_SPUR_IMMUNITY_LEVEL | | ||
488 | ATH9K_ANI_FIRSTEP_LEVEL); | ||
489 | else | ||
490 | ah->ani_function = 0; | ||
491 | } | ||
492 | |||
481 | ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, 0); | 493 | ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, 0); |
482 | ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0); | 494 | ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0); |
483 | ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, 0); | 495 | ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, 0); |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c index a2fda702b620..ce0e86c36a82 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ b/drivers/net/wireless/ath/ath9k/eeprom.c | |||
@@ -460,7 +460,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) | |||
460 | integer = swab32(eep->modalHeader.antCtrlCommon); | 460 | integer = swab32(eep->modalHeader.antCtrlCommon); |
461 | eep->modalHeader.antCtrlCommon = integer; | 461 | eep->modalHeader.antCtrlCommon = integer; |
462 | 462 | ||
463 | for (i = 0; i < AR5416_MAX_CHAINS; i++) { | 463 | for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) { |
464 | integer = swab32(eep->modalHeader.antCtrlChain[i]); | 464 | integer = swab32(eep->modalHeader.antCtrlChain[i]); |
465 | eep->modalHeader.antCtrlChain[i] = integer; | 465 | eep->modalHeader.antCtrlChain[i] = integer; |
466 | } | 466 | } |
@@ -914,7 +914,7 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, | |||
914 | ctlMode, numCtlModes, isHt40CtlMode, | 914 | ctlMode, numCtlModes, isHt40CtlMode, |
915 | (pCtlMode[ctlMode] & EXT_ADDITIVE)); | 915 | (pCtlMode[ctlMode] & EXT_ADDITIVE)); |
916 | 916 | ||
917 | for (i = 0; (i < AR5416_NUM_CTLS) && | 917 | for (i = 0; (i < AR5416_EEP4K_NUM_CTLS) && |
918 | pEepData->ctlIndex[i]; i++) { | 918 | pEepData->ctlIndex[i]; i++) { |
919 | DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, | 919 | DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, |
920 | " LOOP-Ctlidx %d: cfgCtl 0x%2.2x " | 920 | " LOOP-Ctlidx %d: cfgCtl 0x%2.2x " |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index b61a071788a5..4ccf48e396df 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -355,7 +355,14 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
355 | } | 355 | } |
356 | 356 | ||
357 | if (bf_next == NULL) { | 357 | if (bf_next == NULL) { |
358 | INIT_LIST_HEAD(&bf_head); | 358 | /* |
359 | * Make sure the last desc is reclaimed if it | ||
360 | * not a holding desc. | ||
361 | */ | ||
362 | if (!bf_last->bf_stale) | ||
363 | list_move_tail(&bf->list, &bf_head); | ||
364 | else | ||
365 | INIT_LIST_HEAD(&bf_head); | ||
359 | } else { | 366 | } else { |
360 | ASSERT(!list_empty(bf_q)); | 367 | ASSERT(!list_empty(bf_q)); |
361 | list_move_tail(&bf->list, &bf_head); | 368 | list_move_tail(&bf->list, &bf_head); |
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c index eef370bd1211..bf3d25ba7be1 100644 --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c | |||
@@ -474,6 +474,21 @@ ath_regd_init_wiphy(struct ath_regulatory *reg, | |||
474 | return 0; | 474 | return 0; |
475 | } | 475 | } |
476 | 476 | ||
477 | /* | ||
478 | * Some users have reported their EEPROM programmed with | ||
479 | * 0x8000 set, this is not a supported regulatory domain | ||
480 | * but since we have more than one user with it we need | ||
481 | * a solution for them. We default to 0x64, which is the | ||
482 | * default Atheros world regulatory domain. | ||
483 | */ | ||
484 | static void ath_regd_sanitize(struct ath_regulatory *reg) | ||
485 | { | ||
486 | if (reg->current_rd != COUNTRY_ERD_FLAG) | ||
487 | return; | ||
488 | printk(KERN_DEBUG "ath: EEPROM regdomain sanitized\n"); | ||
489 | reg->current_rd = 0x64; | ||
490 | } | ||
491 | |||
477 | int | 492 | int |
478 | ath_regd_init(struct ath_regulatory *reg, | 493 | ath_regd_init(struct ath_regulatory *reg, |
479 | struct wiphy *wiphy, | 494 | struct wiphy *wiphy, |
@@ -486,6 +501,8 @@ ath_regd_init(struct ath_regulatory *reg, | |||
486 | if (!reg) | 501 | if (!reg) |
487 | return -EINVAL; | 502 | return -EINVAL; |
488 | 503 | ||
504 | ath_regd_sanitize(reg); | ||
505 | |||
489 | printk(KERN_DEBUG "ath: EEPROM regdomain: 0x%0x\n", reg->current_rd); | 506 | printk(KERN_DEBUG "ath: EEPROM regdomain: 0x%0x\n", reg->current_rd); |
490 | 507 | ||
491 | if (!ath_regd_is_eeprom_valid(reg)) { | 508 | if (!ath_regd_is_eeprom_valid(reg)) { |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index f580c2812d91..40448067e4cc 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -648,6 +648,7 @@ struct b43_wl { | |||
648 | u8 nr_devs; | 648 | u8 nr_devs; |
649 | 649 | ||
650 | bool radiotap_enabled; | 650 | bool radiotap_enabled; |
651 | bool radio_enabled; | ||
651 | 652 | ||
652 | /* The beacon we are currently using (AP or IBSS mode). | 653 | /* The beacon we are currently using (AP or IBSS mode). |
653 | * This beacon stuff is protected by the irq_lock. */ | 654 | * This beacon stuff is protected by the irq_lock. */ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 6456afebdba1..e71c8d9cd706 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3497,8 +3497,8 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed) | |||
3497 | if (phy->ops->set_rx_antenna) | 3497 | if (phy->ops->set_rx_antenna) |
3498 | phy->ops->set_rx_antenna(dev, antenna); | 3498 | phy->ops->set_rx_antenna(dev, antenna); |
3499 | 3499 | ||
3500 | if (!!conf->radio_enabled != phy->radio_on) { | 3500 | if (wl->radio_enabled != phy->radio_on) { |
3501 | if (conf->radio_enabled) { | 3501 | if (wl->radio_enabled) { |
3502 | b43_software_rfkill(dev, false); | 3502 | b43_software_rfkill(dev, false); |
3503 | b43info(dev->wl, "Radio turned on by software\n"); | 3503 | b43info(dev->wl, "Radio turned on by software\n"); |
3504 | if (!dev->radio_hw_enable) { | 3504 | if (!dev->radio_hw_enable) { |
@@ -4339,6 +4339,7 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
4339 | wl->beacon0_uploaded = 0; | 4339 | wl->beacon0_uploaded = 0; |
4340 | wl->beacon1_uploaded = 0; | 4340 | wl->beacon1_uploaded = 0; |
4341 | wl->beacon_templates_virgin = 1; | 4341 | wl->beacon_templates_virgin = 1; |
4342 | wl->radio_enabled = 1; | ||
4342 | 4343 | ||
4343 | mutex_lock(&wl->mutex); | 4344 | mutex_lock(&wl->mutex); |
4344 | 4345 | ||
@@ -4378,6 +4379,7 @@ static void b43_op_stop(struct ieee80211_hw *hw) | |||
4378 | if (b43_status(dev) >= B43_STAT_STARTED) | 4379 | if (b43_status(dev) >= B43_STAT_STARTED) |
4379 | b43_wireless_core_stop(dev); | 4380 | b43_wireless_core_stop(dev); |
4380 | b43_wireless_core_exit(dev); | 4381 | b43_wireless_core_exit(dev); |
4382 | wl->radio_enabled = 0; | ||
4381 | mutex_unlock(&wl->mutex); | 4383 | mutex_unlock(&wl->mutex); |
4382 | 4384 | ||
4383 | cancel_work_sync(&(wl->txpower_adjust_work)); | 4385 | cancel_work_sync(&(wl->txpower_adjust_work)); |
@@ -4560,6 +4562,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4560 | B43_WARN_ON(1); | 4562 | B43_WARN_ON(1); |
4561 | 4563 | ||
4562 | dev->phy.gmode = have_2ghz_phy; | 4564 | dev->phy.gmode = have_2ghz_phy; |
4565 | dev->phy.radio_on = 1; | ||
4563 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; | 4566 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; |
4564 | b43_wireless_core_reset(dev, tmp); | 4567 | b43_wireless_core_reset(dev, tmp); |
4565 | 4568 | ||
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 3cfc30307a27..6c3a74964ab8 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { | 36 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { |
37 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), | 37 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), |
38 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x476), | ||
38 | PCMCIA_DEVICE_NULL, | 39 | PCMCIA_DEVICE_NULL, |
39 | }; | 40 | }; |
40 | 41 | ||
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h index 77fda148ac46..038baa8869e2 100644 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ b/drivers/net/wireless/b43legacy/b43legacy.h | |||
@@ -607,6 +607,7 @@ struct b43legacy_wl { | |||
607 | u8 nr_devs; | 607 | u8 nr_devs; |
608 | 608 | ||
609 | bool radiotap_enabled; | 609 | bool radiotap_enabled; |
610 | bool radio_enabled; | ||
610 | 611 | ||
611 | /* The beacon we are currently using (AP or IBSS mode). | 612 | /* The beacon we are currently using (AP or IBSS mode). |
612 | * This beacon stuff is protected by the irq_lock. */ | 613 | * This beacon stuff is protected by the irq_lock. */ |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index e5136fb65ddd..c4973c1942bf 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -2689,8 +2689,8 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw, | |||
2689 | /* Antennas for RX and management frame TX. */ | 2689 | /* Antennas for RX and management frame TX. */ |
2690 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); | 2690 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); |
2691 | 2691 | ||
2692 | if (!!conf->radio_enabled != phy->radio_on) { | 2692 | if (wl->radio_enabled != phy->radio_on) { |
2693 | if (conf->radio_enabled) { | 2693 | if (wl->radio_enabled) { |
2694 | b43legacy_radio_turn_on(dev); | 2694 | b43legacy_radio_turn_on(dev); |
2695 | b43legacyinfo(dev->wl, "Radio turned on by software\n"); | 2695 | b43legacyinfo(dev->wl, "Radio turned on by software\n"); |
2696 | if (!dev->radio_hw_enable) | 2696 | if (!dev->radio_hw_enable) |
@@ -3441,6 +3441,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw) | |||
3441 | wl->beacon0_uploaded = 0; | 3441 | wl->beacon0_uploaded = 0; |
3442 | wl->beacon1_uploaded = 0; | 3442 | wl->beacon1_uploaded = 0; |
3443 | wl->beacon_templates_virgin = 1; | 3443 | wl->beacon_templates_virgin = 1; |
3444 | wl->radio_enabled = 1; | ||
3444 | 3445 | ||
3445 | mutex_lock(&wl->mutex); | 3446 | mutex_lock(&wl->mutex); |
3446 | 3447 | ||
@@ -3479,6 +3480,7 @@ static void b43legacy_op_stop(struct ieee80211_hw *hw) | |||
3479 | if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) | 3480 | if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) |
3480 | b43legacy_wireless_core_stop(dev); | 3481 | b43legacy_wireless_core_stop(dev); |
3481 | b43legacy_wireless_core_exit(dev); | 3482 | b43legacy_wireless_core_exit(dev); |
3483 | wl->radio_enabled = 0; | ||
3482 | mutex_unlock(&wl->mutex); | 3484 | mutex_unlock(&wl->mutex); |
3483 | } | 3485 | } |
3484 | 3486 | ||
@@ -3620,6 +3622,7 @@ static int b43legacy_wireless_core_attach(struct b43legacy_wldev *dev) | |||
3620 | have_bphy = 1; | 3622 | have_bphy = 1; |
3621 | 3623 | ||
3622 | dev->phy.gmode = (have_gphy || have_bphy); | 3624 | dev->phy.gmode = (have_gphy || have_bphy); |
3625 | dev->phy.radio_on = 1; | ||
3623 | tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; | 3626 | tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; |
3624 | b43legacy_wireless_core_reset(dev, tmp); | 3627 | b43legacy_wireless_core_reset(dev, tmp); |
3625 | 3628 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index fbb3a573463e..2de6471d4be9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -112,7 +112,7 @@ enum iwl3945_antenna { | |||
112 | #define IWL_TX_FIFO_NONE 7 | 112 | #define IWL_TX_FIFO_NONE 7 |
113 | 113 | ||
114 | /* Minimum number of queues. MAX_NUM is defined in hw specific files */ | 114 | /* Minimum number of queues. MAX_NUM is defined in hw specific files */ |
115 | #define IWL_MIN_NUM_QUEUES 4 | 115 | #define IWL39_MIN_NUM_QUEUES 4 |
116 | 116 | ||
117 | #define IEEE80211_DATA_LEN 2304 | 117 | #define IEEE80211_DATA_LEN 2304 |
118 | #define IEEE80211_4ADDR_LEN 30 | 118 | #define IEEE80211_4ADDR_LEN 30 |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 6d1519e1f011..355f50ea7fef 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -2675,12 +2675,10 @@ static ssize_t show_power_level(struct device *d, | |||
2675 | struct device_attribute *attr, char *buf) | 2675 | struct device_attribute *attr, char *buf) |
2676 | { | 2676 | { |
2677 | struct iwl_priv *priv = dev_get_drvdata(d); | 2677 | struct iwl_priv *priv = dev_get_drvdata(d); |
2678 | int mode = priv->power_data.user_power_setting; | ||
2679 | int level = priv->power_data.power_mode; | 2678 | int level = priv->power_data.power_mode; |
2680 | char *p = buf; | 2679 | char *p = buf; |
2681 | 2680 | ||
2682 | p += sprintf(p, "INDEX:%d\t", level); | 2681 | p += sprintf(p, "%d\n", level); |
2683 | p += sprintf(p, "USER:%d\n", mode); | ||
2684 | return p - buf + 1; | 2682 | return p - buf + 1; |
2685 | } | 2683 | } |
2686 | 2684 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 6ab07165ea28..18b135f510e5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -1332,6 +1332,9 @@ int iwl_setup_mac(struct iwl_priv *priv) | |||
1332 | 1332 | ||
1333 | hw->wiphy->custom_regulatory = true; | 1333 | hw->wiphy->custom_regulatory = true; |
1334 | 1334 | ||
1335 | /* Firmware does not support this */ | ||
1336 | hw->wiphy->disable_beacon_hints = true; | ||
1337 | |||
1335 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; | 1338 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; |
1336 | /* we create the 802.11 header and a zero-length SSID element */ | 1339 | /* we create the 802.11 header and a zero-length SSID element */ |
1337 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; | 1340 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 11e08c068917..ca00cc8ad4c7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -308,18 +308,18 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, | |||
308 | return -ENODATA; | 308 | return -ENODATA; |
309 | } | 309 | } |
310 | 310 | ||
311 | ptr = priv->eeprom; | ||
312 | if (!ptr) { | ||
313 | IWL_ERR(priv, "Invalid EEPROM/OTP memory\n"); | ||
314 | return -ENOMEM; | ||
315 | } | ||
316 | |||
311 | /* 4 characters for byte 0xYY */ | 317 | /* 4 characters for byte 0xYY */ |
312 | buf = kzalloc(buf_size, GFP_KERNEL); | 318 | buf = kzalloc(buf_size, GFP_KERNEL); |
313 | if (!buf) { | 319 | if (!buf) { |
314 | IWL_ERR(priv, "Can not allocate Buffer\n"); | 320 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
315 | return -ENOMEM; | 321 | return -ENOMEM; |
316 | } | 322 | } |
317 | |||
318 | ptr = priv->eeprom; | ||
319 | if (!ptr) { | ||
320 | IWL_ERR(priv, "Invalid EEPROM/OTP memory\n"); | ||
321 | return -ENOMEM; | ||
322 | } | ||
323 | pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s\n", | 323 | pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s\n", |
324 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) | 324 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) |
325 | ? "OTP" : "EEPROM"); | 325 | ? "OTP" : "EEPROM"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index e2d620f0b6e8..650e20af20fa 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -258,8 +258,10 @@ struct iwl_channel_info { | |||
258 | #define IWL_TX_FIFO_HCCA_2 6 | 258 | #define IWL_TX_FIFO_HCCA_2 6 |
259 | #define IWL_TX_FIFO_NONE 7 | 259 | #define IWL_TX_FIFO_NONE 7 |
260 | 260 | ||
261 | /* Minimum number of queues. MAX_NUM is defined in hw specific files */ | 261 | /* Minimum number of queues. MAX_NUM is defined in hw specific files. |
262 | #define IWL_MIN_NUM_QUEUES 4 | 262 | * Set the minimum to accommodate the 4 standard TX queues, 1 command |
263 | * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */ | ||
264 | #define IWL_MIN_NUM_QUEUES 10 | ||
263 | 265 | ||
264 | /* Power management (not Tx power) structures */ | 266 | /* Power management (not Tx power) structures */ |
265 | 267 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index 2addf735b193..ffd5c61a7553 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -566,6 +566,8 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, | |||
566 | unsigned long flags; | 566 | unsigned long flags; |
567 | 567 | ||
568 | spin_lock_irqsave(&priv->sta_lock, flags); | 568 | spin_lock_irqsave(&priv->sta_lock, flags); |
569 | IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", | ||
570 | keyconf->keyidx); | ||
569 | 571 | ||
570 | if (!test_and_clear_bit(keyconf->keyidx, &priv->ucode_key_table)) | 572 | if (!test_and_clear_bit(keyconf->keyidx, &priv->ucode_key_table)) |
571 | IWL_ERR(priv, "index %d not used in uCode key table.\n", | 573 | IWL_ERR(priv, "index %d not used in uCode key table.\n", |
@@ -573,6 +575,11 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, | |||
573 | 575 | ||
574 | priv->default_wep_key--; | 576 | priv->default_wep_key--; |
575 | memset(&priv->wep_keys[keyconf->keyidx], 0, sizeof(priv->wep_keys[0])); | 577 | memset(&priv->wep_keys[keyconf->keyidx], 0, sizeof(priv->wep_keys[0])); |
578 | if (iwl_is_rfkill(priv)) { | ||
579 | IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); | ||
580 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
581 | return 0; | ||
582 | } | ||
576 | ret = iwl_send_static_wepkey_cmd(priv, 1); | 583 | ret = iwl_send_static_wepkey_cmd(priv, 1); |
577 | IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", | 584 | IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", |
578 | keyconf->keyidx, ret); | 585 | keyconf->keyidx, ret); |
@@ -853,6 +860,11 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, | |||
853 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 860 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
854 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 861 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
855 | 862 | ||
863 | if (iwl_is_rfkill(priv)) { | ||
864 | IWL_DEBUG_WEP(priv, "Not sending REPLY_ADD_STA command because RFKILL enabled. \n"); | ||
865 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
866 | return 0; | ||
867 | } | ||
856 | ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); | 868 | ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); |
857 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 869 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
858 | return ret; | 870 | return ret; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 85ae7a62109c..2e89040e63be 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -720,8 +720,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
720 | goto drop_unlock; | 720 | goto drop_unlock; |
721 | } | 721 | } |
722 | 722 | ||
723 | spin_unlock_irqrestore(&priv->lock, flags); | ||
724 | |||
725 | hdr_len = ieee80211_hdrlen(fc); | 723 | hdr_len = ieee80211_hdrlen(fc); |
726 | 724 | ||
727 | /* Find (or create) index into station table for destination station */ | 725 | /* Find (or create) index into station table for destination station */ |
@@ -729,7 +727,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
729 | if (sta_id == IWL_INVALID_STATION) { | 727 | if (sta_id == IWL_INVALID_STATION) { |
730 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 728 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
731 | hdr->addr1); | 729 | hdr->addr1); |
732 | goto drop; | 730 | goto drop_unlock; |
733 | } | 731 | } |
734 | 732 | ||
735 | IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); | 733 | IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); |
@@ -750,14 +748,17 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
750 | txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; | 748 | txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; |
751 | swq_id = iwl_virtual_agg_queue_num(swq_id, txq_id); | 749 | swq_id = iwl_virtual_agg_queue_num(swq_id, txq_id); |
752 | } | 750 | } |
753 | priv->stations[sta_id].tid[tid].tfds_in_queue++; | ||
754 | } | 751 | } |
755 | 752 | ||
756 | txq = &priv->txq[txq_id]; | 753 | txq = &priv->txq[txq_id]; |
757 | q = &txq->q; | 754 | q = &txq->q; |
758 | txq->swq_id = swq_id; | 755 | txq->swq_id = swq_id; |
759 | 756 | ||
760 | spin_lock_irqsave(&priv->lock, flags); | 757 | if (unlikely(iwl_queue_space(q) < q->high_mark)) |
758 | goto drop_unlock; | ||
759 | |||
760 | if (ieee80211_is_data_qos(fc)) | ||
761 | priv->stations[sta_id].tid[tid].tfds_in_queue++; | ||
761 | 762 | ||
762 | /* Set up driver data for this TFD */ | 763 | /* Set up driver data for this TFD */ |
763 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); | 764 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); |
@@ -872,7 +873,8 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
872 | iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); | 873 | iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); |
873 | 874 | ||
874 | /* Set up entry for this TFD in Tx byte-count array */ | 875 | /* Set up entry for this TFD in Tx byte-count array */ |
875 | priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, | 876 | if (info->flags & IEEE80211_TX_CTL_AMPDU) |
877 | priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, | ||
876 | le16_to_cpu(tx_cmd->len)); | 878 | le16_to_cpu(tx_cmd->len)); |
877 | 879 | ||
878 | pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys, | 880 | pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys, |
@@ -901,7 +903,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
901 | 903 | ||
902 | drop_unlock: | 904 | drop_unlock: |
903 | spin_unlock_irqrestore(&priv->lock, flags); | 905 | spin_unlock_irqrestore(&priv->lock, flags); |
904 | drop: | ||
905 | return -1; | 906 | return -1; |
906 | } | 907 | } |
907 | EXPORT_SYMBOL(iwl_tx_skb); | 908 | EXPORT_SYMBOL(iwl_tx_skb); |
@@ -1170,6 +1171,8 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
1170 | IWL_ERR(priv, "Start AGG on invalid station\n"); | 1171 | IWL_ERR(priv, "Start AGG on invalid station\n"); |
1171 | return -ENXIO; | 1172 | return -ENXIO; |
1172 | } | 1173 | } |
1174 | if (unlikely(tid >= MAX_TID_COUNT)) | ||
1175 | return -EINVAL; | ||
1173 | 1176 | ||
1174 | if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { | 1177 | if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { |
1175 | IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); | 1178 | IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index cb9bd4c8f25e..523843369ca2 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -3643,12 +3643,10 @@ static ssize_t show_power_level(struct device *d, | |||
3643 | struct device_attribute *attr, char *buf) | 3643 | struct device_attribute *attr, char *buf) |
3644 | { | 3644 | { |
3645 | struct iwl_priv *priv = dev_get_drvdata(d); | 3645 | struct iwl_priv *priv = dev_get_drvdata(d); |
3646 | int mode = priv->power_data.user_power_setting; | ||
3647 | int level = priv->power_data.power_mode; | 3646 | int level = priv->power_data.power_mode; |
3648 | char *p = buf; | 3647 | char *p = buf; |
3649 | 3648 | ||
3650 | p += sprintf(p, "INDEX:%d\t", level); | 3649 | p += sprintf(p, "%d\n", level); |
3651 | p += sprintf(p, "USER:%d\n", mode); | ||
3652 | return p - buf + 1; | 3650 | return p - buf + 1; |
3653 | } | 3651 | } |
3654 | 3652 | ||
@@ -3970,6 +3968,9 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3970 | 3968 | ||
3971 | hw->wiphy->custom_regulatory = true; | 3969 | hw->wiphy->custom_regulatory = true; |
3972 | 3970 | ||
3971 | /* Firmware does not support this */ | ||
3972 | hw->wiphy->disable_beacon_hints = true; | ||
3973 | |||
3973 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945; | 3974 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945; |
3974 | /* we create the 802.11 header and a zero-length SSID element */ | 3975 | /* we create the 802.11 header and a zero-length SSID element */ |
3975 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; | 3976 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; |
@@ -4020,10 +4021,10 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4020 | SET_IEEE80211_DEV(hw, &pdev->dev); | 4021 | SET_IEEE80211_DEV(hw, &pdev->dev); |
4021 | 4022 | ||
4022 | if ((iwl3945_mod_params.num_of_queues > IWL39_MAX_NUM_QUEUES) || | 4023 | if ((iwl3945_mod_params.num_of_queues > IWL39_MAX_NUM_QUEUES) || |
4023 | (iwl3945_mod_params.num_of_queues < IWL_MIN_NUM_QUEUES)) { | 4024 | (iwl3945_mod_params.num_of_queues < IWL39_MIN_NUM_QUEUES)) { |
4024 | IWL_ERR(priv, | 4025 | IWL_ERR(priv, |
4025 | "invalid queues_num, should be between %d and %d\n", | 4026 | "invalid queues_num, should be between %d and %d\n", |
4026 | IWL_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES); | 4027 | IWL39_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES); |
4027 | err = -EINVAL; | 4028 | err = -EINVAL; |
4028 | goto out_ieee80211_free_hw; | 4029 | goto out_ieee80211_free_hw; |
4029 | } | 4030 | } |
diff --git a/drivers/net/wireless/iwmc3200wifi/Kconfig b/drivers/net/wireless/iwmc3200wifi/Kconfig index 1eccb6df46dd..030401d367d3 100644 --- a/drivers/net/wireless/iwmc3200wifi/Kconfig +++ b/drivers/net/wireless/iwmc3200wifi/Kconfig | |||
@@ -4,6 +4,15 @@ config IWM | |||
4 | depends on CFG80211 | 4 | depends on CFG80211 |
5 | select WIRELESS_EXT | 5 | select WIRELESS_EXT |
6 | select FW_LOADER | 6 | select FW_LOADER |
7 | help | ||
8 | The Intel Wireless Multicomm 3200 hardware is a combo | ||
9 | card with GPS, Bluetooth, WiMax and 802.11 radios. It | ||
10 | runs over SDIO and is typically found on Moorestown | ||
11 | based platform. This driver takes care of the 802.11 | ||
12 | part, which is a fullmac one. | ||
13 | |||
14 | If you choose to build it as a module, it'll be called | ||
15 | iwmc3200wifi.ko. | ||
7 | 16 | ||
8 | config IWM_DEBUG | 17 | config IWM_DEBUG |
9 | bool "Enable full debugging output in iwmc3200wifi" | 18 | bool "Enable full debugging output in iwmc3200wifi" |
diff --git a/drivers/net/wireless/iwmc3200wifi/commands.c b/drivers/net/wireless/iwmc3200wifi/commands.c index 834a7f544e5d..e2334d123599 100644 --- a/drivers/net/wireless/iwmc3200wifi/commands.c +++ b/drivers/net/wireless/iwmc3200wifi/commands.c | |||
@@ -220,6 +220,7 @@ int iwm_store_rxiq_calib_result(struct iwm_priv *iwm) | |||
220 | eeprom_rxiq = iwm_eeprom_access(iwm, IWM_EEPROM_CALIB_RXIQ); | 220 | eeprom_rxiq = iwm_eeprom_access(iwm, IWM_EEPROM_CALIB_RXIQ); |
221 | if (IS_ERR(eeprom_rxiq)) { | 221 | if (IS_ERR(eeprom_rxiq)) { |
222 | IWM_ERR(iwm, "Couldn't access EEPROM RX IQ entry\n"); | 222 | IWM_ERR(iwm, "Couldn't access EEPROM RX IQ entry\n"); |
223 | kfree(rxiq); | ||
223 | return PTR_ERR(eeprom_rxiq); | 224 | return PTR_ERR(eeprom_rxiq); |
224 | } | 225 | } |
225 | 226 | ||
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c index aaa20c6885c8..bf294e41753b 100644 --- a/drivers/net/wireless/iwmc3200wifi/netdev.c +++ b/drivers/net/wireless/iwmc3200wifi/netdev.c | |||
@@ -106,10 +106,8 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev, | |||
106 | int ret = 0; | 106 | int ret = 0; |
107 | 107 | ||
108 | wdev = iwm_wdev_alloc(sizeof_bus, dev); | 108 | wdev = iwm_wdev_alloc(sizeof_bus, dev); |
109 | if (!wdev) { | 109 | if (IS_ERR(wdev)) |
110 | dev_err(dev, "no memory for wireless device instance\n"); | 110 | return wdev; |
111 | return ERR_PTR(-ENOMEM); | ||
112 | } | ||
113 | 111 | ||
114 | iwm = wdev_to_iwm(wdev); | 112 | iwm = wdev_to_iwm(wdev); |
115 | iwm->bus_ops = if_ops; | 113 | iwm->bus_ops = if_ops; |
@@ -151,8 +149,8 @@ void iwm_if_free(struct iwm_priv *iwm) | |||
151 | return; | 149 | return; |
152 | 150 | ||
153 | free_netdev(iwm_to_ndev(iwm)); | 151 | free_netdev(iwm_to_ndev(iwm)); |
154 | iwm_wdev_free(iwm); | ||
155 | iwm_priv_deinit(iwm); | 152 | iwm_priv_deinit(iwm); |
153 | iwm_wdev_free(iwm); | ||
156 | } | 154 | } |
157 | 155 | ||
158 | int iwm_if_add(struct iwm_priv *iwm) | 156 | int iwm_if_add(struct iwm_priv *iwm) |
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c index 9a5408e7d94a..5c6968101f0d 100644 --- a/drivers/net/wireless/libertas/11d.c +++ b/drivers/net/wireless/libertas/11d.c | |||
@@ -47,7 +47,7 @@ static u8 lbs_region_2_code(u8 *region) | |||
47 | { | 47 | { |
48 | u8 i; | 48 | u8 i; |
49 | 49 | ||
50 | for (i = 0; region[i] && i < COUNTRY_CODE_LEN; i++) | 50 | for (i = 0; i < COUNTRY_CODE_LEN && region[i]; i++) |
51 | region[i] = toupper(region[i]); | 51 | region[i] = toupper(region[i]); |
52 | 52 | ||
53 | for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) { | 53 | for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) { |
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index b9b374119033..d6997371c27e 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* Copyright (C) 2006, Red Hat, Inc. */ | 1 | /* Copyright (C) 2006, Red Hat, Inc. */ |
2 | 2 | ||
3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
4 | #include <linux/kernel.h> | ||
4 | #include <linux/etherdevice.h> | 5 | #include <linux/etherdevice.h> |
5 | #include <linux/ieee80211.h> | 6 | #include <linux/ieee80211.h> |
6 | #include <linux/if_arp.h> | 7 | #include <linux/if_arp.h> |
@@ -43,21 +44,21 @@ static int get_common_rates(struct lbs_private *priv, | |||
43 | u16 *rates_size) | 44 | u16 *rates_size) |
44 | { | 45 | { |
45 | u8 *card_rates = lbs_bg_rates; | 46 | u8 *card_rates = lbs_bg_rates; |
46 | size_t num_card_rates = sizeof(lbs_bg_rates); | ||
47 | int ret = 0, i, j; | 47 | int ret = 0, i, j; |
48 | u8 tmp[30]; | 48 | u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)]; |
49 | size_t tmp_size = 0; | 49 | size_t tmp_size = 0; |
50 | 50 | ||
51 | /* For each rate in card_rates that exists in rate1, copy to tmp */ | 51 | /* For each rate in card_rates that exists in rate1, copy to tmp */ |
52 | for (i = 0; card_rates[i] && (i < num_card_rates); i++) { | 52 | for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) { |
53 | for (j = 0; rates[j] && (j < *rates_size); j++) { | 53 | for (j = 0; j < *rates_size && rates[j]; j++) { |
54 | if (rates[j] == card_rates[i]) | 54 | if (rates[j] == card_rates[i]) |
55 | tmp[tmp_size++] = card_rates[i]; | 55 | tmp[tmp_size++] = card_rates[i]; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); | 59 | lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); |
60 | lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); | 60 | lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, |
61 | ARRAY_SIZE(lbs_bg_rates)); | ||
61 | lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); | 62 | lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); |
62 | lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); | 63 | lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); |
63 | 64 | ||
@@ -69,10 +70,7 @@ static int get_common_rates(struct lbs_private *priv, | |||
69 | lbs_pr_alert("Previously set fixed data rate %#x isn't " | 70 | lbs_pr_alert("Previously set fixed data rate %#x isn't " |
70 | "compatible with the network.\n", priv->cur_rate); | 71 | "compatible with the network.\n", priv->cur_rate); |
71 | ret = -1; | 72 | ret = -1; |
72 | goto done; | ||
73 | } | 73 | } |
74 | ret = 0; | ||
75 | |||
76 | done: | 74 | done: |
77 | memset(rates, 0, *rates_size); | 75 | memset(rates, 0, *rates_size); |
78 | *rates_size = min_t(int, tmp_size, *rates_size); | 76 | *rates_size = min_t(int, tmp_size, *rates_size); |
@@ -322,7 +320,7 @@ static int lbs_associate(struct lbs_private *priv, | |||
322 | rates = (struct mrvl_ie_rates_param_set *) pos; | 320 | rates = (struct mrvl_ie_rates_param_set *) pos; |
323 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); | 321 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); |
324 | memcpy(&rates->rates, &bss->rates, MAX_RATES); | 322 | memcpy(&rates->rates, &bss->rates, MAX_RATES); |
325 | tmplen = MAX_RATES; | 323 | tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES); |
326 | if (get_common_rates(priv, rates->rates, &tmplen)) { | 324 | if (get_common_rates(priv, rates->rates, &tmplen)) { |
327 | ret = -1; | 325 | ret = -1; |
328 | goto done; | 326 | goto done; |
@@ -598,7 +596,7 @@ static int lbs_adhoc_join(struct lbs_private *priv, | |||
598 | 596 | ||
599 | /* Copy Data rates from the rates recorded in scan response */ | 597 | /* Copy Data rates from the rates recorded in scan response */ |
600 | memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); | 598 | memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); |
601 | ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES); | 599 | ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES); |
602 | memcpy(cmd.bss.rates, bss->rates, ratesize); | 600 | memcpy(cmd.bss.rates, bss->rates, ratesize); |
603 | if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { | 601 | if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { |
604 | lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); | 602 | lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 01db705a38ec..685098148e10 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -135,8 +135,14 @@ int lbs_update_hw_spec(struct lbs_private *priv) | |||
135 | /* Clamp region code to 8-bit since FW spec indicates that it should | 135 | /* Clamp region code to 8-bit since FW spec indicates that it should |
136 | * only ever be 8-bit, even though the field size is 16-bit. Some firmware | 136 | * only ever be 8-bit, even though the field size is 16-bit. Some firmware |
137 | * returns non-zero high 8 bits here. | 137 | * returns non-zero high 8 bits here. |
138 | * | ||
139 | * Firmware version 4.0.102 used in CF8381 has region code shifted. We | ||
140 | * need to check for this problem and handle it properly. | ||
138 | */ | 141 | */ |
139 | priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF; | 142 | if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V4) |
143 | priv->regioncode = (le16_to_cpu(cmd.regioncode) >> 8) & 0xFF; | ||
144 | else | ||
145 | priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF; | ||
140 | 146 | ||
141 | for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { | 147 | for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { |
142 | /* use the region code to search for the index */ | 148 | /* use the region code to search for the index */ |
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 48da157d6cda..72f3479a4d70 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -234,6 +234,8 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in | |||
234 | /** Mesh enable bit in FW capability */ | 234 | /** Mesh enable bit in FW capability */ |
235 | #define MESH_CAPINFO_ENABLE_MASK (1<<16) | 235 | #define MESH_CAPINFO_ENABLE_MASK (1<<16) |
236 | 236 | ||
237 | /** FW definition from Marvell v4 */ | ||
238 | #define MRVL_FW_V4 (0x04) | ||
237 | /** FW definition from Marvell v5 */ | 239 | /** FW definition from Marvell v5 */ |
238 | #define MRVL_FW_V5 (0x05) | 240 | #define MRVL_FW_V5 (0x05) |
239 | /** FW definition from Marvell v10 */ | 241 | /** FW definition from Marvell v10 */ |
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 601b54249677..6c95af3023cc 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * for sending scan commands to the firmware. | 5 | * for sending scan commands to the firmware. |
6 | */ | 6 | */ |
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | #include <linux/kernel.h> | ||
8 | #include <linux/etherdevice.h> | 9 | #include <linux/etherdevice.h> |
9 | #include <linux/if_arp.h> | 10 | #include <linux/if_arp.h> |
10 | #include <asm/unaligned.h> | 11 | #include <asm/unaligned.h> |
@@ -876,7 +877,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv, | |||
876 | iwe.u.bitrate.disabled = 0; | 877 | iwe.u.bitrate.disabled = 0; |
877 | iwe.u.bitrate.value = 0; | 878 | iwe.u.bitrate.value = 0; |
878 | 879 | ||
879 | for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) { | 880 | for (j = 0; j < ARRAY_SIZE(bss->rates) && bss->rates[j]; j++) { |
880 | /* Bit rate given in 500 kb/s units */ | 881 | /* Bit rate given in 500 kb/s units */ |
881 | iwe.u.bitrate.value = bss->rates[j] * 500000; | 882 | iwe.u.bitrate.value = bss->rates[j] * 500000; |
882 | current_val = iwe_stream_add_value(info, start, current_val, | 883 | current_val = iwe_stream_add_value(info, start, current_val, |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index e789c6e9938c..7916ca3f84c8 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -418,6 +418,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | |||
418 | continue; | 418 | continue; |
419 | 419 | ||
420 | if (!data2->started || !hwsim_ps_rx_ok(data2, skb) || | 420 | if (!data2->started || !hwsim_ps_rx_ok(data2, skb) || |
421 | !data->channel || !data2->channel || | ||
421 | data->channel->center_freq != data2->channel->center_freq || | 422 | data->channel->center_freq != data2->channel->center_freq || |
422 | !(data->group & data2->group)) | 423 | !(data->group & data2->group)) |
423 | continue; | 424 | continue; |
@@ -708,7 +709,7 @@ static const struct ieee80211_ops mac80211_hwsim_ops = | |||
708 | static void mac80211_hwsim_free(void) | 709 | static void mac80211_hwsim_free(void) |
709 | { | 710 | { |
710 | struct list_head tmplist, *i, *tmp; | 711 | struct list_head tmplist, *i, *tmp; |
711 | struct mac80211_hwsim_data *data; | 712 | struct mac80211_hwsim_data *data, *tmpdata; |
712 | 713 | ||
713 | INIT_LIST_HEAD(&tmplist); | 714 | INIT_LIST_HEAD(&tmplist); |
714 | 715 | ||
@@ -717,7 +718,7 @@ static void mac80211_hwsim_free(void) | |||
717 | list_move(i, &tmplist); | 718 | list_move(i, &tmplist); |
718 | spin_unlock_bh(&hwsim_radio_lock); | 719 | spin_unlock_bh(&hwsim_radio_lock); |
719 | 720 | ||
720 | list_for_each_entry(data, &tmplist, list) { | 721 | list_for_each_entry_safe(data, tmpdata, &tmplist, list) { |
721 | debugfs_remove(data->debugfs_group); | 722 | debugfs_remove(data->debugfs_group); |
722 | debugfs_remove(data->debugfs_ps); | 723 | debugfs_remove(data->debugfs_ps); |
723 | debugfs_remove(data->debugfs); | 724 | debugfs_remove(data->debugfs); |
@@ -1166,8 +1167,8 @@ static void __exit exit_mac80211_hwsim(void) | |||
1166 | { | 1167 | { |
1167 | printk(KERN_DEBUG "mac80211_hwsim: unregister radios\n"); | 1168 | printk(KERN_DEBUG "mac80211_hwsim: unregister radios\n"); |
1168 | 1169 | ||
1169 | unregister_netdev(hwsim_mon); | ||
1170 | mac80211_hwsim_free(); | 1170 | mac80211_hwsim_free(); |
1171 | unregister_netdev(hwsim_mon); | ||
1171 | } | 1172 | } |
1172 | 1173 | ||
1173 | 1174 | ||
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index 345593c4accb..a370e510f19f 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -2521,6 +2521,8 @@ static const struct net_device_ops orinoco_netdev_ops = { | |||
2521 | .ndo_start_xmit = orinoco_xmit, | 2521 | .ndo_start_xmit = orinoco_xmit, |
2522 | .ndo_set_multicast_list = orinoco_set_multicast_list, | 2522 | .ndo_set_multicast_list = orinoco_set_multicast_list, |
2523 | .ndo_change_mtu = orinoco_change_mtu, | 2523 | .ndo_change_mtu = orinoco_change_mtu, |
2524 | .ndo_set_mac_address = eth_mac_addr, | ||
2525 | .ndo_validate_addr = eth_validate_addr, | ||
2524 | .ndo_tx_timeout = orinoco_tx_timeout, | 2526 | .ndo_tx_timeout = orinoco_tx_timeout, |
2525 | .ndo_get_stats = orinoco_get_stats, | 2527 | .ndo_get_stats = orinoco_get_stats, |
2526 | }; | 2528 | }; |
@@ -2555,7 +2557,6 @@ struct net_device | |||
2555 | priv->wireless_data.spy_data = &priv->spy_data; | 2557 | priv->wireless_data.spy_data = &priv->spy_data; |
2556 | dev->wireless_data = &priv->wireless_data; | 2558 | dev->wireless_data = &priv->wireless_data; |
2557 | #endif | 2559 | #endif |
2558 | /* we use the default eth_mac_addr for setting the MAC addr */ | ||
2559 | 2560 | ||
2560 | /* Reserve space in skb for the SNAP header */ | 2561 | /* Reserve space in skb for the SNAP header */ |
2561 | dev->hard_header_len += ENCAPS_OVERHEAD; | 2562 | dev->hard_header_len += ENCAPS_OVERHEAD; |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index b618bd14583f..22ca122bd798 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -823,30 +823,30 @@ void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
823 | struct p54_tx_info *range; | 823 | struct p54_tx_info *range; |
824 | unsigned long flags; | 824 | unsigned long flags; |
825 | 825 | ||
826 | if (unlikely(!skb || !dev || skb_queue_empty(&priv->tx_queue))) | 826 | if (unlikely(!skb || !dev || !skb_queue_len(&priv->tx_queue))) |
827 | return; | 827 | return; |
828 | 828 | ||
829 | /* There used to be a check here to see if the SKB was on the | 829 | /* |
830 | * TX queue or not. This can never happen because all SKBs we | 830 | * don't try to free an already unlinked skb |
831 | * see here successfully went through p54_assign_address() | ||
832 | * which means the SKB is on the ->tx_queue. | ||
833 | */ | 831 | */ |
832 | if (unlikely((!skb->next) || (!skb->prev))) | ||
833 | return; | ||
834 | 834 | ||
835 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 835 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
836 | info = IEEE80211_SKB_CB(skb); | 836 | info = IEEE80211_SKB_CB(skb); |
837 | range = (void *)info->rate_driver_data; | 837 | range = (void *)info->rate_driver_data; |
838 | if (!skb_queue_is_first(&priv->tx_queue, skb)) { | 838 | if (skb->prev != (struct sk_buff *)&priv->tx_queue) { |
839 | struct ieee80211_tx_info *ni; | 839 | struct ieee80211_tx_info *ni; |
840 | struct p54_tx_info *mr; | 840 | struct p54_tx_info *mr; |
841 | 841 | ||
842 | ni = IEEE80211_SKB_CB(skb_queue_prev(&priv->tx_queue, skb)); | 842 | ni = IEEE80211_SKB_CB(skb->prev); |
843 | mr = (struct p54_tx_info *)ni->rate_driver_data; | 843 | mr = (struct p54_tx_info *)ni->rate_driver_data; |
844 | } | 844 | } |
845 | if (!skb_queue_is_last(&priv->tx_queue, skb)) { | 845 | if (skb->next != (struct sk_buff *)&priv->tx_queue) { |
846 | struct ieee80211_tx_info *ni; | 846 | struct ieee80211_tx_info *ni; |
847 | struct p54_tx_info *mr; | 847 | struct p54_tx_info *mr; |
848 | 848 | ||
849 | ni = IEEE80211_SKB_CB(skb_queue_next(&priv->tx_queue, skb)); | 849 | ni = IEEE80211_SKB_CB(skb->next); |
850 | mr = (struct p54_tx_info *)ni->rate_driver_data; | 850 | mr = (struct p54_tx_info *)ni->rate_driver_data; |
851 | } | 851 | } |
852 | __skb_unlink(skb, &priv->tx_queue); | 852 | __skb_unlink(skb, &priv->tx_queue); |
@@ -864,13 +864,15 @@ static struct sk_buff *p54_find_tx_entry(struct ieee80211_hw *dev, | |||
864 | unsigned long flags; | 864 | unsigned long flags; |
865 | 865 | ||
866 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 866 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
867 | skb_queue_walk(&priv->tx_queue, entry) { | 867 | entry = priv->tx_queue.next; |
868 | while (entry != (struct sk_buff *)&priv->tx_queue) { | ||
868 | struct p54_hdr *hdr = (struct p54_hdr *) entry->data; | 869 | struct p54_hdr *hdr = (struct p54_hdr *) entry->data; |
869 | 870 | ||
870 | if (hdr->req_id == req_id) { | 871 | if (hdr->req_id == req_id) { |
871 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 872 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
872 | return entry; | 873 | return entry; |
873 | } | 874 | } |
875 | entry = entry->next; | ||
874 | } | 876 | } |
875 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 877 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
876 | return NULL; | 878 | return NULL; |
@@ -888,33 +890,36 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
888 | int count, idx; | 890 | int count, idx; |
889 | 891 | ||
890 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 892 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
891 | skb_queue_walk(&priv->tx_queue, entry) { | 893 | entry = (struct sk_buff *) priv->tx_queue.next; |
894 | while (entry != (struct sk_buff *)&priv->tx_queue) { | ||
892 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); | 895 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); |
893 | struct p54_hdr *entry_hdr; | 896 | struct p54_hdr *entry_hdr; |
894 | struct p54_tx_data *entry_data; | 897 | struct p54_tx_data *entry_data; |
895 | unsigned int pad = 0, frame_len; | 898 | unsigned int pad = 0, frame_len; |
896 | 899 | ||
897 | range = (void *)info->rate_driver_data; | 900 | range = (void *)info->rate_driver_data; |
898 | if (range->start_addr != addr) | 901 | if (range->start_addr != addr) { |
902 | entry = entry->next; | ||
899 | continue; | 903 | continue; |
904 | } | ||
900 | 905 | ||
901 | if (!skb_queue_is_last(&priv->tx_queue, entry)) { | 906 | if (entry->next != (struct sk_buff *)&priv->tx_queue) { |
902 | struct ieee80211_tx_info *ni; | 907 | struct ieee80211_tx_info *ni; |
903 | struct p54_tx_info *mr; | 908 | struct p54_tx_info *mr; |
904 | 909 | ||
905 | ni = IEEE80211_SKB_CB(skb_queue_next(&priv->tx_queue, | 910 | ni = IEEE80211_SKB_CB(entry->next); |
906 | entry)); | ||
907 | mr = (struct p54_tx_info *)ni->rate_driver_data; | 911 | mr = (struct p54_tx_info *)ni->rate_driver_data; |
908 | } | 912 | } |
909 | 913 | ||
910 | __skb_unlink(entry, &priv->tx_queue); | 914 | __skb_unlink(entry, &priv->tx_queue); |
911 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | ||
912 | 915 | ||
913 | frame_len = entry->len; | 916 | frame_len = entry->len; |
914 | entry_hdr = (struct p54_hdr *) entry->data; | 917 | entry_hdr = (struct p54_hdr *) entry->data; |
915 | entry_data = (struct p54_tx_data *) entry_hdr->data; | 918 | entry_data = (struct p54_tx_data *) entry_hdr->data; |
916 | priv->tx_stats[entry_data->hw_queue].len--; | 919 | if (priv->tx_stats[entry_data->hw_queue].len) |
920 | priv->tx_stats[entry_data->hw_queue].len--; | ||
917 | priv->stats.dot11ACKFailureCount += payload->tries - 1; | 921 | priv->stats.dot11ACKFailureCount += payload->tries - 1; |
922 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | ||
918 | 923 | ||
919 | /* | 924 | /* |
920 | * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are | 925 | * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are |
@@ -1164,21 +1169,23 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
1164 | } | 1169 | } |
1165 | } | 1170 | } |
1166 | 1171 | ||
1167 | skb_queue_walk(&priv->tx_queue, entry) { | 1172 | entry = priv->tx_queue.next; |
1173 | while (left--) { | ||
1168 | u32 hole_size; | 1174 | u32 hole_size; |
1169 | info = IEEE80211_SKB_CB(entry); | 1175 | info = IEEE80211_SKB_CB(entry); |
1170 | range = (void *)info->rate_driver_data; | 1176 | range = (void *)info->rate_driver_data; |
1171 | hole_size = range->start_addr - last_addr; | 1177 | hole_size = range->start_addr - last_addr; |
1172 | if (!target_skb && hole_size >= len) { | 1178 | if (!target_skb && hole_size >= len) { |
1173 | target_skb = skb_queue_prev(&priv->tx_queue, entry); | 1179 | target_skb = entry->prev; |
1174 | hole_size -= len; | 1180 | hole_size -= len; |
1175 | target_addr = last_addr; | 1181 | target_addr = last_addr; |
1176 | } | 1182 | } |
1177 | largest_hole = max(largest_hole, hole_size); | 1183 | largest_hole = max(largest_hole, hole_size); |
1178 | last_addr = range->end_addr; | 1184 | last_addr = range->end_addr; |
1185 | entry = entry->next; | ||
1179 | } | 1186 | } |
1180 | if (!target_skb && priv->rx_end - last_addr >= len) { | 1187 | if (!target_skb && priv->rx_end - last_addr >= len) { |
1181 | target_skb = skb_peek_tail(&priv->tx_queue); | 1188 | target_skb = priv->tx_queue.prev; |
1182 | largest_hole = max(largest_hole, priv->rx_end - last_addr - len); | 1189 | largest_hole = max(largest_hole, priv->rx_end - last_addr - len); |
1183 | if (!skb_queue_empty(&priv->tx_queue)) { | 1190 | if (!skb_queue_empty(&priv->tx_queue)) { |
1184 | info = IEEE80211_SKB_CB(target_skb); | 1191 | info = IEEE80211_SKB_CB(target_skb); |
@@ -2084,6 +2091,7 @@ out: | |||
2084 | static void p54_stop(struct ieee80211_hw *dev) | 2091 | static void p54_stop(struct ieee80211_hw *dev) |
2085 | { | 2092 | { |
2086 | struct p54_common *priv = dev->priv; | 2093 | struct p54_common *priv = dev->priv; |
2094 | struct sk_buff *skb; | ||
2087 | 2095 | ||
2088 | mutex_lock(&priv->conf_mutex); | 2096 | mutex_lock(&priv->conf_mutex); |
2089 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; | 2097 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; |
@@ -2098,7 +2106,8 @@ static void p54_stop(struct ieee80211_hw *dev) | |||
2098 | p54_tx_cancel(dev, priv->cached_beacon); | 2106 | p54_tx_cancel(dev, priv->cached_beacon); |
2099 | 2107 | ||
2100 | priv->stop(dev); | 2108 | priv->stop(dev); |
2101 | skb_queue_purge(&priv->tx_queue); | 2109 | while ((skb = skb_dequeue(&priv->tx_queue))) |
2110 | kfree_skb(skb); | ||
2102 | priv->cached_beacon = NULL; | 2111 | priv->cached_beacon = NULL; |
2103 | priv->tsf_high32 = priv->tsf_low32 = 0; | 2112 | priv->tsf_high32 = priv->tsf_low32 = 0; |
2104 | mutex_unlock(&priv->conf_mutex); | 2113 | mutex_unlock(&priv->conf_mutex); |
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c index 83116baeb110..72c7dbd39d0a 100644 --- a/drivers/net/wireless/p54/p54spi.c +++ b/drivers/net/wireless/p54/p54spi.c | |||
@@ -635,7 +635,7 @@ static int __devinit p54spi_probe(struct spi_device *spi) | |||
635 | 635 | ||
636 | hw = p54_init_common(sizeof(*priv)); | 636 | hw = p54_init_common(sizeof(*priv)); |
637 | if (!hw) { | 637 | if (!hw) { |
638 | dev_err(&priv->spi->dev, "could not alloc ieee80211_hw"); | 638 | dev_err(&spi->dev, "could not alloc ieee80211_hw"); |
639 | return -ENOMEM; | 639 | return -ENOMEM; |
640 | } | 640 | } |
641 | 641 | ||
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index b10b0383dfa5..698b11b1cadb 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -2427,11 +2427,10 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
2427 | 2427 | ||
2428 | #ifdef PCMCIA_DEBUG | 2428 | #ifdef PCMCIA_DEBUG |
2429 | if (pc_debug > 3) { | 2429 | if (pc_debug > 3) { |
2430 | int i; | 2430 | print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", |
2431 | printk(KERN_DEBUG "skb->data before untranslate"); | 2431 | DUMP_PREFIX_NONE, 16, 1, |
2432 | for (i = 0; i < 64; i++) | 2432 | skb->data, 64, true); |
2433 | printk("%02x ", skb->data[i]); | 2433 | printk(KERN_DEBUG |
2434 | printk("\n" KERN_DEBUG | ||
2435 | "type = %08x, xsap = %02x%02x%02x, org = %02x02x02x\n", | 2434 | "type = %08x, xsap = %02x%02x%02x, org = %02x02x02x\n", |
2436 | ntohs(type), psnap->dsap, psnap->ssap, psnap->ctrl, | 2435 | ntohs(type), psnap->dsap, psnap->ssap, psnap->ctrl, |
2437 | psnap->org[0], psnap->org[1], psnap->org[2]); | 2436 | psnap->org[0], psnap->org[1], psnap->org[2]); |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 66daf68ff0ee..ce75426764a1 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1550,7 +1550,9 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1550 | rt2500usb_register_read(rt2x00dev, MAC_CSR0, ®); | 1550 | rt2500usb_register_read(rt2x00dev, MAC_CSR0, ®); |
1551 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); | 1551 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); |
1552 | 1552 | ||
1553 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0)) { | 1553 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0) || |
1554 | rt2x00_check_rev(&rt2x00dev->chip, 0x0000000f, 0)) { | ||
1555 | |||
1554 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1556 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1555 | return -ENODEV; | 1557 | return -ENODEV; |
1556 | } | 1558 | } |
diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.c b/drivers/net/wireless/rtl818x/rtl8187_leds.c index b44253592243..cf9f899fe0e6 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_leds.c +++ b/drivers/net/wireless/rtl818x/rtl8187_leds.c | |||
@@ -208,11 +208,12 @@ void rtl8187_leds_exit(struct ieee80211_hw *dev) | |||
208 | { | 208 | { |
209 | struct rtl8187_priv *priv = dev->priv; | 209 | struct rtl8187_priv *priv = dev->priv; |
210 | 210 | ||
211 | rtl8187_unregister_led(&priv->led_tx); | ||
212 | /* turn the LED off before exiting */ | 211 | /* turn the LED off before exiting */ |
213 | queue_delayed_work(dev->workqueue, &priv->led_off, 0); | 212 | queue_delayed_work(dev->workqueue, &priv->led_off, 0); |
214 | cancel_delayed_work_sync(&priv->led_off); | 213 | cancel_delayed_work_sync(&priv->led_off); |
214 | cancel_delayed_work_sync(&priv->led_on); | ||
215 | rtl8187_unregister_led(&priv->led_rx); | 215 | rtl8187_unregister_led(&priv->led_rx); |
216 | rtl8187_unregister_led(&priv->led_tx); | ||
216 | } | 217 | } |
217 | #endif /* def CONFIG_RTL8187_LED */ | 218 | #endif /* def CONFIG_RTL8187_LED */ |
218 | 219 | ||
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 6af706408ac0..c6d300666ad8 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -3556,17 +3556,8 @@ wv_82593_config(struct net_device * dev) | |||
3556 | cfblk.rcvstop = TRUE; /* Enable Receive Stop Register */ | 3556 | cfblk.rcvstop = TRUE; /* Enable Receive Stop Register */ |
3557 | 3557 | ||
3558 | #ifdef DEBUG_I82593_SHOW | 3558 | #ifdef DEBUG_I82593_SHOW |
3559 | { | 3559 | print_hex_dump(KERN_DEBUG, "wavelan_cs: config block: ", DUMP_PREFIX_NONE, |
3560 | u_char *c = (u_char *) &cfblk; | 3560 | 16, 1, &cfblk, sizeof(struct i82593_conf_block), false); |
3561 | int i; | ||
3562 | printk(KERN_DEBUG "wavelan_cs: config block:"); | ||
3563 | for(i = 0; i < sizeof(struct i82593_conf_block); i++,c++) | ||
3564 | { | ||
3565 | if((i % 16) == 0) printk("\n" KERN_DEBUG); | ||
3566 | printk("%02x ", *c); | ||
3567 | } | ||
3568 | printk("\n"); | ||
3569 | } | ||
3570 | #endif | 3561 | #endif |
3571 | 3562 | ||
3572 | /* Copy the config block to the i82593 */ | 3563 | /* Copy the config block to the i82593 */ |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 40b07b988224..3bd3c779fff3 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -698,7 +698,7 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length) | |||
698 | && !mac->pass_ctrl) | 698 | && !mac->pass_ctrl) |
699 | return 0; | 699 | return 0; |
700 | 700 | ||
701 | fc = *(__le16 *)buffer; | 701 | fc = get_unaligned((__le16*)buffer); |
702 | need_padding = ieee80211_is_data_qos(fc) ^ ieee80211_has_a4(fc); | 702 | need_padding = ieee80211_is_data_qos(fc) ^ ieee80211_has_a4(fc); |
703 | 703 | ||
704 | skb = dev_alloc_skb(length + (need_padding ? 2 : 0)); | 704 | skb = dev_alloc_skb(length + (need_padding ? 2 : 0)); |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 14a19baff214..0e6e44689cc6 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -38,7 +38,6 @@ static struct usb_device_id usb_ids[] = { | |||
38 | /* ZD1211 */ | 38 | /* ZD1211 */ |
39 | { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 }, | 39 | { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 }, |
40 | { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 }, | 40 | { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 }, |
41 | { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211 }, | ||
42 | { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 }, | 41 | { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 }, |
43 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, | 42 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, |
44 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, | 43 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, |
@@ -61,6 +60,7 @@ static struct usb_device_id usb_ids[] = { | |||
61 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, | 60 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, |
62 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, | 61 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, |
63 | /* ZD1211B */ | 62 | /* ZD1211B */ |
63 | { USB_DEVICE(0x054c, 0x0257), .driver_info = DEVICE_ZD1211B }, | ||
64 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, | 64 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, |
65 | { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, | 65 | { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, |
66 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, | 66 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, |
@@ -87,6 +87,7 @@ static struct usb_device_id usb_ids[] = { | |||
87 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, | 87 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, |
88 | { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, | 88 | { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, |
89 | { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B }, | 89 | { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B }, |
90 | { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211B }, | ||
90 | /* "Driverless" devices that need ejecting */ | 91 | /* "Driverless" devices that need ejecting */ |
91 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, | 92 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, |
92 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, | 93 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, |
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 3c7a5053f1da..a07580138e81 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -109,7 +109,7 @@ static int gx_fix; | |||
109 | /* These identify the driver base version and may not be removed. */ | 109 | /* These identify the driver base version and may not be removed. */ |
110 | static const char version[] __devinitconst = | 110 | static const char version[] __devinitconst = |
111 | KERN_INFO DRV_NAME ".c:v1.05 1/09/2001 Written by Donald Becker <becker@scyld.com>\n" | 111 | KERN_INFO DRV_NAME ".c:v1.05 1/09/2001 Written by Donald Becker <becker@scyld.com>\n" |
112 | KERN_INFO " (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n"; | 112 | " (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n"; |
113 | 113 | ||
114 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 114 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
115 | MODULE_DESCRIPTION("Packet Engines Yellowfin G-NIC Gigabit Ethernet driver"); | 115 | MODULE_DESCRIPTION("Packet Engines Yellowfin G-NIC Gigabit Ethernet driver"); |
@@ -700,12 +700,15 @@ static void yellowfin_tx_timeout(struct net_device *dev) | |||
700 | int i; | 700 | int i; |
701 | printk(KERN_WARNING " Rx ring %p: ", yp->rx_ring); | 701 | printk(KERN_WARNING " Rx ring %p: ", yp->rx_ring); |
702 | for (i = 0; i < RX_RING_SIZE; i++) | 702 | for (i = 0; i < RX_RING_SIZE; i++) |
703 | printk(" %8.8x", yp->rx_ring[i].result_status); | 703 | printk(KERN_CONT " %8.8x", |
704 | printk("\n"KERN_WARNING" Tx ring %p: ", yp->tx_ring); | 704 | yp->rx_ring[i].result_status); |
705 | printk(KERN_CONT "\n"); | ||
706 | printk(KERN_WARNING" Tx ring %p: ", yp->tx_ring); | ||
705 | for (i = 0; i < TX_RING_SIZE; i++) | 707 | for (i = 0; i < TX_RING_SIZE; i++) |
706 | printk(" %4.4x /%8.8x", yp->tx_status[i].tx_errs, | 708 | printk(KERN_CONT " %4.4x /%8.8x", |
707 | yp->tx_ring[i].result_status); | 709 | yp->tx_status[i].tx_errs, |
708 | printk("\n"); | 710 | yp->tx_ring[i].result_status); |
711 | printk(KERN_CONT "\n"); | ||
709 | } | 712 | } |
710 | 713 | ||
711 | /* If the hardware is found to hang regularly, we will update the code | 714 | /* If the hardware is found to hang regularly, we will update the code |
@@ -1216,20 +1219,20 @@ static int yellowfin_close(struct net_device *dev) | |||
1216 | 1219 | ||
1217 | #if defined(__i386__) | 1220 | #if defined(__i386__) |
1218 | if (yellowfin_debug > 2) { | 1221 | if (yellowfin_debug > 2) { |
1219 | printk("\n"KERN_DEBUG" Tx ring at %8.8llx:\n", | 1222 | printk(KERN_DEBUG" Tx ring at %8.8llx:\n", |
1220 | (unsigned long long)yp->tx_ring_dma); | 1223 | (unsigned long long)yp->tx_ring_dma); |
1221 | for (i = 0; i < TX_RING_SIZE*2; i++) | 1224 | for (i = 0; i < TX_RING_SIZE*2; i++) |
1222 | printk(" %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n", | 1225 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n", |
1223 | ioread32(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ', | 1226 | ioread32(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ', |
1224 | i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr, | 1227 | i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr, |
1225 | yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status); | 1228 | yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status); |
1226 | printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status); | 1229 | printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status); |
1227 | for (i = 0; i < TX_RING_SIZE; i++) | 1230 | for (i = 0; i < TX_RING_SIZE; i++) |
1228 | printk(" #%d status %4.4x %4.4x %4.4x %4.4x.\n", | 1231 | printk(KERN_DEBUG " #%d status %4.4x %4.4x %4.4x %4.4x.\n", |
1229 | i, yp->tx_status[i].tx_cnt, yp->tx_status[i].tx_errs, | 1232 | i, yp->tx_status[i].tx_cnt, yp->tx_status[i].tx_errs, |
1230 | yp->tx_status[i].total_tx_cnt, yp->tx_status[i].paused); | 1233 | yp->tx_status[i].total_tx_cnt, yp->tx_status[i].paused); |
1231 | 1234 | ||
1232 | printk("\n"KERN_DEBUG " Rx ring %8.8llx:\n", | 1235 | printk(KERN_DEBUG " Rx ring %8.8llx:\n", |
1233 | (unsigned long long)yp->rx_ring_dma); | 1236 | (unsigned long long)yp->rx_ring_dma); |
1234 | for (i = 0; i < RX_RING_SIZE; i++) { | 1237 | for (i = 0; i < RX_RING_SIZE; i++) { |
1235 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n", | 1238 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n", |