Currently on mask delete OVS moves last mask to the deleted
place to keep flow cache consistent and compact for per cpu
cache. But that generate duplicate entries in mask cache array
which results in multiple flow lookups in case we miss flow
cache.
Following patch simply sets NULL for deleted entry.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
This commit adds options for configuring the MAC addresses
in BFD state machine. Therein, the "bfd_local_src_mac" and
"bfd_local_dst_mac" configure the MAC address for transmitted
BFD packets. The "bfd_remote_dst_mac" configure the matching
of MAC address on received BFD packets.
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
This commit flips the default value of bfd ip source and destination,
so that they match the default value of ip destination and source
of vtep schema.
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
This cleans up the dpif interface to make it more consistent with the
other dpif operations, and allows flows to be fetched in batches.
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
list_size() yields a size_t, not uint64_t, and these types are different on
32-bit targets.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
In the Windows datapath, Tx tunneling functionality is implemented by checking
if the outport in the action is a tunnel port. If so, the packet is
encapsulated and sent out on the PIF bridge for as second flow lookup.
Basically, we don't use the hypervisor's IP stack to send out a packet, and
short circuit the path ourselves. On the PIF bridge, the source port of the
encapsulated packet is the VTEP port ie. the internal port.
If a Tunneling port is added to the PIF bridge (a possible misconfiguration),
where the VTEP(internal) port and the external port (physical NIC) also reside,
a flooding action can cause a loop, by re-injecting the packet on the same PIF
bridge which again floods to the tunnel port.
In this change, we break the loop by encapsulating packets only if they are
sent out by a VIF or if they originate from userspace ie. userspace generated.
We make use of the input port attribute in the packet execute ioctl.
This change is based off of the legacy datapath interface published in
OvsPub.h. This interface has a input port field in the packet execute ioctl.
I looked in dpif-linux.c that uses the netlink based datapath interface and
even in that case, we do add the the source port in:
dpif_linux_encode_execute() -> odp_key_from_pkt_metadata().
So, this fix is applicable when we adopt the netlink based datapath interface
as well.
The Rx side of OvsDetectTunnelPkt() has only documentation updates. The fix is
on the Tx side.
Validation (using dpif-windows.c):
- Was able to perform VTEP <-> VTEP ping with the configuration posted in the
issue.
- Was able to perform VIF <-> VIF ping when the setup was configured correctly.
Signed-off-by: Nithin Raju <nithin@vmware.com>
Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/20
Signed-off-by: Ben Pfaff <blp@nicira.com>
Preparing the include headers needed to compile dpif-linux.c with MSVC.
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs_vport_alloc() bails out without freeing the memory 'vport' points
to.
Picked up by Coverity - CID 1230503.
Fixes: beb1c69a3 ("datapath: Allow each vport to have an array of
'port_id's.")
Signed-off-by: Christoph Jaeger <cj@linux.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
rte_eth_tx_burst() _should_ transmit every packet that it is passed unless the
queue is full. Nontheless some implementation of rte_eth_tx_burst (e.g.
ixgbe_xmit_pkts_vec()) does not transmit more than a fixed number (32) of
packets at a time.
With this commit we assume that there's an error only if rte_eth_tx_burst
returns 0.
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
With this commit we move our DPDK support to 1.7.0.
DPDK binaries (starting with dpdk 1.7.0) should be linked with --whole-archive
to include pmd drivers
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
struct dp_netdev_flow used to have a reference counter.
It has been replaced by RCU. Unfortunately RCU is not
enough if we plan to hold a reference to the dp_netdev_flow
for a long time. So this commit reintroduces reference
counting for struct dp_netdev_flow
Subsequent commits make use of it.
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
These error codes are proposed in the ONF extensibility working group as an
OpenFlow 1.3 extension.
Error codes are also proposed for the other three "bad property" error
codes, but those already have standardized OpenFlow 1.3 error codes and the
proposal says that implementations should use the standard ones.
ONF-JIRA: EXT-444.
Signed-off-by: Ben Pfaff <blp@nicira.com>
The controller setup in my personal test environment has been broken for a
while. I figured that it wasn't anything important, though, because no one
else had reported similar problems. Anyway, it turns out that enabling
OpenFlow 1.3 by default broke test-controller because OpenFlow 1.3 doesn't
send table misses to the controller by default. This commit fixes the
problem.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Added saurabh's fix to not to include some header files
in lib/netlink-protocol.h not needed by windows driver.
This is a temporary fix to make sure that windows driver can compile.
We are working in parallel on adding netlink support in windows driver
(https://github.com/openvswitch/ovs-issues/issues/18). With netlink support
changes we will get rid of the dependency on lib/netlink-protocol.h.
Testing:
1. Verified make distcheck on linux.
2. Verified that windows driver can compile now.
3. Verified that ping works over vxlan tunnel.
Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Co-authored-by: Saurabh Shah <ssaurabh@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/21
Signed-off-by: Ben Pfaff <blp@nicira.com>
Before commit c2d936a44f (ofp-actions: Centralize all OpenFlow action
code for maintainability.), struct ofpact was 4 bytes with GCC and Clang,
and 12 bytes with other compilers. That commit changed struct ofpact so
that it remained 4 bytes with GCC and Clang but shrank to 8 bytes on other
compilers. An unexpected side effect of that change was that the size
of the pad[] array in struct ofpact_nest shrank to 0 bytes, because that
array padded to a multiple of 8 bytes. MSVC does not support 0-element
arrays, so this caused a build failure.
This commit fixes the problem by changing struct ofpact so that it is 4
bytes with every compiler.
Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Serdean <aserdean@cloudbasesolutions.com>
When flow key becomes invalid due to push or pop actions, current
implementation leaves it as invalid, only rebuild the flow key used
for recirculation.
This works, but is less efficient in case of multiple recirc
actions. Each recirc action will have to re-extract
its own flow keys.
This patch update the original flow key as soon as the first recirc
action is encountered, avoiding expensive flow extract call for any
future recirc actions as long as the flow key remains valid.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
The dpif provider 'operate' call duplicates all of the features available
from the 'flow_put', 'flow_del', and 'execute' calls, yielding redundant
code in providers that support both mechanisms. This change drops the
latter calls in favor of making every dpif provider support 'operate'.
The result is code that is overall less duplicative.
It might make sense to do the same with flow_get but so far 'operate'
doesn't support flow_get.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Add usage info for ovs-vswitchd dpdk option. Update
INSTALL.DPDK file and man page.
Reported-by: Hari Sasank Bhamidipalli <hbhamidi@cisco.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Autogenerated odp-netlink.h will not compile with windows kernel, as
it refers to some userspace files like openvswitch/types.h and
packets.h which hyperv extension does not access. Due to this the
windows datapath compilation is broken on tip of tree. This patch
intends to fix that.
In this patch we add a new sed script "extract-odp-netlink-windows-dp-h"
to create OvsDpInterface.h. It works on similar lines as
extract-odp-netlink-h, but avoids including the header files
which are not available for driver.
After this fix, a userspace build will be needed before windows
kernel datapath can be built.
Tested that hyperv extension could be built after building
the userspace. Verified vxlan tunnel based ping across
hypervisors. Verified that odp-netlink-windows-dp.h is not
built for linux platform. Ran 'make distcheck' to verify that
nothing is broken on linux.
Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Co-authored-by: Saurabh Shah <ssaurabh@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Reported-by: Nithin Raju <nithin@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/21
Signed-off-by: Ben Pfaff <blp@nicira.com>
Until now, there were four of these commands: parse-ofp10-actions,
parse-ofp10-instructions, parse-ofp11-actions, parse-ofp11-instructions.
This is painful to add support for new OpenFlow versions and has a ton of
cut-and-paste code. This commit generalizes the code to improve on both
of those points.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Until now, knowledge about OpenFlow has been somewhat scattered around the
tree. Some of it is in ofp-actions, some of it is in ofp-util, some in
separate files for individual actions, and most of the wire format
declarations are in include/openflow. This commit centralizes all of that
in ofp-actions.
Encoding and decoding OpenFlow actions was previously broken up by OpenFlow
version. This was OK with only OpenFlow 1.0 and 1.1, but each additional
version added a new wrapper around the existing ones, which started to
become hard to understand. This commit merges all of the processing for
the different versions, to the extent that they are similar, making the
version differences clearer.
Previously, ofp-actions contained OpenFlow encoding and decoding, plus
ofpact formatting, but OpenFlow parsing was separated into ofp-parse, which
seems an odd division. This commit moves the parsing code into ofp-actions
with the rest of the code.
Before this commit, the four main bits of code associated with a particular
ofpact--OpenFlow encoding and decoding, ofpact formatting and parsing--were
all found far away from each other. This often made it hard to see what
was going on for a particular ofpact, since you had to search around to
many different pieces of code. This commit reorganizes so that all of the
code for a given ofpact is in a single place.
As a code refactoring, this commit has little visible behavioral change.
The update to ofproto-dpif.at illustrates one minor bug fix as a side
effect: a flow that was added with the action "dec_ttl" (a standard
OpenFlow action) was previously formatted as "dec_ttl(0)" (using a Nicira
extension to specifically direct packets bounced to the controller because
of too-low TTL), but after this commit it is correctly formatted as
"dec_ttl".
The other visible effect is to drop support for the Nicira extension
dec_ttl action in OpenFlow 1.1 and later in favor of the equivalent
standard action. It seems unlikely that anyone was really using the
Nicira extension in OF1.1 or later.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This allows callers to be more uniform, because they don't have to pick
out whether they should parse actions or instructions based on the OpenFlow
version in use. It also allows the Write-Metadata instruction emulation
in OpenFlow 1.0 to be treated just as in OpenFlow 1.1 in the sense that
it is allowed in contexts where instructions are allowed in OpenFlow 1.1
and not elsewhere. (The changes in the tests reflect this more accurate
treatment.)
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
"apply_actions" is assumed, any other instruction has to be specified
explicitly.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
The call to parse_oxms() inside ofputil_decode_table_features() sets only
one bit in either 'match' or 'mask' for a given field that is matchable:
in 'mask' if the field is arbitrarily maskable or in 'match' otherwise.
The code at the end of ofputil_decode_table_features() mishandled this,
assuming that an arbitrarily matchable field would have that bit set in
both. This meant that arbitrarily matchable fields were being
misinterpreted as not matchable at all. This commit fixes the problem.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Parsing of actions was wrong because OF1.3 says that non-experimenter
actions are 4 bytes and don't include padding. This fixes the problem.
Parsing of instructions seems wrong too because OF1.3 says that
non-experimenter instructions are 4 bytes (though it is not explicit about
padding as it is for actions). This fixes the problem there too.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Table features replies can be packed back-to-back within a single
multipart reply. The code here didn't properly parse properties when this
occurred. This fixes the problem.
There is no test in the current tree that exercises this decoding, but an
upcoming commit that adds ofproto support for table-features requests will
add one.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
The ofproto implementation has had an abstraction layer on top of
OFPTC11_TABLE_MISS for a while. This commit pushes that abstraction layer
farther down, into ofp-util. This will be more useful in an upcoming
commit.
During the conversion I realized that the previous implementation was
not entirely correct. In particular, the OpenFlow 1.3+ "table mod" was
still being treated as if it had table miss configuration bits, even
though it doesn't. This commit fixes that issue and updates the tests.
OpenFlow 1.4 adds some more OFPTC_* flags that this new abstraction doesn't
yet support, but OVS didn't support those flags any better before this
commit, so abstracting those is left as future work.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
OFPTC11_TABLE_MISS_MASK isn't a valid value at all, let alone always the
value in use. We should report the value actually in use, as this commit
does.
There is a remaining problem: the default table configuration is
OFPROTO_TABLE_MISS_DEFAULT, which doesn't correspond to any particular
OFPTC11_* value or, more precisely, corresponds to a different OFPTC11_*
value based on the OpenFlow version. The following commit fixes that
problem.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This will allow, later, to centralize all of the knowledge of instruction
encoding inside ofp-actions.
OFPIT11_ALL and OFPIT13_ALL are no longer used, so this commit removes
them. Their definitions were wrong (they did not shift each bit into
position correctly), so this commit is also a small bug fix.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Until now, sets of actions have been abstracted separately outside
ofp-actions, as enum ofputil_action_bitmap. Drawing sets of actions into
ofp-actions, as done in this commit, makes for a better overall
abstraction of actions, with better consistency.
A big part of this commit is shifting from using ofp12_table_stats as if
it were an abstraction for OpenFlow table stats, toward using a new
struct ofputil_table_stats, which is what we generally do with other
OpenFlow structures and fits better with the rest of the code.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
The ‘recalculate_csum’ is almost always ‘true’. It is false only if
the ipv6 nexthdr is an extension header, and a routing header is
found. For the majority of ipv6 packets this would not be the case,
so this can be marked as 'likely'.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
OVS does mask validation even if it does not need to convert
netlink mask attributes to mask structure. ovs_nla_get_match()
caller can pass NULL mask structure pointer if the caller does
not need mask. Therefore NULL check is required in SW_FLOW_KEY*
macros. Following patch does not convert mask netlink attributes
if mask pointer is NULL, so we do not need these checks in
SW_FLOW_KEY* macro.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Andy Zhou <azhou@nicira.com>
OVS need to flow key for flow lookup in recic action. OVS
does key extract in recic action. Most of cases we could
use OVS_CB packet key directly and can avoid packet flow key
extract. SET action we can update flow-key along with packet
to keep it consistent. But there are some action like MPLS
pop which forces OVS to do flow-extract. In such cases we
can mark flow key as invalid so that subsequent recirc
action can do full flow extract.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
commit (datapath: Refactor action alloc and copy api) effectively
reverted 1d2a1b5f52 (datapath: Factor out
allocation and verification of actions.). This results in following
warning:
CC [M] /home/jesse/openvswitch/datapath/linux/datapath.o
/home/jesse/openvswitch/datapath/linux/datapath.c: In function
‘ovs_flow_cmd_set’:
/home/jesse/openvswitch/datapath/linux/datapath.c:1094:1: warning: the
frame size of 1256 bytes is larger than 1024 bytes
[-Wframe-larger-than=]
}
Following patch introduced the factoring back.
CC: Jesse Gross <jesse@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>