OSDN Git Service

octeontx2-pf: Add police action for TC flower
authorSubbaraya Sundeep <sbhatta@marvell.com>
Tue, 15 Jun 2021 11:34:31 +0000 (17:04 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Jun 2021 18:11:05 +0000 (11:11 -0700)
commit68fbff68dbea35f9e6f7649dd22fce492a5aedac
treef27d6ebb0988beac33cbf2c4e7e83fb053b011c8
parent5d2fdd86d517350c4fc903a5a69a562a4b0084e4
octeontx2-pf: Add police action for TC flower

Added police action for ingress TC flower
hardware offload. With this rate limiting can be
done per flow. Since rate limiting is tied to
RQs in hardware the number of TC flower filters
with action as police is limited to number
of receive queues of the interface. Both bps
and pps modes are supported.

Examples to rate limit a flow:
$ ethtool -K eth0 hw-tc-offload on
$ tc qdisc add dev eth0 ingress
$ tc filter add dev eth0 parent ffff: protocol ip \
  flower ip_proto udp dst_port 80 action \
  police rate 100Mbit burst 32Kbit

$ tc filter add dev eth0 parent ffff: \
  protocol ip flower dst_mac 5e:b2:34:ee:29:49 \
  action police pkts_rate 5000 pkts_burst 2048

Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c