[ofw] [IPoIB CM][Patch] receive Chksum flags
Alex Estrin
alex.estrin at qlogic.com
Mon Feb 9 10:06:20 PST 2009
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;
More information about the ofw
mailing list