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

Pull networking fixes from Jakub Kicinski:
"Including fixes from Bluetooth and wireless.

A few more fixes for the locking changes trickling in. Nothing too
alarming, I suspect those will continue for another release. Other
than that things are slowing down nicely.

Current release - fix to a fix:

- Bluetooth: hci_event: use key encryption size when its known

- tools: ynl-gen: allow multi-attr without nested-attributes again

Current release - regressions:

- locking fixes:
- lock lower level devices when updating features
- eth: bnxt_en: bring back rtnl_lock() in the bnxt_open() path
- devmem: fix panic when Netlink socket closes after module unload

Current release - new code bugs:

- eth: txgbe: fixes for FW communication on new AML devices

Previous releases - always broken:

- sched: flush gso_skb list too during ->change(), avoid potential
null-deref on reconfig

- wifi: mt76: disable NAPI on driver removal

- hv_netvsc: fix error 'nvsp_rndis_pkt_complete error status: 2'"

* tag 'net-6.15-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (44 commits)
net: devmem: fix kernel panic when netlink socket close after module unload
tsnep: fix timestamping with a stacked DSA driver
net/tls: fix kernel panic when alloc_page failed
bnxt_en: bring back rtnl_lock() in the bnxt_open() path
mlxsw: spectrum_router: Fix use-after-free when deleting GRE net devices
wifi: mac80211: Set n_channels after allocating struct cfg80211_scan_request
octeontx2-pf: Do not reallocate all ntuple filters
wifi: mt76: mt7925: fix missing hdr_trans_tlv command for broadcast wtbl
wifi: mt76: disable napi on driver removal
Drivers: hv: vmbus: Remove vmbus_sendpacket_pagebuffer()
hv_netvsc: Remove rmsg_pgcnt
hv_netvsc: Preserve contiguous PFN grouping in the page buffer array
hv_netvsc: Use vmbus_sendpacket_mpb_desc() to send VMBus messages
Drivers: hv: Allow vmbus_sendpacket_mpb_desc() to create multiple ranges
octeontx2-af: Fix CGX Receive counters
net: ethernet: mtk_eth_soc: fix typo for declaration MT7988 ESW capability
net: libwx: Fix FW mailbox unknown command
net: libwx: Fix FW mailbox reply timeout
net: txgbe: Fix to calculate EEPROM checksum for AML devices
octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy
...

+698 -361
+6 -4
Documentation/netlink/specs/tc.yaml
··· 2017 2017 attributes: 2018 2018 - 2019 2019 name: act 2020 - type: nest 2020 + type: indexed-array 2021 + sub-type: nest 2021 2022 nested-attributes: tc-act-attrs 2022 2023 - 2023 2024 name: police ··· 2251 2250 attributes: 2252 2251 - 2253 2252 name: act 2254 - type: nest 2253 + type: indexed-array 2254 + sub-type: nest 2255 2255 nested-attributes: tc-act-attrs 2256 2256 - 2257 2257 name: police ··· 2747 2745 type: u16 2748 2746 byte-order: big-endian 2749 2747 - 2750 - name: key-l2-tpv3-sid 2748 + name: key-l2tpv3-sid 2751 2749 type: u32 2752 2750 byte-order: big-endian 2753 2751 - ··· 3506 3504 name: rate64 3507 3505 type: u64 3508 3506 - 3509 - name: prate4 3507 + name: prate64 3510 3508 type: u64 3511 3509 - 3512 3510 name: burst
+3 -5
Documentation/networking/timestamping.rst
··· 811 811 3.2.4 Other caveats for MAC drivers 812 812 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 813 813 814 - Stacked PHCs, especially DSA (but not only) - since that doesn't require any 815 - modification to MAC drivers, so it is more difficult to ensure correctness of 816 - all possible code paths - is that they uncover bugs which were impossible to 817 - trigger before the existence of stacked PTP clocks. One example has to do with 818 - this line of code, already presented earlier:: 814 + The use of stacked PHCs may uncover MAC driver bugs which were impossible to 815 + trigger without them. One example has to do with this line of code, already 816 + presented earlier:: 819 817 820 818 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 821 819
+3 -62
drivers/hv/channel.c
··· 1077 1077 EXPORT_SYMBOL(vmbus_sendpacket); 1078 1078 1079 1079 /* 1080 - * vmbus_sendpacket_pagebuffer - Send a range of single-page buffer 1081 - * packets using a GPADL Direct packet type. This interface allows you 1082 - * to control notifying the host. This will be useful for sending 1083 - * batched data. Also the sender can control the send flags 1084 - * explicitly. 1085 - */ 1086 - int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, 1087 - struct hv_page_buffer pagebuffers[], 1088 - u32 pagecount, void *buffer, u32 bufferlen, 1089 - u64 requestid) 1090 - { 1091 - int i; 1092 - struct vmbus_channel_packet_page_buffer desc; 1093 - u32 descsize; 1094 - u32 packetlen; 1095 - u32 packetlen_aligned; 1096 - struct kvec bufferlist[3]; 1097 - u64 aligned_data = 0; 1098 - 1099 - if (pagecount > MAX_PAGE_BUFFER_COUNT) 1100 - return -EINVAL; 1101 - 1102 - /* 1103 - * Adjust the size down since vmbus_channel_packet_page_buffer is the 1104 - * largest size we support 1105 - */ 1106 - descsize = sizeof(struct vmbus_channel_packet_page_buffer) - 1107 - ((MAX_PAGE_BUFFER_COUNT - pagecount) * 1108 - sizeof(struct hv_page_buffer)); 1109 - packetlen = descsize + bufferlen; 1110 - packetlen_aligned = ALIGN(packetlen, sizeof(u64)); 1111 - 1112 - /* Setup the descriptor */ 1113 - desc.type = VM_PKT_DATA_USING_GPA_DIRECT; 1114 - desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; 1115 - desc.dataoffset8 = descsize >> 3; /* in 8-bytes granularity */ 1116 - desc.length8 = (u16)(packetlen_aligned >> 3); 1117 - desc.transactionid = VMBUS_RQST_ERROR; /* will be updated in hv_ringbuffer_write() */ 1118 - desc.reserved = 0; 1119 - desc.rangecount = pagecount; 1120 - 1121 - for (i = 0; i < pagecount; i++) { 1122 - desc.range[i].len = pagebuffers[i].len; 1123 - desc.range[i].offset = pagebuffers[i].offset; 1124 - desc.range[i].pfn = pagebuffers[i].pfn; 1125 - } 1126 - 1127 - bufferlist[0].iov_base = &desc; 1128 - bufferlist[0].iov_len = descsize; 1129 - bufferlist[1].iov_base = buffer; 1130 - bufferlist[1].iov_len = bufferlen; 1131 - bufferlist[2].iov_base = &aligned_data; 1132 - bufferlist[2].iov_len = (packetlen_aligned - packetlen); 1133 - 1134 - return hv_ringbuffer_write(channel, bufferlist, 3, requestid, NULL); 1135 - } 1136 - EXPORT_SYMBOL_GPL(vmbus_sendpacket_pagebuffer); 1137 - 1138 - /* 1139 - * vmbus_sendpacket_multipagebuffer - Send a multi-page buffer packet 1080 + * vmbus_sendpacket_mpb_desc - Send one or more multi-page buffer packets 1140 1081 * using a GPADL Direct packet type. 1141 - * The buffer includes the vmbus descriptor. 1082 + * The desc argument must include space for the VMBus descriptor. The 1083 + * rangecount field must already be set. 1142 1084 */ 1143 1085 int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel, 1144 1086 struct vmbus_packet_mpb_array *desc, ··· 1102 1160 desc->length8 = (u16)(packetlen_aligned >> 3); 1103 1161 desc->transactionid = VMBUS_RQST_ERROR; /* will be updated in hv_ringbuffer_write() */ 1104 1162 desc->reserved = 0; 1105 - desc->rangecount = 1; 1106 1163 1107 1164 bufferlist[0].iov_base = desc; 1108 1165 bufferlist[0].iov_len = desc_size;
+33
drivers/net/dsa/b53/b53_common.c
··· 326 326 } 327 327 } 328 328 329 + static void b53_set_eap_mode(struct b53_device *dev, int port, int mode) 330 + { 331 + u64 eap_conf; 332 + 333 + if (is5325(dev) || is5365(dev) || dev->chip_id == BCM5389_DEVICE_ID) 334 + return; 335 + 336 + b53_read64(dev, B53_EAP_PAGE, B53_PORT_EAP_CONF(port), &eap_conf); 337 + 338 + if (is63xx(dev)) { 339 + eap_conf &= ~EAP_MODE_MASK_63XX; 340 + eap_conf |= (u64)mode << EAP_MODE_SHIFT_63XX; 341 + } else { 342 + eap_conf &= ~EAP_MODE_MASK; 343 + eap_conf |= (u64)mode << EAP_MODE_SHIFT; 344 + } 345 + 346 + b53_write64(dev, B53_EAP_PAGE, B53_PORT_EAP_CONF(port), eap_conf); 347 + } 348 + 329 349 static void b53_set_forwarding(struct b53_device *dev, int enable) 330 350 { 331 351 u8 mgmt; ··· 605 585 b53_port_set_ucast_flood(dev, port, true); 606 586 b53_port_set_mcast_flood(dev, port, true); 607 587 b53_port_set_learning(dev, port, false); 588 + 589 + /* Force all traffic to go to the CPU port to prevent the ASIC from 590 + * trying to forward to bridged ports on matching FDB entries, then 591 + * dropping frames because it isn't allowed to forward there. 592 + */ 593 + if (dsa_is_user_port(ds, port)) 594 + b53_set_eap_mode(dev, port, EAP_MODE_SIMPLIFIED); 608 595 609 596 return 0; 610 597 } ··· 2069 2042 pvlan |= BIT(i); 2070 2043 } 2071 2044 2045 + /* Disable redirection of unknown SA to the CPU port */ 2046 + b53_set_eap_mode(dev, port, EAP_MODE_BASIC); 2047 + 2072 2048 /* Configure the local port VLAN control membership to include 2073 2049 * remote ports and update the local port bitmask 2074 2050 */ ··· 2106 2076 if (port != i) 2107 2077 pvlan &= ~BIT(i); 2108 2078 } 2079 + 2080 + /* Enable redirection of unknown SA to the CPU port */ 2081 + b53_set_eap_mode(dev, port, EAP_MODE_SIMPLIFIED); 2109 2082 2110 2083 b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), pvlan); 2111 2084 dev->ports[port].vlan_ctl_mask = pvlan;
+14
drivers/net/dsa/b53/b53_regs.h
··· 50 50 /* Jumbo Frame Registers */ 51 51 #define B53_JUMBO_PAGE 0x40 52 52 53 + /* EAP Registers */ 54 + #define B53_EAP_PAGE 0x42 55 + 53 56 /* EEE Control Registers Page */ 54 57 #define B53_EEE_PAGE 0x92 55 58 ··· 482 479 #define B53_JUMBO_MAX_SIZE_63XX 0x08 483 480 #define JMS_MIN_SIZE 1518 484 481 #define JMS_MAX_SIZE 9724 482 + 483 + /************************************************************************* 484 + * EAP Page Registers 485 + *************************************************************************/ 486 + #define B53_PORT_EAP_CONF(i) (0x20 + 8 * (i)) 487 + #define EAP_MODE_SHIFT 51 488 + #define EAP_MODE_SHIFT_63XX 50 489 + #define EAP_MODE_MASK (0x3ull << EAP_MODE_SHIFT) 490 + #define EAP_MODE_MASK_63XX (0x3ull << EAP_MODE_SHIFT_63XX) 491 + #define EAP_MODE_BASIC 0 492 + #define EAP_MODE_SIMPLIFIED 3 485 493 486 494 /************************************************************************* 487 495 * EEE Configuration Page Registers
+108 -29
drivers/net/dsa/microchip/ksz_common.c
··· 265 265 unsigned int mode, 266 266 phy_interface_t interface); 267 267 268 + /** 269 + * ksz_phylink_mac_disable_tx_lpi() - Callback to signal LPI support (Dummy) 270 + * @config: phylink config structure 271 + * 272 + * This function is a dummy handler. See ksz_phylink_mac_enable_tx_lpi() for 273 + * a detailed explanation of EEE/LPI handling in KSZ switches. 274 + */ 275 + static void ksz_phylink_mac_disable_tx_lpi(struct phylink_config *config) 276 + { 277 + } 278 + 279 + /** 280 + * ksz_phylink_mac_enable_tx_lpi() - Callback to signal LPI support (Dummy) 281 + * @config: phylink config structure 282 + * @timer: timer value before entering LPI (unused) 283 + * @tx_clock_stop: whether to stop the TX clock in LPI mode (unused) 284 + * 285 + * This function signals to phylink that the driver architecture supports 286 + * LPI management, enabling phylink to control EEE advertisement during 287 + * negotiation according to IEEE Std 802.3 (Clause 78). 288 + * 289 + * Hardware Management of EEE/LPI State: 290 + * For KSZ switch ports with integrated PHYs (e.g., KSZ9893R ports 1-2), 291 + * observation and testing suggest that the actual EEE / Low Power Idle (LPI) 292 + * state transitions are managed autonomously by the hardware based on 293 + * the auto-negotiation results. (Note: While the datasheet describes EEE 294 + * operation based on negotiation, it doesn't explicitly detail the internal 295 + * MAC/PHY interaction, so autonomous hardware management of the MAC state 296 + * for LPI is inferred from observed behavior). 297 + * This hardware control, consistent with the switch's ability to operate 298 + * autonomously via strapping, means MAC-level software intervention is not 299 + * required or exposed for managing the LPI state once EEE is negotiated. 300 + * (Ref: KSZ9893R Data Sheet DS00002420D, primarily Section 4.7.5 explaining 301 + * EEE, also Sections 4.1.7 on Auto-Negotiation and 3.2.1 on Configuration 302 + * Straps). 303 + * 304 + * Additionally, ports configured as MAC interfaces (e.g., KSZ9893R port 3) 305 + * lack documented MAC-level LPI control. 306 + * 307 + * Therefore, this callback performs no action and serves primarily to inform 308 + * phylink of LPI awareness and to document the inferred hardware behavior. 309 + * 310 + * Returns: 0 (Always success) 311 + */ 312 + static int ksz_phylink_mac_enable_tx_lpi(struct phylink_config *config, 313 + u32 timer, bool tx_clock_stop) 314 + { 315 + return 0; 316 + } 317 + 268 318 static const struct phylink_mac_ops ksz88x3_phylink_mac_ops = { 269 319 .mac_config = ksz88x3_phylink_mac_config, 270 320 .mac_link_down = ksz_phylink_mac_link_down, 271 321 .mac_link_up = ksz8_phylink_mac_link_up, 322 + .mac_disable_tx_lpi = ksz_phylink_mac_disable_tx_lpi, 323 + .mac_enable_tx_lpi = ksz_phylink_mac_enable_tx_lpi, 272 324 }; 273 325 274 326 static const struct phylink_mac_ops ksz8_phylink_mac_ops = { 275 327 .mac_config = ksz_phylink_mac_config, 276 328 .mac_link_down = ksz_phylink_mac_link_down, 277 329 .mac_link_up = ksz8_phylink_mac_link_up, 330 + .mac_disable_tx_lpi = ksz_phylink_mac_disable_tx_lpi, 331 + .mac_enable_tx_lpi = ksz_phylink_mac_enable_tx_lpi, 278 332 }; 279 333 280 334 static const struct ksz_dev_ops ksz88xx_dev_ops = { ··· 412 358 .mac_config = ksz_phylink_mac_config, 413 359 .mac_link_down = ksz_phylink_mac_link_down, 414 360 .mac_link_up = ksz9477_phylink_mac_link_up, 361 + .mac_disable_tx_lpi = ksz_phylink_mac_disable_tx_lpi, 362 + .mac_enable_tx_lpi = ksz_phylink_mac_enable_tx_lpi, 415 363 }; 416 364 417 365 static const struct ksz_dev_ops ksz9477_dev_ops = { ··· 457 401 .mac_config = ksz_phylink_mac_config, 458 402 .mac_link_down = ksz_phylink_mac_link_down, 459 403 .mac_link_up = ksz9477_phylink_mac_link_up, 404 + .mac_disable_tx_lpi = ksz_phylink_mac_disable_tx_lpi, 405 + .mac_enable_tx_lpi = ksz_phylink_mac_enable_tx_lpi, 460 406 }; 461 407 462 408 static const struct ksz_dev_ops lan937x_dev_ops = { ··· 2074 2016 2075 2017 if (dev->dev_ops->get_caps) 2076 2018 dev->dev_ops->get_caps(dev, port, config); 2019 + 2020 + if (ds->ops->support_eee && ds->ops->support_eee(ds, port)) { 2021 + memcpy(config->lpi_interfaces, config->supported_interfaces, 2022 + sizeof(config->lpi_interfaces)); 2023 + 2024 + config->lpi_capabilities = MAC_100FD; 2025 + if (dev->info->gbit_capable[port]) 2026 + config->lpi_capabilities |= MAC_1000FD; 2027 + 2028 + /* EEE is fully operational */ 2029 + config->eee_enabled_default = true; 2030 + } 2077 2031 } 2078 2032 2079 2033 void ksz_r_mib_stats64(struct ksz_device *dev, int port) ··· 3078 3008 if (!port) 3079 3009 return MICREL_KSZ8_P1_ERRATA; 3080 3010 break; 3081 - case KSZ8567_CHIP_ID: 3082 - /* KSZ8567R Errata DS80000752C Module 4 */ 3083 - case KSZ8765_CHIP_ID: 3084 - case KSZ8794_CHIP_ID: 3085 - case KSZ8795_CHIP_ID: 3086 - /* KSZ879x/KSZ877x/KSZ876x Errata DS80000687C Module 2 */ 3087 - case KSZ9477_CHIP_ID: 3088 - /* KSZ9477S Errata DS80000754A Module 4 */ 3089 - case KSZ9567_CHIP_ID: 3090 - /* KSZ9567S Errata DS80000756A Module 4 */ 3091 - case KSZ9896_CHIP_ID: 3092 - /* KSZ9896C Errata DS80000757A Module 3 */ 3093 - case KSZ9897_CHIP_ID: 3094 - case LAN9646_CHIP_ID: 3095 - /* KSZ9897R Errata DS80000758C Module 4 */ 3096 - /* Energy Efficient Ethernet (EEE) feature select must be manually disabled 3097 - * The EEE feature is enabled by default, but it is not fully 3098 - * operational. It must be manually disabled through register 3099 - * controls. If not disabled, the PHY ports can auto-negotiate 3100 - * to enable EEE, and this feature can cause link drops when 3101 - * linked to another device supporting EEE. 3102 - * 3103 - * The same item appears in the errata for all switches above. 3104 - */ 3105 - return MICREL_NO_EEE; 3106 3011 } 3107 3012 3108 3013 return 0; ··· 3511 3466 return -EOPNOTSUPP; 3512 3467 } 3513 3468 3469 + /** 3470 + * ksz_support_eee - Determine Energy Efficient Ethernet (EEE) support for a 3471 + * port 3472 + * @ds: Pointer to the DSA switch structure 3473 + * @port: Port number to check 3474 + * 3475 + * This function also documents devices where EEE was initially advertised but 3476 + * later withdrawn due to reliability issues, as described in official errata 3477 + * documents. These devices are explicitly listed to record known limitations, 3478 + * even if there is no technical necessity for runtime checks. 3479 + * 3480 + * Returns: true if the internal PHY on the given port supports fully 3481 + * operational EEE, false otherwise. 3482 + */ 3514 3483 static bool ksz_support_eee(struct dsa_switch *ds, int port) 3515 3484 { 3516 3485 struct ksz_device *dev = ds->priv; ··· 3534 3475 3535 3476 switch (dev->chip_id) { 3536 3477 case KSZ8563_CHIP_ID: 3537 - case KSZ8567_CHIP_ID: 3538 - case KSZ9477_CHIP_ID: 3539 3478 case KSZ9563_CHIP_ID: 3540 - case KSZ9567_CHIP_ID: 3541 3479 case KSZ9893_CHIP_ID: 3480 + return true; 3481 + case KSZ8567_CHIP_ID: 3482 + /* KSZ8567R Errata DS80000752C Module 4 */ 3483 + case KSZ8765_CHIP_ID: 3484 + case KSZ8794_CHIP_ID: 3485 + case KSZ8795_CHIP_ID: 3486 + /* KSZ879x/KSZ877x/KSZ876x Errata DS80000687C Module 2 */ 3487 + case KSZ9477_CHIP_ID: 3488 + /* KSZ9477S Errata DS80000754A Module 4 */ 3489 + case KSZ9567_CHIP_ID: 3490 + /* KSZ9567S Errata DS80000756A Module 4 */ 3542 3491 case KSZ9896_CHIP_ID: 3492 + /* KSZ9896C Errata DS80000757A Module 3 */ 3543 3493 case KSZ9897_CHIP_ID: 3544 3494 case LAN9646_CHIP_ID: 3545 - return true; 3495 + /* KSZ9897R Errata DS80000758C Module 4 */ 3496 + /* Energy Efficient Ethernet (EEE) feature select must be 3497 + * manually disabled 3498 + * The EEE feature is enabled by default, but it is not fully 3499 + * operational. It must be manually disabled through register 3500 + * controls. If not disabled, the PHY ports can auto-negotiate 3501 + * to enable EEE, and this feature can cause link drops when 3502 + * linked to another device supporting EEE. 3503 + * 3504 + * The same item appears in the errata for all switches above. 3505 + */ 3506 + break; 3546 3507 } 3547 3508 3548 3509 return false;
+1 -5
drivers/net/dsa/sja1105/sja1105_main.c
··· 2081 2081 switch (state) { 2082 2082 case BR_STATE_DISABLED: 2083 2083 case BR_STATE_BLOCKING: 2084 + case BR_STATE_LISTENING: 2084 2085 /* From UM10944 description of DRPDTAG (why put this there?): 2085 2086 * "Management traffic flows to the port regardless of the state 2086 2087 * of the INGRESS flag". So BPDUs are still be allowed to pass. 2087 2088 * At the moment no difference between DISABLED and BLOCKING. 2088 2089 */ 2089 2090 mac[port].ingress = false; 2090 - mac[port].egress = false; 2091 - mac[port].dyn_learn = false; 2092 - break; 2093 - case BR_STATE_LISTENING: 2094 - mac[port].ingress = true; 2095 2091 mac[port].egress = false; 2096 2092 mac[port].dyn_learn = false; 2097 2093 break;
+29 -7
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 14013 14013 netdev_unlock(bp->dev); 14014 14014 } 14015 14015 14016 + /* Same as bnxt_lock_sp() with additional rtnl_lock */ 14017 + static void bnxt_rtnl_lock_sp(struct bnxt *bp) 14018 + { 14019 + clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state); 14020 + rtnl_lock(); 14021 + netdev_lock(bp->dev); 14022 + } 14023 + 14024 + static void bnxt_rtnl_unlock_sp(struct bnxt *bp) 14025 + { 14026 + set_bit(BNXT_STATE_IN_SP_TASK, &bp->state); 14027 + netdev_unlock(bp->dev); 14028 + rtnl_unlock(); 14029 + } 14030 + 14016 14031 /* Only called from bnxt_sp_task() */ 14017 14032 static void bnxt_reset(struct bnxt *bp, bool silent) 14018 14033 { 14019 - bnxt_lock_sp(bp); 14034 + bnxt_rtnl_lock_sp(bp); 14020 14035 if (test_bit(BNXT_STATE_OPEN, &bp->state)) 14021 14036 bnxt_reset_task(bp, silent); 14022 - bnxt_unlock_sp(bp); 14037 + bnxt_rtnl_unlock_sp(bp); 14023 14038 } 14024 14039 14025 14040 /* Only called from bnxt_sp_task() */ ··· 14042 14027 { 14043 14028 int i; 14044 14029 14045 - bnxt_lock_sp(bp); 14030 + bnxt_rtnl_lock_sp(bp); 14046 14031 if (!test_bit(BNXT_STATE_OPEN, &bp->state)) { 14047 - bnxt_unlock_sp(bp); 14032 + bnxt_rtnl_unlock_sp(bp); 14048 14033 return; 14049 14034 } 14050 14035 /* Disable and flush TPA before resetting the RX ring */ ··· 14083 14068 } 14084 14069 if (bp->flags & BNXT_FLAG_TPA) 14085 14070 bnxt_set_tpa(bp, true); 14086 - bnxt_unlock_sp(bp); 14071 + bnxt_rtnl_unlock_sp(bp); 14087 14072 } 14088 14073 14089 14074 static void bnxt_fw_fatal_close(struct bnxt *bp) ··· 14975 14960 bp->fw_reset_state = BNXT_FW_RESET_STATE_OPENING; 14976 14961 fallthrough; 14977 14962 case BNXT_FW_RESET_STATE_OPENING: 14978 - while (!netdev_trylock(bp->dev)) { 14963 + while (!rtnl_trylock()) { 14979 14964 bnxt_queue_fw_reset_work(bp, HZ / 10); 14980 14965 return; 14981 14966 } 14967 + netdev_lock(bp->dev); 14982 14968 rc = bnxt_open(bp->dev); 14983 14969 if (rc) { 14984 14970 netdev_err(bp->dev, "bnxt_open() failed during FW reset\n"); 14985 14971 bnxt_fw_reset_abort(bp, rc); 14986 14972 netdev_unlock(bp->dev); 14973 + rtnl_unlock(); 14987 14974 goto ulp_start; 14988 14975 } 14989 14976 ··· 15005 14988 bnxt_dl_health_fw_status_update(bp, true); 15006 14989 } 15007 14990 netdev_unlock(bp->dev); 14991 + rtnl_unlock(); 15008 14992 bnxt_ulp_start(bp, 0); 15009 14993 bnxt_reenable_sriov(bp); 15010 14994 netdev_lock(bp->dev); ··· 15954 15936 rc); 15955 15937 napi_enable_locked(&bnapi->napi); 15956 15938 bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons); 15957 - bnxt_reset_task(bp, true); 15939 + netif_close(dev); 15958 15940 return rc; 15959 15941 } 15960 15942 ··· 16770 16752 struct bnxt *bp = netdev_priv(dev); 16771 16753 int rc = 0; 16772 16754 16755 + rtnl_lock(); 16773 16756 netdev_lock(dev); 16774 16757 rc = pci_enable_device(bp->pdev); 16775 16758 if (rc) { ··· 16815 16796 16816 16797 resume_exit: 16817 16798 netdev_unlock(bp->dev); 16799 + rtnl_unlock(); 16818 16800 bnxt_ulp_start(bp, rc); 16819 16801 if (!rc) 16820 16802 bnxt_reenable_sriov(bp); ··· 16981 16961 int err; 16982 16962 16983 16963 netdev_info(bp->dev, "PCI Slot Resume\n"); 16964 + rtnl_lock(); 16984 16965 netdev_lock(netdev); 16985 16966 16986 16967 err = bnxt_hwrm_func_qcaps(bp); ··· 16999 16978 netif_device_attach(netdev); 17000 16979 17001 16980 netdev_unlock(netdev); 16981 + rtnl_unlock(); 17002 16982 bnxt_ulp_start(bp, err); 17003 16983 if (!err) 17004 16984 bnxt_reenable_sriov(bp);
+6 -13
drivers/net/ethernet/cadence/macb_main.c
··· 997 997 998 998 static int macb_halt_tx(struct macb *bp) 999 999 { 1000 - unsigned long halt_time, timeout; 1001 - u32 status; 1000 + u32 status; 1002 1001 1003 1002 macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(THALT)); 1004 1003 1005 - timeout = jiffies + usecs_to_jiffies(MACB_HALT_TIMEOUT); 1006 - do { 1007 - halt_time = jiffies; 1008 - status = macb_readl(bp, TSR); 1009 - if (!(status & MACB_BIT(TGO))) 1010 - return 0; 1011 - 1012 - udelay(250); 1013 - } while (time_before(halt_time, timeout)); 1014 - 1015 - return -ETIMEDOUT; 1004 + /* Poll TSR until TGO is cleared or timeout. */ 1005 + return read_poll_timeout_atomic(macb_readl, status, 1006 + !(status & MACB_BIT(TGO)), 1007 + 250, MACB_HALT_TIMEOUT, false, 1008 + bp, TSR); 1016 1009 } 1017 1010 1018 1011 static void macb_tx_unmap(struct macb *bp, struct macb_tx_skb *tx_skb, int budget)
+19 -11
drivers/net/ethernet/engleder/tsnep_main.c
··· 67 67 #define TSNEP_TX_TYPE_XDP_NDO_MAP_PAGE (TSNEP_TX_TYPE_XDP_NDO | TSNEP_TX_TYPE_MAP_PAGE) 68 68 #define TSNEP_TX_TYPE_XDP (TSNEP_TX_TYPE_XDP_TX | TSNEP_TX_TYPE_XDP_NDO) 69 69 #define TSNEP_TX_TYPE_XSK BIT(12) 70 + #define TSNEP_TX_TYPE_TSTAMP BIT(13) 71 + #define TSNEP_TX_TYPE_SKB_TSTAMP (TSNEP_TX_TYPE_SKB | TSNEP_TX_TYPE_TSTAMP) 70 72 71 73 #define TSNEP_XDP_TX BIT(0) 72 74 #define TSNEP_XDP_REDIRECT BIT(1) ··· 388 386 if (entry->skb) { 389 387 entry->properties = length & TSNEP_DESC_LENGTH_MASK; 390 388 entry->properties |= TSNEP_DESC_INTERRUPT_FLAG; 391 - if ((entry->type & TSNEP_TX_TYPE_SKB) && 392 - (skb_shinfo(entry->skb)->tx_flags & SKBTX_IN_PROGRESS)) 389 + if ((entry->type & TSNEP_TX_TYPE_SKB_TSTAMP) == TSNEP_TX_TYPE_SKB_TSTAMP) 393 390 entry->properties |= TSNEP_DESC_EXTENDED_WRITEBACK_FLAG; 394 391 395 392 /* toggle user flag to prevent false acknowledge ··· 480 479 return mapped; 481 480 } 482 481 483 - static int tsnep_tx_map(struct sk_buff *skb, struct tsnep_tx *tx, int count) 482 + static int tsnep_tx_map(struct sk_buff *skb, struct tsnep_tx *tx, int count, 483 + bool do_tstamp) 484 484 { 485 485 struct device *dmadev = tx->adapter->dmadev; 486 486 struct tsnep_tx_entry *entry; ··· 507 505 entry->type = TSNEP_TX_TYPE_SKB_INLINE; 508 506 mapped = 0; 509 507 } 508 + 509 + if (do_tstamp) 510 + entry->type |= TSNEP_TX_TYPE_TSTAMP; 510 511 } else { 511 512 skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1]; 512 513 ··· 563 558 static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb, 564 559 struct tsnep_tx *tx) 565 560 { 566 - int count = 1; 567 561 struct tsnep_tx_entry *entry; 562 + bool do_tstamp = false; 563 + int count = 1; 568 564 int length; 569 - int i; 570 565 int retval; 566 + int i; 571 567 572 568 if (skb_shinfo(skb)->nr_frags > 0) 573 569 count += skb_shinfo(skb)->nr_frags; ··· 585 579 entry = &tx->entry[tx->write]; 586 580 entry->skb = skb; 587 581 588 - retval = tsnep_tx_map(skb, tx, count); 582 + if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && 583 + tx->adapter->hwtstamp_config.tx_type == HWTSTAMP_TX_ON) { 584 + skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 585 + do_tstamp = true; 586 + } 587 + 588 + retval = tsnep_tx_map(skb, tx, count, do_tstamp); 589 589 if (retval < 0) { 590 590 tsnep_tx_unmap(tx, tx->write, count); 591 591 dev_kfree_skb_any(entry->skb); ··· 602 590 return NETDEV_TX_OK; 603 591 } 604 592 length = retval; 605 - 606 - if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) 607 - skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 608 593 609 594 for (i = 0; i < count; i++) 610 595 tsnep_tx_activate(tx, (tx->write + i) & TSNEP_RING_MASK, length, ··· 853 844 854 845 length = tsnep_tx_unmap(tx, tx->read, count); 855 846 856 - if ((entry->type & TSNEP_TX_TYPE_SKB) && 857 - (skb_shinfo(entry->skb)->tx_flags & SKBTX_IN_PROGRESS) && 847 + if (((entry->type & TSNEP_TX_TYPE_SKB_TSTAMP) == TSNEP_TX_TYPE_SKB_TSTAMP) && 858 848 (__le32_to_cpu(entry->desc_wb->properties) & 859 849 TSNEP_DESC_EXTENDED_WRITEBACK_FLAG)) { 860 850 struct skb_shared_hwtstamps hwtstamps;
+5
drivers/net/ethernet/marvell/octeontx2/af/cgx.c
··· 717 717 718 718 if (!is_lmac_valid(cgx, lmac_id)) 719 719 return -ENODEV; 720 + 721 + /* pass lmac as 0 for CGX_CMR_RX_STAT9-12 */ 722 + if (idx >= CGX_RX_STAT_GLOBAL_INDEX) 723 + lmac_id = 0; 724 + 720 725 *rx_stat = cgx_read(cgx, lmac_id, CGXX_CMRX_RX_STAT0 + (idx * 8)); 721 726 return 0; 722 727 }
+2 -1
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c
··· 531 531 if (sw_tx_sc->encrypt) 532 532 sectag_tci |= (MCS_TCI_E | MCS_TCI_C); 533 533 534 - policy = FIELD_PREP(MCS_TX_SECY_PLCY_MTU, secy->netdev->mtu); 534 + policy = FIELD_PREP(MCS_TX_SECY_PLCY_MTU, 535 + pfvf->netdev->mtu + OTX2_ETH_HLEN); 535 536 /* Write SecTag excluding AN bits(1..0) */ 536 537 policy |= FIELD_PREP(MCS_TX_SECY_PLCY_ST_TCI, sectag_tci >> 2); 537 538 policy |= FIELD_PREP(MCS_TX_SECY_PLCY_ST_OFFSET, tag_offset);
+1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
··· 356 356 struct list_head flow_list_tc; 357 357 u8 ucast_flt_cnt; 358 358 bool ntuple; 359 + u16 ntuple_cnt; 359 360 }; 360 361 361 362 struct dev_hw_ops {
+1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
··· 41 41 if (!pfvf->flow_cfg) 42 42 return 0; 43 43 44 + pfvf->flow_cfg->ntuple_cnt = ctx->val.vu16; 44 45 otx2_alloc_mcam_entries(pfvf, ctx->val.vu16); 45 46 46 47 return 0;
+5 -5
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
··· 315 315 struct otx2_nic *pfvf = netdev_priv(netdev); 316 316 struct cgx_pause_frm_cfg *req, *rsp; 317 317 318 - if (is_otx2_lbkvf(pfvf->pdev)) 318 + if (is_otx2_lbkvf(pfvf->pdev) || is_otx2_sdp_rep(pfvf->pdev)) 319 319 return; 320 320 321 321 mutex_lock(&pfvf->mbox.lock); ··· 347 347 if (pause->autoneg) 348 348 return -EOPNOTSUPP; 349 349 350 - if (is_otx2_lbkvf(pfvf->pdev)) 350 + if (is_otx2_lbkvf(pfvf->pdev) || is_otx2_sdp_rep(pfvf->pdev)) 351 351 return -EOPNOTSUPP; 352 352 353 353 if (pause->rx_pause) ··· 941 941 { 942 942 struct otx2_nic *pfvf = netdev_priv(netdev); 943 943 944 - /* LBK link is internal and always UP */ 945 - if (is_otx2_lbkvf(pfvf->pdev)) 944 + /* LBK and SDP links are internal and always UP */ 945 + if (is_otx2_lbkvf(pfvf->pdev) || is_otx2_sdp_rep(pfvf->pdev)) 946 946 return 1; 947 947 return pfvf->linfo.link_up; 948 948 } ··· 1413 1413 { 1414 1414 struct otx2_nic *pfvf = netdev_priv(netdev); 1415 1415 1416 - if (is_otx2_lbkvf(pfvf->pdev)) { 1416 + if (is_otx2_lbkvf(pfvf->pdev) || is_otx2_sdp_rep(pfvf->pdev)) { 1417 1417 cmd->base.duplex = DUPLEX_FULL; 1418 1418 cmd->base.speed = SPEED_100000; 1419 1419 } else {
+2 -1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
··· 247 247 mutex_unlock(&pfvf->mbox.lock); 248 248 249 249 /* Allocate entries for Ntuple filters */ 250 - count = otx2_alloc_mcam_entries(pfvf, OTX2_DEFAULT_FLOWCOUNT); 250 + count = otx2_alloc_mcam_entries(pfvf, flow_cfg->ntuple_cnt); 251 251 if (count <= 0) { 252 252 otx2_clear_ntuple_flow_info(pfvf, flow_cfg); 253 253 return 0; ··· 307 307 INIT_LIST_HEAD(&pf->flow_cfg->flow_list_tc); 308 308 309 309 pf->flow_cfg->ucast_flt_cnt = OTX2_DEFAULT_UNICAST_FLOWS; 310 + pf->flow_cfg->ntuple_cnt = OTX2_DEFAULT_FLOWCOUNT; 310 311 311 312 /* Allocate bare minimum number of MCAM entries needed for 312 313 * unicast and ntuple filters.
+1 -1
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 4748 4748 } 4749 4749 4750 4750 if (mtk_is_netsys_v3_or_greater(mac->hw) && 4751 - MTK_HAS_CAPS(mac->hw->soc->caps, MTK_ESW_BIT) && 4751 + MTK_HAS_CAPS(mac->hw->soc->caps, MTK_ESW) && 4752 4752 id == MTK_GMAC1_ID) { 4753 4753 mac->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | 4754 4754 MAC_SYM_PAUSE |
+4
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 4349 4349 if (netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER) 4350 4350 netdev_warn(netdev, "Disabling HW_VLAN CTAG FILTERING, not supported in switchdev mode\n"); 4351 4351 4352 + features &= ~NETIF_F_HW_MACSEC; 4353 + if (netdev->features & NETIF_F_HW_MACSEC) 4354 + netdev_warn(netdev, "Disabling HW MACsec offload, not supported in switchdev mode\n"); 4355 + 4352 4356 return features; 4353 4357 } 4354 4358
+3
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 3014 3014 .rif = rif, 3015 3015 }; 3016 3016 3017 + if (!mlxsw_sp_dev_lower_is_port(mlxsw_sp_rif_dev(rif))) 3018 + return 0; 3019 + 3017 3020 neigh_for_each(&arp_tbl, mlxsw_sp_neigh_rif_made_sync_each, &rms); 3018 3021 if (rms.err) 3019 3022 goto err_arp;
+1 -1
drivers/net/ethernet/qlogic/qede/qede_main.c
··· 203 203 }; 204 204 205 205 static struct qed_eth_cb_ops qede_ll_ops = { 206 - { 206 + .common = { 207 207 #ifdef CONFIG_RFS_ACCEL 208 208 .arfs_filter_op = qede_arfs_filter_op, 209 209 #endif
+5 -2
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
··· 1484 1484 } 1485 1485 1486 1486 cmd_op = (cmd.rsp.arg[0] & 0xff); 1487 - if (cmd.rsp.arg[0] >> 25 == 2) 1488 - return 2; 1487 + if (cmd.rsp.arg[0] >> 25 == 2) { 1488 + ret = 2; 1489 + goto out; 1490 + } 1491 + 1489 1492 if (cmd_op == QLCNIC_BC_CMD_CHANNEL_INIT) 1490 1493 set_bit(QLC_BC_VF_STATE, &vf->state); 1491 1494 else
+8 -2
drivers/net/ethernet/wangxun/libwx/wx_hw.c
··· 434 434 wr32m(wx, WX_SW2FW_MBOX_CMD, WX_SW2FW_MBOX_CMD_VLD, WX_SW2FW_MBOX_CMD_VLD); 435 435 436 436 /* polling reply from FW */ 437 - err = read_poll_timeout(wx_poll_fw_reply, reply, reply, 1000, 50000, 438 - true, wx, buffer, send_cmd); 437 + err = read_poll_timeout(wx_poll_fw_reply, reply, reply, 2000, 438 + timeout * 1000, true, wx, buffer, send_cmd); 439 439 if (err) { 440 440 wx_err(wx, "Polling from FW messages timeout, cmd: 0x%x, index: %d\n", 441 441 send_cmd, wx->swfw_index); 442 + goto rel_out; 443 + } 444 + 445 + if (hdr->cmd_or_resp.ret_status == 0x80) { 446 + wx_err(wx, "Unknown FW command: 0x%x\n", send_cmd); 447 + err = -EINVAL; 442 448 goto rel_out; 443 449 } 444 450
+7 -1
drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
··· 99 99 } 100 100 local_buffer = eeprom_ptrs; 101 101 102 - for (i = 0; i < TXGBE_EEPROM_LAST_WORD; i++) 102 + for (i = 0; i < TXGBE_EEPROM_LAST_WORD; i++) { 103 + if (wx->mac.type == wx_mac_aml) { 104 + if (i >= TXGBE_EEPROM_I2C_SRART_PTR && 105 + i < TXGBE_EEPROM_I2C_END_PTR) 106 + local_buffer[i] = 0xffff; 107 + } 103 108 if (i != wx->eeprom.sw_region_offset + TXGBE_EEPROM_CHECKSUM) 104 109 *checksum += local_buffer[i]; 110 + } 105 111 106 112 kvfree(eeprom_ptrs); 107 113
+2
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
··· 158 158 #define TXGBE_EEPROM_VERSION_L 0x1D 159 159 #define TXGBE_EEPROM_VERSION_H 0x1E 160 160 #define TXGBE_ISCSI_BOOT_CONFIG 0x07 161 + #define TXGBE_EEPROM_I2C_SRART_PTR 0x580 162 + #define TXGBE_EEPROM_I2C_END_PTR 0x800 161 163 162 164 #define TXGBE_MAX_MSIX_VECTORS 64 163 165 #define TXGBE_MAX_FDIR_INDICES 63
+12 -1
drivers/net/hyperv/hyperv_net.h
··· 158 158 u8 cp_partial; /* partial copy into send buffer */ 159 159 160 160 u8 rmsg_size; /* RNDIS header and PPI size */ 161 - u8 rmsg_pgcnt; /* page count of RNDIS header and PPI */ 162 161 u8 page_buf_cnt; 163 162 164 163 u16 q_idx; ··· 891 892 #define NETVSC_MIN_OUT_MSG_SIZE (sizeof(struct vmpacket_descriptor) + \ 892 893 sizeof(struct nvsp_message)) 893 894 #define NETVSC_MIN_IN_MSG_SIZE sizeof(struct vmpacket_descriptor) 895 + 896 + /* Maximum # of contiguous data ranges that can make up a trasmitted packet. 897 + * Typically it's the max SKB fragments plus 2 for the rndis packet and the 898 + * linear portion of the SKB. But if MAX_SKB_FRAGS is large, the value may 899 + * need to be limited to MAX_PAGE_BUFFER_COUNT, which is the max # of entries 900 + * in a GPA direct packet sent to netvsp over VMBus. 901 + */ 902 + #if MAX_SKB_FRAGS + 2 < MAX_PAGE_BUFFER_COUNT 903 + #define MAX_DATA_RANGES (MAX_SKB_FRAGS + 2) 904 + #else 905 + #define MAX_DATA_RANGES MAX_PAGE_BUFFER_COUNT 906 + #endif 894 907 895 908 /* Estimated requestor size: 896 909 * out_ring_size/min_out_msg_size + in_ring_size/min_in_msg_size
+48 -9
drivers/net/hyperv/netvsc.c
··· 953 953 + pend_size; 954 954 int i; 955 955 u32 padding = 0; 956 - u32 page_count = packet->cp_partial ? packet->rmsg_pgcnt : 957 - packet->page_buf_cnt; 956 + u32 page_count = packet->cp_partial ? 1 : packet->page_buf_cnt; 958 957 u32 remain; 959 958 960 959 /* Add padding */ ··· 1054 1055 return 0; 1055 1056 } 1056 1057 1058 + /* Build an "array" of mpb entries describing the data to be transferred 1059 + * over VMBus. After the desc header fields, each "array" entry is variable 1060 + * size, and each entry starts after the end of the previous entry. The 1061 + * "offset" and "len" fields for each entry imply the size of the entry. 1062 + * 1063 + * The pfns are in HV_HYP_PAGE_SIZE, because all communication with Hyper-V 1064 + * uses that granularity, even if the system page size of the guest is larger. 1065 + * Each entry in the input "pb" array must describe a contiguous range of 1066 + * guest physical memory so that the pfns are sequential if the range crosses 1067 + * a page boundary. The offset field must be < HV_HYP_PAGE_SIZE. 1068 + */ 1069 + static inline void netvsc_build_mpb_array(struct hv_page_buffer *pb, 1070 + u32 page_buffer_count, 1071 + struct vmbus_packet_mpb_array *desc, 1072 + u32 *desc_size) 1073 + { 1074 + struct hv_mpb_array *mpb_entry = &desc->range; 1075 + int i, j; 1076 + 1077 + for (i = 0; i < page_buffer_count; i++) { 1078 + u32 offset = pb[i].offset; 1079 + u32 len = pb[i].len; 1080 + 1081 + mpb_entry->offset = offset; 1082 + mpb_entry->len = len; 1083 + 1084 + for (j = 0; j < HVPFN_UP(offset + len); j++) 1085 + mpb_entry->pfn_array[j] = pb[i].pfn + j; 1086 + 1087 + mpb_entry = (struct hv_mpb_array *)&mpb_entry->pfn_array[j]; 1088 + } 1089 + 1090 + desc->rangecount = page_buffer_count; 1091 + *desc_size = (char *)mpb_entry - (char *)desc; 1092 + } 1093 + 1057 1094 static inline int netvsc_send_pkt( 1058 1095 struct hv_device *device, 1059 1096 struct hv_netvsc_packet *packet, ··· 1132 1097 1133 1098 packet->dma_range = NULL; 1134 1099 if (packet->page_buf_cnt) { 1100 + struct vmbus_channel_packet_page_buffer desc; 1101 + u32 desc_size; 1102 + 1135 1103 if (packet->cp_partial) 1136 - pb += packet->rmsg_pgcnt; 1104 + pb++; 1137 1105 1138 1106 ret = netvsc_dma_map(ndev_ctx->device_ctx, packet, pb); 1139 1107 if (ret) { ··· 1144 1106 goto exit; 1145 1107 } 1146 1108 1147 - ret = vmbus_sendpacket_pagebuffer(out_channel, 1148 - pb, packet->page_buf_cnt, 1149 - &nvmsg, sizeof(nvmsg), 1150 - req_id); 1151 - 1109 + netvsc_build_mpb_array(pb, packet->page_buf_cnt, 1110 + (struct vmbus_packet_mpb_array *)&desc, 1111 + &desc_size); 1112 + ret = vmbus_sendpacket_mpb_desc(out_channel, 1113 + (struct vmbus_packet_mpb_array *)&desc, 1114 + desc_size, &nvmsg, sizeof(nvmsg), req_id); 1152 1115 if (ret) 1153 1116 netvsc_dma_unmap(ndev_ctx->device_ctx, packet); 1154 1117 } else { ··· 1298 1259 packet->send_buf_index = section_index; 1299 1260 1300 1261 if (packet->cp_partial) { 1301 - packet->page_buf_cnt -= packet->rmsg_pgcnt; 1262 + packet->page_buf_cnt--; 1302 1263 packet->total_data_buflen = msd_len + packet->rmsg_size; 1303 1264 } else { 1304 1265 packet->page_buf_cnt = 0;
+14 -48
drivers/net/hyperv/netvsc_drv.c
··· 326 326 return txq; 327 327 } 328 328 329 - static u32 fill_pg_buf(unsigned long hvpfn, u32 offset, u32 len, 330 - struct hv_page_buffer *pb) 331 - { 332 - int j = 0; 333 - 334 - hvpfn += offset >> HV_HYP_PAGE_SHIFT; 335 - offset = offset & ~HV_HYP_PAGE_MASK; 336 - 337 - while (len > 0) { 338 - unsigned long bytes; 339 - 340 - bytes = HV_HYP_PAGE_SIZE - offset; 341 - if (bytes > len) 342 - bytes = len; 343 - pb[j].pfn = hvpfn; 344 - pb[j].offset = offset; 345 - pb[j].len = bytes; 346 - 347 - offset += bytes; 348 - len -= bytes; 349 - 350 - if (offset == HV_HYP_PAGE_SIZE && len) { 351 - hvpfn++; 352 - offset = 0; 353 - j++; 354 - } 355 - } 356 - 357 - return j + 1; 358 - } 359 - 360 329 static u32 init_page_array(void *hdr, u32 len, struct sk_buff *skb, 361 330 struct hv_netvsc_packet *packet, 362 331 struct hv_page_buffer *pb) 363 332 { 364 - u32 slots_used = 0; 365 - char *data = skb->data; 366 333 int frags = skb_shinfo(skb)->nr_frags; 367 334 int i; 368 335 ··· 338 371 * 2. skb linear data 339 372 * 3. skb fragment data 340 373 */ 341 - slots_used += fill_pg_buf(virt_to_hvpfn(hdr), 342 - offset_in_hvpage(hdr), 343 - len, 344 - &pb[slots_used]); 345 374 375 + pb[0].offset = offset_in_hvpage(hdr); 376 + pb[0].len = len; 377 + pb[0].pfn = virt_to_hvpfn(hdr); 346 378 packet->rmsg_size = len; 347 - packet->rmsg_pgcnt = slots_used; 348 379 349 - slots_used += fill_pg_buf(virt_to_hvpfn(data), 350 - offset_in_hvpage(data), 351 - skb_headlen(skb), 352 - &pb[slots_used]); 380 + pb[1].offset = offset_in_hvpage(skb->data); 381 + pb[1].len = skb_headlen(skb); 382 + pb[1].pfn = virt_to_hvpfn(skb->data); 353 383 354 384 for (i = 0; i < frags; i++) { 355 385 skb_frag_t *frag = skb_shinfo(skb)->frags + i; 386 + struct hv_page_buffer *cur_pb = &pb[i + 2]; 387 + u64 pfn = page_to_hvpfn(skb_frag_page(frag)); 388 + u32 offset = skb_frag_off(frag); 356 389 357 - slots_used += fill_pg_buf(page_to_hvpfn(skb_frag_page(frag)), 358 - skb_frag_off(frag), 359 - skb_frag_size(frag), 360 - &pb[slots_used]); 390 + cur_pb->offset = offset_in_hvpage(offset); 391 + cur_pb->len = skb_frag_size(frag); 392 + cur_pb->pfn = pfn + (offset >> HV_HYP_PAGE_SHIFT); 361 393 } 362 - return slots_used; 394 + return frags + 2; 363 395 } 364 396 365 397 static int count_skb_frag_slots(struct sk_buff *skb) ··· 449 483 struct net_device *vf_netdev; 450 484 u32 rndis_msg_size; 451 485 u32 hash; 452 - struct hv_page_buffer pb[MAX_PAGE_BUFFER_COUNT]; 486 + struct hv_page_buffer pb[MAX_DATA_RANGES]; 453 487 454 488 /* If VF is present and up then redirect packets to it. 455 489 * Skip the VF if it is marked down or has no carrier.
+5 -19
drivers/net/hyperv/rndis_filter.c
··· 225 225 struct rndis_request *req) 226 226 { 227 227 struct hv_netvsc_packet *packet; 228 - struct hv_page_buffer page_buf[2]; 229 - struct hv_page_buffer *pb = page_buf; 228 + struct hv_page_buffer pb; 230 229 int ret; 231 230 232 231 /* Setup the packet to send it */ ··· 234 235 packet->total_data_buflen = req->request_msg.msg_len; 235 236 packet->page_buf_cnt = 1; 236 237 237 - pb[0].pfn = virt_to_phys(&req->request_msg) >> 238 - HV_HYP_PAGE_SHIFT; 239 - pb[0].len = req->request_msg.msg_len; 240 - pb[0].offset = offset_in_hvpage(&req->request_msg); 241 - 242 - /* Add one page_buf when request_msg crossing page boundary */ 243 - if (pb[0].offset + pb[0].len > HV_HYP_PAGE_SIZE) { 244 - packet->page_buf_cnt++; 245 - pb[0].len = HV_HYP_PAGE_SIZE - 246 - pb[0].offset; 247 - pb[1].pfn = virt_to_phys((void *)&req->request_msg 248 - + pb[0].len) >> HV_HYP_PAGE_SHIFT; 249 - pb[1].offset = 0; 250 - pb[1].len = req->request_msg.msg_len - 251 - pb[0].len; 252 - } 238 + pb.pfn = virt_to_phys(&req->request_msg) >> HV_HYP_PAGE_SHIFT; 239 + pb.len = req->request_msg.msg_len; 240 + pb.offset = offset_in_hvpage(&req->request_msg); 253 241 254 242 trace_rndis_send(dev->ndev, 0, &req->request_msg); 255 243 256 244 rcu_read_lock_bh(); 257 - ret = netvsc_send(dev->ndev, packet, NULL, pb, NULL, false); 245 + ret = netvsc_send(dev->ndev, packet, NULL, &pb, NULL, false); 258 246 rcu_read_unlock_bh(); 259 247 260 248 return ret;
-7
drivers/net/phy/micrel.c
··· 2027 2027 return err; 2028 2028 } 2029 2029 2030 - /* According to KSZ9477 Errata DS80000754C (Module 4) all EEE modes 2031 - * in this switch shall be regarded as broken. 2032 - */ 2033 - if (phydev->dev_flags & MICREL_NO_EEE) 2034 - phy_disable_eee(phydev); 2035 - 2036 2030 return kszphy_config_init(phydev); 2037 2031 } 2038 2032 ··· 5699 5705 .handle_interrupt = kszphy_handle_interrupt, 5700 5706 .suspend = genphy_suspend, 5701 5707 .resume = ksz9477_resume, 5702 - .get_features = ksz9477_get_features, 5703 5708 } }; 5704 5709 5705 5710 module_phy_driver(ksphy_driver);
+1
drivers/net/wireless/mediatek/mt76/dma.c
··· 1011 1011 int i; 1012 1012 1013 1013 mt76_worker_disable(&dev->tx_worker); 1014 + napi_disable(&dev->tx_napi); 1014 1015 netif_napi_del(&dev->tx_napi); 1015 1016 1016 1017 for (i = 0; i < ARRAY_SIZE(dev->phys); i++) {
+2 -2
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
··· 1924 1924 mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta); 1925 1925 mt7925_mcu_sta_eht_mld_tlv(skb, info->vif, info->link_sta->sta); 1926 1926 } 1927 - 1928 - mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta); 1929 1927 } 1930 1928 1931 1929 if (!info->enable) { 1932 1930 mt7925_mcu_sta_remove_tlv(skb); 1933 1931 mt76_connac_mcu_add_tlv(skb, STA_REC_MLD_OFF, 1934 1932 sizeof(struct tlv)); 1933 + } else { 1934 + mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta); 1935 1935 } 1936 1936 1937 1937 return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true);
+1
drivers/scsi/storvsc_drv.c
··· 1819 1819 return SCSI_MLQUEUE_DEVICE_BUSY; 1820 1820 } 1821 1821 1822 + payload->rangecount = 1; 1822 1823 payload->range.len = length; 1823 1824 payload->range.offset = offset_in_hvpg; 1824 1825
-7
include/linux/hyperv.h
··· 1167 1167 enum vmbus_packet_type type, 1168 1168 u32 flags); 1169 1169 1170 - extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, 1171 - struct hv_page_buffer pagebuffers[], 1172 - u32 pagecount, 1173 - void *buffer, 1174 - u32 bufferlen, 1175 - u64 requestid); 1176 - 1177 1170 extern int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel, 1178 1171 struct vmbus_packet_mpb_array *mpb, 1179 1172 u32 desc_size,
-1
include/linux/micrel_phy.h
··· 44 44 #define MICREL_PHY_50MHZ_CLK BIT(0) 45 45 #define MICREL_PHY_FXEN BIT(1) 46 46 #define MICREL_KSZ8_P1_ERRATA BIT(2) 47 - #define MICREL_NO_EEE BIT(3) 48 47 49 48 #define MICREL_KSZ9021_EXTREG_CTRL 0xB 50 49 #define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC
+1
include/net/bluetooth/hci_core.h
··· 1798 1798 void hci_uuids_clear(struct hci_dev *hdev); 1799 1799 1800 1800 void hci_link_keys_clear(struct hci_dev *hdev); 1801 + u8 *hci_conn_key_enc_size(struct hci_conn *conn); 1801 1802 struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 1802 1803 struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, 1803 1804 bdaddr_t *bdaddr, u8 *val, u8 type,
+15
include/net/sch_generic.h
··· 1031 1031 return skb; 1032 1032 } 1033 1033 1034 + static inline struct sk_buff *qdisc_dequeue_internal(struct Qdisc *sch, bool direct) 1035 + { 1036 + struct sk_buff *skb; 1037 + 1038 + skb = __skb_dequeue(&sch->gso_skb); 1039 + if (skb) { 1040 + sch->q.qlen--; 1041 + return skb; 1042 + } 1043 + if (direct) 1044 + return __qdisc_dequeue_head(&sch->q); 1045 + else 1046 + return sch->dequeue(sch); 1047 + } 1048 + 1034 1049 static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch) 1035 1050 { 1036 1051 struct sk_buff *skb = __qdisc_dequeue_head(&sch->q);
+18 -13
net/batman-adv/hard-interface.c
··· 506 506 return false; 507 507 } 508 508 509 - static void batadv_check_known_mac_addr(const struct net_device *net_dev) 509 + static void batadv_check_known_mac_addr(const struct batadv_hard_iface *hard_iface) 510 510 { 511 - const struct batadv_hard_iface *hard_iface; 511 + const struct net_device *mesh_iface = hard_iface->mesh_iface; 512 + const struct batadv_hard_iface *tmp_hard_iface; 512 513 513 - rcu_read_lock(); 514 - list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) { 515 - if (hard_iface->if_status != BATADV_IF_ACTIVE && 516 - hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED) 514 + if (!mesh_iface) 515 + return; 516 + 517 + list_for_each_entry(tmp_hard_iface, &batadv_hardif_list, list) { 518 + if (tmp_hard_iface == hard_iface) 517 519 continue; 518 520 519 - if (hard_iface->net_dev == net_dev) 521 + if (tmp_hard_iface->mesh_iface != mesh_iface) 520 522 continue; 521 523 522 - if (!batadv_compare_eth(hard_iface->net_dev->dev_addr, 523 - net_dev->dev_addr)) 524 + if (tmp_hard_iface->if_status == BATADV_IF_NOT_IN_USE) 525 + continue; 526 + 527 + if (!batadv_compare_eth(tmp_hard_iface->net_dev->dev_addr, 528 + hard_iface->net_dev->dev_addr)) 524 529 continue; 525 530 526 531 pr_warn("The newly added mac address (%pM) already exists on: %s\n", 527 - net_dev->dev_addr, hard_iface->net_dev->name); 532 + hard_iface->net_dev->dev_addr, tmp_hard_iface->net_dev->name); 528 533 pr_warn("It is strongly recommended to keep mac addresses unique to avoid problems!\n"); 529 534 } 530 - rcu_read_unlock(); 531 535 } 532 536 533 537 /** ··· 767 763 hard_iface->net_dev->name, hardif_mtu, 768 764 required_mtu); 769 765 766 + batadv_check_known_mac_addr(hard_iface); 767 + 770 768 if (batadv_hardif_is_iface_up(hard_iface)) 771 769 batadv_hardif_activate_interface(hard_iface); 772 770 else ··· 907 901 908 902 batadv_v_hardif_init(hard_iface); 909 903 910 - batadv_check_known_mac_addr(hard_iface->net_dev); 911 904 kref_get(&hard_iface->refcount); 912 905 list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list); 913 906 batadv_hardif_generation++; ··· 993 988 if (hard_iface->if_status == BATADV_IF_NOT_IN_USE) 994 989 goto hardif_put; 995 990 996 - batadv_check_known_mac_addr(hard_iface->net_dev); 991 + batadv_check_known_mac_addr(hard_iface); 997 992 998 993 bat_priv = netdev_priv(hard_iface->mesh_iface); 999 994 bat_priv->algo_ops->iface.update_mac(hard_iface);
+24
net/bluetooth/hci_conn.c
··· 3023 3023 3024 3024 kfree_skb(skb); 3025 3025 } 3026 + 3027 + u8 *hci_conn_key_enc_size(struct hci_conn *conn) 3028 + { 3029 + if (conn->type == ACL_LINK) { 3030 + struct link_key *key; 3031 + 3032 + key = hci_find_link_key(conn->hdev, &conn->dst); 3033 + if (!key) 3034 + return NULL; 3035 + 3036 + return &key->pin_len; 3037 + } else if (conn->type == LE_LINK) { 3038 + struct smp_ltk *ltk; 3039 + 3040 + ltk = hci_find_ltk(conn->hdev, &conn->dst, conn->dst_type, 3041 + conn->role); 3042 + if (!ltk) 3043 + return NULL; 3044 + 3045 + return &ltk->enc_size; 3046 + } 3047 + 3048 + return NULL; 3049 + }
+42 -31
net/bluetooth/hci_event.c
··· 739 739 handle); 740 740 conn->enc_key_size = 0; 741 741 } else { 742 + u8 *key_enc_size = hci_conn_key_enc_size(conn); 743 + 742 744 conn->enc_key_size = rp->key_size; 743 745 status = 0; 744 746 745 - if (conn->enc_key_size < hdev->min_enc_key_size) { 747 + /* Attempt to check if the key size is too small or if it has 748 + * been downgraded from the last time it was stored as part of 749 + * the link_key. 750 + */ 751 + if (conn->enc_key_size < hdev->min_enc_key_size || 752 + (key_enc_size && conn->enc_key_size < *key_enc_size)) { 746 753 /* As slave role, the conn->state has been set to 747 754 * BT_CONNECTED and l2cap conn req might not be received 748 755 * yet, at this moment the l2cap layer almost does ··· 762 755 clear_bit(HCI_CONN_ENCRYPT, &conn->flags); 763 756 clear_bit(HCI_CONN_AES_CCM, &conn->flags); 764 757 } 758 + 759 + /* Update the key encryption size with the connection one */ 760 + if (key_enc_size && *key_enc_size != conn->enc_key_size) 761 + *key_enc_size = conn->enc_key_size; 765 762 } 766 763 767 764 hci_encrypt_cfm(conn, status); ··· 3076 3065 hci_dev_unlock(hdev); 3077 3066 } 3078 3067 3068 + static int hci_read_enc_key_size(struct hci_dev *hdev, struct hci_conn *conn) 3069 + { 3070 + struct hci_cp_read_enc_key_size cp; 3071 + u8 *key_enc_size = hci_conn_key_enc_size(conn); 3072 + 3073 + if (!read_key_size_capable(hdev)) { 3074 + conn->enc_key_size = HCI_LINK_KEY_SIZE; 3075 + return -EOPNOTSUPP; 3076 + } 3077 + 3078 + bt_dev_dbg(hdev, "hcon %p", conn); 3079 + 3080 + memset(&cp, 0, sizeof(cp)); 3081 + cp.handle = cpu_to_le16(conn->handle); 3082 + 3083 + /* If the key enc_size is already known, use it as conn->enc_key_size, 3084 + * otherwise use hdev->min_enc_key_size so the likes of 3085 + * l2cap_check_enc_key_size don't fail while waiting for 3086 + * HCI_OP_READ_ENC_KEY_SIZE response. 3087 + */ 3088 + if (key_enc_size && *key_enc_size) 3089 + conn->enc_key_size = *key_enc_size; 3090 + else 3091 + conn->enc_key_size = hdev->min_enc_key_size; 3092 + 3093 + return hci_send_cmd(hdev, HCI_OP_READ_ENC_KEY_SIZE, sizeof(cp), &cp); 3094 + } 3095 + 3079 3096 static void hci_conn_complete_evt(struct hci_dev *hdev, void *data, 3080 3097 struct sk_buff *skb) 3081 3098 { ··· 3196 3157 if (ev->encr_mode == 1 && !test_bit(HCI_CONN_ENCRYPT, &conn->flags) && 3197 3158 ev->link_type == ACL_LINK) { 3198 3159 struct link_key *key; 3199 - struct hci_cp_read_enc_key_size cp; 3200 3160 3201 3161 key = hci_find_link_key(hdev, &ev->bdaddr); 3202 3162 if (key) { 3203 3163 set_bit(HCI_CONN_ENCRYPT, &conn->flags); 3204 - 3205 - if (!read_key_size_capable(hdev)) { 3206 - conn->enc_key_size = HCI_LINK_KEY_SIZE; 3207 - } else { 3208 - cp.handle = cpu_to_le16(conn->handle); 3209 - if (hci_send_cmd(hdev, HCI_OP_READ_ENC_KEY_SIZE, 3210 - sizeof(cp), &cp)) { 3211 - bt_dev_err(hdev, "sending read key size failed"); 3212 - conn->enc_key_size = HCI_LINK_KEY_SIZE; 3213 - } 3214 - } 3215 - 3164 + hci_read_enc_key_size(hdev, conn); 3216 3165 hci_encrypt_cfm(conn, ev->status); 3217 3166 } 3218 3167 } ··· 3639 3612 3640 3613 /* Try reading the encryption key size for encrypted ACL links */ 3641 3614 if (!ev->status && ev->encrypt && conn->type == ACL_LINK) { 3642 - struct hci_cp_read_enc_key_size cp; 3643 - 3644 - /* Only send HCI_Read_Encryption_Key_Size if the 3645 - * controller really supports it. If it doesn't, assume 3646 - * the default size (16). 3647 - */ 3648 - if (!read_key_size_capable(hdev)) { 3649 - conn->enc_key_size = HCI_LINK_KEY_SIZE; 3615 + if (hci_read_enc_key_size(hdev, conn)) 3650 3616 goto notify; 3651 - } 3652 - 3653 - cp.handle = cpu_to_le16(conn->handle); 3654 - if (hci_send_cmd(hdev, HCI_OP_READ_ENC_KEY_SIZE, 3655 - sizeof(cp), &cp)) { 3656 - bt_dev_err(hdev, "sending read key size failed"); 3657 - conn->enc_key_size = HCI_LINK_KEY_SIZE; 3658 - goto notify; 3659 - } 3660 3617 3661 3618 goto unlock; 3662 3619 }
+6 -3
net/bluetooth/mgmt.c
··· 7506 7506 struct mgmt_cp_add_device *cp = cmd->param; 7507 7507 7508 7508 if (!err) { 7509 + struct hci_conn_params *params; 7510 + 7511 + params = hci_conn_params_lookup(hdev, &cp->addr.bdaddr, 7512 + le_addr_type(cp->addr.type)); 7513 + 7509 7514 device_added(cmd->sk, hdev, &cp->addr.bdaddr, cp->addr.type, 7510 7515 cp->action); 7511 7516 device_flags_changed(NULL, hdev, &cp->addr.bdaddr, 7512 7517 cp->addr.type, hdev->conn_flags, 7513 - PTR_UINT(cmd->user_data)); 7518 + params ? params->flags : 0); 7514 7519 } 7515 7520 7516 7521 mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_ADD_DEVICE, ··· 7617 7612 err = -ENOMEM; 7618 7613 goto unlock; 7619 7614 } 7620 - 7621 - cmd->user_data = UINT_PTR(current_flags); 7622 7615 7623 7616 err = hci_cmd_sync_queue(hdev, add_device_sync, cmd, 7624 7617 add_device_complete);
+2
net/core/dev.c
··· 10441 10441 if (!(features & feature) && (lower->features & feature)) { 10442 10442 netdev_dbg(upper, "Disabling feature %pNF on lower dev %s.\n", 10443 10443 &feature, lower->name); 10444 + netdev_lock_ops(lower); 10444 10445 lower->wanted_features &= ~feature; 10445 10446 __netdev_update_features(lower); 10446 10447 ··· 10450 10449 &feature, lower->name); 10451 10450 else 10452 10451 netdev_features_change(lower); 10452 + netdev_unlock_ops(lower); 10453 10453 } 10454 10454 } 10455 10455 }
+7
net/core/devmem.c
··· 200 200 201 201 refcount_set(&binding->ref, 1); 202 202 203 + mutex_init(&binding->lock); 204 + 203 205 binding->dmabuf = dmabuf; 204 206 205 207 binding->attachment = dma_buf_attach(binding->dmabuf, dev->dev.parent); ··· 381 379 xa_for_each(&binding->bound_rxqs, xa_idx, bound_rxq) { 382 380 if (bound_rxq == rxq) { 383 381 xa_erase(&binding->bound_rxqs, xa_idx); 382 + if (xa_empty(&binding->bound_rxqs)) { 383 + mutex_lock(&binding->lock); 384 + binding->dev = NULL; 385 + mutex_unlock(&binding->lock); 386 + } 384 387 break; 385 388 } 386 389 }
+2
net/core/devmem.h
··· 20 20 struct sg_table *sgt; 21 21 struct net_device *dev; 22 22 struct gen_pool *chunk_pool; 23 + /* Protect dev */ 24 + struct mutex lock; 23 25 24 26 /* The user holds a ref (via the netlink API) for as long as they want 25 27 * the binding to remain alive. Each page pool using this binding holds
+11
net/core/netdev-genl.c
··· 979 979 { 980 980 struct net_devmem_dmabuf_binding *binding; 981 981 struct net_devmem_dmabuf_binding *temp; 982 + netdevice_tracker dev_tracker; 982 983 struct net_device *dev; 983 984 984 985 mutex_lock(&priv->lock); 985 986 list_for_each_entry_safe(binding, temp, &priv->bindings, list) { 987 + mutex_lock(&binding->lock); 986 988 dev = binding->dev; 989 + if (!dev) { 990 + mutex_unlock(&binding->lock); 991 + net_devmem_unbind_dmabuf(binding); 992 + continue; 993 + } 994 + netdev_hold(dev, &dev_tracker, GFP_KERNEL); 995 + mutex_unlock(&binding->lock); 996 + 987 997 netdev_lock(dev); 988 998 net_devmem_unbind_dmabuf(binding); 989 999 netdev_unlock(dev); 1000 + netdev_put(dev, &dev_tracker); 990 1001 } 991 1002 mutex_unlock(&priv->lock); 992 1003 }
+4 -2
net/mac80211/main.c
··· 1354 1354 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); 1355 1355 1356 1356 1357 - local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) + 1358 - sizeof(void *) * channels, GFP_KERNEL); 1357 + local->int_scan_req = kzalloc(struct_size(local->int_scan_req, 1358 + channels, channels), 1359 + GFP_KERNEL); 1359 1360 if (!local->int_scan_req) 1360 1361 return -ENOMEM; 1362 + local->int_scan_req->n_channels = channels; 1361 1363 1362 1364 eth_broadcast_addr(local->int_scan_req->bssid); 1363 1365
+11 -4
net/mctp/device.c
··· 117 117 struct net_device *dev; 118 118 struct ifaddrmsg *hdr; 119 119 struct mctp_dev *mdev; 120 - int ifindex, rc; 120 + int ifindex = 0, rc; 121 121 122 - hdr = nlmsg_data(cb->nlh); 123 - // filter by ifindex if requested 124 - ifindex = hdr->ifa_index; 122 + /* Filter by ifindex if a header is provided */ 123 + if (cb->nlh->nlmsg_len >= nlmsg_msg_size(sizeof(*hdr))) { 124 + hdr = nlmsg_data(cb->nlh); 125 + ifindex = hdr->ifa_index; 126 + } else { 127 + if (cb->strict_check) { 128 + NL_SET_ERR_MSG(cb->extack, "mctp: Invalid header for addr dump request"); 129 + return -EINVAL; 130 + } 131 + } 125 132 126 133 rcu_read_lock(); 127 134 for_each_netdev_dump(net, dev, mcb->ifindex) {
+3 -1
net/mctp/route.c
··· 313 313 314 314 key = flow->key; 315 315 316 - if (WARN_ON(key->dev && key->dev != dev)) 316 + if (key->dev) { 317 + WARN_ON(key->dev != dev); 317 318 return; 319 + } 318 320 319 321 mctp_dev_set_key(dev, key); 320 322 }
+1 -1
net/sched/sch_codel.c
··· 144 144 145 145 qlen = sch->q.qlen; 146 146 while (sch->q.qlen > sch->limit) { 147 - struct sk_buff *skb = __qdisc_dequeue_head(&sch->q); 147 + struct sk_buff *skb = qdisc_dequeue_internal(sch, true); 148 148 149 149 dropped += qdisc_pkt_len(skb); 150 150 qdisc_qstats_backlog_dec(sch, skb);
+1 -1
net/sched/sch_fq.c
··· 1136 1136 sch_tree_lock(sch); 1137 1137 } 1138 1138 while (sch->q.qlen > sch->limit) { 1139 - struct sk_buff *skb = fq_dequeue(sch); 1139 + struct sk_buff *skb = qdisc_dequeue_internal(sch, false); 1140 1140 1141 1141 if (!skb) 1142 1142 break;
+1 -1
net/sched/sch_fq_codel.c
··· 441 441 442 442 while (sch->q.qlen > sch->limit || 443 443 q->memory_usage > q->memory_limit) { 444 - struct sk_buff *skb = fq_codel_dequeue(sch); 444 + struct sk_buff *skb = qdisc_dequeue_internal(sch, false); 445 445 446 446 q->cstats.drop_len += qdisc_pkt_len(skb); 447 447 rtnl_kfree_skbs(skb, skb);
+1 -1
net/sched/sch_fq_pie.c
··· 366 366 367 367 /* Drop excess packets if new limit is lower */ 368 368 while (sch->q.qlen > sch->limit) { 369 - struct sk_buff *skb = fq_pie_qdisc_dequeue(sch); 369 + struct sk_buff *skb = qdisc_dequeue_internal(sch, false); 370 370 371 371 len_dropped += qdisc_pkt_len(skb); 372 372 num_dropped += 1;
+1 -1
net/sched/sch_hhf.c
··· 564 564 qlen = sch->q.qlen; 565 565 prev_backlog = sch->qstats.backlog; 566 566 while (sch->q.qlen > sch->limit) { 567 - struct sk_buff *skb = hhf_dequeue(sch); 567 + struct sk_buff *skb = qdisc_dequeue_internal(sch, false); 568 568 569 569 rtnl_kfree_skbs(skb, skb); 570 570 }
+1 -1
net/sched/sch_pie.c
··· 195 195 /* Drop excess packets if new limit is lower */ 196 196 qlen = sch->q.qlen; 197 197 while (sch->q.qlen > sch->limit) { 198 - struct sk_buff *skb = __qdisc_dequeue_head(&sch->q); 198 + struct sk_buff *skb = qdisc_dequeue_internal(sch, true); 199 199 200 200 dropped += qdisc_pkt_len(skb); 201 201 qdisc_qstats_backlog_dec(sch, skb);
+2 -1
net/tls/tls_strp.c
··· 396 396 return 0; 397 397 398 398 shinfo = skb_shinfo(strp->anchor); 399 - shinfo->frag_list = NULL; 400 399 401 400 /* If we don't know the length go max plus page for cipher overhead */ 402 401 need_spc = strp->stm.full_len ?: TLS_MAX_PAYLOAD_SIZE + PAGE_SIZE; ··· 410 411 skb_fill_page_desc(strp->anchor, shinfo->nr_frags++, 411 412 page, 0, 0); 412 413 } 414 + 415 + shinfo->frag_list = NULL; 413 416 414 417 strp->copy_mode = 1; 415 418 strp->stm.offset = 0;
+15 -7
tools/net/ynl/pyynl/ethtool.py
··· 338 338 print('Capabilities:') 339 339 [print(f'\t{v}') for v in bits_to_dict(tsinfo['timestamping'])] 340 340 341 - print(f'PTP Hardware Clock: {tsinfo["phc-index"]}') 341 + print(f'PTP Hardware Clock: {tsinfo.get("phc-index", "none")}') 342 342 343 - print('Hardware Transmit Timestamp Modes:') 344 - [print(f'\t{v}') for v in bits_to_dict(tsinfo['tx-types'])] 343 + if 'tx-types' in tsinfo: 344 + print('Hardware Transmit Timestamp Modes:') 345 + [print(f'\t{v}') for v in bits_to_dict(tsinfo['tx-types'])] 346 + else: 347 + print('Hardware Transmit Timestamp Modes: none') 345 348 346 - print('Hardware Receive Filter Modes:') 347 - [print(f'\t{v}') for v in bits_to_dict(tsinfo['rx-filters'])] 349 + if 'rx-filters' in tsinfo: 350 + print('Hardware Receive Filter Modes:') 351 + [print(f'\t{v}') for v in bits_to_dict(tsinfo['rx-filters'])] 352 + else: 353 + print('Hardware Receive Filter Modes: none') 348 354 349 - print('Statistics:') 350 - [print(f'\t{k}: {v}') for k, v in tsinfo['stats'].items()] 355 + if 'stats' in tsinfo and tsinfo['stats']: 356 + print('Statistics:') 357 + [print(f'\t{k}: {v}') for k, v in tsinfo['stats'].items()] 358 + 351 359 return 352 360 353 361 print(f'Settings for {args.device}:')
+3 -4
tools/net/ynl/pyynl/ynl_gen_c.py
··· 1143 1143 self.pure_nested_structs[nested].request = True 1144 1144 if attr in rs_members['reply']: 1145 1145 self.pure_nested_structs[nested].reply = True 1146 - 1147 - if spec.is_multi_val(): 1148 - child = self.pure_nested_structs.get(nested) 1149 - child.in_multi_val = True 1146 + if spec.is_multi_val(): 1147 + child = self.pure_nested_structs.get(nested) 1148 + child.in_multi_val = True 1150 1149 1151 1150 self._sort_pure_types() 1152 1151
+22 -33
tools/testing/selftests/drivers/net/hw/ncdevmem.c
··· 431 431 return 0; 432 432 } 433 433 434 + static struct netdev_queue_id *create_queues(void) 435 + { 436 + struct netdev_queue_id *queues; 437 + size_t i = 0; 438 + 439 + queues = calloc(num_queues, sizeof(*queues)); 440 + for (i = 0; i < num_queues; i++) { 441 + queues[i]._present.type = 1; 442 + queues[i]._present.id = 1; 443 + queues[i].type = NETDEV_QUEUE_TYPE_RX; 444 + queues[i].id = start_queue + i; 445 + } 446 + 447 + return queues; 448 + } 449 + 434 450 int do_server(struct memory_buffer *mem) 435 451 { 436 452 char ctrl_data[sizeof(int) * 20000]; ··· 464 448 char buffer[256]; 465 449 int socket_fd; 466 450 int client_fd; 467 - size_t i = 0; 468 451 int ret; 469 452 470 453 ret = parse_address(server_ip, atoi(port), &server_sin); ··· 486 471 487 472 sleep(1); 488 473 489 - queues = malloc(sizeof(*queues) * num_queues); 490 - 491 - for (i = 0; i < num_queues; i++) { 492 - queues[i]._present.type = 1; 493 - queues[i]._present.id = 1; 494 - queues[i].type = NETDEV_QUEUE_TYPE_RX; 495 - queues[i].id = start_queue + i; 496 - } 497 - 498 - if (bind_rx_queue(ifindex, mem->fd, queues, num_queues, &ys)) 474 + if (bind_rx_queue(ifindex, mem->fd, create_queues(), num_queues, &ys)) 499 475 error(1, 0, "Failed to bind\n"); 500 476 501 477 tmp_mem = malloc(mem->size); ··· 551 545 goto cleanup; 552 546 } 553 547 554 - i++; 555 548 for (cm = CMSG_FIRSTHDR(&msg); cm; cm = CMSG_NXTHDR(&msg, cm)) { 556 549 if (cm->cmsg_level != SOL_SOCKET || 557 550 (cm->cmsg_type != SCM_DEVMEM_DMABUF && ··· 635 630 636 631 void run_devmem_tests(void) 637 632 { 638 - struct netdev_queue_id *queues; 639 633 struct memory_buffer *mem; 640 634 struct ynl_sock *ys; 641 - size_t i = 0; 642 635 643 636 mem = provider->alloc(getpagesize() * NUM_PAGES); 644 637 ··· 644 641 if (configure_rss()) 645 642 error(1, 0, "rss error\n"); 646 643 647 - queues = calloc(num_queues, sizeof(*queues)); 648 - 649 644 if (configure_headersplit(1)) 650 645 error(1, 0, "Failed to configure header split\n"); 651 646 652 - if (!bind_rx_queue(ifindex, mem->fd, queues, num_queues, &ys)) 647 + if (!bind_rx_queue(ifindex, mem->fd, 648 + calloc(num_queues, sizeof(struct netdev_queue_id)), 649 + num_queues, &ys)) 653 650 error(1, 0, "Binding empty queues array should have failed\n"); 654 - 655 - for (i = 0; i < num_queues; i++) { 656 - queues[i]._present.type = 1; 657 - queues[i]._present.id = 1; 658 - queues[i].type = NETDEV_QUEUE_TYPE_RX; 659 - queues[i].id = start_queue + i; 660 - } 661 651 662 652 if (configure_headersplit(0)) 663 653 error(1, 0, "Failed to configure header split\n"); 664 654 665 - if (!bind_rx_queue(ifindex, mem->fd, queues, num_queues, &ys)) 655 + if (!bind_rx_queue(ifindex, mem->fd, create_queues(), num_queues, &ys)) 666 656 error(1, 0, "Configure dmabuf with header split off should have failed\n"); 667 657 668 658 if (configure_headersplit(1)) 669 659 error(1, 0, "Failed to configure header split\n"); 670 660 671 - for (i = 0; i < num_queues; i++) { 672 - queues[i]._present.type = 1; 673 - queues[i]._present.id = 1; 674 - queues[i].type = NETDEV_QUEUE_TYPE_RX; 675 - queues[i].id = start_queue + i; 676 - } 677 - 678 - if (bind_rx_queue(ifindex, mem->fd, queues, num_queues, &ys)) 661 + if (bind_rx_queue(ifindex, mem->fd, create_queues(), num_queues, &ys)) 679 662 error(1, 0, "Failed to bind\n"); 680 663 681 664 /* Deactivating a bound queue should not be legal */
+24
tools/testing/selftests/tc-testing/tc-tests/qdiscs/codel.json
··· 189 189 "teardown": [ 190 190 "$TC qdisc del dev $DUMMY handle 1: root" 191 191 ] 192 + }, 193 + { 194 + "id": "deb1", 195 + "name": "CODEL test qdisc limit trimming", 196 + "category": ["qdisc", "codel"], 197 + "plugins": { 198 + "requires": ["nsPlugin", "scapyPlugin"] 199 + }, 200 + "setup": [ 201 + "$TC qdisc add dev $DEV1 handle 1: root codel limit 10" 202 + ], 203 + "scapy": [ 204 + { 205 + "iface": "$DEV0", 206 + "count": 10, 207 + "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)" 208 + } 209 + ], 210 + "cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root codel limit 1", 211 + "expExitCode": "0", 212 + "verifyCmd": "$TC qdisc show dev $DEV1", 213 + "matchPattern": "qdisc codel 1: root refcnt [0-9]+ limit 1p target 5ms interval 100ms", 214 + "matchCount": "1", 215 + "teardown": ["$TC qdisc del dev $DEV1 handle 1: root"] 192 216 } 193 217 ]
+22
tools/testing/selftests/tc-testing/tc-tests/qdiscs/fq.json
··· 377 377 "teardown": [ 378 378 "$TC qdisc del dev $DUMMY handle 1: root" 379 379 ] 380 + }, 381 + { 382 + "id": "9479", 383 + "name": "FQ test qdisc limit trimming", 384 + "category": ["qdisc", "fq"], 385 + "plugins": {"requires": ["nsPlugin", "scapyPlugin"]}, 386 + "setup": [ 387 + "$TC qdisc add dev $DEV1 handle 1: root fq limit 10" 388 + ], 389 + "scapy": [ 390 + { 391 + "iface": "$DEV0", 392 + "count": 10, 393 + "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)" 394 + } 395 + ], 396 + "cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root fq limit 1", 397 + "expExitCode": "0", 398 + "verifyCmd": "$TC qdisc show dev $DEV1", 399 + "matchPattern": "qdisc fq 1: root refcnt [0-9]+ limit 1p", 400 + "matchCount": "1", 401 + "teardown": ["$TC qdisc del dev $DEV1 handle 1: root"] 380 402 } 381 403 ]
+22
tools/testing/selftests/tc-testing/tc-tests/qdiscs/fq_codel.json
··· 294 294 "teardown": [ 295 295 "$TC qdisc del dev $DUMMY handle 1: root" 296 296 ] 297 + }, 298 + { 299 + "id": "0436", 300 + "name": "FQ_CODEL test qdisc limit trimming", 301 + "category": ["qdisc", "fq_codel"], 302 + "plugins": {"requires": ["nsPlugin", "scapyPlugin"]}, 303 + "setup": [ 304 + "$TC qdisc add dev $DEV1 handle 1: root fq_codel limit 10" 305 + ], 306 + "scapy": [ 307 + { 308 + "iface": "$DEV0", 309 + "count": 10, 310 + "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)" 311 + } 312 + ], 313 + "cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root fq_codel limit 1", 314 + "expExitCode": "0", 315 + "verifyCmd": "$TC qdisc show dev $DEV1", 316 + "matchPattern": "qdisc fq_codel 1: root refcnt [0-9]+ limit 1p flows 1024 quantum.*target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64", 317 + "matchCount": "1", 318 + "teardown": ["$TC qdisc del dev $DEV1 handle 1: root"] 297 319 } 298 320 ]
+22
tools/testing/selftests/tc-testing/tc-tests/qdiscs/fq_pie.json
··· 18 18 "matchCount": "1", 19 19 "teardown": [ 20 20 ] 21 + }, 22 + { 23 + "id": "83bf", 24 + "name": "FQ_PIE test qdisc limit trimming", 25 + "category": ["qdisc", "fq_pie"], 26 + "plugins": {"requires": ["nsPlugin", "scapyPlugin"]}, 27 + "setup": [ 28 + "$TC qdisc add dev $DEV1 handle 1: root fq_pie limit 10" 29 + ], 30 + "scapy": [ 31 + { 32 + "iface": "$DEV0", 33 + "count": 10, 34 + "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)" 35 + } 36 + ], 37 + "cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root fq_pie limit 1", 38 + "expExitCode": "0", 39 + "verifyCmd": "$TC qdisc show dev $DEV1", 40 + "matchPattern": "qdisc fq_pie 1: root refcnt [0-9]+ limit 1p", 41 + "matchCount": "1", 42 + "teardown": ["$TC qdisc del dev $DEV1 handle 1: root"] 21 43 } 22 44 ]
+22
tools/testing/selftests/tc-testing/tc-tests/qdiscs/hhf.json
··· 188 188 "teardown": [ 189 189 "$TC qdisc del dev $DUMMY handle 1: root" 190 190 ] 191 + }, 192 + { 193 + "id": "385f", 194 + "name": "HHF test qdisc limit trimming", 195 + "category": ["qdisc", "hhf"], 196 + "plugins": {"requires": ["nsPlugin", "scapyPlugin"]}, 197 + "setup": [ 198 + "$TC qdisc add dev $DEV1 handle 1: root hhf limit 10" 199 + ], 200 + "scapy": [ 201 + { 202 + "iface": "$DEV0", 203 + "count": 10, 204 + "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)" 205 + } 206 + ], 207 + "cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root hhf limit 1", 208 + "expExitCode": "0", 209 + "verifyCmd": "$TC qdisc show dev $DEV1", 210 + "matchPattern": "qdisc hhf 1: root refcnt [0-9]+ limit 1p.*hh_limit 2048 reset_timeout 40ms admit_bytes 128Kb evict_timeout 1s non_hh_weight 2", 211 + "matchCount": "1", 212 + "teardown": ["$TC qdisc del dev $DEV1 handle 1: root"] 191 213 } 192 214 ]
+24
tools/testing/selftests/tc-testing/tc-tests/qdiscs/pie.json
··· 1 + [ 2 + { 3 + "id": "6158", 4 + "name": "PIE test qdisc limit trimming", 5 + "category": ["qdisc", "pie"], 6 + "plugins": {"requires": ["nsPlugin", "scapyPlugin"]}, 7 + "setup": [ 8 + "$TC qdisc add dev $DEV1 handle 1: root pie limit 10" 9 + ], 10 + "scapy": [ 11 + { 12 + "iface": "$DEV0", 13 + "count": 10, 14 + "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)" 15 + } 16 + ], 17 + "cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root pie limit 1", 18 + "expExitCode": "0", 19 + "verifyCmd": "$TC qdisc show dev $DEV1", 20 + "matchPattern": "qdisc pie 1: root refcnt [0-9]+ limit 1p", 21 + "matchCount": "1", 22 + "teardown": ["$TC qdisc del dev $DEV1 handle 1: root"] 23 + } 24 + ]
+16 -12
tools/testing/vsock/vsock_test.c
··· 1264 1264 send_buf(fd, buf, sizeof(buf), 0, sizeof(buf)); 1265 1265 control_expectln("RECEIVED"); 1266 1266 1267 - ret = ioctl(fd, SIOCOUTQ, &sock_bytes_unsent); 1268 - if (ret < 0) { 1269 - if (errno == EOPNOTSUPP) { 1270 - fprintf(stderr, "Test skipped, SIOCOUTQ not supported.\n"); 1271 - } else { 1267 + /* SIOCOUTQ isn't guaranteed to instantly track sent data. Even though 1268 + * the "RECEIVED" message means that the other side has received the 1269 + * data, there can be a delay in our kernel before updating the "unsent 1270 + * bytes" counter. Repeat SIOCOUTQ until it returns 0. 1271 + */ 1272 + timeout_begin(TIMEOUT); 1273 + do { 1274 + ret = ioctl(fd, SIOCOUTQ, &sock_bytes_unsent); 1275 + if (ret < 0) { 1276 + if (errno == EOPNOTSUPP) { 1277 + fprintf(stderr, "Test skipped, SIOCOUTQ not supported.\n"); 1278 + break; 1279 + } 1272 1280 perror("ioctl"); 1273 1281 exit(EXIT_FAILURE); 1274 1282 } 1275 - } else if (ret == 0 && sock_bytes_unsent != 0) { 1276 - fprintf(stderr, 1277 - "Unexpected 'SIOCOUTQ' value, expected 0, got %i\n", 1278 - sock_bytes_unsent); 1279 - exit(EXIT_FAILURE); 1280 - } 1281 - 1283 + timeout_check("SIOCOUTQ"); 1284 + } while (sock_bytes_unsent != 0); 1285 + timeout_end(); 1282 1286 close(fd); 1283 1287 } 1284 1288