iPXE
|
Ethernet over Infiniband. More...
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/errortab.h>
#include <ipxe/malloc.h>
#include <ipxe/iobuf.h>
#include <ipxe/if_ether.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include <ipxe/infiniband.h>
#include <ipxe/ib_mcast.h>
#include <ipxe/ib_pathrec.h>
#include <ipxe/eoib.h>
Go to the source code of this file.
Data Structures | |
struct | eoib_peer |
An EoIB peer cache entry. More... | |
Macros | |
#define | EOIB_NUM_SEND_WQES 8 |
Number of EoIB send work queue entries. More... | |
#define | EOIB_NUM_RECV_WQES 4 |
Number of EoIB receive work queue entries. More... | |
#define | EOIB_NUM_CQES 16 |
Number of EoIB completion queue entries. More... | |
#define | EINPROGRESS_JOINING __einfo_error ( EINFO_EINPROGRESS_JOINING ) |
Link status for "broadcast join in progress". More... | |
#define | EINFO_EINPROGRESS_JOINING |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static | LIST_HEAD (eoib_devices) |
List of EoIB devices. More... | |
static struct eoib_peer * | eoib_find_peer (struct eoib_device *eoib, const uint8_t *mac) |
Find EoIB peer cache entry. More... | |
static struct eoib_peer * | eoib_create_peer (struct eoib_device *eoib, const uint8_t *mac) |
Create EoIB peer cache entry. More... | |
static void | eoib_flush_peers (struct eoib_device *eoib) |
Flush EoIB peer cache. More... | |
static unsigned int | eoib_discard (void) |
Discard some entries from the peer cache. More... | |
struct cache_discarder eoib_discarder | __cache_discarder (CACHE_EXPENSIVE) |
EoIB cache discarder. More... | |
static struct ib_address_vector * | eoib_tx_av (struct eoib_device *eoib, const uint8_t *mac) |
Find destination address vector. More... | |
static void | eoib_rx_av (struct eoib_device *eoib, const uint8_t *mac, const struct ib_address_vector *av) |
Record source address vector. More... | |
static int | eoib_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
Transmit packet via EoIB network device. More... | |
static void | eoib_complete_send (struct ib_device *ibdev __unused, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc) |
Handle EoIB send completion. More... | |
static void | eoib_complete_recv (struct ib_device *ibdev __unused, struct ib_queue_pair *qp, struct ib_address_vector *dest __unused, struct ib_address_vector *source, struct io_buffer *iobuf, int rc) |
Handle EoIB receive completion. More... | |
static void | eoib_poll (struct net_device *netdev) |
Poll EoIB network device. More... | |
static void | eoib_join_complete (struct ib_mc_membership *membership, int rc) |
Handle EoIB broadcast multicast group join completion. More... | |
static int | eoib_join_broadcast_group (struct eoib_device *eoib) |
Join EoIB broadcast multicast group. More... | |
static void | eoib_leave_broadcast_group (struct eoib_device *eoib) |
Leave EoIB broadcast multicast group. More... | |
static void | eoib_link_state_changed (struct eoib_device *eoib) |
Handle link status change. More... | |
static int | eoib_open (struct net_device *netdev) |
Open EoIB network device. More... | |
static void | eoib_close (struct net_device *netdev) |
Close EoIB network device. More... | |
int | eoib_create (struct ib_device *ibdev, const uint8_t *hw_addr, struct ib_address_vector *broadcast, const char *name) |
Create EoIB device. More... | |
struct eoib_device * | eoib_find (struct ib_device *ibdev, const uint8_t *hw_addr) |
Find EoIB device. More... | |
void | eoib_destroy (struct eoib_device *eoib) |
Remove EoIB device. More... | |
static int | eoib_probe (struct ib_device *ibdev __unused) |
Probe EoIB device. More... | |
static void | eoib_notify (struct ib_device *ibdev) |
Handle device or link status change. More... | |
static void | eoib_remove (struct ib_device *ibdev) |
Remove EoIB device. More... | |
static int | eoib_heartbeat_rx (struct io_buffer *iobuf, struct net_device *netdev __unused, const void *ll_dest __unused, const void *ll_source __unused, unsigned int flags __unused) |
Silently ignore incoming EoIB heartbeat packets. More... | |
static const char * | eoib_heartbeat_ntoa (const void *net_addr __unused) |
Transcribe EoIB heartbeat address. More... | |
static void | eoib_duplicate (struct eoib_device *eoib, struct io_buffer *original) |
Transmit duplicate packet to the EoIB gateway. More... | |
void | eoib_set_gateway (struct eoib_device *eoib, struct ib_address_vector *av) |
Set EoIB gateway. More... | |
Variables | |
struct errortab eoib_errors [] | __errortab |
Human-readable message for the link status. More... | |
static struct net_device_operations | eoib_operations |
EoIB network device operations. More... | |
static struct ib_completion_queue_operations | eoib_cq_op |
EoIB completion operations. More... | |
static struct ib_queue_pair_operations | eoib_qp_op |
EoIB queue pair operations. More... | |
struct ib_driver eoib_driver | __ib_driver |
EoIB driver. More... | |
struct net_protocol eoib_heartbeat_protocol | __net_protocol |
EoIB heartbeat network protocol. More... | |
Ethernet over Infiniband.
Definition in file eoib.c.
#define EOIB_NUM_SEND_WQES 8 |
#define EOIB_NUM_RECV_WQES 4 |
#define EOIB_NUM_CQES 16 |
#define EINPROGRESS_JOINING __einfo_error ( EINFO_EINPROGRESS_JOINING ) |
#define EINFO_EINPROGRESS_JOINING |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
List of EoIB devices.
|
static |
Find EoIB peer cache entry.
eoib | EoIB device |
mac | Ethernet MAC |
peer | EoIB peer, or NULL if not found |
Definition at line 94 of file eoib.c.
References eoib_peer::list, list_add, list_del, list_for_each_entry, mac, memcmp(), NULL, peer, and eoib_device::peers.
Referenced by eoib_rx_av(), and eoib_tx_av().
|
static |
Create EoIB peer cache entry.
eoib | EoIB device |
mac | Ethernet MAC |
peer | EoIB peer, or NULL on error |
Definition at line 118 of file eoib.c.
References list_add, mac, memcpy(), peer, eoib_device::peers, and zalloc().
Referenced by eoib_tx_av().
|
static |
Flush EoIB peer cache.
eoib | EoIB device |
Definition at line 136 of file eoib.c.
References free, eoib_peer::list, list_del, list_for_each_entry_safe, peer, eoib_device::peers, and tmp.
Referenced by eoib_close().
|
static |
Discard some entries from the peer cache.
discarded | Number of cached items discarded |
Definition at line 151 of file eoib.c.
References eoib_operations, for_each_netdev, free, eoib_peer::list, list_del, list_for_each_entry_reverse, netdev, net_device::op, peer, eoib_device::peers, and net_device::priv.
struct cache_discarder eoib_discarder __cache_discarder | ( | CACHE_EXPENSIVE | ) |
EoIB cache discarder.
|
static |
Find destination address vector.
eoib | EoIB device |
mac | Ethernet MAC |
av | Address vector, or NULL to send as broadcast |
Definition at line 189 of file eoib.c.
References DBGC, DBGCP, eoib_create_peer(), eoib_find_peer(), eth_ntoa(), IB_GID_ARGS, IB_GID_FMT, ib_resolve_path(), eoib_device::ibdev, is_multicast_ether_addr(), mac, eoib_device::name, NULL, peer, and rc.
Referenced by eoib_transmit().
|
static |
Record source address vector.
eoib | EoIB device |
mac | Ethernet MAC |
lid | Infiniband LID |
Definition at line 251 of file eoib.c.
References eoib_peer::av, eoib_device::broadcast, DBGC, DBGCP, eoib_find_peer(), eoib_has_gateway(), eth_ntoa(), eoib_device::gateway, gid, ib_address_vector::gid, ib_address_vector::gid_present, IB_GID_ARGS, IB_GID_FMT, ib_address_vector::lid, mac, memcmp(), memcpy(), eoib_device::name, peer, ib_address_vector::qkey, qpn, and ib_address_vector::qpn.
Referenced by eoib_complete_recv().
|
static |
Transmit packet via EoIB network device.
netdev | Network device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 310 of file eoib.c.
References assert(), eoib_device::broadcast, io_buffer::data, eoib_device::duplicate, eoib_has_gateway(), EOIB_MAGIC, eoib_tx_av(), ETH_ZLEN, ethhdr::h_dest, htons, ib_post_send(), eoib_device::ibdev, iob_headroom(), iob_len(), iob_pad(), iob_push, IOB_ZLEN, eoib_header::magic, netdev, net_device::priv, eoib_device::qp, and eoib_header::reserved.
|
static |
Handle EoIB send completion.
ibdev | Infiniband device |
qp | Queue pair |
iobuf | I/O buffer |
rc | Completion status code |
Definition at line 358 of file eoib.c.
References ib_qp_get_ownerdata(), eoib_device::netdev, netdev_tx_complete_err(), qp, and rc.
|
static |
Handle EoIB receive completion.
ibdev | Infiniband device |
qp | Queue pair |
dest | Destination address vector, or NULL |
source | Source address vector, or NULL |
iobuf | I/O buffer |
rc | Completion status code |
Definition at line 376 of file eoib.c.
References io_buffer::data, DBGC, DBGC_HD, EIO, ENOTTY, eoib_rx_av(), ethhdr::h_source, ib_qp_get_ownerdata(), iob_len(), iob_pull, eoib_device::name, eoib_device::netdev, netdev, netdev_rx(), netdev_rx_err(), qp, and rc.
|
static |
Poll EoIB network device.
netdev | Network device |
Definition at line 434 of file eoib.c.
References ib_poll_eq(), eoib_device::ibdev, netdev, net_device::priv, and retry_poll().
|
static |
Handle EoIB broadcast multicast group join completion.
membership | Multicast group membership |
rc | Status code |
Definition at line 451 of file eoib.c.
References container_of, eoib_device::membership, eoib_device::netdev, netdev_link_err(), and rc.
Referenced by eoib_join_broadcast_group().
|
static |
Join EoIB broadcast multicast group.
eoib | EoIB device |
rc | Return status code |
Definition at line 465 of file eoib.c.
References eoib_device::broadcast, DBGC, eoib_join_complete(), ib_mcast_join(), eoib_device::ibdev, eoib_device::mask, eoib_device::membership, eoib_device::name, eoib_device::qp, rc, and strerror().
Referenced by eoib_link_state_changed().
|
static |
Leave EoIB broadcast multicast group.
eoib | EoIB device |
Definition at line 485 of file eoib.c.
References ib_mcast_leave(), eoib_device::ibdev, eoib_device::membership, and eoib_device::qp.
Referenced by eoib_close(), and eoib_link_state_changed().
|
static |
Handle link status change.
eoib | EoIB device |
Definition at line 496 of file eoib.c.
References eoib_device::broadcast, DBGC, EINPROGRESS_JOINING, eoib_join_broadcast_group(), eoib_leave_broadcast_group(), ib_address_vector::gid, htons, ib_is_open(), ib_link_ok(), ib_link_rc(), IB_PKEY_FULL, eoib_device::ibdev, eoib_device::name, eoib_device::netdev, netdev, netdev_link_err(), ib_device::pkey, eoib_device::qp, rc, strerror(), and ib_gid::words.
Referenced by eoib_notify(), and eoib_open().
|
static |
Open EoIB network device.
netdev | Network device |
rc | Return status code |
Definition at line 528 of file eoib.c.
References eoib_device::cq, DBGC, eoib_cq_op, eoib_link_state_changed(), EOIB_NUM_CQES, EOIB_NUM_RECV_WQES, EOIB_NUM_SEND_WQES, eoib_qp_op, ib_close(), ib_create_cq(), ib_create_qp(), ib_destroy_cq(), ib_destroy_qp(), ib_open(), ib_qp_set_ownerdata(), IB_QPT_UD, ib_refill_recv(), eoib_device::ibdev, eoib_device::name, net_device::name, ib_device::name, netdev, NULL, net_device::priv, eoib_device::qp, rc, and strerror().
|
static |
Close EoIB network device.
netdev | Network device |
Definition at line 582 of file eoib.c.
References eoib_device::cq, eoib_flush_peers(), eoib_leave_broadcast_group(), ib_close(), ib_destroy_cq(), ib_destroy_qp(), eoib_device::ibdev, netdev, NULL, net_device::priv, and eoib_device::qp.
int eoib_create | ( | struct ib_device * | ibdev, |
const uint8_t * | hw_addr, | ||
struct ib_address_vector * | broadcast, | ||
const char * | name | ||
) |
Create EoIB device.
ibdev | Infiniband device |
hw_addr | Ethernet MAC |
broadcast | Broadcast address vector |
name | Interface name (or NULL to use default) |
rc | Return status code |
Definition at line 619 of file eoib.c.
References alloc_etherdev(), eoib_device::broadcast, DBGC, net_device::dev, ib_device::dev, ENOMEM, eoib_operations, ETH_ALEN, eth_ntoa(), ib_address_vector::gid, net_device::hw_addr, IB_GID_ARGS, IB_GID_FMT, eoib_device::ibdev, ibdev_get(), ibdev_put(), INIT_LIST_HEAD, eoib_device::list, list_add_tail, list_del, memcpy(), eoib_device::name, net_device::name, ib_device::name, name, eoib_device::netdev, netdev, netdev_init(), netdev_nullify(), netdev_put(), eoib_device::peers, net_device::priv, rc, register_netdev(), snprintf(), and unregister_netdev().
Referenced by xve_create().
struct eoib_device* eoib_find | ( | struct ib_device * | ibdev, |
const uint8_t * | hw_addr | ||
) |
Find EoIB device.
ibdev | Infiniband device |
hw_addr | Original Ethernet MAC |
eoib | EoIB device |
Definition at line 677 of file eoib.c.
References ETH_ALEN, net_device::hw_addr, eoib_device::ibdev, eoib_device::list, list_for_each_entry, memcmp(), eoib_device::netdev, and NULL.
Referenced by xsigo_net_notify(), xsmp_rx_xve_modify(), and xve_destroy().
void eoib_destroy | ( | struct eoib_device * | eoib | ) |
Remove EoIB device.
eoib | EoIB device |
Definition at line 695 of file eoib.c.
References DBGC, eoib_device::ibdev, ibdev_put(), eoib_device::list, list_del, eoib_device::name, eoib_device::netdev, netdev, netdev_nullify(), netdev_put(), and unregister_netdev().
Referenced by eoib_remove(), and xve_destroy().
|
static |
|
static |
Handle device or link status change.
ibdev | Infiniband device |
Definition at line 730 of file eoib.c.
References eoib_link_state_changed(), eoib_device::ibdev, eoib_device::list, and list_for_each_entry.
|
static |
Remove EoIB device.
ibdev | Infiniband device |
Definition at line 746 of file eoib.c.
References eoib_destroy(), eoib_device::ibdev, eoib_device::list, list_for_each_entry_safe, and tmp.
|
static |
Silently ignore incoming EoIB heartbeat packets.
iobuf | I/O buffer |
netdev | Network device |
ll_source | Link-layer source address |
flags | Packet flags |
rc | Return status code |
Definition at line 782 of file eoib.c.
References free_iob().
|
static |
|
static |
Transmit duplicate packet to the EoIB gateway.
eoib | EoIB device |
original | Original I/O buffer |
Definition at line 832 of file eoib.c.
References alloc_iob(), io_buffer::data, DBGC, ENOMEM, eoib_device::gateway, ib_address_vector::gid_present, ib_post_send(), ib_resolve_path(), eoib_device::ibdev, iob_len(), iob_put, len, io_buffer::list, list_add_tail, list_del, memcpy(), eoib_device::name, eoib_device::netdev, netdev, netdev_tx_err(), eoib_device::qp, rc, and strerror().
Referenced by eoib_set_gateway().
void eoib_set_gateway | ( | struct eoib_device * | eoib, |
struct ib_address_vector * | av | ||
) |
Set EoIB gateway.
eoib | EoIB device |
av | Address vector, or NULL to clear gateway |
Definition at line 881 of file eoib.c.
References DBGC, eoib_device::duplicate, eoib_duplicate(), eoib_device::gateway, ib_address_vector::gid, IB_GID_ARGS, IB_GID_FMT, memcpy(), eoib_device::name, and NULL.
Referenced by xve_update_tca().
struct errortab eoib_errors [] __errortab |
Human-readable message for the link status.
|
static |
EoIB network device operations.
Definition at line 68 of file eoib.c.
Referenced by eoib_create(), and eoib_discard().
|
static |
EoIB completion operations.
Definition at line 419 of file eoib.c.
Referenced by eoib_open().
|
static |
EoIB queue pair operations.
Definition at line 425 of file eoib.c.
Referenced by eoib_open().
struct ib_driver eoib_driver __ib_driver |
EoIB driver.
struct net_protocol eoib_heartbeat_protocol __net_protocol |
EoIB heartbeat network protocol.
AoE protocol.