Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into ddlog3
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpettit committed Dec 21, 2018
2 parents 49cae42 + b559c8b commit 261aeb1
Show file tree
Hide file tree
Showing 57 changed files with 1,105 additions and 402 deletions.
30 changes: 30 additions & 0 deletions .cirrus.yml
@@ -0,0 +1,30 @@
freebsd_build_task:

freebsd_instance:
matrix:
image: freebsd-12-0-release-amd64
image: freebsd-11-2-release-amd64
cpu: 4
memory: 8G

env:
matrix:
COMPILER: gcc
COMPILER: clang

prepare_script:
- pkg install -y automake libtool gmake gcc wget
python py27-six py27-sphinx

configure_script:
- ./boot.sh
- ./configure CC=$COMPILER MAKE=gmake OVS_CFLAGS='-Wall' --enable-Werror
|| { cat config.log; exit 1; }

build_script:
- gmake -j8

# TODO(i.maximets): Uncomment the test suite execution when it is fixed.
# check_script:
# - gmake -j8 check TESTSUITEFLAGS=-j8 RECHECK=yes
# || { cat ./tests/testsuite.log; exit 1; }
8 changes: 4 additions & 4 deletions .travis/linux-build.sh
Expand Up @@ -56,9 +56,9 @@ function install_dpdk()
cd dpdk-$1
git checkout tags/v$1
else
wget http://fast.dpdk.org/rel/dpdk-$1.tar.gz
tar xzvf dpdk-$1.tar.gz > /dev/null
DIR_NAME=$(tar -tf dpdk-$1.tar.gz | head -1 | cut -f1 -d"/")
wget https://fast.dpdk.org/rel/dpdk-$1.tar.xz
tar xvf dpdk-$1.tar.xz > /dev/null
DIR_NAME=$(tar -tf dpdk-$1.tar.xz | head -1 | cut -f1 -d"/")
if [ $DIR_NAME != "dpdk-$1" ]; then mv $DIR_NAME dpdk-$1; fi
cd dpdk-$1
fi
Expand All @@ -83,7 +83,7 @@ fi

if [ "$DPDK" ]; then
if [ -z "$DPDK_VER" ]; then
DPDK_VER="17.11.4"
DPDK_VER="18.11"
fi
install_dpdk $DPDK_VER
if [ "$CC" = "clang" ]; then
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS.rst
Expand Up @@ -235,7 +235,9 @@ Mark Maglana mmaglana@gmail.com
Mark Michelson mmichels@redhat.com
Markos Chandras mchandras@suse.de
Martin Casado casado@cs.stanford.edu
Martin Fong mwfong@csl.sri.com
Martino Fornasa mf@fornasa.it
Martin Xu martinxu9.ovs@gmail.com
Maryam Tahhan maryam.tahhan@intel.com
Matteo Croce mcroce@redhat.com
Mauricio Vásquez mauricio.vasquezbernal@studenti.polito.it
Expand Down
11 changes: 6 additions & 5 deletions Documentation/intro/install/dpdk.rst
Expand Up @@ -42,7 +42,7 @@ Build requirements
In addition to the requirements described in :doc:`general`, building Open
vSwitch with DPDK will require the following:

- DPDK 17.11.4
- DPDK 18.11

- A `DPDK supported NIC`_

Expand Down Expand Up @@ -71,9 +71,9 @@ Install DPDK
#. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``::

$ cd /usr/src/
$ wget http://fast.dpdk.org/rel/dpdk-17.11.4.tar.xz
$ tar xf dpdk-17.11.4.tar.xz
$ export DPDK_DIR=/usr/src/dpdk-stable-17.11.4
$ wget http://fast.dpdk.org/rel/dpdk-18.11.tar.xz
$ tar xf dpdk-18.11.tar.xz
$ export DPDK_DIR=/usr/src/dpdk-18.11
$ cd $DPDK_DIR

#. (Optional) Configure DPDK as a shared library
Expand Down Expand Up @@ -672,7 +672,8 @@ Limitations
The latest list of validated firmware versions can be found in the `DPDK
release notes`_.

.. _DPDK release notes: http://dpdk.org/doc/guides/rel_notes/release_17_11.html
.. _DPDK release notes:
https://doc.dpdk.org/guides/rel_notes/release_18_11.html

- Upper bound MTU: DPDK device drivers differ in how the L2 frame for a
given MTU value is calculated e.g. i40e driver includes 2 x vlan headers in
Expand Down
3 changes: 2 additions & 1 deletion Documentation/topics/dpdk/ring.rst
Expand Up @@ -82,4 +82,5 @@ DPDK. However, this functionality was removed because:
- :doc:`vhost-user interfaces <vhost-user>` are the de facto DPDK-based path to
guests

.. _DPDK documentation: https://dpdk.readthedocs.io/en/v17.11/prog_guide/ring_lib.html
.. _DPDK documentation:
https://doc.dpdk.org/guides-18.11/prog_guide/ring_lib.html
8 changes: 4 additions & 4 deletions Documentation/topics/dpdk/vhost-user.rst
Expand Up @@ -320,9 +320,9 @@ To begin, instantiate a guest as described in :ref:`dpdk-vhost-user` or
DPDK sources to VM and build DPDK::

$ cd /root/dpdk/
$ wget http://fast.dpdk.org/rel/dpdk-17.11.4.tar.xz
$ tar xf dpdk-17.11.4.tar.xz
$ export DPDK_DIR=/root/dpdk/dpdk-stable-17.11.4
$ wget http://fast.dpdk.org/rel/dpdk-18.11.tar.xz
$ tar xf dpdk-18.11.tar.xz
$ export DPDK_DIR=/root/dpdk/dpdk-18.11
$ export DPDK_TARGET=x86_64-native-linuxapp-gcc
$ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET
$ cd $DPDK_DIR
Expand Down Expand Up @@ -502,4 +502,4 @@ Because of this limitation, this feature is considered 'experimental'.

Further information can be found in the
`DPDK documentation
<http://dpdk.readthedocs.io/en/v17.11/prog_guide/vhost_lib.html>`__
<https://doc.dpdk.org/guides-18.11/prog_guide/vhost_lib.html>`__
1 change: 1 addition & 0 deletions Makefile.am
Expand Up @@ -76,6 +76,7 @@ EXTRA_DIST = \
MAINTAINERS.rst \
README.rst \
NOTICE \
.cirrus.yml \
.travis.yml \
.travis/linux-build.sh \
.travis/linux-prepare.sh \
Expand Down
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -12,6 +12,7 @@ Post-v2.10.0
- DPDK:
* Add option for simple round-robin based Rxq to PMD assignment.
It can be set with pmd-rxq-assign.
* Add support for DPDK 18.11
- Add 'symmetric_l3' hash function.
- OVS now honors 'updelay' and 'downdelay' for bonds with LACP configured.
- ovs-vswitchd:
Expand Down
20 changes: 19 additions & 1 deletion acinclude.m4
Expand Up @@ -287,6 +287,19 @@ AC_DEFUN([OVS_CHECK_DPDK], [
[AC_DEFINE([DPDK_PDUMP], [1], [DPDK pdump enabled in OVS.])])
])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[
#include <rte_config.h>
#if RTE_LIBRTE_MLX5_PMD
#error
#endif
], [])
], [],
[AC_SEARCH_LIBS([mnl_attr_put],[mnl],[],[AC_MSG_ERROR([unable to find libmnl, install the dependency package])])
DPDK_EXTRA_LIB="-lmnl"
AC_DEFINE([DPDK_MNL], [1], [MLX5 PMD detected in DPDK.])])
# On some systems we have to add -ldl to link with dpdk
#
# This code, at first, tries to link without -ldl (""),
Expand Down Expand Up @@ -508,8 +521,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [IS_ERR_OR_NULL])
OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [PTR_ERR_OR_ZERO])
OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], [DEFINE_STATIC_KEY_FALSE],
OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], [static_branch_unlikely(],
[OVS_DEFINE([HAVE_UPSTREAM_STATIC_KEY])])
OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], [DEFINE_STATIC_KEY_FALSE],
[OVS_DEFINE([HAVE_DEFINE_STATIC_KEY])])
OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random])
OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [ether_addr_copy])
Expand Down Expand Up @@ -935,6 +950,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
[OVS_DEFINE([HAVE_VOID_NDO_GET_STATS64])])
OVS_GREP_IFELSE([$KSRC/include/linux/timer.h], [init_timer_deferrable],
[OVS_DEFINE([HAVE_INIT_TIMER_DEFERRABLE])])
OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip_tunnels.h],
[ip_tunnel_info_opts_set], [flags],
[OVS_DEFINE([HAVE_IP_TUNNEL_INFO_OPTS_SET_FLAGS])])
if cmp -s datapath/linux/kcompat.h.new \
datapath/linux/kcompat.h >/dev/null 2>&1; then
Expand Down
32 changes: 32 additions & 0 deletions datapath/actions.c
Expand Up @@ -1068,6 +1068,28 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
clone_flow_key);
}

/* When 'last' is true, clone() should always consume the 'skb'.
* Otherwise, clone() should keep 'skb' intact regardless what
* actions are executed within clone().
*/
static int clone(struct datapath *dp, struct sk_buff *skb,
struct sw_flow_key *key, const struct nlattr *attr,
bool last)
{
struct nlattr *actions;
struct nlattr *clone_arg;
int rem = nla_len(attr);
bool dont_clone_flow_key;

/* The first action is always 'OVS_CLONE_ATTR_ARG'. */
clone_arg = nla_data(attr);
dont_clone_flow_key = nla_get_u32(clone_arg);
actions = nla_next(clone_arg, &rem);

return clone_execute(dp, skb, key, 0, actions, rem, last,
!dont_clone_flow_key);
}

static void execute_hash(struct sk_buff *skb, struct sw_flow_key *key,
const struct nlattr *attr)
{
Expand Down Expand Up @@ -1347,6 +1369,16 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
consume_skb(skb);
return 0;
}
break;

case OVS_ACTION_ATTR_CLONE: {
bool last = nla_is_last(a, rem);

err = clone(dp, skb, key, a, last);
if (last)
return err;
break;
}
}

if (unlikely(err)) {
Expand Down
6 changes: 5 additions & 1 deletion datapath/conntrack.c
Expand Up @@ -1216,7 +1216,7 @@ static int ovs_ct_commit(struct net *net, struct sw_flow_key *key,
&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
if (err) {
net_warn_ratelimited("openvswitch: zone: %u "
"execeeds conntrack limit\n",
"exceeds conntrack limit\n",
info->zone.id);
return err;
}
Expand Down Expand Up @@ -1370,6 +1370,10 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name,

rcu_assign_pointer(help->helper, helper);
info->helper = helper;

if (info->nat)
request_module("ip_nat_%s", name);

return 0;
}

Expand Down
5 changes: 3 additions & 2 deletions datapath/datapath.c
Expand Up @@ -1594,8 +1594,9 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
goto err_destroy_table;
}

dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head),
GFP_KERNEL);
dp->ports = kmalloc_array(DP_VPORT_HASH_BUCKETS,
sizeof(struct hlist_head),
GFP_KERNEL);
if (!dp->ports) {
err = -ENOMEM;
goto err_destroy_percpu;
Expand Down
80 changes: 79 additions & 1 deletion datapath/flow_netlink.c
Expand Up @@ -2465,6 +2465,40 @@ static int validate_and_copy_sample(struct net *net, const struct nlattr *attr,
return 0;
}

static int validate_and_copy_clone(struct net *net,
const struct nlattr *attr,
const struct sw_flow_key *key,
struct sw_flow_actions **sfa,
__be16 eth_type, __be16 vlan_tci,
bool log, bool last)
{
int start, err;
u32 exec;

if (nla_len(attr) && nla_len(attr) < NLA_HDRLEN)
return -EINVAL;

start = add_nested_action_start(sfa, OVS_ACTION_ATTR_CLONE, log);
if (start < 0)
return start;

exec = last || !actions_may_change_flow(attr);

err = ovs_nla_add_action(sfa, OVS_CLONE_ATTR_EXEC, &exec,
sizeof(exec), log);
if (err)
return err;

err = __ovs_nla_copy_actions(net, attr, key, sfa,
eth_type, vlan_tci, log);
if (err)
return err;

add_nested_action_end(*sfa, start);

return 0;
}

void ovs_match_init(struct sw_flow_match *match,
struct sw_flow_key *key,
bool reset_key,
Expand Down Expand Up @@ -2521,7 +2555,9 @@ static int validate_and_copy_set_tun(const struct nlattr *attr,
struct ovs_tunnel_info *ovs_tun;
struct nlattr *a;
int err = 0, start, opts_type;
__be16 dst_opt_type;

dst_opt_type = 0;
ovs_match_init(&match, &key, true, NULL);
opts_type = ip_tun_from_nlattr(nla_data(attr), &match, false, log);
if (opts_type < 0)
Expand All @@ -2533,10 +2569,13 @@ static int validate_and_copy_set_tun(const struct nlattr *attr,
err = validate_geneve_opts(&key);
if (err < 0)
return err;
dst_opt_type = TUNNEL_GENEVE_OPT;
break;
case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS:
dst_opt_type = TUNNEL_VXLAN_OPT;
break;
case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS:
dst_opt_type = TUNNEL_ERSPAN_OPT;
break;
}
}
Expand Down Expand Up @@ -2578,7 +2617,7 @@ static int validate_and_copy_set_tun(const struct nlattr *attr,
*/
ip_tunnel_info_opts_set(tun_info,
TUN_METADATA_OPTS(&key, key.tun_opts_len),
key.tun_opts_len);
key.tun_opts_len, dst_opt_type);
add_nested_action_end(*sfa, start);

return err;
Expand Down Expand Up @@ -2852,6 +2891,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
[OVS_ACTION_ATTR_PUSH_NSH] = (u32)-1,
[OVS_ACTION_ATTR_POP_NSH] = 0,
[OVS_ACTION_ATTR_METER] = sizeof(u32),
[OVS_ACTION_ATTR_CLONE] = (u32)-1,
};
const struct ovs_action_push_vlan *vlan;
int type = nla_type(a);
Expand Down Expand Up @@ -3041,6 +3081,18 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
/* Non-existent meters are simply ignored. */
break;

case OVS_ACTION_ATTR_CLONE: {
bool last = nla_is_last(a, rem);

err = validate_and_copy_clone(net, a, key, sfa,
eth_type, vlan_tci,
log, last);
if (err)
return err;
skip_copy = true;
break;
}

default:
OVS_NLERR(log, "Unknown Action type %d", type);
return -EINVAL;
Expand Down Expand Up @@ -3119,6 +3171,26 @@ static int sample_action_to_attr(const struct nlattr *attr,
return err;
}

static int clone_action_to_attr(const struct nlattr *attr,
struct sk_buff *skb)
{
struct nlattr *start;
int err = 0, rem = nla_len(attr);

start = nla_nest_start(skb, OVS_ACTION_ATTR_CLONE);
if (!start)
return -EMSGSIZE;

err = ovs_nla_put_actions(nla_data(attr), rem, skb);

if (err)
nla_nest_cancel(skb, start);
else
nla_nest_end(skb, start);

return err;
}

static int set_action_to_attr(const struct nlattr *a, struct sk_buff *skb)
{
const struct nlattr *ovs_key = nla_data(a);
Expand Down Expand Up @@ -3207,6 +3279,12 @@ int ovs_nla_put_actions(const struct nlattr *attr, int len, struct sk_buff *skb)
return err;
break;

case OVS_ACTION_ATTR_CLONE:
err = clone_action_to_attr(a, skb);
if (err)
return err;
break;

default:
if (nla_put(skb, type, nla_len(a), nla_data(a)))
return -EMSGSIZE;
Expand Down

0 comments on commit 261aeb1

Please sign in to comment.