Skip to content
  1. Feb 08, 2023
    • Ido Schimmel's avatar
      mlxsw: spectrum_acl_tcam: Move devlink param to TCAM code · 74cbc3c0
      Ido Schimmel authored
      Cited commit added 'DEVLINK_CMD_PARAM_DEL' notifications whenever the
      network namespace of the devlink instance is changed. Specifically, the
      notifications are generated after calling reload_down(), but before
      calling reload_up(). At this stage, the data structures accessed while
      reading the value of the "acl_region_rehash_interval" devlink parameter
      are uninitialized, resulting in a use-after-free [1].
      
      Fix by moving the registration and unregistration of the devlink
      parameter to the TCAM code where it is actually used. This means that
      the parameter is unregistered during reload_down() and then
      re-registered during reload_up(), avoiding the use-after-free between
      these two operations.
      
      Reproducer:
      
       # ip netns add test123
       # devlink dev reload pci/0000:06:00.0 netns test123
      
      [1]
      BUG: KASAN: use-after-free in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_get+0xb2/0xd0
      Read of size 4 at addr ffff888162fd37d8 by task devlink/1323
      [...]
      Call Trace:
       <TASK>
       dump_stack_lvl+0x95/0xbd
       print_report+0x181/0x4a1
       kasan_report+0xdb/0x200
       mlxsw_sp_acl_tcam_vregion_rehash_intrvl_get+0xb2/0xd0
       mlxsw_sp_params_acl_region_rehash_intrvl_get+0x32/0x80
       devlink_nl_param_fill.constprop.0+0x29a/0x11e0
       devlink_param_notify.constprop.0+0xb9/0x250
       devlink_notify_unregister+0xbc/0x470
       devlink_reload+0x1aa/0x440
       devlink_nl_cmd_reload+0x559/0x11b0
       genl_family_rcv_msg_doit.isra.0+0x1f8/0x2e0
       genl_rcv_msg+0x558/0x7f0
       netlink_rcv_skb+0x170/0x440
       genl_rcv+0x2d/0x40
       netlink_unicast+0x53f/0x810
       netlink_sendmsg+0x961/0xe80
       __sys_sendto+0x2a4/0x420
       __x64_sys_sendto+0xe5/0x1c0
       do_syscall_64+0x38/0x80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Fixes: 7d7e9169
      
       ("devlink: move devlink reload notifications back in between _down() and _up() calls")
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      74cbc3c0
    • Ido Schimmel's avatar
      mlxsw: spectrum_acl_tcam: Reorder functions to avoid forward declarations · 194ab947
      Ido Schimmel authored
      
      
      Move the initialization and de-initialization code further below in
      order to avoid forward declarations in the next patch. No functional
      changes.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      194ab947
    • Ido Schimmel's avatar
      mlxsw: spectrum_acl_tcam: Make fini symmetric to init · 61fe3b91
      Ido Schimmel authored
      
      
      Move mutex_destroy() to the end to make the function symmetric with
      mlxsw_sp_acl_tcam_init(). No functional changes.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      61fe3b91
    • Ido Schimmel's avatar
      mlxsw: spectrum_acl_tcam: Add missing mutex_destroy() · 65823e07
      Ido Schimmel authored
      
      
      Pair mutex_init() with a mutex_destroy() in the error path. Found during
      code review. No functional changes.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      65823e07
    • Danielle Ratson's avatar
      mlxsw: spectrum: Remove pointless call to devlink_param_driverinit_value_set() · 8b50ac29
      Danielle Ratson authored
      The "acl_region_rehash_interval" devlink parameter is a "runtime"
      parameter, making the call to devl_param_driverinit_value_set()
      pointless. Before cited commit the function simply returned an error
      (that was not checked), but now it emits a WARNING [1].
      
      Fix by removing the function call.
      
      [1]
      WARNING: CPU: 0 PID: 7 at net/devlink/leftover.c:10974
      devl_param_driverinit_value_set+0x8c/0x90
      [...]
      Call Trace:
       <TASK>
       mlxsw_sp2_params_register+0x83/0xb0 [mlxsw_spectrum]
       __mlxsw_core_bus_device_register+0x5e5/0x990 [mlxsw_core]
       mlxsw_core_bus_device_register+0x42/0x60 [mlxsw_core]
       mlxsw_pci_probe+0x1f0/0x230 [mlxsw_pci]
       local_pci_probe+0x1a/0x40
       work_for_cpu_fn+0xf/0x20
       process_one_work+0x1db/0x390
       worker_thread+0x1d5/0x3b0
       kthread+0xe5/0x110
       ret_from_fork+0x1f/0x30
       </TASK>
      
      Fixes: 85fe0b32
      
       ("devlink: make devlink_param_driverinit_value_set() return void")
      Signed-off-by: default avatarDanielle Ratson <danieller@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8b50ac29
    • Vladimir Oltean's avatar
      net: enetc: add support for MAC Merge statistics counters · cf52bd23
      Vladimir Oltean authored
      
      
      Add PF driver support for the following:
      
      - Viewing the standardized MAC Merge layer counters.
      
      - Viewing the standardized Ethernet MAC and RMON counters associated
        with the pMAC.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20230206094531.444988-2-vladimir.oltean@nxp.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cf52bd23
    • Vladimir Oltean's avatar
      net: enetc: add support for MAC Merge layer · c7b9e808
      Vladimir Oltean authored
      
      
      Add PF driver support for viewing and changing the MAC Merge sublayer
      parameters, and seeing the verification state machine's current state.
      The verification handshake with the link partner is driven by hardware.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20230206094531.444988-1-vladimir.oltean@nxp.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c7b9e808
    • Jakub Kicinski's avatar
      Merge branch 'sched-cpumask-improve-on-cpumask_local_spread-locality' · cc74ca30
      Jakub Kicinski authored
      
      
      Yury Norov says:
      
      ====================
      sched: cpumask: improve on cpumask_local_spread() locality
      
      cpumask_local_spread() currently checks local node for presence of i'th
      CPU, and then if it finds nothing makes a flat search among all non-local
      CPUs. We can do it better by checking CPUs per NUMA hops.
      
      This has significant performance implications on NUMA machines, for example
      when using NUMA-aware allocated memory together with NUMA-aware IRQ
      affinity hints.
      
      Performance tests from patch 8 of this series for mellanox network
      driver show:
      
        TCP multi-stream, using 16 iperf3 instances pinned to 16 cores (with aRFS on).
        Active cores: 64,65,72,73,80,81,88,89,96,97,104,105,112,113,120,121
      
        +-------------------------+-----------+------------------+------------------+
        |                         | BW (Gbps) | TX side CPU util | RX side CPU util |
        +-------------------------+-----------+------------------+------------------+
        | Baseline                | 52.3      | 6.4 %            | 17.9 %           |
        +-------------------------+-----------+------------------+------------------+
        | Applied on TX side only | 52.6      | 5.2 %            | 18.5 %           |
        +-------------------------+-----------+------------------+------------------+
        | Applied on RX side only | 94.9      | 11.9 %           | 27.2 %           |
        +-------------------------+-----------+------------------+------------------+
        | Applied on both sides   | 95.1      | 8.4 %            | 27.3 %           |
        +-------------------------+-----------+------------------+------------------+
      
        Bottleneck in RX side is released, reached linerate (~1.8x speedup).
        ~30% less cpu util on TX.
      ====================
      
      Link: https://lore.kernel.org/r/20230121042436.2661843-1-yury.norov@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cc74ca30
    • Yury Norov's avatar
      lib/cpumask: update comment for cpumask_local_spread() · 2ac4980c
      Yury Norov authored
      
      
      Now that we have an iterator-based alternative for a very common case
      of using cpumask_local_spread for all cpus in a row, it's worth to
      mention that in comment to cpumask_local_spread().
      
      Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
      Reviewed-by: default avatarValentin Schneider <vschneid@redhat.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2ac4980c
    • Tariq Toukan's avatar
      net/mlx5e: Improve remote NUMA preferences used for the IRQ affinity hints · 2acda577
      Tariq Toukan authored
      
      
      In the IRQ affinity hints, replace the binary NUMA preference (local /
      remote) with the improved for_each_numa_hop_cpu() API that minds the
      actual distances, so that remote NUMAs with short distance are preferred
      over farther ones.
      
      This has significant performance implications when using NUMA-aware
      allocated memory (follow [1] and derivatives for example).
      
      [1]
      drivers/net/ethernet/mellanox/mlx5/core/en_main.c :: mlx5e_open_channel()
         int cpu = cpumask_first(mlx5_comp_irq_get_affinity_mask(priv->mdev, ix));
      
      Performance tests:
      
      TCP multi-stream, using 16 iperf3 instances pinned to 16 cores (with aRFS on).
      Active cores: 64,65,72,73,80,81,88,89,96,97,104,105,112,113,120,121
      
      +-------------------------+-----------+------------------+------------------+
      |                         | BW (Gbps) | TX side CPU util | RX side CPU util |
      +-------------------------+-----------+------------------+------------------+
      | Baseline                | 52.3      | 6.4 %            | 17.9 %           |
      +-------------------------+-----------+------------------+------------------+
      | Applied on TX side only | 52.6      | 5.2 %            | 18.5 %           |
      +-------------------------+-----------+------------------+------------------+
      | Applied on RX side only | 94.9      | 11.9 %           | 27.2 %           |
      +-------------------------+-----------+------------------+------------------+
      | Applied on both sides   | 95.1      | 8.4 %            | 27.3 %           |
      +-------------------------+-----------+------------------+------------------+
      
      Bottleneck in RX side is released, reached linerate (~1.8x speedup).
      ~30% less cpu util on TX.
      
      * CPU util on active cores only.
      
      Setups details (similar for both sides):
      
      NIC: ConnectX6-DX dual port, 100 Gbps each.
      Single port used in the tests.
      
      $ lscpu
      Architecture:        x86_64
      CPU op-mode(s):      32-bit, 64-bit
      Byte Order:          Little Endian
      CPU(s):              256
      On-line CPU(s) list: 0-255
      Thread(s) per core:  2
      Core(s) per socket:  64
      Socket(s):           2
      NUMA node(s):        16
      Vendor ID:           AuthenticAMD
      CPU family:          25
      Model:               1
      Model name:          AMD EPYC 7763 64-Core Processor
      Stepping:            1
      CPU MHz:             2594.804
      BogoMIPS:            4890.73
      Virtualization:      AMD-V
      L1d cache:           32K
      L1i cache:           32K
      L2 cache:            512K
      L3 cache:            32768K
      NUMA node0 CPU(s):   0-7,128-135
      NUMA node1 CPU(s):   8-15,136-143
      NUMA node2 CPU(s):   16-23,144-151
      NUMA node3 CPU(s):   24-31,152-159
      NUMA node4 CPU(s):   32-39,160-167
      NUMA node5 CPU(s):   40-47,168-175
      NUMA node6 CPU(s):   48-55,176-183
      NUMA node7 CPU(s):   56-63,184-191
      NUMA node8 CPU(s):   64-71,192-199
      NUMA node9 CPU(s):   72-79,200-207
      NUMA node10 CPU(s):  80-87,208-215
      NUMA node11 CPU(s):  88-95,216-223
      NUMA node12 CPU(s):  96-103,224-231
      NUMA node13 CPU(s):  104-111,232-239
      NUMA node14 CPU(s):  112-119,240-247
      NUMA node15 CPU(s):  120-127,248-255
      ..
      
      $ numactl -H
      ..
      node distances:
      node   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
        0:  10  11  11  11  12  12  12  12  32  32  32  32  32  32  32  32
        1:  11  10  11  11  12  12  12  12  32  32  32  32  32  32  32  32
        2:  11  11  10  11  12  12  12  12  32  32  32  32  32  32  32  32
        3:  11  11  11  10  12  12  12  12  32  32  32  32  32  32  32  32
        4:  12  12  12  12  10  11  11  11  32  32  32  32  32  32  32  32
        5:  12  12  12  12  11  10  11  11  32  32  32  32  32  32  32  32
        6:  12  12  12  12  11  11  10  11  32  32  32  32  32  32  32  32
        7:  12  12  12  12  11  11  11  10  32  32  32  32  32  32  32  32
        8:  32  32  32  32  32  32  32  32  10  11  11  11  12  12  12  12
        9:  32  32  32  32  32  32  32  32  11  10  11  11  12  12  12  12
       10:  32  32  32  32  32  32  32  32  11  11  10  11  12  12  12  12
       11:  32  32  32  32  32  32  32  32  11  11  11  10  12  12  12  12
       12:  32  32  32  32  32  32  32  32  12  12  12  12  10  11  11  11
       13:  32  32  32  32  32  32  32  32  12  12  12  12  11  10  11  11
       14:  32  32  32  32  32  32  32  32  12  12  12  12  11  11  10  11
       15:  32  32  32  32  32  32  32  32  12  12  12  12  11  11  11  10
      
      $ cat /sys/class/net/ens5f0/device/numa_node
      14
      
      Affinity hints (127 IRQs):
      Before:
      331: 00000000,00000000,00000000,00000000,00010000,00000000,00000000,00000000
      332: 00000000,00000000,00000000,00000000,00020000,00000000,00000000,00000000
      333: 00000000,00000000,00000000,00000000,00040000,00000000,00000000,00000000
      334: 00000000,00000000,00000000,00000000,00080000,00000000,00000000,00000000
      335: 00000000,00000000,00000000,00000000,00100000,00000000,00000000,00000000
      336: 00000000,00000000,00000000,00000000,00200000,00000000,00000000,00000000
      337: 00000000,00000000,00000000,00000000,00400000,00000000,00000000,00000000
      338: 00000000,00000000,00000000,00000000,00800000,00000000,00000000,00000000
      339: 00010000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      340: 00020000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      341: 00040000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      342: 00080000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      343: 00100000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      344: 00200000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      345: 00400000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      346: 00800000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      347: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
      348: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000002
      349: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000004
      350: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000008
      351: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000010
      352: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000020
      353: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000040
      354: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000080
      355: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000100
      356: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000200
      357: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000400
      358: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000800
      359: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00001000
      360: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00002000
      361: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00004000
      362: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00008000
      363: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00010000
      364: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00020000
      365: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00040000
      366: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00080000
      367: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00100000
      368: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00200000
      369: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00400000
      370: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00800000
      371: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,01000000
      372: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,02000000
      373: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,04000000
      374: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,08000000
      375: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,10000000
      376: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,20000000
      377: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,40000000
      378: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,80000000
      379: 00000000,00000000,00000000,00000000,00000000,00000000,00000001,00000000
      380: 00000000,00000000,00000000,00000000,00000000,00000000,00000002,00000000
      381: 00000000,00000000,00000000,00000000,00000000,00000000,00000004,00000000
      382: 00000000,00000000,00000000,00000000,00000000,00000000,00000008,00000000
      383: 00000000,00000000,00000000,00000000,00000000,00000000,00000010,00000000
      384: 00000000,00000000,00000000,00000000,00000000,00000000,00000020,00000000
      385: 00000000,00000000,00000000,00000000,00000000,00000000,00000040,00000000
      386: 00000000,00000000,00000000,00000000,00000000,00000000,00000080,00000000
      387: 00000000,00000000,00000000,00000000,00000000,00000000,00000100,00000000
      388: 00000000,00000000,00000000,00000000,00000000,00000000,00000200,00000000
      389: 00000000,00000000,00000000,00000000,00000000,00000000,00000400,00000000
      390: 00000000,00000000,00000000,00000000,00000000,00000000,00000800,00000000
      391: 00000000,00000000,00000000,00000000,00000000,00000000,00001000,00000000
      392: 00000000,00000000,00000000,00000000,00000000,00000000,00002000,00000000
      393: 00000000,00000000,00000000,00000000,00000000,00000000,00004000,00000000
      394: 00000000,00000000,00000000,00000000,00000000,00000000,00008000,00000000
      395: 00000000,00000000,00000000,00000000,00000000,00000000,00010000,00000000
      396: 00000000,00000000,00000000,00000000,00000000,00000000,00020000,00000000
      397: 00000000,00000000,00000000,00000000,00000000,00000000,00040000,00000000
      398: 00000000,00000000,00000000,00000000,00000000,00000000,00080000,00000000
      399: 00000000,00000000,00000000,00000000,00000000,00000000,00100000,00000000
      400: 00000000,00000000,00000000,00000000,00000000,00000000,00200000,00000000
      401: 00000000,00000000,00000000,00000000,00000000,00000000,00400000,00000000
      402: 00000000,00000000,00000000,00000000,00000000,00000000,00800000,00000000
      403: 00000000,00000000,00000000,00000000,00000000,00000000,01000000,00000000
      404: 00000000,00000000,00000000,00000000,00000000,00000000,02000000,00000000
      405: 00000000,00000000,00000000,00000000,00000000,00000000,04000000,00000000
      406: 00000000,00000000,00000000,00000000,00000000,00000000,08000000,00000000
      407: 00000000,00000000,00000000,00000000,00000000,00000000,10000000,00000000
      408: 00000000,00000000,00000000,00000000,00000000,00000000,20000000,00000000
      409: 00000000,00000000,00000000,00000000,00000000,00000000,40000000,00000000
      410: 00000000,00000000,00000000,00000000,00000000,00000000,80000000,00000000
      411: 00000000,00000000,00000000,00000000,00000000,00000001,00000000,00000000
      412: 00000000,00000000,00000000,00000000,00000000,00000002,00000000,00000000
      413: 00000000,00000000,00000000,00000000,00000000,00000004,00000000,00000000
      414: 00000000,00000000,00000000,00000000,00000000,00000008,00000000,00000000
      415: 00000000,00000000,00000000,00000000,00000000,00000010,00000000,00000000
      416: 00000000,00000000,00000000,00000000,00000000,00000020,00000000,00000000
      417: 00000000,00000000,00000000,00000000,00000000,00000040,00000000,00000000
      418: 00000000,00000000,00000000,00000000,00000000,00000080,00000000,00000000
      419: 00000000,00000000,00000000,00000000,00000000,00000100,00000000,00000000
      420: 00000000,00000000,00000000,00000000,00000000,00000200,00000000,00000000
      421: 00000000,00000000,00000000,00000000,00000000,00000400,00000000,00000000
      422: 00000000,00000000,00000000,00000000,00000000,00000800,00000000,00000000
      423: 00000000,00000000,00000000,00000000,00000000,00001000,00000000,00000000
      424: 00000000,00000000,00000000,00000000,00000000,00002000,00000000,00000000
      425: 00000000,00000000,00000000,00000000,00000000,00004000,00000000,00000000
      426: 00000000,00000000,00000000,00000000,00000000,00008000,00000000,00000000
      427: 00000000,00000000,00000000,00000000,00000000,00010000,00000000,00000000
      428: 00000000,00000000,00000000,00000000,00000000,00020000,00000000,00000000
      429: 00000000,00000000,00000000,00000000,00000000,00040000,00000000,00000000
      430: 00000000,00000000,00000000,00000000,00000000,00080000,00000000,00000000
      431: 00000000,00000000,00000000,00000000,00000000,00100000,00000000,00000000
      432: 00000000,00000000,00000000,00000000,00000000,00200000,00000000,00000000
      433: 00000000,00000000,00000000,00000000,00000000,00400000,00000000,00000000
      434: 00000000,00000000,00000000,00000000,00000000,00800000,00000000,00000000
      435: 00000000,00000000,00000000,00000000,00000000,01000000,00000000,00000000
      436: 00000000,00000000,00000000,00000000,00000000,02000000,00000000,00000000
      437: 00000000,00000000,00000000,00000000,00000000,04000000,00000000,00000000
      438: 00000000,00000000,00000000,00000000,00000000,08000000,00000000,00000000
      439: 00000000,00000000,00000000,00000000,00000000,10000000,00000000,00000000
      440: 00000000,00000000,00000000,00000000,00000000,20000000,00000000,00000000
      441: 00000000,00000000,00000000,00000000,00000000,40000000,00000000,00000000
      442: 00000000,00000000,00000000,00000000,00000000,80000000,00000000,00000000
      443: 00000000,00000000,00000000,00000000,00000001,00000000,00000000,00000000
      444: 00000000,00000000,00000000,00000000,00000002,00000000,00000000,00000000
      445: 00000000,00000000,00000000,00000000,00000004,00000000,00000000,00000000
      446: 00000000,00000000,00000000,00000000,00000008,00000000,00000000,00000000
      447: 00000000,00000000,00000000,00000000,00000010,00000000,00000000,00000000
      448: 00000000,00000000,00000000,00000000,00000020,00000000,00000000,00000000
      449: 00000000,00000000,00000000,00000000,00000040,00000000,00000000,00000000
      450: 00000000,00000000,00000000,00000000,00000080,00000000,00000000,00000000
      451: 00000000,00000000,00000000,00000000,00000100,00000000,00000000,00000000
      452: 00000000,00000000,00000000,00000000,00000200,00000000,00000000,00000000
      453: 00000000,00000000,00000000,00000000,00000400,00000000,00000000,00000000
      454: 00000000,00000000,00000000,00000000,00000800,00000000,00000000,00000000
      455: 00000000,00000000,00000000,00000000,00001000,00000000,00000000,00000000
      456: 00000000,00000000,00000000,00000000,00002000,00000000,00000000,00000000
      457: 00000000,00000000,00000000,00000000,00004000,00000000,00000000,00000000
      
      After:
      331: 00000000,00000000,00000000,00000000,00010000,00000000,00000000,00000000
      332: 00000000,00000000,00000000,00000000,00020000,00000000,00000000,00000000
      333: 00000000,00000000,00000000,00000000,00040000,00000000,00000000,00000000
      334: 00000000,00000000,00000000,00000000,00080000,00000000,00000000,00000000
      335: 00000000,00000000,00000000,00000000,00100000,00000000,00000000,00000000
      336: 00000000,00000000,00000000,00000000,00200000,00000000,00000000,00000000
      337: 00000000,00000000,00000000,00000000,00400000,00000000,00000000,00000000
      338: 00000000,00000000,00000000,00000000,00800000,00000000,00000000,00000000
      339: 00010000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      340: 00020000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      341: 00040000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      342: 00080000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      343: 00100000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      344: 00200000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      345: 00400000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      346: 00800000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      347: 00000000,00000000,00000000,00000000,00000001,00000000,00000000,00000000
      348: 00000000,00000000,00000000,00000000,00000002,00000000,00000000,00000000
      349: 00000000,00000000,00000000,00000000,00000004,00000000,00000000,00000000
      350: 00000000,00000000,00000000,00000000,00000008,00000000,00000000,00000000
      351: 00000000,00000000,00000000,00000000,00000010,00000000,00000000,00000000
      352: 00000000,00000000,00000000,00000000,00000020,00000000,00000000,00000000
      353: 00000000,00000000,00000000,00000000,00000040,00000000,00000000,00000000
      354: 00000000,00000000,00000000,00000000,00000080,00000000,00000000,00000000
      355: 00000000,00000000,00000000,00000000,00000100,00000000,00000000,00000000
      356: 00000000,00000000,00000000,00000000,00000200,00000000,00000000,00000000
      357: 00000000,00000000,00000000,00000000,00000400,00000000,00000000,00000000
      358: 00000000,00000000,00000000,00000000,00000800,00000000,00000000,00000000
      359: 00000000,00000000,00000000,00000000,00001000,00000000,00000000,00000000
      360: 00000000,00000000,00000000,00000000,00002000,00000000,00000000,00000000
      361: 00000000,00000000,00000000,00000000,00004000,00000000,00000000,00000000
      362: 00000000,00000000,00000000,00000000,00008000,00000000,00000000,00000000
      363: 00000000,00000000,00000000,00000000,01000000,00000000,00000000,00000000
      364: 00000000,00000000,00000000,00000000,02000000,00000000,00000000,00000000
      365: 00000000,00000000,00000000,00000000,04000000,00000000,00000000,00000000
      366: 00000000,00000000,00000000,00000000,08000000,00000000,00000000,00000000
      367: 00000000,00000000,00000000,00000000,10000000,00000000,00000000,00000000
      368: 00000000,00000000,00000000,00000000,20000000,00000000,00000000,00000000
      369: 00000000,00000000,00000000,00000000,40000000,00000000,00000000,00000000
      370: 00000000,00000000,00000000,00000000,80000000,00000000,00000000,00000000
      371: 00000001,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      372: 00000002,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      373: 00000004,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      374: 00000008,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      375: 00000010,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      376: 00000020,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      377: 00000040,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      378: 00000080,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      379: 00000100,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      380: 00000200,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      381: 00000400,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      382: 00000800,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      383: 00001000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      384: 00002000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      385: 00004000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      386: 00008000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      387: 01000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      388: 02000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      389: 04000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      390: 08000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      391: 10000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      392: 20000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      393: 40000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      394: 80000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
      395: 00000000,00000000,00000000,00000000,00000000,00000001,00000000,00000000
      396: 00000000,00000000,00000000,00000000,00000000,00000002,00000000,00000000
      397: 00000000,00000000,00000000,00000000,00000000,00000004,00000000,00000000
      398: 00000000,00000000,00000000,00000000,00000000,00000008,00000000,00000000
      399: 00000000,00000000,00000000,00000000,00000000,00000010,00000000,00000000
      400: 00000000,00000000,00000000,00000000,00000000,00000020,00000000,00000000
      401: 00000000,00000000,00000000,00000000,00000000,00000040,00000000,00000000
      402: 00000000,00000000,00000000,00000000,00000000,00000080,00000000,00000000
      403: 00000000,00000000,00000000,00000000,00000000,00000100,00000000,00000000
      404: 00000000,00000000,00000000,00000000,00000000,00000200,00000000,00000000
      405: 00000000,00000000,00000000,00000000,00000000,00000400,00000000,00000000
      406: 00000000,00000000,00000000,00000000,00000000,00000800,00000000,00000000
      407: 00000000,00000000,00000000,00000000,00000000,00001000,00000000,00000000
      408: 00000000,00000000,00000000,00000000,00000000,00002000,00000000,00000000
      409: 00000000,00000000,00000000,00000000,00000000,00004000,00000000,00000000
      410: 00000000,00000000,00000000,00000000,00000000,00008000,00000000,00000000
      411: 00000000,00000000,00000000,00000000,00000000,00010000,00000000,00000000
      412: 00000000,00000000,00000000,00000000,00000000,00020000,00000000,00000000
      413: 00000000,00000000,00000000,00000000,00000000,00040000,00000000,00000000
      414: 00000000,00000000,00000000,00000000,00000000,00080000,00000000,00000000
      415: 00000000,00000000,00000000,00000000,00000000,00100000,00000000,00000000
      416: 00000000,00000000,00000000,00000000,00000000,00200000,00000000,00000000
      417: 00000000,00000000,00000000,00000000,00000000,00400000,00000000,00000000
      418: 00000000,00000000,00000000,00000000,00000000,00800000,00000000,00000000
      419: 00000000,00000000,00000000,00000000,00000000,01000000,00000000,00000000
      420: 00000000,00000000,00000000,00000000,00000000,02000000,00000000,00000000
      421: 00000000,00000000,00000000,00000000,00000000,04000000,00000000,00000000
      422: 00000000,00000000,00000000,00000000,00000000,08000000,00000000,00000000
      423: 00000000,00000000,00000000,00000000,00000000,10000000,00000000,00000000
      424: 00000000,00000000,00000000,00000000,00000000,20000000,00000000,00000000
      425: 00000000,00000000,00000000,00000000,00000000,40000000,00000000,00000000
      426: 00000000,00000000,00000000,00000000,00000000,80000000,00000000,00000000
      427: 00000000,00000001,00000000,00000000,00000000,00000000,00000000,00000000
      428: 00000000,00000002,00000000,00000000,00000000,00000000,00000000,00000000
      429: 00000000,00000004,00000000,00000000,00000000,00000000,00000000,00000000
      430: 00000000,00000008,00000000,00000000,00000000,00000000,00000000,00000000
      431: 00000000,00000010,00000000,00000000,00000000,00000000,00000000,00000000
      432: 00000000,00000020,00000000,00000000,00000000,00000000,00000000,00000000
      433: 00000000,00000040,00000000,00000000,00000000,00000000,00000000,00000000
      434: 00000000,00000080,00000000,00000000,00000000,00000000,00000000,00000000
      435: 00000000,00000100,00000000,00000000,00000000,00000000,00000000,00000000
      436: 00000000,00000200,00000000,00000000,00000000,00000000,00000000,00000000
      437: 00000000,00000400,00000000,00000000,00000000,00000000,00000000,00000000
      438: 00000000,00000800,00000000,00000000,00000000,00000000,00000000,00000000
      439: 00000000,00001000,00000000,00000000,00000000,00000000,00000000,00000000
      440: 00000000,00002000,00000000,00000000,00000000,00000000,00000000,00000000
      441: 00000000,00004000,00000000,00000000,00000000,00000000,00000000,00000000
      442: 00000000,00008000,00000000,00000000,00000000,00000000,00000000,00000000
      443: 00000000,00010000,00000000,00000000,00000000,00000000,00000000,00000000
      444: 00000000,00020000,00000000,00000000,00000000,00000000,00000000,00000000
      445: 00000000,00040000,00000000,00000000,00000000,00000000,00000000,00000000
      446: 00000000,00080000,00000000,00000000,00000000,00000000,00000000,00000000
      447: 00000000,00100000,00000000,00000000,00000000,00000000,00000000,00000000
      448: 00000000,00200000,00000000,00000000,00000000,00000000,00000000,00000000
      449: 00000000,00400000,00000000,00000000,00000000,00000000,00000000,00000000
      450: 00000000,00800000,00000000,00000000,00000000,00000000,00000000,00000000
      451: 00000000,01000000,00000000,00000000,00000000,00000000,00000000,00000000
      452: 00000000,02000000,00000000,00000000,00000000,00000000,00000000,00000000
      453: 00000000,04000000,00000000,00000000,00000000,00000000,00000000,00000000
      454: 00000000,08000000,00000000,00000000,00000000,00000000,00000000,00000000
      455: 00000000,10000000,00000000,00000000,00000000,00000000,00000000,00000000
      456: 00000000,20000000,00000000,00000000,00000000,00000000,00000000,00000000
      457: 00000000,40000000,00000000,00000000,00000000,00000000,00000000,00000000
      
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      [Tweaked API use]
      Suggested-by: default avatarYury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarValentin Schneider <vschneid@redhat.com>
      Reviewed-by: default avatarYury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2acda577
    • Valentin Schneider's avatar
      sched/topology: Introduce for_each_numa_hop_mask() · 06ac0172
      Valentin Schneider authored
      
      
      The recently introduced sched_numa_hop_mask() exposes cpumasks of CPUs
      reachable within a given distance budget, wrap the logic for iterating over
      all (distance, mask) values inside an iterator macro.
      
      Signed-off-by: default avatarValentin Schneider <vschneid@redhat.com>
      Reviewed-by: default avatarYury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      06ac0172
    • Valentin Schneider's avatar
      sched/topology: Introduce sched_numa_hop_mask() · 9feae658
      Valentin Schneider authored
      
      
      Tariq has pointed out that drivers allocating IRQ vectors would benefit
      from having smarter NUMA-awareness - cpumask_local_spread() only knows
      about the local node and everything outside is in the same bucket.
      
      sched_domains_numa_masks is pretty much what we want to hand out (a cpumask
      of CPUs reachable within a given distance budget), introduce
      sched_numa_hop_mask() to export those cpumasks.
      
      Link: http://lore.kernel.org/r/20220728191203.4055-1-tariqt@nvidia.com
      Signed-off-by: default avatarValentin Schneider <vschneid@redhat.com>
      Reviewed-by: default avatarYury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9feae658
    • Yury Norov's avatar
      lib/cpumask: reorganize cpumask_local_spread() logic · b1beed72
      Yury Norov authored
      
      
      Now after moving all NUMA logic into sched_numa_find_nth_cpu(),
      else-branch of cpumask_local_spread() is just a function call, and
      we can simplify logic by using ternary operator.
      
      While here, replace BUG() with WARN_ON().
      
      Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
      Acked-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPeter Lafreniere <peter@n8pjl.ca>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b1beed72
    • Yury Norov's avatar
      cpumask: improve on cpumask_local_spread() locality · 406d394a
      Yury Norov authored
      
      
      Switch cpumask_local_spread() to use newly added sched_numa_find_nth_cpu(),
      which takes into account distances to each node in the system.
      
      For the following NUMA configuration:
      
      root@debian:~# numactl -H
      available: 4 nodes (0-3)
      node 0 cpus: 0 1 2 3
      node 0 size: 3869 MB
      node 0 free: 3740 MB
      node 1 cpus: 4 5
      node 1 size: 1969 MB
      node 1 free: 1937 MB
      node 2 cpus: 6 7
      node 2 size: 1967 MB
      node 2 free: 1873 MB
      node 3 cpus: 8 9 10 11 12 13 14 15
      node 3 size: 7842 MB
      node 3 free: 7723 MB
      node distances:
      node   0   1   2   3
        0:  10  50  30  70
        1:  50  10  70  30
        2:  30  70  10  50
        3:  70  30  50  10
      
      The new cpumask_local_spread() traverses cpus for each node like this:
      
      node 0:   0   1   2   3   6   7   4   5   8   9  10  11  12  13  14  15
      node 1:   4   5   8   9  10  11  12  13  14  15   0   1   2   3   6   7
      node 2:   6   7   0   1   2   3   8   9  10  11  12  13  14  15   4   5
      node 3:   8   9  10  11  12  13  14  15   4   5   6   7   0   1   2   3
      
      Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
      Acked-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPeter Lafreniere <peter@n8pjl.ca>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      406d394a
    • Yury Norov's avatar
      sched: add sched_numa_find_nth_cpu() · cd7f5535
      Yury Norov authored
      
      
      The function finds Nth set CPU in a given cpumask starting from a given
      node.
      
      Leveraging the fact that each hop in sched_domains_numa_masks includes the
      same or greater number of CPUs than the previous one, we can use binary
      search on hops instead of linear walk, which makes the overall complexity
      of O(log n) in terms of number of cpumask_weight() calls.
      
      Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
      Acked-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPeter Lafreniere <peter@n8pjl.ca>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cd7f5535
    • Yury Norov's avatar
      cpumask: introduce cpumask_nth_and_andnot · 62f4386e
      Yury Norov authored
      
      
      Introduce cpumask_nth_and_andnot() based on find_nth_and_andnot_bit().
      It's used in the following patch to traverse cpumasks without storing
      intermediate result in temporary cpumask.
      
      Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
      Acked-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPeter Lafreniere <peter@n8pjl.ca>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      62f4386e
    • Yury Norov's avatar
      lib/find: introduce find_nth_and_andnot_bit · 43245117
      Yury Norov authored
      
      
      In the following patches the function is used to implement in-place bitmaps
      traversing without storing intermediate result in temporary bitmaps.
      
      Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
      Acked-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPeter Lafreniere <peter@n8pjl.ca>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      43245117
    • Jakub Kicinski's avatar
      Merge branch 'net-core-use-a-dedicated-kmem_cache-for-skb-head-allocs' · 383d9f87
      Jakub Kicinski authored
      
      
      Eric Dumazet says:
      
      ====================
      net: core: use a dedicated kmem_cache for skb head allocs
      
      Our profile data show that using kmalloc(non_const_size)/kfree(ptr)
      has a certain cost, because kfree(ptr) has to pull a 'struct page'
      in cpu caches.
      
      Using a dedicated kmem_cache for TCP skb->head allocations makes
      a difference, both in cpu cycles and memory savings.
      
      This kmem_cache could also be used for GRO skb allocations,
      this is left as a future exercise.
      ====================
      
      Link: https://lore.kernel.org/r/20230206173103.2617121-1-edumazet@google.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      383d9f87
    • Eric Dumazet's avatar
      net: add dedicated kmem_cache for typical/small skb->head · bf9f1baa
      Eric Dumazet authored
      Recent removal of ksize() in alloc_skb() increased
      performance because we no longer read
      the associated struct page.
      
      We have an equivalent cost at kfree_skb() time.
      
      kfree(skb->head) has to access a struct page,
      often cold in cpu caches to get the owning
      struct kmem_cache.
      
      Considering that many allocations are small (at least for TCP ones)
      we can have our own kmem_cache to avoid the cache line miss.
      
      This also saves memory because these small heads
      are no longer padded to 1024 bytes.
      
      CONFIG_SLUB=y
      $ grep skbuff_small_head /proc/slabinfo
      skbuff_small_head   2907   2907    640   51    8 : tunables    0    0    0 : slabdata     57     57      0
      
      CONFIG_SLAB=y
      $ grep skbuff_small_head /proc/slabinfo
      skbuff_small_head    607    624    640    6    1 : tunables   54   27    8 : slabdata    104    104      5
      
      Notes:
      
      - After Kees Cook patches and this one, we might
        be able to revert commit
        dbae2b06
      
       ("net: skb: introduce and use a single page frag cache")
        because GRO_MAX_HEAD is also small.
      
      - This patch is a NOP for CONFIG_SLOB=y builds.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bf9f1baa
    • Eric Dumazet's avatar
      net: factorize code in kmalloc_reserve() · 5c0e820c
      Eric Dumazet authored
      
      
      All kmalloc_reserve() callers have to make the same computation,
      we can factorize them, to prepare following patch in the series.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5c0e820c
    • Eric Dumazet's avatar
      net: remove osize variable in __alloc_skb() · 65998d2b
      Eric Dumazet authored
      
      
      This is a cleanup patch, to prepare following change.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      65998d2b
    • Eric Dumazet's avatar
      net: add SKB_HEAD_ALIGN() helper · 115f1a5c
      Eric Dumazet authored
      
      
      We have many places using this expression:
      
       SKB_DATA_ALIGN(sizeof(struct skb_shared_info))
      
      Use of SKB_HEAD_ALIGN() will allow to clean them.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      115f1a5c
  2. Feb 07, 2023
    • Paolo Abeni's avatar
      Merge tag 'linux-can-next-for-6.3-20230206' of... · 61d731e6
      Paolo Abeni authored
      
      Merge tag 'linux-can-next-for-6.3-20230206' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
      
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can-next 2023-02-06
      
      this is a pull request of 47 patches for net-next/master.
      
      The first two patch is by Oliver Hartkopp. One adds missing error
      checking to the CAN_GW protocol, the other adds a missing CAN address
      family check to the CAN ISO TP protocol.
      
      Thomas Kopp contributes a performance optimization to the mcp251xfd
      driver.
      
      The next 11 patches are by Geert Uytterhoeven and add support for
      R-Car V4H systems to the rcar_canfd driver.
      
      Stephane Grosjean and Lukas Magel contribute 8 patches to the peak_usb
      driver, which add support for configurable CAN channel ID.
      
      The last 17 patches are by me and target the CAN bit timing
      configuration. The bit timing is cleaned up, error messages are
      improved and forwarded to user space via NL_SET_ERR_MSG_FMT() instead
      of netdev_err(), and the SJW handling is updated, including the
      definition of a new default value that will benefit CAN-FD
      controllers, by increasing their oscillator tolerance.
      
      * tag 'linux-can-next-for-6.3-20230206' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next: (47 commits)
        can: bittiming: can_validate_bitrate(): report error via netlink
        can: bittiming: can_calc_bittiming(): convert from netdev_err() to NL_SET_ERR_MSG_FMT()
        can: bittiming: can_calc_bittiming(): clean up SJW handling
        can: bittiming: can_sjw_set_default(): use Phase Seg2 / 2 as default for SJW
        can: bittiming: can_sjw_check(): check that SJW is not longer than either Phase Buffer Segment
        can: bittiming: can_sjw_check(): report error via netlink and harmonize error value
        can: bittiming: can_fixup_bittiming(): report error via netlink and harmonize error value
        can: bittiming: factor out can_sjw_set_default() and can_sjw_check()
        can: bittiming: can_changelink() pass extack down callstack
        can: netlink: can_changelink(): convert from netdev_err() to NL_SET_ERR_MSG_FMT()
        can: netlink: can_validate(): validate sample point for CAN and CAN-FD
        can: dev: register_candev(): bail out if both fixed bit rates and bit timing constants are provided
        can: dev: register_candev(): ensure that bittiming const are valid
        can: bittiming: can_get_bittiming(): use direct return and remove unneeded else
        can: bittiming: can_fixup_bittiming(): set effective tq
        can: bittiming: can_fixup_bittiming(): use CAN_SYNC_SEG instead of 1
        can: bittiming(): replace open coded variants of can_bit_time()
        can: peak_usb: Reorder include directives alphabetically
        can: peak_usb: align CAN channel ID format in log with sysfs attribute
        can: peak_usb: export PCAN CAN channel ID as sysfs device attribute
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20230206131620.2758724-1-mkl@pengutronix.de
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      61d731e6
    • Vladimir Oltean's avatar
      ethtool: mm: fix get_mm() return code not propagating to user space · ca8e4cbf
      Vladimir Oltean authored
      If ops->get_mm() returns a non-zero error code, we goto out_complete,
      but there, we return 0. Fix that to propagate the "ret" variable to the
      caller. If ops->get_mm() succeeds, it will always return 0.
      
      Fixes: 2b30f829
      
       ("net: ethtool: add support for MAC Merge layer")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230206094932.446379-1-vladimir.oltean@nxp.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      ca8e4cbf
    • Eddy Tao's avatar
      net: openvswitch: reduce cpu_used_mask memory · 15ea59a0
      Eddy Tao authored
      
      
      Use actual CPU number instead of hardcoded value to decide the size
      of 'cpu_used_mask' in 'struct sw_flow'. Below is the reason.
      
      'struct cpumask cpu_used_mask' is embedded in struct sw_flow.
      Its size is hardcoded to CONFIG_NR_CPUS bits, which can be
      8192 by default, it costs memory and slows down ovs_flow_alloc.
      
      To address this:
       Redefine cpu_used_mask to pointer.
       Append cpumask_size() bytes after 'stat' to hold cpumask.
       Initialization cpu_used_mask right after stats_last_writer.
      
      APIs like cpumask_next and cpumask_set_cpu never access bits
      beyond cpu count, cpumask_size() bytes of memory is enough.
      
      Signed-off-by: default avatarEddy Tao <taoyuan_eddy@hotmail.com>
      Acked-by: default avatarEelco Chaudron <echaudro@redhat.com>
      Link: https://lore.kernel.org/r/OS3P286MB229570CCED618B20355D227AF5D59@OS3P286MB2295.JPNP286.PROD.OUTLOOK.COM
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      15ea59a0
    • Arnd Bergmann's avatar
      amd-xgbe: fix mismatched prototype · bbe64186
      Arnd Bergmann authored
      The forward declaration was introduced with a prototype that does
      not match the function definition:
      
      drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:2166:13: error: conflicting types for 'xgbe_phy_perform_ratechange' due to enum/integer mismatch; have 'void(struct xgbe_prv_data *, enum xgbe_mb_cmd,  enum xgbe_mb_subcmd)' [-Werror=enum-int-mismatch]
       2166 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
            |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:391:13: note: previous declaration of 'xgbe_phy_perform_ratechange' with type 'void(struct xgbe_prv_data *, unsigned int,  unsigned int)'
        391 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
            |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Ideally there should not be any forward declarations here, which
      would make it easier to show that there is no unbounded recursion.
      I tried fixing this but could not figure out how to avoid the
      recursive call.
      
      As a hotfix, address only the broken prototype to fix the build
      problem instead.
      
      Fixes: 4f3b20bf
      
       ("amd-xgbe: add support for rx-adaptation")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Acked-by: default avatarShyam Sundar S K <Shyam-sundar.S-k@amd.com>
      Link: https://lore.kernel.org/r/20230203121553.2871598-1-arnd@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bbe64186
    • Colin Foster's avatar
      net: mscc: ocelot: un-export unused regmap symbols · b1ca2f1b
      Colin Foster authored
      There are no external users of the vsc7514_*_regmap[] symbols or
      vsc7514_vcap_* functions. They were exported in commit 32ecd22b ("net:
      mscc: ocelot: split register definitions to a separate file") with the
      intention of being used, but the actual structure used in commit
      2efaca41
      
       ("net: mscc: ocelot: expose vsc7514_regmap definition") ended
      up being all that was needed.
      
      Bury these unnecessary symbols.
      
      Signed-off-by: default avatarColin Foster <colin.foster@in-advantage.com>
      Suggested-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20230204182056.25502-1-colin.foster@in-advantage.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b1ca2f1b
    • Jakub Kicinski's avatar
      Merge branch 'aux-bus-v11' of https://github.com/ajitkhaparde1/linux · 9ac543c0
      Jakub Kicinski authored
      
      
      Ajit Khaparde says:
      
      ====================
      bnxt: Add Auxiliary driver support
      
      Add auxiliary device driver for Broadcom devices.
      The bnxt_en driver will register and initialize an aux device
      if RDMA is enabled in the underlying device.
      The bnxt_re driver will then probe and initialize the
      RoCE interfaces with the infiniband stack.
      
      We got rid of the bnxt_en_ops which the bnxt_re driver used to
      communicate with bnxt_en.
      Similarly  We have tried to clean up most of the bnxt_ulp_ops.
      In most of the cases we used the functions and entry points provided
      by the auxiliary bus driver framework.
      And now these are the minimal functions needed to support the functionality.
      
      We will try to work on getting rid of the remaining if we find any
      other viable option in future.
      
      * 'aux-bus-v11' of https://github.com/ajitkhaparde1/linux:
        bnxt_en: Remove runtime interrupt vector allocation
        RDMA/bnxt_re: Remove the sriov config callback
        bnxt_en: Remove struct bnxt access from RoCE driver
        bnxt_en: Use auxiliary bus calls over proprietary calls
        bnxt_en: Use direct API instead of indirection
        bnxt_en: Remove usage of ulp_id
        RDMA/bnxt_re: Use auxiliary driver interface
        bnxt_en: Add auxiliary driver support
      ====================
      
      Link: https://lore.kernel.org/r/20230202033809.3989-1-ajit.khaparde@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9ac543c0
  3. Feb 06, 2023
    • Marc Kleine-Budde's avatar
      Merge patch series "can: bittiming: cleanups and rework SJW handling" · 3dafbe5c
      Marc Kleine-Budde authored
      
      
      Marc Kleine-Budde <mkl@pengutronix.de> says:
      
      several people noticed that on modern CAN controllers with wide bit
      timing registers the default SJW of 1 can result in unstable or no
      synchronization to the CAN network. See Patch 14/17 for details.
      
      During review of v1 Vincent pointed out that the original code and the
      series doesn't always check user provided bit timing parameters,
      sometimes silently limits them and the return error values are not
      consistent.
      
      This series first cleans up some code in bittiming.c, replacing
      open-coded variants by macros or functions (Patches 1, 2).
      
      Patch 3 adds the missing assignment of the effective TQ if the
      interface is configured with low level timing parameters.
      
      Patch 4 is another code cleanup.
      
      Patches 5, 6 check the bit timing parameter during interface
      registration.
      
      Patch 7 adds a validation of the sample point.
      
      The patches 8-13 convert the error messages from netdev_err() to
      NL_SET_ERR_MSG_FMT, factor out the SJW handling from
      can_fixup_bittiming(), add checking and error messages for the
      individual limits and harmonize the error return values.
      
      Patch 14 changes the default SJW value from 1 to min(Phase Seg1, Phase
      Seg2 / 2).
      
      Patch 15 switches can_calc_bittiming() to use the new SJW handling.
      
      Patch 16 converts can_calc_bittiming() to NL_SET_ERR_MSG_FMT().
      
      And patch 16 adds a NL_SET_ERR_MSG_FMT() error message to
      can_validate_bitrate().
      
      v1: https://lore.kernel.org/all/20220907103845.3929288-1-mkl@pengutronix.de
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-1-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      3dafbe5c
    • Marc Kleine-Budde's avatar
      can: bittiming: can_validate_bitrate(): report error via netlink · 6d793471
      Marc Kleine-Budde authored
      
      
      Report an error to user space via netlink if the requested bit rate is
      not supported by the device.
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-18-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      6d793471
    • Marc Kleine-Budde's avatar
      can: bittiming: can_calc_bittiming(): convert from netdev_err() to NL_SET_ERR_MSG_FMT() · 06742086
      Marc Kleine-Budde authored
      
      
      Replace the netdev_err() by NL_SET_ERR_MSG_FMT() to better inform the
      user about the problem. While there, use %u to print unsigned values
      and improve error message a bit.
      
      In case of an error, return -EINVAL instead of -EDOM, this corresponds
      better to the actual meaning of the error value.
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-17-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      06742086
    • Marc Kleine-Budde's avatar
      can: bittiming: can_calc_bittiming(): clean up SJW handling · c7650728
      Marc Kleine-Budde authored
      
      
      In the current code, if the user configures a bitrate, a default SJW
      value of 1 is used. If the user configures both a bitrate and a SJW
      value, can_calc_bittiming() silently limits the SJW value to SJW max
      and TSEG2.
      
      We came to the conclusion that if the user provided an invalid SJW
      value, it's best to bail out and inform the user [1].
      
      [1] https://lore.kernel.org/all/CAMZ6RqKqhmTgUZiwe5uqUjBDnhhC2iOjZ791+Y845btJYwVDKg@mail.gmail.com
      
      Further the ISO 11898-1:2015 standard mandates that "SJW shall be less
      than or equal to the minimum of these two items: Phase_Seg1 and
      Phase_Seg2." [2] The current code is missing that check.
      
      [2] https://lore.kernel.org/all/BL3PR11MB64844E3FC13C55433CDD0B3DFB449@BL3PR11MB6484.namprd11.prod.outlook.com
      
      The previous patches introduced
      1) can_sjw_set_default() - sets a default value for SJW if unset
      2) can_sjw_check() - implements a SJW check against SJW max, Phase
         Seg1 and Phase Seg2. In the error case this function reports the error
         to user space via netlink.
      
      Replace both the open-coded SJW default setting and the open-coded and
      insufficient checks of SJW with the helper functions
      can_sjw_set_default() and can_sjw_check().
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-16-mkl@pengutronix.de
      Link: https://lore.kernel.org/all/CAMZ6RqKqhmTgUZiwe5uqUjBDnhhC2iOjZ791+Y845btJYwVDKg@mail.gmail.com
      Link: https://lore.kernel.org/all/BL3PR11MB64844E3FC13C55433CDD0B3DFB449@BL3PR11MB6484.namprd11.prod.outlook.com
      Suggested-by: default avatarThomas Kopp <Thomas.Kopp@microchip.com>
      Suggested-by: default avatarVincent Mailhol <vincent.mailhol@gmail.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      c7650728
    • Marc Kleine-Budde's avatar
      can: bittiming: can_sjw_set_default(): use Phase Seg2 / 2 as default for SJW · 80bcf5ec
      Marc Kleine-Budde authored
      
      
      "The (Re-)Synchronization Jump Width (SJW) defines how far a
       resynchronization may move the Sample Point inside the limits defined
       by the Phase Buffer Segments to compensate for edge phase errors." [1]
      
      In other words, this means that the SJW parameter controls the
      tolerance of the CAN controller to frequency errors compared to other
      CAN controllers.
      
      If the user space does not provide an SJW parameter, the kernel
      chooses a default value of 1. This has proven to be a good default
      value for classic CAN controllers, but no longer for modern CAN-FD
      controllers.
      
      In the past there were CAN controllers like the sja1000 with a rather
      limited range of bit timing parameters. For the standard bit rates
      this results in the following bit timing parameters:
      
      | Bit timing parameters for sja1000 with 8.000000 MHz ref clock
      |                     _----+--------------=> tseg1: 1 …   16
      |                    /    /     _---------=> tseg2: 1 …    8
      |                   |    |     /    _-----=> sjw:   1 …    4
      |                   |    |    |    /    _-=> brp:   1 …   64 (inc: 1)
      |                   |    |    |   |    /
      |  nominal          |    |    |   |   |     real  Bitrt    nom   real   SampP
      |  Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP  Bitrate  Error  SampP  SampP   Error  BTR0 BTR1
      |  1000000    125   2    3    2   1   1  1000000   0.0%  75.0%  75.0%   0.0%   0x00 0x14
      |   800000    125   3    4    2   1   1   800000   0.0%  80.0%  80.0%   0.0%   0x00 0x16
      |   666666    125   4    4    3   1   1   666666   0.0%  80.0%  75.0%   6.2%   0x00 0x27
      |   500000    125   6    7    2   1   1   500000   0.0%  87.5%  87.5%   0.0%   0x00 0x1c
      |   250000    250   6    7    2   1   2   250000   0.0%  87.5%  87.5%   0.0%   0x01 0x1c
      |   125000    500   6    7    2   1   4   125000   0.0%  87.5%  87.5%   0.0%   0x03 0x1c
      |   100000    625   6    7    2   1   5   100000   0.0%  87.5%  87.5%   0.0%   0x04 0x1c
      |    83333    750   6    7    2   1   6    83333   0.0%  87.5%  87.5%   0.0%   0x05 0x1c
      |    50000   1250   6    7    2   1  10    50000   0.0%  87.5%  87.5%   0.0%   0x09 0x1c
      |    33333   1875   6    7    2   1  15    33333   0.0%  87.5%  87.5%   0.0%   0x0e 0x1c
      |    20000   3125   6    7    2   1  25    20000   0.0%  87.5%  87.5%   0.0%   0x18 0x1c
      |    10000   6250   6    7    2   1  50    10000   0.0%  87.5%  87.5%   0.0%   0x31 0x1c
      
      The attentive reader will notice that the SJW is 1 in most cases,
      while the Seg2 phase is 2. Both values are given in TQ units, which in
      turn is a duration in nanoseconds.
      
      For example the 500 kbit/s configuration:
      
      |  nominal                                  real  Bitrt    nom   real   SampP
      |  Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP  Bitrate  Error  SampP  SampP   Error  BTR0 BTR1
      |   500000    125   6    7    2   1   1   500000   0.0%  87.5%  87.5%   0.0%   0x00 0x1c
      
      the TQ is 125ns, the Phase Seg2 is "2" (== 250ns), the SJW is "1" (==
      125 ns).
      
      Looking at a more modern CAN controller like a mcp2518fd, it has wider
      bit timing registers.
      
      | Bit timing parameters for mcp251xfd with 40.000000 MHz ref clock
      |                     _----+--------------=> tseg1: 2 …  256
      |                    /    /     _---------=> tseg2: 1 …  128
      |                   |    |     /    _-----=> sjw:   1 …  128
      |                   |    |    |    /    _-=> brp:   1 …  256 (inc: 1)
      |                   |    |    |   |    /
      |  nominal          |    |    |   |   |     real  Bitrt    nom   real   SampP
      |  Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP  Bitrate  Error  SampP  SampP   Error      NBTCFG
      |   500000     25  34   35   10   1   1   500000   0.0%  87.5%  87.5%   0.0%   0x00440900
      
      The TQ is 25ns, the Phase Seg 2 is "10" (== 250ns), the SJW is "1" (==
      25ns).
      
      Since the kernel chooses a default SJW of 1 regardless of the TQ, this
      leads to a much smaller SJW and thus much smaller tolerances to
      frequency errors.
      
      To maintain the same oscillator tolerances on controllers with wide
      bit timing registers, select a default SJW value of Phase Seg2 / 2
      unless Phase Seg 1 is less. This results in the following bit timing
      parameters:
      
      | Bit timing parameters for mcp251xfd with 40.000000 MHz ref clock
      |                     _----+--------------=> tseg1: 2 …  256
      |                    /    /     _---------=> tseg2: 1 …  128
      |                   |    |     /    _-----=> sjw:   1 …  128
      |                   |    |    |    /    _-=> brp:   1 …  256 (inc: 1)
      |                   |    |    |   |    /
      |  nominal          |    |    |   |   |     real  Bitrt    nom   real   SampP
      |  Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP  Bitrate  Error  SampP  SampP   Error      NBTCFG
      |   500000     25  34   35   10   5   1   500000   0.0%  87.5%  87.5%   0.0%   0x00440904
      
      The TQ is 25ns, the Phase Seg 2 is "10" (== 250ns), the SJW is "5" (==
      125ns). Which is the same as on the sja1000 controller.
      
      [1] http://web.archive.org/http://www.oertel-halle.de/files/cia99paper.pdf
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-15-mkl@pengutronix.de
      Cc: Mark Bath <mark@baggywrinkle.co.uk>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      80bcf5ec
    • Marc Kleine-Budde's avatar
      can: bittiming: can_sjw_check(): check that SJW is not longer than either Phase Buffer Segment · b5a3d086
      Marc Kleine-Budde authored
      
      
      According to "The Configuration of the CAN Bit Timing" [1] the SJW
      "may not be longer than either Phase Buffer Segment".
      
      Check SJW against length of both Phase buffers. In case the SJW is
      greater, report an error via netlink to user space and bail out.
      
      [1] http://web.archive.org/http://www.oertel-halle.de/files/cia99paper.pdf
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-14-mkl@pengutronix.de
      Suggested-by: default avatarVincent Mailhol <vincent.mailhol@gmail.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      b5a3d086
    • Marc Kleine-Budde's avatar
      can: bittiming: can_sjw_check(): report error via netlink and harmonize error value · 0c017f09
      Marc Kleine-Budde authored
      
      
      If the user space has supplied an invalid SJW value (greater than the
      maximum SJW value), report -EINVAL instead of -ERANGE, this better
      matches the actual meaning of the error value.
      
      Additionally report an error message via netlink to the user space.
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-13-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      0c017f09
    • Marc Kleine-Budde's avatar
      can: bittiming: can_fixup_bittiming(): report error via netlink and harmonize error value · de82d618
      Marc Kleine-Budde authored
      
      
      Check each bit timing parameter first individually against their
      limits and report a meaningful error message via netlink to the user
      space.
      
      In case of an error, return -EINVAL instead of -ERANGE, this
      corresponds better to the actual meaning of the error value.
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-12-mkl@pengutronix.de
      Suggested-by: default avatarVincent Mailhol <vincent.mailhol@gmail.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      de82d618
    • Marc Kleine-Budde's avatar
      can: bittiming: factor out can_sjw_set_default() and can_sjw_check() · 5988bf73
      Marc Kleine-Budde authored
      
      
      Factor out the functionality of assigning a SJW default value into
      can_sjw_set_default() and the checking the SJW limits into
      can_sjw_check().
      
      This functions will be improved and called from a different function
      in the following patches.
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-11-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      5988bf73
    • Marc Kleine-Budde's avatar
      can: bittiming: can_changelink() pass extack down callstack · 286c0e09
      Marc Kleine-Budde authored
      
      
      This is a preparation patch.
      
      In order to pass warning/error messages during netlink calls back to
      user space, pass the extack struct down the callstack of
      can_changelink(), the actual error messages will be added in the
      following ptaches.
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-10-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      286c0e09
    • Marc Kleine-Budde's avatar
      can: netlink: can_changelink(): convert from netdev_err() to NL_SET_ERR_MSG_FMT() · 1494d27f
      Marc Kleine-Budde authored
      Since commit 51c352bd
      
       ("netlink: add support for formatted extack
      messages") formatted extack messages are supported to inform the user
      space or warnings/errors during netlink calls.
      
      Replace the netdev_err() by NL_SET_ERR_MSG_FMT() to better inform the
      user about the problem. While there, use %u to print unsigned values
      and improve error message a bit.
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-9-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      1494d27f
    • Marc Kleine-Budde's avatar
      can: netlink: can_validate(): validate sample point for CAN and CAN-FD · 73335cfa
      Marc Kleine-Budde authored
      
      
      The sample point is a value in tenths of a percent. Meaningful values
      are between 0 and 1000. Invalid values are rejected and an error
      message is returned to user space via netlink.
      
      Link: https://lore.kernel.org/all/20230202110854.2318594-8-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      73335cfa