iPXE
Data Structures | Defines | Functions | Variables
qib7322.c File Reference

QLogic QIB7322 Infiniband HCA. More...

#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>
#include <ipxe/io.h>
#include <ipxe/pci.h>
#include <ipxe/infiniband.h>
#include <ipxe/i2c.h>
#include <ipxe/bitbash.h>
#include <ipxe/malloc.h>
#include <ipxe/iobuf.h>
#include <ipxe/pcibackup.h>
#include "qib7322.h"

Go to the source code of this file.

Data Structures

struct  qib7322_send_buffers
 A QIB7322 send buffer set. More...
struct  qib7322_send_work_queue
 A QIB7322 send work queue. More...
struct  qib7322_recv_work_queue
 A QIB7322 receive work queue. More...
struct  qib7322
 A QIB7322 HCA. More...

Defines

#define qib7322_readq(_qib7322, _ptr, _offset)   qib7322_readq ( (_qib7322), (_ptr)->u.qwords, (_offset) )
#define qib7322_readq_array8b(_qib7322, _ptr, _offset, _idx)   qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )
#define qib7322_readq_array64k(_qib7322, _ptr, _offset, _idx)   qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 65536 ) ) )
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)   qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_port) * 4096 ) ) )
#define qib7322_writeq(_qib7322, _ptr, _offset)   qib7322_writeq ( (_qib7322), (_ptr)->u.qwords, (_offset) )
#define qib7322_writeq_array8b(_qib7322, _ptr, _offset, _idx)   qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )
#define qib7322_writeq_array64k(_qib7322, _ptr, _offset, _idx)   qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 65536 ) ))
#define qib7322_writeq_port(_qib7322, _ptr, _offset, _port)   qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_port) * 4096 ) ))
#define QIB7322_SEND_BUF_TOGGLE   0x8000
 Send buffer toggle bit.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static void qib7322_readq (struct qib7322 *qib7322, uint64_t *qword, unsigned long offset)
 Read QIB7322 qword register.
static void qib7322_writeq (struct qib7322 *qib7322, const uint64_t *qword, unsigned long offset)
 Write QIB7322 qword register.
static void qib7322_writel (struct qib7322 *qib7322, uint32_t dword, unsigned long offset)
 Write QIB7322 dword register.
static const char * qib7322_link_state_text (unsigned int link_state)
 Textual representation of link state.
static void qib7322_link_state_changed (struct ib_device *ibdev)
 Handle link state change.
static int qib7322_link_state_check (struct ib_device *ibdev, unsigned int new_link_state)
 Wait for link state change to take effect.
static int qib7322_set_port_info (struct ib_device *ibdev, union ib_mad *mad)
 Set port information.
static int qib7322_set_pkey_table (struct ib_device *ibdev __unused, union ib_mad *mad __unused)
 Set partition key table.
static int qib7322_alloc_ctx (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Allocate a context and set queue pair number.
static unsigned int qib7322_ctx (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Get queue pair context number.
static void qib7322_free_ctx (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Free a context.
static struct
qib7322_send_buffers
qib7322_create_send_bufs (struct qib7322 *qib7322, unsigned long base, unsigned int size, unsigned int start, unsigned int count)
 Create send buffer set.
static void qib7322_destroy_send_bufs (struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs)
 Destroy send buffer set.
static int qib7322_alloc_send_buf (struct qib7322 *qib7322, struct qib7322_send_buffers *send_bufs)
 Allocate a send buffer.
static void qib7322_free_send_buf (struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs, unsigned int send_buf)
 Free a send buffer.
static int qib7322_send_buf_in_use (struct qib7322 *qib7322, unsigned int send_buf)
 Check to see if send buffer is in use.
static unsigned long qib7322_send_buffer_offset (struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs, unsigned int send_buf)
 Calculate starting offset for send buffer.
static int qib7322_create_send_wq (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Create send work queue.
static void qib7322_destroy_send_wq (struct ib_device *ibdev __unused, struct ib_queue_pair *qp)
 Destroy send work queue.
static int qib7322_init_send (struct qib7322 *qib7322)
 Initialise send datapath.
static void qib7322_fini_send (struct qib7322 *qib7322)
 Shut down send datapath.
static int qib7322_create_recv_wq (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Create receive work queue.
static void qib7322_destroy_recv_wq (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Destroy receive work queue.
static int qib7322_init_recv (struct qib7322 *qib7322)
 Initialise receive datapath.
static void qib7322_fini_recv (struct qib7322 *qib7322 __unused)
 Shut down receive datapath.
static int qib7322_create_cq (struct ib_device *ibdev, struct ib_completion_queue *cq)
 Create completion queue.
static void qib7322_destroy_cq (struct ib_device *ibdev, struct ib_completion_queue *cq)
 Destroy completion queue.
static int qib7322_create_qp (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Create queue pair.
static int qib7322_modify_qp (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Modify queue pair.
static void qib7322_destroy_qp (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Destroy queue pair.
static int qib7322_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.
static void qib7322_complete_send (struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int wqe_idx)
 Complete send work queue entry.
static void qib7322_poll_send_wq (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Poll send work queue.
static int qib7322_post_recv (struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf)
 Post receive work queue entry.
static void qib7322_complete_recv (struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int header_offs)
 Complete receive work queue entry.
static void qib7322_poll_recv_wq (struct ib_device *ibdev, struct ib_queue_pair *qp)
 Poll receive work queue.
static void qib7322_poll_cq (struct ib_device *ibdev, struct ib_completion_queue *cq)
 Poll completion queue.
static void qib7322_poll_eq (struct ib_device *ibdev)
 Poll event queue.
static unsigned int qib7322_link_speed_supported (struct qib7322 *qib7322, unsigned int port)
 Determine supported link speeds.
static int qib7322_open (struct ib_device *ibdev)
 Initialise Infiniband link.
static void qib7322_close (struct ib_device *ibdev)
 Close Infiniband link.
static int qib7322_mcast_attach (struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
 Attach to multicast group.
static void qib7322_mcast_detach (struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
 Detach from multicast group.
static int qib7322_i2c_read_bit (struct bit_basher *basher, unsigned int bit_id)
 Read QIB7322 I2C line status.
static void qib7322_i2c_write_bit (struct bit_basher *basher, unsigned int bit_id, unsigned long data)
 Write QIB7322 I2C line status.
static int qib7322_init_i2c (struct qib7322 *qib7322)
 Initialise QIB7322 I2C subsystem.
static int qib7322_read_eeprom (struct qib7322 *qib7322)
 Read EEPROM parameters.
static int qib7322_ahb_wait (struct qib7322 *qib7322)
 Wait for AHB transaction to complete.
static int qib7322_ahb_request (struct qib7322 *qib7322, unsigned int location)
 Request ownership of the AHB.
static void qib7322_ahb_release (struct qib7322 *qib7322)
 Release ownership of the AHB.
static int qib7322_ahb_read (struct qib7322 *qib7322, unsigned int location, uint32_t *data)
 Read data via AHB.
static int qib7322_ahb_write (struct qib7322 *qib7322, unsigned int location, uint32_t data)
 Write data via AHB.
static int qib7322_ahb_mod_reg (struct qib7322 *qib7322, unsigned int location, uint32_t value, uint32_t mask)
 Read/modify/write AHB register.
static int qib7322_ahb_mod_reg_all (struct qib7322 *qib7322, unsigned int reg, uint32_t value, uint32_t mask)
 Read/modify/write AHB register across all ports and channels.
static int qib7322_init_ib_serdes (struct qib7322 *qib7322)
 Initialise the IB SerDes.
static void qib7322_reset (struct qib7322 *qib7322, struct pci_device *pci)
 Reset QIB7322.
static int qib7322_probe (struct pci_device *pci)
 Probe PCI device.
static void qib7322_remove (struct pci_device *pci)
 Remove PCI device.

Variables

static struct ib_device_operations qib7322_ib_operations
 QIB7322 Infiniband operations.
static unsigned int qib7322_i2c_bits []
 QIB7322 I2C bit to GPIO mappings.
static struct bit_basher_operations qib7322_i2c_basher_ops
 QIB7322 I2C bit-bashing interface operations.
static struct pci_device_id qib7322_nics []
struct pci_driver qib7322_driver __pci_driver

Detailed Description

QLogic QIB7322 Infiniband HCA.

Definition in file qib7322.c.


Define Documentation

#define qib7322_readq (   _qib7322,
  _ptr,
  _offset 
)    qib7322_readq ( (_qib7322), (_ptr)->u.qwords, (_offset) )
#define qib7322_readq_array8b (   _qib7322,
  _ptr,
  _offset,
  _idx 
)    qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )

Definition at line 155 of file qib7322.c.

#define qib7322_readq_array64k (   _qib7322,
  _ptr,
  _offset,
  _idx 
)    qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 65536 ) ) )

Definition at line 157 of file qib7322.c.

#define qib7322_readq_port (   _qib7322,
  _ptr,
  _offset,
  _port 
)    qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_port) * 4096 ) ) )
#define qib7322_writeq (   _qib7322,
  _ptr,
  _offset 
)    qib7322_writeq ( (_qib7322), (_ptr)->u.qwords, (_offset) )
#define qib7322_writeq_array8b (   _qib7322,
  _ptr,
  _offset,
  _idx 
)    qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )
#define qib7322_writeq_array64k (   _qib7322,
  _ptr,
  _offset,
  _idx 
)    qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 65536 ) ))

Definition at line 177 of file qib7322.c.

Referenced by qib7322_create_recv_wq(), qib7322_poll_recv_wq(), and qib7322_post_recv().

#define qib7322_writeq_port (   _qib7322,
  _ptr,
  _offset,
  _port 
)    qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_port) * 4096 ) ))
#define QIB7322_SEND_BUF_TOGGLE   0x8000

Send buffer toggle bit.

We encode send buffers as 15 bits of send buffer index plus a single bit which should match the "check" bit in the SendBufAvail array.

Definition at line 432 of file qib7322.c.

Referenced by qib7322_alloc_send_buf(), qib7322_send_buf_in_use(), and qib7322_send_buffer_offset().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static void qib7322_readq ( struct qib7322 qib7322,
uint64_t qword,
unsigned long  offset 
) [static]

Read QIB7322 qword register.

Parameters:
qib7322QIB7322 device
qwordRegister buffer to read into
offsetRegister offset

Definition at line 149 of file qib7322.c.

References readq(), and qib7322::regs.

                                                   {
        *qword = readq ( qib7322->regs + offset );
}
static void qib7322_writeq ( struct qib7322 qib7322,
const uint64_t qword,
unsigned long  offset 
) [static]

Write QIB7322 qword register.

Parameters:
qib7322QIB7322 device
qwordRegister buffer to write
offsetRegister offset

Definition at line 169 of file qib7322.c.

References qib7322::regs, and writeq().

                                                    {
        writeq ( *qword, ( qib7322->regs + offset ) );
}
static void qib7322_writel ( struct qib7322 qib7322,
uint32_t  dword,
unsigned long  offset 
) [static]

Write QIB7322 dword register.

Parameters:
qib7322QIB7322 device
dwordValue to write
offsetRegister offset

Definition at line 189 of file qib7322.c.

References qib7322::regs, and writel().

Referenced by qib7322_post_send().

                                                    {
        writel ( dword, ( qib7322->regs + offset ) );
}
static const char* qib7322_link_state_text ( unsigned int  link_state) [static]

Textual representation of link state.

Parameters:
link_stateLink state
Return values:
link_textLink state text

Definition at line 207 of file qib7322.c.

References QIB7322_LINK_STATE_ACT_DEFER, QIB7322_LINK_STATE_ACTIVE, QIB7322_LINK_STATE_ARM, QIB7322_LINK_STATE_DOWN, and QIB7322_LINK_STATE_INIT.

Referenced by qib7322_link_state_changed(), qib7322_link_state_check(), and qib7322_set_port_info().

                                                                        {
        switch ( link_state ) {
        case QIB7322_LINK_STATE_DOWN:           return "DOWN";
        case QIB7322_LINK_STATE_INIT:           return "INIT";
        case QIB7322_LINK_STATE_ARM:            return "ARM";
        case QIB7322_LINK_STATE_ACTIVE:         return "ACTIVE";
        case QIB7322_LINK_STATE_ACT_DEFER:      return "ACT_DEFER";
        default:                                return "UNKNOWN";
        }
}
static void qib7322_link_state_changed ( struct ib_device ibdev) [static]

Handle link state change.

Parameters:
qib7322QIB7322 device

Definition at line 223 of file qib7322.c.

References BIT_GET, BIT_SET, DBGC, ib_get_drvdata(), IB_LINK_SPEED_DDR, IB_LINK_SPEED_SDR, ib_link_state_changed(), IB_LINK_WIDTH_1X, IB_LINK_WIDTH_4X, ib_device::link_speed_active, ib_device::link_width_active, ib_device::port, port, ib_device::port_state, QIB7322_LINK_STATE_ACTIVE, QIB7322_LINK_STATE_INIT, qib7322_link_state_text(), QIB7322_PORT_BASE, qib7322_readq, qib7322_readq_port, qib7322_writeq, QIB_7322_EXTCtrl_offset, and QIB_7322_IBCStatusA_0_offset.

Referenced by qib7322_poll_eq(), and qib7322_set_port_info().

                                                                   {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct QIB_7322_IBCStatusA_0 ibcstatusa;
        struct QIB_7322_EXTCtrl extctrl;
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
        unsigned int link_training_state;
        unsigned int link_state;
        unsigned int link_width;
        unsigned int link_speed;
        unsigned int link_speed_qdr;
        unsigned int green;
        unsigned int yellow;

        /* Read link state */
        qib7322_readq_port ( qib7322, &ibcstatusa,
                             QIB_7322_IBCStatusA_0_offset, port );
        link_training_state = BIT_GET ( &ibcstatusa, LinkTrainingState );
        link_state = BIT_GET ( &ibcstatusa, LinkState );
        link_width = BIT_GET ( &ibcstatusa, LinkWidthActive );
        link_speed = BIT_GET ( &ibcstatusa, LinkSpeedActive );
        link_speed_qdr = BIT_GET ( &ibcstatusa, LinkSpeedQDR );
        DBGC ( qib7322, "QIB7322 %p port %d training state %#x link state %s "
               "(%s %s)\n", qib7322, port, link_training_state,
               qib7322_link_state_text ( link_state ),
               ( link_speed_qdr ? "QDR" : ( link_speed ? "DDR" : "SDR" ) ),
               ( link_width ? "x4" : "x1" ) );

        /* Set LEDs according to link state */
        qib7322_readq ( qib7322, &extctrl, QIB_7322_EXTCtrl_offset );
        green = ( ( link_state >= QIB7322_LINK_STATE_INIT ) ? 1 : 0 );
        yellow = ( ( link_state >= QIB7322_LINK_STATE_ACTIVE ) ? 1 : 0 );
        if ( port == 0 ) {
                BIT_SET ( &extctrl, LEDPort0GreenOn, green );
                BIT_SET ( &extctrl, LEDPort0YellowOn, yellow );
        } else {
                BIT_SET ( &extctrl, LEDPort1GreenOn, green );
                BIT_SET ( &extctrl, LEDPort1YellowOn, yellow );
        }
        qib7322_writeq ( qib7322, &extctrl, QIB_7322_EXTCtrl_offset );

        /* Notify Infiniband core of link state change */
        ibdev->port_state = ( link_state + 1 );
        ibdev->link_width_active =
                ( link_width ? IB_LINK_WIDTH_4X : IB_LINK_WIDTH_1X );
        ibdev->link_speed_active =
                ( link_speed ? IB_LINK_SPEED_DDR : IB_LINK_SPEED_SDR );
        ib_link_state_changed ( ibdev );
}
static int qib7322_link_state_check ( struct ib_device ibdev,
unsigned int  new_link_state 
) [static]

Wait for link state change to take effect.

Parameters:
ibdevInfiniband device
new_link_stateExpected link state
Return values:
rcReturn status code

Definition at line 279 of file qib7322.c.

References BIT_GET, DBGC, ETIMEDOUT, ib_get_drvdata(), ib_device::port, port, QIB7322_LINK_STATE_MAX_WAIT_US, qib7322_link_state_text(), QIB7322_PORT_BASE, qib7322_readq_port, QIB_7322_IBCStatusA_0_offset, and udelay().

Referenced by qib7322_set_port_info().

                                                                    {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct QIB_7322_IBCStatusA_0 ibcstatusa;
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
        unsigned int link_state;
        unsigned int i;

        for ( i = 0 ; i < QIB7322_LINK_STATE_MAX_WAIT_US ; i++ ) {
                qib7322_readq_port ( qib7322, &ibcstatusa,
                                     QIB_7322_IBCStatusA_0_offset, port );
                link_state = BIT_GET ( &ibcstatusa, LinkState );
                if ( link_state == new_link_state )
                        return 0;
                udelay ( 1 );
        }

        DBGC ( qib7322, "QIB7322 %p port %d timed out waiting for link state "
               "%s\n", qib7322, port, qib7322_link_state_text ( link_state ) );
        return -ETIMEDOUT;
}
static int qib7322_set_port_info ( struct ib_device ibdev,
union ib_mad mad 
) [static]

Set port information.

Parameters:
ibdevInfiniband device
madSet port information MAD

Definition at line 307 of file qib7322.c.

References BIT_SET, DBGC, ib_get_drvdata(), ib_port_info::link_speed_supported__port_state, ib_device::port, port, ib_smp_data::port_info, port_info, port_state, qib7322_link_state_changed(), qib7322_link_state_check(), qib7322_link_state_text(), QIB7322_PORT_BASE, qib7322_readq_port, qib7322_writeq_port, QIB_7322_IBCCtrlA_0_offset, ib_mad::smp, and ib_mad_smp::smp_data.

                                                       {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_port_info *port_info = &mad->smp.smp_data.port_info;
        struct QIB_7322_IBCCtrlA_0 ibcctrla;
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
        unsigned int port_state;
        unsigned int link_state;

        /* Set new link state */
        port_state = ( port_info->link_speed_supported__port_state & 0xf );
        if ( port_state ) {
                link_state = ( port_state - 1 );
                DBGC ( qib7322, "QIB7322 %p set link state to %s (%x)\n",
                       qib7322, qib7322_link_state_text ( link_state ),
                       link_state );
                qib7322_readq_port ( qib7322, &ibcctrla,
                                     QIB_7322_IBCCtrlA_0_offset, port );
                BIT_SET ( &ibcctrla, LinkCmd, link_state );
                qib7322_writeq_port ( qib7322, &ibcctrla,
                                      QIB_7322_IBCCtrlA_0_offset, port );

                /* Wait for link state change to take effect.  Ignore
                 * errors; the current link state will be returned via
                 * the GetResponse MAD.
                 */
                qib7322_link_state_check ( ibdev, link_state );
        }

        /* Detect and report link state change */
        qib7322_link_state_changed ( ibdev );

        return 0;
}
static int qib7322_set_pkey_table ( struct ib_device *ibdev  __unused,
union ib_mad *mad  __unused 
) [static]

Set partition key table.

Parameters:
ibdevInfiniband device
madSet partition key table MAD

Definition at line 348 of file qib7322.c.

                                                                 {
        /* Nothing to do */
        return 0;
}
static int qib7322_alloc_ctx ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Allocate a context and set queue pair number.

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

Definition at line 368 of file qib7322.c.

References ctx, DBGC, DBGC2, ENOENT, ib_get_drvdata(), ib_device::port, port, QIB7322_NUM_CONTEXTS, QIB7322_PORT_BASE, ib_queue_pair::qpn, and qib7322::used_ctx.

Referenced by qib7322_create_qp().

                                                          {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
        unsigned int ctx;

        for ( ctx = port ; ctx < QIB7322_NUM_CONTEXTS ; ctx += 2 ) {

                if ( ! qib7322->used_ctx[ctx] ) {
                        qib7322->used_ctx[ctx] = 1;
                        qp->qpn = ( ctx & ~0x01 );
                        DBGC2 ( qib7322, "QIB7322 %p port %d QPN %ld is CTX "
                                "%d\n", qib7322, port, qp->qpn, ctx );
                        return 0;
                }
        }

        DBGC ( qib7322, "QIB7322 %p port %d out of available contexts\n",
               qib7322, port );
        return -ENOENT;
}
static unsigned int qib7322_ctx ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Get queue pair context number.

Parameters:
ibdevInfiniband device
qpQueue pair
Return values:
ctxContext index

Definition at line 397 of file qib7322.c.

References ib_device::port, QIB7322_PORT_BASE, and ib_queue_pair::qpn.

Referenced by qib7322_create_qp(), qib7322_create_recv_wq(), qib7322_destroy_recv_wq(), qib7322_free_ctx(), qib7322_poll_recv_wq(), and qib7322_post_recv().

                                                             {
        return ( qp->qpn + ( ibdev->port - QIB7322_PORT_BASE ) );
}
static void qib7322_free_ctx ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Free a context.

Parameters:
qib7322QIB7322 device
ctxContext index

Definition at line 408 of file qib7322.c.

References ctx, DBGC2, ib_get_drvdata(), ib_device::port, port, qib7322_ctx(), QIB7322_PORT_BASE, and qib7322::used_ctx.

Referenced by qib7322_create_qp(), and qib7322_destroy_qp().

                                                          {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
        unsigned int ctx = qib7322_ctx ( ibdev, qp );

        qib7322->used_ctx[ctx] = 0;
        DBGC2 ( qib7322, "QIB7322 %p port %d CTX %d freed\n",
                qib7322, port, ctx );
}
static struct qib7322_send_buffers* qib7322_create_send_bufs ( struct qib7322 qib7322,
unsigned long  base,
unsigned int  size,
unsigned int  start,
unsigned int  count 
) [static, read]

Create send buffer set.

Parameters:
qib7322QIB7322 device
baseSend buffer base offset
sizeSend buffer size
startIndex of first send buffer
countNumber of send buffers
Return values:
send_bufsSend buffer set

Definition at line 445 of file qib7322.c.

References qib7322_send_buffers::avail, qib7322_send_buffers::base, base, qib7322_send_buffers::count, count, DBGC2, NULL, qib7322_send_buffers::size, size, qib7322_send_buffers::start, start, and zalloc().

Referenced by qib7322_init_send().

                                                {
        struct qib7322_send_buffers *send_bufs;
        unsigned int i;

        /* Allocate send buffer set */
        send_bufs = zalloc ( sizeof ( *send_bufs ) +
                             ( count * sizeof ( send_bufs->avail[0] ) ) );
        if ( ! send_bufs )
                return NULL;

        /* Populate send buffer set */
        send_bufs->base = base;
        send_bufs->size = size;
        send_bufs->start = start;
        send_bufs->count = count;
        for ( i = 0 ; i < count ; i++ )
                send_bufs->avail[i] = ( start + i );

        DBGC2 ( qib7322, "QIB7322 %p send buffer set %p [%d,%d] at %lx\n",
                qib7322, send_bufs, start, ( start + count - 1 ),
                send_bufs->base );

        return send_bufs;
}
static void qib7322_destroy_send_bufs ( struct qib7322 *qib7322  __unused,
struct qib7322_send_buffers send_bufs 
) [static]

Destroy send buffer set.

Parameters:
qib7322QIB7322 device
send_bufsSend buffer set

Definition at line 479 of file qib7322.c.

References free.

Referenced by qib7322_fini_send(), and qib7322_init_send().

                                                                     {
        free ( send_bufs );
}
static int qib7322_alloc_send_buf ( struct qib7322 qib7322,
struct qib7322_send_buffers send_bufs 
) [static]

Allocate a send buffer.

Parameters:
qib7322QIB7322 device
send_bufsSend buffer set
Return values:
send_bufSend buffer, or negative error

Definition at line 491 of file qib7322.c.

References qib7322_send_buffers::avail, qib7322_send_buffers::cons, qib7322_send_buffers::count, DBGC, ENOBUFS, qib7322_send_buffers::prod, and QIB7322_SEND_BUF_TOGGLE.

Referenced by qib7322_post_send().

                                                                             {
        unsigned int used;
        unsigned int mask;
        unsigned int send_buf;

        used = ( send_bufs->cons - send_bufs->prod );
        if ( used >= send_bufs->count ) {
                DBGC ( qib7322, "QIB7322 %p send buffer set %p out of "
                       "buffers\n", qib7322, send_bufs );
                return -ENOBUFS;
        }

        mask = ( send_bufs->count - 1 );
        send_buf = send_bufs->avail[ send_bufs->cons++ & mask ];
        send_buf ^= QIB7322_SEND_BUF_TOGGLE;
        return send_buf;
}
static void qib7322_free_send_buf ( struct qib7322 *qib7322  __unused,
struct qib7322_send_buffers send_bufs,
unsigned int  send_buf 
) [static]

Free a send buffer.

Parameters:
qib7322QIB7322 device
send_bufsSend buffer set
send_bufSend buffer

Definition at line 517 of file qib7322.c.

References qib7322_send_buffers::avail, qib7322_send_buffers::count, and qib7322_send_buffers::prod.

Referenced by qib7322_complete_send().

                                                            {
        unsigned int mask;

        mask = ( send_bufs->count - 1 );
        send_bufs->avail[ send_bufs->prod++ & mask ] = send_buf;
}
static int qib7322_send_buf_in_use ( struct qib7322 qib7322,
unsigned int  send_buf 
) [static]

Check to see if send buffer is in use.

Parameters:
qib7322QIB7322 device
send_bufSend buffer
Return values:
in_useSend buffer is in use

Definition at line 533 of file qib7322.c.

References BIT_GET, QIB7322_SEND_BUF_TOGGLE, and qib7322::sendbufavail.

Referenced by qib7322_poll_send_wq().

                                                             {
        unsigned int send_idx;
        unsigned int send_check;
        unsigned int inusecheck;
        unsigned int inuse;
        unsigned int check;

        send_idx = ( send_buf & ~QIB7322_SEND_BUF_TOGGLE );
        send_check = ( !! ( send_buf & QIB7322_SEND_BUF_TOGGLE ) );
        inusecheck = BIT_GET ( qib7322->sendbufavail, InUseCheck[send_idx] );
        inuse = ( !! ( inusecheck & 0x02 ) );
        check = ( !! ( inusecheck & 0x01 ) );
        return ( inuse || ( check != send_check ) );
}
static unsigned long qib7322_send_buffer_offset ( struct qib7322 *qib7322  __unused,
struct qib7322_send_buffers send_bufs,
unsigned int  send_buf 
) [static]

Calculate starting offset for send buffer.

Parameters:
qib7322QIB7322 device
send_bufSend buffer
Return values:
offsetStarting offset

Definition at line 557 of file qib7322.c.

References qib7322_send_buffers::base, index, QIB7322_SEND_BUF_TOGGLE, qib7322_send_buffers::size, and qib7322_send_buffers::start.

Referenced by qib7322_post_send().

                                                     {
        unsigned int index;

        index = ( ( send_buf & ~QIB7322_SEND_BUF_TOGGLE ) - send_bufs->start );
        return ( send_bufs->base + ( index * send_bufs->size ) );
}
static int qib7322_create_send_wq ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Create send work queue.

Parameters:
ibdevInfiniband device
qpQueue pair

Definition at line 572 of file qib7322.c.

References qib7322_send_work_queue::cons, ENOMEM, ib_get_drvdata(), IB_QPT_SMI, ib_wq_get_drvdata(), ib_work_queue::num_wqes, ib_device::port, port, qib7322_send_work_queue::prod, QIB7322_PORT_BASE, ib_queue_pair::send, qib7322_send_work_queue::send_bufs, qib7322::send_bufs_small, qib7322::send_bufs_vl15_port0, qib7322::send_bufs_vl15_port1, ib_queue_pair::type, qib7322_send_work_queue::used, and zalloc().

Referenced by qib7322_create_qp().

                                                               {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_work_queue *wq = &qp->send;
        struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );

        /* Select send buffer set */
        if ( qp->type == IB_QPT_SMI ) {
                if ( port == 0 ) {
                        qib7322_wq->send_bufs = qib7322->send_bufs_vl15_port0;
                } else {
                        qib7322_wq->send_bufs = qib7322->send_bufs_vl15_port1;
                }
        } else {
                qib7322_wq->send_bufs = qib7322->send_bufs_small;
        }

        /* Allocate space for send buffer usage list */
        qib7322_wq->used = zalloc ( qp->send.num_wqes *
                                    sizeof ( qib7322_wq->used[0] ) );
        if ( ! qib7322_wq->used )
                return -ENOMEM;

        /* Reset work queue */
        qib7322_wq->prod = 0;
        qib7322_wq->cons = 0;

        return 0;
}
static void qib7322_destroy_send_wq ( struct ib_device *ibdev  __unused,
struct ib_queue_pair qp 
) [static]

Destroy send work queue.

Parameters:
ibdevInfiniband device
qpQueue pair

Definition at line 609 of file qib7322.c.

References free, ib_wq_get_drvdata(), ib_queue_pair::send, and qib7322_send_work_queue::used.

Referenced by qib7322_create_qp(), and qib7322_destroy_qp().

                                                                 {
        struct ib_work_queue *wq = &qp->send;
        struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );

        free ( qib7322_wq->used );
}
static int qib7322_init_send ( struct qib7322 qib7322) [static]

Initialise send datapath.

Parameters:
qib7322QIB7322 device
Return values:
rcReturn status code

Definition at line 623 of file qib7322.c.

References BIT_FILL_1, BIT_GET, ENOMEM, free_dma(), malloc_dma(), memset(), qib7322_create_send_bufs(), qib7322_destroy_send_bufs(), QIB7322_LARGE_SEND_BUF_COUNT, QIB7322_LARGE_SEND_BUF_SIZE, qib7322_readq, QIB7322_SENDBUFAVAIL_ALIGN, QIB7322_SMALL_SEND_BUF_SIZE, QIB7322_SMALL_SEND_BUF_START, QIB7322_SMALL_SEND_BUF_USED, QIB7322_VL15_PORT0_SEND_BUF_COUNT, QIB7322_VL15_PORT0_SEND_BUF_SIZE, QIB7322_VL15_PORT0_SEND_BUF_START, QIB7322_VL15_PORT1_SEND_BUF_COUNT, QIB7322_VL15_PORT1_SEND_BUF_SIZE, QIB7322_VL15_PORT1_SEND_BUF_START, qib7322_writeq, QIB_7322_SendBufAvailAddr_offset, QIB_7322_SendBufBase_offset, QIB_7322_SendCtrl_0_offset, QIB_7322_SendCtrl_1_offset, QIB_7322_SendCtrl_offset, rc, qib7322::send_bufs_small, qib7322::send_bufs_vl15_port0, qib7322::send_bufs_vl15_port1, qib7322::sendbufavail, and virt_to_bus().

Referenced by qib7322_probe().

                                                         {
        struct QIB_7322_SendBufBase sendbufbase;
        struct QIB_7322_SendBufAvailAddr sendbufavailaddr;
        struct QIB_7322_SendCtrl sendctrl;
        struct QIB_7322_SendCtrl_0 sendctrlp;
        unsigned long baseaddr_smallpio;
        unsigned long baseaddr_largepio;
        unsigned long baseaddr_vl15_port0;
        unsigned long baseaddr_vl15_port1;
        int rc;

        /* Create send buffer sets */
        qib7322_readq ( qib7322, &sendbufbase, QIB_7322_SendBufBase_offset );
        baseaddr_smallpio = BIT_GET ( &sendbufbase, BaseAddr_SmallPIO );
        baseaddr_largepio = BIT_GET ( &sendbufbase, BaseAddr_LargePIO );
        baseaddr_vl15_port0 = ( baseaddr_largepio +
                                ( QIB7322_LARGE_SEND_BUF_SIZE *
                                  QIB7322_LARGE_SEND_BUF_COUNT ) );
        baseaddr_vl15_port1 = ( baseaddr_vl15_port0 +
                                QIB7322_VL15_PORT0_SEND_BUF_SIZE );
        qib7322->send_bufs_small =
                qib7322_create_send_bufs ( qib7322, baseaddr_smallpio,
                                           QIB7322_SMALL_SEND_BUF_SIZE,
                                           QIB7322_SMALL_SEND_BUF_START,
                                           QIB7322_SMALL_SEND_BUF_USED );
        if ( ! qib7322->send_bufs_small ) {
                rc = -ENOMEM;
                goto err_create_send_bufs_small;
        }
        qib7322->send_bufs_vl15_port0 =
                qib7322_create_send_bufs ( qib7322, baseaddr_vl15_port0,
                                           QIB7322_VL15_PORT0_SEND_BUF_SIZE,
                                           QIB7322_VL15_PORT0_SEND_BUF_START,
                                           QIB7322_VL15_PORT0_SEND_BUF_COUNT );
        if ( ! qib7322->send_bufs_vl15_port0 ) {
                rc = -ENOMEM;
                goto err_create_send_bufs_vl15_port0;
        }
        qib7322->send_bufs_vl15_port1 =
                qib7322_create_send_bufs ( qib7322, baseaddr_vl15_port1,
                                           QIB7322_VL15_PORT1_SEND_BUF_SIZE,
                                           QIB7322_VL15_PORT1_SEND_BUF_START,
                                           QIB7322_VL15_PORT1_SEND_BUF_COUNT );
        if ( ! qib7322->send_bufs_vl15_port1 ) {
                rc = -ENOMEM;
                goto err_create_send_bufs_vl15_port1;
        }

        /* Allocate space for the SendBufAvail array */
        qib7322->sendbufavail = malloc_dma ( sizeof ( *qib7322->sendbufavail ),
                                             QIB7322_SENDBUFAVAIL_ALIGN );
        if ( ! qib7322->sendbufavail ) {
                rc = -ENOMEM;
                goto err_alloc_sendbufavail;
        }
        memset ( qib7322->sendbufavail, 0, sizeof ( *qib7322->sendbufavail ) );

        /* Program SendBufAvailAddr into the hardware */
        memset ( &sendbufavailaddr, 0, sizeof ( sendbufavailaddr ) );
        BIT_FILL_1 ( &sendbufavailaddr, SendBufAvailAddr,
                     ( virt_to_bus ( qib7322->sendbufavail ) >> 6 ) );
        qib7322_writeq ( qib7322, &sendbufavailaddr,
                         QIB_7322_SendBufAvailAddr_offset );

        /* Enable sending */
        memset ( &sendctrlp, 0, sizeof ( sendctrlp ) );
        BIT_FILL_1 ( &sendctrlp, SendEnable, 1 );
        qib7322_writeq ( qib7322, &sendctrlp, QIB_7322_SendCtrl_0_offset );
        qib7322_writeq ( qib7322, &sendctrlp, QIB_7322_SendCtrl_1_offset );

        /* Enable DMA of SendBufAvail */
        memset ( &sendctrl, 0, sizeof ( sendctrl ) );
        BIT_FILL_1 ( &sendctrl, SendBufAvailUpd, 1 );
        qib7322_writeq ( qib7322, &sendctrl, QIB_7322_SendCtrl_offset );

        return 0;

        free_dma ( qib7322->sendbufavail, sizeof ( *qib7322->sendbufavail ) );
 err_alloc_sendbufavail:
        qib7322_destroy_send_bufs ( qib7322, qib7322->send_bufs_vl15_port1 );
 err_create_send_bufs_vl15_port1:
        qib7322_destroy_send_bufs ( qib7322, qib7322->send_bufs_vl15_port0 );
 err_create_send_bufs_vl15_port0:
        qib7322_destroy_send_bufs ( qib7322, qib7322->send_bufs_small );
 err_create_send_bufs_small:
        return rc;
}
static void qib7322_fini_send ( struct qib7322 qib7322) [static]

Shut down send datapath.

Parameters:
qib7322QIB7322 device

Definition at line 716 of file qib7322.c.

References free_dma(), mb(), memset(), qib7322_destroy_send_bufs(), qib7322_readq, qib7322_writeq, QIB_7322_SendCtrl_offset, qib7322::send_bufs_small, qib7322::send_bufs_vl15_port0, qib7322::send_bufs_vl15_port1, and qib7322::sendbufavail.

Referenced by qib7322_probe(), and qib7322_remove().

                                                          {
        struct QIB_7322_SendCtrl sendctrl;

        /* Disable sending and DMA of SendBufAvail */
        memset ( &sendctrl, 0, sizeof ( sendctrl ) );
        qib7322_writeq ( qib7322, &sendctrl, QIB_7322_SendCtrl_offset );
        mb();

        /* Ensure hardware has seen this disable */
        qib7322_readq ( qib7322, &sendctrl, QIB_7322_SendCtrl_offset );

        free_dma ( qib7322->sendbufavail, sizeof ( *qib7322->sendbufavail ) );
        qib7322_destroy_send_bufs ( qib7322, qib7322->send_bufs_vl15_port1 );
        qib7322_destroy_send_bufs ( qib7322, qib7322->send_bufs_vl15_port0 );
        qib7322_destroy_send_bufs ( qib7322, qib7322->send_bufs_small );
}
static int qib7322_create_recv_wq ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Create receive work queue.

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

Definition at line 747 of file qib7322.c.

References BIT_FILL_1, BIT_SET, ctx, DBGC, qib7322_recv_work_queue::eager_cons, qib7322_recv_work_queue::eager_prod, ENOMEM, free_dma(), qib7322_recv_work_queue::header, qib7322_recv_work_queue::header_cons, qib7322_recv_work_queue::header_prod, ib_get_drvdata(), ib_wq_get_drvdata(), malloc_dma(), memset(), ib_device::port, port, qib7322_ctx(), QIB7322_PORT_BASE, qib7322_readq, qib7322_readq_port, QIB7322_RECV_HEADERS_ALIGN, QIB7322_RECV_HEADERS_SIZE, qib7322_writeq, qib7322_writeq_array64k, qib7322_writeq_array8b, qib7322_writeq_port, QIB_7322_RcvCtrl_0_offset, QIB_7322_RcvCtrl_offset, QIB_7322_RcvEgrIndexHead0_offset, QIB_7322_RcvHdrAddr0_offset, QIB_7322_RcvHdrHead0_offset, QIB_7322_RcvHdrTailAddr0_offset, ib_queue_pair::qpn, rc, ib_queue_pair::recv, and virt_to_bus().

Referenced by qib7322_create_qp().

                                                               {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_work_queue *wq = &qp->recv;
        struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
        struct QIB_7322_RcvHdrAddr0 rcvhdraddr;
        struct QIB_7322_RcvHdrTailAddr0 rcvhdrtailaddr;
        struct QIB_7322_RcvHdrHead0 rcvhdrhead;
        struct QIB_7322_scalar rcvegrindexhead;
        struct QIB_7322_RcvCtrl rcvctrl;
        struct QIB_7322_RcvCtrl_P rcvctrlp;
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
        unsigned int ctx = qib7322_ctx ( ibdev, qp );
        int rc;

        /* Reset context information */
        memset ( &qib7322_wq->header_prod, 0,
                 sizeof ( qib7322_wq->header_prod ) );
        qib7322_wq->header_cons = 0;
        qib7322_wq->eager_prod = 0;
        qib7322_wq->eager_cons = 0;

        /* Allocate receive header buffer */
        qib7322_wq->header = malloc_dma ( QIB7322_RECV_HEADERS_SIZE,
                                          QIB7322_RECV_HEADERS_ALIGN );
        if ( ! qib7322_wq->header ) {
                rc = -ENOMEM;
                goto err_alloc_header;
        }

        /* Enable context in hardware */
        memset ( &rcvhdraddr, 0, sizeof ( rcvhdraddr ) );
        BIT_FILL_1 ( &rcvhdraddr, RcvHdrAddr,
                     ( virt_to_bus ( qib7322_wq->header ) >> 2 ) );
        qib7322_writeq_array8b ( qib7322, &rcvhdraddr,
                                 QIB_7322_RcvHdrAddr0_offset, ctx );
        memset ( &rcvhdrtailaddr, 0, sizeof ( rcvhdrtailaddr ) );
        BIT_FILL_1 ( &rcvhdrtailaddr, RcvHdrTailAddr,
                     ( virt_to_bus ( &qib7322_wq->header_prod ) >> 2 ) );
        qib7322_writeq_array8b ( qib7322, &rcvhdrtailaddr,
                                 QIB_7322_RcvHdrTailAddr0_offset, ctx );
        memset ( &rcvhdrhead, 0, sizeof ( rcvhdrhead ) );
        BIT_FILL_1 ( &rcvhdrhead, counter, 1 );
        qib7322_writeq_array64k ( qib7322, &rcvhdrhead,
                                  QIB_7322_RcvHdrHead0_offset, ctx );
        memset ( &rcvegrindexhead, 0, sizeof ( rcvegrindexhead ) );
        BIT_FILL_1 ( &rcvegrindexhead, Value, 1 );
        qib7322_writeq_array64k ( qib7322, &rcvegrindexhead,
                                  QIB_7322_RcvEgrIndexHead0_offset, ctx );
        qib7322_readq_port ( qib7322, &rcvctrlp,
                             QIB_7322_RcvCtrl_0_offset, port );
        BIT_SET ( &rcvctrlp, ContextEnable[ctx], 1 );
        qib7322_writeq_port ( qib7322, &rcvctrlp,
                              QIB_7322_RcvCtrl_0_offset, port );
        qib7322_readq ( qib7322, &rcvctrl, QIB_7322_RcvCtrl_offset );
        BIT_SET ( &rcvctrl, IntrAvail[ctx], 1 );
        qib7322_writeq ( qib7322, &rcvctrl, QIB_7322_RcvCtrl_offset );

        DBGC ( qib7322, "QIB7322 %p port %d QPN %ld CTX %d hdrs [%lx,%lx) prod "
               "%lx\n", qib7322, port, qp->qpn, ctx,
               virt_to_bus ( qib7322_wq->header ),
               ( virt_to_bus ( qib7322_wq->header )
                 + QIB7322_RECV_HEADERS_SIZE ),
               virt_to_bus ( &qib7322_wq->header_prod ) );
        return 0;

        free_dma ( qib7322_wq->header, QIB7322_RECV_HEADERS_SIZE );
 err_alloc_header:
        return rc;
}
static void qib7322_destroy_recv_wq ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Destroy receive work queue.

Parameters:
ibdevInfiniband device
qpQueue pair

Definition at line 824 of file qib7322.c.

References BIT_SET, ctx, free_dma(), qib7322_recv_work_queue::header, ib_get_drvdata(), ib_wq_get_drvdata(), mb(), ib_device::port, port, qib7322_ctx(), QIB7322_PORT_BASE, qib7322_readq, qib7322_readq_port, QIB7322_RECV_HEADERS_SIZE, qib7322_writeq, qib7322_writeq_port, QIB_7322_RcvCtrl_0_offset, QIB_7322_RcvCtrl_offset, and ib_queue_pair::recv.

Referenced by qib7322_create_qp(), and qib7322_destroy_qp().

                                                                 {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_work_queue *wq = &qp->recv;
        struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
        struct QIB_7322_RcvCtrl rcvctrl;
        struct QIB_7322_RcvCtrl_P rcvctrlp;
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
        unsigned int ctx = qib7322_ctx ( ibdev, qp );

        /* Disable context in hardware */
        qib7322_readq_port ( qib7322, &rcvctrlp,
                             QIB_7322_RcvCtrl_0_offset, port );
        BIT_SET ( &rcvctrlp, ContextEnable[ctx], 0 );
        qib7322_writeq_port ( qib7322, &rcvctrlp,
                              QIB_7322_RcvCtrl_0_offset, port );
        qib7322_readq ( qib7322, &rcvctrl, QIB_7322_RcvCtrl_offset );
        BIT_SET ( &rcvctrl, IntrAvail[ctx], 0 );
        qib7322_writeq ( qib7322, &rcvctrl, QIB_7322_RcvCtrl_offset );

        /* Make sure the hardware has seen that the context is disabled */
        qib7322_readq ( qib7322, &rcvctrl, QIB_7322_RcvCtrl_offset );
        mb();

        /* Free headers ring */
        free_dma ( qib7322_wq->header, QIB7322_RECV_HEADERS_SIZE );
}
static int qib7322_init_recv ( struct qib7322 qib7322) [static]

Initialise receive datapath.

Parameters:
qib7322QIB7322 device
Return values:
rcReturn status code

Definition at line 858 of file qib7322.c.

References BIT_FILL_1, BIT_FILL_2, BIT_FILL_3, BIT_FILL_6, BIT_GET, ctx, DBGC, qib7322_recv_work_queue::eager_array, qib7322_recv_work_queue::eager_entries, EINVAL, linker_assert, memset(), QIB7322_CONTEXTCFG_10CTX, QIB7322_CONTEXTCFG_18CTX, QIB7322_CONTEXTCFG_6CTX, QIB7322_EAGER_ARRAY_SIZE_10CTX_KERNEL, QIB7322_EAGER_ARRAY_SIZE_10CTX_USER, QIB7322_EAGER_ARRAY_SIZE_18CTX_KERNEL, QIB7322_EAGER_ARRAY_SIZE_18CTX_USER, QIB7322_EAGER_ARRAY_SIZE_6CTX_KERNEL, QIB7322_EAGER_ARRAY_SIZE_6CTX_USER, QIB7322_MAX_CREDITS_VL0, QIB7322_MAX_CREDITS_VL15, QIB7322_MAX_PORTS, QIB7322_NUM_CONTEXTS, QIB7322_QP_IDETH, qib7322_readq, QIB7322_RECV_HEADER_COUNT, QIB7322_RECV_HEADER_SIZE, qib7322_writeq, qib7322_writeq_array8b, QIB_7322_RcvBTHQP_0_offset, QIB_7322_RcvBTHQP_1_offset, QIB_7322_RcvCtrl_0_offset, QIB_7322_RcvCtrl_1_offset, QIB_7322_RcvCtrl_offset, QIB_7322_RcvEgrBase_offset, QIB_7322_RcvHdrCnt_offset, QIB_7322_RcvHdrEntSize_offset, QIB_7322_RcvQPMapTableA_0_offset, QIB_7322_RcvQPMapTableA_1_offset, QIB_7322_RcvQPMapTableB_0_offset, QIB_7322_RcvQPMapTableB_1_offset, QIB_7322_RcvQPMulticastContext_0_offset, QIB_7322_RcvQPMulticastContext_1_offset, QIB_7322_RxCreditVL0_0_offset, QIB_7322_RxCreditVL0_1_offset, and qib7322::recv_wq.

Referenced by qib7322_probe().

                                                         {
        struct QIB_7322_RcvCtrl rcvctrl;
        struct QIB_7322_RcvCtrl_0 rcvctrlp;
        struct QIB_7322_RcvQPMapTableA_0 rcvqpmaptablea0;
        struct QIB_7322_RcvQPMapTableB_0 rcvqpmaptableb0;
        struct QIB_7322_RcvQPMapTableA_1 rcvqpmaptablea1;
        struct QIB_7322_RcvQPMapTableB_1 rcvqpmaptableb1;
        struct QIB_7322_RcvQPMulticastContext_0 rcvqpmcastctx0;
        struct QIB_7322_RcvQPMulticastContext_1 rcvqpmcastctx1;
        struct QIB_7322_scalar rcvegrbase;
        struct QIB_7322_scalar rcvhdrentsize;
        struct QIB_7322_scalar rcvhdrcnt;
        struct QIB_7322_RcvBTHQP_0 rcvbthqp;
        struct QIB_7322_RxCreditVL0_0 rxcreditvl;
        unsigned int contextcfg;
        unsigned long egrbase;
        unsigned int eager_array_size_kernel;
        unsigned int eager_array_size_user;
        unsigned int ctx;

        /* Select configuration based on number of contexts */
        switch ( QIB7322_NUM_CONTEXTS ) {
        case 6:
                contextcfg = QIB7322_CONTEXTCFG_6CTX;
                eager_array_size_kernel = QIB7322_EAGER_ARRAY_SIZE_6CTX_KERNEL;
                eager_array_size_user = QIB7322_EAGER_ARRAY_SIZE_6CTX_USER;
                break;
        case 10:
                contextcfg = QIB7322_CONTEXTCFG_10CTX;
                eager_array_size_kernel = QIB7322_EAGER_ARRAY_SIZE_10CTX_KERNEL;
                eager_array_size_user = QIB7322_EAGER_ARRAY_SIZE_10CTX_USER;
                break;
        case 18:
                contextcfg = QIB7322_CONTEXTCFG_18CTX;
                eager_array_size_kernel = QIB7322_EAGER_ARRAY_SIZE_18CTX_KERNEL;
                eager_array_size_user = QIB7322_EAGER_ARRAY_SIZE_18CTX_USER;
                break;
        default:
                linker_assert ( 0, invalid_QIB7322_NUM_CONTEXTS );
                return -EINVAL;
        }

        /* Configure number of contexts */
        memset ( &rcvctrl, 0, sizeof ( rcvctrl ) );
        BIT_FILL_2 ( &rcvctrl,
                     TailUpd, 1,
                     ContextCfg, contextcfg );
        qib7322_writeq ( qib7322, &rcvctrl, QIB_7322_RcvCtrl_offset );

        /* Map QPNs to contexts */
        memset ( &rcvctrlp, 0, sizeof ( rcvctrlp ) );
        BIT_FILL_3 ( &rcvctrlp,
                     RcvIBPortEnable, 1,
                     RcvQPMapEnable, 1,
                     RcvPartitionKeyDisable, 1 );
        qib7322_writeq ( qib7322, &rcvctrlp, QIB_7322_RcvCtrl_0_offset );
        qib7322_writeq ( qib7322, &rcvctrlp, QIB_7322_RcvCtrl_1_offset );
        memset ( &rcvqpmaptablea0, 0, sizeof ( rcvqpmaptablea0 ) );
        BIT_FILL_6 ( &rcvqpmaptablea0,
                     RcvQPMapContext0, 0,
                     RcvQPMapContext1, 2,
                     RcvQPMapContext2, 4,
                     RcvQPMapContext3, 6,
                     RcvQPMapContext4, 8,
                     RcvQPMapContext5, 10 );
        qib7322_writeq ( qib7322, &rcvqpmaptablea0,
                         QIB_7322_RcvQPMapTableA_0_offset );
        memset ( &rcvqpmaptableb0, 0, sizeof ( rcvqpmaptableb0 ) );
        BIT_FILL_3 ( &rcvqpmaptableb0,
                     RcvQPMapContext6, 12,
                     RcvQPMapContext7, 14,
                     RcvQPMapContext8, 16 );
        qib7322_writeq ( qib7322, &rcvqpmaptableb0,
                         QIB_7322_RcvQPMapTableB_0_offset );
        memset ( &rcvqpmaptablea1, 0, sizeof ( rcvqpmaptablea1 ) );
        BIT_FILL_6 ( &rcvqpmaptablea1,
                     RcvQPMapContext0, 1,
                     RcvQPMapContext1, 3,
                     RcvQPMapContext2, 5,
                     RcvQPMapContext3, 7,
                     RcvQPMapContext4, 9,
                     RcvQPMapContext5, 11 );
        qib7322_writeq ( qib7322, &rcvqpmaptablea1,
                         QIB_7322_RcvQPMapTableA_1_offset );
        memset ( &rcvqpmaptableb1, 0, sizeof ( rcvqpmaptableb1 ) );
        BIT_FILL_3 ( &rcvqpmaptableb1,
                     RcvQPMapContext6, 13,
                     RcvQPMapContext7, 15,
                     RcvQPMapContext8, 17 );
        qib7322_writeq ( qib7322, &rcvqpmaptableb1,
                         QIB_7322_RcvQPMapTableB_1_offset );

        /* Map multicast QPNs to contexts */
        memset ( &rcvqpmcastctx0, 0, sizeof ( rcvqpmcastctx0 ) );
        BIT_FILL_1 ( &rcvqpmcastctx0, RcvQpMcContext, 0 );
        qib7322_writeq ( qib7322, &rcvqpmcastctx0,
                         QIB_7322_RcvQPMulticastContext_0_offset );
        memset ( &rcvqpmcastctx1, 0, sizeof ( rcvqpmcastctx1 ) );
        BIT_FILL_1 ( &rcvqpmcastctx1, RcvQpMcContext, 1 );
        qib7322_writeq ( qib7322, &rcvqpmcastctx1,
                         QIB_7322_RcvQPMulticastContext_1_offset );

        /* Configure receive header buffer sizes */
        memset ( &rcvhdrcnt, 0, sizeof ( rcvhdrcnt ) );
        BIT_FILL_1 ( &rcvhdrcnt, Value, QIB7322_RECV_HEADER_COUNT );
        qib7322_writeq ( qib7322, &rcvhdrcnt, QIB_7322_RcvHdrCnt_offset );
        memset ( &rcvhdrentsize, 0, sizeof ( rcvhdrentsize ) );
        BIT_FILL_1 ( &rcvhdrentsize, Value, ( QIB7322_RECV_HEADER_SIZE >> 2 ) );
        qib7322_writeq ( qib7322, &rcvhdrentsize,
                         QIB_7322_RcvHdrEntSize_offset );

        /* Calculate eager array start addresses for each context */
        qib7322_readq ( qib7322, &rcvegrbase, QIB_7322_RcvEgrBase_offset );
        egrbase = BIT_GET ( &rcvegrbase, Value );
        for ( ctx = 0 ; ctx < QIB7322_MAX_PORTS ; ctx++ ) {
                qib7322->recv_wq[ctx].eager_array = egrbase;
                qib7322->recv_wq[ctx].eager_entries = eager_array_size_kernel;
                egrbase += ( eager_array_size_kernel *
                             sizeof ( struct QIB_7322_RcvEgr ) );
        }
        for ( ; ctx < QIB7322_NUM_CONTEXTS ; ctx++ ) {
                qib7322->recv_wq[ctx].eager_array = egrbase;
                qib7322->recv_wq[ctx].eager_entries = eager_array_size_user;
                egrbase += ( eager_array_size_user *
                             sizeof ( struct QIB_7322_RcvEgr ) );
        }
        for ( ctx = 0 ; ctx < QIB7322_NUM_CONTEXTS ; ctx++ ) {
                DBGC ( qib7322, "QIB7322 %p CTX %d eager array at %lx (%d "
                       "entries)\n", qib7322, ctx,
                       qib7322->recv_wq[ctx].eager_array,
                       qib7322->recv_wq[ctx].eager_entries );
        }

        /* Set the BTH QP for Infinipath packets to an unused value */
        memset ( &rcvbthqp, 0, sizeof ( rcvbthqp ) );
        BIT_FILL_1 ( &rcvbthqp, RcvBTHQP, QIB7322_QP_IDETH );
        qib7322_writeq ( qib7322, &rcvbthqp, QIB_7322_RcvBTHQP_0_offset );
        qib7322_writeq ( qib7322, &rcvbthqp, QIB_7322_RcvBTHQP_1_offset );

        /* Assign initial credits */
        memset ( &rxcreditvl, 0, sizeof ( rxcreditvl ) );
        BIT_FILL_1 ( &rxcreditvl, RxMaxCreditVL, QIB7322_MAX_CREDITS_VL0 );
        qib7322_writeq_array8b ( qib7322, &rxcreditvl,
                                 QIB_7322_RxCreditVL0_0_offset, 0 );
        qib7322_writeq_array8b ( qib7322, &rxcreditvl,
                                 QIB_7322_RxCreditVL0_1_offset, 0 );
        BIT_FILL_1 ( &rxcreditvl, RxMaxCreditVL, QIB7322_MAX_CREDITS_VL15 );
        qib7322_writeq_array8b ( qib7322, &rxcreditvl,
                                 QIB_7322_RxCreditVL0_0_offset, 15 );
        qib7322_writeq_array8b ( qib7322, &rxcreditvl,
                                 QIB_7322_RxCreditVL0_1_offset, 15 );

        return 0;
}
static void qib7322_fini_recv ( struct qib7322 *qib7322  __unused) [static]

Shut down receive datapath.

Parameters:
qib7322QIB7322 device

Definition at line 1018 of file qib7322.c.

Referenced by qib7322_probe(), and qib7322_remove().

                                                                   {
        /* Nothing to do; all contexts were already disabled when the
         * queue pairs were destroyed
         */
}
static int qib7322_create_cq ( struct ib_device ibdev,
struct ib_completion_queue cq 
) [static]

Create completion queue.

Parameters:
ibdevInfiniband device
cqCompletion queue
Return values:
rcReturn status code

Definition at line 1038 of file qib7322.c.

References ib_completion_queue::cqn, cqn, DBGC, and ib_get_drvdata().

                                                                {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        static int cqn;

        /* The hardware has no concept of completion queues.  We
         * simply use the association between CQs and WQs (already
         * handled by the IB core) to decide which WQs to poll.
         *
         * We do set a CQN, just to avoid confusing debug messages
         * from the IB core.
         */
        cq->cqn = ++cqn;
        DBGC ( qib7322, "QIB7322 %p CQN %ld created\n", qib7322, cq->cqn );

        return 0;
}
static void qib7322_destroy_cq ( struct ib_device ibdev,
struct ib_completion_queue cq 
) [static]

Destroy completion queue.

Parameters:
ibdevInfiniband device
cqCompletion queue

Definition at line 1062 of file qib7322.c.

References ib_completion_queue::cqn, DBGC, and ib_get_drvdata().

                                                                  {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );

        /* Nothing to do */
        DBGC ( qib7322, "QIB7322 %p CQN %ld destroyed\n", qib7322, cq->cqn );
}
static int qib7322_create_qp ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Create queue pair.

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

Definition at line 1084 of file qib7322.c.

References ctx, ib_get_drvdata(), ib_wq_set_drvdata(), qib7322_alloc_ctx(), qib7322_create_recv_wq(), qib7322_create_send_wq(), qib7322_ctx(), qib7322_destroy_recv_wq(), qib7322_destroy_send_wq(), qib7322_free_ctx(), rc, ib_queue_pair::recv, qib7322::recv_wq, ib_queue_pair::send, and qib7322::send_wq.

                                                          {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        unsigned int ctx;
        int rc;

        /* Allocate a context and QPN */
        if ( ( rc = qib7322_alloc_ctx ( ibdev, qp ) ) != 0 )
                goto err_alloc_ctx;
        ctx = qib7322_ctx ( ibdev, qp );

        /* Set work-queue private data pointers */
        ib_wq_set_drvdata ( &qp->send, &qib7322->send_wq[ctx] );
        ib_wq_set_drvdata ( &qp->recv, &qib7322->recv_wq[ctx] );

        /* Create receive work queue */
        if ( ( rc = qib7322_create_recv_wq ( ibdev, qp ) ) != 0 )
                goto err_create_recv_wq;

        /* Create send work queue */
        if ( ( rc = qib7322_create_send_wq ( ibdev, qp ) ) != 0 )
                goto err_create_send_wq;

        return 0;

        qib7322_destroy_send_wq ( ibdev, qp );
 err_create_send_wq:
        qib7322_destroy_recv_wq ( ibdev, qp );
 err_create_recv_wq:
        qib7322_free_ctx ( ibdev, qp );
 err_alloc_ctx:
        return rc;
}
static int qib7322_modify_qp ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Modify queue pair.

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

Definition at line 1125 of file qib7322.c.

References DBGC2, ib_get_drvdata(), and ib_queue_pair::qpn.

                                                          {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );

        /* Nothing to do; the hardware doesn't have a notion of queue
         * keys
         */
        DBGC2 ( qib7322, "QIB7322 %p QPN %ld modified\n", qib7322, qp->qpn );
        return 0;
}
static void qib7322_destroy_qp ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Destroy queue pair.

Parameters:
ibdevInfiniband device
qpQueue pair

Definition at line 1142 of file qib7322.c.

References qib7322_destroy_recv_wq(), qib7322_destroy_send_wq(), and qib7322_free_ctx().

                                                            {

        qib7322_destroy_send_wq ( ibdev, qp );
        qib7322_destroy_recv_wq ( ibdev, qp );
        qib7322_free_ctx ( ibdev, qp );
}
static int qib7322_post_send ( struct ib_device ibdev,
struct ib_queue_pair qp,
struct ib_address_vector dest,
struct io_buffer iobuf 
) [static]

Post send work queue entry.

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

Definition at line 1166 of file qib7322.c.

References assert, BIT_FILL_3, io_buffer::data, data, DBG_DISABLE, DBG_ENABLE, DBGC2, DBGLVL_IO, ib_get_drvdata(), IB_MAX_HEADER_SIZE, ib_push(), IB_QPT_SMI, ib_wq_get_drvdata(), iob_len(), iob_populate(), iob_reserve, ib_work_queue::iobufs, len, memset(), NULL, ib_work_queue::num_wqes, offset, ib_device::port, port, qib7322_send_work_queue::prod, qib7322_alloc_send_buf(), QIB7322_PORT_BASE, qib7322_send_buffer_offset(), qib7322_writel(), qib7322_writeq, ib_queue_pair::qpn, ib_queue_pair::send, qib7322_send_work_queue::send_bufs, ib_queue_pair::type, and qib7322_send_work_queue::used.

                                                         {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_work_queue *wq = &qp->send;
        struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
        struct QIB_7322_SendPbc sendpbc;
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
        uint8_t header_buf[IB_MAX_HEADER_SIZE];
        struct io_buffer headers;
        int send_buf;
        unsigned long start_offset;
        unsigned long offset;
        size_t len;
        ssize_t frag_len;
        uint32_t *data;

        /* Allocate send buffer and calculate offset */
        send_buf = qib7322_alloc_send_buf ( qib7322, qib7322_wq->send_bufs );
        if ( send_buf < 0 )
                return send_buf;
        start_offset = offset =
                qib7322_send_buffer_offset ( qib7322, qib7322_wq->send_bufs,
                                             send_buf );

        /* Store I/O buffer and send buffer index */
        assert ( wq->iobufs[qib7322_wq->prod] == NULL );
        wq->iobufs[qib7322_wq->prod] = iobuf;
        qib7322_wq->used[qib7322_wq->prod] = send_buf;

        /* Construct headers */
        iob_populate ( &headers, header_buf, 0, sizeof ( header_buf ) );
        iob_reserve ( &headers, sizeof ( header_buf ) );
        ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), dest );

        /* Calculate packet length */
        len = ( ( sizeof ( sendpbc ) + iob_len ( &headers ) +
                  iob_len ( iobuf ) + 3 ) & ~3 );

        /* Construct send per-buffer control word */
        memset ( &sendpbc, 0, sizeof ( sendpbc ) );
        BIT_FILL_3 ( &sendpbc,
                     LengthP1_toibc, ( ( len >> 2 ) - 1 ),
                     Port, port,
                     VL15, ( ( qp->type == IB_QPT_SMI ) ? 1 : 0 ) );

        /* Write SendPbc */
        DBG_DISABLE ( DBGLVL_IO );
        qib7322_writeq ( qib7322, &sendpbc, offset );
        offset += sizeof ( sendpbc );

        /* Write headers */
        for ( data = headers.data, frag_len = iob_len ( &headers ) ;
              frag_len > 0 ; data++, offset += 4, frag_len -= 4 ) {
                qib7322_writel ( qib7322, *data, offset );
        }

        /* Write data */
        for ( data = iobuf->data, frag_len = iob_len ( iobuf ) ;
              frag_len > 0 ; data++, offset += 4, frag_len -= 4 ) {
                qib7322_writel ( qib7322, *data, offset );
        }
        DBG_ENABLE ( DBGLVL_IO );

        assert ( ( start_offset + len ) == offset );
        DBGC2 ( qib7322, "QIB7322 %p QPN %ld TX %04x(%04x) posted [%lx,%lx)\n",
                qib7322, qp->qpn, send_buf, qib7322_wq->prod,
                start_offset, offset );

        /* Increment producer counter */
        qib7322_wq->prod = ( ( qib7322_wq->prod + 1 ) & ( wq->num_wqes - 1 ) );

        return 0;
}
static void qib7322_complete_send ( struct ib_device ibdev,
struct ib_queue_pair qp,
unsigned int  wqe_idx 
) [static]

Complete send work queue entry.

Parameters:
ibdevInfiniband device
qpQueue pair
wqe_idxWork queue entry index

Definition at line 1249 of file qib7322.c.

References assert, DBGC2, ib_complete_send(), ib_get_drvdata(), ib_wq_get_drvdata(), ib_work_queue::iobufs, NULL, qib7322_free_send_buf(), ib_queue_pair::qpn, ib_queue_pair::send, qib7322_send_work_queue::send_bufs, and qib7322_send_work_queue::used.

Referenced by qib7322_poll_send_wq().

                                                           {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_work_queue *wq = &qp->send;
        struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
        struct io_buffer *iobuf;
        unsigned int send_buf;

        /* Parse completion */
        send_buf = qib7322_wq->used[wqe_idx];
        DBGC2 ( qib7322, "QIB7322 %p QPN %ld TX %04x(%04x) complete\n",
                qib7322, qp->qpn, send_buf, wqe_idx );

        /* Complete work queue entry */
        iobuf = wq->iobufs[wqe_idx];
        assert ( iobuf != NULL );
        ib_complete_send ( ibdev, qp, iobuf, 0 );
        wq->iobufs[wqe_idx] = NULL;

        /* Free send buffer */
        qib7322_free_send_buf ( qib7322, qib7322_wq->send_bufs, send_buf );
}
static void qib7322_poll_send_wq ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Poll send work queue.

Parameters:
ibdevInfiniband device
qpQueue pair

Definition at line 1279 of file qib7322.c.

References qib7322_send_work_queue::cons, ib_work_queue::fill, ib_get_drvdata(), ib_wq_get_drvdata(), ib_work_queue::num_wqes, qib7322_complete_send(), qib7322_send_buf_in_use(), ib_queue_pair::send, and qib7322_send_work_queue::used.

Referenced by qib7322_poll_cq().

                                                              {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_work_queue *wq = &qp->send;
        struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
        unsigned int send_buf;

        /* Look for completions */
        while ( wq->fill ) {

                /* Check to see if send buffer has completed */
                send_buf = qib7322_wq->used[qib7322_wq->cons];
                if ( qib7322_send_buf_in_use ( qib7322, send_buf ) )
                        break;

                /* Complete this buffer */
                qib7322_complete_send ( ibdev, qp, qib7322_wq->cons );

                /* Increment consumer counter */
                qib7322_wq->cons = ( ( qib7322_wq->cons + 1 ) &
                                     ( wq->num_wqes - 1 ) );
        }
}
static int qib7322_post_recv ( struct ib_device ibdev,
struct ib_queue_pair qp,
struct io_buffer iobuf 
) [static]

Post receive work queue entry.

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

Definition at line 1311 of file qib7322.c.

References addr, assert, BIT_FILL_1, BIT_FILL_2, bufsize, ctx, io_buffer::data, DBGC, DBGC2, qib7322_recv_work_queue::eager_array, qib7322_recv_work_queue::eager_entries, qib7322_recv_work_queue::eager_prod, EINVAL, ib_get_drvdata(), ib_wq_get_drvdata(), iob_tailroom(), ib_work_queue::iobufs, len, linker_assert, memset(), NULL, ib_work_queue::num_wqes, qib7322_ctx(), QIB7322_EAGER_BUFFER_16K, QIB7322_EAGER_BUFFER_2K, QIB7322_EAGER_BUFFER_32K, QIB7322_EAGER_BUFFER_4K, QIB7322_EAGER_BUFFER_64K, QIB7322_EAGER_BUFFER_8K, QIB7322_EAGER_BUFFER_ALIGN, QIB7322_EAGER_BUFFER_NONE, QIB7322_RECV_PAYLOAD_SIZE, qib7322_writeq_array64k, qib7322_writeq_array8b, QIB_7322_RcvEgrIndexHead0_offset, ib_queue_pair::qpn, ib_queue_pair::recv, and virt_to_bus().

                                                         {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_work_queue *wq = &qp->recv;
        struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
        struct QIB_7322_RcvEgr rcvegr;
        struct QIB_7322_scalar rcvegrindexhead;
        unsigned int ctx = qib7322_ctx ( ibdev, qp );
        physaddr_t addr;
        size_t len;
        unsigned int wqe_idx;
        unsigned int bufsize;

        /* Sanity checks */
        addr = virt_to_bus ( iobuf->data );
        len = iob_tailroom ( iobuf );
        if ( addr & ( QIB7322_EAGER_BUFFER_ALIGN - 1 ) ) {
                DBGC ( qib7322, "QIB7322 %p QPN %ld misaligned RX buffer "
                       "(%08lx)\n", qib7322, qp->qpn, addr );
                return -EINVAL;
        }
        if ( len != QIB7322_RECV_PAYLOAD_SIZE ) {
                DBGC ( qib7322, "QIB7322 %p QPN %ld wrong RX buffer size "
                       "(%zd)\n", qib7322, qp->qpn, len );
                return -EINVAL;
        }

        /* Calculate eager producer index and WQE index */
        wqe_idx = ( qib7322_wq->eager_prod & ( wq->num_wqes - 1 ) );
        assert ( wq->iobufs[wqe_idx] == NULL );

        /* Store I/O buffer */
        wq->iobufs[wqe_idx] = iobuf;

        /* Calculate buffer size */
        switch ( QIB7322_RECV_PAYLOAD_SIZE ) {
        case 2048:  bufsize = QIB7322_EAGER_BUFFER_2K;  break;
        case 4096:  bufsize = QIB7322_EAGER_BUFFER_4K;  break;
        case 8192:  bufsize = QIB7322_EAGER_BUFFER_8K;  break;
        case 16384: bufsize = QIB7322_EAGER_BUFFER_16K; break;
        case 32768: bufsize = QIB7322_EAGER_BUFFER_32K; break;
        case 65536: bufsize = QIB7322_EAGER_BUFFER_64K; break;
        default:    linker_assert ( 0, invalid_rx_payload_size );
                    bufsize = QIB7322_EAGER_BUFFER_NONE;
        }

        /* Post eager buffer */
        memset ( &rcvegr, 0, sizeof ( rcvegr ) );
        BIT_FILL_2 ( &rcvegr,
                     Addr, ( addr >> 11 ),
                     BufSize, bufsize );
        qib7322_writeq_array8b ( qib7322, &rcvegr, qib7322_wq->eager_array,
                                 qib7322_wq->eager_prod );
        DBGC2 ( qib7322, "QIB7322 %p QPN %ld RX egr %04x(%04x) posted "
                "[%lx,%lx)\n", qib7322, qp->qpn, qib7322_wq->eager_prod,
                wqe_idx, addr, ( addr + len ) );

        /* Increment producer index */
        qib7322_wq->eager_prod = ( ( qib7322_wq->eager_prod + 1 ) &
                                   ( qib7322_wq->eager_entries - 1 ) );

        /* Update head index */
        memset ( &rcvegrindexhead, 0, sizeof ( rcvegrindexhead ) );
        BIT_FILL_1 ( &rcvegrindexhead,
                     Value, ( ( qib7322_wq->eager_prod + 1 ) &
                              ( qib7322_wq->eager_entries - 1 ) ) );
        qib7322_writeq_array64k ( qib7322, &rcvegrindexhead,
                                  QIB_7322_RcvEgrIndexHead0_offset, ctx );

        return 0;
}
static void qib7322_complete_recv ( struct ib_device ibdev,
struct ib_queue_pair qp,
unsigned int  header_offs 
) [static]

Complete receive work queue entry.

Parameters:
ibdevInfiniband device
qpQueue pair
header_offsHeader offset

Definition at line 1391 of file qib7322.c.

References assert, BIT_GET, io_buffer::data, DBGC, DBGC2, DBGCP_HDA, qib7322_recv_work_queue::eager_array, qib7322_recv_work_queue::eager_cons, qib7322_recv_work_queue::eager_entries, qib7322_recv_work_queue::eager_prod, ECANCELED, EIO, EPROTO, ib_work_queue::fill, qib7322_recv_work_queue::header, ib_complete_recv(), ib_get_drvdata(), ib_pull(), ib_wq_get_drvdata(), iob_populate(), iob_put, iob_tailroom(), ib_work_queue::iobufs, memset(), NULL, ib_work_queue::num_wqes, QIB7322_RECV_HEADER_SIZE, qib7322_writeq_array8b, qp, ib_queue_pair::qpn, rc, ib_queue_pair::recv, and strerror().

Referenced by qib7322_poll_recv_wq().

                                                               {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_work_queue *wq = &qp->recv;
        struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
        struct QIB_7322_RcvHdrFlags *rcvhdrflags;
        struct QIB_7322_RcvEgr rcvegr;
        struct io_buffer headers;
        struct io_buffer *iobuf;
        struct ib_queue_pair *intended_qp;
        struct ib_address_vector dest;
        struct ib_address_vector source;
        unsigned int rcvtype;
        unsigned int pktlen;
        unsigned int egrindex;
        unsigned int useegrbfr;
        unsigned int iberr, mkerr, tiderr, khdrerr, mtuerr;
        unsigned int lenerr, parityerr, vcrcerr, icrcerr;
        unsigned int err;
        unsigned int hdrqoffset;
        unsigned int header_len;
        unsigned int padded_payload_len;
        unsigned int wqe_idx;
        size_t payload_len;
        int qp0;
        int rc;

        /* RcvHdrFlags are at the end of the header entry */
        rcvhdrflags = ( qib7322_wq->header + header_offs +
                        QIB7322_RECV_HEADER_SIZE - sizeof ( *rcvhdrflags ) );
        rcvtype = BIT_GET ( rcvhdrflags, RcvType );
        pktlen = ( BIT_GET ( rcvhdrflags, PktLen ) << 2 );
        egrindex = BIT_GET ( rcvhdrflags, EgrIndex );
        useegrbfr = BIT_GET ( rcvhdrflags, UseEgrBfr );
        hdrqoffset = ( BIT_GET ( rcvhdrflags, HdrqOffset ) << 2 );
        iberr = BIT_GET ( rcvhdrflags, IBErr );
        mkerr = BIT_GET ( rcvhdrflags, MKErr );
        tiderr = BIT_GET ( rcvhdrflags, TIDErr );
        khdrerr = BIT_GET ( rcvhdrflags, KHdrErr );
        mtuerr = BIT_GET ( rcvhdrflags, MTUErr );
        lenerr = BIT_GET ( rcvhdrflags, LenErr );
        parityerr = BIT_GET ( rcvhdrflags, ParityErr );
        vcrcerr = BIT_GET ( rcvhdrflags, VCRCErr );
        icrcerr = BIT_GET ( rcvhdrflags, ICRCErr );
        header_len = ( QIB7322_RECV_HEADER_SIZE - hdrqoffset -
                       sizeof ( *rcvhdrflags ) );
        padded_payload_len = ( pktlen - header_len - 4 /* ICRC */ );
        err = ( iberr | mkerr | tiderr | khdrerr | mtuerr |
                lenerr | parityerr | vcrcerr | icrcerr );
        /* IB header is placed immediately before RcvHdrFlags */
        iob_populate ( &headers, ( ( ( void * ) rcvhdrflags ) - header_len ),
                       header_len, header_len );

        /* Dump diagnostic information */
        DBGC2 ( qib7322, "QIB7322 %p QPN %ld RX egr %04x%s hdr %d type %d len "
                "%d(%d+%d+4)%s%s%s%s%s%s%s%s%s%s%s\n", qib7322, qp->qpn,
                egrindex, ( useegrbfr ? "" : "(unused)" ),
                ( header_offs / QIB7322_RECV_HEADER_SIZE ),
                rcvtype, pktlen, header_len, padded_payload_len,
                ( err ? " [Err" : "" ), ( iberr ? " IB" : "" ),
                ( mkerr ? " MK" : "" ), ( tiderr ? " TID" : "" ),
                ( khdrerr ? " KHdr" : "" ), ( mtuerr ? " MTU" : "" ),
                ( lenerr ? " Len" : "" ), ( parityerr ? " Parity" : ""),
                ( vcrcerr ? " VCRC" : "" ), ( icrcerr ? " ICRC" : "" ),
                ( err ? "]" : "" ) );
        DBGCP_HDA ( qib7322, hdrqoffset, headers.data,
                    ( header_len + sizeof ( *rcvhdrflags ) ) );

        /* Parse header to generate address vector */
        qp0 = ( qp->qpn == 0 );
        intended_qp = NULL;
        if ( ( rc = ib_pull ( ibdev, &headers, ( qp0 ? &intended_qp : NULL ),
                              &payload_len, &dest, &source ) ) != 0 ) {
                DBGC ( qib7322, "QIB7322 %p could not parse headers: %s\n",
                       qib7322, strerror ( rc ) );
                err = 1;
        }
        if ( ! intended_qp )
                intended_qp = qp;

        /* Complete this buffer and any skipped buffers.  Note that
         * when the hardware runs out of buffers, it will repeatedly
         * report the same buffer (the tail) as a TID error, and that
         * it also has a habit of sometimes skipping over several
         * buffers at once.
         */
        while ( 1 ) {

                /* If we have caught up to the producer counter, stop.
                 * This will happen when the hardware first runs out
                 * of buffers and starts reporting TID errors against
                 * the eager buffer it wants to use next.
                 */
                if ( qib7322_wq->eager_cons == qib7322_wq->eager_prod )
                        break;

                /* If we have caught up to where we should be after
                 * completing this egrindex, stop.  We phrase the test
                 * this way to avoid completing the entire ring when
                 * we receive the same egrindex twice in a row.
                 */
                if ( ( qib7322_wq->eager_cons ==
                       ( ( egrindex + 1 ) & ( qib7322_wq->eager_entries - 1 ))))
                        break;

                /* Identify work queue entry and corresponding I/O
                 * buffer.
                 */
                wqe_idx = ( qib7322_wq->eager_cons & ( wq->num_wqes - 1 ) );
                iobuf = wq->iobufs[wqe_idx];
                assert ( iobuf != NULL );
                wq->iobufs[wqe_idx] = NULL;

                /* Complete the eager buffer */
                if ( qib7322_wq->eager_cons == egrindex ) {
                        /* Completing the eager buffer described in
                         * this header entry.
                         */
                        if ( payload_len <= iob_tailroom ( iobuf ) ) {
                                iob_put ( iobuf, payload_len );
                                rc = ( err ?
                                       -EIO : ( useegrbfr ? 0 : -ECANCELED ) );
                        } else {
                                DBGC ( qib7322, "QIB7322 %p bad payload len "
                                       "%zd\n", qib7322, payload_len );
                                rc = -EPROTO;
                        }
                        /* Redirect to target QP if necessary */
                        if ( qp != intended_qp ) {
                                DBGC2 ( qib7322, "QIB7322 %p redirecting QPN "
                                        "%ld => %ld\n",
                                        qib7322, qp->qpn, intended_qp->qpn );
                                /* Compensate for incorrect fill levels */
                                qp->recv.fill--;
                                intended_qp->recv.fill++;
                        }
                        ib_complete_recv ( ibdev, intended_qp, &dest, &source,
                                           iobuf, rc );
                } else {
                        /* Completing on a skipped-over eager buffer */
                        ib_complete_recv ( ibdev, qp, &dest, &source, iobuf,
                                           -ECANCELED );
                }

                /* Clear eager buffer */
                memset ( &rcvegr, 0, sizeof ( rcvegr ) );
                qib7322_writeq_array8b ( qib7322, &rcvegr,
                                         qib7322_wq->eager_array,
                                         qib7322_wq->eager_cons );

                /* Increment consumer index */
                qib7322_wq->eager_cons = ( ( qib7322_wq->eager_cons + 1 ) &
                                           ( qib7322_wq->eager_entries - 1 ) );
        }
}
static void qib7322_poll_recv_wq ( struct ib_device ibdev,
struct ib_queue_pair qp 
) [static]

Poll receive work queue.

Parameters:
ibdevInfiniband device
qpQueue pair

Definition at line 1554 of file qib7322.c.

References BIT_FILL_2, BIT_GET, ctx, qib7322_recv_work_queue::header_cons, qib7322_recv_work_queue::header_prod, ib_get_drvdata(), IB_QPT_SMI, ib_wq_get_drvdata(), memset(), qib7322_complete_recv(), qib7322_ctx(), QIB7322_RECV_HEADER_SIZE, QIB7322_RECV_HEADERS_SIZE, qib7322_writeq_array64k, QIB_7322_RcvHdrHead0_offset, ib_queue_pair::recv, and ib_queue_pair::type.

Referenced by qib7322_poll_cq().

                                                              {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct ib_work_queue *wq = &qp->recv;
        struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
        struct QIB_7322_RcvHdrHead0 rcvhdrhead;
        unsigned int ctx = qib7322_ctx ( ibdev, qp );
        unsigned int header_prod;

        /* Check for received packets */
        header_prod = ( BIT_GET ( &qib7322_wq->header_prod, Value ) << 2 );
        if ( header_prod == qib7322_wq->header_cons )
                return;

        /* Process all received packets */
        while ( qib7322_wq->header_cons != header_prod ) {

                /* Complete the receive */
                qib7322_complete_recv ( ibdev, qp, qib7322_wq->header_cons );

                /* Increment the consumer offset */
                qib7322_wq->header_cons += QIB7322_RECV_HEADER_SIZE;
                qib7322_wq->header_cons %= QIB7322_RECV_HEADERS_SIZE;

                /* QIB7322 has only one send buffer per port for VL15,
                 * which almost always leads to send buffer exhaustion
                 * and dropped MADs.  Mitigate this by refusing to
                 * process more than one VL15 MAD per poll, which will
                 * enforce interleaved TX/RX polls.
                 */
                if ( qp->type == IB_QPT_SMI )
                        break;
        }

        /* Update consumer offset */
        memset ( &rcvhdrhead, 0, sizeof ( rcvhdrhead ) );
        BIT_FILL_2 ( &rcvhdrhead,
                     RcvHeadPointer, ( qib7322_wq->header_cons >> 2 ),
                     counter, 1 );
        qib7322_writeq_array64k ( qib7322, &rcvhdrhead,
                                  QIB_7322_RcvHdrHead0_offset, ctx );
}
static void qib7322_poll_cq ( struct ib_device ibdev,
struct ib_completion_queue cq 
) [static]

Poll completion queue.

Parameters:
ibdevInfiniband device
cqCompletion queue

Definition at line 1603 of file qib7322.c.

References ib_work_queue::is_send, ib_work_queue::list, list_for_each_entry, qib7322_poll_recv_wq(), qib7322_poll_send_wq(), ib_work_queue::qp, and ib_completion_queue::work_queues.

                                                               {
        struct ib_work_queue *wq;

        /* Poll associated send and receive queues */
        list_for_each_entry ( wq, &cq->work_queues, list ) {
                if ( wq->is_send ) {
                        qib7322_poll_send_wq ( ibdev, wq->qp );
                } else {
                        qib7322_poll_recv_wq ( ibdev, wq->qp );
                }
        }
}
static void qib7322_poll_eq ( struct ib_device ibdev) [static]

Poll event queue.

Parameters:
ibdevInfiniband device

Definition at line 1629 of file qib7322.c.

References BIT_GET, DBG_DISABLE, DBG_ENABLE, DBGC, DBGLVL_IO, ib_get_drvdata(), ib_device::port, port, qib7322_link_state_changed(), QIB7322_PORT_BASE, qib7322_readq_port, qib7322_writeq_port, QIB_7322_ErrClear_0_offset, and QIB_7322_ErrStatus_0_offset.

                                                        {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct QIB_7322_ErrStatus_0 errstatus;
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );

        /* Check for and clear status bits */
        DBG_DISABLE ( DBGLVL_IO );
        qib7322_readq_port ( qib7322, &errstatus,
                             QIB_7322_ErrStatus_0_offset, port );
        if ( errstatus.u.qwords[0] ) {
                DBGC ( qib7322, "QIB7322 %p port %d status %08x%08x\n", qib7322,
                       port, errstatus.u.dwords[1],  errstatus.u.dwords[0] );
                qib7322_writeq_port ( qib7322, &errstatus,
                                      QIB_7322_ErrClear_0_offset, port );
        }
        DBG_ENABLE ( DBGLVL_IO );

        /* Check for link status changes */
        if ( BIT_GET ( &errstatus, IBStatusChanged ) )
                qib7322_link_state_changed ( ibdev );
}
static unsigned int qib7322_link_speed_supported ( struct qib7322 qib7322,
unsigned int  port 
) [static]

Determine supported link speeds.

Parameters:
qib7322QIB7322 device
Return values:
supportedSupported link speeds

Definition at line 1664 of file qib7322.c.

References BIT_GET, DBGC, DBGC2, IB_LINK_SPEED_DDR, IB_LINK_SPEED_QDR, IB_LINK_SPEED_SDR, QIB7322_BOARD_QMH7342, qib7322_readq, QIB_7322_active_feature_mask_offset, and QIB_7322_Revision_offset.

Referenced by qib7322_probe().

                                                                       {
        struct QIB_7322_feature_mask features;
        struct QIB_7322_Revision revision;
        unsigned int supported;
        unsigned int boardid;

        /* Read the active feature mask */
        qib7322_readq ( qib7322, &features,
                        QIB_7322_active_feature_mask_offset );
        switch ( port ) {
        case 0 :
                supported = BIT_GET ( &features, Port0_Link_Speed_Supported );
                break;
        case 1 :
                supported = BIT_GET ( &features, Port1_Link_Speed_Supported );
                break;
        default:
                DBGC ( qib7322, "QIB7322 %p port %d is invalid\n",
                       qib7322, port );
                supported = 0;
                break;
        }

        /* Apply hacks for specific board IDs */
        qib7322_readq ( qib7322, &revision, QIB_7322_Revision_offset );
        boardid = BIT_GET ( &revision, BoardID );
        switch ( boardid ) {
        case QIB7322_BOARD_QMH7342 :
                DBGC2 ( qib7322, "QIB7322 %p is a QMH7342; forcing QDR-only\n",
                        qib7322 );
                supported = IB_LINK_SPEED_QDR;
                break;
        default:
                /* Do nothing */
                break;
        }

        DBGC2 ( qib7322, "QIB7322 %p port %d %s%s%s%s\n", qib7322, port,
                ( supported ? "supports" : "disabled" ),
                ( ( supported & IB_LINK_SPEED_SDR ) ? " SDR" : "" ),
                ( ( supported & IB_LINK_SPEED_DDR ) ? " DDR" : "" ),
                ( ( supported & IB_LINK_SPEED_QDR ) ? " QDR" : "" ) );
        return supported;
}
static int qib7322_open ( struct ib_device ibdev) [static]

Initialise Infiniband link.

Parameters:
ibdevInfiniband device
Return values:
rcReturn status code

Definition at line 1716 of file qib7322.c.

References BIT_SET, ib_get_drvdata(), ib_device::port, port, QIB7322_PORT_BASE, qib7322_readq_port, qib7322_writeq_port, and QIB_7322_IBCCtrlA_0_offset.

                                                    {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct QIB_7322_IBCCtrlA_0 ibcctrla;
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );

        /* Enable link */
        qib7322_readq_port ( qib7322, &ibcctrla,
                             QIB_7322_IBCCtrlA_0_offset, port );
        BIT_SET ( &ibcctrla, IBLinkEn, 1 );
        qib7322_writeq_port ( qib7322, &ibcctrla,
                              QIB_7322_IBCCtrlA_0_offset, port );

        return 0;
}
static void qib7322_close ( struct ib_device ibdev) [static]

Close Infiniband link.

Parameters:
ibdevInfiniband device

Definition at line 1736 of file qib7322.c.

References BIT_SET, ib_get_drvdata(), ib_device::port, port, QIB7322_PORT_BASE, qib7322_readq_port, qib7322_writeq_port, and QIB_7322_IBCCtrlA_0_offset.

                                                      {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
        struct QIB_7322_IBCCtrlA_0 ibcctrla;
        unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );

        /* Disable link */
        qib7322_readq_port ( qib7322, &ibcctrla,
                             QIB_7322_IBCCtrlA_0_offset, port );
        BIT_SET ( &ibcctrla, IBLinkEn, 0 );
        qib7322_writeq_port ( qib7322, &ibcctrla,
                              QIB_7322_IBCCtrlA_0_offset, port );
}
static int qib7322_mcast_attach ( struct ib_device ibdev,
struct ib_queue_pair qp,
union ib_gid gid 
) [static]

Attach to multicast group.

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

Definition at line 1764 of file qib7322.c.

References ib_get_drvdata().

                                                      {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );

        ( void ) qib7322;
        ( void ) qp;
        ( void ) gid;
        return 0;
}
static void qib7322_mcast_detach ( struct ib_device ibdev,
struct ib_queue_pair qp,
union ib_gid gid 
) [static]

Detach from multicast group.

Parameters:
ibdevInfiniband device
qpQueue pair
gidMulticast GID

Definition at line 1782 of file qib7322.c.

References ib_get_drvdata().

                                                       {
        struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );

        ( void ) qib7322;
        ( void ) qp;
        ( void ) gid;
 }
static int qib7322_i2c_read_bit ( struct bit_basher basher,
unsigned int  bit_id 
) [static]

Read QIB7322 I2C line status.

Parameters:
basherBit-bashing interface
bit_idBit number
Return values:
zeroInput is a logic 0
non-zeroInput is a logic 1

Definition at line 1832 of file qib7322.c.

References i2c_bit_basher::basher, BIT_GET, container_of, DBG_DISABLE, DBG_ENABLE, DBGLVL_IO, qib7322::i2c, qib7322_i2c_bits, qib7322_readq, QIB_7322_EXTStatus_offset, and status.

                                                        {
        struct qib7322 *qib7322 =
                container_of ( basher, struct qib7322, i2c.basher );
        struct QIB_7322_EXTStatus extstatus;
        unsigned int status;

        DBG_DISABLE ( DBGLVL_IO );

        qib7322_readq ( qib7322, &extstatus, QIB_7322_EXTStatus_offset );
        status = ( BIT_GET ( &extstatus, GPIOIn ) & qib7322_i2c_bits[bit_id] );

        DBG_ENABLE ( DBGLVL_IO );

        return status;
}
static void qib7322_i2c_write_bit ( struct bit_basher basher,
unsigned int  bit_id,
unsigned long  data 
) [static]

Write QIB7322 I2C line status.

Parameters:
basherBit-bashing interface
bit_idBit number
dataValue to write

Definition at line 1856 of file qib7322.c.

References i2c_bit_basher::basher, BIT_GET, BIT_SET, container_of, DBG_DISABLE, DBG_ENABLE, DBGLVL_IO, qib7322::i2c, mb(), qib7322_i2c_bits, qib7322_readq, qib7322_writeq, QIB_7322_EXTCtrl_offset, and QIB_7322_GPIOOut_offset.

                                                                              {
        struct qib7322 *qib7322 =
                container_of ( basher, struct qib7322, i2c.basher );
        struct QIB_7322_EXTCtrl extctrl;
        struct QIB_7322_GPIO gpioout;
        unsigned int bit = qib7322_i2c_bits[bit_id];
        unsigned int outputs = 0;
        unsigned int output_enables = 0;

        DBG_DISABLE ( DBGLVL_IO );

        /* Read current GPIO mask and outputs */
        qib7322_readq ( qib7322, &extctrl, QIB_7322_EXTCtrl_offset );
        qib7322_readq ( qib7322, &gpioout, QIB_7322_GPIOOut_offset );

        /* Update outputs and output enables.  I2C lines are tied
         * high, so we always set the output to 0 and use the output
         * enable to control the line.
         */
        output_enables = BIT_GET ( &extctrl, GPIOOe );
        output_enables = ( ( output_enables & ~bit ) | ( ~data & bit ) );
        outputs = BIT_GET ( &gpioout, GPIO );
        outputs = ( outputs & ~bit );
        BIT_SET ( &extctrl, GPIOOe, output_enables );
        BIT_SET ( &gpioout, GPIO, outputs );

        /* Write the output enable first; that way we avoid logic
         * hazards.
         */
        qib7322_writeq ( qib7322, &extctrl, QIB_7322_EXTCtrl_offset );
        qib7322_writeq ( qib7322, &gpioout, QIB_7322_GPIOOut_offset );
        mb();

        DBG_ENABLE ( DBGLVL_IO );
}
static int qib7322_init_i2c ( struct qib7322 qib7322) [static]

Initialise QIB7322 I2C subsystem.

Parameters:
qib7322QIB7322 device
Return values:
rcReturn status code

Definition at line 1905 of file qib7322.c.

References DBGC, DBGC2, qib7322::eeprom, ENODEV, i2c_bit_basher::i2c, qib7322::i2c, i2c_check_presence(), init_i2c_bit_basher(), init_i2c_eeprom(), rc, and strerror().

Referenced by qib7322_probe().

                                                        {
        static int try_eeprom_address[] = { 0x51, 0x50 };
        unsigned int i;
        int rc;

        /* Initialise bus */
        if ( ( rc = init_i2c_bit_basher ( &qib7322->i2c,
                                          &qib7322_i2c_basher_ops ) ) != 0 ) {
                DBGC ( qib7322, "QIB7322 %p could not initialise I2C bus: %s\n",
                       qib7322, strerror ( rc ) );
                return rc;
        }

        /* Probe for devices */
        for ( i = 0 ; i < ( sizeof ( try_eeprom_address ) /
                            sizeof ( try_eeprom_address[0] ) ) ; i++ ) {
                init_i2c_eeprom ( &qib7322->eeprom, try_eeprom_address[i] );
                if ( ( rc = i2c_check_presence ( &qib7322->i2c.i2c,
                                                 &qib7322->eeprom ) ) == 0 ) {
                        DBGC2 ( qib7322, "QIB7322 %p found EEPROM at %02x\n",
                                qib7322, try_eeprom_address[i] );
                        return 0;
                }
        }

        DBGC ( qib7322, "QIB7322 %p could not find EEPROM\n", qib7322 );
        return -ENODEV;
}
static int qib7322_read_eeprom ( struct qib7322 qib7322) [static]

Read EEPROM parameters.

Parameters:
qib7322QIB7322 device
Return values:
rcReturn status code

Definition at line 1940 of file qib7322.c.

References ib_guid::bytes, DBG_LOG, DBGC, DBGC2, qib7322::eeprom, qib7322::guid, guid, i2c_bit_basher::i2c, qib7322::i2c, IB_GUID_ARGS, IB_GUID_FMT, QIB7322_EEPROM_GUID_OFFSET, QIB7322_EEPROM_SERIAL_OFFSET, QIB7322_EEPROM_SERIAL_SIZE, rc, i2c_interface::read, serial, and strerror().

Referenced by qib7322_probe().

                                                           {
        struct i2c_interface *i2c = &qib7322->i2c.i2c;
        union ib_guid *guid = &qib7322->guid;
        int rc;

        /* Read GUID */
        if ( ( rc = i2c->read ( i2c, &qib7322->eeprom,
                                QIB7322_EEPROM_GUID_OFFSET, guid->bytes,
                                sizeof ( *guid ) ) ) != 0 ) {
                DBGC ( qib7322, "QIB7322 %p could not read GUID: %s\n",
                       qib7322, strerror ( rc ) );
                return rc;
        }
        DBGC2 ( qib7322, "QIB7322 %p has GUID " IB_GUID_FMT "\n",
                qib7322, IB_GUID_ARGS ( guid ) );

        /* Read serial number (debug only) */
        if ( DBG_LOG ) {
                uint8_t serial[QIB7322_EEPROM_SERIAL_SIZE + 1];

                serial[ sizeof ( serial ) - 1 ] = '\0';
                if ( ( rc = i2c->read ( i2c, &qib7322->eeprom,
                                        QIB7322_EEPROM_SERIAL_OFFSET, serial,
                                        ( sizeof ( serial ) - 1 ) ) ) != 0 ) {
                        DBGC ( qib7322, "QIB7322 %p could not read serial: "
                               "%s\n", qib7322, strerror ( rc ) );
                        return rc;
                }
                DBGC2 ( qib7322, "QIB7322 %p has serial number \"%s\"\n",
                        qib7322, serial );
        }

        return 0;
}
static int qib7322_ahb_wait ( struct qib7322 qib7322) [static]

Wait for AHB transaction to complete.

Parameters:
qib7322QIB7322 device
Return values:
rcReturn status code

Definition at line 1988 of file qib7322.c.

References BIT_GET, DBGC, ETIMEDOUT, QIB7322_AHB_MAX_WAIT_US, qib7322_readq, QIB_7322_ahb_transaction_reg_offset, and udelay().

Referenced by qib7322_ahb_read(), qib7322_ahb_request(), and qib7322_ahb_write().

                                                        {
        struct QIB_7322_ahb_transaction_reg transaction;
        unsigned int i;

        /* Wait for Ready bit to be asserted */
        for ( i = 0 ; i < QIB7322_AHB_MAX_WAIT_US ; i++ ) {
                qib7322_readq ( qib7322, &transaction,
                                QIB_7322_ahb_transaction_reg_offset );
                if ( BIT_GET ( &transaction, ahb_rdy ) )
                        return 0;
                udelay ( 1 );
        }

        DBGC ( qib7322, "QIB7322 %p timed out waiting for AHB transaction\n",
               qib7322 );
        return -ETIMEDOUT;
}
static int qib7322_ahb_request ( struct qib7322 qib7322,
unsigned int  location 
) [static]

Request ownership of the AHB.

Parameters:
qib7322QIB7322 device
locationAHB location
Return values:
rcReturn status code

Definition at line 2013 of file qib7322.c.

References BIT_FILL_2, DBGC, memset(), QIB7322_AHB_LOC_TARGET, qib7322_ahb_wait(), qib7322_writeq, QIB_7322_ahb_access_ctrl_offset, rc, and strerror().

Referenced by qib7322_ahb_mod_reg().

                                                         {
        struct QIB_7322_ahb_access_ctrl access;
        int rc;

        /* Request ownership */
        memset ( &access, 0, sizeof ( access ) );
        BIT_FILL_2 ( &access,
                     sw_ahb_sel, 1,
                     sw_sel_ahb_trgt, QIB7322_AHB_LOC_TARGET ( location ) );
        qib7322_writeq ( qib7322, &access, QIB_7322_ahb_access_ctrl_offset );

        /* Wait for ownership to be granted */
        if ( ( rc = qib7322_ahb_wait ( qib7322 ) ) != 0 )  {
                DBGC ( qib7322, "QIB7322 %p could not obtain AHB ownership: "
                       "%s\n", qib7322, strerror ( rc ) );
                return rc;
        }

        return 0;
}
static void qib7322_ahb_release ( struct qib7322 qib7322) [static]

Release ownership of the AHB.

Parameters:
qib7322QIB7322 device

Definition at line 2040 of file qib7322.c.

References memset(), qib7322_writeq, and QIB_7322_ahb_access_ctrl_offset.

Referenced by qib7322_ahb_mod_reg().

                                                            {
        struct QIB_7322_ahb_access_ctrl access;

        memset ( &access, 0, sizeof ( access ) );
        qib7322_writeq ( qib7322, &access, QIB_7322_ahb_access_ctrl_offset );
}
static int qib7322_ahb_read ( struct qib7322 qib7322,
unsigned int  location,
uint32_t data 
) [static]

Read data via AHB.

Parameters:
qib7322QIB7322 device
locationAHB location
dataData to read
Return values:
rcReturn status code

You must have already acquired ownership of the AHB.

Definition at line 2057 of file qib7322.c.

References BIT_FILL_2, BIT_GET, memset(), QIB7322_AHB_LOC_ADDRESS, qib7322_ahb_wait(), qib7322_readq, qib7322_writeq, QIB_7322_ahb_transaction_reg_offset, and rc.

Referenced by qib7322_ahb_mod_reg().

                                               {
        struct QIB_7322_ahb_transaction_reg xact;
        int rc;

        /* Avoid returning uninitialised data on error */
        *data = 0;

        /* Initiate transaction */
        memset ( &xact, 0, sizeof ( xact ) );
        BIT_FILL_2 ( &xact,
                     ahb_address, QIB7322_AHB_LOC_ADDRESS ( location ),
                     write_not_read, 0 );
        qib7322_writeq ( qib7322, &xact, QIB_7322_ahb_transaction_reg_offset );

        /* Wait for transaction to complete */
        if ( ( rc = qib7322_ahb_wait ( qib7322 ) ) != 0 )
                return rc;

        /* Read transaction data */
        qib7322_readq ( qib7322, &xact, QIB_7322_ahb_transaction_reg_offset );
        *data = BIT_GET ( &xact, ahb_data );
        return 0;
}
static int qib7322_ahb_write ( struct qib7322 qib7322,
unsigned int  location,
uint32_t  data 
) [static]

Write data via AHB.

Parameters:
qib7322QIB7322 device
locationAHB location
dataData to write
Return values:
rcReturn status code

You must have already acquired ownership of the AHB.

Definition at line 2092 of file qib7322.c.

References BIT_FILL_3, memset(), QIB7322_AHB_LOC_ADDRESS, qib7322_ahb_wait(), qib7322_writeq, QIB_7322_ahb_transaction_reg_offset, and rc.

Referenced by qib7322_ahb_mod_reg().

                                               {
        struct QIB_7322_ahb_transaction_reg xact;
        int rc;

        /* Initiate transaction */
        memset ( &xact, 0, sizeof ( xact ) );
        BIT_FILL_3 ( &xact,
                     ahb_address, QIB7322_AHB_LOC_ADDRESS ( location ),
                     write_not_read, 1,
                     ahb_data, data );
        qib7322_writeq ( qib7322, &xact, QIB_7322_ahb_transaction_reg_offset );

        /* Wait for transaction to complete */
        if ( ( rc = qib7322_ahb_wait ( qib7322 ) ) != 0 )
                return rc;

        return 0;
}
static int qib7322_ahb_mod_reg ( struct qib7322 qib7322,
unsigned int  location,
uint32_t  value,
uint32_t  mask 
) [static]

Read/modify/write AHB register.

Parameters:
qib7322QIB7322 device
locationAHB location
valueValue to set
maskMask to apply to old value
Return values:
rcReturn status code

Definition at line 2121 of file qib7322.c.

References assert, DBG_DISABLE, DBG_ENABLE, DBGCP, DBGLVL_IO, out, qib7322_ahb_read(), qib7322_ahb_release(), qib7322_ahb_request(), qib7322_ahb_write(), and rc.

Referenced by qib7322_ahb_mod_reg_all().

                                                                 {
        uint32_t old_value;
        uint32_t new_value;
        int rc;

        DBG_DISABLE ( DBGLVL_IO );

        /* Sanity check */
        assert ( ( value & mask ) == value );

        /* Acquire bus ownership */
        if ( ( rc = qib7322_ahb_request ( qib7322, location ) ) != 0 )
                goto out;

        /* Read existing value */
        if ( ( rc = qib7322_ahb_read ( qib7322, location, &old_value ) ) != 0 )
                goto out_release;

        /* Update value */
        new_value = ( ( old_value & ~mask ) | value );
        DBGCP ( qib7322, "QIB7322 %p AHB %x %#08x => %#08x\n",
                qib7322, location, old_value, new_value );
        if ( ( rc = qib7322_ahb_write ( qib7322, location, new_value ) ) != 0 )
                goto out_release;

 out_release:
        /* Release bus */
        qib7322_ahb_release ( qib7322 );
 out:
        DBG_ENABLE ( DBGLVL_IO );
        return rc;
}
static int qib7322_ahb_mod_reg_all ( struct qib7322 qib7322,
unsigned int  reg,
uint32_t  value,
uint32_t  mask 
) [static]

Read/modify/write AHB register across all ports and channels.

Parameters:
qib7322QIB7322 device
regAHB register
valueValue to set
maskMask to apply to old value
Return values:
rcReturn status code

Definition at line 2164 of file qib7322.c.

References channel, port, QIB7322_AHB_LOCATION, qib7322_ahb_mod_reg(), QIB7322_MAX_PORTS, QIB7322_MAX_WIDTH, and rc.

Referenced by qib7322_init_ib_serdes().

                                                                     {
        unsigned int port;
        unsigned int channel;
        unsigned int location;
        int rc;

        for ( port = 0 ; port < QIB7322_MAX_PORTS ; port++ ) {
                for ( channel = 0 ; channel < QIB7322_MAX_WIDTH ; channel++ ) {
                        location = QIB7322_AHB_LOCATION ( port, channel, reg );
                        if ( ( rc = qib7322_ahb_mod_reg ( qib7322, location,
                                                          value, mask ) ) != 0 )
                                return rc;
                }
        }
        return 0;
}
static int qib7322_init_ib_serdes ( struct qib7322 qib7322) [static]

Initialise the IB SerDes.

Parameters:
qib7322QIB7322 device
Return values:
rcReturn status code

Definition at line 2195 of file qib7322.c.

References BIT_FILL_5, BIT_SET, memset(), qib7322_ahb_mod_reg_all(), qib7322_readq, QIB7322_RECV_HEADER_SIZE, QIB7322_RECV_PAYLOAD_SIZE, qib7322_writeq, QIB_7322_IBCCtrlA_0_offset, QIB_7322_IBCCtrlA_1_offset, QIB_7322_IBCCtrlB_0_offset, QIB_7322_IBCCtrlB_1_offset, QIB_7322_IBPCSConfig_0_offset, and QIB_7322_IBPCSConfig_1_offset.

Referenced by qib7322_probe().

                                                              {
        struct QIB_7322_IBCCtrlA_0 ibcctrla;
        struct QIB_7322_IBCCtrlB_0 ibcctrlb;
        struct QIB_7322_IBPCSConfig_0 ibpcsconfig;

        /* Configure sensible defaults for IBC */
        memset ( &ibcctrla, 0, sizeof ( ibcctrla ) );
        BIT_FILL_5 ( &ibcctrla, /* Tuning values taken from Linux driver */
                     FlowCtrlPeriod, 0x03,
                     FlowCtrlWaterMark, 0x05,
                     MaxPktLen, ( ( QIB7322_RECV_HEADER_SIZE +
                                    QIB7322_RECV_PAYLOAD_SIZE +
                                    4 /* ICRC */ ) >> 2 ),
                     PhyerrThreshold, 0xf,
                     OverrunThreshold, 0xf );
        qib7322_writeq ( qib7322, &ibcctrla, QIB_7322_IBCCtrlA_0_offset );
        qib7322_writeq ( qib7322, &ibcctrla, QIB_7322_IBCCtrlA_1_offset );

        /* Force SDR only to avoid needing all the DDR tuning,
         * Mellanox compatibility hacks etc.  SDR is plenty for
         * boot-time operation.
         */
        qib7322_readq ( qib7322, &ibcctrlb, QIB_7322_IBCCtrlB_0_offset );
        BIT_SET ( &ibcctrlb, IB_ENHANCED_MODE, 0 );
        BIT_SET ( &ibcctrlb, SD_SPEED_SDR, 1 );
        BIT_SET ( &ibcctrlb, SD_SPEED_DDR, 0 );
        BIT_SET ( &ibcctrlb, SD_SPEED_QDR, 0 );
        BIT_SET ( &ibcctrlb, IB_NUM_CHANNELS, 1 ); /* 4X only */
        BIT_SET ( &ibcctrlb, IB_LANE_REV_SUPPORTED, 0 );
        BIT_SET ( &ibcctrlb, HRTBT_ENB, 0 );
        BIT_SET ( &ibcctrlb, HRTBT_AUTO, 0 );
        qib7322_writeq ( qib7322, &ibcctrlb, QIB_7322_IBCCtrlB_0_offset );
        qib7322_writeq ( qib7322, &ibcctrlb, QIB_7322_IBCCtrlB_1_offset );

        /* Tune SerDes */
        qib7322_ahb_mod_reg_all ( qib7322, 2, 0, 0x00000e00UL );

        /* Bring XGXS out of reset */
        memset ( &ibpcsconfig, 0, sizeof ( ibpcsconfig ) );
        qib7322_writeq ( qib7322, &ibpcsconfig, QIB_7322_IBPCSConfig_0_offset );
        qib7322_writeq ( qib7322, &ibpcsconfig, QIB_7322_IBPCSConfig_1_offset );

        return 0;
}
static void qib7322_reset ( struct qib7322 qib7322,
struct pci_device pci 
) [static]

Reset QIB7322.

Parameters:
qib7322QIB7322 device
pciPCI device
Return values:
rcReturn status code

Definition at line 2254 of file qib7322.c.

References BIT_FILL_1, mdelay(), memset(), NULL, pci_backup(), pci_restore(), qib7322_writeq, and QIB_7322_Control_offset.

Referenced by qib7322_probe().

                                                                              {
        struct QIB_7322_Control control;
        struct pci_config_backup backup;

        /* Back up PCI configuration space */
        pci_backup ( pci, &backup, NULL );

        /* Assert reset */
        memset ( &control, 0, sizeof ( control ) );
        BIT_FILL_1 ( &control, SyncReset, 1 );
        qib7322_writeq ( qib7322, &control, QIB_7322_Control_offset );

        /* Wait for reset to complete */
        mdelay ( 1000 );

        /* Restore PCI configuration space */
        pci_restore ( pci, &backup, NULL );
}
static int qib7322_probe ( struct pci_device pci) [static]

Probe PCI device.

Parameters:
pciPCI device
idPCI ID
Return values:
rcReturn status code

Definition at line 2280 of file qib7322.c.

References adjust_pci_device(), alloc_ibdev(), assert, BIT_GET, ib_guid::bytes, DBGC, DBGC2, pci_device::dev, ib_device::dev, ENOMEM, free, ib_device::gid, ib_gid::guid, qib7322::guid, IB_LINK_SPEED_SDR, IB_LINK_WIDTH_4X, ib_set_drvdata(), qib7322::ibdev, ibdev_put(), ioremap(), iounmap(), ib_device::link_speed_enabled, ib_device::link_speed_supported, ib_device::link_width_enabled, ib_device::link_width_supported, pci_device::membase, memcpy(), ib_device::node_guid, ib_device::op, pci_set_drvdata(), ib_device::port, QIB7322_BAR0_SIZE, qib7322_fini_recv(), qib7322_fini_send(), qib7322_ib_operations, qib7322_init_i2c(), qib7322_init_ib_serdes(), qib7322_init_recv(), qib7322_init_send(), qib7322_link_speed_supported(), QIB7322_MAX_PORTS, QIB7322_PORT_BASE, qib7322_read_eeprom(), qib7322_readq, qib7322_reset(), QIB_7322_Revision_offset, rc, register_ibdev(), qib7322::regs, ib_gid::s, strerror(), unregister_ibdev(), and zalloc().

                                                    {
        struct qib7322 *qib7322;
        struct QIB_7322_Revision revision;
        struct ib_device *ibdev;
        unsigned int link_speed_supported;
        int i;
        int rc;

        /* Allocate QIB7322 device */
        qib7322 = zalloc ( sizeof ( *qib7322 ) );
        if ( ! qib7322 ) {
                rc = -ENOMEM;
                goto err_alloc_qib7322;
        }
        pci_set_drvdata ( pci, qib7322 );

        /* Fix up PCI device */
        adjust_pci_device ( pci );

        /* Map PCI BARs */
        qib7322->regs = ioremap ( pci->membase, QIB7322_BAR0_SIZE );
        DBGC2 ( qib7322, "QIB7322 %p has BAR at %08lx\n",
                qib7322, pci->membase );

        /* Reset device */
        qib7322_reset ( qib7322, pci );

        /* Print some general data */
        qib7322_readq ( qib7322, &revision, QIB_7322_Revision_offset );
        DBGC2 ( qib7322, "QIB7322 %p board %02lx v%ld.%ld.%ld.%ld\n", qib7322,
                BIT_GET ( &revision, BoardID ),
                BIT_GET ( &revision, R_SW ),
                BIT_GET ( &revision, R_Arch ),
                BIT_GET ( &revision, R_ChipRevMajor ),
                BIT_GET ( &revision, R_ChipRevMinor ) );

        /* Initialise I2C subsystem */
        if ( ( rc = qib7322_init_i2c ( qib7322 ) ) != 0 )
                goto err_init_i2c;

        /* Read EEPROM parameters */
        if ( ( rc = qib7322_read_eeprom ( qib7322 ) ) != 0 )
                goto err_read_eeprom;

        /* Initialise send datapath */
        if ( ( rc = qib7322_init_send ( qib7322 ) ) != 0 )
                goto err_init_send;

        /* Initialise receive datapath */
        if ( ( rc = qib7322_init_recv ( qib7322 ) ) != 0 )
                goto err_init_recv;

        /* Initialise the IB SerDes */
        if ( ( rc = qib7322_init_ib_serdes ( qib7322 ) ) != 0 )
                goto err_init_ib_serdes;

        /* Allocate Infiniband devices */
        for ( i = 0 ; i < QIB7322_MAX_PORTS ; i++ ) {
                link_speed_supported =
                        qib7322_link_speed_supported ( qib7322, i );
                if ( ! link_speed_supported )
                        continue;
                ibdev = alloc_ibdev ( 0 );
                if ( ! ibdev ) {
                        rc = -ENOMEM;
                        goto err_alloc_ibdev;
                }
                qib7322->ibdev[i] = ibdev;
                ibdev->dev = &pci->dev;
                ibdev->op = &qib7322_ib_operations;
                ibdev->port = ( QIB7322_PORT_BASE + i );
                ibdev->link_width_enabled = ibdev->link_width_supported =
                        IB_LINK_WIDTH_4X; /* 1x does not work */
                ibdev->link_speed_enabled = ibdev->link_speed_supported =
                        IB_LINK_SPEED_SDR; /* to avoid need for link tuning */
                memcpy ( &ibdev->node_guid, &qib7322->guid,
                         sizeof ( ibdev->node_guid ) );
                memcpy ( &ibdev->gid.s.guid, &qib7322->guid,
                         sizeof ( ibdev->gid.s.guid ) );
                assert ( ( ibdev->gid.s.guid.bytes[7] & i ) == 0 );
                ibdev->gid.s.guid.bytes[7] |= i;
                ib_set_drvdata ( ibdev, qib7322 );
        }

        /* Register Infiniband devices */
        for ( i = 0 ; i < QIB7322_MAX_PORTS ; i++ ) {
                if ( ! qib7322->ibdev[i] )
                        continue;
                if ( ( rc = register_ibdev ( qib7322->ibdev[i] ) ) != 0 ) {
                        DBGC ( qib7322, "QIB7322 %p port %d could not register "
                               "IB device: %s\n", qib7322, i, strerror ( rc ) );
                        goto err_register_ibdev;
                }
        }

        return 0;

        i = QIB7322_MAX_PORTS;
 err_register_ibdev:
        for ( i-- ; i >= 0 ; i-- ) {
                if ( qib7322->ibdev[i] )
                        unregister_ibdev ( qib7322->ibdev[i] );
        }
        i = QIB7322_MAX_PORTS;
 err_alloc_ibdev:
        for ( i-- ; i >= 0 ; i-- )
                ibdev_put ( qib7322->ibdev[i] );
 err_init_ib_serdes:
        qib7322_fini_send ( qib7322 );
 err_init_send:
        qib7322_fini_recv ( qib7322 );
 err_init_recv:
 err_read_eeprom:
 err_init_i2c:
        iounmap ( qib7322->regs );
        free ( qib7322 );
 err_alloc_qib7322:
        return rc;
}
static void qib7322_remove ( struct pci_device pci) [static]

Remove PCI device.

Parameters:
pciPCI device

Definition at line 2405 of file qib7322.c.

References free, qib7322::ibdev, ibdev_put(), iounmap(), pci_get_drvdata(), qib7322_fini_recv(), qib7322_fini_send(), QIB7322_MAX_PORTS, qib7322::regs, and unregister_ibdev().

                                                      {
        struct qib7322 *qib7322 = pci_get_drvdata ( pci );
        int i;

        for ( i = ( QIB7322_MAX_PORTS - 1 ) ; i >= 0 ; i-- ) {
                if ( qib7322->ibdev[i] )
                        unregister_ibdev ( qib7322->ibdev[i] );
        }
        for ( i = ( QIB7322_MAX_PORTS - 1 ) ; i >= 0 ; i-- )
                ibdev_put ( qib7322->ibdev[i] );
        qib7322_fini_send ( qib7322 );
        qib7322_fini_recv ( qib7322 );
        iounmap ( qib7322->regs );
        free ( qib7322 );
}

Variable Documentation

Initial value:
 {
        .create_cq      = qib7322_create_cq,
        .destroy_cq     = qib7322_destroy_cq,
        .create_qp      = qib7322_create_qp,
        .modify_qp      = qib7322_modify_qp,
        .destroy_qp     = qib7322_destroy_qp,
        .post_send      = qib7322_post_send,
        .post_recv      = qib7322_post_recv,
        .poll_cq        = qib7322_poll_cq,
        .poll_eq        = qib7322_poll_eq,
        .open           = qib7322_open,
        .close          = qib7322_close,
        .mcast_attach   = qib7322_mcast_attach,
        .mcast_detach   = qib7322_mcast_detach,
        .set_port_info  = qib7322_set_port_info,
        .set_pkey_table = qib7322_set_pkey_table,
}

QIB7322 Infiniband operations.

Definition at line 1793 of file qib7322.c.

Referenced by qib7322_probe().

unsigned int qib7322_i2c_bits[] [static]
Initial value:
 {
        [I2C_BIT_SCL] = ( 1 << QIB7322_GPIO_SCL ),
        [I2C_BIT_SDA] = ( 1 << QIB7322_GPIO_SDA ),
}

QIB7322 I2C bit to GPIO mappings.

Definition at line 1819 of file qib7322.c.

Referenced by qib7322_i2c_read_bit(), and qib7322_i2c_write_bit().

Initial value:

QIB7322 I2C bit-bashing interface operations.

Definition at line 1894 of file qib7322.c.

struct pci_device_id qib7322_nics[] [static]
Initial value:
 {
        PCI_ROM ( 0x1077, 0x7322, "iba7322", "IBA7322 QDR InfiniBand HCA", 0 ),
}

Definition at line 2421 of file qib7322.c.

struct pci_driver qib7322_driver __pci_driver
Initial value:
 {
        .ids = qib7322_nics,
        .id_count = ( sizeof ( qib7322_nics ) / sizeof ( qib7322_nics[0] ) ),
        .probe = qib7322_probe,
        .remove = qib7322_remove,
}

Definition at line 2425 of file qib7322.c.