Hi Allan,
On 11.06.2002 2:18, Allan W. Nielsen <[email protected]> wrote:
>> >> Here is my initial suggestion for an alternative chain-schema:
>> >>
>> >> Chain 0: The default chain - today this is in IS2. If we proceed
>> >> with this as is - then this will change.
>> >> Chain 1-9999: These are offloaded by "basic" classification.
>> >> Chain 10000-19999: These are offloaded in IS1
>> >> Chain 10000: Lookup-0 in IS1, and here we could limit the
>> >> action to do QoS related stuff (priority
>> >> update)
>> >> Chain 11000: Lookup-1 in IS1, here we could do VLAN
>> >> stuff
>> >> Chain 12000: Lookup-2 in IS1, here we could apply the
>> >> "PAG" which is essentially a GOTO.
>> >>
>> >> Chain 20000-29999: These are offloaded in IS2
>> >> Chain 20000-20255: Lookup-0 in IS2, where CHAIN-ID -
>> >> 20000 is the PAG value.
>> >> Chain 21000-21000: Lookup-1 in IS2.
>> >>
>> >> All these chains should be optional - users should only need to
>> >> configure the chains they need. To make this work, we need to
>> >> configure both the desired actions (could be priority update) and the goto action.
>> >> Remember in HW, all packets goes through this process, while in SW
>> >> they only follow the "goto" path.
>> >>
I agree with this chain assignment, following is an example to set rules:
1. Set a matchall rule for each chain, the last chain do not need goto chain action.
# tc filter add dev swp0 chain 0 flower skip_sw action goto chain 10000
# tc filter add dev swp0 chain 10000 flower skip_sw action goto chain 21000
In driver, use these rules to register the chain.
2. Set normal rules.
# tc filter add dev swp0 chain 10000 protocol 802.1Q parent ffff: flower skip_sw vlan_id 1 vlan_prio 1 action skbedit priority 1 action goto chain 21000
# tc filter add dev swp0 chain 21000 protocol 802.1Q parent ffff: flower skip_sw vlan_id 1 vlan_prio 1 action drop
In driver, we check if the chain ID has been registered, and goto chain is the same as first matchall rule, if is not, then return error. Each rule need has goto action except last chain.
I also have check about chain template, it can not set an action template for each chain, so I think it's no use for our case. If this way to set rules is OK, I will update the patch to do as this.
Thanks,
Xiaoliang Yang