Tonghao Zhang
38a6f08657
net: sched: support hash selecting tx queue
...
This patch allows users to pick queue_mapping, range
from A to B. Then we can load balance packets from A
to B tx queue. The range is an unsigned 16bit value
in decimal format.
$ tc filter ... action skbedit queue_mapping skbhash A B
"skbedit queue_mapping QUEUE_MAPPING" (from "man 8 tc-skbedit")
is enhanced with flags: SKBEDIT_F_TXQ_SKBHASH
+----+ +----+ +----+
| P1 | | P2 | | Pn |
+----+ +----+ +----+
| | |
+-----------+-----------+
|
| clsact/skbedit
| MQ
v
+-----------+-----------+
| q0 | qn | qm
v v v
HTB/FQ FIFO ... FIFO
For example:
If P1 sends out packets to different Pods on other host, and
we want distribute flows from qn - qm. Then we can use skb->hash
as hash.
setup commands:
$ NETDEV=eth0
$ ip netns add n1
$ ip link add ipv1 link $NETDEV type ipvlan mode l2
$ ip link set ipv1 netns n1
$ ip netns exec n1 ifconfig ipv1 2.2.2.100/24 up
$ tc qdisc add dev $NETDEV clsact
$ tc filter add dev $NETDEV egress protocol ip prio 1 \
flower skip_hw src_ip 2.2.2.100 action skbedit queue_mapping skbhash 2 6
$ tc qdisc add dev $NETDEV handle 1: root mq
$ tc qdisc add dev $NETDEV parent 1:1 handle 2: htb
$ tc class add dev $NETDEV parent 2: classid 2:1 htb rate 100kbit
$ tc class add dev $NETDEV parent 2: classid 2:2 htb rate 200kbit
$ tc qdisc add dev $NETDEV parent 1:2 tbf rate 100mbit burst 100mb latency 1
$ tc qdisc add dev $NETDEV parent 1:3 pfifo
$ tc qdisc add dev $NETDEV parent 1:4 pfifo
$ tc qdisc add dev $NETDEV parent 1:5 pfifo
$ tc qdisc add dev $NETDEV parent 1:6 pfifo
$ tc qdisc add dev $NETDEV parent 1:7 pfifo
$ ip netns exec n1 iperf3 -c 2.2.2.1 -i 1 -t 10 -P 10
pick txqueue from 2 - 6:
$ ethtool -S $NETDEV | grep -i tx_queue_[0-9]_bytes
tx_queue_0_bytes: 42
tx_queue_1_bytes: 0
tx_queue_2_bytes: 11442586444
tx_queue_3_bytes: 7383615334
tx_queue_4_bytes: 3981365579
tx_queue_5_bytes: 3983235051
tx_queue_6_bytes: 6706236461
tx_queue_7_bytes: 42
tx_queue_8_bytes: 0
tx_queue_9_bytes: 0
txqueues 2 - 6 are mapped to classid 1:3 - 1:7
$ tc -s class show dev $NETDEV
...
class mq 1:3 root leaf 8002:
Sent 11949133672 bytes 7929798 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class mq 1:4 root leaf 8003:
Sent 7710449050 bytes 5117279 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class mq 1:5 root leaf 8004:
Sent 4157648675 bytes 2758990 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class mq 1:6 root leaf 8005:
Sent 4159632195 bytes 2759990 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class mq 1:7 root leaf 8006:
Sent 7003169603 bytes 4646912 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
...
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Alexander Lobakin <alobakin@pm.me>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Talal Ahmad <talalahmad@google.com>
Cc: Kevin Hao <haokexin@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Antoine Tenart <atenart@kernel.org>
Cc: Wei Wang <weiwan@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-04-19 12:20:45 +02:00
..
2022-01-10 10:00:09 +09:00
2022-03-24 13:13:26 -07:00
2021-07-01 13:19:48 -07:00
2021-11-19 11:52:25 +00:00
2022-04-08 12:08:58 +02:00
2022-03-19 14:49:08 +00:00
2021-11-17 20:17:05 -08:00
2022-04-12 15:00:25 +02:00
2022-04-19 12:20:45 +02:00
2020-02-28 14:51:30 +01:00
2022-04-08 13:45:43 +01:00
2022-02-18 21:20:06 -08:00
2021-04-23 10:17:26 +01:00
2021-11-26 18:01:58 -08:00
2022-03-11 23:14:19 -08:00
2021-11-01 13:36:09 +00:00
2022-02-21 11:44:30 +00:00
2022-02-03 17:36:16 -08:00
2021-08-03 13:05:25 +01:00
2021-12-13 12:34:09 +00:00
2022-02-15 14:35:18 +00:00
2021-12-03 14:16:48 +00:00
2022-02-21 12:13:45 +00:00
2022-03-11 23:17:24 -08:00
2021-03-26 17:43:55 +01:00
2021-12-03 14:15:49 +00:00
2022-02-16 15:43:25 +01:00
2022-02-01 21:03:48 +01:00
2022-03-11 10:57:22 +00:00
2020-07-15 07:45:24 -07:00
2020-03-27 19:40:38 -07:00
2021-12-22 15:03:47 -08:00
2021-12-22 15:03:51 -08:00
2021-12-22 15:03:51 -08:00
2021-08-05 11:46:42 +01:00
2021-10-13 09:40:46 -07:00
2022-04-18 11:00:18 +01:00
2021-07-30 15:33:24 +02:00
2021-10-13 09:40:46 -07:00
2022-03-17 17:42:47 -07:00
2019-12-16 16:09:44 -08:00
2021-11-29 19:50:45 -08:00
2022-02-09 11:41:47 +00:00
2020-05-08 21:33:33 -07:00
2021-12-06 16:05:10 -08:00
2020-05-05 13:23:29 -07:00
2022-03-07 13:14:03 +01:00
2020-04-20 07:34:16 +02:00
2021-12-06 16:06:02 -08:00
2019-12-24 22:37:30 -08:00
2021-12-16 07:18:35 -08:00
2022-04-08 12:07:37 +01:00
2022-03-16 19:59:36 -07:00
2022-03-15 20:20:02 -07:00
2021-01-21 13:33:45 +01:00
2021-01-21 13:33:45 +01:00
2019-12-09 10:36:44 -08:00
2021-10-18 12:54:41 +01:00
2021-02-12 16:31:46 -08:00
2021-01-29 20:39:14 -08:00
2022-02-18 11:00:25 +00:00
2022-03-11 08:28:27 -08:00
2020-06-22 21:12:44 -07:00
2021-06-28 14:29:45 -07:00
2022-02-04 16:25:21 +01:00
2022-04-06 22:09:39 -07:00
2020-03-30 13:45:04 -07:00
2021-01-27 18:18:15 -08:00
2022-02-02 14:45:18 +00:00
2022-02-07 20:12:45 -08:00
2021-10-15 11:33:08 +01:00
2022-03-03 14:38:48 +00:00
2021-07-23 16:44:57 -07:00
2021-11-17 20:21:52 -08:00
2022-01-25 11:25:21 +00:00
2022-02-17 07:00:39 -06:00
2021-11-16 13:16:54 +00:00
2022-02-17 11:44:20 -08:00
2021-11-19 20:09:55 -08:00
2021-12-06 16:05:11 -08:00
2022-04-11 17:37:50 -07:00
2021-12-06 16:05:11 -08:00
2021-10-07 19:52:58 +02:00
2022-01-31 11:33:10 +00:00
2022-02-04 14:15:11 -08:00
2021-11-22 15:44:49 +00:00
2022-02-17 11:44:20 -08:00
2020-06-20 17:22:22 -07:00
2021-03-23 14:14:50 -07:00
2021-12-07 20:44:59 -08:00
2021-10-13 09:40:46 -07:00
2021-07-27 13:05:56 +01:00
2021-11-07 19:25:29 +00:00
2021-08-30 01:51:36 +02:00
2022-03-15 11:36:26 +01:00
2022-01-28 11:23:41 +01:00
2021-06-24 12:41:12 -07:00
2022-04-01 12:04:15 +01:00
2021-10-29 13:23:51 +01:00
2020-03-02 11:16:27 -08:00
2021-03-26 15:14:56 -07:00
2020-02-28 12:08:37 -08:00
2020-05-29 21:20:20 -07:00
2022-02-16 20:52:04 -08:00
2019-12-09 10:36:44 -08:00
2022-03-03 11:55:12 -08:00
2022-02-02 20:30:18 -08:00
2022-02-10 15:30:26 +00:00
2021-12-10 06:38:26 -08:00
2021-07-27 11:43:50 +01:00
2021-09-24 14:07:10 +01:00
2021-11-16 18:02:46 +01:00
2022-04-15 10:43:47 +01:00
2020-03-04 13:25:55 -08:00
2022-04-12 15:00:25 +02:00
2022-04-08 13:45:43 +01:00
2022-01-27 13:53:27 +00:00
2021-05-17 15:29:35 -07:00
2021-08-09 15:34:21 -07:00
2021-03-25 17:40:43 -07:00
2020-07-31 09:24:23 +02:00
2022-02-02 14:45:18 +00:00
2021-10-13 09:40:45 -07:00
2022-01-27 08:38:33 -08:00
2020-06-23 20:27:09 -07:00
2022-04-13 12:46:26 +01:00
2022-01-27 13:53:27 +00:00
2020-07-13 11:03:44 -07:00
2022-01-04 12:17:35 +00:00
2021-04-28 14:06:45 -07:00
2020-09-28 15:19:03 -07:00
2021-06-15 18:01:05 +02:00
2022-04-12 15:00:25 +02:00
2021-08-03 13:05:26 +01:00
2022-04-08 11:49:08 +01:00
2022-03-17 16:49:58 -07:00
2022-04-12 15:00:25 +02:00
2022-04-12 15:00:25 +02:00
2020-06-23 20:10:15 -07:00
2020-06-18 20:46:23 -07:00
2021-02-04 18:37:14 -08:00
2022-04-12 15:00:25 +02:00
2022-01-27 13:53:27 +00:00
2022-03-01 08:38:02 +00:00
2019-12-09 10:28:43 -08:00
2021-12-14 00:24:24 +01:00
2022-01-27 17:25:32 +01:00
2021-12-29 08:48:14 -08:00
2022-03-17 20:33:52 +01:00
2022-03-19 14:49:08 +00:00
2022-01-27 17:25:32 +01:00