VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/E1kNetDxe/SnpReceiveFilters.c

Last change on this file was 89462, checked in by vboxsync, 3 years ago

EFI: Beginnings of a e1000 network driver to support network boot with our e1000 emulation, not built right now.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/** @file
2
3 Implementation of the SNP.ReceiveFilters() function and its private helpers
4 if any.
5
6 Copyright (c) 2021, Oracle and/or its affiliates.
7 Copyright (C) 2013, Red Hat, Inc.
8 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
9
10 SPDX-License-Identifier: BSD-2-Clause-Patent
11
12**/
13
14#include <Library/UefiBootServicesTableLib.h>
15
16#include "E1kNet.h"
17
18/**
19 Manages the multicast receive filters of a network interface.
20
21 @param This The protocol instance pointer.
22 @param Enable A bit mask of receive filters to enable on the
23 network interface.
24 @param Disable A bit mask of receive filters to disable on the
25 network interface.
26 @param ResetMCastFilter Set to TRUE to reset the contents of the multicast
27 receive filters on the network interface to their
28 default values.
29 @param McastFilterCnt Number of multicast HW MAC addresses in the new
30 MCastFilter list. This value must be less than or
31 equal to the MCastFilterCnt field of
32 EFI_SIMPLE_NETWORK_MODE. This field is optional if
33 ResetMCastFilter is TRUE.
34 @param MCastFilter A pointer to a list of new multicast receive filter
35 HW MAC addresses. This list will replace any
36 existing multicast HW MAC address list. This field
37 is optional if ResetMCastFilter is TRUE.
38
39 @retval EFI_SUCCESS The multicast receive filter list was updated.
40 @retval EFI_NOT_STARTED The network interface has not been started.
41 @retval EFI_INVALID_PARAMETER One or more of the parameters has an
42 unsupported value.
43 @retval EFI_DEVICE_ERROR The command could not be sent to the network
44 interface.
45 @retval EFI_UNSUPPORTED This function is not supported by the network
46 interface.
47
48**/
49
50EFI_STATUS
51EFIAPI
52E1kNetReceiveFilters (
53 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
54 IN UINT32 Enable,
55 IN UINT32 Disable,
56 IN BOOLEAN ResetMCastFilter,
57 IN UINTN MCastFilterCnt OPTIONAL,
58 IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
59 )
60{
61 E1K_NET_DEV *Dev;
62 EFI_TPL OldTpl;
63 EFI_STATUS Status;
64
65 if (This == NULL) {
66 return EFI_INVALID_PARAMETER;
67 }
68
69 Dev = E1K_NET_FROM_SNP (This);
70 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
71 switch (Dev->Snm.State) {
72 case EfiSimpleNetworkStopped:
73 Status = EFI_NOT_STARTED;
74 goto Exit;
75 case EfiSimpleNetworkStarted:
76 Status = EFI_DEVICE_ERROR;
77 goto Exit;
78 default:
79 break;
80 }
81
82 //
83 // MNP apparently fails to initialize on top of us if we simply return
84 // EFI_UNSUPPORTED in this function.
85 //
86 // Hence we openly refuse multicast functionality, and fake the rest by
87 // selecting a no stricter filter setting than whatever is requested. The
88 // UEFI-2.3.1+errC spec allows this. In practice we don't change our current
89 // (default) filter. Additionally, receiving software is responsible for
90 // discarding any packets getting through the filter.
91 //
92 Status = (
93 ((Enable | Disable) & ~Dev->Snm.ReceiveFilterMask) != 0 ||
94 (!ResetMCastFilter && MCastFilterCnt > Dev->Snm.MaxMCastFilterCount)
95 ) ? EFI_INVALID_PARAMETER : EFI_SUCCESS;
96
97Exit:
98 gBS->RestoreTPL (OldTpl);
99 return Status;
100}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use