cxgb4: add TC-MATCHALL classifier egress offload
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Wed, 20 Nov 2019 00:16:06 +0000 (05:46 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Nov 2019 20:05:23 +0000 (12:05 -0800)
commit4ec4762d8ec6edcfe59fd806472d2b7518debe52
tree07289ddff8b84242baa7a42e8d16edea45abb9ce
parent77c05d2f73066e205f786c407964b97d11abb7f4
cxgb4: add TC-MATCHALL classifier egress offload

Add TC-MATCHALL classifier offload with TC-POLICE action applied for
all outgoing traffic on the underlying interface. Split flow block
offload to support both egress and ingress classification.

For example, to rate limit all outgoing traffic to 1 Gbps:

$ tc qdisc add dev enp2s0f4 clsact
$ tc filter add dev enp2s0f4 egress matchall skip_sw \
action police rate 1Gbit burst 8Kbit

Note that skip_sw is important. Otherwise, both stack and hardware
will end up doing policing. Policing can't be shared across flow
blocks. Only 1 egress matchall rule can be active at a time on the
underlying interface.

v5:
- No change.

v4:
- Removed check to reject police offload if prio is not 1.
- Moved TC_SETUP_BLOCK code to separate function.

v3:
- Added check to reject police offload if prio is not 1.
- Assign block_shared variable only for TC_SETUP_BLOCK.

v2:
- Added check to reject flow block sharing for policers.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/Makefile
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_matchall.c [new file with mode: 0644]
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_matchall.h [new file with mode: 0644]
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_mqprio.c
drivers/net/ethernet/chelsio/cxgb4/sched.c
drivers/net/ethernet/chelsio/cxgb4/sched.h
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c