Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull networking fixes from David Miller:
"This looks like a lot but it's a mixture of regression fixes as well
as fixes for longer standing issues.

1) Fix on-channel cancellation in mac80211, from Johannes Berg.

2) Handle CHECKSUM_COMPLETE properly in xt_TCPMSS netfilter xtables
module, from Eric Dumazet.

3) Avoid infinite loop in UDP SO_REUSEPORT logic, also from Eric
Dumazet.

4) Avoid a NULL deref if we try to set SO_REUSEPORT after a socket is
bound, from Craig Gallek.

5) GRO key comparisons don't take lightweight tunnels into account,
from Jesse Gross.

6) Fix struct pid leak via SCM credentials in AF_UNIX, from Eric
Dumazet.

7) We need to set the rtnl_link_ops of ipv6 SIT tunnels before we
register them, otherwise the NEWLINK netlink message is missing
the proper attributes. From Thadeu Lima de Souza Cascardo.

8) Several Spectrum chip bug fixes for mlxsw switch driver, from Ido
Schimmel

9) Handle fragments properly in ipv4 easly socket demux, from Eric
Dumazet.

10) Don't ignore the ifindex key specifier on ipv6 output route
lookups, from Paolo Abeni"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (128 commits)
tcp: avoid cwnd undo after receiving ECN
irda: fix a potential use-after-free in ircomm_param_request
net: tg3: avoid uninitialized variable warning
net: nb8800: avoid uninitialized variable warning
net: vxge: avoid unused function warnings
net: bgmac: clarify CONFIG_BCMA dependency
net: hp100: remove unnecessary #ifdefs
net: davinci_cpdma: use dma_addr_t for DMA address
ipv6/udp: use sticky pktinfo egress ifindex on connect()
ipv6: enforce flowi6_oif usage in ip6_dst_lookup_tail()
netlink: not trim skb for mmaped socket when dump
vxlan: fix a out of bounds access in __vxlan_find_mac
net: dsa: mv88e6xxx: fix port VLAN maps
fib_trie: Fix shift by 32 in fib_table_lookup
net: moxart: use correct accessors for DMA memory
ipv4: ipconfig: avoid unused ic_proto_used symbol
bnxt_en: Fix crash in bnxt_free_tx_skbs() during tx timeout.
bnxt_en: Exclude rx_drop_pkts hw counter from the stack's rx_dropped counter.
bnxt_en: Ring free response from close path should use completion ring
net_sched: drr: check for NULL pointer in drr_dequeue
...

+1404 -845
+2 -2
Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
··· 68 68 phy1: ethernet-phy@1 { 69 69 max-speed = <1000>; 70 70 reg = <0x1>; 71 - compatible = "brcm,28nm-gphy", "ethernet-phy-ieee802.3-c22"; 71 + compatible = "ethernet-phy-ieee802.3-c22"; 72 72 }; 73 73 }; 74 74 }; ··· 115 115 phy0: ethernet-phy@0 { 116 116 max-speed = <1000>; 117 117 reg = <0x0>; 118 - compatible = "brcm,bcm53125", "ethernet-phy-ieee802.3-c22"; 118 + compatible = "ethernet-phy-ieee802.3-c22"; 119 119 }; 120 120 }; 121 121 };
+1 -4
Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
··· 4 4 - compatible: should be "hisilicon,hns-dsaf-v1" or "hisilicon,hns-dsaf-v2". 5 5 "hisilicon,hns-dsaf-v1" is for hip05. 6 6 "hisilicon,hns-dsaf-v2" is for Hi1610 and Hi1612. 7 - - dsa-name: dsa fabric name who provide this interface. 8 - should be "dsafX", X is the dsaf id. 9 7 - mode: dsa fabric mode string. only support one of dsaf modes like these: 10 8 "2port-64vf", 11 9 "6port-16rss", ··· 24 26 25 27 Example: 26 28 27 - dsa: dsa@c7000000 { 29 + dsaf0: dsa@c7000000 { 28 30 compatible = "hisilicon,hns-dsaf-v1"; 29 - dsa_name = "dsaf0"; 30 31 mode = "6port-16rss"; 31 32 interrupt-parent = <&mbigen_dsa>; 32 33 reg = <0x0 0xC0000000 0x0 0x420000
+4 -3
Documentation/devicetree/bindings/net/hisilicon-hns-nic.txt
··· 4 4 - compatible: "hisilicon,hns-nic-v1" or "hisilicon,hns-nic-v2". 5 5 "hisilicon,hns-nic-v1" is for hip05. 6 6 "hisilicon,hns-nic-v2" is for Hi1610 and Hi1612. 7 - - ae-name: accelerator name who provides this interface, 8 - is simply a name referring to the name of name in the accelerator node. 7 + - ae-handle: accelerator engine handle for hns, 8 + specifies a reference to the associating hardware driver node. 9 + see Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt 9 10 - port-id: is the index of port provided by DSAF (the accelerator). DSAF can 10 11 connect to 8 PHYs. Port 0 to 1 are both used for adminstration purpose. They 11 12 are called debug ports. ··· 42 41 43 42 ethernet@0{ 44 43 compatible = "hisilicon,hns-nic-v1"; 45 - ae-name = "dsaf0"; 44 + ae-handle = <&dsaf0>; 46 45 port-id = <0>; 47 46 local-mac-address = [a2 14 e4 4b 56 76]; 48 47 };
+6 -1
Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
··· 6 6 - interrupts: interrupt for the device 7 7 - phy: See ethernet.txt file in the same directory. 8 8 - phy-mode: See ethernet.txt file in the same directory 9 - - clocks: a pointer to the reference clock for this device. 9 + - clocks: List of clocks for this device. At least one clock is 10 + mandatory for the core clock. If several clocks are given, then the 11 + clock-names property must be used to identify them. 10 12 11 13 Optional properties: 12 14 - tx-csum-limit: maximum mtu supported by port that allow TX checksum. 13 15 Value is presented in bytes. If not used, by default 1600B is set for 14 16 "marvell,armada-370-neta" and 9800B for others. 17 + - clock-names: List of names corresponding to clocks property; shall be 18 + "core" for core clock and "bus" for the optional bus clock. 19 + 15 20 16 21 Example: 17 22
-8
Documentation/devicetree/bindings/net/mdio-mux-gpio.txt
··· 38 38 39 39 phy11: ethernet-phy@1 { 40 40 reg = <1>; 41 - compatible = "marvell,88e1149r"; 42 41 marvell,reg-init = <3 0x10 0 0x5777>, 43 42 <3 0x11 0 0x00aa>, 44 43 <3 0x12 0 0x4105>, ··· 47 48 }; 48 49 phy12: ethernet-phy@2 { 49 50 reg = <2>; 50 - compatible = "marvell,88e1149r"; 51 51 marvell,reg-init = <3 0x10 0 0x5777>, 52 52 <3 0x11 0 0x00aa>, 53 53 <3 0x12 0 0x4105>, ··· 56 58 }; 57 59 phy13: ethernet-phy@3 { 58 60 reg = <3>; 59 - compatible = "marvell,88e1149r"; 60 61 marvell,reg-init = <3 0x10 0 0x5777>, 61 62 <3 0x11 0 0x00aa>, 62 63 <3 0x12 0 0x4105>, ··· 65 68 }; 66 69 phy14: ethernet-phy@4 { 67 70 reg = <4>; 68 - compatible = "marvell,88e1149r"; 69 71 marvell,reg-init = <3 0x10 0 0x5777>, 70 72 <3 0x11 0 0x00aa>, 71 73 <3 0x12 0 0x4105>, ··· 81 85 82 86 phy21: ethernet-phy@1 { 83 87 reg = <1>; 84 - compatible = "marvell,88e1149r"; 85 88 marvell,reg-init = <3 0x10 0 0x5777>, 86 89 <3 0x11 0 0x00aa>, 87 90 <3 0x12 0 0x4105>, ··· 90 95 }; 91 96 phy22: ethernet-phy@2 { 92 97 reg = <2>; 93 - compatible = "marvell,88e1149r"; 94 98 marvell,reg-init = <3 0x10 0 0x5777>, 95 99 <3 0x11 0 0x00aa>, 96 100 <3 0x12 0 0x4105>, ··· 99 105 }; 100 106 phy23: ethernet-phy@3 { 101 107 reg = <3>; 102 - compatible = "marvell,88e1149r"; 103 108 marvell,reg-init = <3 0x10 0 0x5777>, 104 109 <3 0x11 0 0x00aa>, 105 110 <3 0x12 0 0x4105>, ··· 108 115 }; 109 116 phy24: ethernet-phy@4 { 110 117 reg = <4>; 111 - compatible = "marvell,88e1149r"; 112 118 marvell,reg-init = <3 0x10 0 0x5777>, 113 119 <3 0x11 0 0x00aa>, 114 120 <3 0x12 0 0x4105>,
-8
Documentation/devicetree/bindings/net/mdio-mux.txt
··· 47 47 48 48 phy11: ethernet-phy@1 { 49 49 reg = <1>; 50 - compatible = "marvell,88e1149r"; 51 50 marvell,reg-init = <3 0x10 0 0x5777>, 52 51 <3 0x11 0 0x00aa>, 53 52 <3 0x12 0 0x4105>, ··· 56 57 }; 57 58 phy12: ethernet-phy@2 { 58 59 reg = <2>; 59 - compatible = "marvell,88e1149r"; 60 60 marvell,reg-init = <3 0x10 0 0x5777>, 61 61 <3 0x11 0 0x00aa>, 62 62 <3 0x12 0 0x4105>, ··· 65 67 }; 66 68 phy13: ethernet-phy@3 { 67 69 reg = <3>; 68 - compatible = "marvell,88e1149r"; 69 70 marvell,reg-init = <3 0x10 0 0x5777>, 70 71 <3 0x11 0 0x00aa>, 71 72 <3 0x12 0 0x4105>, ··· 74 77 }; 75 78 phy14: ethernet-phy@4 { 76 79 reg = <4>; 77 - compatible = "marvell,88e1149r"; 78 80 marvell,reg-init = <3 0x10 0 0x5777>, 79 81 <3 0x11 0 0x00aa>, 80 82 <3 0x12 0 0x4105>, ··· 90 94 91 95 phy21: ethernet-phy@1 { 92 96 reg = <1>; 93 - compatible = "marvell,88e1149r"; 94 97 marvell,reg-init = <3 0x10 0 0x5777>, 95 98 <3 0x11 0 0x00aa>, 96 99 <3 0x12 0 0x4105>, ··· 99 104 }; 100 105 phy22: ethernet-phy@2 { 101 106 reg = <2>; 102 - compatible = "marvell,88e1149r"; 103 107 marvell,reg-init = <3 0x10 0 0x5777>, 104 108 <3 0x11 0 0x00aa>, 105 109 <3 0x12 0 0x4105>, ··· 108 114 }; 109 115 phy23: ethernet-phy@3 { 110 116 reg = <3>; 111 - compatible = "marvell,88e1149r"; 112 117 marvell,reg-init = <3 0x10 0 0x5777>, 113 118 <3 0x11 0 0x00aa>, 114 119 <3 0x12 0 0x4105>, ··· 117 124 }; 118 125 phy24: ethernet-phy@4 { 119 126 reg = <4>; 120 - compatible = "marvell,88e1149r"; 121 127 marvell,reg-init = <3 0x10 0 0x5777>, 122 128 <3 0x11 0 0x00aa>, 123 129 <3 0x12 0 0x4105>,
+4 -2
Documentation/devicetree/bindings/net/phy.txt
··· 17 17 "ethernet-phy-ieee802.3-c22" or "ethernet-phy-ieee802.3-c45" for 18 18 PHYs that implement IEEE802.3 clause 22 or IEEE802.3 clause 45 19 19 specifications. If neither of these are specified, the default is to 20 - assume clause 22. The compatible list may also contain other 21 - elements. 20 + assume clause 22. 22 21 23 22 If the phy's identifier is known then the list may contain an entry 24 23 of the form: "ethernet-phy-idAAAA.BBBB" where ··· 26 27 BBBB - The value of the 16 bit Phy Identifier 2 register as 27 28 4 hex digits. This is the chip vendor OUI bits 19:24, 28 29 followed by 10 bits of a vendor specific ID. 30 + 31 + The compatible list should not contain other values than those 32 + listed here. 29 33 30 34 - max-speed: Maximum PHY supported speed (10, 100, 1000...) 31 35
+1 -1
Documentation/networking/ip-sysctl.txt
··· 594 594 595 595 tcp_syn_retries - INTEGER 596 596 Number of times initial SYNs for an active TCP connection attempt 597 - will be retransmitted. Should not be higher than 255. Default value 597 + will be retransmitted. Should not be higher than 127. Default value 598 598 is 6, which corresponds to 63seconds till the last retransmission 599 599 with the current initial RTO of 1second. With this the final timeout 600 600 for an active TCP connection attempt will happen after 127seconds.
+1 -1
MAINTAINERS
··· 10173 10173 10174 10174 SONICS SILICON BACKPLANE DRIVER (SSB) 10175 10175 M: Michael Buesch <m@bues.ch> 10176 - L: netdev@vger.kernel.org 10176 + L: linux-wireless@vger.kernel.org 10177 10177 S: Maintained 10178 10178 F: drivers/ssb/ 10179 10179 F: include/linux/ssb/
+9 -10
arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi
··· 23 23 }; 24 24 }; 25 25 26 - dsa: dsa@c7000000 { 26 + dsaf0: dsa@c7000000 { 27 27 compatible = "hisilicon,hns-dsaf-v1"; 28 - dsa_name = "dsaf0"; 29 28 mode = "6port-16rss"; 30 29 interrupt-parent = <&mbigen_dsa>; 31 30 ··· 126 127 127 128 eth0: ethernet@0{ 128 129 compatible = "hisilicon,hns-nic-v1"; 129 - ae-name = "dsaf0"; 130 + ae-handle = <&dsaf0>; 130 131 port-id = <0>; 131 132 local-mac-address = [00 00 00 01 00 58]; 132 133 status = "disabled"; ··· 134 135 }; 135 136 eth1: ethernet@1{ 136 137 compatible = "hisilicon,hns-nic-v1"; 137 - ae-name = "dsaf0"; 138 + ae-handle = <&dsaf0>; 138 139 port-id = <1>; 139 140 status = "disabled"; 140 141 dma-coherent; 141 142 }; 142 143 eth2: ethernet@2{ 143 144 compatible = "hisilicon,hns-nic-v1"; 144 - ae-name = "dsaf0"; 145 + ae-handle = <&dsaf0>; 145 146 port-id = <2>; 146 147 local-mac-address = [00 00 00 01 00 5a]; 147 148 status = "disabled"; ··· 149 150 }; 150 151 eth3: ethernet@3{ 151 152 compatible = "hisilicon,hns-nic-v1"; 152 - ae-name = "dsaf0"; 153 + ae-handle = <&dsaf0>; 153 154 port-id = <3>; 154 155 local-mac-address = [00 00 00 01 00 5b]; 155 156 status = "disabled"; ··· 157 158 }; 158 159 eth4: ethernet@4{ 159 160 compatible = "hisilicon,hns-nic-v1"; 160 - ae-name = "dsaf0"; 161 + ae-handle = <&dsaf0>; 161 162 port-id = <4>; 162 163 local-mac-address = [00 00 00 01 00 5c]; 163 164 status = "disabled"; ··· 165 166 }; 166 167 eth5: ethernet@5{ 167 168 compatible = "hisilicon,hns-nic-v1"; 168 - ae-name = "dsaf0"; 169 + ae-handle = <&dsaf0>; 169 170 port-id = <5>; 170 171 local-mac-address = [00 00 00 01 00 5d]; 171 172 status = "disabled"; ··· 173 174 }; 174 175 eth6: ethernet@6{ 175 176 compatible = "hisilicon,hns-nic-v1"; 176 - ae-name = "dsaf0"; 177 + ae-handle = <&dsaf0>; 177 178 port-id = <6>; 178 179 local-mac-address = [00 00 00 01 00 5e]; 179 180 status = "disabled"; ··· 181 182 }; 182 183 eth7: ethernet@7{ 183 184 compatible = "hisilicon,hns-nic-v1"; 184 - ae-name = "dsaf0"; 185 + ae-handle = <&dsaf0>; 185 186 port-id = <7>; 186 187 local-mac-address = [00 00 00 01 00 5f]; 187 188 status = "disabled";
+3 -2
drivers/net/dsa/mv88e6xxx.c
··· 1532 1532 1533 1533 /* no PVID with ranges, otherwise it's a bug */ 1534 1534 if (pvid) 1535 - err = _mv88e6xxx_port_pvid_set(ds, port, vid); 1535 + err = _mv88e6xxx_port_pvid_set(ds, port, vlan->vid_end); 1536 1536 unlock: 1537 1537 mutex_unlock(&ps->smi_mutex); 1538 1538 ··· 2163 2163 * database, and allow every port to egress frames on all other ports. 2164 2164 */ 2165 2165 reg = BIT(ps->num_ports) - 1; /* all ports */ 2166 - ret = _mv88e6xxx_port_vlan_map_set(ds, port, reg & ~port); 2166 + reg &= ~BIT(port); /* except itself */ 2167 + ret = _mv88e6xxx_port_vlan_map_set(ds, port, reg); 2167 2168 if (ret) 2168 2169 goto abort; 2169 2170
+9 -3
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
··· 628 628 int ret; 629 629 630 630 ring = pdata->rx_ring; 631 + irq_set_status_flags(ring->irq, IRQ_DISABLE_UNLAZY); 631 632 ret = devm_request_irq(dev, ring->irq, xgene_enet_rx_irq, 632 633 IRQF_SHARED, ring->irq_name, ring); 633 634 if (ret) ··· 636 635 637 636 if (pdata->cq_cnt) { 638 637 ring = pdata->tx_ring->cp_ring; 638 + irq_set_status_flags(ring->irq, IRQ_DISABLE_UNLAZY); 639 639 ret = devm_request_irq(dev, ring->irq, xgene_enet_rx_irq, 640 640 IRQF_SHARED, ring->irq_name, ring); 641 641 if (ret) { ··· 651 649 static void xgene_enet_free_irq(struct net_device *ndev) 652 650 { 653 651 struct xgene_enet_pdata *pdata; 652 + struct xgene_enet_desc_ring *ring; 654 653 struct device *dev; 655 654 656 655 pdata = netdev_priv(ndev); 657 656 dev = ndev_to_dev(ndev); 658 - devm_free_irq(dev, pdata->rx_ring->irq, pdata->rx_ring); 657 + ring = pdata->rx_ring; 658 + irq_clear_status_flags(ring->irq, IRQ_DISABLE_UNLAZY); 659 + devm_free_irq(dev, ring->irq, ring); 659 660 660 661 if (pdata->cq_cnt) { 661 - devm_free_irq(dev, pdata->tx_ring->cp_ring->irq, 662 - pdata->tx_ring->cp_ring); 662 + ring = pdata->tx_ring->cp_ring; 663 + irq_clear_status_flags(ring->irq, IRQ_DISABLE_UNLAZY); 664 + devm_free_irq(dev, ring->irq, ring); 663 665 } 664 666 } 665 667
+1
drivers/net/ethernet/apm/xgene/xgene_enet_main.h
··· 25 25 #include <linux/acpi.h> 26 26 #include <linux/clk.h> 27 27 #include <linux/efi.h> 28 + #include <linux/irq.h> 28 29 #include <linux/io.h> 29 30 #include <linux/of_platform.h> 30 31 #include <linux/of_net.h>
+2 -2
drivers/net/ethernet/aurora/nb8800.c
··· 302 302 nb8800_tx_done(dev); 303 303 304 304 again: 305 - while (work < budget) { 305 + do { 306 306 struct nb8800_rx_buf *rxb; 307 307 unsigned int len; 308 308 ··· 330 330 rxd->report = 0; 331 331 last = next; 332 332 work++; 333 - } 333 + } while (work < budget); 334 334 335 335 if (work) { 336 336 priv->rx_descs[last].desc.config |= DESC_EOC;
+4 -1
drivers/net/ethernet/broadcom/Kconfig
··· 151 151 152 152 config BGMAC 153 153 tristate "BCMA bus GBit core support" 154 - depends on BCMA_HOST_SOC && HAS_DMA && (BCM47XX || ARCH_BCM_5301X) 154 + depends on BCMA && BCMA_HOST_SOC 155 + depends on HAS_DMA 156 + depends on BCM47XX || ARCH_BCM_5301X || COMPILE_TEST 155 157 select PHYLIB 158 + select FIXED_PHY 156 159 ---help--- 157 160 This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus. 158 161 They can be found on BCM47xx SoCs and provide gigabit ethernet.
+4 -5
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 1490 1490 1491 1491 last = tx_buf->nr_frags; 1492 1492 j += 2; 1493 - for (k = 0; k < last; k++, j = NEXT_TX(j)) { 1493 + for (k = 0; k < last; k++, j++) { 1494 + int ring_idx = j & bp->tx_ring_mask; 1494 1495 skb_frag_t *frag = &skb_shinfo(skb)->frags[k]; 1495 1496 1496 - tx_buf = &txr->tx_buf_ring[j]; 1497 + tx_buf = &txr->tx_buf_ring[ring_idx]; 1497 1498 dma_unmap_page( 1498 1499 &pdev->dev, 1499 1500 dma_unmap_addr(tx_buf, mapping), ··· 3407 3406 struct hwrm_ring_free_output *resp = bp->hwrm_cmd_resp_addr; 3408 3407 u16 error_code; 3409 3408 3410 - bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_RING_FREE, -1, -1); 3409 + bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_RING_FREE, cmpl_ring_id, -1); 3411 3410 req.ring_type = ring_type; 3412 3411 req.ring_id = cpu_to_le16(ring->fw_ring_id); 3413 3412 ··· 4819 4818 le64_to_cpu(hw_stats->rx_discard_pkts); 4820 4819 4821 4820 stats->multicast += le64_to_cpu(hw_stats->rx_mcast_pkts); 4822 - 4823 - stats->rx_dropped += le64_to_cpu(hw_stats->rx_drop_pkts); 4824 4821 4825 4822 stats->tx_dropped += le64_to_cpu(hw_stats->tx_drop_pkts); 4826 4823 }
+1 -1
drivers/net/ethernet/broadcom/genet/bcmmii.c
··· 401 401 * Ethernet MAC ISRs 402 402 */ 403 403 if (priv->internal_phy) 404 - priv->mii_bus->irq[phydev->mdio.addr] = PHY_IGNORE_INTERRUPT; 404 + priv->phydev->irq = PHY_IGNORE_INTERRUPT; 405 405 406 406 return 0; 407 407 }
+1 -1
drivers/net/ethernet/broadcom/tg3.c
··· 12016 12016 int ret; 12017 12017 u32 offset, len, b_offset, odd_len; 12018 12018 u8 *buf; 12019 - __be32 start, end; 12019 + __be32 start = 0, end; 12020 12020 12021 12021 if (tg3_flag(tp, NO_NVRAM) || 12022 12022 eeprom->magic != TG3_EEPROM_MAGIC)
+1 -1
drivers/net/ethernet/cadence/macb.c
··· 2823 2823 struct device_node *np = pdev->dev.of_node; 2824 2824 struct device_node *phy_node; 2825 2825 const struct macb_config *macb_config = NULL; 2826 - struct clk *pclk, *hclk, *tx_clk; 2826 + struct clk *pclk, *hclk = NULL, *tx_clk = NULL; 2827 2827 unsigned int queue_mask, num_queues; 2828 2828 struct macb_platform_data *pdata; 2829 2829 bool native_io;
+1 -3
drivers/net/ethernet/cavium/liquidio/lio_main.c
··· 1526 1526 struct timespec64 *ts) 1527 1527 { 1528 1528 u64 ns; 1529 - u32 remainder; 1530 1529 unsigned long flags; 1531 1530 struct lio *lio = container_of(ptp, struct lio, ptp_info); 1532 1531 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; ··· 1535 1536 ns += lio->ptp_adjust; 1536 1537 spin_unlock_irqrestore(&lio->ptp_lock, flags); 1537 1538 1538 - ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder); 1539 - ts->tv_nsec = remainder; 1539 + *ts = ns_to_timespec64(ns); 1540 1540 1541 1541 return 0; 1542 1542 }
+1
drivers/net/ethernet/ezchip/Kconfig
··· 18 18 config EZCHIP_NPS_MANAGEMENT_ENET 19 19 tristate "EZchip NPS management enet support" 20 20 depends on OF_IRQ && OF_NET 21 + depends on HAS_IOMEM 21 22 ---help--- 22 23 Simple LAN device for debug or management purposes. 23 24 Device supports interrupts for RX and TX(completion).
+3
drivers/net/ethernet/freescale/Makefile
··· 4 4 5 5 obj-$(CONFIG_FEC) += fec.o 6 6 fec-objs :=fec_main.o fec_ptp.o 7 + CFLAGS_fec_main.o := -D__CHECK_ENDIAN__ 8 + CFLAGS_fec_ptp.o := -D__CHECK_ENDIAN__ 9 + 7 10 obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx.o 8 11 ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y) 9 12 obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx_phy.o
+30 -14
drivers/net/ethernet/freescale/fec.h
··· 19 19 #include <linux/timecounter.h> 20 20 21 21 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ 22 - defined(CONFIG_M520x) || defined(CONFIG_M532x) || \ 23 - defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28) 22 + defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) 24 23 /* 25 24 * Just figures, Motorola would have to change the offsets for 26 25 * registers in the same peripheral device on different models ··· 189 190 190 191 /* 191 192 * Define the buffer descriptor structure. 193 + * 194 + * Evidently, ARM SoCs have the FEC block generated in a 195 + * little endian mode so adjust endianness accordingly. 192 196 */ 193 - #if defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28) 197 + #if defined(CONFIG_ARM) 198 + #define fec32_to_cpu le32_to_cpu 199 + #define fec16_to_cpu le16_to_cpu 200 + #define cpu_to_fec32 cpu_to_le32 201 + #define cpu_to_fec16 cpu_to_le16 202 + #define __fec32 __le32 203 + #define __fec16 __le16 204 + 194 205 struct bufdesc { 195 - unsigned short cbd_datlen; /* Data length */ 196 - unsigned short cbd_sc; /* Control and status info */ 197 - unsigned long cbd_bufaddr; /* Buffer address */ 206 + __fec16 cbd_datlen; /* Data length */ 207 + __fec16 cbd_sc; /* Control and status info */ 208 + __fec32 cbd_bufaddr; /* Buffer address */ 198 209 }; 199 210 #else 211 + #define fec32_to_cpu be32_to_cpu 212 + #define fec16_to_cpu be16_to_cpu 213 + #define cpu_to_fec32 cpu_to_be32 214 + #define cpu_to_fec16 cpu_to_be16 215 + #define __fec32 __be32 216 + #define __fec16 __be16 217 + 200 218 struct bufdesc { 201 - unsigned short cbd_sc; /* Control and status info */ 202 - unsigned short cbd_datlen; /* Data length */ 203 - unsigned long cbd_bufaddr; /* Buffer address */ 219 + __fec16 cbd_sc; /* Control and status info */ 220 + __fec16 cbd_datlen; /* Data length */ 221 + __fec32 cbd_bufaddr; /* Buffer address */ 204 222 }; 205 223 #endif 206 224 207 225 struct bufdesc_ex { 208 226 struct bufdesc desc; 209 - unsigned long cbd_esc; 210 - unsigned long cbd_prot; 211 - unsigned long cbd_bdu; 212 - unsigned long ts; 213 - unsigned short res0[4]; 227 + __fec32 cbd_esc; 228 + __fec32 cbd_prot; 229 + __fec32 cbd_bdu; 230 + __fec32 ts; 231 + __fec16 res0[4]; 214 232 }; 215 233 216 234 /*
+70 -63
drivers/net/ethernet/freescale/fec_main.c
··· 332 332 bdp = txq->tx_bd_base; 333 333 334 334 do { 335 - pr_info("%3u %c%c 0x%04x 0x%08lx %4u %p\n", 335 + pr_info("%3u %c%c 0x%04x 0x%08x %4u %p\n", 336 336 index, 337 337 bdp == txq->cur_tx ? 'S' : ' ', 338 338 bdp == txq->dirty_tx ? 'H' : ' ', 339 - bdp->cbd_sc, bdp->cbd_bufaddr, bdp->cbd_datlen, 339 + fec16_to_cpu(bdp->cbd_sc), 340 + fec32_to_cpu(bdp->cbd_bufaddr), 341 + fec16_to_cpu(bdp->cbd_datlen), 340 342 txq->tx_skbuff[index]); 341 343 bdp = fec_enet_get_nextdesc(bdp, fep, 0); 342 344 index++; ··· 391 389 bdp = fec_enet_get_nextdesc(bdp, fep, queue); 392 390 ebdp = (struct bufdesc_ex *)bdp; 393 391 394 - status = bdp->cbd_sc; 392 + status = fec16_to_cpu(bdp->cbd_sc); 395 393 status &= ~BD_ENET_TX_STATS; 396 394 status |= (BD_ENET_TX_TC | BD_ENET_TX_READY); 397 395 frag_len = skb_shinfo(skb)->frags[frag].size; ··· 413 411 if (skb->ip_summed == CHECKSUM_PARTIAL) 414 412 estatus |= BD_ENET_TX_PINS | BD_ENET_TX_IINS; 415 413 ebdp->cbd_bdu = 0; 416 - ebdp->cbd_esc = estatus; 414 + ebdp->cbd_esc = cpu_to_fec32(estatus); 417 415 } 418 416 419 417 bufaddr = page_address(this_frag->page.p) + this_frag->page_offset; ··· 437 435 goto dma_mapping_error; 438 436 } 439 437 440 - bdp->cbd_bufaddr = addr; 441 - bdp->cbd_datlen = frag_len; 442 - bdp->cbd_sc = status; 438 + bdp->cbd_bufaddr = cpu_to_fec32(addr); 439 + bdp->cbd_datlen = cpu_to_fec16(frag_len); 440 + bdp->cbd_sc = cpu_to_fec16(status); 443 441 } 444 442 445 443 return bdp; ··· 447 445 bdp = txq->cur_tx; 448 446 for (i = 0; i < frag; i++) { 449 447 bdp = fec_enet_get_nextdesc(bdp, fep, queue); 450 - dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, 451 - bdp->cbd_datlen, DMA_TO_DEVICE); 448 + dma_unmap_single(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr), 449 + fec16_to_cpu(bdp->cbd_datlen), DMA_TO_DEVICE); 452 450 } 453 451 return ERR_PTR(-ENOMEM); 454 452 } ··· 485 483 /* Fill in a Tx ring entry */ 486 484 bdp = txq->cur_tx; 487 485 last_bdp = bdp; 488 - status = bdp->cbd_sc; 486 + status = fec16_to_cpu(bdp->cbd_sc); 489 487 status &= ~BD_ENET_TX_STATS; 490 488 491 489 /* Set buffer length and buffer pointer */ ··· 541 539 estatus |= BD_ENET_TX_PINS | BD_ENET_TX_IINS; 542 540 543 541 ebdp->cbd_bdu = 0; 544 - ebdp->cbd_esc = estatus; 542 + ebdp->cbd_esc = cpu_to_fec32(estatus); 545 543 } 546 544 547 545 index = fec_enet_get_bd_index(txq->tx_bd_base, last_bdp, fep); 548 546 /* Save skb pointer */ 549 547 txq->tx_skbuff[index] = skb; 550 548 551 - bdp->cbd_datlen = buflen; 552 - bdp->cbd_bufaddr = addr; 549 + bdp->cbd_datlen = cpu_to_fec16(buflen); 550 + bdp->cbd_bufaddr = cpu_to_fec32(addr); 553 551 554 552 /* Send it on its way. Tell FEC it's ready, interrupt when done, 555 553 * it's the last BD of the frame, and to put the CRC on the end. 556 554 */ 557 555 status |= (BD_ENET_TX_READY | BD_ENET_TX_TC); 558 - bdp->cbd_sc = status; 556 + bdp->cbd_sc = cpu_to_fec16(status); 559 557 560 558 /* If this was the last BD in the ring, start at the beginning again. */ 561 559 bdp = fec_enet_get_nextdesc(last_bdp, fep, queue); ··· 587 585 unsigned int estatus = 0; 588 586 dma_addr_t addr; 589 587 590 - status = bdp->cbd_sc; 588 + status = fec16_to_cpu(bdp->cbd_sc); 591 589 status &= ~BD_ENET_TX_STATS; 592 590 593 591 status |= (BD_ENET_TX_TC | BD_ENET_TX_READY); ··· 609 607 return NETDEV_TX_BUSY; 610 608 } 611 609 612 - bdp->cbd_datlen = size; 613 - bdp->cbd_bufaddr = addr; 610 + bdp->cbd_datlen = cpu_to_fec16(size); 611 + bdp->cbd_bufaddr = cpu_to_fec32(addr); 614 612 615 613 if (fep->bufdesc_ex) { 616 614 if (fep->quirks & FEC_QUIRK_HAS_AVB) ··· 618 616 if (skb->ip_summed == CHECKSUM_PARTIAL) 619 617 estatus |= BD_ENET_TX_PINS | BD_ENET_TX_IINS; 620 618 ebdp->cbd_bdu = 0; 621 - ebdp->cbd_esc = estatus; 619 + ebdp->cbd_esc = cpu_to_fec32(estatus); 622 620 } 623 621 624 622 /* Handle the last BD specially */ ··· 627 625 if (is_last) { 628 626 status |= BD_ENET_TX_INTR; 629 627 if (fep->bufdesc_ex) 630 - ebdp->cbd_esc |= BD_ENET_TX_INT; 628 + ebdp->cbd_esc |= cpu_to_fec32(BD_ENET_TX_INT); 631 629 } 632 630 633 - bdp->cbd_sc = status; 631 + bdp->cbd_sc = cpu_to_fec16(status); 634 632 635 633 return 0; 636 634 } ··· 649 647 unsigned short status; 650 648 unsigned int estatus = 0; 651 649 652 - status = bdp->cbd_sc; 650 + status = fec16_to_cpu(bdp->cbd_sc); 653 651 status &= ~BD_ENET_TX_STATS; 654 652 status |= (BD_ENET_TX_TC | BD_ENET_TX_READY); 655 653 ··· 673 671 } 674 672 } 675 673 676 - bdp->cbd_bufaddr = dmabuf; 677 - bdp->cbd_datlen = hdr_len; 674 + bdp->cbd_bufaddr = cpu_to_fec32(dmabuf); 675 + bdp->cbd_datlen = cpu_to_fec16(hdr_len); 678 676 679 677 if (fep->bufdesc_ex) { 680 678 if (fep->quirks & FEC_QUIRK_HAS_AVB) ··· 682 680 if (skb->ip_summed == CHECKSUM_PARTIAL) 683 681 estatus |= BD_ENET_TX_PINS | BD_ENET_TX_IINS; 684 682 ebdp->cbd_bdu = 0; 685 - ebdp->cbd_esc = estatus; 683 + ebdp->cbd_esc = cpu_to_fec32(estatus); 686 684 } 687 685 688 - bdp->cbd_sc = status; 686 + bdp->cbd_sc = cpu_to_fec16(status); 689 687 690 688 return 0; 691 689 } ··· 825 823 826 824 /* Initialize the BD for every fragment in the page. */ 827 825 if (bdp->cbd_bufaddr) 828 - bdp->cbd_sc = BD_ENET_RX_EMPTY; 826 + bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); 829 827 else 830 - bdp->cbd_sc = 0; 828 + bdp->cbd_sc = cpu_to_fec16(0); 831 829 bdp = fec_enet_get_nextdesc(bdp, fep, q); 832 830 } 833 831 834 832 /* Set the last buffer to wrap */ 835 833 bdp = fec_enet_get_prevdesc(bdp, fep, q); 836 - bdp->cbd_sc |= BD_SC_WRAP; 834 + bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); 837 835 838 836 rxq->cur_rx = rxq->rx_bd_base; 839 837 } ··· 846 844 847 845 for (i = 0; i < txq->tx_ring_size; i++) { 848 846 /* Initialize the BD for every fragment in the page. */ 849 - bdp->cbd_sc = 0; 847 + bdp->cbd_sc = cpu_to_fec16(0); 850 848 if (txq->tx_skbuff[i]) { 851 849 dev_kfree_skb_any(txq->tx_skbuff[i]); 852 850 txq->tx_skbuff[i] = NULL; 853 851 } 854 - bdp->cbd_bufaddr = 0; 852 + bdp->cbd_bufaddr = cpu_to_fec32(0); 855 853 bdp = fec_enet_get_nextdesc(bdp, fep, q); 856 854 } 857 855 858 856 /* Set the last buffer to wrap */ 859 857 bdp = fec_enet_get_prevdesc(bdp, fep, q); 860 - bdp->cbd_sc |= BD_SC_WRAP; 858 + bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); 861 859 txq->dirty_tx = bdp; 862 860 } 863 861 } ··· 949 947 */ 950 948 if (fep->quirks & FEC_QUIRK_ENET_MAC) { 951 949 memcpy(&temp_mac, ndev->dev_addr, ETH_ALEN); 952 - writel(cpu_to_be32(temp_mac[0]), fep->hwp + FEC_ADDR_LOW); 953 - writel(cpu_to_be32(temp_mac[1]), fep->hwp + FEC_ADDR_HIGH); 950 + writel((__force u32)cpu_to_be32(temp_mac[0]), 951 + fep->hwp + FEC_ADDR_LOW); 952 + writel((__force u32)cpu_to_be32(temp_mac[1]), 953 + fep->hwp + FEC_ADDR_HIGH); 954 954 } 955 955 956 956 /* Clear any outstanding interrupt. */ ··· 1226 1222 while (bdp != READ_ONCE(txq->cur_tx)) { 1227 1223 /* Order the load of cur_tx and cbd_sc */ 1228 1224 rmb(); 1229 - status = READ_ONCE(bdp->cbd_sc); 1225 + status = fec16_to_cpu(READ_ONCE(bdp->cbd_sc)); 1230 1226 if (status & BD_ENET_TX_READY) 1231 1227 break; 1232 1228 ··· 1234 1230 1235 1231 skb = txq->tx_skbuff[index]; 1236 1232 txq->tx_skbuff[index] = NULL; 1237 - if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr)) 1238 - dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, 1239 - bdp->cbd_datlen, DMA_TO_DEVICE); 1240 - bdp->cbd_bufaddr = 0; 1233 + if (!IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr))) 1234 + dma_unmap_single(&fep->pdev->dev, 1235 + fec32_to_cpu(bdp->cbd_bufaddr), 1236 + fec16_to_cpu(bdp->cbd_datlen), 1237 + DMA_TO_DEVICE); 1238 + bdp->cbd_bufaddr = cpu_to_fec32(0); 1241 1239 if (!skb) { 1242 1240 bdp = fec_enet_get_nextdesc(bdp, fep, queue_id); 1243 1241 continue; ··· 1270 1264 struct skb_shared_hwtstamps shhwtstamps; 1271 1265 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; 1272 1266 1273 - fec_enet_hwtstamp(fep, ebdp->ts, &shhwtstamps); 1267 + fec_enet_hwtstamp(fep, fec32_to_cpu(ebdp->ts), &shhwtstamps); 1274 1268 skb_tstamp_tx(skb, &shhwtstamps); 1275 1269 } 1276 1270 ··· 1330 1324 if (off) 1331 1325 skb_reserve(skb, fep->rx_align + 1 - off); 1332 1326 1333 - bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, skb->data, 1334 - FEC_ENET_RX_FRSIZE - fep->rx_align, 1335 - DMA_FROM_DEVICE); 1336 - if (dma_mapping_error(&fep->pdev->dev, bdp->cbd_bufaddr)) { 1327 + bdp->cbd_bufaddr = cpu_to_fec32(dma_map_single(&fep->pdev->dev, skb->data, FEC_ENET_RX_FRSIZE - fep->rx_align, DMA_FROM_DEVICE)); 1328 + if (dma_mapping_error(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr))) { 1337 1329 if (net_ratelimit()) 1338 1330 netdev_err(ndev, "Rx DMA memory map failed\n"); 1339 1331 return -ENOMEM; ··· 1353 1349 if (!new_skb) 1354 1350 return false; 1355 1351 1356 - dma_sync_single_for_cpu(&fep->pdev->dev, bdp->cbd_bufaddr, 1352 + dma_sync_single_for_cpu(&fep->pdev->dev, 1353 + fec32_to_cpu(bdp->cbd_bufaddr), 1357 1354 FEC_ENET_RX_FRSIZE - fep->rx_align, 1358 1355 DMA_FROM_DEVICE); 1359 1356 if (!swap) ··· 1401 1396 */ 1402 1397 bdp = rxq->cur_rx; 1403 1398 1404 - while (!((status = bdp->cbd_sc) & BD_ENET_RX_EMPTY)) { 1399 + while (!((status = fec16_to_cpu(bdp->cbd_sc)) & BD_ENET_RX_EMPTY)) { 1405 1400 1406 1401 if (pkt_received >= budget) 1407 1402 break; ··· 1443 1438 1444 1439 /* Process the incoming frame. */ 1445 1440 ndev->stats.rx_packets++; 1446 - pkt_len = bdp->cbd_datlen; 1441 + pkt_len = fec16_to_cpu(bdp->cbd_datlen); 1447 1442 ndev->stats.rx_bytes += pkt_len; 1448 1443 1449 1444 index = fec_enet_get_bd_index(rxq->rx_bd_base, bdp, fep); ··· 1461 1456 ndev->stats.rx_dropped++; 1462 1457 goto rx_processing_done; 1463 1458 } 1464 - dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, 1459 + dma_unmap_single(&fep->pdev->dev, 1460 + fec32_to_cpu(bdp->cbd_bufaddr), 1465 1461 FEC_ENET_RX_FRSIZE - fep->rx_align, 1466 1462 DMA_FROM_DEVICE); 1467 1463 } ··· 1481 1475 /* If this is a VLAN packet remove the VLAN Tag */ 1482 1476 vlan_packet_rcvd = false; 1483 1477 if ((ndev->features & NETIF_F_HW_VLAN_CTAG_RX) && 1484 - fep->bufdesc_ex && (ebdp->cbd_esc & BD_ENET_RX_VLAN)) { 1478 + fep->bufdesc_ex && 1479 + (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) { 1485 1480 /* Push and remove the vlan tag */ 1486 1481 struct vlan_hdr *vlan_header = 1487 1482 (struct vlan_hdr *) (data + ETH_HLEN); ··· 1498 1491 1499 1492 /* Get receive timestamp from the skb */ 1500 1493 if (fep->hwts_rx_en && fep->bufdesc_ex) 1501 - fec_enet_hwtstamp(fep, ebdp->ts, 1494 + fec_enet_hwtstamp(fep, fec32_to_cpu(ebdp->ts), 1502 1495 skb_hwtstamps(skb)); 1503 1496 1504 1497 if (fep->bufdesc_ex && 1505 1498 (fep->csum_flags & FLAG_RX_CSUM_ENABLED)) { 1506 - if (!(ebdp->cbd_esc & FLAG_RX_CSUM_ERROR)) { 1499 + if (!(ebdp->cbd_esc & cpu_to_fec32(FLAG_RX_CSUM_ERROR))) { 1507 1500 /* don't check it */ 1508 1501 skb->ip_summed = CHECKSUM_UNNECESSARY; 1509 1502 } else { ··· 1520 1513 napi_gro_receive(&fep->napi, skb); 1521 1514 1522 1515 if (is_copybreak) { 1523 - dma_sync_single_for_device(&fep->pdev->dev, bdp->cbd_bufaddr, 1516 + dma_sync_single_for_device(&fep->pdev->dev, 1517 + fec32_to_cpu(bdp->cbd_bufaddr), 1524 1518 FEC_ENET_RX_FRSIZE - fep->rx_align, 1525 1519 DMA_FROM_DEVICE); 1526 1520 } else { ··· 1535 1527 1536 1528 /* Mark the buffer empty */ 1537 1529 status |= BD_ENET_RX_EMPTY; 1538 - bdp->cbd_sc = status; 1530 + bdp->cbd_sc = cpu_to_fec16(status); 1539 1531 1540 1532 if (fep->bufdesc_ex) { 1541 1533 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; 1542 1534 1543 - ebdp->cbd_esc = BD_ENET_RX_INT; 1535 + ebdp->cbd_esc = cpu_to_fec32(BD_ENET_RX_INT); 1544 1536 ebdp->cbd_prot = 0; 1545 1537 ebdp->cbd_bdu = 0; 1546 1538 } ··· 2153 2145 2154 2146 /* List of registers that can be safety be read to dump them with ethtool */ 2155 2147 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ 2156 - defined(CONFIG_M520x) || defined(CONFIG_M532x) || \ 2157 - defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28) 2148 + defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) 2158 2149 static u32 fec_enet_register_offset[] = { 2159 2150 FEC_IEVENT, FEC_IMASK, FEC_R_DES_ACTIVE_0, FEC_X_DES_ACTIVE_0, 2160 2151 FEC_ECNTRL, FEC_MII_DATA, FEC_MII_SPEED, FEC_MIB_CTRLSTAT, FEC_R_CNTRL, ··· 2669 2662 rxq->rx_skbuff[i] = NULL; 2670 2663 if (skb) { 2671 2664 dma_unmap_single(&fep->pdev->dev, 2672 - bdp->cbd_bufaddr, 2665 + fec32_to_cpu(bdp->cbd_bufaddr), 2673 2666 FEC_ENET_RX_FRSIZE - fep->rx_align, 2674 2667 DMA_FROM_DEVICE); 2675 2668 dev_kfree_skb(skb); ··· 2784 2777 } 2785 2778 2786 2779 rxq->rx_skbuff[i] = skb; 2787 - bdp->cbd_sc = BD_ENET_RX_EMPTY; 2780 + bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); 2788 2781 2789 2782 if (fep->bufdesc_ex) { 2790 2783 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; 2791 - ebdp->cbd_esc = BD_ENET_RX_INT; 2784 + ebdp->cbd_esc = cpu_to_fec32(BD_ENET_RX_INT); 2792 2785 } 2793 2786 2794 2787 bdp = fec_enet_get_nextdesc(bdp, fep, queue); ··· 2796 2789 2797 2790 /* Set the last buffer to wrap. */ 2798 2791 bdp = fec_enet_get_prevdesc(bdp, fep, queue); 2799 - bdp->cbd_sc |= BD_SC_WRAP; 2792 + bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); 2800 2793 return 0; 2801 2794 2802 2795 err_alloc: ··· 2819 2812 if (!txq->tx_bounce[i]) 2820 2813 goto err_alloc; 2821 2814 2822 - bdp->cbd_sc = 0; 2823 - bdp->cbd_bufaddr = 0; 2815 + bdp->cbd_sc = cpu_to_fec16(0); 2816 + bdp->cbd_bufaddr = cpu_to_fec32(0); 2824 2817 2825 2818 if (fep->bufdesc_ex) { 2826 2819 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; 2827 - ebdp->cbd_esc = BD_ENET_TX_INT; 2820 + ebdp->cbd_esc = cpu_to_fec32(BD_ENET_TX_INT); 2828 2821 } 2829 2822 2830 2823 bdp = fec_enet_get_nextdesc(bdp, fep, queue); ··· 2832 2825 2833 2826 /* Set the last buffer to wrap. */ 2834 2827 bdp = fec_enet_get_prevdesc(bdp, fep, queue); 2835 - bdp->cbd_sc |= BD_SC_WRAP; 2828 + bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); 2836 2829 2837 2830 return 0; 2838 2831
+1 -1
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
··· 552 552 cbd_t __iomem *prev_bd; 553 553 cbd_t __iomem *last_tx_bd; 554 554 555 - last_tx_bd = fep->tx_bd_base + ((fpi->tx_ring - 1) * sizeof(cbd_t)); 555 + last_tx_bd = fep->tx_bd_base + (fpi->tx_ring - 1); 556 556 557 557 /* get the current bd held in TBPTR and scan back from this point */ 558 558 recheck_bd = curr_tbptr = (cbd_t __iomem *)
+7 -10
drivers/net/ethernet/hisilicon/hns/hnae.c
··· 95 95 static int __ae_match(struct device *dev, const void *data) 96 96 { 97 97 struct hnae_ae_dev *hdev = cls_to_ae_dev(dev); 98 - const char *ae_id = data; 99 98 100 - if (!strncmp(ae_id, hdev->name, AE_NAME_SIZE)) 101 - return 1; 102 - 103 - return 0; 99 + return hdev->dev->of_node == data; 104 100 } 105 101 106 - static struct hnae_ae_dev *find_ae(const char *ae_id) 102 + static struct hnae_ae_dev *find_ae(const struct device_node *ae_node) 107 103 { 108 104 struct device *dev; 109 105 110 - WARN_ON(!ae_id); 106 + WARN_ON(!ae_node); 111 107 112 - dev = class_find_device(hnae_class, NULL, ae_id, __ae_match); 108 + dev = class_find_device(hnae_class, NULL, ae_node, __ae_match); 113 109 114 110 return dev ? cls_to_ae_dev(dev) : NULL; 115 111 } ··· 312 316 * return handle ptr or ERR_PTR 313 317 */ 314 318 struct hnae_handle *hnae_get_handle(struct device *owner_dev, 315 - const char *ae_id, u32 port_id, 319 + const struct device_node *ae_node, 320 + u32 port_id, 316 321 struct hnae_buf_ops *bops) 317 322 { 318 323 struct hnae_ae_dev *dev; ··· 321 324 int i, j; 322 325 int ret; 323 326 324 - dev = find_ae(ae_id); 327 + dev = find_ae(ae_node); 325 328 if (!dev) 326 329 return ERR_PTR(-ENODEV); 327 330
+5 -2
drivers/net/ethernet/hisilicon/hns/hnae.h
··· 524 524 525 525 #define ring_to_dev(ring) ((ring)->q->dev->dev) 526 526 527 - struct hnae_handle *hnae_get_handle(struct device *owner_dev, const char *ae_id, 528 - u32 port_id, struct hnae_buf_ops *bops); 527 + struct hnae_handle *hnae_get_handle(struct device *owner_dev, 528 + const struct device_node *ae_node, 529 + u32 port_id, 530 + struct hnae_buf_ops *bops); 531 + 529 532 void hnae_put_handle(struct hnae_handle *handle); 530 533 int hnae_ae_register(struct hnae_ae_dev *dev, struct module *owner); 531 534 void hnae_ae_unregister(struct hnae_ae_dev *dev);
+4
drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
··· 847 847 int hns_dsaf_ae_init(struct dsaf_device *dsaf_dev) 848 848 { 849 849 struct hnae_ae_dev *ae_dev = &dsaf_dev->ae_dev; 850 + static atomic_t id = ATOMIC_INIT(-1); 850 851 851 852 switch (dsaf_dev->dsaf_ver) { 852 853 case AE_VERSION_1: ··· 859 858 default: 860 859 break; 861 860 } 861 + 862 + snprintf(ae_dev->name, AE_NAME_SIZE, "%s%d", DSAF_DEVICE_NAME, 863 + (int)atomic_inc_return(&id)); 862 864 ae_dev->ops = &hns_dsaf_ops; 863 865 ae_dev->dev = dsaf_dev->dev; 864 866
+1 -9
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
··· 35 35 int ret, i; 36 36 u32 desc_num; 37 37 u32 buf_size; 38 - const char *name, *mode_str; 38 + const char *mode_str; 39 39 struct device_node *np = dsaf_dev->dev->of_node; 40 40 41 41 if (of_device_is_compatible(np, "hisilicon,hns-dsaf-v1")) 42 42 dsaf_dev->dsaf_ver = AE_VERSION_1; 43 43 else 44 44 dsaf_dev->dsaf_ver = AE_VERSION_2; 45 - 46 - ret = of_property_read_string(np, "dsa_name", &name); 47 - if (ret) { 48 - dev_err(dsaf_dev->dev, "get dsaf name fail, ret=%d!\n", ret); 49 - return ret; 50 - } 51 - strncpy(dsaf_dev->ae_dev.name, name, AE_NAME_SIZE); 52 - dsaf_dev->ae_dev.name[AE_NAME_SIZE - 1] = '\0'; 53 45 54 46 ret = of_property_read_string(np, "mode", &mode_str); 55 47 if (ret) {
+1
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
··· 18 18 19 19 #define DSAF_DRV_NAME "hns_dsaf" 20 20 #define DSAF_MOD_VERSION "v1.0" 21 + #define DSAF_DEVICE_NAME "dsaf" 21 22 22 23 #define HNS_DSAF_DEBUG_NW_REG_OFFSET 0x100000 23 24
+9 -6
drivers/net/ethernet/hisilicon/hns/hns_enet.c
··· 1802 1802 int ret; 1803 1803 1804 1804 h = hnae_get_handle(&priv->netdev->dev, 1805 - priv->ae_name, priv->port_id, NULL); 1805 + priv->ae_node, priv->port_id, NULL); 1806 1806 if (IS_ERR_OR_NULL(h)) { 1807 1807 ret = PTR_ERR(h); 1808 1808 dev_dbg(priv->dev, "has not handle, register notifier!\n"); ··· 1880 1880 else 1881 1881 priv->enet_ver = AE_VERSION_2; 1882 1882 1883 - ret = of_property_read_string(node, "ae-name", &priv->ae_name); 1884 - if (ret) 1885 - goto out_read_string_fail; 1883 + priv->ae_node = (void *)of_parse_phandle(node, "ae-handle", 0); 1884 + if (IS_ERR_OR_NULL(priv->ae_node)) { 1885 + ret = PTR_ERR(priv->ae_node); 1886 + dev_err(dev, "not find ae-handle\n"); 1887 + goto out_read_prop_fail; 1888 + } 1886 1889 1887 1890 ret = of_property_read_u32(node, "port-id", &priv->port_id); 1888 1891 if (ret) 1889 - goto out_read_string_fail; 1892 + goto out_read_prop_fail; 1890 1893 1891 1894 hns_init_mac_addr(ndev); 1892 1895 ··· 1948 1945 1949 1946 out_notify_fail: 1950 1947 (void)cancel_work_sync(&priv->service_task); 1951 - out_read_string_fail: 1948 + out_read_prop_fail: 1952 1949 free_netdev(ndev); 1953 1950 return ret; 1954 1951 }
+1 -1
drivers/net/ethernet/hisilicon/hns/hns_enet.h
··· 51 51 }; 52 52 53 53 struct hns_nic_priv { 54 - const char *ae_name; 54 + const struct device_node *ae_node; 55 55 u32 enet_ver; 56 56 u32 port_id; 57 57 int phy_mode;
-18
drivers/net/ethernet/hp/hp100.c
··· 194 194 }; 195 195 #endif 196 196 197 - #ifdef CONFIG_EISA 198 197 static struct eisa_device_id hp100_eisa_tbl[] = { 199 198 { "HWPF180" }, /* HP J2577 rev A */ 200 199 { "HWP1920" }, /* HP 27248B */ ··· 204 205 { "" } /* Mandatory final entry ! */ 205 206 }; 206 207 MODULE_DEVICE_TABLE(eisa, hp100_eisa_tbl); 207 - #endif 208 208 209 - #ifdef CONFIG_PCI 210 209 static const struct pci_device_id hp100_pci_tbl[] = { 211 210 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585A, PCI_ANY_ID, PCI_ANY_ID,}, 212 211 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585B, PCI_ANY_ID, PCI_ANY_ID,}, ··· 216 219 {} /* Terminating entry */ 217 220 }; 218 221 MODULE_DEVICE_TABLE(pci, hp100_pci_tbl); 219 - #endif 220 222 221 223 static int hp100_rx_ratio = HP100_DEFAULT_RX_RATIO; 222 224 static int hp100_priority_tx = HP100_DEFAULT_PRIORITY_TX; ··· 2838 2842 free_netdev(d); 2839 2843 } 2840 2844 2841 - #ifdef CONFIG_EISA 2842 2845 static int hp100_eisa_probe(struct device *gendev) 2843 2846 { 2844 2847 struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private)); ··· 2879 2884 .remove = hp100_eisa_remove, 2880 2885 } 2881 2886 }; 2882 - #endif 2883 2887 2884 - #ifdef CONFIG_PCI 2885 2888 static int hp100_pci_probe(struct pci_dev *pdev, 2886 2889 const struct pci_device_id *ent) 2887 2890 { ··· 2948 2955 .probe = hp100_pci_probe, 2949 2956 .remove = hp100_pci_remove, 2950 2957 }; 2951 - #endif 2952 2958 2953 2959 /* 2954 2960 * module section ··· 3024 3032 err = hp100_isa_init(); 3025 3033 if (err && err != -ENODEV) 3026 3034 goto out; 3027 - #ifdef CONFIG_EISA 3028 3035 err = eisa_driver_register(&hp100_eisa_driver); 3029 3036 if (err && err != -ENODEV) 3030 3037 goto out2; 3031 - #endif 3032 - #ifdef CONFIG_PCI 3033 3038 err = pci_register_driver(&hp100_pci_driver); 3034 3039 if (err && err != -ENODEV) 3035 3040 goto out3; 3036 - #endif 3037 3041 out: 3038 3042 return err; 3039 3043 out3: 3040 - #ifdef CONFIG_EISA 3041 3044 eisa_driver_unregister (&hp100_eisa_driver); 3042 3045 out2: 3043 - #endif 3044 3046 hp100_isa_cleanup(); 3045 3047 goto out; 3046 3048 } ··· 3043 3057 static void __exit hp100_module_exit(void) 3044 3058 { 3045 3059 hp100_isa_cleanup(); 3046 - #ifdef CONFIG_EISA 3047 3060 eisa_driver_unregister (&hp100_eisa_driver); 3048 - #endif 3049 - #ifdef CONFIG_PCI 3050 3061 pci_unregister_driver (&hp100_pci_driver); 3051 - #endif 3052 3062 } 3053 3063 3054 3064 module_init(hp100_module_init)
+5 -10
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 7117 7117 i40e_watchdog_subtask(pf); 7118 7118 i40e_fdir_reinit_subtask(pf); 7119 7119 i40e_sync_filters_subtask(pf); 7120 - #if IS_ENABLED(CONFIG_VXLAN) || IS_ENABLED(CONFIG_GENEVE) 7121 7120 i40e_sync_udp_filters_subtask(pf); 7122 - #endif 7123 7121 i40e_clean_adminq_subtask(pf); 7124 7122 7125 7123 i40e_service_event_complete(pf); ··· 8513 8515 } 8514 8516 8515 8517 #endif 8518 + 8519 + #if IS_ENABLED(CONFIG_VXLAN) 8516 8520 /** 8517 8521 * i40e_add_vxlan_port - Get notifications about VXLAN ports that come up 8518 8522 * @netdev: This physical port's netdev ··· 8524 8524 static void i40e_add_vxlan_port(struct net_device *netdev, 8525 8525 sa_family_t sa_family, __be16 port) 8526 8526 { 8527 - #if IS_ENABLED(CONFIG_VXLAN) 8528 8527 struct i40e_netdev_priv *np = netdev_priv(netdev); 8529 8528 struct i40e_vsi *vsi = np->vsi; 8530 8529 struct i40e_pf *pf = vsi->back; ··· 8556 8557 pf->udp_ports[next_idx].type = I40E_AQC_TUNNEL_TYPE_VXLAN; 8557 8558 pf->pending_udp_bitmap |= BIT_ULL(next_idx); 8558 8559 pf->flags |= I40E_FLAG_UDP_FILTER_SYNC; 8559 - #endif 8560 8560 } 8561 8561 8562 8562 /** ··· 8567 8569 static void i40e_del_vxlan_port(struct net_device *netdev, 8568 8570 sa_family_t sa_family, __be16 port) 8569 8571 { 8570 - #if IS_ENABLED(CONFIG_VXLAN) 8571 8572 struct i40e_netdev_priv *np = netdev_priv(netdev); 8572 8573 struct i40e_vsi *vsi = np->vsi; 8573 8574 struct i40e_pf *pf = vsi->back; ··· 8589 8592 netdev_warn(netdev, "vxlan port %d was not found, not deleting\n", 8590 8593 ntohs(port)); 8591 8594 } 8592 - #endif 8593 8595 } 8596 + #endif 8594 8597 8598 + #if IS_ENABLED(CONFIG_GENEVE) 8595 8599 /** 8596 8600 * i40e_add_geneve_port - Get notifications about GENEVE ports that come up 8597 8601 * @netdev: This physical port's netdev ··· 8602 8604 static void i40e_add_geneve_port(struct net_device *netdev, 8603 8605 sa_family_t sa_family, __be16 port) 8604 8606 { 8605 - #if IS_ENABLED(CONFIG_GENEVE) 8606 8607 struct i40e_netdev_priv *np = netdev_priv(netdev); 8607 8608 struct i40e_vsi *vsi = np->vsi; 8608 8609 struct i40e_pf *pf = vsi->back; ··· 8636 8639 pf->flags |= I40E_FLAG_UDP_FILTER_SYNC; 8637 8640 8638 8641 dev_info(&pf->pdev->dev, "adding geneve port %d\n", ntohs(port)); 8639 - #endif 8640 8642 } 8641 8643 8642 8644 /** ··· 8647 8651 static void i40e_del_geneve_port(struct net_device *netdev, 8648 8652 sa_family_t sa_family, __be16 port) 8649 8653 { 8650 - #if IS_ENABLED(CONFIG_GENEVE) 8651 8654 struct i40e_netdev_priv *np = netdev_priv(netdev); 8652 8655 struct i40e_vsi *vsi = np->vsi; 8653 8656 struct i40e_pf *pf = vsi->back; ··· 8672 8677 netdev_warn(netdev, "geneve port %d was not found, not deleting\n", 8673 8678 ntohs(port)); 8674 8679 } 8675 - #endif 8676 8680 } 8681 + #endif 8677 8682 8678 8683 static int i40e_get_phys_port_id(struct net_device *netdev, 8679 8684 struct netdev_phys_item_id *ppid)
+2 -2
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 2313 2313 struct iphdr *this_ip_hdr; 2314 2314 u32 network_hdr_len; 2315 2315 u8 l4_hdr = 0; 2316 - struct udphdr *oudph; 2317 - struct iphdr *oiph; 2316 + struct udphdr *oudph = NULL; 2317 + struct iphdr *oiph = NULL; 2318 2318 u32 l4_tunnel = 0; 2319 2319 2320 2320 if (skb->encapsulation) {
+2 -2
drivers/net/ethernet/marvell/mv643xx_eth.c
··· 762 762 763 763 if (length <= 8 && (uintptr_t)data & 0x7) { 764 764 /* Copy unaligned small data fragment to TSO header data area */ 765 - memcpy(txq->tso_hdrs + txq->tx_curr_desc * TSO_HEADER_SIZE, 765 + memcpy(txq->tso_hdrs + tx_index * TSO_HEADER_SIZE, 766 766 data, length); 767 767 desc->buf_ptr = txq->tso_hdrs_dma 768 - + txq->tx_curr_desc * TSO_HEADER_SIZE; 768 + + tx_index * TSO_HEADER_SIZE; 769 769 } else { 770 770 /* Alignment is okay, map buffer and hand off to hardware */ 771 771 txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_SINGLE;
+28 -19
drivers/net/ethernet/marvell/mvneta.c
··· 11 11 * warranty of any kind, whether express or implied. 12 12 */ 13 13 14 - #include <linux/kernel.h> 15 - #include <linux/netdevice.h> 14 + #include <linux/clk.h> 15 + #include <linux/cpu.h> 16 16 #include <linux/etherdevice.h> 17 - #include <linux/platform_device.h> 18 - #include <linux/skbuff.h> 17 + #include <linux/if_vlan.h> 19 18 #include <linux/inetdevice.h> 19 + #include <linux/interrupt.h> 20 + #include <linux/io.h> 21 + #include <linux/kernel.h> 20 22 #include <linux/mbus.h> 21 23 #include <linux/module.h> 22 - #include <linux/interrupt.h> 23 - #include <linux/if_vlan.h> 24 - #include <net/ip.h> 25 - #include <net/ipv6.h> 26 - #include <linux/io.h> 27 - #include <net/tso.h> 24 + #include <linux/netdevice.h> 28 25 #include <linux/of.h> 26 + #include <linux/of_address.h> 29 27 #include <linux/of_irq.h> 30 28 #include <linux/of_mdio.h> 31 29 #include <linux/of_net.h> 32 - #include <linux/of_address.h> 33 30 #include <linux/phy.h> 34 - #include <linux/clk.h> 35 - #include <linux/cpu.h> 31 + #include <linux/platform_device.h> 32 + #include <linux/skbuff.h> 33 + #include <net/ip.h> 34 + #include <net/ipv6.h> 35 + #include <net/tso.h> 36 36 37 37 /* Registers */ 38 38 #define MVNETA_RXQ_CONFIG_REG(q) (0x1400 + ((q) << 2)) ··· 373 373 374 374 /* Core clock */ 375 375 struct clk *clk; 376 + /* AXI clock */ 377 + struct clk *clk_bus; 376 378 u8 mcast_count[256]; 377 379 u16 tx_ring_size; 378 380 u16 rx_ring_size; ··· 3244 3242 const struct mvneta_statistic *s; 3245 3243 void __iomem *base = pp->base; 3246 3244 u32 high, low, val; 3245 + u64 val64; 3247 3246 int i; 3248 3247 3249 3248 for (i = 0, s = mvneta_statistics; 3250 3249 s < mvneta_statistics + ARRAY_SIZE(mvneta_statistics); 3251 3250 s++, i++) { 3252 - val = 0; 3253 - 3254 3251 switch (s->type) { 3255 3252 case T_REG_32: 3256 3253 val = readl_relaxed(base + s->offset); 3254 + pp->ethtool_stats[i] += val; 3257 3255 break; 3258 3256 case T_REG_64: 3259 3257 /* Docs say to read low 32-bit then high */ 3260 3258 low = readl_relaxed(base + s->offset); 3261 3259 high = readl_relaxed(base + s->offset + 4); 3262 - val = (u64)high << 32 | low; 3260 + val64 = (u64)high << 32 | low; 3261 + pp->ethtool_stats[i] += val64; 3263 3262 break; 3264 3263 } 3265 - 3266 - pp->ethtool_stats[i] += val; 3267 3264 } 3268 3265 } 3269 3266 ··· 3606 3605 3607 3606 pp->indir[0] = rxq_def; 3608 3607 3609 - pp->clk = devm_clk_get(&pdev->dev, NULL); 3608 + pp->clk = devm_clk_get(&pdev->dev, "core"); 3609 + if (IS_ERR(pp->clk)) 3610 + pp->clk = devm_clk_get(&pdev->dev, NULL); 3610 3611 if (IS_ERR(pp->clk)) { 3611 3612 err = PTR_ERR(pp->clk); 3612 3613 goto err_put_phy_node; 3613 3614 } 3614 3615 3615 3616 clk_prepare_enable(pp->clk); 3617 + 3618 + pp->clk_bus = devm_clk_get(&pdev->dev, "bus"); 3619 + if (!IS_ERR(pp->clk_bus)) 3620 + clk_prepare_enable(pp->clk_bus); 3616 3621 3617 3622 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 3618 3623 pp->base = devm_ioremap_resource(&pdev->dev, res); ··· 3731 3724 err_free_ports: 3732 3725 free_percpu(pp->ports); 3733 3726 err_clk: 3727 + clk_disable_unprepare(pp->clk_bus); 3734 3728 clk_disable_unprepare(pp->clk); 3735 3729 err_put_phy_node: 3736 3730 of_node_put(phy_node); ··· 3749 3741 struct mvneta_port *pp = netdev_priv(dev); 3750 3742 3751 3743 unregister_netdev(dev); 3744 + clk_disable_unprepare(pp->clk_bus); 3752 3745 clk_disable_unprepare(pp->clk); 3753 3746 free_percpu(pp->ports); 3754 3747 free_percpu(pp->stats);
+91 -3
drivers/net/ethernet/mellanox/mlxsw/reg.h
··· 1044 1044 mlxsw_reg_sftr_port_mask_set(payload, port, 1); 1045 1045 } 1046 1046 1047 + /* SFDF - Switch Filtering DB Flush 1048 + * -------------------------------- 1049 + * The switch filtering DB flush register is used to flush the FDB. 1050 + * Note that FDB notifications are flushed as well. 1051 + */ 1052 + #define MLXSW_REG_SFDF_ID 0x2013 1053 + #define MLXSW_REG_SFDF_LEN 0x14 1054 + 1055 + static const struct mlxsw_reg_info mlxsw_reg_sfdf = { 1056 + .id = MLXSW_REG_SFDF_ID, 1057 + .len = MLXSW_REG_SFDF_LEN, 1058 + }; 1059 + 1060 + /* reg_sfdf_swid 1061 + * Switch partition ID. 1062 + * Access: Index 1063 + */ 1064 + MLXSW_ITEM32(reg, sfdf, swid, 0x00, 24, 8); 1065 + 1066 + enum mlxsw_reg_sfdf_flush_type { 1067 + MLXSW_REG_SFDF_FLUSH_PER_SWID, 1068 + MLXSW_REG_SFDF_FLUSH_PER_FID, 1069 + MLXSW_REG_SFDF_FLUSH_PER_PORT, 1070 + MLXSW_REG_SFDF_FLUSH_PER_PORT_AND_FID, 1071 + MLXSW_REG_SFDF_FLUSH_PER_LAG, 1072 + MLXSW_REG_SFDF_FLUSH_PER_LAG_AND_FID, 1073 + }; 1074 + 1075 + /* reg_sfdf_flush_type 1076 + * Flush type. 1077 + * 0 - All SWID dynamic entries are flushed. 1078 + * 1 - All FID dynamic entries are flushed. 1079 + * 2 - All dynamic entries pointing to port are flushed. 1080 + * 3 - All FID dynamic entries pointing to port are flushed. 1081 + * 4 - All dynamic entries pointing to LAG are flushed. 1082 + * 5 - All FID dynamic entries pointing to LAG are flushed. 1083 + * Access: RW 1084 + */ 1085 + MLXSW_ITEM32(reg, sfdf, flush_type, 0x04, 28, 4); 1086 + 1087 + /* reg_sfdf_flush_static 1088 + * Static. 1089 + * 0 - Flush only dynamic entries. 1090 + * 1 - Flush both dynamic and static entries. 1091 + * Access: RW 1092 + */ 1093 + MLXSW_ITEM32(reg, sfdf, flush_static, 0x04, 24, 1); 1094 + 1095 + static inline void mlxsw_reg_sfdf_pack(char *payload, 1096 + enum mlxsw_reg_sfdf_flush_type type) 1097 + { 1098 + MLXSW_REG_ZERO(sfdf, payload); 1099 + mlxsw_reg_sfdf_flush_type_set(payload, type); 1100 + mlxsw_reg_sfdf_flush_static_set(payload, true); 1101 + } 1102 + 1103 + /* reg_sfdf_fid 1104 + * FID to flush. 1105 + * Access: RW 1106 + */ 1107 + MLXSW_ITEM32(reg, sfdf, fid, 0x0C, 0, 16); 1108 + 1109 + /* reg_sfdf_system_port 1110 + * Port to flush. 1111 + * Access: RW 1112 + */ 1113 + MLXSW_ITEM32(reg, sfdf, system_port, 0x0C, 0, 16); 1114 + 1115 + /* reg_sfdf_port_fid_system_port 1116 + * Port to flush, pointed to by FID. 1117 + * Access: RW 1118 + */ 1119 + MLXSW_ITEM32(reg, sfdf, port_fid_system_port, 0x08, 0, 16); 1120 + 1121 + /* reg_sfdf_lag_id 1122 + * LAG ID to flush. 1123 + * Access: RW 1124 + */ 1125 + MLXSW_ITEM32(reg, sfdf, lag_id, 0x0C, 0, 10); 1126 + 1127 + /* reg_sfdf_lag_fid_lag_id 1128 + * LAG ID to flush, pointed to by FID. 1129 + * Access: RW 1130 + */ 1131 + MLXSW_ITEM32(reg, sfdf, lag_fid_lag_id, 0x08, 0, 10); 1132 + 1047 1133 /* SLDR - Switch LAG Descriptor Register 1048 1134 * ----------------------------------------- 1049 1135 * The switch LAG descriptor register is populated by LAG descriptors. ··· 1787 1701 * Module number. 1788 1702 * Access: RW 1789 1703 */ 1790 - MLXSW_ITEM32_INDEXED(reg, pmlp, module, 0x04, 0, 8, 0x04, 0, false); 1704 + MLXSW_ITEM32_INDEXED(reg, pmlp, module, 0x04, 0, 8, 0x04, 0x00, false); 1791 1705 1792 1706 /* reg_pmlp_tx_lane 1793 1707 * Tx Lane. When rxtx field is cleared, this field is used for Rx as well. 1794 1708 * Access: RW 1795 1709 */ 1796 - MLXSW_ITEM32_INDEXED(reg, pmlp, tx_lane, 0x04, 16, 2, 0x04, 16, false); 1710 + MLXSW_ITEM32_INDEXED(reg, pmlp, tx_lane, 0x04, 16, 2, 0x04, 0x00, false); 1797 1711 1798 1712 /* reg_pmlp_rx_lane 1799 1713 * Rx Lane. When rxtx field is cleared, this field is ignored and Rx lane is 1800 1714 * equal to Tx lane. 1801 1715 * Access: RW 1802 1716 */ 1803 - MLXSW_ITEM32_INDEXED(reg, pmlp, rx_lane, 0x04, 24, 2, 0x04, 24, false); 1717 + MLXSW_ITEM32_INDEXED(reg, pmlp, rx_lane, 0x04, 24, 2, 0x04, 0x00, false); 1804 1718 1805 1719 static inline void mlxsw_reg_pmlp_pack(char *payload, u8 local_port) 1806 1720 { ··· 3207 3121 return "SFGC"; 3208 3122 case MLXSW_REG_SFTR_ID: 3209 3123 return "SFTR"; 3124 + case MLXSW_REG_SFDF_ID: 3125 + return "SFDF"; 3210 3126 case MLXSW_REG_SLDR_ID: 3211 3127 return "SLDR"; 3212 3128 case MLXSW_REG_SLCR_ID:
+153 -8
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 1979 1979 .profile = &mlxsw_sp_config_profile, 1980 1980 }; 1981 1981 1982 + static int 1983 + mlxsw_sp_port_fdb_flush_by_port(const struct mlxsw_sp_port *mlxsw_sp_port) 1984 + { 1985 + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 1986 + char sfdf_pl[MLXSW_REG_SFDF_LEN]; 1987 + 1988 + mlxsw_reg_sfdf_pack(sfdf_pl, MLXSW_REG_SFDF_FLUSH_PER_PORT); 1989 + mlxsw_reg_sfdf_system_port_set(sfdf_pl, mlxsw_sp_port->local_port); 1990 + 1991 + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfdf), sfdf_pl); 1992 + } 1993 + 1994 + static int 1995 + mlxsw_sp_port_fdb_flush_by_port_fid(const struct mlxsw_sp_port *mlxsw_sp_port, 1996 + u16 fid) 1997 + { 1998 + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 1999 + char sfdf_pl[MLXSW_REG_SFDF_LEN]; 2000 + 2001 + mlxsw_reg_sfdf_pack(sfdf_pl, MLXSW_REG_SFDF_FLUSH_PER_PORT_AND_FID); 2002 + mlxsw_reg_sfdf_fid_set(sfdf_pl, fid); 2003 + mlxsw_reg_sfdf_port_fid_system_port_set(sfdf_pl, 2004 + mlxsw_sp_port->local_port); 2005 + 2006 + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfdf), sfdf_pl); 2007 + } 2008 + 2009 + static int 2010 + mlxsw_sp_port_fdb_flush_by_lag_id(const struct mlxsw_sp_port *mlxsw_sp_port) 2011 + { 2012 + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 2013 + char sfdf_pl[MLXSW_REG_SFDF_LEN]; 2014 + 2015 + mlxsw_reg_sfdf_pack(sfdf_pl, MLXSW_REG_SFDF_FLUSH_PER_LAG); 2016 + mlxsw_reg_sfdf_lag_id_set(sfdf_pl, mlxsw_sp_port->lag_id); 2017 + 2018 + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfdf), sfdf_pl); 2019 + } 2020 + 2021 + static int 2022 + mlxsw_sp_port_fdb_flush_by_lag_id_fid(const struct mlxsw_sp_port *mlxsw_sp_port, 2023 + u16 fid) 2024 + { 2025 + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 2026 + char sfdf_pl[MLXSW_REG_SFDF_LEN]; 2027 + 2028 + mlxsw_reg_sfdf_pack(sfdf_pl, MLXSW_REG_SFDF_FLUSH_PER_LAG_AND_FID); 2029 + mlxsw_reg_sfdf_fid_set(sfdf_pl, fid); 2030 + mlxsw_reg_sfdf_lag_fid_lag_id_set(sfdf_pl, mlxsw_sp_port->lag_id); 2031 + 2032 + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfdf), sfdf_pl); 2033 + } 2034 + 2035 + static int 2036 + __mlxsw_sp_port_fdb_flush(const struct mlxsw_sp_port *mlxsw_sp_port) 2037 + { 2038 + int err, last_err = 0; 2039 + u16 vid; 2040 + 2041 + for (vid = 1; vid < VLAN_N_VID - 1; vid++) { 2042 + err = mlxsw_sp_port_fdb_flush_by_port_fid(mlxsw_sp_port, vid); 2043 + if (err) 2044 + last_err = err; 2045 + } 2046 + 2047 + return last_err; 2048 + } 2049 + 2050 + static int 2051 + __mlxsw_sp_port_fdb_flush_lagged(const struct mlxsw_sp_port *mlxsw_sp_port) 2052 + { 2053 + int err, last_err = 0; 2054 + u16 vid; 2055 + 2056 + for (vid = 1; vid < VLAN_N_VID - 1; vid++) { 2057 + err = mlxsw_sp_port_fdb_flush_by_lag_id_fid(mlxsw_sp_port, vid); 2058 + if (err) 2059 + last_err = err; 2060 + } 2061 + 2062 + return last_err; 2063 + } 2064 + 2065 + static int mlxsw_sp_port_fdb_flush(struct mlxsw_sp_port *mlxsw_sp_port) 2066 + { 2067 + if (!list_empty(&mlxsw_sp_port->vports_list)) 2068 + if (mlxsw_sp_port->lagged) 2069 + return __mlxsw_sp_port_fdb_flush_lagged(mlxsw_sp_port); 2070 + else 2071 + return __mlxsw_sp_port_fdb_flush(mlxsw_sp_port); 2072 + else 2073 + if (mlxsw_sp_port->lagged) 2074 + return mlxsw_sp_port_fdb_flush_by_lag_id(mlxsw_sp_port); 2075 + else 2076 + return mlxsw_sp_port_fdb_flush_by_port(mlxsw_sp_port); 2077 + } 2078 + 2079 + static int mlxsw_sp_vport_fdb_flush(struct mlxsw_sp_port *mlxsw_sp_vport) 2080 + { 2081 + u16 vfid = mlxsw_sp_vport_vfid_get(mlxsw_sp_vport); 2082 + u16 fid = mlxsw_sp_vfid_to_fid(vfid); 2083 + 2084 + if (mlxsw_sp_vport->lagged) 2085 + return mlxsw_sp_port_fdb_flush_by_lag_id_fid(mlxsw_sp_vport, 2086 + fid); 2087 + else 2088 + return mlxsw_sp_port_fdb_flush_by_port_fid(mlxsw_sp_vport, fid); 2089 + } 2090 + 1982 2091 static bool mlxsw_sp_port_dev_check(const struct net_device *dev) 1983 2092 { 1984 2093 return dev->netdev_ops == &mlxsw_sp_port_netdev_ops; ··· 2115 2006 return 0; 2116 2007 } 2117 2008 2118 - static int mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port) 2009 + static int mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port, 2010 + bool flush_fdb) 2119 2011 { 2120 2012 struct net_device *dev = mlxsw_sp_port->dev; 2013 + 2014 + if (flush_fdb && mlxsw_sp_port_fdb_flush(mlxsw_sp_port)) 2015 + netdev_err(mlxsw_sp_port->dev, "Failed to flush FDB\n"); 2121 2016 2122 2017 mlxsw_sp_port->learning = 0; 2123 2018 mlxsw_sp_port->learning_sync = 0; ··· 2313 2200 return err; 2314 2201 } 2315 2202 2203 + static int mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport, 2204 + struct net_device *br_dev, 2205 + bool flush_fdb); 2206 + 2316 2207 static int mlxsw_sp_port_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port, 2317 2208 struct net_device *lag_dev) 2318 2209 { 2319 2210 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 2211 + struct mlxsw_sp_port *mlxsw_sp_vport; 2320 2212 struct mlxsw_sp_upper *lag; 2321 2213 u16 lag_id = mlxsw_sp_port->lag_id; 2322 2214 int err; ··· 2338 2220 if (err) 2339 2221 return err; 2340 2222 2223 + /* In case we leave a LAG device that has bridges built on top, 2224 + * then their teardown sequence is never issued and we need to 2225 + * invoke the necessary cleanup routines ourselves. 2226 + */ 2227 + list_for_each_entry(mlxsw_sp_vport, &mlxsw_sp_port->vports_list, 2228 + vport.list) { 2229 + struct net_device *br_dev; 2230 + 2231 + if (!mlxsw_sp_vport->bridged) 2232 + continue; 2233 + 2234 + br_dev = mlxsw_sp_vport_br_get(mlxsw_sp_vport); 2235 + mlxsw_sp_vport_bridge_leave(mlxsw_sp_vport, br_dev, false); 2236 + } 2237 + 2238 + if (mlxsw_sp_port->bridged) { 2239 + mlxsw_sp_port_active_vlans_del(mlxsw_sp_port); 2240 + mlxsw_sp_port_bridge_leave(mlxsw_sp_port, false); 2241 + 2242 + if (lag->ref_count == 1) 2243 + mlxsw_sp_master_bridge_dec(mlxsw_sp, NULL); 2244 + } 2245 + 2341 2246 if (lag->ref_count == 1) { 2247 + if (mlxsw_sp_port_fdb_flush_by_lag_id(mlxsw_sp_port)) 2248 + netdev_err(mlxsw_sp_port->dev, "Failed to flush FDB\n"); 2342 2249 err = mlxsw_sp_lag_destroy(mlxsw_sp, lag_id); 2343 2250 if (err) 2344 2251 return err; ··· 2415 2272 return mlxsw_sp_port_lag_tx_en_set(mlxsw_sp_port, info->tx_enabled); 2416 2273 } 2417 2274 2418 - static int mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport, 2419 - struct net_device *br_dev); 2420 - 2421 2275 static int mlxsw_sp_port_vlan_link(struct mlxsw_sp_port *mlxsw_sp_port, 2422 2276 struct net_device *vlan_dev) 2423 2277 { ··· 2452 2312 struct net_device *br_dev; 2453 2313 2454 2314 br_dev = mlxsw_sp_vport_br_get(mlxsw_sp_vport); 2455 - mlxsw_sp_vport_bridge_leave(mlxsw_sp_vport, br_dev); 2315 + mlxsw_sp_vport_bridge_leave(mlxsw_sp_vport, br_dev, true); 2456 2316 } 2457 2317 2458 2318 mlxsw_sp_vport->dev = mlxsw_sp_port->dev; ··· 2514 2374 } 2515 2375 mlxsw_sp_master_bridge_inc(mlxsw_sp, upper_dev); 2516 2376 } else { 2517 - err = mlxsw_sp_port_bridge_leave(mlxsw_sp_port); 2377 + err = mlxsw_sp_port_bridge_leave(mlxsw_sp_port, 2378 + true); 2518 2379 mlxsw_sp_master_bridge_dec(mlxsw_sp, upper_dev); 2519 2380 if (err) { 2520 2381 netdev_err(dev, "Failed to leave bridge\n"); ··· 2682 2541 } 2683 2542 2684 2543 static int mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport, 2685 - struct net_device *br_dev) 2544 + struct net_device *br_dev, 2545 + bool flush_fdb) 2686 2546 { 2687 2547 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_vport->mlxsw_sp; 2688 2548 u16 vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport); ··· 2745 2603 netdev_err(dev, "Failed clear to clear flooding\n"); 2746 2604 goto err_vport_flood_set; 2747 2605 } 2606 + 2607 + if (flush_fdb && mlxsw_sp_vport_fdb_flush(mlxsw_sp_vport)) 2608 + netdev_err(dev, "Failed to flush FDB\n"); 2748 2609 2749 2610 /* Switch between the vFIDs and destroy the old one if needed. */ 2750 2611 new_vfid->nr_vports++; ··· 2922 2777 if (!mlxsw_sp_vport) 2923 2778 return NOTIFY_DONE; 2924 2779 err = mlxsw_sp_vport_bridge_leave(mlxsw_sp_vport, 2925 - upper_dev); 2780 + upper_dev, true); 2926 2781 if (err) { 2927 2782 netdev_err(dev, "Failed to leave bridge\n"); 2928 2783 return NOTIFY_BAD;
+1 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
··· 120 120 } fdb_notify; 121 121 #define MLXSW_SP_DEFAULT_AGEING_TIME 300 122 122 u32 ageing_time; 123 - struct mutex fdb_lock; /* Make sure FDB sessions are atomic. */ 124 123 struct mlxsw_sp_upper master_bridge; 125 124 struct mlxsw_sp_upper lags[MLXSW_SP_LAG_MAX]; 126 125 }; ··· 253 254 __be16 __always_unused proto, u16 vid); 254 255 int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 vfid, 255 256 bool set, bool only_uc); 257 + void mlxsw_sp_port_active_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port); 256 258 257 259 #endif
+51 -34
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
··· 45 45 #include <linux/if_bridge.h> 46 46 #include <linux/workqueue.h> 47 47 #include <linux/jiffies.h> 48 + #include <linux/rtnetlink.h> 48 49 #include <net/switchdev.h> 49 50 50 51 #include "spectrum.h" ··· 125 124 int err; 126 125 127 126 switch (state) { 128 - case BR_STATE_DISABLED: /* fall-through */ 129 127 case BR_STATE_FORWARDING: 130 128 spms_state = MLXSW_REG_SPMS_STATE_FORWARDING; 131 129 break; 132 - case BR_STATE_LISTENING: /* fall-through */ 133 130 case BR_STATE_LEARNING: 134 131 spms_state = MLXSW_REG_SPMS_STATE_LEARNING; 135 132 break; 133 + case BR_STATE_LISTENING: /* fall-through */ 134 + case BR_STATE_DISABLED: /* fall-through */ 136 135 case BR_STATE_BLOCKING: 137 136 spms_state = MLXSW_REG_SPMS_STATE_DISCARDING; 138 137 break; ··· 937 936 vlan->vid_begin, vlan->vid_end, false); 938 937 } 939 938 939 + void mlxsw_sp_port_active_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port) 940 + { 941 + u16 vid; 942 + 943 + for_each_set_bit(vid, mlxsw_sp_port->active_vlans, VLAN_N_VID) 944 + __mlxsw_sp_port_vlans_del(mlxsw_sp_port, vid, vid, false); 945 + } 946 + 940 947 static int 941 948 mlxsw_sp_port_fdb_static_del(struct mlxsw_sp_port *mlxsw_sp_port, 942 949 const struct switchdev_obj_port_fdb *fdb) ··· 1049 1040 1050 1041 static int mlxsw_sp_port_fdb_dump(struct mlxsw_sp_port *mlxsw_sp_port, 1051 1042 struct switchdev_obj_port_fdb *fdb, 1052 - switchdev_obj_dump_cb_t *cb) 1043 + switchdev_obj_dump_cb_t *cb, 1044 + struct net_device *orig_dev) 1053 1045 { 1054 1046 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 1055 - u16 vport_vid = 0, vport_fid = 0; 1047 + struct mlxsw_sp_port *tmp; 1048 + u16 vport_fid = 0; 1056 1049 char *sfd_pl; 1057 1050 char mac[ETH_ALEN]; 1058 1051 u16 fid; ··· 1069 1058 if (!sfd_pl) 1070 1059 return -ENOMEM; 1071 1060 1072 - mutex_lock(&mlxsw_sp_port->mlxsw_sp->fdb_lock); 1073 1061 if (mlxsw_sp_port_is_vport(mlxsw_sp_port)) { 1074 1062 u16 tmp; 1075 1063 1076 1064 tmp = mlxsw_sp_vport_vfid_get(mlxsw_sp_port); 1077 1065 vport_fid = mlxsw_sp_vfid_to_fid(tmp); 1078 - vport_vid = mlxsw_sp_vport_vid_get(mlxsw_sp_port); 1079 1066 } 1080 1067 1081 1068 mlxsw_reg_sfd_pack(sfd_pl, MLXSW_REG_SFD_OP_QUERY_DUMP, 0); ··· 1097 1088 mlxsw_reg_sfd_uc_unpack(sfd_pl, i, mac, &fid, 1098 1089 &local_port); 1099 1090 if (local_port == mlxsw_sp_port->local_port) { 1100 - if (vport_fid && vport_fid != fid) 1101 - continue; 1102 - else if (vport_fid) 1103 - fdb->vid = vport_vid; 1104 - else 1091 + if (vport_fid && vport_fid == fid) 1092 + fdb->vid = 0; 1093 + else if (!vport_fid && 1094 + !mlxsw_sp_fid_is_vfid(fid)) 1105 1095 fdb->vid = fid; 1096 + else 1097 + continue; 1106 1098 ether_addr_copy(fdb->addr, mac); 1107 1099 fdb->ndm_state = NUD_REACHABLE; 1108 1100 err = cb(&fdb->obj); ··· 1114 1104 case MLXSW_REG_SFD_REC_TYPE_UNICAST_LAG: 1115 1105 mlxsw_reg_sfd_uc_lag_unpack(sfd_pl, i, 1116 1106 mac, &fid, &lag_id); 1117 - if (mlxsw_sp_port == 1118 - mlxsw_sp_lag_rep_port(mlxsw_sp, lag_id)) { 1119 - if (vport_fid && vport_fid != fid) 1107 + tmp = mlxsw_sp_lag_rep_port(mlxsw_sp, lag_id); 1108 + if (tmp && tmp->local_port == 1109 + mlxsw_sp_port->local_port) { 1110 + /* LAG records can only point to LAG 1111 + * devices or VLAN devices on top. 1112 + */ 1113 + if (!netif_is_lag_master(orig_dev) && 1114 + !is_vlan_dev(orig_dev)) 1120 1115 continue; 1121 - else if (vport_fid) 1122 - fdb->vid = vport_vid; 1123 - else 1116 + if (vport_fid && vport_fid == fid) 1117 + fdb->vid = 0; 1118 + else if (!vport_fid && 1119 + !mlxsw_sp_fid_is_vfid(fid)) 1124 1120 fdb->vid = fid; 1121 + else 1122 + continue; 1125 1123 ether_addr_copy(fdb->addr, mac); 1126 1124 fdb->ndm_state = NUD_REACHABLE; 1127 1125 err = cb(&fdb->obj); ··· 1142 1124 } while (num_rec == MLXSW_REG_SFD_REC_MAX_COUNT); 1143 1125 1144 1126 out: 1145 - mutex_unlock(&mlxsw_sp_port->mlxsw_sp->fdb_lock); 1146 1127 kfree(sfd_pl); 1147 1128 return stored_err ? stored_err : err; 1148 1129 } ··· 1193 1176 break; 1194 1177 case SWITCHDEV_OBJ_ID_PORT_FDB: 1195 1178 err = mlxsw_sp_port_fdb_dump(mlxsw_sp_port, 1196 - SWITCHDEV_OBJ_PORT_FDB(obj), cb); 1179 + SWITCHDEV_OBJ_PORT_FDB(obj), cb, 1180 + obj->orig_dev); 1197 1181 break; 1198 1182 default: 1199 1183 err = -EOPNOTSUPP; ··· 1212 1194 .switchdev_port_obj_dump = mlxsw_sp_port_obj_dump, 1213 1195 }; 1214 1196 1215 - static void mlxsw_sp_fdb_call_notifiers(bool learning, bool learning_sync, 1216 - bool adding, char *mac, u16 vid, 1197 + static void mlxsw_sp_fdb_call_notifiers(bool learning_sync, bool adding, 1198 + char *mac, u16 vid, 1217 1199 struct net_device *dev) 1218 1200 { 1219 1201 struct switchdev_notifier_fdb_info info; 1220 1202 unsigned long notifier_type; 1221 1203 1222 - if (learning && learning_sync) { 1204 + if (learning_sync) { 1223 1205 info.addr = mac; 1224 1206 info.vid = vid; 1225 1207 notifier_type = adding ? SWITCHDEV_FDB_ADD : SWITCHDEV_FDB_DEL; ··· 1255 1237 netdev_err(mlxsw_sp_port->dev, "Failed to find a matching vPort following FDB notification\n"); 1256 1238 goto just_remove; 1257 1239 } 1258 - vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport); 1240 + vid = 0; 1259 1241 /* Override the physical port with the vPort. */ 1260 1242 mlxsw_sp_port = mlxsw_sp_vport; 1261 1243 } else { ··· 1275 1257 1276 1258 if (!do_notification) 1277 1259 return; 1278 - mlxsw_sp_fdb_call_notifiers(mlxsw_sp_port->learning, 1279 - mlxsw_sp_port->learning_sync, 1260 + mlxsw_sp_fdb_call_notifiers(mlxsw_sp_port->learning_sync, 1280 1261 adding, mac, vid, mlxsw_sp_port->dev); 1281 1262 return; 1282 1263 ··· 1290 1273 bool adding) 1291 1274 { 1292 1275 struct mlxsw_sp_port *mlxsw_sp_port; 1276 + struct net_device *dev; 1293 1277 char mac[ETH_ALEN]; 1294 1278 u16 lag_vid = 0; 1295 1279 u16 lag_id; ··· 1316 1298 goto just_remove; 1317 1299 } 1318 1300 1319 - vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport); 1320 - lag_vid = vid; 1301 + lag_vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport); 1302 + dev = mlxsw_sp_vport->dev; 1303 + vid = 0; 1321 1304 /* Override the physical port with the vPort. */ 1322 1305 mlxsw_sp_port = mlxsw_sp_vport; 1323 1306 } else { 1307 + dev = mlxsw_sp_lag_get(mlxsw_sp, lag_id)->dev; 1324 1308 vid = fid; 1325 1309 } 1326 1310 ··· 1339 1319 1340 1320 if (!do_notification) 1341 1321 return; 1342 - mlxsw_sp_fdb_call_notifiers(mlxsw_sp_port->learning, 1343 - mlxsw_sp_port->learning_sync, 1344 - adding, mac, vid, 1345 - mlxsw_sp_lag_get(mlxsw_sp, lag_id)->dev); 1322 + mlxsw_sp_fdb_call_notifiers(mlxsw_sp_port->learning_sync, adding, mac, 1323 + vid, dev); 1346 1324 return; 1347 1325 1348 1326 just_remove: ··· 1392 1374 1393 1375 mlxsw_sp = container_of(work, struct mlxsw_sp, fdb_notify.dw.work); 1394 1376 1395 - mutex_lock(&mlxsw_sp->fdb_lock); 1377 + rtnl_lock(); 1396 1378 do { 1397 1379 mlxsw_reg_sfn_pack(sfn_pl); 1398 1380 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(sfn), sfn_pl); ··· 1405 1387 mlxsw_sp_fdb_notify_rec_process(mlxsw_sp, sfn_pl, i); 1406 1388 1407 1389 } while (num_rec); 1408 - mutex_unlock(&mlxsw_sp->fdb_lock); 1390 + rtnl_unlock(); 1409 1391 1410 1392 kfree(sfn_pl); 1411 1393 mlxsw_sp_fdb_notify_work_schedule(mlxsw_sp); ··· 1420 1402 dev_err(mlxsw_sp->bus_info->dev, "Failed to set default ageing time\n"); 1421 1403 return err; 1422 1404 } 1423 - mutex_init(&mlxsw_sp->fdb_lock); 1424 1405 INIT_DELAYED_WORK(&mlxsw_sp->fdb_notify.dw, mlxsw_sp_fdb_notify_work); 1425 1406 mlxsw_sp->fdb_notify.interval = MLXSW_SP_DEFAULT_LEARNING_INTERVAL; 1426 1407 mlxsw_sp_fdb_notify_work_schedule(mlxsw_sp);
+30 -16
drivers/net/ethernet/moxa/moxart_ether.c
··· 28 28 29 29 #include "moxart_ether.h" 30 30 31 + static inline void moxart_desc_write(u32 data, u32 *desc) 32 + { 33 + *desc = cpu_to_le32(data); 34 + } 35 + 36 + static inline u32 moxart_desc_read(u32 *desc) 37 + { 38 + return le32_to_cpu(*desc); 39 + } 40 + 31 41 static inline void moxart_emac_write(struct net_device *ndev, 32 42 unsigned int reg, unsigned long value) 33 43 { ··· 122 112 static void moxart_mac_setup_desc_ring(struct net_device *ndev) 123 113 { 124 114 struct moxart_mac_priv_t *priv = netdev_priv(ndev); 125 - void __iomem *desc; 115 + void *desc; 126 116 int i; 127 117 128 118 for (i = 0; i < TX_DESC_NUM; i++) { ··· 131 121 132 122 priv->tx_buf[i] = priv->tx_buf_base + priv->tx_buf_size * i; 133 123 } 134 - writel(TX_DESC1_END, desc + TX_REG_OFFSET_DESC1); 124 + moxart_desc_write(TX_DESC1_END, desc + TX_REG_OFFSET_DESC1); 135 125 136 126 priv->tx_head = 0; 137 127 priv->tx_tail = 0; ··· 139 129 for (i = 0; i < RX_DESC_NUM; i++) { 140 130 desc = priv->rx_desc_base + i * RX_REG_DESC_SIZE; 141 131 memset(desc, 0, RX_REG_DESC_SIZE); 142 - writel(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); 143 - writel(RX_BUF_SIZE & RX_DESC1_BUF_SIZE_MASK, 132 + moxart_desc_write(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); 133 + moxart_desc_write(RX_BUF_SIZE & RX_DESC1_BUF_SIZE_MASK, 144 134 desc + RX_REG_OFFSET_DESC1); 145 135 146 136 priv->rx_buf[i] = priv->rx_buf_base + priv->rx_buf_size * i; ··· 151 141 if (dma_mapping_error(&ndev->dev, priv->rx_mapping[i])) 152 142 netdev_err(ndev, "DMA mapping error\n"); 153 143 154 - writel(priv->rx_mapping[i], 144 + moxart_desc_write(priv->rx_mapping[i], 155 145 desc + RX_REG_OFFSET_DESC2 + RX_DESC2_ADDRESS_PHYS); 156 - writel(priv->rx_buf[i], 146 + moxart_desc_write((uintptr_t)priv->rx_buf[i], 157 147 desc + RX_REG_OFFSET_DESC2 + RX_DESC2_ADDRESS_VIRT); 158 148 } 159 - writel(RX_DESC1_END, desc + RX_REG_OFFSET_DESC1); 149 + moxart_desc_write(RX_DESC1_END, desc + RX_REG_OFFSET_DESC1); 160 150 161 151 priv->rx_head = 0; 162 152 ··· 211 201 napi); 212 202 struct net_device *ndev = priv->ndev; 213 203 struct sk_buff *skb; 214 - void __iomem *desc; 204 + void *desc; 215 205 unsigned int desc0, len; 216 206 int rx_head = priv->rx_head; 217 207 int rx = 0; 218 208 219 209 while (rx < budget) { 220 210 desc = priv->rx_desc_base + (RX_REG_DESC_SIZE * rx_head); 221 - desc0 = readl(desc + RX_REG_OFFSET_DESC0); 211 + desc0 = moxart_desc_read(desc + RX_REG_OFFSET_DESC0); 212 + rmb(); /* ensure desc0 is up to date */ 222 213 223 214 if (desc0 & RX_DESC0_DMA_OWN) 224 215 break; ··· 261 250 priv->stats.multicast++; 262 251 263 252 rx_next: 264 - writel(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); 253 + wmb(); /* prevent setting ownership back too early */ 254 + moxart_desc_write(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); 265 255 266 256 rx_head = RX_NEXT(rx_head); 267 257 priv->rx_head = rx_head; ··· 322 310 static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) 323 311 { 324 312 struct moxart_mac_priv_t *priv = netdev_priv(ndev); 325 - void __iomem *desc; 313 + void *desc; 326 314 unsigned int len; 327 315 unsigned int tx_head = priv->tx_head; 328 316 u32 txdes1; ··· 331 319 desc = priv->tx_desc_base + (TX_REG_DESC_SIZE * tx_head); 332 320 333 321 spin_lock_irq(&priv->txlock); 334 - if (readl(desc + TX_REG_OFFSET_DESC0) & TX_DESC0_DMA_OWN) { 322 + if (moxart_desc_read(desc + TX_REG_OFFSET_DESC0) & TX_DESC0_DMA_OWN) { 335 323 net_dbg_ratelimited("no TX space for packet\n"); 336 324 priv->stats.tx_dropped++; 337 325 goto out_unlock; 338 326 } 327 + rmb(); /* ensure data is only read that had TX_DESC0_DMA_OWN cleared */ 339 328 340 329 len = skb->len > TX_BUF_SIZE ? TX_BUF_SIZE : skb->len; 341 330 ··· 350 337 priv->tx_len[tx_head] = len; 351 338 priv->tx_skb[tx_head] = skb; 352 339 353 - writel(priv->tx_mapping[tx_head], 340 + moxart_desc_write(priv->tx_mapping[tx_head], 354 341 desc + TX_REG_OFFSET_DESC2 + TX_DESC2_ADDRESS_PHYS); 355 - writel(skb->data, 342 + moxart_desc_write((uintptr_t)skb->data, 356 343 desc + TX_REG_OFFSET_DESC2 + TX_DESC2_ADDRESS_VIRT); 357 344 358 345 if (skb->len < ETH_ZLEN) { ··· 367 354 txdes1 = TX_DESC1_LTS | TX_DESC1_FTS | (len & TX_DESC1_BUF_SIZE_MASK); 368 355 if (tx_head == TX_DESC_NUM_MASK) 369 356 txdes1 |= TX_DESC1_END; 370 - writel(txdes1, desc + TX_REG_OFFSET_DESC1); 371 - writel(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0); 357 + moxart_desc_write(txdes1, desc + TX_REG_OFFSET_DESC1); 358 + wmb(); /* flush descriptor before transferring ownership */ 359 + moxart_desc_write(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0); 372 360 373 361 /* start to send packet */ 374 362 writel(0xffffffff, priv->base + REG_TX_POLL_DEMAND);
+2 -2
drivers/net/ethernet/moxa/moxart_ether.h
··· 300 300 301 301 dma_addr_t rx_base; 302 302 dma_addr_t rx_mapping[RX_DESC_NUM]; 303 - void __iomem *rx_desc_base; 303 + void *rx_desc_base; 304 304 unsigned char *rx_buf_base; 305 305 unsigned char *rx_buf[RX_DESC_NUM]; 306 306 unsigned int rx_head; ··· 308 308 309 309 dma_addr_t tx_base; 310 310 dma_addr_t tx_mapping[TX_DESC_NUM]; 311 - void __iomem *tx_desc_base; 311 + void *tx_desc_base; 312 312 unsigned char *tx_buf_base; 313 313 unsigned char *tx_buf[RX_DESC_NUM]; 314 314 unsigned int tx_head;
+12 -19
drivers/net/ethernet/neterion/vxge/vxge-main.c
··· 2223 2223 return IRQ_NONE; 2224 2224 } 2225 2225 2226 - #ifdef CONFIG_PCI_MSI 2227 - 2228 2226 static irqreturn_t vxge_tx_msix_handle(int irq, void *dev_id) 2229 2227 { 2230 2228 struct vxge_fifo *fifo = (struct vxge_fifo *)dev_id; ··· 2440 2442 if (vdev->config.intr_type == MSI_X) 2441 2443 pci_disable_msix(vdev->pdev); 2442 2444 } 2443 - #endif 2444 2445 2445 2446 static void vxge_rem_isr(struct vxgedev *vdev) 2446 2447 { 2447 - #ifdef CONFIG_PCI_MSI 2448 - if (vdev->config.intr_type == MSI_X) { 2448 + if (IS_ENABLED(CONFIG_PCI_MSI) && 2449 + vdev->config.intr_type == MSI_X) { 2449 2450 vxge_rem_msix_isr(vdev); 2450 - } else 2451 - #endif 2452 - if (vdev->config.intr_type == INTA) { 2451 + } else if (vdev->config.intr_type == INTA) { 2453 2452 synchronize_irq(vdev->pdev->irq); 2454 2453 free_irq(vdev->pdev->irq, vdev); 2455 2454 } ··· 2455 2460 static int vxge_add_isr(struct vxgedev *vdev) 2456 2461 { 2457 2462 int ret = 0; 2458 - #ifdef CONFIG_PCI_MSI 2459 2463 int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0; 2460 2464 int pci_fun = PCI_FUNC(vdev->pdev->devfn); 2461 2465 2462 - if (vdev->config.intr_type == MSI_X) 2466 + if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X) 2463 2467 ret = vxge_enable_msix(vdev); 2464 2468 2465 2469 if (ret) { ··· 2469 2475 vdev->config.intr_type = INTA; 2470 2476 } 2471 2477 2472 - if (vdev->config.intr_type == MSI_X) { 2478 + if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X) { 2473 2479 for (intr_idx = 0; 2474 2480 intr_idx < (vdev->no_of_vpath * 2475 2481 VXGE_HW_VPATH_MSIX_ACTIVE); intr_idx++) { ··· 2570 2576 vdev->vxge_entries[intr_cnt].in_use = 1; 2571 2577 vdev->vxge_entries[intr_cnt].arg = &vdev->vpaths[0]; 2572 2578 } 2573 - INTA_MODE: 2574 - #endif 2575 2579 2580 + INTA_MODE: 2576 2581 if (vdev->config.intr_type == INTA) { 2577 2582 snprintf(vdev->desc[0], VXGE_INTR_STRLEN, 2578 2583 "%s:vxge:INTA", vdev->ndev->name); ··· 3882 3889 if (max_mac_vpath > VXGE_MAX_MAC_ADDR_COUNT) 3883 3890 max_mac_vpath = VXGE_MAX_MAC_ADDR_COUNT; 3884 3891 3885 - #ifndef CONFIG_PCI_MSI 3886 - vxge_debug_init(VXGE_ERR, 3887 - "%s: This Kernel does not support " 3888 - "MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME); 3889 - *intr_type = INTA; 3890 - #endif 3892 + if (!IS_ENABLED(CONFIG_PCI_MSI)) { 3893 + vxge_debug_init(VXGE_ERR, 3894 + "%s: This Kernel does not support " 3895 + "MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME); 3896 + *intr_type = INTA; 3897 + } 3891 3898 3892 3899 /* Configure whether MSI-X or IRQL. */ 3893 3900 switch (*intr_type) {
+2
drivers/net/ethernet/rocker/rocker.c
··· 3531 3531 info.addr = lw->addr; 3532 3532 info.vid = lw->vid; 3533 3533 3534 + rtnl_lock(); 3534 3535 if (learned && removing) 3535 3536 call_switchdev_notifiers(SWITCHDEV_FDB_DEL, 3536 3537 lw->rocker_port->dev, &info.info); 3537 3538 else if (learned && !removing) 3538 3539 call_switchdev_notifiers(SWITCHDEV_FDB_ADD, 3539 3540 lw->rocker_port->dev, &info.info); 3541 + rtnl_unlock(); 3540 3542 3541 3543 rocker_port_kfree(lw->trans, work); 3542 3544 }
+13 -3
drivers/net/ethernet/sun/sunvnet.c
··· 389 389 if (vio_version_after_eq(&port->vio, 1, 8)) { 390 390 struct vio_net_dext *dext = vio_net_ext(desc); 391 391 392 + skb_reset_network_header(skb); 393 + 392 394 if (dext->flags & VNET_PKT_HCK_IPV4_HDRCKSUM) { 393 395 if (skb->protocol == ETH_P_IP) { 394 - struct iphdr *iph = (struct iphdr *)skb->data; 396 + struct iphdr *iph = ip_hdr(skb); 395 397 396 398 iph->check = 0; 397 399 ip_send_check(iph); 398 400 } 399 401 } 400 402 if ((dext->flags & VNET_PKT_HCK_FULLCKSUM) && 401 - skb->ip_summed == CHECKSUM_NONE) 402 - vnet_fullcsum(skb); 403 + skb->ip_summed == CHECKSUM_NONE) { 404 + if (skb->protocol == htons(ETH_P_IP)) { 405 + struct iphdr *iph = ip_hdr(skb); 406 + int ihl = iph->ihl * 4; 407 + 408 + skb_reset_transport_header(skb); 409 + skb_set_transport_header(skb, ihl); 410 + vnet_fullcsum(skb); 411 + } 412 + } 403 413 if (dext->flags & VNET_PKT_HCK_IPV4_HDRCKSUM_OK) { 404 414 skb->ip_summed = CHECKSUM_PARTIAL; 405 415 skb->csum_level = 0;
+6 -6
drivers/net/ethernet/ti/davinci_cpdma.c
··· 82 82 83 83 struct cpdma_desc_pool { 84 84 phys_addr_t phys; 85 - u32 hw_addr; 85 + dma_addr_t hw_addr; 86 86 void __iomem *iomap; /* ioremap map */ 87 87 void *cpumap; /* dma_alloc map */ 88 88 int desc_size, mem_size; ··· 152 152 * abstract out these details 153 153 */ 154 154 static struct cpdma_desc_pool * 155 - cpdma_desc_pool_create(struct device *dev, u32 phys, u32 hw_addr, 155 + cpdma_desc_pool_create(struct device *dev, u32 phys, dma_addr_t hw_addr, 156 156 int size, int align) 157 157 { 158 158 int bitmap_size; ··· 176 176 177 177 if (phys) { 178 178 pool->phys = phys; 179 - pool->iomap = ioremap(phys, size); 179 + pool->iomap = ioremap(phys, size); /* should be memremap? */ 180 180 pool->hw_addr = hw_addr; 181 181 } else { 182 - pool->cpumap = dma_alloc_coherent(dev, size, &pool->phys, 182 + pool->cpumap = dma_alloc_coherent(dev, size, &pool->hw_addr, 183 183 GFP_KERNEL); 184 - pool->iomap = pool->cpumap; 185 - pool->hw_addr = pool->phys; 184 + pool->iomap = (void __iomem __force *)pool->cpumap; 185 + pool->phys = pool->hw_addr; /* assumes no IOMMU, don't use this value */ 186 186 } 187 187 188 188 if (pool->iomap)
+4 -4
drivers/net/fddi/defxx.c
··· 533 533 const char *print_name = dev_name(bdev); 534 534 struct net_device *dev; 535 535 DFX_board_t *bp; /* board pointer */ 536 - resource_size_t bar_start[3]; /* pointers to ports */ 537 - resource_size_t bar_len[3]; /* resource length */ 536 + resource_size_t bar_start[3] = {0}; /* pointers to ports */ 537 + resource_size_t bar_len[3] = {0}; /* resource length */ 538 538 int alloc_size; /* total buffer size used */ 539 539 struct resource *region; 540 540 int err = 0; ··· 3697 3697 int dfx_bus_pci = dev_is_pci(bdev); 3698 3698 int dfx_bus_tc = DFX_BUS_TC(bdev); 3699 3699 int dfx_use_mmio = DFX_MMIO || dfx_bus_tc; 3700 - resource_size_t bar_start[3]; /* pointers to ports */ 3701 - resource_size_t bar_len[3]; /* resource lengths */ 3700 + resource_size_t bar_start[3] = {0}; /* pointers to ports */ 3701 + resource_size_t bar_len[3] = {0}; /* resource lengths */ 3702 3702 int alloc_size; /* total buffer size used */ 3703 3703 3704 3704 unregister_netdev(dev);
+2 -2
drivers/net/geneve.c
··· 980 980 opts = ip_tunnel_info_opts(info); 981 981 982 982 if (key->tun_flags & TUNNEL_CSUM) 983 - flags |= GENEVE_F_UDP_CSUM; 983 + flags &= ~GENEVE_F_UDP_ZERO_CSUM6_TX; 984 984 else 985 - flags &= ~GENEVE_F_UDP_CSUM; 985 + flags |= GENEVE_F_UDP_ZERO_CSUM6_TX; 986 986 987 987 err = geneve6_build_skb(dst, skb, key->tun_flags, vni, 988 988 info->options_len, opts,
+1
drivers/net/hyperv/hyperv_net.h
··· 624 624 #define RNDIS_PKT_ALIGN_DEFAULT 8 625 625 626 626 struct multi_send_data { 627 + struct sk_buff *skb; /* skb containing the pkt */ 627 628 struct hv_netvsc_packet *pkt; /* netvsc pkt pending */ 628 629 u32 count; /* counter of batched packets */ 629 630 };
+22 -11
drivers/net/hyperv/netvsc.c
··· 841 841 return ret; 842 842 } 843 843 844 + /* Move packet out of multi send data (msd), and clear msd */ 845 + static inline void move_pkt_msd(struct hv_netvsc_packet **msd_send, 846 + struct sk_buff **msd_skb, 847 + struct multi_send_data *msdp) 848 + { 849 + *msd_skb = msdp->skb; 850 + *msd_send = msdp->pkt; 851 + msdp->skb = NULL; 852 + msdp->pkt = NULL; 853 + msdp->count = 0; 854 + } 855 + 844 856 int netvsc_send(struct hv_device *device, 845 857 struct hv_netvsc_packet *packet, 846 858 struct rndis_message *rndis_msg, ··· 867 855 unsigned int section_index = NETVSC_INVALID_INDEX; 868 856 struct multi_send_data *msdp; 869 857 struct hv_netvsc_packet *msd_send = NULL, *cur_send = NULL; 858 + struct sk_buff *msd_skb = NULL; 870 859 bool try_batch; 871 860 bool xmit_more = (skb != NULL) ? skb->xmit_more : false; 872 861 ··· 910 897 net_device->send_section_size) { 911 898 section_index = netvsc_get_next_send_section(net_device); 912 899 if (section_index != NETVSC_INVALID_INDEX) { 913 - msd_send = msdp->pkt; 914 - msdp->pkt = NULL; 915 - msdp->count = 0; 916 - msd_len = 0; 900 + move_pkt_msd(&msd_send, &msd_skb, msdp); 901 + msd_len = 0; 917 902 } 918 903 } 919 904 ··· 930 919 packet->total_data_buflen += msd_len; 931 920 } 932 921 933 - if (msdp->pkt) 934 - dev_kfree_skb_any(skb); 922 + if (msdp->skb) 923 + dev_kfree_skb_any(msdp->skb); 935 924 936 925 if (xmit_more && !packet->cp_partial) { 926 + msdp->skb = skb; 937 927 msdp->pkt = packet; 938 928 msdp->count++; 939 929 } else { 940 930 cur_send = packet; 931 + msdp->skb = NULL; 941 932 msdp->pkt = NULL; 942 933 msdp->count = 0; 943 934 } 944 935 } else { 945 - msd_send = msdp->pkt; 946 - msdp->pkt = NULL; 947 - msdp->count = 0; 936 + move_pkt_msd(&msd_send, &msd_skb, msdp); 948 937 cur_send = packet; 949 938 } 950 939 951 940 if (msd_send) { 952 - m_ret = netvsc_send_pkt(msd_send, net_device, pb, skb); 941 + m_ret = netvsc_send_pkt(msd_send, net_device, NULL, msd_skb); 953 942 954 943 if (m_ret != 0) { 955 944 netvsc_free_send_slot(net_device, 956 945 msd_send->send_buf_index); 957 - dev_kfree_skb_any(skb); 946 + dev_kfree_skb_any(msd_skb); 958 947 } 959 948 } 960 949
+3 -64
drivers/net/hyperv/netvsc_drv.c
··· 196 196 return ppi; 197 197 } 198 198 199 - union sub_key { 200 - u64 k; 201 - struct { 202 - u8 pad[3]; 203 - u8 kb; 204 - u32 ka; 205 - }; 206 - }; 207 - 208 - /* Toeplitz hash function 209 - * data: network byte order 210 - * return: host byte order 211 - */ 212 - static u32 comp_hash(u8 *key, int klen, void *data, int dlen) 213 - { 214 - union sub_key subk; 215 - int k_next = 4; 216 - u8 dt; 217 - int i, j; 218 - u32 ret = 0; 219 - 220 - subk.k = 0; 221 - subk.ka = ntohl(*(u32 *)key); 222 - 223 - for (i = 0; i < dlen; i++) { 224 - subk.kb = key[k_next]; 225 - k_next = (k_next + 1) % klen; 226 - dt = ((u8 *)data)[i]; 227 - for (j = 0; j < 8; j++) { 228 - if (dt & 0x80) 229 - ret ^= subk.ka; 230 - dt <<= 1; 231 - subk.k <<= 1; 232 - } 233 - } 234 - 235 - return ret; 236 - } 237 - 238 - static bool netvsc_set_hash(u32 *hash, struct sk_buff *skb) 239 - { 240 - struct flow_keys flow; 241 - int data_len; 242 - 243 - if (!skb_flow_dissect_flow_keys(skb, &flow, 0) || 244 - !(flow.basic.n_proto == htons(ETH_P_IP) || 245 - flow.basic.n_proto == htons(ETH_P_IPV6))) 246 - return false; 247 - 248 - if (flow.basic.ip_proto == IPPROTO_TCP) 249 - data_len = 12; 250 - else 251 - data_len = 8; 252 - 253 - *hash = comp_hash(netvsc_hash_key, HASH_KEYLEN, &flow, data_len); 254 - 255 - return true; 256 - } 257 - 258 199 static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb, 259 200 void *accel_priv, select_queue_fallback_t fallback) 260 201 { ··· 208 267 if (nvsc_dev == NULL || ndev->real_num_tx_queues <= 1) 209 268 return 0; 210 269 211 - if (netvsc_set_hash(&hash, skb)) { 212 - q_idx = nvsc_dev->send_table[hash % VRSS_SEND_TAB_SIZE] % 213 - ndev->real_num_tx_queues; 214 - skb_set_hash(skb, hash, PKT_HASH_TYPE_L3); 215 - } 270 + hash = skb_get_hash(skb); 271 + q_idx = nvsc_dev->send_table[hash % VRSS_SEND_TAB_SIZE] % 272 + ndev->real_num_tx_queues; 216 273 217 274 if (!nvsc_dev->chn_table[q_idx]) 218 275 q_idx = 0;
-3
drivers/net/irda/bfin_sir.h
··· 82 82 83 83 #define DRIVER_NAME "bfin_sir" 84 84 85 - #define port_membase(port) (((struct bfin_sir_port *)(port))->membase) 86 - #define get_lsr_cache(port) (((struct bfin_sir_port *)(port))->lsr) 87 - #define put_lsr_cache(port, v) (((struct bfin_sir_port *)(port))->lsr = (v)) 88 85 #include <asm/bfin_serial.h> 89 86 90 87 static const unsigned short per[][4] = {
+2
drivers/net/macvlan.c
··· 1323 1323 1324 1324 list_add_tail_rcu(&vlan->list, &port->vlans); 1325 1325 netif_stacked_transfer_operstate(lowerdev, dev); 1326 + linkwatch_fire_event(dev); 1326 1327 1327 1328 return 0; 1328 1329 ··· 1523 1522 port = macvlan_port_get_rtnl(dev); 1524 1523 1525 1524 switch (event) { 1525 + case NETDEV_UP: 1526 1526 case NETDEV_CHANGE: 1527 1527 list_for_each_entry(vlan, &port->vlans, list) 1528 1528 netif_stacked_transfer_operstate(vlan->lowerdev,
+1
drivers/net/phy/Kconfig
··· 186 186 config MDIO_OCTEON 187 187 tristate "Support for MDIO buses on Octeon and ThunderX SOCs" 188 188 depends on 64BIT 189 + depends on HAS_IOMEM 189 190 help 190 191 191 192 This module provides a driver for the Octeon and ThunderX MDIO
+17
drivers/net/phy/dp83640.c
··· 846 846 struct skb_shared_hwtstamps *shhwtstamps = NULL; 847 847 struct sk_buff *skb; 848 848 unsigned long flags; 849 + u8 overflow; 850 + 851 + overflow = (phy_rxts->ns_hi >> 14) & 0x3; 852 + if (overflow) 853 + pr_debug("rx timestamp queue overflow, count %d\n", overflow); 849 854 850 855 spin_lock_irqsave(&dp83640->rx_lock, flags); 851 856 ··· 893 888 struct skb_shared_hwtstamps shhwtstamps; 894 889 struct sk_buff *skb; 895 890 u64 ns; 891 + u8 overflow; 896 892 897 893 /* We must already have the skb that triggered this. */ 898 894 ··· 903 897 pr_debug("have timestamp but tx_queue empty\n"); 904 898 return; 905 899 } 900 + 901 + overflow = (phy_txts->ns_hi >> 14) & 0x3; 902 + if (overflow) { 903 + pr_debug("tx timestamp queue overflow, count %d\n", overflow); 904 + while (skb) { 905 + skb_complete_tx_timestamp(skb, NULL); 906 + skb = skb_dequeue(&dp83640->tx_queue); 907 + } 908 + return; 909 + } 910 + 906 911 ns = phy2txts(phy_txts); 907 912 memset(&shhwtstamps, 0, sizeof(shhwtstamps)); 908 913 shhwtstamps.hwtstamp = ns_to_ktime(ns);
+28 -18
drivers/net/phy/phy.c
··· 692 692 struct phy_device *phydev = 693 693 container_of(work, struct phy_device, phy_queue); 694 694 695 - if (phydev->drv->did_interrupt && 696 - !phydev->drv->did_interrupt(phydev)) 697 - goto ignore; 695 + if (phy_interrupt_is_valid(phydev)) { 696 + if (phydev->drv->did_interrupt && 697 + !phydev->drv->did_interrupt(phydev)) 698 + goto ignore; 698 699 699 - if (phy_disable_interrupts(phydev)) 700 - goto phy_err; 700 + if (phy_disable_interrupts(phydev)) 701 + goto phy_err; 702 + } 701 703 702 704 mutex_lock(&phydev->lock); 703 705 if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state)) 704 706 phydev->state = PHY_CHANGELINK; 705 707 mutex_unlock(&phydev->lock); 706 708 707 - atomic_dec(&phydev->irq_disable); 708 - enable_irq(phydev->irq); 709 + if (phy_interrupt_is_valid(phydev)) { 710 + atomic_dec(&phydev->irq_disable); 711 + enable_irq(phydev->irq); 709 712 710 - /* Reenable interrupts */ 711 - if (PHY_HALTED != phydev->state && 712 - phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED)) 713 - goto irq_enable_err; 713 + /* Reenable interrupts */ 714 + if (PHY_HALTED != phydev->state && 715 + phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED)) 716 + goto irq_enable_err; 717 + } 714 718 715 719 /* reschedule state queue work to run as soon as possible */ 716 720 cancel_delayed_work_sync(&phydev->state_queue); ··· 909 905 phydev->adjust_link(phydev->attached_dev); 910 906 break; 911 907 case PHY_RUNNING: 912 - /* Only register a CHANGE if we are polling or ignoring 913 - * interrupts and link changed since latest checking. 908 + /* Only register a CHANGE if we are polling and link changed 909 + * since latest checking. 914 910 */ 915 - if (!phy_interrupt_is_valid(phydev)) { 911 + if (phydev->irq == PHY_POLL) { 916 912 old_link = phydev->link; 917 913 err = phy_read_status(phydev); 918 914 if (err) ··· 1004 1000 phy_state_to_str(old_state), 1005 1001 phy_state_to_str(phydev->state)); 1006 1002 1007 - queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, 1008 - PHY_STATE_TIME * HZ); 1003 + /* Only re-schedule a PHY state machine change if we are polling the 1004 + * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving 1005 + * between states from phy_mac_interrupt() 1006 + */ 1007 + if (phydev->irq == PHY_POLL) 1008 + queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, 1009 + PHY_STATE_TIME * HZ); 1009 1010 } 1010 1011 1011 1012 void phy_mac_interrupt(struct phy_device *phydev, int new_link) 1012 1013 { 1013 - cancel_work_sync(&phydev->phy_queue); 1014 1014 phydev->link = new_link; 1015 - schedule_work(&phydev->phy_queue); 1015 + 1016 + /* Trigger a state machine change */ 1017 + queue_work(system_power_efficient_wq, &phydev->phy_queue); 1016 1018 } 1017 1019 EXPORT_SYMBOL(phy_mac_interrupt); 1018 1020
+45 -11
drivers/net/phy/smsc.c
··· 24 24 #include <linux/netdevice.h> 25 25 #include <linux/smscphy.h> 26 26 27 + struct smsc_phy_priv { 28 + bool energy_enable; 29 + }; 30 + 27 31 static int smsc_phy_config_intr(struct phy_device *phydev) 28 32 { 29 33 int rc = phy_write (phydev, MII_LAN83C185_IM, ··· 47 43 48 44 static int smsc_phy_config_init(struct phy_device *phydev) 49 45 { 50 - int __maybe_unused len; 51 - struct device *dev __maybe_unused = &phydev->mdio.dev; 52 - struct device_node *of_node __maybe_unused = dev->of_node; 46 + struct smsc_phy_priv *priv = phydev->priv; 47 + 53 48 int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); 54 - int enable_energy = 1; 55 49 56 50 if (rc < 0) 57 51 return rc; 58 52 59 - if (of_find_property(of_node, "smsc,disable-energy-detect", &len)) 60 - enable_energy = 0; 61 - 62 - if (enable_energy) { 53 + if (priv->energy_enable) { 63 54 /* Enable energy detect mode for this SMSC Transceivers */ 64 55 rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, 65 56 rc | MII_LAN83C185_EDPWRDOWN); ··· 109 110 */ 110 111 static int lan87xx_read_status(struct phy_device *phydev) 111 112 { 112 - int err = genphy_read_status(phydev); 113 - int i; 113 + struct smsc_phy_priv *priv = phydev->priv; 114 114 115 - if (!phydev->link) { 115 + int err = genphy_read_status(phydev); 116 + 117 + if (!phydev->link && priv->energy_enable) { 118 + int i; 119 + 116 120 /* Disable EDPD to wake up PHY */ 117 121 int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); 118 122 if (rc < 0) ··· 151 149 return err; 152 150 } 153 151 152 + static int smsc_phy_probe(struct phy_device *phydev) 153 + { 154 + struct device *dev = &phydev->mdio.dev; 155 + struct device_node *of_node = dev->of_node; 156 + struct smsc_phy_priv *priv; 157 + 158 + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 159 + if (!priv) 160 + return -ENOMEM; 161 + 162 + priv->energy_enable = true; 163 + 164 + if (of_property_read_bool(of_node, "smsc,disable-energy-detect")) 165 + priv->energy_enable = false; 166 + 167 + phydev->priv = priv; 168 + 169 + return 0; 170 + } 171 + 154 172 static struct phy_driver smsc_phy_driver[] = { 155 173 { 156 174 .phy_id = 0x0007c0a0, /* OUI=0x00800f, Model#=0x0a */ ··· 180 158 .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause 181 159 | SUPPORTED_Asym_Pause), 182 160 .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, 161 + 162 + .probe = smsc_phy_probe, 183 163 184 164 /* basic functions */ 185 165 .config_aneg = genphy_config_aneg, ··· 204 180 | SUPPORTED_Asym_Pause), 205 181 .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, 206 182 183 + .probe = smsc_phy_probe, 184 + 207 185 /* basic functions */ 208 186 .config_aneg = genphy_config_aneg, 209 187 .read_status = genphy_read_status, ··· 226 200 .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause 227 201 | SUPPORTED_Asym_Pause), 228 202 .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, 203 + 204 + .probe = smsc_phy_probe, 229 205 230 206 /* basic functions */ 231 207 .config_aneg = genphy_config_aneg, ··· 250 222 | SUPPORTED_Asym_Pause), 251 223 .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, 252 224 225 + .probe = smsc_phy_probe, 226 + 253 227 /* basic functions */ 254 228 .config_aneg = genphy_config_aneg, 255 229 .read_status = genphy_read_status, ··· 271 241 .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause 272 242 | SUPPORTED_Asym_Pause), 273 243 .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, 244 + 245 + .probe = smsc_phy_probe, 274 246 275 247 /* basic functions */ 276 248 .config_aneg = genphy_config_aneg, ··· 294 262 .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause 295 263 | SUPPORTED_Asym_Pause), 296 264 .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, 265 + 266 + .probe = smsc_phy_probe, 297 267 298 268 /* basic functions */ 299 269 .config_aneg = genphy_config_aneg,
+25 -11
drivers/net/ppp/pptp.c
··· 129 129 return i < MAX_CALLID; 130 130 } 131 131 132 - static int add_chan(struct pppox_sock *sock) 132 + static int add_chan(struct pppox_sock *sock, 133 + struct pptp_addr *sa) 133 134 { 134 135 static int call_id; 135 136 136 137 spin_lock(&chan_lock); 137 - if (!sock->proto.pptp.src_addr.call_id) { 138 + if (!sa->call_id) { 138 139 call_id = find_next_zero_bit(callid_bitmap, MAX_CALLID, call_id + 1); 139 140 if (call_id == MAX_CALLID) { 140 141 call_id = find_next_zero_bit(callid_bitmap, MAX_CALLID, 1); 141 142 if (call_id == MAX_CALLID) 142 143 goto out_err; 143 144 } 144 - sock->proto.pptp.src_addr.call_id = call_id; 145 - } else if (test_bit(sock->proto.pptp.src_addr.call_id, callid_bitmap)) 145 + sa->call_id = call_id; 146 + } else if (test_bit(sa->call_id, callid_bitmap)) { 146 147 goto out_err; 148 + } 147 149 148 - set_bit(sock->proto.pptp.src_addr.call_id, callid_bitmap); 149 - rcu_assign_pointer(callid_sock[sock->proto.pptp.src_addr.call_id], sock); 150 + sock->proto.pptp.src_addr = *sa; 151 + set_bit(sa->call_id, callid_bitmap); 152 + rcu_assign_pointer(callid_sock[sa->call_id], sock); 150 153 spin_unlock(&chan_lock); 151 154 152 155 return 0; ··· 419 416 struct sock *sk = sock->sk; 420 417 struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr; 421 418 struct pppox_sock *po = pppox_sk(sk); 422 - struct pptp_opt *opt = &po->proto.pptp; 423 419 int error = 0; 424 420 425 421 if (sockaddr_len < sizeof(struct sockaddr_pppox)) ··· 426 424 427 425 lock_sock(sk); 428 426 429 - opt->src_addr = sp->sa_addr.pptp; 430 - if (add_chan(po)) 431 - error = -EBUSY; 427 + if (sk->sk_state & PPPOX_DEAD) { 428 + error = -EALREADY; 429 + goto out; 430 + } 432 431 432 + if (sk->sk_state & PPPOX_BOUND) { 433 + error = -EBUSY; 434 + goto out; 435 + } 436 + 437 + if (add_chan(po, &sp->sa_addr.pptp)) 438 + error = -EBUSY; 439 + else 440 + sk->sk_state |= PPPOX_BOUND; 441 + 442 + out: 433 443 release_sock(sk); 434 444 return error; 435 445 } ··· 512 498 } 513 499 514 500 opt->dst_addr = sp->sa_addr.pptp; 515 - sk->sk_state = PPPOX_CONNECTED; 501 + sk->sk_state |= PPPOX_CONNECTED; 516 502 517 503 end: 518 504 release_sock(sk);
+88 -44
drivers/net/usb/lan78xx.c
··· 36 36 #define DRIVER_AUTHOR "WOOJUNG HUH <woojung.huh@microchip.com>" 37 37 #define DRIVER_DESC "LAN78XX USB 3.0 Gigabit Ethernet Devices" 38 38 #define DRIVER_NAME "lan78xx" 39 - #define DRIVER_VERSION "1.0.1" 39 + #define DRIVER_VERSION "1.0.2" 40 40 41 41 #define TX_TIMEOUT_JIFFIES (5 * HZ) 42 42 #define THROTTLE_JIFFIES (HZ / 8) ··· 462 462 u32 length, u8 *data) 463 463 { 464 464 u32 val; 465 + u32 saved; 465 466 int i, ret; 467 + int retval; 466 468 467 - ret = lan78xx_eeprom_confirm_not_busy(dev); 468 - if (ret) 469 - return ret; 469 + /* depends on chip, some EEPROM pins are muxed with LED function. 470 + * disable & restore LED function to access EEPROM. 471 + */ 472 + ret = lan78xx_read_reg(dev, HW_CFG, &val); 473 + saved = val; 474 + if ((dev->devid & ID_REV_CHIP_ID_MASK_) == 0x78000000) { 475 + val &= ~(HW_CFG_LED1_EN_ | HW_CFG_LED0_EN_); 476 + ret = lan78xx_write_reg(dev, HW_CFG, val); 477 + } 478 + 479 + retval = lan78xx_eeprom_confirm_not_busy(dev); 480 + if (retval) 481 + return retval; 470 482 471 483 for (i = 0; i < length; i++) { 472 484 val = E2P_CMD_EPC_BUSY_ | E2P_CMD_EPC_CMD_READ_; 473 485 val |= (offset & E2P_CMD_EPC_ADDR_MASK_); 474 486 ret = lan78xx_write_reg(dev, E2P_CMD, val); 475 - if (unlikely(ret < 0)) 476 - return -EIO; 487 + if (unlikely(ret < 0)) { 488 + retval = -EIO; 489 + goto exit; 490 + } 477 491 478 - ret = lan78xx_wait_eeprom(dev); 479 - if (ret < 0) 480 - return ret; 492 + retval = lan78xx_wait_eeprom(dev); 493 + if (retval < 0) 494 + goto exit; 481 495 482 496 ret = lan78xx_read_reg(dev, E2P_DATA, &val); 483 - if (unlikely(ret < 0)) 484 - return -EIO; 497 + if (unlikely(ret < 0)) { 498 + retval = -EIO; 499 + goto exit; 500 + } 485 501 486 502 data[i] = val & 0xFF; 487 503 offset++; 488 504 } 489 505 490 - return 0; 506 + retval = 0; 507 + exit: 508 + if ((dev->devid & ID_REV_CHIP_ID_MASK_) == 0x78000000) 509 + ret = lan78xx_write_reg(dev, HW_CFG, saved); 510 + 511 + return retval; 491 512 } 492 513 493 514 static int lan78xx_read_eeprom(struct lan78xx_net *dev, u32 offset, ··· 530 509 u32 length, u8 *data) 531 510 { 532 511 u32 val; 512 + u32 saved; 533 513 int i, ret; 514 + int retval; 534 515 535 - ret = lan78xx_eeprom_confirm_not_busy(dev); 536 - if (ret) 537 - return ret; 516 + /* depends on chip, some EEPROM pins are muxed with LED function. 517 + * disable & restore LED function to access EEPROM. 518 + */ 519 + ret = lan78xx_read_reg(dev, HW_CFG, &val); 520 + saved = val; 521 + if ((dev->devid & ID_REV_CHIP_ID_MASK_) == 0x78000000) { 522 + val &= ~(HW_CFG_LED1_EN_ | HW_CFG_LED0_EN_); 523 + ret = lan78xx_write_reg(dev, HW_CFG, val); 524 + } 525 + 526 + retval = lan78xx_eeprom_confirm_not_busy(dev); 527 + if (retval) 528 + goto exit; 538 529 539 530 /* Issue write/erase enable command */ 540 531 val = E2P_CMD_EPC_BUSY_ | E2P_CMD_EPC_CMD_EWEN_; 541 532 ret = lan78xx_write_reg(dev, E2P_CMD, val); 542 - if (unlikely(ret < 0)) 543 - return -EIO; 533 + if (unlikely(ret < 0)) { 534 + retval = -EIO; 535 + goto exit; 536 + } 544 537 545 - ret = lan78xx_wait_eeprom(dev); 546 - if (ret < 0) 547 - return ret; 538 + retval = lan78xx_wait_eeprom(dev); 539 + if (retval < 0) 540 + goto exit; 548 541 549 542 for (i = 0; i < length; i++) { 550 543 /* Fill data register */ 551 544 val = data[i]; 552 545 ret = lan78xx_write_reg(dev, E2P_DATA, val); 553 - if (ret < 0) 554 - return ret; 546 + if (ret < 0) { 547 + retval = -EIO; 548 + goto exit; 549 + } 555 550 556 551 /* Send "write" command */ 557 552 val = E2P_CMD_EPC_BUSY_ | E2P_CMD_EPC_CMD_WRITE_; 558 553 val |= (offset & E2P_CMD_EPC_ADDR_MASK_); 559 554 ret = lan78xx_write_reg(dev, E2P_CMD, val); 560 - if (ret < 0) 561 - return ret; 555 + if (ret < 0) { 556 + retval = -EIO; 557 + goto exit; 558 + } 562 559 563 - ret = lan78xx_wait_eeprom(dev); 564 - if (ret < 0) 565 - return ret; 560 + retval = lan78xx_wait_eeprom(dev); 561 + if (retval < 0) 562 + goto exit; 566 563 567 564 offset++; 568 565 } 569 566 570 - return 0; 567 + retval = 0; 568 + exit: 569 + if ((dev->devid & ID_REV_CHIP_ID_MASK_) == 0x78000000) 570 + ret = lan78xx_write_reg(dev, HW_CFG, saved); 571 + 572 + return retval; 571 573 } 572 574 573 575 static int lan78xx_read_raw_otp(struct lan78xx_net *dev, u32 offset, ··· 948 904 949 905 if (!phydev->link && dev->link_on) { 950 906 dev->link_on = false; 951 - netif_carrier_off(dev->net); 952 907 953 908 /* reset MAC */ 954 909 ret = lan78xx_read_reg(dev, MAC_CR, &buf); ··· 957 914 ret = lan78xx_write_reg(dev, MAC_CR, buf); 958 915 if (unlikely(ret < 0)) 959 916 return -EIO; 917 + 918 + phy_mac_interrupt(phydev, 0); 960 919 } else if (phydev->link && !dev->link_on) { 961 920 dev->link_on = true; 962 921 ··· 998 953 ethtool_cmd_speed(&ecmd), ecmd.duplex, ladv, radv); 999 954 1000 955 ret = lan78xx_update_flowcontrol(dev, ecmd.duplex, ladv, radv); 1001 - netif_carrier_on(dev->net); 956 + phy_mac_interrupt(phydev, 1); 1002 957 } 1003 958 1004 959 return ret; ··· 1540 1495 static int lan78xx_mdio_init(struct lan78xx_net *dev) 1541 1496 { 1542 1497 int ret; 1543 - int i; 1544 1498 1545 1499 dev->mdiobus = mdiobus_alloc(); 1546 1500 if (!dev->mdiobus) { ··· 1554 1510 1555 1511 snprintf(dev->mdiobus->id, MII_BUS_ID_SIZE, "usb-%03d:%03d", 1556 1512 dev->udev->bus->busnum, dev->udev->devnum); 1557 - 1558 - /* handle our own interrupt */ 1559 - for (i = 0; i < PHY_MAX_ADDR; i++) 1560 - dev->mdiobus->irq[i] = PHY_IGNORE_INTERRUPT; 1561 1513 1562 1514 switch (dev->devid & ID_REV_CHIP_ID_MASK_) { 1563 1515 case 0x78000000: ··· 1598 1558 return -EIO; 1599 1559 } 1600 1560 1561 + /* Enable PHY interrupts. 1562 + * We handle our own interrupt 1563 + */ 1564 + ret = phy_read(phydev, LAN88XX_INT_STS); 1565 + ret = phy_write(phydev, LAN88XX_INT_MASK, 1566 + LAN88XX_INT_MASK_MDINTPIN_EN_ | 1567 + LAN88XX_INT_MASK_LINK_CHANGE_); 1568 + 1569 + phydev->irq = PHY_IGNORE_INTERRUPT; 1570 + 1601 1571 ret = phy_connect_direct(dev->net, phydev, 1602 1572 lan78xx_link_status_change, 1603 1573 PHY_INTERFACE_MODE_GMII); ··· 1630 1580 SUPPORTED_Pause | SUPPORTED_Asym_Pause); 1631 1581 genphy_config_aneg(phydev); 1632 1582 1633 - /* Workaround to enable PHY interrupt. 1634 - * phy_start_interrupts() is API for requesting and enabling 1635 - * PHY interrupt. However, USB-to-Ethernet device can't use 1636 - * request_irq() called in phy_start_interrupts(). 1637 - * Set PHY to PHY_HALTED and call phy_start() 1638 - * to make a call to phy_enable_interrupts() 1639 - */ 1640 - phy_stop(phydev); 1641 1583 phy_start(phydev); 1642 1584 1643 1585 netif_dbg(dev, ifup, dev->net, "phy initialised successfully"); ··· 2263 2221 if (skb2) { 2264 2222 skb_queue_tail(&dev->txq_pend, skb2); 2265 2223 2266 - if (skb_queue_len(&dev->txq_pend) > 10) 2224 + /* throttle TX patch at slower than SUPER SPEED USB */ 2225 + if ((dev->udev->speed < USB_SPEED_SUPER) && 2226 + (skb_queue_len(&dev->txq_pend) > 10)) 2267 2227 netif_stop_queue(net); 2268 2228 } else { 2269 2229 netif_dbg(dev, tx_err, dev->net,
+17 -8
drivers/net/vxlan.c
··· 73 73 static int vxlan_net_id; 74 74 static struct rtnl_link_ops vxlan_link_ops; 75 75 76 - static const u8 all_zeros_mac[ETH_ALEN]; 76 + static const u8 all_zeros_mac[ETH_ALEN + 2]; 77 77 78 78 static int vxlan_sock_add(struct vxlan_dev *vxlan); 79 79 ··· 1985 1985 vxlan->cfg.port_max, true); 1986 1986 1987 1987 if (info) { 1988 - if (info->key.tun_flags & TUNNEL_CSUM) 1989 - flags |= VXLAN_F_UDP_CSUM; 1990 - else 1991 - flags &= ~VXLAN_F_UDP_CSUM; 1992 - 1993 1988 ttl = info->key.ttl; 1994 1989 tos = info->key.tos; 1995 1990 ··· 1999 2004 goto drop; 2000 2005 sk = vxlan->vn4_sock->sock->sk; 2001 2006 2002 - if (info && (info->key.tun_flags & TUNNEL_DONT_FRAGMENT)) 2003 - df = htons(IP_DF); 2007 + if (info) { 2008 + if (info->key.tun_flags & TUNNEL_DONT_FRAGMENT) 2009 + df = htons(IP_DF); 2010 + 2011 + if (info->key.tun_flags & TUNNEL_CSUM) 2012 + flags |= VXLAN_F_UDP_CSUM; 2013 + else 2014 + flags &= ~VXLAN_F_UDP_CSUM; 2015 + } 2004 2016 2005 2017 memset(&fl4, 0, sizeof(fl4)); 2006 2018 fl4.flowi4_oif = rdst ? rdst->remote_ifindex : 0; ··· 2101 2099 goto tx_error; 2102 2100 vxlan_encap_bypass(skb, vxlan, dst_vxlan); 2103 2101 return; 2102 + } 2103 + 2104 + if (info) { 2105 + if (info->key.tun_flags & TUNNEL_CSUM) 2106 + flags &= ~VXLAN_F_UDP_ZERO_CSUM6_TX; 2107 + else 2108 + flags |= VXLAN_F_UDP_ZERO_CSUM6_TX; 2104 2109 } 2105 2110 2106 2111 ttl = ttl ? : ip6_dst_hoplimit(ndst);
+6 -6
drivers/net/wireless/ath/ath9k/eeprom.c
··· 150 150 return -EIO; 151 151 } 152 152 153 - if (magic == AR5416_EEPROM_MAGIC) { 154 - *swap_needed = false; 155 - } else if (swab16(magic) == AR5416_EEPROM_MAGIC) { 153 + *swap_needed = false; 154 + if (swab16(magic) == AR5416_EEPROM_MAGIC) { 156 155 if (ah->ah_flags & AH_NO_EEP_SWAP) { 157 156 ath_info(common, 158 157 "Ignoring endianness difference in EEPROM magic bytes.\n"); 159 - 160 - *swap_needed = false; 161 158 } else { 162 159 *swap_needed = true; 163 160 } 164 - } else { 161 + } else if (magic != AR5416_EEPROM_MAGIC) { 162 + if (ath9k_hw_use_flash(ah)) 163 + return 0; 164 + 165 165 ath_err(common, 166 166 "Invalid EEPROM Magic (0x%04x).\n", magic); 167 167 return -EINVAL;
+15 -25
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
··· 879 879 return 0; 880 880 } 881 881 882 - static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev) 882 + void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev) 883 883 { 884 + struct sdio_func *func; 885 + struct mmc_host *host; 886 + uint max_blocks; 884 887 uint nents; 885 888 int err; 889 + 890 + func = sdiodev->func[2]; 891 + host = func->card->host; 892 + sdiodev->sg_support = host->max_segs > 1; 893 + max_blocks = min_t(uint, host->max_blk_count, 511u); 894 + sdiodev->max_request_size = min_t(uint, host->max_req_size, 895 + max_blocks * func->cur_blksize); 896 + sdiodev->max_segment_count = min_t(uint, host->max_segs, 897 + SG_MAX_SINGLE_ALLOC); 898 + sdiodev->max_segment_size = host->max_seg_size; 886 899 887 900 if (!sdiodev->sg_support) 888 901 return; ··· 1034 1021 1035 1022 static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) 1036 1023 { 1037 - struct sdio_func *func; 1038 - struct mmc_host *host; 1039 - uint max_blocks; 1040 1024 int ret = 0; 1041 1025 1042 1026 sdiodev->num_funcs = 2; ··· 1064 1054 goto out; 1065 1055 } 1066 1056 1067 - /* 1068 - * determine host related variables after brcmf_sdiod_probe() 1069 - * as func->cur_blksize is properly set and F2 init has been 1070 - * completed successfully. 1071 - */ 1072 - func = sdiodev->func[2]; 1073 - host = func->card->host; 1074 - sdiodev->sg_support = host->max_segs > 1; 1075 - max_blocks = min_t(uint, host->max_blk_count, 511u); 1076 - sdiodev->max_request_size = min_t(uint, host->max_req_size, 1077 - max_blocks * func->cur_blksize); 1078 - sdiodev->max_segment_count = min_t(uint, host->max_segs, 1079 - SG_MAX_SINGLE_ALLOC); 1080 - sdiodev->max_segment_size = host->max_seg_size; 1081 - 1082 - /* allocate scatter-gather table. sg support 1083 - * will be disabled upon allocation failure. 1084 - */ 1085 - brcmf_sdiod_sgtable_alloc(sdiodev); 1086 - 1087 1057 ret = brcmf_sdiod_freezer_attach(sdiodev); 1088 1058 if (ret) 1089 1059 goto out; ··· 1074 1084 ret = -ENODEV; 1075 1085 goto out; 1076 1086 } 1077 - brcmf_sdiod_host_fixup(host); 1087 + brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host); 1078 1088 out: 1079 1089 if (ret) 1080 1090 brcmf_sdiod_remove(sdiodev);
+1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/string.h> 19 19 #include <linux/netdevice.h> 20 + #include <linux/module.h> 20 21 #include <brcmu_wifi.h> 21 22 #include <brcmu_utils.h> 22 23 #include "core.h"
+5
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
··· 4114 4114 goto fail; 4115 4115 } 4116 4116 4117 + /* allocate scatter-gather table. sg support 4118 + * will be disabled upon allocation failure. 4119 + */ 4120 + brcmf_sdiod_sgtable_alloc(bus->sdiodev); 4121 + 4117 4122 /* Query the F2 block size, set roundup accordingly */ 4118 4123 bus->blocksize = bus->sdiodev->func[2]->cur_blksize; 4119 4124 bus->roundup = min(max_roundup, bus->blocksize);
+1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
··· 342 342 343 343 /* Issue an abort to the specified function */ 344 344 int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn); 345 + void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev); 345 346 void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev, 346 347 enum brcmf_sdiod_state state); 347 348 #ifdef CONFIG_PM_SLEEP
+19 -4
drivers/net/wireless/intel/iwlwifi/iwl-7000.c
··· 74 74 #define IWL7260_UCODE_API_MAX 17 75 75 #define IWL7265_UCODE_API_MAX 17 76 76 #define IWL7265D_UCODE_API_MAX 20 77 + #define IWL3168_UCODE_API_MAX 20 77 78 78 79 /* Oldest version we won't warn about */ 79 80 #define IWL7260_UCODE_API_OK 13 80 81 #define IWL7265_UCODE_API_OK 13 81 82 #define IWL7265D_UCODE_API_OK 13 83 + #define IWL3168_UCODE_API_OK 20 82 84 83 85 /* Lowest firmware API version supported */ 84 86 #define IWL7260_UCODE_API_MIN 13 85 87 #define IWL7265_UCODE_API_MIN 13 86 88 #define IWL7265D_UCODE_API_MIN 13 89 + #define IWL3168_UCODE_API_MIN 20 87 90 88 91 /* NVM versions */ 89 92 #define IWL7260_NVM_VERSION 0x0a1d ··· 95 92 #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ 96 93 #define IWL3165_NVM_VERSION 0x709 97 94 #define IWL3165_TX_POWER_VERSION 0xffff /* meaningless */ 95 + #define IWL3168_NVM_VERSION 0xd01 96 + #define IWL3168_TX_POWER_VERSION 0xffff /* meaningless */ 98 97 #define IWL7265_NVM_VERSION 0x0a1d 99 98 #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ 100 99 #define IWL7265D_NVM_VERSION 0x0c11 ··· 113 108 114 109 #define IWL3160_FW_PRE "iwlwifi-3160-" 115 110 #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" 111 + 112 + #define IWL3168_FW_PRE "iwlwifi-3168-" 113 + #define IWL3168_MODULE_FIRMWARE(api) IWL3168_FW_PRE __stringify(api) ".ucode" 116 114 117 115 #define IWL7265_FW_PRE "iwlwifi-7265-" 118 116 #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" ··· 187 179 .ucode_api_max = IWL7265_UCODE_API_MAX, \ 188 180 .ucode_api_ok = IWL7265_UCODE_API_OK, \ 189 181 .ucode_api_min = IWL7265_UCODE_API_MIN 182 + 183 + #define IWL_DEVICE_3008 \ 184 + IWL_DEVICE_7000_COMMON, \ 185 + .ucode_api_max = IWL3168_UCODE_API_MAX, \ 186 + .ucode_api_ok = IWL3168_UCODE_API_OK, \ 187 + .ucode_api_min = IWL3168_UCODE_API_MIN 190 188 191 189 #define IWL_DEVICE_7005D \ 192 190 IWL_DEVICE_7000_COMMON, \ ··· 313 299 314 300 const struct iwl_cfg iwl3168_2ac_cfg = { 315 301 .name = "Intel(R) Dual Band Wireless AC 3168", 316 - .fw_name_pre = IWL7265D_FW_PRE, 317 - IWL_DEVICE_7000, 302 + .fw_name_pre = IWL3168_FW_PRE, 303 + IWL_DEVICE_3008, 318 304 .ht_params = &iwl7000_ht_params, 319 - .nvm_ver = IWL3165_NVM_VERSION, 320 - .nvm_calib_ver = IWL3165_TX_POWER_VERSION, 305 + .nvm_ver = IWL3168_NVM_VERSION, 306 + .nvm_calib_ver = IWL3168_TX_POWER_VERSION, 321 307 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 322 308 .dccm_len = IWL7265_DCCM_LEN, 323 309 }; ··· 390 376 391 377 MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 392 378 MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 379 + MODULE_FIRMWARE(IWL3168_MODULE_FIRMWARE(IWL3168_UCODE_API_OK)); 393 380 MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7265_UCODE_API_OK)); 394 381 MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7265D_UCODE_API_OK));
+5 -1
drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
··· 510 510 * @scd_ssn: the index of the last contiguously sent packet 511 511 * @txed: number of Txed frames in this batch 512 512 * @txed_2_done: number of Acked frames in this batch 513 + * @reduced_txp: power reduced according to TPC. This is the actual value and 514 + * not a copy from the LQ command. Thus, if not the first rate was used 515 + * for Tx-ing then this value will be set to 0 by FW. 513 516 */ 514 517 struct iwl_mvm_ba_notif { 515 518 __le32 sta_addr_lo32; ··· 527 524 __le16 scd_ssn; 528 525 u8 txed; 529 526 u8 txed_2_done; 530 - __le16 reserved1; 527 + u8 reduced_txp; 528 + u8 reserved1; 531 529 } __packed; 532 530 533 531 /*
+48 -26
drivers/net/wireless/intel/iwlwifi/mvm/rs.c
··· 2 2 * 3 3 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 4 4 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 5 + * Copyright(c) 2016 Intel Deutschland GmbH 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify it 7 8 * under the terms of version 2 of the GNU General Public License as ··· 725 724 return 0; 726 725 } 727 726 728 - static int rs_collect_tx_data(struct iwl_mvm *mvm, 729 - struct iwl_lq_sta *lq_sta, 730 - struct iwl_scale_tbl_info *tbl, 731 - int scale_index, int attempts, int successes, 732 - u8 reduced_txp) 727 + static int rs_collect_tpc_data(struct iwl_mvm *mvm, 728 + struct iwl_lq_sta *lq_sta, 729 + struct iwl_scale_tbl_info *tbl, 730 + int scale_index, int attempts, int successes, 731 + u8 reduced_txp) 733 732 { 734 733 struct iwl_rate_scale_data *window = NULL; 735 - int ret; 734 + 735 + if (WARN_ON_ONCE(reduced_txp > TPC_MAX_REDUCTION)) 736 + return -EINVAL; 737 + 738 + window = &tbl->tpc_win[reduced_txp]; 739 + return _rs_collect_tx_data(mvm, tbl, scale_index, attempts, successes, 740 + window); 741 + } 742 + 743 + static int rs_collect_tlc_data(struct iwl_mvm *mvm, 744 + struct iwl_lq_sta *lq_sta, 745 + struct iwl_scale_tbl_info *tbl, 746 + int scale_index, int attempts, int successes) 747 + { 748 + struct iwl_rate_scale_data *window = NULL; 736 749 737 750 if (scale_index < 0 || scale_index >= IWL_RATE_COUNT) 738 751 return -EINVAL; ··· 760 745 761 746 /* Select window for current tx bit rate */ 762 747 window = &(tbl->win[scale_index]); 763 - 764 - ret = _rs_collect_tx_data(mvm, tbl, scale_index, attempts, successes, 765 - window); 766 - if (ret) 767 - return ret; 768 - 769 - if (WARN_ON_ONCE(reduced_txp > TPC_MAX_REDUCTION)) 770 - return -EINVAL; 771 - 772 - window = &tbl->tpc_win[reduced_txp]; 773 748 return _rs_collect_tx_data(mvm, tbl, scale_index, attempts, successes, 774 749 window); 775 750 } ··· 1306 1301 * first index into rate scale table. 1307 1302 */ 1308 1303 if (info->flags & IEEE80211_TX_STAT_AMPDU) { 1309 - /* ampdu_ack_len = 0 marks no BA was received. In this case 1310 - * treat it as a single frame loss as we don't want the success 1311 - * ratio to dip too quickly because a BA wasn't received 1304 + rs_collect_tpc_data(mvm, lq_sta, curr_tbl, lq_rate.index, 1305 + info->status.ampdu_len, 1306 + info->status.ampdu_ack_len, 1307 + reduced_txp); 1308 + 1309 + /* ampdu_ack_len = 0 marks no BA was received. For TLC, treat 1310 + * it as a single frame loss as we don't want the success ratio 1311 + * to dip too quickly because a BA wasn't received. 1312 + * For TPC, there's no need for this optimisation since we want 1313 + * to recover very quickly from a bad power reduction and, 1314 + * therefore we'd like the success ratio to get an immediate hit 1315 + * when failing to get a BA, so we'd switch back to a lower or 1316 + * zero power reduction. When FW transmits agg with a rate 1317 + * different from the initial rate, it will not use reduced txp 1318 + * and will send BA notification twice (one empty with reduced 1319 + * txp equal to the value from LQ and one with reduced txp 0). 1320 + * We need to update counters for each txp level accordingly. 1312 1321 */ 1313 1322 if (info->status.ampdu_ack_len == 0) 1314 1323 info->status.ampdu_len = 1; 1315 1324 1316 - rs_collect_tx_data(mvm, lq_sta, curr_tbl, lq_rate.index, 1317 - info->status.ampdu_len, 1318 - info->status.ampdu_ack_len, 1319 - reduced_txp); 1325 + rs_collect_tlc_data(mvm, lq_sta, curr_tbl, lq_rate.index, 1326 + info->status.ampdu_len, 1327 + info->status.ampdu_ack_len); 1320 1328 1321 1329 /* Update success/fail counts if not searching for new mode */ 1322 1330 if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { ··· 1362 1344 else 1363 1345 continue; 1364 1346 1365 - rs_collect_tx_data(mvm, lq_sta, tmp_tbl, lq_rate.index, 1366 - 1, i < retries ? 0 : legacy_success, 1367 - reduced_txp); 1347 + rs_collect_tpc_data(mvm, lq_sta, tmp_tbl, 1348 + lq_rate.index, 1, 1349 + i < retries ? 0 : legacy_success, 1350 + reduced_txp); 1351 + rs_collect_tlc_data(mvm, lq_sta, tmp_tbl, 1352 + lq_rate.index, 1, 1353 + i < retries ? 0 : legacy_success); 1368 1354 } 1369 1355 1370 1356 /* Update success/fail counts if not searching for new mode */
+3 -2
drivers/net/wireless/intel/iwlwifi/mvm/tx.c
··· 1029 1029 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 1030 1030 mvmsta->tid_data[tid].rate_n_flags = 1031 1031 le32_to_cpu(tx_resp->initial_rate); 1032 - mvmsta->tid_data[tid].reduced_tpc = tx_resp->reduced_tpc; 1033 1032 mvmsta->tid_data[tid].tx_time = 1034 1033 le16_to_cpu(tx_resp->wireless_media_time); 1035 1034 } ··· 1059 1060 /* TODO: not accounted if the whole A-MPDU failed */ 1060 1061 info->status.tx_time = tid_data->tx_time; 1061 1062 info->status.status_driver_data[0] = 1062 - (void *)(uintptr_t)tid_data->reduced_tpc; 1063 + (void *)(uintptr_t)ba_notif->reduced_txp; 1063 1064 info->status.status_driver_data[1] = 1064 1065 (void *)(uintptr_t)tid_data->rate_n_flags; 1065 1066 } ··· 1132 1133 scd_flow, ba_resp_scd_ssn, ba_notif->txed, 1133 1134 ba_notif->txed_2_done); 1134 1135 1136 + IWL_DEBUG_TX_REPLY(mvm, "reduced txp from ba notif %d\n", 1137 + ba_notif->reduced_txp); 1135 1138 tid_data->next_reclaimed = ba_resp_scd_ssn; 1136 1139 1137 1140 iwl_mvm_check_ratid_empty(mvm, sta, tid);
+4
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 378 378 {IWL_PCI_DEVICE(0x3165, 0x8110, iwl3165_2ac_cfg)}, 379 379 380 380 /* 3168 Series */ 381 + {IWL_PCI_DEVICE(0x24FB, 0x2010, iwl3168_2ac_cfg)}, 381 382 {IWL_PCI_DEVICE(0x24FB, 0x2110, iwl3168_2ac_cfg)}, 383 + {IWL_PCI_DEVICE(0x24FB, 0x2050, iwl3168_2ac_cfg)}, 384 + {IWL_PCI_DEVICE(0x24FB, 0x2150, iwl3168_2ac_cfg)}, 382 385 {IWL_PCI_DEVICE(0x24FB, 0x0000, iwl3168_2ac_cfg)}, 383 386 384 387 /* 7265 Series */ ··· 478 475 {IWL_PCI_DEVICE(0x24F3, 0x0000, iwl8265_2ac_cfg)}, 479 476 {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)}, 480 477 {IWL_PCI_DEVICE(0x24FD, 0x8010, iwl8265_2ac_cfg)}, 478 + {IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)}, 481 479 482 480 /* 9000 Series */ 483 481 {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)},
+3 -2
drivers/net/wireless/mac80211_hwsim.c
··· 991 991 goto nla_put_failure; 992 992 } 993 993 994 - if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, ETH_ALEN, hdr->addr2)) 994 + if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, 995 + ETH_ALEN, data->addresses[1].addr)) 995 996 goto nla_put_failure; 996 997 997 998 /* We get the skb->data */ ··· 2737 2736 2738 2737 spin_lock_bh(&hwsim_radio_lock); 2739 2738 list_for_each_entry(data, &hwsim_radios, list) { 2740 - if (mac80211_hwsim_addr_match(data, addr)) { 2739 + if (memcmp(data->addresses[1].addr, addr, ETH_ALEN) == 0) { 2741 2740 _found = true; 2742 2741 break; 2743 2742 }
+3 -1
drivers/net/wireless/ralink/rt2x00/rt2400pci.c
··· 273 273 !(filter_flags & FIF_PLCPFAIL)); 274 274 rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL, 275 275 !(filter_flags & FIF_CONTROL)); 276 - rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1); 276 + rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 277 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags)); 277 278 rt2x00_set_field32(&reg, RXCSR0_DROP_TODS, 279 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags) && 278 280 !rt2x00dev->intf_ap_count); 279 281 rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1); 280 282 rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
+3 -1
drivers/net/wireless/ralink/rt2x00/rt2500pci.c
··· 274 274 !(filter_flags & FIF_PLCPFAIL)); 275 275 rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL, 276 276 !(filter_flags & FIF_CONTROL)); 277 - rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1); 277 + rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 278 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags)); 278 279 rt2x00_set_field32(&reg, RXCSR0_DROP_TODS, 280 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags) && 279 281 !rt2x00dev->intf_ap_count); 280 282 rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1); 281 283 rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
+3 -1
drivers/net/wireless/ralink/rt2x00/rt2500usb.c
··· 437 437 !(filter_flags & FIF_PLCPFAIL)); 438 438 rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL, 439 439 !(filter_flags & FIF_CONTROL)); 440 - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1); 440 + rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 441 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags)); 441 442 rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS, 443 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags) && 442 444 !rt2x00dev->intf_ap_count); 443 445 rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1); 444 446 rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
+2 -1
drivers/net/wireless/ralink/rt2x00/rt2800lib.c
··· 1490 1490 !(filter_flags & FIF_FCSFAIL)); 1491 1491 rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR, 1492 1492 !(filter_flags & FIF_PLCPFAIL)); 1493 - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1); 1493 + rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1494 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags)); 1494 1495 rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0); 1495 1496 rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1); 1496 1497 rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
+1
drivers/net/wireless/ralink/rt2x00/rt2x00.h
··· 669 669 CONFIG_POWERSAVING, 670 670 CONFIG_HT_DISABLED, 671 671 CONFIG_QOS_DISABLED, 672 + CONFIG_MONITORING, 672 673 673 674 /* 674 675 * Mark we currently are sequentially reading TX_STA_FIFO register
+5
drivers/net/wireless/ralink/rt2x00/rt2x00config.c
··· 277 277 else 278 278 clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); 279 279 280 + if (conf->flags & IEEE80211_CONF_MONITOR) 281 + set_bit(CONFIG_MONITORING, &rt2x00dev->flags); 282 + else 283 + clear_bit(CONFIG_MONITORING, &rt2x00dev->flags); 284 + 280 285 rt2x00dev->curr_band = conf->chandef.chan->band; 281 286 rt2x00dev->curr_freq = conf->chandef.chan->center_freq; 282 287 rt2x00dev->tx_power = conf->power_level;
-5
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
··· 385 385 *total_flags |= FIF_PSPOLL; 386 386 } 387 387 388 - /* 389 - * Check if there is any work left for us. 390 - */ 391 - if (rt2x00dev->packet_filter == *total_flags) 392 - return; 393 388 rt2x00dev->packet_filter = *total_flags; 394 389 395 390 rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
+3 -1
drivers/net/wireless/ralink/rt2x00/rt61pci.c
··· 530 530 !(filter_flags & FIF_PLCPFAIL)); 531 531 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL, 532 532 !(filter_flags & (FIF_CONTROL | FIF_PSPOLL))); 533 - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1); 533 + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 534 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags)); 534 535 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS, 536 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags) && 535 537 !rt2x00dev->intf_ap_count); 536 538 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1); 537 539 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
+3 -1
drivers/net/wireless/ralink/rt2x00/rt73usb.c
··· 480 480 !(filter_flags & FIF_PLCPFAIL)); 481 481 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL, 482 482 !(filter_flags & (FIF_CONTROL | FIF_PSPOLL))); 483 - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1); 483 + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 484 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags)); 484 485 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS, 486 + !test_bit(CONFIG_MONITORING, &rt2x00dev->flags) && 485 487 !rt2x00dev->intf_ap_count); 486 488 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1); 487 489 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
+1 -1
drivers/net/wireless/realtek/rtlwifi/regd.c
··· 351 351 case COUNTRY_CODE_SPAIN: 352 352 case COUNTRY_CODE_FRANCE: 353 353 case COUNTRY_CODE_ISRAEL: 354 - case COUNTRY_CODE_WORLD_WIDE_13: 355 354 return &rtl_regdom_12_13; 356 355 case COUNTRY_CODE_MKK: 357 356 case COUNTRY_CODE_MKK1: ··· 359 360 return &rtl_regdom_14_60_64; 360 361 case COUNTRY_CODE_GLOBAL_DOMAIN: 361 362 return &rtl_regdom_14; 363 + case COUNTRY_CODE_WORLD_WIDE_13: 362 364 case COUNTRY_CODE_WORLD_WIDE_13_5G_ALL: 363 365 return &rtl_regdom_12_13_5g_all; 364 366 default:
+3 -12
drivers/net/xen-netfront.c
··· 364 364 RING_IDX cons, prod; 365 365 unsigned short id; 366 366 struct sk_buff *skb; 367 + bool more_to_do; 367 368 368 369 BUG_ON(!netif_carrier_ok(queue->info->netdev)); 369 370 ··· 399 398 400 399 queue->tx.rsp_cons = prod; 401 400 402 - /* 403 - * Set a new event, then check for race with update of tx_cons. 404 - * Note that it is essential to schedule a callback, no matter 405 - * how few buffers are pending. Even if there is space in the 406 - * transmit ring, higher layers may be blocked because too much 407 - * data is outstanding: in such cases notification from Xen is 408 - * likely to be the only kick that we'll get. 409 - */ 410 - queue->tx.sring->rsp_event = 411 - prod + ((queue->tx.sring->req_prod - prod) >> 1) + 1; 412 - mb(); /* update shared area */ 413 - } while ((cons == prod) && (prod != queue->tx.sring->rsp_prod)); 401 + RING_FINAL_CHECK_FOR_RESPONSES(&queue->tx, more_to_do); 402 + } while (more_to_do); 414 403 415 404 xennet_maybe_wake_tx(queue); 416 405 }
+36 -1
drivers/of/of_mdio.c
··· 143 143 } 144 144 EXPORT_SYMBOL(of_mdio_parse_addr); 145 145 146 + /* The following is a list of PHY compatible strings which appear in 147 + * some DTBs. The compatible string is never matched against a PHY 148 + * driver, so is pointless. We only expect devices which are not PHYs 149 + * to have a compatible string, so they can be matched to an MDIO 150 + * driver. Encourage users to upgrade their DT blobs to remove these. 151 + */ 152 + static const struct of_device_id whitelist_phys[] = { 153 + { .compatible = "brcm,40nm-ephy" }, 154 + { .compatible = "marvell,88E1111", }, 155 + { .compatible = "marvell,88e1116", }, 156 + { .compatible = "marvell,88e1118", }, 157 + { .compatible = "marvell,88e1149r", }, 158 + { .compatible = "marvell,88e1310", }, 159 + { .compatible = "marvell,88E1510", }, 160 + { .compatible = "marvell,88E1514", }, 161 + { .compatible = "moxa,moxart-rtl8201cp", }, 162 + {} 163 + }; 164 + 146 165 /* 147 166 * Return true if the child node is for a phy. It must either: 148 167 * o Compatible string of "ethernet-phy-idX.X" 149 168 * o Compatible string of "ethernet-phy-ieee802.3-c45" 150 169 * o Compatible string of "ethernet-phy-ieee802.3-c22" 170 + * o In the white list above (and issue a warning) 151 171 * o No compatibility string 152 172 * 153 173 * A device which is not a phy is expected to have a compatible string ··· 185 165 186 166 if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c22")) 187 167 return true; 168 + 169 + if (of_match_node(whitelist_phys, child)) { 170 + pr_warn(FW_WARN 171 + "%s: Whitelisted compatible string. Please remove\n", 172 + child->full_name); 173 + return true; 174 + } 188 175 189 176 if (!of_find_property(child, "compatible", NULL)) 190 177 return true; ··· 283 256 struct phy_device *of_phy_find_device(struct device_node *phy_np) 284 257 { 285 258 struct device *d; 259 + struct mdio_device *mdiodev; 260 + 286 261 if (!phy_np) 287 262 return NULL; 288 263 289 264 d = bus_find_device(&mdio_bus_type, NULL, phy_np, of_phy_match); 290 - return d ? to_phy_device(d) : NULL; 265 + if (d) { 266 + mdiodev = to_mdio_device(d); 267 + if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) 268 + return to_phy_device(d); 269 + } 270 + 271 + return NULL; 291 272 } 292 273 EXPORT_SYMBOL(of_phy_find_device); 293 274
+2 -5
drivers/ptp/ptp_ixp46x.c
··· 178 178 static int ptp_ixp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) 179 179 { 180 180 u64 ns; 181 - u32 remainder; 182 181 unsigned long flags; 183 182 struct ixp_clock *ixp_clock = container_of(ptp, struct ixp_clock, caps); 184 183 struct ixp46x_ts_regs *regs = ixp_clock->regs; ··· 188 189 189 190 spin_unlock_irqrestore(&register_lock, flags); 190 191 191 - ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); 192 - ts->tv_nsec = remainder; 192 + *ts = ns_to_timespec64(ns); 193 193 return 0; 194 194 } 195 195 ··· 200 202 struct ixp_clock *ixp_clock = container_of(ptp, struct ixp_clock, caps); 201 203 struct ixp46x_ts_regs *regs = ixp_clock->regs; 202 204 203 - ns = ts->tv_sec * 1000000000ULL; 204 - ns += ts->tv_nsec; 205 + ns = timespec64_to_ns(ts); 205 206 206 207 spin_lock_irqsave(&register_lock, flags); 207 208
+4 -3
drivers/ssb/main.c
··· 613 613 return err; 614 614 } 615 615 616 - static int ssb_bus_register(struct ssb_bus *bus, 617 - ssb_invariants_func_t get_invariants, 618 - unsigned long baseaddr) 616 + static int __maybe_unused 617 + ssb_bus_register(struct ssb_bus *bus, 618 + ssb_invariants_func_t get_invariants, 619 + unsigned long baseaddr) 619 620 { 620 621 int err; 621 622
+3
fs/compat_ioctl.c
··· 1261 1261 COMPATIBLE_IOCTL(HCIINQUIRY) 1262 1262 COMPATIBLE_IOCTL(HCIUARTSETPROTO) 1263 1263 COMPATIBLE_IOCTL(HCIUARTGETPROTO) 1264 + COMPATIBLE_IOCTL(HCIUARTGETDEVICE) 1265 + COMPATIBLE_IOCTL(HCIUARTSETFLAGS) 1266 + COMPATIBLE_IOCTL(HCIUARTGETFLAGS) 1264 1267 COMPATIBLE_IOCTL(RFCOMMCREATEDEV) 1265 1268 COMPATIBLE_IOCTL(RFCOMMRELEASEDEV) 1266 1269 COMPATIBLE_IOCTL(RFCOMMGETDEVLIST)
+5 -6
include/linux/netdevice.h
··· 512 512 clear_bit(NAPI_STATE_NPSVC, &n->state); 513 513 } 514 514 515 - #ifdef CONFIG_SMP 516 515 /** 517 516 * napi_synchronize - wait until NAPI is not running 518 517 * @n: napi context ··· 522 523 */ 523 524 static inline void napi_synchronize(const struct napi_struct *n) 524 525 { 525 - while (test_bit(NAPI_STATE_SCHED, &n->state)) 526 - msleep(1); 526 + if (IS_ENABLED(CONFIG_SMP)) 527 + while (test_bit(NAPI_STATE_SCHED, &n->state)) 528 + msleep(1); 529 + else 530 + barrier(); 527 531 } 528 - #else 529 - # define napi_synchronize(n) barrier() 530 - #endif 531 532 532 533 enum netdev_queue_state_t { 533 534 __QUEUE_STATE_DRV_XOFF,
+6
include/net/bluetooth/l2cap.h
··· 252 252 #define L2CAP_PSM_3DSP 0x0021 253 253 #define L2CAP_PSM_IPSP 0x0023 /* 6LoWPAN */ 254 254 255 + #define L2CAP_PSM_DYN_START 0x1001 256 + #define L2CAP_PSM_DYN_END 0xffff 257 + #define L2CAP_PSM_AUTO_END 0x10ff 258 + #define L2CAP_PSM_LE_DYN_START 0x0080 259 + #define L2CAP_PSM_LE_DYN_END 0x00ff 260 + 255 261 /* channel identifier */ 256 262 #define L2CAP_CID_SIGNALING 0x0001 257 263 #define L2CAP_CID_CONN_LESS 0x0002
+18
include/net/dst_metadata.h
··· 44 44 return dst && !(dst->flags & DST_METADATA); 45 45 } 46 46 47 + static inline int skb_metadata_dst_cmp(const struct sk_buff *skb_a, 48 + const struct sk_buff *skb_b) 49 + { 50 + const struct metadata_dst *a, *b; 51 + 52 + if (!(skb_a->_skb_refdst | skb_b->_skb_refdst)) 53 + return 0; 54 + 55 + a = (const struct metadata_dst *) skb_dst(skb_a); 56 + b = (const struct metadata_dst *) skb_dst(skb_b); 57 + 58 + if (!a != !b || a->u.tun_info.options_len != b->u.tun_info.options_len) 59 + return 1; 60 + 61 + return memcmp(&a->u.tun_info, &b->u.tun_info, 62 + sizeof(a->u.tun_info) + a->u.tun_info.options_len); 63 + } 64 + 47 65 struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags); 48 66 struct metadata_dst __percpu *metadata_dst_alloc_percpu(u8 optslen, gfp_t flags); 49 67
+10 -2
include/net/ip6_route.h
··· 64 64 65 65 void ip6_route_input(struct sk_buff *skb); 66 66 67 - struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk, 68 - struct flowi6 *fl6); 67 + struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk, 68 + struct flowi6 *fl6, int flags); 69 + 70 + static inline struct dst_entry *ip6_route_output(struct net *net, 71 + const struct sock *sk, 72 + struct flowi6 *fl6) 73 + { 74 + return ip6_route_output_flags(net, sk, fl6, 0); 75 + } 76 + 69 77 struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6, 70 78 int flags); 71 79
+3 -5
include/net/netfilter/nf_conntrack_core.h
··· 79 79 const struct nf_conntrack_l3proto *l3proto, 80 80 const struct nf_conntrack_l4proto *proto); 81 81 82 - #ifdef CONFIG_LOCKDEP 83 - # define CONNTRACK_LOCKS 8 84 - #else 85 - # define CONNTRACK_LOCKS 1024 86 - #endif 82 + #define CONNTRACK_LOCKS 1024 83 + 87 84 extern spinlock_t nf_conntrack_locks[CONNTRACK_LOCKS]; 85 + void nf_conntrack_lock(spinlock_t *lock); 88 86 89 87 extern spinlock_t nf_conntrack_expect_lock; 90 88
+2 -3
include/net/sctp/structs.h
··· 756 756 757 757 /* Reference counting. */ 758 758 atomic_t refcnt; 759 - __u32 dead:1, 760 759 /* RTO-Pending : A flag used to track if one of the DATA 761 760 * chunks sent to this address is currently being 762 761 * used to compute a RTT. If this flag is 0, ··· 765 766 * calculation completes (i.e. the DATA chunk 766 767 * is SACK'd) clear this flag. 767 768 */ 768 - rto_pending:1, 769 + __u32 rto_pending:1, 769 770 770 771 /* 771 772 * hb_sent : a flag that signals that we have a pending ··· 954 955 void sctp_transport_pmtu(struct sctp_transport *, struct sock *sk); 955 956 void sctp_transport_free(struct sctp_transport *); 956 957 void sctp_transport_reset_timers(struct sctp_transport *); 957 - void sctp_transport_hold(struct sctp_transport *); 958 + int sctp_transport_hold(struct sctp_transport *); 958 959 void sctp_transport_put(struct sctp_transport *); 959 960 void sctp_transport_update_rto(struct sctp_transport *, __u32); 960 961 void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
-12
include/net/sock.h
··· 1036 1036 #ifdef SOCK_REFCNT_DEBUG 1037 1037 atomic_t socks; 1038 1038 #endif 1039 - #ifdef CONFIG_MEMCG_KMEM 1040 - /* 1041 - * cgroup specific init/deinit functions. Called once for all 1042 - * protocols that implement it, from cgroups populate function. 1043 - * This function has to setup any files the protocol want to 1044 - * appear in the kmem cgroup filesystem. 1045 - */ 1046 - int (*init_cgroup)(struct mem_cgroup *memcg, 1047 - struct cgroup_subsys *ss); 1048 - void (*destroy_cgroup)(struct mem_cgroup *memcg); 1049 - struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg); 1050 - #endif 1051 1039 int (*diag_destroy)(struct sock *sk, int err); 1052 1040 }; 1053 1041
+1 -1
include/net/sock_reuseport.h
··· 16 16 }; 17 17 18 18 extern int reuseport_alloc(struct sock *sk); 19 - extern int reuseport_add_sock(struct sock *sk, const struct sock *sk2); 19 + extern int reuseport_add_sock(struct sock *sk, struct sock *sk2); 20 20 extern void reuseport_detach_sock(struct sock *sk); 21 21 extern struct sock *reuseport_select_sock(struct sock *sk, 22 22 u32 hash,
+1 -1
include/net/tcp.h
··· 216 216 /* TCP thin-stream limits */ 217 217 #define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */ 218 218 219 - /* TCP initial congestion window as per draft-hkchu-tcpm-initcwnd-01 */ 219 + /* TCP initial congestion window as per rfc6928 */ 220 220 #define TCP_INIT_CWND 10 221 221 222 222 /* Bit Flags for sysctl_tcp_fastopen */
+6 -1
net/bluetooth/6lowpan.c
··· 307 307 308 308 /* check that it's our buffer */ 309 309 if (lowpan_is_ipv6(*skb_network_header(skb))) { 310 + /* Pull off the 1-byte of 6lowpan header. */ 311 + skb_pull(skb, 1); 312 + 310 313 /* Copy the packet so that the IPv6 header is 311 314 * properly aligned. 312 315 */ ··· 320 317 321 318 local_skb->protocol = htons(ETH_P_IPV6); 322 319 local_skb->pkt_type = PACKET_HOST; 320 + local_skb->dev = dev; 323 321 324 322 skb_set_transport_header(local_skb, sizeof(struct ipv6hdr)); 325 323 ··· 339 335 if (!local_skb) 340 336 goto drop; 341 337 338 + local_skb->dev = dev; 339 + 342 340 ret = iphc_decompress(local_skb, dev, chan); 343 341 if (ret < 0) { 344 342 kfree_skb(local_skb); ··· 349 343 350 344 local_skb->protocol = htons(ETH_P_IPV6); 351 345 local_skb->pkt_type = PACKET_HOST; 352 - local_skb->dev = dev; 353 346 354 347 if (give_skb_to_upper(local_skb, dev) 355 348 != NET_RX_SUCCESS) {
+18 -10
net/bluetooth/hci_request.c
··· 688 688 * command to remove it from the controller. 689 689 */ 690 690 list_for_each_entry(b, &hdev->le_white_list, list) { 691 - struct hci_cp_le_del_from_white_list cp; 691 + /* If the device is neither in pend_le_conns nor 692 + * pend_le_reports then remove it from the whitelist. 693 + */ 694 + if (!hci_pend_le_action_lookup(&hdev->pend_le_conns, 695 + &b->bdaddr, b->bdaddr_type) && 696 + !hci_pend_le_action_lookup(&hdev->pend_le_reports, 697 + &b->bdaddr, b->bdaddr_type)) { 698 + struct hci_cp_le_del_from_white_list cp; 692 699 693 - if (hci_pend_le_action_lookup(&hdev->pend_le_conns, 694 - &b->bdaddr, b->bdaddr_type) || 695 - hci_pend_le_action_lookup(&hdev->pend_le_reports, 696 - &b->bdaddr, b->bdaddr_type)) { 697 - white_list_entries++; 700 + cp.bdaddr_type = b->bdaddr_type; 701 + bacpy(&cp.bdaddr, &b->bdaddr); 702 + 703 + hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, 704 + sizeof(cp), &cp); 698 705 continue; 699 706 } 700 707 701 - cp.bdaddr_type = b->bdaddr_type; 702 - bacpy(&cp.bdaddr, &b->bdaddr); 708 + if (hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) { 709 + /* White list can not be used with RPAs */ 710 + return 0x00; 711 + } 703 712 704 - hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, 705 - sizeof(cp), &cp); 713 + white_list_entries++; 706 714 } 707 715 708 716 /* Since all no longer valid white list entries have been
+12 -2
net/bluetooth/l2cap_core.c
··· 197 197 chan->sport = psm; 198 198 err = 0; 199 199 } else { 200 - u16 p; 200 + u16 p, start, end, incr; 201 + 202 + if (chan->src_type == BDADDR_BREDR) { 203 + start = L2CAP_PSM_DYN_START; 204 + end = L2CAP_PSM_AUTO_END; 205 + incr = 2; 206 + } else { 207 + start = L2CAP_PSM_LE_DYN_START; 208 + end = L2CAP_PSM_LE_DYN_END; 209 + incr = 1; 210 + } 201 211 202 212 err = -EINVAL; 203 - for (p = 0x1001; p < 0x1100; p += 2) 213 + for (p = start; p <= end; p += incr) 204 214 if (!__l2cap_global_chan_by_addr(cpu_to_le16(p), src)) { 205 215 chan->psm = cpu_to_le16(p); 206 216 chan->sport = cpu_to_le16(p);
+6 -6
net/bluetooth/l2cap_sock.c
··· 58 58 return -EINVAL; 59 59 60 60 /* Restrict usage of well-known PSMs */ 61 - if (psm < 0x1001 && !capable(CAP_NET_BIND_SERVICE)) 61 + if (psm < L2CAP_PSM_DYN_START && !capable(CAP_NET_BIND_SERVICE)) 62 62 return -EACCES; 63 63 64 64 return 0; ··· 67 67 static int l2cap_validate_le_psm(u16 psm) 68 68 { 69 69 /* Valid LE_PSM ranges are defined only until 0x00ff */ 70 - if (psm > 0x00ff) 70 + if (psm > L2CAP_PSM_LE_DYN_END) 71 71 return -EINVAL; 72 72 73 73 /* Restrict fixed, SIG assigned PSM values to CAP_NET_BIND_SERVICE */ 74 - if (psm <= 0x007f && !capable(CAP_NET_BIND_SERVICE)) 74 + if (psm < L2CAP_PSM_LE_DYN_START && !capable(CAP_NET_BIND_SERVICE)) 75 75 return -EACCES; 76 76 77 77 return 0; ··· 125 125 goto done; 126 126 } 127 127 128 + bacpy(&chan->src, &la.l2_bdaddr); 129 + chan->src_type = la.l2_bdaddr_type; 130 + 128 131 if (la.l2_cid) 129 132 err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid)); 130 133 else ··· 158 155 set_bit(FLAG_HOLD_HCI_CONN, &chan->flags); 159 156 break; 160 157 } 161 - 162 - bacpy(&chan->src, &la.l2_bdaddr); 163 - chan->src_type = la.l2_bdaddr_type; 164 158 165 159 if (chan->psm && bdaddr_type_is_le(chan->src_type)) 166 160 chan->mode = L2CAP_MODE_LE_FLOWCTL;
-16
net/bluetooth/smp.c
··· 1072 1072 hcon->dst_type = smp->remote_irk->addr_type; 1073 1073 queue_work(hdev->workqueue, &conn->id_addr_update_work); 1074 1074 } 1075 - 1076 - /* When receiving an indentity resolving key for 1077 - * a remote device that does not use a resolvable 1078 - * private address, just remove the key so that 1079 - * it is possible to use the controller white 1080 - * list for scanning. 1081 - * 1082 - * Userspace will have been told to not store 1083 - * this key at this point. So it is safe to 1084 - * just remove it. 1085 - */ 1086 - if (!bacmp(&smp->remote_irk->rpa, BDADDR_ANY)) { 1087 - list_del_rcu(&smp->remote_irk->list); 1088 - kfree_rcu(smp->remote_irk, rcu); 1089 - smp->remote_irk = NULL; 1090 - } 1091 1075 } 1092 1076 1093 1077 if (smp->csrk) {
+1 -2
net/bridge/br.c
··· 121 121 .notifier_call = br_device_event 122 122 }; 123 123 124 + /* called with RTNL */ 124 125 static int br_switchdev_event(struct notifier_block *unused, 125 126 unsigned long event, void *ptr) 126 127 { ··· 131 130 struct switchdev_notifier_fdb_info *fdb_info; 132 131 int err = NOTIFY_DONE; 133 132 134 - rtnl_lock(); 135 133 p = br_port_get_rtnl(dev); 136 134 if (!p) 137 135 goto out; ··· 155 155 } 156 156 157 157 out: 158 - rtnl_unlock(); 159 158 return err; 160 159 } 161 160
+5 -2
net/core/dev.c
··· 4351 4351 4352 4352 diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev; 4353 4353 diffs |= p->vlan_tci ^ skb->vlan_tci; 4354 + diffs |= skb_metadata_dst_cmp(p, skb); 4354 4355 if (maclen == ETH_HLEN) 4355 4356 diffs |= compare_ether_header(skb_mac_header(p), 4356 4357 skb_mac_header(skb)); ··· 4549 4548 break; 4550 4549 4551 4550 case GRO_MERGED_FREE: 4552 - if (NAPI_GRO_CB(skb)->free == NAPI_GRO_FREE_STOLEN_HEAD) 4551 + if (NAPI_GRO_CB(skb)->free == NAPI_GRO_FREE_STOLEN_HEAD) { 4552 + skb_dst_drop(skb); 4553 4553 kmem_cache_free(skbuff_head_cache, skb); 4554 - else 4554 + } else { 4555 4555 __kfree_skb(skb); 4556 + } 4556 4557 break; 4557 4558 4558 4559 case GRO_HELD:
+8 -1
net/core/sock_reuseport.c
··· 93 93 * @sk2: Socket belonging to the existing reuseport group. 94 94 * May return ENOMEM and not add socket to group under memory pressure. 95 95 */ 96 - int reuseport_add_sock(struct sock *sk, const struct sock *sk2) 96 + int reuseport_add_sock(struct sock *sk, struct sock *sk2) 97 97 { 98 98 struct sock_reuseport *reuse; 99 + 100 + if (!rcu_access_pointer(sk2->sk_reuseport_cb)) { 101 + int err = reuseport_alloc(sk2); 102 + 103 + if (err) 104 + return err; 105 + } 99 106 100 107 spin_lock_bh(&reuseport_lock); 101 108 reuse = rcu_dereference_protected(sk2->sk_reuseport_cb,
+1
net/ipv4/Kconfig
··· 353 353 select CRYPTO_CBC 354 354 select CRYPTO_SHA1 355 355 select CRYPTO_DES 356 + select CRYPTO_ECHAINIV 356 357 ---help--- 357 358 Support for IPsec ESP. 358 359
+4 -3
net/ipv4/fib_trie.c
··· 1394 1394 struct fib_info *fi = fa->fa_info; 1395 1395 int nhsel, err; 1396 1396 1397 - if ((index >= (1ul << fa->fa_slen)) && 1398 - ((BITS_PER_LONG > KEYLENGTH) || (fa->fa_slen != KEYLENGTH))) 1399 - continue; 1397 + if ((BITS_PER_LONG > KEYLENGTH) || (fa->fa_slen < KEYLENGTH)) { 1398 + if (index >= (1ul << fa->fa_slen)) 1399 + continue; 1400 + } 1400 1401 if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) 1401 1402 continue; 1402 1403 if (fi->fib_dead)
+14 -7
net/ipv4/inet_diag.c
··· 361 361 req->id.idiag_dport, req->id.idiag_src[0], 362 362 req->id.idiag_sport, req->id.idiag_if); 363 363 #if IS_ENABLED(CONFIG_IPV6) 364 - else if (req->sdiag_family == AF_INET6) 365 - sk = inet6_lookup(net, hashinfo, 366 - (struct in6_addr *)req->id.idiag_dst, 367 - req->id.idiag_dport, 368 - (struct in6_addr *)req->id.idiag_src, 369 - req->id.idiag_sport, 370 - req->id.idiag_if); 364 + else if (req->sdiag_family == AF_INET6) { 365 + if (ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_dst) && 366 + ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_src)) 367 + sk = inet_lookup(net, hashinfo, req->id.idiag_dst[3], 368 + req->id.idiag_dport, req->id.idiag_src[3], 369 + req->id.idiag_sport, req->id.idiag_if); 370 + else 371 + sk = inet6_lookup(net, hashinfo, 372 + (struct in6_addr *)req->id.idiag_dst, 373 + req->id.idiag_dport, 374 + (struct in6_addr *)req->id.idiag_src, 375 + req->id.idiag_sport, 376 + req->id.idiag_if); 377 + } 371 378 #endif 372 379 else 373 380 return ERR_PTR(-EINVAL);
+1
net/ipv4/ip_fragment.c
··· 661 661 struct ipq *qp; 662 662 663 663 IP_INC_STATS_BH(net, IPSTATS_MIB_REASMREQDS); 664 + skb_orphan(skb); 664 665 665 666 /* Lookup (or create) queue header */ 666 667 qp = ip_find(net, ip_hdr(skb), user, vif);
+4 -1
net/ipv4/ip_input.c
··· 316 316 const struct iphdr *iph = ip_hdr(skb); 317 317 struct rtable *rt; 318 318 319 - if (sysctl_ip_early_demux && !skb_dst(skb) && !skb->sk) { 319 + if (sysctl_ip_early_demux && 320 + !skb_dst(skb) && 321 + !skb->sk && 322 + !ip_is_fragment(iph)) { 320 323 const struct net_protocol *ipprot; 321 324 int protocol = iph->protocol; 322 325
+4
net/ipv4/ipconfig.c
··· 143 143 144 144 /* Persistent data: */ 145 145 146 + #ifdef IPCONFIG_DYNAMIC 146 147 static int ic_proto_used; /* Protocol used, if any */ 148 + #else 149 + #define ic_proto_used 0 150 + #endif 147 151 static __be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */ 148 152 static u8 ic_domain[64]; /* DNS (not NIS) domain name */ 149 153
-2
net/ipv4/netfilter/nf_defrag_ipv4.c
··· 27 27 { 28 28 int err; 29 29 30 - skb_orphan(skb); 31 - 32 30 local_bh_disable(); 33 31 err = ip_defrag(net, skb, user); 34 32 local_bh_enable();
+8 -4
net/ipv4/tcp.c
··· 279 279 280 280 #include <asm/uaccess.h> 281 281 #include <asm/ioctls.h> 282 + #include <asm/unaligned.h> 282 283 #include <net/busy_poll.h> 283 284 284 285 int sysctl_tcp_fin_timeout __read_mostly = TCP_FIN_TIMEOUT; ··· 2639 2638 const struct inet_connection_sock *icsk = inet_csk(sk); 2640 2639 u32 now = tcp_time_stamp; 2641 2640 unsigned int start; 2641 + u64 rate64; 2642 2642 u32 rate; 2643 2643 2644 2644 memset(info, 0, sizeof(*info)); ··· 2705 2703 info->tcpi_total_retrans = tp->total_retrans; 2706 2704 2707 2705 rate = READ_ONCE(sk->sk_pacing_rate); 2708 - info->tcpi_pacing_rate = rate != ~0U ? rate : ~0ULL; 2706 + rate64 = rate != ~0U ? rate : ~0ULL; 2707 + put_unaligned(rate64, &info->tcpi_pacing_rate); 2709 2708 2710 2709 rate = READ_ONCE(sk->sk_max_pacing_rate); 2711 - info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL; 2710 + rate64 = rate != ~0U ? rate : ~0ULL; 2711 + put_unaligned(rate64, &info->tcpi_max_pacing_rate); 2712 2712 2713 2713 do { 2714 2714 start = u64_stats_fetch_begin_irq(&tp->syncp); 2715 - info->tcpi_bytes_acked = tp->bytes_acked; 2716 - info->tcpi_bytes_received = tp->bytes_received; 2715 + put_unaligned(tp->bytes_acked, &info->tcpi_bytes_acked); 2716 + put_unaligned(tp->bytes_received, &info->tcpi_bytes_received); 2717 2717 } while (u64_stats_fetch_retry_irq(&tp->syncp, start)); 2718 2718 info->tcpi_segs_out = tp->segs_out; 2719 2719 info->tcpi_segs_in = tp->segs_in;
+5 -7
net/ipv4/tcp_input.c
··· 2164 2164 { 2165 2165 struct tcp_sock *tp = tcp_sk(sk); 2166 2166 struct sk_buff *skb; 2167 - int cnt, oldcnt; 2168 - int err; 2167 + int cnt, oldcnt, lost; 2169 2168 unsigned int mss; 2170 2169 /* Use SACK to deduce losses of new sequences sent during recovery */ 2171 2170 const u32 loss_high = tcp_is_sack(tp) ? tp->snd_nxt : tp->high_seq; ··· 2204 2205 break; 2205 2206 2206 2207 mss = tcp_skb_mss(skb); 2207 - err = tcp_fragment(sk, skb, (packets - oldcnt) * mss, 2208 - mss, GFP_ATOMIC); 2209 - if (err < 0) 2208 + /* If needed, chop off the prefix to mark as lost. */ 2209 + lost = (packets - oldcnt) * mss; 2210 + if (lost < skb->len && 2211 + tcp_fragment(sk, skb, lost, mss, GFP_ATOMIC) < 0) 2210 2212 break; 2211 2213 cnt = packets; 2212 2214 } ··· 2366 2366 tp->snd_ssthresh = tp->prior_ssthresh; 2367 2367 tcp_ecn_withdraw_cwr(tp); 2368 2368 } 2369 - } else { 2370 - tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh); 2371 2369 } 2372 2370 tp->snd_cwnd_stamp = tcp_time_stamp; 2373 2371 tp->undo_marker = 0;
+8 -5
net/ipv4/tcp_ipv4.c
··· 707 707 outside socket context is ugly, certainly. What can I do? 708 708 */ 709 709 710 - static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack, 710 + static void tcp_v4_send_ack(struct net *net, 711 + struct sk_buff *skb, u32 seq, u32 ack, 711 712 u32 win, u32 tsval, u32 tsecr, int oif, 712 713 struct tcp_md5sig_key *key, 713 714 int reply_flags, u8 tos) ··· 723 722 ]; 724 723 } rep; 725 724 struct ip_reply_arg arg; 726 - struct net *net = dev_net(skb_dst(skb)->dev); 727 725 728 726 memset(&rep.th, 0, sizeof(struct tcphdr)); 729 727 memset(&arg, 0, sizeof(arg)); ··· 784 784 struct inet_timewait_sock *tw = inet_twsk(sk); 785 785 struct tcp_timewait_sock *tcptw = tcp_twsk(sk); 786 786 787 - tcp_v4_send_ack(skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, 787 + tcp_v4_send_ack(sock_net(sk), skb, 788 + tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, 788 789 tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, 789 790 tcp_time_stamp + tcptw->tw_ts_offset, 790 791 tcptw->tw_ts_recent, ··· 804 803 /* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV 805 804 * sk->sk_state == TCP_SYN_RECV -> for Fast Open. 806 805 */ 807 - tcp_v4_send_ack(skb, (sk->sk_state == TCP_LISTEN) ? 808 - tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt, 806 + u32 seq = (sk->sk_state == TCP_LISTEN) ? tcp_rsk(req)->snt_isn + 1 : 807 + tcp_sk(sk)->snd_nxt; 808 + 809 + tcp_v4_send_ack(sock_net(sk), skb, seq, 809 810 tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd, 810 811 tcp_time_stamp, 811 812 req->ts_recent,
+21 -11
net/ipv4/udp.c
··· 499 499 struct sock *sk, *result; 500 500 struct hlist_nulls_node *node; 501 501 int score, badness, matches = 0, reuseport = 0; 502 + bool select_ok = true; 502 503 u32 hash = 0; 503 504 504 505 begin: ··· 513 512 badness = score; 514 513 reuseport = sk->sk_reuseport; 515 514 if (reuseport) { 516 - struct sock *sk2; 517 515 hash = udp_ehashfn(net, daddr, hnum, 518 516 saddr, sport); 519 - sk2 = reuseport_select_sock(sk, hash, skb, 520 - sizeof(struct udphdr)); 521 - if (sk2) { 522 - result = sk2; 523 - goto found; 517 + if (select_ok) { 518 + struct sock *sk2; 519 + 520 + sk2 = reuseport_select_sock(sk, hash, skb, 521 + sizeof(struct udphdr)); 522 + if (sk2) { 523 + result = sk2; 524 + select_ok = false; 525 + goto found; 526 + } 524 527 } 525 528 matches = 1; 526 529 } ··· 568 563 unsigned int hash2, slot2, slot = udp_hashfn(net, hnum, udptable->mask); 569 564 struct udp_hslot *hslot2, *hslot = &udptable->hash[slot]; 570 565 int score, badness, matches = 0, reuseport = 0; 566 + bool select_ok = true; 571 567 u32 hash = 0; 572 568 573 569 rcu_read_lock(); ··· 607 601 badness = score; 608 602 reuseport = sk->sk_reuseport; 609 603 if (reuseport) { 610 - struct sock *sk2; 611 604 hash = udp_ehashfn(net, daddr, hnum, 612 605 saddr, sport); 613 - sk2 = reuseport_select_sock(sk, hash, skb, 606 + if (select_ok) { 607 + struct sock *sk2; 608 + 609 + sk2 = reuseport_select_sock(sk, hash, skb, 614 610 sizeof(struct udphdr)); 615 - if (sk2) { 616 - result = sk2; 617 - goto found; 611 + if (sk2) { 612 + result = sk2; 613 + select_ok = false; 614 + goto found; 615 + } 618 616 } 619 617 matches = 1; 620 618 }
+1
net/ipv6/Kconfig
··· 69 69 select CRYPTO_CBC 70 70 select CRYPTO_SHA1 71 71 select CRYPTO_DES 72 + select CRYPTO_ECHAINIV 72 73 ---help--- 73 74 Support for IPsec ESP. 74 75
+3
net/ipv6/datagram.c
··· 162 162 fl6.fl6_dport = inet->inet_dport; 163 163 fl6.fl6_sport = inet->inet_sport; 164 164 165 + if (!fl6.flowi6_oif) 166 + fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; 167 + 165 168 if (!fl6.flowi6_oif && (addr_type&IPV6_ADDR_MULTICAST)) 166 169 fl6.flowi6_oif = np->mcast_oif; 167 170
+5 -1
net/ipv6/ip6_output.c
··· 909 909 struct rt6_info *rt; 910 910 #endif 911 911 int err; 912 + int flags = 0; 912 913 913 914 /* The correct way to handle this would be to do 914 915 * ip6_route_get_saddr, and then ip6_route_output; however, ··· 941 940 dst_release(*dst); 942 941 *dst = NULL; 943 942 } 943 + 944 + if (fl6->flowi6_oif) 945 + flags |= RT6_LOOKUP_F_IFACE; 944 946 } 945 947 946 948 if (!*dst) 947 - *dst = ip6_route_output(net, sk, fl6); 949 + *dst = ip6_route_output_flags(net, sk, fl6, flags); 948 950 949 951 err = (*dst)->error; 950 952 if (err)
+3 -4
net/ipv6/route.c
··· 1183 1183 return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags); 1184 1184 } 1185 1185 1186 - struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk, 1187 - struct flowi6 *fl6) 1186 + struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk, 1187 + struct flowi6 *fl6, int flags) 1188 1188 { 1189 1189 struct dst_entry *dst; 1190 - int flags = 0; 1191 1190 bool any_src; 1192 1191 1193 1192 dst = l3mdev_rt6_dst_by_oif(net, fl6); ··· 1207 1208 1208 1209 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_output); 1209 1210 } 1210 - EXPORT_SYMBOL(ip6_route_output); 1211 + EXPORT_SYMBOL_GPL(ip6_route_output_flags); 1211 1212 1212 1213 struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_orig) 1213 1214 {
+2 -2
net/ipv6/sit.c
··· 201 201 if ((__force u16)t->parms.i_flags & SIT_ISATAP) 202 202 dev->priv_flags |= IFF_ISATAP; 203 203 204 + dev->rtnl_link_ops = &sit_link_ops; 205 + 204 206 err = register_netdevice(dev); 205 207 if (err < 0) 206 208 goto out; 207 209 208 210 ipip6_tunnel_clone_6rd(dev, sitn); 209 - 210 - dev->rtnl_link_ops = &sit_link_ops; 211 211 212 212 dev_hold(dev); 213 213
+21 -11
net/ipv6/udp.c
··· 257 257 struct sock *sk, *result; 258 258 struct hlist_nulls_node *node; 259 259 int score, badness, matches = 0, reuseport = 0; 260 + bool select_ok = true; 260 261 u32 hash = 0; 261 262 262 263 begin: ··· 271 270 badness = score; 272 271 reuseport = sk->sk_reuseport; 273 272 if (reuseport) { 274 - struct sock *sk2; 275 273 hash = udp6_ehashfn(net, daddr, hnum, 276 274 saddr, sport); 277 - sk2 = reuseport_select_sock(sk, hash, skb, 278 - sizeof(struct udphdr)); 279 - if (sk2) { 280 - result = sk2; 281 - goto found; 275 + if (select_ok) { 276 + struct sock *sk2; 277 + 278 + sk2 = reuseport_select_sock(sk, hash, skb, 279 + sizeof(struct udphdr)); 280 + if (sk2) { 281 + result = sk2; 282 + select_ok = false; 283 + goto found; 284 + } 282 285 } 283 286 matches = 1; 284 287 } ··· 326 321 unsigned int hash2, slot2, slot = udp_hashfn(net, hnum, udptable->mask); 327 322 struct udp_hslot *hslot2, *hslot = &udptable->hash[slot]; 328 323 int score, badness, matches = 0, reuseport = 0; 324 + bool select_ok = true; 329 325 u32 hash = 0; 330 326 331 327 rcu_read_lock(); ··· 364 358 badness = score; 365 359 reuseport = sk->sk_reuseport; 366 360 if (reuseport) { 367 - struct sock *sk2; 368 361 hash = udp6_ehashfn(net, daddr, hnum, 369 362 saddr, sport); 370 - sk2 = reuseport_select_sock(sk, hash, skb, 363 + if (select_ok) { 364 + struct sock *sk2; 365 + 366 + sk2 = reuseport_select_sock(sk, hash, skb, 371 367 sizeof(struct udphdr)); 372 - if (sk2) { 373 - result = sk2; 374 - goto found; 368 + if (sk2) { 369 + result = sk2; 370 + select_ok = false; 371 + goto found; 372 + } 375 373 } 376 374 matches = 1; 377 375 }
+1 -2
net/irda/ircomm/ircomm_param.c
··· 134 134 return -1; 135 135 } 136 136 skb_put(skb, count); 137 + pr_debug("%s(), skb->len=%d\n", __func__, skb->len); 137 138 138 139 spin_unlock_irqrestore(&self->spinlock, flags); 139 - 140 - pr_debug("%s(), skb->len=%d\n", __func__ , skb->len); 141 140 142 141 if (flush) { 143 142 /* ircomm_tty_do_softint will take care of the rest */
+3
net/iucv/af_iucv.c
··· 708 708 if (!addr || addr->sa_family != AF_IUCV) 709 709 return -EINVAL; 710 710 711 + if (addr_len < sizeof(struct sockaddr_iucv)) 712 + return -EINVAL; 713 + 711 714 lock_sock(sk); 712 715 if (sk->sk_state != IUCV_OPEN) { 713 716 err = -EBADFD;
-1
net/mac80211/ibss.c
··· 1733 1733 if (sdata->vif.type != NL80211_IFTYPE_ADHOC) 1734 1734 continue; 1735 1735 sdata->u.ibss.last_scan_completed = jiffies; 1736 - ieee80211_queue_work(&local->hw, &sdata->work); 1737 1736 } 1738 1737 mutex_unlock(&local->iflist_mtx); 1739 1738 }
+6
net/mac80211/main.c
··· 248 248 249 249 /* wait for scan work complete */ 250 250 flush_workqueue(local->workqueue); 251 + flush_work(&local->sched_scan_stopped_work); 251 252 252 253 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), 253 254 "%s called with hardware scan in progress\n", __func__); ··· 257 256 list_for_each_entry(sdata, &local->interfaces, list) 258 257 flush_delayed_work(&sdata->dec_tailroom_needed_wk); 259 258 ieee80211_scan_cancel(local); 259 + 260 + /* make sure any new ROC will consider local->in_reconfig */ 261 + flush_delayed_work(&local->roc_work); 262 + flush_work(&local->hw_roc_done); 263 + 260 264 ieee80211_reconfig(local); 261 265 rtnl_unlock(); 262 266 }
-11
net/mac80211/mesh.c
··· 1370 1370 sdata_unlock(sdata); 1371 1371 } 1372 1372 1373 - void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) 1374 - { 1375 - struct ieee80211_sub_if_data *sdata; 1376 - 1377 - rcu_read_lock(); 1378 - list_for_each_entry_rcu(sdata, &local->interfaces, list) 1379 - if (ieee80211_vif_is_mesh(&sdata->vif) && 1380 - ieee80211_sdata_running(sdata)) 1381 - ieee80211_queue_work(&local->hw, &sdata->work); 1382 - rcu_read_unlock(); 1383 - } 1384 1373 1385 1374 void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) 1386 1375 {
-4
net/mac80211/mesh.h
··· 362 362 return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP; 363 363 } 364 364 365 - void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local); 366 - 367 365 void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata); 368 366 void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata); 369 367 void ieee80211s_stop(void); 370 368 #else 371 - static inline void 372 - ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {} 373 369 static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata) 374 370 { return false; } 375 371 static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
-2
net/mac80211/mlme.c
··· 4005 4005 if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) 4006 4006 ieee80211_queue_work(&sdata->local->hw, 4007 4007 &sdata->u.mgd.monitor_work); 4008 - /* and do all the other regular work too */ 4009 - ieee80211_queue_work(&sdata->local->hw, &sdata->work); 4010 4008 } 4011 4009 } 4012 4010
+9 -7
net/mac80211/offchannel.c
··· 252 252 static void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc, 253 253 unsigned long start_time) 254 254 { 255 - struct ieee80211_local *local = roc->sdata->local; 256 - 257 255 if (WARN_ON(roc->notified)) 258 256 return; 259 257 260 258 roc->start_time = start_time; 261 259 roc->started = true; 262 - roc->hw_begun = true; 263 260 264 261 if (roc->mgmt_tx_cookie) { 265 262 if (!WARN_ON(!roc->frame)) { ··· 271 274 } 272 275 273 276 roc->notified = true; 274 - 275 - if (!local->ops->remain_on_channel) 276 - ieee80211_recalc_sw_work(local, start_time); 277 277 } 278 278 279 279 static void ieee80211_hw_roc_start(struct work_struct *work) ··· 285 291 if (!roc->started) 286 292 break; 287 293 294 + roc->hw_begun = true; 288 295 ieee80211_handle_roc_started(roc, local->hw_roc_start_time); 289 296 } 290 297 ··· 408 413 return; 409 414 } 410 415 416 + /* defer roc if driver is not started (i.e. during reconfig) */ 417 + if (local->in_reconfig) 418 + return; 419 + 411 420 roc = list_first_entry(&local->roc_list, struct ieee80211_roc_work, 412 421 list); 413 422 ··· 533 534 * begin, otherwise they'll both be marked properly by the work 534 535 * struct that runs once the driver notifies us of the beginning 535 536 */ 536 - if (cur_roc->hw_begun) 537 + if (cur_roc->hw_begun) { 538 + new_roc->hw_begun = true; 537 539 ieee80211_handle_roc_started(new_roc, now); 540 + } 538 541 539 542 return true; 540 543 } ··· 659 658 queued = true; 660 659 roc->on_channel = tmp->on_channel; 661 660 ieee80211_handle_roc_started(roc, now); 661 + ieee80211_recalc_sw_work(local, now); 662 662 break; 663 663 } 664 664
+19 -1
net/mac80211/scan.c
··· 314 314 bool was_scanning = local->scanning; 315 315 struct cfg80211_scan_request *scan_req; 316 316 struct ieee80211_sub_if_data *scan_sdata; 317 + struct ieee80211_sub_if_data *sdata; 317 318 318 319 lockdep_assert_held(&local->mtx); 319 320 ··· 374 373 375 374 ieee80211_mlme_notify_scan_completed(local); 376 375 ieee80211_ibss_notify_scan_completed(local); 377 - ieee80211_mesh_notify_scan_completed(local); 376 + 377 + /* Requeue all the work that might have been ignored while 378 + * the scan was in progress; if there was none this will 379 + * just be a no-op for the particular interface. 380 + */ 381 + list_for_each_entry_rcu(sdata, &local->interfaces, list) { 382 + if (ieee80211_sdata_running(sdata)) 383 + ieee80211_queue_work(&sdata->local->hw, &sdata->work); 384 + } 385 + 378 386 if (was_scanning) 379 387 ieee80211_start_next_roc(local); 380 388 } ··· 1222 1212 struct ieee80211_local *local = hw_to_local(hw); 1223 1213 1224 1214 trace_api_sched_scan_stopped(local); 1215 + 1216 + /* 1217 + * this shouldn't really happen, so for simplicity 1218 + * simply ignore it, and let mac80211 reconfigure 1219 + * the sched scan later on. 1220 + */ 1221 + if (local->in_reconfig) 1222 + return; 1225 1223 1226 1224 schedule_work(&local->sched_scan_stopped_work); 1227 1225 }
+1 -1
net/mac80211/sta_info.c
··· 1453 1453 1454 1454 more_data = ieee80211_sta_ps_more_data(sta, ignored_acs, reason, driver_release_tids); 1455 1455 1456 - if (reason == IEEE80211_FRAME_RELEASE_PSPOLL) 1456 + if (driver_release_tids && reason == IEEE80211_FRAME_RELEASE_PSPOLL) 1457 1457 driver_release_tids = 1458 1458 BIT(find_highest_prio_tid(driver_release_tids)); 1459 1459
+5
net/mac80211/status.c
··· 51 51 struct ieee80211_hdr *hdr = (void *)skb->data; 52 52 int ac; 53 53 54 + if (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER) { 55 + ieee80211_free_txskb(&local->hw, skb); 56 + return; 57 + } 58 + 54 59 /* 55 60 * This skb 'survived' a round-trip through the driver, and 56 61 * hopefully the driver didn't mangle it too badly. However,
+13 -3
net/mac80211/util.c
··· 2043 2043 */ 2044 2044 if (sched_scan_req->n_scan_plans > 1 || 2045 2045 __ieee80211_request_sched_scan_start(sched_scan_sdata, 2046 - sched_scan_req)) 2046 + sched_scan_req)) { 2047 + RCU_INIT_POINTER(local->sched_scan_sdata, NULL); 2048 + RCU_INIT_POINTER(local->sched_scan_req, NULL); 2047 2049 sched_scan_stopped = true; 2050 + } 2048 2051 mutex_unlock(&local->mtx); 2049 2052 2050 2053 if (sched_scan_stopped) 2051 2054 cfg80211_sched_scan_stopped_rtnl(local->hw.wiphy); 2052 2055 2053 2056 wake_up: 2054 - local->in_reconfig = false; 2055 - barrier(); 2057 + if (local->in_reconfig) { 2058 + local->in_reconfig = false; 2059 + barrier(); 2060 + 2061 + /* Restart deferred ROCs */ 2062 + mutex_lock(&local->mtx); 2063 + ieee80211_start_next_roc(local); 2064 + mutex_unlock(&local->mtx); 2065 + } 2056 2066 2057 2067 if (local->monitors == local->open_count && local->monitors > 0) 2058 2068 ieee80211_add_virtual_monitor(local);
-4
net/netfilter/ipset/ip_set_hash_netiface.c
··· 164 164 }; 165 165 struct ip_set_ext ext = IP_SET_INIT_KEXT(skb, opt, set); 166 166 167 - if (e.cidr == 0) 168 - return -EINVAL; 169 167 if (adt == IPSET_TEST) 170 168 e.cidr = HOST_MASK; 171 169 ··· 375 377 }; 376 378 struct ip_set_ext ext = IP_SET_INIT_KEXT(skb, opt, set); 377 379 378 - if (e.cidr == 0) 379 - return -EINVAL; 380 380 if (adt == IPSET_TEST) 381 381 e.cidr = HOST_MASK; 382 382
+28 -10
net/netfilter/nf_conntrack_core.c
··· 66 66 __cacheline_aligned_in_smp DEFINE_SPINLOCK(nf_conntrack_expect_lock); 67 67 EXPORT_SYMBOL_GPL(nf_conntrack_expect_lock); 68 68 69 + static __read_mostly spinlock_t nf_conntrack_locks_all_lock; 70 + static __read_mostly bool nf_conntrack_locks_all; 71 + 72 + void nf_conntrack_lock(spinlock_t *lock) __acquires(lock) 73 + { 74 + spin_lock(lock); 75 + while (unlikely(nf_conntrack_locks_all)) { 76 + spin_unlock(lock); 77 + spin_lock(&nf_conntrack_locks_all_lock); 78 + spin_unlock(&nf_conntrack_locks_all_lock); 79 + spin_lock(lock); 80 + } 81 + } 82 + EXPORT_SYMBOL_GPL(nf_conntrack_lock); 83 + 69 84 static void nf_conntrack_double_unlock(unsigned int h1, unsigned int h2) 70 85 { 71 86 h1 %= CONNTRACK_LOCKS; ··· 97 82 h1 %= CONNTRACK_LOCKS; 98 83 h2 %= CONNTRACK_LOCKS; 99 84 if (h1 <= h2) { 100 - spin_lock(&nf_conntrack_locks[h1]); 85 + nf_conntrack_lock(&nf_conntrack_locks[h1]); 101 86 if (h1 != h2) 102 87 spin_lock_nested(&nf_conntrack_locks[h2], 103 88 SINGLE_DEPTH_NESTING); 104 89 } else { 105 - spin_lock(&nf_conntrack_locks[h2]); 90 + nf_conntrack_lock(&nf_conntrack_locks[h2]); 106 91 spin_lock_nested(&nf_conntrack_locks[h1], 107 92 SINGLE_DEPTH_NESTING); 108 93 } ··· 117 102 { 118 103 int i; 119 104 120 - for (i = 0; i < CONNTRACK_LOCKS; i++) 121 - spin_lock_nested(&nf_conntrack_locks[i], i); 105 + spin_lock(&nf_conntrack_locks_all_lock); 106 + nf_conntrack_locks_all = true; 107 + 108 + for (i = 0; i < CONNTRACK_LOCKS; i++) { 109 + spin_lock(&nf_conntrack_locks[i]); 110 + spin_unlock(&nf_conntrack_locks[i]); 111 + } 122 112 } 123 113 124 114 static void nf_conntrack_all_unlock(void) 125 115 { 126 - int i; 127 - 128 - for (i = 0; i < CONNTRACK_LOCKS; i++) 129 - spin_unlock(&nf_conntrack_locks[i]); 116 + nf_conntrack_locks_all = false; 117 + spin_unlock(&nf_conntrack_locks_all_lock); 130 118 } 131 119 132 120 unsigned int nf_conntrack_htable_size __read_mostly; ··· 775 757 hash = hash_bucket(_hash, net); 776 758 for (; i < net->ct.htable_size; i++) { 777 759 lockp = &nf_conntrack_locks[hash % CONNTRACK_LOCKS]; 778 - spin_lock(lockp); 760 + nf_conntrack_lock(lockp); 779 761 if (read_seqcount_retry(&net->ct.generation, sequence)) { 780 762 spin_unlock(lockp); 781 763 goto restart; ··· 1400 1382 for (; *bucket < net->ct.htable_size; (*bucket)++) { 1401 1383 lockp = &nf_conntrack_locks[*bucket % CONNTRACK_LOCKS]; 1402 1384 local_bh_disable(); 1403 - spin_lock(lockp); 1385 + nf_conntrack_lock(lockp); 1404 1386 if (*bucket < net->ct.htable_size) { 1405 1387 hlist_nulls_for_each_entry(h, n, &net->ct.hash[*bucket], hnnode) { 1406 1388 if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL)
+1 -1
net/netfilter/nf_conntrack_helper.c
··· 425 425 } 426 426 local_bh_disable(); 427 427 for (i = 0; i < net->ct.htable_size; i++) { 428 - spin_lock(&nf_conntrack_locks[i % CONNTRACK_LOCKS]); 428 + nf_conntrack_lock(&nf_conntrack_locks[i % CONNTRACK_LOCKS]); 429 429 if (i < net->ct.htable_size) { 430 430 hlist_nulls_for_each_entry(h, nn, &net->ct.hash[i], hnnode) 431 431 unhelp(h, me);
+1 -1
net/netfilter/nf_conntrack_netlink.c
··· 840 840 for (; cb->args[0] < net->ct.htable_size; cb->args[0]++) { 841 841 restart: 842 842 lockp = &nf_conntrack_locks[cb->args[0] % CONNTRACK_LOCKS]; 843 - spin_lock(lockp); 843 + nf_conntrack_lock(lockp); 844 844 if (cb->args[0] >= net->ct.htable_size) { 845 845 spin_unlock(lockp); 846 846 goto out;
+4 -4
net/netfilter/nf_tables_netdev.c
··· 224 224 225 225 nft_register_chain_type(&nft_filter_chain_netdev); 226 226 ret = register_pernet_subsys(&nf_tables_netdev_net_ops); 227 - if (ret < 0) 227 + if (ret < 0) { 228 228 nft_unregister_chain_type(&nft_filter_chain_netdev); 229 - 229 + return ret; 230 + } 230 231 register_netdevice_notifier(&nf_tables_netdev_notifier); 231 - 232 - return ret; 232 + return 0; 233 233 } 234 234 235 235 static void __exit nf_tables_netdev_exit(void)
+2 -4
net/netfilter/nft_byteorder.c
··· 46 46 switch (priv->op) { 47 47 case NFT_BYTEORDER_NTOH: 48 48 for (i = 0; i < priv->len / 8; i++) { 49 - src64 = get_unaligned_be64(&src[i]); 50 - src64 = be64_to_cpu((__force __be64)src64); 49 + src64 = get_unaligned((u64 *)&src[i]); 51 50 put_unaligned_be64(src64, &dst[i]); 52 51 } 53 52 break; 54 53 case NFT_BYTEORDER_HTON: 55 54 for (i = 0; i < priv->len / 8; i++) { 56 55 src64 = get_unaligned_be64(&src[i]); 57 - src64 = (__force u64)cpu_to_be64(src64); 58 - put_unaligned_be64(src64, &dst[i]); 56 + put_unaligned(src64, (u64 *)&dst[i]); 59 57 } 60 58 break; 61 59 }
+1 -1
net/netfilter/nft_ct.c
··· 127 127 NF_CT_LABELS_MAX_SIZE - size); 128 128 return; 129 129 } 130 + #endif 130 131 case NFT_CT_BYTES: /* fallthrough */ 131 132 case NFT_CT_PKTS: { 132 133 const struct nf_conn_acct *acct = nf_conn_acct_find(ct); ··· 139 138 memcpy(dest, &count, sizeof(count)); 140 139 return; 141 140 } 142 - #endif 143 141 default: 144 142 break; 145 143 }
+7 -2
net/netfilter/xt_TCPMSS.c
··· 228 228 { 229 229 struct ipv6hdr *ipv6h = ipv6_hdr(skb); 230 230 u8 nexthdr; 231 - __be16 frag_off; 231 + __be16 frag_off, oldlen, newlen; 232 232 int tcphoff; 233 233 int ret; 234 234 ··· 244 244 return NF_DROP; 245 245 if (ret > 0) { 246 246 ipv6h = ipv6_hdr(skb); 247 - ipv6h->payload_len = htons(ntohs(ipv6h->payload_len) + ret); 247 + oldlen = ipv6h->payload_len; 248 + newlen = htons(ntohs(oldlen) + ret); 249 + if (skb->ip_summed == CHECKSUM_COMPLETE) 250 + skb->csum = csum_add(csum_sub(skb->csum, oldlen), 251 + newlen); 252 + ipv6h->payload_len = newlen; 248 253 } 249 254 return XT_CONTINUE; 250 255 }
+2 -1
net/netlink/af_netlink.c
··· 2831 2831 * reasonable static buffer based on the expected largest dump of a 2832 2832 * single netdev. The outcome is MSG_TRUNC error. 2833 2833 */ 2834 - skb_reserve(skb, skb_tailroom(skb) - alloc_size); 2834 + if (!netlink_rx_is_mmaped(sk)) 2835 + skb_reserve(skb, skb_tailroom(skb) - alloc_size); 2835 2836 netlink_skb_set_owner_r(skb, sk); 2836 2837 2837 2838 len = cb->dump(skb, cb);
+4 -12
net/rfkill/core.c
··· 1095 1095 return res; 1096 1096 } 1097 1097 1098 - static bool rfkill_readable(struct rfkill_data *data) 1099 - { 1100 - bool r; 1101 - 1102 - mutex_lock(&data->mtx); 1103 - r = !list_empty(&data->events); 1104 - mutex_unlock(&data->mtx); 1105 - 1106 - return r; 1107 - } 1108 - 1109 1098 static ssize_t rfkill_fop_read(struct file *file, char __user *buf, 1110 1099 size_t count, loff_t *pos) 1111 1100 { ··· 1111 1122 goto out; 1112 1123 } 1113 1124 mutex_unlock(&data->mtx); 1125 + /* since we re-check and it just compares pointers, 1126 + * using !list_empty() without locking isn't a problem 1127 + */ 1114 1128 ret = wait_event_interruptible(data->read_wait, 1115 - rfkill_readable(data)); 1129 + !list_empty(&data->events)); 1116 1130 mutex_lock(&data->mtx); 1117 1131 1118 1132 if (ret)
+2
net/sched/sch_drr.c
··· 403 403 if (len <= cl->deficit) { 404 404 cl->deficit -= len; 405 405 skb = qdisc_dequeue_peeked(cl->qdisc); 406 + if (unlikely(skb == NULL)) 407 + goto out; 406 408 if (cl->qdisc->q.qlen == 0) 407 409 list_del(&cl->alist); 408 410
+11 -6
net/sctp/input.c
··· 935 935 struct sctp_transport **pt) 936 936 { 937 937 struct sctp_transport *t; 938 + struct sctp_association *asoc = NULL; 938 939 940 + rcu_read_lock(); 939 941 t = sctp_addrs_lookup_transport(net, local, peer); 940 - if (!t || t->dead) 941 - return NULL; 942 + if (!t || !sctp_transport_hold(t)) 943 + goto out; 942 944 943 - sctp_association_hold(t->asoc); 945 + asoc = t->asoc; 946 + sctp_association_hold(asoc); 944 947 *pt = t; 945 948 946 - return t->asoc; 949 + sctp_transport_put(t); 950 + 951 + out: 952 + rcu_read_unlock(); 953 + return asoc; 947 954 } 948 955 949 956 /* Look up an association. protected by RCU read lock */ ··· 962 955 { 963 956 struct sctp_association *asoc; 964 957 965 - rcu_read_lock(); 966 958 asoc = __sctp_lookup_association(net, laddr, paddr, transportp); 967 - rcu_read_unlock(); 968 959 969 960 return asoc; 970 961 }
+8 -4
net/sctp/proc.c
··· 165 165 list_for_each_entry_rcu(transport, &assoc->peer.transport_addr_list, 166 166 transports) { 167 167 addr = &transport->ipaddr; 168 - if (transport->dead) 169 - continue; 170 168 171 169 af = sctp_get_af_specific(addr->sa.sa_family); 172 170 if (af->cmp_addr(addr, primary)) { ··· 378 380 } 379 381 380 382 transport = (struct sctp_transport *)v; 383 + if (!sctp_transport_hold(transport)) 384 + return 0; 381 385 assoc = transport->asoc; 382 386 epb = &assoc->base; 383 387 sk = epb->sk; ··· 411 411 sk->sk_sndbuf, 412 412 sk->sk_rcvbuf); 413 413 seq_printf(seq, "\n"); 414 + 415 + sctp_transport_put(transport); 414 416 415 417 return 0; 416 418 } ··· 491 489 } 492 490 493 491 tsp = (struct sctp_transport *)v; 492 + if (!sctp_transport_hold(tsp)) 493 + return 0; 494 494 assoc = tsp->asoc; 495 495 496 496 list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list, 497 497 transports) { 498 - if (tsp->dead) 499 - continue; 500 498 /* 501 499 * The remote address (ADDR) 502 500 */ ··· 545 543 546 544 seq_printf(seq, "\n"); 547 545 } 546 + 547 + sctp_transport_put(tsp); 548 548 549 549 return 0; 550 550 }
-12
net/sctp/sm_sideeffect.c
··· 259 259 goto out_unlock; 260 260 } 261 261 262 - /* Is this transport really dead and just waiting around for 263 - * the timer to let go of the reference? 264 - */ 265 - if (transport->dead) 266 - goto out_unlock; 267 - 268 262 /* Run through the state machine. */ 269 263 error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT, 270 264 SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_T3_RTX), ··· 373 379 sctp_transport_hold(transport); 374 380 goto out_unlock; 375 381 } 376 - 377 - /* Is this structure just waiting around for us to actually 378 - * get destroyed? 379 - */ 380 - if (transport->dead) 381 - goto out_unlock; 382 382 383 383 error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT, 384 384 SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_HEARTBEAT),
+2
net/sctp/socket.c
··· 6636 6636 6637 6637 if (cmsgs->srinfo->sinfo_flags & 6638 6638 ~(SCTP_UNORDERED | SCTP_ADDR_OVER | 6639 + SCTP_SACK_IMMEDIATELY | 6639 6640 SCTP_ABORT | SCTP_EOF)) 6640 6641 return -EINVAL; 6641 6642 break; ··· 6660 6659 6661 6660 if (cmsgs->sinfo->snd_flags & 6662 6661 ~(SCTP_UNORDERED | SCTP_ADDR_OVER | 6662 + SCTP_SACK_IMMEDIATELY | 6663 6663 SCTP_ABORT | SCTP_EOF)) 6664 6664 return -EINVAL; 6665 6665 break;
+3 -5
net/sctp/transport.c
··· 132 132 */ 133 133 void sctp_transport_free(struct sctp_transport *transport) 134 134 { 135 - transport->dead = 1; 136 - 137 135 /* Try to delete the heartbeat timer. */ 138 136 if (del_timer(&transport->hb_timer)) 139 137 sctp_transport_put(transport); ··· 167 169 */ 168 170 static void sctp_transport_destroy(struct sctp_transport *transport) 169 171 { 170 - if (unlikely(!transport->dead)) { 172 + if (unlikely(atomic_read(&transport->refcnt))) { 171 173 WARN(1, "Attempt to destroy undead transport %p!\n", transport); 172 174 return; 173 175 } ··· 294 296 } 295 297 296 298 /* Hold a reference to a transport. */ 297 - void sctp_transport_hold(struct sctp_transport *transport) 299 + int sctp_transport_hold(struct sctp_transport *transport) 298 300 { 299 - atomic_inc(&transport->refcnt); 301 + return atomic_add_unless(&transport->refcnt, 1, 0); 300 302 } 301 303 302 304 /* Release a reference to a transport and clean up
+8 -7
net/switchdev/switchdev.c
··· 20 20 #include <linux/list.h> 21 21 #include <linux/workqueue.h> 22 22 #include <linux/if_vlan.h> 23 + #include <linux/rtnetlink.h> 23 24 #include <net/ip_fib.h> 24 25 #include <net/switchdev.h> 25 26 ··· 568 567 } 569 568 EXPORT_SYMBOL_GPL(switchdev_port_obj_dump); 570 569 571 - static DEFINE_MUTEX(switchdev_mutex); 572 570 static RAW_NOTIFIER_HEAD(switchdev_notif_chain); 573 571 574 572 /** ··· 582 582 { 583 583 int err; 584 584 585 - mutex_lock(&switchdev_mutex); 585 + rtnl_lock(); 586 586 err = raw_notifier_chain_register(&switchdev_notif_chain, nb); 587 - mutex_unlock(&switchdev_mutex); 587 + rtnl_unlock(); 588 588 return err; 589 589 } 590 590 EXPORT_SYMBOL_GPL(register_switchdev_notifier); ··· 600 600 { 601 601 int err; 602 602 603 - mutex_lock(&switchdev_mutex); 603 + rtnl_lock(); 604 604 err = raw_notifier_chain_unregister(&switchdev_notif_chain, nb); 605 - mutex_unlock(&switchdev_mutex); 605 + rtnl_unlock(); 606 606 return err; 607 607 } 608 608 EXPORT_SYMBOL_GPL(unregister_switchdev_notifier); ··· 616 616 * Call all network notifier blocks. This should be called by driver 617 617 * when it needs to propagate hardware event. 618 618 * Return values are same as for atomic_notifier_call_chain(). 619 + * rtnl_lock must be held. 619 620 */ 620 621 int call_switchdev_notifiers(unsigned long val, struct net_device *dev, 621 622 struct switchdev_notifier_info *info) 622 623 { 623 624 int err; 624 625 626 + ASSERT_RTNL(); 627 + 625 628 info->dev = dev; 626 - mutex_lock(&switchdev_mutex); 627 629 err = raw_notifier_call_chain(&switchdev_notif_chain, val, info); 628 - mutex_unlock(&switchdev_mutex); 629 630 return err; 630 631 } 631 632 EXPORT_SYMBOL_GPL(call_switchdev_notifiers);
+5 -6
net/tipc/subscr.c
··· 289 289 struct sockaddr_tipc *addr, void *usr_data, 290 290 void *buf, size_t len) 291 291 { 292 - struct tipc_subscriber *subscriber = usr_data; 292 + struct tipc_subscriber *subscrb = usr_data; 293 293 struct tipc_subscription *sub = NULL; 294 294 struct tipc_net *tn = net_generic(net, tipc_net_id); 295 295 296 - tipc_subscrp_create(net, (struct tipc_subscr *)buf, subscriber, &sub); 297 - if (sub) 298 - tipc_nametbl_subscribe(sub); 299 - else 300 - tipc_conn_terminate(tn->topsrv, subscriber->conid); 296 + if (tipc_subscrp_create(net, (struct tipc_subscr *)buf, subscrb, &sub)) 297 + return tipc_conn_terminate(tn->topsrv, subscrb->conid); 298 + 299 + tipc_nametbl_subscribe(sub); 301 300 } 302 301 303 302 /* Handle one request to establish a new subscriber */
+1
net/unix/af_unix.c
··· 2339 2339 2340 2340 if (signal_pending(current)) { 2341 2341 err = sock_intr_errno(timeo); 2342 + scm_destroy(&scm); 2342 2343 goto out; 2343 2344 } 2344 2345
+25 -20
net/wireless/reg.c
··· 231 231 /* IEEE 802.11b/g, channels 1..11 */ 232 232 REG_RULE(2412-10, 2462+10, 40, 6, 20, 0), 233 233 /* IEEE 802.11b/g, channels 12..13. */ 234 - REG_RULE(2467-10, 2472+10, 40, 6, 20, 235 - NL80211_RRF_NO_IR), 234 + REG_RULE(2467-10, 2472+10, 20, 6, 20, 235 + NL80211_RRF_NO_IR | NL80211_RRF_AUTO_BW), 236 236 /* IEEE 802.11 channel 14 - Only JP enables 237 237 * this and for 802.11b only */ 238 238 REG_RULE(2484-10, 2484+10, 20, 6, 20, 239 239 NL80211_RRF_NO_IR | 240 240 NL80211_RRF_NO_OFDM), 241 241 /* IEEE 802.11a, channel 36..48 */ 242 - REG_RULE(5180-10, 5240+10, 160, 6, 20, 243 - NL80211_RRF_NO_IR), 242 + REG_RULE(5180-10, 5240+10, 80, 6, 20, 243 + NL80211_RRF_NO_IR | 244 + NL80211_RRF_AUTO_BW), 244 245 245 246 /* IEEE 802.11a, channel 52..64 - DFS required */ 246 - REG_RULE(5260-10, 5320+10, 160, 6, 20, 247 + REG_RULE(5260-10, 5320+10, 80, 6, 20, 247 248 NL80211_RRF_NO_IR | 249 + NL80211_RRF_AUTO_BW | 248 250 NL80211_RRF_DFS), 249 251 250 252 /* IEEE 802.11a, channel 100..144 - DFS required */ ··· 2747 2745 const struct ieee80211_power_rule *power_rule = NULL; 2748 2746 char bw[32], cac_time[32]; 2749 2747 2750 - pr_info(" (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)\n"); 2748 + pr_debug(" (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)\n"); 2751 2749 2752 2750 for (i = 0; i < rd->n_reg_rules; i++) { 2753 2751 reg_rule = &rd->reg_rules[i]; ··· 2774 2772 * in certain regions 2775 2773 */ 2776 2774 if (power_rule->max_antenna_gain) 2777 - pr_info(" (%d KHz - %d KHz @ %s), (%d mBi, %d mBm), (%s)\n", 2775 + pr_debug(" (%d KHz - %d KHz @ %s), (%d mBi, %d mBm), (%s)\n", 2778 2776 freq_range->start_freq_khz, 2779 2777 freq_range->end_freq_khz, 2780 2778 bw, ··· 2782 2780 power_rule->max_eirp, 2783 2781 cac_time); 2784 2782 else 2785 - pr_info(" (%d KHz - %d KHz @ %s), (N/A, %d mBm), (%s)\n", 2783 + pr_debug(" (%d KHz - %d KHz @ %s), (N/A, %d mBm), (%s)\n", 2786 2784 freq_range->start_freq_khz, 2787 2785 freq_range->end_freq_khz, 2788 2786 bw, ··· 2815 2813 struct cfg80211_registered_device *rdev; 2816 2814 rdev = cfg80211_rdev_by_wiphy_idx(lr->wiphy_idx); 2817 2815 if (rdev) { 2818 - pr_info("Current regulatory domain updated by AP to: %c%c\n", 2816 + pr_debug("Current regulatory domain updated by AP to: %c%c\n", 2819 2817 rdev->country_ie_alpha2[0], 2820 2818 rdev->country_ie_alpha2[1]); 2821 2819 } else 2822 - pr_info("Current regulatory domain intersected:\n"); 2820 + pr_debug("Current regulatory domain intersected:\n"); 2823 2821 } else 2824 - pr_info("Current regulatory domain intersected:\n"); 2822 + pr_debug("Current regulatory domain intersected:\n"); 2825 2823 } else if (is_world_regdom(rd->alpha2)) { 2826 - pr_info("World regulatory domain updated:\n"); 2824 + pr_debug("World regulatory domain updated:\n"); 2827 2825 } else { 2828 2826 if (is_unknown_alpha2(rd->alpha2)) 2829 - pr_info("Regulatory domain changed to driver built-in settings (unknown country)\n"); 2827 + pr_debug("Regulatory domain changed to driver built-in settings (unknown country)\n"); 2830 2828 else { 2831 2829 if (reg_request_cell_base(lr)) 2832 - pr_info("Regulatory domain changed to country: %c%c by Cell Station\n", 2830 + pr_debug("Regulatory domain changed to country: %c%c by Cell Station\n", 2833 2831 rd->alpha2[0], rd->alpha2[1]); 2834 2832 else 2835 - pr_info("Regulatory domain changed to country: %c%c\n", 2833 + pr_debug("Regulatory domain changed to country: %c%c\n", 2836 2834 rd->alpha2[0], rd->alpha2[1]); 2837 2835 } 2838 2836 } 2839 2837 2840 - pr_info(" DFS Master region: %s", reg_dfs_region_str(rd->dfs_region)); 2838 + pr_debug(" DFS Master region: %s", reg_dfs_region_str(rd->dfs_region)); 2841 2839 print_rd_rules(rd); 2842 2840 } 2843 2841 2844 2842 static void print_regdomain_info(const struct ieee80211_regdomain *rd) 2845 2843 { 2846 - pr_info("Regulatory domain: %c%c\n", rd->alpha2[0], rd->alpha2[1]); 2844 + pr_debug("Regulatory domain: %c%c\n", rd->alpha2[0], rd->alpha2[1]); 2847 2845 print_rd_rules(rd); 2848 2846 } 2849 2847 ··· 2864 2862 return -EALREADY; 2865 2863 2866 2864 if (!is_valid_rd(rd)) { 2867 - pr_err("Invalid regulatory domain detected:\n"); 2865 + pr_err("Invalid regulatory domain detected: %c%c\n", 2866 + rd->alpha2[0], rd->alpha2[1]); 2868 2867 print_regdomain_info(rd); 2869 2868 return -EINVAL; 2870 2869 } ··· 2901 2898 return -EALREADY; 2902 2899 2903 2900 if (!is_valid_rd(rd)) { 2904 - pr_err("Invalid regulatory domain detected:\n"); 2901 + pr_err("Invalid regulatory domain detected: %c%c\n", 2902 + rd->alpha2[0], rd->alpha2[1]); 2905 2903 print_regdomain_info(rd); 2906 2904 return -EINVAL; 2907 2905 } ··· 2960 2956 */ 2961 2957 2962 2958 if (!is_valid_rd(rd)) { 2963 - pr_err("Invalid regulatory domain detected:\n"); 2959 + pr_err("Invalid regulatory domain detected: %c%c\n", 2960 + rd->alpha2[0], rd->alpha2[1]); 2964 2961 print_regdomain_info(rd); 2965 2962 return -EINVAL; 2966 2963 }