* [PATCH net-next 0/8] Preparation for VLAN_TAG_PRESENT cleanup, drivers part
@ 2017-01-04 0:24 Michał Mirosław
2017-01-04 0:24 ` [PATCH net-next 2/8] benet: use skb_vlan_tag_get_prio() Michał Mirosław
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Michał Mirosław @ 2017-01-04 0:24 UTC (permalink / raw)
To: netdev
Cleanups needed before enabling passing of VLAN.CFI.
Those patches depend on '*** SUBJECT HERE ***' patchset, but
are otherwise independent of each other.
Michał Mirosław (8):
benet: use __vlan_hwaccel helpers
benet: use skb_vlan_tag_get_prio()
sky2: use __vlan_hwaccel helpers
net/core: use __vlan_hwaccel helpers
bridge: use __vlan_hwaccel helpers
8021q: use __vlan_hwaccel helpers
ipv4/tunnel: use __vlan_hwaccel helpers
OVS: remove use of VLAN_TAG_PRESENT
drivers/net/ethernet/emulex/benet/be_main.c | 15 ++++++++++-----
drivers/net/ethernet/marvell/sky2.c | 6 ++----
net/8021q/vlan_core.c | 2 +-
net/bridge/br_netfilter_hooks.c | 15 +++++++++------
net/bridge/br_private.h | 2 +-
net/bridge/br_vlan.c | 6 +++---
net/core/dev.c | 8 +++++---
net/core/skbuff.c | 2 +-
net/ipv4/ip_tunnel_core.c | 2 +-
net/openvswitch/actions.c | 13 +++++++++----
net/openvswitch/flow.c | 4 ++--
net/openvswitch/flow.h | 2 +-
net/openvswitch/flow_netlink.c | 22 +++++++++++-----------
net/sched/act_vlan.c | 2 +-
14 files changed, 57 insertions(+), 44 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH net-next 2/8] benet: use skb_vlan_tag_get_prio() 2017-01-04 0:24 [PATCH net-next 0/8] Preparation for VLAN_TAG_PRESENT cleanup, drivers part Michał Mirosław @ 2017-01-04 0:24 ` Michał Mirosław 2017-01-04 0:24 ` [PATCH net-next 3/8] sky2: use __vlan_hwaccel helpers Michał Mirosław ` (6 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michał Mirosław @ 2017-01-04 0:24 UTC (permalink / raw) To: netdev; +Cc: Ajit Khaparde Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index cd12c9a7664b..7e50c6c224c4 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -781,7 +781,7 @@ static inline u16 be_get_tx_vlan_tag(struct be_adapter *adapter, u16 vlan_tag; vlan_tag = skb_vlan_tag_get(skb); - vlan_prio = (vlan_tag & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; + vlan_prio = skb_vlan_tag_get_prio(skb); /* If vlan priority provided by OS is NOT in available bmap */ if (!(adapter->vlan_prio_bmap & (1 << vlan_prio))) vlan_tag = (vlan_tag & ~VLAN_PRIO_MASK) | -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 3/8] sky2: use __vlan_hwaccel helpers 2017-01-04 0:24 [PATCH net-next 0/8] Preparation for VLAN_TAG_PRESENT cleanup, drivers part Michał Mirosław 2017-01-04 0:24 ` [PATCH net-next 2/8] benet: use skb_vlan_tag_get_prio() Michał Mirosław @ 2017-01-04 0:24 ` Michał Mirosław 2017-01-04 0:24 ` [PATCH net-next 1/8] benet: " Michał Mirosław ` (5 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michał Mirosław @ 2017-01-04 0:24 UTC (permalink / raw) To: netdev; +Cc: Mirko Lindner, Stephen Hemminger Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- drivers/net/ethernet/marvell/sky2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index b60ad0e56a9f..bcd20e04caba 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c @@ -2485,13 +2485,11 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2, skb->ip_summed = re->skb->ip_summed; skb->csum = re->skb->csum; skb_copy_hash(skb, re->skb); - skb->vlan_proto = re->skb->vlan_proto; - skb->vlan_tci = re->skb->vlan_tci; + __vlan_hwaccel_copy_tag(skb, re->skb); pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, length, PCI_DMA_FROMDEVICE); - re->skb->vlan_proto = 0; - re->skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(re->skb); skb_clear_hash(re->skb); re->skb->ip_summed = CHECKSUM_NONE; skb_put(skb, length); -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 1/8] benet: use __vlan_hwaccel helpers 2017-01-04 0:24 [PATCH net-next 0/8] Preparation for VLAN_TAG_PRESENT cleanup, drivers part Michał Mirosław 2017-01-04 0:24 ` [PATCH net-next 2/8] benet: use skb_vlan_tag_get_prio() Michał Mirosław 2017-01-04 0:24 ` [PATCH net-next 3/8] sky2: use __vlan_hwaccel helpers Michał Mirosław @ 2017-01-04 0:24 ` Michał Mirosław 2017-01-04 0:24 ` [PATCH net-next 4/8] net/core: " Michał Mirosław ` (4 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michał Mirosław @ 2017-01-04 0:24 UTC (permalink / raw) To: netdev; +Cc: Ajit Khaparde Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- v3: fix adapter->pvid handling drivers/net/ethernet/emulex/benet/be_main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 7e1633bf5a22..cd12c9a7664b 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -1035,30 +1035,35 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter, struct be_wrb_params *wrb_params) { + bool insert_vlan = false; u16 vlan_tag = 0; skb = skb_share_check(skb, GFP_ATOMIC); if (unlikely(!skb)) return skb; - if (skb_vlan_tag_present(skb)) + if (skb_vlan_tag_present(skb)) { vlan_tag = be_get_tx_vlan_tag(adapter, skb); + insert_vlan = true; + } if (qnq_async_evt_rcvd(adapter) && adapter->pvid) { - if (!vlan_tag) + if (!insert_vlan) { vlan_tag = adapter->pvid; + insert_vlan = true; + } /* f/w workaround to set skip_hw_vlan = 1, informs the F/W to * skip VLAN insertion */ BE_WRB_F_SET(wrb_params->features, VLAN_SKIP_HW, 1); } - if (vlan_tag) { + if (insert_vlan) { skb = vlan_insert_tag_set_proto(skb, htons(ETH_P_8021Q), vlan_tag); if (unlikely(!skb)) return skb; - skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(skb); } /* Insert the outer VLAN, if any */ -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 4/8] net/core: use __vlan_hwaccel helpers 2017-01-04 0:24 [PATCH net-next 0/8] Preparation for VLAN_TAG_PRESENT cleanup, drivers part Michał Mirosław ` (2 preceding siblings ...) 2017-01-04 0:24 ` [PATCH net-next 1/8] benet: " Michał Mirosław @ 2017-01-04 0:24 ` Michał Mirosław 2017-01-04 0:24 ` [PATCH net-next 7/8] ipv4/tunnel: " Michał Mirosław ` (3 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michał Mirosław @ 2017-01-04 0:24 UTC (permalink / raw) To: netdev; +Cc: David S. Miller, Jamal Hadi Salim This removes assumptions about VLAN_TAG_PRESENT bit. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- net/core/dev.c | 8 +++++--- net/core/skbuff.c | 2 +- net/sched/act_vlan.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 56818f7eab2b..3e2d617970e4 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4172,7 +4172,7 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc) * and set skb->priority like in vlan_do_receive() * For the time being, just ignore Priority Code Point */ - skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(skb); } type = skb->protocol; @@ -4419,7 +4419,9 @@ static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb) } diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev; - diffs |= p->vlan_tci ^ skb->vlan_tci; + diffs |= skb_vlan_tag_present(p) ^ skb_vlan_tag_present(skb); + if (skb_vlan_tag_present(p)) + diffs |= p->vlan_tci ^ skb->vlan_tci; diffs |= skb_metadata_dst_cmp(p, skb); if (maclen == ETH_HLEN) diffs |= compare_ether_header(skb_mac_header(p), @@ -4657,7 +4659,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) __skb_pull(skb, skb_headlen(skb)); /* restore the reserve we had after netdev_alloc_skb_ip_align() */ skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN - skb_headroom(skb)); - skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(skb); skb->dev = napi->dev; skb->skb_iif = 0; skb->encapsulation = 0; diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 5a03730fbc1a..4b2aba3a28b2 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4565,7 +4565,7 @@ int skb_vlan_pop(struct sk_buff *skb) int err; if (likely(skb_vlan_tag_present(skb))) { - skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(skb); } else { if (unlikely(!eth_type_vlan(skb->protocol))) return 0; diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 19e0dba305ce..8d563806f518 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -62,7 +62,7 @@ static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a, /* extract existing tag (and guarantee no hw-accel tag) */ if (skb_vlan_tag_present(skb)) { tci = skb_vlan_tag_get(skb); - skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(skb); } else { /* in-payload vlan tag, pop it */ err = __skb_vlan_pop(skb, &tci); -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 7/8] ipv4/tunnel: use __vlan_hwaccel helpers 2017-01-04 0:24 [PATCH net-next 0/8] Preparation for VLAN_TAG_PRESENT cleanup, drivers part Michał Mirosław ` (3 preceding siblings ...) 2017-01-04 0:24 ` [PATCH net-next 4/8] net/core: " Michał Mirosław @ 2017-01-04 0:24 ` Michał Mirosław 2017-01-04 0:24 ` [PATCH net-next 5/8] bridge: " Michał Mirosław ` (2 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michał Mirosław @ 2017-01-04 0:24 UTC (permalink / raw) To: netdev Cc: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- net/ipv4/ip_tunnel_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index fed3d29f9eb3..0004a54373f0 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c @@ -120,7 +120,7 @@ int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len, } skb_clear_hash_if_not_l4(skb); - skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(skb); skb_set_queue_mapping(skb, 0); skb_scrub_packet(skb, xnet); -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 5/8] bridge: use __vlan_hwaccel helpers 2017-01-04 0:24 [PATCH net-next 0/8] Preparation for VLAN_TAG_PRESENT cleanup, drivers part Michał Mirosław ` (4 preceding siblings ...) 2017-01-04 0:24 ` [PATCH net-next 7/8] ipv4/tunnel: " Michał Mirosław @ 2017-01-04 0:24 ` Michał Mirosław 2017-01-04 0:24 ` [PATCH net-next 6/8] 8021q: " Michał Mirosław [not found] ` <cover.1483488960.git.mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org> 7 siblings, 0 replies; 9+ messages in thread From: Michał Mirosław @ 2017-01-04 0:24 UTC (permalink / raw) To: netdev Cc: bridge, netfilter-devel, Jozsef Kadlecsik, Patrick McHardy, Pablo Neira Ayuso This removes assumption than vlan_tci != 0 when tag is present. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- net/bridge/br_netfilter_hooks.c | 15 +++++++++------ net/bridge/br_private.h | 2 +- net/bridge/br_vlan.c | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c index 8ca6a929bf12..b62177a980e1 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -682,10 +682,8 @@ static int br_nf_push_frag_xmit(struct net *net, struct sock *sk, struct sk_buff return 0; } - if (data->vlan_tci) { - skb->vlan_tci = data->vlan_tci; - skb->vlan_proto = data->vlan_proto; - } + if (data->vlan_proto) + __vlan_hwaccel_put_tag(skb, data->vlan_proto, data->vlan_tci); skb_copy_to_linear_data_offset(skb, -data->size, data->mac, data->size); __skb_push(skb, data->encap_size); @@ -749,8 +747,13 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff data = this_cpu_ptr(&brnf_frag_data_storage); - data->vlan_tci = skb->vlan_tci; - data->vlan_proto = skb->vlan_proto; + if (skb_vlan_tag_present(skb)) { + data->vlan_tci = skb->vlan_tci; + data->vlan_proto = skb->vlan_proto; + } else { + data->vlan_proto = 0; + } + data->encap_size = nf_bridge_encap_header_len(skb); data->size = ETH_HLEN + data->encap_size; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 8ce621e8345c..2efbdaf9ae1b 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -819,7 +819,7 @@ static inline int br_vlan_get_tag(const struct sk_buff *skb, u16 *vid) int err = 0; if (skb_vlan_tag_present(skb)) { - *vid = skb_vlan_tag_get(skb) & VLAN_VID_MASK; + *vid = skb_vlan_tag_get_id(skb); } else { *vid = 0; err = -EINVAL; diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index b6de4f457161..d25a5b34dc76 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -377,7 +377,7 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br, } if (v->flags & BRIDGE_VLAN_INFO_UNTAGGED) - skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(skb); out: return skb; } @@ -444,8 +444,8 @@ static bool __allowed_ingress(const struct net_bridge *br, __vlan_hwaccel_put_tag(skb, br->vlan_proto, pvid); else /* Priority-tagged Frame. - * At this point, We know that skb->vlan_tci had - * VLAN_TAG_PRESENT bit and its VID field was 0x000. + * At this point, we know that skb->vlan_tci VID + * field was 0. * We update only VID field and preserve PCP field. */ skb->vlan_tci |= pvid; -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 6/8] 8021q: use __vlan_hwaccel helpers 2017-01-04 0:24 [PATCH net-next 0/8] Preparation for VLAN_TAG_PRESENT cleanup, drivers part Michał Mirosław ` (5 preceding siblings ...) 2017-01-04 0:24 ` [PATCH net-next 5/8] bridge: " Michał Mirosław @ 2017-01-04 0:24 ` Michał Mirosław [not found] ` <cover.1483488960.git.mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org> 7 siblings, 0 replies; 9+ messages in thread From: Michał Mirosław @ 2017-01-04 0:24 UTC (permalink / raw) To: netdev; +Cc: Patrick McHardy Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- net/8021q/vlan_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index e2ed69850489..604a67abdeb6 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -50,7 +50,7 @@ bool vlan_do_receive(struct sk_buff **skbp) } skb->priority = vlan_get_ingress_priority(vlan_dev, skb->vlan_tci); - skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(skb); rx_stats = this_cpu_ptr(vlan_dev_priv(vlan_dev)->vlan_pcpu_stats); -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
[parent not found: <cover.1483488960.git.mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org>]
* [PATCH net-next 8/8] OVS: remove use of VLAN_TAG_PRESENT [not found] ` <cover.1483488960.git.mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org> @ 2017-01-04 0:24 ` Michał Mirosław 0 siblings, 0 replies; 9+ messages in thread From: Michał Mirosław @ 2017-01-04 0:24 UTC (permalink / raw) To: netdev-u79uwXL29TY76Z2rM5mHXA; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, Jiri Benc This is a minimal change to allow removing of VLAN_TAG_PRESENT. It leaves OVS unable to use CFI bit, as fixing this would need a deeper surgery involving userspace interface. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- v2: removed userspace-facing changes net/openvswitch/actions.c | 13 +++++++++---- net/openvswitch/flow.c | 4 ++-- net/openvswitch/flow.h | 2 +- net/openvswitch/flow_netlink.c | 22 +++++++++++----------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 514f7bcf7c63..fb41833423ea 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -278,7 +278,7 @@ static int push_vlan(struct sk_buff *skb, struct sw_flow_key *key, key->eth.vlan.tpid = vlan->vlan_tpid; } return skb_vlan_push(skb, vlan->vlan_tpid, - ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT); + ntohs(vlan->vlan_tci) & ~VLAN_CFI_MASK); } /* 'src' is already properly masked. */ @@ -704,8 +704,10 @@ static int ovs_vport_output(struct net *net, struct sock *sk, struct sk_buff *sk __skb_dst_copy(skb, data->dst); *OVS_CB(skb) = data->cb; skb->inner_protocol = data->inner_protocol; - skb->vlan_tci = data->vlan_tci; - skb->vlan_proto = data->vlan_proto; + if (data->vlan_tci & VLAN_CFI_MASK) + __vlan_hwaccel_put_tag(skb, data->vlan_proto, data->vlan_tci & ~VLAN_CFI_MASK); + else + __vlan_hwaccel_clear_tag(skb); /* Reconstruct the MAC header. */ skb_push(skb, data->l2_len); @@ -749,7 +751,10 @@ static void prepare_frag(struct vport *vport, struct sk_buff *skb, data->cb = *OVS_CB(skb); data->inner_protocol = skb->inner_protocol; data->network_offset = orig_network_offset; - data->vlan_tci = skb->vlan_tci; + if (skb_vlan_tag_present(skb)) + data->vlan_tci = skb_vlan_tag_get(skb) | VLAN_CFI_MASK; + else + data->vlan_tci = 0; data->vlan_proto = skb->vlan_proto; data->mac_proto = mac_proto; data->l2_len = hlen; diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 2c0a00f7f1b7..e632de603081 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c @@ -328,7 +328,7 @@ static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh, return -ENOMEM; vh = (struct vlan_head *)skb->data; - key_vh->tci = vh->tci | htons(VLAN_TAG_PRESENT); + key_vh->tci = vh->tci | htons(VLAN_CFI_MASK); key_vh->tpid = vh->tpid; if (unlikely(untag_vlan)) { @@ -361,7 +361,7 @@ static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key) int res; if (skb_vlan_tag_present(skb)) { - key->eth.vlan.tci = htons(skb->vlan_tci); + key->eth.vlan.tci = htons(skb->vlan_tci) | htons(VLAN_CFI_MASK); key->eth.vlan.tpid = skb->vlan_proto; } else { /* Parse outer vlan tag in the non-accelerated case. */ diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h index f61cae7f9030..c8724ca2e4c3 100644 --- a/net/openvswitch/flow.h +++ b/net/openvswitch/flow.h @@ -58,7 +58,7 @@ struct ovs_tunnel_info { struct vlan_head { __be16 tpid; /* Vlan type. Generally 802.1q or 802.1ad.*/ - __be16 tci; /* 0 if no VLAN, VLAN_TAG_PRESENT set otherwise. */ + __be16 tci; /* 0 if no VLAN, VLAN_CFI_MASK set otherwise. */ }; #define OVS_SW_FLOW_KEY_METADATA_SIZE \ diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index c87d359b9b37..05a31950f69c 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c @@ -853,9 +853,9 @@ static int validate_vlan_from_nlattrs(const struct sw_flow_match *match, if (a[OVS_KEY_ATTR_VLAN]) tci = nla_get_be16(a[OVS_KEY_ATTR_VLAN]); - if (!(tci & htons(VLAN_TAG_PRESENT))) { + if (!(tci & htons(VLAN_CFI_MASK))) { if (tci) { - OVS_NLERR(log, "%s TCI does not have VLAN_TAG_PRESENT bit set.", + OVS_NLERR(log, "%s TCI does not have VLAN_CFI_MASK bit set.", (inner) ? "C-VLAN" : "VLAN"); return -EINVAL; } else if (nla_len(a[OVS_KEY_ATTR_ENCAP])) { @@ -876,9 +876,9 @@ static int validate_vlan_mask_from_nlattrs(const struct sw_flow_match *match, __be16 tci = 0; __be16 tpid = 0; bool encap_valid = !!(match->key->eth.vlan.tci & - htons(VLAN_TAG_PRESENT)); + htons(VLAN_CFI_MASK)); bool i_encap_valid = !!(match->key->eth.cvlan.tci & - htons(VLAN_TAG_PRESENT)); + htons(VLAN_CFI_MASK)); if (!(key_attrs & (1 << OVS_KEY_ATTR_ENCAP))) { /* Not a VLAN. */ @@ -902,8 +902,8 @@ static int validate_vlan_mask_from_nlattrs(const struct sw_flow_match *match, (inner) ? "C-VLAN" : "VLAN", ntohs(tpid)); return -EINVAL; } - if (!(tci & htons(VLAN_TAG_PRESENT))) { - OVS_NLERR(log, "%s TCI mask does not have exact match for VLAN_TAG_PRESENT bit.", + if (!(tci & htons(VLAN_CFI_MASK))) { + OVS_NLERR(log, "%s TCI mask does not have exact match for VLAN_CFI_MASK bit.", (inner) ? "C-VLAN" : "VLAN"); return -EINVAL; } @@ -958,7 +958,7 @@ static int parse_vlan_from_nlattrs(struct sw_flow_match *match, if (err) return err; - encap_valid = !!(match->key->eth.vlan.tci & htons(VLAN_TAG_PRESENT)); + encap_valid = !!(match->key->eth.vlan.tci & htons(VLAN_CFI_MASK)); if (encap_valid) { err = __parse_vlan_from_nlattrs(match, key_attrs, true, a, is_mask, log); @@ -2445,7 +2445,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, vlan = nla_data(a); if (!eth_type_vlan(vlan->vlan_tpid)) return -EINVAL; - if (!(vlan->vlan_tci & htons(VLAN_TAG_PRESENT))) + if (!(vlan->vlan_tci & htons(VLAN_CFI_MASK))) return -EINVAL; vlan_tci = vlan->vlan_tci; break; @@ -2461,7 +2461,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, /* Prohibit push MPLS other than to a white list * for packets that have a known tag order. */ - if (vlan_tci & htons(VLAN_TAG_PRESENT) || + if (vlan_tci & htons(VLAN_CFI_MASK) || (eth_type != htons(ETH_P_IP) && eth_type != htons(ETH_P_IPV6) && eth_type != htons(ETH_P_ARP) && @@ -2473,7 +2473,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, } case OVS_ACTION_ATTR_POP_MPLS: - if (vlan_tci & htons(VLAN_TAG_PRESENT) || + if (vlan_tci & htons(VLAN_CFI_MASK) || !eth_p_mpls(eth_type)) return -EINVAL; @@ -2531,7 +2531,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, case OVS_ACTION_ATTR_POP_ETH: if (mac_proto != MAC_PROTO_ETHERNET) return -EINVAL; - if (vlan_tci & htons(VLAN_TAG_PRESENT)) + if (vlan_tci & htons(VLAN_CFI_MASK)) return -EINVAL; mac_proto = MAC_PROTO_ETHERNET; break; -- 2.11.0 _______________________________________________ dev mailing list dev@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-01-04 0:24 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04 0:24 [PATCH net-next 0/8] Preparation for VLAN_TAG_PRESENT cleanup, drivers part Michał Mirosław
2017-01-04 0:24 ` [PATCH net-next 2/8] benet: use skb_vlan_tag_get_prio() Michał Mirosław
2017-01-04 0:24 ` [PATCH net-next 3/8] sky2: use __vlan_hwaccel helpers Michał Mirosław
2017-01-04 0:24 ` [PATCH net-next 1/8] benet: " Michał Mirosław
2017-01-04 0:24 ` [PATCH net-next 4/8] net/core: " Michał Mirosław
2017-01-04 0:24 ` [PATCH net-next 7/8] ipv4/tunnel: " Michał Mirosław
2017-01-04 0:24 ` [PATCH net-next 5/8] bridge: " Michał Mirosław
2017-01-04 0:24 ` [PATCH net-next 6/8] 8021q: " Michał Mirosław
[not found] ` <cover.1483488960.git.mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org>
2017-01-04 0:24 ` [PATCH net-next 8/8] OVS: remove use of VLAN_TAG_PRESENT Michał Mirosław
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox