diff options
64 files changed, 985 insertions, 1654 deletions
diff --git a/arch/ppc/platforms/hdpu.c b/arch/ppc/platforms/hdpu.c index 50039a204c..f945416960 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 9e1fe2e047..b40885d416 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 7488ee7f7c..3dde1df334 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> |
@@ -2717,7 +2718,7 @@ boomerang_rx(struct net_device *dev) | |||
2717 | skb = dev_alloc_skb(PKT_BUF_SZ); | 2718 | skb = dev_alloc_skb(PKT_BUF_SZ); |
2718 | if (skb == NULL) { | 2719 | if (skb == NULL) { |
2719 | static unsigned long last_jif; | 2720 | static unsigned long last_jif; |
2720 | if ((jiffies - last_jif) > 10 * HZ) { | 2721 | if (time_after(jiffies, last_jif + 10 * HZ)) { |
2721 | printk(KERN_WARNING "%s: memory shortage\n", dev->name); | 2722 | printk(KERN_WARNING "%s: memory shortage\n", dev->name); |
2722 | last_jif = jiffies; | 2723 | last_jif = jiffies; |
2723 | } | 2724 | } |
diff --git a/drivers/net/apne.c b/drivers/net/apne.c index a94216b871..b9820b86cd 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 e1ea29b0cd..e7555d4e6f 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/arcnet.c b/drivers/net/arcnet/arcnet.c index 12ef52c193..64e2caf308 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/rfc1051.c b/drivers/net/arcnet/rfc1051.c index 6d7913704f..6d6c69f036 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 6b6ae4bf3d..bee34226ab 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 6a93b666eb..d52deb8d20 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 f32a6b3acb..b67545be2c 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/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index e4188d082f..9220de9f4f 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 55c7ed6083..a37b82ebca 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); |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 7ef4b0434a..df57201859 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -79,10 +79,15 @@ | |||
79 | #define PHY_WAIT_MICRO_SECONDS 10 | 79 | #define PHY_WAIT_MICRO_SECONDS 10 |
80 | 80 | ||
81 | /* Static function declarations */ | 81 | /* Static function declarations */ |
82 | static int eth_port_link_is_up(unsigned int eth_port_num); | ||
83 | static void eth_port_uc_addr_get(struct net_device *dev, | 82 | static void eth_port_uc_addr_get(struct net_device *dev, |
84 | unsigned char *MacAddr); | 83 | unsigned char *MacAddr); |
85 | static void eth_port_set_multicast_list(struct net_device *); | 84 | static void eth_port_set_multicast_list(struct net_device *); |
85 | static void mv643xx_eth_port_enable_tx(unsigned int port_num, | ||
86 | unsigned int channels); | ||
87 | static void mv643xx_eth_port_enable_rx(unsigned int port_num, | ||
88 | unsigned int channels); | ||
89 | static unsigned int mv643xx_eth_port_disable_tx(unsigned int port_num); | ||
90 | static unsigned int mv643xx_eth_port_disable_rx(unsigned int port_num); | ||
86 | static int mv643xx_eth_open(struct net_device *); | 91 | static int mv643xx_eth_open(struct net_device *); |
87 | static int mv643xx_eth_stop(struct net_device *); | 92 | static int mv643xx_eth_stop(struct net_device *); |
88 | static int mv643xx_eth_change_mtu(struct net_device *, int); | 93 | static int mv643xx_eth_change_mtu(struct net_device *, int); |
@@ -91,8 +96,12 @@ static void eth_port_init_mac_tables(unsigned int eth_port_num); | |||
91 | #ifdef MV643XX_NAPI | 96 | #ifdef MV643XX_NAPI |
92 | static int mv643xx_poll(struct net_device *dev, int *budget); | 97 | static int mv643xx_poll(struct net_device *dev, int *budget); |
93 | #endif | 98 | #endif |
99 | static int ethernet_phy_get(unsigned int eth_port_num); | ||
94 | static void ethernet_phy_set(unsigned int eth_port_num, int phy_addr); | 100 | static void ethernet_phy_set(unsigned int eth_port_num, int phy_addr); |
95 | static int ethernet_phy_detect(unsigned int eth_port_num); | 101 | static int ethernet_phy_detect(unsigned int eth_port_num); |
102 | static int mv643xx_mdio_read(struct net_device *dev, int phy_id, int location); | ||
103 | static void mv643xx_mdio_write(struct net_device *dev, int phy_id, int location, int val); | ||
104 | static int mv643xx_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | ||
96 | static struct ethtool_ops mv643xx_ethtool_ops; | 105 | static struct ethtool_ops mv643xx_ethtool_ops; |
97 | 106 | ||
98 | static char mv643xx_driver_name[] = "mv643xx_eth"; | 107 | static char mv643xx_driver_name[] = "mv643xx_eth"; |
@@ -169,11 +178,11 @@ static void mv643xx_eth_rx_task(void *data) | |||
169 | if (test_and_set_bit(0, &mp->rx_task_busy)) | 178 | if (test_and_set_bit(0, &mp->rx_task_busy)) |
170 | panic("%s: Error in test_set_bit / clear_bit", dev->name); | 179 | panic("%s: Error in test_set_bit / clear_bit", dev->name); |
171 | 180 | ||
172 | while (mp->rx_ring_skbs < (mp->rx_ring_size - 5)) { | 181 | while (mp->rx_desc_count < (mp->rx_ring_size - 5)) { |
173 | skb = dev_alloc_skb(RX_SKB_SIZE + DMA_ALIGN); | 182 | skb = dev_alloc_skb(RX_SKB_SIZE + DMA_ALIGN); |
174 | if (!skb) | 183 | if (!skb) |
175 | break; | 184 | break; |
176 | mp->rx_ring_skbs++; | 185 | mp->rx_desc_count++; |
177 | unaligned = (u32)skb->data & (DMA_ALIGN - 1); | 186 | unaligned = (u32)skb->data & (DMA_ALIGN - 1); |
178 | if (unaligned) | 187 | if (unaligned) |
179 | skb_reserve(skb, DMA_ALIGN - unaligned); | 188 | skb_reserve(skb, DMA_ALIGN - unaligned); |
@@ -194,7 +203,7 @@ static void mv643xx_eth_rx_task(void *data) | |||
194 | * If RX ring is empty of SKB, set a timer to try allocating | 203 | * If RX ring is empty of SKB, set a timer to try allocating |
195 | * again in a later time . | 204 | * again in a later time . |
196 | */ | 205 | */ |
197 | if ((mp->rx_ring_skbs == 0) && (mp->rx_timer_flag == 0)) { | 206 | if ((mp->rx_desc_count == 0) && (mp->rx_timer_flag == 0)) { |
198 | printk(KERN_INFO "%s: Rx ring is empty\n", dev->name); | 207 | printk(KERN_INFO "%s: Rx ring is empty\n", dev->name); |
199 | /* After 100mSec */ | 208 | /* After 100mSec */ |
200 | mp->timeout.expires = jiffies + (HZ / 10); | 209 | mp->timeout.expires = jiffies + (HZ / 10); |
@@ -243,8 +252,7 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev) | |||
243 | unsigned int port_num = mp->port_num; | 252 | unsigned int port_num = mp->port_num; |
244 | 253 | ||
245 | eth_port_init_mac_tables(port_num); | 254 | eth_port_init_mac_tables(port_num); |
246 | memcpy(mp->port_mac_addr, dev->dev_addr, 6); | 255 | eth_port_uc_addr_set(port_num, dev->dev_addr); |
247 | eth_port_uc_addr_set(port_num, mp->port_mac_addr); | ||
248 | } | 256 | } |
249 | 257 | ||
250 | /* | 258 | /* |
@@ -258,13 +266,14 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev) | |||
258 | static void mv643xx_eth_set_rx_mode(struct net_device *dev) | 266 | static void mv643xx_eth_set_rx_mode(struct net_device *dev) |
259 | { | 267 | { |
260 | struct mv643xx_private *mp = netdev_priv(dev); | 268 | struct mv643xx_private *mp = netdev_priv(dev); |
269 | u32 config_reg; | ||
261 | 270 | ||
271 | config_reg = mv_read(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num)); | ||
262 | if (dev->flags & IFF_PROMISC) | 272 | if (dev->flags & IFF_PROMISC) |
263 | mp->port_config |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; | 273 | config_reg |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; |
264 | else | 274 | else |
265 | mp->port_config &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; | 275 | config_reg &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; |
266 | 276 | mv_write(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num), config_reg); | |
267 | mv_write(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num), mp->port_config); | ||
268 | 277 | ||
269 | eth_port_set_multicast_list(dev); | 278 | eth_port_set_multicast_list(dev); |
270 | } | 279 | } |
@@ -320,7 +329,7 @@ static void mv643xx_eth_tx_timeout_task(struct net_device *dev) | |||
320 | 329 | ||
321 | netif_device_detach(dev); | 330 | netif_device_detach(dev); |
322 | eth_port_reset(mp->port_num); | 331 | eth_port_reset(mp->port_num); |
323 | eth_port_start(mp); | 332 | eth_port_start(dev); |
324 | netif_device_attach(dev); | 333 | netif_device_attach(dev); |
325 | } | 334 | } |
326 | 335 | ||
@@ -395,7 +404,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) | |||
395 | #else | 404 | #else |
396 | while (eth_port_receive(mp, &pkt_info) == ETH_OK) { | 405 | while (eth_port_receive(mp, &pkt_info) == ETH_OK) { |
397 | #endif | 406 | #endif |
398 | mp->rx_ring_skbs--; | 407 | mp->rx_desc_count--; |
399 | received_packets++; | 408 | received_packets++; |
400 | 409 | ||
401 | /* Update statistics. Note byte count includes 4 byte CRC count */ | 410 | /* Update statistics. Note byte count includes 4 byte CRC count */ |
@@ -450,6 +459,56 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) | |||
450 | return received_packets; | 459 | return received_packets; |
451 | } | 460 | } |
452 | 461 | ||
462 | /* Set the mv643xx port configuration register for the speed/duplex mode. */ | ||
463 | static void mv643xx_eth_update_pscr(struct net_device *dev, | ||
464 | struct ethtool_cmd *ecmd) | ||
465 | { | ||
466 | struct mv643xx_private *mp = netdev_priv(dev); | ||
467 | int port_num = mp->port_num; | ||
468 | u32 o_pscr, n_pscr; | ||
469 | unsigned int channels; | ||
470 | |||
471 | o_pscr = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); | ||
472 | n_pscr = o_pscr; | ||
473 | |||
474 | /* clear speed, duplex and rx buffer size fields */ | ||
475 | n_pscr &= ~(MV643XX_ETH_SET_MII_SPEED_TO_100 | | ||
476 | MV643XX_ETH_SET_GMII_SPEED_TO_1000 | | ||
477 | MV643XX_ETH_SET_FULL_DUPLEX_MODE | | ||
478 | MV643XX_ETH_MAX_RX_PACKET_MASK); | ||
479 | |||
480 | if (ecmd->duplex == DUPLEX_FULL) | ||
481 | n_pscr |= MV643XX_ETH_SET_FULL_DUPLEX_MODE; | ||
482 | |||
483 | if (ecmd->speed == SPEED_1000) | ||
484 | n_pscr |= MV643XX_ETH_SET_GMII_SPEED_TO_1000 | | ||
485 | MV643XX_ETH_MAX_RX_PACKET_9700BYTE; | ||
486 | else { | ||
487 | if (ecmd->speed == SPEED_100) | ||
488 | n_pscr |= MV643XX_ETH_SET_MII_SPEED_TO_100; | ||
489 | n_pscr |= MV643XX_ETH_MAX_RX_PACKET_1522BYTE; | ||
490 | } | ||
491 | |||
492 | if (n_pscr != o_pscr) { | ||
493 | if ((o_pscr & MV643XX_ETH_SERIAL_PORT_ENABLE) == 0) | ||
494 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | ||
495 | n_pscr); | ||
496 | else { | ||
497 | channels = mv643xx_eth_port_disable_tx(port_num); | ||
498 | |||
499 | o_pscr &= ~MV643XX_ETH_SERIAL_PORT_ENABLE; | ||
500 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | ||
501 | o_pscr); | ||
502 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | ||
503 | n_pscr); | ||
504 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | ||
505 | n_pscr); | ||
506 | if (channels) | ||
507 | mv643xx_eth_port_enable_tx(port_num, channels); | ||
508 | } | ||
509 | } | ||
510 | } | ||
511 | |||
453 | /* | 512 | /* |
454 | * mv643xx_eth_int_handler | 513 | * mv643xx_eth_int_handler |
455 | * | 514 | * |
@@ -495,7 +554,7 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, | |||
495 | /* UDP change : We may need this */ | 554 | /* UDP change : We may need this */ |
496 | if ((eth_int_cause_ext & 0x0000ffff) && | 555 | if ((eth_int_cause_ext & 0x0000ffff) && |
497 | (mv643xx_eth_free_tx_queue(dev, eth_int_cause_ext) == 0) && | 556 | (mv643xx_eth_free_tx_queue(dev, eth_int_cause_ext) == 0) && |
498 | (mp->tx_ring_size > mp->tx_ring_skbs + MAX_DESCS_PER_SKB)) | 557 | (mp->tx_ring_size > mp->tx_desc_count + MAX_DESCS_PER_SKB)) |
499 | netif_wake_queue(dev); | 558 | netif_wake_queue(dev); |
500 | #ifdef MV643XX_NAPI | 559 | #ifdef MV643XX_NAPI |
501 | } else { | 560 | } else { |
@@ -532,15 +591,23 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, | |||
532 | } | 591 | } |
533 | /* PHY status changed */ | 592 | /* PHY status changed */ |
534 | if (eth_int_cause_ext & (BIT16 | BIT20)) { | 593 | if (eth_int_cause_ext & (BIT16 | BIT20)) { |
535 | if (eth_port_link_is_up(port_num)) { | 594 | struct ethtool_cmd cmd; |
536 | netif_carrier_on(dev); | 595 | |
537 | netif_wake_queue(dev); | 596 | if (mii_link_ok(&mp->mii)) { |
538 | /* Start TX queue */ | 597 | mii_ethtool_gset(&mp->mii, &cmd); |
539 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG | 598 | mv643xx_eth_update_pscr(dev, &cmd); |
540 | (port_num), 1); | 599 | if (!netif_carrier_ok(dev)) { |
541 | } else { | 600 | netif_carrier_on(dev); |
542 | netif_carrier_off(dev); | 601 | if (mp->tx_ring_size > mp->tx_desc_count + |
602 | MAX_DESCS_PER_SKB) { | ||
603 | netif_wake_queue(dev); | ||
604 | /* Start TX queue */ | ||
605 | mv643xx_eth_port_enable_tx(port_num, mp->port_tx_queue_command); | ||
606 | } | ||
607 | } | ||
608 | } else if (netif_carrier_ok(dev)) { | ||
543 | netif_stop_queue(dev); | 609 | netif_stop_queue(dev); |
610 | netif_carrier_off(dev); | ||
544 | } | 611 | } |
545 | } | 612 | } |
546 | 613 | ||
@@ -669,8 +736,8 @@ static void ether_init_rx_desc_ring(struct mv643xx_private *mp) | |||
669 | 736 | ||
670 | mp->rx_desc_area_size = rx_desc_num * sizeof(struct eth_rx_desc); | 737 | mp->rx_desc_area_size = rx_desc_num * sizeof(struct eth_rx_desc); |
671 | 738 | ||
672 | /* Add the queue to the list of RX queues of this port */ | 739 | /* Enable queue 0 for this port */ |
673 | mp->port_rx_queue_command |= 1; | 740 | mp->port_rx_queue_command = 1; |
674 | } | 741 | } |
675 | 742 | ||
676 | /* | 743 | /* |
@@ -716,8 +783,36 @@ static void ether_init_tx_desc_ring(struct mv643xx_private *mp) | |||
716 | 783 | ||
717 | mp->tx_desc_area_size = tx_desc_num * sizeof(struct eth_tx_desc); | 784 | mp->tx_desc_area_size = tx_desc_num * sizeof(struct eth_tx_desc); |
718 | 785 | ||
719 | /* Add the queue to the list of Tx queues of this port */ | 786 | /* Enable queue 0 for this port */ |
720 | mp->port_tx_queue_command |= 1; | 787 | mp->port_tx_queue_command = 1; |
788 | } | ||
789 | |||
790 | static int mv643xx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
791 | { | ||
792 | struct mv643xx_private *mp = netdev_priv(dev); | ||
793 | int err; | ||
794 | |||
795 | spin_lock_irq(&mp->lock); | ||
796 | err = mii_ethtool_sset(&mp->mii, cmd); | ||
797 | spin_unlock_irq(&mp->lock); | ||
798 | |||
799 | return err; | ||
800 | } | ||
801 | |||
802 | static int mv643xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
803 | { | ||
804 | struct mv643xx_private *mp = netdev_priv(dev); | ||
805 | int err; | ||
806 | |||
807 | spin_lock_irq(&mp->lock); | ||
808 | err = mii_ethtool_gset(&mp->mii, cmd); | ||
809 | spin_unlock_irq(&mp->lock); | ||
810 | |||
811 | /* The PHY may support 1000baseT_Half, but the mv643xx does not */ | ||
812 | cmd->supported &= ~SUPPORTED_1000baseT_Half; | ||
813 | cmd->advertising &= ~ADVERTISED_1000baseT_Half; | ||
814 | |||
815 | return err; | ||
721 | } | 816 | } |
722 | 817 | ||
723 | /* | 818 | /* |
@@ -748,12 +843,6 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
748 | return -EAGAIN; | 843 | return -EAGAIN; |
749 | } | 844 | } |
750 | 845 | ||
751 | /* Stop RX Queues */ | ||
752 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), 0x0000ff00); | ||
753 | |||
754 | /* Set the MAC Address */ | ||
755 | memcpy(mp->port_mac_addr, dev->dev_addr, 6); | ||
756 | |||
757 | eth_port_init(mp); | 846 | eth_port_init(mp); |
758 | 847 | ||
759 | INIT_WORK(&mp->rx_task, (void (*)(void *))mv643xx_eth_rx_task, dev); | 848 | INIT_WORK(&mp->rx_task, (void (*)(void *))mv643xx_eth_rx_task, dev); |
@@ -782,7 +871,7 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
782 | } | 871 | } |
783 | 872 | ||
784 | /* Allocate TX ring */ | 873 | /* Allocate TX ring */ |
785 | mp->tx_ring_skbs = 0; | 874 | mp->tx_desc_count = 0; |
786 | size = mp->tx_ring_size * sizeof(struct eth_tx_desc); | 875 | size = mp->tx_ring_size * sizeof(struct eth_tx_desc); |
787 | mp->tx_desc_area_size = size; | 876 | mp->tx_desc_area_size = size; |
788 | 877 | ||
@@ -807,7 +896,7 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
807 | ether_init_tx_desc_ring(mp); | 896 | ether_init_tx_desc_ring(mp); |
808 | 897 | ||
809 | /* Allocate RX ring */ | 898 | /* Allocate RX ring */ |
810 | mp->rx_ring_skbs = 0; | 899 | mp->rx_desc_count = 0; |
811 | size = mp->rx_ring_size * sizeof(struct eth_rx_desc); | 900 | size = mp->rx_ring_size * sizeof(struct eth_rx_desc); |
812 | mp->rx_desc_area_size = size; | 901 | mp->rx_desc_area_size = size; |
813 | 902 | ||
@@ -839,7 +928,11 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
839 | 928 | ||
840 | mv643xx_eth_rx_task(dev); /* Fill RX ring with skb's */ | 929 | mv643xx_eth_rx_task(dev); /* Fill RX ring with skb's */ |
841 | 930 | ||
842 | eth_port_start(mp); | 931 | /* Clear any pending ethernet port interrupts */ |
932 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0); | ||
933 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0); | ||
934 | |||
935 | eth_port_start(dev); | ||
843 | 936 | ||
844 | /* Interrupt Coalescing */ | 937 | /* Interrupt Coalescing */ |
845 | 938 | ||
@@ -851,16 +944,13 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
851 | mp->tx_int_coal = | 944 | mp->tx_int_coal = |
852 | eth_port_set_tx_coal(port_num, 133000000, MV643XX_TX_COAL); | 945 | eth_port_set_tx_coal(port_num, 133000000, MV643XX_TX_COAL); |
853 | 946 | ||
854 | /* Clear any pending ethernet port interrupts */ | ||
855 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0); | ||
856 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0); | ||
857 | |||
858 | /* Unmask phy and link status changes interrupts */ | 947 | /* Unmask phy and link status changes interrupts */ |
859 | mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port_num), | 948 | mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port_num), |
860 | INT_UNMASK_ALL_EXT); | 949 | INT_UNMASK_ALL_EXT); |
861 | 950 | ||
862 | /* Unmask RX buffer and TX end interrupt */ | 951 | /* Unmask RX buffer and TX end interrupt */ |
863 | mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), INT_UNMASK_ALL); | 952 | mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), INT_UNMASK_ALL); |
953 | |||
864 | return 0; | 954 | return 0; |
865 | 955 | ||
866 | out_free_tx_skb: | 956 | out_free_tx_skb: |
@@ -881,20 +971,20 @@ static void mv643xx_eth_free_tx_rings(struct net_device *dev) | |||
881 | struct sk_buff *skb; | 971 | struct sk_buff *skb; |
882 | 972 | ||
883 | /* Stop Tx Queues */ | 973 | /* Stop Tx Queues */ |
884 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), 0x0000ff00); | 974 | mv643xx_eth_port_disable_tx(port_num); |
885 | 975 | ||
886 | /* Free outstanding skb's on TX rings */ | 976 | /* Free outstanding skb's on TX rings */ |
887 | for (curr = 0; mp->tx_ring_skbs && curr < mp->tx_ring_size; curr++) { | 977 | for (curr = 0; mp->tx_desc_count && curr < mp->tx_ring_size; curr++) { |
888 | skb = mp->tx_skb[curr]; | 978 | skb = mp->tx_skb[curr]; |
889 | if (skb) { | 979 | if (skb) { |
890 | mp->tx_ring_skbs -= skb_shinfo(skb)->nr_frags; | 980 | mp->tx_desc_count -= skb_shinfo(skb)->nr_frags; |
891 | dev_kfree_skb(skb); | 981 | dev_kfree_skb(skb); |
892 | mp->tx_ring_skbs--; | 982 | mp->tx_desc_count--; |
893 | } | 983 | } |
894 | } | 984 | } |
895 | if (mp->tx_ring_skbs) | 985 | if (mp->tx_desc_count) |
896 | printk("%s: Error on Tx descriptor free - could not free %d" | 986 | printk("%s: Error on Tx descriptor free - could not free %d" |
897 | " descriptors\n", dev->name, mp->tx_ring_skbs); | 987 | " descriptors\n", dev->name, mp->tx_desc_count); |
898 | 988 | ||
899 | /* Free TX ring */ | 989 | /* Free TX ring */ |
900 | if (mp->tx_sram_size) | 990 | if (mp->tx_sram_size) |
@@ -911,21 +1001,21 @@ static void mv643xx_eth_free_rx_rings(struct net_device *dev) | |||
911 | int curr; | 1001 | int curr; |
912 | 1002 | ||
913 | /* Stop RX Queues */ | 1003 | /* Stop RX Queues */ |
914 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), 0x0000ff00); | 1004 | mv643xx_eth_port_disable_rx(port_num); |
915 | 1005 | ||
916 | /* Free preallocated skb's on RX rings */ | 1006 | /* Free preallocated skb's on RX rings */ |
917 | for (curr = 0; mp->rx_ring_skbs && curr < mp->rx_ring_size; curr++) { | 1007 | for (curr = 0; mp->rx_desc_count && curr < mp->rx_ring_size; curr++) { |
918 | if (mp->rx_skb[curr]) { | 1008 | if (mp->rx_skb[curr]) { |
919 | dev_kfree_skb(mp->rx_skb[curr]); | 1009 | dev_kfree_skb(mp->rx_skb[curr]); |
920 | mp->rx_ring_skbs--; | 1010 | mp->rx_desc_count--; |
921 | } | 1011 | } |
922 | } | 1012 | } |
923 | 1013 | ||
924 | if (mp->rx_ring_skbs) | 1014 | if (mp->rx_desc_count) |
925 | printk(KERN_ERR | 1015 | printk(KERN_ERR |
926 | "%s: Error in freeing Rx Ring. %d skb's still" | 1016 | "%s: Error in freeing Rx Ring. %d skb's still" |
927 | " stuck in RX Ring - ignoring them\n", dev->name, | 1017 | " stuck in RX Ring - ignoring them\n", dev->name, |
928 | mp->rx_ring_skbs); | 1018 | mp->rx_desc_count); |
929 | /* Free RX ring */ | 1019 | /* Free RX ring */ |
930 | if (mp->rx_sram_size) | 1020 | if (mp->rx_sram_size) |
931 | iounmap(mp->p_rx_desc_area); | 1021 | iounmap(mp->p_rx_desc_area); |
@@ -995,7 +1085,8 @@ static void mv643xx_tx(struct net_device *dev) | |||
995 | } | 1085 | } |
996 | 1086 | ||
997 | if (netif_queue_stopped(dev) && | 1087 | if (netif_queue_stopped(dev) && |
998 | mp->tx_ring_size > mp->tx_ring_skbs + MAX_DESCS_PER_SKB) | 1088 | mp->tx_ring_size > |
1089 | mp->tx_desc_count + MAX_DESCS_PER_SKB) | ||
999 | netif_wake_queue(dev); | 1090 | netif_wake_queue(dev); |
1000 | } | 1091 | } |
1001 | 1092 | ||
@@ -1087,7 +1178,7 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1087 | } | 1178 | } |
1088 | 1179 | ||
1089 | /* This is a hard error, log it. */ | 1180 | /* This is a hard error, log it. */ |
1090 | if ((mp->tx_ring_size - mp->tx_ring_skbs) <= | 1181 | if ((mp->tx_ring_size - mp->tx_desc_count) <= |
1091 | (skb_shinfo(skb)->nr_frags + 1)) { | 1182 | (skb_shinfo(skb)->nr_frags + 1)) { |
1092 | netif_stop_queue(dev); | 1183 | netif_stop_queue(dev); |
1093 | printk(KERN_ERR | 1184 | printk(KERN_ERR |
@@ -1264,7 +1355,7 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1264 | /* Check if TX queue can handle another skb. If not, then | 1355 | /* Check if TX queue can handle another skb. If not, then |
1265 | * signal higher layers to stop requesting TX | 1356 | * signal higher layers to stop requesting TX |
1266 | */ | 1357 | */ |
1267 | if (mp->tx_ring_size <= (mp->tx_ring_skbs + MAX_DESCS_PER_SKB)) | 1358 | if (mp->tx_ring_size <= (mp->tx_desc_count + MAX_DESCS_PER_SKB)) |
1268 | /* | 1359 | /* |
1269 | * Stop getting skb's from upper layers. | 1360 | * Stop getting skb's from upper layers. |
1270 | * Getting skb's from upper layers will be enabled again after | 1361 | * Getting skb's from upper layers will be enabled again after |
@@ -1314,6 +1405,35 @@ static void mv643xx_netpoll(struct net_device *netdev) | |||
1314 | } | 1405 | } |
1315 | #endif | 1406 | #endif |
1316 | 1407 | ||
1408 | static void mv643xx_init_ethtool_cmd(struct net_device *dev, int phy_address, | ||
1409 | int speed, int duplex, | ||
1410 | struct ethtool_cmd *cmd) | ||
1411 | { | ||
1412 | struct mv643xx_private *mp = netdev_priv(dev); | ||
1413 | |||
1414 | memset(cmd, 0, sizeof(*cmd)); | ||
1415 | |||
1416 | cmd->port = PORT_MII; | ||
1417 | cmd->transceiver = XCVR_INTERNAL; | ||
1418 | cmd->phy_address = phy_address; | ||
1419 | |||
1420 | if (speed == 0) { | ||
1421 | cmd->autoneg = AUTONEG_ENABLE; | ||
1422 | /* mii lib checks, but doesn't use speed on AUTONEG_ENABLE */ | ||
1423 | cmd->speed = SPEED_100; | ||
1424 | cmd->advertising = ADVERTISED_10baseT_Half | | ||
1425 | ADVERTISED_10baseT_Full | | ||
1426 | ADVERTISED_100baseT_Half | | ||
1427 | ADVERTISED_100baseT_Full; | ||
1428 | if (mp->mii.supports_gmii) | ||
1429 | cmd->advertising |= ADVERTISED_1000baseT_Full; | ||
1430 | } else { | ||
1431 | cmd->autoneg = AUTONEG_DISABLE; | ||
1432 | cmd->speed = speed; | ||
1433 | cmd->duplex = duplex; | ||
1434 | } | ||
1435 | } | ||
1436 | |||
1317 | /*/ | 1437 | /*/ |
1318 | * mv643xx_eth_probe | 1438 | * mv643xx_eth_probe |
1319 | * | 1439 | * |
@@ -1334,6 +1454,9 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1334 | u8 *p; | 1454 | u8 *p; |
1335 | struct resource *res; | 1455 | struct resource *res; |
1336 | int err; | 1456 | int err; |
1457 | struct ethtool_cmd cmd; | ||
1458 | int duplex = DUPLEX_HALF; | ||
1459 | int speed = 0; /* default to auto-negotiation */ | ||
1337 | 1460 | ||
1338 | dev = alloc_etherdev(sizeof(struct mv643xx_private)); | 1461 | dev = alloc_etherdev(sizeof(struct mv643xx_private)); |
1339 | if (!dev) | 1462 | if (!dev) |
@@ -1371,6 +1494,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1371 | dev->tx_queue_len = mp->tx_ring_size; | 1494 | dev->tx_queue_len = mp->tx_ring_size; |
1372 | dev->base_addr = 0; | 1495 | dev->base_addr = 0; |
1373 | dev->change_mtu = mv643xx_eth_change_mtu; | 1496 | dev->change_mtu = mv643xx_eth_change_mtu; |
1497 | dev->do_ioctl = mv643xx_eth_do_ioctl; | ||
1374 | SET_ETHTOOL_OPS(dev, &mv643xx_ethtool_ops); | 1498 | SET_ETHTOOL_OPS(dev, &mv643xx_ethtool_ops); |
1375 | 1499 | ||
1376 | #ifdef MV643XX_CHECKSUM_OFFLOAD_TX | 1500 | #ifdef MV643XX_CHECKSUM_OFFLOAD_TX |
@@ -1391,33 +1515,17 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1391 | 1515 | ||
1392 | /* set default config values */ | 1516 | /* set default config values */ |
1393 | eth_port_uc_addr_get(dev, dev->dev_addr); | 1517 | eth_port_uc_addr_get(dev, dev->dev_addr); |
1394 | mp->port_config = MV643XX_ETH_PORT_CONFIG_DEFAULT_VALUE; | ||
1395 | mp->port_config_extend = MV643XX_ETH_PORT_CONFIG_EXTEND_DEFAULT_VALUE; | ||
1396 | mp->port_sdma_config = MV643XX_ETH_PORT_SDMA_CONFIG_DEFAULT_VALUE; | ||
1397 | mp->port_serial_control = MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE; | ||
1398 | mp->rx_ring_size = MV643XX_ETH_PORT_DEFAULT_RECEIVE_QUEUE_SIZE; | 1518 | mp->rx_ring_size = MV643XX_ETH_PORT_DEFAULT_RECEIVE_QUEUE_SIZE; |
1399 | mp->tx_ring_size = MV643XX_ETH_PORT_DEFAULT_TRANSMIT_QUEUE_SIZE; | 1519 | mp->tx_ring_size = MV643XX_ETH_PORT_DEFAULT_TRANSMIT_QUEUE_SIZE; |
1400 | 1520 | ||
1401 | pd = pdev->dev.platform_data; | 1521 | pd = pdev->dev.platform_data; |
1402 | if (pd) { | 1522 | if (pd) { |
1403 | if (pd->mac_addr != NULL) | 1523 | if (pd->mac_addr) |
1404 | memcpy(dev->dev_addr, pd->mac_addr, 6); | 1524 | memcpy(dev->dev_addr, pd->mac_addr, 6); |
1405 | 1525 | ||
1406 | if (pd->phy_addr || pd->force_phy_addr) | 1526 | if (pd->phy_addr || pd->force_phy_addr) |
1407 | ethernet_phy_set(port_num, pd->phy_addr); | 1527 | ethernet_phy_set(port_num, pd->phy_addr); |
1408 | 1528 | ||
1409 | if (pd->port_config || pd->force_port_config) | ||
1410 | mp->port_config = pd->port_config; | ||
1411 | |||
1412 | if (pd->port_config_extend || pd->force_port_config_extend) | ||
1413 | mp->port_config_extend = pd->port_config_extend; | ||
1414 | |||
1415 | if (pd->port_sdma_config || pd->force_port_sdma_config) | ||
1416 | mp->port_sdma_config = pd->port_sdma_config; | ||
1417 | |||
1418 | if (pd->port_serial_control || pd->force_port_serial_control) | ||
1419 | mp->port_serial_control = pd->port_serial_control; | ||
1420 | |||
1421 | if (pd->rx_queue_size) | 1529 | if (pd->rx_queue_size) |
1422 | mp->rx_ring_size = pd->rx_queue_size; | 1530 | mp->rx_ring_size = pd->rx_queue_size; |
1423 | 1531 | ||
@@ -1433,16 +1541,33 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1433 | mp->rx_sram_size = pd->rx_sram_size; | 1541 | mp->rx_sram_size = pd->rx_sram_size; |
1434 | mp->rx_sram_addr = pd->rx_sram_addr; | 1542 | mp->rx_sram_addr = pd->rx_sram_addr; |
1435 | } | 1543 | } |
1544 | |||
1545 | duplex = pd->duplex; | ||
1546 | speed = pd->speed; | ||
1436 | } | 1547 | } |
1437 | 1548 | ||
1549 | /* Hook up MII support for ethtool */ | ||
1550 | mp->mii.dev = dev; | ||
1551 | mp->mii.mdio_read = mv643xx_mdio_read; | ||
1552 | mp->mii.mdio_write = mv643xx_mdio_write; | ||
1553 | mp->mii.phy_id = ethernet_phy_get(port_num); | ||
1554 | mp->mii.phy_id_mask = 0x3f; | ||
1555 | mp->mii.reg_num_mask = 0x1f; | ||
1556 | |||
1438 | err = ethernet_phy_detect(port_num); | 1557 | err = ethernet_phy_detect(port_num); |
1439 | if (err) { | 1558 | if (err) { |
1440 | pr_debug("MV643xx ethernet port %d: " | 1559 | pr_debug("MV643xx ethernet port %d: " |
1441 | "No PHY detected at addr %d\n", | 1560 | "No PHY detected at addr %d\n", |
1442 | port_num, ethernet_phy_get(port_num)); | 1561 | port_num, ethernet_phy_get(port_num)); |
1443 | return err; | 1562 | goto out; |
1444 | } | 1563 | } |
1445 | 1564 | ||
1565 | ethernet_phy_reset(port_num); | ||
1566 | mp->mii.supports_gmii = mii_check_gmii_support(&mp->mii); | ||
1567 | mv643xx_init_ethtool_cmd(dev, mp->mii.phy_id, speed, duplex, &cmd); | ||
1568 | mv643xx_eth_update_pscr(dev, &cmd); | ||
1569 | mv643xx_set_settings(dev, &cmd); | ||
1570 | |||
1446 | err = register_netdev(dev); | 1571 | err = register_netdev(dev); |
1447 | if (err) | 1572 | if (err) |
1448 | goto out; | 1573 | goto out; |
@@ -1706,7 +1831,6 @@ MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX"); | |||
1706 | * Prior to calling the initialization routine eth_port_init() the user | 1831 | * Prior to calling the initialization routine eth_port_init() the user |
1707 | * must set the following fields under mv643xx_private struct: | 1832 | * must set the following fields under mv643xx_private struct: |
1708 | * port_num User Ethernet port number. | 1833 | * port_num User Ethernet port number. |
1709 | * port_mac_addr[6] User defined port MAC address. | ||
1710 | * port_config User port configuration value. | 1834 | * port_config User port configuration value. |
1711 | * port_config_extend User port config extend value. | 1835 | * port_config_extend User port config extend value. |
1712 | * port_sdma_config User port SDMA config value. | 1836 | * port_sdma_config User port SDMA config value. |
@@ -1723,20 +1847,12 @@ MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX"); | |||
1723 | * return_info Tx/Rx user resource return information. | 1847 | * return_info Tx/Rx user resource return information. |
1724 | */ | 1848 | */ |
1725 | 1849 | ||
1726 | /* defines */ | ||
1727 | /* SDMA command macros */ | ||
1728 | #define ETH_ENABLE_TX_QUEUE(eth_port) \ | ||
1729 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(eth_port), 1) | ||
1730 | |||
1731 | /* locals */ | ||
1732 | |||
1733 | /* PHY routines */ | 1850 | /* PHY routines */ |
1734 | static int ethernet_phy_get(unsigned int eth_port_num); | 1851 | static int ethernet_phy_get(unsigned int eth_port_num); |
1735 | static void ethernet_phy_set(unsigned int eth_port_num, int phy_addr); | 1852 | static void ethernet_phy_set(unsigned int eth_port_num, int phy_addr); |
1736 | 1853 | ||
1737 | /* Ethernet Port routines */ | 1854 | /* Ethernet Port routines */ |
1738 | static int eth_port_uc_addr(unsigned int eth_port_num, unsigned char uc_nibble, | 1855 | static void eth_port_set_filter_table_entry(int table, unsigned char entry); |
1739 | int option); | ||
1740 | 1856 | ||
1741 | /* | 1857 | /* |
1742 | * eth_port_init - Initialize the Ethernet port driver | 1858 | * eth_port_init - Initialize the Ethernet port driver |
@@ -1764,17 +1880,12 @@ static int eth_port_uc_addr(unsigned int eth_port_num, unsigned char uc_nibble, | |||
1764 | */ | 1880 | */ |
1765 | static void eth_port_init(struct mv643xx_private *mp) | 1881 | static void eth_port_init(struct mv643xx_private *mp) |
1766 | { | 1882 | { |
1767 | mp->port_rx_queue_command = 0; | ||
1768 | mp->port_tx_queue_command = 0; | ||
1769 | |||
1770 | mp->rx_resource_err = 0; | 1883 | mp->rx_resource_err = 0; |
1771 | mp->tx_resource_err = 0; | 1884 | mp->tx_resource_err = 0; |
1772 | 1885 | ||
1773 | eth_port_reset(mp->port_num); | 1886 | eth_port_reset(mp->port_num); |
1774 | 1887 | ||
1775 | eth_port_init_mac_tables(mp->port_num); | 1888 | eth_port_init_mac_tables(mp->port_num); |
1776 | |||
1777 | ethernet_phy_reset(mp->port_num); | ||
1778 | } | 1889 | } |
1779 | 1890 | ||
1780 | /* | 1891 | /* |
@@ -1796,7 +1907,7 @@ static void eth_port_init(struct mv643xx_private *mp) | |||
1796 | * and ether_init_rx_desc_ring for Rx queues). | 1907 | * and ether_init_rx_desc_ring for Rx queues). |
1797 | * | 1908 | * |
1798 | * INPUT: | 1909 | * INPUT: |
1799 | * struct mv643xx_private *mp Ethernet port control struct | 1910 | * dev - a pointer to the required interface |
1800 | * | 1911 | * |
1801 | * OUTPUT: | 1912 | * OUTPUT: |
1802 | * Ethernet port is ready to receive and transmit. | 1913 | * Ethernet port is ready to receive and transmit. |
@@ -1804,10 +1915,13 @@ static void eth_port_init(struct mv643xx_private *mp) | |||
1804 | * RETURN: | 1915 | * RETURN: |
1805 | * None. | 1916 | * None. |
1806 | */ | 1917 | */ |
1807 | static void eth_port_start(struct mv643xx_private *mp) | 1918 | static void eth_port_start(struct net_device *dev) |
1808 | { | 1919 | { |
1920 | struct mv643xx_private *mp = netdev_priv(dev); | ||
1809 | unsigned int port_num = mp->port_num; | 1921 | unsigned int port_num = mp->port_num; |
1810 | int tx_curr_desc, rx_curr_desc; | 1922 | int tx_curr_desc, rx_curr_desc; |
1923 | u32 pscr; | ||
1924 | struct ethtool_cmd ethtool_cmd; | ||
1811 | 1925 | ||
1812 | /* Assignment of Tx CTRP of given queue */ | 1926 | /* Assignment of Tx CTRP of given queue */ |
1813 | tx_curr_desc = mp->tx_curr_desc_q; | 1927 | tx_curr_desc = mp->tx_curr_desc_q; |
@@ -1820,37 +1934,45 @@ static void eth_port_start(struct mv643xx_private *mp) | |||
1820 | (u32)((struct eth_rx_desc *)mp->rx_desc_dma + rx_curr_desc)); | 1934 | (u32)((struct eth_rx_desc *)mp->rx_desc_dma + rx_curr_desc)); |
1821 | 1935 | ||
1822 | /* Add the assigned Ethernet address to the port's address table */ | 1936 | /* Add the assigned Ethernet address to the port's address table */ |
1823 | eth_port_uc_addr_set(port_num, mp->port_mac_addr); | 1937 | eth_port_uc_addr_set(port_num, dev->dev_addr); |
1824 | 1938 | ||
1825 | /* Assign port configuration and command. */ | 1939 | /* Assign port configuration and command. */ |
1826 | mv_write(MV643XX_ETH_PORT_CONFIG_REG(port_num), mp->port_config); | 1940 | mv_write(MV643XX_ETH_PORT_CONFIG_REG(port_num), |
1941 | MV643XX_ETH_PORT_CONFIG_DEFAULT_VALUE); | ||
1827 | 1942 | ||
1828 | mv_write(MV643XX_ETH_PORT_CONFIG_EXTEND_REG(port_num), | 1943 | mv_write(MV643XX_ETH_PORT_CONFIG_EXTEND_REG(port_num), |
1829 | mp->port_config_extend); | 1944 | MV643XX_ETH_PORT_CONFIG_EXTEND_DEFAULT_VALUE); |
1830 | 1945 | ||
1946 | pscr = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); | ||
1831 | 1947 | ||
1832 | /* Increase the Rx side buffer size if supporting GigE */ | 1948 | pscr &= ~(MV643XX_ETH_SERIAL_PORT_ENABLE | MV643XX_ETH_FORCE_LINK_PASS); |
1833 | if (mp->port_serial_control & MV643XX_ETH_SET_GMII_SPEED_TO_1000) | 1949 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), pscr); |
1834 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | 1950 | |
1835 | (mp->port_serial_control & 0xfff1ffff) | (0x5 << 17)); | 1951 | pscr |= MV643XX_ETH_DISABLE_AUTO_NEG_FOR_FLOW_CTRL | |
1836 | else | 1952 | MV643XX_ETH_DISABLE_AUTO_NEG_SPEED_GMII | |
1837 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | 1953 | MV643XX_ETH_DISABLE_AUTO_NEG_FOR_DUPLX | |
1838 | mp->port_serial_control); | 1954 | MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL | |
1955 | MV643XX_ETH_SERIAL_PORT_CONTROL_RESERVED; | ||
1839 | 1956 | ||
1840 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), | 1957 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), pscr); |
1841 | mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)) | | 1958 | |
1842 | MV643XX_ETH_SERIAL_PORT_ENABLE); | 1959 | pscr |= MV643XX_ETH_SERIAL_PORT_ENABLE; |
1960 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), pscr); | ||
1843 | 1961 | ||
1844 | /* Assign port SDMA configuration */ | 1962 | /* Assign port SDMA configuration */ |
1845 | mv_write(MV643XX_ETH_SDMA_CONFIG_REG(port_num), | 1963 | mv_write(MV643XX_ETH_SDMA_CONFIG_REG(port_num), |
1846 | mp->port_sdma_config); | 1964 | MV643XX_ETH_PORT_SDMA_CONFIG_DEFAULT_VALUE); |
1847 | 1965 | ||
1848 | /* Enable port Rx. */ | 1966 | /* Enable port Rx. */ |
1849 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), | 1967 | mv643xx_eth_port_enable_rx(port_num, mp->port_rx_queue_command); |
1850 | mp->port_rx_queue_command); | ||
1851 | 1968 | ||
1852 | /* Disable port bandwidth limits by clearing MTU register */ | 1969 | /* Disable port bandwidth limits by clearing MTU register */ |
1853 | mv_write(MV643XX_ETH_MAXIMUM_TRANSMIT_UNIT(port_num), 0); | 1970 | mv_write(MV643XX_ETH_MAXIMUM_TRANSMIT_UNIT(port_num), 0); |
1971 | |||
1972 | /* save phy settings across reset */ | ||
1973 | mv643xx_get_settings(dev, ðtool_cmd); | ||
1974 | ethernet_phy_reset(mp->port_num); | ||
1975 | mv643xx_set_settings(dev, ðtool_cmd); | ||
1854 | } | 1976 | } |
1855 | 1977 | ||
1856 | /* | 1978 | /* |
@@ -1864,8 +1986,9 @@ static void eth_port_start(struct mv643xx_private *mp) | |||
1864 | * char * p_addr Address to be set | 1986 | * char * p_addr Address to be set |
1865 | * | 1987 | * |
1866 | * OUTPUT: | 1988 | * OUTPUT: |
1867 | * Set MAC address low and high registers. also calls eth_port_uc_addr() | 1989 | * Set MAC address low and high registers. also calls |
1868 | * To set the unicast table with the proper information. | 1990 | * eth_port_set_filter_table_entry() to set the unicast |
1991 | * table with the proper information. | ||
1869 | * | 1992 | * |
1870 | * RETURN: | 1993 | * RETURN: |
1871 | * N/A. | 1994 | * N/A. |
@@ -1876,6 +1999,7 @@ static void eth_port_uc_addr_set(unsigned int eth_port_num, | |||
1876 | { | 1999 | { |
1877 | unsigned int mac_h; | 2000 | unsigned int mac_h; |
1878 | unsigned int mac_l; | 2001 | unsigned int mac_l; |
2002 | int table; | ||
1879 | 2003 | ||
1880 | mac_l = (p_addr[4] << 8) | (p_addr[5]); | 2004 | mac_l = (p_addr[4] << 8) | (p_addr[5]); |
1881 | mac_h = (p_addr[0] << 24) | (p_addr[1] << 16) | (p_addr[2] << 8) | | 2005 | mac_h = (p_addr[0] << 24) | (p_addr[1] << 16) | (p_addr[2] << 8) | |
@@ -1885,9 +2009,8 @@ static void eth_port_uc_addr_set(unsigned int eth_port_num, | |||
1885 | mv_write(MV643XX_ETH_MAC_ADDR_HIGH(eth_port_num), mac_h); | 2009 | mv_write(MV643XX_ETH_MAC_ADDR_HIGH(eth_port_num), mac_h); |
1886 | 2010 | ||
1887 | /* Accept frames of this address */ | 2011 | /* Accept frames of this address */ |
1888 | eth_port_uc_addr(eth_port_num, p_addr[5], ACCEPT_MAC_ADDR); | 2012 | table = MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE(eth_port_num); |
1889 | 2013 | eth_port_set_filter_table_entry(table, p_addr[5] & 0x0f); | |
1890 | return; | ||
1891 | } | 2014 | } |
1892 | 2015 | ||
1893 | /* | 2016 | /* |
@@ -1926,72 +2049,6 @@ static void eth_port_uc_addr_get(struct net_device *dev, unsigned char *p_addr) | |||
1926 | } | 2049 | } |
1927 | 2050 | ||
1928 | /* | 2051 | /* |
1929 | * eth_port_uc_addr - This function Set the port unicast address table | ||
1930 | * | ||
1931 | * DESCRIPTION: | ||
1932 | * This function locates the proper entry in the Unicast table for the | ||
1933 | * specified MAC nibble and sets its properties according to function | ||
1934 | * parameters. | ||
1935 | * | ||
1936 | * INPUT: | ||
1937 | * unsigned int eth_port_num Port number. | ||
1938 | * unsigned char uc_nibble Unicast MAC Address last nibble. | ||
1939 | * int option 0 = Add, 1 = remove address. | ||
1940 | * | ||
1941 | * OUTPUT: | ||
1942 | * This function add/removes MAC addresses from the port unicast address | ||
1943 | * table. | ||
1944 | * | ||
1945 | * RETURN: | ||
1946 | * true is output succeeded. | ||
1947 | * false if option parameter is invalid. | ||
1948 | * | ||
1949 | */ | ||
1950 | static int eth_port_uc_addr(unsigned int eth_port_num, unsigned char uc_nibble, | ||
1951 | int option) | ||
1952 | { | ||
1953 | unsigned int unicast_reg; | ||
1954 | unsigned int tbl_offset; | ||
1955 | unsigned int reg_offset; | ||
1956 | |||
1957 | /* Locate the Unicast table entry */ | ||
1958 | uc_nibble = (0xf & uc_nibble); | ||
1959 | tbl_offset = (uc_nibble / 4) * 4; /* Register offset from unicast table base */ | ||
1960 | reg_offset = uc_nibble % 4; /* Entry offset within the above register */ | ||
1961 | |||
1962 | switch (option) { | ||
1963 | case REJECT_MAC_ADDR: | ||
1964 | /* Clear accepts frame bit at given unicast DA table entry */ | ||
1965 | unicast_reg = mv_read((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | ||
1966 | (eth_port_num) + tbl_offset)); | ||
1967 | |||
1968 | unicast_reg &= (0x0E << (8 * reg_offset)); | ||
1969 | |||
1970 | mv_write((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | ||
1971 | (eth_port_num) + tbl_offset), unicast_reg); | ||
1972 | break; | ||
1973 | |||
1974 | case ACCEPT_MAC_ADDR: | ||
1975 | /* Set accepts frame bit at unicast DA filter table entry */ | ||
1976 | unicast_reg = | ||
1977 | mv_read((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | ||
1978 | (eth_port_num) + tbl_offset)); | ||
1979 | |||
1980 | unicast_reg |= (0x01 << (8 * reg_offset)); | ||
1981 | |||
1982 | mv_write((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | ||
1983 | (eth_port_num) + tbl_offset), unicast_reg); | ||
1984 | |||
1985 | break; | ||
1986 | |||
1987 | default: | ||
1988 | return 0; | ||
1989 | } | ||
1990 | |||
1991 | return 1; | ||
1992 | } | ||
1993 | |||
1994 | /* | ||
1995 | * The entries in each table are indexed by a hash of a packet's MAC | 2052 | * The entries in each table are indexed by a hash of a packet's MAC |
1996 | * address. One bit in each entry determines whether the packet is | 2053 | * address. One bit in each entry determines whether the packet is |
1997 | * accepted. There are 4 entries (each 8 bits wide) in each register | 2054 | * accepted. There are 4 entries (each 8 bits wide) in each register |
@@ -2203,8 +2260,8 @@ static void eth_port_init_mac_tables(unsigned int eth_port_num) | |||
2203 | 2260 | ||
2204 | /* Clear DA filter unicast table (Ex_dFUT) */ | 2261 | /* Clear DA filter unicast table (Ex_dFUT) */ |
2205 | for (table_index = 0; table_index <= 0xC; table_index += 4) | 2262 | for (table_index = 0; table_index <= 0xC; table_index += 4) |
2206 | mv_write((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE | 2263 | mv_write(MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE |
2207 | (eth_port_num) + table_index), 0); | 2264 | (eth_port_num) + table_index, 0); |
2208 | 2265 | ||
2209 | for (table_index = 0; table_index <= 0xFC; table_index += 4) { | 2266 | for (table_index = 0; table_index <= 0xFC; table_index += 4) { |
2210 | /* Clear DA filter special multicast table (Ex_dFSMT) */ | 2267 | /* Clear DA filter special multicast table (Ex_dFSMT) */ |
@@ -2387,6 +2444,73 @@ static void ethernet_phy_reset(unsigned int eth_port_num) | |||
2387 | eth_port_read_smi_reg(eth_port_num, 0, &phy_reg_data); | 2444 | eth_port_read_smi_reg(eth_port_num, 0, &phy_reg_data); |
2388 | phy_reg_data |= 0x8000; /* Set bit 15 to reset the PHY */ | 2445 | phy_reg_data |= 0x8000; /* Set bit 15 to reset the PHY */ |
2389 | eth_port_write_smi_reg(eth_port_num, 0, phy_reg_data); | 2446 | eth_port_write_smi_reg(eth_port_num, 0, phy_reg_data); |
2447 | |||
2448 | /* wait for PHY to come out of reset */ | ||
2449 | do { | ||
2450 | udelay(1); | ||
2451 | eth_port_read_smi_reg(eth_port_num, 0, &phy_reg_data); | ||
2452 | } while (phy_reg_data & 0x8000); | ||
2453 | } | ||
2454 | |||
2455 | static void mv643xx_eth_port_enable_tx(unsigned int port_num, | ||
2456 | unsigned int channels) | ||
2457 | { | ||
2458 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), channels); | ||
2459 | } | ||
2460 | |||
2461 | static void mv643xx_eth_port_enable_rx(unsigned int port_num, | ||
2462 | unsigned int channels) | ||
2463 | { | ||
2464 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), channels); | ||
2465 | } | ||
2466 | |||
2467 | static unsigned int mv643xx_eth_port_disable_tx(unsigned int port_num) | ||
2468 | { | ||
2469 | u32 channels; | ||
2470 | |||
2471 | /* Stop Tx port activity. Check port Tx activity. */ | ||
2472 | channels = mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num)) | ||
2473 | & 0xFF; | ||
2474 | if (channels) { | ||
2475 | /* Issue stop command for active channels only */ | ||
2476 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), | ||
2477 | (channels << 8)); | ||
2478 | |||
2479 | /* Wait for all Tx activity to terminate. */ | ||
2480 | /* Check port cause register that all Tx queues are stopped */ | ||
2481 | while (mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num)) | ||
2482 | & 0xFF) | ||
2483 | udelay(PHY_WAIT_MICRO_SECONDS); | ||
2484 | |||
2485 | /* Wait for Tx FIFO to empty */ | ||
2486 | while (mv_read(MV643XX_ETH_PORT_STATUS_REG(port_num)) & | ||
2487 | ETH_PORT_TX_FIFO_EMPTY) | ||
2488 | udelay(PHY_WAIT_MICRO_SECONDS); | ||
2489 | } | ||
2490 | |||
2491 | return channels; | ||
2492 | } | ||
2493 | |||
2494 | static unsigned int mv643xx_eth_port_disable_rx(unsigned int port_num) | ||
2495 | { | ||
2496 | u32 channels; | ||
2497 | |||
2498 | /* Stop Rx port activity. Check port Rx activity. */ | ||
2499 | channels = mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num) | ||
2500 | & 0xFF); | ||
2501 | if (channels) { | ||
2502 | /* Issue stop command for active channels only */ | ||
2503 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), | ||
2504 | (channels << 8)); | ||
2505 | |||
2506 | /* Wait for all Rx activity to terminate. */ | ||
2507 | /* Check port cause register that all Rx queues are stopped */ | ||
2508 | while (mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num)) | ||
2509 | & 0xFF) | ||
2510 | udelay(PHY_WAIT_MICRO_SECONDS); | ||
2511 | } | ||
2512 | |||
2513 | return channels; | ||
2390 | } | 2514 | } |
2391 | 2515 | ||
2392 | /* | 2516 | /* |
@@ -2411,70 +2535,21 @@ static void eth_port_reset(unsigned int port_num) | |||
2411 | { | 2535 | { |
2412 | unsigned int reg_data; | 2536 | unsigned int reg_data; |
2413 | 2537 | ||
2414 | /* Stop Tx port activity. Check port Tx activity. */ | 2538 | mv643xx_eth_port_disable_tx(port_num); |
2415 | reg_data = mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num)); | 2539 | mv643xx_eth_port_disable_rx(port_num); |
2416 | |||
2417 | if (reg_data & 0xFF) { | ||
2418 | /* Issue stop command for active channels only */ | ||
2419 | mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), | ||
2420 | (reg_data << 8)); | ||
2421 | |||
2422 | /* Wait for all Tx activity to terminate. */ | ||
2423 | /* Check port cause register that all Tx queues are stopped */ | ||
2424 | while (mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num)) | ||
2425 | & 0xFF) | ||
2426 | udelay(10); | ||
2427 | } | ||
2428 | |||
2429 | /* Stop Rx port activity. Check port Rx activity. */ | ||
2430 | reg_data = mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num)); | ||
2431 | |||
2432 | if (reg_data & 0xFF) { | ||
2433 | /* Issue stop command for active channels only */ | ||
2434 | mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num), | ||
2435 | (reg_data << 8)); | ||
2436 | |||
2437 | /* Wait for all Rx activity to terminate. */ | ||
2438 | /* Check port cause register that all Rx queues are stopped */ | ||
2439 | while (mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num)) | ||
2440 | & 0xFF) | ||
2441 | udelay(10); | ||
2442 | } | ||
2443 | 2540 | ||
2444 | /* Clear all MIB counters */ | 2541 | /* Clear all MIB counters */ |
2445 | eth_clear_mib_counters(port_num); | 2542 | eth_clear_mib_counters(port_num); |
2446 | 2543 | ||
2447 | /* Reset the Enable bit in the Configuration Register */ | 2544 | /* Reset the Enable bit in the Configuration Register */ |
2448 | reg_data = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); | 2545 | reg_data = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); |
2449 | reg_data &= ~MV643XX_ETH_SERIAL_PORT_ENABLE; | 2546 | reg_data &= ~(MV643XX_ETH_SERIAL_PORT_ENABLE | |
2547 | MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL | | ||
2548 | MV643XX_ETH_FORCE_LINK_PASS); | ||
2450 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), reg_data); | 2549 | mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), reg_data); |
2451 | } | 2550 | } |
2452 | 2551 | ||
2453 | 2552 | ||
2454 | static int eth_port_autoneg_supported(unsigned int eth_port_num) | ||
2455 | { | ||
2456 | unsigned int phy_reg_data0; | ||
2457 | |||
2458 | eth_port_read_smi_reg(eth_port_num, 0, &phy_reg_data0); | ||
2459 | |||
2460 | return phy_reg_data0 & 0x1000; | ||
2461 | } | ||
2462 | |||
2463 | static int eth_port_link_is_up(unsigned int eth_port_num) | ||
2464 | { | ||
2465 | unsigned int phy_reg_data1; | ||
2466 | |||
2467 | eth_port_read_smi_reg(eth_port_num, 1, &phy_reg_data1); | ||
2468 | |||
2469 | if (eth_port_autoneg_supported(eth_port_num)) { | ||
2470 | if (phy_reg_data1 & 0x20) /* auto-neg complete */ | ||
2471 | return 1; | ||
2472 | } else if (phy_reg_data1 & 0x4) /* link up */ | ||
2473 | return 1; | ||
2474 | |||
2475 | return 0; | ||
2476 | } | ||
2477 | |||
2478 | /* | 2553 | /* |
2479 | * eth_port_read_smi_reg - Read PHY registers | 2554 | * eth_port_read_smi_reg - Read PHY registers |
2480 | * | 2555 | * |
@@ -2580,6 +2655,24 @@ out: | |||
2580 | } | 2655 | } |
2581 | 2656 | ||
2582 | /* | 2657 | /* |
2658 | * Wrappers for MII support library. | ||
2659 | */ | ||
2660 | static int mv643xx_mdio_read(struct net_device *dev, int phy_id, int location) | ||
2661 | { | ||
2662 | int val; | ||
2663 | struct mv643xx_private *mp = netdev_priv(dev); | ||
2664 | |||
2665 | eth_port_read_smi_reg(mp->port_num, location, &val); | ||
2666 | return val; | ||
2667 | } | ||
2668 | |||
2669 | static void mv643xx_mdio_write(struct net_device *dev, int phy_id, int location, int val) | ||
2670 | { | ||
2671 | struct mv643xx_private *mp = netdev_priv(dev); | ||
2672 | eth_port_write_smi_reg(mp->port_num, location, val); | ||
2673 | } | ||
2674 | |||
2675 | /* | ||
2583 | * eth_port_send - Send an Ethernet packet | 2676 | * eth_port_send - Send an Ethernet packet |
2584 | * | 2677 | * |
2585 | * DESCRIPTION: | 2678 | * DESCRIPTION: |
@@ -2633,8 +2726,8 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2633 | return ETH_ERROR; | 2726 | return ETH_ERROR; |
2634 | } | 2727 | } |
2635 | 2728 | ||
2636 | mp->tx_ring_skbs++; | 2729 | mp->tx_desc_count++; |
2637 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | 2730 | BUG_ON(mp->tx_desc_count > mp->tx_ring_size); |
2638 | 2731 | ||
2639 | /* Get the Tx Desc ring indexes */ | 2732 | /* Get the Tx Desc ring indexes */ |
2640 | tx_desc_curr = mp->tx_curr_desc_q; | 2733 | tx_desc_curr = mp->tx_curr_desc_q; |
@@ -2668,7 +2761,7 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2668 | first_descriptor->cmd_sts = mp->tx_first_command; | 2761 | first_descriptor->cmd_sts = mp->tx_first_command; |
2669 | 2762 | ||
2670 | wmb(); | 2763 | wmb(); |
2671 | ETH_ENABLE_TX_QUEUE(mp->port_num); | 2764 | mv643xx_eth_port_enable_tx(mp->port_num, mp->port_tx_queue_command); |
2672 | 2765 | ||
2673 | /* | 2766 | /* |
2674 | * Finish Tx packet. Update first desc in case of Tx resource | 2767 | * Finish Tx packet. Update first desc in case of Tx resource |
@@ -2702,8 +2795,8 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2702 | if (mp->tx_resource_err) | 2795 | if (mp->tx_resource_err) |
2703 | return ETH_QUEUE_FULL; | 2796 | return ETH_QUEUE_FULL; |
2704 | 2797 | ||
2705 | mp->tx_ring_skbs++; | 2798 | mp->tx_desc_count++; |
2706 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | 2799 | BUG_ON(mp->tx_desc_count > mp->tx_ring_size); |
2707 | 2800 | ||
2708 | /* Get the Tx Desc ring indexes */ | 2801 | /* Get the Tx Desc ring indexes */ |
2709 | tx_desc_curr = mp->tx_curr_desc_q; | 2802 | tx_desc_curr = mp->tx_curr_desc_q; |
@@ -2721,7 +2814,7 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2721 | ETH_BUFFER_OWNED_BY_DMA | ETH_TX_ENABLE_INTERRUPT; | 2814 | ETH_BUFFER_OWNED_BY_DMA | ETH_TX_ENABLE_INTERRUPT; |
2722 | 2815 | ||
2723 | wmb(); | 2816 | wmb(); |
2724 | ETH_ENABLE_TX_QUEUE(mp->port_num); | 2817 | mv643xx_eth_port_enable_tx(mp->port_num, mp->port_tx_queue_command); |
2725 | 2818 | ||
2726 | /* Finish Tx packet. Update first desc in case of Tx resource error */ | 2819 | /* Finish Tx packet. Update first desc in case of Tx resource error */ |
2727 | tx_desc_curr = (tx_desc_curr + 1) % mp->tx_ring_size; | 2820 | tx_desc_curr = (tx_desc_curr + 1) % mp->tx_ring_size; |
@@ -2817,8 +2910,8 @@ static ETH_FUNC_RET_STATUS eth_tx_return_desc(struct mv643xx_private *mp, | |||
2817 | /* Any Tx return cancels the Tx resource error status */ | 2910 | /* Any Tx return cancels the Tx resource error status */ |
2818 | mp->tx_resource_err = 0; | 2911 | mp->tx_resource_err = 0; |
2819 | 2912 | ||
2820 | BUG_ON(mp->tx_ring_skbs == 0); | 2913 | BUG_ON(mp->tx_desc_count == 0); |
2821 | mp->tx_ring_skbs--; | 2914 | mp->tx_desc_count--; |
2822 | 2915 | ||
2823 | out: | 2916 | out: |
2824 | spin_unlock_irqrestore(&mp->lock, flags); | 2917 | spin_unlock_irqrestore(&mp->lock, flags); |
@@ -3015,111 +3108,6 @@ static const struct mv643xx_stats mv643xx_gstrings_stats[] = { | |||
3015 | #define MV643XX_STATS_LEN \ | 3108 | #define MV643XX_STATS_LEN \ |
3016 | sizeof(mv643xx_gstrings_stats) / sizeof(struct mv643xx_stats) | 3109 | sizeof(mv643xx_gstrings_stats) / sizeof(struct mv643xx_stats) |
3017 | 3110 | ||
3018 | static int | ||
3019 | mv643xx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | ||
3020 | { | ||
3021 | struct mv643xx_private *mp = netdev->priv; | ||
3022 | int port_num = mp->port_num; | ||
3023 | int autoneg = eth_port_autoneg_supported(port_num); | ||
3024 | int mode_10_bit; | ||
3025 | int auto_duplex; | ||
3026 | int half_duplex = 0; | ||
3027 | int full_duplex = 0; | ||
3028 | int auto_speed; | ||
3029 | int speed_10 = 0; | ||
3030 | int speed_100 = 0; | ||
3031 | int speed_1000 = 0; | ||
3032 | |||
3033 | u32 pcs = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)); | ||
3034 | u32 psr = mv_read(MV643XX_ETH_PORT_STATUS_REG(port_num)); | ||
3035 | |||
3036 | mode_10_bit = psr & MV643XX_ETH_PORT_STATUS_MODE_10_BIT; | ||
3037 | |||
3038 | if (mode_10_bit) { | ||
3039 | ecmd->supported = SUPPORTED_10baseT_Half; | ||
3040 | } else { | ||
3041 | ecmd->supported = (SUPPORTED_10baseT_Half | | ||
3042 | SUPPORTED_10baseT_Full | | ||
3043 | SUPPORTED_100baseT_Half | | ||
3044 | SUPPORTED_100baseT_Full | | ||
3045 | SUPPORTED_1000baseT_Full | | ||
3046 | (autoneg ? SUPPORTED_Autoneg : 0) | | ||
3047 | SUPPORTED_TP); | ||
3048 | |||
3049 | auto_duplex = !(pcs & MV643XX_ETH_DISABLE_AUTO_NEG_FOR_DUPLX); | ||
3050 | auto_speed = !(pcs & MV643XX_ETH_DISABLE_AUTO_NEG_SPEED_GMII); | ||
3051 | |||
3052 | ecmd->advertising = ADVERTISED_TP; | ||
3053 | |||
3054 | if (autoneg) { | ||
3055 | ecmd->advertising |= ADVERTISED_Autoneg; | ||
3056 | |||
3057 | if (auto_duplex) { | ||
3058 | half_duplex = 1; | ||
3059 | full_duplex = 1; | ||
3060 | } else { | ||
3061 | if (pcs & MV643XX_ETH_SET_FULL_DUPLEX_MODE) | ||
3062 | full_duplex = 1; | ||
3063 | else | ||
3064 | half_duplex = 1; | ||
3065 | } | ||
3066 | |||
3067 | if (auto_speed) { | ||
3068 | speed_10 = 1; | ||
3069 | speed_100 = 1; | ||
3070 | speed_1000 = 1; | ||
3071 | } else { | ||
3072 | if (pcs & MV643XX_ETH_SET_GMII_SPEED_TO_1000) | ||
3073 | speed_1000 = 1; | ||
3074 | else if (pcs & MV643XX_ETH_SET_MII_SPEED_TO_100) | ||
3075 | speed_100 = 1; | ||
3076 | else | ||
3077 | speed_10 = 1; | ||
3078 | } | ||
3079 | |||
3080 | if (speed_10 & half_duplex) | ||
3081 | ecmd->advertising |= ADVERTISED_10baseT_Half; | ||
3082 | if (speed_10 & full_duplex) | ||
3083 | ecmd->advertising |= ADVERTISED_10baseT_Full; | ||
3084 | if (speed_100 & half_duplex) | ||
3085 | ecmd->advertising |= ADVERTISED_100baseT_Half; | ||
3086 | if (speed_100 & full_duplex) | ||
3087 | ecmd->advertising |= ADVERTISED_100baseT_Full; | ||
3088 | if (speed_1000) | ||
3089 | ecmd->advertising |= ADVERTISED_1000baseT_Full; | ||
3090 | } | ||
3091 | } | ||
3092 | |||
3093 | ecmd->port = PORT_TP; | ||
3094 | ecmd->phy_address = ethernet_phy_get(port_num); | ||
3095 | |||
3096 | ecmd->transceiver = XCVR_EXTERNAL; | ||
3097 | |||
3098 | if (netif_carrier_ok(netdev)) { | ||
3099 | if (mode_10_bit) | ||
3100 | ecmd->speed = SPEED_10; | ||
3101 | else { | ||
3102 | if (psr & MV643XX_ETH_PORT_STATUS_GMII_1000) | ||
3103 | ecmd->speed = SPEED_1000; | ||
3104 | else if (psr & MV643XX_ETH_PORT_STATUS_MII_100) | ||
3105 | ecmd->speed = SPEED_100; | ||
3106 | else | ||
3107 | ecmd->speed = SPEED_10; | ||
3108 | } | ||
3109 | |||
3110 | if (psr & MV643XX_ETH_PORT_STATUS_FULL_DUPLEX) | ||
3111 | ecmd->duplex = DUPLEX_FULL; | ||
3112 | else | ||
3113 | ecmd->duplex = DUPLEX_HALF; | ||
3114 | } else { | ||
3115 | ecmd->speed = -1; | ||
3116 | ecmd->duplex = -1; | ||
3117 | } | ||
3118 | |||
3119 | ecmd->autoneg = autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE; | ||
3120 | return 0; | ||
3121 | } | ||
3122 | |||
3123 | static void mv643xx_get_drvinfo(struct net_device *netdev, | 3111 | static void mv643xx_get_drvinfo(struct net_device *netdev, |
3124 | struct ethtool_drvinfo *drvinfo) | 3112 | struct ethtool_drvinfo *drvinfo) |
3125 | { | 3113 | { |
@@ -3166,15 +3154,41 @@ static void mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, | |||
3166 | } | 3154 | } |
3167 | } | 3155 | } |
3168 | 3156 | ||
3157 | static u32 mv643xx_eth_get_link(struct net_device *dev) | ||
3158 | { | ||
3159 | struct mv643xx_private *mp = netdev_priv(dev); | ||
3160 | |||
3161 | return mii_link_ok(&mp->mii); | ||
3162 | } | ||
3163 | |||
3164 | static int mv643xx_eth_nway_restart(struct net_device *dev) | ||
3165 | { | ||
3166 | struct mv643xx_private *mp = netdev_priv(dev); | ||
3167 | |||
3168 | return mii_nway_restart(&mp->mii); | ||
3169 | } | ||
3170 | |||
3171 | static int mv643xx_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | ||
3172 | { | ||
3173 | struct mv643xx_private *mp = netdev_priv(dev); | ||
3174 | |||
3175 | return generic_mii_ioctl(&mp->mii, if_mii(ifr), cmd, NULL); | ||
3176 | } | ||
3177 | |||
3169 | static struct ethtool_ops mv643xx_ethtool_ops = { | 3178 | static struct ethtool_ops mv643xx_ethtool_ops = { |
3170 | .get_settings = mv643xx_get_settings, | 3179 | .get_settings = mv643xx_get_settings, |
3180 | .set_settings = mv643xx_set_settings, | ||
3171 | .get_drvinfo = mv643xx_get_drvinfo, | 3181 | .get_drvinfo = mv643xx_get_drvinfo, |
3172 | .get_link = ethtool_op_get_link, | 3182 | .get_link = mv643xx_eth_get_link, |
3173 | .get_sg = ethtool_op_get_sg, | 3183 | .get_sg = ethtool_op_get_sg, |
3174 | .set_sg = ethtool_op_set_sg, | 3184 | .set_sg = ethtool_op_set_sg, |
3175 | .get_strings = mv643xx_get_strings, | 3185 | .get_strings = mv643xx_get_strings, |
3176 | .get_stats_count = mv643xx_get_stats_count, | 3186 | .get_stats_count = mv643xx_get_stats_count, |
3177 | .get_ethtool_stats = mv643xx_get_ethtool_stats, | 3187 | .get_ethtool_stats = mv643xx_get_ethtool_stats, |
3188 | .get_strings = mv643xx_get_strings, | ||
3189 | .get_stats_count = mv643xx_get_stats_count, | ||
3190 | .get_ethtool_stats = mv643xx_get_ethtool_stats, | ||
3191 | .nway_reset = mv643xx_eth_nway_restart, | ||
3178 | }; | 3192 | }; |
3179 | 3193 | ||
3180 | /************* End ethtool support *************************/ | 3194 | /************* End ethtool support *************************/ |
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h index f769f9b626..a553054e8d 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 8f40368cf2..aaebd28a19 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 94f782d51f..08b218c5bf 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 e6df375a1d..2aa7b77f84 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 b0c3b6ab62..253cf018df 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 62167a29de..d0f686d6ea 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 1c3c9c666f..c4abc9365f 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 aa6540b394..23659fd7c3 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 49b597cbc1..da0d8a85ac 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 852a6a899d..68ae336519 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 79dca398f3..bcef03feb2 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 221354eea2..88e212043a 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 3a2ea4a4b5..423ad063d0 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 2b94adb933..6e256bd9a2 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 184f47c5a6..143e635ec2 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 3b2773e6f8..1ed214ccb2 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 b486bd9b66..3eec6274e4 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 598bb42ccc..6a63f4a15d 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 daa9a8d154..fdd9e48e80 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 a7e25edc7f..6e6c56aa6d 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 6cb49dd022..67f1d6a5c1 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 2991bc85cf..0a6f67a7a3 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 a386172107..b36dd9ac6b 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 87520f0057..ab66d80a44 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 075a0464e5..79bf57cb53 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 68292d1817..a204f5bb55 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 9ea11ab229..be8d1ccddf 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 eb3c8988ce..17786056c6 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 42d2d96315..b4e75022a6 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 d167deda9a..ed5458c454 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/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index 97712c3c4e..c58a4c31d0 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 05477d24fd..23032a7bc0 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 d7fb3ffe06..d6c3d52d2e 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 d9980bde75..ca7e53246a 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 5b1af3986a..ba05dedf29 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 60d1e05ab7..c5c738a51e 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c | |||
@@ -598,10 +598,8 @@ static void setup_descriptors(struct xircom_private *card) | |||
598 | enter("setup_descriptors"); | 598 | enter("setup_descriptors"); |
599 | 599 | ||
600 | 600 | ||
601 | if (card->rx_buffer == NULL) | 601 | BUG_ON(card->rx_buffer == NULL); |
602 | BUG(); | 602 | BUG_ON(card->tx_buffer == NULL); |
603 | if (card->tx_buffer == NULL) | ||
604 | BUG(); | ||
605 | 603 | ||
606 | /* Receive descriptors */ | 604 | /* Receive descriptors */ |
607 | memset(card->rx_buffer, 0, 128); /* clear the descriptors */ | 605 | memset(card->rx_buffer, 0, 128); /* clear the descriptors */ |
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index 18baacfc5a..18a44580b5 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/zorro8390.c b/drivers/net/zorro8390.c index 8ab6e12153..7610216035 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 7198f129e1..231ba090ae 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 0b08cd6922..955d3069d7 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 9a92aef8b0..ff6ef9e1a6 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, |
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index cd82c3e998..eb476414fd 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/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c index ecc9bb196a..cb71d794a7 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 4702217285..097bcea212 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 e0988320ef..93def94c1b 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 f8dca31be5..649e581fa5 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 610cc5cbc2..3027153940 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 90d18b72da..5f67c684af 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 960aa78cdb..6c070bc155 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -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,19 @@ 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 | |||
1504 | case IEEE80211_STYPE_DEAUTH: | 1610 | case IEEE80211_STYPE_DEAUTH: |
1505 | printk("DEAUTH from AP\n"); | 1611 | IEEE80211_DEBUG_MGMT("DEAUTH\n"); |
1506 | if (ieee->handle_deauth != NULL) | 1612 | if (ieee->handle_deauth != NULL) |
1507 | ieee->handle_deauth(ieee->dev, (struct ieee80211_auth *) | 1613 | ieee->handle_deauth(ieee->dev, |
1614 | (struct ieee80211_deauth *) | ||
1508 | header); | 1615 | header); |
1509 | break; | 1616 | break; |
1510 | default: | 1617 | default: |
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index 8fdd943ebe..8b4332f533 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 f87c6b89f8..9496918e61 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 | ||