]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
6 years agodatapath-windows: Account for VLAN tag in tunnel Decap
Shashank Ram [Mon, 20 Nov 2017 23:06:14 +0000 (15:06 -0800)]
datapath-windows: Account for VLAN tag in tunnel Decap

Decap functions for tunneling protocols do not compute
the packet header offsets correctly when there is a VLAN
tag in the L2 header. This results in incorrect checksum
computation causing the packet to be dropped.

This patch adds support to account for the VLAN tag in the
packet if its present, and makes use of the OvsExtractLayers()
function to correctly compute the header offsets for different
layers.

Testing done:
- Tested Geneve, STT, Vxlan and Gre and verified that there
  are no regressions.
- Verified that packets with VLAN tags are correctly handled
  in the decap code of all tunneling protocols. Previously,
  this would result in packet drops due to invalid checksums
  being computed.
- Verified that non-VLAN tagged packets are handled correctly.

Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Anand Kumar <kumaranand@vmware.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
6 years agoUpdate mailing list archive pointers to the current server.
Justin Pettit [Mon, 27 Nov 2017 22:19:30 +0000 (14:19 -0800)]
Update mailing list archive pointers to the current server.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-util: Fix buffer overread in parsing string form of ODP flows.
Ben Pfaff [Mon, 27 Nov 2017 01:34:59 +0000 (17:34 -0800)]
odp-util: Fix buffer overread in parsing string form of ODP flows.

scan_u128() should return 0 on an error but it actually returned an errno
value in some cases, so a command like this:
    ovs-appctl dpctl/add-flow 'ct_label(1/55555555555555555555555555)' ''
could cause a buffer overread.

This bug is not as severe as it may sound because the string form of ODP
flows is not used over OpenFlow or OVSDB, only through the appctl interface
that is normally used just by local system administrators and not exposed
over a network.

Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
6 years agotc: Fix build breakage on GCC 7 by annotating fall-through.
Ben Pfaff [Mon, 27 Nov 2017 00:26:41 +0000 (16:26 -0800)]
tc: Fix build breakage on GCC 7 by annotating fall-through.

Open vSwitch enables the GCC 7+ option that warns about fall-through
switch statements.  This commit fixes newly introduced warnings.

Fixes: d6118e628988 ("netdev-tc-offloads: Verify csum flags on dump from tc")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Paul Blakey <paulb@mellanox.com>
6 years agoOpenvSwitch logrotate: Use ctl file path as target in ovs-appctl to reset logs
Numan Siddique [Wed, 8 Nov 2017 08:59:07 +0000 (14:29 +0530)]
OpenvSwitch logrotate: Use ctl file path as target in ovs-appctl to reset logs

Presently, logrotate script, searches for the pid files in /var/log/openvswitch
and passes the pid file name (without .pid) as target to ovs-appctl. This approach
doesn't work for OVN DB servers since the ctl files are generated as "ovnnb_db.ctl"
and "ovnsb_db.ctl". So search for the .ctl files instead and use them as target to
ovs-appctl.

Suggested-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agoovn-ctl: Add -vfile:info option to OVN_NB/SB_LOG options
Numan Siddique [Wed, 8 Nov 2017 08:58:49 +0000 (14:28 +0530)]
ovn-ctl: Add -vfile:info option to OVN_NB/SB_LOG options

In the RHEL environment, when OVN db servers are started using ovn-ctl,
log files are empty. Adding "-vfile:info" option to ovsdb-server is
resolving this issue. Running 'ovs-apptctl -t .. vlog/reopen" results in the
logs appearing in the log files. This issue is seen with 2.7.2.

"-vfile:info" option is passed to ovn-northd and ovn-controller when starting.
There is no harm in adding this to OVN db servers.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoRemove Perl dependency.
Ben Pfaff [Wed, 15 Nov 2017 18:24:32 +0000 (10:24 -0800)]
Remove Perl dependency.

Nothing in the OVS tree uses Perl any longer, so remove the dependency.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert miscellaneous test code from Perl to Python.
Ben Pfaff [Wed, 15 Nov 2017 18:23:39 +0000 (10:23 -0800)]
tests: Convert miscellaneous test code from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert dot2pic build tool from Perl to Python.
Ben Pfaff [Mon, 20 Nov 2017 18:05:25 +0000 (10:05 -0800)]
tests: Convert dot2pic build tool from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert sodepends build tool from Perl to Python.
Ben Pfaff [Mon, 20 Nov 2017 17:40:45 +0000 (09:40 -0800)]
tests: Convert sodepends build tool from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert soexpand build tool from Perl to Python.
Ben Pfaff [Mon, 20 Nov 2017 17:41:42 +0000 (09:41 -0800)]
tests: Convert soexpand build tool from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert dpdkstrip utility from Perl to Python.
Ben Pfaff [Wed, 15 Nov 2017 06:58:06 +0000 (22:58 -0800)]
tests: Convert dpdkstrip utility from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert flowgen utility from Perl to Python.
Ben Pfaff [Wed, 15 Nov 2017 01:05:43 +0000 (17:05 -0800)]
tests: Convert flowgen utility from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert ovsdb-monitor-sort utility from Perl to Python.
Ben Pfaff [Mon, 20 Nov 2017 18:03:18 +0000 (10:03 -0800)]
tests: Convert ovsdb-monitor-sort utility from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert uuidfilt utility from Perl to Python.
Ben Pfaff [Mon, 27 Nov 2017 00:07:39 +0000 (16:07 -0800)]
tests: Convert uuidfilt utility from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotc: Send csum action only if we need to update csum
Paul Blakey [Tue, 21 Nov 2017 12:40:42 +0000 (14:40 +0200)]
tc: Send csum action only if we need to update csum

Currently we send the tc csum action even if it's not needed.
Fix that by sending it only if csum update flags isn't zero.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agotc: Fix wrong struct variable order
Paul Blakey [Tue, 21 Nov 2017 12:40:41 +0000 (14:40 +0200)]
tc: Fix wrong struct variable order

Fix the struct variable order to corrospond with
it's usage.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Remove redundant loop handling ovs action set
Paul Blakey [Tue, 21 Nov 2017 12:40:40 +0000 (14:40 +0200)]
netdev-tc-offloads: Remove redundant loop handling ovs action set

OVS action set always has a single nested OVS_KEY_ATTR_*
so there is no need to iterate it.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Remove redundant brackets
Paul Blakey [Tue, 21 Nov 2017 12:40:39 +0000 (14:40 +0200)]
netdev-tc-offloads: Remove redundant brackets

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Verify csum flags on dump from tc
Paul Blakey [Tue, 21 Nov 2017 12:40:38 +0000 (14:40 +0200)]
netdev-tc-offloads: Verify csum flags on dump from tc

On dump, parse and verify the tc csum action update flags
in the same way as we put them.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Fix accidental skipping of extended pedit keys
Paul Blakey [Tue, 21 Nov 2017 12:40:37 +0000 (14:40 +0200)]
netdev-tc-offloads: Fix accidental skipping of extended pedit keys

We only support extended pedit keys for now, so it's the type we
expect. Skip the legacy ones instead.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Fix travis compilation error
Paul Blakey [Tue, 21 Nov 2017 12:40:36 +0000 (14:40 +0200)]
netdev-tc-offloads: Fix travis compilation error

Travis complains about variable length array usage, use
a fixed size instead.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agoMerge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD
Ben Pfaff [Mon, 20 Nov 2017 16:59:57 +0000 (08:59 -0800)]
Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD

6 years agoAUHTORS: Add Vishal Deep Ajmera.
Ben Pfaff [Mon, 20 Nov 2017 16:57:24 +0000 (08:57 -0800)]
AUHTORS: Add Vishal Deep Ajmera.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-execute: Add missing break statement for CLONE action.
Vishal Deep Ajmera [Thu, 9 Nov 2017 10:15:31 +0000 (10:15 +0000)]
odp-execute: Add missing break statement for CLONE action.

This does not fix any existing bug but it makes the code less hazardous for
future updates.

Signed-off-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-tc-offloads: update stats properly on flow deletion
Paolo Abeni [Fri, 17 Nov 2017 13:36:22 +0000 (14:36 +0100)]
netdev-tc-offloads: update stats properly on flow deletion

Currently, when an offloaded DP flow is deleted, the related stats
are unconditionally cleared. As a result the counters for the
originating open flow are corrupted.

This change addresses the issue updating the DP stats with the current
values provided by the flower APIs before deleting the tc filter, as
currently done by others DP providers.

Tested vs different OVS H/W offload devices, verifying that the open flow
stats are correct after the expiration of the related, H/W offloaded DP
flow.

Fixes: 30b6b047260b ("netdev-tc-offloads: Implement netdev flow del using tc interface")
CC: Paul Blakey <paulb@mellanox.com>
Reported-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-dpdk: Fix mempool creation with large MTU.
Ilya Maximets [Fri, 10 Nov 2017 07:12:06 +0000 (10:12 +0300)]
netdev-dpdk: Fix mempool creation with large MTU.

Currently mempool name size limited to 25 characters by
RTE_MEMPOOL_NAMESIZE. netdev-dpdk tries to create mempool with the
following name pattern: "ovs_%{hash}_%{socket}_%{mtu}_%{n_mbuf}".

We have 3 chars for "ovs" + 4 chars for delimiters + 8 chars for
hash (because it's the 32 bit integer printed in hex) + 1 char for
socket_id (mostly 1, but it could be 2 on some systems; larger?) = 16.

Only 25 - 16 = 9 characters remains for mtu + n_mbufs.
Minimum usual value for mtu is 1500 --> 2030 (4 chars) after
dpdk_buf_size conversion and the minimum value for n_mbufs is 16384
(5 chars). So, all the 9 characters are used.

If we'll try to create port with mtu = 9500, mempool creation will
fail, because FRAME_LEN_TO_MTU(dpdk_buf_size(9500)) = 10222 (5 chars)
and this value will overflow the RTE_MEMPOOL_NAMESIZE limit.

Same issue will happen if we'll try to create port with big enough
number of queues or will try to create big enough number of PMD
threads (number of tx queues will enlarge the mempool requirements).

Fix that by removing the delimiters. To keep the readability (at least
partial) of the mempool names exact field sizes with zero padding
are used.

Following limits should be suitable for now:
 - Hash length: 8 chars (uint32_t in hex)
 - Socket ID  : 2 chars (For systems with up to 10 sockets)
 - MTU        : 5 chars (MTU (10^5 - 1) should be enough for now)
 - n_mbufs    : 7 chars (Up to 10^7 of mbufs)

   Total      : 22 + 3 (for "ovs") = 25

CC: Antonio Fischetti <antonio.fischetti@intel.com>
CC: Robert Wojciechowicz <robertx.wojciechowicz@intel.com>
Fixes: f06546a51dd8 ("Fix mempool names to reflect socket id.")
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Acked-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Tested-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agodpif-netdev: Rename rxq_interval.
Kevin Traynor [Tue, 7 Nov 2017 17:31:40 +0000 (17:31 +0000)]
dpif-netdev: Rename rxq_interval.

rxq_interval was added before there was other #defines
and code related to rxq intervals.

Rename to rxq_next_cycles_store in order to make it more intuitive.

Requested-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Fix calling vhost API with negative vid.
Ilya Maximets [Fri, 6 Oct 2017 10:50:14 +0000 (13:50 +0300)]
netdev-dpdk: Fix calling vhost API with negative vid.

Currently, rx and tx functions for vhost interfaces always obtain
'vid' twice. First time inside 'is_vhost_running' for checking
the value and the second time in enqueue/dequeue function calls to
send/receive packets. But second time we're not checking the
returned value. If vhost device will be destroyed between
checking and enqueue/dequeue, DPDK API will be called with
'-1' instead of valid 'vid'. DPDK API does not validate the 'vid'.
This leads to getting random memory value as a pointer to internal
device structure inside DPDK. Access by this pointer leads to
segmentation fault. For example:

  |00503|dpdk|INFO|VHOST_CONFIG: read message VHOST_USER_GET_VRING_BASE
  [New Thread 0x7fb6754910 (LWP 21246)]

  Program received signal SIGSEGV, Segmentation fault.
  rte_vhost_enqueue_burst at lib/librte_vhost/virtio_net.c:630
  630             if (dev->features & (1 << VIRTIO_NET_F_MRG_RXBUF))
  (gdb) bt full
  #0  rte_vhost_enqueue_burst at lib/librte_vhost/virtio_net.c:630
          dev = 0xffffffff
  #1  __netdev_dpdk_vhost_send at lib/netdev-dpdk.c:1803
          tx_pkts = <optimized out>
          cur_pkts = 0x7f340084f0
          total_pkts = 32
          dropped = 0
          i = <optimized out>
          retries = 0
  ...
  (gdb) p *((struct netdev_dpdk *) netdev)
  $8 = { ... ,
        flags = (NETDEV_UP | NETDEV_PROMISC), ... ,
        vid = {v = -1},
        vhost_reconfigured = false, ... }

Issue can be reproduced by stopping DPDK application (testpmd) inside
guest while heavy traffic flows to this VM.

Fix that by obtaining and checking the 'vid' only once.

CC: Ciara Loftus <ciara.loftus@intel.com>
Fixes: 0a0f39df1d5a ("netdev-dpdk: Add support for DPDK 16.07")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Billy O'Mahony <billy.o.mahony@intel.com>
Acked-by: Billy O'Mahony <billy.o.mahony@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Remove unused MAX_NB_MBUF.
Ilya Maximets [Fri, 10 Nov 2017 15:16:12 +0000 (18:16 +0300)]
netdev-dpdk: Remove unused MAX_NB_MBUF.

MAX_NB_MBUF was used as a default mempool size for almost all ports.
Not used since new per-port mempool allocation introduced.
MIN_NB_MBUF still used as a lower limit.

CC: Robert Wojciechowicz <robertx.wojciechowicz@intel.com>
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Factor out struct dpdk_mp.
Ilya Maximets [Fri, 10 Nov 2017 15:16:11 +0000 (18:16 +0300)]
netdev-dpdk: Factor out struct dpdk_mp.

Since commit d555d9bded5f ("netdev-dpdk: Create separate memory pool
for each port."), struct dpdk_mp is redundant because each mempool
can be used by single port only and this port already contains all
the information we store in dpdk_mp.
There is no need to duplicate the information.
Fields of this structure currently used only to generate mempool name.
But it's required only while creation and after that we can use
mp->name directly from the struct rte_mempool.

Let's remove this structure and use struct rte_mempool directly
instead.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Fix dpdk_mp leak in case of EEXIST.
Ilya Maximets [Fri, 10 Nov 2017 15:16:10 +0000 (18:16 +0300)]
netdev-dpdk: Fix dpdk_mp leak in case of EEXIST.

In case of EEXIST, 'dpdk_mp_create()' will allocate yet another
'struct dpdk_mp' with same 'mp' pointer inside. We need to free
this structure to avoid the leak.

CC: Robert Wojciechowicz <robertx.wojciechowicz@intel.com>
CC: Antonio Fischetti <antonio.fischetti@intel.com>
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.")
Fixes: b6b26021d2e2 ("netdev-dpdk: fix management of pre-existing mempools.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: replace uint8_t with dpdk_port_t
Mark Kavanagh [Fri, 20 Oct 2017 12:37:00 +0000 (13:37 +0100)]
netdev-dpdk: replace uint8_t with dpdk_port_t

netdev_dpdk_detach() declares a 'port_id' variable, of type uint8_t.
This variable should instead be of type dpdk_port_t.

Fixes: bb37956ac ("netdev-dpdk: Use uint8_t for port_id.")
CC: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-tc-offloads: Add support for action set
Paul Blakey [Mon, 18 Sep 2017 04:16:04 +0000 (07:16 +0300)]
netdev-tc-offloads: Add support for action set

Implement support for offloading ovs action set using
tc header rewrite action.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agotc: Add header rewrite using tc pedit action
Paul Blakey [Mon, 18 Sep 2017 04:16:03 +0000 (07:16 +0300)]
tc: Add header rewrite using tc pedit action

To be later used to implement ovs action set offloading.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellacom>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agoodp-util: Expose ovs flow key attr len table for reuse
Paul Blakey [Mon, 18 Sep 2017 04:16:02 +0000 (07:16 +0300)]
odp-util: Expose ovs flow key attr len table for reuse

Make ovs_flow_key_attr_lens() public to be reused by other modules.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agocompat: Add act_pedit compatibility for old kernels
Paul Blakey [Mon, 18 Sep 2017 04:16:01 +0000 (07:16 +0300)]
compat: Add act_pedit compatibility for old kernels

Added compatibility for action pedit.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev: Eliminate redundant ifindex mapping.
Ben Pfaff [Tue, 14 Nov 2017 18:15:11 +0000 (10:15 -0800)]
netdev: Eliminate redundant ifindex mapping.

Until now, the code for mapping ODP port number to ifindexes and vice versa
has maintained two completely separate data structures, one for each
direction.  It was possible for the two mappings to become out of sync
with each other since either one could change independently.  This commit
merges them into a single data structure (with two indexes), which at least
means that if one is removed then the other is as well.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agonetdev: Indentation and style fixes.
Ben Pfaff [Tue, 14 Nov 2017 18:15:10 +0000 (10:15 -0800)]
netdev: Indentation and style fixes.

White space changes only.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoovn.at: Fix MSYS IPv6 interpretation
Alin Gabriel Serdean [Tue, 14 Nov 2017 01:49:44 +0000 (03:49 +0200)]
ovn.at: Fix MSYS IPv6 interpretation

Unfortunately MSYS transforms `0::` into the location of the binaries i.e.:
c:\MinGW\msys\1.0\64.

Currently the test:
`testing ovn -- IPv6 Neighbor Solicitation for unknown MAC`
fails because of the above:
"ovn-nbctl: lrp0_ip6: invalid network address: aef0;c:\MinGW\msys\1.0\64"

This patch uses the full form of the IPv6 address instead of its shorter
notation.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev: Change macro to function.
Ben Pfaff [Mon, 13 Nov 2017 20:40:29 +0000 (12:40 -0800)]
netdev: Change macro to function.

There was no reason that this should have been a macro.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agotests: Try harder to figure out whether IPv6 is supported.
Ben Pfaff [Tue, 14 Nov 2017 00:57:48 +0000 (16:57 -0800)]
tests: Try harder to figure out whether IPv6 is supported.

Until now, the tests have tried to create an IPv6 socket to figure out
whether the system under test supports IPv6.  Recently we've seen test
failures on Travis which appear to be because, although the system supports
IPv6, test programs are not allowed to connect or bind IPv6 addresses.
This commit refines the test for IPv6 to also try to bind the IPv6
localhost address, which should convert the test failures to "skip"s.

Acked-by: William Tu <u9012063@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Tested-at: https://travis-ci.org/gvrose8192/ovs-experimental
Reported-at: https://github.com/travis-ci/travis-ci/issues/8711
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoinstaller-windows: Add x64 installer build via command line
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:12:03 +0000 (12:12 +0200)]
installer-windows: Add x64 installer build via command line

Add a new variable to know on which platform we are compiling.

Make the msbuild command to be aware of the platform we want to build.

Shorter the msbuild parameters from `property:`->`p:`. Change slashes
to double slashes so msys does not get confused.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoinstaller-windows: Modify installer so it can be compiled on x64
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:12:02 +0000 (12:12 +0200)]
installer-windows: Modify installer so it can be compiled on x64

Add variables to know for which platform we are building.

They are needed for the installer to know if it should install
in `Program Files (x86)` or `Program Files` and which registry
it needs to update.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoinstaller-windows: Call WIX binaries outside of MSBuild on x64
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:12:01 +0000 (12:12 +0200)]
installer-windows: Call WIX binaries outside of MSBuild on x64

Unfortunately all WIX binaries (candle, heat, etc) are only 32 bit (up to
the latest version 3.11).

For performance reasons they are run as .NET assemblies inside the MSBuild
process. Running 32 bit assemblies inside a 64 bit process (MSBuild) makes
them segfault.

Add a new option for heat to be run as an individual process when the
platform is not x86.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoinstaller-windows: Resolve WIX solution build type
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:12:00 +0000 (12:12 +0200)]
installer-windows: Resolve WIX solution build type

Until now the x64 build of the installer solution was pointing to the
x86 build of the WIX project.

This patch changes for them to match.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoinstaller-windows: Remove unused entries from WIX project
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:11:59 +0000 (12:11 +0200)]
installer-windows: Remove unused entries from WIX project

Remove duplicate and obsolete entries from the installer WIX project.

Found by inspection.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agobuild-windows: Suppress output from MSBuild
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:11:58 +0000 (12:11 +0200)]
build-windows: Suppress output from MSBuild

Add `nologo` parameter to MSBuild to suppress the banner.

This will make tidier log messages.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoofp-actions: Add compare to offsetof need for MSVC 2015/17
Alin Gabriel Serdean [Wed, 1 Nov 2017 17:19:07 +0000 (19:19 +0200)]
ofp-actions: Add compare to offsetof need for MSVC 2015/17

Unfortunately starting from VS 2015, the "C" definition for `offsetof`
has been changed. Please see:
https://stackoverflow.com/questions/42725929/using-offsetof-with-enum-does-not-compile-in-visual-studio-2015/42726424

Several people reported the bug for 2015 and also 2017 (i.e. :
https://developercommunity.visualstudio.com/content/problem/22196/static-assert-cannot-compile-constexprs-method-tha.html
), but we don't have a fix yet.

This patch adds an explicit compare, although we could redefine the macro
for the same effect.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agobuild-windows: Add check for struct timespec
Alin Gabriel Serdean [Wed, 1 Nov 2017 17:19:06 +0000 (19:19 +0200)]
build-windows: Add check for struct timespec

Starting from WDK 10 the structure `timespec` is defined in <time.h>.

This patch adds a check for the structure to make <pthread.h> aware of it, so
it doesn't try to redefine the structure.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agowindows: Add interlocked function definitions for VS 2015
Alin Gabriel Serdean [Wed, 1 Nov 2017 17:19:05 +0000 (19:19 +0200)]
windows: Add interlocked function definitions for VS 2015

For some unclear and accidental reasons, the Windows 10 SDK
renamed _Interlocked* functions to _InlineInterlocked* (although the
documentation still points to the old form:
https://msdn.microsoft.com/en-us/library/191ca0sk.aspx).

This patch adds mappings for used functions.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agowindows: _set_output_format is no longer required from VS2015
Alin Gabriel Serdean [Wed, 1 Nov 2017 17:19:04 +0000 (19:19 +0200)]
windows: _set_output_format is no longer required from VS2015

_set_output_format is deprecated ang no longer required
starting from MSC_VER 1900 (VS 2015):
https://msdn.microsoft.com/en-us/library/bb531344(v=vs.140).aspx .

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agonetdev, dpif: fix the crash/assert on port delete
Ashish Varma [Mon, 6 Nov 2017 20:17:45 +0000 (12:17 -0800)]
netdev, dpif: fix the crash/assert on port delete

a crash is seen in "netdev_ports_remove" when an interface is deleted and added
back in the system and when the interface is part of a bridge configuration.
e.g. steps:
  create a tap0 interface using "ip tuntap add.."
  add the tap0 interface to br0 using "ovs-vsctl add-port.."
  delete the tap0 interface from system using "ip tuntap del.."
  add the tap0 interface back in system using "ip tuntap add.."
                       (this changes the ifindex of the interface)
  delete tap0 from br0 using "ovs-vsctl del-port.."

In the function "netdev_ports_insert", two hmap entries were created for
mapping "portnum -> netdev" and "ifindex -> portnum".
When the interface is deleted from the system, the "netdev_ports_remove"
function is not getting called and the old ifindex entry is not getting
cleaned up from the "ifindex_to_port" hmap.

As part of the fix, added function "dpif_port_remove" which will call
"netdev_ports_remove" in the path where the interface deletion from the system
is detected.
Also, in "netdev_ports_remove", added the code where the "ifindex_to_port_data"
(ifindex -> portnum map node) is getting freed when the ifindex is not
available any more. (as the interface is already deleted.)

VMware-BZ: #1975788
Signed-off-by: Ashish Varma <ashishvarma.ovs@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-tcpdump: handle large interface names on linux
Aaron Conole [Fri, 10 Nov 2017 22:33:20 +0000 (17:33 -0500)]
ovs-tcpdump: handle large interface names on linux

Linux has a fixed size interface name, which will not change.  This means
that attempts to dump interfaces whose names are larger than the max size
will result in an error making the tap device.

This commit brings a new function.  When the generated name would be too
large, use a random number prefixed by 'ovsmi' instead.

Reported-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Add document describing new features in OVN added in version 2.8.
Ben Pfaff [Thu, 9 Nov 2017 22:02:29 +0000 (14:02 -0800)]
ovn: Add document describing new features in OVN added in version 2.8.

This is adapted from a talk I gave at OpenStack Summit Sydney on Nov. 6.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
6 years agoovs-ctl: Don't remember vport-* kernel modules
Gurucharan Shetty [Fri, 10 Nov 2017 22:30:00 +0000 (14:30 -0800)]
ovs-ctl: Don't remember vport-* kernel modules

From OVS 2.8, ovs-vswitchd, when it starts, will
load the kernel modules for tunnels. It has logic
inside it to choose either upstream kernel module
or vport-* kernel module.

So, when we run 'force-reload-kmod' to upgrade to
OVS 2.8 from a previous version,  we do not need to
remember the vport-* kernel module that was previously
loaded.  It is not really harmful to load vport-* kernel
module though.

On RHEL7.x and OVS 2.8, we use the upstream "geneve" kernel
module for tunnels.

But, on RHEL 7.x we have hit a bug caused by iptables
startup script which tries to remove all kernel modules
related to linux conntrack. It fails to unload openvswitch
kernel module because it has a reference count on it. But it
succeeds in unloading vport-geneve and in turn the upstream
"geneve" kernel module.  This causes the tunnels to go down.

With this patch, we avoid the above situation, by not loading
vport-geneve kernel module.  ovs-vswitchd when it starts will
load upstream geneve. And when "iptables stop" runs, since
"geneve" has nothing to do with conntrack, it spares it.
Ideally, we should fix this by incrementing the refcount
on the kernel modules.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agodpif-netdev: Remove unnecessary resets on new rxqs.
Kevin Traynor [Sun, 12 Nov 2017 11:47:18 +0000 (11:47 +0000)]
dpif-netdev: Remove unnecessary resets on new rxqs.

Commit 38259bd7eb21 (dpif-netdev: Initialize new rxqs in
port_reconfigure().) added a memset for the dp_netdev_rxq of new rxq's
to remove a valgrind warning for an index field in that struct.  With
the addition of that memset, it also means there are some existing
resets on other fields in that struct that are no longer needed and
gives the opportunity to simplify by removing them.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev: Remove EOPNOTSUPP related comment for netdev_send().
Ilya Maximets [Thu, 9 Nov 2017 12:34:08 +0000 (15:34 +0300)]
netdev: Remove EOPNOTSUPP related comment for netdev_send().

Since 57eebbb4c315, the caller must make sure that 'netdev' supports
sending. This mentioned at the start of the comment.

Fixes: 57eebbb4c315 ("dpif-netdev: Don't try to output on a device without txqs.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoNSH: Adjust NSH wire format to the latest IETF draft
Jan Scheurich [Mon, 6 Nov 2017 23:40:21 +0000 (00:40 +0100)]
NSH: Adjust NSH wire format to the latest IETF draft

This commit adjusts the NSH user space implementation in OVS to
the latest wire format defined in draft-ietf-sfc-nsh-28 (November 3
2017). The NSH_MDTYPE field was reduced from 8 to 4 bits. The FLAGS
field is reduced from 8 to 2 bits. A new 6 bit TTL header field is
added. The TTL field is set to 63 at encap(nsh).

Match and set_field support for the newly introduced TTL header field
and a corresponding dec_nsh_ttl action is not yet included and will be
implemented in a future patch.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoNSH: Minor bugfixes
Jan Scheurich [Tue, 7 Nov 2017 14:48:39 +0000 (15:48 +0100)]
NSH: Minor bugfixes

- Fix 2 incorrect length checks
- Remove unnecessary limit of MD length to 16 bytes
- Remove incorrect comments stating MD2 was not supported
- Pad metadata in encap_nsh with zeroes if not multiple of 4 bytes

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agorhel: Add support for "systemctl reload openvswitch"
Timothy Redaelli [Fri, 3 Nov 2017 20:39:17 +0000 (21:39 +0100)]
rhel: Add support for "systemctl reload openvswitch"

The reload procedure will trigger a script that saves the flows and tlv
maps (using ovs-save) then it restarts ovsdb-server, it stops ovs-vswitchd,
it sets other_config:flow-restore-wait=true (to wait till flow restore is
finished), it starts ovs-vswitchd, it restore the backupped flows/tlv
maps and it removes other_config:flow-restore-wait=true (logic mostly ripped
from ovs-ctl).

It uses systemctl with --job-mode=ignore-dependencies to restart ovsdb-server
and stop and start ovs-vswitchd in order to avoid systemd to restart the other
components due to dependencies (as explained in rhel/README.RHEL.rst).

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
6 years agoDocumentation: Fix for userspace testsuite directory name
László Sürü [Wed, 8 Nov 2017 10:20:20 +0000 (10:20 +0000)]
Documentation: Fix for userspace testsuite directory name

Open vSwitch Testing documentation Userspace datapath section shows incorrect directory name for test result.
Morever to this check-system-userspace test fails if another OVS instance is running.
This patch corrects the directory name and adds a note for other running instances.

Signed-off-by: László Sürü <laszlo.suru@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agovswitch.xml: Fix nonbreaking spaces.
Ben Pfaff [Wed, 8 Nov 2017 09:35:16 +0000 (01:35 -0800)]
vswitch.xml: Fix nonbreaking spaces.

Fixes: fb9fdd72893d ("vswitchd: Document option dst_port.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agovswitchd: Document option dst_port.
duanjiong [Mon, 6 Nov 2017 05:43:23 +0000 (13:43 +0800)]
vswitchd: Document option dst_port.

Otherwise the user does not know how to change it

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agopackets: Move declarations inside extern "C".
duanjiong [Mon, 6 Nov 2017 06:06:12 +0000 (14:06 +0800)]
packets: Move declarations inside extern "C".

It doesn't matter but it seems "more correct" this way.

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoconntrack: Include <sys/types.h> before <netinet/icmp6.h>.
Borja Marcos EA2EKH [Mon, 6 Nov 2017 09:32:12 +0000 (10:32 +0100)]
conntrack: Include <sys/types.h> before <netinet/icmp6.h>.

FreeBSD and Mac OS X require this.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpctl: manage ret value when dumping CT entries.
antonio.fischetti@intel.com [Tue, 26 Sep 2017 09:37:09 +0000 (10:37 +0100)]
dpctl: manage ret value when dumping CT entries.

Manage error value returned by ct_dpif_dump_next.

Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoAUTHORS: Add Matteo Croce.
Ben Pfaff [Fri, 3 Nov 2017 21:51:24 +0000 (14:51 -0700)]
AUTHORS: Add Matteo Croce.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-lib: dont't purge corrupted DB
Matteo Croce [Wed, 27 Sep 2017 13:46:13 +0000 (15:46 +0200)]
ovs-lib: dont't purge corrupted DB

In ovs-lib there is a function named upgrade_db which tries to convert a
database after OVS {up,down}grades. This function uses ovsdb-tool to
check if the DB needs to be upgraded. If the upgrade fails,
it purges the DB and create an empty one.
ovsdb-tool returns "yes" or "no" to indicate if the DB needs upgrading,
but if the DB is corrupted it returns a list of errors.
Change a condition from "!= no" to "= yes" because in case of DB
corruption upgrade_db would purge the existing DB without writing
anything in the logs.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agodpctl: Comment functions retrieving the datapath name.
antonio.fischetti@intel.com [Fri, 13 Oct 2017 08:25:13 +0000 (09:25 +0100)]
dpctl: Comment functions retrieving the datapath name.

Add a comment to functions retrieving the datapath name.

CC: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Fix remote not receive GARP, when localnet Port has vlan tag.
Guoshuai Li [Fri, 13 Oct 2017 14:09:51 +0000 (22:09 +0800)]
ovn: Fix remote not receive GARP, when localnet Port has vlan tag.

When sending a localnet port with vlan, the GARP packet needs push_vlan.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpif-netdev: Set MAX_RECIRC_DEPTH to 6.
Guoshuai Li [Fri, 22 Sep 2017 14:49:43 +0000 (22:49 +0800)]
dpif-netdev: Set MAX_RECIRC_DEPTH to 6.

In an ovn gateway node with DPDK, the RECIRC_DEPTH may be greater than 5.

Scenes:
VM ping self floating IP, or
VM ping Floating IP of VMs with the same network.

It need process UNDNAT SNAT in LRouter egress and
UNSNAT DNAT in LRouter ingress, and
output to geneve tunnel also need recirc.

This has an WARN:
dpif_netdev(pmd36)|WARN|Packet dropped. Max recirculation depth exceeded.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb: Remove break after OVS_NOT_REACHED.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:40 +0000 (08:57 +0100)]
ovsdb: Remove break after OVS_NOT_REACHED.

The break statement would never be executed as OVS_NOT_REACHED()
internally invokes abort() and causes process termination.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofp-actions: Remove return after OVS_NOT_REACHED.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:39 +0000 (08:57 +0100)]
ofp-actions: Remove return after OVS_NOT_REACHED.

The return statement would never be executed as OVS_NOT_REACHED()
internally invokes abort() and causes process termination.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto: Remove break after OVS_NOT_REACHED.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:38 +0000 (08:57 +0100)]
ofproto: Remove break after OVS_NOT_REACHED.

The break statement would never be executed as OVS_NOT_REACHED()
internally invokes abort() and causes process termination.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-dpdk: Refactor netdev_dpdk structure.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:37 +0000 (08:57 +0100)]
netdev-dpdk: Refactor netdev_dpdk structure.

This commit introduces below changes to netdev_dpdk structure.

- Mark cachelines and reorder few member variables.
- Maintain the grouping of related member variables.
- Add comment on the information on pad bytes where ever appropriate, so
  new members can be introduced in the future to fill the gaps.

  Below is how this structure looks with this commit.

                  Member                    size

         OVS_CACHE_LINE_MARKER cacheline0;
             dpdk_port_t port_id;            1
             bool attached;                  1
             ...

         OVS_CACHE_LINE_MARKER cacheline1;
             struct ovs_mutex;              48
             struct dpdk_mp *dpdk_mp;        8
             ...

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpif_netdev: Refactor dp_netdev_pmd_thread structure.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:36 +0000 (08:57 +0100)]
dpif_netdev: Refactor dp_netdev_pmd_thread structure.

This commit introduces below changes to dp_netdev_pmd_thread
structure.

- Mark cachelines and in this process reorder few members to avoid
  holes.
- Align emc_cache to a cacheline.
- Maintain the grouping of related member variables.
- Add comment on the information on pad bytes whereever appropriate so
  that new member variables may be introduced to fill the holes in future.

  Below is how the structure looks with this commit.

              Member                    size

     OVS_CACHE_LINE_MARKER cacheline0;
         struct dp_netdev * dp;          8
         struct cmap_node node;          8
         pthread_cond_t cond;           48

     OVS_CACHE_LINE_MARKER cacheline1;
         struct ovs_mutex cond_mutex;   48
         pthread_t  thread;              8
         unsigned int core_id;           4
         int        numa_id;             4

     OVS_CACHE_LINE_MARKER cacheline2;
         struct emc_cache flow_cache;   4849672

     ###cachelineX: 64 bytes, 0 pad bytes####
         struct cmap flow_table;         8
         ....

     ###cachelineY: 59 bytes, 5 pad bytes####
       struct dp_netdev_pmd_stats stats 40
         ....

     ###cachelineZ: 48 bytes, 16 pad bytes###
         struct ovs_mutex port_mutex;   48
         ....

This change also improve the performance marginally.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agocmap: Use PADDED_MEMBERS_CACHELINE_MARKER in cmap_impl.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:35 +0000 (08:57 +0100)]
cmap: Use PADDED_MEMBERS_CACHELINE_MARKER in cmap_impl.

Instead of explicitly adding the pad bytes to force the structure an
exact multiple of cacheline size, let the macro do the job. This way
the pad bytes will be auto adjusted when the new members get introduced
in to the structure.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoccmap: Use PADDED_MEMBERS macro in ccmap_impl structure.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:34 +0000 (08:57 +0100)]
ccmap: Use PADDED_MEMBERS macro in ccmap_impl structure.

Instead of explicitly adding the pad bytes to force the structure an exact
multiple of cacheline size, let the PADDED_MEMBERS macro do the job.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-execute: Use const qualifer for batch size.
Bhanuprakash Bodireddy [Wed, 20 Sep 2017 13:12:59 +0000 (14:12 +0100)]
odp-execute: Use const qualifer for batch size.

It is recommended to use const qualifer for 'num' that tracks the
packet batch count. This way 'num' can't be modified by iterator.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-linux: Clean up netdev_linux_sock_batch_send().
Bhanuprakash Bodireddy [Wed, 20 Sep 2017 13:12:56 +0000 (14:12 +0100)]
netdev-linux: Clean up netdev_linux_sock_batch_send().

Use DP_PACKET_BATCH_FOR_EACH macro and dp_packet_batch_size() API
in netdev_linux_sock_batch_send().

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-linux: Use DP_PACKET_BATCH_FOR_EACH in netdev_linux_tap_batch_send.
Bhanuprakash Bodireddy [Wed, 20 Sep 2017 13:12:51 +0000 (14:12 +0100)]
netdev-linux: Use DP_PACKET_BATCH_FOR_EACH in netdev_linux_tap_batch_send.

Use DP_PACKET_BATCH_FOR_EACH macro in netdev_linux_tap_batch_send().

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpif-netdev: Reorder elements in dp_netdev_rxq structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:20 +0000 (18:59 +0100)]
dpif-netdev: Reorder elements in dp_netdev_rxq structure.

By reordering elements in dp_netdev_rxq structure, pad bytes and a hole
can be removed.

Before: structure size: 104, sum holes: 1, sum padbytes:4, cachelines:2
After : structure size:  96, sum holes: 0, sum padbytes:0, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-provider: Reorder elements in netdev structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:19 +0000 (18:59 +0100)]
netdev-provider: Reorder elements in netdev structure.

By reordering elements in netdev structure, holes can be removed.

Before: structure size: 88, sum holes: 10, cachelines:2
After : structure size: 80, sum holes:  2, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-provider: Reorder element in netdev_flow_dump structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:18 +0000 (18:59 +0100)]
netdev-provider: Reorder element in netdev_flow_dump structure.

By reordering bool in netdev_flow_dump structure, pad bytes can be
reduced.

Before: structure size: 32, sum holes: 4, sum padbytes:7, cachelines:1
After : structure size: 24, sum holes: 3, sum padbytes:0, cachelines:1

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev: Reorder elements in netdev_tunnel_config structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:17 +0000 (18:59 +0100)]
netdev: Reorder elements in netdev_tunnel_config structure.

By reordering elements in netdev_tunnel_config structure, sum holes and
pad bytes can be reduced.

Before: structure size: 96, sum holes: 17, pad bytes: 4, cachelines:2
After : structure size: 80, sum holes:  5, pad bytes: 0, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-dummy: Reorder elements in dummy_packet_stream structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:14 +0000 (18:59 +0100)]
netdev-dummy: Reorder elements in dummy_packet_stream structure.

By reordering elements in dummy_packet_stream structure, sum holes
can be reduced, thus saving a cache line.

Before: structure size: 784, sum holes: 56, cachelines:13
After : structure size: 768, sum holes: 40, cachelines:12

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotun-metadata: Reorder elements in tun_meta_entry structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:15 +0000 (18:59 +0100)]
tun-metadata: Reorder elements in tun_meta_entry structure.

By reordering elements in tun_meta_entry structure, sum holes and pad
bytes can be reduced there by reducing the tun_table size.

Before: structure size: 56, sum holes: 4, pad bytes: 7  cachelines:1
After : structure size: 48, sum holes: 0, pad bytes: 3, cachelines:1

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agobond: Reorder elements in bond_slave structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:13 +0000 (18:59 +0100)]
bond: Reorder elements in bond_slave structure.

By reordering elements in bond_slave structure, holes can be removed and
saves a cache line.

Before: structure size: 136, sum holes: 10, cachelines:3
After : structure size: 128, sum holes:  2, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Put bundle_lookup ahead to simplify the code.
Duan Jiong [Fri, 8 Sep 2017 01:51:38 +0000 (09:51 +0800)]
ofproto-dpif: Put bundle_lookup ahead to simplify the code.

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoAUTHORS: Add Duan Jiong.
Ben Pfaff [Fri, 3 Nov 2017 19:24:13 +0000 (12:24 -0700)]
AUTHORS: Add Duan Jiong.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Fix comment in struct ofbundle.
Duan Jiong [Fri, 8 Sep 2017 01:34:07 +0000 (09:34 +0800)]
ofproto-dpif: Fix comment in struct ofbundle.

The ovs_list ports should contain struct ofport_dpif.

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agolib: Remove lib/pool-loop.h from lib_libopenvswitch_la_SOURCES
Timothy Redaelli [Fri, 3 Nov 2017 18:18:05 +0000 (19:18 +0100)]
lib: Remove lib/pool-loop.h from lib_libopenvswitch_la_SOURCES

lib/pool-loop.h is moved to to include/openvswitch, but lib/pool-loop.h
is still used in lib_libopenvswitch_la_SOURCES.

This commit removes lib/pool-loop.h from lib_libopenvswitch_la_SOURCES.

CC: Xiao Liang <shaw.leon@gmail.com>
Fixes: fd016ae3fb84 ("lib: Move lib/poll-loop.h to include/openvswitch")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agolib: Move lib/poll-loop.h to include/openvswitch
Xiao Liang [Fri, 3 Nov 2017 05:53:53 +0000 (13:53 +0800)]
lib: Move lib/poll-loop.h to include/openvswitch

Poll-loop is the core to implement main loop. It should be available in
libopenvswitch.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agometa-flow: Fix format in documentation.
Yi-Hung Wei [Fri, 3 Nov 2017 17:32:57 +0000 (10:32 -0700)]
meta-flow: Fix format in documentation.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofp-util: Update OpenFlow 1.6 port support to track latest proposal.
Ben Pfaff [Fri, 14 Jul 2017 19:51:43 +0000 (12:51 -0700)]
ofp-util: Update OpenFlow 1.6 port support to track latest proposal.

The latest updates to the OpenFlow 1.6 proposal removes the hw_addr_type
fields from ofp_port and ofp_port_mod.  This commit updates the OVS
prototype to match the updated proposal.

ONF-JIRA: EXT-566
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
6 years agoovn-northd.8: Fix wrong description
wei [Fri, 3 Nov 2017 01:08:26 +0000 (09:08 +0800)]
ovn-northd.8: Fix wrong description

Signed-off-by: wei <liw@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoNEWS: Add recently added OVN IPv6 features
Numan Siddique [Fri, 3 Nov 2017 03:43:16 +0000 (09:13 +0530)]
NEWS: Add recently added OVN IPv6 features

OVN now supports sending IPv6 RA packet in response to the RS packet
and resolves the unknown next hop MACs by generating a NS packet.

Mention this in the NEWS.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoDocumentation: Add the Open vSwitch project charter.
Ben Pfaff [Tue, 24 Oct 2017 16:33:07 +0000 (09:33 -0700)]
Documentation: Add the Open vSwitch project charter.

It always seems odd that this isn't in the repo, so this adds it, with
internal links properly directed.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agoofproto-dpif-upcall: Transition ukey on dp_ops error.
Joe Stringer [Wed, 6 Sep 2017 22:12:52 +0000 (15:12 -0700)]
ofproto-dpif-upcall: Transition ukey on dp_ops error.

In most situations, we don't expect that a flow we've successfully
dumped, which we intend to delete, cannot be deleted. However, to make
this code more resilient to ensure that ukeys *will* transition in all
cases (including an error at this stage), grab the lock and transition
this ukey forward to the evicted state, effectively treating a failure
to delete as "this flow is already gone".

If we subsequently find out that it wasn't deleted, then that's ok - we
will re-dump, and validate at that stage, which should lead to creating
a new ukey or deleting the datapath flow when that happens.

Signed-off-by: Joe Stringer <joe@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>