TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip6If.c File Reference
#include "Ip6Impl.h"

Go to the source code of this file.

Functions

VOID EFIAPI Ip6OnFrameSent (IN EFI_EVENT Event, IN VOID *Context)
 
BOOLEAN Ip6CancelInstanceFrame (IN IP6_LINK_TX_TOKEN *Frame, IN VOID *Context)
 
EFI_STATUS Ip6SetAddress (IN IP6_INTERFACE *Interface, IN EFI_IPv6_ADDRESS *Ip6Addr, IN BOOLEAN IsAnycast, IN UINT8 PrefixLength, IN UINT32 ValidLifetime, IN UINT32 PreferredLifetime, IN IP6_DAD_CALLBACK DadCallback OPTIONAL, IN VOID *Context OPTIONAL)
 
IP6_INTERFACEIp6CreateInterface (IN IP6_SERVICE *IpSb, IN BOOLEAN LinkLocal)
 
VOID Ip6CleanInterface (IN IP6_INTERFACE *Interface, IN IP6_PROTOCOL *IpInstance OPTIONAL)
 
IP6_LINK_TX_TOKENIp6CreateLinkTxToken (IN IP6_INTERFACE *Interface, IN IP6_PROTOCOL *IpInstance OPTIONAL, IN NET_BUF *Packet, IN IP6_FRAME_CALLBACK CallBack, IN VOID *Context)
 
VOID Ip6FreeLinkTxToken (IN IP6_LINK_TX_TOKEN *Token)
 
VOID EFIAPI Ip6RecycleFrame (IN VOID *Context)
 
VOID EFIAPI Ip6OnFrameReceivedDpc (IN VOID *Context)
 
VOID EFIAPI Ip6OnFrameReceived (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS Ip6ReceiveFrame (IN IP6_FRAME_CALLBACK CallBack, IN IP6_SERVICE *IpSb)
 
VOID EFIAPI Ip6OnFrameSentDpc (IN VOID *Context)
 
EFI_STATUS Ip6SendFrame (IN IP6_INTERFACE *Interface, IN IP6_PROTOCOL *IpInstance OPTIONAL, IN NET_BUF *Packet, IN EFI_IPv6_ADDRESS *NextHop, IN IP6_FRAME_CALLBACK CallBack, IN VOID *Context)
 
VOID EFIAPI Ip6TimerTicking (IN EFI_EVENT Event, IN VOID *Context)
 

Detailed Description

Implement IP6 pseudo interface.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Ip6If.c.

Function Documentation

◆ Ip6CancelInstanceFrame()

BOOLEAN Ip6CancelInstanceFrame ( IN IP6_LINK_TX_TOKEN Frame,
IN VOID *  Context 
)

Fileter function to cancel all the frame related to an IP instance.

Parameters
[in]FrameThe transmit request to test whether to cancel.
[in]ContextThe context which is the Ip instance that issued the transmit.
Return values
TRUEThe frame belongs to this instance and is to be removed.
FALSEThe frame doesn't belong to this instance.

Definition at line 39 of file Ip6If.c.

◆ Ip6CleanInterface()

VOID Ip6CleanInterface ( IN IP6_INTERFACE Interface,
IN IP6_PROTOCOL *IpInstance  OPTIONAL 
)

Free the interface used by IpInstance. All the IP instance with the same Ip/prefix pair share the same interface. It is reference counted. All the frames that haven't been sent will be cancelled. Because the IpInstance is optional, the caller must remove IpInstance from the interface's instance list.

Parameters
[in]InterfaceThe interface used by the IpInstance.
[in]IpInstanceThe IP instance that free the interface. NULL if the IP driver is releasing the default interface.

Definition at line 297 of file Ip6If.c.

◆ Ip6CreateInterface()

IP6_INTERFACE * Ip6CreateInterface ( IN IP6_SERVICE IpSb,
IN BOOLEAN  LinkLocal 
)

Create an IP6_INTERFACE.

Parameters
[in]IpSbThe IP6 service binding instance.
[in]LinkLocalIf TRUE, the instance is created for link-local address. Otherwise, it is not for a link-local address.
Returns
Point to the created IP6_INTERFACE, otherwise NULL.

Definition at line 206 of file Ip6If.c.

◆ Ip6CreateLinkTxToken()

IP6_LINK_TX_TOKEN * Ip6CreateLinkTxToken ( IN IP6_INTERFACE Interface,
IN IP6_PROTOCOL *IpInstance  OPTIONAL,
IN NET_BUF Packet,
IN IP6_FRAME_CALLBACK  CallBack,
IN VOID *  Context 
)

Create and wrap a transmit request into a newly allocated IP6_LINK_TX_TOKEN.

Parameters
[in]InterfaceThe interface to send out from.
[in]IpInstanceThe IpInstance that transmit the packet. NULL if the packet is sent by the IP6 driver itself.
[in]PacketThe packet to transmit
[in]CallBackCall back function to execute if transmission finished.
[in]ContextOpaque parameter to the callback.
Returns
The wrapped token if succeed or NULL.

Definition at line 361 of file Ip6If.c.

◆ Ip6FreeLinkTxToken()

VOID Ip6FreeLinkTxToken ( IN IP6_LINK_TX_TOKEN Token)

Free the link layer transmit token. It will close the event, then free the memory used.

Parameters
[in]TokenToken to free.

Definition at line 432 of file Ip6If.c.

◆ Ip6OnFrameReceived()

VOID EFIAPI Ip6OnFrameReceived ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Request Ip6OnFrameReceivedDpc as a DPC at TPL_CALLBACK.

Parameters
EventThe receive event delivered to MNP for receive.
ContextContext for the callback.

Definition at line 538 of file Ip6If.c.

◆ Ip6OnFrameReceivedDpc()

VOID EFIAPI Ip6OnFrameReceivedDpc ( IN VOID *  Context)

Received a frame from MNP. Wrap it in net buffer then deliver it to IP's input function. The ownship of the packet also is transferred to IP. When Ip is finished with this packet, it will call NetbufFree to release the packet, NetbufFree will again call the Ip6RecycleFrame to signal MNP's event and free the token used.

Parameters
[in]ContextContext for the callback.

Definition at line 475 of file Ip6If.c.

◆ Ip6OnFrameSent()

VOID EFIAPI Ip6OnFrameSent ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Request Ip6OnFrameSentDpc as a DPC at TPL_CALLBACK.

Parameters
[in]EventThe transmit token's event.
[in]ContextThe Context which is pointed to the token.

Request Ip6OnFrameSentDpc as a DPC at TPL_CALLBACK.

Parameters
[in]EventThe transmit token's event.
[in]ContextContext which points to the token.

Definition at line 622 of file Ip6If.c.

◆ Ip6OnFrameSentDpc()

VOID EFIAPI Ip6OnFrameSentDpc ( IN VOID *  Context)

Callback function when frame transmission is finished. It will call the frame owner's callback function to tell it the result.

Parameters
[in]ContextContext which points to the token.

Definition at line 592 of file Ip6If.c.

◆ Ip6ReceiveFrame()

EFI_STATUS Ip6ReceiveFrame ( IN IP6_FRAME_CALLBACK  CallBack,
IN IP6_SERVICE IpSb 
)

Request to receive the packet from the interface.

Parameters
[in]CallBackFunction to call when receive finished.
[in]IpSbPoints to IP6 service binding instance.
Return values
EFI_ALREADY_STARTEDThere is already a pending receive request.
EFI_OUT_OF_RESOURCESFailed to allocate resource to receive.
EFI_SUCCESSThe receive request has been started.

Definition at line 561 of file Ip6If.c.

◆ Ip6RecycleFrame()

VOID EFIAPI Ip6RecycleFrame ( IN VOID *  Context)

Callback function when the received packet is freed. Check Ip6OnFrameReceived for information.

Parameters
[in]ContextPoints to EFI_MANAGED_NETWORK_RECEIVE_DATA.

Definition at line 451 of file Ip6If.c.

◆ Ip6SendFrame()

EFI_STATUS Ip6SendFrame ( IN IP6_INTERFACE Interface,
IN IP6_PROTOCOL *IpInstance  OPTIONAL,
IN NET_BUF Packet,
IN EFI_IPv6_ADDRESS NextHop,
IN IP6_FRAME_CALLBACK  CallBack,
IN VOID *  Context 
)

Send a frame from the interface. If the next hop is a multicast address, it is transmitted immediately. If the next hop is a unicast, and the NextHop's MAC is not known, it will perform address resolution. If an error occurred, the CallBack won't be called. So, the caller must test the return value, and take action when there is an error.

Parameters
[in]InterfaceThe interface to send the frame from
[in]IpInstanceThe IP child that request the transmission. NULL if it is the IP6 driver itself.
[in]PacketThe packet to transmit.
[in]NextHopThe immediate destination to transmit the packet to.
[in]CallBackFunction to call back when transmit finished.
[in]ContextOpaque parameter to the callback.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate resource to send the frame.
EFI_NO_MAPPINGCan't resolve the MAC for the nexthop.
EFI_SUCCESSThe packet successfully transmitted.

Definition at line 654 of file Ip6If.c.

◆ Ip6SetAddress()

EFI_STATUS Ip6SetAddress ( IN IP6_INTERFACE Interface,
IN EFI_IPv6_ADDRESS Ip6Addr,
IN BOOLEAN  IsAnycast,
IN UINT8  PrefixLength,
IN UINT32  ValidLifetime,
IN UINT32  PreferredLifetime,
IN IP6_DAD_CALLBACK DadCallback  OPTIONAL,
IN VOID *Context  OPTIONAL 
)

Set the interface's address. This will trigger the DAD process for the address to set. To set an already set address, the lifetimes wil be updated to the new value passed in.

Parameters
[in]InterfaceThe interface to set the address.
[in]Ip6AddrThe interface's to be assigned IPv6 address.
[in]IsAnycastIf TRUE, the unicast IPv6 address is anycast. Otherwise, it is not anycast.
[in]PrefixLengthThe prefix length of the Ip6Addr.
[in]ValidLifetimeThe valid lifetime for this address.
[in]PreferredLifetimeThe preferred lifetime for this address.
[in]DadCallbackThe caller's callback to trigger when DAD finishes. This is an optional parameter that may be NULL.
[in]ContextThe context that will be passed to DadCallback. This is an optional parameter that may be NULL.
Return values
EFI_SUCCESSThe interface is scheduled to be configured with the specified address.
EFI_OUT_OF_RESOURCESFailed to set the interface's address due to lack of resources.

Definition at line 75 of file Ip6If.c.

◆ Ip6TimerTicking()

VOID EFIAPI Ip6TimerTicking ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

The heartbeat timer of IP6 service instance. It times out all of its IP6 children's received-but-not-delivered and transmitted-but-not-recycle packets.

Parameters
[in]EventThe IP6 service instance's heartbeat timer.
[in]ContextThe IP6 service instance.

Definition at line 785 of file Ip6If.c.