[ovs-dev] [PATCH] datapath-windows: Remove the workaround in NAT for TCP checksum

Sairam Venugopal vsairam at vmware.com
Fri Oct 13 20:51:08 UTC 2017


Hi Alin,

Any update on this one? I believe you had raised this issue and had sent out a patch to address this earlier.

Thanks,
Sairam




On 9/15/17, 3:04 PM, "ovs-dev-bounces at openvswitch.org on behalf of Anand Kumar" <ovs-dev-bounces at openvswitch.org on behalf of kumaranand at vmware.com> wrote:

>When checksum offload is enabled, compute checksum using the
>TCP pseudo header.
>
>Signed-off-by: Anand Kumar <kumaranand at vmware.com>
>---
> datapath-windows/ovsext/Actions.c | 60 +++++++--------------------------------
> 1 file changed, 11 insertions(+), 49 deletions(-)
>
>diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c
>index 41d1c7b..0af4a66 100644
>--- a/datapath-windows/ovsext/Actions.c
>+++ b/datapath-windows/ovsext/Actions.c
>@@ -1528,6 +1528,11 @@ OvsUpdateAddressAndPort(OvsForwardingContext *ovsFwdCtx,
>                         ((BOOLEAN)csumInfo.Receive.UdpChecksumSucceeded ||
>                          (BOOLEAN)csumInfo.Receive.UdpChecksumFailed);
>         }
>+        if (l4Offload) {
>+            *checkField = IPPseudoChecksum(&newAddr, &ipHdr->daddr,
>+                tcpHdr ? IPPROTO_TCP : IPPROTO_UDP,
>+                ntohs(ipHdr->tot_len) - ipHdr->ihl * 4);
>+        }
>     } else {
>         addrField = &ipHdr->daddr;
>         if (tcpHdr) {
>@@ -1538,19 +1543,13 @@ OvsUpdateAddressAndPort(OvsForwardingContext *ovsFwdCtx,
>             checkField = &udpHdr->check;
>         }
>     }
>+
>     if (*addrField != newAddr) {
>         UINT32 oldAddr = *addrField;
>-        if (checkField && *checkField != 0) {
>-            if (l4Offload) {
>-                /* Recompute IP pseudo checksum */
>-                *checkField = ~(*checkField);
>-                *checkField = ChecksumUpdate32(*checkField, oldAddr,
>-                                               newAddr);
>-                *checkField = ~(*checkField);
>-            } else {
>-                *checkField = ChecksumUpdate32(*checkField, oldAddr,
>-                                               newAddr);
>-            }
>+        if (checkField && *checkField != 0 && !l4Offload) {
>+            /* Recompute total checksum. */
>+            *checkField = ChecksumUpdate32(*checkField, oldAddr,
>+                                            newAddr);
>         }
>         if (ipHdr->check != 0) {
>             ipHdr->check = ChecksumUpdate32(ipHdr->check, oldAddr,
>@@ -1561,49 +1560,12 @@ OvsUpdateAddressAndPort(OvsForwardingContext *ovsFwdCtx,
> 
>     if (portField && *portField != newPort) {
>         if (checkField && !l4Offload) {
>+            /* Recompute total checksum. */
>             *checkField = ChecksumUpdate16(*checkField, *portField,
>                                            newPort);
>         }
>         *portField = newPort;
>     }
>-    PNET_BUFFER_LIST curNbl = ovsFwdCtx->curNbl;
>-    PNET_BUFFER_LIST newNbl = NULL;
>-    if (layers->isTcp) {
>-        UINT32 mss = OVSGetTcpMSS(curNbl);
>-        if (mss) {
>-            OVS_LOG_TRACE("l4Offset %d", layers->l4Offset);
>-            newNbl = OvsTcpSegmentNBL(ovsFwdCtx->switchContext, curNbl, layers,
>-                                      mss, 0, FALSE);
>-            if (newNbl == NULL) {
>-                OVS_LOG_ERROR("Unable to segment NBL");
>-                return NDIS_STATUS_FAILURE;
>-            }
>-            /* Clear out LSO flags after this point */
>-            NET_BUFFER_LIST_INFO(newNbl, TcpLargeSendNetBufferListInfo) = 0;
>-        }
>-    }
>-    /* If we didn't split the packet above, make a copy now */
>-    if (newNbl == NULL) {
>-        csumInfo.Value = NET_BUFFER_LIST_INFO(curNbl,
>-                                              TcpIpChecksumNetBufferListInfo);
>-        OvsApplySWChecksumOnNB(layers, curNbl, &csumInfo);
>-    }
>-
>-    if (newNbl) {
>-        curNbl = newNbl;
>-        OvsCompleteNBLForwardingCtx(ovsFwdCtx,
>-                                    L"Complete after cloning NBL for encapsulation");
>-        OvsInitForwardingCtx(ovsFwdCtx, ovsFwdCtx->switchContext,
>-                             newNbl, ovsFwdCtx->srcVportNo, 0,
>-                             NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(newNbl),
>-                             ovsFwdCtx->completionList,
>-                             &ovsFwdCtx->layers, FALSE);
>-        ovsFwdCtx->curNbl = newNbl;
>-    }
>-
>-    NET_BUFFER_LIST_INFO(curNbl,
>-                         TcpIpChecksumNetBufferListInfo) = 0;
>-
>     return NDIS_STATUS_SUCCESS;
> }
> 
>-- 
>2.9.3.windows.1
>
>_______________________________________________
>dev mailing list
>dev at openvswitch.org
>https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Z6vowHUOjP5ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo&m=SBcJfA7atJ6aGjBxtOlOR2r14HlYT8CY-K1DpMvgt4A&s=oP6eHfHcXJwo9vAhJbfEzIDJtQ6u-WkjnbIOxErltVY&e= 


More information about the dev mailing list