aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bonding/bond_main.c7
-rw-r--r--drivers/net/netconsole.c5
-rw-r--r--drivers/net/pptp.c22
-rw-r--r--drivers/net/r8169.c90
-rw-r--r--drivers/net/smsc911x.c2
-rw-r--r--drivers/net/tg3.c2
6 files changed, 84 insertions, 44 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6d79b78cfc75..de3d351ccb6b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1435,6 +1435,8 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
1435 struct sk_buff *skb = *pskb; 1435 struct sk_buff *skb = *pskb;
1436 struct slave *slave; 1436 struct slave *slave;
1437 struct bonding *bond; 1437 struct bonding *bond;
1438 void (*recv_probe)(struct sk_buff *, struct bonding *,
1439 struct slave *);
1438 1440
1439 skb = skb_share_check(skb, GFP_ATOMIC); 1441 skb = skb_share_check(skb, GFP_ATOMIC);
1440 if (unlikely(!skb)) 1442 if (unlikely(!skb))
@@ -1448,11 +1450,12 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
1448 if (bond->params.arp_interval) 1450 if (bond->params.arp_interval)
1449 slave->dev->last_rx = jiffies; 1451 slave->dev->last_rx = jiffies;
1450 1452
1451 if (bond->recv_probe) { 1453 recv_probe = ACCESS_ONCE(bond->recv_probe);
1454 if (recv_probe) {
1452 struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); 1455 struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
1453 1456
1454 if (likely(nskb)) { 1457 if (likely(nskb)) {
1455 bond->recv_probe(nskb, bond, slave); 1458 recv_probe(nskb, bond, slave);
1456 dev_kfree_skb(nskb); 1459 dev_kfree_skb(nskb);
1457 } 1460 }
1458 } 1461 }
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index ed2a3977c6e7..e8882023576b 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -307,6 +307,11 @@ static ssize_t store_enabled(struct netconsole_target *nt,
307 return err; 307 return err;
308 if (enabled < 0 || enabled > 1) 308 if (enabled < 0 || enabled > 1)
309 return -EINVAL; 309 return -EINVAL;
310 if (enabled == nt->enabled) {
311 printk(KERN_INFO "netconsole: network logging has already %s\n",
312 nt->enabled ? "started" : "stopped");
313 return -EINVAL;
314 }
310 315
311 if (enabled) { /* 1 */ 316 if (enabled) { /* 1 */
312 317
diff --git a/drivers/net/pptp.c b/drivers/net/pptp.c
index eae542a7e987..89f829f5f725 100644
--- a/drivers/net/pptp.c
+++ b/drivers/net/pptp.c
@@ -285,8 +285,10 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
285 ip_send_check(iph); 285 ip_send_check(iph);
286 286
287 ip_local_out(skb); 287 ip_local_out(skb);
288 return 1;
288 289
289tx_error: 290tx_error:
291 kfree_skb(skb);
290 return 1; 292 return 1;
291} 293}
292 294
@@ -305,11 +307,18 @@ static int pptp_rcv_core(struct sock *sk, struct sk_buff *skb)
305 } 307 }
306 308
307 header = (struct pptp_gre_header *)(skb->data); 309 header = (struct pptp_gre_header *)(skb->data);
310 headersize = sizeof(*header);
308 311
309 /* test if acknowledgement present */ 312 /* test if acknowledgement present */
310 if (PPTP_GRE_IS_A(header->ver)) { 313 if (PPTP_GRE_IS_A(header->ver)) {
311 __u32 ack = (PPTP_GRE_IS_S(header->flags)) ? 314 __u32 ack;
312 header->ack : header->seq; /* ack in different place if S = 0 */ 315
316 if (!pskb_may_pull(skb, headersize))
317 goto drop;
318 header = (struct pptp_gre_header *)(skb->data);
319
320 /* ack in different place if S = 0 */
321 ack = PPTP_GRE_IS_S(header->flags) ? header->ack : header->seq;
313 322
314 ack = ntohl(ack); 323 ack = ntohl(ack);
315 324
@@ -318,21 +327,18 @@ static int pptp_rcv_core(struct sock *sk, struct sk_buff *skb)
318 /* also handle sequence number wrap-around */ 327 /* also handle sequence number wrap-around */
319 if (WRAPPED(ack, opt->ack_recv)) 328 if (WRAPPED(ack, opt->ack_recv))
320 opt->ack_recv = ack; 329 opt->ack_recv = ack;
330 } else {
331 headersize -= sizeof(header->ack);
321 } 332 }
322
323 /* test if payload present */ 333 /* test if payload present */
324 if (!PPTP_GRE_IS_S(header->flags)) 334 if (!PPTP_GRE_IS_S(header->flags))
325 goto drop; 335 goto drop;
326 336
327 headersize = sizeof(*header);
328 payload_len = ntohs(header->payload_len); 337 payload_len = ntohs(header->payload_len);
329 seq = ntohl(header->seq); 338 seq = ntohl(header->seq);
330 339
331 /* no ack present? */
332 if (!PPTP_GRE_IS_A(header->ver))
333 headersize -= sizeof(header->ack);
334 /* check for incomplete packet (length smaller than expected) */ 340 /* check for incomplete packet (length smaller than expected) */
335 if (skb->len - headersize < payload_len) 341 if (!pskb_may_pull(skb, headersize + payload_len))
336 goto drop; 342 goto drop;
337 343
338 payload = skb->data + headersize; 344 payload = skb->data + headersize;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index c23667017922..6d657cabb951 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2859,7 +2859,7 @@ static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
2859 rtl_writephy(tp, 0x1f, 0x0004); 2859 rtl_writephy(tp, 0x1f, 0x0004);
2860 rtl_writephy(tp, 0x1f, 0x0007); 2860 rtl_writephy(tp, 0x1f, 0x0007);
2861 rtl_writephy(tp, 0x1e, 0x0020); 2861 rtl_writephy(tp, 0x1e, 0x0020);
2862 rtl_w1w0_phy(tp, 0x06, 0x0000, 0x0100); 2862 rtl_w1w0_phy(tp, 0x15, 0x0000, 0x0100);
2863 rtl_writephy(tp, 0x1f, 0x0002); 2863 rtl_writephy(tp, 0x1f, 0x0002);
2864 rtl_writephy(tp, 0x1f, 0x0000); 2864 rtl_writephy(tp, 0x1f, 0x0000);
2865 rtl_writephy(tp, 0x0d, 0x0007); 2865 rtl_writephy(tp, 0x0d, 0x0007);
@@ -3316,6 +3316,37 @@ static void __devinit rtl_init_mdio_ops(struct rtl8169_private *tp)
3316 } 3316 }
3317} 3317}
3318 3318
3319static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
3320{
3321 void __iomem *ioaddr = tp->mmio_addr;
3322
3323 switch (tp->mac_version) {
3324 case RTL_GIGA_MAC_VER_29:
3325 case RTL_GIGA_MAC_VER_30:
3326 case RTL_GIGA_MAC_VER_32:
3327 case RTL_GIGA_MAC_VER_33:
3328 case RTL_GIGA_MAC_VER_34:
3329 RTL_W32(RxConfig, RTL_R32(RxConfig) |
3330 AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
3331 break;
3332 default:
3333 break;
3334 }
3335}
3336
3337static bool rtl_wol_pll_power_down(struct rtl8169_private *tp)
3338{
3339 if (!(__rtl8169_get_wol(tp) & WAKE_ANY))
3340 return false;
3341
3342 rtl_writephy(tp, 0x1f, 0x0000);
3343 rtl_writephy(tp, MII_BMCR, 0x0000);
3344
3345 rtl_wol_suspend_quirk(tp);
3346
3347 return true;
3348}
3349
3319static void r810x_phy_power_down(struct rtl8169_private *tp) 3350static void r810x_phy_power_down(struct rtl8169_private *tp)
3320{ 3351{
3321 rtl_writephy(tp, 0x1f, 0x0000); 3352 rtl_writephy(tp, 0x1f, 0x0000);
@@ -3330,18 +3361,8 @@ static void r810x_phy_power_up(struct rtl8169_private *tp)
3330 3361
3331static void r810x_pll_power_down(struct rtl8169_private *tp) 3362static void r810x_pll_power_down(struct rtl8169_private *tp)
3332{ 3363{
3333 void __iomem *ioaddr = tp->mmio_addr; 3364 if (rtl_wol_pll_power_down(tp))
3334
3335 if (__rtl8169_get_wol(tp) & WAKE_ANY) {
3336 rtl_writephy(tp, 0x1f, 0x0000);
3337 rtl_writephy(tp, MII_BMCR, 0x0000);
3338
3339 if (tp->mac_version == RTL_GIGA_MAC_VER_29 ||
3340 tp->mac_version == RTL_GIGA_MAC_VER_30)
3341 RTL_W32(RxConfig, RTL_R32(RxConfig) | AcceptBroadcast |
3342 AcceptMulticast | AcceptMyPhys);
3343 return; 3365 return;
3344 }
3345 3366
3346 r810x_phy_power_down(tp); 3367 r810x_phy_power_down(tp);
3347} 3368}
@@ -3430,17 +3451,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp)
3430 tp->mac_version == RTL_GIGA_MAC_VER_33) 3451 tp->mac_version == RTL_GIGA_MAC_VER_33)
3431 rtl_ephy_write(ioaddr, 0x19, 0xff64); 3452 rtl_ephy_write(ioaddr, 0x19, 0xff64);
3432 3453
3433 if (__rtl8169_get_wol(tp) & WAKE_ANY) { 3454 if (rtl_wol_pll_power_down(tp))
3434 rtl_writephy(tp, 0x1f, 0x0000);
3435 rtl_writephy(tp, MII_BMCR, 0x0000);
3436
3437 if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
3438 tp->mac_version == RTL_GIGA_MAC_VER_33 ||
3439 tp->mac_version == RTL_GIGA_MAC_VER_34)
3440 RTL_W32(RxConfig, RTL_R32(RxConfig) | AcceptBroadcast |
3441 AcceptMulticast | AcceptMyPhys);
3442 return; 3455 return;
3443 }
3444 3456
3445 r8168_phy_power_down(tp); 3457 r8168_phy_power_down(tp);
3446 3458
@@ -5788,11 +5800,30 @@ static const struct dev_pm_ops rtl8169_pm_ops = {
5788 5800
5789#endif /* !CONFIG_PM */ 5801#endif /* !CONFIG_PM */
5790 5802
5803static void rtl_wol_shutdown_quirk(struct rtl8169_private *tp)
5804{
5805 void __iomem *ioaddr = tp->mmio_addr;
5806
5807 /* WoL fails with 8168b when the receiver is disabled. */
5808 switch (tp->mac_version) {
5809 case RTL_GIGA_MAC_VER_11:
5810 case RTL_GIGA_MAC_VER_12:
5811 case RTL_GIGA_MAC_VER_17:
5812 pci_clear_master(tp->pci_dev);
5813
5814 RTL_W8(ChipCmd, CmdRxEnb);
5815 /* PCI commit */
5816 RTL_R8(ChipCmd);
5817 break;
5818 default:
5819 break;
5820 }
5821}
5822
5791static void rtl_shutdown(struct pci_dev *pdev) 5823static void rtl_shutdown(struct pci_dev *pdev)
5792{ 5824{
5793 struct net_device *dev = pci_get_drvdata(pdev); 5825 struct net_device *dev = pci_get_drvdata(pdev);
5794 struct rtl8169_private *tp = netdev_priv(dev); 5826 struct rtl8169_private *tp = netdev_priv(dev);
5795 void __iomem *ioaddr = tp->mmio_addr;
5796 5827
5797 rtl8169_net_suspend(dev); 5828 rtl8169_net_suspend(dev);
5798 5829
@@ -5806,16 +5837,9 @@ static void rtl_shutdown(struct pci_dev *pdev)
5806 spin_unlock_irq(&tp->lock); 5837 spin_unlock_irq(&tp->lock);
5807 5838
5808 if (system_state == SYSTEM_POWER_OFF) { 5839 if (system_state == SYSTEM_POWER_OFF) {
5809 /* WoL fails with 8168b when the receiver is disabled. */ 5840 if (__rtl8169_get_wol(tp) & WAKE_ANY) {
5810 if ((tp->mac_version == RTL_GIGA_MAC_VER_11 || 5841 rtl_wol_suspend_quirk(tp);
5811 tp->mac_version == RTL_GIGA_MAC_VER_12 || 5842 rtl_wol_shutdown_quirk(tp);
5812 tp->mac_version == RTL_GIGA_MAC_VER_17) &&
5813 (tp->features & RTL_FEATURE_WOL)) {
5814 pci_clear_master(pdev);
5815
5816 RTL_W8(ChipCmd, CmdRxEnb);
5817 /* PCI commit */
5818 RTL_R8(ChipCmd);
5819 } 5843 }
5820 5844
5821 pci_wake_from_d3(pdev, true); 5845 pci_wake_from_d3(pdev, true);
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index b9016a30cdc5..c90ddb61cc56 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -26,6 +26,7 @@
26 * LAN9215, LAN9216, LAN9217, LAN9218 26 * LAN9215, LAN9216, LAN9217, LAN9218
27 * LAN9210, LAN9211 27 * LAN9210, LAN9211
28 * LAN9220, LAN9221 28 * LAN9220, LAN9221
29 * LAN89218
29 * 30 *
30 */ 31 */
31 32
@@ -1983,6 +1984,7 @@ static int __devinit smsc911x_init(struct net_device *dev)
1983 case 0x01170000: 1984 case 0x01170000:
1984 case 0x01160000: 1985 case 0x01160000:
1985 case 0x01150000: 1986 case 0x01150000:
1987 case 0x218A0000:
1986 /* LAN911[5678] family */ 1988 /* LAN911[5678] family */
1987 pdata->generation = pdata->idrev & 0x0000FFFF; 1989 pdata->generation = pdata->idrev & 0x0000FFFF;
1988 break; 1990 break;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 4a1374df6084..c11a2b8327f3 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -15577,7 +15577,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
15577 15577
15578 cancel_work_sync(&tp->reset_task); 15578 cancel_work_sync(&tp->reset_task);
15579 15579
15580 if (!tg3_flag(tp, USE_PHYLIB)) { 15580 if (tg3_flag(tp, USE_PHYLIB)) {
15581 tg3_phy_fini(tp); 15581 tg3_phy_fini(tp);
15582 tg3_mdio_fini(tp); 15582 tg3_mdio_fini(tp);
15583 } 15583 }