[ofw] umad: do not modify input after sending
Fab Tillier
ftillier at microsoft.com
Wed Apr 20 17:56:38 PDT 2011
Hefty, Sean wrote on Wed, 20 Apr 2011 at 14:55:36
> diff --git a/trunk/core/winmad/kernel/wm_provider.c
> b/trunk/core/winmad/kernel/wm_provider.c
> index f3926f9..6e73c9d 100644
> --- a/trunk/core/winmad/kernel/wm_provider.c
> +++ b/trunk/core/winmad/kernel/wm_provider.c
> @@ -284,6 +284,23 @@ out:
> WdfRequestCompleteWithInformation(Request, status, len);
> }
>
> +// If the Version is not set, use umad compatability address format
> +static void WmConvertGrh(ib_grh_t *pGrh, WM_IO_MAD *pIoMad)
> +{
> + if (RtlUlongByteSwap(pIoMad->Address.VersionClassFlow) >> 28) {
Couldn't you just check the upper four bits of the lowest byte and avoid the byte swap here:
if (pIoMad->Address.VersionClassFlow & 0xF0) {
> + pGrh->ver_class_flow = pIoMad->Address.VersionClassFlow;
> + } else {
> + pGrh->ver_class_flow = RtlUlongByteSwap((6 << 28) |
> + (((uint32_t) pIoMad->UmadAddress.TrafficClass) <<
> 20) |
> + (pIoMad->UmadAddress.FlowLabel & 0x000FFFFF));
> + }
> +
> + pGrh->hop_limit = pIoMad->Address.HopLimit;
> + // TODO: update IBAL to use SGID index
> + // pGrh->src_gid_index = pIoMad->Address.GidIndex;
> + RtlCopyMemory(pGrh->dest_gid.raw, pIoMad->Address.Gid, 16);
> +}
> +
> static NTSTATUS WmSendMad(WM_REGISTRATION *pRegistration,
> WM_IO_MAD *pIoMad, UINT32 size)
> {
> ib_al_ifc_t *pifc;
More information about the ofw
mailing list