From: Hadar Hen Zion <hidden> Date: 2016-08-10 19:27:56
This patchset introduce vlan tag support to the flower classifier and the flow
dissector. In addition to adding vlan priority to act vlan.
The first 2 patches are dealing with the flow dissector:
- The first patch is a fix, vlan id value should be taken from skb->vlan_tci
and not from skb->data.
- The second patch adds support for vlan priority.
The third patch adds vlan tag support to the flower classifier, user space
patches will be sent later to complete it.
The last patch adds vlan priority to act vlan since only vlan id is currently supported.
Hadar Hen Zion (4):
flow_dissector: Get vlan info from skb->vlan_tci instead of skb->data
flow_dissector: Get vlan priority in addition to vlan id
net_sched: flower: Add vlan support
net_sched: act_vlan: Add priority option
include/linux/if_vlan.h | 1 +
include/net/flow_dissector.h | 11 ++++--
include/net/tc_act/tc_vlan.h | 1 +
include/uapi/linux/pkt_cls.h | 3 ++
include/uapi/linux/tc_act/tc_vlan.h | 1 +
net/core/flow_dissector.c | 28 +++++++--------
net/sched/act_vlan.c | 13 +++++--
net/sched/cls_flower.c | 69 +++++++++++++++++++++++++++++++++++--
8 files changed, 103 insertions(+), 24 deletions(-)
--
1.8.3.1
From: Hadar Hen Zion <hidden> Date: 2016-08-10 19:27:56
Early in the datapath skb_vlan_untag function is called, stripped
the vlan from the skb and set skb->vlan_tci and skb->vlan_proto fields.
The current dissection doesn't handle vlan packets correctly. Vlan
doesn't exist in skb->data anymore when applying flow dissection on the
skb, fix that.
Fixes: 0744dd00c1b1 ('net: introduce skb_flow_dissect()')
Signed-off-by: Hadar Hen Zion <redacted>
---
net/core/flow_dissector.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
From: Hadar Hen Zion <hidden> Date: 2016-08-10 19:27:56
Add vlan priority check to the flow dissector by adding new flow
dissector struct, flow_dissector_key_vlan which includes vlan tag
fields.
vlan_id and flow_label fields were under the same struct
(flow_dissector_key_tags). It was a convenient setting since struct
flow_dissector_key_tags is used by struct flow_keys and by setting
vlan_id and flow_label under the same struct, we get precisely 24 or 48
bytes in flow_keys from flow_dissector_key_basic.
Now, when adding vlan priority support, the code will be cleaner if
flow_label and vlan tag won't be under the same struct anymore.
Signed-off-by: Hadar Hen Zion <redacted>
---
include/linux/if_vlan.h | 1 +
include/net/flow_dissector.h | 11 ++++++++---
net/core/flow_dissector.c | 15 +++++++++------
3 files changed, 18 insertions(+), 9 deletions(-)
@@ -668,6 +704,29 @@ static int fl_dump_key_val(struct sk_buff *skb,return0;}+staticintfl_dump_key_vlan(structsk_buff*skb,+structflow_dissector_key_vlan*vlan_key,+structflow_dissector_key_vlan*vlan_mask)+{+interr;++if(!memchr_inv(vlan_mask,0,sizeof(*vlan_mask)))+return0;+if(vlan_mask->vlan_id){+err=nla_put_u16(skb,TCA_FLOWER_KEY_VLAN_ID,+vlan_key->vlan_id);+if(err)+returnerr;+}+if(vlan_mask->vlan_priority){+err=nla_put_u8(skb,TCA_FLOWER_KEY_VLAN_PRIO,+vlan_key->vlan_priority);+if(err)+returnerr;+}+return0;+}+staticintfl_dump(structnet*net,structtcf_proto*tp,unsignedlongfh,structsk_buff*skb,structtcmsg*t){
@@ -712,6 +771,10 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,&mask->basic.n_proto,TCA_FLOWER_UNSPEC,sizeof(key->basic.n_proto)))gotonla_put_failure;++if(fl_dump_key_vlan(skb,&key->vlan,&mask->vlan))+gotonla_put_failure;+if((key->basic.n_proto==htons(ETH_P_IP)||key->basic.n_proto==htons(ETH_P_IPV6))&&fl_dump_key_val(skb,&key->basic.ip_proto,TCA_FLOWER_KEY_IP_PROTO,
From: Hadar Hen Zion <hidden> Date: 2016-08-10 19:27:59
The current vlan push action supports only vid and protocol options.
Add priority option.
Example script that adds vlan push action with vid and
priority:
tc filter add dev veth0 protocol ip parent ffff: \
flower \
indev veth0 \
action vlan push id 100 priority 5
Signed-off-by: Hadar Hen Zion <redacted>
---
include/net/tc_act/tc_vlan.h | 1 +
include/uapi/linux/tc_act/tc_vlan.h | 1 +
net/sched/act_vlan.c | 13 +++++++++++--
3 files changed, 13 insertions(+), 2 deletions(-)
include/linux/compiler.h:491:38: error: call to '__compiletime_assert_512' declared with attribute error: BUILD_BUG_ON failed: (sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:474:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^
include/linux/compiler.h:491:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/bug.h:51:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:75:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
quoted
net/core/flow_dissector.c:512:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON((sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32));
^
In function 'flow_keys_hash_length.isra.3',
inlined from '__skb_get_hash' at net/core/flow_dissector.c:599:9:
quoted
include/linux/compiler.h:491:38: error: call to '__compiletime_assert_512' declared with attribute error: BUILD_BUG_ON failed: (sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:474:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^
include/linux/compiler.h:491:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/bug.h:51:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:75:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
quoted
net/core/flow_dissector.c:512:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON((sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32));
^
In function 'flow_keys_hash_length.isra.3',
inlined from 'skb_get_hash_perturb' at net/core/flow_dissector.c:599:9:
quoted
include/linux/compiler.h:491:38: error: call to '__compiletime_assert_512' declared with attribute error: BUILD_BUG_ON failed: (sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:474:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^
include/linux/compiler.h:491:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/bug.h:51:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:75:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
quoted
net/core/flow_dissector.c:512:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON((sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32));
^
In function 'flow_keys_hash_length.isra.3',
inlined from '__skb_get_hash_symmetric' at net/core/flow_dissector.c:599:9:
quoted
include/linux/compiler.h:491:38: error: call to '__compiletime_assert_512' declared with attribute error: BUILD_BUG_ON failed: (sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:474:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^
include/linux/compiler.h:491:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/bug.h:51:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:75:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
quoted
net/core/flow_dissector.c:512:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON((sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32));
^
vim +/BUILD_BUG_ON +512 net/core/flow_dissector.c
20a17bf6 David S. Miller 2015-09-01 496 u32 keyval)
42aecaa9 Tom Herbert 2015-06-04 497 {
42aecaa9 Tom Herbert 2015-06-04 498 return jhash2(words, length, keyval);
42aecaa9 Tom Herbert 2015-06-04 499 }
42aecaa9 Tom Herbert 2015-06-04 500
20a17bf6 David S. Miller 2015-09-01 501 static inline const u32 *flow_keys_hash_start(const struct flow_keys *flow)
66415cf8 Hannes Frederic Sowa 2013-10-23 502 {
20a17bf6 David S. Miller 2015-09-01 503 const void *p = flow;
20a17bf6 David S. Miller 2015-09-01 504
42aecaa9 Tom Herbert 2015-06-04 505 BUILD_BUG_ON(FLOW_KEYS_HASH_OFFSET % sizeof(u32));
20a17bf6 David S. Miller 2015-09-01 506 return (const u32 *)(p + FLOW_KEYS_HASH_OFFSET);
42aecaa9 Tom Herbert 2015-06-04 507 }
42aecaa9 Tom Herbert 2015-06-04 508
20a17bf6 David S. Miller 2015-09-01 509 static inline size_t flow_keys_hash_length(const struct flow_keys *flow)
42aecaa9 Tom Herbert 2015-06-04 510 {
c3f83241 Tom Herbert 2015-06-04 511 size_t diff = FLOW_KEYS_HASH_OFFSET + sizeof(flow->addrs);
42aecaa9 Tom Herbert 2015-06-04 @512 BUILD_BUG_ON((sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32));
c3f83241 Tom Herbert 2015-06-04 513 BUILD_BUG_ON(offsetof(typeof(*flow), addrs) !=
c3f83241 Tom Herbert 2015-06-04 514 sizeof(*flow) - sizeof(flow->addrs));
c3f83241 Tom Herbert 2015-06-04 515
c3f83241 Tom Herbert 2015-06-04 516 switch (flow->control.addr_type) {
c3f83241 Tom Herbert 2015-06-04 517 case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
c3f83241 Tom Herbert 2015-06-04 518 diff -= sizeof(flow->addrs.v4addrs);
c3f83241 Tom Herbert 2015-06-04 519 break;
c3f83241 Tom Herbert 2015-06-04 520 case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
:::::: The code at line 512 was first introduced by commit
:::::: 42aecaa9bb2bd57eb8d61b4565cee5d3640863fb net: Get skb hash over flow_keys structure
:::::: TO: Tom Herbert [off-list ref]
:::::: CC: David S. Miller [off-list ref]
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
net/core/flow_dissector.c:512:2: error: call to '__compiletime_assert_512' declared with attribute error: BUILD_BUG_ON failed: (sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)
In function 'flow_keys_hash_length.isra.6',
inlined from '__flow_hash_from_keys' at net/core/flow_dissector.c:599:26,
inlined from '__skb_get_hash_symmetric' at net/core/flow_dissector.c:663:2:
quoted
net/core/flow_dissector.c:512:2: error: call to '__compiletime_assert_512' declared with attribute error: BUILD_BUG_ON failed: (sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)
In function 'flow_keys_hash_length.isra.6',
inlined from '__flow_hash_from_keys' at net/core/flow_dissector.c:599:26,
inlined from '__skb_get_hash' at net/core/flow_dissector.c:620:2:
quoted
net/core/flow_dissector.c:512:2: error: call to '__compiletime_assert_512' declared with attribute error: BUILD_BUG_ON failed: (sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)
In function 'flow_keys_hash_length.isra.6',
inlined from '__flow_hash_from_keys' at net/core/flow_dissector.c:599:26,
inlined from 'skb_get_hash_perturb' at net/core/flow_dissector.c:620:2:
quoted
net/core/flow_dissector.c:512:2: error: call to '__compiletime_assert_512' declared with attribute error: BUILD_BUG_ON failed: (sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)
vim +/__compiletime_assert_512 +512 net/core/flow_dissector.c
20a17bf6 David S. Miller 2015-09-01 506 return (const u32 *)(p + FLOW_KEYS_HASH_OFFSET);
42aecaa9 Tom Herbert 2015-06-04 507 }
42aecaa9 Tom Herbert 2015-06-04 508
20a17bf6 David S. Miller 2015-09-01 509 static inline size_t flow_keys_hash_length(const struct flow_keys *flow)
42aecaa9 Tom Herbert 2015-06-04 510 {
c3f83241 Tom Herbert 2015-06-04 511 size_t diff = FLOW_KEYS_HASH_OFFSET + sizeof(flow->addrs);
42aecaa9 Tom Herbert 2015-06-04 @512 BUILD_BUG_ON((sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32));
c3f83241 Tom Herbert 2015-06-04 513 BUILD_BUG_ON(offsetof(typeof(*flow), addrs) !=
c3f83241 Tom Herbert 2015-06-04 514 sizeof(*flow) - sizeof(flow->addrs));
c3f83241 Tom Herbert 2015-06-04 515
c3f83241 Tom Herbert 2015-06-04 516 switch (flow->control.addr_type) {
c3f83241 Tom Herbert 2015-06-04 517 case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
c3f83241 Tom Herbert 2015-06-04 518 diff -= sizeof(flow->addrs.v4addrs);
c3f83241 Tom Herbert 2015-06-04 519 break;
c3f83241 Tom Herbert 2015-06-04 520 case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
c3f83241 Tom Herbert 2015-06-04 521 diff -= sizeof(flow->addrs.v6addrs);
c3f83241 Tom Herbert 2015-06-04 522 break;
9f249089 Tom Herbert 2015-06-04 523 case FLOW_DISSECTOR_KEY_TIPC_ADDRS:
9f249089 Tom Herbert 2015-06-04 524 diff -= sizeof(flow->addrs.tipcaddrs);
9f249089 Tom Herbert 2015-06-04 525 break;
c3f83241 Tom Herbert 2015-06-04 526 }
c3f83241 Tom Herbert 2015-06-04 527 return (sizeof(*flow) - diff) / sizeof(u32);
66415cf8 Hannes Frederic Sowa 2013-10-23 528 }
66415cf8 Hannes Frederic Sowa 2013-10-23 529
c3f83241 Tom Herbert 2015-06-04 530 __be32 flow_get_u32_src(const struct flow_keys *flow)
5ed20a68 Tom Herbert 2014-07-01 531 {
c3f83241 Tom Herbert 2015-06-04 532 switch (flow->control.addr_type) {
c3f83241 Tom Herbert 2015-06-04 533 case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
c3f83241 Tom Herbert 2015-06-04 534 return flow->addrs.v4addrs.src;
c3f83241 Tom Herbert 2015-06-04 535 case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
c3f83241 Tom Herbert 2015-06-04 536 return (__force __be32)ipv6_addr_hash(
c3f83241 Tom Herbert 2015-06-04 537 &flow->addrs.v6addrs.src);
9f249089 Tom Herbert 2015-06-04 538 case FLOW_DISSECTOR_KEY_TIPC_ADDRS:
9f249089 Tom Herbert 2015-06-04 539 return flow->addrs.tipcaddrs.srcnode;
c3f83241 Tom Herbert 2015-06-04 540 default:
c3f83241 Tom Herbert 2015-06-04 541 return 0;
c3f83241 Tom Herbert 2015-06-04 542 }
c3f83241 Tom Herbert 2015-06-04 543 }
c3f83241 Tom Herbert 2015-06-04 544 EXPORT_SYMBOL(flow_get_u32_src);
c3f83241 Tom Herbert 2015-06-04 545
c3f83241 Tom Herbert 2015-06-04 546 __be32 flow_get_u32_dst(const struct flow_keys *flow)
c3f83241 Tom Herbert 2015-06-04 547 {
c3f83241 Tom Herbert 2015-06-04 548 switch (flow->control.addr_type) {
c3f83241 Tom Herbert 2015-06-04 549 case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
c3f83241 Tom Herbert 2015-06-04 550 return flow->addrs.v4addrs.dst;
c3f83241 Tom Herbert 2015-06-04 551 case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
c3f83241 Tom Herbert 2015-06-04 552 return (__force __be32)ipv6_addr_hash(
c3f83241 Tom Herbert 2015-06-04 553 &flow->addrs.v6addrs.dst);
c3f83241 Tom Herbert 2015-06-04 554 default:
c3f83241 Tom Herbert 2015-06-04 555 return 0;
c3f83241 Tom Herbert 2015-06-04 556 }
c3f83241 Tom Herbert 2015-06-04 557 }
c3f83241 Tom Herbert 2015-06-04 558 EXPORT_SYMBOL(flow_get_u32_dst);
5ed20a68 Tom Herbert 2014-07-01 559
c3f83241 Tom Herbert 2015-06-04 560 static inline void __flow_hash_consistentify(struct flow_keys *keys)
c3f83241 Tom Herbert 2015-06-04 561 {
c3f83241 Tom Herbert 2015-06-04 562 int addr_diff, i;
c3f83241 Tom Herbert 2015-06-04 563
c3f83241 Tom Herbert 2015-06-04 564 switch (keys->control.addr_type) {
c3f83241 Tom Herbert 2015-06-04 565 case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
c3f83241 Tom Herbert 2015-06-04 566 addr_diff = (__force u32)keys->addrs.v4addrs.dst -
c3f83241 Tom Herbert 2015-06-04 567 (__force u32)keys->addrs.v4addrs.src;
c3f83241 Tom Herbert 2015-06-04 568 if ((addr_diff < 0) ||
c3f83241 Tom Herbert 2015-06-04 569 (addr_diff == 0 &&
c3f83241 Tom Herbert 2015-06-04 570 ((__force u16)keys->ports.dst <
c3f83241 Tom Herbert 2015-06-04 571 (__force u16)keys->ports.src))) {
c3f83241 Tom Herbert 2015-06-04 572 swap(keys->addrs.v4addrs.src, keys->addrs.v4addrs.dst);
c3f83241 Tom Herbert 2015-06-04 573 swap(keys->ports.src, keys->ports.dst);
c3f83241 Tom Herbert 2015-06-04 574 }
c3f83241 Tom Herbert 2015-06-04 575 break;
c3f83241 Tom Herbert 2015-06-04 576 case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
c3f83241 Tom Herbert 2015-06-04 577 addr_diff = memcmp(&keys->addrs.v6addrs.dst,
c3f83241 Tom Herbert 2015-06-04 578 &keys->addrs.v6addrs.src,
c3f83241 Tom Herbert 2015-06-04 579 sizeof(keys->addrs.v6addrs.dst));
c3f83241 Tom Herbert 2015-06-04 580 if ((addr_diff < 0) ||
c3f83241 Tom Herbert 2015-06-04 581 (addr_diff == 0 &&
c3f83241 Tom Herbert 2015-06-04 582 ((__force u16)keys->ports.dst <
c3f83241 Tom Herbert 2015-06-04 583 (__force u16)keys->ports.src))) {
c3f83241 Tom Herbert 2015-06-04 584 for (i = 0; i < 4; i++)
c3f83241 Tom Herbert 2015-06-04 585 swap(keys->addrs.v6addrs.src.s6_addr32[i],
c3f83241 Tom Herbert 2015-06-04 586 keys->addrs.v6addrs.dst.s6_addr32[i]);
59346afe Jiri Pirko 2015-05-12 587 swap(keys->ports.src, keys->ports.dst);
5ed20a68 Tom Herbert 2014-07-01 588 }
c3f83241 Tom Herbert 2015-06-04 589 break;
c3f83241 Tom Herbert 2015-06-04 590 }
c3f83241 Tom Herbert 2015-06-04 591 }
c3f83241 Tom Herbert 2015-06-04 592
c3f83241 Tom Herbert 2015-06-04 593 static inline u32 __flow_hash_from_keys(struct flow_keys *keys, u32 keyval)
c3f83241 Tom Herbert 2015-06-04 594 {
c3f83241 Tom Herbert 2015-06-04 595 u32 hash;
c3f83241 Tom Herbert 2015-06-04 596
c3f83241 Tom Herbert 2015-06-04 597 __flow_hash_consistentify(keys);
5ed20a68 Tom Herbert 2014-07-01 598
20a17bf6 David S. Miller 2015-09-01 @599 hash = __flow_hash_words(flow_keys_hash_start(keys),
42aecaa9 Tom Herbert 2015-06-04 600 flow_keys_hash_length(keys), keyval);
5ed20a68 Tom Herbert 2014-07-01 601 if (!hash)
5ed20a68 Tom Herbert 2014-07-01 602 hash = 1;
:::::: The code at line 512 was first introduced by commit
:::::: 42aecaa9bb2bd57eb8d61b4565cee5d3640863fb net: Get skb hash over flow_keys structure
:::::: TO: Tom Herbert [off-list ref]
:::::: CC: David S. Miller [off-list ref]
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
net/core/flow_dissector.c:512:2: error: call to '__compiletime_assert_512' declared with attribute error: BUILD_BUG_ON failed: (sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)
[...]
I'm working on a fix, will send it soon.
I'll be happy to get your review and comments on my flow_dissector and
flower patches.
Thank you,
Hadar
[...]
Wed, Aug 10, 2016 at 03:32:22PM CEST, hadarh@mellanox.com wrote:
Enhance flower to support 802.1Q vlan protocol classification.
Currently, the supported fields are vlan_id and vlan_priority.
Example:
# add a flower filter with vlan id and priority classification
tc filter add dev ens4f0 protocol 802.1Q parent ffff: \
flower \
indev ens4f0 \
vlan_ethtype ipv4 \
vlan_id 100 \
vlan_prio 3 \
action vlan pop
Signed-off-by: Hadar Hen Zion <redacted>
Wed, Aug 10, 2016 at 03:32:23PM CEST, hadarh@mellanox.com wrote:
The current vlan push action supports only vid and protocol options.
Add priority option.
Example script that adds vlan push action with vid and
priority:
tc filter add dev veth0 protocol ip parent ffff: \
flower \
indev veth0 \
action vlan push id 100 priority 5
Signed-off-by: Hadar Hen Zion <redacted>
Wed, Aug 10, 2016 at 03:32:20PM CEST, hadarh@mellanox.com wrote:
Early in the datapath skb_vlan_untag function is called, stripped
the vlan from the skb and set skb->vlan_tci and skb->vlan_proto fields.
The current dissection doesn't handle vlan packets correctly. Vlan
doesn't exist in skb->data anymore when applying flow dissection on the
skb, fix that.
Fixes: 0744dd00c1b1 ('net: introduce skb_flow_dissect()')
Signed-off-by: Hadar Hen Zion <redacted>
Early in the datapath skb_vlan_untag function is called, stripped
the vlan from the skb and set skb->vlan_tci and skb->vlan_proto fields.
The current dissection doesn't handle vlan packets correctly. Vlan
doesn't exist in skb->data anymore when applying flow dissection on the
skb, fix that.
RPS (and flow-dissector called in RPS) is performed before vlan-strip in
__netif_receive_skb_core().
Also, in cases skb is tagged with multiple vlan headers (typical when
using 802.1ad), the second level vlan tag is in skb->data.
So I think you should handle both of skb->vlan_tci and skb->data cases.
Thanks,
Toshiaki Makita
nit: We could avoid the 'v->tcfv_push_prio' test, so user can explicitly
observe the associated priority, even if it is set to zero.
Reviewed-by: Shmulik Ladkani <redacted>
From: Hadar Hen Zion <hidden> Date: 2016-08-14 14:59:50
On Fri, Aug 12, 2016 at 9:36 AM, Toshiaki Makita
[off-list ref] wrote:
On 2016/08/10 22:32, Hadar Hen Zion wrote:
quoted
Early in the datapath skb_vlan_untag function is called, stripped
the vlan from the skb and set skb->vlan_tci and skb->vlan_proto fields.
The current dissection doesn't handle vlan packets correctly. Vlan
doesn't exist in skb->data anymore when applying flow dissection on the
skb, fix that.
RPS (and flow-dissector called in RPS) is performed before vlan-strip in
__netif_receive_skb_core().
right, I'll fix it to v2.
Also, in cases skb is tagged with multiple vlan headers (typical when
using 802.1ad), the second level vlan tag is in skb->data.
Currently, flow_dissector doesn't support multiple vlan headers, only
one vlan_id field is present.
There aren't any flow_dissector "customers" yet for multiple vlan support.
So I think you should handle both of skb->vlan_tci and skb->data cases.
On Fri, Aug 12, 2016 at 9:36 AM, Toshiaki Makita
[off-list ref] wrote:
quoted
On 2016/08/10 22:32, Hadar Hen Zion wrote:
quoted
Early in the datapath skb_vlan_untag function is called, stripped
the vlan from the skb and set skb->vlan_tci and skb->vlan_proto fields.
The current dissection doesn't handle vlan packets correctly. Vlan
doesn't exist in skb->data anymore when applying flow dissection on the
skb, fix that.
RPS (and flow-dissector called in RPS) is performed before vlan-strip in
__netif_receive_skb_core().
right, I'll fix it to v2.
quoted
Also, in cases skb is tagged with multiple vlan headers (typical when
using 802.1ad), the second level vlan tag is in skb->data.
Currently, flow_dissector doesn't support multiple vlan headers, only
one vlan_id field is present.
There aren't any flow_dissector "customers" yet for multiple vlan support.
Sure, no need to store second level vlan tag information for now.
The point is that current flow-dissector correctly skips any number of
vlan tags and get hash value from IP/TCP/UDP headers, so RPS works for
multiple vlan tagged packets.
Thanks,
Toshiaki Makita
From: Hadar Hen Zion <hidden> Date: 2016-08-15 15:51:40
On Mon, Aug 15, 2016 at 5:38 AM, Toshiaki Makita
[off-list ref] wrote:
On 16/08/14 (日) 23:58, Hadar Hen Zion wrote:
quoted
On Fri, Aug 12, 2016 at 9:36 AM, Toshiaki Makita
[off-list ref] wrote:
quoted
On 2016/08/10 22:32, Hadar Hen Zion wrote:
quoted
Early in the datapath skb_vlan_untag function is called, stripped
the vlan from the skb and set skb->vlan_tci and skb->vlan_proto fields.
The current dissection doesn't handle vlan packets correctly. Vlan
doesn't exist in skb->data anymore when applying flow dissection on the
skb, fix that.
RPS (and flow-dissector called in RPS) is performed before vlan-strip in
__netif_receive_skb_core().
right, I'll fix it to v2.
quoted
Also, in cases skb is tagged with multiple vlan headers (typical when
using 802.1ad), the second level vlan tag is in skb->data.
Currently, flow_dissector doesn't support multiple vlan headers, only
one vlan_id field is present.
There aren't any flow_dissector "customers" yet for multiple vlan support.
Sure, no need to store second level vlan tag information for now.
The point is that current flow-dissector correctly skips any number of vlan
tags and get hash value from IP/TCP/UDP headers, so RPS works for multiple
vlan tagged packets.
Thanks,
Toshiaki Makita
ok, so we are on the same page.
The flow dissector will correctly skip any number of vlans regardless
if the first vlan is stripped or not.
I also found a dependency between my vlan addition to flower and mlx5
tc offload support so I'm working to fix it for V2.
Thanks,
Hadar
Mon, Aug 15, 2016 at 05:51:38PM CEST, hadarh@dev.mellanox.co.il wrote:
On Mon, Aug 15, 2016 at 5:38 AM, Toshiaki Makita
[off-list ref] wrote:
quoted
On 16/08/14 (日) 23:58, Hadar Hen Zion wrote:
quoted
On Fri, Aug 12, 2016 at 9:36 AM, Toshiaki Makita
[off-list ref] wrote:
quoted
On 2016/08/10 22:32, Hadar Hen Zion wrote:
quoted
Early in the datapath skb_vlan_untag function is called, stripped
the vlan from the skb and set skb->vlan_tci and skb->vlan_proto fields.
The current dissection doesn't handle vlan packets correctly. Vlan
doesn't exist in skb->data anymore when applying flow dissection on the
skb, fix that.
RPS (and flow-dissector called in RPS) is performed before vlan-strip in
__netif_receive_skb_core().
right, I'll fix it to v2.
quoted
Also, in cases skb is tagged with multiple vlan headers (typical when
using 802.1ad), the second level vlan tag is in skb->data.
Currently, flow_dissector doesn't support multiple vlan headers, only
one vlan_id field is present.
There aren't any flow_dissector "customers" yet for multiple vlan support.
Sure, no need to store second level vlan tag information for now.
The point is that current flow-dissector correctly skips any number of vlan
tags and get hash value from IP/TCP/UDP headers, so RPS works for multiple
vlan tagged packets.
Thanks,
Toshiaki Makita
ok, so we are on the same page.
The flow dissector will correctly skip any number of vlans regardless
if the first vlan is stripped or not.
On RX the first vlan is always stripped either by hw or by skb_vlan_untag.
On TX the first vlan is also stripped as validate_xmit_skb_list which
pushes vlan header is called just before dev_hard_start_xmit.
So I believe you can safely work just with skb->vlan_*