47 #define EOIB_NUM_SEND_WQES 8 50 #define EOIB_NUM_RECV_WQES 4 53 #define EOIB_NUM_CQES 16 56 #define EINPROGRESS_JOINING __einfo_error ( EINFO_EINPROGRESS_JOINING ) 57 #define EINFO_EINPROGRESS_JOINING __einfo_uniqify \ 58 ( EINFO_EINPROGRESS, 0x01, "Joining" ) 155 unsigned int discarded = 0;
199 DBGCP ( eoib,
"EoIB %s %s TX multicast\n",
209 DBGC ( eoib,
"EoIB %s %s TX unknown\n",
218 if ( !
peer->av.gid_present ) {
219 DBGCP ( eoib,
"EoIB %s %s TX not yet recorded\n",
228 DBGCP ( eoib,
"EoIB %s %s TX not yet resolved\n",
234 peer->av.gid_present = 1;
254 unsigned long qpn = av->
qpn;
259 DBGC ( eoib,
"EoIB %s %s RX with no GID\n",
282 DBGCP ( eoib,
"EoIB %s %s RX unchanged\n",
290 peer->av.gid_present = 1;
327 eoib_hdr =
iob_push ( iobuf,
sizeof ( *eoib_hdr ) );
332 zlen = (
sizeof ( *eoib_hdr ) +
ETH_ZLEN );
334 if (
iob_len ( iobuf ) < zlen )
393 if (
iob_len ( iobuf ) < (
sizeof ( *eoib_hdr ) +
sizeof ( *
ethhdr ) )){
394 DBGC ( eoib,
"EoIB %s received packet too short to " 395 "contain EoIB and Ethernet headers\n", eoib->
name );
401 DBGC ( eoib,
"EoIB %s received packet without address " 402 "vector\n", eoib->
name );
408 iob_pull ( iobuf,
sizeof ( *eoib_hdr ) );
472 DBGC ( eoib,
"EoIB %s could not join broadcast group: %s\n",
515 DBGC ( eoib,
"EoIB %s could not rejoin broadcast group: " 535 DBGC ( eoib,
"EoIB %s could not open %s: %s\n",
542 &eoib->
cq ) ) != 0 ) {
543 DBGC ( eoib,
"EoIB %s could not create completion queue: %s\n",
552 DBGC ( eoib,
"EoIB %s could not create queue pair: %s\n",
654 DBGC ( eoib,
"EoIB %s created for %s MAC %s\n",
708 DBGC ( eoib,
"EoIB %s destroyed\n", eoib->
name );
854 DBGC ( eoib,
"EoIB %s no path to gateway: %s\n",
890 DBGC ( eoib,
"EoIB %s not using gateway\n", eoib->
name );
int eoib_create(struct ib_device *ibdev, const uint8_t *hw_addr, struct ib_address_vector *broadcast, const char *name)
Create EoIB device.
#define iob_pull(iobuf, len)
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
Ethernet over Infiniband.
const char * name
Protocol name.
struct list_head peers
Peer cache.
#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.
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.
#define EOIB_NUM_SEND_WQES
Number of EoIB send work queue entries.
char name[IBDEV_NAME_LEN]
Name of this Infiniband device.
static int ib_is_open(struct ib_device *ibdev)
Check whether or not Infiniband device is open.
struct ib_address_vector broadcast
Broadcast address.
#define EINFO_EINPROGRESS_JOINING
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int(* open)(struct net_device *netdev)
Open network device.
void eoib_destroy(struct eoib_device *eoib)
Remove EoIB device.
#define list_add(new, head)
Add a new entry to the head of a list.
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
Infiniband multicast groups.
struct ib_driver eoib_driver __ib_driver
EoIB driver.
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.
#define iob_push(iobuf, len)
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
void eoib_set_gateway(struct eoib_device *eoib, struct ib_address_vector *av)
Set EoIB gateway.
#define __einfo_errortab(einfo)
#define IB_PKEY_FULL
Infiniband partition key full membership flag.
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.
void ib_refill_recv(struct ib_device *ibdev, struct ib_queue_pair *qp)
Refill receive work queue.
#define EOIB_MAGIC
EoIB magic signature.
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.
static void eoib_notify(struct ib_device *ibdev)
Handle device or link status change.
An Infiniband upper-layer driver.
static LIST_HEAD(eoib_devices)
List of EoIB devices.
static int eoib_join_broadcast_group(struct eoib_device *eoib)
Join EoIB broadcast multicast group.
void ib_close(struct ib_device *ibdev)
Close port.
uint8_t mac[ETH_ALEN]
MAC address.
struct net_protocol eoib_heartbeat_protocol __net_protocol
EoIB heartbeat network protocol.
unsigned int gid_present
GID is present.
static void eoib_remove(struct ib_device *ibdev)
Remove EoIB device.
#define EOIB_NUM_RECV_WQES
Number of EoIB receive work queue entries.
struct net_device_operations * op
Network device operations.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
static __always_inline struct ib_device * ibdev_get(struct ib_device *ibdev)
Get reference to Infiniband device.
An Infiniband Global Identifier.
struct ib_completion_queue * cq
Completion queue.
#define EOIB_NUM_CQES
Number of EoIB completion queue entries.
void ib_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
A doubly-linked list entry (or list head)
Dynamic memory allocation.
static void eoib_rx_av(struct eoib_device *eoib, const uint8_t *mac, const struct ib_address_vector *av)
Record source address vector.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static unsigned int eoib_discard(void)
Discard some entries from the peer cache.
#define list_del(list)
Delete an entry from a list.
#define EINPROGRESS_JOINING
Link status for "broadcast join in progress".
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 struct ib_queue_pair_operations eoib_qp_op
EoIB queue pair operations.
unsigned long qkey
Queue key.
static void eoib_poll(struct net_device *netdev)
Poll EoIB network device.
static int eoib_open(struct net_device *netdev)
Open EoIB network device.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define container_of(ptr, type, field)
Get containing structure.
static int eoib_probe(struct ib_device *ibdev __unused)
Probe EoIB device.
#define CACHE_EXPENSIVE
Items with a high replacement cost.
unsigned int(* discard)(void)
Discard some cached data.
uint8_t mac[ETH_ALEN]
Ethernet MAC.
void * priv
Driver private data.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
static int eoib_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet via EoIB network device.
#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.
struct ib_mc_membership membership
Broadcast group membership.
struct list_head list
List of EoIB devices.
#define list_for_each_entry_reverse(pos, head, member)
Iterate over entries in a list in reverse order.
unsigned int mask
Multicast group additional component mask.
static struct net_device * netdev
static int is_multicast_ether_addr(const void *addr)
Check if Ethernet address is a multicast address.
static void eoib_link_state_changed(struct eoib_device *eoib)
Handle link status change.
struct net_device * netdev
Network device.
An Infiniband multicast group membership.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
static int eoib_has_gateway(struct eoib_device *eoib)
Check if EoIB device uses a gateway.
struct ib_device * ibdev
Underlying Infiniband device.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
#define IB_GID_ARGS(gid)
Infiniband Global Identifier debug message arguments.
static __always_inline void ibdev_put(struct ib_device *ibdev)
Drop reference to Infiniband device.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
struct cache_discarder eoib_discarder __cache_discarder(CACHE_EXPENSIVE)
EoIB cache discarder.
static void eoib_flush_peers(struct eoib_device *eoib)
Flush EoIB peer cache.
void(* duplicate)(struct eoib_device *eoib, struct io_buffer *original)
Send duplicate packet to gateway (or NULL)
static __always_inline void * ib_qp_get_ownerdata(struct ib_queue_pair *qp)
Get Infiniband queue pair owner-private data.
void * zalloc(size_t size)
Allocate cleared memory.
#define for_each_netdev(netdev)
Iterate over all network devices.
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.
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.
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.
static void eoib_duplicate(struct eoib_device *eoib, struct io_buffer *original)
Transmit duplicate packet to the EoIB gateway.
void netdev_link_err(struct net_device *netdev, int rc)
Mark network device as having a specific link state.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void eoib_leave_broadcast_group(struct eoib_device *eoib)
Leave EoIB broadcast multicast group.
void ib_destroy_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
uint8_t h_source[ETH_ALEN]
Source MAC address.
struct list_head list
List of EoIB peer cache entries.
unsigned long qpn
Queue Pair Number.
An EoIB peer cache entry.
int ib_resolve_path(struct ib_device *ibdev, struct ib_address_vector *av)
Resolve path.
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.
A network-layer protocol.
Network device management.
static struct net_device_operations eoib_operations
EoIB network device operations.
struct eoib_device * eoib_find(struct ib_device *ibdev, const uint8_t *hw_addr)
Find EoIB device.
struct arbelprm_qp_db_record qp
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 INIT_LIST_HEAD(list)
Initialise a list head.
static struct eoib_peer * eoib_find_peer(struct eoib_device *eoib, const uint8_t *mac)
Find EoIB peer cache entry.
static size_t iob_headroom(struct io_buffer *iobuf)
Calculate available space at start of an I/O buffer.
struct ib_address_vector gateway
Gateway (if any)
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 which this buffer is a member.
struct ib_address_vector av
Infiniband address vector.
#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.
#define IOB_ZLEN
Minimum I/O buffer length.
void * data
Start of data.
#define EIO
Input/output error.
static struct ib_completion_queue_operations eoib_cq_op
EoIB completion operations.
union ib_gid gid
GID, if present.
static struct eoib_peer * eoib_create_peer(struct eoib_device *eoib, const uint8_t *mac)
Create EoIB peer cache entry.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
#define IB_GID_FMT
Infiniband Global Identifier debug message format.
void(* complete_send)(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc)
Complete Send WQE.
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
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
uint16_t pkey
Partition key.
An Infiniband Address Vector.
static const char * eoib_heartbeat_ntoa(const void *net_addr __unused)
Transcribe EoIB heartbeat address.
struct mschapv2_challenge peer
Peer challenge.
struct ib_queue_pair * qp
Queue pair.
unsigned int lid
Local ID.
void ib_mcast_leave(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_mc_membership *membership)
Leave multicast group.
struct errortab eoib_errors [] __errortab
Human-readable message for the link status.
static struct ib_address_vector * eoib_tx_av(struct eoib_device *eoib, const uint8_t *mac)
Find destination address vector.
An Ethernet link-layer header.
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 void eoib_join_complete(struct ib_mc_membership *membership, int rc)
Handle EoIB broadcast multicast group join completion.
static __always_inline void ib_qp_set_ownerdata(struct ib_queue_pair *qp, void *priv)
Set Infiniband queue pair owner-private data.
void iob_pad(struct io_buffer *iobuf, size_t min_len)
Pad I/O buffer.
static void eoib_close(struct net_device *netdev)
Close EoIB network device.