MnpVlan.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /** @file
  2. Header file to be included by MnpVlan.c.
  3. Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef __MNP_VLAN_H__
  7. #define __MNP_VLAN_H__
  8. #include "MnpDriver.h"
  9. extern EFI_VLAN_CONFIG_PROTOCOL mVlanConfigProtocolTemplate;
  10. /**
  11. Create a child handle for the VLAN ID.
  12. @param[in] ImageHandle The driver image handle.
  13. @param[in] ControllerHandle Handle of device to bind driver to.
  14. @param[in] VlanId The VLAN ID.
  15. @param[out] Devicepath Pointer to returned device path for child handle.
  16. @return The handle of VLAN child or NULL if failed to create VLAN child.
  17. **/
  18. EFI_HANDLE
  19. MnpCreateVlanChild (
  20. IN EFI_HANDLE ImageHandle,
  21. IN EFI_HANDLE ControllerHandle,
  22. IN UINT16 VlanId,
  23. OUT EFI_DEVICE_PATH_PROTOCOL **Devicepath OPTIONAL
  24. );
  25. /**
  26. Remove VLAN tag of a packet.
  27. @param[in, out] MnpDeviceData Pointer to the mnp device context data.
  28. @param[in, out] Nbuf Pointer to the NET_BUF to remove VLAN tag.
  29. @param[out] VlanId Pointer to the returned VLAN ID.
  30. @retval TRUE VLAN tag is removed from this packet.
  31. @retval FALSE There is no VLAN tag in this packet.
  32. **/
  33. BOOLEAN
  34. MnpRemoveVlanTag (
  35. IN OUT MNP_DEVICE_DATA *MnpDeviceData,
  36. IN OUT NET_BUF *Nbuf,
  37. OUT UINT16 *VlanId
  38. );
  39. /**
  40. Build the vlan packet to transmit from the TxData passed in.
  41. @param MnpServiceData Pointer to the mnp service context data.
  42. @param TxData Pointer to the transmit data containing the
  43. information to build the packet.
  44. @param ProtocolType Pointer to the Ethernet protocol type.
  45. @param Packet Pointer to record the address of the packet.
  46. @param Length Pointer to a UINT32 variable used to record the
  47. packet's length.
  48. **/
  49. VOID
  50. MnpInsertVlanTag (
  51. IN MNP_SERVICE_DATA *MnpServiceData,
  52. IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,
  53. OUT UINT16 *ProtocolType,
  54. IN OUT UINT8 **Packet,
  55. IN OUT UINT32 *Length
  56. );
  57. /**
  58. Get VLAN configuration variable.
  59. @param[in] MnpDeviceData Pointer to the MNP device context data.
  60. @param[out] NumberOfVlan Pointer to number of VLAN to be returned.
  61. @param[out] VlanVariable Pointer to the buffer to return requested
  62. array of VLAN_TCI.
  63. @retval EFI_SUCCESS The array of VLAN_TCI was returned in VlanVariable
  64. and number of VLAN was returned in NumberOfVlan.
  65. @retval EFI_NOT_FOUND VLAN configuration variable not found.
  66. @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the configuration.
  67. **/
  68. EFI_STATUS
  69. MnpGetVlanVariable (
  70. IN MNP_DEVICE_DATA *MnpDeviceData,
  71. OUT UINTN *NumberOfVlan,
  72. OUT VLAN_TCI **VlanVariable
  73. );
  74. /**
  75. Set VLAN configuration variable.
  76. @param[in] MnpDeviceData Pointer to the MNP device context data.
  77. @param[in] NumberOfVlan Number of VLAN in array VlanVariable.
  78. @param[in] VlanVariable Pointer to array of VLAN_TCI.
  79. @retval EFI_SUCCESS The VLAN variable is successfully set.
  80. @retval EFI_OUT_OF_RESOURCES There is not enough resource to set the configuration.
  81. **/
  82. EFI_STATUS
  83. MnpSetVlanVariable (
  84. IN MNP_DEVICE_DATA *MnpDeviceData,
  85. IN UINTN NumberOfVlan,
  86. IN VLAN_TCI *VlanVariable
  87. );
  88. /**
  89. Create a VLAN device or modify the configuration parameter of an
  90. already-configured VLAN.
  91. The Set() function is used to create a new VLAN device or change the VLAN
  92. configuration parameters. If the VlanId hasn't been configured in the
  93. physical Ethernet device, a new VLAN device will be created. If a VLAN with
  94. this VlanId is already configured, then related configuration will be updated
  95. as the input parameters.
  96. If VlanId is zero, the VLAN device will send and receive untagged frames.
  97. Otherwise, the VLAN device will send and receive VLAN-tagged frames containing the VlanId.
  98. If VlanId is out of scope of (0-4094), EFI_INVALID_PARAMETER is returned.
  99. If Priority is out of the scope of (0-7), then EFI_INVALID_PARAMETER is returned.
  100. If there is not enough system memory to perform the registration, then
  101. EFI_OUT_OF_RESOURCES is returned.
  102. @param[in] This Points to the EFI_VLAN_CONFIG_PROTOCOL.
  103. @param[in] VlanId A unique identifier (1-4094) of the VLAN which is being created
  104. or modified, or zero (0).
  105. @param[in] Priority 3 bit priority in VLAN header. Priority 0 is default value. If
  106. VlanId is zero (0), Priority is ignored.
  107. @retval EFI_SUCCESS The VLAN is successfully configured.
  108. @retval EFI_INVALID_PARAMETER One or more of following conditions is TRUE:
  109. - This is NULL.
  110. - VlanId is an invalid VLAN Identifier.
  111. - Priority is invalid.
  112. @retval EFI_OUT_OF_RESOURCES There is not enough system memory to perform the registration.
  113. **/
  114. EFI_STATUS
  115. EFIAPI
  116. VlanConfigSet (
  117. IN EFI_VLAN_CONFIG_PROTOCOL *This,
  118. IN UINT16 VlanId,
  119. IN UINT8 Priority
  120. );
  121. /**
  122. Find configuration information for specified VLAN or all configured VLANs.
  123. The Find() function is used to find the configuration information for matching
  124. VLAN and allocate a buffer into which those entries are copied.
  125. @param[in] This Points to the EFI_VLAN_CONFIG_PROTOCOL.
  126. @param[in] VlanId Pointer to VLAN identifier. Set to NULL to find all
  127. configured VLANs.
  128. @param[out] NumberOfVlan The number of VLANs which is found by the specified criteria.
  129. @param[out] Entries The buffer which receive the VLAN configuration.
  130. @retval EFI_SUCCESS The VLAN is successfully found.
  131. @retval EFI_INVALID_PARAMETER One or more of following conditions is TRUE:
  132. - This is NULL.
  133. - Specified VlanId is invalid.
  134. @retval EFI_NOT_FOUND No matching VLAN is found.
  135. **/
  136. EFI_STATUS
  137. EFIAPI
  138. VlanConfigFind (
  139. IN EFI_VLAN_CONFIG_PROTOCOL *This,
  140. IN UINT16 *VlanId OPTIONAL,
  141. OUT UINT16 *NumberOfVlan,
  142. OUT EFI_VLAN_FIND_DATA **Entries
  143. );
  144. /**
  145. Remove the configured VLAN device.
  146. The Remove() function is used to remove the specified VLAN device.
  147. If the VlanId is out of the scope of (0-4094), EFI_INVALID_PARAMETER is returned.
  148. If specified VLAN hasn't been previously configured, EFI_NOT_FOUND is returned.
  149. @param[in] This Points to the EFI_VLAN_CONFIG_PROTOCOL.
  150. @param[in] VlanId Identifier (0-4094) of the VLAN to be removed.
  151. @retval EFI_SUCCESS The VLAN is successfully removed.
  152. @retval EFI_INVALID_PARAMETER One or more of following conditions is TRUE:
  153. - This is NULL.
  154. - VlanId is an invalid parameter.
  155. @retval EFI_NOT_FOUND The to-be-removed VLAN does not exist.
  156. **/
  157. EFI_STATUS
  158. EFIAPI
  159. VlanConfigRemove (
  160. IN EFI_VLAN_CONFIG_PROTOCOL *This,
  161. IN UINT16 VlanId
  162. );
  163. #endif