2 * Copyright (c) 2014 VMware, Inc.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 /* This file contains structures and function definitions necessary for
18 * forwarding packet to user space.
28 * Even we have more cores, I don't think we need
29 * more than 32 queues for processing packets to
32 #define OVS_DEFAULT_PACKET_QUEUE 1
33 #define OVS_MAX_PACKET_QUEUE_LEN 4096
36 * Only when OVS_PER_VPORT_QUEUE_CTRL is defined
37 * we will apply this constraint
39 #define OVS_MAX_PACKETS_PER_VPORT 128
40 #define OVS_MAX_PACKETS_PER_TUNNEL 1024
42 typedef struct _OVS_USER_PACKET_QUEUE {
45 LIST_ENTRY packetList;
48 NDIS_SPIN_LOCK queueLock;
49 } OVS_USER_PACKET_QUEUE, *POVS_USER_PACKET_QUEUE;
51 typedef struct _OVS_PACKET_QUEUE_ELEM {
54 OVS_PACKET_HDR_INFO hdrInfo;
55 OVS_PACKET_INFO packet;
56 } OVS_PACKET_QUEUE_ELEM, *POVS_PACKET_QUEUE_ELEM;
58 struct _OVS_OPEN_INSTANCE;
60 typedef struct _OVS_USER_STATS {
63 UINT32 dropDuetoResource;
64 UINT32 dropDuetoChecksum;
69 } OVS_USER_STATS, *POVS_USER_STATS;
71 VOID OvsCleanupPacketQueue(struct _OVS_OPEN_INSTANCE *instance);
73 POVS_PACKET_QUEUE_ELEM OvsCreateQueueNlPacket(PVOID userData,
76 POVS_VPORT_ENTRY vport,
81 POVS_PACKET_HDR_INFO hdrInfo);
83 VOID OvsQueuePackets(PLIST_ENTRY packetList, UINT32 numElems);
84 NTSTATUS OvsCreateAndAddPackets(PVOID userData,
87 POVS_VPORT_ENTRY vport,
91 POVS_PACKET_HDR_INFO hdrInfo,
92 POVS_SWITCH_CONTEXT switchContext,
96 NTSTATUS OvsSubscribeDpIoctl(PVOID instanceP,
100 NTSTATUS OvsReadDpIoctl(PFILE_OBJECT fileObject,
104 NTSTATUS OvsExecuteDpIoctl(OvsPacketExecute *execute);
105 NTSTATUS OvsPurgeDpIoctl(PFILE_OBJECT fileObject);
107 NTSTATUS OvsWaitDpIoctl(PIRP irp, PFILE_OBJECT fileObject);
109 NTSTATUS OvsNlExecuteCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
113 OvsGetPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid);
116 OvsAddPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid,
117 POVS_OPEN_INSTANCE instance);
120 OvsDelPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid);
122 NTSTATUS OvsReadPacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
124 NTSTATUS OvsSubscribePacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
126 NTSTATUS OvsPendPacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
129 #endif /* __USER_H_ */