datapath-windows: pid-instance hash table APIs.

In this patch we have added APIs for insert, delete and search APIs.

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

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Refactor CreateQueue function to handle vport pid.

Refactored CreateQueue function so that packets are enqueued to correct corresponding queue.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: check for 'gOvsSwitchContext' in ValidateNetlinkCmd()

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto: Only allow indirect groups with one bucket

OpenFlow 1.1 - 1.4 specify that indirect groups should
opperate on the "one defined bucket in the group". OpenFlow
1.2 - 1.4 also state "This group only supports a single bucket."

This patch enforces the single bucket limitation for indirect groups
when decoding group mod messages. A test is also added to exercise
this change.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Avoid BSOD when no event queue found.

kd> ??instance
struct _OVS_OPEN_INSTANCE * 0xffffe000`037f2880
   +0x000 cookie           : 1
   +0x008 fileObject       : 0xffffe000`02c59f20 _FILE_OBJECT
   +0x010 eventQueue       : (null)
   +0x018 packetQueue      : 0xffffe000`02d50100 _OVS_USER_PACKET_QUEUE
   +0x020 pid              : 2
   +0x024 inUse            : 0n1
   +0x028 dumpState        : <unnamed-tag>
   +0x038 pidLink          : _LIST_ENTRY [ 0xffffe000`03ad83f0 - 0xffffe000`03ad83f0 ]
kd> k
Child-SP          RetAddr           Call Site
ffffd000`2876eb18 fffff801`f364b7c6 nt!DbgBreakPointWithStatus
ffffd000`2876eb20 fffff801`f364b0d7 nt!KiBugCheckDebugBreak+0x12
ffffd000`2876eb80 fffff801`f35c21a4 nt!KeBugCheck2+0x8ab
ffffd000`2876f290 fffff801`f35cdbe9 nt!KeBugCheckEx+0x104
ffffd000`2876f2d0 fffff801`f35cc43a nt!KiBugCheckDispatch+0x69
ffffd000`2876f410 fffff800`02626666 nt!KiPageFault+0x23a
ffffd000`2876f5a0 fffff800`026318d7 OVSExt!OvsWaitEventIoctl+0x116 [c:\work\ovs\datapath-windows\ovsext\event.c @ 472]
ffffd000`2876f610 fffff800`026339b4 OVSExt!OvsPendEventCmdHandler+0x57 [c:\work\ovs\datapath-windows\ovsext\datapath.c @ 1056]
ffffd000`2876f660 fffff800`0264d9c5 OVSExt!InvokeNetlinkCmdHandler+0xf4 [c:\work\ovs\datapath-windows\ovsext\datapath.c @ 938]
ffffd000`2876f6b0 fffff800`006f1c18 OVSExt!OvsDeviceControl+0x855 [c:\work\ovs\datapath-windows\ovsext\datapath.c @ 853]
ffffd000`2876f840 fffff801`f383c395 NDIS!ndisDummyIrpHandler+0x88
ffffd000`2876f870 fffff801`f383cd2a nt!IopXxxControlFile+0x845
ffffd000`2876fa20 fffff801`f35cd8b3 nt!NtDeviceIoControlFile+0x56
ffffd000`2876fa90 00000000`775c2772 nt!KiSystemServiceCopyEnd+0x13
00000000`010feef8 00000000`775c2371 wow64cpu!CpupSyscallStub+0x2
00000000`010fef00 00000000`7765323a wow64cpu!DeviceIoctlFileFault+0x31
00000000`010fefb0 00000000`7765317e wow64!RunCpuSimulation+0xa
00000000`010ff000 00007ff8`f1076bd0 wow64!Wow64LdrpInitialize+0x172
00000000`010ff540 00007ff8`f1076aa6 ntdll!_LdrpInitialize+0xd8
00000000`010ff5b0 00000000`00000000 ntdll!LdrInitializeThunk+0xe
kd> ??poll
struct _OVS_EVENT_POLL * 0xffffd000`2876f640
   +0x000 cookie           : 0x3a9ae28
   +0x004 dpNo             : 0
SYMBOL_STACK_INDEX:  6

SYMBOL_NAME:  OVSExt!OvsWaitEventIoctl+116

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: OVSExt

IMAGE_NAME:  OVSExt.sys

DEBUG_FLR_IMAGE_TIMESTAMP:  54498bc5

BUCKET_ID_FUNC_OFFSET:  116

FAILURE_BUCKET_ID:  AV_OVSExt!OvsWaitEventIoctl

BUCKET_ID:  AV_OVSExt!OvsWaitEventIoctl

ANALYSIS_SOURCE:  KM

FAILURE_ID_HASH_STRING:  km:av_ovsext!ovswaiteventioctl

FAILURE_ID_HASH:  {07550bfb-c3b5-0412-b95d-f89a5c4671a9}

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib: Clean up vlog use.

Vlog functions assume a vlog module has been defined for the current
translation unit.  Including lib/vlog.h from a header file makes the
vlog API visible even when no vlog module may not have been defined.
This patch removes the two cases in the tree where vlog.h was included
from a header file.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/classifier: Add lib/classifier-private.h.

tests/test-classifier.c used to include lib/classifier.c to gain
access to the internal data structures and some utility functions.
This was confusing, so this patch splits the relevant groups of
classifier internal definations to a new file
(lib/classifier-private.h), which is included by both lib/classifier.c
and tests/test-classifier.c.  Other use of the new file is
discouraged.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
netlink-socket: Fix a couple of compilation warnings.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
[blp@nicira.com replaced conventional cast by CONST_CAST]
Signed-off-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>
squash
datapath: add layer 3 flow/port support

Implementation of the pop_eth and push_eth actions in the kernel, and
layer 3 flow support.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Address Jesse's comment #1
Address Jesse's comment #8
Address Jesse's comment #7
Address Jesse's comment #6
Address Jesse's comment #5
Address Jesse's comment #4