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/aoe.h>

Go to the source code of this file.

Data Structures

struct  aoe_device
 An AoE device. More...
 
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 160 of file aoe.c.

160  {
161  ref_get ( &aoedev->refcnt );
162  return aoedev;
163 }
#define ref_get(refcnt)
Get additional reference to object.
Definition: refcnt.h:92
struct refcnt refcnt
Reference counter.
Definition: aoe.c:74

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 171 of file aoe.c.

171  {
172  ref_put ( &aoedev->refcnt );
173 }
struct refcnt refcnt
Reference counter.
Definition: aoe.c:74
#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 182 of file aoe.c.

182  {
183  ref_get ( &aoecmd->refcnt );
184  return aoecmd;
185 }
An AoE command.
Definition: aoe.h:60
#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 193 of file aoe.c.

193  {
194  ref_put ( &aoecmd->refcnt );
195 }
An AoE command.
Definition: aoe.h:60
#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 203 of file aoe.c.

203  {
204  static char buf[16];
205 
206  snprintf ( buf, sizeof ( buf ), "%s/e%d.%d", aoedev->netdev->name,
207  aoedev->major, aoedev->minor );
208  return buf;
209 }
uint16_t major
Major number.
Definition: aoe.c:82
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
uint8_t minor
Minor number.
Definition: aoe.c:84
struct net_device * netdev
Network device.
Definition: aoe.c:77
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 216 of file aoe.c.

216  {
217  struct aoe_command *aoecmd =
218  container_of ( refcnt, struct aoe_command, refcnt );
219 
220  assert ( ! timer_running ( &aoecmd->timer ) );
221  assert ( list_empty ( &aoecmd->list ) );
222 
223  aoedev_put ( aoecmd->aoedev );
224  free ( aoecmd );
225 }
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:60
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:171
An AoE command.
Definition: aoe.c:101

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 233 of file aoe.c.

233  {
234  struct aoe_device *aoedev = aoecmd->aoedev;
235 
236  /* Stop timer */
237  stop_timer ( &aoecmd->timer );
238 
239  /* Preserve the timeout value for subsequent commands */
240  aoedev->timeout = aoecmd->timer.timeout;
241 
242  /* Remove from list of commands */
243  if ( ! list_empty ( &aoecmd->list ) ) {
244  list_del ( &aoecmd->list );
245  INIT_LIST_HEAD ( &aoecmd->list );
246  aoecmd_put ( aoecmd );
247  }
248 
249  /* Shut down interfaces */
250  intf_shutdown ( &aoecmd->ata, rc );
251 }
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:273
unsigned long timeout
Saved timeout value.
Definition: aoe.c:89
An AoE device.
Definition: aoe.c:72
#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:60
#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:193
struct aoeata ata
ATA command.
Definition: aoe.h:64

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 259 of file aoe.c.

259  {
260  struct aoe_device *aoedev = aoecmd->aoedev;
261  struct net_device *netdev = aoedev->netdev;
262  struct io_buffer *iobuf;
263  struct aoehdr *aoehdr;
264  size_t cmd_len;
265  int rc;
266 
267  /* Sanity check */
268  assert ( netdev != NULL );
269 
270  /* If we are transmitting anything that requires a response,
271  * start the retransmission timer. Do this before attempting
272  * to allocate the I/O buffer, in case allocation itself
273  * fails.
274  */
275  start_timer ( &aoecmd->timer );
276 
277  /* Create outgoing I/O buffer */
278  cmd_len = aoecmd->type->cmd_len ( aoecmd );
279  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + cmd_len );
280  if ( ! iobuf )
281  return -ENOMEM;
282  iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
283  aoehdr = iob_put ( iobuf, cmd_len );
284 
285  /* Fill AoE header */
286  memset ( aoehdr, 0, sizeof ( *aoehdr ) );
288  aoehdr->major = htons ( aoedev->major );
289  aoehdr->minor = aoedev->minor;
290  aoehdr->tag = htonl ( aoecmd->tag );
291  aoecmd->type->cmd ( aoecmd, iobuf->data, iob_len ( iobuf ) );
292 
293  /* Send packet */
294  if ( ( rc = net_tx ( iobuf, netdev, &aoe_protocol, aoedev->target,
295  netdev->ll_addr ) ) != 0 ) {
296  DBGC ( aoedev, "AoE %s/%08x could not transmit: %s\n",
297  aoedev_name ( aoedev ), aoecmd->tag,
298  strerror ( rc ) );
299  return rc;
300  }
301 
302  return 0;
303 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:116
uint16_t major
Major number.
Definition: aoe.c:82
#define DBGC(...)
Definition: compiler.h:505
uint16_t major
Major device number, in network byte order.
Definition: aoe.h:74
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:128
#define htonl(value)
Definition: byteswap.h:133
An AoE device.
Definition: aoe.c:72
#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:85
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:76
An AoE command.
Definition: aoe.h:60
uint8_t target[MAX_LL_ADDR_LEN]
Target MAC address.
Definition: aoe.c:86
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
uint32_t tag
Tag, in network byte order.
Definition: aoe.h:80
A network device.
Definition: netdevice.h:348
void start_timer(struct retry_timer *timer)
Start timer.
Definition: retry.c:93
#define iob_reserve(iobuf, len)
Definition: iobuf.h:63
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:999
void * data
Start of data.
Definition: iobuf.h:44
uint8_t minor
Minor number.
Definition: aoe.c:84
struct net_device * netdev
Network device.
Definition: aoe.c:77
uint8_t ver_flags
Protocol version number and flags.
Definition: aoe.h:70
An AoE header.
Definition: aoe.h:68
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:381
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
#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:203
A persistent I/O buffer.
Definition: iobuf.h:32

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 313 of file aoe.c.

314  {
315  struct aoe_device *aoedev = aoecmd->aoedev;
316  struct aoehdr *aoehdr = iobuf->data;
317  int rc;
318 
319  /* Sanity check */
320  if ( iob_len ( iobuf ) < sizeof ( *aoehdr ) ) {
321  DBGC ( aoedev, "AoE %s/%08x received underlength response "
322  "(%zd bytes)\n", aoedev_name ( aoedev ),
323  aoecmd->tag, iob_len ( iobuf ) );
324  rc = -EINVAL;
325  goto done;
326  }
327  if ( ( ntohs ( aoehdr->major ) != aoedev->major ) ||
328  ( aoehdr->minor != aoedev->minor ) ) {
329  DBGC ( aoedev, "AoE %s/%08x received response for incorrect "
330  "device e%d.%d\n", aoedev_name ( aoedev ), aoecmd->tag,
331  ntohs ( aoehdr->major ), aoehdr->minor );
332  rc = -EINVAL;
333  goto done;
334  }
335 
336  /* Catch command failures */
337  if ( aoehdr->ver_flags & AOE_FL_ERROR ) {
338  DBGC ( aoedev, "AoE %s/%08x terminated in error\n",
339  aoedev_name ( aoedev ), aoecmd->tag );
340  aoecmd_close ( aoecmd, -EIO );
341  rc = -EIO;
342  goto done;
343  }
344 
345  /* Hand off to command completion handler */
346  if ( ( rc = aoecmd->type->rsp ( aoecmd, iobuf->data, iob_len ( iobuf ),
347  ll_source ) ) != 0 )
348  goto done;
349 
350  done:
351  /* Free I/O buffer */
352  free_iob ( iobuf );
353 
354  /* Terminate command */
355  aoecmd_close ( aoecmd, rc );
356 
357  return rc;
358 }
#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:145
uint16_t major
Major number.
Definition: aoe.c:82
#define DBGC(...)
Definition: compiler.h:505
uint16_t major
Major device number, in network byte order.
Definition: aoe.h:74
#define ntohs(value)
Definition: byteswap.h:136
An AoE device.
Definition: aoe.c:72
uint8_t minor
Minor device number.
Definition: aoe.h:76
An AoE command.
Definition: aoe.h:60
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
void * data
Start of data.
Definition: iobuf.h:44
#define EIO
Input/output error.
Definition: errno.h:433
uint8_t minor
Minor number.
Definition: aoe.c:84
uint8_t ver_flags
Protocol version number and flags.
Definition: aoe.h:70
#define AOE_FL_ERROR
Command generated an error.
Definition: aoe.h:89
static void aoecmd_close(struct aoe_command *aoecmd, int rc)
Close AoE command.
Definition: aoe.c:233
An AoE header.
Definition: aoe.h:68
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:203

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 366 of file aoe.c.

366  {
367  struct aoe_command *aoecmd =
368  container_of ( timer, struct aoe_command, timer );
369 
370  if ( fail ) {
372  } else {
373  aoecmd_tx ( aoecmd );
374  }
375 }
static int aoecmd_tx(struct aoe_command *aoecmd)
Transmit AoE command request.
Definition: aoe.c:259
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:60
static void aoecmd_close(struct aoe_command *aoecmd, int rc)
Close AoE command.
Definition: aoe.c:233
An AoE command.
Definition: aoe.c:101
#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 383 of file aoe.c.

383  {
384  struct ata_cmd *command = &aoecmd->command;
385 
386  return ( sizeof ( struct aoehdr ) + sizeof ( struct aoeata ) +
387  command->data_out_len );
388 }
An AoE ATA command.
Definition: aoe.h:36
A command-line command.
Definition: command.h:9
An ATA command information unit.
Definition: ata.h:168
An AoE command.
Definition: aoe.h:60
An AoE header.
Definition: aoe.h:68

◆ 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 397 of file aoe.c.

398  {
399  struct aoe_device *aoedev = aoecmd->aoedev;
400  struct ata_cmd *command = &aoecmd->command;
401  struct aoehdr *aoehdr = data;
402  struct aoeata *aoeata = &aoehdr->payload[0].ata;
403 
404  /* Sanity check */
405  linker_assert ( AOE_FL_DEV_HEAD == ATA_DEV_SLAVE, __fix_ata_h__ );
406  assert ( len == ( sizeof ( *aoehdr ) + sizeof ( *aoeata ) +
407  command->data_out_len ) );
408 
409  /* Build IU */
411  memset ( aoeata, 0, sizeof ( *aoeata ) );
412  aoeata->aflags = ( ( command->cb.lba48 ? AOE_FL_EXTENDED : 0 ) |
413  ( command->cb.device & ATA_DEV_SLAVE ) |
414  ( command->data_out_len ? AOE_FL_WRITE : 0 ) );
415  aoeata->err_feat = command->cb.err_feat.bytes.cur;
416  aoeata->count = command->cb.count.native;
417  aoeata->cmd_stat = command->cb.cmd_stat;
418  aoeata->lba.u64 = cpu_to_le64 ( command->cb.lba.native );
419  if ( ! command->cb.lba48 )
420  aoeata->lba.bytes[3] |=
421  ( command->cb.device & ATA_DEV_MASK );
422  copy_from_user ( aoeata->data, command->data_out, 0,
423  command->data_out_len );
424 
425  DBGC2 ( aoedev, "AoE %s/%08x ATA cmd %02x:%02x:%02x:%02x:%08llx",
426  aoedev_name ( aoedev ), aoecmd->tag, aoeata->aflags,
428  aoeata->lba.u64 );
429  if ( command->data_out_len )
430  DBGC2 ( aoedev, " out %04zx", command->data_out_len );
431  if ( command->data_in_len )
432  DBGC2 ( aoedev, " in %04zx", command->data_in_len );
433  DBGC2 ( aoedev, "\n" );
434 }
uint8_t err_feat
ATA error/feature register.
Definition: aoe.h:40
An AoE ATA command.
Definition: aoe.h:36
A command-line command.
Definition: command.h:9
uint8_t bytes[6]
Definition: aoe.h:48
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:51
union aoecmd payload[0]
Payload.
Definition: aoe.h:82
#define cpu_to_le64(value)
Definition: byteswap.h:108
uint8_t cmd_stat
ATA command/status register.
Definition: aoe.h:44
An AoE device.
Definition: aoe.c:72
uint8_t command
Command number.
Definition: aoe.h:78
#define AOE_FL_WRITE
Write command.
Definition: aoe.h:57
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An ATA command information unit.
Definition: ata.h:168
An AoE command.
Definition: aoe.h:60
union aoeata::@430 lba
Logical block address, in little-endian order.
uint8_t aflags
AoE command flags.
Definition: aoe.h:38
uint64_t u64
Definition: aoe.h:47
uint32_t len
Length.
Definition: ena.h:14
#define DBGC2(...)
Definition: compiler.h:522
uint8_t count
ATA sector count register.
Definition: aoe.h:42
struct aoeata ata
ATA command.
Definition: aoe.h:64
#define AOE_CMD_ATA
Issue ATA command.
Definition: aoe.h:94
An AoE header.
Definition: aoe.h:68
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
#define AOE_FL_EXTENDED
LBA48 extended addressing.
Definition: aoe.h:54
#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 linker_assert(condition, error_symbol)
Assert a condition at link-time.
Definition: assert.h:68
#define AOE_FL_DEV_HEAD
Device/head flag.
Definition: aoe.h:55
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:203

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, linker_assert, memset(), aoehdr::payload, 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 445 of file aoe.c.

446  {
447  struct aoe_device *aoedev = aoecmd->aoedev;
448  struct ata_cmd *command = &aoecmd->command;
449  const struct aoehdr *aoehdr = data;
450  const struct aoeata *aoeata = &aoehdr->payload[0].ata;
451  size_t data_len;
452 
453  /* Sanity check */
454  if ( len < ( sizeof ( *aoehdr ) + sizeof ( *aoeata ) ) ) {
455  DBGC ( aoedev, "AoE %s/%08x received underlength ATA response "
456  "(%zd bytes)\n", aoedev_name ( aoedev ),
457  aoecmd->tag, len );
458  return -EINVAL;
459  }
460  data_len = ( len - ( sizeof ( *aoehdr ) + sizeof ( *aoeata ) ) );
461  DBGC2 ( aoedev, "AoE %s/%08x ATA rsp %02x in %04zx\n",
462  aoedev_name ( aoedev ), aoecmd->tag, aoeata->cmd_stat,
463  data_len );
464 
465  /* Check for command failure */
466  if ( aoeata->cmd_stat & ATA_STAT_ERR ) {
467  DBGC ( aoedev, "AoE %s/%08x status %02x\n",
468  aoedev_name ( aoedev ), aoecmd->tag, aoeata->cmd_stat );
469  return -EIO;
470  }
471 
472  /* Check data-in length is sufficient. (There may be trailing
473  * garbage due to Ethernet minimum-frame-size padding.)
474  */
475  if ( data_len < command->data_in_len ) {
476  DBGC ( aoedev, "AoE %s/%08x data-in underrun (received %zd, "
477  "expected %zd)\n", aoedev_name ( aoedev ), aoecmd->tag,
478  data_len, command->data_in_len );
479  return -ERANGE;
480  }
481 
482  /* Copy out data payload */
483  copy_to_user ( command->data_in, 0, aoeata->data,
484  command->data_in_len );
485 
486  return 0;
487 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
An AoE ATA command.
Definition: aoe.h:36
A command-line command.
Definition: command.h:9
uint8_t data[0]
Data payload.
Definition: aoe.h:51
#define DBGC(...)
Definition: compiler.h:505
union aoecmd payload[0]
Payload.
Definition: aoe.h:82
uint8_t cmd_stat
ATA command/status register.
Definition: aoe.h:44
An AoE device.
Definition: aoe.c:72
An ATA command information unit.
Definition: ata.h:168
An AoE command.
Definition: aoe.h:60
#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
struct aoeata ata
ATA command.
Definition: aoe.h:64
An AoE header.
Definition: aoe.h:68
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:203

References aoedev_name(), aoecmd::ata, ATA_STAT_ERR, aoeata::cmd_stat, copy_to_user(), data, aoeata::data, 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 502 of file aoe.c.

502  {
503  return ( sizeof ( struct aoehdr ) + sizeof ( struct aoecfg ) );
504 }
An AoE config command.
Definition: aoe.h:20
An AoE header.
Definition: aoe.h:68

◆ 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 513 of file aoe.c.

514  {
515  struct aoe_device *aoedev = aoecmd->aoedev;
516  struct aoehdr *aoehdr = data;
517  struct aoecfg *aoecfg = &aoehdr->payload[0].cfg;
518 
519  /* Sanity check */
520  assert ( len == ( sizeof ( *aoehdr ) + sizeof ( *aoecfg ) ) );
521 
522  /* Build IU */
524  memset ( aoecfg, 0, sizeof ( *aoecfg ) );
525 
526  DBGC ( aoedev, "AoE %s/%08x CONFIG cmd\n",
527  aoedev_name ( aoedev ), aoecmd->tag );
528 }
struct aoecfg cfg
Config command.
Definition: aoe.h:62
#define DBGC(...)
Definition: compiler.h:505
union aoecmd payload[0]
Payload.
Definition: aoe.h:82
An AoE device.
Definition: aoe.c:72
uint8_t command
Command number.
Definition: aoe.h:78
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An AoE command.
Definition: aoe.h:60
An AoE config command.
Definition: aoe.h:20
#define AOE_CMD_CONFIG
Query Config Information.
Definition: aoe.h:95
uint32_t len
Length.
Definition: ena.h:14
An AoE header.
Definition: aoe.h:68
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
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:203

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 539 of file aoe.c.

540  {
541  struct aoe_device *aoedev = aoecmd->aoedev;
542  struct ll_protocol *ll_protocol = aoedev->netdev->ll_protocol;
543  const struct aoehdr *aoehdr = data;
544  const struct aoecfg *aoecfg = &aoehdr->payload[0].cfg;
545 
546  /* Sanity check */
547  if ( len < ( sizeof ( *aoehdr ) + sizeof ( *aoecfg ) ) ) {
548  DBGC ( aoedev, "AoE %s/%08x received underlength "
549  "configuration response (%zd bytes)\n",
550  aoedev_name ( aoedev ), aoecmd->tag, len );
551  return -EINVAL;
552  }
553  DBGC ( aoedev, "AoE %s/%08x CONFIG rsp buf %04x fw %04x scnt %02x\n",
554  aoedev_name ( aoedev ), aoecmd->tag, ntohs ( aoecfg->bufcnt ),
555  aoecfg->fwver, aoecfg->scnt );
556 
557  /* Record target MAC address */
558  memcpy ( aoedev->target, ll_source, ll_protocol->ll_addr_len );
559  DBGC ( aoedev, "AoE %s has MAC address %s\n",
560  aoedev_name ( aoedev ), ll_protocol->ntoa ( aoedev->target ) );
561 
562  return 0;
563 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct aoecfg cfg
Config command.
Definition: aoe.h:62
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:82
uint16_t fwver
ATA target firmware version.
Definition: aoe.h:24
#define ntohs(value)
Definition: byteswap.h:136
A link-layer protocol.
Definition: netdevice.h:114
An AoE device.
Definition: aoe.c:72
void * memcpy(void *dest, const void *src, size_t len) __nonnull
An AoE command.
Definition: aoe.h:60
uint8_t target[MAX_LL_ADDR_LEN]
Target MAC address.
Definition: aoe.c:86
An AoE config command.
Definition: aoe.h:20
uint16_t bufcnt
AoE queue depth.
Definition: aoe.h:22
uint32_t len
Length.
Definition: ena.h:14
struct net_device * netdev
Network device.
Definition: aoe.c:77
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:26
An AoE header.
Definition: aoe.h:68
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
struct ll_protocol * ll_protocol
Link-layer protocol.
Definition: netdevice.h:366
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:203

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 587 of file aoe.c.

587  {
588  struct aoe_command *aoecmd;
589 
590  list_for_each_entry ( aoecmd, &aoe_commands, list ) {
591  if ( aoecmd->tag == tag )
592  return aoecmd;
593  }
594  return NULL;
595 }
struct list_head list
List of active commands.
Definition: aoe.c:107
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:420
An AoE command.
Definition: aoe.h:60
uint64_t tag
Identity tag.
Definition: edd.h:30
An AoE command.
Definition: aoe.c:101
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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 602 of file aoe.c.

602  {
603  static uint16_t tag_idx;
604  unsigned int i;
605 
606  for ( i = 0 ; i < 65536 ; i++ ) {
607  tag_idx++;
608  if ( aoecmd_find_tag ( tag_idx ) == NULL )
609  return ( AOE_TAG_MAGIC | tag_idx );
610  }
611  return -EADDRINUSE;
612 }
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:587
#define AOE_TAG_MAGIC
AoE tag magic marker.
Definition: aoe.h:107
#define EADDRINUSE
Address already in use.
Definition: errno.h:303
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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 621 of file aoe.c.

622  {
623  struct aoe_command *aoecmd;
624  int tag;
625 
626  /* Allocate command tag */
627  tag = aoecmd_new_tag();
628  if ( tag < 0 )
629  return NULL;
630 
631  /* Allocate and initialise structure */
632  aoecmd = zalloc ( sizeof ( *aoecmd ) );
633  if ( ! aoecmd )
634  return NULL;
635  ref_init ( &aoecmd->refcnt, aoecmd_free );
636  list_add ( &aoecmd->list, &aoe_commands );
637  intf_init ( &aoecmd->ata, &aoecmd_ata_desc, &aoecmd->refcnt );
638  timer_init ( &aoecmd->timer, aoecmd_expired, &aoecmd->refcnt );
639  aoecmd->aoedev = aoedev_get ( aoedev );
640  aoecmd->type = type;
641  aoecmd->tag = tag;
642 
643  /* Preserve timeout from last completed command */
644  aoecmd->timer.timeout = aoedev->timeout;
645 
646  /* Return already mortalised. (Reference is held by command list.) */
647  return aoecmd;
648 }
static struct aoe_device * aoedev_get(struct aoe_device *aoedev)
Get reference to AoE device.
Definition: aoe.c:160
#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:578
uint8_t type
Type.
Definition: ena.h:16
static int aoecmd_new_tag(void)
Choose an AoE command tag.
Definition: aoe.c:602
unsigned long timeout
Saved timeout value.
Definition: aoe.c:89
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:105
An AoE command.
Definition: aoe.h:60
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
static void aoecmd_expired(struct retry_timer *timer, int fail)
Handle AoE retry timer expiry.
Definition: aoe.c:366
static void aoecmd_free(struct refcnt *refcnt)
Free AoE command.
Definition: aoe.c:216
struct aoeata ata
ATA command.
Definition: aoe.h:64
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:173
uint64_t tag
Identity tag.
Definition: edd.h:30
An AoE command.
Definition: aoe.c:101
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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 658 of file aoe.c.

660  {
661  struct net_device *netdev = aoedev->netdev;
662  struct aoe_command *aoecmd;
663 
664  /* Fail immediately if net device is closed */
665  if ( ! netdev_is_open ( netdev ) ) {
666  DBGC ( aoedev, "AoE %s cannot issue command while net device "
667  "is closed\n", aoedev_name ( aoedev ) );
668  return -EWOULDBLOCK;
669  }
670 
671  /* Create command */
673  if ( ! aoecmd )
674  return -ENOMEM;
675  memcpy ( &aoecmd->command, command, sizeof ( aoecmd->command ) );
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 }
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:102
static int aoecmd_tx(struct aoe_command *aoecmd)
Transmit AoE command request.
Definition: aoe.c:259
#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:652
#define EWOULDBLOCK
Operation would block.
Definition: errno.h:679
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:105
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:621
An AoE command.
Definition: aoe.h:60
A network device.
Definition: netdevice.h:348
static struct aoe_command_type aoecmd_ata
AoE ATA command.
Definition: aoe.c:490
struct net_device * netdev
Network device.
Definition: aoe.c:77
struct aoeata ata
ATA command.
Definition: aoe.h:64
An AoE command.
Definition: aoe.c:101
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:203

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 696 of file aoe.c.

697  {
698  struct aoe_command *aoecmd;
699 
700  /* Create command */
702  if ( ! aoecmd )
703  return -ENOMEM;
704 
705  /* Attempt to send command. Allow failures to be handled by
706  * the retry timer.
707  */
708  aoecmd_tx ( aoecmd );
709 
710  /* Attach to parent interface, leave reference with command
711  * list, and return.
712  */
713  intf_plug_plug ( &aoecmd->ata, parent );
714  return aoecmd->tag;
715 }
static struct aoe_command_type aoecmd_cfg
AoE configuration command.
Definition: aoe.c:566
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition: interface.c:102
static int aoecmd_tx(struct aoe_command *aoecmd)
Transmit AoE command request.
Definition: aoe.c:259
#define ENOMEM
Not enough space.
Definition: errno.h:534
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:105
static struct aoe_command * aoecmd_create(struct aoe_device *aoedev, struct aoe_command_type *type)
Create AoE command.
Definition: aoe.c:621
An AoE command.
Definition: aoe.h:60
struct aoeata ata
ATA command.
Definition: aoe.h:64
An AoE command.
Definition: aoe.c:101

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 722 of file aoe.c.

722  {
723  struct aoe_device *aoedev =
724  container_of ( refcnt, struct aoe_device, refcnt );
725 
726  netdev_put ( aoedev->netdev );
727  free ( aoedev );
728 }
An AoE device.
Definition: aoe.c:72
A reference counter.
Definition: refcnt.h:26
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:555
#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.c:77

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 736 of file aoe.c.

736  {
737  struct aoe_command *aoecmd;
738  struct aoe_command *tmp;
739 
740  /* Shut down interfaces */
741  intf_shutdown ( &aoedev->ata, rc );
742  intf_shutdown ( &aoedev->config, rc );
743 
744  /* Shut down any active commands */
745  list_for_each_entry_safe ( aoecmd, tmp, &aoe_commands, list ) {
746  if ( aoecmd->aoedev != aoedev )
747  continue;
748  aoecmd_get ( aoecmd );
749  aoecmd_close ( aoecmd, rc );
750  aoecmd_put ( aoecmd );
751  }
752 }
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:273
struct list_head list
List of active commands.
Definition: aoe.c:107
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:105
struct interface ata
ATA command issuing interface.
Definition: aoe.c:79
#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:447
An AoE command.
Definition: aoe.h:60
uint8_t * tmp
Definition: entropy.h:156
struct interface config
Configuration command interface.
Definition: aoe.c:92
static void aoecmd_put(struct aoe_command *aoecmd)
Drop reference to AoE command.
Definition: aoe.c:193
static void aoecmd_close(struct aoe_command *aoecmd, int rc)
Close AoE command.
Definition: aoe.c:233
static struct aoe_command * aoecmd_get(struct aoe_command *aoecmd)
Get reference to AoE command.
Definition: aoe.c:182
An AoE command.
Definition: aoe.c:101

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 760 of file aoe.c.

760  {
761  return ( aoedev->configured ? ~( ( size_t ) 0 ) : 0 );
762 }
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:105
int configured
Device is configued.
Definition: aoe.c:94

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 770 of file aoe.c.

770  {
771 
772  /* Shut down interface */
773  intf_shutdown ( &aoedev->config, rc );
774 
775  /* Close device on failure */
776  if ( rc != 0 ) {
777  aoedev_close ( aoedev, rc );
778  return;
779  }
780 
781  /* Mark device as configured */
782  aoedev->configured = 1;
784 }
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:145
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:273
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:105
struct interface ata
ATA command issuing interface.
Definition: aoe.c:79
static void aoedev_close(struct aoe_device *aoedev, int rc)
Close AoE device.
Definition: aoe.c:736
struct interface config
Configuration command interface.
Definition: aoe.c:92
int configured
Device is configued.
Definition: aoe.c:94

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 792 of file aoe.c.

792  {
793  return aoedev->netdev->dev;
794 }
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:105
struct device * dev
Underlying hardware device.
Definition: netdevice.h:360
struct net_device * netdev
Network device.
Definition: aoe.c:77

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 802 of file aoe.c.

802  {
803  return &aoedev->desc;
804 }
struct aoe_device * aoedev
AOE device.
Definition: aoe.c:105
struct acpi_descriptor desc
ACPI descriptor.
Definition: aoe.c:97

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 838 of file aoe.c.

839  {
840  struct aoe_device *aoedev;
841  int rc;
842 
843  /* Allocate and initialise structure */
844  aoedev = zalloc ( sizeof ( *aoedev ) );
845  if ( ! aoedev ) {
846  rc = -ENOMEM;
847  goto err_zalloc;
848  }
849  ref_init ( &aoedev->refcnt, aoedev_free );
850  intf_init ( &aoedev->ata, &aoedev_ata_desc, &aoedev->refcnt );
851  intf_init ( &aoedev->config, &aoedev_config_desc, &aoedev->refcnt );
852  aoedev->netdev = netdev_get ( netdev );
853  aoedev->major = major;
854  aoedev->minor = minor;
855  memcpy ( aoedev->target, netdev->ll_broadcast,
857  acpi_init ( &aoedev->desc, &abft_model, &aoedev->refcnt );
858 
859  /* Initiate configuration */
860  if ( ( rc = aoedev_cfg_command ( aoedev, &aoedev->config ) ) < 0 ) {
861  DBGC ( aoedev, "AoE %s could not initiate configuration: %s\n",
862  aoedev_name ( aoedev ), strerror ( rc ) );
863  goto err_config;
864  }
865 
866  /* Attach ATA device to parent interface */
867  if ( ( rc = ata_open ( parent, &aoedev->ata, ATA_DEV_MASTER,
868  AOE_MAX_COUNT ) ) != 0 ) {
869  DBGC ( aoedev, "AoE %s could not create ATA device: %s\n",
870  aoedev_name ( aoedev ), strerror ( rc ) );
871  goto err_ata_open;
872  }
873 
874  /* Mortalise self and return */
875  ref_put ( &aoedev->refcnt );
876  return 0;
877 
878  err_ata_open:
879  err_config:
880  aoedev_close ( aoedev, rc );
881  ref_put ( &aoedev->refcnt );
882  err_zalloc:
883  return rc;
884 }
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:826
#define AOE_MAX_COUNT
Maximum number of sectors per packet.
Definition: aoe.h:110
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition: refcnt.h:64
uint16_t major
Major number.
Definition: aoe.c:82
#define DBGC(...)
Definition: compiler.h:505
const uint8_t * ll_broadcast
Link-layer broadcast address.
Definition: netdevice.h:383
uint32_t major
Major version.
Definition: netvsc.h:14
An AoE device.
Definition: aoe.c:72
uint32_t minor
Minor version.
Definition: netvsc.h:16
#define ENOMEM
Not enough space.
Definition: errno.h:534
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#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.c:97
static int aoedev_cfg_command(struct aoe_device *aoedev, struct interface *parent)
Issue AoE configuration command.
Definition: aoe.c:696
struct interface ata
ATA command issuing interface.
Definition: aoe.c:79
uint8_t target[MAX_LL_ADDR_LEN]
Target MAC address.
Definition: aoe.c:86
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:736
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
struct refcnt refcnt
Reference counter.
Definition: aoe.c:74
struct interface config
Configuration command interface.
Definition: aoe.c:92
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
Definition: netdevice.h:544
uint8_t minor
Minor number.
Definition: aoe.c:84
struct net_device * netdev
Network device.
Definition: aoe.c:77
static void aoedev_free(struct refcnt *refcnt)
Free AoE device.
Definition: aoe.c:722
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:817
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:173
struct ll_protocol * ll_protocol
Link-layer protocol.
Definition: netdevice.h:366
#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:160
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
Definition: aoe.c:203

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 903 of file aoe.c.

907  {
908  struct aoehdr *aoehdr = iobuf->data;
909  struct aoe_command *aoecmd;
910  int rc;
911 
912  /* Sanity check */
913  if ( iob_len ( iobuf ) < sizeof ( *aoehdr ) ) {
914  DBG ( "AoE received underlength packet (%zd bytes)\n",
915  iob_len ( iobuf ) );
916  rc = -EINVAL;
917  goto err_sanity;
918  }
919  if ( ( aoehdr->ver_flags & AOE_VERSION_MASK ) != AOE_VERSION ) {
920  DBG ( "AoE received packet for unsupported protocol version "
921  "%02x\n", ( aoehdr->ver_flags & AOE_VERSION_MASK ) );
922  rc = -EPROTONOSUPPORT;
923  goto err_sanity;
924  }
925  if ( ! ( aoehdr->ver_flags & AOE_FL_RESPONSE ) ) {
926  DBG ( "AoE received request packet\n" );
927  rc = -EOPNOTSUPP;
928  goto err_sanity;
929  }
930 
931  /* Demultiplex amongst active AoE commands */
933  if ( ! aoecmd ) {
934  DBG ( "AoE received packet for unused tag %08x\n",
935  ntohl ( aoehdr->tag ) );
936  rc = -ENOENT;
937  goto err_demux;
938  }
939 
940  /* Pass received frame to command */
941  aoecmd_get ( aoecmd );
942  if ( ( rc = aoecmd_rx ( aoecmd, iob_disown ( iobuf ),
943  ll_source ) ) != 0 )
944  goto err_rx;
945 
946  err_rx:
947  aoecmd_put ( aoecmd );
948  err_demux:
949  err_sanity:
950  free_iob ( iobuf );
951  return rc;
952 }
#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:587
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
#define AOE_VERSION_MASK
Version part of ver_flags field.
Definition: aoe.h:86
#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:208
#define AOE_VERSION
Version 1.
Definition: aoe.h:85
An AoE command.
Definition: aoe.h:60
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
uint32_t tag
Tag, in network byte order.
Definition: aoe.h:80
#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:313
#define EPROTONOSUPPORT
Protocol not supported.
Definition: errno.h:629
void * data
Start of data.
Definition: iobuf.h:44
static void aoecmd_put(struct aoe_command *aoecmd)
Drop reference to AoE command.
Definition: aoe.c:193
uint8_t ver_flags
Protocol version number and flags.
Definition: aoe.h:70
An AoE header.
Definition: aoe.h:68
#define AOE_FL_RESPONSE
Message is a response.
Definition: aoe.h:88
#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:182
An AoE command.
Definition: aoe.c:101

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 978 of file aoe.c.

979  {
980  const char *ptr;
981  char *end;
982 
983  /* Check for URI with opaque portion */
984  if ( ! uri->opaque )
985  return -EINVAL;
986  ptr = uri->opaque;
987 
988  /* Check for initial 'e' */
989  if ( *ptr != 'e' )
990  return -EINVAL;
991  ptr++;
992 
993  /* Parse major device number */
994  *major = strtoul ( ptr, &end, 10 );
995  if ( *end != '.' )
996  return -EINVAL;
997  ptr = ( end + 1 );
998 
999  /* Parse minor device number */
1000  *minor = strtoul ( ptr, &end, 10 );
1001  if ( *end )
1002  return -EINVAL;
1003 
1004  return 0;
1005 }
#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:441
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:56
uint32_t end
Ending offset.
Definition: netvsc.h:18
A Uniform Resource Identifier.
Definition: uri.h:50

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 1014 of file aoe.c.

1014  {
1015  struct net_device *netdev;
1016  unsigned int major;
1017  unsigned int minor;
1018  int rc;
1019 
1020  /* Identify network device. This is something of a hack, but
1021  * the AoE URI scheme that has been in use for some time now
1022  * provides no way to specify a particular device.
1023  */
1025  if ( ! netdev ) {
1026  DBG ( "AoE cannot identify network device\n" );
1027  return -ENODEV;
1028  }
1029 
1030  /* Parse URI */
1031  if ( ( rc = aoe_parse_uri ( uri, &major, &minor ) ) != 0 ) {
1032  DBG ( "AoE cannot parse URI\n" );
1033  return rc;
1034  }
1035 
1036  /* Open AoE device */
1037  if ( ( rc = aoedev_open ( parent, netdev, major, minor ) ) != 0 )
1038  return rc;
1039 
1040  return 0;
1041 }
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:978
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:973
A network device.
Definition: netdevice.h:348
#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:838
A Uniform Resource Identifier.
Definition: uri.h:50
#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 1062 of file aoe.c.

1062  {
1063  return 0;
1064 }

◆ 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 1072 of file aoe.c.

1072  {
1073  struct aoe_device *aoedev;
1074  struct abft_table abft;
1075  int rc;
1076 
1077  list_for_each_entry ( aoedev, &abft_model.descs, desc.list ) {
1078 
1079  /* Populate table */
1080  memset ( &abft, 0, sizeof ( abft ) );
1081  abft.acpi.signature = cpu_to_le32 ( ABFT_SIG );
1082  abft.acpi.length = cpu_to_le32 ( sizeof ( abft ) );
1083  abft.acpi.revision = 1;
1084  abft.shelf = cpu_to_le16 ( aoedev->major );
1085  abft.slot = aoedev->minor;
1086  memcpy ( abft.mac, aoedev->netdev->ll_addr,
1087  sizeof ( abft.mac ) );
1088 
1089  /* Install table */
1090  if ( ( rc = install ( &abft.acpi ) ) != 0 ) {
1091  DBGC ( aoedev, "AoE %s could not install aBFT: %s\n",
1092  aoedev_name ( aoedev ), strerror ( rc ) );
1093  return rc;
1094  }
1095  }
1096 
1097  return 0;
1098 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
uint16_t major
Major number.
Definition: aoe.c:82
#define DBGC(...)
Definition: compiler.h:505
An AoE device.
Definition: aoe.c:72
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:420
#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:118
#define ABFT_SIG
AoE boot firmware table signature.
Definition: aoe.h:113
#define cpu_to_le16(value)
Definition: byteswap.h:106
uint8_t minor
Minor number.
Definition: aoe.c:84
struct net_device * netdev
Network device.
Definition: aoe.c:77
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:381
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:203

References ABFT_SIG, abft_table::acpi, aoedev_name(), cpu_to_le16, cpu_to_le32, DBGC, 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:903
#define ETH_P_AOE
Definition: if_ether.h:25
#define htons(value)
Definition: byteswap.h:135

AoE protocol.

Definition at line 55 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:1062
static int abft_install(int(*install)(struct acpi_header *acpi))
Install AoE boot firmware table(s)
Definition: aoe.c:1072
#define LIST_HEAD_INIT(list)
Initialise a static list head.
Definition: list.h:30

aBFT model

Definition at line 56 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:383
static void aoecmd_ata_cmd(struct aoe_command *aoecmd, void *data, size_t len)
Build AoE ATA command IU.
Definition: aoe.c:397
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:445

AoE ATA command.

Definition at line 490 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:513
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:539
static size_t aoecmd_cfg_cmd_len(struct aoe_command *aoecmd __unused)
Calculate length of AoE configuration command IU.
Definition: aoe.c:502

AoE configuration command.

Definition at line 566 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:244
#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:233
An AoE command.
Definition: aoe.c:101

AoE command ATA interface operations.

Definition at line 573 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:573
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:65
An AoE command.
Definition: aoe.c:101

AoE command ATA interface descriptor.

Definition at line 578 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:244
static size_t aoedev_window(struct aoe_device *aoedev)
Check AoE device flow-control window.
Definition: aoe.c:760
static int aoedev_ata_command(struct aoe_device *aoedev, struct interface *parent, struct ata_cmd *command)
Issue AoE ATA command.
Definition: aoe.c:658
size_t xfer_window(struct interface *intf)
Check flow control window.
Definition: xfer.c:115
An AoE device.
Definition: aoe.c:72
static void aoedev_close(struct aoe_device *aoedev, int rc)
Close AoE device.
Definition: aoe.c:736
#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:334
static struct device * aoedev_identify_device(struct aoe_device *aoedev)
Identify device underlying AoE device.
Definition: aoe.c:792
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:802

AoE device ATA interface operations.

Definition at line 807 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:807
An AoE device.
Definition: aoe.c:72
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:65

AoE device ATA interface descriptor.

Definition at line 817 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:244
An AoE device.
Definition: aoe.c:72
#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:770

AoE device configuration interface operations.

Definition at line 821 of file aoe.c.

◆ aoedev_config_desc

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

AoE device configuration interface descriptor.

Definition at line 826 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:1014

AoE URI opener.

Definition at line 1044 of file aoe.c.