summaryrefslogtreecommitdiff
path: root/datapath-windows
diff options
context:
space:
mode:
authorShashank Ram <rams@vmware.com>2017-08-21 14:45:23 -0700
committerAlin Gabriel Serdean <aserdean@ovn.org>2017-08-23 22:29:08 +0300
commitbf4077e2cb571584cebcb1b506a34b5f31dc7be0 (patch)
tree7caa7af4d872910821019acc545761e4dc6cf053 /datapath-windows
parentba953e1e83d54d000b65aa6ac95821466849626c (diff)
downloadopenvswitch-bf4077e2cb571584cebcb1b506a34b5f31dc7be0.tar.gz
datapath-windows: Move OvsCreateNewNBLsFromMultipleNBs to BuggerMgmt
Moves function OvsCreateNewNBLsFromMultipleNBs() to BufferMgmt.c to facilitate consumption from outside PacketIO.c. Signed-off-by: Shashank Ram <rams@vmware.com> Acked-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Diffstat (limited to 'datapath-windows')
-rw-r--r--datapath-windows/ovsext/BufferMgmt.c47
-rw-r--r--datapath-windows/ovsext/BufferMgmt.h4
-rw-r--r--datapath-windows/ovsext/PacketIO.c42
3 files changed, 51 insertions, 42 deletions
diff --git a/datapath-windows/ovsext/BufferMgmt.c b/datapath-windows/ovsext/BufferMgmt.c
index 1ede4a32e..5c9e5627c 100644
--- a/datapath-windows/ovsext/BufferMgmt.c
+++ b/datapath-windows/ovsext/BufferMgmt.c
@@ -1783,3 +1783,50 @@ OvsGetCtxSourcePortNo(PNET_BUFFER_LIST nbl,
*portNo = ctx->srcPortNo;
return NDIS_STATUS_SUCCESS;
}
+
+/*
+ * --------------------------------------------------------------------------
+ * OvsCreateNewNBLsFromMultipleNBs --
+ * Creates an NBL chain where each NBL has a single NB,
+ * from an NBL which has multiple NBs.
+ * Sets 'curNbl' and 'lastNbl' to the first and last NBL in the
+ * newly created NBL chain respectively, and completes the original NBL.
+ * --------------------------------------------------------------------------
+ */
+NTSTATUS
+OvsCreateNewNBLsFromMultipleNBs(POVS_SWITCH_CONTEXT switchContext,
+ PNET_BUFFER_LIST *curNbl,
+ PNET_BUFFER_LIST *lastNbl)
+{
+ NTSTATUS status = STATUS_SUCCESS;
+ PNET_BUFFER_LIST newNbls = NULL;
+ PNET_BUFFER_LIST nbl = NULL;
+ BOOLEAN error = TRUE;
+
+ do {
+ /* Create new NBLs from curNbl with multiple net buffers. */
+ newNbls = OvsPartialCopyToMultipleNBLs(switchContext,
+ *curNbl, 0, 0, TRUE);
+ if (NULL == newNbls) {
+ OVS_LOG_ERROR("Failed to allocate NBLs with single NB.");
+ status = NDIS_STATUS_RESOURCES;
+ break;
+ }
+
+ nbl = newNbls;
+ while (nbl) {
+ *lastNbl = nbl;
+ nbl = NET_BUFFER_LIST_NEXT_NBL(nbl);
+ }
+
+ (*curNbl)->Next = NULL;
+
+ OvsCompleteNBL(switchContext, *curNbl, TRUE);
+
+ *curNbl = newNbls;
+
+ error = FALSE;
+ } while (error);
+
+ return status;
+}
diff --git a/datapath-windows/ovsext/BufferMgmt.h b/datapath-windows/ovsext/BufferMgmt.h
index e6cc0fe82..dcf310a27 100644
--- a/datapath-windows/ovsext/BufferMgmt.h
+++ b/datapath-windows/ovsext/BufferMgmt.h
@@ -141,4 +141,8 @@ NDIS_STATUS OvsSetCtxSourcePortNo(PNET_BUFFER_LIST nbl, UINT32 portNo);
NDIS_STATUS OvsGetCtxSourcePortNo(PNET_BUFFER_LIST nbl, UINT32 *portNo);
+NTSTATUS OvsCreateNewNBLsFromMultipleNBs(PVOID context,
+ PNET_BUFFER_LIST *curNbl,
+ PNET_BUFFER_LIST *lastNbl);
+
#endif /* __BUFFER_MGMT_H_ */
diff --git a/datapath-windows/ovsext/PacketIO.c b/datapath-windows/ovsext/PacketIO.c
index 81c574e75..38e3e5f36 100644
--- a/datapath-windows/ovsext/PacketIO.c
+++ b/datapath-windows/ovsext/PacketIO.c
@@ -46,10 +46,6 @@ extern NDIS_STRING ovsExtFriendlyNameUC;
static VOID OvsFinalizeCompletionList(OvsCompletionList *completionList);
static VOID OvsCompleteNBLIngress(POVS_SWITCH_CONTEXT switchContext,
PNET_BUFFER_LIST netBufferLists, ULONG sendCompleteFlags);
-static NTSTATUS OvsCreateNewNBLsFromMultipleNBs(
- POVS_SWITCH_CONTEXT switchContext,
- PNET_BUFFER_LIST *curNbl,
- PNET_BUFFER_LIST *lastNbl);
VOID
OvsInitCompletionList(OvsCompletionList *completionList,
@@ -500,41 +496,3 @@ OvsExtCancelSendNBL(NDIS_HANDLE filterModuleContext,
/* All send requests get completed synchronously, so there is no need to
* implement this callback. */
}
-
-static NTSTATUS
-OvsCreateNewNBLsFromMultipleNBs(POVS_SWITCH_CONTEXT switchContext,
- PNET_BUFFER_LIST *curNbl,
- PNET_BUFFER_LIST *lastNbl)
-{
- NTSTATUS status = STATUS_SUCCESS;
- PNET_BUFFER_LIST newNbls = NULL;
- PNET_BUFFER_LIST nbl = NULL;
- BOOLEAN error = TRUE;
-
- do {
- /* Create new NBLs from curNbl with multiple net buffers. */
- newNbls = OvsPartialCopyToMultipleNBLs(switchContext,
- *curNbl, 0, 0, TRUE);
- if (NULL == newNbls) {
- OVS_LOG_ERROR("Failed to allocate NBLs with single NB.");
- status = NDIS_STATUS_RESOURCES;
- break;
- }
-
- nbl = newNbls;
- while (nbl) {
- *lastNbl = nbl;
- nbl = NET_BUFFER_LIST_NEXT_NBL(nbl);
- }
-
- (*curNbl)->Next = NULL;
-
- OvsCompleteNBL(switchContext, *curNbl, TRUE);
-
- *curNbl = newNbls;
-
- error = FALSE;
- } while (error);
-
- return status;
-}