NetworkPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the NetworkPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
2f88bd3a12
commit
d1050b9dff
@@ -9,13 +9,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include "MnpImpl.h"
|
||||
#include "MnpVlan.h"
|
||||
|
||||
VLAN_DEVICE_PATH mVlanDevicePathTemplate = {
|
||||
VLAN_DEVICE_PATH mVlanDevicePathTemplate = {
|
||||
{
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_VLAN_DP,
|
||||
{
|
||||
(UINT8) (sizeof (VLAN_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VLAN_DEVICE_PATH)) >> 8)
|
||||
(UINT8)(sizeof (VLAN_DEVICE_PATH)),
|
||||
(UINT8)((sizeof (VLAN_DEVICE_PATH)) >> 8)
|
||||
}
|
||||
},
|
||||
0
|
||||
@@ -27,7 +27,6 @@ EFI_VLAN_CONFIG_PROTOCOL mVlanConfigProtocolTemplate = {
|
||||
VlanConfigRemove
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Create a child handle for the VLAN ID.
|
||||
|
||||
@@ -41,10 +40,10 @@ EFI_VLAN_CONFIG_PROTOCOL mVlanConfigProtocolTemplate = {
|
||||
**/
|
||||
EFI_HANDLE
|
||||
MnpCreateVlanChild (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN UINT16 VlanId,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **Devicepath OPTIONAL
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN UINT16 VlanId,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **Devicepath OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_HANDLE ChildHandle;
|
||||
@@ -59,7 +58,7 @@ MnpCreateVlanChild (
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &ParentDevicePath,
|
||||
(VOID **)&ParentDevicePath,
|
||||
ImageHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -73,10 +72,10 @@ MnpCreateVlanChild (
|
||||
//
|
||||
CopyMem (&VlanNode, &mVlanDevicePathTemplate, sizeof (VLAN_DEVICE_PATH));
|
||||
VlanNode.VlanId = VlanId;
|
||||
VlanDevicePath = AppendDevicePathNode (
|
||||
ParentDevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &VlanNode
|
||||
);
|
||||
VlanDevicePath = AppendDevicePathNode (
|
||||
ParentDevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&VlanNode
|
||||
);
|
||||
if (VlanDevicePath == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -85,12 +84,12 @@ MnpCreateVlanChild (
|
||||
// Create child VLAN handle by installing DevicePath protocol
|
||||
//
|
||||
ChildHandle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ChildHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
VlanDevicePath,
|
||||
NULL
|
||||
);
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ChildHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
VlanDevicePath,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (VlanDevicePath);
|
||||
return NULL;
|
||||
@@ -116,9 +115,9 @@ MnpCreateVlanChild (
|
||||
**/
|
||||
BOOLEAN
|
||||
MnpRemoveVlanTag (
|
||||
IN OUT MNP_DEVICE_DATA *MnpDeviceData,
|
||||
IN OUT NET_BUF *Nbuf,
|
||||
OUT UINT16 *VlanId
|
||||
IN OUT MNP_DEVICE_DATA *MnpDeviceData,
|
||||
IN OUT NET_BUF *Nbuf,
|
||||
OUT UINT16 *VlanId
|
||||
)
|
||||
{
|
||||
UINT8 *Packet;
|
||||
@@ -138,7 +137,7 @@ MnpRemoveVlanTag (
|
||||
// Check whether this is VLAN tagged frame by Ether Type
|
||||
//
|
||||
*VlanId = 0;
|
||||
ProtocolType = NTOHS (*(UINT16 *) (Packet + ProtocolOffset));
|
||||
ProtocolType = NTOHS (*(UINT16 *)(Packet + ProtocolOffset));
|
||||
if (ProtocolType != ETHER_TYPE_VLAN) {
|
||||
//
|
||||
// Not a VLAN tagged frame
|
||||
@@ -146,8 +145,8 @@ MnpRemoveVlanTag (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VlanTag.Uint16 = NTOHS (*(UINT16 *) (Packet + ProtocolOffset + sizeof (ProtocolType)));
|
||||
*VlanId = VlanTag.Bits.Vid;
|
||||
VlanTag.Uint16 = NTOHS (*(UINT16 *)(Packet + ProtocolOffset + sizeof (ProtocolType)));
|
||||
*VlanId = VlanTag.Bits.Vid;
|
||||
|
||||
//
|
||||
// Move hardware address (DA + SA) 4 bytes right to override VLAN tag
|
||||
@@ -162,7 +161,6 @@ MnpRemoveVlanTag (
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Build the vlan packet to transmit from the TxData passed in.
|
||||
|
||||
@@ -177,28 +175,28 @@ MnpRemoveVlanTag (
|
||||
**/
|
||||
VOID
|
||||
MnpInsertVlanTag (
|
||||
IN MNP_SERVICE_DATA *MnpServiceData,
|
||||
IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,
|
||||
OUT UINT16 *ProtocolType,
|
||||
IN OUT UINT8 **Packet,
|
||||
IN OUT UINT32 *Length
|
||||
IN MNP_SERVICE_DATA *MnpServiceData,
|
||||
IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,
|
||||
OUT UINT16 *ProtocolType,
|
||||
IN OUT UINT8 **Packet,
|
||||
IN OUT UINT32 *Length
|
||||
)
|
||||
{
|
||||
VLAN_TCI *VlanTci;
|
||||
UINT16 *Tpid;
|
||||
UINT16 *EtherType;
|
||||
MNP_DEVICE_DATA *MnpDeviceData;
|
||||
EFI_SIMPLE_NETWORK_MODE *SnpMode;
|
||||
VLAN_TCI *VlanTci;
|
||||
UINT16 *Tpid;
|
||||
UINT16 *EtherType;
|
||||
MNP_DEVICE_DATA *MnpDeviceData;
|
||||
EFI_SIMPLE_NETWORK_MODE *SnpMode;
|
||||
|
||||
MnpDeviceData = MnpServiceData->MnpDeviceData;
|
||||
SnpMode = MnpDeviceData->Snp->Mode;
|
||||
|
||||
*ProtocolType = ETHER_TYPE_VLAN;
|
||||
*Length = *Length + NET_VLAN_TAG_LEN;
|
||||
*Packet = *Packet - NET_VLAN_TAG_LEN;
|
||||
*Length = *Length + NET_VLAN_TAG_LEN;
|
||||
*Packet = *Packet - NET_VLAN_TAG_LEN;
|
||||
|
||||
Tpid = (UINT16 *) (*Packet + SnpMode->MediaHeaderSize - sizeof (*ProtocolType));
|
||||
VlanTci = (VLAN_TCI *) (UINTN) (Tpid + 1);
|
||||
Tpid = (UINT16 *)(*Packet + SnpMode->MediaHeaderSize - sizeof (*ProtocolType));
|
||||
VlanTci = (VLAN_TCI *)(UINTN)(Tpid + 1);
|
||||
if (TxData->HeaderLength != 0) {
|
||||
//
|
||||
// Media header is in packet, move DA+SA 4 bytes left
|
||||
@@ -213,7 +211,7 @@ MnpInsertVlanTag (
|
||||
//
|
||||
// Media header not in packet, VLAN TCI and original protocol type becomes payload
|
||||
//
|
||||
EtherType = (UINT16 *) (UINTN) (VlanTci + 1);
|
||||
EtherType = (UINT16 *)(UINTN)(VlanTci + 1);
|
||||
*EtherType = HTONS (TxData->ProtocolType);
|
||||
}
|
||||
|
||||
@@ -237,36 +235,38 @@ MnpInsertVlanTag (
|
||||
**/
|
||||
EFI_STATUS
|
||||
MnpCheckVlanVariable (
|
||||
IN MNP_DEVICE_DATA *MnpDeviceData,
|
||||
IN VLAN_TCI *Buffer,
|
||||
IN UINTN NumberOfVlan,
|
||||
OUT UINTN *NewNumberOfVlan
|
||||
IN MNP_DEVICE_DATA *MnpDeviceData,
|
||||
IN VLAN_TCI *Buffer,
|
||||
IN UINTN NumberOfVlan,
|
||||
OUT UINTN *NewNumberOfVlan
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Index2;
|
||||
UINTN Count;
|
||||
BOOLEAN FoundDuplicateItem;
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
UINTN Index2;
|
||||
UINTN Count;
|
||||
BOOLEAN FoundDuplicateItem;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Count = 0;
|
||||
FoundDuplicateItem = FALSE;
|
||||
Status = EFI_SUCCESS;
|
||||
Count = 0;
|
||||
FoundDuplicateItem = FALSE;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
for (Index = 0; Index < NumberOfVlan; Index++) {
|
||||
for (Index2 = Index + 1; Index2 < NumberOfVlan; Index2++) {
|
||||
if (Buffer[Index].Bits.Vid == Buffer[Index2].Bits.Vid) {
|
||||
FoundDuplicateItem = TRUE;
|
||||
Count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (FoundDuplicateItem) {
|
||||
for (Index2 = Index +1; Index2 < NumberOfVlan; Index++, Index2++) {
|
||||
CopyMem (Buffer + Index, Buffer + Index2, sizeof (VLAN_TCI));
|
||||
for (Index2 = Index + 1; Index2 < NumberOfVlan; Index2++) {
|
||||
if (Buffer[Index].Bits.Vid == Buffer[Index2].Bits.Vid) {
|
||||
FoundDuplicateItem = TRUE;
|
||||
Count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
FoundDuplicateItem = FALSE;
|
||||
|
||||
if (FoundDuplicateItem) {
|
||||
for (Index2 = Index +1; Index2 < NumberOfVlan; Index++, Index2++) {
|
||||
CopyMem (Buffer + Index, Buffer + Index2, sizeof (VLAN_TCI));
|
||||
}
|
||||
}
|
||||
|
||||
FoundDuplicateItem = FALSE;
|
||||
}
|
||||
|
||||
*NewNumberOfVlan = NumberOfVlan - Count;
|
||||
@@ -293,9 +293,9 @@ MnpCheckVlanVariable (
|
||||
**/
|
||||
EFI_STATUS
|
||||
MnpGetVlanVariable (
|
||||
IN MNP_DEVICE_DATA *MnpDeviceData,
|
||||
OUT UINTN *NumberOfVlan,
|
||||
OUT VLAN_TCI **VlanVariable
|
||||
IN MNP_DEVICE_DATA *MnpDeviceData,
|
||||
OUT UINTN *NumberOfVlan,
|
||||
OUT VLAN_TCI **VlanVariable
|
||||
)
|
||||
{
|
||||
UINTN BufferSize;
|
||||
@@ -306,15 +306,15 @@ MnpGetVlanVariable (
|
||||
//
|
||||
// Get VLAN configuration from EFI Variable
|
||||
//
|
||||
Buffer = NULL;
|
||||
Buffer = NULL;
|
||||
BufferSize = 0;
|
||||
Status = gRT->GetVariable (
|
||||
MnpDeviceData->MacString,
|
||||
&gEfiVlanConfigProtocolGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
NULL
|
||||
);
|
||||
Status = gRT->GetVariable (
|
||||
MnpDeviceData->MacString,
|
||||
&gEfiVlanConfigProtocolGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
NULL
|
||||
);
|
||||
if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
@@ -361,9 +361,9 @@ MnpGetVlanVariable (
|
||||
**/
|
||||
EFI_STATUS
|
||||
MnpSetVlanVariable (
|
||||
IN MNP_DEVICE_DATA *MnpDeviceData,
|
||||
IN UINTN NumberOfVlan,
|
||||
IN VLAN_TCI *VlanVariable
|
||||
IN MNP_DEVICE_DATA *MnpDeviceData,
|
||||
IN UINTN NumberOfVlan,
|
||||
IN VLAN_TCI *VlanVariable
|
||||
)
|
||||
{
|
||||
return gRT->SetVariable (
|
||||
@@ -375,7 +375,6 @@ MnpSetVlanVariable (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create a VLAN device or modify the configuration parameter of an
|
||||
already-configured VLAN.
|
||||
@@ -410,9 +409,9 @@ MnpSetVlanVariable (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
VlanConfigSet (
|
||||
IN EFI_VLAN_CONFIG_PROTOCOL *This,
|
||||
IN UINT16 VlanId,
|
||||
IN UINT8 Priority
|
||||
IN EFI_VLAN_CONFIG_PROTOCOL *This,
|
||||
IN UINT16 VlanId,
|
||||
IN UINT8 Priority
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -429,14 +428,14 @@ VlanConfigSet (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
IsAdd = FALSE;
|
||||
IsAdd = FALSE;
|
||||
MnpDeviceData = MNP_DEVICE_DATA_FROM_THIS (This);
|
||||
if (MnpDeviceData->NumberOfVlan == 0) {
|
||||
//
|
||||
// No existing VLAN, this is the first VLAN to add
|
||||
//
|
||||
IsAdd = TRUE;
|
||||
Entry = GetFirstNode (&MnpDeviceData->ServiceList);
|
||||
IsAdd = TRUE;
|
||||
Entry = GetFirstNode (&MnpDeviceData->ServiceList);
|
||||
MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);
|
||||
|
||||
if (VlanId != 0) {
|
||||
@@ -470,7 +469,7 @@ VlanConfigSet (
|
||||
//
|
||||
// VlanId not found, create a new MNP service data
|
||||
//
|
||||
IsAdd = TRUE;
|
||||
IsAdd = TRUE;
|
||||
MnpServiceData = MnpCreateServiceData (MnpDeviceData, VlanId, Priority);
|
||||
if (MnpServiceData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -478,7 +477,7 @@ VlanConfigSet (
|
||||
}
|
||||
}
|
||||
|
||||
MnpServiceData->VlanId = VlanId;
|
||||
MnpServiceData->VlanId = VlanId;
|
||||
MnpServiceData->Priority = Priority;
|
||||
if (IsAdd) {
|
||||
MnpDeviceData->NumberOfVlan++;
|
||||
@@ -516,6 +515,7 @@ VlanConfigSet (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT (Index < NumberOfVlan);
|
||||
|
||||
NewVariable = OldVariable;
|
||||
@@ -536,7 +536,6 @@ Exit:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Find configuration information for specified VLAN or all configured VLANs.
|
||||
|
||||
@@ -559,10 +558,10 @@ Exit:
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
VlanConfigFind (
|
||||
IN EFI_VLAN_CONFIG_PROTOCOL *This,
|
||||
IN UINT16 *VlanId OPTIONAL,
|
||||
OUT UINT16 *NumberOfVlan,
|
||||
OUT EFI_VLAN_FIND_DATA **Entries
|
||||
IN EFI_VLAN_CONFIG_PROTOCOL *This,
|
||||
IN UINT16 *VlanId OPTIONAL,
|
||||
OUT UINT16 *NumberOfVlan,
|
||||
OUT EFI_VLAN_FIND_DATA **Entries
|
||||
)
|
||||
{
|
||||
MNP_DEVICE_DATA *MnpDeviceData;
|
||||
@@ -570,7 +569,7 @@ VlanConfigFind (
|
||||
LIST_ENTRY *Entry;
|
||||
EFI_VLAN_FIND_DATA *VlanData;
|
||||
|
||||
if ((This == NULL) || (VlanId != NULL && *VlanId > 4094) || (NumberOfVlan == NULL) || (Entries == NULL)) {
|
||||
if ((This == NULL) || ((VlanId != NULL) && (*VlanId > 4094)) || (NumberOfVlan == NULL) || (Entries == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -586,8 +585,8 @@ VlanConfigFind (
|
||||
//
|
||||
// Return all current VLAN configuration
|
||||
//
|
||||
*NumberOfVlan = (UINT16) MnpDeviceData->NumberOfVlan;
|
||||
VlanData = AllocateZeroPool (*NumberOfVlan * sizeof (EFI_VLAN_FIND_DATA));
|
||||
*NumberOfVlan = (UINT16)MnpDeviceData->NumberOfVlan;
|
||||
VlanData = AllocateZeroPool (*NumberOfVlan * sizeof (EFI_VLAN_FIND_DATA));
|
||||
if (VlanData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@@ -596,7 +595,7 @@ VlanConfigFind (
|
||||
NET_LIST_FOR_EACH (Entry, &MnpDeviceData->ServiceList) {
|
||||
MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);
|
||||
|
||||
VlanData->VlanId = MnpServiceData->VlanId;
|
||||
VlanData->VlanId = MnpServiceData->VlanId;
|
||||
VlanData->Priority = MnpServiceData->Priority;
|
||||
VlanData++;
|
||||
}
|
||||
@@ -616,16 +615,16 @@ VlanConfigFind (
|
||||
if (VlanData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
VlanData->VlanId = MnpServiceData->VlanId;
|
||||
|
||||
VlanData->VlanId = MnpServiceData->VlanId;
|
||||
VlanData->Priority = MnpServiceData->Priority;
|
||||
|
||||
*NumberOfVlan = 1;
|
||||
*Entries = VlanData;
|
||||
*Entries = VlanData;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Remove the configured VLAN device.
|
||||
|
||||
@@ -646,8 +645,8 @@ VlanConfigFind (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
VlanConfigRemove (
|
||||
IN EFI_VLAN_CONFIG_PROTOCOL *This,
|
||||
IN UINT16 VlanId
|
||||
IN EFI_VLAN_CONFIG_PROTOCOL *This,
|
||||
IN UINT16 VlanId
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
Reference in New Issue
Block a user