1. 14 May, 2022 1 commit
  2. 13 May, 2022 22 commits
  3. 12 May, 2022 17 commits
    • Jakub Kicinski's avatar
      Merge branch 'net-inet-retire-port-only-listening_hash' · b67fd3d9
      Jakub Kicinski authored
      Martin KaFai Lau says:
      
      ====================
      net: inet: Retire port only listening_hash
      
      This series is to retire the port only listening_hash.
      
      The listen sk is currently stored in two hash tables,
      listening_hash (hashed by port) and lhash2 (hashed by port and address).
      
      After commit 0ee58dad ("net: tcp6: prefer listeners bound to an address")
      and commit d9fbc7f6 ("net: tcp: prefer listeners bound to an address"),
      the TCP-SYN lookup fast path does not use listening_hash.
      
      The commit 05c0b357 ("tcp: seq_file: Replace listening_hash with lhash2")
      also moved the seq_file (/proc/net/tcp) iteration usage from
      listening_hash to lhash2.
      
      There are still a few listening_hash usages left.
      One of them is inet_reuseport_add_sock() which uses the listening_hash
      to search a listen sk during the listen() system call.  This turns
      out to be very slow on use cases that listen on many different
      VIPs at a popular port (e.g. 443).  [ On top of the slowness in
      adding to the tail in the IPv6 case ]. A latter patch has a
      selftest to demonstrate this case.
      
      This series takes this chance to move all remaining listening_hash
      usages to lhash2 and then retire listening_hash.
      ====================
      
      Link: https://lore.kernel.org/r/20220512000546.188616-1-kafai@fb.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b67fd3d9
    • Martin KaFai Lau's avatar
      net: selftests: Stress reuseport listen · ec8cb4f6
      Martin KaFai Lau authored
      This patch adds a test that has 300 VIPs listening on port 443.
      Each VIP:443 will have 80 listening socks by using SO_REUSEPORT.
      Thus, it will have 24000 listening socks.
      
      Before removing the port only listening_hash, all socks will be in the
      same port 443 bucket and inet_reuseport_add_sock() spends much time to
      walk through the bucket.  After removing the port only listening_hash
      and move all usage to the port+addr lhash2, each bucket in the
      ideal case has 80 sk which is much smaller than before.
      
      Here is the test result from a qemu:
      Before: listen 24000 socks took 210.210485362 (~210s)
       After: listen 24000 socks took 0.207173      (~210ms)
      Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ec8cb4f6
    • Martin KaFai Lau's avatar
      net: inet: Retire port only listening_hash · cae3873c
      Martin KaFai Lau authored
      The listen sk is currently stored in two hash tables,
      listening_hash (hashed by port) and lhash2 (hashed by port and address).
      
      After commit 0ee58dad ("net: tcp6: prefer listeners bound to an address")
      and commit d9fbc7f6 ("net: tcp: prefer listeners bound to an address"),
      the TCP-SYN lookup fast path does not use listening_hash.
      
      The commit 05c0b357 ("tcp: seq_file: Replace listening_hash with lhash2")
      also moved the seq_file (/proc/net/tcp) iteration usage from
      listening_hash to lhash2.
      
      There are still a few listening_hash usages left.
      One of them is inet_reuseport_add_sock() which uses the listening_hash
      to search a listen sk during the listen() system call.  This turns
      out to be very slow on use cases that listen on many different
      VIPs at a popular port (e.g. 443).  [ On top of the slowness in
      adding to the tail in the IPv6 case ].  The latter patch has a
      selftest to demonstrate this case.
      
      This patch takes this chance to move all remaining listening_hash
      usages to lhash2 and then retire listening_hash.
      
      Since most changes need to be done together, it is hard to cut
      the listening_hash to lhash2 switch into small patches.  The
      changes in this patch is highlighted here for the review
      purpose.
      
      1. Because of the listening_hash removal, lhash2 can use the
         sk->sk_nulls_node instead of the icsk->icsk_listen_portaddr_node.
         This will also keep the sk_unhashed() check to work as is
         after stop adding sk to listening_hash.
      
         The union is removed from inet_listen_hashbucket because
         only nulls_head is needed.
      
      2. icsk->icsk_listen_portaddr_node and its helpers are removed.
      
      3. The current lhash2 users needs to iterate with sk_nulls_node
         instead of icsk_listen_portaddr_node.
      
         One case is in the inet[6]_lhash2_lookup().
      
         Another case is the seq_file iterator in tcp_ipv4.c.
         One thing to note is sk_nulls_next() is needed
         because the old inet_lhash2_for_each_icsk_continue()
         does a "next" first before iterating.
      
      4. Move the remaining listening_hash usage to lhash2
      
         inet_reuseport_add_sock() which this series is
         trying to improve.
      
         inet_diag.c and mptcp_diag.c are the final two
         remaining use cases and is moved to lhash2 now also.
      Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cae3873c
    • Martin KaFai Lau's avatar
      net: inet: Open code inet_hash2 and inet_unhash2 · e8d00590
      Martin KaFai Lau authored
      This patch folds lhash2 related functions into __inet_hash and
      inet_unhash.  This will make the removal of the listening_hash
      in a latter patch easier to review.
      
      First, this patch folds inet_hash2 into __inet_hash.
      
      For unhash, the current call sequence is like
      inet_unhash() => __inet_unhash() => inet_unhash2().
      The specific testing cases in __inet_unhash() are mostly related
      to TCP_LISTEN sk and its caller inet_unhash() already has
      the TCP_LISTEN test, so this patch folds both __inet_unhash() and
      inet_unhash2() into inet_unhash().
      
      Note that all listening_hash users also have lhash2 initialized,
      so the !h->lhash2 check is no longer needed.
      Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e8d00590
    • Martin KaFai Lau's avatar
      net: inet: Remove count from inet_listen_hashbucket · 8ea1eebb
      Martin KaFai Lau authored
      After commit 0ee58dad ("net: tcp6: prefer listeners bound to an address")
      and commit d9fbc7f6 ("net: tcp: prefer listeners bound to an address"),
      the count is no longer used.  This patch removes it.
      Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8ea1eebb
    • Jakub Kicinski's avatar
      Merge branch 'make-sfc-siena-ko-specific-to-siena' · 0c1822d9
      Jakub Kicinski authored
      Martin Habets says:
      
      ====================
      Make sfc-siena.ko specific to Siena
      
      This series is a follow-up to the one titled "Move Siena into
      a separate subdirectory".
      It enhances the new sfc-siena.ko module to differentiate it from sfc.ko.
      
      	Patches
      
      Patches 1-5 create separate Kconfig options for Siena, and adjusts the
      various names used for work items and directories.
      Patch 6 reinstates SRIOV functionality in sfc-siena.ko.
      
      	Testing
      
      Various build tests were done such as allyesconfig, W=1 and sparse.
      The new sfc-siena.ko and sfc.ko modules were tested on a machine with NICs
      for both modules in them.
      Inserting the updated sfc.ko and the new sfc-siena.ko modules at the same
      time works, and no work items and directories exist with the same name.
      ====================
      
      Link: https://lore.kernel.org/r/165228589518.696.7119477411428288875.stgit@palantir17.mph.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0c1822d9
    • Martin Habets's avatar
      sfc/siena: Reinstate SRIOV init/fini function calls · c3743039
      Martin Habets authored
      They were removed in the first series since they were not used for EF10.
      Put that code back for Siena, with the prototypes in siena_sriov.h
      since that file is a more applicable place for it.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c3743039
    • Martin Habets's avatar
      sfc/siena: Make PTP and reset support specific for Siena · ef9b5770
      Martin Habets authored
      Change the clock name and work queue names to differentiate them from
      the names used in sfc.ko.
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ef9b5770
    • Martin Habets's avatar
      sfc/siena: Make MCDI logging support specific for Siena · 58b6b3d5
      Martin Habets authored
      Add a Siena Kconfig option and use it in stead of the sfc one.
      Rename the internal variable for the 'mcdi_logging_default' module
      parameter to avoid a naming conflict with the one in sfc.ko.
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      58b6b3d5
    • Martin Habets's avatar
      siena: Make HWMON support specific for Siena · f62a0745
      Martin Habets authored
      Add a Siena Kconfig option and use it in stead of the sfc one.
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f62a0745
    • Martin Habets's avatar
      siena: Make SRIOV support specific for Siena · dfb1cfbd
      Martin Habets authored
      Add a Siena Kconfig option and use it in stead of the sfc one.
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      dfb1cfbd
    • Martin Habets's avatar
      siena: Make MTD support specific for Siena · 65d4b471
      Martin Habets authored
      Add a Siena Kconfig option and use it in stead of the sfc one.
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      65d4b471
    • Jakub Kicinski's avatar
      Merge branch 'restructure-struct-ocelot_port' · 75db72de
      Jakub Kicinski authored
      Vladimir Oltean says:
      
      ====================
      Restructure struct ocelot_port
      
      This patch set represents preparation for further work. It adds an
      "index" field to struct ocelot_port, and populates it from the Felix DSA
      driver and Ocelot switchdev driver.
      
      The users of struct ocelot_port :: index are the same users as those of
      struct ocelot_port_private :: chip_port.
      ====================
      
      Link: https://lore.kernel.org/r/20220511100637.568950-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      75db72de
    • Vladimir Oltean's avatar
      net: mscc: ocelot: move ocelot_port_private :: chip_port to ocelot_port :: index · 7e708760
      Vladimir Oltean authored
      Currently the ocelot switch lib is unaware of the index of a struct
      ocelot_port, since that is kept in the encapsulating structures of outer
      drivers (struct dsa_port :: index, struct ocelot_port_private :: chip_port).
      
      With the upcoming increase in complexity associated with assigning DSA
      tag_8021q CPU ports to certain user ports, it becomes necessary for the
      switch lib to be able to retrieve the index of a certain ocelot_port.
      
      Therefore, introduce a new u8 to ocelot_port (same size as the chip_port
      used by the ocelot switchdev driver) and rework the existing code to
      populate and use it.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7e708760
    • Vladimir Oltean's avatar
      net: mscc: ocelot: minimize holes in struct ocelot_port · 6d0be600
      Vladimir Oltean authored
      Reorder members of struct ocelot_port to eliminate holes and reduce
      structure size. Pahole says:
      
      Before:
      
      struct ocelot_port {
              struct ocelot *            ocelot;               /*     0     8 */
              struct regmap *            target;               /*     8     8 */
              bool                       vlan_aware;           /*    16     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              const struct ocelot_bridge_vlan  * pvid_vlan;    /*    24     8 */
              unsigned int               ptp_skbs_in_flight;   /*    32     4 */
              u8                         ptp_cmd;              /*    36     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              struct sk_buff_head        tx_skbs;              /*    40    96 */
              /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
              u8                         ts_id;                /*   136     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              phy_interface_t            phy_mode;             /*   140     4 */
              bool                       is_dsa_8021q_cpu;     /*   144     1 */
              bool                       learn_ena;            /*   145     1 */
      
              /* XXX 6 bytes hole, try to pack */
      
              struct net_device *        bond;                 /*   152     8 */
              bool                       lag_tx_active;        /*   160     1 */
      
              /* XXX 1 byte hole, try to pack */
      
              u16                        mrp_ring_id;          /*   162     2 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct net_device *        bridge;               /*   168     8 */
              int                        bridge_num;           /*   176     4 */
              u8                         stp_state;            /*   180     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              int                        speed;                /*   184     4 */
      
              /* size: 192, cachelines: 3, members: 18 */
              /* sum members: 161, holes: 7, sum holes: 27 */
              /* padding: 4 */
      };
      
      After:
      
      struct ocelot_port {
              struct ocelot *            ocelot;               /*     0     8 */
              struct regmap *            target;               /*     8     8 */
              struct net_device *        bond;                 /*    16     8 */
              struct net_device *        bridge;               /*    24     8 */
              const struct ocelot_bridge_vlan  * pvid_vlan;    /*    32     8 */
              phy_interface_t            phy_mode;             /*    40     4 */
              unsigned int               ptp_skbs_in_flight;   /*    44     4 */
              struct sk_buff_head        tx_skbs;              /*    48    96 */
              /* --- cacheline 2 boundary (128 bytes) was 16 bytes ago --- */
              u16                        mrp_ring_id;          /*   144     2 */
              u8                         ptp_cmd;              /*   146     1 */
              u8                         ts_id;                /*   147     1 */
              u8                         stp_state;            /*   148     1 */
              bool                       vlan_aware;           /*   149     1 */
              bool                       is_dsa_8021q_cpu;     /*   150     1 */
              bool                       learn_ena;            /*   151     1 */
              bool                       lag_tx_active;        /*   152     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              int                        bridge_num;           /*   156     4 */
              int                        speed;                /*   160     4 */
      
              /* size: 168, cachelines: 3, members: 18 */
              /* sum members: 161, holes: 1, sum holes: 3 */
              /* padding: 4 */
              /* last cacheline: 40 bytes */
      };
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6d0be600
    • Vladimir Oltean's avatar
      net: mscc: ocelot: delete ocelot_port :: xmit_template · 15f6d01e
      Vladimir Oltean authored
      This is no longer used since commit 7c4bb540 ("net: dsa: tag_ocelot:
      create separate tagger for Seville").
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      15f6d01e
    • Jakub Kicinski's avatar
      Merge branch 'dsa-changes-for-multiple-cpu-ports-part-1' · 879c610c
      Jakub Kicinski authored
      Vladimir Oltean says:
      
      ====================
      DSA changes for multiple CPU ports (part 1)
      
      I am trying to enable the second internal port pair from the NXP LS1028A
      Felix switch for DSA-tagged traffic via "ocelot-8021q". This series
      represents part 1 (of an unknown number) of that effort.
      
      It does some preparation work, like managing host flooding in DSA via a
      dedicated method, and removing the CPU port as argument from the tagging
      protocol change procedure.
      
      In terms of driver-specific changes, it reworks the 2 tag protocol
      implementations in the Felix driver to have a structured data format.
      It enables host flooding towards all tag_8021q CPU ports. It dynamically
      updates the tag_8021q CPU port used for traps. It also fixes a bug
      introduced by a previous refactoring/oversimplification commit in
      net-next.
      ====================
      
      Link: https://lore.kernel.org/r/20220511095020.562461-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      879c610c