1. 23 6月, 2021 27 次提交
  2. 22 6月, 2021 13 次提交
    • B
      Revert "net/sched: cls_flower: Remove match on n_proto" · 6d551617
      Boris Sukholitko 提交于
      This reverts commit 0dca2c74.
      
      The commit in question breaks hardware offload of flower filters.
      
      Quoting Vladimir Oltean <olteanv@gmail.com>:
      
       fl_hw_replace_filter() and fl_reoffload() create a struct
       flow_cls_offload with a rule->match.mask member derived from the mask
       of the software classifier: &f->mask->key - that same mask that is used
       for initializing the flow dissector keys, and the one from which Boris
       removed the basic.n_proto member because it was bothering him.
      Reported-by: NVadym Kochan <vadym.kochan@plvision.eu>
      Signed-off-by: NBoris Sukholitko <boris.sukholitko@broadcom.com>
      Reviewed-by: NVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6d551617
    • Y
      net: add pf_family_names[] for protocol family · fe0bdbde
      Yejune Deng 提交于
      Modify the pr_info content from int to char * in sock_register() and
      sock_unregister(), this looks more readable.
      
      Fixed build error in ARCH=sparc64.
      Signed-off-by: NYejune Deng <yejune.deng@gmail.com>
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fe0bdbde
    • V
      net: dsa: remove cross-chip support from the MRP notifiers · f9bcdc36
      Vladimir Oltean 提交于
      With MRP hardware assist being supported only by the ocelot switch
      family, which by design does not support cross-chip bridging, the
      current match functions are at best a guess and have not been confirmed
      in any way to do anything relevant in a multi-switch topology.
      
      Drop the code and make the notifiers match only on the targeted switch
      port.
      
      Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f9bcdc36
    • V
      net: dsa: targeted MTU notifiers should only match on one port · 88faba20
      Vladimir Oltean 提交于
      dsa_slave_change_mtu() calls dsa_port_mtu_change() twice:
      - it sends a cross-chip notifier with the MTU of the CPU port which is
        used to update the DSA links.
      - it sends one targeted MTU notifier which is supposed to only match the
        user port on which we are changing the MTU. The "propagate_upstream"
        variable is used here to bypass the cross-chip notifier system from
        switch.c
      
      But due to a mistake, the second, targeted notifier matches not only on
      the user port, but also on the DSA link which is a member of the same
      switch, if that exists.
      
      And because the DSA links of the entire dst were programmed in a
      previous round to the largest_mtu via a "propagate_upstream == true"
      notification, then the dsa_port_mtu_change(propagate_upstream == false)
      call that is immediately upcoming will break the MTU on the one DSA link
      which is chip-wise local to the dp whose MTU is changing right now.
      
      Example given this daisy chain topology:
      
         sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
      [  cpu  ] [  user ] [  user ] [  dsa  ] [  user ]
      [   x   ] [       ] [       ] [   x   ] [       ]
                                        |
                                        +---------+
                                                  |
         sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
      [  user ] [  user ] [  user ] [  dsa  ] [  dsa  ]
      [       ] [       ] [       ] [       ] [   x   ]
      
      ip link set sw0p1 mtu 9000
      ip link set sw1p1 mtu 9000 # at this stage, sw0p1 and sw1p1 can talk
                                 # to one another using jumbo frames
      ip link set sw0p2 mtu 1500 # this programs the sw0p3 DSA link first to
                                 # the largest_mtu of 9000, then reprograms it to
                                 # 1500 with the "propagate_upstream == false"
                                 # notifier, breaking communication between
                                 # sw0p1 and sw1p1
      
      To escape from this situation, make the targeted match really match on a
      single port - the user port, and rename the "propagate_upstream"
      variable to "targeted_match" to clarify the intention and avoid future
      issues.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      88faba20
    • V
      net: dsa: calculate the largest_mtu across all ports in the tree · 4e4ab795
      Vladimir Oltean 提交于
      If we have a cross-chip topology like this:
      
         sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
      [  cpu  ] [  user ] [  user ] [  dsa  ] [  user ]
                                        |
                                        +---------+
                                                  |
         sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
      [  user ] [  user ] [  user ] [  dsa  ] [  dsa  ]
      
      and we issue the following commands:
      
      1. ip link set sw0p1 mtu 1700
      2. ip link set sw1p1 mtu 1600
      
      we notice the following happening:
      
      Command 1. emits a non-targeted MTU notifier for the CPU port (sw0p0)
      with the largest_mtu calculated across switch 0, of 1700. This matches
      sw0p0, sw0p3 and sw1p4 (all CPU ports and DSA links).
      Then, it emits a targeted MTU notifier for the user port (sw0p1), again
      with MTU 1700 (this doesn't matter).
      
      Command 2. emits a non-targeted MTU notifier for the CPU port (sw0p0)
      with the largest_mtu calculated across switch 1, of 1600. This matches
      the same group of ports as above, and decreases the MTU for the CPU port
      and the DSA links from 1700 to 1600.
      
      As a result, the sw0p1 user port can no longer communicate with its CPU
      port at MTU 1700.
      
      To address this, we should calculate the largest_mtu across all switches
      that may share a CPU port, and only emit MTU notifiers with that value.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4e4ab795
    • V
      net: dsa: execute dsa_switch_mdb_add only for routing port in cross-chip topologies · abd49535
      Vladimir Oltean 提交于
      Currently, the notifier for adding a multicast MAC address matches on
      the targeted port and on all DSA links in the system, be they upstream
      or downstream links.
      
      This leads to a considerable amount of useless traffic.
      
      Consider this daisy chain topology, and a MDB add notifier emitted on
      sw0p0. It matches on sw0p0, sw0p3, sw1p3 and sw2p4.
      
         sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
      [  user ] [  user ] [  user ] [  dsa  ] [  cpu  ]
      [   x   ] [       ] [       ] [   x   ] [       ]
                                        |
                                        +---------+
                                                  |
         sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
      [  user ] [  user ] [  user ] [  dsa  ] [  dsa  ]
      [       ] [       ] [       ] [   x   ] [   x   ]
                                        |
                                        +---------+
                                                  |
         sw2p0     sw2p1     sw2p2     sw2p3     sw2p4
      [  user ] [  user ] [  user ] [  user ] [  dsa  ]
      [       ] [       ] [       ] [       ] [   x   ]
      
      But switch 0 has no reason to send the multicast traffic for that MAC
      address on sw0p3, which is how it reaches switches 1 and 2. Those
      switches don't expect, according to the user configuration, to receive
      this multicast address from switch 1, and they will drop it anyway,
      because the only valid destination is the port they received it on.
      They only need to configure themselves to deliver that multicast address
      _towards_ switch 1, where the MDB entry is installed.
      
      Similarly, switch 1 should not send this multicast traffic towards
      sw1p3, because that is how it reaches switch 2.
      
      With this change, the heat map for this MDB notifier changes as follows:
      
         sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
      [  user ] [  user ] [  user ] [  dsa  ] [  cpu  ]
      [   x   ] [       ] [       ] [       ] [       ]
                                        |
                                        +---------+
                                                  |
         sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
      [  user ] [  user ] [  user ] [  dsa  ] [  dsa  ]
      [       ] [       ] [       ] [       ] [   x   ]
                                        |
                                        +---------+
                                                  |
         sw2p0     sw2p1     sw2p2     sw2p3     sw2p4
      [  user ] [  user ] [  user ] [  user ] [  dsa  ]
      [       ] [       ] [       ] [       ] [   x   ]
      
      Now the mdb notifier behaves the same as the fdb notifier.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      abd49535
    • V
      net: dsa: export the dsa_port_is_{user,cpu,dsa} helpers · a8986681
      Vladimir Oltean 提交于
      The difference between dsa_is_user_port and dsa_port_is_user is that the
      former needs to look up the list of ports of the DSA switch tree in
      order to find the struct dsa_port, while the latter directly receives it
      as an argument.
      
      dsa_is_user_port is already in widespread use and has its place, so
      there isn't any chance of converting all callers to a single form.
      But being able to do:
      	dsa_port_is_user(dp)
      instead of
      	dsa_is_user_port(dp->ds, dp->index)
      
      is much more efficient too, especially when the "dp" comes from an
      iterator over the DSA switch tree - this reduces the complexity from
      quadratic to linear.
      
      Move these helpers from dsa2.c to include/net/dsa.h so that others can
      use them too.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a8986681
    • V
      net: dsa: assert uniqueness of dsa,member properties · 8674f8d3
      Vladimir Oltean 提交于
      The cross-chip notifiers work by comparing each ds->index against the
      info->sw_index value from the notifier. The ds->index is retrieved from
      the device tree dsa,member property.
      
      If a single tree cross-chip topology does not declare unique switch IDs,
      this will result in hard-to-debug issues/voodoo effects such as the
      cross-chip notifier for one switch port also matching the port with the
      same number from another switch.
      
      Check in dsa_switch_parse_member_of() whether the DSA switch tree
      contains a DSA switch with the index we're preparing to add, before
      actually adding it.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8674f8d3
    • A
      __unix_find_socket_byname(): don't pass hash and type separately · be752283
      Al Viro 提交于
      We only care about exclusive or of those, so pass that directly.
      Makes life simpler for callers as well...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      be752283
    • A
      unix_bind_bsd(): unlink if we fail after successful mknod · c0c3b8d3
      Al Viro 提交于
      We can do that more or less safely, since the parent is
      held locked all along.  Yes, somebody might observe the
      object via dcache, only to have it disappear afterwards,
      but there's really no good way to prevent that.  It won't
      race with other bind(2) or attempts to move the sucker
      elsewhere, or put something else in its place - locked
      parent prevents that.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c0c3b8d3
    • A
      unix_bind_bsd(): move done_path_create() call after dealing with ->bindlock · 56c1731b
      Al Viro 提交于
      Final preparations for doing unlink on failure past the successful
      mknod.  We can't hold ->bindlock over ->mknod() or ->unlink(), since
      either might do sb_start_write() (e.g. on overlayfs).  However, we
      can do it while holding filesystem and VFS locks - doing
      	kern_path_create()
      	vfs_mknod()
      	grab ->bindlock
      	if u->addr had been set
      		drop ->bindlock
      		done_path_create
      		return -EINVAL
      	else
      		assign the address to socket
      		drop ->bindlock
      		done_path_create
      		return 0
      would be deadlock-free.  Here we massage unix_bind_bsd() to that
      form.  We are still doing equivalent transformations.
      
      Next commit will *not* be an equivalent transformation - it will
      add a call of vfs_unlink() before done_path_create() in "alread bound"
      case.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      56c1731b
    • A
      fold unix_mknod() into unix_bind_bsd() · 71e6be6f
      Al Viro 提交于
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      71e6be6f
    • A
      unix_bind(): take BSD and abstract address cases into new helpers · fa42d910
      Al Viro 提交于
      unix_bind_bsd() and unix_bind_abstract() respectively.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fa42d910