From: Stan Smith Date: Tue, 16 Nov 2010 18:16:11 +0000 (+0000) Subject: [IPOIB_NDIS6_CM] incorporate trunk commit 2994; X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=e2379522a5102c14d78c2bf031cdece954be731a;p=~shefty%2Frdma-win.git [IPOIB_NDIS6_CM] incorporate trunk commit 2994; ETH header was copied twice when falling into __send_copy flow git-svn-id: svn://openib.tc.cornell.edu/gen1@2995 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp b/branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp index 8c844038..731f1a21 100644 --- a/branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp +++ b/branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp @@ -3702,7 +3702,10 @@ __send_copy( IN ipoib_send_NB_SG * s_buf, IN UINT lso_header_size) { - ULONG tot_len = 0; + ULONG tot_len = 0; + uint32_t offset = + (lso_header_size ? EthIPoIBHeaderOffset : EthHeaderOffset ); + int seg_index = lso_header_size ? 0 : 1; IPOIB_ENTER( IPOIB_DBG_SEND ); @@ -3722,13 +3725,11 @@ __send_copy( ASSERT(tot_len > lso_header_size); return NDIS_STATUS_FAILURE; } - //TODO Do not copy the ETH header + /* Setup the work request. */ - int seg_index = lso_header_size ? 0 : 1; - p_desc->send_wr[0].local_ds[seg_index].vaddr = cl_get_physaddr( - ((uint8_t*)s_buf->p_send_buf) + lso_header_size ); - p_desc->send_wr[0].local_ds[seg_index].length = tot_len - lso_header_size; + ((uint8_t*)s_buf->p_send_buf) + lso_header_size + offset ); + p_desc->send_wr[0].local_ds[seg_index].length = tot_len - lso_header_size - offset; p_desc->send_wr[0].local_ds[seg_index].lkey = p_port->ib_mgr.lkey; p_desc->send_wr[0].wr.num_ds = seg_index+1; @@ -4265,9 +4266,7 @@ __send_gen( NDIS_STATUS status; uint32_t i, j = 1; ULONG DataOffset = 0; - uint32_t EthHeaderOffset = sizeof(eth_hdr_t); - static const EthIPoIBHeaderOffset = EthHeaderOffset - sizeof(ipoib_hdr_t); - + uint32_t offset = EthHeaderOffset; PERF_DECLARE( SendCopy ); IPOIB_ENTER( IPOIB_DBG_SEND ); @@ -4282,7 +4281,6 @@ __send_gen( return NDIS_STATUS_FAILURE; } ipoib_send_desc_t *p_desc = s_buf->p_port->p_desc; - /* TODO: Copy only essential data That is, copy only 2 chunks of ETH header if it contained in several first SG elements. @@ -4340,18 +4338,18 @@ __send_gen( return NDIS_STATUS_SUCCESS; } } - else while( EthHeaderOffset ) + else while( offset ) { - if( p_sgl->Elements[i].Length <= EthHeaderOffset ) + if( p_sgl->Elements[i].Length <= offset ) { - EthHeaderOffset -= p_sgl->Elements[i++].Length; + offset -= p_sgl->Elements[i++].Length; } else { p_desc->send_wr[0].local_ds[j].vaddr = - p_sgl->Elements[i].Address.QuadPart + EthHeaderOffset + DataOffset; + p_sgl->Elements[i].Address.QuadPart + offset + DataOffset; p_desc->send_wr[0].local_ds[j].length = - p_sgl->Elements[i].Length - EthHeaderOffset - DataOffset; + p_sgl->Elements[i].Length - offset - DataOffset; p_desc->send_wr[0].local_ds[j].lkey = s_buf->p_port->ib_mgr.lkey; if( p_desc->send_wr[0].local_ds[j].length > 0 ) { diff --git a/branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.h b/branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.h index 501f3f51..36ad0d91 100644 --- a/branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.h +++ b/branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.h @@ -168,6 +168,11 @@ typedef struct _ipoib_hdr * resv * Reserved portion of IPoIB header. *********/ +static const uint32_t EthHeaderOffset = sizeof(eth_hdr_t); + +//We reuse eth header to put there IPoIB header for LSO Net Buffers. +// Thus, when copying such NB one need to jump over the appropriate offset +static const uint32_t EthIPoIBHeaderOffset = EthHeaderOffset - sizeof(ipoib_hdr_t); typedef struct _ipoib_arp_pkt { @@ -184,6 +189,7 @@ typedef struct _ipoib_arp_pkt } PACK_SUFFIX ipoib_arp_pkt_t; + /****s* IPoIB Driver/ipoib_pkt_t * NAME * ipoib_pkt_t