1. 06 Jan, 2022 10 commits
  2. 05 Jan, 2022 30 commits
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · b9adba35
      Jakub Kicinski authored
      No conflicts.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b9adba35
    • Linus Torvalds's avatar
      Merge tag 'net-5.16-final' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 75acfdb6
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski"
       "Networking fixes, including fixes from bpf, and WiFi. One last pull
        request, turns out some of the recent fixes did more harm than good.
      
        Current release - regressions:
      
         - Revert "xsk: Do not sleep in poll() when need_wakeup set", made the
           problem worse
      
         - Revert "net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in
           __fixed_phy_register", broke EPROBE_DEFER handling
      
         - Revert "net: usb: r8152: Add MAC pass-through support for more
           Lenovo Docks", broke setups without a Lenovo dock
      
        Current release - new code bugs:
      
         - selftests: set amt.sh executable
      
        Previous releases - regressions:
      
         - batman-adv: mcast: don't send link-local multicast to mcast routers
      
        Previous releases - always broken:
      
         - ipv4/ipv6: check attribute length for RTA_FLOW / RTA_GATEWAY
      
         - sctp: hold endpoint before calling cb in
           sctp_transport_lookup_process
      
         - mac80211: mesh: embed mesh_paths and mpp_paths into
           ieee80211_if_mesh to avoid complicated handling of sub-object
           allocation failures
      
         - seg6: fix traceroute in the presence of SRv6
      
         - tipc: fix a kernel-infoleak in __tipc_sendmsg()"
      
      * tag 'net-5.16-final' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (36 commits)
        selftests: set amt.sh executable
        Revert "net: usb: r8152: Add MAC passthrough support for more Lenovo Docks"
        sfc: The RX page_ring is optional
        iavf: Fix limit of total number of queues to active queues of VF
        i40e: Fix incorrect netdev's real number of RX/TX queues
        i40e: Fix for displaying message regarding NVM version
        i40e: fix use-after-free in i40e_sync_filters_subtask()
        i40e: Fix to not show opcode msg on unsuccessful VF MAC change
        ieee802154: atusb: fix uninit value in atusb_set_extended_addr
        mac80211: mesh: embedd mesh_paths and mpp_paths into ieee80211_if_mesh
        mac80211: initialize variable have_higher_than_11mbit
        sch_qfq: prevent shift-out-of-bounds in qfq_init_qdisc
        netrom: fix copying in user data in nr_setsockopt
        udp6: Use Segment Routing Header for dest address if present
        icmp: ICMPV6: Examine invoking packet for Segment Route Headers.
        seg6: export get_srh() for ICMP handling
        Revert "net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register"
        ipv6: Do cleanup if attribute validation fails in multipath route
        ipv6: Continue processing multipath route even if gateway attribute is invalid
        net/fsl: Remove leftover definition in xgmac_mdio
        ...
      75acfdb6
    • Russell King (Oracle)'s avatar
      net: gemini: allow any RGMII interface mode · 4e4f325a
      Russell King (Oracle) authored
      The four RGMII interface modes take care of the required RGMII delay
      configuration at the PHY and should not be limited by the network MAC
      driver. Sadly, gemini was only permitting RGMII mode with no delays,
      which would require the required delay to be inserted via PCB tracking
      or by the MAC.
      
      However, there are designs that require the PHY to add the delay, which
      is impossible without Gemini permitting the other three PHY interface
      modes. Fix the driver to allow these.
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Tested-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
      Link: https://lore.kernel.org/r/E1n4mpT-002PLd-Ha@rmk-PC.armlinux.org.ukSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4e4f325a
    • Jakub Kicinski's avatar
      Merge branch 'fix-rgmii-delays-for-88e1118' · aa298b55
      Jakub Kicinski authored
      Russell King says:
      
      ====================
      Fix RGMII delays for 88E1118
      
      This series fixes the RGMII delays for 88E1118 Marvell PHYs, after
      a report by Corentin Labbe that the Marvell driver fails to work.
      
      Patch 1 cleans up the paged register accesses in m88e1118_config_init()
      and patch 2 adds the RGMII delay configuration.
      
      This comes with an element of risk as existing DT may need to be fixed
      for this in a similar way as we have done in the recent past for other
      PHY drivers that have misinterpreted the RGMII interface modes.
      ====================
      
      Link: https://lore.kernel.org/r/YdR3wYFkm4eJApwb@shell.armlinux.org.ukSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      aa298b55
    • Russell King (Oracle)'s avatar
      net: phy: marvell: configure RGMII delays for 88E1118 · f22725c9
      Russell King (Oracle) authored
      Corentin Labbe reports that the SSI 1328 does not work when allowing
      the PHY to operate at gigabit speeds, but does work with the generic
      PHY driver.
      
      This appears to be because m88e1118_config_init() writes a fixed value
      to the MSCR register, claiming that this is to enable 1G speeds.
      However, this always sets bits 4 and 5, enabling RGMII transmit and
      receive delays. The suspicion is that the original board this was
      added for required the delays to make 1G speeds work.
      
      Add the necessary configuration for RGMII delays for the 88E1118 to
      bring this into line with the requirements for RGMII support, and thus
      make the SSI 1328 work.
      
      Corentin Labbe has tested this on gemini-ssi1328 and gemini-ns2502.
      Reported-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
      Tested-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f22725c9
    • Russell King (Oracle)'s avatar
      net: phy: marvell: use phy_write_paged() to set MSCR · 5b8f9703
      Russell King (Oracle) authored
      Use phy_write_paged() in m88e1118_config_init() to set the MSCR value.
      We leave the other paged write for the LEDs in case the DT register
      parsing is relying on this page.
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Tested-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5b8f9703
    • Taehee Yoo's avatar
      selftests: set amt.sh executable · db54c12a
      Taehee Yoo authored
      amt.sh test script will not work because it doesn't have execution
      permission. So, it adds execution permission.
      Reported-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Fixes: c08e8bae ("selftests: add amt interface selftest script")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Link: https://lore.kernel.org/r/20220105144436.13415-1-ap420073@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      db54c12a
    • Aaron Ma's avatar
      Revert "net: usb: r8152: Add MAC passthrough support for more Lenovo Docks" · 00fcf8c7
      Aaron Ma authored
      This reverts commit f77b83b5.
      
      This change breaks multiple usb to ethernet dongles attached on Lenovo
      USB hub.
      
      Fixes: f77b83b5 ("net: usb: r8152: Add MAC passthrough support for more Lenovo Docks")
      Signed-off-by: default avatarAaron Ma <aaron.ma@canonical.com>
      Link: https://lore.kernel.org/r/20220105155102.8557-1-aaron.ma@canonical.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      00fcf8c7
    • Eric Dumazet's avatar
      netlink: do not allocate a device refcount tracker in ethnl_default_notify() · 2d6ec255
      Eric Dumazet authored
      As reported by Johannes, the tracker allocated in
      ethnl_default_notify() is not really needed, as this
      function is not expected to change a device reference count.
      
      Fixes: e4b89540 ("netlink: add net device refcount tracker to struct ethnl_req_info")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Tested-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Link: https://lore.kernel.org/r/20220105170849.2610470-1-eric.dumazet@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2d6ec255
    • Eric Dumazet's avatar
      net/sched: add missing tracker information in qdisc_create() · 88248c35
      Eric Dumazet authored
      qdisc_create() error path needs to use dev_put_track()
      because qdisc_alloc() allocated the tracker.
      
      Fixes: 606509f2 ("net/sched: add net device refcount tracker to struct Qdisc")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20220104170439.3790052-1-eric.dumazet@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      88248c35
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · 49ef78e5
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
       "Here are two last fixes for this release cycle from the GPIO
        subsystem:
      
         - fix irq offset calculation in gpio-aspeed-sgpio
      
         - update the MAINTAINERS entry for gpio-brcmstb"
      
      * tag 'gpio-fixes-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        MAINTAINERS: update gpio-brcmstb maintainers
        gpio: gpio-aspeed-sgpio: Fix wrong hwirq base in irq handler
      49ef78e5
    • Jakub Kicinski's avatar
      Merge tag 'ieee802154-for-net-2022-01-05' of... · af872b69
      Jakub Kicinski authored
      Merge tag 'ieee802154-for-net-2022-01-05' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan
      
      Stefan Schmidt says:
      
      ====================
      pull-request: ieee802154 for net 2022-01-05
      
      Below I have a last minute fix for the atusb driver.
      
      Pavel fixes a KASAN uninit report for the driver. This version is the
      minimal impact fix to ease backporting. A bigger rework of the driver to
      avoid potential similar problems is ongoing and will come through net-next
      when ready.
      
      * tag 'ieee802154-for-net-2022-01-05' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan:
        ieee802154: atusb: fix uninit value in atusb_set_extended_addr
      ====================
      
      Link: https://lore.kernel.org/r/20220105153914.512305-1-stefan@datenfreihafen.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      af872b69
    • David S. Miller's avatar
      Merge branch 'dsa-notifier-cleanup' · c487b653
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      DSA cross-chip notifier cleanup
      
      This series deletes the no-op cross-chip notifier support for MRP and
      HSR, features which were introduced relatively recently and did not get
      full review at the time. The new code is functionally equivalent, but
      simpler.
      
      Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
      Cc: George McCollister <george.mccollister@gmail.com>
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c487b653
    • Vladimir Oltean's avatar
      net: dsa: remove cross-chip support for HSR · a68dc7b9
      Vladimir Oltean authored
      The cross-chip notifiers for HSR are bypass operations, meaning that
      even though all switches in a tree are notified, only the switch
      specified in the info structure is targeted.
      
      We can eliminate the unnecessary complexity by deleting the cross-chip
      notifier logic and calling the ds->ops straight from port.c.
      
      Cc: George McCollister <george.mccollister@gmail.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarGeorge McCollister <george.mccollister@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a68dc7b9
    • Vladimir Oltean's avatar
      net: dsa: remove cross-chip support for MRP · cad69019
      Vladimir Oltean authored
      The cross-chip notifiers for MRP are bypass operations, meaning that
      even though all switches in a tree are notified, only the switch
      specified in the info structure is targeted.
      
      We can eliminate the unnecessary complexity by deleting the cross-chip
      notifier logic and calling the ds->ops straight from port.c.
      
      Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cad69019
    • Vladimir Oltean's avatar
      net: dsa: fix incorrect function pointer check for MRP ring roles · ff91e1b6
      Vladimir Oltean authored
      The cross-chip notifier boilerplate code meant to check the presence of
      ds->ops->port_mrp_add_ring_role before calling it, but checked
      ds->ops->port_mrp_add instead, before calling
      ds->ops->port_mrp_add_ring_role.
      
      Therefore, a driver which implements one operation but not the other
      would trigger a NULL pointer dereference.
      
      There isn't any such driver in DSA yet, so there is no reason to
      backport the change. Issue found through code inspection.
      
      Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
      Fixes: c595c433 ("net: dsa: add MRP support")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ff91e1b6
    • Danielle Ratson's avatar
      mlxsw: pci: Avoid flow control for EMAD packets · d43e4271
      Danielle Ratson authored
      Locally generated packets ingress the device through its CPU port. When
      the CPU port is congested and there are not enough credits in its
      headroom buffer, packets can be dropped.
      
      While this might be acceptable for data packets that traverse the
      network, configuration packets exchanged between the host and the device
      (EMADs) should not be subjected to this flow control.
      
      The "sdq_lp" bit in the SDQ (Send Descriptor Queue) context allows the
      host to instruct the device to treat packets sent on this queue as
      "local processing" and always process them, regardless of the state of
      the CPU port's headroom.
      
      Add the definition of this bit and set it for the dedicated SDQ reserved
      for the transmission of EMAD packets. This makes the "local processing"
      bit in the WQE (Work Queue Element) redundant, so clear it.
      Signed-off-by: default avatarDanielle Ratson <danieller@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d43e4271
    • David S. Miller's avatar
      Merge tag 'linux-can-next-for-5.17-20220105' of... · 7da0694c
      David S. Miller authored
      Merge tag 'linux-can-next-for-5.17-20220105' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
      
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can-next 2022-01-05
      
      this is a pull request of 15 patches for net-next/master.
      
      The first patch is by me and removed an unused variable from the
      usb_8dev driver.
      
      Andy Shevchenko contributes a patch for the mcp251x driver, which
      removes an unneeded assignment.
      
      Jimmy Assarsson's patch for the kvaser_usb makes use of units.h in the
      assignment of frequencies.
      
      Lad Prabhakar provides 2 patches, converting the ti_hecc and the
      sja1000 driver to make use of platform_get_irq().
      
      The 10 remaining patches are by Vincent Mailhol. First the etas_es58x
      driver populates the net_device::dev_port. The next 5 patches cleanup
      the handling of CAN error and CAN RTR messages of all drivers. The
      remaining 4 patches enhance the CAN controller mode flag handling and
      export it via netlink to user space.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7da0694c
    • David S. Miller's avatar
      Merge branch 'dsa-cleanups' · 53928cdd
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Cleanup to main DSA structures
      
      This series contains changes that do the following:
      
      - struct dsa_port reduced from 576 to 544 bytes, and first cache line a
        bit better organized
      - struct dsa_switch from 160 to 136 bytes, and first cache line a bit
        better organized
      - struct dsa_switch_tree from 112 to 104 bytes, and first cache line a
        bit better organized
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      53928cdd
    • Vladimir Oltean's avatar
      net: dsa: combine two holes in struct dsa_switch_tree · 4b026e82
      Vladimir Oltean authored
      There is a 7 byte hole after dst->setup and a 4 byte hole after
      dst->default_proto. Combining them, we have a single hole of just 3
      bytes on 64 bit machines.
      
      Before:
      
      pahole -C dsa_switch_tree net/dsa/slave.o
      struct dsa_switch_tree {
              struct list_head           list;                 /*     0    16 */
              struct list_head           ports;                /*    16    16 */
              struct raw_notifier_head   nh;                   /*    32     8 */
              unsigned int               index;                /*    40     4 */
              struct kref                refcount;             /*    44     4 */
              struct net_device * *      lags;                 /*    48     8 */
              bool                       setup;                /*    56     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              /* --- cacheline 1 boundary (64 bytes) --- */
              const struct dsa_device_ops  * tag_ops;          /*    64     8 */
              enum dsa_tag_protocol      default_proto;        /*    72     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_platform_data * pd;                   /*    80     8 */
              struct list_head           rtable;               /*    88    16 */
              unsigned int               lags_len;             /*   104     4 */
              unsigned int               last_switch;          /*   108     4 */
      
              /* size: 112, cachelines: 2, members: 13 */
              /* sum members: 101, holes: 2, sum holes: 11 */
              /* last cacheline: 48 bytes */
      };
      
      After:
      
      pahole -C dsa_switch_tree net/dsa/slave.o
      struct dsa_switch_tree {
              struct list_head           list;                 /*     0    16 */
              struct list_head           ports;                /*    16    16 */
              struct raw_notifier_head   nh;                   /*    32     8 */
              unsigned int               index;                /*    40     4 */
              struct kref                refcount;             /*    44     4 */
              struct net_device * *      lags;                 /*    48     8 */
              const struct dsa_device_ops  * tag_ops;          /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              enum dsa_tag_protocol      default_proto;        /*    64     4 */
              bool                       setup;                /*    68     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              struct dsa_platform_data * pd;                   /*    72     8 */
              struct list_head           rtable;               /*    80    16 */
              unsigned int               lags_len;             /*    96     4 */
              unsigned int               last_switch;          /*   100     4 */
      
              /* size: 104, cachelines: 2, members: 13 */
              /* sum members: 101, holes: 1, sum holes: 3 */
              /* last cacheline: 40 bytes */
      };
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4b026e82
    • Vladimir Oltean's avatar
      net: dsa: move dsa_switch_tree :: ports and lags to first cache line · b035c88c
      Vladimir Oltean authored
      dst->ports is accessed most notably by dsa_master_find_slave(), which is
      invoked in the RX path.
      
      dst->lags is accessed by dsa_lag_dev(), which is invoked in the RX path
      of tag_dsa.c.
      
      dst->tag_ops, dst->default_proto and dst->pd don't need to be in the
      first cache line, so they are moved out by this change.
      
      Before:
      
      pahole -C dsa_switch_tree net/dsa/slave.o
      struct dsa_switch_tree {
              struct list_head           list;                 /*     0    16 */
              struct raw_notifier_head   nh;                   /*    16     8 */
              unsigned int               index;                /*    24     4 */
              struct kref                refcount;             /*    28     4 */
              bool                       setup;                /*    32     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              const struct dsa_device_ops  * tag_ops;          /*    40     8 */
              enum dsa_tag_protocol      default_proto;        /*    48     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_platform_data * pd;                   /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              struct list_head           ports;                /*    64    16 */
              struct list_head           rtable;               /*    80    16 */
              struct net_device * *      lags;                 /*    96     8 */
              unsigned int               lags_len;             /*   104     4 */
              unsigned int               last_switch;          /*   108     4 */
      
              /* size: 112, cachelines: 2, members: 13 */
              /* sum members: 101, holes: 2, sum holes: 11 */
              /* last cacheline: 48 bytes */
      };
      
      After:
      
      pahole -C dsa_switch_tree net/dsa/slave.o
      struct dsa_switch_tree {
              struct list_head           list;                 /*     0    16 */
              struct list_head           ports;                /*    16    16 */
              struct raw_notifier_head   nh;                   /*    32     8 */
              unsigned int               index;                /*    40     4 */
              struct kref                refcount;             /*    44     4 */
              struct net_device * *      lags;                 /*    48     8 */
              bool                       setup;                /*    56     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              /* --- cacheline 1 boundary (64 bytes) --- */
              const struct dsa_device_ops  * tag_ops;          /*    64     8 */
              enum dsa_tag_protocol      default_proto;        /*    72     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_platform_data * pd;                   /*    80     8 */
              struct list_head           rtable;               /*    88    16 */
              unsigned int               lags_len;             /*   104     4 */
              unsigned int               last_switch;          /*   108     4 */
      
              /* size: 112, cachelines: 2, members: 13 */
              /* sum members: 101, holes: 2, sum holes: 11 */
              /* last cacheline: 48 bytes */
      };
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b035c88c
    • Vladimir Oltean's avatar
      net: dsa: make dsa_switch :: num_ports an unsigned int · 258030ac
      Vladimir Oltean authored
      Currently, num_ports is declared as size_t, which is defined as
      __kernel_ulong_t, therefore it occupies 8 bytes of memory.
      
      Even switches with port numbers in the range of tens are exotic, so
      there is no need for this amount of storage.
      
      Additionally, because the max_num_bridges member right above it is also
      4 bytes, it means the compiler needs to add padding between the last 2
      fields. By reducing the size, we don't need that padding and can reduce
      the struct size.
      
      Before:
      
      pahole -C dsa_switch net/dsa/slave.o
      struct dsa_switch {
              struct device *            dev;                  /*     0     8 */
              struct dsa_switch_tree *   dst;                  /*     8     8 */
              unsigned int               index;                /*    16     4 */
              u32                        setup:1;              /*    20: 0  4 */
              u32                        vlan_filtering_is_global:1; /*    20: 1  4 */
              u32                        needs_standalone_vlan_filtering:1; /*    20: 2  4 */
              u32                        configure_vlan_while_not_filtering:1; /*    20: 3  4 */
              u32                        untag_bridge_pvid:1;  /*    20: 4  4 */
              u32                        assisted_learning_on_cpu_port:1; /*    20: 5  4 */
              u32                        vlan_filtering:1;     /*    20: 6  4 */
              u32                        pcs_poll:1;           /*    20: 7  4 */
              u32                        mtu_enforcement_ingress:1; /*    20: 8  4 */
      
              /* XXX 23 bits hole, try to pack */
      
              struct notifier_block      nb;                   /*    24    24 */
      
              /* XXX last struct has 4 bytes of padding */
      
              void *                     priv;                 /*    48     8 */
              void *                     tagger_data;          /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              struct dsa_chip_data *     cd;                   /*    64     8 */
              const struct dsa_switch_ops  * ops;              /*    72     8 */
              u32                        phys_mii_mask;        /*    80     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct mii_bus *           slave_mii_bus;        /*    88     8 */
              unsigned int               ageing_time_min;      /*    96     4 */
              unsigned int               ageing_time_max;      /*   100     4 */
              struct dsa_8021q_context * tag_8021q_ctx;        /*   104     8 */
              struct devlink *           devlink;              /*   112     8 */
              unsigned int               num_tx_queues;        /*   120     4 */
              unsigned int               num_lag_ids;          /*   124     4 */
              /* --- cacheline 2 boundary (128 bytes) --- */
              unsigned int               max_num_bridges;      /*   128     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              size_t                     num_ports;            /*   136     8 */
      
              /* size: 144, cachelines: 3, members: 27 */
              /* sum members: 132, holes: 2, sum holes: 8 */
              /* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 23 bits */
              /* paddings: 1, sum paddings: 4 */
              /* last cacheline: 16 bytes */
      };
      
      After:
      
      pahole -C dsa_switch net/dsa/slave.o
      struct dsa_switch {
              struct device *            dev;                  /*     0     8 */
              struct dsa_switch_tree *   dst;                  /*     8     8 */
              unsigned int               index;                /*    16     4 */
              u32                        setup:1;              /*    20: 0  4 */
              u32                        vlan_filtering_is_global:1; /*    20: 1  4 */
              u32                        needs_standalone_vlan_filtering:1; /*    20: 2  4 */
              u32                        configure_vlan_while_not_filtering:1; /*    20: 3  4 */
              u32                        untag_bridge_pvid:1;  /*    20: 4  4 */
              u32                        assisted_learning_on_cpu_port:1; /*    20: 5  4 */
              u32                        vlan_filtering:1;     /*    20: 6  4 */
              u32                        pcs_poll:1;           /*    20: 7  4 */
              u32                        mtu_enforcement_ingress:1; /*    20: 8  4 */
      
              /* XXX 23 bits hole, try to pack */
      
              struct notifier_block      nb;                   /*    24    24 */
      
              /* XXX last struct has 4 bytes of padding */
      
              void *                     priv;                 /*    48     8 */
              void *                     tagger_data;          /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              struct dsa_chip_data *     cd;                   /*    64     8 */
              const struct dsa_switch_ops  * ops;              /*    72     8 */
              u32                        phys_mii_mask;        /*    80     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct mii_bus *           slave_mii_bus;        /*    88     8 */
              unsigned int               ageing_time_min;      /*    96     4 */
              unsigned int               ageing_time_max;      /*   100     4 */
              struct dsa_8021q_context * tag_8021q_ctx;        /*   104     8 */
              struct devlink *           devlink;              /*   112     8 */
              unsigned int               num_tx_queues;        /*   120     4 */
              unsigned int               num_lag_ids;          /*   124     4 */
              /* --- cacheline 2 boundary (128 bytes) --- */
              unsigned int               max_num_bridges;      /*   128     4 */
              unsigned int               num_ports;            /*   132     4 */
      
              /* size: 136, cachelines: 3, members: 27 */
              /* sum members: 128, holes: 1, sum holes: 4 */
              /* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 23 bits */
              /* paddings: 1, sum paddings: 4 */
              /* last cacheline: 8 bytes */
      };
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      258030ac
    • Vladimir Oltean's avatar
      net: dsa: merge all bools of struct dsa_switch into a single u32 · 7787ff77
      Vladimir Oltean authored
      struct dsa_switch has 9 boolean properties, many of which are in fact
      set by drivers for custom behavior (vlan_filtering_is_global,
      needs_standalone_vlan_filtering, etc etc). The binary layout of the
      structure could be improved. For example, the "bool setup" at the
      beginning introduces a gratuitous 7 byte hole in the first cache line.
      
      The change merges all boolean properties into bitfields of an u32, and
      places that u32 in the first cache line of the structure, since many
      bools are accessed from the data path (untag_bridge_pvid, vlan_filtering,
      vlan_filtering_is_global).
      
      We place this u32 after the existing ds->index, which is also 4 bytes in
      size. As a positive side effect, ds->tagger_data now fits into the first
      cache line too, because 4 bytes are saved.
      
      Before:
      
      pahole -C dsa_switch net/dsa/slave.o
      struct dsa_switch {
              bool                       setup;                /*     0     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              struct device *            dev;                  /*     8     8 */
              struct dsa_switch_tree *   dst;                  /*    16     8 */
              unsigned int               index;                /*    24     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct notifier_block      nb;                   /*    32    24 */
      
              /* XXX last struct has 4 bytes of padding */
      
              void *                     priv;                 /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              void *                     tagger_data;          /*    64     8 */
              struct dsa_chip_data *     cd;                   /*    72     8 */
              const struct dsa_switch_ops  * ops;              /*    80     8 */
              u32                        phys_mii_mask;        /*    88     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct mii_bus *           slave_mii_bus;        /*    96     8 */
              unsigned int               ageing_time_min;      /*   104     4 */
              unsigned int               ageing_time_max;      /*   108     4 */
              struct dsa_8021q_context * tag_8021q_ctx;        /*   112     8 */
              struct devlink *           devlink;              /*   120     8 */
              /* --- cacheline 2 boundary (128 bytes) --- */
              unsigned int               num_tx_queues;        /*   128     4 */
              bool                       vlan_filtering_is_global; /*   132     1 */
              bool                       needs_standalone_vlan_filtering; /*   133     1 */
              bool                       configure_vlan_while_not_filtering; /*   134     1 */
              bool                       untag_bridge_pvid;    /*   135     1 */
              bool                       assisted_learning_on_cpu_port; /*   136     1 */
              bool                       vlan_filtering;       /*   137     1 */
              bool                       pcs_poll;             /*   138     1 */
              bool                       mtu_enforcement_ingress; /*   139     1 */
              unsigned int               num_lag_ids;          /*   140     4 */
              unsigned int               max_num_bridges;      /*   144     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              size_t                     num_ports;            /*   152     8 */
      
              /* size: 160, cachelines: 3, members: 27 */
              /* sum members: 141, holes: 4, sum holes: 19 */
              /* paddings: 1, sum paddings: 4 */
              /* last cacheline: 32 bytes */
      };
      
      After:
      
      pahole -C dsa_switch net/dsa/slave.o
      struct dsa_switch {
              struct device *            dev;                  /*     0     8 */
              struct dsa_switch_tree *   dst;                  /*     8     8 */
              unsigned int               index;                /*    16     4 */
              u32                        setup:1;              /*    20: 0  4 */
              u32                        vlan_filtering_is_global:1; /*    20: 1  4 */
              u32                        needs_standalone_vlan_filtering:1; /*    20: 2  4 */
              u32                        configure_vlan_while_not_filtering:1; /*    20: 3  4 */
              u32                        untag_bridge_pvid:1;  /*    20: 4  4 */
              u32                        assisted_learning_on_cpu_port:1; /*    20: 5  4 */
              u32                        vlan_filtering:1;     /*    20: 6  4 */
              u32                        pcs_poll:1;           /*    20: 7  4 */
              u32                        mtu_enforcement_ingress:1; /*    20: 8  4 */
      
              /* XXX 23 bits hole, try to pack */
      
              struct notifier_block      nb;                   /*    24    24 */
      
              /* XXX last struct has 4 bytes of padding */
      
              void *                     priv;                 /*    48     8 */
              void *                     tagger_data;          /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              struct dsa_chip_data *     cd;                   /*    64     8 */
              const struct dsa_switch_ops  * ops;              /*    72     8 */
              u32                        phys_mii_mask;        /*    80     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct mii_bus *           slave_mii_bus;        /*    88     8 */
              unsigned int               ageing_time_min;      /*    96     4 */
              unsigned int               ageing_time_max;      /*   100     4 */
              struct dsa_8021q_context * tag_8021q_ctx;        /*   104     8 */
              struct devlink *           devlink;              /*   112     8 */
              unsigned int               num_tx_queues;        /*   120     4 */
              unsigned int               num_lag_ids;          /*   124     4 */
              /* --- cacheline 2 boundary (128 bytes) --- */
              unsigned int               max_num_bridges;      /*   128     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              size_t                     num_ports;            /*   136     8 */
      
              /* size: 144, cachelines: 3, members: 27 */
              /* sum members: 132, holes: 2, sum holes: 8 */
              /* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 23 bits */
              /* paddings: 1, sum paddings: 4 */
              /* last cacheline: 16 bytes */
      };
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7787ff77
    • Vladimir Oltean's avatar
      net: dsa: move dsa_port :: type near dsa_port :: index · 06251258
      Vladimir Oltean authored
      Both dsa_port :: type and dsa_port :: index introduce a 4 octet hole
      after them, so we can group them together and the holes would be
      eliminated, turning 16 octets of storage into just 8. This makes the
      cpu_dp pointer fit in the first cache line, which is good, because
      dsa_slave_to_master(), called by dsa_enqueue_skb(), uses it.
      
      Before:
      
      pahole -C dsa_port net/dsa/slave.o
      struct dsa_port {
              union {
                      struct net_device * master;              /*     0     8 */
                      struct net_device * slave;               /*     0     8 */
              };                                               /*     0     8 */
              const struct dsa_device_ops  * tag_ops;          /*     8     8 */
              struct dsa_switch_tree *   dst;                  /*    16     8 */
              struct sk_buff *           (*rcv)(struct sk_buff *, struct net_device *); /*    24     8 */
              enum {
                      DSA_PORT_TYPE_UNUSED = 0,
                      DSA_PORT_TYPE_CPU    = 1,
                      DSA_PORT_TYPE_DSA    = 2,
                      DSA_PORT_TYPE_USER   = 3,
              } type;                                          /*    32     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_switch *        ds;                   /*    40     8 */
              unsigned int               index;                /*    48     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              const char  *              name;                 /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              struct dsa_port *          cpu_dp;               /*    64     8 */
              u8                         mac[6];               /*    72     6 */
              u8                         stp_state;            /*    78     1 */
              u8                         vlan_filtering:1;     /*    79: 0  1 */
              u8                         learning:1;           /*    79: 1  1 */
              u8                         lag_tx_enabled:1;     /*    79: 2  1 */
              u8                         devlink_port_setup:1; /*    79: 3  1 */
              u8                         setup:1;              /*    79: 4  1 */
      
              /* XXX 3 bits hole, try to pack */
      
              struct device_node *       dn;                   /*    80     8 */
              unsigned int               ageing_time;          /*    88     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_bridge *        bridge;               /*    96     8 */
              struct devlink_port        devlink_port;         /*   104   288 */
              /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */
              struct phylink *           pl;                   /*   392     8 */
              struct phylink_config      pl_config;            /*   400    40 */
              struct net_device *        lag_dev;              /*   440     8 */
              /* --- cacheline 7 boundary (448 bytes) --- */
              struct net_device *        hsr_dev;              /*   448     8 */
              struct list_head           list;                 /*   456    16 */
              const struct ethtool_ops  * orig_ethtool_ops;    /*   472     8 */
              const struct dsa_netdevice_ops  * netdev_ops;    /*   480     8 */
              struct mutex               addr_lists_lock;      /*   488    32 */
              /* --- cacheline 8 boundary (512 bytes) was 8 bytes ago --- */
              struct list_head           fdbs;                 /*   520    16 */
              struct list_head           mdbs;                 /*   536    16 */
      
              /* size: 552, cachelines: 9, members: 30 */
              /* sum members: 539, holes: 3, sum holes: 12 */
              /* sum bitfield members: 5 bits, bit holes: 1, sum bit holes: 3 bits */
              /* last cacheline: 40 bytes */
      };
      
      After:
      
      pahole -C dsa_port net/dsa/slave.o
      struct dsa_port {
              union {
                      struct net_device * master;              /*     0     8 */
                      struct net_device * slave;               /*     0     8 */
              };                                               /*     0     8 */
              const struct dsa_device_ops  * tag_ops;          /*     8     8 */
              struct dsa_switch_tree *   dst;                  /*    16     8 */
              struct sk_buff *           (*rcv)(struct sk_buff *, struct net_device *); /*    24     8 */
              struct dsa_switch *        ds;                   /*    32     8 */
              unsigned int               index;                /*    40     4 */
              enum {
                      DSA_PORT_TYPE_UNUSED = 0,
                      DSA_PORT_TYPE_CPU    = 1,
                      DSA_PORT_TYPE_DSA    = 2,
                      DSA_PORT_TYPE_USER   = 3,
              } type;                                          /*    44     4 */
              const char  *              name;                 /*    48     8 */
              struct dsa_port *          cpu_dp;               /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              u8                         mac[6];               /*    64     6 */
              u8                         stp_state;            /*    70     1 */
              u8                         vlan_filtering:1;     /*    71: 0  1 */
              u8                         learning:1;           /*    71: 1  1 */
              u8                         lag_tx_enabled:1;     /*    71: 2  1 */
              u8                         devlink_port_setup:1; /*    71: 3  1 */
              u8                         setup:1;              /*    71: 4  1 */
      
              /* XXX 3 bits hole, try to pack */
      
              struct device_node *       dn;                   /*    72     8 */
              unsigned int               ageing_time;          /*    80     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_bridge *        bridge;               /*    88     8 */
              struct devlink_port        devlink_port;         /*    96   288 */
              /* --- cacheline 6 boundary (384 bytes) --- */
              struct phylink *           pl;                   /*   384     8 */
              struct phylink_config      pl_config;            /*   392    40 */
              struct net_device *        lag_dev;              /*   432     8 */
              struct net_device *        hsr_dev;              /*   440     8 */
              /* --- cacheline 7 boundary (448 bytes) --- */
              struct list_head           list;                 /*   448    16 */
              const struct ethtool_ops  * orig_ethtool_ops;    /*   464     8 */
              const struct dsa_netdevice_ops  * netdev_ops;    /*   472     8 */
              struct mutex               addr_lists_lock;      /*   480    32 */
              /* --- cacheline 8 boundary (512 bytes) --- */
              struct list_head           fdbs;                 /*   512    16 */
              struct list_head           mdbs;                 /*   528    16 */
      
              /* size: 544, cachelines: 9, members: 30 */
              /* sum members: 539, holes: 1, sum holes: 4 */
              /* sum bitfield members: 5 bits, bit holes: 1, sum bit holes: 3 bits */
              /* last cacheline: 32 bytes */
      };
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      06251258
    • Vladimir Oltean's avatar
      net: dsa: merge all bools of struct dsa_port into a single u8 · bde82f38
      Vladimir Oltean authored
      struct dsa_port has 5 bool members which create quite a number of 7 byte
      holes in the structure layout. By merging them all into bitfields of an
      u8, and placing that u8 in the 1-byte hole after dp->mac and dp->stp_state,
      we can reduce the structure size from 576 bytes to 552 bytes on arm64.
      
      Before:
      
      pahole -C dsa_port net/dsa/slave.o
      struct dsa_port {
              union {
                      struct net_device * master;              /*     0     8 */
                      struct net_device * slave;               /*     0     8 */
              };                                               /*     0     8 */
              const struct dsa_device_ops  * tag_ops;          /*     8     8 */
              struct dsa_switch_tree *   dst;                  /*    16     8 */
              struct sk_buff *           (*rcv)(struct sk_buff *, struct net_device *); /*    24     8 */
              enum {
                      DSA_PORT_TYPE_UNUSED = 0,
                      DSA_PORT_TYPE_CPU    = 1,
                      DSA_PORT_TYPE_DSA    = 2,
                      DSA_PORT_TYPE_USER   = 3,
              } type;                                          /*    32     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_switch *        ds;                   /*    40     8 */
              unsigned int               index;                /*    48     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              const char  *              name;                 /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              struct dsa_port *          cpu_dp;               /*    64     8 */
              u8                         mac[6];               /*    72     6 */
              u8                         stp_state;            /*    78     1 */
      
              /* XXX 1 byte hole, try to pack */
      
              struct device_node *       dn;                   /*    80     8 */
              unsigned int               ageing_time;          /*    88     4 */
              bool                       vlan_filtering;       /*    92     1 */
              bool                       learning;             /*    93     1 */
      
              /* XXX 2 bytes hole, try to pack */
      
              struct dsa_bridge *        bridge;               /*    96     8 */
              struct devlink_port        devlink_port;         /*   104   288 */
              /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */
              bool                       devlink_port_setup;   /*   392     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              struct phylink *           pl;                   /*   400     8 */
              struct phylink_config      pl_config;            /*   408    40 */
              /* --- cacheline 7 boundary (448 bytes) --- */
              struct net_device *        lag_dev;              /*   448     8 */
              bool                       lag_tx_enabled;       /*   456     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              struct net_device *        hsr_dev;              /*   464     8 */
              struct list_head           list;                 /*   472    16 */
              const struct ethtool_ops  * orig_ethtool_ops;    /*   488     8 */
              const struct dsa_netdevice_ops  * netdev_ops;    /*   496     8 */
              struct mutex               addr_lists_lock;      /*   504    32 */
              /* --- cacheline 8 boundary (512 bytes) was 24 bytes ago --- */
              struct list_head           fdbs;                 /*   536    16 */
              struct list_head           mdbs;                 /*   552    16 */
              bool                       setup;                /*   568     1 */
      
              /* size: 576, cachelines: 9, members: 30 */
              /* sum members: 544, holes: 6, sum holes: 25 */
              /* padding: 7 */
      };
      
      After:
      
      pahole -C dsa_port net/dsa/slave.o
      struct dsa_port {
              union {
                      struct net_device * master;              /*     0     8 */
                      struct net_device * slave;               /*     0     8 */
              };                                               /*     0     8 */
              const struct dsa_device_ops  * tag_ops;          /*     8     8 */
              struct dsa_switch_tree *   dst;                  /*    16     8 */
              struct sk_buff *           (*rcv)(struct sk_buff *, struct net_device *); /*    24     8 */
              enum {
                      DSA_PORT_TYPE_UNUSED = 0,
                      DSA_PORT_TYPE_CPU    = 1,
                      DSA_PORT_TYPE_DSA    = 2,
                      DSA_PORT_TYPE_USER   = 3,
              } type;                                          /*    32     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_switch *        ds;                   /*    40     8 */
              unsigned int               index;                /*    48     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              const char  *              name;                 /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              struct dsa_port *          cpu_dp;               /*    64     8 */
              u8                         mac[6];               /*    72     6 */
              u8                         stp_state;            /*    78     1 */
              u8                         vlan_filtering:1;     /*    79: 0  1 */
              u8                         learning:1;           /*    79: 1  1 */
              u8                         lag_tx_enabled:1;     /*    79: 2  1 */
              u8                         devlink_port_setup:1; /*    79: 3  1 */
              u8                         setup:1;              /*    79: 4  1 */
      
              /* XXX 3 bits hole, try to pack */
      
              struct device_node *       dn;                   /*    80     8 */
              unsigned int               ageing_time;          /*    88     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_bridge *        bridge;               /*    96     8 */
              struct devlink_port        devlink_port;         /*   104   288 */
              /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */
              struct phylink *           pl;                   /*   392     8 */
              struct phylink_config      pl_config;            /*   400    40 */
              struct net_device *        lag_dev;              /*   440     8 */
              /* --- cacheline 7 boundary (448 bytes) --- */
              struct net_device *        hsr_dev;              /*   448     8 */
              struct list_head           list;                 /*   456    16 */
              const struct ethtool_ops  * orig_ethtool_ops;    /*   472     8 */
              const struct dsa_netdevice_ops  * netdev_ops;    /*   480     8 */
              struct mutex               addr_lists_lock;      /*   488    32 */
              /* --- cacheline 8 boundary (512 bytes) was 8 bytes ago --- */
              struct list_head           fdbs;                 /*   520    16 */
              struct list_head           mdbs;                 /*   536    16 */
      
              /* size: 552, cachelines: 9, members: 30 */
              /* sum members: 539, holes: 3, sum holes: 12 */
              /* sum bitfield members: 5 bits, bit holes: 1, sum bit holes: 3 bits */
              /* last cacheline: 40 bytes */
      };
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bde82f38
    • Vladimir Oltean's avatar
      net: dsa: move dsa_port :: stp_state near dsa_port :: mac · b08db33d
      Vladimir Oltean authored
      The MAC address of a port is 6 octets in size, and this creates a 2
      octet hole after it. There are some other u8 members of struct dsa_port
      that we can put in that hole. One such member is the stp_state.
      
      Before:
      
      pahole -C dsa_port net/dsa/slave.o
      struct dsa_port {
              union {
                      struct net_device * master;              /*     0     8 */
                      struct net_device * slave;               /*     0     8 */
              };                                               /*     0     8 */
              const struct dsa_device_ops  * tag_ops;          /*     8     8 */
              struct dsa_switch_tree *   dst;                  /*    16     8 */
              struct sk_buff *           (*rcv)(struct sk_buff *, struct net_device *); /*    24     8 */
              enum {
                      DSA_PORT_TYPE_UNUSED = 0,
                      DSA_PORT_TYPE_CPU    = 1,
                      DSA_PORT_TYPE_DSA    = 2,
                      DSA_PORT_TYPE_USER   = 3,
              } type;                                          /*    32     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_switch *        ds;                   /*    40     8 */
              unsigned int               index;                /*    48     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              const char  *              name;                 /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              struct dsa_port *          cpu_dp;               /*    64     8 */
              u8                         mac[6];               /*    72     6 */
      
              /* XXX 2 bytes hole, try to pack */
      
              struct device_node *       dn;                   /*    80     8 */
              unsigned int               ageing_time;          /*    88     4 */
              bool                       vlan_filtering;       /*    92     1 */
              bool                       learning;             /*    93     1 */
              u8                         stp_state;            /*    94     1 */
      
              /* XXX 1 byte hole, try to pack */
      
              struct dsa_bridge *        bridge;               /*    96     8 */
              struct devlink_port        devlink_port;         /*   104   288 */
              /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */
              bool                       devlink_port_setup;   /*   392     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              struct phylink *           pl;                   /*   400     8 */
              struct phylink_config      pl_config;            /*   408    40 */
              /* --- cacheline 7 boundary (448 bytes) --- */
              struct net_device *        lag_dev;              /*   448     8 */
              bool                       lag_tx_enabled;       /*   456     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              struct net_device *        hsr_dev;              /*   464     8 */
              struct list_head           list;                 /*   472    16 */
              const struct ethtool_ops  * orig_ethtool_ops;    /*   488     8 */
              const struct dsa_netdevice_ops  * netdev_ops;    /*   496     8 */
              struct mutex               addr_lists_lock;      /*   504    32 */
              /* --- cacheline 8 boundary (512 bytes) was 24 bytes ago --- */
              struct list_head           fdbs;                 /*   536    16 */
              struct list_head           mdbs;                 /*   552    16 */
              bool                       setup;                /*   568     1 */
      
              /* size: 576, cachelines: 9, members: 30 */
              /* sum members: 544, holes: 6, sum holes: 25 */
              /* padding: 7 */
      };
      
      After:
      
      pahole -C dsa_port net/dsa/slave.o
      struct dsa_port {
              union {
                      struct net_device * master;              /*     0     8 */
                      struct net_device * slave;               /*     0     8 */
              };                                               /*     0     8 */
              const struct dsa_device_ops  * tag_ops;          /*     8     8 */
              struct dsa_switch_tree *   dst;                  /*    16     8 */
              struct sk_buff *           (*rcv)(struct sk_buff *, struct net_device *); /*    24     8 */
              enum {
                      DSA_PORT_TYPE_UNUSED = 0,
                      DSA_PORT_TYPE_CPU    = 1,
                      DSA_PORT_TYPE_DSA    = 2,
                      DSA_PORT_TYPE_USER   = 3,
              } type;                                          /*    32     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct dsa_switch *        ds;                   /*    40     8 */
              unsigned int               index;                /*    48     4 */
      
              /* XXX 4 bytes hole, try to pack */
      
              const char  *              name;                 /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              struct dsa_port *          cpu_dp;               /*    64     8 */
              u8                         mac[6];               /*    72     6 */
              u8                         stp_state;            /*    78     1 */
      
              /* XXX 1 byte hole, try to pack */
      
              struct device_node *       dn;                   /*    80     8 */
              unsigned int               ageing_time;          /*    88     4 */
              bool                       vlan_filtering;       /*    92     1 */
              bool                       learning;             /*    93     1 */
      
              /* XXX 2 bytes hole, try to pack */
      
              struct dsa_bridge *        bridge;               /*    96     8 */
              struct devlink_port        devlink_port;         /*   104   288 */
              /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */
              bool                       devlink_port_setup;   /*   392     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              struct phylink *           pl;                   /*   400     8 */
              struct phylink_config      pl_config;            /*   408    40 */
              /* --- cacheline 7 boundary (448 bytes) --- */
              struct net_device *        lag_dev;              /*   448     8 */
              bool                       lag_tx_enabled;       /*   456     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              struct net_device *        hsr_dev;              /*   464     8 */
              struct list_head           list;                 /*   472    16 */
              const struct ethtool_ops  * orig_ethtool_ops;    /*   488     8 */
              const struct dsa_netdevice_ops  * netdev_ops;    /*   496     8 */
              struct mutex               addr_lists_lock;      /*   504    32 */
              /* --- cacheline 8 boundary (512 bytes) was 24 bytes ago --- */
              struct list_head           fdbs;                 /*   536    16 */
              struct list_head           mdbs;                 /*   552    16 */
              bool                       setup;                /*   568     1 */
      
              /* size: 576, cachelines: 9, members: 30 */
              /* sum members: 544, holes: 6, sum holes: 25 */
              /* padding: 7 */
      };
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b08db33d
    • David S. Miller's avatar
      Merge branch 'hns3-stats-refactor' · 5be9963d
      David S. Miller authored
      Jie Wang says:
      
      ====================
      net: hns3: refactor rss/tqp stats functions
      
      Currently, hns3 PF and VF module have two sets of rss and tqp stats APIs
      to provide get and set functions. Most of these APIs are the same. There is
      no need to keep these two sets of same functions for double development and
      bugfix work.
      
      This series refactor the rss and tqp stats APIs in hns3 PF and VF by
      implementing one set of common APIs for PF and VF reuse and deleting the
      old APIs.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5be9963d
    • Jie Wang's avatar
      net: hns3: create new common cmd code for PF and VF modules · 43710bfe
      Jie Wang authored
      Currently PF and VF use two sets of command code for modules to interact
      with firmware. These codes values are same espect the macro names. It is
      redundent to keep two sets of command code for same functions between PF
      and VF.
      
      So this patch firstly creates a unified command code for PF and VF module.
      We keep the macro name same with the PF command code name to avoid too many
      meaningless modifications. Secondly the new common command codes are used
      to replace the old ones in VF and deletes the old ones.
      Signed-off-by: default avatarJie Wang <wangjie125@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      43710bfe
    • Jie Wang's avatar
      net: hns3: refactor VF tqp stats APIs with new common tqp stats APIs · 4afc310c
      Jie Wang authored
      This patch firstly uses new tqp struct(hclge_comm_tqp) and removes the
      old VF tqp struct(hclgevf_tqp). All the tqp stats members used in VF module
      are modified according to the new hclge_comm_tqp.
      
      Secondly VF tqp stats APIs are refactored to use new common tqp stats APIs.
      The old tqp stats APIs in VF are deleted.
      Signed-off-by: default avatarJie Wang <wangjie125@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4afc310c
    • Jie Wang's avatar
      net: hns3: refactor PF tqp stats APIs with new common tqp stats APIs · add7645c
      Jie Wang authored
      This patch firstly uses new tqp struct(hclge_comm_tqp) and deletes the
      old PF tqp struct(hclge_tqp). All the tqp stats members used in PF module
      are modified according to the new hclge_comm_tqp.
      
      Secondly PF tqp stats APIs are refactored to use new common tqp stats APIs.
      The old tqp stats APIs in PF are deleted.
      Signed-off-by: default avatarJie Wang <wangjie125@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      add7645c