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

Configure Feed

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

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

Pull networking fixes from David Miller:

1) Missing netns pointer init in arp_tables, from Florian Westphal.

2) Fix normal tcp SACK being treated as D-SACK, from Pengcheng Yang.

3) Fix divide by zero in sch_cake, from Wen Yang.

4) Len passed to skb_put_padto() is wrong in qrtr code, from Carl
Huang.

5) cmd->obj.chunk is leaked in sctp code error paths, from Xin Long.

6) cgroup bpf programs can be released out of order, fix from Roman
Gushchin.

7) Make sure stmmac debugfs entry name is changed when device name
changes, from Jiping Ma.

8) Fix memory leak in vlan_dev_set_egress_priority(), from Eric
Dumazet.

9) SKB leak in lan78xx usb driver, also from Eric Dumazet.

10) Ridiculous TCA_FQ_QUANTUM values configured can cause loops in fq
packet scheduler, reject them. From Eric Dumazet.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (69 commits)
tipc: fix wrong connect() return code
tipc: fix link overflow issue at socket shutdown
netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present
netfilter: conntrack: dccp, sctp: handle null timeout argument
atm: eni: fix uninitialized variable warning
macvlan: do not assume mac_header is set in macvlan_broadcast()
net: sch_prio: When ungrafting, replace with FIFO
mlxsw: spectrum_qdisc: Ignore grafting of invisible FIFO
MAINTAINERS: Remove myself as co-maintainer for qcom-ethqos
gtp: fix bad unlock balance in gtp_encap_enable_socket
pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM
tipc: remove meaningless assignment in Makefile
tipc: do not add socket.o to tipc-y twice
net: stmmac: dwmac-sun8i: Allow all RGMII modes
net: stmmac: dwmac-sunxi: Allow all RGMII modes
net: usb: lan78xx: fix possible skb leak
net: stmmac: Fixed link does not need MDIO Bus
vlan: vlan_changelink() should propagate errors
vlan: fix memory leak in vlan_dev_set_egress_priority
stmmac: debugfs entry name is not be changed when udev rename device name.
...

+527 -287
+1 -1
Documentation/networking/ip-sysctl.txt
··· 603 603 with the current initial RTO of 1second. With this the final timeout 604 604 for a passive TCP connection will happen after 63seconds. 605 605 606 - tcp_syncookies - BOOLEAN 606 + tcp_syncookies - INTEGER 607 607 Only valid when the kernel was compiled with CONFIG_SYN_COOKIES 608 608 Send out syncookies when the syn backlog queue of a socket 609 609 overflows. This is to prevent against the common 'SYN flood attack'
+2 -2
Documentation/networking/netdev-FAQ.rst
··· 34 34 mainline tree from Linus, and ``net-next`` is where the new code goes 35 35 for the future release. You can find the trees here: 36 36 37 - - https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 38 - - https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 37 + - https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git 38 + - https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git 39 39 40 40 Q: How often do changes from these trees make it to the mainline Linus tree? 41 41 ----------------------------------------------------------------------------
+5 -8
MAINTAINERS
··· 11460 11460 L: netdev@vger.kernel.org 11461 11461 W: http://www.linuxfoundation.org/en/Net 11462 11462 Q: http://patchwork.ozlabs.org/project/netdev/list/ 11463 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 11464 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 11463 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git 11464 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git 11465 11465 S: Odd Fixes 11466 11466 F: Documentation/devicetree/bindings/net/ 11467 11467 F: drivers/net/ ··· 11502 11502 L: netdev@vger.kernel.org 11503 11503 W: http://www.linuxfoundation.org/en/Net 11504 11504 Q: http://patchwork.ozlabs.org/project/netdev/list/ 11505 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 11506 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 11505 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git 11506 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git 11507 11507 B: mailto:netdev@vger.kernel.org 11508 11508 S: Maintained 11509 11509 F: net/ ··· 11548 11548 M: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 11549 11549 M: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> 11550 11550 L: netdev@vger.kernel.org 11551 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 11551 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git 11552 11552 S: Maintained 11553 11553 F: net/ipv4/ 11554 11554 F: net/ipv6/ ··· 13679 13679 13680 13680 QUALCOMM ETHQOS ETHERNET DRIVER 13681 13681 M: Vinod Koul <vkoul@kernel.org> 13682 - M: Niklas Cassel <niklas.cassel@linaro.org> 13683 13682 L: netdev@vger.kernel.org 13684 13683 S: Maintained 13685 13684 F: drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c ··· 14548 14549 14549 14550 SAMSUNG SXGBE DRIVERS 14550 14551 M: Byungho An <bh74.an@samsung.com> 14551 - M: Girish K S <ks.giri@samsung.com> 14552 - M: Vipul Pandya <vipul.pandya@samsung.com> 14553 14552 S: Supported 14554 14553 L: netdev@vger.kernel.org 14555 14554 F: drivers/net/ethernet/samsung/sxgbe/
+2 -2
drivers/atm/eni.c
··· 374 374 here = (eni_vcc->descr+skip) & (eni_vcc->words-1); 375 375 dma[j++] = (here << MID_DMA_COUNT_SHIFT) | (vcc->vci 376 376 << MID_DMA_VCI_SHIFT) | MID_DT_JK; 377 - j++; 377 + dma[j++] = 0; 378 378 } 379 379 here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1); 380 380 if (!eff) size += skip; ··· 447 447 if (size != eff) { 448 448 dma[j++] = (here << MID_DMA_COUNT_SHIFT) | 449 449 (vcc->vci << MID_DMA_VCI_SHIFT) | MID_DT_JK; 450 - j++; 450 + dma[j++] = 0; 451 451 } 452 452 if (!j || j > 2*RX_DMA_BUF) { 453 453 printk(KERN_CRIT DEV_LABEL "!j or j too big!!!\n");
-1
drivers/firmware/broadcom/tee_bnxt_fw.c
··· 215 215 fw_shm_pool = tee_shm_alloc(pvt_data.ctx, MAX_SHM_MEM_SZ, 216 216 TEE_SHM_MAPPED | TEE_SHM_DMA_BUF); 217 217 if (IS_ERR(fw_shm_pool)) { 218 - tee_client_close_context(pvt_data.ctx); 219 218 dev_err(pvt_data.dev, "tee_shm_alloc failed\n"); 220 219 err = PTR_ERR(fw_shm_pool); 221 220 goto out_sess;
+53 -10
drivers/net/can/m_can/tcan4x5x.c
··· 102 102 #define TCAN4X5X_MODE_NORMAL BIT(7) 103 103 104 104 #define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30)) 105 + #define TCAN4X5X_DISABLE_INH_MSK BIT(9) 105 106 106 107 #define TCAN4X5X_SW_RESET BIT(2) 107 108 ··· 165 164 usleep_range(5, 50); 166 165 gpiod_set_value(priv->device_wake_gpio, 1); 167 166 } 167 + } 168 + 169 + static int tcan4x5x_reset(struct tcan4x5x_priv *priv) 170 + { 171 + int ret = 0; 172 + 173 + if (priv->reset_gpio) { 174 + gpiod_set_value(priv->reset_gpio, 1); 175 + 176 + /* tpulse_width minimum 30us */ 177 + usleep_range(30, 100); 178 + gpiod_set_value(priv->reset_gpio, 0); 179 + } else { 180 + ret = regmap_write(priv->regmap, TCAN4X5X_CONFIG, 181 + TCAN4X5X_SW_RESET); 182 + if (ret) 183 + return ret; 184 + } 185 + 186 + usleep_range(700, 1000); 187 + 188 + return ret; 168 189 } 169 190 170 191 static int regmap_spi_gather_write(void *context, const void *reg, ··· 371 348 TCAN4X5X_DISABLE_WAKE_MSK, 0x00); 372 349 } 373 350 351 + static int tcan4x5x_disable_state(struct m_can_classdev *cdev) 352 + { 353 + struct tcan4x5x_priv *tcan4x5x = cdev->device_data; 354 + 355 + return regmap_update_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG, 356 + TCAN4X5X_DISABLE_INH_MSK, 0x01); 357 + } 358 + 374 359 static int tcan4x5x_parse_config(struct m_can_classdev *cdev) 375 360 { 376 361 struct tcan4x5x_priv *tcan4x5x = cdev->device_data; 362 + int ret; 377 363 378 364 tcan4x5x->device_wake_gpio = devm_gpiod_get(cdev->dev, "device-wake", 379 365 GPIOD_OUT_HIGH); 380 366 if (IS_ERR(tcan4x5x->device_wake_gpio)) { 381 - if (PTR_ERR(tcan4x5x->power) == -EPROBE_DEFER) 367 + if (PTR_ERR(tcan4x5x->device_wake_gpio) == -EPROBE_DEFER) 382 368 return -EPROBE_DEFER; 383 369 384 370 tcan4x5x_disable_wake(cdev); ··· 398 366 if (IS_ERR(tcan4x5x->reset_gpio)) 399 367 tcan4x5x->reset_gpio = NULL; 400 368 401 - usleep_range(700, 1000); 369 + ret = tcan4x5x_reset(tcan4x5x); 370 + if (ret) 371 + return ret; 402 372 403 373 tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, 404 374 "device-state", 405 375 GPIOD_IN); 406 - if (IS_ERR(tcan4x5x->device_state_gpio)) 376 + if (IS_ERR(tcan4x5x->device_state_gpio)) { 407 377 tcan4x5x->device_state_gpio = NULL; 408 - 409 - tcan4x5x->power = devm_regulator_get_optional(cdev->dev, 410 - "vsup"); 411 - if (PTR_ERR(tcan4x5x->power) == -EPROBE_DEFER) 412 - return -EPROBE_DEFER; 378 + tcan4x5x_disable_state(cdev); 379 + } 413 380 414 381 return 0; 415 382 } ··· 442 411 priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); 443 412 if (!priv) 444 413 return -ENOMEM; 414 + 415 + priv->power = devm_regulator_get_optional(&spi->dev, "vsup"); 416 + if (PTR_ERR(priv->power) == -EPROBE_DEFER) 417 + return -EPROBE_DEFER; 418 + else 419 + priv->power = NULL; 445 420 446 421 mcan_class->device_data = priv; 447 422 ··· 488 451 priv->regmap = devm_regmap_init(&spi->dev, &tcan4x5x_bus, 489 452 &spi->dev, &tcan4x5x_regmap); 490 453 491 - ret = tcan4x5x_parse_config(mcan_class); 454 + ret = tcan4x5x_power_enable(priv->power, 1); 492 455 if (ret) 493 456 goto out_clk; 494 457 495 - tcan4x5x_power_enable(priv->power, 1); 458 + ret = tcan4x5x_parse_config(mcan_class); 459 + if (ret) 460 + goto out_power; 461 + 462 + ret = tcan4x5x_init(mcan_class); 463 + if (ret) 464 + goto out_power; 496 465 497 466 ret = m_can_class_register(mcan_class); 498 467 if (ret)
+10 -11
drivers/net/can/mscan/mscan.c
··· 381 381 struct net_device *dev = napi->dev; 382 382 struct mscan_regs __iomem *regs = priv->reg_base; 383 383 struct net_device_stats *stats = &dev->stats; 384 - int npackets = 0; 385 - int ret = 1; 384 + int work_done = 0; 386 385 struct sk_buff *skb; 387 386 struct can_frame *frame; 388 387 u8 canrflg; 389 388 390 - while (npackets < quota) { 389 + while (work_done < quota) { 391 390 canrflg = in_8(&regs->canrflg); 392 391 if (!(canrflg & (MSCAN_RXF | MSCAN_ERR_IF))) 393 392 break; ··· 407 408 408 409 stats->rx_packets++; 409 410 stats->rx_bytes += frame->can_dlc; 410 - npackets++; 411 + work_done++; 411 412 netif_receive_skb(skb); 412 413 } 413 414 414 - if (!(in_8(&regs->canrflg) & (MSCAN_RXF | MSCAN_ERR_IF))) { 415 - napi_complete(&priv->napi); 416 - clear_bit(F_RX_PROGRESS, &priv->flags); 417 - if (priv->can.state < CAN_STATE_BUS_OFF) 418 - out_8(&regs->canrier, priv->shadow_canrier); 419 - ret = 0; 415 + if (work_done < quota) { 416 + if (likely(napi_complete_done(&priv->napi, work_done))) { 417 + clear_bit(F_RX_PROGRESS, &priv->flags); 418 + if (priv->can.state < CAN_STATE_BUS_OFF) 419 + out_8(&regs->canrier, priv->shadow_canrier); 420 + } 420 421 } 421 - return ret; 422 + return work_done; 422 423 } 423 424 424 425 static irqreturn_t mscan_isr(int irq, void *dev_id)
+2 -2
drivers/net/can/usb/gs_usb.c
··· 918 918 GS_USB_BREQ_HOST_FORMAT, 919 919 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 920 920 1, 921 - intf->altsetting[0].desc.bInterfaceNumber, 921 + intf->cur_altsetting->desc.bInterfaceNumber, 922 922 hconf, 923 923 sizeof(*hconf), 924 924 1000); ··· 941 941 GS_USB_BREQ_DEVICE_CONFIG, 942 942 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 943 943 1, 944 - intf->altsetting[0].desc.bInterfaceNumber, 944 + intf->cur_altsetting->desc.bInterfaceNumber, 945 945 dconf, 946 946 sizeof(*dconf), 947 947 1000);
+1 -1
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
··· 1590 1590 struct usb_endpoint_descriptor *ep; 1591 1591 int i; 1592 1592 1593 - iface_desc = &dev->intf->altsetting[0]; 1593 + iface_desc = dev->intf->cur_altsetting; 1594 1594 1595 1595 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { 1596 1596 ep = &iface_desc->endpoint[i].desc;
+1 -1
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
··· 1310 1310 struct usb_endpoint_descriptor *endpoint; 1311 1311 int i; 1312 1312 1313 - iface_desc = &dev->intf->altsetting[0]; 1313 + iface_desc = dev->intf->cur_altsetting; 1314 1314 1315 1315 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { 1316 1316 endpoint = &iface_desc->endpoint[i].desc;
+5
drivers/net/dsa/mv88e6xxx/global1.c
··· 360 360 { 361 361 u16 ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST; 362 362 363 + /* Use the default high priority for management frames sent to 364 + * the CPU. 365 + */ 366 + port |= MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST_MGMTPRI; 367 + 363 368 return mv88e6390_g1_monitor_write(chip, ptr, port); 364 369 } 365 370
+1
drivers/net/dsa/mv88e6xxx/global1.h
··· 211 211 #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_INGRESS_DEST 0x2000 212 212 #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_EGRESS_DEST 0x2100 213 213 #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST 0x3000 214 + #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST_MGMTPRI 0x00e0 214 215 #define MV88E6390_G1_MONITOR_MGMT_CTL_DATA_MASK 0x00ff 215 216 216 217 /* Offset 0x1C: Global Control 2 */
+6 -6
drivers/net/dsa/mv88e6xxx/port.c
··· 393 393 } 394 394 395 395 static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, 396 - phy_interface_t mode) 396 + phy_interface_t mode, bool force) 397 397 { 398 398 u8 lane; 399 399 u16 cmode; ··· 427 427 cmode = 0; 428 428 } 429 429 430 - /* cmode doesn't change, nothing to do for us */ 431 - if (cmode == chip->ports[port].cmode) 430 + /* cmode doesn't change, nothing to do for us unless forced */ 431 + if (cmode == chip->ports[port].cmode && !force) 432 432 return 0; 433 433 434 434 lane = mv88e6xxx_serdes_get_lane(chip, port); ··· 484 484 if (port != 9 && port != 10) 485 485 return -EOPNOTSUPP; 486 486 487 - return mv88e6xxx_port_set_cmode(chip, port, mode); 487 + return mv88e6xxx_port_set_cmode(chip, port, mode, false); 488 488 } 489 489 490 490 int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port, ··· 504 504 break; 505 505 } 506 506 507 - return mv88e6xxx_port_set_cmode(chip, port, mode); 507 + return mv88e6xxx_port_set_cmode(chip, port, mode, false); 508 508 } 509 509 510 510 static int mv88e6341_port_set_cmode_writable(struct mv88e6xxx_chip *chip, ··· 555 555 if (err) 556 556 return err; 557 557 558 - return mv88e6xxx_port_set_cmode(chip, port, mode); 558 + return mv88e6xxx_port_set_cmode(chip, port, mode, true); 559 559 } 560 560 561 561 int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode)
+2 -2
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
··· 403 403 if (err < 0) 404 404 goto err_exit; 405 405 406 + aq_nic_set_loopback(self); 407 + 406 408 err = self->aq_hw_ops->hw_start(self->aq_hw); 407 409 if (err < 0) 408 410 goto err_exit; ··· 414 412 goto err_exit; 415 413 416 414 INIT_WORK(&self->service_task, aq_nic_service_task); 417 - 418 - aq_nic_set_loopback(self); 419 415 420 416 timer_setup(&self->service_timer, aq_nic_service_timer_cb, 0); 421 417 aq_nic_service_timer_cb(&self->service_timer);
-3
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
··· 1525 1525 .rx_extract_ts = hw_atl_b0_rx_extract_ts, 1526 1526 .extract_hwts = hw_atl_b0_extract_hwts, 1527 1527 .hw_set_offload = hw_atl_b0_hw_offload_set, 1528 - .hw_get_hw_stats = hw_atl_utils_get_hw_stats, 1529 - .hw_get_fw_version = hw_atl_utils_get_fw_version, 1530 - .hw_set_offload = hw_atl_b0_hw_offload_set, 1531 1528 .hw_set_loopback = hw_atl_b0_set_loopback, 1532 1529 .hw_set_fc = hw_atl_b0_set_fc, 1533 1530 };
+1 -3
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
··· 667 667 u32 speed; 668 668 669 669 mpi_state = hw_atl_utils_mpi_get_state(self); 670 - speed = mpi_state & (FW2X_RATE_100M | FW2X_RATE_1G | 671 - FW2X_RATE_2G5 | FW2X_RATE_5G | 672 - FW2X_RATE_10G); 670 + speed = mpi_state >> HW_ATL_MPI_SPEED_SHIFT; 673 671 674 672 if (!speed) { 675 673 link_status->mbps = 0U;
+6 -3
drivers/net/ethernet/broadcom/b44.c
··· 1516 1516 int ethaddr_bytes = ETH_ALEN; 1517 1517 1518 1518 memset(ppattern + offset, 0xff, magicsync); 1519 - for (j = 0; j < magicsync; j++) 1520 - set_bit(len++, (unsigned long *) pmask); 1519 + for (j = 0; j < magicsync; j++) { 1520 + pmask[len >> 3] |= BIT(len & 7); 1521 + len++; 1522 + } 1521 1523 1522 1524 for (j = 0; j < B44_MAX_PATTERNS; j++) { 1523 1525 if ((B44_PATTERN_SIZE - len) >= ETH_ALEN) ··· 1531 1529 for (k = 0; k< ethaddr_bytes; k++) { 1532 1530 ppattern[offset + magicsync + 1533 1531 (j * ETH_ALEN) + k] = macaddr[k]; 1534 - set_bit(len++, (unsigned long *) pmask); 1532 + pmask[len >> 3] |= BIT(len & 7); 1533 + len++; 1535 1534 } 1536 1535 } 1537 1536 return len - 1;
+1 -3
drivers/net/ethernet/cadence/macb_main.c
··· 4088 4088 mgmt->rate = 0; 4089 4089 mgmt->hw.init = &init; 4090 4090 4091 - *tx_clk = clk_register(NULL, &mgmt->hw); 4091 + *tx_clk = devm_clk_register(&pdev->dev, &mgmt->hw); 4092 4092 if (IS_ERR(*tx_clk)) 4093 4093 return PTR_ERR(*tx_clk); 4094 4094 ··· 4416 4416 4417 4417 err_disable_clocks: 4418 4418 clk_disable_unprepare(tx_clk); 4419 - clk_unregister(tx_clk); 4420 4419 clk_disable_unprepare(hclk); 4421 4420 clk_disable_unprepare(pclk); 4422 4421 clk_disable_unprepare(rx_clk); ··· 4445 4446 pm_runtime_dont_use_autosuspend(&pdev->dev); 4446 4447 if (!pm_runtime_suspended(&pdev->dev)) { 4447 4448 clk_disable_unprepare(bp->tx_clk); 4448 - clk_unregister(bp->tx_clk); 4449 4449 clk_disable_unprepare(bp->hclk); 4450 4450 clk_disable_unprepare(bp->pclk); 4451 4451 clk_disable_unprepare(bp->rx_clk);
+9
drivers/net/ethernet/freescale/fec_main.c
··· 2199 2199 { 2200 2200 struct fec_enet_private *fep = netdev_priv(ndev); 2201 2201 u32 __iomem *theregs = (u32 __iomem *)fep->hwp; 2202 + struct device *dev = &fep->pdev->dev; 2202 2203 u32 *buf = (u32 *)regbuf; 2203 2204 u32 i, off; 2205 + int ret; 2206 + 2207 + ret = pm_runtime_get_sync(dev); 2208 + if (ret < 0) 2209 + return; 2204 2210 2205 2211 regs->version = fec_enet_register_version; 2206 2212 ··· 2222 2216 off >>= 2; 2223 2217 buf[off] = readl(&theregs[off]); 2224 2218 } 2219 + 2220 + pm_runtime_mark_last_busy(dev); 2221 + pm_runtime_put_autosuspend(dev); 2225 2222 } 2226 2223 2227 2224 static int fec_enet_get_ts_info(struct net_device *ndev,
-2
drivers/net/ethernet/google/gve/gve_rx.c
··· 418 418 rx->cnt = cnt; 419 419 rx->fill_cnt += work_done; 420 420 421 - /* restock desc ring slots */ 422 - dma_wmb(); /* Ensure descs are visible before ringing doorbell */ 423 421 gve_rx_write_doorbell(priv, rx); 424 422 return gve_rx_work_pending(rx); 425 423 }
-6
drivers/net/ethernet/google/gve/gve_tx.c
··· 487 487 * may have added descriptors without ringing the doorbell. 488 488 */ 489 489 490 - /* Ensure tx descs from a prior gve_tx are visible before 491 - * ringing doorbell. 492 - */ 493 - dma_wmb(); 494 490 gve_tx_put_doorbell(priv, tx->q_resources, tx->req); 495 491 return NETDEV_TX_BUSY; 496 492 } ··· 501 505 if (!netif_xmit_stopped(tx->netdev_txq) && netdev_xmit_more()) 502 506 return NETDEV_TX_OK; 503 507 504 - /* Ensure tx descs are visible before ringing doorbell */ 505 - dma_wmb(); 506 508 gve_tx_put_doorbell(priv, tx->q_resources, tx->req); 507 509 return NETDEV_TX_OK; 508 510 }
+16
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
··· 122 122 #endif 123 123 }; 124 124 125 + #define MLX5E_TTC_NUM_GROUPS 3 126 + #define MLX5E_TTC_GROUP1_SIZE (BIT(3) + MLX5E_NUM_TUNNEL_TT) 127 + #define MLX5E_TTC_GROUP2_SIZE BIT(1) 128 + #define MLX5E_TTC_GROUP3_SIZE BIT(0) 129 + #define MLX5E_TTC_TABLE_SIZE (MLX5E_TTC_GROUP1_SIZE +\ 130 + MLX5E_TTC_GROUP2_SIZE +\ 131 + MLX5E_TTC_GROUP3_SIZE) 132 + 133 + #define MLX5E_INNER_TTC_NUM_GROUPS 3 134 + #define MLX5E_INNER_TTC_GROUP1_SIZE BIT(3) 135 + #define MLX5E_INNER_TTC_GROUP2_SIZE BIT(1) 136 + #define MLX5E_INNER_TTC_GROUP3_SIZE BIT(0) 137 + #define MLX5E_INNER_TTC_TABLE_SIZE (MLX5E_INNER_TTC_GROUP1_SIZE +\ 138 + MLX5E_INNER_TTC_GROUP2_SIZE +\ 139 + MLX5E_INNER_TTC_GROUP3_SIZE) 140 + 125 141 #ifdef CONFIG_MLX5_EN_RXNFC 126 142 127 143 struct mlx5e_ethtool_table {
+4 -3
drivers/net/ethernet/mellanox/mlx5/core/en/health.c
··· 197 197 struct devlink_health_reporter *reporter, char *err_str, 198 198 struct mlx5e_err_ctx *err_ctx) 199 199 { 200 - if (!reporter) { 201 - netdev_err(priv->netdev, err_str); 200 + netdev_err(priv->netdev, err_str); 201 + 202 + if (!reporter) 202 203 return err_ctx->recover(&err_ctx->ctx); 203 - } 204 + 204 205 return devlink_health_report(reporter, err_str, err_ctx); 205 206 }
-16
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
··· 904 904 return err; 905 905 } 906 906 907 - #define MLX5E_TTC_NUM_GROUPS 3 908 - #define MLX5E_TTC_GROUP1_SIZE (BIT(3) + MLX5E_NUM_TUNNEL_TT) 909 - #define MLX5E_TTC_GROUP2_SIZE BIT(1) 910 - #define MLX5E_TTC_GROUP3_SIZE BIT(0) 911 - #define MLX5E_TTC_TABLE_SIZE (MLX5E_TTC_GROUP1_SIZE +\ 912 - MLX5E_TTC_GROUP2_SIZE +\ 913 - MLX5E_TTC_GROUP3_SIZE) 914 - 915 - #define MLX5E_INNER_TTC_NUM_GROUPS 3 916 - #define MLX5E_INNER_TTC_GROUP1_SIZE BIT(3) 917 - #define MLX5E_INNER_TTC_GROUP2_SIZE BIT(1) 918 - #define MLX5E_INNER_TTC_GROUP3_SIZE BIT(0) 919 - #define MLX5E_INNER_TTC_TABLE_SIZE (MLX5E_INNER_TTC_GROUP1_SIZE +\ 920 - MLX5E_INNER_TTC_GROUP2_SIZE +\ 921 - MLX5E_INNER_TTC_GROUP3_SIZE) 922 - 923 907 static int mlx5e_create_ttc_table_groups(struct mlx5e_ttc_table *ttc, 924 908 bool use_ipv) 925 909 {
+58 -2
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 592 592 for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) 593 593 ttc_params->indir_tirn[tt] = hp->indir_tirn[tt]; 594 594 595 - ft_attr->max_fte = MLX5E_NUM_TT; 595 + ft_attr->max_fte = MLX5E_TTC_TABLE_SIZE; 596 596 ft_attr->level = MLX5E_TC_TTC_FT_LEVEL; 597 597 ft_attr->prio = MLX5E_TC_PRIO; 598 598 } ··· 2999 2999 return kmemdup(tun_info, tun_size, GFP_KERNEL); 3000 3000 } 3001 3001 3002 + static bool is_duplicated_encap_entry(struct mlx5e_priv *priv, 3003 + struct mlx5e_tc_flow *flow, 3004 + int out_index, 3005 + struct mlx5e_encap_entry *e, 3006 + struct netlink_ext_ack *extack) 3007 + { 3008 + int i; 3009 + 3010 + for (i = 0; i < out_index; i++) { 3011 + if (flow->encaps[i].e != e) 3012 + continue; 3013 + NL_SET_ERR_MSG_MOD(extack, "can't duplicate encap action"); 3014 + netdev_err(priv->netdev, "can't duplicate encap action\n"); 3015 + return true; 3016 + } 3017 + 3018 + return false; 3019 + } 3020 + 3002 3021 static int mlx5e_attach_encap(struct mlx5e_priv *priv, 3003 3022 struct mlx5e_tc_flow *flow, 3004 3023 struct net_device *mirred_dev, ··· 3053 3034 3054 3035 /* must verify if encap is valid or not */ 3055 3036 if (e) { 3037 + /* Check that entry was not already attached to this flow */ 3038 + if (is_duplicated_encap_entry(priv, flow, out_index, e, extack)) { 3039 + err = -EOPNOTSUPP; 3040 + goto out_err; 3041 + } 3042 + 3056 3043 mutex_unlock(&esw->offloads.encap_tbl_lock); 3057 3044 wait_for_completion(&e->res_ready); 3058 3045 ··· 3245 3220 same_hw_devs(priv, netdev_priv(out_dev)); 3246 3221 } 3247 3222 3223 + static bool is_duplicated_output_device(struct net_device *dev, 3224 + struct net_device *out_dev, 3225 + int *ifindexes, int if_count, 3226 + struct netlink_ext_ack *extack) 3227 + { 3228 + int i; 3229 + 3230 + for (i = 0; i < if_count; i++) { 3231 + if (ifindexes[i] == out_dev->ifindex) { 3232 + NL_SET_ERR_MSG_MOD(extack, 3233 + "can't duplicate output to same device"); 3234 + netdev_err(dev, "can't duplicate output to same device: %s\n", 3235 + out_dev->name); 3236 + return true; 3237 + } 3238 + } 3239 + 3240 + return false; 3241 + } 3242 + 3248 3243 static int parse_tc_fdb_actions(struct mlx5e_priv *priv, 3249 3244 struct flow_action *flow_action, 3250 3245 struct mlx5e_tc_flow *flow, ··· 3276 3231 struct mlx5e_tc_flow_parse_attr *parse_attr = attr->parse_attr; 3277 3232 struct mlx5e_rep_priv *rpriv = priv->ppriv; 3278 3233 const struct ip_tunnel_info *info = NULL; 3234 + int ifindexes[MLX5_MAX_FLOW_FWD_VPORTS]; 3279 3235 bool ft_flow = mlx5e_is_ft_flow(flow); 3280 3236 const struct flow_action_entry *act; 3237 + int err, i, if_count = 0; 3281 3238 bool encap = false; 3282 3239 u32 action = 0; 3283 - int err, i; 3284 3240 3285 3241 if (!flow_action_has_entries(flow_action)) 3286 3242 return -EINVAL; ··· 3357 3311 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; 3358 3312 struct net_device *uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH); 3359 3313 struct net_device *uplink_upper; 3314 + 3315 + if (is_duplicated_output_device(priv->netdev, 3316 + out_dev, 3317 + ifindexes, 3318 + if_count, 3319 + extack)) 3320 + return -EOPNOTSUPP; 3321 + 3322 + ifindexes[if_count] = out_dev->ifindex; 3323 + if_count++; 3360 3324 3361 3325 rcu_read_lock(); 3362 3326 uplink_upper =
+27 -67
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
··· 531 531 } 532 532 } 533 533 534 - static void del_sw_fte_rcu(struct rcu_head *head) 535 - { 536 - struct fs_fte *fte = container_of(head, struct fs_fte, rcu); 537 - struct mlx5_flow_steering *steering = get_steering(&fte->node); 538 - 539 - kmem_cache_free(steering->ftes_cache, fte); 540 - } 541 - 542 534 static void del_sw_fte(struct fs_node *node) 543 535 { 536 + struct mlx5_flow_steering *steering = get_steering(node); 544 537 struct mlx5_flow_group *fg; 545 538 struct fs_fte *fte; 546 539 int err; ··· 546 553 rhash_fte); 547 554 WARN_ON(err); 548 555 ida_simple_remove(&fg->fte_allocator, fte->index - fg->start_index); 549 - 550 - call_rcu(&fte->rcu, del_sw_fte_rcu); 556 + kmem_cache_free(steering->ftes_cache, fte); 551 557 } 552 558 553 559 static void del_hw_flow_group(struct fs_node *node) ··· 1625 1633 } 1626 1634 1627 1635 static struct fs_fte * 1628 - lookup_fte_for_write_locked(struct mlx5_flow_group *g, const u32 *match_value) 1636 + lookup_fte_locked(struct mlx5_flow_group *g, 1637 + const u32 *match_value, 1638 + bool take_write) 1629 1639 { 1630 1640 struct fs_fte *fte_tmp; 1631 1641 1632 - nested_down_write_ref_node(&g->node, FS_LOCK_PARENT); 1633 - 1634 - fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, match_value, rhash_fte); 1635 - if (!fte_tmp || !tree_get_node(&fte_tmp->node)) { 1636 - fte_tmp = NULL; 1637 - goto out; 1638 - } 1639 - 1640 - if (!fte_tmp->node.active) { 1641 - tree_put_node(&fte_tmp->node, false); 1642 - fte_tmp = NULL; 1643 - goto out; 1644 - } 1645 - nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD); 1646 - 1647 - out: 1648 - up_write_ref_node(&g->node, false); 1649 - return fte_tmp; 1650 - } 1651 - 1652 - static struct fs_fte * 1653 - lookup_fte_for_read_locked(struct mlx5_flow_group *g, const u32 *match_value) 1654 - { 1655 - struct fs_fte *fte_tmp; 1656 - 1657 - if (!tree_get_node(&g->node)) 1658 - return NULL; 1659 - 1660 - rcu_read_lock(); 1661 - fte_tmp = rhashtable_lookup(&g->ftes_hash, match_value, rhash_fte); 1662 - if (!fte_tmp || !tree_get_node(&fte_tmp->node)) { 1663 - rcu_read_unlock(); 1664 - fte_tmp = NULL; 1665 - goto out; 1666 - } 1667 - rcu_read_unlock(); 1668 - 1669 - if (!fte_tmp->node.active) { 1670 - tree_put_node(&fte_tmp->node, false); 1671 - fte_tmp = NULL; 1672 - goto out; 1673 - } 1674 - 1675 - nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD); 1676 - 1677 - out: 1678 - tree_put_node(&g->node, false); 1679 - return fte_tmp; 1680 - } 1681 - 1682 - static struct fs_fte * 1683 - lookup_fte_locked(struct mlx5_flow_group *g, const u32 *match_value, bool write) 1684 - { 1685 - if (write) 1686 - return lookup_fte_for_write_locked(g, match_value); 1642 + if (take_write) 1643 + nested_down_write_ref_node(&g->node, FS_LOCK_PARENT); 1687 1644 else 1688 - return lookup_fte_for_read_locked(g, match_value); 1645 + nested_down_read_ref_node(&g->node, FS_LOCK_PARENT); 1646 + fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, match_value, 1647 + rhash_fte); 1648 + if (!fte_tmp || !tree_get_node(&fte_tmp->node)) { 1649 + fte_tmp = NULL; 1650 + goto out; 1651 + } 1652 + if (!fte_tmp->node.active) { 1653 + tree_put_node(&fte_tmp->node, false); 1654 + fte_tmp = NULL; 1655 + goto out; 1656 + } 1657 + 1658 + nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD); 1659 + out: 1660 + if (take_write) 1661 + up_write_ref_node(&g->node, false); 1662 + else 1663 + up_read_ref_node(&g->node); 1664 + return fte_tmp; 1689 1665 } 1690 1666 1691 1667 static struct mlx5_flow_handle *
-1
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
··· 203 203 enum fs_fte_status status; 204 204 struct mlx5_fc *counter; 205 205 struct rhash_head hash; 206 - struct rcu_head rcu; 207 206 int modify_mask; 208 207 }; 209 208
+9 -7
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 1193 1193 if (err) 1194 1194 goto err_load; 1195 1195 1196 + if (boot) { 1197 + err = mlx5_devlink_register(priv_to_devlink(dev), dev->device); 1198 + if (err) 1199 + goto err_devlink_reg; 1200 + } 1201 + 1196 1202 if (mlx5_device_registered(dev)) { 1197 1203 mlx5_attach_device(dev); 1198 1204 } else { ··· 1216 1210 return err; 1217 1211 1218 1212 err_reg_dev: 1213 + if (boot) 1214 + mlx5_devlink_unregister(priv_to_devlink(dev)); 1215 + err_devlink_reg: 1219 1216 mlx5_unload(dev); 1220 1217 err_load: 1221 1218 if (boot) ··· 1356 1347 1357 1348 request_module_nowait(MLX5_IB_MOD); 1358 1349 1359 - err = mlx5_devlink_register(devlink, &pdev->dev); 1360 - if (err) 1361 - goto clean_load; 1362 - 1363 1350 err = mlx5_crdump_enable(dev); 1364 1351 if (err) 1365 1352 dev_err(&pdev->dev, "mlx5_crdump_enable failed with error code %d\n", err); 1366 1353 1367 1354 pci_save_state(pdev); 1368 1355 return 0; 1369 - 1370 - clean_load: 1371 - mlx5_unload_one(dev, true); 1372 1356 1373 1357 err_load_one: 1374 1358 mlx5_pci_close(dev);
+4 -1
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
··· 209 209 /* We need to copy the refcount since this ste 210 210 * may have been traversed several times 211 211 */ 212 - refcount_set(&new_ste->refcount, refcount_read(&cur_ste->refcount)); 212 + new_ste->refcount = cur_ste->refcount; 213 213 214 214 /* Link old STEs rule_mem list to the new ste */ 215 215 mlx5dr_rule_update_rule_member(cur_ste, new_ste); ··· 637 637 rule_mem = kvzalloc(sizeof(*rule_mem), GFP_KERNEL); 638 638 if (!rule_mem) 639 639 return -ENOMEM; 640 + 641 + INIT_LIST_HEAD(&rule_mem->list); 642 + INIT_LIST_HEAD(&rule_mem->use_ste_list); 640 643 641 644 rule_mem->ste = ste; 642 645 list_add_tail(&rule_mem->list, &nic_rule->rule_members_list);
+5 -5
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
··· 348 348 if (dst->next_htbl) 349 349 dst->next_htbl->pointing_ste = dst; 350 350 351 - refcount_set(&dst->refcount, refcount_read(&src->refcount)); 351 + dst->refcount = src->refcount; 352 352 353 353 INIT_LIST_HEAD(&dst->rule_list); 354 354 list_splice_tail_init(&src->rule_list, &dst->rule_list); ··· 565 565 566 566 bool mlx5dr_ste_not_used_ste(struct mlx5dr_ste *ste) 567 567 { 568 - return !refcount_read(&ste->refcount); 568 + return !ste->refcount; 569 569 } 570 570 571 571 /* Init one ste as a pattern for ste data array */ ··· 689 689 htbl->ste_arr = chunk->ste_arr; 690 690 htbl->hw_ste_arr = chunk->hw_ste_arr; 691 691 htbl->miss_list = chunk->miss_list; 692 - refcount_set(&htbl->refcount, 0); 692 + htbl->refcount = 0; 693 693 694 694 for (i = 0; i < chunk->num_of_entries; i++) { 695 695 struct mlx5dr_ste *ste = &htbl->ste_arr[i]; 696 696 697 697 ste->hw_ste = htbl->hw_ste_arr + i * DR_STE_SIZE_REDUCED; 698 698 ste->htbl = htbl; 699 - refcount_set(&ste->refcount, 0); 699 + ste->refcount = 0; 700 700 INIT_LIST_HEAD(&ste->miss_list_node); 701 701 INIT_LIST_HEAD(&htbl->miss_list[i]); 702 702 INIT_LIST_HEAD(&ste->rule_list); ··· 713 713 714 714 int mlx5dr_ste_htbl_free(struct mlx5dr_ste_htbl *htbl) 715 715 { 716 - if (refcount_read(&htbl->refcount)) 716 + if (htbl->refcount) 717 717 return -EBUSY; 718 718 719 719 mlx5dr_icm_free_chunk(htbl->chunk);
+8 -6
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
··· 123 123 struct mlx5dr_ste { 124 124 u8 *hw_ste; 125 125 /* refcount: indicates the num of rules that using this ste */ 126 - refcount_t refcount; 126 + u32 refcount; 127 127 128 128 /* attached to the miss_list head at each htbl entry */ 129 129 struct list_head miss_list_node; ··· 155 155 struct mlx5dr_ste_htbl { 156 156 u8 lu_type; 157 157 u16 byte_mask; 158 - refcount_t refcount; 158 + u32 refcount; 159 159 struct mlx5dr_icm_chunk *chunk; 160 160 struct mlx5dr_ste *ste_arr; 161 161 u8 *hw_ste_arr; ··· 206 206 207 207 static inline void mlx5dr_htbl_put(struct mlx5dr_ste_htbl *htbl) 208 208 { 209 - if (refcount_dec_and_test(&htbl->refcount)) 209 + htbl->refcount--; 210 + if (!htbl->refcount) 210 211 mlx5dr_ste_htbl_free(htbl); 211 212 } 212 213 213 214 static inline void mlx5dr_htbl_get(struct mlx5dr_ste_htbl *htbl) 214 215 { 215 - refcount_inc(&htbl->refcount); 216 + htbl->refcount++; 216 217 } 217 218 218 219 /* STE utils */ ··· 255 254 struct mlx5dr_matcher *matcher, 256 255 struct mlx5dr_matcher_rx_tx *nic_matcher) 257 256 { 258 - if (refcount_dec_and_test(&ste->refcount)) 257 + ste->refcount--; 258 + if (!ste->refcount) 259 259 mlx5dr_ste_free(ste, matcher, nic_matcher); 260 260 } 261 261 262 262 /* initial as 0, increased only when ste appears in a new rule */ 263 263 static inline void mlx5dr_ste_get(struct mlx5dr_ste *ste) 264 264 { 265 - refcount_inc(&ste->refcount); 265 + ste->refcount++; 266 266 } 267 267 268 268 void mlx5dr_ste_set_hit_addr_by_next_htbl(u8 *hw_ste,
+7
drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
··· 651 651 mlxsw_sp_port->tclass_qdiscs[tclass_num].handle == p->child_handle) 652 652 return 0; 653 653 654 + if (!p->child_handle) { 655 + /* This is an invisible FIFO replacing the original Qdisc. 656 + * Ignore it--the original Qdisc's destroy will follow. 657 + */ 658 + return 0; 659 + } 660 + 654 661 /* See if the grafted qdisc is already offloaded on any tclass. If so, 655 662 * unoffload it. 656 663 */
+1 -1
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
··· 2296 2296 2297 2297 2298 2298 2299 - MODULE_DESCRIPTION("SAMSUNG 10G/2.5G/1G Ethernet PLATFORM driver"); 2299 + MODULE_DESCRIPTION("Samsung 10G/2.5G/1G Ethernet PLATFORM driver"); 2300 2300 2301 2301 MODULE_PARM_DESC(debug, "Message Level (-1: default, 0: no output, 16: all)"); 2302 2302 MODULE_PARM_DESC(eee_timer, "EEE-LPI Default LS timer value");
+3
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
··· 957 957 /* default */ 958 958 break; 959 959 case PHY_INTERFACE_MODE_RGMII: 960 + case PHY_INTERFACE_MODE_RGMII_ID: 961 + case PHY_INTERFACE_MODE_RGMII_RXID: 962 + case PHY_INTERFACE_MODE_RGMII_TXID: 960 963 reg |= SYSCON_EPIT | SYSCON_ETCS_INT_GMII; 961 964 break; 962 965 case PHY_INTERFACE_MODE_RMII:
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
··· 44 44 * rate, which then uses the auto-reparenting feature of the 45 45 * clock driver, and enabling/disabling the clock. 46 46 */ 47 - if (gmac->interface == PHY_INTERFACE_MODE_RGMII) { 47 + if (phy_interface_mode_is_rgmii(gmac->interface)) { 48 48 clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE); 49 49 clk_prepare_enable(gmac->tx_clk); 50 50 gmac->clk_enabled = 1;
+32
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 106 106 static irqreturn_t stmmac_interrupt(int irq, void *dev_id); 107 107 108 108 #ifdef CONFIG_DEBUG_FS 109 + static const struct net_device_ops stmmac_netdev_ops; 109 110 static void stmmac_init_fs(struct net_device *dev); 110 111 static void stmmac_exit_fs(struct net_device *dev); 111 112 #endif ··· 4257 4256 } 4258 4257 DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap); 4259 4258 4259 + /* Use network device events to rename debugfs file entries. 4260 + */ 4261 + static int stmmac_device_event(struct notifier_block *unused, 4262 + unsigned long event, void *ptr) 4263 + { 4264 + struct net_device *dev = netdev_notifier_info_to_dev(ptr); 4265 + struct stmmac_priv *priv = netdev_priv(dev); 4266 + 4267 + if (dev->netdev_ops != &stmmac_netdev_ops) 4268 + goto done; 4269 + 4270 + switch (event) { 4271 + case NETDEV_CHANGENAME: 4272 + if (priv->dbgfs_dir) 4273 + priv->dbgfs_dir = debugfs_rename(stmmac_fs_dir, 4274 + priv->dbgfs_dir, 4275 + stmmac_fs_dir, 4276 + dev->name); 4277 + break; 4278 + } 4279 + done: 4280 + return NOTIFY_DONE; 4281 + } 4282 + 4283 + static struct notifier_block stmmac_notifier = { 4284 + .notifier_call = stmmac_device_event, 4285 + }; 4286 + 4260 4287 static void stmmac_init_fs(struct net_device *dev) 4261 4288 { 4262 4289 struct stmmac_priv *priv = netdev_priv(dev); ··· 4299 4270 /* Entry to report the DMA HW features */ 4300 4271 debugfs_create_file("dma_cap", 0444, priv->dbgfs_dir, dev, 4301 4272 &stmmac_dma_cap_fops); 4273 + 4274 + register_netdevice_notifier(&stmmac_notifier); 4302 4275 } 4303 4276 4304 4277 static void stmmac_exit_fs(struct net_device *dev) 4305 4278 { 4306 4279 struct stmmac_priv *priv = netdev_priv(dev); 4307 4280 4281 + unregister_netdevice_notifier(&stmmac_notifier); 4308 4282 debugfs_remove_recursive(priv->dbgfs_dir); 4309 4283 } 4310 4284 #endif /* CONFIG_DEBUG_FS */
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 320 320 static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, 321 321 struct device_node *np, struct device *dev) 322 322 { 323 - bool mdio = false; 323 + bool mdio = !of_phy_is_fixed_link(np); 324 324 static const struct of_device_id need_mdio_ids[] = { 325 325 { .compatible = "snps,dwc-qos-ethernet-4.10" }, 326 326 {},
+3 -2
drivers/net/gtp.c
··· 813 813 lock_sock(sock->sk); 814 814 if (sock->sk->sk_user_data) { 815 815 sk = ERR_PTR(-EBUSY); 816 - goto out_sock; 816 + goto out_rel_sock; 817 817 } 818 818 819 819 sk = sock->sk; ··· 826 826 827 827 setup_udp_tunnel_sock(sock_net(sock->sk), sock, &tuncfg); 828 828 829 - out_sock: 829 + out_rel_sock: 830 830 release_sock(sock->sk); 831 + out_sock: 831 832 sockfd_put(sock); 832 833 return sk; 833 834 }
+1 -1
drivers/net/macvlan.c
··· 259 259 struct net_device *src, 260 260 enum macvlan_mode mode) 261 261 { 262 - const struct ethhdr *eth = eth_hdr(skb); 262 + const struct ethhdr *eth = skb_eth_hdr(skb); 263 263 const struct macvlan_dev *vlan; 264 264 struct sk_buff *nskb; 265 265 unsigned int i;
+3
drivers/net/phy/phylink.c
··· 566 566 struct sfp_bus *bus; 567 567 int ret; 568 568 569 + if (!fwnode) 570 + return 0; 571 + 569 572 bus = sfp_bus_find_fwnode(fwnode); 570 573 if (IS_ERR(bus)) { 571 574 ret = PTR_ERR(bus);
+3 -6
drivers/net/usb/lan78xx.c
··· 2724 2724 return 0; 2725 2725 } 2726 2726 2727 - static int lan78xx_linearize(struct sk_buff *skb) 2728 - { 2729 - return skb_linearize(skb); 2730 - } 2731 - 2732 2727 static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev, 2733 2728 struct sk_buff *skb, gfp_t flags) 2734 2729 { ··· 2735 2740 return NULL; 2736 2741 } 2737 2742 2738 - if (lan78xx_linearize(skb) < 0) 2743 + if (skb_linearize(skb)) { 2744 + dev_kfree_skb_any(skb); 2739 2745 return NULL; 2746 + } 2740 2747 2741 2748 tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN_MASK_) | TX_CMD_A_FCS_; 2742 2749
+2 -2
drivers/net/vxlan.c
··· 2541 2541 ndst = &rt->dst; 2542 2542 skb_tunnel_check_pmtu(skb, ndst, VXLAN_HEADROOM); 2543 2543 2544 - tos = ip_tunnel_ecn_encap(tos, old_iph, skb); 2544 + tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); 2545 2545 ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); 2546 2546 err = vxlan_build_skb(skb, ndst, sizeof(struct iphdr), 2547 2547 vni, md, flags, udp_sum); ··· 2581 2581 2582 2582 skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM); 2583 2583 2584 - tos = ip_tunnel_ecn_encap(tos, old_iph, skb); 2584 + tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); 2585 2585 ttl = ttl ? : ip6_dst_hoplimit(ndst); 2586 2586 skb_scrub_packet(skb, xnet); 2587 2587 err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr),
+1 -1
drivers/net/wan/sdla.c
··· 708 708 709 709 spin_lock_irqsave(&sdla_lock, flags); 710 710 SDLA_WINDOW(dev, addr); 711 - pbuf = (void *)(((int) dev->mem_start) + (addr & SDLA_ADDR_MASK)); 711 + pbuf = (void *)(dev->mem_start + (addr & SDLA_ADDR_MASK)); 712 712 __sdla_write(dev, pbuf->buf_addr, skb->data, skb->len); 713 713 SDLA_WINDOW(dev, addr); 714 714 pbuf->opp_flag = 1;
+34
include/linux/can/dev.h
··· 18 18 #include <linux/can/error.h> 19 19 #include <linux/can/led.h> 20 20 #include <linux/can/netlink.h> 21 + #include <linux/can/skb.h> 21 22 #include <linux/netdevice.h> 22 23 23 24 /* ··· 92 91 #define get_can_dlc(i) (min_t(__u8, (i), CAN_MAX_DLC)) 93 92 #define get_canfd_dlc(i) (min_t(__u8, (i), CANFD_MAX_DLC)) 94 93 94 + /* Check for outgoing skbs that have not been created by the CAN subsystem */ 95 + static inline bool can_skb_headroom_valid(struct net_device *dev, 96 + struct sk_buff *skb) 97 + { 98 + /* af_packet creates a headroom of HH_DATA_MOD bytes which is fine */ 99 + if (WARN_ON_ONCE(skb_headroom(skb) < sizeof(struct can_skb_priv))) 100 + return false; 101 + 102 + /* af_packet does not apply CAN skb specific settings */ 103 + if (skb->ip_summed == CHECKSUM_NONE) { 104 + /* init headroom */ 105 + can_skb_prv(skb)->ifindex = dev->ifindex; 106 + can_skb_prv(skb)->skbcnt = 0; 107 + 108 + skb->ip_summed = CHECKSUM_UNNECESSARY; 109 + 110 + /* preform proper loopback on capable devices */ 111 + if (dev->flags & IFF_ECHO) 112 + skb->pkt_type = PACKET_LOOPBACK; 113 + else 114 + skb->pkt_type = PACKET_HOST; 115 + 116 + skb_reset_mac_header(skb); 117 + skb_reset_network_header(skb); 118 + skb_reset_transport_header(skb); 119 + } 120 + 121 + return true; 122 + } 123 + 95 124 /* Drop a given socketbuffer if it does not contain a valid CAN frame. */ 96 125 static inline bool can_dropped_invalid_skb(struct net_device *dev, 97 126 struct sk_buff *skb) ··· 137 106 cfd->len > CANFD_MAX_DLEN)) 138 107 goto inval_skb; 139 108 } else 109 + goto inval_skb; 110 + 111 + if (!can_skb_headroom_valid(dev, skb)) 140 112 goto inval_skb; 141 113 142 114 return false;
+8
include/linux/if_ether.h
··· 24 24 return (struct ethhdr *)skb_mac_header(skb); 25 25 } 26 26 27 + /* Prefer this version in TX path, instead of 28 + * skb_reset_mac_header() + eth_hdr() 29 + */ 30 + static inline struct ethhdr *skb_eth_hdr(const struct sk_buff *skb) 31 + { 32 + return (struct ethhdr *)skb->data; 33 + } 34 + 27 35 static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb) 28 36 { 29 37 return (struct ethhdr *)skb_inner_mac_header(skb);
+1 -1
include/linux/sxgbe_platform.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * 10G controller driver for Samsung EXYNOS SoCs 3 + * 10G controller driver for Samsung Exynos SoCs 4 4 * 5 5 * Copyright (C) 2013 Samsung Electronics Co., Ltd. 6 6 * http://www.samsung.com
+6
include/net/netfilter/nf_flow_table.h
··· 106 106 }; 107 107 108 108 #define NF_FLOW_TIMEOUT (30 * HZ) 109 + #define nf_flowtable_time_stamp (u32)jiffies 110 + 111 + static inline __s32 nf_flow_timeout_delta(unsigned int timeout) 112 + { 113 + return (__s32)(timeout - nf_flowtable_time_stamp); 114 + } 109 115 110 116 struct nf_flow_route { 111 117 struct {
+9 -2
kernel/bpf/cgroup.c
··· 35 35 */ 36 36 static void cgroup_bpf_release(struct work_struct *work) 37 37 { 38 - struct cgroup *cgrp = container_of(work, struct cgroup, 39 - bpf.release_work); 38 + struct cgroup *p, *cgrp = container_of(work, struct cgroup, 39 + bpf.release_work); 40 40 enum bpf_cgroup_storage_type stype; 41 41 struct bpf_prog_array *old_array; 42 42 unsigned int type; ··· 64 64 } 65 65 66 66 mutex_unlock(&cgroup_mutex); 67 + 68 + for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p)) 69 + cgroup_bpf_put(p); 67 70 68 71 percpu_ref_exit(&cgrp->bpf.refcnt); 69 72 cgroup_put(cgrp); ··· 202 199 */ 203 200 #define NR ARRAY_SIZE(cgrp->bpf.effective) 204 201 struct bpf_prog_array *arrays[NR] = {}; 202 + struct cgroup *p; 205 203 int ret, i; 206 204 207 205 ret = percpu_ref_init(&cgrp->bpf.refcnt, cgroup_bpf_release_fn, 0, 208 206 GFP_KERNEL); 209 207 if (ret) 210 208 return ret; 209 + 210 + for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p)) 211 + cgroup_bpf_get(p); 211 212 212 213 for (i = 0; i < NR; i++) 213 214 INIT_LIST_HEAD(&cgrp->bpf.progs[i]);
+7 -2
kernel/bpf/verifier.c
··· 6264 6264 static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn) 6265 6265 { 6266 6266 struct bpf_reg_state *regs = cur_regs(env); 6267 + static const int ctx_reg = BPF_REG_6; 6267 6268 u8 mode = BPF_MODE(insn->code); 6268 6269 int i, err; 6269 6270 ··· 6298 6297 } 6299 6298 6300 6299 /* check whether implicit source operand (register R6) is readable */ 6301 - err = check_reg_arg(env, BPF_REG_6, SRC_OP); 6300 + err = check_reg_arg(env, ctx_reg, SRC_OP); 6302 6301 if (err) 6303 6302 return err; 6304 6303 ··· 6317 6316 return -EINVAL; 6318 6317 } 6319 6318 6320 - if (regs[BPF_REG_6].type != PTR_TO_CTX) { 6319 + if (regs[ctx_reg].type != PTR_TO_CTX) { 6321 6320 verbose(env, 6322 6321 "at the time of BPF_LD_ABS|IND R6 != pointer to skb\n"); 6323 6322 return -EINVAL; ··· 6329 6328 if (err) 6330 6329 return err; 6331 6330 } 6331 + 6332 + err = check_ctx_reg(env, &regs[ctx_reg], ctx_reg); 6333 + if (err < 0) 6334 + return err; 6332 6335 6333 6336 /* reset caller saved regs to unreadable */ 6334 6337 for (i = 0; i < CALLER_SAVED_REGS; i++) {
+1
net/8021q/vlan.h
··· 126 126 void vlan_setup(struct net_device *dev); 127 127 int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack); 128 128 void unregister_vlan_dev(struct net_device *dev, struct list_head *head); 129 + void vlan_dev_uninit(struct net_device *dev); 129 130 bool vlan_dev_inherit_address(struct net_device *dev, 130 131 struct net_device *real_dev); 131 132
+2 -1
net/8021q/vlan_dev.c
··· 586 586 return 0; 587 587 } 588 588 589 - static void vlan_dev_uninit(struct net_device *dev) 589 + /* Note: this function might be called multiple times for the same device. */ 590 + void vlan_dev_uninit(struct net_device *dev) 590 591 { 591 592 struct vlan_priority_tci_mapping *pm; 592 593 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
+12 -7
net/8021q/vlan_netlink.c
··· 108 108 struct ifla_vlan_flags *flags; 109 109 struct ifla_vlan_qos_mapping *m; 110 110 struct nlattr *attr; 111 - int rem; 111 + int rem, err; 112 112 113 113 if (data[IFLA_VLAN_FLAGS]) { 114 114 flags = nla_data(data[IFLA_VLAN_FLAGS]); 115 - vlan_dev_change_flags(dev, flags->flags, flags->mask); 115 + err = vlan_dev_change_flags(dev, flags->flags, flags->mask); 116 + if (err) 117 + return err; 116 118 } 117 119 if (data[IFLA_VLAN_INGRESS_QOS]) { 118 120 nla_for_each_nested(attr, data[IFLA_VLAN_INGRESS_QOS], rem) { ··· 125 123 if (data[IFLA_VLAN_EGRESS_QOS]) { 126 124 nla_for_each_nested(attr, data[IFLA_VLAN_EGRESS_QOS], rem) { 127 125 m = nla_data(attr); 128 - vlan_dev_set_egress_priority(dev, m->from, m->to); 126 + err = vlan_dev_set_egress_priority(dev, m->from, m->to); 127 + if (err) 128 + return err; 129 129 } 130 130 } 131 131 return 0; ··· 183 179 return -EINVAL; 184 180 185 181 err = vlan_changelink(dev, tb, data, extack); 186 - if (err < 0) 187 - return err; 188 - 189 - return register_vlan_dev(dev, extack); 182 + if (!err) 183 + err = register_vlan_dev(dev, extack); 184 + if (err) 185 + vlan_dev_uninit(dev); 186 + return err; 190 187 } 191 188 192 189 static inline size_t vlan_qos_map_size(unsigned int n)
+16 -11
net/ipv4/netfilter/arp_tables.c
··· 384 384 return 1; 385 385 } 386 386 387 - static inline int check_target(struct arpt_entry *e, const char *name) 387 + static int check_target(struct arpt_entry *e, struct net *net, const char *name) 388 388 { 389 389 struct xt_entry_target *t = arpt_get_target(e); 390 390 struct xt_tgchk_param par = { 391 + .net = net, 391 392 .table = name, 392 393 .entryinfo = e, 393 394 .target = t->u.kernel.target, ··· 400 399 return xt_check_target(&par, t->u.target_size - sizeof(*t), 0, false); 401 400 } 402 401 403 - static inline int 404 - find_check_entry(struct arpt_entry *e, const char *name, unsigned int size, 402 + static int 403 + find_check_entry(struct arpt_entry *e, struct net *net, const char *name, 404 + unsigned int size, 405 405 struct xt_percpu_counter_alloc_state *alloc_state) 406 406 { 407 407 struct xt_entry_target *t; ··· 421 419 } 422 420 t->u.kernel.target = target; 423 421 424 - ret = check_target(e, name); 422 + ret = check_target(e, net, name); 425 423 if (ret) 426 424 goto err; 427 425 return 0; ··· 514 512 /* Checks and translates the user-supplied table segment (held in 515 513 * newinfo). 516 514 */ 517 - static int translate_table(struct xt_table_info *newinfo, void *entry0, 515 + static int translate_table(struct net *net, 516 + struct xt_table_info *newinfo, 517 + void *entry0, 518 518 const struct arpt_replace *repl) 519 519 { 520 520 struct xt_percpu_counter_alloc_state alloc_state = { 0 }; ··· 573 569 /* Finally, each sanity check must pass */ 574 570 i = 0; 575 571 xt_entry_foreach(iter, entry0, newinfo->size) { 576 - ret = find_check_entry(iter, repl->name, repl->size, 572 + ret = find_check_entry(iter, net, repl->name, repl->size, 577 573 &alloc_state); 578 574 if (ret != 0) 579 575 break; ··· 978 974 goto free_newinfo; 979 975 } 980 976 981 - ret = translate_table(newinfo, loc_cpu_entry, &tmp); 977 + ret = translate_table(net, newinfo, loc_cpu_entry, &tmp); 982 978 if (ret != 0) 983 979 goto free_newinfo; 984 980 ··· 1153 1149 } 1154 1150 } 1155 1151 1156 - static int translate_compat_table(struct xt_table_info **pinfo, 1152 + static int translate_compat_table(struct net *net, 1153 + struct xt_table_info **pinfo, 1157 1154 void **pentry0, 1158 1155 const struct compat_arpt_replace *compatr) 1159 1156 { ··· 1222 1217 repl.num_counters = 0; 1223 1218 repl.counters = NULL; 1224 1219 repl.size = newinfo->size; 1225 - ret = translate_table(newinfo, entry1, &repl); 1220 + ret = translate_table(net, newinfo, entry1, &repl); 1226 1221 if (ret) 1227 1222 goto free_newinfo; 1228 1223 ··· 1275 1270 goto free_newinfo; 1276 1271 } 1277 1272 1278 - ret = translate_compat_table(&newinfo, &loc_cpu_entry, &tmp); 1273 + ret = translate_compat_table(net, &newinfo, &loc_cpu_entry, &tmp); 1279 1274 if (ret != 0) 1280 1275 goto free_newinfo; 1281 1276 ··· 1551 1546 loc_cpu_entry = newinfo->entries; 1552 1547 memcpy(loc_cpu_entry, repl->entries, repl->size); 1553 1548 1554 - ret = translate_table(newinfo, loc_cpu_entry, repl); 1549 + ret = translate_table(net, newinfo, loc_cpu_entry, repl); 1555 1550 if (ret != 0) 1556 1551 goto out_free; 1557 1552
+4 -1
net/ipv4/tcp_input.c
··· 1727 1727 } 1728 1728 1729 1729 /* Ignore very old stuff early */ 1730 - if (!after(sp[used_sacks].end_seq, prior_snd_una)) 1730 + if (!after(sp[used_sacks].end_seq, prior_snd_una)) { 1731 + if (i == 0) 1732 + first_sack_index = -1; 1731 1733 continue; 1734 + } 1732 1735 1733 1736 used_sacks++; 1734 1737 }
+2 -1
net/netfilter/ipset/ip_set_core.c
··· 1848 1848 struct ip_set *set; 1849 1849 struct nlattr *tb[IPSET_ATTR_ADT_MAX + 1] = {}; 1850 1850 int ret = 0; 1851 + u32 lineno; 1851 1852 1852 1853 if (unlikely(protocol_min_failed(attr) || 1853 1854 !attr[IPSET_ATTR_SETNAME] || ··· 1865 1864 return -IPSET_ERR_PROTOCOL; 1866 1865 1867 1866 rcu_read_lock_bh(); 1868 - ret = set->variant->uadt(set, tb, IPSET_TEST, NULL, 0, 0); 1867 + ret = set->variant->uadt(set, tb, IPSET_TEST, &lineno, 0, 0); 1869 1868 rcu_read_unlock_bh(); 1870 1869 /* Userspace can't trigger element to be re-added */ 1871 1870 if (ret == -EAGAIN)
+3
net/netfilter/nf_conntrack_proto_dccp.c
··· 677 677 unsigned int *timeouts = data; 678 678 int i; 679 679 680 + if (!timeouts) 681 + timeouts = dn->dccp_timeout; 682 + 680 683 /* set default DCCP timeouts. */ 681 684 for (i=0; i<CT_DCCP_MAX; i++) 682 685 timeouts[i] = dn->dccp_timeout[i];
+3
net/netfilter/nf_conntrack_proto_sctp.c
··· 594 594 struct nf_sctp_net *sn = nf_sctp_pernet(net); 595 595 int i; 596 596 597 + if (!timeouts) 598 + timeouts = sn->timeouts; 599 + 597 600 /* set default SCTP timeouts. */ 598 601 for (i=0; i<SCTP_CONNTRACK_MAX; i++) 599 602 timeouts[i] = sn->timeouts[i];
+1 -6
net/netfilter/nf_flow_table_core.c
··· 134 134 #define NF_FLOWTABLE_TCP_PICKUP_TIMEOUT (120 * HZ) 135 135 #define NF_FLOWTABLE_UDP_PICKUP_TIMEOUT (30 * HZ) 136 136 137 - static inline __s32 nf_flow_timeout_delta(unsigned int timeout) 138 - { 139 - return (__s32)(timeout - (u32)jiffies); 140 - } 141 - 142 137 static void flow_offload_fixup_ct_timeout(struct nf_conn *ct) 143 138 { 144 139 const struct nf_conntrack_l4proto *l4proto; ··· 227 232 { 228 233 int err; 229 234 230 - flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; 235 + flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT; 231 236 232 237 err = rhashtable_insert_fast(&flow_table->rhashtable, 233 238 &flow->tuplehash[0].node,
+2 -2
net/netfilter/nf_flow_table_ip.c
··· 280 280 if (nf_flow_nat_ip(flow, skb, thoff, dir) < 0) 281 281 return NF_DROP; 282 282 283 - flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; 283 + flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT; 284 284 iph = ip_hdr(skb); 285 285 ip_decrease_ttl(iph); 286 286 skb->tstamp = 0; ··· 509 509 if (nf_flow_nat_ipv6(flow, skb, dir) < 0) 510 510 return NF_DROP; 511 511 512 - flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; 512 + flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT; 513 513 ip6h = ipv6_hdr(skb); 514 514 ip6h->hop_limit--; 515 515 skb->tstamp = 0;
+36 -14
net/netfilter/nf_flow_table_offload.c
··· 166 166 enum flow_offload_tuple_dir dir, 167 167 struct nf_flow_rule *flow_rule) 168 168 { 169 - const struct flow_offload_tuple *tuple = &flow->tuplehash[dir].tuple; 170 169 struct flow_action_entry *entry0 = flow_action_entry_next(flow_rule); 171 170 struct flow_action_entry *entry1 = flow_action_entry_next(flow_rule); 171 + const void *daddr = &flow->tuplehash[!dir].tuple.src_v4; 172 + const struct dst_entry *dst_cache; 173 + unsigned char ha[ETH_ALEN]; 172 174 struct neighbour *n; 173 175 u32 mask, val; 176 + u8 nud_state; 174 177 u16 val16; 175 178 176 - n = dst_neigh_lookup(tuple->dst_cache, &tuple->dst_v4); 179 + dst_cache = flow->tuplehash[dir].tuple.dst_cache; 180 + n = dst_neigh_lookup(dst_cache, daddr); 177 181 if (!n) 178 182 return -ENOENT; 179 183 184 + read_lock_bh(&n->lock); 185 + nud_state = n->nud_state; 186 + ether_addr_copy(ha, n->ha); 187 + read_unlock_bh(&n->lock); 188 + 189 + if (!(nud_state & NUD_VALID)) { 190 + neigh_release(n); 191 + return -ENOENT; 192 + } 193 + 180 194 mask = ~0xffffffff; 181 - memcpy(&val, n->ha, 4); 195 + memcpy(&val, ha, 4); 182 196 flow_offload_mangle(entry0, FLOW_ACT_MANGLE_HDR_TYPE_ETH, 0, 183 197 &val, &mask); 184 198 185 199 mask = ~0x0000ffff; 186 - memcpy(&val16, n->ha + 4, 2); 200 + memcpy(&val16, ha + 4, 2); 187 201 val = val16; 188 202 flow_offload_mangle(entry1, FLOW_ACT_MANGLE_HDR_TYPE_ETH, 4, 189 203 &val, &mask); ··· 349 335 struct nf_flow_rule *flow_rule) 350 336 { 351 337 struct flow_action_entry *entry = flow_action_entry_next(flow_rule); 352 - u32 mask = ~htonl(0xffff0000), port; 338 + u32 mask, port; 353 339 u32 offset; 354 340 355 341 switch (dir) { 356 342 case FLOW_OFFLOAD_DIR_ORIGINAL: 357 343 port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_port); 358 344 offset = 0; /* offsetof(struct tcphdr, source); */ 345 + port = htonl(port << 16); 346 + mask = ~htonl(0xffff0000); 359 347 break; 360 348 case FLOW_OFFLOAD_DIR_REPLY: 361 349 port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port); 362 350 offset = 0; /* offsetof(struct tcphdr, dest); */ 351 + port = htonl(port); 352 + mask = ~htonl(0xffff); 363 353 break; 364 354 default: 365 355 return; 366 356 } 367 - port = htonl(port << 16); 357 + 368 358 flow_offload_mangle(entry, flow_offload_l4proto(flow), offset, 369 359 &port, &mask); 370 360 } ··· 379 361 struct nf_flow_rule *flow_rule) 380 362 { 381 363 struct flow_action_entry *entry = flow_action_entry_next(flow_rule); 382 - u32 mask = ~htonl(0xffff), port; 364 + u32 mask, port; 383 365 u32 offset; 384 366 385 367 switch (dir) { 386 368 case FLOW_OFFLOAD_DIR_ORIGINAL: 387 - port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_port); 388 - offset = 0; /* offsetof(struct tcphdr, source); */ 369 + port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.src_port); 370 + offset = 0; /* offsetof(struct tcphdr, dest); */ 371 + port = htonl(port); 372 + mask = ~htonl(0xffff); 389 373 break; 390 374 case FLOW_OFFLOAD_DIR_REPLY: 391 - port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port); 392 - offset = 0; /* offsetof(struct tcphdr, dest); */ 375 + port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_port); 376 + offset = 0; /* offsetof(struct tcphdr, source); */ 377 + port = htonl(port << 16); 378 + mask = ~htonl(0xffff0000); 393 379 break; 394 380 default: 395 381 return; 396 382 } 397 - port = htonl(port); 383 + 398 384 flow_offload_mangle(entry, flow_offload_l4proto(flow), offset, 399 385 &port, &mask); 400 386 } ··· 781 759 struct flow_offload *flow) 782 760 { 783 761 struct flow_offload_work *offload; 784 - s64 delta; 762 + __s32 delta; 785 763 786 - delta = flow->timeout - jiffies; 764 + delta = nf_flow_timeout_delta(flow->timeout); 787 765 if ((delta >= (9 * NF_FLOW_TIMEOUT) / 10) || 788 766 flow->flags & FLOW_OFFLOAD_HW_DYING) 789 767 return;
+6 -2
net/netfilter/nf_tables_api.c
··· 5984 5984 return ERR_PTR(-ENOENT); 5985 5985 } 5986 5986 5987 + /* Only called from error and netdev event paths. */ 5987 5988 static void nft_unregister_flowtable_hook(struct net *net, 5988 5989 struct nft_flowtable *flowtable, 5989 5990 struct nft_hook *hook) ··· 6000 5999 struct nft_hook *hook; 6001 6000 6002 6001 list_for_each_entry(hook, &flowtable->hook_list, list) 6003 - nft_unregister_flowtable_hook(net, flowtable, hook); 6002 + nf_unregister_net_hook(net, &hook->ops); 6004 6003 } 6005 6004 6006 6005 static int nft_register_flowtable_net_hooks(struct net *net, ··· 6449 6448 { 6450 6449 struct nft_hook *hook, *next; 6451 6450 6451 + flowtable->data.type->free(&flowtable->data); 6452 6452 list_for_each_entry_safe(hook, next, &flowtable->hook_list, list) { 6453 + flowtable->data.type->setup(&flowtable->data, hook->ops.dev, 6454 + FLOW_BLOCK_UNBIND); 6453 6455 list_del_rcu(&hook->list); 6454 6456 kfree(hook); 6455 6457 } 6456 6458 kfree(flowtable->name); 6457 - flowtable->data.type->free(&flowtable->data); 6458 6459 module_put(flowtable->data.type->owner); 6459 6460 kfree(flowtable); 6460 6461 } ··· 6500 6497 if (hook->ops.dev != dev) 6501 6498 continue; 6502 6499 6500 + /* flow_offload_netdev_event() cleans up entries for us. */ 6503 6501 nft_unregister_flowtable_hook(dev_net(dev), flowtable, hook); 6504 6502 list_del_rcu(&hook->list); 6505 6503 kfree_rcu(hook, rcu);
-3
net/netfilter/nft_flow_offload.c
··· 200 200 static void nft_flow_offload_destroy(const struct nft_ctx *ctx, 201 201 const struct nft_expr *expr) 202 202 { 203 - struct nft_flow_offload *priv = nft_expr_priv(expr); 204 - 205 - priv->flowtable->use--; 206 203 nf_ct_netns_put(ctx->net, ctx->family); 207 204 } 208 205
+1 -1
net/qrtr/qrtr.c
··· 196 196 hdr->size = cpu_to_le32(len); 197 197 hdr->confirm_rx = 0; 198 198 199 - skb_put_padto(skb, ALIGN(len, 4)); 199 + skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr)); 200 200 201 201 mutex_lock(&node->ep_lock); 202 202 if (node->ep)
+1 -1
net/sched/sch_cake.c
··· 1769 1769 q->avg_window_begin)); 1770 1770 u64 b = q->avg_window_bytes * (u64)NSEC_PER_SEC; 1771 1771 1772 - do_div(b, window_interval); 1772 + b = div64_u64(b, window_interval); 1773 1773 q->avg_peak_bandwidth = 1774 1774 cake_ewma(q->avg_peak_bandwidth, b, 1775 1775 b > q->avg_peak_bandwidth ? 2 : 8);
+4 -2
net/sched/sch_fq.c
··· 786 786 if (tb[TCA_FQ_QUANTUM]) { 787 787 u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); 788 788 789 - if (quantum > 0) 789 + if (quantum > 0 && quantum <= (1 << 20)) { 790 790 q->quantum = quantum; 791 - else 791 + } else { 792 + NL_SET_ERR_MSG_MOD(extack, "invalid quantum"); 792 793 err = -EINVAL; 794 + } 793 795 } 794 796 795 797 if (tb[TCA_FQ_INITIAL_QUANTUM])
+8 -2
net/sched/sch_prio.c
··· 292 292 struct tc_prio_qopt_offload graft_offload; 293 293 unsigned long band = arg - 1; 294 294 295 - if (new == NULL) 296 - new = &noop_qdisc; 295 + if (!new) { 296 + new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, 297 + TC_H_MAKE(sch->handle, arg), extack); 298 + if (!new) 299 + new = &noop_qdisc; 300 + else 301 + qdisc_hash_add(new, true); 302 + } 297 303 298 304 *old = qdisc_replace(sch, new, &q->queues[band]); 299 305
+18 -10
net/sctp/sm_sideeffect.c
··· 1363 1363 /* Generate an INIT ACK chunk. */ 1364 1364 new_obj = sctp_make_init_ack(asoc, chunk, GFP_ATOMIC, 1365 1365 0); 1366 - if (!new_obj) 1367 - goto nomem; 1366 + if (!new_obj) { 1367 + error = -ENOMEM; 1368 + break; 1369 + } 1368 1370 1369 1371 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, 1370 1372 SCTP_CHUNK(new_obj)); ··· 1388 1386 if (!new_obj) { 1389 1387 if (cmd->obj.chunk) 1390 1388 sctp_chunk_free(cmd->obj.chunk); 1391 - goto nomem; 1389 + error = -ENOMEM; 1390 + break; 1392 1391 } 1393 1392 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, 1394 1393 SCTP_CHUNK(new_obj)); ··· 1436 1433 1437 1434 /* Generate a SHUTDOWN chunk. */ 1438 1435 new_obj = sctp_make_shutdown(asoc, chunk); 1439 - if (!new_obj) 1440 - goto nomem; 1436 + if (!new_obj) { 1437 + error = -ENOMEM; 1438 + break; 1439 + } 1441 1440 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, 1442 1441 SCTP_CHUNK(new_obj)); 1443 1442 break; ··· 1775 1770 break; 1776 1771 } 1777 1772 1778 - if (error) 1773 + if (error) { 1774 + cmd = sctp_next_cmd(commands); 1775 + while (cmd) { 1776 + if (cmd->verb == SCTP_CMD_REPLY) 1777 + sctp_chunk_free(cmd->obj.chunk); 1778 + cmd = sctp_next_cmd(commands); 1779 + } 1779 1780 break; 1781 + } 1780 1782 } 1781 1783 1782 - out: 1783 1784 /* If this is in response to a received chunk, wait until 1784 1785 * we are done with the packet to open the queue so that we don't 1785 1786 * send multiple packets in response to a single request. ··· 1800 1789 sp->data_ready_signalled = 0; 1801 1790 1802 1791 return error; 1803 - nomem: 1804 - error = -ENOMEM; 1805 - goto out; 1806 1792 }
+1 -3
net/tipc/Makefile
··· 9 9 core.o link.o discover.o msg.o \ 10 10 name_distr.o subscr.o monitor.o name_table.o net.o \ 11 11 netlink.o netlink_compat.o node.o socket.o eth_media.o \ 12 - topsrv.o socket.o group.o trace.o 12 + topsrv.o group.o trace.o 13 13 14 14 CFLAGS_trace.o += -I$(src) 15 15 ··· 20 20 21 21 22 22 obj-$(CONFIG_TIPC_DIAG) += diag.o 23 - 24 - tipc_diag-y := diag.o
+34 -23
net/tipc/socket.c
··· 287 287 * 288 288 * Caller must hold socket lock 289 289 */ 290 - static void tsk_rej_rx_queue(struct sock *sk) 290 + static void tsk_rej_rx_queue(struct sock *sk, int error) 291 291 { 292 292 struct sk_buff *skb; 293 293 294 294 while ((skb = __skb_dequeue(&sk->sk_receive_queue))) 295 - tipc_sk_respond(sk, skb, TIPC_ERR_NO_PORT); 295 + tipc_sk_respond(sk, skb, error); 296 296 } 297 297 298 298 static bool tipc_sk_connected(struct sock *sk) ··· 545 545 /* Remove pending SYN */ 546 546 __skb_queue_purge(&sk->sk_write_queue); 547 547 548 - /* Reject all unreceived messages, except on an active connection 549 - * (which disconnects locally & sends a 'FIN+' to peer). 550 - */ 551 - while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) { 552 - if (TIPC_SKB_CB(skb)->bytes_read) { 553 - kfree_skb(skb); 554 - continue; 555 - } 556 - if (!tipc_sk_type_connectionless(sk) && 557 - sk->sk_state != TIPC_DISCONNECTING) { 558 - tipc_set_sk_state(sk, TIPC_DISCONNECTING); 559 - tipc_node_remove_conn(net, dnode, tsk->portid); 560 - } 561 - tipc_sk_respond(sk, skb, error); 548 + /* Remove partially received buffer if any */ 549 + skb = skb_peek(&sk->sk_receive_queue); 550 + if (skb && TIPC_SKB_CB(skb)->bytes_read) { 551 + __skb_unlink(skb, &sk->sk_receive_queue); 552 + kfree_skb(skb); 562 553 } 563 554 564 - if (tipc_sk_type_connectionless(sk)) 555 + /* Reject all unreceived messages if connectionless */ 556 + if (tipc_sk_type_connectionless(sk)) { 557 + tsk_rej_rx_queue(sk, error); 565 558 return; 559 + } 566 560 567 - if (sk->sk_state != TIPC_DISCONNECTING) { 561 + switch (sk->sk_state) { 562 + case TIPC_CONNECTING: 563 + case TIPC_ESTABLISHED: 564 + tipc_set_sk_state(sk, TIPC_DISCONNECTING); 565 + tipc_node_remove_conn(net, dnode, tsk->portid); 566 + /* Send a FIN+/- to its peer */ 567 + skb = __skb_dequeue(&sk->sk_receive_queue); 568 + if (skb) { 569 + __skb_queue_purge(&sk->sk_receive_queue); 570 + tipc_sk_respond(sk, skb, error); 571 + break; 572 + } 568 573 skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, 569 574 TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode, 570 575 tsk_own_node(tsk), tsk_peer_port(tsk), 571 576 tsk->portid, error); 572 577 if (skb) 573 578 tipc_node_xmit_skb(net, skb, dnode, tsk->portid); 574 - tipc_node_remove_conn(net, dnode, tsk->portid); 575 - tipc_set_sk_state(sk, TIPC_DISCONNECTING); 579 + break; 580 + case TIPC_LISTEN: 581 + /* Reject all SYN messages */ 582 + tsk_rej_rx_queue(sk, error); 583 + break; 584 + default: 585 + __skb_queue_purge(&sk->sk_receive_queue); 586 + break; 576 587 } 577 588 } 578 589 ··· 2443 2432 return sock_intr_errno(*timeo_p); 2444 2433 2445 2434 add_wait_queue(sk_sleep(sk), &wait); 2446 - done = sk_wait_event(sk, timeo_p, 2447 - sk->sk_state != TIPC_CONNECTING, &wait); 2435 + done = sk_wait_event(sk, timeo_p, tipc_sk_connected(sk), 2436 + &wait); 2448 2437 remove_wait_queue(sk_sleep(sk), &wait); 2449 2438 } while (!done); 2450 2439 return 0; ··· 2654 2643 * Reject any stray messages received by new socket 2655 2644 * before the socket lock was taken (very, very unlikely) 2656 2645 */ 2657 - tsk_rej_rx_queue(new_sk); 2646 + tsk_rej_rx_queue(new_sk, TIPC_ERR_NO_PORT); 2658 2647 2659 2648 /* Connect new socket to it's peer */ 2660 2649 tipc_sk_finish_conn(new_tsock, msg_origport(msg), msg_orignode(msg));
+8
tools/testing/selftests/net/forwarding/loopback.sh
··· 1 1 #!/bin/bash 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 + # Kselftest framework requirement - SKIP code is 4. 5 + ksft_skip=4 6 + 4 7 ALL_TESTS="loopback_test" 5 8 NUM_NETIFS=2 6 9 source tc_common.sh ··· 75 72 76 73 h1_create 77 74 h2_create 75 + 76 + if ethtool -k $h1 | grep loopback | grep -q fixed; then 77 + log_test "SKIP: dev $h1 does not support loopback feature" 78 + exit $ksft_skip 79 + fi 78 80 } 79 81 80 82 cleanup()