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

Pull networking fixes from Jakub Kicinski:
"Including fixes from Bluetooth, CAN and Netfilter.

Current release - regressions:

- two fixes for the netdev per-instance locking

- batman-adv: fix double-hold of meshif when getting enabled

Current release - new code bugs:

- Bluetooth: increment TX timestamping tskey always for stream
sockets

- wifi: static analysis and build fixes for the new Intel sub-driver

Previous releases - regressions:

- net: fib_rules: fix iif / oif matching on L3 master (VRF) device

- ipv6: add exception routes to GC list in rt6_insert_exception()

- netfilter: conntrack: fix erroneous removal of offload bit

- Bluetooth:
- fix sending MGMT_EV_DEVICE_FOUND for invalid address
- l2cap: process valid commands in too long frame
- btnxpuart: Revert baudrate change in nxp_shutdown

Previous releases - always broken:

- ethtool: fix memory corruption during SFP FW flashing

- eth:
- hibmcge: fixes for link and MTU handling, pause frames etc
- igc: fixes for PTM (PCIe timestamping)

- dsa: b53: enable BPDU reception for management port

Misc:

- fixes for Netlink protocol schemas"

* tag 'net-6.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (81 commits)
net: ethernet: mtk_eth_soc: revise QDMA packet scheduler settings
net: ethernet: mtk_eth_soc: correct the max weight of the queue limit for 100Mbps
net: ethernet: mtk_eth_soc: reapply mdc divider on reset
net: ti: icss-iep: Fix possible NULL pointer dereference for perout request
net: ti: icssg-prueth: Fix possible NULL pointer dereference inside emac_xmit_xdp_frame()
net: ti: icssg-prueth: Fix kernel warning while bringing down network interface
netfilter: conntrack: fix erronous removal of offload bit
net: don't try to ops lock uninitialized devs
ptp: ocp: fix start time alignment in ptp_ocp_signal_set
net: dsa: avoid refcount warnings when ds->ops->tag_8021q_vlan_del() fails
net: dsa: free routing table on probe failure
net: dsa: clean up FDB, MDB, VLAN entries on unbind
net: dsa: mv88e6xxx: fix -ENOENT when deleting VLANs and MST is unsupported
net: dsa: mv88e6xxx: avoid unregistering devlink regions which were never registered
net: txgbe: fix memory leak in txgbe_probe() error path
net: bridge: switchdev: do not notify new brentries as changed
net: b53: enable BPDU reception for management port
netlink: specs: rt-neigh: prefix struct nfmsg members with ndm
netlink: specs: rt-link: adjust mctp attribute naming
netlink: specs: rtnetlink: attribute naming corrections
...

+684 -276
+1 -3
Documentation/netlink/specs/ovs_vport.yaml
··· 123 123 124 124 operations: 125 125 name-prefix: ovs-vport-cmd- 126 + fixed-header: ovs-header 126 127 list: 127 128 - 128 129 name: new 129 130 doc: Create a new OVS vport 130 131 attribute-set: vport 131 - fixed-header: ovs-header 132 132 do: 133 133 request: 134 134 attributes: ··· 141 141 name: del 142 142 doc: Delete existing OVS vport from a data path 143 143 attribute-set: vport 144 - fixed-header: ovs-header 145 144 do: 146 145 request: 147 146 attributes: ··· 151 152 name: get 152 153 doc: Get / dump OVS vport configuration and state 153 154 attribute-set: vport 154 - fixed-header: ovs-header 155 155 do: &vport-get-op 156 156 request: 157 157 attributes:
+13 -7
Documentation/netlink/specs/rt_link.yaml
··· 1113 1113 - 1114 1114 name: prop-list 1115 1115 type: nest 1116 - nested-attributes: link-attrs 1116 + nested-attributes: prop-list-link-attrs 1117 1117 - 1118 1118 name: alt-ifname 1119 1119 type: string 1120 - multi-attr: true 1121 1120 - 1122 1121 name: perm-address 1123 1122 type: binary ··· 1162 1163 - 1163 1164 name: netns-immutable 1164 1165 type: u8 1166 + - 1167 + name: prop-list-link-attrs 1168 + subset-of: link-attrs 1169 + attributes: 1170 + - 1171 + name: alt-ifname 1172 + multi-attr: true 1165 1173 - 1166 1174 name: af-spec-attrs 1167 1175 attributes: ··· 1591 1585 name: nf-call-iptables 1592 1586 type: u8 1593 1587 - 1594 - name: nf-call-ip6-tables 1588 + name: nf-call-ip6tables 1595 1589 type: u8 1596 1590 - 1597 1591 name: nf-call-arptables ··· 2083 2077 name: id 2084 2078 type: u16 2085 2079 - 2086 - name: flag 2080 + name: flags 2087 2081 type: binary 2088 2082 struct: ifla-vlan-flags 2089 2083 - ··· 2171 2165 type: binary 2172 2166 struct: ifla-cacheinfo 2173 2167 - 2174 - name: icmp6-stats 2168 + name: icmp6stats 2175 2169 type: binary 2176 2170 struct: ifla-icmp6-stats 2177 2171 - ··· 2185 2179 type: u32 2186 2180 - 2187 2181 name: mctp-attrs 2182 + name-prefix: ifla-mctp- 2188 2183 attributes: 2189 2184 - 2190 - name: mctp-net 2185 + name: net 2191 2186 type: u32 2192 2187 - 2193 2188 name: phys-binding ··· 2460 2453 - min-mtu 2461 2454 - max-mtu 2462 2455 - prop-list 2463 - - alt-ifname 2464 2456 - perm-address 2465 2457 - proto-down-reason 2466 2458 - parent-dev-name
+7 -7
Documentation/netlink/specs/rt_neigh.yaml
··· 13 13 type: struct 14 14 members: 15 15 - 16 - name: family 16 + name: ndm-family 17 17 type: u8 18 18 - 19 - name: pad 19 + name: ndm-pad 20 20 type: pad 21 21 len: 3 22 22 - 23 - name: ifindex 23 + name: ndm-ifindex 24 24 type: s32 25 25 - 26 - name: state 26 + name: ndm-state 27 27 type: u16 28 28 enum: nud-state 29 29 - 30 - name: flags 30 + name: ndm-flags 31 31 type: u8 32 32 enum: ntf-flags 33 33 - 34 - name: type 34 + name: ndm-type 35 35 type: u8 36 36 enum: rtm-type 37 37 - ··· 189 189 type: binary 190 190 display-hint: ipv4 191 191 - 192 - name: lladr 192 + name: lladdr 193 193 type: binary 194 194 display-hint: mac 195 195 -
+6
MAINTAINERS
··· 6335 6335 6336 6336 CW1200 WLAN driver 6337 6337 S: Orphan 6338 + L: linux-wireless@vger.kernel.org 6338 6339 F: drivers/net/wireless/st/ 6339 6340 F: include/linux/platform_data/net-cw1200.h 6340 6341 ··· 14290 14289 F: drivers/net/ethernet/marvell/sk* 14291 14290 14292 14291 MARVELL LIBERTAS WIRELESS DRIVER 14292 + L: linux-wireless@vger.kernel.org 14293 14293 L: libertas-dev@lists.infradead.org 14294 14294 S: Orphan 14295 14295 F: drivers/net/wireless/marvell/libertas/ ··· 19754 19752 19755 19753 QUALCOMM ATH12K WIRELESS DRIVER 19756 19754 M: Jeff Johnson <jjohnson@kernel.org> 19755 + L: linux-wireless@vger.kernel.org 19757 19756 L: ath12k@lists.infradead.org 19758 19757 S: Supported 19759 19758 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath12k ··· 19764 19761 19765 19762 QUALCOMM ATHEROS ATH10K WIRELESS DRIVER 19766 19763 M: Jeff Johnson <jjohnson@kernel.org> 19764 + L: linux-wireless@vger.kernel.org 19767 19765 L: ath10k@lists.infradead.org 19768 19766 S: Supported 19769 19767 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath10k ··· 19774 19770 19775 19771 QUALCOMM ATHEROS ATH11K WIRELESS DRIVER 19776 19772 M: Jeff Johnson <jjohnson@kernel.org> 19773 + L: linux-wireless@vger.kernel.org 19777 19774 L: ath11k@lists.infradead.org 19778 19775 S: Supported 19779 19776 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath11k ··· 22148 22143 22149 22144 SILICON LABS WIRELESS DRIVERS (for WFxxx series) 22150 22145 M: Jérôme Pouiller <jerome.pouiller@silabs.com> 22146 + L: linux-wireless@vger.kernel.org 22151 22147 S: Supported 22152 22148 F: Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml 22153 22149 F: drivers/net/wireless/silabs/
+11 -10
drivers/bluetooth/btnxpuart.c
··· 1286 1286 u8 pcmd = 2; 1287 1287 1288 1288 skb = nxp_drv_send_cmd(hdev, HCI_NXP_TRIGGER_DUMP, 1, &pcmd); 1289 - if (!IS_ERR(skb)) 1289 + if (IS_ERR(skb)) 1290 + bt_dev_err(hdev, "Failed to trigger FW Dump. (%ld)", PTR_ERR(skb)); 1291 + else 1290 1292 kfree_skb(skb); 1291 1293 } 1292 1294 ··· 1447 1445 /* HCI_NXP_IND_RESET command may not returns any response */ 1448 1446 if (!IS_ERR(skb)) 1449 1447 kfree_skb(skb); 1450 - } else if (nxpdev->current_baudrate != nxpdev->fw_init_baudrate) { 1451 - nxpdev->new_baudrate = nxpdev->fw_init_baudrate; 1452 - nxp_set_baudrate_cmd(hdev, NULL); 1453 1448 } 1454 1449 1455 1450 return 0; ··· 1798 1799 clear_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state); 1799 1800 wake_up_interruptible(&nxpdev->check_boot_sign_wait_q); 1800 1801 wake_up_interruptible(&nxpdev->fw_dnld_done_wait_q); 1801 - } 1802 - 1803 - if (test_bit(HCI_RUNNING, &hdev->flags)) { 1804 - /* Ensure shutdown callback is executed before unregistering, so 1805 - * that baudrate is reset to initial value. 1802 + } else { 1803 + /* Restore FW baudrate to fw_init_baudrate if changed. 1804 + * This will ensure FW baudrate is in sync with 1805 + * driver baudrate in case this driver is re-inserted. 1806 1806 */ 1807 - nxp_shutdown(hdev); 1807 + if (nxpdev->current_baudrate != nxpdev->fw_init_baudrate) { 1808 + nxpdev->new_baudrate = nxpdev->fw_init_baudrate; 1809 + nxp_set_baudrate_cmd(hdev, NULL); 1810 + } 1808 1811 } 1809 1812 1810 1813 ps_cleanup(nxpdev);
+1 -1
drivers/bluetooth/btqca.c
··· 889 889 if (le32_to_cpu(ver.soc_id) == QCA_WCN3950_SOC_ID_T) 890 890 variant = "t"; 891 891 else if (le32_to_cpu(ver.soc_id) == QCA_WCN3950_SOC_ID_S) 892 - variant = "u"; 892 + variant = "s"; 893 893 894 894 snprintf(config.fwname, sizeof(config.fwname), 895 895 "qca/cmnv%02x%s.bin", rom_ver, variant);
+2
drivers/bluetooth/btrtl.c
··· 1215 1215 rtl_dev_err(hdev, "mandatory config file %s not found", 1216 1216 btrtl_dev->ic_info->cfg_name); 1217 1217 ret = btrtl_dev->cfg_len; 1218 + if (!ret) 1219 + ret = -EINVAL; 1218 1220 goto err_free; 1219 1221 } 1220 1222 }
+5 -5
drivers/bluetooth/hci_vhci.c
··· 289 289 290 290 static void vhci_coredump_hdr(struct hci_dev *hdev, struct sk_buff *skb) 291 291 { 292 - char buf[80]; 292 + const char *buf; 293 293 294 - snprintf(buf, sizeof(buf), "Controller Name: vhci_ctrl\n"); 294 + buf = "Controller Name: vhci_ctrl\n"; 295 295 skb_put_data(skb, buf, strlen(buf)); 296 296 297 - snprintf(buf, sizeof(buf), "Firmware Version: vhci_fw\n"); 297 + buf = "Firmware Version: vhci_fw\n"; 298 298 skb_put_data(skb, buf, strlen(buf)); 299 299 300 - snprintf(buf, sizeof(buf), "Driver: vhci_drv\n"); 300 + buf = "Driver: vhci_drv\n"; 301 301 skb_put_data(skb, buf, strlen(buf)); 302 302 303 - snprintf(buf, sizeof(buf), "Vendor: vhci\n"); 303 + buf = "Vendor: vhci\n"; 304 304 skb_put_data(skb, buf, strlen(buf)); 305 305 } 306 306
+9 -4
drivers/net/bonding/bond_main.c
··· 850 850 struct net_device *slave_dev, int reporting) 851 851 { 852 852 const struct net_device_ops *slave_ops = slave_dev->netdev_ops; 853 - struct ifreq ifr; 854 853 struct mii_ioctl_data *mii; 854 + struct ifreq ifr; 855 + int ret; 855 856 856 857 if (!reporting && !netif_running(slave_dev)) 857 858 return 0; ··· 861 860 return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0; 862 861 863 862 /* Try to get link status using Ethtool first. */ 864 - if (slave_dev->ethtool_ops->get_link) 865 - return slave_dev->ethtool_ops->get_link(slave_dev) ? 866 - BMSR_LSTATUS : 0; 863 + if (slave_dev->ethtool_ops->get_link) { 864 + netdev_lock_ops(slave_dev); 865 + ret = slave_dev->ethtool_ops->get_link(slave_dev); 866 + netdev_unlock_ops(slave_dev); 867 + 868 + return ret ? BMSR_LSTATUS : 0; 869 + } 867 870 868 871 /* Ethtool can't be used, fallback to MII ioctls. */ 869 872 if (slave_ops->ndo_eth_ioctl) {
+4 -3
drivers/net/can/rockchip/rockchip_canfd-core.c
··· 902 902 priv->can.data_bittiming_const = &rkcanfd_data_bittiming_const; 903 903 priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | 904 904 CAN_CTRLMODE_BERR_REPORTING; 905 - if (!(priv->devtype_data.quirks & RKCANFD_QUIRK_CANFD_BROKEN)) 906 - priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD; 907 905 priv->can.do_set_mode = rkcanfd_set_mode; 908 906 priv->can.do_get_berr_counter = rkcanfd_get_berr_counter; 909 907 priv->ndev = ndev; 910 908 911 909 match = device_get_match_data(&pdev->dev); 912 - if (match) 910 + if (match) { 913 911 priv->devtype_data = *(struct rkcanfd_devtype_data *)match; 912 + if (!(priv->devtype_data.quirks & RKCANFD_QUIRK_CANFD_BROKEN)) 913 + priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD; 914 + } 914 915 915 916 err = can_rx_offload_add_manual(ndev, &priv->offload, 916 917 RKCANFD_NAPI_WEIGHT);
+10
drivers/net/dsa/b53/b53_common.c
··· 737 737 b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, gc); 738 738 } 739 739 740 + static void b53_enable_stp(struct b53_device *dev) 741 + { 742 + u8 gc; 743 + 744 + b53_read8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, &gc); 745 + gc |= GC_RX_BPDU_EN; 746 + b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, gc); 747 + } 748 + 740 749 static u16 b53_default_pvid(struct b53_device *dev) 741 750 { 742 751 if (is5325(dev) || is5365(dev)) ··· 885 876 } 886 877 887 878 b53_enable_mib(dev); 879 + b53_enable_stp(dev); 888 880 889 881 return b53_flush_arl(dev, FAST_AGE_STATIC); 890 882 }
+12 -1
drivers/net/dsa/mv88e6xxx/chip.c
··· 1852 1852 if (!chip->info->ops->vtu_getnext) 1853 1853 return -EOPNOTSUPP; 1854 1854 1855 + memset(entry, 0, sizeof(*entry)); 1856 + 1855 1857 entry->vid = vid ? vid - 1 : mv88e6xxx_max_vid(chip); 1856 1858 entry->valid = false; 1857 1859 ··· 1962 1960 struct mv88e6xxx_mst *mst, *tmp; 1963 1961 int err; 1964 1962 1965 - if (!sid) 1963 + /* If the SID is zero, it is for a VLAN mapped to the default MSTI, 1964 + * and mv88e6xxx_stu_setup() made sure it is always present, and thus, 1965 + * should not be removed here. 1966 + * 1967 + * If the chip lacks STU support, numerically the "sid" variable will 1968 + * happen to also be zero, but we don't want to rely on that fact, so 1969 + * we explicitly test that first. In that case, there is also nothing 1970 + * to do here. 1971 + */ 1972 + if (!mv88e6xxx_has_stu(chip) || !sid) 1966 1973 return 0; 1967 1974 1968 1975 list_for_each_entry_safe(mst, tmp, &chip->msts, node) {
+2 -1
drivers/net/dsa/mv88e6xxx/devlink.c
··· 736 736 int i; 737 737 738 738 for (i = 0; i < ARRAY_SIZE(mv88e6xxx_regions); i++) 739 - dsa_devlink_region_destroy(chip->regions[i]); 739 + if (chip->regions[i]) 740 + dsa_devlink_region_destroy(chip->regions[i]); 740 741 } 741 742 742 743 void mv88e6xxx_teardown_devlink_regions_port(struct dsa_switch *ds, int port)
+3 -2
drivers/net/ethernet/amd/pds_core/debugfs.c
··· 154 154 debugfs_create_u32("index", 0400, intr_dentry, &intr->index); 155 155 debugfs_create_u32("vector", 0400, intr_dentry, &intr->vector); 156 156 157 - intr_ctrl_regset = kzalloc(sizeof(*intr_ctrl_regset), 158 - GFP_KERNEL); 157 + intr_ctrl_regset = devm_kzalloc(pdsc->dev, 158 + sizeof(*intr_ctrl_regset), 159 + GFP_KERNEL); 159 160 if (!intr_ctrl_regset) 160 161 return; 161 162 intr_ctrl_regset->regs = intr_ctrl_regs;
+2 -2
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 787 787 dev_kfree_skb_any(skb); 788 788 tx_kick_pending: 789 789 if (BNXT_TX_PTP_IS_SET(lflags)) { 790 - txr->tx_buf_ring[txr->tx_prod].is_ts_pkt = 0; 790 + txr->tx_buf_ring[RING_TX(bp, txr->tx_prod)].is_ts_pkt = 0; 791 791 atomic64_inc(&bp->ptp_cfg->stats.ts_err); 792 792 if (!(bp->fw_cap & BNXT_FW_CAP_TX_TS_CMP)) 793 793 /* set SKB to err so PTP worker will clean up */ ··· 795 795 } 796 796 if (txr->kick_pending) 797 797 bnxt_txr_db_kick(bp, txr, txr->tx_prod); 798 - txr->tx_buf_ring[txr->tx_prod].skb = NULL; 798 + txr->tx_buf_ring[RING_TX(bp, txr->tx_prod)].skb = NULL; 799 799 dev_core_stats_tx_dropped_inc(dev); 800 800 return NETDEV_TX_OK; 801 801 }
+1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
··· 2270 2270 eth_filter->port[i].bmap = bitmap_zalloc(nentries, GFP_KERNEL); 2271 2271 if (!eth_filter->port[i].bmap) { 2272 2272 ret = -ENOMEM; 2273 + kvfree(eth_filter->port[i].loc_array); 2273 2274 goto free_eth_finfo; 2274 2275 } 2275 2276 }
+5 -3
drivers/net/ethernet/hisilicon/hibmcge/hbg_common.h
··· 108 108 bool re_enable; 109 109 bool need_print; 110 110 bool need_reset; 111 - u64 count; 112 111 113 - void (*irq_handle)(struct hbg_priv *priv, struct hbg_irq_info *info); 112 + void (*irq_handle)(struct hbg_priv *priv, 113 + const struct hbg_irq_info *info); 114 114 }; 115 115 116 116 struct hbg_vector { 117 117 char name[HBG_VECTOR_NUM][32]; 118 - struct hbg_irq_info *info_array; 118 + 119 + u64 *stats_array; 120 + const struct hbg_irq_info *info_array; 119 121 u32 info_array_len; 120 122 }; 121 123
+7 -4
drivers/net/ethernet/hisilicon/hibmcge/hbg_debugfs.c
··· 61 61 { 62 62 struct net_device *netdev = dev_get_drvdata(s->private); 63 63 struct hbg_priv *priv = netdev_priv(netdev); 64 - struct hbg_irq_info *info; 64 + const struct hbg_irq_info *info; 65 65 u32 i; 66 66 67 67 for (i = 0; i < priv->vectors.info_array_len; i++) { ··· 73 73 info->mask)), 74 74 str_true_false(info->need_reset), 75 75 str_true_false(info->need_print), 76 - info->count); 76 + priv->vectors.stats_array[i]); 77 77 } 78 78 79 79 return 0; ··· 106 106 { 107 107 struct net_device *netdev = dev_get_drvdata(s->private); 108 108 struct hbg_priv *priv = netdev_priv(netdev); 109 + bool np_link_fail; 109 110 110 111 seq_printf(s, "event handling state: %s\n", 111 112 state_str_true_false(priv, HBG_NIC_STATE_EVENT_HANDLING)); ··· 118 117 reset_type_str[priv->reset_type]); 119 118 seq_printf(s, "need reset state: %s\n", 120 119 state_str_true_false(priv, HBG_NIC_STATE_NEED_RESET)); 121 - seq_printf(s, "np_link fail state: %s\n", 122 - state_str_true_false(priv, HBG_NIC_STATE_NP_LINK_FAIL)); 120 + 121 + np_link_fail = !hbg_reg_read_field(priv, HBG_REG_AN_NEG_STATE_ADDR, 122 + HBG_REG_AN_NEG_STATE_NP_LINK_OK_B); 123 + seq_printf(s, "np_link fail state: %s\n", str_true_false(np_link_fail)); 123 124 124 125 return 0; 125 126 }
+1 -1
drivers/net/ethernet/hisilicon/hibmcge/hbg_diagnose.c
··· 234 234 235 235 for (i = 0; i < vectors->info_array_len; i++) 236 236 if (vectors->info_array[i].mask == mask) 237 - return vectors->info_array[i].count; 237 + return vectors->stats_array[i]; 238 238 239 239 return 0; 240 240 }
+3
drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
··· 26 26 27 27 static void hbg_restore_user_def_settings(struct hbg_priv *priv) 28 28 { 29 + /* The index of host mac is always 0. */ 30 + u64 rx_pause_addr = ether_addr_to_u64(priv->filter.mac_table[0].addr); 29 31 struct ethtool_pauseparam *pause_param = &priv->user_def.pause_param; 30 32 31 33 hbg_restore_mac_table(priv); 32 34 hbg_hw_set_mtu(priv, priv->netdev->mtu); 33 35 hbg_hw_set_pause_enable(priv, pause_param->tx_pause, 34 36 pause_param->rx_pause); 37 + hbg_hw_set_rx_pause_mac_addr(priv, rx_pause_addr); 35 38 } 36 39 37 40 int hbg_rebuild(struct hbg_priv *priv)
+7
drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c
··· 234 234 { 235 235 hbg_reg_write_field(priv, HBG_REG_REC_FILT_CTRL_ADDR, 236 236 HBG_REG_REC_FILT_CTRL_UC_MATCH_EN_B, enable); 237 + 238 + /* only uc filter is supported, so set all bits of mc mask reg to 1 */ 239 + hbg_reg_write64(priv, HBG_REG_STATION_ADDR_LOW_MSK_0, U64_MAX); 240 + hbg_reg_write64(priv, HBG_REG_STATION_ADDR_LOW_MSK_1, U64_MAX); 237 241 } 238 242 239 243 void hbg_hw_set_pause_enable(struct hbg_priv *priv, u32 tx_en, u32 rx_en) ··· 246 242 HBG_REG_PAUSE_ENABLE_TX_B, tx_en); 247 243 hbg_reg_write_field(priv, HBG_REG_PAUSE_ENABLE_ADDR, 248 244 HBG_REG_PAUSE_ENABLE_RX_B, rx_en); 245 + 246 + hbg_reg_write_field(priv, HBG_REG_REC_FILT_CTRL_ADDR, 247 + HBG_REG_REC_FILT_CTRL_PAUSE_FRM_PASS_B, rx_en); 249 248 } 250 249 251 250 void hbg_hw_get_pause_enable(struct hbg_priv *priv, u32 *tx_en, u32 *rx_en)
+15 -9
drivers/net/ethernet/hisilicon/hibmcge/hbg_irq.c
··· 6 6 #include "hbg_hw.h" 7 7 8 8 static void hbg_irq_handle_err(struct hbg_priv *priv, 9 - struct hbg_irq_info *irq_info) 9 + const struct hbg_irq_info *irq_info) 10 10 { 11 11 if (irq_info->need_print) 12 12 dev_err(&priv->pdev->dev, ··· 17 17 } 18 18 19 19 static void hbg_irq_handle_tx(struct hbg_priv *priv, 20 - struct hbg_irq_info *irq_info) 20 + const struct hbg_irq_info *irq_info) 21 21 { 22 22 napi_schedule(&priv->tx_ring.napi); 23 23 } 24 24 25 25 static void hbg_irq_handle_rx(struct hbg_priv *priv, 26 - struct hbg_irq_info *irq_info) 26 + const struct hbg_irq_info *irq_info) 27 27 { 28 28 napi_schedule(&priv->rx_ring.napi); 29 29 } 30 30 31 31 static void hbg_irq_handle_rx_buf_val(struct hbg_priv *priv, 32 - struct hbg_irq_info *irq_info) 32 + const struct hbg_irq_info *irq_info) 33 33 { 34 34 priv->stats.rx_fifo_less_empty_thrsld_cnt++; 35 35 } 36 36 37 37 #define HBG_IRQ_I(name, handle) \ 38 - {#name, HBG_INT_MSK_##name##_B, false, false, false, 0, handle} 38 + {#name, HBG_INT_MSK_##name##_B, false, false, false, handle} 39 39 #define HBG_ERR_IRQ_I(name, need_print, ndde_reset) \ 40 40 {#name, HBG_INT_MSK_##name##_B, true, need_print, \ 41 - ndde_reset, 0, hbg_irq_handle_err} 41 + ndde_reset, hbg_irq_handle_err} 42 42 43 - static struct hbg_irq_info hbg_irqs[] = { 43 + static const struct hbg_irq_info hbg_irqs[] = { 44 44 HBG_IRQ_I(RX, hbg_irq_handle_rx), 45 45 HBG_IRQ_I(TX, hbg_irq_handle_tx), 46 46 HBG_ERR_IRQ_I(TX_PKT_CPL, true, true), ··· 64 64 65 65 static irqreturn_t hbg_irq_handle(int irq_num, void *p) 66 66 { 67 - struct hbg_irq_info *info; 67 + const struct hbg_irq_info *info; 68 68 struct hbg_priv *priv = p; 69 69 u32 status; 70 70 u32 i; ··· 79 79 hbg_hw_irq_enable(priv, info->mask, false); 80 80 hbg_hw_irq_clear(priv, info->mask); 81 81 82 - info->count++; 82 + priv->vectors.stats_array[i]++; 83 83 if (info->irq_handle) 84 84 info->irq_handle(priv, info); 85 85 ··· 131 131 "failed to request irq: %s\n", 132 132 irq_names_map[i]); 133 133 } 134 + 135 + vectors->stats_array = devm_kcalloc(&priv->pdev->dev, 136 + ARRAY_SIZE(hbg_irqs), 137 + sizeof(u64), GFP_KERNEL); 138 + if (!vectors->stats_array) 139 + return -ENOMEM; 134 140 135 141 vectors->info_array = hbg_irqs; 136 142 vectors->info_array_len = ARRAY_SIZE(hbg_irqs);
+4 -4
drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c
··· 21 21 22 22 static void hbg_all_irq_enable(struct hbg_priv *priv, bool enabled) 23 23 { 24 - struct hbg_irq_info *info; 24 + const struct hbg_irq_info *info; 25 25 u32 i; 26 26 27 27 for (i = 0; i < priv->vectors.info_array_len; i++) { ··· 203 203 if (netif_running(netdev)) 204 204 return -EBUSY; 205 205 206 - hbg_hw_set_mtu(priv, new_mtu); 207 - WRITE_ONCE(netdev->mtu, new_mtu); 208 - 209 206 dev_dbg(&priv->pdev->dev, 210 207 "change mtu from %u to %u\n", netdev->mtu, new_mtu); 208 + 209 + hbg_hw_set_mtu(priv, new_mtu); 210 + WRITE_ONCE(netdev->mtu, new_mtu); 211 211 212 212 return 0; 213 213 }
+10 -1
drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c
··· 2 2 // Copyright (c) 2024 Hisilicon Limited. 3 3 4 4 #include <linux/phy.h> 5 + #include <linux/rtnetlink.h> 5 6 #include "hbg_common.h" 6 7 #include "hbg_hw.h" 7 8 #include "hbg_mdio.h" ··· 134 133 { 135 134 struct device *dev = &priv->pdev->dev; 136 135 136 + rtnl_lock(); 137 + 137 138 if (priv->stats.np_link_fail_cnt >= HBG_NP_LINK_FAIL_RETRY_TIMES) { 138 139 dev_err(dev, "failed to fix the MAC link status\n"); 139 140 priv->stats.np_link_fail_cnt = 0; 140 - return; 141 + goto unlock; 141 142 } 143 + 144 + if (!priv->mac.phydev->link) 145 + goto unlock; 142 146 143 147 priv->stats.np_link_fail_cnt++; 144 148 dev_err(dev, "failed to link between MAC and PHY, try to fix...\n"); ··· 153 147 */ 154 148 hbg_phy_stop(priv); 155 149 hbg_phy_start(priv); 150 + 151 + unlock: 152 + rtnl_unlock(); 156 153 } 157 154 158 155 static void hbg_phy_adjust_link(struct net_device *netdev)
+3
drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h
··· 68 68 #define HBG_REG_TRANSMIT_CTRL_AN_EN_B BIT(5) 69 69 #define HBG_REG_REC_FILT_CTRL_ADDR (HBG_REG_SGMII_BASE + 0x0064) 70 70 #define HBG_REG_REC_FILT_CTRL_UC_MATCH_EN_B BIT(0) 71 + #define HBG_REG_REC_FILT_CTRL_PAUSE_FRM_PASS_B BIT(4) 71 72 #define HBG_REG_RX_OCTETS_TOTAL_OK_ADDR (HBG_REG_SGMII_BASE + 0x0080) 72 73 #define HBG_REG_RX_OCTETS_BAD_ADDR (HBG_REG_SGMII_BASE + 0x0084) 73 74 #define HBG_REG_RX_UC_PKTS_ADDR (HBG_REG_SGMII_BASE + 0x0088) ··· 135 134 #define HBG_REG_STATION_ADDR_HIGH_4_ADDR (HBG_REG_SGMII_BASE + 0x0224) 136 135 #define HBG_REG_STATION_ADDR_LOW_5_ADDR (HBG_REG_SGMII_BASE + 0x0228) 137 136 #define HBG_REG_STATION_ADDR_HIGH_5_ADDR (HBG_REG_SGMII_BASE + 0x022C) 137 + #define HBG_REG_STATION_ADDR_LOW_MSK_0 (HBG_REG_SGMII_BASE + 0x0230) 138 + #define HBG_REG_STATION_ADDR_LOW_MSK_1 (HBG_REG_SGMII_BASE + 0x0238) 138 139 139 140 /* PCU */ 140 141 #define HBG_REG_TX_FIFO_THRSLD_ADDR (HBG_REG_SGMII_BASE + 0x0420)
+1
drivers/net/ethernet/intel/igc/igc.h
··· 319 319 struct timespec64 prev_ptp_time; /* Pre-reset PTP clock */ 320 320 ktime_t ptp_reset_start; /* Reset time in clock mono */ 321 321 struct system_time_snapshot snapshot; 322 + struct mutex ptm_lock; /* Only allow one PTM transaction at a time */ 322 323 323 324 char fw_version[32]; 324 325
+5 -1
drivers/net/ethernet/intel/igc/igc_defines.h
··· 574 574 #define IGC_PTM_CTRL_SHRT_CYC(usec) (((usec) & 0x3f) << 2) 575 575 #define IGC_PTM_CTRL_PTM_TO(usec) (((usec) & 0xff) << 8) 576 576 577 - #define IGC_PTM_SHORT_CYC_DEFAULT 1 /* Default short cycle interval */ 577 + /* A short cycle time of 1us theoretically should work, but appears to be too 578 + * short in practice. 579 + */ 580 + #define IGC_PTM_SHORT_CYC_DEFAULT 4 /* Default short cycle interval */ 578 581 #define IGC_PTM_CYC_TIME_DEFAULT 5 /* Default PTM cycle time */ 579 582 #define IGC_PTM_TIMEOUT_DEFAULT 255 /* Default timeout for PTM errors */ 580 583 ··· 596 593 #define IGC_PTM_STAT_T4M1_OVFL BIT(3) /* T4 minus T1 overflow */ 597 594 #define IGC_PTM_STAT_ADJUST_1ST BIT(4) /* 1588 timer adjusted during 1st PTM cycle */ 598 595 #define IGC_PTM_STAT_ADJUST_CYC BIT(5) /* 1588 timer adjusted during non-1st PTM cycle */ 596 + #define IGC_PTM_STAT_ALL GENMASK(5, 0) /* Used to clear all status */ 599 597 600 598 /* PCIe PTM Cycle Control */ 601 599 #define IGC_PTM_CYCLE_CTRL_CYC_TIME(msec) ((msec) & 0x3ff) /* PTM Cycle Time (msec) */
+1
drivers/net/ethernet/intel/igc/igc_main.c
··· 7231 7231 7232 7232 err_register: 7233 7233 igc_release_hw_control(adapter); 7234 + igc_ptp_stop(adapter); 7234 7235 err_eeprom: 7235 7236 if (!igc_check_reset_block(hw)) 7236 7237 igc_reset_phy(hw);
+74 -39
drivers/net/ethernet/intel/igc/igc_ptp.c
··· 974 974 } 975 975 } 976 976 977 + /* The PTM lock: adapter->ptm_lock must be held when calling igc_ptm_trigger() */ 978 + static void igc_ptm_trigger(struct igc_hw *hw) 979 + { 980 + u32 ctrl; 981 + 982 + /* To "manually" start the PTM cycle we need to set the 983 + * trigger (TRIG) bit 984 + */ 985 + ctrl = rd32(IGC_PTM_CTRL); 986 + ctrl |= IGC_PTM_CTRL_TRIG; 987 + wr32(IGC_PTM_CTRL, ctrl); 988 + /* Perform flush after write to CTRL register otherwise 989 + * transaction may not start 990 + */ 991 + wrfl(); 992 + } 993 + 994 + /* The PTM lock: adapter->ptm_lock must be held when calling igc_ptm_reset() */ 995 + static void igc_ptm_reset(struct igc_hw *hw) 996 + { 997 + u32 ctrl; 998 + 999 + ctrl = rd32(IGC_PTM_CTRL); 1000 + ctrl &= ~IGC_PTM_CTRL_TRIG; 1001 + wr32(IGC_PTM_CTRL, ctrl); 1002 + /* Write to clear all status */ 1003 + wr32(IGC_PTM_STAT, IGC_PTM_STAT_ALL); 1004 + } 1005 + 977 1006 static int igc_phc_get_syncdevicetime(ktime_t *device, 978 1007 struct system_counterval_t *system, 979 1008 void *ctx) 980 1009 { 981 - u32 stat, t2_curr_h, t2_curr_l, ctrl; 982 1010 struct igc_adapter *adapter = ctx; 983 1011 struct igc_hw *hw = &adapter->hw; 1012 + u32 stat, t2_curr_h, t2_curr_l; 984 1013 int err, count = 100; 985 1014 ktime_t t1, t2_curr; 986 1015 987 - /* Get a snapshot of system clocks to use as historic value. */ 988 - ktime_get_snapshot(&adapter->snapshot); 989 - 1016 + /* Doing this in a loop because in the event of a 1017 + * badly timed (ha!) system clock adjustment, we may 1018 + * get PTM errors from the PCI root, but these errors 1019 + * are transitory. Repeating the process returns valid 1020 + * data eventually. 1021 + */ 990 1022 do { 991 - /* Doing this in a loop because in the event of a 992 - * badly timed (ha!) system clock adjustment, we may 993 - * get PTM errors from the PCI root, but these errors 994 - * are transitory. Repeating the process returns valid 995 - * data eventually. 996 - */ 1023 + /* Get a snapshot of system clocks to use as historic value. */ 1024 + ktime_get_snapshot(&adapter->snapshot); 997 1025 998 - /* To "manually" start the PTM cycle we need to clear and 999 - * then set again the TRIG bit. 1000 - */ 1001 - ctrl = rd32(IGC_PTM_CTRL); 1002 - ctrl &= ~IGC_PTM_CTRL_TRIG; 1003 - wr32(IGC_PTM_CTRL, ctrl); 1004 - ctrl |= IGC_PTM_CTRL_TRIG; 1005 - wr32(IGC_PTM_CTRL, ctrl); 1006 - 1007 - /* The cycle only starts "for real" when software notifies 1008 - * that it has read the registers, this is done by setting 1009 - * VALID bit. 1010 - */ 1011 - wr32(IGC_PTM_STAT, IGC_PTM_STAT_VALID); 1026 + igc_ptm_trigger(hw); 1012 1027 1013 1028 err = readx_poll_timeout(rd32, IGC_PTM_STAT, stat, 1014 1029 stat, IGC_PTM_STAT_SLEEP, 1015 1030 IGC_PTM_STAT_TIMEOUT); 1031 + igc_ptm_reset(hw); 1032 + 1016 1033 if (err < 0) { 1017 1034 netdev_err(adapter->netdev, "Timeout reading IGC_PTM_STAT register\n"); 1018 1035 return err; ··· 1038 1021 if ((stat & IGC_PTM_STAT_VALID) == IGC_PTM_STAT_VALID) 1039 1022 break; 1040 1023 1041 - if (stat & ~IGC_PTM_STAT_VALID) { 1042 - /* An error occurred, log it. */ 1043 - igc_ptm_log_error(adapter, stat); 1044 - /* The STAT register is write-1-to-clear (W1C), 1045 - * so write the previous error status to clear it. 1046 - */ 1047 - wr32(IGC_PTM_STAT, stat); 1048 - continue; 1049 - } 1024 + igc_ptm_log_error(adapter, stat); 1050 1025 } while (--count); 1051 1026 1052 1027 if (!count) { ··· 1070 1061 { 1071 1062 struct igc_adapter *adapter = container_of(ptp, struct igc_adapter, 1072 1063 ptp_caps); 1064 + int ret; 1073 1065 1074 - return get_device_system_crosststamp(igc_phc_get_syncdevicetime, 1075 - adapter, &adapter->snapshot, cts); 1066 + /* This blocks until any in progress PTM transactions complete */ 1067 + mutex_lock(&adapter->ptm_lock); 1068 + 1069 + ret = get_device_system_crosststamp(igc_phc_get_syncdevicetime, 1070 + adapter, &adapter->snapshot, cts); 1071 + mutex_unlock(&adapter->ptm_lock); 1072 + 1073 + return ret; 1076 1074 } 1077 1075 1078 1076 static int igc_ptp_getcyclesx64(struct ptp_clock_info *ptp, ··· 1178 1162 spin_lock_init(&adapter->ptp_tx_lock); 1179 1163 spin_lock_init(&adapter->free_timer_lock); 1180 1164 spin_lock_init(&adapter->tmreg_lock); 1165 + mutex_init(&adapter->ptm_lock); 1181 1166 1182 1167 adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE; 1183 1168 adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF; ··· 1191 1174 if (IS_ERR(adapter->ptp_clock)) { 1192 1175 adapter->ptp_clock = NULL; 1193 1176 netdev_err(netdev, "ptp_clock_register failed\n"); 1177 + mutex_destroy(&adapter->ptm_lock); 1194 1178 } else if (adapter->ptp_clock) { 1195 1179 netdev_info(netdev, "PHC added\n"); 1196 1180 adapter->ptp_flags |= IGC_PTP_ENABLED; ··· 1221 1203 struct igc_hw *hw = &adapter->hw; 1222 1204 u32 ctrl; 1223 1205 1206 + mutex_lock(&adapter->ptm_lock); 1224 1207 ctrl = rd32(IGC_PTM_CTRL); 1225 1208 ctrl &= ~IGC_PTM_CTRL_EN; 1226 1209 1227 1210 wr32(IGC_PTM_CTRL, ctrl); 1211 + mutex_unlock(&adapter->ptm_lock); 1228 1212 } 1229 1213 1230 1214 /** ··· 1257 1237 **/ 1258 1238 void igc_ptp_stop(struct igc_adapter *adapter) 1259 1239 { 1240 + if (!(adapter->ptp_flags & IGC_PTP_ENABLED)) 1241 + return; 1242 + 1260 1243 igc_ptp_suspend(adapter); 1261 1244 1245 + adapter->ptp_flags &= ~IGC_PTP_ENABLED; 1262 1246 if (adapter->ptp_clock) { 1263 1247 ptp_clock_unregister(adapter->ptp_clock); 1264 1248 netdev_info(adapter->netdev, "PHC removed\n"); 1265 1249 adapter->ptp_flags &= ~IGC_PTP_ENABLED; 1266 1250 } 1251 + mutex_destroy(&adapter->ptm_lock); 1267 1252 } 1268 1253 1269 1254 /** ··· 1280 1255 void igc_ptp_reset(struct igc_adapter *adapter) 1281 1256 { 1282 1257 struct igc_hw *hw = &adapter->hw; 1283 - u32 cycle_ctrl, ctrl; 1258 + u32 cycle_ctrl, ctrl, stat; 1284 1259 unsigned long flags; 1285 1260 u32 timadj; 1261 + 1262 + if (!(adapter->ptp_flags & IGC_PTP_ENABLED)) 1263 + return; 1286 1264 1287 1265 /* reset the tstamp_config */ 1288 1266 igc_ptp_set_timestamp_mode(adapter, &adapter->tstamp_config); ··· 1308 1280 if (!igc_is_crosststamp_supported(adapter)) 1309 1281 break; 1310 1282 1283 + mutex_lock(&adapter->ptm_lock); 1311 1284 wr32(IGC_PCIE_DIG_DELAY, IGC_PCIE_DIG_DELAY_DEFAULT); 1312 1285 wr32(IGC_PCIE_PHY_DELAY, IGC_PCIE_PHY_DELAY_DEFAULT); 1313 1286 ··· 1319 1290 ctrl = IGC_PTM_CTRL_EN | 1320 1291 IGC_PTM_CTRL_START_NOW | 1321 1292 IGC_PTM_CTRL_SHRT_CYC(IGC_PTM_SHORT_CYC_DEFAULT) | 1322 - IGC_PTM_CTRL_PTM_TO(IGC_PTM_TIMEOUT_DEFAULT) | 1323 - IGC_PTM_CTRL_TRIG; 1293 + IGC_PTM_CTRL_PTM_TO(IGC_PTM_TIMEOUT_DEFAULT); 1324 1294 1325 1295 wr32(IGC_PTM_CTRL, ctrl); 1326 1296 1327 1297 /* Force the first cycle to run. */ 1328 - wr32(IGC_PTM_STAT, IGC_PTM_STAT_VALID); 1298 + igc_ptm_trigger(hw); 1329 1299 1300 + if (readx_poll_timeout_atomic(rd32, IGC_PTM_STAT, stat, 1301 + stat, IGC_PTM_STAT_SLEEP, 1302 + IGC_PTM_STAT_TIMEOUT)) 1303 + netdev_err(adapter->netdev, "Timeout reading IGC_PTM_STAT register\n"); 1304 + 1305 + igc_ptm_reset(hw); 1306 + mutex_unlock(&adapter->ptm_lock); 1330 1307 break; 1331 1308 default: 1332 1309 /* No work to do. */
+2
drivers/net/ethernet/marvell/octeontx2/nic/rep.c
··· 67 67 68 68 rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp 69 69 (&priv->mbox.mbox, 0, &req->hdr); 70 + if (IS_ERR(rsp)) 71 + goto exit; 70 72 71 73 for (ent = 0; ent < rsp->count; ent++) 72 74 rep->flow_cfg->flow_ent[ent + allocated] = rsp->entry_list[ent];
+29 -20
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 734 734 case SPEED_100: 735 735 val |= MTK_QTX_SCH_MAX_RATE_EN | 736 736 FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 103) | 737 - FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 3); 737 + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 3) | 738 738 FIELD_PREP(MTK_QTX_SCH_MAX_RATE_WEIGHT, 1); 739 739 break; 740 740 case SPEED_1000: ··· 757 757 case SPEED_100: 758 758 val |= MTK_QTX_SCH_MAX_RATE_EN | 759 759 FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 1) | 760 - FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 5); 760 + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 5) | 761 761 FIELD_PREP(MTK_QTX_SCH_MAX_RATE_WEIGHT, 1); 762 762 break; 763 763 case SPEED_1000: 764 764 val |= MTK_QTX_SCH_MAX_RATE_EN | 765 - FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 10) | 766 - FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 5) | 765 + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 1) | 766 + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 6) | 767 767 FIELD_PREP(MTK_QTX_SCH_MAX_RATE_WEIGHT, 10); 768 768 break; 769 769 default: ··· 871 871 .mac_enable_tx_lpi = mtk_mac_enable_tx_lpi, 872 872 }; 873 873 874 + static void mtk_mdio_config(struct mtk_eth *eth) 875 + { 876 + u32 val; 877 + 878 + /* Configure MDC Divider */ 879 + val = FIELD_PREP(PPSC_MDC_CFG, eth->mdc_divider); 880 + 881 + /* Configure MDC Turbo Mode */ 882 + if (mtk_is_netsys_v3_or_greater(eth)) 883 + mtk_m32(eth, 0, MISC_MDC_TURBO, MTK_MAC_MISC_V3); 884 + else 885 + val |= PPSC_MDC_TURBO; 886 + 887 + mtk_m32(eth, PPSC_MDC_CFG, val, MTK_PPSC); 888 + } 889 + 874 890 static int mtk_mdio_init(struct mtk_eth *eth) 875 891 { 876 - unsigned int max_clk = 2500000, divider; 892 + unsigned int max_clk = 2500000; 877 893 struct device_node *mii_np; 878 894 int ret; 879 895 u32 val; ··· 924 908 } 925 909 max_clk = val; 926 910 } 927 - divider = min_t(unsigned int, DIV_ROUND_UP(MDC_MAX_FREQ, max_clk), 63); 928 - 929 - /* Configure MDC Turbo Mode */ 930 - if (mtk_is_netsys_v3_or_greater(eth)) 931 - mtk_m32(eth, 0, MISC_MDC_TURBO, MTK_MAC_MISC_V3); 932 - 933 - /* Configure MDC Divider */ 934 - val = FIELD_PREP(PPSC_MDC_CFG, divider); 935 - if (!mtk_is_netsys_v3_or_greater(eth)) 936 - val |= PPSC_MDC_TURBO; 937 - mtk_m32(eth, PPSC_MDC_CFG, val, MTK_PPSC); 938 - 939 - dev_dbg(eth->dev, "MDC is running on %d Hz\n", MDC_MAX_FREQ / divider); 940 - 911 + eth->mdc_divider = min_t(unsigned int, DIV_ROUND_UP(MDC_MAX_FREQ, max_clk), 63); 912 + mtk_mdio_config(eth); 913 + dev_dbg(eth->dev, "MDC is running on %d Hz\n", MDC_MAX_FREQ / eth->mdc_divider); 941 914 ret = of_mdiobus_register(eth->mii_bus, mii_np); 942 915 943 916 err_put_node: ··· 3320 3315 if (mtk_is_netsys_v2_or_greater(eth)) 3321 3316 val |= MTK_MUTLI_CNT | MTK_RESV_BUF | 3322 3317 MTK_WCOMP_EN | MTK_DMAD_WR_WDONE | 3323 - MTK_CHK_DDONE_EN | MTK_LEAKY_BUCKET_EN; 3318 + MTK_CHK_DDONE_EN; 3324 3319 else 3325 3320 val |= MTK_RX_BT_32DWORDS; 3326 3321 mtk_w32(eth, val, reg_map->qdma.glo_cfg); ··· 3978 3973 mtk_hw_warm_reset(eth); 3979 3974 else 3980 3975 mtk_hw_reset(eth); 3976 + 3977 + /* No MT7628/88 support yet */ 3978 + if (reset && !MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) 3979 + mtk_mdio_config(eth); 3981 3980 3982 3981 if (mtk_is_netsys_v3_or_greater(eth)) { 3983 3982 /* Set FE to PDMAv2 if necessary */
+1
drivers/net/ethernet/mediatek/mtk_eth_soc.h
··· 1271 1271 struct clk *clks[MTK_CLK_MAX]; 1272 1272 1273 1273 struct mii_bus *mii_bus; 1274 + unsigned int mdc_divider; 1274 1275 struct work_struct pending_work; 1275 1276 unsigned long state; 1276 1277
+14 -1
drivers/net/ethernet/ti/am65-cpsw-nuss.c
··· 2666 2666 of_property_read_bool(port_np, "ti,mac-only"); 2667 2667 2668 2668 /* get phy/link info */ 2669 - port->slave.port_np = port_np; 2669 + port->slave.port_np = of_node_get(port_np); 2670 2670 ret = of_get_phy_mode(port_np, &port->slave.phy_if); 2671 2671 if (ret) { 2672 2672 dev_err(dev, "%pOF read phy-mode err %d\n", ··· 2717 2717 port = &common->ports[i]; 2718 2718 if (port->slave.phylink) 2719 2719 phylink_destroy(port->slave.phylink); 2720 + } 2721 + } 2722 + 2723 + static void am65_cpsw_remove_dt(struct am65_cpsw_common *common) 2724 + { 2725 + struct am65_cpsw_port *port; 2726 + int i; 2727 + 2728 + for (i = 0; i < common->port_num; i++) { 2729 + port = &common->ports[i]; 2730 + of_node_put(port->slave.port_np); 2720 2731 } 2721 2732 } 2722 2733 ··· 3633 3622 am65_cpsw_nuss_cleanup_ndev(common); 3634 3623 am65_cpsw_nuss_phylink_cleanup(common); 3635 3624 am65_cpts_release(common->cpts); 3625 + am65_cpsw_remove_dt(common); 3636 3626 err_of_clear: 3637 3627 if (common->mdio_dev) 3638 3628 of_platform_device_destroy(common->mdio_dev, NULL); ··· 3673 3661 am65_cpsw_nuss_phylink_cleanup(common); 3674 3662 am65_cpts_release(common->cpts); 3675 3663 am65_cpsw_disable_serdes_phy(common); 3664 + am65_cpsw_remove_dt(common); 3676 3665 3677 3666 if (common->mdio_dev) 3678 3667 of_platform_device_destroy(common->mdio_dev, NULL);
+56 -61
drivers/net/ethernet/ti/icssg/icss_iep.c
··· 412 412 int ret; 413 413 u64 cmp; 414 414 415 + if (!on) { 416 + /* Disable CMP 1 */ 417 + regmap_update_bits(iep->map, ICSS_IEP_CMP_CFG_REG, 418 + IEP_CMP_CFG_CMP_EN(1), 0); 419 + 420 + /* clear CMP regs */ 421 + regmap_write(iep->map, ICSS_IEP_CMP1_REG0, 0); 422 + if (iep->plat_data->flags & ICSS_IEP_64BIT_COUNTER_SUPPORT) 423 + regmap_write(iep->map, ICSS_IEP_CMP1_REG1, 0); 424 + 425 + /* Disable sync */ 426 + regmap_write(iep->map, ICSS_IEP_SYNC_CTRL_REG, 0); 427 + 428 + return 0; 429 + } 430 + 415 431 /* Calculate width of the signal for PPS/PEROUT handling */ 416 432 ts.tv_sec = req->on.sec; 417 433 ts.tv_nsec = req->on.nsec; ··· 446 430 if (ret) 447 431 return ret; 448 432 449 - if (on) { 450 - /* Configure CMP */ 451 - regmap_write(iep->map, ICSS_IEP_CMP1_REG0, lower_32_bits(cmp)); 452 - if (iep->plat_data->flags & ICSS_IEP_64BIT_COUNTER_SUPPORT) 453 - regmap_write(iep->map, ICSS_IEP_CMP1_REG1, upper_32_bits(cmp)); 454 - /* Configure SYNC, based on req on width */ 455 - regmap_write(iep->map, ICSS_IEP_SYNC_PWIDTH_REG, 456 - div_u64(ns_width, iep->def_inc)); 457 - regmap_write(iep->map, ICSS_IEP_SYNC0_PERIOD_REG, 0); 458 - regmap_write(iep->map, ICSS_IEP_SYNC_START_REG, 459 - div_u64(ns_start, iep->def_inc)); 460 - regmap_write(iep->map, ICSS_IEP_SYNC_CTRL_REG, 0); /* one-shot mode */ 461 - /* Enable CMP 1 */ 462 - regmap_update_bits(iep->map, ICSS_IEP_CMP_CFG_REG, 463 - IEP_CMP_CFG_CMP_EN(1), IEP_CMP_CFG_CMP_EN(1)); 464 - } else { 465 - /* Disable CMP 1 */ 466 - regmap_update_bits(iep->map, ICSS_IEP_CMP_CFG_REG, 467 - IEP_CMP_CFG_CMP_EN(1), 0); 468 - 469 - /* clear regs */ 470 - regmap_write(iep->map, ICSS_IEP_CMP1_REG0, 0); 471 - if (iep->plat_data->flags & ICSS_IEP_64BIT_COUNTER_SUPPORT) 472 - regmap_write(iep->map, ICSS_IEP_CMP1_REG1, 0); 473 - } 433 + /* Configure CMP */ 434 + regmap_write(iep->map, ICSS_IEP_CMP1_REG0, lower_32_bits(cmp)); 435 + if (iep->plat_data->flags & ICSS_IEP_64BIT_COUNTER_SUPPORT) 436 + regmap_write(iep->map, ICSS_IEP_CMP1_REG1, upper_32_bits(cmp)); 437 + /* Configure SYNC, based on req on width */ 438 + regmap_write(iep->map, ICSS_IEP_SYNC_PWIDTH_REG, 439 + div_u64(ns_width, iep->def_inc)); 440 + regmap_write(iep->map, ICSS_IEP_SYNC0_PERIOD_REG, 0); 441 + regmap_write(iep->map, ICSS_IEP_SYNC_START_REG, 442 + div_u64(ns_start, iep->def_inc)); 443 + regmap_write(iep->map, ICSS_IEP_SYNC_CTRL_REG, 0); /* one-shot mode */ 444 + /* Enable CMP 1 */ 445 + regmap_update_bits(iep->map, ICSS_IEP_CMP_CFG_REG, 446 + IEP_CMP_CFG_CMP_EN(1), IEP_CMP_CFG_CMP_EN(1)); 474 447 } else { 475 - if (on) { 476 - u64 start_ns; 448 + u64 start_ns; 477 449 478 - iep->period = ((u64)req->period.sec * NSEC_PER_SEC) + 479 - req->period.nsec; 480 - start_ns = ((u64)req->period.sec * NSEC_PER_SEC) 481 - + req->period.nsec; 482 - icss_iep_update_to_next_boundary(iep, start_ns); 450 + iep->period = ((u64)req->period.sec * NSEC_PER_SEC) + 451 + req->period.nsec; 452 + start_ns = ((u64)req->period.sec * NSEC_PER_SEC) 453 + + req->period.nsec; 454 + icss_iep_update_to_next_boundary(iep, start_ns); 483 455 484 - regmap_write(iep->map, ICSS_IEP_SYNC_PWIDTH_REG, 485 - div_u64(ns_width, iep->def_inc)); 486 - regmap_write(iep->map, ICSS_IEP_SYNC_START_REG, 487 - div_u64(ns_start, iep->def_inc)); 488 - /* Enable Sync in single shot mode */ 489 - regmap_write(iep->map, ICSS_IEP_SYNC_CTRL_REG, 490 - IEP_SYNC_CTRL_SYNC_N_EN(0) | IEP_SYNC_CTRL_SYNC_EN); 491 - /* Enable CMP 1 */ 492 - regmap_update_bits(iep->map, ICSS_IEP_CMP_CFG_REG, 493 - IEP_CMP_CFG_CMP_EN(1), IEP_CMP_CFG_CMP_EN(1)); 494 - } else { 495 - /* Disable CMP 1 */ 496 - regmap_update_bits(iep->map, ICSS_IEP_CMP_CFG_REG, 497 - IEP_CMP_CFG_CMP_EN(1), 0); 498 - 499 - /* clear CMP regs */ 500 - regmap_write(iep->map, ICSS_IEP_CMP1_REG0, 0); 501 - if (iep->plat_data->flags & ICSS_IEP_64BIT_COUNTER_SUPPORT) 502 - regmap_write(iep->map, ICSS_IEP_CMP1_REG1, 0); 503 - 504 - /* Disable sync */ 505 - regmap_write(iep->map, ICSS_IEP_SYNC_CTRL_REG, 0); 506 - } 456 + regmap_write(iep->map, ICSS_IEP_SYNC_PWIDTH_REG, 457 + div_u64(ns_width, iep->def_inc)); 458 + regmap_write(iep->map, ICSS_IEP_SYNC_START_REG, 459 + div_u64(ns_start, iep->def_inc)); 460 + /* Enable Sync in single shot mode */ 461 + regmap_write(iep->map, ICSS_IEP_SYNC_CTRL_REG, 462 + IEP_SYNC_CTRL_SYNC_N_EN(0) | IEP_SYNC_CTRL_SYNC_EN); 463 + /* Enable CMP 1 */ 464 + regmap_update_bits(iep->map, ICSS_IEP_CMP_CFG_REG, 465 + IEP_CMP_CFG_CMP_EN(1), IEP_CMP_CFG_CMP_EN(1)); 507 466 } 508 467 509 468 return 0; ··· 489 498 { 490 499 int ret = 0; 491 500 501 + if (!on) 502 + goto disable; 503 + 492 504 /* Reject requests with unsupported flags */ 493 505 if (req->flags & ~(PTP_PEROUT_DUTY_CYCLE | 494 506 PTP_PEROUT_PHASE)) 495 507 return -EOPNOTSUPP; 496 508 509 + /* Set default "on" time (1ms) for the signal if not passed by the app */ 510 + if (!(req->flags & PTP_PEROUT_DUTY_CYCLE)) { 511 + req->on.sec = 0; 512 + req->on.nsec = NSEC_PER_MSEC; 513 + } 514 + 515 + disable: 497 516 mutex_lock(&iep->ptp_clk_mutex); 498 517 499 518 if (iep->pps_enabled) { ··· 513 512 514 513 if (iep->perout_enabled == !!on) 515 514 goto exit; 516 - 517 - /* Set default "on" time (1ms) for the signal if not passed by the app */ 518 - if (!(req->flags & PTP_PEROUT_DUTY_CYCLE)) { 519 - req->on.sec = 0; 520 - req->on.nsec = NSEC_PER_MSEC; 521 - } 522 515 523 516 ret = icss_iep_perout_enable_hw(iep, req, on); 524 517 if (!ret)
+4 -5
drivers/net/ethernet/ti/icssg/icssg_common.c
··· 583 583 first_desc = k3_cppi_desc_pool_alloc(tx_chn->desc_pool); 584 584 if (!first_desc) { 585 585 netdev_dbg(ndev, "xdp tx: failed to allocate descriptor\n"); 586 - goto drop_free_descs; /* drop */ 586 + return ICSSG_XDP_CONSUMED; /* drop */ 587 587 } 588 588 589 589 if (page) { /* already DMA mapped by page_pool */ ··· 671 671 672 672 q_idx = smp_processor_id() % emac->tx_ch_num; 673 673 result = emac_xmit_xdp_frame(emac, xdpf, page, q_idx); 674 - if (result == ICSSG_XDP_CONSUMED) 674 + if (result == ICSSG_XDP_CONSUMED) { 675 + ndev->stats.tx_dropped++; 675 676 goto drop; 677 + } 676 678 677 679 dev_sw_netstats_rx_add(ndev, xdpf->len); 678 680 return result; ··· 1217 1215 prueth_rx_cleanup); 1218 1216 if (disable) 1219 1217 k3_udma_glue_disable_rx_chn(chn->rx_chn); 1220 - 1221 - page_pool_destroy(chn->pg_pool); 1222 - chn->pg_pool = NULL; 1223 1218 } 1224 1219 EXPORT_SYMBOL_GPL(prueth_reset_rx_chan); 1225 1220
+2 -1
drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
··· 625 625 /* setup the private structure */ 626 626 err = ngbe_sw_init(wx); 627 627 if (err) 628 - goto err_free_mac_table; 628 + goto err_pci_release_regions; 629 629 630 630 /* check if flash load is done after hw power up */ 631 631 err = wx_check_flash_load(wx, NGBE_SPI_ILDR_STATUS_PERST); ··· 719 719 err_clear_interrupt_scheme: 720 720 wx_clear_interrupt_scheme(wx); 721 721 err_free_mac_table: 722 + kfree(wx->rss_key); 722 723 kfree(wx->mac_table); 723 724 err_pci_release_regions: 724 725 pci_release_selected_regions(pdev,
+2 -1
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
··· 611 611 /* setup the private structure */ 612 612 err = txgbe_sw_init(wx); 613 613 if (err) 614 - goto err_free_mac_table; 614 + goto err_pci_release_regions; 615 615 616 616 /* check if flash load is done after hw power up */ 617 617 err = wx_check_flash_load(wx, TXGBE_SPI_ILDR_STATUS_PERST); ··· 769 769 wx_clear_interrupt_scheme(wx); 770 770 wx_control_hw(wx, false); 771 771 err_free_mac_table: 772 + kfree(wx->rss_key); 772 773 kfree(wx->mac_table); 773 774 err_pci_release_regions: 774 775 pci_release_selected_regions(pdev,
+1 -1
drivers/net/wireless/atmel/at76c50x-usb.c
··· 2552 2552 2553 2553 wiphy_info(priv->hw->wiphy, "disconnecting\n"); 2554 2554 at76_delete_device(priv); 2555 - usb_put_dev(priv->udev); 2555 + usb_put_dev(interface_to_usbdev(interface)); 2556 2556 dev_info(&interface->dev, "disconnected\n"); 2557 2557 } 2558 2558
+3 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
··· 561 561 if (!found) { 562 562 /* No platform data for this device, try OF and DMI data */ 563 563 brcmf_dmi_probe(settings, chip, chiprev); 564 - if (brcmf_of_probe(dev, bus_type, settings) == -EPROBE_DEFER) 564 + if (brcmf_of_probe(dev, bus_type, settings) == -EPROBE_DEFER) { 565 + kfree(settings); 565 566 return ERR_PTR(-EPROBE_DEFER); 567 + } 566 568 brcmf_acpi_probe(dev, bus_type, settings); 567 569 } 568 570 return settings;
+3 -5
drivers/net/wireless/intel/iwlwifi/mld/d3.c
··· 1895 1895 int link_id; 1896 1896 int ret; 1897 1897 bool fw_err = false; 1898 - bool keep_connection; 1899 1898 1900 1899 lockdep_assert_wiphy(mld->wiphy); 1901 1900 ··· 1964 1965 iwl_mld_process_netdetect_res(mld, bss_vif, &resume_data); 1965 1966 mld->netdetect = false; 1966 1967 } else { 1967 - keep_connection = 1968 + bool keep_connection = 1968 1969 iwl_mld_process_wowlan_status(mld, bss_vif, 1969 1970 resume_data.wowlan_status); 1970 1971 ··· 1972 1973 if (keep_connection) 1973 1974 iwl_mld_unblock_emlsr(mld, bss_vif, 1974 1975 IWL_MLD_EMLSR_BLOCKED_WOWLAN); 1976 + else 1977 + ieee80211_resume_disconnect(bss_vif); 1975 1978 } 1976 - 1977 - if (!mld->netdetect && !keep_connection) 1978 - ieee80211_resume_disconnect(bss_vif); 1979 1979 1980 1980 goto out; 1981 1981
+1 -1
drivers/net/wireless/intel/iwlwifi/mld/debugfs.c
··· 396 396 .data[0] = &cmd, 397 397 }; 398 398 struct iwl_dhc_tas_status_resp *resp = NULL; 399 + u32 resp_len = 0; 399 400 ssize_t pos = 0; 400 - u32 resp_len; 401 401 u32 status; 402 402 int ret; 403 403
+1 -1
drivers/net/wireless/intel/iwlwifi/mld/iface.h
··· 166 166 167 167 struct iwl_mld_emlsr emlsr; 168 168 169 - #if CONFIG_PM_SLEEP 169 + #ifdef CONFIG_PM_SLEEP 170 170 struct iwl_mld_wowlan_data wowlan_data; 171 171 #endif 172 172 #ifdef CONFIG_IWLWIFI_DEBUGFS
+5 -2
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
··· 475 475 int iwl_mld_mac80211_start(struct ieee80211_hw *hw) 476 476 { 477 477 struct iwl_mld *mld = IWL_MAC80211_GET_MLD(hw); 478 - int ret; 479 478 bool in_d3 = false; 479 + int ret = 0; 480 480 481 481 lockdep_assert_wiphy(mld->wiphy); 482 482 ··· 537 537 /* if the suspend flow fails the fw is in error. Stop it here, and it 538 538 * will be started upon wakeup 539 539 */ 540 - if (!suspend || iwl_mld_no_wowlan_suspend(mld)) 540 + if (!suspend || 541 + (IS_ENABLED(CONFIG_PM_SLEEP) && iwl_mld_no_wowlan_suspend(mld))) 541 542 iwl_mld_stop_fw(mld); 542 543 543 544 /* HW is stopped, no more coming RX. OTOH, the worker can't run as the ··· 1944 1943 } 1945 1944 } 1946 1945 1946 + #ifdef CONFIG_PM_SLEEP 1947 1947 static void iwl_mld_set_wakeup(struct ieee80211_hw *hw, bool enabled) 1948 1948 { 1949 1949 struct iwl_mld *mld = IWL_MAC80211_GET_MLD(hw); ··· 1996 1994 1997 1995 return 0; 1998 1996 } 1997 + #endif 1999 1998 2000 1999 static int iwl_mld_alloc_ptk_pn(struct iwl_mld *mld, 2001 2000 struct iwl_mld_sta *mld_sta,
+7 -1
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
··· 147 147 return; 148 148 149 149 if (trans->state >= IWL_TRANS_FW_STARTED && 150 - trans_pcie->fw_reset_handshake) 150 + trans_pcie->fw_reset_handshake) { 151 + /* 152 + * Reset handshake can dump firmware on timeout, but that 153 + * should assume that the firmware is already dead. 154 + */ 155 + trans->state = IWL_TRANS_NO_FW; 151 156 iwl_trans_pcie_fw_reset_handshake(trans); 157 + } 152 158 153 159 trans_pcie->is_down = true; 154 160
+3 -1
drivers/net/wireless/ti/wl1251/tx.c
··· 342 342 while ((skb = skb_dequeue(&wl->tx_queue))) { 343 343 if (!woken_up) { 344 344 ret = wl1251_ps_elp_wakeup(wl); 345 - if (ret < 0) 345 + if (ret < 0) { 346 + skb_queue_head(&wl->tx_queue, skb); 346 347 goto out; 348 + } 347 349 woken_up = true; 348 350 } 349 351
+1
drivers/ptp/ptp_ocp.c
··· 2067 2067 if (!s->start) { 2068 2068 /* roundup() does not work on 32-bit systems */ 2069 2069 s->start = DIV64_U64_ROUND_UP(start_ns, s->period); 2070 + s->start *= s->period; 2070 2071 s->start = ktime_add(s->start, s->phase); 2071 2072 } 2072 2073
+2
include/net/fib_rules.h
··· 45 45 struct fib_rule_port_range dport_range; 46 46 u16 sport_mask; 47 47 u16 dport_mask; 48 + u8 iif_is_l3_master; 49 + u8 oif_is_l3_master; 48 50 struct rcu_head rcu; 49 51 }; 50 52
+1
include/net/flow.h
··· 38 38 __u8 flowic_flags; 39 39 #define FLOWI_FLAG_ANYSRC 0x01 40 40 #define FLOWI_FLAG_KNOWN_NH 0x02 41 + #define FLOWI_FLAG_L3MDEV_OIF 0x04 41 42 __u32 flowic_secid; 42 43 kuid_t flowic_uid; 43 44 __u32 flowic_multipath_hash;
+27
include/net/l3mdev.h
··· 59 59 int l3mdev_fib_rule_match(struct net *net, struct flowi *fl, 60 60 struct fib_lookup_arg *arg); 61 61 62 + static inline 63 + bool l3mdev_fib_rule_iif_match(const struct flowi *fl, int iifindex) 64 + { 65 + return !(fl->flowi_flags & FLOWI_FLAG_L3MDEV_OIF) && 66 + fl->flowi_l3mdev == iifindex; 67 + } 68 + 69 + static inline 70 + bool l3mdev_fib_rule_oif_match(const struct flowi *fl, int oifindex) 71 + { 72 + return fl->flowi_flags & FLOWI_FLAG_L3MDEV_OIF && 73 + fl->flowi_l3mdev == oifindex; 74 + } 75 + 62 76 void l3mdev_update_flow(struct net *net, struct flowi *fl); 63 77 64 78 int l3mdev_master_ifindex_rcu(const struct net_device *dev); ··· 341 327 { 342 328 return 1; 343 329 } 330 + 331 + static inline 332 + bool l3mdev_fib_rule_iif_match(const struct flowi *fl, int iifindex) 333 + { 334 + return false; 335 + } 336 + 337 + static inline 338 + bool l3mdev_fib_rule_oif_match(const struct flowi *fl, int oifindex) 339 + { 340 + return false; 341 + } 342 + 344 343 static inline 345 344 void l3mdev_update_flow(struct net *net, struct flowi *fl) 346 345 {
-1
net/batman-adv/hard-interface.c
··· 725 725 726 726 kref_get(&hard_iface->refcount); 727 727 728 - dev_hold(mesh_iface); 729 728 netdev_hold(mesh_iface, &hard_iface->meshif_dev_tracker, GFP_ATOMIC); 730 729 hard_iface->mesh_iface = mesh_iface; 731 730 bat_priv = netdev_priv(hard_iface->mesh_iface);
+6 -2
net/bluetooth/hci_conn.c
··· 3072 3072 const struct sockcm_cookie *sockc) 3073 3073 { 3074 3074 struct sock *sk = skb ? skb->sk : NULL; 3075 + int key; 3075 3076 3076 3077 /* This shall be called on a single skb of those generated by user 3077 3078 * sendmsg(), and only when the sendmsg() does not return error to ··· 3088 3087 3089 3088 sock_tx_timestamp(sk, sockc, &skb_shinfo(skb)->tx_flags); 3090 3089 3090 + if (sk->sk_type == SOCK_STREAM) 3091 + key = atomic_add_return(key_offset, &sk->sk_tskey); 3092 + 3091 3093 if (sockc->tsflags & SOF_TIMESTAMPING_OPT_ID && 3092 3094 sockc->tsflags & SOF_TIMESTAMPING_TX_RECORD_MASK) { 3093 3095 if (sockc->tsflags & SOCKCM_FLAG_TS_OPT_ID) { 3094 3096 skb_shinfo(skb)->tskey = sockc->ts_opt_id; 3095 3097 } else { 3096 - int key = atomic_add_return(key_offset, &sk->sk_tskey); 3097 - 3098 + if (sk->sk_type != SOCK_STREAM) 3099 + key = atomic_inc_return(&sk->sk_tskey); 3098 3100 skb_shinfo(skb)->tskey = key - 1; 3099 3101 } 3100 3102 }
+3 -2
net/bluetooth/hci_event.c
··· 6160 6160 * event or send an immediate device found event if the data 6161 6161 * should not be stored for later. 6162 6162 */ 6163 - if (!ext_adv && !has_pending_adv_report(hdev)) { 6163 + if (!has_pending_adv_report(hdev)) { 6164 6164 /* If the report will trigger a SCAN_REQ store it for 6165 6165 * later merging. 6166 6166 */ 6167 - if (type == LE_ADV_IND || type == LE_ADV_SCAN_IND) { 6167 + if (!ext_adv && (type == LE_ADV_IND || 6168 + type == LE_ADV_SCAN_IND)) { 6168 6169 store_pending_adv_report(hdev, bdaddr, bdaddr_type, 6169 6170 rssi, flags, data, len); 6170 6171 return;
+19 -2
net/bluetooth/l2cap_core.c
··· 3991 3991 3992 3992 /* Check if the ACL is secure enough (if not SDP) */ 3993 3993 if (psm != cpu_to_le16(L2CAP_PSM_SDP) && 3994 - !hci_conn_check_link_mode(conn->hcon)) { 3994 + (!hci_conn_check_link_mode(conn->hcon) || 3995 + !l2cap_check_enc_key_size(conn->hcon))) { 3995 3996 conn->disc_reason = HCI_ERROR_AUTH_FAILURE; 3996 3997 result = L2CAP_CR_SEC_BLOCK; 3997 3998 goto response; ··· 7539 7538 if (skb->len > len) { 7540 7539 BT_ERR("Frame is too long (len %u, expected len %d)", 7541 7540 skb->len, len); 7541 + /* PTS test cases L2CAP/COS/CED/BI-14-C and BI-15-C 7542 + * (Multiple Signaling Command in one PDU, Data 7543 + * Truncated, BR/EDR) send a C-frame to the IUT with 7544 + * PDU Length set to 8 and Channel ID set to the 7545 + * correct signaling channel for the logical link. 7546 + * The Information payload contains one L2CAP_ECHO_REQ 7547 + * packet with Data Length set to 0 with 0 octets of 7548 + * echo data and one invalid command packet due to 7549 + * data truncated in PDU but present in HCI packet. 7550 + * 7551 + * Shorter the socket buffer to the PDU length to 7552 + * allow to process valid commands from the PDU before 7553 + * setting the socket unreliable. 7554 + */ 7555 + skb->len = len; 7556 + l2cap_recv_frame(conn, skb); 7542 7557 l2cap_conn_unreliable(conn, ECOMM); 7543 - goto drop; 7558 + goto unlock; 7544 7559 } 7545 7560 7546 7561 /* Append fragment into frame (with header) */
+3 -1
net/bridge/br_vlan.c
··· 715 715 u16 flags, bool *changed, 716 716 struct netlink_ext_ack *extack) 717 717 { 718 - bool would_change = __vlan_flags_would_change(vlan, flags); 719 718 bool becomes_brentry = false; 719 + bool would_change = false; 720 720 int err; 721 721 722 722 if (!br_vlan_is_brentry(vlan)) { ··· 725 725 return -EINVAL; 726 726 727 727 becomes_brentry = true; 728 + } else { 729 + would_change = __vlan_flags_would_change(vlan, flags); 728 730 } 729 731 730 732 /* Master VLANs that aren't brentries weren't notified before,
+1
net/can/j1939/socket.c
··· 655 655 sock->sk = NULL; 656 656 657 657 release_sock(sk); 658 + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); 658 659 sock_put(sk); 659 660 660 661 return 0;
+15 -4
net/core/dev.c
··· 1520 1520 1521 1521 void netif_state_change(struct net_device *dev) 1522 1522 { 1523 + netdev_ops_assert_locked_or_invisible(dev); 1524 + 1523 1525 if (dev->flags & IFF_UP) { 1524 1526 struct netdev_notifier_change_info change_info = { 1525 1527 .info.dev = dev, ··· 11934 11932 BUG_ON(dev->reg_state != NETREG_REGISTERED); 11935 11933 } 11936 11934 11937 - /* If device is running, close it first. */ 11935 + /* If device is running, close it first. Start with ops locked... */ 11938 11936 list_for_each_entry(dev, head, unreg_list) { 11939 - list_add_tail(&dev->close_list, &close_head); 11940 - netdev_lock_ops(dev); 11937 + if (netdev_need_ops_lock(dev)) { 11938 + list_add_tail(&dev->close_list, &close_head); 11939 + netdev_lock(dev); 11940 + } 11941 + } 11942 + dev_close_many(&close_head, true); 11943 + /* ... now unlock them and go over the rest. */ 11944 + list_for_each_entry(dev, head, unreg_list) { 11945 + if (netdev_need_ops_lock(dev)) 11946 + netdev_unlock(dev); 11947 + else 11948 + list_add_tail(&dev->close_list, &close_head); 11941 11949 } 11942 11950 dev_close_many(&close_head, true); 11943 11951 11944 11952 list_for_each_entry(dev, head, unreg_list) { 11945 - netdev_unlock_ops(dev); 11946 11953 /* And unlink it from device chain. */ 11947 11954 unlist_netdevice(dev); 11948 11955 netdev_lock(dev);
+40 -8
net/core/fib_rules.c
··· 257 257 return nla_put(skb, attrtype, sizeof(*range), range); 258 258 } 259 259 260 + static bool fib_rule_iif_match(const struct fib_rule *rule, int iifindex, 261 + const struct flowi *fl) 262 + { 263 + u8 iif_is_l3_master = READ_ONCE(rule->iif_is_l3_master); 264 + 265 + return iif_is_l3_master ? l3mdev_fib_rule_iif_match(fl, iifindex) : 266 + fl->flowi_iif == iifindex; 267 + } 268 + 269 + static bool fib_rule_oif_match(const struct fib_rule *rule, int oifindex, 270 + const struct flowi *fl) 271 + { 272 + u8 oif_is_l3_master = READ_ONCE(rule->oif_is_l3_master); 273 + 274 + return oif_is_l3_master ? l3mdev_fib_rule_oif_match(fl, oifindex) : 275 + fl->flowi_oif == oifindex; 276 + } 277 + 260 278 static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops, 261 279 struct flowi *fl, int flags, 262 280 struct fib_lookup_arg *arg) ··· 282 264 int iifindex, oifindex, ret = 0; 283 265 284 266 iifindex = READ_ONCE(rule->iifindex); 285 - if (iifindex && (iifindex != fl->flowi_iif)) 267 + if (iifindex && !fib_rule_iif_match(rule, iifindex, fl)) 286 268 goto out; 287 269 288 270 oifindex = READ_ONCE(rule->oifindex); 289 - if (oifindex && (oifindex != fl->flowi_oif)) 271 + if (oifindex && !fib_rule_oif_match(rule, oifindex, fl)) 290 272 goto out; 291 273 292 274 if ((rule->mark ^ fl->flowi_mark) & rule->mark_mask) ··· 754 736 struct net_device *dev; 755 737 756 738 dev = __dev_get_by_name(nlrule->fr_net, nlrule->iifname); 757 - if (dev) 739 + if (dev) { 758 740 nlrule->iifindex = dev->ifindex; 741 + nlrule->iif_is_l3_master = netif_is_l3_master(dev); 742 + } 759 743 } 760 744 761 745 if (tb[FRA_OIFNAME]) { 762 746 struct net_device *dev; 763 747 764 748 dev = __dev_get_by_name(nlrule->fr_net, nlrule->oifname); 765 - if (dev) 749 + if (dev) { 766 750 nlrule->oifindex = dev->ifindex; 751 + nlrule->oif_is_l3_master = netif_is_l3_master(dev); 752 + } 767 753 } 768 754 769 755 return 0; ··· 1358 1336 1359 1337 list_for_each_entry(rule, rules, list) { 1360 1338 if (rule->iifindex == -1 && 1361 - strcmp(dev->name, rule->iifname) == 0) 1339 + strcmp(dev->name, rule->iifname) == 0) { 1362 1340 WRITE_ONCE(rule->iifindex, dev->ifindex); 1341 + WRITE_ONCE(rule->iif_is_l3_master, 1342 + netif_is_l3_master(dev)); 1343 + } 1363 1344 if (rule->oifindex == -1 && 1364 - strcmp(dev->name, rule->oifname) == 0) 1345 + strcmp(dev->name, rule->oifname) == 0) { 1365 1346 WRITE_ONCE(rule->oifindex, dev->ifindex); 1347 + WRITE_ONCE(rule->oif_is_l3_master, 1348 + netif_is_l3_master(dev)); 1349 + } 1366 1350 } 1367 1351 } 1368 1352 ··· 1377 1349 struct fib_rule *rule; 1378 1350 1379 1351 list_for_each_entry(rule, rules, list) { 1380 - if (rule->iifindex == dev->ifindex) 1352 + if (rule->iifindex == dev->ifindex) { 1381 1353 WRITE_ONCE(rule->iifindex, -1); 1382 - if (rule->oifindex == dev->ifindex) 1354 + WRITE_ONCE(rule->iif_is_l3_master, false); 1355 + } 1356 + if (rule->oifindex == dev->ifindex) { 1383 1357 WRITE_ONCE(rule->oifindex, -1); 1358 + WRITE_ONCE(rule->oif_is_l3_master, false); 1359 + } 1384 1360 } 1385 1361 } 1386 1362
+1 -4
net/core/rtnetlink.c
··· 3676 3676 nla_len(tb[IFLA_BROADCAST])); 3677 3677 if (tb[IFLA_TXQLEN]) 3678 3678 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]); 3679 - if (tb[IFLA_OPERSTATE]) { 3680 - netdev_lock_ops(dev); 3679 + if (tb[IFLA_OPERSTATE]) 3681 3680 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE])); 3682 - netdev_unlock_ops(dev); 3683 - } 3684 3681 if (tb[IFLA_LINKMODE]) 3685 3682 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]); 3686 3683 if (tb[IFLA_GROUP])
+49 -10
net/dsa/dsa.c
··· 862 862 kfree(dst->lags); 863 863 } 864 864 865 + static void dsa_tree_teardown_routing_table(struct dsa_switch_tree *dst) 866 + { 867 + struct dsa_link *dl, *next; 868 + 869 + list_for_each_entry_safe(dl, next, &dst->rtable, list) { 870 + list_del(&dl->list); 871 + kfree(dl); 872 + } 873 + } 874 + 865 875 static int dsa_tree_setup(struct dsa_switch_tree *dst) 866 876 { 867 877 bool complete; ··· 889 879 890 880 err = dsa_tree_setup_cpu_ports(dst); 891 881 if (err) 892 - return err; 882 + goto teardown_rtable; 893 883 894 884 err = dsa_tree_setup_switches(dst); 895 885 if (err) ··· 921 911 dsa_tree_teardown_switches(dst); 922 912 teardown_cpu_ports: 923 913 dsa_tree_teardown_cpu_ports(dst); 914 + teardown_rtable: 915 + dsa_tree_teardown_routing_table(dst); 924 916 925 917 return err; 926 918 } 927 919 928 920 static void dsa_tree_teardown(struct dsa_switch_tree *dst) 929 921 { 930 - struct dsa_link *dl, *next; 931 - 932 922 if (!dst->setup) 933 923 return; 934 924 ··· 942 932 943 933 dsa_tree_teardown_cpu_ports(dst); 944 934 945 - list_for_each_entry_safe(dl, next, &dst->rtable, list) { 946 - list_del(&dl->list); 947 - kfree(dl); 948 - } 935 + dsa_tree_teardown_routing_table(dst); 949 936 950 937 pr_info("DSA: tree %d torn down\n", dst->index); 951 938 ··· 1485 1478 1486 1479 static void dsa_switch_release_ports(struct dsa_switch *ds) 1487 1480 { 1481 + struct dsa_mac_addr *a, *tmp; 1488 1482 struct dsa_port *dp, *next; 1483 + struct dsa_vlan *v, *n; 1489 1484 1490 1485 dsa_switch_for_each_port_safe(dp, next, ds) { 1491 - WARN_ON(!list_empty(&dp->fdbs)); 1492 - WARN_ON(!list_empty(&dp->mdbs)); 1493 - WARN_ON(!list_empty(&dp->vlans)); 1486 + /* These are either entries that upper layers lost track of 1487 + * (probably due to bugs), or installed through interfaces 1488 + * where one does not necessarily have to remove them, like 1489 + * ndo_dflt_fdb_add(). 1490 + */ 1491 + list_for_each_entry_safe(a, tmp, &dp->fdbs, list) { 1492 + dev_info(ds->dev, 1493 + "Cleaning up unicast address %pM vid %u from port %d\n", 1494 + a->addr, a->vid, dp->index); 1495 + list_del(&a->list); 1496 + kfree(a); 1497 + } 1498 + 1499 + list_for_each_entry_safe(a, tmp, &dp->mdbs, list) { 1500 + dev_info(ds->dev, 1501 + "Cleaning up multicast address %pM vid %u from port %d\n", 1502 + a->addr, a->vid, dp->index); 1503 + list_del(&a->list); 1504 + kfree(a); 1505 + } 1506 + 1507 + /* These are entries that upper layers have lost track of, 1508 + * probably due to bugs, but also due to dsa_port_do_vlan_del() 1509 + * having failed and the VLAN entry still lingering on. 1510 + */ 1511 + list_for_each_entry_safe(v, n, &dp->vlans, list) { 1512 + dev_info(ds->dev, 1513 + "Cleaning up vid %u from port %d\n", 1514 + v->vid, dp->index); 1515 + list_del(&v->list); 1516 + kfree(v); 1517 + } 1518 + 1494 1519 list_del(&dp->list); 1495 1520 kfree(dp); 1496 1521 }
+1 -1
net/dsa/tag_8021q.c
··· 197 197 198 198 err = ds->ops->tag_8021q_vlan_del(ds, port, vid); 199 199 if (err) { 200 - refcount_inc(&v->refcount); 200 + refcount_set(&v->refcount, 1); 201 201 return err; 202 202 } 203 203
+1 -1
net/ethtool/cmis_cdb.c
··· 351 351 struct netlink_ext_ack extack = {}; 352 352 int err; 353 353 354 - ethtool_cmis_page_init(&page_data, 0, offset, sizeof(rpl)); 354 + ethtool_cmis_page_init(&page_data, 0, offset, sizeof(*rpl)); 355 355 page_data.data = (u8 *)rpl; 356 356 357 357 err = ops->get_module_eeprom_by_page(dev, &page_data, &extack);
+1
net/ipv6/route.c
··· 1771 1771 if (!err) { 1772 1772 spin_lock_bh(&f6i->fib6_table->tb6_lock); 1773 1773 fib6_update_sernum(net, f6i); 1774 + fib6_add_gc_list(f6i); 1774 1775 spin_unlock_bh(&f6i->fib6_table->tb6_lock); 1775 1776 fib6_force_start_gc(net); 1776 1777 }
+3 -1
net/l3mdev/l3mdev.c
··· 277 277 if (fl->flowi_oif) { 278 278 dev = dev_get_by_index_rcu(net, fl->flowi_oif); 279 279 if (dev) { 280 - if (!fl->flowi_l3mdev) 280 + if (!fl->flowi_l3mdev) { 281 281 fl->flowi_l3mdev = l3mdev_master_ifindex_rcu(dev); 282 + fl->flowi_flags |= FLOWI_FLAG_L3MDEV_OIF; 283 + } 282 284 283 285 /* oif set to L3mdev directs lookup to its table; 284 286 * reset to avoid oif match in fib_lookup
+3
net/mac80211/iface.c
··· 659 659 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 660 660 ieee80211_txq_remove_vlan(local, sdata); 661 661 662 + if (sdata->vif.txq) 663 + ieee80211_txq_purge(sdata->local, to_txq_info(sdata->vif.txq)); 664 + 662 665 sdata->bss = NULL; 663 666 664 667 if (local->open_count == 0)
+3
net/mctp/af_mctp.c
··· 630 630 { 631 631 struct net *net = sock_net(sk); 632 632 633 + /* Bind lookup runs under RCU, remain live during that. */ 634 + sock_set_flag(sk, SOCK_RCU_FREE); 635 + 633 636 mutex_lock(&net->mctp.bind_lock); 634 637 sk_add_node_rcu(sk, &net->mctp.binds); 635 638 mutex_unlock(&net->mctp.bind_lock);
+6 -4
net/netfilter/nf_flow_table_core.c
··· 383 383 void flow_offload_teardown(struct flow_offload *flow) 384 384 { 385 385 clear_bit(IPS_OFFLOAD_BIT, &flow->ct->status); 386 - set_bit(NF_FLOW_TEARDOWN, &flow->flags); 387 - flow_offload_fixup_ct(flow); 386 + if (!test_and_set_bit(NF_FLOW_TEARDOWN, &flow->flags)) 387 + flow_offload_fixup_ct(flow); 388 388 } 389 389 EXPORT_SYMBOL_GPL(flow_offload_teardown); 390 390 ··· 558 558 559 559 if (nf_flow_has_expired(flow) || 560 560 nf_ct_is_dying(flow->ct) || 561 - nf_flow_custom_gc(flow_table, flow)) 561 + nf_flow_custom_gc(flow_table, flow)) { 562 562 flow_offload_teardown(flow); 563 - else if (!teardown) 563 + teardown = true; 564 + } else if (!teardown) { 564 565 nf_flow_table_extend_ct_timeout(flow->ct); 566 + } 565 567 566 568 if (teardown) { 567 569 if (test_bit(NF_FLOW_HW, &flow->flags)) {
+2 -1
net/openvswitch/flow_netlink.c
··· 2876 2876 size_t key_len; 2877 2877 2878 2878 /* There can be only one key in a action */ 2879 - if (nla_total_size(nla_len(ovs_key)) != nla_len(a)) 2879 + if (!nla_ok(ovs_key, nla_len(a)) || 2880 + nla_total_size(nla_len(ovs_key)) != nla_len(a)) 2880 2881 return -EINVAL; 2881 2882 2882 2883 key_len = nla_len(ovs_key);
+5
net/smc/af_smc.c
··· 362 362 return; 363 363 } 364 364 365 + static struct lock_class_key smc_key; 366 + static struct lock_class_key smc_slock_key; 367 + 365 368 void smc_sk_init(struct net *net, struct sock *sk, int protocol) 366 369 { 367 370 struct smc_sock *smc = smc_sk(sk); ··· 378 375 INIT_WORK(&smc->connect_work, smc_connect_work); 379 376 INIT_DELAYED_WORK(&smc->conn.tx_work, smc_tx_work); 380 377 INIT_LIST_HEAD(&smc->accept_q); 378 + sock_lock_init_class_and_name(sk, "slock-AF_SMC", &smc_slock_key, 379 + "sk_lock-AF_SMC", &smc_key); 381 380 spin_lock_init(&smc->accept_q_lock); 382 381 spin_lock_init(&smc->conn.send_lock); 383 382 sk->sk_prot->hash(sk);
+72 -24
tools/net/ynl/pyynl/ynl_gen_c.py
··· 162 162 def free_needs_iter(self): 163 163 return False 164 164 165 - def free(self, ri, var, ref): 165 + def _free_lines(self, ri, var, ref): 166 166 if self.is_multi_val() or self.presence_type() == 'len': 167 - ri.cw.p(f'free({var}->{ref}{self.c_name});') 167 + return [f'free({var}->{ref}{self.c_name});'] 168 + return [] 169 + 170 + def free(self, ri, var, ref): 171 + lines = self._free_lines(ri, var, ref) 172 + for line in lines: 173 + ri.cw.p(line) 168 174 169 175 def arg_member(self, ri): 170 176 member = self._complex_member_type(ri) ··· 269 263 var = "req" 270 264 member = f"{var}->{'.'.join(ref)}" 271 265 266 + local_vars = [] 267 + if self.free_needs_iter(): 268 + local_vars += ['unsigned int i;'] 269 + 272 270 code = [] 273 271 presence = '' 274 272 for i in range(0, len(ref)): ··· 282 272 if i == len(ref) - 1 and self.presence_type() != 'bit': 283 273 continue 284 274 code.append(presence + ' = 1;') 275 + ref_path = '.'.join(ref[:-1]) 276 + if ref_path: 277 + ref_path += '.' 278 + code += self._free_lines(ri, var, ref_path) 285 279 code += self._setter_lines(ri, member, presence) 286 280 287 281 func_name = f"{op_prefix(ri, direction, deref=deref)}_set_{'_'.join(ref)}" ··· 293 279 alloc = bool([x for x in code if 'alloc(' in x]) 294 280 if free and not alloc: 295 281 func_name = '__' + func_name 296 - ri.cw.write_func('static inline void', func_name, body=code, 282 + ri.cw.write_func('static inline void', func_name, local_vars=local_vars, 283 + body=code, 297 284 args=[f'{type_name(ri, direction, deref=deref)} *{var}'] + self.arg_member(ri)) 298 285 299 286 ··· 497 482 ['unsigned int len;'] 498 483 499 484 def _setter_lines(self, ri, member, presence): 500 - return [f"free({member});", 501 - f"{presence}_len = strlen({self.c_name});", 485 + return [f"{presence}_len = strlen({self.c_name});", 502 486 f"{member} = malloc({presence}_len + 1);", 503 487 f'memcpy({member}, {self.c_name}, {presence}_len);', 504 488 f'{member}[{presence}_len] = 0;'] ··· 550 536 ['unsigned int len;'] 551 537 552 538 def _setter_lines(self, ri, member, presence): 553 - return [f"free({member});", 554 - f"{presence}_len = len;", 539 + return [f"{presence}_len = len;", 555 540 f"{member} = malloc({presence}_len);", 556 541 f'memcpy({member}, {self.c_name}, {presence}_len);'] 557 542 ··· 587 574 def _complex_member_type(self, ri): 588 575 return self.nested_struct_type 589 576 590 - def free(self, ri, var, ref): 577 + def _free_lines(self, ri, var, ref): 578 + lines = [] 591 579 at = '&' 592 580 if self.is_recursive_for_op(ri): 593 581 at = '' 594 - ri.cw.p(f'if ({var}->{ref}{self.c_name})') 595 - ri.cw.p(f'{self.nested_render_name}_free({at}{var}->{ref}{self.c_name});') 582 + lines += [f'if ({var}->{ref}{self.c_name})'] 583 + lines += [f'{self.nested_render_name}_free({at}{var}->{ref}{self.c_name});'] 584 + return lines 596 585 597 586 def _attr_typol(self): 598 587 return f'.type = YNL_PT_NEST, .nest = &{self.nested_render_name}_nest, ' ··· 647 632 def free_needs_iter(self): 648 633 return 'type' not in self.attr or self.attr['type'] == 'nest' 649 634 650 - def free(self, ri, var, ref): 635 + def _free_lines(self, ri, var, ref): 636 + lines = [] 651 637 if self.attr['type'] in scalars: 652 - ri.cw.p(f"free({var}->{ref}{self.c_name});") 638 + lines += [f"free({var}->{ref}{self.c_name});"] 653 639 elif 'type' not in self.attr or self.attr['type'] == 'nest': 654 - ri.cw.p(f"for (i = 0; i < {var}->{ref}n_{self.c_name}; i++)") 655 - ri.cw.p(f'{self.nested_render_name}_free(&{var}->{ref}{self.c_name}[i]);') 656 - ri.cw.p(f"free({var}->{ref}{self.c_name});") 640 + lines += [ 641 + f"for (i = 0; i < {var}->{ref}n_{self.c_name}; i++)", 642 + f'{self.nested_render_name}_free(&{var}->{ref}{self.c_name}[i]);', 643 + f"free({var}->{ref}{self.c_name});", 644 + ] 657 645 else: 658 646 raise Exception(f"Free of MultiAttr sub-type {self.attr['type']} not supported yet") 647 + return lines 659 648 660 649 def _attr_policy(self, policy): 661 650 return self.base_type._attr_policy(policy) ··· 673 654 def attr_put(self, ri, var): 674 655 if self.attr['type'] in scalars: 675 656 put_type = self.type 676 - ri.cw.p(f"for (unsigned int i = 0; i < {var}->n_{self.c_name}; i++)") 657 + ri.cw.p(f"for (i = 0; i < {var}->n_{self.c_name}; i++)") 677 658 ri.cw.p(f"ynl_attr_put_{put_type}(nlh, {self.enum_name}, {var}->{self.c_name}[i]);") 678 659 elif 'type' not in self.attr or self.attr['type'] == 'nest': 679 - ri.cw.p(f"for (unsigned int i = 0; i < {var}->n_{self.c_name}; i++)") 660 + ri.cw.p(f"for (i = 0; i < {var}->n_{self.c_name}; i++)") 680 661 self._attr_put_line(ri, var, f"{self.nested_render_name}_put(nlh, " + 681 662 f"{self.enum_name}, &{var}->{self.c_name}[i])") 682 663 else: ··· 685 666 def _setter_lines(self, ri, member, presence): 686 667 # For multi-attr we have a count, not presence, hack up the presence 687 668 presence = presence[:-(len('_present.') + len(self.c_name))] + "n_" + self.c_name 688 - return [f"free({member});", 689 - f"{member} = {self.c_name};", 669 + return [f"{member} = {self.c_name};", 690 670 f"{presence} = n_{self.c_name};"] 691 671 692 672 ··· 714 696 def _attr_get(self, ri, var): 715 697 local_vars = ['const struct nlattr *attr2;'] 716 698 get_lines = [f'attr_{self.c_name} = attr;', 717 - 'ynl_attr_for_each_nested(attr2, attr)', 718 - f'\t{var}->n_{self.c_name}++;'] 699 + 'ynl_attr_for_each_nested(attr2, attr) {', 700 + '\tif (ynl_attr_validate(yarg, attr2))', 701 + '\t\treturn YNL_PARSE_CB_ERROR;', 702 + f'\t{var}->n_{self.c_name}++;', 703 + '}'] 719 704 return get_lines, None, local_vars 720 705 721 706 ··· 776 755 self.request = False 777 756 self.reply = False 778 757 self.recursive = False 758 + self.in_multi_val = False # used by a MultiAttr or and legacy arrays 779 759 780 760 self.attr_list = [] 781 761 self.attrs = dict() ··· 1144 1122 if attr in rs_members['reply']: 1145 1123 self.pure_nested_structs[nested].reply = True 1146 1124 1125 + if spec.is_multi_val(): 1126 + child = self.pure_nested_structs.get(nested) 1127 + child.in_multi_val = True 1128 + 1147 1129 self._sort_pure_types() 1148 1130 1149 1131 # Propagate the request / reply / recursive ··· 1162 1136 struct.child_nests.update(child.child_nests) 1163 1137 child.request |= struct.request 1164 1138 child.reply |= struct.reply 1139 + if spec.is_multi_val(): 1140 + child.in_multi_val = True 1165 1141 if attr_set in struct.child_nests: 1166 1142 struct.recursive = True 1167 1143 ··· 1427 1399 1428 1400 def write_func(self, qual_ret, name, body, args=None, local_vars=None): 1429 1401 self.write_func_prot(qual_ret=qual_ret, name=name, args=args) 1402 + self.block_start() 1430 1403 self.write_func_lvar(local_vars=local_vars) 1431 1404 1432 - self.block_start() 1433 1405 for line in body: 1434 1406 self.p(line) 1435 1407 self.block_end() ··· 1672 1644 1673 1645 1674 1646 def put_req_nested(ri, struct): 1647 + local_vars = [] 1648 + init_lines = [] 1649 + 1650 + local_vars.append('struct nlattr *nest;') 1651 + init_lines.append("nest = ynl_attr_nest_start(nlh, attr_type);") 1652 + 1653 + for _, arg in struct.member_list(): 1654 + if arg.presence_type() == 'count': 1655 + local_vars.append('unsigned int i;') 1656 + break 1657 + 1675 1658 put_req_nested_prototype(ri, struct, suffix='') 1676 1659 ri.cw.block_start() 1677 - ri.cw.write_func_lvar('struct nlattr *nest;') 1660 + ri.cw.write_func_lvar(local_vars) 1678 1661 1679 - ri.cw.p("nest = ynl_attr_nest_start(nlh, attr_type);") 1662 + for line in init_lines: 1663 + ri.cw.p(line) 1680 1664 1681 1665 for _, arg in struct.member_list(): 1682 1666 arg.attr_put(ri, "obj") ··· 1889 1849 if ri.fixed_hdr: 1890 1850 local_vars += ['size_t hdr_len;', 1891 1851 'void *hdr;'] 1852 + 1853 + for _, attr in ri.struct["request"].member_list(): 1854 + if attr.presence_type() == 'count': 1855 + local_vars += ['unsigned int i;'] 1856 + break 1892 1857 1893 1858 print_prototype(ri, direction, terminate=False) 1894 1859 ri.cw.block_start() ··· 2986 2941 for attr_set, struct in parsed.pure_nested_structs.items(): 2987 2942 ri = RenderInfo(cw, parsed, args.mode, "", "", attr_set) 2988 2943 print_type_full(ri, struct) 2944 + if struct.request and struct.in_multi_val: 2945 + free_rsp_nested_prototype(ri) 2946 + cw.nl() 2989 2947 2990 2948 for op_name, op in parsed.ops.items(): 2991 2949 cw.p(f"/* ============== {op.enum_name} ============== */")
+4
tools/testing/selftests/drivers/net/hw/iou-zcrx.py
··· 35 35 rx_ring = _get_rx_ring_entries(cfg) 36 36 37 37 try: 38 + ethtool(f"-G {cfg.ifname} tcp-data-split on", host=cfg.remote) 38 39 ethtool(f"-G {cfg.ifname} rx 64", host=cfg.remote) 39 40 ethtool(f"-X {cfg.ifname} equal {combined_chans - 1}", host=cfg.remote) 40 41 flow_rule_id = _set_flow_rule(cfg, combined_chans - 1) ··· 49 48 ethtool(f"-N {cfg.ifname} delete {flow_rule_id}", host=cfg.remote) 50 49 ethtool(f"-X {cfg.ifname} default", host=cfg.remote) 51 50 ethtool(f"-G {cfg.ifname} rx {rx_ring}", host=cfg.remote) 51 + ethtool(f"-G {cfg.ifname} tcp-data-split auto", host=cfg.remote) 52 52 53 53 54 54 def test_zcrx_oneshot(cfg) -> None: ··· 61 59 rx_ring = _get_rx_ring_entries(cfg) 62 60 63 61 try: 62 + ethtool(f"-G {cfg.ifname} tcp-data-split on", host=cfg.remote) 64 63 ethtool(f"-G {cfg.ifname} rx 64", host=cfg.remote) 65 64 ethtool(f"-X {cfg.ifname} equal {combined_chans - 1}", host=cfg.remote) 66 65 flow_rule_id = _set_flow_rule(cfg, combined_chans - 1) ··· 75 72 ethtool(f"-N {cfg.ifname} delete {flow_rule_id}", host=cfg.remote) 76 73 ethtool(f"-X {cfg.ifname} default", host=cfg.remote) 77 74 ethtool(f"-G {cfg.ifname} rx {rx_ring}", host=cfg.remote) 75 + ethtool(f"-G {cfg.ifname} tcp-data-split auto", host=cfg.remote) 78 76 79 77 80 78 def main() -> None:
+34
tools/testing/selftests/net/fib_rule_tests.sh
··· 359 359 "$getnomatch" "iif flowlabel masked redirect to table" \ 360 360 "iif flowlabel masked no redirect to table" 361 361 fi 362 + 363 + $IP link show dev $DEV | grep -q vrf0 364 + if [ $? -eq 0 ]; then 365 + match="oif vrf0" 366 + getmatch="oif $DEV" 367 + getnomatch="oif lo" 368 + fib_rule6_test_match_n_redirect "$match" "$getmatch" \ 369 + "$getnomatch" "VRF oif redirect to table" \ 370 + "VRF oif no redirect to table" 371 + 372 + match="from $SRC_IP6 iif vrf0" 373 + getmatch="from $SRC_IP6 iif $DEV" 374 + getnomatch="from $SRC_IP6 iif lo" 375 + fib_rule6_test_match_n_redirect "$match" "$getmatch" \ 376 + "$getnomatch" "VRF iif redirect to table" \ 377 + "VRF iif no redirect to table" 378 + fi 362 379 } 363 380 364 381 fib_rule6_vrf_test() ··· 651 634 fib_rule4_test_match_n_redirect "$match" "$getmatch" \ 652 635 "$getnomatch" "iif dscp masked redirect to table" \ 653 636 "iif dscp masked no redirect to table" 637 + fi 638 + 639 + $IP link show dev $DEV | grep -q vrf0 640 + if [ $? -eq 0 ]; then 641 + match="oif vrf0" 642 + getmatch="oif $DEV" 643 + getnomatch="oif lo" 644 + fib_rule4_test_match_n_redirect "$match" "$getmatch" \ 645 + "$getnomatch" "VRF oif redirect to table" \ 646 + "VRF oif no redirect to table" 647 + 648 + match="from $SRC_IP iif vrf0" 649 + getmatch="from $SRC_IP iif $DEV" 650 + getnomatch="from $SRC_IP iif lo" 651 + fib_rule4_test_match_n_redirect "$match" "$getmatch" \ 652 + "$getnomatch" "VRF iif redirect to table" \ 653 + "VRF iif no redirect to table" 654 654 fi 655 655 } 656 656
+22
tools/testing/selftests/tc-testing/tc-tests/infra/actions.json
··· 412 412 "teardown": [ 413 413 "$TC qdisc del dev $DUMMY ingress" 414 414 ] 415 + }, 416 + { 417 + "id": "33f4", 418 + "name": "Check echo of big filter command", 419 + "category": [ 420 + "infra", 421 + "u32" 422 + ], 423 + "plugins": { 424 + "requires": "nsPlugin" 425 + }, 426 + "setup": [ 427 + "$TC qdisc add dev $DUMMY parent root handle 10: fq_codel" 428 + ], 429 + "cmdUnderTest": "bash -c '$TC -echo filter add dev $DUMMY parent 10: u32 match u32 0 0 $(for i in $(seq 32); do echo action pedit munge ip dport set 22; done) | grep \"added filter\"'", 430 + "verifyCmd": "", 431 + "expExitCode": "0", 432 + "matchCount": "0", 433 + "matchPattern": "", 434 + "teardown": [ 435 + "$TC qdisc del dev $DUMMY parent root fq_codel" 436 + ] 415 437 } 416 438 ]