{\r
UINTN PktIdx;\r
\r
- Dev->TxMaxPending = MIN (Dev->TxRing.QueueSize / 2, VNET_MAX_PENDING);\r
+ Dev->TxMaxPending = (UINT16) MIN (Dev->TxRing.QueueSize / 2,\r
+ VNET_MAX_PENDING);\r
Dev->TxCurPending = 0;\r
Dev->TxFreeStack = AllocatePool (Dev->TxMaxPending *\r
sizeof *Dev->TxFreeStack);\r
Dev->TxRing.Desc[DescIdx].Addr = (UINTN) &Dev->TxSharedReq;\r
Dev->TxRing.Desc[DescIdx].Len = sizeof Dev->TxSharedReq;\r
Dev->TxRing.Desc[DescIdx].Flags = VRING_DESC_F_NEXT;\r
- Dev->TxRing.Desc[DescIdx].Next = DescIdx + 1;\r
+ Dev->TxRing.Desc[DescIdx].Next = (UINT16) (DescIdx + 1);\r
\r
//\r
// The second descriptor of each pending TX packet is updated on the fly,\r
// Limit the number of pending RX packets if the queue is big. The division\r
// by two is due to the above "two descriptors per packet" trait.\r
//\r
- RxAlwaysPending = MIN (Dev->RxRing.QueueSize / 2, VNET_MAX_PENDING);\r
+ RxAlwaysPending = (UINT16) MIN (Dev->RxRing.QueueSize / 2, VNET_MAX_PENDING);\r
\r
Dev->RxBuf = AllocatePool (RxAlwaysPending * RxBufSize);\r
if (Dev->RxBuf == NULL) {\r
Dev->RxRing.Desc[DescIdx].Addr = (UINTN) RxPtr;\r
Dev->RxRing.Desc[DescIdx].Len = sizeof (VIRTIO_NET_REQ);\r
Dev->RxRing.Desc[DescIdx].Flags = VRING_DESC_F_WRITE | VRING_DESC_F_NEXT;\r
- Dev->RxRing.Desc[DescIdx].Next = DescIdx + 1;\r
+ Dev->RxRing.Desc[DescIdx].Next = (UINT16) (DescIdx + 1);\r
RxPtr += Dev->RxRing.Desc[DescIdx++].Len;\r
\r
Dev->RxRing.Desc[DescIdx].Addr = (UINTN) RxPtr;\r
- Dev->RxRing.Desc[DescIdx].Len = RxBufSize - sizeof (VIRTIO_NET_REQ);\r
+ Dev->RxRing.Desc[DescIdx].Len = (UINT32) (RxBufSize -\r
+ sizeof (VIRTIO_NET_REQ));\r
Dev->RxRing.Desc[DescIdx].Flags = VRING_DESC_F_WRITE;\r
RxPtr += Dev->RxRing.Desc[DescIdx++].Len;\r
}\r
RxPtr += SIZE_OF_VNET (VhdrMac);\r
\r
if (Protocol != NULL) {\r
- *Protocol = ((UINT16) RxPtr[0] << 8) | RxPtr[1];\r
+ *Protocol = (UINT16) ((RxPtr[0] << 8) | RxPtr[1]);\r
}\r
RxPtr += sizeof (UINT16);\r
\r
// virtio-0.9.5, 2.4.1 Supplying Buffers to The Device\r
//\r
AvailIdx = *Dev->RxRing.Avail.Idx;\r
- Dev->RxRing.Avail.Ring[AvailIdx++ % Dev->RxRing.QueueSize] = DescIdx;\r
+ Dev->RxRing.Avail.Ring[AvailIdx++ % Dev->RxRing.QueueSize] =\r
+ (UINT16) DescIdx;\r
\r
MemoryFence ();\r
*Dev->RxRing.Avail.Idx = AvailIdx;\r