Re: behaviour of tc for bridged ports

Adam Niescierowicz <[email protected]> Wed, 12 Jul 2023 10:44:50 +0000
Newsgroups org.kernel.vger.lartc
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------5zPinEaKUJgRUJ9BdRUz4Twp
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 8bit

It can be stupid answer but try limiting traffic on br0.
Also try using htb with tc filter.


W dniu 9.07.2023 o 14:24, Nayan Gadre pisze:
> Hi Experts,
>
> I have a wireless router having the client facing interface wlan0 and
> the wired gateway facing interface eth0 under a bridge br0.
>
> / # brctl show
> bridge name     bridge id               STP enabled     interfaces
> br0             8000.bce67c4d8fb0       no              eth0
>                                                                             wlan0
>
> client get IP 192.168.0.105, and server (connected via eth0) has IP
> 192.168.0.10.
> On server I run "iperf3 -s -p 5678 -V"
> On client I run "iperf3 -c 192.168.0.10 -p5678 -i1 -tinf"
> All works fine.
>
> Now I want to rate limit the traffic going from wlan0 to eth0 to 5000kbits/sec.
>
> I tried to apply a classless qdisc to eth0 port as well as wlan0 port.
> # tc qdisc add dev eth0 root tbf rate 5000kbit latency 50ms burst 15k
> # tc qdisc add dev wlan0 root tbf rate 5000kbit latency 50ms burst 15k
>
> However, the qdisc does not take effect.
>
> iperf3 -c 192.168.0.10 -p5678 -i1 -tinf
> Connecting to host 192.168.0.10, port 5678
> [  5] local 192.168.0.105 port 43384 connected to 192.168.0.10 port 5678
> [ ID] Interval           Transfer     Bitrate         Retr  Cwnd
> [  5]   0.00-1.00   sec  10.7 MBytes  89.6 Mbits/sec    0    526 KBytes
> [  5]   1.00-2.00   sec  8.95 MBytes  75.1 Mbits/sec    0    560 KBytes
> [  5]   2.00-3.00   sec  9.13 MBytes  76.6 Mbits/sec    0    619 KBytes
>
> / # tc -s qdisc
> qdisc tbf 8005: dev eth0 root refcnt 5 rate 5Mbit burst 15Kb lat 50ms
>   Sent 221305 bytes 469 pkt (dropped 157, overlimits 288 requeues 0)
>   backlog 0b 0p requeues 0
> qdisc tbf 8006: dev wlan16 root refcnt 5 rate 5Mbit burst 15Kb lat 50ms
>   Sent 7095 bytes 109 pkt (dropped 0, overlimits 0 requeues 0)
>   backlog 0b 0p requeues 0
>
> My kernel is 4.4.60, and I checked that qdisc gets activated in the
> egress path after dev_queue_xmit() is called. And for a bridged port,
> the path taken by the packet coming to wlan0 is
> __br_deliver -> br_forward_finish -> br_dev_queue_push_xmit -> dev_queue_xmit.
>
> So the qdisc should have taken effect even in the bridged case. I see
> statistics for eth0 qdisc.
> What am I missing in the tc rule ?
>
> If I apply the same rule on the server and client interfaces then I
> can see rate limiting taking effect. But on the wireless router linux
> bridge it's not working.
>
> Thanks
> N Gadre

-- 
---
Pozdrawiam
Adam Nieścierowicz

--------------5zPinEaKUJgRUJ9BdRUz4Twp
Content-Type: text/vcard; charset=UTF-8; name="adam_niescierowicz.vcf"
Content-Disposition: attachment; filename="adam_niescierowicz.vcf"
Content-Transfer-Encoding: base64

YmVnaW46dmNhcmQNCmZuO3F1b3RlZC1wcmludGFibGU6QWRhbSBOaWU9QzU9OUJjaWVyb3dp
Y3oNCm47cXVvdGVkLXByaW50YWJsZTpOaWU9QzU9OUJjaWVyb3dpY3o7QWRhbQ0KZW1haWw7
aW50ZXJuZXQ6YWRhbS5uaWVzY2llcm93aWN6QGp1c3RuZXQucGwNCngtbW96aWxsYS1odG1s
OlRSVUUNCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K

--------------5zPinEaKUJgRUJ9BdRUz4Twp--