diff options
Diffstat (limited to 'drivers/net')
61 files changed, 1212 insertions, 549 deletions
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c index b72b89d53ec8..fae295b6809c 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c | |||
@@ -103,8 +103,8 @@ DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Richard Procter <rnp@paradise.net. | |||
103 | #include <linux/ethtool.h> | 103 | #include <linux/ethtool.h> |
104 | #include <linux/completion.h> | 104 | #include <linux/completion.h> |
105 | #include <linux/bitops.h> | 105 | #include <linux/bitops.h> |
106 | #include <linux/semaphore.h> | ||
106 | 107 | ||
107 | #include <asm/semaphore.h> | ||
108 | #include <asm/uaccess.h> | 108 | #include <asm/uaccess.h> |
109 | #include <asm/system.h> | 109 | #include <asm/system.h> |
110 | #include <asm/io.h> | 110 | #include <asm/io.h> |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 50b36b408ca1..af46341827f2 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -469,7 +469,7 @@ config SNI_82596 | |||
469 | 469 | ||
470 | config KORINA | 470 | config KORINA |
471 | tristate "Korina (IDT RC32434) Ethernet support" | 471 | tristate "Korina (IDT RC32434) Ethernet support" |
472 | depends on NET_ETHERNET && MIKROTIK_RB500 | 472 | depends on NET_ETHERNET && MIKROTIK_RB532 |
473 | help | 473 | help |
474 | If you have a Mikrotik RouterBoard 500 or IDT RC32434 | 474 | If you have a Mikrotik RouterBoard 500 or IDT RC32434 |
475 | based system say Y. Otherwise say N. | 475 | based system say Y. Otherwise say N. |
@@ -827,7 +827,7 @@ config ULTRA32 | |||
827 | 827 | ||
828 | config BFIN_MAC | 828 | config BFIN_MAC |
829 | tristate "Blackfin 527/536/537 on-chip mac support" | 829 | tristate "Blackfin 527/536/537 on-chip mac support" |
830 | depends on NET_ETHERNET && (BF527 || BF537 || BF536) && (!BF537_PORT_H) | 830 | depends on NET_ETHERNET && (BF527 || BF537 || BF536) |
831 | select CRC32 | 831 | select CRC32 |
832 | select MII | 832 | select MII |
833 | select PHYLIB | 833 | select PHYLIB |
@@ -2011,7 +2011,7 @@ config E1000_DISABLE_PACKET_SPLIT | |||
2011 | 2011 | ||
2012 | config E1000E | 2012 | config E1000E |
2013 | tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support" | 2013 | tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support" |
2014 | depends on PCI | 2014 | depends on PCI && (!SPARC32 || BROKEN) |
2015 | ---help--- | 2015 | ---help--- |
2016 | This driver supports the PCI-Express Intel(R) PRO/1000 gigabit | 2016 | This driver supports the PCI-Express Intel(R) PRO/1000 gigabit |
2017 | ethernet family of adapters. For PCI or PCI-X e1000 adapters, | 2017 | ethernet family of adapters. For PCI or PCI-X e1000 adapters, |
@@ -2278,6 +2278,7 @@ config TSI108_ETH | |||
2278 | config GELIC_NET | 2278 | config GELIC_NET |
2279 | tristate "PS3 Gigabit Ethernet driver" | 2279 | tristate "PS3 Gigabit Ethernet driver" |
2280 | depends on PPC_PS3 | 2280 | depends on PPC_PS3 |
2281 | select PS3_SYS_MANAGER | ||
2281 | help | 2282 | help |
2282 | This driver supports the network device on the PS3 game | 2283 | This driver supports the network device on the PS3 game |
2283 | console. This driver has built-in support for Ethernet. | 2284 | console. This driver has built-in support for Ethernet. |
@@ -2335,7 +2336,7 @@ config UGETH_TX_ON_DEMAND | |||
2335 | 2336 | ||
2336 | config MV643XX_ETH | 2337 | config MV643XX_ETH |
2337 | tristate "Marvell Discovery (643XX) and Orion ethernet support" | 2338 | tristate "Marvell Discovery (643XX) and Orion ethernet support" |
2338 | depends on MV64360 || MV64X60 || (PPC_MULTIPLATFORM && PPC32) || ARCH_ORION | 2339 | depends on MV64360 || MV64X60 || (PPC_MULTIPLATFORM && PPC32) || PLAT_ORION |
2339 | select MII | 2340 | select MII |
2340 | help | 2341 | help |
2341 | This driver supports the gigabit ethernet MACs in the | 2342 | This driver supports the gigabit ethernet MACs in the |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 371cb0785b27..dcbfe8421154 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -218,7 +218,8 @@ obj-$(CONFIG_SMC911X) += smc911x.o | |||
218 | obj-$(CONFIG_BFIN_MAC) += bfin_mac.o | 218 | obj-$(CONFIG_BFIN_MAC) += bfin_mac.o |
219 | obj-$(CONFIG_DM9000) += dm9000.o | 219 | obj-$(CONFIG_DM9000) += dm9000.o |
220 | obj-$(CONFIG_FEC_8XX) += fec_8xx/ | 220 | obj-$(CONFIG_FEC_8XX) += fec_8xx/ |
221 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac.o | 221 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o |
222 | pasemi_mac_driver-objs := pasemi_mac.o pasemi_mac_ethtool.o | ||
222 | obj-$(CONFIG_MLX4_CORE) += mlx4/ | 223 | obj-$(CONFIG_MLX4_CORE) += mlx4/ |
223 | obj-$(CONFIG_ENC28J60) += enc28j60.o | 224 | obj-$(CONFIG_ENC28J60) += enc28j60.o |
224 | 225 | ||
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index 770226d904d4..1e39e78f1778 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
@@ -1043,7 +1043,9 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add | |||
1043 | } else if (machine_is_csb337()) { | 1043 | } else if (machine_is_csb337()) { |
1044 | /* mix link activity status into LED2 link state */ | 1044 | /* mix link activity status into LED2 link state */ |
1045 | write_phy(phy_address, MII_LEDCTRL_REG, 0x0d22); | 1045 | write_phy(phy_address, MII_LEDCTRL_REG, 0x0d22); |
1046 | } | 1046 | } else if (machine_is_ecbat91()) |
1047 | write_phy(phy_address, MII_LEDCTRL_REG, 0x156A); | ||
1048 | |||
1047 | disable_mdi(); | 1049 | disable_mdi(); |
1048 | spin_unlock_irq(&lp->lock); | 1050 | spin_unlock_irq(&lp->lock); |
1049 | 1051 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 6e91b4b7aabb..6425603bc379 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3282,17 +3282,14 @@ static int bond_create_proc_entry(struct bonding *bond) | |||
3282 | struct net_device *bond_dev = bond->dev; | 3282 | struct net_device *bond_dev = bond->dev; |
3283 | 3283 | ||
3284 | if (bond_proc_dir) { | 3284 | if (bond_proc_dir) { |
3285 | bond->proc_entry = create_proc_entry(bond_dev->name, | 3285 | bond->proc_entry = proc_create_data(bond_dev->name, |
3286 | S_IRUGO, | 3286 | S_IRUGO, bond_proc_dir, |
3287 | bond_proc_dir); | 3287 | &bond_info_fops, bond); |
3288 | if (bond->proc_entry == NULL) { | 3288 | if (bond->proc_entry == NULL) { |
3289 | printk(KERN_WARNING DRV_NAME | 3289 | printk(KERN_WARNING DRV_NAME |
3290 | ": Warning: Cannot create /proc/net/%s/%s\n", | 3290 | ": Warning: Cannot create /proc/net/%s/%s\n", |
3291 | DRV_NAME, bond_dev->name); | 3291 | DRV_NAME, bond_dev->name); |
3292 | } else { | 3292 | } else { |
3293 | bond->proc_entry->data = bond; | ||
3294 | bond->proc_entry->proc_fops = &bond_info_fops; | ||
3295 | bond->proc_entry->owner = THIS_MODULE; | ||
3296 | memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ); | 3293 | memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ); |
3297 | } | 3294 | } |
3298 | } | 3295 | } |
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h index eb305a0895fc..4fdb13f8447b 100644 --- a/drivers/net/cxgb3/adapter.h +++ b/drivers/net/cxgb3/adapter.h | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/mutex.h> | 43 | #include <linux/mutex.h> |
44 | #include <linux/bitops.h> | 44 | #include <linux/bitops.h> |
45 | #include "t3cdev.h" | 45 | #include "t3cdev.h" |
46 | #include <asm/semaphore.h> | ||
47 | #include <asm/io.h> | 46 | #include <asm/io.h> |
48 | 47 | ||
49 | struct vlan_group; | 48 | struct vlan_group; |
diff --git a/drivers/net/cxgb3/t3cdev.h b/drivers/net/cxgb3/t3cdev.h index 77fcc1a4984e..a18c8a140424 100644 --- a/drivers/net/cxgb3/t3cdev.h +++ b/drivers/net/cxgb3/t3cdev.h | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | #include <linux/list.h> | 35 | #include <linux/list.h> |
36 | #include <asm/atomic.h> | 36 | #include <asm/atomic.h> |
37 | #include <asm/semaphore.h> | ||
38 | #include <linux/netdevice.h> | 37 | #include <linux/netdevice.h> |
39 | #include <linux/proc_fs.h> | 38 | #include <linux/proc_fs.h> |
40 | #include <linux/skbuff.h> | 39 | #include <linux/skbuff.h> |
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h index 229303ff6a39..a0177fc55e28 100644 --- a/drivers/net/cxgb3/version.h +++ b/drivers/net/cxgb3/version.h | |||
@@ -38,7 +38,7 @@ | |||
38 | #define DRV_VERSION "1.0-ko" | 38 | #define DRV_VERSION "1.0-ko" |
39 | 39 | ||
40 | /* Firmware version */ | 40 | /* Firmware version */ |
41 | #define FW_VERSION_MAJOR 5 | 41 | #define FW_VERSION_MAJOR 6 |
42 | #define FW_VERSION_MINOR 0 | 42 | #define FW_VERSION_MINOR 0 |
43 | #define FW_VERSION_MICRO 0 | 43 | #define FW_VERSION_MICRO 0 |
44 | #endif /* __CHELSIO_VERSION_H */ | 44 | #endif /* __CHELSIO_VERSION_H */ |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 2d139ec79777..f3cba5e24ec5 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1802,7 +1802,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | |||
1802 | * it is protected by the before last buffer's el bit being set */ | 1802 | * it is protected by the before last buffer's el bit being set */ |
1803 | if (rx->prev->skb) { | 1803 | if (rx->prev->skb) { |
1804 | struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data; | 1804 | struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data; |
1805 | put_unaligned(cpu_to_le32(rx->dma_addr), &prev_rfd->link); | 1805 | put_unaligned_le32(rx->dma_addr, &prev_rfd->link); |
1806 | } | 1806 | } |
1807 | 1807 | ||
1808 | return 0; | 1808 | return 0; |
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index e5e6352556fa..d21b7ab64bd1 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
@@ -491,20 +491,23 @@ static irqreturn_t mpc52xx_fec_interrupt(int irq, void *dev_id) | |||
491 | 491 | ||
492 | out_be32(&fec->ievent, ievent); /* clear pending events */ | 492 | out_be32(&fec->ievent, ievent); /* clear pending events */ |
493 | 493 | ||
494 | if (ievent & ~(FEC_IEVENT_RFIFO_ERROR | FEC_IEVENT_XFIFO_ERROR)) { | 494 | /* on fifo error, soft-reset fec */ |
495 | if (ievent & ~FEC_IEVENT_TFINT) | 495 | if (ievent & (FEC_IEVENT_RFIFO_ERROR | FEC_IEVENT_XFIFO_ERROR)) { |
496 | dev_dbg(&dev->dev, "ievent: %08x\n", ievent); | 496 | |
497 | if (net_ratelimit() && (ievent & FEC_IEVENT_RFIFO_ERROR)) | ||
498 | dev_warn(&dev->dev, "FEC_IEVENT_RFIFO_ERROR\n"); | ||
499 | if (net_ratelimit() && (ievent & FEC_IEVENT_XFIFO_ERROR)) | ||
500 | dev_warn(&dev->dev, "FEC_IEVENT_XFIFO_ERROR\n"); | ||
501 | |||
502 | mpc52xx_fec_reset(dev); | ||
503 | |||
504 | netif_wake_queue(dev); | ||
497 | return IRQ_HANDLED; | 505 | return IRQ_HANDLED; |
498 | } | 506 | } |
499 | 507 | ||
500 | if (net_ratelimit() && (ievent & FEC_IEVENT_RFIFO_ERROR)) | 508 | if (ievent & ~FEC_IEVENT_TFINT) |
501 | dev_warn(&dev->dev, "FEC_IEVENT_RFIFO_ERROR\n"); | 509 | dev_dbg(&dev->dev, "ievent: %08x\n", ievent); |
502 | if (net_ratelimit() && (ievent & FEC_IEVENT_XFIFO_ERROR)) | ||
503 | dev_warn(&dev->dev, "FEC_IEVENT_XFIFO_ERROR\n"); | ||
504 | 510 | ||
505 | mpc52xx_fec_reset(dev); | ||
506 | |||
507 | netif_wake_queue(dev); | ||
508 | return IRQ_HANDLED; | 511 | return IRQ_HANDLED; |
509 | } | 512 | } |
510 | 513 | ||
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index b53f6b6491b3..e5c2380f50ca 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c | |||
@@ -1508,7 +1508,7 @@ static int hamachi_rx(struct net_device *dev) | |||
1508 | hmp->rx_buf_sz, | 1508 | hmp->rx_buf_sz, |
1509 | PCI_DMA_FROMDEVICE); | 1509 | PCI_DMA_FROMDEVICE); |
1510 | buf_addr = (u8 *) hmp->rx_skbuff[entry]->data; | 1510 | buf_addr = (u8 *) hmp->rx_skbuff[entry]->data; |
1511 | frame_status = le32_to_cpu(get_unaligned((__le32*)&(buf_addr[data_size - 12]))); | 1511 | frame_status = get_unaligned_le32(&(buf_addr[data_size - 12])); |
1512 | if (hamachi_debug > 4) | 1512 | if (hamachi_debug > 4) |
1513 | printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n", | 1513 | printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n", |
1514 | frame_status); | 1514 | frame_status); |
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 0a9b75139e0f..9d5721287d6f 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/ip.h> | 34 | #include <linux/ip.h> |
35 | #include <linux/tcp.h> | 35 | #include <linux/tcp.h> |
36 | #include <asm/semaphore.h> | 36 | #include <linux/semaphore.h> |
37 | #include <asm/atomic.h> | 37 | #include <asm/atomic.h> |
38 | 38 | ||
39 | #define SIXPACK_VERSION "Revision: 0.3.0" | 39 | #define SIXPACK_VERSION "Revision: 0.3.0" |
@@ -148,13 +148,13 @@ static void sp_xmit_on_air(unsigned long channel) | |||
148 | 148 | ||
149 | if (((sp->status1 & SIXP_DCD_MASK) == 0) && (random < sp->persistence)) { | 149 | if (((sp->status1 & SIXP_DCD_MASK) == 0) && (random < sp->persistence)) { |
150 | sp->led_state = 0x70; | 150 | sp->led_state = 0x70; |
151 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 151 | sp->tty->ops->write(sp->tty, &sp->led_state, 1); |
152 | sp->tx_enable = 1; | 152 | sp->tx_enable = 1; |
153 | actual = sp->tty->driver->write(sp->tty, sp->xbuff, sp->status2); | 153 | actual = sp->tty->ops->write(sp->tty, sp->xbuff, sp->status2); |
154 | sp->xleft -= actual; | 154 | sp->xleft -= actual; |
155 | sp->xhead += actual; | 155 | sp->xhead += actual; |
156 | sp->led_state = 0x60; | 156 | sp->led_state = 0x60; |
157 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 157 | sp->tty->ops->write(sp->tty, &sp->led_state, 1); |
158 | sp->status2 = 0; | 158 | sp->status2 = 0; |
159 | } else | 159 | } else |
160 | mod_timer(&sp->tx_t, jiffies + ((when + 1) * HZ) / 100); | 160 | mod_timer(&sp->tx_t, jiffies + ((when + 1) * HZ) / 100); |
@@ -220,13 +220,13 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) | |||
220 | */ | 220 | */ |
221 | if (sp->duplex == 1) { | 221 | if (sp->duplex == 1) { |
222 | sp->led_state = 0x70; | 222 | sp->led_state = 0x70; |
223 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 223 | sp->tty->ops->write(sp->tty, &sp->led_state, 1); |
224 | sp->tx_enable = 1; | 224 | sp->tx_enable = 1; |
225 | actual = sp->tty->driver->write(sp->tty, sp->xbuff, count); | 225 | actual = sp->tty->ops->write(sp->tty, sp->xbuff, count); |
226 | sp->xleft = count - actual; | 226 | sp->xleft = count - actual; |
227 | sp->xhead = sp->xbuff + actual; | 227 | sp->xhead = sp->xbuff + actual; |
228 | sp->led_state = 0x60; | 228 | sp->led_state = 0x60; |
229 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 229 | sp->tty->ops->write(sp->tty, &sp->led_state, 1); |
230 | } else { | 230 | } else { |
231 | sp->xleft = count; | 231 | sp->xleft = count; |
232 | sp->xhead = sp->xbuff; | 232 | sp->xhead = sp->xbuff; |
@@ -444,7 +444,7 @@ static void sixpack_write_wakeup(struct tty_struct *tty) | |||
444 | } | 444 | } |
445 | 445 | ||
446 | if (sp->tx_enable) { | 446 | if (sp->tx_enable) { |
447 | actual = tty->driver->write(tty, sp->xhead, sp->xleft); | 447 | actual = tty->ops->write(tty, sp->xhead, sp->xleft); |
448 | sp->xleft -= actual; | 448 | sp->xleft -= actual; |
449 | sp->xhead += actual; | 449 | sp->xhead += actual; |
450 | } | 450 | } |
@@ -491,9 +491,7 @@ static void sixpack_receive_buf(struct tty_struct *tty, | |||
491 | sixpack_decode(sp, buf, count1); | 491 | sixpack_decode(sp, buf, count1); |
492 | 492 | ||
493 | sp_put(sp); | 493 | sp_put(sp); |
494 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) | 494 | tty_unthrottle(tty); |
495 | && tty->driver->unthrottle) | ||
496 | tty->driver->unthrottle(tty); | ||
497 | } | 495 | } |
498 | 496 | ||
499 | /* | 497 | /* |
@@ -554,8 +552,8 @@ static void resync_tnc(unsigned long channel) | |||
554 | /* resync the TNC */ | 552 | /* resync the TNC */ |
555 | 553 | ||
556 | sp->led_state = 0x60; | 554 | sp->led_state = 0x60; |
557 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 555 | sp->tty->ops->write(sp->tty, &sp->led_state, 1); |
558 | sp->tty->driver->write(sp->tty, &resync_cmd, 1); | 556 | sp->tty->ops->write(sp->tty, &resync_cmd, 1); |
559 | 557 | ||
560 | 558 | ||
561 | /* Start resync timer again -- the TNC might be still absent */ | 559 | /* Start resync timer again -- the TNC might be still absent */ |
@@ -573,7 +571,7 @@ static inline int tnc_init(struct sixpack *sp) | |||
573 | 571 | ||
574 | tnc_set_sync_state(sp, TNC_UNSYNC_STARTUP); | 572 | tnc_set_sync_state(sp, TNC_UNSYNC_STARTUP); |
575 | 573 | ||
576 | sp->tty->driver->write(sp->tty, &inbyte, 1); | 574 | sp->tty->ops->write(sp->tty, &inbyte, 1); |
577 | 575 | ||
578 | del_timer(&sp->resync_t); | 576 | del_timer(&sp->resync_t); |
579 | sp->resync_t.data = (unsigned long) sp; | 577 | sp->resync_t.data = (unsigned long) sp; |
@@ -601,6 +599,8 @@ static int sixpack_open(struct tty_struct *tty) | |||
601 | 599 | ||
602 | if (!capable(CAP_NET_ADMIN)) | 600 | if (!capable(CAP_NET_ADMIN)) |
603 | return -EPERM; | 601 | return -EPERM; |
602 | if (tty->ops->write == NULL) | ||
603 | return -EOPNOTSUPP; | ||
604 | 604 | ||
605 | dev = alloc_netdev(sizeof(struct sixpack), "sp%d", sp_setup); | 605 | dev = alloc_netdev(sizeof(struct sixpack), "sp%d", sp_setup); |
606 | if (!dev) { | 606 | if (!dev) { |
@@ -914,9 +914,9 @@ static void decode_prio_command(struct sixpack *sp, unsigned char cmd) | |||
914 | } else { /* output watchdog char if idle */ | 914 | } else { /* output watchdog char if idle */ |
915 | if ((sp->status2 != 0) && (sp->duplex == 1)) { | 915 | if ((sp->status2 != 0) && (sp->duplex == 1)) { |
916 | sp->led_state = 0x70; | 916 | sp->led_state = 0x70; |
917 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 917 | sp->tty->ops->write(sp->tty, &sp->led_state, 1); |
918 | sp->tx_enable = 1; | 918 | sp->tx_enable = 1; |
919 | actual = sp->tty->driver->write(sp->tty, sp->xbuff, sp->status2); | 919 | actual = sp->tty->ops->write(sp->tty, sp->xbuff, sp->status2); |
920 | sp->xleft -= actual; | 920 | sp->xleft -= actual; |
921 | sp->xhead += actual; | 921 | sp->xhead += actual; |
922 | sp->led_state = 0x60; | 922 | sp->led_state = 0x60; |
@@ -926,7 +926,7 @@ static void decode_prio_command(struct sixpack *sp, unsigned char cmd) | |||
926 | } | 926 | } |
927 | 927 | ||
928 | /* needed to trigger the TNC watchdog */ | 928 | /* needed to trigger the TNC watchdog */ |
929 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 929 | sp->tty->ops->write(sp->tty, &sp->led_state, 1); |
930 | 930 | ||
931 | /* if the state byte has been received, the TNC is present, | 931 | /* if the state byte has been received, the TNC is present, |
932 | so the resync timer can be reset. */ | 932 | so the resync timer can be reset. */ |
@@ -956,12 +956,12 @@ static void decode_std_command(struct sixpack *sp, unsigned char cmd) | |||
956 | if ((sp->status & SIXP_RX_DCD_MASK) == | 956 | if ((sp->status & SIXP_RX_DCD_MASK) == |
957 | SIXP_RX_DCD_MASK) { | 957 | SIXP_RX_DCD_MASK) { |
958 | sp->led_state = 0x68; | 958 | sp->led_state = 0x68; |
959 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 959 | sp->tty->ops->write(sp->tty, &sp->led_state, 1); |
960 | } | 960 | } |
961 | } else { | 961 | } else { |
962 | sp->led_state = 0x60; | 962 | sp->led_state = 0x60; |
963 | /* fill trailing bytes with zeroes */ | 963 | /* fill trailing bytes with zeroes */ |
964 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 964 | sp->tty->ops->write(sp->tty, &sp->led_state, 1); |
965 | rest = sp->rx_count; | 965 | rest = sp->rx_count; |
966 | if (rest != 0) | 966 | if (rest != 0) |
967 | for (i = rest; i <= 3; i++) | 967 | for (i = rest; i <= 3; i++) |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 30c9b3b0d131..65166035aca0 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -516,7 +516,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) | |||
516 | spin_unlock_bh(&ax->buflock); | 516 | spin_unlock_bh(&ax->buflock); |
517 | 517 | ||
518 | set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); | 518 | set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); |
519 | actual = ax->tty->driver->write(ax->tty, ax->xbuff, count); | 519 | actual = ax->tty->ops->write(ax->tty, ax->xbuff, count); |
520 | ax->stats.tx_packets++; | 520 | ax->stats.tx_packets++; |
521 | ax->stats.tx_bytes += actual; | 521 | ax->stats.tx_bytes += actual; |
522 | 522 | ||
@@ -546,7 +546,7 @@ static int ax_xmit(struct sk_buff *skb, struct net_device *dev) | |||
546 | } | 546 | } |
547 | 547 | ||
548 | printk(KERN_ERR "mkiss: %s: transmit timed out, %s?\n", dev->name, | 548 | printk(KERN_ERR "mkiss: %s: transmit timed out, %s?\n", dev->name, |
549 | (ax->tty->driver->chars_in_buffer(ax->tty) || ax->xleft) ? | 549 | (ax->tty->ops->chars_in_buffer(ax->tty) || ax->xleft) ? |
550 | "bad line quality" : "driver error"); | 550 | "bad line quality" : "driver error"); |
551 | 551 | ||
552 | ax->xleft = 0; | 552 | ax->xleft = 0; |
@@ -736,6 +736,8 @@ static int mkiss_open(struct tty_struct *tty) | |||
736 | 736 | ||
737 | if (!capable(CAP_NET_ADMIN)) | 737 | if (!capable(CAP_NET_ADMIN)) |
738 | return -EPERM; | 738 | return -EPERM; |
739 | if (tty->ops->write == NULL) | ||
740 | return -EOPNOTSUPP; | ||
739 | 741 | ||
740 | dev = alloc_netdev(sizeof(struct mkiss), "ax%d", ax_setup); | 742 | dev = alloc_netdev(sizeof(struct mkiss), "ax%d", ax_setup); |
741 | if (!dev) { | 743 | if (!dev) { |
@@ -754,8 +756,7 @@ static int mkiss_open(struct tty_struct *tty) | |||
754 | tty->disc_data = ax; | 756 | tty->disc_data = ax; |
755 | tty->receive_room = 65535; | 757 | tty->receive_room = 65535; |
756 | 758 | ||
757 | if (tty->driver->flush_buffer) | 759 | tty_driver_flush_buffer(tty); |
758 | tty->driver->flush_buffer(tty); | ||
759 | 760 | ||
760 | /* Restore default settings */ | 761 | /* Restore default settings */ |
761 | dev->type = ARPHRD_AX25; | 762 | dev->type = ARPHRD_AX25; |
@@ -935,9 +936,7 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
935 | } | 936 | } |
936 | 937 | ||
937 | mkiss_put(ax); | 938 | mkiss_put(ax); |
938 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) | 939 | tty_unthrottle(tty); |
939 | && tty->driver->unthrottle) | ||
940 | tty->driver->unthrottle(tty); | ||
941 | } | 940 | } |
942 | 941 | ||
943 | /* | 942 | /* |
@@ -962,7 +961,7 @@ static void mkiss_write_wakeup(struct tty_struct *tty) | |||
962 | goto out; | 961 | goto out; |
963 | } | 962 | } |
964 | 963 | ||
965 | actual = tty->driver->write(tty, ax->xhead, ax->xleft); | 964 | actual = tty->ops->write(tty, ax->xhead, ax->xleft); |
966 | ax->xleft -= actual; | 965 | ax->xleft -= actual; |
967 | ax->xhead += actual; | 966 | ax->xhead += actual; |
968 | 967 | ||
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index bb31e09899fc..00527805e4f1 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/in.h> | 49 | #include <linux/in.h> |
50 | #include <linux/ip.h> | 50 | #include <linux/ip.h> |
51 | #include <net/net_namespace.h> | 51 | #include <net/net_namespace.h> |
52 | #include <asm/semaphore.h> | ||
53 | #include <asm/hvcall.h> | 52 | #include <asm/hvcall.h> |
54 | #include <asm/atomic.h> | 53 | #include <asm/atomic.h> |
55 | #include <asm/vio.h> | 54 | #include <asm/vio.h> |
@@ -1303,13 +1302,10 @@ static void ibmveth_proc_register_adapter(struct ibmveth_adapter *adapter) | |||
1303 | if (ibmveth_proc_dir) { | 1302 | if (ibmveth_proc_dir) { |
1304 | char u_addr[10]; | 1303 | char u_addr[10]; |
1305 | sprintf(u_addr, "%x", adapter->vdev->unit_address); | 1304 | sprintf(u_addr, "%x", adapter->vdev->unit_address); |
1306 | entry = create_proc_entry(u_addr, S_IFREG, ibmveth_proc_dir); | 1305 | entry = proc_create_data(u_addr, S_IFREG, ibmveth_proc_dir, |
1307 | if (!entry) { | 1306 | &ibmveth_proc_fops, adapter); |
1307 | if (!entry) | ||
1308 | ibmveth_error_printk("Cannot create adapter proc entry"); | 1308 | ibmveth_error_printk("Cannot create adapter proc entry"); |
1309 | } else { | ||
1310 | entry->data = (void *) adapter; | ||
1311 | entry->proc_fops = &ibmveth_proc_fops; | ||
1312 | } | ||
1313 | } | 1309 | } |
1314 | return; | 1310 | return; |
1315 | } | 1311 | } |
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index fc753d7f674e..e6f40b7f9041 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -64,7 +64,7 @@ static int irtty_chars_in_buffer(struct sir_dev *dev) | |||
64 | IRDA_ASSERT(priv != NULL, return -1;); | 64 | IRDA_ASSERT(priv != NULL, return -1;); |
65 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -1;); | 65 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -1;); |
66 | 66 | ||
67 | return priv->tty->driver->chars_in_buffer(priv->tty); | 67 | return tty_chars_in_buffer(priv->tty); |
68 | } | 68 | } |
69 | 69 | ||
70 | /* Wait (sleep) until underlaying hardware finished transmission | 70 | /* Wait (sleep) until underlaying hardware finished transmission |
@@ -93,10 +93,8 @@ static void irtty_wait_until_sent(struct sir_dev *dev) | |||
93 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return;); | 93 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return;); |
94 | 94 | ||
95 | tty = priv->tty; | 95 | tty = priv->tty; |
96 | if (tty->driver->wait_until_sent) { | 96 | if (tty->ops->wait_until_sent) { |
97 | lock_kernel(); | 97 | tty->ops->wait_until_sent(tty, msecs_to_jiffies(100)); |
98 | tty->driver->wait_until_sent(tty, msecs_to_jiffies(100)); | ||
99 | unlock_kernel(); | ||
100 | } | 98 | } |
101 | else { | 99 | else { |
102 | msleep(USBSERIAL_TX_DONE_DELAY); | 100 | msleep(USBSERIAL_TX_DONE_DELAY); |
@@ -125,48 +123,14 @@ static int irtty_change_speed(struct sir_dev *dev, unsigned speed) | |||
125 | 123 | ||
126 | tty = priv->tty; | 124 | tty = priv->tty; |
127 | 125 | ||
128 | lock_kernel(); | 126 | mutex_lock(&tty->termios_mutex); |
129 | old_termios = *(tty->termios); | 127 | old_termios = *(tty->termios); |
130 | cflag = tty->termios->c_cflag; | 128 | cflag = tty->termios->c_cflag; |
131 | 129 | tty_encode_baud_rate(tty, speed, speed); | |
132 | cflag &= ~CBAUD; | 130 | if (tty->ops->set_termios) |
133 | 131 | tty->ops->set_termios(tty, &old_termios); | |
134 | IRDA_DEBUG(2, "%s(), Setting speed to %d\n", __FUNCTION__, speed); | ||
135 | |||
136 | switch (speed) { | ||
137 | case 1200: | ||
138 | cflag |= B1200; | ||
139 | break; | ||
140 | case 2400: | ||
141 | cflag |= B2400; | ||
142 | break; | ||
143 | case 4800: | ||
144 | cflag |= B4800; | ||
145 | break; | ||
146 | case 19200: | ||
147 | cflag |= B19200; | ||
148 | break; | ||
149 | case 38400: | ||
150 | cflag |= B38400; | ||
151 | break; | ||
152 | case 57600: | ||
153 | cflag |= B57600; | ||
154 | break; | ||
155 | case 115200: | ||
156 | cflag |= B115200; | ||
157 | break; | ||
158 | case 9600: | ||
159 | default: | ||
160 | cflag |= B9600; | ||
161 | break; | ||
162 | } | ||
163 | |||
164 | tty->termios->c_cflag = cflag; | ||
165 | if (tty->driver->set_termios) | ||
166 | tty->driver->set_termios(tty, &old_termios); | ||
167 | unlock_kernel(); | ||
168 | |||
169 | priv->io.speed = speed; | 132 | priv->io.speed = speed; |
133 | mutex_unlock(&tty->termios_mutex); | ||
170 | 134 | ||
171 | return 0; | 135 | return 0; |
172 | } | 136 | } |
@@ -202,8 +166,8 @@ static int irtty_set_dtr_rts(struct sir_dev *dev, int dtr, int rts) | |||
202 | * This function is not yet defined for all tty driver, so | 166 | * This function is not yet defined for all tty driver, so |
203 | * let's be careful... Jean II | 167 | * let's be careful... Jean II |
204 | */ | 168 | */ |
205 | IRDA_ASSERT(priv->tty->driver->tiocmset != NULL, return -1;); | 169 | IRDA_ASSERT(priv->tty->ops->tiocmset != NULL, return -1;); |
206 | priv->tty->driver->tiocmset(priv->tty, NULL, set, clear); | 170 | priv->tty->ops->tiocmset(priv->tty, NULL, set, clear); |
207 | 171 | ||
208 | return 0; | 172 | return 0; |
209 | } | 173 | } |
@@ -225,17 +189,13 @@ static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t | |||
225 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -1;); | 189 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -1;); |
226 | 190 | ||
227 | tty = priv->tty; | 191 | tty = priv->tty; |
228 | if (!tty->driver->write) | 192 | if (!tty->ops->write) |
229 | return 0; | 193 | return 0; |
230 | tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); | 194 | tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); |
231 | if (tty->driver->write_room) { | 195 | writelen = tty_write_room(tty); |
232 | writelen = tty->driver->write_room(tty); | 196 | if (writelen > len) |
233 | if (writelen > len) | ||
234 | writelen = len; | ||
235 | } | ||
236 | else | ||
237 | writelen = len; | 197 | writelen = len; |
238 | return tty->driver->write(tty, ptr, writelen); | 198 | return tty->ops->write(tty, ptr, writelen); |
239 | } | 199 | } |
240 | 200 | ||
241 | /* ------------------------------------------------------- */ | 201 | /* ------------------------------------------------------- */ |
@@ -321,7 +281,7 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop) | |||
321 | struct ktermios old_termios; | 281 | struct ktermios old_termios; |
322 | int cflag; | 282 | int cflag; |
323 | 283 | ||
324 | lock_kernel(); | 284 | mutex_lock(&tty->termios_mutex); |
325 | old_termios = *(tty->termios); | 285 | old_termios = *(tty->termios); |
326 | cflag = tty->termios->c_cflag; | 286 | cflag = tty->termios->c_cflag; |
327 | 287 | ||
@@ -331,9 +291,9 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop) | |||
331 | cflag |= CREAD; | 291 | cflag |= CREAD; |
332 | 292 | ||
333 | tty->termios->c_cflag = cflag; | 293 | tty->termios->c_cflag = cflag; |
334 | if (tty->driver->set_termios) | 294 | if (tty->ops->set_termios) |
335 | tty->driver->set_termios(tty, &old_termios); | 295 | tty->ops->set_termios(tty, &old_termios); |
336 | unlock_kernel(); | 296 | mutex_unlock(&tty->termios_mutex); |
337 | } | 297 | } |
338 | 298 | ||
339 | /*****************************************************************/ | 299 | /*****************************************************************/ |
@@ -359,8 +319,8 @@ static int irtty_start_dev(struct sir_dev *dev) | |||
359 | 319 | ||
360 | tty = priv->tty; | 320 | tty = priv->tty; |
361 | 321 | ||
362 | if (tty->driver->start) | 322 | if (tty->ops->start) |
363 | tty->driver->start(tty); | 323 | tty->ops->start(tty); |
364 | /* Make sure we can receive more data */ | 324 | /* Make sure we can receive more data */ |
365 | irtty_stop_receiver(tty, FALSE); | 325 | irtty_stop_receiver(tty, FALSE); |
366 | 326 | ||
@@ -388,8 +348,8 @@ static int irtty_stop_dev(struct sir_dev *dev) | |||
388 | 348 | ||
389 | /* Make sure we don't receive more data */ | 349 | /* Make sure we don't receive more data */ |
390 | irtty_stop_receiver(tty, TRUE); | 350 | irtty_stop_receiver(tty, TRUE); |
391 | if (tty->driver->stop) | 351 | if (tty->ops->stop) |
392 | tty->driver->stop(tty); | 352 | tty->ops->stop(tty); |
393 | 353 | ||
394 | mutex_unlock(&irtty_mutex); | 354 | mutex_unlock(&irtty_mutex); |
395 | 355 | ||
@@ -483,11 +443,10 @@ static int irtty_open(struct tty_struct *tty) | |||
483 | 443 | ||
484 | /* stop the underlying driver */ | 444 | /* stop the underlying driver */ |
485 | irtty_stop_receiver(tty, TRUE); | 445 | irtty_stop_receiver(tty, TRUE); |
486 | if (tty->driver->stop) | 446 | if (tty->ops->stop) |
487 | tty->driver->stop(tty); | 447 | tty->ops->stop(tty); |
488 | 448 | ||
489 | if (tty->driver->flush_buffer) | 449 | tty_driver_flush_buffer(tty); |
490 | tty->driver->flush_buffer(tty); | ||
491 | 450 | ||
492 | /* apply mtt override */ | 451 | /* apply mtt override */ |
493 | sir_tty_drv.qos_mtt_bits = qos_mtt_bits; | 452 | sir_tty_drv.qos_mtt_bits = qos_mtt_bits; |
@@ -564,8 +523,8 @@ static void irtty_close(struct tty_struct *tty) | |||
564 | /* Stop tty */ | 523 | /* Stop tty */ |
565 | irtty_stop_receiver(tty, TRUE); | 524 | irtty_stop_receiver(tty, TRUE); |
566 | tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); | 525 | tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); |
567 | if (tty->driver->stop) | 526 | if (tty->ops->stop) |
568 | tty->driver->stop(tty); | 527 | tty->ops->stop(tty); |
569 | 528 | ||
570 | kfree(priv); | 529 | kfree(priv); |
571 | 530 | ||
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index 93916cf33f29..ad92d3ff1c40 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c | |||
@@ -464,7 +464,7 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len) | |||
464 | } | 464 | } |
465 | 465 | ||
466 | fcs = ~(crc32_le(~0, buf, new_len)); | 466 | fcs = ~(crc32_le(~0, buf, new_len)); |
467 | if(fcs != le32_to_cpu(get_unaligned((__le32 *)(buf+new_len)))) { | 467 | if(fcs != get_unaligned_le32(buf + new_len)) { |
468 | IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len); | 468 | IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len); |
469 | mcs->stats.rx_errors++; | 469 | mcs->stats.rx_errors++; |
470 | mcs->stats.rx_crc_errors++; | 470 | mcs->stats.rx_crc_errors++; |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 60b94bb4d25e..d5c2d27f3ea4 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/hardware.h> | 36 | #include <asm/hardware.h> |
37 | #include <asm/arch/irda.h> | 37 | #include <asm/arch/irda.h> |
38 | #include <asm/arch/pxa-regs.h> | 38 | #include <asm/arch/pxa-regs.h> |
39 | #include <asm/arch/pxa2xx-gpio.h> | ||
39 | 40 | ||
40 | #ifdef CONFIG_MACH_MAINSTONE | 41 | #ifdef CONFIG_MACH_MAINSTONE |
41 | #include <asm/arch/mainstone.h> | 42 | #include <asm/arch/mainstone.h> |
@@ -831,6 +832,11 @@ static int pxa_irda_probe(struct platform_device *pdev) | |||
831 | if (err) | 832 | if (err) |
832 | goto err_mem_5; | 833 | goto err_mem_5; |
833 | 834 | ||
835 | if (si->pdata->startup) | ||
836 | err = si->pdata->startup(si->dev); | ||
837 | if (err) | ||
838 | goto err_startup; | ||
839 | |||
834 | dev->hard_start_xmit = pxa_irda_hard_xmit; | 840 | dev->hard_start_xmit = pxa_irda_hard_xmit; |
835 | dev->open = pxa_irda_start; | 841 | dev->open = pxa_irda_start; |
836 | dev->stop = pxa_irda_stop; | 842 | dev->stop = pxa_irda_stop; |
@@ -856,6 +862,9 @@ static int pxa_irda_probe(struct platform_device *pdev) | |||
856 | dev_set_drvdata(&pdev->dev, dev); | 862 | dev_set_drvdata(&pdev->dev, dev); |
857 | 863 | ||
858 | if (err) { | 864 | if (err) { |
865 | if (si->pdata->shutdown) | ||
866 | si->pdata->shutdown(si->dev); | ||
867 | err_startup: | ||
859 | kfree(si->tx_buff.head); | 868 | kfree(si->tx_buff.head); |
860 | err_mem_5: | 869 | err_mem_5: |
861 | kfree(si->rx_buff.head); | 870 | kfree(si->rx_buff.head); |
@@ -881,6 +890,8 @@ static int pxa_irda_remove(struct platform_device *_dev) | |||
881 | if (dev) { | 890 | if (dev) { |
882 | struct pxa_irda *si = netdev_priv(dev); | 891 | struct pxa_irda *si = netdev_priv(dev); |
883 | unregister_netdev(dev); | 892 | unregister_netdev(dev); |
893 | if (si->pdata->shutdown) | ||
894 | si->pdata->shutdown(si->dev); | ||
884 | kfree(si->tx_buff.head); | 895 | kfree(si->tx_buff.head); |
885 | kfree(si->rx_buff.head); | 896 | kfree(si->rx_buff.head); |
886 | clk_put(si->fir_clk); | 897 | clk_put(si->fir_clk); |
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index e59c485bc497..051963782749 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -329,7 +329,7 @@ static void fir_eof(struct stir_cb *stir) | |||
329 | } | 329 | } |
330 | 330 | ||
331 | fcs = ~(crc32_le(~0, rx_buff->data, len)); | 331 | fcs = ~(crc32_le(~0, rx_buff->data, len)); |
332 | if (fcs != le32_to_cpu(get_unaligned((__le32 *)(rx_buff->data+len)))) { | 332 | if (fcs != get_unaligned_le32(rx_buff->data + len)) { |
333 | pr_debug("crc error calc 0x%x len %d\n", fcs, len); | 333 | pr_debug("crc error calc 0x%x len %d\n", fcs, len); |
334 | stir->stats.rx_errors++; | 334 | stir->stats.rx_errors++; |
335 | stir->stats.rx_crc_errors++; | 335 | stir->stats.rx_crc_errors++; |
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index acd082a96a4f..d15e00b8591e 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c | |||
@@ -1674,13 +1674,12 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1674 | if (vlsi_proc_root != NULL) { | 1674 | if (vlsi_proc_root != NULL) { |
1675 | struct proc_dir_entry *ent; | 1675 | struct proc_dir_entry *ent; |
1676 | 1676 | ||
1677 | ent = create_proc_entry(ndev->name, S_IFREG|S_IRUGO, vlsi_proc_root); | 1677 | ent = proc_create_data(ndev->name, S_IFREG|S_IRUGO, |
1678 | vlsi_proc_root, VLSI_PROC_FOPS, ndev); | ||
1678 | if (!ent) { | 1679 | if (!ent) { |
1679 | IRDA_WARNING("%s: failed to create proc entry\n", | 1680 | IRDA_WARNING("%s: failed to create proc entry\n", |
1680 | __FUNCTION__); | 1681 | __FUNCTION__); |
1681 | } else { | 1682 | } else { |
1682 | ent->data = ndev; | ||
1683 | ent->proc_fops = VLSI_PROC_FOPS; | ||
1684 | ent->size = 0; | 1683 | ent->size = 0; |
1685 | } | 1684 | } |
1686 | idev->proc_entry = ent; | 1685 | idev->proc_entry = ent; |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 58d3bb622da6..b8d0639c1cdf 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -308,7 +308,8 @@ static void veth_complete_allocation(void *parm, int number) | |||
308 | 308 | ||
309 | static int veth_allocate_events(HvLpIndex rlp, int number) | 309 | static int veth_allocate_events(HvLpIndex rlp, int number) |
310 | { | 310 | { |
311 | struct veth_allocation vc = { COMPLETION_INITIALIZER(vc.c), 0 }; | 311 | struct veth_allocation vc = |
312 | { COMPLETION_INITIALIZER_ONSTACK(vc.c), 0 }; | ||
312 | 313 | ||
313 | mf_allocate_lp_events(rlp, HvLpEvent_Type_VirtualLan, | 314 | mf_allocate_lp_events(rlp, HvLpEvent_Type_VirtualLan, |
314 | sizeof(struct veth_lpevent), number, | 315 | sizeof(struct veth_lpevent), number, |
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c index 75ef9d0d974d..f9d6b4dca180 100644 --- a/drivers/net/mlx4/alloc.c +++ b/drivers/net/mlx4/alloc.c | |||
@@ -196,3 +196,160 @@ void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf) | |||
196 | } | 196 | } |
197 | } | 197 | } |
198 | EXPORT_SYMBOL_GPL(mlx4_buf_free); | 198 | EXPORT_SYMBOL_GPL(mlx4_buf_free); |
199 | |||
200 | static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device) | ||
201 | { | ||
202 | struct mlx4_db_pgdir *pgdir; | ||
203 | |||
204 | pgdir = kzalloc(sizeof *pgdir, GFP_KERNEL); | ||
205 | if (!pgdir) | ||
206 | return NULL; | ||
207 | |||
208 | bitmap_fill(pgdir->order1, MLX4_DB_PER_PAGE / 2); | ||
209 | pgdir->bits[0] = pgdir->order0; | ||
210 | pgdir->bits[1] = pgdir->order1; | ||
211 | pgdir->db_page = dma_alloc_coherent(dma_device, PAGE_SIZE, | ||
212 | &pgdir->db_dma, GFP_KERNEL); | ||
213 | if (!pgdir->db_page) { | ||
214 | kfree(pgdir); | ||
215 | return NULL; | ||
216 | } | ||
217 | |||
218 | return pgdir; | ||
219 | } | ||
220 | |||
221 | static int mlx4_alloc_db_from_pgdir(struct mlx4_db_pgdir *pgdir, | ||
222 | struct mlx4_db *db, int order) | ||
223 | { | ||
224 | int o; | ||
225 | int i; | ||
226 | |||
227 | for (o = order; o <= 1; ++o) { | ||
228 | i = find_first_bit(pgdir->bits[o], MLX4_DB_PER_PAGE >> o); | ||
229 | if (i < MLX4_DB_PER_PAGE >> o) | ||
230 | goto found; | ||
231 | } | ||
232 | |||
233 | return -ENOMEM; | ||
234 | |||
235 | found: | ||
236 | clear_bit(i, pgdir->bits[o]); | ||
237 | |||
238 | i <<= o; | ||
239 | |||
240 | if (o > order) | ||
241 | set_bit(i ^ 1, pgdir->bits[order]); | ||
242 | |||
243 | db->u.pgdir = pgdir; | ||
244 | db->index = i; | ||
245 | db->db = pgdir->db_page + db->index; | ||
246 | db->dma = pgdir->db_dma + db->index * 4; | ||
247 | db->order = order; | ||
248 | |||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order) | ||
253 | { | ||
254 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
255 | struct mlx4_db_pgdir *pgdir; | ||
256 | int ret = 0; | ||
257 | |||
258 | mutex_lock(&priv->pgdir_mutex); | ||
259 | |||
260 | list_for_each_entry(pgdir, &priv->pgdir_list, list) | ||
261 | if (!mlx4_alloc_db_from_pgdir(pgdir, db, order)) | ||
262 | goto out; | ||
263 | |||
264 | pgdir = mlx4_alloc_db_pgdir(&(dev->pdev->dev)); | ||
265 | if (!pgdir) { | ||
266 | ret = -ENOMEM; | ||
267 | goto out; | ||
268 | } | ||
269 | |||
270 | list_add(&pgdir->list, &priv->pgdir_list); | ||
271 | |||
272 | /* This should never fail -- we just allocated an empty page: */ | ||
273 | WARN_ON(mlx4_alloc_db_from_pgdir(pgdir, db, order)); | ||
274 | |||
275 | out: | ||
276 | mutex_unlock(&priv->pgdir_mutex); | ||
277 | |||
278 | return ret; | ||
279 | } | ||
280 | EXPORT_SYMBOL_GPL(mlx4_db_alloc); | ||
281 | |||
282 | void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db) | ||
283 | { | ||
284 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
285 | int o; | ||
286 | int i; | ||
287 | |||
288 | mutex_lock(&priv->pgdir_mutex); | ||
289 | |||
290 | o = db->order; | ||
291 | i = db->index; | ||
292 | |||
293 | if (db->order == 0 && test_bit(i ^ 1, db->u.pgdir->order0)) { | ||
294 | clear_bit(i ^ 1, db->u.pgdir->order0); | ||
295 | ++o; | ||
296 | } | ||
297 | i >>= o; | ||
298 | set_bit(i, db->u.pgdir->bits[o]); | ||
299 | |||
300 | if (bitmap_full(db->u.pgdir->order1, MLX4_DB_PER_PAGE / 2)) { | ||
301 | dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE, | ||
302 | db->u.pgdir->db_page, db->u.pgdir->db_dma); | ||
303 | list_del(&db->u.pgdir->list); | ||
304 | kfree(db->u.pgdir); | ||
305 | } | ||
306 | |||
307 | mutex_unlock(&priv->pgdir_mutex); | ||
308 | } | ||
309 | EXPORT_SYMBOL_GPL(mlx4_db_free); | ||
310 | |||
311 | int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres, | ||
312 | int size, int max_direct) | ||
313 | { | ||
314 | int err; | ||
315 | |||
316 | err = mlx4_db_alloc(dev, &wqres->db, 1); | ||
317 | if (err) | ||
318 | return err; | ||
319 | |||
320 | *wqres->db.db = 0; | ||
321 | |||
322 | err = mlx4_buf_alloc(dev, size, max_direct, &wqres->buf); | ||
323 | if (err) | ||
324 | goto err_db; | ||
325 | |||
326 | err = mlx4_mtt_init(dev, wqres->buf.npages, wqres->buf.page_shift, | ||
327 | &wqres->mtt); | ||
328 | if (err) | ||
329 | goto err_buf; | ||
330 | |||
331 | err = mlx4_buf_write_mtt(dev, &wqres->mtt, &wqres->buf); | ||
332 | if (err) | ||
333 | goto err_mtt; | ||
334 | |||
335 | return 0; | ||
336 | |||
337 | err_mtt: | ||
338 | mlx4_mtt_cleanup(dev, &wqres->mtt); | ||
339 | err_buf: | ||
340 | mlx4_buf_free(dev, size, &wqres->buf); | ||
341 | err_db: | ||
342 | mlx4_db_free(dev, &wqres->db); | ||
343 | |||
344 | return err; | ||
345 | } | ||
346 | EXPORT_SYMBOL_GPL(mlx4_alloc_hwq_res); | ||
347 | |||
348 | void mlx4_free_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres, | ||
349 | int size) | ||
350 | { | ||
351 | mlx4_mtt_cleanup(dev, &wqres->mtt); | ||
352 | mlx4_buf_free(dev, size, &wqres->buf); | ||
353 | mlx4_db_free(dev, &wqres->db); | ||
354 | } | ||
355 | EXPORT_SYMBOL_GPL(mlx4_free_hwq_res); | ||
diff --git a/drivers/net/mlx4/cq.c b/drivers/net/mlx4/cq.c index caa5bcf54e35..95e87a2f8896 100644 --- a/drivers/net/mlx4/cq.c +++ b/drivers/net/mlx4/cq.c | |||
@@ -180,7 +180,7 @@ int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq, | |||
180 | cq_context->mtt_base_addr_h = mtt_addr >> 32; | 180 | cq_context->mtt_base_addr_h = mtt_addr >> 32; |
181 | cq_context->mtt_base_addr_l = cpu_to_be32(mtt_addr & 0xffffffff); | 181 | cq_context->mtt_base_addr_l = cpu_to_be32(mtt_addr & 0xffffffff); |
182 | 182 | ||
183 | err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 1); | 183 | err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 0); |
184 | 184 | ||
185 | mlx4_free_cmd_mailbox(dev, mailbox); | 185 | mlx4_free_cmd_mailbox(dev, mailbox); |
186 | return err; | 186 | return err; |
@@ -188,7 +188,8 @@ int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq, | |||
188 | EXPORT_SYMBOL_GPL(mlx4_cq_resize); | 188 | EXPORT_SYMBOL_GPL(mlx4_cq_resize); |
189 | 189 | ||
190 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, | 190 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, |
191 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq) | 191 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, |
192 | int collapsed) | ||
192 | { | 193 | { |
193 | struct mlx4_priv *priv = mlx4_priv(dev); | 194 | struct mlx4_priv *priv = mlx4_priv(dev); |
194 | struct mlx4_cq_table *cq_table = &priv->cq_table; | 195 | struct mlx4_cq_table *cq_table = &priv->cq_table; |
@@ -224,6 +225,7 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, | |||
224 | cq_context = mailbox->buf; | 225 | cq_context = mailbox->buf; |
225 | memset(cq_context, 0, sizeof *cq_context); | 226 | memset(cq_context, 0, sizeof *cq_context); |
226 | 227 | ||
228 | cq_context->flags = cpu_to_be32(!!collapsed << 18); | ||
227 | cq_context->logsize_usrpage = cpu_to_be32((ilog2(nent) << 24) | uar->index); | 229 | cq_context->logsize_usrpage = cpu_to_be32((ilog2(nent) << 24) | uar->index); |
228 | cq_context->comp_eqn = priv->eq_table.eq[MLX4_EQ_COMP].eqn; | 230 | cq_context->comp_eqn = priv->eq_table.eq[MLX4_EQ_COMP].eqn; |
229 | cq_context->log_page_size = mtt->page_shift - MLX4_ICM_PAGE_SHIFT; | 231 | cq_context->log_page_size = mtt->page_shift - MLX4_ICM_PAGE_SHIFT; |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 49a4acab5e82..a6aa49fc1d68 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -798,6 +798,9 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
798 | INIT_LIST_HEAD(&priv->ctx_list); | 798 | INIT_LIST_HEAD(&priv->ctx_list); |
799 | spin_lock_init(&priv->ctx_lock); | 799 | spin_lock_init(&priv->ctx_lock); |
800 | 800 | ||
801 | INIT_LIST_HEAD(&priv->pgdir_list); | ||
802 | mutex_init(&priv->pgdir_mutex); | ||
803 | |||
801 | /* | 804 | /* |
802 | * Now reset the HCA before we touch the PCI capabilities or | 805 | * Now reset the HCA before we touch the PCI capabilities or |
803 | * attempt a firmware command, since a boot ROM may have left | 806 | * attempt a firmware command, since a boot ROM may have left |
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 73336810e652..a4023c2dd050 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h | |||
@@ -257,6 +257,9 @@ struct mlx4_priv { | |||
257 | struct list_head ctx_list; | 257 | struct list_head ctx_list; |
258 | spinlock_t ctx_lock; | 258 | spinlock_t ctx_lock; |
259 | 259 | ||
260 | struct list_head pgdir_list; | ||
261 | struct mutex pgdir_mutex; | ||
262 | |||
260 | struct mlx4_fw fw; | 263 | struct mlx4_fw fw; |
261 | struct mlx4_cmd cmd; | 264 | struct mlx4_cmd cmd; |
262 | 265 | ||
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c index 79b317b88c86..cb46446b2691 100644 --- a/drivers/net/mlx4/mr.c +++ b/drivers/net/mlx4/mr.c | |||
@@ -607,15 +607,9 @@ EXPORT_SYMBOL_GPL(mlx4_fmr_enable); | |||
607 | void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr, | 607 | void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr, |
608 | u32 *lkey, u32 *rkey) | 608 | u32 *lkey, u32 *rkey) |
609 | { | 609 | { |
610 | u32 key; | ||
611 | |||
612 | if (!fmr->maps) | 610 | if (!fmr->maps) |
613 | return; | 611 | return; |
614 | 612 | ||
615 | key = key_to_hw_index(fmr->mr.key); | ||
616 | key &= dev->caps.num_mpts - 1; | ||
617 | *lkey = *rkey = fmr->mr.key = hw_index_to_key(key); | ||
618 | |||
619 | fmr->maps = 0; | 613 | fmr->maps = 0; |
620 | 614 | ||
621 | *(u8 *) fmr->mpt = MLX4_MPT_STATUS_SW; | 615 | *(u8 *) fmr->mpt = MLX4_MPT_STATUS_SW; |
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c index fa24e6597591..ee5484c44a18 100644 --- a/drivers/net/mlx4/qp.c +++ b/drivers/net/mlx4/qp.c | |||
@@ -299,3 +299,34 @@ int mlx4_qp_query(struct mlx4_dev *dev, struct mlx4_qp *qp, | |||
299 | } | 299 | } |
300 | EXPORT_SYMBOL_GPL(mlx4_qp_query); | 300 | EXPORT_SYMBOL_GPL(mlx4_qp_query); |
301 | 301 | ||
302 | int mlx4_qp_to_ready(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | ||
303 | struct mlx4_qp_context *context, | ||
304 | struct mlx4_qp *qp, enum mlx4_qp_state *qp_state) | ||
305 | { | ||
306 | int err; | ||
307 | int i; | ||
308 | enum mlx4_qp_state states[] = { | ||
309 | MLX4_QP_STATE_RST, | ||
310 | MLX4_QP_STATE_INIT, | ||
311 | MLX4_QP_STATE_RTR, | ||
312 | MLX4_QP_STATE_RTS | ||
313 | }; | ||
314 | |||
315 | for (i = 0; i < ARRAY_SIZE(states) - 1; i++) { | ||
316 | context->flags &= cpu_to_be32(~(0xf << 28)); | ||
317 | context->flags |= cpu_to_be32(states[i + 1] << 28); | ||
318 | err = mlx4_qp_modify(dev, mtt, states[i], states[i + 1], | ||
319 | context, 0, 0, qp); | ||
320 | if (err) { | ||
321 | mlx4_err(dev, "Failed to bring QP to state: " | ||
322 | "%d with error: %d\n", | ||
323 | states[i + 1], err); | ||
324 | return err; | ||
325 | } | ||
326 | |||
327 | *qp_state = states[i + 1]; | ||
328 | } | ||
329 | |||
330 | return 0; | ||
331 | } | ||
332 | EXPORT_SYMBOL_GPL(mlx4_qp_to_ready); | ||
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index cead81e80f0c..ef63c8d2bd7e 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -2437,7 +2437,7 @@ static int myri10ge_sw_tso(struct sk_buff *skb, struct net_device *dev) | |||
2437 | int status; | 2437 | int status; |
2438 | 2438 | ||
2439 | segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6); | 2439 | segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6); |
2440 | if (unlikely(IS_ERR(segs))) | 2440 | if (IS_ERR(segs)) |
2441 | goto drop; | 2441 | goto drop; |
2442 | 2442 | ||
2443 | while (segs) { | 2443 | while (segs) { |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 160f605e58db..24d027e29c45 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
35 | #include <linux/version.h> | 35 | #include <linux/version.h> |
36 | 36 | ||
37 | #include <asm/semaphore.h> | ||
38 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
39 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
40 | #include <linux/init.h> | 39 | #include <linux/init.h> |
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index bcd7f9814ed8..3b2a6c598088 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -55,15 +55,10 @@ | |||
55 | * - Multiqueue RX/TX | 55 | * - Multiqueue RX/TX |
56 | */ | 56 | */ |
57 | 57 | ||
58 | |||
59 | /* Must be a power of two */ | ||
60 | #define RX_RING_SIZE 2048 | ||
61 | #define TX_RING_SIZE 4096 | ||
62 | |||
63 | #define LRO_MAX_AGGR 64 | 58 | #define LRO_MAX_AGGR 64 |
64 | 59 | ||
65 | #define PE_MIN_MTU 64 | 60 | #define PE_MIN_MTU 64 |
66 | #define PE_MAX_MTU 1500 | 61 | #define PE_MAX_MTU 9000 |
67 | #define PE_DEF_MTU ETH_DATA_LEN | 62 | #define PE_DEF_MTU ETH_DATA_LEN |
68 | 63 | ||
69 | #define DEFAULT_MSG_ENABLE \ | 64 | #define DEFAULT_MSG_ENABLE \ |
@@ -76,16 +71,6 @@ | |||
76 | NETIF_MSG_RX_ERR | \ | 71 | NETIF_MSG_RX_ERR | \ |
77 | NETIF_MSG_TX_ERR) | 72 | NETIF_MSG_TX_ERR) |
78 | 73 | ||
79 | #define TX_DESC(tx, num) ((tx)->chan.ring_virt[(num) & (TX_RING_SIZE-1)]) | ||
80 | #define TX_DESC_INFO(tx, num) ((tx)->ring_info[(num) & (TX_RING_SIZE-1)]) | ||
81 | #define RX_DESC(rx, num) ((rx)->chan.ring_virt[(num) & (RX_RING_SIZE-1)]) | ||
82 | #define RX_DESC_INFO(rx, num) ((rx)->ring_info[(num) & (RX_RING_SIZE-1)]) | ||
83 | #define RX_BUFF(rx, num) ((rx)->buffers[(num) & (RX_RING_SIZE-1)]) | ||
84 | |||
85 | #define RING_USED(ring) (((ring)->next_to_fill - (ring)->next_to_clean) \ | ||
86 | & ((ring)->size - 1)) | ||
87 | #define RING_AVAIL(ring) ((ring->size) - RING_USED(ring)) | ||
88 | |||
89 | MODULE_LICENSE("GPL"); | 74 | MODULE_LICENSE("GPL"); |
90 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); | 75 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); |
91 | MODULE_DESCRIPTION("PA Semi PWRficient Ethernet driver"); | 76 | MODULE_DESCRIPTION("PA Semi PWRficient Ethernet driver"); |
@@ -94,6 +79,8 @@ static int debug = -1; /* -1 == use DEFAULT_MSG_ENABLE as value */ | |||
94 | module_param(debug, int, 0); | 79 | module_param(debug, int, 0); |
95 | MODULE_PARM_DESC(debug, "PA Semi MAC bitmapped debugging message enable value"); | 80 | MODULE_PARM_DESC(debug, "PA Semi MAC bitmapped debugging message enable value"); |
96 | 81 | ||
82 | extern const struct ethtool_ops pasemi_mac_ethtool_ops; | ||
83 | |||
97 | static int translation_enabled(void) | 84 | static int translation_enabled(void) |
98 | { | 85 | { |
99 | #if defined(CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE) | 86 | #if defined(CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE) |
@@ -322,6 +309,104 @@ static int pasemi_mac_unmap_tx_skb(struct pasemi_mac *mac, | |||
322 | return (nfrags + 3) & ~1; | 309 | return (nfrags + 3) & ~1; |
323 | } | 310 | } |
324 | 311 | ||
312 | static struct pasemi_mac_csring *pasemi_mac_setup_csring(struct pasemi_mac *mac) | ||
313 | { | ||
314 | struct pasemi_mac_csring *ring; | ||
315 | u32 val; | ||
316 | unsigned int cfg; | ||
317 | int chno; | ||
318 | |||
319 | ring = pasemi_dma_alloc_chan(TXCHAN, sizeof(struct pasemi_mac_csring), | ||
320 | offsetof(struct pasemi_mac_csring, chan)); | ||
321 | |||
322 | if (!ring) { | ||
323 | dev_err(&mac->pdev->dev, "Can't allocate checksum channel\n"); | ||
324 | goto out_chan; | ||
325 | } | ||
326 | |||
327 | chno = ring->chan.chno; | ||
328 | |||
329 | ring->size = CS_RING_SIZE; | ||
330 | ring->next_to_fill = 0; | ||
331 | |||
332 | /* Allocate descriptors */ | ||
333 | if (pasemi_dma_alloc_ring(&ring->chan, CS_RING_SIZE)) | ||
334 | goto out_ring_desc; | ||
335 | |||
336 | write_dma_reg(PAS_DMA_TXCHAN_BASEL(chno), | ||
337 | PAS_DMA_TXCHAN_BASEL_BRBL(ring->chan.ring_dma)); | ||
338 | val = PAS_DMA_TXCHAN_BASEU_BRBH(ring->chan.ring_dma >> 32); | ||
339 | val |= PAS_DMA_TXCHAN_BASEU_SIZ(CS_RING_SIZE >> 3); | ||
340 | |||
341 | write_dma_reg(PAS_DMA_TXCHAN_BASEU(chno), val); | ||
342 | |||
343 | ring->events[0] = pasemi_dma_alloc_flag(); | ||
344 | ring->events[1] = pasemi_dma_alloc_flag(); | ||
345 | if (ring->events[0] < 0 || ring->events[1] < 0) | ||
346 | goto out_flags; | ||
347 | |||
348 | pasemi_dma_clear_flag(ring->events[0]); | ||
349 | pasemi_dma_clear_flag(ring->events[1]); | ||
350 | |||
351 | ring->fun = pasemi_dma_alloc_fun(); | ||
352 | if (ring->fun < 0) | ||
353 | goto out_fun; | ||
354 | |||
355 | cfg = PAS_DMA_TXCHAN_CFG_TY_FUNC | PAS_DMA_TXCHAN_CFG_UP | | ||
356 | PAS_DMA_TXCHAN_CFG_TATTR(ring->fun) | | ||
357 | PAS_DMA_TXCHAN_CFG_LPSQ | PAS_DMA_TXCHAN_CFG_LPDQ; | ||
358 | |||
359 | if (translation_enabled()) | ||
360 | cfg |= PAS_DMA_TXCHAN_CFG_TRD | PAS_DMA_TXCHAN_CFG_TRR; | ||
361 | |||
362 | write_dma_reg(PAS_DMA_TXCHAN_CFG(chno), cfg); | ||
363 | |||
364 | /* enable channel */ | ||
365 | pasemi_dma_start_chan(&ring->chan, PAS_DMA_TXCHAN_TCMDSTA_SZ | | ||
366 | PAS_DMA_TXCHAN_TCMDSTA_DB | | ||
367 | PAS_DMA_TXCHAN_TCMDSTA_DE | | ||
368 | PAS_DMA_TXCHAN_TCMDSTA_DA); | ||
369 | |||
370 | return ring; | ||
371 | |||
372 | out_fun: | ||
373 | out_flags: | ||
374 | if (ring->events[0] >= 0) | ||
375 | pasemi_dma_free_flag(ring->events[0]); | ||
376 | if (ring->events[1] >= 0) | ||
377 | pasemi_dma_free_flag(ring->events[1]); | ||
378 | pasemi_dma_free_ring(&ring->chan); | ||
379 | out_ring_desc: | ||
380 | pasemi_dma_free_chan(&ring->chan); | ||
381 | out_chan: | ||
382 | |||
383 | return NULL; | ||
384 | } | ||
385 | |||
386 | static void pasemi_mac_setup_csrings(struct pasemi_mac *mac) | ||
387 | { | ||
388 | int i; | ||
389 | mac->cs[0] = pasemi_mac_setup_csring(mac); | ||
390 | if (mac->type == MAC_TYPE_XAUI) | ||
391 | mac->cs[1] = pasemi_mac_setup_csring(mac); | ||
392 | else | ||
393 | mac->cs[1] = 0; | ||
394 | |||
395 | for (i = 0; i < MAX_CS; i++) | ||
396 | if (mac->cs[i]) | ||
397 | mac->num_cs++; | ||
398 | } | ||
399 | |||
400 | static void pasemi_mac_free_csring(struct pasemi_mac_csring *csring) | ||
401 | { | ||
402 | pasemi_dma_stop_chan(&csring->chan); | ||
403 | pasemi_dma_free_flag(csring->events[0]); | ||
404 | pasemi_dma_free_flag(csring->events[1]); | ||
405 | pasemi_dma_free_ring(&csring->chan); | ||
406 | pasemi_dma_free_chan(&csring->chan); | ||
407 | pasemi_dma_free_fun(csring->fun); | ||
408 | } | ||
409 | |||
325 | static int pasemi_mac_setup_rx_resources(const struct net_device *dev) | 410 | static int pasemi_mac_setup_rx_resources(const struct net_device *dev) |
326 | { | 411 | { |
327 | struct pasemi_mac_rxring *ring; | 412 | struct pasemi_mac_rxring *ring; |
@@ -445,7 +530,7 @@ pasemi_mac_setup_tx_resources(const struct net_device *dev) | |||
445 | cfg = PAS_DMA_TXCHAN_CFG_TY_IFACE | | 530 | cfg = PAS_DMA_TXCHAN_CFG_TY_IFACE | |
446 | PAS_DMA_TXCHAN_CFG_TATTR(mac->dma_if) | | 531 | PAS_DMA_TXCHAN_CFG_TATTR(mac->dma_if) | |
447 | PAS_DMA_TXCHAN_CFG_UP | | 532 | PAS_DMA_TXCHAN_CFG_UP | |
448 | PAS_DMA_TXCHAN_CFG_WT(2); | 533 | PAS_DMA_TXCHAN_CFG_WT(4); |
449 | 534 | ||
450 | if (translation_enabled()) | 535 | if (translation_enabled()) |
451 | cfg |= PAS_DMA_TXCHAN_CFG_TRD | PAS_DMA_TXCHAN_CFG_TRR; | 536 | cfg |= PAS_DMA_TXCHAN_CFG_TRD | PAS_DMA_TXCHAN_CFG_TRR; |
@@ -810,13 +895,21 @@ restart: | |||
810 | u64 mactx = TX_DESC(txring, i); | 895 | u64 mactx = TX_DESC(txring, i); |
811 | struct sk_buff *skb; | 896 | struct sk_buff *skb; |
812 | 897 | ||
813 | skb = TX_DESC_INFO(txring, i+1).skb; | ||
814 | nr_frags = TX_DESC_INFO(txring, i).dma; | ||
815 | |||
816 | if ((mactx & XCT_MACTX_E) || | 898 | if ((mactx & XCT_MACTX_E) || |
817 | (*chan->status & PAS_STATUS_ERROR)) | 899 | (*chan->status & PAS_STATUS_ERROR)) |
818 | pasemi_mac_tx_error(mac, mactx); | 900 | pasemi_mac_tx_error(mac, mactx); |
819 | 901 | ||
902 | /* Skip over control descriptors */ | ||
903 | if (!(mactx & XCT_MACTX_LLEN_M)) { | ||
904 | TX_DESC(txring, i) = 0; | ||
905 | TX_DESC(txring, i+1) = 0; | ||
906 | buf_count = 2; | ||
907 | continue; | ||
908 | } | ||
909 | |||
910 | skb = TX_DESC_INFO(txring, i+1).skb; | ||
911 | nr_frags = TX_DESC_INFO(txring, i).dma; | ||
912 | |||
820 | if (unlikely(mactx & XCT_MACTX_O)) | 913 | if (unlikely(mactx & XCT_MACTX_O)) |
821 | /* Not yet transmitted */ | 914 | /* Not yet transmitted */ |
822 | break; | 915 | break; |
@@ -1041,13 +1134,7 @@ static int pasemi_mac_open(struct net_device *dev) | |||
1041 | { | 1134 | { |
1042 | struct pasemi_mac *mac = netdev_priv(dev); | 1135 | struct pasemi_mac *mac = netdev_priv(dev); |
1043 | unsigned int flags; | 1136 | unsigned int flags; |
1044 | int ret; | 1137 | int i, ret; |
1045 | |||
1046 | /* enable rx section */ | ||
1047 | write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN); | ||
1048 | |||
1049 | /* enable tx section */ | ||
1050 | write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN); | ||
1051 | 1138 | ||
1052 | flags = PAS_MAC_CFG_TXP_FCE | PAS_MAC_CFG_TXP_FPC(3) | | 1139 | flags = PAS_MAC_CFG_TXP_FCE | PAS_MAC_CFG_TXP_FPC(3) | |
1053 | PAS_MAC_CFG_TXP_SL(3) | PAS_MAC_CFG_TXP_COB(0xf) | | 1140 | PAS_MAC_CFG_TXP_SL(3) | PAS_MAC_CFG_TXP_COB(0xf) | |
@@ -1064,6 +1151,19 @@ static int pasemi_mac_open(struct net_device *dev) | |||
1064 | if (!mac->tx) | 1151 | if (!mac->tx) |
1065 | goto out_tx_ring; | 1152 | goto out_tx_ring; |
1066 | 1153 | ||
1154 | /* We might already have allocated rings in case mtu was changed | ||
1155 | * before interface was brought up. | ||
1156 | */ | ||
1157 | if (dev->mtu > 1500 && !mac->num_cs) { | ||
1158 | pasemi_mac_setup_csrings(mac); | ||
1159 | if (!mac->num_cs) | ||
1160 | goto out_tx_ring; | ||
1161 | } | ||
1162 | |||
1163 | /* Zero out rmon counters */ | ||
1164 | for (i = 0; i < 32; i++) | ||
1165 | write_mac_reg(mac, PAS_MAC_RMON(i), 0); | ||
1166 | |||
1067 | /* 0x3ff with 33MHz clock is about 31us */ | 1167 | /* 0x3ff with 33MHz clock is about 31us */ |
1068 | write_iob_reg(PAS_IOB_DMA_COM_TIMEOUTCFG, | 1168 | write_iob_reg(PAS_IOB_DMA_COM_TIMEOUTCFG, |
1069 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0x3ff)); | 1169 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0x3ff)); |
@@ -1247,7 +1347,7 @@ static int pasemi_mac_close(struct net_device *dev) | |||
1247 | { | 1347 | { |
1248 | struct pasemi_mac *mac = netdev_priv(dev); | 1348 | struct pasemi_mac *mac = netdev_priv(dev); |
1249 | unsigned int sta; | 1349 | unsigned int sta; |
1250 | int rxch, txch; | 1350 | int rxch, txch, i; |
1251 | 1351 | ||
1252 | rxch = rx_ring(mac)->chan.chno; | 1352 | rxch = rx_ring(mac)->chan.chno; |
1253 | txch = tx_ring(mac)->chan.chno; | 1353 | txch = tx_ring(mac)->chan.chno; |
@@ -1292,6 +1392,13 @@ static int pasemi_mac_close(struct net_device *dev) | |||
1292 | free_irq(mac->tx->chan.irq, mac->tx); | 1392 | free_irq(mac->tx->chan.irq, mac->tx); |
1293 | free_irq(mac->rx->chan.irq, mac->rx); | 1393 | free_irq(mac->rx->chan.irq, mac->rx); |
1294 | 1394 | ||
1395 | for (i = 0; i < mac->num_cs; i++) { | ||
1396 | pasemi_mac_free_csring(mac->cs[i]); | ||
1397 | mac->cs[i] = NULL; | ||
1398 | } | ||
1399 | |||
1400 | mac->num_cs = 0; | ||
1401 | |||
1295 | /* Free resources */ | 1402 | /* Free resources */ |
1296 | pasemi_mac_free_rx_resources(mac); | 1403 | pasemi_mac_free_rx_resources(mac); |
1297 | pasemi_mac_free_tx_resources(mac); | 1404 | pasemi_mac_free_tx_resources(mac); |
@@ -1299,35 +1406,113 @@ static int pasemi_mac_close(struct net_device *dev) | |||
1299 | return 0; | 1406 | return 0; |
1300 | } | 1407 | } |
1301 | 1408 | ||
1409 | static void pasemi_mac_queue_csdesc(const struct sk_buff *skb, | ||
1410 | const dma_addr_t *map, | ||
1411 | const unsigned int *map_size, | ||
1412 | struct pasemi_mac_txring *txring, | ||
1413 | struct pasemi_mac_csring *csring) | ||
1414 | { | ||
1415 | u64 fund; | ||
1416 | dma_addr_t cs_dest; | ||
1417 | const int nh_off = skb_network_offset(skb); | ||
1418 | const int nh_len = skb_network_header_len(skb); | ||
1419 | const int nfrags = skb_shinfo(skb)->nr_frags; | ||
1420 | int cs_size, i, fill, hdr, cpyhdr, evt; | ||
1421 | dma_addr_t csdma; | ||
1422 | |||
1423 | fund = XCT_FUN_ST | XCT_FUN_RR_8BRES | | ||
1424 | XCT_FUN_O | XCT_FUN_FUN(csring->fun) | | ||
1425 | XCT_FUN_CRM_SIG | XCT_FUN_LLEN(skb->len - nh_off) | | ||
1426 | XCT_FUN_SHL(nh_len >> 2) | XCT_FUN_SE; | ||
1427 | |||
1428 | switch (ip_hdr(skb)->protocol) { | ||
1429 | case IPPROTO_TCP: | ||
1430 | fund |= XCT_FUN_SIG_TCP4; | ||
1431 | /* TCP checksum is 16 bytes into the header */ | ||
1432 | cs_dest = map[0] + skb_transport_offset(skb) + 16; | ||
1433 | break; | ||
1434 | case IPPROTO_UDP: | ||
1435 | fund |= XCT_FUN_SIG_UDP4; | ||
1436 | /* UDP checksum is 6 bytes into the header */ | ||
1437 | cs_dest = map[0] + skb_transport_offset(skb) + 6; | ||
1438 | break; | ||
1439 | default: | ||
1440 | BUG(); | ||
1441 | } | ||
1442 | |||
1443 | /* Do the checksum offloaded */ | ||
1444 | fill = csring->next_to_fill; | ||
1445 | hdr = fill; | ||
1446 | |||
1447 | CS_DESC(csring, fill++) = fund; | ||
1448 | /* Room for 8BRES. Checksum result is really 2 bytes into it */ | ||
1449 | csdma = csring->chan.ring_dma + (fill & (CS_RING_SIZE-1)) * 8 + 2; | ||
1450 | CS_DESC(csring, fill++) = 0; | ||
1451 | |||
1452 | CS_DESC(csring, fill) = XCT_PTR_LEN(map_size[0]-nh_off) | XCT_PTR_ADDR(map[0]+nh_off); | ||
1453 | for (i = 1; i <= nfrags; i++) | ||
1454 | CS_DESC(csring, fill+i) = XCT_PTR_LEN(map_size[i]) | XCT_PTR_ADDR(map[i]); | ||
1455 | |||
1456 | fill += i; | ||
1457 | if (fill & 1) | ||
1458 | fill++; | ||
1459 | |||
1460 | /* Copy the result into the TCP packet */ | ||
1461 | cpyhdr = fill; | ||
1462 | CS_DESC(csring, fill++) = XCT_FUN_O | XCT_FUN_FUN(csring->fun) | | ||
1463 | XCT_FUN_LLEN(2) | XCT_FUN_SE; | ||
1464 | CS_DESC(csring, fill++) = XCT_PTR_LEN(2) | XCT_PTR_ADDR(cs_dest) | XCT_PTR_T; | ||
1465 | CS_DESC(csring, fill++) = XCT_PTR_LEN(2) | XCT_PTR_ADDR(csdma); | ||
1466 | fill++; | ||
1467 | |||
1468 | evt = !csring->last_event; | ||
1469 | csring->last_event = evt; | ||
1470 | |||
1471 | /* Event handshaking with MAC TX */ | ||
1472 | CS_DESC(csring, fill++) = CTRL_CMD_T | CTRL_CMD_META_EVT | CTRL_CMD_O | | ||
1473 | CTRL_CMD_ETYPE_SET | CTRL_CMD_REG(csring->events[evt]); | ||
1474 | CS_DESC(csring, fill++) = 0; | ||
1475 | CS_DESC(csring, fill++) = CTRL_CMD_T | CTRL_CMD_META_EVT | CTRL_CMD_O | | ||
1476 | CTRL_CMD_ETYPE_WCLR | CTRL_CMD_REG(csring->events[!evt]); | ||
1477 | CS_DESC(csring, fill++) = 0; | ||
1478 | csring->next_to_fill = fill & (CS_RING_SIZE-1); | ||
1479 | |||
1480 | cs_size = fill - hdr; | ||
1481 | write_dma_reg(PAS_DMA_TXCHAN_INCR(csring->chan.chno), (cs_size) >> 1); | ||
1482 | |||
1483 | /* TX-side event handshaking */ | ||
1484 | fill = txring->next_to_fill; | ||
1485 | TX_DESC(txring, fill++) = CTRL_CMD_T | CTRL_CMD_META_EVT | CTRL_CMD_O | | ||
1486 | CTRL_CMD_ETYPE_WSET | CTRL_CMD_REG(csring->events[evt]); | ||
1487 | TX_DESC(txring, fill++) = 0; | ||
1488 | TX_DESC(txring, fill++) = CTRL_CMD_T | CTRL_CMD_META_EVT | CTRL_CMD_O | | ||
1489 | CTRL_CMD_ETYPE_CLR | CTRL_CMD_REG(csring->events[!evt]); | ||
1490 | TX_DESC(txring, fill++) = 0; | ||
1491 | txring->next_to_fill = fill; | ||
1492 | |||
1493 | write_dma_reg(PAS_DMA_TXCHAN_INCR(txring->chan.chno), 2); | ||
1494 | |||
1495 | return; | ||
1496 | } | ||
1497 | |||
1302 | static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev) | 1498 | static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev) |
1303 | { | 1499 | { |
1304 | struct pasemi_mac *mac = netdev_priv(dev); | 1500 | struct pasemi_mac * const mac = netdev_priv(dev); |
1305 | struct pasemi_mac_txring *txring; | 1501 | struct pasemi_mac_txring * const txring = tx_ring(mac); |
1306 | u64 dflags, mactx; | 1502 | struct pasemi_mac_csring *csring; |
1503 | u64 dflags = 0; | ||
1504 | u64 mactx; | ||
1307 | dma_addr_t map[MAX_SKB_FRAGS+1]; | 1505 | dma_addr_t map[MAX_SKB_FRAGS+1]; |
1308 | unsigned int map_size[MAX_SKB_FRAGS+1]; | 1506 | unsigned int map_size[MAX_SKB_FRAGS+1]; |
1309 | unsigned long flags; | 1507 | unsigned long flags; |
1310 | int i, nfrags; | 1508 | int i, nfrags; |
1311 | int fill; | 1509 | int fill; |
1510 | const int nh_off = skb_network_offset(skb); | ||
1511 | const int nh_len = skb_network_header_len(skb); | ||
1312 | 1512 | ||
1313 | dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_CRC_PAD; | 1513 | prefetch(&txring->ring_info); |
1314 | |||
1315 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | ||
1316 | const unsigned char *nh = skb_network_header(skb); | ||
1317 | 1514 | ||
1318 | switch (ip_hdr(skb)->protocol) { | 1515 | dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_CRC_PAD; |
1319 | case IPPROTO_TCP: | ||
1320 | dflags |= XCT_MACTX_CSUM_TCP; | ||
1321 | dflags |= XCT_MACTX_IPH(skb_network_header_len(skb) >> 2); | ||
1322 | dflags |= XCT_MACTX_IPO(nh - skb->data); | ||
1323 | break; | ||
1324 | case IPPROTO_UDP: | ||
1325 | dflags |= XCT_MACTX_CSUM_UDP; | ||
1326 | dflags |= XCT_MACTX_IPH(skb_network_header_len(skb) >> 2); | ||
1327 | dflags |= XCT_MACTX_IPO(nh - skb->data); | ||
1328 | break; | ||
1329 | } | ||
1330 | } | ||
1331 | 1516 | ||
1332 | nfrags = skb_shinfo(skb)->nr_frags; | 1517 | nfrags = skb_shinfo(skb)->nr_frags; |
1333 | 1518 | ||
@@ -1350,24 +1535,46 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1350 | } | 1535 | } |
1351 | } | 1536 | } |
1352 | 1537 | ||
1353 | mactx = dflags | XCT_MACTX_LLEN(skb->len); | 1538 | if (skb->ip_summed == CHECKSUM_PARTIAL && skb->len <= 1540) { |
1539 | switch (ip_hdr(skb)->protocol) { | ||
1540 | case IPPROTO_TCP: | ||
1541 | dflags |= XCT_MACTX_CSUM_TCP; | ||
1542 | dflags |= XCT_MACTX_IPH(nh_len >> 2); | ||
1543 | dflags |= XCT_MACTX_IPO(nh_off); | ||
1544 | break; | ||
1545 | case IPPROTO_UDP: | ||
1546 | dflags |= XCT_MACTX_CSUM_UDP; | ||
1547 | dflags |= XCT_MACTX_IPH(nh_len >> 2); | ||
1548 | dflags |= XCT_MACTX_IPO(nh_off); | ||
1549 | break; | ||
1550 | default: | ||
1551 | WARN_ON(1); | ||
1552 | } | ||
1553 | } | ||
1354 | 1554 | ||
1355 | txring = tx_ring(mac); | 1555 | mactx = dflags | XCT_MACTX_LLEN(skb->len); |
1356 | 1556 | ||
1357 | spin_lock_irqsave(&txring->lock, flags); | 1557 | spin_lock_irqsave(&txring->lock, flags); |
1358 | 1558 | ||
1359 | fill = txring->next_to_fill; | ||
1360 | |||
1361 | /* Avoid stepping on the same cache line that the DMA controller | 1559 | /* Avoid stepping on the same cache line that the DMA controller |
1362 | * is currently about to send, so leave at least 8 words available. | 1560 | * is currently about to send, so leave at least 8 words available. |
1363 | * Total free space needed is mactx + fragments + 8 | 1561 | * Total free space needed is mactx + fragments + 8 |
1364 | */ | 1562 | */ |
1365 | if (RING_AVAIL(txring) < nfrags + 10) { | 1563 | if (RING_AVAIL(txring) < nfrags + 14) { |
1366 | /* no room -- stop the queue and wait for tx intr */ | 1564 | /* no room -- stop the queue and wait for tx intr */ |
1367 | netif_stop_queue(dev); | 1565 | netif_stop_queue(dev); |
1368 | goto out_err; | 1566 | goto out_err; |
1369 | } | 1567 | } |
1370 | 1568 | ||
1569 | /* Queue up checksum + event descriptors, if needed */ | ||
1570 | if (mac->num_cs && skb->ip_summed == CHECKSUM_PARTIAL && skb->len > 1540) { | ||
1571 | csring = mac->cs[mac->last_cs]; | ||
1572 | mac->last_cs = (mac->last_cs + 1) % mac->num_cs; | ||
1573 | |||
1574 | pasemi_mac_queue_csdesc(skb, map, map_size, txring, csring); | ||
1575 | } | ||
1576 | |||
1577 | fill = txring->next_to_fill; | ||
1371 | TX_DESC(txring, fill) = mactx; | 1578 | TX_DESC(txring, fill) = mactx; |
1372 | TX_DESC_INFO(txring, fill).dma = nfrags; | 1579 | TX_DESC_INFO(txring, fill).dma = nfrags; |
1373 | fill++; | 1580 | fill++; |
@@ -1441,12 +1648,33 @@ static int pasemi_mac_poll(struct napi_struct *napi, int budget) | |||
1441 | return pkts; | 1648 | return pkts; |
1442 | } | 1649 | } |
1443 | 1650 | ||
1651 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1652 | /* | ||
1653 | * Polling 'interrupt' - used by things like netconsole to send skbs | ||
1654 | * without having to re-enable interrupts. It's not called while | ||
1655 | * the interrupt routine is executing. | ||
1656 | */ | ||
1657 | static void pasemi_mac_netpoll(struct net_device *dev) | ||
1658 | { | ||
1659 | const struct pasemi_mac *mac = netdev_priv(dev); | ||
1660 | |||
1661 | disable_irq(mac->tx->chan.irq); | ||
1662 | pasemi_mac_tx_intr(mac->tx->chan.irq, mac->tx); | ||
1663 | enable_irq(mac->tx->chan.irq); | ||
1664 | |||
1665 | disable_irq(mac->rx->chan.irq); | ||
1666 | pasemi_mac_rx_intr(mac->rx->chan.irq, mac->rx); | ||
1667 | enable_irq(mac->rx->chan.irq); | ||
1668 | } | ||
1669 | #endif | ||
1670 | |||
1444 | static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu) | 1671 | static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu) |
1445 | { | 1672 | { |
1446 | struct pasemi_mac *mac = netdev_priv(dev); | 1673 | struct pasemi_mac *mac = netdev_priv(dev); |
1447 | unsigned int reg; | 1674 | unsigned int reg; |
1448 | unsigned int rcmdsta; | 1675 | unsigned int rcmdsta = 0; |
1449 | int running; | 1676 | int running; |
1677 | int ret = 0; | ||
1450 | 1678 | ||
1451 | if (new_mtu < PE_MIN_MTU || new_mtu > PE_MAX_MTU) | 1679 | if (new_mtu < PE_MIN_MTU || new_mtu > PE_MAX_MTU) |
1452 | return -EINVAL; | 1680 | return -EINVAL; |
@@ -1468,6 +1696,16 @@ static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu) | |||
1468 | pasemi_mac_pause_rxint(mac); | 1696 | pasemi_mac_pause_rxint(mac); |
1469 | pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); | 1697 | pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); |
1470 | pasemi_mac_free_rx_buffers(mac); | 1698 | pasemi_mac_free_rx_buffers(mac); |
1699 | |||
1700 | } | ||
1701 | |||
1702 | /* Setup checksum channels if large MTU and none already allocated */ | ||
1703 | if (new_mtu > 1500 && !mac->num_cs) { | ||
1704 | pasemi_mac_setup_csrings(mac); | ||
1705 | if (!mac->num_cs) { | ||
1706 | ret = -ENOMEM; | ||
1707 | goto out; | ||
1708 | } | ||
1471 | } | 1709 | } |
1472 | 1710 | ||
1473 | /* Change maxf, i.e. what size frames are accepted. | 1711 | /* Change maxf, i.e. what size frames are accepted. |
@@ -1482,6 +1720,7 @@ static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu) | |||
1482 | /* MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */ | 1720 | /* MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */ |
1483 | mac->bufsz = new_mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; | 1721 | mac->bufsz = new_mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; |
1484 | 1722 | ||
1723 | out: | ||
1485 | if (running) { | 1724 | if (running) { |
1486 | write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), | 1725 | write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), |
1487 | rcmdsta | PAS_DMA_RXINT_RCMDSTA_EN); | 1726 | rcmdsta | PAS_DMA_RXINT_RCMDSTA_EN); |
@@ -1494,7 +1733,7 @@ static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu) | |||
1494 | pasemi_mac_intf_enable(mac); | 1733 | pasemi_mac_intf_enable(mac); |
1495 | } | 1734 | } |
1496 | 1735 | ||
1497 | return 0; | 1736 | return ret; |
1498 | } | 1737 | } |
1499 | 1738 | ||
1500 | static int __devinit | 1739 | static int __devinit |
@@ -1528,7 +1767,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1528 | netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64); | 1767 | netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64); |
1529 | 1768 | ||
1530 | dev->features = NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG | | 1769 | dev->features = NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG | |
1531 | NETIF_F_HIGHDMA; | 1770 | NETIF_F_HIGHDMA | NETIF_F_GSO; |
1532 | 1771 | ||
1533 | mac->lro_mgr.max_aggr = LRO_MAX_AGGR; | 1772 | mac->lro_mgr.max_aggr = LRO_MAX_AGGR; |
1534 | mac->lro_mgr.max_desc = MAX_LRO_DESCRIPTORS; | 1773 | mac->lro_mgr.max_desc = MAX_LRO_DESCRIPTORS; |
@@ -1588,8 +1827,12 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1588 | dev->mtu = PE_DEF_MTU; | 1827 | dev->mtu = PE_DEF_MTU; |
1589 | /* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */ | 1828 | /* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */ |
1590 | mac->bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; | 1829 | mac->bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; |
1830 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1831 | dev->poll_controller = pasemi_mac_netpoll; | ||
1832 | #endif | ||
1591 | 1833 | ||
1592 | dev->change_mtu = pasemi_mac_change_mtu; | 1834 | dev->change_mtu = pasemi_mac_change_mtu; |
1835 | dev->ethtool_ops = &pasemi_mac_ethtool_ops; | ||
1593 | 1836 | ||
1594 | if (err) | 1837 | if (err) |
1595 | goto out; | 1838 | goto out; |
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h index 99e7b9329a6f..1a115ec60b53 100644 --- a/drivers/net/pasemi_mac.h +++ b/drivers/net/pasemi_mac.h | |||
@@ -26,7 +26,14 @@ | |||
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/phy.h> | 27 | #include <linux/phy.h> |
28 | 28 | ||
29 | /* Must be a power of two */ | ||
30 | #define RX_RING_SIZE 2048 | ||
31 | #define TX_RING_SIZE 4096 | ||
32 | #define CS_RING_SIZE (TX_RING_SIZE*2) | ||
33 | |||
34 | |||
29 | #define MAX_LRO_DESCRIPTORS 8 | 35 | #define MAX_LRO_DESCRIPTORS 8 |
36 | #define MAX_CS 2 | ||
30 | 37 | ||
31 | struct pasemi_mac_txring { | 38 | struct pasemi_mac_txring { |
32 | struct pasemi_dmachan chan; /* Must be first */ | 39 | struct pasemi_dmachan chan; /* Must be first */ |
@@ -51,6 +58,15 @@ struct pasemi_mac_rxring { | |||
51 | struct pasemi_mac *mac; /* Needed in intr handler */ | 58 | struct pasemi_mac *mac; /* Needed in intr handler */ |
52 | }; | 59 | }; |
53 | 60 | ||
61 | struct pasemi_mac_csring { | ||
62 | struct pasemi_dmachan chan; | ||
63 | unsigned int size; | ||
64 | unsigned int next_to_fill; | ||
65 | int events[2]; | ||
66 | int last_event; | ||
67 | int fun; | ||
68 | }; | ||
69 | |||
54 | struct pasemi_mac { | 70 | struct pasemi_mac { |
55 | struct net_device *netdev; | 71 | struct net_device *netdev; |
56 | struct pci_dev *pdev; | 72 | struct pci_dev *pdev; |
@@ -60,10 +76,12 @@ struct pasemi_mac { | |||
60 | struct napi_struct napi; | 76 | struct napi_struct napi; |
61 | 77 | ||
62 | int bufsz; /* RX ring buffer size */ | 78 | int bufsz; /* RX ring buffer size */ |
79 | int last_cs; | ||
80 | int num_cs; | ||
81 | u32 dma_if; | ||
63 | u8 type; | 82 | u8 type; |
64 | #define MAC_TYPE_GMAC 1 | 83 | #define MAC_TYPE_GMAC 1 |
65 | #define MAC_TYPE_XAUI 2 | 84 | #define MAC_TYPE_XAUI 2 |
66 | u32 dma_if; | ||
67 | 85 | ||
68 | u8 mac_addr[6]; | 86 | u8 mac_addr[6]; |
69 | 87 | ||
@@ -74,6 +92,7 @@ struct pasemi_mac { | |||
74 | 92 | ||
75 | struct pasemi_mac_txring *tx; | 93 | struct pasemi_mac_txring *tx; |
76 | struct pasemi_mac_rxring *rx; | 94 | struct pasemi_mac_rxring *rx; |
95 | struct pasemi_mac_csring *cs[MAX_CS]; | ||
77 | char tx_irq_name[10]; /* "eth%d tx" */ | 96 | char tx_irq_name[10]; /* "eth%d tx" */ |
78 | char rx_irq_name[10]; /* "eth%d rx" */ | 97 | char rx_irq_name[10]; /* "eth%d rx" */ |
79 | int link; | 98 | int link; |
@@ -90,6 +109,16 @@ struct pasemi_mac_buffer { | |||
90 | dma_addr_t dma; | 109 | dma_addr_t dma; |
91 | }; | 110 | }; |
92 | 111 | ||
112 | #define TX_DESC(tx, num) ((tx)->chan.ring_virt[(num) & (TX_RING_SIZE-1)]) | ||
113 | #define TX_DESC_INFO(tx, num) ((tx)->ring_info[(num) & (TX_RING_SIZE-1)]) | ||
114 | #define RX_DESC(rx, num) ((rx)->chan.ring_virt[(num) & (RX_RING_SIZE-1)]) | ||
115 | #define RX_DESC_INFO(rx, num) ((rx)->ring_info[(num) & (RX_RING_SIZE-1)]) | ||
116 | #define RX_BUFF(rx, num) ((rx)->buffers[(num) & (RX_RING_SIZE-1)]) | ||
117 | #define CS_DESC(cs, num) ((cs)->chan.ring_virt[(num) & (CS_RING_SIZE-1)]) | ||
118 | |||
119 | #define RING_USED(ring) (((ring)->next_to_fill - (ring)->next_to_clean) \ | ||
120 | & ((ring)->size - 1)) | ||
121 | #define RING_AVAIL(ring) ((ring->size) - RING_USED(ring)) | ||
93 | 122 | ||
94 | /* PCI register offsets and formats */ | 123 | /* PCI register offsets and formats */ |
95 | 124 | ||
@@ -101,6 +130,7 @@ enum { | |||
101 | PAS_MAC_CFG_ADR0 = 0x8c, | 130 | PAS_MAC_CFG_ADR0 = 0x8c, |
102 | PAS_MAC_CFG_ADR1 = 0x90, | 131 | PAS_MAC_CFG_ADR1 = 0x90, |
103 | PAS_MAC_CFG_TXP = 0x98, | 132 | PAS_MAC_CFG_TXP = 0x98, |
133 | PAS_MAC_CFG_RMON = 0x100, | ||
104 | PAS_MAC_IPC_CHNL = 0x208, | 134 | PAS_MAC_IPC_CHNL = 0x208, |
105 | }; | 135 | }; |
106 | 136 | ||
@@ -172,6 +202,8 @@ enum { | |||
172 | #define PAS_MAC_CFG_TXP_TIFG(x) (((x) << PAS_MAC_CFG_TXP_TIFG_S) & \ | 202 | #define PAS_MAC_CFG_TXP_TIFG(x) (((x) << PAS_MAC_CFG_TXP_TIFG_S) & \ |
173 | PAS_MAC_CFG_TXP_TIFG_M) | 203 | PAS_MAC_CFG_TXP_TIFG_M) |
174 | 204 | ||
205 | #define PAS_MAC_RMON(r) (0x100+(r)*4) | ||
206 | |||
175 | #define PAS_MAC_IPC_CHNL_DCHNO_M 0x003f0000 | 207 | #define PAS_MAC_IPC_CHNL_DCHNO_M 0x003f0000 |
176 | #define PAS_MAC_IPC_CHNL_DCHNO_S 16 | 208 | #define PAS_MAC_IPC_CHNL_DCHNO_S 16 |
177 | #define PAS_MAC_IPC_CHNL_DCHNO(x) (((x) << PAS_MAC_IPC_CHNL_DCHNO_S) & \ | 209 | #define PAS_MAC_IPC_CHNL_DCHNO(x) (((x) << PAS_MAC_IPC_CHNL_DCHNO_S) & \ |
@@ -181,4 +213,5 @@ enum { | |||
181 | #define PAS_MAC_IPC_CHNL_BCH(x) (((x) << PAS_MAC_IPC_CHNL_BCH_S) & \ | 213 | #define PAS_MAC_IPC_CHNL_BCH(x) (((x) << PAS_MAC_IPC_CHNL_BCH_S) & \ |
182 | PAS_MAC_IPC_CHNL_BCH_M) | 214 | PAS_MAC_IPC_CHNL_BCH_M) |
183 | 215 | ||
216 | |||
184 | #endif /* PASEMI_MAC_H */ | 217 | #endif /* PASEMI_MAC_H */ |
diff --git a/drivers/net/pasemi_mac_ethtool.c b/drivers/net/pasemi_mac_ethtool.c new file mode 100644 index 000000000000..5e8df3afea64 --- /dev/null +++ b/drivers/net/pasemi_mac_ethtool.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006-2008 PA Semi, Inc | ||
3 | * | ||
4 | * Ethtool hooks for the PA Semi PWRficient onchip 1G/10G Ethernet MACs | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | |||
21 | #include <linux/netdevice.h> | ||
22 | #include <linux/ethtool.h> | ||
23 | #include <linux/pci.h> | ||
24 | #include <linux/inet_lro.h> | ||
25 | |||
26 | #include <asm/pasemi_dma.h> | ||
27 | #include "pasemi_mac.h" | ||
28 | |||
29 | static struct { | ||
30 | const char str[ETH_GSTRING_LEN]; | ||
31 | } ethtool_stats_keys[] = { | ||
32 | { "rx-drops" }, | ||
33 | { "rx-bytes" }, | ||
34 | { "rx-packets" }, | ||
35 | { "rx-broadcast-packets" }, | ||
36 | { "rx-multicast-packets" }, | ||
37 | { "rx-crc-errors" }, | ||
38 | { "rx-undersize-errors" }, | ||
39 | { "rx-oversize-errors" }, | ||
40 | { "rx-short-fragment-errors" }, | ||
41 | { "rx-jabber-errors" }, | ||
42 | { "rx-64-byte-packets" }, | ||
43 | { "rx-65-127-byte-packets" }, | ||
44 | { "rx-128-255-byte-packets" }, | ||
45 | { "rx-256-511-byte-packets" }, | ||
46 | { "rx-512-1023-byte-packets" }, | ||
47 | { "rx-1024-1518-byte-packets" }, | ||
48 | { "rx-pause-frames" }, | ||
49 | { "tx-bytes" }, | ||
50 | { "tx-packets" }, | ||
51 | { "tx-broadcast-packets" }, | ||
52 | { "tx-multicast-packets" }, | ||
53 | { "tx-collisions" }, | ||
54 | { "tx-late-collisions" }, | ||
55 | { "tx-excessive-collisions" }, | ||
56 | { "tx-crc-errors" }, | ||
57 | { "tx-undersize-errors" }, | ||
58 | { "tx-oversize-errors" }, | ||
59 | { "tx-64-byte-packets" }, | ||
60 | { "tx-65-127-byte-packets" }, | ||
61 | { "tx-128-255-byte-packets" }, | ||
62 | { "tx-256-511-byte-packets" }, | ||
63 | { "tx-512-1023-byte-packets" }, | ||
64 | { "tx-1024-1518-byte-packets" }, | ||
65 | }; | ||
66 | |||
67 | static int | ||
68 | pasemi_mac_ethtool_get_settings(struct net_device *netdev, | ||
69 | struct ethtool_cmd *cmd) | ||
70 | { | ||
71 | struct pasemi_mac *mac = netdev_priv(netdev); | ||
72 | struct phy_device *phydev = mac->phydev; | ||
73 | |||
74 | return phy_ethtool_gset(phydev, cmd); | ||
75 | } | ||
76 | |||
77 | static void | ||
78 | pasemi_mac_ethtool_get_drvinfo(struct net_device *netdev, | ||
79 | struct ethtool_drvinfo *drvinfo) | ||
80 | { | ||
81 | struct pasemi_mac *mac; | ||
82 | mac = netdev_priv(netdev); | ||
83 | |||
84 | /* clear and fill out info */ | ||
85 | memset(drvinfo, 0, sizeof(struct ethtool_drvinfo)); | ||
86 | strncpy(drvinfo->driver, "pasemi_mac", 12); | ||
87 | strcpy(drvinfo->version, "N/A"); | ||
88 | strcpy(drvinfo->fw_version, "N/A"); | ||
89 | strncpy(drvinfo->bus_info, pci_name(mac->pdev), 32); | ||
90 | } | ||
91 | |||
92 | static u32 | ||
93 | pasemi_mac_ethtool_get_msglevel(struct net_device *netdev) | ||
94 | { | ||
95 | struct pasemi_mac *mac = netdev_priv(netdev); | ||
96 | return mac->msg_enable; | ||
97 | } | ||
98 | |||
99 | static void | ||
100 | pasemi_mac_ethtool_set_msglevel(struct net_device *netdev, | ||
101 | u32 level) | ||
102 | { | ||
103 | struct pasemi_mac *mac = netdev_priv(netdev); | ||
104 | mac->msg_enable = level; | ||
105 | } | ||
106 | |||
107 | |||
108 | static void | ||
109 | pasemi_mac_ethtool_get_ringparam(struct net_device *netdev, | ||
110 | struct ethtool_ringparam *ering) | ||
111 | { | ||
112 | struct pasemi_mac *mac = netdev->priv; | ||
113 | |||
114 | ering->tx_max_pending = TX_RING_SIZE/2; | ||
115 | ering->tx_pending = RING_USED(mac->tx)/2; | ||
116 | ering->rx_max_pending = RX_RING_SIZE/4; | ||
117 | ering->rx_pending = RING_USED(mac->rx)/4; | ||
118 | } | ||
119 | |||
120 | static int pasemi_mac_get_sset_count(struct net_device *netdev, int sset) | ||
121 | { | ||
122 | switch (sset) { | ||
123 | case ETH_SS_STATS: | ||
124 | return ARRAY_SIZE(ethtool_stats_keys); | ||
125 | default: | ||
126 | return -EOPNOTSUPP; | ||
127 | } | ||
128 | } | ||
129 | |||
130 | static void pasemi_mac_get_ethtool_stats(struct net_device *netdev, | ||
131 | struct ethtool_stats *stats, u64 *data) | ||
132 | { | ||
133 | struct pasemi_mac *mac = netdev->priv; | ||
134 | int i; | ||
135 | |||
136 | data[0] = pasemi_read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)) | ||
137 | >> PAS_DMA_RXINT_RCMDSTA_DROPS_S; | ||
138 | for (i = 0; i < 32; i++) | ||
139 | data[1+i] = pasemi_read_mac_reg(mac->dma_if, PAS_MAC_RMON(i)); | ||
140 | } | ||
141 | |||
142 | static void pasemi_mac_get_strings(struct net_device *netdev, u32 stringset, | ||
143 | u8 *data) | ||
144 | { | ||
145 | memcpy(data, ethtool_stats_keys, sizeof(ethtool_stats_keys)); | ||
146 | } | ||
147 | |||
148 | const struct ethtool_ops pasemi_mac_ethtool_ops = { | ||
149 | .get_settings = pasemi_mac_ethtool_get_settings, | ||
150 | .get_drvinfo = pasemi_mac_ethtool_get_drvinfo, | ||
151 | .get_msglevel = pasemi_mac_ethtool_get_msglevel, | ||
152 | .set_msglevel = pasemi_mac_ethtool_set_msglevel, | ||
153 | .get_link = ethtool_op_get_link, | ||
154 | .get_ringparam = pasemi_mac_ethtool_get_ringparam, | ||
155 | .get_strings = pasemi_mac_get_strings, | ||
156 | .get_sset_count = pasemi_mac_get_sset_count, | ||
157 | .get_ethtool_stats = pasemi_mac_get_ethtool_stats, | ||
158 | }; | ||
159 | |||
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index f023d5b67e6e..f1a52def1241 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -158,6 +158,9 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
158 | struct asyncppp *ap; | 158 | struct asyncppp *ap; |
159 | int err; | 159 | int err; |
160 | 160 | ||
161 | if (tty->ops->write == NULL) | ||
162 | return -EOPNOTSUPP; | ||
163 | |||
161 | err = -ENOMEM; | 164 | err = -ENOMEM; |
162 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 165 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
163 | if (!ap) | 166 | if (!ap) |
@@ -358,9 +361,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
358 | if (!skb_queue_empty(&ap->rqueue)) | 361 | if (!skb_queue_empty(&ap->rqueue)) |
359 | tasklet_schedule(&ap->tsk); | 362 | tasklet_schedule(&ap->tsk); |
360 | ap_put(ap); | 363 | ap_put(ap); |
361 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) | 364 | tty_unthrottle(tty); |
362 | && tty->driver->unthrottle) | ||
363 | tty->driver->unthrottle(tty); | ||
364 | } | 365 | } |
365 | 366 | ||
366 | static void | 367 | static void |
@@ -676,7 +677,7 @@ ppp_async_push(struct asyncppp *ap) | |||
676 | if (!tty_stuffed && ap->optr < ap->olim) { | 677 | if (!tty_stuffed && ap->optr < ap->olim) { |
677 | avail = ap->olim - ap->optr; | 678 | avail = ap->olim - ap->optr; |
678 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 679 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
679 | sent = tty->driver->write(tty, ap->optr, avail); | 680 | sent = tty->ops->write(tty, ap->optr, avail); |
680 | if (sent < 0) | 681 | if (sent < 0) |
681 | goto flush; /* error, e.g. loss of CD */ | 682 | goto flush; /* error, e.g. loss of CD */ |
682 | ap->optr += sent; | 683 | ap->optr += sent; |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index 0d80fa546719..b8f0369a71e7 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -207,6 +207,9 @@ ppp_sync_open(struct tty_struct *tty) | |||
207 | struct syncppp *ap; | 207 | struct syncppp *ap; |
208 | int err; | 208 | int err; |
209 | 209 | ||
210 | if (tty->ops->write == NULL) | ||
211 | return -EOPNOTSUPP; | ||
212 | |||
210 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 213 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
211 | err = -ENOMEM; | 214 | err = -ENOMEM; |
212 | if (!ap) | 215 | if (!ap) |
@@ -398,9 +401,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
398 | if (!skb_queue_empty(&ap->rqueue)) | 401 | if (!skb_queue_empty(&ap->rqueue)) |
399 | tasklet_schedule(&ap->tsk); | 402 | tasklet_schedule(&ap->tsk); |
400 | sp_put(ap); | 403 | sp_put(ap); |
401 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) | 404 | tty_unthrottle(tty); |
402 | && tty->driver->unthrottle) | ||
403 | tty->driver->unthrottle(tty); | ||
404 | } | 405 | } |
405 | 406 | ||
406 | static void | 407 | static void |
@@ -653,7 +654,7 @@ ppp_sync_push(struct syncppp *ap) | |||
653 | tty_stuffed = 0; | 654 | tty_stuffed = 0; |
654 | if (!tty_stuffed && ap->tpkt) { | 655 | if (!tty_stuffed && ap->tpkt) { |
655 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 656 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
656 | sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); | 657 | sent = tty->ops->write(tty, ap->tpkt->data, ap->tpkt->len); |
657 | if (sent < 0) | 658 | if (sent < 0) |
658 | goto flush; /* error, e.g. loss of CD */ | 659 | goto flush; /* error, e.g. loss of CD */ |
659 | if (sent < ap->tpkt->len) { | 660 | if (sent < ap->tpkt->len) { |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 4fad4ddb3504..58a26a47af29 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -1052,11 +1052,9 @@ static int __init pppoe_proc_init(void) | |||
1052 | { | 1052 | { |
1053 | struct proc_dir_entry *p; | 1053 | struct proc_dir_entry *p; |
1054 | 1054 | ||
1055 | p = create_proc_entry("pppoe", S_IRUGO, init_net.proc_net); | 1055 | p = proc_net_fops_create(&init_net, "pppoe", S_IRUGO, &pppoe_seq_fops); |
1056 | if (!p) | 1056 | if (!p) |
1057 | return -ENOMEM; | 1057 | return -ENOMEM; |
1058 | |||
1059 | p->proc_fops = &pppoe_seq_fops; | ||
1060 | return 0; | 1058 | return 0; |
1061 | } | 1059 | } |
1062 | #else /* CONFIG_PROC_FS */ | 1060 | #else /* CONFIG_PROC_FS */ |
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 3d10ca050b79..244d7830c92a 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -2469,12 +2469,12 @@ static int __init pppol2tp_init(void) | |||
2469 | goto out_unregister_pppol2tp_proto; | 2469 | goto out_unregister_pppol2tp_proto; |
2470 | 2470 | ||
2471 | #ifdef CONFIG_PROC_FS | 2471 | #ifdef CONFIG_PROC_FS |
2472 | pppol2tp_proc = create_proc_entry("pppol2tp", 0, init_net.proc_net); | 2472 | pppol2tp_proc = proc_net_fops_create(&init_net, "pppol2tp", 0, |
2473 | &pppol2tp_proc_fops); | ||
2473 | if (!pppol2tp_proc) { | 2474 | if (!pppol2tp_proc) { |
2474 | err = -ENOMEM; | 2475 | err = -ENOMEM; |
2475 | goto out_unregister_pppox_proto; | 2476 | goto out_unregister_pppox_proto; |
2476 | } | 2477 | } |
2477 | pppol2tp_proc->proc_fops = &pppol2tp_proc_fops; | ||
2478 | #endif /* CONFIG_PROC_FS */ | 2478 | #endif /* CONFIG_PROC_FS */ |
2479 | printk(KERN_INFO "PPPoL2TP kernel driver, %s\n", | 2479 | printk(KERN_INFO "PPPoL2TP kernel driver, %s\n", |
2480 | PPPOL2TP_DRV_VERSION); | 2480 | PPPOL2TP_DRV_VERSION); |
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c index 7eb6e7e848f4..e365efb3c627 100644 --- a/drivers/net/ps3_gelic_net.c +++ b/drivers/net/ps3_gelic_net.c | |||
@@ -1266,6 +1266,85 @@ int gelic_net_set_rx_csum(struct net_device *netdev, u32 data) | |||
1266 | return 0; | 1266 | return 0; |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | static void gelic_net_get_wol(struct net_device *netdev, | ||
1270 | struct ethtool_wolinfo *wol) | ||
1271 | { | ||
1272 | if (0 <= ps3_compare_firmware_version(2, 2, 0)) | ||
1273 | wol->supported = WAKE_MAGIC; | ||
1274 | else | ||
1275 | wol->supported = 0; | ||
1276 | |||
1277 | wol->wolopts = ps3_sys_manager_get_wol() ? wol->supported : 0; | ||
1278 | memset(&wol->sopass, 0, sizeof(wol->sopass)); | ||
1279 | } | ||
1280 | static int gelic_net_set_wol(struct net_device *netdev, | ||
1281 | struct ethtool_wolinfo *wol) | ||
1282 | { | ||
1283 | int status; | ||
1284 | struct gelic_card *card; | ||
1285 | u64 v1, v2; | ||
1286 | |||
1287 | if (ps3_compare_firmware_version(2, 2, 0) < 0 || | ||
1288 | !capable(CAP_NET_ADMIN)) | ||
1289 | return -EPERM; | ||
1290 | |||
1291 | if (wol->wolopts & ~WAKE_MAGIC) | ||
1292 | return -EINVAL; | ||
1293 | |||
1294 | card = netdev_card(netdev); | ||
1295 | if (wol->wolopts & WAKE_MAGIC) { | ||
1296 | status = lv1_net_control(bus_id(card), dev_id(card), | ||
1297 | GELIC_LV1_SET_WOL, | ||
1298 | GELIC_LV1_WOL_MAGIC_PACKET, | ||
1299 | 0, GELIC_LV1_WOL_MP_ENABLE, | ||
1300 | &v1, &v2); | ||
1301 | if (status) { | ||
1302 | pr_info("%s: enabling WOL failed %d\n", __func__, | ||
1303 | status); | ||
1304 | status = -EIO; | ||
1305 | goto done; | ||
1306 | } | ||
1307 | status = lv1_net_control(bus_id(card), dev_id(card), | ||
1308 | GELIC_LV1_SET_WOL, | ||
1309 | GELIC_LV1_WOL_ADD_MATCH_ADDR, | ||
1310 | 0, GELIC_LV1_WOL_MATCH_ALL, | ||
1311 | &v1, &v2); | ||
1312 | if (!status) | ||
1313 | ps3_sys_manager_set_wol(1); | ||
1314 | else { | ||
1315 | pr_info("%s: enabling WOL filter failed %d\n", | ||
1316 | __func__, status); | ||
1317 | status = -EIO; | ||
1318 | } | ||
1319 | } else { | ||
1320 | status = lv1_net_control(bus_id(card), dev_id(card), | ||
1321 | GELIC_LV1_SET_WOL, | ||
1322 | GELIC_LV1_WOL_MAGIC_PACKET, | ||
1323 | 0, GELIC_LV1_WOL_MP_DISABLE, | ||
1324 | &v1, &v2); | ||
1325 | if (status) { | ||
1326 | pr_info("%s: disabling WOL failed %d\n", __func__, | ||
1327 | status); | ||
1328 | status = -EIO; | ||
1329 | goto done; | ||
1330 | } | ||
1331 | status = lv1_net_control(bus_id(card), dev_id(card), | ||
1332 | GELIC_LV1_SET_WOL, | ||
1333 | GELIC_LV1_WOL_DELETE_MATCH_ADDR, | ||
1334 | 0, GELIC_LV1_WOL_MATCH_ALL, | ||
1335 | &v1, &v2); | ||
1336 | if (!status) | ||
1337 | ps3_sys_manager_set_wol(0); | ||
1338 | else { | ||
1339 | pr_info("%s: removing WOL filter failed %d\n", | ||
1340 | __func__, status); | ||
1341 | status = -EIO; | ||
1342 | } | ||
1343 | } | ||
1344 | done: | ||
1345 | return status; | ||
1346 | } | ||
1347 | |||
1269 | static struct ethtool_ops gelic_ether_ethtool_ops = { | 1348 | static struct ethtool_ops gelic_ether_ethtool_ops = { |
1270 | .get_drvinfo = gelic_net_get_drvinfo, | 1349 | .get_drvinfo = gelic_net_get_drvinfo, |
1271 | .get_settings = gelic_ether_get_settings, | 1350 | .get_settings = gelic_ether_get_settings, |
@@ -1274,6 +1353,8 @@ static struct ethtool_ops gelic_ether_ethtool_ops = { | |||
1274 | .set_tx_csum = ethtool_op_set_tx_csum, | 1353 | .set_tx_csum = ethtool_op_set_tx_csum, |
1275 | .get_rx_csum = gelic_net_get_rx_csum, | 1354 | .get_rx_csum = gelic_net_get_rx_csum, |
1276 | .set_rx_csum = gelic_net_set_rx_csum, | 1355 | .set_rx_csum = gelic_net_set_rx_csum, |
1356 | .get_wol = gelic_net_get_wol, | ||
1357 | .set_wol = gelic_net_set_wol, | ||
1277 | }; | 1358 | }; |
1278 | 1359 | ||
1279 | /** | 1360 | /** |
diff --git a/drivers/net/ps3_gelic_net.h b/drivers/net/ps3_gelic_net.h index 1d39d06797e4..520f143c2c09 100644 --- a/drivers/net/ps3_gelic_net.h +++ b/drivers/net/ps3_gelic_net.h | |||
@@ -182,12 +182,32 @@ enum gelic_lv1_net_control_code { | |||
182 | GELIC_LV1_GET_ETH_PORT_STATUS = 2, | 182 | GELIC_LV1_GET_ETH_PORT_STATUS = 2, |
183 | GELIC_LV1_SET_NEGOTIATION_MODE = 3, | 183 | GELIC_LV1_SET_NEGOTIATION_MODE = 3, |
184 | GELIC_LV1_GET_VLAN_ID = 4, | 184 | GELIC_LV1_GET_VLAN_ID = 4, |
185 | GELIC_LV1_SET_WOL = 5, | ||
185 | GELIC_LV1_GET_CHANNEL = 6, | 186 | GELIC_LV1_GET_CHANNEL = 6, |
186 | GELIC_LV1_POST_WLAN_CMD = 9, | 187 | GELIC_LV1_POST_WLAN_CMD = 9, |
187 | GELIC_LV1_GET_WLAN_CMD_RESULT = 10, | 188 | GELIC_LV1_GET_WLAN_CMD_RESULT = 10, |
188 | GELIC_LV1_GET_WLAN_EVENT = 11 | 189 | GELIC_LV1_GET_WLAN_EVENT = 11 |
189 | }; | 190 | }; |
190 | 191 | ||
192 | /* for GELIC_LV1_SET_WOL */ | ||
193 | enum gelic_lv1_wol_command { | ||
194 | GELIC_LV1_WOL_MAGIC_PACKET = 1, | ||
195 | GELIC_LV1_WOL_ADD_MATCH_ADDR = 6, | ||
196 | GELIC_LV1_WOL_DELETE_MATCH_ADDR = 7, | ||
197 | }; | ||
198 | |||
199 | /* for GELIC_LV1_WOL_MAGIC_PACKET */ | ||
200 | enum gelic_lv1_wol_mp_arg { | ||
201 | GELIC_LV1_WOL_MP_DISABLE = 0, | ||
202 | GELIC_LV1_WOL_MP_ENABLE = 1, | ||
203 | }; | ||
204 | |||
205 | /* for GELIC_LV1_WOL_{ADD,DELETE}_MATCH_ADDR */ | ||
206 | enum gelic_lv1_wol_match_arg { | ||
207 | GELIC_LV1_WOL_MATCH_INDIVIDUAL = 0, | ||
208 | GELIC_LV1_WOL_MATCH_ALL = 1, | ||
209 | }; | ||
210 | |||
191 | /* status returened from GET_ETH_PORT_STATUS */ | 211 | /* status returened from GET_ETH_PORT_STATUS */ |
192 | enum gelic_lv1_ether_port_status { | 212 | enum gelic_lv1_ether_port_status { |
193 | GELIC_LV1_ETHER_LINK_UP = 0x0000000000000001L, | 213 | GELIC_LV1_ETHER_LINK_UP = 0x0000000000000001L, |
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index e7fd08adbbac..2b8fd68bc516 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -77,7 +77,7 @@ static int rionet_capable = 1; | |||
77 | * could be made into a hash table to save memory depending | 77 | * could be made into a hash table to save memory depending |
78 | * on system trade-offs. | 78 | * on system trade-offs. |
79 | */ | 79 | */ |
80 | static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES]; | 80 | static struct rio_dev **rionet_active; |
81 | 81 | ||
82 | #define is_rionet_capable(pef, src_ops, dst_ops) \ | 82 | #define is_rionet_capable(pef, src_ops, dst_ops) \ |
83 | ((pef & RIO_PEF_INB_MBOX) && \ | 83 | ((pef & RIO_PEF_INB_MBOX) && \ |
@@ -195,7 +195,8 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
195 | } | 195 | } |
196 | 196 | ||
197 | if (eth->h_dest[0] & 0x01) { | 197 | if (eth->h_dest[0] & 0x01) { |
198 | for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++) | 198 | for (i = 0; i < RIO_MAX_ROUTE_ENTRIES(rnet->mport->sys_size); |
199 | i++) | ||
199 | if (rionet_active[i]) | 200 | if (rionet_active[i]) |
200 | rionet_queue_tx_msg(skb, ndev, | 201 | rionet_queue_tx_msg(skb, ndev, |
201 | rionet_active[i]); | 202 | rionet_active[i]); |
@@ -385,6 +386,8 @@ static void rionet_remove(struct rio_dev *rdev) | |||
385 | struct net_device *ndev = NULL; | 386 | struct net_device *ndev = NULL; |
386 | struct rionet_peer *peer, *tmp; | 387 | struct rionet_peer *peer, *tmp; |
387 | 388 | ||
389 | free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? | ||
390 | __ilog2(sizeof(void *)) + 4 : 0); | ||
388 | unregister_netdev(ndev); | 391 | unregister_netdev(ndev); |
389 | kfree(ndev); | 392 | kfree(ndev); |
390 | 393 | ||
@@ -443,6 +446,15 @@ static int rionet_setup_netdev(struct rio_mport *mport) | |||
443 | goto out; | 446 | goto out; |
444 | } | 447 | } |
445 | 448 | ||
449 | rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, | ||
450 | mport->sys_size ? __ilog2(sizeof(void *)) + 4 : 0); | ||
451 | if (!rionet_active) { | ||
452 | rc = -ENOMEM; | ||
453 | goto out; | ||
454 | } | ||
455 | memset((void *)rionet_active, 0, sizeof(void *) * | ||
456 | RIO_MAX_ROUTE_ENTRIES(mport->sys_size)); | ||
457 | |||
446 | /* Set up private area */ | 458 | /* Set up private area */ |
447 | rnet = (struct rionet_private *)ndev->priv; | 459 | rnet = (struct rionet_private *)ndev->priv; |
448 | rnet->mport = mport; | 460 | rnet->mport = mport; |
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 5a55ede352f4..84af68fdb6c2 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
@@ -396,14 +396,14 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len) | |||
396 | 396 | ||
397 | /* Order of next two lines is *very* important. | 397 | /* Order of next two lines is *very* important. |
398 | * When we are sending a little amount of data, | 398 | * When we are sending a little amount of data, |
399 | * the transfer may be completed inside driver.write() | 399 | * the transfer may be completed inside the ops->write() |
400 | * routine, because it's running with interrupts enabled. | 400 | * routine, because it's running with interrupts enabled. |
401 | * In this case we *never* got WRITE_WAKEUP event, | 401 | * In this case we *never* got WRITE_WAKEUP event, |
402 | * if we did not request it before write operation. | 402 | * if we did not request it before write operation. |
403 | * 14 Oct 1994 Dmitry Gorodchanin. | 403 | * 14 Oct 1994 Dmitry Gorodchanin. |
404 | */ | 404 | */ |
405 | sl->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); | 405 | sl->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); |
406 | actual = sl->tty->driver->write(sl->tty, sl->xbuff, count); | 406 | actual = sl->tty->ops->write(sl->tty, sl->xbuff, count); |
407 | #ifdef SL_CHECK_TRANSMIT | 407 | #ifdef SL_CHECK_TRANSMIT |
408 | sl->dev->trans_start = jiffies; | 408 | sl->dev->trans_start = jiffies; |
409 | #endif | 409 | #endif |
@@ -437,7 +437,7 @@ static void slip_write_wakeup(struct tty_struct *tty) | |||
437 | return; | 437 | return; |
438 | } | 438 | } |
439 | 439 | ||
440 | actual = tty->driver->write(tty, sl->xhead, sl->xleft); | 440 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); |
441 | sl->xleft -= actual; | 441 | sl->xleft -= actual; |
442 | sl->xhead += actual; | 442 | sl->xhead += actual; |
443 | } | 443 | } |
@@ -462,7 +462,7 @@ static void sl_tx_timeout(struct net_device *dev) | |||
462 | } | 462 | } |
463 | printk(KERN_WARNING "%s: transmit timed out, %s?\n", | 463 | printk(KERN_WARNING "%s: transmit timed out, %s?\n", |
464 | dev->name, | 464 | dev->name, |
465 | (sl->tty->driver->chars_in_buffer(sl->tty) || sl->xleft) ? | 465 | (tty_chars_in_buffer(sl->tty) || sl->xleft) ? |
466 | "bad line quality" : "driver error"); | 466 | "bad line quality" : "driver error"); |
467 | sl->xleft = 0; | 467 | sl->xleft = 0; |
468 | sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); | 468 | sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); |
@@ -830,6 +830,9 @@ static int slip_open(struct tty_struct *tty) | |||
830 | if (!capable(CAP_NET_ADMIN)) | 830 | if (!capable(CAP_NET_ADMIN)) |
831 | return -EPERM; | 831 | return -EPERM; |
832 | 832 | ||
833 | if (tty->ops->write == NULL) | ||
834 | return -EOPNOTSUPP; | ||
835 | |||
833 | /* RTnetlink lock is misused here to serialize concurrent | 836 | /* RTnetlink lock is misused here to serialize concurrent |
834 | opens of slip channels. There are better ways, but it is | 837 | opens of slip channels. There are better ways, but it is |
835 | the simplest one. | 838 | the simplest one. |
@@ -1432,7 +1435,7 @@ static void sl_outfill(unsigned long sls) | |||
1432 | /* put END into tty queue. Is it right ??? */ | 1435 | /* put END into tty queue. Is it right ??? */ |
1433 | if (!netif_queue_stopped(sl->dev)) { | 1436 | if (!netif_queue_stopped(sl->dev)) { |
1434 | /* if device busy no outfill */ | 1437 | /* if device busy no outfill */ |
1435 | sl->tty->driver->write(sl->tty, &s, 1); | 1438 | sl->tty->ops->write(sl->tty, &s, 1); |
1436 | } | 1439 | } |
1437 | } else | 1440 | } else |
1438 | set_bit(SLF_OUTWAIT, &sl->flags); | 1441 | set_bit(SLF_OUTWAIT, &sl->flags); |
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index e83b166aa6b9..432e837a1760 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -649,7 +649,7 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) | |||
649 | DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]); | 649 | DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]); |
650 | } | 650 | } |
651 | 651 | ||
652 | if (!capable(CAP_NET_ADMIN)) | 652 | if (!capable(CAP_SYS_RAWIO)) |
653 | return -EPERM; | 653 | return -EPERM; |
654 | 654 | ||
655 | switch (data[0]) { | 655 | switch (data[0]) { |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index e3f74c9f78bd..b66c75e3b8a1 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -4361,7 +4361,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb) | |||
4361 | } | 4361 | } |
4362 | 4362 | ||
4363 | segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO); | 4363 | segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO); |
4364 | if (unlikely(IS_ERR(segs))) | 4364 | if (IS_ERR(segs)) |
4365 | goto tg3_tso_bug_end; | 4365 | goto tg3_tso_bug_end; |
4366 | 4366 | ||
4367 | do { | 4367 | do { |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index 6c6fc325c8f9..bc30c6e8fea2 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -482,7 +482,6 @@ | |||
482 | static char version[] __devinitdata = "de4x5.c:V0.546 2001/02/22 davies@maniac.ultranet.com\n"; | 482 | static char version[] __devinitdata = "de4x5.c:V0.546 2001/02/22 davies@maniac.ultranet.com\n"; |
483 | 483 | ||
484 | #define c_char const char | 484 | #define c_char const char |
485 | #define TWIDDLE(a) (u_short)le16_to_cpu(get_unaligned((__le16 *)(a))) | ||
486 | 485 | ||
487 | /* | 486 | /* |
488 | ** MII Information | 487 | ** MII Information |
@@ -4405,7 +4404,7 @@ srom_infoleaf_info(struct net_device *dev) | |||
4405 | } | 4404 | } |
4406 | } | 4405 | } |
4407 | 4406 | ||
4408 | lp->infoleaf_offset = TWIDDLE(p+1); | 4407 | lp->infoleaf_offset = get_unaligned_le16(p + 1); |
4409 | 4408 | ||
4410 | return 0; | 4409 | return 0; |
4411 | } | 4410 | } |
@@ -4476,7 +4475,7 @@ srom_exec(struct net_device *dev, u_char *p) | |||
4476 | 4475 | ||
4477 | while (count--) { | 4476 | while (count--) { |
4478 | gep_wr(((lp->chipset==DC21140) && (lp->ibn!=5) ? | 4477 | gep_wr(((lp->chipset==DC21140) && (lp->ibn!=5) ? |
4479 | *p++ : TWIDDLE(w++)), dev); | 4478 | *p++ : get_unaligned_le16(w++)), dev); |
4480 | mdelay(2); /* 2ms per action */ | 4479 | mdelay(2); /* 2ms per action */ |
4481 | } | 4480 | } |
4482 | 4481 | ||
@@ -4711,10 +4710,10 @@ type1_infoblock(struct net_device *dev, u_char count, u_char *p) | |||
4711 | lp->active = *p++; | 4710 | lp->active = *p++; |
4712 | lp->phy[lp->active].gep = (*p ? p : NULL); p += (*p + 1); | 4711 | lp->phy[lp->active].gep = (*p ? p : NULL); p += (*p + 1); |
4713 | lp->phy[lp->active].rst = (*p ? p : NULL); p += (*p + 1); | 4712 | lp->phy[lp->active].rst = (*p ? p : NULL); p += (*p + 1); |
4714 | lp->phy[lp->active].mc = TWIDDLE(p); p += 2; | 4713 | lp->phy[lp->active].mc = get_unaligned_le16(p); p += 2; |
4715 | lp->phy[lp->active].ana = TWIDDLE(p); p += 2; | 4714 | lp->phy[lp->active].ana = get_unaligned_le16(p); p += 2; |
4716 | lp->phy[lp->active].fdx = TWIDDLE(p); p += 2; | 4715 | lp->phy[lp->active].fdx = get_unaligned_le16(p); p += 2; |
4717 | lp->phy[lp->active].ttm = TWIDDLE(p); | 4716 | lp->phy[lp->active].ttm = get_unaligned_le16(p); |
4718 | return 0; | 4717 | return 0; |
4719 | } else if ((lp->media == INIT) && (lp->timeout < 0)) { | 4718 | } else if ((lp->media == INIT) && (lp->timeout < 0)) { |
4720 | lp->ibn = 1; | 4719 | lp->ibn = 1; |
@@ -4751,16 +4750,16 @@ type2_infoblock(struct net_device *dev, u_char count, u_char *p) | |||
4751 | lp->infoblock_media = (*p) & MEDIA_CODE; | 4750 | lp->infoblock_media = (*p) & MEDIA_CODE; |
4752 | 4751 | ||
4753 | if ((*p++) & EXT_FIELD) { | 4752 | if ((*p++) & EXT_FIELD) { |
4754 | lp->cache.csr13 = TWIDDLE(p); p += 2; | 4753 | lp->cache.csr13 = get_unaligned_le16(p); p += 2; |
4755 | lp->cache.csr14 = TWIDDLE(p); p += 2; | 4754 | lp->cache.csr14 = get_unaligned_le16(p); p += 2; |
4756 | lp->cache.csr15 = TWIDDLE(p); p += 2; | 4755 | lp->cache.csr15 = get_unaligned_le16(p); p += 2; |
4757 | } else { | 4756 | } else { |
4758 | lp->cache.csr13 = CSR13; | 4757 | lp->cache.csr13 = CSR13; |
4759 | lp->cache.csr14 = CSR14; | 4758 | lp->cache.csr14 = CSR14; |
4760 | lp->cache.csr15 = CSR15; | 4759 | lp->cache.csr15 = CSR15; |
4761 | } | 4760 | } |
4762 | lp->cache.gepc = ((s32)(TWIDDLE(p)) << 16); p += 2; | 4761 | lp->cache.gepc = ((s32)(get_unaligned_le16(p)) << 16); p += 2; |
4763 | lp->cache.gep = ((s32)(TWIDDLE(p)) << 16); | 4762 | lp->cache.gep = ((s32)(get_unaligned_le16(p)) << 16); |
4764 | lp->infoblock_csr6 = OMR_SIA; | 4763 | lp->infoblock_csr6 = OMR_SIA; |
4765 | lp->useMII = false; | 4764 | lp->useMII = false; |
4766 | 4765 | ||
@@ -4792,10 +4791,10 @@ type3_infoblock(struct net_device *dev, u_char count, u_char *p) | |||
4792 | if (MOTO_SROM_BUG) lp->active = 0; | 4791 | if (MOTO_SROM_BUG) lp->active = 0; |
4793 | lp->phy[lp->active].gep = (*p ? p : NULL); p += (2 * (*p) + 1); | 4792 | lp->phy[lp->active].gep = (*p ? p : NULL); p += (2 * (*p) + 1); |
4794 | lp->phy[lp->active].rst = (*p ? p : NULL); p += (2 * (*p) + 1); | 4793 | lp->phy[lp->active].rst = (*p ? p : NULL); p += (2 * (*p) + 1); |
4795 | lp->phy[lp->active].mc = TWIDDLE(p); p += 2; | 4794 | lp->phy[lp->active].mc = get_unaligned_le16(p); p += 2; |
4796 | lp->phy[lp->active].ana = TWIDDLE(p); p += 2; | 4795 | lp->phy[lp->active].ana = get_unaligned_le16(p); p += 2; |
4797 | lp->phy[lp->active].fdx = TWIDDLE(p); p += 2; | 4796 | lp->phy[lp->active].fdx = get_unaligned_le16(p); p += 2; |
4798 | lp->phy[lp->active].ttm = TWIDDLE(p); p += 2; | 4797 | lp->phy[lp->active].ttm = get_unaligned_le16(p); p += 2; |
4799 | lp->phy[lp->active].mci = *p; | 4798 | lp->phy[lp->active].mci = *p; |
4800 | return 0; | 4799 | return 0; |
4801 | } else if ((lp->media == INIT) && (lp->timeout < 0)) { | 4800 | } else if ((lp->media == INIT) && (lp->timeout < 0)) { |
@@ -4835,8 +4834,8 @@ type4_infoblock(struct net_device *dev, u_char count, u_char *p) | |||
4835 | lp->cache.csr13 = CSR13; /* Hard coded defaults */ | 4834 | lp->cache.csr13 = CSR13; /* Hard coded defaults */ |
4836 | lp->cache.csr14 = CSR14; | 4835 | lp->cache.csr14 = CSR14; |
4837 | lp->cache.csr15 = CSR15; | 4836 | lp->cache.csr15 = CSR15; |
4838 | lp->cache.gepc = ((s32)(TWIDDLE(p)) << 16); p += 2; | 4837 | lp->cache.gepc = ((s32)(get_unaligned_le16(p)) << 16); p += 2; |
4839 | lp->cache.gep = ((s32)(TWIDDLE(p)) << 16); p += 2; | 4838 | lp->cache.gep = ((s32)(get_unaligned_le16(p)) << 16); p += 2; |
4840 | csr6 = *p++; | 4839 | csr6 = *p++; |
4841 | flags = *p++; | 4840 | flags = *p++; |
4842 | 4841 | ||
diff --git a/drivers/net/tulip/de4x5.h b/drivers/net/tulip/de4x5.h index 9fb8d7f07994..f5f33b3eb067 100644 --- a/drivers/net/tulip/de4x5.h +++ b/drivers/net/tulip/de4x5.h | |||
@@ -1017,4 +1017,4 @@ struct de4x5_ioctl { | |||
1017 | #define DE4X5_SET_OMR 0x0d /* Set the OMR Register contents */ | 1017 | #define DE4X5_SET_OMR 0x0d /* Set the OMR Register contents */ |
1018 | #define DE4X5_GET_REG 0x0e /* Get the DE4X5 Registers */ | 1018 | #define DE4X5_GET_REG 0x0e /* Get the DE4X5 Registers */ |
1019 | 1019 | ||
1020 | #define MOTO_SROM_BUG ((lp->active == 8) && (((le32_to_cpu(get_unaligned(((__le32 *)dev->dev_addr))))&0x00ffffff)==0x3e0008)) | 1020 | #define MOTO_SROM_BUG (lp->active == 8 && (get_unaligned_le32(dev->dev_addr) & 0x00ffffff) == 0x3e0008) |
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h index 908422f2f320..92c68a22f16b 100644 --- a/drivers/net/tulip/tulip.h +++ b/drivers/net/tulip/tulip.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | #include <asm/irq.h> | 27 | #include <asm/irq.h> |
28 | #include <asm/unaligned.h> | ||
28 | 29 | ||
29 | 30 | ||
30 | 31 | ||
@@ -304,11 +305,7 @@ enum t21143_csr6_bits { | |||
304 | 305 | ||
305 | #define RUN_AT(x) (jiffies + (x)) | 306 | #define RUN_AT(x) (jiffies + (x)) |
306 | 307 | ||
307 | #if defined(__i386__) /* AKA get_unaligned() */ | 308 | #define get_u16(ptr) get_unaligned_le16((ptr)) |
308 | #define get_u16(ptr) (*(u16 *)(ptr)) | ||
309 | #else | ||
310 | #define get_u16(ptr) (((u8*)(ptr))[0] + (((u8*)(ptr))[1]<<8)) | ||
311 | #endif | ||
312 | 309 | ||
313 | struct medialeaf { | 310 | struct medialeaf { |
314 | u8 type; | 311 | u8 type; |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index fa1c1c329a2d..f9d13fa05d64 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -327,8 +327,8 @@ static void tulip_up(struct net_device *dev) | |||
327 | tp->dirty_rx = tp->dirty_tx = 0; | 327 | tp->dirty_rx = tp->dirty_tx = 0; |
328 | 328 | ||
329 | if (tp->flags & MC_HASH_ONLY) { | 329 | if (tp->flags & MC_HASH_ONLY) { |
330 | u32 addr_low = le32_to_cpu(get_unaligned((__le32 *)dev->dev_addr)); | 330 | u32 addr_low = get_unaligned_le32(dev->dev_addr); |
331 | u32 addr_high = le16_to_cpu(get_unaligned((__le16 *)(dev->dev_addr+4))); | 331 | u32 addr_high = get_unaligned_le16(dev->dev_addr + 4); |
332 | if (tp->chip_id == AX88140) { | 332 | if (tp->chip_id == AX88140) { |
333 | iowrite32(0, ioaddr + CSR13); | 333 | iowrite32(0, ioaddr + CSR13); |
334 | iowrite32(addr_low, ioaddr + CSR14); | 334 | iowrite32(addr_low, ioaddr + CSR14); |
@@ -1437,13 +1437,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1437 | do | 1437 | do |
1438 | value = ioread32(ioaddr + CSR9); | 1438 | value = ioread32(ioaddr + CSR9); |
1439 | while (value < 0 && --boguscnt > 0); | 1439 | while (value < 0 && --boguscnt > 0); |
1440 | put_unaligned(cpu_to_le16(value), ((__le16*)dev->dev_addr) + i); | 1440 | put_unaligned_le16(value, ((__le16 *)dev->dev_addr) + i); |
1441 | sum += value & 0xffff; | 1441 | sum += value & 0xffff; |
1442 | } | 1442 | } |
1443 | } else if (chip_idx == COMET) { | 1443 | } else if (chip_idx == COMET) { |
1444 | /* No need to read the EEPROM. */ | 1444 | /* No need to read the EEPROM. */ |
1445 | put_unaligned(cpu_to_le32(ioread32(ioaddr + 0xA4)), (__le32 *)dev->dev_addr); | 1445 | put_unaligned_le32(ioread32(ioaddr + 0xA4), dev->dev_addr); |
1446 | put_unaligned(cpu_to_le16(ioread32(ioaddr + 0xA8)), (__le16 *)(dev->dev_addr + 4)); | 1446 | put_unaligned_le16(ioread32(ioaddr + 0xA8), dev->dev_addr + 4); |
1447 | for (i = 0; i < 6; i ++) | 1447 | for (i = 0; i < 6; i ++) |
1448 | sum += dev->dev_addr[i]; | 1448 | sum += dev->dev_addr[i]; |
1449 | } else { | 1449 | } else { |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 0aac91c3e4e4..281ce3d39532 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -3853,7 +3853,13 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3853 | 3853 | ||
3854 | ugeth_vdbg("%s: IN", __FUNCTION__); | 3854 | ugeth_vdbg("%s: IN", __FUNCTION__); |
3855 | 3855 | ||
3856 | prop = of_get_property(np, "device-id", NULL); | 3856 | prop = of_get_property(np, "cell-index", NULL); |
3857 | if (!prop) { | ||
3858 | prop = of_get_property(np, "device-id", NULL); | ||
3859 | if (!prop) | ||
3860 | return -ENODEV; | ||
3861 | } | ||
3862 | |||
3857 | ucc_num = *prop - 1; | 3863 | ucc_num = *prop - 1; |
3858 | if ((ucc_num < 0) || (ucc_num > 7)) | 3864 | if ((ucc_num < 0) || (ucc_num > 7)) |
3859 | return -ENODEV; | 3865 | return -ENODEV; |
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index e4d3f330bac3..2af490781005 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c | |||
@@ -203,9 +203,14 @@ static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *ma | |||
203 | if ((res.start >= tempres.start) && | 203 | if ((res.start >= tempres.start) && |
204 | (res.end <= tempres.end)) { | 204 | (res.end <= tempres.end)) { |
205 | /* set this UCC to be the MII master */ | 205 | /* set this UCC to be the MII master */ |
206 | const u32 *id = of_get_property(tempnp, "device-id", NULL); | 206 | const u32 *id; |
207 | if (id == NULL) | 207 | |
208 | goto bus_register_fail; | 208 | id = of_get_property(tempnp, "cell-index", NULL); |
209 | if (!id) { | ||
210 | id = of_get_property(tempnp, "device-id", NULL); | ||
211 | if (!id) | ||
212 | goto bus_register_fail; | ||
213 | } | ||
209 | 214 | ||
210 | ucc_set_qe_mux_mii_mng(*id - 1); | 215 | ucc_set_qe_mux_mii_mng(*id - 1); |
211 | 216 | ||
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 569ad8bfd383..0dcfc0310264 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c | |||
@@ -58,7 +58,6 @@ | |||
58 | #include <linux/dma-mapping.h> | 58 | #include <linux/dma-mapping.h> |
59 | #include <linux/wait.h> | 59 | #include <linux/wait.h> |
60 | #include <asm/uaccess.h> | 60 | #include <asm/uaccess.h> |
61 | #include <asm/semaphore.h> | ||
62 | #include <asm/byteorder.h> | 61 | #include <asm/byteorder.h> |
63 | 62 | ||
64 | #undef DEBUG | 63 | #undef DEBUG |
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index 63abfd72542d..e03eef2f2282 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c | |||
@@ -178,6 +178,20 @@ static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char signal) | |||
178 | CPC_TTY_UNLOCK(card,flags); | 178 | CPC_TTY_UNLOCK(card,flags); |
179 | } | 179 | } |
180 | 180 | ||
181 | |||
182 | static const struct tty_operations pc300_ops = { | ||
183 | .open = cpc_tty_open, | ||
184 | .close = cpc_tty_close, | ||
185 | .write = cpc_tty_write, | ||
186 | .write_room = cpc_tty_write_room, | ||
187 | .chars_in_buffer = cpc_tty_chars_in_buffer, | ||
188 | .tiocmset = pc300_tiocmset, | ||
189 | .tiocmget = pc300_tiocmget, | ||
190 | .flush_buffer = cpc_tty_flush_buffer, | ||
191 | .hangup = cpc_tty_hangup, | ||
192 | }; | ||
193 | |||
194 | |||
181 | /* | 195 | /* |
182 | * PC300 TTY initialization routine | 196 | * PC300 TTY initialization routine |
183 | * | 197 | * |
@@ -225,15 +239,7 @@ void cpc_tty_init(pc300dev_t *pc300dev) | |||
225 | serial_drv.flags = TTY_DRIVER_REAL_RAW; | 239 | serial_drv.flags = TTY_DRIVER_REAL_RAW; |
226 | 240 | ||
227 | /* interface routines from the upper tty layer to the tty driver */ | 241 | /* interface routines from the upper tty layer to the tty driver */ |
228 | serial_drv.open = cpc_tty_open; | 242 | tty_set_operations(&serial_drv, &pc300_ops); |
229 | serial_drv.close = cpc_tty_close; | ||
230 | serial_drv.write = cpc_tty_write; | ||
231 | serial_drv.write_room = cpc_tty_write_room; | ||
232 | serial_drv.chars_in_buffer = cpc_tty_chars_in_buffer; | ||
233 | serial_drv.tiocmset = pc300_tiocmset; | ||
234 | serial_drv.tiocmget = pc300_tiocmget; | ||
235 | serial_drv.flush_buffer = cpc_tty_flush_buffer; | ||
236 | serial_drv.hangup = cpc_tty_hangup; | ||
237 | 243 | ||
238 | /* register the TTY driver */ | 244 | /* register the TTY driver */ |
239 | if (tty_register_driver(&serial_drv)) { | 245 | if (tty_register_driver(&serial_drv)) { |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 0f8aca8a4d43..249e18053d5f 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | 18 | ||
19 | #include <asm/system.h> | 19 | #include <asm/system.h> |
20 | #include <asm/uaccess.h> | 20 | #include <linux/uaccess.h> |
21 | #include <linux/bitops.h> | 21 | #include <linux/bitops.h> |
22 | #include <linux/string.h> | 22 | #include <linux/string.h> |
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
@@ -95,7 +95,7 @@ static struct x25_asy *x25_asy_alloc(void) | |||
95 | x25_asy_devs[i] = dev; | 95 | x25_asy_devs[i] = dev; |
96 | return sl; | 96 | return sl; |
97 | } else { | 97 | } else { |
98 | printk("x25_asy_alloc() - register_netdev() failure.\n"); | 98 | printk(KERN_WARNING "x25_asy_alloc() - register_netdev() failure.\n"); |
99 | free_netdev(dev); | 99 | free_netdev(dev); |
100 | } | 100 | } |
101 | } | 101 | } |
@@ -112,23 +112,22 @@ static void x25_asy_free(struct x25_asy *sl) | |||
112 | kfree(sl->xbuff); | 112 | kfree(sl->xbuff); |
113 | sl->xbuff = NULL; | 113 | sl->xbuff = NULL; |
114 | 114 | ||
115 | if (!test_and_clear_bit(SLF_INUSE, &sl->flags)) { | 115 | if (!test_and_clear_bit(SLF_INUSE, &sl->flags)) |
116 | printk("%s: x25_asy_free for already free unit.\n", sl->dev->name); | 116 | printk(KERN_ERR "%s: x25_asy_free for already free unit.\n", |
117 | } | 117 | sl->dev->name); |
118 | } | 118 | } |
119 | 119 | ||
120 | static int x25_asy_change_mtu(struct net_device *dev, int newmtu) | 120 | static int x25_asy_change_mtu(struct net_device *dev, int newmtu) |
121 | { | 121 | { |
122 | struct x25_asy *sl = dev->priv; | 122 | struct x25_asy *sl = dev->priv; |
123 | unsigned char *xbuff, *rbuff; | 123 | unsigned char *xbuff, *rbuff; |
124 | int len = 2* newmtu; | 124 | int len = 2 * newmtu; |
125 | 125 | ||
126 | xbuff = kmalloc(len + 4, GFP_ATOMIC); | 126 | xbuff = kmalloc(len + 4, GFP_ATOMIC); |
127 | rbuff = kmalloc(len + 4, GFP_ATOMIC); | 127 | rbuff = kmalloc(len + 4, GFP_ATOMIC); |
128 | 128 | ||
129 | if (xbuff == NULL || rbuff == NULL) | 129 | if (xbuff == NULL || rbuff == NULL) { |
130 | { | 130 | printk(KERN_WARNING "%s: unable to grow X.25 buffers, MTU change cancelled.\n", |
131 | printk("%s: unable to grow X.25 buffers, MTU change cancelled.\n", | ||
132 | dev->name); | 131 | dev->name); |
133 | kfree(xbuff); | 132 | kfree(xbuff); |
134 | kfree(rbuff); | 133 | kfree(rbuff); |
@@ -193,25 +192,23 @@ static void x25_asy_bump(struct x25_asy *sl) | |||
193 | int err; | 192 | int err; |
194 | 193 | ||
195 | count = sl->rcount; | 194 | count = sl->rcount; |
196 | sl->stats.rx_bytes+=count; | 195 | sl->stats.rx_bytes += count; |
197 | 196 | ||
198 | skb = dev_alloc_skb(count+1); | 197 | skb = dev_alloc_skb(count+1); |
199 | if (skb == NULL) | 198 | if (skb == NULL) { |
200 | { | 199 | printk(KERN_WARNING "%s: memory squeeze, dropping packet.\n", |
201 | printk("%s: memory squeeze, dropping packet.\n", sl->dev->name); | 200 | sl->dev->name); |
202 | sl->stats.rx_dropped++; | 201 | sl->stats.rx_dropped++; |
203 | return; | 202 | return; |
204 | } | 203 | } |
205 | skb_push(skb,1); /* LAPB internal control */ | 204 | skb_push(skb, 1); /* LAPB internal control */ |
206 | memcpy(skb_put(skb,count), sl->rbuff, count); | 205 | memcpy(skb_put(skb, count), sl->rbuff, count); |
207 | skb->protocol = x25_type_trans(skb, sl->dev); | 206 | skb->protocol = x25_type_trans(skb, sl->dev); |
208 | if((err=lapb_data_received(skb->dev, skb))!=LAPB_OK) | 207 | err = lapb_data_received(skb->dev, skb); |
209 | { | 208 | if (err != LAPB_OK) { |
210 | kfree_skb(skb); | 209 | kfree_skb(skb); |
211 | printk(KERN_DEBUG "x25_asy: data received err - %d\n",err); | 210 | printk(KERN_DEBUG "x25_asy: data received err - %d\n", err); |
212 | } | 211 | } else { |
213 | else | ||
214 | { | ||
215 | netif_rx(skb); | 212 | netif_rx(skb); |
216 | sl->dev->last_rx = jiffies; | 213 | sl->dev->last_rx = jiffies; |
217 | sl->stats.rx_packets++; | 214 | sl->stats.rx_packets++; |
@@ -224,10 +221,11 @@ static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len) | |||
224 | unsigned char *p; | 221 | unsigned char *p; |
225 | int actual, count, mtu = sl->dev->mtu; | 222 | int actual, count, mtu = sl->dev->mtu; |
226 | 223 | ||
227 | if (len > mtu) | 224 | if (len > mtu) { |
228 | { /* Sigh, shouldn't occur BUT ... */ | 225 | /* Sigh, shouldn't occur BUT ... */ |
229 | len = mtu; | 226 | len = mtu; |
230 | printk ("%s: truncating oversized transmit packet!\n", sl->dev->name); | 227 | printk(KERN_DEBUG "%s: truncating oversized transmit packet!\n", |
228 | sl->dev->name); | ||
231 | sl->stats.tx_dropped++; | 229 | sl->stats.tx_dropped++; |
232 | x25_asy_unlock(sl); | 230 | x25_asy_unlock(sl); |
233 | return; | 231 | return; |
@@ -245,7 +243,7 @@ static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len) | |||
245 | * 14 Oct 1994 Dmitry Gorodchanin. | 243 | * 14 Oct 1994 Dmitry Gorodchanin. |
246 | */ | 244 | */ |
247 | sl->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); | 245 | sl->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); |
248 | actual = sl->tty->driver->write(sl->tty, sl->xbuff, count); | 246 | actual = sl->tty->ops->write(sl->tty, sl->xbuff, count); |
249 | sl->xleft = count - actual; | 247 | sl->xleft = count - actual; |
250 | sl->xhead = sl->xbuff + actual; | 248 | sl->xhead = sl->xbuff + actual; |
251 | /* VSV */ | 249 | /* VSV */ |
@@ -265,8 +263,7 @@ static void x25_asy_write_wakeup(struct tty_struct *tty) | |||
265 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) | 263 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) |
266 | return; | 264 | return; |
267 | 265 | ||
268 | if (sl->xleft <= 0) | 266 | if (sl->xleft <= 0) { |
269 | { | ||
270 | /* Now serial buffer is almost free & we can start | 267 | /* Now serial buffer is almost free & we can start |
271 | * transmission of another packet */ | 268 | * transmission of another packet */ |
272 | sl->stats.tx_packets++; | 269 | sl->stats.tx_packets++; |
@@ -275,14 +272,14 @@ static void x25_asy_write_wakeup(struct tty_struct *tty) | |||
275 | return; | 272 | return; |
276 | } | 273 | } |
277 | 274 | ||
278 | actual = tty->driver->write(tty, sl->xhead, sl->xleft); | 275 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); |
279 | sl->xleft -= actual; | 276 | sl->xleft -= actual; |
280 | sl->xhead += actual; | 277 | sl->xhead += actual; |
281 | } | 278 | } |
282 | 279 | ||
283 | static void x25_asy_timeout(struct net_device *dev) | 280 | static void x25_asy_timeout(struct net_device *dev) |
284 | { | 281 | { |
285 | struct x25_asy *sl = (struct x25_asy*)(dev->priv); | 282 | struct x25_asy *sl = dev->priv; |
286 | 283 | ||
287 | spin_lock(&sl->lock); | 284 | spin_lock(&sl->lock); |
288 | if (netif_queue_stopped(dev)) { | 285 | if (netif_queue_stopped(dev)) { |
@@ -290,7 +287,7 @@ static void x25_asy_timeout(struct net_device *dev) | |||
290 | * 14 Oct 1994 Dmitry Gorodchanin. | 287 | * 14 Oct 1994 Dmitry Gorodchanin. |
291 | */ | 288 | */ |
292 | printk(KERN_WARNING "%s: transmit timed out, %s?\n", dev->name, | 289 | printk(KERN_WARNING "%s: transmit timed out, %s?\n", dev->name, |
293 | (sl->tty->driver->chars_in_buffer(sl->tty) || sl->xleft) ? | 290 | (tty_chars_in_buffer(sl->tty) || sl->xleft) ? |
294 | "bad line quality" : "driver error"); | 291 | "bad line quality" : "driver error"); |
295 | sl->xleft = 0; | 292 | sl->xleft = 0; |
296 | sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); | 293 | sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); |
@@ -303,31 +300,34 @@ static void x25_asy_timeout(struct net_device *dev) | |||
303 | 300 | ||
304 | static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev) | 301 | static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev) |
305 | { | 302 | { |
306 | struct x25_asy *sl = (struct x25_asy*)(dev->priv); | 303 | struct x25_asy *sl = dev->priv; |
307 | int err; | 304 | int err; |
308 | 305 | ||
309 | if (!netif_running(sl->dev)) { | 306 | if (!netif_running(sl->dev)) { |
310 | printk("%s: xmit call when iface is down\n", dev->name); | 307 | printk(KERN_ERR "%s: xmit call when iface is down\n", |
308 | dev->name); | ||
311 | kfree_skb(skb); | 309 | kfree_skb(skb); |
312 | return 0; | 310 | return 0; |
313 | } | 311 | } |
314 | 312 | ||
315 | switch(skb->data[0]) | 313 | switch (skb->data[0]) { |
316 | { | 314 | case 0x00: |
317 | case 0x00:break; | 315 | break; |
318 | case 0x01: /* Connection request .. do nothing */ | 316 | case 0x01: /* Connection request .. do nothing */ |
319 | if((err=lapb_connect_request(dev))!=LAPB_OK) | 317 | err = lapb_connect_request(dev); |
320 | printk(KERN_ERR "x25_asy: lapb_connect_request error - %d\n", err); | 318 | if (err != LAPB_OK) |
321 | kfree_skb(skb); | 319 | printk(KERN_ERR "x25_asy: lapb_connect_request error - %d\n", err); |
322 | return 0; | 320 | kfree_skb(skb); |
323 | case 0x02: /* Disconnect request .. do nothing - hang up ?? */ | 321 | return 0; |
324 | if((err=lapb_disconnect_request(dev))!=LAPB_OK) | 322 | case 0x02: /* Disconnect request .. do nothing - hang up ?? */ |
325 | printk(KERN_ERR "x25_asy: lapb_disconnect_request error - %d\n", err); | 323 | err = lapb_disconnect_request(dev); |
326 | default: | 324 | if (err != LAPB_OK) |
327 | kfree_skb(skb); | 325 | printk(KERN_ERR "x25_asy: lapb_disconnect_request error - %d\n", err); |
328 | return 0; | 326 | default: |
327 | kfree_skb(skb); | ||
328 | return 0; | ||
329 | } | 329 | } |
330 | skb_pull(skb,1); /* Remove control byte */ | 330 | skb_pull(skb, 1); /* Remove control byte */ |
331 | /* | 331 | /* |
332 | * If we are busy already- too bad. We ought to be able | 332 | * If we are busy already- too bad. We ought to be able |
333 | * to queue things at this point, to allow for a little | 333 | * to queue things at this point, to allow for a little |
@@ -338,10 +338,10 @@ static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev) | |||
338 | * So, no queues ! | 338 | * So, no queues ! |
339 | * 14 Oct 1994 Dmitry Gorodchanin. | 339 | * 14 Oct 1994 Dmitry Gorodchanin. |
340 | */ | 340 | */ |
341 | 341 | ||
342 | if((err=lapb_data_request(dev,skb))!=LAPB_OK) | 342 | err = lapb_data_request(dev, skb); |
343 | { | 343 | if (err != LAPB_OK) { |
344 | printk(KERN_ERR "lapbeth: lapb_data_request error - %d\n", err); | 344 | printk(KERN_ERR "x25_asy: lapb_data_request error - %d\n", err); |
345 | kfree_skb(skb); | 345 | kfree_skb(skb); |
346 | return 0; | 346 | return 0; |
347 | } | 347 | } |
@@ -357,7 +357,7 @@ static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev) | |||
357 | * Called when I frame data arrives. We did the work above - throw it | 357 | * Called when I frame data arrives. We did the work above - throw it |
358 | * at the net layer. | 358 | * at the net layer. |
359 | */ | 359 | */ |
360 | 360 | ||
361 | static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb) | 361 | static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb) |
362 | { | 362 | { |
363 | skb->dev->last_rx = jiffies; | 363 | skb->dev->last_rx = jiffies; |
@@ -369,24 +369,22 @@ static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb) | |||
369 | * busy cases too well. Its tricky to see how to do this nicely - | 369 | * busy cases too well. Its tricky to see how to do this nicely - |
370 | * perhaps lapb should allow us to bounce this ? | 370 | * perhaps lapb should allow us to bounce this ? |
371 | */ | 371 | */ |
372 | 372 | ||
373 | static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb) | 373 | static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb) |
374 | { | 374 | { |
375 | struct x25_asy *sl=dev->priv; | 375 | struct x25_asy *sl = dev->priv; |
376 | 376 | ||
377 | spin_lock(&sl->lock); | 377 | spin_lock(&sl->lock); |
378 | if (netif_queue_stopped(sl->dev) || sl->tty == NULL) | 378 | if (netif_queue_stopped(sl->dev) || sl->tty == NULL) { |
379 | { | ||
380 | spin_unlock(&sl->lock); | 379 | spin_unlock(&sl->lock); |
381 | printk(KERN_ERR "x25_asy: tbusy drop\n"); | 380 | printk(KERN_ERR "x25_asy: tbusy drop\n"); |
382 | kfree_skb(skb); | 381 | kfree_skb(skb); |
383 | return; | 382 | return; |
384 | } | 383 | } |
385 | /* We were not busy, so we are now... :-) */ | 384 | /* We were not busy, so we are now... :-) */ |
386 | if (skb != NULL) | 385 | if (skb != NULL) { |
387 | { | ||
388 | x25_asy_lock(sl); | 386 | x25_asy_lock(sl); |
389 | sl->stats.tx_bytes+=skb->len; | 387 | sl->stats.tx_bytes += skb->len; |
390 | x25_asy_encaps(sl, skb->data, skb->len); | 388 | x25_asy_encaps(sl, skb->data, skb->len); |
391 | dev_kfree_skb(skb); | 389 | dev_kfree_skb(skb); |
392 | } | 390 | } |
@@ -396,15 +394,16 @@ static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb) | |||
396 | /* | 394 | /* |
397 | * LAPB connection establish/down information. | 395 | * LAPB connection establish/down information. |
398 | */ | 396 | */ |
399 | 397 | ||
400 | static void x25_asy_connected(struct net_device *dev, int reason) | 398 | static void x25_asy_connected(struct net_device *dev, int reason) |
401 | { | 399 | { |
402 | struct x25_asy *sl = dev->priv; | 400 | struct x25_asy *sl = dev->priv; |
403 | struct sk_buff *skb; | 401 | struct sk_buff *skb; |
404 | unsigned char *ptr; | 402 | unsigned char *ptr; |
405 | 403 | ||
406 | if ((skb = dev_alloc_skb(1)) == NULL) { | 404 | skb = dev_alloc_skb(1); |
407 | printk(KERN_ERR "lapbeth: out of memory\n"); | 405 | if (skb == NULL) { |
406 | printk(KERN_ERR "x25_asy: out of memory\n"); | ||
408 | return; | 407 | return; |
409 | } | 408 | } |
410 | 409 | ||
@@ -422,7 +421,8 @@ static void x25_asy_disconnected(struct net_device *dev, int reason) | |||
422 | struct sk_buff *skb; | 421 | struct sk_buff *skb; |
423 | unsigned char *ptr; | 422 | unsigned char *ptr; |
424 | 423 | ||
425 | if ((skb = dev_alloc_skb(1)) == NULL) { | 424 | skb = dev_alloc_skb(1); |
425 | if (skb == NULL) { | ||
426 | printk(KERN_ERR "x25_asy: out of memory\n"); | 426 | printk(KERN_ERR "x25_asy: out of memory\n"); |
427 | return; | 427 | return; |
428 | } | 428 | } |
@@ -449,7 +449,7 @@ static struct lapb_register_struct x25_asy_callbacks = { | |||
449 | /* Open the low-level part of the X.25 channel. Easy! */ | 449 | /* Open the low-level part of the X.25 channel. Easy! */ |
450 | static int x25_asy_open(struct net_device *dev) | 450 | static int x25_asy_open(struct net_device *dev) |
451 | { | 451 | { |
452 | struct x25_asy *sl = (struct x25_asy*)(dev->priv); | 452 | struct x25_asy *sl = dev->priv; |
453 | unsigned long len; | 453 | unsigned long len; |
454 | int err; | 454 | int err; |
455 | 455 | ||
@@ -466,13 +466,11 @@ static int x25_asy_open(struct net_device *dev) | |||
466 | len = dev->mtu * 2; | 466 | len = dev->mtu * 2; |
467 | 467 | ||
468 | sl->rbuff = kmalloc(len + 4, GFP_KERNEL); | 468 | sl->rbuff = kmalloc(len + 4, GFP_KERNEL); |
469 | if (sl->rbuff == NULL) { | 469 | if (sl->rbuff == NULL) |
470 | goto norbuff; | 470 | goto norbuff; |
471 | } | ||
472 | sl->xbuff = kmalloc(len + 4, GFP_KERNEL); | 471 | sl->xbuff = kmalloc(len + 4, GFP_KERNEL); |
473 | if (sl->xbuff == NULL) { | 472 | if (sl->xbuff == NULL) |
474 | goto noxbuff; | 473 | goto noxbuff; |
475 | } | ||
476 | 474 | ||
477 | sl->buffsize = len; | 475 | sl->buffsize = len; |
478 | sl->rcount = 0; | 476 | sl->rcount = 0; |
@@ -480,11 +478,12 @@ static int x25_asy_open(struct net_device *dev) | |||
480 | sl->flags &= (1 << SLF_INUSE); /* Clear ESCAPE & ERROR flags */ | 478 | sl->flags &= (1 << SLF_INUSE); /* Clear ESCAPE & ERROR flags */ |
481 | 479 | ||
482 | netif_start_queue(dev); | 480 | netif_start_queue(dev); |
483 | 481 | ||
484 | /* | 482 | /* |
485 | * Now attach LAPB | 483 | * Now attach LAPB |
486 | */ | 484 | */ |
487 | if((err=lapb_register(dev, &x25_asy_callbacks))==LAPB_OK) | 485 | err = lapb_register(dev, &x25_asy_callbacks); |
486 | if (err == LAPB_OK) | ||
488 | return 0; | 487 | return 0; |
489 | 488 | ||
490 | /* Cleanup */ | 489 | /* Cleanup */ |
@@ -499,18 +498,20 @@ norbuff: | |||
499 | /* Close the low-level part of the X.25 channel. Easy! */ | 498 | /* Close the low-level part of the X.25 channel. Easy! */ |
500 | static int x25_asy_close(struct net_device *dev) | 499 | static int x25_asy_close(struct net_device *dev) |
501 | { | 500 | { |
502 | struct x25_asy *sl = (struct x25_asy*)(dev->priv); | 501 | struct x25_asy *sl = dev->priv; |
503 | int err; | 502 | int err; |
504 | 503 | ||
505 | spin_lock(&sl->lock); | 504 | spin_lock(&sl->lock); |
506 | if (sl->tty) | 505 | if (sl->tty) |
507 | sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); | 506 | sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); |
508 | 507 | ||
509 | netif_stop_queue(dev); | 508 | netif_stop_queue(dev); |
510 | sl->rcount = 0; | 509 | sl->rcount = 0; |
511 | sl->xleft = 0; | 510 | sl->xleft = 0; |
512 | if((err=lapb_unregister(dev))!=LAPB_OK) | 511 | err = lapb_unregister(dev); |
513 | printk(KERN_ERR "x25_asy_close: lapb_unregister error -%d\n",err); | 512 | if (err != LAPB_OK) |
513 | printk(KERN_ERR "x25_asy_close: lapb_unregister error -%d\n", | ||
514 | err); | ||
514 | spin_unlock(&sl->lock); | 515 | spin_unlock(&sl->lock); |
515 | return 0; | 516 | return 0; |
516 | } | 517 | } |
@@ -521,8 +522,9 @@ static int x25_asy_close(struct net_device *dev) | |||
521 | * a block of X.25 data has been received, which can now be decapsulated | 522 | * a block of X.25 data has been received, which can now be decapsulated |
522 | * and sent on to some IP layer for further processing. | 523 | * and sent on to some IP layer for further processing. |
523 | */ | 524 | */ |
524 | 525 | ||
525 | static void x25_asy_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) | 526 | static void x25_asy_receive_buf(struct tty_struct *tty, |
527 | const unsigned char *cp, char *fp, int count) | ||
526 | { | 528 | { |
527 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; | 529 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; |
528 | 530 | ||
@@ -533,9 +535,8 @@ static void x25_asy_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
533 | /* Read the characters out of the buffer */ | 535 | /* Read the characters out of the buffer */ |
534 | while (count--) { | 536 | while (count--) { |
535 | if (fp && *fp++) { | 537 | if (fp && *fp++) { |
536 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) { | 538 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) |
537 | sl->stats.rx_errors++; | 539 | sl->stats.rx_errors++; |
538 | } | ||
539 | cp++; | 540 | cp++; |
540 | continue; | 541 | continue; |
541 | } | 542 | } |
@@ -556,31 +557,31 @@ static int x25_asy_open_tty(struct tty_struct *tty) | |||
556 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; | 557 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; |
557 | int err; | 558 | int err; |
558 | 559 | ||
560 | if (tty->ops->write == NULL) | ||
561 | return -EOPNOTSUPP; | ||
562 | |||
559 | /* First make sure we're not already connected. */ | 563 | /* First make sure we're not already connected. */ |
560 | if (sl && sl->magic == X25_ASY_MAGIC) { | 564 | if (sl && sl->magic == X25_ASY_MAGIC) |
561 | return -EEXIST; | 565 | return -EEXIST; |
562 | } | ||
563 | 566 | ||
564 | /* OK. Find a free X.25 channel to use. */ | 567 | /* OK. Find a free X.25 channel to use. */ |
565 | if ((sl = x25_asy_alloc()) == NULL) { | 568 | sl = x25_asy_alloc(); |
569 | if (sl == NULL) | ||
566 | return -ENFILE; | 570 | return -ENFILE; |
567 | } | ||
568 | 571 | ||
569 | sl->tty = tty; | 572 | sl->tty = tty; |
570 | tty->disc_data = sl; | 573 | tty->disc_data = sl; |
571 | tty->receive_room = 65536; | 574 | tty->receive_room = 65536; |
572 | if (tty->driver->flush_buffer) { | 575 | tty_driver_flush_buffer(tty); |
573 | tty->driver->flush_buffer(tty); | ||
574 | } | ||
575 | tty_ldisc_flush(tty); | 576 | tty_ldisc_flush(tty); |
576 | 577 | ||
577 | /* Restore default settings */ | 578 | /* Restore default settings */ |
578 | sl->dev->type = ARPHRD_X25; | 579 | sl->dev->type = ARPHRD_X25; |
579 | 580 | ||
580 | /* Perform the low-level X.25 async init */ | 581 | /* Perform the low-level X.25 async init */ |
581 | if ((err = x25_asy_open(sl->dev))) | 582 | err = x25_asy_open(sl->dev); |
583 | if (err) | ||
582 | return err; | 584 | return err; |
583 | |||
584 | /* Done. We have linked the TTY line to a channel. */ | 585 | /* Done. We have linked the TTY line to a channel. */ |
585 | return sl->dev->base_addr; | 586 | return sl->dev->base_addr; |
586 | } | 587 | } |
@@ -601,9 +602,7 @@ static void x25_asy_close_tty(struct tty_struct *tty) | |||
601 | return; | 602 | return; |
602 | 603 | ||
603 | if (sl->dev->flags & IFF_UP) | 604 | if (sl->dev->flags & IFF_UP) |
604 | { | 605 | dev_close(sl->dev); |
605 | (void) dev_close(sl->dev); | ||
606 | } | ||
607 | 606 | ||
608 | tty->disc_data = NULL; | 607 | tty->disc_data = NULL; |
609 | sl->tty = NULL; | 608 | sl->tty = NULL; |
@@ -613,8 +612,7 @@ static void x25_asy_close_tty(struct tty_struct *tty) | |||
613 | 612 | ||
614 | static struct net_device_stats *x25_asy_get_stats(struct net_device *dev) | 613 | static struct net_device_stats *x25_asy_get_stats(struct net_device *dev) |
615 | { | 614 | { |
616 | struct x25_asy *sl = (struct x25_asy*)(dev->priv); | 615 | struct x25_asy *sl = dev->priv; |
617 | |||
618 | return &sl->stats; | 616 | return &sl->stats; |
619 | } | 617 | } |
620 | 618 | ||
@@ -641,21 +639,19 @@ int x25_asy_esc(unsigned char *s, unsigned char *d, int len) | |||
641 | * character sequence, according to the X.25 protocol. | 639 | * character sequence, according to the X.25 protocol. |
642 | */ | 640 | */ |
643 | 641 | ||
644 | while (len-- > 0) | 642 | while (len-- > 0) { |
645 | { | 643 | switch (c = *s++) { |
646 | switch(c = *s++) | 644 | case X25_END: |
647 | { | 645 | *ptr++ = X25_ESC; |
648 | case X25_END: | 646 | *ptr++ = X25_ESCAPE(X25_END); |
649 | *ptr++ = X25_ESC; | 647 | break; |
650 | *ptr++ = X25_ESCAPE(X25_END); | 648 | case X25_ESC: |
651 | break; | 649 | *ptr++ = X25_ESC; |
652 | case X25_ESC: | 650 | *ptr++ = X25_ESCAPE(X25_ESC); |
653 | *ptr++ = X25_ESC; | 651 | break; |
654 | *ptr++ = X25_ESCAPE(X25_ESC); | 652 | default: |
655 | break; | 653 | *ptr++ = c; |
656 | default: | 654 | break; |
657 | *ptr++ = c; | ||
658 | break; | ||
659 | } | 655 | } |
660 | } | 656 | } |
661 | *ptr++ = X25_END; | 657 | *ptr++ = X25_END; |
@@ -665,31 +661,25 @@ int x25_asy_esc(unsigned char *s, unsigned char *d, int len) | |||
665 | static void x25_asy_unesc(struct x25_asy *sl, unsigned char s) | 661 | static void x25_asy_unesc(struct x25_asy *sl, unsigned char s) |
666 | { | 662 | { |
667 | 663 | ||
668 | switch(s) | 664 | switch (s) { |
669 | { | 665 | case X25_END: |
670 | case X25_END: | 666 | if (!test_and_clear_bit(SLF_ERROR, &sl->flags) |
671 | if (!test_and_clear_bit(SLF_ERROR, &sl->flags) && (sl->rcount > 2)) | 667 | && sl->rcount > 2) |
672 | { | 668 | x25_asy_bump(sl); |
673 | x25_asy_bump(sl); | 669 | clear_bit(SLF_ESCAPE, &sl->flags); |
674 | } | 670 | sl->rcount = 0; |
675 | clear_bit(SLF_ESCAPE, &sl->flags); | 671 | return; |
676 | sl->rcount = 0; | 672 | case X25_ESC: |
677 | return; | 673 | set_bit(SLF_ESCAPE, &sl->flags); |
678 | 674 | return; | |
679 | case X25_ESC: | 675 | case X25_ESCAPE(X25_ESC): |
680 | set_bit(SLF_ESCAPE, &sl->flags); | 676 | case X25_ESCAPE(X25_END): |
681 | return; | 677 | if (test_and_clear_bit(SLF_ESCAPE, &sl->flags)) |
682 | 678 | s = X25_UNESCAPE(s); | |
683 | case X25_ESCAPE(X25_ESC): | 679 | break; |
684 | case X25_ESCAPE(X25_END): | 680 | } |
685 | if (test_and_clear_bit(SLF_ESCAPE, &sl->flags)) | 681 | if (!test_bit(SLF_ERROR, &sl->flags)) { |
686 | s = X25_UNESCAPE(s); | 682 | if (sl->rcount < sl->buffsize) { |
687 | break; | ||
688 | } | ||
689 | if (!test_bit(SLF_ERROR, &sl->flags)) | ||
690 | { | ||
691 | if (sl->rcount < sl->buffsize) | ||
692 | { | ||
693 | sl->rbuff[sl->rcount++] = s; | 683 | sl->rbuff[sl->rcount++] = s; |
694 | return; | 684 | return; |
695 | } | 685 | } |
@@ -709,7 +699,7 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file, | |||
709 | if (!sl || sl->magic != X25_ASY_MAGIC) | 699 | if (!sl || sl->magic != X25_ASY_MAGIC) |
710 | return -EINVAL; | 700 | return -EINVAL; |
711 | 701 | ||
712 | switch(cmd) { | 702 | switch (cmd) { |
713 | case SIOCGIFNAME: | 703 | case SIOCGIFNAME: |
714 | if (copy_to_user((void __user *)arg, sl->dev->name, | 704 | if (copy_to_user((void __user *)arg, sl->dev->name, |
715 | strlen(sl->dev->name) + 1)) | 705 | strlen(sl->dev->name) + 1)) |
@@ -724,8 +714,8 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file, | |||
724 | 714 | ||
725 | static int x25_asy_open_dev(struct net_device *dev) | 715 | static int x25_asy_open_dev(struct net_device *dev) |
726 | { | 716 | { |
727 | struct x25_asy *sl = (struct x25_asy*)(dev->priv); | 717 | struct x25_asy *sl = dev->priv; |
728 | if(sl->tty==NULL) | 718 | if (sl->tty == NULL) |
729 | return -ENODEV; | 719 | return -ENODEV; |
730 | return 0; | 720 | return 0; |
731 | } | 721 | } |
@@ -741,9 +731,9 @@ static void x25_asy_setup(struct net_device *dev) | |||
741 | set_bit(SLF_INUSE, &sl->flags); | 731 | set_bit(SLF_INUSE, &sl->flags); |
742 | 732 | ||
743 | /* | 733 | /* |
744 | * Finish setting up the DEVICE info. | 734 | * Finish setting up the DEVICE info. |
745 | */ | 735 | */ |
746 | 736 | ||
747 | dev->mtu = SL_MTU; | 737 | dev->mtu = SL_MTU; |
748 | dev->hard_start_xmit = x25_asy_xmit; | 738 | dev->hard_start_xmit = x25_asy_xmit; |
749 | dev->tx_timeout = x25_asy_timeout; | 739 | dev->tx_timeout = x25_asy_timeout; |
@@ -778,9 +768,10 @@ static int __init init_x25_asy(void) | |||
778 | x25_asy_maxdev = 4; /* Sanity */ | 768 | x25_asy_maxdev = 4; /* Sanity */ |
779 | 769 | ||
780 | printk(KERN_INFO "X.25 async: version 0.00 ALPHA " | 770 | printk(KERN_INFO "X.25 async: version 0.00 ALPHA " |
781 | "(dynamic channels, max=%d).\n", x25_asy_maxdev ); | 771 | "(dynamic channels, max=%d).\n", x25_asy_maxdev); |
782 | 772 | ||
783 | x25_asy_devs = kcalloc(x25_asy_maxdev, sizeof(struct net_device*), GFP_KERNEL); | 773 | x25_asy_devs = kcalloc(x25_asy_maxdev, sizeof(struct net_device *), |
774 | GFP_KERNEL); | ||
784 | if (!x25_asy_devs) { | 775 | if (!x25_asy_devs) { |
785 | printk(KERN_WARNING "X25 async: Can't allocate x25_asy_ctrls[] " | 776 | printk(KERN_WARNING "X25 async: Can't allocate x25_asy_ctrls[] " |
786 | "array! Uaargh! (-> No X.25 available)\n"); | 777 | "array! Uaargh! (-> No X.25 available)\n"); |
@@ -802,7 +793,7 @@ static void __exit exit_x25_asy(void) | |||
802 | struct x25_asy *sl = dev->priv; | 793 | struct x25_asy *sl = dev->priv; |
803 | 794 | ||
804 | spin_lock_bh(&sl->lock); | 795 | spin_lock_bh(&sl->lock); |
805 | if (sl->tty) | 796 | if (sl->tty) |
806 | tty_hangup(sl->tty); | 797 | tty_hangup(sl->tty); |
807 | 798 | ||
808 | spin_unlock_bh(&sl->lock); | 799 | spin_unlock_bh(&sl->lock); |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 932d6b1c9d0b..45f47c1c0a35 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -3657,7 +3657,7 @@ void mpi_receive_802_11 (struct airo_info *ai) | |||
3657 | ptr += hdrlen; | 3657 | ptr += hdrlen; |
3658 | if (hdrlen == 24) | 3658 | if (hdrlen == 24) |
3659 | ptr += 6; | 3659 | ptr += 6; |
3660 | gap = le16_to_cpu(get_unaligned((__le16 *)ptr)); | 3660 | gap = get_unaligned_le16(ptr); |
3661 | ptr += sizeof(__le16); | 3661 | ptr += sizeof(__le16); |
3662 | if (gap) { | 3662 | if (gap) { |
3663 | if (gap <= 8) | 3663 | if (gap <= 8) |
@@ -4347,24 +4347,28 @@ static int proc_config_open( struct inode *inode, struct file *file ); | |||
4347 | static int proc_wepkey_open( struct inode *inode, struct file *file ); | 4347 | static int proc_wepkey_open( struct inode *inode, struct file *file ); |
4348 | 4348 | ||
4349 | static const struct file_operations proc_statsdelta_ops = { | 4349 | static const struct file_operations proc_statsdelta_ops = { |
4350 | .owner = THIS_MODULE, | ||
4350 | .read = proc_read, | 4351 | .read = proc_read, |
4351 | .open = proc_statsdelta_open, | 4352 | .open = proc_statsdelta_open, |
4352 | .release = proc_close | 4353 | .release = proc_close |
4353 | }; | 4354 | }; |
4354 | 4355 | ||
4355 | static const struct file_operations proc_stats_ops = { | 4356 | static const struct file_operations proc_stats_ops = { |
4357 | .owner = THIS_MODULE, | ||
4356 | .read = proc_read, | 4358 | .read = proc_read, |
4357 | .open = proc_stats_open, | 4359 | .open = proc_stats_open, |
4358 | .release = proc_close | 4360 | .release = proc_close |
4359 | }; | 4361 | }; |
4360 | 4362 | ||
4361 | static const struct file_operations proc_status_ops = { | 4363 | static const struct file_operations proc_status_ops = { |
4364 | .owner = THIS_MODULE, | ||
4362 | .read = proc_read, | 4365 | .read = proc_read, |
4363 | .open = proc_status_open, | 4366 | .open = proc_status_open, |
4364 | .release = proc_close | 4367 | .release = proc_close |
4365 | }; | 4368 | }; |
4366 | 4369 | ||
4367 | static const struct file_operations proc_SSID_ops = { | 4370 | static const struct file_operations proc_SSID_ops = { |
4371 | .owner = THIS_MODULE, | ||
4368 | .read = proc_read, | 4372 | .read = proc_read, |
4369 | .write = proc_write, | 4373 | .write = proc_write, |
4370 | .open = proc_SSID_open, | 4374 | .open = proc_SSID_open, |
@@ -4372,6 +4376,7 @@ static const struct file_operations proc_SSID_ops = { | |||
4372 | }; | 4376 | }; |
4373 | 4377 | ||
4374 | static const struct file_operations proc_BSSList_ops = { | 4378 | static const struct file_operations proc_BSSList_ops = { |
4379 | .owner = THIS_MODULE, | ||
4375 | .read = proc_read, | 4380 | .read = proc_read, |
4376 | .write = proc_write, | 4381 | .write = proc_write, |
4377 | .open = proc_BSSList_open, | 4382 | .open = proc_BSSList_open, |
@@ -4379,6 +4384,7 @@ static const struct file_operations proc_BSSList_ops = { | |||
4379 | }; | 4384 | }; |
4380 | 4385 | ||
4381 | static const struct file_operations proc_APList_ops = { | 4386 | static const struct file_operations proc_APList_ops = { |
4387 | .owner = THIS_MODULE, | ||
4382 | .read = proc_read, | 4388 | .read = proc_read, |
4383 | .write = proc_write, | 4389 | .write = proc_write, |
4384 | .open = proc_APList_open, | 4390 | .open = proc_APList_open, |
@@ -4386,6 +4392,7 @@ static const struct file_operations proc_APList_ops = { | |||
4386 | }; | 4392 | }; |
4387 | 4393 | ||
4388 | static const struct file_operations proc_config_ops = { | 4394 | static const struct file_operations proc_config_ops = { |
4395 | .owner = THIS_MODULE, | ||
4389 | .read = proc_read, | 4396 | .read = proc_read, |
4390 | .write = proc_write, | 4397 | .write = proc_write, |
4391 | .open = proc_config_open, | 4398 | .open = proc_config_open, |
@@ -4393,6 +4400,7 @@ static const struct file_operations proc_config_ops = { | |||
4393 | }; | 4400 | }; |
4394 | 4401 | ||
4395 | static const struct file_operations proc_wepkey_ops = { | 4402 | static const struct file_operations proc_wepkey_ops = { |
4403 | .owner = THIS_MODULE, | ||
4396 | .read = proc_read, | 4404 | .read = proc_read, |
4397 | .write = proc_write, | 4405 | .write = proc_write, |
4398 | .open = proc_wepkey_open, | 4406 | .open = proc_wepkey_open, |
@@ -4411,10 +4419,6 @@ struct proc_data { | |||
4411 | void (*on_close) (struct inode *, struct file *); | 4419 | void (*on_close) (struct inode *, struct file *); |
4412 | }; | 4420 | }; |
4413 | 4421 | ||
4414 | #ifndef SETPROC_OPS | ||
4415 | #define SETPROC_OPS(entry, ops) (entry)->proc_fops = &(ops) | ||
4416 | #endif | ||
4417 | |||
4418 | static int setup_proc_entry( struct net_device *dev, | 4422 | static int setup_proc_entry( struct net_device *dev, |
4419 | struct airo_info *apriv ) { | 4423 | struct airo_info *apriv ) { |
4420 | struct proc_dir_entry *entry; | 4424 | struct proc_dir_entry *entry; |
@@ -4430,100 +4434,76 @@ static int setup_proc_entry( struct net_device *dev, | |||
4430 | apriv->proc_entry->owner = THIS_MODULE; | 4434 | apriv->proc_entry->owner = THIS_MODULE; |
4431 | 4435 | ||
4432 | /* Setup the StatsDelta */ | 4436 | /* Setup the StatsDelta */ |
4433 | entry = create_proc_entry("StatsDelta", | 4437 | entry = proc_create_data("StatsDelta", |
4434 | S_IFREG | (S_IRUGO&proc_perm), | 4438 | S_IFREG | (S_IRUGO&proc_perm), |
4435 | apriv->proc_entry); | 4439 | apriv->proc_entry, &proc_statsdelta_ops, dev); |
4436 | if (!entry) | 4440 | if (!entry) |
4437 | goto fail_stats_delta; | 4441 | goto fail_stats_delta; |
4438 | entry->uid = proc_uid; | 4442 | entry->uid = proc_uid; |
4439 | entry->gid = proc_gid; | 4443 | entry->gid = proc_gid; |
4440 | entry->data = dev; | ||
4441 | entry->owner = THIS_MODULE; | ||
4442 | SETPROC_OPS(entry, proc_statsdelta_ops); | ||
4443 | 4444 | ||
4444 | /* Setup the Stats */ | 4445 | /* Setup the Stats */ |
4445 | entry = create_proc_entry("Stats", | 4446 | entry = proc_create_data("Stats", |
4446 | S_IFREG | (S_IRUGO&proc_perm), | 4447 | S_IFREG | (S_IRUGO&proc_perm), |
4447 | apriv->proc_entry); | 4448 | apriv->proc_entry, &proc_stats_ops, dev); |
4448 | if (!entry) | 4449 | if (!entry) |
4449 | goto fail_stats; | 4450 | goto fail_stats; |
4450 | entry->uid = proc_uid; | 4451 | entry->uid = proc_uid; |
4451 | entry->gid = proc_gid; | 4452 | entry->gid = proc_gid; |
4452 | entry->data = dev; | ||
4453 | entry->owner = THIS_MODULE; | ||
4454 | SETPROC_OPS(entry, proc_stats_ops); | ||
4455 | 4453 | ||
4456 | /* Setup the Status */ | 4454 | /* Setup the Status */ |
4457 | entry = create_proc_entry("Status", | 4455 | entry = proc_create_data("Status", |
4458 | S_IFREG | (S_IRUGO&proc_perm), | 4456 | S_IFREG | (S_IRUGO&proc_perm), |
4459 | apriv->proc_entry); | 4457 | apriv->proc_entry, &proc_status_ops, dev); |
4460 | if (!entry) | 4458 | if (!entry) |
4461 | goto fail_status; | 4459 | goto fail_status; |
4462 | entry->uid = proc_uid; | 4460 | entry->uid = proc_uid; |
4463 | entry->gid = proc_gid; | 4461 | entry->gid = proc_gid; |
4464 | entry->data = dev; | ||
4465 | entry->owner = THIS_MODULE; | ||
4466 | SETPROC_OPS(entry, proc_status_ops); | ||
4467 | 4462 | ||
4468 | /* Setup the Config */ | 4463 | /* Setup the Config */ |
4469 | entry = create_proc_entry("Config", | 4464 | entry = proc_create_data("Config", |
4470 | S_IFREG | proc_perm, | 4465 | S_IFREG | proc_perm, |
4471 | apriv->proc_entry); | 4466 | apriv->proc_entry, &proc_config_ops, dev); |
4472 | if (!entry) | 4467 | if (!entry) |
4473 | goto fail_config; | 4468 | goto fail_config; |
4474 | entry->uid = proc_uid; | 4469 | entry->uid = proc_uid; |
4475 | entry->gid = proc_gid; | 4470 | entry->gid = proc_gid; |
4476 | entry->data = dev; | ||
4477 | entry->owner = THIS_MODULE; | ||
4478 | SETPROC_OPS(entry, proc_config_ops); | ||
4479 | 4471 | ||
4480 | /* Setup the SSID */ | 4472 | /* Setup the SSID */ |
4481 | entry = create_proc_entry("SSID", | 4473 | entry = proc_create_data("SSID", |
4482 | S_IFREG | proc_perm, | 4474 | S_IFREG | proc_perm, |
4483 | apriv->proc_entry); | 4475 | apriv->proc_entry, &proc_SSID_ops, dev); |
4484 | if (!entry) | 4476 | if (!entry) |
4485 | goto fail_ssid; | 4477 | goto fail_ssid; |
4486 | entry->uid = proc_uid; | 4478 | entry->uid = proc_uid; |
4487 | entry->gid = proc_gid; | 4479 | entry->gid = proc_gid; |
4488 | entry->data = dev; | ||
4489 | entry->owner = THIS_MODULE; | ||
4490 | SETPROC_OPS(entry, proc_SSID_ops); | ||
4491 | 4480 | ||
4492 | /* Setup the APList */ | 4481 | /* Setup the APList */ |
4493 | entry = create_proc_entry("APList", | 4482 | entry = proc_create_data("APList", |
4494 | S_IFREG | proc_perm, | 4483 | S_IFREG | proc_perm, |
4495 | apriv->proc_entry); | 4484 | apriv->proc_entry, &proc_APList_ops, dev); |
4496 | if (!entry) | 4485 | if (!entry) |
4497 | goto fail_aplist; | 4486 | goto fail_aplist; |
4498 | entry->uid = proc_uid; | 4487 | entry->uid = proc_uid; |
4499 | entry->gid = proc_gid; | 4488 | entry->gid = proc_gid; |
4500 | entry->data = dev; | ||
4501 | entry->owner = THIS_MODULE; | ||
4502 | SETPROC_OPS(entry, proc_APList_ops); | ||
4503 | 4489 | ||
4504 | /* Setup the BSSList */ | 4490 | /* Setup the BSSList */ |
4505 | entry = create_proc_entry("BSSList", | 4491 | entry = proc_create_data("BSSList", |
4506 | S_IFREG | proc_perm, | 4492 | S_IFREG | proc_perm, |
4507 | apriv->proc_entry); | 4493 | apriv->proc_entry, &proc_BSSList_ops, dev); |
4508 | if (!entry) | 4494 | if (!entry) |
4509 | goto fail_bsslist; | 4495 | goto fail_bsslist; |
4510 | entry->uid = proc_uid; | 4496 | entry->uid = proc_uid; |
4511 | entry->gid = proc_gid; | 4497 | entry->gid = proc_gid; |
4512 | entry->data = dev; | ||
4513 | entry->owner = THIS_MODULE; | ||
4514 | SETPROC_OPS(entry, proc_BSSList_ops); | ||
4515 | 4498 | ||
4516 | /* Setup the WepKey */ | 4499 | /* Setup the WepKey */ |
4517 | entry = create_proc_entry("WepKey", | 4500 | entry = proc_create_data("WepKey", |
4518 | S_IFREG | proc_perm, | 4501 | S_IFREG | proc_perm, |
4519 | apriv->proc_entry); | 4502 | apriv->proc_entry, &proc_wepkey_ops, dev); |
4520 | if (!entry) | 4503 | if (!entry) |
4521 | goto fail_wepkey; | 4504 | goto fail_wepkey; |
4522 | entry->uid = proc_uid; | 4505 | entry->uid = proc_uid; |
4523 | entry->gid = proc_gid; | 4506 | entry->gid = proc_gid; |
4524 | entry->data = dev; | ||
4525 | entry->owner = THIS_MODULE; | ||
4526 | SETPROC_OPS(entry, proc_wepkey_ops); | ||
4527 | 4507 | ||
4528 | return 0; | 4508 | return 0; |
4529 | 4509 | ||
@@ -5625,9 +5605,9 @@ static int __init airo_init_module( void ) | |||
5625 | int have_isa_dev = 0; | 5605 | int have_isa_dev = 0; |
5626 | #endif | 5606 | #endif |
5627 | 5607 | ||
5628 | airo_entry = create_proc_entry("aironet", | 5608 | airo_entry = create_proc_entry("driver/aironet", |
5629 | S_IFDIR | airo_perm, | 5609 | S_IFDIR | airo_perm, |
5630 | proc_root_driver); | 5610 | NULL); |
5631 | 5611 | ||
5632 | if (airo_entry) { | 5612 | if (airo_entry) { |
5633 | airo_entry->uid = proc_uid; | 5613 | airo_entry->uid = proc_uid; |
@@ -5651,7 +5631,7 @@ static int __init airo_init_module( void ) | |||
5651 | airo_print_info("", "Finished probing for PCI adapters"); | 5631 | airo_print_info("", "Finished probing for PCI adapters"); |
5652 | 5632 | ||
5653 | if (i) { | 5633 | if (i) { |
5654 | remove_proc_entry("aironet", proc_root_driver); | 5634 | remove_proc_entry("driver/aironet", NULL); |
5655 | return i; | 5635 | return i; |
5656 | } | 5636 | } |
5657 | #endif | 5637 | #endif |
@@ -5673,7 +5653,7 @@ static void __exit airo_cleanup_module( void ) | |||
5673 | #ifdef CONFIG_PCI | 5653 | #ifdef CONFIG_PCI |
5674 | pci_unregister_driver(&airo_driver); | 5654 | pci_unregister_driver(&airo_driver); |
5675 | #endif | 5655 | #endif |
5676 | remove_proc_entry("aironet", proc_root_driver); | 5656 | remove_proc_entry("driver/aironet", NULL); |
5677 | } | 5657 | } |
5678 | 5658 | ||
5679 | /* | 5659 | /* |
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index e18305b781c9..4e5c8fc35200 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c | |||
@@ -58,10 +58,6 @@ | |||
58 | #include "reg.h" | 58 | #include "reg.h" |
59 | #include "debug.h" | 59 | #include "debug.h" |
60 | 60 | ||
61 | /* unaligned little endian access */ | ||
62 | #define LE_READ_2(_p) (le16_to_cpu(get_unaligned((__le16 *)(_p)))) | ||
63 | #define LE_READ_4(_p) (le32_to_cpu(get_unaligned((__le32 *)(_p)))) | ||
64 | |||
65 | enum { | 61 | enum { |
66 | ATH_LED_TX, | 62 | ATH_LED_TX, |
67 | ATH_LED_RX, | 63 | ATH_LED_RX, |
@@ -2909,9 +2905,9 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw, | |||
2909 | if (!mclist) | 2905 | if (!mclist) |
2910 | break; | 2906 | break; |
2911 | /* calculate XOR of eight 6-bit values */ | 2907 | /* calculate XOR of eight 6-bit values */ |
2912 | val = LE_READ_4(mclist->dmi_addr + 0); | 2908 | val = get_unaligned_le32(mclist->dmi_addr + 0); |
2913 | pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; | 2909 | pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; |
2914 | val = LE_READ_4(mclist->dmi_addr + 3); | 2910 | val = get_unaligned_le32(mclist->dmi_addr + 3); |
2915 | pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; | 2911 | pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; |
2916 | pos &= 0x3f; | 2912 | pos &= 0x3f; |
2917 | mfilt[pos / 32] |= (1 << (pos % 32)); | 2913 | mfilt[pos / 32] |= (1 << (pos % 32)); |
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c index 0aac1ff511df..36a9c42df835 100644 --- a/drivers/net/wireless/b43/leds.c +++ b/drivers/net/wireless/b43/leds.c | |||
@@ -116,10 +116,7 @@ static void b43_unregister_led(struct b43_led *led) | |||
116 | { | 116 | { |
117 | if (!led->dev) | 117 | if (!led->dev) |
118 | return; | 118 | return; |
119 | if (led->dev->suspend_in_progress) | 119 | led_classdev_unregister(&led->led_dev); |
120 | led_classdev_unregister_suspended(&led->led_dev); | ||
121 | else | ||
122 | led_classdev_unregister(&led->led_dev); | ||
123 | b43_led_turn_off(led->dev, led->index, led->activelow); | 120 | b43_led_turn_off(led->dev, led->index, led->activelow); |
124 | led->dev = NULL; | 121 | led->dev = NULL; |
125 | } | 122 | } |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 94a0cdeb39a8..8c24cd72aaca 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -2171,7 +2171,7 @@ static int b43_write_initvals(struct b43_wldev *dev, | |||
2171 | goto err_format; | 2171 | goto err_format; |
2172 | array_size -= sizeof(iv->data.d32); | 2172 | array_size -= sizeof(iv->data.d32); |
2173 | 2173 | ||
2174 | value = be32_to_cpu(get_unaligned(&iv->data.d32)); | 2174 | value = get_unaligned_be32(&iv->data.d32); |
2175 | b43_write32(dev, offset, value); | 2175 | b43_write32(dev, offset, value); |
2176 | 2176 | ||
2177 | iv = (const struct b43_iv *)((const uint8_t *)iv + | 2177 | iv = (const struct b43_iv *)((const uint8_t *)iv + |
@@ -2808,10 +2808,10 @@ static int b43_rng_read(struct hwrng *rng, u32 * data) | |||
2808 | return (sizeof(u16)); | 2808 | return (sizeof(u16)); |
2809 | } | 2809 | } |
2810 | 2810 | ||
2811 | static void b43_rng_exit(struct b43_wl *wl, bool suspended) | 2811 | static void b43_rng_exit(struct b43_wl *wl) |
2812 | { | 2812 | { |
2813 | if (wl->rng_initialized) | 2813 | if (wl->rng_initialized) |
2814 | __hwrng_unregister(&wl->rng, suspended); | 2814 | hwrng_unregister(&wl->rng); |
2815 | } | 2815 | } |
2816 | 2816 | ||
2817 | static int b43_rng_init(struct b43_wl *wl) | 2817 | static int b43_rng_init(struct b43_wl *wl) |
@@ -3832,7 +3832,7 @@ static void b43_wireless_core_exit(struct b43_wldev *dev) | |||
3832 | 3832 | ||
3833 | if (!dev->suspend_in_progress) { | 3833 | if (!dev->suspend_in_progress) { |
3834 | b43_leds_exit(dev); | 3834 | b43_leds_exit(dev); |
3835 | b43_rng_exit(dev->wl, false); | 3835 | b43_rng_exit(dev->wl); |
3836 | } | 3836 | } |
3837 | b43_dma_free(dev); | 3837 | b43_dma_free(dev); |
3838 | b43_pio_free(dev); | 3838 | b43_pio_free(dev); |
@@ -4613,7 +4613,7 @@ static int b43_resume(struct ssb_device *dev) | |||
4613 | err = b43_wireless_core_start(wldev); | 4613 | err = b43_wireless_core_start(wldev); |
4614 | if (err) { | 4614 | if (err) { |
4615 | b43_leds_exit(wldev); | 4615 | b43_leds_exit(wldev); |
4616 | b43_rng_exit(wldev->wl, true); | 4616 | b43_rng_exit(wldev->wl); |
4617 | b43_wireless_core_exit(wldev); | 4617 | b43_wireless_core_exit(wldev); |
4618 | b43err(wl, "Resume failed at core start\n"); | 4618 | b43err(wl, "Resume failed at core start\n"); |
4619 | goto out; | 4619 | goto out; |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index ef829ee8ffd4..14a5eea2573e 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -1720,7 +1720,7 @@ static int b43legacy_write_initvals(struct b43legacy_wldev *dev, | |||
1720 | goto err_format; | 1720 | goto err_format; |
1721 | array_size -= sizeof(iv->data.d32); | 1721 | array_size -= sizeof(iv->data.d32); |
1722 | 1722 | ||
1723 | value = be32_to_cpu(get_unaligned(&iv->data.d32)); | 1723 | value = get_unaligned_be32(&iv->data.d32); |
1724 | b43legacy_write32(dev, offset, value); | 1724 | b43legacy_write32(dev, offset, value); |
1725 | 1725 | ||
1726 | iv = (const struct b43legacy_iv *)((const uint8_t *)iv + | 1726 | iv = (const struct b43legacy_iv *)((const uint8_t *)iv + |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 598e4eef4f40..d3406830c8e3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -554,40 +554,36 @@ static void iwl3945_add_radiotap(struct iwl3945_priv *priv, | |||
554 | iwl3945_rt->rt_hdr.it_pad = 0; | 554 | iwl3945_rt->rt_hdr.it_pad = 0; |
555 | 555 | ||
556 | /* total header + data */ | 556 | /* total header + data */ |
557 | put_unaligned(cpu_to_le16(sizeof(*iwl3945_rt)), | 557 | put_unaligned_le16(sizeof(*iwl3945_rt), &iwl3945_rt->rt_hdr.it_len); |
558 | &iwl3945_rt->rt_hdr.it_len); | ||
559 | 558 | ||
560 | /* Indicate all the fields we add to the radiotap header */ | 559 | /* Indicate all the fields we add to the radiotap header */ |
561 | put_unaligned(cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | | 560 | put_unaligned_le32((1 << IEEE80211_RADIOTAP_TSFT) | |
562 | (1 << IEEE80211_RADIOTAP_FLAGS) | | 561 | (1 << IEEE80211_RADIOTAP_FLAGS) | |
563 | (1 << IEEE80211_RADIOTAP_RATE) | | 562 | (1 << IEEE80211_RADIOTAP_RATE) | |
564 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | 563 | (1 << IEEE80211_RADIOTAP_CHANNEL) | |
565 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | | 564 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | |
566 | (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | | 565 | (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | |
567 | (1 << IEEE80211_RADIOTAP_ANTENNA)), | 566 | (1 << IEEE80211_RADIOTAP_ANTENNA), |
568 | &iwl3945_rt->rt_hdr.it_present); | 567 | &iwl3945_rt->rt_hdr.it_present); |
569 | 568 | ||
570 | /* Zero the flags, we'll add to them as we go */ | 569 | /* Zero the flags, we'll add to them as we go */ |
571 | iwl3945_rt->rt_flags = 0; | 570 | iwl3945_rt->rt_flags = 0; |
572 | 571 | ||
573 | put_unaligned(cpu_to_le64(tsf), &iwl3945_rt->rt_tsf); | 572 | put_unaligned_le64(tsf, &iwl3945_rt->rt_tsf); |
574 | 573 | ||
575 | iwl3945_rt->rt_dbmsignal = signal; | 574 | iwl3945_rt->rt_dbmsignal = signal; |
576 | iwl3945_rt->rt_dbmnoise = noise; | 575 | iwl3945_rt->rt_dbmnoise = noise; |
577 | 576 | ||
578 | /* Convert the channel frequency and set the flags */ | 577 | /* Convert the channel frequency and set the flags */ |
579 | put_unaligned(cpu_to_le16(stats->freq), &iwl3945_rt->rt_channelMHz); | 578 | put_unaligned_le16(stats->freq, &iwl3945_rt->rt_channelMHz); |
580 | if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) | 579 | if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) |
581 | put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM | | 580 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ, |
582 | IEEE80211_CHAN_5GHZ), | ||
583 | &iwl3945_rt->rt_chbitmask); | 581 | &iwl3945_rt->rt_chbitmask); |
584 | else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) | 582 | else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) |
585 | put_unaligned(cpu_to_le16(IEEE80211_CHAN_CCK | | 583 | put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ, |
586 | IEEE80211_CHAN_2GHZ), | ||
587 | &iwl3945_rt->rt_chbitmask); | 584 | &iwl3945_rt->rt_chbitmask); |
588 | else /* 802.11g */ | 585 | else /* 802.11g */ |
589 | put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM | | 586 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ, |
590 | IEEE80211_CHAN_2GHZ), | ||
591 | &iwl3945_rt->rt_chbitmask); | 587 | &iwl3945_rt->rt_chbitmask); |
592 | 588 | ||
593 | if (rate == -1) | 589 | if (rate == -1) |
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index e72c97a0d6c1..1a409fcc80d3 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -522,7 +522,7 @@ static int lbs_process_bss(struct bss_descriptor *bss, | |||
522 | 522 | ||
523 | if (*bytesleft >= sizeof(beaconsize)) { | 523 | if (*bytesleft >= sizeof(beaconsize)) { |
524 | /* Extract & convert beacon size from the command buffer */ | 524 | /* Extract & convert beacon size from the command buffer */ |
525 | beaconsize = le16_to_cpu(get_unaligned((__le16 *)*pbeaconinfo)); | 525 | beaconsize = get_unaligned_le16(*pbeaconinfo); |
526 | *bytesleft -= sizeof(beaconsize); | 526 | *bytesleft -= sizeof(beaconsize); |
527 | *pbeaconinfo += sizeof(beaconsize); | 527 | *pbeaconinfo += sizeof(beaconsize); |
528 | } | 528 | } |
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index bced3fe1cf8a..5dd23c93497d 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c | |||
@@ -768,41 +768,17 @@ static __u8 *UnStuffData(__u8 * src, __u8 * end, __u8 * dst, | |||
768 | /* General routines for STRIP */ | 768 | /* General routines for STRIP */ |
769 | 769 | ||
770 | /* | 770 | /* |
771 | * get_baud returns the current baud rate, as one of the constants defined in | ||
772 | * termbits.h | ||
773 | * If the user has issued a baud rate override using the 'setserial' command | ||
774 | * and the logical current rate is set to 38.4, then the true baud rate | ||
775 | * currently in effect (57.6 or 115.2) is returned. | ||
776 | */ | ||
777 | static unsigned int get_baud(struct tty_struct *tty) | ||
778 | { | ||
779 | if (!tty || !tty->termios) | ||
780 | return (0); | ||
781 | if ((tty->termios->c_cflag & CBAUD) == B38400 && tty->driver_data) { | ||
782 | struct async_struct *info = | ||
783 | (struct async_struct *) tty->driver_data; | ||
784 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | ||
785 | return (B57600); | ||
786 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | ||
787 | return (B115200); | ||
788 | } | ||
789 | return (tty->termios->c_cflag & CBAUD); | ||
790 | } | ||
791 | |||
792 | /* | ||
793 | * set_baud sets the baud rate to the rate defined by baudcode | 771 | * set_baud sets the baud rate to the rate defined by baudcode |
794 | * Note: The rate B38400 should be avoided, because the user may have | ||
795 | * issued a 'setserial' speed override to map that to a different speed. | ||
796 | * We could achieve a true rate of 38400 if we needed to by cancelling | ||
797 | * any user speed override that is in place, but that might annoy the | ||
798 | * user, so it is simplest to just avoid using 38400. | ||
799 | */ | 772 | */ |
800 | static void set_baud(struct tty_struct *tty, unsigned int baudcode) | 773 | static void set_baud(struct tty_struct *tty, speed_t baudrate) |
801 | { | 774 | { |
802 | struct ktermios old_termios = *(tty->termios); | 775 | struct ktermios old_termios; |
803 | tty->termios->c_cflag &= ~CBAUD; /* Clear the old baud setting */ | 776 | |
804 | tty->termios->c_cflag |= baudcode; /* Set the new baud setting */ | 777 | mutex_lock(&tty->termios_mutex); |
805 | tty->driver->set_termios(tty, &old_termios); | 778 | old_termios =*(tty->termios); |
779 | tty_encode_baud_rate(tty, baudrate, baudrate); | ||
780 | tty->ops->set_termios(tty, &old_termios); | ||
781 | mutex_unlock(&tty->termios_mutex); | ||
806 | } | 782 | } |
807 | 783 | ||
808 | /* | 784 | /* |
@@ -1217,7 +1193,7 @@ static void ResetRadio(struct strip *strip_info) | |||
1217 | strip_info->watchdog_doreset = jiffies + 1 * HZ; | 1193 | strip_info->watchdog_doreset = jiffies + 1 * HZ; |
1218 | 1194 | ||
1219 | /* If the user has selected a baud rate above 38.4 see what magic we have to do */ | 1195 | /* If the user has selected a baud rate above 38.4 see what magic we have to do */ |
1220 | if (strip_info->user_baud > B38400) { | 1196 | if (strip_info->user_baud > 38400) { |
1221 | /* | 1197 | /* |
1222 | * Subtle stuff: Pay attention :-) | 1198 | * Subtle stuff: Pay attention :-) |
1223 | * If the serial port is currently at the user's selected (>38.4) rate, | 1199 | * If the serial port is currently at the user's selected (>38.4) rate, |
@@ -1227,17 +1203,17 @@ static void ResetRadio(struct strip *strip_info) | |||
1227 | * issued the ATS304 command last time through, so this time we restore | 1203 | * issued the ATS304 command last time through, so this time we restore |
1228 | * the user's selected rate and issue the normal starmode reset string. | 1204 | * the user's selected rate and issue the normal starmode reset string. |
1229 | */ | 1205 | */ |
1230 | if (strip_info->user_baud == get_baud(tty)) { | 1206 | if (strip_info->user_baud == tty_get_baud_rate(tty)) { |
1231 | static const char b0[] = "ate0q1s304=57600\r"; | 1207 | static const char b0[] = "ate0q1s304=57600\r"; |
1232 | static const char b1[] = "ate0q1s304=115200\r"; | 1208 | static const char b1[] = "ate0q1s304=115200\r"; |
1233 | static const StringDescriptor baudstring[2] = | 1209 | static const StringDescriptor baudstring[2] = |
1234 | { {b0, sizeof(b0) - 1} | 1210 | { {b0, sizeof(b0) - 1} |
1235 | , {b1, sizeof(b1) - 1} | 1211 | , {b1, sizeof(b1) - 1} |
1236 | }; | 1212 | }; |
1237 | set_baud(tty, B19200); | 1213 | set_baud(tty, 19200); |
1238 | if (strip_info->user_baud == B57600) | 1214 | if (strip_info->user_baud == 57600) |
1239 | s = baudstring[0]; | 1215 | s = baudstring[0]; |
1240 | else if (strip_info->user_baud == B115200) | 1216 | else if (strip_info->user_baud == 115200) |
1241 | s = baudstring[1]; | 1217 | s = baudstring[1]; |
1242 | else | 1218 | else |
1243 | s = baudstring[1]; /* For now */ | 1219 | s = baudstring[1]; /* For now */ |
@@ -1245,7 +1221,7 @@ static void ResetRadio(struct strip *strip_info) | |||
1245 | set_baud(tty, strip_info->user_baud); | 1221 | set_baud(tty, strip_info->user_baud); |
1246 | } | 1222 | } |
1247 | 1223 | ||
1248 | tty->driver->write(tty, s.string, s.length); | 1224 | tty->ops->write(tty, s.string, s.length); |
1249 | #ifdef EXT_COUNTERS | 1225 | #ifdef EXT_COUNTERS |
1250 | strip_info->tx_ebytes += s.length; | 1226 | strip_info->tx_ebytes += s.length; |
1251 | #endif | 1227 | #endif |
@@ -1267,7 +1243,7 @@ static void strip_write_some_more(struct tty_struct *tty) | |||
1267 | 1243 | ||
1268 | if (strip_info->tx_left > 0) { | 1244 | if (strip_info->tx_left > 0) { |
1269 | int num_written = | 1245 | int num_written = |
1270 | tty->driver->write(tty, strip_info->tx_head, | 1246 | tty->ops->write(tty, strip_info->tx_head, |
1271 | strip_info->tx_left); | 1247 | strip_info->tx_left); |
1272 | strip_info->tx_left -= num_written; | 1248 | strip_info->tx_left -= num_written; |
1273 | strip_info->tx_head += num_written; | 1249 | strip_info->tx_head += num_written; |
@@ -2457,7 +2433,7 @@ static int strip_open_low(struct net_device *dev) | |||
2457 | strip_info->working = FALSE; | 2433 | strip_info->working = FALSE; |
2458 | strip_info->firmware_level = NoStructure; | 2434 | strip_info->firmware_level = NoStructure; |
2459 | strip_info->next_command = CompatibilityCommand; | 2435 | strip_info->next_command = CompatibilityCommand; |
2460 | strip_info->user_baud = get_baud(strip_info->tty); | 2436 | strip_info->user_baud = tty_get_baud_rate(strip_info->tty); |
2461 | 2437 | ||
2462 | printk(KERN_INFO "%s: Initializing Radio.\n", | 2438 | printk(KERN_INFO "%s: Initializing Radio.\n", |
2463 | strip_info->dev->name); | 2439 | strip_info->dev->name); |
@@ -2632,6 +2608,13 @@ static int strip_open(struct tty_struct *tty) | |||
2632 | return -EEXIST; | 2608 | return -EEXIST; |
2633 | 2609 | ||
2634 | /* | 2610 | /* |
2611 | * We need a write method. | ||
2612 | */ | ||
2613 | |||
2614 | if (tty->ops->write == NULL) | ||
2615 | return -EOPNOTSUPP; | ||
2616 | |||
2617 | /* | ||
2635 | * OK. Find a free STRIP channel to use. | 2618 | * OK. Find a free STRIP channel to use. |
2636 | */ | 2619 | */ |
2637 | if ((strip_info = strip_alloc()) == NULL) | 2620 | if ((strip_info = strip_alloc()) == NULL) |
@@ -2652,8 +2635,7 @@ static int strip_open(struct tty_struct *tty) | |||
2652 | tty->disc_data = strip_info; | 2635 | tty->disc_data = strip_info; |
2653 | tty->receive_room = 65536; | 2636 | tty->receive_room = 65536; |
2654 | 2637 | ||
2655 | if (tty->driver->flush_buffer) | 2638 | tty_driver_flush_buffer(tty); |
2656 | tty->driver->flush_buffer(tty); | ||
2657 | 2639 | ||
2658 | /* | 2640 | /* |
2659 | * Restore default settings | 2641 | * Restore default settings |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index e34675c2f8fc..5316074f39f0 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -545,11 +545,11 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer, | |||
545 | * be padded. Unaligned access might also happen if the length_info | 545 | * be padded. Unaligned access might also happen if the length_info |
546 | * structure is not present. | 546 | * structure is not present. |
547 | */ | 547 | */ |
548 | if (get_unaligned(&length_info->tag) == cpu_to_le16(RX_LENGTH_INFO_TAG)) | 548 | if (get_unaligned_le16(&length_info->tag) == RX_LENGTH_INFO_TAG) |
549 | { | 549 | { |
550 | unsigned int l, k, n; | 550 | unsigned int l, k, n; |
551 | for (i = 0, l = 0;; i++) { | 551 | for (i = 0, l = 0;; i++) { |
552 | k = le16_to_cpu(get_unaligned(&length_info->length[i])); | 552 | k = get_unaligned_le16(&length_info->length[i]); |
553 | if (k == 0) | 553 | if (k == 0) |
554 | return; | 554 | return; |
555 | n = l+k; | 555 | n = l+k; |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 7483d45bc5bc..e62018a36133 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1809,3 +1809,5 @@ module_exit(netif_exit); | |||
1809 | 1809 | ||
1810 | MODULE_DESCRIPTION("Xen virtual network device frontend"); | 1810 | MODULE_DESCRIPTION("Xen virtual network device frontend"); |
1811 | MODULE_LICENSE("GPL"); | 1811 | MODULE_LICENSE("GPL"); |
1812 | MODULE_ALIAS("xen:vif"); | ||
1813 | MODULE_ALIAS("xennet"); | ||
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 24640726f8bb..57e1f495b9fc 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -1062,7 +1062,7 @@ static int yellowfin_rx(struct net_device *dev) | |||
1062 | buf_addr = rx_skb->data; | 1062 | buf_addr = rx_skb->data; |
1063 | data_size = (le32_to_cpu(desc->dbdma_cmd) - | 1063 | data_size = (le32_to_cpu(desc->dbdma_cmd) - |
1064 | le32_to_cpu(desc->result_status)) & 0xffff; | 1064 | le32_to_cpu(desc->result_status)) & 0xffff; |
1065 | frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2]))); | 1065 | frame_status = get_unaligned_le16(&(buf_addr[data_size - 2])); |
1066 | if (yellowfin_debug > 4) | 1066 | if (yellowfin_debug > 4) |
1067 | printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", | 1067 | printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", |
1068 | frame_status); | 1068 | frame_status); |