iPXE
|
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_device * | aoedev_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_command * | aoecmd_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_command * | aoecmd_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_command * | aoecmd_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 device * | aoedev_identify_device (struct aoe_device *aoedev) |
Identify device underlying AoE device. More... | |
static struct acpi_descriptor * | aoedev_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... | |
AoE protocol.
Definition in file aoe.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
FEATURE | ( | FEATURE_PROTOCOL | , |
"AoE" | , | ||
DHCP_EB_FEATURE_AOE | , | ||
1 | |||
) |
|
static |
List of all AoE devices.
|
static |
List of active AoE commands.
|
inlinestatic |
Get reference to AoE device.
aoedev | AoE device |
aoedev | AoE device |
Definition at line 132 of file aoe.c.
References ref_get, and aoe_device::refcnt.
Referenced by aoecmd_create().
|
inlinestatic |
Drop reference to AoE device.
aoedev | AoE device |
Definition at line 143 of file aoe.c.
References ref_put, and aoe_device::refcnt.
Referenced by aoecmd_free().
|
inlinestatic |
Get reference to AoE command.
aoecmd | AoE command |
aoecmd | AoE command |
Definition at line 154 of file aoe.c.
References ref_get.
Referenced by aoe_rx(), and aoedev_close().
|
inlinestatic |
Drop reference to AoE command.
aoecmd | AoE command |
Definition at line 165 of file aoe.c.
References ref_put.
Referenced by aoe_rx(), aoecmd_close(), and aoedev_close().
|
static |
Name AoE device.
aoedev | AoE device |
name | AoE device name |
Definition at line 175 of file aoe.c.
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().
|
static |
Free AoE command.
refcnt | Reference counter |
Definition at line 188 of file aoe.c.
References aoedev_put(), assert(), container_of, free, and list_empty.
Referenced by aoecmd_create().
|
static |
Close AoE command.
aoecmd | AoE command |
rc | Reason for close |
Definition at line 205 of file aoe.c.
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().
|
static |
Transmit AoE command request.
aoecmd | AoE command |
rc | Return status code |
Definition at line 231 of file aoe.c.
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().
|
static |
Receive AoE command response.
aoecmd | AoE command |
iobuf | I/O buffer |
ll_source | Link-layer source address |
rc | Return status code |
Definition at line 285 of file aoe.c.
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().
|
static |
Handle AoE retry timer expiry.
timer | AoE retry timer |
fail | Failure indicator |
Definition at line 338 of file aoe.c.
References aoecmd_close(), aoecmd_tx(), container_of, and ETIMEDOUT.
Referenced by aoecmd_create().
|
static |
|
static |
Build AoE ATA command IU.
aoecmd | AoE command |
data | Command IU |
len | Length of command IU |
Definition at line 369 of file aoe.c.
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.
|
static |
Handle AoE ATA response IU.
aoecmd | AoE command |
data | Response IU |
len | Length of response IU |
ll_source | Link-layer source address |
rc | Return status code |
Definition at line 417 of file aoe.c.
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.
|
static |
Calculate length of AoE configuration command IU.
aoecmd | AoE command |
len | Length of command IU |
|
static |
Build AoE configuration command IU.
aoecmd | AoE command |
data | Command IU |
len | Length of command IU |
Definition at line 485 of file aoe.c.
References AOE_CMD_CONFIG, aoedev_name(), assert(), aoecmd::cfg, aoehdr::command, data, DBGC, len, memset(), and aoehdr::payload.
|
static |
Handle AoE configuration response IU.
aoecmd | AoE command |
data | Response IU |
len | Length of response IU |
ll_source | Link-layer source address |
rc | Return status code |
Definition at line 511 of file aoe.c.
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.
|
static |
Identify AoE command by tag.
tag | Command tag |
aoecmd | AoE command, or NULL |
Definition at line 559 of file aoe.c.
References aoe_command::list, list_for_each_entry, NULL, and tag.
Referenced by aoe_rx(), and aoecmd_new_tag().
|
static |
Choose an AoE command tag.
tag | New tag, or negative error |
Definition at line 574 of file aoe.c.
References AOE_TAG_MAGIC, aoecmd_find_tag(), EADDRINUSE, and NULL.
Referenced by aoecmd_create().
|
static |
Create AoE command.
aoedev | AoE device |
type | AoE command type |
aoecmd | AoE command |
Definition at line 593 of file aoe.c.
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().
|
static |
Issue AoE ATA command.
aoedev | AoE device |
parent | Parent interface |
command | ATA command |
tag | Command tag, or negative error |
Definition at line 630 of file aoe.c.
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().
|
static |
Issue AoE configuration command.
aoedev | AoE device |
parent | Parent interface |
tag | Command tag, or negative error |
Definition at line 668 of file aoe.c.
References aoecmd_cfg, aoecmd_create(), aoecmd_tx(), aoe_command::aoedev, aoecmd::ata, ENOMEM, and intf_plug_plug().
Referenced by aoedev_open().
|
static |
Free AoE device.
refcnt | Reference count |
Definition at line 694 of file aoe.c.
References container_of, free, aoe_device::netdev, and netdev_put().
Referenced by aoedev_open().
|
static |
Close AoE device.
aoedev | AoE device |
rc | Reason for close |
Definition at line 708 of file aoe.c.
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().
|
static |
Check AoE device flow-control window.
aoedev | AoE device |
len | Length of window |
Definition at line 732 of file aoe.c.
References aoe_command::aoedev, and aoe_device::configured.
|
static |
Handle AoE device configuration completion.
aoedev | AoE device |
rc | Reason for completion |
Definition at line 742 of file aoe.c.
References aoe_command::aoedev, aoedev_close(), aoe_device::ata, aoe_device::config, aoe_device::configured, intf_shutdown(), rc, and xfer_window_changed().
|
static |
Identify device underlying AoE device.
aoedev | AoE device |
device | Underlying device |
Definition at line 764 of file aoe.c.
References net_device::dev, and aoe_device::netdev.
|
static |
Get AoE ACPI descriptor.
aoedev | AoE device |
desc | ACPI descriptor |
Definition at line 774 of file aoe.c.
References aoe_device::desc.
|
static |
Open AoE device.
parent | Parent interface |
netdev | Network device |
major | Device major number |
minor | Device minor number |
rc | Return status code |
Definition at line 811 of file aoe.c.
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().
|
static |
Process incoming AoE packets.
iobuf | I/O buffer |
netdev | Network device |
ll_dest | Link-layer destination address |
ll_source | Link-layer source address |
flags | Packet flags |
rc | Return status code |
Definition at line 876 of file aoe.c.
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.
|
static |
Parse AoE URI.
uri | URI |
major | Major device number |
minor | Minor device number |
rc | Return status code |
An AoE URI has the form "aoe:e<major>.<minor>".
Definition at line 951 of file aoe.c.
References EINVAL, end, major, minor, uri::opaque, and strtoul().
Referenced by aoe_open().
Open AoE URI.
parent | Parent interface |
uri | URI |
rc | Return status code |
Definition at line 987 of file aoe.c.
References aoe_parse_uri(), aoedev_open(), DBG, ENODEV, last_opened_netdev(), major, minor, netdev, and rc.
|
static |
|
static |
Install AoE boot firmware table(s)
install | Installation method |
rc | Return status code |
Definition at line 1045 of file aoe.c.
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().
struct net_protocol aoe_protocol __net_protocol |
struct acpi_model abft_model __acpi_model |
aBFT model
|
static |
AoE ATA command.
Definition at line 462 of file aoe.c.
Referenced by aoedev_ata_command().
|
static |
AoE configuration command.
Definition at line 538 of file aoe.c.
Referenced by aoedev_cfg_command().
|
static |
AoE command ATA interface operations.
|
static |
AoE command ATA interface descriptor.
Definition at line 550 of file aoe.c.
Referenced by aoecmd_create().
|
static |
AoE device ATA interface operations.
|
static |
AoE device ATA interface descriptor.
Definition at line 790 of file aoe.c.
Referenced by aoedev_open().
|
static |
AoE device configuration interface operations.
|
static |
AoE device configuration interface descriptor.
Definition at line 799 of file aoe.c.
Referenced by aoedev_open().