[ofw] RE: [IPoIB CM][Patch] receive Chksum flags
Alex Estrin
alex.estrin at qlogic.com
Tue Feb 10 04:45:15 PST 2009
Applied in revision 1937.
Thanks,
Alex.
> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Alex
> Estrin
> Sent: Monday, February 09, 2009 1:06 PM
> To: ofw at lists.openfabrics.org; Alex Naslednikov
> Subject: [ofw] [IPoIB CM][Patch] receive Chksum flags
>
> Hello,
>
> Here is a patch to replace hardcoded TCP/IP Chksum flags indication
> with the same algorithm as used for datagram mode.
>
> Please review.
>
> Thanks,
> Alex.
>
> Index: kernel/ipoib_endpoint.c
> ===================================================================
> --- kernel/ipoib_endpoint.c (revision 1933)
> +++ kernel/ipoib_endpoint.c (working copy)
> @@ -791,6 +791,7 @@
> ipoib_cm_desc_t *p_desc;
> uint32_t i = 0;
> NDIS_PACKET *p_packet;
> + NDIS_TCP_IP_CHECKSUM_PACKET_INFO chksum;
>
> IPOIB_ENTER( IPOIB_DBG_RECV );
> UNUSED_PARAM( p_endpt );
> @@ -813,12 +814,31 @@
> p_port->cm_recv_mgr.depth--;
> continue;
> }
> - p_desc->ndis_csum.Value = 0;
> - p_desc->ndis_csum.Receive.NdisPacketTcpChecksumSucceeded = TRUE;
> - p_desc->ndis_csum.Receive.NdisPacketUdpChecksumSucceeded = TRUE;
> - p_desc->ndis_csum.Receive.NdisPacketIpChecksumSucceeded = TRUE;
> - NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, TcpIpChecksumPacketInfo ) =
> - (void*)(uintn_t)p_desc-
> >ndis_csum.Value;
> + chksum.Value = 0;
> + switch( p_port->p_adapter->params.recv_chksum_offload )
> + {
> + default:
> + CL_ASSERT( FALSE );
> + case CSUM_DISABLED:
> + NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, TcpIpChecksumPacketInfo ) =
> + (void*)(uintn_t)chksum.Value;
> + break;
> + case CSUM_ENABLED:
> + /* Get the checksums directly from packet information. */
> + /* In this case, no one of cheksum's cat get false value */
> + /* If hardware checksum failed or wasn't calculated, NDIS will recalculate it again
> */
> + NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, TcpIpChecksumPacketInfo ) =
> + (void*)(uintn_t)(p_desc->ndis_csum.Value);
> + break;
> + case CSUM_BYPASS:
> + /* Flag the checksums as having been calculated. */
> + chksum.Receive.NdisPacketTcpChecksumSucceeded = TRUE;
> + chksum.Receive.NdisPacketUdpChecksumSucceeded = TRUE;
> + chksum.Receive.NdisPacketIpChecksumSucceeded = TRUE;
> + NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, TcpIpChecksumPacketInfo ) =
> + (void*)(uintn_t)chksum.Value;
> + break;
> + }
>
> NDIS_SET_PACKET_STATUS( p_packet, NDIS_STATUS_SUCCESS );
> p_port->cm_recv_mgr.recv_pkt_array[i] = p_packet;
> Index: kernel/ipoib_port.c
> ===================================================================
> --- kernel/ipoib_port.c (revision 1933)
> +++ kernel/ipoib_port.c (working copy)
> @@ -1082,16 +1082,6 @@
> NdisWriteErrorLogEntry( p_port->p_adapter->h_adapter,
> EVENT_IPOIB_CONNECTED_MODE_ERR, 1, 0xbadc0de2 );
> }
> - else
> - {
> - /* now we can adjust csum capabilities */
> - if (p_port->p_adapter->params.send_chksum_offload )
> - p_port->p_adapter->params.send_chksum_offload = CSUM_DISABLED;
> -
> - if (p_port->p_adapter->params.recv_chksum_offload == CSUM_ENABLED)
> - p_port->p_adapter->params.recv_chksum_offload = CSUM_BYPASS;
> - }
> -
> }
> IPOIB_EXIT( IPOIB_DBG_INIT );
> return IB_SUCCESS;
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
More information about the ofw
mailing list