54 #define ENXIO_ARP_REPLY __einfo_error ( EINFO_ENXIO_ARP_REPLY ) 55 #define EINFO_ENXIO_ARP_REPLY \ 56 __einfo_uniqify ( EINFO_ENXIO, 0x01, \ 57 "Missing REMAC for ARP reply target address" ) 58 #define ENXIO_NON_IPV4 __einfo_error ( EINFO_ENXIO_NON_IPV4 ) 59 #define EINFO_ENXIO_NON_IPV4 \ 60 __einfo_uniqify ( EINFO_ENXIO, 0x02, \ 61 "Missing REMAC for non-IPv4 packet" ) 62 #define ENXIO_ARP_SENT __einfo_error ( EINFO_ENXIO_ARP_SENT ) 63 #define EINFO_ENXIO_ARP_SENT \ 64 __einfo_uniqify ( EINFO_ENXIO, 0x03, \ 65 "Missing REMAC for IPv4 packet (ARP sent)" ) 68 #define IPOIB_NUM_SEND_WQES 8 71 #define IPOIB_NUM_RECV_WQES 4 74 #define IPOIB_NUM_CQES 16 109 .gid.bytes = { 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
110 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
114 #define EINPROGRESS_JOINING __einfo_error ( EINFO_EINPROGRESS_JOINING ) 115 #define EINFO_EINPROGRESS_JOINING __einfo_uniqify \ 116 ( EINFO_EINPROGRESS, 0x01, "Joining" ) 165 sizeof (
peer->remac ) ) == 0 ) {
173 DBGC ( ipoib,
"IPoIB %p unknown REMAC %s\n",
194 sizeof (
peer->remac ) ) == 0 ) {
239 unsigned int discarded = 0;
286 for ( i = 0 ; i < 8 ; i++,
guid++, guid_mask <<= 1 ) {
287 if ( guid_mask & 0x80 )
288 *(eth_addr++) = *
guid;
296 .hw_addr_len =
sizeof (
union ib_guid ),
356 DBGC ( ipoib,
"IPoIB %p insufficient space in TX ARP\n",
365 DBGC ( ipoib,
"IPoIB %p no REMAC for %s ARP reply\n",
383 sizeof ( *target_ha ) );
400 switch ( net_proto ) {
436 DBGC ( ipoib,
"IPoIB %p could not map REMAC: %s\n",
473 switch ( net_proto ) {
515 DBGC ( ipoib,
"IPoIB %p buffer too short\n", ipoib );
544 dest->gid_present = 1;
558 DBGC ( ipoib,
"IPoIB %p no REMAC for %s non-IPv4 " 559 "packet type %04x\n", ipoib,
561 ntohs ( net_proto ) );
567 DBGC ( ipoib,
"IPoIB %p could not ARP for %s/%s/",
574 DBGC ( ipoib,
"IPoIB %p no REMAC for %s/%s/", ipoib,
639 DBGC ( ipoib,
"IPoIB %p received packet too short to " 640 "contain IPoIB header\n", ipoib );
646 DBGC ( ipoib,
"IPoIB %p received packet without address " 663 net_proto ) ) != 0 ) {
714 reserve_len = (
sizeof (
struct ethhdr ) -
775 DBGC ( ipoib,
"IPoIB %p could not join broadcast group: %s\n",
831 DBGC ( ipoib,
"IPoIB %p could not rejoin broadcast group: " 851 DBGC ( ipoib,
"IPoIB %p could not open device: %s\n",
858 &ipoib->
cq ) ) != 0 ) {
859 DBGC ( ipoib,
"IPoIB %p could not create completion queue: " 868 &ipoib->
qp ) ) != 0 ) {
869 DBGC ( ipoib,
"IPoIB %p could not create queue pair: %s\n",
949 memset ( ipoib, 0,
sizeof ( *ipoib ) );
972 goto err_register_netdev;
1012 if ( ipoib->
ibdev != ibdev )
uint16_t h_protocol
Protocol ID.
static void * arp_sender_pa(struct arphdr *arphdr)
ARP packet sender protocol address.
#define iob_pull(iobuf, len)
Address Resolution Protocol.
#define EINVAL
Invalid argument.
int ib_link_rc(struct ib_device *ibdev)
Get link state.
void ib_poll_eq(struct ib_device *ibdev)
Poll event queue.
struct arbelprm_rc_send_wqe rc
void ipoib_join_complete(struct ib_mc_membership *membership, int rc)
Handle IPv4 broadcast multicast group join completion.
#define iob_put(iobuf, len)
static __always_inline int ib_link_ok(struct ib_device *ibdev)
Check link state of Infiniband device.
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
union ib_gid gid
Port GID (comprising GID prefix and port GUID)
static int ib_is_open(struct ib_device *ibdev)
Check whether or not Infiniband device is open.
int(* open)(struct net_device *netdev)
Open network device.
static void * arp_target_ha(struct arphdr *arphdr)
ARP packet target hardware address.
int eth_eth_addr(const void *ll_addr, void *eth_addr)
Generate Ethernet-compatible compressed link-layer address.
#define list_add(new, head)
Add a new entry to the head of a list.
Infiniband multicast groups.
static void * arp_target_pa(struct arphdr *arphdr)
ARP packet target protocol address.
struct ib_device * ibdev
Underlying Infiniband device.
int ib_mcast_join(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_mc_membership *membership, struct ib_address_vector *av, unsigned int mask, void(*complete)(struct ib_mc_membership *membership, int rc))
Join multicast group.
static void ipoib_link_state_changed(struct ipoib_device *ipoib)
Handle link status change.
#define iob_push(iobuf, len)
struct net_device * ipoib_netdev(struct ib_device *ibdev)
Find IPoIB network device.
struct io_buffer * alloc_iob_raw(size_t len, size_t align, size_t offset)
Allocate I/O buffer with specified alignment and offset.
#define __einfo_errortab(einfo)
#define IPOIB_NUM_RECV_WQES
Number of IPoIB receive work queue entries.
struct list_head list
List of network devices.
#define IB_PKEY_FULL
Infiniband partition key full membership flag.
struct ib_queue_pair * qp
Queue pair.
int ib_create_cq(struct ib_device *ibdev, unsigned int num_cqes, struct ib_completion_queue_operations *op, struct ib_completion_queue **new_cq)
Create completion queue.
uint8_t eth_broadcast[ETH_ALEN]
Ethernet broadcast MAC address.
void ib_refill_recv(struct ib_device *ibdev, struct ib_queue_pair *qp)
Refill receive work queue.
#define LL_NAME_ONLY
Local link-layer address functions only as a name.
struct io_buffer *(* alloc_iob)(size_t len)
Allocate receive I/O buffer.
int ib_open(struct ib_device *ibdev)
Open port.
struct device * dev
Underlying device.
const uint8_t * ll_broadcast
Link-layer broadcast address.
#define EIPOIB_QPN_LA
eIPoIB REMAC locally-assigned address indicator
An IPoIB REMAC cache entry.
An Infiniband upper-layer driver.
uint8_t ar_hln
Link-layer address length.
static int ipoib_translate_rx_arp(struct net_device *netdev, struct io_buffer *iobuf, struct ipoib_remac *remac)
Translate received ARP packet.
void ib_close(struct ib_device *ibdev)
Close port.
uint8_t mac[ETH_ALEN]
MAC address.
unsigned int gid_present
GID is present.
int eth_push(struct net_device *netdev __unused, struct io_buffer *iobuf, const void *ll_dest, const void *ll_source, uint16_t net_proto)
Add Ethernet link-layer header.
static void ipoib_poll(struct net_device *netdev)
Poll IPoIB network device.
struct net_device_operations * op
Network device operations.
struct net_device * alloc_ipoibdev(size_t priv_size)
Allocate IPoIB device.
static LIST_HEAD(ipoib_devices)
List of all IPoIB devices.
Address Resolution Protocol constants and types.
int eth_eui64(const void *ll_addr, void *eui64)
Generate EUI-64 address.
int eth_pull(struct net_device *netdev __unused, struct io_buffer *iobuf, const void **ll_dest, const void **ll_source, uint16_t *net_proto, unsigned int *flags)
Remove Ethernet link-layer header.
#define ENOTSUP
Operation not supported.
void ib_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
A doubly-linked list entry (or list head)
#define EINFO_EINPROGRESS_JOINING
Dynamic memory allocation.
uint16_t ar_hrd
Link-layer protocol.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
struct net_device * alloc_netdev(size_t priv_len)
Allocate network device.
const char * name
Protocol name.
#define list_del(list)
Delete an entry from a list.
uint8_t h_dest[ETH_ALEN]
Destination MAC address.
#define ENOMEM
Not enough space.
Infiniband completion queue operations.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
Infiniband queue pair operations.
static unsigned int ipoib_discard_remac(void)
Discard some entries from the REMAC cache.
static int ipoib_probe(struct ib_device *ibdev)
Probe IPoIB device.
unsigned long qkey
Queue key.
struct list_head peers
REMAC cache.
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.
uint16_t reserved
Reserved, must be zero.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define container_of(ptr, type, field)
Get containing structure.
#define CACHE_EXPENSIVE
Items with a high replacement cost.
unsigned int(* discard)(void)
Discard some cached data.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static void ipoib_close(struct net_device *netdev)
Close IPoIB network device.
void * priv
Driver private data.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
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.
#define __unused
Declare a variable or data structure as unused.
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
#define list_for_each_entry_reverse(pos, head, member)
Iterate over entries in a list in reverse order.
unsigned long qpn
Queue pair number.
struct ipoib_mac mac
MAC address.
static struct net_device * netdev
#define IB_GID_MULTICAST(gid)
Test for multicast GID.
struct list_head list
List of REMAC cache entries.
int eth_mc_hash(unsigned int af, const void *net_addr, void *ll_addr)
Hash multicast address.
static int is_multicast_ether_addr(const void *addr)
Check if Ethernet address is a multicast address.
#define ARPHRD_INFINIBAND
InfiniBand.
struct ipoib_mac mac
MAC address.
An Infiniband multicast group membership.
struct errortab ipoib_errors [] __errortab
Human-readable message for the link status.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
static void ipoib_leave_broadcast_group(struct ipoib_device *ipoib)
Leave IPv4 broadcast multicast group.
#define IB_QPN_BROADCAST
Broadcast QPN.
int arp_tx_request(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *net_source)
Transmit ARP request.
static void ipoib_remove(struct ib_device *ibdev)
Remove IPoIB device.
#define iob_unput(iobuf, len)
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
static __always_inline void * ib_qp_get_ownerdata(struct ib_queue_pair *qp)
Get Infiniband queue pair owner-private data.
#define for_each_netdev(netdev)
Iterate over all network devices.
uint16_t ar_op
ARP opcode.
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
struct ipoib_remac remac
Remote Ethermet MAC.
struct cache_discarder ipoib_discarder __cache_discarder(CACHE_EXPENSIVE)
IPoIB cache discarder.
An Infiniband Globally Unique Identifier.
static int ipoib_translate_tx_arp(struct net_device *netdev, struct io_buffer *iobuf)
Translate transmitted ARP packet.
void netdev_link_err(struct net_device *netdev, int rc)
Mark network device as having a specific link state.
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
#define ARPOP_REPLY
ARP reply.
An Infiniband Completion Queue.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
void ib_destroy_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
static int ipoib_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet via IPoIB network device.
uint32_t flags__qpn
Queue pair number.
uint8_t h_source[ETH_ALEN]
Source MAC address.
static struct ib_completion_queue_operations ipoib_cq_op
IPoIB completion operations.
unsigned long qpn
Queue Pair Number.
int ib_resolve_path(struct ib_device *ibdev, struct ib_address_vector *av)
Resolve path.
static void * arp_sender_ha(struct arphdr *arphdr)
ARP packet sender hardware address.
static struct io_buffer * ipoib_alloc_iob(size_t len)
Allocate IPoIB receive I/O buffer.
void * malloc(size_t size)
Allocate memory.
static int ipoib_open(struct net_device *netdev)
Open IPoIB network device.
#define IPOIB_GUID_MASK
GUID mask used for constructing eIPoIB Local Ethernet MAC address (LEMAC)
Network device operations.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
void retry_poll(void)
Poll the retry timer list.
An Infiniband Queue Pair.
struct ib_mc_membership membership
Multicast group membership.
Network device management.
#define EINPROGRESS_JOINING
Link status for "broadcast join in progress".
uint16_t proto
Network-layer protocol.
struct arbelprm_qp_db_record qp
#define IPOIB_NUM_CQES
Number of IPoIB completion entries.
int ib_post_send(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *dest, struct io_buffer *iobuf)
Post send work queue entry.
#define iob_reserve(iobuf, len)
#define INIT_LIST_HEAD(list)
Initialise a list head.
struct ipoib_broadcast broadcast
Broadcast address.
#define IPOIB_NUM_SEND_WQES
Number of IPoIB send work queue entries.
struct ib_driver ipoib_driver __ib_driver
IPoIB driver.
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
char name[NETDEV_NAME_LEN]
Name of this network device.
struct list_head list
List of IPoIB devices.
#define ENOBUFS
No buffer space available.
#define ENOTTY
Inappropriate I/O control operation.
int ib_create_qp(struct ib_device *ibdev, enum ib_queue_pair_type type, unsigned int num_send_wqes, struct ib_completion_queue *send_cq, unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq, struct ib_queue_pair_operations *op, const char *name, struct ib_queue_pair **new_qp)
Create queue pair.
static void ipoib_flush_remac(struct ipoib_device *ipoib)
Flush REMAC cache.
static int ipoib_join_broadcast_group(struct ipoib_device *ipoib)
Join IPv4 broadcast multicast group.
void * data
Start of data.
eIPoIB Remote Ethernet MAC address
#define EIO
Input/output error.
union ib_gid gid
GID, if present.
static void ipoib_notify(struct ib_device *ibdev)
Handle device or link status change.
void(* complete_send)(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc)
Complete Send WQE.
uint8_t ar_pln
Network-layer address length.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
uint16_t pkey
Partition key.
An Infiniband Address Vector.
static struct net_device_operations ipoib_operations
IPoIB network device operations.
struct mschapv2_challenge peer
Peer challenge.
static void ipoib_init_addr(const void *hw_addr, void *ll_addr)
Initialise IPoIB link-layer address.
unsigned int lid
Local ID.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
size_t max_pkt_len
Maximum packet length.
static struct ipoib_mac * ipoib_find_remac(struct ipoib_device *ipoib, const struct ipoib_remac *remac)
Find IPoIB MAC from REMAC.
static int ipoib_translate_tx(struct net_device *netdev, struct io_buffer *iobuf, uint16_t net_proto)
Translate transmitted packet.
void ib_mcast_leave(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_mc_membership *membership)
Leave multicast group.
#define ARPHRD_ETHER
Ethernet 10Mbps.
static int ipoib_translate_rx(struct net_device *netdev, struct io_buffer *iobuf, struct ipoib_remac *remac, uint16_t net_proto)
Translate received packet.
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.
uint8_t lemac[ETH_ALEN]
IPoIB LEMAC (if non-default)
#define ENETUNREACH
Network unreachable.
An Ethernet link-layer header.
static struct ib_queue_pair_operations ipoib_qp_op
IPoIB queue pair operations.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
static __always_inline void ib_qp_set_ownerdata(struct ib_queue_pair *qp, void *priv)
Set Infiniband queue pair owner-private data.
struct ipoib_mac mac
Local MAC.
struct ib_address_vector av
Address vector.
An IPoIB broadcast address.
#define IB_QPN_MASK
QPN mask.
struct ll_protocol * ll_protocol
Link-layer protocol.
struct ib_completion_queue * cq
Completion queue.
struct ll_protocol ipoib_protocol __ll_protocol
IPoIB protocol.
union ib_gid gid
Port GID.
#define IB_MAX_PAYLOAD_SIZE
Maximum payload size.
void * memset(void *dest, int character, size_t len) __nonnull
struct net_device * netdev
Network device.