Skip to content
  1. Aug 02, 2017
  2. Aug 01, 2017
  3. Jul 31, 2017
    • David S. Miller's avatar
      Merge branch 'net-sched-actions-improve-dump-performance' · 764646b0
      David S. Miller authored
      
      
      Jamal Hadi Salim says:
      
      ====================
      net sched actions: improve dump performance
      
      Changes since v11:
      ------------------
      1) Jiri - renames: nla_value to value and nla_selector to selector
      2) Jiri - rename: validate_nla_bitfield_32 to validate_nla_bitfield_32
      3) Jiri - rename: NLA_BITFIELD_32 to NLA_BITFIELD32
      4) Jiri - remove unnecessary break when we return in case statement
      5) Jiri - rename and move nla_get_bitfield_32 to an earlier patch
      6) Jiri - xmas tree alignment of var declaration
      7) Jiri - rename all declarations of bitfield 32 vars to be consistent ("bf")
      8) Jiri - improve validate_nla_bitfield32() validation to disallow valid
                bit values that are not selected by the selector
      
      Changes since v10:
      -----------------
      1) Jiri: move type->validate_content() to its own patch
      Jamal: decided to remove it altogether so we can get this patch set in.
      
      2) Change name of NLA_FLAG_BITS to NLA_BITFIELD_32 based on discussions
      with D. Ahern and Jiri. D. Ahern suggests to make this a variable bitmap size.
      My analysis at this point is it too complex and i only need a few bit
      flags. If we run out of bits someone else can create a new NLA_BITFIELD_XXX
      and start using that. So please let this go.
      
      3) Jamal - Add Suggested-by: Jiri for type NLA_BITFIELD_32
      
      4) Jiri: Change name allowed_flags to tcaa_root_flags_allowed
      
      5) Jiri: Introduce nla_get_flag_bits_values() helper instead of using
      memcpy for retrieving nla_bitfield_32 fields.
      
      Changes since v9:
      -----------------
      
      1) General consensus:
      - remove again the use of BIT() to maintain uapi consistency ;->
      
      1) Jiri:
      - Add a new netlink type NLA_FLAG_BITS to check for valid bits
        and use it instead of inline vetting (patch 4/4 now)
      
      Changes since v8:
      -----------------
      
      1) Jiri:
      - Add back the use of BIT(). Eventually fix iproute2 instead
      - Rename VALID_TCA_FLAGS to VALID_TCA_ROOT_FLAGS
      
      Changes since v7:
      -----------------
      
      Jamal:
      No changes.
      Patch 1 went out twice. Resend without two copies of patch 1
      
      changes since v6:
      -----------------
      
      1) DaveM:
      New rules for netlink messages. From now on we are going to start
      checking for bits that are not used and rejecting anything we dont
      understand. In the future this is going to require major changes
      to user space code (tc etc). This is just a start.
      
      To quote, David:
      "
       Again, bits you aren't using now, make sure userspace doesn't
         set them.  And if it does, reject.
      "
      Added checks for ensuring things work as above.
      
      2) Jiri:
      a)Fix the commit message to properly use "Fixes" description
      b)Align assignments for nla_policy
      
      Changes since v5:
      ----------------
      
      0)
      Remove use of BIT() because it is kernel specific. Requires a separate
      patch (Jiri can submit that in his cleanups)
      
      1)To paraphrase Eric D.
      
      "memcpy(nla_data(count_attr), &cb->args[1], sizeof(u32));
      wont work on 64bit BE machines because cb->args[1]
      (which is 64 bit is larger in size than sizeof(u32))"
      
      Fixed
      
      2) Jiri Pirko
      
      i) Spotted a bug fix mixed in the patch for wrong TLV
      fix. Add patch 1/3 to address this. Make part of this
      series because of dependencies.
      
      ii) Rename ACT_LARGE_DUMP_ON -> TCA_FLAG_LARGE_DUMP_ON
      
      iii) Satisfy Jiri's obsession against the noun "tcaa"
      a)Rename struct nlattr *tcaa --> struct nlattr *tb
      b)Rename TCAA_ACT_XXX -> TCA_ROOT_XXX
      
      Changes since v4:
      -----------------
      
      1) Eric D.
      
      pointed out that when all skb space is used up by the dump
      there will be no space to insert the TCAA_ACT_COUNT attribute.
      
      2) Jiri:
      
      i) Change:
      
      enum {
              TCAA_UNSPEC,
              TCAA_ACT_TAB,
              TCAA_ACT_FLAGS,
              TCAA_ACT_COUNT,
              TCAA_ACT_TIME_FILTER,
              __TCAA_MAX
      };
      
      to:
      enum {
             TCAA_UNSPEC,
             TCAA_ACT_TAB,
             TCAA_ACT_FLAGS,
             TCAA_ACT_COUNT,
             __TCAA_MAX,
      };
      
      Jiri plans to followup with the rest of the code to make the
      style consistent.
      
      ii) Rename attribute TCAA_ACT_TIME_FILTER --> TCAA_ACT_TIME_DELTA
      
      iii) Rename variable jiffy_filter --> jiffy_since
      iv) Rename msecs_filter --> msecs_since
      v) get rid of unused cb->args[0] and rename cb->args[4] to cb->args[0]
      
      Earlier Changes
      ----------------
      - Jiri mostly on names of things.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      764646b0
    • Jamal Hadi Salim's avatar
      net sched actions: add time filter for action dumping · e62e484d
      Jamal Hadi Salim authored
      
      
      This patch adds support for filtering based on time since last used.
      When we are dumping a large number of actions it is useful to
      have the option of filtering based on when the action was last
      used to reduce the amount of data crossing to user space.
      
      With this patch the user space app sets the TCA_ROOT_TIME_DELTA
      attribute with the value in milliseconds with "time of interest
      since now".  The kernel converts this to jiffies and does the
      filtering comparison matching entries that have seen activity
      since then and returns them to user space.
      Old kernels and old tc continue to work in legacy mode since
      they dont specify this attribute.
      
      Some example (we have 400 actions bound to 400 filters); at
      installation time. Using updated when tc setting the time of
      interest to 120 seconds earlier (we see 400 actions):
      prompt$ hackedtc actions ls action gact since 120000| grep index | wc -l
      400
      
      go get some coffee and wait for > 120 seconds and try again:
      
      prompt$ hackedtc actions ls action gact since 120000 | grep index | wc -l
      0
      
      Lets see a filter bound to one of these actions:
      ....
      filter pref 10 u32
      filter pref 10 u32 fh 800: ht divisor 1
      filter pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:10  (rule hit 2 success 1)
        match 7f000002/ffffffff at 12 (success 1 )
          action order 1: gact action pass
           random type none pass val 0
           index 23 ref 2 bind 1 installed 1145 sec used 802 sec
          Action statistics:
          Sent 84 bytes 1 pkt (dropped 0, overlimits 0 requeues 0)
          backlog 0b 0p requeues 0
      ....
      
      that coffee took long, no? It was good.
      
      Now lets ping -c 1 127.0.0.2, then run the actions again:
      prompt$ hackedtc actions ls action gact since 120 | grep index | wc -l
      1
      
      More details please:
      prompt$ hackedtc -s actions ls action gact since 120000
      
          action order 0: gact action pass
           random type none pass val 0
           index 23 ref 2 bind 1 installed 1270 sec used 30 sec
          Action statistics:
          Sent 168 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
          backlog 0b 0p requeues 0
      
      And the filter?
      
      filter pref 10 u32
      filter pref 10 u32 fh 800: ht divisor 1
      filter pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:10  (rule hit 4 success 2)
        match 7f000002/ffffffff at 12 (success 2 )
          action order 1: gact action pass
           random type none pass val 0
           index 23 ref 2 bind 1 installed 1324 sec used 84 sec
          Action statistics:
          Sent 168 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
          backlog 0b 0p requeues 0
      
      Signed-off-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e62e484d