1. 26 Aug, 2020 16 commits
    • Ido Schimmel's avatar
      selftests: fib_nexthops: Test IPv6 route with group after replacing IPv4 nexthops · 041bc0dc
      Ido Schimmel authored
      Test that an IPv6 route can not use a nexthop group with mixed IPv4 and
      IPv6 nexthops, but can use it after replacing the IPv4 nexthops with
      IPv6 nexthops.
      
      Output without previous patch:
      
      # ./fib_nexthops.sh -t ipv6_fcnal_runtime
      
      IPv6 functional runtime
      -----------------------
      TEST: Route add                                                     [ OK ]
      TEST: Route delete                                                  [ OK ]
      TEST: Ping with nexthop                                             [ OK ]
      TEST: Ping - multipath                                              [ OK ]
      TEST: Ping - blackhole                                              [ OK ]
      TEST: Ping - blackhole replaced with gateway                        [ OK ]
      TEST: Ping - gateway replaced by blackhole                          [ OK ]
      TEST: Ping - group with blackhole                                   [ OK ]
      TEST: Ping - group blackhole replaced with gateways                 [ OK ]
      TEST: IPv6 route with device only nexthop                           [ OK ]
      TEST: IPv6 multipath route with nexthop mix - dev only + gw         [ OK ]
      TEST: IPv6 route can not have a v4 gateway                          [ OK ]
      TEST: Nexthop replace - v6 route, v4 nexthop                        [ OK ]
      TEST: Nexthop replace of group entry - v6 route, v4 nexthop         [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route using a group after removing v4 gateways           [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route using a group after replacing v4 gateways          [FAIL]
      TEST: Nexthop with default route and rpfilter                       [ OK ]
      TEST: Nexthop with multipath default route and rpfilter             [ OK ]
      
      Tests passed:  21
      Tests failed:   1
      
      Output with previous patch:
      
      # ./fib_nexthops.sh -t ipv6_fcnal_runtime
      
      IPv6 functional runtime
      -----------------------
      TEST: Route add                                                     [ OK ]
      TEST: Route delete                                                  [ OK ]
      TEST: Ping with nexthop                                             [ OK ]
      TEST: Ping - multipath                                              [ OK ]
      TEST: Ping - blackhole                                              [ OK ]
      TEST: Ping - blackhole replaced with gateway                        [ OK ]
      TEST: Ping - gateway replaced by blackhole                          [ OK ]
      TEST: Ping - group with blackhole                                   [ OK ]
      TEST: Ping - group blackhole replaced with gateways                 [ OK ]
      TEST: IPv6 route with device only nexthop                           [ OK ]
      TEST: IPv6 multipath route with nexthop mix - dev only + gw         [ OK ]
      TEST: IPv6 route can not have a v4 gateway                          [ OK ]
      TEST: Nexthop replace - v6 route, v4 nexthop                        [ OK ]
      TEST: Nexthop replace of group entry - v6 route, v4 nexthop         [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route using a group after removing v4 gateways           [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route using a group after replacing v4 gateways          [ OK ]
      TEST: Nexthop with default route and rpfilter                       [ OK ]
      TEST: Nexthop with multipath default route and rpfilter             [ OK ]
      
      Tests passed:  22
      Tests failed:   0
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      041bc0dc
    • Ido Schimmel's avatar
      ipv4: nexthop: Correctly update nexthop group when replacing a nexthop · 885a3b15
      Ido Schimmel authored
      Each nexthop group contains an indication if it has IPv4 nexthops
      ('has_v4'). Its purpose is to prevent IPv6 routes from using groups with
      IPv4 nexthops.
      
      However, the indication is not updated when a nexthop is replaced. This
      results in the kernel wrongly rejecting IPv6 routes from pointing to
      groups that only contain IPv6 nexthops. Example:
      
      # ip nexthop replace id 1 via 192.0.2.2 dev dummy10
      # ip nexthop replace id 10 group 1
      # ip nexthop replace id 1 via 2001:db8:1::2 dev dummy10
      # ip route replace 2001:db8:10::/64 nhid 10
      Error: IPv6 routes can not use an IPv4 nexthop.
      
      Solve this by iterating over all the nexthop groups that the replaced
      nexthop is a member of and potentially update their IPv4 indication
      according to the new set of member nexthops.
      
      Avoid wasting cycles by only performing the update in case an IPv4
      nexthop is replaced by an IPv6 nexthop.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      885a3b15
    • Ido Schimmel's avatar
      selftests: fib_nexthops: Test IPv6 route with group after removing IPv4 nexthops · 05290a27
      Ido Schimmel authored
      Test that an IPv6 route can not use a nexthop group with mixed IPv4 and
      IPv6 nexthops, but can use it after deleting the IPv4 nexthops.
      
      Output without previous patch:
      
      # ./fib_nexthops.sh -t ipv6_fcnal_runtime
      
      IPv6 functional runtime
      -----------------------
      TEST: Route add                                                     [ OK ]
      TEST: Route delete                                                  [ OK ]
      TEST: Ping with nexthop                                             [ OK ]
      TEST: Ping - multipath                                              [ OK ]
      TEST: Ping - blackhole                                              [ OK ]
      TEST: Ping - blackhole replaced with gateway                        [ OK ]
      TEST: Ping - gateway replaced by blackhole                          [ OK ]
      TEST: Ping - group with blackhole                                   [ OK ]
      TEST: Ping - group blackhole replaced with gateways                 [ OK ]
      TEST: IPv6 route with device only nexthop                           [ OK ]
      TEST: IPv6 multipath route with nexthop mix - dev only + gw         [ OK ]
      TEST: IPv6 route can not have a v4 gateway                          [ OK ]
      TEST: Nexthop replace - v6 route, v4 nexthop                        [ OK ]
      TEST: Nexthop replace of group entry - v6 route, v4 nexthop         [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route using a group after deleting v4 gateways           [FAIL]
      TEST: Nexthop with default route and rpfilter                       [ OK ]
      TEST: Nexthop with multipath default route and rpfilter             [ OK ]
      
      Tests passed:  18
      Tests failed:   1
      
      Output with previous patch:
      
      bash-5.0# ./fib_nexthops.sh -t ipv6_fcnal_runtime
      
      IPv6 functional runtime
      -----------------------
      TEST: Route add                                                     [ OK ]
      TEST: Route delete                                                  [ OK ]
      TEST: Ping with nexthop                                             [ OK ]
      TEST: Ping - multipath                                              [ OK ]
      TEST: Ping - blackhole                                              [ OK ]
      TEST: Ping - blackhole replaced with gateway                        [ OK ]
      TEST: Ping - gateway replaced by blackhole                          [ OK ]
      TEST: Ping - group with blackhole                                   [ OK ]
      TEST: Ping - group blackhole replaced with gateways                 [ OK ]
      TEST: IPv6 route with device only nexthop                           [ OK ]
      TEST: IPv6 multipath route with nexthop mix - dev only + gw         [ OK ]
      TEST: IPv6 route can not have a v4 gateway                          [ OK ]
      TEST: Nexthop replace - v6 route, v4 nexthop                        [ OK ]
      TEST: Nexthop replace of group entry - v6 route, v4 nexthop         [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route can not have a group with v4 and v6 gateways       [ OK ]
      TEST: IPv6 route using a group after deleting v4 gateways           [ OK ]
      TEST: Nexthop with default route and rpfilter                       [ OK ]
      TEST: Nexthop with multipath default route and rpfilter             [ OK ]
      
      Tests passed:  19
      Tests failed:   0
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      05290a27
    • Ido Schimmel's avatar
      ipv4: nexthop: Correctly update nexthop group when removing a nexthop · 863b2558
      Ido Schimmel authored
      Each nexthop group contains an indication if it has IPv4 nexthops
      ('has_v4'). Its purpose is to prevent IPv6 routes from using groups with
      IPv4 nexthops.
      
      However, the indication is not updated when a nexthop is removed. This
      results in the kernel wrongly rejecting IPv6 routes from pointing to
      groups that only contain IPv6 nexthops. Example:
      
      # ip nexthop replace id 1 via 192.0.2.2 dev dummy10
      # ip nexthop replace id 2 via 2001:db8:1::2 dev dummy10
      # ip nexthop replace id 10 group 1/2
      # ip nexthop del id 1
      # ip route replace 2001:db8:10::/64 nhid 10
      Error: IPv6 routes can not use an IPv4 nexthop.
      
      Solve this by updating the indication according to the new set of
      member nexthops.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      863b2558
    • Ido Schimmel's avatar
      ipv4: nexthop: Remove unnecessary rtnl_dereference() · 233c6378
      Ido Schimmel authored
      The pointer is not RCU protected, so remove the unnecessary
      rtnl_dereference(). This suppresses the following warning:
      
      net/ipv4/nexthop.c:1101:24: error: incompatible types in comparison expression (different address spaces):
      net/ipv4/nexthop.c:1101:24:    struct rb_node [noderef] __rcu *
      net/ipv4/nexthop.c:1101:24:    struct rb_node *
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      233c6378
    • Ido Schimmel's avatar
      ipv4: nexthop: Use nla_put_be32() for NHA_GATEWAY · 33d80996
      Ido Schimmel authored
      The code correctly uses nla_get_be32() to get the payload of the
      attribute, but incorrectly uses nla_put_u32() to add the attribute to
      the payload. This results in the following warning:
      
      net/ipv4/nexthop.c:279:59: warning: incorrect type in argument 3 (different base types)
      net/ipv4/nexthop.c:279:59:    expected unsigned int [usertype] value
      net/ipv4/nexthop.c:279:59:    got restricted __be32 [usertype] ipv4
      
      Suppress the warning by using nla_put_be32().
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      33d80996
    • Ido Schimmel's avatar
      ipv4: nexthop: Reduce allocation size of 'struct nh_group' · d7d49dc7
      Ido Schimmel authored
      The struct looks as follows:
      
      struct nh_group {
      	struct nh_group		*spare; /* spare group for removals */
      	u16			num_nh;
      	bool			mpath;
      	bool			fdb_nh;
      	bool			has_v4;
      	struct nh_grp_entry	nh_entries[];
      };
      
      But its offset within 'struct nexthop' is also taken into account to
      determine the allocation size.
      
      Instead, use struct_size() to allocate only the required number of
      bytes.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d7d49dc7
    • David S. Miller's avatar
      Merge branch 'net_prefetch-API' · 751e4251
      David S. Miller authored
      Tariq Toukan says:
      
      ====================
      net_prefetch API
      
      This patchset adds a common net API for L1 cacheline size-aware prefetch.
      
      Patch 1 introduces the common API in net and aligns the drivers to use it.
      Patches 2 and 3 add usage in mlx4 and mlx5 Eth drivers.
      
      Series generated against net-next commit:
      079f921e Merge tag 'batadv-next-for-davem-20200824' of git://git.open-mesh.org/linux-merge
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      751e4251
    • Tariq Toukan's avatar
      net/mlx4_en: RX, Add a prefetch command for small L1_CACHE_BYTES · aed4d4c6
      Tariq Toukan authored
      A single cacheline might not contain the packet header for
      small L1_CACHE_BYTES values.
      Use net_prefetch() as it issues an additional prefetch
      in this case.
      Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aed4d4c6
    • Tariq Toukan's avatar
      net/mlx5e: RX, Add a prefetch command for small L1_CACHE_BYTES · e20f0dbf
      Tariq Toukan authored
      A single cacheline might not contain the packet header for
      small L1_CACHE_BYTES values.
      Use net_prefetch() as it issues an additional prefetch
      in this case.
      Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e20f0dbf
    • Tariq Toukan's avatar
      net: Take common prefetch code structure into a function · f468f21b
      Tariq Toukan authored
      Many device drivers use the same prefetch code structure to
      deal with small L1 cacheline size.
      Take this code into a function and call it from the drivers.
      Suggested-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f468f21b
    • David S. Miller's avatar
      Merge branch 'Add-Ethernet-support-for-Intel-Keem-Bay-SoC' · 04e006b4
      David S. Miller authored
      Vineetha G. Jaya Kumaran says:
      
      ====================
      Add Ethernet support for Intel Keem Bay SoC
      
      This patch set enables support for Ethernet on the Intel Keem Bay SoC.
      The first patch contains the required Device Tree bindings documentation,
      while the second patch adds the Intel platform glue layer for the stmmac
      device driver.
      
      This driver was tested on the Keem Bay evaluation module board.
      Changes since v2:
      -Add a select in DT documentation to avoid matching with all nodes containing 'snps,dwmac'
      -Rebased to 5.9-rc1
      
      Changes since v1:
      -Removed clocks maxItems property from DT bindings documentation
      -Removed phy compatible strings from DT bindings documentation
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      04e006b4
    • Rusaimi Amira Ruslan's avatar
      net: stmmac: Add dwmac-intel-plat for GBE driver · 9efc9b2b
      Rusaimi Amira Ruslan authored
      Add dwmac-intel-plat to enable the stmmac driver in Intel Keem Bay.
      Also add fix_mac_speed and tx_clk in order to change link speeds.
      This is required as mac_speed_o is not connected in the
      Intel Keem Bay SoC.
      Signed-off-by: default avatarRusaimi Amira Ruslan <rusaimi.amira.rusaimi@intel.com>
      Signed-off-by: default avatarVineetha G. Jaya Kumaran <vineetha.g.jaya.kumaran@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9efc9b2b
    • Vineetha G. Jaya Kumaran's avatar
      dt-bindings: net: Add bindings for Intel Keem Bay · 8d3c875c
      Vineetha G. Jaya Kumaran authored
      Add Device Tree bindings documentation for the ethernet controller
      on Intel Keem Bay.
      Signed-off-by: default avatarVineetha G. Jaya Kumaran <vineetha.g.jaya.kumaran@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8d3c875c
    • Eric Dumazet's avatar
      inet: remove inet_sk_copy_descendant() · 24da7990
      Eric Dumazet authored
      This is no longer used, SCTP now uses a private helper.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      24da7990
    • Xu Wang's avatar
      ptp: ptp_ines: Remove redundant null check · ea416e27
      Xu Wang authored
      Because kfree_skb already checked NULL skb parameter,
      so the additional check is unnecessary, just remove it.
      Signed-off-by: default avatarXu Wang <vulab@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ea416e27
  2. 25 Aug, 2020 24 commits