iPXE
Data Structures | Functions | Variables
aoe.c File Reference

AoE protocol. More...

#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>
#include <ipxe/list.h>
#include <ipxe/if_ether.h>
#include <ipxe/iobuf.h>
#include <ipxe/uaccess.h>
#include <ipxe/netdevice.h>
#include <ipxe/features.h>
#include <ipxe/interface.h>
#include <ipxe/xfer.h>
#include <ipxe/uri.h>
#include <ipxe/open.h>
#include <ipxe/ata.h>
#include <ipxe/device.h>
#include <ipxe/efi/efi_path.h>
#include <ipxe/aoe.h>

Go to the source code of this file.

Data Structures

struct  aoe_command
 An AoE command. More...
 
struct  aoe_command_type
 An AoE command type. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
 FEATURE (FEATURE_PROTOCOL, "AoE", DHCP_EB_FEATURE_AOE, 1)
 
static LIST_HEAD (aoe_devices)
 List of all AoE devices. More...
 
static LIST_HEAD (aoe_commands)
 List of active AoE commands. More...
 
static struct aoe_deviceaoedev_get (struct aoe_device *aoedev)
 Get reference to AoE device. More...
 
static void aoedev_put (struct aoe_device *aoedev)
 Drop reference to AoE device. More...
 
static struct aoe_commandaoecmd_get (struct aoe_command *aoecmd)
 Get reference to AoE command. More...
 
static void aoecmd_put (struct aoe_command *aoecmd)
 Drop reference to AoE command. More...
 
static const char * aoedev_name (struct aoe_device *aoedev)
 Name AoE device. More...
 
static void aoecmd_free (struct refcnt *refcnt)
 Free AoE command. More...
 
static void aoecmd_close (struct aoe_command *aoecmd, int rc)
 Close AoE command. More...
 
static int aoecmd_tx (struct aoe_command *aoecmd)
 Transmit AoE command request. More...
 
static int aoecmd_rx (struct aoe_command *aoecmd, struct io_buffer *iobuf, const void *ll_source)
 Receive AoE command response. More...
 
static void aoecmd_expired (struct retry_timer *timer, int fail)
 Handle AoE retry timer expiry. More...
 
static size_t aoecmd_ata_cmd_len (struct aoe_command *aoecmd)
 Calculate length of AoE ATA command IU. More...
 
static void aoecmd_ata_cmd (struct aoe_command *aoecmd, void *data, size_t len)
 Build AoE ATA command IU. More...
 
static int aoecmd_ata_rsp (struct aoe_command *aoecmd, const void *data, size_t len, const void *ll_source __unused)
 Handle AoE ATA response IU. More...
 
static size_t aoecmd_cfg_cmd_len (struct aoe_command *aoecmd __unused)
 Calculate length of AoE configuration command IU. More...
 
static void aoecmd_cfg_cmd (struct aoe_command *aoecmd, void *data, size_t len)
 Build AoE configuration command IU. More...
 
static int aoecmd_cfg_rsp (struct aoe_command *aoecmd, const void *data, size_t len, const void *ll_source)
 Handle AoE configuration response IU. More...
 
static struct aoe_commandaoecmd_find_tag (uint32_t tag)
 Identify AoE command by tag. More...
 
static int aoecmd_new_tag (void)
 Choose an AoE command tag. More...
 
static struct aoe_commandaoecmd_create (struct aoe_device *aoedev, struct aoe_command_type *type)
 Create AoE command. More...
 
static int aoedev_ata_command (struct aoe_device *aoedev, struct interface *parent, struct ata_cmd *command)
 Issue AoE ATA command. More...
 
static int aoedev_cfg_command (struct aoe_device *aoedev, struct interface *parent)
 Issue AoE configuration command. More...
 
static void aoedev_free (struct refcnt *refcnt)
 Free AoE device. More...
 
static void aoedev_close (struct aoe_device *aoedev, int rc)
 Close AoE device. More...
 
static size_t aoedev_window (struct aoe_device *aoedev)
 Check AoE device flow-control window. More...
 
static void aoedev_config_done (struct aoe_device *aoedev, int rc)
 Handle AoE device configuration completion. More...
 
static struct deviceaoedev_identify_device (struct aoe_device *aoedev)
 Identify device underlying AoE device. More...
 
static struct acpi_descriptoraoedev_describe (struct aoe_device *aoedev)
 Get AoE ACPI descriptor. More...
 
static int aoedev_open (struct interface *parent, struct net_device *netdev, unsigned int major, unsigned int minor)
 Open AoE device. More...
 
static int aoe_rx (struct io_buffer *iobuf, struct net_device *netdev __unused, const void *ll_dest __unused, const void *ll_source, unsigned int flags __unused)
 Process incoming AoE packets. More...
 
static int aoe_parse_uri (struct uri *uri, unsigned int *major, unsigned int *minor)
 Parse AoE URI. More...
 
static int aoe_open (struct interface *parent, struct uri *uri)
 Open AoE URI. More...
 
static int abft_complete (struct acpi_descriptor *desc __unused)
 Check if AoE boot firmware table descriptor is complete. More...
 
static int abft_install (int(*install)(struct acpi_header *acpi))
 Install AoE boot firmware table(s) More...
 

Variables

struct net_protocol aoe_protocol __net_protocol
 AoE protocol. More...
 
struct acpi_model abft_model __acpi_model
 aBFT model More...
 
static struct aoe_command_type aoecmd_ata
 AoE ATA command. More...
 
static struct aoe_command_type aoecmd_cfg
 AoE configuration command. More...
 
static struct interface_operation aoecmd_ata_op []
 AoE command ATA interface operations. More...
 
static struct interface_descriptor aoecmd_ata_desc
 AoE command ATA interface descriptor. More...
 
static struct interface_operation aoedev_ata_op []
 AoE device ATA interface operations. More...
 
static struct interface_descriptor aoedev_ata_desc
 AoE device ATA interface descriptor. More...
 
static struct interface_operation aoedev_config_op []
 AoE device configuration interface operations. More...
 
static struct interface_descriptor aoedev_config_desc
 AoE device configuration interface descriptor. More...
 
struct uri_opener aoe_uri_opener __uri_opener
 AoE URI opener. More...
 

Detailed Description

AoE protocol.

Definition in file aoe.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ FEATURE()

FEATURE ( FEATURE_PROTOCOL  ,
"AoE"  ,
DHCP_EB_FEATURE_AOE  ,
 
)

◆ LIST_HEAD() [1/2]

static LIST_HEAD ( aoe_devices  )
static

List of all AoE devices.

◆ LIST_HEAD() [2/2]

static LIST_HEAD ( aoe_commands  )
static

List of active AoE commands.

◆ aoedev_get()

static struct aoe_device* aoedev_get ( struct aoe_device aoedev)
inlinestatic

Get reference to AoE device.

Parameters
aoedevAoE device
Return values
aoedevAoE device

Definition at line 132 of file aoe.c.

132  {
133  ref_get ( &aoedev->refcnt );
134  return aoedev;
135 }
#define ref_get(refcnt)
Get additional reference to object.
Definition: refcnt.h:92
struct refcnt refcnt
Reference counter.
Definition: aoe.h:117

References ref_get, and aoe_device::refcnt.

Referenced by aoecmd_create().

◆ aoedev_put()

static void aoedev_put ( struct aoe_device aoedev)
inlinestatic

Drop reference to AoE device.

Parameters
aoedevAoE device

Definition at line 143 of file aoe.c.

143  {
144  ref_put ( &aoedev->refcnt );
145 }
struct refcnt refcnt
Reference counter.
Definition: aoe.h:117
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106

References ref_put, and aoe_device::refcnt.

Referenced by aoecmd_free().

◆ aoecmd_get()

static struct aoe_command* aoecmd_get ( struct aoe_command aoecmd)
inlinestatic

Get reference to AoE command.

Parameters
aoecmdAoE command
Return values
aoecmdAoE command

Definition at line 154 of file aoe.c.

154  {
155  ref_get ( &aoecmd->refcnt );
156  return aoecmd;
157 }
An AoE command.
Definition: aoe.h:62
#define ref_get(refcnt)
Get additional reference to object.
Definition: refcnt.h:92

References ref_get.

Referenced by aoe_rx(), and aoedev_close().

◆ aoecmd_put()

static void aoecmd_put ( struct aoe_command aoecmd)
inlinestatic

Drop reference to AoE command.

Parameters
aoecmdAoE command

Definition at line 165 of file aoe.c.

165  {
166  ref_put ( &aoecmd->refcnt );
167 }
An AoE command.
Definition: aoe.h:62
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106

References ref_put.

Referenced by aoe_rx(), aoecmd_close(), and aoedev_close().

◆ aoedev_name()

static const char* aoedev_name ( struct aoe_device aoedev)
static

Name AoE device.

Parameters
aoedevAoE device
Return values
nameAoE device name

Definition at line 175 of file aoe.c.

175  {
176  static char buf[16];
177 
178  snprintf ( buf, sizeof ( buf ), "%s/e%d.%d", aoedev->netdev->name,
179  aoedev->major, aoedev->minor );
180  return buf;
181 }
uint16_t major
Major number.
Definition: aoe.h:125
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
uint8_t minor
Minor number.
Definition: aoe.h:127
struct net_device * netdev
Network device.
Definition: aoe.h:120
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:382

References aoe_command::aoedev, aoe_device::major, aoe_device::minor, net_device::name, aoe_device::netdev, and snprintf().

Referenced by abft_install(), aoecmd_ata_cmd(), aoecmd_ata_rsp(), aoecmd_cfg_cmd(), aoecmd_cfg_rsp(), aoecmd_rx(), aoecmd_tx(), aoedev_ata_command(), and aoedev_open().

◆ aoecmd_free()

static void aoecmd_free ( struct refcnt refcnt)
static

Free AoE command.

Parameters
refcntReference counter

Definition at line 188 of file aoe.c.

188  {
189  struct aoe_command *aoecmd =
190  container_of ( refcnt, struct aoe_command, refcnt );
191 
192  assert ( ! timer_running ( &aoecmd->timer ) );
193  assert ( list_empty ( &aoecmd->list ) );
194 
195  aoedev_put ( aoecmd->aoedev );
196  free ( aoecmd );
197 }
A reference counter.
Definition: refcnt.h:26
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:136
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
An AoE command.
Definition: aoe.h:62
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
static void aoedev_put(struct aoe_device *aoedev)
Drop reference to AoE device.
Definition: aoe.c:143
An AoE command.
Definition: aoe.c:73

References aoedev_put(), assert(), container_of, free, and list_empty.

Referenced by aoecmd_create().

◆ aoecmd_close()

static void aoecmd_close ( struct aoe_command aoecmd,
int  rc 
)
static

Close AoE command.

Parameters
aoecmdAoE command
rcReason for close

Definition at line 205 of file aoe.c.

205  {
206  struct aoe_device *aoedev = aoecmd->aoedev;
207 
208  /* Stop timer */
209  stop_timer ( &aoecmd->timer );
210 
211  /* Preserve the timeout value for subsequent commands */
212  aoedev->timeout = aoecmd->timer.timeout;
213 
214  /* Remove from list of commands */
215  if ( ! list_empty ( &aoecmd->list ) ) {
216  list_del ( &aoecmd->list );
217  INIT_LIST_HEAD ( &aoecmd->list );
218  aoecmd_put ( aoecmd );
219  }
220 
221  /* Shut down interfaces */
222  intf_shutdown ( &aoecmd->ata, rc );
223 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:278
unsigned long timeout
Saved timeout value.
Definition: aoe.h:132
An AoE device.
Definition: aoe.h:115
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:136
#define list_del(list)
Delete an entry from a list.
Definition: list.h:119
An AoE command.
Definition: aoe.h:62
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:45
void stop_timer(struct retry_timer *timer)
Stop timer.
Definition: retry.c:117
static void aoecmd_put(struct aoe_command *aoecmd)
Drop reference to AoE command.
Definition: aoe.c:165
struct aoeata ata
ATA command.
Definition: aoe.h:66

References aoecmd_put(), aoecmd::ata, INIT_LIST_HEAD, intf_shutdown(), list_del, list_empty, rc, stop_timer(), and aoe_device::timeout.

Referenced by aoecmd_expired(), aoecmd_rx(), and aoedev_close().

◆ aoecmd_tx()

static int aoecmd_tx ( struct aoe_command aoecmd)
static

Transmit AoE command request.

Parameters
aoecmdAoE command
Return values
rcReturn status code

Definition at line 231 of file aoe.c.

231  {
232  struct aoe_device *aoedev = aoecmd->aoedev;
233  struct net_device *netdev = aoedev->netdev;
234  struct io_buffer *iobuf;
235  struct aoehdr *aoehdr;
236  size_t cmd_len;
237  int rc;
238 
239  /* Sanity check */
240  assert ( netdev != NULL );
241 
242  /* If we are transmitting anything that requires a response,
243  * start the retransmission timer. Do this before attempting
244  * to allocate the I/O buffer, in case allocation itself
245  * fails.
246  */
247  start_timer ( &aoecmd->timer );
248 
249  /* Create outgoing I/O buffer */
250  cmd_len = aoecmd->type->cmd_len ( aoecmd );
251  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + cmd_len );
252  if ( ! iobuf )
253  return -ENOMEM;
254  iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
255  aoehdr = iob_put ( iobuf, cmd_len );
256 
257  /* Fill AoE header */
258  memset ( aoehdr, 0, sizeof ( *aoehdr ) );
260  aoehdr->major = htons ( aoedev->major );
261  aoehdr->minor = aoedev->minor;
262  aoehdr->tag = htonl ( aoecmd->tag );
263  aoecmd->type->cmd ( aoecmd, iobuf->data, iob_len ( iobuf ) );
264 
265  /* Send packet */
266  if ( ( rc = net_tx ( iobuf, netdev, &aoe_protocol, aoedev->target,
267  netdev->ll_addr ) ) != 0 ) {
268  DBGC ( aoedev, "AoE %s/%08x could not transmit: %s\n",
269  aoedev_name ( aoedev ), aoecmd->tag,
270  strerror ( rc ) );
271  return rc;
272  }
273 
274  return 0;
275 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:120
uint16_t major
Major number.
Definition: aoe.h:125
#define DBGC(...)
Definition: compiler.h:505
uint16_t major
Major device number, in network byte order.
Definition: aoe.h:76
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:129
#define htonl(value)
Definition: byteswap.h:133
An AoE device.
Definition: aoe.h:115
#define ENOMEM
Not enough space.
Definition: errno.h:534
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define AOE_VERSION
Version 1.
Definition: aoe.h:87
static struct net_device * netdev
Definition: gdbudp.c:52
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
Definition: netdevice.h:45
uint8_t minor
Minor device number.
Definition: aoe.h:78
An AoE command.
Definition: aoe.h:62
uint8_t target[MAX_LL_ADDR_LEN]
Target MAC address.
Definition: aoe.h:129
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:155
uint32_t tag
Tag, in network byte order.
Definition: aoe.h:82
A network device.
Definition: netdevice.h:352
void start_timer(struct retry_timer *timer)
Start timer.
Definition: retry.c:93
#define iob_reserve(iobuf, len)
Definition: iobuf.h:67
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
Definition: netdevice.c:1073
void * data
Start of data.
Definition: iobuf.h:48
uint8_t minor
Minor number.
Definition: aoe.h:127
struct net_device * netdev
Network device.
Definition: aoe.h:120
uint8_t ver_flags
Protocol version number and flags.
Definition: aoe.h:72
An AoE header.
Definition: aoe.h:70
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define htons(value)
Definition: byteswap.h:135
void * memset(void *dest, int character, size_t len) __nonnull
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:175
A persistent I/O buffer.
Definition: iobuf.h:33

References alloc_iob(), AOE_VERSION, aoedev_name(), assert(), io_buffer::data, DBGC, ENOMEM, htonl, htons, iob_len(), iob_put, iob_reserve, net_device::ll_addr, aoehdr::major, aoe_device::major, MAX_LL_HEADER_LEN, memset(), aoehdr::minor, aoe_device::minor, net_tx(), netdev, aoe_device::netdev, NULL, rc, start_timer(), strerror(), aoehdr::tag, aoe_device::target, and aoehdr::ver_flags.

Referenced by aoecmd_expired(), aoedev_ata_command(), and aoedev_cfg_command().

◆ aoecmd_rx()

static int aoecmd_rx ( struct aoe_command aoecmd,
struct io_buffer iobuf,
const void *  ll_source 
)
static

Receive AoE command response.

Parameters
aoecmdAoE command
iobufI/O buffer
ll_sourceLink-layer source address
Return values
rcReturn status code

Definition at line 285 of file aoe.c.

286  {
287  struct aoe_device *aoedev = aoecmd->aoedev;
288  struct aoehdr *aoehdr = iobuf->data;
289  int rc;
290 
291  /* Sanity check */
292  if ( iob_len ( iobuf ) < sizeof ( *aoehdr ) ) {
293  DBGC ( aoedev, "AoE %s/%08x received underlength response "
294  "(%zd bytes)\n", aoedev_name ( aoedev ),
295  aoecmd->tag, iob_len ( iobuf ) );
296  rc = -EINVAL;
297  goto done;
298  }
299  if ( ( ntohs ( aoehdr->major ) != aoedev->major ) ||
300  ( aoehdr->minor != aoedev->minor ) ) {
301  DBGC ( aoedev, "AoE %s/%08x received response for incorrect "
302  "device e%d.%d\n", aoedev_name ( aoedev ), aoecmd->tag,
303  ntohs ( aoehdr->major ), aoehdr->minor );
304  rc = -EINVAL;
305  goto done;
306  }
307 
308  /* Catch command failures */
309  if ( aoehdr->ver_flags & AOE_FL_ERROR ) {
310  DBGC ( aoedev, "AoE %s/%08x terminated in error\n",
311  aoedev_name ( aoedev ), aoecmd->tag );
312  aoecmd_close ( aoecmd, -EIO );
313  rc = -EIO;
314  goto done;
315  }
316 
317  /* Hand off to command completion handler */
318  if ( ( rc = aoecmd->type->rsp ( aoecmd, iobuf->data, iob_len ( iobuf ),
319  ll_source ) ) != 0 )
320  goto done;
321 
322  done:
323  /* Free I/O buffer */
324  free_iob ( iobuf );
325 
326  /* Terminate command */
327  aoecmd_close ( aoecmd, rc );
328 
329  return rc;
330 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
uint16_t major
Major number.
Definition: aoe.h:125
#define DBGC(...)
Definition: compiler.h:505
uint16_t major
Major device number, in network byte order.
Definition: aoe.h:76
#define ntohs(value)
Definition: byteswap.h:136
An AoE device.
Definition: aoe.h:115
uint8_t minor
Minor device number.
Definition: aoe.h:78
An AoE command.
Definition: aoe.h:62
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:155
void * data
Start of data.
Definition: iobuf.h:48
#define EIO
Input/output error.
Definition: errno.h:433
uint8_t minor
Minor number.
Definition: aoe.h:127
uint8_t ver_flags
Protocol version number and flags.
Definition: aoe.h:72
#define AOE_FL_ERROR
Command generated an error.
Definition: aoe.h:91
static void aoecmd_close(struct aoe_command *aoecmd, int rc)
Close AoE command.
Definition: aoe.c:205
An AoE header.
Definition: aoe.h:70
struct bofm_section_header done
Definition: bofm_test.c:46
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:175

References AOE_FL_ERROR, aoecmd_close(), aoedev_name(), io_buffer::data, DBGC, done, EINVAL, EIO, free_iob(), iob_len(), aoehdr::major, aoe_device::major, aoehdr::minor, aoe_device::minor, ntohs, rc, and aoehdr::ver_flags.

Referenced by aoe_rx().

◆ aoecmd_expired()

static void aoecmd_expired ( struct retry_timer timer,
int  fail 
)
static

Handle AoE retry timer expiry.

Parameters
timerAoE retry timer
failFailure indicator

Definition at line 338 of file aoe.c.

338  {
339  struct aoe_command *aoecmd =
340  container_of ( timer, struct aoe_command, timer );
341 
342  if ( fail ) {
344  } else {
345  aoecmd_tx ( aoecmd );
346  }
347 }
static int aoecmd_tx(struct aoe_command *aoecmd)
Transmit AoE command request.
Definition: aoe.c:231
A timer.
Definition: timer.h:28
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
An AoE command.
Definition: aoe.h:62
static void aoecmd_close(struct aoe_command *aoecmd, int rc)
Close AoE command.
Definition: aoe.c:205
An AoE command.
Definition: aoe.c:73
#define ETIMEDOUT
Connection timed out.
Definition: errno.h:669

References aoecmd_close(), aoecmd_tx(), container_of, and ETIMEDOUT.

Referenced by aoecmd_create().

◆ aoecmd_ata_cmd_len()

static size_t aoecmd_ata_cmd_len ( struct aoe_command aoecmd)
static

Calculate length of AoE ATA command IU.

Parameters
aoecmdAoE command
Return values
lenLength of command IU

Definition at line 355 of file aoe.c.

355  {
356  struct ata_cmd *command = &aoecmd->command;
357 
358  return ( sizeof ( struct aoehdr ) + sizeof ( struct aoeata ) +
359  command->data_out_len );
360 }
An AoE ATA command.
Definition: aoe.h:38
A command-line command.
Definition: command.h:9
An ATA command information unit.
Definition: ata.h:168
An AoE command.
Definition: aoe.h:62
An AoE header.
Definition: aoe.h:70

◆ aoecmd_ata_cmd()

static void aoecmd_ata_cmd ( struct aoe_command aoecmd,
void *  data,
size_t  len 
)
static

Build AoE ATA command IU.

Parameters
aoecmdAoE command
dataCommand IU
lenLength of command IU

Definition at line 369 of file aoe.c.

370  {
371  struct aoe_device *aoedev = aoecmd->aoedev;
372  struct ata_cmd *command = &aoecmd->command;
373  struct aoehdr *aoehdr = data;
374  struct aoeata *aoeata = &aoehdr->payload[0].ata;
375 
376  /* Sanity check */
378  assert ( len == ( sizeof ( *aoehdr ) + sizeof ( *aoeata ) +
379  command->data_out_len ) );
380 
381  /* Build IU */
383  memset ( aoeata, 0, sizeof ( *aoeata ) );
384  aoeata->aflags = ( ( command->cb.lba48 ? AOE_FL_EXTENDED : 0 ) |
385  ( command->cb.device & ATA_DEV_SLAVE ) |
386  ( command->data_out_len ? AOE_FL_WRITE : 0 ) );
387  aoeata->err_feat = command->cb.err_feat.bytes.cur;
388  aoeata->count = command->cb.count.native;
389  aoeata->cmd_stat = command->cb.cmd_stat;
390  aoeata->lba.u64 = cpu_to_le64 ( command->cb.lba.native );
391  if ( ! command->cb.lba48 )
392  aoeata->lba.bytes[3] |=
393  ( command->cb.device & ATA_DEV_MASK );
394  copy_from_user ( aoeata->data, command->data_out, 0,
395  command->data_out_len );
396 
397  DBGC2 ( aoedev, "AoE %s/%08x ATA cmd %02x:%02x:%02x:%02x:%08llx",
398  aoedev_name ( aoedev ), aoecmd->tag, aoeata->aflags,
400  aoeata->lba.u64 );
401  if ( command->data_out_len )
402  DBGC2 ( aoedev, " out %04zx", command->data_out_len );
403  if ( command->data_in_len )
404  DBGC2 ( aoedev, " in %04zx", command->data_in_len );
405  DBGC2 ( aoedev, "\n" );
406 }
uint8_t err_feat
ATA error/feature register.
Definition: aoe.h:42
An AoE ATA command.
Definition: aoe.h:38
A command-line command.
Definition: command.h:9
uint8_t bytes[6]
Definition: aoe.h:50
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
Definition: uaccess.h:337
uint8_t data[0]
Data payload.
Definition: aoe.h:53
union aoecmd payload[0]
Payload.
Definition: aoe.h:84
#define cpu_to_le64(value)
Definition: byteswap.h:108
#define static_assert(x)
Assert a condition at build time.
Definition: assert.h:65
uint8_t cmd_stat
ATA command/status register.
Definition: aoe.h:46
An AoE device.
Definition: aoe.h:115
uint8_t command
Command number.
Definition: aoe.h:80
#define AOE_FL_WRITE
Write command.
Definition: aoe.h:59
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
union aoeata::@445 lba
Logical block address, in little-endian order.
An ATA command information unit.
Definition: ata.h:168
An AoE command.
Definition: aoe.h:62
uint8_t aflags
AoE command flags.
Definition: aoe.h:40
uint64_t u64
Definition: aoe.h:49
uint32_t len
Length.
Definition: ena.h:14
#define DBGC2(...)
Definition: compiler.h:522
uint8_t count
ATA sector count register.
Definition: aoe.h:44
uint8_t data[48]
Additional event data.
Definition: ena.h:22
struct aoeata ata
ATA command.
Definition: aoe.h:66
#define AOE_CMD_ATA
Issue ATA command.
Definition: aoe.h:96
An AoE header.
Definition: aoe.h:70
#define AOE_FL_EXTENDED
LBA48 extended addressing.
Definition: aoe.h:56
#define ATA_DEV_SLAVE
Slave ("device 1") flag in the ATA device register.
Definition: ata.h:117
#define ATA_DEV_MASK
Mask of non-LBA portion of device register.
Definition: ata.h:123
#define AOE_FL_DEV_HEAD
Device/head flag.
Definition: aoe.h:57
void * memset(void *dest, int character, size_t len) __nonnull
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:175

References aoeata::aflags, AOE_CMD_ATA, AOE_FL_DEV_HEAD, AOE_FL_EXTENDED, AOE_FL_WRITE, aoedev_name(), assert(), aoecmd::ata, ATA_DEV_MASK, ATA_DEV_SLAVE, aoeata::bytes, aoeata::cmd_stat, aoehdr::command, copy_from_user(), aoeata::count, cpu_to_le64, data, aoeata::data, DBGC2, aoeata::err_feat, aoeata::lba, len, memset(), aoehdr::payload, static_assert, and aoeata::u64.

◆ aoecmd_ata_rsp()

static int aoecmd_ata_rsp ( struct aoe_command aoecmd,
const void *  data,
size_t  len,
const void *ll_source  __unused 
)
static

Handle AoE ATA response IU.

Parameters
aoecmdAoE command
dataResponse IU
lenLength of response IU
ll_sourceLink-layer source address
Return values
rcReturn status code

Definition at line 417 of file aoe.c.

418  {
419  struct aoe_device *aoedev = aoecmd->aoedev;
420  struct ata_cmd *command = &aoecmd->command;
421  const struct aoehdr *aoehdr = data;
422  const struct aoeata *aoeata = &aoehdr->payload[0].ata;
423  size_t data_len;
424 
425  /* Sanity check */
426  if ( len < ( sizeof ( *aoehdr ) + sizeof ( *aoeata ) ) ) {
427  DBGC ( aoedev, "AoE %s/%08x received underlength ATA response "
428  "(%zd bytes)\n", aoedev_name ( aoedev ),
429  aoecmd->tag, len );
430  return -EINVAL;
431  }
432  data_len = ( len - ( sizeof ( *aoehdr ) + sizeof ( *aoeata ) ) );
433  DBGC2 ( aoedev, "AoE %s/%08x ATA rsp %02x in %04zx\n",
434  aoedev_name ( aoedev ), aoecmd->tag, aoeata->cmd_stat,
435  data_len );
436 
437  /* Check for command failure */
438  if ( aoeata->cmd_stat & ATA_STAT_ERR ) {
439  DBGC ( aoedev, "AoE %s/%08x status %02x\n",
440  aoedev_name ( aoedev ), aoecmd->tag, aoeata->cmd_stat );
441  return -EIO;
442  }
443 
444  /* Check data-in length is sufficient. (There may be trailing
445  * garbage due to Ethernet minimum-frame-size padding.)
446  */
447  if ( data_len < command->data_in_len ) {
448  DBGC ( aoedev, "AoE %s/%08x data-in underrun (received %zd, "
449  "expected %zd)\n", aoedev_name ( aoedev ), aoecmd->tag,
450  data_len, command->data_in_len );
451  return -ERANGE;
452  }
453 
454  /* Copy out data payload */
455  copy_to_user ( command->data_in, 0, aoeata->data,
456  command->data_in_len );
457 
458  return 0;
459 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
An AoE ATA command.
Definition: aoe.h:38
A command-line command.
Definition: command.h:9
uint8_t data[0]
Data payload.
Definition: aoe.h:53
#define DBGC(...)
Definition: compiler.h:505
union aoecmd payload[0]
Payload.
Definition: aoe.h:84
uint32_t data_len
Microcode data size (or 0 to indicate 2000 bytes)
Definition: ucode.h:26
uint8_t cmd_stat
ATA command/status register.
Definition: aoe.h:46
An AoE device.
Definition: aoe.h:115
An ATA command information unit.
Definition: ata.h:168
An AoE command.
Definition: aoe.h:62
#define ERANGE
Result too large.
Definition: errno.h:639
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
Definition: uaccess.h:324
#define ATA_STAT_ERR
Command completed in error.
Definition: ata.h:141
uint32_t len
Length.
Definition: ena.h:14
#define DBGC2(...)
Definition: compiler.h:522
#define EIO
Input/output error.
Definition: errno.h:433
uint8_t data[48]
Additional event data.
Definition: ena.h:22
struct aoeata ata
ATA command.
Definition: aoe.h:66
An AoE header.
Definition: aoe.h:70
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:175

References aoedev_name(), aoecmd::ata, ATA_STAT_ERR, aoeata::cmd_stat, copy_to_user(), data, aoeata::data, data_len, DBGC, DBGC2, EINVAL, EIO, ERANGE, len, and aoehdr::payload.

◆ aoecmd_cfg_cmd_len()

static size_t aoecmd_cfg_cmd_len ( struct aoe_command *aoecmd  __unused)
static

Calculate length of AoE configuration command IU.

Parameters
aoecmdAoE command
Return values
lenLength of command IU

Definition at line 474 of file aoe.c.

474  {
475  return ( sizeof ( struct aoehdr ) + sizeof ( struct aoecfg ) );
476 }
An AoE config command.
Definition: aoe.h:22
An AoE header.
Definition: aoe.h:70

◆ aoecmd_cfg_cmd()

static void aoecmd_cfg_cmd ( struct aoe_command aoecmd,
void *  data,
size_t  len 
)
static

Build AoE configuration command IU.

Parameters
aoecmdAoE command
dataCommand IU
lenLength of command IU

Definition at line 485 of file aoe.c.

486  {
487  struct aoe_device *aoedev = aoecmd->aoedev;
488  struct aoehdr *aoehdr = data;
489  struct aoecfg *aoecfg = &aoehdr->payload[0].cfg;
490 
491  /* Sanity check */
492  assert ( len == ( sizeof ( *aoehdr ) + sizeof ( *aoecfg ) ) );
493 
494  /* Build IU */
496  memset ( aoecfg, 0, sizeof ( *aoecfg ) );
497 
498  DBGC ( aoedev, "AoE %s/%08x CONFIG cmd\n",
499  aoedev_name ( aoedev ), aoecmd->tag );
500 }
struct aoecfg cfg
Config command.
Definition: aoe.h:64
#define DBGC(...)
Definition: compiler.h:505
union aoecmd payload[0]
Payload.
Definition: aoe.h:84
An AoE device.
Definition: aoe.h:115
uint8_t command
Command number.
Definition: aoe.h:80
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An AoE command.
Definition: aoe.h:62
An AoE config command.
Definition: aoe.h:22
#define AOE_CMD_CONFIG
Query Config Information.
Definition: aoe.h:97
uint32_t len
Length.
Definition: ena.h:14
uint8_t data[48]
Additional event data.
Definition: ena.h:22
An AoE header.
Definition: aoe.h:70
void * memset(void *dest, int character, size_t len) __nonnull
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:175

References AOE_CMD_CONFIG, aoedev_name(), assert(), aoecmd::cfg, aoehdr::command, data, DBGC, len, memset(), and aoehdr::payload.

◆ aoecmd_cfg_rsp()

static int aoecmd_cfg_rsp ( struct aoe_command aoecmd,
const void *  data,
size_t  len,
const void *  ll_source 
)
static

Handle AoE configuration response IU.

Parameters
aoecmdAoE command
dataResponse IU
lenLength of response IU
ll_sourceLink-layer source address
Return values
rcReturn status code

Definition at line 511 of file aoe.c.

512  {
513  struct aoe_device *aoedev = aoecmd->aoedev;
514  struct ll_protocol *ll_protocol = aoedev->netdev->ll_protocol;
515  const struct aoehdr *aoehdr = data;
516  const struct aoecfg *aoecfg = &aoehdr->payload[0].cfg;
517 
518  /* Sanity check */
519  if ( len < ( sizeof ( *aoehdr ) + sizeof ( *aoecfg ) ) ) {
520  DBGC ( aoedev, "AoE %s/%08x received underlength "
521  "configuration response (%zd bytes)\n",
522  aoedev_name ( aoedev ), aoecmd->tag, len );
523  return -EINVAL;
524  }
525  DBGC ( aoedev, "AoE %s/%08x CONFIG rsp buf %04x fw %04x scnt %02x\n",
526  aoedev_name ( aoedev ), aoecmd->tag, ntohs ( aoecfg->bufcnt ),
527  aoecfg->fwver, aoecfg->scnt );
528 
529  /* Record target MAC address */
530  memcpy ( aoedev->target, ll_source, ll_protocol->ll_addr_len );
531  DBGC ( aoedev, "AoE %s has MAC address %s\n",
532  aoedev_name ( aoedev ), ll_protocol->ntoa ( aoedev->target ) );
533 
534  return 0;
535 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct aoecfg cfg
Config command.
Definition: aoe.h:64
uint8_t ll_addr_len
Link-layer address length.
Definition: netdevice.h:198
#define DBGC(...)
Definition: compiler.h:505
union aoecmd payload[0]
Payload.
Definition: aoe.h:84
uint16_t fwver
ATA target firmware version.
Definition: aoe.h:26
#define ntohs(value)
Definition: byteswap.h:136
A link-layer protocol.
Definition: netdevice.h:114
An AoE device.
Definition: aoe.h:115
void * memcpy(void *dest, const void *src, size_t len) __nonnull
An AoE command.
Definition: aoe.h:62
uint8_t target[MAX_LL_ADDR_LEN]
Target MAC address.
Definition: aoe.h:129
An AoE config command.
Definition: aoe.h:22
uint16_t bufcnt
AoE queue depth.
Definition: aoe.h:24
uint32_t len
Length.
Definition: ena.h:14
struct net_device * netdev
Network device.
Definition: aoe.h:120
uint8_t data[48]
Additional event data.
Definition: ena.h:22
const char *(* ntoa)(const void *ll_addr)
Transcribe link-layer address.
Definition: netdevice.h:163
uint8_t scnt
ATA target sector count.
Definition: aoe.h:28
An AoE header.
Definition: aoe.h:70
struct ll_protocol * ll_protocol
Link-layer protocol.
Definition: netdevice.h:372
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:175

References aoedev_name(), aoecfg::bufcnt, aoecmd::cfg, data, DBGC, EINVAL, aoecfg::fwver, len, ll_protocol::ll_addr_len, net_device::ll_protocol, memcpy(), aoe_device::netdev, ll_protocol::ntoa, ntohs, aoehdr::payload, aoecfg::scnt, and aoe_device::target.

◆ aoecmd_find_tag()

static struct aoe_command* aoecmd_find_tag ( uint32_t  tag)
static

Identify AoE command by tag.

Parameters
tagCommand tag
Return values
aoecmdAoE command, or NULL

Definition at line 559 of file aoe.c.

559  {
560  struct aoe_command *aoecmd;
561 
562  list_for_each_entry ( aoecmd, &aoe_commands, list ) {
563  if ( aoecmd->tag == tag )
564  return aoecmd;
565  }
566  return NULL;
567 }
struct list_head list
List of active commands.
Definition: aoe.c:79
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:431
An AoE command.
Definition: aoe.h:62
uint64_t tag
Identity tag.
Definition: edd.h:30
An AoE command.
Definition: aoe.c:73
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References aoe_command::list, list_for_each_entry, NULL, and tag.

Referenced by aoe_rx(), and aoecmd_new_tag().

◆ aoecmd_new_tag()

static int aoecmd_new_tag ( void  )
static

Choose an AoE command tag.

Return values
tagNew tag, or negative error

Definition at line 574 of file aoe.c.

574  {
575  static uint16_t tag_idx;
576  unsigned int i;
577 
578  for ( i = 0 ; i < 65536 ; i++ ) {
579  tag_idx++;
580  if ( aoecmd_find_tag ( tag_idx ) == NULL )
581  return ( AOE_TAG_MAGIC | tag_idx );
582  }
583  return -EADDRINUSE;
584 }
unsigned short uint16_t
Definition: stdint.h:11
static struct aoe_command * aoecmd_find_tag(uint32_t tag)
Identify AoE command by tag.
Definition: aoe.c:559
#define AOE_TAG_MAGIC
AoE tag magic marker.
Definition: aoe.h:109
#define EADDRINUSE
Address already in use.
Definition: errno.h:303
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References AOE_TAG_MAGIC, aoecmd_find_tag(), EADDRINUSE, and NULL.

Referenced by aoecmd_create().

◆ aoecmd_create()

static struct aoe_command* aoecmd_create ( struct aoe_device aoedev,
struct aoe_command_type type 
)
static

Create AoE command.

Parameters
aoedevAoE device
typeAoE command type
Return values
aoecmdAoE command

Definition at line 593 of file aoe.c.

594  {
595  struct aoe_command *aoecmd;
596  int tag;
597 
598  /* Allocate command tag */
599  tag = aoecmd_new_tag();
600  if ( tag < 0 )
601  return NULL;
602 
603  /* Allocate and initialise structure */
604  aoecmd = zalloc ( sizeof ( *aoecmd ) );
605  if ( ! aoecmd )
606  return NULL;
607  ref_init ( &aoecmd->refcnt, aoecmd_free );
608  list_add ( &aoecmd->list, &aoe_commands );
609  intf_init ( &aoecmd->ata, &aoecmd_ata_desc, &aoecmd->refcnt );
610  timer_init ( &aoecmd->timer, aoecmd_expired, &aoecmd->refcnt );
611  aoecmd->aoedev = aoedev_get ( aoedev );
612  aoecmd->type = type;
613  aoecmd->tag = tag;
614 
615  /* Preserve timeout from last completed command */
616  aoecmd->timer.timeout = aoedev->timeout;
617 
618  /* Return already mortalised. (Reference is held by command list.) */
619  return aoecmd;
620 }
static struct aoe_device * aoedev_get(struct aoe_device *aoedev)
Get reference to AoE device.
Definition: aoe.c:132
#define list_add(new, head)
Add a new entry to the head of a list.
Definition: list.h:69
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition: refcnt.h:64
static struct interface_descriptor aoecmd_ata_desc
AoE command ATA interface descriptor.
Definition: aoe.c:550
static int aoecmd_new_tag(void)
Choose an AoE command tag.
Definition: aoe.c:574
unsigned long timeout
Saved timeout value.
Definition: aoe.h:132
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:77
An AoE command.
Definition: aoe.h:62
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
uint32_t type
Operating system type.
Definition: ena.h:12
static void aoecmd_expired(struct retry_timer *timer, int fail)
Handle AoE retry timer expiry.
Definition: aoe.c:338
static void aoecmd_free(struct refcnt *refcnt)
Free AoE command.
Definition: aoe.c:188
struct aoeata ata
ATA command.
Definition: aoe.h:66
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:203
uint64_t tag
Identity tag.
Definition: edd.h:30
An AoE command.
Definition: aoe.c:73
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References aoecmd_ata_desc, aoecmd_expired(), aoecmd_free(), aoecmd_new_tag(), aoe_command::aoedev, aoedev_get(), aoecmd::ata, intf_init(), list_add, NULL, ref_init, tag, aoe_device::timeout, type, and zalloc().

Referenced by aoedev_ata_command(), and aoedev_cfg_command().

◆ aoedev_ata_command()

static int aoedev_ata_command ( struct aoe_device aoedev,
struct interface parent,
struct ata_cmd command 
)
static

Issue AoE ATA command.

Parameters
aoedevAoE device
parentParent interface
commandATA command
Return values
tagCommand tag, or negative error

Definition at line 630 of file aoe.c.

632  {
633  struct net_device *netdev = aoedev->netdev;
634  struct aoe_command *aoecmd;
635 
636  /* Fail immediately if net device is closed */
637  if ( ! netdev_is_open ( netdev ) ) {
638  DBGC ( aoedev, "AoE %s cannot issue command while net device "
639  "is closed\n", aoedev_name ( aoedev ) );
640  return -EWOULDBLOCK;
641  }
642 
643  /* Create command */
645  if ( ! aoecmd )
646  return -ENOMEM;
647  memcpy ( &aoecmd->command, command, sizeof ( aoecmd->command ) );
648 
649  /* Attempt to send command. Allow failures to be handled by
650  * the retry timer.
651  */
652  aoecmd_tx ( aoecmd );
653 
654  /* Attach to parent interface, leave reference with command
655  * list, and return.
656  */
657  intf_plug_plug ( &aoecmd->ata, parent );
658  return aoecmd->tag;
659 }
A command-line command.
Definition: command.h:9
#define DBGC(...)
Definition: compiler.h:505
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition: interface.c:107
static int aoecmd_tx(struct aoe_command *aoecmd)
Transmit AoE command request.
Definition: aoe.c:231
#define ENOMEM
Not enough space.
Definition: errno.h:534
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
Definition: netdevice.h:658
#define EWOULDBLOCK
Operation would block.
Definition: errno.h:679
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:77
static struct net_device * netdev
Definition: gdbudp.c:52
static struct aoe_command * aoecmd_create(struct aoe_device *aoedev, struct aoe_command_type *type)
Create AoE command.
Definition: aoe.c:593
An AoE command.
Definition: aoe.h:62
A network device.
Definition: netdevice.h:352
static struct aoe_command_type aoecmd_ata
AoE ATA command.
Definition: aoe.c:462
struct net_device * netdev
Network device.
Definition: aoe.h:120
struct aoeata ata
ATA command.
Definition: aoe.h:66
An AoE command.
Definition: aoe.c:73
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:175

References aoecmd_ata, aoecmd_create(), aoecmd_tx(), aoe_command::aoedev, aoedev_name(), aoecmd::ata, DBGC, ENOMEM, EWOULDBLOCK, intf_plug_plug(), memcpy(), netdev, aoe_device::netdev, and netdev_is_open().

◆ aoedev_cfg_command()

static int aoedev_cfg_command ( struct aoe_device aoedev,
struct interface parent 
)
static

Issue AoE configuration command.

Parameters
aoedevAoE device
parentParent interface
Return values
tagCommand tag, or negative error

Definition at line 668 of file aoe.c.

669  {
670  struct aoe_command *aoecmd;
671 
672  /* Create command */
674  if ( ! aoecmd )
675  return -ENOMEM;
676 
677  /* Attempt to send command. Allow failures to be handled by
678  * the retry timer.
679  */
680  aoecmd_tx ( aoecmd );
681 
682  /* Attach to parent interface, leave reference with command
683  * list, and return.
684  */
685  intf_plug_plug ( &aoecmd->ata, parent );
686  return aoecmd->tag;
687 }
static struct aoe_command_type aoecmd_cfg
AoE configuration command.
Definition: aoe.c:538
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition: interface.c:107
static int aoecmd_tx(struct aoe_command *aoecmd)
Transmit AoE command request.
Definition: aoe.c:231
#define ENOMEM
Not enough space.
Definition: errno.h:534
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:77
static struct aoe_command * aoecmd_create(struct aoe_device *aoedev, struct aoe_command_type *type)
Create AoE command.
Definition: aoe.c:593
An AoE command.
Definition: aoe.h:62
struct aoeata ata
ATA command.
Definition: aoe.h:66
An AoE command.
Definition: aoe.c:73

References aoecmd_cfg, aoecmd_create(), aoecmd_tx(), aoe_command::aoedev, aoecmd::ata, ENOMEM, and intf_plug_plug().

Referenced by aoedev_open().

◆ aoedev_free()

static void aoedev_free ( struct refcnt refcnt)
static

Free AoE device.

Parameters
refcntReference count

Definition at line 694 of file aoe.c.

694  {
695  struct aoe_device *aoedev =
696  container_of ( refcnt, struct aoe_device, refcnt );
697 
698  netdev_put ( aoedev->netdev );
699  free ( aoedev );
700 }
An AoE device.
Definition: aoe.h:115
A reference counter.
Definition: refcnt.h:26
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:572
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
struct net_device * netdev
Network device.
Definition: aoe.h:120

References container_of, free, aoe_device::netdev, and netdev_put().

Referenced by aoedev_open().

◆ aoedev_close()

static void aoedev_close ( struct aoe_device aoedev,
int  rc 
)
static

Close AoE device.

Parameters
aoedevAoE device
rcReason for close

Definition at line 708 of file aoe.c.

708  {
709  struct aoe_command *aoecmd;
710  struct aoe_command *tmp;
711 
712  /* Shut down interfaces */
713  intf_shutdown ( &aoedev->ata, rc );
714  intf_shutdown ( &aoedev->config, rc );
715 
716  /* Shut down any active commands */
717  list_for_each_entry_safe ( aoecmd, tmp, &aoe_commands, list ) {
718  if ( aoecmd->aoedev != aoedev )
719  continue;
720  aoecmd_get ( aoecmd );
721  aoecmd_close ( aoecmd, rc );
722  aoecmd_put ( aoecmd );
723  }
724 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:278
struct list_head list
List of active commands.
Definition: aoe.c:79
unsigned long tmp
Definition: linux_pci.h:53
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:77
struct interface ata
ATA command issuing interface.
Definition: aoe.h:122
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
Definition: list.h:458
An AoE command.
Definition: aoe.h:62
struct interface config
Configuration command interface.
Definition: aoe.h:135
static void aoecmd_put(struct aoe_command *aoecmd)
Drop reference to AoE command.
Definition: aoe.c:165
static void aoecmd_close(struct aoe_command *aoecmd, int rc)
Close AoE command.
Definition: aoe.c:205
static struct aoe_command * aoecmd_get(struct aoe_command *aoecmd)
Get reference to AoE command.
Definition: aoe.c:154
An AoE command.
Definition: aoe.c:73

References aoecmd_close(), aoecmd_get(), aoecmd_put(), aoe_command::aoedev, aoe_device::ata, aoe_device::config, intf_shutdown(), aoe_command::list, list_for_each_entry_safe, rc, and tmp.

Referenced by aoedev_config_done(), and aoedev_open().

◆ aoedev_window()

static size_t aoedev_window ( struct aoe_device aoedev)
static

Check AoE device flow-control window.

Parameters
aoedevAoE device
Return values
lenLength of window

Definition at line 732 of file aoe.c.

732  {
733  return ( aoedev->configured ? ~( ( size_t ) 0 ) : 0 );
734 }
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:77
int configured
Device is configued.
Definition: aoe.h:137

References aoe_command::aoedev, and aoe_device::configured.

◆ aoedev_config_done()

static void aoedev_config_done ( struct aoe_device aoedev,
int  rc 
)
static

Handle AoE device configuration completion.

Parameters
aoedevAoE device
rcReason for completion

Definition at line 742 of file aoe.c.

742  {
743 
744  /* Shut down interface */
745  intf_shutdown ( &aoedev->config, rc );
746 
747  /* Close device on failure */
748  if ( rc != 0 ) {
749  aoedev_close ( aoedev, rc );
750  return;
751  }
752 
753  /* Mark device as configured */
754  aoedev->configured = 1;
756 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
Definition: xfer.c:146
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:278
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:77
struct interface ata
ATA command issuing interface.
Definition: aoe.h:122
static void aoedev_close(struct aoe_device *aoedev, int rc)
Close AoE device.
Definition: aoe.c:708
struct interface config
Configuration command interface.
Definition: aoe.h:135
int configured
Device is configued.
Definition: aoe.h:137

References aoe_command::aoedev, aoedev_close(), aoe_device::ata, aoe_device::config, aoe_device::configured, intf_shutdown(), rc, and xfer_window_changed().

◆ aoedev_identify_device()

static struct device* aoedev_identify_device ( struct aoe_device aoedev)
static

Identify device underlying AoE device.

Parameters
aoedevAoE device
Return values
deviceUnderlying device

Definition at line 764 of file aoe.c.

764  {
765  return aoedev->netdev->dev;
766 }
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:77
struct device * dev
Underlying hardware device.
Definition: netdevice.h:364
struct net_device * netdev
Network device.
Definition: aoe.h:120

References net_device::dev, and aoe_device::netdev.

◆ aoedev_describe()

static struct acpi_descriptor* aoedev_describe ( struct aoe_device aoedev)
static

Get AoE ACPI descriptor.

Parameters
aoedevAoE device
Return values
descACPI descriptor

Definition at line 774 of file aoe.c.

774  {
775  return &aoedev->desc;
776 }
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:77
struct acpi_descriptor desc
ACPI descriptor.
Definition: aoe.h:140

References aoe_device::desc.

◆ aoedev_open()

static int aoedev_open ( struct interface parent,
struct net_device netdev,
unsigned int  major,
unsigned int  minor 
)
static

Open AoE device.

Parameters
parentParent interface
netdevNetwork device
majorDevice major number
minorDevice minor number
Return values
rcReturn status code

Definition at line 811 of file aoe.c.

812  {
813  struct aoe_device *aoedev;
814  int rc;
815 
816  /* Allocate and initialise structure */
817  aoedev = zalloc ( sizeof ( *aoedev ) );
818  if ( ! aoedev ) {
819  rc = -ENOMEM;
820  goto err_zalloc;
821  }
822  ref_init ( &aoedev->refcnt, aoedev_free );
823  intf_init ( &aoedev->ata, &aoedev_ata_desc, &aoedev->refcnt );
824  intf_init ( &aoedev->config, &aoedev_config_desc, &aoedev->refcnt );
825  aoedev->netdev = netdev_get ( netdev );
826  aoedev->major = major;
827  aoedev->minor = minor;
828  memcpy ( aoedev->target, netdev->ll_broadcast,
830  acpi_init ( &aoedev->desc, &abft_model, &aoedev->refcnt );
831 
832  /* Initiate configuration */
833  if ( ( rc = aoedev_cfg_command ( aoedev, &aoedev->config ) ) < 0 ) {
834  DBGC ( aoedev, "AoE %s could not initiate configuration: %s\n",
835  aoedev_name ( aoedev ), strerror ( rc ) );
836  goto err_config;
837  }
838 
839  /* Attach ATA device to parent interface */
840  if ( ( rc = ata_open ( parent, &aoedev->ata, ATA_DEV_MASTER,
841  AOE_MAX_COUNT ) ) != 0 ) {
842  DBGC ( aoedev, "AoE %s could not create ATA device: %s\n",
843  aoedev_name ( aoedev ), strerror ( rc ) );
844  goto err_ata_open;
845  }
846 
847  /* Mortalise self and return */
848  ref_put ( &aoedev->refcnt );
849  return 0;
850 
851  err_ata_open:
852  err_config:
853  aoedev_close ( aoedev, rc );
854  ref_put ( &aoedev->refcnt );
855  err_zalloc:
856  return rc;
857 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
uint8_t ll_addr_len
Link-layer address length.
Definition: netdevice.h:198
static struct interface_descriptor aoedev_config_desc
AoE device configuration interface descriptor.
Definition: aoe.c:799
#define AOE_MAX_COUNT
Maximum number of sectors per packet.
Definition: aoe.h:112
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition: refcnt.h:64
uint16_t major
Major number.
Definition: aoe.h:125
#define DBGC(...)
Definition: compiler.h:505
const uint8_t * ll_broadcast
Link-layer broadcast address.
Definition: netdevice.h:389
An AoE device.
Definition: aoe.h:115
#define ENOMEM
Not enough space.
Definition: errno.h:534
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint32_t major
Major version.
Definition: netvsc.h:14
uint32_t minor
Minor version.
Definition: netvsc.h:16
#define ATA_DEV_MASTER
Master ("device 0") flag in the ATA device register.
Definition: ata.h:120
static struct net_device * netdev
Definition: gdbudp.c:52
struct acpi_descriptor desc
ACPI descriptor.
Definition: aoe.h:140
static int aoedev_cfg_command(struct aoe_device *aoedev, struct interface *parent)
Issue AoE configuration command.
Definition: aoe.c:668
struct interface ata
ATA command issuing interface.
Definition: aoe.h:122
uint8_t target[MAX_LL_ADDR_LEN]
Target MAC address.
Definition: aoe.h:129
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static void aoedev_close(struct aoe_device *aoedev, int rc)
Close AoE device.
Definition: aoe.c:708
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
struct refcnt refcnt
Reference counter.
Definition: aoe.h:117
struct interface config
Configuration command interface.
Definition: aoe.h:135
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
Definition: netdevice.h:561
uint8_t minor
Minor number.
Definition: aoe.h:127
struct net_device * netdev
Network device.
Definition: aoe.h:120
static void aoedev_free(struct refcnt *refcnt)
Free AoE device.
Definition: aoe.c:694
int ata_open(struct interface *block, struct interface *ata, unsigned int device, unsigned int max_count)
Open ATA device.
Definition: ata.c:662
static struct interface_descriptor aoedev_ata_desc
AoE device ATA interface descriptor.
Definition: aoe.c:790
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:203
struct ll_protocol * ll_protocol
Link-layer protocol.
Definition: netdevice.h:372
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106
static void acpi_init(struct acpi_descriptor *desc, struct acpi_model *model, struct refcnt *refcnt)
Initialise ACPI descriptor.
Definition: acpi.h:295
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:175

References acpi_init(), AOE_MAX_COUNT, aoedev_ata_desc, aoedev_cfg_command(), aoedev_close(), aoedev_config_desc, aoedev_free(), aoedev_name(), aoe_device::ata, ATA_DEV_MASTER, ata_open(), aoe_device::config, DBGC, aoe_device::desc, ENOMEM, intf_init(), ll_protocol::ll_addr_len, net_device::ll_broadcast, net_device::ll_protocol, major, aoe_device::major, memcpy(), minor, aoe_device::minor, netdev, aoe_device::netdev, netdev_get(), rc, ref_init, ref_put, aoe_device::refcnt, strerror(), aoe_device::target, and zalloc().

Referenced by aoe_open().

◆ aoe_rx()

static int aoe_rx ( struct io_buffer iobuf,
struct net_device *netdev  __unused,
const void *ll_dest  __unused,
const void *  ll_source,
unsigned int flags  __unused 
)
static

Process incoming AoE packets.

Parameters
iobufI/O buffer
netdevNetwork device
ll_destLink-layer destination address
ll_sourceLink-layer source address
flagsPacket flags
Return values
rcReturn status code

Definition at line 876 of file aoe.c.

880  {
881  struct aoehdr *aoehdr = iobuf->data;
882  struct aoe_command *aoecmd;
883  int rc;
884 
885  /* Sanity check */
886  if ( iob_len ( iobuf ) < sizeof ( *aoehdr ) ) {
887  DBG ( "AoE received underlength packet (%zd bytes)\n",
888  iob_len ( iobuf ) );
889  rc = -EINVAL;
890  goto err_sanity;
891  }
892  if ( ( aoehdr->ver_flags & AOE_VERSION_MASK ) != AOE_VERSION ) {
893  DBG ( "AoE received packet for unsupported protocol version "
894  "%02x\n", ( aoehdr->ver_flags & AOE_VERSION_MASK ) );
895  rc = -EPROTONOSUPPORT;
896  goto err_sanity;
897  }
898  if ( ! ( aoehdr->ver_flags & AOE_FL_RESPONSE ) ) {
899  DBG ( "AoE received request packet\n" );
900  rc = -EOPNOTSUPP;
901  goto err_sanity;
902  }
903 
904  /* Demultiplex amongst active AoE commands */
906  if ( ! aoecmd ) {
907  DBG ( "AoE received packet for unused tag %08x\n",
908  ntohl ( aoehdr->tag ) );
909  rc = -ENOENT;
910  goto err_demux;
911  }
912 
913  /* Pass received frame to command */
914  aoecmd_get ( aoecmd );
915  if ( ( rc = aoecmd_rx ( aoecmd, iob_disown ( iobuf ),
916  ll_source ) ) != 0 )
917  goto err_rx;
918 
919  err_rx:
920  aoecmd_put ( aoecmd );
921  err_demux:
922  err_sanity:
923  free_iob ( iobuf );
924  return rc;
925 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static struct aoe_command * aoecmd_find_tag(uint32_t tag)
Identify AoE command by tag.
Definition: aoe.c:559
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
#define AOE_VERSION_MASK
Version part of ver_flags field.
Definition: aoe.h:88
#define ENOENT
No such file or directory.
Definition: errno.h:514
#define ntohl(value)
Definition: byteswap.h:134
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:212
#define AOE_VERSION
Version 1.
Definition: aoe.h:87
An AoE command.
Definition: aoe.h:62
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:155
uint32_t tag
Tag, in network byte order.
Definition: aoe.h:82
#define EOPNOTSUPP
Operation not supported on socket.
Definition: errno.h:604
static int aoecmd_rx(struct aoe_command *aoecmd, struct io_buffer *iobuf, const void *ll_source)
Receive AoE command response.
Definition: aoe.c:285
#define EPROTONOSUPPORT
Protocol not supported.
Definition: errno.h:629
void * data
Start of data.
Definition: iobuf.h:48
static void aoecmd_put(struct aoe_command *aoecmd)
Drop reference to AoE command.
Definition: aoe.c:165
uint8_t ver_flags
Protocol version number and flags.
Definition: aoe.h:72
An AoE header.
Definition: aoe.h:70
#define AOE_FL_RESPONSE
Message is a response.
Definition: aoe.h:90
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
static struct aoe_command * aoecmd_get(struct aoe_command *aoecmd)
Get reference to AoE command.
Definition: aoe.c:154
An AoE command.
Definition: aoe.c:73

References AOE_FL_RESPONSE, AOE_VERSION, AOE_VERSION_MASK, aoecmd_find_tag(), aoecmd_get(), aoecmd_put(), aoecmd_rx(), io_buffer::data, DBG, EINVAL, ENOENT, EOPNOTSUPP, EPROTONOSUPPORT, free_iob(), iob_disown, iob_len(), ntohl, rc, aoehdr::tag, and aoehdr::ver_flags.

◆ aoe_parse_uri()

static int aoe_parse_uri ( struct uri uri,
unsigned int *  major,
unsigned int *  minor 
)
static

Parse AoE URI.

Parameters
uriURI
Return values
majorMajor device number
minorMinor device number
rcReturn status code

An AoE URI has the form "aoe:e<major>.<minor>".

Definition at line 951 of file aoe.c.

952  {
953  const char *ptr;
954  char *end;
955 
956  /* Check for URI with opaque portion */
957  if ( ! uri->opaque )
958  return -EINVAL;
959  ptr = uri->opaque;
960 
961  /* Check for initial 'e' */
962  if ( *ptr != 'e' )
963  return -EINVAL;
964  ptr++;
965 
966  /* Parse major device number */
967  *major = strtoul ( ptr, &end, 10 );
968  if ( *end != '.' )
969  return -EINVAL;
970  ptr = ( end + 1 );
971 
972  /* Parse minor device number */
973  *minor = strtoul ( ptr, &end, 10 );
974  if ( *end )
975  return -EINVAL;
976 
977  return 0;
978 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
unsigned long strtoul(const char *string, char **endp, int base)
Convert string to numeric value.
Definition: string.c:471
uint32_t major
Major version.
Definition: netvsc.h:14
uint32_t minor
Minor version.
Definition: netvsc.h:16
const char * opaque
Opaque part.
Definition: uri.h:70
uint32_t end
Ending offset.
Definition: netvsc.h:18
A Uniform Resource Identifier.
Definition: uri.h:64

References EINVAL, end, major, minor, uri::opaque, and strtoul().

Referenced by aoe_open().

◆ aoe_open()

static int aoe_open ( struct interface parent,
struct uri uri 
)
static

Open AoE URI.

Parameters
parentParent interface
uriURI
Return values
rcReturn status code

Definition at line 987 of file aoe.c.

987  {
988  struct net_device *netdev;
989  unsigned int major;
990  unsigned int minor;
991  int rc;
992 
993  /* Identify network device. This is something of a hack, but
994  * the AoE URI scheme that has been in use for some time now
995  * provides no way to specify a particular device.
996  */
998  if ( ! netdev ) {
999  DBG ( "AoE cannot identify network device\n" );
1000  return -ENODEV;
1001  }
1002 
1003  /* Parse URI */
1004  if ( ( rc = aoe_parse_uri ( uri, &major, &minor ) ) != 0 ) {
1005  DBG ( "AoE cannot parse URI\n" );
1006  return rc;
1007  }
1008 
1009  /* Open AoE device */
1010  if ( ( rc = aoedev_open ( parent, netdev, major, minor ) ) != 0 )
1011  return rc;
1012 
1013  return 0;
1014 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int aoe_parse_uri(struct uri *uri, unsigned int *major, unsigned int *minor)
Parse AoE URI.
Definition: aoe.c:951
uint32_t major
Major version.
Definition: netvsc.h:14
uint32_t minor
Minor version.
Definition: netvsc.h:16
static struct net_device * netdev
Definition: gdbudp.c:52
struct net_device * last_opened_netdev(void)
Get most recently opened network device.
Definition: netdevice.c:1047
A network device.
Definition: netdevice.h:352
#define ENODEV
No such device.
Definition: errno.h:509
static int aoedev_open(struct interface *parent, struct net_device *netdev, unsigned int major, unsigned int minor)
Open AoE device.
Definition: aoe.c:811
A Uniform Resource Identifier.
Definition: uri.h:64
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References aoe_parse_uri(), aoedev_open(), DBG, ENODEV, last_opened_netdev(), major, minor, netdev, and rc.

◆ abft_complete()

static int abft_complete ( struct acpi_descriptor *desc  __unused)
static

Check if AoE boot firmware table descriptor is complete.

Parameters
descACPI descriptor
Return values
rcReturn status code

Definition at line 1035 of file aoe.c.

1035  {
1036  return 0;
1037 }

◆ abft_install()

static int abft_install ( int(*)(struct acpi_header *acpi install)
static

Install AoE boot firmware table(s)

Parameters
installInstallation method
Return values
rcReturn status code

Definition at line 1045 of file aoe.c.

1045  {
1046  struct aoe_device *aoedev;
1047  struct abft_table abft;
1048  int rc;
1049 
1050  list_for_each_entry ( aoedev, &abft_model.descs, desc.list ) {
1051 
1052  /* Populate table */
1053  memset ( &abft, 0, sizeof ( abft ) );
1054  abft.acpi.signature = cpu_to_le32 ( ABFT_SIG );
1055  abft.acpi.length = cpu_to_le32 ( sizeof ( abft ) );
1056  abft.acpi.revision = 1;
1057  abft.shelf = cpu_to_le16 ( aoedev->major );
1058  abft.slot = aoedev->minor;
1059  memcpy ( abft.mac, aoedev->netdev->ll_addr,
1060  sizeof ( abft.mac ) );
1061 
1062  /* Install table */
1063  if ( ( rc = install ( &abft.acpi ) ) != 0 ) {
1064  DBGC ( aoedev, "AoE %s could not install aBFT: %s\n",
1065  aoedev_name ( aoedev ), strerror ( rc ) );
1066  return rc;
1067  }
1068  }
1069 
1070  return 0;
1071 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
uint16_t major
Major number.
Definition: aoe.h:125
uint64_t desc
Microcode descriptor list physical address.
Definition: ucode.h:12
#define DBGC(...)
Definition: compiler.h:505
An AoE device.
Definition: aoe.h:115
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:431
#define cpu_to_le32(value)
Definition: byteswap.h:107
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
AoE Boot Firmware Table (aBFT)
Definition: aoe.h:149
#define ABFT_SIG
AoE boot firmware table signature.
Definition: aoe.h:144
#define cpu_to_le16(value)
Definition: byteswap.h:106
uint8_t minor
Minor number.
Definition: aoe.h:127
struct net_device * netdev
Network device.
Definition: aoe.h:120
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
void * memset(void *dest, int character, size_t len) __nonnull
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:175

References ABFT_SIG, abft_table::acpi, aoedev_name(), cpu_to_le16, cpu_to_le32, DBGC, desc, acpi_header::length, list_for_each_entry, net_device::ll_addr, abft_table::mac, aoe_device::major, memcpy(), memset(), aoe_device::minor, aoe_device::netdev, rc, acpi_header::revision, abft_table::shelf, acpi_header::signature, abft_table::slot, and strerror().

Variable Documentation

◆ __net_protocol

struct net_protocol aoe_protocol __net_protocol
Initial value:
= {
.name = "AoE",
.net_proto = htons ( ETH_P_AOE ),
.rx = aoe_rx,
}
static int aoe_rx(struct io_buffer *iobuf, struct net_device *netdev __unused, const void *ll_dest __unused, const void *ll_source, unsigned int flags __unused)
Process incoming AoE packets.
Definition: aoe.c:876
#define ETH_P_AOE
Definition: if_ether.h:25
#define htons(value)
Definition: byteswap.h:135

AoE protocol.

Definition at line 56 of file aoe.c.

◆ __acpi_model

struct acpi_model abft_model __acpi_model
Initial value:
= {
.descs = LIST_HEAD_INIT ( abft_model.descs ),
.complete = abft_complete,
.install = abft_install,
}
static int abft_complete(struct acpi_descriptor *desc __unused)
Check if AoE boot firmware table descriptor is complete.
Definition: aoe.c:1035
static int abft_install(int(*install)(struct acpi_header *acpi))
Install AoE boot firmware table(s)
Definition: aoe.c:1045
#define LIST_HEAD_INIT(list)
Initialise a static list head.
Definition: list.h:30

aBFT model

Definition at line 57 of file aoe.c.

◆ aoecmd_ata

struct aoe_command_type aoecmd_ata
static
Initial value:
= {
.cmd_len = aoecmd_ata_cmd_len,
}
static size_t aoecmd_ata_cmd_len(struct aoe_command *aoecmd)
Calculate length of AoE ATA command IU.
Definition: aoe.c:355
static void aoecmd_ata_cmd(struct aoe_command *aoecmd, void *data, size_t len)
Build AoE ATA command IU.
Definition: aoe.c:369
static int aoecmd_ata_rsp(struct aoe_command *aoecmd, const void *data, size_t len, const void *ll_source __unused)
Handle AoE ATA response IU.
Definition: aoe.c:417

AoE ATA command.

Definition at line 462 of file aoe.c.

Referenced by aoedev_ata_command().

◆ aoecmd_cfg

struct aoe_command_type aoecmd_cfg
static
Initial value:
= {
.cmd_len = aoecmd_cfg_cmd_len,
}
static void aoecmd_cfg_cmd(struct aoe_command *aoecmd, void *data, size_t len)
Build AoE configuration command IU.
Definition: aoe.c:485
static int aoecmd_cfg_rsp(struct aoe_command *aoecmd, const void *data, size_t len, const void *ll_source)
Handle AoE configuration response IU.
Definition: aoe.c:511
static size_t aoecmd_cfg_cmd_len(struct aoe_command *aoecmd __unused)
Calculate length of AoE configuration command IU.
Definition: aoe.c:474

AoE configuration command.

Definition at line 538 of file aoe.c.

Referenced by aoedev_cfg_command().

◆ aoecmd_ata_op

struct interface_operation aoecmd_ata_op[]
static
Initial value:
= {
}
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32
static void aoecmd_close(struct aoe_command *aoecmd, int rc)
Close AoE command.
Definition: aoe.c:205
An AoE command.
Definition: aoe.c:73

AoE command ATA interface operations.

Definition at line 545 of file aoe.c.

◆ aoecmd_ata_desc

struct interface_descriptor aoecmd_ata_desc
static
Initial value:
=
static struct interface_operation aoecmd_ata_op[]
AoE command ATA interface operations.
Definition: aoe.c:545
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80
An AoE command.
Definition: aoe.c:73

AoE command ATA interface descriptor.

Definition at line 550 of file aoe.c.

Referenced by aoecmd_create().

◆ aoedev_ata_op

struct interface_operation aoedev_ata_op[]
static
Initial value:
= {
}
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
static size_t aoedev_window(struct aoe_device *aoedev)
Check AoE device flow-control window.
Definition: aoe.c:732
static int aoedev_ata_command(struct aoe_device *aoedev, struct interface *parent, struct ata_cmd *command)
Issue AoE ATA command.
Definition: aoe.c:630
size_t xfer_window(struct interface *intf)
Check flow control window.
Definition: xfer.c:116
An AoE device.
Definition: aoe.h:115
#define EFI_INTF_OP
Definition: efi.h:350
static void aoedev_close(struct aoe_device *aoedev, int rc)
Close AoE device.
Definition: aoe.c:708
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32
struct acpi_descriptor * acpi_describe(struct interface *intf)
Get object's ACPI descriptor.
Definition: acpi.c:313
static struct device * aoedev_identify_device(struct aoe_device *aoedev)
Identify device underlying AoE device.
Definition: aoe.c:764
EFI_DEVICE_PATH_PROTOCOL * efi_describe(struct interface *intf)
Describe object as an EFI device path.
Definition: efi_path.c:680
EFI_DEVICE_PATH_PROTOCOL * efi_aoe_path(struct aoe_device *aoedev)
Construct EFI device path for AoE device.
Definition: efi_path.c:499
struct device * identify_device(struct interface *intf)
Identify a device behind an interface.
Definition: device.c:125
An ATA command.
Definition: ata.c:109
static struct acpi_descriptor * aoedev_describe(struct aoe_device *aoedev)
Get AoE ACPI descriptor.
Definition: aoe.c:774

AoE device ATA interface operations.

Definition at line 779 of file aoe.c.

◆ aoedev_ata_desc

struct interface_descriptor aoedev_ata_desc
static
Initial value:
=
static struct interface_operation aoedev_ata_op[]
AoE device ATA interface operations.
Definition: aoe.c:779
An AoE device.
Definition: aoe.h:115
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80

AoE device ATA interface descriptor.

Definition at line 790 of file aoe.c.

Referenced by aoedev_open().

◆ aoedev_config_op

struct interface_operation aoedev_config_op[]
static
Initial value:
= {
}
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
An AoE device.
Definition: aoe.h:115
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32
static void aoedev_config_done(struct aoe_device *aoedev, int rc)
Handle AoE device configuration completion.
Definition: aoe.c:742

AoE device configuration interface operations.

Definition at line 794 of file aoe.c.

◆ aoedev_config_desc

struct interface_descriptor aoedev_config_desc
static
Initial value:
=
An AoE device.
Definition: aoe.h:115
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80
static struct interface_operation aoedev_config_op[]
AoE device configuration interface operations.
Definition: aoe.c:794

AoE device configuration interface descriptor.

Definition at line 799 of file aoe.c.

Referenced by aoedev_open().

◆ __uri_opener

struct uri_opener aoe_uri_opener __uri_opener
Initial value:
= {
.scheme = "aoe",
.open = aoe_open,
}
static int aoe_open(struct interface *parent, struct uri *uri)
Open AoE URI.
Definition: aoe.c:987

AoE URI opener.

Definition at line 1017 of file aoe.c.