Pull networking fixes from Jakub Kicinski: - fix failure to add bond interfaces to a bridge, the offload-handling code was too defensive there and recent refactoring unearthed that. Users complained (Ido) - fix unnecessarily reflecting ECN bits within TOS values / QoS marking in TCP ACK and reset packets (Wei) - fix a deadlock with bpf iterator. Hopefully we're in the clear on this front now... (Yonghong) - BPF fix for clobbering r2 in bpf_gen_ld_abs (Daniel) - fix AQL on mt76 devices with FW rate control and add a couple of AQL issues in mac80211 code (Felix) - fix authentication issue with mwifiex (Maximilian) - WiFi connectivity fix: revert IGTK support in ti/wlcore (Mauro) - fix exception handling for multipath routes via same device (David Ahern) - revert back to a BH spin lock flavor for nsid_lock: there are paths which do require the BH context protection (Taehee) - fix interrupt / queue / NAPI handling in the lantiq driver (Hauke) - fix ife module load deadlock (Cong) - make an adjustment to netlink reply message type for code added in this release (the sole change touching uAPI here) (Michal) - a number of fixes for small NXP and Microchip switches (Vladimir) [ Pull request acked by David: "you can expect more of this in the future as I try to delegate more things to Jakub" ] * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (167 commits) net: mscc: ocelot: fix some key offsets for IP4_TCP_UDP VCAP IS2 entries net: dsa: seville: fix some key offsets for IP4_TCP_UDP VCAP IS2 entries net: dsa: felix: fix some key offsets for IP4_TCP_UDP VCAP IS2 entries inet_diag: validate INET_DIAG_REQ_PROTOCOL attribute net: bridge: br_vlan_get_pvid_rcu() should dereference the VLAN group under RCU net: Update MAINTAINERS for MediaTek switch driver net/mlx5e: mlx5e_fec_in_caps() returns a boolean net/mlx5e: kTLS, Avoid kzalloc(GFP_KERNEL) under spinlock net/mlx5e: kTLS, Fix leak on resync error flow net/mlx5e: kTLS, Add missing dma_unmap in RX resync net/mlx5e: kTLS, Fix napi sync and possible use-after-free net/mlx5e: TLS, Do not expose FPGA TLS counter if not supported net/mlx5e: Fix using wrong stats_grps in mlx5e_update_ndo_stats() net/mlx5e: Fix multicast counter not up-to-date in "ip -s" net/mlx5e: Fix endianness when calculating pedit mask first bit net/mlx5e: Enable adding peer miss rules only if merged eswitch is supported net/mlx5e: CT: Fix freeing ct_label mapping net/mlx5e: Fix memory leak of tunnel info when rule under multipath not ready net/mlx5e: Use synchronize_rcu to sync with NAPI net/mlx5e: Use RCU to protect rq->xdp_prog ...
Unified · Split
| @@ -182,9 +182,6 @@ in the order of reservations, but only after all previous records where · 181 unmodified lines | ||
| 182 | 182 | already committed. It is thus possible for slow producers to temporarily hold |
| 183 | 183 | off submitted records, that were reserved later. |
| 184 | 184 | |
| 185 | −Reservation/commit/consumer protocol is verified by litmus tests in | |
| 186 | −Documentation/litmus_tests/bpf-rb/_. | |
| 187 | − | |
| 188 | 185 | One interesting implementation bit, that significantly simplifies (and thus |
| 189 | 186 | speeds up as well) implementation of both producers and consumers is how data |
| 190 | 187 | area is mapped twice contiguously back-to-back in the virtual memory. This |
| @@ -200,7 +197,7 @@ a self-pacing notifications of new data being availability. · 9 unmodified lines | ||
| 200 | 197 | being available after commit only if consumer has already caught up right up to |
| 201 | 198 | the record being committed. If not, consumer still has to catch up and thus |
| 202 | 199 | will see new data anyways without needing an extra poll notification. |
| 203 | −Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbuf.c_) show that | |
| 200 | +Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbufs.c) show that | |
| 204 | 201 | this allows to achieve a very high throughput without having to resort to |
| 205 | 202 | tricks like "notify only every Nth sample", which are necessary with perf |
| 206 | 203 | buffer. For extreme cases, when BPF program wants more manual control of |
| @@ -206,6 +206,7 @@ Userspace to kernel: · 205 unmodified lines | ||
| 206 | 206 | ``ETHTOOL_MSG_TSINFO_GET`` get timestamping info |
| 207 | 207 | ``ETHTOOL_MSG_CABLE_TEST_ACT`` action start cable test |
| 208 | 208 | ``ETHTOOL_MSG_CABLE_TEST_TDR_ACT`` action start raw TDR cable test |
| 209 | + ``ETHTOOL_MSG_TUNNEL_INFO_GET`` get tunnel offload info | |
| 209 | 210 | ===================================== ================================ |
| 210 | 211 | |
| 211 | 212 | Kernel to userspace: |
| @@ -239,6 +240,7 @@ Kernel to userspace: · 27 unmodified lines | ||
| 239 | 240 | ``ETHTOOL_MSG_TSINFO_GET_REPLY`` timestamping info |
| 240 | 241 | ``ETHTOOL_MSG_CABLE_TEST_NTF`` Cable test results |
| 241 | 242 | ``ETHTOOL_MSG_CABLE_TEST_TDR_NTF`` Cable test TDR results |
| 243 | + ``ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY`` tunnel offload info | |
| 242 | 244 | ===================================== ================================= |
| 243 | 245 | |
| 244 | 246 | ``GET`` requests are sent by userspace applications to retrieve device |
| @@ -1363,4 +1365,5 @@ are netlink only. · 1118 unmodified lines | ||
| 1363 | 1365 | ``ETHTOOL_SFECPARAM`` n/a |
| 1364 | 1366 | n/a ''ETHTOOL_MSG_CABLE_TEST_ACT'' |
| 1365 | 1367 | n/a ''ETHTOOL_MSG_CABLE_TEST_TDR_ACT'' |
| 1368 | + n/a ``ETHTOOL_MSG_TUNNEL_INFO_GET`` | |
| 1366 | 1369 | =================================== ===================================== |
| @@ -4408,12 +4408,6 @@ T: git git://git.infradead.org/users/hch/configfs.git · 4407 unmodified lines | ||
| 4408 | 4408 | F: fs/configfs/ |
| 4409 | 4409 | F: include/linux/configfs.h |
| 4410 | 4410 | |
| 4411 | −CONNECTOR | |
| 4412 | −M: Evgeniy Polyakov <zbr@ioremap.net> | |
| 4413 | −L: netdev@vger.kernel.org | |
| 4414 | −S: Maintained | |
| 4415 | −F: drivers/connector/ | |
| 4416 | − | |
| 4417 | 4411 | CONSOLE SUBSYSTEM |
| 4418 | 4412 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| 4419 | 4413 | S: Supported |
| @@ -8329,8 +8323,9 @@ S: Supported · 3909 unmodified lines | ||
| 8329 | 8323 | F: drivers/pci/hotplug/rpaphp* |
| 8330 | 8324 | |
| 8331 | 8325 | IBM Power SRIOV Virtual NIC Device Driver |
| 8332 | −M: Thomas Falcon <tlfalcon@linux.ibm.com> | |
| 8333 | −M: John Allen <jallen@linux.ibm.com> | |
| 8326 | +M: Dany Madden <drt@linux.ibm.com> | |
| 8327 | +M: Lijun Pan <ljp@linux.ibm.com> | |
| 8328 | +M: Sukadev Bhattiprolu <sukadev@linux.ibm.com> | |
| 8334 | 8329 | L: netdev@vger.kernel.org |
| 8335 | 8330 | S: Supported |
| 8336 | 8331 | F: drivers/net/ethernet/ibm/ibmvnic.* |
| @@ -8344,7 +8339,7 @@ F: arch/powerpc/platforms/powernv/copy-paste.h · 7 unmodified lines | ||
| 8344 | 8339 | F: arch/powerpc/platforms/powernv/vas* |
| 8345 | 8340 | |
| 8346 | 8341 | IBM Power Virtual Ethernet Device Driver |
| 8347 | −M: Thomas Falcon <tlfalcon@linux.ibm.com> | |
| 8342 | +M: Cristobal Forno <cforno12@linux.ibm.com> | |
| 8348 | 8343 | L: netdev@vger.kernel.org |
| 8349 | 8344 | S: Supported |
| 8350 | 8345 | F: drivers/net/ethernet/ibm/ibmveth.* |
| @@ -11042,6 +11037,7 @@ F: drivers/char/hw_random/mtk-rng.c · 2691 unmodified lines | ||
| 11042 | 11037 | |
| 11043 | 11038 | MEDIATEK SWITCH DRIVER |
| 11044 | 11039 | M: Sean Wang <sean.wang@mediatek.com> |
| 11040 | +M: Landen Chao <Landen.Chao@mediatek.com> | |
| 11045 | 11041 | L: netdev@vger.kernel.org |
| 11046 | 11042 | S: Maintained |
| 11047 | 11043 | F: drivers/net/dsa/mt7530.* |
| @@ -12055,6 +12051,7 @@ Q: http://patchwork.ozlabs.org/project/netdev/list/ · 1007 unmodified lines | ||
| 12055 | 12051 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git |
| 12056 | 12052 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git |
| 12057 | 12053 | F: Documentation/devicetree/bindings/net/ |
| 12054 | +F: drivers/connector/ | |
| 12058 | 12055 | F: drivers/net/ |
| 12059 | 12056 | F: include/linux/etherdevice.h |
| 12060 | 12057 | F: include/linux/fcdevice.h |
| @@ -116,7 +116,6 @@ · 115 unmodified lines | ||
| 116 | 116 | switch0: ksz8563@0 { |
| 117 | 117 | compatible = "microchip,ksz8563"; |
| 118 | 118 | reg = <0>; |
| 119 | − phy-mode = "mii"; | |
| 120 | 119 | reset-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_LOW>; |
| 121 | 120 | |
| 122 | 121 | spi-max-frequency = <500000>; |
| @@ -140,6 +139,7 @@ · 17 unmodified lines | ||
| 140 | 139 | reg = <2>; |
| 141 | 140 | label = "cpu"; |
| 142 | 141 | ethernet = <&macb0>; |
| 142 | + phy-mode = "mii"; | |
| 143 | 143 | fixed-link { |
| 144 | 144 | speed = <100>; |
| 145 | 145 | full-duplex; |
| @@ -2224,7 +2224,7 @@ static int eni_init_one(struct pci_dev *pci_dev, · 2223 unmodified lines | ||
| 2224 | 2224 | |
| 2225 | 2225 | rc = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32)); |
| 2226 | 2226 | if (rc < 0) |
| 2227 | − goto out; | |
| 2227 | + goto err_disable; | |
| 2228 | 2228 | |
| 2229 | 2229 | rc = -ENOMEM; |
| 2230 | 2230 | eni_dev = kmalloc(sizeof(struct eni_dev), GFP_KERNEL); |
| @@ -932,11 +932,19 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port) · 931 unmodified lines | ||
| 932 | 932 | ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_ENABLE, true); |
| 933 | 933 | |
| 934 | 934 | if (cpu_port) { |
| 935 | + if (!p->interface && dev->compat_interface) { | |
| 936 | + dev_warn(dev->dev, | |
| 937 | + "Using legacy switch \"phy-mode\" property, because it is missing on port %d node. " | |
| 938 | + "Please update your device tree.\n", | |
| 939 | + port); | |
| 940 | + p->interface = dev->compat_interface; | |
| 941 | + } | |
| 942 | + | |
| 935 | 943 | /* Configure MII interface for proper network communication. */ |
| 936 | 944 | ksz_read8(dev, REG_PORT_5_CTRL_6, &data8); |
| 937 | 945 | data8 &= ~PORT_INTERFACE_TYPE; |
| 938 | 946 | data8 &= ~PORT_GMII_1GPS_MODE; |
| 939 | − switch (dev->interface) { | |
| 947 | + switch (p->interface) { | |
| 940 | 948 | case PHY_INTERFACE_MODE_MII: |
| 941 | 949 | p->phydev.speed = SPEED_100; |
| 942 | 950 | break; |
| @@ -952,11 +960,11 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port) · 9 unmodified lines | ||
| 952 | 960 | default: |
| 953 | 961 | data8 &= ~PORT_RGMII_ID_IN_ENABLE; |
| 954 | 962 | data8 &= ~PORT_RGMII_ID_OUT_ENABLE; |
| 955 | − if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID || | |
| 956 | − dev->interface == PHY_INTERFACE_MODE_RGMII_RXID) | |
| 963 | + if (p->interface == PHY_INTERFACE_MODE_RGMII_ID || | |
| 964 | + p->interface == PHY_INTERFACE_MODE_RGMII_RXID) | |
| 957 | 965 | data8 |= PORT_RGMII_ID_IN_ENABLE; |
| 958 | − if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID || | |
| 959 | − dev->interface == PHY_INTERFACE_MODE_RGMII_TXID) | |
| 966 | + if (p->interface == PHY_INTERFACE_MODE_RGMII_ID || | |
| 967 | + p->interface == PHY_INTERFACE_MODE_RGMII_TXID) | |
| 960 | 968 | data8 |= PORT_RGMII_ID_OUT_ENABLE; |
| 961 | 969 | data8 |= PORT_GMII_1GPS_MODE; |
| 962 | 970 | data8 |= PORT_INTERFACE_RGMII; |
| @@ -1252,7 +1260,7 @@ static int ksz8795_switch_init(struct ksz_device *dev) · 289 unmodified lines | ||
| 1252 | 1260 | } |
| 1253 | 1261 | |
| 1254 | 1262 | /* set the real number of ports */ |
| 1255 | − dev->ds->num_ports = dev->port_cnt; | |
| 1263 | + dev->ds->num_ports = dev->port_cnt + 1; | |
| 1256 | 1264 | |
| 1257 | 1265 | return 0; |
| 1258 | 1266 | } |
| @@ -1208,7 +1208,7 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port) · 1207 unmodified lines | ||
| 1208 | 1208 | |
| 1209 | 1209 | /* configure MAC to 1G & RGMII mode */ |
| 1210 | 1210 | ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8); |
| 1211 | − switch (dev->interface) { | |
| 1211 | + switch (p->interface) { | |
| 1212 | 1212 | case PHY_INTERFACE_MODE_MII: |
| 1213 | 1213 | ksz9477_set_xmii(dev, 0, &data8); |
| 1214 | 1214 | ksz9477_set_gbit(dev, false, &data8); |
| @@ -1229,11 +1229,11 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port) · 14 unmodified lines | ||
| 1229 | 1229 | ksz9477_set_gbit(dev, true, &data8); |
| 1230 | 1230 | data8 &= ~PORT_RGMII_ID_IG_ENABLE; |
| 1231 | 1231 | data8 &= ~PORT_RGMII_ID_EG_ENABLE; |
| 1232 | − if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID || | |
| 1233 | − dev->interface == PHY_INTERFACE_MODE_RGMII_RXID) | |
| 1232 | + if (p->interface == PHY_INTERFACE_MODE_RGMII_ID || | |
| 1233 | + p->interface == PHY_INTERFACE_MODE_RGMII_RXID) | |
| 1234 | 1234 | data8 |= PORT_RGMII_ID_IG_ENABLE; |
| 1235 | − if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID || | |
| 1236 | − dev->interface == PHY_INTERFACE_MODE_RGMII_TXID) | |
| 1235 | + if (p->interface == PHY_INTERFACE_MODE_RGMII_ID || | |
| 1236 | + p->interface == PHY_INTERFACE_MODE_RGMII_TXID) | |
| 1237 | 1237 | data8 |= PORT_RGMII_ID_EG_ENABLE; |
| 1238 | 1238 | p->phydev.speed = SPEED_1000; |
| 1239 | 1239 | break; |
| @@ -1269,23 +1269,32 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds) · 29 unmodified lines | ||
| 1269 | 1269 | dev->cpu_port = i; |
| 1270 | 1270 | dev->host_mask = (1 << dev->cpu_port); |
| 1271 | 1271 | dev->port_mask |= dev->host_mask; |
| 1272 | + p = &dev->ports[i]; | |
| 1272 | 1273 | |
| 1273 | 1274 | /* Read from XMII register to determine host port |
| 1274 | 1275 | * interface. If set specifically in device tree |
| 1275 | 1276 | * note the difference to help debugging. |
| 1276 | 1277 | */ |
| 1277 | 1278 | interface = ksz9477_get_interface(dev, i); |
| 1278 | − if (!dev->interface) | |
| 1279 | − dev->interface = interface; | |
| 1280 | − if (interface && interface != dev->interface) | |
| 1279 | + if (!p->interface) { | |
| 1280 | + if (dev->compat_interface) { | |
| 1281 | + dev_warn(dev->dev, | |
| 1282 | + "Using legacy switch \"phy-mode\" property, because it is missing on port %d node. " | |
| 1283 | + "Please update your device tree.\n", | |
| 1284 | + i); | |
| 1285 | + p->interface = dev->compat_interface; | |
| 1286 | + } else { | |
| 1287 | + p->interface = interface; | |
| 1288 | + } | |
| 1289 | + } | |
| 1290 | + if (interface && interface != p->interface) | |
| 1281 | 1291 | dev_info(dev->dev, |
| 1282 | 1292 | "use %s instead of %s\n", |
| 1283 | − phy_modes(dev->interface), | |
| 1293 | + phy_modes(p->interface), | |
| 1284 | 1294 | phy_modes(interface)); |
| 1285 | 1295 | |
| 1286 | 1296 | /* enable cpu port */ |
| 1287 | 1297 | ksz9477_port_setup(dev, i, true); |
| 1288 | − p = &dev->ports[dev->cpu_port]; | |
| 1289 | 1298 | p->vid_member = dev->port_mask; |
| 1290 | 1299 | p->on = 1; |
| 1291 | 1300 | } |
| @@ -388,6 +388,8 @@ int ksz_switch_register(struct ksz_device *dev, · 387 unmodified lines | ||
| 388 | 388 | const struct ksz_dev_ops *ops) |
| 389 | 389 | { |
| 390 | 390 | phy_interface_t interface; |
| 391 | + struct device_node *port; | |
| 392 | + unsigned int port_num; | |
| 391 | 393 | int ret; |
| 392 | 394 | |
| 393 | 395 | if (dev->pdata) |
| @@ -421,10 +423,19 @@ int ksz_switch_register(struct ksz_device *dev, · 27 unmodified lines | ||
| 421 | 423 | /* Host port interface will be self detected, or specifically set in |
| 422 | 424 | * device tree. |
| 423 | 425 | */ |
| 426 | + for (port_num = 0; port_num < dev->port_cnt; ++port_num) | |
| 427 | + dev->ports[port_num].interface = PHY_INTERFACE_MODE_NA; | |
| 424 | 428 | if (dev->dev->of_node) { |
| 425 | 429 | ret = of_get_phy_mode(dev->dev->of_node, &interface); |
| 426 | 430 | if (ret == 0) |
| 427 | − dev->interface = interface; | |
| 431 | + dev->compat_interface = interface; | |
| 432 | + for_each_available_child_of_node(dev->dev->of_node, port) { | |
| 433 | + if (of_property_read_u32(port, "reg", &port_num)) | |
| 434 | + continue; | |
| 435 | + if (port_num >= dev->port_cnt) | |
| 436 | + return -EINVAL; | |
| 437 | + of_get_phy_mode(port, &dev->ports[port_num].interface); | |
| 438 | + } | |
| 428 | 439 | dev->synclko_125 = of_property_read_bool(dev->dev->of_node, |
| 429 | 440 | "microchip,synclko-125"); |
| 430 | 441 | } |
| @@ -39,6 +39,7 @@ struct ksz_port { · 38 unmodified lines | ||
| 39 | 39 | u32 freeze:1; /* MIB counter freeze is enabled */ |
| 40 | 40 | |
| 41 | 41 | struct ksz_port_mib mib; |
| 42 | + phy_interface_t interface; | |
| 42 | 43 | }; |
| 43 | 44 | |
| 44 | 45 | struct ksz_device { |
| @@ -72,7 +73,7 @@ struct ksz_device { · 27 unmodified lines | ||
| 72 | 73 | int mib_cnt; |
| 73 | 74 | int mib_port_cnt; |
| 74 | 75 | int last_port; /* ports after that not used */ |
| 75 | − phy_interface_t interface; | |
| 76 | + phy_interface_t compat_interface; | |
| 76 | 77 | u32 regs_size; |
| 77 | 78 | bool phy_errata_9477; |
| 78 | 79 | bool synclko_125; |
| @@ -585,7 +585,10 @@ static int felix_setup(struct dsa_switch *ds) · 584 unmodified lines | ||
| 585 | 585 | if (err) |
| 586 | 586 | return err; |
| 587 | 587 | |
| 588 | − ocelot_init(ocelot); | |
| 588 | + err = ocelot_init(ocelot); | |
| 589 | + if (err) | |
| 590 | + return err; | |
| 591 | + | |
| 589 | 592 | if (ocelot->ptp) { |
| 590 | 593 | err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info); |
| 591 | 594 | if (err) { |
| @@ -640,10 +643,13 @@ static void felix_teardown(struct dsa_switch *ds) · 48 unmodified lines | ||
| 640 | 643 | { |
| 641 | 644 | struct ocelot *ocelot = ds->priv; |
| 642 | 645 | struct felix *felix = ocelot_to_felix(ocelot); |
| 646 | + int port; | |
| 643 | 647 | |
| 644 | 648 | if (felix->info->mdio_bus_free) |
| 645 | 649 | felix->info->mdio_bus_free(ocelot); |
| 646 | 650 | |
| 651 | + for (port = 0; port < ocelot->num_phys_ports; port++) | |
| 652 | + ocelot_deinit_port(ocelot, port); | |
| 647 | 653 | ocelot_deinit_timestamp(ocelot); |
| 648 | 654 | /* stop workqueue thread */ |
| 649 | 655 | ocelot_deinit(ocelot); |
| @@ -645,17 +645,17 @@ static struct vcap_field vsc9959_vcap_is2_keys[] = { · 644 unmodified lines | ||
| 645 | 645 | [VCAP_IS2_HK_DIP_EQ_SIP] = {118, 1}, |
| 646 | 646 | /* IP4_TCP_UDP (TYPE=100) */ |
| 647 | 647 | [VCAP_IS2_HK_TCP] = {119, 1}, |
| 648 | − [VCAP_IS2_HK_L4_SPORT] = {120, 16}, | |
| 649 | − [VCAP_IS2_HK_L4_DPORT] = {136, 16}, | |
| 648 | + [VCAP_IS2_HK_L4_DPORT] = {120, 16}, | |
| 649 | + [VCAP_IS2_HK_L4_SPORT] = {136, 16}, | |
| 650 | 650 | [VCAP_IS2_HK_L4_RNG] = {152, 8}, |
| 651 | 651 | [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {160, 1}, |
| 652 | 652 | [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {161, 1}, |
| 653 | − [VCAP_IS2_HK_L4_URG] = {162, 1}, | |
| 654 | − [VCAP_IS2_HK_L4_ACK] = {163, 1}, | |
| 655 | − [VCAP_IS2_HK_L4_PSH] = {164, 1}, | |
| 656 | − [VCAP_IS2_HK_L4_RST] = {165, 1}, | |
| 657 | − [VCAP_IS2_HK_L4_SYN] = {166, 1}, | |
| 658 | − [VCAP_IS2_HK_L4_FIN] = {167, 1}, | |
| 653 | + [VCAP_IS2_HK_L4_FIN] = {162, 1}, | |
| 654 | + [VCAP_IS2_HK_L4_SYN] = {163, 1}, | |
| 655 | + [VCAP_IS2_HK_L4_RST] = {164, 1}, | |
| 656 | + [VCAP_IS2_HK_L4_PSH] = {165, 1}, | |
| 657 | + [VCAP_IS2_HK_L4_ACK] = {166, 1}, | |
| 658 | + [VCAP_IS2_HK_L4_URG] = {167, 1}, | |
| 659 | 659 | [VCAP_IS2_HK_L4_1588_DOM] = {168, 8}, |
| 660 | 660 | [VCAP_IS2_HK_L4_1588_VER] = {176, 4}, |
| 661 | 661 | /* IP4_OTHER (TYPE=101) */ |
| @@ -659,17 +659,17 @@ static struct vcap_field vsc9953_vcap_is2_keys[] = { · 658 unmodified lines | ||
| 659 | 659 | [VCAP_IS2_HK_DIP_EQ_SIP] = {122, 1}, |
| 660 | 660 | /* IP4_TCP_UDP (TYPE=100) */ |
| 661 | 661 | [VCAP_IS2_HK_TCP] = {123, 1}, |
| 662 | − [VCAP_IS2_HK_L4_SPORT] = {124, 16}, | |
| 663 | − [VCAP_IS2_HK_L4_DPORT] = {140, 16}, | |
| 662 | + [VCAP_IS2_HK_L4_DPORT] = {124, 16}, | |
| 663 | + [VCAP_IS2_HK_L4_SPORT] = {140, 16}, | |
| 664 | 664 | [VCAP_IS2_HK_L4_RNG] = {156, 8}, |
| 665 | 665 | [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {164, 1}, |
| 666 | 666 | [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {165, 1}, |
| 667 | − [VCAP_IS2_HK_L4_URG] = {166, 1}, | |
| 668 | − [VCAP_IS2_HK_L4_ACK] = {167, 1}, | |
| 669 | − [VCAP_IS2_HK_L4_PSH] = {168, 1}, | |
| 670 | − [VCAP_IS2_HK_L4_RST] = {169, 1}, | |
| 671 | − [VCAP_IS2_HK_L4_SYN] = {170, 1}, | |
| 672 | − [VCAP_IS2_HK_L4_FIN] = {171, 1}, | |
| 667 | + [VCAP_IS2_HK_L4_FIN] = {166, 1}, | |
| 668 | + [VCAP_IS2_HK_L4_SYN] = {167, 1}, | |
| 669 | + [VCAP_IS2_HK_L4_RST] = {168, 1}, | |
| 670 | + [VCAP_IS2_HK_L4_PSH] = {169, 1}, | |
| 671 | + [VCAP_IS2_HK_L4_ACK] = {170, 1}, | |
| 672 | + [VCAP_IS2_HK_L4_URG] = {171, 1}, | |
| 673 | 673 | /* IP4_OTHER (TYPE=101) */ |
| 674 | 674 | [VCAP_IS2_HK_IP4_L3_PROTO] = {123, 8}, |
| 675 | 675 | [VCAP_IS2_HK_L3_PAYLOAD] = {131, 56}, |
| @@ -1008,7 +1008,7 @@ static const struct felix_info seville_info_vsc9953 = { · 332 unmodified lines | ||
| 1008 | 1008 | .vcap_is2_keys = vsc9953_vcap_is2_keys, |
| 1009 | 1009 | .vcap_is2_actions = vsc9953_vcap_is2_actions, |
| 1010 | 1010 | .vcap = vsc9953_vcap_props, |
| 1011 | − .shared_queue_sz = 128 * 1024, | |
| 1011 | + .shared_queue_sz = 2048 * 1024, | |
| 1012 | 1012 | .num_mact_rows = 2048, |
| 1013 | 1013 | .num_ports = 10, |
| 1014 | 1014 | .mdio_bus_alloc = vsc9953_mdio_bus_alloc, |
| @@ -452,13 +452,19 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port, · 451 unmodified lines | ||
| 452 | 452 | return ret; |
| 453 | 453 | |
| 454 | 454 | if (vid == vlanmc.vid) { |
| 455 | − /* clear VLAN member configurations */ | |
| 456 | − vlanmc.vid = 0; | |
| 457 | − vlanmc.priority = 0; | |
| 458 | − vlanmc.member = 0; | |
| 459 | − vlanmc.untag = 0; | |
| 460 | − vlanmc.fid = 0; | |
| 461 | − | |
| 455 | + /* Remove this port from the VLAN */ | |
| 456 | + vlanmc.member &= ~BIT(port); | |
| 457 | + vlanmc.untag &= ~BIT(port); | |
| 458 | + /* | |
| 459 | + * If no ports are members of this VLAN | |
| 460 | + * anymore then clear the whole member | |
| 461 | + * config so it can be reused. | |
| 462 | + */ | |
| 463 | + if (!vlanmc.member && vlanmc.untag) { | |
| 464 | + vlanmc.vid = 0; | |
| 465 | + vlanmc.priority = 0; | |
| 466 | + vlanmc.fid = 0; | |
| 467 | + } | |
| 462 | 468 | ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); |
| 463 | 469 | if (ret) { |
| 464 | 470 | dev_err(smi->dev, |
| @@ -3782,6 +3782,7 @@ static int bnxt_hwrm_func_qstat_ext(struct bnxt *bp, · 3781 unmodified lines | ||
| 3782 | 3782 | return -EOPNOTSUPP; |
| 3783 | 3783 | |
| 3784 | 3784 | bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QSTATS_EXT, -1, -1); |
| 3785 | + req.fid = cpu_to_le16(0xffff); | |
| 3785 | 3786 | req.flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK; |
| 3786 | 3787 | mutex_lock(&bp->hwrm_cmd_lock); |
| 3787 | 3788 | rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); |
| @@ -3852,7 +3853,7 @@ static void bnxt_init_stats(struct bnxt *bp) · 64 unmodified lines | ||
| 3852 | 3853 | tx_masks = stats->hw_masks; |
| 3853 | 3854 | tx_count = sizeof(struct tx_port_stats_ext) / 8; |
| 3854 | 3855 | |
| 3855 | − flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK; | |
| 3856 | + flags = PORT_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK; | |
| 3856 | 3857 | rc = bnxt_hwrm_port_qstats_ext(bp, flags); |
| 3857 | 3858 | if (rc) { |
| 3858 | 3859 | mask = (1ULL << 40) - 1; |
| @@ -4305,7 +4306,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, · 446 unmodified lines | ||
| 4305 | 4306 | u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM; |
| 4306 | 4307 | u16 dst = BNXT_HWRM_CHNL_CHIMP; |
| 4307 | 4308 | |
| 4308 | − if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state)) | |
| 4309 | + if (BNXT_NO_FW_ACCESS(bp)) | |
| 4309 | 4310 | return -EBUSY; |
| 4310 | 4311 | |
| 4311 | 4312 | if (msg_len > BNXT_HWRM_MAX_REQ_LEN) { |
| @@ -5723,7 +5724,7 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp, · 1411 unmodified lines | ||
| 5723 | 5724 | struct hwrm_ring_free_output *resp = bp->hwrm_cmd_resp_addr; |
| 5724 | 5725 | u16 error_code; |
| 5725 | 5726 | |
| 5726 | − if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state)) | |
| 5727 | + if (BNXT_NO_FW_ACCESS(bp)) | |
| 5727 | 5728 | return 0; |
| 5728 | 5729 | |
| 5729 | 5730 | bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_RING_FREE, cmpl_ring_id, -1); |
| @@ -7817,7 +7818,7 @@ static int bnxt_set_tpa(struct bnxt *bp, bool set_tpa) · 2087 unmodified lines | ||
| 7817 | 7818 | |
| 7818 | 7819 | if (set_tpa) |
| 7819 | 7820 | tpa_flags = bp->flags & BNXT_FLAG_TPA; |
| 7820 | − else if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state)) | |
| 7821 | + else if (BNXT_NO_FW_ACCESS(bp)) | |
| 7821 | 7822 | return 0; |
| 7822 | 7823 | for (i = 0; i < bp->nr_vnics; i++) { |
| 7823 | 7824 | rc = bnxt_hwrm_vnic_set_tpa(bp, i, tpa_flags); |
| @@ -9311,18 +9312,16 @@ static ssize_t bnxt_show_temp(struct device *dev, · 1487 unmodified lines | ||
| 9311 | 9312 | struct hwrm_temp_monitor_query_output *resp; |
| 9312 | 9313 | struct bnxt *bp = dev_get_drvdata(dev); |
| 9313 | 9314 | u32 len = 0; |
| 9315 | + int rc; | |
| 9314 | 9316 | |
| 9315 | 9317 | resp = bp->hwrm_cmd_resp_addr; |
| 9316 | 9318 | bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1); |
| 9317 | 9319 | mutex_lock(&bp->hwrm_cmd_lock); |
| 9318 | − if (!_hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) | |
| 9320 | + rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); | |
| 9321 | + if (!rc) | |
| 9319 | 9322 | len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */ |
| 9320 | 9323 | mutex_unlock(&bp->hwrm_cmd_lock); |
| 9321 | − | |
| 9322 | − if (len) | |
| 9323 | − return len; | |
| 9324 | − | |
| 9325 | − return sprintf(buf, "unknown\n"); | |
| 9324 | + return rc ?: len; | |
| 9326 | 9325 | } |
| 9327 | 9326 | static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0); |
| 9328 | 9327 | |
| @@ -9342,7 +9341,16 @@ static void bnxt_hwmon_close(struct bnxt *bp) · 13 unmodified lines | ||
| 9342 | 9341 | |
| 9343 | 9342 | static void bnxt_hwmon_open(struct bnxt *bp) |
| 9344 | 9343 | { |
| 9344 | + struct hwrm_temp_monitor_query_input req = {0}; | |
| 9345 | 9345 | struct pci_dev *pdev = bp->pdev; |
| 9346 | + int rc; | |
| 9347 | + | |
| 9348 | + bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1); | |
| 9349 | + rc = hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); | |
| 9350 | + if (rc == -EACCES || rc == -EOPNOTSUPP) { | |
| 9351 | + bnxt_hwmon_close(bp); | |
| 9352 | + return; | |
| 9353 | + } | |
| 9346 | 9354 | |
| 9347 | 9355 | if (bp->hwmon_dev) |
| 9348 | 9356 | return; |
| @@ -11779,6 +11787,10 @@ static void bnxt_remove_one(struct pci_dev *pdev) · 2430 unmodified lines | ||
| 11779 | 11787 | if (BNXT_PF(bp)) |
| 11780 | 11788 | bnxt_sriov_disable(bp); |
| 11781 | 11789 | |
| 11790 | + clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); | |
| 11791 | + bnxt_cancel_sp_work(bp); | |
| 11792 | + bp->sp_event = 0; | |
| 11793 | + | |
| 11782 | 11794 | bnxt_dl_fw_reporters_destroy(bp, true); |
| 11783 | 11795 | if (BNXT_PF(bp)) |
| 11784 | 11796 | devlink_port_type_clear(&bp->dl_port); |
| @@ -11786,9 +11798,6 @@ static void bnxt_remove_one(struct pci_dev *pdev) · 1 unmodified line | ||
| 11786 | 11798 | unregister_netdev(dev); |
| 11787 | 11799 | bnxt_dl_unregister(bp); |
| 11788 | 11800 | bnxt_shutdown_tc(bp); |
| 11789 | − clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); | |
| 11790 | − bnxt_cancel_sp_work(bp); | |
| 11791 | − bp->sp_event = 0; | |
| 11792 | 11801 | |
| 11793 | 11802 | bnxt_clear_int_mode(bp); |
| 11794 | 11803 | bnxt_hwrm_func_drv_unrgtr(bp); |
| @@ -12089,7 +12098,7 @@ static int bnxt_init_mac_addr(struct bnxt *bp) · 294 unmodified lines | ||
| 12089 | 12098 | static void bnxt_vpd_read_info(struct bnxt *bp) |
| 12090 | 12099 | { |
| 12091 | 12100 | struct pci_dev *pdev = bp->pdev; |
| 12092 | − int i, len, pos, ro_size; | |
| 12101 | + int i, len, pos, ro_size, size; | |
| 12093 | 12102 | ssize_t vpd_size; |
| 12094 | 12103 | u8 *vpd_data; |
| 12095 | 12104 | |
| @@ -12124,7 +12133,8 @@ static void bnxt_vpd_read_info(struct bnxt *bp) · 28 unmodified lines | ||
| 12124 | 12133 | if (len + pos > vpd_size) |
| 12125 | 12134 | goto read_sn; |
| 12126 | 12135 | |
| 12127 | − strlcpy(bp->board_partno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN)); | |
| 12136 | + size = min(len, BNXT_VPD_FLD_LEN - 1); | |
| 12137 | + memcpy(bp->board_partno, &vpd_data[pos], size); | |
| 12128 | 12138 | |
| 12129 | 12139 | read_sn: |
| 12130 | 12140 | pos = pci_vpd_find_info_keyword(vpd_data, i, ro_size, |
| @@ -12137,7 +12147,8 @@ read_sn: · 6 unmodified lines | ||
| 12137 | 12147 | if (len + pos > vpd_size) |
| 12138 | 12148 | goto exit; |
| 12139 | 12149 | |
| 12140 | − strlcpy(bp->board_serialno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN)); | |
| 12150 | + size = min(len, BNXT_VPD_FLD_LEN - 1); | |
| 12151 | + memcpy(bp->board_serialno, &vpd_data[pos], size); | |
| 12141 | 12152 | exit: |
| 12142 | 12153 | kfree(vpd_data); |
| 12143 | 12154 | } |
| @@ -1737,6 +1737,10 @@ struct bnxt { · 1736 unmodified lines | ||
| 1737 | 1737 | #define BNXT_STATE_FW_FATAL_COND 6 |
| 1738 | 1738 | #define BNXT_STATE_DRV_REGISTERED 7 |
| 1739 | 1739 | |
| 1740 | +#define BNXT_NO_FW_ACCESS(bp) \ | |
| 1741 | + (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) || \ | |
| 1742 | + pci_channel_offline((bp)->pdev)) | |
| 1743 | + | |
| 1740 | 1744 | struct bnxt_irq *irq_tbl; |
| 1741 | 1745 | int total_irqs; |
| 1742 | 1746 | u8 mac_addr[ETH_ALEN]; |
| @@ -1322,6 +1322,9 @@ static int bnxt_get_regs_len(struct net_device *dev) · 1321 unmodified lines | ||
| 1322 | 1322 | struct bnxt *bp = netdev_priv(dev); |
| 1323 | 1323 | int reg_len; |
| 1324 | 1324 | |
| 1325 | + if (!BNXT_PF(bp)) | |
| 1326 | + return -EOPNOTSUPP; | |
| 1327 | + | |
| 1325 | 1328 | reg_len = BNXT_PXP_REG_LEN; |
| 1326 | 1329 | |
| 1327 | 1330 | if (bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED) |
| @@ -1788,9 +1791,12 @@ static int bnxt_set_pauseparam(struct net_device *dev, · 460 unmodified lines | ||
| 1788 | 1791 | if (!BNXT_PHY_CFG_ABLE(bp)) |
| 1789 | 1792 | return -EOPNOTSUPP; |
| 1790 | 1793 | |
| 1794 | + mutex_lock(&bp->link_lock); | |
| 1791 | 1795 | if (epause->autoneg) { |
| 1792 | − if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) | |
| 1793 | − return -EINVAL; | |
| 1796 | + if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) { | |
| 1797 | + rc = -EINVAL; | |
| 1798 | + goto pause_exit; | |
| 1799 | + } | |
| 1794 | 1800 | |
| 1795 | 1801 | link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL; |
| 1796 | 1802 | if (bp->hwrm_spec_code >= 0x10201) |
| @@ -1811,11 +1817,11 @@ static int bnxt_set_pauseparam(struct net_device *dev, · 14 unmodified lines | ||
| 1811 | 1817 | if (epause->tx_pause) |
| 1812 | 1818 | link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX; |
| 1813 | 1819 | |
| 1814 | − if (netif_running(dev)) { | |
| 1815 | − mutex_lock(&bp->link_lock); | |
| 1820 | + if (netif_running(dev)) | |
| 1816 | 1821 | rc = bnxt_hwrm_set_pause(bp); |
| 1817 | − mutex_unlock(&bp->link_lock); | |
| 1818 | − } | |
| 1822 | + | |
| 1823 | +pause_exit: | |
| 1824 | + mutex_unlock(&bp->link_lock); | |
| 1819 | 1825 | return rc; |
| 1820 | 1826 | } |
| 1821 | 1827 | |
| @@ -2552,8 +2558,7 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 730 unmodified lines | ||
| 2552 | 2558 | struct bnxt *bp = netdev_priv(dev); |
| 2553 | 2559 | struct ethtool_eee *eee = &bp->eee; |
| 2554 | 2560 | struct bnxt_link_info *link_info = &bp->link_info; |
| 2555 | − u32 advertising = | |
| 2556 | − _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0); | |
| 2561 | + u32 advertising; | |
| 2557 | 2562 | int rc = 0; |
| 2558 | 2563 | |
| 2559 | 2564 | if (!BNXT_PHY_CFG_ABLE(bp)) |
| @@ -2562,19 +2567,23 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 2 unmodified lines | ||
| 2562 | 2567 | if (!(bp->flags & BNXT_FLAG_EEE_CAP)) |
| 2563 | 2568 | return -EOPNOTSUPP; |
| 2564 | 2569 | |
| 2570 | + mutex_lock(&bp->link_lock); | |
| 2571 | + advertising = _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0); | |
| 2565 | 2572 | if (!edata->eee_enabled) |
| 2566 | 2573 | goto eee_ok; |
| 2567 | 2574 | |
| 2568 | 2575 | if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) { |
| 2569 | 2576 | netdev_warn(dev, "EEE requires autoneg\n"); |
| 2570 | − return -EINVAL; | |
| 2577 | + rc = -EINVAL; | |
| 2578 | + goto eee_exit; | |
| 2571 | 2579 | } |
| 2572 | 2580 | if (edata->tx_lpi_enabled) { |
| 2573 | 2581 | if (bp->lpi_tmr_hi && (edata->tx_lpi_timer > bp->lpi_tmr_hi || |
| 2574 | 2582 | edata->tx_lpi_timer < bp->lpi_tmr_lo)) { |
| 2575 | 2583 | netdev_warn(dev, "Valid LPI timer range is %d and %d microsecs\n", |
| 2576 | 2584 | bp->lpi_tmr_lo, bp->lpi_tmr_hi); |
| 2577 | − return -EINVAL; | |
| 2585 | + rc = -EINVAL; | |
| 2586 | + goto eee_exit; | |
| 2578 | 2587 | } else if (!bp->lpi_tmr_hi) { |
| 2579 | 2588 | edata->tx_lpi_timer = eee->tx_lpi_timer; |
| 2580 | 2589 | } |
| @@ -2584,7 +2593,8 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 3 unmodified lines | ||
| 2584 | 2593 | } else if (edata->advertised & ~advertising) { |
| 2585 | 2594 | netdev_warn(dev, "EEE advertised %x must be a subset of autoneg advertised speeds %x\n", |
| 2586 | 2595 | edata->advertised, advertising); |
| 2587 | − return -EINVAL; | |
| 2596 | + rc = -EINVAL; | |
| 2597 | + goto eee_exit; | |
| 2588 | 2598 | } |
| 2589 | 2599 | |
| 2590 | 2600 | eee->advertised = edata->advertised; |
| @@ -2596,6 +2606,8 @@ eee_ok: · 5 unmodified lines | ||
| 2596 | 2606 | if (netif_running(dev)) |
| 2597 | 2607 | rc = bnxt_hwrm_set_link_setting(bp, false, true); |
| 2598 | 2608 | |
| 2609 | +eee_exit: | |
| 2610 | + mutex_unlock(&bp->link_lock); | |
| 2599 | 2611 | return rc; |
| 2600 | 2612 | } |
| 2601 | 2613 | |
| @@ -647,8 +647,7 @@ static void macb_mac_link_up(struct phylink_config *config, · 646 unmodified lines | ||
| 647 | 647 | ctrl |= GEM_BIT(GBE); |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | − /* We do not support MLO_PAUSE_RX yet */ | |
| 651 | − if (tx_pause) | |
| 650 | + if (rx_pause) | |
| 652 | 651 | ctrl |= MACB_BIT(PAE); |
| 653 | 652 | |
| 654 | 653 | macb_set_tx_clk(bp->tx_clk, speed, ndev); |
| @@ -1911,13 +1911,16 @@ out: · 1910 unmodified lines | ||
| 1911 | 1911 | static int configure_filter_tcb(struct adapter *adap, unsigned int tid, |
| 1912 | 1912 | struct filter_entry *f) |
| 1913 | 1913 | { |
| 1914 | − if (f->fs.hitcnts) | |
| 1914 | + if (f->fs.hitcnts) { | |
| 1915 | 1915 | set_tcb_field(adap, f, tid, TCB_TIMESTAMP_W, |
| 1916 | − TCB_TIMESTAMP_V(TCB_TIMESTAMP_M) | | |
| 1916 | + TCB_TIMESTAMP_V(TCB_TIMESTAMP_M), | |
| 1917 | + TCB_TIMESTAMP_V(0ULL), | |
| 1918 | + 1); | |
| 1919 | + set_tcb_field(adap, f, tid, TCB_RTT_TS_RECENT_AGE_W, | |
| 1917 | 1920 | TCB_RTT_TS_RECENT_AGE_V(TCB_RTT_TS_RECENT_AGE_M), |
| 1918 | − TCB_TIMESTAMP_V(0ULL) | | |
| 1919 | 1921 | TCB_RTT_TS_RECENT_AGE_V(0ULL), |
| 1920 | 1922 | 1); |
| 1923 | + } | |
| 1921 | 1924 | |
| 1922 | 1925 | if (f->fs.newdmac) |
| 1923 | 1926 | set_tcb_tflag(adap, f, tid, TF_CCTRL_ECE_S, 1, |
| @@ -229,7 +229,7 @@ void cxgb4_free_mps_ref_entries(struct adapter *adap) · 228 unmodified lines | ||
| 229 | 229 | { |
| 230 | 230 | struct mps_entries_ref *mps_entry, *tmp; |
| 231 | 231 | |
| 232 | − if (!list_empty(&adap->mps_ref)) | |
| 232 | + if (list_empty(&adap->mps_ref)) | |
| 233 | 233 | return; |
| 234 | 234 | |
| 235 | 235 | spin_lock(&adap->mps_ref_lock); |
| @@ -85,7 +85,7 @@ MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copi · 84 unmodified lines | ||
| 85 | 85 | #define DSL CONFIG_DE2104X_DSL |
| 86 | 86 | #endif |
| 87 | 87 | |
| 88 | −#define DE_RX_RING_SIZE 64 | |
| 88 | +#define DE_RX_RING_SIZE 128 | |
| 89 | 89 | #define DE_TX_RING_SIZE 64 |
| 90 | 90 | #define DE_RING_BYTES \ |
| 91 | 91 | ((sizeof(struct de_desc) * DE_RX_RING_SIZE) + \ |
| @@ -66,8 +66,8 @@ struct dpmac_cmd_get_counter { · 65 unmodified lines | ||
| 66 | 66 | }; |
| 67 | 67 | |
| 68 | 68 | struct dpmac_rsp_get_counter { |
| 69 | − u64 pad; | |
| 70 | − u64 counter; | |
| 69 | + __le64 pad; | |
| 70 | + __le64 counter; | |
| 71 | 71 | }; |
| 72 | 72 | |
| 73 | 73 | #endif /* _FSL_DPMAC_CMD_H */ |
| @@ -1053,7 +1053,6 @@ static int enetc_pf_probe(struct pci_dev *pdev, · 1052 unmodified lines | ||
| 1053 | 1053 | |
| 1054 | 1054 | err_reg_netdev: |
| 1055 | 1055 | enetc_teardown_serdes(priv); |
| 1056 | − enetc_mdio_remove(pf); | |
| 1057 | 1056 | enetc_free_msix(priv); |
| 1058 | 1057 | err_alloc_msix: |
| 1059 | 1058 | enetc_free_si_resources(priv); |
| @@ -1061,6 +1060,7 @@ err_alloc_si_res: · 1 unmodified line | ||
| 1061 | 1060 | si->ndev = NULL; |
| 1062 | 1061 | free_netdev(ndev); |
| 1063 | 1062 | err_alloc_netdev: |
| 1063 | + enetc_mdio_remove(pf); | |
| 1064 | 1064 | enetc_of_put_phy(pf); |
| 1065 | 1065 | err_map_pf_space: |
| 1066 | 1066 | enetc_pci_remove(pdev); |
| @@ -334,7 +334,7 @@ static void hns_dsaf_xge_srst_by_port_acpi(struct dsaf_device *dsaf_dev, · 333 unmodified lines | ||
| 334 | 334 | * bit6-11 for ppe0-5 |
| 335 | 335 | * bit12-17 for roce0-5 |
| 336 | 336 | * bit18-19 for com/dfx |
| 337 | − * @enable: false - request reset , true - drop reset | |
| 337 | + * @dereset: false - request reset , true - drop reset | |
| 338 | 338 | */ |
| 339 | 339 | static void |
| 340 | 340 | hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool dereset) |
| @@ -357,7 +357,7 @@ hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool dereset) · 16 unmodified lines | ||
| 357 | 357 | * bit6-11 for ppe0-5 |
| 358 | 358 | * bit12-17 for roce0-5 |
| 359 | 359 | * bit18-19 for com/dfx |
| 360 | − * @enable: false - request reset , true - drop reset | |
| 360 | + * @dereset: false - request reset , true - drop reset | |
| 361 | 361 | */ |
| 362 | 362 | static void |
| 363 | 363 | hns_dsaf_srst_chns_acpi(struct dsaf_device *dsaf_dev, u32 msk, bool dereset) |
| @@ -463,8 +463,8 @@ static int __lb_clean_rings(struct hns_nic_priv *priv, · 462 unmodified lines | ||
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | 465 | * nic_run_loopback_test - run loopback test |
| 466 | − * @nic_dev: net device | |
| 467 | − * @loopback_type: loopback type | |
| 466 | + * @ndev: net device | |
| 467 | + * @loop_mode: loopback mode | |
| 468 | 468 | */ |
| 469 | 469 | static int __lb_run_test(struct net_device *ndev, |
| 470 | 470 | enum hnae_loop loop_mode) |
| @@ -572,7 +572,7 @@ static int __lb_down(struct net_device *ndev, enum hnae_loop loop) · 101 unmodified lines | ||
| 572 | 572 | |
| 573 | 573 | /** |
| 574 | 574 | * hns_nic_self_test - self test |
| 575 | − * @dev: net device | |
| 575 | + * @ndev: net device | |
| 576 | 576 | * @eth_test: test cmd |
| 577 | 577 | * @data: test result |
| 578 | 578 | */ |
| @@ -633,7 +633,7 @@ static void hns_nic_self_test(struct net_device *ndev, · 54 unmodified lines | ||
| 633 | 633 | |
| 634 | 634 | /** |
| 635 | 635 | * hns_nic_get_drvinfo - get net driver info |
| 636 | − * @dev: net device | |
| 636 | + * @net_dev: net device | |
| 637 | 637 | * @drvinfo: driver info |
| 638 | 638 | */ |
| 639 | 639 | static void hns_nic_get_drvinfo(struct net_device *net_dev, |
| @@ -658,7 +658,7 @@ static void hns_nic_get_drvinfo(struct net_device *net_dev, · 18 unmodified lines | ||
| 658 | 658 | |
| 659 | 659 | /** |
| 660 | 660 | * hns_get_ringparam - get ring parameter |
| 661 | − * @dev: net device | |
| 661 | + * @net_dev: net device | |
| 662 | 662 | * @param: ethtool parameter |
| 663 | 663 | */ |
| 664 | 664 | static void hns_get_ringparam(struct net_device *net_dev, |
| @@ -683,7 +683,7 @@ static void hns_get_ringparam(struct net_device *net_dev, · 18 unmodified lines | ||
| 683 | 683 | |
| 684 | 684 | /** |
| 685 | 685 | * hns_get_pauseparam - get pause parameter |
| 686 | − * @dev: net device | |
| 686 | + * @net_dev: net device | |
| 687 | 687 | * @param: pause parameter |
| 688 | 688 | */ |
| 689 | 689 | static void hns_get_pauseparam(struct net_device *net_dev, |
| @@ -701,7 +701,7 @@ static void hns_get_pauseparam(struct net_device *net_dev, · 11 unmodified lines | ||
| 701 | 701 | |
| 702 | 702 | /** |
| 703 | 703 | * hns_set_pauseparam - set pause parameter |
| 704 | − * @dev: net device | |
| 704 | + * @net_dev: net device | |
| 705 | 705 | * @param: pause parameter |
| 706 | 706 | * |
| 707 | 707 | * Return 0 on success, negative on failure |
| @@ -725,7 +725,7 @@ static int hns_set_pauseparam(struct net_device *net_dev, · 17 unmodified lines | ||
| 725 | 725 | |
| 726 | 726 | /** |
| 727 | 727 | * hns_get_coalesce - get coalesce info. |
| 728 | − * @dev: net device | |
| 728 | + * @net_dev: net device | |
| 729 | 729 | * @ec: coalesce info. |
| 730 | 730 | * |
| 731 | 731 | * Return 0 on success, negative on failure. |
| @@ -769,7 +769,7 @@ static int hns_get_coalesce(struct net_device *net_dev, · 37 unmodified lines | ||
| 769 | 769 | |
| 770 | 770 | /** |
| 771 | 771 | * hns_set_coalesce - set coalesce info. |
| 772 | − * @dev: net device | |
| 772 | + * @net_dev: net device | |
| 773 | 773 | * @ec: coalesce info. |
| 774 | 774 | * |
| 775 | 775 | * Return 0 on success, negative on failure. |
| @@ -808,7 +808,7 @@ static int hns_set_coalesce(struct net_device *net_dev, · 32 unmodified lines | ||
| 808 | 808 | |
| 809 | 809 | /** |
| 810 | 810 | * hns_get_channels - get channel info. |
| 811 | − * @dev: net device | |
| 811 | + * @net_dev: net device | |
| 812 | 812 | * @ch: channel info. |
| 813 | 813 | */ |
| 814 | 814 | static void |
| @@ -825,7 +825,7 @@ hns_get_channels(struct net_device *net_dev, struct ethtool_channels *ch) · 10 unmodified lines | ||
| 825 | 825 | |
| 826 | 826 | /** |
| 827 | 827 | * get_ethtool_stats - get detail statistics. |
| 828 | − * @dev: net device | |
| 828 | + * @netdev: net device | |
| 829 | 829 | * @stats: statistics info. |
| 830 | 830 | * @data: statistics data. |
| 831 | 831 | */ |
| @@ -883,8 +883,8 @@ static void hns_get_ethtool_stats(struct net_device *netdev, · 51 unmodified lines | ||
| 883 | 883 | |
| 884 | 884 | /** |
| 885 | 885 | * get_strings: Return a set of strings that describe the requested objects |
| 886 | − * @dev: net device | |
| 887 | − * @stats: string set ID. | |
| 886 | + * @netdev: net device | |
| 887 | + * @stringset: string set ID. | |
| 888 | 888 | * @data: objects data. |
| 889 | 889 | */ |
| 890 | 890 | static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data) |
| @@ -972,7 +972,7 @@ static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data) · 81 unmodified lines | ||
| 972 | 972 | |
| 973 | 973 | /** |
| 974 | 974 | * nic_get_sset_count - get string set count witch returned by nic_get_strings. |
| 975 | − * @dev: net device | |
| 975 | + * @netdev: net device | |
| 976 | 976 | * @stringset: string set index, 0: self test string; 1: statistics string. |
| 977 | 977 | * |
| 978 | 978 | * Return string set count. |
| @@ -1006,7 +1006,7 @@ static int hns_get_sset_count(struct net_device *netdev, int stringset) · 27 unmodified lines | ||
| 1006 | 1006 | |
| 1007 | 1007 | /** |
| 1008 | 1008 | * hns_phy_led_set - set phy LED status. |
| 1009 | − * @dev: net device | |
| 1009 | + * @netdev: net device | |
| 1010 | 1010 | * @value: LED state. |
| 1011 | 1011 | * |
| 1012 | 1012 | * Return 0 on success, negative on failure. |
| @@ -1028,7 +1028,7 @@ static int hns_phy_led_set(struct net_device *netdev, int value) · 15 unmodified lines | ||
| 1028 | 1028 | |
| 1029 | 1029 | /** |
| 1030 | 1030 | * nic_set_phys_id - set phy identify LED. |
| 1031 | − * @dev: net device | |
| 1031 | + * @netdev: net device | |
| 1032 | 1032 | * @state: LED state. |
| 1033 | 1033 | * |
| 1034 | 1034 | * Return 0 on success, negative on failure. |
| @@ -1104,9 +1104,9 @@ hns_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state) · 69 unmodified lines | ||
| 1104 | 1104 | |
| 1105 | 1105 | /** |
| 1106 | 1106 | * hns_get_regs - get net device register |
| 1107 | − * @dev: net device | |
| 1107 | + * @net_dev: net device | |
| 1108 | 1108 | * @cmd: ethtool cmd |
| 1109 | − * @date: register data | |
| 1109 | + * @data: register data | |
| 1110 | 1110 | */ |
| 1111 | 1111 | static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd, |
| 1112 | 1112 | void *data) |
| @@ -1126,7 +1126,7 @@ static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd, · 13 unmodified lines | ||
| 1126 | 1126 | |
| 1127 | 1127 | /** |
| 1128 | 1128 | * nic_get_regs_len - get total register len. |
| 1129 | − * @dev: net device | |
| 1129 | + * @net_dev: net device | |
| 1130 | 1130 | * |
| 1131 | 1131 | * Return total register len. |
| 1132 | 1132 | */ |
| @@ -1151,7 +1151,7 @@ static int hns_get_regs_len(struct net_device *net_dev) · 18 unmodified lines | ||
| 1151 | 1151 | |
| 1152 | 1152 | /** |
| 1153 | 1153 | * hns_nic_nway_reset - nway reset |
| 1154 | − * @dev: net device | |
| 1154 | + * @netdev: net device | |
| 1155 | 1155 | * |
| 1156 | 1156 | * Return 0 on success, negative on failure |
| 1157 | 1157 | */ |
| @@ -1654,6 +1654,7 @@ static void hinic_diag_test(struct net_device *netdev, · 1653 unmodified lines | ||
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | 1656 | netif_carrier_off(netdev); |
| 1657 | + netif_tx_disable(netdev); | |
| 1657 | 1658 | |
| 1658 | 1659 | err = do_lp_test(nic_dev, eth_test->flags, LP_DEFAULT_TIME, |
| 1659 | 1660 | &test_index); |
| @@ -1662,9 +1663,12 @@ static void hinic_diag_test(struct net_device *netdev, · 2 unmodified lines | ||
| 1662 | 1663 | data[test_index] = 1; |
| 1663 | 1664 | } |
| 1664 | 1665 | |
| 1666 | + netif_tx_wake_all_queues(netdev); | |
| 1667 | + | |
| 1665 | 1668 | err = hinic_port_link_state(nic_dev, &link_state); |
| 1666 | 1669 | if (!err && link_state == HINIC_LINK_STATE_UP) |
| 1667 | 1670 | netif_carrier_on(netdev); |
| 1671 | + | |
| 1668 | 1672 | } |
| 1669 | 1673 | |
| 1670 | 1674 | static int hinic_set_phys_id(struct net_device *netdev, |
| @@ -47,8 +47,12 @@ · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | #define MGMT_MSG_TIMEOUT 5000 |
| 49 | 49 | |
| 50 | +#define SET_FUNC_PORT_MBOX_TIMEOUT 30000 | |
| 51 | + | |
| 50 | 52 | #define SET_FUNC_PORT_MGMT_TIMEOUT 25000 |
| 51 | 53 | |
| 54 | +#define UPDATE_FW_MGMT_TIMEOUT 20000 | |
| 55 | + | |
| 52 | 56 | #define mgmt_to_pfhwdev(pf_mgmt) \ |
| 53 | 57 | container_of(pf_mgmt, struct hinic_pfhwdev, pf_to_mgmt) |
| 54 | 58 | |
| @@ -361,16 +365,22 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt, · 306 unmodified lines | ||
| 361 | 365 | return -EINVAL; |
| 362 | 366 | } |
| 363 | 367 | |
| 364 | − if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE) | |
| 365 | − timeout = SET_FUNC_PORT_MGMT_TIMEOUT; | |
| 368 | + if (HINIC_IS_VF(hwif)) { | |
| 369 | + if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE) | |
| 370 | + timeout = SET_FUNC_PORT_MBOX_TIMEOUT; | |
| 366 | 371 | |
| 367 | − if (HINIC_IS_VF(hwif)) | |
| 368 | 372 | return hinic_mbox_to_pf(pf_to_mgmt->hwdev, mod, cmd, buf_in, |
| 369 | − in_size, buf_out, out_size, 0); | |
| 370 | − else | |
| 373 | + in_size, buf_out, out_size, timeout); | |
| 374 | + } else { | |
| 375 | + if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE) | |
| 376 | + timeout = SET_FUNC_PORT_MGMT_TIMEOUT; | |
| 377 | + else if (cmd == HINIC_PORT_CMD_UPDATE_FW) | |
| 378 | + timeout = UPDATE_FW_MGMT_TIMEOUT; | |
| 379 | + | |
| 371 | 380 | return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size, |
| 372 | 381 | buf_out, out_size, MGMT_DIRECT_SEND, |
| 373 | 382 | MSG_NOT_RESP, timeout); |
| 383 | + } | |
| 374 | 384 | } |
| 375 | 385 | |
| 376 | 386 | static void recv_mgmt_msg_work_handler(struct work_struct *work) |
| @@ -174,6 +174,24 @@ err_init_txq: · 173 unmodified lines | ||
| 174 | 174 | return err; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | +static void enable_txqs_napi(struct hinic_dev *nic_dev) | |
| 178 | +{ | |
| 179 | + int num_txqs = hinic_hwdev_num_qps(nic_dev->hwdev); | |
| 180 | + int i; | |
| 181 | + | |
| 182 | + for (i = 0; i < num_txqs; i++) | |
| 183 | + napi_enable(&nic_dev->txqs[i].napi); | |
| 184 | +} | |
| 185 | + | |
| 186 | +static void disable_txqs_napi(struct hinic_dev *nic_dev) | |
| 187 | +{ | |
| 188 | + int num_txqs = hinic_hwdev_num_qps(nic_dev->hwdev); | |
| 189 | + int i; | |
| 190 | + | |
| 191 | + for (i = 0; i < num_txqs; i++) | |
| 192 | + napi_disable(&nic_dev->txqs[i].napi); | |
| 193 | +} | |
| 194 | + | |
| 177 | 195 | /** |
| 178 | 196 | * free_txqs - Free the Logical Tx Queues of specific NIC device |
| 179 | 197 | * @nic_dev: the specific NIC device |
| @@ -400,6 +418,8 @@ int hinic_open(struct net_device *netdev) · 220 unmodified lines | ||
| 400 | 418 | goto err_create_txqs; |
| 401 | 419 | } |
| 402 | 420 | |
| 421 | + enable_txqs_napi(nic_dev); | |
| 422 | + | |
| 403 | 423 | err = create_rxqs(nic_dev); |
| 404 | 424 | if (err) { |
| 405 | 425 | netif_err(nic_dev, drv, netdev, |
| @@ -484,6 +504,7 @@ err_port_state: · 78 unmodified lines | ||
| 484 | 504 | } |
| 485 | 505 | |
| 486 | 506 | err_create_rxqs: |
| 507 | + disable_txqs_napi(nic_dev); | |
| 487 | 508 | free_txqs(nic_dev); |
| 488 | 509 | |
| 489 | 510 | err_create_txqs: |
| @@ -497,6 +518,9 @@ int hinic_close(struct net_device *netdev) · 7 unmodified lines | ||
| 497 | 518 | struct hinic_dev *nic_dev = netdev_priv(netdev); |
| 498 | 519 | unsigned int flags; |
| 499 | 520 | |
| 521 | + /* Disable txq napi firstly to aviod rewaking txq in free_tx_poll */ | |
| 522 | + disable_txqs_napi(nic_dev); | |
| 523 | + | |
| 500 | 524 | down(&nic_dev->mgmt_lock); |
| 501 | 525 | |
| 502 | 526 | flags = nic_dev->flags; |
| @@ -543,18 +543,25 @@ static int rx_request_irq(struct hinic_rxq *rxq) · 542 unmodified lines | ||
| 543 | 543 | if (err) { |
| 544 | 544 | netif_err(nic_dev, drv, rxq->netdev, |
| 545 | 545 | "Failed to set RX interrupt coalescing attribute\n"); |
| 546 | − rx_del_napi(rxq); | |
| 547 | − return err; | |
| 546 | + goto err_req_irq; | |
| 548 | 547 | } |
| 549 | 548 | |
| 550 | 549 | err = request_irq(rq->irq, rx_irq, 0, rxq->irq_name, rxq); |
| 551 | − if (err) { | |
| 552 | − rx_del_napi(rxq); | |
| 553 | − return err; | |
| 554 | − } | |
| 550 | + if (err) | |
| 551 | + goto err_req_irq; | |
| 555 | 552 | |
| 556 | 553 | cpumask_set_cpu(qp->q_id % num_online_cpus(), &rq->affinity_mask); |
| 557 | − return irq_set_affinity_hint(rq->irq, &rq->affinity_mask); | |
| 554 | + err = irq_set_affinity_hint(rq->irq, &rq->affinity_mask); | |
| 555 | + if (err) | |
| 556 | + goto err_irq_affinity; | |
| 557 | + | |
| 558 | + return 0; | |
| 559 | + | |
| 560 | +err_irq_affinity: | |
| 561 | + free_irq(rq->irq, rxq); | |
| 562 | +err_req_irq: | |
| 563 | + rx_del_napi(rxq); | |
| 564 | + return err; | |
| 558 | 565 | } |
| 559 | 566 | |
| 560 | 567 | static void rx_free_irq(struct hinic_rxq *rxq) |
| @@ -717,8 +717,8 @@ static int free_tx_poll(struct napi_struct *napi, int budget) · 716 unmodified lines | ||
| 717 | 717 | netdev_txq = netdev_get_tx_queue(txq->netdev, qp->q_id); |
| 718 | 718 | |
| 719 | 719 | __netif_tx_lock(netdev_txq, smp_processor_id()); |
| 720 | − | |
| 721 | − netif_wake_subqueue(nic_dev->netdev, qp->q_id); | |
| 720 | + if (!netif_testing(nic_dev->netdev)) | |
| 721 | + netif_wake_subqueue(nic_dev->netdev, qp->q_id); | |
| 722 | 722 | |
| 723 | 723 | __netif_tx_unlock(netdev_txq); |
| 724 | 724 | |
| @@ -745,18 +745,6 @@ static int free_tx_poll(struct napi_struct *napi, int budget) · 20 unmodified lines | ||
| 745 | 745 | return budget; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | −static void tx_napi_add(struct hinic_txq *txq, int weight) | |
| 749 | −{ | |
| 750 | − netif_napi_add(txq->netdev, &txq->napi, free_tx_poll, weight); | |
| 751 | − napi_enable(&txq->napi); | |
| 752 | −} | |
| 753 | − | |
| 754 | −static void tx_napi_del(struct hinic_txq *txq) | |
| 755 | −{ | |
| 756 | − napi_disable(&txq->napi); | |
| 757 | − netif_napi_del(&txq->napi); | |
| 758 | −} | |
| 759 | − | |
| 760 | 748 | static irqreturn_t tx_irq(int irq, void *data) |
| 761 | 749 | { |
| 762 | 750 | struct hinic_txq *txq = data; |
| @@ -790,7 +778,7 @@ static int tx_request_irq(struct hinic_txq *txq) · 27 unmodified lines | ||
| 790 | 778 | |
| 791 | 779 | qp = container_of(sq, struct hinic_qp, sq); |
| 792 | 780 | |
| 793 | − tx_napi_add(txq, nic_dev->tx_weight); | |
| 781 | + netif_napi_add(txq->netdev, &txq->napi, free_tx_poll, nic_dev->tx_weight); | |
| 794 | 782 | |
| 795 | 783 | hinic_hwdev_msix_set(nic_dev->hwdev, sq->msix_entry, |
| 796 | 784 | TX_IRQ_NO_PENDING, TX_IRQ_NO_COALESC, |
| @@ -807,14 +795,14 @@ static int tx_request_irq(struct hinic_txq *txq) · 10 unmodified lines | ||
| 807 | 795 | if (err) { |
| 808 | 796 | netif_err(nic_dev, drv, txq->netdev, |
| 809 | 797 | "Failed to set TX interrupt coalescing attribute\n"); |
| 810 | − tx_napi_del(txq); | |
| 798 | + netif_napi_del(&txq->napi); | |
| 811 | 799 | return err; |
| 812 | 800 | } |
| 813 | 801 | |
| 814 | 802 | err = request_irq(sq->irq, tx_irq, 0, txq->irq_name, txq); |
| 815 | 803 | if (err) { |
| 816 | 804 | dev_err(&pdev->dev, "Failed to request Tx irq\n"); |
| 817 | − tx_napi_del(txq); | |
| 805 | + netif_napi_del(&txq->napi); | |
| 818 | 806 | return err; |
| 819 | 807 | } |
| 820 | 808 | |
| @@ -826,7 +814,7 @@ static void tx_free_irq(struct hinic_txq *txq) · 5 unmodified lines | ||
| 826 | 814 | struct hinic_sq *sq = txq->sq; |
| 827 | 815 | |
| 828 | 816 | free_irq(sq->irq, txq); |
| 829 | − tx_napi_del(txq); | |
| 817 | + netif_napi_del(&txq->napi); | |
| 830 | 818 | } |
| 831 | 819 | |
| 832 | 820 | /** |
| @@ -2032,16 +2032,18 @@ static int do_reset(struct ibmvnic_adapter *adapter, · 2031 unmodified lines | ||
| 2032 | 2032 | |
| 2033 | 2033 | } else { |
| 2034 | 2034 | rc = reset_tx_pools(adapter); |
| 2035 | − if (rc) | |
| 2035 | + if (rc) { | |
| 2036 | 2036 | netdev_dbg(adapter->netdev, "reset tx pools failed (%d)\n", |
| 2037 | 2037 | rc); |
| 2038 | 2038 | goto out; |
| 2039 | + } | |
| 2039 | 2040 | |
| 2040 | 2041 | rc = reset_rx_pools(adapter); |
| 2041 | − if (rc) | |
| 2042 | + if (rc) { | |
| 2042 | 2043 | netdev_dbg(adapter->netdev, "reset rx pools failed (%d)\n", |
| 2043 | 2044 | rc); |
| 2044 | 2045 | goto out; |
| 2046 | + } | |
| 2045 | 2047 | } |
| 2046 | 2048 | ibmvnic_disable_irqs(adapter); |
| 2047 | 2049 | } |
| @@ -1115,7 +1115,7 @@ static int i40e_quiesce_vf_pci(struct i40e_vf *vf) · 1114 unmodified lines | ||
| 1115 | 1115 | static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi) |
| 1116 | 1116 | { |
| 1117 | 1117 | struct i40e_mac_filter *f; |
| 1118 | − int num_vlans = 0, bkt; | |
| 1118 | + u16 num_vlans = 0, bkt; | |
| 1119 | 1119 | |
| 1120 | 1120 | hash_for_each(vsi->mac_filter_hash, bkt, f, hlist) { |
| 1121 | 1121 | if (f->vlan >= 0 && f->vlan <= I40E_MAX_VLANID) |
| @@ -1134,8 +1134,8 @@ static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi) · 12 unmodified lines | ||
| 1134 | 1134 | * |
| 1135 | 1135 | * Called to get number of VLANs and VLAN list present in mac_filter_hash. |
| 1136 | 1136 | **/ |
| 1137 | −static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, int *num_vlans, | |
| 1138 | − s16 **vlan_list) | |
| 1137 | +static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, u16 *num_vlans, | |
| 1138 | + s16 **vlan_list) | |
| 1139 | 1139 | { |
| 1140 | 1140 | struct i40e_mac_filter *f; |
| 1141 | 1141 | int i = 0; |
| @@ -1169,11 +1169,11 @@ err: · 27 unmodified lines | ||
| 1169 | 1169 | **/ |
| 1170 | 1170 | static i40e_status |
| 1171 | 1171 | i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, |
| 1172 | − bool unicast_enable, s16 *vl, int num_vlans) | |
| 1172 | + bool unicast_enable, s16 *vl, u16 num_vlans) | |
| 1173 | 1173 | { |
| 1174 | + i40e_status aq_ret, aq_tmp = 0; | |
| 1174 | 1175 | struct i40e_pf *pf = vf->pf; |
| 1175 | 1176 | struct i40e_hw *hw = &pf->hw; |
| 1176 | − i40e_status aq_ret; | |
| 1177 | 1177 | int i; |
| 1178 | 1178 | |
| 1179 | 1179 | /* No VLAN to set promisc on, set on VSI */ |
| @@ -1222,6 +1222,9 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, · 42 unmodified lines | ||
| 1222 | 1222 | vf->vf_id, |
| 1223 | 1223 | i40e_stat_str(&pf->hw, aq_ret), |
| 1224 | 1224 | i40e_aq_str(&pf->hw, aq_err)); |
| 1225 | + | |
| 1226 | + if (!aq_tmp) | |
| 1227 | + aq_tmp = aq_ret; | |
| 1225 | 1228 | } |
| 1226 | 1229 | |
| 1227 | 1230 | aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, seid, |
| @@ -1235,8 +1238,15 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, · 7 unmodified lines | ||
| 1235 | 1238 | vf->vf_id, |
| 1236 | 1239 | i40e_stat_str(&pf->hw, aq_ret), |
| 1237 | 1240 | i40e_aq_str(&pf->hw, aq_err)); |
| 1241 | + | |
| 1242 | + if (!aq_tmp) | |
| 1243 | + aq_tmp = aq_ret; | |
| 1238 | 1244 | } |
| 1239 | 1245 | } |
| 1246 | + | |
| 1247 | + if (aq_tmp) | |
| 1248 | + aq_ret = aq_tmp; | |
| 1249 | + | |
| 1240 | 1250 | return aq_ret; |
| 1241 | 1251 | } |
| 1242 | 1252 | |
| @@ -1258,7 +1268,7 @@ static i40e_status i40e_config_vf_promiscuous_mode(struct i40e_vf *vf, · 15 unmodified lines | ||
| 1258 | 1268 | i40e_status aq_ret = I40E_SUCCESS; |
| 1259 | 1269 | struct i40e_pf *pf = vf->pf; |
| 1260 | 1270 | struct i40e_vsi *vsi; |
| 1261 | − int num_vlans; | |
| 1271 | + u16 num_vlans; | |
| 1262 | 1272 | s16 *vl; |
| 1263 | 1273 | |
| 1264 | 1274 | vsi = i40e_find_vsi_from_id(pf, vsi_id); |
| @@ -299,18 +299,14 @@ extern char igc_driver_name[]; · 298 unmodified lines | ||
| 299 | 299 | #define IGC_RX_HDR_LEN IGC_RXBUFFER_256 |
| 300 | 300 | |
| 301 | 301 | /* Transmit and receive latency (for PTP timestamps) */ |
| 302 | −/* FIXME: These values were estimated using the ones that i225 has as | |
| 303 | − * basis, they seem to provide good numbers with ptp4l/phc2sys, but we | |
| 304 | − * need to confirm them. | |
| 305 | − */ | |
| 306 | −#define IGC_I225_TX_LATENCY_10 9542 | |
| 307 | −#define IGC_I225_TX_LATENCY_100 1024 | |
| 308 | −#define IGC_I225_TX_LATENCY_1000 178 | |
| 309 | −#define IGC_I225_TX_LATENCY_2500 64 | |
| 310 | −#define IGC_I225_RX_LATENCY_10 20662 | |
| 311 | −#define IGC_I225_RX_LATENCY_100 2213 | |
| 312 | −#define IGC_I225_RX_LATENCY_1000 448 | |
| 313 | −#define IGC_I225_RX_LATENCY_2500 160 | |
| 302 | +#define IGC_I225_TX_LATENCY_10 240 | |
| 303 | +#define IGC_I225_TX_LATENCY_100 58 | |
| 304 | +#define IGC_I225_TX_LATENCY_1000 80 | |
| 305 | +#define IGC_I225_TX_LATENCY_2500 1325 | |
| 306 | +#define IGC_I225_RX_LATENCY_10 6450 | |
| 307 | +#define IGC_I225_RX_LATENCY_100 185 | |
| 308 | +#define IGC_I225_RX_LATENCY_1000 300 | |
| 309 | +#define IGC_I225_RX_LATENCY_2500 1485 | |
| 314 | 310 | |
| 315 | 311 | /* RX and TX descriptor control thresholds. |
| 316 | 312 | * PTHRESH - MAC will consider prefetch if it has fewer than this number of |
| @@ -364,6 +364,7 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter) · 363 unmodified lines | ||
| 364 | 364 | struct sk_buff *skb = adapter->ptp_tx_skb; |
| 365 | 365 | struct skb_shared_hwtstamps shhwtstamps; |
| 366 | 366 | struct igc_hw *hw = &adapter->hw; |
| 367 | + int adjust = 0; | |
| 367 | 368 | u64 regval; |
| 368 | 369 | |
| 369 | 370 | if (WARN_ON_ONCE(!skb)) |
| @@ -373,6 +374,24 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter) · 3 unmodified lines | ||
| 373 | 374 | regval |= (u64)rd32(IGC_TXSTMPH) << 32; |
| 374 | 375 | igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval); |
| 375 | 376 | |
| 377 | + switch (adapter->link_speed) { | |
| 378 | + case SPEED_10: | |
| 379 | + adjust = IGC_I225_TX_LATENCY_10; | |
| 380 | + break; | |
| 381 | + case SPEED_100: | |
| 382 | + adjust = IGC_I225_TX_LATENCY_100; | |
| 383 | + break; | |
| 384 | + case SPEED_1000: | |
| 385 | + adjust = IGC_I225_TX_LATENCY_1000; | |
| 386 | + break; | |
| 387 | + case SPEED_2500: | |
| 388 | + adjust = IGC_I225_TX_LATENCY_2500; | |
| 389 | + break; | |
| 390 | + } | |
| 391 | + | |
| 392 | + shhwtstamps.hwtstamp = | |
| 393 | + ktime_add_ns(shhwtstamps.hwtstamp, adjust); | |
| 394 | + | |
| 376 | 395 | /* Clear the lock early before calling skb_tstamp_tx so that |
| 377 | 396 | * applications are not woken up before the lock bit is clear. We use |
| 378 | 397 | * a copy of the skb pointer to ensure other threads can't change it |
| @@ -230,8 +230,8 @@ static int xrx200_poll_rx(struct napi_struct *napi, int budget) · 229 unmodified lines | ||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (rx < budget) { |
| 233 | − napi_complete(&ch->napi); | |
| 234 | − ltq_dma_enable_irq(&ch->dma); | |
| 233 | + if (napi_complete_done(&ch->napi, rx)) | |
| 234 | + ltq_dma_enable_irq(&ch->dma); | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | return rx; |
| @@ -268,9 +268,12 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget) · 30 unmodified lines | ||
| 268 | 268 | net_dev->stats.tx_bytes += bytes; |
| 269 | 269 | netdev_completed_queue(ch->priv->net_dev, pkts, bytes); |
| 270 | 270 | |
| 271 | + if (netif_queue_stopped(net_dev)) | |
| 272 | + netif_wake_queue(net_dev); | |
| 273 | + | |
| 271 | 274 | if (pkts < budget) { |
| 272 | − napi_complete(&ch->napi); | |
| 273 | − ltq_dma_enable_irq(&ch->dma); | |
| 275 | + if (napi_complete_done(&ch->napi, pkts)) | |
| 276 | + ltq_dma_enable_irq(&ch->dma); | |
| 274 | 277 | } |
| 275 | 278 | |
| 276 | 279 | return pkts; |
| @@ -342,10 +345,12 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr) · 65 unmodified lines | ||
| 342 | 345 | { |
| 343 | 346 | struct xrx200_chan *ch = ptr; |
| 344 | 347 | |
| 345 | − ltq_dma_disable_irq(&ch->dma); | |
| 346 | − ltq_dma_ack_irq(&ch->dma); | |
| 348 | + if (napi_schedule_prep(&ch->napi)) { | |
| 349 | + __napi_schedule(&ch->napi); | |
| 350 | + ltq_dma_disable_irq(&ch->dma); | |
| 351 | + } | |
| 347 | 352 | |
| 348 | − napi_schedule(&ch->napi); | |
| 353 | + ltq_dma_ack_irq(&ch->dma); | |
| 349 | 354 | |
| 350 | 355 | return IRQ_HANDLED; |
| 351 | 356 | } |
| @@ -499,7 +504,7 @@ static int xrx200_probe(struct platform_device *pdev) · 147 unmodified lines | ||
| 499 | 504 | |
| 500 | 505 | /* setup NAPI */ |
| 501 | 506 | netif_napi_add(net_dev, &priv->chan_rx.napi, xrx200_poll_rx, 32); |
| 502 | − netif_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32); | |
| 507 | + netif_tx_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32); | |
| 503 | 508 | |
| 504 | 509 | platform_set_drvdata(pdev, priv); |
| 505 | 510 | |
| @@ -2029,11 +2029,11 @@ mvneta_xdp_put_buff(struct mvneta_port *pp, struct mvneta_rx_queue *rxq, · 2028 unmodified lines | ||
| 2029 | 2029 | struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp); |
| 2030 | 2030 | int i; |
| 2031 | 2031 | |
| 2032 | − page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data), | |
| 2033 | − sync_len, napi); | |
| 2034 | 2032 | for (i = 0; i < sinfo->nr_frags; i++) |
| 2035 | 2033 | page_pool_put_full_page(rxq->page_pool, |
| 2036 | 2034 | skb_frag_page(&sinfo->frags[i]), napi); |
| 2035 | + page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data), | |
| 2036 | + sync_len, napi); | |
| 2037 | 2037 | } |
| 2038 | 2038 | |
| 2039 | 2039 | static int |
| @@ -2383,8 +2383,12 @@ static int mvneta_rx_swbm(struct napi_struct *napi, · 343 unmodified lines | ||
| 2383 | 2383 | mvneta_swbm_rx_frame(pp, rx_desc, rxq, &xdp_buf, |
| 2384 | 2384 | &size, page, &ps); |
| 2385 | 2385 | } else { |
| 2386 | − if (unlikely(!xdp_buf.data_hard_start)) | |
| 2386 | + if (unlikely(!xdp_buf.data_hard_start)) { | |
| 2387 | + rx_desc->buf_phys_addr = 0; | |
| 2388 | + page_pool_put_full_page(rxq->page_pool, page, | |
| 2389 | + true); | |
| 2387 | 2390 | continue; |
| 2391 | + } | |
| 2388 | 2392 | |
| 2389 | 2393 | mvneta_swbm_add_rx_fragment(pp, rx_desc, rxq, &xdp_buf, |
| 2390 | 2394 | &size, page); |
| @@ -600,7 +600,7 @@ struct mlx5e_rq { · 599 unmodified lines | ||
| 600 | 600 | struct dim dim; /* Dynamic Interrupt Moderation */ |
| 601 | 601 | |
| 602 | 602 | /* XDP */ |
| 603 | − struct bpf_prog *xdp_prog; | |
| 603 | + struct bpf_prog __rcu *xdp_prog; | |
| 604 | 604 | struct mlx5e_xdpsq *xdpsq; |
| 605 | 605 | DECLARE_BITMAP(flags, 8); |
| 606 | 606 | struct page_pool *page_pool; |
| @@ -1005,7 +1005,6 @@ int mlx5e_update_nic_rx(struct mlx5e_priv *priv); · 398 unmodified lines | ||
| 1005 | 1005 | void mlx5e_update_carrier(struct mlx5e_priv *priv); |
| 1006 | 1006 | int mlx5e_close(struct net_device *netdev); |
| 1007 | 1007 | int mlx5e_open(struct net_device *netdev); |
| 1008 | −void mlx5e_update_ndo_stats(struct mlx5e_priv *priv); | |
| 1009 | 1008 | |
| 1010 | 1009 | void mlx5e_queue_update_stats(struct mlx5e_priv *priv); |
| 1011 | 1010 | int mlx5e_bits_invert(unsigned long a, int size); |
| @@ -51,7 +51,7 @@ static void mlx5e_monitor_counters_work(struct work_struct *work) · 50 unmodified lines | ||
| 51 | 51 | monitor_counters_work); |
| 52 | 52 | |
| 53 | 53 | mutex_lock(&priv->state_lock); |
| 54 | − mlx5e_update_ndo_stats(priv); | |
| 54 | + mlx5e_stats_update_ndo_stats(priv); | |
| 55 | 55 | mutex_unlock(&priv->state_lock); |
| 56 | 56 | mlx5e_monitor_counter_arm(priv); |
| 57 | 57 | } |
| @@ -490,11 +490,8 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy) · 489 unmodified lines | ||
| 490 | 490 | int err; |
| 491 | 491 | int i; |
| 492 | 492 | |
| 493 | − if (!MLX5_CAP_GEN(dev, pcam_reg)) | |
| 494 | − return -EOPNOTSUPP; | |
| 495 | − | |
| 496 | − if (!MLX5_CAP_PCAM_REG(dev, pplm)) | |
| 497 | − return -EOPNOTSUPP; | |
| 493 | + if (!MLX5_CAP_GEN(dev, pcam_reg) || !MLX5_CAP_PCAM_REG(dev, pplm)) | |
| 494 | + return false; | |
| 498 | 495 | |
| 499 | 496 | MLX5_SET(pplm_reg, in, local_port, 1); |
| 500 | 497 | err = mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPLM, 0, 0); |
| @@ -699,6 +699,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, · 698 unmodified lines | ||
| 699 | 699 | err_rule: |
| 700 | 700 | mlx5e_mod_hdr_detach(ct_priv->esw->dev, |
| 701 | 701 | &esw->offloads.mod_hdr, zone_rule->mh); |
| 702 | + mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); | |
| 702 | 703 | err_mod_hdr: |
| 703 | 704 | kfree(spec); |
| 704 | 705 | return err; |
| @@ -958,12 +959,22 @@ mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv, · 253 unmodified lines | ||
| 958 | 959 | return 0; |
| 959 | 960 | } |
| 960 | 961 | |
| 962 | +void mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr) | |
| 963 | +{ | |
| 964 | + struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv); | |
| 965 | + | |
| 966 | + if (!ct_priv || !ct_attr->ct_labels_id) | |
| 967 | + return; | |
| 968 | + | |
| 969 | + mapping_remove(ct_priv->labels_mapping, ct_attr->ct_labels_id); | |
| 970 | +} | |
| 971 | + | |
| 961 | 972 | int |
| 962 | −mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, | |
| 963 | − struct mlx5_flow_spec *spec, | |
| 964 | − struct flow_cls_offload *f, | |
| 965 | − struct mlx5_ct_attr *ct_attr, | |
| 966 | − struct netlink_ext_ack *extack) | |
| 973 | +mlx5_tc_ct_match_add(struct mlx5e_priv *priv, | |
| 974 | + struct mlx5_flow_spec *spec, | |
| 975 | + struct flow_cls_offload *f, | |
| 976 | + struct mlx5_ct_attr *ct_attr, | |
| 977 | + struct netlink_ext_ack *extack) | |
| 967 | 978 | { |
| 968 | 979 | struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv); |
| 969 | 980 | struct flow_rule *rule = flow_cls_offload_flow_rule(f); |
| @@ -87,12 +87,15 @@ mlx5_tc_ct_init(struct mlx5_rep_uplink_priv *uplink_priv); · 86 unmodified lines | ||
| 87 | 87 | void |
| 88 | 88 | mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv); |
| 89 | 89 | |
| 90 | +void | |
| 91 | +mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr); | |
| 92 | + | |
| 90 | 93 | int |
| 91 | −mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, | |
| 92 | − struct mlx5_flow_spec *spec, | |
| 93 | − struct flow_cls_offload *f, | |
| 94 | − struct mlx5_ct_attr *ct_attr, | |
| 95 | − struct netlink_ext_ack *extack); | |
| 94 | +mlx5_tc_ct_match_add(struct mlx5e_priv *priv, | |
| 95 | + struct mlx5_flow_spec *spec, | |
| 96 | + struct flow_cls_offload *f, | |
| 97 | + struct mlx5_ct_attr *ct_attr, | |
| 98 | + struct netlink_ext_ack *extack); | |
| 96 | 99 | int |
| 97 | 100 | mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv, |
| 98 | 101 | struct mlx5_flow_spec *spec); |
| @@ -130,12 +133,15 @@ mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv) · 31 unmodified lines | ||
| 130 | 133 | { |
| 131 | 134 | } |
| 132 | 135 | |
| 136 | +static inline void | |
| 137 | +mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr) {} | |
| 138 | + | |
| 133 | 139 | static inline int |
| 134 | −mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, | |
| 135 | − struct mlx5_flow_spec *spec, | |
| 136 | − struct flow_cls_offload *f, | |
| 137 | − struct mlx5_ct_attr *ct_attr, | |
| 138 | − struct netlink_ext_ack *extack) | |
| 140 | +mlx5_tc_ct_match_add(struct mlx5e_priv *priv, | |
| 141 | + struct mlx5_flow_spec *spec, | |
| 142 | + struct flow_cls_offload *f, | |
| 143 | + struct mlx5_ct_attr *ct_attr, | |
| 144 | + struct netlink_ext_ack *extack) | |
| 139 | 145 | { |
| 140 | 146 | struct flow_rule *rule = flow_cls_offload_flow_rule(f); |
| 141 | 147 | |
| @@ -20,6 +20,11 @@ enum mlx5e_icosq_wqe_type { · 19 unmodified lines | ||
| 20 | 20 | }; |
| 21 | 21 | |
| 22 | 22 | /* General */ |
| 23 | +static inline bool mlx5e_skb_is_multicast(struct sk_buff *skb) | |
| 24 | +{ | |
| 25 | + return skb->pkt_type == PACKET_MULTICAST || skb->pkt_type == PACKET_BROADCAST; | |
| 26 | +} | |
| 27 | + | |
| 23 | 28 | void mlx5e_trigger_irq(struct mlx5e_icosq *sq); |
| 24 | 29 | void mlx5e_completion_event(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe); |
| 25 | 30 | void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event); |
| @@ -122,7 +122,7 @@ mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq, · 121 unmodified lines | ||
| 122 | 122 | bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di, |
| 123 | 123 | u32 *len, struct xdp_buff *xdp) |
| 124 | 124 | { |
| 125 | − struct bpf_prog *prog = READ_ONCE(rq->xdp_prog); | |
| 125 | + struct bpf_prog *prog = rcu_dereference(rq->xdp_prog); | |
| 126 | 126 | u32 act; |
| 127 | 127 | int err; |
| 128 | 128 | |
| @@ -31,7 +31,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 30 unmodified lines | ||
| 31 | 31 | { |
| 32 | 32 | struct xdp_buff *xdp = wi->umr.dma_info[page_idx].xsk; |
| 33 | 33 | u32 cqe_bcnt32 = cqe_bcnt; |
| 34 | − bool consumed; | |
| 35 | 34 | |
| 36 | 35 | /* Check packet size. Note LRO doesn't use linear SKB */ |
| 37 | 36 | if (unlikely(cqe_bcnt > rq->hw_mtu)) { |
| @@ -51,10 +50,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 13 unmodified lines | ||
| 51 | 50 | xsk_buff_dma_sync_for_cpu(xdp); |
| 52 | 51 | prefetch(xdp->data); |
| 53 | 52 | |
| 54 | − rcu_read_lock(); | |
| 55 | − consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp); | |
| 56 | − rcu_read_unlock(); | |
| 57 | − | |
| 58 | 53 | /* Possible flows: |
| 59 | 54 | * - XDP_REDIRECT to XSKMAP: |
| 60 | 55 | * The page is owned by the userspace from now. |
| @@ -70,7 +65,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 9 unmodified lines | ||
| 70 | 65 | * allocated first from the Reuse Ring, so it has enough space. |
| 71 | 66 | */ |
| 72 | 67 | |
| 73 | − if (likely(consumed)) { | |
| 68 | + if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp))) { | |
| 74 | 69 | if (likely(__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags))) |
| 75 | 70 | __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */ |
| 76 | 71 | return NULL; /* page/packet was consumed by XDP */ |
| @@ -88,7 +83,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq, · 11 unmodified lines | ||
| 88 | 83 | u32 cqe_bcnt) |
| 89 | 84 | { |
| 90 | 85 | struct xdp_buff *xdp = wi->di->xsk; |
| 91 | − bool consumed; | |
| 92 | 86 | |
| 93 | 87 | /* wi->offset is not used in this function, because xdp->data and the |
| 94 | 88 | * DMA address point directly to the necessary place. Furthermore, the |
| @@ -107,11 +101,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq, · 12 unmodified lines | ||
| 107 | 101 | return NULL; |
| 108 | 102 | } |
| 109 | 103 | |
| 110 | − rcu_read_lock(); | |
| 111 | − consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp); | |
| 112 | − rcu_read_unlock(); | |
| 113 | − | |
| 114 | − if (likely(consumed)) | |
| 104 | + if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp))) | |
| 115 | 105 | return NULL; /* page/packet was consumed by XDP */ |
| 116 | 106 | |
| 117 | 107 | /* XDP_PASS: copy the data from the UMEM to a new SKB. The frame reuse |
| @@ -106,8 +106,7 @@ err_free_cparam: · 105 unmodified lines | ||
| 106 | 106 | void mlx5e_close_xsk(struct mlx5e_channel *c) |
| 107 | 107 | { |
| 108 | 108 | clear_bit(MLX5E_CHANNEL_STATE_XSK, c->state); |
| 109 | − napi_synchronize(&c->napi); | |
| 110 | − synchronize_rcu(); /* Sync with the XSK wakeup. */ | |
| 109 | + synchronize_rcu(); /* Sync with the XSK wakeup and with NAPI. */ | |
| 111 | 110 | |
| 112 | 111 | mlx5e_close_rq(&c->xskrq); |
| 113 | 112 | mlx5e_close_cq(&c->xskrq.cq); |
| @@ -234,7 +234,7 @@ mlx5e_get_ktls_rx_priv_ctx(struct tls_context *tls_ctx) · 233 unmodified lines | ||
| 234 | 234 | |
| 235 | 235 | /* Re-sync */ |
| 236 | 236 | /* Runs in work context */ |
| 237 | −static struct mlx5_wqe_ctrl_seg * | |
| 237 | +static int | |
| 238 | 238 | resync_post_get_progress_params(struct mlx5e_icosq *sq, |
| 239 | 239 | struct mlx5e_ktls_offload_context_rx *priv_rx) |
| 240 | 240 | { |
| @@ -258,15 +258,19 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, · 17 unmodified lines | ||
| 258 | 258 | PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE); |
| 259 | 259 | if (unlikely(dma_mapping_error(pdev, buf->dma_addr))) { |
| 260 | 260 | err = -ENOMEM; |
| 261 | − goto err_out; | |
| 261 | + goto err_free; | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | buf->priv_rx = priv_rx; |
| 265 | 265 | |
| 266 | 266 | BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1); |
| 267 | + | |
| 268 | + spin_lock(&sq->channel->async_icosq_lock); | |
| 269 | + | |
| 267 | 270 | if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) { |
| 271 | + spin_unlock(&sq->channel->async_icosq_lock); | |
| 268 | 272 | err = -ENOSPC; |
| 269 | − goto err_out; | |
| 273 | + goto err_dma_unmap; | |
| 270 | 274 | } |
| 271 | 275 | |
| 272 | 276 | pi = mlx5e_icosq_get_next_pi(sq, 1); |
| @@ -294,12 +298,18 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, · 21 unmodified lines | ||
| 294 | 298 | }; |
| 295 | 299 | icosq_fill_wi(sq, pi, &wi); |
| 296 | 300 | sq->pc++; |
| 301 | + mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, cseg); | |
| 302 | + spin_unlock(&sq->channel->async_icosq_lock); | |
| 297 | 303 | |
| 298 | − return cseg; | |
| 304 | + return 0; | |
| 299 | 305 | |
| 306 | +err_dma_unmap: | |
| 307 | + dma_unmap_single(pdev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE); | |
| 308 | +err_free: | |
| 309 | + kfree(buf); | |
| 300 | 310 | err_out: |
| 301 | 311 | priv_rx->stats->tls_resync_req_skip++; |
| 302 | − return ERR_PTR(err); | |
| 312 | + return err; | |
| 303 | 313 | } |
| 304 | 314 | |
| 305 | 315 | /* Function is called with elevated refcount. |
| @@ -309,10 +319,8 @@ static void resync_handle_work(struct work_struct *work) · 3 unmodified lines | ||
| 309 | 319 | { |
| 310 | 320 | struct mlx5e_ktls_offload_context_rx *priv_rx; |
| 311 | 321 | struct mlx5e_ktls_rx_resync_ctx *resync; |
| 312 | − struct mlx5_wqe_ctrl_seg *cseg; | |
| 313 | 322 | struct mlx5e_channel *c; |
| 314 | 323 | struct mlx5e_icosq *sq; |
| 315 | − struct mlx5_wq_cyc *wq; | |
| 316 | 324 | |
| 317 | 325 | resync = container_of(work, struct mlx5e_ktls_rx_resync_ctx, work); |
| 318 | 326 | priv_rx = container_of(resync, struct mlx5e_ktls_offload_context_rx, resync); |
| @@ -324,18 +332,9 @@ static void resync_handle_work(struct work_struct *work) · 5 unmodified lines | ||
| 324 | 332 | |
| 325 | 333 | c = resync->priv->channels.c[priv_rx->rxq]; |
| 326 | 334 | sq = &c->async_icosq; |
| 327 | − wq = &sq->wq; | |
| 328 | − | |
| 329 | − spin_lock(&c->async_icosq_lock); | |
| 330 | 335 | |
| 331 | − cseg = resync_post_get_progress_params(sq, priv_rx); | |
| 332 | − if (IS_ERR(cseg)) { | |
| 336 | + if (resync_post_get_progress_params(sq, priv_rx)) | |
| 333 | 337 | refcount_dec(&resync->refcnt); |
| 334 | − goto unlock; | |
| 335 | − } | |
| 336 | − mlx5e_notify_hw(wq, sq->pc, sq->uar_map, cseg); | |
| 337 | −unlock: | |
| 338 | − spin_unlock(&c->async_icosq_lock); | |
| 339 | 338 | } |
| 340 | 339 | |
| 341 | 340 | static void resync_init(struct mlx5e_ktls_rx_resync_ctx *resync, |
| @@ -386,16 +385,17 @@ void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi, · 44 unmodified lines | ||
| 386 | 385 | struct mlx5e_ktls_offload_context_rx *priv_rx; |
| 387 | 386 | struct mlx5e_ktls_rx_resync_ctx *resync; |
| 388 | 387 | u8 tracker_state, auth_state, *ctx; |
| 388 | + struct device *dev; | |
| 389 | 389 | u32 hw_seq; |
| 390 | 390 | |
| 391 | 391 | priv_rx = buf->priv_rx; |
| 392 | 392 | resync = &priv_rx->resync; |
| 393 | − | |
| 393 | + dev = resync->priv->mdev->device; | |
| 394 | 394 | if (unlikely(test_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags))) |
| 395 | 395 | goto out; |
| 396 | 396 | |
| 397 | − dma_sync_single_for_cpu(resync->priv->mdev->device, buf->dma_addr, | |
| 398 | − PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE); | |
| 397 | + dma_sync_single_for_cpu(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, | |
| 398 | + DMA_FROM_DEVICE); | |
| 399 | 399 | |
| 400 | 400 | ctx = buf->progress.ctx; |
| 401 | 401 | tracker_state = MLX5_GET(tls_progress_params, ctx, record_tracker_state); |
| @@ -411,6 +411,7 @@ void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi, · 9 unmodified lines | ||
| 411 | 411 | priv_rx->stats->tls_resync_req_end++; |
| 412 | 412 | out: |
| 413 | 413 | refcount_dec(&resync->refcnt); |
| 414 | + dma_unmap_single(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE); | |
| 414 | 415 | kfree(buf); |
| 415 | 416 | } |
| 416 | 417 | |
| @@ -659,7 +660,7 @@ void mlx5e_ktls_del_rx(struct net_device *netdev, struct tls_context *tls_ctx) · 242 unmodified lines | ||
| 659 | 660 | priv_rx = mlx5e_get_ktls_rx_priv_ctx(tls_ctx); |
| 660 | 661 | set_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags); |
| 661 | 662 | mlx5e_set_ktls_rx_priv_ctx(tls_ctx, NULL); |
| 662 | − napi_synchronize(&priv->channels.c[priv_rx->rxq]->napi); | |
| 663 | + synchronize_rcu(); /* Sync with NAPI */ | |
| 663 | 664 | if (!cancel_work_sync(&priv_rx->rule.work)) |
| 664 | 665 | /* completion is needed, as the priv_rx in the add flow |
| 665 | 666 | * is maintained on the wqe info (wi), not on the socket. |
| @@ -35,7 +35,6 @@ · 34 unmodified lines | ||
| 35 | 35 | #include <net/sock.h> |
| 36 | 36 | |
| 37 | 37 | #include "en.h" |
| 38 | −#include "accel/tls.h" | |
| 39 | 38 | #include "fpga/sdk.h" |
| 40 | 39 | #include "en_accel/tls.h" |
| 41 | 40 | |
| @@ -51,9 +50,14 @@ static const struct counter_desc mlx5e_tls_sw_stats_desc[] = { · 9 unmodified lines | ||
| 51 | 50 | |
| 52 | 51 | #define NUM_TLS_SW_COUNTERS ARRAY_SIZE(mlx5e_tls_sw_stats_desc) |
| 53 | 52 | |
| 53 | +static bool is_tls_atomic_stats(struct mlx5e_priv *priv) | |
| 54 | +{ | |
| 55 | + return priv->tls && !mlx5_accel_is_ktls_device(priv->mdev); | |
| 56 | +} | |
| 57 | + | |
| 54 | 58 | int mlx5e_tls_get_count(struct mlx5e_priv *priv) |
| 55 | 59 | { |
| 56 | − if (!priv->tls) | |
| 60 | + if (!is_tls_atomic_stats(priv)) | |
| 57 | 61 | return 0; |
| 58 | 62 | |
| 59 | 63 | return NUM_TLS_SW_COUNTERS; |
| @@ -63,7 +67,7 @@ int mlx5e_tls_get_strings(struct mlx5e_priv *priv, uint8_t *data) · 3 unmodified lines | ||
| 63 | 67 | { |
| 64 | 68 | unsigned int i, idx = 0; |
| 65 | 69 | |
| 66 | − if (!priv->tls) | |
| 70 | + if (!is_tls_atomic_stats(priv)) | |
| 67 | 71 | return 0; |
| 68 | 72 | |
| 69 | 73 | for (i = 0; i < NUM_TLS_SW_COUNTERS; i++) |
| @@ -77,7 +81,7 @@ int mlx5e_tls_get_stats(struct mlx5e_priv *priv, u64 *data) · 7 unmodified lines | ||
| 77 | 81 | { |
| 78 | 82 | int i, idx = 0; |
| 79 | 83 | |
| 80 | − if (!priv->tls) | |
| 84 | + if (!is_tls_atomic_stats(priv)) | |
| 81 | 85 | return 0; |
| 82 | 86 | |
| 83 | 87 | for (i = 0; i < NUM_TLS_SW_COUNTERS; i++) |
| @@ -158,16 +158,6 @@ static void mlx5e_update_carrier_work(struct work_struct *work) · 157 unmodified lines | ||
| 158 | 158 | mutex_unlock(&priv->state_lock); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | −void mlx5e_update_ndo_stats(struct mlx5e_priv *priv) | |
| 162 | −{ | |
| 163 | − int i; | |
| 164 | − | |
| 165 | − for (i = mlx5e_nic_stats_grps_num(priv) - 1; i >= 0; i--) | |
| 166 | − if (mlx5e_nic_stats_grps[i]->update_stats_mask & | |
| 167 | − MLX5E_NDO_UPDATE_STATS) | |
| 168 | − mlx5e_nic_stats_grps[i]->update_stats(priv); | |
| 169 | −} | |
| 170 | − | |
| 171 | 161 | static void mlx5e_update_stats_work(struct work_struct *work) |
| 172 | 162 | { |
| 173 | 163 | struct mlx5e_priv *priv = container_of(work, struct mlx5e_priv, |
| @@ -399,7 +389,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, · 225 unmodified lines | ||
| 399 | 389 | |
| 400 | 390 | if (params->xdp_prog) |
| 401 | 391 | bpf_prog_inc(params->xdp_prog); |
| 402 | − rq->xdp_prog = params->xdp_prog; | |
| 392 | + RCU_INIT_POINTER(rq->xdp_prog, params->xdp_prog); | |
| 403 | 393 | |
| 404 | 394 | rq_xdp_ix = rq->ix; |
| 405 | 395 | if (xsk) |
| @@ -408,7 +398,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, · 2 unmodified lines | ||
| 408 | 398 | if (err < 0) |
| 409 | 399 | goto err_rq_wq_destroy; |
| 410 | 400 | |
| 411 | − rq->buff.map_dir = rq->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE; | |
| 401 | + rq->buff.map_dir = params->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE; | |
| 412 | 402 | rq->buff.headroom = mlx5e_get_rq_headroom(mdev, params, xsk); |
| 413 | 403 | pool_size = 1 << params->log_rq_mtu_frames; |
| 414 | 404 | |
| @@ -564,8 +554,8 @@ err_free: · 149 unmodified lines | ||
| 564 | 554 | } |
| 565 | 555 | |
| 566 | 556 | err_rq_wq_destroy: |
| 567 | − if (rq->xdp_prog) | |
| 568 | − bpf_prog_put(rq->xdp_prog); | |
| 557 | + if (params->xdp_prog) | |
| 558 | + bpf_prog_put(params->xdp_prog); | |
| 569 | 559 | xdp_rxq_info_unreg(&rq->xdp_rxq); |
| 570 | 560 | page_pool_destroy(rq->page_pool); |
| 571 | 561 | mlx5_wq_destroy(&rq->wq_ctrl); |
| @@ -575,10 +565,16 @@ err_rq_wq_destroy: · 3 unmodified lines | ||
| 575 | 565 | |
| 576 | 566 | static void mlx5e_free_rq(struct mlx5e_rq *rq) |
| 577 | 567 | { |
| 568 | + struct mlx5e_channel *c = rq->channel; | |
| 569 | + struct bpf_prog *old_prog = NULL; | |
| 578 | 570 | int i; |
| 579 | 571 | |
| 580 | − if (rq->xdp_prog) | |
| 581 | − bpf_prog_put(rq->xdp_prog); | |
| 572 | + /* drop_rq has neither channel nor xdp_prog. */ | |
| 573 | + if (c) | |
| 574 | + old_prog = rcu_dereference_protected(rq->xdp_prog, | |
| 575 | + lockdep_is_held(&c->priv->state_lock)); | |
| 576 | + if (old_prog) | |
| 577 | + bpf_prog_put(old_prog); | |
| 582 | 578 | |
| 583 | 579 | switch (rq->wq_type) { |
| 584 | 580 | case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: |
| @@ -867,7 +863,7 @@ void mlx5e_activate_rq(struct mlx5e_rq *rq) · 282 unmodified lines | ||
| 867 | 863 | void mlx5e_deactivate_rq(struct mlx5e_rq *rq) |
| 868 | 864 | { |
| 869 | 865 | clear_bit(MLX5E_RQ_STATE_ENABLED, &rq->state); |
| 870 | − napi_synchronize(&rq->channel->napi); /* prevent mlx5e_post_rx_wqes */ | |
| 866 | + synchronize_rcu(); /* Sync with NAPI to prevent mlx5e_post_rx_wqes. */ | |
| 871 | 867 | } |
| 872 | 868 | |
| 873 | 869 | void mlx5e_close_rq(struct mlx5e_rq *rq) |
| @@ -1312,12 +1308,10 @@ void mlx5e_tx_disable_queue(struct netdev_queue *txq) · 438 unmodified lines | ||
| 1312 | 1308 | |
| 1313 | 1309 | static void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq) |
| 1314 | 1310 | { |
| 1315 | − struct mlx5e_channel *c = sq->channel; | |
| 1316 | 1311 | struct mlx5_wq_cyc *wq = &sq->wq; |
| 1317 | 1312 | |
| 1318 | 1313 | clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); |
| 1319 | − /* prevent netif_tx_wake_queue */ | |
| 1320 | − napi_synchronize(&c->napi); | |
| 1314 | + synchronize_rcu(); /* Sync with NAPI to prevent netif_tx_wake_queue. */ | |
| 1321 | 1315 | |
| 1322 | 1316 | mlx5e_tx_disable_queue(sq->txq); |
| 1323 | 1317 | |
| @@ -1392,10 +1386,8 @@ void mlx5e_activate_icosq(struct mlx5e_icosq *icosq) · 68 unmodified lines | ||
| 1392 | 1386 | |
| 1393 | 1387 | void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq) |
| 1394 | 1388 | { |
| 1395 | − struct mlx5e_channel *c = icosq->channel; | |
| 1396 | − | |
| 1397 | 1389 | clear_bit(MLX5E_SQ_STATE_ENABLED, &icosq->state); |
| 1398 | − napi_synchronize(&c->napi); | |
| 1390 | + synchronize_rcu(); /* Sync with NAPI. */ | |
| 1399 | 1391 | } |
| 1400 | 1392 | |
| 1401 | 1393 | void mlx5e_close_icosq(struct mlx5e_icosq *sq) |
| @@ -1474,7 +1466,7 @@ void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq) · 72 unmodified lines | ||
| 1474 | 1466 | struct mlx5e_channel *c = sq->channel; |
| 1475 | 1467 | |
| 1476 | 1468 | clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); |
| 1477 | − napi_synchronize(&c->napi); | |
| 1469 | + synchronize_rcu(); /* Sync with NAPI. */ | |
| 1478 | 1470 | |
| 1479 | 1471 | mlx5e_destroy_sq(c->mdev, sq->sqn); |
| 1480 | 1472 | mlx5e_free_xdpsq_descs(sq); |
| @@ -3567,6 +3559,7 @@ void mlx5e_fold_sw_stats64(struct mlx5e_priv *priv, struct rtnl_link_stats64 *s) · 2086 unmodified lines | ||
| 3567 | 3559 | |
| 3568 | 3560 | s->rx_packets += rq_stats->packets + xskrq_stats->packets; |
| 3569 | 3561 | s->rx_bytes += rq_stats->bytes + xskrq_stats->bytes; |
| 3562 | + s->multicast += rq_stats->mcast_packets + xskrq_stats->mcast_packets; | |
| 3570 | 3563 | |
| 3571 | 3564 | for (j = 0; j < priv->max_opened_tc; j++) { |
| 3572 | 3565 | struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j]; |
| @@ -3582,7 +3575,6 @@ void · 9 unmodified lines | ||
| 3582 | 3575 | mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) |
| 3583 | 3576 | { |
| 3584 | 3577 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 3585 | − struct mlx5e_vport_stats *vstats = &priv->stats.vport; | |
| 3586 | 3578 | struct mlx5e_pport_stats *pstats = &priv->stats.pport; |
| 3587 | 3579 | |
| 3588 | 3580 | /* In switchdev mode, monitor counters doesn't monitor |
| @@ -3617,12 +3609,6 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) · 28 unmodified lines | ||
| 3617 | 3609 | stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors + |
| 3618 | 3610 | stats->rx_frame_errors; |
| 3619 | 3611 | stats->tx_errors = stats->tx_aborted_errors + stats->tx_carrier_errors; |
| 3620 | − | |
| 3621 | − /* vport multicast also counts packets that are dropped due to steering | |
| 3622 | − * or rx out of buffer | |
| 3623 | − */ | |
| 3624 | − stats->multicast = | |
| 3625 | − VPORT_COUNTER_GET(vstats, received_eth_multicast.packets); | |
| 3626 | 3612 | } |
| 3627 | 3613 | |
| 3628 | 3614 | static void mlx5e_set_rx_mode(struct net_device *dev) |
| @@ -4330,6 +4316,16 @@ static int mlx5e_xdp_allowed(struct mlx5e_priv *priv, struct bpf_prog *prog) · 701 unmodified lines | ||
| 4330 | 4316 | return 0; |
| 4331 | 4317 | } |
| 4332 | 4318 | |
| 4319 | +static void mlx5e_rq_replace_xdp_prog(struct mlx5e_rq *rq, struct bpf_prog *prog) | |
| 4320 | +{ | |
| 4321 | + struct bpf_prog *old_prog; | |
| 4322 | + | |
| 4323 | + old_prog = rcu_replace_pointer(rq->xdp_prog, prog, | |
| 4324 | + lockdep_is_held(&rq->channel->priv->state_lock)); | |
| 4325 | + if (old_prog) | |
| 4326 | + bpf_prog_put(old_prog); | |
| 4327 | +} | |
| 4328 | + | |
| 4333 | 4329 | static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) |
| 4334 | 4330 | { |
| 4335 | 4331 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| @@ -4388,29 +4384,10 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) · 52 unmodified lines | ||
| 4388 | 4384 | */ |
| 4389 | 4385 | for (i = 0; i < priv->channels.num; i++) { |
| 4390 | 4386 | struct mlx5e_channel *c = priv->channels.c[i]; |
| 4391 | − bool xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state); | |
| 4392 | − | |
| 4393 | − clear_bit(MLX5E_RQ_STATE_ENABLED, &c->rq.state); | |
| 4394 | − if (xsk_open) | |
| 4395 | − clear_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state); | |
| 4396 | − napi_synchronize(&c->napi); | |
| 4397 | − /* prevent mlx5e_poll_rx_cq from accessing rq->xdp_prog */ | |
| 4398 | − | |
| 4399 | − old_prog = xchg(&c->rq.xdp_prog, prog); | |
| 4400 | − if (old_prog) | |
| 4401 | − bpf_prog_put(old_prog); | |
| 4402 | − | |
| 4403 | − if (xsk_open) { | |
| 4404 | − old_prog = xchg(&c->xskrq.xdp_prog, prog); | |
| 4405 | − if (old_prog) | |
| 4406 | − bpf_prog_put(old_prog); | |
| 4407 | − } | |
| 4408 | 4387 | |
| 4409 | − set_bit(MLX5E_RQ_STATE_ENABLED, &c->rq.state); | |
| 4410 | − if (xsk_open) | |
| 4411 | − set_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state); | |
| 4412 | − /* napi_schedule in case we have missed anything */ | |
| 4413 | − napi_schedule(&c->napi); | |
| 4388 | + mlx5e_rq_replace_xdp_prog(&c->rq, prog); | |
| 4389 | + if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) | |
| 4390 | + mlx5e_rq_replace_xdp_prog(&c->xskrq, prog); | |
| 4414 | 4391 | } |
| 4415 | 4392 | |
| 4416 | 4393 | unlock: |
| @@ -5200,7 +5177,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = { · 783 unmodified lines | ||
| 5200 | 5177 | .enable = mlx5e_nic_enable, |
| 5201 | 5178 | .disable = mlx5e_nic_disable, |
| 5202 | 5179 | .update_rx = mlx5e_update_nic_rx, |
| 5203 | − .update_stats = mlx5e_update_ndo_stats, | |
| 5180 | + .update_stats = mlx5e_stats_update_ndo_stats, | |
| 5204 | 5181 | .update_carrier = mlx5e_update_carrier, |
| 5205 | 5182 | .rx_handlers = &mlx5e_rx_handlers_nic, |
| 5206 | 5183 | .max_tc = MLX5E_MAX_NUM_TC, |
| @@ -1171,7 +1171,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = { · 1170 unmodified lines | ||
| 1171 | 1171 | .cleanup_tx = mlx5e_cleanup_rep_tx, |
| 1172 | 1172 | .enable = mlx5e_rep_enable, |
| 1173 | 1173 | .update_rx = mlx5e_update_rep_rx, |
| 1174 | − .update_stats = mlx5e_update_ndo_stats, | |
| 1174 | + .update_stats = mlx5e_stats_update_ndo_stats, | |
| 1175 | 1175 | .rx_handlers = &mlx5e_rx_handlers_rep, |
| 1176 | 1176 | .max_tc = 1, |
| 1177 | 1177 | .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), |
| @@ -1189,7 +1189,7 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = { · 11 unmodified lines | ||
| 1189 | 1189 | .enable = mlx5e_uplink_rep_enable, |
| 1190 | 1190 | .disable = mlx5e_uplink_rep_disable, |
| 1191 | 1191 | .update_rx = mlx5e_update_rep_rx, |
| 1192 | − .update_stats = mlx5e_update_ndo_stats, | |
| 1192 | + .update_stats = mlx5e_stats_update_ndo_stats, | |
| 1193 | 1193 | .update_carrier = mlx5e_update_carrier, |
| 1194 | 1194 | .rx_handlers = &mlx5e_rx_handlers_rep, |
| 1195 | 1195 | .max_tc = MLX5E_MAX_NUM_TC, |
| @@ -53,6 +53,7 @@ · 52 unmodified lines | ||
| 53 | 53 | #include "en/xsk/rx.h" |
| 54 | 54 | #include "en/health.h" |
| 55 | 55 | #include "en/params.h" |
| 56 | +#include "en/txrx.h" | |
| 56 | 57 | |
| 57 | 58 | static struct sk_buff * |
| 58 | 59 | mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, |
| @@ -1080,6 +1081,9 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, · 1021 unmodified lines | ||
| 1080 | 1081 | mlx5e_enable_ecn(rq, skb); |
| 1081 | 1082 | |
| 1082 | 1083 | skb->protocol = eth_type_trans(skb, netdev); |
| 1084 | + | |
| 1085 | + if (unlikely(mlx5e_skb_is_multicast(skb))) | |
| 1086 | + stats->mcast_packets++; | |
| 1083 | 1087 | } |
| 1084 | 1088 | |
| 1085 | 1089 | static inline void mlx5e_complete_rx_cqe(struct mlx5e_rq *rq, |
| @@ -1132,7 +1136,6 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, · 46 unmodified lines | ||
| 1132 | 1136 | struct xdp_buff xdp; |
| 1133 | 1137 | struct sk_buff *skb; |
| 1134 | 1138 | void *va, *data; |
| 1135 | − bool consumed; | |
| 1136 | 1139 | u32 frag_size; |
| 1137 | 1140 | |
| 1138 | 1141 | va = page_address(di->page) + wi->offset; |
| @@ -1144,11 +1147,8 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, · 5 unmodified lines | ||
| 1144 | 1147 | prefetchw(va); /* xdp_frame data area */ |
| 1145 | 1148 | prefetch(data); |
| 1146 | 1149 | |
| 1147 | − rcu_read_lock(); | |
| 1148 | 1150 | mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt, &xdp); |
| 1149 | − consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp); | |
| 1150 | − rcu_read_unlock(); | |
| 1151 | − if (consumed) | |
| 1151 | + if (mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp)) | |
| 1152 | 1152 | return NULL; /* page/packet was consumed by XDP */ |
| 1153 | 1153 | |
| 1154 | 1154 | rx_headroom = xdp.data - xdp.data_hard_start; |
| @@ -1438,7 +1438,6 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 283 unmodified lines | ||
| 1438 | 1438 | struct sk_buff *skb; |
| 1439 | 1439 | void *va, *data; |
| 1440 | 1440 | u32 frag_size; |
| 1441 | − bool consumed; | |
| 1442 | 1441 | |
| 1443 | 1442 | /* Check packet size. Note LRO doesn't use linear SKB */ |
| 1444 | 1443 | if (unlikely(cqe_bcnt > rq->hw_mtu)) { |
| @@ -1455,11 +1454,8 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 10 unmodified lines | ||
| 1455 | 1454 | prefetchw(va); /* xdp_frame data area */ |
| 1456 | 1455 | prefetch(data); |
| 1457 | 1456 | |
| 1458 | − rcu_read_lock(); | |
| 1459 | 1457 | mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt32, &xdp); |
| 1460 | − consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp); | |
| 1461 | − rcu_read_unlock(); | |
| 1462 | − if (consumed) { | |
| 1458 | + if (mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp)) { | |
| 1463 | 1459 | if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)) |
| 1464 | 1460 | __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */ |
| 1465 | 1461 | return NULL; /* page/packet was consumed by XDP */ |
| @@ -54,6 +54,18 @@ unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv) · 53 unmodified lines | ||
| 54 | 54 | return total; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | +void mlx5e_stats_update_ndo_stats(struct mlx5e_priv *priv) | |
| 58 | +{ | |
| 59 | + mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps; | |
| 60 | + const unsigned int num_stats_grps = stats_grps_num(priv); | |
| 61 | + int i; | |
| 62 | + | |
| 63 | + for (i = num_stats_grps - 1; i >= 0; i--) | |
| 64 | + if (stats_grps[i]->update_stats && | |
| 65 | + stats_grps[i]->update_stats_mask & MLX5E_NDO_UPDATE_STATS) | |
| 66 | + stats_grps[i]->update_stats(priv); | |
| 67 | +} | |
| 68 | + | |
| 57 | 69 | void mlx5e_stats_update(struct mlx5e_priv *priv) |
| 58 | 70 | { |
| 59 | 71 | mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps; |
| @@ -103,6 +103,7 @@ unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv); · 102 unmodified lines | ||
| 103 | 103 | void mlx5e_stats_update(struct mlx5e_priv *priv); |
| 104 | 104 | void mlx5e_stats_fill(struct mlx5e_priv *priv, u64 *data, int idx); |
| 105 | 105 | void mlx5e_stats_fill_strings(struct mlx5e_priv *priv, u8 *data); |
| 106 | +void mlx5e_stats_update_ndo_stats(struct mlx5e_priv *priv); | |
| 106 | 107 | |
| 107 | 108 | /* Concrete NIC Stats */ |
| 108 | 109 | |
| @@ -119,6 +120,7 @@ struct mlx5e_sw_stats { · 10 unmodified lines | ||
| 119 | 120 | u64 tx_nop; |
| 120 | 121 | u64 rx_lro_packets; |
| 121 | 122 | u64 rx_lro_bytes; |
| 123 | + u64 rx_mcast_packets; | |
| 122 | 124 | u64 rx_ecn_mark; |
| 123 | 125 | u64 rx_removed_vlan_packets; |
| 124 | 126 | u64 rx_csum_unnecessary; |
| @@ -298,6 +300,7 @@ struct mlx5e_rq_stats { · 173 unmodified lines | ||
| 298 | 300 | u64 csum_none; |
| 299 | 301 | u64 lro_packets; |
| 300 | 302 | u64 lro_bytes; |
| 303 | + u64 mcast_packets; | |
| 301 | 304 | u64 ecn_mark; |
| 302 | 305 | u64 removed_vlan_packets; |
| 303 | 306 | u64 xdp_drop; |
| @@ -1290,11 +1290,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, · 1289 unmodified lines | ||
| 1290 | 1290 | |
| 1291 | 1291 | mlx5e_put_flow_tunnel_id(flow); |
| 1292 | 1292 | |
| 1293 | − if (flow_flag_test(flow, NOT_READY)) { | |
| 1293 | + if (flow_flag_test(flow, NOT_READY)) | |
| 1294 | 1294 | remove_unready_flow(flow); |
| 1295 | − kvfree(attr->parse_attr); | |
| 1296 | − return; | |
| 1297 | − } | |
| 1298 | 1295 | |
| 1299 | 1296 | if (mlx5e_is_offloaded_flow(flow)) { |
| 1300 | 1297 | if (flow_flag_test(flow, SLOW)) |
| @@ -1315,6 +1312,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, · 14 unmodified lines | ||
| 1315 | 1312 | } |
| 1316 | 1313 | kvfree(attr->parse_attr); |
| 1317 | 1314 | |
| 1315 | + mlx5_tc_ct_match_del(priv, &flow->esw_attr->ct_attr); | |
| 1316 | + | |
| 1318 | 1317 | if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) |
| 1319 | 1318 | mlx5e_detach_mod_hdr(priv, flow); |
| 1320 | 1319 | |
| @@ -2625,6 +2624,22 @@ static struct mlx5_fields fields[] = { · 1304 unmodified lines | ||
| 2625 | 2624 | OFFLOAD(UDP_DPORT, 16, U16_MAX, udp.dest, 0, udp_dport), |
| 2626 | 2625 | }; |
| 2627 | 2626 | |
| 2627 | +static unsigned long mask_to_le(unsigned long mask, int size) | |
| 2628 | +{ | |
| 2629 | + __be32 mask_be32; | |
| 2630 | + __be16 mask_be16; | |
| 2631 | + | |
| 2632 | + if (size == 32) { | |
| 2633 | + mask_be32 = (__force __be32)(mask); | |
| 2634 | + mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32)); | |
| 2635 | + } else if (size == 16) { | |
| 2636 | + mask_be32 = (__force __be32)(mask); | |
| 2637 | + mask_be16 = *(__be16 *)&mask_be32; | |
| 2638 | + mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16)); | |
| 2639 | + } | |
| 2640 | + | |
| 2641 | + return mask; | |
| 2642 | +} | |
| 2628 | 2643 | static int offload_pedit_fields(struct mlx5e_priv *priv, |
| 2629 | 2644 | int namespace, |
| 2630 | 2645 | struct pedit_headers_action *hdrs, |
| @@ -2638,9 +2653,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, · 7 unmodified lines | ||
| 2638 | 2653 | u32 *s_masks_p, *a_masks_p, s_mask, a_mask; |
| 2639 | 2654 | struct mlx5e_tc_mod_hdr_acts *mod_acts; |
| 2640 | 2655 | struct mlx5_fields *f; |
| 2641 | − unsigned long mask; | |
| 2642 | − __be32 mask_be32; | |
| 2643 | − __be16 mask_be16; | |
| 2656 | + unsigned long mask, field_mask; | |
| 2644 | 2657 | int err; |
| 2645 | 2658 | u8 cmd; |
| 2646 | 2659 | |
| @@ -2706,14 +2719,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, · 59 unmodified lines | ||
| 2706 | 2719 | if (skip) |
| 2707 | 2720 | continue; |
| 2708 | 2721 | |
| 2709 | − if (f->field_bsize == 32) { | |
| 2710 | − mask_be32 = (__force __be32)(mask); | |
| 2711 | − mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32)); | |
| 2712 | − } else if (f->field_bsize == 16) { | |
| 2713 | − mask_be32 = (__force __be32)(mask); | |
| 2714 | − mask_be16 = *(__be16 *)&mask_be32; | |
| 2715 | − mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16)); | |
| 2716 | − } | |
| 2722 | + mask = mask_to_le(mask, f->field_bsize); | |
| 2717 | 2723 | |
| 2718 | 2724 | first = find_first_bit(&mask, f->field_bsize); |
| 2719 | 2725 | next_z = find_next_zero_bit(&mask, f->field_bsize, first); |
| @@ -2744,9 +2750,10 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, · 24 unmodified lines | ||
| 2744 | 2750 | if (cmd == MLX5_ACTION_TYPE_SET) { |
| 2745 | 2751 | int start; |
| 2746 | 2752 | |
| 2753 | + field_mask = mask_to_le(f->field_mask, f->field_bsize); | |
| 2754 | + | |
| 2747 | 2755 | /* if field is bit sized it can start not from first bit */ |
| 2748 | − start = find_first_bit((unsigned long *)&f->field_mask, | |
| 2749 | − f->field_bsize); | |
| 2756 | + start = find_first_bit(&field_mask, f->field_bsize); | |
| 2750 | 2757 | |
| 2751 | 2758 | MLX5_SET(set_action_in, action, offset, first - start); |
| 2752 | 2759 | /* length is num of bits to be written, zero means length of 32 */ |
| @@ -4402,8 +4409,8 @@ __mlx5e_add_fdb_flow(struct mlx5e_priv *priv, · 1649 unmodified lines | ||
| 4402 | 4409 | goto err_free; |
| 4403 | 4410 | |
| 4404 | 4411 | /* actions validation depends on parsing the ct matches first */ |
| 4405 | − err = mlx5_tc_ct_parse_match(priv, &parse_attr->spec, f, | |
| 4406 | − &flow->esw_attr->ct_attr, extack); | |
| 4412 | + err = mlx5_tc_ct_match_add(priv, &parse_attr->spec, f, | |
| 4413 | + &flow->esw_attr->ct_attr, extack); | |
| 4407 | 4414 | if (err) |
| 4408 | 4415 | goto err_free; |
| 4409 | 4416 | |
| @@ -121,13 +121,17 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 120 unmodified lines | ||
| 121 | 121 | struct mlx5e_xdpsq *xsksq = &c->xsksq; |
| 122 | 122 | struct mlx5e_rq *xskrq = &c->xskrq; |
| 123 | 123 | struct mlx5e_rq *rq = &c->rq; |
| 124 | − bool xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state); | |
| 125 | 124 | bool aff_change = false; |
| 126 | 125 | bool busy_xsk = false; |
| 127 | 126 | bool busy = false; |
| 128 | 127 | int work_done = 0; |
| 128 | + bool xsk_open; | |
| 129 | 129 | int i; |
| 130 | 130 | |
| 131 | + rcu_read_lock(); | |
| 132 | + | |
| 133 | + xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state); | |
| 134 | + | |
| 131 | 135 | ch_stats->poll++; |
| 132 | 136 | |
| 133 | 137 | for (i = 0; i < c->num_tc; i++) |
| @@ -167,8 +171,10 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 33 unmodified lines | ||
| 167 | 171 | busy |= busy_xsk; |
| 168 | 172 | |
| 169 | 173 | if (busy) { |
| 170 | − if (likely(mlx5e_channel_no_affinity_change(c))) | |
| 171 | − return budget; | |
| 174 | + if (likely(mlx5e_channel_no_affinity_change(c))) { | |
| 175 | + work_done = budget; | |
| 176 | + goto out; | |
| 177 | + } | |
| 172 | 178 | ch_stats->aff_change++; |
| 173 | 179 | aff_change = true; |
| 174 | 180 | if (budget && work_done == budget) |
| @@ -176,7 +182,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 1 unmodified line | ||
| 176 | 182 | } |
| 177 | 183 | |
| 178 | 184 | if (unlikely(!napi_complete_done(napi, work_done))) |
| 179 | − return work_done; | |
| 185 | + goto out; | |
| 180 | 186 | |
| 181 | 187 | ch_stats->arm++; |
| 182 | 188 | |
| @@ -203,6 +209,9 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 20 unmodified lines | ||
| 203 | 209 | ch_stats->force_irq++; |
| 204 | 210 | } |
| 205 | 211 | |
| 212 | +out: | |
| 213 | + rcu_read_unlock(); | |
| 214 | + | |
| 206 | 215 | return work_done; |
| 207 | 216 | } |
| 208 | 217 | |
| @@ -1219,35 +1219,37 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw) · 1218 unmodified lines | ||
| 1219 | 1219 | } |
| 1220 | 1220 | esw->fdb_table.offloads.send_to_vport_grp = g; |
| 1221 | 1221 | |
| 1222 | − /* create peer esw miss group */ | |
| 1223 | − memset(flow_group_in, 0, inlen); | |
| 1222 | + if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) { | |
| 1223 | + /* create peer esw miss group */ | |
| 1224 | + memset(flow_group_in, 0, inlen); | |
| 1224 | 1225 | |
| 1225 | − esw_set_flow_group_source_port(esw, flow_group_in); | |
| 1226 | + esw_set_flow_group_source_port(esw, flow_group_in); | |
| 1226 | 1227 | |
| 1227 | − if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) { | |
| 1228 | − match_criteria = MLX5_ADDR_OF(create_flow_group_in, | |
| 1229 | − flow_group_in, | |
| 1230 | − match_criteria); | |
| 1228 | + if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) { | |
| 1229 | + match_criteria = MLX5_ADDR_OF(create_flow_group_in, | |
| 1230 | + flow_group_in, | |
| 1231 | + match_criteria); | |
| 1231 | 1232 | |
| 1232 | − MLX5_SET_TO_ONES(fte_match_param, match_criteria, | |
| 1233 | − misc_parameters.source_eswitch_owner_vhca_id); | |
| 1233 | + MLX5_SET_TO_ONES(fte_match_param, match_criteria, | |
| 1234 | + misc_parameters.source_eswitch_owner_vhca_id); | |
| 1234 | 1235 | |
| 1235 | − MLX5_SET(create_flow_group_in, flow_group_in, | |
| 1236 | − source_eswitch_owner_vhca_id_valid, 1); | |
| 1237 | − } | |
| 1236 | + MLX5_SET(create_flow_group_in, flow_group_in, | |
| 1237 | + source_eswitch_owner_vhca_id_valid, 1); | |
| 1238 | + } | |
| 1238 | 1239 | |
| 1239 | − MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, ix); | |
| 1240 | − MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, | |
| 1241 | − ix + esw->total_vports - 1); | |
| 1242 | − ix += esw->total_vports; | |
| 1240 | + MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, ix); | |
| 1241 | + MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, | |
| 1242 | + ix + esw->total_vports - 1); | |
| 1243 | + ix += esw->total_vports; | |
| 1243 | 1244 | |
| 1244 | − g = mlx5_create_flow_group(fdb, flow_group_in); | |
| 1245 | − if (IS_ERR(g)) { | |
| 1246 | − err = PTR_ERR(g); | |
| 1247 | − esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err); | |
| 1248 | − goto peer_miss_err; | |
| 1245 | + g = mlx5_create_flow_group(fdb, flow_group_in); | |
| 1246 | + if (IS_ERR(g)) { | |
| 1247 | + err = PTR_ERR(g); | |
| 1248 | + esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err); | |
| 1249 | + goto peer_miss_err; | |
| 1250 | + } | |
| 1251 | + esw->fdb_table.offloads.peer_miss_grp = g; | |
| 1249 | 1252 | } |
| 1250 | − esw->fdb_table.offloads.peer_miss_grp = g; | |
| 1251 | 1253 | |
| 1252 | 1254 | /* create miss group */ |
| 1253 | 1255 | memset(flow_group_in, 0, inlen); |
| @@ -1281,7 +1283,8 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw) · 27 unmodified lines | ||
| 1281 | 1283 | miss_rule_err: |
| 1282 | 1284 | mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp); |
| 1283 | 1285 | miss_err: |
| 1284 | − mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp); | |
| 1286 | + if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) | |
| 1287 | + mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp); | |
| 1285 | 1288 | peer_miss_err: |
| 1286 | 1289 | mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp); |
| 1287 | 1290 | send_vport_err: |
| @@ -1305,7 +1308,8 @@ static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw) · 17 unmodified lines | ||
| 1305 | 1308 | mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_multi); |
| 1306 | 1309 | mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_uni); |
| 1307 | 1310 | mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp); |
| 1308 | − mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp); | |
| 1311 | + if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) | |
| 1312 | + mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp); | |
| 1309 | 1313 | mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp); |
| 1310 | 1314 | |
| 1311 | 1315 | mlx5_esw_chains_destroy(esw); |
| @@ -654,7 +654,7 @@ static struct fs_fte *alloc_fte(struct mlx5_flow_table *ft, · 653 unmodified lines | ||
| 654 | 654 | fte->action = *flow_act; |
| 655 | 655 | fte->flow_context = spec->flow_context; |
| 656 | 656 | |
| 657 | − tree_init_node(&fte->node, NULL, del_sw_fte); | |
| 657 | + tree_init_node(&fte->node, del_hw_fte, del_sw_fte); | |
| 658 | 658 | |
| 659 | 659 | return fte; |
| 660 | 660 | } |
| @@ -1792,7 +1792,6 @@ skip_search: · 1131 unmodified lines | ||
| 1792 | 1792 | up_write_ref_node(&g->node, false); |
| 1793 | 1793 | rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte); |
| 1794 | 1794 | up_write_ref_node(&fte->node, false); |
| 1795 | − tree_put_node(&fte->node, false); | |
| 1796 | 1795 | return rule; |
| 1797 | 1796 | } |
| 1798 | 1797 | rule = ERR_PTR(-ENOENT); |
| @@ -1891,7 +1890,6 @@ search_again_locked: · 92 unmodified lines | ||
| 1891 | 1890 | up_write_ref_node(&g->node, false); |
| 1892 | 1891 | rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte); |
| 1893 | 1892 | up_write_ref_node(&fte->node, false); |
| 1894 | − tree_put_node(&fte->node, false); | |
| 1895 | 1893 | tree_put_node(&g->node, false); |
| 1896 | 1894 | return rule; |
| 1897 | 1895 | |
| @@ -2001,7 +1999,9 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) · 103 unmodified lines | ||
| 2001 | 1999 | up_write_ref_node(&fte->node, false); |
| 2002 | 2000 | } else { |
| 2003 | 2001 | del_hw_fte(&fte->node); |
| 2004 | − up_write(&fte->node.lock); | |
| 2002 | + /* Avoid double call to del_hw_fte */ | |
| 2003 | + fte->node.del_hw_func = NULL; | |
| 2004 | + up_write_ref_node(&fte->node, false); | |
| 2005 | 2005 | tree_put_node(&fte->node, false); |
| 2006 | 2006 | } |
| 2007 | 2007 | kfree(handle); |
| @@ -421,10 +421,15 @@ int ocelot_port_add_txtstamp_skb(struct ocelot_port *ocelot_port, · 420 unmodified lines | ||
| 421 | 421 | |
| 422 | 422 | if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP && |
| 423 | 423 | ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) { |
| 424 | + spin_lock(&ocelot_port->ts_id_lock); | |
| 425 | + | |
| 424 | 426 | shinfo->tx_flags |= SKBTX_IN_PROGRESS; |
| 425 | 427 | /* Store timestamp ID in cb[0] of sk_buff */ |
| 426 | − skb->cb[0] = ocelot_port->ts_id % 4; | |
| 428 | + skb->cb[0] = ocelot_port->ts_id; | |
| 429 | + ocelot_port->ts_id = (ocelot_port->ts_id + 1) % 4; | |
| 427 | 430 | skb_queue_tail(&ocelot_port->tx_skbs, skb); |
| 431 | + | |
| 432 | + spin_unlock(&ocelot_port->ts_id_lock); | |
| 428 | 433 | return 0; |
| 429 | 434 | } |
| 430 | 435 | return -ENODATA; |
| @@ -1300,6 +1305,7 @@ void ocelot_init_port(struct ocelot *ocelot, int port) · 869 unmodified lines | ||
| 1300 | 1305 | struct ocelot_port *ocelot_port = ocelot->ports[port]; |
| 1301 | 1306 | |
| 1302 | 1307 | skb_queue_head_init(&ocelot_port->tx_skbs); |
| 1308 | + spin_lock_init(&ocelot_port->ts_id_lock); | |
| 1303 | 1309 | |
| 1304 | 1310 | /* Basic L2 initialization */ |
| 1305 | 1311 | |
| @@ -1544,18 +1550,18 @@ EXPORT_SYMBOL(ocelot_init); · 238 unmodified lines | ||
| 1544 | 1550 | |
| 1545 | 1551 | void ocelot_deinit(struct ocelot *ocelot) |
| 1546 | 1552 | { |
| 1547 | − struct ocelot_port *port; | |
| 1548 | − int i; | |
| 1549 | − | |
| 1550 | 1553 | cancel_delayed_work(&ocelot->stats_work); |
| 1551 | 1554 | destroy_workqueue(ocelot->stats_queue); |
| 1552 | 1555 | mutex_destroy(&ocelot->stats_lock); |
| 1553 | − | |
| 1554 | − for (i = 0; i < ocelot->num_phys_ports; i++) { | |
| 1555 | − port = ocelot->ports[i]; | |
| 1556 | − skb_queue_purge(&port->tx_skbs); | |
| 1557 | − } | |
| 1558 | 1556 | } |
| 1559 | 1557 | EXPORT_SYMBOL(ocelot_deinit); |
| 1560 | 1558 | |
| 1559 | +void ocelot_deinit_port(struct ocelot *ocelot, int port) | |
| 1560 | +{ | |
| 1561 | + struct ocelot_port *ocelot_port = ocelot->ports[port]; | |
| 1562 | + | |
| 1563 | + skb_queue_purge(&ocelot_port->tx_skbs); | |
| 1564 | +} | |
| 1565 | +EXPORT_SYMBOL(ocelot_deinit_port); | |
| 1566 | + | |
| 1561 | 1567 | MODULE_LICENSE("Dual MIT/GPL"); |
| @@ -330,6 +330,7 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev) · 329 unmodified lines | ||
| 330 | 330 | u8 grp = 0; /* Send everything on CPU group 0 */ |
| 331 | 331 | unsigned int i, count, last; |
| 332 | 332 | int port = priv->chip_port; |
| 333 | + bool do_tstamp; | |
| 333 | 334 | |
| 334 | 335 | val = ocelot_read(ocelot, QS_INJ_STATUS); |
| 335 | 336 | if (!(val & QS_INJ_STATUS_FIFO_RDY(BIT(grp))) || |
| @@ -344,10 +345,12 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev) · 8 unmodified lines | ||
| 344 | 345 | info.vid = skb_vlan_tag_get(skb); |
| 345 | 346 | |
| 346 | 347 | /* Check if timestamping is needed */ |
| 348 | + do_tstamp = (ocelot_port_add_txtstamp_skb(ocelot_port, skb) == 0); | |
| 349 | + | |
| 347 | 350 | if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP) { |
| 348 | 351 | info.rew_op = ocelot_port->ptp_cmd; |
| 349 | 352 | if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) |
| 350 | − info.rew_op |= (ocelot_port->ts_id % 4) << 3; | |
| 353 | + info.rew_op |= skb->cb[0] << 3; | |
| 351 | 354 | } |
| 352 | 355 | |
| 353 | 356 | ocelot_gen_ifh(ifh, &info); |
| @@ -380,12 +383,9 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev) · 26 unmodified lines | ||
| 380 | 383 | dev->stats.tx_packets++; |
| 381 | 384 | dev->stats.tx_bytes += skb->len; |
| 382 | 385 | |
| 383 | − if (!ocelot_port_add_txtstamp_skb(ocelot_port, skb)) { | |
| 384 | − ocelot_port->ts_id++; | |
| 385 | − return NETDEV_TX_OK; | |
| 386 | − } | |
| 386 | + if (!do_tstamp) | |
| 387 | + dev_kfree_skb_any(skb); | |
| 387 | 388 | |
| 388 | − dev_kfree_skb_any(skb); | |
| 389 | 389 | return NETDEV_TX_OK; |
| 390 | 390 | } |
| 391 | 391 | |
| @@ -806,17 +806,17 @@ static const struct vcap_field vsc7514_vcap_is2_keys[] = { · 805 unmodified lines | ||
| 806 | 806 | [VCAP_IS2_HK_DIP_EQ_SIP] = {123, 1}, |
| 807 | 807 | /* IP4_TCP_UDP (TYPE=100) */ |
| 808 | 808 | [VCAP_IS2_HK_TCP] = {124, 1}, |
| 809 | − [VCAP_IS2_HK_L4_SPORT] = {125, 16}, | |
| 810 | − [VCAP_IS2_HK_L4_DPORT] = {141, 16}, | |
| 809 | + [VCAP_IS2_HK_L4_DPORT] = {125, 16}, | |
| 810 | + [VCAP_IS2_HK_L4_SPORT] = {141, 16}, | |
| 811 | 811 | [VCAP_IS2_HK_L4_RNG] = {157, 8}, |
| 812 | 812 | [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {165, 1}, |
| 813 | 813 | [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {166, 1}, |
| 814 | − [VCAP_IS2_HK_L4_URG] = {167, 1}, | |
| 815 | − [VCAP_IS2_HK_L4_ACK] = {168, 1}, | |
| 816 | − [VCAP_IS2_HK_L4_PSH] = {169, 1}, | |
| 817 | − [VCAP_IS2_HK_L4_RST] = {170, 1}, | |
| 818 | − [VCAP_IS2_HK_L4_SYN] = {171, 1}, | |
| 819 | − [VCAP_IS2_HK_L4_FIN] = {172, 1}, | |
| 814 | + [VCAP_IS2_HK_L4_FIN] = {167, 1}, | |
| 815 | + [VCAP_IS2_HK_L4_SYN] = {168, 1}, | |
| 816 | + [VCAP_IS2_HK_L4_RST] = {169, 1}, | |
| 817 | + [VCAP_IS2_HK_L4_PSH] = {170, 1}, | |
| 818 | + [VCAP_IS2_HK_L4_ACK] = {171, 1}, | |
| 819 | + [VCAP_IS2_HK_L4_URG] = {172, 1}, | |
| 820 | 820 | [VCAP_IS2_HK_L4_1588_DOM] = {173, 8}, |
| 821 | 821 | [VCAP_IS2_HK_L4_1588_VER] = {181, 4}, |
| 822 | 822 | /* IP4_OTHER (TYPE=101) */ |
| @@ -896,11 +896,137 @@ static struct ptp_clock_info ocelot_ptp_clock_info = { · 73 unmodified lines | ||
| 896 | 896 | .enable = ocelot_ptp_enable, |
| 897 | 897 | }; |
| 898 | 898 | |
| 899 | +static void mscc_ocelot_release_ports(struct ocelot *ocelot) | |
| 900 | +{ | |
| 901 | + int port; | |
| 902 | + | |
| 903 | + for (port = 0; port < ocelot->num_phys_ports; port++) { | |
| 904 | + struct ocelot_port_private *priv; | |
| 905 | + struct ocelot_port *ocelot_port; | |
| 906 | + | |
| 907 | + ocelot_port = ocelot->ports[port]; | |
| 908 | + if (!ocelot_port) | |
| 909 | + continue; | |
| 910 | + | |
| 911 | + ocelot_deinit_port(ocelot, port); | |
| 912 | + | |
| 913 | + priv = container_of(ocelot_port, struct ocelot_port_private, | |
| 914 | + port); | |
| 915 | + | |
| 916 | + unregister_netdev(priv->dev); | |
| 917 | + free_netdev(priv->dev); | |
| 918 | + } | |
| 919 | +} | |
| 920 | + | |
| 921 | +static int mscc_ocelot_init_ports(struct platform_device *pdev, | |
| 922 | + struct device_node *ports) | |
| 923 | +{ | |
| 924 | + struct ocelot *ocelot = platform_get_drvdata(pdev); | |
| 925 | + struct device_node *portnp; | |
| 926 | + int err; | |
| 927 | + | |
| 928 | + ocelot->ports = devm_kcalloc(ocelot->dev, ocelot->num_phys_ports, | |
| 929 | + sizeof(struct ocelot_port *), GFP_KERNEL); | |
| 930 | + if (!ocelot->ports) | |
| 931 | + return -ENOMEM; | |
| 932 | + | |
| 933 | + /* No NPI port */ | |
| 934 | + ocelot_configure_cpu(ocelot, -1, OCELOT_TAG_PREFIX_NONE, | |
| 935 | + OCELOT_TAG_PREFIX_NONE); | |
| 936 | + | |
| 937 | + for_each_available_child_of_node(ports, portnp) { | |
| 938 | + struct ocelot_port_private *priv; | |
| 939 | + struct ocelot_port *ocelot_port; | |
| 940 | + struct device_node *phy_node; | |
| 941 | + phy_interface_t phy_mode; | |
| 942 | + struct phy_device *phy; | |
| 943 | + struct regmap *target; | |
| 944 | + struct resource *res; | |
| 945 | + struct phy *serdes; | |
| 946 | + char res_name[8]; | |
| 947 | + u32 port; | |
| 948 | + | |
| 949 | + if (of_property_read_u32(portnp, "reg", &port)) | |
| 950 | + continue; | |
| 951 | + | |
| 952 | + snprintf(res_name, sizeof(res_name), "port%d", port); | |
| 953 | + | |
| 954 | + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | |
| 955 | + res_name); | |
| 956 | + target = ocelot_regmap_init(ocelot, res); | |
| 957 | + if (IS_ERR(target)) | |
| 958 | + continue; | |
| 959 | + | |
| 960 | + phy_node = of_parse_phandle(portnp, "phy-handle", 0); | |
| 961 | + if (!phy_node) | |
| 962 | + continue; | |
| 963 | + | |
| 964 | + phy = of_phy_find_device(phy_node); | |
| 965 | + of_node_put(phy_node); | |
| 966 | + if (!phy) | |
| 967 | + continue; | |
| 968 | + | |
| 969 | + err = ocelot_probe_port(ocelot, port, target, phy); | |
| 970 | + if (err) { | |
| 971 | + of_node_put(portnp); | |
| 972 | + return err; | |
| 973 | + } | |
| 974 | + | |
| 975 | + ocelot_port = ocelot->ports[port]; | |
| 976 | + priv = container_of(ocelot_port, struct ocelot_port_private, | |
| 977 | + port); | |
| 978 | + | |
| 979 | + of_get_phy_mode(portnp, &phy_mode); | |
| 980 | + | |
| 981 | + ocelot_port->phy_mode = phy_mode; | |
| 982 | + | |
| 983 | + switch (ocelot_port->phy_mode) { | |
| 984 | + case PHY_INTERFACE_MODE_NA: | |
| 985 | + continue; | |
| 986 | + case PHY_INTERFACE_MODE_SGMII: | |
| 987 | + break; | |
| 988 | + case PHY_INTERFACE_MODE_QSGMII: | |
| 989 | + /* Ensure clock signals and speed is set on all | |
| 990 | + * QSGMII links | |
| 991 | + */ | |
| 992 | + ocelot_port_writel(ocelot_port, | |
| 993 | + DEV_CLOCK_CFG_LINK_SPEED | |
| 994 | + (OCELOT_SPEED_1000), | |
| 995 | + DEV_CLOCK_CFG); | |
| 996 | + break; | |
| 997 | + default: | |
| 998 | + dev_err(ocelot->dev, | |
| 999 | + "invalid phy mode for port%d, (Q)SGMII only\n", | |
| 1000 | + port); | |
| 1001 | + of_node_put(portnp); | |
| 1002 | + return -EINVAL; | |
| 1003 | + } | |
| 1004 | + | |
| 1005 | + serdes = devm_of_phy_get(ocelot->dev, portnp, NULL); | |
| 1006 | + if (IS_ERR(serdes)) { | |
| 1007 | + err = PTR_ERR(serdes); | |
| 1008 | + if (err == -EPROBE_DEFER) | |
| 1009 | + dev_dbg(ocelot->dev, "deferring probe\n"); | |
| 1010 | + else | |
| 1011 | + dev_err(ocelot->dev, | |
| 1012 | + "missing SerDes phys for port%d\n", | |
| 1013 | + port); | |
| 1014 | + | |
| 1015 | + of_node_put(portnp); | |
| 1016 | + return err; | |
| 1017 | + } | |
| 1018 | + | |
| 1019 | + priv->serdes = serdes; | |
| 1020 | + } | |
| 1021 | + | |
| 1022 | + return 0; | |
| 1023 | +} | |
| 1024 | + | |
| 899 | 1025 | static int mscc_ocelot_probe(struct platform_device *pdev) |
| 900 | 1026 | { |
| 901 | 1027 | struct device_node *np = pdev->dev.of_node; |
| 902 | − struct device_node *ports, *portnp; | |
| 903 | 1028 | int err, irq_xtr, irq_ptp_rdy; |
| 1029 | + struct device_node *ports; | |
| 904 | 1030 | struct ocelot *ocelot; |
| 905 | 1031 | struct regmap *hsio; |
| 906 | 1032 | unsigned int i; |
| @@ -985,20 +1111,24 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 78 unmodified lines | ||
| 985 | 1111 | |
| 986 | 1112 | ports = of_get_child_by_name(np, "ethernet-ports"); |
| 987 | 1113 | if (!ports) { |
| 988 | − dev_err(&pdev->dev, "no ethernet-ports child node found\n"); | |
| 1114 | + dev_err(ocelot->dev, "no ethernet-ports child node found\n"); | |
| 989 | 1115 | return -ENODEV; |
| 990 | 1116 | } |
| 991 | 1117 | |
| 992 | 1118 | ocelot->num_phys_ports = of_get_child_count(ports); |
| 993 | 1119 | |
| 994 | − ocelot->ports = devm_kcalloc(&pdev->dev, ocelot->num_phys_ports, | |
| 995 | − sizeof(struct ocelot_port *), GFP_KERNEL); | |
| 996 | − | |
| 997 | 1120 | ocelot->vcap_is2_keys = vsc7514_vcap_is2_keys; |
| 998 | 1121 | ocelot->vcap_is2_actions = vsc7514_vcap_is2_actions; |
| 999 | 1122 | ocelot->vcap = vsc7514_vcap_props; |
| 1000 | 1123 | |
| 1001 | − ocelot_init(ocelot); | |
| 1124 | + err = ocelot_init(ocelot); | |
| 1125 | + if (err) | |
| 1126 | + goto out_put_ports; | |
| 1127 | + | |
| 1128 | + err = mscc_ocelot_init_ports(pdev, ports); | |
| 1129 | + if (err) | |
| 1130 | + goto out_put_ports; | |
| 1131 | + | |
| 1002 | 1132 | if (ocelot->ptp) { |
| 1003 | 1133 | err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info); |
| 1004 | 1134 | if (err) { |
| @@ -1008,96 +1138,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 3 unmodified lines | ||
| 1008 | 1138 | } |
| 1009 | 1139 | } |
| 1010 | 1140 | |
| 1011 | − /* No NPI port */ | |
| 1012 | − ocelot_configure_cpu(ocelot, -1, OCELOT_TAG_PREFIX_NONE, | |
| 1013 | − OCELOT_TAG_PREFIX_NONE); | |
| 1014 | − | |
| 1015 | − for_each_available_child_of_node(ports, portnp) { | |
| 1016 | − struct ocelot_port_private *priv; | |
| 1017 | − struct ocelot_port *ocelot_port; | |
| 1018 | − struct device_node *phy_node; | |
| 1019 | − phy_interface_t phy_mode; | |
| 1020 | − struct phy_device *phy; | |
| 1021 | − struct regmap *target; | |
| 1022 | − struct resource *res; | |
| 1023 | − struct phy *serdes; | |
| 1024 | − char res_name[8]; | |
| 1025 | − u32 port; | |
| 1026 | − | |
| 1027 | − if (of_property_read_u32(portnp, "reg", &port)) | |
| 1028 | − continue; | |
| 1029 | − | |
| 1030 | − snprintf(res_name, sizeof(res_name), "port%d", port); | |
| 1031 | − | |
| 1032 | − res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | |
| 1033 | − res_name); | |
| 1034 | − target = ocelot_regmap_init(ocelot, res); | |
| 1035 | − if (IS_ERR(target)) | |
| 1036 | − continue; | |
| 1037 | − | |
| 1038 | − phy_node = of_parse_phandle(portnp, "phy-handle", 0); | |
| 1039 | − if (!phy_node) | |
| 1040 | − continue; | |
| 1041 | − | |
| 1042 | − phy = of_phy_find_device(phy_node); | |
| 1043 | − of_node_put(phy_node); | |
| 1044 | − if (!phy) | |
| 1045 | − continue; | |
| 1046 | − | |
| 1047 | − err = ocelot_probe_port(ocelot, port, target, phy); | |
| 1048 | − if (err) { | |
| 1049 | − of_node_put(portnp); | |
| 1050 | − goto out_put_ports; | |
| 1051 | − } | |
| 1052 | − | |
| 1053 | − ocelot_port = ocelot->ports[port]; | |
| 1054 | − priv = container_of(ocelot_port, struct ocelot_port_private, | |
| 1055 | − port); | |
| 1056 | − | |
| 1057 | − of_get_phy_mode(portnp, &phy_mode); | |
| 1058 | − | |
| 1059 | − ocelot_port->phy_mode = phy_mode; | |
| 1060 | − | |
| 1061 | − switch (ocelot_port->phy_mode) { | |
| 1062 | − case PHY_INTERFACE_MODE_NA: | |
| 1063 | − continue; | |
| 1064 | − case PHY_INTERFACE_MODE_SGMII: | |
| 1065 | − break; | |
| 1066 | − case PHY_INTERFACE_MODE_QSGMII: | |
| 1067 | − /* Ensure clock signals and speed is set on all | |
| 1068 | − * QSGMII links | |
| 1069 | − */ | |
| 1070 | − ocelot_port_writel(ocelot_port, | |
| 1071 | − DEV_CLOCK_CFG_LINK_SPEED | |
| 1072 | − (OCELOT_SPEED_1000), | |
| 1073 | − DEV_CLOCK_CFG); | |
| 1074 | − break; | |
| 1075 | − default: | |
| 1076 | − dev_err(ocelot->dev, | |
| 1077 | − "invalid phy mode for port%d, (Q)SGMII only\n", | |
| 1078 | − port); | |
| 1079 | − of_node_put(portnp); | |
| 1080 | − err = -EINVAL; | |
| 1081 | − goto out_put_ports; | |
| 1082 | − } | |
| 1083 | − | |
| 1084 | − serdes = devm_of_phy_get(ocelot->dev, portnp, NULL); | |
| 1085 | − if (IS_ERR(serdes)) { | |
| 1086 | − err = PTR_ERR(serdes); | |
| 1087 | − if (err == -EPROBE_DEFER) | |
| 1088 | − dev_dbg(ocelot->dev, "deferring probe\n"); | |
| 1089 | − else | |
| 1090 | − dev_err(ocelot->dev, | |
| 1091 | − "missing SerDes phys for port%d\n", | |
| 1092 | − port); | |
| 1093 | − | |
| 1094 | − of_node_put(portnp); | |
| 1095 | − goto out_put_ports; | |
| 1096 | − } | |
| 1097 | − | |
| 1098 | − priv->serdes = serdes; | |
| 1099 | − } | |
| 1100 | − | |
| 1101 | 1141 | register_netdevice_notifier(&ocelot_netdevice_nb); |
| 1102 | 1142 | register_switchdev_notifier(&ocelot_switchdev_nb); |
| 1103 | 1143 | register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb); |
| @@ -1114,6 +1154,7 @@ static int mscc_ocelot_remove(struct platform_device *pdev) · 10 unmodified lines | ||
| 1114 | 1154 | struct ocelot *ocelot = platform_get_drvdata(pdev); |
| 1115 | 1155 | |
| 1116 | 1156 | ocelot_deinit_timestamp(ocelot); |
| 1157 | + mscc_ocelot_release_ports(ocelot); | |
| 1117 | 1158 | ocelot_deinit(ocelot); |
| 1118 | 1159 | unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb); |
| 1119 | 1160 | unregister_switchdev_notifier(&ocelot_switchdev_nb); |
| @@ -829,8 +829,8 @@ nfp_port_get_fecparam(struct net_device *netdev, · 828 unmodified lines | ||
| 829 | 829 | struct nfp_eth_table_port *eth_port; |
| 830 | 830 | struct nfp_port *port; |
| 831 | 831 | |
| 832 | − param->active_fec = ETHTOOL_FEC_NONE_BIT; | |
| 833 | − param->fec = ETHTOOL_FEC_NONE_BIT; | |
| 832 | + param->active_fec = ETHTOOL_FEC_NONE; | |
| 833 | + param->fec = ETHTOOL_FEC_NONE; | |
| 834 | 834 | |
| 835 | 835 | port = nfp_port_from_netdev(netdev); |
| 836 | 836 | eth_port = nfp_port_get_eth_port(port); |
| @@ -4253,7 +4253,8 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) · 4252 unmodified lines | ||
| 4253 | 4253 | cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) | |
| 4254 | 4254 | BIT(QED_MF_LLH_PROTO_CLSS) | |
| 4255 | 4255 | BIT(QED_MF_LL2_NON_UNICAST) | |
| 4256 | − BIT(QED_MF_INTER_PF_SWITCH); | |
| 4256 | + BIT(QED_MF_INTER_PF_SWITCH) | | |
| 4257 | + BIT(QED_MF_DISABLE_ARFS); | |
| 4257 | 4258 | break; |
| 4258 | 4259 | case NVM_CFG1_GLOB_MF_MODE_DEFAULT: |
| 4259 | 4260 | cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) | |
| @@ -4266,6 +4267,14 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) · 6 unmodified lines | ||
| 4266 | 4267 | |
| 4267 | 4268 | DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n", |
| 4268 | 4269 | cdev->mf_bits); |
| 4270 | + | |
| 4271 | + /* In CMT the PF is unknown when the GFS block processes the | |
| 4272 | + * packet. Therefore cannot use searcher as it has a per PF | |
| 4273 | + * database, and thus ARFS must be disabled. | |
| 4274 | + * | |
| 4275 | + */ | |
| 4276 | + if (QED_IS_CMT(cdev)) | |
| 4277 | + cdev->mf_bits |= BIT(QED_MF_DISABLE_ARFS); | |
| 4269 | 4278 | } |
| 4270 | 4279 | |
| 4271 | 4280 | DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n", |
| @@ -1980,6 +1980,9 @@ void qed_arfs_mode_configure(struct qed_hwfn *p_hwfn, · 1979 unmodified lines | ||
| 1980 | 1980 | struct qed_ptt *p_ptt, |
| 1981 | 1981 | struct qed_arfs_config_params *p_cfg_params) |
| 1982 | 1982 | { |
| 1983 | + if (test_bit(QED_MF_DISABLE_ARFS, &p_hwfn->cdev->mf_bits)) | |
| 1984 | + return; | |
| 1985 | + | |
| 1983 | 1986 | if (p_cfg_params->mode != QED_FILTER_CONFIG_MODE_DISABLE) { |
| 1984 | 1987 | qed_gft_config(p_hwfn, p_ptt, p_hwfn->rel_pf_id, |
| 1985 | 1988 | p_cfg_params->tcp, |
| @@ -444,6 +444,8 @@ int qed_fill_dev_info(struct qed_dev *cdev, · 443 unmodified lines | ||
| 444 | 444 | dev_info->fw_eng = FW_ENGINEERING_VERSION; |
| 445 | 445 | dev_info->b_inter_pf_switch = test_bit(QED_MF_INTER_PF_SWITCH, |
| 446 | 446 | &cdev->mf_bits); |
| 447 | + if (!test_bit(QED_MF_DISABLE_ARFS, &cdev->mf_bits)) | |
| 448 | + dev_info->b_arfs_capable = true; | |
| 447 | 449 | dev_info->tx_switching = true; |
| 448 | 450 | |
| 449 | 451 | if (hw_info->b_wol_support == QED_WOL_SUPPORT_PME) |
| @@ -71,6 +71,7 @@ static int qed_sp_vf_start(struct qed_hwfn *p_hwfn, struct qed_vf_info *p_vf) · 70 unmodified lines | ||
| 71 | 71 | p_ramrod->personality = PERSONALITY_ETH; |
| 72 | 72 | break; |
| 73 | 73 | case QED_PCI_ETH_ROCE: |
| 74 | + case QED_PCI_ETH_IWARP: | |
| 74 | 75 | p_ramrod->personality = PERSONALITY_RDMA_AND_ETH; |
| 75 | 76 | break; |
| 76 | 77 | default: |
| @@ -311,6 +311,9 @@ int qede_alloc_arfs(struct qede_dev *edev) · 310 unmodified lines | ||
| 311 | 311 | { |
| 312 | 312 | int i; |
| 313 | 313 | |
| 314 | + if (!edev->dev_info.common.b_arfs_capable) | |
| 315 | + return -EINVAL; | |
| 316 | + | |
| 314 | 317 | edev->arfs = vzalloc(sizeof(*edev->arfs)); |
| 315 | 318 | if (!edev->arfs) |
| 316 | 319 | return -ENOMEM; |
| @@ -804,7 +804,7 @@ static void qede_init_ndev(struct qede_dev *edev) · 803 unmodified lines | ||
| 804 | 804 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
| 805 | 805 | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC; |
| 806 | 806 | |
| 807 | − if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) | |
| 807 | + if (edev->dev_info.common.b_arfs_capable) | |
| 808 | 808 | hw_features |= NETIF_F_NTUPLE; |
| 809 | 809 | |
| 810 | 810 | if (edev->dev_info.common.vxlan_enable || |
| @@ -2274,7 +2274,7 @@ static void qede_unload(struct qede_dev *edev, enum qede_unload_mode mode, · 1463 unmodified lines | ||
| 2274 | 2274 | qede_vlan_mark_nonconfigured(edev); |
| 2275 | 2275 | edev->ops->fastpath_stop(edev->cdev); |
| 2276 | 2276 | |
| 2277 | − if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) { | |
| 2277 | + if (edev->dev_info.common.b_arfs_capable) { | |
| 2278 | 2278 | qede_poll_for_freeing_arfs_filters(edev); |
| 2279 | 2279 | qede_free_arfs(edev); |
| 2280 | 2280 | } |
| @@ -2341,10 +2341,9 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode, · 60 unmodified lines | ||
| 2341 | 2341 | if (rc) |
| 2342 | 2342 | goto err2; |
| 2343 | 2343 | |
| 2344 | − if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) { | |
| 2345 | − rc = qede_alloc_arfs(edev); | |
| 2346 | − if (rc) | |
| 2347 | − DP_NOTICE(edev, "aRFS memory allocation failed\n"); | |
| 2344 | + if (qede_alloc_arfs(edev)) { | |
| 2345 | + edev->ndev->features &= ~NETIF_F_NTUPLE; | |
| 2346 | + edev->dev_info.common.b_arfs_capable = false; | |
| 2348 | 2347 | } |
| 2349 | 2348 | |
| 2350 | 2349 | qede_napi_add_enable(edev); |
| @@ -490,6 +490,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev, · 489 unmodified lines | ||
| 490 | 490 | if (fcw.offset > pci_resource_len(efx->pci_dev, fcw.bar) - ESE_GZ_FCW_LEN) { |
| 491 | 491 | netif_err(efx, probe, efx->net_dev, |
| 492 | 492 | "Func control window overruns BAR\n"); |
| 493 | + rc = -EIO; | |
| 493 | 494 | goto fail; |
| 494 | 495 | } |
| 495 | 496 | |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <linux/phy.h> |
| 18 | 18 | #include <linux/phy/phy.h> |
| 19 | 19 | #include <linux/delay.h> |
| 20 | +#include <linux/pinctrl/consumer.h> | |
| 20 | 21 | #include <linux/pm_runtime.h> |
| 21 | 22 | #include <linux/gpio/consumer.h> |
| 22 | 23 | #include <linux/of.h> |
| @@ -2070,9 +2071,61 @@ static int cpsw_remove(struct platform_device *pdev) · 2047 unmodified lines | ||
| 2070 | 2071 | return 0; |
| 2071 | 2072 | } |
| 2072 | 2073 | |
| 2074 | +static int __maybe_unused cpsw_suspend(struct device *dev) | |
| 2075 | +{ | |
| 2076 | + struct cpsw_common *cpsw = dev_get_drvdata(dev); | |
| 2077 | + int i; | |
| 2078 | + | |
| 2079 | + rtnl_lock(); | |
| 2080 | + | |
| 2081 | + for (i = 0; i < cpsw->data.slaves; i++) { | |
| 2082 | + struct net_device *ndev = cpsw->slaves[i].ndev; | |
| 2083 | + | |
| 2084 | + if (!(ndev && netif_running(ndev))) | |
| 2085 | + continue; | |
| 2086 | + | |
| 2087 | + cpsw_ndo_stop(ndev); | |
| 2088 | + } | |
| 2089 | + | |
| 2090 | + rtnl_unlock(); | |
| 2091 | + | |
| 2092 | + /* Select sleep pin state */ | |
| 2093 | + pinctrl_pm_select_sleep_state(dev); | |
| 2094 | + | |
| 2095 | + return 0; | |
| 2096 | +} | |
| 2097 | + | |
| 2098 | +static int __maybe_unused cpsw_resume(struct device *dev) | |
| 2099 | +{ | |
| 2100 | + struct cpsw_common *cpsw = dev_get_drvdata(dev); | |
| 2101 | + int i; | |
| 2102 | + | |
| 2103 | + /* Select default pin state */ | |
| 2104 | + pinctrl_pm_select_default_state(dev); | |
| 2105 | + | |
| 2106 | + /* shut up ASSERT_RTNL() warning in netif_set_real_num_tx/rx_queues */ | |
| 2107 | + rtnl_lock(); | |
| 2108 | + | |
| 2109 | + for (i = 0; i < cpsw->data.slaves; i++) { | |
| 2110 | + struct net_device *ndev = cpsw->slaves[i].ndev; | |
| 2111 | + | |
| 2112 | + if (!(ndev && netif_running(ndev))) | |
| 2113 | + continue; | |
| 2114 | + | |
| 2115 | + cpsw_ndo_open(ndev); | |
| 2116 | + } | |
| 2117 | + | |
| 2118 | + rtnl_unlock(); | |
| 2119 | + | |
| 2120 | + return 0; | |
| 2121 | +} | |
| 2122 | + | |
| 2123 | +static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume); | |
| 2124 | + | |
| 2073 | 2125 | static struct platform_driver cpsw_driver = { |
| 2074 | 2126 | .driver = { |
| 2075 | 2127 | .name = "cpsw-switch", |
| 2128 | + .pm = &cpsw_pm_ops, | |
| 2076 | 2129 | .of_match_table = cpsw_of_mtable, |
| 2077 | 2130 | }, |
| 2078 | 2131 | .probe = cpsw_probe, |
| @@ -777,7 +777,8 @@ static struct rtable *geneve_get_v4_rt(struct sk_buff *skb, · 776 unmodified lines | ||
| 777 | 777 | struct net_device *dev, |
| 778 | 778 | struct geneve_sock *gs4, |
| 779 | 779 | struct flowi4 *fl4, |
| 780 | − const struct ip_tunnel_info *info) | |
| 780 | + const struct ip_tunnel_info *info, | |
| 781 | + __be16 dport, __be16 sport) | |
| 781 | 782 | { |
| 782 | 783 | bool use_cache = ip_tunnel_dst_cache_usable(skb, info); |
| 783 | 784 | struct geneve_dev *geneve = netdev_priv(dev); |
| @@ -793,6 +794,8 @@ static struct rtable *geneve_get_v4_rt(struct sk_buff *skb, · 9 unmodified lines | ||
| 793 | 794 | fl4->flowi4_proto = IPPROTO_UDP; |
| 794 | 795 | fl4->daddr = info->key.u.ipv4.dst; |
| 795 | 796 | fl4->saddr = info->key.u.ipv4.src; |
| 797 | + fl4->fl4_dport = dport; | |
| 798 | + fl4->fl4_sport = sport; | |
| 796 | 799 | |
| 797 | 800 | tos = info->key.tos; |
| 798 | 801 | if ((tos == 1) && !geneve->cfg.collect_md) { |
| @@ -827,7 +830,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, · 28 unmodified lines | ||
| 827 | 830 | struct net_device *dev, |
| 828 | 831 | struct geneve_sock *gs6, |
| 829 | 832 | struct flowi6 *fl6, |
| 830 | − const struct ip_tunnel_info *info) | |
| 833 | + const struct ip_tunnel_info *info, | |
| 834 | + __be16 dport, __be16 sport) | |
| 831 | 835 | { |
| 832 | 836 | bool use_cache = ip_tunnel_dst_cache_usable(skb, info); |
| 833 | 837 | struct geneve_dev *geneve = netdev_priv(dev); |
| @@ -843,6 +847,9 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, · 9 unmodified lines | ||
| 843 | 847 | fl6->flowi6_proto = IPPROTO_UDP; |
| 844 | 848 | fl6->daddr = info->key.u.ipv6.dst; |
| 845 | 849 | fl6->saddr = info->key.u.ipv6.src; |
| 850 | + fl6->fl6_dport = dport; | |
| 851 | + fl6->fl6_sport = sport; | |
| 852 | + | |
| 846 | 853 | prio = info->key.tos; |
| 847 | 854 | if ((prio == 1) && !geneve->cfg.collect_md) { |
| 848 | 855 | prio = ip_tunnel_get_dsfield(ip_hdr(skb), skb); |
| @@ -889,7 +896,9 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 40 unmodified lines | ||
| 889 | 896 | __be16 sport; |
| 890 | 897 | int err; |
| 891 | 898 | |
| 892 | − rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info); | |
| 899 | + sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); | |
| 900 | + rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info, | |
| 901 | + geneve->cfg.info.key.tp_dst, sport); | |
| 893 | 902 | if (IS_ERR(rt)) |
| 894 | 903 | return PTR_ERR(rt); |
| 895 | 904 | |
| @@ -919,7 +928,6 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 23 unmodified lines | ||
| 919 | 928 | return -EMSGSIZE; |
| 920 | 929 | } |
| 921 | 930 | |
| 922 | − sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); | |
| 923 | 931 | if (geneve->cfg.collect_md) { |
| 924 | 932 | tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb); |
| 925 | 933 | ttl = key->ttl; |
| @@ -974,7 +982,9 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 48 unmodified lines | ||
| 974 | 982 | __be16 sport; |
| 975 | 983 | int err; |
| 976 | 984 | |
| 977 | − dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info); | |
| 985 | + sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); | |
| 986 | + dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info, | |
| 987 | + geneve->cfg.info.key.tp_dst, sport); | |
| 978 | 988 | if (IS_ERR(dst)) |
| 979 | 989 | return PTR_ERR(dst); |
| 980 | 990 | |
| @@ -1003,7 +1013,6 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 22 unmodified lines | ||
| 1003 | 1013 | return -EMSGSIZE; |
| 1004 | 1014 | } |
| 1005 | 1015 | |
| 1006 | − sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); | |
| 1007 | 1016 | if (geneve->cfg.collect_md) { |
| 1008 | 1017 | prio = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb); |
| 1009 | 1018 | ttl = key->ttl; |
| @@ -1085,13 +1094,18 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 75 unmodified lines | ||
| 1085 | 1094 | { |
| 1086 | 1095 | struct ip_tunnel_info *info = skb_tunnel_info(skb); |
| 1087 | 1096 | struct geneve_dev *geneve = netdev_priv(dev); |
| 1097 | + __be16 sport; | |
| 1088 | 1098 | |
| 1089 | 1099 | if (ip_tunnel_info_af(info) == AF_INET) { |
| 1090 | 1100 | struct rtable *rt; |
| 1091 | 1101 | struct flowi4 fl4; |
| 1102 | + | |
| 1092 | 1103 | struct geneve_sock *gs4 = rcu_dereference(geneve->sock4); |
| 1104 | + sport = udp_flow_src_port(geneve->net, skb, | |
| 1105 | + 1, USHRT_MAX, true); | |
| 1093 | 1106 | |
| 1094 | − rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info); | |
| 1107 | + rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info, | |
| 1108 | + geneve->cfg.info.key.tp_dst, sport); | |
| 1095 | 1109 | if (IS_ERR(rt)) |
| 1096 | 1110 | return PTR_ERR(rt); |
| 1097 | 1111 | |
| @@ -1101,9 +1115,13 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 3 unmodified lines | ||
| 1101 | 1115 | } else if (ip_tunnel_info_af(info) == AF_INET6) { |
| 1102 | 1116 | struct dst_entry *dst; |
| 1103 | 1117 | struct flowi6 fl6; |
| 1118 | + | |
| 1104 | 1119 | struct geneve_sock *gs6 = rcu_dereference(geneve->sock6); |
| 1120 | + sport = udp_flow_src_port(geneve->net, skb, | |
| 1121 | + 1, USHRT_MAX, true); | |
| 1105 | 1122 | |
| 1106 | − dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info); | |
| 1123 | + dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info, | |
| 1124 | + geneve->cfg.info.key.tp_dst, sport); | |
| 1107 | 1125 | if (IS_ERR(dst)) |
| 1108 | 1126 | return PTR_ERR(dst); |
| 1109 | 1127 | |
| @@ -1114,8 +1132,7 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 4 unmodified lines | ||
| 1114 | 1132 | return -EINVAL; |
| 1115 | 1133 | } |
| 1116 | 1134 | |
| 1117 | − info->key.tp_src = udp_flow_src_port(geneve->net, skb, | |
| 1118 | − 1, USHRT_MAX, true); | |
| 1135 | + info->key.tp_src = sport; | |
| 1119 | 1136 | info->key.tp_dst = geneve->cfg.info.key.tp_dst; |
| 1120 | 1137 | return 0; |
| 1121 | 1138 | } |
| @@ -847,6 +847,10 @@ struct nvsp_message { · 846 unmodified lines | ||
| 847 | 847 | |
| 848 | 848 | #define NETVSC_XDP_HDRM 256 |
| 849 | 849 | |
| 850 | +#define NETVSC_XFER_HEADER_SIZE(rng_cnt) \ | |
| 851 | + (offsetof(struct vmtransfer_page_packet_header, ranges) + \ | |
| 852 | + (rng_cnt) * sizeof(struct vmtransfer_page_range)) | |
| 853 | + | |
| 850 | 854 | struct multi_send_data { |
| 851 | 855 | struct sk_buff *skb; /* skb containing the pkt */ |
| 852 | 856 | struct hv_netvsc_packet *pkt; /* netvsc pkt pending */ |
| @@ -974,6 +978,9 @@ struct net_device_context { · 121 unmodified lines | ||
| 974 | 978 | /* Serial number of the VF to team with */ |
| 975 | 979 | u32 vf_serial; |
| 976 | 980 | |
| 981 | + /* Is the current data path through the VF NIC? */ | |
| 982 | + bool data_path_is_vf; | |
| 983 | + | |
| 977 | 984 | /* Used to temporarily save the config info across hibernation */ |
| 978 | 985 | struct netvsc_device_info *saved_netvsc_dev_info; |
| 979 | 986 | }; |
| @@ -388,6 +388,15 @@ static int netvsc_init_buf(struct hv_device *device, · 387 unmodified lines | ||
| 388 | 388 | net_device->recv_section_size = resp->sections[0].sub_alloc_size; |
| 389 | 389 | net_device->recv_section_cnt = resp->sections[0].num_sub_allocs; |
| 390 | 390 | |
| 391 | + /* Ensure buffer will not overflow */ | |
| 392 | + if (net_device->recv_section_size < NETVSC_MTU_MIN || (u64)net_device->recv_section_size * | |
| 393 | + (u64)net_device->recv_section_cnt > (u64)buf_size) { | |
| 394 | + netdev_err(ndev, "invalid recv_section_size %u\n", | |
| 395 | + net_device->recv_section_size); | |
| 396 | + ret = -EINVAL; | |
| 397 | + goto cleanup; | |
| 398 | + } | |
| 399 | + | |
| 391 | 400 | /* Setup receive completion ring. |
| 392 | 401 | * Add 1 to the recv_section_cnt because at least one entry in a |
| 393 | 402 | * ring buffer has to be empty. |
| @@ -460,6 +469,12 @@ static int netvsc_init_buf(struct hv_device *device, · 66 unmodified lines | ||
| 460 | 469 | /* Parse the response */ |
| 461 | 470 | net_device->send_section_size = init_packet->msg. |
| 462 | 471 | v1_msg.send_send_buf_complete.section_size; |
| 472 | + if (net_device->send_section_size < NETVSC_MTU_MIN) { | |
| 473 | + netdev_err(ndev, "invalid send_section_size %u\n", | |
| 474 | + net_device->send_section_size); | |
| 475 | + ret = -EINVAL; | |
| 476 | + goto cleanup; | |
| 477 | + } | |
| 463 | 478 | |
| 464 | 479 | /* Section count is simply the size divided by the section size. */ |
| 465 | 480 | net_device->send_section_cnt = buf_size / net_device->send_section_size; |
| @@ -731,12 +746,49 @@ static void netvsc_send_completion(struct net_device *ndev, · 265 unmodified lines | ||
| 731 | 746 | int budget) |
| 732 | 747 | { |
| 733 | 748 | const struct nvsp_message *nvsp_packet = hv_pkt_data(desc); |
| 749 | + u32 msglen = hv_pkt_datalen(desc); | |
| 750 | + | |
| 751 | + /* Ensure packet is big enough to read header fields */ | |
| 752 | + if (msglen < sizeof(struct nvsp_message_header)) { | |
| 753 | + netdev_err(ndev, "nvsp_message length too small: %u\n", msglen); | |
| 754 | + return; | |
| 755 | + } | |
| 734 | 756 | |
| 735 | 757 | switch (nvsp_packet->hdr.msg_type) { |
| 736 | 758 | case NVSP_MSG_TYPE_INIT_COMPLETE: |
| 759 | + if (msglen < sizeof(struct nvsp_message_header) + | |
| 760 | + sizeof(struct nvsp_message_init_complete)) { | |
| 761 | + netdev_err(ndev, "nvsp_msg length too small: %u\n", | |
| 762 | + msglen); | |
| 763 | + return; | |
| 764 | + } | |
| 765 | + fallthrough; | |
| 766 | + | |
| 737 | 767 | case NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE: |
| 768 | + if (msglen < sizeof(struct nvsp_message_header) + | |
| 769 | + sizeof(struct nvsp_1_message_send_receive_buffer_complete)) { | |
| 770 | + netdev_err(ndev, "nvsp_msg1 length too small: %u\n", | |
| 771 | + msglen); | |
| 772 | + return; | |
| 773 | + } | |
| 774 | + fallthrough; | |
| 775 | + | |
| 738 | 776 | case NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE: |
| 777 | + if (msglen < sizeof(struct nvsp_message_header) + | |
| 778 | + sizeof(struct nvsp_1_message_send_send_buffer_complete)) { | |
| 779 | + netdev_err(ndev, "nvsp_msg1 length too small: %u\n", | |
| 780 | + msglen); | |
| 781 | + return; | |
| 782 | + } | |
| 783 | + fallthrough; | |
| 784 | + | |
| 739 | 785 | case NVSP_MSG5_TYPE_SUBCHANNEL: |
| 786 | + if (msglen < sizeof(struct nvsp_message_header) + | |
| 787 | + sizeof(struct nvsp_5_subchannel_complete)) { | |
| 788 | + netdev_err(ndev, "nvsp_msg5 length too small: %u\n", | |
| 789 | + msglen); | |
| 790 | + return; | |
| 791 | + } | |
| 740 | 792 | /* Copy the response back */ |
| 741 | 793 | memcpy(&net_device->channel_init_pkt, nvsp_packet, |
| 742 | 794 | sizeof(struct nvsp_message)); |
| @@ -1117,19 +1169,28 @@ static void enq_receive_complete(struct net_device *ndev, · 374 unmodified lines | ||
| 1117 | 1169 | static int netvsc_receive(struct net_device *ndev, |
| 1118 | 1170 | struct netvsc_device *net_device, |
| 1119 | 1171 | struct netvsc_channel *nvchan, |
| 1120 | − const struct vmpacket_descriptor *desc, | |
| 1121 | − const struct nvsp_message *nvsp) | |
| 1172 | + const struct vmpacket_descriptor *desc) | |
| 1122 | 1173 | { |
| 1123 | 1174 | struct net_device_context *net_device_ctx = netdev_priv(ndev); |
| 1124 | 1175 | struct vmbus_channel *channel = nvchan->channel; |
| 1125 | 1176 | const struct vmtransfer_page_packet_header *vmxferpage_packet |
| 1126 | 1177 | = container_of(desc, const struct vmtransfer_page_packet_header, d); |
| 1178 | + const struct nvsp_message *nvsp = hv_pkt_data(desc); | |
| 1179 | + u32 msglen = hv_pkt_datalen(desc); | |
| 1127 | 1180 | u16 q_idx = channel->offermsg.offer.sub_channel_index; |
| 1128 | 1181 | char *recv_buf = net_device->recv_buf; |
| 1129 | 1182 | u32 status = NVSP_STAT_SUCCESS; |
| 1130 | 1183 | int i; |
| 1131 | 1184 | int count = 0; |
| 1132 | 1185 | |
| 1186 | + /* Ensure packet is big enough to read header fields */ | |
| 1187 | + if (msglen < sizeof(struct nvsp_message_header)) { | |
| 1188 | + netif_err(net_device_ctx, rx_err, ndev, | |
| 1189 | + "invalid nvsp header, length too small: %u\n", | |
| 1190 | + msglen); | |
| 1191 | + return 0; | |
| 1192 | + } | |
| 1193 | + | |
| 1133 | 1194 | /* Make sure this is a valid nvsp packet */ |
| 1134 | 1195 | if (unlikely(nvsp->hdr.msg_type != NVSP_MSG1_TYPE_SEND_RNDIS_PKT)) { |
| 1135 | 1196 | netif_err(net_device_ctx, rx_err, ndev, |
| @@ -1138,6 +1199,14 @@ static int netvsc_receive(struct net_device *ndev, · 2 unmodified lines | ||
| 1138 | 1199 | return 0; |
| 1139 | 1200 | } |
| 1140 | 1201 | |
| 1202 | + /* Validate xfer page pkt header */ | |
| 1203 | + if ((desc->offset8 << 3) < sizeof(struct vmtransfer_page_packet_header)) { | |
| 1204 | + netif_err(net_device_ctx, rx_err, ndev, | |
| 1205 | + "Invalid xfer page pkt, offset too small: %u\n", | |
| 1206 | + desc->offset8 << 3); | |
| 1207 | + return 0; | |
| 1208 | + } | |
| 1209 | + | |
| 1141 | 1210 | if (unlikely(vmxferpage_packet->xfer_pageset_id != NETVSC_RECEIVE_BUFFER_ID)) { |
| 1142 | 1211 | netif_err(net_device_ctx, rx_err, ndev, |
| 1143 | 1212 | "Invalid xfer page set id - expecting %x got %x\n", |
| @@ -1148,6 +1217,14 @@ static int netvsc_receive(struct net_device *ndev, · 4 unmodified lines | ||
| 1148 | 1217 | |
| 1149 | 1218 | count = vmxferpage_packet->range_cnt; |
| 1150 | 1219 | |
| 1220 | + /* Check count for a valid value */ | |
| 1221 | + if (NETVSC_XFER_HEADER_SIZE(count) > desc->offset8 << 3) { | |
| 1222 | + netif_err(net_device_ctx, rx_err, ndev, | |
| 1223 | + "Range count is not valid: %d\n", | |
| 1224 | + count); | |
| 1225 | + return 0; | |
| 1226 | + } | |
| 1227 | + | |
| 1151 | 1228 | /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */ |
| 1152 | 1229 | for (i = 0; i < count; i++) { |
| 1153 | 1230 | u32 offset = vmxferpage_packet->ranges[i].byte_offset; |
| @@ -1155,7 +1232,8 @@ static int netvsc_receive(struct net_device *ndev, · 1 unmodified line | ||
| 1155 | 1232 | void *data; |
| 1156 | 1233 | int ret; |
| 1157 | 1234 | |
| 1158 | − if (unlikely(offset + buflen > net_device->recv_buf_size)) { | |
| 1235 | + if (unlikely(offset > net_device->recv_buf_size || | |
| 1236 | + buflen > net_device->recv_buf_size - offset)) { | |
| 1159 | 1237 | nvchan->rsc.cnt = 0; |
| 1160 | 1238 | status = NVSP_STAT_FAIL; |
| 1161 | 1239 | netif_err(net_device_ctx, rx_err, ndev, |
| @@ -1194,6 +1272,13 @@ static void netvsc_send_table(struct net_device *ndev, · 32 unmodified lines | ||
| 1194 | 1272 | u32 count, offset, *tab; |
| 1195 | 1273 | int i; |
| 1196 | 1274 | |
| 1275 | + /* Ensure packet is big enough to read send_table fields */ | |
| 1276 | + if (msglen < sizeof(struct nvsp_message_header) + | |
| 1277 | + sizeof(struct nvsp_5_send_indirect_table)) { | |
| 1278 | + netdev_err(ndev, "nvsp_v5_msg length too small: %u\n", msglen); | |
| 1279 | + return; | |
| 1280 | + } | |
| 1281 | + | |
| 1197 | 1282 | count = nvmsg->msg.v5_msg.send_table.count; |
| 1198 | 1283 | offset = nvmsg->msg.v5_msg.send_table.offset; |
| 1199 | 1284 | |
| @@ -1225,10 +1310,18 @@ static void netvsc_send_table(struct net_device *ndev, · 25 unmodified lines | ||
| 1225 | 1310 | } |
| 1226 | 1311 | |
| 1227 | 1312 | static void netvsc_send_vf(struct net_device *ndev, |
| 1228 | − const struct nvsp_message *nvmsg) | |
| 1313 | + const struct nvsp_message *nvmsg, | |
| 1314 | + u32 msglen) | |
| 1229 | 1315 | { |
| 1230 | 1316 | struct net_device_context *net_device_ctx = netdev_priv(ndev); |
| 1231 | 1317 | |
| 1318 | + /* Ensure packet is big enough to read its fields */ | |
| 1319 | + if (msglen < sizeof(struct nvsp_message_header) + | |
| 1320 | + sizeof(struct nvsp_4_send_vf_association)) { | |
| 1321 | + netdev_err(ndev, "nvsp_v4_msg length too small: %u\n", msglen); | |
| 1322 | + return; | |
| 1323 | + } | |
| 1324 | + | |
| 1232 | 1325 | net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated; |
| 1233 | 1326 | net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial; |
| 1234 | 1327 | netdev_info(ndev, "VF slot %u %s\n", |
| @@ -1238,16 +1331,24 @@ static void netvsc_send_vf(struct net_device *ndev, · 3 unmodified lines | ||
| 1238 | 1331 | |
| 1239 | 1332 | static void netvsc_receive_inband(struct net_device *ndev, |
| 1240 | 1333 | struct netvsc_device *nvscdev, |
| 1241 | − const struct nvsp_message *nvmsg, | |
| 1242 | − u32 msglen) | |
| 1334 | + const struct vmpacket_descriptor *desc) | |
| 1243 | 1335 | { |
| 1336 | + const struct nvsp_message *nvmsg = hv_pkt_data(desc); | |
| 1337 | + u32 msglen = hv_pkt_datalen(desc); | |
| 1338 | + | |
| 1339 | + /* Ensure packet is big enough to read header fields */ | |
| 1340 | + if (msglen < sizeof(struct nvsp_message_header)) { | |
| 1341 | + netdev_err(ndev, "inband nvsp_message length too small: %u\n", msglen); | |
| 1342 | + return; | |
| 1343 | + } | |
| 1344 | + | |
| 1244 | 1345 | switch (nvmsg->hdr.msg_type) { |
| 1245 | 1346 | case NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE: |
| 1246 | 1347 | netvsc_send_table(ndev, nvscdev, nvmsg, msglen); |
| 1247 | 1348 | break; |
| 1248 | 1349 | |
| 1249 | 1350 | case NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION: |
| 1250 | − netvsc_send_vf(ndev, nvmsg); | |
| 1351 | + netvsc_send_vf(ndev, nvmsg, msglen); | |
| 1251 | 1352 | break; |
| 1252 | 1353 | } |
| 1253 | 1354 | } |
| @@ -1261,23 +1362,20 @@ static int netvsc_process_raw_pkt(struct hv_device *device, · 7 unmodified lines | ||
| 1261 | 1362 | { |
| 1262 | 1363 | struct vmbus_channel *channel = nvchan->channel; |
| 1263 | 1364 | const struct nvsp_message *nvmsg = hv_pkt_data(desc); |
| 1264 | − u32 msglen = hv_pkt_datalen(desc); | |
| 1265 | 1365 | |
| 1266 | 1366 | trace_nvsp_recv(ndev, channel, nvmsg); |
| 1267 | 1367 | |
| 1268 | 1368 | switch (desc->type) { |
| 1269 | 1369 | case VM_PKT_COMP: |
| 1270 | − netvsc_send_completion(ndev, net_device, channel, | |
| 1271 | − desc, budget); | |
| 1370 | + netvsc_send_completion(ndev, net_device, channel, desc, budget); | |
| 1272 | 1371 | break; |
| 1273 | 1372 | |
| 1274 | 1373 | case VM_PKT_DATA_USING_XFER_PAGES: |
| 1275 | − return netvsc_receive(ndev, net_device, nvchan, | |
| 1276 | − desc, nvmsg); | |
| 1374 | + return netvsc_receive(ndev, net_device, nvchan, desc); | |
| 1277 | 1375 | break; |
| 1278 | 1376 | |
| 1279 | 1377 | case VM_PKT_DATA_INBAND: |
| 1280 | − netvsc_receive_inband(ndev, net_device, nvmsg, msglen); | |
| 1378 | + netvsc_receive_inband(ndev, net_device, desc); | |
| 1281 | 1379 | break; |
| 1282 | 1380 | |
| 1283 | 1381 | default: |
| @@ -748,6 +748,13 @@ void netvsc_linkstatus_callback(struct net_device *net, · 747 unmodified lines | ||
| 748 | 748 | struct netvsc_reconfig *event; |
| 749 | 749 | unsigned long flags; |
| 750 | 750 | |
| 751 | + /* Ensure the packet is big enough to access its fields */ | |
| 752 | + if (resp->msg_len - RNDIS_HEADER_SIZE < sizeof(struct rndis_indicate_status)) { | |
| 753 | + netdev_err(net, "invalid rndis_indicate_status packet, len: %u\n", | |
| 754 | + resp->msg_len); | |
| 755 | + return; | |
| 756 | + } | |
| 757 | + | |
| 751 | 758 | /* Update the physical link speed when changing to another vSwitch */ |
| 752 | 759 | if (indicate->status == RNDIS_STATUS_LINK_SPEED_CHANGE) { |
| 753 | 760 | u32 speed; |
| @@ -2366,7 +2373,16 @@ static int netvsc_register_vf(struct net_device *vf_netdev) · 1612 unmodified lines | ||
| 2366 | 2373 | return NOTIFY_OK; |
| 2367 | 2374 | } |
| 2368 | 2375 | |
| 2369 | −/* VF up/down change detected, schedule to change data path */ | |
| 2376 | +/* Change the data path when VF UP/DOWN/CHANGE are detected. | |
| 2377 | + * | |
| 2378 | + * Typically a UP or DOWN event is followed by a CHANGE event, so | |
| 2379 | + * net_device_ctx->data_path_is_vf is used to cache the current data path | |
| 2380 | + * to avoid the duplicate call of netvsc_switch_datapath() and the duplicate | |
| 2381 | + * message. | |
| 2382 | + * | |
| 2383 | + * During hibernation, if a VF NIC driver (e.g. mlx5) preserves the network | |
| 2384 | + * interface, there is only the CHANGE event and no UP or DOWN event. | |
| 2385 | + */ | |
| 2370 | 2386 | static int netvsc_vf_changed(struct net_device *vf_netdev) |
| 2371 | 2387 | { |
| 2372 | 2388 | struct net_device_context *net_device_ctx; |
| @@ -2383,6 +2399,10 @@ static int netvsc_vf_changed(struct net_device *vf_netdev) · 10 unmodified lines | ||
| 2383 | 2399 | if (!netvsc_dev) |
| 2384 | 2400 | return NOTIFY_DONE; |
| 2385 | 2401 | |
| 2402 | + if (net_device_ctx->data_path_is_vf == vf_is_up) | |
| 2403 | + return NOTIFY_OK; | |
| 2404 | + net_device_ctx->data_path_is_vf = vf_is_up; | |
| 2405 | + | |
| 2386 | 2406 | netvsc_switch_datapath(ndev, vf_is_up); |
| 2387 | 2407 | netdev_info(ndev, "Data path switched %s VF: %s\n", |
| 2388 | 2408 | vf_is_up ? "to" : "from", vf_netdev->name); |
| @@ -2587,8 +2607,8 @@ static int netvsc_remove(struct hv_device *dev) · 198 unmodified lines | ||
| 2587 | 2607 | static int netvsc_suspend(struct hv_device *dev) |
| 2588 | 2608 | { |
| 2589 | 2609 | struct net_device_context *ndev_ctx; |
| 2590 | − struct net_device *vf_netdev, *net; | |
| 2591 | 2610 | struct netvsc_device *nvdev; |
| 2611 | + struct net_device *net; | |
| 2592 | 2612 | int ret; |
| 2593 | 2613 | |
| 2594 | 2614 | net = hv_get_drvdata(dev); |
| @@ -2604,10 +2624,6 @@ static int netvsc_suspend(struct hv_device *dev) · 9 unmodified lines | ||
| 2604 | 2624 | goto out; |
| 2605 | 2625 | } |
| 2606 | 2626 | |
| 2607 | − vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); | |
| 2608 | − if (vf_netdev) | |
| 2609 | − netvsc_unregister_vf(vf_netdev); | |
| 2610 | − | |
| 2611 | 2627 | /* Save the current config info */ |
| 2612 | 2628 | ndev_ctx->saved_netvsc_dev_info = netvsc_devinfo_get(nvdev); |
| 2613 | 2629 | |
| @@ -2628,6 +2644,12 @@ static int netvsc_resume(struct hv_device *dev) · 14 unmodified lines | ||
| 2628 | 2644 | rtnl_lock(); |
| 2629 | 2645 | |
| 2630 | 2646 | net_device_ctx = netdev_priv(net); |
| 2647 | + | |
| 2648 | + /* Reset the data path to the netvsc NIC before re-opening the vmbus | |
| 2649 | + * channel. Later netvsc_netdev_event() will switch the data path to | |
| 2650 | + * the VF upon the UP or CHANGE event. | |
| 2651 | + */ | |
| 2652 | + net_device_ctx->data_path_is_vf = false; | |
| 2631 | 2653 | device_info = net_device_ctx->saved_netvsc_dev_info; |
| 2632 | 2654 | |
| 2633 | 2655 | ret = netvsc_attach(net, device_info); |
| @@ -2695,6 +2717,7 @@ static int netvsc_netdev_event(struct notifier_block *this, · 61 unmodified lines | ||
| 2695 | 2717 | return netvsc_unregister_vf(event_dev); |
| 2696 | 2718 | case NETDEV_UP: |
| 2697 | 2719 | case NETDEV_DOWN: |
| 2720 | + case NETDEV_CHANGE: | |
| 2698 | 2721 | return netvsc_vf_changed(event_dev); |
| 2699 | 2722 | default: |
| 2700 | 2723 | return NOTIFY_DONE; |
| @@ -275,6 +275,16 @@ static void rndis_filter_receive_response(struct net_device *ndev, · 274 unmodified lines | ||
| 275 | 275 | return; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | + /* Ensure the packet is big enough to read req_id. Req_id is the 1st | |
| 279 | + * field in any request/response message, so the payload should have at | |
| 280 | + * least sizeof(u32) bytes | |
| 281 | + */ | |
| 282 | + if (resp->msg_len - RNDIS_HEADER_SIZE < sizeof(u32)) { | |
| 283 | + netdev_err(ndev, "rndis msg_len too small: %u\n", | |
| 284 | + resp->msg_len); | |
| 285 | + return; | |
| 286 | + } | |
| 287 | + | |
| 278 | 288 | spin_lock_irqsave(&dev->request_lock, flags); |
| 279 | 289 | list_for_each_entry(request, &dev->req_list, list_ent) { |
| 280 | 290 | /* |
| @@ -331,8 +341,9 @@ static void rndis_filter_receive_response(struct net_device *ndev, · 50 unmodified lines | ||
| 331 | 341 | * Get the Per-Packet-Info with the specified type |
| 332 | 342 | * return NULL if not found. |
| 333 | 343 | */ |
| 334 | −static inline void *rndis_get_ppi(struct rndis_packet *rpkt, | |
| 335 | − u32 type, u8 internal) | |
| 344 | +static inline void *rndis_get_ppi(struct net_device *ndev, | |
| 345 | + struct rndis_packet *rpkt, | |
| 346 | + u32 rpkt_len, u32 type, u8 internal) | |
| 336 | 347 | { |
| 337 | 348 | struct rndis_per_packet_info *ppi; |
| 338 | 349 | int len; |
| @@ -340,11 +351,36 @@ static inline void *rndis_get_ppi(struct rndis_packet *rpkt, · 1 unmodified line | ||
| 340 | 351 | if (rpkt->per_pkt_info_offset == 0) |
| 341 | 352 | return NULL; |
| 342 | 353 | |
| 354 | + /* Validate info_offset and info_len */ | |
| 355 | + if (rpkt->per_pkt_info_offset < sizeof(struct rndis_packet) || | |
| 356 | + rpkt->per_pkt_info_offset > rpkt_len) { | |
| 357 | + netdev_err(ndev, "Invalid per_pkt_info_offset: %u\n", | |
| 358 | + rpkt->per_pkt_info_offset); | |
| 359 | + return NULL; | |
| 360 | + } | |
| 361 | + | |
| 362 | + if (rpkt->per_pkt_info_len > rpkt_len - rpkt->per_pkt_info_offset) { | |
| 363 | + netdev_err(ndev, "Invalid per_pkt_info_len: %u\n", | |
| 364 | + rpkt->per_pkt_info_len); | |
| 365 | + return NULL; | |
| 366 | + } | |
| 367 | + | |
| 343 | 368 | ppi = (struct rndis_per_packet_info *)((ulong)rpkt + |
| 344 | 369 | rpkt->per_pkt_info_offset); |
| 345 | 370 | len = rpkt->per_pkt_info_len; |
| 346 | 371 | |
| 347 | 372 | while (len > 0) { |
| 373 | + /* Validate ppi_offset and ppi_size */ | |
| 374 | + if (ppi->size > len) { | |
| 375 | + netdev_err(ndev, "Invalid ppi size: %u\n", ppi->size); | |
| 376 | + continue; | |
| 377 | + } | |
| 378 | + | |
| 379 | + if (ppi->ppi_offset >= ppi->size) { | |
| 380 | + netdev_err(ndev, "Invalid ppi_offset: %u\n", ppi->ppi_offset); | |
| 381 | + continue; | |
| 382 | + } | |
| 383 | + | |
| 348 | 384 | if (ppi->type == type && ppi->internal == internal) |
| 349 | 385 | return (void *)((ulong)ppi + ppi->ppi_offset); |
| 350 | 386 | len -= ppi->size; |
| @@ -388,14 +424,29 @@ static int rndis_filter_receive_data(struct net_device *ndev, · 37 unmodified lines | ||
| 388 | 424 | const struct ndis_pkt_8021q_info *vlan; |
| 389 | 425 | const struct rndis_pktinfo_id *pktinfo_id; |
| 390 | 426 | const u32 *hash_info; |
| 391 | − u32 data_offset; | |
| 427 | + u32 data_offset, rpkt_len; | |
| 392 | 428 | void *data; |
| 393 | 429 | bool rsc_more = false; |
| 394 | 430 | int ret; |
| 395 | 431 | |
| 432 | + /* Ensure data_buflen is big enough to read header fields */ | |
| 433 | + if (data_buflen < RNDIS_HEADER_SIZE + sizeof(struct rndis_packet)) { | |
| 434 | + netdev_err(ndev, "invalid rndis pkt, data_buflen too small: %u\n", | |
| 435 | + data_buflen); | |
| 436 | + return NVSP_STAT_FAIL; | |
| 437 | + } | |
| 438 | + | |
| 439 | + /* Validate rndis_pkt offset */ | |
| 440 | + if (rndis_pkt->data_offset >= data_buflen - RNDIS_HEADER_SIZE) { | |
| 441 | + netdev_err(ndev, "invalid rndis packet offset: %u\n", | |
| 442 | + rndis_pkt->data_offset); | |
| 443 | + return NVSP_STAT_FAIL; | |
| 444 | + } | |
| 445 | + | |
| 396 | 446 | /* Remove the rndis header and pass it back up the stack */ |
| 397 | 447 | data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset; |
| 398 | 448 | |
| 449 | + rpkt_len = data_buflen - RNDIS_HEADER_SIZE; | |
| 399 | 450 | data_buflen -= data_offset; |
| 400 | 451 | |
| 401 | 452 | /* |
| @@ -410,13 +461,13 @@ static int rndis_filter_receive_data(struct net_device *ndev, · 8 unmodified lines | ||
| 410 | 461 | return NVSP_STAT_FAIL; |
| 411 | 462 | } |
| 412 | 463 | |
| 413 | − vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO, 0); | |
| 464 | + vlan = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, IEEE_8021Q_INFO, 0); | |
| 414 | 465 | |
| 415 | − csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO, 0); | |
| 466 | + csum_info = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, TCPIP_CHKSUM_PKTINFO, 0); | |
| 416 | 467 | |
| 417 | − hash_info = rndis_get_ppi(rndis_pkt, NBL_HASH_VALUE, 0); | |
| 468 | + hash_info = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, NBL_HASH_VALUE, 0); | |
| 418 | 469 | |
| 419 | − pktinfo_id = rndis_get_ppi(rndis_pkt, RNDIS_PKTINFO_ID, 1); | |
| 470 | + pktinfo_id = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, RNDIS_PKTINFO_ID, 1); | |
| 420 | 471 | |
| 421 | 472 | data = (void *)msg + data_offset; |
| 422 | 473 | |
| @@ -474,6 +525,14 @@ int rndis_filter_receive(struct net_device *ndev, · 51 unmodified lines | ||
| 474 | 525 | if (netif_msg_rx_status(net_device_ctx)) |
| 475 | 526 | dump_rndis_message(ndev, rndis_msg); |
| 476 | 527 | |
| 528 | + /* Validate incoming rndis_message packet */ | |
| 529 | + if (buflen < RNDIS_HEADER_SIZE || rndis_msg->msg_len < RNDIS_HEADER_SIZE || | |
| 530 | + buflen < rndis_msg->msg_len) { | |
| 531 | + netdev_err(ndev, "Invalid rndis_msg (buflen: %u, msg_len: %u)\n", | |
| 532 | + buflen, rndis_msg->msg_len); | |
| 533 | + return NVSP_STAT_FAIL; | |
| 534 | + } | |
| 535 | + | |
| 477 | 536 | switch (rndis_msg->ndis_msg_type) { |
| 478 | 537 | case RNDIS_MSG_PACKET: |
| 479 | 538 | return rndis_filter_receive_data(ndev, net_dev, nvchan, |
| @@ -882,7 +882,9 @@ static int adf7242_rx(struct adf7242_local *lp) · 881 unmodified lines | ||
| 882 | 882 | int ret; |
| 883 | 883 | u8 lqi, len_u8, *data; |
| 884 | 884 | |
| 885 | − adf7242_read_reg(lp, 0, &len_u8); | |
| 885 | + ret = adf7242_read_reg(lp, 0, &len_u8); | |
| 886 | + if (ret) | |
| 887 | + return ret; | |
| 886 | 888 | |
| 887 | 889 | len = len_u8; |
| 888 | 890 | |
| @@ -2925,6 +2925,7 @@ static int ca8210_dev_com_init(struct ca8210_priv *priv) · 2924 unmodified lines | ||
| 2925 | 2925 | ); |
| 2926 | 2926 | if (!priv->irq_workqueue) { |
| 2927 | 2927 | dev_crit(&priv->spi->dev, "alloc of irq_workqueue failed!\n"); |
| 2928 | + destroy_workqueue(priv->mlme_workqueue); | |
| 2928 | 2929 | return -ENOMEM; |
| 2929 | 2930 | } |
| 2930 | 2931 | |
| @@ -521,7 +521,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint) · 520 unmodified lines | ||
| 521 | 521 | val = ioread32(endpoint->ipa->reg_virt + offset); |
| 522 | 522 | |
| 523 | 523 | /* Zero all filter-related fields, preserving the rest */ |
| 524 | − u32_replace_bits(val, 0, IPA_REG_ENDP_FILTER_HASH_MSK_ALL); | |
| 524 | + u32p_replace_bits(&val, 0, IPA_REG_ENDP_FILTER_HASH_MSK_ALL); | |
| 525 | 525 | |
| 526 | 526 | iowrite32(val, endpoint->ipa->reg_virt + offset); |
| 527 | 527 | } |
| @@ -573,7 +573,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id) · 45 unmodified lines | ||
| 573 | 573 | val = ioread32(ipa->reg_virt + offset); |
| 574 | 574 | |
| 575 | 575 | /* Zero all route-related fields, preserving the rest */ |
| 576 | − u32_replace_bits(val, 0, IPA_REG_ENDP_ROUTER_HASH_MSK_ALL); | |
| 576 | + u32p_replace_bits(&val, 0, IPA_REG_ENDP_ROUTER_HASH_MSK_ALL); | |
| 577 | 577 | |
| 578 | 578 | iowrite32(val, ipa->reg_virt + offset); |
| 579 | 579 | } |
| @@ -996,7 +996,7 @@ void phy_stop(struct phy_device *phydev) · 995 unmodified lines | ||
| 996 | 996 | { |
| 997 | 997 | struct net_device *dev = phydev->attached_dev; |
| 998 | 998 | |
| 999 | − if (!phy_is_started(phydev)) { | |
| 999 | + if (!phy_is_started(phydev) && phydev->state != PHY_DOWN) { | |
| 1000 | 1000 | WARN(1, "called from state %s\n", |
| 1001 | 1001 | phy_state_to_str(phydev->state)); |
| 1002 | 1002 | return; |
| @@ -1143,10 +1143,6 @@ int phy_init_hw(struct phy_device *phydev) · 1142 unmodified lines | ||
| 1143 | 1143 | if (ret < 0) |
| 1144 | 1144 | return ret; |
| 1145 | 1145 | |
| 1146 | − ret = phy_disable_interrupts(phydev); | |
| 1147 | − if (ret) | |
| 1148 | − return ret; | |
| 1149 | − | |
| 1150 | 1146 | if (phydev->drv->config_init) |
| 1151 | 1147 | ret = phydev->drv->config_init(phydev); |
| 1152 | 1148 | |
| @@ -1423,6 +1419,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, · 270 unmodified lines | ||
| 1423 | 1419 | if (err) |
| 1424 | 1420 | goto error; |
| 1425 | 1421 | |
| 1422 | + err = phy_disable_interrupts(phydev); | |
| 1423 | + if (err) | |
| 1424 | + return err; | |
| 1425 | + | |
| 1426 | 1426 | phy_resume(phydev); |
| 1427 | 1427 | phy_led_triggers_register(phydev); |
| 1428 | 1428 | |
| @@ -1682,7 +1682,8 @@ void phy_detach(struct phy_device *phydev) · 253 unmodified lines | ||
| 1682 | 1682 | |
| 1683 | 1683 | phy_led_triggers_unregister(phydev); |
| 1684 | 1684 | |
| 1685 | − module_put(phydev->mdio.dev.driver->owner); | |
| 1685 | + if (phydev->mdio.dev.driver) | |
| 1686 | + module_put(phydev->mdio.dev.driver->owner); | |
| 1686 | 1687 | |
| 1687 | 1688 | /* If the device had no specific driver before (i.e. - it |
| 1688 | 1689 | * was using the generic driver), we unbind the device |
| @@ -201,7 +201,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) · 200 unmodified lines | ||
| 201 | 201 | dev_dbg(&info->control->dev, |
| 202 | 202 | "rndis response error, code %d\n", retval); |
| 203 | 203 | } |
| 204 | − msleep(20); | |
| 204 | + msleep(40); | |
| 205 | 205 | } |
| 206 | 206 | dev_dbg(&info->control->dev, "rndis response timeout\n"); |
| 207 | 207 | return -ETIMEDOUT; |
| @@ -118,6 +118,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type, · 117 unmodified lines | ||
| 118 | 118 | skb_put(skb, sizeof(struct cisco_packet)); |
| 119 | 119 | skb->priority = TC_PRIO_CONTROL; |
| 120 | 120 | skb->dev = dev; |
| 121 | + skb->protocol = htons(ETH_P_HDLC); | |
| 121 | 122 | skb_reset_network_header(skb); |
| 122 | 123 | |
| 123 | 124 | dev_queue_xmit(skb); |
| @@ -433,6 +433,8 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) · 432 unmodified lines | ||
| 433 | 433 | if (pvc->state.fecn) /* TX Congestion counter */ |
| 434 | 434 | dev->stats.tx_compressed++; |
| 435 | 435 | skb->dev = pvc->frad; |
| 436 | + skb->protocol = htons(ETH_P_HDLC); | |
| 437 | + skb_reset_network_header(skb); | |
| 436 | 438 | dev_queue_xmit(skb); |
| 437 | 439 | return NETDEV_TX_OK; |
| 438 | 440 | } |
| @@ -555,6 +557,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) · 116 unmodified lines | ||
| 555 | 557 | skb_put(skb, i); |
| 556 | 558 | skb->priority = TC_PRIO_CONTROL; |
| 557 | 559 | skb->dev = dev; |
| 560 | + skb->protocol = htons(ETH_P_HDLC); | |
| 558 | 561 | skb_reset_network_header(skb); |
| 559 | 562 | |
| 560 | 563 | dev_queue_xmit(skb); |
| @@ -1041,7 +1044,7 @@ static void pvc_setup(struct net_device *dev) · 480 unmodified lines | ||
| 1041 | 1044 | { |
| 1042 | 1045 | dev->type = ARPHRD_DLCI; |
| 1043 | 1046 | dev->flags = IFF_POINTOPOINT; |
| 1044 | − dev->hard_header_len = 10; | |
| 1047 | + dev->hard_header_len = 0; | |
| 1045 | 1048 | dev->addr_len = 2; |
| 1046 | 1049 | netif_keep_dst(dev); |
| 1047 | 1050 | } |
| @@ -1093,6 +1096,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) · 45 unmodified lines | ||
| 1093 | 1096 | dev->mtu = HDLC_MAX_MTU; |
| 1094 | 1097 | dev->min_mtu = 68; |
| 1095 | 1098 | dev->max_mtu = HDLC_MAX_MTU; |
| 1099 | + dev->needed_headroom = 10; | |
| 1096 | 1100 | dev->priv_flags |= IFF_NO_QUEUE; |
| 1097 | 1101 | dev->ml_priv = pvc; |
| 1098 | 1102 | |
| @@ -251,6 +251,7 @@ static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code, · 250 unmodified lines | ||
| 251 | 251 | |
| 252 | 252 | skb->priority = TC_PRIO_CONTROL; |
| 253 | 253 | skb->dev = dev; |
| 254 | + skb->protocol = htons(ETH_P_HDLC); | |
| 254 | 255 | skb_reset_network_header(skb); |
| 255 | 256 | skb_queue_tail(&tx_queue, skb); |
| 256 | 257 | } |
| @@ -383,11 +384,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 126 unmodified lines | ||
| 383 | 384 | } |
| 384 | 385 | |
| 385 | 386 | for (opt = data; len; len -= opt[1], opt += opt[1]) { |
| 386 | − if (len < 2 || len < opt[1]) { | |
| 387 | − dev->stats.rx_errors++; | |
| 388 | − kfree(out); | |
| 389 | − return; /* bad packet, drop silently */ | |
| 390 | − } | |
| 387 | + if (len < 2 || opt[1] < 2 || len < opt[1]) | |
| 388 | + goto err_out; | |
| 391 | 389 | |
| 392 | 390 | if (pid == PID_LCP) |
| 393 | 391 | switch (opt[0]) { |
| @@ -395,6 +393,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 1 unmodified line | ||
| 395 | 393 | continue; /* MRU always OK and > 1500 bytes? */ |
| 396 | 394 | |
| 397 | 395 | case LCP_OPTION_ACCM: /* async control character map */ |
| 396 | + if (opt[1] < sizeof(valid_accm)) | |
| 397 | + goto err_out; | |
| 398 | 398 | if (!memcmp(opt, valid_accm, |
| 399 | 399 | sizeof(valid_accm))) |
| 400 | 400 | continue; |
| @@ -406,6 +406,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 5 unmodified lines | ||
| 406 | 406 | } |
| 407 | 407 | break; |
| 408 | 408 | case LCP_OPTION_MAGIC: |
| 409 | + if (len < 6) | |
| 410 | + goto err_out; | |
| 409 | 411 | if (opt[1] != 6 || (!opt[2] && !opt[3] && |
| 410 | 412 | !opt[4] && !opt[5])) |
| 411 | 413 | break; /* reject invalid magic number */ |
| @@ -424,6 +426,11 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 12 unmodified lines | ||
| 424 | 426 | ppp_cp_event(dev, pid, RCR_GOOD, CP_CONF_ACK, id, req_len, data); |
| 425 | 427 | |
| 426 | 428 | kfree(out); |
| 429 | + return; | |
| 430 | + | |
| 431 | +err_out: | |
| 432 | + dev->stats.rx_errors++; | |
| 433 | + kfree(out); | |
| 427 | 434 | } |
| 428 | 435 | |
| 429 | 436 | static int ppp_rx(struct sk_buff *skb) |
| @@ -198,8 +198,6 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) · 197 unmodified lines | ||
| 198 | 198 | struct net_device *dev; |
| 199 | 199 | int size = skb->len; |
| 200 | 200 | |
| 201 | − skb->protocol = htons(ETH_P_X25); | |
| 202 | − | |
| 203 | 201 | ptr = skb_push(skb, 2); |
| 204 | 202 | |
| 205 | 203 | *ptr++ = size % 256; |
| @@ -210,6 +208,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) · 4 unmodified lines | ||
| 210 | 208 | |
| 211 | 209 | skb->dev = dev = lapbeth->ethdev; |
| 212 | 210 | |
| 211 | + skb->protocol = htons(ETH_P_DEC); | |
| 212 | + | |
| 213 | 213 | skb_reset_network_header(skb); |
| 214 | 214 | |
| 215 | 215 | dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); |
| @@ -87,15 +87,12 @@ static void handshake_zero(struct noise_handshake *handshake) · 86 unmodified lines | ||
| 87 | 87 | |
| 88 | 88 | void wg_noise_handshake_clear(struct noise_handshake *handshake) |
| 89 | 89 | { |
| 90 | + down_write(&handshake->lock); | |
| 90 | 91 | wg_index_hashtable_remove( |
| 91 | 92 | handshake->entry.peer->device->index_hashtable, |
| 92 | 93 | &handshake->entry); |
| 93 | − down_write(&handshake->lock); | |
| 94 | 94 | handshake_zero(handshake); |
| 95 | 95 | up_write(&handshake->lock); |
| 96 | − wg_index_hashtable_remove( | |
| 97 | − handshake->entry.peer->device->index_hashtable, | |
| 98 | − &handshake->entry); | |
| 99 | 96 | } |
| 100 | 97 | |
| 101 | 98 | static struct noise_keypair *keypair_create(struct wg_peer *peer) |
| @@ -167,9 +167,13 @@ bool wg_index_hashtable_replace(struct index_hashtable *table, · 166 unmodified lines | ||
| 167 | 167 | struct index_hashtable_entry *old, |
| 168 | 168 | struct index_hashtable_entry *new) |
| 169 | 169 | { |
| 170 | − if (unlikely(hlist_unhashed(&old->index_hash))) | |
| 171 | − return false; | |
| 170 | + bool ret; | |
| 171 | + | |
| 172 | 172 | spin_lock_bh(&table->lock); |
| 173 | + ret = !hlist_unhashed(&old->index_hash); | |
| 174 | + if (unlikely(!ret)) | |
| 175 | + goto out; | |
| 176 | + | |
| 173 | 177 | new->index = old->index; |
| 174 | 178 | hlist_replace_rcu(&old->index_hash, &new->index_hash); |
| 175 | 179 | |
| @@ -180,8 +184,9 @@ bool wg_index_hashtable_replace(struct index_hashtable *table, · 4 unmodified lines | ||
| 180 | 184 | * simply gets dropped, which isn't terrible. |
| 181 | 185 | */ |
| 182 | 186 | INIT_HLIST_NODE(&old->index_hash); |
| 187 | +out: | |
| 183 | 188 | spin_unlock_bh(&table->lock); |
| 184 | − return true; | |
| 189 | + return ret; | |
| 185 | 190 | } |
| 186 | 191 | |
| 187 | 192 | void wg_index_hashtable_remove(struct index_hashtable *table, |
| @@ -664,9 +664,15 @@ static void pkt_align(struct sk_buff *p, int len, int align) · 663 unmodified lines | ||
| 664 | 664 | /* To check if there's window offered */ |
| 665 | 665 | static bool data_ok(struct brcmf_sdio *bus) |
| 666 | 666 | { |
| 667 | − /* Reserve TXCTL_CREDITS credits for txctl */ | |
| 668 | − return (bus->tx_max - bus->tx_seq) > TXCTL_CREDITS && | |
| 669 | − ((bus->tx_max - bus->tx_seq) & 0x80) == 0; | |
| 667 | + u8 tx_rsv = 0; | |
| 668 | + | |
| 669 | + /* Reserve TXCTL_CREDITS credits for txctl when it is ready to send */ | |
| 670 | + if (bus->ctrl_frame_stat) | |
| 671 | + tx_rsv = TXCTL_CREDITS; | |
| 672 | + | |
| 673 | + return (bus->tx_max - bus->tx_seq - tx_rsv) != 0 && | |
| 674 | + ((bus->tx_max - bus->tx_seq - tx_rsv) & 0x80) == 0; | |
| 675 | + | |
| 670 | 676 | } |
| 671 | 677 | |
| 672 | 678 | /* To check if there's window offered */ |
| @@ -954,7 +954,7 @@ struct mwifiex_tkip_param { · 953 unmodified lines | ||
| 954 | 954 | struct mwifiex_aes_param { |
| 955 | 955 | u8 pn[WPA_PN_SIZE]; |
| 956 | 956 | __le16 key_len; |
| 957 | − u8 key[WLAN_KEY_LEN_CCMP]; | |
| 957 | + u8 key[WLAN_KEY_LEN_CCMP_256]; | |
| 958 | 958 | } __packed; |
| 959 | 959 | |
| 960 | 960 | struct mwifiex_wapi_param { |
| @@ -619,7 +619,7 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, · 618 unmodified lines | ||
| 619 | 619 | key_v2 = &resp->params.key_material_v2; |
| 620 | 620 | |
| 621 | 621 | len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len); |
| 622 | − if (len > WLAN_KEY_LEN_CCMP) | |
| 622 | + if (len > sizeof(key_v2->key_param_set.key_params.aes.key)) | |
| 623 | 623 | return -EINVAL; |
| 624 | 624 | |
| 625 | 625 | if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) { |
| @@ -635,7 +635,7 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, · 9 unmodified lines | ||
| 635 | 635 | return 0; |
| 636 | 636 | |
| 637 | 637 | memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0, |
| 638 | − WLAN_KEY_LEN_CCMP); | |
| 638 | + sizeof(key_v2->key_param_set.key_params.aes.key)); | |
| 639 | 639 | priv->aes_key_v2.key_param_set.key_params.aes.key_len = |
| 640 | 640 | cpu_to_le16(len); |
| 641 | 641 | memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key, |
| @@ -2128,7 +2128,8 @@ static int mt7615_load_n9(struct mt7615_dev *dev, const char *name) · 2127 unmodified lines | ||
| 2128 | 2128 | sizeof(dev->mt76.hw->wiphy->fw_version), |
| 2129 | 2129 | "%.10s-%.15s", hdr->fw_ver, hdr->build_date); |
| 2130 | 2130 | |
| 2131 | − if (!strncmp(hdr->fw_ver, "2.0", sizeof(hdr->fw_ver))) { | |
| 2131 | + if (!is_mt7615(&dev->mt76) && | |
| 2132 | + !strncmp(hdr->fw_ver, "2.0", sizeof(hdr->fw_ver))) { | |
| 2132 | 2133 | dev->fw_ver = MT7615_FIRMWARE_V2; |
| 2133 | 2134 | dev->mcu_ops = &sta_update_ops; |
| 2134 | 2135 | } else { |
| @@ -699,8 +699,12 @@ void mt7915_unregister_device(struct mt7915_dev *dev) · 698 unmodified lines | ||
| 699 | 699 | spin_lock_bh(&dev->token_lock); |
| 700 | 700 | idr_for_each_entry(&dev->token, txwi, id) { |
| 701 | 701 | mt7915_txp_skb_unmap(&dev->mt76, txwi); |
| 702 | − if (txwi->skb) | |
| 703 | − dev_kfree_skb_any(txwi->skb); | |
| 702 | + if (txwi->skb) { | |
| 703 | + struct ieee80211_hw *hw; | |
| 704 | + | |
| 705 | + hw = mt76_tx_status_get_hw(&dev->mt76, txwi->skb); | |
| 706 | + ieee80211_free_txskb(hw, txwi->skb); | |
| 707 | + } | |
| 704 | 708 | mt76_put_txwi(&dev->mt76, txwi); |
| 705 | 709 | } |
| 706 | 710 | spin_unlock_bh(&dev->token_lock); |
| @@ -841,7 +841,7 @@ mt7915_tx_complete_status(struct mt76_dev *mdev, struct sk_buff *skb, · 840 unmodified lines | ||
| 841 | 841 | if (sta || !(info->flags & IEEE80211_TX_CTL_NO_ACK)) |
| 842 | 842 | mt7915_tx_status(sta, hw, info, NULL); |
| 843 | 843 | |
| 844 | − dev_kfree_skb(skb); | |
| 844 | + ieee80211_free_txskb(hw, skb); | |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | void mt7915_txp_skb_unmap(struct mt76_dev *dev, |
| @@ -458,7 +458,6 @@ enum wl1271_cmd_key_type { · 457 unmodified lines | ||
| 458 | 458 | KEY_TKIP = 2, |
| 459 | 459 | KEY_AES = 3, |
| 460 | 460 | KEY_GEM = 4, |
| 461 | − KEY_IGTK = 5, | |
| 462 | 461 | }; |
| 463 | 462 | |
| 464 | 463 | struct wl1271_cmd_set_keys { |
| @@ -3559,9 +3559,6 @@ int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd, · 3558 unmodified lines | ||
| 3559 | 3559 | case WL1271_CIPHER_SUITE_GEM: |
| 3560 | 3560 | key_type = KEY_GEM; |
| 3561 | 3561 | break; |
| 3562 | − case WLAN_CIPHER_SUITE_AES_CMAC: | |
| 3563 | − key_type = KEY_IGTK; | |
| 3564 | − break; | |
| 3565 | 3562 | default: |
| 3566 | 3563 | wl1271_error("Unknown key algo 0x%x", key_conf->cipher); |
| 3567 | 3564 | |
| @@ -6231,7 +6228,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) · 2663 unmodified lines | ||
| 6231 | 6228 | WLAN_CIPHER_SUITE_TKIP, |
| 6232 | 6229 | WLAN_CIPHER_SUITE_CCMP, |
| 6233 | 6230 | WL1271_CIPHER_SUITE_GEM, |
| 6234 | − WLAN_CIPHER_SUITE_AES_CMAC, | |
| 6235 | 6231 | }; |
| 6236 | 6232 | |
| 6237 | 6233 | /* The tx descriptor buffer */ |
| @@ -284,11 +284,11 @@ static void qeth_l2_stop_card(struct qeth_card *card) · 283 unmodified lines | ||
| 284 | 284 | |
| 285 | 285 | if (card->state == CARD_STATE_SOFTSETUP) { |
| 286 | 286 | qeth_clear_ipacmd_list(card); |
| 287 | − qeth_drain_output_queues(card); | |
| 288 | 287 | card->state = CARD_STATE_DOWN; |
| 289 | 288 | } |
| 290 | 289 | |
| 291 | 290 | qeth_qdio_clear_card(card, 0); |
| 291 | + qeth_drain_output_queues(card); | |
| 292 | 292 | qeth_clear_working_pool_list(card); |
| 293 | 293 | flush_workqueue(card->event_wq); |
| 294 | 294 | qeth_flush_local_addrs(card); |
| @@ -1168,11 +1168,11 @@ static void qeth_l3_stop_card(struct qeth_card *card) · 1167 unmodified lines | ||
| 1168 | 1168 | if (card->state == CARD_STATE_SOFTSETUP) { |
| 1169 | 1169 | qeth_l3_clear_ip_htable(card, 1); |
| 1170 | 1170 | qeth_clear_ipacmd_list(card); |
| 1171 | − qeth_drain_output_queues(card); | |
| 1172 | 1171 | card->state = CARD_STATE_DOWN; |
| 1173 | 1172 | } |
| 1174 | 1173 | |
| 1175 | 1174 | qeth_qdio_clear_card(card, 0); |
| 1175 | + qeth_drain_output_queues(card); | |
| 1176 | 1176 | qeth_clear_working_pool_list(card); |
| 1177 | 1177 | flush_workqueue(card->event_wq); |
| 1178 | 1178 | qeth_flush_local_addrs(card); |
| @@ -193,7 +193,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) · 192 unmodified lines | ||
| 193 | 193 | #define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \ |
| 194 | 194 | __NETIF_F_BIT(NETIF_F_GSO_SHIFT)) |
| 195 | 195 | |
| 196 | −/* List of IP checksum features. Note that NETIF_F_ HW_CSUM should not be | |
| 196 | +/* List of IP checksum features. Note that NETIF_F_HW_CSUM should not be | |
| 197 | 197 | * set in features when NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM are set-- |
| 198 | 198 | * this would be contradictory |
| 199 | 199 | */ |
| @@ -1784,6 +1784,7 @@ enum netdev_priv_flags { · 1783 unmodified lines | ||
| 1784 | 1784 | * the watchdog (see dev_watchdog()) |
| 1785 | 1785 | * @watchdog_timer: List of timers |
| 1786 | 1786 | * |
| 1787 | + * @proto_down_reason: reason a netdev interface is held down | |
| 1787 | 1788 | * @pcpu_refcnt: Number of references to this device |
| 1788 | 1789 | * @todo_list: Delayed register/unregister |
| 1789 | 1790 | * @link_watch_list: XXX: need comments on this one |
| @@ -1848,6 +1849,7 @@ enum netdev_priv_flags { · 58 unmodified lines | ||
| 1848 | 1849 | * @udp_tunnel_nic_info: static structure describing the UDP tunnel |
| 1849 | 1850 | * offload capabilities of the device |
| 1850 | 1851 | * @udp_tunnel_nic: UDP tunnel offload state |
| 1852 | + * @xdp_state: stores info on attached XDP BPF programs | |
| 1851 | 1853 | * |
| 1852 | 1854 | * FIXME: cleanup struct net_device such that network protocol info |
| 1853 | 1855 | * moves out. |
| @@ -623,6 +623,7 @@ struct qed_dev_info { · 622 unmodified lines | ||
| 623 | 623 | #define QED_MFW_VERSION_3_OFFSET 24 |
| 624 | 624 | |
| 625 | 625 | u32 flash_size; |
| 626 | + bool b_arfs_capable; | |
| 626 | 627 | bool b_inter_pf_switch; |
| 627 | 628 | bool tx_switching; |
| 628 | 629 | bool rdma_supported; |
| @@ -3223,8 +3223,9 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len) · 3222 unmodified lines | ||
| 3223 | 3223 | * is untouched. Otherwise it is extended. Returns zero on |
| 3224 | 3224 | * success. The skb is freed on error if @free_on_error is true. |
| 3225 | 3225 | */ |
| 3226 | −static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len, | |
| 3227 | − bool free_on_error) | |
| 3226 | +static inline int __must_check __skb_put_padto(struct sk_buff *skb, | |
| 3227 | + unsigned int len, | |
| 3228 | + bool free_on_error) | |
| 3228 | 3229 | { |
| 3229 | 3230 | unsigned int size = skb->len; |
| 3230 | 3231 | |
| @@ -3247,7 +3248,7 @@ static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len, · 16 unmodified lines | ||
| 3247 | 3248 | * is untouched. Otherwise it is extended. Returns zero on |
| 3248 | 3249 | * success. The skb is freed on error. |
| 3249 | 3250 | */ |
| 3250 | −static inline int skb_put_padto(struct sk_buff *skb, unsigned int len) | |
| 3251 | +static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int len) | |
| 3251 | 3252 | { |
| 3252 | 3253 | return __skb_put_padto(skb, len, true); |
| 3253 | 3254 | } |
| @@ -116,6 +116,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif, · 115 unmodified lines | ||
| 116 | 116 | fl4->saddr = saddr; |
| 117 | 117 | fl4->fl4_dport = dport; |
| 118 | 118 | fl4->fl4_sport = sport; |
| 119 | + fl4->flowi4_multipath_hash = 0; | |
| 119 | 120 | } |
| 120 | 121 | |
| 121 | 122 | /* Reset some input parameters after previous lookup */ |
| @@ -726,7 +726,6 @@ static inline int __nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen, · 725 unmodified lines | ||
| 726 | 726 | * @hdrlen: length of family specific header |
| 727 | 727 | * @tb: destination array with maxtype+1 elements |
| 728 | 728 | * @maxtype: maximum attribute type to be expected |
| 729 | − * @validate: validation strictness | |
| 730 | 729 | * @extack: extended ACK report struct |
| 731 | 730 | * |
| 732 | 731 | * See nla_parse() |
| @@ -824,7 +823,6 @@ static inline int nla_validate_deprecated(const struct nlattr *head, int len, · 91 unmodified lines | ||
| 824 | 823 | * @len: length of attribute stream |
| 825 | 824 | * @maxtype: maximum attribute type to be expected |
| 826 | 825 | * @policy: validation policy |
| 827 | − * @validate: validation strictness | |
| 828 | 826 | * @extack: extended ACK report struct |
| 829 | 827 | * |
| 830 | 828 | * Validates all attributes in the specified attribute stream against the |
| @@ -8,6 +8,7 @@ struct netns_nftables { · 7 unmodified lines | ||
| 8 | 8 | struct list_head tables; |
| 9 | 9 | struct list_head commit_list; |
| 10 | 10 | struct list_head module_list; |
| 11 | + struct list_head notify_list; | |
| 11 | 12 | struct mutex commit_mutex; |
| 12 | 13 | unsigned int base_seq; |
| 13 | 14 | u8 gencursor; |
| @@ -226,12 +226,14 @@ struct sctp_sock { · 225 unmodified lines | ||
| 226 | 226 | data_ready_signalled:1; |
| 227 | 227 | |
| 228 | 228 | atomic_t pd_mode; |
| 229 | + | |
| 230 | + /* Fields after this point will be skipped on copies, like on accept | |
| 231 | + * and peeloff operations | |
| 232 | + */ | |
| 233 | + | |
| 229 | 234 | /* Receive to here while partial delivery is in effect. */ |
| 230 | 235 | struct sk_buff_head pd_lobby; |
| 231 | 236 | |
| 232 | − /* These must be the last fields, as they will skipped on copies, | |
| 233 | − * like on accept and peeloff operations | |
| 234 | − */ | |
| 235 | 237 | struct list_head auto_asconf_list; |
| 236 | 238 | int do_auto_asconf; |
| 237 | 239 | }; |
| @@ -121,6 +121,9 @@ struct vxlanhdr_gbp { · 120 unmodified lines | ||
| 121 | 121 | #define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16) |
| 122 | 122 | #define VXLAN_GBP_ID_MASK (0xFFFF) |
| 123 | 123 | |
| 124 | +#define VXLAN_GBP_MASK (VXLAN_GBP_DONT_LEARN | VXLAN_GBP_POLICY_APPLIED | \ | |
| 125 | + VXLAN_GBP_ID_MASK) | |
| 126 | + | |
| 124 | 127 | /* |
| 125 | 128 | * VXLAN Generic Protocol Extension (VXLAN_F_GPE): |
| 126 | 129 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| @@ -566,6 +566,7 @@ struct ocelot_port { · 565 unmodified lines | ||
| 566 | 566 | u8 ptp_cmd; |
| 567 | 567 | struct sk_buff_head tx_skbs; |
| 568 | 568 | u8 ts_id; |
| 569 | + spinlock_t ts_id_lock; | |
| 569 | 570 | |
| 570 | 571 | phy_interface_t phy_mode; |
| 571 | 572 | |
| @@ -677,6 +678,7 @@ void ocelot_configure_cpu(struct ocelot *ocelot, int npi, · 105 unmodified lines | ||
| 677 | 678 | int ocelot_init(struct ocelot *ocelot); |
| 678 | 679 | void ocelot_deinit(struct ocelot *ocelot); |
| 679 | 680 | void ocelot_init_port(struct ocelot *ocelot, int port); |
| 681 | +void ocelot_deinit_port(struct ocelot *ocelot, int port); | |
| 680 | 682 | |
| 681 | 683 | /* DSA callbacks */ |
| 682 | 684 | void ocelot_port_enable(struct ocelot *ocelot, int port, |
| @@ -79,6 +79,7 @@ enum { · 78 unmodified lines | ||
| 79 | 79 | ETHTOOL_MSG_TSINFO_GET_REPLY, |
| 80 | 80 | ETHTOOL_MSG_CABLE_TEST_NTF, |
| 81 | 81 | ETHTOOL_MSG_CABLE_TEST_TDR_NTF, |
| 82 | + ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY, | |
| 82 | 83 | |
| 83 | 84 | /* add new constants above here */ |
| 84 | 85 | __ETHTOOL_MSG_KERNEL_CNT, |
| @@ -1622,7 +1622,6 @@ struct bpf_iter_seq_hash_map_info { · 1621 unmodified lines | ||
| 1622 | 1622 | struct bpf_map *map; |
| 1623 | 1623 | struct bpf_htab *htab; |
| 1624 | 1624 | void *percpu_value_buf; // non-zero means percpu hash |
| 1625 | − unsigned long flags; | |
| 1626 | 1625 | u32 bucket_id; |
| 1627 | 1626 | u32 skip_elems; |
| 1628 | 1627 | }; |
| @@ -1632,7 +1631,6 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info, · 3 unmodified lines | ||
| 1632 | 1631 | struct htab_elem *prev_elem) |
| 1633 | 1632 | { |
| 1634 | 1633 | const struct bpf_htab *htab = info->htab; |
| 1635 | − unsigned long flags = info->flags; | |
| 1636 | 1634 | u32 skip_elems = info->skip_elems; |
| 1637 | 1635 | u32 bucket_id = info->bucket_id; |
| 1638 | 1636 | struct hlist_nulls_head *head; |
| @@ -1656,19 +1654,18 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info, · 17 unmodified lines | ||
| 1656 | 1654 | |
| 1657 | 1655 | /* not found, unlock and go to the next bucket */ |
| 1658 | 1656 | b = &htab->buckets[bucket_id++]; |
| 1659 | − htab_unlock_bucket(htab, b, flags); | |
| 1657 | + rcu_read_unlock(); | |
| 1660 | 1658 | skip_elems = 0; |
| 1661 | 1659 | } |
| 1662 | 1660 | |
| 1663 | 1661 | for (i = bucket_id; i < htab->n_buckets; i++) { |
| 1664 | 1662 | b = &htab->buckets[i]; |
| 1665 | − flags = htab_lock_bucket(htab, b); | |
| 1663 | + rcu_read_lock(); | |
| 1666 | 1664 | |
| 1667 | 1665 | count = 0; |
| 1668 | 1666 | head = &b->head; |
| 1669 | 1667 | hlist_nulls_for_each_entry_rcu(elem, n, head, hash_node) { |
| 1670 | 1668 | if (count >= skip_elems) { |
| 1671 | − info->flags = flags; | |
| 1672 | 1669 | info->bucket_id = i; |
| 1673 | 1670 | info->skip_elems = count; |
| 1674 | 1671 | return elem; |
| @@ -1676,7 +1673,7 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info, · 1 unmodified line | ||
| 1676 | 1673 | count++; |
| 1677 | 1674 | } |
| 1678 | 1675 | |
| 1679 | − htab_unlock_bucket(htab, b, flags); | |
| 1676 | + rcu_read_unlock(); | |
| 1680 | 1677 | skip_elems = 0; |
| 1681 | 1678 | } |
| 1682 | 1679 | |
| @@ -1754,14 +1751,10 @@ static int bpf_hash_map_seq_show(struct seq_file *seq, void *v) · 71 unmodified lines | ||
| 1754 | 1751 | |
| 1755 | 1752 | static void bpf_hash_map_seq_stop(struct seq_file *seq, void *v) |
| 1756 | 1753 | { |
| 1757 | − struct bpf_iter_seq_hash_map_info *info = seq->private; | |
| 1758 | − | |
| 1759 | 1754 | if (!v) |
| 1760 | 1755 | (void)__bpf_hash_map_seq_show(seq, NULL); |
| 1761 | 1756 | else |
| 1762 | − htab_unlock_bucket(info->htab, | |
| 1763 | − &info->htab->buckets[info->bucket_id], | |
| 1764 | − info->flags); | |
| 1757 | + rcu_read_unlock(); | |
| 1765 | 1758 | } |
| 1766 | 1759 | |
| 1767 | 1760 | static int bpf_iter_init_hash_map(void *priv_data, |
| @@ -226,10 +226,12 @@ static void *map_seq_next(struct seq_file *m, void *v, loff_t *pos) · 225 unmodified lines | ||
| 226 | 226 | else |
| 227 | 227 | prev_key = key; |
| 228 | 228 | |
| 229 | + rcu_read_lock(); | |
| 229 | 230 | if (map->ops->map_get_next_key(map, prev_key, key)) { |
| 230 | 231 | map_iter(m)->done = true; |
| 231 | − return NULL; | |
| 232 | + key = NULL; | |
| 232 | 233 | } |
| 234 | + rcu_read_unlock(); | |
| 233 | 235 | return key; |
| 234 | 236 | } |
| 235 | 237 | |
| @@ -434,7 +434,7 @@ static int __init test_rhltable(unsigned int entries) · 433 unmodified lines | ||
| 434 | 434 | } else { |
| 435 | 435 | if (WARN(err != -ENOENT, "removed non-existent element, error %d not %d", |
| 436 | 436 | err, -ENOENT)) |
| 437 | − continue; | |
| 437 | + continue; | |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include <linux/lockdep.h> |
| 26 | 26 | #include <linux/netdevice.h> |
| 27 | 27 | #include <linux/netlink.h> |
| 28 | +#include <linux/preempt.h> | |
| 28 | 29 | #include <linux/rculist.h> |
| 29 | 30 | #include <linux/rcupdate.h> |
| 30 | 31 | #include <linux/seq_file.h> |
| @@ -83,11 +84,12 @@ static inline u32 batadv_choose_claim(const void *data, u32 size) · 52 unmodified lines | ||
| 83 | 84 | */ |
| 84 | 85 | static inline u32 batadv_choose_backbone_gw(const void *data, u32 size) |
| 85 | 86 | { |
| 86 | − const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data; | |
| 87 | + const struct batadv_bla_backbone_gw *gw; | |
| 87 | 88 | u32 hash = 0; |
| 88 | 89 | |
| 89 | − hash = jhash(&claim->addr, sizeof(claim->addr), hash); | |
| 90 | − hash = jhash(&claim->vid, sizeof(claim->vid), hash); | |
| 90 | + gw = (struct batadv_bla_backbone_gw *)data; | |
| 91 | + hash = jhash(&gw->orig, sizeof(gw->orig), hash); | |
| 92 | + hash = jhash(&gw->vid, sizeof(gw->vid), hash); | |
| 91 | 93 | |
| 92 | 94 | return hash % size; |
| 93 | 95 | } |
| @@ -1579,13 +1581,16 @@ int batadv_bla_init(struct batadv_priv *bat_priv) · 1485 unmodified lines | ||
| 1579 | 1581 | } |
| 1580 | 1582 | |
| 1581 | 1583 | /** |
| 1582 | − * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup. | |
| 1584 | + * batadv_bla_check_duplist() - Check if a frame is in the broadcast dup. | |
| 1583 | 1585 | * @bat_priv: the bat priv with all the soft interface information |
| 1584 | − * @skb: contains the bcast_packet to be checked | |
| 1586 | + * @skb: contains the multicast packet to be checked | |
| 1587 | + * @payload_ptr: pointer to position inside the head buffer of the skb | |
| 1588 | + * marking the start of the data to be CRC'ed | |
| 1589 | + * @orig: originator mac address, NULL if unknown | |
| 1585 | 1590 | * |
| 1586 | − * check if it is on our broadcast list. Another gateway might | |
| 1587 | − * have sent the same packet because it is connected to the same backbone, | |
| 1588 | − * so we have to remove this duplicate. | |
| 1591 | + * Check if it is on our broadcast list. Another gateway might have sent the | |
| 1592 | + * same packet because it is connected to the same backbone, so we have to | |
| 1593 | + * remove this duplicate. | |
| 1589 | 1594 | * |
| 1590 | 1595 | * This is performed by checking the CRC, which will tell us |
| 1591 | 1596 | * with a good chance that it is the same packet. If it is furthermore |
| @@ -1594,19 +1599,17 @@ int batadv_bla_init(struct batadv_priv *bat_priv) · 2 unmodified lines | ||
| 1594 | 1599 | * |
| 1595 | 1600 | * Return: true if a packet is in the duplicate list, false otherwise. |
| 1596 | 1601 | */ |
| 1597 | −bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | |
| 1598 | − struct sk_buff *skb) | |
| 1602 | +static bool batadv_bla_check_duplist(struct batadv_priv *bat_priv, | |
| 1603 | + struct sk_buff *skb, u8 *payload_ptr, | |
| 1604 | + const u8 *orig) | |
| 1599 | 1605 | { |
| 1600 | − int i, curr; | |
| 1601 | − __be32 crc; | |
| 1602 | − struct batadv_bcast_packet *bcast_packet; | |
| 1603 | 1606 | struct batadv_bcast_duplist_entry *entry; |
| 1604 | 1607 | bool ret = false; |
| 1605 | − | |
| 1606 | − bcast_packet = (struct batadv_bcast_packet *)skb->data; | |
| 1608 | + int i, curr; | |
| 1609 | + __be32 crc; | |
| 1607 | 1610 | |
| 1608 | 1611 | /* calculate the crc ... */ |
| 1609 | − crc = batadv_skb_crc32(skb, (u8 *)(bcast_packet + 1)); | |
| 1612 | + crc = batadv_skb_crc32(skb, payload_ptr); | |
| 1610 | 1613 | |
| 1611 | 1614 | spin_lock_bh(&bat_priv->bla.bcast_duplist_lock); |
| 1612 | 1615 | |
| @@ -1625,8 +1628,21 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, · 12 unmodified lines | ||
| 1625 | 1628 | if (entry->crc != crc) |
| 1626 | 1629 | continue; |
| 1627 | 1630 | |
| 1628 | − if (batadv_compare_eth(entry->orig, bcast_packet->orig)) | |
| 1629 | − continue; | |
| 1631 | + /* are the originators both known and not anonymous? */ | |
| 1632 | + if (orig && !is_zero_ether_addr(orig) && | |
| 1633 | + !is_zero_ether_addr(entry->orig)) { | |
| 1634 | + /* If known, check if the new frame came from | |
| 1635 | + * the same originator: | |
| 1636 | + * We are safe to take identical frames from the | |
| 1637 | + * same orig, if known, as multiplications in | |
| 1638 | + * the mesh are detected via the (orig, seqno) pair. | |
| 1639 | + * So we can be a bit more liberal here and allow | |
| 1640 | + * identical frames from the same orig which the source | |
| 1641 | + * host might have sent multiple times on purpose. | |
| 1642 | + */ | |
| 1643 | + if (batadv_compare_eth(entry->orig, orig)) | |
| 1644 | + continue; | |
| 1645 | + } | |
| 1630 | 1646 | |
| 1631 | 1647 | /* this entry seems to match: same crc, not too old, |
| 1632 | 1648 | * and from another gw. therefore return true to forbid it. |
| @@ -1642,7 +1658,14 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, · 9 unmodified lines | ||
| 1642 | 1658 | entry = &bat_priv->bla.bcast_duplist[curr]; |
| 1643 | 1659 | entry->crc = crc; |
| 1644 | 1660 | entry->entrytime = jiffies; |
| 1645 | − ether_addr_copy(entry->orig, bcast_packet->orig); | |
| 1661 | + | |
| 1662 | + /* known originator */ | |
| 1663 | + if (orig) | |
| 1664 | + ether_addr_copy(entry->orig, orig); | |
| 1665 | + /* anonymous originator */ | |
| 1666 | + else | |
| 1667 | + eth_zero_addr(entry->orig); | |
| 1668 | + | |
| 1646 | 1669 | bat_priv->bla.bcast_duplist_curr = curr; |
| 1647 | 1670 | |
| 1648 | 1671 | out: |
| @@ -1651,6 +1674,48 @@ out: · 2 unmodified lines | ||
| 1651 | 1674 | return ret; |
| 1652 | 1675 | } |
| 1653 | 1676 | |
| 1677 | +/** | |
| 1678 | + * batadv_bla_check_ucast_duplist() - Check if a frame is in the broadcast dup. | |
| 1679 | + * @bat_priv: the bat priv with all the soft interface information | |
| 1680 | + * @skb: contains the multicast packet to be checked, decapsulated from a | |
| 1681 | + * unicast_packet | |
| 1682 | + * | |
| 1683 | + * Check if it is on our broadcast list. Another gateway might have sent the | |
| 1684 | + * same packet because it is connected to the same backbone, so we have to | |
| 1685 | + * remove this duplicate. | |
| 1686 | + * | |
| 1687 | + * Return: true if a packet is in the duplicate list, false otherwise. | |
| 1688 | + */ | |
| 1689 | +static bool batadv_bla_check_ucast_duplist(struct batadv_priv *bat_priv, | |
| 1690 | + struct sk_buff *skb) | |
| 1691 | +{ | |
| 1692 | + return batadv_bla_check_duplist(bat_priv, skb, (u8 *)skb->data, NULL); | |
| 1693 | +} | |
| 1694 | + | |
| 1695 | +/** | |
| 1696 | + * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup. | |
| 1697 | + * @bat_priv: the bat priv with all the soft interface information | |
| 1698 | + * @skb: contains the bcast_packet to be checked | |
| 1699 | + * | |
| 1700 | + * Check if it is on our broadcast list. Another gateway might have sent the | |
| 1701 | + * same packet because it is connected to the same backbone, so we have to | |
| 1702 | + * remove this duplicate. | |
| 1703 | + * | |
| 1704 | + * Return: true if a packet is in the duplicate list, false otherwise. | |
| 1705 | + */ | |
| 1706 | +bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | |
| 1707 | + struct sk_buff *skb) | |
| 1708 | +{ | |
| 1709 | + struct batadv_bcast_packet *bcast_packet; | |
| 1710 | + u8 *payload_ptr; | |
| 1711 | + | |
| 1712 | + bcast_packet = (struct batadv_bcast_packet *)skb->data; | |
| 1713 | + payload_ptr = (u8 *)(bcast_packet + 1); | |
| 1714 | + | |
| 1715 | + return batadv_bla_check_duplist(bat_priv, skb, payload_ptr, | |
| 1716 | + bcast_packet->orig); | |
| 1717 | +} | |
| 1718 | + | |
| 1654 | 1719 | /** |
| 1655 | 1720 | * batadv_bla_is_backbone_gw_orig() - Check if the originator is a gateway for |
| 1656 | 1721 | * the VLAN identified by vid. |
| @@ -1812,7 +1877,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb, · 155 unmodified lines | ||
| 1812 | 1877 | * @bat_priv: the bat priv with all the soft interface information |
| 1813 | 1878 | * @skb: the frame to be checked |
| 1814 | 1879 | * @vid: the VLAN ID of the frame |
| 1815 | − * @is_bcast: the packet came in a broadcast packet type. | |
| 1880 | + * @packet_type: the batman packet type this frame came in | |
| 1816 | 1881 | * |
| 1817 | 1882 | * batadv_bla_rx avoidance checks if: |
| 1818 | 1883 | * * we have to race for a claim |
| @@ -1824,7 +1889,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb, · 5 unmodified lines | ||
| 1824 | 1889 | * further process the skb. |
| 1825 | 1890 | */ |
| 1826 | 1891 | bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
| 1827 | − unsigned short vid, bool is_bcast) | |
| 1892 | + unsigned short vid, int packet_type) | |
| 1828 | 1893 | { |
| 1829 | 1894 | struct batadv_bla_backbone_gw *backbone_gw; |
| 1830 | 1895 | struct ethhdr *ethhdr; |
| @@ -1846,9 +1911,32 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, · 15 unmodified lines | ||
| 1846 | 1911 | goto handled; |
| 1847 | 1912 | |
| 1848 | 1913 | if (unlikely(atomic_read(&bat_priv->bla.num_requests))) |
| 1849 | − /* don't allow broadcasts while requests are in flight */ | |
| 1850 | − if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) | |
| 1851 | − goto handled; | |
| 1914 | + /* don't allow multicast packets while requests are in flight */ | |
| 1915 | + if (is_multicast_ether_addr(ethhdr->h_dest)) | |
| 1916 | + /* Both broadcast flooding or multicast-via-unicasts | |
| 1917 | + * delivery might send to multiple backbone gateways | |
| 1918 | + * sharing the same LAN and therefore need to coordinate | |
| 1919 | + * which backbone gateway forwards into the LAN, | |
| 1920 | + * by claiming the payload source address. | |
| 1921 | + * | |
| 1922 | + * Broadcast flooding and multicast-via-unicasts | |
| 1923 | + * delivery use the following two batman packet types. | |
| 1924 | + * Note: explicitly exclude BATADV_UNICAST_4ADDR, | |
| 1925 | + * as the DHCP gateway feature will send explicitly | |
| 1926 | + * to only one BLA gateway, so the claiming process | |
| 1927 | + * should be avoided there. | |
| 1928 | + */ | |
| 1929 | + if (packet_type == BATADV_BCAST || | |
| 1930 | + packet_type == BATADV_UNICAST) | |
| 1931 | + goto handled; | |
| 1932 | + | |
| 1933 | + /* potential duplicates from foreign BLA backbone gateways via | |
| 1934 | + * multicast-in-unicast packets | |
| 1935 | + */ | |
| 1936 | + if (is_multicast_ether_addr(ethhdr->h_dest) && | |
| 1937 | + packet_type == BATADV_UNICAST && | |
| 1938 | + batadv_bla_check_ucast_duplist(bat_priv, skb)) | |
| 1939 | + goto handled; | |
| 1852 | 1940 | |
| 1853 | 1941 | ether_addr_copy(search_claim.addr, ethhdr->h_source); |
| 1854 | 1942 | search_claim.vid = vid; |
| @@ -1883,13 +1971,14 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, · 28 unmodified lines | ||
| 1883 | 1971 | goto allow; |
| 1884 | 1972 | } |
| 1885 | 1973 | |
| 1886 | − /* if it is a broadcast ... */ | |
| 1887 | − if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) { | |
| 1974 | + /* if it is a multicast ... */ | |
| 1975 | + if (is_multicast_ether_addr(ethhdr->h_dest) && | |
| 1976 | + (packet_type == BATADV_BCAST || packet_type == BATADV_UNICAST)) { | |
| 1888 | 1977 | /* ... drop it. the responsible gateway is in charge. |
| 1889 | 1978 | * |
| 1890 | − * We need to check is_bcast because with the gateway | |
| 1979 | + * We need to check packet type because with the gateway | |
| 1891 | 1980 | * feature, broadcasts (like DHCP requests) may be sent |
| 1892 | − * using a unicast packet type. | |
| 1981 | + * using a unicast 4 address packet type. See comment above. | |
| 1893 | 1982 | */ |
| 1894 | 1983 | goto handled; |
| 1895 | 1984 | } else { |
| @@ -35,7 +35,7 @@ static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac) · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | #ifdef CONFIG_BATMAN_ADV_BLA |
| 37 | 37 | bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
| 38 | − unsigned short vid, bool is_bcast); | |
| 38 | + unsigned short vid, int packet_type); | |
| 39 | 39 | bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
| 40 | 40 | unsigned short vid); |
| 41 | 41 | bool batadv_bla_is_backbone_gw(struct sk_buff *skb, |
| @@ -66,7 +66,7 @@ bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr, · 24 unmodified lines | ||
| 66 | 66 | |
| 67 | 67 | static inline bool batadv_bla_rx(struct batadv_priv *bat_priv, |
| 68 | 68 | struct sk_buff *skb, unsigned short vid, |
| 69 | − bool is_bcast) | |
| 69 | + int packet_type) | |
| 70 | 70 | { |
| 71 | 71 | return false; |
| 72 | 72 | } |
| @@ -51,6 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | #include <uapi/linux/batadv_packet.h> |
| 52 | 52 | #include <uapi/linux/batman_adv.h> |
| 53 | 53 | |
| 54 | +#include "bridge_loop_avoidance.h" | |
| 54 | 55 | #include "hard-interface.h" |
| 55 | 56 | #include "hash.h" |
| 56 | 57 | #include "log.h" |
| @@ -1434,6 +1435,35 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, · 1377 unmodified lines | ||
| 1434 | 1435 | return BATADV_FORW_ALL; |
| 1435 | 1436 | } |
| 1436 | 1437 | |
| 1438 | +/** | |
| 1439 | + * batadv_mcast_forw_send_orig() - send a multicast packet to an originator | |
| 1440 | + * @bat_priv: the bat priv with all the soft interface information | |
| 1441 | + * @skb: the multicast packet to send | |
| 1442 | + * @vid: the vlan identifier | |
| 1443 | + * @orig_node: the originator to send the packet to | |
| 1444 | + * | |
| 1445 | + * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. | |
| 1446 | + */ | |
| 1447 | +int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv, | |
| 1448 | + struct sk_buff *skb, | |
| 1449 | + unsigned short vid, | |
| 1450 | + struct batadv_orig_node *orig_node) | |
| 1451 | +{ | |
| 1452 | + /* Avoid sending multicast-in-unicast packets to other BLA | |
| 1453 | + * gateways - they already got the frame from the LAN side | |
| 1454 | + * we share with them. | |
| 1455 | + * TODO: Refactor to take BLA into account earlier, to avoid | |
| 1456 | + * reducing the mcast_fanout count. | |
| 1457 | + */ | |
| 1458 | + if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) { | |
| 1459 | + dev_kfree_skb(skb); | |
| 1460 | + return NET_XMIT_SUCCESS; | |
| 1461 | + } | |
| 1462 | + | |
| 1463 | + return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0, | |
| 1464 | + orig_node, vid); | |
| 1465 | +} | |
| 1466 | + | |
| 1437 | 1467 | /** |
| 1438 | 1468 | * batadv_mcast_forw_tt() - forwards a packet to multicast listeners |
| 1439 | 1469 | * @bat_priv: the bat priv with all the soft interface information |
| @@ -1471,8 +1501,8 @@ batadv_mcast_forw_tt(struct batadv_priv *bat_priv, struct sk_buff *skb, · 31 unmodified lines | ||
| 1471 | 1501 | break; |
| 1472 | 1502 | } |
| 1473 | 1503 | |
| 1474 | − batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0, | |
| 1475 | − orig_entry->orig_node, vid); | |
| 1504 | + batadv_mcast_forw_send_orig(bat_priv, newskb, vid, | |
| 1505 | + orig_entry->orig_node); | |
| 1476 | 1506 | } |
| 1477 | 1507 | rcu_read_unlock(); |
| 1478 | 1508 | |
| @@ -1513,8 +1543,7 @@ batadv_mcast_forw_want_all_ipv4(struct batadv_priv *bat_priv, · 34 unmodified lines | ||
| 1513 | 1543 | break; |
| 1514 | 1544 | } |
| 1515 | 1545 | |
| 1516 | − batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0, | |
| 1517 | − orig_node, vid); | |
| 1546 | + batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node); | |
| 1518 | 1547 | } |
| 1519 | 1548 | rcu_read_unlock(); |
| 1520 | 1549 | return ret; |
| @@ -1551,8 +1580,7 @@ batadv_mcast_forw_want_all_ipv6(struct batadv_priv *bat_priv, · 30 unmodified lines | ||
| 1551 | 1580 | break; |
| 1552 | 1581 | } |
| 1553 | 1582 | |
| 1554 | − batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0, | |
| 1555 | − orig_node, vid); | |
| 1583 | + batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node); | |
| 1556 | 1584 | } |
| 1557 | 1585 | rcu_read_unlock(); |
| 1558 | 1586 | return ret; |
| @@ -1618,8 +1646,7 @@ batadv_mcast_forw_want_all_rtr4(struct batadv_priv *bat_priv, · 59 unmodified lines | ||
| 1618 | 1646 | break; |
| 1619 | 1647 | } |
| 1620 | 1648 | |
| 1621 | − batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0, | |
| 1622 | − orig_node, vid); | |
| 1649 | + batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node); | |
| 1623 | 1650 | } |
| 1624 | 1651 | rcu_read_unlock(); |
| 1625 | 1652 | return ret; |
| @@ -1656,8 +1683,7 @@ batadv_mcast_forw_want_all_rtr6(struct batadv_priv *bat_priv, · 30 unmodified lines | ||
| 1656 | 1683 | break; |
| 1657 | 1684 | } |
| 1658 | 1685 | |
| 1659 | − batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0, | |
| 1660 | − orig_node, vid); | |
| 1686 | + batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node); | |
| 1661 | 1687 | } |
| 1662 | 1688 | rcu_read_unlock(); |
| 1663 | 1689 | return ret; |
| @@ -46,6 +46,11 @@ enum batadv_forw_mode · 45 unmodified lines | ||
| 46 | 46 | batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, |
| 47 | 47 | struct batadv_orig_node **mcast_single_orig); |
| 48 | 48 | |
| 49 | +int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv, | |
| 50 | + struct sk_buff *skb, | |
| 51 | + unsigned short vid, | |
| 52 | + struct batadv_orig_node *orig_node); | |
| 53 | + | |
| 49 | 54 | int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, |
| 50 | 55 | unsigned short vid); |
| 51 | 56 | |
| @@ -71,6 +76,16 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, · 19 unmodified lines | ||
| 71 | 76 | return BATADV_FORW_ALL; |
| 72 | 77 | } |
| 73 | 78 | |
| 79 | +static inline int | |
| 80 | +batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv, | |
| 81 | + struct sk_buff *skb, | |
| 82 | + unsigned short vid, | |
| 83 | + struct batadv_orig_node *orig_node) | |
| 84 | +{ | |
| 85 | + kfree_skb(skb); | |
| 86 | + return NET_XMIT_DROP; | |
| 87 | +} | |
| 88 | + | |
| 74 | 89 | static inline int |
| 75 | 90 | batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, |
| 76 | 91 | unsigned short vid) |
| @@ -826,6 +826,10 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, · 825 unmodified lines | ||
| 826 | 826 | vid = batadv_get_vid(skb, hdr_len); |
| 827 | 827 | ethhdr = (struct ethhdr *)(skb->data + hdr_len); |
| 828 | 828 | |
| 829 | + /* do not reroute multicast frames in a unicast header */ | |
| 830 | + if (is_multicast_ether_addr(ethhdr->h_dest)) | |
| 831 | + return true; | |
| 832 | + | |
| 829 | 833 | /* check if the destination client was served by this node and it is now |
| 830 | 834 | * roaming. In this case, it means that the node has got a ROAM_ADV |
| 831 | 835 | * message and that it knows the new destination in the mesh to re-route |
| @@ -364,9 +364,8 @@ send: · 363 unmodified lines | ||
| 364 | 364 | goto dropped; |
| 365 | 365 | ret = batadv_send_skb_via_gw(bat_priv, skb, vid); |
| 366 | 366 | } else if (mcast_single_orig) { |
| 367 | − ret = batadv_send_skb_unicast(bat_priv, skb, | |
| 368 | − BATADV_UNICAST, 0, | |
| 369 | − mcast_single_orig, vid); | |
| 367 | + ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid, | |
| 368 | + mcast_single_orig); | |
| 370 | 369 | } else if (forw_mode == BATADV_FORW_SOME) { |
| 371 | 370 | ret = batadv_mcast_forw_send(bat_priv, skb, vid); |
| 372 | 371 | } else { |
| @@ -425,10 +424,10 @@ void batadv_interface_rx(struct net_device *soft_iface, · 52 unmodified lines | ||
| 425 | 424 | struct vlan_ethhdr *vhdr; |
| 426 | 425 | struct ethhdr *ethhdr; |
| 427 | 426 | unsigned short vid; |
| 428 | − bool is_bcast; | |
| 427 | + int packet_type; | |
| 429 | 428 | |
| 430 | 429 | batadv_bcast_packet = (struct batadv_bcast_packet *)skb->data; |
| 431 | − is_bcast = (batadv_bcast_packet->packet_type == BATADV_BCAST); | |
| 430 | + packet_type = batadv_bcast_packet->packet_type; | |
| 432 | 431 | |
| 433 | 432 | skb_pull_rcsum(skb, hdr_size); |
| 434 | 433 | skb_reset_mac_header(skb); |
| @@ -471,7 +470,7 @@ void batadv_interface_rx(struct net_device *soft_iface, · 36 unmodified lines | ||
| 471 | 470 | /* Let the bridge loop avoidance check the packet. If will |
| 472 | 471 | * not handle it, we can safely push it up. |
| 473 | 472 | */ |
| 474 | − if (batadv_bla_rx(bat_priv, skb, vid, is_bcast)) | |
| 473 | + if (batadv_bla_rx(bat_priv, skb, vid, packet_type)) | |
| 475 | 474 | goto out; |
| 476 | 475 | |
| 477 | 476 | if (orig_node) |
| @@ -1288,11 +1288,13 @@ void br_vlan_get_stats(const struct net_bridge_vlan *v, · 1287 unmodified lines | ||
| 1288 | 1288 | } |
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | −static int __br_vlan_get_pvid(const struct net_device *dev, | |
| 1292 | − struct net_bridge_port *p, u16 *p_pvid) | |
| 1291 | +int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid) | |
| 1293 | 1292 | { |
| 1294 | 1293 | struct net_bridge_vlan_group *vg; |
| 1294 | + struct net_bridge_port *p; | |
| 1295 | 1295 | |
| 1296 | + ASSERT_RTNL(); | |
| 1297 | + p = br_port_get_check_rtnl(dev); | |
| 1296 | 1298 | if (p) |
| 1297 | 1299 | vg = nbp_vlan_group(p); |
| 1298 | 1300 | else if (netif_is_bridge_master(dev)) |
| @@ -1303,18 +1305,23 @@ static int __br_vlan_get_pvid(const struct net_device *dev, · 4 unmodified lines | ||
| 1303 | 1305 | *p_pvid = br_get_pvid(vg); |
| 1304 | 1306 | return 0; |
| 1305 | 1307 | } |
| 1306 | − | |
| 1307 | −int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid) | |
| 1308 | −{ | |
| 1309 | − ASSERT_RTNL(); | |
| 1310 | − | |
| 1311 | − return __br_vlan_get_pvid(dev, br_port_get_check_rtnl(dev), p_pvid); | |
| 1312 | −} | |
| 1313 | 1308 | EXPORT_SYMBOL_GPL(br_vlan_get_pvid); |
| 1314 | 1309 | |
| 1315 | 1310 | int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid) |
| 1316 | 1311 | { |
| 1317 | − return __br_vlan_get_pvid(dev, br_port_get_check_rcu(dev), p_pvid); | |
| 1312 | + struct net_bridge_vlan_group *vg; | |
| 1313 | + struct net_bridge_port *p; | |
| 1314 | + | |
| 1315 | + p = br_port_get_check_rcu(dev); | |
| 1316 | + if (p) | |
| 1317 | + vg = nbp_vlan_group_rcu(p); | |
| 1318 | + else if (netif_is_bridge_master(dev)) | |
| 1319 | + vg = br_vlan_group_rcu(netdev_priv(dev)); | |
| 1320 | + else | |
| 1321 | + return -EINVAL; | |
| 1322 | + | |
| 1323 | + *p_pvid = br_get_pvid(vg); | |
| 1324 | + return 0; | |
| 1318 | 1325 | } |
| 1319 | 1326 | EXPORT_SYMBOL_GPL(br_vlan_get_pvid_rcu); |
| 1320 | 1327 | |
| @@ -8647,7 +8647,7 @@ int dev_get_port_parent_id(struct net_device *dev, · 8646 unmodified lines | ||
| 8647 | 8647 | if (!first.id_len) |
| 8648 | 8648 | first = *ppid; |
| 8649 | 8649 | else if (memcmp(&first, ppid, sizeof(*ppid))) |
| 8650 | − return -ENODATA; | |
| 8650 | + return -EOPNOTSUPP; | |
| 8651 | 8651 | } |
| 8652 | 8652 | |
| 8653 | 8653 | return err; |
| @@ -144,7 +144,7 @@ static void dst_destroy_rcu(struct rcu_head *head) · 143 unmodified lines | ||
| 144 | 144 | |
| 145 | 145 | /* Operations to mark dst as DEAD and clean up the net device referenced |
| 146 | 146 | * by dst: |
| 147 | − * 1. put the dst under loopback interface and discard all tx/rx packets | |
| 147 | + * 1. put the dst under blackhole interface and discard all tx/rx packets | |
| 148 | 148 | * on this route. |
| 149 | 149 | * 2. release the net_device |
| 150 | 150 | * This function should be called when removing routes from the fib tree |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <net/ip_tunnels.h> |
| 17 | 17 | #include <linux/indirect_call_wrapper.h> |
| 18 | 18 | |
| 19 | −#ifdef CONFIG_IPV6_MULTIPLE_TABLES | |
| 19 | +#if defined(CONFIG_IPV6) && defined(CONFIG_IPV6_MULTIPLE_TABLES) | |
| 20 | 20 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
| 21 | 21 | #define INDIRECT_CALL_MT(f, f2, f1, ...) \ |
| 22 | 22 | INDIRECT_CALL_INET(f, f2, f1, __VA_ARGS__) |
| @@ -4838,6 +4838,7 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params, · 4837 unmodified lines | ||
| 4838 | 4838 | fl4.saddr = params->ipv4_src; |
| 4839 | 4839 | fl4.fl4_sport = params->sport; |
| 4840 | 4840 | fl4.fl4_dport = params->dport; |
| 4841 | + fl4.flowi4_multipath_hash = 0; | |
| 4841 | 4842 | |
| 4842 | 4843 | if (flags & BPF_FIB_LOOKUP_DIRECT) { |
| 4843 | 4844 | u32 tbid = l3mdev_fib_table_rcu(dev) ? : RT_TABLE_MAIN; |
| @@ -7065,8 +7066,6 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig, · 2221 unmodified lines | ||
| 7065 | 7066 | bool indirect = BPF_MODE(orig->code) == BPF_IND; |
| 7066 | 7067 | struct bpf_insn *insn = insn_buf; |
| 7067 | 7068 | |
| 7068 | − /* We're guaranteed here that CTX is in R6. */ | |
| 7069 | − *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX); | |
| 7070 | 7069 | if (!indirect) { |
| 7071 | 7070 | *insn++ = BPF_MOV64_IMM(BPF_REG_2, orig->imm); |
| 7072 | 7071 | } else { |
| @@ -7074,6 +7073,8 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig, · 1 unmodified line | ||
| 7074 | 7073 | if (orig->imm) |
| 7075 | 7074 | *insn++ = BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, orig->imm); |
| 7076 | 7075 | } |
| 7076 | + /* We're guaranteed here that CTX is in R6. */ | |
| 7077 | + *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX); | |
| 7077 | 7078 | |
| 7078 | 7079 | switch (BPF_SIZE(orig->code)) { |
| 7079 | 7080 | case BPF_B: |
| @@ -9522,7 +9523,7 @@ BPF_CALL_1(bpf_skc_to_tcp6_sock, struct sock *, sk) · 2442 unmodified lines | ||
| 9522 | 9523 | * trigger an explicit type generation here. |
| 9523 | 9524 | */ |
| 9524 | 9525 | BTF_TYPE_EMIT(struct tcp6_sock); |
| 9525 | − if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP && | |
| 9526 | + if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP && | |
| 9526 | 9527 | sk->sk_family == AF_INET6) |
| 9527 | 9528 | return (unsigned long)sk; |
| 9528 | 9529 | |
| @@ -9540,7 +9541,7 @@ const struct bpf_func_proto bpf_skc_to_tcp6_sock_proto = { · 11 unmodified lines | ||
| 9540 | 9541 | |
| 9541 | 9542 | BPF_CALL_1(bpf_skc_to_tcp_sock, struct sock *, sk) |
| 9542 | 9543 | { |
| 9543 | − if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP) | |
| 9544 | + if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP) | |
| 9544 | 9545 | return (unsigned long)sk; |
| 9545 | 9546 | |
| 9546 | 9547 | return (unsigned long)NULL; |
| @@ -9558,12 +9559,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_sock_proto = { · 11 unmodified lines | ||
| 9558 | 9559 | BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk) |
| 9559 | 9560 | { |
| 9560 | 9561 | #ifdef CONFIG_INET |
| 9561 | − if (sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT) | |
| 9562 | + if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT) | |
| 9562 | 9563 | return (unsigned long)sk; |
| 9563 | 9564 | #endif |
| 9564 | 9565 | |
| 9565 | 9566 | #if IS_BUILTIN(CONFIG_IPV6) |
| 9566 | − if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_TIME_WAIT) | |
| 9567 | + if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_TIME_WAIT) | |
| 9567 | 9568 | return (unsigned long)sk; |
| 9568 | 9569 | #endif |
| 9569 | 9570 | |
| @@ -9582,12 +9583,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto = { · 12 unmodified lines | ||
| 9582 | 9583 | BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk) |
| 9583 | 9584 | { |
| 9584 | 9585 | #ifdef CONFIG_INET |
| 9585 | − if (sk->sk_prot == &tcp_prot && sk->sk_state == TCP_NEW_SYN_RECV) | |
| 9586 | + if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_NEW_SYN_RECV) | |
| 9586 | 9587 | return (unsigned long)sk; |
| 9587 | 9588 | #endif |
| 9588 | 9589 | |
| 9589 | 9590 | #if IS_BUILTIN(CONFIG_IPV6) |
| 9590 | − if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_NEW_SYN_RECV) | |
| 9591 | + if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_NEW_SYN_RECV) | |
| 9591 | 9592 | return (unsigned long)sk; |
| 9592 | 9593 | #endif |
| 9593 | 9594 | |
| @@ -9609,7 +9610,7 @@ BPF_CALL_1(bpf_skc_to_udp6_sock, struct sock *, sk) · 15 unmodified lines | ||
| 9609 | 9610 | * trigger an explicit type generation here. |
| 9610 | 9611 | */ |
| 9611 | 9612 | BTF_TYPE_EMIT(struct udp6_sock); |
| 9612 | − if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_UDP && | |
| 9613 | + if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_UDP && | |
| 9613 | 9614 | sk->sk_type == SOCK_DGRAM && sk->sk_family == AF_INET6) |
| 9614 | 9615 | return (unsigned long)sk; |
| 9615 | 9616 | |
| @@ -251,10 +251,10 @@ int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp) · 250 unmodified lines | ||
| 251 | 251 | if (refcount_read(&net->count) == 0) |
| 252 | 252 | return NETNSA_NSID_NOT_ASSIGNED; |
| 253 | 253 | |
| 254 | − spin_lock(&net->nsid_lock); | |
| 254 | + spin_lock_bh(&net->nsid_lock); | |
| 255 | 255 | id = __peernet2id(net, peer); |
| 256 | 256 | if (id >= 0) { |
| 257 | − spin_unlock(&net->nsid_lock); | |
| 257 | + spin_unlock_bh(&net->nsid_lock); | |
| 258 | 258 | return id; |
| 259 | 259 | } |
| 260 | 260 | |
| @@ -264,12 +264,12 @@ int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp) · 3 unmodified lines | ||
| 264 | 264 | * just been idr_remove()'d from there in cleanup_net(). |
| 265 | 265 | */ |
| 266 | 266 | if (!maybe_get_net(peer)) { |
| 267 | − spin_unlock(&net->nsid_lock); | |
| 267 | + spin_unlock_bh(&net->nsid_lock); | |
| 268 | 268 | return NETNSA_NSID_NOT_ASSIGNED; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | id = alloc_netid(net, peer, -1); |
| 272 | − spin_unlock(&net->nsid_lock); | |
| 272 | + spin_unlock_bh(&net->nsid_lock); | |
| 273 | 273 | |
| 274 | 274 | put_net(peer); |
| 275 | 275 | if (id < 0) |
| @@ -534,20 +534,20 @@ static void unhash_nsid(struct net *net, struct net *last) · 258 unmodified lines | ||
| 534 | 534 | for_each_net(tmp) { |
| 535 | 535 | int id; |
| 536 | 536 | |
| 537 | − spin_lock(&tmp->nsid_lock); | |
| 537 | + spin_lock_bh(&tmp->nsid_lock); | |
| 538 | 538 | id = __peernet2id(tmp, net); |
| 539 | 539 | if (id >= 0) |
| 540 | 540 | idr_remove(&tmp->netns_ids, id); |
| 541 | − spin_unlock(&tmp->nsid_lock); | |
| 541 | + spin_unlock_bh(&tmp->nsid_lock); | |
| 542 | 542 | if (id >= 0) |
| 543 | 543 | rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL, |
| 544 | 544 | GFP_KERNEL); |
| 545 | 545 | if (tmp == last) |
| 546 | 546 | break; |
| 547 | 547 | } |
| 548 | − spin_lock(&net->nsid_lock); | |
| 548 | + spin_lock_bh(&net->nsid_lock); | |
| 549 | 549 | idr_destroy(&net->netns_ids); |
| 550 | − spin_unlock(&net->nsid_lock); | |
| 550 | + spin_unlock_bh(&net->nsid_lock); | |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | static LLIST_HEAD(cleanup_list); |
| @@ -760,9 +760,9 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, · 206 unmodified lines | ||
| 760 | 760 | return PTR_ERR(peer); |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | − spin_lock(&net->nsid_lock); | |
| 763 | + spin_lock_bh(&net->nsid_lock); | |
| 764 | 764 | if (__peernet2id(net, peer) >= 0) { |
| 765 | − spin_unlock(&net->nsid_lock); | |
| 765 | + spin_unlock_bh(&net->nsid_lock); | |
| 766 | 766 | err = -EEXIST; |
| 767 | 767 | NL_SET_BAD_ATTR(extack, nla); |
| 768 | 768 | NL_SET_ERR_MSG(extack, |
| @@ -771,7 +771,7 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, · 2 unmodified lines | ||
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | err = alloc_netid(net, peer, nsid); |
| 774 | − spin_unlock(&net->nsid_lock); | |
| 774 | + spin_unlock_bh(&net->nsid_lock); | |
| 775 | 775 | if (err >= 0) { |
| 776 | 776 | rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid, |
| 777 | 777 | nlh, GFP_KERNEL); |
| @@ -1426,6 +1426,7 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh, · 1425 unmodified lines | ||
| 1426 | 1426 | { |
| 1427 | 1427 | const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops; |
| 1428 | 1428 | struct nlattr *ieee[DCB_ATTR_IEEE_MAX + 1]; |
| 1429 | + int prio; | |
| 1429 | 1430 | int err; |
| 1430 | 1431 | |
| 1431 | 1432 | if (!ops) |
| @@ -1475,6 +1476,13 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh, · 43 unmodified lines | ||
| 1475 | 1476 | struct dcbnl_buffer *buffer = |
| 1476 | 1477 | nla_data(ieee[DCB_ATTR_DCB_BUFFER]); |
| 1477 | 1478 | |
| 1479 | + for (prio = 0; prio < ARRAY_SIZE(buffer->prio2buffer); prio++) { | |
| 1480 | + if (buffer->prio2buffer[prio] >= DCBX_MAX_BUFFERS) { | |
| 1481 | + err = -EINVAL; | |
| 1482 | + goto err; | |
| 1483 | + } | |
| 1484 | + } | |
| 1485 | + | |
| 1478 | 1486 | err = ops->dcbnl_setbuffer(netdev, buffer); |
| 1479 | 1487 | if (err) |
| 1480 | 1488 | goto err; |
| @@ -1799,15 +1799,27 @@ int dsa_slave_create(struct dsa_port *port) · 1798 unmodified lines | ||
| 1799 | 1799 | |
| 1800 | 1800 | dsa_slave_notify(slave_dev, DSA_PORT_REGISTER); |
| 1801 | 1801 | |
| 1802 | − ret = register_netdev(slave_dev); | |
| 1802 | + rtnl_lock(); | |
| 1803 | + | |
| 1804 | + ret = register_netdevice(slave_dev); | |
| 1803 | 1805 | if (ret) { |
| 1804 | 1806 | netdev_err(master, "error %d registering interface %s\n", |
| 1805 | 1807 | ret, slave_dev->name); |
| 1808 | + rtnl_unlock(); | |
| 1806 | 1809 | goto out_phy; |
| 1807 | 1810 | } |
| 1808 | 1811 | |
| 1812 | + ret = netdev_upper_dev_link(master, slave_dev, NULL); | |
| 1813 | + | |
| 1814 | + rtnl_unlock(); | |
| 1815 | + | |
| 1816 | + if (ret) | |
| 1817 | + goto out_unregister; | |
| 1818 | + | |
| 1809 | 1819 | return 0; |
| 1810 | 1820 | |
| 1821 | +out_unregister: | |
| 1822 | + unregister_netdev(slave_dev); | |
| 1811 | 1823 | out_phy: |
| 1812 | 1824 | rtnl_lock(); |
| 1813 | 1825 | phylink_disconnect_phy(p->dp->pl); |
| @@ -1824,16 +1836,18 @@ out_free: · 10 unmodified lines | ||
| 1824 | 1836 | |
| 1825 | 1837 | void dsa_slave_destroy(struct net_device *slave_dev) |
| 1826 | 1838 | { |
| 1839 | + struct net_device *master = dsa_slave_to_master(slave_dev); | |
| 1827 | 1840 | struct dsa_port *dp = dsa_slave_to_port(slave_dev); |
| 1828 | 1841 | struct dsa_slave_priv *p = netdev_priv(slave_dev); |
| 1829 | 1842 | |
| 1830 | 1843 | netif_carrier_off(slave_dev); |
| 1831 | 1844 | rtnl_lock(); |
| 1845 | + netdev_upper_dev_unlink(master, slave_dev); | |
| 1846 | + unregister_netdevice(slave_dev); | |
| 1832 | 1847 | phylink_disconnect_phy(dp->pl); |
| 1833 | 1848 | rtnl_unlock(); |
| 1834 | 1849 | |
| 1835 | 1850 | dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER); |
| 1836 | − unregister_netdev(slave_dev); | |
| 1837 | 1851 | phylink_destroy(dp->pl); |
| 1838 | 1852 | gro_cells_destroy(&p->gcells); |
| 1839 | 1853 | free_percpu(p->stats64); |
| @@ -160,11 +160,14 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb, · 159 unmodified lines | ||
| 160 | 160 | packing(injection, &qos_class, 19, 17, OCELOT_TAG_LEN, PACK, 0); |
| 161 | 161 | |
| 162 | 162 | if (ocelot->ptp && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { |
| 163 | + struct sk_buff *clone = DSA_SKB_CB(skb)->clone; | |
| 164 | + | |
| 163 | 165 | rew_op = ocelot_port->ptp_cmd; |
| 164 | − if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) { | |
| 165 | − rew_op |= (ocelot_port->ts_id % 4) << 3; | |
| 166 | − ocelot_port->ts_id++; | |
| 167 | − } | |
| 166 | + /* Retrieve timestamp ID populated inside skb->cb[0] of the | |
| 167 | + * clone by ocelot_port_add_txtstamp_skb | |
| 168 | + */ | |
| 169 | + if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) | |
| 170 | + rew_op |= clone->cb[0] << 3; | |
| 168 | 171 | |
| 169 | 172 | packing(injection, &rew_op, 125, 117, OCELOT_TAG_LEN, PACK, 0); |
| 170 | 173 | } |
| @@ -200,7 +200,7 @@ int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info) · 199 unmodified lines | ||
| 200 | 200 | reply_len = ret + ethnl_reply_header_size(); |
| 201 | 201 | |
| 202 | 202 | rskb = ethnl_reply_init(reply_len, req_info.dev, |
| 203 | − ETHTOOL_MSG_TUNNEL_INFO_GET, | |
| 203 | + ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY, | |
| 204 | 204 | ETHTOOL_A_TUNNEL_INFO_HEADER, |
| 205 | 205 | info, &reply_payload); |
| 206 | 206 | if (!rskb) { |
| @@ -273,7 +273,7 @@ int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb) · 66 unmodified lines | ||
| 273 | 273 | goto cont; |
| 274 | 274 | |
| 275 | 275 | ehdr = ethnl_dump_put(skb, cb, |
| 276 | − ETHTOOL_MSG_TUNNEL_INFO_GET); | |
| 276 | + ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY); | |
| 277 | 277 | if (!ehdr) { |
| 278 | 278 | ret = -EMSGSIZE; |
| 279 | 279 | goto out; |
| @@ -76,7 +76,7 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev, · 75 unmodified lines | ||
| 76 | 76 | proto = nla_get_u8(data[IFLA_HSR_PROTOCOL]); |
| 77 | 77 | |
| 78 | 78 | if (proto >= HSR_PROTOCOL_MAX) { |
| 79 | − NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol\n"); | |
| 79 | + NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol"); | |
| 80 | 80 | return -EINVAL; |
| 81 | 81 | } |
| 82 | 82 | |
| @@ -84,14 +84,14 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev, · 1 unmodified line | ||
| 84 | 84 | proto_version = HSR_V0; |
| 85 | 85 | } else { |
| 86 | 86 | if (proto == HSR_PROTOCOL_PRP) { |
| 87 | − NL_SET_ERR_MSG_MOD(extack, "PRP version unsupported\n"); | |
| 87 | + NL_SET_ERR_MSG_MOD(extack, "PRP version unsupported"); | |
| 88 | 88 | return -EINVAL; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | proto_version = nla_get_u8(data[IFLA_HSR_VERSION]); |
| 92 | 92 | if (proto_version > HSR_V1) { |
| 93 | 93 | NL_SET_ERR_MSG_MOD(extack, |
| 94 | − "Only HSR version 0/1 supported\n"); | |
| 94 | + "Only HSR version 0/1 supported"); | |
| 95 | 95 | return -EINVAL; |
| 96 | 96 | } |
| 97 | 97 | } |
| @@ -362,6 +362,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, · 361 unmodified lines | ||
| 362 | 362 | fl4.flowi4_tun_key.tun_id = 0; |
| 363 | 363 | fl4.flowi4_flags = 0; |
| 364 | 364 | fl4.flowi4_uid = sock_net_uid(net, NULL); |
| 365 | + fl4.flowi4_multipath_hash = 0; | |
| 365 | 366 | |
| 366 | 367 | no_addr = idev->ifa_list == NULL; |
| 367 | 368 | |
| @@ -186,8 +186,8 @@ errout: · 185 unmodified lines | ||
| 186 | 186 | } |
| 187 | 187 | EXPORT_SYMBOL_GPL(inet_diag_msg_attrs_fill); |
| 188 | 188 | |
| 189 | −static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen, | |
| 190 | − struct nlattr **req_nlas) | |
| 189 | +static int inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen, | |
| 190 | + struct nlattr **req_nlas) | |
| 191 | 191 | { |
| 192 | 192 | struct nlattr *nla; |
| 193 | 193 | int remaining; |
| @@ -195,9 +195,13 @@ static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen, · 1 unmodified line | ||
| 195 | 195 | nlmsg_for_each_attr(nla, nlh, hdrlen, remaining) { |
| 196 | 196 | int type = nla_type(nla); |
| 197 | 197 | |
| 198 | + if (type == INET_DIAG_REQ_PROTOCOL && nla_len(nla) != sizeof(u32)) | |
| 199 | + return -EINVAL; | |
| 200 | + | |
| 198 | 201 | if (type < __INET_DIAG_REQ_MAX) |
| 199 | 202 | req_nlas[type] = nla; |
| 200 | 203 | } |
| 204 | + return 0; | |
| 201 | 205 | } |
| 202 | 206 | |
| 203 | 207 | static int inet_diag_get_protocol(const struct inet_diag_req_v2 *req, |
| @@ -574,7 +578,10 @@ static int inet_diag_cmd_exact(int cmd, struct sk_buff *in_skb, · 370 unmodified lines | ||
| 574 | 578 | int err, protocol; |
| 575 | 579 | |
| 576 | 580 | memset(&dump_data, 0, sizeof(dump_data)); |
| 577 | − inet_diag_parse_attrs(nlh, hdrlen, dump_data.req_nlas); | |
| 581 | + err = inet_diag_parse_attrs(nlh, hdrlen, dump_data.req_nlas); | |
| 582 | + if (err) | |
| 583 | + return err; | |
| 584 | + | |
| 578 | 585 | protocol = inet_diag_get_protocol(req, &dump_data); |
| 579 | 586 | |
| 580 | 587 | handler = inet_diag_lock_handler(protocol); |
| @@ -1180,8 +1187,11 @@ static int __inet_diag_dump_start(struct netlink_callback *cb, int hdrlen) · 599 unmodified lines | ||
| 1180 | 1187 | if (!cb_data) |
| 1181 | 1188 | return -ENOMEM; |
| 1182 | 1189 | |
| 1183 | − inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas); | |
| 1184 | − | |
| 1190 | + err = inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas); | |
| 1191 | + if (err) { | |
| 1192 | + kfree(cb_data); | |
| 1193 | + return err; | |
| 1194 | + } | |
| 1185 | 1195 | nla = cb_data->inet_diag_nla_bc; |
| 1186 | 1196 | if (nla) { |
| 1187 | 1197 | err = inet_diag_bc_audit(nla, skb); |
| @@ -74,6 +74,7 @@ · 73 unmodified lines | ||
| 74 | 74 | #include <net/icmp.h> |
| 75 | 75 | #include <net/checksum.h> |
| 76 | 76 | #include <net/inetpeer.h> |
| 77 | +#include <net/inet_ecn.h> | |
| 77 | 78 | #include <net/lwtunnel.h> |
| 78 | 79 | #include <linux/bpf-cgroup.h> |
| 79 | 80 | #include <linux/igmp.h> |
| @@ -1703,7 +1704,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, · 1623 unmodified lines | ||
| 1703 | 1704 | if (IS_ERR(rt)) |
| 1704 | 1705 | return; |
| 1705 | 1706 | |
| 1706 | − inet_sk(sk)->tos = arg->tos; | |
| 1707 | + inet_sk(sk)->tos = arg->tos & ~INET_ECN_MASK; | |
| 1707 | 1708 | |
| 1708 | 1709 | sk->sk_protocol = ip_hdr(skb)->protocol; |
| 1709 | 1710 | sk->sk_bound_dev_if = arg->bound_dev_if; |
| @@ -554,6 +554,7 @@ static int ip_tun_parse_opts_vxlan(struct nlattr *attr, · 553 unmodified lines | ||
| 554 | 554 | |
| 555 | 555 | attr = tb[LWTUNNEL_IP_OPT_VXLAN_GBP]; |
| 556 | 556 | md->gbp = nla_get_u32(attr); |
| 557 | + md->gbp &= VXLAN_GBP_MASK; | |
| 557 | 558 | info->key.tun_flags |= TUNNEL_VXLAN_OPT; |
| 558 | 559 | } |
| 559 | 560 | |
| @@ -786,8 +786,10 @@ static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flow · 785 unmodified lines | ||
| 786 | 786 | neigh_event_send(n, NULL); |
| 787 | 787 | } else { |
| 788 | 788 | if (fib_lookup(net, fl4, &res, 0) == 0) { |
| 789 | − struct fib_nh_common *nhc = FIB_RES_NHC(res); | |
| 789 | + struct fib_nh_common *nhc; | |
| 790 | 790 | |
| 791 | + fib_select_path(net, &res, fl4, skb); | |
| 792 | + nhc = FIB_RES_NHC(res); | |
| 791 | 793 | update_or_create_fnhe(nhc, fl4->daddr, new_gw, |
| 792 | 794 | 0, false, |
| 793 | 795 | jiffies + ip_rt_gc_timeout); |
| @@ -1013,6 +1015,7 @@ out: kfree_skb(skb); · 219 unmodified lines | ||
| 1013 | 1015 | static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) |
| 1014 | 1016 | { |
| 1015 | 1017 | struct dst_entry *dst = &rt->dst; |
| 1018 | + struct net *net = dev_net(dst->dev); | |
| 1016 | 1019 | u32 old_mtu = ipv4_mtu(dst); |
| 1017 | 1020 | struct fib_result res; |
| 1018 | 1021 | bool lock = false; |
| @@ -1033,9 +1036,11 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) · 14 unmodified lines | ||
| 1033 | 1036 | return; |
| 1034 | 1037 | |
| 1035 | 1038 | rcu_read_lock(); |
| 1036 | − if (fib_lookup(dev_net(dst->dev), fl4, &res, 0) == 0) { | |
| 1037 | − struct fib_nh_common *nhc = FIB_RES_NHC(res); | |
| 1039 | + if (fib_lookup(net, fl4, &res, 0) == 0) { | |
| 1040 | + struct fib_nh_common *nhc; | |
| 1038 | 1041 | |
| 1042 | + fib_select_path(net, &res, fl4, NULL); | |
| 1043 | + nhc = FIB_RES_NHC(res); | |
| 1039 | 1044 | update_or_create_fnhe(nhc, fl4->daddr, 0, mtu, lock, |
| 1040 | 1045 | jiffies + ip_rt_mtu_expires); |
| 1041 | 1046 | } |
| @@ -2147,6 +2152,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, · 1105 unmodified lines | ||
| 2147 | 2152 | fl4.daddr = daddr; |
| 2148 | 2153 | fl4.saddr = saddr; |
| 2149 | 2154 | fl4.flowi4_uid = sock_net_uid(net, NULL); |
| 2155 | + fl4.flowi4_multipath_hash = 0; | |
| 2150 | 2156 | |
| 2151 | 2157 | if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) { |
| 2152 | 2158 | flkeys = &_flkeys; |
| @@ -2667,8 +2673,6 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4, · 514 unmodified lines | ||
| 2667 | 2673 | fib_select_path(net, res, fl4, skb); |
| 2668 | 2674 | |
| 2669 | 2675 | dev_out = FIB_RES_DEV(*res); |
| 2670 | − fl4->flowi4_oif = dev_out->ifindex; | |
| 2671 | − | |
| 2672 | 2676 | |
| 2673 | 2677 | make_route: |
| 2674 | 2678 | rth = __mkroute_output(res, fl4, orig_oif, dev_out, flags); |
| @@ -303,6 +303,7 @@ config IPV6_SEG6_LWTUNNEL · 302 unmodified lines | ||
| 303 | 303 | config IPV6_SEG6_HMAC |
| 304 | 304 | bool "IPv6: Segment Routing HMAC support" |
| 305 | 305 | depends on IPV6 |
| 306 | + select CRYPTO | |
| 306 | 307 | select CRYPTO_HMAC |
| 307 | 308 | select CRYPTO_SHA1 |
| 308 | 309 | select CRYPTO_SHA256 |
| @@ -1993,14 +1993,19 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn, · 1992 unmodified lines | ||
| 1993 | 1993 | /* Need to own table->tb6_lock */ |
| 1994 | 1994 | int fib6_del(struct fib6_info *rt, struct nl_info *info) |
| 1995 | 1995 | { |
| 1996 | − struct fib6_node *fn = rcu_dereference_protected(rt->fib6_node, | |
| 1997 | − lockdep_is_held(&rt->fib6_table->tb6_lock)); | |
| 1998 | − struct fib6_table *table = rt->fib6_table; | |
| 1999 | 1996 | struct net *net = info->nl_net; |
| 2000 | 1997 | struct fib6_info __rcu **rtp; |
| 2001 | 1998 | struct fib6_info __rcu **rtp_next; |
| 1999 | + struct fib6_table *table; | |
| 2000 | + struct fib6_node *fn; | |
| 2001 | + | |
| 2002 | + if (rt == net->ipv6.fib6_null_entry) | |
| 2003 | + return -ENOENT; | |
| 2002 | 2004 | |
| 2003 | − if (!fn || rt == net->ipv6.fib6_null_entry) | |
| 2005 | + table = rt->fib6_table; | |
| 2006 | + fn = rcu_dereference_protected(rt->fib6_node, | |
| 2007 | + lockdep_is_held(&table->tb6_lock)); | |
| 2008 | + if (!fn) | |
| 2004 | 2009 | return -ENOENT; |
| 2005 | 2010 | |
| 2006 | 2011 | WARN_ON(!(fn->fn_flags & RTN_RTINFO)); |
| @@ -4202,7 +4202,7 @@ static struct fib6_info *rt6_add_route_info(struct net *net, · 4201 unmodified lines | ||
| 4202 | 4202 | .fc_nlinfo.nl_net = net, |
| 4203 | 4203 | }; |
| 4204 | 4204 | |
| 4205 | − cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO, | |
| 4205 | + cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO; | |
| 4206 | 4206 | cfg.fc_dst = *prefix; |
| 4207 | 4207 | cfg.fc_gateway = *gwaddr; |
| 4208 | 4208 | |
| @@ -560,7 +560,9 @@ static int ieee80211_fill_rx_status(struct ieee80211_rx_status *stat, · 559 unmodified lines | ||
| 560 | 560 | if (rate->idx < 0 || !rate->count) |
| 561 | 561 | return -1; |
| 562 | 562 | |
| 563 | − if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) | |
| 563 | + if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) | |
| 564 | + stat->bw = RATE_INFO_BW_160; | |
| 565 | + else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) | |
| 564 | 566 | stat->bw = RATE_INFO_BW_80; |
| 565 | 567 | else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) |
| 566 | 568 | stat->bw = RATE_INFO_BW_40; |
| @@ -668,20 +670,26 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, · 101 unmodified lines | ||
| 668 | 670 | * This will not be very accurate, but much better than simply |
| 669 | 671 | * assuming un-aggregated tx in all cases. |
| 670 | 672 | */ |
| 671 | − if (duration > 400) /* <= VHT20 MCS2 1S */ | |
| 673 | + if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */ | |
| 672 | 674 | agg_shift = 1; |
| 673 | − else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */ | |
| 675 | + else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */ | |
| 674 | 676 | agg_shift = 2; |
| 675 | − else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */ | |
| 677 | + else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */ | |
| 676 | 678 | agg_shift = 3; |
| 677 | − else | |
| 679 | + else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */ | |
| 678 | 680 | agg_shift = 4; |
| 681 | + else if (stat.encoding != RX_ENC_HE || | |
| 682 | + duration > 20 * 1024) /* <= HE40 MCS6 2S */ | |
| 683 | + agg_shift = 5; | |
| 684 | + else | |
| 685 | + agg_shift = 6; | |
| 679 | 686 | |
| 680 | 687 | duration *= len; |
| 681 | 688 | duration /= AVG_PKT_SIZE; |
| 682 | 689 | duration /= 1024; |
| 690 | + duration += (overhead >> agg_shift); | |
| 683 | 691 | |
| 684 | − return duration + (overhead >> agg_shift); | |
| 692 | + return max_t(u32, duration, 4); | |
| 685 | 693 | } |
| 686 | 694 | |
| 687 | 695 | if (!conf) |
| @@ -4861,6 +4861,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, · 4860 unmodified lines | ||
| 4861 | 4861 | struct ieee80211_supported_band *sband; |
| 4862 | 4862 | struct cfg80211_chan_def chandef; |
| 4863 | 4863 | bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; |
| 4864 | + bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ; | |
| 4864 | 4865 | struct ieee80211_bss *bss = (void *)cbss->priv; |
| 4865 | 4866 | int ret; |
| 4866 | 4867 | u32 i; |
| @@ -4879,7 +4880,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, · 12 unmodified lines | ||
| 4879 | 4880 | ifmgd->flags |= IEEE80211_STA_DISABLE_HE; |
| 4880 | 4881 | } |
| 4881 | 4882 | |
| 4882 | − if (!sband->vht_cap.vht_supported && !is_6ghz) { | |
| 4883 | + if (!sband->vht_cap.vht_supported && is_5ghz) { | |
| 4883 | 4884 | ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; |
| 4884 | 4885 | ifmgd->flags |= IEEE80211_STA_DISABLE_HE; |
| 4885 | 4886 | } |
| @@ -451,7 +451,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, · 450 unmodified lines | ||
| 451 | 451 | else if (status->bw == RATE_INFO_BW_5) |
| 452 | 452 | channel_flags |= IEEE80211_CHAN_QUARTER; |
| 453 | 453 | |
| 454 | − if (status->band == NL80211_BAND_5GHZ) | |
| 454 | + if (status->band == NL80211_BAND_5GHZ || | |
| 455 | + status->band == NL80211_BAND_6GHZ) | |
| 455 | 456 | channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ; |
| 456 | 457 | else if (status->encoding != RX_ENC_LEGACY) |
| 457 | 458 | channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ; |
| @@ -3353,9 +3353,10 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata, · 3352 unmodified lines | ||
| 3353 | 3353 | he_chandef.center_freq1 = |
| 3354 | 3354 | ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0, |
| 3355 | 3355 | NL80211_BAND_6GHZ); |
| 3356 | − he_chandef.center_freq2 = | |
| 3357 | − ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, | |
| 3358 | − NL80211_BAND_6GHZ); | |
| 3356 | + if (support_80_80 || support_160) | |
| 3357 | + he_chandef.center_freq2 = | |
| 3358 | + ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, | |
| 3359 | + NL80211_BAND_6GHZ); | |
| 3359 | 3360 | } |
| 3360 | 3361 | |
| 3361 | 3362 | if (!cfg80211_chandef_valid(&he_chandef)) { |
| @@ -168,10 +168,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, · 167 unmodified lines | ||
| 168 | 168 | /* take some capabilities as-is */ |
| 169 | 169 | cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info); |
| 170 | 170 | vht_cap->cap = cap_info; |
| 171 | − vht_cap->cap &= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 | | |
| 172 | − IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 | | |
| 173 | − IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | | |
| 174 | − IEEE80211_VHT_CAP_RXLDPC | | |
| 171 | + vht_cap->cap &= IEEE80211_VHT_CAP_RXLDPC | | |
| 175 | 172 | IEEE80211_VHT_CAP_VHT_TXOP_PS | |
| 176 | 173 | IEEE80211_VHT_CAP_HTC_VHT | |
| 177 | 174 | IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK | |
| @@ -180,6 +177,9 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, · 2 unmodified lines | ||
| 180 | 177 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN | |
| 181 | 178 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 182 | 179 | |
| 180 | + vht_cap->cap |= min_t(u32, cap_info & IEEE80211_VHT_CAP_MAX_MPDU_MASK, | |
| 181 | + own_cap.cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK); | |
| 182 | + | |
| 183 | 183 | /* and some based on our own capabilities */ |
| 184 | 184 | switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { |
| 185 | 185 | case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: |
| @@ -34,11 +34,11 @@ void ieee802154_xmit_worker(struct work_struct *work) · 33 unmodified lines | ||
| 34 | 34 | if (res) |
| 35 | 35 | goto err_tx; |
| 36 | 36 | |
| 37 | − ieee802154_xmit_complete(&local->hw, skb, false); | |
| 38 | − | |
| 39 | 37 | dev->stats.tx_packets++; |
| 40 | 38 | dev->stats.tx_bytes += skb->len; |
| 41 | 39 | |
| 40 | + ieee802154_xmit_complete(&local->hw, skb, false); | |
| 41 | + | |
| 42 | 42 | return; |
| 43 | 43 | |
| 44 | 44 | err_tx: |
| @@ -78,6 +78,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) · 33 unmodified lines | ||
| 78 | 78 | |
| 79 | 79 | /* async is priority, otherwise sync is fallback */ |
| 80 | 80 | if (local->ops->xmit_async) { |
| 81 | + unsigned int len = skb->len; | |
| 82 | + | |
| 81 | 83 | ret = drv_xmit_async(local, skb); |
| 82 | 84 | if (ret) { |
| 83 | 85 | ieee802154_wake_queue(&local->hw); |
| @@ -85,7 +87,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) · 1 unmodified line | ||
| 85 | 87 | } |
| 86 | 88 | |
| 87 | 89 | dev->stats.tx_packets++; |
| 88 | − dev->stats.tx_bytes += skb->len; | |
| 90 | + dev->stats.tx_bytes += len; | |
| 89 | 91 | } else { |
| 90 | 92 | local->tx_skb = skb; |
| 91 | 93 | queue_work(local->workqueue, &local->tx_work); |
| @@ -66,6 +66,16 @@ static bool addresses_equal(const struct mptcp_addr_info *a, · 65 unmodified lines | ||
| 66 | 66 | return a->port == b->port; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | +static bool address_zero(const struct mptcp_addr_info *addr) | |
| 70 | +{ | |
| 71 | + struct mptcp_addr_info zero; | |
| 72 | + | |
| 73 | + memset(&zero, 0, sizeof(zero)); | |
| 74 | + zero.family = addr->family; | |
| 75 | + | |
| 76 | + return addresses_equal(addr, &zero, false); | |
| 77 | +} | |
| 78 | + | |
| 69 | 79 | static void local_address(const struct sock_common *skc, |
| 70 | 80 | struct mptcp_addr_info *addr) |
| 71 | 81 | { |
| @@ -171,9 +181,9 @@ static void check_work_pending(struct mptcp_sock *msk) · 99 unmodified lines | ||
| 171 | 181 | |
| 172 | 182 | static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) |
| 173 | 183 | { |
| 184 | + struct mptcp_addr_info remote = { 0 }; | |
| 174 | 185 | struct sock *sk = (struct sock *)msk; |
| 175 | 186 | struct mptcp_pm_addr_entry *local; |
| 176 | − struct mptcp_addr_info remote; | |
| 177 | 187 | struct pm_nl_pernet *pernet; |
| 178 | 188 | |
| 179 | 189 | pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id); |
| @@ -323,10 +333,13 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) · 143 unmodified lines | ||
| 323 | 333 | * addr |
| 324 | 334 | */ |
| 325 | 335 | local_address((struct sock_common *)msk, &msk_local); |
| 326 | − local_address((struct sock_common *)msk, &skc_local); | |
| 336 | + local_address((struct sock_common *)skc, &skc_local); | |
| 327 | 337 | if (addresses_equal(&msk_local, &skc_local, false)) |
| 328 | 338 | return 0; |
| 329 | 339 | |
| 340 | + if (address_zero(&skc_local)) | |
| 341 | + return 0; | |
| 342 | + | |
| 330 | 343 | pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id); |
| 331 | 344 | |
| 332 | 345 | rcu_read_lock(); |
| @@ -341,7 +354,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) · 8 unmodified lines | ||
| 341 | 354 | return ret; |
| 342 | 355 | |
| 343 | 356 | /* address not found, add to local list */ |
| 344 | − entry = kmalloc(sizeof(*entry), GFP_KERNEL); | |
| 357 | + entry = kmalloc(sizeof(*entry), GFP_ATOMIC); | |
| 345 | 358 | if (!entry) |
| 346 | 359 | return -ENOMEM; |
| 347 | 360 | |
| @@ -1063,6 +1063,7 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex, · 1062 unmodified lines | ||
| 1063 | 1063 | struct mptcp_sock *msk = mptcp_sk(sk); |
| 1064 | 1064 | struct mptcp_subflow_context *subflow; |
| 1065 | 1065 | struct sockaddr_storage addr; |
| 1066 | + int remote_id = remote->id; | |
| 1066 | 1067 | int local_id = loc->id; |
| 1067 | 1068 | struct socket *sf; |
| 1068 | 1069 | struct sock *ssk; |
| @@ -1107,10 +1108,11 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex, · 38 unmodified lines | ||
| 1107 | 1108 | goto failed; |
| 1108 | 1109 | |
| 1109 | 1110 | mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL); |
| 1110 | − pr_debug("msk=%p remote_token=%u local_id=%d", msk, remote_token, | |
| 1111 | − local_id); | |
| 1111 | + pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk, | |
| 1112 | + remote_token, local_id, remote_id); | |
| 1112 | 1113 | subflow->remote_token = remote_token; |
| 1113 | 1114 | subflow->local_id = local_id; |
| 1115 | + subflow->remote_id = remote_id; | |
| 1114 | 1116 | subflow->request_join = 1; |
| 1115 | 1117 | subflow->request_bkup = 1; |
| 1116 | 1118 | mptcp_info2sockaddr(remote, &addr); |
| @@ -1347,6 +1349,7 @@ static void subflow_ulp_clone(const struct request_sock *req, · 230 unmodified lines | ||
| 1347 | 1349 | new_ctx->fully_established = 1; |
| 1348 | 1350 | new_ctx->backup = subflow_req->backup; |
| 1349 | 1351 | new_ctx->local_id = subflow_req->local_id; |
| 1352 | + new_ctx->remote_id = subflow_req->remote_id; | |
| 1350 | 1353 | new_ctx->token = subflow_req->token; |
| 1351 | 1354 | new_ctx->thmac = subflow_req->thmac; |
| 1352 | 1355 | } |
| @@ -851,7 +851,6 @@ static int ctnetlink_done(struct netlink_callback *cb) · 850 unmodified lines | ||
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | struct ctnetlink_filter { |
| 854 | − u_int32_t cta_flags; | |
| 855 | 854 | u8 family; |
| 856 | 855 | |
| 857 | 856 | u_int32_t orig_flags; |
| @@ -906,10 +905,6 @@ static int ctnetlink_parse_tuple_filter(const struct nlattr * const cda[], · 48 unmodified lines | ||
| 906 | 905 | struct nf_conntrack_zone *zone, |
| 907 | 906 | u_int32_t flags); |
| 908 | 907 | |
| 909 | −/* applied on filters */ | |
| 910 | −#define CTA_FILTER_F_CTA_MARK (1 << 0) | |
| 911 | −#define CTA_FILTER_F_CTA_MARK_MASK (1 << 1) | |
| 912 | − | |
| 913 | 908 | static struct ctnetlink_filter * |
| 914 | 909 | ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family) |
| 915 | 910 | { |
| @@ -930,14 +925,10 @@ ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family) · 14 unmodified lines | ||
| 930 | 925 | #ifdef CONFIG_NF_CONNTRACK_MARK |
| 931 | 926 | if (cda[CTA_MARK]) { |
| 932 | 927 | filter->mark.val = ntohl(nla_get_be32(cda[CTA_MARK])); |
| 933 | − filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK); | |
| 934 | − | |
| 935 | − if (cda[CTA_MARK_MASK]) { | |
| 928 | + if (cda[CTA_MARK_MASK]) | |
| 936 | 929 | filter->mark.mask = ntohl(nla_get_be32(cda[CTA_MARK_MASK])); |
| 937 | − filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK_MASK); | |
| 938 | − } else { | |
| 930 | + else | |
| 939 | 931 | filter->mark.mask = 0xffffffff; |
| 940 | − } | |
| 941 | 932 | } else if (cda[CTA_MARK_MASK]) { |
| 942 | 933 | err = -EINVAL; |
| 943 | 934 | goto err_filter; |
| @@ -1117,11 +1108,7 @@ static int ctnetlink_filter_match(struct nf_conn *ct, void *data) · 173 unmodified lines | ||
| 1117 | 1108 | } |
| 1118 | 1109 | |
| 1119 | 1110 | #ifdef CONFIG_NF_CONNTRACK_MARK |
| 1120 | − if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK_MASK)) && | |
| 1121 | − (ct->mark & filter->mark.mask) != filter->mark.val) | |
| 1122 | − goto ignore_entry; | |
| 1123 | − else if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK)) && | |
| 1124 | − ct->mark != filter->mark.val) | |
| 1111 | + if ((ct->mark & filter->mark.mask) != filter->mark.val) | |
| 1125 | 1112 | goto ignore_entry; |
| 1126 | 1113 | #endif |
| 1127 | 1114 | |
| @@ -1404,7 +1391,8 @@ ctnetlink_parse_tuple_filter(const struct nlattr * const cda[], · 276 unmodified lines | ||
| 1404 | 1391 | if (err < 0) |
| 1405 | 1392 | return err; |
| 1406 | 1393 | |
| 1407 | − | |
| 1394 | + if (l3num != NFPROTO_IPV4 && l3num != NFPROTO_IPV6) | |
| 1395 | + return -EOPNOTSUPP; | |
| 1408 | 1396 | tuple->src.l3num = l3num; |
| 1409 | 1397 | |
| 1410 | 1398 | if (flags & CTA_FILTER_FLAG(CTA_IP_DST) || |
| @@ -565,6 +565,7 @@ static int nf_ct_netns_inet_get(struct net *net) · 564 unmodified lines | ||
| 565 | 565 | int err; |
| 566 | 566 | |
| 567 | 567 | err = nf_ct_netns_do_get(net, NFPROTO_IPV4); |
| 568 | +#if IS_ENABLED(CONFIG_IPV6) | |
| 568 | 569 | if (err < 0) |
| 569 | 570 | goto err1; |
| 570 | 571 | err = nf_ct_netns_do_get(net, NFPROTO_IPV6); |
| @@ -575,6 +576,7 @@ static int nf_ct_netns_inet_get(struct net *net) · 4 unmodified lines | ||
| 575 | 576 | err2: |
| 576 | 577 | nf_ct_netns_put(net, NFPROTO_IPV4); |
| 577 | 578 | err1: |
| 579 | +#endif | |
| 578 | 580 | return err; |
| 579 | 581 | } |
| 580 | 582 | |
| @@ -684,6 +684,18 @@ nla_put_failure: · 683 unmodified lines | ||
| 684 | 684 | return -1; |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | +struct nftnl_skb_parms { | |
| 688 | + bool report; | |
| 689 | +}; | |
| 690 | +#define NFT_CB(skb) (*(struct nftnl_skb_parms*)&((skb)->cb)) | |
| 691 | + | |
| 692 | +static void nft_notify_enqueue(struct sk_buff *skb, bool report, | |
| 693 | + struct list_head *notify_list) | |
| 694 | +{ | |
| 695 | + NFT_CB(skb).report = report; | |
| 696 | + list_add_tail(&skb->list, notify_list); | |
| 697 | +} | |
| 698 | + | |
| 687 | 699 | static void nf_tables_table_notify(const struct nft_ctx *ctx, int event) |
| 688 | 700 | { |
| 689 | 701 | struct sk_buff *skb; |
| @@ -715,8 +727,7 @@ static void nf_tables_table_notify(const struct nft_ctx *ctx, int event) · 25 unmodified lines | ||
| 715 | 727 | goto err; |
| 716 | 728 | } |
| 717 | 729 | |
| 718 | − nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES, | |
| 719 | − ctx->report, GFP_KERNEL); | |
| 730 | + nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list); | |
| 720 | 731 | return; |
| 721 | 732 | err: |
| 722 | 733 | nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS); |
| @@ -1468,8 +1479,7 @@ static void nf_tables_chain_notify(const struct nft_ctx *ctx, int event) · 745 unmodified lines | ||
| 1468 | 1479 | goto err; |
| 1469 | 1480 | } |
| 1470 | 1481 | |
| 1471 | − nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES, | |
| 1472 | − ctx->report, GFP_KERNEL); | |
| 1482 | + nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list); | |
| 1473 | 1483 | return; |
| 1474 | 1484 | err: |
| 1475 | 1485 | nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS); |
| @@ -2807,8 +2817,7 @@ static void nf_tables_rule_notify(const struct nft_ctx *ctx, · 1331 unmodified lines | ||
| 2807 | 2817 | goto err; |
| 2808 | 2818 | } |
| 2809 | 2819 | |
| 2810 | − nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES, | |
| 2811 | − ctx->report, GFP_KERNEL); | |
| 2820 | + nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list); | |
| 2812 | 2821 | return; |
| 2813 | 2822 | err: |
| 2814 | 2823 | nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS); |
| @@ -3837,8 +3846,7 @@ static void nf_tables_set_notify(const struct nft_ctx *ctx, · 1022 unmodified lines | ||
| 3837 | 3846 | goto err; |
| 3838 | 3847 | } |
| 3839 | 3848 | |
| 3840 | − nfnetlink_send(skb, ctx->net, portid, NFNLGRP_NFTABLES, ctx->report, | |
| 3841 | − gfp_flags); | |
| 3849 | + nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list); | |
| 3842 | 3850 | return; |
| 3843 | 3851 | err: |
| 3844 | 3852 | nfnetlink_set_err(ctx->net, portid, NFNLGRP_NFTABLES, -ENOBUFS); |
| @@ -4959,8 +4967,7 @@ static void nf_tables_setelem_notify(const struct nft_ctx *ctx, · 1114 unmodified lines | ||
| 4959 | 4967 | goto err; |
| 4960 | 4968 | } |
| 4961 | 4969 | |
| 4962 | − nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, ctx->report, | |
| 4963 | − GFP_KERNEL); | |
| 4970 | + nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list); | |
| 4964 | 4971 | return; |
| 4965 | 4972 | err: |
| 4966 | 4973 | nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS); |
| @@ -6275,7 +6282,7 @@ void nft_obj_notify(struct net *net, const struct nft_table *table, · 1308 unmodified lines | ||
| 6275 | 6282 | goto err; |
| 6276 | 6283 | } |
| 6277 | 6284 | |
| 6278 | − nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, report, gfp); | |
| 6285 | + nft_notify_enqueue(skb, report, &net->nft.notify_list); | |
| 6279 | 6286 | return; |
| 6280 | 6287 | err: |
| 6281 | 6288 | nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS); |
| @@ -7085,8 +7092,7 @@ static void nf_tables_flowtable_notify(struct nft_ctx *ctx, · 803 unmodified lines | ||
| 7085 | 7092 | goto err; |
| 7086 | 7093 | } |
| 7087 | 7094 | |
| 7088 | − nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES, | |
| 7089 | − ctx->report, GFP_KERNEL); | |
| 7095 | + nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list); | |
| 7090 | 7096 | return; |
| 7091 | 7097 | err: |
| 7092 | 7098 | nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS); |
| @@ -7695,6 +7701,41 @@ static void nf_tables_commit_release(struct net *net) · 602 unmodified lines | ||
| 7695 | 7701 | mutex_unlock(&net->nft.commit_mutex); |
| 7696 | 7702 | } |
| 7697 | 7703 | |
| 7704 | +static void nft_commit_notify(struct net *net, u32 portid) | |
| 7705 | +{ | |
| 7706 | + struct sk_buff *batch_skb = NULL, *nskb, *skb; | |
| 7707 | + unsigned char *data; | |
| 7708 | + int len; | |
| 7709 | + | |
| 7710 | + list_for_each_entry_safe(skb, nskb, &net->nft.notify_list, list) { | |
| 7711 | + if (!batch_skb) { | |
| 7712 | +new_batch: | |
| 7713 | + batch_skb = skb; | |
| 7714 | + len = NLMSG_GOODSIZE - skb->len; | |
| 7715 | + list_del(&skb->list); | |
| 7716 | + continue; | |
| 7717 | + } | |
| 7718 | + len -= skb->len; | |
| 7719 | + if (len > 0 && NFT_CB(skb).report == NFT_CB(batch_skb).report) { | |
| 7720 | + data = skb_put(batch_skb, skb->len); | |
| 7721 | + memcpy(data, skb->data, skb->len); | |
| 7722 | + list_del(&skb->list); | |
| 7723 | + kfree_skb(skb); | |
| 7724 | + continue; | |
| 7725 | + } | |
| 7726 | + nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES, | |
| 7727 | + NFT_CB(batch_skb).report, GFP_KERNEL); | |
| 7728 | + goto new_batch; | |
| 7729 | + } | |
| 7730 | + | |
| 7731 | + if (batch_skb) { | |
| 7732 | + nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES, | |
| 7733 | + NFT_CB(batch_skb).report, GFP_KERNEL); | |
| 7734 | + } | |
| 7735 | + | |
| 7736 | + WARN_ON_ONCE(!list_empty(&net->nft.notify_list)); | |
| 7737 | +} | |
| 7738 | + | |
| 7698 | 7739 | static int nf_tables_commit(struct net *net, struct sk_buff *skb) |
| 7699 | 7740 | { |
| 7700 | 7741 | struct nft_trans *trans, *next; |
| @@ -7897,6 +7938,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) · 196 unmodified lines | ||
| 7897 | 7938 | } |
| 7898 | 7939 | } |
| 7899 | 7940 | |
| 7941 | + nft_commit_notify(net, NETLINK_CB(skb).portid); | |
| 7900 | 7942 | nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); |
| 7901 | 7943 | nf_tables_commit_release(net); |
| 7902 | 7944 | |
| @@ -8721,6 +8763,7 @@ static int __net_init nf_tables_init_net(struct net *net) · 818 unmodified lines | ||
| 8721 | 8763 | INIT_LIST_HEAD(&net->nft.tables); |
| 8722 | 8764 | INIT_LIST_HEAD(&net->nft.commit_list); |
| 8723 | 8765 | INIT_LIST_HEAD(&net->nft.module_list); |
| 8766 | + INIT_LIST_HEAD(&net->nft.notify_list); | |
| 8724 | 8767 | mutex_init(&net->nft.commit_mutex); |
| 8725 | 8768 | net->nft.base_seq = 1; |
| 8726 | 8769 | net->nft.validate_state = NFT_VALIDATE_SKIP; |
| @@ -8737,6 +8780,7 @@ static void __net_exit nf_tables_exit_net(struct net *net) · 10 unmodified lines | ||
| 8737 | 8780 | mutex_unlock(&net->nft.commit_mutex); |
| 8738 | 8781 | WARN_ON_ONCE(!list_empty(&net->nft.tables)); |
| 8739 | 8782 | WARN_ON_ONCE(!list_empty(&net->nft.module_list)); |
| 8783 | + WARN_ON_ONCE(!list_empty(&net->nft.notify_list)); | |
| 8740 | 8784 | } |
| 8741 | 8785 | |
| 8742 | 8786 | static struct pernet_operations nf_tables_net_ops = { |
| @@ -147,11 +147,11 @@ nft_meta_get_eval_skugid(enum nft_meta_keys key, · 146 unmodified lines | ||
| 147 | 147 | |
| 148 | 148 | switch (key) { |
| 149 | 149 | case NFT_META_SKUID: |
| 150 | − *dest = from_kuid_munged(&init_user_ns, | |
| 150 | + *dest = from_kuid_munged(sock_net(sk)->user_ns, | |
| 151 | 151 | sock->file->f_cred->fsuid); |
| 152 | 152 | break; |
| 153 | 153 | case NFT_META_SKGID: |
| 154 | − *dest = from_kgid_munged(&init_user_ns, | |
| 154 | + *dest = from_kgid_munged(sock_net(sk)->user_ns, | |
| 155 | 155 | sock->file->f_cred->fsgid); |
| 156 | 156 | break; |
| 157 | 157 | default: |
| @@ -332,8 +332,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, · 331 unmodified lines | ||
| 332 | 332 | { |
| 333 | 333 | struct qrtr_hdr_v1 *hdr; |
| 334 | 334 | size_t len = skb->len; |
| 335 | − int rc = -ENODEV; | |
| 336 | − int confirm_rx; | |
| 335 | + int rc, confirm_rx; | |
| 337 | 336 | |
| 338 | 337 | confirm_rx = qrtr_tx_wait(node, to->sq_node, to->sq_port, type); |
| 339 | 338 | if (confirm_rx < 0) { |
| @@ -357,15 +356,17 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, · 17 unmodified lines | ||
| 357 | 356 | hdr->size = cpu_to_le32(len); |
| 358 | 357 | hdr->confirm_rx = !!confirm_rx; |
| 359 | 358 | |
| 360 | − skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr)); | |
| 361 | − | |
| 362 | − mutex_lock(&node->ep_lock); | |
| 363 | − if (node->ep) | |
| 364 | − rc = node->ep->xmit(node->ep, skb); | |
| 365 | − else | |
| 366 | − kfree_skb(skb); | |
| 367 | − mutex_unlock(&node->ep_lock); | |
| 359 | + rc = skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr)); | |
| 368 | 360 | |
| 361 | + if (!rc) { | |
| 362 | + mutex_lock(&node->ep_lock); | |
| 363 | + rc = -ENODEV; | |
| 364 | + if (node->ep) | |
| 365 | + rc = node->ep->xmit(node->ep, skb); | |
| 366 | + else | |
| 367 | + kfree_skb(skb); | |
| 368 | + mutex_unlock(&node->ep_lock); | |
| 369 | + } | |
| 369 | 370 | /* Need to ensure that a subsequent message carries the otherwise lost |
| 370 | 371 | * confirm_rx flag if we dropped this one */ |
| 371 | 372 | if (rc && confirm_rx) |
| @@ -436,6 +436,25 @@ static void tcf_ife_cleanup(struct tc_action *a) · 435 unmodified lines | ||
| 436 | 436 | kfree_rcu(p, rcu); |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | +static int load_metalist(struct nlattr **tb, bool rtnl_held) | |
| 440 | +{ | |
| 441 | + int i; | |
| 442 | + | |
| 443 | + for (i = 1; i < max_metacnt; i++) { | |
| 444 | + if (tb[i]) { | |
| 445 | + void *val = nla_data(tb[i]); | |
| 446 | + int len = nla_len(tb[i]); | |
| 447 | + int rc; | |
| 448 | + | |
| 449 | + rc = load_metaops_and_vet(i, val, len, rtnl_held); | |
| 450 | + if (rc != 0) | |
| 451 | + return rc; | |
| 452 | + } | |
| 453 | + } | |
| 454 | + | |
| 455 | + return 0; | |
| 456 | +} | |
| 457 | + | |
| 439 | 458 | static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb, |
| 440 | 459 | bool exists, bool rtnl_held) |
| 441 | 460 | { |
| @@ -449,10 +468,6 @@ static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb, · 7 unmodified lines | ||
| 449 | 468 | val = nla_data(tb[i]); |
| 450 | 469 | len = nla_len(tb[i]); |
| 451 | 470 | |
| 452 | − rc = load_metaops_and_vet(i, val, len, rtnl_held); | |
| 453 | − if (rc != 0) | |
| 454 | − return rc; | |
| 455 | − | |
| 456 | 471 | rc = add_metainfo(ife, i, val, len, exists); |
| 457 | 472 | if (rc) |
| 458 | 473 | return rc; |
| @@ -509,6 +524,21 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, · 50 unmodified lines | ||
| 509 | 524 | if (!p) |
| 510 | 525 | return -ENOMEM; |
| 511 | 526 | |
| 527 | + if (tb[TCA_IFE_METALST]) { | |
| 528 | + err = nla_parse_nested_deprecated(tb2, IFE_META_MAX, | |
| 529 | + tb[TCA_IFE_METALST], NULL, | |
| 530 | + NULL); | |
| 531 | + if (err) { | |
| 532 | + kfree(p); | |
| 533 | + return err; | |
| 534 | + } | |
| 535 | + err = load_metalist(tb2, rtnl_held); | |
| 536 | + if (err) { | |
| 537 | + kfree(p); | |
| 538 | + return err; | |
| 539 | + } | |
| 540 | + } | |
| 541 | + | |
| 512 | 542 | index = parm->index; |
| 513 | 543 | err = tcf_idr_check_alloc(tn, &index, a, bind); |
| 514 | 544 | if (err < 0) { |
| @@ -570,15 +600,9 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, · 55 unmodified lines | ||
| 570 | 600 | } |
| 571 | 601 | |
| 572 | 602 | if (tb[TCA_IFE_METALST]) { |
| 573 | − err = nla_parse_nested_deprecated(tb2, IFE_META_MAX, | |
| 574 | − tb[TCA_IFE_METALST], NULL, | |
| 575 | − NULL); | |
| 576 | − if (err) | |
| 577 | − goto metadata_parse_err; | |
| 578 | 603 | err = populate_metalist(ife, tb2, exists, rtnl_held); |
| 579 | 604 | if (err) |
| 580 | 605 | goto metadata_parse_err; |
| 581 | − | |
| 582 | 606 | } else { |
| 583 | 607 | /* if no passed metadata allow list or passed allow-all |
| 584 | 608 | * then here we process by adding as many supported metadatum |
| @@ -156,6 +156,7 @@ tunnel_key_copy_vxlan_opt(const struct nlattr *nla, void *dst, int dst_len, · 155 unmodified lines | ||
| 156 | 156 | struct vxlan_metadata *md = dst; |
| 157 | 157 | |
| 158 | 158 | md->gbp = nla_get_u32(tb[TCA_TUNNEL_KEY_ENC_OPT_VXLAN_GBP]); |
| 159 | + md->gbp &= VXLAN_GBP_MASK; | |
| 159 | 160 | } |
| 160 | 161 | |
| 161 | 162 | return sizeof(struct vxlan_metadata); |
| @@ -1175,8 +1175,10 @@ static int fl_set_vxlan_opt(const struct nlattr *nla, struct fl_flow_key *key, · 1174 unmodified lines | ||
| 1175 | 1175 | return -EINVAL; |
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | − if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]) | |
| 1178 | + if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]) { | |
| 1179 | 1179 | md->gbp = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]); |
| 1180 | + md->gbp &= VXLAN_GBP_MASK; | |
| 1181 | + } | |
| 1180 | 1182 | |
| 1181 | 1183 | return sizeof(*md); |
| 1182 | 1184 | } |
| @@ -1221,6 +1223,7 @@ static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key, · 38 unmodified lines | ||
| 1221 | 1223 | } |
| 1222 | 1224 | if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]) { |
| 1223 | 1225 | nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]; |
| 1226 | + memset(&md->u, 0x00, sizeof(md->u)); | |
| 1224 | 1227 | md->u.index = nla_get_be32(nla); |
| 1225 | 1228 | } |
| 1226 | 1229 | } else if (md->version == 2) { |
| @@ -1131,24 +1131,10 @@ EXPORT_SYMBOL(dev_activate); · 1130 unmodified lines | ||
| 1131 | 1131 | |
| 1132 | 1132 | static void qdisc_deactivate(struct Qdisc *qdisc) |
| 1133 | 1133 | { |
| 1134 | − bool nolock = qdisc->flags & TCQ_F_NOLOCK; | |
| 1135 | − | |
| 1136 | 1134 | if (qdisc->flags & TCQ_F_BUILTIN) |
| 1137 | 1135 | return; |
| 1138 | − if (test_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state)) | |
| 1139 | − return; | |
| 1140 | − | |
| 1141 | − if (nolock) | |
| 1142 | − spin_lock_bh(&qdisc->seqlock); | |
| 1143 | − spin_lock_bh(qdisc_lock(qdisc)); | |
| 1144 | 1136 | |
| 1145 | 1137 | set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state); |
| 1146 | − | |
| 1147 | − qdisc_reset(qdisc); | |
| 1148 | − | |
| 1149 | − spin_unlock_bh(qdisc_lock(qdisc)); | |
| 1150 | − if (nolock) | |
| 1151 | − spin_unlock_bh(&qdisc->seqlock); | |
| 1152 | 1138 | } |
| 1153 | 1139 | |
| 1154 | 1140 | static void dev_deactivate_queue(struct net_device *dev, |
| @@ -1165,6 +1151,30 @@ static void dev_deactivate_queue(struct net_device *dev, · 10 unmodified lines | ||
| 1165 | 1151 | } |
| 1166 | 1152 | } |
| 1167 | 1153 | |
| 1154 | +static void dev_reset_queue(struct net_device *dev, | |
| 1155 | + struct netdev_queue *dev_queue, | |
| 1156 | + void *_unused) | |
| 1157 | +{ | |
| 1158 | + struct Qdisc *qdisc; | |
| 1159 | + bool nolock; | |
| 1160 | + | |
| 1161 | + qdisc = dev_queue->qdisc_sleeping; | |
| 1162 | + if (!qdisc) | |
| 1163 | + return; | |
| 1164 | + | |
| 1165 | + nolock = qdisc->flags & TCQ_F_NOLOCK; | |
| 1166 | + | |
| 1167 | + if (nolock) | |
| 1168 | + spin_lock_bh(&qdisc->seqlock); | |
| 1169 | + spin_lock_bh(qdisc_lock(qdisc)); | |
| 1170 | + | |
| 1171 | + qdisc_reset(qdisc); | |
| 1172 | + | |
| 1173 | + spin_unlock_bh(qdisc_lock(qdisc)); | |
| 1174 | + if (nolock) | |
| 1175 | + spin_unlock_bh(&qdisc->seqlock); | |
| 1176 | +} | |
| 1177 | + | |
| 1168 | 1178 | static bool some_qdisc_is_busy(struct net_device *dev) |
| 1169 | 1179 | { |
| 1170 | 1180 | unsigned int i; |
| @@ -1213,12 +1223,20 @@ void dev_deactivate_many(struct list_head *head) · 42 unmodified lines | ||
| 1213 | 1223 | dev_watchdog_down(dev); |
| 1214 | 1224 | } |
| 1215 | 1225 | |
| 1216 | − /* Wait for outstanding qdisc-less dev_queue_xmit calls. | |
| 1226 | + /* Wait for outstanding qdisc-less dev_queue_xmit calls or | |
| 1227 | + * outstanding qdisc enqueuing calls. | |
| 1217 | 1228 | * This is avoided if all devices are in dismantle phase : |
| 1218 | 1229 | * Caller will call synchronize_net() for us |
| 1219 | 1230 | */ |
| 1220 | 1231 | synchronize_net(); |
| 1221 | 1232 | |
| 1233 | + list_for_each_entry(dev, head, close_list) { | |
| 1234 | + netdev_for_each_tx_queue(dev, dev_reset_queue, NULL); | |
| 1235 | + | |
| 1236 | + if (dev_ingress_queue(dev)) | |
| 1237 | + dev_reset_queue(dev, dev_ingress_queue(dev), NULL); | |
| 1238 | + } | |
| 1239 | + | |
| 1222 | 1240 | /* Wait for outstanding qdisc_run calls. */ |
| 1223 | 1241 | list_for_each_entry(dev, head, close_list) { |
| 1224 | 1242 | while (some_qdisc_is_busy(dev)) { |
| @@ -777,9 +777,11 @@ static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = { · 776 unmodified lines | ||
| 777 | 777 | [TCA_TAPRIO_ATTR_TXTIME_DELAY] = { .type = NLA_U32 }, |
| 778 | 778 | }; |
| 779 | 779 | |
| 780 | −static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry, | |
| 780 | +static int fill_sched_entry(struct taprio_sched *q, struct nlattr **tb, | |
| 781 | + struct sched_entry *entry, | |
| 781 | 782 | struct netlink_ext_ack *extack) |
| 782 | 783 | { |
| 784 | + int min_duration = length_to_duration(q, ETH_ZLEN); | |
| 783 | 785 | u32 interval = 0; |
| 784 | 786 | |
| 785 | 787 | if (tb[TCA_TAPRIO_SCHED_ENTRY_CMD]) |
| @@ -794,7 +796,10 @@ static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry, · 8 unmodified lines | ||
| 794 | 796 | interval = nla_get_u32( |
| 795 | 797 | tb[TCA_TAPRIO_SCHED_ENTRY_INTERVAL]); |
| 796 | 798 | |
| 797 | − if (interval == 0) { | |
| 799 | + /* The interval should allow at least the minimum ethernet | |
| 800 | + * frame to go out. | |
| 801 | + */ | |
| 802 | + if (interval < min_duration) { | |
| 798 | 803 | NL_SET_ERR_MSG(extack, "Invalid interval for schedule entry"); |
| 799 | 804 | return -EINVAL; |
| 800 | 805 | } |
| @@ -804,8 +809,9 @@ static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry, · 3 unmodified lines | ||
| 804 | 809 | return 0; |
| 805 | 810 | } |
| 806 | 811 | |
| 807 | −static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry, | |
| 808 | − int index, struct netlink_ext_ack *extack) | |
| 812 | +static int parse_sched_entry(struct taprio_sched *q, struct nlattr *n, | |
| 813 | + struct sched_entry *entry, int index, | |
| 814 | + struct netlink_ext_ack *extack) | |
| 809 | 815 | { |
| 810 | 816 | struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { }; |
| 811 | 817 | int err; |
| @@ -819,10 +825,10 @@ static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry, · 7 unmodified lines | ||
| 819 | 825 | |
| 820 | 826 | entry->index = index; |
| 821 | 827 | |
| 822 | − return fill_sched_entry(tb, entry, extack); | |
| 828 | + return fill_sched_entry(q, tb, entry, extack); | |
| 823 | 829 | } |
| 824 | 830 | |
| 825 | −static int parse_sched_list(struct nlattr *list, | |
| 831 | +static int parse_sched_list(struct taprio_sched *q, struct nlattr *list, | |
| 826 | 832 | struct sched_gate_list *sched, |
| 827 | 833 | struct netlink_ext_ack *extack) |
| 828 | 834 | { |
| @@ -847,7 +853,7 @@ static int parse_sched_list(struct nlattr *list, · 18 unmodified lines | ||
| 847 | 853 | return -ENOMEM; |
| 848 | 854 | } |
| 849 | 855 | |
| 850 | − err = parse_sched_entry(n, entry, i, extack); | |
| 856 | + err = parse_sched_entry(q, n, entry, i, extack); | |
| 851 | 857 | if (err < 0) { |
| 852 | 858 | kfree(entry); |
| 853 | 859 | return err; |
| @@ -862,7 +868,7 @@ static int parse_sched_list(struct nlattr *list, · 8 unmodified lines | ||
| 862 | 868 | return i; |
| 863 | 869 | } |
| 864 | 870 | |
| 865 | −static int parse_taprio_schedule(struct nlattr **tb, | |
| 871 | +static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb, | |
| 866 | 872 | struct sched_gate_list *new, |
| 867 | 873 | struct netlink_ext_ack *extack) |
| 868 | 874 | { |
| @@ -883,8 +889,8 @@ static int parse_taprio_schedule(struct nlattr **tb, · 14 unmodified lines | ||
| 883 | 889 | new->cycle_time = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME]); |
| 884 | 890 | |
| 885 | 891 | if (tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST]) |
| 886 | − err = parse_sched_list( | |
| 887 | − tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST], new, extack); | |
| 892 | + err = parse_sched_list(q, tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST], | |
| 893 | + new, extack); | |
| 888 | 894 | if (err < 0) |
| 889 | 895 | return err; |
| 890 | 896 | |
| @@ -1473,7 +1479,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, · 582 unmodified lines | ||
| 1473 | 1479 | goto free_sched; |
| 1474 | 1480 | } |
| 1475 | 1481 | |
| 1476 | − err = parse_taprio_schedule(tb, new_admin, extack); | |
| 1482 | + err = parse_taprio_schedule(q, tb, new_admin, extack); | |
| 1477 | 1483 | if (err < 0) |
| 1478 | 1484 | goto free_sched; |
| 1479 | 1485 | |
| @@ -9220,13 +9220,10 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, · 9219 unmodified lines | ||
| 9220 | 9220 | static inline void sctp_copy_descendant(struct sock *sk_to, |
| 9221 | 9221 | const struct sock *sk_from) |
| 9222 | 9222 | { |
| 9223 | − int ancestor_size = sizeof(struct inet_sock) + | |
| 9224 | − sizeof(struct sctp_sock) - | |
| 9225 | − offsetof(struct sctp_sock, pd_lobby); | |
| 9226 | − | |
| 9227 | − if (sk_from->sk_family == PF_INET6) | |
| 9228 | − ancestor_size += sizeof(struct ipv6_pinfo); | |
| 9223 | + size_t ancestor_size = sizeof(struct inet_sock); | |
| 9229 | 9224 | |
| 9225 | + ancestor_size += sk_from->sk_prot->obj_size; | |
| 9226 | + ancestor_size -= offsetof(struct sctp_sock, pd_lobby); | |
| 9230 | 9227 | __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size); |
| 9231 | 9228 | } |
| 9232 | 9229 | |
| @@ -273,8 +273,8 @@ static struct tipc_member *tipc_group_find_node(struct tipc_group *grp, · 272 unmodified lines | ||
| 273 | 273 | return NULL; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | −static void tipc_group_add_to_tree(struct tipc_group *grp, | |
| 277 | − struct tipc_member *m) | |
| 276 | +static int tipc_group_add_to_tree(struct tipc_group *grp, | |
| 277 | + struct tipc_member *m) | |
| 278 | 278 | { |
| 279 | 279 | u64 nkey, key = (u64)m->node << 32 | m->port; |
| 280 | 280 | struct rb_node **n, *parent = NULL; |
| @@ -291,10 +291,11 @@ static void tipc_group_add_to_tree(struct tipc_group *grp, · 10 unmodified lines | ||
| 291 | 291 | else if (key > nkey) |
| 292 | 292 | n = &(*n)->rb_right; |
| 293 | 293 | else |
| 294 | − return; | |
| 294 | + return -EEXIST; | |
| 295 | 295 | } |
| 296 | 296 | rb_link_node(&m->tree_node, parent, n); |
| 297 | 297 | rb_insert_color(&m->tree_node, &grp->members); |
| 298 | + return 0; | |
| 298 | 299 | } |
| 299 | 300 | |
| 300 | 301 | static struct tipc_member *tipc_group_create_member(struct tipc_group *grp, |
| @@ -302,6 +303,7 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp, · 1 unmodified line | ||
| 302 | 303 | u32 instance, int state) |
| 303 | 304 | { |
| 304 | 305 | struct tipc_member *m; |
| 306 | + int ret; | |
| 305 | 307 | |
| 306 | 308 | m = kzalloc(sizeof(*m), GFP_ATOMIC); |
| 307 | 309 | if (!m) |
| @@ -314,8 +316,12 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp, · 6 unmodified lines | ||
| 314 | 316 | m->port = port; |
| 315 | 317 | m->instance = instance; |
| 316 | 318 | m->bc_acked = grp->bc_snd_nxt - 1; |
| 319 | + ret = tipc_group_add_to_tree(grp, m); | |
| 320 | + if (ret < 0) { | |
| 321 | + kfree(m); | |
| 322 | + return NULL; | |
| 323 | + } | |
| 317 | 324 | grp->member_cnt++; |
| 318 | − tipc_group_add_to_tree(grp, m); | |
| 319 | 325 | tipc_nlist_add(&grp->dests, m->node); |
| 320 | 326 | m->state = state; |
| 321 | 327 | return m; |
| @@ -532,7 +532,8 @@ bool tipc_link_create(struct net *net, char *if_name, int bearer_id, · 531 unmodified lines | ||
| 532 | 532 | * tipc_link_bc_create - create new link to be used for broadcast |
| 533 | 533 | * @net: pointer to associated network namespace |
| 534 | 534 | * @mtu: mtu to be used initially if no peers |
| 535 | − * @window: send window to be used | |
| 535 | + * @min_win: minimal send window to be used by link | |
| 536 | + * @max_win: maximal send window to be used by link | |
| 536 | 537 | * @inputq: queue to put messages ready for delivery |
| 537 | 538 | * @namedq: queue to put binding table update messages ready for delivery |
| 538 | 539 | * @link: return value, pointer to put the created link |
| @@ -150,7 +150,8 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) · 149 unmodified lines | ||
| 150 | 150 | if (fragid == FIRST_FRAGMENT) { |
| 151 | 151 | if (unlikely(head)) |
| 152 | 152 | goto err; |
| 153 | − if (unlikely(skb_unclone(frag, GFP_ATOMIC))) | |
| 153 | + frag = skb_unshare(frag, GFP_ATOMIC); | |
| 154 | + if (unlikely(!frag)) | |
| 154 | 155 | goto err; |
| 155 | 156 | head = *headbuf = frag; |
| 156 | 157 | *buf = NULL; |
| @@ -2771,10 +2771,7 @@ static int tipc_shutdown(struct socket *sock, int how) · 2770 unmodified lines | ||
| 2771 | 2771 | |
| 2772 | 2772 | trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " "); |
| 2773 | 2773 | __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN); |
| 2774 | − if (tipc_sk_type_connectionless(sk)) | |
| 2775 | − sk->sk_shutdown = SHUTDOWN_MASK; | |
| 2776 | − else | |
| 2777 | − sk->sk_shutdown = SEND_SHUTDOWN; | |
| 2774 | + sk->sk_shutdown = SHUTDOWN_MASK; | |
| 2778 | 2775 | |
| 2779 | 2776 | if (sk->sk_state == TIPC_DISCONNECTING) { |
| 2780 | 2777 | /* Discard any unreceived messages */ |
| @@ -217,6 +217,7 @@ config LIB80211_CRYPT_WEP · 216 unmodified lines | ||
| 217 | 217 | |
| 218 | 218 | config LIB80211_CRYPT_CCMP |
| 219 | 219 | tristate |
| 220 | + select CRYPTO | |
| 220 | 221 | select CRYPTO_AES |
| 221 | 222 | select CRYPTO_CCM |
| 222 | 223 | |
| @@ -95,7 +95,7 @@ u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band) · 94 unmodified lines | ||
| 95 | 95 | /* see 802.11ax D6.1 27.3.23.2 */ |
| 96 | 96 | if (chan == 2) |
| 97 | 97 | return MHZ_TO_KHZ(5935); |
| 98 | − if (chan <= 253) | |
| 98 | + if (chan <= 233) | |
| 99 | 99 | return MHZ_TO_KHZ(5950 + chan * 5); |
| 100 | 100 | break; |
| 101 | 101 | case NL80211_BAND_60GHZ: |
| @@ -303,10 +303,10 @@ static int xdp_umem_account_pages(struct xdp_umem *umem) · 302 unmodified lines | ||
| 303 | 303 | |
| 304 | 304 | static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) |
| 305 | 305 | { |
| 306 | + u32 npgs_rem, chunk_size = mr->chunk_size, headroom = mr->headroom; | |
| 306 | 307 | bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG; |
| 307 | − u32 chunk_size = mr->chunk_size, headroom = mr->headroom; | |
| 308 | 308 | u64 npgs, addr = mr->addr, size = mr->len; |
| 309 | − unsigned int chunks, chunks_per_page; | |
| 309 | + unsigned int chunks, chunks_rem; | |
| 310 | 310 | int err; |
| 311 | 311 | |
| 312 | 312 | if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) { |
| @@ -336,19 +336,18 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) · 23 unmodified lines | ||
| 336 | 336 | if ((addr + size) < addr) |
| 337 | 337 | return -EINVAL; |
| 338 | 338 | |
| 339 | − npgs = size >> PAGE_SHIFT; | |
| 339 | + npgs = div_u64_rem(size, PAGE_SIZE, &npgs_rem); | |
| 340 | + if (npgs_rem) | |
| 341 | + npgs++; | |
| 340 | 342 | if (npgs > U32_MAX) |
| 341 | 343 | return -EINVAL; |
| 342 | 344 | |
| 343 | − chunks = (unsigned int)div_u64(size, chunk_size); | |
| 345 | + chunks = (unsigned int)div_u64_rem(size, chunk_size, &chunks_rem); | |
| 344 | 346 | if (chunks == 0) |
| 345 | 347 | return -EINVAL; |
| 346 | 348 | |
| 347 | − if (!unaligned_chunks) { | |
| 348 | − chunks_per_page = PAGE_SIZE / chunk_size; | |
| 349 | − if (chunks < chunks_per_page || chunks % chunks_per_page) | |
| 350 | − return -EINVAL; | |
| 351 | − } | |
| 349 | + if (!unaligned_chunks && chunks_rem) | |
| 350 | + return -EINVAL; | |
| 352 | 351 | |
| 353 | 352 | if (headroom >= chunk_size - XDP_PACKET_HEADROOM) |
| 354 | 353 | return -EINVAL; |
| @@ -38,7 +38,7 @@ FEATURE_TESTS = libbfd disassembler-four-args · 37 unmodified lines | ||
| 38 | 38 | FEATURE_DISPLAY = libbfd disassembler-four-args |
| 39 | 39 | |
| 40 | 40 | check_feat := 1 |
| 41 | −NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean | |
| 41 | +NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean | |
| 42 | 42 | ifdef MAKECMDGOALS |
| 43 | 43 | ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),) |
| 44 | 44 | check_feat := 0 |
| @@ -89,7 +89,7 @@ $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c · 44 unmodified lines | ||
| 89 | 89 | $(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c |
| 90 | 90 | $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c |
| 91 | 91 | |
| 92 | −clean: bpftool_clean runqslower_clean | |
| 92 | +clean: bpftool_clean runqslower_clean resolve_btfids_clean | |
| 93 | 93 | $(call QUIET_CLEAN, bpf-progs) |
| 94 | 94 | $(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \ |
| 95 | 95 | $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.* |
| @@ -80,6 +80,7 @@ libbpf-clean: · 79 unmodified lines | ||
| 80 | 80 | clean: libsubcmd-clean libbpf-clean fixdep-clean |
| 81 | 81 | $(call msg,CLEAN,$(BINARY)) |
| 82 | 82 | $(Q)$(RM) -f $(BINARY); \ |
| 83 | + $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ | |
| 83 | 84 | find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) |
| 84 | 85 | |
| 85 | 86 | tags: |
| @@ -59,7 +59,7 @@ FEATURE_USER = .libbpf · 58 unmodified lines | ||
| 59 | 59 | FEATURE_TESTS = libelf libelf-mmap zlib bpf reallocarray |
| 60 | 60 | FEATURE_DISPLAY = libelf zlib bpf |
| 61 | 61 | |
| 62 | −INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi | |
| 62 | +INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi | |
| 63 | 63 | FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES) |
| 64 | 64 | |
| 65 | 65 | check_feat := 1 |
| @@ -152,6 +152,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ · 86 unmodified lines | ||
| 152 | 152 | awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ |
| 153 | 153 | sort -u | wc -l) |
| 154 | 154 | VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ |
| 155 | + awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ | |
| 155 | 156 | grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l) |
| 156 | 157 | |
| 157 | 158 | CMD_TARGETS = $(LIB_TARGET) $(PC_FILE) |
| @@ -219,6 +220,7 @@ check_abi: $(OUTPUT)libbpf.so · 61 unmodified lines | ||
| 219 | 220 | awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ |
| 220 | 221 | sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ |
| 221 | 222 | readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ |
| 223 | + awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ | |
| 222 | 224 | grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \ |
| 223 | 225 | sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \ |
| 224 | 226 | diff -u $(OUTPUT)libbpf_global_syms.tmp \ |
| @@ -5203,8 +5203,8 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj, · 5202 unmodified lines | ||
| 5203 | 5203 | int i, j, nrels, new_sz; |
| 5204 | 5204 | const struct btf_var_secinfo *vi = NULL; |
| 5205 | 5205 | const struct btf_type *sec, *var, *def; |
| 5206 | + struct bpf_map *map = NULL, *targ_map; | |
| 5206 | 5207 | const struct btf_member *member; |
| 5207 | − struct bpf_map *map, *targ_map; | |
| 5208 | 5208 | const char *name, *mname; |
| 5209 | 5209 | Elf_Data *symbols; |
| 5210 | 5210 | unsigned int moff; |
| @@ -47,7 +47,10 @@ int dump_bpf_hash_map(struct bpf_iter__bpf_map_elem *ctx) · 46 unmodified lines | ||
| 47 | 47 | __u32 seq_num = ctx->meta->seq_num; |
| 48 | 48 | struct bpf_map *map = ctx->map; |
| 49 | 49 | struct key_t *key = ctx->key; |
| 50 | + struct key_t tmp_key; | |
| 50 | 51 | __u64 *val = ctx->value; |
| 52 | + __u64 tmp_val = 0; | |
| 53 | + int ret; | |
| 51 | 54 | |
| 52 | 55 | if (in_test_mode) { |
| 53 | 56 | /* test mode is used by selftests to |
| @@ -61,6 +64,18 @@ int dump_bpf_hash_map(struct bpf_iter__bpf_map_elem *ctx) · 7 unmodified lines | ||
| 61 | 64 | if (key == (void *)0 || val == (void *)0) |
| 62 | 65 | return 0; |
| 63 | 66 | |
| 67 | + /* update the value and then delete the <key, value> pair. | |
| 68 | + * it should not impact the existing 'val' which is still | |
| 69 | + * accessible under rcu. | |
| 70 | + */ | |
| 71 | + __builtin_memcpy(&tmp_key, key, sizeof(struct key_t)); | |
| 72 | + ret = bpf_map_update_elem(&hashmap1, &tmp_key, &tmp_val, 0); | |
| 73 | + if (ret) | |
| 74 | + return 0; | |
| 75 | + ret = bpf_map_delete_elem(&hashmap1, &tmp_key); | |
| 76 | + if (ret) | |
| 77 | + return 0; | |
| 78 | + | |
| 64 | 79 | key_sum_a += key->a; |
| 65 | 80 | key_sum_b += key->b; |
| 66 | 81 | key_sum_c += key->c; |
| @@ -1175,6 +1175,51 @@ kci_test_neigh_get() · 1174 unmodified lines | ||
| 1175 | 1175 | echo "PASS: neigh get" |
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | +kci_test_bridge_parent_id() | |
| 1179 | +{ | |
| 1180 | + local ret=0 | |
| 1181 | + sysfsnet=/sys/bus/netdevsim/devices/netdevsim | |
| 1182 | + probed=false | |
| 1183 | + | |
| 1184 | + if [ ! -w /sys/bus/netdevsim/new_device ] ; then | |
| 1185 | + modprobe -q netdevsim | |
| 1186 | + check_err $? | |
| 1187 | + if [ $ret -ne 0 ]; then | |
| 1188 | + echo "SKIP: bridge_parent_id can't load netdevsim" | |
| 1189 | + return $ksft_skip | |
| 1190 | + fi | |
| 1191 | + probed=true | |
| 1192 | + fi | |
| 1193 | + | |
| 1194 | + echo "10 1" > /sys/bus/netdevsim/new_device | |
| 1195 | + while [ ! -d ${sysfsnet}10 ] ; do :; done | |
| 1196 | + echo "20 1" > /sys/bus/netdevsim/new_device | |
| 1197 | + while [ ! -d ${sysfsnet}20 ] ; do :; done | |
| 1198 | + udevadm settle | |
| 1199 | + dev10=`ls ${sysfsnet}10/net/` | |
| 1200 | + dev20=`ls ${sysfsnet}20/net/` | |
| 1201 | + | |
| 1202 | + ip link add name test-bond0 type bond mode 802.3ad | |
| 1203 | + ip link set dev $dev10 master test-bond0 | |
| 1204 | + ip link set dev $dev20 master test-bond0 | |
| 1205 | + ip link add name test-br0 type bridge | |
| 1206 | + ip link set dev test-bond0 master test-br0 | |
| 1207 | + check_err $? | |
| 1208 | + | |
| 1209 | + # clean up any leftovers | |
| 1210 | + ip link del dev test-br0 | |
| 1211 | + ip link del dev test-bond0 | |
| 1212 | + echo 20 > /sys/bus/netdevsim/del_device | |
| 1213 | + echo 10 > /sys/bus/netdevsim/del_device | |
| 1214 | + $probed && rmmod netdevsim | |
| 1215 | + | |
| 1216 | + if [ $ret -ne 0 ]; then | |
| 1217 | + echo "FAIL: bridge_parent_id" | |
| 1218 | + return 1 | |
| 1219 | + fi | |
| 1220 | + echo "PASS: bridge_parent_id" | |
| 1221 | +} | |
| 1222 | + | |
| 1178 | 1223 | kci_test_rtnl() |
| 1179 | 1224 | { |
| 1180 | 1225 | local ret=0 |
| @@ -1224,6 +1269,8 @@ kci_test_rtnl() · 43 unmodified lines | ||
| 1224 | 1269 | check_err $? |
| 1225 | 1270 | kci_test_neigh_get |
| 1226 | 1271 | check_err $? |
| 1272 | + kci_test_bridge_parent_id | |
| 1273 | + check_err $? | |
| 1227 | 1274 | |
| 1228 | 1275 | kci_del_dummy |
| 1229 | 1276 | return $ret |