Skip to contentSkip to conversation

Out of IMQ interfaces

LARTC Hasso Tepper 3 participants 5 messages Jul 7, 2003 – Jul 9, 2003 Networking

lore
Share & tools
lore
#0 lore raw

I needed router that can do "bidirectional" shaping in interface. I'm using IMQ + TBF for that at the moment. One ethernet interface is connected to "backbone", other has many vlan's. Every vlan is "connected" to IMQ device. I have wrapper scripts for maintaining this stuff and it works like a charm.

But there is problem though - router can handle more, but I'm running out of IMQ devices. Default is 16 devices, but it is possible to change it in linux/include/imq.h. Theoretical maximum is 127. There is bug is imq module btw, it refuses to accept bigger number of numdevs argument than 99. But router really can handle more.

So, any ideas?

1) It is router, nothing more. No any services here.
2) Solution should be really simple because configuration changes really often.
3) Shaping "upload" only in backbone interface isn't solution.
4) No need for obvious "solutions" like - buy another box ;).

regards,

PS. I posted with wrong from address at first. Sorry if it would be duplicate.

Signature · 7 lines
Hasso Tepper
Elion Enterprises Ltd.
WAN administrator

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#1 lore raw
Quoted 6 lines · Hasso Tepper

But there is problem though - router can handle more, but I'm running out of IMQ devices. Default is 16 devices, but it is possible to change it in linux/include/imq.h. Theoretical maximum is 127. There is bug is imq module btw, it refuses to accept bigger number of numdevs argument than 99. But router really can handle more.

The default is 2 devices. I can not imagine why there should be a 99 device limit, there is one such limit in net/core/dev.c:dev_alloc_name, but imq doesn't use that function. I can't really imagine alloc_netdev calling dev_alloc_name
because the caller chooses it's own name, but i haven't checked. if you want to make sure, change dev_alloc_name to support more than 100 devices (trivial)
and try again. Please inform me in case of success.

Bye,
Patrick

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#2 lore raw
In reply to Hasso Tepper

May you need mark packets with iptables and one IMQ device with htb queue
Something like
iptables -t mangle -A PREROUTING -i intf1 -j MARK --set-mark 1
.....
iptables -t mangle -A PREROUTING -i intfN -j MARK --set-mark N iptables -t mangle -A PREROUTING -j IMQ

And to imq0 attach HTB qdisc with shaping according to mark value

On Mon, Jul 07, 2003 at 11:32:25PM +0300, Hasso Tepper wrote:
HT>I needed router that can do "bidirectional" shaping in interface. I'm HT>using IMQ + TBF for that at the moment. One ethernet interface is HT>connected to "backbone", other has many vlan's. Every vlan is HT>"connected" to IMQ device. I have wrapper scripts for maintaining HT>this stuff and it works like a charm.

HT>But there is problem though - router can handle more, but I'm running HT>out of IMQ devices. Default is 16 devices, but it is possible to HT>change it in linux/include/imq.h. Theoretical maximum is 127. There HT>is bug is imq module btw, it refuses to accept bigger number of HT>numdevs argument than 99. But router really can handle more.

HT>So, any ideas?

HT>1) It is router, nothing more. No any services here. HT>2) Solution should be really simple because configuration changes HT>really often.
HT>3) Shaping "upload" only in backbone interface isn't solution. HT>4) No need for obvious "solutions" like - buy another box ;).

HT>regards,

HT>PS. I posted with wrong from address at first. Sorry if it would be HT>duplicate.

HT>--
HT>Hasso Tepper
HT>Elion Enterprises Ltd.
HT>WAN administrator

HT>_______________________________________________
HT>LARTC mailing list / [email protected] HT>http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

Signature · 6 lines
Best regard, Aleksander Trotsai aka MAGE-RIPE aka MAGE-UANIC
My PGP key at ftp://blackhole.adamant.ua/pgp/trotsai.key[.asc]
Big trouble - Quantum dynamics are affecting the transistors
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#3 lore raw
In reply to Hasso Tepper
Quoted 10 lines · Alexander Trotsai

May you need mark packets with iptables and one IMQ device with htb queue
Something like
iptables -t mangle -A PREROUTING -i intf1 -j MARK --set-mark 1
.....
iptables -t mangle -A PREROUTING -i intfN -j MARK --set-mark N iptables -t mangle -A PREROUTING -j IMQ

And to imq0 attach HTB qdisc with shaping according to mark value

Yes, I thought about it, but it will make management a lot more complicated. If I have to change rate on one vlan only? At the moment:

Up:
iptables -t mangle -A PREROUTING -i eth1.$d+ -j IMQ --todev $d tc qdisc add dev eth1.$d root tbf rate ...
tc qdisc add dev imq$d root tbf rate ...
ip link set imq$d up

Down:
iptables -t mangle -D PREROUTING -i eth1.$d+ -j IMQ --todev $d tc qdisc del dev eth1.$d root
tc qdisc del dev imq$d root
ip link set imq$d down

I made wrapper script, which takes device number and shaping parameters from command line. I can change shaping parameters on any vlan without affecting others.

regards,

Signature · 7 lines
Hasso Tepper
Elion Enterprises Ltd.
WAN administrator

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#4 lore raw
In reply to Hasso Tepper

Hi Hasso,
just to correct some wrong information i gave, imq _does_ use that function indirectly through alloc_netdev, the caller sets the format string not the name. Must have been too late. Anyway, this patch should fix your problem.

Bye
Patrick

Quoted 11 lines · Patrick McHardy
Quoted 2 lines · Hasso Tepper

But there is problem though - router can handle more, but I'm running out of IMQ devices. Default is 16 devices, but it is possible to change it in linux/include/imq.h. Theoretical maximum is 127. There is bug is imq module btw, it refuses to accept bigger number of numdevs argument than 99. But router really can handle more.

The default is 2 devices. I can not imagine why there should be a 99 device limit, there is one such limit in net/core/dev.c:dev_alloc_name, but imq doesn't use that function. I can't really imagine alloc_netdev calling dev_alloc_name because the caller chooses it's own name, but i haven't checked. if you want to make sure, change dev_alloc_name to support more than 100 devices (trivial) and try again. Please inform me in case of success.

Quoted 3 lines

Bye,
Patrick

===== net/core/dev.c 1.36 vs edited =====

net/core/dev.c +1 -1
@@ -620,7 +620,7 @@
 	/*
 	 * If you need over 100 please also fix the algorithm...
 	 */
-	for (i = 0; i < 100; i++) {
+	for (i = 0; i < 128; i++) {
 		snprintf(buf,sizeof(buf),name,i);
 		if (__dev_get_by_name(buf) == NULL) {
 			strcpy(dev->name, buf);