From fa1324c92810c6b1e33b7e87caaaf2e6c4041040 Mon Sep 17 00:00:00 2001 From: Samuel Ghinet Date: Fri, 29 Aug 2014 04:06:48 +0000 Subject: datapath-windows: Rename files. This patch includes the file renaming and accommodations needed for the file renaming to build the forwarding extension for Hyper-V. This patch is also a follow-up for the thread: http://openvswitch.org/pipermail/dev/2014-August/044005.html Signed-off-by: Samuel Ghinet Co-authored-by: Alin Gabriel Serdean Signed-off-by: Ben Pfaff --- datapath-windows/ovsext/Util.h | 78 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 datapath-windows/ovsext/Util.h (limited to 'datapath-windows/ovsext/Util.h') diff --git a/datapath-windows/ovsext/Util.h b/datapath-windows/ovsext/Util.h new file mode 100644 index 000000000..c45d48881 --- /dev/null +++ b/datapath-windows/ovsext/Util.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2014 VMware, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __UTIL_H_ +#define __UTIL_H_ 1 + +#define OVS_MEMORY_TAG 'TSVO' +#define OVS_FIX_SIZE_NBL_POOL_TAG 'FSVO' +#define OVS_VARIABLE_SIZE_NBL_POOL_TAG 'VSVO' +#define OVS_NBL_ONLY_POOL_TAG 'OSVO' +#define OVS_NET_BUFFER_POOL_TAG 'NSVO' +#define OVS_OTHER_POOL_TAG 'MSVO' + +VOID *OvsAllocateMemory(size_t size); +VOID *OvsAllocateAlignedMemory(size_t size, UINT16 align); +VOID OvsFreeMemory(VOID *ptr); +VOID OvsFreeAlignedMemory(VOID *ptr); + +#define LIST_FORALL(_headPtr, _itemPtr) \ + for (_itemPtr = (_headPtr)->Flink; \ + _itemPtr != _headPtr; \ + _itemPtr = (_itemPtr)->Flink) + +#define LIST_FORALL_SAFE(_headPtr, _itemPtr, _nextPtr) \ + for (_itemPtr = (_headPtr)->Flink, _nextPtr = (_itemPtr)->Flink; \ + _itemPtr != _headPtr; \ + _itemPtr = _nextPtr, _nextPtr = (_itemPtr)->Flink) + +#define LIST_FORALL_REVERSE(_headPtr, _itemPtr) \ + for (_itemPtr = (_headPtr)->Blink; \ + _itemPtr != _headPtr; \ + _itemPtr = (_itemPtr)->Blink) + +#define LIST_FORALL_REVERSE_SAFE(_headPtr, _itemPtr, _nextPtr) \ + for (_itemPtr = (_headPtr)->Blink, _nextPtr = (_itemPtr)->Blink; \ + _itemPtr != _headPtr; \ + _itemPtr = _nextPtr, _nextPtr = (_itemPtr)->Blink) + +VOID OvsAppendList(PLIST_ENTRY dst, PLIST_ENTRY src); + + +#define MIN(_a, _b) (_a) > (_b) ? (_b) : (_a) +#define ARRAY_SIZE(_x) ((sizeof(_x))/sizeof (_x)[0]) +#define OVS_SWITCH_PORT_ID_INVALID (NDIS_SWITCH_PORT_ID)(-1) + +#ifndef htons +#define htons(_x) _byteswap_ushort((USHORT)(_x)) +#define ntohs(_x) _byteswap_ushort((USHORT)(_x)) +#define htonl(_x) _byteswap_ulong((ULONG)(_x)) +#define ntohl(_x) _byteswap_ulong((ULONG)(_x)) +#endif + +#define OVS_INIT_OBJECT_HEADER(_obj, _type, _revision, _size) \ + { \ + PNDIS_OBJECT_HEADER hdrp = _obj; \ + hdrp->Type = _type; \ + hdrp->Revision = _revision; \ + hdrp->Size = _size; \ + } + + +#define BIT16(_x) ((UINT16)0x1 << (_x)) +#define BIT32(_x) ((UINT32)0x1 << (_x)) + +#endif /* __UTIL_H_ */ -- cgit v1.2.1