From: Jamal Hadi Salim <jhs@mojatatu.com>
To: Jiri Pirko <jiri@resnulli.us>, netdev@vger.kernel.org
Cc: davem@davemloft.net, pshelar@nicira.com, therbert@google.com,
edumazet@google.com, willemb@google.com, dborkman@redhat.com,
mst@redhat.com, fw@strlen.de, Paul.Durrant@citrix.com,
tgraf@suug.ch
Subject: Re: [patch iproute2] tc: add support for vlan tc action
Date: Sun, 16 Nov 2014 15:19:34 -0500 [thread overview]
Message-ID: <546906D6.7040400@mojatatu.com> (raw)
In-Reply-To: <1415804134-9895-1-git-send-email-jiri@resnulli.us>
On 11/12/14 09:55, Jiri Pirko wrote:
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>
Latest patches work great. If you want you can
include these notes in the iproute2 commit log.
There is only one small doubt when i add two vlan
tags(Q followed by QandQ). Look at the very end
of the text i have below...
cheers,
jamal
---
export TC=/media/MT1/other-gits/iproute2-jiri/tc/tc
export ETH=eth0
#index supplied by kernel
sudo $TC actions add action vlan pop
#explicit add with our index
sudo $TC actions add action vlan pop index 10
sudo $TC actions add action vlan push id 123
sudo $TC actions add action vlan push id 456 protocol 802.1Q
sudo $TC actions add action vlan push id 789 protocol 802.1ad
sudo $TC actions ls action vlan
------ expect something like ----
action order 0: vlan pop
index 1 ref 1 bind 0
action order 1: vlan push id 123 protocol 802.1Q
index 2 ref 1 bind 0
action order 2: vlan push id 456 protocol 802.1Q
index 3 ref 1 bind 0
action order 3: vlan push id 789 protocol 802.1ad
index 4 ref 1 bind 0
action order 4: vlan pop
index 10 ref 1 bind 0
-------
#show stats
sudo $TC -s actions ls action vlan
-------
action order 0: vlan pop
index 1 ref 1 bind 0 installed 78 sec used 78 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 1: vlan push id 123 protocol 802.1Q
index 2 ref 1 bind 0 installed 44 sec used 44 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 2: vlan push id 456 protocol 802.1Q
index 3 ref 1 bind 0 installed 42 sec used 42 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 3: vlan push id 789 protocol 802.1ad
index 4 ref 1 bind 0 installed 39 sec used 39 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 4: vlan pop
index 10 ref 1 bind 0 installed 47 sec used 47 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
-----
sudo $TC actions flush action vlan
#expect all actions to be gone..
sudo $TC actions ls action vlan
#lets bind actions to filters...
sudo ip li add dev dummy0 type dummy
sudo ifconfig dummy0 up
#
sudo tc qdisc del dev $ETH ingress
sudo tc qdisc add dev $ETH ingress
#
sudo $TC filter add dev $ETH parent ffff: pref 11 protocol ip \
u32 match ip src 10.0.0.1 flowid 1:1 \
action vlan push id 123 \
action mirred egress redirect dev dummy0
window 1> sudo tcpdump -n -i dummy0 -e -X
window 2> ping -c 1 10.0.0.1
Expect something like:
52:54:00:c3:4b:c5 > 02:00:00:22:01:01, ethertype 802.1Q (0x8100), length
102: vlan 123, p 0, ethertype IPv4, ...
#now look at the stats..
sudo $TC -s filter ls dev $ETH parent ffff: protocol ip
#
sudo $TC filter add dev $ETH parent ffff: pref 12 protocol ip \
u32 match ip src 10.0.0.2 flowid 1:2 \
action vlan push id 456 protocol 802.1Q \
action mirred egress redirect dev dummy0
sudo tcpdump -n -i dummy0 -X -e
ping -c 1 10.0.0.2
#look at the stats..
sudo $TC -s filter ls dev $ETH parent ffff: protocol ip
#
sudo $TC filter add dev $ETH parent ffff: pref 13 protocol ip \
u32 match ip src 10.0.0.13 flowid 1:13 \
action vlan push id 789 protocol 802.1ad \
action mirred egress redirect dev dummy0
ping -c 1 10.0.0.2
sudo tcpdump -n -i dummy0 -X -e
Expect ...
52:54:00:c3:4b:c5 > 02:00:00:22:01:01, ethertype 802.1Q-QinQ (0x88a8),
length 102: vlan 789, p 0, ethertype IPv4,,,
#
sudo $TC -s filter ls dev $ETH parent 1: protocol ip
#
# Speaking in New Brunswickian:
# For shits and giggles lets add two vlans ...
# match all pings this time...
#
sudo $TC filter add dev $ETH parent ffff: pref 11 protocol ip u32 \
match ip protocol 1 0xff flowid 1:1 \
action vlan push id 123 \
action vlan push id 789 protocol 802.1ad \
action mirred egress redirect dev dummy0
sudo $TC -s filter ls dev $ETH parent ffff: protocol ip
------
filter pref 11 u32
filter pref 11 u32 fh 800: ht divisor 1
filter pref 11 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
(rule hit 2 success 0)
match 00010000/00ff0000 at 8 (success 0 )
action order 1: vlan push id 123 protocol 802.1Q
index 13 ref 1 bind 1 installed 6 sec used 6 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 2: vlan push id 789 protocol 802.1ad
index 14 ref 1 bind 1 installed 6 sec used 6 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 3: mirred (Egress Redirect to device dummy0) stolen
index 9 ref 1 bind 1 installed 6 sec used 6 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
----
Send 10 pings to 192.168.100.1
ping 192.168.100.1 -c 10
sudo $TC -s filter ls dev $ETH parent ffff: protocol ip
------
filter pref 11 u32
filter pref 11 u32 fh 800: ht divisor 1
filter pref 11 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
(rule hit 24 success 10)
match 00010000/00ff0000 at 8 (success 10 )
action order 1: vlan push id 123 protocol 802.1Q
index 13 ref 1 bind 1 installed 143 sec used 60 sec
Action statistics:
Sent 840 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 2: vlan push id 789 protocol 802.1ad
index 14 ref 1 bind 1 installed 143 sec used 60 sec
Action statistics:
Sent 840 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 3: mirred (Egress Redirect to device dummy0) stolen
index 9 ref 1 bind 1 installed 143 sec used 60 sec
Action statistics:
Sent 840 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
--------
As can be seen, the two vlan tags were supposedly added. I am
not sure how well it worked. I see 4 more bytes added. tcpdump doesnt do
a good job telling me if it worked...
17:58:31.636816 00:22:01:01:52:54 > 00:00:00:00:02:00, ethertype
802.1Q-QinQ (0x88a8), length 106: vlan 789, p 0, LLC, dsap Unknown
(0x44) Group, ssap Null (0x00) Command, ctrl 0x5400: Information, send
seq 0, rcv seq 42, Flags [Command], length 88
0x0000: 0000 0000 0200 0022 0101 5254 88a8 0315
0x0010: 00c3 4500 0054 c06b 0000 4001 704c 8100
0x0020: 007b c0a8 6401 c0a8 649f 0000 24b8 027c
0x0030: 000a c7e5 6854 0000 0000 e0b4 0900 0000
0x0040: 0000 1011 1213 1415 1617 1819 1a1b 1c1d
0x0050: 1e1f 2021 2223 2425 2627 2829 2a2b 2c2d
0x0060: 2e2f 3031 3233 3435 3637
Here it is with just 802.1q tag...
17:53:38.198323 52:54:00:c3:4b:c5 > 02:00:00:22:01:01, ethertype 802.1Q
(0x8100), length 102: vlan 456, p 0, ethertype IPv4, 192.168.100.1 >
192.168.100.159: ICMP echo reply, id 620, seq 1, length 64
0x0000: 0200 0022 0101 5254 00c3 4bc5 8100 01c8
0x0010: 0800 4500 0054 c052 0000 4001 7065 c0a8
0x0020: 6401 c0a8 649f 0000 6482 026c 0001 a2e4
0x0030: 6854 0000 0000 cc04 0300 0000 0000 1011
0x0040: 1213 1415 1617 1819 1a1b 1c1d 1e1f 2021
0x0050: 2223 2425 2627 2829 2a2b 2c2d 2e2f 3031
0x0060: 3233 3435 3637
------------
next prev parent reply other threads:[~2014-11-16 20:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 14:52 [patch net-next v2 1/4] openvswitch: actions: use skb_postpull_rcsum when possible Jiri Pirko
2014-11-12 14:52 ` [patch net-next v2 2/4] net: move make_writable helper into common code Jiri Pirko
2014-11-12 19:15 ` Pravin Shelar
2014-11-12 14:52 ` [patch net-next v2 3/4] net: move vlan pop/push functions " Jiri Pirko
2014-11-12 19:17 ` Pravin Shelar
2014-11-12 14:52 ` [patch net-next v2 4/4] sched: introduce vlan action Jiri Pirko
2014-11-12 14:55 ` [patch iproute2] tc: add support for vlan tc action Jiri Pirko
2014-11-16 20:19 ` Jamal Hadi Salim [this message]
2014-11-18 20:48 ` Jiri Pirko
2014-11-13 17:07 ` [patch net-next v2 4/4] sched: introduce vlan action Cong Wang
2014-11-12 19:13 ` [patch net-next v2 1/4] openvswitch: actions: use skb_postpull_rcsum when possible Pravin Shelar
[not found] <reply-to=1415700789-9171-2-git-send-email-jiri@resnulli.us>
2014-11-11 10:16 ` [patch iproute2] tc: add support for vlan tc action Jiri Pirko
2014-11-11 12:35 ` Jamal Hadi Salim
2014-11-11 13:36 ` Jamal Hadi Salim
2014-11-11 13:46 ` Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=546906D6.7040400@mojatatu.com \
--to=jhs@mojatatu.com \
--cc=Paul.Durrant@citrix.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=jiri@resnulli.us \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@nicira.com \
--cc=tgraf@suug.ch \
--cc=therbert@google.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).