iPXE
Data Structures | Macros | Functions | Variables
snpnet.c File Reference

SNP NIC driver. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include <ipxe/vsprintf.h>
#include <ipxe/timer.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/SimpleNetwork.h>
#include <ipxe/efi/efi_driver.h>
#include <ipxe/efi/efi_utils.h>
#include "snpnet.h"

Go to the source code of this file.

Data Structures

struct  snp_nic
 An SNP NIC. More...
 

Macros

#define SNP_RX_QUOTA   4
 Maximum number of received packets per poll. More...
 
#define SNP_INITIALIZE_RETRY_MAX   10
 Maximum initialisation retry count. More...
 
#define SNP_INITIALIZE_RETRY_DELAY_MS   10
 Delay between each initialisation retry. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
static const char * snpnet_mac_text (EFI_MAC_ADDRESS *mac, size_t len)
 Format SNP MAC address (for debugging) More...
 
static void snpnet_dump_mode (struct net_device *netdev)
 Dump SNP mode information (for debugging) More...
 
static void snpnet_check_link (struct net_device *netdev)
 Check link state. More...
 
static int snpnet_transmit (struct net_device *netdev, struct io_buffer *iobuf)
 Transmit packet. More...
 
static void snpnet_poll_tx (struct net_device *netdev)
 Poll for completed packets. More...
 
static void snpnet_poll_rx (struct net_device *netdev)
 Poll for received packets. More...
 
static void snpnet_poll (struct net_device *netdev)
 Poll for completed packets. More...
 
static int snpnet_rx_filters (struct net_device *netdev)
 Set receive filters. More...
 
static int snpnet_open (struct net_device *netdev)
 Open network device. More...
 
static void snpnet_close (struct net_device *netdev)
 Close network device. More...
 
int snpnet_start (struct efi_device *efidev)
 Attach driver to device. More...
 
void snpnet_stop (struct efi_device *efidev)
 Detach driver from device. More...
 

Variables

static struct net_device_operations snpnet_operations
 SNP network device operations. More...
 

Detailed Description

SNP NIC driver.

Definition in file snpnet.c.

Macro Definition Documentation

◆ SNP_RX_QUOTA

#define SNP_RX_QUOTA   4

Maximum number of received packets per poll.

Definition at line 66 of file snpnet.c.

◆ SNP_INITIALIZE_RETRY_MAX

#define SNP_INITIALIZE_RETRY_MAX   10

Maximum initialisation retry count.

Definition at line 69 of file snpnet.c.

◆ SNP_INITIALIZE_RETRY_DELAY_MS

#define SNP_INITIALIZE_RETRY_DELAY_MS   10

Delay between each initialisation retry.

Definition at line 72 of file snpnet.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ snpnet_mac_text()

static const char* snpnet_mac_text ( EFI_MAC_ADDRESS mac,
size_t  len 
)
static

Format SNP MAC address (for debugging)

Parameters
macMAC address
lenLength of MAC address
Return values
textMAC address as text

Definition at line 81 of file snpnet.c.

81  {
82  static char buf[ sizeof ( *mac ) * 3 /* "xx:" or "xx\0" */ ];
83  size_t used = 0;
84  unsigned int i;
85 
86  for ( i = 0 ; i < len ; i++ ) {
87  used += ssnprintf ( &buf[used], ( sizeof ( buf ) - used ),
88  "%s%02x", ( used ? ":" : "" ),
89  mac->Addr[i] );
90  }
91  return buf;
92 }
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
int ssnprintf(char *buf, ssize_t ssize, const char *fmt,...)
Version of vsnprintf() that accepts a signed buffer size.
Definition: vsprintf.c:420
uint32_t len
Length.
Definition: ena.h:14

References len, mac, and ssnprintf().

Referenced by snpnet_dump_mode().

◆ snpnet_dump_mode()

static void snpnet_dump_mode ( struct net_device netdev)
static

Dump SNP mode information (for debugging)

Parameters
netdevNetwork device

Definition at line 99 of file snpnet.c.

99  {
100  struct snp_nic *snp = netdev_priv ( netdev );
101  EFI_SIMPLE_NETWORK_MODE *mode = snp->snp->Mode;
102  size_t mac_len = mode->HwAddressSize;
103  unsigned int i;
104 
105  /* Do nothing unless debugging is enabled */
106  if ( ! DBG_EXTRA )
107  return;
108 
109  DBGC2 ( snp, "SNP %s st %d type %d hdr %d pkt %d rxflt %#x/%#x%s "
110  "nvram %d acc %d mcast %d/%d\n", netdev->name, mode->State,
111  mode->IfType, mode->MediaHeaderSize, mode->MaxPacketSize,
113  ( mode->MultipleTxSupported ? " multitx" : "" ),
114  mode->NvRamSize, mode->NvRamAccessSize,
115  mode->MCastFilterCount, mode->MaxMCastFilterCount );
116  DBGC2 ( snp, "SNP %s hw %s", netdev->name,
117  snpnet_mac_text ( &mode->PermanentAddress, mac_len ) );
118  DBGC2 ( snp, " addr %s%s",
119  snpnet_mac_text ( &mode->CurrentAddress, mac_len ),
120  ( mode->MacAddressChangeable ? "" : "(f)" ) );
121  DBGC2 ( snp, " bcast %s\n",
122  snpnet_mac_text ( &mode->BroadcastAddress, mac_len ) );
123  for ( i = 0 ; i < mode->MCastFilterCount ; i++ ) {
124  DBGC2 ( snp, "SNP %s mcast %s\n", netdev->name,
125  snpnet_mac_text ( &mode->MCastFilter[i], mac_len ) );
126  }
127  DBGC2 ( snp, "SNP %s media %s\n", netdev->name,
128  ( mode->MediaPresentSupported ?
129  ( mode->MediaPresent ? "present" : "not present" ) :
130  "presence not supported" ) );
131 }
static void * netdev_priv(struct net_device *netdev)
Get driver private area for this network device.
Definition: netdevice.h:566
UINT32 NvRamSize
The size, in bytes, of the NVRAM device attached to the network interface.
UINT32 MediaHeaderSize
The size, in bytes, of the network interface's media header.
BOOLEAN MediaPresent
TRUE if media are connected to the network interface; otherwise FALSE.
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
BOOLEAN MediaPresentSupported
TRUE if the presence of media can be determined; otherwise FALSE.
UINT32 State
Reports the current state of the network interface.
EFI_MAC_ADDRESS CurrentAddress
The current HW MAC address for the network interface.
EFI_SIMPLE_NETWORK_MODE * Mode
Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT]
Array containing the addresses of the current multicast address receive filters.
EFI_MAC_ADDRESS BroadcastAddress
The current HW MAC address for broadcast packets.
static const char * snpnet_mac_text(EFI_MAC_ADDRESS *mac, size_t len)
Format SNP MAC address (for debugging)
Definition: snpnet.c:81
BOOLEAN MultipleTxSupported
TRUE if the network interface can transmit more than one packet at a time.
UINT8 IfType
The interface type of the network interface.
UINT32 MaxPacketSize
The maximum size, in bytes, of the packets supported by the network interface.
UINT32 ReceiveFilterSetting
The current multicast receive filter settings.
UINT32 MCastFilterCount
The current number of multicast address receive filters.
static struct net_device * netdev
Definition: gdbudp.c:52
BOOLEAN MacAddressChangeable
TRUE if the HW MAC address can be changed.
An SNP NIC.
Definition: snpnet.c:44
UINT32 NvRamAccessSize
The size that must be used for all NVRAM reads and writes.
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
#define DBGC2(...)
Definition: compiler.h:522
UINT32 HwAddressSize
The size, in bytes, of the network interface's HW address.
UINT32 MaxMCastFilterCount
The maximum number of multicast address receive filters supported by the driver.
UINT32 ReceiveFilterMask
The multicast receive filter settings supported by the network interface.
#define DBG_EXTRA
Definition: compiler.h:319
EFI_MAC_ADDRESS PermanentAddress
The permanent HW MAC address for the network interface.

References EFI_SIMPLE_NETWORK_MODE::BroadcastAddress, EFI_SIMPLE_NETWORK_MODE::CurrentAddress, DBG_EXTRA, DBGC2, EFI_SIMPLE_NETWORK_MODE::HwAddressSize, EFI_SIMPLE_NETWORK_MODE::IfType, EFI_SIMPLE_NETWORK_MODE::MacAddressChangeable, EFI_SIMPLE_NETWORK_MODE::MaxMCastFilterCount, EFI_SIMPLE_NETWORK_MODE::MaxPacketSize, EFI_SIMPLE_NETWORK_MODE::MCastFilter, EFI_SIMPLE_NETWORK_MODE::MCastFilterCount, EFI_SIMPLE_NETWORK_MODE::MediaHeaderSize, EFI_SIMPLE_NETWORK_MODE::MediaPresent, EFI_SIMPLE_NETWORK_MODE::MediaPresentSupported, _EFI_SIMPLE_NETWORK_PROTOCOL::Mode, EFI_SIMPLE_NETWORK_MODE::MultipleTxSupported, net_device::name, netdev, netdev_priv(), EFI_SIMPLE_NETWORK_MODE::NvRamAccessSize, EFI_SIMPLE_NETWORK_MODE::NvRamSize, EFI_SIMPLE_NETWORK_MODE::PermanentAddress, EFI_SIMPLE_NETWORK_MODE::ReceiveFilterMask, EFI_SIMPLE_NETWORK_MODE::ReceiveFilterSetting, snp_nic::snp, snpnet_mac_text(), and EFI_SIMPLE_NETWORK_MODE::State.

Referenced by snpnet_open().

◆ snpnet_check_link()

static void snpnet_check_link ( struct net_device netdev)
static

Check link state.

Parameters
netdevNetwork device

Definition at line 138 of file snpnet.c.

138  {
139  struct snp_nic *snp = netdev_priv ( netdev );
140  EFI_SIMPLE_NETWORK_MODE *mode = snp->snp->Mode;
141 
142  /* Do nothing unless media presence detection is supported */
143  if ( ! mode->MediaPresentSupported )
144  return;
145 
146  /* Report any link status change */
147  if ( mode->MediaPresent && ( ! netdev_link_ok ( netdev ) ) ) {
149  } else if ( ( ! mode->MediaPresent ) && netdev_link_ok ( netdev ) ) {
151  }
152 }
static void * netdev_priv(struct net_device *netdev)
Get driver private area for this network device.
Definition: netdevice.h:566
BOOLEAN MediaPresent
TRUE if media are connected to the network interface; otherwise FALSE.
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
BOOLEAN MediaPresentSupported
TRUE if the presence of media can be determined; otherwise FALSE.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition: netdevice.c:186
EFI_SIMPLE_NETWORK_MODE * Mode
Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition: netdevice.h:768
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
Definition: netdevice.h:630
static struct net_device * netdev
Definition: gdbudp.c:52
An SNP NIC.
Definition: snpnet.c:44

References EFI_SIMPLE_NETWORK_MODE::MediaPresent, EFI_SIMPLE_NETWORK_MODE::MediaPresentSupported, _EFI_SIMPLE_NETWORK_PROTOCOL::Mode, netdev, netdev_link_down(), netdev_link_ok(), netdev_link_up(), netdev_priv(), and snp_nic::snp.

Referenced by snpnet_poll(), and snpnet_start().

◆ snpnet_transmit()

static int snpnet_transmit ( struct net_device netdev,
struct io_buffer iobuf 
)
static

Transmit packet.

Parameters
netdevNetwork device
iobufI/O buffer
Return values
rcReturn status code

Definition at line 161 of file snpnet.c.

162  {
163  struct snp_nic *snp = netdev_priv ( netdev );
164  EFI_STATUS efirc;
165  int rc;
166 
167  /* Defer the packet if there is already a transmission in progress */
168  if ( snp->txbuf ) {
169  netdev_tx_defer ( netdev, iobuf );
170  return 0;
171  }
172 
173  /* Transmit packet */
174  if ( ( efirc = snp->snp->Transmit ( snp->snp, 0, iob_len ( iobuf ),
175  iobuf->data, NULL, NULL,
176  NULL ) ) != 0 ) {
177  rc = -EEFI ( efirc );
178  DBGC ( snp, "SNP %s could not transmit: %s\n",
179  netdev->name, strerror ( rc ) );
180  return rc;
181  }
182  snp->txbuf = iobuf;
183 
184  return 0;
185 }
static void * netdev_priv(struct net_device *netdev)
Get driver private area for this network device.
Definition: netdevice.h:566
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:159
void netdev_tx_defer(struct net_device *netdev, struct io_buffer *iobuf)
Defer transmitted packet.
Definition: netdevice.c:344
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
#define DBGC(...)
Definition: compiler.h:505
static struct net_device * netdev
Definition: gdbudp.c:52
EFI_SIMPLE_NETWORK_TRANSMIT Transmit
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
An SNP NIC.
Definition: snpnet.c:44
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
void * data
Start of data.
Definition: iobuf.h:44
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References io_buffer::data, DBGC, EEFI, iob_len(), net_device::name, netdev, netdev_priv(), netdev_tx_defer(), NULL, rc, snp_nic::snp, strerror(), and _EFI_SIMPLE_NETWORK_PROTOCOL::Transmit.

◆ snpnet_poll_tx()

static void snpnet_poll_tx ( struct net_device netdev)
static

Poll for completed packets.

Parameters
netdevNetwork device

Definition at line 192 of file snpnet.c.

192  {
193  struct snp_nic *snp = netdev->priv;
194  struct io_buffer *iobuf;
195  UINT32 irq;
196  VOID *txbuf;
197  EFI_STATUS efirc;
198  int rc;
199 
200  /* Get status */
201  txbuf = NULL;
202  if ( ( efirc = snp->snp->GetStatus ( snp->snp, &irq, &txbuf ) ) != 0 ) {
203  rc = -EEFI ( efirc );
204  DBGC ( snp, "SNP %s could not get status: %s\n",
205  netdev->name, strerror ( rc ) );
206  netdev_rx_err ( netdev, NULL, rc );
207  return;
208  }
209 
210  /* Do nothing unless we have a completion */
211  if ( ! txbuf )
212  return;
213 
214  /* Sanity check */
215  if ( ! snp->txbuf ) {
216  DBGC ( snp, "SNP %s reported spurious TX completion\n",
217  netdev->name );
219  return;
220  }
221 
222  /* Complete transmission */
223  iobuf = snp->txbuf;
224  snp->txbuf = NULL;
225  netdev_tx_complete ( netdev, iobuf );
226 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
Definition: netdevice.h:746
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition: netdevice.c:501
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:159
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
Definition: netdevice.c:369
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
#define EPIPE
Broken pipe.
Definition: errno.h:619
#define DBGC(...)
Definition: compiler.h:505
unsigned int UINT32
Definition: ProcessorBind.h:56
struct io_buffer * txbuf
Current transmit buffer.
Definition: snpnet.c:60
void * priv
Driver private data.
Definition: netdevice.h:425
EFI_SIMPLE_NETWORK_GET_STATUS GetStatus
static struct net_device * netdev
Definition: gdbudp.c:52
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
An SNP NIC.
Definition: snpnet.c:44
#define VOID
Undeclared type.
Definition: Base.h:319
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
A persistent I/O buffer.
Definition: iobuf.h:32

References DBGC, EEFI, EPIPE, _EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus, net_device::name, netdev, netdev_rx_err(), netdev_tx_complete(), netdev_tx_err(), NULL, net_device::priv, rc, snp_nic::snp, strerror(), snp_nic::txbuf, and VOID.

Referenced by snpnet_poll().

◆ snpnet_poll_rx()

static void snpnet_poll_rx ( struct net_device netdev)
static

Poll for received packets.

Parameters
netdevNetwork device

Definition at line 233 of file snpnet.c.

233  {
234  struct snp_nic *snp = netdev->priv;
235  UINTN len;
236  unsigned int quota;
237  EFI_STATUS efirc;
238  int rc;
239 
240  /* Retrieve up to SNP_RX_QUOTA packets */
241  for ( quota = SNP_RX_QUOTA ; quota ; quota-- ) {
242 
243  /* Allocate buffer, if required */
244  if ( ! snp->rxbuf ) {
245  snp->rxbuf = alloc_iob ( snp->mtu );
246  if ( ! snp->rxbuf ) {
247  /* Leave for next poll */
248  break;
249  }
250  }
251 
252  /* Receive packet */
253  len = iob_tailroom ( snp->rxbuf );
254  if ( ( efirc = snp->snp->Receive ( snp->snp, NULL, &len,
255  snp->rxbuf->data, NULL,
256  NULL, NULL ) ) != 0 ) {
257 
258  /* EFI_NOT_READY is just the usual "no packet"
259  * status indication; ignore it.
260  */
261  if ( efirc == EFI_NOT_READY )
262  break;
263 
264  /* Anything else is an error */
265  rc = -EEFI ( efirc );
266  DBGC ( snp, "SNP %s could not receive: %s\n",
267  netdev->name, strerror ( rc ) );
268  netdev_rx_err ( netdev, NULL, rc );
269  break;
270  }
271 
272  /* Hand off to network stack */
273  iob_put ( snp->rxbuf, len );
274  netdev_rx ( netdev, snp->rxbuf );
275  snp->rxbuf = NULL;
276  }
277 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:116
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition: netdevice.c:501
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:159
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
#define DBGC(...)
Definition: compiler.h:505
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:128
void * priv
Driver private data.
Definition: netdevice.h:425
static struct net_device * netdev
Definition: gdbudp.c:52
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
An SNP NIC.
Definition: snpnet.c:44
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
Definition: iobuf.h:171
UINT64 UINTN
Unsigned value of native width.
Definition: ProcessorBind.h:71
#define EFI_NOT_READY
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:126
#define SNP_RX_QUOTA
Maximum number of received packets per poll.
Definition: snpnet.c:66
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
Definition: netdevice.c:470
EFI_SIMPLE_NETWORK_RECEIVE Receive
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
uint32_t len
Length.
Definition: ena.h:14
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References alloc_iob(), DBGC, EEFI, EFI_NOT_READY, iob_put, iob_tailroom(), len, net_device::name, netdev, netdev_rx(), netdev_rx_err(), NULL, net_device::priv, rc, _EFI_SIMPLE_NETWORK_PROTOCOL::Receive, snp_nic::snp, SNP_RX_QUOTA, and strerror().

Referenced by snpnet_poll().

◆ snpnet_poll()

static void snpnet_poll ( struct net_device netdev)
static

Poll for completed packets.

Parameters
netdevNetwork device

Definition at line 284 of file snpnet.c.

284  {
285 
286  /* Process any TX completions */
288 
289  /* Process any RX completions */
291 
292  /* Check for link state changes */
294 }
static struct net_device * netdev
Definition: gdbudp.c:52
static void snpnet_check_link(struct net_device *netdev)
Check link state.
Definition: snpnet.c:138
static void snpnet_poll_tx(struct net_device *netdev)
Poll for completed packets.
Definition: snpnet.c:192
static void snpnet_poll_rx(struct net_device *netdev)
Poll for received packets.
Definition: snpnet.c:233

References netdev, snpnet_check_link(), snpnet_poll_rx(), and snpnet_poll_tx().

◆ snpnet_rx_filters()

static int snpnet_rx_filters ( struct net_device netdev)
static

Set receive filters.

Parameters
netdevNetwork device
Return values
rcReturn status code

Definition at line 302 of file snpnet.c.

302  {
303  struct snp_nic *snp = netdev->priv;
304  UINT32 filters[] = {
305  snp->snp->Mode->ReceiveFilterMask,
315  };
316  unsigned int i;
317  EFI_STATUS efirc;
318  int rc;
319 
320  /* Try possible receive filters in turn */
321  for ( i = 0; i < ( sizeof ( filters ) / sizeof ( filters[0] ) ); i++ ) {
322  efirc = snp->snp->ReceiveFilters ( snp->snp, filters[i],
324  0, NULL );
325  if ( efirc == 0 )
326  return 0;
327  rc = -EEFI ( efirc );
328  DBGC ( snp, "SNP %s could not set receive filters %#02x (have "
329  "%#02x): %s\n", netdev->name, filters[i],
330  snp->snp->Mode->ReceiveFilterSetting, strerror ( rc ) );
331  }
332 
333  return rc;
334 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:159
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
#define DBGC(...)
Definition: compiler.h:505
#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST
unsigned int UINT32
Definition: ProcessorBind.h:56
#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST
EFI_SIMPLE_NETWORK_MODE * Mode
Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
UINT32 ReceiveFilterSetting
The current multicast receive filter settings.
void * priv
Driver private data.
Definition: netdevice.h:425
static struct net_device * netdev
Definition: gdbudp.c:52
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST
An SNP NIC.
Definition: snpnet.c:44
#define TRUE
Definition: tlan.h:46
#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
UINT32 ReceiveFilterMask
The multicast receive filter settings supported by the network interface.
EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References DBGC, EEFI, EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST, EFI_SIMPLE_NETWORK_RECEIVE_UNICAST, _EFI_SIMPLE_NETWORK_PROTOCOL::Mode, net_device::name, netdev, NULL, net_device::priv, rc, EFI_SIMPLE_NETWORK_MODE::ReceiveFilterMask, _EFI_SIMPLE_NETWORK_PROTOCOL::ReceiveFilters, EFI_SIMPLE_NETWORK_MODE::ReceiveFilterSetting, snp_nic::snp, strerror(), and TRUE.

Referenced by snpnet_open().

◆ snpnet_open()

static int snpnet_open ( struct net_device netdev)
static

Open network device.

Parameters
netdevNetwork device
Return values
rcReturn status code

Definition at line 342 of file snpnet.c.

342  {
343  struct snp_nic *snp = netdev->priv;
344  EFI_MAC_ADDRESS *mac = ( ( void * ) netdev->ll_addr );
345  EFI_SIMPLE_NETWORK_MODE *mode = snp->snp->Mode;
346  EFI_STATUS efirc;
347  unsigned int retry;
348  int rc;
349 
350  /* Try setting MAC address (before initialising) */
351  if ( ( efirc = snp->snp->StationAddress ( snp->snp, FALSE, mac ) ) !=0){
352  rc = -EEFI ( efirc );
353  DBGC ( snp, "SNP %s could not set station address before "
354  "initialising: %s\n", netdev->name, strerror ( rc ) );
355  /* Ignore error */
356  }
357 
358  /* Initialise NIC, retrying multiple times if link stays down */
359  for ( retry = 0 ; ; ) {
360 
361  /* Initialise NIC */
362  if ( ( efirc = snp->snp->Initialize ( snp->snp,
363  0, 0 ) ) != 0 ) {
364  rc = -EEFI ( efirc );
366  DBGC ( snp, "SNP %s could not initialise: %s\n",
367  netdev->name, strerror ( rc ) );
368  return rc;
369  }
370 
371  /* Stop if we have link up (or no link detection capability) */
372  if ( ( ! mode->MediaPresentSupported ) || mode->MediaPresent )
373  break;
374 
375  /* Stop if we have exceeded our retry count. This is
376  * not a failure; it is plausible that we genuinely do
377  * not have link up.
378  */
379  if ( ++retry >= SNP_INITIALIZE_RETRY_MAX )
380  break;
381  DBGC ( snp, "SNP %s retrying initialisation (retry %d)\n",
382  netdev->name, retry );
383 
384  /* Delay to allow time for link to establish */
386 
387  /* Shut down and retry; this is sometimes necessary in
388  * order to persuade the underlying SNP driver to
389  * actually update the link state.
390  */
391  if ( ( efirc = snp->snp->Shutdown ( snp->snp ) ) != 0 ) {
392  rc = -EEFI ( efirc );
394  DBGC ( snp, "SNP %s could not shut down: %s\n",
395  netdev->name, strerror ( rc ) );
396  return rc;
397  }
398  }
399 
400  /* Try setting MAC address (after initialising) */
401  if ( ( efirc = snp->snp->StationAddress ( snp->snp, FALSE, mac ) ) !=0){
402  rc = -EEFI ( efirc );
403  DBGC ( snp, "SNP %s could not set station address after "
404  "initialising: %s\n", netdev->name, strerror ( rc ) );
405  /* Ignore error */
406  }
407 
408  /* Set receive filters */
409  if ( ( rc = snpnet_rx_filters ( netdev ) ) != 0 ) {
410  /* Ignore error */
411  }
412 
413  /* Dump mode information (for debugging) */
415 
416  return 0;
417 }
EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static void snpnet_dump_mode(struct net_device *netdev)
Dump SNP mode information (for debugging)
Definition: snpnet.c:99
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:159
BOOLEAN MediaPresent
TRUE if media are connected to the network interface; otherwise FALSE.
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
32-byte buffer containing a network Media Access Control address.
Definition: UefiBaseType.h:102
#define DBGC(...)
Definition: compiler.h:505
BOOLEAN MediaPresentSupported
TRUE if the presence of media can be determined; otherwise FALSE.
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
EFI_SIMPLE_NETWORK_MODE * Mode
Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
EFI_SIMPLE_NETWORK_INITIALIZE Initialize
void * priv
Driver private data.
Definition: netdevice.h:425
EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown
static struct net_device * netdev
Definition: gdbudp.c:52
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
An SNP NIC.
Definition: snpnet.c:44
static int snpnet_rx_filters(struct net_device *netdev)
Set receive filters.
Definition: snpnet.c:302
#define SNP_INITIALIZE_RETRY_MAX
Maximum initialisation retry count.
Definition: snpnet.c:69
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:78
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
#define FALSE
Definition: tlan.h:45
#define SNP_INITIALIZE_RETRY_DELAY_MS
Delay between each initialisation retry.
Definition: snpnet.c:72
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:381

References DBGC, EEFI, FALSE, _EFI_SIMPLE_NETWORK_PROTOCOL::Initialize, net_device::ll_addr, mac, mdelay(), EFI_SIMPLE_NETWORK_MODE::MediaPresent, EFI_SIMPLE_NETWORK_MODE::MediaPresentSupported, _EFI_SIMPLE_NETWORK_PROTOCOL::Mode, net_device::name, netdev, net_device::priv, rc, _EFI_SIMPLE_NETWORK_PROTOCOL::Shutdown, snp_nic::snp, SNP_INITIALIZE_RETRY_DELAY_MS, SNP_INITIALIZE_RETRY_MAX, snpnet_dump_mode(), snpnet_rx_filters(), _EFI_SIMPLE_NETWORK_PROTOCOL::StationAddress, and strerror().

◆ snpnet_close()

static void snpnet_close ( struct net_device netdev)
static

Close network device.

Parameters
netdevNetwork device

Definition at line 424 of file snpnet.c.

424  {
425  struct snp_nic *snp = netdev->priv;
426  EFI_STATUS efirc;
427  int rc;
428 
429  /* Shut down NIC */
430  if ( ( efirc = snp->snp->Shutdown ( snp->snp ) ) != 0 ) {
431  rc = -EEFI ( efirc );
432  DBGC ( snp, "SNP %s could not shut down: %s\n",
433  netdev->name, strerror ( rc ) );
434  /* Nothing we can do about this */
435  }
436 
437  /* Discard transmit buffer, if applicable */
438  if ( snp->txbuf ) {
440  snp->txbuf = NULL;
441  }
442 
443  /* Discard receive buffer, if applicable */
444  if ( snp->rxbuf ) {
445  free_iob ( snp->rxbuf );
446  snp->rxbuf = NULL;
447  }
448 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:159
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
#define DBGC(...)
Definition: compiler.h:505
#define ECANCELED
Operation canceled.
Definition: errno.h:343
void * priv
Driver private data.
Definition: netdevice.h:425
EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown
static struct net_device * netdev
Definition: gdbudp.c:52
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
An SNP NIC.
Definition: snpnet.c:44
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
Definition: netdevice.c:395
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References DBGC, ECANCELED, EEFI, free_iob(), net_device::name, netdev, netdev_tx_complete_err(), NULL, net_device::priv, rc, _EFI_SIMPLE_NETWORK_PROTOCOL::Shutdown, snp_nic::snp, and strerror().

◆ snpnet_start()

int snpnet_start ( struct efi_device efidev)

Attach driver to device.

Parameters
efidevEFI device
Return values
rcReturn status code

Definition at line 464 of file snpnet.c.

464  {
468  struct net_device *netdev;
469  struct snp_nic *snp;
470  void *interface;
471  EFI_STATUS efirc;
472  int rc;
473 
474  /* Open SNP protocol */
475  if ( ( efirc = bs->OpenProtocol ( device,
480  rc = -EEFI ( efirc );
481  DBGC ( device, "SNP %s cannot open SNP protocol: %s\n",
482  efi_handle_name ( device ), strerror ( rc ) );
485  goto err_open_protocol;
486  }
487 
488  /* Allocate and initialise structure */
489  netdev = alloc_etherdev ( sizeof ( *snp ) );
490  if ( ! netdev ) {
491  rc = -ENOMEM;
492  goto err_alloc;
493  }
495  snp = netdev->priv;
496  snp->efidev = efidev;
497  snp->snp = interface;
498  mode = snp->snp->Mode;
500 
501  /* Populate underlying device information */
502  efi_device_info ( device, "SNP", &snp->dev );
503  snp->dev.driver_name = "SNP";
504  snp->dev.parent = &efidev->dev;
505  list_add ( &snp->dev.siblings, &efidev->dev.children );
506  INIT_LIST_HEAD ( &snp->dev.children );
507  netdev->dev = &snp->dev;
508 
509  /* Bring to the Started state */
510  if ( ( mode->State == EfiSimpleNetworkStopped ) &&
511  ( ( efirc = snp->snp->Start ( snp->snp ) ) != 0 ) ) {
512  rc = -EEFI ( efirc );
513  DBGC ( device, "SNP %s could not start: %s\n",
514  efi_handle_name ( device ), strerror ( rc ) );
515  goto err_start;
516  }
517  if ( ( mode->State == EfiSimpleNetworkInitialized ) &&
518  ( ( efirc = snp->snp->Shutdown ( snp->snp ) ) != 0 ) ) {
519  rc = -EEFI ( efirc );
520  DBGC ( device, "SNP %s could not shut down: %s\n",
521  efi_handle_name ( device ), strerror ( rc ) );
522  goto err_shutdown;
523  }
524 
525  /* Populate network device parameters */
526  if ( mode->HwAddressSize != netdev->ll_protocol->hw_addr_len ) {
527  DBGC ( device, "SNP %s has invalid hardware address length "
528  "%d\n", efi_handle_name ( device ), mode->HwAddressSize);
529  rc = -ENOTSUP;
530  goto err_hw_addr_len;
531  }
534  if ( mode->HwAddressSize != netdev->ll_protocol->ll_addr_len ) {
535  DBGC ( device, "SNP %s has invalid link-layer address length "
536  "%d\n", efi_handle_name ( device ), mode->HwAddressSize);
537  rc = -ENOTSUP;
538  goto err_ll_addr_len;
539  }
540  memcpy ( netdev->ll_addr, &mode->CurrentAddress,
542  snp->mtu = ( snp->snp->Mode->MaxPacketSize +
543  snp->snp->Mode->MediaHeaderSize );
544 
545  /* Register network device */
546  if ( ( rc = register_netdev ( netdev ) ) != 0 )
547  goto err_register_netdev;
548  DBGC ( device, "SNP %s registered as %s\n",
550 
551  /* Set initial link state */
552  if ( snp->snp->Mode->MediaPresentSupported ) {
554  } else {
556  }
557 
558  return 0;
559 
561  err_register_netdev:
562  err_ll_addr_len:
563  err_hw_addr_len:
564  err_shutdown:
565  err_start:
566  list_del ( &snp->dev.siblings );
568  netdev_put ( netdev );
569  err_alloc:
572  err_open_protocol:
573  return rc;
574 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:159
uint8_t ll_addr_len
Link-layer address length.
Definition: netdevice.h:198
UINT32 MediaHeaderSize
The size, in bytes, of the network interface's media header.
#define list_add(new, head)
Add a new entry to the head of a list.
Definition: list.h:69
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
EFI_GUID efi_simple_network_protocol_guid
Simple network protocol GUID.
Definition: efi_guid.c:236
#define DBGC(...)
Definition: compiler.h:505
#define EFI_OPEN_PROTOCOL_BY_DRIVER
Definition: UefiSpec.h:1274
#define EFI_OPEN_PROTOCOL_EXCLUSIVE
Definition: UefiSpec.h:1275
BOOLEAN MediaPresentSupported
TRUE if the presence of media can be determined; otherwise FALSE.
#define DBGC_EFI_OPENERS(...)
Definition: efi.h:262
EFI_HANDLE device
EFI device handle.
Definition: efi_driver.h:21
UINT32 State
Reports the current state of the network interface.
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:1906
EFI_MAC_ADDRESS CurrentAddress
The current HW MAC address for the network interface.
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
EFI_SIMPLE_NETWORK_MODE * Mode
Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition: netdevice.h:498
#define list_del(list)
Delete an entry from a list.
Definition: list.h:119
UINT32 MaxPacketSize
The maximum size, in bytes, of the packets supported by the network interface.
#define ENOMEM
Not enough space.
Definition: errno.h:534
A hardware device.
Definition: device.h:73
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:555
An object interface.
Definition: interface.h:109
uint8_t hw_addr_len
Hardware address length.
Definition: netdevice.h:196
void * priv
Driver private data.
Definition: netdevice.h:425
EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition: netdevice.h:768
static struct net_device * netdev
Definition: gdbudp.c:52
static void snpnet_check_link(struct net_device *netdev)
Check link state.
Definition: snpnet.c:138
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:844
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:713
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI Boot Services Table.
Definition: UefiSpec.h:1836
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:32
int register_netdev(struct net_device *netdev)
Register network device.
Definition: netdevice.c:667
A network device.
Definition: netdevice.h:348
An SNP NIC.
Definition: snpnet.c:44
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition: netdevice.h:511
EFI_SIMPLE_NETWORK_START Start
struct efi_device * efidev
EFI device.
Definition: snpnet.c:46
struct device * dev
Underlying hardware device.
Definition: netdevice.h:360
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:45
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
UINT32 HwAddressSize
The size, in bytes, of the network interface's HW address.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
struct list_head children
Devices attached to this device.
Definition: device.h:83
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition: ethernet.c:264
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1905
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:381
static void efidev_set_drvdata(struct efi_device *efidev, void *priv)
Set EFI driver-private data.
Definition: efi_driver.h:72
struct device dev
Generic device.
Definition: efi_driver.h:19
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
Definition: netdevice.h:375
static struct net_device_operations snpnet_operations
SNP network device operations.
Definition: snpnet.c:451
Definition: efi.h:55
struct ll_protocol * ll_protocol
Link-layer protocol.
Definition: netdevice.h:366
void efi_device_info(EFI_HANDLE device, const char *prefix, struct device *dev)
Get underlying device information.
Definition: efi_utils.c:211
EFI_MAC_ADDRESS PermanentAddress
The permanent HW MAC address for the network interface.

References alloc_etherdev(), EFI_SYSTEM_TABLE::BootServices, device::children, EFI_BOOT_SERVICES::CloseProtocol, EFI_SIMPLE_NETWORK_MODE::CurrentAddress, DBGC, DBGC_EFI_OPENERS, efi_device::dev, net_device::dev, efi_device::device, EEFI, efi_device_info(), efi_handle_name(), efi_image_handle, EFI_OPEN_PROTOCOL_BY_DRIVER, EFI_OPEN_PROTOCOL_EXCLUSIVE, efi_simple_network_protocol_guid, efi_systab, snp_nic::efidev, efidev_set_drvdata(), EfiSimpleNetworkInitialized, EfiSimpleNetworkStopped, ENOMEM, ENOTSUP, net_device::hw_addr, ll_protocol::hw_addr_len, EFI_SIMPLE_NETWORK_MODE::HwAddressSize, INIT_LIST_HEAD, list_add, list_del, net_device::ll_addr, ll_protocol::ll_addr_len, net_device::ll_protocol, EFI_SIMPLE_NETWORK_MODE::MaxPacketSize, EFI_SIMPLE_NETWORK_MODE::MediaHeaderSize, EFI_SIMPLE_NETWORK_MODE::MediaPresentSupported, memcpy(), _EFI_SIMPLE_NETWORK_PROTOCOL::Mode, net_device::name, netdev, netdev_init(), netdev_link_up(), netdev_nullify(), netdev_put(), EFI_BOOT_SERVICES::OpenProtocol, EFI_SIMPLE_NETWORK_MODE::PermanentAddress, net_device::priv, rc, register_netdev(), _EFI_SIMPLE_NETWORK_PROTOCOL::Shutdown, snp_nic::snp, snpnet_check_link(), snpnet_operations, _EFI_SIMPLE_NETWORK_PROTOCOL::Start, EFI_SIMPLE_NETWORK_MODE::State, strerror(), and unregister_netdev().

◆ snpnet_stop()

void snpnet_stop ( struct efi_device efidev)

Detach driver from device.

Parameters
efidevEFI device

Definition at line 581 of file snpnet.c.

581  {
583  struct net_device *netdev = efidev_get_drvdata ( efidev );
584  struct snp_nic *snp = netdev->priv;
586  EFI_STATUS efirc;
587  int rc;
588 
589  /* Unregister network device */
591 
592  /* Stop SNP protocol */
593  if ( ( efirc = snp->snp->Stop ( snp->snp ) ) != 0 ) {
594  rc = -EEFI ( efirc );
595  DBGC ( device, "SNP %s could not stop: %s\n",
596  efi_handle_name ( device ), strerror ( rc ) );
597  /* Nothing we can do about this */
598  }
599 
600  /* Free network device */
601  list_del ( &snp->dev.siblings );
603  netdev_put ( netdev );
604 
605  /* Close SNP protocol */
608 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:159
EFI_SIMPLE_NETWORK_PROTOCOL * snp
Simple network protocol.
Definition: snpnet.c:48
EFI_GUID efi_simple_network_protocol_guid
Simple network protocol GUID.
Definition: efi_guid.c:236
#define DBGC(...)
Definition: compiler.h:505
EFI_HANDLE device
EFI device handle.
Definition: efi_driver.h:21
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:1906
#define list_del(list)
Delete an entry from a list.
Definition: list.h:119
A hardware device.
Definition: device.h:73
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:555
void * priv
Driver private data.
Definition: netdevice.h:425
static struct net_device * netdev
Definition: gdbudp.c:52
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:844
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:713
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI Boot Services Table.
Definition: UefiSpec.h:1836
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:32
static void * efidev_get_drvdata(struct efi_device *efidev)
Get EFI driver-private data.
Definition: efi_driver.h:83
A network device.
Definition: netdevice.h:348
An SNP NIC.
Definition: snpnet.c:44
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition: netdevice.h:511
struct efi_device * efidev
EFI device.
Definition: snpnet.c:46
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
EFI_SYSTEM_TABLE * efi_systab
EFI_SIMPLE_NETWORK_STOP Stop
Definition: efi.h:55

References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseProtocol, DBGC, efi_device::device, EEFI, efi_handle_name(), efi_image_handle, efi_simple_network_protocol_guid, efi_systab, snp_nic::efidev, efidev_get_drvdata(), list_del, netdev, netdev_nullify(), netdev_put(), net_device::priv, rc, snp_nic::snp, _EFI_SIMPLE_NETWORK_PROTOCOL::Stop, strerror(), and unregister_netdev().

Variable Documentation

◆ snpnet_operations

struct net_device_operations snpnet_operations
static
Initial value:
= {
.open = snpnet_open,
.close = snpnet_close,
.transmit = snpnet_transmit,
.poll = snpnet_poll,
}
static void snpnet_poll(struct net_device *netdev)
Poll for completed packets.
Definition: snpnet.c:284
static int snpnet_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition: snpnet.c:161
static void snpnet_close(struct net_device *netdev)
Close network device.
Definition: snpnet.c:424
static int snpnet_open(struct net_device *netdev)
Open network device.
Definition: snpnet.c:342

SNP network device operations.

Definition at line 451 of file snpnet.c.

Referenced by snpnet_start().