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