diff options
93 files changed, 2674 insertions, 2367 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index be5ae600f533..975e14e150ae 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -151,6 +151,13 @@ Who: Ralf Baechle <ralf@linux-mips.org> | |||
151 | 151 | ||
152 | --------------------------- | 152 | --------------------------- |
153 | 153 | ||
154 | What: eepro100 network driver | ||
155 | When: January 2007 | ||
156 | Why: replaced by the e100 driver | ||
157 | Who: Adrian Bunk <bunk@stusta.de> | ||
158 | |||
159 | --------------------------- | ||
160 | |||
154 | What: Legacy /proc/pci interface (PCI_LEGACY_PROC) | 161 | What: Legacy /proc/pci interface (PCI_LEGACY_PROC) |
155 | When: March 2006 | 162 | When: March 2006 |
156 | Why: deprecated since 2.5.53 in favor of lspci(8) | 163 | Why: deprecated since 2.5.53 in favor of lspci(8) |
diff --git a/arch/ppc/platforms/hdpu.c b/arch/ppc/platforms/hdpu.c index 50039a204c24..f945416960e9 100644 --- a/arch/ppc/platforms/hdpu.c +++ b/arch/ppc/platforms/hdpu.c | |||
@@ -319,11 +319,10 @@ static void __init hdpu_fixup_eth_pdata(struct platform_device *pd) | |||
319 | struct mv643xx_eth_platform_data *eth_pd; | 319 | struct mv643xx_eth_platform_data *eth_pd; |
320 | eth_pd = pd->dev.platform_data; | 320 | eth_pd = pd->dev.platform_data; |
321 | 321 | ||
322 | eth_pd->port_serial_control = | ||
323 | mv64x60_read(&bh, MV643XX_ETH_PORT_SERIAL_CONTROL_REG(pd->id) & ~1); | ||
324 | |||
325 | eth_pd->force_phy_addr = 1; | 322 | eth_pd->force_phy_addr = 1; |
326 | eth_pd->phy_addr = pd->id; | 323 | eth_pd->phy_addr = pd->id; |
324 | eth_pd->speed = SPEED_100; | ||
325 | eth_pd->duplex = DUPLEX_FULL; | ||
327 | eth_pd->tx_queue_size = 400; | 326 | eth_pd->tx_queue_size = 400; |
328 | eth_pd->rx_queue_size = 800; | 327 | eth_pd->rx_queue_size = 800; |
329 | } | 328 | } |
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c index 9e1fe2e0478c..b40885d41680 100644 --- a/drivers/net/3c523.c +++ b/drivers/net/3c523.c | |||
@@ -105,6 +105,7 @@ | |||
105 | #include <linux/mca-legacy.h> | 105 | #include <linux/mca-legacy.h> |
106 | #include <linux/ethtool.h> | 106 | #include <linux/ethtool.h> |
107 | #include <linux/bitops.h> | 107 | #include <linux/bitops.h> |
108 | #include <linux/jiffies.h> | ||
108 | 109 | ||
109 | #include <asm/uaccess.h> | 110 | #include <asm/uaccess.h> |
110 | #include <asm/processor.h> | 111 | #include <asm/processor.h> |
@@ -658,7 +659,7 @@ static int init586(struct net_device *dev) | |||
658 | 659 | ||
659 | s = jiffies; /* warning: only active with interrupts on !! */ | 660 | s = jiffies; /* warning: only active with interrupts on !! */ |
660 | while (!(cfg_cmd->cmd_status & STAT_COMPL)) { | 661 | while (!(cfg_cmd->cmd_status & STAT_COMPL)) { |
661 | if (jiffies - s > 30*HZ/100) | 662 | if (time_after(jiffies, s + 30*HZ/100)) |
662 | break; | 663 | break; |
663 | } | 664 | } |
664 | 665 | ||
@@ -684,7 +685,7 @@ static int init586(struct net_device *dev) | |||
684 | 685 | ||
685 | s = jiffies; | 686 | s = jiffies; |
686 | while (!(ias_cmd->cmd_status & STAT_COMPL)) { | 687 | while (!(ias_cmd->cmd_status & STAT_COMPL)) { |
687 | if (jiffies - s > 30*HZ/100) | 688 | if (time_after(jiffies, s + 30*HZ/100)) |
688 | break; | 689 | break; |
689 | } | 690 | } |
690 | 691 | ||
@@ -709,7 +710,7 @@ static int init586(struct net_device *dev) | |||
709 | 710 | ||
710 | s = jiffies; | 711 | s = jiffies; |
711 | while (!(tdr_cmd->cmd_status & STAT_COMPL)) { | 712 | while (!(tdr_cmd->cmd_status & STAT_COMPL)) { |
712 | if (jiffies - s > 30*HZ/100) { | 713 | if (time_after(jiffies, s + 30*HZ/100)) { |
713 | printk(KERN_WARNING "%s: %d Problems while running the TDR.\n", dev->name, __LINE__); | 714 | printk(KERN_WARNING "%s: %d Problems while running the TDR.\n", dev->name, __LINE__); |
714 | result = 1; | 715 | result = 1; |
715 | break; | 716 | break; |
@@ -798,7 +799,7 @@ static int init586(struct net_device *dev) | |||
798 | elmc_id_attn586(); | 799 | elmc_id_attn586(); |
799 | s = jiffies; | 800 | s = jiffies; |
800 | while (!(mc_cmd->cmd_status & STAT_COMPL)) { | 801 | while (!(mc_cmd->cmd_status & STAT_COMPL)) { |
801 | if (jiffies - s > 30*HZ/100) | 802 | if (time_after(jiffies, s + 30*HZ/100)) |
802 | break; | 803 | break; |
803 | } | 804 | } |
804 | if (!(mc_cmd->cmd_status & STAT_COMPL)) { | 805 | if (!(mc_cmd->cmd_status & STAT_COMPL)) { |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 7f47124f118d..9e8897976a69 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -258,6 +258,7 @@ static int vortex_debug = 1; | |||
258 | #include <linux/highmem.h> | 258 | #include <linux/highmem.h> |
259 | #include <linux/eisa.h> | 259 | #include <linux/eisa.h> |
260 | #include <linux/bitops.h> | 260 | #include <linux/bitops.h> |
261 | #include <linux/jiffies.h> | ||
261 | #include <asm/irq.h> /* For NR_IRQS only. */ | 262 | #include <asm/irq.h> /* For NR_IRQS only. */ |
262 | #include <asm/io.h> | 263 | #include <asm/io.h> |
263 | #include <asm/uaccess.h> | 264 | #include <asm/uaccess.h> |
@@ -2724,7 +2725,7 @@ boomerang_rx(struct net_device *dev) | |||
2724 | skb = dev_alloc_skb(PKT_BUF_SZ); | 2725 | skb = dev_alloc_skb(PKT_BUF_SZ); |
2725 | if (skb == NULL) { | 2726 | if (skb == NULL) { |
2726 | static unsigned long last_jif; | 2727 | static unsigned long last_jif; |
2727 | if ((jiffies - last_jif) > 10 * HZ) { | 2728 | if (time_after(jiffies, last_jif + 10 * HZ)) { |
2728 | printk(KERN_WARNING "%s: memory shortage\n", dev->name); | 2729 | printk(KERN_WARNING "%s: memory shortage\n", dev->name); |
2729 | last_jif = jiffies; | 2730 | last_jif = jiffies; |
2730 | } | 2731 | } |
diff --git a/drivers/net/7990.c b/drivers/net/7990.c index 18b027e73f28..86633c5f1a4b 100644 --- a/drivers/net/7990.c +++ b/drivers/net/7990.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/string.h> | 30 | #include <linux/string.h> |
31 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
32 | #include <linux/irq.h> | 32 | #include <asm/irq.h> |
33 | /* Used for the temporal inet entries and routing */ | 33 | /* Used for the temporal inet entries and routing */ |
34 | #include <linux/socket.h> | 34 | #include <linux/socket.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 13b745b39667..da0c878dcba8 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -614,7 +614,7 @@ static void rebuild_rx_bufs(struct net_device *dev) | |||
614 | static int init_i596_mem(struct net_device *dev) | 614 | static int init_i596_mem(struct net_device *dev) |
615 | { | 615 | { |
616 | struct i596_private *lp = dev->priv; | 616 | struct i596_private *lp = dev->priv; |
617 | #if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET) | 617 | #if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET) || defined(ENABLE_APRICOT) |
618 | short ioaddr = dev->base_addr; | 618 | short ioaddr = dev->base_addr; |
619 | #endif | 619 | #endif |
620 | unsigned long flags; | 620 | unsigned long flags; |
diff --git a/drivers/net/apne.c b/drivers/net/apne.c index a94216b87184..b9820b86cdcc 100644 --- a/drivers/net/apne.c +++ b/drivers/net/apne.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/netdevice.h> | 37 | #include <linux/netdevice.h> |
38 | #include <linux/etherdevice.h> | 38 | #include <linux/etherdevice.h> |
39 | #include <linux/jiffies.h> | ||
39 | 40 | ||
40 | #include <asm/system.h> | 41 | #include <asm/system.h> |
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
@@ -216,7 +217,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) | |||
216 | outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); | 217 | outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); |
217 | 218 | ||
218 | while ((inb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) | 219 | while ((inb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) |
219 | if (jiffies - reset_start_time > 2*HZ/100) { | 220 | if (time_after(jiffies, reset_start_time + 2*HZ/100)) { |
220 | printk(" not found (no reset ack).\n"); | 221 | printk(" not found (no reset ack).\n"); |
221 | return -ENODEV; | 222 | return -ENODEV; |
222 | } | 223 | } |
@@ -382,7 +383,7 @@ apne_reset_8390(struct net_device *dev) | |||
382 | 383 | ||
383 | /* This check _should_not_ be necessary, omit eventually. */ | 384 | /* This check _should_not_ be necessary, omit eventually. */ |
384 | while ((inb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) | 385 | while ((inb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) |
385 | if (jiffies - reset_start_time > 2*HZ/100) { | 386 | if (time_after(jiffies, reset_start_time + 2*HZ/100)) { |
386 | printk("%s: ne_reset_8390() did not complete.\n", dev->name); | 387 | printk("%s: ne_reset_8390() did not complete.\n", dev->name); |
387 | break; | 388 | break; |
388 | } | 389 | } |
@@ -530,7 +531,7 @@ apne_block_output(struct net_device *dev, int count, | |||
530 | dma_start = jiffies; | 531 | dma_start = jiffies; |
531 | 532 | ||
532 | while ((inb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) | 533 | while ((inb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) |
533 | if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ | 534 | if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ |
534 | printk("%s: timeout waiting for Tx RDC.\n", dev->name); | 535 | printk("%s: timeout waiting for Tx RDC.\n", dev->name); |
535 | apne_reset_8390(dev); | 536 | apne_reset_8390(dev); |
536 | NS8390_init(dev,1); | 537 | NS8390_init(dev,1); |
diff --git a/drivers/net/arcnet/arc-rawmode.c b/drivers/net/arcnet/arc-rawmode.c index e1ea29b0cd14..e7555d4e6ff1 100644 --- a/drivers/net/arcnet/arc-rawmode.c +++ b/drivers/net/arcnet/arc-rawmode.c | |||
@@ -42,7 +42,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev, | |||
42 | static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length, | 42 | static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length, |
43 | int bufnum); | 43 | int bufnum); |
44 | 44 | ||
45 | struct ArcProto rawmode_proto = | 45 | static struct ArcProto rawmode_proto = |
46 | { | 46 | { |
47 | .suffix = 'r', | 47 | .suffix = 'r', |
48 | .mtu = XMTU, | 48 | .mtu = XMTU, |
diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c index 38c3f033f739..8c8d6c453c45 100644 --- a/drivers/net/arcnet/arc-rimi.c +++ b/drivers/net/arcnet/arc-rimi.c | |||
@@ -97,25 +97,44 @@ static int __init arcrimi_probe(struct net_device *dev) | |||
97 | "must specify the shmem and irq!\n"); | 97 | "must specify the shmem and irq!\n"); |
98 | return -ENODEV; | 98 | return -ENODEV; |
99 | } | 99 | } |
100 | if (dev->dev_addr[0] == 0) { | ||
101 | BUGMSG(D_NORMAL, "You need to specify your card's station " | ||
102 | "ID!\n"); | ||
103 | return -ENODEV; | ||
104 | } | ||
100 | /* | 105 | /* |
101 | * Grab the memory region at mem_start for BUFFER_SIZE bytes. | 106 | * Grab the memory region at mem_start for MIRROR_SIZE bytes. |
102 | * Later in arcrimi_found() the real size will be determined | 107 | * Later in arcrimi_found() the real size will be determined |
103 | * and this reserve will be released and the correct size | 108 | * and this reserve will be released and the correct size |
104 | * will be taken. | 109 | * will be taken. |
105 | */ | 110 | */ |
106 | if (!request_mem_region(dev->mem_start, BUFFER_SIZE, "arcnet (90xx)")) { | 111 | if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { |
107 | BUGMSG(D_NORMAL, "Card memory already allocated\n"); | 112 | BUGMSG(D_NORMAL, "Card memory already allocated\n"); |
108 | return -ENODEV; | 113 | return -ENODEV; |
109 | } | 114 | } |
110 | if (dev->dev_addr[0] == 0) { | ||
111 | release_mem_region(dev->mem_start, BUFFER_SIZE); | ||
112 | BUGMSG(D_NORMAL, "You need to specify your card's station " | ||
113 | "ID!\n"); | ||
114 | return -ENODEV; | ||
115 | } | ||
116 | return arcrimi_found(dev); | 115 | return arcrimi_found(dev); |
117 | } | 116 | } |
118 | 117 | ||
118 | static int check_mirror(unsigned long addr, size_t size) | ||
119 | { | ||
120 | void __iomem *p; | ||
121 | int res = -1; | ||
122 | |||
123 | if (!request_mem_region(addr, size, "arcnet (90xx)")) | ||
124 | return -1; | ||
125 | |||
126 | p = ioremap(addr, size); | ||
127 | if (p) { | ||
128 | if (readb(p) == TESTvalue) | ||
129 | res = 1; | ||
130 | else | ||
131 | res = 0; | ||
132 | iounmap(p); | ||
133 | } | ||
134 | |||
135 | release_mem_region(addr, size); | ||
136 | return res; | ||
137 | } | ||
119 | 138 | ||
120 | /* | 139 | /* |
121 | * Set up the struct net_device associated with this card. Called after | 140 | * Set up the struct net_device associated with this card. Called after |
@@ -125,19 +144,28 @@ static int __init arcrimi_found(struct net_device *dev) | |||
125 | { | 144 | { |
126 | struct arcnet_local *lp; | 145 | struct arcnet_local *lp; |
127 | unsigned long first_mirror, last_mirror, shmem; | 146 | unsigned long first_mirror, last_mirror, shmem; |
147 | void __iomem *p; | ||
128 | int mirror_size; | 148 | int mirror_size; |
129 | int err; | 149 | int err; |
130 | 150 | ||
151 | p = ioremap(dev->mem_start, MIRROR_SIZE); | ||
152 | if (!p) { | ||
153 | release_mem_region(dev->mem_start, MIRROR_SIZE); | ||
154 | BUGMSG(D_NORMAL, "Can't ioremap\n"); | ||
155 | return -ENODEV; | ||
156 | } | ||
157 | |||
131 | /* reserve the irq */ | 158 | /* reserve the irq */ |
132 | if (request_irq(dev->irq, &arcnet_interrupt, 0, "arcnet (RIM I)", dev)) { | 159 | if (request_irq(dev->irq, &arcnet_interrupt, 0, "arcnet (RIM I)", dev)) { |
133 | release_mem_region(dev->mem_start, BUFFER_SIZE); | 160 | iounmap(p); |
161 | release_mem_region(dev->mem_start, MIRROR_SIZE); | ||
134 | BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq); | 162 | BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq); |
135 | return -ENODEV; | 163 | return -ENODEV; |
136 | } | 164 | } |
137 | 165 | ||
138 | shmem = dev->mem_start; | 166 | shmem = dev->mem_start; |
139 | isa_writeb(TESTvalue, shmem); | 167 | writeb(TESTvalue, p); |
140 | isa_writeb(dev->dev_addr[0], shmem + 1); /* actually the node ID */ | 168 | writeb(dev->dev_addr[0], p + 1); /* actually the node ID */ |
141 | 169 | ||
142 | /* find the real shared memory start/end points, including mirrors */ | 170 | /* find the real shared memory start/end points, including mirrors */ |
143 | 171 | ||
@@ -146,17 +174,18 @@ static int __init arcrimi_found(struct net_device *dev) | |||
146 | * 2k (or there are no mirrors at all) but on some, it's 4k. | 174 | * 2k (or there are no mirrors at all) but on some, it's 4k. |
147 | */ | 175 | */ |
148 | mirror_size = MIRROR_SIZE; | 176 | mirror_size = MIRROR_SIZE; |
149 | if (isa_readb(shmem) == TESTvalue | 177 | if (readb(p) == TESTvalue |
150 | && isa_readb(shmem - mirror_size) != TESTvalue | 178 | && check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0 |
151 | && isa_readb(shmem - 2 * mirror_size) == TESTvalue) | 179 | && check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1) |
152 | mirror_size *= 2; | 180 | mirror_size = 2 * MIRROR_SIZE; |
153 | 181 | ||
154 | first_mirror = last_mirror = shmem; | 182 | first_mirror = shmem - mirror_size; |
155 | while (isa_readb(first_mirror) == TESTvalue) | 183 | while (check_mirror(first_mirror, mirror_size) == 1) |
156 | first_mirror -= mirror_size; | 184 | first_mirror -= mirror_size; |
157 | first_mirror += mirror_size; | 185 | first_mirror += mirror_size; |
158 | 186 | ||
159 | while (isa_readb(last_mirror) == TESTvalue) | 187 | last_mirror = shmem + mirror_size; |
188 | while (check_mirror(last_mirror, mirror_size) == 1) | ||
160 | last_mirror += mirror_size; | 189 | last_mirror += mirror_size; |
161 | last_mirror -= mirror_size; | 190 | last_mirror -= mirror_size; |
162 | 191 | ||
@@ -181,7 +210,8 @@ static int __init arcrimi_found(struct net_device *dev) | |||
181 | * with the correct size. There is a VERY slim chance this could | 210 | * with the correct size. There is a VERY slim chance this could |
182 | * fail. | 211 | * fail. |
183 | */ | 212 | */ |
184 | release_mem_region(shmem, BUFFER_SIZE); | 213 | iounmap(p); |
214 | release_mem_region(shmem, MIRROR_SIZE); | ||
185 | if (!request_mem_region(dev->mem_start, | 215 | if (!request_mem_region(dev->mem_start, |
186 | dev->mem_end - dev->mem_start + 1, | 216 | dev->mem_end - dev->mem_start + 1, |
187 | "arcnet (90xx)")) { | 217 | "arcnet (90xx)")) { |
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 12ef52c193a3..64e2caf3083d 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <net/arp.h> | 52 | #include <net/arp.h> |
53 | #include <linux/init.h> | 53 | #include <linux/init.h> |
54 | #include <linux/arcdevice.h> | 54 | #include <linux/arcdevice.h> |
55 | #include <linux/jiffies.h> | ||
55 | 56 | ||
56 | /* "do nothing" functions for protocol drivers */ | 57 | /* "do nothing" functions for protocol drivers */ |
57 | static void null_rx(struct net_device *dev, int bufnum, | 58 | static void null_rx(struct net_device *dev, int bufnum, |
@@ -61,6 +62,7 @@ static int null_build_header(struct sk_buff *skb, struct net_device *dev, | |||
61 | static int null_prepare_tx(struct net_device *dev, struct archdr *pkt, | 62 | static int null_prepare_tx(struct net_device *dev, struct archdr *pkt, |
62 | int length, int bufnum); | 63 | int length, int bufnum); |
63 | 64 | ||
65 | static void arcnet_rx(struct net_device *dev, int bufnum); | ||
64 | 66 | ||
65 | /* | 67 | /* |
66 | * one ArcProto per possible proto ID. None of the elements of | 68 | * one ArcProto per possible proto ID. None of the elements of |
@@ -71,7 +73,7 @@ static int null_prepare_tx(struct net_device *dev, struct archdr *pkt, | |||
71 | struct ArcProto *arc_proto_map[256], *arc_proto_default, | 73 | struct ArcProto *arc_proto_map[256], *arc_proto_default, |
72 | *arc_bcast_proto, *arc_raw_proto; | 74 | *arc_bcast_proto, *arc_raw_proto; |
73 | 75 | ||
74 | struct ArcProto arc_proto_null = | 76 | static struct ArcProto arc_proto_null = |
75 | { | 77 | { |
76 | .suffix = '?', | 78 | .suffix = '?', |
77 | .mtu = XMTU, | 79 | .mtu = XMTU, |
@@ -90,7 +92,6 @@ EXPORT_SYMBOL(arc_proto_map); | |||
90 | EXPORT_SYMBOL(arc_proto_default); | 92 | EXPORT_SYMBOL(arc_proto_default); |
91 | EXPORT_SYMBOL(arc_bcast_proto); | 93 | EXPORT_SYMBOL(arc_bcast_proto); |
92 | EXPORT_SYMBOL(arc_raw_proto); | 94 | EXPORT_SYMBOL(arc_raw_proto); |
93 | EXPORT_SYMBOL(arc_proto_null); | ||
94 | EXPORT_SYMBOL(arcnet_unregister_proto); | 95 | EXPORT_SYMBOL(arcnet_unregister_proto); |
95 | EXPORT_SYMBOL(arcnet_debug); | 96 | EXPORT_SYMBOL(arcnet_debug); |
96 | EXPORT_SYMBOL(alloc_arcdev); | 97 | EXPORT_SYMBOL(alloc_arcdev); |
@@ -118,7 +119,7 @@ static int __init arcnet_init(void) | |||
118 | 119 | ||
119 | arcnet_debug = debug; | 120 | arcnet_debug = debug; |
120 | 121 | ||
121 | printk(VERSION); | 122 | printk("arcnet loaded.\n"); |
122 | 123 | ||
123 | #ifdef ALPHA_WARNING | 124 | #ifdef ALPHA_WARNING |
124 | BUGLVL(D_EXTRA) { | 125 | BUGLVL(D_EXTRA) { |
@@ -178,8 +179,8 @@ EXPORT_SYMBOL(arcnet_dump_skb); | |||
178 | * Dump the contents of an ARCnet buffer | 179 | * Dump the contents of an ARCnet buffer |
179 | */ | 180 | */ |
180 | #if (ARCNET_DEBUG_MAX & (D_RX | D_TX)) | 181 | #if (ARCNET_DEBUG_MAX & (D_RX | D_TX)) |
181 | void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc, | 182 | static void arcnet_dump_packet(struct net_device *dev, int bufnum, |
182 | int take_arcnet_lock) | 183 | char *desc, int take_arcnet_lock) |
183 | { | 184 | { |
184 | struct arcnet_local *lp = dev->priv; | 185 | struct arcnet_local *lp = dev->priv; |
185 | int i, length; | 186 | int i, length; |
@@ -208,7 +209,10 @@ void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc, | |||
208 | 209 | ||
209 | } | 210 | } |
210 | 211 | ||
211 | EXPORT_SYMBOL(arcnet_dump_packet); | 212 | #else |
213 | |||
214 | #define arcnet_dump_packet(dev, bufnum, desc,take_arcnet_lock) do { } while (0) | ||
215 | |||
212 | #endif | 216 | #endif |
213 | 217 | ||
214 | 218 | ||
@@ -733,7 +737,7 @@ static void arcnet_timeout(struct net_device *dev) | |||
733 | 737 | ||
734 | spin_unlock_irqrestore(&lp->lock, flags); | 738 | spin_unlock_irqrestore(&lp->lock, flags); |
735 | 739 | ||
736 | if (jiffies - lp->last_timeout > 10*HZ) { | 740 | if (time_after(jiffies, lp->last_timeout + 10*HZ)) { |
737 | BUGMSG(D_EXTRA, "tx timed out%s (status=%Xh, intmask=%Xh, dest=%02Xh)\n", | 741 | BUGMSG(D_EXTRA, "tx timed out%s (status=%Xh, intmask=%Xh, dest=%02Xh)\n", |
738 | msg, status, lp->intmask, lp->lasttrans_dest); | 742 | msg, status, lp->intmask, lp->lasttrans_dest); |
739 | lp->last_timeout = jiffies; | 743 | lp->last_timeout = jiffies; |
@@ -996,7 +1000,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
996 | * This is a generic packet receiver that calls arcnet??_rx depending on the | 1000 | * This is a generic packet receiver that calls arcnet??_rx depending on the |
997 | * protocol ID found. | 1001 | * protocol ID found. |
998 | */ | 1002 | */ |
999 | void arcnet_rx(struct net_device *dev, int bufnum) | 1003 | static void arcnet_rx(struct net_device *dev, int bufnum) |
1000 | { | 1004 | { |
1001 | struct arcnet_local *lp = dev->priv; | 1005 | struct arcnet_local *lp = dev->priv; |
1002 | struct archdr pkt; | 1006 | struct archdr pkt; |
diff --git a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c index 6c2c9b9ac6db..43150b2bd13f 100644 --- a/drivers/net/arcnet/com90xx.c +++ b/drivers/net/arcnet/com90xx.c | |||
@@ -53,7 +53,7 @@ | |||
53 | 53 | ||
54 | 54 | ||
55 | /* Internal function declarations */ | 55 | /* Internal function declarations */ |
56 | static int com90xx_found(int ioaddr, int airq, u_long shmem); | 56 | static int com90xx_found(int ioaddr, int airq, u_long shmem, void __iomem *); |
57 | static void com90xx_command(struct net_device *dev, int command); | 57 | static void com90xx_command(struct net_device *dev, int command); |
58 | static int com90xx_status(struct net_device *dev); | 58 | static int com90xx_status(struct net_device *dev); |
59 | static void com90xx_setmask(struct net_device *dev, int mask); | 59 | static void com90xx_setmask(struct net_device *dev, int mask); |
@@ -116,14 +116,26 @@ static void __init com90xx_probe(void) | |||
116 | unsigned long airqmask; | 116 | unsigned long airqmask; |
117 | int ports[(0x3f0 - 0x200) / 16 + 1] = | 117 | int ports[(0x3f0 - 0x200) / 16 + 1] = |
118 | {0}; | 118 | {0}; |
119 | u_long shmems[(0xFF800 - 0xA0000) / 2048 + 1] = | 119 | unsigned long *shmems; |
120 | {0}; | 120 | void __iomem **iomem; |
121 | int numports, numshmems, *port; | 121 | int numports, numshmems, *port; |
122 | u_long *p; | 122 | u_long *p; |
123 | int index; | ||
123 | 124 | ||
124 | if (!io && !irq && !shmem && !*device && com90xx_skip_probe) | 125 | if (!io && !irq && !shmem && !*device && com90xx_skip_probe) |
125 | return; | 126 | return; |
126 | 127 | ||
128 | shmems = kzalloc(((0x10000-0xa0000) / 0x800) * sizeof(unsigned long), | ||
129 | GFP_KERNEL); | ||
130 | if (!shmems) | ||
131 | return; | ||
132 | iomem = kzalloc(((0x10000-0xa0000) / 0x800) * sizeof(void __iomem *), | ||
133 | GFP_KERNEL); | ||
134 | if (!iomem) { | ||
135 | kfree(shmems); | ||
136 | return; | ||
137 | } | ||
138 | |||
127 | BUGLVL(D_NORMAL) printk(VERSION); | 139 | BUGLVL(D_NORMAL) printk(VERSION); |
128 | 140 | ||
129 | /* set up the arrays where we'll store the possible probe addresses */ | 141 | /* set up the arrays where we'll store the possible probe addresses */ |
@@ -179,6 +191,8 @@ static void __init com90xx_probe(void) | |||
179 | 191 | ||
180 | if (!numports) { | 192 | if (!numports) { |
181 | BUGMSG2(D_NORMAL, "S1: No ARCnet cards found.\n"); | 193 | BUGMSG2(D_NORMAL, "S1: No ARCnet cards found.\n"); |
194 | kfree(shmems); | ||
195 | kfree(iomem); | ||
182 | return; | 196 | return; |
183 | } | 197 | } |
184 | /* Stage 2: we have now reset any possible ARCnet cards, so we can't | 198 | /* Stage 2: we have now reset any possible ARCnet cards, so we can't |
@@ -202,8 +216,8 @@ static void __init com90xx_probe(void) | |||
202 | * 0xD1 byte in the right place, or are read-only. | 216 | * 0xD1 byte in the right place, or are read-only. |
203 | */ | 217 | */ |
204 | numprint = -1; | 218 | numprint = -1; |
205 | for (p = &shmems[0]; p < shmems + numshmems; p++) { | 219 | for (index = 0, p = &shmems[0]; index < numshmems; p++, index++) { |
206 | u_long ptr = *p; | 220 | void __iomem *base; |
207 | 221 | ||
208 | numprint++; | 222 | numprint++; |
209 | numprint %= 8; | 223 | numprint %= 8; |
@@ -213,38 +227,49 @@ static void __init com90xx_probe(void) | |||
213 | } | 227 | } |
214 | BUGMSG2(D_INIT, "%lXh ", *p); | 228 | BUGMSG2(D_INIT, "%lXh ", *p); |
215 | 229 | ||
216 | if (!request_mem_region(*p, BUFFER_SIZE, "arcnet (90xx)")) { | 230 | if (!request_mem_region(*p, MIRROR_SIZE, "arcnet (90xx)")) { |
217 | BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n"); | 231 | BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n"); |
218 | BUGMSG2(D_INIT_REASONS, "Stage 3: "); | 232 | BUGMSG2(D_INIT_REASONS, "Stage 3: "); |
219 | BUGLVL(D_INIT_REASONS) numprint = 0; | 233 | BUGLVL(D_INIT_REASONS) numprint = 0; |
220 | *p-- = shmems[--numshmems]; | 234 | goto out; |
221 | continue; | 235 | } |
236 | base = ioremap(*p, MIRROR_SIZE); | ||
237 | if (!base) { | ||
238 | BUGMSG2(D_INIT_REASONS, "(ioremap)\n"); | ||
239 | BUGMSG2(D_INIT_REASONS, "Stage 3: "); | ||
240 | BUGLVL(D_INIT_REASONS) numprint = 0; | ||
241 | goto out1; | ||
222 | } | 242 | } |
223 | if (isa_readb(ptr) != TESTvalue) { | 243 | if (readb(base) != TESTvalue) { |
224 | BUGMSG2(D_INIT_REASONS, "(%02Xh != %02Xh)\n", | 244 | BUGMSG2(D_INIT_REASONS, "(%02Xh != %02Xh)\n", |
225 | isa_readb(ptr), TESTvalue); | 245 | readb(base), TESTvalue); |
226 | BUGMSG2(D_INIT_REASONS, "S3: "); | 246 | BUGMSG2(D_INIT_REASONS, "S3: "); |
227 | BUGLVL(D_INIT_REASONS) numprint = 0; | 247 | BUGLVL(D_INIT_REASONS) numprint = 0; |
228 | release_mem_region(*p, BUFFER_SIZE); | 248 | goto out2; |
229 | *p-- = shmems[--numshmems]; | ||
230 | continue; | ||
231 | } | 249 | } |
232 | /* By writing 0x42 to the TESTvalue location, we also make | 250 | /* By writing 0x42 to the TESTvalue location, we also make |
233 | * sure no "mirror" shmem areas show up - if they occur | 251 | * sure no "mirror" shmem areas show up - if they occur |
234 | * in another pass through this loop, they will be discarded | 252 | * in another pass through this loop, they will be discarded |
235 | * because *cptr != TESTvalue. | 253 | * because *cptr != TESTvalue. |
236 | */ | 254 | */ |
237 | isa_writeb(0x42, ptr); | 255 | writeb(0x42, base); |
238 | if (isa_readb(ptr) != 0x42) { | 256 | if (readb(base) != 0x42) { |
239 | BUGMSG2(D_INIT_REASONS, "(read only)\n"); | 257 | BUGMSG2(D_INIT_REASONS, "(read only)\n"); |
240 | BUGMSG2(D_INIT_REASONS, "S3: "); | 258 | BUGMSG2(D_INIT_REASONS, "S3: "); |
241 | release_mem_region(*p, BUFFER_SIZE); | 259 | goto out2; |
242 | *p-- = shmems[--numshmems]; | ||
243 | continue; | ||
244 | } | 260 | } |
245 | BUGMSG2(D_INIT_REASONS, "\n"); | 261 | BUGMSG2(D_INIT_REASONS, "\n"); |
246 | BUGMSG2(D_INIT_REASONS, "S3: "); | 262 | BUGMSG2(D_INIT_REASONS, "S3: "); |
247 | BUGLVL(D_INIT_REASONS) numprint = 0; | 263 | BUGLVL(D_INIT_REASONS) numprint = 0; |
264 | iomem[index] = base; | ||
265 | continue; | ||
266 | out2: | ||
267 | iounmap(base); | ||
268 | out1: | ||
269 | release_mem_region(*p, MIRROR_SIZE); | ||
270 | out: | ||
271 | *p-- = shmems[--numshmems]; | ||
272 | index--; | ||
248 | } | 273 | } |
249 | BUGMSG2(D_INIT, "\n"); | 274 | BUGMSG2(D_INIT, "\n"); |
250 | 275 | ||
@@ -252,6 +277,8 @@ static void __init com90xx_probe(void) | |||
252 | BUGMSG2(D_NORMAL, "S3: No ARCnet cards found.\n"); | 277 | BUGMSG2(D_NORMAL, "S3: No ARCnet cards found.\n"); |
253 | for (port = &ports[0]; port < ports + numports; port++) | 278 | for (port = &ports[0]; port < ports + numports; port++) |
254 | release_region(*port, ARCNET_TOTAL_SIZE); | 279 | release_region(*port, ARCNET_TOTAL_SIZE); |
280 | kfree(shmems); | ||
281 | kfree(iomem); | ||
255 | return; | 282 | return; |
256 | } | 283 | } |
257 | /* Stage 4: something of a dummy, to report the shmems that are | 284 | /* Stage 4: something of a dummy, to report the shmems that are |
@@ -351,30 +378,32 @@ static void __init com90xx_probe(void) | |||
351 | mdelay(RESETtime); | 378 | mdelay(RESETtime); |
352 | } else { | 379 | } else { |
353 | /* just one shmem and port, assume they match */ | 380 | /* just one shmem and port, assume they match */ |
354 | isa_writeb(TESTvalue, shmems[0]); | 381 | writeb(TESTvalue, iomem[0]); |
355 | } | 382 | } |
356 | #else | 383 | #else |
357 | inb(_RESET); | 384 | inb(_RESET); |
358 | mdelay(RESETtime); | 385 | mdelay(RESETtime); |
359 | #endif | 386 | #endif |
360 | 387 | ||
361 | for (p = &shmems[0]; p < shmems + numshmems; p++) { | 388 | for (index = 0; index < numshmems; index++) { |
362 | u_long ptr = *p; | 389 | u_long ptr = shmems[index]; |
390 | void __iomem *base = iomem[index]; | ||
363 | 391 | ||
364 | if (isa_readb(ptr) == TESTvalue) { /* found one */ | 392 | if (readb(base) == TESTvalue) { /* found one */ |
365 | BUGMSG2(D_INIT, "%lXh)\n", *p); | 393 | BUGMSG2(D_INIT, "%lXh)\n", *p); |
366 | openparen = 0; | 394 | openparen = 0; |
367 | 395 | ||
368 | /* register the card */ | 396 | /* register the card */ |
369 | if (com90xx_found(*port, airq, *p) == 0) | 397 | if (com90xx_found(*port, airq, ptr, base) == 0) |
370 | found = 1; | 398 | found = 1; |
371 | numprint = -1; | 399 | numprint = -1; |
372 | 400 | ||
373 | /* remove shmem from the list */ | 401 | /* remove shmem from the list */ |
374 | *p = shmems[--numshmems]; | 402 | shmems[index] = shmems[--numshmems]; |
403 | iomem[index] = iomem[numshmems]; | ||
375 | break; /* go to the next I/O port */ | 404 | break; /* go to the next I/O port */ |
376 | } else { | 405 | } else { |
377 | BUGMSG2(D_INIT_REASONS, "%Xh-", isa_readb(ptr)); | 406 | BUGMSG2(D_INIT_REASONS, "%Xh-", readb(base)); |
378 | } | 407 | } |
379 | } | 408 | } |
380 | 409 | ||
@@ -391,17 +420,40 @@ static void __init com90xx_probe(void) | |||
391 | BUGLVL(D_INIT_REASONS) printk("\n"); | 420 | BUGLVL(D_INIT_REASONS) printk("\n"); |
392 | 421 | ||
393 | /* Now put back TESTvalue on all leftover shmems. */ | 422 | /* Now put back TESTvalue on all leftover shmems. */ |
394 | for (p = &shmems[0]; p < shmems + numshmems; p++) { | 423 | for (index = 0; index < numshmems; index++) { |
395 | isa_writeb(TESTvalue, *p); | 424 | writeb(TESTvalue, iomem[index]); |
396 | release_mem_region(*p, BUFFER_SIZE); | 425 | iounmap(iomem[index]); |
426 | release_mem_region(shmems[index], MIRROR_SIZE); | ||
397 | } | 427 | } |
428 | kfree(shmems); | ||
429 | kfree(iomem); | ||
398 | } | 430 | } |
399 | 431 | ||
432 | static int check_mirror(unsigned long addr, size_t size) | ||
433 | { | ||
434 | void __iomem *p; | ||
435 | int res = -1; | ||
436 | |||
437 | if (!request_mem_region(addr, size, "arcnet (90xx)")) | ||
438 | return -1; | ||
439 | |||
440 | p = ioremap(addr, size); | ||
441 | if (p) { | ||
442 | if (readb(p) == TESTvalue) | ||
443 | res = 1; | ||
444 | else | ||
445 | res = 0; | ||
446 | iounmap(p); | ||
447 | } | ||
448 | |||
449 | release_mem_region(addr, size); | ||
450 | return res; | ||
451 | } | ||
400 | 452 | ||
401 | /* Set up the struct net_device associated with this card. Called after | 453 | /* Set up the struct net_device associated with this card. Called after |
402 | * probing succeeds. | 454 | * probing succeeds. |
403 | */ | 455 | */ |
404 | static int __init com90xx_found(int ioaddr, int airq, u_long shmem) | 456 | static int __init com90xx_found(int ioaddr, int airq, u_long shmem, void __iomem *p) |
405 | { | 457 | { |
406 | struct net_device *dev = NULL; | 458 | struct net_device *dev = NULL; |
407 | struct arcnet_local *lp; | 459 | struct arcnet_local *lp; |
@@ -412,7 +464,8 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem) | |||
412 | dev = alloc_arcdev(device); | 464 | dev = alloc_arcdev(device); |
413 | if (!dev) { | 465 | if (!dev) { |
414 | BUGMSG2(D_NORMAL, "com90xx: Can't allocate device!\n"); | 466 | BUGMSG2(D_NORMAL, "com90xx: Can't allocate device!\n"); |
415 | release_mem_region(shmem, BUFFER_SIZE); | 467 | iounmap(p); |
468 | release_mem_region(shmem, MIRROR_SIZE); | ||
416 | return -ENOMEM; | 469 | return -ENOMEM; |
417 | } | 470 | } |
418 | lp = dev->priv; | 471 | lp = dev->priv; |
@@ -423,24 +476,27 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem) | |||
423 | * 2k (or there are no mirrors at all) but on some, it's 4k. | 476 | * 2k (or there are no mirrors at all) but on some, it's 4k. |
424 | */ | 477 | */ |
425 | mirror_size = MIRROR_SIZE; | 478 | mirror_size = MIRROR_SIZE; |
426 | if (isa_readb(shmem) == TESTvalue | 479 | if (readb(p) == TESTvalue && |
427 | && isa_readb(shmem - mirror_size) != TESTvalue | 480 | check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0 && |
428 | && isa_readb(shmem - 2 * mirror_size) == TESTvalue) | 481 | check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1) |
429 | mirror_size *= 2; | 482 | mirror_size = 2 * MIRROR_SIZE; |
430 | 483 | ||
431 | first_mirror = last_mirror = shmem; | 484 | first_mirror = shmem - mirror_size; |
432 | while (isa_readb(first_mirror) == TESTvalue) | 485 | while (check_mirror(first_mirror, mirror_size) == 1) |
433 | first_mirror -= mirror_size; | 486 | first_mirror -= mirror_size; |
434 | first_mirror += mirror_size; | 487 | first_mirror += mirror_size; |
435 | 488 | ||
436 | while (isa_readb(last_mirror) == TESTvalue) | 489 | last_mirror = shmem + mirror_size; |
490 | while (check_mirror(last_mirror, mirror_size) == 1) | ||
437 | last_mirror += mirror_size; | 491 | last_mirror += mirror_size; |
438 | last_mirror -= mirror_size; | 492 | last_mirror -= mirror_size; |
439 | 493 | ||
440 | dev->mem_start = first_mirror; | 494 | dev->mem_start = first_mirror; |
441 | dev->mem_end = last_mirror + MIRROR_SIZE - 1; | 495 | dev->mem_end = last_mirror + MIRROR_SIZE - 1; |
442 | 496 | ||
443 | release_mem_region(shmem, BUFFER_SIZE); | 497 | iounmap(p); |
498 | release_mem_region(shmem, MIRROR_SIZE); | ||
499 | |||
444 | if (!request_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1, "arcnet (90xx)")) | 500 | if (!request_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1, "arcnet (90xx)")) |
445 | goto err_free_dev; | 501 | goto err_free_dev; |
446 | 502 | ||
diff --git a/drivers/net/arcnet/rfc1051.c b/drivers/net/arcnet/rfc1051.c index 6d7913704fb5..6d6c69f036ef 100644 --- a/drivers/net/arcnet/rfc1051.c +++ b/drivers/net/arcnet/rfc1051.c | |||
@@ -43,7 +43,7 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length, | |||
43 | int bufnum); | 43 | int bufnum); |
44 | 44 | ||
45 | 45 | ||
46 | struct ArcProto rfc1051_proto = | 46 | static struct ArcProto rfc1051_proto = |
47 | { | 47 | { |
48 | .suffix = 's', | 48 | .suffix = 's', |
49 | .mtu = XMTU - RFC1051_HDR_SIZE, | 49 | .mtu = XMTU - RFC1051_HDR_SIZE, |
diff --git a/drivers/net/arcnet/rfc1201.c b/drivers/net/arcnet/rfc1201.c index 6b6ae4bf3d39..bee34226abfa 100644 --- a/drivers/net/arcnet/rfc1201.c +++ b/drivers/net/arcnet/rfc1201.c | |||
@@ -43,7 +43,7 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length, | |||
43 | int bufnum); | 43 | int bufnum); |
44 | static int continue_tx(struct net_device *dev, int bufnum); | 44 | static int continue_tx(struct net_device *dev, int bufnum); |
45 | 45 | ||
46 | struct ArcProto rfc1201_proto = | 46 | static struct ArcProto rfc1201_proto = |
47 | { | 47 | { |
48 | .suffix = 'a', | 48 | .suffix = 'a', |
49 | .mtu = 1500, /* could be more, but some receivers can't handle it... */ | 49 | .mtu = 1500, /* could be more, but some receivers can't handle it... */ |
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c index 6a93b666eb72..d52deb8d2075 100644 --- a/drivers/net/arm/etherh.c +++ b/drivers/net/arm/etherh.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/device.h> | 46 | #include <linux/device.h> |
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/bitops.h> | 48 | #include <linux/bitops.h> |
49 | #include <linux/jiffies.h> | ||
49 | 50 | ||
50 | #include <asm/system.h> | 51 | #include <asm/system.h> |
51 | #include <asm/ecard.h> | 52 | #include <asm/ecard.h> |
@@ -355,7 +356,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf | |||
355 | dma_start = jiffies; | 356 | dma_start = jiffies; |
356 | 357 | ||
357 | while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0) | 358 | while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0) |
358 | if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ | 359 | if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ |
359 | printk(KERN_ERR "%s: timeout waiting for TX RDC\n", | 360 | printk(KERN_ERR "%s: timeout waiting for TX RDC\n", |
360 | dev->name); | 361 | dev->name); |
361 | etherh_reset (dev); | 362 | etherh_reset (dev); |
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c index f32a6b3acb2a..b67545be2caa 100644 --- a/drivers/net/eth16i.c +++ b/drivers/net/eth16i.c | |||
@@ -161,6 +161,7 @@ static char *version = | |||
161 | #include <linux/etherdevice.h> | 161 | #include <linux/etherdevice.h> |
162 | #include <linux/skbuff.h> | 162 | #include <linux/skbuff.h> |
163 | #include <linux/bitops.h> | 163 | #include <linux/bitops.h> |
164 | #include <linux/jiffies.h> | ||
164 | 165 | ||
165 | #include <asm/system.h> | 166 | #include <asm/system.h> |
166 | #include <asm/io.h> | 167 | #include <asm/io.h> |
@@ -754,7 +755,7 @@ static void eth16i_set_port(int ioaddr, int porttype) | |||
754 | 755 | ||
755 | static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) | 756 | static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) |
756 | { | 757 | { |
757 | int starttime; | 758 | unsigned long starttime; |
758 | 759 | ||
759 | outb(0xff, ioaddr + TX_STATUS_REG); | 760 | outb(0xff, ioaddr + TX_STATUS_REG); |
760 | 761 | ||
@@ -765,7 +766,7 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) | |||
765 | outb(TX_START | 1, ioaddr + TRANSMIT_START_REG); | 766 | outb(TX_START | 1, ioaddr + TRANSMIT_START_REG); |
766 | 767 | ||
767 | while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) { | 768 | while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) { |
768 | if( (jiffies - starttime) > TX_TIMEOUT) { | 769 | if( time_after(jiffies, starttime + TX_TIMEOUT)) { |
769 | return -1; | 770 | return -1; |
770 | } | 771 | } |
771 | } | 772 | } |
@@ -775,18 +776,18 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) | |||
775 | 776 | ||
776 | static int eth16i_receive_probe_packet(int ioaddr) | 777 | static int eth16i_receive_probe_packet(int ioaddr) |
777 | { | 778 | { |
778 | int starttime; | 779 | unsigned long starttime; |
779 | 780 | ||
780 | starttime = jiffies; | 781 | starttime = jiffies; |
781 | 782 | ||
782 | while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) { | 783 | while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) { |
783 | if( (jiffies - starttime) > TX_TIMEOUT) { | 784 | if( time_after(jiffies, starttime + TX_TIMEOUT)) { |
784 | 785 | ||
785 | if(eth16i_debug > 1) | 786 | if(eth16i_debug > 1) |
786 | printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n"); | 787 | printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n"); |
787 | starttime = jiffies; | 788 | starttime = jiffies; |
788 | while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) { | 789 | while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) { |
789 | if( (jiffies - starttime) > TX_TIMEOUT) { | 790 | if( time_after(jiffies, starttime + TX_TIMEOUT)) { |
790 | if(eth16i_debug > 1) | 791 | if(eth16i_debug > 1) |
791 | printk(KERN_DEBUG "Timeout occurred waiting receive packet\n"); | 792 | printk(KERN_DEBUG "Timeout occurred waiting receive packet\n"); |
792 | return -1; | 793 | return -1; |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 3682ec61e8a8..e7fc28b07e5a 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -102,6 +102,9 @@ | |||
102 | * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. | 102 | * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. |
103 | * 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single | 103 | * 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single |
104 | * 0.49: 10 Dec 2005: Fix tso for large buffers. | 104 | * 0.49: 10 Dec 2005: Fix tso for large buffers. |
105 | * 0.50: 20 Jan 2006: Add 8021pq tagging support. | ||
106 | * 0.51: 20 Jan 2006: Add 64bit consistent memory allocation for rings. | ||
107 | * 0.52: 20 Jan 2006: Add MSI/MSIX support. | ||
105 | * | 108 | * |
106 | * Known bugs: | 109 | * Known bugs: |
107 | * We suspect that on some hardware no TX done interrupts are generated. | 110 | * We suspect that on some hardware no TX done interrupts are generated. |
@@ -113,7 +116,7 @@ | |||
113 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few | 116 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
114 | * superfluous timer interrupts from the nic. | 117 | * superfluous timer interrupts from the nic. |
115 | */ | 118 | */ |
116 | #define FORCEDETH_VERSION "0.49" | 119 | #define FORCEDETH_VERSION "0.52" |
117 | #define DRV_NAME "forcedeth" | 120 | #define DRV_NAME "forcedeth" |
118 | 121 | ||
119 | #include <linux/module.h> | 122 | #include <linux/module.h> |
@@ -153,6 +156,9 @@ | |||
153 | #define DEV_HAS_LARGEDESC 0x0004 /* device supports jumbo frames and needs packet format 2 */ | 156 | #define DEV_HAS_LARGEDESC 0x0004 /* device supports jumbo frames and needs packet format 2 */ |
154 | #define DEV_HAS_HIGH_DMA 0x0008 /* device supports 64bit dma */ | 157 | #define DEV_HAS_HIGH_DMA 0x0008 /* device supports 64bit dma */ |
155 | #define DEV_HAS_CHECKSUM 0x0010 /* device supports tx and rx checksum offloads */ | 158 | #define DEV_HAS_CHECKSUM 0x0010 /* device supports tx and rx checksum offloads */ |
159 | #define DEV_HAS_VLAN 0x0020 /* device supports vlan tagging and striping */ | ||
160 | #define DEV_HAS_MSI 0x0040 /* device supports MSI */ | ||
161 | #define DEV_HAS_MSI_X 0x0080 /* device supports MSI-X */ | ||
156 | 162 | ||
157 | enum { | 163 | enum { |
158 | NvRegIrqStatus = 0x000, | 164 | NvRegIrqStatus = 0x000, |
@@ -166,14 +172,17 @@ enum { | |||
166 | #define NVREG_IRQ_TX_OK 0x0010 | 172 | #define NVREG_IRQ_TX_OK 0x0010 |
167 | #define NVREG_IRQ_TIMER 0x0020 | 173 | #define NVREG_IRQ_TIMER 0x0020 |
168 | #define NVREG_IRQ_LINK 0x0040 | 174 | #define NVREG_IRQ_LINK 0x0040 |
169 | #define NVREG_IRQ_TX_ERROR 0x0080 | 175 | #define NVREG_IRQ_RX_FORCED 0x0080 |
170 | #define NVREG_IRQ_TX1 0x0100 | 176 | #define NVREG_IRQ_TX_FORCED 0x0100 |
171 | #define NVREG_IRQMASK_THROUGHPUT 0x00df | 177 | #define NVREG_IRQMASK_THROUGHPUT 0x00df |
172 | #define NVREG_IRQMASK_CPU 0x0040 | 178 | #define NVREG_IRQMASK_CPU 0x0040 |
179 | #define NVREG_IRQ_TX_ALL (NVREG_IRQ_TX_ERR|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_FORCED) | ||
180 | #define NVREG_IRQ_RX_ALL (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_RX_FORCED) | ||
181 | #define NVREG_IRQ_OTHER (NVREG_IRQ_TIMER|NVREG_IRQ_LINK) | ||
173 | 182 | ||
174 | #define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ | 183 | #define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ |
175 | NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX_ERROR| \ | 184 | NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_RX_FORCED| \ |
176 | NVREG_IRQ_TX1)) | 185 | NVREG_IRQ_TX_FORCED)) |
177 | 186 | ||
178 | NvRegUnknownSetupReg6 = 0x008, | 187 | NvRegUnknownSetupReg6 = 0x008, |
179 | #define NVREG_UNKSETUP6_VAL 3 | 188 | #define NVREG_UNKSETUP6_VAL 3 |
@@ -185,6 +194,10 @@ enum { | |||
185 | NvRegPollingInterval = 0x00c, | 194 | NvRegPollingInterval = 0x00c, |
186 | #define NVREG_POLL_DEFAULT_THROUGHPUT 970 | 195 | #define NVREG_POLL_DEFAULT_THROUGHPUT 970 |
187 | #define NVREG_POLL_DEFAULT_CPU 13 | 196 | #define NVREG_POLL_DEFAULT_CPU 13 |
197 | NvRegMSIMap0 = 0x020, | ||
198 | NvRegMSIMap1 = 0x024, | ||
199 | NvRegMSIIrqMask = 0x030, | ||
200 | #define NVREG_MSI_VECTOR_0_ENABLED 0x01 | ||
188 | NvRegMisc1 = 0x080, | 201 | NvRegMisc1 = 0x080, |
189 | #define NVREG_MISC1_HD 0x02 | 202 | #define NVREG_MISC1_HD 0x02 |
190 | #define NVREG_MISC1_FORCE 0x3b0f3c | 203 | #define NVREG_MISC1_FORCE 0x3b0f3c |
@@ -254,6 +267,10 @@ enum { | |||
254 | #define NVREG_TXRXCTL_DESC_1 0 | 267 | #define NVREG_TXRXCTL_DESC_1 0 |
255 | #define NVREG_TXRXCTL_DESC_2 0x02100 | 268 | #define NVREG_TXRXCTL_DESC_2 0x02100 |
256 | #define NVREG_TXRXCTL_DESC_3 0x02200 | 269 | #define NVREG_TXRXCTL_DESC_3 0x02200 |
270 | #define NVREG_TXRXCTL_VLANSTRIP 0x00040 | ||
271 | #define NVREG_TXRXCTL_VLANINS 0x00080 | ||
272 | NvRegTxRingPhysAddrHigh = 0x148, | ||
273 | NvRegRxRingPhysAddrHigh = 0x14C, | ||
257 | NvRegMIIStatus = 0x180, | 274 | NvRegMIIStatus = 0x180, |
258 | #define NVREG_MIISTAT_ERROR 0x0001 | 275 | #define NVREG_MIISTAT_ERROR 0x0001 |
259 | #define NVREG_MIISTAT_LINKCHANGE 0x0008 | 276 | #define NVREG_MIISTAT_LINKCHANGE 0x0008 |
@@ -303,6 +320,11 @@ enum { | |||
303 | #define NVREG_POWERSTATE_D1 0x0001 | 320 | #define NVREG_POWERSTATE_D1 0x0001 |
304 | #define NVREG_POWERSTATE_D2 0x0002 | 321 | #define NVREG_POWERSTATE_D2 0x0002 |
305 | #define NVREG_POWERSTATE_D3 0x0003 | 322 | #define NVREG_POWERSTATE_D3 0x0003 |
323 | NvRegVlanControl = 0x300, | ||
324 | #define NVREG_VLANCONTROL_ENABLE 0x2000 | ||
325 | NvRegMSIXMap0 = 0x3e0, | ||
326 | NvRegMSIXMap1 = 0x3e4, | ||
327 | NvRegMSIXIrqStatus = 0x3f0, | ||
306 | }; | 328 | }; |
307 | 329 | ||
308 | /* Big endian: should work, but is untested */ | 330 | /* Big endian: should work, but is untested */ |
@@ -314,7 +336,7 @@ struct ring_desc { | |||
314 | struct ring_desc_ex { | 336 | struct ring_desc_ex { |
315 | u32 PacketBufferHigh; | 337 | u32 PacketBufferHigh; |
316 | u32 PacketBufferLow; | 338 | u32 PacketBufferLow; |
317 | u32 Reserved; | 339 | u32 TxVlan; |
318 | u32 FlagLen; | 340 | u32 FlagLen; |
319 | }; | 341 | }; |
320 | 342 | ||
@@ -355,6 +377,8 @@ typedef union _ring_type { | |||
355 | #define NV_TX2_CHECKSUM_L3 (1<<27) | 377 | #define NV_TX2_CHECKSUM_L3 (1<<27) |
356 | #define NV_TX2_CHECKSUM_L4 (1<<26) | 378 | #define NV_TX2_CHECKSUM_L4 (1<<26) |
357 | 379 | ||
380 | #define NV_TX3_VLAN_TAG_PRESENT (1<<18) | ||
381 | |||
358 | #define NV_RX_DESCRIPTORVALID (1<<16) | 382 | #define NV_RX_DESCRIPTORVALID (1<<16) |
359 | #define NV_RX_MISSEDFRAME (1<<17) | 383 | #define NV_RX_MISSEDFRAME (1<<17) |
360 | #define NV_RX_SUBSTRACT1 (1<<18) | 384 | #define NV_RX_SUBSTRACT1 (1<<18) |
@@ -385,6 +409,9 @@ typedef union _ring_type { | |||
385 | #define NV_RX2_ERROR (1<<30) | 409 | #define NV_RX2_ERROR (1<<30) |
386 | #define NV_RX2_AVAIL (1<<31) | 410 | #define NV_RX2_AVAIL (1<<31) |
387 | 411 | ||
412 | #define NV_RX3_VLAN_TAG_PRESENT (1<<16) | ||
413 | #define NV_RX3_VLAN_TAG_MASK (0x0000FFFF) | ||
414 | |||
388 | /* Miscelaneous hardware related defines: */ | 415 | /* Miscelaneous hardware related defines: */ |
389 | #define NV_PCI_REGSZ 0x270 | 416 | #define NV_PCI_REGSZ 0x270 |
390 | 417 | ||
@@ -475,6 +502,18 @@ typedef union _ring_type { | |||
475 | #define LPA_1000FULL 0x0800 | 502 | #define LPA_1000FULL 0x0800 |
476 | #define LPA_1000HALF 0x0400 | 503 | #define LPA_1000HALF 0x0400 |
477 | 504 | ||
505 | /* MSI/MSI-X defines */ | ||
506 | #define NV_MSI_X_MAX_VECTORS 8 | ||
507 | #define NV_MSI_X_VECTORS_MASK 0x000f | ||
508 | #define NV_MSI_CAPABLE 0x0010 | ||
509 | #define NV_MSI_X_CAPABLE 0x0020 | ||
510 | #define NV_MSI_ENABLED 0x0040 | ||
511 | #define NV_MSI_X_ENABLED 0x0080 | ||
512 | |||
513 | #define NV_MSI_X_VECTOR_ALL 0x0 | ||
514 | #define NV_MSI_X_VECTOR_RX 0x0 | ||
515 | #define NV_MSI_X_VECTOR_TX 0x1 | ||
516 | #define NV_MSI_X_VECTOR_OTHER 0x2 | ||
478 | 517 | ||
479 | /* | 518 | /* |
480 | * SMP locking: | 519 | * SMP locking: |
@@ -511,6 +550,7 @@ struct fe_priv { | |||
511 | u32 irqmask; | 550 | u32 irqmask; |
512 | u32 desc_ver; | 551 | u32 desc_ver; |
513 | u32 txrxctl_bits; | 552 | u32 txrxctl_bits; |
553 | u32 vlanctl_bits; | ||
514 | 554 | ||
515 | void __iomem *base; | 555 | void __iomem *base; |
516 | 556 | ||
@@ -525,6 +565,7 @@ struct fe_priv { | |||
525 | unsigned int pkt_limit; | 565 | unsigned int pkt_limit; |
526 | struct timer_list oom_kick; | 566 | struct timer_list oom_kick; |
527 | struct timer_list nic_poll; | 567 | struct timer_list nic_poll; |
568 | u32 nic_poll_irq; | ||
528 | 569 | ||
529 | /* media detection workaround. | 570 | /* media detection workaround. |
530 | * Locking: Within irq hander or disable_irq+spin_lock(&np->lock); | 571 | * Locking: Within irq hander or disable_irq+spin_lock(&np->lock); |
@@ -540,6 +581,13 @@ struct fe_priv { | |||
540 | dma_addr_t tx_dma[TX_RING]; | 581 | dma_addr_t tx_dma[TX_RING]; |
541 | unsigned int tx_dma_len[TX_RING]; | 582 | unsigned int tx_dma_len[TX_RING]; |
542 | u32 tx_flags; | 583 | u32 tx_flags; |
584 | |||
585 | /* vlan fields */ | ||
586 | struct vlan_group *vlangrp; | ||
587 | |||
588 | /* msi/msi-x fields */ | ||
589 | u32 msi_flags; | ||
590 | struct msix_entry msi_x_entry[NV_MSI_X_MAX_VECTORS]; | ||
543 | }; | 591 | }; |
544 | 592 | ||
545 | /* | 593 | /* |
@@ -567,6 +615,16 @@ static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT; | |||
567 | */ | 615 | */ |
568 | static int poll_interval = -1; | 616 | static int poll_interval = -1; |
569 | 617 | ||
618 | /* | ||
619 | * Disable MSI interrupts | ||
620 | */ | ||
621 | static int disable_msi = 0; | ||
622 | |||
623 | /* | ||
624 | * Disable MSIX interrupts | ||
625 | */ | ||
626 | static int disable_msix = 0; | ||
627 | |||
570 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) | 628 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) |
571 | { | 629 | { |
572 | return netdev_priv(dev); | 630 | return netdev_priv(dev); |
@@ -612,6 +670,33 @@ static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target, | |||
612 | return 0; | 670 | return 0; |
613 | } | 671 | } |
614 | 672 | ||
673 | #define NV_SETUP_RX_RING 0x01 | ||
674 | #define NV_SETUP_TX_RING 0x02 | ||
675 | |||
676 | static void setup_hw_rings(struct net_device *dev, int rxtx_flags) | ||
677 | { | ||
678 | struct fe_priv *np = get_nvpriv(dev); | ||
679 | u8 __iomem *base = get_hwbase(dev); | ||
680 | |||
681 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | ||
682 | if (rxtx_flags & NV_SETUP_RX_RING) { | ||
683 | writel((u32) cpu_to_le64(np->ring_addr), base + NvRegRxRingPhysAddr); | ||
684 | } | ||
685 | if (rxtx_flags & NV_SETUP_TX_RING) { | ||
686 | writel((u32) cpu_to_le64(np->ring_addr + RX_RING*sizeof(struct ring_desc)), base + NvRegTxRingPhysAddr); | ||
687 | } | ||
688 | } else { | ||
689 | if (rxtx_flags & NV_SETUP_RX_RING) { | ||
690 | writel((u32) cpu_to_le64(np->ring_addr), base + NvRegRxRingPhysAddr); | ||
691 | writel((u32) (cpu_to_le64(np->ring_addr) >> 32), base + NvRegRxRingPhysAddrHigh); | ||
692 | } | ||
693 | if (rxtx_flags & NV_SETUP_TX_RING) { | ||
694 | writel((u32) cpu_to_le64(np->ring_addr + RX_RING*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddr); | ||
695 | writel((u32) (cpu_to_le64(np->ring_addr + RX_RING*sizeof(struct ring_desc_ex)) >> 32), base + NvRegTxRingPhysAddrHigh); | ||
696 | } | ||
697 | } | ||
698 | } | ||
699 | |||
615 | #define MII_READ (-1) | 700 | #define MII_READ (-1) |
616 | /* mii_rw: read/write a register on the PHY. | 701 | /* mii_rw: read/write a register on the PHY. |
617 | * | 702 | * |
@@ -903,14 +988,27 @@ static void nv_do_rx_refill(unsigned long data) | |||
903 | struct net_device *dev = (struct net_device *) data; | 988 | struct net_device *dev = (struct net_device *) data; |
904 | struct fe_priv *np = netdev_priv(dev); | 989 | struct fe_priv *np = netdev_priv(dev); |
905 | 990 | ||
906 | disable_irq(dev->irq); | 991 | |
992 | if (!(np->msi_flags & NV_MSI_X_ENABLED) || | ||
993 | ((np->msi_flags & NV_MSI_X_ENABLED) && | ||
994 | ((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))) { | ||
995 | disable_irq(dev->irq); | ||
996 | } else { | ||
997 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | ||
998 | } | ||
907 | if (nv_alloc_rx(dev)) { | 999 | if (nv_alloc_rx(dev)) { |
908 | spin_lock(&np->lock); | 1000 | spin_lock(&np->lock); |
909 | if (!np->in_shutdown) | 1001 | if (!np->in_shutdown) |
910 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | 1002 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
911 | spin_unlock(&np->lock); | 1003 | spin_unlock(&np->lock); |
912 | } | 1004 | } |
913 | enable_irq(dev->irq); | 1005 | if (!(np->msi_flags & NV_MSI_X_ENABLED) || |
1006 | ((np->msi_flags & NV_MSI_X_ENABLED) && | ||
1007 | ((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))) { | ||
1008 | enable_irq(dev->irq); | ||
1009 | } else { | ||
1010 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | ||
1011 | } | ||
914 | } | 1012 | } |
915 | 1013 | ||
916 | static void nv_init_rx(struct net_device *dev) | 1014 | static void nv_init_rx(struct net_device *dev) |
@@ -965,7 +1063,7 @@ static int nv_release_txskb(struct net_device *dev, unsigned int skbnr) | |||
965 | } | 1063 | } |
966 | 1064 | ||
967 | if (np->tx_skbuff[skbnr]) { | 1065 | if (np->tx_skbuff[skbnr]) { |
968 | dev_kfree_skb_irq(np->tx_skbuff[skbnr]); | 1066 | dev_kfree_skb_any(np->tx_skbuff[skbnr]); |
969 | np->tx_skbuff[skbnr] = NULL; | 1067 | np->tx_skbuff[skbnr] = NULL; |
970 | return 1; | 1068 | return 1; |
971 | } else { | 1069 | } else { |
@@ -1031,6 +1129,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1031 | u32 bcnt; | 1129 | u32 bcnt; |
1032 | u32 size = skb->len-skb->data_len; | 1130 | u32 size = skb->len-skb->data_len; |
1033 | u32 entries = (size >> NV_TX2_TSO_MAX_SHIFT) + ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); | 1131 | u32 entries = (size >> NV_TX2_TSO_MAX_SHIFT) + ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); |
1132 | u32 tx_flags_vlan = 0; | ||
1034 | 1133 | ||
1035 | /* add fragments to entries count */ | 1134 | /* add fragments to entries count */ |
1036 | for (i = 0; i < fragments; i++) { | 1135 | for (i = 0; i < fragments; i++) { |
@@ -1111,10 +1210,16 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1111 | #endif | 1210 | #endif |
1112 | tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); | 1211 | tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); |
1113 | 1212 | ||
1213 | /* vlan tag */ | ||
1214 | if (np->vlangrp && vlan_tx_tag_present(skb)) { | ||
1215 | tx_flags_vlan = NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb); | ||
1216 | } | ||
1217 | |||
1114 | /* set tx flags */ | 1218 | /* set tx flags */ |
1115 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1219 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1116 | np->tx_ring.orig[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); | 1220 | np->tx_ring.orig[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); |
1117 | } else { | 1221 | } else { |
1222 | np->tx_ring.ex[start_nr].TxVlan = cpu_to_le32(tx_flags_vlan); | ||
1118 | np->tx_ring.ex[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); | 1223 | np->tx_ring.ex[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); |
1119 | } | 1224 | } |
1120 | 1225 | ||
@@ -1209,9 +1314,14 @@ static void nv_tx_timeout(struct net_device *dev) | |||
1209 | { | 1314 | { |
1210 | struct fe_priv *np = netdev_priv(dev); | 1315 | struct fe_priv *np = netdev_priv(dev); |
1211 | u8 __iomem *base = get_hwbase(dev); | 1316 | u8 __iomem *base = get_hwbase(dev); |
1317 | u32 status; | ||
1318 | |||
1319 | if (np->msi_flags & NV_MSI_X_ENABLED) | ||
1320 | status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; | ||
1321 | else | ||
1322 | status = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; | ||
1212 | 1323 | ||
1213 | printk(KERN_INFO "%s: Got tx_timeout. irq: %08x\n", dev->name, | 1324 | printk(KERN_INFO "%s: Got tx_timeout. irq: %08x\n", dev->name, status); |
1214 | readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK); | ||
1215 | 1325 | ||
1216 | { | 1326 | { |
1217 | int i; | 1327 | int i; |
@@ -1273,10 +1383,7 @@ static void nv_tx_timeout(struct net_device *dev) | |||
1273 | printk(KERN_DEBUG "%s: tx_timeout: dead entries!\n", dev->name); | 1383 | printk(KERN_DEBUG "%s: tx_timeout: dead entries!\n", dev->name); |
1274 | nv_drain_tx(dev); | 1384 | nv_drain_tx(dev); |
1275 | np->next_tx = np->nic_tx = 0; | 1385 | np->next_tx = np->nic_tx = 0; |
1276 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 1386 | setup_hw_rings(dev, NV_SETUP_TX_RING); |
1277 | writel((u32) (np->ring_addr + RX_RING*sizeof(struct ring_desc)), base + NvRegTxRingPhysAddr); | ||
1278 | else | ||
1279 | writel((u32) (np->ring_addr + RX_RING*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddr); | ||
1280 | netif_wake_queue(dev); | 1387 | netif_wake_queue(dev); |
1281 | } | 1388 | } |
1282 | 1389 | ||
@@ -1342,6 +1449,8 @@ static void nv_rx_process(struct net_device *dev) | |||
1342 | { | 1449 | { |
1343 | struct fe_priv *np = netdev_priv(dev); | 1450 | struct fe_priv *np = netdev_priv(dev); |
1344 | u32 Flags; | 1451 | u32 Flags; |
1452 | u32 vlanflags = 0; | ||
1453 | |||
1345 | 1454 | ||
1346 | for (;;) { | 1455 | for (;;) { |
1347 | struct sk_buff *skb; | 1456 | struct sk_buff *skb; |
@@ -1357,6 +1466,7 @@ static void nv_rx_process(struct net_device *dev) | |||
1357 | } else { | 1466 | } else { |
1358 | Flags = le32_to_cpu(np->rx_ring.ex[i].FlagLen); | 1467 | Flags = le32_to_cpu(np->rx_ring.ex[i].FlagLen); |
1359 | len = nv_descr_getlength_ex(&np->rx_ring.ex[i], np->desc_ver); | 1468 | len = nv_descr_getlength_ex(&np->rx_ring.ex[i], np->desc_ver); |
1469 | vlanflags = le32_to_cpu(np->rx_ring.ex[i].PacketBufferLow); | ||
1360 | } | 1470 | } |
1361 | 1471 | ||
1362 | dprintk(KERN_DEBUG "%s: nv_rx_process: looking at packet %d, Flags 0x%x.\n", | 1472 | dprintk(KERN_DEBUG "%s: nv_rx_process: looking at packet %d, Flags 0x%x.\n", |
@@ -1474,7 +1584,11 @@ static void nv_rx_process(struct net_device *dev) | |||
1474 | skb->protocol = eth_type_trans(skb, dev); | 1584 | skb->protocol = eth_type_trans(skb, dev); |
1475 | dprintk(KERN_DEBUG "%s: nv_rx_process: packet %d with %d bytes, proto %d accepted.\n", | 1585 | dprintk(KERN_DEBUG "%s: nv_rx_process: packet %d with %d bytes, proto %d accepted.\n", |
1476 | dev->name, np->cur_rx, len, skb->protocol); | 1586 | dev->name, np->cur_rx, len, skb->protocol); |
1477 | netif_rx(skb); | 1587 | if (np->vlangrp && (vlanflags & NV_RX3_VLAN_TAG_PRESENT)) { |
1588 | vlan_hwaccel_rx(skb, np->vlangrp, vlanflags & NV_RX3_VLAN_TAG_MASK); | ||
1589 | } else { | ||
1590 | netif_rx(skb); | ||
1591 | } | ||
1478 | dev->last_rx = jiffies; | 1592 | dev->last_rx = jiffies; |
1479 | np->stats.rx_packets++; | 1593 | np->stats.rx_packets++; |
1480 | np->stats.rx_bytes += len; | 1594 | np->stats.rx_bytes += len; |
@@ -1523,7 +1637,15 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu) | |||
1523 | * guessed, there is probably a simpler approach. | 1637 | * guessed, there is probably a simpler approach. |
1524 | * Changing the MTU is a rare event, it shouldn't matter. | 1638 | * Changing the MTU is a rare event, it shouldn't matter. |
1525 | */ | 1639 | */ |
1526 | disable_irq(dev->irq); | 1640 | if (!(np->msi_flags & NV_MSI_X_ENABLED) || |
1641 | ((np->msi_flags & NV_MSI_X_ENABLED) && | ||
1642 | ((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))) { | ||
1643 | disable_irq(dev->irq); | ||
1644 | } else { | ||
1645 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | ||
1646 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); | ||
1647 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); | ||
1648 | } | ||
1527 | spin_lock_bh(&dev->xmit_lock); | 1649 | spin_lock_bh(&dev->xmit_lock); |
1528 | spin_lock(&np->lock); | 1650 | spin_lock(&np->lock); |
1529 | /* stop engines */ | 1651 | /* stop engines */ |
@@ -1544,11 +1666,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu) | |||
1544 | } | 1666 | } |
1545 | /* reinit nic view of the rx queue */ | 1667 | /* reinit nic view of the rx queue */ |
1546 | writel(np->rx_buf_sz, base + NvRegOffloadConfig); | 1668 | writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
1547 | writel((u32) np->ring_addr, base + NvRegRxRingPhysAddr); | 1669 | setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
1548 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | ||
1549 | writel((u32) (np->ring_addr + RX_RING*sizeof(struct ring_desc)), base + NvRegTxRingPhysAddr); | ||
1550 | else | ||
1551 | writel((u32) (np->ring_addr + RX_RING*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddr); | ||
1552 | writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), | 1670 | writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), |
1553 | base + NvRegRingSizes); | 1671 | base + NvRegRingSizes); |
1554 | pci_push(base); | 1672 | pci_push(base); |
@@ -1560,7 +1678,15 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu) | |||
1560 | nv_start_tx(dev); | 1678 | nv_start_tx(dev); |
1561 | spin_unlock(&np->lock); | 1679 | spin_unlock(&np->lock); |
1562 | spin_unlock_bh(&dev->xmit_lock); | 1680 | spin_unlock_bh(&dev->xmit_lock); |
1563 | enable_irq(dev->irq); | 1681 | if (!(np->msi_flags & NV_MSI_X_ENABLED) || |
1682 | ((np->msi_flags & NV_MSI_X_ENABLED) && | ||
1683 | ((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))) { | ||
1684 | enable_irq(dev->irq); | ||
1685 | } else { | ||
1686 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | ||
1687 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); | ||
1688 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); | ||
1689 | } | ||
1564 | } | 1690 | } |
1565 | return 0; | 1691 | return 0; |
1566 | } | 1692 | } |
@@ -1866,8 +1992,13 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | |||
1866 | dprintk(KERN_DEBUG "%s: nv_nic_irq\n", dev->name); | 1992 | dprintk(KERN_DEBUG "%s: nv_nic_irq\n", dev->name); |
1867 | 1993 | ||
1868 | for (i=0; ; i++) { | 1994 | for (i=0; ; i++) { |
1869 | events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; | 1995 | if (!(np->msi_flags & NV_MSI_X_ENABLED)) { |
1870 | writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); | 1996 | events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; |
1997 | writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); | ||
1998 | } else { | ||
1999 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; | ||
2000 | writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus); | ||
2001 | } | ||
1871 | pci_push(base); | 2002 | pci_push(base); |
1872 | dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); | 2003 | dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); |
1873 | if (!(events & np->irqmask)) | 2004 | if (!(events & np->irqmask)) |
@@ -1907,11 +2038,16 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | |||
1907 | if (i > max_interrupt_work) { | 2038 | if (i > max_interrupt_work) { |
1908 | spin_lock(&np->lock); | 2039 | spin_lock(&np->lock); |
1909 | /* disable interrupts on the nic */ | 2040 | /* disable interrupts on the nic */ |
1910 | writel(0, base + NvRegIrqMask); | 2041 | if (!(np->msi_flags & NV_MSI_X_ENABLED)) |
2042 | writel(0, base + NvRegIrqMask); | ||
2043 | else | ||
2044 | writel(np->irqmask, base + NvRegIrqMask); | ||
1911 | pci_push(base); | 2045 | pci_push(base); |
1912 | 2046 | ||
1913 | if (!np->in_shutdown) | 2047 | if (!np->in_shutdown) { |
2048 | np->nic_poll_irq = np->irqmask; | ||
1914 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); | 2049 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
2050 | } | ||
1915 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i); | 2051 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i); |
1916 | spin_unlock(&np->lock); | 2052 | spin_unlock(&np->lock); |
1917 | break; | 2053 | break; |
@@ -1923,22 +2059,212 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | |||
1923 | return IRQ_RETVAL(i); | 2059 | return IRQ_RETVAL(i); |
1924 | } | 2060 | } |
1925 | 2061 | ||
2062 | static irqreturn_t nv_nic_irq_tx(int foo, void *data, struct pt_regs *regs) | ||
2063 | { | ||
2064 | struct net_device *dev = (struct net_device *) data; | ||
2065 | struct fe_priv *np = netdev_priv(dev); | ||
2066 | u8 __iomem *base = get_hwbase(dev); | ||
2067 | u32 events; | ||
2068 | int i; | ||
2069 | |||
2070 | dprintk(KERN_DEBUG "%s: nv_nic_irq_tx\n", dev->name); | ||
2071 | |||
2072 | for (i=0; ; i++) { | ||
2073 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_TX_ALL; | ||
2074 | writel(NVREG_IRQ_TX_ALL, base + NvRegMSIXIrqStatus); | ||
2075 | pci_push(base); | ||
2076 | dprintk(KERN_DEBUG "%s: tx irq: %08x\n", dev->name, events); | ||
2077 | if (!(events & np->irqmask)) | ||
2078 | break; | ||
2079 | |||
2080 | spin_lock(&np->lock); | ||
2081 | nv_tx_done(dev); | ||
2082 | spin_unlock(&np->lock); | ||
2083 | |||
2084 | if (events & (NVREG_IRQ_TX_ERR)) { | ||
2085 | dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably TX fail.\n", | ||
2086 | dev->name, events); | ||
2087 | } | ||
2088 | if (i > max_interrupt_work) { | ||
2089 | spin_lock(&np->lock); | ||
2090 | /* disable interrupts on the nic */ | ||
2091 | writel(NVREG_IRQ_TX_ALL, base + NvRegIrqMask); | ||
2092 | pci_push(base); | ||
2093 | |||
2094 | if (!np->in_shutdown) { | ||
2095 | np->nic_poll_irq |= NVREG_IRQ_TX_ALL; | ||
2096 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); | ||
2097 | } | ||
2098 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_tx.\n", dev->name, i); | ||
2099 | spin_unlock(&np->lock); | ||
2100 | break; | ||
2101 | } | ||
2102 | |||
2103 | } | ||
2104 | dprintk(KERN_DEBUG "%s: nv_nic_irq_tx completed\n", dev->name); | ||
2105 | |||
2106 | return IRQ_RETVAL(i); | ||
2107 | } | ||
2108 | |||
2109 | static irqreturn_t nv_nic_irq_rx(int foo, void *data, struct pt_regs *regs) | ||
2110 | { | ||
2111 | struct net_device *dev = (struct net_device *) data; | ||
2112 | struct fe_priv *np = netdev_priv(dev); | ||
2113 | u8 __iomem *base = get_hwbase(dev); | ||
2114 | u32 events; | ||
2115 | int i; | ||
2116 | |||
2117 | dprintk(KERN_DEBUG "%s: nv_nic_irq_rx\n", dev->name); | ||
2118 | |||
2119 | for (i=0; ; i++) { | ||
2120 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; | ||
2121 | writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus); | ||
2122 | pci_push(base); | ||
2123 | dprintk(KERN_DEBUG "%s: rx irq: %08x\n", dev->name, events); | ||
2124 | if (!(events & np->irqmask)) | ||
2125 | break; | ||
2126 | |||
2127 | nv_rx_process(dev); | ||
2128 | if (nv_alloc_rx(dev)) { | ||
2129 | spin_lock(&np->lock); | ||
2130 | if (!np->in_shutdown) | ||
2131 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
2132 | spin_unlock(&np->lock); | ||
2133 | } | ||
2134 | |||
2135 | if (i > max_interrupt_work) { | ||
2136 | spin_lock(&np->lock); | ||
2137 | /* disable interrupts on the nic */ | ||
2138 | writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); | ||
2139 | pci_push(base); | ||
2140 | |||
2141 | if (!np->in_shutdown) { | ||
2142 | np->nic_poll_irq |= NVREG_IRQ_RX_ALL; | ||
2143 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); | ||
2144 | } | ||
2145 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_rx.\n", dev->name, i); | ||
2146 | spin_unlock(&np->lock); | ||
2147 | break; | ||
2148 | } | ||
2149 | |||
2150 | } | ||
2151 | dprintk(KERN_DEBUG "%s: nv_nic_irq_rx completed\n", dev->name); | ||
2152 | |||
2153 | return IRQ_RETVAL(i); | ||
2154 | } | ||
2155 | |||
2156 | static irqreturn_t nv_nic_irq_other(int foo, void *data, struct pt_regs *regs) | ||
2157 | { | ||
2158 | struct net_device *dev = (struct net_device *) data; | ||
2159 | struct fe_priv *np = netdev_priv(dev); | ||
2160 | u8 __iomem *base = get_hwbase(dev); | ||
2161 | u32 events; | ||
2162 | int i; | ||
2163 | |||
2164 | dprintk(KERN_DEBUG "%s: nv_nic_irq_other\n", dev->name); | ||
2165 | |||
2166 | for (i=0; ; i++) { | ||
2167 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_OTHER; | ||
2168 | writel(NVREG_IRQ_OTHER, base + NvRegMSIXIrqStatus); | ||
2169 | pci_push(base); | ||
2170 | dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); | ||
2171 | if (!(events & np->irqmask)) | ||
2172 | break; | ||
2173 | |||
2174 | if (events & NVREG_IRQ_LINK) { | ||
2175 | spin_lock(&np->lock); | ||
2176 | nv_link_irq(dev); | ||
2177 | spin_unlock(&np->lock); | ||
2178 | } | ||
2179 | if (np->need_linktimer && time_after(jiffies, np->link_timeout)) { | ||
2180 | spin_lock(&np->lock); | ||
2181 | nv_linkchange(dev); | ||
2182 | spin_unlock(&np->lock); | ||
2183 | np->link_timeout = jiffies + LINK_TIMEOUT; | ||
2184 | } | ||
2185 | if (events & (NVREG_IRQ_UNKNOWN)) { | ||
2186 | printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n", | ||
2187 | dev->name, events); | ||
2188 | } | ||
2189 | if (i > max_interrupt_work) { | ||
2190 | spin_lock(&np->lock); | ||
2191 | /* disable interrupts on the nic */ | ||
2192 | writel(NVREG_IRQ_OTHER, base + NvRegIrqMask); | ||
2193 | pci_push(base); | ||
2194 | |||
2195 | if (!np->in_shutdown) { | ||
2196 | np->nic_poll_irq |= NVREG_IRQ_OTHER; | ||
2197 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); | ||
2198 | } | ||
2199 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_other.\n", dev->name, i); | ||
2200 | spin_unlock(&np->lock); | ||
2201 | break; | ||
2202 | } | ||
2203 | |||
2204 | } | ||
2205 | dprintk(KERN_DEBUG "%s: nv_nic_irq_other completed\n", dev->name); | ||
2206 | |||
2207 | return IRQ_RETVAL(i); | ||
2208 | } | ||
2209 | |||
1926 | static void nv_do_nic_poll(unsigned long data) | 2210 | static void nv_do_nic_poll(unsigned long data) |
1927 | { | 2211 | { |
1928 | struct net_device *dev = (struct net_device *) data; | 2212 | struct net_device *dev = (struct net_device *) data; |
1929 | struct fe_priv *np = netdev_priv(dev); | 2213 | struct fe_priv *np = netdev_priv(dev); |
1930 | u8 __iomem *base = get_hwbase(dev); | 2214 | u8 __iomem *base = get_hwbase(dev); |
2215 | u32 mask = 0; | ||
1931 | 2216 | ||
1932 | disable_irq(dev->irq); | ||
1933 | /* FIXME: Do we need synchronize_irq(dev->irq) here? */ | ||
1934 | /* | 2217 | /* |
2218 | * First disable irq(s) and then | ||
1935 | * reenable interrupts on the nic, we have to do this before calling | 2219 | * reenable interrupts on the nic, we have to do this before calling |
1936 | * nv_nic_irq because that may decide to do otherwise | 2220 | * nv_nic_irq because that may decide to do otherwise |
1937 | */ | 2221 | */ |
1938 | writel(np->irqmask, base + NvRegIrqMask); | 2222 | |
2223 | if (!(np->msi_flags & NV_MSI_X_ENABLED) || | ||
2224 | ((np->msi_flags & NV_MSI_X_ENABLED) && | ||
2225 | ((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))) { | ||
2226 | disable_irq(dev->irq); | ||
2227 | mask = np->irqmask; | ||
2228 | } else { | ||
2229 | if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { | ||
2230 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | ||
2231 | mask |= NVREG_IRQ_RX_ALL; | ||
2232 | } | ||
2233 | if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) { | ||
2234 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); | ||
2235 | mask |= NVREG_IRQ_TX_ALL; | ||
2236 | } | ||
2237 | if (np->nic_poll_irq & NVREG_IRQ_OTHER) { | ||
2238 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); | ||
2239 | mask |= NVREG_IRQ_OTHER; | ||
2240 | } | ||
2241 | } | ||
2242 | np->nic_poll_irq = 0; | ||
2243 | |||
2244 | /* FIXME: Do we need synchronize_irq(dev->irq) here? */ | ||
2245 | |||
2246 | writel(mask, base + NvRegIrqMask); | ||
1939 | pci_push(base); | 2247 | pci_push(base); |
1940 | nv_nic_irq((int) 0, (void *) data, (struct pt_regs *) NULL); | 2248 | |
1941 | enable_irq(dev->irq); | 2249 | if (!(np->msi_flags & NV_MSI_X_ENABLED) || |
2250 | ((np->msi_flags & NV_MSI_X_ENABLED) && | ||
2251 | ((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))) { | ||
2252 | nv_nic_irq((int) 0, (void *) data, (struct pt_regs *) NULL); | ||
2253 | enable_irq(dev->irq); | ||
2254 | } else { | ||
2255 | if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { | ||
2256 | nv_nic_irq_rx((int) 0, (void *) data, (struct pt_regs *) NULL); | ||
2257 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | ||
2258 | } | ||
2259 | if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) { | ||
2260 | nv_nic_irq_tx((int) 0, (void *) data, (struct pt_regs *) NULL); | ||
2261 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); | ||
2262 | } | ||
2263 | if (np->nic_poll_irq & NVREG_IRQ_OTHER) { | ||
2264 | nv_nic_irq_other((int) 0, (void *) data, (struct pt_regs *) NULL); | ||
2265 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); | ||
2266 | } | ||
2267 | } | ||
1942 | } | 2268 | } |
1943 | 2269 | ||
1944 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2270 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -2217,11 +2543,66 @@ static struct ethtool_ops ops = { | |||
2217 | .get_perm_addr = ethtool_op_get_perm_addr, | 2543 | .get_perm_addr = ethtool_op_get_perm_addr, |
2218 | }; | 2544 | }; |
2219 | 2545 | ||
2546 | static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | ||
2547 | { | ||
2548 | struct fe_priv *np = get_nvpriv(dev); | ||
2549 | |||
2550 | spin_lock_irq(&np->lock); | ||
2551 | |||
2552 | /* save vlan group */ | ||
2553 | np->vlangrp = grp; | ||
2554 | |||
2555 | if (grp) { | ||
2556 | /* enable vlan on MAC */ | ||
2557 | np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP | NVREG_TXRXCTL_VLANINS; | ||
2558 | } else { | ||
2559 | /* disable vlan on MAC */ | ||
2560 | np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP; | ||
2561 | np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS; | ||
2562 | } | ||
2563 | |||
2564 | writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); | ||
2565 | |||
2566 | spin_unlock_irq(&np->lock); | ||
2567 | }; | ||
2568 | |||
2569 | static void nv_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | ||
2570 | { | ||
2571 | /* nothing to do */ | ||
2572 | }; | ||
2573 | |||
2574 | static void set_msix_vector_map(struct net_device *dev, u32 vector, u32 irqmask) | ||
2575 | { | ||
2576 | u8 __iomem *base = get_hwbase(dev); | ||
2577 | int i; | ||
2578 | u32 msixmap = 0; | ||
2579 | |||
2580 | /* Each interrupt bit can be mapped to a MSIX vector (4 bits). | ||
2581 | * MSIXMap0 represents the first 8 interrupts and MSIXMap1 represents | ||
2582 | * the remaining 8 interrupts. | ||
2583 | */ | ||
2584 | for (i = 0; i < 8; i++) { | ||
2585 | if ((irqmask >> i) & 0x1) { | ||
2586 | msixmap |= vector << (i << 2); | ||
2587 | } | ||
2588 | } | ||
2589 | writel(readl(base + NvRegMSIXMap0) | msixmap, base + NvRegMSIXMap0); | ||
2590 | |||
2591 | msixmap = 0; | ||
2592 | for (i = 0; i < 8; i++) { | ||
2593 | if ((irqmask >> (i + 8)) & 0x1) { | ||
2594 | msixmap |= vector << (i << 2); | ||
2595 | } | ||
2596 | } | ||
2597 | writel(readl(base + NvRegMSIXMap1) | msixmap, base + NvRegMSIXMap1); | ||
2598 | } | ||
2599 | |||
2220 | static int nv_open(struct net_device *dev) | 2600 | static int nv_open(struct net_device *dev) |
2221 | { | 2601 | { |
2222 | struct fe_priv *np = netdev_priv(dev); | 2602 | struct fe_priv *np = netdev_priv(dev); |
2223 | u8 __iomem *base = get_hwbase(dev); | 2603 | u8 __iomem *base = get_hwbase(dev); |
2224 | int ret, oom, i; | 2604 | int ret = 1; |
2605 | int oom, i; | ||
2225 | 2606 | ||
2226 | dprintk(KERN_DEBUG "nv_open: begin\n"); | 2607 | dprintk(KERN_DEBUG "nv_open: begin\n"); |
2227 | 2608 | ||
@@ -2253,11 +2634,7 @@ static int nv_open(struct net_device *dev) | |||
2253 | nv_copy_mac_to_hw(dev); | 2634 | nv_copy_mac_to_hw(dev); |
2254 | 2635 | ||
2255 | /* 4) give hw rings */ | 2636 | /* 4) give hw rings */ |
2256 | writel((u32) np->ring_addr, base + NvRegRxRingPhysAddr); | 2637 | setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
2257 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | ||
2258 | writel((u32) (np->ring_addr + RX_RING*sizeof(struct ring_desc)), base + NvRegTxRingPhysAddr); | ||
2259 | else | ||
2260 | writel((u32) (np->ring_addr + RX_RING*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddr); | ||
2261 | writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), | 2638 | writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), |
2262 | base + NvRegRingSizes); | 2639 | base + NvRegRingSizes); |
2263 | 2640 | ||
@@ -2265,6 +2642,7 @@ static int nv_open(struct net_device *dev) | |||
2265 | writel(np->linkspeed, base + NvRegLinkSpeed); | 2642 | writel(np->linkspeed, base + NvRegLinkSpeed); |
2266 | writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); | 2643 | writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); |
2267 | writel(np->txrxctl_bits, base + NvRegTxRxControl); | 2644 | writel(np->txrxctl_bits, base + NvRegTxRxControl); |
2645 | writel(np->vlanctl_bits, base + NvRegVlanControl); | ||
2268 | pci_push(base); | 2646 | pci_push(base); |
2269 | writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl); | 2647 | writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl); |
2270 | reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31, | 2648 | reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31, |
@@ -2315,9 +2693,77 @@ static int nv_open(struct net_device *dev) | |||
2315 | writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); | 2693 | writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
2316 | pci_push(base); | 2694 | pci_push(base); |
2317 | 2695 | ||
2318 | ret = request_irq(dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev); | 2696 | if (np->msi_flags & NV_MSI_X_CAPABLE) { |
2319 | if (ret) | 2697 | for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { |
2320 | goto out_drain; | 2698 | np->msi_x_entry[i].entry = i; |
2699 | } | ||
2700 | if ((ret = pci_enable_msix(np->pci_dev, np->msi_x_entry, (np->msi_flags & NV_MSI_X_VECTORS_MASK))) == 0) { | ||
2701 | np->msi_flags |= NV_MSI_X_ENABLED; | ||
2702 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) { | ||
2703 | /* Request irq for rx handling */ | ||
2704 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) { | ||
2705 | printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret); | ||
2706 | pci_disable_msix(np->pci_dev); | ||
2707 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2708 | goto out_drain; | ||
2709 | } | ||
2710 | /* Request irq for tx handling */ | ||
2711 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) { | ||
2712 | printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret); | ||
2713 | pci_disable_msix(np->pci_dev); | ||
2714 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2715 | goto out_drain; | ||
2716 | } | ||
2717 | /* Request irq for link and timer handling */ | ||
2718 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) { | ||
2719 | printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret); | ||
2720 | pci_disable_msix(np->pci_dev); | ||
2721 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2722 | goto out_drain; | ||
2723 | } | ||
2724 | |||
2725 | /* map interrupts to their respective vector */ | ||
2726 | writel(0, base + NvRegMSIXMap0); | ||
2727 | writel(0, base + NvRegMSIXMap1); | ||
2728 | set_msix_vector_map(dev, NV_MSI_X_VECTOR_RX, NVREG_IRQ_RX_ALL); | ||
2729 | set_msix_vector_map(dev, NV_MSI_X_VECTOR_TX, NVREG_IRQ_TX_ALL); | ||
2730 | set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, NVREG_IRQ_OTHER); | ||
2731 | } else { | ||
2732 | /* Request irq for all interrupts */ | ||
2733 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) { | ||
2734 | printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); | ||
2735 | pci_disable_msix(np->pci_dev); | ||
2736 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2737 | goto out_drain; | ||
2738 | } | ||
2739 | |||
2740 | /* map interrupts to vector 0 */ | ||
2741 | writel(0, base + NvRegMSIXMap0); | ||
2742 | writel(0, base + NvRegMSIXMap1); | ||
2743 | } | ||
2744 | } | ||
2745 | } | ||
2746 | if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { | ||
2747 | if ((ret = pci_enable_msi(np->pci_dev)) == 0) { | ||
2748 | np->msi_flags |= NV_MSI_ENABLED; | ||
2749 | if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) { | ||
2750 | printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); | ||
2751 | pci_disable_msi(np->pci_dev); | ||
2752 | np->msi_flags &= ~NV_MSI_ENABLED; | ||
2753 | goto out_drain; | ||
2754 | } | ||
2755 | |||
2756 | /* map interrupts to vector 0 */ | ||
2757 | writel(0, base + NvRegMSIMap0); | ||
2758 | writel(0, base + NvRegMSIMap1); | ||
2759 | /* enable msi vector 0 */ | ||
2760 | writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask); | ||
2761 | } | ||
2762 | } | ||
2763 | if (ret != 0) { | ||
2764 | if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) | ||
2765 | goto out_drain; | ||
2766 | } | ||
2321 | 2767 | ||
2322 | /* ask for interrupts */ | 2768 | /* ask for interrupts */ |
2323 | writel(np->irqmask, base + NvRegIrqMask); | 2769 | writel(np->irqmask, base + NvRegIrqMask); |
@@ -2364,6 +2810,7 @@ static int nv_close(struct net_device *dev) | |||
2364 | { | 2810 | { |
2365 | struct fe_priv *np = netdev_priv(dev); | 2811 | struct fe_priv *np = netdev_priv(dev); |
2366 | u8 __iomem *base; | 2812 | u8 __iomem *base; |
2813 | int i; | ||
2367 | 2814 | ||
2368 | spin_lock_irq(&np->lock); | 2815 | spin_lock_irq(&np->lock); |
2369 | np->in_shutdown = 1; | 2816 | np->in_shutdown = 1; |
@@ -2381,13 +2828,31 @@ static int nv_close(struct net_device *dev) | |||
2381 | 2828 | ||
2382 | /* disable interrupts on the nic or we will lock up */ | 2829 | /* disable interrupts on the nic or we will lock up */ |
2383 | base = get_hwbase(dev); | 2830 | base = get_hwbase(dev); |
2384 | writel(0, base + NvRegIrqMask); | 2831 | if (np->msi_flags & NV_MSI_X_ENABLED) { |
2832 | writel(np->irqmask, base + NvRegIrqMask); | ||
2833 | } else { | ||
2834 | if (np->msi_flags & NV_MSI_ENABLED) | ||
2835 | writel(0, base + NvRegMSIIrqMask); | ||
2836 | writel(0, base + NvRegIrqMask); | ||
2837 | } | ||
2385 | pci_push(base); | 2838 | pci_push(base); |
2386 | dprintk(KERN_INFO "%s: Irqmask is zero again\n", dev->name); | 2839 | dprintk(KERN_INFO "%s: Irqmask is zero again\n", dev->name); |
2387 | 2840 | ||
2388 | spin_unlock_irq(&np->lock); | 2841 | spin_unlock_irq(&np->lock); |
2389 | 2842 | ||
2390 | free_irq(dev->irq, dev); | 2843 | if (np->msi_flags & NV_MSI_X_ENABLED) { |
2844 | for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { | ||
2845 | free_irq(np->msi_x_entry[i].vector, dev); | ||
2846 | } | ||
2847 | pci_disable_msix(np->pci_dev); | ||
2848 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2849 | } else { | ||
2850 | free_irq(np->pci_dev->irq, dev); | ||
2851 | if (np->msi_flags & NV_MSI_ENABLED) { | ||
2852 | pci_disable_msi(np->pci_dev); | ||
2853 | np->msi_flags &= ~NV_MSI_ENABLED; | ||
2854 | } | ||
2855 | } | ||
2391 | 2856 | ||
2392 | drain_ring(dev); | 2857 | drain_ring(dev); |
2393 | 2858 | ||
@@ -2471,7 +2936,14 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2471 | printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", | 2936 | printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", |
2472 | pci_name(pci_dev)); | 2937 | pci_name(pci_dev)); |
2473 | } else { | 2938 | } else { |
2474 | dev->features |= NETIF_F_HIGHDMA; | 2939 | if (pci_set_consistent_dma_mask(pci_dev, 0x0000007fffffffffULL)) { |
2940 | printk(KERN_INFO "forcedeth: 64-bit DMA (consistent) failed for device %s.\n", | ||
2941 | pci_name(pci_dev)); | ||
2942 | goto out_relreg; | ||
2943 | } else { | ||
2944 | dev->features |= NETIF_F_HIGHDMA; | ||
2945 | printk(KERN_INFO "forcedeth: using HIGHDMA\n"); | ||
2946 | } | ||
2475 | } | 2947 | } |
2476 | np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; | 2948 | np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; |
2477 | } else if (id->driver_data & DEV_HAS_LARGEDESC) { | 2949 | } else if (id->driver_data & DEV_HAS_LARGEDESC) { |
@@ -2496,6 +2968,22 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2496 | #endif | 2968 | #endif |
2497 | } | 2969 | } |
2498 | 2970 | ||
2971 | np->vlanctl_bits = 0; | ||
2972 | if (id->driver_data & DEV_HAS_VLAN) { | ||
2973 | np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; | ||
2974 | dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX; | ||
2975 | dev->vlan_rx_register = nv_vlan_rx_register; | ||
2976 | dev->vlan_rx_kill_vid = nv_vlan_rx_kill_vid; | ||
2977 | } | ||
2978 | |||
2979 | np->msi_flags = 0; | ||
2980 | if ((id->driver_data & DEV_HAS_MSI) && !disable_msi) { | ||
2981 | np->msi_flags |= NV_MSI_CAPABLE; | ||
2982 | } | ||
2983 | if ((id->driver_data & DEV_HAS_MSI_X) && !disable_msix) { | ||
2984 | np->msi_flags |= NV_MSI_X_CAPABLE; | ||
2985 | } | ||
2986 | |||
2499 | err = -ENOMEM; | 2987 | err = -ENOMEM; |
2500 | np->base = ioremap(addr, NV_PCI_REGSZ); | 2988 | np->base = ioremap(addr, NV_PCI_REGSZ); |
2501 | if (!np->base) | 2989 | if (!np->base) |
@@ -2578,10 +3066,15 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2578 | } else { | 3066 | } else { |
2579 | np->tx_flags = NV_TX2_VALID; | 3067 | np->tx_flags = NV_TX2_VALID; |
2580 | } | 3068 | } |
2581 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) | 3069 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) { |
2582 | np->irqmask = NVREG_IRQMASK_THROUGHPUT; | 3070 | np->irqmask = NVREG_IRQMASK_THROUGHPUT; |
2583 | else | 3071 | if (np->msi_flags & NV_MSI_X_CAPABLE) /* set number of vectors */ |
3072 | np->msi_flags |= 0x0003; | ||
3073 | } else { | ||
2584 | np->irqmask = NVREG_IRQMASK_CPU; | 3074 | np->irqmask = NVREG_IRQMASK_CPU; |
3075 | if (np->msi_flags & NV_MSI_X_CAPABLE) /* set number of vectors */ | ||
3076 | np->msi_flags |= 0x0001; | ||
3077 | } | ||
2585 | 3078 | ||
2586 | if (id->driver_data & DEV_NEED_TIMERIRQ) | 3079 | if (id->driver_data & DEV_NEED_TIMERIRQ) |
2587 | np->irqmask |= NVREG_IRQ_TIMER; | 3080 | np->irqmask |= NVREG_IRQ_TIMER; |
@@ -2737,11 +3230,11 @@ static struct pci_device_id pci_tbl[] = { | |||
2737 | }, | 3230 | }, |
2738 | { /* MCP55 Ethernet Controller */ | 3231 | { /* MCP55 Ethernet Controller */ |
2739 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), | 3232 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), |
2740 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, | 3233 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X, |
2741 | }, | 3234 | }, |
2742 | { /* MCP55 Ethernet Controller */ | 3235 | { /* MCP55 Ethernet Controller */ |
2743 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), | 3236 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), |
2744 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, | 3237 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X, |
2745 | }, | 3238 | }, |
2746 | {0,}, | 3239 | {0,}, |
2747 | }; | 3240 | }; |
@@ -2771,6 +3264,10 @@ module_param(optimization_mode, int, 0); | |||
2771 | MODULE_PARM_DESC(optimization_mode, "In throughput mode (0), every tx & rx packet will generate an interrupt. In CPU mode (1), interrupts are controlled by a timer."); | 3264 | MODULE_PARM_DESC(optimization_mode, "In throughput mode (0), every tx & rx packet will generate an interrupt. In CPU mode (1), interrupts are controlled by a timer."); |
2772 | module_param(poll_interval, int, 0); | 3265 | module_param(poll_interval, int, 0); |
2773 | MODULE_PARM_DESC(poll_interval, "Interval determines how frequent timer interrupt is generated by [(time_in_micro_secs * 100) / (2^10)]. Min is 0 and Max is 65535."); | 3266 | MODULE_PARM_DESC(poll_interval, "Interval determines how frequent timer interrupt is generated by [(time_in_micro_secs * 100) / (2^10)]. Min is 0 and Max is 65535."); |
3267 | module_param(disable_msi, int, 0); | ||
3268 | MODULE_PARM_DESC(disable_msi, "Disable MSI interrupts by setting to 1."); | ||
3269 | module_param(disable_msix, int, 0); | ||
3270 | MODULE_PARM_DESC(disable_msix, "Disable MSIX interrupts by setting to 1."); | ||
2774 | 3271 | ||
2775 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); | 3272 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); |
2776 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); | 3273 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); |
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index e4188d082f01..9220de9f4fe7 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c | |||
@@ -905,7 +905,7 @@ static int epp_open(struct net_device *dev) | |||
905 | /* autoprobe baud rate */ | 905 | /* autoprobe baud rate */ |
906 | tstart = jiffies; | 906 | tstart = jiffies; |
907 | i = 0; | 907 | i = 0; |
908 | while ((signed)(jiffies-tstart-HZ/3) < 0) { | 908 | while (time_before(jiffies, tstart + HZ/3)) { |
909 | if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1) | 909 | if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1) |
910 | goto epptimeout; | 910 | goto epptimeout; |
911 | if ((stat & (EPP_NRAEF|EPP_NRHF)) == EPP_NRHF) { | 911 | if ((stat & (EPP_NRAEF|EPP_NRHF)) == EPP_NRHF) { |
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index 55c7ed608391..247c8ca86033 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -115,6 +115,7 @@ | |||
115 | #include <linux/delay.h> | 115 | #include <linux/delay.h> |
116 | #include <linux/init.h> | 116 | #include <linux/init.h> |
117 | #include <linux/bitops.h> | 117 | #include <linux/bitops.h> |
118 | #include <linux/jiffies.h> | ||
118 | 119 | ||
119 | #include <asm/io.h> | 120 | #include <asm/io.h> |
120 | 121 | ||
@@ -1499,7 +1500,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) | |||
1499 | printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name); | 1500 | printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name); |
1500 | #endif | 1501 | #endif |
1501 | /* not waited long enough since last tx? */ | 1502 | /* not waited long enough since last tx? */ |
1502 | if (jiffies - dev->trans_start < HZ) | 1503 | if (time_before(jiffies, dev->trans_start + HZ)) |
1503 | return -EAGAIN; | 1504 | return -EAGAIN; |
1504 | 1505 | ||
1505 | if (hp100_check_lan(dev)) | 1506 | if (hp100_check_lan(dev)) |
@@ -1652,7 +1653,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1652 | printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i); | 1653 | printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i); |
1653 | #endif | 1654 | #endif |
1654 | /* not waited long enough since last failed tx try? */ | 1655 | /* not waited long enough since last failed tx try? */ |
1655 | if (jiffies - dev->trans_start < HZ) { | 1656 | if (time_before(jiffies, dev->trans_start + HZ)) { |
1656 | #ifdef HP100_DEBUG | 1657 | #ifdef HP100_DEBUG |
1657 | printk("hp100: %s: trans_start timing problem\n", | 1658 | printk("hp100: %s: trans_start timing problem\n", |
1658 | dev->name); | 1659 | dev->name); |
@@ -1718,17 +1719,10 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1718 | hp100_outw(i, FRAGMENT_LEN); /* and first/only fragment length */ | 1719 | hp100_outw(i, FRAGMENT_LEN); /* and first/only fragment length */ |
1719 | 1720 | ||
1720 | if (lp->mode == 2) { /* memory mapped */ | 1721 | if (lp->mode == 2) { /* memory mapped */ |
1721 | if (lp->mem_ptr_virt) { /* high pci memory was remapped */ | 1722 | /* Note: The J2585B needs alignment to 32bits here! */ |
1722 | /* Note: The J2585B needs alignment to 32bits here! */ | 1723 | memcpy_toio(lp->mem_ptr_virt, skb->data, (skb->len + 3) & ~3); |
1723 | memcpy_toio(lp->mem_ptr_virt, skb->data, (skb->len + 3) & ~3); | 1724 | if (!ok_flag) |
1724 | if (!ok_flag) | 1725 | memset_io(lp->mem_ptr_virt, 0, HP100_MIN_PACKET_SIZE - skb->len); |
1725 | memset_io(lp->mem_ptr_virt, 0, HP100_MIN_PACKET_SIZE - skb->len); | ||
1726 | } else { | ||
1727 | /* Note: The J2585B needs alignment to 32bits here! */ | ||
1728 | isa_memcpy_toio(lp->mem_ptr_phys, skb->data, (skb->len + 3) & ~3); | ||
1729 | if (!ok_flag) | ||
1730 | isa_memset_io(lp->mem_ptr_phys, 0, HP100_MIN_PACKET_SIZE - skb->len); | ||
1731 | } | ||
1732 | } else { /* programmed i/o */ | 1726 | } else { /* programmed i/o */ |
1733 | outsl(ioaddr + HP100_REG_DATA32, skb->data, | 1727 | outsl(ioaddr + HP100_REG_DATA32, skb->data, |
1734 | (skb->len + 3) >> 2); | 1728 | (skb->len + 3) >> 2); |
@@ -1798,10 +1792,7 @@ static void hp100_rx(struct net_device *dev) | |||
1798 | /* First we get the header, which contains information about the */ | 1792 | /* First we get the header, which contains information about the */ |
1799 | /* actual length of the received packet. */ | 1793 | /* actual length of the received packet. */ |
1800 | if (lp->mode == 2) { /* memory mapped mode */ | 1794 | if (lp->mode == 2) { /* memory mapped mode */ |
1801 | if (lp->mem_ptr_virt) /* if memory was remapped */ | 1795 | header = readl(lp->mem_ptr_virt); |
1802 | header = readl(lp->mem_ptr_virt); | ||
1803 | else | ||
1804 | header = isa_readl(lp->mem_ptr_phys); | ||
1805 | } else /* programmed i/o */ | 1796 | } else /* programmed i/o */ |
1806 | header = hp100_inl(DATA32); | 1797 | header = hp100_inl(DATA32); |
1807 | 1798 | ||
@@ -1833,13 +1824,9 @@ static void hp100_rx(struct net_device *dev) | |||
1833 | ptr = skb->data; | 1824 | ptr = skb->data; |
1834 | 1825 | ||
1835 | /* Now transfer the data from the card into that area */ | 1826 | /* Now transfer the data from the card into that area */ |
1836 | if (lp->mode == 2) { | 1827 | if (lp->mode == 2) |
1837 | if (lp->mem_ptr_virt) | 1828 | memcpy_fromio(ptr, lp->mem_ptr_virt,pkt_len); |
1838 | memcpy_fromio(ptr, lp->mem_ptr_virt,pkt_len); | 1829 | else /* io mapped */ |
1839 | /* Note alignment to 32bit transfers */ | ||
1840 | else | ||
1841 | isa_memcpy_fromio(ptr, lp->mem_ptr_phys, pkt_len); | ||
1842 | } else /* io mapped */ | ||
1843 | insl(ioaddr + HP100_REG_DATA32, ptr, pkt_len >> 2); | 1830 | insl(ioaddr + HP100_REG_DATA32, ptr, pkt_len >> 2); |
1844 | 1831 | ||
1845 | skb->protocol = eth_type_trans(skb, dev); | 1832 | skb->protocol = eth_type_trans(skb, dev); |
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index 591c5864ffb1..7e49522b8b3c 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c | |||
@@ -204,7 +204,7 @@ static inline int emac_phy_gpcs(int phy_mode) | |||
204 | 204 | ||
205 | static inline void emac_tx_enable(struct ocp_enet_private *dev) | 205 | static inline void emac_tx_enable(struct ocp_enet_private *dev) |
206 | { | 206 | { |
207 | struct emac_regs *p = dev->emacp; | 207 | struct emac_regs __iomem *p = dev->emacp; |
208 | unsigned long flags; | 208 | unsigned long flags; |
209 | u32 r; | 209 | u32 r; |
210 | 210 | ||
@@ -220,7 +220,7 @@ static inline void emac_tx_enable(struct ocp_enet_private *dev) | |||
220 | 220 | ||
221 | static void emac_tx_disable(struct ocp_enet_private *dev) | 221 | static void emac_tx_disable(struct ocp_enet_private *dev) |
222 | { | 222 | { |
223 | struct emac_regs *p = dev->emacp; | 223 | struct emac_regs __iomem *p = dev->emacp; |
224 | unsigned long flags; | 224 | unsigned long flags; |
225 | u32 r; | 225 | u32 r; |
226 | 226 | ||
@@ -244,7 +244,7 @@ static void emac_tx_disable(struct ocp_enet_private *dev) | |||
244 | 244 | ||
245 | static void emac_rx_enable(struct ocp_enet_private *dev) | 245 | static void emac_rx_enable(struct ocp_enet_private *dev) |
246 | { | 246 | { |
247 | struct emac_regs *p = dev->emacp; | 247 | struct emac_regs __iomem *p = dev->emacp; |
248 | unsigned long flags; | 248 | unsigned long flags; |
249 | u32 r; | 249 | u32 r; |
250 | 250 | ||
@@ -275,7 +275,7 @@ static void emac_rx_enable(struct ocp_enet_private *dev) | |||
275 | 275 | ||
276 | static void emac_rx_disable(struct ocp_enet_private *dev) | 276 | static void emac_rx_disable(struct ocp_enet_private *dev) |
277 | { | 277 | { |
278 | struct emac_regs *p = dev->emacp; | 278 | struct emac_regs __iomem *p = dev->emacp; |
279 | unsigned long flags; | 279 | unsigned long flags; |
280 | u32 r; | 280 | u32 r; |
281 | 281 | ||
@@ -299,7 +299,7 @@ static void emac_rx_disable(struct ocp_enet_private *dev) | |||
299 | 299 | ||
300 | static inline void emac_rx_disable_async(struct ocp_enet_private *dev) | 300 | static inline void emac_rx_disable_async(struct ocp_enet_private *dev) |
301 | { | 301 | { |
302 | struct emac_regs *p = dev->emacp; | 302 | struct emac_regs __iomem *p = dev->emacp; |
303 | unsigned long flags; | 303 | unsigned long flags; |
304 | u32 r; | 304 | u32 r; |
305 | 305 | ||
@@ -315,7 +315,7 @@ static inline void emac_rx_disable_async(struct ocp_enet_private *dev) | |||
315 | 315 | ||
316 | static int emac_reset(struct ocp_enet_private *dev) | 316 | static int emac_reset(struct ocp_enet_private *dev) |
317 | { | 317 | { |
318 | struct emac_regs *p = dev->emacp; | 318 | struct emac_regs __iomem *p = dev->emacp; |
319 | unsigned long flags; | 319 | unsigned long flags; |
320 | int n = 20; | 320 | int n = 20; |
321 | 321 | ||
@@ -348,7 +348,7 @@ static int emac_reset(struct ocp_enet_private *dev) | |||
348 | 348 | ||
349 | static void emac_hash_mc(struct ocp_enet_private *dev) | 349 | static void emac_hash_mc(struct ocp_enet_private *dev) |
350 | { | 350 | { |
351 | struct emac_regs *p = dev->emacp; | 351 | struct emac_regs __iomem *p = dev->emacp; |
352 | u16 gaht[4] = { 0 }; | 352 | u16 gaht[4] = { 0 }; |
353 | struct dev_mc_list *dmi; | 353 | struct dev_mc_list *dmi; |
354 | 354 | ||
@@ -393,7 +393,7 @@ static inline int emac_opb_mhz(void) | |||
393 | /* BHs disabled */ | 393 | /* BHs disabled */ |
394 | static int emac_configure(struct ocp_enet_private *dev) | 394 | static int emac_configure(struct ocp_enet_private *dev) |
395 | { | 395 | { |
396 | struct emac_regs *p = dev->emacp; | 396 | struct emac_regs __iomem *p = dev->emacp; |
397 | struct net_device *ndev = dev->ndev; | 397 | struct net_device *ndev = dev->ndev; |
398 | int gige; | 398 | int gige; |
399 | u32 r; | 399 | u32 r; |
@@ -555,7 +555,7 @@ static void emac_full_tx_reset(struct net_device *ndev) | |||
555 | 555 | ||
556 | static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg) | 556 | static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg) |
557 | { | 557 | { |
558 | struct emac_regs *p = dev->emacp; | 558 | struct emac_regs __iomem *p = dev->emacp; |
559 | u32 r; | 559 | u32 r; |
560 | int n; | 560 | int n; |
561 | 561 | ||
@@ -604,7 +604,7 @@ static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg) | |||
604 | static void __emac_mdio_write(struct ocp_enet_private *dev, u8 id, u8 reg, | 604 | static void __emac_mdio_write(struct ocp_enet_private *dev, u8 id, u8 reg, |
605 | u16 val) | 605 | u16 val) |
606 | { | 606 | { |
607 | struct emac_regs *p = dev->emacp; | 607 | struct emac_regs __iomem *p = dev->emacp; |
608 | int n; | 608 | int n; |
609 | 609 | ||
610 | DBG2("%d: mdio_write(%02x,%02x,%04x)" NL, dev->def->index, id, reg, | 610 | DBG2("%d: mdio_write(%02x,%02x,%04x)" NL, dev->def->index, id, reg, |
@@ -666,7 +666,7 @@ static void emac_mdio_write(struct net_device *ndev, int id, int reg, int val) | |||
666 | static void emac_set_multicast_list(struct net_device *ndev) | 666 | static void emac_set_multicast_list(struct net_device *ndev) |
667 | { | 667 | { |
668 | struct ocp_enet_private *dev = ndev->priv; | 668 | struct ocp_enet_private *dev = ndev->priv; |
669 | struct emac_regs *p = dev->emacp; | 669 | struct emac_regs __iomem *p = dev->emacp; |
670 | u32 rmr = emac_iff2rmr(ndev); | 670 | u32 rmr = emac_iff2rmr(ndev); |
671 | 671 | ||
672 | DBG("%d: multicast %08x" NL, dev->def->index, rmr); | 672 | DBG("%d: multicast %08x" NL, dev->def->index, rmr); |
@@ -825,7 +825,7 @@ static void emac_clean_rx_ring(struct ocp_enet_private *dev) | |||
825 | } | 825 | } |
826 | 826 | ||
827 | static inline int emac_alloc_rx_skb(struct ocp_enet_private *dev, int slot, | 827 | static inline int emac_alloc_rx_skb(struct ocp_enet_private *dev, int slot, |
828 | int flags) | 828 | gfp_t flags) |
829 | { | 829 | { |
830 | struct sk_buff *skb = alloc_skb(dev->rx_skb_size, flags); | 830 | struct sk_buff *skb = alloc_skb(dev->rx_skb_size, flags); |
831 | if (unlikely(!skb)) | 831 | if (unlikely(!skb)) |
@@ -1047,7 +1047,7 @@ static inline u16 emac_tx_csum(struct ocp_enet_private *dev, | |||
1047 | 1047 | ||
1048 | static inline int emac_xmit_finish(struct ocp_enet_private *dev, int len) | 1048 | static inline int emac_xmit_finish(struct ocp_enet_private *dev, int len) |
1049 | { | 1049 | { |
1050 | struct emac_regs *p = dev->emacp; | 1050 | struct emac_regs __iomem *p = dev->emacp; |
1051 | struct net_device *ndev = dev->ndev; | 1051 | struct net_device *ndev = dev->ndev; |
1052 | 1052 | ||
1053 | /* Send the packet out */ | 1053 | /* Send the packet out */ |
@@ -1519,7 +1519,7 @@ static void emac_rxde(void *param) | |||
1519 | static irqreturn_t emac_irq(int irq, void *dev_instance, struct pt_regs *regs) | 1519 | static irqreturn_t emac_irq(int irq, void *dev_instance, struct pt_regs *regs) |
1520 | { | 1520 | { |
1521 | struct ocp_enet_private *dev = dev_instance; | 1521 | struct ocp_enet_private *dev = dev_instance; |
1522 | struct emac_regs *p = dev->emacp; | 1522 | struct emac_regs __iomem *p = dev->emacp; |
1523 | struct ibm_emac_error_stats *st = &dev->estats; | 1523 | struct ibm_emac_error_stats *st = &dev->estats; |
1524 | 1524 | ||
1525 | u32 isr = in_be32(&p->isr); | 1525 | u32 isr = in_be32(&p->isr); |
@@ -1619,17 +1619,17 @@ static void emac_remove(struct ocp_device *ocpdev) | |||
1619 | 1619 | ||
1620 | DBG("%d: remove" NL, dev->def->index); | 1620 | DBG("%d: remove" NL, dev->def->index); |
1621 | 1621 | ||
1622 | ocp_set_drvdata(ocpdev, 0); | 1622 | ocp_set_drvdata(ocpdev, NULL); |
1623 | unregister_netdev(dev->ndev); | 1623 | unregister_netdev(dev->ndev); |
1624 | 1624 | ||
1625 | tah_fini(dev->tah_dev); | 1625 | tah_fini(dev->tah_dev); |
1626 | rgmii_fini(dev->rgmii_dev, dev->rgmii_input); | 1626 | rgmii_fini(dev->rgmii_dev, dev->rgmii_input); |
1627 | zmii_fini(dev->zmii_dev, dev->zmii_input); | 1627 | zmii_fini(dev->zmii_dev, dev->zmii_input); |
1628 | 1628 | ||
1629 | emac_dbg_register(dev->def->index, 0); | 1629 | emac_dbg_register(dev->def->index, NULL); |
1630 | 1630 | ||
1631 | mal_unregister_commac(dev->mal, &dev->commac); | 1631 | mal_unregister_commac(dev->mal, &dev->commac); |
1632 | iounmap((void *)dev->emacp); | 1632 | iounmap(dev->emacp); |
1633 | kfree(dev->ndev); | 1633 | kfree(dev->ndev); |
1634 | } | 1634 | } |
1635 | 1635 | ||
@@ -2048,9 +2048,7 @@ static int __init emac_probe(struct ocp_device *ocpdev) | |||
2048 | goto out4; | 2048 | goto out4; |
2049 | 2049 | ||
2050 | /* Map EMAC regs */ | 2050 | /* Map EMAC regs */ |
2051 | dev->emacp = | 2051 | dev->emacp = ioremap(dev->def->paddr, sizeof(struct emac_regs)); |
2052 | (struct emac_regs *)ioremap(dev->def->paddr, | ||
2053 | sizeof(struct emac_regs)); | ||
2054 | if (!dev->emacp) { | 2052 | if (!dev->emacp) { |
2055 | printk(KERN_ERR "emac%d: could not ioremap device registers!\n", | 2053 | printk(KERN_ERR "emac%d: could not ioremap device registers!\n", |
2056 | dev->def->index); | 2054 | dev->def->index); |
@@ -2210,7 +2208,7 @@ static int __init emac_probe(struct ocp_device *ocpdev) | |||
2210 | 2208 | ||
2211 | return 0; | 2209 | return 0; |
2212 | out6: | 2210 | out6: |
2213 | iounmap((void *)dev->emacp); | 2211 | iounmap(dev->emacp); |
2214 | out5: | 2212 | out5: |
2215 | tah_fini(dev->tah_dev); | 2213 | tah_fini(dev->tah_dev); |
2216 | out4: | 2214 | out4: |
diff --git a/drivers/net/ibm_emac/ibm_emac_core.h b/drivers/net/ibm_emac/ibm_emac_core.h index 911abbaf471b..f61273b2e94f 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.h +++ b/drivers/net/ibm_emac/ibm_emac_core.h | |||
@@ -155,7 +155,7 @@ struct ibm_emac_error_stats { | |||
155 | 155 | ||
156 | struct ocp_enet_private { | 156 | struct ocp_enet_private { |
157 | struct net_device *ndev; /* 0 */ | 157 | struct net_device *ndev; /* 0 */ |
158 | struct emac_regs *emacp; | 158 | struct emac_regs __iomem *emacp; |
159 | 159 | ||
160 | struct mal_descriptor *tx_desc; | 160 | struct mal_descriptor *tx_desc; |
161 | int tx_cnt; | 161 | int tx_cnt; |
diff --git a/drivers/net/ibm_emac/ibm_emac_debug.c b/drivers/net/ibm_emac/ibm_emac_debug.c index 75d3b8639041..c7e1ecfa08fe 100644 --- a/drivers/net/ibm_emac/ibm_emac_debug.c +++ b/drivers/net/ibm_emac/ibm_emac_debug.c | |||
@@ -58,7 +58,7 @@ static void emac_desc_dump(int idx, struct ocp_enet_private *p) | |||
58 | 58 | ||
59 | static void emac_mac_dump(int idx, struct ocp_enet_private *dev) | 59 | static void emac_mac_dump(int idx, struct ocp_enet_private *dev) |
60 | { | 60 | { |
61 | struct emac_regs *p = dev->emacp; | 61 | struct emac_regs __iomem *p = dev->emacp; |
62 | 62 | ||
63 | printk("** EMAC%d registers **\n" | 63 | printk("** EMAC%d registers **\n" |
64 | "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n" | 64 | "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n" |
diff --git a/drivers/net/ibm_emac/ibm_emac_rgmii.h b/drivers/net/ibm_emac/ibm_emac_rgmii.h index a1ffb8a44fff..7f03d536c9a3 100644 --- a/drivers/net/ibm_emac/ibm_emac_rgmii.h +++ b/drivers/net/ibm_emac/ibm_emac_rgmii.h | |||
@@ -31,7 +31,7 @@ struct rgmii_regs { | |||
31 | 31 | ||
32 | /* RGMII device */ | 32 | /* RGMII device */ |
33 | struct ibm_ocp_rgmii { | 33 | struct ibm_ocp_rgmii { |
34 | struct rgmii_regs *base; | 34 | struct rgmii_regs __iomem *base; |
35 | int users; /* number of EMACs using this RGMII bridge */ | 35 | int users; /* number of EMACs using this RGMII bridge */ |
36 | }; | 36 | }; |
37 | 37 | ||
diff --git a/drivers/net/ibm_emac/ibm_emac_zmii.c b/drivers/net/ibm_emac/ibm_emac_zmii.c index 35c1185079ed..e129e0aaa045 100644 --- a/drivers/net/ibm_emac/ibm_emac_zmii.c +++ b/drivers/net/ibm_emac/ibm_emac_zmii.c | |||
@@ -80,7 +80,7 @@ static inline u32 zmii_mode_mask(int mode, int input) | |||
80 | static int __init zmii_init(struct ocp_device *ocpdev, int input, int *mode) | 80 | static int __init zmii_init(struct ocp_device *ocpdev, int input, int *mode) |
81 | { | 81 | { |
82 | struct ibm_ocp_zmii *dev = ocp_get_drvdata(ocpdev); | 82 | struct ibm_ocp_zmii *dev = ocp_get_drvdata(ocpdev); |
83 | struct zmii_regs *p; | 83 | struct zmii_regs __iomem *p; |
84 | 84 | ||
85 | ZMII_DBG("%d: init(%d, %d)" NL, ocpdev->def->index, input, *mode); | 85 | ZMII_DBG("%d: init(%d, %d)" NL, ocpdev->def->index, input, *mode); |
86 | 86 | ||
@@ -94,8 +94,7 @@ static int __init zmii_init(struct ocp_device *ocpdev, int input, int *mode) | |||
94 | } | 94 | } |
95 | dev->mode = PHY_MODE_NA; | 95 | dev->mode = PHY_MODE_NA; |
96 | 96 | ||
97 | p = (struct zmii_regs *)ioremap(ocpdev->def->paddr, | 97 | p = ioremap(ocpdev->def->paddr, sizeof(struct zmii_regs)); |
98 | sizeof(struct zmii_regs)); | ||
99 | if (!p) { | 98 | if (!p) { |
100 | printk(KERN_ERR | 99 | printk(KERN_ERR |
101 | "zmii%d: could not ioremap device registers!\n", | 100 | "zmii%d: could not ioremap device registers!\n", |
@@ -231,7 +230,7 @@ void __exit __zmii_fini(struct ocp_device *ocpdev, int input) | |||
231 | if (!--dev->users) { | 230 | if (!--dev->users) { |
232 | /* Free everything if this is the last user */ | 231 | /* Free everything if this is the last user */ |
233 | ocp_set_drvdata(ocpdev, NULL); | 232 | ocp_set_drvdata(ocpdev, NULL); |
234 | iounmap((void *)dev->base); | 233 | iounmap(dev->base); |
235 | kfree(dev); | 234 | kfree(dev); |
236 | } | 235 | } |
237 | } | 236 | } |
diff --git a/drivers/net/ibm_emac/ibm_emac_zmii.h b/drivers/net/ibm_emac/ibm_emac_zmii.h index 0bb26062c0ad..92c854410753 100644 --- a/drivers/net/ibm_emac/ibm_emac_zmii.h +++ b/drivers/net/ibm_emac/ibm_emac_zmii.h | |||
@@ -32,7 +32,7 @@ struct zmii_regs { | |||
32 | 32 | ||
33 | /* ZMII device */ | 33 | /* ZMII device */ |
34 | struct ibm_ocp_zmii { | 34 | struct ibm_ocp_zmii { |
35 | struct zmii_regs *base; | 35 | struct zmii_regs __iomem *base; |
36 | int mode; /* subset of PHY_MODE_XXXX */ | 36 | int mode; /* subset of PHY_MODE_XXXX */ |
37 | int users; /* number of EMACs using this ZMII bridge */ | 37 | int users; /* number of EMACs using this ZMII bridge */ |
38 | u32 fer_save; /* FER value left by firmware */ | 38 | u32 fer_save; /* FER value left by firmware */ |
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index 02d5c6822733..f6f3dafe83ee 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c | |||
@@ -622,7 +622,7 @@ static int __init mac_sonic_init_module(void) | |||
622 | return 0; | 622 | return 0; |
623 | 623 | ||
624 | out_unregister: | 624 | out_unregister: |
625 | driver_unregister(&mac_sonic_driver); | 625 | platform_driver_unregister(&mac_sonic_driver); |
626 | 626 | ||
627 | return -ENOMEM; | 627 | return -ENOMEM; |
628 | } | 628 | } |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index c0998ef938e0..6b4fff80ae5f 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -81,10 +81,15 @@ | |||
81 | #define PHY_WAIT_MICRO_SECONDS 10 | 81 | #define PHY_WAIT_MICRO_SECONDS 10 |
82 | 82 | ||
83 | /* Static function declarations */ | 83 | /* Static function declarations */ |
84 | static int eth_port_link_is_up(unsigned int eth_port_num); | ||
85 | static void eth_port_uc_addr_get(struct net_device *dev, | 84 | static void eth_port_uc_addr_get(struct net_device *dev, |
86 | unsigned char *MacAddr); | 85 | unsigned char *MacAddr); |
87 | static void eth_port_set_multicast_list(struct net_device *); | 86 | static void eth_port_set_multicast_list(struct net_device *); |
87 | static void mv643xx_eth_port_enable_tx(unsigned int port_num, | ||
88 | unsigned int channels); | ||
89 | static void mv643xx_eth_port_enable_rx(unsigned int port_num, | ||
90 | unsigned int channels); | ||
91 | static unsigned int mv643xx_eth_port_disable_tx(unsigned int port_num); | ||
92 | static unsigned int mv643xx_eth_port_disable_rx(unsigned int port_num); | ||
88 | static int mv643xx_eth_open(struct net_device *); | 93 | static int mv643xx_eth_open(struct net_device *); |
89 | static int mv643xx_eth_stop(struct net_device *); | 94 | static int mv643xx_eth_stop(struct net_device *); |
90 | static int mv643xx_eth_change_mtu(struct net_device *, int); | 95 | static int mv643xx_eth_change_mtu(struct net_device *, int); |
@@ -93,8 +98,12 @@ static void eth_port_init_mac_tables(unsigned int eth_port_num); | |||
93 | #ifdef MV643XX_NAPI | 98 | #ifdef MV643XX_NAPI |
94 | static int mv643xx_poll(struct net_device *dev, int *budget); | 99 | static int mv643xx_poll(struct net_device *dev, int *budget); |
95 | #endif | 100 | #endif |
101 | static int ethernet_phy_get(unsigned int eth_port_num); | ||
96 | static void ethernet_phy_set(unsigned int eth_port_num, int phy_addr); | 102 | static void ethernet_phy_set(unsigned int eth_port_num, int phy_addr); |
97 | static int ethernet_phy_detect(unsigned int eth_port_num); | 103 | static int ethernet_phy_detect(unsigned int eth_port_num); |
104 | static int mv643xx_mdio_read(struct net_device *dev, int phy_id, int location); | ||
105 | static void mv643xx_mdio_write(struct net_device *dev, int phy_id, int location, int val); | ||
106 | static int mv643xx_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | ||
98 | static struct ethtool_ops mv643xx_ethtool_ops; | 107 | static struct ethtool_ops mv643xx_ethtool_ops; |
99 | 108 | ||
100 | static char mv643xx_driver_name[] = "mv643xx_eth"; | 109 | static char mv643xx_driver_name[] = "mv643xx_eth"; |
@@ -171,11 +180,11 @@ static void mv643xx_eth_rx_task(void *data) | |||
171 | if (test_and_set_bit(0, &mp->rx_task_busy)) | 180 | if (test_and_set_bit(0, &mp->rx_task_busy)) |
172 | panic("%s: Error in test_set_bit / clear_bit", dev->name); | 181 | panic("%s: Error in test_set_bit / clear_bit", dev->name); |
173 | 182 | ||
174 | while (mp->rx_ring_skbs < (mp->rx_ring_size - 5)) { | 183 | while (mp->rx_desc_count < (mp->rx_ring_size - 5)) { |
175 | skb = dev_alloc_skb(RX_SKB_SIZE + DMA_ALIGN); | 184 | skb = dev_alloc_skb(RX_SKB_SIZE + DMA_ALIGN); |
176 | if (!skb) | 185 | if (!skb) |
177 | break; | 186 | break; |
178 | mp->rx_ring_skbs++; | 187 | mp->rx_desc_count++; |
179 | unaligned = (u32)skb->data & (DMA_ALIGN - 1); | 188 | unaligned = (u32)skb->data & (DMA_ALIGN - 1); |
180 | if (unaligned) | 189 | if (unaligned) |
181 | skb_reserve(skb, DMA_ALIGN - unaligned); | 190 | skb_reserve(skb, DMA_ALIGN - unaligned); |
@@ -196,7 +205,7 @@ static void mv643xx_eth_rx_task(void *data) | |||
196 | * If RX ring is empty of SKB, set a timer to try allocating | 205 | * If RX ring is empty of SKB, set a timer to try allocating |
197 | * again in a later time . | 206 | * again in a later time . |
198 | */ | 207 | */ |
199 | if ((mp->rx_ring_skbs == 0) && (mp->rx_timer_flag == 0)) { | 208 | if ((mp->rx_desc_count == 0) && (mp->rx_timer_flag == 0)) { |
200 | printk(KERN_INFO "%s: Rx ring is empty\n", dev->name); | 209 | printk(KERN_INFO "%s: Rx ring is empty\n", dev->name); |
201 | /* After 100mSec */ | 210 | /* After 100mSec */ |
202 | mp->timeout.expires = jiffies + (HZ / 10); | 211 | mp->timeout.expires = jiffies + (HZ / 10); |
@@ -245,8 +254,7 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev) | |||
245 | unsigned int port_num = mp->port_num; | 254 | unsigned int port_num = mp->port_num; |
246 | 255 | ||
247 | eth_port_init_mac_tables(port_num); | 256 | eth_port_init_mac_tables(port_num); |
248 | memcpy(mp->port_mac_addr, dev->dev_addr, 6); | 257 | eth_port_uc_addr_set(port_num, dev->dev_addr); |
249 | eth_port_uc_addr_set(port_num, mp->port_mac_addr); | ||
250 | } | 258 | } |
251 | 259 | ||
252 | /* | 260 | /* |
@@ -260,13 +268,14 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev) | |||
260 | static void mv643xx_eth_set_rx_mode(struct net_device *dev) | 268 | static void mv643xx_eth_set_rx_mode(struct net_device *dev) |
261 | { | 269 | { |
262 | struct mv643xx_private *mp = netdev_priv(dev); | 270 | struct mv643xx_private *mp = netdev_priv(dev); |
271 | u32 config_reg; | ||
263 | 272 | ||
273 | config_reg = mv_read(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num)); | ||
264 | if (dev->flags & IFF_PROMISC) | 274 | if (dev->flags & IFF_PROMISC) |
265 | mp->port_config |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; | 275 | config_reg |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; |
266 | else | 276 | else |
267 | mp->port_config &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; | 277 | config_reg &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; |
268 | 278 | mv_write(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num), config_reg); | |
269 | mv_write(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num), mp->port_config); | ||
270 | 279 | ||
271 | eth_port_set_multicast_list(dev); | 280 | eth_port_set_multicast_list(dev); |
272 | } | 281 | } |
@@ -322,7 +331,7 @@ static void mv643xx_eth_tx_timeout_task(struct net_device *dev) | |||
322 | 331 | ||
323 | netif_device_detach(dev); | 332 | netif_device_detach(dev); |
324 | eth_port_reset(mp->port_num); | 333 | eth_port_reset(mp->port_num); |
325 | eth_port_start(mp); | 334 | eth_port_start(dev); |
326 | netif_device_attach(dev); | 335 | netif_device_attach(dev); |
327 | } | 336 | } |
328 | 337 | ||
@@ -397,7 +406,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) | |||
397 | #else | 406 | #else |
398 | while (eth_port_receive(mp, &pkt_info) == ETH_OK) { | 407 | while (eth_port_receive(mp, &pkt_info) == ETH_OK) { |
399 | #endif | 408 | #endif |
400 | mp->rx_ring_skbs--; | 409 | mp->rx_desc_count--; |
401 | received_packets++; | 410 | received_packets++; |
402 | 411 | ||
403 | /* Update statistics. Note byte count includes 4 byte CRC count */ | 412 | /* Update statistics. Note byte count includes 4 byte CRC count */ |
@@ -452,6 +461,56 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) | |||
452 | return received_packets; | 461 | return received_packets; |
453 | } | 462 | } |
454 | 463 | ||
464 | /* Set the mv643xx port configuration register for the speed/duplex mode. */ | ||
465 | static void mv643xx_eth_update_pscr(struct net_device *dev, | ||
466 | struct ethtool_cmd *ecmd) | ||
467 | { | ||
468 | struct mv643xx_private *mp = netdev_priv(dev); | ||
469 | int port_num = mp->port_num; | ||
470 | u32 o_pscr, n_pscr; | ||
471 | unsigned int channels; | ||
472 | |||
473 | o_pscr = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); | ||
474 | n_pscr = o_pscr; | ||
475 | |||
476 | /* clear speed, duplex and rx buffer size fields */ | ||
477 | n_pscr &= ~(MV643XX_ETH_SET_MII_SPEED_TO_100 | | ||
478 | MV643XX_ETH_SET_GMII_SPEED_TO_1000 | | ||
479 | MV643XX_ETH_SET_FULL_DUPLEX_MODE | | ||
480 | MV643XX_ETH_MAX_RX_PACKET_MASK); | ||
481 | |||
482 | if (ecmd->duplex == DUPLEX_FULL) | ||
483 | n_pscr |= MV643XX_ETH_SET_FULL_DUPLEX_MODE; | ||
484 | |||
485 | if (ecmd->speed == SPEED_1000) | ||
486 | n_pscr |= MV643XX_ETH_SET_GMII_SPEED_TO_1000 | | ||
487 | MV643XX_ETH_MAX_RX_PACKET_9700BYTE; | ||
488 | else { | ||
489 | if (ecmd->speed == SPEED_100) | ||
490 | n_pscr |= MV643XX_ETH_SET_MII_SPEED_TO_100; | ||
491 | n_pscr |= MV643XX_ETH_MAX_RX_PACKET_1522BYTE; | ||
492 | } | ||
493 | |||
494 | if (n_pscr != o_pscr) { | ||
495 | if ((o_pscr & MV643XX_ETH_SERIAL_PORT_ENABLE) == 0) | ||
496 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | ||
497 | n_pscr); | ||
498 | else { | ||
499 | channels = mv643xx_eth_port_disable_tx(port_num); | ||
500 | |||
501 | o_pscr &= ~MV643XX_ETH_SERIAL_PORT_ENABLE; | ||
502 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | ||
503 | o_pscr); | ||
504 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | ||
505 | n_pscr); | ||
506 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | ||
507 | n_pscr); | ||
508 | if (channels) | ||
509 | mv643xx_eth_port_enable_tx(port_num, channels); | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | |||
455 | /* | 514 | /* |
456 | * mv643xx_eth_int_handler | 515 | * mv643xx_eth_int_handler |
457 | * | 516 | * |
@@ -497,7 +556,7 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, | |||
497 | /* UDP change : We may need this */ | 556 | /* UDP change : We may need this */ |
498 | if ((eth_int_cause_ext & 0x0000ffff) && | 557 | if ((eth_int_cause_ext & 0x0000ffff) && |
499 | (mv643xx_eth_free_tx_queue(dev, eth_int_cause_ext) == 0) && | 558 | (mv643xx_eth_free_tx_queue(dev, eth_int_cause_ext) == 0) && |
500 | (mp->tx_ring_size > mp->tx_ring_skbs + MAX_DESCS_PER_SKB)) | 559 | (mp->tx_ring_size > mp->tx_desc_count + MAX_DESCS_PER_SKB)) |
501 | netif_wake_queue(dev); | 560 | netif_wake_queue(dev); |
502 | #ifdef MV643XX_NAPI | 561 | #ifdef MV643XX_NAPI |
503 | } else { | 562 | } else { |
@@ -534,15 +593,23 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, | |||
534 | } | 593 | } |
535 | /* PHY status changed */ | 594 | /* PHY status changed */ |
536 | if (eth_int_cause_ext & (BIT16 | BIT20)) { | 595 | if (eth_int_cause_ext & (BIT16 | BIT20)) { |
537 | if (eth_port_link_is_up(port_num)) { | 596 | struct ethtool_cmd cmd; |
538 | netif_carrier_on(dev); | 597 | |
539 | netif_wake_queue(dev); | 598 | if (mii_link_ok(&mp->mii)) { |
540 | /* Start TX queue */ | 599 | mii_ethtool_gset(&mp->mii, &cmd); |
541 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG | 600 | mv643xx_eth_update_pscr(dev, &cmd); |
542 | (port_num), 1); | 601 | if (!netif_carrier_ok(dev)) { |
543 | } else { | 602 | netif_carrier_on(dev); |
544 | netif_carrier_off(dev); | 603 | if (mp->tx_ring_size > mp->tx_desc_count + |
604 | MAX_DESCS_PER_SKB) { | ||
605 | netif_wake_queue(dev); | ||
606 | /* Start TX queue */ | ||
607 | mv643xx_eth_port_enable_tx(port_num, mp->port_tx_queue_command); | ||
608 | } | ||
609 | } | ||
610 | } else if (netif_carrier_ok(dev)) { | ||
545 | netif_stop_queue(dev); | 611 | netif_stop_queue(dev); |
612 | netif_carrier_off(dev); | ||
546 | } | 613 | } |
547 | } | 614 | } |
548 | 615 | ||
@@ -671,8 +738,8 @@ static void ether_init_rx_desc_ring(struct mv643xx_private *mp) | |||
671 | 738 | ||
672 | mp->rx_desc_area_size = rx_desc_num * sizeof(struct eth_rx_desc); | 739 | mp->rx_desc_area_size = rx_desc_num * sizeof(struct eth_rx_desc); |
673 | 740 | ||
674 | /* Add the queue to the list of RX queues of this port */ | 741 | /* Enable queue 0 for this port */ |
675 | mp->port_rx_queue_command |= 1; | 742 | mp->port_rx_queue_command = 1; |
676 | } | 743 | } |
677 | 744 | ||
678 | /* | 745 | /* |
@@ -718,8 +785,36 @@ static void ether_init_tx_desc_ring(struct mv643xx_private *mp) | |||
718 | 785 | ||
719 | mp->tx_desc_area_size = tx_desc_num * sizeof(struct eth_tx_desc); | 786 | mp->tx_desc_area_size = tx_desc_num * sizeof(struct eth_tx_desc); |
720 | 787 | ||
721 | /* Add the queue to the list of Tx queues of this port */ | 788 | /* Enable queue 0 for this port */ |
722 | mp->port_tx_queue_command |= 1; | 789 | mp->port_tx_queue_command = 1; |
790 | } | ||
791 | |||
792 | static int mv643xx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
793 | { | ||
794 | struct mv643xx_private *mp = netdev_priv(dev); | ||
795 | int err; | ||
796 | |||
797 | spin_lock_irq(&mp->lock); | ||
798 | err = mii_ethtool_sset(&mp->mii, cmd); | ||
799 | spin_unlock_irq(&mp->lock); | ||
800 | |||
801 | return err; | ||
802 | } | ||
803 | |||
804 | static int mv643xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
805 | { | ||
806 | struct mv643xx_private *mp = netdev_priv(dev); | ||
807 | int err; | ||
808 | |||
809 | spin_lock_irq(&mp->lock); | ||
810 | err = mii_ethtool_gset(&mp->mii, cmd); | ||
811 | spin_unlock_irq(&mp->lock); | ||
812 | |||
813 | /* The PHY may support 1000baseT_Half, but the mv643xx does not */ | ||
814 | cmd->supported &= ~SUPPORTED_1000baseT_Half; | ||
815 | cmd->advertising &= ~ADVERTISED_1000baseT_Half; | ||
816 | |||
817 | return err; | ||
723 | } | 818 | } |
724 | 819 | ||
725 | /* | 820 | /* |
@@ -750,12 +845,6 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
750 | return -EAGAIN; | 845 | return -EAGAIN; |
751 | } | 846 | } |
752 | 847 | ||
753 | /* Stop RX Queues */ | ||
754 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), 0x0000ff00); | ||
755 | |||
756 | /* Set the MAC Address */ | ||
757 | memcpy(mp->port_mac_addr, dev->dev_addr, 6); | ||
758 | |||
759 | eth_port_init(mp); | 848 | eth_port_init(mp); |
760 | 849 | ||
761 | INIT_WORK(&mp->rx_task, (void (*)(void *))mv643xx_eth_rx_task, dev); | 850 | INIT_WORK(&mp->rx_task, (void (*)(void *))mv643xx_eth_rx_task, dev); |
@@ -784,7 +873,7 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
784 | } | 873 | } |
785 | 874 | ||
786 | /* Allocate TX ring */ | 875 | /* Allocate TX ring */ |
787 | mp->tx_ring_skbs = 0; | 876 | mp->tx_desc_count = 0; |
788 | size = mp->tx_ring_size * sizeof(struct eth_tx_desc); | 877 | size = mp->tx_ring_size * sizeof(struct eth_tx_desc); |
789 | mp->tx_desc_area_size = size; | 878 | mp->tx_desc_area_size = size; |
790 | 879 | ||
@@ -809,7 +898,7 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
809 | ether_init_tx_desc_ring(mp); | 898 | ether_init_tx_desc_ring(mp); |
810 | 899 | ||
811 | /* Allocate RX ring */ | 900 | /* Allocate RX ring */ |
812 | mp->rx_ring_skbs = 0; | 901 | mp->rx_desc_count = 0; |
813 | size = mp->rx_ring_size * sizeof(struct eth_rx_desc); | 902 | size = mp->rx_ring_size * sizeof(struct eth_rx_desc); |
814 | mp->rx_desc_area_size = size; | 903 | mp->rx_desc_area_size = size; |
815 | 904 | ||
@@ -841,7 +930,11 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
841 | 930 | ||
842 | mv643xx_eth_rx_task(dev); /* Fill RX ring with skb's */ | 931 | mv643xx_eth_rx_task(dev); /* Fill RX ring with skb's */ |
843 | 932 | ||
844 | eth_port_start(mp); | 933 | /* Clear any pending ethernet port interrupts */ |
934 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0); | ||
935 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0); | ||
936 | |||
937 | eth_port_start(dev); | ||
845 | 938 | ||
846 | /* Interrupt Coalescing */ | 939 | /* Interrupt Coalescing */ |
847 | 940 | ||
@@ -853,16 +946,13 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
853 | mp->tx_int_coal = | 946 | mp->tx_int_coal = |
854 | eth_port_set_tx_coal(port_num, 133000000, MV643XX_TX_COAL); | 947 | eth_port_set_tx_coal(port_num, 133000000, MV643XX_TX_COAL); |
855 | 948 | ||
856 | /* Clear any pending ethernet port interrupts */ | ||
857 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0); | ||
858 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0); | ||
859 | |||
860 | /* Unmask phy and link status changes interrupts */ | 949 | /* Unmask phy and link status changes interrupts */ |
861 | mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port_num), | 950 | mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port_num), |
862 | INT_UNMASK_ALL_EXT); | 951 | INT_UNMASK_ALL_EXT); |
863 | 952 | ||
864 | /* Unmask RX buffer and TX end interrupt */ | 953 | /* Unmask RX buffer and TX end interrupt */ |
865 | mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), INT_UNMASK_ALL); | 954 | mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), INT_UNMASK_ALL); |
955 | |||
866 | return 0; | 956 | return 0; |
867 | 957 | ||
868 | out_free_tx_skb: | 958 | out_free_tx_skb: |
@@ -883,20 +973,20 @@ static void mv643xx_eth_free_tx_rings(struct net_device *dev) | |||
883 | struct sk_buff *skb; | 973 | struct sk_buff *skb; |
884 | 974 | ||
885 | /* Stop Tx Queues */ | 975 | /* Stop Tx Queues */ |
886 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), 0x0000ff00); | 976 | mv643xx_eth_port_disable_tx(port_num); |
887 | 977 | ||
888 | /* Free outstanding skb's on TX rings */ | 978 | /* Free outstanding skb's on TX rings */ |
889 | for (curr = 0; mp->tx_ring_skbs && curr < mp->tx_ring_size; curr++) { | 979 | for (curr = 0; mp->tx_desc_count && curr < mp->tx_ring_size; curr++) { |
890 | skb = mp->tx_skb[curr]; | 980 | skb = mp->tx_skb[curr]; |
891 | if (skb) { | 981 | if (skb) { |
892 | mp->tx_ring_skbs -= skb_shinfo(skb)->nr_frags; | 982 | mp->tx_desc_count -= skb_shinfo(skb)->nr_frags; |
893 | dev_kfree_skb(skb); | 983 | dev_kfree_skb(skb); |
894 | mp->tx_ring_skbs--; | 984 | mp->tx_desc_count--; |
895 | } | 985 | } |
896 | } | 986 | } |
897 | if (mp->tx_ring_skbs) | 987 | if (mp->tx_desc_count) |
898 | printk("%s: Error on Tx descriptor free - could not free %d" | 988 | printk("%s: Error on Tx descriptor free - could not free %d" |
899 | " descriptors\n", dev->name, mp->tx_ring_skbs); | 989 | " descriptors\n", dev->name, mp->tx_desc_count); |
900 | 990 | ||
901 | /* Free TX ring */ | 991 | /* Free TX ring */ |
902 | if (mp->tx_sram_size) | 992 | if (mp->tx_sram_size) |
@@ -913,21 +1003,21 @@ static void mv643xx_eth_free_rx_rings(struct net_device *dev) | |||
913 | int curr; | 1003 | int curr; |
914 | 1004 | ||
915 | /* Stop RX Queues */ | 1005 | /* Stop RX Queues */ |
916 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), 0x0000ff00); | 1006 | mv643xx_eth_port_disable_rx(port_num); |
917 | 1007 | ||
918 | /* Free preallocated skb's on RX rings */ | 1008 | /* Free preallocated skb's on RX rings */ |
919 | for (curr = 0; mp->rx_ring_skbs && curr < mp->rx_ring_size; curr++) { | 1009 | for (curr = 0; mp->rx_desc_count && curr < mp->rx_ring_size; curr++) { |
920 | if (mp->rx_skb[curr]) { | 1010 | if (mp->rx_skb[curr]) { |
921 | dev_kfree_skb(mp->rx_skb[curr]); | 1011 | dev_kfree_skb(mp->rx_skb[curr]); |
922 | mp->rx_ring_skbs--; | 1012 | mp->rx_desc_count--; |
923 | } | 1013 | } |
924 | } | 1014 | } |
925 | 1015 | ||
926 | if (mp->rx_ring_skbs) | 1016 | if (mp->rx_desc_count) |
927 | printk(KERN_ERR | 1017 | printk(KERN_ERR |
928 | "%s: Error in freeing Rx Ring. %d skb's still" | 1018 | "%s: Error in freeing Rx Ring. %d skb's still" |
929 | " stuck in RX Ring - ignoring them\n", dev->name, | 1019 | " stuck in RX Ring - ignoring them\n", dev->name, |
930 | mp->rx_ring_skbs); | 1020 | mp->rx_desc_count); |
931 | /* Free RX ring */ | 1021 | /* Free RX ring */ |
932 | if (mp->rx_sram_size) | 1022 | if (mp->rx_sram_size) |
933 | iounmap(mp->p_rx_desc_area); | 1023 | iounmap(mp->p_rx_desc_area); |
@@ -997,7 +1087,8 @@ static void mv643xx_tx(struct net_device *dev) | |||
997 | } | 1087 | } |
998 | 1088 | ||
999 | if (netif_queue_stopped(dev) && | 1089 | if (netif_queue_stopped(dev) && |
1000 | mp->tx_ring_size > mp->tx_ring_skbs + MAX_DESCS_PER_SKB) | 1090 | mp->tx_ring_size > |
1091 | mp->tx_desc_count + MAX_DESCS_PER_SKB) | ||
1001 | netif_wake_queue(dev); | 1092 | netif_wake_queue(dev); |
1002 | } | 1093 | } |
1003 | 1094 | ||
@@ -1089,7 +1180,7 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1089 | } | 1180 | } |
1090 | 1181 | ||
1091 | /* This is a hard error, log it. */ | 1182 | /* This is a hard error, log it. */ |
1092 | if ((mp->tx_ring_size - mp->tx_ring_skbs) <= | 1183 | if ((mp->tx_ring_size - mp->tx_desc_count) <= |
1093 | (skb_shinfo(skb)->nr_frags + 1)) { | 1184 | (skb_shinfo(skb)->nr_frags + 1)) { |
1094 | netif_stop_queue(dev); | 1185 | netif_stop_queue(dev); |
1095 | printk(KERN_ERR | 1186 | printk(KERN_ERR |
@@ -1266,7 +1357,7 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1266 | /* Check if TX queue can handle another skb. If not, then | 1357 | /* Check if TX queue can handle another skb. If not, then |
1267 | * signal higher layers to stop requesting TX | 1358 | * signal higher layers to stop requesting TX |
1268 | */ | 1359 | */ |
1269 | if (mp->tx_ring_size <= (mp->tx_ring_skbs + MAX_DESCS_PER_SKB)) | 1360 | if (mp->tx_ring_size <= (mp->tx_desc_count + MAX_DESCS_PER_SKB)) |
1270 | /* | 1361 | /* |
1271 | * Stop getting skb's from upper layers. | 1362 | * Stop getting skb's from upper layers. |
1272 | * Getting skb's from upper layers will be enabled again after | 1363 | * Getting skb's from upper layers will be enabled again after |
@@ -1316,6 +1407,35 @@ static void mv643xx_netpoll(struct net_device *netdev) | |||
1316 | } | 1407 | } |
1317 | #endif | 1408 | #endif |
1318 | 1409 | ||
1410 | static void mv643xx_init_ethtool_cmd(struct net_device *dev, int phy_address, | ||
1411 | int speed, int duplex, | ||
1412 | struct ethtool_cmd *cmd) | ||
1413 | { | ||
1414 | struct mv643xx_private *mp = netdev_priv(dev); | ||
1415 | |||
1416 | memset(cmd, 0, sizeof(*cmd)); | ||
1417 | |||
1418 | cmd->port = PORT_MII; | ||
1419 | cmd->transceiver = XCVR_INTERNAL; | ||
1420 | cmd->phy_address = phy_address; | ||
1421 | |||
1422 | if (speed == 0) { | ||
1423 | cmd->autoneg = AUTONEG_ENABLE; | ||
1424 | /* mii lib checks, but doesn't use speed on AUTONEG_ENABLE */ | ||
1425 | cmd->speed = SPEED_100; | ||
1426 | cmd->advertising = ADVERTISED_10baseT_Half | | ||
1427 | ADVERTISED_10baseT_Full | | ||
1428 | ADVERTISED_100baseT_Half | | ||
1429 | ADVERTISED_100baseT_Full; | ||
1430 | if (mp->mii.supports_gmii) | ||
1431 | cmd->advertising |= ADVERTISED_1000baseT_Full; | ||
1432 | } else { | ||
1433 | cmd->autoneg = AUTONEG_DISABLE; | ||
1434 | cmd->speed = speed; | ||
1435 | cmd->duplex = duplex; | ||
1436 | } | ||
1437 | } | ||
1438 | |||
1319 | /*/ | 1439 | /*/ |
1320 | * mv643xx_eth_probe | 1440 | * mv643xx_eth_probe |
1321 | * | 1441 | * |
@@ -1336,6 +1456,9 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1336 | u8 *p; | 1456 | u8 *p; |
1337 | struct resource *res; | 1457 | struct resource *res; |
1338 | int err; | 1458 | int err; |
1459 | struct ethtool_cmd cmd; | ||
1460 | int duplex = DUPLEX_HALF; | ||
1461 | int speed = 0; /* default to auto-negotiation */ | ||
1339 | 1462 | ||
1340 | dev = alloc_etherdev(sizeof(struct mv643xx_private)); | 1463 | dev = alloc_etherdev(sizeof(struct mv643xx_private)); |
1341 | if (!dev) | 1464 | if (!dev) |
@@ -1373,6 +1496,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1373 | dev->tx_queue_len = mp->tx_ring_size; | 1496 | dev->tx_queue_len = mp->tx_ring_size; |
1374 | dev->base_addr = 0; | 1497 | dev->base_addr = 0; |
1375 | dev->change_mtu = mv643xx_eth_change_mtu; | 1498 | dev->change_mtu = mv643xx_eth_change_mtu; |
1499 | dev->do_ioctl = mv643xx_eth_do_ioctl; | ||
1376 | SET_ETHTOOL_OPS(dev, &mv643xx_ethtool_ops); | 1500 | SET_ETHTOOL_OPS(dev, &mv643xx_ethtool_ops); |
1377 | 1501 | ||
1378 | #ifdef MV643XX_CHECKSUM_OFFLOAD_TX | 1502 | #ifdef MV643XX_CHECKSUM_OFFLOAD_TX |
@@ -1393,33 +1517,17 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1393 | 1517 | ||
1394 | /* set default config values */ | 1518 | /* set default config values */ |
1395 | eth_port_uc_addr_get(dev, dev->dev_addr); | 1519 | eth_port_uc_addr_get(dev, dev->dev_addr); |
1396 | mp->port_config = MV643XX_ETH_PORT_CONFIG_DEFAULT_VALUE; | ||
1397 | mp->port_config_extend = MV643XX_ETH_PORT_CONFIG_EXTEND_DEFAULT_VALUE; | ||
1398 | mp->port_sdma_config = MV643XX_ETH_PORT_SDMA_CONFIG_DEFAULT_VALUE; | ||
1399 | mp->port_serial_control = MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE; | ||
1400 | mp->rx_ring_size = MV643XX_ETH_PORT_DEFAULT_RECEIVE_QUEUE_SIZE; | 1520 | mp->rx_ring_size = MV643XX_ETH_PORT_DEFAULT_RECEIVE_QUEUE_SIZE; |
1401 | mp->tx_ring_size = MV643XX_ETH_PORT_DEFAULT_TRANSMIT_QUEUE_SIZE; | 1521 | mp->tx_ring_size = MV643XX_ETH_PORT_DEFAULT_TRANSMIT_QUEUE_SIZE; |
1402 | 1522 | ||
1403 | pd = pdev->dev.platform_data; | 1523 | pd = pdev->dev.platform_data; |
1404 | if (pd) { | 1524 | if (pd) { |
1405 | if (pd->mac_addr != NULL) | 1525 | if (pd->mac_addr) |
1406 | memcpy(dev->dev_addr, pd->mac_addr, 6); | 1526 | memcpy(dev->dev_addr, pd->mac_addr, 6); |
1407 | 1527 | ||
1408 | if (pd->phy_addr || pd->force_phy_addr) | 1528 | if (pd->phy_addr || pd->force_phy_addr) |
1409 | ethernet_phy_set(port_num, pd->phy_addr); | 1529 | ethernet_phy_set(port_num, pd->phy_addr); |
1410 | 1530 | ||
1411 | if (pd->port_config || pd->force_port_config) | ||
1412 | mp->port_config = pd->port_config; | ||
1413 | |||
1414 | if (pd->port_config_extend || pd->force_port_config_extend) | ||
1415 | mp->port_config_extend = pd->port_config_extend; | ||
1416 | |||
1417 | if (pd->port_sdma_config || pd->force_port_sdma_config) | ||
1418 | mp->port_sdma_config = pd->port_sdma_config; | ||
1419 | |||
1420 | if (pd->port_serial_control || pd->force_port_serial_control) | ||
1421 | mp->port_serial_control = pd->port_serial_control; | ||
1422 | |||
1423 | if (pd->rx_queue_size) | 1531 | if (pd->rx_queue_size) |
1424 | mp->rx_ring_size = pd->rx_queue_size; | 1532 | mp->rx_ring_size = pd->rx_queue_size; |
1425 | 1533 | ||
@@ -1435,16 +1543,33 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1435 | mp->rx_sram_size = pd->rx_sram_size; | 1543 | mp->rx_sram_size = pd->rx_sram_size; |
1436 | mp->rx_sram_addr = pd->rx_sram_addr; | 1544 | mp->rx_sram_addr = pd->rx_sram_addr; |
1437 | } | 1545 | } |
1546 | |||
1547 | duplex = pd->duplex; | ||
1548 | speed = pd->speed; | ||
1438 | } | 1549 | } |
1439 | 1550 | ||
1551 | /* Hook up MII support for ethtool */ | ||
1552 | mp->mii.dev = dev; | ||
1553 | mp->mii.mdio_read = mv643xx_mdio_read; | ||
1554 | mp->mii.mdio_write = mv643xx_mdio_write; | ||
1555 | mp->mii.phy_id = ethernet_phy_get(port_num); | ||
1556 | mp->mii.phy_id_mask = 0x3f; | ||
1557 | mp->mii.reg_num_mask = 0x1f; | ||
1558 | |||
1440 | err = ethernet_phy_detect(port_num); | 1559 | err = ethernet_phy_detect(port_num); |
1441 | if (err) { | 1560 | if (err) { |
1442 | pr_debug("MV643xx ethernet port %d: " | 1561 | pr_debug("MV643xx ethernet port %d: " |
1443 | "No PHY detected at addr %d\n", | 1562 | "No PHY detected at addr %d\n", |
1444 | port_num, ethernet_phy_get(port_num)); | 1563 | port_num, ethernet_phy_get(port_num)); |
1445 | return err; | 1564 | goto out; |
1446 | } | 1565 | } |
1447 | 1566 | ||
1567 | ethernet_phy_reset(port_num); | ||
1568 | mp->mii.supports_gmii = mii_check_gmii_support(&mp->mii); | ||
1569 | mv643xx_init_ethtool_cmd(dev, mp->mii.phy_id, speed, duplex, &cmd); | ||
1570 | mv643xx_eth_update_pscr(dev, &cmd); | ||
1571 | mv643xx_set_settings(dev, &cmd); | ||
1572 | |||
1448 | err = register_netdev(dev); | 1573 | err = register_netdev(dev); |
1449 | if (err) | 1574 | if (err) |
1450 | goto out; | 1575 | goto out; |
@@ -1708,7 +1833,6 @@ MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX"); | |||
1708 | * Prior to calling the initialization routine eth_port_init() the user | 1833 | * Prior to calling the initialization routine eth_port_init() the user |
1709 | * must set the following fields under mv643xx_private struct: | 1834 | * must set the following fields under mv643xx_private struct: |
1710 | * port_num User Ethernet port number. | 1835 | * port_num User Ethernet port number. |
1711 | * port_mac_addr[6] User defined port MAC address. | ||
1712 | * port_config User port configuration value. | 1836 | * port_config User port configuration value. |
1713 | * port_config_extend User port config extend value. | 1837 | * port_config_extend User port config extend value. |
1714 | * port_sdma_config User port SDMA config value. | 1838 | * port_sdma_config User port SDMA config value. |
@@ -1725,20 +1849,12 @@ MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX"); | |||
1725 | * return_info Tx/Rx user resource return information. | 1849 | * return_info Tx/Rx user resource return information. |
1726 | */ | 1850 | */ |
1727 | 1851 | ||
1728 | /* defines */ | ||
1729 | /* SDMA command macros */ | ||
1730 | #define ETH_ENABLE_TX_QUEUE(eth_port) \ | ||
1731 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(eth_port), 1) | ||
1732 | |||
1733 | /* locals */ | ||
1734 | |||
1735 | /* PHY routines */ | 1852 | /* PHY routines */ |
1736 | static int ethernet_phy_get(unsigned int eth_port_num); | 1853 | static int ethernet_phy_get(unsigned int eth_port_num); |
1737 | static void ethernet_phy_set(unsigned int eth_port_num, int phy_addr); | 1854 | static void ethernet_phy_set(unsigned int eth_port_num, int phy_addr); |
1738 | 1855 | ||
1739 | /* Ethernet Port routines */ | 1856 | /* Ethernet Port routines */ |
1740 | static int eth_port_uc_addr(unsigned int eth_port_num, unsigned char uc_nibble, | 1857 | static void eth_port_set_filter_table_entry(int table, unsigned char entry); |
1741 | int option); | ||
1742 | 1858 | ||
1743 | /* | 1859 | /* |
1744 | * eth_port_init - Initialize the Ethernet port driver | 1860 | * eth_port_init - Initialize the Ethernet port driver |
@@ -1766,17 +1882,12 @@ static int eth_port_uc_addr(unsigned int eth_port_num, unsigned char uc_nibble, | |||
1766 | */ | 1882 | */ |
1767 | static void eth_port_init(struct mv643xx_private *mp) | 1883 | static void eth_port_init(struct mv643xx_private *mp) |
1768 | { | 1884 | { |
1769 | mp->port_rx_queue_command = 0; | ||
1770 | mp->port_tx_queue_command = 0; | ||
1771 | |||
1772 | mp->rx_resource_err = 0; | 1885 | mp->rx_resource_err = 0; |
1773 | mp->tx_resource_err = 0; | 1886 | mp->tx_resource_err = 0; |
1774 | 1887 | ||
1775 | eth_port_reset(mp->port_num); | 1888 | eth_port_reset(mp->port_num); |
1776 | 1889 | ||
1777 | eth_port_init_mac_tables(mp->port_num); | 1890 | eth_port_init_mac_tables(mp->port_num); |
1778 | |||
1779 | ethernet_phy_reset(mp->port_num); | ||
1780 | } | 1891 | } |
1781 | 1892 | ||
1782 | /* | 1893 | /* |
@@ -1798,7 +1909,7 @@ static void eth_port_init(struct mv643xx_private *mp) | |||
1798 | * and ether_init_rx_desc_ring for Rx queues). | 1909 | * and ether_init_rx_desc_ring for Rx queues). |
1799 | * | 1910 | * |
1800 | * INPUT: | 1911 | * INPUT: |
1801 | * struct mv643xx_private *mp Ethernet port control struct | 1912 | * dev - a pointer to the required interface |
1802 | * | 1913 | * |
1803 | * OUTPUT: | 1914 | * OUTPUT: |
1804 | * Ethernet port is ready to receive and transmit. | 1915 | * Ethernet port is ready to receive and transmit. |
@@ -1806,10 +1917,13 @@ static void eth_port_init(struct mv643xx_private *mp) | |||
1806 | * RETURN: | 1917 | * RETURN: |
1807 | * None. | 1918 | * None. |
1808 | */ | 1919 | */ |
1809 | static void eth_port_start(struct mv643xx_private *mp) | 1920 | static void eth_port_start(struct net_device *dev) |
1810 | { | 1921 | { |
1922 | struct mv643xx_private *mp = netdev_priv(dev); | ||
1811 | unsigned int port_num = mp->port_num; | 1923 | unsigned int port_num = mp->port_num; |
1812 | int tx_curr_desc, rx_curr_desc; | 1924 | int tx_curr_desc, rx_curr_desc; |
1925 | u32 pscr; | ||
1926 | struct ethtool_cmd ethtool_cmd; | ||
1813 | 1927 | ||
1814 | /* Assignment of Tx CTRP of given queue */ | 1928 | /* Assignment of Tx CTRP of given queue */ |
1815 | tx_curr_desc = mp->tx_curr_desc_q; | 1929 | tx_curr_desc = mp->tx_curr_desc_q; |
@@ -1822,37 +1936,45 @@ static void eth_port_start(struct mv643xx_private *mp) | |||
1822 | (u32)((struct eth_rx_desc *)mp->rx_desc_dma + rx_curr_desc)); | 1936 | (u32)((struct eth_rx_desc *)mp->rx_desc_dma + rx_curr_desc)); |
1823 | 1937 | ||
1824 | /* Add the assigned Ethernet address to the port's address table */ | 1938 | /* Add the assigned Ethernet address to the port's address table */ |
1825 | eth_port_uc_addr_set(port_num, mp->port_mac_addr); | 1939 | eth_port_uc_addr_set(port_num, dev->dev_addr); |
1826 | 1940 | ||
1827 | /* Assign port configuration and command. */ | 1941 | /* Assign port configuration and command. */ |
1828 | mv_write(MV643XX_ETH_PORT_CONFIG_REG(port_num), mp->port_config); | 1942 | mv_write(MV643XX_ETH_PORT_CONFIG_REG(port_num), |
1943 | MV643XX_ETH_PORT_CONFIG_DEFAULT_VALUE); | ||
1829 | 1944 | ||
1830 | mv_write(MV643XX_ETH_PORT_CONFIG_EXTEND_REG(port_num), | 1945 | mv_write(MV643XX_ETH_PORT_CONFIG_EXTEND_REG(port_num), |
1831 | mp->port_config_extend); | 1946 | MV643XX_ETH_PORT_CONFIG_EXTEND_DEFAULT_VALUE); |
1832 | 1947 | ||
1948 | pscr = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); | ||
1833 | 1949 | ||
1834 | /* Increase the Rx side buffer size if supporting GigE */ | 1950 | pscr &= ~(MV643XX_ETH_SERIAL_PORT_ENABLE | MV643XX_ETH_FORCE_LINK_PASS); |
1835 | if (mp->port_serial_control & MV643XX_ETH_SET_GMII_SPEED_TO_1000) | 1951 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), pscr); |
1836 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | 1952 | |
1837 | (mp->port_serial_control & 0xfff1ffff) | (0x5 << 17)); | 1953 | pscr |= MV643XX_ETH_DISABLE_AUTO_NEG_FOR_FLOW_CTRL | |
1838 | else | 1954 | MV643XX_ETH_DISABLE_AUTO_NEG_SPEED_GMII | |
1839 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | 1955 | MV643XX_ETH_DISABLE_AUTO_NEG_FOR_DUPLX | |
1840 | mp->port_serial_control); | 1956 | MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL | |
1957 | MV643XX_ETH_SERIAL_PORT_CONTROL_RESERVED; | ||
1841 | 1958 | ||
1842 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | 1959 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), pscr); |
1843 | mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)) | | 1960 | |
1844 | MV643XX_ETH_SERIAL_PORT_ENABLE); | 1961 | pscr |= MV643XX_ETH_SERIAL_PORT_ENABLE; |
1962 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), pscr); | ||
1845 | 1963 | ||
1846 | /* Assign port SDMA configuration */ | 1964 | /* Assign port SDMA configuration */ |
1847 | mv_write(MV643XX_ETH_SDMA_CONFIG_REG(port_num), | 1965 | mv_write(MV643XX_ETH_SDMA_CONFIG_REG(port_num), |
1848 | mp->port_sdma_config); | 1966 | MV643XX_ETH_PORT_SDMA_CONFIG_DEFAULT_VALUE); |
1849 | 1967 | ||
1850 | /* Enable port Rx. */ | 1968 | /* Enable port Rx. */ |
1851 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), | 1969 | mv643xx_eth_port_enable_rx(port_num, mp->port_rx_queue_command); |
1852 | mp->port_rx_queue_command); | ||
1853 | 1970 | ||
1854 | /* Disable port bandwidth limits by clearing MTU register */ | 1971 | /* Disable port bandwidth limits by clearing MTU register */ |
1855 | mv_write(MV643XX_ETH_MAXIMUM_TRANSMIT_UNIT(port_num), 0); | 1972 | mv_write(MV643XX_ETH_MAXIMUM_TRANSMIT_UNIT(port_num), 0); |
1973 | |||
1974 | /* save phy settings across reset */ | ||
1975 | mv643xx_get_settings(dev, ðtool_cmd); | ||
1976 | ethernet_phy_reset(mp->port_num); | ||
1977 | mv643xx_set_settings(dev, ðtool_cmd); | ||
1856 | } | 1978 | } |
1857 | 1979 | ||
1858 | /* | 1980 | /* |
@@ -1866,8 +1988,9 @@ static void eth_port_start(struct mv643xx_private *mp) | |||
1866 | * char * p_addr Address to be set | 1988 | * char * p_addr Address to be set |
1867 | * | 1989 | * |
1868 | * OUTPUT: | 1990 | * OUTPUT: |
1869 | * Set MAC address low and high registers. also calls eth_port_uc_addr() | 1991 | * Set MAC address low and high registers. also calls |
1870 | * To set the unicast table with the proper information. | 1992 | * eth_port_set_filter_table_entry() to set the unicast |
1993 | * table with the proper information. | ||
1871 | * | 1994 | * |
1872 | * RETURN: | 1995 | * RETURN: |
1873 | * N/A. | 1996 | * N/A. |
@@ -1878,6 +2001,7 @@ static void eth_port_uc_addr_set(unsigned int eth_port_num, | |||
1878 | { | 2001 | { |
1879 | unsigned int mac_h; | 2002 | unsigned int mac_h; |
1880 | unsigned int mac_l; | 2003 | unsigned int mac_l; |
2004 | int table; | ||
1881 | 2005 | ||
1882 | mac_l = (p_addr[4] << 8) | (p_addr[5]); | 2006 | mac_l = (p_addr[4] << 8) | (p_addr[5]); |
1883 | mac_h = (p_addr[0] << 24) | (p_addr[1] << 16) | (p_addr[2] << 8) | | 2007 | mac_h = (p_addr[0] << 24) | (p_addr[1] << 16) | (p_addr[2] << 8) | |
@@ -1887,9 +2011,8 @@ static void eth_port_uc_addr_set(unsigned int eth_port_num, | |||
1887 | mv_write(MV643XX_ETH_MAC_ADDR_HIGH(eth_port_num), mac_h); | 2011 | mv_write(MV643XX_ETH_MAC_ADDR_HIGH(eth_port_num), mac_h); |
1888 | 2012 | ||
1889 | /* Accept frames of this address */ | 2013 | /* Accept frames of this address */ |
1890 | eth_port_uc_addr(eth_port_num, p_addr[5], ACCEPT_MAC_ADDR); | 2014 | table = MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE(eth_port_num); |
1891 | 2015 | eth_port_set_filter_table_entry(table, p_addr[5] & 0x0f); | |
1892 | return; | ||
1893 | } | 2016 | } |
1894 | 2017 | ||
1895 | /* | 2018 | /* |
@@ -1928,72 +2051,6 @@ static void eth_port_uc_addr_get(struct net_device *dev, unsigned char *p_addr) | |||
1928 | } | 2051 | } |
1929 | 2052 | ||
1930 | /* | 2053 | /* |
1931 | * eth_port_uc_addr - This function Set the port unicast address table | ||
1932 | * | ||
1933 | * DESCRIPTION: | ||
1934 | * This function locates the proper entry in the Unicast table for the | ||
1935 | * specified MAC nibble and sets its properties according to function | ||
1936 | * parameters. | ||
1937 | * | ||
1938 | * INPUT: | ||
1939 | * unsigned int eth_port_num Port number. | ||
1940 | * unsigned char uc_nibble Unicast MAC Address last nibble. | ||
1941 | * int option 0 = Add, 1 = remove address. | ||
1942 | * | ||
1943 | * OUTPUT: | ||
1944 | * This function add/removes MAC addresses from the port unicast address | ||
1945 | * table. | ||
1946 | * | ||
1947 | * RETURN: | ||
1948 | * true is output succeeded. | ||
1949 | * false if option parameter is invalid. | ||
1950 | * | ||
1951 | */ | ||
1952 | static int eth_port_uc_addr(unsigned int eth_port_num, unsigned char uc_nibble, | ||
1953 | int option) | ||
1954 | { | ||
1955 | unsigned int unicast_reg; | ||
1956 | unsigned int tbl_offset; | ||
1957 | unsigned int reg_offset; | ||
1958 | |||
1959 | /* Locate the Unicast table entry */ | ||
1960 | uc_nibble = (0xf & uc_nibble); | ||
1961 | tbl_offset = (uc_nibble / 4) * 4; /* Register offset from unicast table base */ | ||
1962 | reg_offset = uc_nibble % 4; /* Entry offset within the above register */ | ||
1963 | |||
1964 | switch (option) { | ||
1965 | case REJECT_MAC_ADDR: | ||
1966 | /* Clear accepts frame bit at given unicast DA table entry */ | ||
1967 | unicast_reg = mv_read((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | ||
1968 | (eth_port_num) + tbl_offset)); | ||
1969 | |||
1970 | unicast_reg &= (0x0E << (8 * reg_offset)); | ||
1971 | |||
1972 | mv_write((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | ||
1973 | (eth_port_num) + tbl_offset), unicast_reg); | ||
1974 | break; | ||
1975 | |||
1976 | case ACCEPT_MAC_ADDR: | ||
1977 | /* Set accepts frame bit at unicast DA filter table entry */ | ||
1978 | unicast_reg = | ||
1979 | mv_read((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | ||
1980 | (eth_port_num) + tbl_offset)); | ||
1981 | |||
1982 | unicast_reg |= (0x01 << (8 * reg_offset)); | ||
1983 | |||
1984 | mv_write((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | ||
1985 | (eth_port_num) + tbl_offset), unicast_reg); | ||
1986 | |||
1987 | break; | ||
1988 | |||
1989 | default: | ||
1990 | return 0; | ||
1991 | } | ||
1992 | |||
1993 | return 1; | ||
1994 | } | ||
1995 | |||
1996 | /* | ||
1997 | * The entries in each table are indexed by a hash of a packet's MAC | 2054 | * The entries in each table are indexed by a hash of a packet's MAC |
1998 | * address. One bit in each entry determines whether the packet is | 2055 | * address. One bit in each entry determines whether the packet is |
1999 | * accepted. There are 4 entries (each 8 bits wide) in each register | 2056 | * accepted. There are 4 entries (each 8 bits wide) in each register |
@@ -2205,8 +2262,8 @@ static void eth_port_init_mac_tables(unsigned int eth_port_num) | |||
2205 | 2262 | ||
2206 | /* Clear DA filter unicast table (Ex_dFUT) */ | 2263 | /* Clear DA filter unicast table (Ex_dFUT) */ |
2207 | for (table_index = 0; table_index <= 0xC; table_index += 4) | 2264 | for (table_index = 0; table_index <= 0xC; table_index += 4) |
2208 | mv_write((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | 2265 | mv_write(MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE |
2209 | (eth_port_num) + table_index), 0); | 2266 | (eth_port_num) + table_index, 0); |
2210 | 2267 | ||
2211 | for (table_index = 0; table_index <= 0xFC; table_index += 4) { | 2268 | for (table_index = 0; table_index <= 0xFC; table_index += 4) { |
2212 | /* Clear DA filter special multicast table (Ex_dFSMT) */ | 2269 | /* Clear DA filter special multicast table (Ex_dFSMT) */ |
@@ -2389,6 +2446,73 @@ static void ethernet_phy_reset(unsigned int eth_port_num) | |||
2389 | eth_port_read_smi_reg(eth_port_num, 0, &phy_reg_data); | 2446 | eth_port_read_smi_reg(eth_port_num, 0, &phy_reg_data); |
2390 | phy_reg_data |= 0x8000; /* Set bit 15 to reset the PHY */ | 2447 | phy_reg_data |= 0x8000; /* Set bit 15 to reset the PHY */ |
2391 | eth_port_write_smi_reg(eth_port_num, 0, phy_reg_data); | 2448 | eth_port_write_smi_reg(eth_port_num, 0, phy_reg_data); |
2449 | |||
2450 | /* wait for PHY to come out of reset */ | ||
2451 | do { | ||
2452 | udelay(1); | ||
2453 | eth_port_read_smi_reg(eth_port_num, 0, &phy_reg_data); | ||
2454 | } while (phy_reg_data & 0x8000); | ||
2455 | } | ||
2456 | |||
2457 | static void mv643xx_eth_port_enable_tx(unsigned int port_num, | ||
2458 | unsigned int channels) | ||
2459 | { | ||
2460 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), channels); | ||
2461 | } | ||
2462 | |||
2463 | static void mv643xx_eth_port_enable_rx(unsigned int port_num, | ||
2464 | unsigned int channels) | ||
2465 | { | ||
2466 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), channels); | ||
2467 | } | ||
2468 | |||
2469 | static unsigned int mv643xx_eth_port_disable_tx(unsigned int port_num) | ||
2470 | { | ||
2471 | u32 channels; | ||
2472 | |||
2473 | /* Stop Tx port activity. Check port Tx activity. */ | ||
2474 | channels = mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num)) | ||
2475 | & 0xFF; | ||
2476 | if (channels) { | ||
2477 | /* Issue stop command for active channels only */ | ||
2478 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), | ||
2479 | (channels << 8)); | ||
2480 | |||
2481 | /* Wait for all Tx activity to terminate. */ | ||
2482 | /* Check port cause register that all Tx queues are stopped */ | ||
2483 | while (mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num)) | ||
2484 | & 0xFF) | ||
2485 | udelay(PHY_WAIT_MICRO_SECONDS); | ||
2486 | |||
2487 | /* Wait for Tx FIFO to empty */ | ||
2488 | while (mv_read(MV643XX_ETH_PORT_STATUS_REG(port_num)) & | ||
2489 | ETH_PORT_TX_FIFO_EMPTY) | ||
2490 | udelay(PHY_WAIT_MICRO_SECONDS); | ||
2491 | } | ||
2492 | |||
2493 | return channels; | ||
2494 | } | ||
2495 | |||
2496 | static unsigned int mv643xx_eth_port_disable_rx(unsigned int port_num) | ||
2497 | { | ||
2498 | u32 channels; | ||
2499 | |||
2500 | /* Stop Rx port activity. Check port Rx activity. */ | ||
2501 | channels = mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num) | ||
2502 | & 0xFF); | ||
2503 | if (channels) { | ||
2504 | /* Issue stop command for active channels only */ | ||
2505 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), | ||
2506 | (channels << 8)); | ||
2507 | |||
2508 | /* Wait for all Rx activity to terminate. */ | ||
2509 | /* Check port cause register that all Rx queues are stopped */ | ||
2510 | while (mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num)) | ||
2511 | & 0xFF) | ||
2512 | udelay(PHY_WAIT_MICRO_SECONDS); | ||
2513 | } | ||
2514 | |||
2515 | return channels; | ||
2392 | } | 2516 | } |
2393 | 2517 | ||
2394 | /* | 2518 | /* |
@@ -2413,70 +2537,21 @@ static void eth_port_reset(unsigned int port_num) | |||
2413 | { | 2537 | { |
2414 | unsigned int reg_data; | 2538 | unsigned int reg_data; |
2415 | 2539 | ||
2416 | /* Stop Tx port activity. Check port Tx activity. */ | 2540 | mv643xx_eth_port_disable_tx(port_num); |
2417 | reg_data = mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num)); | 2541 | mv643xx_eth_port_disable_rx(port_num); |
2418 | |||
2419 | if (reg_data & 0xFF) { | ||
2420 | /* Issue stop command for active channels only */ | ||
2421 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), | ||
2422 | (reg_data << 8)); | ||
2423 | |||
2424 | /* Wait for all Tx activity to terminate. */ | ||
2425 | /* Check port cause register that all Tx queues are stopped */ | ||
2426 | while (mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num)) | ||
2427 | & 0xFF) | ||
2428 | udelay(10); | ||
2429 | } | ||
2430 | |||
2431 | /* Stop Rx port activity. Check port Rx activity. */ | ||
2432 | reg_data = mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num)); | ||
2433 | |||
2434 | if (reg_data & 0xFF) { | ||
2435 | /* Issue stop command for active channels only */ | ||
2436 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), | ||
2437 | (reg_data << 8)); | ||
2438 | |||
2439 | /* Wait for all Rx activity to terminate. */ | ||
2440 | /* Check port cause register that all Rx queues are stopped */ | ||
2441 | while (mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num)) | ||
2442 | & 0xFF) | ||
2443 | udelay(10); | ||
2444 | } | ||
2445 | 2542 | ||
2446 | /* Clear all MIB counters */ | 2543 | /* Clear all MIB counters */ |
2447 | eth_clear_mib_counters(port_num); | 2544 | eth_clear_mib_counters(port_num); |
2448 | 2545 | ||
2449 | /* Reset the Enable bit in the Configuration Register */ | 2546 | /* Reset the Enable bit in the Configuration Register */ |
2450 | reg_data = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); | 2547 | reg_data = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); |
2451 | reg_data &= ~MV643XX_ETH_SERIAL_PORT_ENABLE; | 2548 | reg_data &= ~(MV643XX_ETH_SERIAL_PORT_ENABLE | |
2549 | MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL | | ||
2550 | MV643XX_ETH_FORCE_LINK_PASS); | ||
2452 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), reg_data); | 2551 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), reg_data); |
2453 | } | 2552 | } |
2454 | 2553 | ||
2455 | 2554 | ||
2456 | static int eth_port_autoneg_supported(unsigned int eth_port_num) | ||
2457 | { | ||
2458 | unsigned int phy_reg_data0; | ||
2459 | |||
2460 | eth_port_read_smi_reg(eth_port_num, 0, &phy_reg_data0); | ||
2461 | |||
2462 | return phy_reg_data0 & 0x1000; | ||
2463 | } | ||
2464 | |||
2465 | static int eth_port_link_is_up(unsigned int eth_port_num) | ||
2466 | { | ||
2467 | unsigned int phy_reg_data1; | ||
2468 | |||
2469 | eth_port_read_smi_reg(eth_port_num, 1, &phy_reg_data1); | ||
2470 | |||
2471 | if (eth_port_autoneg_supported(eth_port_num)) { | ||
2472 | if (phy_reg_data1 & 0x20) /* auto-neg complete */ | ||
2473 | return 1; | ||
2474 | } else if (phy_reg_data1 & 0x4) /* link up */ | ||
2475 | return 1; | ||
2476 | |||
2477 | return 0; | ||
2478 | } | ||
2479 | |||
2480 | /* | 2555 | /* |
2481 | * eth_port_read_smi_reg - Read PHY registers | 2556 | * eth_port_read_smi_reg - Read PHY registers |
2482 | * | 2557 | * |
@@ -2582,6 +2657,24 @@ out: | |||
2582 | } | 2657 | } |
2583 | 2658 | ||
2584 | /* | 2659 | /* |
2660 | * Wrappers for MII support library. | ||
2661 | */ | ||
2662 | static int mv643xx_mdio_read(struct net_device *dev, int phy_id, int location) | ||
2663 | { | ||
2664 | int val; | ||
2665 | struct mv643xx_private *mp = netdev_priv(dev); | ||
2666 | |||
2667 | eth_port_read_smi_reg(mp->port_num, location, &val); | ||
2668 | return val; | ||
2669 | } | ||
2670 | |||
2671 | static void mv643xx_mdio_write(struct net_device *dev, int phy_id, int location, int val) | ||
2672 | { | ||
2673 | struct mv643xx_private *mp = netdev_priv(dev); | ||
2674 | eth_port_write_smi_reg(mp->port_num, location, val); | ||
2675 | } | ||
2676 | |||
2677 | /* | ||
2585 | * eth_port_send - Send an Ethernet packet | 2678 | * eth_port_send - Send an Ethernet packet |
2586 | * | 2679 | * |
2587 | * DESCRIPTION: | 2680 | * DESCRIPTION: |
@@ -2635,8 +2728,8 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2635 | return ETH_ERROR; | 2728 | return ETH_ERROR; |
2636 | } | 2729 | } |
2637 | 2730 | ||
2638 | mp->tx_ring_skbs++; | 2731 | mp->tx_desc_count++; |
2639 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | 2732 | BUG_ON(mp->tx_desc_count > mp->tx_ring_size); |
2640 | 2733 | ||
2641 | /* Get the Tx Desc ring indexes */ | 2734 | /* Get the Tx Desc ring indexes */ |
2642 | tx_desc_curr = mp->tx_curr_desc_q; | 2735 | tx_desc_curr = mp->tx_curr_desc_q; |
@@ -2670,7 +2763,7 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2670 | first_descriptor->cmd_sts = mp->tx_first_command; | 2763 | first_descriptor->cmd_sts = mp->tx_first_command; |
2671 | 2764 | ||
2672 | wmb(); | 2765 | wmb(); |
2673 | ETH_ENABLE_TX_QUEUE(mp->port_num); | 2766 | mv643xx_eth_port_enable_tx(mp->port_num, mp->port_tx_queue_command); |
2674 | 2767 | ||
2675 | /* | 2768 | /* |
2676 | * Finish Tx packet. Update first desc in case of Tx resource | 2769 | * Finish Tx packet. Update first desc in case of Tx resource |
@@ -2704,8 +2797,8 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2704 | if (mp->tx_resource_err) | 2797 | if (mp->tx_resource_err) |
2705 | return ETH_QUEUE_FULL; | 2798 | return ETH_QUEUE_FULL; |
2706 | 2799 | ||
2707 | mp->tx_ring_skbs++; | 2800 | mp->tx_desc_count++; |
2708 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | 2801 | BUG_ON(mp->tx_desc_count > mp->tx_ring_size); |
2709 | 2802 | ||
2710 | /* Get the Tx Desc ring indexes */ | 2803 | /* Get the Tx Desc ring indexes */ |
2711 | tx_desc_curr = mp->tx_curr_desc_q; | 2804 | tx_desc_curr = mp->tx_curr_desc_q; |
@@ -2723,7 +2816,7 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2723 | ETH_BUFFER_OWNED_BY_DMA | ETH_TX_ENABLE_INTERRUPT; | 2816 | ETH_BUFFER_OWNED_BY_DMA | ETH_TX_ENABLE_INTERRUPT; |
2724 | 2817 | ||
2725 | wmb(); | 2818 | wmb(); |
2726 | ETH_ENABLE_TX_QUEUE(mp->port_num); | 2819 | mv643xx_eth_port_enable_tx(mp->port_num, mp->port_tx_queue_command); |
2727 | 2820 | ||
2728 | /* Finish Tx packet. Update first desc in case of Tx resource error */ | 2821 | /* Finish Tx packet. Update first desc in case of Tx resource error */ |
2729 | tx_desc_curr = (tx_desc_curr + 1) % mp->tx_ring_size; | 2822 | tx_desc_curr = (tx_desc_curr + 1) % mp->tx_ring_size; |
@@ -2819,8 +2912,8 @@ static ETH_FUNC_RET_STATUS eth_tx_return_desc(struct mv643xx_private *mp, | |||
2819 | /* Any Tx return cancels the Tx resource error status */ | 2912 | /* Any Tx return cancels the Tx resource error status */ |
2820 | mp->tx_resource_err = 0; | 2913 | mp->tx_resource_err = 0; |
2821 | 2914 | ||
2822 | BUG_ON(mp->tx_ring_skbs == 0); | 2915 | BUG_ON(mp->tx_desc_count == 0); |
2823 | mp->tx_ring_skbs--; | 2916 | mp->tx_desc_count--; |
2824 | 2917 | ||
2825 | out: | 2918 | out: |
2826 | spin_unlock_irqrestore(&mp->lock, flags); | 2919 | spin_unlock_irqrestore(&mp->lock, flags); |
@@ -3017,111 +3110,6 @@ static const struct mv643xx_stats mv643xx_gstrings_stats[] = { | |||
3017 | #define MV643XX_STATS_LEN \ | 3110 | #define MV643XX_STATS_LEN \ |
3018 | sizeof(mv643xx_gstrings_stats) / sizeof(struct mv643xx_stats) | 3111 | sizeof(mv643xx_gstrings_stats) / sizeof(struct mv643xx_stats) |
3019 | 3112 | ||
3020 | static int | ||
3021 | mv643xx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | ||
3022 | { | ||
3023 | struct mv643xx_private *mp = netdev->priv; | ||
3024 | int port_num = mp->port_num; | ||
3025 | int autoneg = eth_port_autoneg_supported(port_num); | ||
3026 | int mode_10_bit; | ||
3027 | int auto_duplex; | ||
3028 | int half_duplex = 0; | ||
3029 | int full_duplex = 0; | ||
3030 | int auto_speed; | ||
3031 | int speed_10 = 0; | ||
3032 | int speed_100 = 0; | ||
3033 | int speed_1000 = 0; | ||
3034 | |||
3035 | u32 pcs = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); | ||
3036 | u32 psr = mv_read(MV643XX_ETH_PORT_STATUS_REG(port_num)); | ||
3037 | |||
3038 | mode_10_bit = psr & MV643XX_ETH_PORT_STATUS_MODE_10_BIT; | ||
3039 | |||
3040 | if (mode_10_bit) { | ||
3041 | ecmd->supported = SUPPORTED_10baseT_Half; | ||
3042 | } else { | ||
3043 | ecmd->supported = (SUPPORTED_10baseT_Half | | ||
3044 | SUPPORTED_10baseT_Full | | ||
3045 | SUPPORTED_100baseT_Half | | ||
3046 | SUPPORTED_100baseT_Full | | ||
3047 | SUPPORTED_1000baseT_Full | | ||
3048 | (autoneg ? SUPPORTED_Autoneg : 0) | | ||
3049 | SUPPORTED_TP); | ||
3050 | |||
3051 | auto_duplex = !(pcs & MV643XX_ETH_DISABLE_AUTO_NEG_FOR_DUPLX); | ||
3052 | auto_speed = !(pcs & MV643XX_ETH_DISABLE_AUTO_NEG_SPEED_GMII); | ||
3053 | |||
3054 | ecmd->advertising = ADVERTISED_TP; | ||
3055 | |||
3056 | if (autoneg) { | ||
3057 | ecmd->advertising |= ADVERTISED_Autoneg; | ||
3058 | |||
3059 | if (auto_duplex) { | ||
3060 | half_duplex = 1; | ||
3061 | full_duplex = 1; | ||
3062 | } else { | ||
3063 | if (pcs & MV643XX_ETH_SET_FULL_DUPLEX_MODE) | ||
3064 | full_duplex = 1; | ||
3065 | else | ||
3066 | half_duplex = 1; | ||
3067 | } | ||
3068 | |||
3069 | if (auto_speed) { | ||
3070 | speed_10 = 1; | ||
3071 | speed_100 = 1; | ||
3072 | speed_1000 = 1; | ||
3073 | } else { | ||
3074 | if (pcs & MV643XX_ETH_SET_GMII_SPEED_TO_1000) | ||
3075 | speed_1000 = 1; | ||
3076 | else if (pcs & MV643XX_ETH_SET_MII_SPEED_TO_100) | ||
3077 | speed_100 = 1; | ||
3078 | else | ||
3079 | speed_10 = 1; | ||
3080 | } | ||
3081 | |||
3082 | if (speed_10 & half_duplex) | ||
3083 | ecmd->advertising |= ADVERTISED_10baseT_Half; | ||
3084 | if (speed_10 & full_duplex) | ||
3085 | ecmd->advertising |= ADVERTISED_10baseT_Full; | ||
3086 | if (speed_100 & half_duplex) | ||
3087 | ecmd->advertising |= ADVERTISED_100baseT_Half; | ||
3088 | if (speed_100 & full_duplex) | ||
3089 | ecmd->advertising |= ADVERTISED_100baseT_Full; | ||
3090 | if (speed_1000) | ||
3091 | ecmd->advertising |= ADVERTISED_1000baseT_Full; | ||
3092 | } | ||
3093 | } | ||
3094 | |||
3095 | ecmd->port = PORT_TP; | ||
3096 | ecmd->phy_address = ethernet_phy_get(port_num); | ||
3097 | |||
3098 | ecmd->transceiver = XCVR_EXTERNAL; | ||
3099 | |||
3100 | if (netif_carrier_ok(netdev)) { | ||
3101 | if (mode_10_bit) | ||
3102 | ecmd->speed = SPEED_10; | ||
3103 | else { | ||
3104 | if (psr & MV643XX_ETH_PORT_STATUS_GMII_1000) | ||
3105 | ecmd->speed = SPEED_1000; | ||
3106 | else if (psr & MV643XX_ETH_PORT_STATUS_MII_100) | ||
3107 | ecmd->speed = SPEED_100; | ||
3108 | else | ||
3109 | ecmd->speed = SPEED_10; | ||
3110 | } | ||
3111 | |||
3112 | if (psr & MV643XX_ETH_PORT_STATUS_FULL_DUPLEX) | ||
3113 | ecmd->duplex = DUPLEX_FULL; | ||
3114 | else | ||
3115 | ecmd->duplex = DUPLEX_HALF; | ||
3116 | } else { | ||
3117 | ecmd->speed = -1; | ||
3118 | ecmd->duplex = -1; | ||
3119 | } | ||
3120 | |||
3121 | ecmd->autoneg = autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE; | ||
3122 | return 0; | ||
3123 | } | ||
3124 | |||
3125 | static void mv643xx_get_drvinfo(struct net_device *netdev, | 3113 | static void mv643xx_get_drvinfo(struct net_device *netdev, |
3126 | struct ethtool_drvinfo *drvinfo) | 3114 | struct ethtool_drvinfo *drvinfo) |
3127 | { | 3115 | { |
@@ -3168,15 +3156,41 @@ static void mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, | |||
3168 | } | 3156 | } |
3169 | } | 3157 | } |
3170 | 3158 | ||
3159 | static u32 mv643xx_eth_get_link(struct net_device *dev) | ||
3160 | { | ||
3161 | struct mv643xx_private *mp = netdev_priv(dev); | ||
3162 | |||
3163 | return mii_link_ok(&mp->mii); | ||
3164 | } | ||
3165 | |||
3166 | static int mv643xx_eth_nway_restart(struct net_device *dev) | ||
3167 | { | ||
3168 | struct mv643xx_private *mp = netdev_priv(dev); | ||
3169 | |||
3170 | return mii_nway_restart(&mp->mii); | ||
3171 | } | ||
3172 | |||
3173 | static int mv643xx_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | ||
3174 | { | ||
3175 | struct mv643xx_private *mp = netdev_priv(dev); | ||
3176 | |||
3177 | return generic_mii_ioctl(&mp->mii, if_mii(ifr), cmd, NULL); | ||
3178 | } | ||
3179 | |||
3171 | static struct ethtool_ops mv643xx_ethtool_ops = { | 3180 | static struct ethtool_ops mv643xx_ethtool_ops = { |
3172 | .get_settings = mv643xx_get_settings, | 3181 | .get_settings = mv643xx_get_settings, |
3182 | .set_settings = mv643xx_set_settings, | ||
3173 | .get_drvinfo = mv643xx_get_drvinfo, | 3183 | .get_drvinfo = mv643xx_get_drvinfo, |
3174 | .get_link = ethtool_op_get_link, | 3184 | .get_link = mv643xx_eth_get_link, |
3175 | .get_sg = ethtool_op_get_sg, | 3185 | .get_sg = ethtool_op_get_sg, |
3176 | .set_sg = ethtool_op_set_sg, | 3186 | .set_sg = ethtool_op_set_sg, |
3177 | .get_strings = mv643xx_get_strings, | 3187 | .get_strings = mv643xx_get_strings, |
3178 | .get_stats_count = mv643xx_get_stats_count, | 3188 | .get_stats_count = mv643xx_get_stats_count, |
3179 | .get_ethtool_stats = mv643xx_get_ethtool_stats, | 3189 | .get_ethtool_stats = mv643xx_get_ethtool_stats, |
3190 | .get_strings = mv643xx_get_strings, | ||
3191 | .get_stats_count = mv643xx_get_stats_count, | ||
3192 | .get_ethtool_stats = mv643xx_get_ethtool_stats, | ||
3193 | .nway_reset = mv643xx_eth_nway_restart, | ||
3180 | }; | 3194 | }; |
3181 | 3195 | ||
3182 | /************* End ethtool support *************************/ | 3196 | /************* End ethtool support *************************/ |
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h index f769f9b626ea..a553054e8da7 100644 --- a/drivers/net/mv643xx_eth.h +++ b/drivers/net/mv643xx_eth.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
7 | #include <linux/workqueue.h> | 7 | #include <linux/workqueue.h> |
8 | #include <linux/mii.h> | ||
8 | 9 | ||
9 | #include <linux/mv643xx.h> | 10 | #include <linux/mv643xx.h> |
10 | 11 | ||
@@ -89,10 +90,6 @@ | |||
89 | * | 90 | * |
90 | */ | 91 | */ |
91 | 92 | ||
92 | /* MAC accepet/reject macros */ | ||
93 | #define ACCEPT_MAC_ADDR 0 | ||
94 | #define REJECT_MAC_ADDR 1 | ||
95 | |||
96 | /* Buffer offset from buffer pointer */ | 93 | /* Buffer offset from buffer pointer */ |
97 | #define RX_BUF_OFFSET 0x2 | 94 | #define RX_BUF_OFFSET 0x2 |
98 | 95 | ||
@@ -324,11 +321,6 @@ struct mv643xx_mib_counters { | |||
324 | 321 | ||
325 | struct mv643xx_private { | 322 | struct mv643xx_private { |
326 | int port_num; /* User Ethernet port number */ | 323 | int port_num; /* User Ethernet port number */ |
327 | u8 port_mac_addr[6]; /* User defined port MAC address.*/ | ||
328 | u32 port_config; /* User port configuration value*/ | ||
329 | u32 port_config_extend; /* User port config extend value*/ | ||
330 | u32 port_sdma_config; /* User port SDMA config value */ | ||
331 | u32 port_serial_control; /* User port serial control value */ | ||
332 | u32 port_tx_queue_command; /* Port active Tx queues summary*/ | 324 | u32 port_tx_queue_command; /* Port active Tx queues summary*/ |
333 | u32 port_rx_queue_command; /* Port active Rx queues summary*/ | 325 | u32 port_rx_queue_command; /* Port active Rx queues summary*/ |
334 | 326 | ||
@@ -376,12 +368,12 @@ struct mv643xx_private { | |||
376 | spinlock_t lock; | 368 | spinlock_t lock; |
377 | /* Size of Tx Ring per queue */ | 369 | /* Size of Tx Ring per queue */ |
378 | unsigned int tx_ring_size; | 370 | unsigned int tx_ring_size; |
379 | /* Ammont of SKBs outstanding on Tx queue */ | 371 | /* Number of tx descriptors in use */ |
380 | unsigned int tx_ring_skbs; | 372 | unsigned int tx_desc_count; |
381 | /* Size of Rx Ring per queue */ | 373 | /* Size of Rx Ring per queue */ |
382 | unsigned int rx_ring_size; | 374 | unsigned int rx_ring_size; |
383 | /* Ammount of SKBs allocated to Rx Ring per queue */ | 375 | /* Number of rx descriptors in use */ |
384 | unsigned int rx_ring_skbs; | 376 | unsigned int rx_desc_count; |
385 | 377 | ||
386 | /* | 378 | /* |
387 | * rx_task used to fill RX ring out of bottom half context | 379 | * rx_task used to fill RX ring out of bottom half context |
@@ -398,6 +390,7 @@ struct mv643xx_private { | |||
398 | 390 | ||
399 | u32 rx_int_coal; | 391 | u32 rx_int_coal; |
400 | u32 tx_int_coal; | 392 | u32 tx_int_coal; |
393 | struct mii_if_info mii; | ||
401 | }; | 394 | }; |
402 | 395 | ||
403 | /* ethernet.h API list */ | 396 | /* ethernet.h API list */ |
@@ -405,7 +398,7 @@ struct mv643xx_private { | |||
405 | /* Port operation control routines */ | 398 | /* Port operation control routines */ |
406 | static void eth_port_init(struct mv643xx_private *mp); | 399 | static void eth_port_init(struct mv643xx_private *mp); |
407 | static void eth_port_reset(unsigned int eth_port_num); | 400 | static void eth_port_reset(unsigned int eth_port_num); |
408 | static void eth_port_start(struct mv643xx_private *mp); | 401 | static void eth_port_start(struct net_device *dev); |
409 | 402 | ||
410 | /* Port MAC address routines */ | 403 | /* Port MAC address routines */ |
411 | static void eth_port_uc_addr_set(unsigned int eth_port_num, | 404 | static void eth_port_uc_addr_set(unsigned int eth_port_num, |
diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c index 8f40368cf2e9..aaebd28a1920 100644 --- a/drivers/net/ne-h8300.c +++ b/drivers/net/ne-h8300.c | |||
@@ -27,6 +27,7 @@ static const char version1[] = | |||
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/netdevice.h> | 28 | #include <linux/netdevice.h> |
29 | #include <linux/etherdevice.h> | 29 | #include <linux/etherdevice.h> |
30 | #include <linux/jiffies.h> | ||
30 | 31 | ||
31 | #include <asm/system.h> | 32 | #include <asm/system.h> |
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
@@ -365,7 +366,7 @@ static void ne_reset_8390(struct net_device *dev) | |||
365 | 366 | ||
366 | /* This check _should_not_ be necessary, omit eventually. */ | 367 | /* This check _should_not_ be necessary, omit eventually. */ |
367 | while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) | 368 | while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) |
368 | if (jiffies - reset_start_time > 2*HZ/100) { | 369 | if (time_after(jiffies, reset_start_time + 2*HZ/100)) { |
369 | printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); | 370 | printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); |
370 | break; | 371 | break; |
371 | } | 372 | } |
@@ -580,7 +581,7 @@ retry: | |||
580 | #endif | 581 | #endif |
581 | 582 | ||
582 | while ((inb_p(NE_BASE + EN0_ISR) & ENISR_RDC) == 0) | 583 | while ((inb_p(NE_BASE + EN0_ISR) & ENISR_RDC) == 0) |
583 | if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ | 584 | if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ |
584 | printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); | 585 | printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); |
585 | ne_reset_8390(dev); | 586 | ne_reset_8390(dev); |
586 | NS8390_init(dev,1); | 587 | NS8390_init(dev,1); |
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 94f782d51f0f..08b218c5bfbc 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -50,6 +50,7 @@ static const char version2[] = | |||
50 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
51 | #include <linux/netdevice.h> | 51 | #include <linux/netdevice.h> |
52 | #include <linux/etherdevice.h> | 52 | #include <linux/etherdevice.h> |
53 | #include <linux/jiffies.h> | ||
53 | 54 | ||
54 | #include <asm/system.h> | 55 | #include <asm/system.h> |
55 | #include <asm/io.h> | 56 | #include <asm/io.h> |
@@ -341,7 +342,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr) | |||
341 | outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); | 342 | outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); |
342 | 343 | ||
343 | while ((inb_p(ioaddr + EN0_ISR) & ENISR_RESET) == 0) | 344 | while ((inb_p(ioaddr + EN0_ISR) & ENISR_RESET) == 0) |
344 | if (jiffies - reset_start_time > 2*HZ/100) { | 345 | if (time_after(jiffies, reset_start_time + 2*HZ/100)) { |
345 | if (bad_card) { | 346 | if (bad_card) { |
346 | printk(" (warning: no reset ack)"); | 347 | printk(" (warning: no reset ack)"); |
347 | break; | 348 | break; |
@@ -580,7 +581,7 @@ static void ne_reset_8390(struct net_device *dev) | |||
580 | 581 | ||
581 | /* This check _should_not_ be necessary, omit eventually. */ | 582 | /* This check _should_not_ be necessary, omit eventually. */ |
582 | while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) | 583 | while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) |
583 | if (jiffies - reset_start_time > 2*HZ/100) { | 584 | if (time_after(jiffies, reset_start_time + 2*HZ/100)) { |
584 | printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); | 585 | printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); |
585 | break; | 586 | break; |
586 | } | 587 | } |
@@ -787,7 +788,7 @@ retry: | |||
787 | #endif | 788 | #endif |
788 | 789 | ||
789 | while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) | 790 | while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) |
790 | if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ | 791 | if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ |
791 | printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); | 792 | printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); |
792 | ne_reset_8390(dev); | 793 | ne_reset_8390(dev); |
793 | NS8390_init(dev,1); | 794 | NS8390_init(dev,1); |
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c index e6df375a1d4b..2aa7b77f84f8 100644 --- a/drivers/net/ne2.c +++ b/drivers/net/ne2.c | |||
@@ -75,6 +75,7 @@ static const char *version = "ne2.c:v0.91 Nov 16 1998 Wim Dumon <wimpie@kotnet.o | |||
75 | #include <linux/etherdevice.h> | 75 | #include <linux/etherdevice.h> |
76 | #include <linux/skbuff.h> | 76 | #include <linux/skbuff.h> |
77 | #include <linux/bitops.h> | 77 | #include <linux/bitops.h> |
78 | #include <linux/jiffies.h> | ||
78 | 79 | ||
79 | #include <asm/system.h> | 80 | #include <asm/system.h> |
80 | #include <asm/io.h> | 81 | #include <asm/io.h> |
@@ -395,7 +396,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot) | |||
395 | outb(inb(base_addr + NE_RESET), base_addr + NE_RESET); | 396 | outb(inb(base_addr + NE_RESET), base_addr + NE_RESET); |
396 | 397 | ||
397 | while ((inb_p(base_addr + EN0_ISR) & ENISR_RESET) == 0) | 398 | while ((inb_p(base_addr + EN0_ISR) & ENISR_RESET) == 0) |
398 | if (jiffies - reset_start_time > 2*HZ/100) { | 399 | if (time_after(jiffies, reset_start_time + 2*HZ/100)) { |
399 | printk(" not found (no reset ack).\n"); | 400 | printk(" not found (no reset ack).\n"); |
400 | retval = -ENODEV; | 401 | retval = -ENODEV; |
401 | goto out; | 402 | goto out; |
@@ -548,7 +549,7 @@ static void ne_reset_8390(struct net_device *dev) | |||
548 | 549 | ||
549 | /* This check _should_not_ be necessary, omit eventually. */ | 550 | /* This check _should_not_ be necessary, omit eventually. */ |
550 | while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) | 551 | while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) |
551 | if (jiffies - reset_start_time > 2*HZ/100) { | 552 | if (time_after(jiffies, reset_start_time + 2*HZ/100)) { |
552 | printk("%s: ne_reset_8390() did not complete.\n", | 553 | printk("%s: ne_reset_8390() did not complete.\n", |
553 | dev->name); | 554 | dev->name); |
554 | break; | 555 | break; |
@@ -749,7 +750,7 @@ retry: | |||
749 | #endif | 750 | #endif |
750 | 751 | ||
751 | while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) | 752 | while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) |
752 | if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ | 753 | if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ |
753 | printk("%s: timeout waiting for Tx RDC.\n", dev->name); | 754 | printk("%s: timeout waiting for Tx RDC.\n", dev->name); |
754 | ne_reset_8390(dev); | 755 | ne_reset_8390(dev); |
755 | NS8390_init(dev,1); | 756 | NS8390_init(dev,1); |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index b0c3b6ab6263..253cf018dfba 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -116,6 +116,7 @@ | |||
116 | #include <linux/timer.h> | 116 | #include <linux/timer.h> |
117 | #include <linux/if_vlan.h> | 117 | #include <linux/if_vlan.h> |
118 | #include <linux/rtnetlink.h> | 118 | #include <linux/rtnetlink.h> |
119 | #include <linux/jiffies.h> | ||
119 | 120 | ||
120 | #include <asm/io.h> | 121 | #include <asm/io.h> |
121 | #include <asm/uaccess.h> | 122 | #include <asm/uaccess.h> |
@@ -1607,7 +1608,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab | |||
1607 | { | 1608 | { |
1608 | struct ns83820 *dev = PRIV(ndev); | 1609 | struct ns83820 *dev = PRIV(ndev); |
1609 | int timed_out = 0; | 1610 | int timed_out = 0; |
1610 | long start; | 1611 | unsigned long start; |
1611 | u32 status; | 1612 | u32 status; |
1612 | int loops = 0; | 1613 | int loops = 0; |
1613 | 1614 | ||
@@ -1625,7 +1626,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab | |||
1625 | break; | 1626 | break; |
1626 | if (status & fail) | 1627 | if (status & fail) |
1627 | break; | 1628 | break; |
1628 | if ((jiffies - start) >= HZ) { | 1629 | if (time_after_eq(jiffies, start + HZ)) { |
1629 | timed_out = 1; | 1630 | timed_out = 1; |
1630 | break; | 1631 | break; |
1631 | } | 1632 | } |
diff --git a/drivers/net/oaknet.c b/drivers/net/oaknet.c index 62167a29debe..d0f686d6eaaa 100644 --- a/drivers/net/oaknet.c +++ b/drivers/net/oaknet.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
21 | #include <linux/etherdevice.h> | 21 | #include <linux/etherdevice.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/jiffies.h> | ||
23 | 24 | ||
24 | #include <asm/board.h> | 25 | #include <asm/board.h> |
25 | #include <asm/io.h> | 26 | #include <asm/io.h> |
@@ -606,7 +607,7 @@ retry: | |||
606 | #endif | 607 | #endif |
607 | 608 | ||
608 | while ((ei_ibp(base + EN0_ISR) & ENISR_RDC) == 0) { | 609 | while ((ei_ibp(base + EN0_ISR) & ENISR_RDC) == 0) { |
609 | if (jiffies - start > OAKNET_WAIT) { | 610 | if (time_after(jiffies, start + OAKNET_WAIT)) { |
610 | printk("%s: timeout waiting for Tx RDC.\n", dev->name); | 611 | printk("%s: timeout waiting for Tx RDC.\n", dev->name); |
611 | oaknet_reset_8390(dev); | 612 | oaknet_reset_8390(dev); |
612 | NS8390_init(dev, TRUE); | 613 | NS8390_init(dev, TRUE); |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 1c3c9c666f74..c4abc9365f8e 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/if_arp.h> | 39 | #include <linux/if_arp.h> |
40 | #include <linux/ioport.h> | 40 | #include <linux/ioport.h> |
41 | #include <linux/bitops.h> | 41 | #include <linux/bitops.h> |
42 | #include <linux/jiffies.h> | ||
42 | 43 | ||
43 | #include <pcmcia/cs_types.h> | 44 | #include <pcmcia/cs_types.h> |
44 | #include <pcmcia/cs.h> | 45 | #include <pcmcia/cs.h> |
@@ -796,7 +797,7 @@ static void media_check(unsigned long arg) | |||
796 | media = inw(ioaddr+WN4_MEDIA) & 0xc810; | 797 | media = inw(ioaddr+WN4_MEDIA) & 0xc810; |
797 | 798 | ||
798 | /* Ignore collisions unless we've had no irq's recently */ | 799 | /* Ignore collisions unless we've had no irq's recently */ |
799 | if (jiffies - lp->last_irq < HZ) { | 800 | if (time_before(jiffies, lp->last_irq + HZ)) { |
800 | media &= ~0x0010; | 801 | media &= ~0x0010; |
801 | } else { | 802 | } else { |
802 | /* Try harder to detect carrier errors */ | 803 | /* Try harder to detect carrier errors */ |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index aa6540b39466..23659fd7c3a6 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/ppp_channel.h> | 30 | #include <linux/ppp_channel.h> |
31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/jiffies.h> | ||
33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
34 | #include <asm/string.h> | 35 | #include <asm/string.h> |
35 | 36 | ||
@@ -570,7 +571,7 @@ ppp_async_encode(struct asyncppp *ap) | |||
570 | * character if necessary. | 571 | * character if necessary. |
571 | */ | 572 | */ |
572 | if (islcp || flag_time == 0 | 573 | if (islcp || flag_time == 0 |
573 | || jiffies - ap->last_xmit >= flag_time) | 574 | || time_after_eq(jiffies, ap->last_xmit + flag_time)) |
574 | *buf++ = PPP_FLAG; | 575 | *buf++ = PPP_FLAG; |
575 | ap->last_xmit = jiffies; | 576 | ap->last_xmit = jiffies; |
576 | fcs = PPP_INITFCS; | 577 | fcs = PPP_INITFCS; |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 49b597cbc19a..da0d8a85acce 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -72,8 +72,8 @@ | |||
72 | static char s2io_driver_name[] = "Neterion"; | 72 | static char s2io_driver_name[] = "Neterion"; |
73 | static char s2io_driver_version[] = DRV_VERSION; | 73 | static char s2io_driver_version[] = DRV_VERSION; |
74 | 74 | ||
75 | int rxd_size[4] = {32,48,48,64}; | 75 | static int rxd_size[4] = {32,48,48,64}; |
76 | int rxd_count[4] = {127,85,85,63}; | 76 | static int rxd_count[4] = {127,85,85,63}; |
77 | 77 | ||
78 | static inline int RXD_IS_UP2DT(RxD_t *rxdp) | 78 | static inline int RXD_IS_UP2DT(RxD_t *rxdp) |
79 | { | 79 | { |
@@ -2127,7 +2127,7 @@ static void stop_nic(struct s2io_nic *nic) | |||
2127 | } | 2127 | } |
2128 | } | 2128 | } |
2129 | 2129 | ||
2130 | int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb) | 2130 | static int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb) |
2131 | { | 2131 | { |
2132 | struct net_device *dev = nic->dev; | 2132 | struct net_device *dev = nic->dev; |
2133 | struct sk_buff *frag_list; | 2133 | struct sk_buff *frag_list; |
@@ -2852,7 +2852,7 @@ static int wait_for_cmd_complete(nic_t * sp) | |||
2852 | * void. | 2852 | * void. |
2853 | */ | 2853 | */ |
2854 | 2854 | ||
2855 | void s2io_reset(nic_t * sp) | 2855 | static void s2io_reset(nic_t * sp) |
2856 | { | 2856 | { |
2857 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 2857 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
2858 | u64 val64; | 2858 | u64 val64; |
@@ -2940,7 +2940,7 @@ void s2io_reset(nic_t * sp) | |||
2940 | * SUCCESS on success and FAILURE on failure. | 2940 | * SUCCESS on success and FAILURE on failure. |
2941 | */ | 2941 | */ |
2942 | 2942 | ||
2943 | int s2io_set_swapper(nic_t * sp) | 2943 | static int s2io_set_swapper(nic_t * sp) |
2944 | { | 2944 | { |
2945 | struct net_device *dev = sp->dev; | 2945 | struct net_device *dev = sp->dev; |
2946 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 2946 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
@@ -3089,7 +3089,7 @@ static int wait_for_msix_trans(nic_t *nic, int i) | |||
3089 | return ret; | 3089 | return ret; |
3090 | } | 3090 | } |
3091 | 3091 | ||
3092 | void restore_xmsi_data(nic_t *nic) | 3092 | static void restore_xmsi_data(nic_t *nic) |
3093 | { | 3093 | { |
3094 | XENA_dev_config_t __iomem *bar0 = nic->bar0; | 3094 | XENA_dev_config_t __iomem *bar0 = nic->bar0; |
3095 | u64 val64; | 3095 | u64 val64; |
@@ -3180,7 +3180,7 @@ int s2io_enable_msi(nic_t *nic) | |||
3180 | return 0; | 3180 | return 0; |
3181 | } | 3181 | } |
3182 | 3182 | ||
3183 | int s2io_enable_msi_x(nic_t *nic) | 3183 | static int s2io_enable_msi_x(nic_t *nic) |
3184 | { | 3184 | { |
3185 | XENA_dev_config_t __iomem *bar0 = nic->bar0; | 3185 | XENA_dev_config_t __iomem *bar0 = nic->bar0; |
3186 | u64 tx_mat, rx_mat; | 3186 | u64 tx_mat, rx_mat; |
@@ -4128,7 +4128,7 @@ static void s2io_set_multicast(struct net_device *dev) | |||
4128 | * as defined in errno.h file on failure. | 4128 | * as defined in errno.h file on failure. |
4129 | */ | 4129 | */ |
4130 | 4130 | ||
4131 | int s2io_set_mac_addr(struct net_device *dev, u8 * addr) | 4131 | static int s2io_set_mac_addr(struct net_device *dev, u8 * addr) |
4132 | { | 4132 | { |
4133 | nic_t *sp = dev->priv; | 4133 | nic_t *sp = dev->priv; |
4134 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 4134 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
@@ -5713,7 +5713,7 @@ static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp) | |||
5713 | * void. | 5713 | * void. |
5714 | */ | 5714 | */ |
5715 | 5715 | ||
5716 | void s2io_link(nic_t * sp, int link) | 5716 | static void s2io_link(nic_t * sp, int link) |
5717 | { | 5717 | { |
5718 | struct net_device *dev = (struct net_device *) sp->dev; | 5718 | struct net_device *dev = (struct net_device *) sp->dev; |
5719 | 5719 | ||
@@ -5738,7 +5738,7 @@ void s2io_link(nic_t * sp, int link) | |||
5738 | * returns the revision ID of the device. | 5738 | * returns the revision ID of the device. |
5739 | */ | 5739 | */ |
5740 | 5740 | ||
5741 | int get_xena_rev_id(struct pci_dev *pdev) | 5741 | static int get_xena_rev_id(struct pci_dev *pdev) |
5742 | { | 5742 | { |
5743 | u8 id = 0; | 5743 | u8 id = 0; |
5744 | int ret; | 5744 | int ret; |
@@ -6343,7 +6343,7 @@ int __init s2io_starter(void) | |||
6343 | * Description: This function is the cleanup routine for the driver. It unregist * ers the driver. | 6343 | * Description: This function is the cleanup routine for the driver. It unregist * ers the driver. |
6344 | */ | 6344 | */ |
6345 | 6345 | ||
6346 | void s2io_closer(void) | 6346 | static void s2io_closer(void) |
6347 | { | 6347 | { |
6348 | pci_unregister_driver(&s2io_driver); | 6348 | pci_unregister_driver(&s2io_driver); |
6349 | DBG_PRINT(INIT_DBG, "cleanup done\n"); | 6349 | DBG_PRINT(INIT_DBG, "cleanup done\n"); |
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 852a6a899d07..68ae33651947 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -64,7 +64,7 @@ typedef enum xena_max_outstanding_splits { | |||
64 | #define INTR_DBG 4 | 64 | #define INTR_DBG 4 |
65 | 65 | ||
66 | /* Global variable that defines the present debug level of the driver. */ | 66 | /* Global variable that defines the present debug level of the driver. */ |
67 | int debug_level = ERR_DBG; /* Default level. */ | 67 | static int debug_level = ERR_DBG; |
68 | 68 | ||
69 | /* DEBUG message print. */ | 69 | /* DEBUG message print. */ |
70 | #define DBG_PRINT(dbg_level, args...) if(!(debug_level<dbg_level)) printk(args) | 70 | #define DBG_PRINT(dbg_level, args...) if(!(debug_level<dbg_level)) printk(args) |
@@ -268,7 +268,7 @@ typedef struct stat_block { | |||
268 | #define MAX_RX_RINGS 8 | 268 | #define MAX_RX_RINGS 8 |
269 | 269 | ||
270 | /* FIFO mappings for all possible number of fifos configured */ | 270 | /* FIFO mappings for all possible number of fifos configured */ |
271 | int fifo_map[][MAX_TX_FIFOS] = { | 271 | static int fifo_map[][MAX_TX_FIFOS] = { |
272 | {0, 0, 0, 0, 0, 0, 0, 0}, | 272 | {0, 0, 0, 0, 0, 0, 0, 0}, |
273 | {0, 0, 0, 0, 1, 1, 1, 1}, | 273 | {0, 0, 0, 0, 1, 1, 1, 1}, |
274 | {0, 0, 0, 1, 1, 1, 2, 2}, | 274 | {0, 0, 0, 1, 1, 1, 2, 2}, |
@@ -911,18 +911,16 @@ static void tx_intr_handler(fifo_info_t *fifo_data); | |||
911 | static void alarm_intr_handler(struct s2io_nic *sp); | 911 | static void alarm_intr_handler(struct s2io_nic *sp); |
912 | 912 | ||
913 | static int s2io_starter(void); | 913 | static int s2io_starter(void); |
914 | void s2io_closer(void); | ||
915 | static void s2io_tx_watchdog(struct net_device *dev); | 914 | static void s2io_tx_watchdog(struct net_device *dev); |
916 | static void s2io_tasklet(unsigned long dev_addr); | 915 | static void s2io_tasklet(unsigned long dev_addr); |
917 | static void s2io_set_multicast(struct net_device *dev); | 916 | static void s2io_set_multicast(struct net_device *dev); |
918 | static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp); | 917 | static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp); |
919 | void s2io_link(nic_t * sp, int link); | 918 | static void s2io_link(nic_t * sp, int link); |
920 | void s2io_reset(nic_t * sp); | ||
921 | #if defined(CONFIG_S2IO_NAPI) | 919 | #if defined(CONFIG_S2IO_NAPI) |
922 | static int s2io_poll(struct net_device *dev, int *budget); | 920 | static int s2io_poll(struct net_device *dev, int *budget); |
923 | #endif | 921 | #endif |
924 | static void s2io_init_pci(nic_t * sp); | 922 | static void s2io_init_pci(nic_t * sp); |
925 | int s2io_set_mac_addr(struct net_device *dev, u8 * addr); | 923 | static int s2io_set_mac_addr(struct net_device *dev, u8 * addr); |
926 | static void s2io_alarm_handle(unsigned long data); | 924 | static void s2io_alarm_handle(unsigned long data); |
927 | static int s2io_enable_msi(nic_t *nic); | 925 | static int s2io_enable_msi(nic_t *nic); |
928 | static irqreturn_t s2io_msi_handle(int irq, void *dev_id, struct pt_regs *regs); | 926 | static irqreturn_t s2io_msi_handle(int irq, void *dev_id, struct pt_regs *regs); |
@@ -930,14 +928,13 @@ static irqreturn_t | |||
930 | s2io_msix_ring_handle(int irq, void *dev_id, struct pt_regs *regs); | 928 | s2io_msix_ring_handle(int irq, void *dev_id, struct pt_regs *regs); |
931 | static irqreturn_t | 929 | static irqreturn_t |
932 | s2io_msix_fifo_handle(int irq, void *dev_id, struct pt_regs *regs); | 930 | s2io_msix_fifo_handle(int irq, void *dev_id, struct pt_regs *regs); |
933 | int s2io_enable_msi_x(nic_t *nic); | ||
934 | static irqreturn_t s2io_isr(int irq, void *dev_id, struct pt_regs *regs); | 931 | static irqreturn_t s2io_isr(int irq, void *dev_id, struct pt_regs *regs); |
935 | static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag); | 932 | static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag); |
936 | static struct ethtool_ops netdev_ethtool_ops; | 933 | static struct ethtool_ops netdev_ethtool_ops; |
937 | static void s2io_set_link(unsigned long data); | 934 | static void s2io_set_link(unsigned long data); |
938 | int s2io_set_swapper(nic_t * sp); | 935 | static int s2io_set_swapper(nic_t * sp); |
939 | static void s2io_card_down(nic_t *nic); | 936 | static void s2io_card_down(nic_t *nic); |
940 | static int s2io_card_up(nic_t *nic); | 937 | static int s2io_card_up(nic_t *nic); |
941 | int get_xena_rev_id(struct pci_dev *pdev); | 938 | static int get_xena_rev_id(struct pci_dev *pdev); |
942 | void restore_xmsi_data(nic_t *nic); | 939 | static void restore_xmsi_data(nic_t *nic); |
943 | #endif /* _S2IO_H */ | 940 | #endif /* _S2IO_H */ |
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c index 79dca398f3ac..bcef03feb2fc 100644 --- a/drivers/net/seeq8005.c +++ b/drivers/net/seeq8005.c | |||
@@ -46,6 +46,7 @@ static const char version[] = | |||
46 | #include <linux/etherdevice.h> | 46 | #include <linux/etherdevice.h> |
47 | #include <linux/skbuff.h> | 47 | #include <linux/skbuff.h> |
48 | #include <linux/bitops.h> | 48 | #include <linux/bitops.h> |
49 | #include <linux/jiffies.h> | ||
49 | 50 | ||
50 | #include <asm/system.h> | 51 | #include <asm/system.h> |
51 | #include <asm/io.h> | 52 | #include <asm/io.h> |
@@ -699,7 +700,7 @@ static void hardware_send_packet(struct net_device * dev, char *buf, int length) | |||
699 | int ioaddr = dev->base_addr; | 700 | int ioaddr = dev->base_addr; |
700 | int status = inw(SEEQ_STATUS); | 701 | int status = inw(SEEQ_STATUS); |
701 | int transmit_ptr = 0; | 702 | int transmit_ptr = 0; |
702 | int tmp; | 703 | unsigned long tmp; |
703 | 704 | ||
704 | if (net_debug>4) { | 705 | if (net_debug>4) { |
705 | printk("%s: send 0x%04x\n",dev->name,length); | 706 | printk("%s: send 0x%04x\n",dev->name,length); |
@@ -724,7 +725,7 @@ static void hardware_send_packet(struct net_device * dev, char *buf, int length) | |||
724 | 725 | ||
725 | /* drain FIFO */ | 726 | /* drain FIFO */ |
726 | tmp = jiffies; | 727 | tmp = jiffies; |
727 | while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && (jiffies - tmp < HZ)) | 728 | while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && time_before(jiffies, tmp + HZ)) |
728 | mb(); | 729 | mb(); |
729 | 730 | ||
730 | /* doit ! */ | 731 | /* doit ! */ |
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c index 221354eea21f..88e212043a43 100644 --- a/drivers/net/shaper.c +++ b/drivers/net/shaper.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #include <linux/if_arp.h> | 83 | #include <linux/if_arp.h> |
84 | #include <linux/init.h> | 84 | #include <linux/init.h> |
85 | #include <linux/if_shaper.h> | 85 | #include <linux/if_shaper.h> |
86 | #include <linux/jiffies.h> | ||
86 | 87 | ||
87 | #include <net/dst.h> | 88 | #include <net/dst.h> |
88 | #include <net/arp.h> | 89 | #include <net/arp.h> |
@@ -168,7 +169,7 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
168 | /* | 169 | /* |
169 | * Queue over time. Spill packet. | 170 | * Queue over time. Spill packet. |
170 | */ | 171 | */ |
171 | if(SHAPERCB(skb)->shapeclock-jiffies > SHAPER_LATENCY) { | 172 | if(time_after(SHAPERCB(skb)->shapeclock,jiffies + SHAPER_LATENCY)) { |
172 | dev_kfree_skb(skb); | 173 | dev_kfree_skb(skb); |
173 | shaper->stats.tx_dropped++; | 174 | shaper->stats.tx_dropped++; |
174 | } else | 175 | } else |
diff --git a/drivers/net/sk98lin/h/skaddr.h b/drivers/net/sk98lin/h/skaddr.h index 3a2ea4a4b539..423ad063d09b 100644 --- a/drivers/net/sk98lin/h/skaddr.h +++ b/drivers/net/sk98lin/h/skaddr.h | |||
@@ -236,18 +236,6 @@ extern int SkAddrMcClear( | |||
236 | SK_U32 PortNumber, | 236 | SK_U32 PortNumber, |
237 | int Flags); | 237 | int Flags); |
238 | 238 | ||
239 | extern int SkAddrXmacMcClear( | ||
240 | SK_AC *pAC, | ||
241 | SK_IOC IoC, | ||
242 | SK_U32 PortNumber, | ||
243 | int Flags); | ||
244 | |||
245 | extern int SkAddrGmacMcClear( | ||
246 | SK_AC *pAC, | ||
247 | SK_IOC IoC, | ||
248 | SK_U32 PortNumber, | ||
249 | int Flags); | ||
250 | |||
251 | extern int SkAddrMcAdd( | 239 | extern int SkAddrMcAdd( |
252 | SK_AC *pAC, | 240 | SK_AC *pAC, |
253 | SK_IOC IoC, | 241 | SK_IOC IoC, |
@@ -255,35 +243,11 @@ extern int SkAddrMcAdd( | |||
255 | SK_MAC_ADDR *pMc, | 243 | SK_MAC_ADDR *pMc, |
256 | int Flags); | 244 | int Flags); |
257 | 245 | ||
258 | extern int SkAddrXmacMcAdd( | ||
259 | SK_AC *pAC, | ||
260 | SK_IOC IoC, | ||
261 | SK_U32 PortNumber, | ||
262 | SK_MAC_ADDR *pMc, | ||
263 | int Flags); | ||
264 | |||
265 | extern int SkAddrGmacMcAdd( | ||
266 | SK_AC *pAC, | ||
267 | SK_IOC IoC, | ||
268 | SK_U32 PortNumber, | ||
269 | SK_MAC_ADDR *pMc, | ||
270 | int Flags); | ||
271 | |||
272 | extern int SkAddrMcUpdate( | 246 | extern int SkAddrMcUpdate( |
273 | SK_AC *pAC, | 247 | SK_AC *pAC, |
274 | SK_IOC IoC, | 248 | SK_IOC IoC, |
275 | SK_U32 PortNumber); | 249 | SK_U32 PortNumber); |
276 | 250 | ||
277 | extern int SkAddrXmacMcUpdate( | ||
278 | SK_AC *pAC, | ||
279 | SK_IOC IoC, | ||
280 | SK_U32 PortNumber); | ||
281 | |||
282 | extern int SkAddrGmacMcUpdate( | ||
283 | SK_AC *pAC, | ||
284 | SK_IOC IoC, | ||
285 | SK_U32 PortNumber); | ||
286 | |||
287 | extern int SkAddrOverride( | 251 | extern int SkAddrOverride( |
288 | SK_AC *pAC, | 252 | SK_AC *pAC, |
289 | SK_IOC IoC, | 253 | SK_IOC IoC, |
@@ -297,18 +261,6 @@ extern int SkAddrPromiscuousChange( | |||
297 | SK_U32 PortNumber, | 261 | SK_U32 PortNumber, |
298 | int NewPromMode); | 262 | int NewPromMode); |
299 | 263 | ||
300 | extern int SkAddrXmacPromiscuousChange( | ||
301 | SK_AC *pAC, | ||
302 | SK_IOC IoC, | ||
303 | SK_U32 PortNumber, | ||
304 | int NewPromMode); | ||
305 | |||
306 | extern int SkAddrGmacPromiscuousChange( | ||
307 | SK_AC *pAC, | ||
308 | SK_IOC IoC, | ||
309 | SK_U32 PortNumber, | ||
310 | int NewPromMode); | ||
311 | |||
312 | #ifndef SK_SLIM | 264 | #ifndef SK_SLIM |
313 | extern int SkAddrSwap( | 265 | extern int SkAddrSwap( |
314 | SK_AC *pAC, | 266 | SK_AC *pAC, |
diff --git a/drivers/net/sk98lin/h/skcsum.h b/drivers/net/sk98lin/h/skcsum.h index 2b94adb93331..6e256bd9a28c 100644 --- a/drivers/net/sk98lin/h/skcsum.h +++ b/drivers/net/sk98lin/h/skcsum.h | |||
@@ -203,12 +203,6 @@ extern SKCS_STATUS SkCsGetReceiveInfo( | |||
203 | unsigned Checksum2, | 203 | unsigned Checksum2, |
204 | int NetNumber); | 204 | int NetNumber); |
205 | 205 | ||
206 | extern void SkCsGetSendInfo( | ||
207 | SK_AC *pAc, | ||
208 | void *pIpHeader, | ||
209 | SKCS_PACKET_INFO *pPacketInfo, | ||
210 | int NetNumber); | ||
211 | |||
212 | extern void SkCsSetReceiveFlags( | 206 | extern void SkCsSetReceiveFlags( |
213 | SK_AC *pAc, | 207 | SK_AC *pAc, |
214 | unsigned ReceiveFlags, | 208 | unsigned ReceiveFlags, |
diff --git a/drivers/net/sk98lin/h/skgeinit.h b/drivers/net/sk98lin/h/skgeinit.h index 184f47c5a60f..143e635ec24d 100644 --- a/drivers/net/sk98lin/h/skgeinit.h +++ b/drivers/net/sk98lin/h/skgeinit.h | |||
@@ -464,12 +464,6 @@ typedef struct s_GeInit { | |||
464 | /* | 464 | /* |
465 | * public functions in skgeinit.c | 465 | * public functions in skgeinit.c |
466 | */ | 466 | */ |
467 | extern void SkGePollRxD( | ||
468 | SK_AC *pAC, | ||
469 | SK_IOC IoC, | ||
470 | int Port, | ||
471 | SK_BOOL PollRxD); | ||
472 | |||
473 | extern void SkGePollTxD( | 467 | extern void SkGePollTxD( |
474 | SK_AC *pAC, | 468 | SK_AC *pAC, |
475 | SK_IOC IoC, | 469 | SK_IOC IoC, |
@@ -522,10 +516,6 @@ extern void SkGeXmitLED( | |||
522 | int Led, | 516 | int Led, |
523 | int Mode); | 517 | int Mode); |
524 | 518 | ||
525 | extern void SkGeInitRamIface( | ||
526 | SK_AC *pAC, | ||
527 | SK_IOC IoC); | ||
528 | |||
529 | extern int SkGeInitAssignRamToQueues( | 519 | extern int SkGeInitAssignRamToQueues( |
530 | SK_AC *pAC, | 520 | SK_AC *pAC, |
531 | int ActivePort, | 521 | int ActivePort, |
@@ -549,11 +539,6 @@ extern void SkMacHardRst( | |||
549 | SK_IOC IoC, | 539 | SK_IOC IoC, |
550 | int Port); | 540 | int Port); |
551 | 541 | ||
552 | extern void SkMacClearRst( | ||
553 | SK_AC *pAC, | ||
554 | SK_IOC IoC, | ||
555 | int Port); | ||
556 | |||
557 | extern void SkXmInitMac( | 542 | extern void SkXmInitMac( |
558 | SK_AC *pAC, | 543 | SK_AC *pAC, |
559 | SK_IOC IoC, | 544 | SK_IOC IoC, |
@@ -580,11 +565,6 @@ extern void SkMacFlushTxFifo( | |||
580 | SK_IOC IoC, | 565 | SK_IOC IoC, |
581 | int Port); | 566 | int Port); |
582 | 567 | ||
583 | extern void SkMacFlushRxFifo( | ||
584 | SK_AC *pAC, | ||
585 | SK_IOC IoC, | ||
586 | int Port); | ||
587 | |||
588 | extern void SkMacIrq( | 568 | extern void SkMacIrq( |
589 | SK_AC *pAC, | 569 | SK_AC *pAC, |
590 | SK_IOC IoC, | 570 | SK_IOC IoC, |
@@ -601,12 +581,6 @@ extern void SkMacAutoNegLipaPhy( | |||
601 | int Port, | 581 | int Port, |
602 | SK_U16 IStatus); | 582 | SK_U16 IStatus); |
603 | 583 | ||
604 | extern void SkMacSetRxTxEn( | ||
605 | SK_AC *pAC, | ||
606 | SK_IOC IoC, | ||
607 | int Port, | ||
608 | int Para); | ||
609 | |||
610 | extern int SkMacRxTxEnable( | 584 | extern int SkMacRxTxEnable( |
611 | SK_AC *pAC, | 585 | SK_AC *pAC, |
612 | SK_IOC IoC, | 586 | SK_IOC IoC, |
@@ -659,16 +633,6 @@ extern void SkXmClrExactAddr( | |||
659 | int StartNum, | 633 | int StartNum, |
660 | int StopNum); | 634 | int StopNum); |
661 | 635 | ||
662 | extern void SkXmInitDupMd( | ||
663 | SK_AC *pAC, | ||
664 | SK_IOC IoC, | ||
665 | int Port); | ||
666 | |||
667 | extern void SkXmInitPauseMd( | ||
668 | SK_AC *pAC, | ||
669 | SK_IOC IoC, | ||
670 | int Port); | ||
671 | |||
672 | extern void SkXmAutoNegLipaXmac( | 636 | extern void SkXmAutoNegLipaXmac( |
673 | SK_AC *pAC, | 637 | SK_AC *pAC, |
674 | SK_IOC IoC, | 638 | SK_IOC IoC, |
@@ -729,17 +693,6 @@ extern int SkGmCableDiagStatus( | |||
729 | int Port, | 693 | int Port, |
730 | SK_BOOL StartTest); | 694 | SK_BOOL StartTest); |
731 | 695 | ||
732 | extern int SkGmEnterLowPowerMode( | ||
733 | SK_AC *pAC, | ||
734 | SK_IOC IoC, | ||
735 | int Port, | ||
736 | SK_U8 Mode); | ||
737 | |||
738 | extern int SkGmLeaveLowPowerMode( | ||
739 | SK_AC *pAC, | ||
740 | SK_IOC IoC, | ||
741 | int Port); | ||
742 | |||
743 | #ifdef SK_DIAG | 696 | #ifdef SK_DIAG |
744 | extern void SkGePhyRead( | 697 | extern void SkGePhyRead( |
745 | SK_AC *pAC, | 698 | SK_AC *pAC, |
@@ -782,7 +735,6 @@ extern void SkXmSendCont( | |||
782 | /* | 735 | /* |
783 | * public functions in skgeinit.c | 736 | * public functions in skgeinit.c |
784 | */ | 737 | */ |
785 | extern void SkGePollRxD(); | ||
786 | extern void SkGePollTxD(); | 738 | extern void SkGePollTxD(); |
787 | extern void SkGeYellowLED(); | 739 | extern void SkGeYellowLED(); |
788 | extern int SkGeCfgSync(); | 740 | extern int SkGeCfgSync(); |
@@ -792,7 +744,6 @@ extern int SkGeInit(); | |||
792 | extern void SkGeDeInit(); | 744 | extern void SkGeDeInit(); |
793 | extern int SkGeInitPort(); | 745 | extern int SkGeInitPort(); |
794 | extern void SkGeXmitLED(); | 746 | extern void SkGeXmitLED(); |
795 | extern void SkGeInitRamIface(); | ||
796 | extern int SkGeInitAssignRamToQueues(); | 747 | extern int SkGeInitAssignRamToQueues(); |
797 | 748 | ||
798 | /* | 749 | /* |
@@ -801,18 +752,15 @@ extern int SkGeInitAssignRamToQueues(); | |||
801 | extern void SkMacRxTxDisable(); | 752 | extern void SkMacRxTxDisable(); |
802 | extern void SkMacSoftRst(); | 753 | extern void SkMacSoftRst(); |
803 | extern void SkMacHardRst(); | 754 | extern void SkMacHardRst(); |
804 | extern void SkMacClearRst(); | ||
805 | extern void SkMacInitPhy(); | 755 | extern void SkMacInitPhy(); |
806 | extern int SkMacRxTxEnable(); | 756 | extern int SkMacRxTxEnable(); |
807 | extern void SkMacPromiscMode(); | 757 | extern void SkMacPromiscMode(); |
808 | extern void SkMacHashing(); | 758 | extern void SkMacHashing(); |
809 | extern void SkMacIrqDisable(); | 759 | extern void SkMacIrqDisable(); |
810 | extern void SkMacFlushTxFifo(); | 760 | extern void SkMacFlushTxFifo(); |
811 | extern void SkMacFlushRxFifo(); | ||
812 | extern void SkMacIrq(); | 761 | extern void SkMacIrq(); |
813 | extern int SkMacAutoNegDone(); | 762 | extern int SkMacAutoNegDone(); |
814 | extern void SkMacAutoNegLipaPhy(); | 763 | extern void SkMacAutoNegLipaPhy(); |
815 | extern void SkMacSetRxTxEn(); | ||
816 | extern void SkXmInitMac(); | 764 | extern void SkXmInitMac(); |
817 | extern void SkXmPhyRead(); | 765 | extern void SkXmPhyRead(); |
818 | extern void SkXmPhyWrite(); | 766 | extern void SkXmPhyWrite(); |
@@ -820,8 +768,6 @@ extern void SkGmInitMac(); | |||
820 | extern void SkGmPhyRead(); | 768 | extern void SkGmPhyRead(); |
821 | extern void SkGmPhyWrite(); | 769 | extern void SkGmPhyWrite(); |
822 | extern void SkXmClrExactAddr(); | 770 | extern void SkXmClrExactAddr(); |
823 | extern void SkXmInitDupMd(); | ||
824 | extern void SkXmInitPauseMd(); | ||
825 | extern void SkXmAutoNegLipaXmac(); | 771 | extern void SkXmAutoNegLipaXmac(); |
826 | extern int SkXmUpdateStats(); | 772 | extern int SkXmUpdateStats(); |
827 | extern int SkGmUpdateStats(); | 773 | extern int SkGmUpdateStats(); |
@@ -832,8 +778,6 @@ extern int SkGmResetCounter(); | |||
832 | extern int SkXmOverflowStatus(); | 778 | extern int SkXmOverflowStatus(); |
833 | extern int SkGmOverflowStatus(); | 779 | extern int SkGmOverflowStatus(); |
834 | extern int SkGmCableDiagStatus(); | 780 | extern int SkGmCableDiagStatus(); |
835 | extern int SkGmEnterLowPowerMode(); | ||
836 | extern int SkGmLeaveLowPowerMode(); | ||
837 | 781 | ||
838 | #ifdef SK_DIAG | 782 | #ifdef SK_DIAG |
839 | extern void SkGePhyRead(); | 783 | extern void SkGePhyRead(); |
diff --git a/drivers/net/sk98lin/h/skgepnmi.h b/drivers/net/sk98lin/h/skgepnmi.h index 3b2773e6f822..1ed214ccb253 100644 --- a/drivers/net/sk98lin/h/skgepnmi.h +++ b/drivers/net/sk98lin/h/skgepnmi.h | |||
@@ -946,10 +946,6 @@ typedef struct s_PnmiData { | |||
946 | * Function prototypes | 946 | * Function prototypes |
947 | */ | 947 | */ |
948 | extern int SkPnmiInit(SK_AC *pAC, SK_IOC IoC, int Level); | 948 | extern int SkPnmiInit(SK_AC *pAC, SK_IOC IoC, int Level); |
949 | extern int SkPnmiGetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void* pBuf, | ||
950 | unsigned int* pLen, SK_U32 Instance, SK_U32 NetIndex); | ||
951 | extern int SkPnmiPreSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, | ||
952 | void* pBuf, unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex); | ||
953 | extern int SkPnmiSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void* pBuf, | 949 | extern int SkPnmiSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void* pBuf, |
954 | unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex); | 950 | unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex); |
955 | extern int SkPnmiGetStruct(SK_AC *pAC, SK_IOC IoC, void* pBuf, | 951 | extern int SkPnmiGetStruct(SK_AC *pAC, SK_IOC IoC, void* pBuf, |
diff --git a/drivers/net/sk98lin/h/skgesirq.h b/drivers/net/sk98lin/h/skgesirq.h index b486bd9b6628..3eec6274e413 100644 --- a/drivers/net/sk98lin/h/skgesirq.h +++ b/drivers/net/sk98lin/h/skgesirq.h | |||
@@ -105,7 +105,6 @@ | |||
105 | 105 | ||
106 | extern void SkGeSirqIsr(SK_AC *pAC, SK_IOC IoC, SK_U32 Istatus); | 106 | extern void SkGeSirqIsr(SK_AC *pAC, SK_IOC IoC, SK_U32 Istatus); |
107 | extern int SkGeSirqEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para); | 107 | extern int SkGeSirqEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para); |
108 | extern void SkHWLinkUp(SK_AC *pAC, SK_IOC IoC, int Port); | ||
109 | extern void SkHWLinkDown(SK_AC *pAC, SK_IOC IoC, int Port); | 108 | extern void SkHWLinkDown(SK_AC *pAC, SK_IOC IoC, int Port); |
110 | 109 | ||
111 | #endif /* _INC_SKGESIRQ_H_ */ | 110 | #endif /* _INC_SKGESIRQ_H_ */ |
diff --git a/drivers/net/sk98lin/h/ski2c.h b/drivers/net/sk98lin/h/ski2c.h index 598bb42ccc3d..6a63f4a15de6 100644 --- a/drivers/net/sk98lin/h/ski2c.h +++ b/drivers/net/sk98lin/h/ski2c.h | |||
@@ -162,9 +162,6 @@ typedef struct s_I2c { | |||
162 | } SK_I2C; | 162 | } SK_I2C; |
163 | 163 | ||
164 | extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level); | 164 | extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level); |
165 | extern int SkI2cWrite(SK_AC *pAC, SK_IOC IoC, SK_U32 Data, int Dev, int Size, | ||
166 | int Reg, int Burst); | ||
167 | extern int SkI2cReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen); | ||
168 | #ifdef SK_DIAG | 165 | #ifdef SK_DIAG |
169 | extern SK_U32 SkI2cRead(SK_AC *pAC, SK_IOC IoC, int Dev, int Size, int Reg, | 166 | extern SK_U32 SkI2cRead(SK_AC *pAC, SK_IOC IoC, int Dev, int Size, int Reg, |
170 | int Burst); | 167 | int Burst); |
diff --git a/drivers/net/sk98lin/h/skvpd.h b/drivers/net/sk98lin/h/skvpd.h index daa9a8d154fc..fdd9e48e8040 100644 --- a/drivers/net/sk98lin/h/skvpd.h +++ b/drivers/net/sk98lin/h/skvpd.h | |||
@@ -183,14 +183,6 @@ extern SK_U32 VpdReadDWord( | |||
183 | int addr); | 183 | int addr); |
184 | #endif /* SKDIAG */ | 184 | #endif /* SKDIAG */ |
185 | 185 | ||
186 | extern int VpdSetupPara( | ||
187 | SK_AC *pAC, | ||
188 | const char *key, | ||
189 | const char *buf, | ||
190 | int len, | ||
191 | int type, | ||
192 | int op); | ||
193 | |||
194 | extern SK_VPD_STATUS *VpdStat( | 186 | extern SK_VPD_STATUS *VpdStat( |
195 | SK_AC *pAC, | 187 | SK_AC *pAC, |
196 | SK_IOC IoC); | 188 | SK_IOC IoC); |
@@ -227,11 +219,6 @@ extern int VpdUpdate( | |||
227 | SK_AC *pAC, | 219 | SK_AC *pAC, |
228 | SK_IOC IoC); | 220 | SK_IOC IoC); |
229 | 221 | ||
230 | extern void VpdErrLog( | ||
231 | SK_AC *pAC, | ||
232 | SK_IOC IoC, | ||
233 | char *msg); | ||
234 | |||
235 | #ifdef SKDIAG | 222 | #ifdef SKDIAG |
236 | extern int VpdReadBlock( | 223 | extern int VpdReadBlock( |
237 | SK_AC *pAC, | 224 | SK_AC *pAC, |
@@ -249,7 +236,6 @@ extern int VpdWriteBlock( | |||
249 | #endif /* SKDIAG */ | 236 | #endif /* SKDIAG */ |
250 | #else /* SK_KR_PROTO */ | 237 | #else /* SK_KR_PROTO */ |
251 | extern SK_U32 VpdReadDWord(); | 238 | extern SK_U32 VpdReadDWord(); |
252 | extern int VpdSetupPara(); | ||
253 | extern SK_VPD_STATUS *VpdStat(); | 239 | extern SK_VPD_STATUS *VpdStat(); |
254 | extern int VpdKeys(); | 240 | extern int VpdKeys(); |
255 | extern int VpdRead(); | 241 | extern int VpdRead(); |
@@ -257,7 +243,6 @@ extern SK_BOOL VpdMayWrite(); | |||
257 | extern int VpdWrite(); | 243 | extern int VpdWrite(); |
258 | extern int VpdDelete(); | 244 | extern int VpdDelete(); |
259 | extern int VpdUpdate(); | 245 | extern int VpdUpdate(); |
260 | extern void VpdErrLog(); | ||
261 | #endif /* SK_KR_PROTO */ | 246 | #endif /* SK_KR_PROTO */ |
262 | 247 | ||
263 | #endif /* __INC_SKVPD_H_ */ | 248 | #endif /* __INC_SKVPD_H_ */ |
diff --git a/drivers/net/sk98lin/skaddr.c b/drivers/net/sk98lin/skaddr.c index a7e25edc7fc4..6e6c56aa6d6f 100644 --- a/drivers/net/sk98lin/skaddr.c +++ b/drivers/net/sk98lin/skaddr.c | |||
@@ -87,6 +87,21 @@ static const SK_U16 OnesHash[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}; | |||
87 | static int Next0[SK_MAX_MACS] = {0}; | 87 | static int Next0[SK_MAX_MACS] = {0}; |
88 | #endif /* DEBUG */ | 88 | #endif /* DEBUG */ |
89 | 89 | ||
90 | static int SkAddrGmacMcAdd(SK_AC *pAC, SK_IOC IoC, SK_U32 PortNumber, | ||
91 | SK_MAC_ADDR *pMc, int Flags); | ||
92 | static int SkAddrGmacMcClear(SK_AC *pAC, SK_IOC IoC, SK_U32 PortNumber, | ||
93 | int Flags); | ||
94 | static int SkAddrGmacMcUpdate(SK_AC *pAC, SK_IOC IoC, SK_U32 PortNumber); | ||
95 | static int SkAddrGmacPromiscuousChange(SK_AC *pAC, SK_IOC IoC, | ||
96 | SK_U32 PortNumber, int NewPromMode); | ||
97 | static int SkAddrXmacMcAdd(SK_AC *pAC, SK_IOC IoC, SK_U32 PortNumber, | ||
98 | SK_MAC_ADDR *pMc, int Flags); | ||
99 | static int SkAddrXmacMcClear(SK_AC *pAC, SK_IOC IoC, SK_U32 PortNumber, | ||
100 | int Flags); | ||
101 | static int SkAddrXmacMcUpdate(SK_AC *pAC, SK_IOC IoC, SK_U32 PortNumber); | ||
102 | static int SkAddrXmacPromiscuousChange(SK_AC *pAC, SK_IOC IoC, | ||
103 | SK_U32 PortNumber, int NewPromMode); | ||
104 | |||
90 | /* functions ******************************************************************/ | 105 | /* functions ******************************************************************/ |
91 | 106 | ||
92 | /****************************************************************************** | 107 | /****************************************************************************** |
@@ -372,7 +387,7 @@ int Flags) /* permanent/non-perm, sw-only */ | |||
372 | * SK_ADDR_SUCCESS | 387 | * SK_ADDR_SUCCESS |
373 | * SK_ADDR_ILLEGAL_PORT | 388 | * SK_ADDR_ILLEGAL_PORT |
374 | */ | 389 | */ |
375 | int SkAddrXmacMcClear( | 390 | static int SkAddrXmacMcClear( |
376 | SK_AC *pAC, /* adapter context */ | 391 | SK_AC *pAC, /* adapter context */ |
377 | SK_IOC IoC, /* I/O context */ | 392 | SK_IOC IoC, /* I/O context */ |
378 | SK_U32 PortNumber, /* Index of affected port */ | 393 | SK_U32 PortNumber, /* Index of affected port */ |
@@ -429,7 +444,7 @@ int Flags) /* permanent/non-perm, sw-only */ | |||
429 | * SK_ADDR_SUCCESS | 444 | * SK_ADDR_SUCCESS |
430 | * SK_ADDR_ILLEGAL_PORT | 445 | * SK_ADDR_ILLEGAL_PORT |
431 | */ | 446 | */ |
432 | int SkAddrGmacMcClear( | 447 | static int SkAddrGmacMcClear( |
433 | SK_AC *pAC, /* adapter context */ | 448 | SK_AC *pAC, /* adapter context */ |
434 | SK_IOC IoC, /* I/O context */ | 449 | SK_IOC IoC, /* I/O context */ |
435 | SK_U32 PortNumber, /* Index of affected port */ | 450 | SK_U32 PortNumber, /* Index of affected port */ |
@@ -519,7 +534,7 @@ int Flags) /* permanent/non-perm, sw-only */ | |||
519 | * Returns: | 534 | * Returns: |
520 | * Hash value of multicast address. | 535 | * Hash value of multicast address. |
521 | */ | 536 | */ |
522 | SK_U32 SkXmacMcHash( | 537 | static SK_U32 SkXmacMcHash( |
523 | unsigned char *pMc) /* Multicast address */ | 538 | unsigned char *pMc) /* Multicast address */ |
524 | { | 539 | { |
525 | SK_U32 Idx; | 540 | SK_U32 Idx; |
@@ -557,7 +572,7 @@ unsigned char *pMc) /* Multicast address */ | |||
557 | * Returns: | 572 | * Returns: |
558 | * Hash value of multicast address. | 573 | * Hash value of multicast address. |
559 | */ | 574 | */ |
560 | SK_U32 SkGmacMcHash( | 575 | static SK_U32 SkGmacMcHash( |
561 | unsigned char *pMc) /* Multicast address */ | 576 | unsigned char *pMc) /* Multicast address */ |
562 | { | 577 | { |
563 | SK_U32 Data; | 578 | SK_U32 Data; |
@@ -672,7 +687,7 @@ int Flags) /* permanent/non-permanent */ | |||
672 | * SK_MC_ILLEGAL_ADDRESS | 687 | * SK_MC_ILLEGAL_ADDRESS |
673 | * SK_MC_RLMT_OVERFLOW | 688 | * SK_MC_RLMT_OVERFLOW |
674 | */ | 689 | */ |
675 | int SkAddrXmacMcAdd( | 690 | static int SkAddrXmacMcAdd( |
676 | SK_AC *pAC, /* adapter context */ | 691 | SK_AC *pAC, /* adapter context */ |
677 | SK_IOC IoC, /* I/O context */ | 692 | SK_IOC IoC, /* I/O context */ |
678 | SK_U32 PortNumber, /* Port Number */ | 693 | SK_U32 PortNumber, /* Port Number */ |
@@ -778,7 +793,7 @@ int Flags) /* permanent/non-permanent */ | |||
778 | * SK_MC_FILTERING_INEXACT | 793 | * SK_MC_FILTERING_INEXACT |
779 | * SK_MC_ILLEGAL_ADDRESS | 794 | * SK_MC_ILLEGAL_ADDRESS |
780 | */ | 795 | */ |
781 | int SkAddrGmacMcAdd( | 796 | static int SkAddrGmacMcAdd( |
782 | SK_AC *pAC, /* adapter context */ | 797 | SK_AC *pAC, /* adapter context */ |
783 | SK_IOC IoC, /* I/O context */ | 798 | SK_IOC IoC, /* I/O context */ |
784 | SK_U32 PortNumber, /* Port Number */ | 799 | SK_U32 PortNumber, /* Port Number */ |
@@ -937,7 +952,7 @@ SK_U32 PortNumber) /* Port Number */ | |||
937 | * SK_MC_FILTERING_INEXACT | 952 | * SK_MC_FILTERING_INEXACT |
938 | * SK_ADDR_ILLEGAL_PORT | 953 | * SK_ADDR_ILLEGAL_PORT |
939 | */ | 954 | */ |
940 | int SkAddrXmacMcUpdate( | 955 | static int SkAddrXmacMcUpdate( |
941 | SK_AC *pAC, /* adapter context */ | 956 | SK_AC *pAC, /* adapter context */ |
942 | SK_IOC IoC, /* I/O context */ | 957 | SK_IOC IoC, /* I/O context */ |
943 | SK_U32 PortNumber) /* Port Number */ | 958 | SK_U32 PortNumber) /* Port Number */ |
@@ -1082,7 +1097,7 @@ SK_U32 PortNumber) /* Port Number */ | |||
1082 | * SK_MC_FILTERING_INEXACT | 1097 | * SK_MC_FILTERING_INEXACT |
1083 | * SK_ADDR_ILLEGAL_PORT | 1098 | * SK_ADDR_ILLEGAL_PORT |
1084 | */ | 1099 | */ |
1085 | int SkAddrGmacMcUpdate( | 1100 | static int SkAddrGmacMcUpdate( |
1086 | SK_AC *pAC, /* adapter context */ | 1101 | SK_AC *pAC, /* adapter context */ |
1087 | SK_IOC IoC, /* I/O context */ | 1102 | SK_IOC IoC, /* I/O context */ |
1088 | SK_U32 PortNumber) /* Port Number */ | 1103 | SK_U32 PortNumber) /* Port Number */ |
@@ -1468,7 +1483,7 @@ int NewPromMode) /* new promiscuous mode */ | |||
1468 | * SK_ADDR_SUCCESS | 1483 | * SK_ADDR_SUCCESS |
1469 | * SK_ADDR_ILLEGAL_PORT | 1484 | * SK_ADDR_ILLEGAL_PORT |
1470 | */ | 1485 | */ |
1471 | int SkAddrXmacPromiscuousChange( | 1486 | static int SkAddrXmacPromiscuousChange( |
1472 | SK_AC *pAC, /* adapter context */ | 1487 | SK_AC *pAC, /* adapter context */ |
1473 | SK_IOC IoC, /* I/O context */ | 1488 | SK_IOC IoC, /* I/O context */ |
1474 | SK_U32 PortNumber, /* port whose promiscuous mode changes */ | 1489 | SK_U32 PortNumber, /* port whose promiscuous mode changes */ |
@@ -1585,7 +1600,7 @@ int NewPromMode) /* new promiscuous mode */ | |||
1585 | * SK_ADDR_SUCCESS | 1600 | * SK_ADDR_SUCCESS |
1586 | * SK_ADDR_ILLEGAL_PORT | 1601 | * SK_ADDR_ILLEGAL_PORT |
1587 | */ | 1602 | */ |
1588 | int SkAddrGmacPromiscuousChange( | 1603 | static int SkAddrGmacPromiscuousChange( |
1589 | SK_AC *pAC, /* adapter context */ | 1604 | SK_AC *pAC, /* adapter context */ |
1590 | SK_IOC IoC, /* I/O context */ | 1605 | SK_IOC IoC, /* I/O context */ |
1591 | SK_U32 PortNumber, /* port whose promiscuous mode changes */ | 1606 | SK_U32 PortNumber, /* port whose promiscuous mode changes */ |
diff --git a/drivers/net/sk98lin/skgeinit.c b/drivers/net/sk98lin/skgeinit.c index 6cb49dd02251..67f1d6a5c15d 100644 --- a/drivers/net/sk98lin/skgeinit.c +++ b/drivers/net/sk98lin/skgeinit.c | |||
@@ -59,34 +59,6 @@ static struct s_Config OemConfig = { | |||
59 | 59 | ||
60 | /****************************************************************************** | 60 | /****************************************************************************** |
61 | * | 61 | * |
62 | * SkGePollRxD() - Enable / Disable Descriptor Polling of RxD Ring | ||
63 | * | ||
64 | * Description: | ||
65 | * Enable or disable the descriptor polling of the receive descriptor | ||
66 | * ring (RxD) for port 'Port'. | ||
67 | * The new configuration is *not* saved over any SkGeStopPort() and | ||
68 | * SkGeInitPort() calls. | ||
69 | * | ||
70 | * Returns: | ||
71 | * nothing | ||
72 | */ | ||
73 | void SkGePollRxD( | ||
74 | SK_AC *pAC, /* adapter context */ | ||
75 | SK_IOC IoC, /* IO context */ | ||
76 | int Port, /* Port Index (MAC_1 + n) */ | ||
77 | SK_BOOL PollRxD) /* SK_TRUE (enable pol.), SK_FALSE (disable pol.) */ | ||
78 | { | ||
79 | SK_GEPORT *pPrt; | ||
80 | |||
81 | pPrt = &pAC->GIni.GP[Port]; | ||
82 | |||
83 | SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), (PollRxD) ? | ||
84 | CSR_ENA_POL : CSR_DIS_POL); | ||
85 | } /* SkGePollRxD */ | ||
86 | |||
87 | |||
88 | /****************************************************************************** | ||
89 | * | ||
90 | * SkGePollTxD() - Enable / Disable Descriptor Polling of TxD Rings | 62 | * SkGePollTxD() - Enable / Disable Descriptor Polling of TxD Rings |
91 | * | 63 | * |
92 | * Description: | 64 | * Description: |
@@ -952,7 +924,7 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
952 | * Returns: | 924 | * Returns: |
953 | * nothing | 925 | * nothing |
954 | */ | 926 | */ |
955 | void SkGeInitRamIface( | 927 | static void SkGeInitRamIface( |
956 | SK_AC *pAC, /* adapter context */ | 928 | SK_AC *pAC, /* adapter context */ |
957 | SK_IOC IoC) /* IO context */ | 929 | SK_IOC IoC) /* IO context */ |
958 | { | 930 | { |
@@ -1409,83 +1381,6 @@ SK_IOC IoC) /* IO context */ | |||
1409 | 1381 | ||
1410 | } /* SkGeInit0*/ | 1382 | } /* SkGeInit0*/ |
1411 | 1383 | ||
1412 | #ifdef SK_PCI_RESET | ||
1413 | |||
1414 | /****************************************************************************** | ||
1415 | * | ||
1416 | * SkGePciReset() - Reset PCI interface | ||
1417 | * | ||
1418 | * Description: | ||
1419 | * o Read PCI configuration. | ||
1420 | * o Change power state to 3. | ||
1421 | * o Change power state to 0. | ||
1422 | * o Restore PCI configuration. | ||
1423 | * | ||
1424 | * Returns: | ||
1425 | * 0: Success. | ||
1426 | * 1: Power state could not be changed to 3. | ||
1427 | */ | ||
1428 | static int SkGePciReset( | ||
1429 | SK_AC *pAC, /* adapter context */ | ||
1430 | SK_IOC IoC) /* IO context */ | ||
1431 | { | ||
1432 | int i; | ||
1433 | SK_U16 PmCtlSts; | ||
1434 | SK_U32 Bp1; | ||
1435 | SK_U32 Bp2; | ||
1436 | SK_U16 PciCmd; | ||
1437 | SK_U8 Cls; | ||
1438 | SK_U8 Lat; | ||
1439 | SK_U8 ConfigSpace[PCI_CFG_SIZE]; | ||
1440 | |||
1441 | /* | ||
1442 | * Note: Switching to D3 state is like a software reset. | ||
1443 | * Switching from D3 to D0 is a hardware reset. | ||
1444 | * We have to save and restore the configuration space. | ||
1445 | */ | ||
1446 | for (i = 0; i < PCI_CFG_SIZE; i++) { | ||
1447 | SkPciReadCfgDWord(pAC, i*4, &ConfigSpace[i]); | ||
1448 | } | ||
1449 | |||
1450 | /* We know the RAM Interface Arbiter is enabled. */ | ||
1451 | SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, PCI_PM_STATE_D3); | ||
1452 | SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts); | ||
1453 | |||
1454 | if ((PmCtlSts & PCI_PM_STATE_MSK) != PCI_PM_STATE_D3) { | ||
1455 | return(1); | ||
1456 | } | ||
1457 | |||
1458 | /* Return to D0 state. */ | ||
1459 | SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, PCI_PM_STATE_D0); | ||
1460 | |||
1461 | /* Check for D0 state. */ | ||
1462 | SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts); | ||
1463 | |||
1464 | if ((PmCtlSts & PCI_PM_STATE_MSK) != PCI_PM_STATE_D0) { | ||
1465 | return(1); | ||
1466 | } | ||
1467 | |||
1468 | /* Check PCI Config Registers. */ | ||
1469 | SkPciReadCfgWord(pAC, PCI_COMMAND, &PciCmd); | ||
1470 | SkPciReadCfgByte(pAC, PCI_CACHE_LSZ, &Cls); | ||
1471 | SkPciReadCfgDWord(pAC, PCI_BASE_1ST, &Bp1); | ||
1472 | SkPciReadCfgDWord(pAC, PCI_BASE_2ND, &Bp2); | ||
1473 | SkPciReadCfgByte(pAC, PCI_LAT_TIM, &Lat); | ||
1474 | |||
1475 | if (PciCmd != 0 || Cls != (SK_U8)0 || Lat != (SK_U8)0 || | ||
1476 | (Bp1 & 0xfffffff0L) != 0 || Bp2 != 1) { | ||
1477 | return(1); | ||
1478 | } | ||
1479 | |||
1480 | /* Restore PCI Config Space. */ | ||
1481 | for (i = 0; i < PCI_CFG_SIZE; i++) { | ||
1482 | SkPciWriteCfgDWord(pAC, i*4, ConfigSpace[i]); | ||
1483 | } | ||
1484 | |||
1485 | return(0); | ||
1486 | } /* SkGePciReset */ | ||
1487 | |||
1488 | #endif /* SK_PCI_RESET */ | ||
1489 | 1384 | ||
1490 | /****************************************************************************** | 1385 | /****************************************************************************** |
1491 | * | 1386 | * |
@@ -1524,10 +1419,6 @@ SK_IOC IoC) /* IO context */ | |||
1524 | /* save CLK_RUN bits (YUKON-Lite) */ | 1419 | /* save CLK_RUN bits (YUKON-Lite) */ |
1525 | SK_IN16(IoC, B0_CTST, &CtrlStat); | 1420 | SK_IN16(IoC, B0_CTST, &CtrlStat); |
1526 | 1421 | ||
1527 | #ifdef SK_PCI_RESET | ||
1528 | (void)SkGePciReset(pAC, IoC); | ||
1529 | #endif /* SK_PCI_RESET */ | ||
1530 | |||
1531 | /* do the SW-reset */ | 1422 | /* do the SW-reset */ |
1532 | SK_OUT8(IoC, B0_CTST, CS_RST_SET); | 1423 | SK_OUT8(IoC, B0_CTST, CS_RST_SET); |
1533 | 1424 | ||
@@ -1991,11 +1882,6 @@ SK_IOC IoC) /* IO context */ | |||
1991 | int i; | 1882 | int i; |
1992 | SK_U16 Word; | 1883 | SK_U16 Word; |
1993 | 1884 | ||
1994 | #ifdef SK_PHY_LP_MODE | ||
1995 | SK_U8 Byte; | ||
1996 | SK_U16 PmCtlSts; | ||
1997 | #endif /* SK_PHY_LP_MODE */ | ||
1998 | |||
1999 | #if (!defined(SK_SLIM) && !defined(VCPU)) | 1885 | #if (!defined(SK_SLIM) && !defined(VCPU)) |
2000 | /* ensure I2C is ready */ | 1886 | /* ensure I2C is ready */ |
2001 | SkI2cWaitIrq(pAC, IoC); | 1887 | SkI2cWaitIrq(pAC, IoC); |
@@ -2010,38 +1896,6 @@ SK_IOC IoC) /* IO context */ | |||
2010 | } | 1896 | } |
2011 | } | 1897 | } |
2012 | 1898 | ||
2013 | #ifdef SK_PHY_LP_MODE | ||
2014 | /* | ||
2015 | * for power saving purposes within mobile environments | ||
2016 | * we set the PHY to coma mode and switch to D3 power state. | ||
2017 | */ | ||
2018 | if (pAC->GIni.GIYukonLite && | ||
2019 | pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) { | ||
2020 | |||
2021 | /* for all ports switch PHY to coma mode */ | ||
2022 | for (i = 0; i < pAC->GIni.GIMacsFound; i++) { | ||
2023 | |||
2024 | SkGmEnterLowPowerMode(pAC, IoC, i, PHY_PM_DEEP_SLEEP); | ||
2025 | } | ||
2026 | |||
2027 | if (pAC->GIni.GIVauxAvail) { | ||
2028 | /* switch power to VAUX */ | ||
2029 | Byte = PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_ON | PC_VCC_OFF; | ||
2030 | |||
2031 | SK_OUT8(IoC, B0_POWER_CTRL, Byte); | ||
2032 | } | ||
2033 | |||
2034 | /* switch to D3 state */ | ||
2035 | SK_IN16(IoC, PCI_C(PCI_PM_CTL_STS), &PmCtlSts); | ||
2036 | |||
2037 | PmCtlSts |= PCI_PM_STATE_D3; | ||
2038 | |||
2039 | SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2040 | |||
2041 | SK_OUT16(IoC, PCI_C(PCI_PM_CTL_STS), PmCtlSts); | ||
2042 | } | ||
2043 | #endif /* SK_PHY_LP_MODE */ | ||
2044 | |||
2045 | /* Reset all bits in the PCI STATUS register */ | 1899 | /* Reset all bits in the PCI STATUS register */ |
2046 | /* | 1900 | /* |
2047 | * Note: PCI Cfg cycles cannot be used, because they are not | 1901 | * Note: PCI Cfg cycles cannot be used, because they are not |
diff --git a/drivers/net/sk98lin/skgemib.c b/drivers/net/sk98lin/skgemib.c index 2991bc85cf2c..0a6f67a7a395 100644 --- a/drivers/net/sk98lin/skgemib.c +++ b/drivers/net/sk98lin/skgemib.c | |||
@@ -871,13 +871,6 @@ PNMI_STATIC const SK_PNMI_TAB_ENTRY IdTable[] = { | |||
871 | sizeof(SK_PNMI_CONF), | 871 | sizeof(SK_PNMI_CONF), |
872 | SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfPhyType), | 872 | SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfPhyType), |
873 | SK_PNMI_RO, MacPrivateConf, 0}, | 873 | SK_PNMI_RO, MacPrivateConf, 0}, |
874 | #ifdef SK_PHY_LP_MODE | ||
875 | {OID_SKGE_PHY_LP_MODE, | ||
876 | SK_PNMI_MAC_ENTRIES, | ||
877 | sizeof(SK_PNMI_CONF), | ||
878 | SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfPhyMode), | ||
879 | SK_PNMI_RW, MacPrivateConf, 0}, | ||
880 | #endif | ||
881 | {OID_SKGE_LINK_CAP, | 874 | {OID_SKGE_LINK_CAP, |
882 | SK_PNMI_MAC_ENTRIES, | 875 | SK_PNMI_MAC_ENTRIES, |
883 | sizeof(SK_PNMI_CONF), | 876 | sizeof(SK_PNMI_CONF), |
diff --git a/drivers/net/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c index a386172107e8..b36dd9ac6b29 100644 --- a/drivers/net/sk98lin/skgepnmi.c +++ b/drivers/net/sk98lin/skgepnmi.c | |||
@@ -56,10 +56,6 @@ static const char SysKonnectFileId[] = | |||
56 | * Public Function prototypes | 56 | * Public Function prototypes |
57 | */ | 57 | */ |
58 | int SkPnmiInit(SK_AC *pAC, SK_IOC IoC, int level); | 58 | int SkPnmiInit(SK_AC *pAC, SK_IOC IoC, int level); |
59 | int SkPnmiGetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf, | ||
60 | unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex); | ||
61 | int SkPnmiPreSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf, | ||
62 | unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex); | ||
63 | int SkPnmiSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf, | 59 | int SkPnmiSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf, |
64 | unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex); | 60 | unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex); |
65 | int SkPnmiGetStruct(SK_AC *pAC, SK_IOC IoC, void *pBuf, | 61 | int SkPnmiGetStruct(SK_AC *pAC, SK_IOC IoC, void *pBuf, |
@@ -587,7 +583,7 @@ int Level) /* Initialization level */ | |||
587 | * exist (e.g. port instance 3 on a two port | 583 | * exist (e.g. port instance 3 on a two port |
588 | * adapter. | 584 | * adapter. |
589 | */ | 585 | */ |
590 | int SkPnmiGetVar( | 586 | static int SkPnmiGetVar( |
591 | SK_AC *pAC, /* Pointer to adapter context */ | 587 | SK_AC *pAC, /* Pointer to adapter context */ |
592 | SK_IOC IoC, /* IO context handle */ | 588 | SK_IOC IoC, /* IO context handle */ |
593 | SK_U32 Id, /* Object ID that is to be processed */ | 589 | SK_U32 Id, /* Object ID that is to be processed */ |
@@ -629,7 +625,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ | |||
629 | * exist (e.g. port instance 3 on a two port | 625 | * exist (e.g. port instance 3 on a two port |
630 | * adapter. | 626 | * adapter. |
631 | */ | 627 | */ |
632 | int SkPnmiPreSetVar( | 628 | static int SkPnmiPreSetVar( |
633 | SK_AC *pAC, /* Pointer to adapter context */ | 629 | SK_AC *pAC, /* Pointer to adapter context */ |
634 | SK_IOC IoC, /* IO context handle */ | 630 | SK_IOC IoC, /* IO context handle */ |
635 | SK_U32 Id, /* Object ID that is to be processed */ | 631 | SK_U32 Id, /* Object ID that is to be processed */ |
@@ -5062,9 +5058,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ | |||
5062 | case OID_SKGE_SPEED_CAP: | 5058 | case OID_SKGE_SPEED_CAP: |
5063 | case OID_SKGE_SPEED_MODE: | 5059 | case OID_SKGE_SPEED_MODE: |
5064 | case OID_SKGE_SPEED_STATUS: | 5060 | case OID_SKGE_SPEED_STATUS: |
5065 | #ifdef SK_PHY_LP_MODE | ||
5066 | case OID_SKGE_PHY_LP_MODE: | ||
5067 | #endif | ||
5068 | if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U8)) { | 5061 | if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U8)) { |
5069 | 5062 | ||
5070 | *pLen = (Limit - LogPortIndex) * sizeof(SK_U8); | 5063 | *pLen = (Limit - LogPortIndex) * sizeof(SK_U8); |
@@ -5140,28 +5133,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ | |||
5140 | Offset += sizeof(SK_U32); | 5133 | Offset += sizeof(SK_U32); |
5141 | break; | 5134 | break; |
5142 | 5135 | ||
5143 | #ifdef SK_PHY_LP_MODE | ||
5144 | case OID_SKGE_PHY_LP_MODE: | ||
5145 | if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */ | ||
5146 | if (LogPortIndex == 0) { | ||
5147 | continue; | ||
5148 | } | ||
5149 | else { | ||
5150 | /* Get value for physical ports */ | ||
5151 | PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex); | ||
5152 | Val8 = (SK_U8) pAC->GIni.GP[PhysPortIndex].PPhyPowerState; | ||
5153 | *pBufPtr = Val8; | ||
5154 | } | ||
5155 | } | ||
5156 | else { /* DualNetMode */ | ||
5157 | |||
5158 | Val8 = (SK_U8) pAC->GIni.GP[PhysPortIndex].PPhyPowerState; | ||
5159 | *pBufPtr = Val8; | ||
5160 | } | ||
5161 | Offset += sizeof(SK_U8); | ||
5162 | break; | ||
5163 | #endif | ||
5164 | |||
5165 | case OID_SKGE_LINK_CAP: | 5136 | case OID_SKGE_LINK_CAP: |
5166 | if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */ | 5137 | if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */ |
5167 | if (LogPortIndex == 0) { | 5138 | if (LogPortIndex == 0) { |
@@ -5478,16 +5449,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ | |||
5478 | } | 5449 | } |
5479 | break; | 5450 | break; |
5480 | 5451 | ||
5481 | #ifdef SK_PHY_LP_MODE | ||
5482 | case OID_SKGE_PHY_LP_MODE: | ||
5483 | if (*pLen < Limit - LogPortIndex) { | ||
5484 | |||
5485 | *pLen = Limit - LogPortIndex; | ||
5486 | return (SK_PNMI_ERR_TOO_SHORT); | ||
5487 | } | ||
5488 | break; | ||
5489 | #endif | ||
5490 | |||
5491 | case OID_SKGE_MTU: | 5452 | case OID_SKGE_MTU: |
5492 | if (*pLen < sizeof(SK_U32)) { | 5453 | if (*pLen < sizeof(SK_U32)) { |
5493 | 5454 | ||
@@ -5845,116 +5806,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ | |||
5845 | Offset += sizeof(SK_U32); | 5806 | Offset += sizeof(SK_U32); |
5846 | break; | 5807 | break; |
5847 | 5808 | ||
5848 | #ifdef SK_PHY_LP_MODE | ||
5849 | case OID_SKGE_PHY_LP_MODE: | ||
5850 | /* The preset ends here */ | ||
5851 | if (Action == SK_PNMI_PRESET) { | ||
5852 | |||
5853 | return (SK_PNMI_ERR_OK); | ||
5854 | } | ||
5855 | |||
5856 | if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */ | ||
5857 | if (LogPortIndex == 0) { | ||
5858 | Offset = 0; | ||
5859 | continue; | ||
5860 | } | ||
5861 | else { | ||
5862 | /* Set value for physical ports */ | ||
5863 | PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex); | ||
5864 | |||
5865 | switch (*(pBuf + Offset)) { | ||
5866 | case 0: | ||
5867 | /* If LowPowerMode is active, we can leave it. */ | ||
5868 | if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState) { | ||
5869 | |||
5870 | Val32 = SkGmLeaveLowPowerMode(pAC, IoC, PhysPortIndex); | ||
5871 | |||
5872 | if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState < 3) { | ||
5873 | |||
5874 | SkDrvInitAdapter(pAC); | ||
5875 | } | ||
5876 | break; | ||
5877 | } | ||
5878 | else { | ||
5879 | *pLen = 0; | ||
5880 | return (SK_PNMI_ERR_GENERAL); | ||
5881 | } | ||
5882 | case 1: | ||
5883 | case 2: | ||
5884 | case 3: | ||
5885 | case 4: | ||
5886 | /* If no LowPowerMode is active, we can enter it. */ | ||
5887 | if (!pAC->GIni.GP[PhysPortIndex].PPhyPowerState) { | ||
5888 | |||
5889 | if ((*(pBuf + Offset)) < 3) { | ||
5890 | |||
5891 | SkDrvDeInitAdapter(pAC); | ||
5892 | } | ||
5893 | |||
5894 | Val32 = SkGmEnterLowPowerMode(pAC, IoC, PhysPortIndex, *pBuf); | ||
5895 | break; | ||
5896 | } | ||
5897 | else { | ||
5898 | *pLen = 0; | ||
5899 | return (SK_PNMI_ERR_GENERAL); | ||
5900 | } | ||
5901 | default: | ||
5902 | *pLen = 0; | ||
5903 | return (SK_PNMI_ERR_BAD_VALUE); | ||
5904 | } | ||
5905 | } | ||
5906 | } | ||
5907 | else { /* DualNetMode */ | ||
5908 | |||
5909 | switch (*(pBuf + Offset)) { | ||
5910 | case 0: | ||
5911 | /* If we are in a LowPowerMode, we can leave it. */ | ||
5912 | if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState) { | ||
5913 | |||
5914 | Val32 = SkGmLeaveLowPowerMode(pAC, IoC, PhysPortIndex); | ||
5915 | |||
5916 | if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState < 3) { | ||
5917 | |||
5918 | SkDrvInitAdapter(pAC); | ||
5919 | } | ||
5920 | break; | ||
5921 | } | ||
5922 | else { | ||
5923 | *pLen = 0; | ||
5924 | return (SK_PNMI_ERR_GENERAL); | ||
5925 | } | ||
5926 | |||
5927 | case 1: | ||
5928 | case 2: | ||
5929 | case 3: | ||
5930 | case 4: | ||
5931 | /* If we are not already in LowPowerMode, we can enter it. */ | ||
5932 | if (!pAC->GIni.GP[PhysPortIndex].PPhyPowerState) { | ||
5933 | |||
5934 | if ((*(pBuf + Offset)) < 3) { | ||
5935 | |||
5936 | SkDrvDeInitAdapter(pAC); | ||
5937 | } | ||
5938 | else { | ||
5939 | |||
5940 | Val32 = SkGmEnterLowPowerMode(pAC, IoC, PhysPortIndex, *pBuf); | ||
5941 | } | ||
5942 | break; | ||
5943 | } | ||
5944 | else { | ||
5945 | *pLen = 0; | ||
5946 | return (SK_PNMI_ERR_GENERAL); | ||
5947 | } | ||
5948 | |||
5949 | default: | ||
5950 | *pLen = 0; | ||
5951 | return (SK_PNMI_ERR_BAD_VALUE); | ||
5952 | } | ||
5953 | } | ||
5954 | Offset += sizeof(SK_U8); | ||
5955 | break; | ||
5956 | #endif | ||
5957 | |||
5958 | default: | 5809 | default: |
5959 | SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_ERR, | 5810 | SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_ERR, |
5960 | ("MacPrivateConf: Unknown OID should be handled before set")); | 5811 | ("MacPrivateConf: Unknown OID should be handled before set")); |
diff --git a/drivers/net/sk98lin/skgesirq.c b/drivers/net/sk98lin/skgesirq.c index 87520f0057d7..ab66d80a4455 100644 --- a/drivers/net/sk98lin/skgesirq.c +++ b/drivers/net/sk98lin/skgesirq.c | |||
@@ -265,7 +265,7 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
265 | * | 265 | * |
266 | * Returns: N/A | 266 | * Returns: N/A |
267 | */ | 267 | */ |
268 | void SkHWLinkUp( | 268 | static void SkHWLinkUp( |
269 | SK_AC *pAC, /* adapter context */ | 269 | SK_AC *pAC, /* adapter context */ |
270 | SK_IOC IoC, /* IO context */ | 270 | SK_IOC IoC, /* IO context */ |
271 | int Port) /* Port Index (MAC_1 + n) */ | 271 | int Port) /* Port Index (MAC_1 + n) */ |
@@ -612,14 +612,6 @@ SK_U32 Istatus) /* Interrupt status word */ | |||
612 | * we ignore those | 612 | * we ignore those |
613 | */ | 613 | */ |
614 | pPrt->HalfDupTimerActive = SK_TRUE; | 614 | pPrt->HalfDupTimerActive = SK_TRUE; |
615 | #ifdef XXX | ||
616 | Len = sizeof(SK_U64); | ||
617 | SkPnmiGetVar(pAC, IoC, OID_SKGE_STAT_TX_OCTETS, (char *)&Octets, | ||
618 | &Len, (SK_U32)SK_PNMI_PORT_PHYS2INST(pAC, 0), | ||
619 | pAC->Rlmt.Port[0].Net->NetNumber); | ||
620 | |||
621 | pPrt->LastOctets = Octets; | ||
622 | #endif /* XXX */ | ||
623 | /* Snap statistic counters */ | 615 | /* Snap statistic counters */ |
624 | (void)SkXmUpdateStats(pAC, IoC, 0); | 616 | (void)SkXmUpdateStats(pAC, IoC, 0); |
625 | 617 | ||
@@ -653,14 +645,6 @@ SK_U32 Istatus) /* Interrupt status word */ | |||
653 | pPrt->PLinkModeStatus == SK_LMODE_STAT_AUTOHALF) && | 645 | pPrt->PLinkModeStatus == SK_LMODE_STAT_AUTOHALF) && |
654 | !pPrt->HalfDupTimerActive) { | 646 | !pPrt->HalfDupTimerActive) { |
655 | pPrt->HalfDupTimerActive = SK_TRUE; | 647 | pPrt->HalfDupTimerActive = SK_TRUE; |
656 | #ifdef XXX | ||
657 | Len = sizeof(SK_U64); | ||
658 | SkPnmiGetVar(pAC, IoC, OID_SKGE_STAT_TX_OCTETS, (char *)&Octets, | ||
659 | &Len, (SK_U32)SK_PNMI_PORT_PHYS2INST(pAC, 1), | ||
660 | pAC->Rlmt.Port[1].Net->NetNumber); | ||
661 | |||
662 | pPrt->LastOctets = Octets; | ||
663 | #endif /* XXX */ | ||
664 | /* Snap statistic counters */ | 648 | /* Snap statistic counters */ |
665 | (void)SkXmUpdateStats(pAC, IoC, 1); | 649 | (void)SkXmUpdateStats(pAC, IoC, 1); |
666 | 650 | ||
@@ -2085,12 +2069,6 @@ SK_EVPARA Para) /* Event specific Parameter */ | |||
2085 | pPrt->HalfDupTimerActive = SK_FALSE; | 2069 | pPrt->HalfDupTimerActive = SK_FALSE; |
2086 | if (pPrt->PLinkModeStatus == SK_LMODE_STAT_HALF || | 2070 | if (pPrt->PLinkModeStatus == SK_LMODE_STAT_HALF || |
2087 | pPrt->PLinkModeStatus == SK_LMODE_STAT_AUTOHALF) { | 2071 | pPrt->PLinkModeStatus == SK_LMODE_STAT_AUTOHALF) { |
2088 | #ifdef XXX | ||
2089 | Len = sizeof(SK_U64); | ||
2090 | SkPnmiGetVar(pAC, IoC, OID_SKGE_STAT_TX_OCTETS, (char *)&Octets, | ||
2091 | &Len, (SK_U32)SK_PNMI_PORT_PHYS2INST(pAC, Port), | ||
2092 | pAC->Rlmt.Port[Port].Net->NetNumber); | ||
2093 | #endif /* XXX */ | ||
2094 | /* Snap statistic counters */ | 2072 | /* Snap statistic counters */ |
2095 | (void)SkXmUpdateStats(pAC, IoC, Port); | 2073 | (void)SkXmUpdateStats(pAC, IoC, Port); |
2096 | 2074 | ||
diff --git a/drivers/net/sk98lin/ski2c.c b/drivers/net/sk98lin/ski2c.c index 075a0464e56b..79bf57cb5326 100644 --- a/drivers/net/sk98lin/ski2c.c +++ b/drivers/net/sk98lin/ski2c.c | |||
@@ -396,7 +396,7 @@ int Rw) /* Read / Write Flag */ | |||
396 | * 1: error, transfer does not complete, I2C transfer | 396 | * 1: error, transfer does not complete, I2C transfer |
397 | * killed, wait loop terminated. | 397 | * killed, wait loop terminated. |
398 | */ | 398 | */ |
399 | int SkI2cWait( | 399 | static int SkI2cWait( |
400 | SK_AC *pAC, /* Adapter Context */ | 400 | SK_AC *pAC, /* Adapter Context */ |
401 | SK_IOC IoC, /* I/O Context */ | 401 | SK_IOC IoC, /* I/O Context */ |
402 | int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */ | 402 | int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */ |
@@ -481,7 +481,7 @@ SK_IOC IoC) /* I/O Context */ | |||
481 | * returns 0: success | 481 | * returns 0: success |
482 | * 1: error | 482 | * 1: error |
483 | */ | 483 | */ |
484 | int SkI2cWrite( | 484 | static int SkI2cWrite( |
485 | SK_AC *pAC, /* Adapter Context */ | 485 | SK_AC *pAC, /* Adapter Context */ |
486 | SK_IOC IoC, /* I/O Context */ | 486 | SK_IOC IoC, /* I/O Context */ |
487 | SK_U32 I2cData, /* I2C Data to write */ | 487 | SK_U32 I2cData, /* I2C Data to write */ |
@@ -538,7 +538,7 @@ int I2cBurst) /* I2C Burst Flag */ | |||
538 | * 1 if the read is completed | 538 | * 1 if the read is completed |
539 | * 0 if the read must be continued (I2C Bus still allocated) | 539 | * 0 if the read must be continued (I2C Bus still allocated) |
540 | */ | 540 | */ |
541 | int SkI2cReadSensor( | 541 | static int SkI2cReadSensor( |
542 | SK_AC *pAC, /* Adapter Context */ | 542 | SK_AC *pAC, /* Adapter Context */ |
543 | SK_IOC IoC, /* I/O Context */ | 543 | SK_IOC IoC, /* I/O Context */ |
544 | SK_SENSOR *pSen) /* Sensor to be read */ | 544 | SK_SENSOR *pSen) /* Sensor to be read */ |
diff --git a/drivers/net/sk98lin/sklm80.c b/drivers/net/sk98lin/sklm80.c index 68292d18175b..a204f5bb55d4 100644 --- a/drivers/net/sk98lin/sklm80.c +++ b/drivers/net/sk98lin/sklm80.c | |||
@@ -34,79 +34,7 @@ static const char SysKonnectFileId[] = | |||
34 | #include "h/lm80.h" | 34 | #include "h/lm80.h" |
35 | #include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ | 35 | #include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ |
36 | 36 | ||
37 | #ifdef SK_DIAG | ||
38 | #define BREAK_OR_WAIT(pAC,IoC,Event) SkI2cWait(pAC,IoC,Event) | ||
39 | #else /* nSK_DIAG */ | ||
40 | #define BREAK_OR_WAIT(pAC,IoC,Event) break | 37 | #define BREAK_OR_WAIT(pAC,IoC,Event) break |
41 | #endif /* nSK_DIAG */ | ||
42 | |||
43 | #ifdef SK_DIAG | ||
44 | /* | ||
45 | * read the register 'Reg' from the device 'Dev' | ||
46 | * | ||
47 | * return read error -1 | ||
48 | * success the read value | ||
49 | */ | ||
50 | int SkLm80RcvReg( | ||
51 | SK_IOC IoC, /* Adapter Context */ | ||
52 | int Dev, /* I2C device address */ | ||
53 | int Reg) /* register to read */ | ||
54 | { | ||
55 | int Val = 0; | ||
56 | int TempExt; | ||
57 | |||
58 | /* Signal device number */ | ||
59 | if (SkI2cSndDev(IoC, Dev, I2C_WRITE)) { | ||
60 | return(-1); | ||
61 | } | ||
62 | |||
63 | if (SkI2cSndByte(IoC, Reg)) { | ||
64 | return(-1); | ||
65 | } | ||
66 | |||
67 | /* repeat start */ | ||
68 | if (SkI2cSndDev(IoC, Dev, I2C_READ)) { | ||
69 | return(-1); | ||
70 | } | ||
71 | |||
72 | switch (Reg) { | ||
73 | case LM80_TEMP_IN: | ||
74 | Val = (int)SkI2cRcvByte(IoC, 1); | ||
75 | |||
76 | /* First: correct the value: it might be negative */ | ||
77 | if ((Val & 0x80) != 0) { | ||
78 | /* Value is negative */ | ||
79 | Val = Val - 256; | ||
80 | } | ||
81 | Val = Val * SK_LM80_TEMP_LSB; | ||
82 | SkI2cStop(IoC); | ||
83 | |||
84 | TempExt = (int)SkLm80RcvReg(IoC, LM80_ADDR, LM80_TEMP_CTRL); | ||
85 | |||
86 | if (Val > 0) { | ||
87 | Val += ((TempExt >> 7) * SK_LM80_TEMPEXT_LSB); | ||
88 | } | ||
89 | else { | ||
90 | Val -= ((TempExt >> 7) * SK_LM80_TEMPEXT_LSB); | ||
91 | } | ||
92 | return(Val); | ||
93 | break; | ||
94 | case LM80_VT0_IN: | ||
95 | case LM80_VT1_IN: | ||
96 | case LM80_VT2_IN: | ||
97 | case LM80_VT3_IN: | ||
98 | Val = (int)SkI2cRcvByte(IoC, 1) * SK_LM80_VT_LSB; | ||
99 | break; | ||
100 | |||
101 | default: | ||
102 | Val = (int)SkI2cRcvByte(IoC, 1); | ||
103 | break; | ||
104 | } | ||
105 | |||
106 | SkI2cStop(IoC); | ||
107 | return(Val); | ||
108 | } | ||
109 | #endif /* SK_DIAG */ | ||
110 | 38 | ||
111 | /* | 39 | /* |
112 | * read a sensors value (LM80 specific) | 40 | * read a sensors value (LM80 specific) |
diff --git a/drivers/net/sk98lin/skrlmt.c b/drivers/net/sk98lin/skrlmt.c index 9ea11ab2296a..be8d1ccddf6d 100644 --- a/drivers/net/sk98lin/skrlmt.c +++ b/drivers/net/sk98lin/skrlmt.c | |||
@@ -282,7 +282,6 @@ typedef struct s_SpTreeRlmtPacket { | |||
282 | 282 | ||
283 | SK_MAC_ADDR SkRlmtMcAddr = {{0x01, 0x00, 0x5A, 0x52, 0x4C, 0x4D}}; | 283 | SK_MAC_ADDR SkRlmtMcAddr = {{0x01, 0x00, 0x5A, 0x52, 0x4C, 0x4D}}; |
284 | SK_MAC_ADDR BridgeMcAddr = {{0x01, 0x80, 0xC2, 0x00, 0x00, 0x00}}; | 284 | SK_MAC_ADDR BridgeMcAddr = {{0x01, 0x80, 0xC2, 0x00, 0x00, 0x00}}; |
285 | SK_MAC_ADDR BcAddr = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; | ||
286 | 285 | ||
287 | /* local variables ************************************************************/ | 286 | /* local variables ************************************************************/ |
288 | 287 | ||
diff --git a/drivers/net/sk98lin/skvpd.c b/drivers/net/sk98lin/skvpd.c index eb3c8988ced1..17786056c66a 100644 --- a/drivers/net/sk98lin/skvpd.c +++ b/drivers/net/sk98lin/skvpd.c | |||
@@ -132,65 +132,6 @@ int addr) /* VPD address */ | |||
132 | 132 | ||
133 | #endif /* SKDIAG */ | 133 | #endif /* SKDIAG */ |
134 | 134 | ||
135 | #if 0 | ||
136 | |||
137 | /* | ||
138 | Write the dword 'data' at address 'addr' into the VPD EEPROM, and | ||
139 | verify that the data is written. | ||
140 | |||
141 | Needed Time: | ||
142 | |||
143 | . MIN MAX | ||
144 | . ------------------------------------------------------------------- | ||
145 | . write 1.8 ms 3.6 ms | ||
146 | . internal write cyles 0.7 ms 7.0 ms | ||
147 | . ------------------------------------------------------------------- | ||
148 | . over all program time 2.5 ms 10.6 ms | ||
149 | . read 1.3 ms 2.6 ms | ||
150 | . ------------------------------------------------------------------- | ||
151 | . over all 3.8 ms 13.2 ms | ||
152 | . | ||
153 | |||
154 | |||
155 | Returns 0: success | ||
156 | 1: error, I2C transfer does not terminate | ||
157 | 2: error, data verify error | ||
158 | |||
159 | */ | ||
160 | static int VpdWriteDWord( | ||
161 | SK_AC *pAC, /* pAC pointer */ | ||
162 | SK_IOC IoC, /* IO Context */ | ||
163 | int addr, /* VPD address */ | ||
164 | SK_U32 data) /* VPD data to write */ | ||
165 | { | ||
166 | /* start VPD write */ | ||
167 | /* Don't swap here, it's a data stream of bytes */ | ||
168 | SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL, | ||
169 | ("VPD write dword at addr 0x%x, data = 0x%x\n",addr,data)); | ||
170 | VPD_OUT32(pAC, IoC, PCI_VPD_DAT_REG, (SK_U32)data); | ||
171 | /* But do it here */ | ||
172 | addr |= VPD_WRITE; | ||
173 | |||
174 | VPD_OUT16(pAC, IoC, PCI_VPD_ADR_REG, (SK_U16)(addr | VPD_WRITE)); | ||
175 | |||
176 | /* this may take up to 10,6 ms */ | ||
177 | if (VpdWait(pAC, IoC, VPD_WRITE)) { | ||
178 | SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR, | ||
179 | ("Write Timed Out\n")); | ||
180 | return(1); | ||
181 | }; | ||
182 | |||
183 | /* verify data */ | ||
184 | if (VpdReadDWord(pAC, IoC, addr) != data) { | ||
185 | SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL, | ||
186 | ("Data Verify Error\n")); | ||
187 | return(2); | ||
188 | } | ||
189 | return(0); | ||
190 | } /* VpdWriteDWord */ | ||
191 | |||
192 | #endif /* 0 */ | ||
193 | |||
194 | /* | 135 | /* |
195 | * Read one Stream of 'len' bytes of VPD data, starting at 'addr' from | 136 | * Read one Stream of 'len' bytes of VPD data, starting at 'addr' from |
196 | * or to the I2C EEPROM. | 137 | * or to the I2C EEPROM. |
@@ -728,7 +669,7 @@ char *etp) /* end pointer input position */ | |||
728 | * 6: fatal VPD error | 669 | * 6: fatal VPD error |
729 | * | 670 | * |
730 | */ | 671 | */ |
731 | int VpdSetupPara( | 672 | static int VpdSetupPara( |
732 | SK_AC *pAC, /* common data base */ | 673 | SK_AC *pAC, /* common data base */ |
733 | const char *key, /* keyword to insert */ | 674 | const char *key, /* keyword to insert */ |
734 | const char *buf, /* buffer with the keyword value */ | 675 | const char *buf, /* buffer with the keyword value */ |
@@ -1148,50 +1089,3 @@ SK_IOC IoC) /* IO Context */ | |||
1148 | return(0); | 1089 | return(0); |
1149 | } | 1090 | } |
1150 | 1091 | ||
1151 | |||
1152 | |||
1153 | /* | ||
1154 | * Read the contents of the VPD EEPROM and copy it to the VPD buffer | ||
1155 | * if not already done. If the keyword "VF" is not present it will be | ||
1156 | * created and the error log message will be stored to this keyword. | ||
1157 | * If "VF" is not present the error log message will be stored to the | ||
1158 | * keyword "VL". "VL" will created or overwritten if "VF" is present. | ||
1159 | * The VPD read/write area is saved to the VPD EEPROM. | ||
1160 | * | ||
1161 | * returns nothing, errors will be ignored. | ||
1162 | */ | ||
1163 | void VpdErrLog( | ||
1164 | SK_AC *pAC, /* common data base */ | ||
1165 | SK_IOC IoC, /* IO Context */ | ||
1166 | char *msg) /* error log message */ | ||
1167 | { | ||
1168 | SK_VPD_PARA *v, vf; /* VF */ | ||
1169 | int len; | ||
1170 | |||
1171 | SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_TX, | ||
1172 | ("VPD error log msg %s\n", msg)); | ||
1173 | if ((pAC->vpd.v.vpd_status & VPD_VALID) == 0) { | ||
1174 | if (VpdInit(pAC, IoC) != 0) { | ||
1175 | SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR, | ||
1176 | ("VPD init error\n")); | ||
1177 | return; | ||
1178 | } | ||
1179 | } | ||
1180 | |||
1181 | len = strlen(msg); | ||
1182 | if (len > VPD_MAX_LEN) { | ||
1183 | /* cut it */ | ||
1184 | len = VPD_MAX_LEN; | ||
1185 | } | ||
1186 | if ((v = vpd_find_para(pAC, VPD_VF, &vf)) != NULL) { | ||
1187 | SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_TX, ("overwrite VL\n")); | ||
1188 | (void)VpdSetupPara(pAC, VPD_VL, msg, len, VPD_RW_KEY, OWR_KEY); | ||
1189 | } | ||
1190 | else { | ||
1191 | SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_TX, ("write VF\n")); | ||
1192 | (void)VpdSetupPara(pAC, VPD_VF, msg, len, VPD_RW_KEY, ADD_KEY); | ||
1193 | } | ||
1194 | |||
1195 | (void)VpdUpdate(pAC, IoC); | ||
1196 | } | ||
1197 | |||
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c index 42d2d963150a..b4e75022a657 100644 --- a/drivers/net/sk98lin/skxmac2.c +++ b/drivers/net/sk98lin/skxmac2.c | |||
@@ -41,13 +41,13 @@ static const char SysKonnectFileId[] = | |||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #ifdef GENESIS | 43 | #ifdef GENESIS |
44 | BCOM_HACK BcomRegA1Hack[] = { | 44 | static BCOM_HACK BcomRegA1Hack[] = { |
45 | { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1104 }, { 0x17, 0x0013 }, | 45 | { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1104 }, { 0x17, 0x0013 }, |
46 | { 0x15, 0x0404 }, { 0x17, 0x8006 }, { 0x15, 0x0132 }, { 0x17, 0x8006 }, | 46 | { 0x15, 0x0404 }, { 0x17, 0x8006 }, { 0x15, 0x0132 }, { 0x17, 0x8006 }, |
47 | { 0x15, 0x0232 }, { 0x17, 0x800D }, { 0x15, 0x000F }, { 0x18, 0x0420 }, | 47 | { 0x15, 0x0232 }, { 0x17, 0x800D }, { 0x15, 0x000F }, { 0x18, 0x0420 }, |
48 | { 0, 0 } | 48 | { 0, 0 } |
49 | }; | 49 | }; |
50 | BCOM_HACK BcomRegC0Hack[] = { | 50 | static BCOM_HACK BcomRegC0Hack[] = { |
51 | { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1204 }, { 0x17, 0x0013 }, | 51 | { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1204 }, { 0x17, 0x0013 }, |
52 | { 0x15, 0x0A04 }, { 0x18, 0x0420 }, | 52 | { 0x15, 0x0A04 }, { 0x18, 0x0420 }, |
53 | { 0, 0 } | 53 | { 0, 0 } |
@@ -790,7 +790,7 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
790 | * Returns: | 790 | * Returns: |
791 | * nothing | 791 | * nothing |
792 | */ | 792 | */ |
793 | void SkMacFlushRxFifo( | 793 | static void SkMacFlushRxFifo( |
794 | SK_AC *pAC, /* adapter context */ | 794 | SK_AC *pAC, /* adapter context */ |
795 | SK_IOC IoC, /* IO context */ | 795 | SK_IOC IoC, /* IO context */ |
796 | int Port) /* Port Index (MAC_1 + n) */ | 796 | int Port) /* Port Index (MAC_1 + n) */ |
@@ -1231,38 +1231,6 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
1231 | } /* SkMacHardRst */ | 1231 | } /* SkMacHardRst */ |
1232 | 1232 | ||
1233 | 1233 | ||
1234 | /****************************************************************************** | ||
1235 | * | ||
1236 | * SkMacClearRst() - Clear the MAC reset | ||
1237 | * | ||
1238 | * Description: calls a clear MAC reset routine dep. on board type | ||
1239 | * | ||
1240 | * Returns: | ||
1241 | * nothing | ||
1242 | */ | ||
1243 | void SkMacClearRst( | ||
1244 | SK_AC *pAC, /* adapter context */ | ||
1245 | SK_IOC IoC, /* IO context */ | ||
1246 | int Port) /* Port Index (MAC_1 + n) */ | ||
1247 | { | ||
1248 | |||
1249 | #ifdef GENESIS | ||
1250 | if (pAC->GIni.GIGenesis) { | ||
1251 | |||
1252 | SkXmClearRst(pAC, IoC, Port); | ||
1253 | } | ||
1254 | #endif /* GENESIS */ | ||
1255 | |||
1256 | #ifdef YUKON | ||
1257 | if (pAC->GIni.GIYukon) { | ||
1258 | |||
1259 | SkGmClearRst(pAC, IoC, Port); | ||
1260 | } | ||
1261 | #endif /* YUKON */ | ||
1262 | |||
1263 | } /* SkMacClearRst */ | ||
1264 | |||
1265 | |||
1266 | #ifdef GENESIS | 1234 | #ifdef GENESIS |
1267 | /****************************************************************************** | 1235 | /****************************************************************************** |
1268 | * | 1236 | * |
@@ -1713,7 +1681,7 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
1713 | * Returns: | 1681 | * Returns: |
1714 | * nothing | 1682 | * nothing |
1715 | */ | 1683 | */ |
1716 | void SkXmInitDupMd( | 1684 | static void SkXmInitDupMd( |
1717 | SK_AC *pAC, /* adapter context */ | 1685 | SK_AC *pAC, /* adapter context */ |
1718 | SK_IOC IoC, /* IO context */ | 1686 | SK_IOC IoC, /* IO context */ |
1719 | int Port) /* Port Index (MAC_1 + n) */ | 1687 | int Port) /* Port Index (MAC_1 + n) */ |
@@ -1761,7 +1729,7 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
1761 | * Returns: | 1729 | * Returns: |
1762 | * nothing | 1730 | * nothing |
1763 | */ | 1731 | */ |
1764 | void SkXmInitPauseMd( | 1732 | static void SkXmInitPauseMd( |
1765 | SK_AC *pAC, /* adapter context */ | 1733 | SK_AC *pAC, /* adapter context */ |
1766 | SK_IOC IoC, /* IO context */ | 1734 | SK_IOC IoC, /* IO context */ |
1767 | int Port) /* Port Index (MAC_1 + n) */ | 1735 | int Port) /* Port Index (MAC_1 + n) */ |
@@ -2076,283 +2044,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ | |||
2076 | } /* SkXmInitPhyBcom */ | 2044 | } /* SkXmInitPhyBcom */ |
2077 | #endif /* GENESIS */ | 2045 | #endif /* GENESIS */ |
2078 | 2046 | ||
2079 | |||
2080 | #ifdef YUKON | 2047 | #ifdef YUKON |
2081 | #ifndef SK_SLIM | ||
2082 | /****************************************************************************** | ||
2083 | * | ||
2084 | * SkGmEnterLowPowerMode() | ||
2085 | * | ||
2086 | * Description: | ||
2087 | * This function sets the Marvell Alaska PHY to the low power mode | ||
2088 | * given by parameter mode. | ||
2089 | * The following low power modes are available: | ||
2090 | * | ||
2091 | * - Coma Mode (Deep Sleep): | ||
2092 | * Power consumption: ~15 - 30 mW | ||
2093 | * The PHY cannot wake up on its own. | ||
2094 | * | ||
2095 | * - IEEE 22.2.4.1.5 compatible power down mode | ||
2096 | * Power consumption: ~240 mW | ||
2097 | * The PHY cannot wake up on its own. | ||
2098 | * | ||
2099 | * - energy detect mode | ||
2100 | * Power consumption: ~160 mW | ||
2101 | * The PHY can wake up on its own by detecting activity | ||
2102 | * on the CAT 5 cable. | ||
2103 | * | ||
2104 | * - energy detect plus mode | ||
2105 | * Power consumption: ~150 mW | ||
2106 | * The PHY can wake up on its own by detecting activity | ||
2107 | * on the CAT 5 cable. | ||
2108 | * Connected devices can be woken up by sending normal link | ||
2109 | * pulses every one second. | ||
2110 | * | ||
2111 | * Note: | ||
2112 | * | ||
2113 | * Returns: | ||
2114 | * 0: ok | ||
2115 | * 1: error | ||
2116 | */ | ||
2117 | int SkGmEnterLowPowerMode( | ||
2118 | SK_AC *pAC, /* adapter context */ | ||
2119 | SK_IOC IoC, /* IO context */ | ||
2120 | int Port, /* Port Index (e.g. MAC_1) */ | ||
2121 | SK_U8 Mode) /* low power mode */ | ||
2122 | { | ||
2123 | SK_U16 Word; | ||
2124 | SK_U32 DWord; | ||
2125 | SK_U8 LastMode; | ||
2126 | int Ret = 0; | ||
2127 | |||
2128 | if (pAC->GIni.GIYukonLite && | ||
2129 | pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) { | ||
2130 | |||
2131 | /* save current power mode */ | ||
2132 | LastMode = pAC->GIni.GP[Port].PPhyPowerState; | ||
2133 | pAC->GIni.GP[Port].PPhyPowerState = Mode; | ||
2134 | |||
2135 | switch (Mode) { | ||
2136 | /* coma mode (deep sleep) */ | ||
2137 | case PHY_PM_DEEP_SLEEP: | ||
2138 | /* setup General Purpose Control Register */ | ||
2139 | GM_OUT16(IoC, 0, GM_GP_CTRL, GM_GPCR_FL_PASS | | ||
2140 | GM_GPCR_SPEED_100 | GM_GPCR_AU_ALL_DIS); | ||
2141 | |||
2142 | /* apply COMA mode workaround */ | ||
2143 | SkGmPhyWrite(pAC, IoC, Port, 29, 0x001f); | ||
2144 | SkGmPhyWrite(pAC, IoC, Port, 30, 0xfff3); | ||
2145 | |||
2146 | SK_IN32(IoC, PCI_C(PCI_OUR_REG_1), &DWord); | ||
2147 | |||
2148 | SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2149 | |||
2150 | /* Set PHY to Coma Mode */ | ||
2151 | SK_OUT32(IoC, PCI_C(PCI_OUR_REG_1), DWord | PCI_PHY_COMA); | ||
2152 | |||
2153 | SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2154 | |||
2155 | break; | ||
2156 | |||
2157 | /* IEEE 22.2.4.1.5 compatible power down mode */ | ||
2158 | case PHY_PM_IEEE_POWER_DOWN: | ||
2159 | /* | ||
2160 | * - disable MAC 125 MHz clock | ||
2161 | * - allow MAC power down | ||
2162 | */ | ||
2163 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word); | ||
2164 | Word |= PHY_M_PC_DIS_125CLK; | ||
2165 | Word &= ~PHY_M_PC_MAC_POW_UP; | ||
2166 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word); | ||
2167 | |||
2168 | /* | ||
2169 | * register changes must be followed by a software | ||
2170 | * reset to take effect | ||
2171 | */ | ||
2172 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word); | ||
2173 | Word |= PHY_CT_RESET; | ||
2174 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word); | ||
2175 | |||
2176 | /* switch IEEE compatible power down mode on */ | ||
2177 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word); | ||
2178 | Word |= PHY_CT_PDOWN; | ||
2179 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word); | ||
2180 | break; | ||
2181 | |||
2182 | /* energy detect and energy detect plus mode */ | ||
2183 | case PHY_PM_ENERGY_DETECT: | ||
2184 | case PHY_PM_ENERGY_DETECT_PLUS: | ||
2185 | /* | ||
2186 | * - disable MAC 125 MHz clock | ||
2187 | */ | ||
2188 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word); | ||
2189 | Word |= PHY_M_PC_DIS_125CLK; | ||
2190 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word); | ||
2191 | |||
2192 | /* activate energy detect mode 1 */ | ||
2193 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word); | ||
2194 | |||
2195 | /* energy detect mode */ | ||
2196 | if (Mode == PHY_PM_ENERGY_DETECT) { | ||
2197 | Word |= PHY_M_PC_EN_DET; | ||
2198 | } | ||
2199 | /* energy detect plus mode */ | ||
2200 | else { | ||
2201 | Word |= PHY_M_PC_EN_DET_PLUS; | ||
2202 | } | ||
2203 | |||
2204 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word); | ||
2205 | |||
2206 | /* | ||
2207 | * reinitialize the PHY to force a software reset | ||
2208 | * which is necessary after the register settings | ||
2209 | * for the energy detect modes. | ||
2210 | * Furthermore reinitialisation prevents that the | ||
2211 | * PHY is running out of a stable state. | ||
2212 | */ | ||
2213 | SkGmInitPhyMarv(pAC, IoC, Port, SK_FALSE); | ||
2214 | break; | ||
2215 | |||
2216 | /* don't change current power mode */ | ||
2217 | default: | ||
2218 | pAC->GIni.GP[Port].PPhyPowerState = LastMode; | ||
2219 | Ret = 1; | ||
2220 | break; | ||
2221 | } | ||
2222 | } | ||
2223 | /* low power modes are not supported by this chip */ | ||
2224 | else { | ||
2225 | Ret = 1; | ||
2226 | } | ||
2227 | |||
2228 | return(Ret); | ||
2229 | |||
2230 | } /* SkGmEnterLowPowerMode */ | ||
2231 | |||
2232 | /****************************************************************************** | ||
2233 | * | ||
2234 | * SkGmLeaveLowPowerMode() | ||
2235 | * | ||
2236 | * Description: | ||
2237 | * Leave the current low power mode and switch to normal mode | ||
2238 | * | ||
2239 | * Note: | ||
2240 | * | ||
2241 | * Returns: | ||
2242 | * 0: ok | ||
2243 | * 1: error | ||
2244 | */ | ||
2245 | int SkGmLeaveLowPowerMode( | ||
2246 | SK_AC *pAC, /* adapter context */ | ||
2247 | SK_IOC IoC, /* IO context */ | ||
2248 | int Port) /* Port Index (e.g. MAC_1) */ | ||
2249 | { | ||
2250 | SK_U32 DWord; | ||
2251 | SK_U16 Word; | ||
2252 | SK_U8 LastMode; | ||
2253 | int Ret = 0; | ||
2254 | |||
2255 | if (pAC->GIni.GIYukonLite && | ||
2256 | pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) { | ||
2257 | |||
2258 | /* save current power mode */ | ||
2259 | LastMode = pAC->GIni.GP[Port].PPhyPowerState; | ||
2260 | pAC->GIni.GP[Port].PPhyPowerState = PHY_PM_OPERATIONAL_MODE; | ||
2261 | |||
2262 | switch (LastMode) { | ||
2263 | /* coma mode (deep sleep) */ | ||
2264 | case PHY_PM_DEEP_SLEEP: | ||
2265 | SK_IN32(IoC, PCI_C(PCI_OUR_REG_1), &DWord); | ||
2266 | |||
2267 | SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2268 | |||
2269 | /* Release PHY from Coma Mode */ | ||
2270 | SK_OUT32(IoC, PCI_C(PCI_OUR_REG_1), DWord & ~PCI_PHY_COMA); | ||
2271 | |||
2272 | SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2273 | |||
2274 | SK_IN32(IoC, B2_GP_IO, &DWord); | ||
2275 | |||
2276 | /* set to output */ | ||
2277 | DWord |= (GP_DIR_9 | GP_IO_9); | ||
2278 | |||
2279 | /* set PHY reset */ | ||
2280 | SK_OUT32(IoC, B2_GP_IO, DWord); | ||
2281 | |||
2282 | DWord &= ~GP_IO_9; /* clear PHY reset (active high) */ | ||
2283 | |||
2284 | /* clear PHY reset */ | ||
2285 | SK_OUT32(IoC, B2_GP_IO, DWord); | ||
2286 | break; | ||
2287 | |||
2288 | /* IEEE 22.2.4.1.5 compatible power down mode */ | ||
2289 | case PHY_PM_IEEE_POWER_DOWN: | ||
2290 | /* | ||
2291 | * - enable MAC 125 MHz clock | ||
2292 | * - set MAC power up | ||
2293 | */ | ||
2294 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word); | ||
2295 | Word &= ~PHY_M_PC_DIS_125CLK; | ||
2296 | Word |= PHY_M_PC_MAC_POW_UP; | ||
2297 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word); | ||
2298 | |||
2299 | /* | ||
2300 | * register changes must be followed by a software | ||
2301 | * reset to take effect | ||
2302 | */ | ||
2303 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word); | ||
2304 | Word |= PHY_CT_RESET; | ||
2305 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word); | ||
2306 | |||
2307 | /* switch IEEE compatible power down mode off */ | ||
2308 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word); | ||
2309 | Word &= ~PHY_CT_PDOWN; | ||
2310 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word); | ||
2311 | break; | ||
2312 | |||
2313 | /* energy detect and energy detect plus mode */ | ||
2314 | case PHY_PM_ENERGY_DETECT: | ||
2315 | case PHY_PM_ENERGY_DETECT_PLUS: | ||
2316 | /* | ||
2317 | * - enable MAC 125 MHz clock | ||
2318 | */ | ||
2319 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word); | ||
2320 | Word &= ~PHY_M_PC_DIS_125CLK; | ||
2321 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word); | ||
2322 | |||
2323 | /* disable energy detect mode */ | ||
2324 | SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word); | ||
2325 | Word &= ~PHY_M_PC_EN_DET_MSK; | ||
2326 | SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word); | ||
2327 | |||
2328 | /* | ||
2329 | * reinitialize the PHY to force a software reset | ||
2330 | * which is necessary after the register settings | ||
2331 | * for the energy detect modes. | ||
2332 | * Furthermore reinitialisation prevents that the | ||
2333 | * PHY is running out of a stable state. | ||
2334 | */ | ||
2335 | SkGmInitPhyMarv(pAC, IoC, Port, SK_FALSE); | ||
2336 | break; | ||
2337 | |||
2338 | /* don't change current power mode */ | ||
2339 | default: | ||
2340 | pAC->GIni.GP[Port].PPhyPowerState = LastMode; | ||
2341 | Ret = 1; | ||
2342 | break; | ||
2343 | } | ||
2344 | } | ||
2345 | /* low power modes are not supported by this chip */ | ||
2346 | else { | ||
2347 | Ret = 1; | ||
2348 | } | ||
2349 | |||
2350 | return(Ret); | ||
2351 | |||
2352 | } /* SkGmLeaveLowPowerMode */ | ||
2353 | #endif /* !SK_SLIM */ | ||
2354 | |||
2355 | |||
2356 | /****************************************************************************** | 2048 | /****************************************************************************** |
2357 | * | 2049 | * |
2358 | * SkGmInitPhyMarv() - Initialize the Marvell Phy registers | 2050 | * SkGmInitPhyMarv() - Initialize the Marvell Phy registers |
@@ -3420,145 +3112,6 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
3420 | } /* SkMacAutoNegDone */ | 3112 | } /* SkMacAutoNegDone */ |
3421 | 3113 | ||
3422 | 3114 | ||
3423 | #ifdef GENESIS | ||
3424 | /****************************************************************************** | ||
3425 | * | ||
3426 | * SkXmSetRxTxEn() - Special Set Rx/Tx Enable and some features in XMAC | ||
3427 | * | ||
3428 | * Description: | ||
3429 | * sets MAC or PHY LoopBack and Duplex Mode in the MMU Command Reg. | ||
3430 | * enables Rx/Tx | ||
3431 | * | ||
3432 | * Returns: N/A | ||
3433 | */ | ||
3434 | static void SkXmSetRxTxEn( | ||
3435 | SK_AC *pAC, /* Adapter Context */ | ||
3436 | SK_IOC IoC, /* IO context */ | ||
3437 | int Port, /* Port Index (MAC_1 + n) */ | ||
3438 | int Para) /* Parameter to set: MAC or PHY LoopBack, Duplex Mode */ | ||
3439 | { | ||
3440 | SK_U16 Word; | ||
3441 | |||
3442 | XM_IN16(IoC, Port, XM_MMU_CMD, &Word); | ||
3443 | |||
3444 | switch (Para & (SK_MAC_LOOPB_ON | SK_MAC_LOOPB_OFF)) { | ||
3445 | case SK_MAC_LOOPB_ON: | ||
3446 | Word |= XM_MMU_MAC_LB; | ||
3447 | break; | ||
3448 | case SK_MAC_LOOPB_OFF: | ||
3449 | Word &= ~XM_MMU_MAC_LB; | ||
3450 | break; | ||
3451 | } | ||
3452 | |||
3453 | switch (Para & (SK_PHY_LOOPB_ON | SK_PHY_LOOPB_OFF)) { | ||
3454 | case SK_PHY_LOOPB_ON: | ||
3455 | Word |= XM_MMU_GMII_LOOP; | ||
3456 | break; | ||
3457 | case SK_PHY_LOOPB_OFF: | ||
3458 | Word &= ~XM_MMU_GMII_LOOP; | ||
3459 | break; | ||
3460 | } | ||
3461 | |||
3462 | switch (Para & (SK_PHY_FULLD_ON | SK_PHY_FULLD_OFF)) { | ||
3463 | case SK_PHY_FULLD_ON: | ||
3464 | Word |= XM_MMU_GMII_FD; | ||
3465 | break; | ||
3466 | case SK_PHY_FULLD_OFF: | ||
3467 | Word &= ~XM_MMU_GMII_FD; | ||
3468 | break; | ||
3469 | } | ||
3470 | |||
3471 | XM_OUT16(IoC, Port, XM_MMU_CMD, Word | XM_MMU_ENA_RX | XM_MMU_ENA_TX); | ||
3472 | |||
3473 | /* dummy read to ensure writing */ | ||
3474 | XM_IN16(IoC, Port, XM_MMU_CMD, &Word); | ||
3475 | |||
3476 | } /* SkXmSetRxTxEn */ | ||
3477 | #endif /* GENESIS */ | ||
3478 | |||
3479 | |||
3480 | #ifdef YUKON | ||
3481 | /****************************************************************************** | ||
3482 | * | ||
3483 | * SkGmSetRxTxEn() - Special Set Rx/Tx Enable and some features in GMAC | ||
3484 | * | ||
3485 | * Description: | ||
3486 | * sets MAC LoopBack and Duplex Mode in the General Purpose Control Reg. | ||
3487 | * enables Rx/Tx | ||
3488 | * | ||
3489 | * Returns: N/A | ||
3490 | */ | ||
3491 | static void SkGmSetRxTxEn( | ||
3492 | SK_AC *pAC, /* Adapter Context */ | ||
3493 | SK_IOC IoC, /* IO context */ | ||
3494 | int Port, /* Port Index (MAC_1 + n) */ | ||
3495 | int Para) /* Parameter to set: MAC LoopBack, Duplex Mode */ | ||
3496 | { | ||
3497 | SK_U16 Ctrl; | ||
3498 | |||
3499 | GM_IN16(IoC, Port, GM_GP_CTRL, &Ctrl); | ||
3500 | |||
3501 | switch (Para & (SK_MAC_LOOPB_ON | SK_MAC_LOOPB_OFF)) { | ||
3502 | case SK_MAC_LOOPB_ON: | ||
3503 | Ctrl |= GM_GPCR_LOOP_ENA; | ||
3504 | break; | ||
3505 | case SK_MAC_LOOPB_OFF: | ||
3506 | Ctrl &= ~GM_GPCR_LOOP_ENA; | ||
3507 | break; | ||
3508 | } | ||
3509 | |||
3510 | switch (Para & (SK_PHY_FULLD_ON | SK_PHY_FULLD_OFF)) { | ||
3511 | case SK_PHY_FULLD_ON: | ||
3512 | Ctrl |= GM_GPCR_DUP_FULL; | ||
3513 | break; | ||
3514 | case SK_PHY_FULLD_OFF: | ||
3515 | Ctrl &= ~GM_GPCR_DUP_FULL; | ||
3516 | break; | ||
3517 | } | ||
3518 | |||
3519 | GM_OUT16(IoC, Port, GM_GP_CTRL, (SK_U16)(Ctrl | GM_GPCR_RX_ENA | | ||
3520 | GM_GPCR_TX_ENA)); | ||
3521 | |||
3522 | /* dummy read to ensure writing */ | ||
3523 | GM_IN16(IoC, Port, GM_GP_CTRL, &Ctrl); | ||
3524 | |||
3525 | } /* SkGmSetRxTxEn */ | ||
3526 | #endif /* YUKON */ | ||
3527 | |||
3528 | |||
3529 | #ifndef SK_SLIM | ||
3530 | /****************************************************************************** | ||
3531 | * | ||
3532 | * SkMacSetRxTxEn() - Special Set Rx/Tx Enable and parameters | ||
3533 | * | ||
3534 | * Description: calls the Special Set Rx/Tx Enable routines dep. on board type | ||
3535 | * | ||
3536 | * Returns: N/A | ||
3537 | */ | ||
3538 | void SkMacSetRxTxEn( | ||
3539 | SK_AC *pAC, /* Adapter Context */ | ||
3540 | SK_IOC IoC, /* IO context */ | ||
3541 | int Port, /* Port Index (MAC_1 + n) */ | ||
3542 | int Para) | ||
3543 | { | ||
3544 | #ifdef GENESIS | ||
3545 | if (pAC->GIni.GIGenesis) { | ||
3546 | |||
3547 | SkXmSetRxTxEn(pAC, IoC, Port, Para); | ||
3548 | } | ||
3549 | #endif /* GENESIS */ | ||
3550 | |||
3551 | #ifdef YUKON | ||
3552 | if (pAC->GIni.GIYukon) { | ||
3553 | |||
3554 | SkGmSetRxTxEn(pAC, IoC, Port, Para); | ||
3555 | } | ||
3556 | #endif /* YUKON */ | ||
3557 | |||
3558 | } /* SkMacSetRxTxEn */ | ||
3559 | #endif /* !SK_SLIM */ | ||
3560 | |||
3561 | |||
3562 | /****************************************************************************** | 3115 | /****************************************************************************** |
3563 | * | 3116 | * |
3564 | * SkMacRxTxEnable() - Enable Rx/Tx activity if port is up | 3117 | * SkMacRxTxEnable() - Enable Rx/Tx activity if port is up |
@@ -3976,7 +3529,7 @@ SK_U16 PhyStat) /* PHY Status word to analyse */ | |||
3976 | * Returns: | 3529 | * Returns: |
3977 | * nothing | 3530 | * nothing |
3978 | */ | 3531 | */ |
3979 | void SkXmIrq( | 3532 | static void SkXmIrq( |
3980 | SK_AC *pAC, /* adapter context */ | 3533 | SK_AC *pAC, /* adapter context */ |
3981 | SK_IOC IoC, /* IO context */ | 3534 | SK_IOC IoC, /* IO context */ |
3982 | int Port) /* Port Index (MAC_1 + n) */ | 3535 | int Port) /* Port Index (MAC_1 + n) */ |
@@ -4112,7 +3665,7 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
4112 | * Returns: | 3665 | * Returns: |
4113 | * nothing | 3666 | * nothing |
4114 | */ | 3667 | */ |
4115 | void SkGmIrq( | 3668 | static void SkGmIrq( |
4116 | SK_AC *pAC, /* adapter context */ | 3669 | SK_AC *pAC, /* adapter context */ |
4117 | SK_IOC IoC, /* IO context */ | 3670 | SK_IOC IoC, /* IO context */ |
4118 | int Port) /* Port Index (MAC_1 + n) */ | 3671 | int Port) /* Port Index (MAC_1 + n) */ |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index d167deda9a53..ed5458c45446 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -2084,6 +2084,38 @@ static int netdev_close(struct net_device *dev) | |||
2084 | return 0; | 2084 | return 0; |
2085 | } | 2085 | } |
2086 | 2086 | ||
2087 | #ifdef CONFIG_PM | ||
2088 | static int starfire_suspend(struct pci_dev *pdev, pm_message_t state) | ||
2089 | { | ||
2090 | struct net_device *dev = pci_get_drvdata(pdev); | ||
2091 | |||
2092 | if (netif_running(dev)) { | ||
2093 | netif_device_detach(dev); | ||
2094 | netdev_close(dev); | ||
2095 | } | ||
2096 | |||
2097 | pci_save_state(pdev); | ||
2098 | pci_set_power_state(pdev, pci_choose_state(pdev,state)); | ||
2099 | |||
2100 | return 0; | ||
2101 | } | ||
2102 | |||
2103 | static int starfire_resume(struct pci_dev *pdev) | ||
2104 | { | ||
2105 | struct net_device *dev = pci_get_drvdata(pdev); | ||
2106 | |||
2107 | pci_set_power_state(pdev, PCI_D0); | ||
2108 | pci_restore_state(pdev); | ||
2109 | |||
2110 | if (netif_running(dev)) { | ||
2111 | netdev_open(dev); | ||
2112 | netif_device_attach(dev); | ||
2113 | } | ||
2114 | |||
2115 | return 0; | ||
2116 | } | ||
2117 | #endif /* CONFIG_PM */ | ||
2118 | |||
2087 | 2119 | ||
2088 | static void __devexit starfire_remove_one (struct pci_dev *pdev) | 2120 | static void __devexit starfire_remove_one (struct pci_dev *pdev) |
2089 | { | 2121 | { |
@@ -2115,6 +2147,10 @@ static struct pci_driver starfire_driver = { | |||
2115 | .name = DRV_NAME, | 2147 | .name = DRV_NAME, |
2116 | .probe = starfire_init_one, | 2148 | .probe = starfire_init_one, |
2117 | .remove = __devexit_p(starfire_remove_one), | 2149 | .remove = __devexit_p(starfire_remove_one), |
2150 | #ifdef CONFIG_PM | ||
2151 | .suspend = starfire_suspend, | ||
2152 | .resume = starfire_resume, | ||
2153 | #endif /* CONFIG_PM */ | ||
2118 | .id_table = starfire_pci_tbl, | 2154 | .id_table = starfire_pci_tbl, |
2119 | }; | 2155 | }; |
2120 | 2156 | ||
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 0ab9c38b4a34..8cdeb5cbab5b 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -633,9 +633,13 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
633 | 633 | ||
634 | np->phys[0] = 1; /* Default setting */ | 634 | np->phys[0] = 1; /* Default setting */ |
635 | np->mii_preamble_required++; | 635 | np->mii_preamble_required++; |
636 | /* | ||
637 | * It seems some phys doesn't deal well with address 0 being accessed | ||
638 | * first, so leave address zero to the end of the loop (32 & 31). | ||
639 | */ | ||
636 | for (phy = 1; phy <= 32 && phy_idx < MII_CNT; phy++) { | 640 | for (phy = 1; phy <= 32 && phy_idx < MII_CNT; phy++) { |
637 | int mii_status = mdio_read(dev, phy, MII_BMSR); | ||
638 | int phyx = phy & 0x1f; | 641 | int phyx = phy & 0x1f; |
642 | int mii_status = mdio_read(dev, phyx, MII_BMSR); | ||
639 | if (mii_status != 0xffff && mii_status != 0x0000) { | 643 | if (mii_status != 0xffff && mii_status != 0x0000) { |
640 | np->phys[phy_idx++] = phyx; | 644 | np->phys[phy_idx++] = phyx; |
641 | np->mii_if.advertising = mdio_read(dev, phyx, MII_ADVERTISE); | 645 | np->mii_if.advertising = mdio_read(dev, phyx, MII_ADVERTISE); |
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index 97712c3c4e07..c58a4c31d0dd 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c | |||
@@ -122,6 +122,7 @@ | |||
122 | #include <linux/spinlock.h> | 122 | #include <linux/spinlock.h> |
123 | #include <linux/version.h> | 123 | #include <linux/version.h> |
124 | #include <linux/bitops.h> | 124 | #include <linux/bitops.h> |
125 | #include <linux/jiffies.h> | ||
125 | 126 | ||
126 | #include <net/checksum.h> | 127 | #include <net/checksum.h> |
127 | 128 | ||
@@ -512,7 +513,7 @@ static int streamer_reset(struct net_device *dev) | |||
512 | 513 | ||
513 | while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) { | 514 | while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) { |
514 | msleep_interruptible(100); | 515 | msleep_interruptible(100); |
515 | if (jiffies - t > 40 * HZ) { | 516 | if (time_after(jiffies, t + 40 * HZ)) { |
516 | printk(KERN_ERR | 517 | printk(KERN_ERR |
517 | "IBM PCI tokenring card not responding\n"); | 518 | "IBM PCI tokenring card not responding\n"); |
518 | release_region(dev->base_addr, STREAMER_IO_SPACE); | 519 | release_region(dev->base_addr, STREAMER_IO_SPACE); |
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c index 05477d24fd49..23032a7bc0a9 100644 --- a/drivers/net/tokenring/olympic.c +++ b/drivers/net/tokenring/olympic.c | |||
@@ -100,6 +100,7 @@ | |||
100 | #include <linux/pci.h> | 100 | #include <linux/pci.h> |
101 | #include <linux/spinlock.h> | 101 | #include <linux/spinlock.h> |
102 | #include <linux/bitops.h> | 102 | #include <linux/bitops.h> |
103 | #include <linux/jiffies.h> | ||
103 | 104 | ||
104 | #include <net/checksum.h> | 105 | #include <net/checksum.h> |
105 | 106 | ||
@@ -307,7 +308,7 @@ static int __devinit olympic_init(struct net_device *dev) | |||
307 | t=jiffies; | 308 | t=jiffies; |
308 | while((readl(olympic_mmio+BCTL)) & BCTL_SOFTRESET) { | 309 | while((readl(olympic_mmio+BCTL)) & BCTL_SOFTRESET) { |
309 | schedule(); | 310 | schedule(); |
310 | if(jiffies-t > 40*HZ) { | 311 | if(time_after(jiffies, t + 40*HZ)) { |
311 | printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); | 312 | printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); |
312 | return -ENODEV; | 313 | return -ENODEV; |
313 | } | 314 | } |
@@ -359,7 +360,7 @@ static int __devinit olympic_init(struct net_device *dev) | |||
359 | t=jiffies; | 360 | t=jiffies; |
360 | while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) { | 361 | while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) { |
361 | schedule() ; | 362 | schedule() ; |
362 | if(jiffies-t > 2*HZ) { | 363 | if(time_after(jiffies, t + 2*HZ)) { |
363 | printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ; | 364 | printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ; |
364 | return -ENODEV; | 365 | return -ENODEV; |
365 | } | 366 | } |
@@ -373,7 +374,7 @@ static int __devinit olympic_init(struct net_device *dev) | |||
373 | t=jiffies; | 374 | t=jiffies; |
374 | while(!((readl(olympic_mmio+SISR_RR)) & SISR_SRB_REPLY)) { | 375 | while(!((readl(olympic_mmio+SISR_RR)) & SISR_SRB_REPLY)) { |
375 | schedule(); | 376 | schedule(); |
376 | if(jiffies-t > 15*HZ) { | 377 | if(time_after(jiffies, t + 15*HZ)) { |
377 | printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); | 378 | printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); |
378 | return -ENODEV; | 379 | return -ENODEV; |
379 | } | 380 | } |
@@ -519,7 +520,7 @@ static int olympic_open(struct net_device *dev) | |||
519 | olympic_priv->srb_queued=0; | 520 | olympic_priv->srb_queued=0; |
520 | break; | 521 | break; |
521 | } | 522 | } |
522 | if ((jiffies-t) > 10*HZ) { | 523 | if (time_after(jiffies, t + 10*HZ)) { |
523 | printk(KERN_WARNING "%s: SRB timed out. \n",dev->name) ; | 524 | printk(KERN_WARNING "%s: SRB timed out. \n",dev->name) ; |
524 | olympic_priv->srb_queued=0; | 525 | olympic_priv->srb_queued=0; |
525 | break ; | 526 | break ; |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index d7fb3ffe06ac..d6c3d52d2e86 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -402,8 +402,7 @@ static void de_rx (struct de_private *de) | |||
402 | unsigned copying_skb, buflen; | 402 | unsigned copying_skb, buflen; |
403 | 403 | ||
404 | skb = de->rx_skb[rx_tail].skb; | 404 | skb = de->rx_skb[rx_tail].skb; |
405 | if (!skb) | 405 | BUG_ON(!skb); |
406 | BUG(); | ||
407 | rmb(); | 406 | rmb(); |
408 | status = le32_to_cpu(de->rx_ring[rx_tail].opts1); | 407 | status = le32_to_cpu(de->rx_ring[rx_tail].opts1); |
409 | if (status & DescOwn) | 408 | if (status & DescOwn) |
@@ -545,8 +544,7 @@ static void de_tx (struct de_private *de) | |||
545 | break; | 544 | break; |
546 | 545 | ||
547 | skb = de->tx_skb[tx_tail].skb; | 546 | skb = de->tx_skb[tx_tail].skb; |
548 | if (!skb) | 547 | BUG_ON(!skb); |
549 | BUG(); | ||
550 | if (unlikely(skb == DE_DUMMY_SKB)) | 548 | if (unlikely(skb == DE_DUMMY_SKB)) |
551 | goto next; | 549 | goto next; |
552 | 550 | ||
@@ -789,8 +787,7 @@ static void __de_set_rx_mode (struct net_device *dev) | |||
789 | 787 | ||
790 | de->tx_head = NEXT_TX(entry); | 788 | de->tx_head = NEXT_TX(entry); |
791 | 789 | ||
792 | if (TX_BUFFS_AVAIL(de) < 0) | 790 | BUG_ON(TX_BUFFS_AVAIL(de) < 0); |
793 | BUG(); | ||
794 | if (TX_BUFFS_AVAIL(de) == 0) | 791 | if (TX_BUFFS_AVAIL(de) == 0) |
795 | netif_stop_queue(dev); | 792 | netif_stop_queue(dev); |
796 | 793 | ||
@@ -916,8 +913,7 @@ static void de_set_media (struct de_private *de) | |||
916 | unsigned media = de->media_type; | 913 | unsigned media = de->media_type; |
917 | u32 macmode = dr32(MacMode); | 914 | u32 macmode = dr32(MacMode); |
918 | 915 | ||
919 | if (de_is_running(de)) | 916 | BUG_ON(de_is_running(de)); |
920 | BUG(); | ||
921 | 917 | ||
922 | if (de->de21040) | 918 | if (de->de21040) |
923 | dw32(CSR11, FULL_DUPLEX_MAGIC); | 919 | dw32(CSR11, FULL_DUPLEX_MAGIC); |
@@ -1153,8 +1149,7 @@ static void de_media_interrupt (struct de_private *de, u32 status) | |||
1153 | return; | 1149 | return; |
1154 | } | 1150 | } |
1155 | 1151 | ||
1156 | if (!(status & LinkFail)) | 1152 | BUG_ON(!(status & LinkFail)); |
1157 | BUG(); | ||
1158 | 1153 | ||
1159 | if (netif_carrier_ok(de->dev)) { | 1154 | if (netif_carrier_ok(de->dev)) { |
1160 | de_link_down(de); | 1155 | de_link_down(de); |
@@ -2092,8 +2087,7 @@ static void __exit de_remove_one (struct pci_dev *pdev) | |||
2092 | struct net_device *dev = pci_get_drvdata(pdev); | 2087 | struct net_device *dev = pci_get_drvdata(pdev); |
2093 | struct de_private *de = dev->priv; | 2088 | struct de_private *de = dev->priv; |
2094 | 2089 | ||
2095 | if (!dev) | 2090 | BUG_ON(!dev); |
2096 | BUG(); | ||
2097 | unregister_netdev(dev); | 2091 | unregister_netdev(dev); |
2098 | kfree(de->ee_data); | 2092 | kfree(de->ee_data); |
2099 | iounmap(de->regs); | 2093 | iounmap(de->regs); |
diff --git a/drivers/net/tulip/pnic.c b/drivers/net/tulip/pnic.c index d9980bde7508..ca7e53246adb 100644 --- a/drivers/net/tulip/pnic.c +++ b/drivers/net/tulip/pnic.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/jiffies.h> | ||
19 | #include "tulip.h" | 20 | #include "tulip.h" |
20 | 21 | ||
21 | 22 | ||
@@ -68,7 +69,7 @@ void pnic_lnk_change(struct net_device *dev, int csr5) | |||
68 | */ | 69 | */ |
69 | if (tulip_media_cap[dev->if_port] & MediaIsMII) | 70 | if (tulip_media_cap[dev->if_port] & MediaIsMII) |
70 | return; | 71 | return; |
71 | if (! tp->nwayset || jiffies - dev->trans_start > 1*HZ) { | 72 | if (! tp->nwayset || time_after(jiffies, dev->trans_start + 1*HZ)) { |
72 | tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff); | 73 | tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff); |
73 | iowrite32(tp->csr6, ioaddr + CSR6); | 74 | iowrite32(tp->csr6, ioaddr + CSR6); |
74 | iowrite32(0x30, ioaddr + CSR12); | 75 | iowrite32(0x30, ioaddr + CSR12); |
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 5b1af3986abf..ba05dedf29d3 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -1645,7 +1645,7 @@ static int w840_suspend (struct pci_dev *pdev, pm_message_t state) | |||
1645 | 1645 | ||
1646 | /* no more hardware accesses behind this line. */ | 1646 | /* no more hardware accesses behind this line. */ |
1647 | 1647 | ||
1648 | if (np->csr6) BUG(); | 1648 | BUG_ON(np->csr6); |
1649 | if (ioread32(ioaddr + IntrEnable)) BUG(); | 1649 | if (ioread32(ioaddr + IntrEnable)) BUG(); |
1650 | 1650 | ||
1651 | /* pci_power_off(pdev, -1); */ | 1651 | /* pci_power_off(pdev, -1); */ |
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index 60d1e05ab732..56344103ac23 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c | |||
@@ -32,6 +32,9 @@ | |||
32 | 32 | ||
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <asm/io.h> | 34 | #include <asm/io.h> |
35 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
36 | #include <asm/irq.h> | ||
37 | #endif | ||
35 | 38 | ||
36 | #ifdef DEBUG | 39 | #ifdef DEBUG |
37 | #define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__) | 40 | #define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__) |
@@ -598,10 +601,8 @@ static void setup_descriptors(struct xircom_private *card) | |||
598 | enter("setup_descriptors"); | 601 | enter("setup_descriptors"); |
599 | 602 | ||
600 | 603 | ||
601 | if (card->rx_buffer == NULL) | 604 | BUG_ON(card->rx_buffer == NULL); |
602 | BUG(); | 605 | BUG_ON(card->tx_buffer == NULL); |
603 | if (card->tx_buffer == NULL) | ||
604 | BUG(); | ||
605 | 606 | ||
606 | /* Receive descriptors */ | 607 | /* Receive descriptors */ |
607 | memset(card->rx_buffer, 0, 128); /* clear the descriptors */ | 608 | memset(card->rx_buffer, 0, 128); /* clear the descriptors */ |
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c index 7db1d1d0bb34..cf5c805452a3 100644 --- a/drivers/net/wan/hostess_sv11.c +++ b/drivers/net/wan/hostess_sv11.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/ioport.h> | 29 | #include <linux/ioport.h> |
30 | #include <net/arp.h> | 30 | #include <net/arp.h> |
31 | 31 | ||
32 | #include <asm/irq.h> | ||
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
33 | #include <asm/dma.h> | 34 | #include <asm/dma.h> |
34 | #include <asm/byteorder.h> | 35 | #include <asm/byteorder.h> |
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c index 5380ddfcd7d5..050e854e7774 100644 --- a/drivers/net/wan/sealevel.c +++ b/drivers/net/wan/sealevel.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <net/arp.h> | 24 | #include <net/arp.h> |
25 | 25 | ||
26 | #include <asm/irq.h> | ||
26 | #include <asm/io.h> | 27 | #include <asm/io.h> |
27 | #include <asm/dma.h> | 28 | #include <asm/dma.h> |
28 | #include <asm/byteorder.h> | 29 | #include <asm/byteorder.h> |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index ef85d76575a2..a1ede41d9071 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -6,7 +6,8 @@ menu "Wireless LAN (non-hamradio)" | |||
6 | depends on NETDEVICES | 6 | depends on NETDEVICES |
7 | 7 | ||
8 | config NET_RADIO | 8 | config NET_RADIO |
9 | bool "Wireless LAN drivers (non-hamradio) & Wireless Extensions" | 9 | bool "Wireless LAN drivers (non-hamradio)" |
10 | select WIRELESS_EXT | ||
10 | ---help--- | 11 | ---help--- |
11 | Support for wireless LANs and everything having to do with radio, | 12 | Support for wireless LANs and everything having to do with radio, |
12 | but not with amateur radio or FM broadcasting. | 13 | but not with amateur radio or FM broadcasting. |
@@ -239,7 +240,8 @@ config IPW2200_DEBUG | |||
239 | 240 | ||
240 | config AIRO | 241 | config AIRO |
241 | tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" | 242 | tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" |
242 | depends on NET_RADIO && ISA_DMA_API && CRYPTO && (PCI || BROKEN) | 243 | depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN) |
244 | select CRYPTO | ||
243 | ---help--- | 245 | ---help--- |
244 | This is the standard Linux driver to support Cisco/Aironet ISA and | 246 | This is the standard Linux driver to support Cisco/Aironet ISA and |
245 | PCI 802.11 wireless cards. | 247 | PCI 802.11 wireless cards. |
@@ -387,6 +389,7 @@ config PCMCIA_SPECTRUM | |||
387 | config AIRO_CS | 389 | config AIRO_CS |
388 | tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" | 390 | tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" |
389 | depends on NET_RADIO && PCMCIA && (BROKEN || !M32R) | 391 | depends on NET_RADIO && PCMCIA && (BROKEN || !M32R) |
392 | select CRYPTO | ||
390 | ---help--- | 393 | ---help--- |
391 | This is the standard Linux driver to support Cisco/Aironet PCMCIA | 394 | This is the standard Linux driver to support Cisco/Aironet PCMCIA |
392 | 802.11 wireless cards. This driver is the same as the Aironet | 395 | 802.11 wireless cards. This driver is the same as the Aironet |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index a4c7ae94614d..ef6495b07890 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/in.h> | 36 | #include <linux/in.h> |
37 | #include <linux/bitops.h> | 37 | #include <linux/bitops.h> |
38 | #include <linux/scatterlist.h> | 38 | #include <linux/scatterlist.h> |
39 | #include <linux/crypto.h> | ||
39 | #include <asm/io.h> | 40 | #include <asm/io.h> |
40 | #include <asm/system.h> | 41 | #include <asm/system.h> |
41 | 42 | ||
@@ -87,14 +88,6 @@ static struct pci_driver airo_driver = { | |||
87 | #include <linux/delay.h> | 88 | #include <linux/delay.h> |
88 | #endif | 89 | #endif |
89 | 90 | ||
90 | /* Support Cisco MIC feature */ | ||
91 | #define MICSUPPORT | ||
92 | |||
93 | #if defined(MICSUPPORT) && !defined(CONFIG_CRYPTO) | ||
94 | #warning MIC support requires Crypto API | ||
95 | #undef MICSUPPORT | ||
96 | #endif | ||
97 | |||
98 | /* Hack to do some power saving */ | 91 | /* Hack to do some power saving */ |
99 | #define POWER_ON_DOWN | 92 | #define POWER_ON_DOWN |
100 | 93 | ||
@@ -1118,7 +1111,6 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp); | |||
1118 | static int writerids(struct net_device *dev, aironet_ioctl *comp); | 1111 | static int writerids(struct net_device *dev, aironet_ioctl *comp); |
1119 | static int flashcard(struct net_device *dev, aironet_ioctl *comp); | 1112 | static int flashcard(struct net_device *dev, aironet_ioctl *comp); |
1120 | #endif /* CISCO_EXT */ | 1113 | #endif /* CISCO_EXT */ |
1121 | #ifdef MICSUPPORT | ||
1122 | static void micinit(struct airo_info *ai); | 1114 | static void micinit(struct airo_info *ai); |
1123 | static int micsetup(struct airo_info *ai); | 1115 | static int micsetup(struct airo_info *ai); |
1124 | static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len); | 1116 | static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len); |
@@ -1127,9 +1119,6 @@ static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *pPacket, | |||
1127 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi); | 1119 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi); |
1128 | static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); | 1120 | static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); |
1129 | 1121 | ||
1130 | #include <linux/crypto.h> | ||
1131 | #endif | ||
1132 | |||
1133 | struct airo_info { | 1122 | struct airo_info { |
1134 | struct net_device_stats stats; | 1123 | struct net_device_stats stats; |
1135 | struct net_device *dev; | 1124 | struct net_device *dev; |
@@ -1190,12 +1179,10 @@ struct airo_info { | |||
1190 | unsigned long scan_timestamp; /* Time started to scan */ | 1179 | unsigned long scan_timestamp; /* Time started to scan */ |
1191 | struct iw_spy_data spy_data; | 1180 | struct iw_spy_data spy_data; |
1192 | struct iw_public_data wireless_data; | 1181 | struct iw_public_data wireless_data; |
1193 | #ifdef MICSUPPORT | ||
1194 | /* MIC stuff */ | 1182 | /* MIC stuff */ |
1195 | struct crypto_tfm *tfm; | 1183 | struct crypto_tfm *tfm; |
1196 | mic_module mod[2]; | 1184 | mic_module mod[2]; |
1197 | mic_statistics micstats; | 1185 | mic_statistics micstats; |
1198 | #endif | ||
1199 | HostRxDesc rxfids[MPI_MAX_FIDS]; // rx/tx/config MPI350 descriptors | 1186 | HostRxDesc rxfids[MPI_MAX_FIDS]; // rx/tx/config MPI350 descriptors |
1200 | HostTxDesc txfids[MPI_MAX_FIDS]; | 1187 | HostTxDesc txfids[MPI_MAX_FIDS]; |
1201 | HostRidDesc config_desc; | 1188 | HostRidDesc config_desc; |
@@ -1229,7 +1216,6 @@ static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime); | |||
1229 | static int flashputbuf(struct airo_info *ai); | 1216 | static int flashputbuf(struct airo_info *ai); |
1230 | static int flashrestart(struct airo_info *ai,struct net_device *dev); | 1217 | static int flashrestart(struct airo_info *ai,struct net_device *dev); |
1231 | 1218 | ||
1232 | #ifdef MICSUPPORT | ||
1233 | /*********************************************************************** | 1219 | /*********************************************************************** |
1234 | * MIC ROUTINES * | 1220 | * MIC ROUTINES * |
1235 | *********************************************************************** | 1221 | *********************************************************************** |
@@ -1686,7 +1672,6 @@ static void emmh32_final(emmh32_context *context, u8 digest[4]) | |||
1686 | digest[2] = (val>>8) & 0xFF; | 1672 | digest[2] = (val>>8) & 0xFF; |
1687 | digest[3] = val & 0xFF; | 1673 | digest[3] = val & 0xFF; |
1688 | } | 1674 | } |
1689 | #endif | ||
1690 | 1675 | ||
1691 | static int readBSSListRid(struct airo_info *ai, int first, | 1676 | static int readBSSListRid(struct airo_info *ai, int first, |
1692 | BSSListRid *list) { | 1677 | BSSListRid *list) { |
@@ -2005,7 +1990,6 @@ static int mpi_send_packet (struct net_device *dev) | |||
2005 | * Firmware automaticly puts 802 header on so | 1990 | * Firmware automaticly puts 802 header on so |
2006 | * we don't need to account for it in the length | 1991 | * we don't need to account for it in the length |
2007 | */ | 1992 | */ |
2008 | #ifdef MICSUPPORT | ||
2009 | if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && | 1993 | if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && |
2010 | (ntohs(((u16 *)buffer)[6]) != 0x888E)) { | 1994 | (ntohs(((u16 *)buffer)[6]) != 0x888E)) { |
2011 | MICBuffer pMic; | 1995 | MICBuffer pMic; |
@@ -2022,9 +2006,7 @@ static int mpi_send_packet (struct net_device *dev) | |||
2022 | memcpy (sendbuf, &pMic, sizeof(pMic)); | 2006 | memcpy (sendbuf, &pMic, sizeof(pMic)); |
2023 | sendbuf += sizeof(pMic); | 2007 | sendbuf += sizeof(pMic); |
2024 | memcpy (sendbuf, buffer, len - sizeof(etherHead)); | 2008 | memcpy (sendbuf, buffer, len - sizeof(etherHead)); |
2025 | } else | 2009 | } else { |
2026 | #endif | ||
2027 | { | ||
2028 | *payloadLen = cpu_to_le16(len - sizeof(etherHead)); | 2010 | *payloadLen = cpu_to_le16(len - sizeof(etherHead)); |
2029 | 2011 | ||
2030 | dev->trans_start = jiffies; | 2012 | dev->trans_start = jiffies; |
@@ -2400,9 +2382,7 @@ void stop_airo_card( struct net_device *dev, int freeres ) | |||
2400 | ai->shared, ai->shared_dma); | 2382 | ai->shared, ai->shared_dma); |
2401 | } | 2383 | } |
2402 | } | 2384 | } |
2403 | #ifdef MICSUPPORT | ||
2404 | crypto_free_tfm(ai->tfm); | 2385 | crypto_free_tfm(ai->tfm); |
2405 | #endif | ||
2406 | del_airo_dev( dev ); | 2386 | del_airo_dev( dev ); |
2407 | free_netdev( dev ); | 2387 | free_netdev( dev ); |
2408 | } | 2388 | } |
@@ -2726,9 +2706,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, | |||
2726 | ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES); | 2706 | ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES); |
2727 | if (ai->thr_pid < 0) | 2707 | if (ai->thr_pid < 0) |
2728 | goto err_out_free; | 2708 | goto err_out_free; |
2729 | #ifdef MICSUPPORT | ||
2730 | ai->tfm = NULL; | 2709 | ai->tfm = NULL; |
2731 | #endif | ||
2732 | rc = add_airo_dev( dev ); | 2710 | rc = add_airo_dev( dev ); |
2733 | if (rc) | 2711 | if (rc) |
2734 | goto err_out_thr; | 2712 | goto err_out_thr; |
@@ -2969,10 +2947,8 @@ static int airo_thread(void *data) { | |||
2969 | airo_read_wireless_stats(ai); | 2947 | airo_read_wireless_stats(ai); |
2970 | else if (test_bit(JOB_PROMISC, &ai->flags)) | 2948 | else if (test_bit(JOB_PROMISC, &ai->flags)) |
2971 | airo_set_promisc(ai); | 2949 | airo_set_promisc(ai); |
2972 | #ifdef MICSUPPORT | ||
2973 | else if (test_bit(JOB_MIC, &ai->flags)) | 2950 | else if (test_bit(JOB_MIC, &ai->flags)) |
2974 | micinit(ai); | 2951 | micinit(ai); |
2975 | #endif | ||
2976 | else if (test_bit(JOB_EVENT, &ai->flags)) | 2952 | else if (test_bit(JOB_EVENT, &ai->flags)) |
2977 | airo_send_event(dev); | 2953 | airo_send_event(dev); |
2978 | else if (test_bit(JOB_AUTOWEP, &ai->flags)) | 2954 | else if (test_bit(JOB_AUTOWEP, &ai->flags)) |
@@ -3010,12 +2986,10 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) | |||
3010 | 2986 | ||
3011 | if ( status & EV_MIC ) { | 2987 | if ( status & EV_MIC ) { |
3012 | OUT4500( apriv, EVACK, EV_MIC ); | 2988 | OUT4500( apriv, EVACK, EV_MIC ); |
3013 | #ifdef MICSUPPORT | ||
3014 | if (test_bit(FLAG_MIC_CAPABLE, &apriv->flags)) { | 2989 | if (test_bit(FLAG_MIC_CAPABLE, &apriv->flags)) { |
3015 | set_bit(JOB_MIC, &apriv->flags); | 2990 | set_bit(JOB_MIC, &apriv->flags); |
3016 | wake_up_interruptible(&apriv->thr_wait); | 2991 | wake_up_interruptible(&apriv->thr_wait); |
3017 | } | 2992 | } |
3018 | #endif | ||
3019 | } | 2993 | } |
3020 | if ( status & EV_LINK ) { | 2994 | if ( status & EV_LINK ) { |
3021 | union iwreq_data wrqu; | 2995 | union iwreq_data wrqu; |
@@ -3194,11 +3168,8 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) | |||
3194 | } | 3168 | } |
3195 | bap_read (apriv, buffer + hdrlen/2, len, BAP0); | 3169 | bap_read (apriv, buffer + hdrlen/2, len, BAP0); |
3196 | } else { | 3170 | } else { |
3197 | #ifdef MICSUPPORT | ||
3198 | MICBuffer micbuf; | 3171 | MICBuffer micbuf; |
3199 | #endif | ||
3200 | bap_read (apriv, buffer, ETH_ALEN*2, BAP0); | 3172 | bap_read (apriv, buffer, ETH_ALEN*2, BAP0); |
3201 | #ifdef MICSUPPORT | ||
3202 | if (apriv->micstats.enabled) { | 3173 | if (apriv->micstats.enabled) { |
3203 | bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0); | 3174 | bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0); |
3204 | if (ntohs(micbuf.typelen) > 0x05DC) | 3175 | if (ntohs(micbuf.typelen) > 0x05DC) |
@@ -3211,15 +3182,10 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) | |||
3211 | skb_trim (skb, len + hdrlen); | 3182 | skb_trim (skb, len + hdrlen); |
3212 | } | 3183 | } |
3213 | } | 3184 | } |
3214 | #endif | ||
3215 | bap_read(apriv,buffer+ETH_ALEN,len,BAP0); | 3185 | bap_read(apriv,buffer+ETH_ALEN,len,BAP0); |
3216 | #ifdef MICSUPPORT | ||
3217 | if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) { | 3186 | if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) { |
3218 | badmic: | 3187 | badmic: |
3219 | dev_kfree_skb_irq (skb); | 3188 | dev_kfree_skb_irq (skb); |
3220 | #else | ||
3221 | if (0) { | ||
3222 | #endif | ||
3223 | badrx: | 3189 | badrx: |
3224 | OUT4500( apriv, EVACK, EV_RX); | 3190 | OUT4500( apriv, EVACK, EV_RX); |
3225 | goto exitrx; | 3191 | goto exitrx; |
@@ -3430,10 +3396,8 @@ static void mpi_receive_802_3(struct airo_info *ai) | |||
3430 | int len = 0; | 3396 | int len = 0; |
3431 | struct sk_buff *skb; | 3397 | struct sk_buff *skb; |
3432 | char *buffer; | 3398 | char *buffer; |
3433 | #ifdef MICSUPPORT | ||
3434 | int off = 0; | 3399 | int off = 0; |
3435 | MICBuffer micbuf; | 3400 | MICBuffer micbuf; |
3436 | #endif | ||
3437 | 3401 | ||
3438 | memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd)); | 3402 | memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd)); |
3439 | /* Make sure we got something */ | 3403 | /* Make sure we got something */ |
@@ -3448,7 +3412,6 @@ static void mpi_receive_802_3(struct airo_info *ai) | |||
3448 | goto badrx; | 3412 | goto badrx; |
3449 | } | 3413 | } |
3450 | buffer = skb_put(skb,len); | 3414 | buffer = skb_put(skb,len); |
3451 | #ifdef MICSUPPORT | ||
3452 | memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2); | 3415 | memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2); |
3453 | if (ai->micstats.enabled) { | 3416 | if (ai->micstats.enabled) { |
3454 | memcpy(&micbuf, | 3417 | memcpy(&micbuf, |
@@ -3470,9 +3433,6 @@ badmic: | |||
3470 | dev_kfree_skb_irq (skb); | 3433 | dev_kfree_skb_irq (skb); |
3471 | goto badrx; | 3434 | goto badrx; |
3472 | } | 3435 | } |
3473 | #else | ||
3474 | memcpy(buffer, ai->rxfids[0].virtual_host_addr, len); | ||
3475 | #endif | ||
3476 | #ifdef WIRELESS_SPY | 3436 | #ifdef WIRELESS_SPY |
3477 | if (ai->spy_data.spy_number > 0) { | 3437 | if (ai->spy_data.spy_number > 0) { |
3478 | char *sa; | 3438 | char *sa; |
@@ -3689,13 +3649,11 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) | |||
3689 | ai->config.authType = AUTH_OPEN; | 3649 | ai->config.authType = AUTH_OPEN; |
3690 | ai->config.modulation = MOD_CCK; | 3650 | ai->config.modulation = MOD_CCK; |
3691 | 3651 | ||
3692 | #ifdef MICSUPPORT | ||
3693 | if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) && | 3652 | if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) && |
3694 | (micsetup(ai) == SUCCESS)) { | 3653 | (micsetup(ai) == SUCCESS)) { |
3695 | ai->config.opmode |= MODE_MIC; | 3654 | ai->config.opmode |= MODE_MIC; |
3696 | set_bit(FLAG_MIC_CAPABLE, &ai->flags); | 3655 | set_bit(FLAG_MIC_CAPABLE, &ai->flags); |
3697 | } | 3656 | } |
3698 | #endif | ||
3699 | 3657 | ||
3700 | /* Save off the MAC */ | 3658 | /* Save off the MAC */ |
3701 | for( i = 0; i < ETH_ALEN; i++ ) { | 3659 | for( i = 0; i < ETH_ALEN; i++ ) { |
@@ -4170,15 +4128,12 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket) | |||
4170 | } | 4128 | } |
4171 | len -= ETH_ALEN * 2; | 4129 | len -= ETH_ALEN * 2; |
4172 | 4130 | ||
4173 | #ifdef MICSUPPORT | ||
4174 | if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && | 4131 | if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && |
4175 | (ntohs(((u16 *)pPacket)[6]) != 0x888E)) { | 4132 | (ntohs(((u16 *)pPacket)[6]) != 0x888E)) { |
4176 | if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS) | 4133 | if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS) |
4177 | return ERROR; | 4134 | return ERROR; |
4178 | miclen = sizeof(pMic); | 4135 | miclen = sizeof(pMic); |
4179 | } | 4136 | } |
4180 | #endif | ||
4181 | |||
4182 | // packet is destination[6], source[6], payload[len-12] | 4137 | // packet is destination[6], source[6], payload[len-12] |
4183 | // write the payload length and dst/src/payload | 4138 | // write the payload length and dst/src/payload |
4184 | if (bap_setup(ai, txFid, 0x0036, BAP1) != SUCCESS) return ERROR; | 4139 | if (bap_setup(ai, txFid, 0x0036, BAP1) != SUCCESS) return ERROR; |
@@ -5801,11 +5756,13 @@ static int airo_set_wap(struct net_device *dev, | |||
5801 | Cmd cmd; | 5756 | Cmd cmd; |
5802 | Resp rsp; | 5757 | Resp rsp; |
5803 | APListRid APList_rid; | 5758 | APListRid APList_rid; |
5804 | static const unsigned char bcast[ETH_ALEN] = { 255, 255, 255, 255, 255, 255 }; | 5759 | static const u8 any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
5760 | static const u8 off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
5805 | 5761 | ||
5806 | if (awrq->sa_family != ARPHRD_ETHER) | 5762 | if (awrq->sa_family != ARPHRD_ETHER) |
5807 | return -EINVAL; | 5763 | return -EINVAL; |
5808 | else if (!memcmp(bcast, awrq->sa_data, ETH_ALEN)) { | 5764 | else if (!memcmp(any, awrq->sa_data, ETH_ALEN) || |
5765 | !memcmp(off, awrq->sa_data, ETH_ALEN)) { | ||
5809 | memset(&cmd, 0, sizeof(cmd)); | 5766 | memset(&cmd, 0, sizeof(cmd)); |
5810 | cmd.cmd=CMD_LOSE_SYNC; | 5767 | cmd.cmd=CMD_LOSE_SYNC; |
5811 | if (down_interruptible(&local->sem)) | 5768 | if (down_interruptible(&local->sem)) |
@@ -6296,6 +6253,267 @@ static int airo_get_encode(struct net_device *dev, | |||
6296 | 6253 | ||
6297 | /*------------------------------------------------------------------*/ | 6254 | /*------------------------------------------------------------------*/ |
6298 | /* | 6255 | /* |
6256 | * Wireless Handler : set extended Encryption parameters | ||
6257 | */ | ||
6258 | static int airo_set_encodeext(struct net_device *dev, | ||
6259 | struct iw_request_info *info, | ||
6260 | union iwreq_data *wrqu, | ||
6261 | char *extra) | ||
6262 | { | ||
6263 | struct airo_info *local = dev->priv; | ||
6264 | struct iw_point *encoding = &wrqu->encoding; | ||
6265 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
6266 | CapabilityRid cap_rid; /* Card capability info */ | ||
6267 | int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 ); | ||
6268 | u16 currentAuthType = local->config.authType; | ||
6269 | int idx, key_len, alg = ext->alg; /* Check encryption mode */ | ||
6270 | wep_key_t key; | ||
6271 | |||
6272 | /* Is WEP supported ? */ | ||
6273 | readCapabilityRid(local, &cap_rid, 1); | ||
6274 | /* Older firmware doesn't support this... | ||
6275 | if(!(cap_rid.softCap & 2)) { | ||
6276 | return -EOPNOTSUPP; | ||
6277 | } */ | ||
6278 | readConfigRid(local, 1); | ||
6279 | |||
6280 | /* Determine and validate the key index */ | ||
6281 | idx = encoding->flags & IW_ENCODE_INDEX; | ||
6282 | if (idx) { | ||
6283 | if (idx < 1 || idx > ((cap_rid.softCap & 0x80) ? 4:1)) | ||
6284 | return -EINVAL; | ||
6285 | idx--; | ||
6286 | } else | ||
6287 | idx = get_wep_key(local, 0xffff); | ||
6288 | |||
6289 | if (encoding->flags & IW_ENCODE_DISABLED) | ||
6290 | alg = IW_ENCODE_ALG_NONE; | ||
6291 | |||
6292 | /* Just setting the transmit key? */ | ||
6293 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { | ||
6294 | set_wep_key(local, idx, NULL, 0, perm, 1); | ||
6295 | } else { | ||
6296 | /* Set the requested key first */ | ||
6297 | memset(key.key, 0, MAX_KEY_SIZE); | ||
6298 | switch (alg) { | ||
6299 | case IW_ENCODE_ALG_NONE: | ||
6300 | key.len = 0; | ||
6301 | break; | ||
6302 | case IW_ENCODE_ALG_WEP: | ||
6303 | if (ext->key_len > MIN_KEY_SIZE) { | ||
6304 | key.len = MAX_KEY_SIZE; | ||
6305 | } else if (ext->key_len > 0) { | ||
6306 | key.len = MIN_KEY_SIZE; | ||
6307 | } else { | ||
6308 | return -EINVAL; | ||
6309 | } | ||
6310 | key_len = min (ext->key_len, key.len); | ||
6311 | memcpy(key.key, ext->key, key_len); | ||
6312 | break; | ||
6313 | default: | ||
6314 | return -EINVAL; | ||
6315 | } | ||
6316 | /* Send the key to the card */ | ||
6317 | set_wep_key(local, idx, key.key, key.len, perm, 1); | ||
6318 | } | ||
6319 | |||
6320 | /* Read the flags */ | ||
6321 | if(encoding->flags & IW_ENCODE_DISABLED) | ||
6322 | local->config.authType = AUTH_OPEN; // disable encryption | ||
6323 | if(encoding->flags & IW_ENCODE_RESTRICTED) | ||
6324 | local->config.authType = AUTH_SHAREDKEY; // Only Both | ||
6325 | if(encoding->flags & IW_ENCODE_OPEN) | ||
6326 | local->config.authType = AUTH_ENCRYPT; // Only Wep | ||
6327 | /* Commit the changes to flags if needed */ | ||
6328 | if (local->config.authType != currentAuthType) | ||
6329 | set_bit (FLAG_COMMIT, &local->flags); | ||
6330 | |||
6331 | return -EINPROGRESS; | ||
6332 | } | ||
6333 | |||
6334 | |||
6335 | /*------------------------------------------------------------------*/ | ||
6336 | /* | ||
6337 | * Wireless Handler : get extended Encryption parameters | ||
6338 | */ | ||
6339 | static int airo_get_encodeext(struct net_device *dev, | ||
6340 | struct iw_request_info *info, | ||
6341 | union iwreq_data *wrqu, | ||
6342 | char *extra) | ||
6343 | { | ||
6344 | struct airo_info *local = dev->priv; | ||
6345 | struct iw_point *encoding = &wrqu->encoding; | ||
6346 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
6347 | CapabilityRid cap_rid; /* Card capability info */ | ||
6348 | int idx, max_key_len; | ||
6349 | |||
6350 | /* Is it supported ? */ | ||
6351 | readCapabilityRid(local, &cap_rid, 1); | ||
6352 | if(!(cap_rid.softCap & 2)) { | ||
6353 | return -EOPNOTSUPP; | ||
6354 | } | ||
6355 | readConfigRid(local, 1); | ||
6356 | |||
6357 | max_key_len = encoding->length - sizeof(*ext); | ||
6358 | if (max_key_len < 0) | ||
6359 | return -EINVAL; | ||
6360 | |||
6361 | idx = encoding->flags & IW_ENCODE_INDEX; | ||
6362 | if (idx) { | ||
6363 | if (idx < 1 || idx > ((cap_rid.softCap & 0x80) ? 4:1)) | ||
6364 | return -EINVAL; | ||
6365 | idx--; | ||
6366 | } else | ||
6367 | idx = get_wep_key(local, 0xffff); | ||
6368 | |||
6369 | encoding->flags = idx + 1; | ||
6370 | memset(ext, 0, sizeof(*ext)); | ||
6371 | |||
6372 | /* Check encryption mode */ | ||
6373 | switch(local->config.authType) { | ||
6374 | case AUTH_ENCRYPT: | ||
6375 | encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; | ||
6376 | break; | ||
6377 | case AUTH_SHAREDKEY: | ||
6378 | encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; | ||
6379 | break; | ||
6380 | default: | ||
6381 | case AUTH_OPEN: | ||
6382 | encoding->flags = IW_ENCODE_ALG_NONE | IW_ENCODE_DISABLED; | ||
6383 | break; | ||
6384 | } | ||
6385 | /* We can't return the key, so set the proper flag and return zero */ | ||
6386 | encoding->flags |= IW_ENCODE_NOKEY; | ||
6387 | memset(extra, 0, 16); | ||
6388 | |||
6389 | /* Copy the key to the user buffer */ | ||
6390 | ext->key_len = get_wep_key(local, idx); | ||
6391 | if (ext->key_len > 16) { | ||
6392 | ext->key_len=0; | ||
6393 | } | ||
6394 | |||
6395 | return 0; | ||
6396 | } | ||
6397 | |||
6398 | |||
6399 | /*------------------------------------------------------------------*/ | ||
6400 | /* | ||
6401 | * Wireless Handler : set extended authentication parameters | ||
6402 | */ | ||
6403 | static int airo_set_auth(struct net_device *dev, | ||
6404 | struct iw_request_info *info, | ||
6405 | union iwreq_data *wrqu, char *extra) | ||
6406 | { | ||
6407 | struct airo_info *local = dev->priv; | ||
6408 | struct iw_param *param = &wrqu->param; | ||
6409 | u16 currentAuthType = local->config.authType; | ||
6410 | |||
6411 | switch (param->flags & IW_AUTH_INDEX) { | ||
6412 | case IW_AUTH_WPA_VERSION: | ||
6413 | case IW_AUTH_CIPHER_PAIRWISE: | ||
6414 | case IW_AUTH_CIPHER_GROUP: | ||
6415 | case IW_AUTH_KEY_MGMT: | ||
6416 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
6417 | case IW_AUTH_PRIVACY_INVOKED: | ||
6418 | /* | ||
6419 | * airo does not use these parameters | ||
6420 | */ | ||
6421 | break; | ||
6422 | |||
6423 | case IW_AUTH_DROP_UNENCRYPTED: | ||
6424 | if (param->value) { | ||
6425 | /* Only change auth type if unencrypted */ | ||
6426 | if (currentAuthType == AUTH_OPEN) | ||
6427 | local->config.authType = AUTH_ENCRYPT; | ||
6428 | } else { | ||
6429 | local->config.authType = AUTH_OPEN; | ||
6430 | } | ||
6431 | |||
6432 | /* Commit the changes to flags if needed */ | ||
6433 | if (local->config.authType != currentAuthType) | ||
6434 | set_bit (FLAG_COMMIT, &local->flags); | ||
6435 | break; | ||
6436 | |||
6437 | case IW_AUTH_80211_AUTH_ALG: { | ||
6438 | /* FIXME: What about AUTH_OPEN? This API seems to | ||
6439 | * disallow setting our auth to AUTH_OPEN. | ||
6440 | */ | ||
6441 | if (param->value & IW_AUTH_ALG_SHARED_KEY) { | ||
6442 | local->config.authType = AUTH_SHAREDKEY; | ||
6443 | } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { | ||
6444 | local->config.authType = AUTH_ENCRYPT; | ||
6445 | } else | ||
6446 | return -EINVAL; | ||
6447 | break; | ||
6448 | |||
6449 | /* Commit the changes to flags if needed */ | ||
6450 | if (local->config.authType != currentAuthType) | ||
6451 | set_bit (FLAG_COMMIT, &local->flags); | ||
6452 | } | ||
6453 | |||
6454 | case IW_AUTH_WPA_ENABLED: | ||
6455 | /* Silently accept disable of WPA */ | ||
6456 | if (param->value > 0) | ||
6457 | return -EOPNOTSUPP; | ||
6458 | break; | ||
6459 | |||
6460 | default: | ||
6461 | return -EOPNOTSUPP; | ||
6462 | } | ||
6463 | return -EINPROGRESS; | ||
6464 | } | ||
6465 | |||
6466 | |||
6467 | /*------------------------------------------------------------------*/ | ||
6468 | /* | ||
6469 | * Wireless Handler : get extended authentication parameters | ||
6470 | */ | ||
6471 | static int airo_get_auth(struct net_device *dev, | ||
6472 | struct iw_request_info *info, | ||
6473 | union iwreq_data *wrqu, char *extra) | ||
6474 | { | ||
6475 | struct airo_info *local = dev->priv; | ||
6476 | struct iw_param *param = &wrqu->param; | ||
6477 | u16 currentAuthType = local->config.authType; | ||
6478 | |||
6479 | switch (param->flags & IW_AUTH_INDEX) { | ||
6480 | case IW_AUTH_DROP_UNENCRYPTED: | ||
6481 | switch (currentAuthType) { | ||
6482 | case AUTH_SHAREDKEY: | ||
6483 | case AUTH_ENCRYPT: | ||
6484 | param->value = 1; | ||
6485 | break; | ||
6486 | default: | ||
6487 | param->value = 0; | ||
6488 | break; | ||
6489 | } | ||
6490 | break; | ||
6491 | |||
6492 | case IW_AUTH_80211_AUTH_ALG: | ||
6493 | switch (currentAuthType) { | ||
6494 | case AUTH_SHAREDKEY: | ||
6495 | param->value = IW_AUTH_ALG_SHARED_KEY; | ||
6496 | break; | ||
6497 | case AUTH_ENCRYPT: | ||
6498 | default: | ||
6499 | param->value = IW_AUTH_ALG_OPEN_SYSTEM; | ||
6500 | break; | ||
6501 | } | ||
6502 | break; | ||
6503 | |||
6504 | case IW_AUTH_WPA_ENABLED: | ||
6505 | param->value = 0; | ||
6506 | break; | ||
6507 | |||
6508 | default: | ||
6509 | return -EOPNOTSUPP; | ||
6510 | } | ||
6511 | return 0; | ||
6512 | } | ||
6513 | |||
6514 | |||
6515 | /*------------------------------------------------------------------*/ | ||
6516 | /* | ||
6299 | * Wireless Handler : set Tx-Power | 6517 | * Wireless Handler : set Tx-Power |
6300 | */ | 6518 | */ |
6301 | static int airo_set_txpow(struct net_device *dev, | 6519 | static int airo_set_txpow(struct net_device *dev, |
@@ -7050,6 +7268,15 @@ static const iw_handler airo_handler[] = | |||
7050 | (iw_handler) airo_get_encode, /* SIOCGIWENCODE */ | 7268 | (iw_handler) airo_get_encode, /* SIOCGIWENCODE */ |
7051 | (iw_handler) airo_set_power, /* SIOCSIWPOWER */ | 7269 | (iw_handler) airo_set_power, /* SIOCSIWPOWER */ |
7052 | (iw_handler) airo_get_power, /* SIOCGIWPOWER */ | 7270 | (iw_handler) airo_get_power, /* SIOCGIWPOWER */ |
7271 | (iw_handler) NULL, /* -- hole -- */ | ||
7272 | (iw_handler) NULL, /* -- hole -- */ | ||
7273 | (iw_handler) NULL, /* SIOCSIWGENIE */ | ||
7274 | (iw_handler) NULL, /* SIOCGIWGENIE */ | ||
7275 | (iw_handler) airo_set_auth, /* SIOCSIWAUTH */ | ||
7276 | (iw_handler) airo_get_auth, /* SIOCGIWAUTH */ | ||
7277 | (iw_handler) airo_set_encodeext, /* SIOCSIWENCODEEXT */ | ||
7278 | (iw_handler) airo_get_encodeext, /* SIOCGIWENCODEEXT */ | ||
7279 | (iw_handler) NULL, /* SIOCSIWPMKSA */ | ||
7053 | }; | 7280 | }; |
7054 | 7281 | ||
7055 | /* Note : don't describe AIROIDIFC and AIROOLDIDIFC in here. | 7282 | /* Note : don't describe AIROIDIFC and AIROOLDIDIFC in here. |
@@ -7270,13 +7497,11 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { | |||
7270 | case AIROGSTAT: ridcode = RID_STATUS; break; | 7497 | case AIROGSTAT: ridcode = RID_STATUS; break; |
7271 | case AIROGSTATSD32: ridcode = RID_STATSDELTA; break; | 7498 | case AIROGSTATSD32: ridcode = RID_STATSDELTA; break; |
7272 | case AIROGSTATSC32: ridcode = RID_STATS; break; | 7499 | case AIROGSTATSC32: ridcode = RID_STATS; break; |
7273 | #ifdef MICSUPPORT | ||
7274 | case AIROGMICSTATS: | 7500 | case AIROGMICSTATS: |
7275 | if (copy_to_user(comp->data, &ai->micstats, | 7501 | if (copy_to_user(comp->data, &ai->micstats, |
7276 | min((int)comp->len,(int)sizeof(ai->micstats)))) | 7502 | min((int)comp->len,(int)sizeof(ai->micstats)))) |
7277 | return -EFAULT; | 7503 | return -EFAULT; |
7278 | return 0; | 7504 | return 0; |
7279 | #endif | ||
7280 | case AIRORRID: ridcode = comp->ridnum; break; | 7505 | case AIRORRID: ridcode = comp->ridnum; break; |
7281 | default: | 7506 | default: |
7282 | return -EINVAL; | 7507 | return -EINVAL; |
@@ -7308,9 +7533,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { | |||
7308 | static int writerids(struct net_device *dev, aironet_ioctl *comp) { | 7533 | static int writerids(struct net_device *dev, aironet_ioctl *comp) { |
7309 | struct airo_info *ai = dev->priv; | 7534 | struct airo_info *ai = dev->priv; |
7310 | int ridcode; | 7535 | int ridcode; |
7311 | #ifdef MICSUPPORT | ||
7312 | int enabled; | 7536 | int enabled; |
7313 | #endif | ||
7314 | Resp rsp; | 7537 | Resp rsp; |
7315 | static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); | 7538 | static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); |
7316 | unsigned char *iobuf; | 7539 | unsigned char *iobuf; |
@@ -7367,11 +7590,9 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) { | |||
7367 | 7590 | ||
7368 | PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1); | 7591 | PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1); |
7369 | 7592 | ||
7370 | #ifdef MICSUPPORT | ||
7371 | enabled = ai->micstats.enabled; | 7593 | enabled = ai->micstats.enabled; |
7372 | memset(&ai->micstats,0,sizeof(ai->micstats)); | 7594 | memset(&ai->micstats,0,sizeof(ai->micstats)); |
7373 | ai->micstats.enabled = enabled; | 7595 | ai->micstats.enabled = enabled; |
7374 | #endif | ||
7375 | 7596 | ||
7376 | if (copy_to_user(comp->data, iobuf, | 7597 | if (copy_to_user(comp->data, iobuf, |
7377 | min((int)comp->len, (int)RIDSIZE))) { | 7598 | min((int)comp->len, (int)RIDSIZE))) { |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 6290c9f7e939..eb79198ac450 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -167,7 +167,7 @@ that only one external action is invoked at a time. | |||
167 | 167 | ||
168 | #include "ipw2100.h" | 168 | #include "ipw2100.h" |
169 | 169 | ||
170 | #define IPW2100_VERSION "1.1.3" | 170 | #define IPW2100_VERSION "git-1.1.4" |
171 | 171 | ||
172 | #define DRV_NAME "ipw2100" | 172 | #define DRV_NAME "ipw2100" |
173 | #define DRV_VERSION IPW2100_VERSION | 173 | #define DRV_VERSION IPW2100_VERSION |
@@ -1672,6 +1672,18 @@ static int ipw2100_start_scan(struct ipw2100_priv *priv) | |||
1672 | return err; | 1672 | return err; |
1673 | } | 1673 | } |
1674 | 1674 | ||
1675 | static const struct ieee80211_geo ipw_geos[] = { | ||
1676 | { /* Restricted */ | ||
1677 | "---", | ||
1678 | .bg_channels = 14, | ||
1679 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
1680 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
1681 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
1682 | {2457, 10}, {2462, 11}, {2467, 12}, | ||
1683 | {2472, 13}, {2484, 14}}, | ||
1684 | }, | ||
1685 | }; | ||
1686 | |||
1675 | static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | 1687 | static int ipw2100_up(struct ipw2100_priv *priv, int deferred) |
1676 | { | 1688 | { |
1677 | unsigned long flags; | 1689 | unsigned long flags; |
@@ -1727,6 +1739,13 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1727 | goto exit; | 1739 | goto exit; |
1728 | } | 1740 | } |
1729 | 1741 | ||
1742 | /* Initialize the geo */ | ||
1743 | if (ieee80211_set_geo(priv->ieee, &ipw_geos[0])) { | ||
1744 | printk(KERN_WARNING DRV_NAME "Could not set geo\n"); | ||
1745 | return 0; | ||
1746 | } | ||
1747 | priv->ieee->freq_band = IEEE80211_24GHZ_BAND; | ||
1748 | |||
1730 | lock = LOCK_NONE; | 1749 | lock = LOCK_NONE; |
1731 | if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { | 1750 | if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { |
1732 | printk(KERN_ERR DRV_NAME | 1751 | printk(KERN_ERR DRV_NAME |
@@ -3750,7 +3769,7 @@ static ssize_t store_memory(struct device *d, struct device_attribute *attr, | |||
3750 | struct net_device *dev = priv->net_dev; | 3769 | struct net_device *dev = priv->net_dev; |
3751 | const char *p = buf; | 3770 | const char *p = buf; |
3752 | 3771 | ||
3753 | (void) dev; /* kill unused-var warning for debug-only code */ | 3772 | (void)dev; /* kill unused-var warning for debug-only code */ |
3754 | 3773 | ||
3755 | if (count < 1) | 3774 | if (count < 1) |
3756 | return count; | 3775 | return count; |
@@ -4070,7 +4089,7 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | |||
4070 | unsigned long val; | 4089 | unsigned long val; |
4071 | char *p = buffer; | 4090 | char *p = buffer; |
4072 | 4091 | ||
4073 | (void) dev; /* kill unused-var warning for debug-only code */ | 4092 | (void)dev; /* kill unused-var warning for debug-only code */ |
4074 | 4093 | ||
4075 | IPW_DEBUG_INFO("enter\n"); | 4094 | IPW_DEBUG_INFO("enter\n"); |
4076 | 4095 | ||
@@ -5107,12 +5126,13 @@ static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power) | |||
5107 | .host_command_length = 4 | 5126 | .host_command_length = 4 |
5108 | }; | 5127 | }; |
5109 | int err = 0; | 5128 | int err = 0; |
5129 | u32 tmp = tx_power; | ||
5110 | 5130 | ||
5111 | if (tx_power != IPW_TX_POWER_DEFAULT) | 5131 | if (tx_power != IPW_TX_POWER_DEFAULT) |
5112 | tx_power = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / | 5132 | tmp = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / |
5113 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); | 5133 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); |
5114 | 5134 | ||
5115 | cmd.host_command_parameters[0] = tx_power; | 5135 | cmd.host_command_parameters[0] = tmp; |
5116 | 5136 | ||
5117 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | 5137 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) |
5118 | err = ipw2100_hw_send_command(priv, &cmd); | 5138 | err = ipw2100_hw_send_command(priv, &cmd); |
@@ -5365,9 +5385,12 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) | |||
5365 | SEC_LEVEL_0, 0, 1); | 5385 | SEC_LEVEL_0, 0, 1); |
5366 | } else { | 5386 | } else { |
5367 | auth_mode = IPW_AUTH_OPEN; | 5387 | auth_mode = IPW_AUTH_OPEN; |
5368 | if ((priv->ieee->sec.flags & SEC_AUTH_MODE) && | 5388 | if (priv->ieee->sec.flags & SEC_AUTH_MODE) { |
5369 | (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) | 5389 | if (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY) |
5370 | auth_mode = IPW_AUTH_SHARED; | 5390 | auth_mode = IPW_AUTH_SHARED; |
5391 | else if (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP) | ||
5392 | auth_mode = IPW_AUTH_LEAP_CISCO_ID; | ||
5393 | } | ||
5371 | 5394 | ||
5372 | sec_level = SEC_LEVEL_0; | 5395 | sec_level = SEC_LEVEL_0; |
5373 | if (priv->ieee->sec.flags & SEC_LEVEL) | 5396 | if (priv->ieee->sec.flags & SEC_LEVEL) |
@@ -5760,6 +5783,9 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) | |||
5760 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { | 5783 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { |
5761 | sec.auth_mode = WLAN_AUTH_OPEN; | 5784 | sec.auth_mode = WLAN_AUTH_OPEN; |
5762 | ieee->open_wep = 1; | 5785 | ieee->open_wep = 1; |
5786 | } else if (value & IW_AUTH_ALG_LEAP) { | ||
5787 | sec.auth_mode = WLAN_AUTH_LEAP; | ||
5788 | ieee->open_wep = 1; | ||
5763 | } else | 5789 | } else |
5764 | return -EINVAL; | 5790 | return -EINVAL; |
5765 | 5791 | ||
@@ -5771,8 +5797,8 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) | |||
5771 | return ret; | 5797 | return ret; |
5772 | } | 5798 | } |
5773 | 5799 | ||
5774 | void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, | 5800 | static void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, |
5775 | char *wpa_ie, int wpa_ie_len) | 5801 | char *wpa_ie, int wpa_ie_len) |
5776 | { | 5802 | { |
5777 | 5803 | ||
5778 | struct ipw2100_wpa_assoc_frame frame; | 5804 | struct ipw2100_wpa_assoc_frame frame; |
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index f6c51441fa87..51360910d222 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h | |||
@@ -392,8 +392,10 @@ struct ipw2100_notification { | |||
392 | #define IPW_WEP104_CIPHER (1<<5) | 392 | #define IPW_WEP104_CIPHER (1<<5) |
393 | #define IPW_CKIP_CIPHER (1<<6) | 393 | #define IPW_CKIP_CIPHER (1<<6) |
394 | 394 | ||
395 | #define IPW_AUTH_OPEN 0 | 395 | #define IPW_AUTH_OPEN 0 |
396 | #define IPW_AUTH_SHARED 1 | 396 | #define IPW_AUTH_SHARED 1 |
397 | #define IPW_AUTH_LEAP 2 | ||
398 | #define IPW_AUTH_LEAP_CISCO_ID 0x80 | ||
397 | 399 | ||
398 | struct statistic { | 400 | struct statistic { |
399 | int value; | 401 | int value; |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 287676ad80df..44024c76d187 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "ipw2200.h" | 33 | #include "ipw2200.h" |
34 | #include <linux/version.h> | 34 | #include <linux/version.h> |
35 | 35 | ||
36 | #define IPW2200_VERSION "git-1.0.8" | 36 | #define IPW2200_VERSION "git-1.0.10" |
37 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" | 37 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" |
38 | #define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" | 38 | #define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" |
39 | #define DRV_VERSION IPW2200_VERSION | 39 | #define DRV_VERSION IPW2200_VERSION |
@@ -55,7 +55,9 @@ static int associate = 1; | |||
55 | static int auto_create = 1; | 55 | static int auto_create = 1; |
56 | static int led = 0; | 56 | static int led = 0; |
57 | static int disable = 0; | 57 | static int disable = 0; |
58 | static int hwcrypto = 1; | 58 | static int bt_coexist = 0; |
59 | static int hwcrypto = 0; | ||
60 | static int roaming = 1; | ||
59 | static const char ipw_modes[] = { | 61 | static const char ipw_modes[] = { |
60 | 'a', 'b', 'g', '?' | 62 | 'a', 'b', 'g', '?' |
61 | }; | 63 | }; |
@@ -227,12 +229,15 @@ static int snprintk_buf(u8 * output, size_t size, const u8 * data, size_t len) | |||
227 | return total; | 229 | return total; |
228 | } | 230 | } |
229 | 231 | ||
232 | /* alias for 32-bit indirect read (for SRAM/reg above 4K), with debug wrapper */ | ||
230 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); | 233 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); |
231 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) | 234 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) |
232 | 235 | ||
236 | /* alias for 8-bit indirect read (for SRAM/reg above 4K), with debug wrapper */ | ||
233 | static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); | 237 | static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); |
234 | #define ipw_read_reg8(a, b) _ipw_read_reg8(a, b) | 238 | #define ipw_read_reg8(a, b) _ipw_read_reg8(a, b) |
235 | 239 | ||
240 | /* 8-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ | ||
236 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); | 241 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); |
237 | static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) | 242 | static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) |
238 | { | 243 | { |
@@ -241,6 +246,7 @@ static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) | |||
241 | _ipw_write_reg8(a, b, c); | 246 | _ipw_write_reg8(a, b, c); |
242 | } | 247 | } |
243 | 248 | ||
249 | /* 16-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ | ||
244 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); | 250 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); |
245 | static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) | 251 | static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) |
246 | { | 252 | { |
@@ -249,6 +255,7 @@ static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) | |||
249 | _ipw_write_reg16(a, b, c); | 255 | _ipw_write_reg16(a, b, c); |
250 | } | 256 | } |
251 | 257 | ||
258 | /* 32-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ | ||
252 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); | 259 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); |
253 | static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) | 260 | static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) |
254 | { | 261 | { |
@@ -257,48 +264,70 @@ static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) | |||
257 | _ipw_write_reg32(a, b, c); | 264 | _ipw_write_reg32(a, b, c); |
258 | } | 265 | } |
259 | 266 | ||
267 | /* 8-bit direct write (low 4K) */ | ||
260 | #define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs)) | 268 | #define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs)) |
269 | |||
270 | /* 8-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ | ||
261 | #define ipw_write8(ipw, ofs, val) \ | 271 | #define ipw_write8(ipw, ofs, val) \ |
262 | IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ | 272 | IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ |
263 | _ipw_write8(ipw, ofs, val) | 273 | _ipw_write8(ipw, ofs, val) |
264 | 274 | ||
275 | /* 16-bit direct write (low 4K) */ | ||
265 | #define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs)) | 276 | #define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs)) |
277 | |||
278 | /* 16-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ | ||
266 | #define ipw_write16(ipw, ofs, val) \ | 279 | #define ipw_write16(ipw, ofs, val) \ |
267 | IPW_DEBUG_IO("%s %d: write_direct16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ | 280 | IPW_DEBUG_IO("%s %d: write_direct16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ |
268 | _ipw_write16(ipw, ofs, val) | 281 | _ipw_write16(ipw, ofs, val) |
269 | 282 | ||
283 | /* 32-bit direct write (low 4K) */ | ||
270 | #define _ipw_write32(ipw, ofs, val) writel((val), (ipw)->hw_base + (ofs)) | 284 | #define _ipw_write32(ipw, ofs, val) writel((val), (ipw)->hw_base + (ofs)) |
285 | |||
286 | /* 32-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ | ||
271 | #define ipw_write32(ipw, ofs, val) \ | 287 | #define ipw_write32(ipw, ofs, val) \ |
272 | IPW_DEBUG_IO("%s %d: write_direct32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ | 288 | IPW_DEBUG_IO("%s %d: write_direct32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ |
273 | _ipw_write32(ipw, ofs, val) | 289 | _ipw_write32(ipw, ofs, val) |
274 | 290 | ||
291 | /* 8-bit direct read (low 4K) */ | ||
275 | #define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs)) | 292 | #define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs)) |
293 | |||
294 | /* 8-bit direct read (low 4K), with debug wrapper */ | ||
276 | static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | 295 | static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
277 | { | 296 | { |
278 | IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32) (ofs)); | 297 | IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32) (ofs)); |
279 | return _ipw_read8(ipw, ofs); | 298 | return _ipw_read8(ipw, ofs); |
280 | } | 299 | } |
281 | 300 | ||
301 | /* alias to 8-bit direct read (low 4K of SRAM/regs), with debug wrapper */ | ||
282 | #define ipw_read8(ipw, ofs) __ipw_read8(__FILE__, __LINE__, ipw, ofs) | 302 | #define ipw_read8(ipw, ofs) __ipw_read8(__FILE__, __LINE__, ipw, ofs) |
283 | 303 | ||
304 | /* 16-bit direct read (low 4K) */ | ||
284 | #define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs)) | 305 | #define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs)) |
306 | |||
307 | /* 16-bit direct read (low 4K), with debug wrapper */ | ||
285 | static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | 308 | static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
286 | { | 309 | { |
287 | IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32) (ofs)); | 310 | IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32) (ofs)); |
288 | return _ipw_read16(ipw, ofs); | 311 | return _ipw_read16(ipw, ofs); |
289 | } | 312 | } |
290 | 313 | ||
314 | /* alias to 16-bit direct read (low 4K of SRAM/regs), with debug wrapper */ | ||
291 | #define ipw_read16(ipw, ofs) __ipw_read16(__FILE__, __LINE__, ipw, ofs) | 315 | #define ipw_read16(ipw, ofs) __ipw_read16(__FILE__, __LINE__, ipw, ofs) |
292 | 316 | ||
317 | /* 32-bit direct read (low 4K) */ | ||
293 | #define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs)) | 318 | #define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs)) |
319 | |||
320 | /* 32-bit direct read (low 4K), with debug wrapper */ | ||
294 | static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | 321 | static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
295 | { | 322 | { |
296 | IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32) (ofs)); | 323 | IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32) (ofs)); |
297 | return _ipw_read32(ipw, ofs); | 324 | return _ipw_read32(ipw, ofs); |
298 | } | 325 | } |
299 | 326 | ||
327 | /* alias to 32-bit direct read (low 4K of SRAM/regs), with debug wrapper */ | ||
300 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) | 328 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) |
301 | 329 | ||
330 | /* multi-byte read (above 4K), with debug wrapper */ | ||
302 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); | 331 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); |
303 | static inline void __ipw_read_indirect(const char *f, int l, | 332 | static inline void __ipw_read_indirect(const char *f, int l, |
304 | struct ipw_priv *a, u32 b, u8 * c, int d) | 333 | struct ipw_priv *a, u32 b, u8 * c, int d) |
@@ -308,15 +337,17 @@ static inline void __ipw_read_indirect(const char *f, int l, | |||
308 | _ipw_read_indirect(a, b, c, d); | 337 | _ipw_read_indirect(a, b, c, d); |
309 | } | 338 | } |
310 | 339 | ||
340 | /* alias to multi-byte read (SRAM/regs above 4K), with debug wrapper */ | ||
311 | #define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d) | 341 | #define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d) |
312 | 342 | ||
343 | /* alias to multi-byte read (SRAM/regs above 4K), with debug wrapper */ | ||
313 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, | 344 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, |
314 | int num); | 345 | int num); |
315 | #define ipw_write_indirect(a, b, c, d) \ | 346 | #define ipw_write_indirect(a, b, c, d) \ |
316 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ | 347 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ |
317 | _ipw_write_indirect(a, b, c, d) | 348 | _ipw_write_indirect(a, b, c, d) |
318 | 349 | ||
319 | /* indirect write s */ | 350 | /* 32-bit indirect write (above 4K) */ |
320 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) | 351 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) |
321 | { | 352 | { |
322 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); | 353 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); |
@@ -324,22 +355,29 @@ static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) | |||
324 | _ipw_write32(priv, IPW_INDIRECT_DATA, value); | 355 | _ipw_write32(priv, IPW_INDIRECT_DATA, value); |
325 | } | 356 | } |
326 | 357 | ||
358 | /* 8-bit indirect write (above 4K) */ | ||
327 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) | 359 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) |
328 | { | 360 | { |
361 | u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */ | ||
362 | u32 dif_len = reg - aligned_addr; | ||
363 | |||
329 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 364 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
330 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); | 365 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
331 | _ipw_write8(priv, IPW_INDIRECT_DATA, value); | 366 | _ipw_write8(priv, IPW_INDIRECT_DATA + dif_len, value); |
332 | } | 367 | } |
333 | 368 | ||
369 | /* 16-bit indirect write (above 4K) */ | ||
334 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) | 370 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) |
335 | { | 371 | { |
372 | u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */ | ||
373 | u32 dif_len = (reg - aligned_addr) & (~0x1ul); | ||
374 | |||
336 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 375 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
337 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); | 376 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
338 | _ipw_write16(priv, IPW_INDIRECT_DATA, value); | 377 | _ipw_write16(priv, IPW_INDIRECT_DATA + dif_len, value); |
339 | } | 378 | } |
340 | 379 | ||
341 | /* indirect read s */ | 380 | /* 8-bit indirect read (above 4K) */ |
342 | |||
343 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) | 381 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) |
344 | { | 382 | { |
345 | u32 word; | 383 | u32 word; |
@@ -349,6 +387,7 @@ static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) | |||
349 | return (word >> ((reg & 0x3) * 8)) & 0xff; | 387 | return (word >> ((reg & 0x3) * 8)) & 0xff; |
350 | } | 388 | } |
351 | 389 | ||
390 | /* 32-bit indirect read (above 4K) */ | ||
352 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | 391 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) |
353 | { | 392 | { |
354 | u32 value; | 393 | u32 value; |
@@ -361,11 +400,12 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | |||
361 | return value; | 400 | return value; |
362 | } | 401 | } |
363 | 402 | ||
364 | /* iterative/auto-increment 32 bit reads and writes */ | 403 | /* General purpose, no alignment requirement, iterative (multi-byte) read, */ |
404 | /* for area above 1st 4K of SRAM/reg space */ | ||
365 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 405 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
366 | int num) | 406 | int num) |
367 | { | 407 | { |
368 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; | 408 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */ |
369 | u32 dif_len = addr - aligned_addr; | 409 | u32 dif_len = addr - aligned_addr; |
370 | u32 i; | 410 | u32 i; |
371 | 411 | ||
@@ -375,7 +415,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
375 | return; | 415 | return; |
376 | } | 416 | } |
377 | 417 | ||
378 | /* Read the first nibble byte by byte */ | 418 | /* Read the first dword (or portion) byte by byte */ |
379 | if (unlikely(dif_len)) { | 419 | if (unlikely(dif_len)) { |
380 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 420 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
381 | /* Start reading at aligned_addr + dif_len */ | 421 | /* Start reading at aligned_addr + dif_len */ |
@@ -384,11 +424,12 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
384 | aligned_addr += 4; | 424 | aligned_addr += 4; |
385 | } | 425 | } |
386 | 426 | ||
427 | /* Read all of the middle dwords as dwords, with auto-increment */ | ||
387 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); | 428 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
388 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) | 429 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
389 | *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); | 430 | *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); |
390 | 431 | ||
391 | /* Copy the last nibble */ | 432 | /* Read the last dword (or portion) byte by byte */ |
392 | if (unlikely(num)) { | 433 | if (unlikely(num)) { |
393 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 434 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
394 | for (i = 0; num > 0; i++, num--) | 435 | for (i = 0; num > 0; i++, num--) |
@@ -396,10 +437,12 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
396 | } | 437 | } |
397 | } | 438 | } |
398 | 439 | ||
440 | /* General purpose, no alignment requirement, iterative (multi-byte) write, */ | ||
441 | /* for area above 1st 4K of SRAM/reg space */ | ||
399 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 442 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
400 | int num) | 443 | int num) |
401 | { | 444 | { |
402 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; | 445 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */ |
403 | u32 dif_len = addr - aligned_addr; | 446 | u32 dif_len = addr - aligned_addr; |
404 | u32 i; | 447 | u32 i; |
405 | 448 | ||
@@ -409,20 +452,21 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
409 | return; | 452 | return; |
410 | } | 453 | } |
411 | 454 | ||
412 | /* Write the first nibble byte by byte */ | 455 | /* Write the first dword (or portion) byte by byte */ |
413 | if (unlikely(dif_len)) { | 456 | if (unlikely(dif_len)) { |
414 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 457 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
415 | /* Start reading at aligned_addr + dif_len */ | 458 | /* Start writing at aligned_addr + dif_len */ |
416 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) | 459 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) |
417 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); | 460 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); |
418 | aligned_addr += 4; | 461 | aligned_addr += 4; |
419 | } | 462 | } |
420 | 463 | ||
464 | /* Write all of the middle dwords as dwords, with auto-increment */ | ||
421 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); | 465 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
422 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) | 466 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
423 | _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); | 467 | _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); |
424 | 468 | ||
425 | /* Copy the last nibble */ | 469 | /* Write the last dword (or portion) byte by byte */ |
426 | if (unlikely(num)) { | 470 | if (unlikely(num)) { |
427 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 471 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
428 | for (i = 0; num > 0; i++, num--, buf++) | 472 | for (i = 0; num > 0; i++, num--, buf++) |
@@ -430,17 +474,21 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
430 | } | 474 | } |
431 | } | 475 | } |
432 | 476 | ||
477 | /* General purpose, no alignment requirement, iterative (multi-byte) write, */ | ||
478 | /* for 1st 4K of SRAM/regs space */ | ||
433 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, | 479 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, |
434 | int num) | 480 | int num) |
435 | { | 481 | { |
436 | memcpy_toio((priv->hw_base + addr), buf, num); | 482 | memcpy_toio((priv->hw_base + addr), buf, num); |
437 | } | 483 | } |
438 | 484 | ||
485 | /* Set bit(s) in low 4K of SRAM/regs */ | ||
439 | static inline void ipw_set_bit(struct ipw_priv *priv, u32 reg, u32 mask) | 486 | static inline void ipw_set_bit(struct ipw_priv *priv, u32 reg, u32 mask) |
440 | { | 487 | { |
441 | ipw_write32(priv, reg, ipw_read32(priv, reg) | mask); | 488 | ipw_write32(priv, reg, ipw_read32(priv, reg) | mask); |
442 | } | 489 | } |
443 | 490 | ||
491 | /* Clear bit(s) in low 4K of SRAM/regs */ | ||
444 | static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask) | 492 | static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask) |
445 | { | 493 | { |
446 | ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); | 494 | ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); |
@@ -701,7 +749,7 @@ static void ipw_init_ordinals(struct ipw_priv *priv) | |||
701 | 749 | ||
702 | } | 750 | } |
703 | 751 | ||
704 | u32 ipw_register_toggle(u32 reg) | 752 | static u32 ipw_register_toggle(u32 reg) |
705 | { | 753 | { |
706 | reg &= ~IPW_START_STANDBY; | 754 | reg &= ~IPW_START_STANDBY; |
707 | if (reg & IPW_GATE_ODMA) | 755 | if (reg & IPW_GATE_ODMA) |
@@ -722,11 +770,11 @@ u32 ipw_register_toggle(u32 reg) | |||
722 | * - On radio OFF, turn off any LEDs started during radio on | 770 | * - On radio OFF, turn off any LEDs started during radio on |
723 | * | 771 | * |
724 | */ | 772 | */ |
725 | #define LD_TIME_LINK_ON 300 | 773 | #define LD_TIME_LINK_ON msecs_to_jiffies(300) |
726 | #define LD_TIME_LINK_OFF 2700 | 774 | #define LD_TIME_LINK_OFF msecs_to_jiffies(2700) |
727 | #define LD_TIME_ACT_ON 250 | 775 | #define LD_TIME_ACT_ON msecs_to_jiffies(250) |
728 | 776 | ||
729 | void ipw_led_link_on(struct ipw_priv *priv) | 777 | static void ipw_led_link_on(struct ipw_priv *priv) |
730 | { | 778 | { |
731 | unsigned long flags; | 779 | unsigned long flags; |
732 | u32 led; | 780 | u32 led; |
@@ -764,12 +812,12 @@ void ipw_led_link_on(struct ipw_priv *priv) | |||
764 | static void ipw_bg_led_link_on(void *data) | 812 | static void ipw_bg_led_link_on(void *data) |
765 | { | 813 | { |
766 | struct ipw_priv *priv = data; | 814 | struct ipw_priv *priv = data; |
767 | down(&priv->sem); | 815 | mutex_lock(&priv->mutex); |
768 | ipw_led_link_on(data); | 816 | ipw_led_link_on(data); |
769 | up(&priv->sem); | 817 | mutex_unlock(&priv->mutex); |
770 | } | 818 | } |
771 | 819 | ||
772 | void ipw_led_link_off(struct ipw_priv *priv) | 820 | static void ipw_led_link_off(struct ipw_priv *priv) |
773 | { | 821 | { |
774 | unsigned long flags; | 822 | unsigned long flags; |
775 | u32 led; | 823 | u32 led; |
@@ -808,9 +856,9 @@ void ipw_led_link_off(struct ipw_priv *priv) | |||
808 | static void ipw_bg_led_link_off(void *data) | 856 | static void ipw_bg_led_link_off(void *data) |
809 | { | 857 | { |
810 | struct ipw_priv *priv = data; | 858 | struct ipw_priv *priv = data; |
811 | down(&priv->sem); | 859 | mutex_lock(&priv->mutex); |
812 | ipw_led_link_off(data); | 860 | ipw_led_link_off(data); |
813 | up(&priv->sem); | 861 | mutex_unlock(&priv->mutex); |
814 | } | 862 | } |
815 | 863 | ||
816 | static void __ipw_led_activity_on(struct ipw_priv *priv) | 864 | static void __ipw_led_activity_on(struct ipw_priv *priv) |
@@ -847,6 +895,7 @@ static void __ipw_led_activity_on(struct ipw_priv *priv) | |||
847 | } | 895 | } |
848 | } | 896 | } |
849 | 897 | ||
898 | #if 0 | ||
850 | void ipw_led_activity_on(struct ipw_priv *priv) | 899 | void ipw_led_activity_on(struct ipw_priv *priv) |
851 | { | 900 | { |
852 | unsigned long flags; | 901 | unsigned long flags; |
@@ -854,8 +903,9 @@ void ipw_led_activity_on(struct ipw_priv *priv) | |||
854 | __ipw_led_activity_on(priv); | 903 | __ipw_led_activity_on(priv); |
855 | spin_unlock_irqrestore(&priv->lock, flags); | 904 | spin_unlock_irqrestore(&priv->lock, flags); |
856 | } | 905 | } |
906 | #endif /* 0 */ | ||
857 | 907 | ||
858 | void ipw_led_activity_off(struct ipw_priv *priv) | 908 | static void ipw_led_activity_off(struct ipw_priv *priv) |
859 | { | 909 | { |
860 | unsigned long flags; | 910 | unsigned long flags; |
861 | u32 led; | 911 | u32 led; |
@@ -885,12 +935,12 @@ void ipw_led_activity_off(struct ipw_priv *priv) | |||
885 | static void ipw_bg_led_activity_off(void *data) | 935 | static void ipw_bg_led_activity_off(void *data) |
886 | { | 936 | { |
887 | struct ipw_priv *priv = data; | 937 | struct ipw_priv *priv = data; |
888 | down(&priv->sem); | 938 | mutex_lock(&priv->mutex); |
889 | ipw_led_activity_off(data); | 939 | ipw_led_activity_off(data); |
890 | up(&priv->sem); | 940 | mutex_unlock(&priv->mutex); |
891 | } | 941 | } |
892 | 942 | ||
893 | void ipw_led_band_on(struct ipw_priv *priv) | 943 | static void ipw_led_band_on(struct ipw_priv *priv) |
894 | { | 944 | { |
895 | unsigned long flags; | 945 | unsigned long flags; |
896 | u32 led; | 946 | u32 led; |
@@ -925,7 +975,7 @@ void ipw_led_band_on(struct ipw_priv *priv) | |||
925 | spin_unlock_irqrestore(&priv->lock, flags); | 975 | spin_unlock_irqrestore(&priv->lock, flags); |
926 | } | 976 | } |
927 | 977 | ||
928 | void ipw_led_band_off(struct ipw_priv *priv) | 978 | static void ipw_led_band_off(struct ipw_priv *priv) |
929 | { | 979 | { |
930 | unsigned long flags; | 980 | unsigned long flags; |
931 | u32 led; | 981 | u32 led; |
@@ -948,24 +998,24 @@ void ipw_led_band_off(struct ipw_priv *priv) | |||
948 | spin_unlock_irqrestore(&priv->lock, flags); | 998 | spin_unlock_irqrestore(&priv->lock, flags); |
949 | } | 999 | } |
950 | 1000 | ||
951 | void ipw_led_radio_on(struct ipw_priv *priv) | 1001 | static void ipw_led_radio_on(struct ipw_priv *priv) |
952 | { | 1002 | { |
953 | ipw_led_link_on(priv); | 1003 | ipw_led_link_on(priv); |
954 | } | 1004 | } |
955 | 1005 | ||
956 | void ipw_led_radio_off(struct ipw_priv *priv) | 1006 | static void ipw_led_radio_off(struct ipw_priv *priv) |
957 | { | 1007 | { |
958 | ipw_led_activity_off(priv); | 1008 | ipw_led_activity_off(priv); |
959 | ipw_led_link_off(priv); | 1009 | ipw_led_link_off(priv); |
960 | } | 1010 | } |
961 | 1011 | ||
962 | void ipw_led_link_up(struct ipw_priv *priv) | 1012 | static void ipw_led_link_up(struct ipw_priv *priv) |
963 | { | 1013 | { |
964 | /* Set the Link Led on for all nic types */ | 1014 | /* Set the Link Led on for all nic types */ |
965 | ipw_led_link_on(priv); | 1015 | ipw_led_link_on(priv); |
966 | } | 1016 | } |
967 | 1017 | ||
968 | void ipw_led_link_down(struct ipw_priv *priv) | 1018 | static void ipw_led_link_down(struct ipw_priv *priv) |
969 | { | 1019 | { |
970 | ipw_led_activity_off(priv); | 1020 | ipw_led_activity_off(priv); |
971 | ipw_led_link_off(priv); | 1021 | ipw_led_link_off(priv); |
@@ -974,7 +1024,7 @@ void ipw_led_link_down(struct ipw_priv *priv) | |||
974 | ipw_led_radio_off(priv); | 1024 | ipw_led_radio_off(priv); |
975 | } | 1025 | } |
976 | 1026 | ||
977 | void ipw_led_init(struct ipw_priv *priv) | 1027 | static void ipw_led_init(struct ipw_priv *priv) |
978 | { | 1028 | { |
979 | priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; | 1029 | priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; |
980 | 1030 | ||
@@ -1025,7 +1075,7 @@ void ipw_led_init(struct ipw_priv *priv) | |||
1025 | } | 1075 | } |
1026 | } | 1076 | } |
1027 | 1077 | ||
1028 | void ipw_led_shutdown(struct ipw_priv *priv) | 1078 | static void ipw_led_shutdown(struct ipw_priv *priv) |
1029 | { | 1079 | { |
1030 | ipw_led_activity_off(priv); | 1080 | ipw_led_activity_off(priv); |
1031 | ipw_led_link_off(priv); | 1081 | ipw_led_link_off(priv); |
@@ -1074,6 +1124,7 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, | |||
1074 | 1124 | ||
1075 | static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) | 1125 | static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) |
1076 | { | 1126 | { |
1127 | /* length = 1st dword in log */ | ||
1077 | return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); | 1128 | return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); |
1078 | } | 1129 | } |
1079 | 1130 | ||
@@ -1870,7 +1921,8 @@ static char *get_cmd_string(u8 cmd) | |||
1870 | } | 1921 | } |
1871 | 1922 | ||
1872 | #define HOST_COMPLETE_TIMEOUT HZ | 1923 | #define HOST_COMPLETE_TIMEOUT HZ |
1873 | static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | 1924 | |
1925 | static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | ||
1874 | { | 1926 | { |
1875 | int rc = 0; | 1927 | int rc = 0; |
1876 | unsigned long flags; | 1928 | unsigned long flags; |
@@ -1897,9 +1949,15 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
1897 | IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n", | 1949 | IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n", |
1898 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, | 1950 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, |
1899 | priv->status); | 1951 | priv->status); |
1900 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); | ||
1901 | 1952 | ||
1902 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); | 1953 | #ifndef DEBUG_CMD_WEP_KEY |
1954 | if (cmd->cmd == IPW_CMD_WEP_KEY) | ||
1955 | IPW_DEBUG_HC("WEP_KEY command masked out for secure.\n"); | ||
1956 | else | ||
1957 | #endif | ||
1958 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); | ||
1959 | |||
1960 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, cmd->param, cmd->len, 0); | ||
1903 | if (rc) { | 1961 | if (rc) { |
1904 | priv->status &= ~STATUS_HCMD_ACTIVE; | 1962 | priv->status &= ~STATUS_HCMD_ACTIVE; |
1905 | IPW_ERROR("Failed to send %s: Reason %d\n", | 1963 | IPW_ERROR("Failed to send %s: Reason %d\n", |
@@ -1942,61 +2000,62 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
1942 | return rc; | 2000 | return rc; |
1943 | } | 2001 | } |
1944 | 2002 | ||
1945 | static int ipw_send_host_complete(struct ipw_priv *priv) | 2003 | static int ipw_send_cmd_simple(struct ipw_priv *priv, u8 command) |
1946 | { | 2004 | { |
1947 | struct host_cmd cmd = { | 2005 | struct host_cmd cmd = { |
1948 | .cmd = IPW_CMD_HOST_COMPLETE, | 2006 | .cmd = command, |
1949 | .len = 0 | ||
1950 | }; | 2007 | }; |
1951 | 2008 | ||
2009 | return __ipw_send_cmd(priv, &cmd); | ||
2010 | } | ||
2011 | |||
2012 | static int ipw_send_cmd_pdu(struct ipw_priv *priv, u8 command, u8 len, | ||
2013 | void *data) | ||
2014 | { | ||
2015 | struct host_cmd cmd = { | ||
2016 | .cmd = command, | ||
2017 | .len = len, | ||
2018 | .param = data, | ||
2019 | }; | ||
2020 | |||
2021 | return __ipw_send_cmd(priv, &cmd); | ||
2022 | } | ||
2023 | |||
2024 | static int ipw_send_host_complete(struct ipw_priv *priv) | ||
2025 | { | ||
1952 | if (!priv) { | 2026 | if (!priv) { |
1953 | IPW_ERROR("Invalid args\n"); | 2027 | IPW_ERROR("Invalid args\n"); |
1954 | return -1; | 2028 | return -1; |
1955 | } | 2029 | } |
1956 | 2030 | ||
1957 | return ipw_send_cmd(priv, &cmd); | 2031 | return ipw_send_cmd_simple(priv, IPW_CMD_HOST_COMPLETE); |
1958 | } | 2032 | } |
1959 | 2033 | ||
1960 | static int ipw_send_system_config(struct ipw_priv *priv, | 2034 | static int ipw_send_system_config(struct ipw_priv *priv, |
1961 | struct ipw_sys_config *config) | 2035 | struct ipw_sys_config *config) |
1962 | { | 2036 | { |
1963 | struct host_cmd cmd = { | ||
1964 | .cmd = IPW_CMD_SYSTEM_CONFIG, | ||
1965 | .len = sizeof(*config) | ||
1966 | }; | ||
1967 | |||
1968 | if (!priv || !config) { | 2037 | if (!priv || !config) { |
1969 | IPW_ERROR("Invalid args\n"); | 2038 | IPW_ERROR("Invalid args\n"); |
1970 | return -1; | 2039 | return -1; |
1971 | } | 2040 | } |
1972 | 2041 | ||
1973 | memcpy(cmd.param, config, sizeof(*config)); | 2042 | return ipw_send_cmd_pdu(priv, IPW_CMD_SYSTEM_CONFIG, sizeof(*config), |
1974 | return ipw_send_cmd(priv, &cmd); | 2043 | config); |
1975 | } | 2044 | } |
1976 | 2045 | ||
1977 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) | 2046 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) |
1978 | { | 2047 | { |
1979 | struct host_cmd cmd = { | ||
1980 | .cmd = IPW_CMD_SSID, | ||
1981 | .len = min(len, IW_ESSID_MAX_SIZE) | ||
1982 | }; | ||
1983 | |||
1984 | if (!priv || !ssid) { | 2048 | if (!priv || !ssid) { |
1985 | IPW_ERROR("Invalid args\n"); | 2049 | IPW_ERROR("Invalid args\n"); |
1986 | return -1; | 2050 | return -1; |
1987 | } | 2051 | } |
1988 | 2052 | ||
1989 | memcpy(cmd.param, ssid, cmd.len); | 2053 | return ipw_send_cmd_pdu(priv, IPW_CMD_SSID, min(len, IW_ESSID_MAX_SIZE), |
1990 | return ipw_send_cmd(priv, &cmd); | 2054 | ssid); |
1991 | } | 2055 | } |
1992 | 2056 | ||
1993 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | 2057 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) |
1994 | { | 2058 | { |
1995 | struct host_cmd cmd = { | ||
1996 | .cmd = IPW_CMD_ADAPTER_ADDRESS, | ||
1997 | .len = ETH_ALEN | ||
1998 | }; | ||
1999 | |||
2000 | if (!priv || !mac) { | 2059 | if (!priv || !mac) { |
2001 | IPW_ERROR("Invalid args\n"); | 2060 | IPW_ERROR("Invalid args\n"); |
2002 | return -1; | 2061 | return -1; |
@@ -2005,8 +2064,7 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | |||
2005 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", | 2064 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", |
2006 | priv->net_dev->name, MAC_ARG(mac)); | 2065 | priv->net_dev->name, MAC_ARG(mac)); |
2007 | 2066 | ||
2008 | memcpy(cmd.param, mac, ETH_ALEN); | 2067 | return ipw_send_cmd_pdu(priv, IPW_CMD_ADAPTER_ADDRESS, ETH_ALEN, mac); |
2009 | return ipw_send_cmd(priv, &cmd); | ||
2010 | } | 2068 | } |
2011 | 2069 | ||
2012 | /* | 2070 | /* |
@@ -2036,9 +2094,9 @@ static void ipw_adapter_restart(void *adapter) | |||
2036 | static void ipw_bg_adapter_restart(void *data) | 2094 | static void ipw_bg_adapter_restart(void *data) |
2037 | { | 2095 | { |
2038 | struct ipw_priv *priv = data; | 2096 | struct ipw_priv *priv = data; |
2039 | down(&priv->sem); | 2097 | mutex_lock(&priv->mutex); |
2040 | ipw_adapter_restart(data); | 2098 | ipw_adapter_restart(data); |
2041 | up(&priv->sem); | 2099 | mutex_unlock(&priv->mutex); |
2042 | } | 2100 | } |
2043 | 2101 | ||
2044 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) | 2102 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) |
@@ -2048,8 +2106,8 @@ static void ipw_scan_check(void *data) | |||
2048 | struct ipw_priv *priv = data; | 2106 | struct ipw_priv *priv = data; |
2049 | if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { | 2107 | if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { |
2050 | IPW_DEBUG_SCAN("Scan completion watchdog resetting " | 2108 | IPW_DEBUG_SCAN("Scan completion watchdog resetting " |
2051 | "adapter (%dms).\n", | 2109 | "adapter after (%dms).\n", |
2052 | IPW_SCAN_CHECK_WATCHDOG / 100); | 2110 | jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG)); |
2053 | queue_work(priv->workqueue, &priv->adapter_restart); | 2111 | queue_work(priv->workqueue, &priv->adapter_restart); |
2054 | } | 2112 | } |
2055 | } | 2113 | } |
@@ -2057,59 +2115,48 @@ static void ipw_scan_check(void *data) | |||
2057 | static void ipw_bg_scan_check(void *data) | 2115 | static void ipw_bg_scan_check(void *data) |
2058 | { | 2116 | { |
2059 | struct ipw_priv *priv = data; | 2117 | struct ipw_priv *priv = data; |
2060 | down(&priv->sem); | 2118 | mutex_lock(&priv->mutex); |
2061 | ipw_scan_check(data); | 2119 | ipw_scan_check(data); |
2062 | up(&priv->sem); | 2120 | mutex_unlock(&priv->mutex); |
2063 | } | 2121 | } |
2064 | 2122 | ||
2065 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, | 2123 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, |
2066 | struct ipw_scan_request_ext *request) | 2124 | struct ipw_scan_request_ext *request) |
2067 | { | 2125 | { |
2068 | struct host_cmd cmd = { | 2126 | return ipw_send_cmd_pdu(priv, IPW_CMD_SCAN_REQUEST_EXT, |
2069 | .cmd = IPW_CMD_SCAN_REQUEST_EXT, | 2127 | sizeof(*request), request); |
2070 | .len = sizeof(*request) | ||
2071 | }; | ||
2072 | |||
2073 | memcpy(cmd.param, request, sizeof(*request)); | ||
2074 | return ipw_send_cmd(priv, &cmd); | ||
2075 | } | 2128 | } |
2076 | 2129 | ||
2077 | static int ipw_send_scan_abort(struct ipw_priv *priv) | 2130 | static int ipw_send_scan_abort(struct ipw_priv *priv) |
2078 | { | 2131 | { |
2079 | struct host_cmd cmd = { | ||
2080 | .cmd = IPW_CMD_SCAN_ABORT, | ||
2081 | .len = 0 | ||
2082 | }; | ||
2083 | |||
2084 | if (!priv) { | 2132 | if (!priv) { |
2085 | IPW_ERROR("Invalid args\n"); | 2133 | IPW_ERROR("Invalid args\n"); |
2086 | return -1; | 2134 | return -1; |
2087 | } | 2135 | } |
2088 | 2136 | ||
2089 | return ipw_send_cmd(priv, &cmd); | 2137 | return ipw_send_cmd_simple(priv, IPW_CMD_SCAN_ABORT); |
2090 | } | 2138 | } |
2091 | 2139 | ||
2092 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) | 2140 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) |
2093 | { | 2141 | { |
2094 | struct host_cmd cmd = { | 2142 | struct ipw_sensitivity_calib calib = { |
2095 | .cmd = IPW_CMD_SENSITIVITY_CALIB, | 2143 | .beacon_rssi_raw = sens, |
2096 | .len = sizeof(struct ipw_sensitivity_calib) | ||
2097 | }; | 2144 | }; |
2098 | struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) | 2145 | |
2099 | &cmd.param; | 2146 | return ipw_send_cmd_pdu(priv, IPW_CMD_SENSITIVITY_CALIB, sizeof(calib), |
2100 | calib->beacon_rssi_raw = sens; | 2147 | &calib); |
2101 | return ipw_send_cmd(priv, &cmd); | ||
2102 | } | 2148 | } |
2103 | 2149 | ||
2104 | static int ipw_send_associate(struct ipw_priv *priv, | 2150 | static int ipw_send_associate(struct ipw_priv *priv, |
2105 | struct ipw_associate *associate) | 2151 | struct ipw_associate *associate) |
2106 | { | 2152 | { |
2107 | struct host_cmd cmd = { | ||
2108 | .cmd = IPW_CMD_ASSOCIATE, | ||
2109 | .len = sizeof(*associate) | ||
2110 | }; | ||
2111 | |||
2112 | struct ipw_associate tmp_associate; | 2153 | struct ipw_associate tmp_associate; |
2154 | |||
2155 | if (!priv || !associate) { | ||
2156 | IPW_ERROR("Invalid args\n"); | ||
2157 | return -1; | ||
2158 | } | ||
2159 | |||
2113 | memcpy(&tmp_associate, associate, sizeof(*associate)); | 2160 | memcpy(&tmp_associate, associate, sizeof(*associate)); |
2114 | tmp_associate.policy_support = | 2161 | tmp_associate.policy_support = |
2115 | cpu_to_le16(tmp_associate.policy_support); | 2162 | cpu_to_le16(tmp_associate.policy_support); |
@@ -2122,80 +2169,55 @@ static int ipw_send_associate(struct ipw_priv *priv, | |||
2122 | cpu_to_le16(tmp_associate.beacon_interval); | 2169 | cpu_to_le16(tmp_associate.beacon_interval); |
2123 | tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); | 2170 | tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); |
2124 | 2171 | ||
2125 | if (!priv || !associate) { | 2172 | return ipw_send_cmd_pdu(priv, IPW_CMD_ASSOCIATE, sizeof(tmp_associate), |
2126 | IPW_ERROR("Invalid args\n"); | 2173 | &tmp_associate); |
2127 | return -1; | ||
2128 | } | ||
2129 | |||
2130 | memcpy(cmd.param, &tmp_associate, sizeof(*associate)); | ||
2131 | return ipw_send_cmd(priv, &cmd); | ||
2132 | } | 2174 | } |
2133 | 2175 | ||
2134 | static int ipw_send_supported_rates(struct ipw_priv *priv, | 2176 | static int ipw_send_supported_rates(struct ipw_priv *priv, |
2135 | struct ipw_supported_rates *rates) | 2177 | struct ipw_supported_rates *rates) |
2136 | { | 2178 | { |
2137 | struct host_cmd cmd = { | ||
2138 | .cmd = IPW_CMD_SUPPORTED_RATES, | ||
2139 | .len = sizeof(*rates) | ||
2140 | }; | ||
2141 | |||
2142 | if (!priv || !rates) { | 2179 | if (!priv || !rates) { |
2143 | IPW_ERROR("Invalid args\n"); | 2180 | IPW_ERROR("Invalid args\n"); |
2144 | return -1; | 2181 | return -1; |
2145 | } | 2182 | } |
2146 | 2183 | ||
2147 | memcpy(cmd.param, rates, sizeof(*rates)); | 2184 | return ipw_send_cmd_pdu(priv, IPW_CMD_SUPPORTED_RATES, sizeof(*rates), |
2148 | return ipw_send_cmd(priv, &cmd); | 2185 | rates); |
2149 | } | 2186 | } |
2150 | 2187 | ||
2151 | static int ipw_set_random_seed(struct ipw_priv *priv) | 2188 | static int ipw_set_random_seed(struct ipw_priv *priv) |
2152 | { | 2189 | { |
2153 | struct host_cmd cmd = { | 2190 | u32 val; |
2154 | .cmd = IPW_CMD_SEED_NUMBER, | ||
2155 | .len = sizeof(u32) | ||
2156 | }; | ||
2157 | 2191 | ||
2158 | if (!priv) { | 2192 | if (!priv) { |
2159 | IPW_ERROR("Invalid args\n"); | 2193 | IPW_ERROR("Invalid args\n"); |
2160 | return -1; | 2194 | return -1; |
2161 | } | 2195 | } |
2162 | 2196 | ||
2163 | get_random_bytes(&cmd.param, sizeof(u32)); | 2197 | get_random_bytes(&val, sizeof(val)); |
2164 | 2198 | ||
2165 | return ipw_send_cmd(priv, &cmd); | 2199 | return ipw_send_cmd_pdu(priv, IPW_CMD_SEED_NUMBER, sizeof(val), &val); |
2166 | } | 2200 | } |
2167 | 2201 | ||
2168 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) | 2202 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) |
2169 | { | 2203 | { |
2170 | struct host_cmd cmd = { | ||
2171 | .cmd = IPW_CMD_CARD_DISABLE, | ||
2172 | .len = sizeof(u32) | ||
2173 | }; | ||
2174 | |||
2175 | if (!priv) { | 2204 | if (!priv) { |
2176 | IPW_ERROR("Invalid args\n"); | 2205 | IPW_ERROR("Invalid args\n"); |
2177 | return -1; | 2206 | return -1; |
2178 | } | 2207 | } |
2179 | 2208 | ||
2180 | *((u32 *) & cmd.param) = phy_off; | 2209 | return ipw_send_cmd_pdu(priv, IPW_CMD_CARD_DISABLE, sizeof(phy_off), |
2181 | 2210 | &phy_off); | |
2182 | return ipw_send_cmd(priv, &cmd); | ||
2183 | } | 2211 | } |
2184 | 2212 | ||
2185 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) | 2213 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) |
2186 | { | 2214 | { |
2187 | struct host_cmd cmd = { | ||
2188 | .cmd = IPW_CMD_TX_POWER, | ||
2189 | .len = sizeof(*power) | ||
2190 | }; | ||
2191 | |||
2192 | if (!priv || !power) { | 2215 | if (!priv || !power) { |
2193 | IPW_ERROR("Invalid args\n"); | 2216 | IPW_ERROR("Invalid args\n"); |
2194 | return -1; | 2217 | return -1; |
2195 | } | 2218 | } |
2196 | 2219 | ||
2197 | memcpy(cmd.param, power, sizeof(*power)); | 2220 | return ipw_send_cmd_pdu(priv, IPW_CMD_TX_POWER, sizeof(*power), power); |
2198 | return ipw_send_cmd(priv, &cmd); | ||
2199 | } | 2221 | } |
2200 | 2222 | ||
2201 | static int ipw_set_tx_power(struct ipw_priv *priv) | 2223 | static int ipw_set_tx_power(struct ipw_priv *priv) |
@@ -2247,18 +2269,14 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) | |||
2247 | struct ipw_rts_threshold rts_threshold = { | 2269 | struct ipw_rts_threshold rts_threshold = { |
2248 | .rts_threshold = rts, | 2270 | .rts_threshold = rts, |
2249 | }; | 2271 | }; |
2250 | struct host_cmd cmd = { | ||
2251 | .cmd = IPW_CMD_RTS_THRESHOLD, | ||
2252 | .len = sizeof(rts_threshold) | ||
2253 | }; | ||
2254 | 2272 | ||
2255 | if (!priv) { | 2273 | if (!priv) { |
2256 | IPW_ERROR("Invalid args\n"); | 2274 | IPW_ERROR("Invalid args\n"); |
2257 | return -1; | 2275 | return -1; |
2258 | } | 2276 | } |
2259 | 2277 | ||
2260 | memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); | 2278 | return ipw_send_cmd_pdu(priv, IPW_CMD_RTS_THRESHOLD, |
2261 | return ipw_send_cmd(priv, &cmd); | 2279 | sizeof(rts_threshold), &rts_threshold); |
2262 | } | 2280 | } |
2263 | 2281 | ||
2264 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | 2282 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) |
@@ -2266,27 +2284,19 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | |||
2266 | struct ipw_frag_threshold frag_threshold = { | 2284 | struct ipw_frag_threshold frag_threshold = { |
2267 | .frag_threshold = frag, | 2285 | .frag_threshold = frag, |
2268 | }; | 2286 | }; |
2269 | struct host_cmd cmd = { | ||
2270 | .cmd = IPW_CMD_FRAG_THRESHOLD, | ||
2271 | .len = sizeof(frag_threshold) | ||
2272 | }; | ||
2273 | 2287 | ||
2274 | if (!priv) { | 2288 | if (!priv) { |
2275 | IPW_ERROR("Invalid args\n"); | 2289 | IPW_ERROR("Invalid args\n"); |
2276 | return -1; | 2290 | return -1; |
2277 | } | 2291 | } |
2278 | 2292 | ||
2279 | memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); | 2293 | return ipw_send_cmd_pdu(priv, IPW_CMD_FRAG_THRESHOLD, |
2280 | return ipw_send_cmd(priv, &cmd); | 2294 | sizeof(frag_threshold), &frag_threshold); |
2281 | } | 2295 | } |
2282 | 2296 | ||
2283 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | 2297 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) |
2284 | { | 2298 | { |
2285 | struct host_cmd cmd = { | 2299 | u32 param; |
2286 | .cmd = IPW_CMD_POWER_MODE, | ||
2287 | .len = sizeof(u32) | ||
2288 | }; | ||
2289 | u32 *param = (u32 *) (&cmd.param); | ||
2290 | 2300 | ||
2291 | if (!priv) { | 2301 | if (!priv) { |
2292 | IPW_ERROR("Invalid args\n"); | 2302 | IPW_ERROR("Invalid args\n"); |
@@ -2297,17 +2307,18 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | |||
2297 | * level */ | 2307 | * level */ |
2298 | switch (mode) { | 2308 | switch (mode) { |
2299 | case IPW_POWER_BATTERY: | 2309 | case IPW_POWER_BATTERY: |
2300 | *param = IPW_POWER_INDEX_3; | 2310 | param = IPW_POWER_INDEX_3; |
2301 | break; | 2311 | break; |
2302 | case IPW_POWER_AC: | 2312 | case IPW_POWER_AC: |
2303 | *param = IPW_POWER_MODE_CAM; | 2313 | param = IPW_POWER_MODE_CAM; |
2304 | break; | 2314 | break; |
2305 | default: | 2315 | default: |
2306 | *param = mode; | 2316 | param = mode; |
2307 | break; | 2317 | break; |
2308 | } | 2318 | } |
2309 | 2319 | ||
2310 | return ipw_send_cmd(priv, &cmd); | 2320 | return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param), |
2321 | ¶m); | ||
2311 | } | 2322 | } |
2312 | 2323 | ||
2313 | static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) | 2324 | static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) |
@@ -2316,18 +2327,14 @@ static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) | |||
2316 | .short_retry_limit = slimit, | 2327 | .short_retry_limit = slimit, |
2317 | .long_retry_limit = llimit | 2328 | .long_retry_limit = llimit |
2318 | }; | 2329 | }; |
2319 | struct host_cmd cmd = { | ||
2320 | .cmd = IPW_CMD_RETRY_LIMIT, | ||
2321 | .len = sizeof(retry_limit) | ||
2322 | }; | ||
2323 | 2330 | ||
2324 | if (!priv) { | 2331 | if (!priv) { |
2325 | IPW_ERROR("Invalid args\n"); | 2332 | IPW_ERROR("Invalid args\n"); |
2326 | return -1; | 2333 | return -1; |
2327 | } | 2334 | } |
2328 | 2335 | ||
2329 | memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); | 2336 | return ipw_send_cmd_pdu(priv, IPW_CMD_RETRY_LIMIT, sizeof(retry_limit), |
2330 | return ipw_send_cmd(priv, &cmd); | 2337 | &retry_limit); |
2331 | } | 2338 | } |
2332 | 2339 | ||
2333 | /* | 2340 | /* |
@@ -2454,7 +2461,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) | |||
2454 | /* | 2461 | /* |
2455 | If the data looks correct, then copy it to our private | 2462 | If the data looks correct, then copy it to our private |
2456 | copy. Otherwise let the firmware know to perform the operation | 2463 | copy. Otherwise let the firmware know to perform the operation |
2457 | on it's own | 2464 | on its own. |
2458 | */ | 2465 | */ |
2459 | if (priv->eeprom[EEPROM_VERSION] != 0) { | 2466 | if (priv->eeprom[EEPROM_VERSION] != 0) { |
2460 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); | 2467 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); |
@@ -2707,22 +2714,25 @@ static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, | |||
2707 | 2714 | ||
2708 | static int ipw_fw_dma_wait(struct ipw_priv *priv) | 2715 | static int ipw_fw_dma_wait(struct ipw_priv *priv) |
2709 | { | 2716 | { |
2710 | u32 current_index = 0; | 2717 | u32 current_index = 0, previous_index; |
2711 | u32 watchdog = 0; | 2718 | u32 watchdog = 0; |
2712 | 2719 | ||
2713 | IPW_DEBUG_FW(">> : \n"); | 2720 | IPW_DEBUG_FW(">> : \n"); |
2714 | 2721 | ||
2715 | current_index = ipw_fw_dma_command_block_index(priv); | 2722 | current_index = ipw_fw_dma_command_block_index(priv); |
2716 | IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%8X\n", | 2723 | IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%08X\n", |
2717 | (int)priv->sram_desc.last_cb_index); | 2724 | (int)priv->sram_desc.last_cb_index); |
2718 | 2725 | ||
2719 | while (current_index < priv->sram_desc.last_cb_index) { | 2726 | while (current_index < priv->sram_desc.last_cb_index) { |
2720 | udelay(50); | 2727 | udelay(50); |
2728 | previous_index = current_index; | ||
2721 | current_index = ipw_fw_dma_command_block_index(priv); | 2729 | current_index = ipw_fw_dma_command_block_index(priv); |
2722 | 2730 | ||
2723 | watchdog++; | 2731 | if (previous_index < current_index) { |
2724 | 2732 | watchdog = 0; | |
2725 | if (watchdog > 400) { | 2733 | continue; |
2734 | } | ||
2735 | if (++watchdog > 400) { | ||
2726 | IPW_DEBUG_FW_INFO("Timeout\n"); | 2736 | IPW_DEBUG_FW_INFO("Timeout\n"); |
2727 | ipw_fw_dma_dump_command_block(priv); | 2737 | ipw_fw_dma_dump_command_block(priv); |
2728 | ipw_fw_dma_abort(priv); | 2738 | ipw_fw_dma_abort(priv); |
@@ -2772,6 +2782,7 @@ static inline int ipw_alive(struct ipw_priv *priv) | |||
2772 | return ipw_read32(priv, 0x90) == 0xd55555d5; | 2782 | return ipw_read32(priv, 0x90) == 0xd55555d5; |
2773 | } | 2783 | } |
2774 | 2784 | ||
2785 | /* timeout in msec, attempted in 10-msec quanta */ | ||
2775 | static int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask, | 2786 | static int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask, |
2776 | int timeout) | 2787 | int timeout) |
2777 | { | 2788 | { |
@@ -2800,10 +2811,11 @@ static int ipw_stop_master(struct ipw_priv *priv) | |||
2800 | /* stop master. typical delay - 0 */ | 2811 | /* stop master. typical delay - 0 */ |
2801 | ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); | 2812 | ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); |
2802 | 2813 | ||
2814 | /* timeout is in msec, polled in 10-msec quanta */ | ||
2803 | rc = ipw_poll_bit(priv, IPW_RESET_REG, | 2815 | rc = ipw_poll_bit(priv, IPW_RESET_REG, |
2804 | IPW_RESET_REG_MASTER_DISABLED, 100); | 2816 | IPW_RESET_REG_MASTER_DISABLED, 100); |
2805 | if (rc < 0) { | 2817 | if (rc < 0) { |
2806 | IPW_ERROR("stop master failed in 10ms\n"); | 2818 | IPW_ERROR("wait for stop master failed after 100ms\n"); |
2807 | return -1; | 2819 | return -1; |
2808 | } | 2820 | } |
2809 | 2821 | ||
@@ -2890,8 +2902,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2890 | mdelay(1); | 2902 | mdelay(1); |
2891 | 2903 | ||
2892 | /* enable ucode store */ | 2904 | /* enable ucode store */ |
2893 | ipw_write_reg8(priv, DINO_CONTROL_REG, 0x0); | 2905 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0x0); |
2894 | ipw_write_reg8(priv, DINO_CONTROL_REG, DINO_ENABLE_CS); | 2906 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, DINO_ENABLE_CS); |
2895 | mdelay(1); | 2907 | mdelay(1); |
2896 | 2908 | ||
2897 | /* write ucode */ | 2909 | /* write ucode */ |
@@ -3036,7 +3048,7 @@ static int ipw_stop_nic(struct ipw_priv *priv) | |||
3036 | rc = ipw_poll_bit(priv, IPW_RESET_REG, | 3048 | rc = ipw_poll_bit(priv, IPW_RESET_REG, |
3037 | IPW_RESET_REG_MASTER_DISABLED, 500); | 3049 | IPW_RESET_REG_MASTER_DISABLED, 500); |
3038 | if (rc < 0) { | 3050 | if (rc < 0) { |
3039 | IPW_ERROR("wait for reg master disabled failed\n"); | 3051 | IPW_ERROR("wait for reg master disabled failed after 500ms\n"); |
3040 | return rc; | 3052 | return rc; |
3041 | } | 3053 | } |
3042 | 3054 | ||
@@ -3209,55 +3221,31 @@ static int ipw_load(struct ipw_priv *priv) | |||
3209 | const struct firmware *firmware = NULL; | 3221 | const struct firmware *firmware = NULL; |
3210 | const struct firmware *ucode = NULL; | 3222 | const struct firmware *ucode = NULL; |
3211 | #endif | 3223 | #endif |
3224 | char *ucode_name; | ||
3225 | char *fw_name; | ||
3212 | int rc = 0, retries = 3; | 3226 | int rc = 0, retries = 3; |
3213 | 3227 | ||
3214 | #ifdef CONFIG_PM | 3228 | switch (priv->ieee->iw_mode) { |
3215 | if (!fw_loaded) { | 3229 | case IW_MODE_ADHOC: |
3216 | #endif | 3230 | ucode_name = IPW_FW_NAME("ibss_ucode"); |
3217 | rc = ipw_get_fw(priv, &bootfw, IPW_FW_NAME("boot")); | 3231 | fw_name = IPW_FW_NAME("ibss"); |
3218 | if (rc) | 3232 | break; |
3219 | goto error; | ||
3220 | |||
3221 | switch (priv->ieee->iw_mode) { | ||
3222 | case IW_MODE_ADHOC: | ||
3223 | rc = ipw_get_fw(priv, &ucode, | ||
3224 | IPW_FW_NAME("ibss_ucode")); | ||
3225 | if (rc) | ||
3226 | goto error; | ||
3227 | |||
3228 | rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss")); | ||
3229 | break; | ||
3230 | |||
3231 | #ifdef CONFIG_IPW2200_MONITOR | 3233 | #ifdef CONFIG_IPW2200_MONITOR |
3232 | case IW_MODE_MONITOR: | 3234 | case IW_MODE_MONITOR: |
3233 | rc = ipw_get_fw(priv, &ucode, | 3235 | ucode_name = IPW_FW_NAME("sniffer_ucode"); |
3234 | IPW_FW_NAME("sniffer_ucode")); | 3236 | fw_name = IPW_FW_NAME("sniffer"); |
3235 | if (rc) | 3237 | break; |
3236 | goto error; | ||
3237 | |||
3238 | rc = ipw_get_fw(priv, &firmware, | ||
3239 | IPW_FW_NAME("sniffer")); | ||
3240 | break; | ||
3241 | #endif | 3238 | #endif |
3242 | case IW_MODE_INFRA: | 3239 | case IW_MODE_INFRA: |
3243 | rc = ipw_get_fw(priv, &ucode, IPW_FW_NAME("bss_ucode")); | 3240 | ucode_name = IPW_FW_NAME("bss_ucode"); |
3244 | if (rc) | 3241 | fw_name = IPW_FW_NAME("bss"); |
3245 | goto error; | 3242 | break; |
3246 | 3243 | default: | |
3247 | rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("bss")); | 3244 | rc = -EINVAL; |
3248 | break; | ||
3249 | |||
3250 | default: | ||
3251 | rc = -EINVAL; | ||
3252 | } | ||
3253 | |||
3254 | if (rc) | ||
3255 | goto error; | ||
3256 | |||
3257 | #ifdef CONFIG_PM | ||
3258 | fw_loaded = 1; | ||
3259 | } | 3245 | } |
3260 | #endif | 3246 | |
3247 | if (rc < 0) | ||
3248 | goto error; | ||
3261 | 3249 | ||
3262 | if (!priv->rxq) | 3250 | if (!priv->rxq) |
3263 | priv->rxq = ipw_rx_queue_alloc(priv); | 3251 | priv->rxq = ipw_rx_queue_alloc(priv); |
@@ -3279,7 +3267,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
3279 | ipw_stop_nic(priv); | 3267 | ipw_stop_nic(priv); |
3280 | 3268 | ||
3281 | rc = ipw_reset_nic(priv); | 3269 | rc = ipw_reset_nic(priv); |
3282 | if (rc) { | 3270 | if (rc < 0) { |
3283 | IPW_ERROR("Unable to reset NIC\n"); | 3271 | IPW_ERROR("Unable to reset NIC\n"); |
3284 | goto error; | 3272 | goto error; |
3285 | } | 3273 | } |
@@ -3287,6 +3275,15 @@ static int ipw_load(struct ipw_priv *priv) | |||
3287 | ipw_zero_memory(priv, IPW_NIC_SRAM_LOWER_BOUND, | 3275 | ipw_zero_memory(priv, IPW_NIC_SRAM_LOWER_BOUND, |
3288 | IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); | 3276 | IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); |
3289 | 3277 | ||
3278 | #ifdef CONFIG_PM | ||
3279 | if (!fw_loaded) { | ||
3280 | #endif | ||
3281 | rc = ipw_get_fw(priv, &bootfw, IPW_FW_NAME("boot")); | ||
3282 | if (rc < 0) | ||
3283 | goto error; | ||
3284 | #ifdef CONFIG_PM | ||
3285 | } | ||
3286 | #endif | ||
3290 | /* DMA the initial boot firmware into the device */ | 3287 | /* DMA the initial boot firmware into the device */ |
3291 | rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), | 3288 | rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), |
3292 | bootfw->size - sizeof(struct fw_header)); | 3289 | bootfw->size - sizeof(struct fw_header)); |
@@ -3298,7 +3295,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
3298 | /* kick start the device */ | 3295 | /* kick start the device */ |
3299 | ipw_start_nic(priv); | 3296 | ipw_start_nic(priv); |
3300 | 3297 | ||
3301 | /* wait for the device to finish it's initial startup sequence */ | 3298 | /* wait for the device to finish its initial startup sequence */ |
3302 | rc = ipw_poll_bit(priv, IPW_INTA_RW, | 3299 | rc = ipw_poll_bit(priv, IPW_INTA_RW, |
3303 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); | 3300 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); |
3304 | if (rc < 0) { | 3301 | if (rc < 0) { |
@@ -3310,6 +3307,16 @@ static int ipw_load(struct ipw_priv *priv) | |||
3310 | /* ack fw init done interrupt */ | 3307 | /* ack fw init done interrupt */ |
3311 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); | 3308 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); |
3312 | 3309 | ||
3310 | #ifdef CONFIG_PM | ||
3311 | if (!fw_loaded) { | ||
3312 | #endif | ||
3313 | rc = ipw_get_fw(priv, &ucode, ucode_name); | ||
3314 | if (rc < 0) | ||
3315 | goto error; | ||
3316 | #ifdef CONFIG_PM | ||
3317 | } | ||
3318 | #endif | ||
3319 | |||
3313 | /* DMA the ucode into the device */ | 3320 | /* DMA the ucode into the device */ |
3314 | rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), | 3321 | rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), |
3315 | ucode->size - sizeof(struct fw_header)); | 3322 | ucode->size - sizeof(struct fw_header)); |
@@ -3321,6 +3328,16 @@ static int ipw_load(struct ipw_priv *priv) | |||
3321 | /* stop nic */ | 3328 | /* stop nic */ |
3322 | ipw_stop_nic(priv); | 3329 | ipw_stop_nic(priv); |
3323 | 3330 | ||
3331 | #ifdef CONFIG_PM | ||
3332 | if (!fw_loaded) { | ||
3333 | #endif | ||
3334 | rc = ipw_get_fw(priv, &firmware, fw_name); | ||
3335 | if (rc < 0) | ||
3336 | goto error; | ||
3337 | #ifdef CONFIG_PM | ||
3338 | } | ||
3339 | #endif | ||
3340 | |||
3324 | /* DMA bss firmware into the device */ | 3341 | /* DMA bss firmware into the device */ |
3325 | rc = ipw_load_firmware(priv, firmware->data + | 3342 | rc = ipw_load_firmware(priv, firmware->data + |
3326 | sizeof(struct fw_header), | 3343 | sizeof(struct fw_header), |
@@ -3329,11 +3346,14 @@ static int ipw_load(struct ipw_priv *priv) | |||
3329 | IPW_ERROR("Unable to load firmware: %d\n", rc); | 3346 | IPW_ERROR("Unable to load firmware: %d\n", rc); |
3330 | goto error; | 3347 | goto error; |
3331 | } | 3348 | } |
3349 | #ifdef CONFIG_PM | ||
3350 | fw_loaded = 1; | ||
3351 | #endif | ||
3332 | 3352 | ||
3333 | ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0); | 3353 | ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0); |
3334 | 3354 | ||
3335 | rc = ipw_queue_reset(priv); | 3355 | rc = ipw_queue_reset(priv); |
3336 | if (rc) { | 3356 | if (rc < 0) { |
3337 | IPW_ERROR("Unable to initialize queues\n"); | 3357 | IPW_ERROR("Unable to initialize queues\n"); |
3338 | goto error; | 3358 | goto error; |
3339 | } | 3359 | } |
@@ -3362,7 +3382,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
3362 | rc = ipw_poll_bit(priv, IPW_INTA_RW, | 3382 | rc = ipw_poll_bit(priv, IPW_INTA_RW, |
3363 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); | 3383 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); |
3364 | if (rc < 0) { | 3384 | if (rc < 0) { |
3365 | IPW_ERROR("device failed to start after 500ms\n"); | 3385 | IPW_ERROR("device failed to start within 500ms\n"); |
3366 | goto error; | 3386 | goto error; |
3367 | } | 3387 | } |
3368 | IPW_DEBUG_INFO("device response after %dms\n", rc); | 3388 | IPW_DEBUG_INFO("device response after %dms\n", rc); |
@@ -3715,9 +3735,9 @@ static int ipw_disassociate(void *data) | |||
3715 | static void ipw_bg_disassociate(void *data) | 3735 | static void ipw_bg_disassociate(void *data) |
3716 | { | 3736 | { |
3717 | struct ipw_priv *priv = data; | 3737 | struct ipw_priv *priv = data; |
3718 | down(&priv->sem); | 3738 | mutex_lock(&priv->mutex); |
3719 | ipw_disassociate(data); | 3739 | ipw_disassociate(data); |
3720 | up(&priv->sem); | 3740 | mutex_unlock(&priv->mutex); |
3721 | } | 3741 | } |
3722 | 3742 | ||
3723 | static void ipw_system_config(void *data) | 3743 | static void ipw_system_config(void *data) |
@@ -4077,9 +4097,9 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
4077 | static void ipw_bg_gather_stats(void *data) | 4097 | static void ipw_bg_gather_stats(void *data) |
4078 | { | 4098 | { |
4079 | struct ipw_priv *priv = data; | 4099 | struct ipw_priv *priv = data; |
4080 | down(&priv->sem); | 4100 | mutex_lock(&priv->mutex); |
4081 | ipw_gather_stats(data); | 4101 | ipw_gather_stats(data); |
4082 | up(&priv->sem); | 4102 | mutex_unlock(&priv->mutex); |
4083 | } | 4103 | } |
4084 | 4104 | ||
4085 | /* Missed beacon behavior: | 4105 | /* Missed beacon behavior: |
@@ -4121,8 +4141,9 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv, | |||
4121 | return; | 4141 | return; |
4122 | } | 4142 | } |
4123 | 4143 | ||
4124 | if (missed_count > priv->roaming_threshold && | 4144 | if (roaming && |
4125 | missed_count <= priv->disassociate_threshold) { | 4145 | (missed_count > priv->roaming_threshold && |
4146 | missed_count <= priv->disassociate_threshold)) { | ||
4126 | /* If we are not already roaming, set the ROAM | 4147 | /* If we are not already roaming, set the ROAM |
4127 | * bit in the status and kick off a scan. | 4148 | * bit in the status and kick off a scan. |
4128 | * This can happen several times before we reach | 4149 | * This can happen several times before we reach |
@@ -4150,7 +4171,6 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv, | |||
4150 | } | 4171 | } |
4151 | 4172 | ||
4152 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); | 4173 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); |
4153 | |||
4154 | } | 4174 | } |
4155 | 4175 | ||
4156 | /** | 4176 | /** |
@@ -4911,13 +4931,13 @@ static void ipw_rx_queue_replenish(void *data) | |||
4911 | static void ipw_bg_rx_queue_replenish(void *data) | 4931 | static void ipw_bg_rx_queue_replenish(void *data) |
4912 | { | 4932 | { |
4913 | struct ipw_priv *priv = data; | 4933 | struct ipw_priv *priv = data; |
4914 | down(&priv->sem); | 4934 | mutex_lock(&priv->mutex); |
4915 | ipw_rx_queue_replenish(data); | 4935 | ipw_rx_queue_replenish(data); |
4916 | up(&priv->sem); | 4936 | mutex_unlock(&priv->mutex); |
4917 | } | 4937 | } |
4918 | 4938 | ||
4919 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. | 4939 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. |
4920 | * If an SKB has been detached, the POOL needs to have it's SKB set to NULL | 4940 | * If an SKB has been detached, the POOL needs to have its SKB set to NULL |
4921 | * This free routine walks the list of POOL entries and if SKB is set to | 4941 | * This free routine walks the list of POOL entries and if SKB is set to |
4922 | * non NULL it is unmapped and freed | 4942 | * non NULL it is unmapped and freed |
4923 | */ | 4943 | */ |
@@ -5257,10 +5277,11 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, | |||
5257 | if (priv->ieee->scan_age != 0 && | 5277 | if (priv->ieee->scan_age != 0 && |
5258 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { | 5278 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { |
5259 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | 5279 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " |
5260 | "because of age: %lums.\n", | 5280 | "because of age: %ums.\n", |
5261 | escape_essid(network->ssid, network->ssid_len), | 5281 | escape_essid(network->ssid, network->ssid_len), |
5262 | MAC_ARG(network->bssid), | 5282 | MAC_ARG(network->bssid), |
5263 | 1000 * (jiffies - network->last_scanned) / HZ); | 5283 | jiffies_to_msecs(jiffies - |
5284 | network->last_scanned)); | ||
5264 | return 0; | 5285 | return 0; |
5265 | } | 5286 | } |
5266 | 5287 | ||
@@ -5369,7 +5390,7 @@ static void ipw_merge_adhoc_network(void *data) | |||
5369 | return; | 5390 | return; |
5370 | } | 5391 | } |
5371 | 5392 | ||
5372 | down(&priv->sem); | 5393 | mutex_lock(&priv->mutex); |
5373 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { | 5394 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { |
5374 | IPW_DEBUG_MERGE("remove network %s\n", | 5395 | IPW_DEBUG_MERGE("remove network %s\n", |
5375 | escape_essid(priv->essid, | 5396 | escape_essid(priv->essid, |
@@ -5379,7 +5400,7 @@ static void ipw_merge_adhoc_network(void *data) | |||
5379 | 5400 | ||
5380 | ipw_disassociate(priv); | 5401 | ipw_disassociate(priv); |
5381 | priv->assoc_network = match.network; | 5402 | priv->assoc_network = match.network; |
5382 | up(&priv->sem); | 5403 | mutex_unlock(&priv->mutex); |
5383 | return; | 5404 | return; |
5384 | } | 5405 | } |
5385 | } | 5406 | } |
@@ -5467,11 +5488,12 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
5467 | if (network->last_associate && | 5488 | if (network->last_associate && |
5468 | time_after(network->last_associate + (HZ * 3UL), jiffies)) { | 5489 | time_after(network->last_associate + (HZ * 3UL), jiffies)) { |
5469 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5490 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
5470 | "because of storming (%lus since last " | 5491 | "because of storming (%ums since last " |
5471 | "assoc attempt).\n", | 5492 | "assoc attempt).\n", |
5472 | escape_essid(network->ssid, network->ssid_len), | 5493 | escape_essid(network->ssid, network->ssid_len), |
5473 | MAC_ARG(network->bssid), | 5494 | MAC_ARG(network->bssid), |
5474 | (jiffies - network->last_associate) / HZ); | 5495 | jiffies_to_msecs(jiffies - |
5496 | network->last_associate)); | ||
5475 | return 0; | 5497 | return 0; |
5476 | } | 5498 | } |
5477 | 5499 | ||
@@ -5479,10 +5501,11 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
5479 | if (priv->ieee->scan_age != 0 && | 5501 | if (priv->ieee->scan_age != 0 && |
5480 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { | 5502 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { |
5481 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5503 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
5482 | "because of age: %lums.\n", | 5504 | "because of age: %ums.\n", |
5483 | escape_essid(network->ssid, network->ssid_len), | 5505 | escape_essid(network->ssid, network->ssid_len), |
5484 | MAC_ARG(network->bssid), | 5506 | MAC_ARG(network->bssid), |
5485 | 1000 * (jiffies - network->last_scanned) / HZ); | 5507 | jiffies_to_msecs(jiffies - |
5508 | network->last_scanned)); | ||
5486 | return 0; | 5509 | return 0; |
5487 | } | 5510 | } |
5488 | 5511 | ||
@@ -5671,54 +5694,44 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
5671 | 5694 | ||
5672 | static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) | 5695 | static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) |
5673 | { | 5696 | { |
5674 | struct ipw_tgi_tx_key *key; | 5697 | struct ipw_tgi_tx_key key; |
5675 | struct host_cmd cmd = { | ||
5676 | .cmd = IPW_CMD_TGI_TX_KEY, | ||
5677 | .len = sizeof(*key) | ||
5678 | }; | ||
5679 | 5698 | ||
5680 | if (!(priv->ieee->sec.flags & (1 << index))) | 5699 | if (!(priv->ieee->sec.flags & (1 << index))) |
5681 | return; | 5700 | return; |
5682 | 5701 | ||
5683 | key = (struct ipw_tgi_tx_key *)&cmd.param; | 5702 | key.key_id = index; |
5684 | key->key_id = index; | 5703 | memcpy(key.key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH); |
5685 | memcpy(key->key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH); | 5704 | key.security_type = type; |
5686 | key->security_type = type; | 5705 | key.station_index = 0; /* always 0 for BSS */ |
5687 | key->station_index = 0; /* always 0 for BSS */ | 5706 | key.flags = 0; |
5688 | key->flags = 0; | ||
5689 | /* 0 for new key; previous value of counter (after fatal error) */ | 5707 | /* 0 for new key; previous value of counter (after fatal error) */ |
5690 | key->tx_counter[0] = 0; | 5708 | key.tx_counter[0] = 0; |
5691 | key->tx_counter[1] = 0; | 5709 | key.tx_counter[1] = 0; |
5692 | 5710 | ||
5693 | ipw_send_cmd(priv, &cmd); | 5711 | ipw_send_cmd_pdu(priv, IPW_CMD_TGI_TX_KEY, sizeof(key), &key); |
5694 | } | 5712 | } |
5695 | 5713 | ||
5696 | static void ipw_send_wep_keys(struct ipw_priv *priv, int type) | 5714 | static void ipw_send_wep_keys(struct ipw_priv *priv, int type) |
5697 | { | 5715 | { |
5698 | struct ipw_wep_key *key; | 5716 | struct ipw_wep_key key; |
5699 | int i; | 5717 | int i; |
5700 | struct host_cmd cmd = { | ||
5701 | .cmd = IPW_CMD_WEP_KEY, | ||
5702 | .len = sizeof(*key) | ||
5703 | }; | ||
5704 | 5718 | ||
5705 | key = (struct ipw_wep_key *)&cmd.param; | 5719 | key.cmd_id = DINO_CMD_WEP_KEY; |
5706 | key->cmd_id = DINO_CMD_WEP_KEY; | 5720 | key.seq_num = 0; |
5707 | key->seq_num = 0; | ||
5708 | 5721 | ||
5709 | /* Note: AES keys cannot be set for multiple times. | 5722 | /* Note: AES keys cannot be set for multiple times. |
5710 | * Only set it at the first time. */ | 5723 | * Only set it at the first time. */ |
5711 | for (i = 0; i < 4; i++) { | 5724 | for (i = 0; i < 4; i++) { |
5712 | key->key_index = i | type; | 5725 | key.key_index = i | type; |
5713 | if (!(priv->ieee->sec.flags & (1 << i))) { | 5726 | if (!(priv->ieee->sec.flags & (1 << i))) { |
5714 | key->key_size = 0; | 5727 | key.key_size = 0; |
5715 | continue; | 5728 | continue; |
5716 | } | 5729 | } |
5717 | 5730 | ||
5718 | key->key_size = priv->ieee->sec.key_sizes[i]; | 5731 | key.key_size = priv->ieee->sec.key_sizes[i]; |
5719 | memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); | 5732 | memcpy(key.key, priv->ieee->sec.keys[i], key.key_size); |
5720 | 5733 | ||
5721 | ipw_send_cmd(priv, &cmd); | 5734 | ipw_send_cmd_pdu(priv, IPW_CMD_WEP_KEY, sizeof(key), &key); |
5722 | } | 5735 | } |
5723 | } | 5736 | } |
5724 | 5737 | ||
@@ -5822,9 +5835,9 @@ static void ipw_adhoc_check(void *data) | |||
5822 | static void ipw_bg_adhoc_check(void *data) | 5835 | static void ipw_bg_adhoc_check(void *data) |
5823 | { | 5836 | { |
5824 | struct ipw_priv *priv = data; | 5837 | struct ipw_priv *priv = data; |
5825 | down(&priv->sem); | 5838 | mutex_lock(&priv->mutex); |
5826 | ipw_adhoc_check(data); | 5839 | ipw_adhoc_check(data); |
5827 | up(&priv->sem); | 5840 | mutex_unlock(&priv->mutex); |
5828 | } | 5841 | } |
5829 | 5842 | ||
5830 | #ifdef CONFIG_IPW2200_DEBUG | 5843 | #ifdef CONFIG_IPW2200_DEBUG |
@@ -6051,7 +6064,7 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
6051 | (priv->status & STATUS_EXIT_PENDING)) | 6064 | (priv->status & STATUS_EXIT_PENDING)) |
6052 | return 0; | 6065 | return 0; |
6053 | 6066 | ||
6054 | down(&priv->sem); | 6067 | mutex_lock(&priv->mutex); |
6055 | 6068 | ||
6056 | if (priv->status & STATUS_SCANNING) { | 6069 | if (priv->status & STATUS_SCANNING) { |
6057 | IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); | 6070 | IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); |
@@ -6159,16 +6172,16 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
6159 | queue_delayed_work(priv->workqueue, &priv->scan_check, | 6172 | queue_delayed_work(priv->workqueue, &priv->scan_check, |
6160 | IPW_SCAN_CHECK_WATCHDOG); | 6173 | IPW_SCAN_CHECK_WATCHDOG); |
6161 | done: | 6174 | done: |
6162 | up(&priv->sem); | 6175 | mutex_unlock(&priv->mutex); |
6163 | return err; | 6176 | return err; |
6164 | } | 6177 | } |
6165 | 6178 | ||
6166 | static void ipw_bg_abort_scan(void *data) | 6179 | static void ipw_bg_abort_scan(void *data) |
6167 | { | 6180 | { |
6168 | struct ipw_priv *priv = data; | 6181 | struct ipw_priv *priv = data; |
6169 | down(&priv->sem); | 6182 | mutex_lock(&priv->mutex); |
6170 | ipw_abort_scan(data); | 6183 | ipw_abort_scan(data); |
6171 | up(&priv->sem); | 6184 | mutex_unlock(&priv->mutex); |
6172 | } | 6185 | } |
6173 | 6186 | ||
6174 | static int ipw_wpa_enable(struct ipw_priv *priv, int value) | 6187 | static int ipw_wpa_enable(struct ipw_priv *priv, int value) |
@@ -6193,6 +6206,9 @@ static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) | |||
6193 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { | 6206 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { |
6194 | sec.auth_mode = WLAN_AUTH_OPEN; | 6207 | sec.auth_mode = WLAN_AUTH_OPEN; |
6195 | ieee->open_wep = 1; | 6208 | ieee->open_wep = 1; |
6209 | } else if (value & IW_AUTH_ALG_LEAP) { | ||
6210 | sec.auth_mode = WLAN_AUTH_LEAP; | ||
6211 | ieee->open_wep = 1; | ||
6196 | } else | 6212 | } else |
6197 | return -EINVAL; | 6213 | return -EINVAL; |
6198 | 6214 | ||
@@ -6204,7 +6220,8 @@ static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) | |||
6204 | return ret; | 6220 | return ret; |
6205 | } | 6221 | } |
6206 | 6222 | ||
6207 | void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) | 6223 | static void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, |
6224 | int wpa_ie_len) | ||
6208 | { | 6225 | { |
6209 | /* make sure WPA is enabled */ | 6226 | /* make sure WPA is enabled */ |
6210 | ipw_wpa_enable(priv, 1); | 6227 | ipw_wpa_enable(priv, 1); |
@@ -6215,15 +6232,10 @@ void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) | |||
6215 | static int ipw_set_rsn_capa(struct ipw_priv *priv, | 6232 | static int ipw_set_rsn_capa(struct ipw_priv *priv, |
6216 | char *capabilities, int length) | 6233 | char *capabilities, int length) |
6217 | { | 6234 | { |
6218 | struct host_cmd cmd = { | ||
6219 | .cmd = IPW_CMD_RSN_CAPABILITIES, | ||
6220 | .len = length, | ||
6221 | }; | ||
6222 | |||
6223 | IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); | 6235 | IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); |
6224 | 6236 | ||
6225 | memcpy(cmd.param, capabilities, length); | 6237 | return ipw_send_cmd_pdu(priv, IPW_CMD_RSN_CAPABILITIES, length, |
6226 | return ipw_send_cmd(priv, &cmd); | 6238 | capabilities); |
6227 | } | 6239 | } |
6228 | 6240 | ||
6229 | /* | 6241 | /* |
@@ -6244,7 +6256,7 @@ static int ipw_wx_set_genie(struct net_device *dev, | |||
6244 | (wrqu->data.length && extra == NULL)) | 6256 | (wrqu->data.length && extra == NULL)) |
6245 | return -EINVAL; | 6257 | return -EINVAL; |
6246 | 6258 | ||
6247 | //down(&priv->sem); | 6259 | //mutex_lock(&priv->mutex); |
6248 | 6260 | ||
6249 | //if (!ieee->wpa_enabled) { | 6261 | //if (!ieee->wpa_enabled) { |
6250 | // err = -EOPNOTSUPP; | 6262 | // err = -EOPNOTSUPP; |
@@ -6270,7 +6282,7 @@ static int ipw_wx_set_genie(struct net_device *dev, | |||
6270 | 6282 | ||
6271 | ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); | 6283 | ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); |
6272 | out: | 6284 | out: |
6273 | //up(&priv->sem); | 6285 | //mutex_unlock(&priv->mutex); |
6274 | return err; | 6286 | return err; |
6275 | } | 6287 | } |
6276 | 6288 | ||
@@ -6283,7 +6295,7 @@ static int ipw_wx_get_genie(struct net_device *dev, | |||
6283 | struct ieee80211_device *ieee = priv->ieee; | 6295 | struct ieee80211_device *ieee = priv->ieee; |
6284 | int err = 0; | 6296 | int err = 0; |
6285 | 6297 | ||
6286 | //down(&priv->sem); | 6298 | //mutex_lock(&priv->mutex); |
6287 | 6299 | ||
6288 | //if (!ieee->wpa_enabled) { | 6300 | //if (!ieee->wpa_enabled) { |
6289 | // err = -EOPNOTSUPP; | 6301 | // err = -EOPNOTSUPP; |
@@ -6304,7 +6316,7 @@ static int ipw_wx_get_genie(struct net_device *dev, | |||
6304 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); | 6316 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); |
6305 | 6317 | ||
6306 | out: | 6318 | out: |
6307 | //up(&priv->sem); | 6319 | //mutex_unlock(&priv->mutex); |
6308 | return err; | 6320 | return err; |
6309 | } | 6321 | } |
6310 | 6322 | ||
@@ -6964,12 +6976,12 @@ static void ipw_bg_qos_activate(void *data) | |||
6964 | if (priv == NULL) | 6976 | if (priv == NULL) |
6965 | return; | 6977 | return; |
6966 | 6978 | ||
6967 | down(&priv->sem); | 6979 | mutex_lock(&priv->mutex); |
6968 | 6980 | ||
6969 | if (priv->status & STATUS_ASSOCIATED) | 6981 | if (priv->status & STATUS_ASSOCIATED) |
6970 | ipw_qos_activate(priv, &(priv->assoc_network->qos_data)); | 6982 | ipw_qos_activate(priv, &(priv->assoc_network->qos_data)); |
6971 | 6983 | ||
6972 | up(&priv->sem); | 6984 | mutex_unlock(&priv->mutex); |
6973 | } | 6985 | } |
6974 | 6986 | ||
6975 | static int ipw_handle_probe_response(struct net_device *dev, | 6987 | static int ipw_handle_probe_response(struct net_device *dev, |
@@ -7010,25 +7022,15 @@ static int ipw_handle_assoc_response(struct net_device *dev, | |||
7010 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters | 7022 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters |
7011 | *qos_param) | 7023 | *qos_param) |
7012 | { | 7024 | { |
7013 | struct host_cmd cmd = { | 7025 | return ipw_send_cmd_pdu(priv, IPW_CMD_QOS_PARAMETERS, |
7014 | .cmd = IPW_CMD_QOS_PARAMETERS, | 7026 | sizeof(*qos_param) * 3, qos_param); |
7015 | .len = (sizeof(struct ieee80211_qos_parameters) * 3) | ||
7016 | }; | ||
7017 | |||
7018 | memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3); | ||
7019 | return ipw_send_cmd(priv, &cmd); | ||
7020 | } | 7027 | } |
7021 | 7028 | ||
7022 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element | 7029 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element |
7023 | *qos_param) | 7030 | *qos_param) |
7024 | { | 7031 | { |
7025 | struct host_cmd cmd = { | 7032 | return ipw_send_cmd_pdu(priv, IPW_CMD_WME_INFO, sizeof(*qos_param), |
7026 | .cmd = IPW_CMD_WME_INFO, | 7033 | qos_param); |
7027 | .len = sizeof(*qos_param) | ||
7028 | }; | ||
7029 | |||
7030 | memcpy(cmd.param, qos_param, sizeof(*qos_param)); | ||
7031 | return ipw_send_cmd(priv, &cmd); | ||
7032 | } | 7034 | } |
7033 | 7035 | ||
7034 | #endif /* CONFIG_IPW_QOS */ | 7036 | #endif /* CONFIG_IPW_QOS */ |
@@ -7052,19 +7054,22 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
7052 | 7054 | ||
7053 | memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); | 7055 | memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); |
7054 | priv->assoc_request.channel = network->channel; | 7056 | priv->assoc_request.channel = network->channel; |
7057 | priv->assoc_request.auth_key = 0; | ||
7058 | |||
7055 | if ((priv->capability & CAP_PRIVACY_ON) && | 7059 | if ((priv->capability & CAP_PRIVACY_ON) && |
7056 | (priv->capability & CAP_SHARED_KEY)) { | 7060 | (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) { |
7057 | priv->assoc_request.auth_type = AUTH_SHARED_KEY; | 7061 | priv->assoc_request.auth_type = AUTH_SHARED_KEY; |
7058 | priv->assoc_request.auth_key = priv->ieee->sec.active_key; | 7062 | priv->assoc_request.auth_key = priv->ieee->sec.active_key; |
7059 | 7063 | ||
7060 | if ((priv->capability & CAP_PRIVACY_ON) && | 7064 | if ((priv->ieee->sec.level == SEC_LEVEL_1) && |
7061 | (priv->ieee->sec.level == SEC_LEVEL_1) && | ||
7062 | !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) | 7065 | !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) |
7063 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); | 7066 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); |
7064 | } else { | 7067 | |
7068 | } else if ((priv->capability & CAP_PRIVACY_ON) && | ||
7069 | (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP)) | ||
7070 | priv->assoc_request.auth_type = AUTH_LEAP; | ||
7071 | else | ||
7065 | priv->assoc_request.auth_type = AUTH_OPEN; | 7072 | priv->assoc_request.auth_type = AUTH_OPEN; |
7066 | priv->assoc_request.auth_key = 0; | ||
7067 | } | ||
7068 | 7073 | ||
7069 | if (priv->ieee->wpa_ie_len) { | 7074 | if (priv->ieee->wpa_ie_len) { |
7070 | priv->assoc_request.policy_support = 0x02; /* RSN active */ | 7075 | priv->assoc_request.policy_support = 0x02; /* RSN active */ |
@@ -7278,9 +7283,9 @@ static void ipw_roam(void *data) | |||
7278 | static void ipw_bg_roam(void *data) | 7283 | static void ipw_bg_roam(void *data) |
7279 | { | 7284 | { |
7280 | struct ipw_priv *priv = data; | 7285 | struct ipw_priv *priv = data; |
7281 | down(&priv->sem); | 7286 | mutex_lock(&priv->mutex); |
7282 | ipw_roam(data); | 7287 | ipw_roam(data); |
7283 | up(&priv->sem); | 7288 | mutex_unlock(&priv->mutex); |
7284 | } | 7289 | } |
7285 | 7290 | ||
7286 | static int ipw_associate(void *data) | 7291 | static int ipw_associate(void *data) |
@@ -7375,9 +7380,9 @@ static int ipw_associate(void *data) | |||
7375 | static void ipw_bg_associate(void *data) | 7380 | static void ipw_bg_associate(void *data) |
7376 | { | 7381 | { |
7377 | struct ipw_priv *priv = data; | 7382 | struct ipw_priv *priv = data; |
7378 | down(&priv->sem); | 7383 | mutex_lock(&priv->mutex); |
7379 | ipw_associate(data); | 7384 | ipw_associate(data); |
7380 | up(&priv->sem); | 7385 | mutex_unlock(&priv->mutex); |
7381 | } | 7386 | } |
7382 | 7387 | ||
7383 | static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, | 7388 | static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, |
@@ -8126,7 +8131,7 @@ static int ipw_wx_get_name(struct net_device *dev, | |||
8126 | union iwreq_data *wrqu, char *extra) | 8131 | union iwreq_data *wrqu, char *extra) |
8127 | { | 8132 | { |
8128 | struct ipw_priv *priv = ieee80211_priv(dev); | 8133 | struct ipw_priv *priv = ieee80211_priv(dev); |
8129 | down(&priv->sem); | 8134 | mutex_lock(&priv->mutex); |
8130 | if (priv->status & STATUS_RF_KILL_MASK) | 8135 | if (priv->status & STATUS_RF_KILL_MASK) |
8131 | strcpy(wrqu->name, "radio off"); | 8136 | strcpy(wrqu->name, "radio off"); |
8132 | else if (!(priv->status & STATUS_ASSOCIATED)) | 8137 | else if (!(priv->status & STATUS_ASSOCIATED)) |
@@ -8135,7 +8140,7 @@ static int ipw_wx_get_name(struct net_device *dev, | |||
8135 | snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", | 8140 | snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", |
8136 | ipw_modes[priv->assoc_request.ieee_mode]); | 8141 | ipw_modes[priv->assoc_request.ieee_mode]); |
8137 | IPW_DEBUG_WX("Name: %s\n", wrqu->name); | 8142 | IPW_DEBUG_WX("Name: %s\n", wrqu->name); |
8138 | up(&priv->sem); | 8143 | mutex_unlock(&priv->mutex); |
8139 | return 0; | 8144 | return 0; |
8140 | } | 8145 | } |
8141 | 8146 | ||
@@ -8204,9 +8209,9 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
8204 | 8209 | ||
8205 | if (fwrq->m == 0) { | 8210 | if (fwrq->m == 0) { |
8206 | IPW_DEBUG_WX("SET Freq/Channel -> any\n"); | 8211 | IPW_DEBUG_WX("SET Freq/Channel -> any\n"); |
8207 | down(&priv->sem); | 8212 | mutex_lock(&priv->mutex); |
8208 | ret = ipw_set_channel(priv, 0); | 8213 | ret = ipw_set_channel(priv, 0); |
8209 | up(&priv->sem); | 8214 | mutex_unlock(&priv->mutex); |
8210 | return ret; | 8215 | return ret; |
8211 | } | 8216 | } |
8212 | /* if setting by freq convert to channel */ | 8217 | /* if setting by freq convert to channel */ |
@@ -8234,9 +8239,9 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
8234 | } | 8239 | } |
8235 | 8240 | ||
8236 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); | 8241 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); |
8237 | down(&priv->sem); | 8242 | mutex_lock(&priv->mutex); |
8238 | ret = ipw_set_channel(priv, channel); | 8243 | ret = ipw_set_channel(priv, channel); |
8239 | up(&priv->sem); | 8244 | mutex_unlock(&priv->mutex); |
8240 | return ret; | 8245 | return ret; |
8241 | } | 8246 | } |
8242 | 8247 | ||
@@ -8250,14 +8255,14 @@ static int ipw_wx_get_freq(struct net_device *dev, | |||
8250 | 8255 | ||
8251 | /* If we are associated, trying to associate, or have a statically | 8256 | /* If we are associated, trying to associate, or have a statically |
8252 | * configured CHANNEL then return that; otherwise return ANY */ | 8257 | * configured CHANNEL then return that; otherwise return ANY */ |
8253 | down(&priv->sem); | 8258 | mutex_lock(&priv->mutex); |
8254 | if (priv->config & CFG_STATIC_CHANNEL || | 8259 | if (priv->config & CFG_STATIC_CHANNEL || |
8255 | priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) | 8260 | priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) |
8256 | wrqu->freq.m = priv->channel; | 8261 | wrqu->freq.m = priv->channel; |
8257 | else | 8262 | else |
8258 | wrqu->freq.m = 0; | 8263 | wrqu->freq.m = 0; |
8259 | 8264 | ||
8260 | up(&priv->sem); | 8265 | mutex_unlock(&priv->mutex); |
8261 | IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); | 8266 | IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); |
8262 | return 0; | 8267 | return 0; |
8263 | } | 8268 | } |
@@ -8287,7 +8292,7 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
8287 | if (wrqu->mode == priv->ieee->iw_mode) | 8292 | if (wrqu->mode == priv->ieee->iw_mode) |
8288 | return 0; | 8293 | return 0; |
8289 | 8294 | ||
8290 | down(&priv->sem); | 8295 | mutex_lock(&priv->mutex); |
8291 | 8296 | ||
8292 | ipw_sw_reset(priv, 0); | 8297 | ipw_sw_reset(priv, 0); |
8293 | 8298 | ||
@@ -8310,7 +8315,7 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
8310 | priv->ieee->iw_mode = wrqu->mode; | 8315 | priv->ieee->iw_mode = wrqu->mode; |
8311 | 8316 | ||
8312 | queue_work(priv->workqueue, &priv->adapter_restart); | 8317 | queue_work(priv->workqueue, &priv->adapter_restart); |
8313 | up(&priv->sem); | 8318 | mutex_unlock(&priv->mutex); |
8314 | return err; | 8319 | return err; |
8315 | } | 8320 | } |
8316 | 8321 | ||
@@ -8319,10 +8324,10 @@ static int ipw_wx_get_mode(struct net_device *dev, | |||
8319 | union iwreq_data *wrqu, char *extra) | 8324 | union iwreq_data *wrqu, char *extra) |
8320 | { | 8325 | { |
8321 | struct ipw_priv *priv = ieee80211_priv(dev); | 8326 | struct ipw_priv *priv = ieee80211_priv(dev); |
8322 | down(&priv->sem); | 8327 | mutex_lock(&priv->mutex); |
8323 | wrqu->mode = priv->ieee->iw_mode; | 8328 | wrqu->mode = priv->ieee->iw_mode; |
8324 | IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); | 8329 | IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); |
8325 | up(&priv->sem); | 8330 | mutex_unlock(&priv->mutex); |
8326 | return 0; | 8331 | return 0; |
8327 | } | 8332 | } |
8328 | 8333 | ||
@@ -8369,7 +8374,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
8369 | range->avg_qual.level = 0; /* FIXME to real average level */ | 8374 | range->avg_qual.level = 0; /* FIXME to real average level */ |
8370 | range->avg_qual.noise = 0; | 8375 | range->avg_qual.noise = 0; |
8371 | range->avg_qual.updated = 7; /* Updated all three */ | 8376 | range->avg_qual.updated = 7; /* Updated all three */ |
8372 | down(&priv->sem); | 8377 | mutex_lock(&priv->mutex); |
8373 | range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); | 8378 | range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); |
8374 | 8379 | ||
8375 | for (i = 0; i < range->num_bitrates; i++) | 8380 | for (i = 0; i < range->num_bitrates; i++) |
@@ -8387,7 +8392,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
8387 | 8392 | ||
8388 | /* Set the Wireless Extension versions */ | 8393 | /* Set the Wireless Extension versions */ |
8389 | range->we_version_compiled = WIRELESS_EXT; | 8394 | range->we_version_compiled = WIRELESS_EXT; |
8390 | range->we_version_source = 16; | 8395 | range->we_version_source = 18; |
8391 | 8396 | ||
8392 | i = 0; | 8397 | i = 0; |
8393 | if (priv->ieee->mode & (IEEE_B | IEEE_G)) { | 8398 | if (priv->ieee->mode & (IEEE_B | IEEE_G)) { |
@@ -8411,7 +8416,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
8411 | range->num_channels = i; | 8416 | range->num_channels = i; |
8412 | range->num_frequency = i; | 8417 | range->num_frequency = i; |
8413 | 8418 | ||
8414 | up(&priv->sem); | 8419 | mutex_unlock(&priv->mutex); |
8415 | 8420 | ||
8416 | /* Event capability (kernel + driver) */ | 8421 | /* Event capability (kernel + driver) */ |
8417 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | | 8422 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
@@ -8419,6 +8424,9 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
8419 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); | 8424 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); |
8420 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | 8425 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
8421 | 8426 | ||
8427 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | | ||
8428 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; | ||
8429 | |||
8422 | IPW_DEBUG_WX("GET Range\n"); | 8430 | IPW_DEBUG_WX("GET Range\n"); |
8423 | return 0; | 8431 | return 0; |
8424 | } | 8432 | } |
@@ -8438,7 +8446,7 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
8438 | 8446 | ||
8439 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) | 8447 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) |
8440 | return -EINVAL; | 8448 | return -EINVAL; |
8441 | down(&priv->sem); | 8449 | mutex_lock(&priv->mutex); |
8442 | if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || | 8450 | if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || |
8443 | !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { | 8451 | !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { |
8444 | /* we disable mandatory BSSID association */ | 8452 | /* we disable mandatory BSSID association */ |
@@ -8447,14 +8455,14 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
8447 | IPW_DEBUG_ASSOC("Attempting to associate with new " | 8455 | IPW_DEBUG_ASSOC("Attempting to associate with new " |
8448 | "parameters.\n"); | 8456 | "parameters.\n"); |
8449 | ipw_associate(priv); | 8457 | ipw_associate(priv); |
8450 | up(&priv->sem); | 8458 | mutex_unlock(&priv->mutex); |
8451 | return 0; | 8459 | return 0; |
8452 | } | 8460 | } |
8453 | 8461 | ||
8454 | priv->config |= CFG_STATIC_BSSID; | 8462 | priv->config |= CFG_STATIC_BSSID; |
8455 | if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { | 8463 | if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { |
8456 | IPW_DEBUG_WX("BSSID set to current BSSID.\n"); | 8464 | IPW_DEBUG_WX("BSSID set to current BSSID.\n"); |
8457 | up(&priv->sem); | 8465 | mutex_unlock(&priv->mutex); |
8458 | return 0; | 8466 | return 0; |
8459 | } | 8467 | } |
8460 | 8468 | ||
@@ -8468,7 +8476,7 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
8468 | if (!ipw_disassociate(priv)) | 8476 | if (!ipw_disassociate(priv)) |
8469 | ipw_associate(priv); | 8477 | ipw_associate(priv); |
8470 | 8478 | ||
8471 | up(&priv->sem); | 8479 | mutex_unlock(&priv->mutex); |
8472 | return 0; | 8480 | return 0; |
8473 | } | 8481 | } |
8474 | 8482 | ||
@@ -8479,7 +8487,7 @@ static int ipw_wx_get_wap(struct net_device *dev, | |||
8479 | struct ipw_priv *priv = ieee80211_priv(dev); | 8487 | struct ipw_priv *priv = ieee80211_priv(dev); |
8480 | /* If we are associated, trying to associate, or have a statically | 8488 | /* If we are associated, trying to associate, or have a statically |
8481 | * configured BSSID then return that; otherwise return ANY */ | 8489 | * configured BSSID then return that; otherwise return ANY */ |
8482 | down(&priv->sem); | 8490 | mutex_lock(&priv->mutex); |
8483 | if (priv->config & CFG_STATIC_BSSID || | 8491 | if (priv->config & CFG_STATIC_BSSID || |
8484 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8492 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { |
8485 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; | 8493 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; |
@@ -8489,7 +8497,7 @@ static int ipw_wx_get_wap(struct net_device *dev, | |||
8489 | 8497 | ||
8490 | IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", | 8498 | IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", |
8491 | MAC_ARG(wrqu->ap_addr.sa_data)); | 8499 | MAC_ARG(wrqu->ap_addr.sa_data)); |
8492 | up(&priv->sem); | 8500 | mutex_unlock(&priv->mutex); |
8493 | return 0; | 8501 | return 0; |
8494 | } | 8502 | } |
8495 | 8503 | ||
@@ -8500,7 +8508,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
8500 | struct ipw_priv *priv = ieee80211_priv(dev); | 8508 | struct ipw_priv *priv = ieee80211_priv(dev); |
8501 | char *essid = ""; /* ANY */ | 8509 | char *essid = ""; /* ANY */ |
8502 | int length = 0; | 8510 | int length = 0; |
8503 | down(&priv->sem); | 8511 | mutex_lock(&priv->mutex); |
8504 | if (wrqu->essid.flags && wrqu->essid.length) { | 8512 | if (wrqu->essid.flags && wrqu->essid.length) { |
8505 | length = wrqu->essid.length - 1; | 8513 | length = wrqu->essid.length - 1; |
8506 | essid = extra; | 8514 | essid = extra; |
@@ -8515,7 +8523,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
8515 | priv->config &= ~CFG_STATIC_ESSID; | 8523 | priv->config &= ~CFG_STATIC_ESSID; |
8516 | ipw_associate(priv); | 8524 | ipw_associate(priv); |
8517 | } | 8525 | } |
8518 | up(&priv->sem); | 8526 | mutex_unlock(&priv->mutex); |
8519 | return 0; | 8527 | return 0; |
8520 | } | 8528 | } |
8521 | 8529 | ||
@@ -8525,7 +8533,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
8525 | 8533 | ||
8526 | if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { | 8534 | if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { |
8527 | IPW_DEBUG_WX("ESSID set to current ESSID.\n"); | 8535 | IPW_DEBUG_WX("ESSID set to current ESSID.\n"); |
8528 | up(&priv->sem); | 8536 | mutex_unlock(&priv->mutex); |
8529 | return 0; | 8537 | return 0; |
8530 | } | 8538 | } |
8531 | 8539 | ||
@@ -8540,7 +8548,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
8540 | if (!ipw_disassociate(priv)) | 8548 | if (!ipw_disassociate(priv)) |
8541 | ipw_associate(priv); | 8549 | ipw_associate(priv); |
8542 | 8550 | ||
8543 | up(&priv->sem); | 8551 | mutex_unlock(&priv->mutex); |
8544 | return 0; | 8552 | return 0; |
8545 | } | 8553 | } |
8546 | 8554 | ||
@@ -8552,7 +8560,7 @@ static int ipw_wx_get_essid(struct net_device *dev, | |||
8552 | 8560 | ||
8553 | /* If we are associated, trying to associate, or have a statically | 8561 | /* If we are associated, trying to associate, or have a statically |
8554 | * configured ESSID then return that; otherwise return ANY */ | 8562 | * configured ESSID then return that; otherwise return ANY */ |
8555 | down(&priv->sem); | 8563 | mutex_lock(&priv->mutex); |
8556 | if (priv->config & CFG_STATIC_ESSID || | 8564 | if (priv->config & CFG_STATIC_ESSID || |
8557 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8565 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { |
8558 | IPW_DEBUG_WX("Getting essid: '%s'\n", | 8566 | IPW_DEBUG_WX("Getting essid: '%s'\n", |
@@ -8565,7 +8573,7 @@ static int ipw_wx_get_essid(struct net_device *dev, | |||
8565 | wrqu->essid.length = 0; | 8573 | wrqu->essid.length = 0; |
8566 | wrqu->essid.flags = 0; /* active */ | 8574 | wrqu->essid.flags = 0; /* active */ |
8567 | } | 8575 | } |
8568 | up(&priv->sem); | 8576 | mutex_unlock(&priv->mutex); |
8569 | return 0; | 8577 | return 0; |
8570 | } | 8578 | } |
8571 | 8579 | ||
@@ -8578,12 +8586,12 @@ static int ipw_wx_set_nick(struct net_device *dev, | |||
8578 | IPW_DEBUG_WX("Setting nick to '%s'\n", extra); | 8586 | IPW_DEBUG_WX("Setting nick to '%s'\n", extra); |
8579 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) | 8587 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) |
8580 | return -E2BIG; | 8588 | return -E2BIG; |
8581 | down(&priv->sem); | 8589 | mutex_lock(&priv->mutex); |
8582 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); | 8590 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); |
8583 | memset(priv->nick, 0, sizeof(priv->nick)); | 8591 | memset(priv->nick, 0, sizeof(priv->nick)); |
8584 | memcpy(priv->nick, extra, wrqu->data.length); | 8592 | memcpy(priv->nick, extra, wrqu->data.length); |
8585 | IPW_DEBUG_TRACE("<<\n"); | 8593 | IPW_DEBUG_TRACE("<<\n"); |
8586 | up(&priv->sem); | 8594 | mutex_unlock(&priv->mutex); |
8587 | return 0; | 8595 | return 0; |
8588 | 8596 | ||
8589 | } | 8597 | } |
@@ -8594,11 +8602,11 @@ static int ipw_wx_get_nick(struct net_device *dev, | |||
8594 | { | 8602 | { |
8595 | struct ipw_priv *priv = ieee80211_priv(dev); | 8603 | struct ipw_priv *priv = ieee80211_priv(dev); |
8596 | IPW_DEBUG_WX("Getting nick\n"); | 8604 | IPW_DEBUG_WX("Getting nick\n"); |
8597 | down(&priv->sem); | 8605 | mutex_lock(&priv->mutex); |
8598 | wrqu->data.length = strlen(priv->nick) + 1; | 8606 | wrqu->data.length = strlen(priv->nick) + 1; |
8599 | memcpy(extra, priv->nick, wrqu->data.length); | 8607 | memcpy(extra, priv->nick, wrqu->data.length); |
8600 | wrqu->data.flags = 1; /* active */ | 8608 | wrqu->data.flags = 1; /* active */ |
8601 | up(&priv->sem); | 8609 | mutex_unlock(&priv->mutex); |
8602 | return 0; | 8610 | return 0; |
8603 | } | 8611 | } |
8604 | 8612 | ||
@@ -8691,7 +8699,7 @@ static int ipw_wx_set_rate(struct net_device *dev, | |||
8691 | apply: | 8699 | apply: |
8692 | IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", | 8700 | IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", |
8693 | mask, fixed ? "fixed" : "sub-rates"); | 8701 | mask, fixed ? "fixed" : "sub-rates"); |
8694 | down(&priv->sem); | 8702 | mutex_lock(&priv->mutex); |
8695 | if (mask == IEEE80211_DEFAULT_RATES_MASK) { | 8703 | if (mask == IEEE80211_DEFAULT_RATES_MASK) { |
8696 | priv->config &= ~CFG_FIXED_RATE; | 8704 | priv->config &= ~CFG_FIXED_RATE; |
8697 | ipw_set_fixed_rate(priv, priv->ieee->mode); | 8705 | ipw_set_fixed_rate(priv, priv->ieee->mode); |
@@ -8700,7 +8708,7 @@ static int ipw_wx_set_rate(struct net_device *dev, | |||
8700 | 8708 | ||
8701 | if (priv->rates_mask == mask) { | 8709 | if (priv->rates_mask == mask) { |
8702 | IPW_DEBUG_WX("Mask set to current mask.\n"); | 8710 | IPW_DEBUG_WX("Mask set to current mask.\n"); |
8703 | up(&priv->sem); | 8711 | mutex_unlock(&priv->mutex); |
8704 | return 0; | 8712 | return 0; |
8705 | } | 8713 | } |
8706 | 8714 | ||
@@ -8711,7 +8719,7 @@ static int ipw_wx_set_rate(struct net_device *dev, | |||
8711 | if (!ipw_disassociate(priv)) | 8719 | if (!ipw_disassociate(priv)) |
8712 | ipw_associate(priv); | 8720 | ipw_associate(priv); |
8713 | 8721 | ||
8714 | up(&priv->sem); | 8722 | mutex_unlock(&priv->mutex); |
8715 | return 0; | 8723 | return 0; |
8716 | } | 8724 | } |
8717 | 8725 | ||
@@ -8720,9 +8728,9 @@ static int ipw_wx_get_rate(struct net_device *dev, | |||
8720 | union iwreq_data *wrqu, char *extra) | 8728 | union iwreq_data *wrqu, char *extra) |
8721 | { | 8729 | { |
8722 | struct ipw_priv *priv = ieee80211_priv(dev); | 8730 | struct ipw_priv *priv = ieee80211_priv(dev); |
8723 | down(&priv->sem); | 8731 | mutex_lock(&priv->mutex); |
8724 | wrqu->bitrate.value = priv->last_rate; | 8732 | wrqu->bitrate.value = priv->last_rate; |
8725 | up(&priv->sem); | 8733 | mutex_unlock(&priv->mutex); |
8726 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); | 8734 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); |
8727 | return 0; | 8735 | return 0; |
8728 | } | 8736 | } |
@@ -8732,20 +8740,20 @@ static int ipw_wx_set_rts(struct net_device *dev, | |||
8732 | union iwreq_data *wrqu, char *extra) | 8740 | union iwreq_data *wrqu, char *extra) |
8733 | { | 8741 | { |
8734 | struct ipw_priv *priv = ieee80211_priv(dev); | 8742 | struct ipw_priv *priv = ieee80211_priv(dev); |
8735 | down(&priv->sem); | 8743 | mutex_lock(&priv->mutex); |
8736 | if (wrqu->rts.disabled) | 8744 | if (wrqu->rts.disabled) |
8737 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; | 8745 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; |
8738 | else { | 8746 | else { |
8739 | if (wrqu->rts.value < MIN_RTS_THRESHOLD || | 8747 | if (wrqu->rts.value < MIN_RTS_THRESHOLD || |
8740 | wrqu->rts.value > MAX_RTS_THRESHOLD) { | 8748 | wrqu->rts.value > MAX_RTS_THRESHOLD) { |
8741 | up(&priv->sem); | 8749 | mutex_unlock(&priv->mutex); |
8742 | return -EINVAL; | 8750 | return -EINVAL; |
8743 | } | 8751 | } |
8744 | priv->rts_threshold = wrqu->rts.value; | 8752 | priv->rts_threshold = wrqu->rts.value; |
8745 | } | 8753 | } |
8746 | 8754 | ||
8747 | ipw_send_rts_threshold(priv, priv->rts_threshold); | 8755 | ipw_send_rts_threshold(priv, priv->rts_threshold); |
8748 | up(&priv->sem); | 8756 | mutex_unlock(&priv->mutex); |
8749 | IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); | 8757 | IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); |
8750 | return 0; | 8758 | return 0; |
8751 | } | 8759 | } |
@@ -8755,11 +8763,11 @@ static int ipw_wx_get_rts(struct net_device *dev, | |||
8755 | union iwreq_data *wrqu, char *extra) | 8763 | union iwreq_data *wrqu, char *extra) |
8756 | { | 8764 | { |
8757 | struct ipw_priv *priv = ieee80211_priv(dev); | 8765 | struct ipw_priv *priv = ieee80211_priv(dev); |
8758 | down(&priv->sem); | 8766 | mutex_lock(&priv->mutex); |
8759 | wrqu->rts.value = priv->rts_threshold; | 8767 | wrqu->rts.value = priv->rts_threshold; |
8760 | wrqu->rts.fixed = 0; /* no auto select */ | 8768 | wrqu->rts.fixed = 0; /* no auto select */ |
8761 | wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); | 8769 | wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); |
8762 | up(&priv->sem); | 8770 | mutex_unlock(&priv->mutex); |
8763 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); | 8771 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); |
8764 | return 0; | 8772 | return 0; |
8765 | } | 8773 | } |
@@ -8771,7 +8779,7 @@ static int ipw_wx_set_txpow(struct net_device *dev, | |||
8771 | struct ipw_priv *priv = ieee80211_priv(dev); | 8779 | struct ipw_priv *priv = ieee80211_priv(dev); |
8772 | int err = 0; | 8780 | int err = 0; |
8773 | 8781 | ||
8774 | down(&priv->sem); | 8782 | mutex_lock(&priv->mutex); |
8775 | if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { | 8783 | if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { |
8776 | err = -EINPROGRESS; | 8784 | err = -EINPROGRESS; |
8777 | goto out; | 8785 | goto out; |
@@ -8794,7 +8802,7 @@ static int ipw_wx_set_txpow(struct net_device *dev, | |||
8794 | priv->tx_power = wrqu->power.value; | 8802 | priv->tx_power = wrqu->power.value; |
8795 | err = ipw_set_tx_power(priv); | 8803 | err = ipw_set_tx_power(priv); |
8796 | out: | 8804 | out: |
8797 | up(&priv->sem); | 8805 | mutex_unlock(&priv->mutex); |
8798 | return err; | 8806 | return err; |
8799 | } | 8807 | } |
8800 | 8808 | ||
@@ -8803,12 +8811,12 @@ static int ipw_wx_get_txpow(struct net_device *dev, | |||
8803 | union iwreq_data *wrqu, char *extra) | 8811 | union iwreq_data *wrqu, char *extra) |
8804 | { | 8812 | { |
8805 | struct ipw_priv *priv = ieee80211_priv(dev); | 8813 | struct ipw_priv *priv = ieee80211_priv(dev); |
8806 | down(&priv->sem); | 8814 | mutex_lock(&priv->mutex); |
8807 | wrqu->power.value = priv->tx_power; | 8815 | wrqu->power.value = priv->tx_power; |
8808 | wrqu->power.fixed = 1; | 8816 | wrqu->power.fixed = 1; |
8809 | wrqu->power.flags = IW_TXPOW_DBM; | 8817 | wrqu->power.flags = IW_TXPOW_DBM; |
8810 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; | 8818 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; |
8811 | up(&priv->sem); | 8819 | mutex_unlock(&priv->mutex); |
8812 | 8820 | ||
8813 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", | 8821 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", |
8814 | wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); | 8822 | wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); |
@@ -8821,13 +8829,13 @@ static int ipw_wx_set_frag(struct net_device *dev, | |||
8821 | union iwreq_data *wrqu, char *extra) | 8829 | union iwreq_data *wrqu, char *extra) |
8822 | { | 8830 | { |
8823 | struct ipw_priv *priv = ieee80211_priv(dev); | 8831 | struct ipw_priv *priv = ieee80211_priv(dev); |
8824 | down(&priv->sem); | 8832 | mutex_lock(&priv->mutex); |
8825 | if (wrqu->frag.disabled) | 8833 | if (wrqu->frag.disabled) |
8826 | priv->ieee->fts = DEFAULT_FTS; | 8834 | priv->ieee->fts = DEFAULT_FTS; |
8827 | else { | 8835 | else { |
8828 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || | 8836 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || |
8829 | wrqu->frag.value > MAX_FRAG_THRESHOLD) { | 8837 | wrqu->frag.value > MAX_FRAG_THRESHOLD) { |
8830 | up(&priv->sem); | 8838 | mutex_unlock(&priv->mutex); |
8831 | return -EINVAL; | 8839 | return -EINVAL; |
8832 | } | 8840 | } |
8833 | 8841 | ||
@@ -8835,7 +8843,7 @@ static int ipw_wx_set_frag(struct net_device *dev, | |||
8835 | } | 8843 | } |
8836 | 8844 | ||
8837 | ipw_send_frag_threshold(priv, wrqu->frag.value); | 8845 | ipw_send_frag_threshold(priv, wrqu->frag.value); |
8838 | up(&priv->sem); | 8846 | mutex_unlock(&priv->mutex); |
8839 | IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); | 8847 | IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); |
8840 | return 0; | 8848 | return 0; |
8841 | } | 8849 | } |
@@ -8845,11 +8853,11 @@ static int ipw_wx_get_frag(struct net_device *dev, | |||
8845 | union iwreq_data *wrqu, char *extra) | 8853 | union iwreq_data *wrqu, char *extra) |
8846 | { | 8854 | { |
8847 | struct ipw_priv *priv = ieee80211_priv(dev); | 8855 | struct ipw_priv *priv = ieee80211_priv(dev); |
8848 | down(&priv->sem); | 8856 | mutex_lock(&priv->mutex); |
8849 | wrqu->frag.value = priv->ieee->fts; | 8857 | wrqu->frag.value = priv->ieee->fts; |
8850 | wrqu->frag.fixed = 0; /* no auto select */ | 8858 | wrqu->frag.fixed = 0; /* no auto select */ |
8851 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); | 8859 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); |
8852 | up(&priv->sem); | 8860 | mutex_unlock(&priv->mutex); |
8853 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); | 8861 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); |
8854 | 8862 | ||
8855 | return 0; | 8863 | return 0; |
@@ -8870,7 +8878,7 @@ static int ipw_wx_set_retry(struct net_device *dev, | |||
8870 | if (wrqu->retry.value < 0 || wrqu->retry.value > 255) | 8878 | if (wrqu->retry.value < 0 || wrqu->retry.value > 255) |
8871 | return -EINVAL; | 8879 | return -EINVAL; |
8872 | 8880 | ||
8873 | down(&priv->sem); | 8881 | mutex_lock(&priv->mutex); |
8874 | if (wrqu->retry.flags & IW_RETRY_MIN) | 8882 | if (wrqu->retry.flags & IW_RETRY_MIN) |
8875 | priv->short_retry_limit = (u8) wrqu->retry.value; | 8883 | priv->short_retry_limit = (u8) wrqu->retry.value; |
8876 | else if (wrqu->retry.flags & IW_RETRY_MAX) | 8884 | else if (wrqu->retry.flags & IW_RETRY_MAX) |
@@ -8882,7 +8890,7 @@ static int ipw_wx_set_retry(struct net_device *dev, | |||
8882 | 8890 | ||
8883 | ipw_send_retry_limit(priv, priv->short_retry_limit, | 8891 | ipw_send_retry_limit(priv, priv->short_retry_limit, |
8884 | priv->long_retry_limit); | 8892 | priv->long_retry_limit); |
8885 | up(&priv->sem); | 8893 | mutex_unlock(&priv->mutex); |
8886 | IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n", | 8894 | IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n", |
8887 | priv->short_retry_limit, priv->long_retry_limit); | 8895 | priv->short_retry_limit, priv->long_retry_limit); |
8888 | return 0; | 8896 | return 0; |
@@ -8894,11 +8902,11 @@ static int ipw_wx_get_retry(struct net_device *dev, | |||
8894 | { | 8902 | { |
8895 | struct ipw_priv *priv = ieee80211_priv(dev); | 8903 | struct ipw_priv *priv = ieee80211_priv(dev); |
8896 | 8904 | ||
8897 | down(&priv->sem); | 8905 | mutex_lock(&priv->mutex); |
8898 | wrqu->retry.disabled = 0; | 8906 | wrqu->retry.disabled = 0; |
8899 | 8907 | ||
8900 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { | 8908 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { |
8901 | up(&priv->sem); | 8909 | mutex_unlock(&priv->mutex); |
8902 | return -EINVAL; | 8910 | return -EINVAL; |
8903 | } | 8911 | } |
8904 | 8912 | ||
@@ -8912,7 +8920,7 @@ static int ipw_wx_get_retry(struct net_device *dev, | |||
8912 | wrqu->retry.flags = IW_RETRY_LIMIT; | 8920 | wrqu->retry.flags = IW_RETRY_LIMIT; |
8913 | wrqu->retry.value = priv->short_retry_limit; | 8921 | wrqu->retry.value = priv->short_retry_limit; |
8914 | } | 8922 | } |
8915 | up(&priv->sem); | 8923 | mutex_unlock(&priv->mutex); |
8916 | 8924 | ||
8917 | IPW_DEBUG_WX("GET retry -> %d \n", wrqu->retry.value); | 8925 | IPW_DEBUG_WX("GET retry -> %d \n", wrqu->retry.value); |
8918 | 8926 | ||
@@ -8929,7 +8937,7 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, | |||
8929 | (priv->status & STATUS_EXIT_PENDING)) | 8937 | (priv->status & STATUS_EXIT_PENDING)) |
8930 | return 0; | 8938 | return 0; |
8931 | 8939 | ||
8932 | down(&priv->sem); | 8940 | mutex_lock(&priv->mutex); |
8933 | 8941 | ||
8934 | if (priv->status & STATUS_RF_KILL_MASK) { | 8942 | if (priv->status & STATUS_RF_KILL_MASK) { |
8935 | IPW_DEBUG_HC("Aborting scan due to RF kill activation\n"); | 8943 | IPW_DEBUG_HC("Aborting scan due to RF kill activation\n"); |
@@ -8981,7 +8989,7 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, | |||
8981 | priv->status |= STATUS_SCANNING; | 8989 | priv->status |= STATUS_SCANNING; |
8982 | 8990 | ||
8983 | done: | 8991 | done: |
8984 | up(&priv->sem); | 8992 | mutex_unlock(&priv->mutex); |
8985 | return err; | 8993 | return err; |
8986 | } | 8994 | } |
8987 | 8995 | ||
@@ -9024,7 +9032,7 @@ static int ipw_wx_set_encode(struct net_device *dev, | |||
9024 | int ret; | 9032 | int ret; |
9025 | u32 cap = priv->capability; | 9033 | u32 cap = priv->capability; |
9026 | 9034 | ||
9027 | down(&priv->sem); | 9035 | mutex_lock(&priv->mutex); |
9028 | ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); | 9036 | ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); |
9029 | 9037 | ||
9030 | /* In IBSS mode, we need to notify the firmware to update | 9038 | /* In IBSS mode, we need to notify the firmware to update |
@@ -9034,7 +9042,7 @@ static int ipw_wx_set_encode(struct net_device *dev, | |||
9034 | priv->status & STATUS_ASSOCIATED) | 9042 | priv->status & STATUS_ASSOCIATED) |
9035 | ipw_disassociate(priv); | 9043 | ipw_disassociate(priv); |
9036 | 9044 | ||
9037 | up(&priv->sem); | 9045 | mutex_unlock(&priv->mutex); |
9038 | return ret; | 9046 | return ret; |
9039 | } | 9047 | } |
9040 | 9048 | ||
@@ -9052,17 +9060,17 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
9052 | { | 9060 | { |
9053 | struct ipw_priv *priv = ieee80211_priv(dev); | 9061 | struct ipw_priv *priv = ieee80211_priv(dev); |
9054 | int err; | 9062 | int err; |
9055 | down(&priv->sem); | 9063 | mutex_lock(&priv->mutex); |
9056 | if (wrqu->power.disabled) { | 9064 | if (wrqu->power.disabled) { |
9057 | priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); | 9065 | priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); |
9058 | err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); | 9066 | err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); |
9059 | if (err) { | 9067 | if (err) { |
9060 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9068 | IPW_DEBUG_WX("failed setting power mode.\n"); |
9061 | up(&priv->sem); | 9069 | mutex_unlock(&priv->mutex); |
9062 | return err; | 9070 | return err; |
9063 | } | 9071 | } |
9064 | IPW_DEBUG_WX("SET Power Management Mode -> off\n"); | 9072 | IPW_DEBUG_WX("SET Power Management Mode -> off\n"); |
9065 | up(&priv->sem); | 9073 | mutex_unlock(&priv->mutex); |
9066 | return 0; | 9074 | return 0; |
9067 | } | 9075 | } |
9068 | 9076 | ||
@@ -9074,7 +9082,7 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
9074 | default: /* Otherwise we don't support it */ | 9082 | default: /* Otherwise we don't support it */ |
9075 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", | 9083 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", |
9076 | wrqu->power.flags); | 9084 | wrqu->power.flags); |
9077 | up(&priv->sem); | 9085 | mutex_unlock(&priv->mutex); |
9078 | return -EOPNOTSUPP; | 9086 | return -EOPNOTSUPP; |
9079 | } | 9087 | } |
9080 | 9088 | ||
@@ -9087,12 +9095,12 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
9087 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); | 9095 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); |
9088 | if (err) { | 9096 | if (err) { |
9089 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9097 | IPW_DEBUG_WX("failed setting power mode.\n"); |
9090 | up(&priv->sem); | 9098 | mutex_unlock(&priv->mutex); |
9091 | return err; | 9099 | return err; |
9092 | } | 9100 | } |
9093 | 9101 | ||
9094 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); | 9102 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); |
9095 | up(&priv->sem); | 9103 | mutex_unlock(&priv->mutex); |
9096 | return 0; | 9104 | return 0; |
9097 | } | 9105 | } |
9098 | 9106 | ||
@@ -9101,13 +9109,13 @@ static int ipw_wx_get_power(struct net_device *dev, | |||
9101 | union iwreq_data *wrqu, char *extra) | 9109 | union iwreq_data *wrqu, char *extra) |
9102 | { | 9110 | { |
9103 | struct ipw_priv *priv = ieee80211_priv(dev); | 9111 | struct ipw_priv *priv = ieee80211_priv(dev); |
9104 | down(&priv->sem); | 9112 | mutex_lock(&priv->mutex); |
9105 | if (!(priv->power_mode & IPW_POWER_ENABLED)) | 9113 | if (!(priv->power_mode & IPW_POWER_ENABLED)) |
9106 | wrqu->power.disabled = 1; | 9114 | wrqu->power.disabled = 1; |
9107 | else | 9115 | else |
9108 | wrqu->power.disabled = 0; | 9116 | wrqu->power.disabled = 0; |
9109 | 9117 | ||
9110 | up(&priv->sem); | 9118 | mutex_unlock(&priv->mutex); |
9111 | IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); | 9119 | IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); |
9112 | 9120 | ||
9113 | return 0; | 9121 | return 0; |
@@ -9120,7 +9128,7 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
9120 | struct ipw_priv *priv = ieee80211_priv(dev); | 9128 | struct ipw_priv *priv = ieee80211_priv(dev); |
9121 | int mode = *(int *)extra; | 9129 | int mode = *(int *)extra; |
9122 | int err; | 9130 | int err; |
9123 | down(&priv->sem); | 9131 | mutex_lock(&priv->mutex); |
9124 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { | 9132 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { |
9125 | mode = IPW_POWER_AC; | 9133 | mode = IPW_POWER_AC; |
9126 | priv->power_mode = mode; | 9134 | priv->power_mode = mode; |
@@ -9133,11 +9141,11 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
9133 | 9141 | ||
9134 | if (err) { | 9142 | if (err) { |
9135 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9143 | IPW_DEBUG_WX("failed setting power mode.\n"); |
9136 | up(&priv->sem); | 9144 | mutex_unlock(&priv->mutex); |
9137 | return err; | 9145 | return err; |
9138 | } | 9146 | } |
9139 | } | 9147 | } |
9140 | up(&priv->sem); | 9148 | mutex_unlock(&priv->mutex); |
9141 | return 0; | 9149 | return 0; |
9142 | } | 9150 | } |
9143 | 9151 | ||
@@ -9186,7 +9194,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
9186 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); | 9194 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); |
9187 | return -EINVAL; | 9195 | return -EINVAL; |
9188 | } | 9196 | } |
9189 | down(&priv->sem); | 9197 | mutex_lock(&priv->mutex); |
9190 | if (priv->adapter == IPW_2915ABG) { | 9198 | if (priv->adapter == IPW_2915ABG) { |
9191 | priv->ieee->abg_true = 1; | 9199 | priv->ieee->abg_true = 1; |
9192 | if (mode & IEEE_A) { | 9200 | if (mode & IEEE_A) { |
@@ -9198,7 +9206,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
9198 | if (mode & IEEE_A) { | 9206 | if (mode & IEEE_A) { |
9199 | IPW_WARNING("Attempt to set 2200BG into " | 9207 | IPW_WARNING("Attempt to set 2200BG into " |
9200 | "802.11a mode\n"); | 9208 | "802.11a mode\n"); |
9201 | up(&priv->sem); | 9209 | mutex_unlock(&priv->mutex); |
9202 | return -EINVAL; | 9210 | return -EINVAL; |
9203 | } | 9211 | } |
9204 | 9212 | ||
@@ -9235,7 +9243,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
9235 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", | 9243 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", |
9236 | mode & IEEE_A ? 'a' : '.', | 9244 | mode & IEEE_A ? 'a' : '.', |
9237 | mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); | 9245 | mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); |
9238 | up(&priv->sem); | 9246 | mutex_unlock(&priv->mutex); |
9239 | return 0; | 9247 | return 0; |
9240 | } | 9248 | } |
9241 | 9249 | ||
@@ -9244,7 +9252,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, | |||
9244 | union iwreq_data *wrqu, char *extra) | 9252 | union iwreq_data *wrqu, char *extra) |
9245 | { | 9253 | { |
9246 | struct ipw_priv *priv = ieee80211_priv(dev); | 9254 | struct ipw_priv *priv = ieee80211_priv(dev); |
9247 | down(&priv->sem); | 9255 | mutex_lock(&priv->mutex); |
9248 | switch (priv->ieee->mode) { | 9256 | switch (priv->ieee->mode) { |
9249 | case IEEE_A: | 9257 | case IEEE_A: |
9250 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); | 9258 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); |
@@ -9275,7 +9283,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, | |||
9275 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); | 9283 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); |
9276 | 9284 | ||
9277 | wrqu->data.length = strlen(extra) + 1; | 9285 | wrqu->data.length = strlen(extra) + 1; |
9278 | up(&priv->sem); | 9286 | mutex_unlock(&priv->mutex); |
9279 | 9287 | ||
9280 | return 0; | 9288 | return 0; |
9281 | } | 9289 | } |
@@ -9286,7 +9294,7 @@ static int ipw_wx_set_preamble(struct net_device *dev, | |||
9286 | { | 9294 | { |
9287 | struct ipw_priv *priv = ieee80211_priv(dev); | 9295 | struct ipw_priv *priv = ieee80211_priv(dev); |
9288 | int mode = *(int *)extra; | 9296 | int mode = *(int *)extra; |
9289 | down(&priv->sem); | 9297 | mutex_lock(&priv->mutex); |
9290 | /* Switching from SHORT -> LONG requires a disassociation */ | 9298 | /* Switching from SHORT -> LONG requires a disassociation */ |
9291 | if (mode == 1) { | 9299 | if (mode == 1) { |
9292 | if (!(priv->config & CFG_PREAMBLE_LONG)) { | 9300 | if (!(priv->config & CFG_PREAMBLE_LONG)) { |
@@ -9305,11 +9313,11 @@ static int ipw_wx_set_preamble(struct net_device *dev, | |||
9305 | priv->config &= ~CFG_PREAMBLE_LONG; | 9313 | priv->config &= ~CFG_PREAMBLE_LONG; |
9306 | goto done; | 9314 | goto done; |
9307 | } | 9315 | } |
9308 | up(&priv->sem); | 9316 | mutex_unlock(&priv->mutex); |
9309 | return -EINVAL; | 9317 | return -EINVAL; |
9310 | 9318 | ||
9311 | done: | 9319 | done: |
9312 | up(&priv->sem); | 9320 | mutex_unlock(&priv->mutex); |
9313 | return 0; | 9321 | return 0; |
9314 | } | 9322 | } |
9315 | 9323 | ||
@@ -9318,12 +9326,12 @@ static int ipw_wx_get_preamble(struct net_device *dev, | |||
9318 | union iwreq_data *wrqu, char *extra) | 9326 | union iwreq_data *wrqu, char *extra) |
9319 | { | 9327 | { |
9320 | struct ipw_priv *priv = ieee80211_priv(dev); | 9328 | struct ipw_priv *priv = ieee80211_priv(dev); |
9321 | down(&priv->sem); | 9329 | mutex_lock(&priv->mutex); |
9322 | if (priv->config & CFG_PREAMBLE_LONG) | 9330 | if (priv->config & CFG_PREAMBLE_LONG) |
9323 | snprintf(wrqu->name, IFNAMSIZ, "long (1)"); | 9331 | snprintf(wrqu->name, IFNAMSIZ, "long (1)"); |
9324 | else | 9332 | else |
9325 | snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); | 9333 | snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); |
9326 | up(&priv->sem); | 9334 | mutex_unlock(&priv->mutex); |
9327 | return 0; | 9335 | return 0; |
9328 | } | 9336 | } |
9329 | 9337 | ||
@@ -9335,7 +9343,7 @@ static int ipw_wx_set_monitor(struct net_device *dev, | |||
9335 | struct ipw_priv *priv = ieee80211_priv(dev); | 9343 | struct ipw_priv *priv = ieee80211_priv(dev); |
9336 | int *parms = (int *)extra; | 9344 | int *parms = (int *)extra; |
9337 | int enable = (parms[0] > 0); | 9345 | int enable = (parms[0] > 0); |
9338 | down(&priv->sem); | 9346 | mutex_lock(&priv->mutex); |
9339 | IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); | 9347 | IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); |
9340 | if (enable) { | 9348 | if (enable) { |
9341 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { | 9349 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { |
@@ -9350,13 +9358,13 @@ static int ipw_wx_set_monitor(struct net_device *dev, | |||
9350 | ipw_set_channel(priv, parms[1]); | 9358 | ipw_set_channel(priv, parms[1]); |
9351 | } else { | 9359 | } else { |
9352 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { | 9360 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { |
9353 | up(&priv->sem); | 9361 | mutex_unlock(&priv->mutex); |
9354 | return 0; | 9362 | return 0; |
9355 | } | 9363 | } |
9356 | priv->net_dev->type = ARPHRD_ETHER; | 9364 | priv->net_dev->type = ARPHRD_ETHER; |
9357 | queue_work(priv->workqueue, &priv->adapter_restart); | 9365 | queue_work(priv->workqueue, &priv->adapter_restart); |
9358 | } | 9366 | } |
9359 | up(&priv->sem); | 9367 | mutex_unlock(&priv->mutex); |
9360 | return 0; | 9368 | return 0; |
9361 | } | 9369 | } |
9362 | 9370 | ||
@@ -9386,7 +9394,7 @@ static int ipw_wx_sw_reset(struct net_device *dev, | |||
9386 | 9394 | ||
9387 | IPW_DEBUG_WX("SW_RESET\n"); | 9395 | IPW_DEBUG_WX("SW_RESET\n"); |
9388 | 9396 | ||
9389 | down(&priv->sem); | 9397 | mutex_lock(&priv->mutex); |
9390 | 9398 | ||
9391 | ret = ipw_sw_reset(priv, 0); | 9399 | ret = ipw_sw_reset(priv, 0); |
9392 | if (!ret) { | 9400 | if (!ret) { |
@@ -9398,9 +9406,9 @@ static int ipw_wx_sw_reset(struct net_device *dev, | |||
9398 | * module parameter, so take appropriate action */ | 9406 | * module parameter, so take appropriate action */ |
9399 | ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW); | 9407 | ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW); |
9400 | 9408 | ||
9401 | up(&priv->sem); | 9409 | mutex_unlock(&priv->mutex); |
9402 | ieee80211_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL); | 9410 | ieee80211_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL); |
9403 | down(&priv->sem); | 9411 | mutex_lock(&priv->mutex); |
9404 | 9412 | ||
9405 | if (!(priv->status & STATUS_RF_KILL_MASK)) { | 9413 | if (!(priv->status & STATUS_RF_KILL_MASK)) { |
9406 | /* Configuration likely changed -- force [re]association */ | 9414 | /* Configuration likely changed -- force [re]association */ |
@@ -9410,7 +9418,7 @@ static int ipw_wx_sw_reset(struct net_device *dev, | |||
9410 | ipw_associate(priv); | 9418 | ipw_associate(priv); |
9411 | } | 9419 | } |
9412 | 9420 | ||
9413 | up(&priv->sem); | 9421 | mutex_unlock(&priv->mutex); |
9414 | 9422 | ||
9415 | return 0; | 9423 | return 0; |
9416 | } | 9424 | } |
@@ -9586,7 +9594,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) | |||
9586 | static void init_sys_config(struct ipw_sys_config *sys_config) | 9594 | static void init_sys_config(struct ipw_sys_config *sys_config) |
9587 | { | 9595 | { |
9588 | memset(sys_config, 0, sizeof(struct ipw_sys_config)); | 9596 | memset(sys_config, 0, sizeof(struct ipw_sys_config)); |
9589 | sys_config->bt_coexistence = 1; /* We may need to look into prvStaBtConfig */ | 9597 | sys_config->bt_coexistence = 0; |
9590 | sys_config->answer_broadcast_ssid_probe = 0; | 9598 | sys_config->answer_broadcast_ssid_probe = 0; |
9591 | sys_config->accept_all_data_frames = 0; | 9599 | sys_config->accept_all_data_frames = 0; |
9592 | sys_config->accept_non_directed_frames = 1; | 9600 | sys_config->accept_non_directed_frames = 1; |
@@ -9607,11 +9615,11 @@ static int ipw_net_open(struct net_device *dev) | |||
9607 | struct ipw_priv *priv = ieee80211_priv(dev); | 9615 | struct ipw_priv *priv = ieee80211_priv(dev); |
9608 | IPW_DEBUG_INFO("dev->open\n"); | 9616 | IPW_DEBUG_INFO("dev->open\n"); |
9609 | /* we should be verifying the device is ready to be opened */ | 9617 | /* we should be verifying the device is ready to be opened */ |
9610 | down(&priv->sem); | 9618 | mutex_lock(&priv->mutex); |
9611 | if (!(priv->status & STATUS_RF_KILL_MASK) && | 9619 | if (!(priv->status & STATUS_RF_KILL_MASK) && |
9612 | (priv->status & STATUS_ASSOCIATED)) | 9620 | (priv->status & STATUS_ASSOCIATED)) |
9613 | netif_start_queue(dev); | 9621 | netif_start_queue(dev); |
9614 | up(&priv->sem); | 9622 | mutex_unlock(&priv->mutex); |
9615 | return 0; | 9623 | return 0; |
9616 | } | 9624 | } |
9617 | 9625 | ||
@@ -9890,13 +9898,13 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p) | |||
9890 | struct sockaddr *addr = p; | 9898 | struct sockaddr *addr = p; |
9891 | if (!is_valid_ether_addr(addr->sa_data)) | 9899 | if (!is_valid_ether_addr(addr->sa_data)) |
9892 | return -EADDRNOTAVAIL; | 9900 | return -EADDRNOTAVAIL; |
9893 | down(&priv->sem); | 9901 | mutex_lock(&priv->mutex); |
9894 | priv->config |= CFG_CUSTOM_MAC; | 9902 | priv->config |= CFG_CUSTOM_MAC; |
9895 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); | 9903 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); |
9896 | printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", | 9904 | printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", |
9897 | priv->net_dev->name, MAC_ARG(priv->mac_addr)); | 9905 | priv->net_dev->name, MAC_ARG(priv->mac_addr)); |
9898 | queue_work(priv->workqueue, &priv->adapter_restart); | 9906 | queue_work(priv->workqueue, &priv->adapter_restart); |
9899 | up(&priv->sem); | 9907 | mutex_unlock(&priv->mutex); |
9900 | return 0; | 9908 | return 0; |
9901 | } | 9909 | } |
9902 | 9910 | ||
@@ -9940,9 +9948,9 @@ static int ipw_ethtool_get_eeprom(struct net_device *dev, | |||
9940 | 9948 | ||
9941 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) | 9949 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) |
9942 | return -EINVAL; | 9950 | return -EINVAL; |
9943 | down(&p->sem); | 9951 | mutex_lock(&p->mutex); |
9944 | memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len); | 9952 | memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len); |
9945 | up(&p->sem); | 9953 | mutex_unlock(&p->mutex); |
9946 | return 0; | 9954 | return 0; |
9947 | } | 9955 | } |
9948 | 9956 | ||
@@ -9954,12 +9962,12 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev, | |||
9954 | 9962 | ||
9955 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) | 9963 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) |
9956 | return -EINVAL; | 9964 | return -EINVAL; |
9957 | down(&p->sem); | 9965 | mutex_lock(&p->mutex); |
9958 | memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len); | 9966 | memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len); |
9959 | for (i = IPW_EEPROM_DATA; | 9967 | for (i = IPW_EEPROM_DATA; |
9960 | i < IPW_EEPROM_DATA + IPW_EEPROM_IMAGE_SIZE; i++) | 9968 | i < IPW_EEPROM_DATA + IPW_EEPROM_IMAGE_SIZE; i++) |
9961 | ipw_write8(p, i, p->eeprom[i]); | 9969 | ipw_write8(p, i, p->eeprom[i]); |
9962 | up(&p->sem); | 9970 | mutex_unlock(&p->mutex); |
9963 | return 0; | 9971 | return 0; |
9964 | } | 9972 | } |
9965 | 9973 | ||
@@ -10054,12 +10062,12 @@ static void ipw_rf_kill(void *adapter) | |||
10054 | static void ipw_bg_rf_kill(void *data) | 10062 | static void ipw_bg_rf_kill(void *data) |
10055 | { | 10063 | { |
10056 | struct ipw_priv *priv = data; | 10064 | struct ipw_priv *priv = data; |
10057 | down(&priv->sem); | 10065 | mutex_lock(&priv->mutex); |
10058 | ipw_rf_kill(data); | 10066 | ipw_rf_kill(data); |
10059 | up(&priv->sem); | 10067 | mutex_unlock(&priv->mutex); |
10060 | } | 10068 | } |
10061 | 10069 | ||
10062 | void ipw_link_up(struct ipw_priv *priv) | 10070 | static void ipw_link_up(struct ipw_priv *priv) |
10063 | { | 10071 | { |
10064 | priv->last_seq_num = -1; | 10072 | priv->last_seq_num = -1; |
10065 | priv->last_frag_num = -1; | 10073 | priv->last_frag_num = -1; |
@@ -10089,12 +10097,12 @@ void ipw_link_up(struct ipw_priv *priv) | |||
10089 | static void ipw_bg_link_up(void *data) | 10097 | static void ipw_bg_link_up(void *data) |
10090 | { | 10098 | { |
10091 | struct ipw_priv *priv = data; | 10099 | struct ipw_priv *priv = data; |
10092 | down(&priv->sem); | 10100 | mutex_lock(&priv->mutex); |
10093 | ipw_link_up(data); | 10101 | ipw_link_up(data); |
10094 | up(&priv->sem); | 10102 | mutex_unlock(&priv->mutex); |
10095 | } | 10103 | } |
10096 | 10104 | ||
10097 | void ipw_link_down(struct ipw_priv *priv) | 10105 | static void ipw_link_down(struct ipw_priv *priv) |
10098 | { | 10106 | { |
10099 | ipw_led_link_down(priv); | 10107 | ipw_led_link_down(priv); |
10100 | netif_carrier_off(priv->net_dev); | 10108 | netif_carrier_off(priv->net_dev); |
@@ -10117,9 +10125,9 @@ void ipw_link_down(struct ipw_priv *priv) | |||
10117 | static void ipw_bg_link_down(void *data) | 10125 | static void ipw_bg_link_down(void *data) |
10118 | { | 10126 | { |
10119 | struct ipw_priv *priv = data; | 10127 | struct ipw_priv *priv = data; |
10120 | down(&priv->sem); | 10128 | mutex_lock(&priv->mutex); |
10121 | ipw_link_down(data); | 10129 | ipw_link_down(data); |
10122 | up(&priv->sem); | 10130 | mutex_unlock(&priv->mutex); |
10123 | } | 10131 | } |
10124 | 10132 | ||
10125 | static int ipw_setup_deferred_work(struct ipw_priv *priv) | 10133 | static int ipw_setup_deferred_work(struct ipw_priv *priv) |
@@ -10292,6 +10300,20 @@ static int ipw_config(struct ipw_priv *priv) | |||
10292 | 10300 | ||
10293 | /* set basic system config settings */ | 10301 | /* set basic system config settings */ |
10294 | init_sys_config(&priv->sys_config); | 10302 | init_sys_config(&priv->sys_config); |
10303 | |||
10304 | /* Support Bluetooth if we have BT h/w on board, and user wants to. | ||
10305 | * Does not support BT priority yet (don't abort or defer our Tx) */ | ||
10306 | if (bt_coexist) { | ||
10307 | unsigned char bt_caps = priv->eeprom[EEPROM_SKU_CAPABILITY]; | ||
10308 | |||
10309 | if (bt_caps & EEPROM_SKU_CAP_BT_CHANNEL_SIG) | ||
10310 | priv->sys_config.bt_coexistence | ||
10311 | |= CFG_BT_COEXISTENCE_SIGNAL_CHNL; | ||
10312 | if (bt_caps & EEPROM_SKU_CAP_BT_OOB) | ||
10313 | priv->sys_config.bt_coexistence | ||
10314 | |= CFG_BT_COEXISTENCE_OOB; | ||
10315 | } | ||
10316 | |||
10295 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | 10317 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) |
10296 | priv->sys_config.answer_broadcast_ssid_probe = 1; | 10318 | priv->sys_config.answer_broadcast_ssid_probe = 1; |
10297 | else | 10319 | else |
@@ -10782,9 +10804,9 @@ static int ipw_up(struct ipw_priv *priv) | |||
10782 | static void ipw_bg_up(void *data) | 10804 | static void ipw_bg_up(void *data) |
10783 | { | 10805 | { |
10784 | struct ipw_priv *priv = data; | 10806 | struct ipw_priv *priv = data; |
10785 | down(&priv->sem); | 10807 | mutex_lock(&priv->mutex); |
10786 | ipw_up(data); | 10808 | ipw_up(data); |
10787 | up(&priv->sem); | 10809 | mutex_unlock(&priv->mutex); |
10788 | } | 10810 | } |
10789 | 10811 | ||
10790 | static void ipw_deinit(struct ipw_priv *priv) | 10812 | static void ipw_deinit(struct ipw_priv *priv) |
@@ -10853,23 +10875,23 @@ static void ipw_down(struct ipw_priv *priv) | |||
10853 | static void ipw_bg_down(void *data) | 10875 | static void ipw_bg_down(void *data) |
10854 | { | 10876 | { |
10855 | struct ipw_priv *priv = data; | 10877 | struct ipw_priv *priv = data; |
10856 | down(&priv->sem); | 10878 | mutex_lock(&priv->mutex); |
10857 | ipw_down(data); | 10879 | ipw_down(data); |
10858 | up(&priv->sem); | 10880 | mutex_unlock(&priv->mutex); |
10859 | } | 10881 | } |
10860 | 10882 | ||
10861 | /* Called by register_netdev() */ | 10883 | /* Called by register_netdev() */ |
10862 | static int ipw_net_init(struct net_device *dev) | 10884 | static int ipw_net_init(struct net_device *dev) |
10863 | { | 10885 | { |
10864 | struct ipw_priv *priv = ieee80211_priv(dev); | 10886 | struct ipw_priv *priv = ieee80211_priv(dev); |
10865 | down(&priv->sem); | 10887 | mutex_lock(&priv->mutex); |
10866 | 10888 | ||
10867 | if (ipw_up(priv)) { | 10889 | if (ipw_up(priv)) { |
10868 | up(&priv->sem); | 10890 | mutex_unlock(&priv->mutex); |
10869 | return -EIO; | 10891 | return -EIO; |
10870 | } | 10892 | } |
10871 | 10893 | ||
10872 | up(&priv->sem); | 10894 | mutex_unlock(&priv->mutex); |
10873 | return 0; | 10895 | return 0; |
10874 | } | 10896 | } |
10875 | 10897 | ||
@@ -10959,7 +10981,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
10959 | for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) | 10981 | for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) |
10960 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); | 10982 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); |
10961 | 10983 | ||
10962 | init_MUTEX(&priv->sem); | 10984 | mutex_init(&priv->mutex); |
10963 | if (pci_enable_device(pdev)) { | 10985 | if (pci_enable_device(pdev)) { |
10964 | err = -ENODEV; | 10986 | err = -ENODEV; |
10965 | goto out_free_ieee80211; | 10987 | goto out_free_ieee80211; |
@@ -11017,7 +11039,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
11017 | SET_MODULE_OWNER(net_dev); | 11039 | SET_MODULE_OWNER(net_dev); |
11018 | SET_NETDEV_DEV(net_dev, &pdev->dev); | 11040 | SET_NETDEV_DEV(net_dev, &pdev->dev); |
11019 | 11041 | ||
11020 | down(&priv->sem); | 11042 | mutex_lock(&priv->mutex); |
11021 | 11043 | ||
11022 | priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; | 11044 | priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; |
11023 | priv->ieee->set_security = shim__set_security; | 11045 | priv->ieee->set_security = shim__set_security; |
@@ -11050,11 +11072,11 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
11050 | err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); | 11072 | err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); |
11051 | if (err) { | 11073 | if (err) { |
11052 | IPW_ERROR("failed to create sysfs device attributes\n"); | 11074 | IPW_ERROR("failed to create sysfs device attributes\n"); |
11053 | up(&priv->sem); | 11075 | mutex_unlock(&priv->mutex); |
11054 | goto out_release_irq; | 11076 | goto out_release_irq; |
11055 | } | 11077 | } |
11056 | 11078 | ||
11057 | up(&priv->sem); | 11079 | mutex_unlock(&priv->mutex); |
11058 | err = register_netdev(net_dev); | 11080 | err = register_netdev(net_dev); |
11059 | if (err) { | 11081 | if (err) { |
11060 | IPW_ERROR("failed to register network device\n"); | 11082 | IPW_ERROR("failed to register network device\n"); |
@@ -11091,13 +11113,13 @@ static void ipw_pci_remove(struct pci_dev *pdev) | |||
11091 | if (!priv) | 11113 | if (!priv) |
11092 | return; | 11114 | return; |
11093 | 11115 | ||
11094 | down(&priv->sem); | 11116 | mutex_lock(&priv->mutex); |
11095 | 11117 | ||
11096 | priv->status |= STATUS_EXIT_PENDING; | 11118 | priv->status |= STATUS_EXIT_PENDING; |
11097 | ipw_down(priv); | 11119 | ipw_down(priv); |
11098 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); | 11120 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); |
11099 | 11121 | ||
11100 | up(&priv->sem); | 11122 | mutex_unlock(&priv->mutex); |
11101 | 11123 | ||
11102 | unregister_netdev(priv->net_dev); | 11124 | unregister_netdev(priv->net_dev); |
11103 | 11125 | ||
@@ -11281,12 +11303,18 @@ module_param(mode, int, 0444); | |||
11281 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); | 11303 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); |
11282 | #endif | 11304 | #endif |
11283 | 11305 | ||
11306 | module_param(bt_coexist, int, 0444); | ||
11307 | MODULE_PARM_DESC(bt_coexist, "enable bluetooth coexistence (default off)"); | ||
11308 | |||
11284 | module_param(hwcrypto, int, 0444); | 11309 | module_param(hwcrypto, int, 0444); |
11285 | MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default on)"); | 11310 | MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default off)"); |
11286 | 11311 | ||
11287 | module_param(cmdlog, int, 0444); | 11312 | module_param(cmdlog, int, 0444); |
11288 | MODULE_PARM_DESC(cmdlog, | 11313 | MODULE_PARM_DESC(cmdlog, |
11289 | "allocate a ring buffer for logging firmware commands"); | 11314 | "allocate a ring buffer for logging firmware commands"); |
11290 | 11315 | ||
11316 | module_param(roaming, int, 0444); | ||
11317 | MODULE_PARM_DESC(roaming, "enable roaming support (default on)"); | ||
11318 | |||
11291 | module_exit(ipw_exit); | 11319 | module_exit(ipw_exit); |
11292 | module_init(ipw_init); | 11320 | module_init(ipw_init); |
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index e65620a4d79e..5405ba105abf 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/moduleparam.h> | 33 | #include <linux/moduleparam.h> |
34 | #include <linux/config.h> | 34 | #include <linux/config.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/mutex.h> | ||
36 | 37 | ||
37 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
38 | #include <linux/netdevice.h> | 39 | #include <linux/netdevice.h> |
@@ -46,6 +47,7 @@ | |||
46 | #include <linux/firmware.h> | 47 | #include <linux/firmware.h> |
47 | #include <linux/wireless.h> | 48 | #include <linux/wireless.h> |
48 | #include <linux/dma-mapping.h> | 49 | #include <linux/dma-mapping.h> |
50 | #include <linux/jiffies.h> | ||
49 | #include <asm/io.h> | 51 | #include <asm/io.h> |
50 | 52 | ||
51 | #include <net/ieee80211.h> | 53 | #include <net/ieee80211.h> |
@@ -852,7 +854,7 @@ struct ipw_scan_request_ext { | |||
852 | u16 dwell_time[IPW_SCAN_TYPES]; | 854 | u16 dwell_time[IPW_SCAN_TYPES]; |
853 | } __attribute__ ((packed)); | 855 | } __attribute__ ((packed)); |
854 | 856 | ||
855 | extern inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index) | 857 | static inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index) |
856 | { | 858 | { |
857 | if (index % 2) | 859 | if (index % 2) |
858 | return scan->scan_type[index / 2] & 0x0F; | 860 | return scan->scan_type[index / 2] & 0x0F; |
@@ -860,7 +862,7 @@ extern inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index) | |||
860 | return (scan->scan_type[index / 2] & 0xF0) >> 4; | 862 | return (scan->scan_type[index / 2] & 0xF0) >> 4; |
861 | } | 863 | } |
862 | 864 | ||
863 | extern inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan, | 865 | static inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan, |
864 | u8 index, u8 scan_type) | 866 | u8 index, u8 scan_type) |
865 | { | 867 | { |
866 | if (index % 2) | 868 | if (index % 2) |
@@ -1120,7 +1122,7 @@ struct ipw_priv { | |||
1120 | struct ieee80211_device *ieee; | 1122 | struct ieee80211_device *ieee; |
1121 | 1123 | ||
1122 | spinlock_t lock; | 1124 | spinlock_t lock; |
1123 | struct semaphore sem; | 1125 | struct mutex mutex; |
1124 | 1126 | ||
1125 | /* basic pci-network driver stuff */ | 1127 | /* basic pci-network driver stuff */ |
1126 | struct pci_dev *pci_dev; | 1128 | struct pci_dev *pci_dev; |
@@ -1406,13 +1408,6 @@ do { if (ipw_debug_level & (level)) \ | |||
1406 | * Register bit definitions | 1408 | * Register bit definitions |
1407 | */ | 1409 | */ |
1408 | 1410 | ||
1409 | /* Dino control registers bits */ | ||
1410 | |||
1411 | #define DINO_ENABLE_SYSTEM 0x80 | ||
1412 | #define DINO_ENABLE_CS 0x40 | ||
1413 | #define DINO_RXFIFO_DATA 0x01 | ||
1414 | #define DINO_CONTROL_REG 0x00200000 | ||
1415 | |||
1416 | #define IPW_INTA_RW 0x00000008 | 1411 | #define IPW_INTA_RW 0x00000008 |
1417 | #define IPW_INTA_MASK_R 0x0000000C | 1412 | #define IPW_INTA_MASK_R 0x0000000C |
1418 | #define IPW_INDIRECT_ADDR 0x00000010 | 1413 | #define IPW_INDIRECT_ADDR 0x00000010 |
@@ -1459,6 +1454,11 @@ do { if (ipw_debug_level & (level)) \ | |||
1459 | #define IPW_DOMAIN_0_END 0x1000 | 1454 | #define IPW_DOMAIN_0_END 0x1000 |
1460 | #define CLX_MEM_BAR_SIZE 0x1000 | 1455 | #define CLX_MEM_BAR_SIZE 0x1000 |
1461 | 1456 | ||
1457 | /* Dino/baseband control registers bits */ | ||
1458 | |||
1459 | #define DINO_ENABLE_SYSTEM 0x80 /* 1 = baseband processor on, 0 = reset */ | ||
1460 | #define DINO_ENABLE_CS 0x40 /* 1 = enable ucode load */ | ||
1461 | #define DINO_RXFIFO_DATA 0x01 /* 1 = data available */ | ||
1462 | #define IPW_BASEBAND_CONTROL_STATUS 0X00200000 | 1462 | #define IPW_BASEBAND_CONTROL_STATUS 0X00200000 |
1463 | #define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 | 1463 | #define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 |
1464 | #define IPW_BASEBAND_RX_FIFO_READ 0X00200004 | 1464 | #define IPW_BASEBAND_RX_FIFO_READ 0X00200004 |
@@ -1567,13 +1567,18 @@ do { if (ipw_debug_level & (level)) \ | |||
1567 | #define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */ | 1567 | #define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */ |
1568 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ | 1568 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ |
1569 | 1569 | ||
1570 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ | 1570 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset */ |
1571 | #define EEPROM_NIC_TYPE_0 0 | 1571 | #define EEPROM_NIC_TYPE_0 0 |
1572 | #define EEPROM_NIC_TYPE_1 1 | 1572 | #define EEPROM_NIC_TYPE_1 1 |
1573 | #define EEPROM_NIC_TYPE_2 2 | 1573 | #define EEPROM_NIC_TYPE_2 2 |
1574 | #define EEPROM_NIC_TYPE_3 3 | 1574 | #define EEPROM_NIC_TYPE_3 3 |
1575 | #define EEPROM_NIC_TYPE_4 4 | 1575 | #define EEPROM_NIC_TYPE_4 4 |
1576 | 1576 | ||
1577 | /* Bluetooth Coexistence capabilities as found in EEPROM_SKU_CAPABILITY */ | ||
1578 | #define EEPROM_SKU_CAP_BT_CHANNEL_SIG 0x01 /* we can tell BT our channel # */ | ||
1579 | #define EEPROM_SKU_CAP_BT_PRIORITY 0x02 /* BT can take priority over us */ | ||
1580 | #define EEPROM_SKU_CAP_BT_OOB 0x04 /* we can signal BT out-of-band */ | ||
1581 | |||
1577 | #define FW_MEM_REG_LOWER_BOUND 0x00300000 | 1582 | #define FW_MEM_REG_LOWER_BOUND 0x00300000 |
1578 | #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) | 1583 | #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) |
1579 | #define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) | 1584 | #define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) |
@@ -1658,9 +1663,10 @@ enum { | |||
1658 | IPW_FW_ERROR_FATAL_ERROR | 1663 | IPW_FW_ERROR_FATAL_ERROR |
1659 | }; | 1664 | }; |
1660 | 1665 | ||
1661 | #define AUTH_OPEN 0 | 1666 | #define AUTH_OPEN 0 |
1662 | #define AUTH_SHARED_KEY 1 | 1667 | #define AUTH_SHARED_KEY 1 |
1663 | #define AUTH_IGNORE 3 | 1668 | #define AUTH_LEAP 2 |
1669 | #define AUTH_IGNORE 3 | ||
1664 | 1670 | ||
1665 | #define HC_ASSOCIATE 0 | 1671 | #define HC_ASSOCIATE 0 |
1666 | #define HC_REASSOCIATE 1 | 1672 | #define HC_REASSOCIATE 1 |
@@ -1860,7 +1866,7 @@ struct host_cmd { | |||
1860 | u8 cmd; | 1866 | u8 cmd; |
1861 | u8 len; | 1867 | u8 len; |
1862 | u16 reserved; | 1868 | u16 reserved; |
1863 | u32 param[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; | 1869 | u32 *param; |
1864 | } __attribute__ ((packed)); | 1870 | } __attribute__ ((packed)); |
1865 | 1871 | ||
1866 | struct ipw_cmd_log { | 1872 | struct ipw_cmd_log { |
@@ -1869,21 +1875,23 @@ struct ipw_cmd_log { | |||
1869 | struct host_cmd cmd; | 1875 | struct host_cmd cmd; |
1870 | }; | 1876 | }; |
1871 | 1877 | ||
1872 | #define CFG_BT_COEXISTENCE_MIN 0x00 | 1878 | /* SysConfig command parameters ... */ |
1873 | #define CFG_BT_COEXISTENCE_DEFER 0x02 | 1879 | /* bt_coexistence param */ |
1874 | #define CFG_BT_COEXISTENCE_KILL 0x04 | 1880 | #define CFG_BT_COEXISTENCE_SIGNAL_CHNL 0x01 /* tell BT our chnl # */ |
1875 | #define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 | 1881 | #define CFG_BT_COEXISTENCE_DEFER 0x02 /* defer our Tx if BT traffic */ |
1876 | #define CFG_BT_COEXISTENCE_OOB 0x10 | 1882 | #define CFG_BT_COEXISTENCE_KILL 0x04 /* kill our Tx if BT traffic */ |
1877 | #define CFG_BT_COEXISTENCE_MAX 0xFF | 1883 | #define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 /* multimedia extensions */ |
1878 | #define CFG_BT_COEXISTENCE_DEF 0x80 /* read Bt from EEPROM */ | 1884 | #define CFG_BT_COEXISTENCE_OOB 0x10 /* signal BT via out-of-band */ |
1879 | 1885 | ||
1880 | #define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x0 | 1886 | /* clear-to-send to self param */ |
1881 | #define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x1 | 1887 | #define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x00 |
1888 | #define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x01 | ||
1882 | #define CFG_CTS_TO_ITSELF_ENABLED_DEF CFG_CTS_TO_ITSELF_ENABLED_MIN | 1889 | #define CFG_CTS_TO_ITSELF_ENABLED_DEF CFG_CTS_TO_ITSELF_ENABLED_MIN |
1883 | 1890 | ||
1884 | #define CFG_SYS_ANTENNA_BOTH 0x000 | 1891 | /* Antenna diversity param (h/w can select best antenna, based on signal) */ |
1885 | #define CFG_SYS_ANTENNA_A 0x001 | 1892 | #define CFG_SYS_ANTENNA_BOTH 0x00 /* NIC selects best antenna */ |
1886 | #define CFG_SYS_ANTENNA_B 0x003 | 1893 | #define CFG_SYS_ANTENNA_A 0x01 /* force antenna A */ |
1894 | #define CFG_SYS_ANTENNA_B 0x03 /* force antenna B */ | ||
1887 | 1895 | ||
1888 | /* | 1896 | /* |
1889 | * The definitions below were lifted off the ipw2100 driver, which only | 1897 | * The definitions below were lifted off the ipw2100 driver, which only |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index bf6271ee387a..75ce6ddb0cf5 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -55,10 +55,8 @@ | |||
55 | #include <linux/etherdevice.h> | 55 | #include <linux/etherdevice.h> |
56 | #include <linux/skbuff.h> | 56 | #include <linux/skbuff.h> |
57 | #include <linux/bitops.h> | 57 | #include <linux/bitops.h> |
58 | #ifdef CONFIG_NET_RADIO | ||
59 | #include <linux/wireless.h> | 58 | #include <linux/wireless.h> |
60 | #include <net/iw_handler.h> | 59 | #include <net/iw_handler.h> |
61 | #endif | ||
62 | 60 | ||
63 | #include <pcmcia/cs_types.h> | 61 | #include <pcmcia/cs_types.h> |
64 | #include <pcmcia/cs.h> | 62 | #include <pcmcia/cs.h> |
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index 18baacfc5a2c..18a44580b53b 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c | |||
@@ -112,7 +112,7 @@ static const char StripVersion[] = "1.3A-STUART.CHESHIRE"; | |||
112 | #include <linux/ip.h> | 112 | #include <linux/ip.h> |
113 | #include <linux/tcp.h> | 113 | #include <linux/tcp.h> |
114 | #include <linux/time.h> | 114 | #include <linux/time.h> |
115 | 115 | #include <linux/jiffies.h> | |
116 | 116 | ||
117 | /************************************************************************/ | 117 | /************************************************************************/ |
118 | /* Useful structures and definitions */ | 118 | /* Useful structures and definitions */ |
@@ -1569,7 +1569,7 @@ static int strip_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1569 | del_timer(&strip_info->idle_timer); | 1569 | del_timer(&strip_info->idle_timer); |
1570 | 1570 | ||
1571 | 1571 | ||
1572 | if (jiffies - strip_info->pps_timer > HZ) { | 1572 | if (time_after(jiffies, strip_info->pps_timer + HZ)) { |
1573 | unsigned long t = jiffies - strip_info->pps_timer; | 1573 | unsigned long t = jiffies - strip_info->pps_timer; |
1574 | unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t; | 1574 | unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t; |
1575 | unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t; | 1575 | unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t; |
diff --git a/drivers/net/wireless/wavelan.p.h b/drivers/net/wireless/wavelan.p.h index 166e28b9a4f7..5cb0bc8bb128 100644 --- a/drivers/net/wireless/wavelan.p.h +++ b/drivers/net/wireless/wavelan.p.h | |||
@@ -98,11 +98,7 @@ | |||
98 | * characteristics of the hardware. Applications such as mobile IP may | 98 | * characteristics of the hardware. Applications such as mobile IP may |
99 | * take advantage of it. | 99 | * take advantage of it. |
100 | * | 100 | * |
101 | * You will need to enable the CONFIG_NET_RADIO define in the kernel | 101 | * It might be a good idea as well to fetch the wireless tools to |
102 | * configuration to enable the wireless extensions (this is the one | ||
103 | * giving access to the radio network device choice). | ||
104 | * | ||
105 | * It might also be a good idea as well to fetch the wireless tools to | ||
106 | * configure the device and play a bit. | 102 | * configure the device and play a bit. |
107 | */ | 103 | */ |
108 | 104 | ||
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h index f2d597568151..451f6271dcbc 100644 --- a/drivers/net/wireless/wavelan_cs.p.h +++ b/drivers/net/wireless/wavelan_cs.p.h | |||
@@ -99,11 +99,7 @@ | |||
99 | * caracteristics of the hardware in a standard way and support for | 99 | * caracteristics of the hardware in a standard way and support for |
100 | * applications for taking advantage of it (like Mobile IP). | 100 | * applications for taking advantage of it (like Mobile IP). |
101 | * | 101 | * |
102 | * You will need to enable the CONFIG_NET_RADIO define in the kernel | 102 | * It might be a good idea as well to fetch the wireless tools to |
103 | * configuration to enable the wireless extensions (this is the one | ||
104 | * giving access to the radio network device choice). | ||
105 | * | ||
106 | * It might also be a good idea as well to fetch the wireless tools to | ||
107 | * configure the device and play a bit. | 103 | * configure the device and play a bit. |
108 | */ | 104 | */ |
109 | 105 | ||
@@ -440,11 +436,8 @@ | |||
440 | #include <linux/ioport.h> | 436 | #include <linux/ioport.h> |
441 | #include <linux/fcntl.h> | 437 | #include <linux/fcntl.h> |
442 | #include <linux/ethtool.h> | 438 | #include <linux/ethtool.h> |
443 | |||
444 | #ifdef CONFIG_NET_RADIO | ||
445 | #include <linux/wireless.h> /* Wireless extensions */ | 439 | #include <linux/wireless.h> /* Wireless extensions */ |
446 | #include <net/iw_handler.h> /* New driver API */ | 440 | #include <net/iw_handler.h> /* New driver API */ |
447 | #endif | ||
448 | 441 | ||
449 | /* Pcmcia headers that we need */ | 442 | /* Pcmcia headers that we need */ |
450 | #include <pcmcia/cs_types.h> | 443 | #include <pcmcia/cs_types.h> |
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c index 8ab6e12153ba..761021603597 100644 --- a/drivers/net/zorro8390.c +++ b/drivers/net/zorro8390.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/netdevice.h> | 27 | #include <linux/netdevice.h> |
28 | #include <linux/etherdevice.h> | 28 | #include <linux/etherdevice.h> |
29 | #include <linux/zorro.h> | 29 | #include <linux/zorro.h> |
30 | #include <linux/jiffies.h> | ||
30 | 31 | ||
31 | #include <asm/system.h> | 32 | #include <asm/system.h> |
32 | #include <asm/irq.h> | 33 | #include <asm/irq.h> |
@@ -151,7 +152,7 @@ static int __devinit zorro8390_init(struct net_device *dev, | |||
151 | z_writeb(z_readb(ioaddr + NE_RESET), ioaddr + NE_RESET); | 152 | z_writeb(z_readb(ioaddr + NE_RESET), ioaddr + NE_RESET); |
152 | 153 | ||
153 | while ((z_readb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) | 154 | while ((z_readb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) |
154 | if (jiffies - reset_start_time > 2*HZ/100) { | 155 | if (time_after(jiffies, reset_start_time + 2*HZ/100)) { |
155 | printk(KERN_WARNING " not found (no reset ack).\n"); | 156 | printk(KERN_WARNING " not found (no reset ack).\n"); |
156 | return -ENODEV; | 157 | return -ENODEV; |
157 | } | 158 | } |
@@ -273,7 +274,7 @@ static void zorro8390_reset_8390(struct net_device *dev) | |||
273 | 274 | ||
274 | /* This check _should_not_ be necessary, omit eventually. */ | 275 | /* This check _should_not_ be necessary, omit eventually. */ |
275 | while ((z_readb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) | 276 | while ((z_readb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) |
276 | if (jiffies - reset_start_time > 2*HZ/100) { | 277 | if (time_after(jiffies, reset_start_time + 2*HZ/100)) { |
277 | printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", | 278 | printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", |
278 | dev->name); | 279 | dev->name); |
279 | break; | 280 | break; |
@@ -400,7 +401,7 @@ static void zorro8390_block_output(struct net_device *dev, int count, | |||
400 | dma_start = jiffies; | 401 | dma_start = jiffies; |
401 | 402 | ||
402 | while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) | 403 | while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) |
403 | if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ | 404 | if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ |
404 | printk(KERN_ERR "%s: timeout waiting for Tx RDC.\n", | 405 | printk(KERN_ERR "%s: timeout waiting for Tx RDC.\n", |
405 | dev->name); | 406 | dev->name); |
406 | zorro8390_reset_8390(dev); | 407 | zorro8390_reset_8390(dev); |
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h index 7198f129e135..231ba090ae34 100644 --- a/include/linux/arcdevice.h +++ b/include/linux/arcdevice.h | |||
@@ -206,7 +206,6 @@ struct ArcProto { | |||
206 | 206 | ||
207 | extern struct ArcProto *arc_proto_map[256], *arc_proto_default, | 207 | extern struct ArcProto *arc_proto_map[256], *arc_proto_default, |
208 | *arc_bcast_proto, *arc_raw_proto; | 208 | *arc_bcast_proto, *arc_raw_proto; |
209 | extern struct ArcProto arc_proto_null; | ||
210 | 209 | ||
211 | 210 | ||
212 | /* | 211 | /* |
@@ -334,17 +333,9 @@ void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc); | |||
334 | #define arcnet_dump_skb(dev,skb,desc) ; | 333 | #define arcnet_dump_skb(dev,skb,desc) ; |
335 | #endif | 334 | #endif |
336 | 335 | ||
337 | #if (ARCNET_DEBUG_MAX & D_RX) || (ARCNET_DEBUG_MAX & D_TX) | ||
338 | void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc, | ||
339 | int take_arcnet_lock); | ||
340 | #else | ||
341 | #define arcnet_dump_packet(dev, bufnum, desc,take_arcnet_lock) ; | ||
342 | #endif | ||
343 | |||
344 | void arcnet_unregister_proto(struct ArcProto *proto); | 336 | void arcnet_unregister_proto(struct ArcProto *proto); |
345 | irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs); | 337 | irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs); |
346 | struct net_device *alloc_arcdev(char *name); | 338 | struct net_device *alloc_arcdev(char *name); |
347 | void arcnet_rx(struct net_device *dev, int bufnum); | ||
348 | 339 | ||
349 | #endif /* __KERNEL__ */ | 340 | #endif /* __KERNEL__ */ |
350 | #endif /* _LINUX_ARCDEVICE_H */ | 341 | #endif /* _LINUX_ARCDEVICE_H */ |
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h index 0b08cd692201..955d3069d727 100644 --- a/include/linux/mv643xx.h +++ b/include/linux/mv643xx.h | |||
@@ -1214,6 +1214,7 @@ struct mv64xxx_i2c_pdata { | |||
1214 | #define MV643XX_ETH_FORCE_BP_MODE_NO_JAM 0 | 1214 | #define MV643XX_ETH_FORCE_BP_MODE_NO_JAM 0 |
1215 | #define MV643XX_ETH_FORCE_BP_MODE_JAM_TX (1<<7) | 1215 | #define MV643XX_ETH_FORCE_BP_MODE_JAM_TX (1<<7) |
1216 | #define MV643XX_ETH_FORCE_BP_MODE_JAM_TX_ON_RX_ERR (1<<8) | 1216 | #define MV643XX_ETH_FORCE_BP_MODE_JAM_TX_ON_RX_ERR (1<<8) |
1217 | #define MV643XX_ETH_SERIAL_PORT_CONTROL_RESERVED (1<<9) | ||
1217 | #define MV643XX_ETH_FORCE_LINK_FAIL 0 | 1218 | #define MV643XX_ETH_FORCE_LINK_FAIL 0 |
1218 | #define MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL (1<<10) | 1219 | #define MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL (1<<10) |
1219 | #define MV643XX_ETH_RETRANSMIT_16_ATTEMPTS 0 | 1220 | #define MV643XX_ETH_RETRANSMIT_16_ATTEMPTS 0 |
@@ -1243,6 +1244,8 @@ struct mv64xxx_i2c_pdata { | |||
1243 | #define MV643XX_ETH_SET_MII_SPEED_TO_10 0 | 1244 | #define MV643XX_ETH_SET_MII_SPEED_TO_10 0 |
1244 | #define MV643XX_ETH_SET_MII_SPEED_TO_100 (1<<24) | 1245 | #define MV643XX_ETH_SET_MII_SPEED_TO_100 (1<<24) |
1245 | 1246 | ||
1247 | #define MV643XX_ETH_MAX_RX_PACKET_MASK (0x7<<17) | ||
1248 | |||
1246 | #define MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE \ | 1249 | #define MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE \ |
1247 | MV643XX_ETH_DO_NOT_FORCE_LINK_PASS | \ | 1250 | MV643XX_ETH_DO_NOT_FORCE_LINK_PASS | \ |
1248 | MV643XX_ETH_ENABLE_AUTO_NEG_FOR_DUPLX | \ | 1251 | MV643XX_ETH_ENABLE_AUTO_NEG_FOR_DUPLX | \ |
@@ -1285,23 +1288,15 @@ struct mv64xxx_i2c_pdata { | |||
1285 | #define MV643XX_ETH_NAME "mv643xx_eth" | 1288 | #define MV643XX_ETH_NAME "mv643xx_eth" |
1286 | 1289 | ||
1287 | struct mv643xx_eth_platform_data { | 1290 | struct mv643xx_eth_platform_data { |
1288 | /* | ||
1289 | * Non-values for mac_addr, phy_addr, port_config, etc. | ||
1290 | * override the default value. Setting the corresponding | ||
1291 | * force_* field, causes the default value to be overridden | ||
1292 | * even when zero. | ||
1293 | */ | ||
1294 | unsigned int force_phy_addr:1; | ||
1295 | unsigned int force_port_config:1; | ||
1296 | unsigned int force_port_config_extend:1; | ||
1297 | unsigned int force_port_sdma_config:1; | ||
1298 | unsigned int force_port_serial_control:1; | ||
1299 | int phy_addr; | ||
1300 | char *mac_addr; /* pointer to mac address */ | 1291 | char *mac_addr; /* pointer to mac address */ |
1301 | u32 port_config; | 1292 | u16 force_phy_addr; /* force override if phy_addr == 0 */ |
1302 | u32 port_config_extend; | 1293 | u16 phy_addr; |
1303 | u32 port_sdma_config; | 1294 | |
1304 | u32 port_serial_control; | 1295 | /* If speed is 0, then speed and duplex are autonegotiated. */ |
1296 | int speed; /* 0, SPEED_10, SPEED_100, SPEED_1000 */ | ||
1297 | int duplex; /* DUPLEX_HALF or DUPLEX_FULL */ | ||
1298 | |||
1299 | /* non-zero values of the following fields override defaults */ | ||
1305 | u32 tx_queue_size; | 1300 | u32 tx_queue_size; |
1306 | u32 rx_queue_size; | 1301 | u32 rx_queue_size; |
1307 | u32 tx_sram_addr; | 1302 | u32 tx_sram_addr; |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 9a92aef8b0b2..4725ff861c57 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -220,6 +220,7 @@ struct ieee80211_snap_hdr { | |||
220 | /* Authentication algorithms */ | 220 | /* Authentication algorithms */ |
221 | #define WLAN_AUTH_OPEN 0 | 221 | #define WLAN_AUTH_OPEN 0 |
222 | #define WLAN_AUTH_SHARED_KEY 1 | 222 | #define WLAN_AUTH_SHARED_KEY 1 |
223 | #define WLAN_AUTH_LEAP 2 | ||
223 | 224 | ||
224 | #define WLAN_AUTH_CHALLENGE_LEN 128 | 225 | #define WLAN_AUTH_CHALLENGE_LEN 128 |
225 | 226 | ||
@@ -299,6 +300,23 @@ enum ieee80211_reasoncode { | |||
299 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, | 300 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, |
300 | }; | 301 | }; |
301 | 302 | ||
303 | /* Action categories - 802.11h */ | ||
304 | enum ieee80211_actioncategories { | ||
305 | WLAN_ACTION_SPECTRUM_MGMT = 0, | ||
306 | /* Reserved 1-127 */ | ||
307 | /* Error 128-255 */ | ||
308 | }; | ||
309 | |||
310 | /* Action details - 802.11h */ | ||
311 | enum ieee80211_actiondetails { | ||
312 | WLAN_ACTION_CATEGORY_MEASURE_REQUEST = 0, | ||
313 | WLAN_ACTION_CATEGORY_MEASURE_REPORT = 1, | ||
314 | WLAN_ACTION_CATEGORY_TPC_REQUEST = 2, | ||
315 | WLAN_ACTION_CATEGORY_TPC_REPORT = 3, | ||
316 | WLAN_ACTION_CATEGORY_CHANNEL_SWITCH = 4, | ||
317 | /* 5 - 255 Reserved */ | ||
318 | }; | ||
319 | |||
302 | #define IEEE80211_STATMASK_SIGNAL (1<<0) | 320 | #define IEEE80211_STATMASK_SIGNAL (1<<0) |
303 | #define IEEE80211_STATMASK_RSSI (1<<1) | 321 | #define IEEE80211_STATMASK_RSSI (1<<1) |
304 | #define IEEE80211_STATMASK_NOISE (1<<2) | 322 | #define IEEE80211_STATMASK_NOISE (1<<2) |
@@ -377,6 +395,8 @@ struct ieee80211_rx_stats { | |||
377 | u8 mask; | 395 | u8 mask; |
378 | u8 freq; | 396 | u8 freq; |
379 | u16 len; | 397 | u16 len; |
398 | u64 tsf; | ||
399 | u32 beacon_time; | ||
380 | }; | 400 | }; |
381 | 401 | ||
382 | /* IEEE 802.11 requires that STA supports concurrent reception of at least | 402 | /* IEEE 802.11 requires that STA supports concurrent reception of at least |
@@ -608,6 +628,28 @@ struct ieee80211_auth { | |||
608 | struct ieee80211_info_element info_element[0]; | 628 | struct ieee80211_info_element info_element[0]; |
609 | } __attribute__ ((packed)); | 629 | } __attribute__ ((packed)); |
610 | 630 | ||
631 | struct ieee80211_channel_switch { | ||
632 | u8 id; | ||
633 | u8 len; | ||
634 | u8 mode; | ||
635 | u8 channel; | ||
636 | u8 count; | ||
637 | } __attribute__ ((packed)); | ||
638 | |||
639 | struct ieee80211_action { | ||
640 | struct ieee80211_hdr_3addr header; | ||
641 | u8 category; | ||
642 | u8 action; | ||
643 | union { | ||
644 | struct ieee80211_action_exchange { | ||
645 | u8 token; | ||
646 | struct ieee80211_info_element info_element[0]; | ||
647 | } exchange; | ||
648 | struct ieee80211_channel_switch channel_switch; | ||
649 | |||
650 | } format; | ||
651 | } __attribute__ ((packed)); | ||
652 | |||
611 | struct ieee80211_disassoc { | 653 | struct ieee80211_disassoc { |
612 | struct ieee80211_hdr_3addr header; | 654 | struct ieee80211_hdr_3addr header; |
613 | __le16 reason; | 655 | __le16 reason; |
@@ -692,7 +734,15 @@ struct ieee80211_txb { | |||
692 | /* QoS structure */ | 734 | /* QoS structure */ |
693 | #define NETWORK_HAS_QOS_PARAMETERS (1<<3) | 735 | #define NETWORK_HAS_QOS_PARAMETERS (1<<3) |
694 | #define NETWORK_HAS_QOS_INFORMATION (1<<4) | 736 | #define NETWORK_HAS_QOS_INFORMATION (1<<4) |
695 | #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | NETWORK_HAS_QOS_INFORMATION) | 737 | #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ |
738 | NETWORK_HAS_QOS_INFORMATION) | ||
739 | |||
740 | /* 802.11h */ | ||
741 | #define NETWORK_HAS_POWER_CONSTRAINT (1<<5) | ||
742 | #define NETWORK_HAS_CSA (1<<6) | ||
743 | #define NETWORK_HAS_QUIET (1<<7) | ||
744 | #define NETWORK_HAS_IBSS_DFS (1<<8) | ||
745 | #define NETWORK_HAS_TPC_REPORT (1<<9) | ||
696 | 746 | ||
697 | #define QOS_QUEUE_NUM 4 | 747 | #define QOS_QUEUE_NUM 4 |
698 | #define QOS_OUI_LEN 3 | 748 | #define QOS_OUI_LEN 3 |
@@ -748,6 +798,91 @@ struct ieee80211_tim_parameters { | |||
748 | 798 | ||
749 | /*******************************************************/ | 799 | /*******************************************************/ |
750 | 800 | ||
801 | enum { /* ieee80211_basic_report.map */ | ||
802 | IEEE80211_BASIC_MAP_BSS = (1 << 0), | ||
803 | IEEE80211_BASIC_MAP_OFDM = (1 << 1), | ||
804 | IEEE80211_BASIC_MAP_UNIDENTIFIED = (1 << 2), | ||
805 | IEEE80211_BASIC_MAP_RADAR = (1 << 3), | ||
806 | IEEE80211_BASIC_MAP_UNMEASURED = (1 << 4), | ||
807 | /* Bits 5-7 are reserved */ | ||
808 | |||
809 | }; | ||
810 | struct ieee80211_basic_report { | ||
811 | u8 channel; | ||
812 | __le64 start_time; | ||
813 | __le16 duration; | ||
814 | u8 map; | ||
815 | } __attribute__ ((packed)); | ||
816 | |||
817 | enum { /* ieee80211_measurement_request.mode */ | ||
818 | /* Bit 0 is reserved */ | ||
819 | IEEE80211_MEASUREMENT_ENABLE = (1 << 1), | ||
820 | IEEE80211_MEASUREMENT_REQUEST = (1 << 2), | ||
821 | IEEE80211_MEASUREMENT_REPORT = (1 << 3), | ||
822 | /* Bits 4-7 are reserved */ | ||
823 | }; | ||
824 | |||
825 | enum { | ||
826 | IEEE80211_REPORT_BASIC = 0, /* required */ | ||
827 | IEEE80211_REPORT_CCA = 1, /* optional */ | ||
828 | IEEE80211_REPORT_RPI = 2, /* optional */ | ||
829 | /* 3-255 reserved */ | ||
830 | }; | ||
831 | |||
832 | struct ieee80211_measurement_params { | ||
833 | u8 channel; | ||
834 | __le64 start_time; | ||
835 | __le16 duration; | ||
836 | } __attribute__ ((packed)); | ||
837 | |||
838 | struct ieee80211_measurement_request { | ||
839 | struct ieee80211_info_element ie; | ||
840 | u8 token; | ||
841 | u8 mode; | ||
842 | u8 type; | ||
843 | struct ieee80211_measurement_params params[0]; | ||
844 | } __attribute__ ((packed)); | ||
845 | |||
846 | struct ieee80211_measurement_report { | ||
847 | struct ieee80211_info_element ie; | ||
848 | u8 token; | ||
849 | u8 mode; | ||
850 | u8 type; | ||
851 | union { | ||
852 | struct ieee80211_basic_report basic[0]; | ||
853 | } u; | ||
854 | } __attribute__ ((packed)); | ||
855 | |||
856 | struct ieee80211_tpc_report { | ||
857 | u8 transmit_power; | ||
858 | u8 link_margin; | ||
859 | } __attribute__ ((packed)); | ||
860 | |||
861 | struct ieee80211_channel_map { | ||
862 | u8 channel; | ||
863 | u8 map; | ||
864 | } __attribute__ ((packed)); | ||
865 | |||
866 | struct ieee80211_ibss_dfs { | ||
867 | struct ieee80211_info_element ie; | ||
868 | u8 owner[ETH_ALEN]; | ||
869 | u8 recovery_interval; | ||
870 | struct ieee80211_channel_map channel_map[0]; | ||
871 | }; | ||
872 | |||
873 | struct ieee80211_csa { | ||
874 | u8 mode; | ||
875 | u8 channel; | ||
876 | u8 count; | ||
877 | } __attribute__ ((packed)); | ||
878 | |||
879 | struct ieee80211_quiet { | ||
880 | u8 count; | ||
881 | u8 period; | ||
882 | u8 duration; | ||
883 | u8 offset; | ||
884 | } __attribute__ ((packed)); | ||
885 | |||
751 | struct ieee80211_network { | 886 | struct ieee80211_network { |
752 | /* These entries are used to identify a unique network */ | 887 | /* These entries are used to identify a unique network */ |
753 | u8 bssid[ETH_ALEN]; | 888 | u8 bssid[ETH_ALEN]; |
@@ -767,7 +902,7 @@ struct ieee80211_network { | |||
767 | u8 rates_ex_len; | 902 | u8 rates_ex_len; |
768 | unsigned long last_scanned; | 903 | unsigned long last_scanned; |
769 | u8 mode; | 904 | u8 mode; |
770 | u8 flags; | 905 | u32 flags; |
771 | u32 last_associate; | 906 | u32 last_associate; |
772 | u32 time_stamp[2]; | 907 | u32 time_stamp[2]; |
773 | u16 beacon_interval; | 908 | u16 beacon_interval; |
@@ -779,6 +914,25 @@ struct ieee80211_network { | |||
779 | u8 rsn_ie[MAX_WPA_IE_LEN]; | 914 | u8 rsn_ie[MAX_WPA_IE_LEN]; |
780 | size_t rsn_ie_len; | 915 | size_t rsn_ie_len; |
781 | struct ieee80211_tim_parameters tim; | 916 | struct ieee80211_tim_parameters tim; |
917 | |||
918 | /* 802.11h info */ | ||
919 | |||
920 | /* Power Constraint - mandatory if spctrm mgmt required */ | ||
921 | u8 power_constraint; | ||
922 | |||
923 | /* TPC Report - mandatory if spctrm mgmt required */ | ||
924 | struct ieee80211_tpc_report tpc_report; | ||
925 | |||
926 | /* IBSS DFS - mandatory if spctrm mgmt required and IBSS | ||
927 | * NOTE: This is variable length and so must be allocated dynamically */ | ||
928 | struct ieee80211_ibss_dfs *ibss_dfs; | ||
929 | |||
930 | /* Channel Switch Announcement - optional if spctrm mgmt required */ | ||
931 | struct ieee80211_csa csa; | ||
932 | |||
933 | /* Quiet - optional if spctrm mgmt required */ | ||
934 | struct ieee80211_quiet quiet; | ||
935 | |||
782 | struct list_head list; | 936 | struct list_head list; |
783 | }; | 937 | }; |
784 | 938 | ||
@@ -924,7 +1078,10 @@ struct ieee80211_device { | |||
924 | int (*handle_auth) (struct net_device * dev, | 1078 | int (*handle_auth) (struct net_device * dev, |
925 | struct ieee80211_auth * auth); | 1079 | struct ieee80211_auth * auth); |
926 | int (*handle_deauth) (struct net_device * dev, | 1080 | int (*handle_deauth) (struct net_device * dev, |
927 | struct ieee80211_auth * auth); | 1081 | struct ieee80211_deauth * auth); |
1082 | int (*handle_action) (struct net_device * dev, | ||
1083 | struct ieee80211_action * action, | ||
1084 | struct ieee80211_rx_stats * stats); | ||
928 | int (*handle_disassoc) (struct net_device * dev, | 1085 | int (*handle_disassoc) (struct net_device * dev, |
929 | struct ieee80211_disassoc * assoc); | 1086 | struct ieee80211_disassoc * assoc); |
930 | int (*handle_beacon) (struct net_device * dev, | 1087 | int (*handle_beacon) (struct net_device * dev, |
@@ -1093,6 +1250,7 @@ extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
1093 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, | 1250 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, |
1094 | struct ieee80211_hdr_4addr *header, | 1251 | struct ieee80211_hdr_4addr *header, |
1095 | struct ieee80211_rx_stats *stats); | 1252 | struct ieee80211_rx_stats *stats); |
1253 | extern void ieee80211_network_reset(struct ieee80211_network *network); | ||
1096 | 1254 | ||
1097 | /* ieee80211_geo.c */ | 1255 | /* ieee80211_geo.c */ |
1098 | extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device | 1256 | extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device |
@@ -1105,6 +1263,11 @@ extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee, | |||
1105 | extern int ieee80211_channel_to_index(struct ieee80211_device *ieee, | 1263 | extern int ieee80211_channel_to_index(struct ieee80211_device *ieee, |
1106 | u8 channel); | 1264 | u8 channel); |
1107 | extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq); | 1265 | extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq); |
1266 | extern u8 ieee80211_get_channel_flags(struct ieee80211_device *ieee, | ||
1267 | u8 channel); | ||
1268 | extern const struct ieee80211_channel *ieee80211_get_channel(struct | ||
1269 | ieee80211_device | ||
1270 | *ieee, u8 channel); | ||
1108 | 1271 | ||
1109 | /* ieee80211_wx.c */ | 1272 | /* ieee80211_wx.c */ |
1110 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | 1273 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, |
@@ -1122,6 +1285,14 @@ extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee, | |||
1122 | extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, | 1285 | extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, |
1123 | struct iw_request_info *info, | 1286 | struct iw_request_info *info, |
1124 | union iwreq_data *wrqu, char *extra); | 1287 | union iwreq_data *wrqu, char *extra); |
1288 | extern int ieee80211_wx_set_auth(struct net_device *dev, | ||
1289 | struct iw_request_info *info, | ||
1290 | union iwreq_data *wrqu, | ||
1291 | char *extra); | ||
1292 | extern int ieee80211_wx_get_auth(struct net_device *dev, | ||
1293 | struct iw_request_info *info, | ||
1294 | union iwreq_data *wrqu, | ||
1295 | char *extra); | ||
1125 | 1296 | ||
1126 | static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) | 1297 | static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) |
1127 | { | 1298 | { |
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index cd82c3e998e4..eb476414fd72 100644 --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h | |||
@@ -47,7 +47,8 @@ struct ieee80211_crypto_ops { | |||
47 | /* deinitialize crypto context and free allocated private data */ | 47 | /* deinitialize crypto context and free allocated private data */ |
48 | void (*deinit) (void *priv); | 48 | void (*deinit) (void *priv); |
49 | 49 | ||
50 | int (*build_iv) (struct sk_buff * skb, int hdr_len, void *priv); | 50 | int (*build_iv) (struct sk_buff * skb, int hdr_len, |
51 | u8 *key, int keylen, void *priv); | ||
51 | 52 | ||
52 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return | 53 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return |
53 | * value from decrypt_mpdu is passed as the keyidx value for | 54 | * value from decrypt_mpdu is passed as the keyidx value for |
diff --git a/net/Kconfig b/net/Kconfig index 5126f58d9c44..4193cdcd3ae7 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
@@ -224,6 +224,9 @@ source "net/irda/Kconfig" | |||
224 | source "net/bluetooth/Kconfig" | 224 | source "net/bluetooth/Kconfig" |
225 | source "net/ieee80211/Kconfig" | 225 | source "net/ieee80211/Kconfig" |
226 | 226 | ||
227 | config WIRELESS_EXT | ||
228 | bool | ||
229 | |||
227 | endif # if NET | 230 | endif # if NET |
228 | endmenu # Networking | 231 | endmenu # Networking |
229 | 232 | ||
diff --git a/net/core/Makefile b/net/core/Makefile index 630da0f0579e..79fe12cced27 100644 --- a/net/core/Makefile +++ b/net/core/Makefile | |||
@@ -14,5 +14,5 @@ obj-$(CONFIG_XFRM) += flow.o | |||
14 | obj-$(CONFIG_SYSFS) += net-sysfs.o | 14 | obj-$(CONFIG_SYSFS) += net-sysfs.o |
15 | obj-$(CONFIG_NET_DIVERT) += dv.o | 15 | obj-$(CONFIG_NET_DIVERT) += dv.o |
16 | obj-$(CONFIG_NET_PKTGEN) += pktgen.o | 16 | obj-$(CONFIG_NET_PKTGEN) += pktgen.o |
17 | obj-$(CONFIG_NET_RADIO) += wireless.o | 17 | obj-$(CONFIG_WIRELESS_EXT) += wireless.o |
18 | obj-$(CONFIG_NETPOLL) += netpoll.o | 18 | obj-$(CONFIG_NETPOLL) += netpoll.o |
diff --git a/net/core/dev.c b/net/core/dev.c index 2afb0de95329..225e38ff57c4 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -110,10 +110,8 @@ | |||
110 | #include <linux/netpoll.h> | 110 | #include <linux/netpoll.h> |
111 | #include <linux/rcupdate.h> | 111 | #include <linux/rcupdate.h> |
112 | #include <linux/delay.h> | 112 | #include <linux/delay.h> |
113 | #ifdef CONFIG_NET_RADIO | 113 | #include <linux/wireless.h> |
114 | #include <linux/wireless.h> /* Note : will define WIRELESS_EXT */ | ||
115 | #include <net/iw_handler.h> | 114 | #include <net/iw_handler.h> |
116 | #endif /* CONFIG_NET_RADIO */ | ||
117 | #include <asm/current.h> | 115 | #include <asm/current.h> |
118 | 116 | ||
119 | /* | 117 | /* |
@@ -2028,7 +2026,7 @@ static struct file_operations softnet_seq_fops = { | |||
2028 | .release = seq_release, | 2026 | .release = seq_release, |
2029 | }; | 2027 | }; |
2030 | 2028 | ||
2031 | #ifdef WIRELESS_EXT | 2029 | #ifdef CONFIG_WIRELESS_EXT |
2032 | extern int wireless_proc_init(void); | 2030 | extern int wireless_proc_init(void); |
2033 | #else | 2031 | #else |
2034 | #define wireless_proc_init() 0 | 2032 | #define wireless_proc_init() 0 |
@@ -2582,7 +2580,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg) | |||
2582 | ret = -EFAULT; | 2580 | ret = -EFAULT; |
2583 | return ret; | 2581 | return ret; |
2584 | } | 2582 | } |
2585 | #ifdef WIRELESS_EXT | 2583 | #ifdef CONFIG_WIRELESS_EXT |
2586 | /* Take care of Wireless Extensions */ | 2584 | /* Take care of Wireless Extensions */ |
2587 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { | 2585 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { |
2588 | /* If command is `set a parameter', or | 2586 | /* If command is `set a parameter', or |
@@ -2603,7 +2601,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg) | |||
2603 | ret = -EFAULT; | 2601 | ret = -EFAULT; |
2604 | return ret; | 2602 | return ret; |
2605 | } | 2603 | } |
2606 | #endif /* WIRELESS_EXT */ | 2604 | #endif /* CONFIG_WIRELESS_EXT */ |
2607 | return -EINVAL; | 2605 | return -EINVAL; |
2608 | } | 2606 | } |
2609 | } | 2607 | } |
diff --git a/net/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c index ecc9bb196abc..cb71d794a7d1 100644 --- a/net/ieee80211/ieee80211_crypt.c +++ b/net/ieee80211/ieee80211_crypt.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <net/ieee80211.h> | 19 | #include <net/ieee80211.h> |
20 | 20 | ||
21 | |||
22 | MODULE_AUTHOR("Jouni Malinen"); | 21 | MODULE_AUTHOR("Jouni Malinen"); |
23 | MODULE_DESCRIPTION("HostAP crypto"); | 22 | MODULE_DESCRIPTION("HostAP crypto"); |
24 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
@@ -33,11 +32,11 @@ static DEFINE_SPINLOCK(ieee80211_crypto_lock); | |||
33 | 32 | ||
34 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) | 33 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) |
35 | { | 34 | { |
36 | struct ieee80211_crypt_data *entry, *next; | 35 | struct ieee80211_crypt_data *entry, *next; |
37 | unsigned long flags; | 36 | unsigned long flags; |
38 | 37 | ||
39 | spin_lock_irqsave(&ieee->lock, flags); | 38 | spin_lock_irqsave(&ieee->lock, flags); |
40 | list_for_each_entry_safe(entry, next, &ieee->crypt_deinit_list, list) { | 39 | list_for_each_entry_safe(entry, next, &ieee->crypt_deinit_list, list) { |
41 | if (atomic_read(&entry->refcnt) != 0 && !force) | 40 | if (atomic_read(&entry->refcnt) != 0 && !force) |
42 | continue; | 41 | continue; |
43 | 42 | ||
@@ -141,9 +140,9 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
141 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | 140 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
142 | return -EINVAL; | 141 | return -EINVAL; |
143 | 142 | ||
144 | found: | 143 | found: |
145 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " | 144 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " |
146 | "'%s'\n", ops->name); | 145 | "'%s'\n", ops->name); |
147 | list_del(&alg->list); | 146 | list_del(&alg->list); |
148 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | 147 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
149 | kfree(alg); | 148 | kfree(alg); |
@@ -163,7 +162,7 @@ struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) | |||
163 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | 162 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
164 | return NULL; | 163 | return NULL; |
165 | 164 | ||
166 | found: | 165 | found: |
167 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | 166 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
168 | return alg->ops; | 167 | return alg->ops; |
169 | } | 168 | } |
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c index 470221728503..097bcea2129f 100644 --- a/net/ieee80211/ieee80211_crypt_ccmp.c +++ b/net/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -190,7 +190,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, | |||
190 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); | 190 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); |
191 | } | 191 | } |
192 | 192 | ||
193 | static int ieee80211_ccmp_hdr(struct sk_buff *skb, int hdr_len, void *priv) | 193 | static int ieee80211_ccmp_hdr(struct sk_buff *skb, int hdr_len, |
194 | u8 *aeskey, int keylen, void *priv) | ||
194 | { | 195 | { |
195 | struct ieee80211_ccmp_data *key = priv; | 196 | struct ieee80211_ccmp_data *key = priv; |
196 | int i; | 197 | int i; |
@@ -199,6 +200,9 @@ static int ieee80211_ccmp_hdr(struct sk_buff *skb, int hdr_len, void *priv) | |||
199 | if (skb_headroom(skb) < CCMP_HDR_LEN || skb->len < hdr_len) | 200 | if (skb_headroom(skb) < CCMP_HDR_LEN || skb->len < hdr_len) |
200 | return -1; | 201 | return -1; |
201 | 202 | ||
203 | if (aeskey != NULL && keylen >= CCMP_TK_LEN) | ||
204 | memcpy(aeskey, key->key, CCMP_TK_LEN); | ||
205 | |||
202 | pos = skb_push(skb, CCMP_HDR_LEN); | 206 | pos = skb_push(skb, CCMP_HDR_LEN); |
203 | memmove(pos, pos + CCMP_HDR_LEN, hdr_len); | 207 | memmove(pos, pos + CCMP_HDR_LEN, hdr_len); |
204 | pos += hdr_len; | 208 | pos += hdr_len; |
@@ -238,7 +242,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
238 | return -1; | 242 | return -1; |
239 | 243 | ||
240 | data_len = skb->len - hdr_len; | 244 | data_len = skb->len - hdr_len; |
241 | len = ieee80211_ccmp_hdr(skb, hdr_len, priv); | 245 | len = ieee80211_ccmp_hdr(skb, hdr_len, NULL, 0, priv); |
242 | if (len < 0) | 246 | if (len < 0) |
243 | return -1; | 247 | return -1; |
244 | 248 | ||
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c index e0988320efbf..93def94c1b32 100644 --- a/net/ieee80211/ieee80211_crypt_tkip.c +++ b/net/ieee80211/ieee80211_crypt_tkip.c | |||
@@ -80,10 +80,9 @@ static void *ieee80211_tkip_init(int key_idx) | |||
80 | { | 80 | { |
81 | struct ieee80211_tkip_data *priv; | 81 | struct ieee80211_tkip_data *priv; |
82 | 82 | ||
83 | priv = kmalloc(sizeof(*priv), GFP_ATOMIC); | 83 | priv = kzalloc(sizeof(*priv), GFP_ATOMIC); |
84 | if (priv == NULL) | 84 | if (priv == NULL) |
85 | goto fail; | 85 | goto fail; |
86 | memset(priv, 0, sizeof(*priv)); | ||
87 | 86 | ||
88 | priv->key_idx = key_idx; | 87 | priv->key_idx = key_idx; |
89 | 88 | ||
@@ -271,34 +270,33 @@ static void tkip_mixing_phase2(u8 * WEPSeed, const u8 * TK, const u16 * TTAK, | |||
271 | #endif | 270 | #endif |
272 | } | 271 | } |
273 | 272 | ||
274 | static u8 *ieee80211_tkip_hdr(struct sk_buff *skb, int hdr_len, void *priv) | 273 | static int ieee80211_tkip_hdr(struct sk_buff *skb, int hdr_len, |
274 | u8 * rc4key, int keylen, void *priv) | ||
275 | { | 275 | { |
276 | struct ieee80211_tkip_data *tkey = priv; | 276 | struct ieee80211_tkip_data *tkey = priv; |
277 | int len; | 277 | int len; |
278 | u8 *rc4key, *pos, *icv; | 278 | u8 *pos; |
279 | struct ieee80211_hdr_4addr *hdr; | 279 | struct ieee80211_hdr_4addr *hdr; |
280 | u32 crc; | ||
281 | 280 | ||
282 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | 281 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
283 | 282 | ||
284 | if (skb_headroom(skb) < 8 || skb->len < hdr_len) | 283 | if (skb_headroom(skb) < 8 || skb->len < hdr_len) |
285 | return NULL; | 284 | return -1; |
285 | |||
286 | if (rc4key == NULL || keylen < 16) | ||
287 | return -1; | ||
286 | 288 | ||
287 | if (!tkey->tx_phase1_done) { | 289 | if (!tkey->tx_phase1_done) { |
288 | tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, | 290 | tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, |
289 | tkey->tx_iv32); | 291 | tkey->tx_iv32); |
290 | tkey->tx_phase1_done = 1; | 292 | tkey->tx_phase1_done = 1; |
291 | } | 293 | } |
292 | rc4key = kmalloc(16, GFP_ATOMIC); | ||
293 | if (!rc4key) | ||
294 | return NULL; | ||
295 | tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); | 294 | tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); |
296 | 295 | ||
297 | len = skb->len - hdr_len; | 296 | len = skb->len - hdr_len; |
298 | pos = skb_push(skb, 8); | 297 | pos = skb_push(skb, 8); |
299 | memmove(pos, pos + 8, hdr_len); | 298 | memmove(pos, pos + 8, hdr_len); |
300 | pos += hdr_len; | 299 | pos += hdr_len; |
301 | icv = skb_put(skb, 4); | ||
302 | 300 | ||
303 | *pos++ = *rc4key; | 301 | *pos++ = *rc4key; |
304 | *pos++ = *(rc4key + 1); | 302 | *pos++ = *(rc4key + 1); |
@@ -309,28 +307,28 @@ static u8 *ieee80211_tkip_hdr(struct sk_buff *skb, int hdr_len, void *priv) | |||
309 | *pos++ = (tkey->tx_iv32 >> 16) & 0xff; | 307 | *pos++ = (tkey->tx_iv32 >> 16) & 0xff; |
310 | *pos++ = (tkey->tx_iv32 >> 24) & 0xff; | 308 | *pos++ = (tkey->tx_iv32 >> 24) & 0xff; |
311 | 309 | ||
312 | crc = ~crc32_le(~0, pos, len); | 310 | tkey->tx_iv16++; |
313 | icv[0] = crc; | 311 | if (tkey->tx_iv16 == 0) { |
314 | icv[1] = crc >> 8; | 312 | tkey->tx_phase1_done = 0; |
315 | icv[2] = crc >> 16; | 313 | tkey->tx_iv32++; |
316 | icv[3] = crc >> 24; | 314 | } |
317 | 315 | ||
318 | return rc4key; | 316 | return 8; |
319 | } | 317 | } |
320 | 318 | ||
321 | static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | 319 | static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) |
322 | { | 320 | { |
323 | struct ieee80211_tkip_data *tkey = priv; | 321 | struct ieee80211_tkip_data *tkey = priv; |
324 | int len; | 322 | int len; |
325 | const u8 *rc4key; | 323 | u8 rc4key[16], *pos, *icv; |
326 | u8 *pos; | 324 | u32 crc; |
327 | struct scatterlist sg; | 325 | struct scatterlist sg; |
328 | 326 | ||
329 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { | 327 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { |
330 | if (net_ratelimit()) { | 328 | if (net_ratelimit()) { |
331 | struct ieee80211_hdr_4addr *hdr = | 329 | struct ieee80211_hdr_4addr *hdr = |
332 | (struct ieee80211_hdr_4addr *)skb->data; | 330 | (struct ieee80211_hdr_4addr *)skb->data; |
333 | printk(KERN_DEBUG "TKIP countermeasures: dropped " | 331 | printk(KERN_DEBUG ": TKIP countermeasures: dropped " |
334 | "TX packet to " MAC_FMT "\n", | 332 | "TX packet to " MAC_FMT "\n", |
335 | MAC_ARG(hdr->addr1)); | 333 | MAC_ARG(hdr->addr1)); |
336 | } | 334 | } |
@@ -343,22 +341,23 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
343 | len = skb->len - hdr_len; | 341 | len = skb->len - hdr_len; |
344 | pos = skb->data + hdr_len; | 342 | pos = skb->data + hdr_len; |
345 | 343 | ||
346 | rc4key = ieee80211_tkip_hdr(skb, hdr_len, priv); | 344 | if ((ieee80211_tkip_hdr(skb, hdr_len, rc4key, 16, priv)) < 0) |
347 | if (!rc4key) | ||
348 | return -1; | 345 | return -1; |
349 | 346 | ||
347 | icv = skb_put(skb, 4); | ||
348 | |||
349 | crc = ~crc32_le(~0, pos, len); | ||
350 | icv[0] = crc; | ||
351 | icv[1] = crc >> 8; | ||
352 | icv[2] = crc >> 16; | ||
353 | icv[3] = crc >> 24; | ||
354 | |||
350 | crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); | 355 | crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); |
351 | sg.page = virt_to_page(pos); | 356 | sg.page = virt_to_page(pos); |
352 | sg.offset = offset_in_page(pos); | 357 | sg.offset = offset_in_page(pos); |
353 | sg.length = len + 4; | 358 | sg.length = len + 4; |
354 | crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4); | 359 | crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4); |
355 | 360 | ||
356 | tkey->tx_iv16++; | ||
357 | if (tkey->tx_iv16 == 0) { | ||
358 | tkey->tx_phase1_done = 0; | ||
359 | tkey->tx_iv32++; | ||
360 | } | ||
361 | |||
362 | return 0; | 361 | return 0; |
363 | } | 362 | } |
364 | 363 | ||
@@ -379,7 +378,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
379 | 378 | ||
380 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { | 379 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { |
381 | if (net_ratelimit()) { | 380 | if (net_ratelimit()) { |
382 | printk(KERN_DEBUG "TKIP countermeasures: dropped " | 381 | printk(KERN_DEBUG ": TKIP countermeasures: dropped " |
383 | "received packet from " MAC_FMT "\n", | 382 | "received packet from " MAC_FMT "\n", |
384 | MAC_ARG(hdr->addr2)); | 383 | MAC_ARG(hdr->addr2)); |
385 | } | 384 | } |
@@ -695,6 +694,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { | |||
695 | .name = "TKIP", | 694 | .name = "TKIP", |
696 | .init = ieee80211_tkip_init, | 695 | .init = ieee80211_tkip_init, |
697 | .deinit = ieee80211_tkip_deinit, | 696 | .deinit = ieee80211_tkip_deinit, |
697 | .build_iv = ieee80211_tkip_hdr, | ||
698 | .encrypt_mpdu = ieee80211_tkip_encrypt, | 698 | .encrypt_mpdu = ieee80211_tkip_encrypt, |
699 | .decrypt_mpdu = ieee80211_tkip_decrypt, | 699 | .decrypt_mpdu = ieee80211_tkip_decrypt, |
700 | .encrypt_msdu = ieee80211_michael_mic_add, | 700 | .encrypt_msdu = ieee80211_michael_mic_add, |
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index f8dca31be5dd..649e581fa565 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c | |||
@@ -76,7 +76,8 @@ static void prism2_wep_deinit(void *priv) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | /* Add WEP IV/key info to a frame that has at least 4 bytes of headroom */ | 78 | /* Add WEP IV/key info to a frame that has at least 4 bytes of headroom */ |
79 | static int prism2_wep_build_iv(struct sk_buff *skb, int hdr_len, void *priv) | 79 | static int prism2_wep_build_iv(struct sk_buff *skb, int hdr_len, |
80 | u8 *key, int keylen, void *priv) | ||
80 | { | 81 | { |
81 | struct prism2_wep_data *wep = priv; | 82 | struct prism2_wep_data *wep = priv; |
82 | u32 klen, len; | 83 | u32 klen, len; |
@@ -131,7 +132,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
131 | return -1; | 132 | return -1; |
132 | 133 | ||
133 | /* add the IV to the frame */ | 134 | /* add the IV to the frame */ |
134 | if (prism2_wep_build_iv(skb, hdr_len, priv)) | 135 | if (prism2_wep_build_iv(skb, hdr_len, NULL, 0, priv)) |
135 | return -1; | 136 | return -1; |
136 | 137 | ||
137 | /* Copy the IV into the first 3 bytes of the key */ | 138 | /* Copy the IV into the first 3 bytes of the key */ |
diff --git a/net/ieee80211/ieee80211_geo.c b/net/ieee80211/ieee80211_geo.c index 610cc5cbc252..3027153940fc 100644 --- a/net/ieee80211/ieee80211_geo.c +++ b/net/ieee80211/ieee80211_geo.c | |||
@@ -58,13 +58,15 @@ int ieee80211_is_valid_channel(struct ieee80211_device *ieee, u8 channel) | |||
58 | * this is a B only channel, we don't see it | 58 | * this is a B only channel, we don't see it |
59 | * as valid. */ | 59 | * as valid. */ |
60 | if ((ieee->geo.bg[i].channel == channel) && | 60 | if ((ieee->geo.bg[i].channel == channel) && |
61 | !(ieee->geo.bg[i].flags & IEEE80211_CH_INVALID) && | ||
61 | (!(ieee->mode & IEEE_G) || | 62 | (!(ieee->mode & IEEE_G) || |
62 | !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) | 63 | !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) |
63 | return IEEE80211_24GHZ_BAND; | 64 | return IEEE80211_24GHZ_BAND; |
64 | 65 | ||
65 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | 66 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) |
66 | for (i = 0; i < ieee->geo.a_channels; i++) | 67 | for (i = 0; i < ieee->geo.a_channels; i++) |
67 | if (ieee->geo.a[i].channel == channel) | 68 | if ((ieee->geo.a[i].channel == channel) && |
69 | !(ieee->geo.a[i].flags & IEEE80211_CH_INVALID)) | ||
68 | return IEEE80211_52GHZ_BAND; | 70 | return IEEE80211_52GHZ_BAND; |
69 | 71 | ||
70 | return 0; | 72 | return 0; |
@@ -133,6 +135,41 @@ const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device *ieee) | |||
133 | return &ieee->geo; | 135 | return &ieee->geo; |
134 | } | 136 | } |
135 | 137 | ||
138 | u8 ieee80211_get_channel_flags(struct ieee80211_device * ieee, u8 channel) | ||
139 | { | ||
140 | int index = ieee80211_channel_to_index(ieee, channel); | ||
141 | |||
142 | if (index == -1) | ||
143 | return IEEE80211_CH_INVALID; | ||
144 | |||
145 | if (channel <= IEEE80211_24GHZ_CHANNELS) | ||
146 | return ieee->geo.bg[index].flags; | ||
147 | |||
148 | return ieee->geo.a[index].flags; | ||
149 | } | ||
150 | |||
151 | static const struct ieee80211_channel bad_channel = { | ||
152 | .channel = 0, | ||
153 | .flags = IEEE80211_CH_INVALID, | ||
154 | .max_power = 0, | ||
155 | }; | ||
156 | |||
157 | const struct ieee80211_channel *ieee80211_get_channel(struct ieee80211_device | ||
158 | *ieee, u8 channel) | ||
159 | { | ||
160 | int index = ieee80211_channel_to_index(ieee, channel); | ||
161 | |||
162 | if (index == -1) | ||
163 | return &bad_channel; | ||
164 | |||
165 | if (channel <= IEEE80211_24GHZ_CHANNELS) | ||
166 | return &ieee->geo.bg[index]; | ||
167 | |||
168 | return &ieee->geo.a[index]; | ||
169 | } | ||
170 | |||
171 | EXPORT_SYMBOL(ieee80211_get_channel); | ||
172 | EXPORT_SYMBOL(ieee80211_get_channel_flags); | ||
136 | EXPORT_SYMBOL(ieee80211_is_valid_channel); | 173 | EXPORT_SYMBOL(ieee80211_is_valid_channel); |
137 | EXPORT_SYMBOL(ieee80211_freq_to_channel); | 174 | EXPORT_SYMBOL(ieee80211_freq_to_channel); |
138 | EXPORT_SYMBOL(ieee80211_channel_to_index); | 175 | EXPORT_SYMBOL(ieee80211_channel_to_index); |
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c index 90d18b72da3d..5f67c684afc2 100644 --- a/net/ieee80211/ieee80211_module.c +++ b/net/ieee80211/ieee80211_module.c | |||
@@ -82,10 +82,28 @@ static int ieee80211_networks_allocate(struct ieee80211_device *ieee) | |||
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | void ieee80211_network_reset(struct ieee80211_network *network) | ||
86 | { | ||
87 | if (!network) | ||
88 | return; | ||
89 | |||
90 | if (network->ibss_dfs) { | ||
91 | kfree(network->ibss_dfs); | ||
92 | network->ibss_dfs = NULL; | ||
93 | } | ||
94 | } | ||
95 | |||
85 | static inline void ieee80211_networks_free(struct ieee80211_device *ieee) | 96 | static inline void ieee80211_networks_free(struct ieee80211_device *ieee) |
86 | { | 97 | { |
98 | int i; | ||
99 | |||
87 | if (!ieee->networks) | 100 | if (!ieee->networks) |
88 | return; | 101 | return; |
102 | |||
103 | for (i = 0; i < MAX_NETWORK_COUNT; i++) | ||
104 | if (ieee->networks[i].ibss_dfs) | ||
105 | kfree(ieee->networks[i].ibss_dfs); | ||
106 | |||
89 | kfree(ieee->networks); | 107 | kfree(ieee->networks); |
90 | ieee->networks = NULL; | 108 | ieee->networks = NULL; |
91 | } | 109 | } |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 960aa78cdb97..fcf4382ef7d7 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -369,8 +369,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
369 | 369 | ||
370 | /* Put this code here so that we avoid duplicating it in all | 370 | /* Put this code here so that we avoid duplicating it in all |
371 | * Rx paths. - Jean II */ | 371 | * Rx paths. - Jean II */ |
372 | #ifdef CONFIG_WIRELESS_EXT | ||
372 | #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ | 373 | #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ |
373 | #ifdef CONFIG_NET_RADIO | ||
374 | /* If spy monitoring on */ | 374 | /* If spy monitoring on */ |
375 | if (ieee->spy_data.spy_number > 0) { | 375 | if (ieee->spy_data.spy_number > 0) { |
376 | struct iw_quality wstats; | 376 | struct iw_quality wstats; |
@@ -397,8 +397,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
397 | /* Update spy records */ | 397 | /* Update spy records */ |
398 | wireless_spy_update(ieee->dev, hdr->addr2, &wstats); | 398 | wireless_spy_update(ieee->dev, hdr->addr2, &wstats); |
399 | } | 399 | } |
400 | #endif /* CONFIG_NET_RADIO */ | ||
401 | #endif /* IW_WIRELESS_SPY */ | 400 | #endif /* IW_WIRELESS_SPY */ |
401 | #endif /* CONFIG_WIRELESS_EXT */ | ||
402 | 402 | ||
403 | #ifdef NOT_YET | 403 | #ifdef NOT_YET |
404 | hostap_update_rx_stats(local->ap, hdr, rx_stats); | 404 | hostap_update_rx_stats(local->ap, hdr, rx_stats); |
@@ -574,7 +574,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
574 | /* skb: hdr + (possibly fragmented) plaintext payload */ | 574 | /* skb: hdr + (possibly fragmented) plaintext payload */ |
575 | // PR: FIXME: hostap has additional conditions in the "if" below: | 575 | // PR: FIXME: hostap has additional conditions in the "if" below: |
576 | // ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && | 576 | // ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && |
577 | if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) { | 577 | if ((frag != 0) || (fc & IEEE80211_FCTL_MOREFRAGS)) { |
578 | int flen; | 578 | int flen; |
579 | struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr); | 579 | struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr); |
580 | IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag); | 580 | IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag); |
@@ -754,7 +754,14 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
754 | memset(skb->cb, 0, sizeof(skb->cb)); | 754 | memset(skb->cb, 0, sizeof(skb->cb)); |
755 | skb->dev = dev; | 755 | skb->dev = dev; |
756 | skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ | 756 | skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ |
757 | netif_rx(skb); | 757 | if (netif_rx(skb) == NET_RX_DROP) { |
758 | /* netif_rx always succeeds, but it might drop | ||
759 | * the packet. If it drops the packet, we log that | ||
760 | * in our stats. */ | ||
761 | IEEE80211_DEBUG_DROP | ||
762 | ("RX: netif_rx dropped the packet\n"); | ||
763 | stats->rx_dropped++; | ||
764 | } | ||
758 | } | 765 | } |
759 | 766 | ||
760 | rx_exit: | 767 | rx_exit: |
@@ -930,6 +937,45 @@ static int ieee80211_parse_qos_info_param_IE(struct ieee80211_info_element | |||
930 | return rc; | 937 | return rc; |
931 | } | 938 | } |
932 | 939 | ||
940 | #ifdef CONFIG_IEEE80211_DEBUG | ||
941 | #define MFIE_STRING(x) case MFIE_TYPE_ ##x: return #x | ||
942 | |||
943 | static const char *get_info_element_string(u16 id) | ||
944 | { | ||
945 | switch (id) { | ||
946 | MFIE_STRING(SSID); | ||
947 | MFIE_STRING(RATES); | ||
948 | MFIE_STRING(FH_SET); | ||
949 | MFIE_STRING(DS_SET); | ||
950 | MFIE_STRING(CF_SET); | ||
951 | MFIE_STRING(TIM); | ||
952 | MFIE_STRING(IBSS_SET); | ||
953 | MFIE_STRING(COUNTRY); | ||
954 | MFIE_STRING(HOP_PARAMS); | ||
955 | MFIE_STRING(HOP_TABLE); | ||
956 | MFIE_STRING(REQUEST); | ||
957 | MFIE_STRING(CHALLENGE); | ||
958 | MFIE_STRING(POWER_CONSTRAINT); | ||
959 | MFIE_STRING(POWER_CAPABILITY); | ||
960 | MFIE_STRING(TPC_REQUEST); | ||
961 | MFIE_STRING(TPC_REPORT); | ||
962 | MFIE_STRING(SUPP_CHANNELS); | ||
963 | MFIE_STRING(CSA); | ||
964 | MFIE_STRING(MEASURE_REQUEST); | ||
965 | MFIE_STRING(MEASURE_REPORT); | ||
966 | MFIE_STRING(QUIET); | ||
967 | MFIE_STRING(IBSS_DFS); | ||
968 | MFIE_STRING(ERP_INFO); | ||
969 | MFIE_STRING(RSN); | ||
970 | MFIE_STRING(RATES_EX); | ||
971 | MFIE_STRING(GENERIC); | ||
972 | MFIE_STRING(QOS_PARAMETER); | ||
973 | default: | ||
974 | return "UNKNOWN"; | ||
975 | } | ||
976 | } | ||
977 | #endif | ||
978 | |||
933 | static int ieee80211_parse_info_param(struct ieee80211_info_element | 979 | static int ieee80211_parse_info_param(struct ieee80211_info_element |
934 | *info_element, u16 length, | 980 | *info_element, u16 length, |
935 | struct ieee80211_network *network) | 981 | struct ieee80211_network *network) |
@@ -1040,7 +1086,9 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1040 | break; | 1086 | break; |
1041 | 1087 | ||
1042 | case MFIE_TYPE_TIM: | 1088 | case MFIE_TYPE_TIM: |
1043 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_TIM: ignored\n"); | 1089 | network->tim.tim_count = info_element->data[0]; |
1090 | network->tim.tim_period = info_element->data[1]; | ||
1091 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_TIM: partially ignored\n"); | ||
1044 | break; | 1092 | break; |
1045 | 1093 | ||
1046 | case MFIE_TYPE_ERP_INFO: | 1094 | case MFIE_TYPE_ERP_INFO: |
@@ -1091,10 +1139,49 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1091 | printk(KERN_ERR | 1139 | printk(KERN_ERR |
1092 | "QoS Error need to parse QOS_PARAMETER IE\n"); | 1140 | "QoS Error need to parse QOS_PARAMETER IE\n"); |
1093 | break; | 1141 | break; |
1142 | /* 802.11h */ | ||
1143 | case MFIE_TYPE_POWER_CONSTRAINT: | ||
1144 | network->power_constraint = info_element->data[0]; | ||
1145 | network->flags |= NETWORK_HAS_POWER_CONSTRAINT; | ||
1146 | break; | ||
1147 | |||
1148 | case MFIE_TYPE_CSA: | ||
1149 | network->power_constraint = info_element->data[0]; | ||
1150 | network->flags |= NETWORK_HAS_CSA; | ||
1151 | break; | ||
1152 | |||
1153 | case MFIE_TYPE_QUIET: | ||
1154 | network->quiet.count = info_element->data[0]; | ||
1155 | network->quiet.period = info_element->data[1]; | ||
1156 | network->quiet.duration = info_element->data[2]; | ||
1157 | network->quiet.offset = info_element->data[3]; | ||
1158 | network->flags |= NETWORK_HAS_QUIET; | ||
1159 | break; | ||
1160 | |||
1161 | case MFIE_TYPE_IBSS_DFS: | ||
1162 | if (network->ibss_dfs) | ||
1163 | break; | ||
1164 | network->ibss_dfs = | ||
1165 | kmalloc(info_element->len, GFP_ATOMIC); | ||
1166 | if (!network->ibss_dfs) | ||
1167 | return 1; | ||
1168 | memcpy(network->ibss_dfs, info_element->data, | ||
1169 | info_element->len); | ||
1170 | network->flags |= NETWORK_HAS_IBSS_DFS; | ||
1171 | break; | ||
1172 | |||
1173 | case MFIE_TYPE_TPC_REPORT: | ||
1174 | network->tpc_report.transmit_power = | ||
1175 | info_element->data[0]; | ||
1176 | network->tpc_report.link_margin = info_element->data[1]; | ||
1177 | network->flags |= NETWORK_HAS_TPC_REPORT; | ||
1178 | break; | ||
1094 | 1179 | ||
1095 | default: | 1180 | default: |
1096 | IEEE80211_DEBUG_MGMT("unsupported IE %d\n", | 1181 | IEEE80211_DEBUG_MGMT |
1097 | info_element->id); | 1182 | ("Unsupported info element: %s (%d)\n", |
1183 | get_info_element_string(info_element->id), | ||
1184 | info_element->id); | ||
1098 | break; | 1185 | break; |
1099 | } | 1186 | } |
1100 | 1187 | ||
@@ -1110,7 +1197,9 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1110 | static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct ieee80211_assoc_response | 1197 | static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct ieee80211_assoc_response |
1111 | *frame, struct ieee80211_rx_stats *stats) | 1198 | *frame, struct ieee80211_rx_stats *stats) |
1112 | { | 1199 | { |
1113 | struct ieee80211_network network_resp; | 1200 | struct ieee80211_network network_resp = { |
1201 | .ibss_dfs = NULL, | ||
1202 | }; | ||
1114 | struct ieee80211_network *network = &network_resp; | 1203 | struct ieee80211_network *network = &network_resp; |
1115 | struct net_device *dev = ieee->dev; | 1204 | struct net_device *dev = ieee->dev; |
1116 | 1205 | ||
@@ -1253,6 +1342,9 @@ static void update_network(struct ieee80211_network *dst, | |||
1253 | int qos_active; | 1342 | int qos_active; |
1254 | u8 old_param; | 1343 | u8 old_param; |
1255 | 1344 | ||
1345 | ieee80211_network_reset(dst); | ||
1346 | dst->ibss_dfs = src->ibss_dfs; | ||
1347 | |||
1256 | memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); | 1348 | memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); |
1257 | dst->capability = src->capability; | 1349 | dst->capability = src->capability; |
1258 | memcpy(dst->rates, src->rates, src->rates_len); | 1350 | memcpy(dst->rates, src->rates, src->rates_len); |
@@ -1269,6 +1361,7 @@ static void update_network(struct ieee80211_network *dst, | |||
1269 | dst->listen_interval = src->listen_interval; | 1361 | dst->listen_interval = src->listen_interval; |
1270 | dst->atim_window = src->atim_window; | 1362 | dst->atim_window = src->atim_window; |
1271 | dst->erp_value = src->erp_value; | 1363 | dst->erp_value = src->erp_value; |
1364 | dst->tim = src->tim; | ||
1272 | 1365 | ||
1273 | memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); | 1366 | memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); |
1274 | dst->wpa_ie_len = src->wpa_ie_len; | 1367 | dst->wpa_ie_len = src->wpa_ie_len; |
@@ -1313,7 +1406,9 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1313 | *stats) | 1406 | *stats) |
1314 | { | 1407 | { |
1315 | struct net_device *dev = ieee->dev; | 1408 | struct net_device *dev = ieee->dev; |
1316 | struct ieee80211_network network; | 1409 | struct ieee80211_network network = { |
1410 | .ibss_dfs = NULL, | ||
1411 | }; | ||
1317 | struct ieee80211_network *target; | 1412 | struct ieee80211_network *target; |
1318 | struct ieee80211_network *oldest = NULL; | 1413 | struct ieee80211_network *oldest = NULL; |
1319 | #ifdef CONFIG_IEEE80211_DEBUG | 1414 | #ifdef CONFIG_IEEE80211_DEBUG |
@@ -1388,6 +1483,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1388 | escape_essid(target->ssid, | 1483 | escape_essid(target->ssid, |
1389 | target->ssid_len), | 1484 | target->ssid_len), |
1390 | MAC_ARG(target->bssid)); | 1485 | MAC_ARG(target->bssid)); |
1486 | ieee80211_network_reset(target); | ||
1391 | } else { | 1487 | } else { |
1392 | /* Otherwise just pull from the free list */ | 1488 | /* Otherwise just pull from the free list */ |
1393 | target = list_entry(ieee->network_free_list.next, | 1489 | target = list_entry(ieee->network_free_list.next, |
@@ -1406,6 +1502,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1406 | "BEACON" : "PROBE RESPONSE"); | 1502 | "BEACON" : "PROBE RESPONSE"); |
1407 | #endif | 1503 | #endif |
1408 | memcpy(target, &network, sizeof(*target)); | 1504 | memcpy(target, &network, sizeof(*target)); |
1505 | network.ibss_dfs = NULL; | ||
1409 | list_add_tail(&target->list, &ieee->network_list); | 1506 | list_add_tail(&target->list, &ieee->network_list); |
1410 | } else { | 1507 | } else { |
1411 | IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n", | 1508 | IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n", |
@@ -1417,6 +1514,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1417 | frame_ctl)) ? | 1514 | frame_ctl)) ? |
1418 | "BEACON" : "PROBE RESPONSE"); | 1515 | "BEACON" : "PROBE RESPONSE"); |
1419 | update_network(target, &network); | 1516 | update_network(target, &network); |
1517 | network.ibss_dfs = NULL; | ||
1420 | } | 1518 | } |
1421 | 1519 | ||
1422 | spin_unlock_irqrestore(&ieee->lock, flags); | 1520 | spin_unlock_irqrestore(&ieee->lock, flags); |
@@ -1501,10 +1599,43 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, | |||
1501 | header); | 1599 | header); |
1502 | break; | 1600 | break; |
1503 | 1601 | ||
1602 | case IEEE80211_STYPE_ACTION: | ||
1603 | IEEE80211_DEBUG_MGMT("ACTION\n"); | ||
1604 | if (ieee->handle_action) | ||
1605 | ieee->handle_action(ieee->dev, | ||
1606 | (struct ieee80211_action *) | ||
1607 | header, stats); | ||
1608 | break; | ||
1609 | |||
1610 | case IEEE80211_STYPE_REASSOC_REQ: | ||
1611 | IEEE80211_DEBUG_MGMT("received reassoc (%d)\n", | ||
1612 | WLAN_FC_GET_STYPE(le16_to_cpu | ||
1613 | (header->frame_ctl))); | ||
1614 | |||
1615 | IEEE80211_WARNING("%s: IEEE80211_REASSOC_REQ received\n", | ||
1616 | ieee->dev->name); | ||
1617 | if (ieee->handle_reassoc_request != NULL) | ||
1618 | ieee->handle_reassoc_request(ieee->dev, | ||
1619 | (struct ieee80211_reassoc_request *) | ||
1620 | header); | ||
1621 | break; | ||
1622 | |||
1623 | case IEEE80211_STYPE_ASSOC_REQ: | ||
1624 | IEEE80211_DEBUG_MGMT("received assoc (%d)\n", | ||
1625 | WLAN_FC_GET_STYPE(le16_to_cpu | ||
1626 | (header->frame_ctl))); | ||
1627 | |||
1628 | IEEE80211_WARNING("%s: IEEE80211_ASSOC_REQ received\n", | ||
1629 | ieee->dev->name); | ||
1630 | if (ieee->handle_assoc_request != NULL) | ||
1631 | ieee->handle_assoc_request(ieee->dev); | ||
1632 | break; | ||
1633 | |||
1504 | case IEEE80211_STYPE_DEAUTH: | 1634 | case IEEE80211_STYPE_DEAUTH: |
1505 | printk("DEAUTH from AP\n"); | 1635 | IEEE80211_DEBUG_MGMT("DEAUTH\n"); |
1506 | if (ieee->handle_deauth != NULL) | 1636 | if (ieee->handle_deauth != NULL) |
1507 | ieee->handle_deauth(ieee->dev, (struct ieee80211_auth *) | 1637 | ieee->handle_deauth(ieee->dev, |
1638 | (struct ieee80211_deauth *) | ||
1508 | header); | 1639 | header); |
1509 | break; | 1640 | break; |
1510 | default: | 1641 | default: |
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index 8fdd943ebe8e..8b4332f53394 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -56,7 +56,18 @@ Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | | |||
56 | `--------------------------------------------------| |------' | 56 | `--------------------------------------------------| |------' |
57 | Total: 28 non-data bytes `----.----' | 57 | Total: 28 non-data bytes `----.----' |
58 | | | 58 | | |
59 | .- 'Frame data' expands to <---------------------------' | 59 | .- 'Frame data' expands, if WEP enabled, to <----------' |
60 | | | ||
61 | V | ||
62 | ,-----------------------. | ||
63 | Bytes | 4 | 0-2296 | 4 | | ||
64 | |-----|-----------|-----| | ||
65 | Desc. | IV | Encrypted | ICV | | ||
66 | | | Packet | | | ||
67 | `-----| |-----' | ||
68 | `-----.-----' | ||
69 | | | ||
70 | .- 'Encrypted Packet' expands to | ||
60 | | | 71 | | |
61 | V | 72 | V |
62 | ,---------------------------------------------------. | 73 | ,---------------------------------------------------. |
@@ -65,18 +76,7 @@ Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | | |||
65 | Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | | 76 | Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | |
66 | | DSAP | SSAP | | | | Packet | | 77 | | DSAP | SSAP | | | | Packet | |
67 | | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | | 78 | | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | |
68 | `-----------------------------------------| | | 79 | `---------------------------------------------------- |
69 | Total: 8 non-data bytes `----.----' | ||
70 | | | ||
71 | .- 'IP Packet' expands, if WEP enabled, to <--' | ||
72 | | | ||
73 | V | ||
74 | ,-----------------------. | ||
75 | Bytes | 4 | 0-2296 | 4 | | ||
76 | |-----|-----------|-----| | ||
77 | Desc. | IV | Encrypted | ICV | | ||
78 | | | IP Packet | | | ||
79 | `-----------------------' | ||
80 | Total: 8 non-data bytes | 80 | Total: 8 non-data bytes |
81 | 81 | ||
82 | 802.3 Ethernet Data Frame | 82 | 802.3 Ethernet Data Frame |
@@ -470,7 +470,9 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
470 | atomic_inc(&crypt->refcnt); | 470 | atomic_inc(&crypt->refcnt); |
471 | if (crypt->ops->build_iv) | 471 | if (crypt->ops->build_iv) |
472 | crypt->ops->build_iv(skb_frag, hdr_len, | 472 | crypt->ops->build_iv(skb_frag, hdr_len, |
473 | crypt->priv); | 473 | ieee->sec.keys[ieee->sec.active_key], |
474 | ieee->sec.key_sizes[ieee->sec.active_key], | ||
475 | crypt->priv); | ||
474 | atomic_dec(&crypt->refcnt); | 476 | atomic_dec(&crypt->refcnt); |
475 | } | 477 | } |
476 | 478 | ||
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index f87c6b89f845..e8c55a4d5834 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -149,9 +149,7 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
149 | iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID | | 149 | iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID | |
150 | IW_QUAL_LEVEL_INVALID; | 150 | IW_QUAL_LEVEL_INVALID; |
151 | iwe.u.qual.qual = 0; | 151 | iwe.u.qual.qual = 0; |
152 | iwe.u.qual.level = 0; | ||
153 | } else { | 152 | } else { |
154 | iwe.u.qual.level = network->stats.rssi; | ||
155 | if (ieee->perfect_rssi == ieee->worst_rssi) | 153 | if (ieee->perfect_rssi == ieee->worst_rssi) |
156 | iwe.u.qual.qual = 100; | 154 | iwe.u.qual.qual = 100; |
157 | else | 155 | else |
@@ -179,6 +177,13 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
179 | iwe.u.qual.noise = network->stats.noise; | 177 | iwe.u.qual.noise = network->stats.noise; |
180 | } | 178 | } |
181 | 179 | ||
180 | if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) { | ||
181 | iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID; | ||
182 | iwe.u.qual.level = 0; | ||
183 | } else { | ||
184 | iwe.u.qual.level = network->stats.signal; | ||
185 | } | ||
186 | |||
182 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); | 187 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); |
183 | 188 | ||
184 | iwe.cmd = IWEVCUSTOM; | 189 | iwe.cmd = IWEVCUSTOM; |
@@ -229,6 +234,28 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
229 | if (iwe.u.data.length) | 234 | if (iwe.u.data.length) |
230 | start = iwe_stream_add_point(start, stop, &iwe, custom); | 235 | start = iwe_stream_add_point(start, stop, &iwe, custom); |
231 | 236 | ||
237 | /* Add spectrum management information */ | ||
238 | iwe.cmd = -1; | ||
239 | p = custom; | ||
240 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Channel flags: "); | ||
241 | |||
242 | if (ieee80211_get_channel_flags(ieee, network->channel) & | ||
243 | IEEE80211_CH_INVALID) { | ||
244 | iwe.cmd = IWEVCUSTOM; | ||
245 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "INVALID "); | ||
246 | } | ||
247 | |||
248 | if (ieee80211_get_channel_flags(ieee, network->channel) & | ||
249 | IEEE80211_CH_RADAR_DETECT) { | ||
250 | iwe.cmd = IWEVCUSTOM; | ||
251 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "DFS "); | ||
252 | } | ||
253 | |||
254 | if (iwe.cmd == IWEVCUSTOM) { | ||
255 | iwe.u.data.length = p - custom; | ||
256 | start = iwe_stream_add_point(start, stop, &iwe, custom); | ||
257 | } | ||
258 | |||
232 | return start; | 259 | return start; |
233 | } | 260 | } |
234 | 261 | ||
@@ -734,9 +761,98 @@ int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, | |||
734 | return 0; | 761 | return 0; |
735 | } | 762 | } |
736 | 763 | ||
764 | int ieee80211_wx_set_auth(struct net_device *dev, | ||
765 | struct iw_request_info *info, | ||
766 | union iwreq_data *wrqu, | ||
767 | char *extra) | ||
768 | { | ||
769 | struct ieee80211_device *ieee = netdev_priv(dev); | ||
770 | unsigned long flags; | ||
771 | int err = 0; | ||
772 | |||
773 | spin_lock_irqsave(&ieee->lock, flags); | ||
774 | |||
775 | switch (wrqu->param.flags & IW_AUTH_INDEX) { | ||
776 | case IW_AUTH_WPA_VERSION: | ||
777 | case IW_AUTH_CIPHER_PAIRWISE: | ||
778 | case IW_AUTH_CIPHER_GROUP: | ||
779 | case IW_AUTH_KEY_MGMT: | ||
780 | /* | ||
781 | * Host AP driver does not use these parameters and allows | ||
782 | * wpa_supplicant to control them internally. | ||
783 | */ | ||
784 | break; | ||
785 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
786 | break; /* FIXME */ | ||
787 | case IW_AUTH_DROP_UNENCRYPTED: | ||
788 | ieee->drop_unencrypted = !!wrqu->param.value; | ||
789 | break; | ||
790 | case IW_AUTH_80211_AUTH_ALG: | ||
791 | break; /* FIXME */ | ||
792 | case IW_AUTH_WPA_ENABLED: | ||
793 | ieee->privacy_invoked = ieee->wpa_enabled = !!wrqu->param.value; | ||
794 | break; | ||
795 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
796 | ieee->ieee802_1x = !!wrqu->param.value; | ||
797 | break; | ||
798 | case IW_AUTH_PRIVACY_INVOKED: | ||
799 | ieee->privacy_invoked = !!wrqu->param.value; | ||
800 | break; | ||
801 | default: | ||
802 | err = -EOPNOTSUPP; | ||
803 | break; | ||
804 | } | ||
805 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
806 | return err; | ||
807 | } | ||
808 | |||
809 | int ieee80211_wx_get_auth(struct net_device *dev, | ||
810 | struct iw_request_info *info, | ||
811 | union iwreq_data *wrqu, | ||
812 | char *extra) | ||
813 | { | ||
814 | struct ieee80211_device *ieee = netdev_priv(dev); | ||
815 | unsigned long flags; | ||
816 | int err = 0; | ||
817 | |||
818 | spin_lock_irqsave(&ieee->lock, flags); | ||
819 | |||
820 | switch (wrqu->param.flags & IW_AUTH_INDEX) { | ||
821 | case IW_AUTH_WPA_VERSION: | ||
822 | case IW_AUTH_CIPHER_PAIRWISE: | ||
823 | case IW_AUTH_CIPHER_GROUP: | ||
824 | case IW_AUTH_KEY_MGMT: | ||
825 | case IW_AUTH_TKIP_COUNTERMEASURES: /* FIXME */ | ||
826 | case IW_AUTH_80211_AUTH_ALG: /* FIXME */ | ||
827 | /* | ||
828 | * Host AP driver does not use these parameters and allows | ||
829 | * wpa_supplicant to control them internally. | ||
830 | */ | ||
831 | err = -EOPNOTSUPP; | ||
832 | break; | ||
833 | case IW_AUTH_DROP_UNENCRYPTED: | ||
834 | wrqu->param.value = ieee->drop_unencrypted; | ||
835 | break; | ||
836 | case IW_AUTH_WPA_ENABLED: | ||
837 | wrqu->param.value = ieee->wpa_enabled; | ||
838 | break; | ||
839 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
840 | wrqu->param.value = ieee->ieee802_1x; | ||
841 | break; | ||
842 | default: | ||
843 | err = -EOPNOTSUPP; | ||
844 | break; | ||
845 | } | ||
846 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
847 | return err; | ||
848 | } | ||
849 | |||
737 | EXPORT_SYMBOL(ieee80211_wx_set_encodeext); | 850 | EXPORT_SYMBOL(ieee80211_wx_set_encodeext); |
738 | EXPORT_SYMBOL(ieee80211_wx_get_encodeext); | 851 | EXPORT_SYMBOL(ieee80211_wx_get_encodeext); |
739 | 852 | ||
740 | EXPORT_SYMBOL(ieee80211_wx_get_scan); | 853 | EXPORT_SYMBOL(ieee80211_wx_get_scan); |
741 | EXPORT_SYMBOL(ieee80211_wx_set_encode); | 854 | EXPORT_SYMBOL(ieee80211_wx_set_encode); |
742 | EXPORT_SYMBOL(ieee80211_wx_get_encode); | 855 | EXPORT_SYMBOL(ieee80211_wx_get_encode); |
856 | |||
857 | EXPORT_SYMBOL_GPL(ieee80211_wx_set_auth); | ||
858 | EXPORT_SYMBOL_GPL(ieee80211_wx_get_auth); | ||
diff --git a/net/socket.c b/net/socket.c index a00851f981db..7e1bdef8b09e 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -84,10 +84,7 @@ | |||
84 | #include <linux/compat.h> | 84 | #include <linux/compat.h> |
85 | #include <linux/kmod.h> | 85 | #include <linux/kmod.h> |
86 | #include <linux/audit.h> | 86 | #include <linux/audit.h> |
87 | 87 | #include <linux/wireless.h> | |
88 | #ifdef CONFIG_NET_RADIO | ||
89 | #include <linux/wireless.h> /* Note : will define WIRELESS_EXT */ | ||
90 | #endif /* CONFIG_NET_RADIO */ | ||
91 | 88 | ||
92 | #include <asm/uaccess.h> | 89 | #include <asm/uaccess.h> |
93 | #include <asm/unistd.h> | 90 | #include <asm/unistd.h> |
@@ -840,11 +837,11 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
840 | if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { | 837 | if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { |
841 | err = dev_ioctl(cmd, argp); | 838 | err = dev_ioctl(cmd, argp); |
842 | } else | 839 | } else |
843 | #ifdef WIRELESS_EXT | 840 | #ifdef CONFIG_WIRELESS_EXT |
844 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { | 841 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { |
845 | err = dev_ioctl(cmd, argp); | 842 | err = dev_ioctl(cmd, argp); |
846 | } else | 843 | } else |
847 | #endif /* WIRELESS_EXT */ | 844 | #endif /* CONFIG_WIRELESS_EXT */ |
848 | switch (cmd) { | 845 | switch (cmd) { |
849 | case FIOSETOWN: | 846 | case FIOSETOWN: |
850 | case SIOCSPGRP: | 847 | case SIOCSPGRP: |