enable ovs 2.6.1 with NSH

1. port from https://github.com/yyang13/ovs_nsh_patches/
2. todo: ovs 2.6.1 with NSH & DPDK 16.07

Change-Id: If887bdf072e891d2220b37c34ea7aac433fa8d66
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
This commit is contained in:
Guo Ruijing 2016-12-20 17:56:39 -05:00
parent a8f78d202d
commit db6380e405
14 changed files with 2127 additions and 3878 deletions

View File

@ -10,19 +10,21 @@ nsh=$2
dpdk=$3
dpdk_socket_mem=${4:-''}
apt-get install -y dkms
if [ $nsh = 'true' ]
then
curl http://$host:8080/plugins/fuel-plugin-ovs-1.0/repositories/ubuntu/ovs-nsh-dpdk.tar.gz | tar -xzv
dpkg -i openvswitch-datapath-dkms_2.5.90-1.nsh_all.deb
dpkg -i openvswitch-common_2.5.90-1.nsh_amd64.deb
dpkg -i openvswitch-switch_2.5.90-1.nsh_amd64.deb
dpkg -i python-openvswitch_2.5.90-1.nsh_all.deb
dpkg -i openvswitch-datapath-dkms_2.6.1-1.nsh_all.deb
dpkg -i openvswitch-common_2.6.1-1.nsh_amd64.deb
dpkg -i openvswitch-switch_2.6.1-1.nsh_amd64.deb
dpkg -i python-openvswitch_2.6.1-1.nsh_all.deb
if [ $dpdk = 'true' ]
then
dpkg -i libxenstore3.0*.deb
dpkg -i libdpdk0_2.2.0-1_amd64.deb
dpkg -i dpdk_2.2.0-1_amd64.deb
dpkg -i openvswitch-switch-dpdk_2.5.90-1.nsh_amd64.deb
dpkg -i openvswitch-switch-dpdk_2.6.1-1.nsh_amd64.deb
fi
else
curl http://$host:8080/plugins/fuel-plugin-ovs-1.0/repositories/ubuntu/ovs-dpdk.tar.gz | tar -xzv

View File

@ -2,100 +2,47 @@
set -eux
OVS_COMMIT=7d433ae57ebb90cd68e8fa948a096f619ac4e2d8
OVS_COMMIT=f4b0e64cffb4777ff03d48621c3eadcf1d8c19f3
URL_OVS=https://github.com/openvswitch/ovs.git
OVS_VER=${OVS_VER:-2.5.90}
OVS_VER=${OVS_VER:-2.6.1}
BUILD_HOME=$HOME/nsh
BUILD_DEST=${BUILD_DEST:-/deb}
DIR="$(dirname `readlink -f $0`)"
export DEB_BUILD_OPTIONS='parallel=8 nocheck'
sudo apt-get build-dep openvswitch -y
sudo apt-get -y install devscripts dpkg-dev git wget
rm -rf ${BUILD_HOME}; mkdir -p ${BUILD_HOME}
cd ${BUILD_HOME}
wget -c https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.dsc
wget -c https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0.orig.tar.gz
wget -c https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.debian.tar.xz
dpkg-source -x dpdk_2.2.0-0ubuntu8.dsc
# copy from debian/control
sudo apt-get install -y debhelper \
dh-python \
dh-systemd \
doxygen \
graphviz \
inkscape \
libcap-dev \
libpcap-dev \
libxen-dev \
libxenstore3.0 \
python \
python-sphinx \
texlive-fonts-recommended \
texlive-latex-extra
cd dpdk-2.2.0; rm -rf debian/patches/;
cat << EOF > debian/changelog
dpdk (2.2.0-1) unstable; urgency=low
* DPDK 2.2.0
-- DPDK team <dev@dpdk.org> $(date --rfc-2822)
EOF
debian/rules build; fakeroot debian/rules binary
cd ${BUILD_HOME}; sudo dpkg -i *.deb
apt-get download libxenstore3.0
cd ${BUILD_HOME}
wget -c https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0.orig.tar.gz
wget -c https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.dsc
wget -c https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.debian.tar.xz
dpkg-source -x openvswitch-dpdk_2.4.0-0ubuntu1.dsc
# copy from debian/control
sudo apt-get install -y autoconf \
sudo apt-get install -y \
graphviz \
autoconf \
automake \
bzip2 \
debhelper \
dh-autoreconf \
dh-systemd \
graphviz \
libdpdk-dev \
libfuse-dev \
libssl-dev \
libtool \
openssl \
procps \
python-all \
python-qt4 \
python-twisted-conch \
python-zopeinterface \
python-six
git clone https://github.com/openvswitch/ovs.git
cd ovs; git checkout ${OVS_COMMIT}
PATCHES=$(cd ${DIR}/patches; echo *patch)
PATCHES=$(cd ${DIR}/ovs_nsh_patches/v2.6.1/; echo *patch)
for patch in ${PATCHES}
do
patch -p1 < ${DIR}/patches/${patch}
patch -p1 < ${DIR}/ovs_nsh_patches/v2.6.1/${patch}
done
cd ${BUILD_HOME}; tar czvf ovs.tar.gz ovs
rm -rf openvswitch-dpdk-${OVS_VER}*
cd openvswitch-dpdk-2.4.0; uupdate -v ${OVS_VER} ../ovs.tar.gz
cd ../openvswitch-dpdk-${OVS_VER}
sed -i "s/include\/rte_config.h/include\/dpdk\/rte_config.h/" acinclude.m4
sed -i 's/DPDK_INCLUDE=.*/DPDK_INCLUDE=$RTE_SDK\/include\/dpdk/' acinclude.m4
autoreconf --install
rm -rf debian/patches/ .git;
cat << EOF > debian/changelog
openvswitch-dpdk (${OVS_VER}-1.nsh) unstable; urgency=low
* Support NSH
-- Open vSwitch team <dev@openvswitch.org> $(date --rfc-2822)
EOF
debian/rules build; fakeroot debian/rules binary
# build ovs
cd ${BUILD_HOME}/ovs
cat << EOF > debian/changelog
openvswitch (${OVS_VER}-1.nsh) unstable; urgency=low

View File

@ -1,34 +1,31 @@
From 5d79831435ec4e5bea20cc36c3f83eacf6fd065c Mon Sep 17 00:00:00 2001
From 9f7148f9dc03053a4a3231a7cf819c447a178a17 Mon Sep 17 00:00:00 2001
From: Yi Yang <yi.y.yang@intel.com>
Date: Mon, 11 Apr 2016 15:58:14 +0800
Subject: [PATCH 1/6] ovs-vxlan-gpe: vxlan extension to support vxlan-gpe
tunnel port
Date: Fri, 11 Nov 2016 11:13:18 +0800
Subject: [PATCH 1/8] Enable current VxLAN-gpe work and meet NSH requirements
Signed-off-by: Mengke Liu <mengke.liu@intel.com>
Signed-off-by: Ricky Li <ricky.li@intel.com>
Signed-off-by: Johnson Li <johnson.li@intel.com>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
datapath/flow_netlink.c | 8 +-
datapath/linux/compat/include/linux/openvswitch.h | 1 +
datapath/linux/compat/include/net/vxlan.h | 73 +++++++++++++++++++
datapath/linux/compat/vxlan.c | 30 ++++++++
datapath/linux/compat/include/net/vxlan.h | 1 +
datapath/linux/compat/vxlan.c | 4 +-
datapath/vport-netdev.c | 3 +-
datapath/vport-vxlan.c | 15 ++++
include/openvswitch/match.h | 4 +
include/openvswitch/meta-flow.h | 28 +++++++
include/openvswitch/packets.h | 4 +-
lib/flow.c | 8 ++
lib/match.c | 34 +++++++++
lib/match.h | 4 +
lib/meta-flow.c | 36 +++++++++
lib/meta-flow.h | 28 +++++++
lib/netdev-vport.c | 2 +
lib/nx-match.c | 4 +
lib/odp-util.c | 89 ++++++++++++++++++++++-
lib/packets.h | 4 +-
tests/ofproto.at | 4 +-
tests/ovs-ofctl.at | 4 +
16 files changed, 340 insertions(+), 4 deletions(-)
17 files changed, 241 insertions(+), 8 deletions(-)
diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
index 6ffcc53..351a504 100644
index 0f32664..2dcae07 100644
--- a/datapath/flow_netlink.c
+++ b/datapath/flow_netlink.c
@@ -309,6 +309,7 @@ size_t ovs_key_attr_size(void)
@ -39,7 +36,7 @@ index 6ffcc53..351a504 100644
};
static const struct ovs_len_tbl ovs_tunnel_key_lens[OVS_TUNNEL_KEY_ATTR_MAX + 1] = {
@@ -521,6 +522,9 @@ static int vxlan_tun_opt_from_nlattr(const struct nlattr *attr,
@@ -523,6 +524,9 @@ static int vxlan_tun_opt_from_nlattr(const struct nlattr *attr,
case OVS_VXLAN_EXT_GBP:
opts.gbp = nla_get_u32(a);
break;
@ -49,7 +46,7 @@ index 6ffcc53..351a504 100644
default:
OVS_NLERR(log, "Unknown VXLAN extension attribute %d",
type);
@@ -677,7 +681,9 @@ static int vxlan_opt_to_nlattr(struct sk_buff *skb,
@@ -709,7 +713,9 @@ static int vxlan_opt_to_nlattr(struct sk_buff *skb,
if (!nla)
return -EMSGSIZE;
@ -61,10 +58,10 @@ index 6ffcc53..351a504 100644
nla_nest_end(skb, nla);
diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h
index 3b39ebb..44adb81 100644
index 12260d8..44b7ce4 100644
--- a/datapath/linux/compat/include/linux/openvswitch.h
+++ b/datapath/linux/compat/include/linux/openvswitch.h
@@ -287,6 +287,7 @@ enum ovs_vport_attr {
@@ -291,6 +291,7 @@ enum ovs_vport_attr {
enum {
OVS_VXLAN_EXT_UNSPEC,
OVS_VXLAN_EXT_GBP, /* Flag or __u32 */
@ -73,172 +70,57 @@ index 3b39ebb..44adb81 100644
};
diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h
index 75a5a7a..2bfc3f8 100644
index 5bc8969..5a994b2 100644
--- a/datapath/linux/compat/include/net/vxlan.h
+++ b/datapath/linux/compat/include/net/vxlan.h
@@ -84,6 +84,75 @@ struct vxlanhdr_gbp {
#define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16)
#define VXLAN_GBP_ID_MASK (0xFFFF)
@@ -201,6 +201,7 @@ reserved_flags2:2;
+/*
+ * VXLAN Generic Protocol Extension Extension:
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |R|R|Ver|I|P|R|O|R|R|R|R|R|R|R|R|R|R|R|R|R|R|R|R| Next Proto |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | VXLAN Network Identifier (VNI) | Reserved |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * Ver = Version. Indicates VXLAN GPE protocol version. The initial
+ * version is 0. If a receiver does not support the version
+ * indicated it MUST drop the packet.
+ *
+ * I = Instance Bit. The I bit MUST be set to indicate a valid VNI.
+ *
+ * P = Next Protocol Bit. The P bit is set to indicate that the
+ * Next Protocol field is present.
+ *
+ * O = OAM Flag Bit. The O bit is set to indicate that the packet
+ * is an OAM packet.
+ *
+ * [1] https://www.ietf.org/id/draft-ietf-nvo3-vxlan-gpe-01.txt
+ */
+
+struct vxlanhdr_gpe {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+ uint8_t oam_flag:1;
+ uint8_t reserved_flags1:1;
+ uint8_t np_applied:1;
+ uint8_t instance_applied:1;
+ uint8_t gpe_version:2;
+ uint8_t reserved_flags2:2;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+ uint8_t reserved_flags2:2;
+ uint8_t gpe_version:2;
+ uint8_t instance_applied:1;
+ uint8_t np_applied:1;
+ uint8_t reserved_flags1:1;
+ uint8_t oam_flag:1;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+ uint8_t reserved_flags3;
+ uint8_t reserved_flags4;
+ uint8_t next_proto;
+ __be32 vx_vni;
+};
+
+/* VxLAN-GPE Header Next Protocol */
+#define VXLAN_GPE_NP_IPV4 0x01
+#define VXLAN_GPE_NP_IPV6 0x02
+#define VXLAN_GPE_NP_ETHERNET 0x03
+#define VXLAN_GPE_NP_NSH 0x04
+
+/* skb->mark mapping
+ *
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |R|R|Ver|I|P|R|O|R|R|R|R|R|R|R|R|R|R|R|R|R|R|R|R| Next Proto |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
+#define VXLAN_GPE_OAM_FLAG (BIT(0) << 24)
+#define VXLAN_GPE_NP_APPLIED (BIT(0) << 26)
+#define VXLAN_GPE_INSTANCE_APPLIED (BIT(0) << 27)
+#define VXLAN_GPE_VERSION ((BIT(0) << 28) | (BIT(0) << 29))
+
+#define VXLAN_GPE_NP_MASK (0xFF)
+
+#define VXLAN_GPE_USED_BITS (VXLAN_GPE_OAM_FLAG | VXLAN_GPE_NP_APPLIED \
+ | VXLAN_GPE_INSTANCE_APPLIED | VXLAN_GPE_VERSION | 0xFF)
+
/* VXLAN protocol header:
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |G|R|R|R|I|R|R|C| Reserved |
@@ -104,6 +173,7 @@ struct vxlanhdr {
#define VXLAN_HF_RCO BIT(21)
#define VXLAN_HF_VNI BIT(27)
#define VXLAN_HF_GBP BIT(31)
+#define VXLAN_HF_GPE BIT(26)
/* Remote checksum offload header option */
#define VXLAN_RCO_MASK 0x7f /* Last byte of vni field */
@@ -120,6 +190,7 @@ struct vxlanhdr {
struct vxlan_metadata {
__be32 vni;
u32 gbp;
+ u32 gpe;
u32 gbp;
+ u32 gpe;
};
#define VNI_HASH_BITS 10
@@ -205,11 +276,13 @@ struct vxlan_dev {
#define VXLAN_F_GBP 0x800
#define VXLAN_F_REMCSUM_NOPARTIAL 0x1000
#define VXLAN_F_COLLECT_METADATA 0x2000
+#define VXLAN_F_GPE 0x4000
/* Flags that are used in the receive path. These flags must match in
* order for a socket to be shareable
*/
#define VXLAN_F_RCV_FLAGS (VXLAN_F_GBP | \
+ VXLAN_F_GPE | \
VXLAN_F_UDP_ZERO_CSUM6_RX | \
VXLAN_F_REMCSUM_RX | \
VXLAN_F_REMCSUM_NOPARTIAL | \
/* per UDP socket information */
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 4faa18f..7ef051c 100644
index d5dbe8d..a80610b 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -971,6 +971,18 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
md->gbp |= VXLAN_GBP_POLICY_APPLIED;
flags &= ~VXLAN_GBP_USED_BITS;
+ } else if ((flags & VXLAN_HF_GPE) && (vs->flags & VXLAN_F_GPE)) {
+ struct vxlanhdr_gpe *gpe;
+
+ gpe = (struct vxlanhdr_gpe *)vxh;
+ md->gpe = ntohs(gpe->next_proto);
+
+ buf.dst.u.tun_info.key.tun_flags |= TUNNEL_VXLAN_OPT;
+
+ if (gpe->oam_flag)
+ md->gpe |= VXLAN_GPE_OAM_FLAG;
+
+ flags &= ~VXLAN_GPE_USED_BITS;
@@ -705,7 +705,6 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
if (vs->flags & VXLAN_F_GPE) {
if (!vxlan_parse_gpe_hdr(&unparsed, &protocol, skb, vs->flags))
goto drop;
- raw_proto = true;
}
if (flags || vni & ~VXLAN_VNI_MASK) {
@@ -1023,6 +1035,22 @@ static void vxlan_build_gbp_hdr(struct vxlanhdr *vxh, u32 vxflags,
gbp->policy_id = htons(md->gbp & VXLAN_GBP_ID_MASK);
}
+static void vxlan_build_gpe_hdr(struct vxlanhdr *vxh, u32 vxflags,
+ struct vxlan_metadata *md)
+{
+ struct vxlanhdr_gpe *gpe;
+
+ if (!md->gpe)
+ return;
+
+ gpe = (struct vxlanhdr_gpe*)vxh;
+ vxh->vx_flags |= htonl(VXLAN_HF_GPE);
+
+ if (md->gpe & VXLAN_GPE_OAM_FLAG)
+ gpe->oam_flag = 1;
+ gpe->next_proto = md->gpe & VXLAN_GPE_NP_MASK;
+}
+
#if IS_ENABLED(CONFIG_IPV6)
static int vxlan6_xmit_skb(struct dst_entry *dst, struct sock *sk,
struct sk_buff *skb,
@@ -1106,6 +1134,8 @@ static int vxlan6_xmit_skb(struct dst_entry *dst, struct sock *sk,
if (__iptunnel_pull_header(skb, VXLAN_HLEN, protocol, raw_proto,
@@ -896,10 +895,9 @@ static int vxlan_build_skb(struct sk_buff *skb, struct dst_entry *dst,
if (vxflags & VXLAN_F_GBP)
vxlan_build_gbp_hdr(vxh, vxflags, md);
+ else if (vxflags & VXLAN_F_GPE)
+ vxlan_build_gpe_hdr(vxh, vxflags, md);
if (vxflags & VXLAN_F_GPE) {
- err = vxlan_build_gpe_hdr(vxh, vxflags, skb->protocol);
+ err = vxlan_build_gpe_hdr(vxh, vxflags, inner_protocol);
if (err < 0)
goto out_free;
- inner_protocol = skb->protocol;
}
ovs_skb_set_inner_protocol(skb, htons(ETH_P_TEB));
ovs_skb_set_inner_protocol(skb, inner_protocol);
diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index 970f7d3..0ee076b 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -102,7 +102,8 @@ struct vport *ovs_netdev_link(struct vport *vport, const char *name)
}
if (vport->dev->flags & IFF_LOOPBACK ||
- vport->dev->type != ARPHRD_ETHER ||
+ (vport->dev->type != ARPHRD_ETHER &&
+ vport->dev->type != ARPHRD_NONE) ||
ovs_is_internal_dev(vport->dev)) {
err = -EINVAL;
goto error_put;
diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c
index c05f5d4..5d775cc 100644
index 11965c0..e32c970 100644
--- a/datapath/vport-vxlan.c
+++ b/datapath/vport-vxlan.c
@@ -52,6 +52,18 @@ static int vxlan_get_options(const struct vport *vport, struct sk_buff *skb)
@ -277,11 +159,80 @@ index c05f5d4..5d775cc 100644
return 0;
}
diff --git a/include/openvswitch/match.h b/include/openvswitch/match.h
index 3b7f32f..93af1b8 100644
--- a/include/openvswitch/match.h
+++ b/include/openvswitch/match.h
@@ -89,6 +89,10 @@ void match_set_tun_gbp_id_masked(struct match *match, ovs_be16 gbp_id, ovs_be16
void match_set_tun_gbp_id(struct match *match, ovs_be16 gbp_id);
void match_set_tun_gbp_flags_masked(struct match *match, uint8_t flags, uint8_t mask);
void match_set_tun_gbp_flags(struct match *match, uint8_t flags);
+void match_set_tun_gpe_np_masked(struct match *match, uint8_t gpe_np, uint8_t mask);
+void match_set_tun_gpe_np(struct match *match, uint8_t gpe_np);
+void match_set_tun_gpe_flags_masked(struct match *match, uint8_t flags, uint8_t mask);
+void match_set_tun_gpe_flags(struct match *match, uint8_t flags);
void match_set_in_port(struct match *, ofp_port_t ofp_port);
void match_set_pkt_mark(struct match *, uint32_t pkt_mark);
void match_set_pkt_mark_masked(struct match *, uint32_t pkt_mark, uint32_t mask);
diff --git a/include/openvswitch/meta-flow.h b/include/openvswitch/meta-flow.h
index b091c1b..9e569ef 100644
--- a/include/openvswitch/meta-flow.h
+++ b/include/openvswitch/meta-flow.h
@@ -493,6 +493,34 @@ enum OVS_PACKED_ENUM mf_field_id {
*/
MFF_TUN_GBP_FLAGS,
+ /* "tun_gpe_np".
+ *
+ * VXLAN Generic Protocol Extension next_proto
+ *
+ * Type: u8.
+ * Maskable: bitwise.
+ * Formatting: hexadecimal.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_GPE_NP(200) since v2.4.
+ * OXM: none.
+ */
+ MFF_TUN_GPE_NP,
+
+ /* "tun_gpe_flags".
+ *
+ * VXLAN Generic Protocol Extension flag
+ *
+ * Type: u8.
+ * Maskable: bitwise.
+ * Formatting: hexadecimal.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_GPE_FLAGS(201) since v2.4.
+ * OXM: none.
+ */
+ MFF_TUN_GPE_FLAGS,
+
#if TUN_METADATA_NUM_OPTS == 64
/* "tun_metadata<N>".
*
diff --git a/include/openvswitch/packets.h b/include/openvswitch/packets.h
index 5d97309..1e82df0 100644
--- a/include/openvswitch/packets.h
+++ b/include/openvswitch/packets.h
@@ -34,7 +34,9 @@ struct flow_tnl {
ovs_be16 tp_dst;
ovs_be16 gbp_id;
uint8_t gbp_flags;
- uint8_t pad1[5]; /* Pad to 64 bits. */
+ uint8_t gpe_np;
+ uint8_t gpe_flags;
+ uint8_t pad1[3]; /* Pad to 64 bits. */
struct tun_metadata metadata;
};
diff --git a/lib/flow.c b/lib/flow.c
index b9ce331..d24bdc9 100644
index ba4f8c7..375979b 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -870,6 +870,12 @@ flow_get_metadata(const struct flow *flow, struct match *flow_metadata)
@@ -897,6 +897,12 @@ flow_get_metadata(const struct flow *flow, struct match *flow_metadata)
if (flow->tunnel.gbp_flags) {
match_set_tun_gbp_flags(flow_metadata, flow->tunnel.gbp_flags);
}
@ -294,7 +245,7 @@ index b9ce331..d24bdc9 100644
tun_metadata_get_fmd(&flow->tunnel, flow_metadata);
if (flow->metadata != htonll(0)) {
match_set_metadata(flow_metadata, flow->metadata);
@@ -1265,6 +1271,8 @@ void flow_wildcards_init_for_packet(struct flow_wildcards *wc,
@@ -1292,6 +1298,8 @@ void flow_wildcards_init_for_packet(struct flow_wildcards *wc,
WC_MASK_FIELD(wc, tunnel.tp_dst);
WC_MASK_FIELD(wc, tunnel.gbp_id);
WC_MASK_FIELD(wc, tunnel.gbp_flags);
@ -304,10 +255,10 @@ index b9ce331..d24bdc9 100644
if (!(flow->tunnel.flags & FLOW_TNL_F_UDPIF)) {
if (flow->tunnel.metadata.present.map) {
diff --git a/lib/match.c b/lib/match.c
index fd571d9..52437c9 100644
index d78e6a1..f19648d 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -289,6 +289,32 @@ match_set_tun_gbp_flags(struct match *match, uint8_t flags)
@@ -305,6 +305,32 @@ match_set_tun_gbp_flags(struct match *match, uint8_t flags)
}
void
@ -340,7 +291,7 @@ index fd571d9..52437c9 100644
match_set_in_port(struct match *match, ofp_port_t ofp_port)
{
match->wc.masks.in_port.ofp_port = u16_to_ofp(UINT16_MAX);
@@ -1013,6 +1039,14 @@ format_flow_tunnel(struct ds *s, const struct match *match)
@@ -1029,6 +1055,14 @@ format_flow_tunnel(struct ds *s, const struct match *match)
ds_put_format(s, "tun_gbp_flags=%#"PRIx8",", tnl->gbp_flags);
}
@ -355,23 +306,8 @@ index fd571d9..52437c9 100644
if (wc->masks.tunnel.ip_tos) {
ds_put_format(s, "tun_tos=%"PRIx8",", tnl->ip_tos);
}
diff --git a/lib/match.h b/lib/match.h
index 0a6ac29..48aa0b1 100644
--- a/lib/match.h
+++ b/lib/match.h
@@ -86,6 +86,10 @@ void match_set_tun_gbp_id_masked(struct match *match, ovs_be16 gbp_id, ovs_be16
void match_set_tun_gbp_id(struct match *match, ovs_be16 gbp_id);
void match_set_tun_gbp_flags_masked(struct match *match, uint8_t flags, uint8_t mask);
void match_set_tun_gbp_flags(struct match *match, uint8_t flags);
+void match_set_tun_gpe_np_masked(struct match *match, uint8_t gpe_np, uint8_t mask);
+void match_set_tun_gpe_np(struct match *match, uint8_t gpe_np);
+void match_set_tun_gpe_flags_masked(struct match *match, uint8_t flags, uint8_t mask);
+void match_set_tun_gpe_flags(struct match *match, uint8_t flags);
void match_set_in_port(struct match *, ofp_port_t ofp_port);
void match_set_pkt_mark(struct match *, uint32_t pkt_mark);
void match_set_pkt_mark_masked(struct match *, uint32_t pkt_mark, uint32_t mask);
diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index 721152c..ab77fca 100644
index d07f927..5d0721f 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -213,6 +213,10 @@ mf_is_all_wild(const struct mf_field *mf, const struct flow_wildcards *wc)
@ -385,7 +321,7 @@ index 721152c..ab77fca 100644
CASE_MFF_TUN_METADATA:
return !ULLONG_GET(wc->masks.tunnel.metadata.present.map,
mf->id - MFF_TUN_METADATA0);
@@ -515,6 +519,8 @@ mf_is_value_valid(const struct mf_field *mf, const union mf_value *value)
@@ -434,6 +438,8 @@ mf_is_value_valid(const struct mf_field *mf, const union mf_value *value)
case MFF_TUN_TTL:
case MFF_TUN_GBP_ID:
case MFF_TUN_GBP_FLAGS:
@ -394,7 +330,7 @@ index 721152c..ab77fca 100644
CASE_MFF_TUN_METADATA:
case MFF_METADATA:
case MFF_IN_PORT:
@@ -648,6 +654,12 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow,
@@ -568,6 +574,12 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow,
case MFF_TUN_GBP_FLAGS:
value->u8 = flow->tunnel.gbp_flags;
break;
@ -407,7 +343,7 @@ index 721152c..ab77fca 100644
case MFF_TUN_TTL:
value->u8 = flow->tunnel.ip_ttl;
break;
@@ -899,6 +911,12 @@ mf_set_value(const struct mf_field *mf,
@@ -823,6 +835,12 @@ mf_set_value(const struct mf_field *mf,
case MFF_TUN_GBP_FLAGS:
match_set_tun_gbp_flags(match, value->u8);
break;
@ -420,7 +356,7 @@ index 721152c..ab77fca 100644
case MFF_TUN_TOS:
match_set_tun_tos(match, value->u8);
break;
@@ -1216,6 +1234,12 @@ mf_set_flow_value(const struct mf_field *mf,
@@ -1161,6 +1179,12 @@ mf_set_flow_value(const struct mf_field *mf,
case MFF_TUN_GBP_FLAGS:
flow->tunnel.gbp_flags = value->u8;
break;
@ -433,7 +369,7 @@ index 721152c..ab77fca 100644
case MFF_TUN_TOS:
flow->tunnel.ip_tos = value->u8;
break;
@@ -1535,6 +1559,12 @@ mf_set_wild(const struct mf_field *mf, struct match *match, char **err_str)
@@ -1484,6 +1508,12 @@ mf_set_wild(const struct mf_field *mf, struct match *match, char **err_str)
case MFF_TUN_GBP_FLAGS:
match_set_tun_gbp_flags_masked(match, 0, 0);
break;
@ -446,7 +382,7 @@ index 721152c..ab77fca 100644
case MFF_TUN_TOS:
match_set_tun_tos_masked(match, 0, 0);
break;
@@ -1838,6 +1868,12 @@ mf_set(const struct mf_field *mf,
@@ -1793,6 +1823,12 @@ mf_set(const struct mf_field *mf,
case MFF_TUN_GBP_FLAGS:
match_set_tun_gbp_flags_masked(match, value->u8, mask->u8);
break;
@ -459,50 +395,11 @@ index 721152c..ab77fca 100644
case MFF_TUN_TTL:
match_set_tun_ttl_masked(match, value->u8, mask->u8);
break;
diff --git a/lib/meta-flow.h b/lib/meta-flow.h
index c73a1af..4bd9ff6 100644
--- a/lib/meta-flow.h
+++ b/lib/meta-flow.h
@@ -491,6 +491,34 @@ enum OVS_PACKED_ENUM mf_field_id {
*/
MFF_TUN_GBP_FLAGS,
+ /* "tun_gpe_np".
+ *
+ * VXLAN Generic Protocol Extension next_proto
+ *
+ * Type: u8.
+ * Maskable: bitwise.
+ * Formatting: hexadecimal.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_GPE_NP(111) since v2.4.
+ * OXM: none.
+ */
+ MFF_TUN_GPE_NP,
+
+ /* "tun_gpe_flags".
+ *
+ * VXLAN Generic Protocol Extension flag
+ *
+ * Type: u8.
+ * Maskable: bitwise.
+ * Formatting: hexadecimal.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_GPE_FLAGS(112) since v2.4.
+ * OXM: none.
+ */
+ MFF_TUN_GPE_FLAGS,
+
#if TUN_METADATA_NUM_OPTS == 64
/* "tun_metadata<N>".
*
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index e398562..92ceec1 100644
index ac31da6..cff0f5c 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -583,6 +583,8 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args)
@@ -526,6 +526,8 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args)
while (ext) {
if (!strcmp(type, "vxlan") && !strcmp(ext, "gbp")) {
tnl_cfg.exts |= (1 << OVS_VXLAN_EXT_GBP);
@ -512,10 +409,10 @@ index e398562..92ceec1 100644
VLOG_WARN("%s: unknown extension '%s'", name, ext);
}
diff --git a/lib/nx-match.c b/lib/nx-match.c
index 9f0f452..0eecac7 100644
index b03ccf2..65d7ee3 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -1037,6 +1037,10 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match,
@@ -1036,6 +1036,10 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match,
flow->tunnel.gbp_id, match->wc.masks.tunnel.gbp_id);
nxm_put_8m(b, MFF_TUN_GBP_FLAGS, oxm,
flow->tunnel.gbp_flags, match->wc.masks.tunnel.gbp_flags);
@ -527,10 +424,10 @@ index 9f0f452..0eecac7 100644
/* Registers. */
diff --git a/lib/odp-util.c b/lib/odp-util.c
index b4689cc..7983720 100644
index 6d29b67..b9e8aa7 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -1727,6 +1727,7 @@ odp_actions_from_string(const char *s, const struct simap *port_names,
@@ -1755,6 +1755,7 @@ odp_actions_from_string(const char *s, const struct simap *port_names,
static const struct attr_len_tbl ovs_vxlan_ext_attr_lens[OVS_VXLAN_EXT_MAX + 1] = {
[OVS_VXLAN_EXT_GBP] = { .len = 4 },
@ -538,7 +435,7 @@ index b4689cc..7983720 100644
};
static const struct attr_len_tbl ovs_tun_key_attr_lens[OVS_TUNNEL_KEY_ATTR_MAX + 1] = {
@@ -1888,7 +1889,10 @@ odp_tun_key_from_attr__(const struct nlattr *attr,
@@ -1916,7 +1917,10 @@ odp_tun_key_from_attr__(const struct nlattr *attr,
break;
case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS: {
static const struct nl_policy vxlan_opts_policy[] = {
@ -550,7 +447,7 @@ index b4689cc..7983720 100644
};
struct nlattr *ext[ARRAY_SIZE(vxlan_opts_policy)];
@@ -1902,6 +1906,12 @@ odp_tun_key_from_attr__(const struct nlattr *attr,
@@ -1930,6 +1934,12 @@ odp_tun_key_from_attr__(const struct nlattr *attr,
tun->gbp_id = htons(gbp & 0xFFFF);
tun->gbp_flags = (gbp >> 16) & 0xFF;
}
@ -563,7 +460,7 @@ index b4689cc..7983720 100644
break;
}
@@ -1988,6 +1998,13 @@ tun_key_to_attr(struct ofpbuf *a, const struct flow_tnl *tun_key,
@@ -2016,6 +2026,13 @@ tun_key_to_attr(struct ofpbuf *a, const struct flow_tnl *tun_key,
nl_msg_put_u32(a, OVS_VXLAN_EXT_GBP,
(tun_key->gbp_flags << 16) | ntohs(tun_key->gbp_id));
nl_msg_end_nested(a, vxlan_opts_ofs);
@ -577,7 +474,7 @@ index b4689cc..7983720 100644
}
tun_metadata_to_geneve_nlattr(tun_key, tun_flow_key, key_buf, a);
@@ -2383,6 +2400,26 @@ format_odp_tun_vxlan_opt(const struct nlattr *attr,
@@ -2410,6 +2427,26 @@ format_odp_tun_vxlan_opt(const struct nlattr *attr,
ds_put_cstr(ds, "),");
break;
}
@ -604,7 +501,7 @@ index b4689cc..7983720 100644
default:
format_unknown_key(ds, a, ma);
@@ -3670,6 +3707,40 @@ scan_vxlan_gbp(const char *s, uint32_t *key, uint32_t *mask)
@@ -3705,6 +3742,40 @@ scan_vxlan_gbp(const char *s, uint32_t *key, uint32_t *mask)
}
static int
@ -645,7 +542,7 @@ index b4689cc..7983720 100644
scan_geneve(const char *s, struct geneve_scan *key, struct geneve_scan *mask)
{
const char *s_base = s;
@@ -3796,6 +3867,21 @@ vxlan_gbp_to_attr(struct ofpbuf *a, const void *data_)
@@ -3831,6 +3902,21 @@ vxlan_gbp_to_attr(struct ofpbuf *a, const void *data_)
}
static void
@ -667,7 +564,7 @@ index b4689cc..7983720 100644
geneve_to_attr(struct ofpbuf *a, const void *data_)
{
const struct geneve_scan *geneve = data_;
@@ -4031,6 +4117,7 @@ parse_odp_key_mask_attr(const char *s, const struct simap *port_names,
@@ -4066,6 +4152,7 @@ parse_odp_key_mask_attr(const char *s, const struct simap *port_names,
SCAN_FIELD_NESTED("tp_src=", ovs_be16, be16, OVS_TUNNEL_KEY_ATTR_TP_SRC);
SCAN_FIELD_NESTED("tp_dst=", ovs_be16, be16, OVS_TUNNEL_KEY_ATTR_TP_DST);
SCAN_FIELD_NESTED_FUNC("vxlan(gbp(", uint32_t, vxlan_gbp, vxlan_gbp_to_attr);
@ -675,35 +572,20 @@ index b4689cc..7983720 100644
SCAN_FIELD_NESTED_FUNC("geneve(", struct geneve_scan, geneve,
geneve_to_attr);
SCAN_FIELD_NESTED_FUNC("flags(", uint16_t, tun_flags, tun_flags_to_attr);
diff --git a/lib/packets.h b/lib/packets.h
index a8ea24b..dc97333 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -49,7 +49,9 @@ struct flow_tnl {
ovs_be16 tp_dst;
ovs_be16 gbp_id;
uint8_t gbp_flags;
- uint8_t pad1[5]; /* Pad to 64 bits. */
+ uint8_t gpe_np;
+ uint8_t gpe_flags;
+ uint8_t pad1[3]; /* Pad to 64 bits. */
struct tun_metadata metadata;
};
diff --git a/tests/ofproto.at b/tests/ofproto.at
index fbb6d71..6c7217d 100644
index 6e55270..7b7f02b 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -1775,7 +1775,7 @@ head_table () {
@@ -2190,7 +2190,7 @@ head_table () {
instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
Write-Actions and Apply-Actions features:
actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
- supported on Set-Field: tun_id tun_src tun_dst tun_ipv6_src tun_ipv6_dst tun_flags tun_gbp_id tun_gbp_flags tun_metadata0 dnl
+ supported on Set-Field: tun_id tun_src tun_dst tun_ipv6_src tun_ipv6_dst tun_flags tun_gbp_id tun_gbp_flags tun_gpe_np tun_gpe_flags tun_metadata0 dnl
tun_metadata1 tun_metadata2 tun_metadata3 tun_metadata4 tun_metadata5 tun_metadata6 tun_metadata7 tun_metadata8 tun_metadata9 tun_metadata10 tun_metadata11 tun_metadata12 tun_metadata13 tun_metadata14 tun_metadata15 tun_metadata16 tun_metadata17 tun_metadata18 tun_metadata19 tun_metadata20 tun_metadata21 tun_metadata22 tun_metadata23 tun_metadata24 tun_metadata25 tun_metadata26 tun_metadata27 tun_metadata28 tun_metadata29 tun_metadata30 tun_metadata31 tun_metadata32 tun_metadata33 tun_metadata34 tun_metadata35 tun_metadata36 tun_metadata37 tun_metadata38 tun_metadata39 tun_metadata40 tun_metadata41 tun_metadata42 tun_metadata43 tun_metadata44 tun_metadata45 tun_metadata46 tun_metadata47 tun_metadata48 tun_metadata49 tun_metadata50 tun_metadata51 tun_metadata52 tun_metadata53 tun_metadata54 tun_metadata55 tun_metadata56 tun_metadata57 tun_metadata58 tun_metadata59 tun_metadata60 tun_metadata61 tun_metadata62 tun_metadata63 dnl
metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 xreg0 xreg1 xreg2 xreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc mpls_ttl ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 reg10 reg11 reg12 reg13 reg14 reg15 xreg0 xreg1 xreg2 xreg3 xreg4 xreg5 xreg6 xreg7 xxreg0 xxreg1 xxreg2 xxreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc mpls_ttl ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
matching:
@@ -1790,6 +1790,8 @@ metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4
@@ -2205,6 +2205,8 @@ metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4
tun_flags: arbitrary mask
tun_gbp_id: arbitrary mask
tun_gbp_flags: arbitrary mask
@ -713,7 +595,7 @@ index fbb6d71..6c7217d 100644
tun_metadata1: arbitrary mask
tun_metadata2: arbitrary mask
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index f26f622..dde603d 100644
index cbb818e..2267be0 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -17,6 +17,10 @@ for test_case in \
@ -728,5 +610,5 @@ index f26f622..dde603d 100644
'tun_metadata0=0/0x1 NXM,OXM' \
'tun_metadata0 NXM,OXM' \
--
1.9.3
2.1.0

View File

@ -1,7 +1,7 @@
From e6f9b1f96a3ac4066c9d7d4c0a9da7e8abb1597f Mon Sep 17 00:00:00 2001
From 9bd18a89542f910ce12b09fe3e03f08a22b691dd Mon Sep 17 00:00:00 2001
From: Yi Yang <yi.y.yang@intel.com>
Date: Wed, 13 Apr 2016 18:17:21 +0800
Subject: [PATCH 4/6] Fix too large stack frame size
Date: Mon, 14 Nov 2016 13:12:51 +0800
Subject: [PATCH 3/8] Fix too large stack frame size
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
@ -9,10 +9,10 @@ Signed-off-by: Yi Yang <yi.y.yang@intel.com>
1 file changed, 78 insertions(+), 14 deletions(-)
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 5bec072..4baf242 100644
index db8a18a..ae6555f 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -928,7 +928,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
@@ -939,7 +939,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
struct sw_flow_mask mask;
struct sk_buff *reply;
struct datapath *dp;
@ -21,7 +21,7 @@ index 5bec072..4baf242 100644
struct sw_flow_actions *acts;
struct sw_flow_match match;
u32 ufid_flags = ovs_nla_get_ufid_flags(a[OVS_FLOW_ATTR_UFID_FLAGS]);
@@ -946,6 +946,12 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
@@ -957,6 +957,12 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
goto error;
}
@ -34,7 +34,7 @@ index 5bec072..4baf242 100644
/* Most of the time we need to allocate a new flow, do it before
* locking.
*/
@@ -956,17 +962,17 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
@@ -967,17 +973,17 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
}
/* Extract key. */
@ -55,7 +55,7 @@ index 5bec072..4baf242 100644
if (error)
goto err_kfree_flow;
@@ -996,7 +1002,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
@@ -1007,7 +1013,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
if (ovs_identifier_is_ufid(&new_flow->id))
flow = ovs_flow_tbl_lookup_ufid(&dp->table, &new_flow->id);
if (!flow)
@ -64,7 +64,7 @@ index 5bec072..4baf242 100644
if (likely(!flow)) {
rcu_assign_pointer(new_flow->sf_acts, acts);
@@ -1066,6 +1072,10 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
@@ -1077,6 +1083,10 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
if (reply)
ovs_notify(&dp_flow_genl_family, &ovs_dp_flow_multicast_group, reply, info);
@ -75,7 +75,7 @@ index 5bec072..4baf242 100644
return 0;
err_unlock_ovs:
@@ -1076,6 +1086,10 @@ err_kfree_acts:
@@ -1087,6 +1097,10 @@ err_kfree_acts:
err_kfree_flow:
ovs_flow_free(new_flow, false);
error:
@ -86,7 +86,7 @@ index 5bec072..4baf242 100644
return error;
}
@@ -1106,7 +1120,7 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
@@ -1117,7 +1131,7 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
struct net *net = sock_net(skb->sk);
struct nlattr **a = info->attrs;
struct ovs_header *ovs_header = info->userhdr;
@ -95,7 +95,7 @@ index 5bec072..4baf242 100644
struct sw_flow *flow;
struct sw_flow_mask mask;
struct sk_buff *reply = NULL;
@@ -1119,6 +1133,12 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
@@ -1130,9 +1144,15 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
bool log = !a[OVS_FLOW_ATTR_PROBE];
bool ufid_present;
@ -105,28 +105,23 @@ index 5bec072..4baf242 100644
+ goto error;
+ }
+
/* Extract key. */
error = -EINVAL;
if (!a[OVS_FLOW_ATTR_KEY]) {
@@ -1127,7 +1147,7 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
}
ufid_present = ovs_nla_get_ufid(&sfid, a[OVS_FLOW_ATTR_UFID], log);
- ovs_match_init(&match, &key, &mask);
+ ovs_match_init(&match, key, &mask);
error = ovs_nla_get_match(net, &match, a[OVS_FLOW_ATTR_KEY],
a[OVS_FLOW_ATTR_MASK], log);
if (error)
@@ -1135,7 +1155,7 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
if (a[OVS_FLOW_ATTR_KEY]) {
- ovs_match_init(&match, &key, &mask);
+ ovs_match_init(&match, key, &mask);
error = ovs_nla_get_match(net, &match, a[OVS_FLOW_ATTR_KEY],
a[OVS_FLOW_ATTR_MASK], log);
} else if (!ufid_present) {
@@ -1152,7 +1172,7 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
goto error;
}
/* Validate actions. */
if (a[OVS_FLOW_ATTR_ACTIONS]) {
- acts = get_flow_actions(net, a[OVS_FLOW_ATTR_ACTIONS], &key,
+ acts = get_flow_actions(net, a[OVS_FLOW_ATTR_ACTIONS], key,
&mask, log);
if (IS_ERR(acts)) {
error = PTR_ERR(acts);
@@ -1203,6 +1223,10 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
@@ -1220,6 +1240,10 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
if (old_acts)
ovs_nla_free_flow_actions_rcu(old_acts);
@ -137,7 +132,7 @@ index 5bec072..4baf242 100644
return 0;
err_unlock_ovs:
@@ -1211,6 +1235,10 @@ err_unlock_ovs:
@@ -1228,6 +1252,10 @@ err_unlock_ovs:
err_kfree_acts:
ovs_nla_free_flow_actions(acts);
error:
@ -148,7 +143,7 @@ index 5bec072..4baf242 100644
return error;
}
@@ -1219,7 +1247,7 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
@@ -1236,7 +1264,7 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
struct nlattr **a = info->attrs;
struct ovs_header *ovs_header = info->userhdr;
struct net *net = sock_net(skb->sk);
@ -157,7 +152,7 @@ index 5bec072..4baf242 100644
struct sk_buff *reply;
struct sw_flow *flow;
struct datapath *dp;
@@ -1230,9 +1258,15 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
@@ -1247,9 +1275,15 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
bool log = !a[OVS_FLOW_ATTR_PROBE];
bool ufid_present;
@ -174,7 +169,7 @@ index 5bec072..4baf242 100644
err = ovs_nla_get_match(net, &match, a[OVS_FLOW_ATTR_KEY], NULL,
log);
} else if (!ufid_present) {
@@ -1240,9 +1274,13 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
@@ -1257,9 +1291,13 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
"Flow get message rejected, Key attribute missing.");
err = -EINVAL;
}
@ -190,7 +185,7 @@ index 5bec072..4baf242 100644
ovs_lock();
dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex);
if (!dp) {
@@ -1267,9 +1305,17 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
@@ -1284,9 +1322,17 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
}
ovs_unlock();
@ -208,7 +203,7 @@ index 5bec072..4baf242 100644
return err;
}
@@ -1278,7 +1324,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
@@ -1295,7 +1341,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
struct nlattr **a = info->attrs;
struct ovs_header *ovs_header = info->userhdr;
struct net *net = sock_net(skb->sk);
@ -217,7 +212,7 @@ index 5bec072..4baf242 100644
struct sk_buff *reply;
struct sw_flow *flow = NULL;
struct datapath *dp;
@@ -1289,12 +1335,22 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
@@ -1306,12 +1352,22 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
bool log = !a[OVS_FLOW_ATTR_PROBE];
bool ufid_present;
@ -241,7 +236,7 @@ index 5bec072..4baf242 100644
return err;
}
@@ -1344,9 +1400,17 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
@@ -1361,9 +1417,17 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
}
ovs_flow_free(flow, true);
@ -260,5 +255,5 @@ index 5bec072..4baf242 100644
}
--
1.9.3
2.1.0

View File

@ -0,0 +1,127 @@
From 861f91c172c97b3ea787a1ad30617f31d77f1379 Mon Sep 17 00:00:00 2001
From: Yi Yang <yi.y.yang@intel.com>
Date: Wed, 30 Nov 2016 10:22:57 +0800
Subject: [PATCH 4/8] Fix vxlangpe issues on DPDK netdev
- Fix a potential deadlock issue
- Use Ethernet header before NSH header in VxLAN-gpe
to ensure we have uniform behaviour in OVS DPDK and
OVS
- Correct VxLAN-gpe check in netdev_vxlan_pop_header
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
lib/dpif-netdev.c | 5 +----
lib/netdev-native-tnl.c | 9 +++++----
lib/netdev-vport.c | 10 ++++++++++
lib/netdev-vport.h | 2 ++
ofproto/tunnel.c | 1 -
5 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index c779c78..257a174 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1217,11 +1217,8 @@ static void add_vxlan_gpe_exts(struct netdev *netdev, uint32_t exts)
{
const char *type = netdev_get_type(netdev);
if (!strcmp(type, "vxlan")) {
- struct netdev_tunnel_config *cfg;
- cfg = netdev_get_tunnel_config(netdev);
-
if(exts & (1 << OVS_VXLAN_EXT_GPE))
- cfg->exts |= (1 << OVS_VXLAN_EXT_GPE);
+ netdev_set_tunnel_config_exts(netdev, exts);
}
}
diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
index 2fe2722..a677ec8 100644
--- a/lib/netdev-native-tnl.c
+++ b/lib/netdev-native-tnl.c
@@ -243,6 +243,7 @@ eth_build_header(struct ovs_action_push_tnl *data,
uint16_t eth_proto = params->is_ipv6 ? ETH_TYPE_IPV6 : ETH_TYPE_IP;
struct eth_header *eth;
+ data->exts = 0;
memset(data->header, 0, sizeof data->header);
eth = (struct eth_header *)data->header;
@@ -499,9 +500,9 @@ netdev_vxlan_pop_header(struct dp_packet *packet)
flag = get_16aligned_be32(&vxh->vx_flags);
vni = get_16aligned_be32(&vxh->vx_vni);
- if (flag & VXLAN_HF_GPE) {
- flag &= ~VXLAN_GPE_USED_BITS;
- if ((flag & ~VXLAN_GPE_USED_BITS) ||
+ if (flag & htonl(VXLAN_HF_GPE)) {
+ flag &= htonl(~VXLAN_GPE_USED_BITS);
+ if ((flag != htonl(VXLAN_FLAGS)) ||
(vni & htonl(0xff))) {
VLOG_WARN_RL(&err_rl, "invalid vxlan flags=%#x vni=%#x\n for vxlan-gpe",
@@ -578,7 +579,7 @@ netdev_vxlan_build_header(const struct netdev *netdev,
put_16aligned_be32(&vxh->vx_vni, htonl(ntohll(params->flow->tunnel.tun_id) << 8));
if (!params->flow->tunnel.gpe_np)
- return -1;
+ gpe->next_protocol = VXLAN_GPE_NP_ETHERNET;
else
gpe->next_protocol = params->flow->tunnel.gpe_np;
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 841a070..0aca632 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -85,6 +85,16 @@ get_netdev_tunnel_config(const struct netdev *netdev)
return &netdev_vport_cast(netdev)->tnl_cfg;
}
+void netdev_set_tunnel_config_exts(struct netdev *netdev, uint32_t exts)
+{
+ struct netdev_vport *dev = netdev_vport_cast(netdev);
+ dev->tnl_cfg.exts = exts;
+ ovs_mutex_lock(&dev->mutex);
+ tunnel_check_status_change__(dev);
+ netdev_change_seq_changed(netdev);
+ ovs_mutex_unlock(&dev->mutex);
+}
+
bool
netdev_vport_is_patch(const struct netdev *netdev)
{
diff --git a/lib/netdev-vport.h b/lib/netdev-vport.h
index b19cbd2..e093dde 100644
--- a/lib/netdev-vport.h
+++ b/lib/netdev-vport.h
@@ -19,6 +19,7 @@
#include <stdbool.h>
#include <stddef.h>
+#include <inttypes.h>
#include "compiler.h"
struct dpif_netlink_vport;
@@ -42,6 +43,7 @@ void netdev_vport_inc_tx(const struct netdev *,
bool netdev_vport_is_vport_class(const struct netdev_class *);
const char *netdev_vport_class_get_dpif_port(const struct netdev_class *);
+void netdev_set_tunnel_config_exts(struct netdev *netdev, uint32_t exts);
#ifndef _WIN32
enum { NETDEV_VPORT_NAME_BUFSIZE = 16 };
diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index acaec82..9a69071 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -701,7 +701,6 @@ tnl_port_build_header(const struct ofport_dpif *ofport,
tnl_port = tnl_find_ofport(ofport);
ovs_assert(tnl_port);
res = netdev_build_header(tnl_port->netdev, data, params);
- data->exts = 0;
fat_rwlock_unlock(&rwlock);
return res;
--
2.1.0

View File

@ -0,0 +1,197 @@
From b6fb68aaf672af71e60ecff9b6b03f1d5f42be0c Mon Sep 17 00:00:00 2001
From: Yi Yang <yi.y.yang@intel.com>
Date: Wed, 30 Nov 2016 12:22:19 +0800
Subject: [PATCH 5/8] Change match field IDs and action IDs to adapt to ODL
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
include/openvswitch/meta-flow.h | 42 ++++++++++++++++++++---------------------
lib/ofp-actions.c | 10 +++++-----
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/include/openvswitch/meta-flow.h b/include/openvswitch/meta-flow.h
index fa4129c..190c3d6 100644
--- a/include/openvswitch/meta-flow.h
+++ b/include/openvswitch/meta-flow.h
@@ -502,7 +502,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_TUN_GPE_NP(200) since v2.4.
+ * NXM: NXM_NX_TUN_GPE_NP(111) since v2.4.
* OXM: none.
*/
MFF_TUN_GPE_NP,
@@ -516,7 +516,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_TUN_GPE_FLAGS(201) since v2.4.
+ * NXM: NXM_NX_TUN_GPE_FLAGS(112) since v2.4.
* OXM: none.
*/
MFF_TUN_GPE_FLAGS,
@@ -966,14 +966,14 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_XXREG0(111) since v2.6. <0>
- * NXM: NXM_NX_XXREG1(112) since v2.6. <1>
- * NXM: NXM_NX_XXREG2(113) since v2.6. <2>
- * NXM: NXM_NX_XXREG3(114) since v2.6. <3>
- * NXM: NXM_NX_XXREG4(115) since vX.Y. <4>
- * NXM: NXM_NX_XXREG5(116) since vX.Y. <5>
- * NXM: NXM_NX_XXREG6(117) since vX.Y. <6>
- * NXM: NXM_NX_XXREG7(118) since vX.Y. <7>
+ * NXM: NXM_NX_XXREG0(124) since v2.6. <0>
+ * NXM: NXM_NX_XXREG1(125) since v2.6. <1>
+ * NXM: NXM_NX_XXREG2(126) since v2.6. <2>
+ * NXM: NXM_NX_XXREG3(127) since v2.6. <3>
+ * NXM: NXM_NX_XXREG4(128) since vX.Y. <4>
+ * NXM: NXM_NX_XXREG5(129) since vX.Y. <5>
+ * NXM: NXM_NX_XXREG6(130) since vX.Y. <6>
+ * NXM: NXM_NX_XXREG7(131) since vX.Y. <7>
* OXM: none.
*/
MFF_XXREG0,
@@ -1813,7 +1813,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_NSP(202) since v1.1.
+ * NXM: NXM_NX_NSP(113) since v1.1.
* OXM: none.
* Prefix lookup member: nsp.
*/
@@ -1829,7 +1829,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: decimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_NSI(203) since v1.1.
+ * NXM: NXM_NX_NSI(114) since v1.1.
* OXM: none.
* Prefix lookup member: nsi.
*/
@@ -1846,7 +1846,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_NSH_C1(204) since v1.1.
+ * NXM: NXM_NX_NSH_C1(115) since v1.1.
* OXM: none.
* Prefix lookup member: nshc1.
*/
@@ -1863,7 +1863,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_NSH_C2(205) since v1.1.
+ * NXM: NXM_NX_NSH_C2(116) since v1.1.
* OXM: none.
* Prefix lookup member: nshc2.
*/
@@ -1880,7 +1880,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_NSH_C3(206) since v1.1.
+ * NXM: NXM_NX_NSH_C3(117) since v1.1.
* OXM: none.
* Prefix lookup member: nshc3.
*/
@@ -1897,7 +1897,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_NSH_C4(207) since v1.1.
+ * NXM: NXM_NX_NSH_C4(118) since v1.1.
* OXM: none.
* Prefix lookup member: nshc4.
*/
@@ -1913,7 +1913,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: decimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_NSH_MDTYPE(208) since v1.1.
+ * NXM: NXM_NX_NSH_MDTYPE(119) since v1.1.
* OXM: none.
*/
MFF_NSH_MDTYPE,
@@ -1928,7 +1928,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: decimal.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_NSH_NP(209) since v1.1.
+ * NXM: NXM_NX_NSH_NP(120) since v1.1.
* OXM: none.
*/
MFF_NSH_NP,
@@ -1942,7 +1942,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: Ethernet.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_ENCAP_ETH_SRC(210) since v1.1.
+ * NXM: NXM_NX_ENCAP_ETH_SRC(121) since v1.1.
* OXM: none.
*/
MFF_ENCAP_ETH_SRC,
@@ -1956,7 +1956,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: Ethernet.
* Prerequisites: none.
* Access: read/write.
- * NXM: NXM_NX_ENCAP_ETH_DST(211) since v1.1.
+ * NXM: NXM_NX_ENCAP_ETH_DST(122) since v1.1.
* OXM: none.
*/
MFF_ENCAP_ETH_DST,
@@ -1970,7 +1970,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read-only.
- * NXM: NXM_NX_ENCAP_ETH_TYPE(212) since v1.1.
+ * NXM: NXM_NX_ENCAP_ETH_TYPE(123) since v1.1.
* OXM: none.
*/
MFF_ENCAP_ETH_TYPE,
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 2935ca6..4939ef2 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -196,7 +196,7 @@ enum ofp_raw_action_type {
/* NX1.0(4), OF1.1+(21): uint32_t. */
OFPAT_RAW_SET_QUEUE,
- /* NX1.0(40), OF1.1+(22): uint32_t. */
+ /* NX1.0(42), OF1.1+(22): uint32_t. */
OFPAT_RAW_GROUP,
/* OF1.1+(23): uint8_t. */
@@ -289,7 +289,7 @@ enum ofp_raw_action_type {
/* NX1.0+(29): struct nx_action_sample. */
NXAST_RAW_SAMPLE,
- /* NX1.0+(38): struct nx_action_sample2. */
+ /* NX1.0+(40): struct nx_action_sample2. */
NXAST_RAW_SAMPLE2,
/* NX1.0+(34): struct nx_action_conjunction. */
@@ -301,13 +301,13 @@ enum ofp_raw_action_type {
/* NX1.0+(36): struct nx_action_nat, ... */
NXAST_RAW_NAT,
- /* NX1.0+(39): struct nx_action_output_trunc. */
+ /* NX1.0+(41): struct nx_action_output_trunc. */
NXAST_RAW_OUTPUT_TRUNC,
- /* NX1.0+(200): void. */
+ /* NX1.0+(38): void. */
NXAST_RAW_PUSH_NSH,
- /* NX1.0+(201): void. */
+ /* NX1.0+(39): void. */
NXAST_RAW_POP_NSH,
/* ## ------------------ ## */
--
2.1.0

View File

@ -0,0 +1,31 @@
From 622fe1bb00d38a70110d838eecc9e10c0d62cf7c Mon Sep 17 00:00:00 2001
From: Yi Yang <yi.y.yang@intel.com>
Date: Wed, 30 Nov 2016 17:27:11 +0800
Subject: [PATCH 6/8] To be compatible with vpp_nsh
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
lib/netdev-native-tnl.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
index a677ec8..2dd4954 100644
--- a/lib/netdev-native-tnl.c
+++ b/lib/netdev-native-tnl.c
@@ -578,9 +578,10 @@ netdev_vxlan_build_header(const struct netdev *netdev,
put_16aligned_be32(&vxh->vx_flags, htonl(VXLAN_FLAGS | VXLAN_HF_GPE));
put_16aligned_be32(&vxh->vx_vni, htonl(ntohll(params->flow->tunnel.tun_id) << 8));
- if (!params->flow->tunnel.gpe_np)
- gpe->next_protocol = VXLAN_GPE_NP_ETHERNET;
- else
+ if (!params->flow->tunnel.gpe_np) {
+ gpe->next_protocol = VXLAN_GPE_NP_NSH;
+ data->exts |= 1 << VXLAN_GPE_POP_ETH;
+ } else
gpe->next_protocol = params->flow->tunnel.gpe_np;
if (params->flow->tunnel.gpe_flags & 0x01)
--
2.1.0

View File

@ -0,0 +1,67 @@
From dfbdc2b4e12dd5e2aff617e1bc2757e9fc39d1f6 Mon Sep 17 00:00:00 2001
From: Yi Yang <yi.y.yang@intel.com>
Date: Thu, 1 Dec 2016 13:36:23 +0800
Subject: [PATCH 7/8] Fix struct ovs_gso_cb size issue
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
datapath/actions.c | 6 +++---
datapath/datapath.h | 2 --
datapath/flow.c | 2 --
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/datapath/actions.c b/datapath/actions.c
index c979596..936a015 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -278,6 +278,7 @@ static int pop_nsh(struct sk_buff *skb, struct sw_flow_key *key)
static int push_nsh(struct sk_buff *skb, struct sw_flow_key *key,
const struct ovs_action_push_nsh *nsh)
{
+ struct encap_eth_hdr *encap_eth_header = NULL;
if (nsh->nsh_mdtype == NSH_M_TYPE1) {
if (skb_cow_head(skb, ETH_NSH_TYPE1_HEADER_SIZE) < 0) {
@@ -285,10 +286,9 @@ static int push_nsh(struct sk_buff *skb, struct sw_flow_key *key,
}
skb_push(skb, ETH_NSH_TYPE1_HEADER_SIZE);
- OVS_CB(skb)->encap_eth_header = (struct encap_eth_hdr *)skb->data;
- OVS_CB(skb)->nsh_header = (struct nsh_hdr *)(skb->data + ENCAP_ETH_LEN);
+ encap_eth_header = (struct encap_eth_hdr *)skb->data;
memcpy(skb->data, nsh->header, ETH_NSH_TYPE1_HEADER_SIZE);
- OVS_CB(skb)->encap_eth_header->encap_eth_type = htons(ETH_P_NSH);
+ encap_eth_header->encap_eth_type = htons(ETH_P_NSH);
}
else
return -EINVAL;
diff --git a/datapath/datapath.h b/datapath/datapath.h
index a6b2a44..22bbaac 100644
--- a/datapath/datapath.h
+++ b/datapath/datapath.h
@@ -108,8 +108,6 @@ struct ovs_skb_cb {
struct vport *input_vport;
u16 mru;
u32 cutlen;
- struct nsh_hdr *nsh_header;
- struct encap_eth_hdr *encap_eth_header;
};
#define OVS_CB(skb) ((struct ovs_skb_cb *)(skb)->cb)
diff --git a/datapath/flow.c b/datapath/flow.c
index 8c4d583..c712517 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -327,9 +327,7 @@ static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key)
static int parse_nsh(struct sk_buff *skb, struct sw_flow_key *key){
struct nsh_hdr *nsh_hdr = NULL;
- OVS_CB(skb)->encap_eth_header = (struct encap_eth_hdr *)skb->data;
nsh_hdr = (struct nsh_hdr *)((const char *)skb->data + ENCAP_ETH_LEN);
- OVS_CB(skb)->nsh_header = nsh_hdr;
memcpy(&key->nsh.encap_eth_dst, skb->data, ENCAP_ETH_LEN);
key->nsh.nsh_mdtype = nsh_hdr->base.mdtype;
if (key->nsh.nsh_mdtype != NSH_M_TYPE1)
--
2.1.0

View File

@ -0,0 +1,84 @@
From add8faa9d4e0b93ea2828d8932ccbc9b740518ae Mon Sep 17 00:00:00 2001
From: Pravin B Shelar <pshelar@ovn.org>
Date: Mon, 5 Dec 2016 18:22:11 -0800
Subject: [PATCH 8/8] tunnel: set udp dst-port in tunnel metadata
VxLan device expect valid tp-dst in tunnel metadata.
Following patch sets consistent tp-dst with respect to
the egress tunnel port.
Reported-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
Tested-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
---
ofproto/tunnel.c | 1 +
tests/ofproto-dpif.at | 2 +-
tests/tunnel.at | 8 ++++----
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index 9a69071..7277fa0 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -438,6 +438,7 @@ tnl_port_send(const struct ofport_dpif *ofport, struct flow *flow,
flow->pkt_mark |= tnl_port->match.pkt_mark;
wc->masks.pkt_mark |= tnl_port->match.pkt_mark;
+ flow->tunnel.tp_dst = cfg->dst_port;
if (!cfg->out_key_flow) {
flow->tunnel.tun_id = cfg->out_key;
}
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index a71282c..99db282 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -6340,7 +6340,7 @@ AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:
dnl Make sure flow sample action in datapath is behind set tunnel
dnl action at egress point of tunnel port.
AT_CHECK([tail -1 stdout], [0], [dnl
-Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),sample(sample=100.0%,actions(userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=1),tunnel_out_port=1))),1,set(tunnel(tun_id=0x6,src=2.2.2.3,dst=1.1.1.2,tos=0x1,ttl=64,flags(df|key))),sample(sample=100.0%,actions(userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=7471),tunnel_out_port=7471))),7471
+Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),sample(sample=100.0%,actions(userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=1),tunnel_out_port=1))),1,set(tunnel(tun_id=0x6,src=2.2.2.3,dst=1.1.1.2,tos=0x1,ttl=64,tp_dst=7471,flags(df|key))),sample(sample=100.0%,actions(userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=7471),tunnel_out_port=7471))),7471
])
dnl Remove the flow which contains sample action.
diff --git a/tests/tunnel.at b/tests/tunnel.at
index eb429d3..03119bd 100644
--- a/tests/tunnel.at
+++ b/tests/tunnel.at
@@ -866,7 +866,7 @@ AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
dnl Option generation
AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
AT_CHECK([tail -1 stdout], [0],
- [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,geneve({class=0xffff,type=0,len=4,0xa}{class=0xffff,type=0x1,len=8,0x1234567890abcdef}),flags(df))),6081
+ [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,tp_dst=6081,geneve({class=0xffff,type=0,len=4,0xa}{class=0xffff,type=0x1,len=8,0x1234567890abcdef}),flags(df))),6081
])
dnl Option match
@@ -955,7 +955,7 @@ Datapath actions: 2
AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x0,src=1.1.1.1,dst=1.1.1.2,ttl=64,geneve({class=0xffff,type=1,len=0}),flags(df|key)),in_port(6081),skb_mark(0),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
AT_CHECK([tail -2 stdout], [0],
[Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=1.1.1.2,tun_tos=0,tun_flags=+df-csum+key,tun_metadata1,tun_metadata2=NP,in_port=1,nw_ecn=0,nw_frag=no
-Datapath actions: set(tunnel(tun_id=0x0,dst=1.1.1.1,ttl=64,geneve({class=0xffff,type=0x1,len=0}),flags(df|key))),6081
+Datapath actions: set(tunnel(tun_id=0x0,dst=1.1.1.1,ttl=64,tp_dst=6081,geneve({class=0xffff,type=0x1,len=0}),flags(df|key))),6081
])
OVS_VSWITCHD_STOP
@@ -976,12 +976,12 @@ AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0,src=1.1.1.1,dst=1.1.1.2,ttl=64),in_port(4789)'], [0], [stdout])
AT_CHECK([tail -1 stdout], [0],
- [Datapath actions: set(tunnel(tun_id=0x0,ipv6_dst=2001:cafe::1,ttl=64,flags(df|key))),4789
+ [Datapath actions: set(tunnel(tun_id=0x0,ipv6_dst=2001:cafe::1,ttl=64,tp_dst=4789,flags(df|key))),4789
])
AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,ipv6_src=2001:cafe::1,ipv6_dst=2001:cafe::2,ttl=64),in_port(4789)'], [0], [stdout])
AT_CHECK([tail -1 stdout], [0],
- [Datapath actions: set(tunnel(tun_id=0x0,dst=1.1.1.1,ttl=64,flags(df|key))),4789
+ [Datapath actions: set(tunnel(tun_id=0x0,dst=1.1.1.1,ttl=64,tp_dst=4789,flags(df|key))),4789
])
--
2.1.0

View File

@ -1,74 +0,0 @@
From 604bcfaf5211513f665ca05a370bc7f0c0dab39f Mon Sep 17 00:00:00 2001
From: Yi Yang <yi.y.yang@intel.com>
Date: Fri, 15 Apr 2016 14:17:54 +0800
Subject: [PATCH 5/6] Ethernet header must be kept in VxLAN-gpe + eth + NSH for
new ovs lwtunnel implementation
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
datapath/linux/compat/vxlan.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 888d431..3c05141 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -821,7 +821,7 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb,
struct vxlan_dev *vxlan;
struct pcpu_sw_netstats *stats;
union vxlan_addr saddr;
- struct eth_nsh_hdr *eth_nsh_header = NULL;
+ //struct eth_nsh_hdr *eth_nsh_header = NULL;
int err = 0;
/* For flow based devices, map all packets to VNI 0 */
@@ -891,12 +891,13 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb,
u64_stats_update_end(&stats->syncp);
/* Add a faked encap_eth_header for NSH */
- if (md && ((md->gpe & VXLAN_GPE_NP_MASK) == VXLAN_GPE_NP_NSH)) {
+ /* ovs changes have ensured it is here, so needn't add it any more */
+ /*if (md && ((md->gpe & VXLAN_GPE_NP_MASK) == VXLAN_GPE_NP_NSH)) {
skb_push(skb, ENCAP_ETH_LEN);
eth_nsh_header = (struct eth_nsh_hdr *)skb->data;
memmove(eth_nsh_header->encap_eth_header.encap_eth_dst, skb_mac_header(skb), ENCAP_ETH_LEN);
eth_nsh_header->encap_eth_header.encap_eth_type = htons(ETH_P_NSH);
- }
+ }*/
netdev_port_receive(skb, skb_tunnel_info(skb));
return;
@@ -985,7 +986,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
struct vxlanhdr_gpe *gpe;
gpe = (struct vxlanhdr_gpe *)vxh;
- md->gpe = ntohs(gpe->next_proto);
+ md->gpe = gpe->next_proto;
buf.dst.u.tun_info.key.tun_flags |= TUNNEL_VXLAN_OPT;
@@ -1189,9 +1190,10 @@ static int vxlan_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *sk
}
/* Skip encap_eth_header on sending Eth+NSH to vxlan-gpe port */
- if (md && ((md->gpe & VXLAN_GPE_NP_MASK) == VXLAN_GPE_NP_NSH)) {
+ /* ovs needs to keep eth header here */
+ /*if (md && ((md->gpe & VXLAN_GPE_NP_MASK) == VXLAN_GPE_NP_NSH)) {
skb_pull(skb, ENCAP_ETH_LEN);
- }
+ }*/
min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len
+ VXLAN_HLEN + sizeof(struct iphdr)
@@ -1236,6 +1238,8 @@ static int vxlan_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *sk
}
if (vxflags & VXLAN_F_GBP)
vxlan_build_gbp_hdr(vxh, vxflags, md);
+ else if (vxflags & VXLAN_F_GPE)
+ vxlan_build_gpe_hdr(vxh, vxflags, md);
ovs_skb_set_inner_protocol(skb, htons(ETH_P_TEB));
--
1.9.3

View File

@ -1,82 +0,0 @@
From 16982ccaf9249550d01d1ef5d298f97ee6537eb0 Mon Sep 17 00:00:00 2001
From: Yi Yang <yi.y.yang@intel.com>
Date: Wed, 27 Apr 2016 14:50:29 +0800
Subject: [PATCH 6/6] Fix VxLAN-gpe + Eth + NSH issues
- Set encap_eth_type to 0x894F on doing push_nsh
in kernel data path
- Set VxLAN-gpe next protocol present bit
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
datapath/actions.c | 1 +
datapath/linux/compat/vxlan.c | 8 ++++----
lib/flow.c | 2 +-
lib/odp-util.c | 2 +-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/datapath/actions.c b/datapath/actions.c
index 7072638..ffa1f04 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -275,6 +275,7 @@ static int push_nsh(struct sk_buff *skb, struct sw_flow_key *key,
OVS_CB(skb)->encap_eth_header = (struct encap_eth_hdr *)skb->data;
OVS_CB(skb)->nsh_header = (struct nsh_hdr *)(skb->data + ENCAP_ETH_LEN);
memcpy(skb->data, nsh->header, ETH_NSH_TYPE1_HEADER_SIZE);
+ OVS_CB(skb)->encap_eth_header->encap_eth_type = htons(ETH_P_NSH);
}
else
return -EINVAL;
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 3c05141..05fb226 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -1051,15 +1051,15 @@ static void vxlan_build_gpe_hdr(struct vxlanhdr *vxh, u32 vxflags,
{
struct vxlanhdr_gpe *gpe;
- if (!md->gpe)
- return;
-
gpe = (struct vxlanhdr_gpe*)vxh;
vxh->vx_flags |= htonl(VXLAN_HF_GPE);
if (md->gpe & VXLAN_GPE_OAM_FLAG)
gpe->oam_flag = 1;
- gpe->next_proto = md->gpe & VXLAN_GPE_NP_MASK;
+ if (md->gpe == 0)
+ gpe->next_proto = VXLAN_GPE_NP_NSH;
+ else
+ gpe->next_proto = md->gpe & VXLAN_GPE_NP_MASK;
}
#if IS_ENABLED(CONFIG_IPV6)
diff --git a/lib/flow.c b/lib/flow.c
index 887b023..6710e20 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -915,7 +915,7 @@ flow_get_metadata(const struct flow *flow, struct match *flow_metadata)
if (flow->tunnel.gbp_flags) {
match_set_tun_gbp_flags(flow_metadata, flow->tunnel.gbp_flags);
}
- if (flow->tunnel.gpe_np != htons(0)) {
+ if (flow->tunnel.gpe_np != 0) {
match_set_tun_gpe_np(flow_metadata, flow->tunnel.gpe_np);
}
if (flow->tunnel.gpe_flags) {
diff --git a/lib/odp-util.c b/lib/odp-util.c
index 7721cc4..51f0545 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -1982,7 +1982,7 @@ odp_tun_key_from_attr__(const struct nlattr *attr,
};
struct nlattr *ext[ARRAY_SIZE(vxlan_opts_policy)];
- if (!nl_parse_nested(a, vxlan_opts_policy, ext, ARRAY_SIZE(ext))) {
+ if (!nl_parse_nested(a, vxlan_opts_policy, ext, ARRAY_SIZE(vxlan_opts_policy))) {
return ODP_FIT_ERROR;
}
--
1.9.3

View File

@ -1 +0,0 @@
The patches were copied from commit id 307b06d986a49698c01caa3d6ed62fd7dac83e87 in https://github.com/yyang13/ovs_nsh_patches