[ovs-dev] [PATCH] datapath-windows: Fix issues related to packet completion

Shashank Ram rams at vmware.com
Thu Dec 8 21:31:49 UTC 2016


- In OvsTunnelPortTx() function, for packets coming from the
  VIF port, the srcVportNo, srcPortId and srcNicIndex were
  getting modified for the original NBL prior to creation
  of newNbl. This is not correct since modifying the original
  packet's forwarding detail can cause completion issues.
  Instead, we should keep the forwarding detail of the original
  packet as is, and only update the forwarding detail for the
  newNbl.

Signed-off-by: Shashank Ram <rams at vmware.com>
---
 datapath-windows/ovsext/Actions.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c
index f46309a..b5d922b 100644
--- a/datapath-windows/ovsext/Actions.c
+++ b/datapath-windows/ovsext/Actions.c
@@ -663,6 +663,9 @@ OvsTunnelPortTx(OvsForwardingContext *ovsFwdCtx)
 {
     NDIS_STATUS status = NDIS_STATUS_FAILURE;
     PNET_BUFFER_LIST newNbl = NULL;
+    UINT32 srcVportNo;
+    NDIS_SWITCH_NIC_INDEX srcNicIndex;
+    NDIS_SWITCH_PORT_ID srcPortId;

     /*
      * Setup the source port to be the internal port to as to facilitate the
@@ -675,11 +678,15 @@ OvsTunnelPortTx(OvsForwardingContext *ovsFwdCtx)
             L"OVS-Dropped since either internal or external port is absent");
         return NDIS_STATUS_FAILURE;
     }
-    ovsFwdCtx->srcVportNo =
-        ((POVS_VPORT_ENTRY)ovsFwdCtx->switchContext->internalVport)->portNo;

-    ovsFwdCtx->fwdDetail->SourcePortId = ovsFwdCtx->switchContext->internalPortId;
-    ovsFwdCtx->fwdDetail->SourceNicIndex =
+    /*
+     * Save the 'srcVportNo', 'srcPortId', 'srcNicIndex' so that
+     * this can be applied to the new NBL later on.
+     */
+    srcVportNo =
+        ((POVS_VPORT_ENTRY)ovsFwdCtx->switchContext->internalVport)->portNo;
+    srcPortId = ovsFwdCtx->switchContext->internalPortId;
+    srcNicIndex =
         ((POVS_VPORT_ENTRY)ovsFwdCtx->switchContext->internalVport)->nicIndex;

     /* Do the encap. Encap function does not consume the NBL. */
@@ -715,12 +722,20 @@ OvsTunnelPortTx(OvsForwardingContext *ovsFwdCtx)
         ASSERT(newNbl);
         OvsCompleteNBLForwardingCtx(ovsFwdCtx,
                                     L"Complete after cloning NBL for encapsulation");
+        status = OvsInitForwardingCtx(ovsFwdCtx, ovsFwdCtx->switchContext,
+                                      newNbl, srcVportNo, 0,
+                                      NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(newNbl),
+                                      ovsFwdCtx->completionList,
+                                      &ovsFwdCtx->layers, FALSE);
         ovsFwdCtx->curNbl = newNbl;
+        /* Update the forwarding detail for the new NBL */
+        ovsFwdCtx->fwdDetail->SourcePortId = srcPortId;
+        ovsFwdCtx->fwdDetail->SourceNicIndex = srcNicIndex;
         status = OvsDoFlowLookupOutput(ovsFwdCtx);
         ASSERT(ovsFwdCtx->curNbl == NULL);
     } else {
         /*
-        * XXX: Temporary freeing of the packet until we register a
+         * XXX: Temporary freeing of the packet until we register a
          * callback to IP helper.
          */
         OvsCompleteNBLForwardingCtx(ovsFwdCtx,
--
2.6.2



More information about the dev mailing list