tunneling: Remove gre64 tunnel support.
[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, UINT32 inPort,
76                                               OvsFlowKey *key,
77                                               PNET_BUFFER_LIST nbl,
78                                               PNET_BUFFER nb,
79                                               BOOLEAN isRecv,
80                                               POVS_PACKET_HDR_INFO hdrInfo);
81
82 VOID OvsQueuePackets(PLIST_ENTRY packetList, UINT32 numElems);
83 NTSTATUS OvsCreateAndAddPackets(PVOID userData,
84                                 UINT32 userDataLen,
85                                 UINT32 cmd,
86                                 UINT32 inPort,
87                                 OvsFlowKey *key,
88                                 PNET_BUFFER_LIST nbl,
89                                 BOOLEAN isRecv,
90                                 POVS_PACKET_HDR_INFO hdrInfo,
91                                 POVS_SWITCH_CONTEXT switchContext,
92                                 LIST_ENTRY *list,
93                                 UINT32 *num);
94
95 NTSTATUS OvsSubscribeDpIoctl(PVOID instanceP,
96                              UINT32 pid,
97                              UINT8 join);
98
99 NTSTATUS OvsReadDpIoctl(PFILE_OBJECT fileObject,
100                         PVOID outputBuffer,
101                         UINT32 outputLength,
102                         UINT32 *replyLen);
103 NTSTATUS OvsExecuteDpIoctl(OvsPacketExecute *execute);
104 NTSTATUS OvsPurgeDpIoctl(PFILE_OBJECT fileObject);
105
106 NTSTATUS OvsWaitDpIoctl(PIRP irp, PFILE_OBJECT fileObject);
107
108 NTSTATUS OvsNlExecuteCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
109                                 UINT32 *replyLen);
110
111 POVS_OPEN_INSTANCE
112 OvsGetPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid);
113
114 VOID
115 OvsAddPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid,
116                   POVS_OPEN_INSTANCE instance);
117
118 VOID
119 OvsDelPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid);
120
121 #endif /* __USER_H_ */