INSTALL.Windows: minor updates to the SSL section

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows:Remove user mode instance from pid hash on process termination

The instance should be removed from pid-hash when vswitchd.exe terminates so
the driver won't access it during packet miss (causing BSOD)

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Fix BSOD caused by DV due to memory leaks.

If the OVS extension is enabled, Driver Verifier will issue a BSOD
due to memory leaks. This issue reproduces each time and the problem
is in the filter attach routine when the switch context is initialized.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/50
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Re-init the list entry in OvsDeleteVportCmdHandler().

Without this patch, the kernel crashes when it tries to cleanup a port
at unload time when a port has been previously deleted from userspace.
Crash is in OvsRemoveAndDeleteVport() when we call into
RemoveEntryList().

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Clarify externalVport.

In this patch, we add some explanation about the usage of
'externalVport' in the switch context. Also, we rename 'externalVport'
to 'virtualExternalVport' in alignment with the explanation. Also, we
rename 'numVports' to 'numHvVports' since ports are added from 2 ends
now.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Introduce bridge-internal ports.

In this patch, we provide explanation and the reasoning for
bridge-internal ports. The code to add such a port in come in later
patch in the series.

We also fix some formatting issues in PacketIO.c.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: OvsInitTunnelVport() and OvsInitBridgeInternalVport().

In this patch, we add the init functions for a Tunnel vport and a
Bridge-internal vport.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Refactor core in Vport.c.

We do a bunch of changes that did not make sense to split up into
smaller patches:

1. Add descriptive comments to the important functions to clarify
   purpose.
2. s/OvsInitVportCommon/InitHvVportCommon - this function is common code
   for every port that shows up on the Hyper-V switch.
3. Introduce a InitOvsVportCommon() that is common code for evrey port
   that gets added from userspace. This is especially useful for ports
   that are not present on the Hyper-V switch. ie. tunnel ports and
   bridge-internal ports.
4. Fix OvsClearAllSwitchVports() to remove ports from both the lists:
   the ones added from Hyper-V as well as the ones added from OVS
   userspace.
5. Update OvsInitVxlanTunnel() to not call into InitHvVportCommon
   (formerly OvsInitVportCommon()) since it is not a port on the Hyper-v
   switch. In a later patch in the series, we'll call
   InitOvsVportCommon() for a VXLAN port.
6. 'numNonHvVports' increments and decrements ONLY for ports that are
   added from OVS userspace but not present on the Hyper-V switch.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Update vport add code.

In this patch, we make the following updates to the vport add code:

1. Clarify the roles of the different hash tables, so it is easier to
   read/write code in the future.
2. Update OvsNewVportCmdHandler() to support adding bridge-internal
   ports.
3. Fixes in OvsNewVportCmdHandler() to support adding external port.
   Earlier, we'd hit ASSERTs.
4. I could not figure out way to add a port of type
   OVS_PORT_TYPE_INTERNAL with name "internal" to the confdb using
   ovs-vsctl.exe. And, this is needed in order to add the Hyper-V
   internal port from userspace. To workaround this problem, we treat a
   port of type OVS_PORT_TYPE_NETDEV with name "internal" as a request
   to add the Hyper-V internal port. This is a workaround. The end
   result is that there's a discrepancy between the port type in the
   datpaath v/s confdb, but this has not created any trouble in testing
   so far. If this ends up becoming an issue, we can mark the Hyper-V
   internal port to be of type OVS_PORT_TYPE_NETDEV. No harm.
5. Because of changes indicated in #1, we also update the vport dump
   code to look at the correct hash table for ports added from
   userspace.
6. Add a OvsGetTunnelVport() for convenience.
7. Update ASSERTs() while cleaning up the switch.
8. Nuke OvsGetExternalVport() and OvsGetExternalMtu().

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: OvsFindVportByPortIdAndNicIndex() and external port.

We use OvsFindVportByPortIdAndNicIndex() to lookup the vport for a
packte received from the Hyper-V switch. If a packet was indeed received
from the virtual external NIC, we should flag it.

Validation:
1. Install and Uninstall the OVS EXT Driver (without enabling the OVS
   extension on the Hyper-V switch).
2. Install and Uninstall the OVS EXT Driver (with enabling the OVS
   extension on the Hyper-V switch). Hyper-V switch had a few ports.
3. Install and Uninstall the OVS EXT Driver (with enabling the OVS
   extension on the Hyper-V switch). Added a few ports before
   uninstalling.
4. Install the OVS EXT driver, and test the following functionality:
   a) ping between 2 VMs on the same host
   b) ping between 2 VMs on 2 Hyper-Vs - one physical and another
      virtual backed by VLAN (patch port between br-pif and br-int).
   c) ping between 2 VMs on 2 Hyper-Vs - one physical and another
      virtual backed by VXLAN.
   d) Successful uninstallation after these tests.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
doc: Convert docs to Markdown language

Converts the majority of docs over to use the Markdown language for
pretty printing on GitHub. It's a rough first convertion without
exploiting the full potential of Markdown at this point. Section
titles and indentation are fixed as needed. Minimal docs interlinking
is added.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Allow encapsulation if source is bridge-internal port.

It has been observed that when userspace generates and executes that
packet, the source port of such a packet is set to the bridge-internal
port. Currently, we allow encapsulation only if the source port is a VIF
port or no port. We relax the check in this patch.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
netdev-windows: Fix bugs in flag update and MAC address copy functions.

The .update_flags function in netdev-windows was dummy. But we need to
return the existing flags for link status to be shown as up in the
confdb.

There was a bug in copying the MAC address.

We fix these two issues in this patch.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Co-Authored-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
command-line: Add function to print all options.

This commit adds a function that prints (both long and short)
options of a ovs-* command.  To use this function, option
'--option' is added to ovs-appctl/dpctl/ofctl and ovsdb-tool
commands.  A future patch will use the option output to
conduct bash command-line completion.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ovs-appctl: Rename 'help' to 'list-commands'.

Having 'ovs-appctl help' and 'ovs-appctl --help' print different
output is confusing.  This commit renames the 'help' to 'list-commands'.
Also, future patches will add the 'list-commands' to other ovs-*
commands, and the output will be used by bash command-line completion
script.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
dpctl: Implement 'list-commands' function.

This commit implements the 'list-commands' command for ovs-dpctl
and ovs-appctl dpctl/* commands.  The function will print the
usage string for each subcommand.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
command-line: Add function to print command usage.

This commit adds a new variable in 'struct command' for
recording the command usage.  Also, a new function is
added to print the usage given the array of defined
commands.

Later patch will use the output in bash command-line
completion script.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Change Travis CI notification email to ljakab@ac.upc.edu
userspace: add support for pop_eth and push_eth actions

These actions will allow L2->L3 and L3->L2 switching, and are supposed
to be added to flows installed in the datapath transparently by
ovs-vswitchd.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
userspace: add layer 3 flow and switching support

This commit relaxes the assumption that all packets have an Ethernet
header, and adds support for layer 3 flows.  For each packet received on
the Linux kernel datapath the l2 and l3 members of struct ofpbuf are
intialized appropriately, and some functions now expect this (notably
flow_extract()), in order to differentiate between layer 2 and layer 3
packets.  struct flow has now a new 'base_layer' member, because we
cannot assume that a flow has no Ethernet header when eth_src and
eth_dst are 0.  For layer 3 packets, the protocol type is still stored
in the eth_type member.

Switching L2->L3 and L3->L2 are both implemented by adding the pop_eth
and push_eth actions respectively when a transition is detected.  The
push_eth action puts 0s on both source and destination MACs.  These
addresses can be modified with mod_dl_dst and mod_dl_src actions.

Added new prerequisite MFP_ETHERNET for fields MFF_ETH_SRC, MFF_ETH_DST,
MFF_VLAN_TCI, MFF_DL_VLAN, MFF_VLAN_VID and MFF_DL_VLAN_PCP.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>