* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: appletalk: Fix OOPS in atalk_release(). mlx4: Fixing bad size of event queue buffer mlx4: Fixing use after free bonding:typo in comment sctp: Pass __GFP_NOWARN to hash table allocation attempts. connector: convert to synchronous netlink message processing fib: add rtnl locking in ip_fib_net_exit atm/solos-pci: Don't flap VCs when carrier state changes atm/solos-pci: Don't include frame pseudo-header on transmit hex-dump atm/solos-pci: Use VPI.VCI notation uniformly. Atheros, atl2: Fix mem leaks in error paths of atl2_set_eeprom netdev: fix mtu check when TSO is enabled net/usb: Ethernet quirks for the LG-VL600 4G modem phylib: phy_attach_direct: phy_init_hw can fail, add cleanup bridge: mcast snooping, fix length check of snooped MLDv1/2 via-ircc: Pass PCI device pointer to dma_{alloc, free}_coherent() via-ircc: Use pci_{get, set}_drvdata() instead of static pointer variable net: gre: provide multicast mappings for ipv4 and ipv6 bridge: Fix compilation warning in function br_stp_recalculate_bridge_id() net: Fix warnings caused by MAX_SKB_FRAGS change.
Unified · Split
| @@ -165,7 +165,6 @@ static uint32_t fpga_tx(struct solos_card *); · 164 unmodified lines | ||
| 165 | 165 | static irqreturn_t solos_irq(int irq, void *dev_id); |
| 166 | 166 | static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); |
| 167 | 167 | static int list_vccs(int vci); |
| 168 | −static void release_vccs(struct atm_dev *dev); | |
| 169 | 168 | static int atm_init(struct solos_card *, struct device *); |
| 170 | 169 | static void atm_remove(struct solos_card *); |
| 171 | 170 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); |
| @@ -384,7 +383,6 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb · 212 unmodified lines | ||
| 384 | 383 | /* Anything but 'Showtime' is down */ |
| 385 | 384 | if (strcmp(state_str, "Showtime")) { |
| 386 | 385 | atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST); |
| 387 | − release_vccs(card->atmdev[port]); | |
| 388 | 386 | dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str); |
| 389 | 387 | return 0; |
| 390 | 388 | } |
| @@ -697,7 +695,7 @@ void solos_bh(unsigned long card_arg) · 306 unmodified lines | ||
| 697 | 695 | size); |
| 698 | 696 | } |
| 699 | 697 | if (atmdebug) { |
| 700 | − dev_info(&card->dev->dev, "Received: device %d\n", port); | |
| 698 | + dev_info(&card->dev->dev, "Received: port %d\n", port); | |
| 701 | 699 | dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", |
| 702 | 700 | size, le16_to_cpu(header->vpi), |
| 703 | 701 | le16_to_cpu(header->vci)); |
| @@ -710,8 +708,8 @@ void solos_bh(unsigned long card_arg) · 6 unmodified lines | ||
| 710 | 708 | le16_to_cpu(header->vci)); |
| 711 | 709 | if (!vcc) { |
| 712 | 710 | if (net_ratelimit()) |
| 713 | − dev_warn(&card->dev->dev, "Received packet for unknown VCI.VPI %d.%d on port %d\n", | |
| 714 | − le16_to_cpu(header->vci), le16_to_cpu(header->vpi), | |
| 711 | + dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n", | |
| 712 | + le16_to_cpu(header->vpi), le16_to_cpu(header->vci), | |
| 715 | 713 | port); |
| 716 | 714 | continue; |
| 717 | 715 | } |
| @@ -830,28 +828,6 @@ static int list_vccs(int vci) · 112 unmodified lines | ||
| 830 | 828 | return num_found; |
| 831 | 829 | } |
| 832 | 830 | |
| 833 | −static void release_vccs(struct atm_dev *dev) | |
| 834 | −{ | |
| 835 | − int i; | |
| 836 | − | |
| 837 | − write_lock_irq(&vcc_sklist_lock); | |
| 838 | − for (i = 0; i < VCC_HTABLE_SIZE; i++) { | |
| 839 | − struct hlist_head *head = &vcc_hash[i]; | |
| 840 | − struct hlist_node *node, *tmp; | |
| 841 | − struct sock *s; | |
| 842 | − struct atm_vcc *vcc; | |
| 843 | − | |
| 844 | − sk_for_each_safe(s, node, tmp, head) { | |
| 845 | − vcc = atm_sk(s); | |
| 846 | − if (vcc->dev == dev) { | |
| 847 | − vcc_release_async(vcc, -EPIPE); | |
| 848 | − sk_del_node_init(s); | |
| 849 | − } | |
| 850 | − } | |
| 851 | − } | |
| 852 | − write_unlock_irq(&vcc_sklist_lock); | |
| 853 | −} | |
| 854 | − | |
| 855 | 831 | |
| 856 | 832 | static int popen(struct atm_vcc *vcc) |
| 857 | 833 | { |
| @@ -1018,8 +994,15 @@ static uint32_t fpga_tx(struct solos_card *card) · 160 unmodified lines | ||
| 1018 | 994 | |
| 1019 | 995 | /* Clean up and free oldskb now it's gone */ |
| 1020 | 996 | if (atmdebug) { |
| 997 | + struct pkt_hdr *header = (void *)oldskb->data; | |
| 998 | + int size = le16_to_cpu(header->size); | |
| 999 | + | |
| 1000 | + skb_pull(oldskb, sizeof(*header)); | |
| 1021 | 1001 | dev_info(&card->dev->dev, "Transmitted: port %d\n", |
| 1022 | 1002 | port); |
| 1003 | + dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", | |
| 1004 | + size, le16_to_cpu(header->vpi), | |
| 1005 | + le16_to_cpu(header->vci)); | |
| 1023 | 1006 | print_buffer(oldskb); |
| 1024 | 1007 | } |
| 1025 | 1008 | |
| @@ -1262,7 +1245,7 @@ static int atm_init(struct solos_card *card, struct device *parent) · 236 unmodified lines | ||
| 1262 | 1245 | card->atmdev[i]->ci_range.vci_bits = 16; |
| 1263 | 1246 | card->atmdev[i]->dev_data = card; |
| 1264 | 1247 | card->atmdev[i]->phy_data = (void *)(unsigned long)i; |
| 1265 | − atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_UNKNOWN); | |
| 1248 | + atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND); | |
| 1266 | 1249 | |
| 1267 | 1250 | skb = alloc_skb(sizeof(*header), GFP_ATOMIC); |
| 1268 | 1251 | if (!skb) { |
| @@ -31,24 +31,9 @@ · 30 unmodified lines | ||
| 31 | 31 | #include <linux/connector.h> |
| 32 | 32 | #include <linux/delay.h> |
| 33 | 33 | |
| 34 | −void cn_queue_wrapper(struct work_struct *work) | |
| 35 | −{ | |
| 36 | − struct cn_callback_entry *cbq = | |
| 37 | − container_of(work, struct cn_callback_entry, work); | |
| 38 | − struct cn_callback_data *d = &cbq->data; | |
| 39 | − struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb)); | |
| 40 | − struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb); | |
| 41 | − | |
| 42 | − d->callback(msg, nsp); | |
| 43 | − | |
| 44 | − kfree_skb(d->skb); | |
| 45 | − d->skb = NULL; | |
| 46 | − | |
| 47 | − kfree(d->free); | |
| 48 | −} | |
| 49 | − | |
| 50 | 34 | static struct cn_callback_entry * |
| 51 | −cn_queue_alloc_callback_entry(const char *name, struct cb_id *id, | |
| 35 | +cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name, | |
| 36 | + struct cb_id *id, | |
| 52 | 37 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) |
| 53 | 38 | { |
| 54 | 39 | struct cn_callback_entry *cbq; |
| @@ -59,17 +44,23 @@ cn_queue_alloc_callback_entry(const char *name, struct cb_id *id, · 4 unmodified lines | ||
| 59 | 44 | return NULL; |
| 60 | 45 | } |
| 61 | 46 | |
| 47 | + atomic_set(&cbq->refcnt, 1); | |
| 48 | + | |
| 49 | + atomic_inc(&dev->refcnt); | |
| 50 | + cbq->pdev = dev; | |
| 51 | + | |
| 62 | 52 | snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name); |
| 63 | 53 | memcpy(&cbq->id.id, id, sizeof(struct cb_id)); |
| 64 | − cbq->data.callback = callback; | |
| 65 | − | |
| 66 | − INIT_WORK(&cbq->work, &cn_queue_wrapper); | |
| 54 | + cbq->callback = callback; | |
| 67 | 55 | return cbq; |
| 68 | 56 | } |
| 69 | 57 | |
| 70 | −static void cn_queue_free_callback(struct cn_callback_entry *cbq) | |
| 58 | +void cn_queue_release_callback(struct cn_callback_entry *cbq) | |
| 71 | 59 | { |
| 72 | − flush_workqueue(cbq->pdev->cn_queue); | |
| 60 | + if (!atomic_dec_and_test(&cbq->refcnt)) | |
| 61 | + return; | |
| 62 | + | |
| 63 | + atomic_dec(&cbq->pdev->refcnt); | |
| 73 | 64 | kfree(cbq); |
| 74 | 65 | } |
| 75 | 66 | |
| @@ -85,13 +76,10 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, · 9 unmodified lines | ||
| 85 | 76 | struct cn_callback_entry *cbq, *__cbq; |
| 86 | 77 | int found = 0; |
| 87 | 78 | |
| 88 | − cbq = cn_queue_alloc_callback_entry(name, id, callback); | |
| 79 | + cbq = cn_queue_alloc_callback_entry(dev, name, id, callback); | |
| 89 | 80 | if (!cbq) |
| 90 | 81 | return -ENOMEM; |
| 91 | 82 | |
| 92 | − atomic_inc(&dev->refcnt); | |
| 93 | − cbq->pdev = dev; | |
| 94 | − | |
| 95 | 83 | spin_lock_bh(&dev->queue_lock); |
| 96 | 84 | list_for_each_entry(__cbq, &dev->queue_list, callback_entry) { |
| 97 | 85 | if (cn_cb_equal(&__cbq->id.id, id)) { |
| @@ -104,8 +92,7 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, · 6 unmodified lines | ||
| 104 | 92 | spin_unlock_bh(&dev->queue_lock); |
| 105 | 93 | |
| 106 | 94 | if (found) { |
| 107 | − cn_queue_free_callback(cbq); | |
| 108 | − atomic_dec(&dev->refcnt); | |
| 95 | + cn_queue_release_callback(cbq); | |
| 109 | 96 | return -EINVAL; |
| 110 | 97 | } |
| 111 | 98 | |
| @@ -130,10 +117,8 @@ void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id) · 18 unmodified lines | ||
| 130 | 117 | } |
| 131 | 118 | spin_unlock_bh(&dev->queue_lock); |
| 132 | 119 | |
| 133 | − if (found) { | |
| 134 | − cn_queue_free_callback(cbq); | |
| 135 | − atomic_dec(&dev->refcnt); | |
| 136 | − } | |
| 120 | + if (found) | |
| 121 | + cn_queue_release_callback(cbq); | |
| 137 | 122 | } |
| 138 | 123 | |
| 139 | 124 | struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls) |
| @@ -151,12 +136,6 @@ struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls) · 11 unmodified lines | ||
| 151 | 136 | |
| 152 | 137 | dev->nls = nls; |
| 153 | 138 | |
| 154 | − dev->cn_queue = alloc_ordered_workqueue(dev->name, 0); | |
| 155 | − if (!dev->cn_queue) { | |
| 156 | − kfree(dev); | |
| 157 | − return NULL; | |
| 158 | − } | |
| 159 | − | |
| 160 | 139 | return dev; |
| 161 | 140 | } |
| 162 | 141 | |
| @@ -164,9 +143,6 @@ void cn_queue_free_dev(struct cn_queue_dev *dev) · 1 unmodified line | ||
| 164 | 143 | { |
| 165 | 144 | struct cn_callback_entry *cbq, *n; |
| 166 | 145 | |
| 167 | − flush_workqueue(dev->cn_queue); | |
| 168 | − destroy_workqueue(dev->cn_queue); | |
| 169 | − | |
| 170 | 146 | spin_lock_bh(&dev->queue_lock); |
| 171 | 147 | list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry) |
| 172 | 148 | list_del(&cbq->callback_entry); |
| @@ -122,51 +122,28 @@ EXPORT_SYMBOL_GPL(cn_netlink_send); · 121 unmodified lines | ||
| 122 | 122 | */ |
| 123 | 123 | static int cn_call_callback(struct sk_buff *skb) |
| 124 | 124 | { |
| 125 | − struct cn_callback_entry *__cbq, *__new_cbq; | |
| 125 | + struct cn_callback_entry *i, *cbq = NULL; | |
| 126 | 126 | struct cn_dev *dev = &cdev; |
| 127 | 127 | struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb)); |
| 128 | + struct netlink_skb_parms *nsp = &NETLINK_CB(skb); | |
| 128 | 129 | int err = -ENODEV; |
| 129 | 130 | |
| 130 | 131 | spin_lock_bh(&dev->cbdev->queue_lock); |
| 131 | − list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { | |
| 132 | − if (cn_cb_equal(&__cbq->id.id, &msg->id)) { | |
| 133 | − if (likely(!work_pending(&__cbq->work) && | |
| 134 | − __cbq->data.skb == NULL)) { | |
| 135 | − __cbq->data.skb = skb; | |
| 136 | − | |
| 137 | − if (queue_work(dev->cbdev->cn_queue, | |
| 138 | − &__cbq->work)) | |
| 139 | − err = 0; | |
| 140 | − else | |
| 141 | − err = -EINVAL; | |
| 142 | − } else { | |
| 143 | − struct cn_callback_data *d; | |
| 144 | − | |
| 145 | − err = -ENOMEM; | |
| 146 | − __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); | |
| 147 | − if (__new_cbq) { | |
| 148 | − d = &__new_cbq->data; | |
| 149 | − d->skb = skb; | |
| 150 | − d->callback = __cbq->data.callback; | |
| 151 | − d->free = __new_cbq; | |
| 152 | − | |
| 153 | − INIT_WORK(&__new_cbq->work, | |
| 154 | − &cn_queue_wrapper); | |
| 155 | − | |
| 156 | − if (queue_work(dev->cbdev->cn_queue, | |
| 157 | − &__new_cbq->work)) | |
| 158 | − err = 0; | |
| 159 | − else { | |
| 160 | − kfree(__new_cbq); | |
| 161 | − err = -EINVAL; | |
| 162 | − } | |
| 163 | − } | |
| 164 | − } | |
| 132 | + list_for_each_entry(i, &dev->cbdev->queue_list, callback_entry) { | |
| 133 | + if (cn_cb_equal(&i->id.id, &msg->id)) { | |
| 134 | + atomic_inc(&i->refcnt); | |
| 135 | + cbq = i; | |
| 165 | 136 | break; |
| 166 | 137 | } |
| 167 | 138 | } |
| 168 | 139 | spin_unlock_bh(&dev->cbdev->queue_lock); |
| 169 | 140 | |
| 141 | + if (cbq != NULL) { | |
| 142 | + cbq->callback(msg, nsp); | |
| 143 | + kfree_skb(skb); | |
| 144 | + cn_queue_release_callback(cbq); | |
| 145 | + } | |
| 146 | + | |
| 170 | 147 | return err; |
| 171 | 148 | } |
| 172 | 149 | |
| @@ -1996,13 +1996,15 @@ static int atl2_set_eeprom(struct net_device *netdev, · 1995 unmodified lines | ||
| 1996 | 1996 | if (!eeprom_buff) |
| 1997 | 1997 | return -ENOMEM; |
| 1998 | 1998 | |
| 1999 | − ptr = (u32 *)eeprom_buff; | |
| 1999 | + ptr = eeprom_buff; | |
| 2000 | 2000 | |
| 2001 | 2001 | if (eeprom->offset & 3) { |
| 2002 | 2002 | /* need read/modify/write of first changed EEPROM word */ |
| 2003 | 2003 | /* only the second byte of the word is being modified */ |
| 2004 | − if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) | |
| 2005 | − return -EIO; | |
| 2004 | + if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) { | |
| 2005 | + ret_val = -EIO; | |
| 2006 | + goto out; | |
| 2007 | + } | |
| 2006 | 2008 | ptr++; |
| 2007 | 2009 | } |
| 2008 | 2010 | if (((eeprom->offset + eeprom->len) & 3)) { |
| @@ -2011,18 +2013,22 @@ static int atl2_set_eeprom(struct net_device *netdev, · 2 unmodified lines | ||
| 2011 | 2013 | * only the first byte of the word is being modified |
| 2012 | 2014 | */ |
| 2013 | 2015 | if (!atl2_read_eeprom(hw, last_dword * 4, |
| 2014 | − &(eeprom_buff[last_dword - first_dword]))) | |
| 2015 | − return -EIO; | |
| 2016 | + &(eeprom_buff[last_dword - first_dword]))) { | |
| 2017 | + ret_val = -EIO; | |
| 2018 | + goto out; | |
| 2019 | + } | |
| 2016 | 2020 | } |
| 2017 | 2021 | |
| 2018 | 2022 | /* Device's eeprom is always little-endian, word addressable */ |
| 2019 | 2023 | memcpy(ptr, bytes, eeprom->len); |
| 2020 | 2024 | |
| 2021 | 2025 | for (i = 0; i < last_dword - first_dword + 1; i++) { |
| 2022 | − if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) | |
| 2023 | − return -EIO; | |
| 2026 | + if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) { | |
| 2027 | + ret_val = -EIO; | |
| 2028 | + goto out; | |
| 2029 | + } | |
| 2024 | 2030 | } |
| 2025 | − | |
| 2031 | + out: | |
| 2026 | 2032 | kfree(eeprom_buff); |
| 2027 | 2033 | return ret_val; |
| 2028 | 2034 | } |
| @@ -74,7 +74,7 @@ struct tlb_client_info { · 73 unmodified lines | ||
| 74 | 74 | * packets to a Client that the Hash function |
| 75 | 75 | * gave this entry index. |
| 76 | 76 | */ |
| 77 | − u32 tx_bytes; /* Each Client acumulates the BytesTx that | |
| 77 | + u32 tx_bytes; /* Each Client accumulates the BytesTx that | |
| 78 | 78 | * were tranmitted to it, and after each |
| 79 | 79 | * CallBack the LoadHistory is devided |
| 80 | 80 | * by the balance interval |
| @@ -75,15 +75,9 @@ static int dongle_id = 0; /* default: probe */ · 74 unmodified lines | ||
| 75 | 75 | /* We can't guess the type of connected dongle, user *must* supply it. */ |
| 76 | 76 | module_param(dongle_id, int, 0); |
| 77 | 77 | |
| 78 | −/* FIXME : we should not need this, because instances should be automatically | |
| 79 | − * managed by the PCI layer. Especially that we seem to only be using the | |
| 80 | − * first entry. Jean II */ | |
| 81 | −/* Max 4 instances for now */ | |
| 82 | −static struct via_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL }; | |
| 83 | − | |
| 84 | 78 | /* Some prototypes */ |
| 85 | −static int via_ircc_open(int i, chipio_t * info, unsigned int id); | |
| 86 | −static int via_ircc_close(struct via_ircc_cb *self); | |
| 79 | +static int via_ircc_open(struct pci_dev *pdev, chipio_t * info, | |
| 80 | + unsigned int id); | |
| 87 | 81 | static int via_ircc_dma_receive(struct via_ircc_cb *self); |
| 88 | 82 | static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, |
| 89 | 83 | int iobase); |
| @@ -215,7 +209,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi · 125 unmodified lines | ||
| 215 | 209 | pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0)); |
| 216 | 210 | pci_write_config_byte(pcidev,0x5a,0xc0); |
| 217 | 211 | WriteLPCReg(0x28, 0x70 ); |
| 218 | − if (via_ircc_open(0, &info,0x3076) == 0) | |
| 212 | + if (via_ircc_open(pcidev, &info, 0x3076) == 0) | |
| 219 | 213 | rc=0; |
| 220 | 214 | } else |
| 221 | 215 | rc = -ENODEV; //IR not turn on |
| @@ -254,7 +248,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi · 32 unmodified lines | ||
| 254 | 248 | info.irq=FirIRQ; |
| 255 | 249 | info.dma=FirDRQ1; |
| 256 | 250 | info.dma2=FirDRQ0; |
| 257 | − if (via_ircc_open(0, &info,0x3096) == 0) | |
| 251 | + if (via_ircc_open(pcidev, &info, 0x3096) == 0) | |
| 258 | 252 | rc=0; |
| 259 | 253 | } else |
| 260 | 254 | rc = -ENODEV; //IR not turn on !!!!! |
| @@ -264,48 +258,10 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi · 3 unmodified lines | ||
| 264 | 258 | return rc; |
| 265 | 259 | } |
| 266 | 260 | |
| 267 | −/* | |
| 268 | − * Function via_ircc_clean () | |
| 269 | − * | |
| 270 | − * Close all configured chips | |
| 271 | − * | |
| 272 | − */ | |
| 273 | −static void via_ircc_clean(void) | |
| 274 | −{ | |
| 275 | − int i; | |
| 276 | − | |
| 277 | − IRDA_DEBUG(3, "%s()\n", __func__); | |
| 278 | − | |
| 279 | − for (i=0; i < ARRAY_SIZE(dev_self); i++) { | |
| 280 | − if (dev_self[i]) | |
| 281 | − via_ircc_close(dev_self[i]); | |
| 282 | − } | |
| 283 | −} | |
| 284 | − | |
| 285 | −static void __devexit via_remove_one (struct pci_dev *pdev) | |
| 286 | −{ | |
| 287 | − IRDA_DEBUG(3, "%s()\n", __func__); | |
| 288 | − | |
| 289 | − /* FIXME : This is ugly. We should use pci_get_drvdata(pdev); | |
| 290 | − * to get our driver instance and call directly via_ircc_close(). | |
| 291 | − * See vlsi_ir for details... | |
| 292 | − * Jean II */ | |
| 293 | − via_ircc_clean(); | |
| 294 | − | |
| 295 | − /* FIXME : This should be in via_ircc_close(), because here we may | |
| 296 | − * theoritically disable still configured devices :-( - Jean II */ | |
| 297 | − pci_disable_device(pdev); | |
| 298 | −} | |
| 299 | − | |
| 300 | 261 | static void __exit via_ircc_cleanup(void) |
| 301 | 262 | { |
| 302 | 263 | IRDA_DEBUG(3, "%s()\n", __func__); |
| 303 | 264 | |
| 304 | − /* FIXME : This should be redundant, as pci_unregister_driver() | |
| 305 | − * should call via_remove_one() on each device. | |
| 306 | − * Jean II */ | |
| 307 | − via_ircc_clean(); | |
| 308 | − | |
| 309 | 265 | /* Cleanup all instances of the driver */ |
| 310 | 266 | pci_unregister_driver (&via_driver); |
| 311 | 267 | } |
| @@ -324,12 +280,13 @@ static const struct net_device_ops via_ircc_fir_ops = { · 12 unmodified lines | ||
| 324 | 280 | }; |
| 325 | 281 | |
| 326 | 282 | /* |
| 327 | − * Function via_ircc_open (iobase, irq) | |
| 283 | + * Function via_ircc_open(pdev, iobase, irq) | |
| 328 | 284 | * |
| 329 | 285 | * Open driver instance |
| 330 | 286 | * |
| 331 | 287 | */ |
| 332 | −static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) | |
| 288 | +static __devinit int via_ircc_open(struct pci_dev *pdev, chipio_t * info, | |
| 289 | + unsigned int id) | |
| 333 | 290 | { |
| 334 | 291 | struct net_device *dev; |
| 335 | 292 | struct via_ircc_cb *self; |
| @@ -337,9 +294,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) · 1 unmodified line | ||
| 337 | 294 | |
| 338 | 295 | IRDA_DEBUG(3, "%s()\n", __func__); |
| 339 | 296 | |
| 340 | − if (i >= ARRAY_SIZE(dev_self)) | |
| 341 | − return -ENOMEM; | |
| 342 | − | |
| 343 | 297 | /* Allocate new instance of the driver */ |
| 344 | 298 | dev = alloc_irdadev(sizeof(struct via_ircc_cb)); |
| 345 | 299 | if (dev == NULL) |
| @@ -349,13 +303,8 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) · 3 unmodified lines | ||
| 349 | 303 | self->netdev = dev; |
| 350 | 304 | spin_lock_init(&self->lock); |
| 351 | 305 | |
| 352 | − /* FIXME : We should store our driver instance in the PCI layer, | |
| 353 | − * using pci_set_drvdata(), not in this array. | |
| 354 | − * See vlsi_ir for details... - Jean II */ | |
| 355 | − /* FIXME : 'i' is always 0 (see via_init_one()) :-( - Jean II */ | |
| 356 | − /* Need to store self somewhere */ | |
| 357 | − dev_self[i] = self; | |
| 358 | − self->index = i; | |
| 306 | + pci_set_drvdata(pdev, self); | |
| 307 | + | |
| 359 | 308 | /* Initialize Resource */ |
| 360 | 309 | self->io.cfg_base = info->cfg_base; |
| 361 | 310 | self->io.fir_base = info->fir_base; |
| @@ -414,7 +363,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) · 52 unmodified lines | ||
| 414 | 363 | |
| 415 | 364 | /* Allocate memory if needed */ |
| 416 | 365 | self->rx_buff.head = |
| 417 | − dma_alloc_coherent(NULL, self->rx_buff.truesize, | |
| 366 | + dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize, | |
| 418 | 367 | &self->rx_buff_dma, GFP_KERNEL); |
| 419 | 368 | if (self->rx_buff.head == NULL) { |
| 420 | 369 | err = -ENOMEM; |
| @@ -423,7 +372,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) · 2 unmodified lines | ||
| 423 | 372 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); |
| 424 | 373 | |
| 425 | 374 | self->tx_buff.head = |
| 426 | − dma_alloc_coherent(NULL, self->tx_buff.truesize, | |
| 375 | + dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize, | |
| 427 | 376 | &self->tx_buff_dma, GFP_KERNEL); |
| 428 | 377 | if (self->tx_buff.head == NULL) { |
| 429 | 378 | err = -ENOMEM; |
| @@ -455,33 +404,32 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) · 25 unmodified lines | ||
| 455 | 404 | via_hw_init(self); |
| 456 | 405 | return 0; |
| 457 | 406 | err_out4: |
| 458 | − dma_free_coherent(NULL, self->tx_buff.truesize, | |
| 407 | + dma_free_coherent(&pdev->dev, self->tx_buff.truesize, | |
| 459 | 408 | self->tx_buff.head, self->tx_buff_dma); |
| 460 | 409 | err_out3: |
| 461 | − dma_free_coherent(NULL, self->rx_buff.truesize, | |
| 410 | + dma_free_coherent(&pdev->dev, self->rx_buff.truesize, | |
| 462 | 411 | self->rx_buff.head, self->rx_buff_dma); |
| 463 | 412 | err_out2: |
| 464 | 413 | release_region(self->io.fir_base, self->io.fir_ext); |
| 465 | 414 | err_out1: |
| 415 | + pci_set_drvdata(pdev, NULL); | |
| 466 | 416 | free_netdev(dev); |
| 467 | − dev_self[i] = NULL; | |
| 468 | 417 | return err; |
| 469 | 418 | } |
| 470 | 419 | |
| 471 | 420 | /* |
| 472 | − * Function via_ircc_close (self) | |
| 421 | + * Function via_remove_one(pdev) | |
| 473 | 422 | * |
| 474 | 423 | * Close driver instance |
| 475 | 424 | * |
| 476 | 425 | */ |
| 477 | −static int via_ircc_close(struct via_ircc_cb *self) | |
| 426 | +static void __devexit via_remove_one(struct pci_dev *pdev) | |
| 478 | 427 | { |
| 428 | + struct via_ircc_cb *self = pci_get_drvdata(pdev); | |
| 479 | 429 | int iobase; |
| 480 | 430 | |
| 481 | 431 | IRDA_DEBUG(3, "%s()\n", __func__); |
| 482 | 432 | |
| 483 | − IRDA_ASSERT(self != NULL, return -1;); | |
| 484 | − | |
| 485 | 433 | iobase = self->io.fir_base; |
| 486 | 434 | |
| 487 | 435 | ResetChip(iobase, 5); //hardware reset. |
| @@ -493,16 +441,16 @@ static int via_ircc_close(struct via_ircc_cb *self) · 5 unmodified lines | ||
| 493 | 441 | __func__, self->io.fir_base); |
| 494 | 442 | release_region(self->io.fir_base, self->io.fir_ext); |
| 495 | 443 | if (self->tx_buff.head) |
| 496 | − dma_free_coherent(NULL, self->tx_buff.truesize, | |
| 444 | + dma_free_coherent(&pdev->dev, self->tx_buff.truesize, | |
| 497 | 445 | self->tx_buff.head, self->tx_buff_dma); |
| 498 | 446 | if (self->rx_buff.head) |
| 499 | − dma_free_coherent(NULL, self->rx_buff.truesize, | |
| 447 | + dma_free_coherent(&pdev->dev, self->rx_buff.truesize, | |
| 500 | 448 | self->rx_buff.head, self->rx_buff_dma); |
| 501 | − dev_self[self->index] = NULL; | |
| 449 | + pci_set_drvdata(pdev, NULL); | |
| 502 | 450 | |
| 503 | 451 | free_netdev(self->netdev); |
| 504 | 452 | |
| 505 | − return 0; | |
| 453 | + pci_disable_device(pdev); | |
| 506 | 454 | } |
| 507 | 455 | |
| 508 | 456 | /* |
| @@ -603,7 +603,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) · 602 unmodified lines | ||
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | for (i = 0; i < dev->caps.num_comp_vectors; ++i) { |
| 606 | − err = mlx4_create_eq(dev, dev->caps.num_cqs + MLX4_NUM_SPARE_EQE, | |
| 606 | + err = mlx4_create_eq(dev, dev->caps.num_cqs - | |
| 607 | + dev->caps.reserved_cqs + | |
| 608 | + MLX4_NUM_SPARE_EQE, | |
| 607 | 609 | (dev->flags & MLX4_FLAG_MSI_X) ? i : 0, |
| 608 | 610 | &priv->eq_table.eq[i]); |
| 609 | 611 | if (err) { |
| @@ -469,7 +469,6 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 vep_num, u8 port, · 468 unmodified lines | ||
| 469 | 469 | |
| 470 | 470 | /*remove from list of promisc qps */ |
| 471 | 471 | list_del(&pqp->list); |
| 472 | − kfree(pqp); | |
| 473 | 472 | |
| 474 | 473 | /* set the default entry not to include the removed one */ |
| 475 | 474 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
| @@ -528,6 +527,8 @@ out_mailbox: · 52 unmodified lines | ||
| 528 | 527 | out_list: |
| 529 | 528 | if (back_to_list) |
| 530 | 529 | list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]); |
| 530 | + else | |
| 531 | + kfree(pqp); | |
| 531 | 532 | out_mutex: |
| 532 | 533 | mutex_unlock(&priv->mcg_table.mutex); |
| 533 | 534 | return err; |
| @@ -442,11 +442,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, · 441 unmodified lines | ||
| 442 | 442 | u32 flags, phy_interface_t interface) |
| 443 | 443 | { |
| 444 | 444 | struct device *d = &phydev->dev; |
| 445 | + int err; | |
| 445 | 446 | |
| 446 | 447 | /* Assume that if there is no driver, that it doesn't |
| 447 | 448 | * exist, and we should use the genphy driver. */ |
| 448 | 449 | if (NULL == d->driver) { |
| 449 | − int err; | |
| 450 | 450 | d->driver = &genphy_driver.driver; |
| 451 | 451 | |
| 452 | 452 | err = d->driver->probe(d); |
| @@ -474,7 +474,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, · 21 unmodified lines | ||
| 474 | 474 | /* Do initial configuration here, now that |
| 475 | 475 | * we have certain key parameters |
| 476 | 476 | * (dev_flags and interface) */ |
| 477 | − return phy_init_hw(phydev); | |
| 477 | + err = phy_init_hw(phydev); | |
| 478 | + if (err) | |
| 479 | + phy_detach(phydev); | |
| 480 | + | |
| 481 | + return err; | |
| 478 | 482 | } |
| 479 | 483 | |
| 480 | 484 | /** |
| @@ -433,4 +433,19 @@ config USB_SIERRA_NET · 432 unmodified lines | ||
| 433 | 433 | To compile this driver as a module, choose M here: the |
| 434 | 434 | module will be called sierra_net. |
| 435 | 435 | |
| 436 | +config USB_VL600 | |
| 437 | + tristate "LG VL600 modem dongle" | |
| 438 | + depends on USB_NET_CDCETHER | |
| 439 | + select USB_ACM | |
| 440 | + help | |
| 441 | + Select this if you want to use an LG Electronics 4G/LTE usb modem | |
| 442 | + called VL600. This driver only handles the ethernet | |
| 443 | + interface exposed by the modem firmware. To establish a connection | |
| 444 | + you will first need a userspace program that sends the right | |
| 445 | + command to the modem through its CDC ACM port, and most | |
| 446 | + likely also a DHCP client. See this thread about using the | |
| 447 | + 4G modem from Verizon: | |
| 448 | + | |
| 449 | + http://ubuntuforums.org/showpost.php?p=10589647&postcount=17 | |
| 450 | + | |
| 436 | 451 | endmenu |
| @@ -27,4 +27,5 @@ obj-$(CONFIG_USB_IPHETH) += ipheth.o · 26 unmodified lines | ||
| 27 | 27 | obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o |
| 28 | 28 | obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o |
| 29 | 29 | obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o |
| 30 | +obj-$(CONFIG_USB_VL600) += lg-vl600.o | |
| 30 | 31 | |
| @@ -378,7 +378,7 @@ static void dumpspeed(struct usbnet *dev, __le32 *speeds) · 377 unmodified lines | ||
| 378 | 378 | __le32_to_cpu(speeds[1]) / 1000); |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | −static void cdc_status(struct usbnet *dev, struct urb *urb) | |
| 381 | +void usbnet_cdc_status(struct usbnet *dev, struct urb *urb) | |
| 382 | 382 | { |
| 383 | 383 | struct usb_cdc_notification *event; |
| 384 | 384 | |
| @@ -418,8 +418,9 @@ static void cdc_status(struct usbnet *dev, struct urb *urb) · 33 unmodified lines | ||
| 418 | 418 | break; |
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | +EXPORT_SYMBOL_GPL(usbnet_cdc_status); | |
| 421 | 422 | |
| 422 | −static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |
| 423 | +int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |
| 423 | 424 | { |
| 424 | 425 | int status; |
| 425 | 426 | struct cdc_state *info = (void *) &dev->data; |
| @@ -441,6 +442,7 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) · 15 unmodified lines | ||
| 441 | 442 | */ |
| 442 | 443 | return 0; |
| 443 | 444 | } |
| 445 | +EXPORT_SYMBOL_GPL(usbnet_cdc_bind); | |
| 444 | 446 | |
| 445 | 447 | static int cdc_manage_power(struct usbnet *dev, int on) |
| 446 | 448 | { |
| @@ -452,18 +454,18 @@ static const struct driver_info cdc_info = { · 5 unmodified lines | ||
| 452 | 454 | .description = "CDC Ethernet Device", |
| 453 | 455 | .flags = FLAG_ETHER, |
| 454 | 456 | // .check_connect = cdc_check_connect, |
| 455 | − .bind = cdc_bind, | |
| 457 | + .bind = usbnet_cdc_bind, | |
| 456 | 458 | .unbind = usbnet_cdc_unbind, |
| 457 | − .status = cdc_status, | |
| 459 | + .status = usbnet_cdc_status, | |
| 458 | 460 | .manage_power = cdc_manage_power, |
| 459 | 461 | }; |
| 460 | 462 | |
| 461 | 463 | static const struct driver_info mbm_info = { |
| 462 | 464 | .description = "Mobile Broadband Network Device", |
| 463 | 465 | .flags = FLAG_WWAN, |
| 464 | − .bind = cdc_bind, | |
| 466 | + .bind = usbnet_cdc_bind, | |
| 465 | 467 | .unbind = usbnet_cdc_unbind, |
| 466 | − .status = cdc_status, | |
| 468 | + .status = usbnet_cdc_status, | |
| 467 | 469 | .manage_power = cdc_manage_power, |
| 468 | 470 | }; |
| 469 | 471 | |
| @@ -560,6 +562,13 @@ static const struct usb_device_id products [] = { · 90 unmodified lines | ||
| 560 | 562 | .driver_info = 0, |
| 561 | 563 | }, |
| 562 | 564 | |
| 565 | +/* LG Electronics VL600 wants additional headers on every frame */ | |
| 566 | +{ | |
| 567 | + USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, | |
| 568 | + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | |
| 569 | + .driver_info = 0, | |
| 570 | +}, | |
| 571 | + | |
| 563 | 572 | /* |
| 564 | 573 | * WHITELIST!!! |
| 565 | 574 | * |
| @@ -0,0 +1,346 @@ | ||
| 1 | +/* | |
| 2 | + * Ethernet interface part of the LG VL600 LTE modem (4G dongle) | |
| 3 | + * | |
| 4 | + * Copyright (C) 2011 Intel Corporation | |
| 5 | + * Author: Andrzej Zaborowski <balrogg@gmail.com> | |
| 6 | + * | |
| 7 | + * This program is free software; you can redistribute it and/or modify | |
| 8 | + * it under the terms of the GNU General Public License as published by | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or | |
| 10 | + * (at your option) any later version. | |
| 11 | + * | |
| 12 | + * This program is distributed in the hope that it will be useful, | |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | + * GNU General Public License for more details. | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License | |
| 18 | + * along with this program; if not, write to the Free Software | |
| 19 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 20 | + */ | |
| 21 | +#include <linux/etherdevice.h> | |
| 22 | +#include <linux/ethtool.h> | |
| 23 | +#include <linux/mii.h> | |
| 24 | +#include <linux/usb.h> | |
| 25 | +#include <linux/usb/cdc.h> | |
| 26 | +#include <linux/usb/usbnet.h> | |
| 27 | +#include <linux/if_ether.h> | |
| 28 | +#include <linux/if_arp.h> | |
| 29 | +#include <linux/inetdevice.h> | |
| 30 | + | |
| 31 | +/* | |
| 32 | + * The device has a CDC ACM port for modem control (it claims to be | |
| 33 | + * CDC ACM anyway) and a CDC Ethernet port for actual network data. | |
| 34 | + * It will however ignore data on both ports that is not encapsulated | |
| 35 | + * in a specific way, any data returned is also encapsulated the same | |
| 36 | + * way. The headers don't seem to follow any popular standard. | |
| 37 | + * | |
| 38 | + * This driver adds and strips these headers from the ethernet frames | |
| 39 | + * sent/received from the CDC Ethernet port. The proprietary header | |
| 40 | + * replaces the standard ethernet header in a packet so only actual | |
| 41 | + * ethernet frames are allowed. The headers allow some form of | |
| 42 | + * multiplexing by using non standard values of the .h_proto field. | |
| 43 | + * Windows/Mac drivers do send a couple of such frames to the device | |
| 44 | + * during initialisation, with protocol set to 0x0906 or 0x0b06 and (what | |
| 45 | + * seems to be) a flag in the .dummy_flags. This doesn't seem necessary | |
| 46 | + * for modem operation but can possibly be used for GPS or other funcitons. | |
| 47 | + */ | |
| 48 | + | |
| 49 | +struct vl600_frame_hdr { | |
| 50 | + __le32 len; | |
| 51 | + __le32 serial; | |
| 52 | + __le32 pkt_cnt; | |
| 53 | + __le32 dummy_flags; | |
| 54 | + __le32 dummy; | |
| 55 | + __le32 magic; | |
| 56 | +} __attribute__((packed)); | |
| 57 | + | |
| 58 | +struct vl600_pkt_hdr { | |
| 59 | + __le32 dummy[2]; | |
| 60 | + __le32 len; | |
| 61 | + __be16 h_proto; | |
| 62 | +} __attribute__((packed)); | |
| 63 | + | |
| 64 | +struct vl600_state { | |
| 65 | + struct sk_buff *current_rx_buf; | |
| 66 | +}; | |
| 67 | + | |
| 68 | +static int vl600_bind(struct usbnet *dev, struct usb_interface *intf) | |
| 69 | +{ | |
| 70 | + int ret; | |
| 71 | + struct vl600_state *s = kzalloc(sizeof(struct vl600_state), GFP_KERNEL); | |
| 72 | + | |
| 73 | + if (!s) | |
| 74 | + return -ENOMEM; | |
| 75 | + | |
| 76 | + ret = usbnet_cdc_bind(dev, intf); | |
| 77 | + if (ret) { | |
| 78 | + kfree(s); | |
| 79 | + return ret; | |
| 80 | + } | |
| 81 | + | |
| 82 | + dev->driver_priv = s; | |
| 83 | + | |
| 84 | + /* ARP packets don't go through, but they're also of no use. The | |
| 85 | + * subnet has only two hosts anyway: us and the gateway / DHCP | |
| 86 | + * server (probably simulated by modem firmware or network operator) | |
| 87 | + * whose address changes everytime we connect to the intarwebz and | |
| 88 | + * who doesn't bother answering ARP requests either. So hardware | |
| 89 | + * addresses have no meaning, the destination and the source of every | |
| 90 | + * packet depend only on whether it is on the IN or OUT endpoint. */ | |
| 91 | + dev->net->flags |= IFF_NOARP; | |
| 92 | + | |
| 93 | + return ret; | |
| 94 | +} | |
| 95 | + | |
| 96 | +static void vl600_unbind(struct usbnet *dev, struct usb_interface *intf) | |
| 97 | +{ | |
| 98 | + struct vl600_state *s = dev->driver_priv; | |
| 99 | + | |
| 100 | + if (s->current_rx_buf) | |
| 101 | + dev_kfree_skb(s->current_rx_buf); | |
| 102 | + | |
| 103 | + kfree(s); | |
| 104 | + | |
| 105 | + return usbnet_cdc_unbind(dev, intf); | |
| 106 | +} | |
| 107 | + | |
| 108 | +static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |
| 109 | +{ | |
| 110 | + struct vl600_frame_hdr *frame; | |
| 111 | + struct vl600_pkt_hdr *packet; | |
| 112 | + struct ethhdr *ethhdr; | |
| 113 | + int packet_len, count; | |
| 114 | + struct sk_buff *buf = skb; | |
| 115 | + struct sk_buff *clone; | |
| 116 | + struct vl600_state *s = dev->driver_priv; | |
| 117 | + | |
| 118 | + /* Frame lengths are generally 4B multiplies but every couple of | |
| 119 | + * hours there's an odd number of bytes sized yet correct frame, | |
| 120 | + * so don't require this. */ | |
| 121 | + | |
| 122 | + /* Allow a packet (or multiple packets batched together) to be | |
| 123 | + * split across many frames. We don't allow a new batch to | |
| 124 | + * begin in the same frame another one is ending however, and no | |
| 125 | + * leading or trailing pad bytes. */ | |
| 126 | + if (s->current_rx_buf) { | |
| 127 | + frame = (struct vl600_frame_hdr *) s->current_rx_buf->data; | |
| 128 | + if (skb->len + s->current_rx_buf->len > | |
| 129 | + le32_to_cpup(&frame->len)) { | |
| 130 | + netif_err(dev, ifup, dev->net, "Fragment too long\n"); | |
| 131 | + dev->net->stats.rx_length_errors++; | |
| 132 | + goto error; | |
| 133 | + } | |
| 134 | + | |
| 135 | + buf = s->current_rx_buf; | |
| 136 | + memcpy(skb_put(buf, skb->len), skb->data, skb->len); | |
| 137 | + } else if (skb->len < 4) { | |
| 138 | + netif_err(dev, ifup, dev->net, "Frame too short\n"); | |
| 139 | + dev->net->stats.rx_length_errors++; | |
| 140 | + goto error; | |
| 141 | + } | |
| 142 | + | |
| 143 | + frame = (struct vl600_frame_hdr *) buf->data; | |
| 144 | + /* NOTE: Should check that frame->magic == 0x53544448? | |
| 145 | + * Otherwise if we receive garbage at the beginning of the frame | |
| 146 | + * we may end up allocating a huge buffer and saving all the | |
| 147 | + * future incoming data into it. */ | |
| 148 | + | |
| 149 | + if (buf->len < sizeof(*frame) || | |
| 150 | + buf->len != le32_to_cpup(&frame->len)) { | |
| 151 | + /* Save this fragment for later assembly */ | |
| 152 | + if (s->current_rx_buf) | |
| 153 | + return 0; | |
| 154 | + | |
| 155 | + s->current_rx_buf = skb_copy_expand(skb, 0, | |
| 156 | + le32_to_cpup(&frame->len), GFP_ATOMIC); | |
| 157 | + if (!s->current_rx_buf) { | |
| 158 | + netif_err(dev, ifup, dev->net, "Reserving %i bytes " | |
| 159 | + "for packet assembly failed.\n", | |
| 160 | + le32_to_cpup(&frame->len)); | |
| 161 | + dev->net->stats.rx_errors++; | |
| 162 | + } | |
| 163 | + | |
| 164 | + return 0; | |
| 165 | + } | |
| 166 | + | |
| 167 | + count = le32_to_cpup(&frame->pkt_cnt); | |
| 168 | + | |
| 169 | + skb_pull(buf, sizeof(*frame)); | |
| 170 | + | |
| 171 | + while (count--) { | |
| 172 | + if (buf->len < sizeof(*packet)) { | |
| 173 | + netif_err(dev, ifup, dev->net, "Packet too short\n"); | |
| 174 | + goto error; | |
| 175 | + } | |
| 176 | + | |
| 177 | + packet = (struct vl600_pkt_hdr *) buf->data; | |
| 178 | + packet_len = sizeof(*packet) + le32_to_cpup(&packet->len); | |
| 179 | + if (packet_len > buf->len) { | |
| 180 | + netif_err(dev, ifup, dev->net, | |
| 181 | + "Bad packet length stored in header\n"); | |
| 182 | + goto error; | |
| 183 | + } | |
| 184 | + | |
| 185 | + /* Packet header is same size as the ethernet header | |
| 186 | + * (sizeof(*packet) == sizeof(*ethhdr)), additionally | |
| 187 | + * the h_proto field is in the same place so we just leave it | |
| 188 | + * alone and fill in the remaining fields. | |
| 189 | + */ | |
| 190 | + ethhdr = (struct ethhdr *) skb->data; | |
| 191 | + if (be16_to_cpup(ðhdr->h_proto) == ETH_P_ARP && | |
| 192 | + buf->len > 0x26) { | |
| 193 | + /* Copy the addresses from packet contents */ | |
| 194 | + memcpy(ethhdr->h_source, | |
| 195 | + &buf->data[sizeof(*ethhdr) + 0x8], | |
| 196 | + ETH_ALEN); | |
| 197 | + memcpy(ethhdr->h_dest, | |
| 198 | + &buf->data[sizeof(*ethhdr) + 0x12], | |
| 199 | + ETH_ALEN); | |
| 200 | + } else { | |
| 201 | + memset(ethhdr->h_source, 0, ETH_ALEN); | |
| 202 | + memcpy(ethhdr->h_dest, dev->net->dev_addr, ETH_ALEN); | |
| 203 | + } | |
| 204 | + | |
| 205 | + if (count) { | |
| 206 | + /* Not the last packet in this batch */ | |
| 207 | + clone = skb_clone(buf, GFP_ATOMIC); | |
| 208 | + if (!clone) | |
| 209 | + goto error; | |
| 210 | + | |
| 211 | + skb_trim(clone, packet_len); | |
| 212 | + usbnet_skb_return(dev, clone); | |
| 213 | + | |
| 214 | + skb_pull(buf, (packet_len + 3) & ~3); | |
| 215 | + } else { | |
| 216 | + skb_trim(buf, packet_len); | |
| 217 | + | |
| 218 | + if (s->current_rx_buf) { | |
| 219 | + usbnet_skb_return(dev, buf); | |
| 220 | + s->current_rx_buf = NULL; | |
| 221 | + return 0; | |
| 222 | + } | |
| 223 | + | |
| 224 | + return 1; | |
| 225 | + } | |
| 226 | + } | |
| 227 | + | |
| 228 | +error: | |
| 229 | + if (s->current_rx_buf) { | |
| 230 | + dev_kfree_skb_any(s->current_rx_buf); | |
| 231 | + s->current_rx_buf = NULL; | |
| 232 | + } | |
| 233 | + dev->net->stats.rx_errors++; | |
| 234 | + return 0; | |
| 235 | +} | |
| 236 | + | |
| 237 | +static struct sk_buff *vl600_tx_fixup(struct usbnet *dev, | |
| 238 | + struct sk_buff *skb, gfp_t flags) | |
| 239 | +{ | |
| 240 | + struct sk_buff *ret; | |
| 241 | + struct vl600_frame_hdr *frame; | |
| 242 | + struct vl600_pkt_hdr *packet; | |
| 243 | + static uint32_t serial = 1; | |
| 244 | + int orig_len = skb->len - sizeof(struct ethhdr); | |
| 245 | + int full_len = (skb->len + sizeof(struct vl600_frame_hdr) + 3) & ~3; | |
| 246 | + | |
| 247 | + frame = (struct vl600_frame_hdr *) skb->data; | |
| 248 | + if (skb->len > sizeof(*frame) && skb->len == le32_to_cpup(&frame->len)) | |
| 249 | + return skb; /* Already encapsulated? */ | |
| 250 | + | |
| 251 | + if (skb->len < sizeof(struct ethhdr)) | |
| 252 | + /* Drop, device can only deal with ethernet packets */ | |
| 253 | + return NULL; | |
| 254 | + | |
| 255 | + if (!skb_cloned(skb)) { | |
| 256 | + int headroom = skb_headroom(skb); | |
| 257 | + int tailroom = skb_tailroom(skb); | |
| 258 | + | |
| 259 | + if (tailroom >= full_len - skb->len - sizeof(*frame) && | |
| 260 | + headroom >= sizeof(*frame)) | |
| 261 | + /* There's enough head and tail room */ | |
| 262 | + goto encapsulate; | |
| 263 | + | |
| 264 | + if (headroom + tailroom + skb->len >= full_len) { | |
| 265 | + /* There's enough total room, just readjust */ | |
| 266 | + skb->data = memmove(skb->head + sizeof(*frame), | |
| 267 | + skb->data, skb->len); | |
| 268 | + skb_set_tail_pointer(skb, skb->len); | |
| 269 | + goto encapsulate; | |
| 270 | + } | |
| 271 | + } | |
| 272 | + | |
| 273 | + /* Alloc a new skb with the required size */ | |
| 274 | + ret = skb_copy_expand(skb, sizeof(struct vl600_frame_hdr), full_len - | |
| 275 | + skb->len - sizeof(struct vl600_frame_hdr), flags); | |
| 276 | + dev_kfree_skb_any(skb); | |
| 277 | + if (!ret) | |
| 278 | + return ret; | |
| 279 | + skb = ret; | |
| 280 | + | |
| 281 | +encapsulate: | |
| 282 | + /* Packet header is same size as ethernet packet header | |
| 283 | + * (sizeof(*packet) == sizeof(struct ethhdr)), additionally the | |
| 284 | + * h_proto field is in the same place so we just leave it alone and | |
| 285 | + * overwrite the remaining fields. | |
| 286 | + */ | |
| 287 | + packet = (struct vl600_pkt_hdr *) skb->data; | |
| 288 | + memset(&packet->dummy, 0, sizeof(packet->dummy)); | |
| 289 | + packet->len = cpu_to_le32(orig_len); | |
| 290 | + | |
| 291 | + frame = (struct vl600_frame_hdr *) skb_push(skb, sizeof(*frame)); | |
| 292 | + memset(frame, 0, sizeof(*frame)); | |
| 293 | + frame->len = cpu_to_le32(full_len); | |
| 294 | + frame->serial = cpu_to_le32(serial++); | |
| 295 | + frame->pkt_cnt = cpu_to_le32(1); | |
| 296 | + | |
| 297 | + if (skb->len < full_len) /* Pad */ | |
| 298 | + skb_put(skb, full_len - skb->len); | |
| 299 | + | |
| 300 | + return skb; | |
| 301 | +} | |
| 302 | + | |
| 303 | +static const struct driver_info vl600_info = { | |
| 304 | + .description = "LG VL600 modem", | |
| 305 | + .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE, | |
| 306 | + .bind = vl600_bind, | |
| 307 | + .unbind = vl600_unbind, | |
| 308 | + .status = usbnet_cdc_status, | |
| 309 | + .rx_fixup = vl600_rx_fixup, | |
| 310 | + .tx_fixup = vl600_tx_fixup, | |
| 311 | +}; | |
| 312 | + | |
| 313 | +static const struct usb_device_id products[] = { | |
| 314 | + { | |
| 315 | + USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, | |
| 316 | + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | |
| 317 | + .driver_info = (unsigned long) &vl600_info, | |
| 318 | + }, | |
| 319 | + {}, /* End */ | |
| 320 | +}; | |
| 321 | +MODULE_DEVICE_TABLE(usb, products); | |
| 322 | + | |
| 323 | +static struct usb_driver lg_vl600_driver = { | |
| 324 | + .name = "lg-vl600", | |
| 325 | + .id_table = products, | |
| 326 | + .probe = usbnet_probe, | |
| 327 | + .disconnect = usbnet_disconnect, | |
| 328 | + .suspend = usbnet_suspend, | |
| 329 | + .resume = usbnet_resume, | |
| 330 | +}; | |
| 331 | + | |
| 332 | +static int __init vl600_init(void) | |
| 333 | +{ | |
| 334 | + return usb_register(&lg_vl600_driver); | |
| 335 | +} | |
| 336 | +module_init(vl600_init); | |
| 337 | + | |
| 338 | +static void __exit vl600_exit(void) | |
| 339 | +{ | |
| 340 | + usb_deregister(&lg_vl600_driver); | |
| 341 | +} | |
| 342 | +module_exit(vl600_exit); | |
| 343 | + | |
| 344 | +MODULE_AUTHOR("Anrzej Zaborowski"); | |
| 345 | +MODULE_DESCRIPTION("LG-VL600 modem's ethernet link"); | |
| 346 | +MODULE_LICENSE("GPL"); | |
| @@ -387,8 +387,12 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) · 386 unmodified lines | ||
| 387 | 387 | static inline void rx_process (struct usbnet *dev, struct sk_buff *skb) |
| 388 | 388 | { |
| 389 | 389 | if (dev->driver_info->rx_fixup && |
| 390 | − !dev->driver_info->rx_fixup (dev, skb)) | |
| 391 | − goto error; | |
| 390 | + !dev->driver_info->rx_fixup (dev, skb)) { | |
| 391 | + /* With RX_ASSEMBLE, rx_fixup() must update counters */ | |
| 392 | + if (!(dev->driver_info->flags & FLAG_RX_ASSEMBLE)) | |
| 393 | + dev->net->stats.rx_errors++; | |
| 394 | + goto done; | |
| 395 | + } | |
| 392 | 396 | // else network stack removes extra byte if we forced a short packet |
| 393 | 397 | |
| 394 | 398 | if (skb->len) { |
| @@ -401,8 +405,8 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb) · 6 unmodified lines | ||
| 401 | 405 | } |
| 402 | 406 | |
| 403 | 407 | netif_dbg(dev, rx_err, dev->net, "drop\n"); |
| 404 | −error: | |
| 405 | 408 | dev->net->stats.rx_errors++; |
| 409 | +done: | |
| 406 | 410 | skb_queue_tail(&dev->done, skb); |
| 407 | 411 | } |
| 408 | 412 | |
| @@ -443,6 +443,7 @@ void atm_dev_signal_change(struct atm_dev *dev, char signal); · 442 unmodified lines | ||
| 443 | 443 | |
| 444 | 444 | void vcc_insert_socket(struct sock *sk); |
| 445 | 445 | |
| 446 | +void atm_dev_release_vccs(struct atm_dev *dev); | |
| 446 | 447 | |
| 447 | 448 | /* |
| 448 | 449 | * This is approximately the algorithm used by alloc_skb. |
| @@ -88,8 +88,6 @@ struct cn_queue_dev { · 87 unmodified lines | ||
| 88 | 88 | atomic_t refcnt; |
| 89 | 89 | unsigned char name[CN_CBQ_NAMELEN]; |
| 90 | 90 | |
| 91 | − struct workqueue_struct *cn_queue; | |
| 92 | − | |
| 93 | 91 | struct list_head queue_list; |
| 94 | 92 | spinlock_t queue_lock; |
| 95 | 93 | |
| @@ -101,20 +99,13 @@ struct cn_callback_id { · 5 unmodified lines | ||
| 101 | 99 | struct cb_id id; |
| 102 | 100 | }; |
| 103 | 101 | |
| 104 | −struct cn_callback_data { | |
| 105 | − struct sk_buff *skb; | |
| 106 | − void (*callback) (struct cn_msg *, struct netlink_skb_parms *); | |
| 107 | − | |
| 108 | − void *free; | |
| 109 | −}; | |
| 110 | − | |
| 111 | 102 | struct cn_callback_entry { |
| 112 | 103 | struct list_head callback_entry; |
| 113 | − struct work_struct work; | |
| 104 | + atomic_t refcnt; | |
| 114 | 105 | struct cn_queue_dev *pdev; |
| 115 | 106 | |
| 116 | 107 | struct cn_callback_id id; |
| 117 | − struct cn_callback_data data; | |
| 108 | + void (*callback) (struct cn_msg *, struct netlink_skb_parms *); | |
| 118 | 109 | |
| 119 | 110 | u32 seq, group; |
| 120 | 111 | }; |
| @@ -138,13 +129,12 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, · 17 unmodified lines | ||
| 138 | 129 | struct cb_id *id, |
| 139 | 130 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); |
| 140 | 131 | void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); |
| 132 | +void cn_queue_release_callback(struct cn_callback_entry *); | |
| 141 | 133 | |
| 142 | 134 | struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *); |
| 143 | 135 | void cn_queue_free_dev(struct cn_queue_dev *dev); |
| 144 | 136 | |
| 145 | 137 | int cn_cb_equal(struct cb_id *, struct cb_id *); |
| 146 | 138 | |
| 147 | −void cn_queue_wrapper(struct work_struct *work); | |
| 148 | − | |
| 149 | 139 | #endif /* __KERNEL__ */ |
| 150 | 140 | #endif /* __CONNECTOR_H */ |
| @@ -126,7 +126,7 @@ struct sk_buff; · 125 unmodified lines | ||
| 126 | 126 | * GRO uses frags we allocate at least 16 regardless of page size. |
| 127 | 127 | */ |
| 128 | 128 | #if (65536/PAGE_SIZE + 2) < 16 |
| 129 | −#define MAX_SKB_FRAGS 16 | |
| 129 | +#define MAX_SKB_FRAGS 16UL | |
| 130 | 130 | #else |
| 131 | 131 | #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2) |
| 132 | 132 | #endif |
| @@ -102,6 +102,7 @@ struct driver_info { · 101 unmodified lines | ||
| 102 | 102 | * Affects statistic (counters) and short packet handling. |
| 103 | 103 | */ |
| 104 | 104 | #define FLAG_MULTI_PACKET 0x1000 |
| 105 | +#define FLAG_RX_ASSEMBLE 0x2000 /* rx packets may span >1 frames */ | |
| 105 | 106 | |
| 106 | 107 | /* init device ... can sleep, or cause probe() failure */ |
| 107 | 108 | int (*bind)(struct usbnet *, struct usb_interface *); |
| @@ -172,7 +173,9 @@ struct cdc_state { · 64 unmodified lines | ||
| 172 | 173 | }; |
| 173 | 174 | |
| 174 | 175 | extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); |
| 176 | +extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *); | |
| 175 | 177 | extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); |
| 178 | +extern void usbnet_cdc_status(struct usbnet *, struct urb *); | |
| 176 | 179 | |
| 177 | 180 | /* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ |
| 178 | 181 | #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ |
| @@ -286,5 +286,21 @@ static inline void ipv6_ib_mc_map(const struct in6_addr *addr, · 285 unmodified lines | ||
| 286 | 286 | buf[9] = broadcast[9]; |
| 287 | 287 | memcpy(buf + 10, addr->s6_addr + 6, 10); |
| 288 | 288 | } |
| 289 | + | |
| 290 | +static inline int ipv6_ipgre_mc_map(const struct in6_addr *addr, | |
| 291 | + const unsigned char *broadcast, char *buf) | |
| 292 | +{ | |
| 293 | + if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0) { | |
| 294 | + memcpy(buf, broadcast, 4); | |
| 295 | + } else { | |
| 296 | + /* v4mapped? */ | |
| 297 | + if ((addr->s6_addr32[0] | addr->s6_addr32[1] | | |
| 298 | + (addr->s6_addr32[2] ^ htonl(0x0000ffff))) != 0) | |
| 299 | + return -EINVAL; | |
| 300 | + memcpy(buf, &addr->s6_addr32[3], 4); | |
| 301 | + } | |
| 302 | + return 0; | |
| 303 | +} | |
| 304 | + | |
| 289 | 305 | #endif |
| 290 | 306 | #endif |
| @@ -339,6 +339,14 @@ static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, ch · 338 unmodified lines | ||
| 339 | 339 | buf[16] = addr & 0x0f; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | +static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast, char *buf) | |
| 343 | +{ | |
| 344 | + if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0) | |
| 345 | + memcpy(buf, broadcast, 4); | |
| 346 | + else | |
| 347 | + memcpy(buf, &naddr, sizeof(naddr)); | |
| 348 | +} | |
| 349 | + | |
| 342 | 350 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 343 | 351 | #include <linux/ipv6.h> |
| 344 | 352 | #endif |
| @@ -1051,16 +1051,17 @@ static int atalk_release(struct socket *sock) · 1050 unmodified lines | ||
| 1051 | 1051 | { |
| 1052 | 1052 | struct sock *sk = sock->sk; |
| 1053 | 1053 | |
| 1054 | − sock_hold(sk); | |
| 1055 | − lock_sock(sk); | |
| 1056 | 1054 | if (sk) { |
| 1055 | + sock_hold(sk); | |
| 1056 | + lock_sock(sk); | |
| 1057 | + | |
| 1057 | 1058 | sock_orphan(sk); |
| 1058 | 1059 | sock->sk = NULL; |
| 1059 | 1060 | atalk_destroy_socket(sk); |
| 1060 | − } | |
| 1061 | − release_sock(sk); | |
| 1062 | − sock_put(sk); | |
| 1063 | 1061 | |
| 1062 | + release_sock(sk); | |
| 1063 | + sock_put(sk); | |
| 1064 | + } | |
| 1064 | 1065 | return 0; |
| 1065 | 1066 | } |
| 1066 | 1067 | |
| @@ -252,6 +252,7 @@ void atm_dev_release_vccs(struct atm_dev *dev) · 251 unmodified lines | ||
| 252 | 252 | } |
| 253 | 253 | write_unlock_irq(&vcc_sklist_lock); |
| 254 | 254 | } |
| 255 | +EXPORT_SYMBOL(atm_dev_release_vccs); | |
| 255 | 256 | |
| 256 | 257 | static int adjust_tp(struct atm_trafprm *tp, unsigned char aal) |
| 257 | 258 | { |
| @@ -1475,7 +1475,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, · 1474 unmodified lines | ||
| 1475 | 1475 | ip6h->payload_len == 0) |
| 1476 | 1476 | return 0; |
| 1477 | 1477 | |
| 1478 | − len = ntohs(ip6h->payload_len); | |
| 1478 | + len = ntohs(ip6h->payload_len) + sizeof(*ip6h); | |
| 1479 | 1479 | if (skb->len < len) |
| 1480 | 1480 | return -EINVAL; |
| 1481 | 1481 | |
| @@ -213,7 +213,7 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br) · 212 unmodified lines | ||
| 213 | 213 | |
| 214 | 214 | /* user has chosen a value so keep it */ |
| 215 | 215 | if (br->flags & BR_SET_MAC_ADDR) |
| 216 | − return; | |
| 216 | + return false; | |
| 217 | 217 | |
| 218 | 218 | list_for_each_entry(p, &br->port_list, list) { |
| 219 | 219 | if (addr == br_mac_zero || |
| @@ -1454,6 +1454,27 @@ static inline void net_timestamp_check(struct sk_buff *skb) · 1453 unmodified lines | ||
| 1454 | 1454 | __net_timestamp(skb); |
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | +static inline bool is_skb_forwardable(struct net_device *dev, | |
| 1458 | + struct sk_buff *skb) | |
| 1459 | +{ | |
| 1460 | + unsigned int len; | |
| 1461 | + | |
| 1462 | + if (!(dev->flags & IFF_UP)) | |
| 1463 | + return false; | |
| 1464 | + | |
| 1465 | + len = dev->mtu + dev->hard_header_len + VLAN_HLEN; | |
| 1466 | + if (skb->len <= len) | |
| 1467 | + return true; | |
| 1468 | + | |
| 1469 | + /* if TSO is enabled, we don't care about the length as the packet | |
| 1470 | + * could be forwarded without being segmented before | |
| 1471 | + */ | |
| 1472 | + if (skb_is_gso(skb)) | |
| 1473 | + return true; | |
| 1474 | + | |
| 1475 | + return false; | |
| 1476 | +} | |
| 1477 | + | |
| 1457 | 1478 | /** |
| 1458 | 1479 | * dev_forward_skb - loopback an skb to another netif |
| 1459 | 1480 | * |
| @@ -1477,8 +1498,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) · 17 unmodified lines | ||
| 1477 | 1498 | skb_orphan(skb); |
| 1478 | 1499 | nf_reset(skb); |
| 1479 | 1500 | |
| 1480 | − if (unlikely(!(dev->flags & IFF_UP) || | |
| 1481 | − (skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) { | |
| 1501 | + if (unlikely(!is_skb_forwardable(dev, skb))) { | |
| 1482 | 1502 | atomic_long_inc(&dev->rx_dropped); |
| 1483 | 1503 | kfree_skb(skb); |
| 1484 | 1504 | return NET_RX_DROP; |
| @@ -215,6 +215,9 @@ int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir) · 214 unmodified lines | ||
| 215 | 215 | case ARPHRD_INFINIBAND: |
| 216 | 216 | ip_ib_mc_map(addr, dev->broadcast, haddr); |
| 217 | 217 | return 0; |
| 218 | + case ARPHRD_IPGRE: | |
| 219 | + ip_ipgre_mc_map(addr, dev->broadcast, haddr); | |
| 220 | + return 0; | |
| 218 | 221 | default: |
| 219 | 222 | if (dir) { |
| 220 | 223 | memcpy(haddr, dev->broadcast, dev->addr_len); |
| @@ -1068,6 +1068,7 @@ static void ip_fib_net_exit(struct net *net) · 1067 unmodified lines | ||
| 1068 | 1068 | fib4_rules_exit(net); |
| 1069 | 1069 | #endif |
| 1070 | 1070 | |
| 1071 | + rtnl_lock(); | |
| 1071 | 1072 | for (i = 0; i < FIB_TABLE_HASHSZ; i++) { |
| 1072 | 1073 | struct fib_table *tb; |
| 1073 | 1074 | struct hlist_head *head; |
| @@ -1080,6 +1081,7 @@ static void ip_fib_net_exit(struct net *net) · 6 unmodified lines | ||
| 1080 | 1081 | fib_free_table(tb); |
| 1081 | 1082 | } |
| 1082 | 1083 | } |
| 1084 | + rtnl_unlock(); | |
| 1083 | 1085 | kfree(net->ipv4.fib_table_hash); |
| 1084 | 1086 | } |
| 1085 | 1087 | |
| @@ -341,6 +341,8 @@ int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int d · 340 unmodified lines | ||
| 341 | 341 | case ARPHRD_INFINIBAND: |
| 342 | 342 | ipv6_ib_mc_map(addr, dev->broadcast, buf); |
| 343 | 343 | return 0; |
| 344 | + case ARPHRD_IPGRE: | |
| 345 | + return ipv6_ipgre_mc_map(addr, dev->broadcast, buf); | |
| 344 | 346 | default: |
| 345 | 347 | if (dir) { |
| 346 | 348 | memcpy(buf, dev->broadcast, dev->addr_len); |
| @@ -1205,7 +1205,7 @@ SCTP_STATIC __init int sctp_init(void) · 1204 unmodified lines | ||
| 1205 | 1205 | if ((sctp_assoc_hashsize > (64 * 1024)) && order > 0) |
| 1206 | 1206 | continue; |
| 1207 | 1207 | sctp_assoc_hashtable = (struct sctp_hashbucket *) |
| 1208 | − __get_free_pages(GFP_ATOMIC, order); | |
| 1208 | + __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, order); | |
| 1209 | 1209 | } while (!sctp_assoc_hashtable && --order > 0); |
| 1210 | 1210 | if (!sctp_assoc_hashtable) { |
| 1211 | 1211 | pr_err("Failed association hash alloc\n"); |
| @@ -1238,7 +1238,7 @@ SCTP_STATIC __init int sctp_init(void) · 26 unmodified lines | ||
| 1238 | 1238 | if ((sctp_port_hashsize > (64 * 1024)) && order > 0) |
| 1239 | 1239 | continue; |
| 1240 | 1240 | sctp_port_hashtable = (struct sctp_bind_hashbucket *) |
| 1241 | − __get_free_pages(GFP_ATOMIC, order); | |
| 1241 | + __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, order); | |
| 1242 | 1242 | } while (!sctp_port_hashtable && --order > 0); |
| 1243 | 1243 | if (!sctp_port_hashtable) { |
| 1244 | 1244 | pr_err("Failed bind hash alloc\n"); |