History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller: 1) Don't use shared bluetooth antenna in iwlwifi driver for management frames, from Emmanuel Grumbach. 2) Fix device ID check in ath9k driver, from Felix Fietkau. 3) Off by one in xen-netback BUG checks, from Dan Carpenter. 4) Fix IFLA_VF_PORT netlink attribute validation, from Daniel Borkmann. 5) Fix races in setting peeked bit flag in SKBs during datagram receive. If it's shared we have to clone it otherwise the value can easily be corrupted. Fix from Herbert Xu. 6) Revert fec clock handling change, causes regressions. From Fabio Estevam. 7) Fix use after free in fq_codel and sfq packet schedulers, from WANG Cong. 8) ipvlan bug fixes (memory leaks, missing rcu_dereference_bh, etc.) from WANG Cong and Konstantin Khlebnikov. 9) Memory leak in act_bpf packet action, from Alexei Starovoitov. 10) ARM bpf JIT bug fixes from Nicolas Schichan. 11) Fix backwards compat of ANY_LAYOUT in virtio_net driver, from Michael S Tsirkin. 12) Destruction of bond with different ARP header types not handled correctly, fix from Nikolay Aleksandrov. 13) Revert GRO receive support in ipv6 SIT tunnel driver, causes regressions because the GRO packets created cannot be processed properly on the GSO side if we forward the frame. From Herbert Xu. 14) TCCR update race and other fixes to ravb driver from Sergei Shtylyov. 15) Fix SKB leaks in caif_queue_rcv_skb(), from Eric Dumazet. 16) Fix panics on packet scheduler filter replace, from Daniel Borkmann. 17) Make sure AF_PACKET sees properly IP headers in defragmented frames (via PACKET_FANOUT_FLAG_DEFRAG option), from Edward Hyunkoo Jee. 18) AF_NETLINK cannot hold mutex in RCU callback, fix from Florian Westphal. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (84 commits) ravb: fix ring memory allocation net: phy: dp83867: Fix warning check for setting the internal delay openvswitch: allocate nr_node_ids flow_stats instead of num_possible_nodes netlink: don't hold mutex in rcu callback when releasing mmapd ring ARM: net: fix vlan access instructions in ARM JIT. ARM: net: handle negative offsets in BPF JIT. ARM: net: fix condition for load_order > 0 when translating load instructions. tcp: suppress a division by zero warning drivers: net: cpsw: remove tx event processing in rx napi poll inet: frags: fix defragmented packet's IP header for af_packet net: mvneta: fix refilling for Rx DMA buffers stmmac: fix setting of driver data in stmmac_dvr_probe sched: cls_flow: fix panic on filter replace sched: cls_flower: fix panic on filter replace sched: cls_bpf: fix panic on filter replace net/mdio: fix mdio_bus_match for c45 PHY net: ratelimit warnings about dst entry refcount underflow or overflow caif: fix leaks and race in caif_queue_rcv_skb() qmi_wwan: add the second QMI/network interface for Sierra Wireless MC7305/MC7355 ravb: fix race updating TCCR ...

Linus Torvalds committed 11 years ago

Commit c5dfd652 parents 5a5ca73 d8b489179 files · +714 −811Browse files

Unified · Split

79 files
  1. arch/arm/net/bpf_jit_32.c +44 −13
  2. drivers/bluetooth/btbcm.c +5 −6
  3. drivers/isdn/gigaset/ser-gigaset.c +10 −25
  4. drivers/net/bonding/bond_main.c +31 −3
  5. drivers/net/can/at91_can.c +4 −4
  6. drivers/net/can/bfin_can.c +2 −4
  7. drivers/net/can/cc770/cc770.c +2 −2
  8. drivers/net/can/flexcan.c +3 −4
  9. drivers/net/can/grcan.c +2 −1
  10. drivers/net/can/sja1000/sja1000.c +2 −4
  11. drivers/net/can/slcan.c +1 −1
  12. drivers/net/can/spi/mcp251x.c +8 −9
  13. drivers/net/can/ti_hecc.c +1 −1
  14. drivers/net/can/usb/ems_usb.c +2 −4
  15. drivers/net/can/usb/esd_usb2.c +2 −4
  16. drivers/net/can/usb/peak_usb/pcan_usb.c +3 −4
  17. drivers/net/can/usb/peak_usb/pcan_usb_pro.c +2 −2
  18. drivers/net/can/usb/usb_8dev.c +2 −4
  19. drivers/net/dsa/bcm_sf2.c +13 −2
  20. drivers/net/dsa/mv88e6xxx.c +1 −1
  21. drivers/net/ethernet/freescale/fec_main.c +13 −75
  22. drivers/net/ethernet/marvell/mvneta.c +10 −12
  23. drivers/net/ethernet/renesas/ravb_main.c +38 −36
  24. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 −1
  25. drivers/net/ethernet/ti/cpsw.c +3 −6
  26. drivers/net/ethernet/ti/netcp_core.c +1 −1
  27. drivers/net/ipvlan/ipvlan.h +6 −3
  28. drivers/net/ipvlan/ipvlan_core.c +2 −4
  29. drivers/net/ipvlan/ipvlan_main.c +19 −23
  30. drivers/net/phy/dp83867.c +1 −1
  31. drivers/net/phy/mdio_bus.c +17 −2
  32. drivers/net/usb/qmi_wwan.c +1 −0
  33. drivers/net/virtio_net.c +2 −1
  34. drivers/net/wireless/ath/ath9k/hw.c +1 −0
  35. drivers/net/wireless/iwlwifi/iwl-fh.h +6 −0
  36. drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +5 −7
  37. drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +2 −1
  38. drivers/net/wireless/iwlwifi/mvm/scan.c +3 −0
  39. drivers/net/wireless/iwlwifi/mvm/sta.c +2 −1
  40. drivers/net/wireless/iwlwifi/mvm/time-event.c +1 −1
  41. drivers/net/wireless/iwlwifi/mvm/tx.c +1 −1
  42. drivers/net/wireless/iwlwifi/pcie/drv.c +3 −2
  43. drivers/net/wireless/iwlwifi/pcie/internal.h +8 −43
  44. drivers/net/wireless/iwlwifi/pcie/rx.c +83 −331
  45. drivers/net/wireless/iwlwifi/pcie/trans.c +29 −23
  46. drivers/net/xen-netback/netback.c +3 −3
  47. include/net/cfg80211.h +17 −0
  48. include/net/ip.h +1 −0
  49. net/ax25/ax25_subr.c +1 −0
  50. net/bridge/br_mdb.c +0 −1
  51. net/bridge/br_multicast.c +30 −7
  52. net/caif/caif_socket.c +8 −11
  53. net/core/datagram.c +47 −9
  54. net/core/dst.c +3 −1
  55. net/core/rtnetlink.c +7 −4
  56. net/ipv4/datagram.c +12 −4
  57. net/ipv4/inet_hashtables.c +5 −6
  58. net/ipv4/ip_fragment.c +4 −2
  59. net/ipv4/tcp_input.c +1 −2
  60. net/ipv6/datagram.c +15 −5
  61. net/ipv6/ip6_offload.c +0 −2
  62. net/mac80211/debugfs_netdev.c +1 −0
  63. net/mac80211/iface.c +14 −11
  64. net/mac80211/mesh_plink.c +4 −1
  65. net/mac80211/pm.c +16 −0
  66. net/mac80211/tdls.c +3 −3
  67. net/mac80211/tx.c +3 −1
  68. net/netlink/af_netlink.c +47 −32
  69. net/openvswitch/flow_table.c +1 −1
  70. net/sched/act_bpf.c +3 −0
  71. net/sched/cls_bpf.c +1 −1
  72. net/sched/cls_flow.c +3 −2
  73. net/sched/cls_flower.c +1 −1
  74. net/sched/sch_fq_codel.c +11 −2
  75. net/sched/sch_sfq.c +1 −1
  76. net/wireless/chan.c +34 −11
  77. net/wireless/nl80211.c +8 −6
  78. net/wireless/reg.c +4 −4
  79. net/wireless/trace.h +7 −4
arch/arm/net/bpf_jit_32.c+44−13
@@ -74,32 +74,52 @@ struct jit_ctx { · 73 unmodified lines
7474
7575 int bpf_jit_enable __read_mostly;
7676
77−static u64 jit_get_skb_b(struct sk_buff *skb, unsigned offset)
77+static inline int call_neg_helper(struct sk_buff *skb, int offset, void *ret,
78+ unsigned int size)
79+{
80+ void *ptr = bpf_internal_load_pointer_neg_helper(skb, offset, size);
81+
82+ if (!ptr)
83+ return -EFAULT;
84+ memcpy(ret, ptr, size);
85+ return 0;
86+}
87+
88+static u64 jit_get_skb_b(struct sk_buff *skb, int offset)
7889 {
7990 u8 ret;
8091 int err;
8192
82− err = skb_copy_bits(skb, offset, &ret, 1);
93+ if (offset < 0)
94+ err = call_neg_helper(skb, offset, &ret, 1);
95+ else
96+ err = skb_copy_bits(skb, offset, &ret, 1);
8397
8498 return (u64)err << 32 | ret;
8599 }
86100
87−static u64 jit_get_skb_h(struct sk_buff *skb, unsigned offset)
101+static u64 jit_get_skb_h(struct sk_buff *skb, int offset)
88102 {
89103 u16 ret;
90104 int err;
91105
92− err = skb_copy_bits(skb, offset, &ret, 2);
106+ if (offset < 0)
107+ err = call_neg_helper(skb, offset, &ret, 2);
108+ else
109+ err = skb_copy_bits(skb, offset, &ret, 2);
93110
94111 return (u64)err << 32 | ntohs(ret);
95112 }
96113
97−static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset)
114+static u64 jit_get_skb_w(struct sk_buff *skb, int offset)
98115 {
99116 u32 ret;
100117 int err;
101118
102− err = skb_copy_bits(skb, offset, &ret, 4);
119+ if (offset < 0)
120+ err = call_neg_helper(skb, offset, &ret, 4);
121+ else
122+ err = skb_copy_bits(skb, offset, &ret, 4);
103123
104124 return (u64)err << 32 | ntohl(ret);
105125 }
@@ -536,9 +556,6 @@ static int build_body(struct jit_ctx *ctx) · 430 unmodified lines
536556 case BPF_LD | BPF_B | BPF_ABS:
537557 load_order = 0;
538558 load:
539− /* the interpreter will deal with the negative K */
540− if ((int)k < 0)
541− return -ENOTSUPP;
542559 emit_mov_i(r_off, k, ctx);
543560 load_common:
544561 ctx->seen |= SEEN_DATA | SEEN_CALL;
@@ -547,12 +564,24 @@ load_common: · 2 unmodified lines
547564 emit(ARM_SUB_I(r_scratch, r_skb_hl,
548565 1 << load_order), ctx);
549566 emit(ARM_CMP_R(r_scratch, r_off), ctx);
550− condt = ARM_COND_HS;
567+ condt = ARM_COND_GE;
551568 } else {
552569 emit(ARM_CMP_R(r_skb_hl, r_off), ctx);
553570 condt = ARM_COND_HI;
554571 }
555572
573+ /*
574+ * test for negative offset, only if we are
575+ * currently scheduled to take the fast
576+ * path. this will update the flags so that
577+ * the slowpath instruction are ignored if the
578+ * offset is negative.
579+ *
580+ * for loard_order == 0 the HI condition will
581+ * make loads at offset 0 take the slow path too.
582+ */
583+ _emit(condt, ARM_CMP_I(r_off, 0), ctx);
584+
556585 _emit(condt, ARM_ADD_R(r_scratch, r_off, r_skb_data),
557586 ctx);
558587
@@ -860,9 +889,11 @@ b_epilogue: · 301 unmodified lines
860889 off = offsetof(struct sk_buff, vlan_tci);
861890 emit(ARM_LDRH_I(r_A, r_skb, off), ctx);
862891 if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
863− OP_IMM3(ARM_AND, r_A, r_A, VLAN_VID_MASK, ctx);
864− else
865− OP_IMM3(ARM_AND, r_A, r_A, VLAN_TAG_PRESENT, ctx);
892+ OP_IMM3(ARM_AND, r_A, r_A, ~VLAN_TAG_PRESENT, ctx);
893+ else {
894+ OP_IMM3(ARM_LSR, r_A, r_A, 12, ctx);
895+ OP_IMM3(ARM_AND, r_A, r_A, 0x1, ctx);
896+ }
866897 break;
867898 case BPF_ANC | SKF_AD_QUEUE:
868899 ctx->seen |= SEEN_SKB;
drivers/bluetooth/btbcm.c+5−6
@@ -472,12 +472,11 @@ int btbcm_setup_apple(struct hci_dev *hdev) · 471 unmodified lines
472472
473473 /* Read Verbose Config Version Info */
474474 skb = btbcm_read_verbose_config(hdev);
475− if (IS_ERR(skb))
476− return PTR_ERR(skb);
477−
478− BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name, skb->data[1],
479− get_unaligned_le16(skb->data + 5));
480− kfree_skb(skb);
475+ if (!IS_ERR(skb)) {
476+ BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name, skb->data[1],
477+ get_unaligned_le16(skb->data + 5));
478+ kfree_skb(skb);
479+ }
481480
482481 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
483482
drivers/isdn/gigaset/ser-gigaset.c+10−25
@@ -524,9 +524,18 @@ gigaset_tty_open(struct tty_struct *tty) · 523 unmodified lines
524524 cs->hw.ser->tty = tty;
525525 atomic_set(&cs->hw.ser->refcnt, 1);
526526 init_completion(&cs->hw.ser->dead_cmp);
527−
528527 tty->disc_data = cs;
529528
529+ /* Set the amount of data we're willing to receive per call
530+ * from the hardware driver to half of the input buffer size
531+ * to leave some reserve.
532+ * Note: We don't do flow control towards the hardware driver.
533+ * If more data is received than will fit into the input buffer,
534+ * it will be dropped and an error will be logged. This should
535+ * never happen as the device is slow and the buffer size ample.
536+ */
537+ tty->receive_room = RBUFSIZE/2;
538+
530539 /* OK.. Initialization of the datastructures and the HW is done.. Now
531540 * startup system and notify the LL that we are ready to run
532541 */
@@ -597,28 +606,6 @@ static int gigaset_tty_hangup(struct tty_struct *tty) · 64 unmodified lines
597606 return 0;
598607 }
599608
600−/*
601− * Read on the tty.
602− * Unused, received data goes only to the Gigaset driver.
603− */
604−static ssize_t
605−gigaset_tty_read(struct tty_struct *tty, struct file *file,
606− unsigned char __user *buf, size_t count)
607−{
608− return -EAGAIN;
609−}
610−
611−/*
612− * Write on the tty.
613− * Unused, transmit data comes only from the Gigaset driver.
614− */
615−static ssize_t
616−gigaset_tty_write(struct tty_struct *tty, struct file *file,
617− const unsigned char *buf, size_t count)
618−{
619− return -EAGAIN;
620−}
621−
622609 /*
623610 * Ioctl on the tty.
624611 * Called in process context only.
@@ -752,8 +739,6 @@ static struct tty_ldisc_ops gigaset_ldisc = { · 127 unmodified lines
752739 .open = gigaset_tty_open,
753740 .close = gigaset_tty_close,
754741 .hangup = gigaset_tty_hangup,
755− .read = gigaset_tty_read,
756− .write = gigaset_tty_write,
757742 .ioctl = gigaset_tty_ioctl,
758743 .receive_buf = gigaset_tty_receive,
759744 .write_wakeup = gigaset_tty_wakeup,
drivers/net/bonding/bond_main.c+31−3
@@ -625,6 +625,23 @@ static void bond_set_dev_addr(struct net_device *bond_dev, · 624 unmodified lines
625625 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev);
626626 }
627627
628+static struct slave *bond_get_old_active(struct bonding *bond,
629+ struct slave *new_active)
630+{
631+ struct slave *slave;
632+ struct list_head *iter;
633+
634+ bond_for_each_slave(bond, slave, iter) {
635+ if (slave == new_active)
636+ continue;
637+
638+ if (ether_addr_equal(bond->dev->dev_addr, slave->dev->dev_addr))
639+ return slave;
640+ }
641+
642+ return NULL;
643+}
644+
628645 /* bond_do_fail_over_mac
629646 *
630647 * Perform special MAC address swapping for fail_over_mac settings
@@ -652,6 +669,9 @@ static void bond_do_fail_over_mac(struct bonding *bond, · 21 unmodified lines
652669 if (!new_active)
653670 return;
654671
672+ if (!old_active)
673+ old_active = bond_get_old_active(bond, new_active);
674+
655675 if (old_active) {
656676 ether_addr_copy(tmp_mac, new_active->dev->dev_addr);
657677 ether_addr_copy(saddr.sa_data,
@@ -1725,9 +1745,16 @@ err_free: · 1067 unmodified lines
17251745
17261746 err_undo_flags:
17271747 /* Enslave of first slave has failed and we need to fix master's mac */
1728− if (!bond_has_slaves(bond) &&
1729− ether_addr_equal_64bits(bond_dev->dev_addr, slave_dev->dev_addr))
1730− eth_hw_addr_random(bond_dev);
1748+ if (!bond_has_slaves(bond)) {
1749+ if (ether_addr_equal_64bits(bond_dev->dev_addr,
1750+ slave_dev->dev_addr))
1751+ eth_hw_addr_random(bond_dev);
1752+ if (bond_dev->type != ARPHRD_ETHER) {
1753+ ether_setup(bond_dev);
1754+ bond_dev->flags |= IFF_MASTER;
1755+ bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
1756+ }
1757+ }
17311758
17321759 return res;
17331760 }
@@ -1916,6 +1943,7 @@ static int bond_release_and_destroy(struct net_device *bond_dev, · 182 unmodified lines
19161943 bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
19171944 netdev_info(bond_dev, "Destroying bond %s\n",
19181945 bond_dev->name);
1946+ bond_remove_proc_entry(bond);
19191947 unregister_netdevice(bond_dev);
19201948 }
19211949 return ret;
drivers/net/can/at91_can.c+4−4
@@ -577,10 +577,10 @@ static void at91_rx_overflow_err(struct net_device *dev) · 576 unmodified lines
577577
578578 cf->can_id |= CAN_ERR_CRTL;
579579 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
580− netif_receive_skb(skb);
581580
582581 stats->rx_packets++;
583582 stats->rx_bytes += cf->can_dlc;
583+ netif_receive_skb(skb);
584584 }
585585
586586 /**
@@ -642,10 +642,10 @@ static void at91_read_msg(struct net_device *dev, unsigned int mb) · 55 unmodified lines
642642 }
643643
644644 at91_read_mb(dev, mb, cf);
645− netif_receive_skb(skb);
646645
647646 stats->rx_packets++;
648647 stats->rx_bytes += cf->can_dlc;
648+ netif_receive_skb(skb);
649649
650650 can_led_event(dev, CAN_LED_EVENT_RX);
651651 }
@@ -802,10 +802,10 @@ static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr) · 150 unmodified lines
802802 return 0;
803803
804804 at91_poll_err_frame(dev, cf, reg_sr);
805− netif_receive_skb(skb);
806805
807806 dev->stats.rx_packets++;
808807 dev->stats.rx_bytes += cf->can_dlc;
808+ netif_receive_skb(skb);
809809
810810 return 1;
811811 }
@@ -1067,10 +1067,10 @@ static void at91_irq_err(struct net_device *dev) · 255 unmodified lines
10671067 return;
10681068
10691069 at91_irq_err_state(dev, cf, new_state);
1070− netif_rx(skb);
10711070
10721071 dev->stats.rx_packets++;
10731072 dev->stats.rx_bytes += cf->can_dlc;
1073+ netif_rx(skb);
10741074
10751075 priv->can.state = new_state;
10761076 }
drivers/net/can/bfin_can.c+2−4
@@ -424,10 +424,9 @@ static void bfin_can_rx(struct net_device *dev, u16 isrc) · 423 unmodified lines
424424 cf->data[6 - i] = (6 - i) < cf->can_dlc ? (val >> 8) : 0;
425425 }
426426
427− netif_rx(skb);
428−
429427 stats->rx_packets++;
430428 stats->rx_bytes += cf->can_dlc;
429+ netif_rx(skb);
431430 }
432431
433432 static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
@@ -508,10 +507,9 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) · 74 unmodified lines
508507
509508 priv->can.state = state;
510509
511− netif_rx(skb);
512−
513510 stats->rx_packets++;
514511 stats->rx_bytes += cf->can_dlc;
512+ netif_rx(skb);
515513
516514 return 0;
517515 }
drivers/net/can/cc770/cc770.c+2−2
@@ -504,10 +504,10 @@ static void cc770_rx(struct net_device *dev, unsigned int mo, u8 ctrl1) · 503 unmodified lines
504504 for (i = 0; i < cf->can_dlc; i++)
505505 cf->data[i] = cc770_read_reg(priv, msgobj[mo].data[i]);
506506 }
507− netif_rx(skb);
508507
509508 stats->rx_packets++;
510509 stats->rx_bytes += cf->can_dlc;
510+ netif_rx(skb);
511511 }
512512
513513 static int cc770_err(struct net_device *dev, u8 status)
@@ -584,10 +584,10 @@ static int cc770_err(struct net_device *dev, u8 status) · 70 unmodified lines
584584 }
585585 }
586586
587− netif_rx(skb);
588587
589588 stats->rx_packets++;
590589 stats->rx_bytes += cf->can_dlc;
590+ netif_rx(skb);
591591
592592 return 0;
593593 }
drivers/net/can/flexcan.c+3−4
@@ -577,10 +577,10 @@ static int flexcan_poll_bus_err(struct net_device *dev, u32 reg_esr) · 576 unmodified lines
577577 return 0;
578578
579579 do_bus_err(dev, cf, reg_esr);
580− netif_receive_skb(skb);
581580
582581 dev->stats.rx_packets++;
583582 dev->stats.rx_bytes += cf->can_dlc;
583+ netif_receive_skb(skb);
584584
585585 return 1;
586586 }
@@ -622,10 +622,9 @@ static int flexcan_poll_state(struct net_device *dev, u32 reg_esr) · 35 unmodified lines
622622 if (unlikely(new_state == CAN_STATE_BUS_OFF))
623623 can_bus_off(dev);
624624
625− netif_receive_skb(skb);
626−
627625 dev->stats.rx_packets++;
628626 dev->stats.rx_bytes += cf->can_dlc;
627+ netif_receive_skb(skb);
629628
630629 return 1;
631630 }
@@ -670,10 +669,10 @@ static int flexcan_read_frame(struct net_device *dev) · 38 unmodified lines
670669 }
671670
672671 flexcan_read_fifo(dev, cf);
673− netif_receive_skb(skb);
674672
675673 stats->rx_packets++;
676674 stats->rx_bytes += cf->can_dlc;
675+ netif_receive_skb(skb);
677676
678677 can_led_event(dev, CAN_LED_EVENT_RX);
679678
drivers/net/can/grcan.c+2−1
@@ -1216,11 +1216,12 @@ static int grcan_receive(struct net_device *dev, int budget) · 1215 unmodified lines
12161216 cf->data[i] = (u8)(slot[j] >> shift);
12171217 }
12181218 }
1219− netif_receive_skb(skb);
12201219
12211220 /* Update statistics and read pointer */
12221221 stats->rx_packets++;
12231222 stats->rx_bytes += cf->can_dlc;
1223+ netif_receive_skb(skb);
1224+
12241225 rd = grcan_ring_add(rd, GRCAN_MSG_SIZE, dma->rx.size);
12251226 }
12261227
drivers/net/can/sja1000/sja1000.c+2−4
@@ -377,10 +377,9 @@ static void sja1000_rx(struct net_device *dev) · 376 unmodified lines
377377 /* release receive buffer */
378378 sja1000_write_cmdreg(priv, CMD_RRB);
379379
380− netif_rx(skb);
381−
382380 stats->rx_packets++;
383381 stats->rx_bytes += cf->can_dlc;
382+ netif_rx(skb);
384383
385384 can_led_event(dev, CAN_LED_EVENT_RX);
386385 }
@@ -484,10 +483,9 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) · 97 unmodified lines
484483 can_bus_off(dev);
485484 }
486485
487− netif_rx(skb);
488−
489486 stats->rx_packets++;
490487 stats->rx_bytes += cf->can_dlc;
488+ netif_rx(skb);
491489
492490 return 0;
493491 }
drivers/net/can/slcan.c+1−1
@@ -218,10 +218,10 @@ static void slc_bump(struct slcan *sl) · 217 unmodified lines
218218
219219 memcpy(skb_put(skb, sizeof(struct can_frame)),
220220 &cf, sizeof(struct can_frame));
221− netif_rx_ni(skb);
222221
223222 sl->dev->stats.rx_packets++;
224223 sl->dev->stats.rx_bytes += cf.can_dlc;
224+ netif_rx_ni(skb);
225225 }
226226
227227 /* parse tty input stream */
drivers/net/can/spi/mcp251x.c+8−9
@@ -1086,8 +1086,8 @@ static int mcp251x_can_probe(struct spi_device *spi) · 1085 unmodified lines
10861086 if (ret)
10871087 goto out_clk;
10881088
1089− priv->power = devm_regulator_get(&spi->dev, "vdd");
1090− priv->transceiver = devm_regulator_get(&spi->dev, "xceiver");
1089+ priv->power = devm_regulator_get_optional(&spi->dev, "vdd");
1090+ priv->transceiver = devm_regulator_get_optional(&spi->dev, "xceiver");
10911091 if ((PTR_ERR(priv->power) == -EPROBE_DEFER) ||
10921092 (PTR_ERR(priv->transceiver) == -EPROBE_DEFER)) {
10931093 ret = -EPROBE_DEFER;
@@ -1222,17 +1222,16 @@ static int __maybe_unused mcp251x_can_resume(struct device *dev) · 128 unmodified lines
12221222 struct spi_device *spi = to_spi_device(dev);
12231223 struct mcp251x_priv *priv = spi_get_drvdata(spi);
12241224
1225− if (priv->after_suspend & AFTER_SUSPEND_POWER) {
1225+ if (priv->after_suspend & AFTER_SUSPEND_POWER)
12261226 mcp251x_power_enable(priv->power, 1);
1227+
1228+ if (priv->after_suspend & AFTER_SUSPEND_UP) {
1229+ mcp251x_power_enable(priv->transceiver, 1);
12271230 queue_work(priv->wq, &priv->restart_work);
12281231 } else {
1229− if (priv->after_suspend & AFTER_SUSPEND_UP) {
1230− mcp251x_power_enable(priv->transceiver, 1);
1231− queue_work(priv->wq, &priv->restart_work);
1232− } else {
1233− priv->after_suspend = 0;
1234− }
1232+ priv->after_suspend = 0;
12351233 }
1234+
12361235 priv->force_quit = 0;
12371236 enable_irq(spi->irq);
12381237 return 0;
drivers/net/can/ti_hecc.c+1−1
@@ -747,9 +747,9 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, · 746 unmodified lines
747747 }
748748 }
749749
750− netif_rx(skb);
751750 stats->rx_packets++;
752751 stats->rx_bytes += cf->can_dlc;
752+ netif_rx(skb);
753753
754754 return 0;
755755 }
drivers/net/can/usb/ems_usb.c+2−4
@@ -324,10 +324,9 @@ static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) · 323 unmodified lines
324324 cf->data[i] = msg->msg.can_msg.msg[i];
325325 }
326326
327− netif_rx(skb);
328−
329327 stats->rx_packets++;
330328 stats->rx_bytes += cf->can_dlc;
329+ netif_rx(skb);
331330 }
332331
333332 static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg)
@@ -400,10 +399,9 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) · 66 unmodified lines
400399 stats->rx_errors++;
401400 }
402401
403− netif_rx(skb);
404−
405402 stats->rx_packets++;
406403 stats->rx_bytes += cf->can_dlc;
404+ netif_rx(skb);
407405 }
408406
409407 /*
drivers/net/can/usb/esd_usb2.c+2−4
@@ -301,13 +301,12 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv, · 300 unmodified lines
301301 cf->data[7] = rxerr;
302302 }
303303
304− netif_rx(skb);
305−
306304 priv->bec.txerr = txerr;
307305 priv->bec.rxerr = rxerr;
308306
309307 stats->rx_packets++;
310308 stats->rx_bytes += cf->can_dlc;
309+ netif_rx(skb);
311310 }
312311 }
313312
@@ -347,10 +346,9 @@ static void esd_usb2_rx_can_msg(struct esd_usb2_net_priv *priv, · 33 unmodified lines
347346 cf->data[i] = msg->msg.rx.data[i];
348347 }
349348
350− netif_rx(skb);
351−
352349 stats->rx_packets++;
353350 stats->rx_bytes += cf->can_dlc;
351+ netif_rx(skb);
354352 }
355353
356354 return;
drivers/net/can/usb/peak_usb/pcan_usb.c+3−4
@@ -526,9 +526,9 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, · 525 unmodified lines
526526 hwts->hwtstamp = timeval_to_ktime(tv);
527527 }
528528
529− netif_rx(skb);
530529 mc->netdev->stats.rx_packets++;
531530 mc->netdev->stats.rx_bytes += cf->can_dlc;
531+ netif_rx(skb);
532532
533533 return 0;
534534 }
@@ -659,12 +659,11 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len) · 124 unmodified lines
659659 hwts = skb_hwtstamps(skb);
660660 hwts->hwtstamp = timeval_to_ktime(tv);
661661
662− /* push the skb */
663− netif_rx(skb);
664−
665662 /* update statistics */
666663 mc->netdev->stats.rx_packets++;
667664 mc->netdev->stats.rx_bytes += cf->can_dlc;
665+ /* push the skb */
666+ netif_rx(skb);
668667
669668 return 0;
670669
drivers/net/can/usb/peak_usb/pcan_usb_pro.c+2−2
@@ -553,9 +553,9 @@ static int pcan_usb_pro_handle_canmsg(struct pcan_usb_pro_interface *usb_if, · 552 unmodified lines
553553 hwts = skb_hwtstamps(skb);
554554 hwts->hwtstamp = timeval_to_ktime(tv);
555555
556− netif_rx(skb);
557556 netdev->stats.rx_packets++;
558557 netdev->stats.rx_bytes += can_frame->can_dlc;
558+ netif_rx(skb);
559559
560560 return 0;
561561 }
@@ -670,9 +670,9 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if, · 108 unmodified lines
670670 peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(er->ts32), &tv);
671671 hwts = skb_hwtstamps(skb);
672672 hwts->hwtstamp = timeval_to_ktime(tv);
673− netif_rx(skb);
674673 netdev->stats.rx_packets++;
675674 netdev->stats.rx_bytes += can_frame->can_dlc;
675+ netif_rx(skb);
676676
677677 return 0;
678678 }
drivers/net/can/usb/usb_8dev.c+2−4
@@ -461,10 +461,9 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv, · 460 unmodified lines
461461 priv->bec.txerr = txerr;
462462 priv->bec.rxerr = rxerr;
463463
464− netif_rx(skb);
465−
466464 stats->rx_packets++;
467465 stats->rx_bytes += cf->can_dlc;
466+ netif_rx(skb);
468467 }
469468
470469 /* Read data and status frames */
@@ -494,10 +493,9 @@ static void usb_8dev_rx_can_msg(struct usb_8dev_priv *priv, · 23 unmodified lines
494493 else
495494 memcpy(cf->data, msg->data, cf->can_dlc);
496495
497− netif_rx(skb);
498−
499496 stats->rx_packets++;
500497 stats->rx_bytes += cf->can_dlc;
498+ netif_rx(skb);
501499
502500 can_led_event(priv->netdev, CAN_LED_EVENT_RX);
503501 } else {
drivers/net/dsa/bcm_sf2.c+13−2
@@ -696,9 +696,20 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) · 695 unmodified lines
696696 }
697697
698698 /* Include the pseudo-PHY address and the broadcast PHY address to
699− * divert reads towards our workaround
699+ * divert reads towards our workaround. This is only required for
700+ * 7445D0, since 7445E0 disconnects the internal switch pseudo-PHY such
701+ * that we can use the regular SWITCH_MDIO master controller instead.
702+ *
703+ * By default, DSA initializes ds->phys_mii_mask to ds->phys_port_mask
704+ * to have a 1:1 mapping between Port address and PHY address in order
705+ * to utilize the slave_mii_bus instance to read from Port PHYs. This is
706+ * not what we want here, so we initialize phys_mii_mask 0 to always
707+ * utilize the "master" MDIO bus backed by the "mdio-unimac" driver.
700708 */
701− ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0));
709+ if (of_machine_is_compatible("brcm,bcm7445d0"))
710+ ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0));
711+ else
712+ ds->phys_mii_mask = 0;
702713
703714 rev = reg_readl(priv, REG_SWITCH_REVISION);
704715 priv->hw_params.top_rev = (rev >> SWITCH_TOP_REV_SHIFT) &
drivers/net/dsa/mv88e6xxx.c+1−1
@@ -1163,7 +1163,7 @@ int mv88e6xxx_leave_bridge(struct dsa_switch *ds, int port, u32 br_port_mask) · 1162 unmodified lines
11631163
11641164 newfid = __ffs(ps->fid_mask);
11651165 ps->fid[port] = newfid;
1166− ps->fid_mask &= (1 << newfid);
1166+ ps->fid_mask &= ~(1 << newfid);
11671167 ps->bridge_mask[fid] &= ~(1 << port);
11681168 ps->bridge_mask[newfid] = 1 << port;
11691169
drivers/net/ethernet/freescale/fec_main.c+13−75
@@ -24,7 +24,6 @@ · 23 unmodified lines
2424 #include <linux/module.h>
2525 #include <linux/kernel.h>
2626 #include <linux/string.h>
27−#include <linux/pm_runtime.h>
2827 #include <linux/ptrace.h>
2928 #include <linux/errno.h>
3029 #include <linux/ioport.h>
@@ -78,7 +77,6 @@ static void fec_enet_itr_coal_init(struct net_device *ndev); · 47 unmodified lines
7877 #define FEC_ENET_RAEM_V 0x8
7978 #define FEC_ENET_RAFL_V 0x8
8079 #define FEC_ENET_OPD_V 0xFFF0
81−#define FEC_MDIO_PM_TIMEOUT 100 /* ms */
8280
8381 static struct platform_device_id fec_devtype[] = {
8482 {
@@ -1769,13 +1767,7 @@ static void fec_enet_adjust_link(struct net_device *ndev) · 1684 unmodified lines
17691767 static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
17701768 {
17711769 struct fec_enet_private *fep = bus->priv;
1772− struct device *dev = &fep->pdev->dev;
17731770 unsigned long time_left;
1774− int ret = 0;
1775−
1776− ret = pm_runtime_get_sync(dev);
1777− if (IS_ERR_VALUE(ret))
1778− return ret;
17791771
17801772 fep->mii_timeout = 0;
17811773 init_completion(&fep->mdio_done);
@@ -1791,30 +1783,18 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum) · 9 unmodified lines
17911783 if (time_left == 0) {
17921784 fep->mii_timeout = 1;
17931785 netdev_err(fep->netdev, "MDIO read timeout\n");
1794− ret = -ETIMEDOUT;
1795− goto out;
1786+ return -ETIMEDOUT;
17961787 }
17971788
1798− ret = FEC_MMFR_DATA(readl(fep->hwp + FEC_MII_DATA));
1799−
1800−out:
1801− pm_runtime_mark_last_busy(dev);
1802− pm_runtime_put_autosuspend(dev);
1803−
1804− return ret;
1789+ /* return value */
1790+ return FEC_MMFR_DATA(readl(fep->hwp + FEC_MII_DATA));
18051791 }
18061792
18071793 static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
18081794 u16 value)
18091795 {
18101796 struct fec_enet_private *fep = bus->priv;
1811− struct device *dev = &fep->pdev->dev;
18121797 unsigned long time_left;
1813− int ret = 0;
1814−
1815− ret = pm_runtime_get_sync(dev);
1816− if (IS_ERR_VALUE(ret))
1817− return ret;
18181798
18191799 fep->mii_timeout = 0;
18201800 init_completion(&fep->mdio_done);
@@ -1831,13 +1811,10 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, · 10 unmodified lines
18311811 if (time_left == 0) {
18321812 fep->mii_timeout = 1;
18331813 netdev_err(fep->netdev, "MDIO write timeout\n");
1834− ret = -ETIMEDOUT;
1814+ return -ETIMEDOUT;
18351815 }
18361816
1837− pm_runtime_mark_last_busy(dev);
1838− pm_runtime_put_autosuspend(dev);
1839−
1840− return ret;
1817+ return 0;
18411818 }
18421819
18431820 static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
@@ -1849,6 +1826,9 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) · 5 unmodified lines
18491826 ret = clk_prepare_enable(fep->clk_ahb);
18501827 if (ret)
18511828 return ret;
1829+ ret = clk_prepare_enable(fep->clk_ipg);
1830+ if (ret)
1831+ goto failed_clk_ipg;
18521832 if (fep->clk_enet_out) {
18531833 ret = clk_prepare_enable(fep->clk_enet_out);
18541834 if (ret)
@@ -1872,6 +1852,7 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) · 17 unmodified lines
18721852 }
18731853 } else {
18741854 clk_disable_unprepare(fep->clk_ahb);
1855+ clk_disable_unprepare(fep->clk_ipg);
18751856 if (fep->clk_enet_out)
18761857 clk_disable_unprepare(fep->clk_enet_out);
18771858 if (fep->clk_ptp) {
@@ -1893,6 +1874,8 @@ failed_clk_ptp: · 15 unmodified lines
18931874 if (fep->clk_enet_out)
18941875 clk_disable_unprepare(fep->clk_enet_out);
18951876 failed_clk_enet_out:
1877+ clk_disable_unprepare(fep->clk_ipg);
1878+failed_clk_ipg:
18961879 clk_disable_unprepare(fep->clk_ahb);
18971880
18981881 return ret;
@@ -2864,14 +2847,10 @@ fec_enet_open(struct net_device *ndev) · 965 unmodified lines
28642847 struct fec_enet_private *fep = netdev_priv(ndev);
28652848 int ret;
28662849
2867− ret = pm_runtime_get_sync(&fep->pdev->dev);
2868− if (IS_ERR_VALUE(ret))
2869− return ret;
2870−
28712850 pinctrl_pm_select_default_state(&fep->pdev->dev);
28722851 ret = fec_enet_clk_enable(ndev, true);
28732852 if (ret)
2874− goto clk_enable;
2853+ return ret;
28752854
28762855 /* I should reset the ring buffers here, but I don't yet know
28772856 * a simple way to do that.
@@ -2902,9 +2881,6 @@ err_enet_mii_probe: · 24 unmodified lines
29022881 fec_enet_free_buffers(ndev);
29032882 err_enet_alloc:
29042883 fec_enet_clk_enable(ndev, false);
2905−clk_enable:
2906− pm_runtime_mark_last_busy(&fep->pdev->dev);
2907− pm_runtime_put_autosuspend(&fep->pdev->dev);
29082884 pinctrl_pm_select_sleep_state(&fep->pdev->dev);
29092885 return ret;
29102886 }
@@ -2927,9 +2903,6 @@ fec_enet_close(struct net_device *ndev) · 16 unmodified lines
29272903
29282904 fec_enet_clk_enable(ndev, false);
29292905 pinctrl_pm_select_sleep_state(&fep->pdev->dev);
2930− pm_runtime_mark_last_busy(&fep->pdev->dev);
2931− pm_runtime_put_autosuspend(&fep->pdev->dev);
2932−
29332906 fec_enet_free_buffers(ndev);
29342907
29352908 return 0;
@@ -3415,10 +3388,6 @@ fec_probe(struct platform_device *pdev) · 479 unmodified lines
34153388 if (ret)
34163389 goto failed_clk;
34173390
3418− ret = clk_prepare_enable(fep->clk_ipg);
3419− if (ret)
3420− goto failed_clk_ipg;
3421−
34223391 fep->reg_phy = devm_regulator_get(&pdev->dev, "phy");
34233392 if (!IS_ERR(fep->reg_phy)) {
34243393 ret = regulator_enable(fep->reg_phy);
@@ -3465,8 +3434,6 @@ fec_probe(struct platform_device *pdev) · 40 unmodified lines
34653434 netif_carrier_off(ndev);
34663435 fec_enet_clk_enable(ndev, false);
34673436 pinctrl_pm_select_sleep_state(&pdev->dev);
3468− pm_runtime_set_active(&pdev->dev);
3469− pm_runtime_enable(&pdev->dev);
34703437
34713438 ret = register_netdev(ndev);
34723439 if (ret)
@@ -3480,12 +3447,6 @@ fec_probe(struct platform_device *pdev) · 7 unmodified lines
34803447
34813448 fep->rx_copybreak = COPYBREAK_DEFAULT;
34823449 INIT_WORK(&fep->tx_timeout_work, fec_enet_timeout_work);
3483−
3484− pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT);
3485− pm_runtime_use_autosuspend(&pdev->dev);
3486− pm_runtime_mark_last_busy(&pdev->dev);
3487− pm_runtime_put_autosuspend(&pdev->dev);
3488−
34893450 return 0;
34903451
34913452 failed_register:
@@ -3496,8 +3457,6 @@ failed_init: · 4 unmodified lines
34963457 if (fep->reg_phy)
34973458 regulator_disable(fep->reg_phy);
34983459 failed_regulator:
3499− clk_disable_unprepare(fep->clk_ipg);
3500−failed_clk_ipg:
35013460 fec_enet_clk_enable(ndev, false);
35023461 failed_clk:
35033462 failed_phy:
@@ -3609,28 +3568,7 @@ failed_clk: · 105 unmodified lines
36093568 return ret;
36103569 }
36113570
3612−static int __maybe_unused fec_runtime_suspend(struct device *dev)
3613−{
3614− struct net_device *ndev = dev_get_drvdata(dev);
3615− struct fec_enet_private *fep = netdev_priv(ndev);
3616−
3617− clk_disable_unprepare(fep->clk_ipg);
3618−
3619− return 0;
3620−}
3621−
3622−static int __maybe_unused fec_runtime_resume(struct device *dev)
3623−{
3624− struct net_device *ndev = dev_get_drvdata(dev);
3625− struct fec_enet_private *fep = netdev_priv(ndev);
3626−
3627− return clk_prepare_enable(fep->clk_ipg);
3628−}
3629−
3630−static const struct dev_pm_ops fec_pm_ops = {
3631− SET_SYSTEM_SLEEP_PM_OPS(fec_suspend, fec_resume)
3632− SET_RUNTIME_PM_OPS(fec_runtime_suspend, fec_runtime_resume, NULL)
3633−};
3571+static SIMPLE_DEV_PM_OPS(fec_pm_ops, fec_suspend, fec_resume);
36343572
36353573 static struct platform_driver fec_driver = {
36363574 .driver = {
drivers/net/ethernet/marvell/mvneta.c+10−12
@@ -1462,7 +1462,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, · 1461 unmodified lines
14621462 struct mvneta_rx_queue *rxq)
14631463 {
14641464 struct net_device *dev = pp->dev;
1465− int rx_done, rx_filled;
1465+ int rx_done;
14661466 u32 rcvd_pkts = 0;
14671467 u32 rcvd_bytes = 0;
14681468
@@ -1473,7 +1473,6 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, · 4 unmodified lines
14731473 rx_todo = rx_done;
14741474
14751475 rx_done = 0;
1476− rx_filled = 0;
14771476
14781477 /* Fairness NAPI loop */
14791478 while (rx_done < rx_todo) {
@@ -1484,7 +1483,6 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, · 4 unmodified lines
14841483 int rx_bytes, err;
14851484
14861485 rx_done++;
1487− rx_filled++;
14881486 rx_status = rx_desc->status;
14891487 rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE);
14901488 data = (unsigned char *)rx_desc->buf_cookie;
@@ -1524,6 +1522,14 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, · 33 unmodified lines
15241522 continue;
15251523 }
15261524
1525+ /* Refill processing */
1526+ err = mvneta_rx_refill(pp, rx_desc);
1527+ if (err) {
1528+ netdev_err(dev, "Linux processing - Can't refill\n");
1529+ rxq->missed++;
1530+ goto err_drop_frame;
1531+ }
1532+
15271533 skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size);
15281534 if (!skb)
15291535 goto err_drop_frame;
@@ -1543,14 +1549,6 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, · 13 unmodified lines
15431549 mvneta_rx_csum(pp, rx_status, skb);
15441550
15451551 napi_gro_receive(&pp->napi, skb);
1546−
1547− /* Refill processing */
1548− err = mvneta_rx_refill(pp, rx_desc);
1549− if (err) {
1550− netdev_err(dev, "Linux processing - Can't refill\n");
1551− rxq->missed++;
1552− rx_filled--;
1553− }
15541552 }
15551553
15561554 if (rcvd_pkts) {
@@ -1563,7 +1561,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, · 6 unmodified lines
15631561 }
15641562
15651563 /* Update rxq management counters */
1566− mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_filled);
1564+ mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done);
15671565
15681566 return rx_done;
15691567 }
drivers/net/ethernet/renesas/ravb_main.c+38−36
@@ -228,9 +228,7 @@ static void ravb_ring_format(struct net_device *ndev, int q) · 227 unmodified lines
228228 struct ravb_desc *desc = NULL;
229229 int rx_ring_size = sizeof(*rx_desc) * priv->num_rx_ring[q];
230230 int tx_ring_size = sizeof(*tx_desc) * priv->num_tx_ring[q];
231− struct sk_buff *skb;
232231 dma_addr_t dma_addr;
233− void *buffer;
234232 int i;
235233
236234 priv->cur_rx[q] = 0;
@@ -241,41 +239,28 @@ static void ravb_ring_format(struct net_device *ndev, int q) · 4 unmodified lines
241239 memset(priv->rx_ring[q], 0, rx_ring_size);
242240 /* Build RX ring buffer */
243241 for (i = 0; i < priv->num_rx_ring[q]; i++) {
244− priv->rx_skb[q][i] = NULL;
245− skb = netdev_alloc_skb(ndev, PKT_BUF_SZ + RAVB_ALIGN - 1);
246− if (!skb)
247− break;
248− ravb_set_buffer_align(skb);
249242 /* RX descriptor */
250243 rx_desc = &priv->rx_ring[q][i];
251244 /* The size of the buffer should be on 16-byte boundary. */
252245 rx_desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16));
253− dma_addr = dma_map_single(&ndev->dev, skb->data,
246+ dma_addr = dma_map_single(&ndev->dev, priv->rx_skb[q][i]->data,
254247 ALIGN(PKT_BUF_SZ, 16),
255248 DMA_FROM_DEVICE);
256− if (dma_mapping_error(&ndev->dev, dma_addr)) {
257− dev_kfree_skb(skb);
258− break;
259− }
260− priv->rx_skb[q][i] = skb;
249+ /* We just set the data size to 0 for a failed mapping which
250+ * should prevent DMA from happening...
251+ */
252+ if (dma_mapping_error(&ndev->dev, dma_addr))
253+ rx_desc->ds_cc = cpu_to_le16(0);
261254 rx_desc->dptr = cpu_to_le32(dma_addr);
262255 rx_desc->die_dt = DT_FEMPTY;
263256 }
264257 rx_desc = &priv->rx_ring[q][i];
265258 rx_desc->dptr = cpu_to_le32((u32)priv->rx_desc_dma[q]);
266259 rx_desc->die_dt = DT_LINKFIX; /* type */
267− priv->dirty_rx[q] = (u32)(i - priv->num_rx_ring[q]);
268260
269261 memset(priv->tx_ring[q], 0, tx_ring_size);
270262 /* Build TX ring buffer */
271263 for (i = 0; i < priv->num_tx_ring[q]; i++) {
272− priv->tx_skb[q][i] = NULL;
273− priv->tx_buffers[q][i] = NULL;
274− buffer = kmalloc(PKT_BUF_SZ + RAVB_ALIGN - 1, GFP_KERNEL);
275− if (!buffer)
276− break;
277− /* Aligned TX buffer */
278− priv->tx_buffers[q][i] = buffer;
279264 tx_desc = &priv->tx_ring[q][i];
280265 tx_desc->die_dt = DT_EEMPTY;
281266 }
@@ -298,7 +283,10 @@ static void ravb_ring_format(struct net_device *ndev, int q) · 16 unmodified lines
298283 static int ravb_ring_init(struct net_device *ndev, int q)
299284 {
300285 struct ravb_private *priv = netdev_priv(ndev);
286+ struct sk_buff *skb;
301287 int ring_size;
288+ void *buffer;
289+ int i;
302290
303291 /* Allocate RX and TX skb rings */
304292 priv->rx_skb[q] = kcalloc(priv->num_rx_ring[q],
@@ -308,12 +296,28 @@ static int ravb_ring_init(struct net_device *ndev, int q) · 3 unmodified lines
308296 if (!priv->rx_skb[q] || !priv->tx_skb[q])
309297 goto error;
310298
299+ for (i = 0; i < priv->num_rx_ring[q]; i++) {
300+ skb = netdev_alloc_skb(ndev, PKT_BUF_SZ + RAVB_ALIGN - 1);
301+ if (!skb)
302+ goto error;
303+ ravb_set_buffer_align(skb);
304+ priv->rx_skb[q][i] = skb;
305+ }
306+
311307 /* Allocate rings for the aligned buffers */
312308 priv->tx_buffers[q] = kcalloc(priv->num_tx_ring[q],
313309 sizeof(*priv->tx_buffers[q]), GFP_KERNEL);
314310 if (!priv->tx_buffers[q])
315311 goto error;
316312
313+ for (i = 0; i < priv->num_tx_ring[q]; i++) {
314+ buffer = kmalloc(PKT_BUF_SZ + RAVB_ALIGN - 1, GFP_KERNEL);
315+ if (!buffer)
316+ goto error;
317+ /* Aligned TX buffer */
318+ priv->tx_buffers[q][i] = buffer;
319+ }
320+
317321 /* Allocate all RX descriptors. */
318322 ring_size = sizeof(struct ravb_ex_rx_desc) * (priv->num_rx_ring[q] + 1);
319323 priv->rx_ring[q] = dma_alloc_coherent(NULL, ring_size,
@@ -524,6 +528,10 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q) · 204 unmodified lines
524528 if (--boguscnt < 0)
525529 break;
526530
531+ /* We use 0-byte descriptors to mark the DMA mapping errors */
532+ if (!pkt_len)
533+ continue;
534+
527535 if (desc_status & MSC_MC)
528536 stats->multicast++;
529537
@@ -543,10 +551,9 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q) · 13 unmodified lines
543551
544552 skb = priv->rx_skb[q][entry];
545553 priv->rx_skb[q][entry] = NULL;
546− dma_sync_single_for_cpu(&ndev->dev,
547− le32_to_cpu(desc->dptr),
548− ALIGN(PKT_BUF_SZ, 16),
549− DMA_FROM_DEVICE);
554+ dma_unmap_single(&ndev->dev, le32_to_cpu(desc->dptr),
555+ ALIGN(PKT_BUF_SZ, 16),
556+ DMA_FROM_DEVICE);
550557 get_ts &= (q == RAVB_NC) ?
551558 RAVB_RXTSTAMP_TYPE_V2_L2_EVENT :
552559 ~RAVB_RXTSTAMP_TYPE_V2_L2_EVENT;
@@ -584,17 +591,15 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q) · 31 unmodified lines
584591 if (!skb)
585592 break; /* Better luck next round. */
586593 ravb_set_buffer_align(skb);
587− dma_unmap_single(&ndev->dev, le32_to_cpu(desc->dptr),
588− ALIGN(PKT_BUF_SZ, 16),
589− DMA_FROM_DEVICE);
590594 dma_addr = dma_map_single(&ndev->dev, skb->data,
591595 le16_to_cpu(desc->ds_cc),
592596 DMA_FROM_DEVICE);
593597 skb_checksum_none_assert(skb);
594− if (dma_mapping_error(&ndev->dev, dma_addr)) {
595− dev_kfree_skb_any(skb);
596− break;
597− }
598+ /* We just set the data size to 0 for a failed mapping
599+ * which should prevent DMA from happening...
600+ */
601+ if (dma_mapping_error(&ndev->dev, dma_addr))
602+ desc->ds_cc = cpu_to_le16(0);
598603 desc->dptr = cpu_to_le32(dma_addr);
599604 priv->rx_skb[q][entry] = skb;
600605 }
@@ -1279,7 +1284,6 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 678 unmodified lines
12791284 u32 dma_addr;
12801285 void *buffer;
12811286 u32 entry;
1282− u32 tccr;
12831287
12841288 spin_lock_irqsave(&priv->lock, flags);
12851289 if (priv->cur_tx[q] - priv->dirty_tx[q] >= priv->num_tx_ring[q]) {
@@ -1328,9 +1332,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 42 unmodified lines
13281332 dma_wmb();
13291333 desc->die_dt = DT_FSINGLE;
13301334
1331− tccr = ravb_read(ndev, TCCR);
1332− if (!(tccr & (TCCR_TSRQ0 << q)))
1333− ravb_write(ndev, tccr | (TCCR_TSRQ0 << q), TCCR);
1335+ ravb_write(ndev, ravb_read(ndev, TCCR) | (TCCR_TSRQ0 << q), TCCR);
13341336
13351337 priv->cur_tx[q]++;
13361338 if (priv->cur_tx[q] - priv->dirty_tx[q] >= priv->num_tx_ring[q] &&
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+1−1
@@ -2843,7 +2843,7 @@ int stmmac_dvr_probe(struct device *device, · 2842 unmodified lines
28432843 if (res->mac)
28442844 memcpy(priv->dev->dev_addr, res->mac, ETH_ALEN);
28452845
2846− dev_set_drvdata(device, priv);
2846+ dev_set_drvdata(device, priv->dev);
28472847
28482848 /* Verify driver arguments */
28492849 stmmac_verify_args();
drivers/net/ethernet/ti/cpsw.c+3−6
@@ -793,9 +793,7 @@ static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id) · 792 unmodified lines
793793 static int cpsw_poll(struct napi_struct *napi, int budget)
794794 {
795795 struct cpsw_priv *priv = napi_to_priv(napi);
796− int num_tx, num_rx;
797−
798− num_tx = cpdma_chan_process(priv->txch, 128);
796+ int num_rx;
799797
800798 num_rx = cpdma_chan_process(priv->rxch, budget);
801799 if (num_rx < budget) {
@@ -810,9 +808,8 @@ static int cpsw_poll(struct napi_struct *napi, int budget) · 8 unmodified lines
810808 }
811809 }
812810
813− if (num_rx || num_tx)
814− cpsw_dbg(priv, intr, "poll %d rx, %d tx pkts\n",
815− num_rx, num_tx);
811+ if (num_rx)
812+ cpsw_dbg(priv, intr, "poll %d rx pkts\n", num_rx);
816813
817814 return num_rx;
818815 }
drivers/net/ethernet/ti/netcp_core.c+1−1
@@ -1617,11 +1617,11 @@ static int netcp_ndo_open(struct net_device *ndev) · 1616 unmodified lines
16171617 }
16181618 mutex_unlock(&netcp_modules_lock);
16191619
1620− netcp_rxpool_refill(netcp);
16211620 napi_enable(&netcp->rx_napi);
16221621 napi_enable(&netcp->tx_napi);
16231622 knav_queue_enable_notify(netcp->tx_compl_q);
16241623 knav_queue_enable_notify(netcp->rx_queue);
1624+ netcp_rxpool_refill(netcp);
16251625 netif_tx_wake_all_queues(ndev);
16261626 dev_dbg(netcp->ndev_dev, "netcp device %s opened\n", ndev->name);
16271627 return 0;
drivers/net/ipvlan/ipvlan.h+6−3
@@ -67,8 +67,6 @@ struct ipvl_dev { · 66 unmodified lines
6767 struct ipvl_port *port;
6868 struct net_device *phy_dev;
6969 struct list_head addrs;
70− int ipv4cnt;
71− int ipv6cnt;
7270 struct ipvl_pcpu_stats __percpu *pcpu_stats;
7371 DECLARE_BITMAP(mac_filters, IPVLAN_MAC_FILTER_SIZE);
7472 netdev_features_t sfeatures;
@@ -106,6 +104,11 @@ static inline struct ipvl_port *ipvlan_port_get_rcu(const struct net_device *d) · 31 unmodified lines
106104 return rcu_dereference(d->rx_handler_data);
107105 }
108106
107+static inline struct ipvl_port *ipvlan_port_get_rcu_bh(const struct net_device *d)
108+{
109+ return rcu_dereference_bh(d->rx_handler_data);
110+}
111+
109112 static inline struct ipvl_port *ipvlan_port_get_rtnl(const struct net_device *d)
110113 {
111114 return rtnl_dereference(d->rx_handler_data);
@@ -124,5 +127,5 @@ struct ipvl_addr *ipvlan_find_addr(const struct ipvl_dev *ipvlan, · 12 unmodified lines
124127 bool ipvlan_addr_busy(struct ipvl_port *port, void *iaddr, bool is_v6);
125128 struct ipvl_addr *ipvlan_ht_addr_lookup(const struct ipvl_port *port,
126129 const void *iaddr, bool is_v6);
127−void ipvlan_ht_addr_del(struct ipvl_addr *addr, bool sync);
130+void ipvlan_ht_addr_del(struct ipvl_addr *addr);
128131 #endif /* __IPVLAN_H */
drivers/net/ipvlan/ipvlan_core.c+2−4
@@ -85,11 +85,9 @@ void ipvlan_ht_addr_add(struct ipvl_dev *ipvlan, struct ipvl_addr *addr) · 84 unmodified lines
8585 hlist_add_head_rcu(&addr->hlnode, &port->hlhead[hash]);
8686 }
8787
88−void ipvlan_ht_addr_del(struct ipvl_addr *addr, bool sync)
88+void ipvlan_ht_addr_del(struct ipvl_addr *addr)
8989 {
9090 hlist_del_init_rcu(&addr->hlnode);
91− if (sync)
92− synchronize_rcu();
9391 }
9492
9593 struct ipvl_addr *ipvlan_find_addr(const struct ipvl_dev *ipvlan,
@@ -531,7 +529,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev) · 435 unmodified lines
531529 int ipvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
532530 {
533531 struct ipvl_dev *ipvlan = netdev_priv(dev);
534− struct ipvl_port *port = ipvlan_port_get_rcu(ipvlan->phy_dev);
532+ struct ipvl_port *port = ipvlan_port_get_rcu_bh(ipvlan->phy_dev);
535533
536534 if (!port)
537535 goto out;
drivers/net/ipvlan/ipvlan_main.c+19−23
@@ -153,10 +153,9 @@ static int ipvlan_open(struct net_device *dev) · 152 unmodified lines
153153 else
154154 dev->flags &= ~IFF_NOARP;
155155
156− if (ipvlan->ipv6cnt > 0 || ipvlan->ipv4cnt > 0) {
157− list_for_each_entry(addr, &ipvlan->addrs, anode)
158− ipvlan_ht_addr_add(ipvlan, addr);
159− }
156+ list_for_each_entry(addr, &ipvlan->addrs, anode)
157+ ipvlan_ht_addr_add(ipvlan, addr);
158+
160159 return dev_uc_add(phy_dev, phy_dev->dev_addr);
161160 }
162161
@@ -171,10 +170,9 @@ static int ipvlan_stop(struct net_device *dev) · 8 unmodified lines
171170
172171 dev_uc_del(phy_dev, phy_dev->dev_addr);
173172
174− if (ipvlan->ipv6cnt > 0 || ipvlan->ipv4cnt > 0) {
175− list_for_each_entry(addr, &ipvlan->addrs, anode)
176− ipvlan_ht_addr_del(addr, !dev->dismantle);
177− }
173+ list_for_each_entry(addr, &ipvlan->addrs, anode)
174+ ipvlan_ht_addr_del(addr);
175+
178176 return 0;
179177 }
180178
@@ -471,8 +469,6 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev, · 290 unmodified lines
471469 ipvlan->port = port;
472470 ipvlan->sfeatures = IPVLAN_FEATURES;
473471 INIT_LIST_HEAD(&ipvlan->addrs);
474− ipvlan->ipv4cnt = 0;
475− ipvlan->ipv6cnt = 0;
476472
477473 /* TODO Probably put random address here to be presented to the
478474 * world but keep using the physical-dev address for the outgoing
@@ -508,12 +504,12 @@ static void ipvlan_link_delete(struct net_device *dev, struct list_head *head) · 29 unmodified lines
508504 struct ipvl_dev *ipvlan = netdev_priv(dev);
509505 struct ipvl_addr *addr, *next;
510506
511− if (ipvlan->ipv6cnt > 0 || ipvlan->ipv4cnt > 0) {
512− list_for_each_entry_safe(addr, next, &ipvlan->addrs, anode) {
513− ipvlan_ht_addr_del(addr, !dev->dismantle);
514− list_del(&addr->anode);
515− }
507+ list_for_each_entry_safe(addr, next, &ipvlan->addrs, anode) {
508+ ipvlan_ht_addr_del(addr);
509+ list_del(&addr->anode);
510+ kfree_rcu(addr, rcu);
516511 }
512+
517513 list_del_rcu(&ipvlan->pnode);
518514 unregister_netdevice_queue(dev, head);
519515 netdev_upper_dev_unlink(ipvlan->phy_dev, dev);
@@ -627,7 +623,7 @@ static int ipvlan_add_addr6(struct ipvl_dev *ipvlan, struct in6_addr *ip6_addr) · 107 unmodified lines
627623 memcpy(&addr->ip6addr, ip6_addr, sizeof(struct in6_addr));
628624 addr->atype = IPVL_IPV6;
629625 list_add_tail(&addr->anode, &ipvlan->addrs);
630− ipvlan->ipv6cnt++;
626+
631627 /* If the interface is not up, the address will be added to the hash
632628 * list by ipvlan_open.
633629 */
@@ -645,10 +641,8 @@ static void ipvlan_del_addr6(struct ipvl_dev *ipvlan, struct in6_addr *ip6_addr) · 11 unmodified lines
645641 if (!addr)
646642 return;
647643
648− ipvlan_ht_addr_del(addr, true);
644+ ipvlan_ht_addr_del(addr);
649645 list_del(&addr->anode);
650− ipvlan->ipv6cnt--;
651− WARN_ON(ipvlan->ipv6cnt < 0);
652646 kfree_rcu(addr, rcu);
653647
654648 return;
@@ -661,6 +655,10 @@ static int ipvlan_addr6_event(struct notifier_block *unused, · 6 unmodified lines
661655 struct net_device *dev = (struct net_device *)if6->idev->dev;
662656 struct ipvl_dev *ipvlan = netdev_priv(dev);
663657
658+ /* FIXME IPv6 autoconf calls us from bh without RTNL */
659+ if (in_softirq())
660+ return NOTIFY_DONE;
661+
664662 if (!netif_is_ipvlan(dev))
665663 return NOTIFY_DONE;
666664
@@ -699,7 +697,7 @@ static int ipvlan_add_addr4(struct ipvl_dev *ipvlan, struct in_addr *ip4_addr) · 32 unmodified lines
699697 memcpy(&addr->ip4addr, ip4_addr, sizeof(struct in_addr));
700698 addr->atype = IPVL_IPV4;
701699 list_add_tail(&addr->anode, &ipvlan->addrs);
702− ipvlan->ipv4cnt++;
700+
703701 /* If the interface is not up, the address will be added to the hash
704702 * list by ipvlan_open.
705703 */
@@ -717,10 +715,8 @@ static void ipvlan_del_addr4(struct ipvl_dev *ipvlan, struct in_addr *ip4_addr) · 11 unmodified lines
717715 if (!addr)
718716 return;
719717
720− ipvlan_ht_addr_del(addr, true);
718+ ipvlan_ht_addr_del(addr);
721719 list_del(&addr->anode);
722− ipvlan->ipv4cnt--;
723− WARN_ON(ipvlan->ipv4cnt < 0);
724720 kfree_rcu(addr, rcu);
725721
726722 return;
drivers/net/phy/dp83867.c+1−1
@@ -164,7 +164,7 @@ static int dp83867_config_init(struct phy_device *phydev) · 163 unmodified lines
164164 return ret;
165165 }
166166
167− if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) ||
167+ if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) &&
168168 (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) {
169169 val = phy_read_mmd_indirect(phydev, DP83867_RGMIICTL,
170170 DP83867_DEVADDR, phydev->addr);
drivers/net/phy/mdio_bus.c+17−2
@@ -421,6 +421,8 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv) · 420 unmodified lines
421421 {
422422 struct phy_device *phydev = to_phy_device(dev);
423423 struct phy_driver *phydrv = to_phy_driver(drv);
424+ const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids);
425+ int i;
424426
425427 if (of_driver_match_device(dev, drv))
426428 return 1;
@@ -428,8 +430,21 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv) · 1 unmodified line
428430 if (phydrv->match_phy_device)
429431 return phydrv->match_phy_device(phydev);
430432
431− return (phydrv->phy_id & phydrv->phy_id_mask) ==
432− (phydev->phy_id & phydrv->phy_id_mask);
433+ if (phydev->is_c45) {
434+ for (i = 1; i < num_ids; i++) {
435+ if (!(phydev->c45_ids.devices_in_package & (1 << i)))
436+ continue;
437+
438+ if ((phydrv->phy_id & phydrv->phy_id_mask) ==
439+ (phydev->c45_ids.device_ids[i] &
440+ phydrv->phy_id_mask))
441+ return 1;
442+ }
443+ return 0;
444+ } else {
445+ return (phydrv->phy_id & phydrv->phy_id_mask) ==
446+ (phydev->phy_id & phydrv->phy_id_mask);
447+ }
433448 }
434449
435450 #ifdef CONFIG_PM
drivers/net/usb/qmi_wwan.c+1−0
@@ -757,6 +757,7 @@ static const struct usb_device_id products[] = { · 756 unmodified lines
757757 {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */
758758 {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */
759759 {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */
760+ {QMI_FIXED_INTF(0x1199, 0x9041, 10)}, /* Sierra Wireless MC7305/MC7355 */
760761 {QMI_FIXED_INTF(0x1199, 0x9051, 8)}, /* Netgear AirCard 340U */
761762 {QMI_FIXED_INTF(0x1199, 0x9053, 8)}, /* Sierra Wireless Modem */
762763 {QMI_FIXED_INTF(0x1199, 0x9054, 8)}, /* Sierra Wireless Modem */
drivers/net/virtio_net.c+2−1
@@ -1828,7 +1828,8 @@ static int virtnet_probe(struct virtio_device *vdev) · 1827 unmodified lines
18281828 else
18291829 vi->hdr_len = sizeof(struct virtio_net_hdr);
18301830
1831− if (virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT))
1831+ if (virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT) ||
1832+ virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
18321833 vi->any_header_sg = true;
18331834
18341835 if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ))
drivers/net/wireless/ath/ath9k/hw.c+1−0
@@ -279,6 +279,7 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah) · 278 unmodified lines
279279 return;
280280 case AR9300_DEVID_QCA956X:
281281 ah->hw_version.macVersion = AR_SREV_VERSION_9561;
282+ return;
282283 }
283284
284285 val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
drivers/net/wireless/iwlwifi/iwl-fh.h+6−0
@@ -438,6 +438,12 @@ static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) · 437 unmodified lines
438438 #define RX_QUEUE_MASK 255
439439 #define RX_QUEUE_SIZE_LOG 8
440440
441+/*
442+ * RX related structures and functions
443+ */
444+#define RX_FREE_BUFFERS 64
445+#define RX_LOW_WATERMARK 8
446+
441447 /**
442448 * struct iwl_rb_status - reserve buffer status
443449 * host memory mapped FH registers
drivers/net/wireless/iwlwifi/iwl-nvm-parse.c+5−7
@@ -540,13 +540,11 @@ static void iwl_set_hw_address_family_8000(struct device *dev, · 539 unmodified lines
540540 hw_addr = (const u8 *)(mac_override +
541541 MAC_ADDRESS_OVERRIDE_FAMILY_8000);
542542
543− /* The byte order is little endian 16 bit, meaning 214365 */
544− data->hw_addr[0] = hw_addr[1];
545− data->hw_addr[1] = hw_addr[0];
546− data->hw_addr[2] = hw_addr[3];
547− data->hw_addr[3] = hw_addr[2];
548− data->hw_addr[4] = hw_addr[5];
549− data->hw_addr[5] = hw_addr[4];
543+ /*
544+ * Store the MAC address from MAO section.
545+ * No byte swapping is required in MAO section
546+ */
547+ memcpy(data->hw_addr, hw_addr, ETH_ALEN);
550548
551549 /*
552550 * Force the use of the OTP MAC address in case of reserved MAC
drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h+2−1
@@ -660,7 +660,8 @@ struct iwl_scan_config { · 659 unmodified lines
660660 * iwl_umac_scan_flags
661661 *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
662662 * can be preempted by other scan requests with higher priority.
663− * The low priority scan is aborted.
663+ * The low priority scan will be resumed when the higher proirity scan is
664+ * completed.
664665 *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
665666 * when scan starts.
666667 */
drivers/net/wireless/iwlwifi/mvm/scan.c+3−0
@@ -1109,6 +1109,9 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 1108 unmodified lines
11091109 cmd->uid = cpu_to_le32(uid);
11101110 cmd->general_flags = cpu_to_le32(iwl_mvm_scan_umac_flags(mvm, params));
11111111
1112+ if (type == IWL_MVM_SCAN_SCHED)
1113+ cmd->flags = cpu_to_le32(IWL_UMAC_SCAN_FLAG_PREEMPTIVE);
1114+
11121115 if (iwl_mvm_scan_use_ebs(mvm, vif, n_iterations))
11131116 cmd->channel_flags = IWL_SCAN_CHANNEL_FLAG_EBS |
11141117 IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
drivers/net/wireless/iwlwifi/mvm/sta.c+2−1
@@ -1401,6 +1401,7 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, · 1400 unmodified lines
14011401 bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE);
14021402 u8 sta_id;
14031403 int ret;
1404+ static const u8 __maybe_unused zero_addr[ETH_ALEN] = {0};
14041405
14051406 lockdep_assert_held(&mvm->mutex);
14061407
@@ -1467,7 +1468,7 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, · 60 unmodified lines
14671468 end:
14681469 IWL_DEBUG_WEP(mvm, "key: cipher=%x len=%d idx=%d sta=%pM ret=%d\n",
14691470 keyconf->cipher, keyconf->keylen, keyconf->keyidx,
1470− sta->addr, ret);
1471+ sta ? sta->addr : zero_addr, ret);
14711472 return ret;
14721473 }
14731474
drivers/net/wireless/iwlwifi/mvm/time-event.c+1−1
@@ -86,7 +86,7 @@ void iwl_mvm_te_clear_data(struct iwl_mvm *mvm, · 85 unmodified lines
8686 {
8787 lockdep_assert_held(&mvm->time_event_lock);
8888
89− if (te_data->id == TE_MAX)
89+ if (!te_data->vif)
9090 return;
9191
9292 list_del(&te_data->list);
drivers/net/wireless/iwlwifi/mvm/tx.c+1−1
@@ -252,7 +252,7 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd, · 251 unmodified lines
252252
253253 if (info->band == IEEE80211_BAND_2GHZ &&
254254 !iwl_mvm_bt_coex_is_shared_ant_avail(mvm))
255− rate_flags = BIT(mvm->cfg->non_shared_ant) << RATE_MCS_ANT_POS;
255+ rate_flags = mvm->cfg->non_shared_ant << RATE_MCS_ANT_POS;
256256 else
257257 rate_flags =
258258 BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS;
drivers/net/wireless/iwlwifi/pcie/drv.c+3−2
@@ -368,12 +368,14 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 367 unmodified lines
368368 /* 3165 Series */
369369 {IWL_PCI_DEVICE(0x3165, 0x4010, iwl3165_2ac_cfg)},
370370 {IWL_PCI_DEVICE(0x3165, 0x4012, iwl3165_2ac_cfg)},
371+ {IWL_PCI_DEVICE(0x3166, 0x4212, iwl3165_2ac_cfg)},
371372 {IWL_PCI_DEVICE(0x3165, 0x4410, iwl3165_2ac_cfg)},
372373 {IWL_PCI_DEVICE(0x3165, 0x4510, iwl3165_2ac_cfg)},
373374 {IWL_PCI_DEVICE(0x3165, 0x4110, iwl3165_2ac_cfg)},
374375 {IWL_PCI_DEVICE(0x3166, 0x4310, iwl3165_2ac_cfg)},
375376 {IWL_PCI_DEVICE(0x3166, 0x4210, iwl3165_2ac_cfg)},
376377 {IWL_PCI_DEVICE(0x3165, 0x8010, iwl3165_2ac_cfg)},
378+ {IWL_PCI_DEVICE(0x3165, 0x8110, iwl3165_2ac_cfg)},
377379
378380 /* 7265 Series */
379381 {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)},
@@ -426,9 +428,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 46 unmodified lines
426428 {IWL_PCI_DEVICE(0x24F4, 0x1130, iwl8260_2ac_cfg)},
427429 {IWL_PCI_DEVICE(0x24F4, 0x1030, iwl8260_2ac_cfg)},
428430 {IWL_PCI_DEVICE(0x24F3, 0xC010, iwl8260_2ac_cfg)},
431+ {IWL_PCI_DEVICE(0x24F3, 0xC110, iwl8260_2ac_cfg)},
429432 {IWL_PCI_DEVICE(0x24F3, 0xD010, iwl8260_2ac_cfg)},
430− {IWL_PCI_DEVICE(0x24F4, 0xC030, iwl8260_2ac_cfg)},
431− {IWL_PCI_DEVICE(0x24F4, 0xD030, iwl8260_2ac_cfg)},
432433 {IWL_PCI_DEVICE(0x24F3, 0xC050, iwl8260_2ac_cfg)},
433434 {IWL_PCI_DEVICE(0x24F3, 0xD050, iwl8260_2ac_cfg)},
434435 {IWL_PCI_DEVICE(0x24F3, 0x8010, iwl8260_2ac_cfg)},
drivers/net/wireless/iwlwifi/pcie/internal.h+8−43
@@ -44,15 +44,6 @@ · 43 unmodified lines
4444 #include "iwl-io.h"
4545 #include "iwl-op-mode.h"
4646
47−/*
48− * RX related structures and functions
49− */
50−#define RX_NUM_QUEUES 1
51−#define RX_POST_REQ_ALLOC 2
52−#define RX_CLAIM_REQ_ALLOC 8
53−#define RX_POOL_SIZE ((RX_CLAIM_REQ_ALLOC - RX_POST_REQ_ALLOC) * RX_NUM_QUEUES)
54−#define RX_LOW_WATERMARK 8
55−
5647 struct iwl_host_cmd;
5748
5849 /*This file includes the declaration that are internal to the
@@ -86,29 +77,29 @@ struct isr_statistics { · 27 unmodified lines
8677 * struct iwl_rxq - Rx queue
8778 * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
8879 * @bd_dma: bus address of buffer of receive buffer descriptors (rbd)
80+ * @pool:
81+ * @queue:
8982 * @read: Shared index to newest available Rx buffer
9083 * @write: Shared index to oldest written Rx packet
9184 * @free_count: Number of pre-allocated buffers in rx_free
92− * @used_count: Number of RBDs handled to allocator to use for allocation
9385 * @write_actual:
94− * @rx_free: list of RBDs with allocated RB ready for use
95− * @rx_used: list of RBDs with no RB attached
86+ * @rx_free: list of free SKBs for use
87+ * @rx_used: List of Rx buffers with no SKB
9688 * @need_update: flag to indicate we need to update read/write index
9789 * @rb_stts: driver's pointer to receive buffer status
9890 * @rb_stts_dma: bus address of receive buffer status
9991 * @lock:
100− * @pool: initial pool of iwl_rx_mem_buffer for the queue
101− * @queue: actual rx queue
10292 *
10393 * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
10494 */
10595 struct iwl_rxq {
10696 __le32 *bd;
10797 dma_addr_t bd_dma;
98+ struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
99+ struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
108100 u32 read;
109101 u32 write;
110102 u32 free_count;
111− u32 used_count;
112103 u32 write_actual;
113104 struct list_head rx_free;
114105 struct list_head rx_used;
@@ -116,32 +107,6 @@ struct iwl_rxq { · 1 unmodified line
116107 struct iwl_rb_status *rb_stts;
117108 dma_addr_t rb_stts_dma;
118109 spinlock_t lock;
119− struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE];
120− struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
121−};
122−
123−/**
124− * struct iwl_rb_allocator - Rx allocator
125− * @pool: initial pool of allocator
126− * @req_pending: number of requests the allcator had not processed yet
127− * @req_ready: number of requests honored and ready for claiming
128− * @rbd_allocated: RBDs with pages allocated and ready to be handled to
129− * the queue. This is a list of &struct iwl_rx_mem_buffer
130− * @rbd_empty: RBDs with no page attached for allocator use. This is a list
131− * of &struct iwl_rx_mem_buffer
132− * @lock: protects the rbd_allocated and rbd_empty lists
133− * @alloc_wq: work queue for background calls
134− * @rx_alloc: work struct for background calls
135− */
136−struct iwl_rb_allocator {
137− struct iwl_rx_mem_buffer pool[RX_POOL_SIZE];
138− atomic_t req_pending;
139− atomic_t req_ready;
140− struct list_head rbd_allocated;
141− struct list_head rbd_empty;
142− spinlock_t lock;
143− struct workqueue_struct *alloc_wq;
144− struct work_struct rx_alloc;
145110 };
146111
147112 struct iwl_dma_ptr {
@@ -285,7 +250,7 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx) · 137 unmodified lines
285250 /**
286251 * struct iwl_trans_pcie - PCIe transport specific data
287252 * @rxq: all the RX queue data
288− * @rba: allocator for RX replenishing
253+ * @rx_replenish: work that will be called when buffers need to be allocated
289254 * @drv - pointer to iwl_drv
290255 * @trans: pointer to the generic transport area
291256 * @scd_base_addr: scheduler sram base address in SRAM
@@ -308,7 +273,7 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx) · 16 unmodified lines
308273 */
309274 struct iwl_trans_pcie {
310275 struct iwl_rxq rxq;
311− struct iwl_rb_allocator rba;
276+ struct work_struct rx_replenish;
312277 struct iwl_trans *trans;
313278 struct iwl_drv *drv;
314279
drivers/net/wireless/iwlwifi/pcie/rx.c+83−331
@@ -1,7 +1,7 @@
11 /******************************************************************************
22 *
33 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
4− * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
4+ * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
55 *
66 * Portions of this file are derived from the ipw3945 project, as well
77 * as portions of the ieee80211 subsystem header files.
@@ -74,29 +74,16 @@ · 66 unmodified lines
7474 * resets the Rx queue buffers with new memory.
7575 *
7676 * The management in the driver is as follows:
77− * + A list of pre-allocated RBDs is stored in iwl->rxq->rx_free.
78− * When the interrupt handler is called, the request is processed.
79− * The page is either stolen - transferred to the upper layer
80− * or reused - added immediately to the iwl->rxq->rx_free list.
81− * + When the page is stolen - the driver updates the matching queue's used
82− * count, detaches the RBD and transfers it to the queue used list.
83− * When there are two used RBDs - they are transferred to the allocator empty
84− * list. Work is then scheduled for the allocator to start allocating
85− * eight buffers.
86− * When there are another 6 used RBDs - they are transferred to the allocator
87− * empty list and the driver tries to claim the pre-allocated buffers and
88− * add them to iwl->rxq->rx_free. If it fails - it continues to claim them
89− * until ready.
90− * When there are 8+ buffers in the free list - either from allocation or from
91− * 8 reused unstolen pages - restock is called to update the FW and indexes.
92− * + In order to make sure the allocator always has RBDs to use for allocation
93− * the allocator has initial pool in the size of num_queues*(8-2) - the
94− * maximum missing RBDs per allocation request (request posted with 2
95− * empty RBDs, there is no guarantee when the other 6 RBDs are supplied).
96− * The queues supplies the recycle of the rest of the RBDs.
77+ * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When
78+ * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
79+ * to replenish the iwl->rxq->rx_free.
80+ * + In iwl_pcie_rx_replenish (scheduled) if 'processed' != 'read' then the
81+ * iwl->rxq is replenished and the READ INDEX is updated (updating the
82+ * 'processed' and 'read' driver indexes as well)
9783 * + A received packet is processed and handed to the kernel network stack,
9884 * detached from the iwl->rxq. The driver 'processed' index is updated.
99− * + If there are no allocated buffers in iwl->rxq->rx_free,
85+ * + The Host/Firmware iwl->rxq is replenished at irq thread time from the
86+ * rx_free list. If there are no allocated buffers in iwl->rxq->rx_free,
10087 * the READ INDEX is not incremented and iwl->status(RX_STALLED) is set.
10188 * If there were enough free buffers and RX_STALLED is set it is cleared.
10289 *
@@ -105,32 +92,18 @@ · 2 unmodified lines
10592 *
10693 * iwl_rxq_alloc() Allocates rx_free
10794 * iwl_pcie_rx_replenish() Replenishes rx_free list from rx_used, and calls
108− * iwl_pcie_rxq_restock.
109− * Used only during initialization.
95+ * iwl_pcie_rxq_restock
11096 * iwl_pcie_rxq_restock() Moves available buffers from rx_free into Rx
11197 * queue, updates firmware pointers, and updates
112− * the WRITE index.
113− * iwl_pcie_rx_allocator() Background work for allocating pages.
98+ * the WRITE index. If insufficient rx_free buffers
99+ * are available, schedules iwl_pcie_rx_replenish
114100 *
115101 * -- enable interrupts --
116102 * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the
117103 * READ INDEX, detaching the SKB from the pool.
118104 * Moves the packet buffer from queue to rx_used.
119− * Posts and claims requests to the allocator.
120105 * Calls iwl_pcie_rxq_restock to refill any empty
121106 * slots.
122− *
123− * RBD life-cycle:
124− *
125− * Init:
126− * rxq.pool -> rxq.rx_used -> rxq.rx_free -> rxq.queue
127− *
128− * Regular Receive interrupt:
129− * Page Stolen:
130− * rxq.queue -> rxq.rx_used -> allocator.rbd_empty ->
131− * allocator.rbd_allocated -> rxq.rx_free -> rxq.queue
132− * Page not Stolen:
133− * rxq.queue -> rxq.rx_free -> rxq.queue
134107 * ...
135108 *
136109 */
@@ -267,6 +240,10 @@ static void iwl_pcie_rxq_restock(struct iwl_trans *trans) · 130 unmodified lines
267240 rxq->free_count--;
268241 }
269242 spin_unlock(&rxq->lock);
243+ /* If the pre-allocated buffer pool is dropping low, schedule to
244+ * refill it */
245+ if (rxq->free_count <= RX_LOW_WATERMARK)
246+ schedule_work(&trans_pcie->rx_replenish);
270247
271248 /* If we've added more space for the firmware to place data, tell it.
272249 * Increment device's write pointer in multiples of 8. */
@@ -277,44 +254,6 @@ static void iwl_pcie_rxq_restock(struct iwl_trans *trans) · 4 unmodified lines
277254 }
278255 }
279256
280−/*
281− * iwl_pcie_rx_alloc_page - allocates and returns a page.
282− *
283− */
284−static struct page *iwl_pcie_rx_alloc_page(struct iwl_trans *trans)
285−{
286− struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
287− struct iwl_rxq *rxq = &trans_pcie->rxq;
288− struct page *page;
289− gfp_t gfp_mask = GFP_KERNEL;
290−
291− if (rxq->free_count > RX_LOW_WATERMARK)
292− gfp_mask |= __GFP_NOWARN;
293−
294− if (trans_pcie->rx_page_order > 0)
295− gfp_mask |= __GFP_COMP;
296−
297− /* Alloc a new receive buffer */
298− page = alloc_pages(gfp_mask, trans_pcie->rx_page_order);
299− if (!page) {
300− if (net_ratelimit())
301− IWL_DEBUG_INFO(trans, "alloc_pages failed, order: %d\n",
302− trans_pcie->rx_page_order);
303− /* Issue an error if the hardware has consumed more than half
304− * of its free buffer list and we don't have enough
305− * pre-allocated buffers.
306−` */
307− if (rxq->free_count <= RX_LOW_WATERMARK &&
308− iwl_rxq_space(rxq) > (RX_QUEUE_SIZE / 2) &&
309− net_ratelimit())
310− IWL_CRIT(trans,
311− "Failed to alloc_pages with GFP_KERNEL. Only %u free buffers remaining.\n",
312− rxq->free_count);
313− return NULL;
314− }
315− return page;
316−}
317−
318257 /*
319258 * iwl_pcie_rxq_alloc_rbs - allocate a page for each used RBD
320259 *
@@ -324,12 +263,13 @@ static struct page *iwl_pcie_rx_alloc_page(struct iwl_trans *trans) · 3 unmodified lines
324263 * iwl_pcie_rxq_restock. The latter function will update the HW to use the newly
325264 * allocated buffers.
326265 */
327−static void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans)
266+static void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans, gfp_t priority)
328267 {
329268 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
330269 struct iwl_rxq *rxq = &trans_pcie->rxq;
331270 struct iwl_rx_mem_buffer *rxb;
332271 struct page *page;
272+ gfp_t gfp_mask = priority;
333273
334274 while (1) {
335275 spin_lock(&rxq->lock);
@@ -339,10 +279,32 @@ static void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans) · 3 unmodified lines
339279 }
340280 spin_unlock(&rxq->lock);
341281
282+ if (rxq->free_count > RX_LOW_WATERMARK)
283+ gfp_mask |= __GFP_NOWARN;
284+
285+ if (trans_pcie->rx_page_order > 0)
286+ gfp_mask |= __GFP_COMP;
287+
342288 /* Alloc a new receive buffer */
343− page = iwl_pcie_rx_alloc_page(trans);
344− if (!page)
289+ page = alloc_pages(gfp_mask, trans_pcie->rx_page_order);
290+ if (!page) {
291+ if (net_ratelimit())
292+ IWL_DEBUG_INFO(trans, "alloc_pages failed, "
293+ "order: %d\n",
294+ trans_pcie->rx_page_order);
295+
296+ if ((rxq->free_count <= RX_LOW_WATERMARK) &&
297+ net_ratelimit())
298+ IWL_CRIT(trans, "Failed to alloc_pages with %s."
299+ "Only %u free buffers remaining.\n",
300+ priority == GFP_ATOMIC ?
301+ "GFP_ATOMIC" : "GFP_KERNEL",
302+ rxq->free_count);
303+ /* We don't reschedule replenish work here -- we will
304+ * call the restock method and if it still needs
305+ * more buffers it will schedule replenish */
345306 return;
307+ }
346308
347309 spin_lock(&rxq->lock);
348310
@@ -393,7 +355,7 @@ static void iwl_pcie_rxq_free_rbs(struct iwl_trans *trans) · 44 unmodified lines
393355
394356 lockdep_assert_held(&rxq->lock);
395357
396− for (i = 0; i < RX_QUEUE_SIZE; i++) {
358+ for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) {
397359 if (!rxq->pool[i].page)
398360 continue;
399361 dma_unmap_page(trans->dev, rxq->pool[i].page_dma,
@@ -410,144 +372,32 @@ static void iwl_pcie_rxq_free_rbs(struct iwl_trans *trans) · 10 unmodified lines
410372 * When moving to rx_free an page is allocated for the slot.
411373 *
412374 * Also restock the Rx queue via iwl_pcie_rxq_restock.
413− * This is called only during initialization
375+ * This is called as a scheduled work item (except for during initialization)
414376 */
415−static void iwl_pcie_rx_replenish(struct iwl_trans *trans)
377+static void iwl_pcie_rx_replenish(struct iwl_trans *trans, gfp_t gfp)
416378 {
417− iwl_pcie_rxq_alloc_rbs(trans);
379+ iwl_pcie_rxq_alloc_rbs(trans, gfp);
418380
419381 iwl_pcie_rxq_restock(trans);
420382 }
421383
422−/*
423− * iwl_pcie_rx_allocator - Allocates pages in the background for RX queues
424− *
425− * Allocates for each received request 8 pages
426− * Called as a scheduled work item.
427− */
428−static void iwl_pcie_rx_allocator(struct iwl_trans *trans)
429−{
430− struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
431− struct iwl_rb_allocator *rba = &trans_pcie->rba;
432−
433− while (atomic_read(&rba->req_pending)) {
434− int i;
435− struct list_head local_empty;
436− struct list_head local_allocated;
437−
438− INIT_LIST_HEAD(&local_allocated);
439− spin_lock(&rba->lock);
440− /* swap out the entire rba->rbd_empty to a local list */
441− list_replace_init(&rba->rbd_empty, &local_empty);
442− spin_unlock(&rba->lock);
443−
444− for (i = 0; i < RX_CLAIM_REQ_ALLOC;) {
445− struct iwl_rx_mem_buffer *rxb;
446− struct page *page;
447−
448− /* List should never be empty - each reused RBD is
449− * returned to the list, and initial pool covers any
450− * possible gap between the time the page is allocated
451− * to the time the RBD is added.
452− */
453− BUG_ON(list_empty(&local_empty));
454− /* Get the first rxb from the rbd list */
455− rxb = list_first_entry(&local_empty,
456− struct iwl_rx_mem_buffer, list);
457− BUG_ON(rxb->page);
458−
459− /* Alloc a new receive buffer */
460− page = iwl_pcie_rx_alloc_page(trans);
461− if (!page)
462− continue;
463− rxb->page = page;
464−
465− /* Get physical address of the RB */
466− rxb->page_dma = dma_map_page(trans->dev, page, 0,
467− PAGE_SIZE << trans_pcie->rx_page_order,
468− DMA_FROM_DEVICE);
469− if (dma_mapping_error(trans->dev, rxb->page_dma)) {
470− rxb->page = NULL;
471− __free_pages(page, trans_pcie->rx_page_order);
472− continue;
473− }
474− /* dma address must be no more than 36 bits */
475− BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));
476− /* and also 256 byte aligned! */
477− BUG_ON(rxb->page_dma & DMA_BIT_MASK(8));
478−
479− /* move the allocated entry to the out list */
480− list_move(&rxb->list, &local_allocated);
481− i++;
482− }
483−
484− spin_lock(&rba->lock);
485− /* add the allocated rbds to the allocator allocated list */
486− list_splice_tail(&local_allocated, &rba->rbd_allocated);
487− /* add the unused rbds back to the allocator empty list */
488− list_splice_tail(&local_empty, &rba->rbd_empty);
489− spin_unlock(&rba->lock);
490−
491− atomic_dec(&rba->req_pending);
492− atomic_inc(&rba->req_ready);
493− }
494−}
495−
496−/*
497− * iwl_pcie_rx_allocator_get - Returns the pre-allocated pages
498−.*
499−.* Called by queue when the queue posted allocation request and
500− * has freed 8 RBDs in order to restock itself.
501− */
502−static int iwl_pcie_rx_allocator_get(struct iwl_trans *trans,
503− struct iwl_rx_mem_buffer
504− *out[RX_CLAIM_REQ_ALLOC])
505−{
506− struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
507− struct iwl_rb_allocator *rba = &trans_pcie->rba;
508− int i;
509−
510− if (atomic_dec_return(&rba->req_ready) < 0) {
511− atomic_inc(&rba->req_ready);
512− IWL_DEBUG_RX(trans,
513− "Allocation request not ready, pending requests = %d\n",
514− atomic_read(&rba->req_pending));
515− return -ENOMEM;
516− }
517−
518− spin_lock(&rba->lock);
519− for (i = 0; i < RX_CLAIM_REQ_ALLOC; i++) {
520− /* Get next free Rx buffer, remove it from free list */
521− out[i] = list_first_entry(&rba->rbd_allocated,
522− struct iwl_rx_mem_buffer, list);
523− list_del(&out[i]->list);
524− }
525− spin_unlock(&rba->lock);
526−
527− return 0;
528−}
529−
530−static void iwl_pcie_rx_allocator_work(struct work_struct *data)
384+static void iwl_pcie_rx_replenish_work(struct work_struct *data)
531385 {
532− struct iwl_rb_allocator *rba_p =
533− container_of(data, struct iwl_rb_allocator, rx_alloc);
534386 struct iwl_trans_pcie *trans_pcie =
535− container_of(rba_p, struct iwl_trans_pcie, rba);
387+ container_of(data, struct iwl_trans_pcie, rx_replenish);
536388
537− iwl_pcie_rx_allocator(trans_pcie->trans);
389+ iwl_pcie_rx_replenish(trans_pcie->trans, GFP_KERNEL);
538390 }
539391
540392 static int iwl_pcie_rx_alloc(struct iwl_trans *trans)
541393 {
542394 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
543395 struct iwl_rxq *rxq = &trans_pcie->rxq;
544− struct iwl_rb_allocator *rba = &trans_pcie->rba;
545396 struct device *dev = trans->dev;
546397
547398 memset(&trans_pcie->rxq, 0, sizeof(trans_pcie->rxq));
548399
549400 spin_lock_init(&rxq->lock);
550− spin_lock_init(&rba->lock);
551401
552402 if (WARN_ON(rxq->bd || rxq->rb_stts))
553403 return -EINVAL;
@@ -637,49 +487,15 @@ static void iwl_pcie_rx_init_rxb_lists(struct iwl_rxq *rxq) · 83 unmodified lines
637487 INIT_LIST_HEAD(&rxq->rx_free);
638488 INIT_LIST_HEAD(&rxq->rx_used);
639489 rxq->free_count = 0;
640− rxq->used_count = 0;
641490
642− for (i = 0; i < RX_QUEUE_SIZE; i++)
491+ for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++)
643492 list_add(&rxq->pool[i].list, &rxq->rx_used);
644493 }
645494
646−static void iwl_pcie_rx_init_rba(struct iwl_rb_allocator *rba)
647−{
648− int i;
649−
650− lockdep_assert_held(&rba->lock);
651−
652− INIT_LIST_HEAD(&rba->rbd_allocated);
653− INIT_LIST_HEAD(&rba->rbd_empty);
654−
655− for (i = 0; i < RX_POOL_SIZE; i++)
656− list_add(&rba->pool[i].list, &rba->rbd_empty);
657−}
658−
659−static void iwl_pcie_rx_free_rba(struct iwl_trans *trans)
660−{
661− struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
662− struct iwl_rb_allocator *rba = &trans_pcie->rba;
663− int i;
664−
665− lockdep_assert_held(&rba->lock);
666−
667− for (i = 0; i < RX_POOL_SIZE; i++) {
668− if (!rba->pool[i].page)
669− continue;
670− dma_unmap_page(trans->dev, rba->pool[i].page_dma,
671− PAGE_SIZE << trans_pcie->rx_page_order,
672− DMA_FROM_DEVICE);
673− __free_pages(rba->pool[i].page, trans_pcie->rx_page_order);
674− rba->pool[i].page = NULL;
675− }
676−}
677−
678495 int iwl_pcie_rx_init(struct iwl_trans *trans)
679496 {
680497 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
681498 struct iwl_rxq *rxq = &trans_pcie->rxq;
682− struct iwl_rb_allocator *rba = &trans_pcie->rba;
683499 int i, err;
684500
685501 if (!rxq->bd) {
@@ -687,21 +503,11 @@ int iwl_pcie_rx_init(struct iwl_trans *trans) · 1 unmodified line
687503 if (err)
688504 return err;
689505 }
690− if (!rba->alloc_wq)
691− rba->alloc_wq = alloc_workqueue("rb_allocator",
692− WQ_HIGHPRI | WQ_UNBOUND, 1);
693− INIT_WORK(&rba->rx_alloc, iwl_pcie_rx_allocator_work);
694−
695− spin_lock(&rba->lock);
696− atomic_set(&rba->req_pending, 0);
697− atomic_set(&rba->req_ready, 0);
698− /* free all first - we might be reconfigured for a different size */
699− iwl_pcie_rx_free_rba(trans);
700− iwl_pcie_rx_init_rba(rba);
701− spin_unlock(&rba->lock);
702506
703507 spin_lock(&rxq->lock);
704508
509+ INIT_WORK(&trans_pcie->rx_replenish, iwl_pcie_rx_replenish_work);
510+
705511 /* free all first - we might be reconfigured for a different size */
706512 iwl_pcie_rxq_free_rbs(trans);
707513 iwl_pcie_rx_init_rxb_lists(rxq);
@@ -716,7 +522,7 @@ int iwl_pcie_rx_init(struct iwl_trans *trans) · 8 unmodified lines
716522 memset(rxq->rb_stts, 0, sizeof(*rxq->rb_stts));
717523 spin_unlock(&rxq->lock);
718524
719− iwl_pcie_rx_replenish(trans);
525+ iwl_pcie_rx_replenish(trans, GFP_KERNEL);
720526
721527 iwl_pcie_rx_hw_init(trans, rxq);
722528
@@ -731,7 +537,6 @@ void iwl_pcie_rx_free(struct iwl_trans *trans) · 8 unmodified lines
731537 {
732538 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
733539 struct iwl_rxq *rxq = &trans_pcie->rxq;
734− struct iwl_rb_allocator *rba = &trans_pcie->rba;
735540
736541 /*if rxq->bd is NULL, it means that nothing has been allocated,
737542 * exit now */
@@ -740,15 +545,7 @@ void iwl_pcie_rx_free(struct iwl_trans *trans) · 2 unmodified lines
740545 return;
741546 }
742547
743− cancel_work_sync(&rba->rx_alloc);
744− if (rba->alloc_wq) {
745− destroy_workqueue(rba->alloc_wq);
746− rba->alloc_wq = NULL;
747− }
748−
749− spin_lock(&rba->lock);
750− iwl_pcie_rx_free_rba(trans);
751− spin_unlock(&rba->lock);
548+ cancel_work_sync(&trans_pcie->rx_replenish);
752549
753550 spin_lock(&rxq->lock);
754551 iwl_pcie_rxq_free_rbs(trans);
@@ -769,43 +566,6 @@ void iwl_pcie_rx_free(struct iwl_trans *trans) · 14 unmodified lines
769566 rxq->rb_stts = NULL;
770567 }
771568
772−/*
773− * iwl_pcie_rx_reuse_rbd - Recycle used RBDs
774− *
775− * Called when a RBD can be reused. The RBD is transferred to the allocator.
776− * When there are 2 empty RBDs - a request for allocation is posted
777− */
778−static void iwl_pcie_rx_reuse_rbd(struct iwl_trans *trans,
779− struct iwl_rx_mem_buffer *rxb,
780− struct iwl_rxq *rxq)
781−{
782− struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
783− struct iwl_rb_allocator *rba = &trans_pcie->rba;
784−
785− /* Count the used RBDs */
786− rxq->used_count++;
787−
788− /* Move the RBD to the used list, will be moved to allocator in batches
789− * before claiming or posting a request*/
790− list_add_tail(&rxb->list, &rxq->rx_used);
791−
792− /* If we have RX_POST_REQ_ALLOC new released rx buffers -
793− * issue a request for allocator. Modulo RX_CLAIM_REQ_ALLOC is
794− * used for the case we failed to claim RX_CLAIM_REQ_ALLOC,
795− * after but we still need to post another request.
796− */
797− if ((rxq->used_count % RX_CLAIM_REQ_ALLOC) == RX_POST_REQ_ALLOC) {
798− /* Move the 2 RBDs to the allocator ownership.
799− Allocator has another 6 from pool for the request completion*/
800− spin_lock(&rba->lock);
801− list_splice_tail_init(&rxq->rx_used, &rba->rbd_empty);
802− spin_unlock(&rba->lock);
803−
804− atomic_inc(&rba->req_pending);
805− queue_work(rba->alloc_wq, &rba->rx_alloc);
806− }
807−}
808−
809569 static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
810570 struct iwl_rx_mem_buffer *rxb)
811571 {
@@ -928,13 +688,13 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, · 116 unmodified lines
928688 */
929689 __free_pages(rxb->page, trans_pcie->rx_page_order);
930690 rxb->page = NULL;
931− iwl_pcie_rx_reuse_rbd(trans, rxb, rxq);
691+ list_add_tail(&rxb->list, &rxq->rx_used);
932692 } else {
933693 list_add_tail(&rxb->list, &rxq->rx_free);
934694 rxq->free_count++;
935695 }
936696 } else
937− iwl_pcie_rx_reuse_rbd(trans, rxb, rxq);
697+ list_add_tail(&rxb->list, &rxq->rx_used);
938698 }
939699
940700 /*
@@ -944,7 +704,10 @@ static void iwl_pcie_rx_handle(struct iwl_trans *trans) · 3 unmodified lines
944704 {
945705 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
946706 struct iwl_rxq *rxq = &trans_pcie->rxq;
947− u32 r, i, j;
707+ u32 r, i;
708+ u8 fill_rx = 0;
709+ u32 count = 8;
710+ int total_empty;
948711
949712 restart:
950713 spin_lock(&rxq->lock);
@@ -957,6 +720,14 @@ restart: · 6 unmodified lines
957720 if (i == r)
958721 IWL_DEBUG_RX(trans, "HW = SW = %d\n", r);
959722
723+ /* calculate total frames need to be restock after handling RX */
724+ total_empty = r - rxq->write_actual;
725+ if (total_empty < 0)
726+ total_empty += RX_QUEUE_SIZE;
727+
728+ if (total_empty > (RX_QUEUE_SIZE / 2))
729+ fill_rx = 1;
730+
960731 while (i != r) {
961732 struct iwl_rx_mem_buffer *rxb;
962733
@@ -968,48 +739,29 @@ restart: · 5 unmodified lines
968739 iwl_pcie_rx_handle_rb(trans, rxb);
969740
970741 i = (i + 1) & RX_QUEUE_MASK;
971−
972− /* If we have RX_CLAIM_REQ_ALLOC released rx buffers -
973− * try to claim the pre-allocated buffers from the allocator */
974− if (rxq->used_count >= RX_CLAIM_REQ_ALLOC) {
975− struct iwl_rb_allocator *rba = &trans_pcie->rba;
976− struct iwl_rx_mem_buffer *out[RX_CLAIM_REQ_ALLOC];
977−
978− /* Add the remaining 6 empty RBDs for allocator use */
979− spin_lock(&rba->lock);
980− list_splice_tail_init(&rxq->rx_used, &rba->rbd_empty);
981− spin_unlock(&rba->lock);
982−
983− /* If not ready - continue, will try to reclaim later.
984− * No need to reschedule work - allocator exits only on
985− * success */
986− if (!iwl_pcie_rx_allocator_get(trans, out)) {
987− /* If success - then RX_CLAIM_REQ_ALLOC
988− * buffers were retrieved and should be added
989− * to free list */
990− rxq->used_count -= RX_CLAIM_REQ_ALLOC;
991− for (j = 0; j < RX_CLAIM_REQ_ALLOC; j++) {
992− list_add_tail(&out[j]->list,
993− &rxq->rx_free);
994− rxq->free_count++;
995− }
742+ /* If there are a lot of unused frames,
743+ * restock the Rx queue so ucode wont assert. */
744+ if (fill_rx) {
745+ count++;
746+ if (count >= 8) {
747+ rxq->read = i;
748+ spin_unlock(&rxq->lock);
749+ iwl_pcie_rx_replenish(trans, GFP_ATOMIC);
750+ count = 0;
751+ goto restart;
996752 }
997753 }
998− /* handle restock for two cases:
999− * - we just pulled buffers from the allocator
1000− * - we have 8+ unstolen pages accumulated */
1001− if (rxq->free_count >= RX_CLAIM_REQ_ALLOC) {
1002− rxq->read = i;
1003− spin_unlock(&rxq->lock);
1004− iwl_pcie_rxq_restock(trans);
1005− goto restart;
1006− }
1007754 }
1008755
1009756 /* Backtrack one entry */
1010757 rxq->read = i;
1011758 spin_unlock(&rxq->lock);
1012759
760+ if (fill_rx)
761+ iwl_pcie_rx_replenish(trans, GFP_ATOMIC);
762+ else
763+ iwl_pcie_rxq_restock(trans);
764+
1013765 if (trans_pcie->napi.poll)
1014766 napi_gro_flush(&trans_pcie->napi, false);
1015767 }
drivers/net/wireless/iwlwifi/pcie/trans.c+29−23
@@ -182,7 +182,7 @@ static void iwl_trans_pcie_write_shr(struct iwl_trans *trans, u32 reg, u32 val) · 181 unmodified lines
182182
183183 static void iwl_pcie_set_pwr(struct iwl_trans *trans, bool vaux)
184184 {
185− if (!trans->cfg->apmg_not_supported)
185+ if (trans->cfg->apmg_not_supported)
186186 return;
187187
188188 if (vaux && pci_pme_capable(to_pci_dev(trans->dev), PCI_D3cold))
@@ -2459,7 +2459,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 2270 unmodified lines
24592459 struct iwl_trans_pcie *trans_pcie;
24602460 struct iwl_trans *trans;
24612461 u16 pci_cmd;
2462− int err;
2462+ int ret;
24632463
24642464 trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie),
24652465 &pdev->dev, cfg, &trans_ops_pcie, 0);
@@ -2474,8 +2474,8 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 8 unmodified lines
24742474 spin_lock_init(&trans_pcie->ref_lock);
24752475 init_waitqueue_head(&trans_pcie->ucode_write_waitq);
24762476
2477− err = pci_enable_device(pdev);
2478− if (err)
2477+ ret = pci_enable_device(pdev);
2478+ if (ret)
24792479 goto out_no_pci;
24802480
24812481 if (!cfg->base_params->pcie_l1_allowed) {
@@ -2491,23 +2491,23 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 9 unmodified lines
24912491
24922492 pci_set_master(pdev);
24932493
2494− err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36));
2495− if (!err)
2496− err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36));
2497− if (err) {
2498− err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
2499− if (!err)
2500− err = pci_set_consistent_dma_mask(pdev,
2494+ ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(36));
2495+ if (!ret)
2496+ ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36));
2497+ if (ret) {
2498+ ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
2499+ if (!ret)
2500+ ret = pci_set_consistent_dma_mask(pdev,
25012501 DMA_BIT_MASK(32));
25022502 /* both attempts failed: */
2503− if (err) {
2503+ if (ret) {
25042504 dev_err(&pdev->dev, "No suitable DMA available\n");
25052505 goto out_pci_disable_device;
25062506 }
25072507 }
25082508
2509− err = pci_request_regions(pdev, DRV_NAME);
2510− if (err) {
2509+ ret = pci_request_regions(pdev, DRV_NAME);
2510+ if (ret) {
25112511 dev_err(&pdev->dev, "pci_request_regions failed\n");
25122512 goto out_pci_disable_device;
25132513 }
@@ -2515,7 +2515,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 1 unmodified line
25152515 trans_pcie->hw_base = pci_ioremap_bar(pdev, 0);
25162516 if (!trans_pcie->hw_base) {
25172517 dev_err(&pdev->dev, "pci_ioremap_bar failed\n");
2518− err = -ENODEV;
2518+ ret = -ENODEV;
25192519 goto out_pci_release_regions;
25202520 }
25212521
@@ -2527,9 +2527,9 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 5 unmodified lines
25272527 trans_pcie->pci_dev = pdev;
25282528 iwl_disable_interrupts(trans);
25292529
2530− err = pci_enable_msi(pdev);
2531− if (err) {
2532− dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", err);
2530+ ret = pci_enable_msi(pdev);
2531+ if (ret) {
2532+ dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", ret);
25332533 /* enable rfkill interrupt: hw bug w/a */
25342534 pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd);
25352535 if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
@@ -2547,11 +2547,16 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 11 unmodified lines
25472547 */
25482548 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
25492549 unsigned long flags;
2550− int ret;
25512550
25522551 trans->hw_rev = (trans->hw_rev & 0xfff0) |
25532552 (CSR_HW_REV_STEP(trans->hw_rev << 2) << 2);
25542553
2554+ ret = iwl_pcie_prepare_card_hw(trans);
2555+ if (ret) {
2556+ IWL_WARN(trans, "Exit HW not ready\n");
2557+ goto out_pci_disable_msi;
2558+ }
2559+
25552560 /*
25562561 * in-order to recognize C step driver should read chip version
25572562 * id located at the AUX bus MISC address space.
@@ -2591,13 +2596,14 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 33 unmodified lines
25912596 /* Initialize the wait queue for commands */
25922597 init_waitqueue_head(&trans_pcie->wait_command_queue);
25932598
2594− if (iwl_pcie_alloc_ict(trans))
2599+ ret = iwl_pcie_alloc_ict(trans);
2600+ if (ret)
25952601 goto out_pci_disable_msi;
25962602
2597− err = request_threaded_irq(pdev->irq, iwl_pcie_isr,
2603+ ret = request_threaded_irq(pdev->irq, iwl_pcie_isr,
25982604 iwl_pcie_irq_handler,
25992605 IRQF_SHARED, DRV_NAME, trans);
2600− if (err) {
2606+ if (ret) {
26012607 IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq);
26022608 goto out_free_ict;
26032609 }
@@ -2617,5 +2623,5 @@ out_pci_disable_device: · 13 unmodified lines
26172623 pci_disable_device(pdev);
26182624 out_no_pci:
26192625 iwl_trans_free(trans);
2620− return ERR_PTR(err);
2626+ return ERR_PTR(ret);
26212627 }
drivers/net/xen-netback/netback.c+3−3
@@ -1566,13 +1566,13 @@ static inline void xenvif_tx_dealloc_action(struct xenvif_queue *queue) · 1565 unmodified lines
15661566 smp_rmb();
15671567
15681568 while (dc != dp) {
1569− BUG_ON(gop - queue->tx_unmap_ops > MAX_PENDING_REQS);
1569+ BUG_ON(gop - queue->tx_unmap_ops >= MAX_PENDING_REQS);
15701570 pending_idx =
15711571 queue->dealloc_ring[pending_index(dc++)];
15721572
1573− pending_idx_release[gop-queue->tx_unmap_ops] =
1573+ pending_idx_release[gop - queue->tx_unmap_ops] =
15741574 pending_idx;
1575− queue->pages_to_unmap[gop-queue->tx_unmap_ops] =
1575+ queue->pages_to_unmap[gop - queue->tx_unmap_ops] =
15761576 queue->mmap_pages[pending_idx];
15771577 gnttab_set_unmap_op(gop,
15781578 idx_to_kaddr(queue, pending_idx),
include/net/cfg80211.h+17−0
@@ -4868,6 +4868,23 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy, · 4867 unmodified lines
48684868 struct cfg80211_chan_def *chandef,
48694869 enum nl80211_iftype iftype);
48704870
4871+/**
4872+ * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
4873+ * @wiphy: the wiphy
4874+ * @chandef: the channel definition
4875+ * @iftype: interface type
4876+ *
4877+ * Return: %true if there is no secondary channel or the secondary channel(s)
4878+ * can be used for beaconing (i.e. is not a radar channel etc.). This version
4879+ * also checks if IR-relaxation conditions apply, to allow beaconing under
4880+ * more permissive conditions.
4881+ *
4882+ * Requires the RTNL to be held.
4883+ */
4884+bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
4885+ struct cfg80211_chan_def *chandef,
4886+ enum nl80211_iftype iftype);
4887+
48714888 /*
48724889 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
48734890 * @dev: the device which switched channels
include/net/ip.h+1−0
@@ -161,6 +161,7 @@ static inline __u8 get_rtconn_flags(struct ipcm_cookie* ipc, struct sock* sk) · 160 unmodified lines
161161 }
162162
163163 /* datagram.c */
164+int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
164165 int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
165166
166167 void ip4_datagram_release_cb(struct sock *sk);
net/ax25/ax25_subr.c+1−0
@@ -264,6 +264,7 @@ void ax25_disconnect(ax25_cb *ax25, int reason) · 263 unmodified lines
264264 {
265265 ax25_clear_queues(ax25);
266266
267+ ax25_stop_heartbeat(ax25);
267268 ax25_stop_t1timer(ax25);
268269 ax25_stop_t2timer(ax25);
269270 ax25_stop_t3timer(ax25);
net/bridge/br_mdb.c+0−1
@@ -351,7 +351,6 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, · 350 unmodified lines
351351 if (state == MDB_TEMPORARY)
352352 mod_timer(&p->timer, now + br->multicast_membership_interval);
353353
354− br_mdb_notify(br->dev, port, group, RTM_NEWMDB);
355354 return 0;
356355 }
357356
net/bridge/br_multicast.c+30−7
@@ -39,6 +39,16 @@ static void br_multicast_start_querier(struct net_bridge *br, · 38 unmodified lines
3939 struct bridge_mcast_own_query *query);
4040 static void br_multicast_add_router(struct net_bridge *br,
4141 struct net_bridge_port *port);
42+static void br_ip4_multicast_leave_group(struct net_bridge *br,
43+ struct net_bridge_port *port,
44+ __be32 group,
45+ __u16 vid);
46+#if IS_ENABLED(CONFIG_IPV6)
47+static void br_ip6_multicast_leave_group(struct net_bridge *br,
48+ struct net_bridge_port *port,
49+ const struct in6_addr *group,
50+ __u16 vid);
51+#endif
4252 unsigned int br_mdb_rehash_seq;
4353
4454 static inline int br_ip_equal(const struct br_ip *a, const struct br_ip *b)
@@ -1010,9 +1020,15 @@ static int br_ip4_multicast_igmp3_report(struct net_bridge *br, · 965 unmodified lines
10101020 continue;
10111021 }
10121022
1013− err = br_ip4_multicast_add_group(br, port, group, vid);
1014− if (err)
1015− break;
1023+ if ((type == IGMPV3_CHANGE_TO_INCLUDE ||
1024+ type == IGMPV3_MODE_IS_INCLUDE) &&
1025+ ntohs(grec->grec_nsrcs) == 0) {
1026+ br_ip4_multicast_leave_group(br, port, group, vid);
1027+ } else {
1028+ err = br_ip4_multicast_add_group(br, port, group, vid);
1029+ if (err)
1030+ break;
1031+ }
10161032 }
10171033
10181034 return err;
@@ -1071,10 +1087,17 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, · 52 unmodified lines
10711087 continue;
10721088 }
10731089
1074− err = br_ip6_multicast_add_group(br, port, &grec->grec_mca,
1075− vid);
1076− if (err)
1077− break;
1090+ if ((grec->grec_type == MLD2_CHANGE_TO_INCLUDE ||
1091+ grec->grec_type == MLD2_MODE_IS_INCLUDE) &&
1092+ ntohs(*nsrcs) == 0) {
1093+ br_ip6_multicast_leave_group(br, port, &grec->grec_mca,
1094+ vid);
1095+ } else {
1096+ err = br_ip6_multicast_add_group(br, port,
1097+ &grec->grec_mca, vid);
1098+ if (!err)
1099+ break;
1100+ }
10781101 }
10791102
10801103 return err;
net/caif/caif_socket.c+8−11
@@ -121,12 +121,13 @@ static void caif_flow_ctrl(struct sock *sk, int mode) · 120 unmodified lines
121121 * Copied from sock.c:sock_queue_rcv_skb(), but changed so packets are
122122 * not dropped, but CAIF is sending flow off instead.
123123 */
124−static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
124+static void caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
125125 {
126126 int err;
127127 unsigned long flags;
128128 struct sk_buff_head *list = &sk->sk_receive_queue;
129129 struct caifsock *cf_sk = container_of(sk, struct caifsock, sk);
130+ bool queued = false;
130131
131132 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
132133 (unsigned int)sk->sk_rcvbuf && rx_flow_is_on(cf_sk)) {
@@ -139,7 +140,8 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) · 6 unmodified lines
139140
140141 err = sk_filter(sk, skb);
141142 if (err)
142− return err;
143+ goto out;
144+
143145 if (!sk_rmem_schedule(sk, skb, skb->truesize) && rx_flow_is_on(cf_sk)) {
144146 set_rx_flow_off(cf_sk);
145147 net_dbg_ratelimited("sending flow OFF due to rmem_schedule\n");
@@ -147,21 +149,16 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) · 1 unmodified line
147149 }
148150 skb->dev = NULL;
149151 skb_set_owner_r(skb, sk);
150− /* Cache the SKB length before we tack it onto the receive
151− * queue. Once it is added it no longer belongs to us and
152− * may be freed by other threads of control pulling packets
153− * from the queue.
154− */
155152 spin_lock_irqsave(&list->lock, flags);
156− if (!sock_flag(sk, SOCK_DEAD))
153+ queued = !sock_flag(sk, SOCK_DEAD);
154+ if (queued)
157155 __skb_queue_tail(list, skb);
158156 spin_unlock_irqrestore(&list->lock, flags);
159−
160− if (!sock_flag(sk, SOCK_DEAD))
157+out:
158+ if (queued)
161159 sk->sk_data_ready(sk);
162160 else
163161 kfree_skb(skb);
164− return 0;
165162 }
166163
167164 /* Packet Receive Callback function called from CAIF Stack */
net/core/datagram.c+47−9
@@ -131,6 +131,35 @@ out_noerr: · 130 unmodified lines
131131 goto out;
132132 }
133133
134+static int skb_set_peeked(struct sk_buff *skb)
135+{
136+ struct sk_buff *nskb;
137+
138+ if (skb->peeked)
139+ return 0;
140+
141+ /* We have to unshare an skb before modifying it. */
142+ if (!skb_shared(skb))
143+ goto done;
144+
145+ nskb = skb_clone(skb, GFP_ATOMIC);
146+ if (!nskb)
147+ return -ENOMEM;
148+
149+ skb->prev->next = nskb;
150+ skb->next->prev = nskb;
151+ nskb->prev = skb->prev;
152+ nskb->next = skb->next;
153+
154+ consume_skb(skb);
155+ skb = nskb;
156+
157+done:
158+ skb->peeked = 1;
159+
160+ return 0;
161+}
162+
134163 /**
135164 * __skb_recv_datagram - Receive a datagram skbuff
136165 * @sk: socket
@@ -165,7 +194,9 @@ out_noerr: · 28 unmodified lines
165194 struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags,
166195 int *peeked, int *off, int *err)
167196 {
197+ struct sk_buff_head *queue = &sk->sk_receive_queue;
168198 struct sk_buff *skb, *last;
199+ unsigned long cpu_flags;
169200 long timeo;
170201 /*
171202 * Caller is allowed not to check sk->sk_err before skb_recv_datagram()
@@ -184,8 +215,6 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, · 12 unmodified lines
184215 * Look at current nfs client by the way...
185216 * However, this function was correct in any case. 8)
186217 */
187− unsigned long cpu_flags;
188− struct sk_buff_head *queue = &sk->sk_receive_queue;
189218 int _off = *off;
190219
191220 last = (struct sk_buff *)queue;
@@ -199,7 +228,11 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, · 7 unmodified lines
199228 _off -= skb->len;
200229 continue;
201230 }
202− skb->peeked = 1;
231+
232+ error = skb_set_peeked(skb);
233+ if (error)
234+ goto unlock_err;
235+
203236 atomic_inc(&skb->users);
204237 } else
205238 __skb_unlink(skb, queue);
@@ -223,6 +256,8 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, · 17 unmodified lines
223256
224257 return NULL;
225258
259+unlock_err:
260+ spin_unlock_irqrestore(&queue->lock, cpu_flags);
226261 no_packet:
227262 *err = error;
228263 return NULL;
@@ -622,7 +657,8 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len) · 393 unmodified lines
622657 !skb->csum_complete_sw)
623658 netdev_rx_csum_fault(skb->dev);
624659 }
625− skb->csum_valid = !sum;
660+ if (!skb_shared(skb))
661+ skb->csum_valid = !sum;
626662 return sum;
627663 }
628664 EXPORT_SYMBOL(__skb_checksum_complete_head);
@@ -642,11 +678,13 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb) · 13 unmodified lines
642678 netdev_rx_csum_fault(skb->dev);
643679 }
644680
645− /* Save full packet checksum */
646− skb->csum = csum;
647− skb->ip_summed = CHECKSUM_COMPLETE;
648− skb->csum_complete_sw = 1;
649− skb->csum_valid = !sum;
681+ if (!skb_shared(skb)) {
682+ /* Save full packet checksum */
683+ skb->csum = csum;
684+ skb->ip_summed = CHECKSUM_COMPLETE;
685+ skb->csum_complete_sw = 1;
686+ skb->csum_valid = !sum;
687+ }
650688
651689 return sum;
652690 }
net/core/dst.c+3−1
@@ -284,7 +284,9 @@ void dst_release(struct dst_entry *dst) · 283 unmodified lines
284284 int newrefcnt;
285285
286286 newrefcnt = atomic_dec_return(&dst->__refcnt);
287− WARN_ON(newrefcnt < 0);
287+ if (unlikely(newrefcnt < 0))
288+ net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
289+ __func__, dst, newrefcnt);
288290 if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
289291 call_rcu(&dst->rcu_head, dst_destroy_rcu);
290292 }
net/core/rtnetlink.c+7−4
@@ -1804,10 +1804,13 @@ static int do_setlink(const struct sk_buff *skb, · 1803 unmodified lines
18041804 goto errout;
18051805
18061806 nla_for_each_nested(attr, tb[IFLA_VF_PORTS], rem) {
1807− if (nla_type(attr) != IFLA_VF_PORT)
1808− continue;
1809− err = nla_parse_nested(port, IFLA_PORT_MAX,
1810− attr, ifla_port_policy);
1807+ if (nla_type(attr) != IFLA_VF_PORT ||
1808+ nla_len(attr) < NLA_HDRLEN) {
1809+ err = -EINVAL;
1810+ goto errout;
1811+ }
1812+ err = nla_parse_nested(port, IFLA_PORT_MAX, attr,
1813+ ifla_port_policy);
18111814 if (err < 0)
18121815 goto errout;
18131816 if (!port[IFLA_PORT_VF]) {
net/ipv4/datagram.c+12−4
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 #include <net/route.h>
2121 #include <net/tcp_states.h>
2222
23−int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
23+int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
2424 {
2525 struct inet_sock *inet = inet_sk(sk);
2626 struct sockaddr_in *usin = (struct sockaddr_in *) uaddr;
@@ -39,8 +39,6 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 12 unmodified lines
3939
4040 sk_dst_reset(sk);
4141
42− lock_sock(sk);
43−
4442 oif = sk->sk_bound_dev_if;
4543 saddr = inet->inet_saddr;
4644 if (ipv4_is_multicast(usin->sin_addr.s_addr)) {
@@ -82,9 +80,19 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 35 unmodified lines
8280 sk_dst_set(sk, &rt->dst);
8381 err = 0;
8482 out:
85− release_sock(sk);
8683 return err;
8784 }
85+EXPORT_SYMBOL(__ip4_datagram_connect);
86+
87+int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
88+{
89+ int res;
90+
91+ lock_sock(sk);
92+ res = __ip4_datagram_connect(sk, uaddr, addr_len);
93+ release_sock(sk);
94+ return res;
95+}
8896 EXPORT_SYMBOL(ip4_datagram_connect);
8997
9098 /* Because UDP xmit path can manipulate sk_dst_cache without holding
net/ipv4/inet_hashtables.c+5−6
@@ -624,22 +624,21 @@ EXPORT_SYMBOL_GPL(inet_hashinfo_init); · 623 unmodified lines
624624
625625 int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
626626 {
627+ unsigned int locksz = sizeof(spinlock_t);
627628 unsigned int i, nblocks = 1;
628629
629− if (sizeof(spinlock_t) != 0) {
630+ if (locksz != 0) {
630631 /* allocate 2 cache lines or at least one spinlock per cpu */
631− nblocks = max_t(unsigned int,
632− 2 * L1_CACHE_BYTES / sizeof(spinlock_t),
633− 1);
632+ nblocks = max(2U * L1_CACHE_BYTES / locksz, 1U);
634633 nblocks = roundup_pow_of_two(nblocks * num_possible_cpus());
635634
636635 /* no more locks than number of hash buckets */
637636 nblocks = min(nblocks, hashinfo->ehash_mask + 1);
638637
639− hashinfo->ehash_locks = kmalloc_array(nblocks, sizeof(spinlock_t),
638+ hashinfo->ehash_locks = kmalloc_array(nblocks, locksz,
640639 GFP_KERNEL | __GFP_NOWARN);
641640 if (!hashinfo->ehash_locks)
642− hashinfo->ehash_locks = vmalloc(nblocks * sizeof(spinlock_t));
641+ hashinfo->ehash_locks = vmalloc(nblocks * locksz);
643642
644643 if (!hashinfo->ehash_locks)
645644 return -ENOMEM;
net/ipv4/ip_fragment.c+4−2
@@ -351,7 +351,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb) · 350 unmodified lines
351351 ihl = ip_hdrlen(skb);
352352
353353 /* Determine the position of this fragment. */
354− end = offset + skb->len - ihl;
354+ end = offset + skb->len - skb_network_offset(skb) - ihl;
355355 err = -EINVAL;
356356
357357 /* Is this the final fragment? */
@@ -381,7 +381,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb) · 23 unmodified lines
381381 goto err;
382382
383383 err = -ENOMEM;
384− if (!pskb_pull(skb, ihl))
384+ if (!pskb_pull(skb, skb_network_offset(skb) + ihl))
385385 goto err;
386386
387387 err = pskb_trim_rcsum(skb, end - offset);
@@ -641,6 +641,8 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, · 253 unmodified lines
641641 iph->frag_off = 0;
642642 }
643643
644+ ip_send_check(iph);
645+
644646 IP_INC_STATS_BH(net, IPSTATS_MIB_REASMOKS);
645647 qp->q.fragments = NULL;
646648 qp->q.fragments_tail = NULL;
net/ipv4/tcp_input.c+1−2
@@ -1917,14 +1917,13 @@ void tcp_enter_loss(struct sock *sk) · 1916 unmodified lines
19171917 const struct inet_connection_sock *icsk = inet_csk(sk);
19181918 struct tcp_sock *tp = tcp_sk(sk);
19191919 struct sk_buff *skb;
1920− bool new_recovery = false;
1920+ bool new_recovery = icsk->icsk_ca_state < TCP_CA_Recovery;
19211921 bool is_reneg; /* is receiver reneging on SACKs? */
19221922
19231923 /* Reduce ssthresh if it has not yet been made inside this window. */
19241924 if (icsk->icsk_ca_state <= TCP_CA_Disorder ||
19251925 !after(tp->high_seq, tp->snd_una) ||
19261926 (icsk->icsk_ca_state == TCP_CA_Loss && !icsk->icsk_retransmits)) {
1927− new_recovery = true;
19281927 tp->prior_ssthresh = tcp_current_ssthresh(sk);
19291928 tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk);
19301929 tcp_ca_event(sk, CA_EVENT_LOSS);
net/ipv6/datagram.c+15−5
@@ -40,7 +40,7 @@ static bool ipv6_mapped_addr_any(const struct in6_addr *a) · 39 unmodified lines
4040 return ipv6_addr_v4mapped(a) && (a->s6_addr32[3] == 0);
4141 }
4242
43−int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
43+static int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
4444 {
4545 struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;
4646 struct inet_sock *inet = inet_sk(sk);
@@ -56,7 +56,7 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 9 unmodified lines
5656 if (usin->sin6_family == AF_INET) {
5757 if (__ipv6_only_sock(sk))
5858 return -EAFNOSUPPORT;
59− err = ip4_datagram_connect(sk, uaddr, addr_len);
59+ err = __ip4_datagram_connect(sk, uaddr, addr_len);
6060 goto ipv4_connected;
6161 }
6262
@@ -98,9 +98,9 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 35 unmodified lines
9898 sin.sin_addr.s_addr = daddr->s6_addr32[3];
9999 sin.sin_port = usin->sin6_port;
100100
101− err = ip4_datagram_connect(sk,
102− (struct sockaddr *) &sin,
103− sizeof(sin));
101+ err = __ip4_datagram_connect(sk,
102+ (struct sockaddr *) &sin,
103+ sizeof(sin));
104104
105105 ipv4_connected:
106106 if (err)
@@ -204,6 +204,16 @@ out: · 97 unmodified lines
204204 fl6_sock_release(flowlabel);
205205 return err;
206206 }
207+
208+int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
209+{
210+ int res;
211+
212+ lock_sock(sk);
213+ res = __ip6_datagram_connect(sk, uaddr, addr_len);
214+ release_sock(sk);
215+ return res;
216+}
207217 EXPORT_SYMBOL_GPL(ip6_datagram_connect);
208218
209219 int ip6_datagram_connect_v6_only(struct sock *sk, struct sockaddr *uaddr,
net/ipv6/ip6_offload.c+0−2
@@ -292,8 +292,6 @@ static struct packet_offload ipv6_packet_offload __read_mostly = { · 291 unmodified lines
292292 static const struct net_offload sit_offload = {
293293 .callbacks = {
294294 .gso_segment = ipv6_gso_segment,
295− .gro_receive = ipv6_gro_receive,
296− .gro_complete = ipv6_gro_complete,
297295 },
298296 };
299297
net/mac80211/debugfs_netdev.c+1−0
@@ -723,6 +723,7 @@ void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) · 722 unmodified lines
723723
724724 debugfs_remove_recursive(sdata->vif.debugfs_dir);
725725 sdata->vif.debugfs_dir = NULL;
726+ sdata->debugfs.subdir_stations = NULL;
726727 }
727728
728729 void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)
net/mac80211/iface.c+14−11
@@ -1863,10 +1863,6 @@ void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata) · 1862 unmodified lines
18631863 ieee80211_teardown_sdata(sdata);
18641864 }
18651865
1866−/*
1867− * Remove all interfaces, may only be called at hardware unregistration
1868− * time because it doesn't do RCU-safe list removals.
1869− */
18701866 void ieee80211_remove_interfaces(struct ieee80211_local *local)
18711867 {
18721868 struct ieee80211_sub_if_data *sdata, *tmp;
@@ -1875,14 +1871,21 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) · 2 unmodified lines
18751871
18761872 ASSERT_RTNL();
18771873
1878− /*
1879− * Close all AP_VLAN interfaces first, as otherwise they
1880− * might be closed while the AP interface they belong to
1881− * is closed, causing unregister_netdevice_many() to crash.
1874+ /* Before destroying the interfaces, make sure they're all stopped so
1875+ * that the hardware is stopped. Otherwise, the driver might still be
1876+ * iterating the interfaces during the shutdown, e.g. from a worker
1877+ * or from RX processing or similar, and if it does so (using atomic
1878+ * iteration) while we're manipulating the list, the iteration will
1879+ * crash.
1880+ *
1881+ * After this, the hardware should be stopped and the driver should
1882+ * have stopped all of its activities, so that we can do RCU-unaware
1883+ * manipulations of the interface list below.
18821884 */
1883− list_for_each_entry(sdata, &local->interfaces, list)
1884− if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
1885− dev_close(sdata->dev);
1885+ cfg80211_shutdown_all_interfaces(local->hw.wiphy);
1886+
1887+ WARN(local->open_count, "%s: open count remains %d\n",
1888+ wiphy_name(local->hw.wiphy), local->open_count);
18861889
18871890 mutex_lock(&local->iflist_mtx);
18881891 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
net/mac80211/mesh_plink.c+4−1
@@ -306,7 +306,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, · 305 unmodified lines
306306 if (action == WLAN_SP_MESH_PEERING_CONFIRM) {
307307 /* AID */
308308 pos = skb_put(skb, 2);
309− put_unaligned_le16(plid, pos + 2);
309+ put_unaligned_le16(plid, pos);
310310 }
311311 if (ieee80211_add_srates_ie(sdata, skb, true, band) ||
312312 ieee80211_add_ext_srates_ie(sdata, skb, true, band) ||
@@ -1122,6 +1122,9 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, · 809 unmodified lines
11221122 WLAN_SP_MESH_PEERING_CONFIRM) {
11231123 baseaddr += 4;
11241124 baselen += 4;
1125+
1126+ if (baselen > len)
1127+ return;
11251128 }
11261129 ieee802_11_parse_elems(baseaddr, len - baselen, true, &elems);
11271130 mesh_process_plink_frame(sdata, mgmt, &elems);
net/mac80211/pm.c+16−0
@@ -76,6 +76,22 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) · 75 unmodified lines
7676 if (sdata->vif.type != NL80211_IFTYPE_STATION)
7777 continue;
7878 ieee80211_mgd_quiesce(sdata);
79+ /* If suspended during TX in progress, and wowlan
80+ * is enabled (connection will be active) there
81+ * can be a race where the driver is put out
82+ * of power-save due to TX and during suspend
83+ * dynamic_ps_timer is cancelled and TX packet
84+ * is flushed, leaving the driver in ACTIVE even
85+ * after resuming until dynamic_ps_timer puts
86+ * driver back in DOZE.
87+ */
88+ if (sdata->u.mgd.associated &&
89+ sdata->u.mgd.powersave &&
90+ !(local->hw.conf.flags & IEEE80211_CONF_PS)) {
91+ local->hw.conf.flags |= IEEE80211_CONF_PS;
92+ ieee80211_hw_config(local,
93+ IEEE80211_CONF_CHANGE_PS);
94+ }
7995 }
8096
8197 err = drv_suspend(local, wowlan);
net/mac80211/tdls.c+3−3
@@ -60,6 +60,7 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata, · 59 unmodified lines
6060 struct ieee80211_channel *ch;
6161 struct cfg80211_chan_def chandef;
6262 int i, subband_start;
63+ struct wiphy *wiphy = sdata->local->hw.wiphy;
6364
6465 for (i = start; i <= end; i += spacing) {
6566 if (!ch_cnt)
@@ -70,9 +71,8 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata, · 4 unmodified lines
7071 /* we will be active on the channel */
7172 cfg80211_chandef_create(&chandef, ch,
7273 NL80211_CHAN_NO_HT);
73− if (cfg80211_reg_can_beacon(sdata->local->hw.wiphy,
74− &chandef,
75− sdata->wdev.iftype)) {
74+ if (cfg80211_reg_can_beacon_relax(wiphy, &chandef,
75+ sdata->wdev.iftype)) {
7676 ch_cnt++;
7777 /*
7878 * check if the next channel is also part of
net/mac80211/tx.c+3−1
@@ -1117,7 +1117,9 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, · 1116 unmodified lines
11171117 queued = true;
11181118 info->control.vif = &tx->sdata->vif;
11191119 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
1120− info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS;
1120+ info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS |
1121+ IEEE80211_TX_CTL_NO_PS_BUFFER |
1122+ IEEE80211_TX_STATUS_EOSP;
11211123 __skb_queue_tail(&tid_tx->pending, skb);
11221124 if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER)
11231125 purge_skb = __skb_dequeue(&tid_tx->pending);
net/netlink/af_netlink.c+47−32
@@ -357,25 +357,52 @@ err1: · 356 unmodified lines
357357 return NULL;
358358 }
359359
360+
361+static void
362+__netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, bool tx_ring, void **pg_vec,
363+ unsigned int order)
364+{
365+ struct netlink_sock *nlk = nlk_sk(sk);
366+ struct sk_buff_head *queue;
367+ struct netlink_ring *ring;
368+
369+ queue = tx_ring ? &sk->sk_write_queue : &sk->sk_receive_queue;
370+ ring = tx_ring ? &nlk->tx_ring : &nlk->rx_ring;
371+
372+ spin_lock_bh(&queue->lock);
373+
374+ ring->frame_max = req->nm_frame_nr - 1;
375+ ring->head = 0;
376+ ring->frame_size = req->nm_frame_size;
377+ ring->pg_vec_pages = req->nm_block_size / PAGE_SIZE;
378+
379+ swap(ring->pg_vec_len, req->nm_block_nr);
380+ swap(ring->pg_vec_order, order);
381+ swap(ring->pg_vec, pg_vec);
382+
383+ __skb_queue_purge(queue);
384+ spin_unlock_bh(&queue->lock);
385+
386+ WARN_ON(atomic_read(&nlk->mapped));
387+
388+ if (pg_vec)
389+ free_pg_vec(pg_vec, order, req->nm_block_nr);
390+}
391+
360392 static int netlink_set_ring(struct sock *sk, struct nl_mmap_req *req,
361− bool closing, bool tx_ring)
393+ bool tx_ring)
362394 {
363395 struct netlink_sock *nlk = nlk_sk(sk);
364396 struct netlink_ring *ring;
365− struct sk_buff_head *queue;
366397 void **pg_vec = NULL;
367398 unsigned int order = 0;
368− int err;
369399
370400 ring = tx_ring ? &nlk->tx_ring : &nlk->rx_ring;
371− queue = tx_ring ? &sk->sk_write_queue : &sk->sk_receive_queue;
372401
373− if (!closing) {
374− if (atomic_read(&nlk->mapped))
375− return -EBUSY;
376− if (atomic_read(&ring->pending))
377− return -EBUSY;
378− }
402+ if (atomic_read(&nlk->mapped))
403+ return -EBUSY;
404+ if (atomic_read(&ring->pending))
405+ return -EBUSY;
379406
380407 if (req->nm_block_nr) {
381408 if (ring->pg_vec != NULL)
@@ -407,31 +434,19 @@ static int netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, · 25 unmodified lines
407434 return -EINVAL;
408435 }
409436
410− err = -EBUSY;
411437 mutex_lock(&nlk->pg_vec_lock);
412− if (closing || atomic_read(&nlk->mapped) == 0) {
413− err = 0;
414− spin_lock_bh(&queue->lock);
415−
416− ring->frame_max = req->nm_frame_nr - 1;
417− ring->head = 0;
418− ring->frame_size = req->nm_frame_size;
419− ring->pg_vec_pages = req->nm_block_size / PAGE_SIZE;
420−
421− swap(ring->pg_vec_len, req->nm_block_nr);
422− swap(ring->pg_vec_order, order);
423− swap(ring->pg_vec, pg_vec);
424−
425− __skb_queue_purge(queue);
426− spin_unlock_bh(&queue->lock);
427−
428− WARN_ON(atomic_read(&nlk->mapped));
438+ if (atomic_read(&nlk->mapped) == 0) {
439+ __netlink_set_ring(sk, req, tx_ring, pg_vec, order);
440+ mutex_unlock(&nlk->pg_vec_lock);
441+ return 0;
429442 }
443+
430444 mutex_unlock(&nlk->pg_vec_lock);
431445
432446 if (pg_vec)
433447 free_pg_vec(pg_vec, order, req->nm_block_nr);
434− return err;
448+
449+ return -EBUSY;
435450 }
436451
437452 static void netlink_mm_open(struct vm_area_struct *vma)
@@ -900,10 +915,10 @@ static void netlink_sock_destruct(struct sock *sk) · 462 unmodified lines
900915
901916 memset(&req, 0, sizeof(req));
902917 if (nlk->rx_ring.pg_vec)
903− netlink_set_ring(sk, &req, true, false);
918+ __netlink_set_ring(sk, &req, false, NULL, 0);
904919 memset(&req, 0, sizeof(req));
905920 if (nlk->tx_ring.pg_vec)
906− netlink_set_ring(sk, &req, true, true);
921+ __netlink_set_ring(sk, &req, true, NULL, 0);
907922 }
908923 #endif /* CONFIG_NETLINK_MMAP */
909924
@@ -2223,7 +2238,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname, · 1313 unmodified lines
22232238 return -EINVAL;
22242239 if (copy_from_user(&req, optval, sizeof(req)))
22252240 return -EFAULT;
2226− err = netlink_set_ring(sk, &req, false,
2241+ err = netlink_set_ring(sk, &req,
22272242 optname == NETLINK_TX_RING);
22282243 break;
22292244 }
net/openvswitch/flow_table.c+1−1
@@ -752,7 +752,7 @@ int ovs_flow_init(void) · 751 unmodified lines
752752 BUILD_BUG_ON(sizeof(struct sw_flow_key) % sizeof(long));
753753
754754 flow_cache = kmem_cache_create("sw_flow", sizeof(struct sw_flow)
755− + (num_possible_nodes()
755+ + (nr_node_ids
756756 * sizeof(struct flow_stats *)),
757757 0, 0, NULL);
758758 if (flow_cache == NULL)
net/sched/act_bpf.c+3−0
@@ -339,6 +339,9 @@ static void tcf_bpf_cleanup(struct tc_action *act, int bind) · 338 unmodified lines
339339 bpf_prog_put(prog->filter);
340340 else
341341 bpf_prog_destroy(prog->filter);
342+
343+ kfree(prog->bpf_ops);
344+ kfree(prog->bpf_name);
342345 }
343346
344347 static struct tc_action_ops act_bpf_ops __read_mostly = {
net/sched/cls_bpf.c+1−1
@@ -378,7 +378,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, · 377 unmodified lines
378378 goto errout;
379379
380380 if (oldprog) {
381− list_replace_rcu(&prog->link, &oldprog->link);
381+ list_replace_rcu(&oldprog->link, &prog->link);
382382 tcf_unbind_filter(tp, &oldprog->res);
383383 call_rcu(&oldprog->rcu, __cls_bpf_delete_prog);
384384 } else {
net/sched/cls_flow.c+3−2
@@ -425,6 +425,8 @@ static int flow_change(struct net *net, struct sk_buff *in_skb, · 424 unmodified lines
425425 if (!fnew)
426426 goto err2;
427427
428+ tcf_exts_init(&fnew->exts, TCA_FLOW_ACT, TCA_FLOW_POLICE);
429+
428430 fold = (struct flow_filter *)*arg;
429431 if (fold) {
430432 err = -EINVAL;
@@ -486,7 +488,6 @@ static int flow_change(struct net *net, struct sk_buff *in_skb, · 55 unmodified lines
486488 fnew->mask = ~0U;
487489 fnew->tp = tp;
488490 get_random_bytes(&fnew->hashrnd, 4);
489− tcf_exts_init(&fnew->exts, TCA_FLOW_ACT, TCA_FLOW_POLICE);
490491 }
491492
492493 fnew->perturb_timer.function = flow_perturbation;
@@ -526,7 +527,7 @@ static int flow_change(struct net *net, struct sk_buff *in_skb, · 33 unmodified lines
526527 if (*arg == 0)
527528 list_add_tail_rcu(&fnew->list, &head->filters);
528529 else
529− list_replace_rcu(&fnew->list, &fold->list);
530+ list_replace_rcu(&fold->list, &fnew->list);
530531
531532 *arg = (unsigned long)fnew;
532533
net/sched/cls_flower.c+1−1
@@ -499,7 +499,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 498 unmodified lines
499499 *arg = (unsigned long) fnew;
500500
501501 if (fold) {
502− list_replace_rcu(&fnew->list, &fold->list);
502+ list_replace_rcu(&fold->list, &fnew->list);
503503 tcf_unbind_filter(tp, &fold->res);
504504 call_rcu(&fold->rcu, fl_destroy_filter);
505505 } else {
net/sched/sch_fq_codel.c+11−2
@@ -155,14 +155,23 @@ static unsigned int fq_codel_drop(struct Qdisc *sch) · 154 unmodified lines
155155 skb = dequeue_head(flow);
156156 len = qdisc_pkt_len(skb);
157157 q->backlogs[idx] -= len;
158− kfree_skb(skb);
159158 sch->q.qlen--;
160159 qdisc_qstats_drop(sch);
161160 qdisc_qstats_backlog_dec(sch, skb);
161+ kfree_skb(skb);
162162 flow->dropped++;
163163 return idx;
164164 }
165165
166+static unsigned int fq_codel_qdisc_drop(struct Qdisc *sch)
167+{
168+ unsigned int prev_backlog;
169+
170+ prev_backlog = sch->qstats.backlog;
171+ fq_codel_drop(sch);
172+ return prev_backlog - sch->qstats.backlog;
173+}
174+
166175 static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
167176 {
168177 struct fq_codel_sched_data *q = qdisc_priv(sch);
@@ -604,7 +613,7 @@ static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { · 435 unmodified lines
604613 .enqueue = fq_codel_enqueue,
605614 .dequeue = fq_codel_dequeue,
606615 .peek = qdisc_peek_dequeued,
607− .drop = fq_codel_drop,
616+ .drop = fq_codel_qdisc_drop,
608617 .init = fq_codel_init,
609618 .reset = fq_codel_reset,
610619 .destroy = fq_codel_destroy,
net/sched/sch_sfq.c+1−1
@@ -306,10 +306,10 @@ drop: · 305 unmodified lines
306306 len = qdisc_pkt_len(skb);
307307 slot->backlog -= len;
308308 sfq_dec(q, x);
309− kfree_skb(skb);
310309 sch->q.qlen--;
311310 qdisc_qstats_drop(sch);
312311 qdisc_qstats_backlog_dec(sch, skb);
312+ kfree_skb(skb);
313313 return len;
314314 }
315315
net/wireless/chan.c+34−11
@@ -797,23 +797,18 @@ static bool cfg80211_ir_permissive_chan(struct wiphy *wiphy, · 796 unmodified lines
797797 return false;
798798 }
799799
800−bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
801− struct cfg80211_chan_def *chandef,
802− enum nl80211_iftype iftype)
800+static bool _cfg80211_reg_can_beacon(struct wiphy *wiphy,
801+ struct cfg80211_chan_def *chandef,
802+ enum nl80211_iftype iftype,
803+ bool check_no_ir)
803804 {
804805 bool res;
805806 u32 prohibited_flags = IEEE80211_CHAN_DISABLED |
806807 IEEE80211_CHAN_RADAR;
807808
808− trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype);
809+ trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype, check_no_ir);
809810
810− /*
811− * Under certain conditions suggested by some regulatory bodies a
812− * GO/STA can IR on channels marked with IEEE80211_NO_IR. Set this flag
813− * only if such relaxations are not enabled and the conditions are not
814− * met.
815− */
816− if (!cfg80211_ir_permissive_chan(wiphy, iftype, chandef->chan))
811+ if (check_no_ir)
817812 prohibited_flags |= IEEE80211_CHAN_NO_IR;
818813
819814 if (cfg80211_chandef_dfs_required(wiphy, chandef, iftype) > 0 &&
@@ -827,8 +822,36 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy, · 7 unmodified lines
827822 trace_cfg80211_return_bool(res);
828823 return res;
829824 }
825+
826+bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
827+ struct cfg80211_chan_def *chandef,
828+ enum nl80211_iftype iftype)
829+{
830+ return _cfg80211_reg_can_beacon(wiphy, chandef, iftype, true);
831+}
830832 EXPORT_SYMBOL(cfg80211_reg_can_beacon);
831833
834+bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
835+ struct cfg80211_chan_def *chandef,
836+ enum nl80211_iftype iftype)
837+{
838+ bool check_no_ir;
839+
840+ ASSERT_RTNL();
841+
842+ /*
843+ * Under certain conditions suggested by some regulatory bodies a
844+ * GO/STA can IR on channels marked with IEEE80211_NO_IR. Set this flag
845+ * only if such relaxations are not enabled and the conditions are not
846+ * met.
847+ */
848+ check_no_ir = !cfg80211_ir_permissive_chan(wiphy, iftype,
849+ chandef->chan);
850+
851+ return _cfg80211_reg_can_beacon(wiphy, chandef, iftype, check_no_ir);
852+}
853+EXPORT_SYMBOL(cfg80211_reg_can_beacon_relax);
854+
832855 int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
833856 struct cfg80211_chan_def *chandef)
834857 {
net/wireless/nl80211.c+8−6
@@ -2003,7 +2003,8 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, · 2002 unmodified lines
20032003 switch (iftype) {
20042004 case NL80211_IFTYPE_AP:
20052005 case NL80211_IFTYPE_P2P_GO:
2006− if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef, iftype)) {
2006+ if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &chandef,
2007+ iftype)) {
20072008 result = -EINVAL;
20082009 break;
20092010 }
@@ -3403,8 +3404,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) · 1393 unmodified lines
34033404 } else if (!nl80211_get_ap_channel(rdev, &params))
34043405 return -EINVAL;
34053406
3406− if (!cfg80211_reg_can_beacon(&rdev->wiphy, &params.chandef,
3407− wdev->iftype))
3407+ if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &params.chandef,
3408+ wdev->iftype))
34083409 return -EINVAL;
34093410
34103411 if (info->attrs[NL80211_ATTR_ACL_POLICY]) {
@@ -6492,8 +6493,8 @@ skip_beacons: · 3081 unmodified lines
64926493 if (err)
64936494 return err;
64946495
6495− if (!cfg80211_reg_can_beacon(&rdev->wiphy, &params.chandef,
6496− wdev->iftype))
6496+ if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &params.chandef,
6497+ wdev->iftype))
64976498 return -EINVAL;
64986499
64996500 err = cfg80211_chandef_dfs_required(wdev->wiphy,
@@ -10170,7 +10171,8 @@ static int nl80211_tdls_channel_switch(struct sk_buff *skb, · 3670 unmodified lines
1017010171 return -EINVAL;
1017110172
1017210173 /* we will be active on the TDLS link */
10173− if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef, wdev->iftype))
10174+ if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &chandef,
10175+ wdev->iftype))
1017410176 return -EINVAL;
1017510177
1017610178 /* don't allow switching to DFS channels */
net/wireless/reg.c+4−4
@@ -544,15 +544,15 @@ static int call_crda(const char *alpha2) · 543 unmodified lines
544544 reg_regdb_query(alpha2);
545545
546546 if (reg_crda_timeouts > REG_MAX_CRDA_TIMEOUTS) {
547− pr_info("Exceeded CRDA call max attempts. Not calling CRDA\n");
547+ pr_debug("Exceeded CRDA call max attempts. Not calling CRDA\n");
548548 return -EINVAL;
549549 }
550550
551551 if (!is_world_regdom((char *) alpha2))
552− pr_info("Calling CRDA for country: %c%c\n",
552+ pr_debug("Calling CRDA for country: %c%c\n",
553553 alpha2[0], alpha2[1]);
554554 else
555− pr_info("Calling CRDA to update world regulatory domain\n");
555+ pr_debug("Calling CRDA to update world regulatory domain\n");
556556
557557 return kobject_uevent_env(&reg_pdev->dev.kobj, KOBJ_CHANGE, env);
558558 }
@@ -1589,7 +1589,7 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) · 1030 unmodified lines
15891589 case NL80211_IFTYPE_AP:
15901590 case NL80211_IFTYPE_P2P_GO:
15911591 case NL80211_IFTYPE_ADHOC:
1592− return cfg80211_reg_can_beacon(wiphy, &chandef, iftype);
1592+ return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype);
15931593 case NL80211_IFTYPE_STATION:
15941594 case NL80211_IFTYPE_P2P_CLIENT:
15951595 return cfg80211_chandef_usable(wiphy, &chandef,
net/wireless/trace.h+7−4
@@ -2358,20 +2358,23 @@ TRACE_EVENT(cfg80211_cqm_rssi_notify, · 2357 unmodified lines
23582358
23592359 TRACE_EVENT(cfg80211_reg_can_beacon,
23602360 TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
2361− enum nl80211_iftype iftype),
2362− TP_ARGS(wiphy, chandef, iftype),
2361+ enum nl80211_iftype iftype, bool check_no_ir),
2362+ TP_ARGS(wiphy, chandef, iftype, check_no_ir),
23632363 TP_STRUCT__entry(
23642364 WIPHY_ENTRY
23652365 CHAN_DEF_ENTRY
23662366 __field(enum nl80211_iftype, iftype)
2367+ __field(bool, check_no_ir)
23672368 ),
23682369 TP_fast_assign(
23692370 WIPHY_ASSIGN;
23702371 CHAN_DEF_ASSIGN(chandef);
23712372 __entry->iftype = iftype;
2373+ __entry->check_no_ir = check_no_ir;
23722374 ),
2373− TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT ", iftype=%d",
2374− WIPHY_PR_ARG, CHAN_DEF_PR_ARG, __entry->iftype)
2375+ TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT ", iftype=%d check_no_ir=%s",
2376+ WIPHY_PR_ARG, CHAN_DEF_PR_ARG, __entry->iftype,
2377+ BOOL_TO_STR(__entry->check_no_ir))
23752378 );
23762379
23772380 TRACE_EVENT(cfg80211_chandef_dfs_required,