***SPAM*** RE: [ofw] [mthca/mlx4] ChkSum bitfields mismatch?

Fab Tillier ftillier at windows.microsoft.com
Wed Sep 10 15:56:07 PDT 2008


One minor nit:

> +       switch (p_port->p_adapter->params.recv_chksum_offload) {
> +         case CSUM_DISABLED:
> +               NDIS_PER_PACKET_INFO_FROM_PACKET( *pp_packet,
> TcpIpChecksumPacketInfo ) =
> +               (void*)(uintn_t)chksum.Value;
> +               break;

<snip...>

> +         default:
> +               ASSERT(FALSE);
> +               NDIS_PER_PACKET_INFO_FROM_PACKET( *pp_packet,
> TcpIpChecksumPacketInfo ) =
> +               (void*)(uintn_t)chksum.Value;

You've just duplicated the CSUM_DISABLED code - there's no requirement that a default statement be at the end of the switch statement.  You could have moved the first two lines and let it fall through, so that there's a single place to manage the CSUM_DISABLED logic.

Something like:

 +       switch (p_port->p_adapter->params.recv_chksum_offload) {
 +         default:
 +               ASSERT(FALSE);
 +               __fallthrough;
 +
 +         case CSUM_DISABLED:
 +               NDIS_PER_PACKET_INFO_FROM_PACKET( *pp_packet,
 TcpIpChecksumPacketInfo ) =
 +               (void*)(uintn_t)chksum.Value;
 +               break;

-Fab



More information about the ofw mailing list