/* Manages the multicast receive filters of a network interface. */
EFI_STATUS EFIAPI VirtioNetReceiveFilters(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINT32 Enable, IN UINT32 Disable, IN BOOLEAN ResetMCastFilter, IN UINTN MCastFilterCnt OPTIONAL, IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL)
/* Manages the multicast receive filters of a network interface. */
EFI_STATUS EFIAPI VirtioNetReceiveFilters(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINT32 Enable, IN UINT32 Disable, IN BOOLEAN ResetMCastFilter, IN UINTN MCastFilterCnt OPTIONAL, IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL)
{
  VNET_DEV    *Dev;
  EFI_TPL     OldTpl;
  EFI_STATUS  Status;
  if (This == NULL) {
    return EFI_INVALID_PARAMETER;
  }
  Dev    = VIRTIO_NET_FROM_SNP (This);
  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
  switch (Dev->Snm.State) {
    case EfiSimpleNetworkStopped:
      Status = EFI_NOT_STARTED;
      goto Exit;
    case EfiSimpleNetworkStarted:
      Status = EFI_DEVICE_ERROR;
      goto Exit;
    default:
      break;
  }
  Status = (
            ((Enable | Disable) & ~Dev->Snm.ReceiveFilterMask) != 0 ||
            (!ResetMCastFilter && MCastFilterCnt > Dev->Snm.MaxMCastFilterCount)
            ) ? EFI_INVALID_PARAMETER : EFI_SUCCESS;
Exit:
  gBS->RestoreTPL (OldTpl);
  return Status;
}