aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c36
-rw-r--r--drivers/net/cxgb3/t3_hw.c2
-rw-r--r--drivers/net/netconsole.c11
-rw-r--r--drivers/net/usb/smsc95xx.c15
-rw-r--r--drivers/net/usb/smsc95xx.h3
-rw-r--r--drivers/net/virtio_net.c24
6 files changed, 56 insertions, 35 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index fd738367d740..e3af662b0559 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2211,33 +2211,24 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
2211{ 2211{
2212 struct bonding *bond = netdev_priv(bond_dev); 2212 struct bonding *bond = netdev_priv(bond_dev);
2213 struct slave *slave; 2213 struct slave *slave;
2214 int i, found = 0; 2214 int i, res = -ENODEV;
2215
2216 if (info->slave_id < 0) {
2217 return -ENODEV;
2218 }
2219 2215
2220 read_lock(&bond->lock); 2216 read_lock(&bond->lock);
2221 2217
2222 bond_for_each_slave(bond, slave, i) { 2218 bond_for_each_slave(bond, slave, i) {
2223 if (i == (int)info->slave_id) { 2219 if (i == (int)info->slave_id) {
2224 found = 1; 2220 res = 0;
2221 strcpy(info->slave_name, slave->dev->name);
2222 info->link = slave->link;
2223 info->state = slave->state;
2224 info->link_failure_count = slave->link_failure_count;
2225 break; 2225 break;
2226 } 2226 }
2227 } 2227 }
2228 2228
2229 read_unlock(&bond->lock); 2229 read_unlock(&bond->lock);
2230 2230
2231 if (found) { 2231 return res;
2232 strcpy(info->slave_name, slave->dev->name);
2233 info->link = slave->link;
2234 info->state = slave->state;
2235 info->link_failure_count = slave->link_failure_count;
2236 } else {
2237 return -ENODEV;
2238 }
2239
2240 return 0;
2241} 2232}
2242 2233
2243/*-------------------------------- Monitoring -------------------------------*/ 2234/*-------------------------------- Monitoring -------------------------------*/
@@ -5173,16 +5164,15 @@ int bond_create(char *name, struct bond_params *params)
5173 up_write(&bonding_rwsem); 5164 up_write(&bonding_rwsem);
5174 rtnl_unlock(); /* allows sysfs registration of net device */ 5165 rtnl_unlock(); /* allows sysfs registration of net device */
5175 res = bond_create_sysfs_entry(netdev_priv(bond_dev)); 5166 res = bond_create_sysfs_entry(netdev_priv(bond_dev));
5176 if (res < 0) { 5167 if (res < 0)
5177 rtnl_lock(); 5168 goto out_unreg;
5178 down_write(&bonding_rwsem);
5179 bond_deinit(bond_dev);
5180 unregister_netdevice(bond_dev);
5181 goto out_rtnl;
5182 }
5183 5169
5184 return 0; 5170 return 0;
5185 5171
5172out_unreg:
5173 rtnl_lock();
5174 down_write(&bonding_rwsem);
5175 unregister_netdevice(bond_dev);
5186out_bond: 5176out_bond:
5187 bond_deinit(bond_dev); 5177 bond_deinit(bond_dev);
5188out_netdev: 5178out_netdev:
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 1dd1637663a3..c8a865a7e26c 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -3784,7 +3784,7 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai,
3784 3784
3785 adapter->params.info = ai; 3785 adapter->params.info = ai;
3786 adapter->params.nports = ai->nports0 + ai->nports1; 3786 adapter->params.nports = ai->nports0 + ai->nports1;
3787 adapter->params.chan_map = !!ai->nports0 | (!!ai->nports1 << 1); 3787 adapter->params.chan_map = (!!ai->nports0) | (!!ai->nports1 << 1);
3788 adapter->params.rev = t3_read_reg(adapter, A_PL_REV); 3788 adapter->params.rev = t3_read_reg(adapter, A_PL_REV);
3789 /* 3789 /*
3790 * We used to only run the "adapter check task" once a second if 3790 * We used to only run the "adapter check task" once a second if
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index eceadf787a67..bf4af5248cb7 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -664,7 +664,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
664 struct netconsole_target *nt; 664 struct netconsole_target *nt;
665 struct net_device *dev = ptr; 665 struct net_device *dev = ptr;
666 666
667 if (!(event == NETDEV_CHANGENAME)) 667 if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER))
668 goto done; 668 goto done;
669 669
670 spin_lock_irqsave(&target_list_lock, flags); 670 spin_lock_irqsave(&target_list_lock, flags);
@@ -675,6 +675,15 @@ static int netconsole_netdev_event(struct notifier_block *this,
675 case NETDEV_CHANGENAME: 675 case NETDEV_CHANGENAME:
676 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); 676 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
677 break; 677 break;
678 case NETDEV_UNREGISTER:
679 if (!nt->enabled)
680 break;
681 netpoll_cleanup(&nt->np);
682 nt->enabled = 0;
683 printk(KERN_INFO "netconsole: network logging stopped"
684 ", interface %s unregistered\n",
685 dev->name);
686 break;
678 } 687 }
679 } 688 }
680 netconsole_target_put(nt); 689 netconsole_target_put(nt);
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index dc1665326592..5a7283372b53 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -941,6 +941,16 @@ static int smsc95xx_reset(struct usbnet *dev)
941 if (netif_msg_ifup(dev)) 941 if (netif_msg_ifup(dev))
942 devdbg(dev, "ID_REV = 0x%08x", read_buf); 942 devdbg(dev, "ID_REV = 0x%08x", read_buf);
943 943
944 /* Configure GPIO pins as LED outputs */
945 write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
946 LED_GPIO_CFG_FDX_LED;
947 ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf);
948 if (ret < 0) {
949 devwarn(dev, "Failed to write LED_GPIO_CFG register, ret=%d",
950 ret);
951 return ret;
952 }
953
944 /* Init Tx */ 954 /* Init Tx */
945 write_buf = 0; 955 write_buf = 0;
946 ret = smsc95xx_write_reg(dev, FLOW, write_buf); 956 ret = smsc95xx_write_reg(dev, FLOW, write_buf);
@@ -1231,6 +1241,11 @@ static const struct usb_device_id products[] = {
1231 USB_DEVICE(0x0424, 0x9500), 1241 USB_DEVICE(0x0424, 0x9500),
1232 .driver_info = (unsigned long) &smsc95xx_info, 1242 .driver_info = (unsigned long) &smsc95xx_info,
1233 }, 1243 },
1244 {
1245 /* SMSC9512/9514 USB Hub & Ethernet Device */
1246 USB_DEVICE(0x0424, 0xec00),
1247 .driver_info = (unsigned long) &smsc95xx_info,
1248 },
1234 { }, /* END */ 1249 { }, /* END */
1235}; 1250};
1236MODULE_DEVICE_TABLE(usb, products); 1251MODULE_DEVICE_TABLE(usb, products);
diff --git a/drivers/net/usb/smsc95xx.h b/drivers/net/usb/smsc95xx.h
index 66b5c84f302e..86bc44977fbd 100644
--- a/drivers/net/usb/smsc95xx.h
+++ b/drivers/net/usb/smsc95xx.h
@@ -99,6 +99,9 @@
99#define PM_CTL_WUPS_MULTI_ (0x00000003) 99#define PM_CTL_WUPS_MULTI_ (0x00000003)
100 100
101#define LED_GPIO_CFG (0x24) 101#define LED_GPIO_CFG (0x24)
102#define LED_GPIO_CFG_SPD_LED (0x01000000)
103#define LED_GPIO_CFG_LNK_LED (0x00100000)
104#define LED_GPIO_CFG_FDX_LED (0x00010000)
102 105
103#define GPIO_CFG (0x28) 106#define GPIO_CFG (0x28)
104 107
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 071855871524..6cc5bcd34fb0 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -616,10 +616,11 @@ static int virtnet_open(struct net_device *dev)
616static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, 616static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
617 struct scatterlist *data, int out, int in) 617 struct scatterlist *data, int out, int in)
618{ 618{
619 struct scatterlist sg[VIRTNET_SEND_COMMAND_SG_MAX + 2]; 619 struct scatterlist *s, sg[VIRTNET_SEND_COMMAND_SG_MAX + 2];
620 struct virtio_net_ctrl_hdr ctrl; 620 struct virtio_net_ctrl_hdr ctrl;
621 virtio_net_ctrl_ack status = ~0; 621 virtio_net_ctrl_ack status = ~0;
622 unsigned int tmp; 622 unsigned int tmp;
623 int i;
623 624
624 /* Caller should know better */ 625 /* Caller should know better */
625 BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) || 626 BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) ||
@@ -634,7 +635,8 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
634 sg_init_table(sg, out + in); 635 sg_init_table(sg, out + in);
635 636
636 sg_set_buf(&sg[0], &ctrl, sizeof(ctrl)); 637 sg_set_buf(&sg[0], &ctrl, sizeof(ctrl));
637 memcpy(&sg[1], data, sizeof(struct scatterlist) * (out + in - 2)); 638 for_each_sg(data, s, out + in - 2, i)
639 sg_set_buf(&sg[i + 1], sg_virt(s), s->length);
638 sg_set_buf(&sg[out + in - 1], &status, sizeof(status)); 640 sg_set_buf(&sg[out + in - 1], &status, sizeof(status));
639 641
640 BUG_ON(vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi)); 642 BUG_ON(vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi));
@@ -688,7 +690,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
688 promisc = ((dev->flags & IFF_PROMISC) != 0); 690 promisc = ((dev->flags & IFF_PROMISC) != 0);
689 allmulti = ((dev->flags & IFF_ALLMULTI) != 0); 691 allmulti = ((dev->flags & IFF_ALLMULTI) != 0);
690 692
691 sg_set_buf(sg, &promisc, sizeof(promisc)); 693 sg_init_one(sg, &promisc, sizeof(promisc));
692 694
693 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, 695 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX,
694 VIRTIO_NET_CTRL_RX_PROMISC, 696 VIRTIO_NET_CTRL_RX_PROMISC,
@@ -696,7 +698,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
696 dev_warn(&dev->dev, "Failed to %sable promisc mode.\n", 698 dev_warn(&dev->dev, "Failed to %sable promisc mode.\n",
697 promisc ? "en" : "dis"); 699 promisc ? "en" : "dis");
698 700
699 sg_set_buf(sg, &allmulti, sizeof(allmulti)); 701 sg_init_one(sg, &allmulti, sizeof(allmulti));
700 702
701 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, 703 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX,
702 VIRTIO_NET_CTRL_RX_ALLMULTI, 704 VIRTIO_NET_CTRL_RX_ALLMULTI,
@@ -712,6 +714,8 @@ static void virtnet_set_rx_mode(struct net_device *dev)
712 return; 714 return;
713 } 715 }
714 716
717 sg_init_table(sg, 2);
718
715 /* Store the unicast list and count in the front of the buffer */ 719 /* Store the unicast list and count in the front of the buffer */
716 mac_data->entries = dev->uc_count; 720 mac_data->entries = dev->uc_count;
717 addr = dev->uc_list; 721 addr = dev->uc_list;
@@ -740,24 +744,24 @@ static void virtnet_set_rx_mode(struct net_device *dev)
740 kfree(buf); 744 kfree(buf);
741} 745}
742 746
743static void virnet_vlan_rx_add_vid(struct net_device *dev, u16 vid) 747static void virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid)
744{ 748{
745 struct virtnet_info *vi = netdev_priv(dev); 749 struct virtnet_info *vi = netdev_priv(dev);
746 struct scatterlist sg; 750 struct scatterlist sg;
747 751
748 sg_set_buf(&sg, &vid, sizeof(vid)); 752 sg_init_one(&sg, &vid, sizeof(vid));
749 753
750 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, 754 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
751 VIRTIO_NET_CTRL_VLAN_ADD, &sg, 1, 0)) 755 VIRTIO_NET_CTRL_VLAN_ADD, &sg, 1, 0))
752 dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid); 756 dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid);
753} 757}
754 758
755static void virnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) 759static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
756{ 760{
757 struct virtnet_info *vi = netdev_priv(dev); 761 struct virtnet_info *vi = netdev_priv(dev);
758 struct scatterlist sg; 762 struct scatterlist sg;
759 763
760 sg_set_buf(&sg, &vid, sizeof(vid)); 764 sg_init_one(&sg, &vid, sizeof(vid));
761 765
762 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, 766 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
763 VIRTIO_NET_CTRL_VLAN_DEL, &sg, 1, 0)) 767 VIRTIO_NET_CTRL_VLAN_DEL, &sg, 1, 0))
@@ -790,8 +794,8 @@ static const struct net_device_ops virtnet_netdev = {
790 .ndo_set_mac_address = virtnet_set_mac_address, 794 .ndo_set_mac_address = virtnet_set_mac_address,
791 .ndo_set_rx_mode = virtnet_set_rx_mode, 795 .ndo_set_rx_mode = virtnet_set_rx_mode,
792 .ndo_change_mtu = virtnet_change_mtu, 796 .ndo_change_mtu = virtnet_change_mtu,
793 .ndo_vlan_rx_add_vid = virnet_vlan_rx_add_vid, 797 .ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid,
794 .ndo_vlan_rx_kill_vid = virnet_vlan_rx_kill_vid, 798 .ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid,
795#ifdef CONFIG_NET_POLL_CONTROLLER 799#ifdef CONFIG_NET_POLL_CONTROLLER
796 .ndo_poll_controller = virtnet_netpoll, 800 .ndo_poll_controller = virtnet_netpoll,
797#endif 801#endif