ovs-sandbox: Add note about OVN to initial output.
[cascardo/ovs.git] / datapath-windows / ovsext / User.h
1  /*
2  * Copyright (c) 2014 VMware, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /* This file contains structures and function definitions necessary for
18  * forwarding packet to user space.
19  */
20
21 #ifndef __USER_H_
22 #define __USER_H_ 1
23
24
25 #include "Datapath.h"
26
27 /*
28  * Even we have more cores, I don't think we need
29  * more than 32 queues for processing packets to
30  * userspace
31  */
32 #define OVS_DEFAULT_PACKET_QUEUE 1
33 #define OVS_MAX_PACKET_QUEUE_LEN  4096
34
35 /*
36  * Only when OVS_PER_VPORT_QUEUE_CTRL is defined
37  * we will apply this constraint
38  */
39 #define OVS_MAX_PACKETS_PER_VPORT 128
40 #define OVS_MAX_PACKETS_PER_TUNNEL 1024
41
42 typedef struct _OVS_USER_PACKET_QUEUE {
43     UINT32 pid;
44     UINT32 numPackets;
45     LIST_ENTRY  packetList;
46     PVOID instance;
47     PIRP pendingIrp;
48     NDIS_SPIN_LOCK queueLock;
49 } OVS_USER_PACKET_QUEUE, *POVS_USER_PACKET_QUEUE;
50
51 typedef struct _OVS_PACKET_QUEUE_ELEM {
52     UINT32  upcallPid;
53     LIST_ENTRY link;
54     OVS_PACKET_HDR_INFO hdrInfo;
55     OVS_PACKET_INFO packet;
56 } OVS_PACKET_QUEUE_ELEM, *POVS_PACKET_QUEUE_ELEM;
57
58 struct _OVS_OPEN_INSTANCE;
59
60 typedef struct _OVS_USER_STATS {
61     UINT64 miss;
62     UINT64 action;
63     UINT32 dropDuetoResource;
64     UINT32 dropDuetoChecksum;
65     UINT32 ipCsum;
66     UINT32 recalTcpCsum;
67     UINT32 vlanInsert;
68     UINT32 l4Csum;
69 } OVS_USER_STATS, *POVS_USER_STATS;
70
71 VOID OvsCleanupPacketQueue(struct _OVS_OPEN_INSTANCE *instance);
72
73 POVS_PACKET_QUEUE_ELEM OvsCreateQueueNlPacket(PVOID userData,
74                                               UINT32 userDataLen,
75                                               UINT32 cmd, 
76                                               POVS_VPORT_ENTRY vport,
77                                               OvsFlowKey *key,
78                                               PNET_BUFFER_LIST nbl,
79                                               PNET_BUFFER nb,
80                                               BOOLEAN isRecv,
81                                               POVS_PACKET_HDR_INFO hdrInfo);
82
83 VOID OvsQueuePackets(PLIST_ENTRY packetList, UINT32 numElems);
84 NTSTATUS OvsCreateAndAddPackets(PVOID userData,
85                                 UINT32 userDataLen,
86                                 UINT32 cmd,
87                                 POVS_VPORT_ENTRY vport,
88                                 OvsFlowKey *key,
89                                 PNET_BUFFER_LIST nbl,
90                                 BOOLEAN isRecv,
91                                 POVS_PACKET_HDR_INFO hdrInfo,
92                                 POVS_SWITCH_CONTEXT switchContext,
93                                 LIST_ENTRY *list,
94                                 UINT32 *num);
95
96 NTSTATUS OvsSubscribeDpIoctl(PVOID instanceP,
97                              UINT32 pid,
98                              UINT8 join);
99
100 NTSTATUS OvsReadDpIoctl(PFILE_OBJECT fileObject,
101                         PVOID outputBuffer,
102                         UINT32 outputLength,
103                         UINT32 *replyLen);
104 NTSTATUS OvsExecuteDpIoctl(OvsPacketExecute *execute);
105 NTSTATUS OvsPurgeDpIoctl(PFILE_OBJECT fileObject);
106
107 NTSTATUS OvsWaitDpIoctl(PIRP irp, PFILE_OBJECT fileObject);
108
109 NTSTATUS OvsNlExecuteCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
110                                 UINT32 *replyLen);
111
112 POVS_OPEN_INSTANCE
113 OvsGetPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid);
114
115 VOID
116 OvsAddPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid,
117                   POVS_OPEN_INSTANCE instance);
118
119 VOID
120 OvsDelPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid);
121
122 NTSTATUS OvsReadPacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
123                                  UINT32 *replyLen);
124 NTSTATUS OvsSubscribePacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
125                                       UINT32 *replyLen);
126 NTSTATUS OvsPendPacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
127                                  UINT32 *replyLen);
128
129 #endif /* __USER_H_ */