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 tag 'net-5.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
"Including fixes from netfilter.

Current release - regressions:

- revert "tipc: use consistent GFP flags"

Previous releases - regressions:

- igb: fix deadlock caused by taking RTNL in runtime resume path

- accept UFOv6 packages in virtio_net_hdr_to_skb

- netfilter: fix regression in looped (broad|multi)cast's MAC
handling

- bridge: fix ioctl old_deviceless bridge argument

- ice: xsk: do not clear status_error0 for ntu + nb_buffs descriptor,
avoid stalls when multiple sockets use an interface

Previous releases - always broken:

- inet: fully convert sk->sk_rx_dst to RCU rules

- veth: ensure skb entering GRO are not cloned

- sched: fix zone matching for invalid conntrack state

- bonding: fix ad_actor_system option setting to default

- nf_tables: fix use-after-free in nft_set_catchall_destroy()

- lantiq_xrx200: increase buffer reservation to avoid mem corruption

- ice: xsk: avoid leaking app buffers during clean up

- tun: avoid double free in tun_free_netdev"

* tag 'net-5.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (45 commits)
net: stmmac: dwmac-visconti: Fix value of ETHER_CLK_SEL_FREQ_SEL_2P5M
r8152: sync ocp base
r8152: fix the force speed doesn't work for RTL8156
net: bridge: fix ioctl old_deviceless bridge argument
net: stmmac: ptp: fix potentially overflowing expression
net: dsa: tag_ocelot: use traffic class to map priority on injected header
veth: ensure skb entering GRO are not cloned.
asix: fix wrong return value in asix_check_host_enable()
asix: fix uninit-value in asix_mdio_read()
sfc: falcon: Check null pointer of rx_queue->page_ring
sfc: Check null pointer of rx_queue->page_ring
net: ks8851: Check for error irq
drivers: net: smc911x: Check for error irq
fjes: Check for error irq
bonding: fix ad_actor_system option setting to default
igb: fix deadlock caused by taking RTNL in RPM resume path
gve: Correct order of processing device options
net: skip virtio_net_hdr_set_proto if protocol already set
net: accept UFOv6 packages in virtio_net_hdr_to_skb
docs: networking: replace skb_hwtstamp_tx with skb_tstamp_tx
...

+405 -213
+6 -5
Documentation/networking/bonding.rst
··· 196 196 ad_actor_system 197 197 198 198 In an AD system, this specifies the mac-address for the actor in 199 - protocol packet exchanges (LACPDUs). The value cannot be NULL or 200 - multicast. It is preferred to have the local-admin bit set for this 201 - mac but driver does not enforce it. If the value is not given then 202 - system defaults to using the masters' mac address as actors' system 203 - address. 199 + protocol packet exchanges (LACPDUs). The value cannot be a multicast 200 + address. If the all-zeroes MAC is specified, bonding will internally 201 + use the MAC of the bond itself. It is preferred to have the 202 + local-admin bit set for this mac but driver does not enforce it. If 203 + the value is not given then system defaults to using the masters' 204 + mac address as actors' system address. 204 205 205 206 This parameter has effect only in 802.3ad mode and is available through 206 207 SysFs interface.
+1
Documentation/networking/device_drivers/ethernet/freescale/dpaa2/overview.rst
··· 183 183 IRQ config, enable, reset 184 184 185 185 DPNI (Datapath Network Interface) 186 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 187 Contains TX/RX queues, network interface configuration, and RX buffer pool 187 188 configuration mechanisms. The TX/RX queues are in memory and are identified 188 189 by queue number.
+2 -2
Documentation/networking/timestamping.rst
··· 582 582 and hardware timestamping is not possible (SKBTX_IN_PROGRESS not set). 583 583 - As soon as the driver has sent the packet and/or obtained a 584 584 hardware time stamp for it, it passes the time stamp back by 585 - calling skb_hwtstamp_tx() with the original skb, the raw 586 - hardware time stamp. skb_hwtstamp_tx() clones the original skb and 585 + calling skb_tstamp_tx() with the original skb, the raw 586 + hardware time stamp. skb_tstamp_tx() clones the original skb and 587 587 adds the timestamps, therefore the original skb has to be freed now. 588 588 If obtaining the hardware time stamp somehow fails, then the driver 589 589 should not fall back to software time stamping. The rationale is that
+1 -1
drivers/net/bonding/bond_options.c
··· 1526 1526 mac = (u8 *)&newval->value; 1527 1527 } 1528 1528 1529 - if (!is_valid_ether_addr(mac)) 1529 + if (is_multicast_ether_addr(mac)) 1530 1530 goto err; 1531 1531 1532 1532 netdev_dbg(bond->dev, "Setting ad_actor_system to %pM\n", mac);
+4 -4
drivers/net/ethernet/google/gve/gve_adminq.c
··· 738 738 * is not set to GqiRda, choose the queue format in a priority order: 739 739 * DqoRda, GqiRda, GqiQpl. Use GqiQpl as default. 740 740 */ 741 - if (priv->queue_format == GVE_GQI_RDA_FORMAT) { 742 - dev_info(&priv->pdev->dev, 743 - "Driver is running with GQI RDA queue format.\n"); 744 - } else if (dev_op_dqo_rda) { 741 + if (dev_op_dqo_rda) { 745 742 priv->queue_format = GVE_DQO_RDA_FORMAT; 746 743 dev_info(&priv->pdev->dev, 747 744 "Driver is running with DQO RDA queue format.\n"); ··· 750 753 "Driver is running with GQI RDA queue format.\n"); 751 754 supported_features_mask = 752 755 be32_to_cpu(dev_op_gqi_rda->supported_features_mask); 756 + } else if (priv->queue_format == GVE_GQI_RDA_FORMAT) { 757 + dev_info(&priv->pdev->dev, 758 + "Driver is running with GQI RDA queue format.\n"); 753 759 } else { 754 760 priv->queue_format = GVE_GQI_QPL_FORMAT; 755 761 if (dev_op_gqi_qpl)
+17
drivers/net/ethernet/intel/ice/ice_base.c
··· 6 6 #include "ice_lib.h" 7 7 #include "ice_dcb_lib.h" 8 8 9 + static bool ice_alloc_rx_buf_zc(struct ice_rx_ring *rx_ring) 10 + { 11 + rx_ring->xdp_buf = kcalloc(rx_ring->count, sizeof(*rx_ring->xdp_buf), GFP_KERNEL); 12 + return !!rx_ring->xdp_buf; 13 + } 14 + 15 + static bool ice_alloc_rx_buf(struct ice_rx_ring *rx_ring) 16 + { 17 + rx_ring->rx_buf = kcalloc(rx_ring->count, sizeof(*rx_ring->rx_buf), GFP_KERNEL); 18 + return !!rx_ring->rx_buf; 19 + } 20 + 9 21 /** 10 22 * __ice_vsi_get_qs_contig - Assign a contiguous chunk of queues to VSI 11 23 * @qs_cfg: gathered variables needed for PF->VSI queues assignment ··· 504 492 xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, 505 493 ring->q_index, ring->q_vector->napi.napi_id); 506 494 495 + kfree(ring->rx_buf); 507 496 ring->xsk_pool = ice_xsk_pool(ring); 508 497 if (ring->xsk_pool) { 498 + if (!ice_alloc_rx_buf_zc(ring)) 499 + return -ENOMEM; 509 500 xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq); 510 501 511 502 ring->rx_buf_len = ··· 523 508 dev_info(dev, "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n", 524 509 ring->q_index); 525 510 } else { 511 + if (!ice_alloc_rx_buf(ring)) 512 + return -ENOMEM; 526 513 if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) 527 514 /* coverity[check_return] */ 528 515 xdp_rxq_info_reg(&ring->xdp_rxq,
+13 -6
drivers/net/ethernet/intel/ice/ice_txrx.c
··· 419 419 } 420 420 421 421 rx_skip_free: 422 - memset(rx_ring->rx_buf, 0, sizeof(*rx_ring->rx_buf) * rx_ring->count); 422 + if (rx_ring->xsk_pool) 423 + memset(rx_ring->xdp_buf, 0, array_size(rx_ring->count, sizeof(*rx_ring->xdp_buf))); 424 + else 425 + memset(rx_ring->rx_buf, 0, array_size(rx_ring->count, sizeof(*rx_ring->rx_buf))); 423 426 424 427 /* Zero out the descriptor ring */ 425 428 size = ALIGN(rx_ring->count * sizeof(union ice_32byte_rx_desc), ··· 449 446 if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq)) 450 447 xdp_rxq_info_unreg(&rx_ring->xdp_rxq); 451 448 rx_ring->xdp_prog = NULL; 452 - devm_kfree(rx_ring->dev, rx_ring->rx_buf); 453 - rx_ring->rx_buf = NULL; 449 + if (rx_ring->xsk_pool) { 450 + kfree(rx_ring->xdp_buf); 451 + rx_ring->xdp_buf = NULL; 452 + } else { 453 + kfree(rx_ring->rx_buf); 454 + rx_ring->rx_buf = NULL; 455 + } 454 456 455 457 if (rx_ring->desc) { 456 458 size = ALIGN(rx_ring->count * sizeof(union ice_32byte_rx_desc), ··· 483 475 /* warn if we are about to overwrite the pointer */ 484 476 WARN_ON(rx_ring->rx_buf); 485 477 rx_ring->rx_buf = 486 - devm_kcalloc(dev, sizeof(*rx_ring->rx_buf), rx_ring->count, 487 - GFP_KERNEL); 478 + kcalloc(rx_ring->count, sizeof(*rx_ring->rx_buf), GFP_KERNEL); 488 479 if (!rx_ring->rx_buf) 489 480 return -ENOMEM; 490 481 ··· 512 505 return 0; 513 506 514 507 err: 515 - devm_kfree(dev, rx_ring->rx_buf); 508 + kfree(rx_ring->rx_buf); 516 509 rx_ring->rx_buf = NULL; 517 510 return -ENOMEM; 518 511 }
-1
drivers/net/ethernet/intel/ice/ice_txrx.h
··· 24 24 #define ICE_MAX_DATA_PER_TXD_ALIGNED \ 25 25 (~(ICE_MAX_READ_REQ_SIZE - 1) & ICE_MAX_DATA_PER_TXD) 26 26 27 - #define ICE_RX_BUF_WRITE 16 /* Must be power of 2 */ 28 27 #define ICE_MAX_TXQ_PER_TXQG 128 29 28 30 29 /* Attempt to maximize the headroom available for incoming frames. We use a 2K
+32 -34
drivers/net/ethernet/intel/ice/ice_xsk.c
··· 12 12 #include "ice_txrx_lib.h" 13 13 #include "ice_lib.h" 14 14 15 + static struct xdp_buff **ice_xdp_buf(struct ice_rx_ring *rx_ring, u32 idx) 16 + { 17 + return &rx_ring->xdp_buf[idx]; 18 + } 19 + 15 20 /** 16 21 * ice_qp_reset_stats - Resets all stats for rings of given index 17 22 * @vsi: VSI that contains rings of interest ··· 377 372 dma_addr_t dma; 378 373 379 374 rx_desc = ICE_RX_DESC(rx_ring, ntu); 380 - xdp = &rx_ring->xdp_buf[ntu]; 375 + xdp = ice_xdp_buf(rx_ring, ntu); 381 376 382 377 nb_buffs = min_t(u16, count, rx_ring->count - ntu); 383 378 nb_buffs = xsk_buff_alloc_batch(rx_ring->xsk_pool, xdp, nb_buffs); ··· 395 390 } 396 391 397 392 ntu += nb_buffs; 398 - if (ntu == rx_ring->count) { 399 - rx_desc = ICE_RX_DESC(rx_ring, 0); 400 - xdp = rx_ring->xdp_buf; 393 + if (ntu == rx_ring->count) 401 394 ntu = 0; 402 - } 403 395 404 - /* clear the status bits for the next_to_use descriptor */ 405 - rx_desc->wb.status_error0 = 0; 406 396 ice_release_rx_desc(rx_ring, ntu); 407 397 408 398 return count == nb_buffs; ··· 419 419 /** 420 420 * ice_construct_skb_zc - Create an sk_buff from zero-copy buffer 421 421 * @rx_ring: Rx ring 422 - * @xdp_arr: Pointer to the SW ring of xdp_buff pointers 422 + * @xdp: Pointer to XDP buffer 423 423 * 424 424 * This function allocates a new skb from a zero-copy Rx buffer. 425 425 * 426 426 * Returns the skb on success, NULL on failure. 427 427 */ 428 428 static struct sk_buff * 429 - ice_construct_skb_zc(struct ice_rx_ring *rx_ring, struct xdp_buff **xdp_arr) 429 + ice_construct_skb_zc(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp) 430 430 { 431 - struct xdp_buff *xdp = *xdp_arr; 431 + unsigned int datasize_hard = xdp->data_end - xdp->data_hard_start; 432 432 unsigned int metasize = xdp->data - xdp->data_meta; 433 433 unsigned int datasize = xdp->data_end - xdp->data; 434 - unsigned int datasize_hard = xdp->data_end - xdp->data_hard_start; 435 434 struct sk_buff *skb; 436 435 437 436 skb = __napi_alloc_skb(&rx_ring->q_vector->napi, datasize_hard, ··· 444 445 skb_metadata_set(skb, metasize); 445 446 446 447 xsk_buff_free(xdp); 447 - *xdp_arr = NULL; 448 448 return skb; 449 449 } 450 450 ··· 505 507 int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget) 506 508 { 507 509 unsigned int total_rx_bytes = 0, total_rx_packets = 0; 508 - u16 cleaned_count = ICE_DESC_UNUSED(rx_ring); 509 510 struct ice_tx_ring *xdp_ring; 510 511 unsigned int xdp_xmit = 0; 511 512 struct bpf_prog *xdp_prog; ··· 519 522 while (likely(total_rx_packets < (unsigned int)budget)) { 520 523 union ice_32b_rx_flex_desc *rx_desc; 521 524 unsigned int size, xdp_res = 0; 522 - struct xdp_buff **xdp; 525 + struct xdp_buff *xdp; 523 526 struct sk_buff *skb; 524 527 u16 stat_err_bits; 525 528 u16 vlan_tag = 0; ··· 537 540 */ 538 541 dma_rmb(); 539 542 543 + xdp = *ice_xdp_buf(rx_ring, rx_ring->next_to_clean); 544 + 540 545 size = le16_to_cpu(rx_desc->wb.pkt_len) & 541 546 ICE_RX_FLX_DESC_PKT_LEN_M; 542 - if (!size) 543 - break; 547 + if (!size) { 548 + xdp->data = NULL; 549 + xdp->data_end = NULL; 550 + xdp->data_hard_start = NULL; 551 + xdp->data_meta = NULL; 552 + goto construct_skb; 553 + } 544 554 545 - xdp = &rx_ring->xdp_buf[rx_ring->next_to_clean]; 546 - xsk_buff_set_size(*xdp, size); 547 - xsk_buff_dma_sync_for_cpu(*xdp, rx_ring->xsk_pool); 555 + xsk_buff_set_size(xdp, size); 556 + xsk_buff_dma_sync_for_cpu(xdp, rx_ring->xsk_pool); 548 557 549 - xdp_res = ice_run_xdp_zc(rx_ring, *xdp, xdp_prog, xdp_ring); 558 + xdp_res = ice_run_xdp_zc(rx_ring, xdp, xdp_prog, xdp_ring); 550 559 if (xdp_res) { 551 560 if (xdp_res & (ICE_XDP_TX | ICE_XDP_REDIR)) 552 561 xdp_xmit |= xdp_res; 553 562 else 554 - xsk_buff_free(*xdp); 563 + xsk_buff_free(xdp); 555 564 556 - *xdp = NULL; 557 565 total_rx_bytes += size; 558 566 total_rx_packets++; 559 - cleaned_count++; 560 567 561 568 ice_bump_ntc(rx_ring); 562 569 continue; 563 570 } 564 - 571 + construct_skb: 565 572 /* XDP_PASS path */ 566 573 skb = ice_construct_skb_zc(rx_ring, xdp); 567 574 if (!skb) { ··· 573 572 break; 574 573 } 575 574 576 - cleaned_count++; 577 575 ice_bump_ntc(rx_ring); 578 576 579 577 if (eth_skb_pad(skb)) { ··· 594 594 ice_receive_skb(rx_ring, skb, vlan_tag); 595 595 } 596 596 597 - if (cleaned_count >= ICE_RX_BUF_WRITE) 598 - failure = !ice_alloc_rx_bufs_zc(rx_ring, cleaned_count); 597 + failure = !ice_alloc_rx_bufs_zc(rx_ring, ICE_DESC_UNUSED(rx_ring)); 599 598 600 599 ice_finalize_xdp_rx(xdp_ring, xdp_xmit); 601 600 ice_update_rx_ring_stats(rx_ring, total_rx_packets, total_rx_bytes); ··· 810 811 */ 811 812 void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring) 812 813 { 813 - u16 i; 814 + u16 count_mask = rx_ring->count - 1; 815 + u16 ntc = rx_ring->next_to_clean; 816 + u16 ntu = rx_ring->next_to_use; 814 817 815 - for (i = 0; i < rx_ring->count; i++) { 816 - struct xdp_buff **xdp = &rx_ring->xdp_buf[i]; 818 + for ( ; ntc != ntu; ntc = (ntc + 1) & count_mask) { 819 + struct xdp_buff *xdp = *ice_xdp_buf(rx_ring, ntc); 817 820 818 - if (!xdp) 819 - continue; 820 - 821 - *xdp = NULL; 821 + xsk_buff_free(xdp); 822 822 } 823 823 } 824 824
+13 -6
drivers/net/ethernet/intel/igb/igb_main.c
··· 9254 9254 return __igb_shutdown(to_pci_dev(dev), NULL, 0); 9255 9255 } 9256 9256 9257 - static int __maybe_unused igb_resume(struct device *dev) 9257 + static int __maybe_unused __igb_resume(struct device *dev, bool rpm) 9258 9258 { 9259 9259 struct pci_dev *pdev = to_pci_dev(dev); 9260 9260 struct net_device *netdev = pci_get_drvdata(pdev); ··· 9297 9297 9298 9298 wr32(E1000_WUS, ~0); 9299 9299 9300 - rtnl_lock(); 9300 + if (!rpm) 9301 + rtnl_lock(); 9301 9302 if (!err && netif_running(netdev)) 9302 9303 err = __igb_open(netdev, true); 9303 9304 9304 9305 if (!err) 9305 9306 netif_device_attach(netdev); 9306 - rtnl_unlock(); 9307 + if (!rpm) 9308 + rtnl_unlock(); 9307 9309 9308 9310 return err; 9311 + } 9312 + 9313 + static int __maybe_unused igb_resume(struct device *dev) 9314 + { 9315 + return __igb_resume(dev, false); 9309 9316 } 9310 9317 9311 9318 static int __maybe_unused igb_runtime_idle(struct device *dev) ··· 9333 9326 9334 9327 static int __maybe_unused igb_runtime_resume(struct device *dev) 9335 9328 { 9336 - return igb_resume(dev); 9329 + return __igb_resume(dev, true); 9337 9330 } 9338 9331 9339 9332 static void igb_shutdown(struct pci_dev *pdev) ··· 9449 9442 * @pdev: Pointer to PCI device 9450 9443 * 9451 9444 * Restart the card from scratch, as if from a cold-boot. Implementation 9452 - * resembles the first-half of the igb_resume routine. 9445 + * resembles the first-half of the __igb_resume routine. 9453 9446 **/ 9454 9447 static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev) 9455 9448 { ··· 9489 9482 * 9490 9483 * This callback is called when the error recovery driver tells us that 9491 9484 * its OK to resume normal operation. Implementation resembles the 9492 - * second-half of the igb_resume routine. 9485 + * second-half of the __igb_resume routine. 9493 9486 */ 9494 9487 static void igb_io_resume(struct pci_dev *pdev) 9495 9488 {
+24 -10
drivers/net/ethernet/lantiq_xrx200.c
··· 71 71 struct xrx200_chan chan_tx; 72 72 struct xrx200_chan chan_rx; 73 73 74 + u16 rx_buf_size; 75 + 74 76 struct net_device *net_dev; 75 77 struct device *dev; 76 78 ··· 99 97 xrx200_pmac_w32(priv, val, offset); 100 98 } 101 99 100 + static int xrx200_max_frame_len(int mtu) 101 + { 102 + return VLAN_ETH_HLEN + mtu; 103 + } 104 + 105 + static int xrx200_buffer_size(int mtu) 106 + { 107 + return round_up(xrx200_max_frame_len(mtu), 4 * XRX200_DMA_BURST_LEN); 108 + } 109 + 102 110 /* drop all the packets from the DMA ring */ 103 111 static void xrx200_flush_dma(struct xrx200_chan *ch) 104 112 { ··· 121 109 break; 122 110 123 111 desc->ctl = LTQ_DMA_OWN | LTQ_DMA_RX_OFFSET(NET_IP_ALIGN) | 124 - (ch->priv->net_dev->mtu + VLAN_ETH_HLEN + 125 - ETH_FCS_LEN); 112 + ch->priv->rx_buf_size; 126 113 ch->dma.desc++; 127 114 ch->dma.desc %= LTQ_DESC_NUM; 128 115 } ··· 169 158 170 159 static int xrx200_alloc_skb(struct xrx200_chan *ch) 171 160 { 172 - int len = ch->priv->net_dev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; 173 161 struct sk_buff *skb = ch->skb[ch->dma.desc]; 162 + struct xrx200_priv *priv = ch->priv; 174 163 dma_addr_t mapping; 175 164 int ret = 0; 176 165 177 - ch->skb[ch->dma.desc] = netdev_alloc_skb_ip_align(ch->priv->net_dev, 178 - len); 166 + ch->skb[ch->dma.desc] = netdev_alloc_skb_ip_align(priv->net_dev, 167 + priv->rx_buf_size); 179 168 if (!ch->skb[ch->dma.desc]) { 180 169 ret = -ENOMEM; 181 170 goto skip; 182 171 } 183 172 184 - mapping = dma_map_single(ch->priv->dev, ch->skb[ch->dma.desc]->data, 185 - len, DMA_FROM_DEVICE); 186 - if (unlikely(dma_mapping_error(ch->priv->dev, mapping))) { 173 + mapping = dma_map_single(priv->dev, ch->skb[ch->dma.desc]->data, 174 + priv->rx_buf_size, DMA_FROM_DEVICE); 175 + if (unlikely(dma_mapping_error(priv->dev, mapping))) { 187 176 dev_kfree_skb_any(ch->skb[ch->dma.desc]); 188 177 ch->skb[ch->dma.desc] = skb; 189 178 ret = -ENOMEM; ··· 195 184 wmb(); 196 185 skip: 197 186 ch->dma.desc_base[ch->dma.desc].ctl = 198 - LTQ_DMA_OWN | LTQ_DMA_RX_OFFSET(NET_IP_ALIGN) | len; 187 + LTQ_DMA_OWN | LTQ_DMA_RX_OFFSET(NET_IP_ALIGN) | priv->rx_buf_size; 199 188 200 189 return ret; 201 190 } ··· 367 356 int ret = 0; 368 357 369 358 net_dev->mtu = new_mtu; 359 + priv->rx_buf_size = xrx200_buffer_size(new_mtu); 370 360 371 361 if (new_mtu <= old_mtu) 372 362 return ret; ··· 387 375 ret = xrx200_alloc_skb(ch_rx); 388 376 if (ret) { 389 377 net_dev->mtu = old_mtu; 378 + priv->rx_buf_size = xrx200_buffer_size(old_mtu); 390 379 break; 391 380 } 392 381 dev_kfree_skb_any(skb); ··· 518 505 net_dev->netdev_ops = &xrx200_netdev_ops; 519 506 SET_NETDEV_DEV(net_dev, dev); 520 507 net_dev->min_mtu = ETH_ZLEN; 521 - net_dev->max_mtu = XRX200_DMA_DATA_LEN - VLAN_ETH_HLEN - ETH_FCS_LEN; 508 + net_dev->max_mtu = XRX200_DMA_DATA_LEN - xrx200_max_frame_len(0); 509 + priv->rx_buf_size = xrx200_buffer_size(ETH_DATA_LEN); 522 510 523 511 /* load the memory ranges */ 524 512 priv->pmac_reg = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
+22 -13
drivers/net/ethernet/marvell/prestera/prestera_main.c
··· 54 54 struct prestera_port *prestera_port_find_by_hwid(struct prestera_switch *sw, 55 55 u32 dev_id, u32 hw_id) 56 56 { 57 - struct prestera_port *port = NULL; 57 + struct prestera_port *port = NULL, *tmp; 58 58 59 59 read_lock(&sw->port_list_lock); 60 - list_for_each_entry(port, &sw->port_list, list) { 61 - if (port->dev_id == dev_id && port->hw_id == hw_id) 60 + list_for_each_entry(tmp, &sw->port_list, list) { 61 + if (tmp->dev_id == dev_id && tmp->hw_id == hw_id) { 62 + port = tmp; 62 63 break; 64 + } 63 65 } 64 66 read_unlock(&sw->port_list_lock); 65 67 ··· 70 68 71 69 struct prestera_port *prestera_find_port(struct prestera_switch *sw, u32 id) 72 70 { 73 - struct prestera_port *port = NULL; 71 + struct prestera_port *port = NULL, *tmp; 74 72 75 73 read_lock(&sw->port_list_lock); 76 - list_for_each_entry(port, &sw->port_list, list) { 77 - if (port->id == id) 74 + list_for_each_entry(tmp, &sw->port_list, list) { 75 + if (tmp->id == id) { 76 + port = tmp; 78 77 break; 78 + } 79 79 } 80 80 read_unlock(&sw->port_list_lock); 81 81 ··· 768 764 struct net_device *dev, 769 765 unsigned long event, void *ptr) 770 766 { 771 - struct netdev_notifier_changeupper_info *info = ptr; 767 + struct netdev_notifier_info *info = ptr; 768 + struct netdev_notifier_changeupper_info *cu_info; 772 769 struct prestera_port *port = netdev_priv(dev); 773 770 struct netlink_ext_ack *extack; 774 771 struct net_device *upper; 775 772 776 - extack = netdev_notifier_info_to_extack(&info->info); 777 - upper = info->upper_dev; 773 + extack = netdev_notifier_info_to_extack(info); 774 + cu_info = container_of(info, 775 + struct netdev_notifier_changeupper_info, 776 + info); 778 777 779 778 switch (event) { 780 779 case NETDEV_PRECHANGEUPPER: 780 + upper = cu_info->upper_dev; 781 781 if (!netif_is_bridge_master(upper) && 782 782 !netif_is_lag_master(upper)) { 783 783 NL_SET_ERR_MSG_MOD(extack, "Unknown upper device type"); 784 784 return -EINVAL; 785 785 } 786 786 787 - if (!info->linking) 787 + if (!cu_info->linking) 788 788 break; 789 789 790 790 if (netdev_has_any_upper_dev(upper)) { ··· 797 789 } 798 790 799 791 if (netif_is_lag_master(upper) && 800 - !prestera_lag_master_check(upper, info->upper_info, extack)) 792 + !prestera_lag_master_check(upper, cu_info->upper_info, extack)) 801 793 return -EOPNOTSUPP; 802 794 if (netif_is_lag_master(upper) && vlan_uses_dev(dev)) { 803 795 NL_SET_ERR_MSG_MOD(extack, ··· 813 805 break; 814 806 815 807 case NETDEV_CHANGEUPPER: 808 + upper = cu_info->upper_dev; 816 809 if (netif_is_bridge_master(upper)) { 817 - if (info->linking) 810 + if (cu_info->linking) 818 811 return prestera_bridge_port_join(upper, port, 819 812 extack); 820 813 else 821 814 prestera_bridge_port_leave(upper, port); 822 815 } else if (netif_is_lag_master(upper)) { 823 - if (info->linking) 816 + if (cu_info->linking) 824 817 return prestera_lag_port_add(port, upper); 825 818 else 826 819 prestera_lag_port_del(port);
+2
drivers/net/ethernet/micrel/ks8851_par.c
··· 321 321 return ret; 322 322 323 323 netdev->irq = platform_get_irq(pdev, 0); 324 + if (netdev->irq < 0) 325 + return netdev->irq; 324 326 325 327 return ks8851_probe_common(netdev, dev, msg_enable); 326 328 }
+1 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h
··· 201 201 struct qlcnic_info *, u16); 202 202 int qlcnic_sriov_cfg_vf_guest_vlan(struct qlcnic_adapter *, u16, u8); 203 203 void qlcnic_sriov_free_vlans(struct qlcnic_adapter *); 204 - void qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *); 204 + int qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *); 205 205 bool qlcnic_sriov_check_any_vlan(struct qlcnic_vf_info *); 206 206 void qlcnic_sriov_del_vlan_id(struct qlcnic_sriov *, 207 207 struct qlcnic_vf_info *, u16);
+9 -3
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
··· 432 432 struct qlcnic_cmd_args *cmd) 433 433 { 434 434 struct qlcnic_sriov *sriov = adapter->ahw->sriov; 435 - int i, num_vlans; 435 + int i, num_vlans, ret; 436 436 u16 *vlans; 437 437 438 438 if (sriov->allowed_vlans) ··· 443 443 dev_info(&adapter->pdev->dev, "Number of allowed Guest VLANs = %d\n", 444 444 sriov->num_allowed_vlans); 445 445 446 - qlcnic_sriov_alloc_vlans(adapter); 446 + ret = qlcnic_sriov_alloc_vlans(adapter); 447 + if (ret) 448 + return ret; 447 449 448 450 if (!sriov->any_vlan) 449 451 return 0; ··· 2156 2154 return err; 2157 2155 } 2158 2156 2159 - void qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *adapter) 2157 + int qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *adapter) 2160 2158 { 2161 2159 struct qlcnic_sriov *sriov = adapter->ahw->sriov; 2162 2160 struct qlcnic_vf_info *vf; ··· 2166 2164 vf = &sriov->vf_info[i]; 2167 2165 vf->sriov_vlans = kcalloc(sriov->num_allowed_vlans, 2168 2166 sizeof(*vf->sriov_vlans), GFP_KERNEL); 2167 + if (!vf->sriov_vlans) 2168 + return -ENOMEM; 2169 2169 } 2170 + 2171 + return 0; 2170 2172 } 2171 2173 2172 2174 void qlcnic_sriov_free_vlans(struct qlcnic_adapter *adapter)
+3 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
··· 597 597 if (err) 598 598 goto del_flr_queue; 599 599 600 - qlcnic_sriov_alloc_vlans(adapter); 600 + err = qlcnic_sriov_alloc_vlans(adapter); 601 + if (err) 602 + goto del_flr_queue; 601 603 602 604 return err; 603 605
+4 -1
drivers/net/ethernet/sfc/falcon/rx.c
··· 728 728 efx->rx_bufs_per_page); 729 729 rx_queue->page_ring = kcalloc(page_ring_size, 730 730 sizeof(*rx_queue->page_ring), GFP_KERNEL); 731 - rx_queue->page_ptr_mask = page_ring_size - 1; 731 + if (!rx_queue->page_ring) 732 + rx_queue->page_ptr_mask = 0; 733 + else 734 + rx_queue->page_ptr_mask = page_ring_size - 1; 732 735 } 733 736 734 737 void ef4_init_rx_queue(struct ef4_rx_queue *rx_queue)
+4 -1
drivers/net/ethernet/sfc/rx_common.c
··· 150 150 efx->rx_bufs_per_page); 151 151 rx_queue->page_ring = kcalloc(page_ring_size, 152 152 sizeof(*rx_queue->page_ring), GFP_KERNEL); 153 - rx_queue->page_ptr_mask = page_ring_size - 1; 153 + if (!rx_queue->page_ring) 154 + rx_queue->page_ptr_mask = 0; 155 + else 156 + rx_queue->page_ptr_mask = page_ring_size - 1; 154 157 } 155 158 156 159 static void efx_fini_rx_recycle_ring(struct efx_rx_queue *rx_queue)
+5
drivers/net/ethernet/smsc/smc911x.c
··· 2072 2072 2073 2073 ndev->dma = (unsigned char)-1; 2074 2074 ndev->irq = platform_get_irq(pdev, 0); 2075 + if (ndev->irq < 0) { 2076 + ret = ndev->irq; 2077 + goto release_both; 2078 + } 2079 + 2075 2080 lp = netdev_priv(ndev); 2076 2081 lp->netdev = ndev; 2077 2082 #ifdef SMC_DYNAMIC_BUS_CONFIG
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
··· 26 26 #define ETHER_CLK_SEL_FREQ_SEL_125M (BIT(9) | BIT(8)) 27 27 #define ETHER_CLK_SEL_FREQ_SEL_50M BIT(9) 28 28 #define ETHER_CLK_SEL_FREQ_SEL_25M BIT(8) 29 - #define ETHER_CLK_SEL_FREQ_SEL_2P5M BIT(0) 29 + #define ETHER_CLK_SEL_FREQ_SEL_2P5M 0 30 30 #define ETHER_CLK_SEL_TX_CLK_EXT_SEL_IN BIT(0) 31 31 #define ETHER_CLK_SEL_TX_CLK_EXT_SEL_TXC BIT(10) 32 32 #define ETHER_CLK_SEL_TX_CLK_EXT_SEL_DIV BIT(11)
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
··· 102 102 time.tv_nsec = priv->plat->est->btr_reserve[0]; 103 103 time.tv_sec = priv->plat->est->btr_reserve[1]; 104 104 basetime = timespec64_to_ktime(time); 105 - cycle_time = priv->plat->est->ctr[1] * NSEC_PER_SEC + 105 + cycle_time = (u64)priv->plat->est->ctr[1] * NSEC_PER_SEC + 106 106 priv->plat->est->ctr[0]; 107 107 time = stmmac_calc_tas_basetime(basetime, 108 108 current_time_ns,
+5
drivers/net/fjes/fjes_main.c
··· 1262 1262 hw->hw_res.start = res->start; 1263 1263 hw->hw_res.size = resource_size(res); 1264 1264 hw->hw_res.irq = platform_get_irq(plat_dev, 0); 1265 + if (hw->hw_res.irq < 0) { 1266 + err = hw->hw_res.irq; 1267 + goto err_free_control_wq; 1268 + } 1269 + 1265 1270 err = fjes_hw_init(&adapter->hw); 1266 1271 if (err) 1267 1272 goto err_free_control_wq;
+2 -2
drivers/net/hamradio/mkiss.c
··· 794 794 */ 795 795 netif_stop_queue(ax->dev); 796 796 797 - ax->tty = NULL; 798 - 799 797 unregister_netdev(ax->dev); 800 798 801 799 /* Free all AX25 frame buffers after unreg. */ 802 800 kfree(ax->rbuff); 803 801 kfree(ax->xbuff); 802 + 803 + ax->tty = NULL; 804 804 805 805 free_netdev(ax->dev); 806 806 }
+59 -56
drivers/net/tun.c
··· 209 209 struct tun_prog __rcu *steering_prog; 210 210 struct tun_prog __rcu *filter_prog; 211 211 struct ethtool_link_ksettings link_ksettings; 212 + /* init args */ 213 + struct file *file; 214 + struct ifreq *ifr; 212 215 }; 213 216 214 217 struct veth { 215 218 __be16 h_vlan_proto; 216 219 __be16 h_vlan_TCI; 217 220 }; 221 + 222 + static void tun_flow_init(struct tun_struct *tun); 223 + static void tun_flow_uninit(struct tun_struct *tun); 218 224 219 225 static int tun_napi_receive(struct napi_struct *napi, int budget) 220 226 { ··· 959 953 960 954 static const struct ethtool_ops tun_ethtool_ops; 961 955 956 + static int tun_net_init(struct net_device *dev) 957 + { 958 + struct tun_struct *tun = netdev_priv(dev); 959 + struct ifreq *ifr = tun->ifr; 960 + int err; 961 + 962 + dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 963 + if (!dev->tstats) 964 + return -ENOMEM; 965 + 966 + spin_lock_init(&tun->lock); 967 + 968 + err = security_tun_dev_alloc_security(&tun->security); 969 + if (err < 0) { 970 + free_percpu(dev->tstats); 971 + return err; 972 + } 973 + 974 + tun_flow_init(tun); 975 + 976 + dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | 977 + TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | 978 + NETIF_F_HW_VLAN_STAG_TX; 979 + dev->features = dev->hw_features | NETIF_F_LLTX; 980 + dev->vlan_features = dev->features & 981 + ~(NETIF_F_HW_VLAN_CTAG_TX | 982 + NETIF_F_HW_VLAN_STAG_TX); 983 + 984 + tun->flags = (tun->flags & ~TUN_FEATURES) | 985 + (ifr->ifr_flags & TUN_FEATURES); 986 + 987 + INIT_LIST_HEAD(&tun->disabled); 988 + err = tun_attach(tun, tun->file, false, ifr->ifr_flags & IFF_NAPI, 989 + ifr->ifr_flags & IFF_NAPI_FRAGS, false); 990 + if (err < 0) { 991 + tun_flow_uninit(tun); 992 + security_tun_dev_free_security(tun->security); 993 + free_percpu(dev->tstats); 994 + return err; 995 + } 996 + return 0; 997 + } 998 + 962 999 /* Net device detach from fd. */ 963 1000 static void tun_net_uninit(struct net_device *dev) 964 1001 { ··· 1218 1169 } 1219 1170 1220 1171 static const struct net_device_ops tun_netdev_ops = { 1172 + .ndo_init = tun_net_init, 1221 1173 .ndo_uninit = tun_net_uninit, 1222 1174 .ndo_open = tun_net_open, 1223 1175 .ndo_stop = tun_net_close, ··· 1302 1252 } 1303 1253 1304 1254 static const struct net_device_ops tap_netdev_ops = { 1255 + .ndo_init = tun_net_init, 1305 1256 .ndo_uninit = tun_net_uninit, 1306 1257 .ndo_open = tun_net_open, 1307 1258 .ndo_stop = tun_net_close, ··· 1343 1292 #define MAX_MTU 65535 1344 1293 1345 1294 /* Initialize net device. */ 1346 - static void tun_net_init(struct net_device *dev) 1295 + static void tun_net_initialize(struct net_device *dev) 1347 1296 { 1348 1297 struct tun_struct *tun = netdev_priv(dev); 1349 1298 ··· 2257 2206 BUG_ON(!(list_empty(&tun->disabled))); 2258 2207 2259 2208 free_percpu(dev->tstats); 2260 - /* We clear tstats so that tun_set_iff() can tell if 2261 - * tun_free_netdev() has been called from register_netdevice(). 2262 - */ 2263 - dev->tstats = NULL; 2264 - 2265 2209 tun_flow_uninit(tun); 2266 2210 security_tun_dev_free_security(tun->security); 2267 2211 __tun_set_ebpf(tun, &tun->steering_prog, NULL); ··· 2762 2716 tun->rx_batched = 0; 2763 2717 RCU_INIT_POINTER(tun->steering_prog, NULL); 2764 2718 2765 - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 2766 - if (!dev->tstats) { 2767 - err = -ENOMEM; 2768 - goto err_free_dev; 2769 - } 2719 + tun->ifr = ifr; 2720 + tun->file = file; 2770 2721 2771 - spin_lock_init(&tun->lock); 2772 - 2773 - err = security_tun_dev_alloc_security(&tun->security); 2774 - if (err < 0) 2775 - goto err_free_stat; 2776 - 2777 - tun_net_init(dev); 2778 - tun_flow_init(tun); 2779 - 2780 - dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | 2781 - TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | 2782 - NETIF_F_HW_VLAN_STAG_TX; 2783 - dev->features = dev->hw_features | NETIF_F_LLTX; 2784 - dev->vlan_features = dev->features & 2785 - ~(NETIF_F_HW_VLAN_CTAG_TX | 2786 - NETIF_F_HW_VLAN_STAG_TX); 2787 - 2788 - tun->flags = (tun->flags & ~TUN_FEATURES) | 2789 - (ifr->ifr_flags & TUN_FEATURES); 2790 - 2791 - INIT_LIST_HEAD(&tun->disabled); 2792 - err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI, 2793 - ifr->ifr_flags & IFF_NAPI_FRAGS, false); 2794 - if (err < 0) 2795 - goto err_free_flow; 2722 + tun_net_initialize(dev); 2796 2723 2797 2724 err = register_netdevice(tun->dev); 2798 - if (err < 0) 2799 - goto err_detach; 2725 + if (err < 0) { 2726 + free_netdev(dev); 2727 + return err; 2728 + } 2800 2729 /* free_netdev() won't check refcnt, to avoid race 2801 2730 * with dev_put() we need publish tun after registration. 2802 2731 */ ··· 2788 2767 2789 2768 strcpy(ifr->ifr_name, tun->dev->name); 2790 2769 return 0; 2791 - 2792 - err_detach: 2793 - tun_detach_all(dev); 2794 - /* We are here because register_netdevice() has failed. 2795 - * If register_netdevice() already called tun_free_netdev() 2796 - * while dealing with the error, dev->stats has been cleared. 2797 - */ 2798 - if (!dev->tstats) 2799 - goto err_free_dev; 2800 - 2801 - err_free_flow: 2802 - tun_flow_uninit(tun); 2803 - security_tun_dev_free_security(tun->security); 2804 - err_free_stat: 2805 - free_percpu(dev->tstats); 2806 - err_free_dev: 2807 - free_netdev(dev); 2808 - return err; 2809 2770 } 2810 2771 2811 2772 static void tun_get_iff(struct tun_struct *tun, struct ifreq *ifr)
+5 -3
drivers/net/usb/asix_common.c
··· 9 9 10 10 #include "asix.h" 11 11 12 + #define AX_HOST_EN_RETRIES 30 13 + 12 14 int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, 13 15 u16 size, void *data, int in_pm) 14 16 { ··· 70 68 int i, ret; 71 69 u8 smsr; 72 70 73 - for (i = 0; i < 30; ++i) { 71 + for (i = 0; i < AX_HOST_EN_RETRIES; ++i) { 74 72 ret = asix_set_sw_mii(dev, in_pm); 75 73 if (ret == -ENODEV || ret == -ETIMEDOUT) 76 74 break; ··· 79 77 0, 0, 1, &smsr, in_pm); 80 78 if (ret == -ENODEV) 81 79 break; 82 - else if (ret < 0) 80 + else if (ret < sizeof(smsr)) 83 81 continue; 84 82 else if (smsr & AX_HOST_EN) 85 83 break; 86 84 } 87 85 88 - return ret; 86 + return i >= AX_HOST_EN_RETRIES ? -ETIMEDOUT : ret; 89 87 } 90 88 91 89 static void reset_asix_rx_fixup_info(struct asix_rx_fixup_info *rx)
+39 -4
drivers/net/usb/r8152.c
··· 32 32 #define NETNEXT_VERSION "12" 33 33 34 34 /* Information for net */ 35 - #define NET_VERSION "11" 35 + #define NET_VERSION "12" 36 36 37 37 #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION 38 38 #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" ··· 4016 4016 ocp_write_word(tp, type, PLA_BP_BA, 0); 4017 4017 } 4018 4018 4019 + static inline void rtl_reset_ocp_base(struct r8152 *tp) 4020 + { 4021 + tp->ocp_base = -1; 4022 + } 4023 + 4019 4024 static int rtl_phy_patch_request(struct r8152 *tp, bool request, bool wait) 4020 4025 { 4021 4026 u16 data, check; ··· 4091 4086 rtl_patch_key_set(tp, key_addr, 0); 4092 4087 4093 4088 rtl_phy_patch_request(tp, false, wait); 4094 - 4095 - ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, tp->ocp_base); 4096 4089 4097 4090 return 0; 4098 4091 } ··· 4803 4800 u32 len; 4804 4801 u8 *data; 4805 4802 4803 + rtl_reset_ocp_base(tp); 4804 + 4806 4805 if (sram_read(tp, SRAM_GPHY_FW_VER) >= __le16_to_cpu(phy->version)) { 4807 4806 dev_dbg(&tp->intf->dev, "PHY firmware has been the newest\n"); 4808 4807 return; ··· 4850 4845 } 4851 4846 } 4852 4847 4853 - ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, tp->ocp_base); 4848 + rtl_reset_ocp_base(tp); 4849 + 4854 4850 rtl_phy_patch_request(tp, false, wait); 4855 4851 4856 4852 if (sram_read(tp, SRAM_GPHY_FW_VER) == __le16_to_cpu(phy->version)) ··· 4866 4860 4867 4861 ver_addr = __le16_to_cpu(phy_ver->ver.addr); 4868 4862 ver = __le16_to_cpu(phy_ver->ver.data); 4863 + 4864 + rtl_reset_ocp_base(tp); 4869 4865 4870 4866 if (sram_read(tp, ver_addr) >= ver) { 4871 4867 dev_dbg(&tp->intf->dev, "PHY firmware has been the newest\n"); ··· 4884 4876 static void rtl8152_fw_phy_fixup(struct r8152 *tp, struct fw_phy_fixup *fix) 4885 4877 { 4886 4878 u16 addr, data; 4879 + 4880 + rtl_reset_ocp_base(tp); 4887 4881 4888 4882 addr = __le16_to_cpu(fix->setting.addr); 4889 4883 data = ocp_reg_read(tp, addr); ··· 4918 4908 u32 length; 4919 4909 int i, num; 4920 4910 4911 + rtl_reset_ocp_base(tp); 4912 + 4921 4913 num = phy->pre_num; 4922 4914 for (i = 0; i < num; i++) 4923 4915 sram_write(tp, __le16_to_cpu(phy->pre_set[i].addr), ··· 4949 4937 u16 mode_reg, bp_index; 4950 4938 u32 length, i, num; 4951 4939 __le16 *data; 4940 + 4941 + rtl_reset_ocp_base(tp); 4952 4942 4953 4943 mode_reg = __le16_to_cpu(phy->mode_reg); 4954 4944 sram_write(tp, mode_reg, __le16_to_cpu(phy->mode_pre)); ··· 5121 5107 if (rtl_fw->post_fw) 5122 5108 rtl_fw->post_fw(tp); 5123 5109 5110 + rtl_reset_ocp_base(tp); 5124 5111 strscpy(rtl_fw->version, fw_hdr->version, RTL_VER_SIZE); 5125 5112 dev_info(&tp->intf->dev, "load %s successfully\n", rtl_fw->version); 5126 5113 } ··· 6599 6584 return true; 6600 6585 } 6601 6586 6587 + static void r8156_mdio_force_mode(struct r8152 *tp) 6588 + { 6589 + u16 data; 6590 + 6591 + /* Select force mode through 0xa5b4 bit 15 6592 + * 0: MDIO force mode 6593 + * 1: MMD force mode 6594 + */ 6595 + data = ocp_reg_read(tp, 0xa5b4); 6596 + if (data & BIT(15)) { 6597 + data &= ~BIT(15); 6598 + ocp_reg_write(tp, 0xa5b4, data); 6599 + } 6600 + } 6601 + 6602 6602 static void set_carrier(struct r8152 *tp) 6603 6603 { 6604 6604 struct net_device *netdev = tp->netdev; ··· 8046 8016 ocp_data |= ACT_ODMA; 8047 8017 ocp_write_byte(tp, MCU_TYPE_USB, USB_BMU_CONFIG, ocp_data); 8048 8018 8019 + r8156_mdio_force_mode(tp); 8049 8020 rtl_tally_reset(tp); 8050 8021 8051 8022 tp->coalesce = 15000; /* 15 us */ ··· 8176 8145 ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); 8177 8146 ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); 8178 8147 8148 + r8156_mdio_force_mode(tp); 8179 8149 rtl_tally_reset(tp); 8180 8150 8181 8151 tp->coalesce = 15000; /* 15 us */ ··· 8499 8467 8500 8468 mutex_lock(&tp->control); 8501 8469 8470 + rtl_reset_ocp_base(tp); 8471 + 8502 8472 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) 8503 8473 ret = rtl8152_runtime_resume(tp); 8504 8474 else ··· 8516 8482 struct r8152 *tp = usb_get_intfdata(intf); 8517 8483 8518 8484 clear_bit(SELECTIVE_SUSPEND, &tp->flags); 8485 + rtl_reset_ocp_base(tp); 8519 8486 tp->rtl_ops.init(tp); 8520 8487 queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0); 8521 8488 set_ethernet_addr(tp, true);
+6 -2
drivers/net/veth.c
··· 879 879 880 880 stats->xdp_bytes += skb->len; 881 881 skb = veth_xdp_rcv_skb(rq, skb, bq, stats); 882 - if (skb) 883 - napi_gro_receive(&rq->xdp_napi, skb); 882 + if (skb) { 883 + if (skb_shared(skb) || skb_unclone(skb, GFP_ATOMIC)) 884 + netif_receive_skb(skb); 885 + else 886 + napi_gro_receive(&rq->xdp_napi, skb); 887 + } 884 888 } 885 889 done++; 886 890 }
+1 -1
include/linux/netdevice.h
··· 1937 1937 * @udp_tunnel_nic: UDP tunnel offload state 1938 1938 * @xdp_state: stores info on attached XDP BPF programs 1939 1939 * 1940 - * @nested_level: Used as as a parameter of spin_lock_nested() of 1940 + * @nested_level: Used as a parameter of spin_lock_nested() of 1941 1941 * dev->addr_list_lock. 1942 1942 * @unlink_list: As netif_addr_lock() can be called recursively, 1943 1943 * keep a list of interfaces to be deleted.
+2 -1
include/linux/skbuff.h
··· 286 286 struct tc_skb_ext { 287 287 __u32 chain; 288 288 __u16 mru; 289 + __u16 zone; 289 290 bool post_ct; 290 291 }; 291 292 #endif ··· 1381 1380 struct flow_dissector *flow_dissector, 1382 1381 void *target_container, 1383 1382 u16 *ctinfo_map, size_t mapsize, 1384 - bool post_ct); 1383 + bool post_ct, u16 zone); 1385 1384 void 1386 1385 skb_flow_dissect_tunnel_info(const struct sk_buff *skb, 1387 1386 struct flow_dissector *flow_dissector,
+23 -2
include/linux/virtio_net.h
··· 7 7 #include <uapi/linux/udp.h> 8 8 #include <uapi/linux/virtio_net.h> 9 9 10 + static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type) 11 + { 12 + switch (gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { 13 + case VIRTIO_NET_HDR_GSO_TCPV4: 14 + return protocol == cpu_to_be16(ETH_P_IP); 15 + case VIRTIO_NET_HDR_GSO_TCPV6: 16 + return protocol == cpu_to_be16(ETH_P_IPV6); 17 + case VIRTIO_NET_HDR_GSO_UDP: 18 + return protocol == cpu_to_be16(ETH_P_IP) || 19 + protocol == cpu_to_be16(ETH_P_IPV6); 20 + default: 21 + return false; 22 + } 23 + } 24 + 10 25 static inline int virtio_net_hdr_set_proto(struct sk_buff *skb, 11 26 const struct virtio_net_hdr *hdr) 12 27 { 28 + if (skb->protocol) 29 + return 0; 30 + 13 31 switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { 14 32 case VIRTIO_NET_HDR_GSO_TCPV4: 15 33 case VIRTIO_NET_HDR_GSO_UDP: ··· 106 88 if (!skb->protocol) { 107 89 __be16 protocol = dev_parse_header_protocol(skb); 108 90 109 - virtio_net_hdr_set_proto(skb, hdr); 110 - if (protocol && protocol != skb->protocol) 91 + if (!protocol) 92 + virtio_net_hdr_set_proto(skb, hdr); 93 + else if (!virtio_net_hdr_match_proto(protocol, hdr->gso_type)) 111 94 return -EINVAL; 95 + else 96 + skb->protocol = protocol; 112 97 } 113 98 retry: 114 99 if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys,
+16
include/net/pkt_sched.h
··· 193 193 skb->tstamp = ktime_set(0, 0); 194 194 } 195 195 196 + struct tc_skb_cb { 197 + struct qdisc_skb_cb qdisc_cb; 198 + 199 + u16 mru; 200 + bool post_ct; 201 + u16 zone; /* Only valid if post_ct = true */ 202 + }; 203 + 204 + static inline struct tc_skb_cb *tc_skb_cb(const struct sk_buff *skb) 205 + { 206 + struct tc_skb_cb *cb = (struct tc_skb_cb *)skb->cb; 207 + 208 + BUILD_BUG_ON(sizeof(*cb) > sizeof_field(struct sk_buff, cb)); 209 + return cb; 210 + } 211 + 196 212 #endif
-2
include/net/sch_generic.h
··· 447 447 }; 448 448 #define QDISC_CB_PRIV_LEN 20 449 449 unsigned char data[QDISC_CB_PRIV_LEN]; 450 - u16 mru; 451 - bool post_ct; 452 450 }; 453 451 454 452 typedef void tcf_chain_head_change_t(struct tcf_proto *tp_head, void *priv);
+1 -1
include/net/sock.h
··· 431 431 #ifdef CONFIG_XFRM 432 432 struct xfrm_policy __rcu *sk_policy[2]; 433 433 #endif 434 - struct dst_entry *sk_rx_dst; 434 + struct dst_entry __rcu *sk_rx_dst; 435 435 int sk_rx_dst_ifindex; 436 436 u32 sk_rx_dst_cookie; 437 437
+3 -1
net/ax25/af_ax25.c
··· 85 85 again: 86 86 ax25_for_each(s, &ax25_list) { 87 87 if (s->ax25_dev == ax25_dev) { 88 - s->ax25_dev = NULL; 89 88 spin_unlock_bh(&ax25_list_lock); 89 + lock_sock(s->sk); 90 + s->ax25_dev = NULL; 91 + release_sock(s->sk); 90 92 ax25_disconnect(s, ENETUNREACH); 91 93 spin_lock_bh(&ax25_list_lock); 92 94
+1 -1
net/bridge/br_ioctl.c
··· 337 337 338 338 args[2] = get_bridge_ifindices(net, indices, args[2]); 339 339 340 - ret = copy_to_user(uarg, indices, 340 + ret = copy_to_user((void __user *)args[1], indices, 341 341 array_size(args[2], sizeof(int))) 342 342 ? -EFAULT : args[2]; 343 343
+4 -4
net/core/dev.c
··· 3941 3941 return skb; 3942 3942 3943 3943 /* qdisc_skb_cb(skb)->pkt_len was already set by the caller. */ 3944 - qdisc_skb_cb(skb)->mru = 0; 3945 - qdisc_skb_cb(skb)->post_ct = false; 3944 + tc_skb_cb(skb)->mru = 0; 3945 + tc_skb_cb(skb)->post_ct = false; 3946 3946 mini_qdisc_bstats_cpu_update(miniq, skb); 3947 3947 3948 3948 switch (tcf_classify(skb, miniq->block, miniq->filter_list, &cl_res, false)) { ··· 5103 5103 } 5104 5104 5105 5105 qdisc_skb_cb(skb)->pkt_len = skb->len; 5106 - qdisc_skb_cb(skb)->mru = 0; 5107 - qdisc_skb_cb(skb)->post_ct = false; 5106 + tc_skb_cb(skb)->mru = 0; 5107 + tc_skb_cb(skb)->post_ct = false; 5108 5108 skb->tc_at_ingress = 1; 5109 5109 mini_qdisc_bstats_cpu_update(miniq, skb); 5110 5110
+2 -1
net/core/flow_dissector.c
··· 238 238 skb_flow_dissect_ct(const struct sk_buff *skb, 239 239 struct flow_dissector *flow_dissector, 240 240 void *target_container, u16 *ctinfo_map, 241 - size_t mapsize, bool post_ct) 241 + size_t mapsize, bool post_ct, u16 zone) 242 242 { 243 243 #if IS_ENABLED(CONFIG_NF_CONNTRACK) 244 244 struct flow_dissector_key_ct *key; ··· 260 260 if (!ct) { 261 261 key->ct_state = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | 262 262 TCA_FLOWER_KEY_CT_FLAGS_INVALID; 263 + key->ct_zone = zone; 263 264 return; 264 265 } 265 266
+5 -1
net/dsa/tag_ocelot.c
··· 47 47 void *injection; 48 48 __be32 *prefix; 49 49 u32 rew_op = 0; 50 + u64 qos_class; 50 51 51 52 ocelot_xmit_get_vlan_info(skb, dp, &vlan_tci, &tag_type); 53 + 54 + qos_class = netdev_get_num_tc(netdev) ? 55 + netdev_get_prio_tc_map(netdev, skb->priority) : skb->priority; 52 56 53 57 injection = skb_push(skb, OCELOT_TAG_LEN); 54 58 prefix = skb_push(skb, OCELOT_SHORT_PREFIX_LEN); ··· 61 57 memset(injection, 0, OCELOT_TAG_LEN); 62 58 ocelot_ifh_set_bypass(injection, 1); 63 59 ocelot_ifh_set_src(injection, ds->num_ports); 64 - ocelot_ifh_set_qos_class(injection, skb->priority); 60 + ocelot_ifh_set_qos_class(injection, qos_class); 65 61 ocelot_ifh_set_vlan_tci(injection, vlan_tci); 66 62 ocelot_ifh_set_tag_type(injection, tag_type); 67 63
+1 -1
net/ipv4/af_inet.c
··· 154 154 155 155 kfree(rcu_dereference_protected(inet->inet_opt, 1)); 156 156 dst_release(rcu_dereference_protected(sk->sk_dst_cache, 1)); 157 - dst_release(sk->sk_rx_dst); 157 + dst_release(rcu_dereference_protected(sk->sk_rx_dst, 1)); 158 158 sk_refcnt_debug_dec(sk); 159 159 } 160 160 EXPORT_SYMBOL(inet_sock_destruct);
+1 -2
net/ipv4/tcp.c
··· 3012 3012 icsk->icsk_ack.rcv_mss = TCP_MIN_MSS; 3013 3013 memset(&tp->rx_opt, 0, sizeof(tp->rx_opt)); 3014 3014 __sk_dst_reset(sk); 3015 - dst_release(sk->sk_rx_dst); 3016 - sk->sk_rx_dst = NULL; 3015 + dst_release(xchg((__force struct dst_entry **)&sk->sk_rx_dst, NULL)); 3017 3016 tcp_saved_syn_free(tp); 3018 3017 tp->compressed_ack = 0; 3019 3018 tp->segs_in = 0;
+1 -1
net/ipv4/tcp_input.c
··· 5787 5787 trace_tcp_probe(sk, skb); 5788 5788 5789 5789 tcp_mstamp_refresh(tp); 5790 - if (unlikely(!sk->sk_rx_dst)) 5790 + if (unlikely(!rcu_access_pointer(sk->sk_rx_dst))) 5791 5791 inet_csk(sk)->icsk_af_ops->sk_rx_dst_set(sk, skb); 5792 5792 /* 5793 5793 * Header prediction.
+7 -4
net/ipv4/tcp_ipv4.c
··· 1701 1701 struct sock *rsk; 1702 1702 1703 1703 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ 1704 - struct dst_entry *dst = sk->sk_rx_dst; 1704 + struct dst_entry *dst; 1705 + 1706 + dst = rcu_dereference_protected(sk->sk_rx_dst, 1707 + lockdep_sock_is_held(sk)); 1705 1708 1706 1709 sock_rps_save_rxhash(sk, skb); 1707 1710 sk_mark_napi_id(sk, skb); ··· 1712 1709 if (sk->sk_rx_dst_ifindex != skb->skb_iif || 1713 1710 !INDIRECT_CALL_1(dst->ops->check, ipv4_dst_check, 1714 1711 dst, 0)) { 1712 + RCU_INIT_POINTER(sk->sk_rx_dst, NULL); 1715 1713 dst_release(dst); 1716 - sk->sk_rx_dst = NULL; 1717 1714 } 1718 1715 } 1719 1716 tcp_rcv_established(sk, skb); ··· 1789 1786 skb->sk = sk; 1790 1787 skb->destructor = sock_edemux; 1791 1788 if (sk_fullsock(sk)) { 1792 - struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst); 1789 + struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); 1793 1790 1794 1791 if (dst) 1795 1792 dst = dst_check(dst, 0); ··· 2204 2201 struct dst_entry *dst = skb_dst(skb); 2205 2202 2206 2203 if (dst && dst_hold_safe(dst)) { 2207 - sk->sk_rx_dst = dst; 2204 + rcu_assign_pointer(sk->sk_rx_dst, dst); 2208 2205 sk->sk_rx_dst_ifindex = skb->skb_iif; 2209 2206 } 2210 2207 }
+3 -3
net/ipv4/udp.c
··· 2250 2250 struct dst_entry *old; 2251 2251 2252 2252 if (dst_hold_safe(dst)) { 2253 - old = xchg(&sk->sk_rx_dst, dst); 2253 + old = xchg((__force struct dst_entry **)&sk->sk_rx_dst, dst); 2254 2254 dst_release(old); 2255 2255 return old != dst; 2256 2256 } ··· 2440 2440 struct dst_entry *dst = skb_dst(skb); 2441 2441 int ret; 2442 2442 2443 - if (unlikely(sk->sk_rx_dst != dst)) 2443 + if (unlikely(rcu_dereference(sk->sk_rx_dst) != dst)) 2444 2444 udp_sk_rx_dst_set(sk, dst); 2445 2445 2446 2446 ret = udp_unicast_rcv_skb(sk, skb, uh); ··· 2599 2599 2600 2600 skb->sk = sk; 2601 2601 skb->destructor = sock_efree; 2602 - dst = READ_ONCE(sk->sk_rx_dst); 2602 + dst = rcu_dereference(sk->sk_rx_dst); 2603 2603 2604 2604 if (dst) 2605 2605 dst = dst_check(dst, 0);
+7 -4
net/ipv6/tcp_ipv6.c
··· 107 107 if (dst && dst_hold_safe(dst)) { 108 108 const struct rt6_info *rt = (const struct rt6_info *)dst; 109 109 110 - sk->sk_rx_dst = dst; 110 + rcu_assign_pointer(sk->sk_rx_dst, dst); 111 111 sk->sk_rx_dst_ifindex = skb->skb_iif; 112 112 sk->sk_rx_dst_cookie = rt6_get_cookie(rt); 113 113 } ··· 1505 1505 opt_skb = skb_clone(skb, sk_gfp_mask(sk, GFP_ATOMIC)); 1506 1506 1507 1507 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ 1508 - struct dst_entry *dst = sk->sk_rx_dst; 1508 + struct dst_entry *dst; 1509 + 1510 + dst = rcu_dereference_protected(sk->sk_rx_dst, 1511 + lockdep_sock_is_held(sk)); 1509 1512 1510 1513 sock_rps_save_rxhash(sk, skb); 1511 1514 sk_mark_napi_id(sk, skb); ··· 1516 1513 if (sk->sk_rx_dst_ifindex != skb->skb_iif || 1517 1514 INDIRECT_CALL_1(dst->ops->check, ip6_dst_check, 1518 1515 dst, sk->sk_rx_dst_cookie) == NULL) { 1516 + RCU_INIT_POINTER(sk->sk_rx_dst, NULL); 1519 1517 dst_release(dst); 1520 - sk->sk_rx_dst = NULL; 1521 1518 } 1522 1519 } 1523 1520 ··· 1877 1874 skb->sk = sk; 1878 1875 skb->destructor = sock_edemux; 1879 1876 if (sk_fullsock(sk)) { 1880 - struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst); 1877 + struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); 1881 1878 1882 1879 if (dst) 1883 1880 dst = dst_check(dst, sk->sk_rx_dst_cookie);
+2 -2
net/ipv6/udp.c
··· 956 956 struct dst_entry *dst = skb_dst(skb); 957 957 int ret; 958 958 959 - if (unlikely(sk->sk_rx_dst != dst)) 959 + if (unlikely(rcu_dereference(sk->sk_rx_dst) != dst)) 960 960 udp6_sk_rx_dst_set(sk, dst); 961 961 962 962 if (!uh->check && !udp_sk(sk)->no_check6_rx) { ··· 1070 1070 1071 1071 skb->sk = sk; 1072 1072 skb->destructor = sock_efree; 1073 - dst = READ_ONCE(sk->sk_rx_dst); 1073 + dst = rcu_dereference(sk->sk_rx_dst); 1074 1074 1075 1075 if (dst) 1076 1076 dst = dst_check(dst, sk->sk_rx_dst_cookie);
+3
net/mac80211/cfg.c
··· 1264 1264 return 0; 1265 1265 1266 1266 error: 1267 + mutex_lock(&local->mtx); 1267 1268 ieee80211_vif_release_channel(sdata); 1269 + mutex_unlock(&local->mtx); 1270 + 1268 1271 return err; 1269 1272 } 1270 1273
+3 -2
net/netfilter/nf_conntrack_netlink.c
··· 1195 1195 } 1196 1196 hlist_nulls_for_each_entry(h, n, &nf_conntrack_hash[cb->args[0]], 1197 1197 hnnode) { 1198 - if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL) 1199 - continue; 1200 1198 ct = nf_ct_tuplehash_to_ctrack(h); 1201 1199 if (nf_ct_is_expired(ct)) { 1202 1200 if (i < ARRAY_SIZE(nf_ct_evict) && ··· 1204 1206 } 1205 1207 1206 1208 if (!net_eq(net, nf_ct_net(ct))) 1209 + continue; 1210 + 1211 + if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL) 1207 1212 continue; 1208 1213 1209 1214 if (cb->args[1]) {
+2 -2
net/netfilter/nf_tables_api.c
··· 4481 4481 static void nft_set_catchall_destroy(const struct nft_ctx *ctx, 4482 4482 struct nft_set *set) 4483 4483 { 4484 - struct nft_set_elem_catchall *catchall; 4484 + struct nft_set_elem_catchall *next, *catchall; 4485 4485 4486 - list_for_each_entry_rcu(catchall, &set->catchall_list, list) { 4486 + list_for_each_entry_safe(catchall, next, &set->catchall_list, list) { 4487 4487 list_del_rcu(&catchall->list); 4488 4488 nft_set_elem_destroy(set, catchall->elem, true); 4489 4489 kfree_rcu(catchall);
+7 -1
net/openvswitch/flow.c
··· 34 34 #include <net/mpls.h> 35 35 #include <net/ndisc.h> 36 36 #include <net/nsh.h> 37 + #include <net/netfilter/nf_conntrack_zones.h> 37 38 38 39 #include "conntrack.h" 39 40 #include "datapath.h" ··· 861 860 #endif 862 861 bool post_ct = false; 863 862 int res, err; 863 + u16 zone = 0; 864 864 865 865 /* Extract metadata from packet. */ 866 866 if (tun_info) { ··· 900 898 key->recirc_id = tc_ext ? tc_ext->chain : 0; 901 899 OVS_CB(skb)->mru = tc_ext ? tc_ext->mru : 0; 902 900 post_ct = tc_ext ? tc_ext->post_ct : false; 901 + zone = post_ct ? tc_ext->zone : 0; 903 902 } else { 904 903 key->recirc_id = 0; 905 904 } ··· 909 906 #endif 910 907 911 908 err = key_extract(skb, key); 912 - if (!err) 909 + if (!err) { 913 910 ovs_ct_fill_key(skb, key, post_ct); /* Must be after key_extract(). */ 911 + if (post_ct && !skb_get_nfct(skb)) 912 + key->ct_zone = zone; 913 + } 914 914 return err; 915 915 } 916 916
+2
net/phonet/pep.c
··· 947 947 ret = -EBUSY; 948 948 else if (sk->sk_state == TCP_ESTABLISHED) 949 949 ret = -EISCONN; 950 + else if (!pn->pn_sk.sobject) 951 + ret = -EADDRNOTAVAIL; 950 952 else 951 953 ret = pep_sock_enable(sk, NULL, 0); 952 954 release_sock(sk);
+8 -7
net/sched/act_ct.c
··· 690 690 u8 family, u16 zone, bool *defrag) 691 691 { 692 692 enum ip_conntrack_info ctinfo; 693 - struct qdisc_skb_cb cb; 694 693 struct nf_conn *ct; 695 694 int err = 0; 696 695 bool frag; 696 + u16 mru; 697 697 698 698 /* Previously seen (loopback)? Ignore. */ 699 699 ct = nf_ct_get(skb, &ctinfo); ··· 708 708 return err; 709 709 710 710 skb_get(skb); 711 - cb = *qdisc_skb_cb(skb); 711 + mru = tc_skb_cb(skb)->mru; 712 712 713 713 if (family == NFPROTO_IPV4) { 714 714 enum ip_defrag_users user = IP_DEFRAG_CONNTRACK_IN + zone; ··· 722 722 723 723 if (!err) { 724 724 *defrag = true; 725 - cb.mru = IPCB(skb)->frag_max_size; 725 + mru = IPCB(skb)->frag_max_size; 726 726 } 727 727 } else { /* NFPROTO_IPV6 */ 728 728 #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) ··· 735 735 736 736 if (!err) { 737 737 *defrag = true; 738 - cb.mru = IP6CB(skb)->frag_max_size; 738 + mru = IP6CB(skb)->frag_max_size; 739 739 } 740 740 #else 741 741 err = -EOPNOTSUPP; ··· 744 744 } 745 745 746 746 if (err != -EINPROGRESS) 747 - *qdisc_skb_cb(skb) = cb; 747 + tc_skb_cb(skb)->mru = mru; 748 748 skb_clear_hash(skb); 749 749 skb->ignore_df = 1; 750 750 return err; ··· 963 963 tcf_action_update_bstats(&c->common, skb); 964 964 965 965 if (clear) { 966 - qdisc_skb_cb(skb)->post_ct = false; 966 + tc_skb_cb(skb)->post_ct = false; 967 967 ct = nf_ct_get(skb, &ctinfo); 968 968 if (ct) { 969 969 nf_conntrack_put(&ct->ct_general); ··· 1048 1048 out_push: 1049 1049 skb_push_rcsum(skb, nh_ofs); 1050 1050 1051 - qdisc_skb_cb(skb)->post_ct = true; 1051 + tc_skb_cb(skb)->post_ct = true; 1052 + tc_skb_cb(skb)->zone = p->zone; 1052 1053 out_clear: 1053 1054 if (defrag) 1054 1055 qdisc_skb_cb(skb)->pkt_len = skb->len;
+5 -2
net/sched/cls_api.c
··· 1617 1617 1618 1618 /* If we missed on some chain */ 1619 1619 if (ret == TC_ACT_UNSPEC && last_executed_chain) { 1620 + struct tc_skb_cb *cb = tc_skb_cb(skb); 1621 + 1620 1622 ext = tc_skb_ext_alloc(skb); 1621 1623 if (WARN_ON_ONCE(!ext)) 1622 1624 return TC_ACT_SHOT; 1623 1625 ext->chain = last_executed_chain; 1624 - ext->mru = qdisc_skb_cb(skb)->mru; 1625 - ext->post_ct = qdisc_skb_cb(skb)->post_ct; 1626 + ext->mru = cb->mru; 1627 + ext->post_ct = cb->post_ct; 1628 + ext->zone = cb->zone; 1626 1629 } 1627 1630 1628 1631 return ret;
+4 -2
net/sched/cls_flower.c
··· 19 19 20 20 #include <net/sch_generic.h> 21 21 #include <net/pkt_cls.h> 22 + #include <net/pkt_sched.h> 22 23 #include <net/ip.h> 23 24 #include <net/flow_dissector.h> 24 25 #include <net/geneve.h> ··· 310 309 struct tcf_result *res) 311 310 { 312 311 struct cls_fl_head *head = rcu_dereference_bh(tp->root); 313 - bool post_ct = qdisc_skb_cb(skb)->post_ct; 312 + bool post_ct = tc_skb_cb(skb)->post_ct; 313 + u16 zone = tc_skb_cb(skb)->zone; 314 314 struct fl_flow_key skb_key; 315 315 struct fl_flow_mask *mask; 316 316 struct cls_fl_filter *f; ··· 329 327 skb_flow_dissect_ct(skb, &mask->dissector, &skb_key, 330 328 fl_ct_info_to_flower_map, 331 329 ARRAY_SIZE(fl_ct_info_to_flower_map), 332 - post_ct); 330 + post_ct, zone); 333 331 skb_flow_dissect_hash(skb, &mask->dissector, &skb_key); 334 332 skb_flow_dissect(skb, &mask->dissector, &skb_key, 335 333 FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP);
+2 -1
net/sched/sch_frag.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB 2 2 #include <net/netlink.h> 3 3 #include <net/sch_generic.h> 4 + #include <net/pkt_sched.h> 4 5 #include <net/dst.h> 5 6 #include <net/ip.h> 6 7 #include <net/ip6_fib.h> ··· 138 137 139 138 int sch_frag_xmit_hook(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb)) 140 139 { 141 - u16 mru = qdisc_skb_cb(skb)->mru; 140 + u16 mru = tc_skb_cb(skb)->mru; 142 141 int err; 143 142 144 143 if (mru && skb->len > mru + skb->dev->hard_header_len)
+4 -4
net/tipc/crypto.c
··· 524 524 return -EEXIST; 525 525 526 526 /* Allocate a new AEAD */ 527 - tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); 527 + tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC); 528 528 if (unlikely(!tmp)) 529 529 return -ENOMEM; 530 530 ··· 1474 1474 return -EEXIST; 1475 1475 1476 1476 /* Allocate crypto */ 1477 - c = kzalloc(sizeof(*c), GFP_KERNEL); 1477 + c = kzalloc(sizeof(*c), GFP_ATOMIC); 1478 1478 if (!c) 1479 1479 return -ENOMEM; 1480 1480 ··· 1488 1488 } 1489 1489 1490 1490 /* Allocate statistic structure */ 1491 - c->stats = alloc_percpu(struct tipc_crypto_stats); 1491 + c->stats = alloc_percpu_gfp(struct tipc_crypto_stats, GFP_ATOMIC); 1492 1492 if (!c->stats) { 1493 1493 if (c->wq) 1494 1494 destroy_workqueue(c->wq); ··· 2461 2461 } 2462 2462 2463 2463 /* Lets duplicate it first */ 2464 - skey = kmemdup(aead->key, tipc_aead_key_size(aead->key), GFP_KERNEL); 2464 + skey = kmemdup(aead->key, tipc_aead_key_size(aead->key), GFP_ATOMIC); 2465 2465 rcu_read_unlock(); 2466 2466 2467 2467 /* Now, generate new key, initiate & distribute it */