Before writing code over and make you waste your time reading it, I have a basic question.
In my RouterOS I want to control the download and upload with PCQ (with Tree and Mangles obviously) for http, gamer, p2p, etc. by prioritys. In the famous:
http://mum.mikrotik.com/presentations/CZ09/QoS_Megis.pdf
is seen that in the mangle marking does in “forward”, and that same mark is used for Download Tree and Upload Tree.
I make however two marks, the first mark in the PREROUTING and I use it for Donwload Tree, and then back to mark with a different mark_name in same connection in the POSTROUTING, and use this new mark for the brand in the Upload Tree. I honestly do not remember because I did this at the time, I probably saw it somewhere.
Is it right or needed to dial twice?
I think that the reason that does not reach the MaxLimit of Upload tree branch, is because all the upload is considered a single client, not several, and therefore is never greater than the max limit of PCQ, and max limit of upload tree branch is ignored
Code summary: (I have two interfaces, one only for http trafic)
/queue type
add kind=pcq name=default_download pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-classifier=dst-address pcq-dst-address-mask=32 pcq-dst-address6-mask=64 pcq-limit=75 pcq-rate=12M pcq-src-address-mask=32 pcq-src-address6-mask=64 pcq-total-limit=7000
add kind=pcq name=default_upload pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-classifier=src-address pcq-dst-address-mask=32 pcq-dst-address6-mask=64 pcq-limit=75 pcq-rate=600k pcq-src-address-mask=32 pcq-src-address6-mask=64 pcq-total-limit=7000
/queue tree
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name=Download packet-mark=“” parent=bridge1 priority=1
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=5M max-limit=5M name=Ether1 packet-mark=“” parent=Download priority=2
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=5M max-limit=5M name=Ether2 packet-mark=“” parent=Download priority=1
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=400k name=Upload_W1 packet-mark=“” parent=ether1 priority=1
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=400k name=Upload_W2 packet-mark=“” parent=ether2 priority=1
/* Intercafe eth1 for non-http */
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=2M max-limit=7M name=W1_D1 packet-mark=downoad_Winbox,downoad_dns,download_ping parent=Ether1 priority=1 queue=default_download
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1M max-limit=15M name=W1_D8 packet-mark=download_p2p_packet_mark parent=Ether1 priority=8 queue=default_download
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=150k max-limit=400k name=W1_U1 packet-mark=dhcp,dns,winbox parent=Upload_W1 priority=1 queue=default_upload
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=5k max-limit=500k name=W1_U8 packet-mark=p2p parent=Upload_W1 priority=8 queue=default_upload
/* Interface eth2 for http */
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1M max-limit=4M name=W2_D1 packet-mark=download_games_packet_mark parent=Ether2 priority=1 queue=default_download
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=2M max-limit=20M name=W2_D4 packet-mark=download_httpmax_packet_mark parent=Ether2 priority=4 queue=default_download
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1M max-limit=18M name=W2_D7 packet-mark=download_httpmax_p2p parent=Ether2 priority=7 queue=default_download
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=150k max-limit=500k name=W2_U1 packet-mark=dhcp,dns,games_packet_mark parent=Upload_W2 priority=1 queue=default_upload
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=300k max-limit=750k name=W2_U3 packet-mark=web parent=Upload_W2 priority=3 queue=default_upload
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=50k max-limit=600k name=W2_U8 packet-mark=web_file_p2p parent=Upload_W2 priority=8 queue=default_upload
/ip firewall mangle
add action=mark-packet chain=postrouting connection-bytes=0-50000 connection-mark=http_con disabled=no new-packet-mark=web out-interface=ether2 passthrough=no protocol=tcp
add action=mark-packet chain=postrouting connection-bytes=50000-0 connection-mark=http_con disabled=no new-packet-mark=web_file out-interface=ether2 passthrough=no protocol=tcp
add action=mark-connection chain=prerouting connection-mark=no-mark connection-state=new disabled=no dst-port=80,443 new-connection-mark=http_con passthrough=yes protocol=tcp
add action=mark-packet chain=prerouting connection-bytes=0-200000 connection-mark=http_con disabled=no new-packet-mark=download_http_packet_mark passthrough=no protocol=tcp
add action=mark-packet chain=prerouting connection-bytes=200000-0 connection-mark=http_con disabled=no new-packet-mark=download_httpmax_packet_mark passthrough=no protocol=tcp