Skip to content
  1. Sep 30, 2021
    • Wei Wang's avatar
      net: add new socket option SO_RESERVE_MEM · 2bb2f5fb
      Wei Wang authored
      
      
      This socket option provides a mechanism for users to reserve a certain
      amount of memory for the socket to use. When this option is set, kernel
      charges the user specified amount of memory to memcg, as well as
      sk_forward_alloc. This amount of memory is not reclaimable and is
      available in sk_forward_alloc for this socket.
      With this socket option set, the networking stack spends less cycles
      doing forward alloc and reclaim, which should lead to better system
      performance, with the cost of an amount of pre-allocated and
      unreclaimable memory, even under memory pressure.
      
      Note:
      This socket option is only available when memory cgroup is enabled and we
      require this reserved memory to be charged to the user's memcg. We hope
      this could avoid mis-behaving users to abused this feature to reserve a
      large amount on certain sockets and cause unfairness for others.
      
      Signed-off-by: default avatarWei Wang <weiwan@google.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2bb2f5fb
    • Russell King's avatar
      net: phy: marvell10g: add downshift tunable support · 4075a6a0
      Russell King authored
      
      
      Add support for the downshift tunable for the Marvell 88x3310 PHY.
      Downshift is only usable with firmware 0.3.5.0 and later.
      
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4075a6a0
    • Colin Ian King's avatar
      octeontx2-af: Remove redundant initialization of variable pin · 75f81afb
      Colin Ian King authored
      
      
      The variable pin is being initialized with a value that is never
      read, it is being updated later on in only one case of a switch
      statement.  The assignment is redundant and can be removed.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      75f81afb
    • Lars-Peter Clausen's avatar
      net: macb: ptp: Switch to gettimex64() interface · e51bb5c2
      Lars-Peter Clausen authored
      
      
      The macb PTP support currently implements the `gettime64` callback to allow
      to retrieve the hardware clock time. Update the implementation to provide
      the `gettimex64` callback instead.
      
      The difference between the two is that with `gettime64` a snapshot of the
      system clock is taken before and after invoking the callback. Whereas
      `gettimex64` expects the callback itself to take the snapshots.
      
      To get the time from the macb Ethernet core multiple register accesses have
      to be done. Only one of which will happen at the time reported by the
      function. This leads to a non-symmetric delay and adds a slight offset
      between the hardware and system clock time when using the `gettime64`
      method. This offset can be a few 100 nanoseconds. Switching to the
      `gettimex64` method allows for a more precise correlation of the hardware
      and system clocks and results in a lower offset between the two.
      
      On a Xilinx ZynqMP system `phc2sys` reports a delay of 1120 ns before and
      300 ns after the patch. With the latter being mostly symmetric.
      
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e51bb5c2
    • Boris Sukholitko's avatar
      dissector: do not set invalid PPP protocol · 2e861e5e
      Boris Sukholitko authored
      
      
      The following flower filter fails to match non-PPP_IP{V6} packets
      wrapped in PPP_SES protocol:
      
      tc filter add dev eth0 ingress protocol ppp_ses flower \
              action simple sdata hi64
      
      The reason is that proto local variable is being set even when
      FLOW_DISSECT_RET_OUT_BAD status is returned.
      
      The fix is to avoid setting proto variable if the PPP protocol is unknown.
      
      Signed-off-by: default avatarBoris Sukholitko <boris.sukholitko@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2e861e5e
    • Linus Walleij's avatar
      net: dsa: rtl8366rb: Use core filtering tracking · 55b115c7
      Linus Walleij authored
      
      
      We added a state variable to track whether a certain port
      was VLAN filtering or not, but we can just inquire the DSA
      core about this.
      
      Cc: Vladimir Oltean <olteanv@gmail.com>
      Cc: Mauri Sandberg <sandberg@mailfence.com>
      Cc: DENG Qingfang <dqfext@gmail.com>
      Cc: Alvin Šipraga <alsi@bang-olufsen.dk>
      Cc: Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      55b115c7
    • Geetha sowjanya's avatar
      octeontx2-pf: Add XDP support to netdev PF · 06059a1a
      Geetha sowjanya authored
      
      
      Adds XDP_PASS, XDP_TX, XDP_DROP and XDP_REDIRECT support
      for netdev PF.
      
      Signed-off-by: default avatarGeetha sowjanya <gakula@marvell.com>
      Signed-off-by: default avatarSunil Goutham <sgoutham@cavium.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      06059a1a
    • Kiran Kumar K's avatar
      octeontx2-af: Adjust LA pointer for cpt parse header · 85212a12
      Kiran Kumar K authored
      
      
      In case of ltype NPC_LT_LA_CPT_HDR, LA pointer is pointing to the
      start of cpt parse header. Since cpt parse header has veriable
      length padding, this will be a problem for DMAC extraction. Adding
      KPU profile changes to adjust the LA pointer to start at ether header
      in case of cpt parse header by
         - Adding ptr advance in pkind 58 to a fixed value 40
         - Adding variable length offset 7 and mask 7 (pad len in
           CPT_PARSE_HDR).
      Also added the missing static declaration for npc_set_var_len_offset_pkind
      function.
      
      Signed-off-by: default avatarKiran Kumar K <kirankumark@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85212a12
    • Gustavo A. R. Silva's avatar
      net_sched: Use struct_size() and flex_array_size() helpers · 69508d43
      Gustavo A. R. Silva authored
      Make use of the struct_size() and flex_array_size() helpers instead of
      an open-coded version, in order to avoid any potential type mistakes
      or integer overflows that, in the worse scenario, could lead to heap
      overflows.
      
      Link: https://github.com/KSPP/linux/issues/160
      
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Link: https://lore.kernel.org/r/20210928193107.GA262595@embeddedor
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      69508d43
    • Leon Romanovsky's avatar
      devlink: Add missed notifications iterators · ef91abfb
      Leon Romanovsky authored
      The commit mentioned in Fixes line missed a couple of notifications that
      were registered before devlink_register() and should be delayed too.
      
      As such, the too early placed WARN_ON() check spotted it.
      
      WARNING: CPU: 1 PID: 6540 at net/core/devlink.c:5158 devlink_nl_region_notify+0x184/0x1e0 net/core/devlink.c:5158
      Modules linked in:
      CPU: 1 PID: 6540 Comm: syz-executor.0 Not tainted 5.15.0-rc2-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:devlink_nl_region_notify+0x184/0x1e0 net/core/devlink.c:5158
      Code: 38 41 b8 c0 0c 00 00 31 d2 48 89 ee 4c 89 e7 e8 72 1a 26 00 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e e9 01 bd 41 fa
      e8 fc bc 41 fa <0f> 0b e9 f7 fe ff ff e8 f0 bc 41 fa 0f 0b eb da 4c 89 e7 e8 c4 18
      RSP: 0018:ffffc90002d6f658 EFLAGS: 00010293
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: ffff88801f08d580 RSI: ffffffff87344e94 RDI: 0000000000000003
      RBP: ffff88801ee42100 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffff87344d8a R11: 0000000000000000 R12: ffff88801c1dc000
      R13: 0000000000000000 R14: 000000000000002c R15: ffff88801c1dc070
      FS:  0000555555e8e400(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 000055dd7c590310 CR3: 0000000069a09000 CR4: 00000000003506e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       devlink_region_create+0x39f/0x4c0 net/core/devlink.c:10327
       nsim_dev_dummy_region_init drivers/net/netdevsim/dev.c:481 [inline]
       nsim_dev_probe+0x5f6/0x1150 drivers/net/netdevsim/dev.c:1479
       call_driver_probe drivers/base/dd.c:517 [inline]
       really_probe+0x245/0xcc0 drivers/base/dd.c:596
       __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:751
       driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:781
       __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:898
       bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
       __device_attach+0x228/0x4a0 drivers/base/dd.c:969
       bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
       device_add+0xc35/0x21b0 drivers/base/core.c:3359
       nsim_bus_dev_new drivers/net/netdevsim/bus.c:435 [inline]
       new_device_store+0x48b/0x770 drivers/net/netdevsim/bus.c:302
       bus_attr_store+0x72/0xa0 drivers/base/bus.c:122
       sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:139
       kernfs_fop_write_iter+0x342/0x500 fs/kernfs/file.c:296
       call_write_iter include/linux/fs.h:2163 [inline]
       new_sync_write+0x429/0x660 fs/read_write.c:507
       vfs_write+0x7cf/0xae0 fs/read_write.c:594
       ksys_write+0x12d/0x250 fs/read_write.c:647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x7f328409d3ef
      Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 99 fd ff ff 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01
      00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 cc fd ff ff 48
      RSP: 002b:00007ffdc6851140 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f328409d3ef
      RDX: 0000000000000003 RSI: 00007ffdc6851190 RDI: 0000000000000004
      RBP: 0000000000000004 R08: 0000000000000000 R09: 00007ffdc68510e0
      R10: 0000000000000000 R11: 0000000000000293 R12: 00007f3284144971
      R13: 00007ffdc6851190 R14: 0000000000000000 R15: 00007ffdc6851860
      
      Fixes: cf530217
      
       ("devlink: Notify users when objects are accessible")
      Reported-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Tested-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Link: https://lore.kernel.org/r/2ed1159291f2a589b013914f2b60d8172fc525c1.1632925030.git.leonro@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ef91abfb
  2. Sep 29, 2021