/* This function enqueues the received datagram into the instances' receiving queues. */
UINTN Udp6EnqueueDgram(IN UDP6_SERVICE_DATA *Udp6Service, IN NET_BUF *Packet, IN EFI_UDP6_RECEIVE_DATA *RxData)
/* This function enqueues the received datagram into the instances' receiving queues. */
UINTN Udp6EnqueueDgram(IN UDP6_SERVICE_DATA *Udp6Service, IN NET_BUF *Packet, IN EFI_UDP6_RECEIVE_DATA *RxData)
{
  LIST_ENTRY          *Entry;
  UDP6_INSTANCE_DATA  *Instance;
  UDP6_RXDATA_WRAP    *Wrap;
  UINTN               Enqueued;
  Enqueued = 0;
  NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {
    Instance = NET_LIST_USER_STRUCT (Entry, UDP6_INSTANCE_DATA, Link);
    if (!Instance->Configured) {
      continue;
    }
    if (Udp6MatchDgram (Instance, &RxData->UdpSession)) {
      Wrap = Udp6WrapRxData (Instance, Packet, RxData);
      if (Wrap == NULL) {
        continue;
      }
      NET_GET_REF (Packet);
      InsertTailList (&Instance->RcvdDgramQue, &Wrap->Link);
      Enqueued++;
    }
  }
  return Enqueued;
}