|
| | FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
| | FILE_SECBOOT (PERMITTED) |
| | FEATURE (FEATURE_PROTOCOL, "AoE", DHCP_EB_FEATURE_AOE, 1) |
| static | LIST_HEAD (aoe_devices) |
| | List of all AoE devices.
|
| static | LIST_HEAD (aoe_commands) |
| | List of active AoE commands.
|
| static struct aoe_device * | aoedev_get (struct aoe_device *aoedev) |
| | Get reference to AoE device.
|
| static void | aoedev_put (struct aoe_device *aoedev) |
| | Drop reference to AoE device.
|
| static struct aoe_command * | aoecmd_get (struct aoe_command *aoecmd) |
| | Get reference to AoE command.
|
| static void | aoecmd_put (struct aoe_command *aoecmd) |
| | Drop reference to AoE command.
|
| static const char * | aoedev_name (struct aoe_device *aoedev) |
| | Name AoE device.
|
| static void | aoecmd_free (struct refcnt *refcnt) |
| | Free AoE command.
|
| static void | aoecmd_close (struct aoe_command *aoecmd, int rc) |
| | Close AoE command.
|
| static int | aoecmd_tx (struct aoe_command *aoecmd) |
| | Transmit AoE command request.
|
| static int | aoecmd_rx (struct aoe_command *aoecmd, struct io_buffer *iobuf, const void *ll_source) |
| | Receive AoE command response.
|
| static void | aoecmd_expired (struct retry_timer *timer, int fail) |
| | Handle AoE retry timer expiry.
|
| static size_t | aoecmd_ata_cmd_len (struct aoe_command *aoecmd) |
| | Calculate length of AoE ATA command IU.
|
| static void | aoecmd_ata_cmd (struct aoe_command *aoecmd, void *data, size_t len) |
| | Build AoE ATA command IU.
|
| 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.
|
| static size_t | aoecmd_cfg_cmd_len (struct aoe_command *aoecmd __unused) |
| | Calculate length of AoE configuration command IU.
|
| static void | aoecmd_cfg_cmd (struct aoe_command *aoecmd, void *data, size_t len) |
| | Build AoE configuration command IU.
|
| static int | aoecmd_cfg_rsp (struct aoe_command *aoecmd, const void *data, size_t len, const void *ll_source) |
| | Handle AoE configuration response IU.
|
| static struct aoe_command * | aoecmd_find_tag (uint32_t tag) |
| | Identify AoE command by tag.
|
| static int | aoecmd_new_tag (void) |
| | Choose an AoE command tag.
|
| static struct aoe_command * | aoecmd_create (struct aoe_device *aoedev, struct aoe_command_type *type) |
| | Create AoE command.
|
| static int | aoedev_ata_command (struct aoe_device *aoedev, struct interface *parent, struct ata_cmd *command) |
| | Issue AoE ATA command.
|
| static int | aoedev_cfg_command (struct aoe_device *aoedev, struct interface *parent) |
| | Issue AoE configuration command.
|
| static void | aoedev_free (struct refcnt *refcnt) |
| | Free AoE device.
|
| static void | aoedev_close (struct aoe_device *aoedev, int rc) |
| | Close AoE device.
|
| static size_t | aoedev_window (struct aoe_device *aoedev) |
| | Check AoE device flow-control window.
|
| static void | aoedev_config_done (struct aoe_device *aoedev, int rc) |
| | Handle AoE device configuration completion.
|
| static struct device * | aoedev_identify_device (struct aoe_device *aoedev) |
| | Identify device underlying AoE device.
|
| static struct acpi_descriptor * | aoedev_describe (struct aoe_device *aoedev) |
| | Get AoE ACPI descriptor.
|
| static int | aoedev_open (struct interface *parent, struct net_device *netdev, unsigned int major, unsigned int minor) |
| | Open AoE device.
|
| 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.
|
| static int | aoe_parse_uri (struct uri *uri, unsigned int *major, unsigned int *minor) |
| | Parse AoE URI.
|
| static int | aoe_open (struct interface *parent, struct uri *uri) |
| | Open AoE URI.
|
| static int | abft_complete (struct acpi_descriptor *desc __unused) |
| | Check if AoE boot firmware table descriptor is complete.
|
| static int | abft_install (int(*install)(struct acpi_header *acpi)) |
| | Install AoE boot firmware table(s)
|
AoE protocol.
Definition in file aoe.c.
Transmit AoE command request.
- Parameters
-
- Return values
-
Definition at line 231 of file aoe.c.
231 {
236 size_t cmd_len;
238
239
241
242
243
244
245
246
248
249
252 if ( ! iobuf )
256
257
264
265
267 netdev->ll_addr ) ) != 0 ) {
268 DBGC ( aoedev,
"AoE %s/%08x could not transmit: %s\n",
272 }
273
274 return 0;
275}
#define NULL
NULL pointer (VOID *)
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
#define AOE_VERSION
Version 1.
static struct net_device * netdev
#define ENOMEM
Not enough space.
void * memset(void *dest, int character, size_t len) __nonnull
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define iob_put(iobuf, len)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_reserve(iobuf, len)
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.
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
void start_timer(struct retry_timer *timer)
Start timer.
char * strerror(int errno)
Retrieve string representation of error number.
uint8_t target[MAX_LL_ADDR_LEN]
Target MAC address.
uint16_t major
Major device number, in network byte order.
uint32_t tag
Tag, in network byte order.
uint8_t ver_flags
Protocol version number and flags.
uint8_t minor
Minor device number.
void * data
Start of data.
References alloc_iob(), AOE_VERSION, aoedev_name(), assert, io_buffer::data, DBGC, ENOMEM, htonl, htons, iob_len(), iob_put, iob_reserve, aoe_device::major, aoehdr::major, MAX_LL_HEADER_LEN, memset(), aoe_device::minor, aoehdr::minor, net_tx(), aoe_device::netdev, 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().
Build AoE ATA command IU.
- Parameters
-
| aoecmd | AoE command |
| data | Command IU |
| len | Length of command IU |
Definition at line 369 of file aoe.c.
370 {
375
376
380
381
395
396 DBGC2 ( aoedev,
"AoE %s/%08x ATA cmd %02x:%02x:%02x:%02x:%08llx",
404 DBGC2 ( aoedev,
"\n" );
405}
#define AOE_FL_WRITE
Write command.
#define AOE_FL_DEV_HEAD
Device/head flag.
#define AOE_CMD_ATA
Issue ATA command.
#define AOE_FL_EXTENDED
LBA48 extended addressing.
#define ATA_DEV_SLAVE
Slave ("device 1") flag in the ATA device register.
#define ATA_DEV_MASK
Mask of non-LBA portion of device register.
uint8_t data[48]
Additional event data.
#define cpu_to_le64(value)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint8_t cmd_stat
ATA command/status register.
uint8_t data[0]
Data payload.
uint8_t count
ATA sector count register.
uint8_t aflags
AoE command flags.
uint8_t err_feat
ATA error/feature register.
union aoeata::@075054160020220033235346100236214147067212322041 lba
Logical block address, in little-endian order.
uint8_t command
Command number.
union aoecmd payload[0]
Payload.
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, aoeata::count, cpu_to_le64, aoeata::data, data, DBGC2, aoeata::err_feat, aoeata::lba, len, memcpy(), memset(), aoehdr::payload, and aoeata::u64.
| int aoedev_open |
( |
struct interface * | parent, |
|
|
struct net_device * | netdev, |
|
|
unsigned int | major, |
|
|
unsigned int | minor ) |
|
static |
Open AoE device.
- Parameters
-
| parent | Parent interface |
| netdev | Network device |
| major | Device major number |
| minor | Device minor number |
- Return values
-
Definition at line 809 of file aoe.c.
810 {
813
814
815 aoedev =
zalloc (
sizeof ( *aoedev ) );
816 if ( ! aoedev ) {
818 goto err_zalloc;
819 }
827 netdev->ll_protocol->ll_addr_len );
829
830
832 DBGC ( aoedev,
"AoE %s could not initiate configuration: %s\n",
834 goto err_config;
835 }
836
837
840 DBGC ( aoedev,
"AoE %s could not create ATA device: %s\n",
842 goto err_ata_open;
843 }
844
845
847 return 0;
848
849 err_ata_open:
850 err_config:
853 err_zalloc:
855}
static void aoedev_free(struct refcnt *refcnt)
Free AoE device.
static struct interface_descriptor aoedev_ata_desc
AoE device ATA interface descriptor.
static int aoedev_cfg_command(struct aoe_device *aoedev, struct interface *parent)
Issue AoE configuration command.
static struct interface_descriptor aoedev_config_desc
AoE device configuration interface descriptor.
#define AOE_MAX_COUNT
Maximum number of sectors per packet.
int ata_open(struct interface *block, struct interface *ata, unsigned int device, unsigned int max_count)
Open ATA device.
#define ATA_DEV_MASTER
Master ("device 0") flag in the ATA device register.
static void acpi_init(struct acpi_descriptor *desc, struct acpi_model *model, struct refcnt *refcnt)
Initialise ACPI descriptor.
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
uint32_t major
Major version.
uint32_t minor
Minor version.
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(), aoe_device::major, major, memcpy(), aoe_device::minor, minor, aoe_device::netdev, netdev, netdev_get(), rc, ref_init, ref_put, aoe_device::refcnt, strerror(), aoe_device::target, and zalloc().
Referenced by aoe_open().
| 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
-
| iobuf | I/O buffer |
| netdev | Network device |
| ll_dest | Link-layer destination address |
| ll_source | Link-layer source address |
| flags | Packet flags |
- Return values
-
Definition at line 874 of file aoe.c.
878 {
882
883
885 DBG (
"AoE received underlength packet (%zd bytes)\n",
888 goto err_sanity;
889 }
891 DBG (
"AoE received packet for unsupported protocol version "
894 goto err_sanity;
895 }
897 DBG (
"AoE received request packet\n" );
899 goto err_sanity;
900 }
901
902
905 DBG (
"AoE received packet for unused tag %08x\n",
908 goto err_demux;
909 }
910
911
914 ll_source ) ) != 0 )
915 goto err_rx;
916
917 err_rx:
919 err_demux:
920 err_sanity:
923}
static int aoecmd_rx(struct aoe_command *aoecmd, struct io_buffer *iobuf, const void *ll_source)
Receive AoE command response.
#define AOE_FL_RESPONSE
Message is a response.
#define AOE_VERSION_MASK
Version part of ver_flags field.
#define DBG(...)
Print a debugging message.
#define ENOENT
No such file or directory.
#define EOPNOTSUPP
Operation not supported on socket.
#define EPROTONOSUPPORT
Protocol not supported.
#define iob_disown(iobuf)
Disown an I/O buffer.
References __unused, 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, flags, free_iob(), iob_disown, iob_len(), netdev, ntohl, rc, aoehdr::tag, and aoehdr::ver_flags.
Install AoE boot firmware table(s)
- Parameters
-
| install | Installation method |
- Return values
-
Definition at line 1043 of file aoe.c.
1043 {
1047
1049
1050
1051 memset ( &abft, 0,
sizeof ( abft ) );
1053 abft.acpi.length =
cpu_to_le32 (
sizeof ( abft ) );
1054 abft.acpi.revision = 1;
1056 abft.slot = aoedev->
minor;
1058 sizeof ( abft.mac ) );
1059
1060
1061 if ( (
rc = install ( &abft.acpi ) ) != 0 ) {
1062 DBGC ( aoedev,
"AoE %s could not install aBFT: %s\n",
1065 }
1066 }
1067
1068 return 0;
1069}
#define ABFT_SIG
AoE boot firmware table signature.
struct ena_llq_option desc
Descriptor counts.
#define cpu_to_le32(value)
#define cpu_to_le16(value)
AoE Boot Firmware Table (aBFT)
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
References ABFT_SIG, abft_table::acpi, 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().