ofproto: Report support for group stats.

This feature bit was overlooked when we added support for group stats.

Reported-by: Anup Khadka <khadka.py@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
datapath: Replace __force type cast with rcu_dereference_raw().

rcu_dereference_raw() api is cleaner way of accessing RCU pointer
when no locking is required.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
datapath: Fix comment style.

Use netdev comment style.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
datapath: Use upstream ipv6_find_hdr().

ipv6_find_hdr() already fixed in newer upstram kernel by Ansis, we
can start using this API safely.
This patch also backports fix (ipv6: ipv6_find_hdr restore prev
functionality) to compat ipv6_find_hdr().

CC: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
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>
classifier: Correct comment in classifier_lookup().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
lib/ofproto: Remove obsolete FIXME comment.

We already implement OFPFUTIL_FF_RESET_COUNTS.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/ofproto: Add comments about races in ofproto_flush().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/ovs-rcu: Support static initialization.

Currently, OVSRCU_TYPE_INITIALIZER always initializes the RCU pointer
as NULL.  There is no reason why the RCU pointer could not be
initialized with a non-NULL value, however, as statically allocated
memory is even more stable than required for RCU.

This patch changes the initializer to OVSRCU_INITIALIZER(VALUE), which
can take any pointer value as a parameter.

This allows rculist, which is introduced in a following patch, to
provide an initializer similar to the one in the normal list.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
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>