iPXE
|
IP over Infiniband. More...
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <byteswap.h>
#include <errno.h>
#include <ipxe/errortab.h>
#include <ipxe/malloc.h>
#include <ipxe/if_arp.h>
#include <ipxe/arp.h>
#include <ipxe/if_ether.h>
#include <ipxe/ethernet.h>
#include <ipxe/ip.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/infiniband.h>
#include <ipxe/ib_pathrec.h>
#include <ipxe/ib_mcast.h>
#include <ipxe/retry.h>
#include <ipxe/ipoib.h>
Go to the source code of this file.
Data Structures | |
struct | ipoib_broadcast |
An IPoIB broadcast address. More... | |
struct | ipoib_device |
An IPoIB device. More... | |
struct | ipoib_peer |
An IPoIB REMAC cache entry. More... | |
Macros | |
#define | ENXIO_ARP_REPLY __einfo_error ( EINFO_ENXIO_ARP_REPLY ) |
#define | EINFO_ENXIO_ARP_REPLY |
#define | ENXIO_NON_IPV4 __einfo_error ( EINFO_ENXIO_NON_IPV4 ) |
#define | EINFO_ENXIO_NON_IPV4 |
#define | ENXIO_ARP_SENT __einfo_error ( EINFO_ENXIO_ARP_SENT ) |
#define | EINFO_ENXIO_ARP_SENT |
#define | IPOIB_NUM_SEND_WQES 8 |
Number of IPoIB send work queue entries. More... | |
#define | IPOIB_NUM_RECV_WQES 4 |
Number of IPoIB receive work queue entries. More... | |
#define | IPOIB_NUM_CQES 16 |
Number of IPoIB completion 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 (ipoib_devices) |
List of all IPoIB devices. More... | |
static struct ipoib_mac * | ipoib_find_remac (struct ipoib_device *ipoib, const struct ipoib_remac *remac) |
Find IPoIB MAC from REMAC. More... | |
static int | ipoib_map_remac (struct ipoib_device *ipoib, const struct ipoib_remac *remac, const struct ipoib_mac *mac) |
Add IPoIB MAC to REMAC cache. More... | |
static void | ipoib_flush_remac (struct ipoib_device *ipoib) |
Flush REMAC cache. More... | |
static unsigned int | ipoib_discard_remac (void) |
Discard some entries from the REMAC cache. More... | |
struct cache_discarder ipoib_discarder | __cache_discarder (CACHE_EXPENSIVE) |
IPoIB cache discarder. More... | |
static void | ipoib_init_addr (const void *hw_addr, void *ll_addr) |
Initialise IPoIB link-layer address. More... | |
struct net_device * | alloc_ipoibdev (size_t priv_size) |
Allocate IPoIB device. More... | |
static int | ipoib_translate_tx_arp (struct net_device *netdev, struct io_buffer *iobuf) |
Translate transmitted ARP packet. More... | |
static int | ipoib_translate_tx (struct net_device *netdev, struct io_buffer *iobuf, uint16_t net_proto) |
Translate transmitted packet. More... | |
static int | ipoib_translate_rx_arp (struct net_device *netdev, struct io_buffer *iobuf, struct ipoib_remac *remac) |
Translate received ARP packet. More... | |
static int | ipoib_translate_rx (struct net_device *netdev, struct io_buffer *iobuf, struct ipoib_remac *remac, uint16_t net_proto) |
Translate received packet. More... | |
static int | ipoib_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
Transmit packet via IPoIB network device. More... | |
static void | ipoib_complete_send (struct ib_device *ibdev __unused, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc) |
Handle IPoIB send completion. More... | |
static void | ipoib_complete_recv (struct ib_device *ibdev __unused, struct ib_queue_pair *qp, struct ib_address_vector *dest, struct ib_address_vector *source, struct io_buffer *iobuf, int rc) |
Handle IPoIB receive completion. More... | |
static struct io_buffer * | ipoib_alloc_iob (size_t len) |
Allocate IPoIB receive I/O buffer. More... | |
static void | ipoib_poll (struct net_device *netdev) |
Poll IPoIB network device. More... | |
void | ipoib_join_complete (struct ib_mc_membership *membership, int rc) |
Handle IPv4 broadcast multicast group join completion. More... | |
static int | ipoib_join_broadcast_group (struct ipoib_device *ipoib) |
Join IPv4 broadcast multicast group. More... | |
static void | ipoib_leave_broadcast_group (struct ipoib_device *ipoib) |
Leave IPv4 broadcast multicast group. More... | |
static void | ipoib_link_state_changed (struct ipoib_device *ipoib) |
Handle link status change. More... | |
static int | ipoib_open (struct net_device *netdev) |
Open IPoIB network device. More... | |
static void | ipoib_close (struct net_device *netdev) |
Close IPoIB network device. More... | |
static int | ipoib_probe (struct ib_device *ibdev) |
Probe IPoIB device. More... | |
static void | ipoib_notify (struct ib_device *ibdev) |
Handle device or link status change. More... | |
static void | ipoib_remove (struct ib_device *ibdev) |
Remove IPoIB device. More... | |
struct net_device * | ipoib_netdev (struct ib_device *ibdev) |
Find IPoIB network device. More... | |
Variables | |
static struct ipoib_mac | ipoib_broadcast |
Broadcast IPoIB address. More... | |
struct errortab ipoib_errors [] | __errortab |
Human-readable message for the link status. More... | |
static struct net_device_operations | ipoib_operations |
IPoIB network device operations. More... | |
struct ll_protocol ipoib_protocol | __ll_protocol |
IPoIB protocol. More... | |
static struct ib_completion_queue_operations | ipoib_cq_op |
IPoIB completion operations. More... | |
static struct ib_queue_pair_operations | ipoib_qp_op |
IPoIB queue pair operations. More... | |
struct ib_driver ipoib_driver | __ib_driver |
IPoIB driver. More... | |
IP over Infiniband.
Definition in file ipoib.c.
#define ENXIO_ARP_REPLY __einfo_error ( EINFO_ENXIO_ARP_REPLY ) |
#define EINFO_ENXIO_ARP_REPLY |
#define ENXIO_NON_IPV4 __einfo_error ( EINFO_ENXIO_NON_IPV4 ) |
#define EINFO_ENXIO_NON_IPV4 |
#define ENXIO_ARP_SENT __einfo_error ( EINFO_ENXIO_ARP_SENT ) |
#define EINFO_ENXIO_ARP_SENT |
#define IPOIB_NUM_SEND_WQES 8 |
#define IPOIB_NUM_RECV_WQES 4 |
#define IPOIB_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 all IPoIB devices.
|
static |
Find IPoIB MAC from REMAC.
ipoib | IPoIB device |
remac | Remote Ethernet MAC |
mac | IPoIB MAC (or NULL if not found) |
Definition at line 152 of file ipoib.c.
References ipoib_device::broadcast, DBGC, eth_ntoa(), is_multicast_ether_addr(), ipoib_peer::list, list_add, list_del, list_for_each_entry, ipoib_broadcast::mac, memcmp(), NULL, peer, ipoib_device::peers, and ipoib_peer::remac.
Referenced by ipoib_translate_tx_arp(), and ipoib_transmit().
|
static |
Add IPoIB MAC to REMAC cache.
ipoib | IPoIB device |
remac | Remote Ethernet MAC |
mac | IPoIB MAC |
rc | Return status code |
Definition at line 186 of file ipoib.c.
References ENOMEM, ipoib_peer::list, list_add, list_del, list_for_each_entry, mac, malloc(), memcmp(), memcpy(), peer, ipoib_device::peers, and ipoib_peer::remac.
Referenced by ipoib_translate_rx_arp().
|
static |
Flush REMAC cache.
ipoib | IPoIB device |
Definition at line 220 of file ipoib.c.
References free, ipoib_peer::list, list_del, list_for_each_entry_safe, peer, ipoib_device::peers, and tmp.
Referenced by ipoib_close().
|
static |
Discard some entries from the REMAC cache.
discarded | Number of cached items discarded |
Definition at line 235 of file ipoib.c.
References for_each_netdev, free, ipoib_operations, ipoib_peer::list, list_del, list_for_each_entry_reverse, netdev, net_device::op, peer, ipoib_device::peers, and net_device::priv.
struct cache_discarder ipoib_discarder __cache_discarder | ( | CACHE_EXPENSIVE | ) |
IPoIB cache discarder.
|
static |
Initialise IPoIB link-layer address.
hw_addr | Hardware address |
ll_addr | Link-layer address |
Definition at line 279 of file ipoib.c.
References guid, and IPOIB_GUID_MASK.
struct net_device* alloc_ipoibdev | ( | size_t | priv_size | ) |
Allocate IPoIB device.
priv_size | Size of driver private data |
netdev | Network device, or NULL |
Definition at line 315 of file ipoib.c.
References alloc_netdev(), eth_broadcast, IB_MAX_PAYLOAD_SIZE, net_device::ll_broadcast, net_device::ll_protocol, net_device::max_pkt_len, and netdev.
Referenced by ipoib_probe().
|
static |
Translate transmitted ARP packet.
netdev | Network device |
iobuf | Packet to be transmitted (with no link-layer headers) |
rc | Return status code |
Definition at line 341 of file ipoib.c.
References arphdr::ar_hln, arphdr::ar_hrd, arphdr::ar_op, arphdr::ar_pln, arp_sender_ha(), arp_sender_pa(), arp_target_ha(), arp_target_pa(), ARPHRD_INFINIBAND, ARPOP_REPLY, io_buffer::data, DBGC, ENOBUFS, ENXIO_ARP_REPLY, ETH_ALEN, eth_ntoa(), htons, iob_put, iob_tailroom(), ipoib_find_remac(), ipoib_device::mac, memcpy(), memset(), netdev, NULL, and net_device::priv.
Referenced by ipoib_translate_tx().
|
static |
Translate transmitted packet.
netdev | Network device |
iobuf | Packet to be transmitted (with no link-layer headers) |
net_proto | Network-layer protocol (in network byte order) |
rc | Return status code |
Definition at line 397 of file ipoib.c.
References ENOTSUP, ETH_P_ARP, ETH_P_IP, htons, ipoib_translate_tx_arp(), and netdev.
Referenced by ipoib_transmit().
|
static |
Translate received ARP packet.
netdev | Network device |
iobuf | Received packet (with no link-layer headers) |
remac | Constructed Remote Ethernet MAC |
rc | Return status code |
Definition at line 420 of file ipoib.c.
References arphdr::ar_hln, arphdr::ar_hrd, arphdr::ar_op, arphdr::ar_pln, arp_sender_ha(), arp_sender_pa(), arp_target_ha(), arp_target_pa(), ARPHRD_ETHER, ARPOP_REPLY, io_buffer::data, DBGC, ETH_ALEN, htons, iob_unput, ipoib_map_remac(), net_device::ll_addr, ipoib_device::mac, memcpy(), memset(), netdev, net_device::priv, rc, and strerror().
Referenced by ipoib_translate_rx().
|
static |
Translate received packet.
netdev | Network device |
iobuf | Received packet (with no link-layer headers) |
remac | Constructed Remote Ethernet MAC |
net_proto | Network-layer protocol (in network byte order) |
rc | Return status code |
Definition at line 468 of file ipoib.c.
References ENOTSUP, ETH_P_ARP, ETH_P_IP, htons, ipoib_translate_rx_arp(), and netdev.
Referenced by ipoib_complete_recv().
|
static |
Transmit packet via IPoIB network device.
netdev | Network device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 499 of file ipoib.c.
References arp_tx_request(), ipoib_broadcast::av, ipoib_device::broadcast, io_buffer::data, DBGC, iphdr::dest, dest, EINVAL, ENETUNREACH, ENXIO_ARP_SENT, ENXIO_NON_IPV4, eth_ntoa(), ETH_P_IP, ethhdr::h_dest, ethhdr::h_protocol, htons, ib_link_ok(), ib_post_send(), IB_QPN_MASK, ib_resolve_path(), ipoib_device::ibdev, inet_ntoa(), iob_len(), iob_pull, iob_push, ipoib_find_remac(), ipoib_translate_tx(), is_multicast_ether_addr(), mac, memcpy(), memset(), netdev, ntohl, ntohs, net_device::priv, ipoib_hdr::proto, ib_address_vector::qkey, ipoib_device::qp, rc, ipoib_hdr::reserved, iphdr::src, and strerror().
|
static |
Handle IPoIB send completion.
ibdev | Infiniband device |
qp | Queue pair |
iobuf | I/O buffer |
rc | Completion status code |
Definition at line 601 of file ipoib.c.
References ib_qp_get_ownerdata(), ipoib_device::netdev, netdev_tx_complete_err(), qp, and rc.
|
static |
Handle IPoIB 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 619 of file ipoib.c.
References io_buffer::data, DBGC, DBGC_HD, dest, EIO, EIPOIB_QPN_LA, ENOTTY, eth_broadcast, ethhdr::h_dest, ethhdr::h_protocol, ethhdr::h_source, htonl, htons, IB_GID_MULTICAST, ib_qp_get_ownerdata(), iob_len(), iob_pull, iob_push, ipoib_translate_rx(), ipoib_remac::lid, ib_address_vector::lid, net_device::ll_addr, memcpy(), netdev, ipoib_device::netdev, netdev_rx(), netdev_rx_err(), ipoib_hdr::proto, qp, ipoib_remac::qpn, ib_address_vector::qpn, and rc.
Allocate IPoIB receive I/O buffer.
len | Length of buffer |
iobuf | I/O buffer, or NULL |
Some Infiniband hardware requires 2kB alignment of receive buffers and provides no way to disable header separation. The result is that there are only four bytes of link-layer header (the real IPoIB header) before the payload. This is not sufficient space to insert an eIPoIB link-layer pseudo-header.
We therefore allocate I/O buffers offset to start slightly before the natural alignment boundary, in order to allow sufficient space.
Definition at line 709 of file ipoib.c.
References alloc_iob_raw(), iob_reserve, and len.
|
static |
Poll IPoIB network device.
netdev | Network device |
Definition at line 735 of file ipoib.c.
References ib_poll_eq(), ipoib_device::ibdev, netdev, net_device::priv, and retry_poll().
void ipoib_join_complete | ( | struct ib_mc_membership * | membership, |
int | rc | ||
) |
Handle IPv4 broadcast multicast group join completion.
membership | Multicast group membership |
rc | Status code |
Definition at line 752 of file ipoib.c.
References ipoib_device::broadcast, container_of, ipoib_broadcast::membership, ipoib_device::netdev, netdev_link_err(), and rc.
Referenced by ipoib_join_broadcast_group().
|
static |
Join IPv4 broadcast multicast group.
ipoib | IPoIB device |
rc | Return status code |
Definition at line 767 of file ipoib.c.
References ipoib_broadcast::av, ipoib_device::broadcast, DBGC, ib_mcast_join(), ipoib_device::ibdev, ipoib_join_complete(), ipoib_broadcast::membership, ipoib_device::qp, rc, and strerror().
Referenced by ipoib_link_state_changed().
|
static |
Leave IPv4 broadcast multicast group.
ipoib | IPoIB device |
Definition at line 788 of file ipoib.c.
References ipoib_device::broadcast, ib_mcast_leave(), ipoib_device::ibdev, ipoib_broadcast::membership, and ipoib_device::qp.
Referenced by ipoib_close(), and ipoib_link_state_changed().
|
static |
Handle link status change.
ipoib | IPoIB device |
Definition at line 800 of file ipoib.c.
References ipoib_broadcast::av, ipoib_device::broadcast, DBGC, EINPROGRESS_JOINING, ipoib_mac::gid, ib_address_vector::gid, ib_device::gid, ib_address_vector::gid_present, htons, ib_is_open(), ib_link_ok(), ib_link_rc(), IB_PKEY_FULL, IB_QPN_BROADCAST, ipoib_device::ibdev, ipoib_join_broadcast_group(), ipoib_leave_broadcast_group(), ipoib_device::mac, ipoib_broadcast::mac, memcpy(), memset(), netdev, ipoib_device::netdev, netdev_link_err(), ib_device::pkey, ib_gid::prefix, ipoib_device::qp, ib_address_vector::qpn, rc, ib_gid::s, strerror(), and ib_gid::words.
Referenced by ipoib_notify(), and ipoib_open().
|
static |
Open IPoIB network device.
netdev | Network device |
rc | Return status code |
Definition at line 844 of file ipoib.c.
References ipoib_device::cq, DBGC, ipoib_mac::flags__qpn, htonl, 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(), ipoib_device::ibdev, ipoib_cq_op, ipoib_link_state_changed(), IPOIB_NUM_CQES, IPOIB_NUM_RECV_WQES, IPOIB_NUM_SEND_WQES, ipoib_qp_op, ipoib_device::mac, net_device::name, netdev, net_device::priv, ipoib_device::qp, ib_queue_pair::qpn, rc, and strerror().
|
static |
Close IPoIB network device.
netdev | Network device |
Definition at line 900 of file ipoib.c.
References ipoib_device::cq, ipoib_mac::flags__qpn, ib_close(), ib_destroy_cq(), ib_destroy_qp(), ipoib_device::ibdev, ipoib_flush_remac(), ipoib_leave_broadcast_group(), ipoib_device::mac, netdev, NULL, net_device::priv, and ipoib_device::qp.
|
static |
Probe IPoIB device.
ibdev | Infiniband device |
rc | Return status code |
Definition at line 937 of file ipoib.c.
References alloc_ipoibdev(), ipoib_device::broadcast, net_device::dev, ib_device::dev, ENOMEM, ETH_ALEN, ipoib_mac::gid, ib_device::gid, ib_gid::guid, net_device::hw_addr, ipoib_device::ibdev, INIT_LIST_HEAD, ipoib_operations, ib_device::lemac, ipoib_device::list, list_add_tail, list_del, net_device::ll_addr, ipoib_device::mac, ipoib_broadcast::mac, memcpy(), memset(), netdev, ipoib_device::netdev, netdev_init(), netdev_nullify(), netdev_put(), ipoib_device::peers, net_device::priv, rc, register_netdev(), ib_gid::s, and unregister_netdev().
|
static |
Handle device or link status change.
ibdev | Infiniband device |
Definition at line 989 of file ipoib.c.
References ipoib_device::ibdev, ipoib_link_state_changed(), ipoib_device::list, and list_for_each_entry.
|
static |
Remove IPoIB device.
ibdev | Infiniband device |
Definition at line 1005 of file ipoib.c.
References ipoib_device::ibdev, ipoib_device::list, net_device::list, list_del, list_for_each_entry_safe, netdev, ipoib_device::netdev, netdev_nullify(), netdev_put(), tmp, and unregister_netdev().
struct net_device* ipoib_netdev | ( | struct ib_device * | ibdev | ) |
Find IPoIB network device.
ibdev | Infiniband device |
netdev | IPoIB network device, or NULL if not found |
Definition at line 1036 of file ipoib.c.
References ipoib_device::ibdev, ipoib_device::list, list_for_each_entry, ipoib_device::netdev, and NULL.
Referenced by golan_register_ibdev().
|
static |
Broadcast IPoIB address.
struct errortab ipoib_errors [] __errortab |
Human-readable message for the link status.
|
static |
IPoIB network device operations.
Definition at line 126 of file ipoib.c.
Referenced by ipoib_discard_remac(), and ipoib_probe().
struct ll_protocol ipoib_protocol __ll_protocol |
IPoIB protocol.
Ethernet protocol.
|
static |
IPoIB completion operations.
Definition at line 689 of file ipoib.c.
Referenced by ipoib_open().
|
static |
IPoIB queue pair operations.
Definition at line 726 of file ipoib.c.
Referenced by ipoib_open().
struct ib_driver ipoib_driver __ib_driver |
IPoIB driver.