On 6/8/15 11:45 PM, Pravin Shelar wrote:
On Tue, Jun 2, 2015 at 10:50 AM, Thomas F Herbert
<thomasfherb...@gmail.com> wrote:
Add support for 802.1ad to netlink parsing and flow conversation. Uses
double nested encap attributes to represent double tagged vlan.

This patch needs to be merged with earlier patch since it is part of
qinq support.

Signed-off-by: Thomas F Herbert <thomasfherb...@gmail.com>
---
  net/openvswitch/flow_netlink.c | 186 ++++++++++++++++++++++++++++++++++-------
  1 file changed, 157 insertions(+), 29 deletions(-)

diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index c691b1a..8fd4f63 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -771,6 +771,28 @@ static int metadata_from_nlattrs(struct sw_flow_match 
*match,  u64 *attrs,
...
                 err = ovs_key_from_nlattrs(match, mask_attrs, a, true, log);
@@ -1331,6 +1439,25 @@ static int __ovs_nla_put_key(const struct sw_flow_key 
*swkey,
                 encap = nla_nest_start(skb, OVS_KEY_ATTR_ENCAP);
                 if (!swkey->eth.tci)
                         goto unencap;
+       } else if (swkey->eth.ctci || swkey->eth.type == htons(ETH_P_8021AD)) {
+               __be16 eth_type;
+
+               eth_type = !is_mask ? htons(ETH_P_8021AD) : htons(0xffff);
+               if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, eth_type) ||
+                   nla_put_be16(skb, OVS_KEY_ATTR_VLAN, output->eth.tci))
+                       goto nla_put_failure;
+               encap = nla_nest_start(skb, OVS_KEY_ATTR_ENCAP);
+               if (!swkey->eth.tci)
+                       goto unencap;
+               /* Customer tci is nested but uses same key attribute.
+                */
+               eth_type = !is_mask ? htons(ETH_P_8021Q) : htons(0xffff);
+               if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, eth_type) ||
+                   nla_put_be16(skb, OVS_KEY_ATTR_VLAN, output->eth.ctci))
+                       goto nla_put_failure;
+               encap = nla_nest_start(skb, OVS_KEY_ATTR_ENCAP);
+               if (!swkey->eth.ctci)
+                       goto unencap;
         } else
                 encap = NULL;

For qinq we need to keep track of two encap attributes to finalize
nesting of attributes.
Thanks! This was an oversight on my part and I am fixing it in V11.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to