1. 14 Mar, 2016 11 commits
  2. 13 Mar, 2016 6 commits
  3. 11 Mar, 2016 17 commits
  4. 10 Mar, 2016 6 commits
    • David S. Miller's avatar
      Merge branch 'flower-offload' · e8ab563f
      David S. Miller authored
      Amir Vadai says:
      
      ====================
      cls_flower hardware offload support
      
      Please see changes from V2 at the bottom.
      
      This patchset introduces cls_flower hardware offload support over ConnectX-4
      driver, more hardware vendors are welcome to use it too.
      
      This patchset is based on John's infrastructure for tc offloading [2] to add
      hardware offload support to the flower filter. It also extends the support to
      an additional tc action - skbedit mark operation.
      NIC driver that was used is ConnectX-4. Feature is off by default and could be
      turned on using ethtool.
      
      Some commands to use this code:
      
      export TC=../iproute2/tc/tc
      export ETH=ens9
      
      ethtool  -K ens9 hw-tc-offload on
      
      $TC qdisc add dev $ETH ingress
      
      $TC filter add dev $ETH protocol ip prio 20 parent ffff: \
      	flower ip_proto 1 \
      	dst_mac 7c:fe:90:69:81:62 \
      	src_mac 7c:fe:90:69:81:56 \
      	dst_ip 11.11.11.11 \
      	src_ip 11.11.11.12 \
      	indev $ETH \
      	action drop
      
      $TC filter add dev $ETH protocol ip prio 30 parent ffff: \
      	flower ip_proto 6 \
      	indev $ETH \
      	action skbedit mark 0x1234
      
      $TC filter add dev $ETH protocol ip prio 10 parent ffff: \
      	handle 0x1234 fw action pass
      
      The code was tested and applied on top of commit 3ebeac1d ("Merge branch
      'cxgb4-next'")
      
      Changes from V2:
      - patch 1/10 ("net/flower: Introduce hardware offload support")
        - Remove unused variable [Dave]
        - Don't fail command when HW can't offload filter [John]
      - patch 3/10 ("net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef")
        - Mention in changelog that struct tc_action is now exposed out of the ifdef.
      - patch 4/10 ("net/act_skbedit: Utility functions for mark action")
        - Document clearly that is_tcf_skbedit_mark() is returning true if and only
          if the only action is mark [Dave]
      - patch 8/10 ("net/mlx5e: Introduce tc offload support")
        - make mlx5e_tc_add_flow() static
      
      Changes from V1:
      - patch 3/10 ("net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef")
        - fixed return value of tc_no_actions
      
      Changes from V0:
      - Use tc_no_actions and tc_for_each_action instead of ifdef CONFIG_NET_CLS_ACT
      - Replace ENOTSUPP (and some EINVAL) with EOPNOTSUPP
      - Name the flower command enum
      - fl_hw_destroy_filter() to return void - nobody uses the return value
      - mlx5e_tc_init() and mlx5e_tc_cleanup() to be called from the right places.
      - When adding HW rule fails - fail the command
      - Rules are added to be processed both by HW and SW unless SKIP_HW is given
      - Adding patch 6/10 ("net/mlx5e: Relax ndo_setup_tc handle restriction")
      
      Main changes from the RFC [1]:
      - API
        - Using ndo_setup_tc() instead of switchdev
      - act_skbedit, act_gact
        - Actions are not serialized to NIC driver, instead using access functions.
      - cls_flower
        - prevent double classification by software by not adding
          successfuly offloaded filters to the hashtable
        - Fixed some bugs in original RFC with rule delete
      - mlx5
        - Adding flow table to kernel namespace instead of a new namespace
        - s/offload/tc/ in many places
        - no need for a special kconfig since switchdev is not used
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8ab563f
    • Amir Vadai's avatar
      net/mlx5e: Support offload cls_flower with skbedit mark action · 12185a9f
      Amir Vadai authored
      Introduce offloading of skbedit mark action.
      
      For example, to mark with 0x1234, all TCP (ip_proto 6) packets arriving
      to interface ens9:
      
       # tc qdisc add dev ens9 ingress
       # tc filter add dev ens9 protocol ip parent ffff: \
           flower ip_proto 6 \
           indev ens9 \
           action skbedit mark 0x1234
      Signed-off-by: default avatarAmir Vadai <amir@vadai.me>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      12185a9f
    • Amir Vadai's avatar
      net/mlx5e: Support offload cls_flower with drop action · e3a2b7ed
      Amir Vadai authored
      Parse tc_cls_flower_offload into device specific commands and program
      the hardware to classify and act accordingly.
      
      For example, to drop ICMP (ip_proto 1) packets from specific smac, dmac,
      src_ip, src_ip, arriving to interface ens9:
      
       # tc qdisc add dev ens9 ingress
      
       # tc filter add dev ens9 protocol ip parent ffff: \
           flower ip_proto 1 \
           dst_mac 7c:fe:90:69:81:62 src_mac 7c:fe:90:69:81:56 \
           dst_ip 11.11.11.11 src_ip 11.11.11.12 indev ens9 \
           action drop
      Signed-off-by: default avatarAmir Vadai <amir@vadai.me>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e3a2b7ed
    • Amir Vadai's avatar
      net/mlx5e: Introduce tc offload support · e8f887ac
      Amir Vadai authored
      Extend ndo_setup_tc() to support ingress tc offloading. Will be used by
      later patches to offload tc flower filter.
      
      Feature is off by default and could be enabled by issuing:
       # ethtool  -K eth0 hw-tc-offload on
      
      Offloads flow table is dynamically created when first filter is
      added.
      Rules are saved in a hash table that is maintained by the consumer (for
      example - the flower offload in the next patch).
      When last filter is removed and no filters exist in the hash table, the
      offload flow table is destroyed.
      Signed-off-by: default avatarAmir Vadai <amir@vadai.me>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8f887ac
    • Amir Vadai's avatar
      net/mlx5e: Add a new priority for kernel flow tables · b6172aac
      Amir Vadai authored
      Move the vlan and main flow tables to use priority 1. This will allow
      the upcoming TC offload logic to use a higher priority (0) for the
      offload steering table.
      Signed-off-by: default avatarAmir Vadai <amir@vadai.me>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b6172aac
    • Amir Vadai's avatar
      net/mlx5e: Relax ndo_setup_tc handle restriction · 67ba422e
      Amir Vadai authored
      Restricting handle to TC_H_ROOT breaks the old instantiation of mqprio
      to setup a hardware qdisc. This patch relaxes the test, to only check the
      type.
      
      Fixes: 08fb1dac ("net/mlx5e: Support DCBNL IEEE ETS")
      Signed-off-by: default avatarAmir Vadai <amir@vadai.me>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      67ba422e