1. 09 2月, 2021 8 次提交
    • A
      IPv6: Extend 'fib_notify_on_flag_change' sysctl · 6fad361a
      Amit Cohen 提交于
      Add the value '2' to 'fib_notify_on_flag_change' to allow sending
      notifications only for failed route installation.
      
      Separate value is added for such notifications because there are less of
      them, so they do not impact performance and some users will find them more
      important.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6fad361a
    • A
      IPv6: Add "offload failed" indication to routes · 0c5fcf9e
      Amit Cohen 提交于
      After installing a route to the kernel, user space receives an
      acknowledgment, which means the route was installed in the kernel, but not
      necessarily in hardware.
      
      The asynchronous nature of route installation in hardware can lead to a
      routing daemon advertising a route before it was actually installed in
      hardware. This can result in packet loss or mis-routed packets until the
      route is installed in hardware.
      
      To avoid such cases, previous patch set added the ability to emit
      RTM_NEWROUTE notifications whenever RTM_F_OFFLOAD/RTM_F_TRAP flags
      are changed, this behavior is controlled by sysctl.
      
      With the above mentioned behavior, it is possible to know from user-space
      if the route was offloaded, but if the offload fails there is no indication
      to user-space. Following a failure, a routing daemon will wait indefinitely
      for a notification that will never come.
      
      This patch adds an "offload_failed" indication to IPv6 routes, so that
      users will have better visibility into the offload process.
      
      'struct fib6_info' is extended with new field that indicates if route
      offload failed. Note that the new field is added using unused bit and
      therefore there is no need to increase struct size.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0c5fcf9e
    • A
      IPv4: Extend 'fib_notify_on_flag_change' sysctl · 648106c3
      Amit Cohen 提交于
      Add the value '2' to 'fib_notify_on_flag_change' to allow sending
      notifications only for failed route installation.
      
      Separate value is added for such notifications because there are less of
      them, so they do not impact performance and some users will find them more
      important.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      648106c3
    • A
      IPv4: Add "offload failed" indication to routes · 36c5100e
      Amit Cohen 提交于
      After installing a route to the kernel, user space receives an
      acknowledgment, which means the route was installed in the kernel, but not
      necessarily in hardware.
      
      The asynchronous nature of route installation in hardware can lead to a
      routing daemon advertising a route before it was actually installed in
      hardware. This can result in packet loss or mis-routed packets until the
      route is installed in hardware.
      
      To avoid such cases, previous patch set added the ability to emit
      RTM_NEWROUTE notifications whenever RTM_F_OFFLOAD/RTM_F_TRAP flags
      are changed, this behavior is controlled by sysctl.
      
      With the above mentioned behavior, it is possible to know from user-space
      if the route was offloaded, but if the offload fails there is no indication
      to user-space. Following a failure, a routing daemon will wait indefinitely
      for a notification that will never come.
      
      This patch adds an "offload_failed" indication to IPv4 routes, so that
      users will have better visibility into the offload process.
      
      'struct fib_alias', and 'struct fib_rt_info' are extended with new field
      that indicates if route offload failed. Note that the new field is added
      using unused bit and therefore there is no need to increase structs size.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      36c5100e
    • V
      net: bridge: use switchdev for port flags set through sysfs too · 8043c845
      Vladimir Oltean 提交于
      Looking through patchwork I don't see that there was any consensus to
      use switchdev notifiers only in case of netlink provided port flags but
      not sysfs (as a sort of deprecation, punishment or anything like that),
      so we should probably keep the user interface consistent in terms of
      functionality.
      
      http://patchwork.ozlabs.org/project/netdev/patch/20170605092043.3523-3-jiri@resnulli.us/
      http://patchwork.ozlabs.org/project/netdev/patch/20170608064428.4785-3-jiri@resnulli.us/
      
      Fixes: 3922285d ("net: bridge: Add support for offloading port attributes")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Acked-by: NNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8043c845
    • X
      rxrpc: use udp tunnel APIs instead of open code in rxrpc_open_socket · 1a9b86c9
      Xin Long 提交于
      In rxrpc_open_socket(), now it's using sock_create_kern() and
      kernel_bind() to create a udp tunnel socket, and other kernel
      APIs to set up it. These code can be replaced with udp tunnel
      APIs udp_sock_create() and setup_udp_tunnel_sock(), and it'll
      simplify rxrpc_open_socket().
      
      Note that with this patch, the udp tunnel socket will always
      bind to a random port if transport is not provided by users,
      which is suggested by David Howells, thanks!
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Reviewed-by: NVadim Fedorenko <vfedorenko@novek.ru>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1a9b86c9
    • A
      net-sysfs: Add rtnl locking for getting Tx queue traffic class · b2f17564
      Alexander Duyck 提交于
      In order to access the suboordinate dev for a device we should be holding
      the rtnl_lock when outside of the transmit path. The existing code was not
      doing that for the sysfs dump function and as a result we were open to a
      possible race.
      
      To resolve that take the rtnl lock prior to accessing the sb_dev field of
      the Tx queue and release it after we have retrieved the tc for the queue.
      Signed-off-by: NAlexander Duyck <alexanderduyck@fb.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b2f17564
    • A
      seg6: fool-proof the processing of SRv6 behavior attributes · 300a0fd8
      Andrea Mayer 提交于
      The set of required attributes for a given SRv6 behavior is identified
      using a bitmap stored in an unsigned long, since the initial design of SRv6
      networking in Linux. Recently the same approach has been used for
      identifying the optional attributes.
      
      However, the number of attributes supported by SRv6 behaviors depends on
      the size of the unsigned long type which changes with the architecture.
      Indeed, on a 64-bit architecture, an SRv6 behavior can support up to 64
      attributes while on a 32-bit architecture it can support at most 32
      attributes.
      
      To fool-proof the processing of SRv6 behaviors we verify, at compile time,
      that the set of all supported SRv6 attributes can be encoded into a bitmap
      stored in an unsigned long. Otherwise, kernel build fails forcing
      developers to reconsider adding a new attribute or extend the total
      number of supported attributes by the SRv6 behaviors.
      
      Moreover, we replace all patterns (1 << i) with the macro SEG6_F_ATTR(i) in
      order to address potential overflow issues caused by 32-bit signed
      arithmetic.
      
      Thanks to Colin Ian King for catching the overflow problem, providing a
      solution and inspiring this patch.
      Thanks to Jakub Kicinski for his useful suggestions during the design of
      this patch.
      
      v2:
       - remove the SEG6_LOCAL_MAX_SUPP which is not strictly needed: it can
         be derived from the unsigned long type. Thanks to David Ahern for
         pointing it out.
      Signed-off-by: NAndrea Mayer <andrea.mayer@uniroma2.it>
      Reviewed-by: NDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20210206170934.5982-1-andrea.mayer@uniroma2.itSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      300a0fd8
  2. 07 2月, 2021 11 次提交
    • X
      net/packet: Improve the comment about LL header visibility criteria · 21c85974
      Xie He 提交于
      The "dev_has_header" function, recently added in
      commit d5496990 ("net/packet: fix packet receive on L3 devices
      without visible hard header"),
      is more accurate as criteria for determining whether a device exposes
      the LL header to upper layers, because in addition to dev->header_ops,
      it also checks for dev->header_ops->create.
      
      When transmitting an skb on a device, dev_hard_header can be called to
      generate an LL header. dev_hard_header will only generate a header if
      dev->header_ops->create is present.
      Signed-off-by: NXie He <xie.he.0141@gmail.com>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Link: https://lore.kernel.org/r/20210205224124.21345-1-xie.he.0141@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      21c85974
    • V
      net: dsa: make assisted_learning_on_cpu_port bypass offloaded LAG interfaces · a324d3d4
      Vladimir Oltean 提交于
      Given the following topology, and focusing only on Box A:
      
               Box A
               +----------------------------------+
               | Board 1         br0              |
               |             +---------+          |
               |            /           \         |
               |            |           |         |
               |            |         bond0       |
               |            |        +-----+      |
               |192.168.1.1 |       /       \     |
               |  eno0     swp0    swp1    swp2   |
               +---|--------|-------|-------|-----+
                   |        |       |       |
                   +--------+       |       |
                     Cable          |       |
                               Cable|       |Cable
                     Cable          |       |
                   +--------+       |       |
                   |        |       |       |
               +---|--------|-------|-------|-----+
               |  eno0     swp0    swp1    swp2   |
               |192.168.1.2 |       \       /     |
               |            |        +-----+      |
               |            |         bond0       |
               |            |           |         |
               |            \           /         |
               |             +---------+          |
               | Board 2         br0              |
               +----------------------------------+
               Box B
      
      The assisted_learning_on_cpu_port logic will see that swp0 is bridged
      with a "foreign interface" (bond0) and will therefore install all
      addresses learnt by the software bridge towards bond0 (including the
      address of eno0 on Box B) as static addresses towards the CPU port.
      
      But that's not what we want - bond0 is not really a "foreign interface"
      but one we can offload including L2 forwarding from/towards it. So we
      need to refine our logic for assisted learning such that, whenever we
      see an address learnt on a non-DSA interface, we search through the tree
      for any port that offloads that non-DSA interface.
      
      Some confusion might arise as to why we search through the whole tree
      instead of just the local switch returned by dsa_slave_dev_lower_find.
      Or a different angle of the same confusion: why does
      dsa_slave_dev_lower_find(br_dev) return a single dp that's under br_dev
      instead of the whole list of bridged DSA ports?
      
      To answer the second question, it should be enough to install the static
      FDB entry on the CPU port of a single switch in the tree, because
      dsa_port_fdb_add uses DSA_NOTIFIER_FDB_ADD which ensures that all other
      switches in the tree get notified of that address, and add the entry
      themselves using dsa_towards_port().
      
      This should help understand the answer to the first question: the port
      returned by dsa_slave_dev_lower_find may not be on the same switch as
      the ports that offload the LAG. Nonetheless, if the driver implements
      .crosschip_lag_join and .crosschip_bridge_join as mv88e6xxx does, there
      still isn't any reason for trapping addresses learnt on the remote LAG
      towards the CPU, and we should prevent that.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      a324d3d4
    • V
      Revert "net: ipv4: handle DSA enabled master network devices" · 46acf7bd
      Vladimir Oltean 提交于
      This reverts commit 728c0208.
      
      Since 2015 DSA has gained more integration with the network stack, we
      can now have the same functionality without explicitly open-coding for
      it:
      - It now opens the DSA master netdevice automatically whenever a user
        netdevice is opened.
      - The master and switch interfaces are coupled in an upper/lower
        hierarchy using the netdev adjacency lists.
      
      In the nfsroot example below, the interface chosen by autoconfig was
      swp3, and every interface except that and the DSA master, eth1, was
      brought down afterwards:
      
      [    8.714215] mscc_felix 0000:00:00.5 swp0 (uninitialized): PHY [0000:00:00.3:10] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
      [    8.978041] mscc_felix 0000:00:00.5 swp1 (uninitialized): PHY [0000:00:00.3:11] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
      [    9.246134] mscc_felix 0000:00:00.5 swp2 (uninitialized): PHY [0000:00:00.3:12] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
      [    9.486203] mscc_felix 0000:00:00.5 swp3 (uninitialized): PHY [0000:00:00.3:13] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
      [    9.512827] mscc_felix 0000:00:00.5: configuring for fixed/internal link mode
      [    9.521047] mscc_felix 0000:00:00.5: Link is Up - 2.5Gbps/Full - flow control off
      [    9.530382] device eth1 entered promiscuous mode
      [    9.535452] DSA: tree 0 setup
      [    9.539777] printk: console [netcon0] enabled
      [    9.544504] netconsole: network logging started
      [    9.555047] fsl_enetc 0000:00:00.2 eth1: configuring for fixed/internal link mode
      [    9.562790] fsl_enetc 0000:00:00.2 eth1: Link is Up - 1Gbps/Full - flow control off
      [    9.564661] 8021q: adding VLAN 0 to HW filter on device bond0
      [    9.637681] fsl_enetc 0000:00:00.0 eth0: PHY [0000:00:00.0:02] driver [Qualcomm Atheros AR8031/AR8033] (irq=POLL)
      [    9.655679] fsl_enetc 0000:00:00.0 eth0: configuring for inband/sgmii link mode
      [    9.666611] mscc_felix 0000:00:00.5 swp0: configuring for inband/qsgmii link mode
      [    9.676216] 8021q: adding VLAN 0 to HW filter on device swp0
      [    9.682086] mscc_felix 0000:00:00.5 swp1: configuring for inband/qsgmii link mode
      [    9.690700] 8021q: adding VLAN 0 to HW filter on device swp1
      [    9.696538] mscc_felix 0000:00:00.5 swp2: configuring for inband/qsgmii link mode
      [    9.705131] 8021q: adding VLAN 0 to HW filter on device swp2
      [    9.710964] mscc_felix 0000:00:00.5 swp3: configuring for inband/qsgmii link mode
      [    9.719548] 8021q: adding VLAN 0 to HW filter on device swp3
      [    9.747811] Sending DHCP requests ..
      [   12.742899] mscc_felix 0000:00:00.5 swp1: Link is Up - 1Gbps/Full - flow control rx/tx
      [   12.743828] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control off
      [   12.747062] IPv6: ADDRCONF(NETDEV_CHANGE): swp1: link becomes ready
      [   12.755216] fsl_enetc 0000:00:00.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
      [   12.766603] IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready
      [   12.783188] mscc_felix 0000:00:00.5 swp2: Link is Up - 1Gbps/Full - flow control rx/tx
      [   12.785354] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
      [   12.799535] IPv6: ADDRCONF(NETDEV_CHANGE): swp2: link becomes ready
      [   13.803141] mscc_felix 0000:00:00.5 swp3: Link is Up - 1Gbps/Full - flow control rx/tx
      [   13.811646] IPv6: ADDRCONF(NETDEV_CHANGE): swp3: link becomes ready
      [   15.452018] ., OK
      [   15.470336] IP-Config: Got DHCP answer from 10.0.0.1, my address is 10.0.0.39
      [   15.477887] IP-Config: Complete:
      [   15.481330]      device=swp3, hwaddr=00:04:9f:05:de:0a, ipaddr=10.0.0.39, mask=255.255.255.0, gw=10.0.0.1
      [   15.491846]      host=10.0.0.39, domain=(none), nis-domain=(none)
      [   15.498429]      bootserver=10.0.0.1, rootserver=10.0.0.1, rootpath=
      [   15.498481]      nameserver0=8.8.8.8
      [   15.627542] fsl_enetc 0000:00:00.0 eth0: Link is Down
      [   15.690903] mscc_felix 0000:00:00.5 swp0: Link is Down
      [   15.745216] mscc_felix 0000:00:00.5 swp1: Link is Down
      [   15.800498] mscc_felix 0000:00:00.5 swp2: Link is Down
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      46acf7bd
    • V
      Revert "net: Have netpoll bring-up DSA management interface" · ea92000d
      Vladimir Oltean 提交于
      This reverts commit 1532b977.
      
      The above commit is good and it works, however it was meant as a bugfix
      for stable kernels and now we have more self-contained ways in DSA to
      handle the situation where the DSA master must be brought up.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      ea92000d
    • V
      net: dsa: automatically bring user ports down when master goes down · c0a8a9c2
      Vladimir Oltean 提交于
      This is not fixing any actual bug that I know of, but having a DSA
      interface that is up even when its lower (master) interface is down is
      one of those things that just do not sound right.
      
      Yes, DSA checks if the master is up before actually bringing the
      user interface up, but nobody prevents bringing the master interface
      down immediately afterwards... Then the user ports would attempt
      dev_queue_xmit on an interface that is down, and wonder what's wrong.
      
      This patch prevents that from happening. NETDEV_GOING_DOWN is the
      notification emitted _before_ the master actually goes down, and we are
      protected by the rtnl_mutex, so all is well.
      
      For those of you reading this because you were doing switch testing
      such as latency measurements for autonomously forwarded traffic, and you
      needed a controlled environment with no extra packets sent by the
      network stack, this patch breaks that, because now the user ports go
      down too, which may shut down the PHY etc. But please don't do it like
      that, just do instead:
      
      tc qdisc add dev eno2 clsact
      tc filter add dev eno2 egress flower action drop
      
      Tested with two cascaded DSA switches:
      $ ip link set eno2 down
      sja1105 spi2.0 sw0p2: Link is Down
      mscc_felix 0000:00:00.5 swp0: Link is Down
      fsl_enetc 0000:00:00.2 eno2: Link is Down
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      c0a8a9c2
    • V
      net: dsa: automatically bring up DSA master when opening user port · 9d5ef190
      Vladimir Oltean 提交于
      DSA wants the master interface to be open before the user port is due to
      historical reasons. The promiscuity of interfaces that are down used to
      have issues, as referenced Lennert Buytenhek in commit df02c6ff
      ("dsa: fix master interface allmulti/promisc handling").
      
      The bugfix mentioned there, commit b6c40d68 ("net: only invoke
      dev->change_rx_flags when device is UP"), was basically a "don't do
      that" approach to working around the promiscuity while down issue.
      
      Further work done by Vlad Yasevich in commit d2615bf4 ("net: core:
      Always propagate flag changes to interfaces") has resolved the
      underlying issue, and it is strictly up to the DSA and 8021q drivers
      now, it is no longer mandated by the networking core that the master
      interface must be up when changing its promiscuity.
      
      From DSA's point of view, deciding to error out in dsa_slave_open
      because the master isn't up is
      (a) a bad user experience and
      (b) knocking at an open door.
      Even if there still was an issue with promiscuity while down, DSA could
      still just open the master and avoid it.
      
      Doing it this way has the additional benefit that user space can now
      remove DSA-specific workarounds, like systemd-networkd with BindCarrier:
      https://github.com/systemd/systemd/issues/7478
      
      And we can finally remove one of the 2 bullets in the "Common pitfalls
      using DSA setups" chapter.
      
      Tested with two cascaded DSA switches:
      
      $ ip link set sw0p2 up
      fsl_enetc 0000:00:00.2 eno2: configuring for fixed/internal link mode
      fsl_enetc 0000:00:00.2 eno2: Link is Up - 1Gbps/Full - flow control rx/tx
      mscc_felix 0000:00:00.5 swp0: configuring for fixed/sgmii link mode
      mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control off
      8021q: adding VLAN 0 to HW filter on device swp0
      sja1105 spi2.0 sw0p2: configuring for phy/rgmii-id link mode
      IPv6: ADDRCONF(NETDEV_CHANGE): eno2: link becomes ready
      IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      9d5ef190
    • F
      mptcp: pm: add lockdep assertions · 3abc05d9
      Florian Westphal 提交于
      Add a few assertions to make sure functions are called with the needed
      locks held.
      Two functions gain might_sleep annotations because they contain
      conditional calls to functions that sleep.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      3abc05d9
    • K
      net: Introduce {netdev,napi}_alloc_frag_align() · 3f6e687d
      Kevin Hao 提交于
      In the current implementation of {netdev,napi}_alloc_frag(), it doesn't
      have any align guarantee for the returned buffer address, But for some
      hardwares they do require the DMA buffer to be aligned correctly,
      so we would have to use some workarounds like below if the buffers
      allocated by the {netdev,napi}_alloc_frag() are used by these hardwares
      for DMA.
          buf = napi_alloc_frag(really_needed_size + align);
          buf = PTR_ALIGN(buf, align);
      
      These codes seems ugly and would waste a lot of memories if the buffers
      are used in a network driver for the TX/RX. We have added the align
      support for the page_frag functions, so add the corresponding
      {netdev,napi}_frag functions.
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      Reviewed-by: NAlexander Duyck <alexanderduyck@fb.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      3f6e687d
    • Z
      net: sched: Return the correct errno code · a64566a2
      Zheng Yongjun 提交于
      When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.
      Signed-off-by: NZheng Yongjun <zhengyongjun3@huawei.com>
      Link: https://lore.kernel.org/r/20210204073950.18372-1-zhengyongjun3@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      a64566a2
    • Z
      dccp: Return the correct errno code · 247b557e
      Zheng Yongjun 提交于
      When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.
      Signed-off-by: NZheng Yongjun <zhengyongjun3@huawei.com>
      Link: https://lore.kernel.org/r/20210204072820.17723-1-zhengyongjun3@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      247b557e
    • X
      net: bridge: mcast: Use ERR_CAST instead of ERR_PTR(PTR_ERR()) · 1697291d
      Xu Wang 提交于
      Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...)).
      
      net/bridge/br_multicast.c:1246:9-16: WARNING: ERR_CAST can be used with mp
      Generated by: scripts/coccinelle/api/err_cast.cocci
      Signed-off-by: NXu Wang <vulab@iscas.ac.cn>
      Link: https://lore.kernel.org/r/20210204070549.83636-1-vulab@iscas.ac.cnSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      1697291d
  3. 06 2月, 2021 4 次提交
  4. 05 2月, 2021 9 次提交
  5. 04 2月, 2021 8 次提交
    • Z
      xfrm: Return the correct errno code · 4ac7a6ee
      Zheng Yongjun 提交于
      When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.
      Signed-off-by: NZheng Yongjun <zhengyongjun3@huawei.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      4ac7a6ee
    • J
      esp: Simplify the calculation of variables · bf3da527
      Jiapeng Chong 提交于
      Fix the following coccicheck warnings:
      
      ./net/ipv6/esp6.c:791:16-18: WARNING !A || A && B is equivalent
      to !A || B.
      Reported-by: NAbaci Robot <abaci@linux.alibaba.com>
      Signed-off-by: NJiapeng Chong <jiapeng.chong@linux.alibaba.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      bf3da527
    • D
      ethtool: Expose the number of lanes in use · 7dc33f09
      Danielle Ratson 提交于
      Currently, ethtool does not expose how many lanes are used when the
      link is up.
      
      After adding a possibility to advertise or force a specific number of
      lanes, the lanes in use value can be either the maximum width of the port
      or below.
      
      Extend ethtool to expose the number of lanes currently in use for
      drivers that support it.
      
      For example:
      
      $ ethtool -s swp1 speed 100000 lanes 4
      $ ethtool -s swp2 speed 100000 lanes 4
      $ ip link set swp1 up
      $ ip link set swp2 up
      $ ethtool swp1
      Settings for swp1:
              Supported ports: [ FIBRE         Backplane ]
              Supported link modes:   1000baseT/Full
                                      10000baseT/Full
                                      1000baseKX/Full
                                      10000baseKR/Full
                                      10000baseR_FEC
                                      40000baseKR4/Full
                                      40000baseCR4/Full
                                      40000baseSR4/Full
                                      40000baseLR4/Full
                                      25000baseCR/Full
                                      25000baseKR/Full
                                      25000baseSR/Full
                                      50000baseCR2/Full
                                      50000baseKR2/Full
                                      100000baseKR4/Full
                                      100000baseSR4/Full
                                      100000baseCR4/Full
                                      100000baseLR4_ER4/Full
                                      50000baseSR2/Full
                                      10000baseCR/Full
                                      10000baseSR/Full
                                      10000baseLR/Full
                                      10000baseER/Full
                                      50000baseKR/Full
                                      50000baseSR/Full
                                      50000baseCR/Full
                                      50000baseLR_ER_FR/Full
                                      50000baseDR/Full
                                      100000baseKR2/Full
                                      100000baseSR2/Full
                                      100000baseCR2/Full
                                      100000baseLR2_ER2_FR2/Full
                                      100000baseDR2/Full
                                      200000baseKR4/Full
                                      200000baseSR4/Full
                                      200000baseLR4_ER4_FR4/Full
                                      200000baseDR4/Full
                                      200000baseCR4/Full
              Supported pause frame use: Symmetric Receive-only
              Supports auto-negotiation: Yes
              Supported FEC modes: Not reported
              Advertised link modes:  1000baseT/Full
                                      10000baseT/Full
                                      1000baseKX/Full
                                      1000baseKX/Full
                                      10000baseKR/Full
                                      10000baseR_FEC
                                      40000baseKR4/Full
                                      40000baseCR4/Full
                                      40000baseSR4/Full
                                      40000baseLR4/Full
                                      25000baseCR/Full
                                      25000baseKR/Full
                                      25000baseSR/Full
                                      50000baseCR2/Full
                                      50000baseKR2/Full
                                      100000baseKR4/Full
                                      100000baseSR4/Full
                                      100000baseCR4/Full
                                      100000baseLR4_ER4/Full
                                      50000baseSR2/Full
                                      10000baseCR/Full
                                      10000baseSR/Full
                                      10000baseLR/Full
                                      10000baseER/Full
                                      200000baseKR4/Full
                                      200000baseSR4/Full
                                      200000baseLR4_ER4_FR4/Full
                                      200000baseDR4/Full
                                      200000baseCR4/Full
              Advertised pause frame use: No
              Advertised auto-negotiation: Yes
              Advertised FEC modes: Not reported
              Advertised link modes:  100000baseKR4/Full
                                      100000baseSR4/Full
                                      100000baseCR4/Full
                                      100000baseLR4_ER4/Full
      	Advertised pause frame use: No
      	Advertised auto-negotiation: Yes
      	Advertised FEC modes: Not reported
      	Speed: 100000Mb/s
      	Lanes: 4
      	Duplex: Full
      	Auto-negotiation: on
      	Port: Direct Attach Copper
      	PHYAD: 0
      	Transceiver: internal
      	Link detected: yes
      Signed-off-by: NDanielle Ratson <danieller@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      7dc33f09
    • D
      ethtool: Get link mode in use instead of speed and duplex parameters · c8907043
      Danielle Ratson 提交于
      Currently, when user space queries the link's parameters, as speed and
      duplex, each parameter is passed from the driver to ethtool.
      
      Instead, get the link mode bit in use, and derive each of the parameters
      from it in ethtool.
      Signed-off-by: NDanielle Ratson <danieller@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      c8907043
    • D
      ethtool: Extend link modes settings uAPI with lanes · 012ce4dd
      Danielle Ratson 提交于
      Currently, when auto negotiation is on, the user can advertise all the
      linkmodes which correspond to a specific speed, but does not have a
      similar selector for the number of lanes. This is significant when a
      specific speed can be achieved using different number of lanes.  For
      example, 2x50 or 4x25.
      
      Add 'ETHTOOL_A_LINKMODES_LANES' attribute and expand 'struct
      ethtool_link_settings' with lanes field in order to implement a new
      lanes-selector that will enable the user to advertise a specific number
      of lanes as well.
      
      When auto negotiation is off, lanes parameter can be forced only if the
      driver supports it. Add a capability bit in 'struct ethtool_ops' that
      allows ethtool know if the driver can handle the lanes parameter when
      auto negotiation is off, so if it does not, an error message will be
      returned when trying to set lanes.
      
      Example:
      
      $ ethtool -s swp1 lanes 4
      $ ethtool swp1
        Settings for swp1:
      	Supported ports: [ FIBRE ]
              Supported link modes:   1000baseKX/Full
                                      10000baseKR/Full
                                      40000baseCR4/Full
      				40000baseSR4/Full
      				40000baseLR4/Full
                                      25000baseCR/Full
                                      25000baseSR/Full
      				50000baseCR2/Full
                                      100000baseSR4/Full
      				100000baseCR4/Full
              Supported pause frame use: Symmetric Receive-only
              Supports auto-negotiation: Yes
              Supported FEC modes: Not reported
              Advertised link modes:  40000baseCR4/Full
      				40000baseSR4/Full
      				40000baseLR4/Full
                                      100000baseSR4/Full
      				100000baseCR4/Full
              Advertised pause frame use: No
              Advertised auto-negotiation: Yes
              Advertised FEC modes: Not reported
              Speed: Unknown!
              Duplex: Unknown! (255)
              Auto-negotiation: on
              Port: Direct Attach Copper
              PHYAD: 0
              Transceiver: internal
              Link detected: no
      Signed-off-by: NDanielle Ratson <danieller@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      012ce4dd
    • D
      ethtool: Validate master slave configuration before rtnl_lock() · 189e7a8d
      Danielle Ratson 提交于
      Create a new function for input validations to be called before
      rtnl_lock() and move the master slave validation to that function.
      
      This would be a cleanup for next patch that would add another validation
      to the new function.
      Signed-off-by: NDanielle Ratson <danieller@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      189e7a8d
    • V
      net: dsa: fix SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING getting ignored · 99b8202b
      Vladimir Oltean 提交于
      The bridge emits VLAN filtering events and quite a few others via
      switchdev with orig_dev = br->dev. After the blamed commit, these events
      started getting ignored.
      
      The point of the patch was to not offload switchdev objects for ports
      that didn't go through dsa_port_bridge_join, because the configuration
      is unsupported:
      - ports that offload a bonding/team interface go through
        dsa_port_bridge_join when that bonding/team interface is later bridged
        with another switch port or LAG
      - ports that don't offload LAG don't get notified of the bridge that is
        on top of that LAG.
      
      Sadly, a check is missing, which is that the orig_dev is equal to the
      bridge device. This check is compatible with the original intention,
      because ports that don't offload bridging because they use a software
      LAG don't have dp->bridge_dev set.
      
      On a semi-related note, we should not offload switchdev objects or
      populate dp->bridge_dev if the driver doesn't implement .port_bridge_join
      either. However there is no regression associated with that, so it can
      be done separately.
      
      Fixes: 5696c8ae ("net: dsa: Don't offload port attributes on standalone ports")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NTobias Waldekranz <tobias@waldekranz.com>
      Tested-by: NTobias Waldekranz <tobias@waldekranz.com>
      Link: https://lore.kernel.org/r/20210202233109.1591466-1-olteanv@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      99b8202b
    • B
      net: indirect call helpers for ipv4/ipv6 dst_check functions · bbd807df
      Brian Vazquez 提交于
      This patch avoids the indirect call for the common case:
      ip6_dst_check and ipv4_dst_check
      Signed-off-by: NBrian Vazquez <brianvv@google.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      bbd807df