iPXE
Data Structures | Defines | Enumerations | Functions | Variables
infiniband.h File Reference

Infiniband protocol. More...

#include <stdint.h>
#include <ipxe/refcnt.h>
#include <ipxe/device.h>
#include <ipxe/tables.h>
#include <ipxe/ib_packet.h>
#include <ipxe/ib_mad.h>
#include <ipxe/if_ether.h>

Go to the source code of this file.

Data Structures

struct  ib_address_vector
 An Infiniband Address Vector. More...
struct  ib_work_queue
 An Infiniband Work Queue. More...
struct  ib_multicast_gid
 An Infiniband multicast GID. More...
struct  ib_queue_pair_operations
 Infiniband queue pair operations. More...
struct  ib_queue_pair
 An Infiniband Queue Pair. More...
struct  ib_completion_queue_operations
 Infiniband completion queue operations. More...
struct  ib_completion_queue
 An Infiniband Completion Queue. More...
struct  ib_device_operations
 Infiniband device operations. More...
struct  ib_device
 An Infiniband device. More...
struct  ib_driver
 An Infiniband upper-layer driver. More...

Defines

#define IB_QPN_SMI   0
 Subnet management interface QPN.
#define IB_QKEY_SMI   0
 Subnet management interface queue key.
#define IB_QPN_GSI   1
 General service interface QPN.
#define IB_QKEY_GSI   0x80010000UL
 General service interface queue key.
#define IB_QPN_BROADCAST   0xffffffUL
 Broadcast QPN.
#define IB_QPN_MASK   0xffffffUL
 QPN mask.
#define IB_PKEY_DEFAULT   0xffff
 Default Infiniband partition key.
#define IB_PKEY_FULL   0x8000
 Infiniband partition key full membership flag.
#define IB_MAX_PAYLOAD_SIZE   2048
 Maximum payload size.
#define IBDEV_NAME_LEN   8
 Maximum length of an Infiniband device name.
#define IB_DRIVERS   __table ( struct ib_driver, "ib_drivers" )
 Infiniband driver table.
#define __ib_driver   __table_entry ( IB_DRIVERS, 01 )
 Declare an Infiniband driver.
#define for_each_ibdev(ibdev)   list_for_each_entry ( (ibdev), &ib_devices, list )
 Iterate over all network devices.

Enumerations

enum  ib_rate {
  IB_RATE_2_5 = 2, IB_RATE_10 = 3, IB_RATE_30 = 4, IB_RATE_5 = 5,
  IB_RATE_20 = 6, IB_RATE_40 = 7, IB_RATE_60 = 8, IB_RATE_80 = 9,
  IB_RATE_120 = 10
}
 Infiniband transmission rates. More...
enum  ib_queue_pair_type {
  IB_QPT_SMI, IB_QPT_GSI, IB_QPT_UD, IB_QPT_RC,
  IB_QPT_ETH
}
 An Infiniband queue pair type. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
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_destroy_cq (struct ib_device *ibdev, struct ib_completion_queue *cq)
 Destroy completion queue.
void ib_poll_cq (struct ib_device *ibdev, struct ib_completion_queue *cq)
 Poll completion queue.
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.
int ib_modify_qp (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Modify queue pair.
void ib_destroy_qp (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Destroy queue pair.
struct ib_queue_pairib_find_qp_qpn (struct ib_device *ibdev, unsigned long qpn)
 Find queue pair by QPN.
struct ib_queue_pairib_find_qp_mgid (struct ib_device *ibdev, union ib_gid *gid)
 Find queue pair by multicast GID.
struct ib_work_queueib_find_wq (struct ib_completion_queue *cq, unsigned long qpn, int is_send)
 Find work queue belonging to completion queue.
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.
int ib_post_recv (struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf)
 Post receive work queue entry.
void ib_complete_send (struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc)
 Complete send work queue entry.
void ib_complete_recv (struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *dest, struct ib_address_vector *source, struct io_buffer *iobuf, int rc)
 Complete receive work queue entry.
void ib_refill_recv (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Refill receive work queue.
int ib_open (struct ib_device *ibdev)
 Open port.
void ib_close (struct ib_device *ibdev)
 Close port.
int ib_link_rc (struct ib_device *ibdev)
 Get link state.
int ib_mcast_attach (struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
 Attach to multicast group.
void ib_mcast_detach (struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
 Detach from multicast group.
int ib_count_ports (struct ib_device *ibdev)
 Count Infiniband HCA ports.
int ib_set_port_info (struct ib_device *ibdev, union ib_mad *mad)
 Set port information.
int ib_set_pkey_table (struct ib_device *ibdev, union ib_mad *mad)
 Set partition key table.
struct ib_devicealloc_ibdev (size_t priv_size)
 Allocate Infiniband device.
int register_ibdev (struct ib_device *ibdev)
 Register Infiniband device.
void unregister_ibdev (struct ib_device *ibdev)
 Unregister Infiniband device.
struct ib_devicefind_ibdev (union ib_gid *gid)
 Find Infiniband device by GID.
struct ib_devicelast_opened_ibdev (void)
 Get most recently opened Infiniband device.
void ib_link_state_changed (struct ib_device *ibdev)
 Notify of Infiniband link state change.
void ib_poll_eq (struct ib_device *ibdev)
 Poll event queue.
static __always_inline int ib_link_ok (struct ib_device *ibdev)
 Check link state of Infiniband device.
static int ib_is_open (struct ib_device *ibdev)
 Check whether or not Infiniband device is open.
static __always_inline struct
ib_device
ibdev_get (struct ib_device *ibdev)
 Get reference to Infiniband device.
static __always_inline void ibdev_put (struct ib_device *ibdev)
 Drop reference to Infiniband device.
static __always_inline void ib_wq_set_drvdata (struct ib_work_queue *wq, void *priv)
 Set Infiniband work queue driver-private data.
static __always_inline void * ib_wq_get_drvdata (struct ib_work_queue *wq)
 Get Infiniband work queue driver-private data.
static __always_inline void ib_qp_set_drvdata (struct ib_queue_pair *qp, void *priv)
 Set Infiniband queue pair driver-private data.
static __always_inline void * ib_qp_get_drvdata (struct ib_queue_pair *qp)
 Get Infiniband queue pair driver-private data.
static __always_inline void ib_qp_set_ownerdata (struct ib_queue_pair *qp, void *priv)
 Set Infiniband queue pair owner-private data.
static __always_inline void * ib_qp_get_ownerdata (struct ib_queue_pair *qp)
 Get Infiniband queue pair owner-private data.
static __always_inline void ib_cq_set_drvdata (struct ib_completion_queue *cq, void *priv)
 Set Infiniband completion queue driver-private data.
static __always_inline void * ib_cq_get_drvdata (struct ib_completion_queue *cq)
 Get Infiniband completion queue driver-private data.
static __always_inline void ib_set_drvdata (struct ib_device *ibdev, void *priv)
 Set Infiniband device driver-private data.
static __always_inline void * ib_get_drvdata (struct ib_device *ibdev)
 Get Infiniband device driver-private data.

Variables

struct list_head ib_devices
 List of Infiniband devices.

Detailed Description

Infiniband protocol.

Definition in file infiniband.h.


Define Documentation

#define IB_QPN_SMI   0

Subnet management interface QPN.

Definition at line 21 of file infiniband.h.

Referenced by arbel_fill_mlx_send_wqe(), hermon_fill_mlx_send_wqe(), ib_create_qp(), and ib_push().

#define IB_QKEY_SMI   0

Subnet management interface queue key.

Definition at line 24 of file infiniband.h.

Referenced by ib_create_mi().

#define IB_QPN_GSI   1

General service interface QPN.

Definition at line 27 of file infiniband.h.

Referenced by ib_cm_path_complete(), ib_create_madx(), ib_create_qp(), and xsigo_xds_complete().

#define IB_QKEY_GSI   0x80010000UL

General service interface queue key.

Definition at line 30 of file infiniband.h.

Referenced by ib_cm_path_complete(), ib_create_madx(), ib_create_mi(), and xsigo_xds_complete().

#define IB_QPN_BROADCAST   0xffffffUL

Broadcast QPN.

Definition at line 33 of file infiniband.h.

Referenced by ipoib_link_state_changed(), and xve_create().

#define IB_QPN_MASK   0xffffffUL

QPN mask.

Definition at line 36 of file infiniband.h.

Referenced by ipoib_transmit().

#define IB_PKEY_DEFAULT   0xffff

Default Infiniband partition key.

Definition at line 39 of file infiniband.h.

Referenced by alloc_ibdev(), and ib_srp_parse_pkey().

#define IB_PKEY_FULL   0x8000

Infiniband partition key full membership flag.

Definition at line 42 of file infiniband.h.

Referenced by eoib_link_state_changed(), ib_mcast_mad(), and ipoib_link_state_changed().

#define IB_MAX_PAYLOAD_SIZE   2048

Maximum payload size.

This is currently hard-coded in various places (drivers, subnet management agent, etc.) to 2048.

Definition at line 50 of file infiniband.h.

Referenced by alloc_ipoibdev(), ib_cmrc_xfer_window(), ib_post_recv(), ib_refill_recv(), and xve_update_mtu().

#define IBDEV_NAME_LEN   8

Maximum length of an Infiniband device name.

Definition at line 395 of file infiniband.h.

#define IB_DRIVERS   __table ( struct ib_driver, "ib_drivers" )

Infiniband driver table.

Definition at line 491 of file infiniband.h.

Referenced by ib_notify(), register_ibdev(), and unregister_ibdev().

#define __ib_driver   __table_entry ( IB_DRIVERS, 01 )

Declare an Infiniband driver.

Definition at line 494 of file infiniband.h.

#define for_each_ibdev (   ibdev)    list_for_each_entry ( (ibdev), &ib_devices, list )

Iterate over all network devices.

Definition at line 554 of file infiniband.h.

Referenced by find_ibdev(), ib_count_ports(), and ibstat_exec().


Enumeration Type Documentation

enum ib_rate

Infiniband transmission rates.

Enumerator:
IB_RATE_2_5 
IB_RATE_10 
IB_RATE_30 
IB_RATE_5 
IB_RATE_20 
IB_RATE_40 
IB_RATE_60 
IB_RATE_80 
IB_RATE_120 

Definition at line 59 of file infiniband.h.

             {
        IB_RATE_2_5 = 2,
        IB_RATE_10 = 3,
        IB_RATE_30 = 4,
        IB_RATE_5 = 5,
        IB_RATE_20 = 6,
        IB_RATE_40 = 7,
        IB_RATE_60 = 8,
        IB_RATE_80 = 9,
        IB_RATE_120 = 10,
};

An Infiniband queue pair type.

Enumerator:
IB_QPT_SMI 
IB_QPT_GSI 
IB_QPT_UD 
IB_QPT_RC 
IB_QPT_ETH 

Definition at line 138 of file infiniband.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
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.

Parameters:
ibdevInfiniband device
num_cqesNumber of completion queue entries
opCompletion queue operations
new_cqNew completion queue to fill in
Return values:
rcReturn status code

Definition at line 98 of file infiniband.c.

References ib_completion_queue::cqn, ib_device::cqs, ib_device_operations::create_cq, DBGC, ib_device_operations::destroy_cq, ENOMEM, free, ib_cq_get_drvdata(), ib_completion_queue::ibdev, INIT_LIST_HEAD, ib_completion_queue::list, list_add_tail, list_del, ib_device::name, ib_completion_queue::num_cqes, ib_completion_queue::op, op, ib_device::op, rc, strerror(), ib_completion_queue::work_queues, and zalloc().

Referenced by eoib_open(), flexboot_nodnic_eth_open(), hermon_eth_open(), ib_cmrc_open(), ib_create_mi(), and ipoib_open().

                                                         {
        struct ib_completion_queue *cq;
        int rc;

        DBGC ( ibdev, "IBDEV %s creating completion queue\n", ibdev->name );

        /* Allocate and initialise data structure */
        cq = zalloc ( sizeof ( *cq ) );
        if ( ! cq ) {
                rc = -ENOMEM;
                goto err_alloc_cq;
        }
        cq->ibdev = ibdev;
        list_add_tail ( &cq->list, &ibdev->cqs );
        cq->num_cqes = num_cqes;
        INIT_LIST_HEAD ( &cq->work_queues );
        cq->op = op;

        /* Perform device-specific initialisation and get CQN */
        if ( ( rc = ibdev->op->create_cq ( ibdev, cq ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s could not initialise completion "
                       "queue: %s\n", ibdev->name, strerror ( rc ) );
                goto err_dev_create_cq;
        }

        DBGC ( ibdev, "IBDEV %s created %d-entry completion queue %p (%p) "
               "with CQN %#lx\n", ibdev->name, num_cqes, cq,
               ib_cq_get_drvdata ( cq ), cq->cqn );
        *new_cq = cq;
        return 0;

        ibdev->op->destroy_cq ( ibdev, cq );
 err_dev_create_cq:
        list_del ( &cq->list );
        free ( cq );
 err_alloc_cq:
        return rc;
}
void ib_destroy_cq ( struct ib_device ibdev,
struct ib_completion_queue cq 
)

Destroy completion queue.

Parameters:
ibdevInfiniband device
cqCompletion queue

Definition at line 145 of file infiniband.c.

References assert, ib_completion_queue::cqn, DBGC, ib_device_operations::destroy_cq, free, ib_completion_queue::list, list_del, list_empty, ib_device::name, ib_device::op, and ib_completion_queue::work_queues.

Referenced by eoib_close(), eoib_open(), flexboot_nodnic_eth_close(), hermon_eth_close(), hermon_eth_open(), ib_cmrc_open(), ib_cmrc_shutdown(), ib_create_mi(), ib_destroy_mi(), ipoib_close(), and ipoib_open().

                                                      {
        DBGC ( ibdev, "IBDEV %s destroying completion queue %#lx\n",
               ibdev->name, cq->cqn );
        assert ( list_empty ( &cq->work_queues ) );
        ibdev->op->destroy_cq ( ibdev, cq );
        list_del ( &cq->list );
        free ( cq );
}
void ib_poll_cq ( struct ib_device ibdev,
struct ib_completion_queue cq 
)

Poll completion queue.

Parameters:
ibdevInfiniband device
cqCompletion queue

Definition at line 161 of file infiniband.c.

References ib_refill_recv(), ib_work_queue::is_send, ib_work_queue::list, list_for_each_entry, ib_device::op, ib_device_operations::poll_cq, ib_work_queue::qp, and ib_completion_queue::work_queues.

Referenced by flexboot_nodnic_complete_all_tx(), golan_cq_clean(), and ib_poll_eq().

                                                   {
        struct ib_work_queue *wq;

        /* Poll completion queue */
        ibdev->op->poll_cq ( ibdev, cq );

        /* Refill receive work queues */
        list_for_each_entry ( wq, &cq->work_queues, list ) {
                if ( ! wq->is_send )
                        ib_refill_recv ( ibdev, wq->qp );
        }
}
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.

Parameters:
ibdevInfiniband device
typeQueue pair type
num_send_wqesNumber of send work queue entries
send_cqSend completion queue
num_recv_wqesNumber of receive work queue entries
recv_cqReceive completion queue
opQueue pair operations
nameQueue pair name
new_qpNew queue pair to fill in
Return values:
rcReturn status code

The queue pair will be left in the INIT state; you must call ib_modify_qp() before it is ready to use for sending and receiving.

Definition at line 199 of file infiniband.c.

References ib_work_queue::cq, ib_device_operations::create_qp, DBGC, ib_device_operations::destroy_qp, ENOMEM, free, ib_qp_get_drvdata(), IB_QPN_GSI, IB_QPN_SMI, IB_QPT_GSI, IB_QPT_SMI, ib_queue_pair::ibdev, INIT_LIST_HEAD, ib_work_queue::iobufs, ib_work_queue::is_send, ib_work_queue::list, ib_queue_pair::list, list_add_tail, list_del, ib_queue_pair::mgids, ib_queue_pair::name, ib_device::name, name, ib_work_queue::num_wqes, ib_queue_pair::op, op, ib_device::op, ib_work_queue::psn, ib_work_queue::qp, qp, ib_queue_pair::qpn, ib_device::qps, random(), rc, ib_queue_pair::recv, ib_queue_pair::send, strerror(), ib_queue_pair::type, type, ib_completion_queue::work_queues, and zalloc().

Referenced by eoib_open(), flexboot_nodnic_eth_open(), hermon_eth_open(), ib_cmrc_open(), ib_create_mi(), and ipoib_open().

                                                   {
        struct ib_queue_pair *qp;
        size_t total_size;
        int rc;

        DBGC ( ibdev, "IBDEV %s creating queue pair\n", ibdev->name );

        /* Allocate and initialise data structure */
        total_size = ( sizeof ( *qp ) +
                       ( num_send_wqes * sizeof ( qp->send.iobufs[0] ) ) +
                       ( num_recv_wqes * sizeof ( qp->recv.iobufs[0] ) ) );
        qp = zalloc ( total_size );
        if ( ! qp ) {
                rc = -ENOMEM;
                goto err_alloc_qp;
        }
        qp->ibdev = ibdev;
        list_add_tail ( &qp->list, &ibdev->qps );
        qp->type = type;
        qp->send.qp = qp;
        qp->send.is_send = 1;
        qp->send.cq = send_cq;
        list_add_tail ( &qp->send.list, &send_cq->work_queues );
        qp->send.psn = ( random() & 0xffffffUL );
        qp->send.num_wqes = num_send_wqes;
        qp->send.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) );
        qp->recv.qp = qp;
        qp->recv.cq = recv_cq;
        list_add_tail ( &qp->recv.list, &recv_cq->work_queues );
        qp->recv.psn = ( random() & 0xffffffUL );
        qp->recv.num_wqes = num_recv_wqes;
        qp->recv.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) +
                            ( num_send_wqes * sizeof ( qp->send.iobufs[0] ) ));
        INIT_LIST_HEAD ( &qp->mgids );
        qp->op = op;
        qp->name = name;

        /* Perform device-specific initialisation and get QPN */
        if ( ( rc = ibdev->op->create_qp ( ibdev, qp ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s could not initialise queue pair: "
                       "%s\n", ibdev->name, strerror ( rc ) );
                goto err_dev_create_qp;
        }
        DBGC ( ibdev, "IBDEV %s created queue pair %p (%p) with QPN %#lx\n",
               ibdev->name, qp, ib_qp_get_drvdata ( qp ), qp->qpn );
        DBGC ( ibdev, "IBDEV %s QPN %#lx has %d send entries at [%p,%p)\n",
               ibdev->name, qp->qpn, num_send_wqes, qp->send.iobufs,
               qp->recv.iobufs );
        DBGC ( ibdev, "IBDEV %s QPN %#lx has %d receive entries at [%p,%p)\n",
               ibdev->name, qp->qpn, num_recv_wqes, qp->recv.iobufs,
               ( ( ( void * ) qp ) + total_size ) );

        /* Calculate externally-visible QPN */
        switch ( type ) {
        case IB_QPT_SMI:
                qp->ext_qpn = IB_QPN_SMI;
                break;
        case IB_QPT_GSI:
                qp->ext_qpn = IB_QPN_GSI;
                break;
        default:
                qp->ext_qpn = qp->qpn;
                break;
        }
        if ( qp->ext_qpn != qp->qpn ) {
                DBGC ( ibdev, "IBDEV %s QPN %#lx has external QPN %#lx\n",
                       ibdev->name, qp->qpn, qp->ext_qpn );
        }

        *new_qp = qp;
        return 0;

        ibdev->op->destroy_qp ( ibdev, qp );
 err_dev_create_qp:
        list_del ( &qp->send.list );
        list_del ( &qp->recv.list );
        list_del ( &qp->list );
        free ( qp );
 err_alloc_qp:
        return rc;
}
int ib_modify_qp ( struct ib_device ibdev,
struct ib_queue_pair qp 
)

Modify queue pair.

Parameters:
ibdevInfiniband device
qpQueue pair
Return values:
rcReturn status code

Definition at line 294 of file infiniband.c.

References DBGC, ib_device_operations::modify_qp, ib_device::name, ib_device::op, ib_queue_pair::qpn, rc, and strerror().

Referenced by hermon_eth_open(), ib_cm_req_complete(), ib_create_mi(), and ib_mcast_complete().

                                                                       {
        int rc;

        DBGC ( ibdev, "IBDEV %s modifying QPN %#lx\n", ibdev->name, qp->qpn );

        if ( ( rc = ibdev->op->modify_qp ( ibdev, qp ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s could not modify QPN %#lx: %s\n",
                       ibdev->name, qp->qpn, strerror ( rc ) );
                return rc;
        }

        return 0;
}
void ib_destroy_qp ( struct ib_device ibdev,
struct ib_queue_pair qp 
)

Destroy queue pair.

Parameters:
ibdevInfiniband device
qpQueue pair

Definition at line 314 of file infiniband.c.

References assert, DBGC, ib_device_operations::destroy_qp, ECANCELED, free, ib_complete_recv(), ib_complete_send(), ib_work_queue::iobufs, ib_work_queue::list, ib_queue_pair::list, list_del, list_empty, ib_queue_pair::mgids, ib_device::name, NULL, ib_work_queue::num_wqes, ib_device::op, ib_queue_pair::qpn, ib_queue_pair::recv, and ib_queue_pair::send.

Referenced by eoib_close(), eoib_open(), flexboot_nodnic_eth_close(), flexboot_nodnic_eth_open(), hermon_eth_close(), hermon_eth_open(), ib_cmrc_open(), ib_cmrc_shutdown(), ib_create_mi(), ib_destroy_mi(), ipoib_close(), and ipoib_open().

                                                                         {
        struct io_buffer *iobuf;
        unsigned int i;

        DBGC ( ibdev, "IBDEV %s destroying QPN %#lx\n",
               ibdev->name, qp->qpn );

        assert ( list_empty ( &qp->mgids ) );

        /* Perform device-specific destruction */
        ibdev->op->destroy_qp ( ibdev, qp );

        /* Complete any remaining I/O buffers with errors */
        for ( i = 0 ; i < qp->send.num_wqes ; i++ ) {
                if ( ( iobuf = qp->send.iobufs[i] ) != NULL )
                        ib_complete_send ( ibdev, qp, iobuf, -ECANCELED );
        }
        for ( i = 0 ; i < qp->recv.num_wqes ; i++ ) {
                if ( ( iobuf = qp->recv.iobufs[i] ) != NULL ) {
                        ib_complete_recv ( ibdev, qp, NULL, NULL, iobuf,
                                           -ECANCELED );
                }
        }

        /* Remove work queues from completion queue */
        list_del ( &qp->send.list );
        list_del ( &qp->recv.list );

        /* Free QP */
        list_del ( &qp->list );
        free ( qp );
}
struct ib_queue_pair* ib_find_qp_qpn ( struct ib_device ibdev,
unsigned long  qpn 
) [read]

Find queue pair by QPN.

Parameters:
ibdevInfiniband device
qpnQueue pair number
Return values:
qpQueue pair, or NULL

Definition at line 354 of file infiniband.c.

References ib_queue_pair::ext_qpn, ib_queue_pair::list, list_for_each_entry, NULL, qp, ib_queue_pair::qpn, and ib_device::qps.

Referenced by ib_pull().

                                                            {
        struct ib_queue_pair *qp;

        list_for_each_entry ( qp, &ibdev->qps, list ) {
                if ( ( qpn == qp->qpn ) || ( qpn == qp->ext_qpn ) )
                        return qp;
        }
        return NULL;
}
struct ib_queue_pair* ib_find_qp_mgid ( struct ib_device ibdev,
union ib_gid gid 
) [read]

Find queue pair by multicast GID.

Parameters:
ibdevInfiniband device
gidMulticast GID
Return values:
qpQueue pair, or NULL

Definition at line 372 of file infiniband.c.

References ib_multicast_gid::gid, ib_multicast_gid::list, list_for_each_entry, memcmp(), mgid, ib_queue_pair::mgids, NULL, qp, and ib_device::qps.

Referenced by ib_pull().

                                                             {
        struct ib_queue_pair *qp;
        struct ib_multicast_gid *mgid;

        list_for_each_entry ( qp, &ibdev->qps, list ) {
                list_for_each_entry ( mgid, &qp->mgids, list ) {
                        if ( memcmp ( &mgid->gid, gid,
                                      sizeof ( mgid->gid ) ) == 0 ) {
                                return qp;
                        }
                }
        }
        return NULL;
}
struct ib_work_queue* ib_find_wq ( struct ib_completion_queue cq,
unsigned long  qpn,
int  is_send 
) [read]

Find work queue belonging to completion queue.

Parameters:
cqCompletion queue
qpnQueue pair number
is_sendFind send work queue (rather than receive)
Return values:
wqWork queue, or NULL if not found

Definition at line 396 of file infiniband.c.

References ib_work_queue::is_send, ib_work_queue::list, list_for_each_entry, NULL, ib_work_queue::qp, ib_queue_pair::qpn, and ib_completion_queue::work_queues.

Referenced by arbel_complete(), golan_complete(), and hermon_complete().

                                                                     {
        struct ib_work_queue *wq;

        list_for_each_entry ( wq, &cq->work_queues, list ) {
                if ( ( wq->qp->qpn == qpn ) && ( wq->is_send == is_send ) )
                        return wq;
        }
        return NULL;
}
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.

Parameters:
ibdevInfiniband device
qpQueue pair
destDestination address vector
iobufI/O buffer
Return values:
rcReturn status code

Definition at line 416 of file infiniband.c.

References ib_queue_pair::av, DBGC, ENOBUFS, ib_work_queue::fill, IB_RATE_2_5, memcpy(), ib_device::name, ib_work_queue::num_wqes, ib_device::op, ib_device_operations::post_send, profile_start(), profile_stop(), ib_address_vector::qkey, ib_queue_pair::qkey, ib_queue_pair::qpn, ib_address_vector::rate, rc, ib_queue_pair::send, and strerror().

Referenced by eoib_duplicate(), eoib_transmit(), flexboot_nodnic_eth_transmit(), hermon_eth_transmit(), ib_cmrc_xfer_deliver(), ib_mi_send(), and ipoib_transmit().

                                             {
        struct ib_address_vector dest_copy;
        int rc;

        /* Start profiling */
        profile_start ( &ib_post_send_profiler );

        /* Check queue fill level */
        if ( qp->send.fill >= qp->send.num_wqes ) {
                DBGC ( ibdev, "IBDEV %s QPN %#lx send queue full\n",
                       ibdev->name, qp->qpn );
                return -ENOBUFS;
        }

        /* Use default address vector if none specified */
        if ( ! dest )
                dest = &qp->av;

        /* Make modifiable copy of address vector */
        memcpy ( &dest_copy, dest, sizeof ( dest_copy ) );
        dest = &dest_copy;

        /* Fill in optional parameters in address vector */
        if ( ! dest->qkey )
                dest->qkey = qp->qkey;
        if ( ! dest->rate )
                dest->rate = IB_RATE_2_5;

        /* Post to hardware */
        if ( ( rc = ibdev->op->post_send ( ibdev, qp, dest, iobuf ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s QPN %#lx could not post send WQE: "
                       "%s\n", ibdev->name, qp->qpn, strerror ( rc ) );
                return rc;
        }

        /* Increase fill level */
        qp->send.fill++;

        /* Stop profiling */
        profile_stop ( &ib_post_send_profiler );

        return 0;
}
int ib_post_recv ( struct ib_device ibdev,
struct ib_queue_pair qp,
struct io_buffer iobuf 
)

Post receive work queue entry.

Parameters:
ibdevInfiniband device
qpQueue pair
iobufI/O buffer
Return values:
rcReturn status code

Definition at line 470 of file infiniband.c.

References DBGC, EINVAL, ENOBUFS, ib_work_queue::fill, IB_MAX_PAYLOAD_SIZE, iob_tailroom(), ib_device::name, ib_work_queue::num_wqes, ib_device::op, ib_device_operations::post_recv, profile_start(), profile_stop(), ib_queue_pair::qpn, rc, ib_queue_pair::recv, and strerror().

Referenced by ib_refill_recv().

                                             {
        int rc;

        /* Start profiling */
        profile_start ( &ib_post_recv_profiler );

        /* Check packet length */
        if ( iob_tailroom ( iobuf ) < IB_MAX_PAYLOAD_SIZE ) {
                DBGC ( ibdev, "IBDEV %s QPN %#lx wrong RX buffer size (%zd)\n",
                       ibdev->name, qp->qpn, iob_tailroom ( iobuf ) );
                return -EINVAL;
        }

        /* Check queue fill level */
        if ( qp->recv.fill >= qp->recv.num_wqes ) {
                DBGC ( ibdev, "IBDEV %s QPN %#lx receive queue full\n",
                       ibdev->name, qp->qpn );
                return -ENOBUFS;
        }

        /* Post to hardware */
        if ( ( rc = ibdev->op->post_recv ( ibdev, qp, iobuf ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s QPN %#lx could not post receive WQE: "
                       "%s\n", ibdev->name, qp->qpn, strerror ( rc ) );
                return rc;
        }

        /* Increase fill level */
        qp->recv.fill++;

        /* Stop profiling */
        profile_stop ( &ib_post_recv_profiler );

        return 0;
}
void ib_complete_send ( struct ib_device ibdev,
struct ib_queue_pair qp,
struct io_buffer iobuf,
int  rc 
)

Complete send work queue entry.

Parameters:
ibdevInfiniband device
qpQueue pair
iobufI/O buffer
rcCompletion status code

Definition at line 515 of file infiniband.c.

References ib_completion_queue_operations::complete_send, ib_work_queue::cq, ib_work_queue::fill, free_iob(), ib_completion_queue::op, and ib_queue_pair::send.

Referenced by arbel_complete(), flexboot_nodnic_complete(), golan_complete(), hermon_complete(), ib_destroy_qp(), linda_complete_send(), and qib7322_complete_send().

                                                          {

        if ( qp->send.cq->op->complete_send ) {
                qp->send.cq->op->complete_send ( ibdev, qp, iobuf, rc );
        } else {
                free_iob ( iobuf );
        }
        qp->send.fill--;
}
void ib_complete_recv ( struct ib_device ibdev,
struct ib_queue_pair qp,
struct ib_address_vector dest,
struct ib_address_vector source,
struct io_buffer iobuf,
int  rc 
)

Complete receive work queue entry.

Parameters:
ibdevInfiniband device
qpQueue pair
destDestination address vector, or NULL
sourceSource address vector, or NULL
iobufI/O buffer
rcCompletion status code

Definition at line 536 of file infiniband.c.

References ib_completion_queue_operations::complete_recv, ib_work_queue::cq, ib_work_queue::fill, free_iob(), ib_completion_queue::op, and ib_queue_pair::recv.

Referenced by arbel_complete(), flexboot_nodnic_complete(), golan_complete(), hermon_complete(), ib_destroy_qp(), linda_complete_recv(), and qib7322_complete_recv().

                                                          {

        if ( qp->recv.cq->op->complete_recv ) {
                qp->recv.cq->op->complete_recv ( ibdev, qp, dest, source,
                                                 iobuf, rc );
        } else {
                free_iob ( iobuf );
        }
        qp->recv.fill--;
}
void ib_refill_recv ( struct ib_device ibdev,
struct ib_queue_pair qp 
)

Refill receive work queue.

Parameters:
ibdevInfiniband device
qpQueue pair

Definition at line 556 of file infiniband.c.

References ib_queue_pair_operations::alloc_iob, DBGC, ib_work_queue::fill, free_iob(), IB_MAX_PAYLOAD_SIZE, ib_post_recv(), ib_device::name, ib_work_queue::num_wqes, ib_queue_pair::op, rc, ib_queue_pair::recv, and strerror().

Referenced by eoib_open(), flexboot_nodnic_eth_open(), hermon_eth_open(), ib_create_mi(), ib_poll_cq(), and ipoib_open().

                                                                          {
        struct io_buffer *iobuf;
        int rc;

        /* Keep filling while unfilled entries remain */
        while ( qp->recv.fill < qp->recv.num_wqes ) {

                /* Allocate I/O buffer */
                iobuf = qp->op->alloc_iob ( IB_MAX_PAYLOAD_SIZE );
                if ( ! iobuf ) {
                        /* Non-fatal; we will refill on next attempt */
                        return;
                }

                /* Post I/O buffer */
                if ( ( rc = ib_post_recv ( ibdev, qp, iobuf ) ) != 0 ) {
                        DBGC ( ibdev, "IBDEV %s could not refill: %s\n",
                               ibdev->name, strerror ( rc ) );
                        free_iob ( iobuf );
                        /* Give up */
                        return;
                }
        }
}
int ib_open ( struct ib_device ibdev)

Open port.

Parameters:
ibdevInfiniband device
Return values:
rcReturn status code

Definition at line 652 of file infiniband.c.

References assert, ib_device_operations::close, DBGC, ib_device::gsi, ib_create_mi(), ib_create_sma(), ib_destroy_mi(), ib_destroy_sma(), ib_notify(), IB_QPT_GSI, IB_QPT_SMI, list_add, ib_device::name, ib_device::op, ib_device_operations::open, ib_device::open_count, ib_device::open_list, rc, ib_device::smi, and strerror().

Referenced by eoib_open(), ib_cmrc_open(), ipoib_open(), and xsigo_ib_open().

                                        {
        int rc;

        /* Increment device open request counter */
        if ( ibdev->open_count++ > 0 ) {
                /* Device was already open; do nothing */
                return 0;
        }

        /* Open device */
        if ( ( rc = ibdev->op->open ( ibdev ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s could not open: %s\n",
                       ibdev->name, strerror ( rc ) );
                goto err_open;
        }

        /* Create subnet management interface */
        if ( ( rc = ib_create_mi ( ibdev, IB_QPT_SMI, &ibdev->smi ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s could not create SMI: %s\n",
                       ibdev->name, strerror ( rc ) );
                goto err_create_smi;
        }

        /* Create subnet management agent */
        if ( ( rc = ib_create_sma ( ibdev, ibdev->smi ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s could not create SMA: %s\n",
                       ibdev->name, strerror ( rc ) );
                goto err_create_sma;
        }

        /* Create general services interface */
        if ( ( rc = ib_create_mi ( ibdev, IB_QPT_GSI, &ibdev->gsi ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s could not create GSI: %s\n",
                       ibdev->name, strerror ( rc ) );
                goto err_create_gsi;
        }

        /* Add to head of open devices list */
        list_add ( &ibdev->open_list, &open_ib_devices );

        /* Notify drivers of device state change */
        ib_notify ( ibdev );

        assert ( ibdev->open_count == 1 );
        return 0;

        ib_destroy_mi ( ibdev, ibdev->gsi );
 err_create_gsi:
        ib_destroy_sma ( ibdev, ibdev->smi );
 err_create_sma:
        ib_destroy_mi ( ibdev, ibdev->smi );
 err_create_smi:
        ibdev->op->close ( ibdev );
 err_open:
        assert ( ibdev->open_count == 1 );
        ibdev->open_count = 0;
        return rc;
}
void ib_close ( struct ib_device ibdev)

Close port.

Parameters:
ibdevInfiniband device

Definition at line 716 of file infiniband.c.

References ib_device_operations::close, ib_device::gsi, ib_destroy_mi(), ib_destroy_sma(), ib_notify(), IB_PORT_STATE_DOWN, list_del, ib_device::op, ib_device::open_count, ib_device::open_list, ib_device::port_state, and ib_device::smi.

Referenced by eoib_close(), eoib_open(), ib_cmrc_open(), ib_cmrc_shutdown(), ipoib_close(), ipoib_open(), and xsigo_ib_remove().

                                          {

        /* Decrement device open request counter */
        ibdev->open_count--;

        /* Close device if this was the last remaining requested opening */
        if ( ibdev->open_count == 0 ) {
                ib_notify ( ibdev );
                list_del ( &ibdev->open_list );
                ib_destroy_mi ( ibdev, ibdev->gsi );
                ib_destroy_sma ( ibdev, ibdev->smi );
                ib_destroy_mi ( ibdev, ibdev->smi );
                ibdev->op->close ( ibdev );
                ibdev->port_state = IB_PORT_STATE_DOWN;
        }
}
int ib_link_rc ( struct ib_device ibdev)

Get link state.

Parameters:
ibdevInfiniband device
Return values:
rcLink status code

Definition at line 594 of file infiniband.c.

References EINPROGRESS_ARMED, EINPROGRESS_INIT, EINVAL, ENOTCONN, IB_PORT_STATE_ACTIVE, IB_PORT_STATE_ARMED, IB_PORT_STATE_DOWN, IB_PORT_STATE_INIT, and ib_device::port_state.

Referenced by eoib_link_state_changed(), and ipoib_link_state_changed().

                                           {
        switch ( ibdev->port_state ) {
        case IB_PORT_STATE_DOWN:        return -ENOTCONN;
        case IB_PORT_STATE_INIT:        return -EINPROGRESS_INIT;
        case IB_PORT_STATE_ARMED:       return -EINPROGRESS_ARMED;
        case IB_PORT_STATE_ACTIVE:      return 0;
        default:                        return -EINVAL;
        }
}
int ib_mcast_attach ( struct ib_device ibdev,
struct ib_queue_pair qp,
union ib_gid gid 
)

Attach to multicast group.

Parameters:
ibdevInfiniband device
qpQueue pair
gidMulticast GID
Return values:
rcReturn status code

Note that this function handles only the local device's attachment to the multicast GID; it does not issue the relevant MADs to join the multicast group on the subnet.

Definition at line 752 of file infiniband.c.

References assert, ENOMEM, free, ib_multicast_gid::gid, ib_multicast_gid::list, list_add_tail, list_del, ib_device_operations::mcast_attach, memcpy(), mgid, ib_queue_pair::mgids, NULL, ib_device::op, rc, and zalloc().

Referenced by ib_mcast_join().

                                          {
        struct ib_multicast_gid *mgid;
        int rc;

        /* Sanity check */
        assert ( qp != NULL );

        /* Add to software multicast GID list */
        mgid = zalloc ( sizeof ( *mgid ) );
        if ( ! mgid ) {
                rc = -ENOMEM;
                goto err_alloc_mgid;
        }
        memcpy ( &mgid->gid, gid, sizeof ( mgid->gid ) );
        list_add_tail ( &mgid->list, &qp->mgids );

        /* Add to hardware multicast GID list */
        if ( ( rc = ibdev->op->mcast_attach ( ibdev, qp, gid ) ) != 0 )
                goto err_dev_mcast_attach;

        return 0;

 err_dev_mcast_attach:
        list_del ( &mgid->list );
        free ( mgid );
 err_alloc_mgid:
        return rc;
}
void ib_mcast_detach ( struct ib_device ibdev,
struct ib_queue_pair qp,
union ib_gid gid 
)

Detach from multicast group.

Parameters:
ibdevInfiniband device
qpQueue pair
gidMulticast GID

Definition at line 789 of file infiniband.c.

References assert, free, ib_multicast_gid::gid, ib_multicast_gid::list, list_del, list_for_each_entry, ib_device_operations::mcast_detach, memcmp(), mgid, ib_queue_pair::mgids, NULL, and ib_device::op.

Referenced by ib_mcast_join(), and ib_mcast_leave().

                                           {
        struct ib_multicast_gid *mgid;

        /* Sanity check */
        assert ( qp != NULL );

        /* Remove from hardware multicast GID list */
        ibdev->op->mcast_detach ( ibdev, qp, gid );

        /* Remove from software multicast GID list */
        list_for_each_entry ( mgid, &qp->mgids, list ) {
                if ( memcmp ( &mgid->gid, gid, sizeof ( mgid->gid ) ) == 0 ) {
                        list_del ( &mgid->list );
                        free ( mgid );
                        break;
                }
        }
}
int ib_count_ports ( struct ib_device ibdev)

Count Infiniband HCA ports.

Parameters:
ibdevInfiniband device
Return values:
num_portsNumber of ports

Definition at line 822 of file infiniband.c.

References ib_device::dev, for_each_ibdev, and num_ports.

Referenced by ib_sma_node_info().

                                               {
        struct ib_device *tmp;
        int num_ports = 0;

        /* Search for IB devices with the same physical device to
         * identify port count.
         */
        for_each_ibdev ( tmp ) {
                if ( tmp->dev == ibdev->dev )
                        num_ports++;
        }
        return num_ports;
}
int ib_set_port_info ( struct ib_device ibdev,
union ib_mad mad 
)

Set port information.

Parameters:
ibdevInfiniband device
madSet port information MAD

Definition at line 842 of file infiniband.c.

References DBGC, ENOTSUP, ib_device::name, ib_device::op, rc, ib_device_operations::set_port_info, and strerror().

Referenced by ib_sma_set_port_info().

                                                                    {
        int rc;

        /* Adapters with embedded SMAs do not need to support this method */
        if ( ! ibdev->op->set_port_info ) {
                DBGC ( ibdev, "IBDEV %s does not support setting port "
                       "information\n", ibdev->name );
                return -ENOTSUP;
        }

        if ( ( rc = ibdev->op->set_port_info ( ibdev, mad ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s could not set port information: %s\n",
                       ibdev->name, strerror ( rc ) );
                return rc;
        }

        return 0;
};
int ib_set_pkey_table ( struct ib_device ibdev,
union ib_mad mad 
)

Set partition key table.

Parameters:
ibdevInfiniband device
madSet partition key table MAD

Definition at line 867 of file infiniband.c.

References DBGC, ENOTSUP, ib_device::name, ib_device::op, rc, ib_device_operations::set_pkey_table, and strerror().

Referenced by ib_sma_set_pkey_table().

                                                                     {
        int rc;

        /* Adapters with embedded SMAs do not need to support this method */
        if ( ! ibdev->op->set_pkey_table ) {
                DBGC ( ibdev, "IBDEV %s does not support setting partition "
                       "key table\n", ibdev->name );
                return -ENOTSUP;
        }

        if ( ( rc = ibdev->op->set_pkey_table ( ibdev, mad ) ) != 0 ) {
                DBGC ( ibdev, "IBDEV %s could not set partition key table: "
                       "%s\n", ibdev->name, strerror ( rc ) );
                return rc;
        }

        return 0;
};
struct ib_device* alloc_ibdev ( size_t  priv_size) [read]

Allocate Infiniband device.

Parameters:
priv_sizeSize of driver private data area
Return values:
ibdevInfiniband device, or NULL

Definition at line 937 of file infiniband.c.

References ib_device::cqs, ib_device::drv_priv, IB_LID_NONE, IB_PKEY_DEFAULT, IB_PORT_STATE_DOWN, ib_set_drvdata(), INIT_LIST_HEAD, ib_device::lid, ib_device::list, ib_device::open_list, ib_device::pkey, ib_device::port_state, ib_device::qps, and zalloc().

Referenced by arbel_probe(), flexboot_nodnic_allocate_infiniband_devices(), golan_probe_normal(), hermon_probe(), linda_probe(), and qib7322_probe().

                                                    {
        struct ib_device *ibdev;
        void *drv_priv;
        size_t total_len;

        total_len = ( sizeof ( *ibdev ) + priv_size );
        ibdev = zalloc ( total_len );
        if ( ibdev ) {
                drv_priv = ( ( ( void * ) ibdev ) + sizeof ( *ibdev ) );
                ib_set_drvdata ( ibdev, drv_priv );
                INIT_LIST_HEAD ( &ibdev->list );
                INIT_LIST_HEAD ( &ibdev->open_list );
                INIT_LIST_HEAD ( &ibdev->cqs );
                INIT_LIST_HEAD ( &ibdev->qps );
                ibdev->port_state = IB_PORT_STATE_DOWN;
                ibdev->lid = IB_LID_NONE;
                ibdev->pkey = IB_PKEY_DEFAULT;
        }
        return ibdev;
}
int register_ibdev ( struct ib_device ibdev)

Register Infiniband device.

Parameters:
ibdevInfiniband device
Return values:
rcReturn status code

Definition at line 964 of file infiniband.c.

References DBGC, ib_device::dev, driver, for_each_table_entry, for_each_table_entry_continue_reverse, IB_DRIVERS, ibdev_get(), ibdev_index, ibdev_put(), ib_device::index, ib_device::list, list_add_tail, list_del, device::name, ib_device::name, ib_driver::name, ib_driver::probe, rc, ib_driver::remove, snprintf(), and strerror().

Referenced by arbel_probe(), golan_register_ibdev(), hermon_register_ibdev(), linda_probe(), and qib7322_probe().

                                               {
        struct ib_driver *driver;
        int rc;

        /* Record device index and create device name */
        if ( ibdev->name[0] == '\0' ) {
                snprintf ( ibdev->name, sizeof ( ibdev->name ), "inf%d",
                           ibdev_index );
        }
        ibdev->index = ++ibdev_index;

        /* Add to device list */
        ibdev_get ( ibdev );
        list_add_tail ( &ibdev->list, &ib_devices );
        DBGC ( ibdev, "IBDEV %s registered (phys %s)\n", ibdev->name,
               ibdev->dev->name );

        /* Probe device */
        for_each_table_entry ( driver, IB_DRIVERS ) {
                if ( ( rc = driver->probe ( ibdev ) ) != 0 ) {
                        DBGC ( ibdev, "IBDEV %s could not add %s device: %s\n",
                               ibdev->name, driver->name, strerror ( rc ) );
                        goto err_probe;
                }
        }

        return 0;

 err_probe:
        for_each_table_entry_continue_reverse ( driver, IB_DRIVERS )
                driver->remove ( ibdev );
        list_del ( &ibdev->list );
        ibdev_put ( ibdev );
        return rc;
}
void unregister_ibdev ( struct ib_device ibdev)

Unregister Infiniband device.

Parameters:
ibdevInfiniband device

Definition at line 1005 of file infiniband.c.

References DBGC, driver, for_each_table_entry_reverse, IB_DRIVERS, ibdev_index, ibdev_put(), ib_device::list, list_del, list_empty, ib_device::name, and ib_driver::remove.

Referenced by arbel_probe(), arbel_remove(), golan_probe_normal(), golan_remove_normal(), hermon_unregister_ibdev(), linda_probe(), linda_remove(), qib7322_probe(), and qib7322_remove().

                                                  {
        struct ib_driver *driver;

        /* Remove device */
        for_each_table_entry_reverse ( driver, IB_DRIVERS )
                driver->remove ( ibdev );

        /* Remove from device list */
        list_del ( &ibdev->list );
        ibdev_put ( ibdev );
        DBGC ( ibdev, "IBDEV %s unregistered\n", ibdev->name );

        /* Reset device index if no devices remain */
        if ( list_empty ( &ib_devices ) )
                ibdev_index = 0;
}
struct ib_device* find_ibdev ( union ib_gid gid) [read]

Find Infiniband device by GID.

Parameters:
gidGID
Return values:
ibdevInfiniband device, or NULL

Definition at line 1028 of file infiniband.c.

References for_each_ibdev, ib_device::gid, memcmp(), and NULL.

Referenced by ib_srp_open_uri().

                                                    {
        struct ib_device *ibdev;

        for_each_ibdev ( ibdev ) {
                if ( memcmp ( gid, &ibdev->gid, sizeof ( *gid ) ) == 0 )
                        return ibdev;
        }
        return NULL;
}
struct ib_device* last_opened_ibdev ( void  ) [read]

Get most recently opened Infiniband device.

Return values:
ibdevMost recently opened Infiniband device, or NULL

Definition at line 1043 of file infiniband.c.

References assert, list_first_entry, NULL, ib_device::open_count, and ib_device::open_list.

Referenced by ib_srp_parse_sgid().

                                              {
        struct ib_device *ibdev;

        ibdev = list_first_entry ( &open_ib_devices, struct ib_device,
                                   open_list );
        if ( ! ibdev )
                return NULL;

        assert ( ibdev->open_count != 0 );
        return ibdev;
}
void ib_link_state_changed ( struct ib_device ibdev)

Notify of Infiniband link state change.

Parameters:
ibdevInfiniband device

Definition at line 637 of file infiniband.c.

References DBGC, ib_link_state_text(), ib_notify(), and ib_device::name.

Referenced by golan_ib_update(), ib_smc_update(), linda_link_state_changed(), and qib7322_link_state_changed().

                                                       {

        DBGC ( ibdev, "IBDEV %s link state is %s\n",
               ibdev->name, ib_link_state_text ( ibdev ) );

        /* Notify drivers of link state change */
        ib_notify ( ibdev );
}
void ib_poll_eq ( struct ib_device ibdev)

Poll event queue.

Parameters:
ibdevInfiniband device

Definition at line 898 of file infiniband.c.

References ib_device::cqs, ib_poll_cq(), ib_completion_queue::list, list_for_each_entry, ib_device::op, and ib_device_operations::poll_eq.

Referenced by eoib_poll(), flexboot_nodnic_eth_poll(), hermon_eth_poll(), ib_step(), and ipoib_poll().

                                            {
        struct ib_completion_queue *cq;

        /* Poll device's event queue */
        ibdev->op->poll_eq ( ibdev );

        /* Poll all completion queues */
        list_for_each_entry ( cq, &ibdev->cqs, list )
                ib_poll_cq ( ibdev, cq );
}
static __always_inline int ib_link_ok ( struct ib_device ibdev) [inline, static]

Check link state of Infiniband device.

Parameters:
ibdevInfiniband device
Return values:
link_upLink is up

Definition at line 564 of file infiniband.h.

References IB_PORT_STATE_ACTIVE, and ib_device::port_state.

Referenced by eoib_link_state_changed(), ibstat(), ipoib_link_state_changed(), ipoib_transmit(), xsigo_ib_notify(), and xsigo_ib_open().

                                       {
        return ( ibdev->port_state == IB_PORT_STATE_ACTIVE );
}
static int ib_is_open ( struct ib_device ibdev) [inline, static]

Check whether or not Infiniband device is open.

Parameters:
ibdevInfiniband device
is_openInfiniband device is open

Definition at line 575 of file infiniband.h.

Referenced by arbel_poll_eq(), eoib_link_state_changed(), golan_handle_port_event(), hermon_poll_eq(), ibstat(), and ipoib_link_state_changed().

                                       {
        return ( ibdev->open_count > 0 );
}
static __always_inline struct ib_device* ibdev_get ( struct ib_device ibdev) [static, read]

Get reference to Infiniband device.

Parameters:
ibdevInfiniband device
Return values:
ibdevInfiniband device

Definition at line 586 of file infiniband.h.

References ref_get, and ib_device::refcnt.

Referenced by eoib_create(), ib_srp_open(), register_ibdev(), and xsigo_ib_probe().

                                      {
        ref_get ( &ibdev->refcnt );
        return ibdev;
}
static __always_inline void ibdev_put ( struct ib_device ibdev) [inline, static]
static __always_inline void ib_wq_set_drvdata ( struct ib_work_queue wq,
void *  priv 
) [inline, static]

Set Infiniband work queue driver-private data.

Parameters:
wqWork queue
privPrivate data

Definition at line 608 of file infiniband.h.

References ib_work_queue::drv_priv, and priv.

Referenced by linda_create_qp(), and qib7322_create_qp().

                                                           {
        wq->drv_priv = priv;
}
static __always_inline void* ib_wq_get_drvdata ( struct ib_work_queue wq) [inline, static]
static __always_inline void ib_qp_set_drvdata ( struct ib_queue_pair qp,
void *  priv 
) [inline, static]

Set Infiniband queue pair driver-private data.

Parameters:
qpQueue pair
privPrivate data

Definition at line 630 of file infiniband.h.

References ib_queue_pair::drv_priv, and priv.

Referenced by arbel_create_qp(), arbel_destroy_qp(), flexboot_nodnic_create_qp(), golan_create_qp_aux(), golan_destroy_qp(), hermon_create_qp(), and hermon_destroy_qp().

                                                           {
        qp->drv_priv = priv;
}
static __always_inline void* ib_qp_get_drvdata ( struct ib_queue_pair qp) [inline, static]
static __always_inline void ib_qp_set_ownerdata ( struct ib_queue_pair qp,
void *  priv 
) [inline, static]

Set Infiniband queue pair owner-private data.

Parameters:
qpQueue pair
privPrivate data

Definition at line 652 of file infiniband.h.

References ib_queue_pair::owner_priv, and priv.

Referenced by eoib_open(), flexboot_nodnic_eth_open(), hermon_eth_open(), ib_cmrc_open(), ib_create_mi(), and ipoib_open().

                                                             {
        qp->owner_priv = priv;
}
static __always_inline void* ib_qp_get_ownerdata ( struct ib_queue_pair qp) [inline, static]
static __always_inline void ib_cq_set_drvdata ( struct ib_completion_queue cq,
void *  priv 
) [inline, static]

Set Infiniband completion queue driver-private data.

Parameters:
cqCompletion queue
privPrivate data

Definition at line 674 of file infiniband.h.

References ib_completion_queue::drv_priv, and priv.

Referenced by arbel_create_cq(), arbel_destroy_cq(), flexboot_nodnic_create_cq(), golan_create_cq(), golan_destroy_cq(), hermon_create_cq(), and hermon_destroy_cq().

                                                                 {
        cq->drv_priv = priv;
}
static __always_inline void* ib_cq_get_drvdata ( struct ib_completion_queue cq) [inline, static]

Get Infiniband completion queue driver-private data.

Parameters:
cqCompletion queue
Return values:
privPrivate data

Definition at line 685 of file infiniband.h.

References ib_completion_queue::drv_priv.

Referenced by arbel_destroy_cq(), arbel_poll_cq(), flexboot_nodnic_destroy_cq(), flexboot_nodnic_poll_cq(), golan_destroy_cq(), golan_poll_cq(), hermon_destroy_cq(), hermon_poll_cq(), and ib_create_cq().

                                                     {
        return cq->drv_priv;
}
static __always_inline void ib_set_drvdata ( struct ib_device ibdev,
void *  priv 
) [inline, static]

Set Infiniband device driver-private data.

Parameters:
ibdevInfiniband device
privPrivate data

Definition at line 696 of file infiniband.h.

References ib_device::drv_priv, and priv.

Referenced by alloc_ibdev(), arbel_probe(), flexboot_nodnic_allocate_infiniband_devices(), golan_probe_normal(), hermon_probe(), and qib7322_probe().

                                                       {
        ibdev->drv_priv = priv;
}
static __always_inline void* ib_get_drvdata ( struct ib_device ibdev) [inline, static]

Get Infiniband device driver-private data.

Parameters:
ibdevInfiniband device
Return values:
privPrivate data

Definition at line 707 of file infiniband.h.

References ib_device::drv_priv.

Referenced by arbel_alloc_qpn(), arbel_complete(), arbel_create_cq(), arbel_create_qp(), arbel_destroy_cq(), arbel_destroy_qp(), arbel_fill_mlx_send_wqe(), arbel_fill_rc_send_wqe(), arbel_fill_ud_send_wqe(), arbel_free_qpn(), arbel_ib_close(), arbel_ib_open(), arbel_mad(), arbel_mcast_attach(), arbel_mcast_detach(), arbel_modify_qp(), arbel_poll_cq(), arbel_poll_eq(), arbel_post_recv(), arbel_post_send(), flexboot_nodnic_complete(), flexboot_nodnic_create_cq(), flexboot_nodnic_create_qp(), flexboot_nodnic_destroy_cq(), flexboot_nodnic_destroy_qp(), flexboot_nodnic_eth_close(), flexboot_nodnic_eth_open(), flexboot_nodnic_eth_transmit(), flexboot_nodnic_find_wq(), flexboot_nodnic_mcast_attach(), flexboot_nodnic_mcast_detach(), flexboot_nodnic_poll_cq(), flexboot_nodnic_poll_eq(), flexboot_nodnic_post_recv(), flexboot_nodnic_post_send(), golan_complete(), golan_create_cq(), golan_create_qp_aux(), golan_destroy_cq(), golan_destroy_qp(), golan_ib_close(), golan_ib_open(), golan_mcast_attach(), golan_mcast_detach(), golan_modify_qp(), golan_modify_qp_to_rst(), golan_poll_cq(), golan_poll_eq(), golan_post_recv(), golan_post_send(), golan_query_vport_context(), golan_query_vport_gid(), golan_query_vport_pkey(), hermon_alloc_qpn(), hermon_complete(), hermon_create_cq(), hermon_create_qp(), hermon_destroy_cq(), hermon_destroy_qp(), hermon_eth_close(), hermon_eth_open(), hermon_eth_transmit(), hermon_fill_eth_send_wqe(), hermon_fill_mlx_send_wqe(), hermon_fill_rc_send_wqe(), hermon_fill_ud_send_wqe(), hermon_free_qpn(), hermon_ib_close(), hermon_ib_open(), hermon_mad(), hermon_mcast_attach(), hermon_mcast_detach(), hermon_modify_qp(), hermon_poll_cq(), hermon_poll_eq(), hermon_post_recv(), hermon_post_send(), linda_close(), linda_complete_recv(), linda_complete_send(), linda_create_cq(), linda_create_qp(), linda_destroy_cq(), linda_destroy_qp(), linda_link_state_changed(), linda_mcast_attach(), linda_mcast_detach(), linda_modify_qp(), linda_open(), linda_poll_eq(), linda_poll_recv_wq(), linda_poll_send_wq(), linda_post_recv(), linda_post_send(), linda_probe(), linda_remove(), linda_set_port_info(), qib7322_alloc_ctx(), qib7322_close(), qib7322_complete_recv(), qib7322_complete_send(), qib7322_create_cq(), qib7322_create_qp(), qib7322_create_recv_wq(), qib7322_create_send_wq(), qib7322_destroy_cq(), qib7322_destroy_recv_wq(), qib7322_free_ctx(), qib7322_link_state_changed(), qib7322_link_state_check(), qib7322_mcast_attach(), qib7322_mcast_detach(), qib7322_modify_qp(), qib7322_open(), qib7322_poll_eq(), qib7322_poll_recv_wq(), qib7322_poll_send_wq(), qib7322_post_recv(), qib7322_post_send(), qib7322_set_port_info(), shomron_fill_eth_send_wqe(), and shomron_tx_uar_send_db().

                                           {
        return ibdev->drv_priv;
}

Variable Documentation

List of Infiniband devices.

Definition at line 52 of file infiniband.c.