diff options
75 files changed, 705 insertions, 231 deletions
diff --git a/Documentation/devicetree/bindings/net/stm32-dwmac.txt b/Documentation/devicetree/bindings/net/stm32-dwmac.txt index 1341012722aa..a90eef11dc46 100644 --- a/Documentation/devicetree/bindings/net/stm32-dwmac.txt +++ b/Documentation/devicetree/bindings/net/stm32-dwmac.txt | |||
@@ -14,8 +14,7 @@ Required properties: | |||
14 | - clock-names: Should be "stmmaceth" for the host clock. | 14 | - clock-names: Should be "stmmaceth" for the host clock. |
15 | Should be "mac-clk-tx" for the MAC TX clock. | 15 | Should be "mac-clk-tx" for the MAC TX clock. |
16 | Should be "mac-clk-rx" for the MAC RX clock. | 16 | Should be "mac-clk-rx" for the MAC RX clock. |
17 | For MPU family need to add also "ethstp" for power mode clock and, | 17 | For MPU family need to add also "ethstp" for power mode clock |
18 | "syscfg-clk" for SYSCFG clock. | ||
19 | - interrupt-names: Should contain a list of interrupt names corresponding to | 18 | - interrupt-names: Should contain a list of interrupt names corresponding to |
20 | the interrupts in the interrupts property, if available. | 19 | the interrupts in the interrupts property, if available. |
21 | Should be "macirq" for the main MAC IRQ | 20 | Should be "macirq" for the main MAC IRQ |
@@ -24,9 +23,9 @@ Required properties: | |||
24 | encompases the glue register, and the offset of the control register. | 23 | encompases the glue register, and the offset of the control register. |
25 | 24 | ||
26 | Optional properties: | 25 | Optional properties: |
27 | - clock-names: For MPU family "mac-clk-ck" for PHY without quartz | 26 | - clock-names: For MPU family "eth-ck" for PHY without quartz |
28 | - st,int-phyclk (boolean) : valid only where PHY do not have quartz and need to be clock | 27 | - st,eth-clk-sel (boolean) : set this property in RGMII PHY when you want to select RCC clock instead of ETH_CLK125. |
29 | by RCC | 28 | - st,eth-ref-clk-sel (boolean) : set this property in RMII mode when you have PHY without crystal 50MHz and want to select RCC clock instead of ETH_REF_CLK. |
30 | 29 | ||
31 | Example: | 30 | Example: |
32 | 31 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 17b59b66474b..e2ec45968a16 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1059,6 +1059,8 @@ L: netdev@vger.kernel.org | |||
1059 | S: Odd fixes | 1059 | S: Odd fixes |
1060 | F: drivers/net/appletalk/ | 1060 | F: drivers/net/appletalk/ |
1061 | F: net/appletalk/ | 1061 | F: net/appletalk/ |
1062 | F: include/linux/atalk.h | ||
1063 | F: include/uapi/linux/atalk.h | ||
1062 | 1064 | ||
1063 | APPLIED MICRO (APM) X-GENE DEVICE TREE SUPPORT | 1065 | APPLIED MICRO (APM) X-GENE DEVICE TREE SUPPORT |
1064 | M: Khuong Dinh <khuong@os.amperecomputing.com> | 1066 | M: Khuong Dinh <khuong@os.amperecomputing.com> |
diff --git a/arch/arm/boot/dts/stm32h743-pinctrl.dtsi b/arch/arm/boot/dts/stm32h743-pinctrl.dtsi index 24be8e63dec8..980b2769caf9 100644 --- a/arch/arm/boot/dts/stm32h743-pinctrl.dtsi +++ b/arch/arm/boot/dts/stm32h743-pinctrl.dtsi | |||
@@ -173,6 +173,21 @@ | |||
173 | }; | 173 | }; |
174 | }; | 174 | }; |
175 | 175 | ||
176 | ethernet_rmii: rmii@0 { | ||
177 | pins { | ||
178 | pinmux = <STM32_PINMUX('G', 11, AF11)>, | ||
179 | <STM32_PINMUX('G', 13, AF11)>, | ||
180 | <STM32_PINMUX('G', 12, AF11)>, | ||
181 | <STM32_PINMUX('C', 4, AF11)>, | ||
182 | <STM32_PINMUX('C', 5, AF11)>, | ||
183 | <STM32_PINMUX('A', 7, AF11)>, | ||
184 | <STM32_PINMUX('C', 1, AF11)>, | ||
185 | <STM32_PINMUX('A', 2, AF11)>, | ||
186 | <STM32_PINMUX('A', 1, AF11)>; | ||
187 | slew-rate = <2>; | ||
188 | }; | ||
189 | }; | ||
190 | |||
176 | usart1_pins: usart1@0 { | 191 | usart1_pins: usart1@0 { |
177 | pins1 { | 192 | pins1 { |
178 | pinmux = <STM32_PINMUX('B', 14, AF4)>; /* USART1_TX */ | 193 | pinmux = <STM32_PINMUX('B', 14, AF4)>; /* USART1_TX */ |
diff --git a/arch/arm/boot/dts/stm32h743.dtsi b/arch/arm/boot/dts/stm32h743.dtsi index 299af0723790..5cac79ebebb1 100644 --- a/arch/arm/boot/dts/stm32h743.dtsi +++ b/arch/arm/boot/dts/stm32h743.dtsi | |||
@@ -513,6 +513,19 @@ | |||
513 | status = "disabled"; | 513 | status = "disabled"; |
514 | }; | 514 | }; |
515 | }; | 515 | }; |
516 | |||
517 | mac: ethernet@40028000 { | ||
518 | compatible = "st,stm32-dwmac", "snps,dwmac-4.10a"; | ||
519 | reg = <0x40028000 0x8000>; | ||
520 | reg-names = "stmmaceth"; | ||
521 | interrupts = <61>; | ||
522 | interrupt-names = "macirq"; | ||
523 | clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx"; | ||
524 | clocks = <&rcc ETH1MAC_CK>, <&rcc ETH1TX_CK>, <&rcc ETH1RX_CK>; | ||
525 | st,syscon = <&syscfg 0x4>; | ||
526 | snps,pbl = <8>; | ||
527 | status = "disabled"; | ||
528 | }; | ||
516 | }; | 529 | }; |
517 | }; | 530 | }; |
518 | 531 | ||
diff --git a/arch/arm/boot/dts/stm32h743i-disco.dts b/arch/arm/boot/dts/stm32h743i-disco.dts index f8040356fe2d..dd06c8f3d09a 100644 --- a/arch/arm/boot/dts/stm32h743i-disco.dts +++ b/arch/arm/boot/dts/stm32h743i-disco.dts | |||
@@ -67,6 +67,23 @@ | |||
67 | clock-frequency = <25000000>; | 67 | clock-frequency = <25000000>; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | &mac { | ||
71 | status = "disabled"; | ||
72 | pinctrl-0 = <ðernet_rmii>; | ||
73 | pinctrl-names = "default"; | ||
74 | phy-mode = "rmii"; | ||
75 | phy-handle = <&phy0>; | ||
76 | |||
77 | mdio0 { | ||
78 | #address-cells = <1>; | ||
79 | #size-cells = <0>; | ||
80 | compatible = "snps,dwmac-mdio"; | ||
81 | phy0: ethernet-phy@0 { | ||
82 | reg = <0>; | ||
83 | }; | ||
84 | }; | ||
85 | }; | ||
86 | |||
70 | &usart2 { | 87 | &usart2 { |
71 | pinctrl-0 = <&usart2_pins>; | 88 | pinctrl-0 = <&usart2_pins>; |
72 | pinctrl-names = "default"; | 89 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/stm32h743i-eval.dts b/arch/arm/boot/dts/stm32h743i-eval.dts index ef34fa2f79ea..ebc3f0933f5c 100644 --- a/arch/arm/boot/dts/stm32h743i-eval.dts +++ b/arch/arm/boot/dts/stm32h743i-eval.dts | |||
@@ -105,6 +105,23 @@ | |||
105 | status = "okay"; | 105 | status = "okay"; |
106 | }; | 106 | }; |
107 | 107 | ||
108 | &mac { | ||
109 | status = "disabled"; | ||
110 | pinctrl-0 = <ðernet_rmii>; | ||
111 | pinctrl-names = "default"; | ||
112 | phy-mode = "rmii"; | ||
113 | phy-handle = <&phy0>; | ||
114 | |||
115 | mdio0 { | ||
116 | #address-cells = <1>; | ||
117 | #size-cells = <0>; | ||
118 | compatible = "snps,dwmac-mdio"; | ||
119 | phy0: ethernet-phy@0 { | ||
120 | reg = <0>; | ||
121 | }; | ||
122 | }; | ||
123 | }; | ||
124 | |||
108 | &usart1 { | 125 | &usart1 { |
109 | pinctrl-0 = <&usart1_pins>; | 126 | pinctrl-0 = <&usart1_pins>; |
110 | pinctrl-names = "default"; | 127 | pinctrl-names = "default"; |
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index ed5e42461094..ad48fd52cb53 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
@@ -250,6 +250,7 @@ void proc_coredump_connector(struct task_struct *task) | |||
250 | { | 250 | { |
251 | struct cn_msg *msg; | 251 | struct cn_msg *msg; |
252 | struct proc_event *ev; | 252 | struct proc_event *ev; |
253 | struct task_struct *parent; | ||
253 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 254 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
254 | 255 | ||
255 | if (atomic_read(&proc_event_num_listeners) < 1) | 256 | if (atomic_read(&proc_event_num_listeners) < 1) |
@@ -262,8 +263,14 @@ void proc_coredump_connector(struct task_struct *task) | |||
262 | ev->what = PROC_EVENT_COREDUMP; | 263 | ev->what = PROC_EVENT_COREDUMP; |
263 | ev->event_data.coredump.process_pid = task->pid; | 264 | ev->event_data.coredump.process_pid = task->pid; |
264 | ev->event_data.coredump.process_tgid = task->tgid; | 265 | ev->event_data.coredump.process_tgid = task->tgid; |
265 | ev->event_data.coredump.parent_pid = task->real_parent->pid; | 266 | |
266 | ev->event_data.coredump.parent_tgid = task->real_parent->tgid; | 267 | rcu_read_lock(); |
268 | if (pid_alive(task)) { | ||
269 | parent = rcu_dereference(task->real_parent); | ||
270 | ev->event_data.coredump.parent_pid = parent->pid; | ||
271 | ev->event_data.coredump.parent_tgid = parent->tgid; | ||
272 | } | ||
273 | rcu_read_unlock(); | ||
267 | 274 | ||
268 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 275 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
269 | msg->ack = 0; /* not used */ | 276 | msg->ack = 0; /* not used */ |
@@ -276,6 +283,7 @@ void proc_exit_connector(struct task_struct *task) | |||
276 | { | 283 | { |
277 | struct cn_msg *msg; | 284 | struct cn_msg *msg; |
278 | struct proc_event *ev; | 285 | struct proc_event *ev; |
286 | struct task_struct *parent; | ||
279 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 287 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
280 | 288 | ||
281 | if (atomic_read(&proc_event_num_listeners) < 1) | 289 | if (atomic_read(&proc_event_num_listeners) < 1) |
@@ -290,8 +298,14 @@ void proc_exit_connector(struct task_struct *task) | |||
290 | ev->event_data.exit.process_tgid = task->tgid; | 298 | ev->event_data.exit.process_tgid = task->tgid; |
291 | ev->event_data.exit.exit_code = task->exit_code; | 299 | ev->event_data.exit.exit_code = task->exit_code; |
292 | ev->event_data.exit.exit_signal = task->exit_signal; | 300 | ev->event_data.exit.exit_signal = task->exit_signal; |
293 | ev->event_data.exit.parent_pid = task->real_parent->pid; | 301 | |
294 | ev->event_data.exit.parent_tgid = task->real_parent->tgid; | 302 | rcu_read_lock(); |
303 | if (pid_alive(task)) { | ||
304 | parent = rcu_dereference(task->real_parent); | ||
305 | ev->event_data.exit.parent_pid = parent->pid; | ||
306 | ev->event_data.exit.parent_tgid = parent->tgid; | ||
307 | } | ||
308 | rcu_read_unlock(); | ||
295 | 309 | ||
296 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 310 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
297 | msg->ack = 0; /* not used */ | 311 | msg->ack = 0; /* not used */ |
diff --git a/drivers/isdn/hardware/mISDN/mISDNinfineon.c b/drivers/isdn/hardware/mISDN/mISDNinfineon.c index 3e01012be4ab..0fe6ddcb3fdc 100644 --- a/drivers/isdn/hardware/mISDN/mISDNinfineon.c +++ b/drivers/isdn/hardware/mISDN/mISDNinfineon.c | |||
@@ -712,8 +712,11 @@ setup_io(struct inf_hw *hw) | |||
712 | (ulong)hw->addr.start, (ulong)hw->addr.size); | 712 | (ulong)hw->addr.start, (ulong)hw->addr.size); |
713 | return err; | 713 | return err; |
714 | } | 714 | } |
715 | if (hw->ci->addr_mode == AM_MEMIO) | 715 | if (hw->ci->addr_mode == AM_MEMIO) { |
716 | hw->addr.p = ioremap(hw->addr.start, hw->addr.size); | 716 | hw->addr.p = ioremap(hw->addr.start, hw->addr.size); |
717 | if (unlikely(!hw->addr.p)) | ||
718 | return -ENOMEM; | ||
719 | } | ||
717 | hw->addr.mode = hw->ci->addr_mode; | 720 | hw->addr.mode = hw->ci->addr_mode; |
718 | if (debug & DEBUG_HW) | 721 | if (debug & DEBUG_HW) |
719 | pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n", | 722 | pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n", |
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index f4253d468ae1..755c6bbc9553 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c | |||
@@ -570,7 +570,7 @@ isdnloop_atimeout(isdnloop_card *card, int ch) | |||
570 | char buf[60]; | 570 | char buf[60]; |
571 | 571 | ||
572 | spin_lock_irqsave(&card->isdnloop_lock, flags); | 572 | spin_lock_irqsave(&card->isdnloop_lock, flags); |
573 | if (card->rcard) { | 573 | if (card->rcard[ch]) { |
574 | isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1); | 574 | isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1); |
575 | card->rcard[ch]->rcard[card->rch[ch]] = NULL; | 575 | card->rcard[ch]->rcard[card->rch[ch]] = NULL; |
576 | card->rcard[ch] = NULL; | 576 | card->rcard[ch] = NULL; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index d516def846ab..b388406ac0f5 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
@@ -127,7 +127,7 @@ static u8 *pcan_msg_init_empty(struct pcan_usb_pro_msg *pm, | |||
127 | /* | 127 | /* |
128 | * add one record to a message being built | 128 | * add one record to a message being built |
129 | */ | 129 | */ |
130 | static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, u8 id, ...) | 130 | static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, int id, ...) |
131 | { | 131 | { |
132 | int len, i; | 132 | int len, i; |
133 | u8 *pc; | 133 | u8 *pc; |
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 96728d1e9824..f4e2db44ad91 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c | |||
@@ -569,6 +569,9 @@ int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, int link, | |||
569 | goto restore_link; | 569 | goto restore_link; |
570 | } | 570 | } |
571 | 571 | ||
572 | if (speed == SPEED_MAX && chip->info->ops->port_max_speed_mode) | ||
573 | mode = chip->info->ops->port_max_speed_mode(port); | ||
574 | |||
572 | if (chip->info->ops->port_set_pause) { | 575 | if (chip->info->ops->port_set_pause) { |
573 | err = chip->info->ops->port_set_pause(chip, port, pause); | 576 | err = chip->info->ops->port_set_pause(chip, port, pause); |
574 | if (err) | 577 | if (err) |
@@ -3067,6 +3070,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { | |||
3067 | .port_set_duplex = mv88e6xxx_port_set_duplex, | 3070 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
3068 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, | 3071 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
3069 | .port_set_speed = mv88e6341_port_set_speed, | 3072 | .port_set_speed = mv88e6341_port_set_speed, |
3073 | .port_max_speed_mode = mv88e6341_port_max_speed_mode, | ||
3070 | .port_tag_remap = mv88e6095_port_tag_remap, | 3074 | .port_tag_remap = mv88e6095_port_tag_remap, |
3071 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, | 3075 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
3072 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, | 3076 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
@@ -3385,6 +3389,7 @@ static const struct mv88e6xxx_ops mv88e6190_ops = { | |||
3385 | .port_set_duplex = mv88e6xxx_port_set_duplex, | 3389 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
3386 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, | 3390 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
3387 | .port_set_speed = mv88e6390_port_set_speed, | 3391 | .port_set_speed = mv88e6390_port_set_speed, |
3392 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, | ||
3388 | .port_tag_remap = mv88e6390_port_tag_remap, | 3393 | .port_tag_remap = mv88e6390_port_tag_remap, |
3389 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, | 3394 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
3390 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, | 3395 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
@@ -3429,6 +3434,7 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = { | |||
3429 | .port_set_duplex = mv88e6xxx_port_set_duplex, | 3434 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
3430 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, | 3435 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
3431 | .port_set_speed = mv88e6390x_port_set_speed, | 3436 | .port_set_speed = mv88e6390x_port_set_speed, |
3437 | .port_max_speed_mode = mv88e6390x_port_max_speed_mode, | ||
3432 | .port_tag_remap = mv88e6390_port_tag_remap, | 3438 | .port_tag_remap = mv88e6390_port_tag_remap, |
3433 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, | 3439 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
3434 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, | 3440 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
@@ -3473,6 +3479,7 @@ static const struct mv88e6xxx_ops mv88e6191_ops = { | |||
3473 | .port_set_duplex = mv88e6xxx_port_set_duplex, | 3479 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
3474 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, | 3480 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
3475 | .port_set_speed = mv88e6390_port_set_speed, | 3481 | .port_set_speed = mv88e6390_port_set_speed, |
3482 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, | ||
3476 | .port_tag_remap = mv88e6390_port_tag_remap, | 3483 | .port_tag_remap = mv88e6390_port_tag_remap, |
3477 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, | 3484 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
3478 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, | 3485 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
@@ -3566,6 +3573,7 @@ static const struct mv88e6xxx_ops mv88e6290_ops = { | |||
3566 | .port_set_duplex = mv88e6xxx_port_set_duplex, | 3573 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
3567 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, | 3574 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
3568 | .port_set_speed = mv88e6390_port_set_speed, | 3575 | .port_set_speed = mv88e6390_port_set_speed, |
3576 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, | ||
3569 | .port_tag_remap = mv88e6390_port_tag_remap, | 3577 | .port_tag_remap = mv88e6390_port_tag_remap, |
3570 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, | 3578 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
3571 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, | 3579 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
@@ -3697,6 +3705,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { | |||
3697 | .port_set_duplex = mv88e6xxx_port_set_duplex, | 3705 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
3698 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, | 3706 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
3699 | .port_set_speed = mv88e6341_port_set_speed, | 3707 | .port_set_speed = mv88e6341_port_set_speed, |
3708 | .port_max_speed_mode = mv88e6341_port_max_speed_mode, | ||
3700 | .port_tag_remap = mv88e6095_port_tag_remap, | 3709 | .port_tag_remap = mv88e6095_port_tag_remap, |
3701 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, | 3710 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
3702 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, | 3711 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
@@ -3872,6 +3881,7 @@ static const struct mv88e6xxx_ops mv88e6390_ops = { | |||
3872 | .port_set_duplex = mv88e6xxx_port_set_duplex, | 3881 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
3873 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, | 3882 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
3874 | .port_set_speed = mv88e6390_port_set_speed, | 3883 | .port_set_speed = mv88e6390_port_set_speed, |
3884 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, | ||
3875 | .port_tag_remap = mv88e6390_port_tag_remap, | 3885 | .port_tag_remap = mv88e6390_port_tag_remap, |
3876 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, | 3886 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
3877 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, | 3887 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
@@ -3920,6 +3930,7 @@ static const struct mv88e6xxx_ops mv88e6390x_ops = { | |||
3920 | .port_set_duplex = mv88e6xxx_port_set_duplex, | 3930 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
3921 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, | 3931 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
3922 | .port_set_speed = mv88e6390x_port_set_speed, | 3932 | .port_set_speed = mv88e6390x_port_set_speed, |
3933 | .port_max_speed_mode = mv88e6390x_port_max_speed_mode, | ||
3923 | .port_tag_remap = mv88e6390_port_tag_remap, | 3934 | .port_tag_remap = mv88e6390_port_tag_remap, |
3924 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, | 3935 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
3925 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, | 3936 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index adcf60779895..19c07dff0440 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h | |||
@@ -377,6 +377,9 @@ struct mv88e6xxx_ops { | |||
377 | */ | 377 | */ |
378 | int (*port_set_speed)(struct mv88e6xxx_chip *chip, int port, int speed); | 378 | int (*port_set_speed)(struct mv88e6xxx_chip *chip, int port, int speed); |
379 | 379 | ||
380 | /* What interface mode should be used for maximum speed? */ | ||
381 | phy_interface_t (*port_max_speed_mode)(int port); | ||
382 | |||
380 | int (*port_tag_remap)(struct mv88e6xxx_chip *chip, int port); | 383 | int (*port_tag_remap)(struct mv88e6xxx_chip *chip, int port); |
381 | 384 | ||
382 | int (*port_set_frame_mode)(struct mv88e6xxx_chip *chip, int port, | 385 | int (*port_set_frame_mode)(struct mv88e6xxx_chip *chip, int port, |
diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index 0796c6feec55..dce84a2a65c7 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c | |||
@@ -312,6 +312,14 @@ int mv88e6341_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) | |||
312 | return mv88e6xxx_port_set_speed(chip, port, speed, !port, true); | 312 | return mv88e6xxx_port_set_speed(chip, port, speed, !port, true); |
313 | } | 313 | } |
314 | 314 | ||
315 | phy_interface_t mv88e6341_port_max_speed_mode(int port) | ||
316 | { | ||
317 | if (port == 5) | ||
318 | return PHY_INTERFACE_MODE_2500BASEX; | ||
319 | |||
320 | return PHY_INTERFACE_MODE_NA; | ||
321 | } | ||
322 | |||
315 | /* Support 10, 100, 200, 1000 Mbps (e.g. 88E6352 family) */ | 323 | /* Support 10, 100, 200, 1000 Mbps (e.g. 88E6352 family) */ |
316 | int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) | 324 | int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) |
317 | { | 325 | { |
@@ -345,6 +353,14 @@ int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) | |||
345 | return mv88e6xxx_port_set_speed(chip, port, speed, true, true); | 353 | return mv88e6xxx_port_set_speed(chip, port, speed, true, true); |
346 | } | 354 | } |
347 | 355 | ||
356 | phy_interface_t mv88e6390_port_max_speed_mode(int port) | ||
357 | { | ||
358 | if (port == 9 || port == 10) | ||
359 | return PHY_INTERFACE_MODE_2500BASEX; | ||
360 | |||
361 | return PHY_INTERFACE_MODE_NA; | ||
362 | } | ||
363 | |||
348 | /* Support 10, 100, 200, 1000, 2500, 10000 Mbps (e.g. 88E6190X) */ | 364 | /* Support 10, 100, 200, 1000, 2500, 10000 Mbps (e.g. 88E6190X) */ |
349 | int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) | 365 | int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) |
350 | { | 366 | { |
@@ -360,6 +376,14 @@ int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) | |||
360 | return mv88e6xxx_port_set_speed(chip, port, speed, true, true); | 376 | return mv88e6xxx_port_set_speed(chip, port, speed, true, true); |
361 | } | 377 | } |
362 | 378 | ||
379 | phy_interface_t mv88e6390x_port_max_speed_mode(int port) | ||
380 | { | ||
381 | if (port == 9 || port == 10) | ||
382 | return PHY_INTERFACE_MODE_XAUI; | ||
383 | |||
384 | return PHY_INTERFACE_MODE_NA; | ||
385 | } | ||
386 | |||
363 | int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, | 387 | int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
364 | phy_interface_t mode) | 388 | phy_interface_t mode) |
365 | { | 389 | { |
diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h index 4aadf321edb7..c7bed263a0f4 100644 --- a/drivers/net/dsa/mv88e6xxx/port.h +++ b/drivers/net/dsa/mv88e6xxx/port.h | |||
@@ -285,6 +285,10 @@ int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); | |||
285 | int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); | 285 | int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); |
286 | int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); | 286 | int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); |
287 | 287 | ||
288 | phy_interface_t mv88e6341_port_max_speed_mode(int port); | ||
289 | phy_interface_t mv88e6390_port_max_speed_mode(int port); | ||
290 | phy_interface_t mv88e6390x_port_max_speed_mode(int port); | ||
291 | |||
288 | int mv88e6xxx_port_set_state(struct mv88e6xxx_chip *chip, int port, u8 state); | 292 | int mv88e6xxx_port_set_state(struct mv88e6xxx_chip *chip, int port, u8 state); |
289 | 293 | ||
290 | int mv88e6xxx_port_set_vlan_map(struct mv88e6xxx_chip *chip, int port, u16 map); | 294 | int mv88e6xxx_port_set_vlan_map(struct mv88e6xxx_chip *chip, int port, u16 map); |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 9a7f70db20c7..733d9172425b 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -119,7 +119,7 @@ static void enic_init_affinity_hint(struct enic *enic) | |||
119 | 119 | ||
120 | for (i = 0; i < enic->intr_count; i++) { | 120 | for (i = 0; i < enic->intr_count; i++) { |
121 | if (enic_is_err_intr(enic, i) || enic_is_notify_intr(enic, i) || | 121 | if (enic_is_err_intr(enic, i) || enic_is_notify_intr(enic, i) || |
122 | (enic->msix[i].affinity_mask && | 122 | (cpumask_available(enic->msix[i].affinity_mask) && |
123 | !cpumask_empty(enic->msix[i].affinity_mask))) | 123 | !cpumask_empty(enic->msix[i].affinity_mask))) |
124 | continue; | 124 | continue; |
125 | if (zalloc_cpumask_var(&enic->msix[i].affinity_mask, | 125 | if (zalloc_cpumask_var(&enic->msix[i].affinity_mask, |
@@ -148,7 +148,7 @@ static void enic_set_affinity_hint(struct enic *enic) | |||
148 | for (i = 0; i < enic->intr_count; i++) { | 148 | for (i = 0; i < enic->intr_count; i++) { |
149 | if (enic_is_err_intr(enic, i) || | 149 | if (enic_is_err_intr(enic, i) || |
150 | enic_is_notify_intr(enic, i) || | 150 | enic_is_notify_intr(enic, i) || |
151 | !enic->msix[i].affinity_mask || | 151 | !cpumask_available(enic->msix[i].affinity_mask) || |
152 | cpumask_empty(enic->msix[i].affinity_mask)) | 152 | cpumask_empty(enic->msix[i].affinity_mask)) |
153 | continue; | 153 | continue; |
154 | err = irq_set_affinity_hint(enic->msix_entry[i].vector, | 154 | err = irq_set_affinity_hint(enic->msix_entry[i].vector, |
@@ -161,7 +161,7 @@ static void enic_set_affinity_hint(struct enic *enic) | |||
161 | for (i = 0; i < enic->wq_count; i++) { | 161 | for (i = 0; i < enic->wq_count; i++) { |
162 | int wq_intr = enic_msix_wq_intr(enic, i); | 162 | int wq_intr = enic_msix_wq_intr(enic, i); |
163 | 163 | ||
164 | if (enic->msix[wq_intr].affinity_mask && | 164 | if (cpumask_available(enic->msix[wq_intr].affinity_mask) && |
165 | !cpumask_empty(enic->msix[wq_intr].affinity_mask)) | 165 | !cpumask_empty(enic->msix[wq_intr].affinity_mask)) |
166 | netif_set_xps_queue(enic->netdev, | 166 | netif_set_xps_queue(enic->netdev, |
167 | enic->msix[wq_intr].affinity_mask, | 167 | enic->msix[wq_intr].affinity_mask, |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 66d7a8b80e76..38b430f11fc1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h | |||
@@ -194,6 +194,7 @@ struct hnae3_ae_dev { | |||
194 | const struct hnae3_ae_ops *ops; | 194 | const struct hnae3_ae_ops *ops; |
195 | struct list_head node; | 195 | struct list_head node; |
196 | u32 flag; | 196 | u32 flag; |
197 | u8 override_pci_need_reset; /* fix to stop multiple reset happening */ | ||
197 | enum hnae3_dev_type dev_type; | 198 | enum hnae3_dev_type dev_type; |
198 | enum hnae3_reset_type reset_type; | 199 | enum hnae3_reset_type reset_type; |
199 | void *priv; | 200 | void *priv; |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 3cb43b1f1c2e..1c1f17ec6be2 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | |||
@@ -1850,7 +1850,9 @@ static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev) | |||
1850 | 1850 | ||
1851 | /* request the reset */ | 1851 | /* request the reset */ |
1852 | if (ae_dev->ops->reset_event) { | 1852 | if (ae_dev->ops->reset_event) { |
1853 | ae_dev->ops->reset_event(pdev, NULL); | 1853 | if (!ae_dev->override_pci_need_reset) |
1854 | ae_dev->ops->reset_event(pdev, NULL); | ||
1855 | |||
1854 | return PCI_ERS_RESULT_RECOVERED; | 1856 | return PCI_ERS_RESULT_RECOVERED; |
1855 | } | 1857 | } |
1856 | 1858 | ||
@@ -2321,8 +2323,8 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb, | |||
2321 | if (!(bd_base_info & BIT(HNS3_RXD_L3L4P_B))) | 2323 | if (!(bd_base_info & BIT(HNS3_RXD_L3L4P_B))) |
2322 | return; | 2324 | return; |
2323 | 2325 | ||
2324 | if (unlikely(l234info & (BIT(HNS3_RXD_L3E_B) | BIT(HNS3_RXD_L4E_B) || | 2326 | if (unlikely(l234info & (BIT(HNS3_RXD_L3E_B) | BIT(HNS3_RXD_L4E_B) | |
2325 | BIT(HNS3_RXD_OL3E_B) || | 2327 | BIT(HNS3_RXD_OL3E_B) | |
2326 | BIT(HNS3_RXD_OL4E_B)))) { | 2328 | BIT(HNS3_RXD_OL4E_B)))) { |
2327 | u64_stats_update_begin(&ring->syncp); | 2329 | u64_stats_update_begin(&ring->syncp); |
2328 | ring->stats.l3l4_csum_err++; | 2330 | ring->stats.l3l4_csum_err++; |
@@ -2472,6 +2474,8 @@ static int hns3_add_frag(struct hns3_enet_ring *ring, struct hns3_desc *desc, | |||
2472 | desc = &ring->desc[ring->next_to_clean]; | 2474 | desc = &ring->desc[ring->next_to_clean]; |
2473 | desc_cb = &ring->desc_cb[ring->next_to_clean]; | 2475 | desc_cb = &ring->desc_cb[ring->next_to_clean]; |
2474 | bd_base_info = le32_to_cpu(desc->rx.bd_base_info); | 2476 | bd_base_info = le32_to_cpu(desc->rx.bd_base_info); |
2477 | /* make sure HW write desc complete */ | ||
2478 | dma_rmb(); | ||
2475 | if (!(bd_base_info & BIT(HNS3_RXD_VLD_B))) | 2479 | if (!(bd_base_info & BIT(HNS3_RXD_VLD_B))) |
2476 | return -ENXIO; | 2480 | return -ENXIO; |
2477 | 2481 | ||
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c index 1feceff1477c..1f52d11f77b5 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | |||
@@ -1317,8 +1317,10 @@ pci_ers_result_t hclge_handle_hw_ras_error(struct hnae3_ae_dev *ae_dev) | |||
1317 | hclge_handle_all_ras_errors(hdev); | 1317 | hclge_handle_all_ras_errors(hdev); |
1318 | } else { | 1318 | } else { |
1319 | if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) || | 1319 | if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) || |
1320 | hdev->pdev->revision < 0x21) | 1320 | hdev->pdev->revision < 0x21) { |
1321 | ae_dev->override_pci_need_reset = 1; | ||
1321 | return PCI_ERS_RESULT_RECOVERED; | 1322 | return PCI_ERS_RESULT_RECOVERED; |
1323 | } | ||
1322 | } | 1324 | } |
1323 | 1325 | ||
1324 | if (status & HCLGE_RAS_REG_ROCEE_ERR_MASK) { | 1326 | if (status & HCLGE_RAS_REG_ROCEE_ERR_MASK) { |
@@ -1327,8 +1329,11 @@ pci_ers_result_t hclge_handle_hw_ras_error(struct hnae3_ae_dev *ae_dev) | |||
1327 | } | 1329 | } |
1328 | 1330 | ||
1329 | if (status & HCLGE_RAS_REG_NFE_MASK || | 1331 | if (status & HCLGE_RAS_REG_NFE_MASK || |
1330 | status & HCLGE_RAS_REG_ROCEE_ERR_MASK) | 1332 | status & HCLGE_RAS_REG_ROCEE_ERR_MASK) { |
1333 | ae_dev->override_pci_need_reset = 0; | ||
1331 | return PCI_ERS_RESULT_NEED_RESET; | 1334 | return PCI_ERS_RESULT_NEED_RESET; |
1335 | } | ||
1336 | ae_dev->override_pci_need_reset = 1; | ||
1332 | 1337 | ||
1333 | return PCI_ERS_RESULT_RECOVERED; | 1338 | return PCI_ERS_RESULT_RECOVERED; |
1334 | } | 1339 | } |
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h b/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h index 166d7f71442e..372adea10e14 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h | |||
@@ -392,7 +392,7 @@ | |||
392 | #define NFP_NET_CFG_MBOX_SIMPLE_CMD 0x0 | 392 | #define NFP_NET_CFG_MBOX_SIMPLE_CMD 0x0 |
393 | #define NFP_NET_CFG_MBOX_SIMPLE_RET 0x4 | 393 | #define NFP_NET_CFG_MBOX_SIMPLE_RET 0x4 |
394 | #define NFP_NET_CFG_MBOX_SIMPLE_VAL 0x8 | 394 | #define NFP_NET_CFG_MBOX_SIMPLE_VAL 0x8 |
395 | #define NFP_NET_CFG_MBOX_SIMPLE_LEN 0x12 | 395 | #define NFP_NET_CFG_MBOX_SIMPLE_LEN 12 |
396 | 396 | ||
397 | #define NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_ADD 1 | 397 | #define NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_ADD 1 |
398 | #define NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_KILL 2 | 398 | #define NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_KILL 2 |
diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c index c6238083e898..b4c8949933f1 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c +++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c | |||
@@ -1663,8 +1663,11 @@ static int qede_selftest_run_loopback(struct qede_dev *edev, u32 loopback_mode) | |||
1663 | /* Wait for loopback configuration to apply */ | 1663 | /* Wait for loopback configuration to apply */ |
1664 | msleep_interruptible(500); | 1664 | msleep_interruptible(500); |
1665 | 1665 | ||
1666 | /* prepare the loopback packet */ | 1666 | /* Setting max packet size to 1.5K to avoid data being split over |
1667 | pkt_size = edev->ndev->mtu + ETH_HLEN; | 1667 | * multiple BDs in cases where MTU > PAGE_SIZE. |
1668 | */ | ||
1669 | pkt_size = (((edev->ndev->mtu < ETH_DATA_LEN) ? | ||
1670 | edev->ndev->mtu : ETH_DATA_LEN) + ETH_HLEN); | ||
1668 | 1671 | ||
1669 | skb = netdev_alloc_skb(edev->ndev, pkt_size); | 1672 | skb = netdev_alloc_skb(edev->ndev, pkt_size); |
1670 | if (!skb) { | 1673 | if (!skb) { |
diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c index 69d752f0b621..55d01266e615 100644 --- a/drivers/net/ethernet/realtek/8139too.c +++ b/drivers/net/ethernet/realtek/8139too.c | |||
@@ -258,6 +258,7 @@ static const struct pci_device_id rtl8139_pci_tbl[] = { | |||
258 | {0x126c, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, | 258 | {0x126c, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, |
259 | {0x1743, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, | 259 | {0x1743, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, |
260 | {0x021b, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, | 260 | {0x021b, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, |
261 | {0x16ec, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, | ||
261 | 262 | ||
262 | #ifdef CONFIG_SH_SECUREEDGE5410 | 263 | #ifdef CONFIG_SH_SECUREEDGE5410 |
263 | /* Bogus 8139 silicon reports 8129 without external PROM :-( */ | 264 | /* Bogus 8139 silicon reports 8129 without external PROM :-( */ |
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index d28c8f9ca55b..8154b38c08f7 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c | |||
@@ -458,7 +458,7 @@ static int ravb_dmac_init(struct net_device *ndev) | |||
458 | RCR_EFFS | RCR_ENCF | RCR_ETS0 | RCR_ESF | 0x18000000, RCR); | 458 | RCR_EFFS | RCR_ENCF | RCR_ETS0 | RCR_ESF | 0x18000000, RCR); |
459 | 459 | ||
460 | /* Set FIFO size */ | 460 | /* Set FIFO size */ |
461 | ravb_write(ndev, TGC_TQP_AVBMODE1 | 0x00222200, TGC); | 461 | ravb_write(ndev, TGC_TQP_AVBMODE1 | 0x00112200, TGC); |
462 | 462 | ||
463 | /* Timestamp enable */ | 463 | /* Timestamp enable */ |
464 | ravb_write(ndev, TCCR_TFEN, TCCR); | 464 | ravb_write(ndev, TCCR_TFEN, TCCR); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c index 7e2e79dedebf..062a600fa5a7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | |||
@@ -25,9 +25,24 @@ | |||
25 | 25 | ||
26 | #define SYSCFG_MCU_ETH_MASK BIT(23) | 26 | #define SYSCFG_MCU_ETH_MASK BIT(23) |
27 | #define SYSCFG_MP1_ETH_MASK GENMASK(23, 16) | 27 | #define SYSCFG_MP1_ETH_MASK GENMASK(23, 16) |
28 | #define SYSCFG_PMCCLRR_OFFSET 0x40 | ||
28 | 29 | ||
29 | #define SYSCFG_PMCR_ETH_CLK_SEL BIT(16) | 30 | #define SYSCFG_PMCR_ETH_CLK_SEL BIT(16) |
30 | #define SYSCFG_PMCR_ETH_REF_CLK_SEL BIT(17) | 31 | #define SYSCFG_PMCR_ETH_REF_CLK_SEL BIT(17) |
32 | |||
33 | /* Ethernet PHY interface selection in register SYSCFG Configuration | ||
34 | *------------------------------------------ | ||
35 | * src |BIT(23)| BIT(22)| BIT(21)|BIT(20)| | ||
36 | *------------------------------------------ | ||
37 | * MII | 0 | 0 | 0 | 1 | | ||
38 | *------------------------------------------ | ||
39 | * GMII | 0 | 0 | 0 | 0 | | ||
40 | *------------------------------------------ | ||
41 | * RGMII | 0 | 0 | 1 | n/a | | ||
42 | *------------------------------------------ | ||
43 | * RMII | 1 | 0 | 0 | n/a | | ||
44 | *------------------------------------------ | ||
45 | */ | ||
31 | #define SYSCFG_PMCR_ETH_SEL_MII BIT(20) | 46 | #define SYSCFG_PMCR_ETH_SEL_MII BIT(20) |
32 | #define SYSCFG_PMCR_ETH_SEL_RGMII BIT(21) | 47 | #define SYSCFG_PMCR_ETH_SEL_RGMII BIT(21) |
33 | #define SYSCFG_PMCR_ETH_SEL_RMII BIT(23) | 48 | #define SYSCFG_PMCR_ETH_SEL_RMII BIT(23) |
@@ -35,14 +50,54 @@ | |||
35 | #define SYSCFG_MCU_ETH_SEL_MII 0 | 50 | #define SYSCFG_MCU_ETH_SEL_MII 0 |
36 | #define SYSCFG_MCU_ETH_SEL_RMII 1 | 51 | #define SYSCFG_MCU_ETH_SEL_RMII 1 |
37 | 52 | ||
53 | /* STM32MP1 register definitions | ||
54 | * | ||
55 | * Below table summarizes the clock requirement and clock sources for | ||
56 | * supported phy interface modes. | ||
57 | * __________________________________________________________________________ | ||
58 | *|PHY_MODE | Normal | PHY wo crystal| PHY wo crystal |No 125Mhz from PHY| | ||
59 | *| | | 25MHz | 50MHz | | | ||
60 | * --------------------------------------------------------------------------- | ||
61 | *| MII | - | eth-ck | n/a | n/a | | ||
62 | *| | | | | | | ||
63 | * --------------------------------------------------------------------------- | ||
64 | *| GMII | - | eth-ck | n/a | n/a | | ||
65 | *| | | | | | | ||
66 | * --------------------------------------------------------------------------- | ||
67 | *| RGMII | - | eth-ck | n/a | eth-ck (no pin) | | ||
68 | *| | | | | st,eth-clk-sel | | ||
69 | * --------------------------------------------------------------------------- | ||
70 | *| RMII | - | eth-ck | eth-ck | n/a | | ||
71 | *| | | | st,eth-ref-clk-sel | | | ||
72 | * --------------------------------------------------------------------------- | ||
73 | * | ||
74 | * BIT(17) : set this bit in RMII mode when you have PHY without crystal 50MHz | ||
75 | * BIT(16) : set this bit in GMII/RGMII PHY when you do not want use 125Mhz | ||
76 | * from PHY | ||
77 | *----------------------------------------------------- | ||
78 | * src | BIT(17) | BIT(16) | | ||
79 | *----------------------------------------------------- | ||
80 | * MII | n/a | n/a | | ||
81 | *----------------------------------------------------- | ||
82 | * GMII | n/a | st,eth-clk-sel | | ||
83 | *----------------------------------------------------- | ||
84 | * RGMII | n/a | st,eth-clk-sel | | ||
85 | *----------------------------------------------------- | ||
86 | * RMII | st,eth-ref-clk-sel | n/a | | ||
87 | *----------------------------------------------------- | ||
88 | * | ||
89 | */ | ||
90 | |||
38 | struct stm32_dwmac { | 91 | struct stm32_dwmac { |
39 | struct clk *clk_tx; | 92 | struct clk *clk_tx; |
40 | struct clk *clk_rx; | 93 | struct clk *clk_rx; |
41 | struct clk *clk_eth_ck; | 94 | struct clk *clk_eth_ck; |
42 | struct clk *clk_ethstp; | 95 | struct clk *clk_ethstp; |
43 | struct clk *syscfg_clk; | 96 | struct clk *syscfg_clk; |
44 | bool int_phyclk; /* Clock from RCC to drive PHY */ | 97 | int eth_clk_sel_reg; |
45 | u32 mode_reg; /* MAC glue-logic mode register */ | 98 | int eth_ref_clk_sel_reg; |
99 | int irq_pwr_wakeup; | ||
100 | u32 mode_reg; /* MAC glue-logic mode register */ | ||
46 | struct regmap *regmap; | 101 | struct regmap *regmap; |
47 | u32 speed; | 102 | u32 speed; |
48 | const struct stm32_ops *ops; | 103 | const struct stm32_ops *ops; |
@@ -102,7 +157,7 @@ static int stm32mp1_clk_prepare(struct stm32_dwmac *dwmac, bool prepare) | |||
102 | if (ret) | 157 | if (ret) |
103 | return ret; | 158 | return ret; |
104 | 159 | ||
105 | if (dwmac->int_phyclk) { | 160 | if (dwmac->clk_eth_ck) { |
106 | ret = clk_prepare_enable(dwmac->clk_eth_ck); | 161 | ret = clk_prepare_enable(dwmac->clk_eth_ck); |
107 | if (ret) { | 162 | if (ret) { |
108 | clk_disable_unprepare(dwmac->syscfg_clk); | 163 | clk_disable_unprepare(dwmac->syscfg_clk); |
@@ -111,7 +166,7 @@ static int stm32mp1_clk_prepare(struct stm32_dwmac *dwmac, bool prepare) | |||
111 | } | 166 | } |
112 | } else { | 167 | } else { |
113 | clk_disable_unprepare(dwmac->syscfg_clk); | 168 | clk_disable_unprepare(dwmac->syscfg_clk); |
114 | if (dwmac->int_phyclk) | 169 | if (dwmac->clk_eth_ck) |
115 | clk_disable_unprepare(dwmac->clk_eth_ck); | 170 | clk_disable_unprepare(dwmac->clk_eth_ck); |
116 | } | 171 | } |
117 | return ret; | 172 | return ret; |
@@ -121,7 +176,7 @@ static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat) | |||
121 | { | 176 | { |
122 | struct stm32_dwmac *dwmac = plat_dat->bsp_priv; | 177 | struct stm32_dwmac *dwmac = plat_dat->bsp_priv; |
123 | u32 reg = dwmac->mode_reg; | 178 | u32 reg = dwmac->mode_reg; |
124 | int val; | 179 | int val, ret; |
125 | 180 | ||
126 | switch (plat_dat->interface) { | 181 | switch (plat_dat->interface) { |
127 | case PHY_INTERFACE_MODE_MII: | 182 | case PHY_INTERFACE_MODE_MII: |
@@ -130,19 +185,22 @@ static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat) | |||
130 | break; | 185 | break; |
131 | case PHY_INTERFACE_MODE_GMII: | 186 | case PHY_INTERFACE_MODE_GMII: |
132 | val = SYSCFG_PMCR_ETH_SEL_GMII; | 187 | val = SYSCFG_PMCR_ETH_SEL_GMII; |
133 | if (dwmac->int_phyclk) | 188 | if (dwmac->eth_clk_sel_reg) |
134 | val |= SYSCFG_PMCR_ETH_CLK_SEL; | 189 | val |= SYSCFG_PMCR_ETH_CLK_SEL; |
135 | pr_debug("SYSCFG init : PHY_INTERFACE_MODE_GMII\n"); | 190 | pr_debug("SYSCFG init : PHY_INTERFACE_MODE_GMII\n"); |
136 | break; | 191 | break; |
137 | case PHY_INTERFACE_MODE_RMII: | 192 | case PHY_INTERFACE_MODE_RMII: |
138 | val = SYSCFG_PMCR_ETH_SEL_RMII; | 193 | val = SYSCFG_PMCR_ETH_SEL_RMII; |
139 | if (dwmac->int_phyclk) | 194 | if (dwmac->eth_ref_clk_sel_reg) |
140 | val |= SYSCFG_PMCR_ETH_REF_CLK_SEL; | 195 | val |= SYSCFG_PMCR_ETH_REF_CLK_SEL; |
141 | pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RMII\n"); | 196 | pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RMII\n"); |
142 | break; | 197 | break; |
143 | case PHY_INTERFACE_MODE_RGMII: | 198 | case PHY_INTERFACE_MODE_RGMII: |
199 | case PHY_INTERFACE_MODE_RGMII_ID: | ||
200 | case PHY_INTERFACE_MODE_RGMII_RXID: | ||
201 | case PHY_INTERFACE_MODE_RGMII_TXID: | ||
144 | val = SYSCFG_PMCR_ETH_SEL_RGMII; | 202 | val = SYSCFG_PMCR_ETH_SEL_RGMII; |
145 | if (dwmac->int_phyclk) | 203 | if (dwmac->eth_clk_sel_reg) |
146 | val |= SYSCFG_PMCR_ETH_CLK_SEL; | 204 | val |= SYSCFG_PMCR_ETH_CLK_SEL; |
147 | pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RGMII\n"); | 205 | pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RGMII\n"); |
148 | break; | 206 | break; |
@@ -153,6 +211,11 @@ static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat) | |||
153 | return -EINVAL; | 211 | return -EINVAL; |
154 | } | 212 | } |
155 | 213 | ||
214 | /* Need to update PMCCLRR (clear register) */ | ||
215 | ret = regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET, | ||
216 | dwmac->ops->syscfg_eth_mask); | ||
217 | |||
218 | /* Update PMCSETR (set register) */ | ||
156 | return regmap_update_bits(dwmac->regmap, reg, | 219 | return regmap_update_bits(dwmac->regmap, reg, |
157 | dwmac->ops->syscfg_eth_mask, val); | 220 | dwmac->ops->syscfg_eth_mask, val); |
158 | } | 221 | } |
@@ -180,7 +243,7 @@ static int stm32mcu_set_mode(struct plat_stmmacenet_data *plat_dat) | |||
180 | } | 243 | } |
181 | 244 | ||
182 | return regmap_update_bits(dwmac->regmap, reg, | 245 | return regmap_update_bits(dwmac->regmap, reg, |
183 | dwmac->ops->syscfg_eth_mask, val); | 246 | dwmac->ops->syscfg_eth_mask, val << 23); |
184 | } | 247 | } |
185 | 248 | ||
186 | static void stm32_dwmac_clk_disable(struct stm32_dwmac *dwmac) | 249 | static void stm32_dwmac_clk_disable(struct stm32_dwmac *dwmac) |
@@ -232,24 +295,29 @@ static int stm32_dwmac_parse_data(struct stm32_dwmac *dwmac, | |||
232 | static int stm32mp1_parse_data(struct stm32_dwmac *dwmac, | 295 | static int stm32mp1_parse_data(struct stm32_dwmac *dwmac, |
233 | struct device *dev) | 296 | struct device *dev) |
234 | { | 297 | { |
298 | struct platform_device *pdev = to_platform_device(dev); | ||
235 | struct device_node *np = dev->of_node; | 299 | struct device_node *np = dev->of_node; |
300 | int err = 0; | ||
236 | 301 | ||
237 | dwmac->int_phyclk = of_property_read_bool(np, "st,int-phyclk"); | 302 | /* Gigabit Ethernet 125MHz clock selection. */ |
303 | dwmac->eth_clk_sel_reg = of_property_read_bool(np, "st,eth-clk-sel"); | ||
238 | 304 | ||
239 | /* Check if internal clk from RCC selected */ | 305 | /* Ethernet 50Mhz RMII clock selection */ |
240 | if (dwmac->int_phyclk) { | 306 | dwmac->eth_ref_clk_sel_reg = |
241 | /* Get ETH_CLK clocks */ | 307 | of_property_read_bool(np, "st,eth-ref-clk-sel"); |
242 | dwmac->clk_eth_ck = devm_clk_get(dev, "eth-ck"); | 308 | |
243 | if (IS_ERR(dwmac->clk_eth_ck)) { | 309 | /* Get ETH_CLK clocks */ |
244 | dev_err(dev, "No ETH CK clock provided...\n"); | 310 | dwmac->clk_eth_ck = devm_clk_get(dev, "eth-ck"); |
245 | return PTR_ERR(dwmac->clk_eth_ck); | 311 | if (IS_ERR(dwmac->clk_eth_ck)) { |
246 | } | 312 | dev_warn(dev, "No phy clock provided...\n"); |
313 | dwmac->clk_eth_ck = NULL; | ||
247 | } | 314 | } |
248 | 315 | ||
249 | /* Clock used for low power mode */ | 316 | /* Clock used for low power mode */ |
250 | dwmac->clk_ethstp = devm_clk_get(dev, "ethstp"); | 317 | dwmac->clk_ethstp = devm_clk_get(dev, "ethstp"); |
251 | if (IS_ERR(dwmac->clk_ethstp)) { | 318 | if (IS_ERR(dwmac->clk_ethstp)) { |
252 | dev_err(dev, "No ETH peripheral clock provided for CStop mode ...\n"); | 319 | dev_err(dev, |
320 | "No ETH peripheral clock provided for CStop mode ...\n"); | ||
253 | return PTR_ERR(dwmac->clk_ethstp); | 321 | return PTR_ERR(dwmac->clk_ethstp); |
254 | } | 322 | } |
255 | 323 | ||
@@ -260,7 +328,26 @@ static int stm32mp1_parse_data(struct stm32_dwmac *dwmac, | |||
260 | return PTR_ERR(dwmac->syscfg_clk); | 328 | return PTR_ERR(dwmac->syscfg_clk); |
261 | } | 329 | } |
262 | 330 | ||
263 | return 0; | 331 | /* Get IRQ information early to have an ability to ask for deferred |
332 | * probe if needed before we went too far with resource allocation. | ||
333 | */ | ||
334 | dwmac->irq_pwr_wakeup = platform_get_irq_byname(pdev, | ||
335 | "stm32_pwr_wakeup"); | ||
336 | if (!dwmac->clk_eth_ck && dwmac->irq_pwr_wakeup >= 0) { | ||
337 | err = device_init_wakeup(&pdev->dev, true); | ||
338 | if (err) { | ||
339 | dev_err(&pdev->dev, "Failed to init wake up irq\n"); | ||
340 | return err; | ||
341 | } | ||
342 | err = dev_pm_set_dedicated_wake_irq(&pdev->dev, | ||
343 | dwmac->irq_pwr_wakeup); | ||
344 | if (err) { | ||
345 | dev_err(&pdev->dev, "Failed to set wake up irq\n"); | ||
346 | device_init_wakeup(&pdev->dev, false); | ||
347 | } | ||
348 | device_set_wakeup_enable(&pdev->dev, false); | ||
349 | } | ||
350 | return err; | ||
264 | } | 351 | } |
265 | 352 | ||
266 | static int stm32_dwmac_probe(struct platform_device *pdev) | 353 | static int stm32_dwmac_probe(struct platform_device *pdev) |
@@ -326,9 +413,15 @@ static int stm32_dwmac_remove(struct platform_device *pdev) | |||
326 | struct net_device *ndev = platform_get_drvdata(pdev); | 413 | struct net_device *ndev = platform_get_drvdata(pdev); |
327 | struct stmmac_priv *priv = netdev_priv(ndev); | 414 | struct stmmac_priv *priv = netdev_priv(ndev); |
328 | int ret = stmmac_dvr_remove(&pdev->dev); | 415 | int ret = stmmac_dvr_remove(&pdev->dev); |
416 | struct stm32_dwmac *dwmac = priv->plat->bsp_priv; | ||
329 | 417 | ||
330 | stm32_dwmac_clk_disable(priv->plat->bsp_priv); | 418 | stm32_dwmac_clk_disable(priv->plat->bsp_priv); |
331 | 419 | ||
420 | if (dwmac->irq_pwr_wakeup >= 0) { | ||
421 | dev_pm_clear_wake_irq(&pdev->dev); | ||
422 | device_init_wakeup(&pdev->dev, false); | ||
423 | } | ||
424 | |||
332 | return ret; | 425 | return ret; |
333 | } | 426 | } |
334 | 427 | ||
@@ -342,7 +435,7 @@ static int stm32mp1_suspend(struct stm32_dwmac *dwmac) | |||
342 | 435 | ||
343 | clk_disable_unprepare(dwmac->clk_tx); | 436 | clk_disable_unprepare(dwmac->clk_tx); |
344 | clk_disable_unprepare(dwmac->syscfg_clk); | 437 | clk_disable_unprepare(dwmac->syscfg_clk); |
345 | if (dwmac->int_phyclk) | 438 | if (dwmac->clk_eth_ck) |
346 | clk_disable_unprepare(dwmac->clk_eth_ck); | 439 | clk_disable_unprepare(dwmac->clk_eth_ck); |
347 | 440 | ||
348 | return ret; | 441 | return ret; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e2a13ec2e30b..97c5e1aad88f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -480,7 +480,7 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv, | |||
480 | struct dma_desc *p, struct sk_buff *skb) | 480 | struct dma_desc *p, struct sk_buff *skb) |
481 | { | 481 | { |
482 | struct skb_shared_hwtstamps shhwtstamp; | 482 | struct skb_shared_hwtstamps shhwtstamp; |
483 | u64 ns; | 483 | u64 ns = 0; |
484 | 484 | ||
485 | if (!priv->hwts_tx_en) | 485 | if (!priv->hwts_tx_en) |
486 | return; | 486 | return; |
@@ -519,7 +519,7 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, | |||
519 | { | 519 | { |
520 | struct skb_shared_hwtstamps *shhwtstamp = NULL; | 520 | struct skb_shared_hwtstamps *shhwtstamp = NULL; |
521 | struct dma_desc *desc = p; | 521 | struct dma_desc *desc = p; |
522 | u64 ns; | 522 | u64 ns = 0; |
523 | 523 | ||
524 | if (!priv->hwts_rx_en) | 524 | if (!priv->hwts_rx_en) |
525 | return; | 525 | return; |
@@ -564,8 +564,8 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) | |||
564 | u32 snap_type_sel = 0; | 564 | u32 snap_type_sel = 0; |
565 | u32 ts_master_en = 0; | 565 | u32 ts_master_en = 0; |
566 | u32 ts_event_en = 0; | 566 | u32 ts_event_en = 0; |
567 | u32 sec_inc = 0; | ||
567 | u32 value = 0; | 568 | u32 value = 0; |
568 | u32 sec_inc; | ||
569 | bool xmac; | 569 | bool xmac; |
570 | 570 | ||
571 | xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac; | 571 | xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 2b800ce1d5bf..3031f2bf15d6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -408,6 +408,9 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) | |||
408 | /* Default to phy auto-detection */ | 408 | /* Default to phy auto-detection */ |
409 | plat->phy_addr = -1; | 409 | plat->phy_addr = -1; |
410 | 410 | ||
411 | /* Get clk_csr from device tree */ | ||
412 | of_property_read_u32(np, "clk_csr", &plat->clk_csr); | ||
413 | |||
411 | /* "snps,phy-addr" is not a standard property. Mark it as deprecated | 414 | /* "snps,phy-addr" is not a standard property. Mark it as deprecated |
412 | * and warn of its use. Remove this when phy node support is added. | 415 | * and warn of its use. Remove this when phy node support is added. |
413 | */ | 416 | */ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 2293e21f789f..cc60b3fb0892 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | |||
@@ -105,7 +105,7 @@ static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
105 | struct stmmac_priv *priv = | 105 | struct stmmac_priv *priv = |
106 | container_of(ptp, struct stmmac_priv, ptp_clock_ops); | 106 | container_of(ptp, struct stmmac_priv, ptp_clock_ops); |
107 | unsigned long flags; | 107 | unsigned long flags; |
108 | u64 ns; | 108 | u64 ns = 0; |
109 | 109 | ||
110 | spin_lock_irqsave(&priv->ptp_lock, flags); | 110 | spin_lock_irqsave(&priv->ptp_lock, flags); |
111 | stmmac_get_systime(priv, priv->ptpaddr, &ns); | 111 | stmmac_get_systime(priv, priv->ptpaddr, &ns); |
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index d84501441edd..6f99437a6962 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
@@ -7464,6 +7464,7 @@ static int niu_add_ethtool_tcam_entry(struct niu *np, | |||
7464 | class = CLASS_CODE_USER_PROG4; | 7464 | class = CLASS_CODE_USER_PROG4; |
7465 | break; | 7465 | break; |
7466 | default: | 7466 | default: |
7467 | class = CLASS_CODE_UNRECOG; | ||
7467 | break; | 7468 | break; |
7468 | } | 7469 | } |
7469 | ret = tcam_user_ip_class_set(np, class, 0, | 7470 | ret = tcam_user_ip_class_set(np, class, 0, |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 840820402cd0..57450b174fc4 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -2029,7 +2029,6 @@ static const struct dev_pm_ops davinci_emac_pm_ops = { | |||
2029 | .resume = davinci_emac_resume, | 2029 | .resume = davinci_emac_resume, |
2030 | }; | 2030 | }; |
2031 | 2031 | ||
2032 | #if IS_ENABLED(CONFIG_OF) | ||
2033 | static const struct emac_platform_data am3517_emac_data = { | 2032 | static const struct emac_platform_data am3517_emac_data = { |
2034 | .version = EMAC_VERSION_2, | 2033 | .version = EMAC_VERSION_2, |
2035 | .hw_ram_addr = 0x01e20000, | 2034 | .hw_ram_addr = 0x01e20000, |
@@ -2046,14 +2045,13 @@ static const struct of_device_id davinci_emac_of_match[] = { | |||
2046 | {}, | 2045 | {}, |
2047 | }; | 2046 | }; |
2048 | MODULE_DEVICE_TABLE(of, davinci_emac_of_match); | 2047 | MODULE_DEVICE_TABLE(of, davinci_emac_of_match); |
2049 | #endif | ||
2050 | 2048 | ||
2051 | /* davinci_emac_driver: EMAC platform driver structure */ | 2049 | /* davinci_emac_driver: EMAC platform driver structure */ |
2052 | static struct platform_driver davinci_emac_driver = { | 2050 | static struct platform_driver davinci_emac_driver = { |
2053 | .driver = { | 2051 | .driver = { |
2054 | .name = "davinci_emac", | 2052 | .name = "davinci_emac", |
2055 | .pm = &davinci_emac_pm_ops, | 2053 | .pm = &davinci_emac_pm_ops, |
2056 | .of_match_table = of_match_ptr(davinci_emac_of_match), | 2054 | .of_match_table = davinci_emac_of_match, |
2057 | }, | 2055 | }, |
2058 | .probe = davinci_emac_probe, | 2056 | .probe = davinci_emac_probe, |
2059 | .remove = davinci_emac_remove, | 2057 | .remove = davinci_emac_remove, |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index a3c46d78d216..077f1b9f2761 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -1731,6 +1731,14 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) | |||
1731 | goto drop; | 1731 | goto drop; |
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | rcu_read_lock(); | ||
1735 | |||
1736 | if (unlikely(!(vxlan->dev->flags & IFF_UP))) { | ||
1737 | rcu_read_unlock(); | ||
1738 | atomic_long_inc(&vxlan->dev->rx_dropped); | ||
1739 | goto drop; | ||
1740 | } | ||
1741 | |||
1734 | stats = this_cpu_ptr(vxlan->dev->tstats); | 1742 | stats = this_cpu_ptr(vxlan->dev->tstats); |
1735 | u64_stats_update_begin(&stats->syncp); | 1743 | u64_stats_update_begin(&stats->syncp); |
1736 | stats->rx_packets++; | 1744 | stats->rx_packets++; |
@@ -1738,6 +1746,9 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) | |||
1738 | u64_stats_update_end(&stats->syncp); | 1746 | u64_stats_update_end(&stats->syncp); |
1739 | 1747 | ||
1740 | gro_cells_receive(&vxlan->gro_cells, skb); | 1748 | gro_cells_receive(&vxlan->gro_cells, skb); |
1749 | |||
1750 | rcu_read_unlock(); | ||
1751 | |||
1741 | return 0; | 1752 | return 0; |
1742 | 1753 | ||
1743 | drop: | 1754 | drop: |
@@ -2690,7 +2701,7 @@ static void vxlan_cleanup(struct timer_list *t) | |||
2690 | for (h = 0; h < FDB_HASH_SIZE; ++h) { | 2701 | for (h = 0; h < FDB_HASH_SIZE; ++h) { |
2691 | struct hlist_node *p, *n; | 2702 | struct hlist_node *p, *n; |
2692 | 2703 | ||
2693 | spin_lock_bh(&vxlan->hash_lock); | 2704 | spin_lock(&vxlan->hash_lock); |
2694 | hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) { | 2705 | hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) { |
2695 | struct vxlan_fdb *f | 2706 | struct vxlan_fdb *f |
2696 | = container_of(p, struct vxlan_fdb, hlist); | 2707 | = container_of(p, struct vxlan_fdb, hlist); |
@@ -2712,7 +2723,7 @@ static void vxlan_cleanup(struct timer_list *t) | |||
2712 | } else if (time_before(timeout, next_timer)) | 2723 | } else if (time_before(timeout, next_timer)) |
2713 | next_timer = timeout; | 2724 | next_timer = timeout; |
2714 | } | 2725 | } |
2715 | spin_unlock_bh(&vxlan->hash_lock); | 2726 | spin_unlock(&vxlan->hash_lock); |
2716 | } | 2727 | } |
2717 | 2728 | ||
2718 | mod_timer(&vxlan->age_timer, next_timer); | 2729 | mod_timer(&vxlan->age_timer, next_timer); |
@@ -2767,6 +2778,8 @@ static void vxlan_uninit(struct net_device *dev) | |||
2767 | { | 2778 | { |
2768 | struct vxlan_dev *vxlan = netdev_priv(dev); | 2779 | struct vxlan_dev *vxlan = netdev_priv(dev); |
2769 | 2780 | ||
2781 | gro_cells_destroy(&vxlan->gro_cells); | ||
2782 | |||
2770 | vxlan_fdb_delete_default(vxlan, vxlan->cfg.vni); | 2783 | vxlan_fdb_delete_default(vxlan, vxlan->cfg.vni); |
2771 | 2784 | ||
2772 | free_percpu(dev->tstats); | 2785 | free_percpu(dev->tstats); |
@@ -3942,7 +3955,6 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head) | |||
3942 | 3955 | ||
3943 | vxlan_flush(vxlan, true); | 3956 | vxlan_flush(vxlan, true); |
3944 | 3957 | ||
3945 | gro_cells_destroy(&vxlan->gro_cells); | ||
3946 | list_del(&vxlan->next); | 3958 | list_del(&vxlan->next); |
3947 | unregister_netdevice_queue(dev, head); | 3959 | unregister_netdevice_queue(dev, head); |
3948 | } | 3960 | } |
diff --git a/include/linux/atalk.h b/include/linux/atalk.h index 5a90f28d5ff2..d5cfc0b15b76 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h | |||
@@ -161,16 +161,26 @@ extern int sysctl_aarp_resolve_time; | |||
161 | extern int atalk_register_sysctl(void); | 161 | extern int atalk_register_sysctl(void); |
162 | extern void atalk_unregister_sysctl(void); | 162 | extern void atalk_unregister_sysctl(void); |
163 | #else | 163 | #else |
164 | #define atalk_register_sysctl() do { } while(0) | 164 | static inline int atalk_register_sysctl(void) |
165 | #define atalk_unregister_sysctl() do { } while(0) | 165 | { |
166 | return 0; | ||
167 | } | ||
168 | static inline void atalk_unregister_sysctl(void) | ||
169 | { | ||
170 | } | ||
166 | #endif | 171 | #endif |
167 | 172 | ||
168 | #ifdef CONFIG_PROC_FS | 173 | #ifdef CONFIG_PROC_FS |
169 | extern int atalk_proc_init(void); | 174 | extern int atalk_proc_init(void); |
170 | extern void atalk_proc_exit(void); | 175 | extern void atalk_proc_exit(void); |
171 | #else | 176 | #else |
172 | #define atalk_proc_init() ({ 0; }) | 177 | static inline int atalk_proc_init(void) |
173 | #define atalk_proc_exit() do { } while(0) | 178 | { |
179 | return 0; | ||
180 | } | ||
181 | static inline void atalk_proc_exit(void) | ||
182 | { | ||
183 | } | ||
174 | #endif /* CONFIG_PROC_FS */ | 184 | #endif /* CONFIG_PROC_FS */ |
175 | 185 | ||
176 | #endif /* __LINUX_ATALK_H__ */ | 186 | #endif /* __LINUX_ATALK_H__ */ |
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index 695b2a880d9a..a4c644c1c091 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h | |||
@@ -292,7 +292,7 @@ static inline int bpf_cgroup_storage_assign(struct bpf_prog *prog, | |||
292 | static inline void bpf_cgroup_storage_release(struct bpf_prog *prog, | 292 | static inline void bpf_cgroup_storage_release(struct bpf_prog *prog, |
293 | struct bpf_map *map) {} | 293 | struct bpf_map *map) {} |
294 | static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc( | 294 | static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc( |
295 | struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return 0; } | 295 | struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return NULL; } |
296 | static inline void bpf_cgroup_storage_free( | 296 | static inline void bpf_cgroup_storage_free( |
297 | struct bpf_cgroup_storage *storage) {} | 297 | struct bpf_cgroup_storage *storage) {} |
298 | static inline int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key, | 298 | static inline int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key, |
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index cc85f4524dbf..9c94b2ea789c 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
@@ -110,7 +110,7 @@ struct ip_mc_list { | |||
110 | static inline int ip_mc_may_pull(struct sk_buff *skb, unsigned int len) | 110 | static inline int ip_mc_may_pull(struct sk_buff *skb, unsigned int len) |
111 | { | 111 | { |
112 | if (skb_transport_offset(skb) + ip_transport_len(skb) < len) | 112 | if (skb_transport_offset(skb) + ip_transport_len(skb) < len) |
113 | return -EINVAL; | 113 | return 0; |
114 | 114 | ||
115 | return pskb_may_pull(skb, len); | 115 | return pskb_may_pull(skb, len); |
116 | } | 116 | } |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index b48bb8b42fc8..9027a8c4219f 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -327,26 +327,49 @@ struct skb_frag_struct { | |||
327 | #endif | 327 | #endif |
328 | }; | 328 | }; |
329 | 329 | ||
330 | /** | ||
331 | * skb_frag_size - Returns the size of a skb fragment | ||
332 | * @frag: skb fragment | ||
333 | */ | ||
330 | static inline unsigned int skb_frag_size(const skb_frag_t *frag) | 334 | static inline unsigned int skb_frag_size(const skb_frag_t *frag) |
331 | { | 335 | { |
332 | return frag->size; | 336 | return frag->size; |
333 | } | 337 | } |
334 | 338 | ||
339 | /** | ||
340 | * skb_frag_size_set - Sets the size of a skb fragment | ||
341 | * @frag: skb fragment | ||
342 | * @size: size of fragment | ||
343 | */ | ||
335 | static inline void skb_frag_size_set(skb_frag_t *frag, unsigned int size) | 344 | static inline void skb_frag_size_set(skb_frag_t *frag, unsigned int size) |
336 | { | 345 | { |
337 | frag->size = size; | 346 | frag->size = size; |
338 | } | 347 | } |
339 | 348 | ||
349 | /** | ||
350 | * skb_frag_size_add - Incrementes the size of a skb fragment by %delta | ||
351 | * @frag: skb fragment | ||
352 | * @delta: value to add | ||
353 | */ | ||
340 | static inline void skb_frag_size_add(skb_frag_t *frag, int delta) | 354 | static inline void skb_frag_size_add(skb_frag_t *frag, int delta) |
341 | { | 355 | { |
342 | frag->size += delta; | 356 | frag->size += delta; |
343 | } | 357 | } |
344 | 358 | ||
359 | /** | ||
360 | * skb_frag_size_sub - Decrements the size of a skb fragment by %delta | ||
361 | * @frag: skb fragment | ||
362 | * @delta: value to subtract | ||
363 | */ | ||
345 | static inline void skb_frag_size_sub(skb_frag_t *frag, int delta) | 364 | static inline void skb_frag_size_sub(skb_frag_t *frag, int delta) |
346 | { | 365 | { |
347 | frag->size -= delta; | 366 | frag->size -= delta; |
348 | } | 367 | } |
349 | 368 | ||
369 | /** | ||
370 | * skb_frag_must_loop - Test if %p is a high memory page | ||
371 | * @p: fragment's page | ||
372 | */ | ||
350 | static inline bool skb_frag_must_loop(struct page *p) | 373 | static inline bool skb_frag_must_loop(struct page *p) |
351 | { | 374 | { |
352 | #if defined(CONFIG_HIGHMEM) | 375 | #if defined(CONFIG_HIGHMEM) |
@@ -590,7 +613,7 @@ typedef unsigned int sk_buff_data_t; | |||
590 | typedef unsigned char *sk_buff_data_t; | 613 | typedef unsigned char *sk_buff_data_t; |
591 | #endif | 614 | #endif |
592 | 615 | ||
593 | /** | 616 | /** |
594 | * struct sk_buff - socket buffer | 617 | * struct sk_buff - socket buffer |
595 | * @next: Next buffer in list | 618 | * @next: Next buffer in list |
596 | * @prev: Previous buffer in list | 619 | * @prev: Previous buffer in list |
@@ -648,7 +671,7 @@ typedef unsigned char *sk_buff_data_t; | |||
648 | * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL | 671 | * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL |
649 | * @dst_pending_confirm: need to confirm neighbour | 672 | * @dst_pending_confirm: need to confirm neighbour |
650 | * @decrypted: Decrypted SKB | 673 | * @decrypted: Decrypted SKB |
651 | * @napi_id: id of the NAPI struct this skb came from | 674 | * @napi_id: id of the NAPI struct this skb came from |
652 | * @secmark: security marking | 675 | * @secmark: security marking |
653 | * @mark: Generic packet mark | 676 | * @mark: Generic packet mark |
654 | * @vlan_proto: vlan encapsulation protocol | 677 | * @vlan_proto: vlan encapsulation protocol |
@@ -883,7 +906,10 @@ struct sk_buff { | |||
883 | #define SKB_ALLOC_RX 0x02 | 906 | #define SKB_ALLOC_RX 0x02 |
884 | #define SKB_ALLOC_NAPI 0x04 | 907 | #define SKB_ALLOC_NAPI 0x04 |
885 | 908 | ||
886 | /* Returns true if the skb was allocated from PFMEMALLOC reserves */ | 909 | /** |
910 | * skb_pfmemalloc - Test if the skb was allocated from PFMEMALLOC reserves | ||
911 | * @skb: buffer | ||
912 | */ | ||
887 | static inline bool skb_pfmemalloc(const struct sk_buff *skb) | 913 | static inline bool skb_pfmemalloc(const struct sk_buff *skb) |
888 | { | 914 | { |
889 | return unlikely(skb->pfmemalloc); | 915 | return unlikely(skb->pfmemalloc); |
@@ -905,7 +931,7 @@ static inline bool skb_pfmemalloc(const struct sk_buff *skb) | |||
905 | */ | 931 | */ |
906 | static inline struct dst_entry *skb_dst(const struct sk_buff *skb) | 932 | static inline struct dst_entry *skb_dst(const struct sk_buff *skb) |
907 | { | 933 | { |
908 | /* If refdst was not refcounted, check we still are in a | 934 | /* If refdst was not refcounted, check we still are in a |
909 | * rcu_read_lock section | 935 | * rcu_read_lock section |
910 | */ | 936 | */ |
911 | WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) && | 937 | WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) && |
@@ -952,6 +978,10 @@ static inline bool skb_dst_is_noref(const struct sk_buff *skb) | |||
952 | return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb); | 978 | return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb); |
953 | } | 979 | } |
954 | 980 | ||
981 | /** | ||
982 | * skb_rtable - Returns the skb &rtable | ||
983 | * @skb: buffer | ||
984 | */ | ||
955 | static inline struct rtable *skb_rtable(const struct sk_buff *skb) | 985 | static inline struct rtable *skb_rtable(const struct sk_buff *skb) |
956 | { | 986 | { |
957 | return (struct rtable *)skb_dst(skb); | 987 | return (struct rtable *)skb_dst(skb); |
@@ -966,6 +996,10 @@ static inline bool skb_pkt_type_ok(u32 ptype) | |||
966 | return ptype <= PACKET_OTHERHOST; | 996 | return ptype <= PACKET_OTHERHOST; |
967 | } | 997 | } |
968 | 998 | ||
999 | /** | ||
1000 | * skb_napi_id - Returns the skb's NAPI id | ||
1001 | * @skb: buffer | ||
1002 | */ | ||
969 | static inline unsigned int skb_napi_id(const struct sk_buff *skb) | 1003 | static inline unsigned int skb_napi_id(const struct sk_buff *skb) |
970 | { | 1004 | { |
971 | #ifdef CONFIG_NET_RX_BUSY_POLL | 1005 | #ifdef CONFIG_NET_RX_BUSY_POLL |
@@ -975,7 +1009,12 @@ static inline unsigned int skb_napi_id(const struct sk_buff *skb) | |||
975 | #endif | 1009 | #endif |
976 | } | 1010 | } |
977 | 1011 | ||
978 | /* decrement the reference count and return true if we can free the skb */ | 1012 | /** |
1013 | * skb_unref - decrement the skb's reference count | ||
1014 | * @skb: buffer | ||
1015 | * | ||
1016 | * Returns true if we can free the skb. | ||
1017 | */ | ||
979 | static inline bool skb_unref(struct sk_buff *skb) | 1018 | static inline bool skb_unref(struct sk_buff *skb) |
980 | { | 1019 | { |
981 | if (unlikely(!skb)) | 1020 | if (unlikely(!skb)) |
@@ -1005,6 +1044,14 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags, | |||
1005 | int node); | 1044 | int node); |
1006 | struct sk_buff *__build_skb(void *data, unsigned int frag_size); | 1045 | struct sk_buff *__build_skb(void *data, unsigned int frag_size); |
1007 | struct sk_buff *build_skb(void *data, unsigned int frag_size); | 1046 | struct sk_buff *build_skb(void *data, unsigned int frag_size); |
1047 | |||
1048 | /** | ||
1049 | * alloc_skb - allocate a network buffer | ||
1050 | * @size: size to allocate | ||
1051 | * @priority: allocation mask | ||
1052 | * | ||
1053 | * This function is a convenient wrapper around __alloc_skb(). | ||
1054 | */ | ||
1008 | static inline struct sk_buff *alloc_skb(unsigned int size, | 1055 | static inline struct sk_buff *alloc_skb(unsigned int size, |
1009 | gfp_t priority) | 1056 | gfp_t priority) |
1010 | { | 1057 | { |
@@ -1047,6 +1094,13 @@ static inline bool skb_fclone_busy(const struct sock *sk, | |||
1047 | fclones->skb2.sk == sk; | 1094 | fclones->skb2.sk == sk; |
1048 | } | 1095 | } |
1049 | 1096 | ||
1097 | /** | ||
1098 | * alloc_skb_fclone - allocate a network buffer from fclone cache | ||
1099 | * @size: size to allocate | ||
1100 | * @priority: allocation mask | ||
1101 | * | ||
1102 | * This function is a convenient wrapper around __alloc_skb(). | ||
1103 | */ | ||
1050 | static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | 1104 | static inline struct sk_buff *alloc_skb_fclone(unsigned int size, |
1051 | gfp_t priority) | 1105 | gfp_t priority) |
1052 | { | 1106 | { |
@@ -4232,10 +4286,10 @@ static inline bool skb_is_gso_sctp(const struct sk_buff *skb) | |||
4232 | return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP; | 4286 | return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP; |
4233 | } | 4287 | } |
4234 | 4288 | ||
4289 | /* Note: Should be called only if skb_is_gso(skb) is true */ | ||
4235 | static inline bool skb_is_gso_tcp(const struct sk_buff *skb) | 4290 | static inline bool skb_is_gso_tcp(const struct sk_buff *skb) |
4236 | { | 4291 | { |
4237 | return skb_is_gso(skb) && | 4292 | return skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6); |
4238 | skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6); | ||
4239 | } | 4293 | } |
4240 | 4294 | ||
4241 | static inline void skb_gso_reset(struct sk_buff *skb) | 4295 | static inline void skb_gso_reset(struct sk_buff *skb) |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index 347015515a7d..21a5243fecd1 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -108,7 +108,6 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener, | |||
108 | 108 | ||
109 | static inline void reqsk_free(struct request_sock *req) | 109 | static inline void reqsk_free(struct request_sock *req) |
110 | { | 110 | { |
111 | /* temporary debugging */ | ||
112 | WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0); | 111 | WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0); |
113 | 112 | ||
114 | req->rsk_ops->destructor(req); | 113 | req->rsk_ops->destructor(req); |
diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h index 5b50fe4906d2..7b60fd186cfe 100644 --- a/include/trace/events/rxrpc.h +++ b/include/trace/events/rxrpc.h | |||
@@ -76,6 +76,7 @@ enum rxrpc_client_trace { | |||
76 | rxrpc_client_chan_disconnect, | 76 | rxrpc_client_chan_disconnect, |
77 | rxrpc_client_chan_pass, | 77 | rxrpc_client_chan_pass, |
78 | rxrpc_client_chan_unstarted, | 78 | rxrpc_client_chan_unstarted, |
79 | rxrpc_client_chan_wait_failed, | ||
79 | rxrpc_client_cleanup, | 80 | rxrpc_client_cleanup, |
80 | rxrpc_client_count, | 81 | rxrpc_client_count, |
81 | rxrpc_client_discard, | 82 | rxrpc_client_discard, |
@@ -276,6 +277,7 @@ enum rxrpc_tx_point { | |||
276 | EM(rxrpc_client_chan_disconnect, "ChDisc") \ | 277 | EM(rxrpc_client_chan_disconnect, "ChDisc") \ |
277 | EM(rxrpc_client_chan_pass, "ChPass") \ | 278 | EM(rxrpc_client_chan_pass, "ChPass") \ |
278 | EM(rxrpc_client_chan_unstarted, "ChUnst") \ | 279 | EM(rxrpc_client_chan_unstarted, "ChUnst") \ |
280 | EM(rxrpc_client_chan_wait_failed, "ChWtFl") \ | ||
279 | EM(rxrpc_client_cleanup, "Clean ") \ | 281 | EM(rxrpc_client_cleanup, "Clean ") \ |
280 | EM(rxrpc_client_count, "Count ") \ | 282 | EM(rxrpc_client_count, "Count ") \ |
281 | EM(rxrpc_client_discard, "Discar") \ | 283 | EM(rxrpc_client_discard, "Discar") \ |
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index a7b96bf0e654..ce166a002d16 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c | |||
@@ -6678,17 +6678,17 @@ static int replace_map_fd_with_map_ptr(struct bpf_verifier_env *env) | |||
6678 | /* valid generic load 64-bit imm */ | 6678 | /* valid generic load 64-bit imm */ |
6679 | goto next_insn; | 6679 | goto next_insn; |
6680 | 6680 | ||
6681 | if (insn->src_reg != BPF_PSEUDO_MAP_FD) { | 6681 | if (insn[0].src_reg != BPF_PSEUDO_MAP_FD || |
6682 | verbose(env, | 6682 | insn[1].imm != 0) { |
6683 | "unrecognized bpf_ld_imm64 insn\n"); | 6683 | verbose(env, "unrecognized bpf_ld_imm64 insn\n"); |
6684 | return -EINVAL; | 6684 | return -EINVAL; |
6685 | } | 6685 | } |
6686 | 6686 | ||
6687 | f = fdget(insn->imm); | 6687 | f = fdget(insn[0].imm); |
6688 | map = __bpf_map_get(f); | 6688 | map = __bpf_map_get(f); |
6689 | if (IS_ERR(map)) { | 6689 | if (IS_ERR(map)) { |
6690 | verbose(env, "fd %d is not pointing to valid bpf_map\n", | 6690 | verbose(env, "fd %d is not pointing to valid bpf_map\n", |
6691 | insn->imm); | 6691 | insn[0].imm); |
6692 | return PTR_ERR(map); | 6692 | return PTR_ERR(map); |
6693 | } | 6693 | } |
6694 | 6694 | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 3fb1405f3f8c..7bb3988425ee 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -3326,7 +3326,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, | |||
3326 | 3326 | ||
3327 | #endif /* CONFIG_PROC_SYSCTL */ | 3327 | #endif /* CONFIG_PROC_SYSCTL */ |
3328 | 3328 | ||
3329 | #ifdef CONFIG_BPF_SYSCALL | 3329 | #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL) |
3330 | static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write, | 3330 | static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write, |
3331 | void __user *buffer, size_t *lenp, | 3331 | void __user *buffer, size_t *lenp, |
3332 | loff_t *ppos) | 3332 | loff_t *ppos) |
diff --git a/net/atm/resources.c b/net/atm/resources.c index bada395ecdb1..889349c6d90d 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c | |||
@@ -203,13 +203,9 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) | |||
203 | int __user *sioc_len; | 203 | int __user *sioc_len; |
204 | int __user *iobuf_len; | 204 | int __user *iobuf_len; |
205 | 205 | ||
206 | #ifndef CONFIG_COMPAT | ||
207 | compat = 0; /* Just so the compiler _knows_ */ | ||
208 | #endif | ||
209 | |||
210 | switch (cmd) { | 206 | switch (cmd) { |
211 | case ATM_GETNAMES: | 207 | case ATM_GETNAMES: |
212 | if (compat) { | 208 | if (IS_ENABLED(CONFIG_COMPAT) && compat) { |
213 | #ifdef CONFIG_COMPAT | 209 | #ifdef CONFIG_COMPAT |
214 | struct compat_atm_iobuf __user *ciobuf = arg; | 210 | struct compat_atm_iobuf __user *ciobuf = arg; |
215 | compat_uptr_t cbuf; | 211 | compat_uptr_t cbuf; |
@@ -253,7 +249,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) | |||
253 | break; | 249 | break; |
254 | } | 250 | } |
255 | 251 | ||
256 | if (compat) { | 252 | if (IS_ENABLED(CONFIG_COMPAT) && compat) { |
257 | #ifdef CONFIG_COMPAT | 253 | #ifdef CONFIG_COMPAT |
258 | struct compat_atmif_sioc __user *csioc = arg; | 254 | struct compat_atmif_sioc __user *csioc = arg; |
259 | compat_uptr_t carg; | 255 | compat_uptr_t carg; |
@@ -417,7 +413,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) | |||
417 | } | 413 | } |
418 | /* fall through */ | 414 | /* fall through */ |
419 | default: | 415 | default: |
420 | if (compat) { | 416 | if (IS_ENABLED(CONFIG_COMPAT) && compat) { |
421 | #ifdef CONFIG_COMPAT | 417 | #ifdef CONFIG_COMPAT |
422 | if (!dev->ops->compat_ioctl) { | 418 | if (!dev->ops->compat_ioctl) { |
423 | error = -EINVAL; | 419 | error = -EINVAL; |
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index da7051d62727..fab142b796ef 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c | |||
@@ -16,7 +16,7 @@ | |||
16 | static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, | 16 | static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, |
17 | u32 *retval, u32 *time) | 17 | u32 *retval, u32 *time) |
18 | { | 18 | { |
19 | struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { 0 }; | 19 | struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { NULL }; |
20 | enum bpf_cgroup_storage_type stype; | 20 | enum bpf_cgroup_storage_type stype; |
21 | u64 time_start, time_spent = 0; | 21 | u64 time_start, time_spent = 0; |
22 | int ret = 0; | 22 | int ret = 0; |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index d4918ffddda8..b1eb32419732 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -2319,9 +2319,10 @@ static int ethtool_set_tunable(struct net_device *dev, void __user *useraddr) | |||
2319 | return ret; | 2319 | return ret; |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | static int ethtool_get_per_queue_coalesce(struct net_device *dev, | 2322 | static noinline_for_stack int |
2323 | void __user *useraddr, | 2323 | ethtool_get_per_queue_coalesce(struct net_device *dev, |
2324 | struct ethtool_per_queue_op *per_queue_opt) | 2324 | void __user *useraddr, |
2325 | struct ethtool_per_queue_op *per_queue_opt) | ||
2325 | { | 2326 | { |
2326 | u32 bit; | 2327 | u32 bit; |
2327 | int ret; | 2328 | int ret; |
@@ -2349,9 +2350,10 @@ static int ethtool_get_per_queue_coalesce(struct net_device *dev, | |||
2349 | return 0; | 2350 | return 0; |
2350 | } | 2351 | } |
2351 | 2352 | ||
2352 | static int ethtool_set_per_queue_coalesce(struct net_device *dev, | 2353 | static noinline_for_stack int |
2353 | void __user *useraddr, | 2354 | ethtool_set_per_queue_coalesce(struct net_device *dev, |
2354 | struct ethtool_per_queue_op *per_queue_opt) | 2355 | void __user *useraddr, |
2356 | struct ethtool_per_queue_op *per_queue_opt) | ||
2355 | { | 2357 | { |
2356 | u32 bit; | 2358 | u32 bit; |
2357 | int i, ret = 0; | 2359 | int i, ret = 0; |
@@ -2405,7 +2407,7 @@ roll_back: | |||
2405 | return ret; | 2407 | return ret; |
2406 | } | 2408 | } |
2407 | 2409 | ||
2408 | static int ethtool_set_per_queue(struct net_device *dev, | 2410 | static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev, |
2409 | void __user *useraddr, u32 sub_cmd) | 2411 | void __user *useraddr, u32 sub_cmd) |
2410 | { | 2412 | { |
2411 | struct ethtool_per_queue_op per_queue_opt; | 2413 | struct ethtool_per_queue_op per_queue_opt; |
diff --git a/net/core/filter.c b/net/core/filter.c index 5ceba98069d4..f274620945ff 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -2804,7 +2804,7 @@ static int bpf_skb_proto_4_to_6(struct sk_buff *skb) | |||
2804 | u32 off = skb_mac_header_len(skb); | 2804 | u32 off = skb_mac_header_len(skb); |
2805 | int ret; | 2805 | int ret; |
2806 | 2806 | ||
2807 | if (!skb_is_gso_tcp(skb)) | 2807 | if (skb_is_gso(skb) && !skb_is_gso_tcp(skb)) |
2808 | return -ENOTSUPP; | 2808 | return -ENOTSUPP; |
2809 | 2809 | ||
2810 | ret = skb_cow(skb, len_diff); | 2810 | ret = skb_cow(skb, len_diff); |
@@ -2845,7 +2845,7 @@ static int bpf_skb_proto_6_to_4(struct sk_buff *skb) | |||
2845 | u32 off = skb_mac_header_len(skb); | 2845 | u32 off = skb_mac_header_len(skb); |
2846 | int ret; | 2846 | int ret; |
2847 | 2847 | ||
2848 | if (!skb_is_gso_tcp(skb)) | 2848 | if (skb_is_gso(skb) && !skb_is_gso_tcp(skb)) |
2849 | return -ENOTSUPP; | 2849 | return -ENOTSUPP; |
2850 | 2850 | ||
2851 | ret = skb_unclone(skb, GFP_ATOMIC); | 2851 | ret = skb_unclone(skb, GFP_ATOMIC); |
@@ -2970,7 +2970,7 @@ static int bpf_skb_net_grow(struct sk_buff *skb, u32 len_diff) | |||
2970 | u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb); | 2970 | u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb); |
2971 | int ret; | 2971 | int ret; |
2972 | 2972 | ||
2973 | if (!skb_is_gso_tcp(skb)) | 2973 | if (skb_is_gso(skb) && !skb_is_gso_tcp(skb)) |
2974 | return -ENOTSUPP; | 2974 | return -ENOTSUPP; |
2975 | 2975 | ||
2976 | ret = skb_cow(skb, len_diff); | 2976 | ret = skb_cow(skb, len_diff); |
@@ -2999,7 +2999,7 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 len_diff) | |||
2999 | u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb); | 2999 | u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb); |
3000 | int ret; | 3000 | int ret; |
3001 | 3001 | ||
3002 | if (!skb_is_gso_tcp(skb)) | 3002 | if (skb_is_gso(skb) && !skb_is_gso_tcp(skb)) |
3003 | return -ENOTSUPP; | 3003 | return -ENOTSUPP; |
3004 | 3004 | ||
3005 | ret = skb_unclone(skb, GFP_ATOMIC); | 3005 | ret = skb_unclone(skb, GFP_ATOMIC); |
diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c index acf45ddbe924..e095fb871d91 100644 --- a/net/core/gro_cells.c +++ b/net/core/gro_cells.c | |||
@@ -13,22 +13,36 @@ int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb) | |||
13 | { | 13 | { |
14 | struct net_device *dev = skb->dev; | 14 | struct net_device *dev = skb->dev; |
15 | struct gro_cell *cell; | 15 | struct gro_cell *cell; |
16 | int res; | ||
16 | 17 | ||
17 | if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev)) | 18 | rcu_read_lock(); |
18 | return netif_rx(skb); | 19 | if (unlikely(!(dev->flags & IFF_UP))) |
20 | goto drop; | ||
21 | |||
22 | if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev)) { | ||
23 | res = netif_rx(skb); | ||
24 | goto unlock; | ||
25 | } | ||
19 | 26 | ||
20 | cell = this_cpu_ptr(gcells->cells); | 27 | cell = this_cpu_ptr(gcells->cells); |
21 | 28 | ||
22 | if (skb_queue_len(&cell->napi_skbs) > netdev_max_backlog) { | 29 | if (skb_queue_len(&cell->napi_skbs) > netdev_max_backlog) { |
30 | drop: | ||
23 | atomic_long_inc(&dev->rx_dropped); | 31 | atomic_long_inc(&dev->rx_dropped); |
24 | kfree_skb(skb); | 32 | kfree_skb(skb); |
25 | return NET_RX_DROP; | 33 | res = NET_RX_DROP; |
34 | goto unlock; | ||
26 | } | 35 | } |
27 | 36 | ||
28 | __skb_queue_tail(&cell->napi_skbs, skb); | 37 | __skb_queue_tail(&cell->napi_skbs, skb); |
29 | if (skb_queue_len(&cell->napi_skbs) == 1) | 38 | if (skb_queue_len(&cell->napi_skbs) == 1) |
30 | napi_schedule(&cell->napi); | 39 | napi_schedule(&cell->napi); |
31 | return NET_RX_SUCCESS; | 40 | |
41 | res = NET_RX_SUCCESS; | ||
42 | |||
43 | unlock: | ||
44 | rcu_read_unlock(); | ||
45 | return res; | ||
32 | } | 46 | } |
33 | EXPORT_SYMBOL(gro_cells_receive); | 47 | EXPORT_SYMBOL(gro_cells_receive); |
34 | 48 | ||
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c index cf2f8897ca19..126d31ff5ee3 100644 --- a/net/core/lwt_bpf.c +++ b/net/core/lwt_bpf.c | |||
@@ -625,6 +625,8 @@ int bpf_lwt_push_ip_encap(struct sk_buff *skb, void *hdr, u32 len, bool ingress) | |||
625 | 625 | ||
626 | /* push the encap headers and fix pointers */ | 626 | /* push the encap headers and fix pointers */ |
627 | skb_reset_inner_headers(skb); | 627 | skb_reset_inner_headers(skb); |
628 | skb_reset_inner_mac_header(skb); /* mac header is not yet set */ | ||
629 | skb_set_inner_protocol(skb, skb->protocol); | ||
628 | skb->encapsulation = 1; | 630 | skb->encapsulation = 1; |
629 | skb_push(skb, len); | 631 | skb_push(skb, len); |
630 | if (ingress) | 632 | if (ingress) |
diff --git a/net/core/skmsg.c b/net/core/skmsg.c index ae6f06e45737..cc94d921476c 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c | |||
@@ -554,6 +554,7 @@ static void sk_psock_destroy_deferred(struct work_struct *gc) | |||
554 | struct sk_psock *psock = container_of(gc, struct sk_psock, gc); | 554 | struct sk_psock *psock = container_of(gc, struct sk_psock, gc); |
555 | 555 | ||
556 | /* No sk_callback_lock since already detached. */ | 556 | /* No sk_callback_lock since already detached. */ |
557 | strp_stop(&psock->parser.strp); | ||
557 | strp_done(&psock->parser.strp); | 558 | strp_done(&psock->parser.strp); |
558 | 559 | ||
559 | cancel_work_sync(&psock->work); | 560 | cancel_work_sync(&psock->work); |
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index b8cd43c9ed5b..a97bf326b231 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c | |||
@@ -94,9 +94,8 @@ static void hsr_check_announce(struct net_device *hsr_dev, | |||
94 | && (old_operstate != IF_OPER_UP)) { | 94 | && (old_operstate != IF_OPER_UP)) { |
95 | /* Went up */ | 95 | /* Went up */ |
96 | hsr->announce_count = 0; | 96 | hsr->announce_count = 0; |
97 | hsr->announce_timer.expires = jiffies + | 97 | mod_timer(&hsr->announce_timer, |
98 | msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL); | 98 | jiffies + msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL)); |
99 | add_timer(&hsr->announce_timer); | ||
100 | } | 99 | } |
101 | 100 | ||
102 | if ((hsr_dev->operstate != IF_OPER_UP) && (old_operstate == IF_OPER_UP)) | 101 | if ((hsr_dev->operstate != IF_OPER_UP) && (old_operstate == IF_OPER_UP)) |
@@ -332,6 +331,7 @@ static void hsr_announce(struct timer_list *t) | |||
332 | { | 331 | { |
333 | struct hsr_priv *hsr; | 332 | struct hsr_priv *hsr; |
334 | struct hsr_port *master; | 333 | struct hsr_port *master; |
334 | unsigned long interval; | ||
335 | 335 | ||
336 | hsr = from_timer(hsr, t, announce_timer); | 336 | hsr = from_timer(hsr, t, announce_timer); |
337 | 337 | ||
@@ -343,18 +343,16 @@ static void hsr_announce(struct timer_list *t) | |||
343 | hsr->protVersion); | 343 | hsr->protVersion); |
344 | hsr->announce_count++; | 344 | hsr->announce_count++; |
345 | 345 | ||
346 | hsr->announce_timer.expires = jiffies + | 346 | interval = msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL); |
347 | msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL); | ||
348 | } else { | 347 | } else { |
349 | send_hsr_supervision_frame(master, HSR_TLV_LIFE_CHECK, | 348 | send_hsr_supervision_frame(master, HSR_TLV_LIFE_CHECK, |
350 | hsr->protVersion); | 349 | hsr->protVersion); |
351 | 350 | ||
352 | hsr->announce_timer.expires = jiffies + | 351 | interval = msecs_to_jiffies(HSR_LIFE_CHECK_INTERVAL); |
353 | msecs_to_jiffies(HSR_LIFE_CHECK_INTERVAL); | ||
354 | } | 352 | } |
355 | 353 | ||
356 | if (is_admin_up(master->dev)) | 354 | if (is_admin_up(master->dev)) |
357 | add_timer(&hsr->announce_timer); | 355 | mod_timer(&hsr->announce_timer, jiffies + interval); |
358 | 356 | ||
359 | rcu_read_unlock(); | 357 | rcu_read_unlock(); |
360 | } | 358 | } |
@@ -486,7 +484,7 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], | |||
486 | 484 | ||
487 | res = hsr_add_port(hsr, hsr_dev, HSR_PT_MASTER); | 485 | res = hsr_add_port(hsr, hsr_dev, HSR_PT_MASTER); |
488 | if (res) | 486 | if (res) |
489 | return res; | 487 | goto err_add_port; |
490 | 488 | ||
491 | res = register_netdevice(hsr_dev); | 489 | res = register_netdevice(hsr_dev); |
492 | if (res) | 490 | if (res) |
@@ -506,6 +504,8 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], | |||
506 | fail: | 504 | fail: |
507 | hsr_for_each_port(hsr, port) | 505 | hsr_for_each_port(hsr, port) |
508 | hsr_del_port(port); | 506 | hsr_del_port(port); |
507 | err_add_port: | ||
508 | hsr_del_node(&hsr->self_node_db); | ||
509 | 509 | ||
510 | return res; | 510 | return res; |
511 | } | 511 | } |
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 286ceb41ac0c..9af16cb68f76 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c | |||
@@ -124,6 +124,18 @@ int hsr_create_self_node(struct list_head *self_node_db, | |||
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | void hsr_del_node(struct list_head *self_node_db) | ||
128 | { | ||
129 | struct hsr_node *node; | ||
130 | |||
131 | rcu_read_lock(); | ||
132 | node = list_first_or_null_rcu(self_node_db, struct hsr_node, mac_list); | ||
133 | rcu_read_unlock(); | ||
134 | if (node) { | ||
135 | list_del_rcu(&node->mac_list); | ||
136 | kfree(node); | ||
137 | } | ||
138 | } | ||
127 | 139 | ||
128 | /* Allocate an hsr_node and add it to node_db. 'addr' is the node's AddressA; | 140 | /* Allocate an hsr_node and add it to node_db. 'addr' is the node's AddressA; |
129 | * seq_out is used to initialize filtering of outgoing duplicate frames | 141 | * seq_out is used to initialize filtering of outgoing duplicate frames |
diff --git a/net/hsr/hsr_framereg.h b/net/hsr/hsr_framereg.h index 370b45998121..531fd3dfcac1 100644 --- a/net/hsr/hsr_framereg.h +++ b/net/hsr/hsr_framereg.h | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | struct hsr_node; | 17 | struct hsr_node; |
18 | 18 | ||
19 | void hsr_del_node(struct list_head *self_node_db); | ||
19 | struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], | 20 | struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], |
20 | u16 seq_out); | 21 | u16 seq_out); |
21 | struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, | 22 | struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, |
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index 437070d1ffb1..79e98e21cdd7 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c | |||
@@ -1024,7 +1024,7 @@ static int gue_err(struct sk_buff *skb, u32 info) | |||
1024 | int ret; | 1024 | int ret; |
1025 | 1025 | ||
1026 | len = sizeof(struct udphdr) + sizeof(struct guehdr); | 1026 | len = sizeof(struct udphdr) + sizeof(struct guehdr); |
1027 | if (!pskb_may_pull(skb, len)) | 1027 | if (!pskb_may_pull(skb, transport_offset + len)) |
1028 | return -EINVAL; | 1028 | return -EINVAL; |
1029 | 1029 | ||
1030 | guehdr = (struct guehdr *)&udp_hdr(skb)[1]; | 1030 | guehdr = (struct guehdr *)&udp_hdr(skb)[1]; |
@@ -1059,7 +1059,7 @@ static int gue_err(struct sk_buff *skb, u32 info) | |||
1059 | 1059 | ||
1060 | optlen = guehdr->hlen << 2; | 1060 | optlen = guehdr->hlen << 2; |
1061 | 1061 | ||
1062 | if (!pskb_may_pull(skb, len + optlen)) | 1062 | if (!pskb_may_pull(skb, transport_offset + len + optlen)) |
1063 | return -EINVAL; | 1063 | return -EINVAL; |
1064 | 1064 | ||
1065 | guehdr = (struct guehdr *)&udp_hdr(skb)[1]; | 1065 | guehdr = (struct guehdr *)&udp_hdr(skb)[1]; |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 2756fb725bf0..a5d8cad18ead 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -515,9 +515,10 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, | |||
515 | mtu = dst_mtu(&rt->dst) - dev->hard_header_len | 515 | mtu = dst_mtu(&rt->dst) - dev->hard_header_len |
516 | - sizeof(struct iphdr) - tunnel_hlen; | 516 | - sizeof(struct iphdr) - tunnel_hlen; |
517 | else | 517 | else |
518 | mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; | 518 | mtu = skb_valid_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; |
519 | 519 | ||
520 | skb_dst_update_pmtu(skb, mtu); | 520 | if (skb_valid_dst(skb)) |
521 | skb_dst_update_pmtu(skb, mtu); | ||
521 | 522 | ||
522 | if (skb->protocol == htons(ETH_P_IP)) { | 523 | if (skb->protocol == htons(ETH_P_IP)) { |
523 | if (!skb_is_gso(skb) && | 524 | if (!skb_is_gso(skb) && |
@@ -530,9 +531,11 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, | |||
530 | } | 531 | } |
531 | #if IS_ENABLED(CONFIG_IPV6) | 532 | #if IS_ENABLED(CONFIG_IPV6) |
532 | else if (skb->protocol == htons(ETH_P_IPV6)) { | 533 | else if (skb->protocol == htons(ETH_P_IPV6)) { |
533 | struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb); | 534 | struct rt6_info *rt6; |
534 | __be32 daddr; | 535 | __be32 daddr; |
535 | 536 | ||
537 | rt6 = skb_valid_dst(skb) ? (struct rt6_info *)skb_dst(skb) : | ||
538 | NULL; | ||
536 | daddr = md ? dst : tunnel->parms.iph.daddr; | 539 | daddr = md ? dst : tunnel->parms.iph.daddr; |
537 | 540 | ||
538 | if (rt6 && mtu < dst_mtu(skb_dst(skb)) && | 541 | if (rt6 && mtu < dst_mtu(skb_dst(skb)) && |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 738ff0a1a048..a5da63e5faa2 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1303,6 +1303,10 @@ static void ip_del_fnhe(struct fib_nh *nh, __be32 daddr) | |||
1303 | if (fnhe->fnhe_daddr == daddr) { | 1303 | if (fnhe->fnhe_daddr == daddr) { |
1304 | rcu_assign_pointer(*fnhe_p, rcu_dereference_protected( | 1304 | rcu_assign_pointer(*fnhe_p, rcu_dereference_protected( |
1305 | fnhe->fnhe_next, lockdep_is_held(&fnhe_lock))); | 1305 | fnhe->fnhe_next, lockdep_is_held(&fnhe_lock))); |
1306 | /* set fnhe_daddr to 0 to ensure it won't bind with | ||
1307 | * new dsts in rt_bind_exception(). | ||
1308 | */ | ||
1309 | fnhe->fnhe_daddr = 0; | ||
1306 | fnhe_flush_routes(fnhe); | 1310 | fnhe_flush_routes(fnhe); |
1307 | kfree_rcu(fnhe, rcu); | 1311 | kfree_rcu(fnhe, rcu); |
1308 | break; | 1312 | break; |
@@ -2149,12 +2153,13 @@ int ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2149 | int our = 0; | 2153 | int our = 0; |
2150 | int err = -EINVAL; | 2154 | int err = -EINVAL; |
2151 | 2155 | ||
2152 | if (in_dev) | 2156 | if (!in_dev) |
2153 | our = ip_check_mc_rcu(in_dev, daddr, saddr, | 2157 | return err; |
2154 | ip_hdr(skb)->protocol); | 2158 | our = ip_check_mc_rcu(in_dev, daddr, saddr, |
2159 | ip_hdr(skb)->protocol); | ||
2155 | 2160 | ||
2156 | /* check l3 master if no match yet */ | 2161 | /* check l3 master if no match yet */ |
2157 | if ((!in_dev || !our) && netif_is_l3_slave(dev)) { | 2162 | if (!our && netif_is_l3_slave(dev)) { |
2158 | struct in_device *l3_in_dev; | 2163 | struct in_device *l3_in_dev; |
2159 | 2164 | ||
2160 | l3_in_dev = __in_dev_get_rcu(skb->dev); | 2165 | l3_in_dev = __in_dev_get_rcu(skb->dev); |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 606f868d9f3f..e531344611a0 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -216,7 +216,12 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb, | |||
216 | refcount_set(&req->rsk_refcnt, 1); | 216 | refcount_set(&req->rsk_refcnt, 1); |
217 | tcp_sk(child)->tsoffset = tsoff; | 217 | tcp_sk(child)->tsoffset = tsoff; |
218 | sock_rps_save_rxhash(child, skb); | 218 | sock_rps_save_rxhash(child, skb); |
219 | inet_csk_reqsk_queue_add(sk, req, child); | 219 | if (!inet_csk_reqsk_queue_add(sk, req, child)) { |
220 | bh_unlock_sock(child); | ||
221 | sock_put(child); | ||
222 | child = NULL; | ||
223 | reqsk_put(req); | ||
224 | } | ||
220 | } else { | 225 | } else { |
221 | reqsk_free(req); | 226 | reqsk_free(req); |
222 | } | 227 | } |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index ad07dd71063d..6baa6dc1b13b 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -943,6 +943,10 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, | |||
943 | ssize_t copied; | 943 | ssize_t copied; |
944 | long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); | 944 | long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); |
945 | 945 | ||
946 | if (IS_ENABLED(CONFIG_DEBUG_VM) && | ||
947 | WARN_ONCE(PageSlab(page), "page must not be a Slab one")) | ||
948 | return -EINVAL; | ||
949 | |||
946 | /* Wait for a connection to finish. One exception is TCP Fast Open | 950 | /* Wait for a connection to finish. One exception is TCP Fast Open |
947 | * (passive side) where data is allowed to be sent before a connection | 951 | * (passive side) where data is allowed to be sent before a connection |
948 | * is fully established. | 952 | * is fully established. |
@@ -1933,6 +1937,11 @@ static int tcp_inq_hint(struct sock *sk) | |||
1933 | inq = tp->rcv_nxt - tp->copied_seq; | 1937 | inq = tp->rcv_nxt - tp->copied_seq; |
1934 | release_sock(sk); | 1938 | release_sock(sk); |
1935 | } | 1939 | } |
1940 | /* After receiving a FIN, tell the user-space to continue reading | ||
1941 | * by returning a non-zero inq. | ||
1942 | */ | ||
1943 | if (inq == 0 && sock_flag(sk, SOCK_DONE)) | ||
1944 | inq = 1; | ||
1936 | return inq; | 1945 | return inq; |
1937 | } | 1946 | } |
1938 | 1947 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 4eb0c8ca3c60..5def3c48870e 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -6498,7 +6498,13 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops, | |||
6498 | af_ops->send_synack(fastopen_sk, dst, &fl, req, | 6498 | af_ops->send_synack(fastopen_sk, dst, &fl, req, |
6499 | &foc, TCP_SYNACK_FASTOPEN); | 6499 | &foc, TCP_SYNACK_FASTOPEN); |
6500 | /* Add the child socket directly into the accept queue */ | 6500 | /* Add the child socket directly into the accept queue */ |
6501 | inet_csk_reqsk_queue_add(sk, req, fastopen_sk); | 6501 | if (!inet_csk_reqsk_queue_add(sk, req, fastopen_sk)) { |
6502 | reqsk_fastopen_remove(fastopen_sk, req, false); | ||
6503 | bh_unlock_sock(fastopen_sk); | ||
6504 | sock_put(fastopen_sk); | ||
6505 | reqsk_put(req); | ||
6506 | goto drop; | ||
6507 | } | ||
6502 | sk->sk_data_ready(sk); | 6508 | sk->sk_data_ready(sk); |
6503 | bh_unlock_sock(fastopen_sk); | 6509 | bh_unlock_sock(fastopen_sk); |
6504 | sock_put(fastopen_sk); | 6510 | sock_put(fastopen_sk); |
diff --git a/net/ipv6/fou6.c b/net/ipv6/fou6.c index 867474abe269..ec4e2ed95f36 100644 --- a/net/ipv6/fou6.c +++ b/net/ipv6/fou6.c | |||
@@ -94,7 +94,7 @@ static int gue6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
94 | int ret; | 94 | int ret; |
95 | 95 | ||
96 | len = sizeof(struct udphdr) + sizeof(struct guehdr); | 96 | len = sizeof(struct udphdr) + sizeof(struct guehdr); |
97 | if (!pskb_may_pull(skb, len)) | 97 | if (!pskb_may_pull(skb, transport_offset + len)) |
98 | return -EINVAL; | 98 | return -EINVAL; |
99 | 99 | ||
100 | guehdr = (struct guehdr *)&udp_hdr(skb)[1]; | 100 | guehdr = (struct guehdr *)&udp_hdr(skb)[1]; |
@@ -129,7 +129,7 @@ static int gue6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
129 | 129 | ||
130 | optlen = guehdr->hlen << 2; | 130 | optlen = guehdr->hlen << 2; |
131 | 131 | ||
132 | if (!pskb_may_pull(skb, len + optlen)) | 132 | if (!pskb_may_pull(skb, transport_offset + len + optlen)) |
133 | return -EINVAL; | 133 | return -EINVAL; |
134 | 134 | ||
135 | guehdr = (struct guehdr *)&udp_hdr(skb)[1]; | 135 | guehdr = (struct guehdr *)&udp_hdr(skb)[1]; |
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c index b2adfa825363..83797b3949e2 100644 --- a/net/rxrpc/conn_client.c +++ b/net/rxrpc/conn_client.c | |||
@@ -353,7 +353,7 @@ static int rxrpc_get_client_conn(struct rxrpc_sock *rx, | |||
353 | * normally have to take channel_lock but we do this before anyone else | 353 | * normally have to take channel_lock but we do this before anyone else |
354 | * can see the connection. | 354 | * can see the connection. |
355 | */ | 355 | */ |
356 | list_add_tail(&call->chan_wait_link, &candidate->waiting_calls); | 356 | list_add(&call->chan_wait_link, &candidate->waiting_calls); |
357 | 357 | ||
358 | if (cp->exclusive) { | 358 | if (cp->exclusive) { |
359 | call->conn = candidate; | 359 | call->conn = candidate; |
@@ -432,7 +432,7 @@ found_extant_conn: | |||
432 | call->conn = conn; | 432 | call->conn = conn; |
433 | call->security_ix = conn->security_ix; | 433 | call->security_ix = conn->security_ix; |
434 | call->service_id = conn->service_id; | 434 | call->service_id = conn->service_id; |
435 | list_add(&call->chan_wait_link, &conn->waiting_calls); | 435 | list_add_tail(&call->chan_wait_link, &conn->waiting_calls); |
436 | spin_unlock(&conn->channel_lock); | 436 | spin_unlock(&conn->channel_lock); |
437 | _leave(" = 0 [extant %d]", conn->debug_id); | 437 | _leave(" = 0 [extant %d]", conn->debug_id); |
438 | return 0; | 438 | return 0; |
@@ -704,6 +704,7 @@ int rxrpc_connect_call(struct rxrpc_sock *rx, | |||
704 | 704 | ||
705 | ret = rxrpc_wait_for_channel(call, gfp); | 705 | ret = rxrpc_wait_for_channel(call, gfp); |
706 | if (ret < 0) { | 706 | if (ret < 0) { |
707 | trace_rxrpc_client(call->conn, ret, rxrpc_client_chan_wait_failed); | ||
707 | rxrpc_disconnect_client_call(call); | 708 | rxrpc_disconnect_client_call(call); |
708 | goto out; | 709 | goto out; |
709 | } | 710 | } |
@@ -774,16 +775,22 @@ static void rxrpc_set_client_reap_timer(struct rxrpc_net *rxnet) | |||
774 | */ | 775 | */ |
775 | void rxrpc_disconnect_client_call(struct rxrpc_call *call) | 776 | void rxrpc_disconnect_client_call(struct rxrpc_call *call) |
776 | { | 777 | { |
777 | unsigned int channel = call->cid & RXRPC_CHANNELMASK; | ||
778 | struct rxrpc_connection *conn = call->conn; | 778 | struct rxrpc_connection *conn = call->conn; |
779 | struct rxrpc_channel *chan = &conn->channels[channel]; | 779 | struct rxrpc_channel *chan = NULL; |
780 | struct rxrpc_net *rxnet = conn->params.local->rxnet; | 780 | struct rxrpc_net *rxnet = conn->params.local->rxnet; |
781 | unsigned int channel = -1; | ||
782 | u32 cid; | ||
781 | 783 | ||
784 | spin_lock(&conn->channel_lock); | ||
785 | |||
786 | cid = call->cid; | ||
787 | if (cid) { | ||
788 | channel = cid & RXRPC_CHANNELMASK; | ||
789 | chan = &conn->channels[channel]; | ||
790 | } | ||
782 | trace_rxrpc_client(conn, channel, rxrpc_client_chan_disconnect); | 791 | trace_rxrpc_client(conn, channel, rxrpc_client_chan_disconnect); |
783 | call->conn = NULL; | 792 | call->conn = NULL; |
784 | 793 | ||
785 | spin_lock(&conn->channel_lock); | ||
786 | |||
787 | /* Calls that have never actually been assigned a channel can simply be | 794 | /* Calls that have never actually been assigned a channel can simply be |
788 | * discarded. If the conn didn't get used either, it will follow | 795 | * discarded. If the conn didn't get used either, it will follow |
789 | * immediately unless someone else grabs it in the meantime. | 796 | * immediately unless someone else grabs it in the meantime. |
@@ -807,7 +814,10 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *call) | |||
807 | goto out; | 814 | goto out; |
808 | } | 815 | } |
809 | 816 | ||
810 | ASSERTCMP(rcu_access_pointer(chan->call), ==, call); | 817 | if (rcu_access_pointer(chan->call) != call) { |
818 | spin_unlock(&conn->channel_lock); | ||
819 | BUG(); | ||
820 | } | ||
811 | 821 | ||
812 | /* If a client call was exposed to the world, we save the result for | 822 | /* If a client call was exposed to the world, we save the result for |
813 | * retransmission. | 823 | * retransmission. |
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 3beb4717d3b7..7c6591b991d5 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c | |||
@@ -201,14 +201,9 @@ static void tunnel_key_release_params(struct tcf_tunnel_key_params *p) | |||
201 | { | 201 | { |
202 | if (!p) | 202 | if (!p) |
203 | return; | 203 | return; |
204 | if (p->tcft_action == TCA_TUNNEL_KEY_ACT_SET) { | 204 | if (p->tcft_action == TCA_TUNNEL_KEY_ACT_SET) |
205 | #ifdef CONFIG_DST_CACHE | ||
206 | struct ip_tunnel_info *info = &p->tcft_enc_metadata->u.tun_info; | ||
207 | |||
208 | dst_cache_destroy(&info->dst_cache); | ||
209 | #endif | ||
210 | dst_release(&p->tcft_enc_metadata->dst); | 205 | dst_release(&p->tcft_enc_metadata->dst); |
211 | } | 206 | |
212 | kfree_rcu(p, rcu); | 207 | kfree_rcu(p, rcu); |
213 | } | 208 | } |
214 | 209 | ||
@@ -338,7 +333,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, | |||
338 | &metadata->u.tun_info, | 333 | &metadata->u.tun_info, |
339 | opts_len, extack); | 334 | opts_len, extack); |
340 | if (ret < 0) | 335 | if (ret < 0) |
341 | goto release_dst_cache; | 336 | goto release_tun_meta; |
342 | } | 337 | } |
343 | 338 | ||
344 | metadata->u.tun_info.mode |= IP_TUNNEL_INFO_TX; | 339 | metadata->u.tun_info.mode |= IP_TUNNEL_INFO_TX; |
@@ -354,14 +349,14 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, | |||
354 | &act_tunnel_key_ops, bind, true); | 349 | &act_tunnel_key_ops, bind, true); |
355 | if (ret) { | 350 | if (ret) { |
356 | NL_SET_ERR_MSG(extack, "Cannot create TC IDR"); | 351 | NL_SET_ERR_MSG(extack, "Cannot create TC IDR"); |
357 | goto release_dst_cache; | 352 | goto release_tun_meta; |
358 | } | 353 | } |
359 | 354 | ||
360 | ret = ACT_P_CREATED; | 355 | ret = ACT_P_CREATED; |
361 | } else if (!ovr) { | 356 | } else if (!ovr) { |
362 | NL_SET_ERR_MSG(extack, "TC IDR already exists"); | 357 | NL_SET_ERR_MSG(extack, "TC IDR already exists"); |
363 | ret = -EEXIST; | 358 | ret = -EEXIST; |
364 | goto release_dst_cache; | 359 | goto release_tun_meta; |
365 | } | 360 | } |
366 | 361 | ||
367 | t = to_tunnel_key(*a); | 362 | t = to_tunnel_key(*a); |
@@ -371,7 +366,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, | |||
371 | NL_SET_ERR_MSG(extack, "Cannot allocate tunnel key parameters"); | 366 | NL_SET_ERR_MSG(extack, "Cannot allocate tunnel key parameters"); |
372 | ret = -ENOMEM; | 367 | ret = -ENOMEM; |
373 | exists = true; | 368 | exists = true; |
374 | goto release_dst_cache; | 369 | goto release_tun_meta; |
375 | } | 370 | } |
376 | params_new->tcft_action = parm->t_action; | 371 | params_new->tcft_action = parm->t_action; |
377 | params_new->tcft_enc_metadata = metadata; | 372 | params_new->tcft_enc_metadata = metadata; |
@@ -388,12 +383,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, | |||
388 | 383 | ||
389 | return ret; | 384 | return ret; |
390 | 385 | ||
391 | release_dst_cache: | ||
392 | #ifdef CONFIG_DST_CACHE | ||
393 | if (metadata) | ||
394 | dst_cache_destroy(&metadata->u.tun_info.dst_cache); | ||
395 | release_tun_meta: | 386 | release_tun_meta: |
396 | #endif | ||
397 | if (metadata) | 387 | if (metadata) |
398 | dst_release(&metadata->dst); | 388 | dst_release(&metadata->dst); |
399 | 389 | ||
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 478095d50f95..2c2aac4ac721 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -470,10 +470,9 @@ static void __tcf_chain_put(struct tcf_chain *chain, bool by_act, | |||
470 | { | 470 | { |
471 | struct tcf_block *block = chain->block; | 471 | struct tcf_block *block = chain->block; |
472 | const struct tcf_proto_ops *tmplt_ops; | 472 | const struct tcf_proto_ops *tmplt_ops; |
473 | bool is_last, free_block = false; | 473 | bool free_block = false; |
474 | unsigned int refcnt; | 474 | unsigned int refcnt; |
475 | void *tmplt_priv; | 475 | void *tmplt_priv; |
476 | u32 chain_index; | ||
477 | 476 | ||
478 | mutex_lock(&block->lock); | 477 | mutex_lock(&block->lock); |
479 | if (explicitly_created) { | 478 | if (explicitly_created) { |
@@ -492,23 +491,21 @@ static void __tcf_chain_put(struct tcf_chain *chain, bool by_act, | |||
492 | * save these to temporary variables. | 491 | * save these to temporary variables. |
493 | */ | 492 | */ |
494 | refcnt = --chain->refcnt; | 493 | refcnt = --chain->refcnt; |
495 | is_last = refcnt - chain->action_refcnt == 0; | ||
496 | tmplt_ops = chain->tmplt_ops; | 494 | tmplt_ops = chain->tmplt_ops; |
497 | tmplt_priv = chain->tmplt_priv; | 495 | tmplt_priv = chain->tmplt_priv; |
498 | chain_index = chain->index; | ||
499 | |||
500 | if (refcnt == 0) | ||
501 | free_block = tcf_chain_detach(chain); | ||
502 | mutex_unlock(&block->lock); | ||
503 | 496 | ||
504 | /* The last dropped non-action reference will trigger notification. */ | 497 | /* The last dropped non-action reference will trigger notification. */ |
505 | if (is_last && !by_act) { | 498 | if (refcnt - chain->action_refcnt == 0 && !by_act) { |
506 | tc_chain_notify_delete(tmplt_ops, tmplt_priv, chain_index, | 499 | tc_chain_notify_delete(tmplt_ops, tmplt_priv, chain->index, |
507 | block, NULL, 0, 0, false); | 500 | block, NULL, 0, 0, false); |
508 | /* Last reference to chain, no need to lock. */ | 501 | /* Last reference to chain, no need to lock. */ |
509 | chain->flushing = false; | 502 | chain->flushing = false; |
510 | } | 503 | } |
511 | 504 | ||
505 | if (refcnt == 0) | ||
506 | free_block = tcf_chain_detach(chain); | ||
507 | mutex_unlock(&block->lock); | ||
508 | |||
512 | if (refcnt == 0) { | 509 | if (refcnt == 0) { |
513 | tc_chain_tmplt_del(tmplt_ops, tmplt_priv); | 510 | tc_chain_tmplt_del(tmplt_ops, tmplt_priv); |
514 | tcf_chain_destroy(chain, free_block); | 511 | tcf_chain_destroy(chain, free_block); |
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 27300a3e76c7..c04247b403ed 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -1348,46 +1348,46 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, | |||
1348 | if (err < 0) | 1348 | if (err < 0) |
1349 | goto errout; | 1349 | goto errout; |
1350 | 1350 | ||
1351 | if (!handle) { | ||
1352 | handle = 1; | ||
1353 | err = idr_alloc_u32(&head->handle_idr, fnew, &handle, | ||
1354 | INT_MAX, GFP_KERNEL); | ||
1355 | } else if (!fold) { | ||
1356 | /* user specifies a handle and it doesn't exist */ | ||
1357 | err = idr_alloc_u32(&head->handle_idr, fnew, &handle, | ||
1358 | handle, GFP_KERNEL); | ||
1359 | } | ||
1360 | if (err) | ||
1361 | goto errout; | ||
1362 | fnew->handle = handle; | ||
1363 | |||
1364 | if (tb[TCA_FLOWER_FLAGS]) { | 1351 | if (tb[TCA_FLOWER_FLAGS]) { |
1365 | fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]); | 1352 | fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]); |
1366 | 1353 | ||
1367 | if (!tc_flags_valid(fnew->flags)) { | 1354 | if (!tc_flags_valid(fnew->flags)) { |
1368 | err = -EINVAL; | 1355 | err = -EINVAL; |
1369 | goto errout_idr; | 1356 | goto errout; |
1370 | } | 1357 | } |
1371 | } | 1358 | } |
1372 | 1359 | ||
1373 | err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE], ovr, | 1360 | err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE], ovr, |
1374 | tp->chain->tmplt_priv, extack); | 1361 | tp->chain->tmplt_priv, extack); |
1375 | if (err) | 1362 | if (err) |
1376 | goto errout_idr; | 1363 | goto errout; |
1377 | 1364 | ||
1378 | err = fl_check_assign_mask(head, fnew, fold, mask); | 1365 | err = fl_check_assign_mask(head, fnew, fold, mask); |
1379 | if (err) | 1366 | if (err) |
1380 | goto errout_idr; | 1367 | goto errout; |
1368 | |||
1369 | if (!handle) { | ||
1370 | handle = 1; | ||
1371 | err = idr_alloc_u32(&head->handle_idr, fnew, &handle, | ||
1372 | INT_MAX, GFP_KERNEL); | ||
1373 | } else if (!fold) { | ||
1374 | /* user specifies a handle and it doesn't exist */ | ||
1375 | err = idr_alloc_u32(&head->handle_idr, fnew, &handle, | ||
1376 | handle, GFP_KERNEL); | ||
1377 | } | ||
1378 | if (err) | ||
1379 | goto errout_mask; | ||
1380 | fnew->handle = handle; | ||
1381 | 1381 | ||
1382 | if (!fold && __fl_lookup(fnew->mask, &fnew->mkey)) { | 1382 | if (!fold && __fl_lookup(fnew->mask, &fnew->mkey)) { |
1383 | err = -EEXIST; | 1383 | err = -EEXIST; |
1384 | goto errout_mask; | 1384 | goto errout_idr; |
1385 | } | 1385 | } |
1386 | 1386 | ||
1387 | err = rhashtable_insert_fast(&fnew->mask->ht, &fnew->ht_node, | 1387 | err = rhashtable_insert_fast(&fnew->mask->ht, &fnew->ht_node, |
1388 | fnew->mask->filter_ht_params); | 1388 | fnew->mask->filter_ht_params); |
1389 | if (err) | 1389 | if (err) |
1390 | goto errout_mask; | 1390 | goto errout_idr; |
1391 | 1391 | ||
1392 | if (!tc_skip_hw(fnew->flags)) { | 1392 | if (!tc_skip_hw(fnew->flags)) { |
1393 | err = fl_hw_replace_filter(tp, fnew, extack); | 1393 | err = fl_hw_replace_filter(tp, fnew, extack); |
@@ -1426,12 +1426,13 @@ errout_mask_ht: | |||
1426 | rhashtable_remove_fast(&fnew->mask->ht, &fnew->ht_node, | 1426 | rhashtable_remove_fast(&fnew->mask->ht, &fnew->ht_node, |
1427 | fnew->mask->filter_ht_params); | 1427 | fnew->mask->filter_ht_params); |
1428 | 1428 | ||
1429 | errout_mask: | ||
1430 | fl_mask_put(head, fnew->mask, false); | ||
1431 | |||
1432 | errout_idr: | 1429 | errout_idr: |
1433 | if (!fold) | 1430 | if (!fold) |
1434 | idr_remove(&head->handle_idr, fnew->handle); | 1431 | idr_remove(&head->handle_idr, fnew->handle); |
1432 | |||
1433 | errout_mask: | ||
1434 | fl_mask_put(head, fnew->mask, false); | ||
1435 | |||
1435 | errout: | 1436 | errout: |
1436 | tcf_exts_destroy(&fnew->exts); | 1437 | tcf_exts_destroy(&fnew->exts); |
1437 | kfree(fnew); | 1438 | kfree(fnew); |
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 5b537613946f..39d72e58b8e5 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
@@ -471,12 +471,6 @@ int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp) | |||
471 | struct crypto_shash *tfm = NULL; | 471 | struct crypto_shash *tfm = NULL; |
472 | __u16 id; | 472 | __u16 id; |
473 | 473 | ||
474 | /* If AUTH extension is disabled, we are done */ | ||
475 | if (!ep->auth_enable) { | ||
476 | ep->auth_hmacs = NULL; | ||
477 | return 0; | ||
478 | } | ||
479 | |||
480 | /* If the transforms are already allocated, we are done */ | 474 | /* If the transforms are already allocated, we are done */ |
481 | if (ep->auth_hmacs) | 475 | if (ep->auth_hmacs) |
482 | return 0; | 476 | return 0; |
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 40c7eb941bc9..0448b68fce74 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
@@ -107,6 +107,13 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, | |||
107 | auth_chunks->param_hdr.length = | 107 | auth_chunks->param_hdr.length = |
108 | htons(sizeof(struct sctp_paramhdr) + 2); | 108 | htons(sizeof(struct sctp_paramhdr) + 2); |
109 | } | 109 | } |
110 | |||
111 | /* Allocate and initialize transorms arrays for supported | ||
112 | * HMACs. | ||
113 | */ | ||
114 | err = sctp_auth_init_hmacs(ep, gfp); | ||
115 | if (err) | ||
116 | goto nomem; | ||
110 | } | 117 | } |
111 | 118 | ||
112 | /* Initialize the base structure. */ | 119 | /* Initialize the base structure. */ |
@@ -150,15 +157,10 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, | |||
150 | INIT_LIST_HEAD(&ep->endpoint_shared_keys); | 157 | INIT_LIST_HEAD(&ep->endpoint_shared_keys); |
151 | null_key = sctp_auth_shkey_create(0, gfp); | 158 | null_key = sctp_auth_shkey_create(0, gfp); |
152 | if (!null_key) | 159 | if (!null_key) |
153 | goto nomem; | 160 | goto nomem_shkey; |
154 | 161 | ||
155 | list_add(&null_key->key_list, &ep->endpoint_shared_keys); | 162 | list_add(&null_key->key_list, &ep->endpoint_shared_keys); |
156 | 163 | ||
157 | /* Allocate and initialize transorms arrays for supported HMACs. */ | ||
158 | err = sctp_auth_init_hmacs(ep, gfp); | ||
159 | if (err) | ||
160 | goto nomem_hmacs; | ||
161 | |||
162 | /* Add the null key to the endpoint shared keys list and | 164 | /* Add the null key to the endpoint shared keys list and |
163 | * set the hmcas and chunks pointers. | 165 | * set the hmcas and chunks pointers. |
164 | */ | 166 | */ |
@@ -169,8 +171,8 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, | |||
169 | 171 | ||
170 | return ep; | 172 | return ep; |
171 | 173 | ||
172 | nomem_hmacs: | 174 | nomem_shkey: |
173 | sctp_auth_destroy_keys(&ep->endpoint_shared_keys); | 175 | sctp_auth_destroy_hmacs(ep->auth_hmacs); |
174 | nomem: | 176 | nomem: |
175 | /* Free all allocations */ | 177 | /* Free all allocations */ |
176 | kfree(auth_hmacs); | 178 | kfree(auth_hmacs); |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 533207dbeae9..6140471efd4b 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -102,9 +102,9 @@ static int sctp_send_asconf(struct sctp_association *asoc, | |||
102 | struct sctp_chunk *chunk); | 102 | struct sctp_chunk *chunk); |
103 | static int sctp_do_bind(struct sock *, union sctp_addr *, int); | 103 | static int sctp_do_bind(struct sock *, union sctp_addr *, int); |
104 | static int sctp_autobind(struct sock *sk); | 104 | static int sctp_autobind(struct sock *sk); |
105 | static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | 105 | static int sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, |
106 | struct sctp_association *assoc, | 106 | struct sctp_association *assoc, |
107 | enum sctp_socket_type type); | 107 | enum sctp_socket_type type); |
108 | 108 | ||
109 | static unsigned long sctp_memory_pressure; | 109 | static unsigned long sctp_memory_pressure; |
110 | static atomic_long_t sctp_memory_allocated; | 110 | static atomic_long_t sctp_memory_allocated; |
@@ -4891,7 +4891,11 @@ static struct sock *sctp_accept(struct sock *sk, int flags, int *err, bool kern) | |||
4891 | /* Populate the fields of the newsk from the oldsk and migrate the | 4891 | /* Populate the fields of the newsk from the oldsk and migrate the |
4892 | * asoc to the newsk. | 4892 | * asoc to the newsk. |
4893 | */ | 4893 | */ |
4894 | sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP); | 4894 | error = sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP); |
4895 | if (error) { | ||
4896 | sk_common_release(newsk); | ||
4897 | newsk = NULL; | ||
4898 | } | ||
4895 | 4899 | ||
4896 | out: | 4900 | out: |
4897 | release_sock(sk); | 4901 | release_sock(sk); |
@@ -5639,7 +5643,12 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) | |||
5639 | /* Populate the fields of the newsk from the oldsk and migrate the | 5643 | /* Populate the fields of the newsk from the oldsk and migrate the |
5640 | * asoc to the newsk. | 5644 | * asoc to the newsk. |
5641 | */ | 5645 | */ |
5642 | sctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH); | 5646 | err = sctp_sock_migrate(sk, sock->sk, asoc, |
5647 | SCTP_SOCKET_UDP_HIGH_BANDWIDTH); | ||
5648 | if (err) { | ||
5649 | sock_release(sock); | ||
5650 | sock = NULL; | ||
5651 | } | ||
5643 | 5652 | ||
5644 | *sockp = sock; | 5653 | *sockp = sock; |
5645 | 5654 | ||
@@ -9171,9 +9180,9 @@ static inline void sctp_copy_descendant(struct sock *sk_to, | |||
9171 | /* Populate the fields of the newsk from the oldsk and migrate the assoc | 9180 | /* Populate the fields of the newsk from the oldsk and migrate the assoc |
9172 | * and its messages to the newsk. | 9181 | * and its messages to the newsk. |
9173 | */ | 9182 | */ |
9174 | static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | 9183 | static int sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, |
9175 | struct sctp_association *assoc, | 9184 | struct sctp_association *assoc, |
9176 | enum sctp_socket_type type) | 9185 | enum sctp_socket_type type) |
9177 | { | 9186 | { |
9178 | struct sctp_sock *oldsp = sctp_sk(oldsk); | 9187 | struct sctp_sock *oldsp = sctp_sk(oldsk); |
9179 | struct sctp_sock *newsp = sctp_sk(newsk); | 9188 | struct sctp_sock *newsp = sctp_sk(newsk); |
@@ -9182,6 +9191,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
9182 | struct sk_buff *skb, *tmp; | 9191 | struct sk_buff *skb, *tmp; |
9183 | struct sctp_ulpevent *event; | 9192 | struct sctp_ulpevent *event; |
9184 | struct sctp_bind_hashbucket *head; | 9193 | struct sctp_bind_hashbucket *head; |
9194 | int err; | ||
9185 | 9195 | ||
9186 | /* Migrate socket buffer sizes and all the socket level options to the | 9196 | /* Migrate socket buffer sizes and all the socket level options to the |
9187 | * new socket. | 9197 | * new socket. |
@@ -9210,8 +9220,20 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
9210 | /* Copy the bind_addr list from the original endpoint to the new | 9220 | /* Copy the bind_addr list from the original endpoint to the new |
9211 | * endpoint so that we can handle restarts properly | 9221 | * endpoint so that we can handle restarts properly |
9212 | */ | 9222 | */ |
9213 | sctp_bind_addr_dup(&newsp->ep->base.bind_addr, | 9223 | err = sctp_bind_addr_dup(&newsp->ep->base.bind_addr, |
9214 | &oldsp->ep->base.bind_addr, GFP_KERNEL); | 9224 | &oldsp->ep->base.bind_addr, GFP_KERNEL); |
9225 | if (err) | ||
9226 | return err; | ||
9227 | |||
9228 | /* New ep's auth_hmacs should be set if old ep's is set, in case | ||
9229 | * that net->sctp.auth_enable has been changed to 0 by users and | ||
9230 | * new ep's auth_hmacs couldn't be set in sctp_endpoint_init(). | ||
9231 | */ | ||
9232 | if (oldsp->ep->auth_hmacs) { | ||
9233 | err = sctp_auth_init_hmacs(newsp->ep, GFP_KERNEL); | ||
9234 | if (err) | ||
9235 | return err; | ||
9236 | } | ||
9215 | 9237 | ||
9216 | /* Move any messages in the old socket's receive queue that are for the | 9238 | /* Move any messages in the old socket's receive queue that are for the |
9217 | * peeled off association to the new socket's receive queue. | 9239 | * peeled off association to the new socket's receive queue. |
@@ -9296,6 +9318,8 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
9296 | } | 9318 | } |
9297 | 9319 | ||
9298 | release_sock(newsk); | 9320 | release_sock(newsk); |
9321 | |||
9322 | return 0; | ||
9299 | } | 9323 | } |
9300 | 9324 | ||
9301 | 9325 | ||
diff --git a/net/sctp/stream.c b/net/sctp/stream.c index 2936ed17bf9e..3b47457862cc 100644 --- a/net/sctp/stream.c +++ b/net/sctp/stream.c | |||
@@ -230,8 +230,6 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, | |||
230 | for (i = 0; i < stream->outcnt; i++) | 230 | for (i = 0; i < stream->outcnt; i++) |
231 | SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; | 231 | SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; |
232 | 232 | ||
233 | sched->init(stream); | ||
234 | |||
235 | in: | 233 | in: |
236 | sctp_stream_interleave_init(stream); | 234 | sctp_stream_interleave_init(stream); |
237 | if (!incnt) | 235 | if (!incnt) |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index e482b342bfa8..3274ef625dba 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1333,7 +1333,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) | |||
1333 | 1333 | ||
1334 | if (unlikely(!dest)) { | 1334 | if (unlikely(!dest)) { |
1335 | dest = &tsk->peer; | 1335 | dest = &tsk->peer; |
1336 | if (!syn || dest->family != AF_TIPC) | 1336 | if (!syn && dest->family != AF_TIPC) |
1337 | return -EDESTADDRREQ; | 1337 | return -EDESTADDRREQ; |
1338 | } | 1338 | } |
1339 | 1339 | ||
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 3ae3a33da70b..602715fc9a75 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c | |||
@@ -662,6 +662,8 @@ static int virtio_transport_reset(struct vsock_sock *vsk, | |||
662 | */ | 662 | */ |
663 | static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt) | 663 | static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt) |
664 | { | 664 | { |
665 | const struct virtio_transport *t; | ||
666 | struct virtio_vsock_pkt *reply; | ||
665 | struct virtio_vsock_pkt_info info = { | 667 | struct virtio_vsock_pkt_info info = { |
666 | .op = VIRTIO_VSOCK_OP_RST, | 668 | .op = VIRTIO_VSOCK_OP_RST, |
667 | .type = le16_to_cpu(pkt->hdr.type), | 669 | .type = le16_to_cpu(pkt->hdr.type), |
@@ -672,15 +674,21 @@ static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt) | |||
672 | if (le16_to_cpu(pkt->hdr.op) == VIRTIO_VSOCK_OP_RST) | 674 | if (le16_to_cpu(pkt->hdr.op) == VIRTIO_VSOCK_OP_RST) |
673 | return 0; | 675 | return 0; |
674 | 676 | ||
675 | pkt = virtio_transport_alloc_pkt(&info, 0, | 677 | reply = virtio_transport_alloc_pkt(&info, 0, |
676 | le64_to_cpu(pkt->hdr.dst_cid), | 678 | le64_to_cpu(pkt->hdr.dst_cid), |
677 | le32_to_cpu(pkt->hdr.dst_port), | 679 | le32_to_cpu(pkt->hdr.dst_port), |
678 | le64_to_cpu(pkt->hdr.src_cid), | 680 | le64_to_cpu(pkt->hdr.src_cid), |
679 | le32_to_cpu(pkt->hdr.src_port)); | 681 | le32_to_cpu(pkt->hdr.src_port)); |
680 | if (!pkt) | 682 | if (!reply) |
681 | return -ENOMEM; | 683 | return -ENOMEM; |
682 | 684 | ||
683 | return virtio_transport_get_ops()->send_pkt(pkt); | 685 | t = virtio_transport_get_ops(); |
686 | if (!t) { | ||
687 | virtio_transport_free_pkt(reply); | ||
688 | return -ENOTCONN; | ||
689 | } | ||
690 | |||
691 | return t->send_pkt(reply); | ||
684 | } | 692 | } |
685 | 693 | ||
686 | static void virtio_transport_wait_close(struct sock *sk, long timeout) | 694 | static void virtio_transport_wait_close(struct sock *sk, long timeout) |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index eff31348e20b..27171ac6fe3b 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -820,8 +820,12 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, | |||
820 | sock->state = SS_CONNECTED; | 820 | sock->state = SS_CONNECTED; |
821 | rc = 0; | 821 | rc = 0; |
822 | out_put_neigh: | 822 | out_put_neigh: |
823 | if (rc) | 823 | if (rc) { |
824 | read_lock_bh(&x25_list_lock); | ||
824 | x25_neigh_put(x25->neighbour); | 825 | x25_neigh_put(x25->neighbour); |
826 | x25->neighbour = NULL; | ||
827 | read_unlock_bh(&x25_list_lock); | ||
828 | } | ||
825 | out_put_route: | 829 | out_put_route: |
826 | x25_route_put(rt); | 830 | x25_route_put(rt); |
827 | out: | 831 | out: |
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 6697084e3fdf..a14e8864e4fa 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c | |||
@@ -407,6 +407,10 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len) | |||
407 | if (sxdp->sxdp_family != AF_XDP) | 407 | if (sxdp->sxdp_family != AF_XDP) |
408 | return -EINVAL; | 408 | return -EINVAL; |
409 | 409 | ||
410 | flags = sxdp->sxdp_flags; | ||
411 | if (flags & ~(XDP_SHARED_UMEM | XDP_COPY | XDP_ZEROCOPY)) | ||
412 | return -EINVAL; | ||
413 | |||
410 | mutex_lock(&xs->mutex); | 414 | mutex_lock(&xs->mutex); |
411 | if (xs->dev) { | 415 | if (xs->dev) { |
412 | err = -EBUSY; | 416 | err = -EBUSY; |
@@ -425,7 +429,6 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len) | |||
425 | } | 429 | } |
426 | 430 | ||
427 | qid = sxdp->sxdp_queue_id; | 431 | qid = sxdp->sxdp_queue_id; |
428 | flags = sxdp->sxdp_flags; | ||
429 | 432 | ||
430 | if (flags & XDP_SHARED_UMEM) { | 433 | if (flags & XDP_SHARED_UMEM) { |
431 | struct xdp_sock *umem_xs; | 434 | struct xdp_sock *umem_xs; |
diff --git a/net/xdp/xsk_diag.c b/net/xdp/xsk_diag.c index 661d007c3b28..d5e06c8e0cbf 100644 --- a/net/xdp/xsk_diag.c +++ b/net/xdp/xsk_diag.c | |||
@@ -68,9 +68,9 @@ static int xsk_diag_put_umem(const struct xdp_sock *xs, struct sk_buff *nlskb) | |||
68 | err = nla_put(nlskb, XDP_DIAG_UMEM, sizeof(du), &du); | 68 | err = nla_put(nlskb, XDP_DIAG_UMEM, sizeof(du), &du); |
69 | 69 | ||
70 | if (!err && umem->fq) | 70 | if (!err && umem->fq) |
71 | err = xsk_diag_put_ring(xs->tx, XDP_DIAG_UMEM_FILL_RING, nlskb); | 71 | err = xsk_diag_put_ring(umem->fq, XDP_DIAG_UMEM_FILL_RING, nlskb); |
72 | if (!err && umem->cq) { | 72 | if (!err && umem->cq) { |
73 | err = xsk_diag_put_ring(xs->tx, XDP_DIAG_UMEM_COMPLETION_RING, | 73 | err = xsk_diag_put_ring(umem->cq, XDP_DIAG_UMEM_COMPLETION_RING, |
74 | nlskb); | 74 | nlskb); |
75 | } | 75 | } |
76 | return err; | 76 | return err; |
diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h index bcb5cbb40419..610c0bdc0c2b 100644 --- a/net/xdp/xsk_queue.h +++ b/net/xdp/xsk_queue.h | |||
@@ -174,8 +174,8 @@ static inline bool xskq_is_valid_desc(struct xsk_queue *q, struct xdp_desc *d) | |||
174 | if (!xskq_is_valid_addr(q, d->addr)) | 174 | if (!xskq_is_valid_addr(q, d->addr)) |
175 | return false; | 175 | return false; |
176 | 176 | ||
177 | if (((d->addr + d->len) & q->chunk_mask) != | 177 | if (((d->addr + d->len) & q->chunk_mask) != (d->addr & q->chunk_mask) || |
178 | (d->addr & q->chunk_mask)) { | 178 | d->options) { |
179 | q->invalid_descs++; | 179 | q->invalid_descs++; |
180 | return false; | 180 | return false; |
181 | } | 181 | } |
diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c index 8408ccb7409f..a79828ab273f 100644 --- a/samples/bpf/hbm.c +++ b/samples/bpf/hbm.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * Default is /hbm1 | 18 | * Default is /hbm1 |
19 | * -r <rate> Rate limit in Mbps | 19 | * -r <rate> Rate limit in Mbps |
20 | * -s Get HBM stats (marked, dropped, etc.) | 20 | * -s Get HBM stats (marked, dropped, etc.) |
21 | * -t <time> Exit after specified seconds (deault is 0) | 21 | * -t <time> Exit after specified seconds (default is 0) |
22 | * -w Work conserving flag. cgroup can increase its bandwidth | 22 | * -w Work conserving flag. cgroup can increase its bandwidth |
23 | * beyond the rate limit specified while there is available | 23 | * beyond the rate limit specified while there is available |
24 | * bandwidth. Current implementation assumes there is only | 24 | * bandwidth. Current implementation assumes there is only |
@@ -376,7 +376,7 @@ static void Usage(void) | |||
376 | " Default is /hbm1\n" | 376 | " Default is /hbm1\n" |
377 | " -r <rate> Rate in Mbps\n" | 377 | " -r <rate> Rate in Mbps\n" |
378 | " -s Update HBM stats\n" | 378 | " -s Update HBM stats\n" |
379 | " -t <time> Exit after specified seconds (deault is 0)\n" | 379 | " -t <time> Exit after specified seconds (default is 0)\n" |
380 | " -w Work conserving flag. cgroup can increase\n" | 380 | " -w Work conserving flag. cgroup can increase\n" |
381 | " bandwidth beyond the rate limit specified\n" | 381 | " bandwidth beyond the rate limit specified\n" |
382 | " while there is available bandwidth. Current\n" | 382 | " while there is available bandwidth. Current\n" |
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index a05c43468bd0..61aaacf0cfa1 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile | |||
@@ -147,7 +147,8 @@ endif | |||
147 | 147 | ||
148 | TARGETS = $(CMD_TARGETS) | 148 | TARGETS = $(CMD_TARGETS) |
149 | 149 | ||
150 | all: fixdep all_cmd | 150 | all: fixdep |
151 | $(Q)$(MAKE) all_cmd | ||
151 | 152 | ||
152 | all_cmd: $(CMD_TARGETS) check | 153 | all_cmd: $(CMD_TARGETS) check |
153 | 154 | ||
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index f5eb60379c8d..d5b830d60601 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c | |||
@@ -838,6 +838,8 @@ static int bpf_object__elf_collect(struct bpf_object *obj, int flags) | |||
838 | if (IS_ERR(obj->btf) || btf__load(obj->btf)) { | 838 | if (IS_ERR(obj->btf) || btf__load(obj->btf)) { |
839 | pr_warning("Error loading ELF section %s: %ld. Ignored and continue.\n", | 839 | pr_warning("Error loading ELF section %s: %ld. Ignored and continue.\n", |
840 | BTF_ELF_SEC, PTR_ERR(obj->btf)); | 840 | BTF_ELF_SEC, PTR_ERR(obj->btf)); |
841 | if (!IS_ERR(obj->btf)) | ||
842 | btf__free(obj->btf); | ||
841 | obj->btf = NULL; | 843 | obj->btf = NULL; |
842 | } | 844 | } |
843 | } else if (strcmp(name, BTF_EXT_ELF_SEC) == 0) { | 845 | } else if (strcmp(name, BTF_EXT_ELF_SEC) == 0) { |
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 518cd587cd63..2aed37ea61a4 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile | |||
@@ -153,6 +153,9 @@ endif | |||
153 | endif | 153 | endif |
154 | endif | 154 | endif |
155 | 155 | ||
156 | TEST_PROGS_CFLAGS := -I. -I$(OUTPUT) | ||
157 | TEST_VERIFIER_CFLAGS := -I. -I$(OUTPUT) -Iverifier | ||
158 | |||
156 | ifneq ($(SUBREG_CODEGEN),) | 159 | ifneq ($(SUBREG_CODEGEN),) |
157 | ALU32_BUILD_DIR = $(OUTPUT)/alu32 | 160 | ALU32_BUILD_DIR = $(OUTPUT)/alu32 |
158 | TEST_CUSTOM_PROGS += $(ALU32_BUILD_DIR)/test_progs_32 | 161 | TEST_CUSTOM_PROGS += $(ALU32_BUILD_DIR)/test_progs_32 |
@@ -162,13 +165,15 @@ $(ALU32_BUILD_DIR): | |||
162 | $(ALU32_BUILD_DIR)/urandom_read: $(OUTPUT)/urandom_read | 165 | $(ALU32_BUILD_DIR)/urandom_read: $(OUTPUT)/urandom_read |
163 | cp $< $@ | 166 | cp $< $@ |
164 | 167 | ||
165 | $(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(ALU32_BUILD_DIR) \ | 168 | $(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(OUTPUT)/libbpf.a\ |
169 | $(ALU32_BUILD_DIR) \ | ||
166 | $(ALU32_BUILD_DIR)/urandom_read | 170 | $(ALU32_BUILD_DIR)/urandom_read |
167 | $(CC) $(CFLAGS) -o $(ALU32_BUILD_DIR)/test_progs_32 $< \ | 171 | $(CC) $(TEST_PROGS_CFLAGS) $(CFLAGS) \ |
168 | trace_helpers.c prog_tests/*.c $(OUTPUT)/libbpf.a $(LDLIBS) | 172 | -o $(ALU32_BUILD_DIR)/test_progs_32 \ |
173 | test_progs.c trace_helpers.c prog_tests/*.c \ | ||
174 | $(OUTPUT)/libbpf.a $(LDLIBS) | ||
169 | 175 | ||
170 | $(ALU32_BUILD_DIR)/test_progs_32: $(PROG_TESTS_H) | 176 | $(ALU32_BUILD_DIR)/test_progs_32: $(PROG_TESTS_H) |
171 | $(ALU32_BUILD_DIR)/test_progs_32: CFLAGS += -I$(OUTPUT) | ||
172 | $(ALU32_BUILD_DIR)/test_progs_32: prog_tests/*.c | 177 | $(ALU32_BUILD_DIR)/test_progs_32: prog_tests/*.c |
173 | 178 | ||
174 | $(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \ | 179 | $(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \ |
@@ -202,12 +207,16 @@ endif | |||
202 | 207 | ||
203 | PROG_TESTS_H := $(OUTPUT)/prog_tests/tests.h | 208 | PROG_TESTS_H := $(OUTPUT)/prog_tests/tests.h |
204 | $(OUTPUT)/test_progs: $(PROG_TESTS_H) | 209 | $(OUTPUT)/test_progs: $(PROG_TESTS_H) |
205 | $(OUTPUT)/test_progs: CFLAGS += -I$(OUTPUT) | 210 | $(OUTPUT)/test_progs: CFLAGS += $(TEST_PROGS_CFLAGS) |
206 | $(OUTPUT)/test_progs: prog_tests/*.c | 211 | $(OUTPUT)/test_progs: prog_tests/*.c |
207 | 212 | ||
213 | PROG_TESTS_DIR = $(OUTPUT)/prog_tests | ||
214 | $(PROG_TESTS_DIR): | ||
215 | mkdir -p $@ | ||
216 | |||
208 | PROG_TESTS_FILES := $(wildcard prog_tests/*.c) | 217 | PROG_TESTS_FILES := $(wildcard prog_tests/*.c) |
209 | $(PROG_TESTS_H): $(PROG_TESTS_FILES) | 218 | $(PROG_TESTS_H): $(PROG_TESTS_DIR) $(PROG_TESTS_FILES) |
210 | $(shell ( cd prog_tests/ | 219 | $(shell ( cd prog_tests/; \ |
211 | echo '/* Generated header, do not edit */'; \ | 220 | echo '/* Generated header, do not edit */'; \ |
212 | echo '#ifdef DECLARE'; \ | 221 | echo '#ifdef DECLARE'; \ |
213 | ls *.c 2> /dev/null | \ | 222 | ls *.c 2> /dev/null | \ |
@@ -221,11 +230,15 @@ $(PROG_TESTS_H): $(PROG_TESTS_FILES) | |||
221 | 230 | ||
222 | VERIFIER_TESTS_H := $(OUTPUT)/verifier/tests.h | 231 | VERIFIER_TESTS_H := $(OUTPUT)/verifier/tests.h |
223 | $(OUTPUT)/test_verifier: $(VERIFIER_TESTS_H) | 232 | $(OUTPUT)/test_verifier: $(VERIFIER_TESTS_H) |
224 | $(OUTPUT)/test_verifier: CFLAGS += -I$(OUTPUT) | 233 | $(OUTPUT)/test_verifier: CFLAGS += $(TEST_VERIFIER_CFLAGS) |
234 | |||
235 | VERIFIER_TESTS_DIR = $(OUTPUT)/verifier | ||
236 | $(VERIFIER_TESTS_DIR): | ||
237 | mkdir -p $@ | ||
225 | 238 | ||
226 | VERIFIER_TEST_FILES := $(wildcard verifier/*.c) | 239 | VERIFIER_TEST_FILES := $(wildcard verifier/*.c) |
227 | $(OUTPUT)/verifier/tests.h: $(VERIFIER_TEST_FILES) | 240 | $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) |
228 | $(shell ( cd verifier/ | 241 | $(shell ( cd verifier/; \ |
229 | echo '/* Generated header, do not edit */'; \ | 242 | echo '/* Generated header, do not edit */'; \ |
230 | echo '#ifdef FILL_ARRAY'; \ | 243 | echo '#ifdef FILL_ARRAY'; \ |
231 | ls *.c 2> /dev/null | \ | 244 | ls *.c 2> /dev/null | \ |
diff --git a/tools/testing/selftests/bpf/prog_tests/signal_pending.c b/tools/testing/selftests/bpf/prog_tests/signal_pending.c index f2a37bbf91ab..996e808f43a2 100644 --- a/tools/testing/selftests/bpf/prog_tests/signal_pending.c +++ b/tools/testing/selftests/bpf/prog_tests/signal_pending.c | |||
@@ -12,7 +12,7 @@ static void test_signal_pending_by_type(enum bpf_prog_type prog_type) | |||
12 | struct itimerval timeo = { | 12 | struct itimerval timeo = { |
13 | .it_value.tv_usec = 100000, /* 100ms */ | 13 | .it_value.tv_usec = 100000, /* 100ms */ |
14 | }; | 14 | }; |
15 | __u32 duration, retval; | 15 | __u32 duration = 0, retval; |
16 | int prog_fd; | 16 | int prog_fd; |
17 | int err; | 17 | int err; |
18 | int i; | 18 | int i; |
diff --git a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh index 612632c1425f..d4d3391cc13a 100755 --- a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh +++ b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh | |||
@@ -78,6 +78,8 @@ TEST_STATUS=0 | |||
78 | TESTS_SUCCEEDED=0 | 78 | TESTS_SUCCEEDED=0 |
79 | TESTS_FAILED=0 | 79 | TESTS_FAILED=0 |
80 | 80 | ||
81 | TMPFILE="" | ||
82 | |||
81 | process_test_results() | 83 | process_test_results() |
82 | { | 84 | { |
83 | if [[ "${TEST_STATUS}" -eq 0 ]] ; then | 85 | if [[ "${TEST_STATUS}" -eq 0 ]] ; then |
@@ -147,7 +149,6 @@ setup() | |||
147 | ip -netns ${NS2} -6 addr add ${IPv6_7}/128 nodad dev veth7 | 149 | ip -netns ${NS2} -6 addr add ${IPv6_7}/128 nodad dev veth7 |
148 | ip -netns ${NS3} -6 addr add ${IPv6_8}/128 nodad dev veth8 | 150 | ip -netns ${NS3} -6 addr add ${IPv6_8}/128 nodad dev veth8 |
149 | 151 | ||
150 | |||
151 | ip -netns ${NS1} link set dev veth1 up | 152 | ip -netns ${NS1} link set dev veth1 up |
152 | ip -netns ${NS2} link set dev veth2 up | 153 | ip -netns ${NS2} link set dev veth2 up |
153 | ip -netns ${NS2} link set dev veth3 up | 154 | ip -netns ${NS2} link set dev veth3 up |
@@ -205,7 +206,7 @@ setup() | |||
205 | # configure IPv4 GRE device in NS3, and a route to it via the "bottom" route | 206 | # configure IPv4 GRE device in NS3, and a route to it via the "bottom" route |
206 | ip -netns ${NS3} tunnel add gre_dev mode gre remote ${IPv4_1} local ${IPv4_GRE} ttl 255 | 207 | ip -netns ${NS3} tunnel add gre_dev mode gre remote ${IPv4_1} local ${IPv4_GRE} ttl 255 |
207 | ip -netns ${NS3} link set gre_dev up | 208 | ip -netns ${NS3} link set gre_dev up |
208 | ip -netns ${NS3} addr add ${IPv4_GRE} nodad dev gre_dev | 209 | ip -netns ${NS3} addr add ${IPv4_GRE} dev gre_dev |
209 | ip -netns ${NS1} route add ${IPv4_GRE}/32 dev veth5 via ${IPv4_6} | 210 | ip -netns ${NS1} route add ${IPv4_GRE}/32 dev veth5 via ${IPv4_6} |
210 | ip -netns ${NS2} route add ${IPv4_GRE}/32 dev veth7 via ${IPv4_8} | 211 | ip -netns ${NS2} route add ${IPv4_GRE}/32 dev veth7 via ${IPv4_8} |
211 | 212 | ||
@@ -222,12 +223,18 @@ setup() | |||
222 | ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0 | 223 | ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0 |
223 | ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0 | 224 | ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0 |
224 | 225 | ||
226 | TMPFILE=$(mktemp /tmp/test_lwt_ip_encap.XXXXXX) | ||
227 | |||
225 | sleep 1 # reduce flakiness | 228 | sleep 1 # reduce flakiness |
226 | set +e | 229 | set +e |
227 | } | 230 | } |
228 | 231 | ||
229 | cleanup() | 232 | cleanup() |
230 | { | 233 | { |
234 | if [ -f ${TMPFILE} ] ; then | ||
235 | rm ${TMPFILE} | ||
236 | fi | ||
237 | |||
231 | ip netns del ${NS1} 2> /dev/null | 238 | ip netns del ${NS1} 2> /dev/null |
232 | ip netns del ${NS2} 2> /dev/null | 239 | ip netns del ${NS2} 2> /dev/null |
233 | ip netns del ${NS3} 2> /dev/null | 240 | ip netns del ${NS3} 2> /dev/null |
@@ -278,6 +285,46 @@ test_ping() | |||
278 | fi | 285 | fi |
279 | } | 286 | } |
280 | 287 | ||
288 | test_gso() | ||
289 | { | ||
290 | local readonly PROTO=$1 | ||
291 | local readonly PKT_SZ=5000 | ||
292 | local IP_DST="" | ||
293 | : > ${TMPFILE} # trim the capture file | ||
294 | |||
295 | # check that nc is present | ||
296 | command -v nc >/dev/null 2>&1 || \ | ||
297 | { echo >&2 "nc is not available: skipping TSO tests"; return; } | ||
298 | |||
299 | # listen on IPv*_DST, capture TCP into $TMPFILE | ||
300 | if [ "${PROTO}" == "IPv4" ] ; then | ||
301 | IP_DST=${IPv4_DST} | ||
302 | ip netns exec ${NS3} bash -c \ | ||
303 | "nc -4 -l -s ${IPv4_DST} -p 9000 > ${TMPFILE} &" | ||
304 | elif [ "${PROTO}" == "IPv6" ] ; then | ||
305 | IP_DST=${IPv6_DST} | ||
306 | ip netns exec ${NS3} bash -c \ | ||
307 | "nc -6 -l -s ${IPv6_DST} -p 9000 > ${TMPFILE} &" | ||
308 | RET=$? | ||
309 | else | ||
310 | echo " test_gso: unknown PROTO: ${PROTO}" | ||
311 | TEST_STATUS=1 | ||
312 | fi | ||
313 | sleep 1 # let nc start listening | ||
314 | |||
315 | # send a packet larger than MTU | ||
316 | ip netns exec ${NS1} bash -c \ | ||
317 | "dd if=/dev/zero bs=$PKT_SZ count=1 > /dev/tcp/${IP_DST}/9000 2>/dev/null" | ||
318 | sleep 2 # let the packet get delivered | ||
319 | |||
320 | # verify we received all expected bytes | ||
321 | SZ=$(stat -c %s ${TMPFILE}) | ||
322 | if [ "$SZ" != "$PKT_SZ" ] ; then | ||
323 | echo " test_gso failed: ${PROTO}" | ||
324 | TEST_STATUS=1 | ||
325 | fi | ||
326 | } | ||
327 | |||
281 | test_egress() | 328 | test_egress() |
282 | { | 329 | { |
283 | local readonly ENCAP=$1 | 330 | local readonly ENCAP=$1 |
@@ -307,6 +354,8 @@ test_egress() | |||
307 | fi | 354 | fi |
308 | test_ping IPv4 0 | 355 | test_ping IPv4 0 |
309 | test_ping IPv6 0 | 356 | test_ping IPv6 0 |
357 | test_gso IPv4 | ||
358 | test_gso IPv6 | ||
310 | 359 | ||
311 | # a negative test: remove routes to GRE devices: ping fails | 360 | # a negative test: remove routes to GRE devices: ping fails |
312 | remove_routes_to_gredev | 361 | remove_routes_to_gredev |
@@ -350,6 +399,7 @@ test_ingress() | |||
350 | ip -netns ${NS2} -6 route add ${IPv6_DST} encap bpf in obj test_lwt_ip_encap.o sec encap_gre6 dev veth2 | 399 | ip -netns ${NS2} -6 route add ${IPv6_DST} encap bpf in obj test_lwt_ip_encap.o sec encap_gre6 dev veth2 |
351 | else | 400 | else |
352 | echo "FAIL: unknown encap ${ENCAP}" | 401 | echo "FAIL: unknown encap ${ENCAP}" |
402 | TEST_STATUS=1 | ||
353 | fi | 403 | fi |
354 | test_ping IPv4 0 | 404 | test_ping IPv4 0 |
355 | test_ping IPv6 0 | 405 | test_ping IPv6 0 |
diff --git a/tools/testing/selftests/bpf/verifier/ld_imm64.c b/tools/testing/selftests/bpf/verifier/ld_imm64.c index 28b8c805a293..3856dba733e9 100644 --- a/tools/testing/selftests/bpf/verifier/ld_imm64.c +++ b/tools/testing/selftests/bpf/verifier/ld_imm64.c | |||
@@ -122,7 +122,7 @@ | |||
122 | .insns = { | 122 | .insns = { |
123 | BPF_MOV64_IMM(BPF_REG_1, 0), | 123 | BPF_MOV64_IMM(BPF_REG_1, 0), |
124 | BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, BPF_REG_1, 0, 1), | 124 | BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, BPF_REG_1, 0, 1), |
125 | BPF_RAW_INSN(0, 0, 0, 0, 1), | 125 | BPF_RAW_INSN(0, 0, 0, 0, 0), |
126 | BPF_EXIT_INSN(), | 126 | BPF_EXIT_INSN(), |
127 | }, | 127 | }, |
128 | .errstr = "not pointing to valid bpf_map", | 128 | .errstr = "not pointing to valid bpf_map", |
@@ -139,3 +139,16 @@ | |||
139 | .errstr = "invalid bpf_ld_imm64 insn", | 139 | .errstr = "invalid bpf_ld_imm64 insn", |
140 | .result = REJECT, | 140 | .result = REJECT, |
141 | }, | 141 | }, |
142 | { | ||
143 | "test14 ld_imm64: reject 2nd imm != 0", | ||
144 | .insns = { | ||
145 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
146 | BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, BPF_REG_1, | ||
147 | BPF_PSEUDO_MAP_FD, 0, 0), | ||
148 | BPF_RAW_INSN(0, 0, 0, 0, 0xfefefe), | ||
149 | BPF_EXIT_INSN(), | ||
150 | }, | ||
151 | .fixup_map_hash_48b = { 1 }, | ||
152 | .errstr = "unrecognized bpf_ld_imm64 insn", | ||
153 | .result = REJECT, | ||
154 | }, | ||