1. 03 May, 2016 6 commits
    • Florian Westphal's avatar
      netdevice: shrink size of struct netdev_queue · c0ef079c
      Florian Westphal authored
      - trans_timeout is incremented when tx queue timed out (tx watchdog).
      - tx_maxrate is set via sysfs
      
      Moving tx_maxrate to read-mostly part shrinks the struct by 64 bytes.
      While at it, also move trans_timeout (it is out-of-place in the
      'write-mostly' part).
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c0ef079c
    • David S. Miller's avatar
      Merge branch 'bridge-per-vlan-stats' · e8194d4f
      David S. Miller authored
      Nikolay Aleksandrov says:
      
      ====================
      bridge: per-vlan stats
      
      This set adds support for bridge per-vlan statistics.
      In order to be able to dump statistics for many vlans we need a way to
      continue dumping after reaching maximum size, thus patches 01 and 02 extend
      the new stats API with a per-device extended link stats attribute and
      callback which can save its local state and continue where it left off
      afterwards. I considered using the already existing "fill_xstats" callback
      but it gets confusing since we need to separate the linkinfo dump from the
      new stats api dump and adding a flag/argument to do that just looks messy.
      I don't think the rtnl_link_ops size is an issue, so adding these seemed
      like the cleaner approach.
      
      Patches 03 and 04 add the stats support and netlink dump support
      respectively. The stats accounting is controlled via a bridge option which
      is default off, thus the performance impact is kept minimal.
      I've tested this set with both old and modified iproute2, kmemleak on and
      some traffic stress tests while adding/removing vlans and ports.
      
      v3:
       - drop the RCU pvid patch and remove one pointer fetch as requested
       - make stats accounting optional with default to off, the option is in the
         same cache line as vlan_proto and vlan_enabled, so it is already fetched
         before the fast path check thus the performance impact is minimal, this
         also allows us to avoid one vlan lookup and return early when using pvid
       - rebased and retested
      
      v2:
       - Improve the error checking, rename lidx to prividx and save the current
         idx user instead of restricting it to one in patch 01
       - squash patch 02 into 01 and remove the restriction
       - add callback descriptions, improve the size calculation and change the
         xstats message structure to have an embedding level per rtnl link type
         so we can avoid one call to get the link type (and thus filter on it)
         and also each link type can now have any number of private attributes
         inside
       - fix a problem where the vlan stats are not dumped if the bridge has 0
         vlans on it but has vlans on the ports, add bridge link type private
         attributes and also add paddings for future extensions to avoid at least
         a few netlink attributes and improve struct alignment
       - drop the is_skb_forwardable argument constifying patch as it's not
         needed anymore, but it's a nice cleanup which I'll send separately
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8194d4f
    • Nikolay Aleksandrov's avatar
      bridge: netlink: export per-vlan stats · a60c0903
      Nikolay Aleksandrov authored
      Add a new LINK_XSTATS_TYPE_BRIDGE attribute and implement the
      RTM_GETSTATS callbacks for IFLA_STATS_LINK_XSTATS (fill_linkxstats and
      get_linkxstats_size) in order to export the per-vlan stats.
      The paddings were added because soon these fields will be needed for
      per-port per-vlan stats (or something else if someone beats me to it) so
      avoiding at least a few more netlink attributes.
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a60c0903
    • Nikolay Aleksandrov's avatar
      bridge: vlan: learn to count · 6dada9b1
      Nikolay Aleksandrov authored
      Add support for per-VLAN Tx/Rx statistics. Every global vlan context gets
      allocated a per-cpu stats which is then set in each per-port vlan context
      for quick access. The br_allowed_ingress() common function is used to
      account for Rx packets and the br_handle_vlan() common function is used
      to account for Tx packets. Stats accounting is performed only if the
      bridge-wide vlan_stats_enabled option is set either via sysfs or netlink.
      A struct hole between vlan_enabled and vlan_proto is used for the new
      option so it is in the same cache line. Currently it is binary (on/off)
      but it is intentionally restricted to exactly 0 and 1 since other values
      will be used in the future for different purposes (e.g. per-port stats).
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6dada9b1
    • Nikolay Aleksandrov's avatar
      net: rtnetlink: add linkxstats callbacks and attribute · 97a47fac
      Nikolay Aleksandrov authored
      Add callbacks to calculate the size and fill link extended statistics
      which can be split into multiple messages and are dumped via the new
      rtnl stats API (RTM_GETSTATS) with the IFLA_STATS_LINK_XSTATS attribute.
      Also add that attribute to the idx mask check since it is expected to
      be able to save state and resume dumping (e.g. future bridge per-vlan
      stats will be dumped via this attribute and callbacks).
      Each link type should nest its private attributes under the per-link type
      attribute. This allows to have any number of separated private attributes
      and to avoid one call to get the dev link type.
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      97a47fac
    • Nikolay Aleksandrov's avatar
      net: rtnetlink: allow rtnl_fill_statsinfo to save private state counter · e8872a25
      Nikolay Aleksandrov authored
      The new prividx argument allows the current dumping device to save a
      private state counter which would enable it to continue dumping from
      where it left off. And the idxattr is used to save the current idx user
      so multiple prividx using attributes can be requested at the same time
      as suggested by Roopa Prabhu.
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8872a25
  2. 02 May, 2016 34 commits