iPXE
Data Structures | Macros | 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...
 

Macros

#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. More...
 

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

Variables

struct qib7322_send_buffers __attribute__
 
static struct ib_device_operations qib7322_ib_operations
 QIB7322 Infiniband operations. More...
 
static unsigned int qib7322_i2c_bits []
 QIB7322 I2C bit to GPIO mappings. More...
 
static struct bit_basher_operations qib7322_i2c_basher_ops
 QIB7322 I2C bit-bashing interface operations. More...
 
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.

Macro Definition Documentation

◆ qib7322_readq

#define qib7322_readq (   _qib7322,
  _ptr,
  _offset 
)    qib7322_readq ( (_qib7322), (_ptr)->u.qwords, (_offset) )

Definition at line 153 of file qib7322.c.

◆ qib7322_readq_array8b

#define qib7322_readq_array8b (   _qib7322,
  _ptr,
  _offset,
  _idx 
)    qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )

Definition at line 155 of file qib7322.c.

◆ qib7322_readq_array64k

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

Definition at line 157 of file qib7322.c.

◆ qib7322_readq_port

#define qib7322_readq_port (   _qib7322,
  _ptr,
  _offset,
  _port 
)    qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_port) * 4096 ) ) )

Definition at line 159 of file qib7322.c.

◆ qib7322_writeq

#define qib7322_writeq (   _qib7322,
  _ptr,
  _offset 
)    qib7322_writeq ( (_qib7322), (_ptr)->u.qwords, (_offset) )

Definition at line 173 of file qib7322.c.

◆ qib7322_writeq_array8b

#define qib7322_writeq_array8b (   _qib7322,
  _ptr,
  _offset,
  _idx 
)    qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )

Definition at line 175 of file qib7322.c.

◆ qib7322_writeq_array64k

#define qib7322_writeq_array64k (   _qib7322,
  _ptr,
  _offset,
  _idx 
)    qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 65536 ) ))

Definition at line 177 of file qib7322.c.

◆ qib7322_writeq_port

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

Definition at line 179 of file qib7322.c.

◆ QIB7322_SEND_BUF_TOGGLE

#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.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ qib7322_readq()

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.

150  {
151  *qword = readq ( qib7322->regs + offset );
152 }
uint64_t readq(volatile uint64_t *io_addr)
Read 64-bit qword from memory-mapped device.
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
A QIB7322 HCA.
Definition: qib7322.c:100
void * regs
Registers.
Definition: qib7322.c:102

References offset, readq(), and qib7322::regs.

◆ qib7322_writeq()

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.

170  {
171  writeq ( *qword, ( qib7322->regs + offset ) );
172 }
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
A QIB7322 HCA.
Definition: qib7322.c:100
void * regs
Registers.
Definition: qib7322.c:102
void writeq(uint64_t data, volatile uint64_t *io_addr)
Write 64-bit qword to memory-mapped device.

References offset, qib7322::regs, and writeq().

◆ qib7322_writel()

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.

190  {
191  writel ( dword, ( qib7322->regs + offset ) );
192 }
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
A QIB7322 HCA.
Definition: qib7322.c:100
void * regs
Registers.
Definition: qib7322.c:102
unsigned long int dword
Definition: smc9000.h:40

References offset, qib7322::regs, and writel().

Referenced by qib7322_post_send().

◆ qib7322_link_state_text()

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.

207  {
208  switch ( link_state ) {
209  case QIB7322_LINK_STATE_DOWN: return "DOWN";
210  case QIB7322_LINK_STATE_INIT: return "INIT";
211  case QIB7322_LINK_STATE_ARM: return "ARM";
212  case QIB7322_LINK_STATE_ACTIVE: return "ACTIVE";
213  case QIB7322_LINK_STATE_ACT_DEFER: return "ACT_DEFER";
214  default: return "UNKNOWN";
215  }
216 }

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

◆ qib7322_link_state_changed()

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.

223  {
224  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
225  struct QIB_7322_IBCStatusA_0 ibcstatusa;
226  struct QIB_7322_EXTCtrl extctrl;
227  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
228  unsigned int link_training_state;
229  unsigned int link_state;
230  unsigned int link_width;
231  unsigned int link_speed;
232  unsigned int link_speed_qdr;
233  unsigned int green;
234  unsigned int yellow;
235 
236  /* Read link state */
237  qib7322_readq_port ( qib7322, &ibcstatusa,
239  link_training_state = BIT_GET ( &ibcstatusa, LinkTrainingState );
240  link_state = BIT_GET ( &ibcstatusa, LinkState );
241  link_width = BIT_GET ( &ibcstatusa, LinkWidthActive );
242  link_speed = BIT_GET ( &ibcstatusa, LinkSpeedActive );
243  link_speed_qdr = BIT_GET ( &ibcstatusa, LinkSpeedQDR );
244  DBGC ( qib7322, "QIB7322 %p port %d training state %#x link state %s "
245  "(%s %s)\n", qib7322, port, link_training_state,
246  qib7322_link_state_text ( link_state ),
247  ( link_speed_qdr ? "QDR" : ( link_speed ? "DDR" : "SDR" ) ),
248  ( link_width ? "x4" : "x1" ) );
249 
250  /* Set LEDs according to link state */
252  green = ( ( link_state >= QIB7322_LINK_STATE_INIT ) ? 1 : 0 );
253  yellow = ( ( link_state >= QIB7322_LINK_STATE_ACTIVE ) ? 1 : 0 );
254  if ( port == 0 ) {
255  BIT_SET ( &extctrl, LEDPort0GreenOn, green );
256  BIT_SET ( &extctrl, LEDPort0YellowOn, yellow );
257  } else {
258  BIT_SET ( &extctrl, LEDPort1GreenOn, green );
259  BIT_SET ( &extctrl, LEDPort1YellowOn, yellow );
260  }
262 
263  /* Notify Infiniband core of link state change */
264  ibdev->port_state = ( link_state + 1 );
265  ibdev->link_width_active =
266  ( link_width ? IB_LINK_WIDTH_4X : IB_LINK_WIDTH_1X );
267  ibdev->link_speed_active =
268  ( link_speed ? IB_LINK_SPEED_DDR : IB_LINK_SPEED_SDR );
269  ib_link_state_changed ( ibdev );
270 }
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define DBGC(...)
Definition: compiler.h:505
#define IB_LINK_SPEED_SDR
Definition: ib_mad.h:144
#define BIT_SET(_ptr, _field, _value)
Definition: pseudobit.h:238
void ib_link_state_changed(struct ib_device *ibdev)
Notify of Infiniband link state change.
Definition: infiniband.c:637
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
#define IB_LINK_WIDTH_4X
Definition: ib_mad.h:140
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
unsigned int port
Port number.
Definition: infiniband.h:418
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:159
uint8_t link_width_active
Link width active.
Definition: infiniband.h:429
#define QIB_7322_EXTCtrl_offset
A QIB7322 HCA.
Definition: qib7322.c:100
#define IB_LINK_WIDTH_1X
Definition: ib_mad.h:139
uint8_t link_speed_active
Link speed active.
Definition: infiniband.h:435
static const char * qib7322_link_state_text(unsigned int link_state)
Textual representation of link state.
Definition: qib7322.c:207
#define QIB_7322_IBCStatusA_0_offset
#define IB_LINK_SPEED_DDR
Definition: ib_mad.h:145
uint8_t port_state
Port state.
Definition: infiniband.h:423

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, qib7322::ibdev, ib_device::link_speed_active, ib_device::link_width_active, port, ib_device::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().

◆ qib7322_link_state_check()

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.

280  {
281  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
282  struct QIB_7322_IBCStatusA_0 ibcstatusa;
283  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
284  unsigned int link_state;
285  unsigned int i;
286 
287  for ( i = 0 ; i < QIB7322_LINK_STATE_MAX_WAIT_US ; i++ ) {
288  qib7322_readq_port ( qib7322, &ibcstatusa,
290  link_state = BIT_GET ( &ibcstatusa, LinkState );
291  if ( link_state == new_link_state )
292  return 0;
293  udelay ( 1 );
294  }
295 
296  DBGC ( qib7322, "QIB7322 %p port %d timed out waiting for link state "
297  "%s\n", qib7322, port, qib7322_link_state_text ( link_state ) );
298  return -ETIMEDOUT;
299 }
#define DBGC(...)
Definition: compiler.h:505
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
unsigned int port
Port number.
Definition: infiniband.h:418
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:159
A QIB7322 HCA.
Definition: qib7322.c:100
static const char * qib7322_link_state_text(unsigned int link_state)
Textual representation of link state.
Definition: qib7322.c:207
#define QIB_7322_IBCStatusA_0_offset
#define ETIMEDOUT
Connection timed out.
Definition: errno.h:669
#define QIB7322_LINK_STATE_MAX_WAIT_US
Maximum time to wait for link state changes, in us.
Definition: qib7322.h:367

References BIT_GET, DBGC, ETIMEDOUT, ib_get_drvdata(), qib7322::ibdev, port, ib_device::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().

◆ qib7322_set_port_info()

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.

308  {
309  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
311  struct QIB_7322_IBCCtrlA_0 ibcctrla;
312  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
313  unsigned int port_state;
314  unsigned int link_state;
315 
316  /* Set new link state */
318  if ( port_state ) {
319  link_state = ( port_state - 1 );
320  DBGC ( qib7322, "QIB7322 %p set link state to %s (%x)\n",
321  qib7322, qib7322_link_state_text ( link_state ),
322  link_state );
323  qib7322_readq_port ( qib7322, &ibcctrla,
325  BIT_SET ( &ibcctrla, LinkCmd, link_state );
326  qib7322_writeq_port ( qib7322, &ibcctrla,
328 
329  /* Wait for link state change to take effect. Ignore
330  * errors; the current link state will be returned via
331  * the GetResponse MAD.
332  */
333  qib7322_link_state_check ( ibdev, link_state );
334  }
335 
336  /* Detect and report link state change */
337  qib7322_link_state_changed ( ibdev );
338 
339  return 0;
340 }
#define qib7322_writeq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:179
#define DBGC(...)
Definition: compiler.h:505
union ib_smp_data smp_data
Definition: ib_mad.h:590
#define BIT_SET(_ptr, _field, _value)
Definition: pseudobit.h:238
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
#define QIB_7322_IBCCtrlA_0_offset
struct ib_port_info port_info
Definition: ib_mad.h:14
struct ib_port_info port_info
Definition: ib_mad.h:184
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
uint8_t link_speed_supported__port_state
Definition: ib_mad.h:116
unsigned int port
Port number.
Definition: infiniband.h:418
struct ib_mad_smp smp
Definition: ib_mad.h:612
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
u8 port_state
Definition: CIB_PRM.h:38
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:159
A QIB7322 HCA.
Definition: qib7322.c:100
static int qib7322_link_state_check(struct ib_device *ibdev, unsigned int new_link_state)
Wait for link state change to take effect.
Definition: qib7322.c:279
static const char * qib7322_link_state_text(unsigned int link_state)
Textual representation of link state.
Definition: qib7322.c:207
static void qib7322_link_state_changed(struct ib_device *ibdev)
Handle link state change.
Definition: qib7322.c:223
A Port Information attribute.
Definition: ib_mad.h:104
union ib_mad mad
Definition: arbel.h:12

References BIT_SET, DBGC, ib_get_drvdata(), qib7322::ibdev, ib_port_info::link_speed_supported__port_state, mad, port, ib_device::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.

◆ qib7322_set_pkey_table()

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.

349  {
350  /* Nothing to do */
351  return 0;
352 }

◆ qib7322_alloc_ctx()

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.

369  {
370  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
371  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
372  unsigned int ctx;
373 
374  for ( ctx = port ; ctx < QIB7322_NUM_CONTEXTS ; ctx += 2 ) {
375 
376  if ( ! qib7322->used_ctx[ctx] ) {
377  qib7322->used_ctx[ctx] = 1;
378  qp->qpn = ( ctx & ~0x01 );
379  DBGC2 ( qib7322, "QIB7322 %p port %d QPN %ld is CTX "
380  "%d\n", qib7322, port, qp->qpn, ctx );
381  return 0;
382  }
383  }
384 
385  DBGC ( qib7322, "QIB7322 %p port %d out of available contexts\n",
386  qib7322, port );
387  return -ENOENT;
388 }
uint8_t used_ctx[QIB7322_NUM_CONTEXTS]
In-use contexts.
Definition: qib7322.c:105
#define DBGC(...)
Definition: compiler.h:505
#define ENOENT
No such file or directory.
Definition: errno.h:514
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
#define QIB7322_NUM_CONTEXTS
Number of contexts (including kernel context)
Definition: qib7322.h:252
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
unsigned int port
Port number.
Definition: infiniband.h:418
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
#define DBGC2(...)
Definition: compiler.h:522

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

Referenced by qib7322_create_qp().

◆ qib7322_ctx()

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.

398  {
399  return ( qp->qpn + ( ibdev->port - QIB7322_PORT_BASE ) );
400 }
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
unsigned int port
Port number.
Definition: infiniband.h:418
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
struct arbelprm_qp_db_record qp
Definition: arbel.h:13

References qib7322::ibdev, ib_device::port, QIB7322_PORT_BASE, and qp.

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

◆ qib7322_free_ctx()

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.

409  {
410  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
411  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
412  unsigned int ctx = qib7322_ctx ( ibdev, qp );
413 
414  qib7322->used_ctx[ctx] = 0;
415  DBGC2 ( qib7322, "QIB7322 %p port %d CTX %d freed\n",
416  qib7322, port, ctx );
417 }
uint8_t used_ctx[QIB7322_NUM_CONTEXTS]
In-use contexts.
Definition: qib7322.c:105
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
unsigned int port
Port number.
Definition: infiniband.h:418
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
static unsigned int qib7322_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Get queue pair context number.
Definition: qib7322.c:397
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
#define DBGC2(...)
Definition: compiler.h:522

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

Referenced by qib7322_create_qp(), and qib7322_destroy_qp().

◆ qib7322_create_send_bufs()

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

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.

447  {
448  struct qib7322_send_buffers *send_bufs;
449  unsigned int i;
450 
451  /* Allocate send buffer set */
452  send_bufs = zalloc ( sizeof ( *send_bufs ) +
453  ( count * sizeof ( send_bufs->avail[0] ) ) );
454  if ( ! send_bufs )
455  return NULL;
456 
457  /* Populate send buffer set */
458  send_bufs->base = base;
459  send_bufs->size = size;
460  send_bufs->start = start;
461  send_bufs->count = count;
462  for ( i = 0 ; i < count ; i++ )
463  send_bufs->avail[i] = ( start + i );
464 
465  DBGC2 ( qib7322, "QIB7322 %p send buffer set %p [%d,%d] at %lx\n",
466  qib7322, send_bufs, start, ( start + count - 1 ),
467  send_bufs->base );
468 
469  return send_bufs;
470 }
unsigned int start
Index of first send buffer.
Definition: qib7322.c:55
unsigned int size
Send buffer size.
Definition: qib7322.c:53
unsigned long base
Offset within register space of the first send buffer.
Definition: qib7322.c:51
A QIB7322 send buffer set.
Definition: qib7322.c:49
uint32_t start
Starting offset.
Definition: netvsc.h:12
unsigned int count
Number of send buffers.
Definition: qib7322.c:60
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
uint16_t base
Base address.
Definition: edd.h:14
uint16_t avail[0]
Send buffer availability.
Definition: qib7322.c:66
A QIB7322 HCA.
Definition: qib7322.c:100
#define DBGC2(...)
Definition: compiler.h:522
uint16_t count
Number of entries.
Definition: ena.h:22
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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

Referenced by qib7322_init_send().

◆ qib7322_destroy_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.

480  {
481  free ( send_bufs );
482 }
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54

References free.

Referenced by qib7322_fini_send(), and qib7322_init_send().

◆ qib7322_alloc_send_buf()

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.

492  {
493  unsigned int used;
494  unsigned int mask;
495  unsigned int send_buf;
496 
497  used = ( send_bufs->cons - send_bufs->prod );
498  if ( used >= send_bufs->count ) {
499  DBGC ( qib7322, "QIB7322 %p send buffer set %p out of "
500  "buffers\n", qib7322, send_bufs );
501  return -ENOBUFS;
502  }
503 
504  mask = ( send_bufs->count - 1 );
505  send_buf = send_bufs->avail[ send_bufs->cons++ & mask ];
506  send_buf ^= QIB7322_SEND_BUF_TOGGLE;
507  return send_buf;
508 }
#define DBGC(...)
Definition: compiler.h:505
unsigned int prod
Send buffer availability producer counter.
Definition: qib7322.c:62
unsigned int count
Number of send buffers.
Definition: qib7322.c:60
#define QIB7322_SEND_BUF_TOGGLE
Send buffer toggle bit.
Definition: qib7322.c:432
unsigned int cons
Send buffer availability consumer counter.
Definition: qib7322.c:64
uint16_t avail[0]
Send buffer availability.
Definition: qib7322.c:66
A QIB7322 HCA.
Definition: qib7322.c:100
#define ENOBUFS
No buffer space available.
Definition: errno.h:498

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

◆ qib7322_free_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.

519  {
520  unsigned int mask;
521 
522  mask = ( send_bufs->count - 1 );
523  send_bufs->avail[ send_bufs->prod++ & mask ] = send_buf;
524 }
unsigned int prod
Send buffer availability producer counter.
Definition: qib7322.c:62
unsigned int count
Number of send buffers.
Definition: qib7322.c:60
uint16_t avail[0]
Send buffer availability.
Definition: qib7322.c:66

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

Referenced by qib7322_complete_send().

◆ qib7322_send_buf_in_use()

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.

534  {
535  unsigned int send_idx;
536  unsigned int send_check;
537  unsigned int inusecheck;
538  unsigned int inuse;
539  unsigned int check;
540 
541  send_idx = ( send_buf & ~QIB7322_SEND_BUF_TOGGLE );
542  send_check = ( !! ( send_buf & QIB7322_SEND_BUF_TOGGLE ) );
543  inusecheck = BIT_GET ( qib7322->sendbufavail, InUseCheck[send_idx] );
544  inuse = ( !! ( inusecheck & 0x02 ) );
545  check = ( !! ( inusecheck & 0x01 ) );
546  return ( inuse || ( check != send_check ) );
547 }
#define QIB7322_SEND_BUF_TOGGLE
Send buffer toggle bit.
Definition: qib7322.c:432
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
struct QIB_7322_SendBufAvail * sendbufavail
Send buffer availability (reported by hardware)
Definition: qib7322.c:112
A QIB7322 HCA.
Definition: qib7322.c:100

References BIT_GET, QIB7322_SEND_BUF_TOGGLE, and qib7322::sendbufavail.

Referenced by qib7322_poll_send_wq().

◆ qib7322_send_buffer_offset()

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.

559  {
560  unsigned int index;
561 
562  index = ( ( send_buf & ~QIB7322_SEND_BUF_TOGGLE ) - send_bufs->start );
563  return ( send_bufs->base + ( index * send_bufs->size ) );
564 }
unsigned int start
Index of first send buffer.
Definition: qib7322.c:55
unsigned int size
Send buffer size.
Definition: qib7322.c:53
unsigned long base
Offset within register space of the first send buffer.
Definition: qib7322.c:51
#define QIB7322_SEND_BUF_TOGGLE
Send buffer toggle bit.
Definition: qib7322.c:432
uint64_t index
Index of the first segment within the content.
Definition: pccrc.h:21

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

Referenced by qib7322_post_send().

◆ qib7322_create_send_wq()

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.

573  {
574  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
575  struct ib_work_queue *wq = &qp->send;
576  struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
577  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
578 
579  /* Select send buffer set */
580  if ( qp->type == IB_QPT_SMI ) {
581  if ( port == 0 ) {
582  qib7322_wq->send_bufs = qib7322->send_bufs_vl15_port0;
583  } else {
584  qib7322_wq->send_bufs = qib7322->send_bufs_vl15_port1;
585  }
586  } else {
587  qib7322_wq->send_bufs = qib7322->send_bufs_small;
588  }
589 
590  /* Allocate space for send buffer usage list */
591  qib7322_wq->used = zalloc ( qp->send.num_wqes *
592  sizeof ( qib7322_wq->used[0] ) );
593  if ( ! qib7322_wq->used )
594  return -ENOMEM;
595 
596  /* Reset work queue */
597  qib7322_wq->prod = 0;
598  qib7322_wq->cons = 0;
599 
600  return 0;
601 }
uint16_t * used
Send buffer usage.
Definition: qib7322.c:74
A QIB7322 send work queue.
Definition: qib7322.c:70
struct qib7322_send_buffers * send_bufs
Send buffer set.
Definition: qib7322.c:72
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
unsigned int prod
Producer index.
Definition: qib7322.c:76
#define ENOMEM
Not enough space.
Definition: errno.h:534
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
An Infiniband Work Queue.
Definition: infiniband.h:100
unsigned int port
Port number.
Definition: infiniband.h:418
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
struct qib7322_send_buffers * send_bufs_vl15_port0
VL15 port 0 send buffers.
Definition: qib7322.c:116
struct qib7322_send_buffers * send_bufs_small
Small send buffers.
Definition: qib7322.c:114
struct qib7322_send_buffers * send_bufs_vl15_port1
VL15 port 1 send buffers.
Definition: qib7322.c:118
unsigned int cons
Consumer index.
Definition: qib7322.c:78

References qib7322_send_work_queue::cons, ENOMEM, ib_get_drvdata(), IB_QPT_SMI, ib_wq_get_drvdata(), qib7322::ibdev, port, ib_device::port, qib7322_send_work_queue::prod, QIB7322_PORT_BASE, qp, qib7322_send_work_queue::send_bufs, qib7322::send_bufs_small, qib7322::send_bufs_vl15_port0, qib7322::send_bufs_vl15_port1, qib7322_send_work_queue::used, and zalloc().

Referenced by qib7322_create_qp().

◆ qib7322_destroy_send_wq()

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.

610  {
611  struct ib_work_queue *wq = &qp->send;
612  struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
613 
614  free ( qib7322_wq->used );
615 }
uint16_t * used
Send buffer usage.
Definition: qib7322.c:74
A QIB7322 send work queue.
Definition: qib7322.c:70
An Infiniband Work Queue.
Definition: infiniband.h:100
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
struct arbelprm_qp_db_record qp
Definition: arbel.h:13

References free, ib_wq_get_drvdata(), qp, and qib7322_send_work_queue::used.

Referenced by qib7322_create_qp(), and qib7322_destroy_qp().

◆ qib7322_init_send()

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.

623  {
624  struct QIB_7322_SendBufBase sendbufbase;
625  struct QIB_7322_SendBufAvailAddr sendbufavailaddr;
626  struct QIB_7322_SendCtrl sendctrl;
627  struct QIB_7322_SendCtrl_0 sendctrlp;
628  unsigned long baseaddr_smallpio;
629  unsigned long baseaddr_largepio;
630  unsigned long baseaddr_vl15_port0;
631  unsigned long baseaddr_vl15_port1;
632  int rc;
633 
634  /* Create send buffer sets */
636  baseaddr_smallpio = BIT_GET ( &sendbufbase, BaseAddr_SmallPIO );
637  baseaddr_largepio = BIT_GET ( &sendbufbase, BaseAddr_LargePIO );
638  baseaddr_vl15_port0 = ( baseaddr_largepio +
641  baseaddr_vl15_port1 = ( baseaddr_vl15_port0 +
644  qib7322_create_send_bufs ( qib7322, baseaddr_smallpio,
648  if ( ! qib7322->send_bufs_small ) {
649  rc = -ENOMEM;
650  goto err_create_send_bufs_small;
651  }
653  qib7322_create_send_bufs ( qib7322, baseaddr_vl15_port0,
657  if ( ! qib7322->send_bufs_vl15_port0 ) {
658  rc = -ENOMEM;
659  goto err_create_send_bufs_vl15_port0;
660  }
662  qib7322_create_send_bufs ( qib7322, baseaddr_vl15_port1,
666  if ( ! qib7322->send_bufs_vl15_port1 ) {
667  rc = -ENOMEM;
668  goto err_create_send_bufs_vl15_port1;
669  }
670 
671  /* Allocate space for the SendBufAvail array */
674  if ( ! qib7322->sendbufavail ) {
675  rc = -ENOMEM;
676  goto err_alloc_sendbufavail;
677  }
678  memset ( qib7322->sendbufavail, 0, sizeof ( *qib7322->sendbufavail ) );
679 
680  /* Program SendBufAvailAddr into the hardware */
681  memset ( &sendbufavailaddr, 0, sizeof ( sendbufavailaddr ) );
682  BIT_FILL_1 ( &sendbufavailaddr, SendBufAvailAddr,
683  ( virt_to_bus ( qib7322->sendbufavail ) >> 6 ) );
684  qib7322_writeq ( qib7322, &sendbufavailaddr,
686 
687  /* Enable sending */
688  memset ( &sendctrlp, 0, sizeof ( sendctrlp ) );
689  BIT_FILL_1 ( &sendctrlp, SendEnable, 1 );
692 
693  /* Enable DMA of SendBufAvail */
694  memset ( &sendctrl, 0, sizeof ( sendctrl ) );
695  BIT_FILL_1 ( &sendctrl, SendBufAvailUpd, 1 );
697 
698  return 0;
699 
700  free_dma ( qib7322->sendbufavail, sizeof ( *qib7322->sendbufavail ) );
701  err_alloc_sendbufavail:
703  err_create_send_bufs_vl15_port1:
705  err_create_send_bufs_vl15_port0:
707  err_create_send_bufs_small:
708  return rc;
709 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define QIB7322_SMALL_SEND_BUF_USED
Number of small send buffers used.
Definition: qib7322.h:246
static void qib7322_destroy_send_bufs(struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs)
Destroy send buffer set.
Definition: qib7322.c:479
#define QIB7322_VL15_PORT1_SEND_BUF_COUNT
QIB7322 VL15 port 0 send buffer count.
Definition: qib7322.h:235
#define QIB_7322_SendBufBase_offset
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define QIB_7322_SendBufAvailAddr_offset
#define QIB_7322_SendCtrl_1_offset
#define QIB7322_VL15_PORT0_SEND_BUF_START
QIB7322 VL15 port 0 send buffer starting index.
Definition: qib7322.h:223
#define QIB7322_VL15_PORT1_SEND_BUF_START
QIB7322 VL15 port 0 send buffer starting index.
Definition: qib7322.h:232
#define QIB7322_SMALL_SEND_BUF_START
QIB7322 small send buffer starting index.
Definition: qib7322.h:208
#define QIB7322_VL15_PORT0_SEND_BUF_SIZE
QIB7322 VL15 port 0 send buffer size.
Definition: qib7322.h:229
#define QIB7322_SENDBUFAVAIL_ALIGN
DMA alignment for send buffer availability.
Definition: qib7322.h:97
#define QIB7322_VL15_PORT1_SEND_BUF_SIZE
QIB7322 VL15 port 0 send buffer size.
Definition: qib7322.h:238
#define QIB7322_LARGE_SEND_BUF_SIZE
QIB7322 large send buffer size.
Definition: qib7322.h:214
#define ENOMEM
Not enough space.
Definition: errno.h:534
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
struct QIB_7322_SendBufAvail * sendbufavail
Send buffer availability (reported by hardware)
Definition: qib7322.c:112
#define QIB7322_LARGE_SEND_BUF_COUNT
QIB7322 large send buffer count.
Definition: qib7322.h:220
#define QIB_7322_SendCtrl_offset
A QIB7322 HCA.
Definition: qib7322.c:100
struct qib7322_send_buffers * send_bufs_vl15_port0
VL15 port 0 send buffers.
Definition: qib7322.c:116
struct qib7322_send_buffers * send_bufs_small
Small send buffers.
Definition: qib7322.c:114
#define QIB7322_VL15_PORT0_SEND_BUF_COUNT
QIB7322 VL15 port 0 send buffer count.
Definition: qib7322.h:226
struct qib7322_send_buffers * send_bufs_vl15_port1
VL15 port 1 send buffers.
Definition: qib7322.c:118
#define BIT_FILL_1(_ptr, _field1,...)
Definition: pseudobit.h:185
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.
Definition: qib7322.c:445
static void *__malloc malloc_dma(size_t size, size_t phys_align)
Allocate memory for DMA.
Definition: malloc.h:66
#define QIB7322_SMALL_SEND_BUF_SIZE
QIB7322 small send buffer size.
Definition: qib7322.h:205
static void free_dma(void *ptr, size_t size)
Free memory allocated with malloc_dma()
Definition: malloc.h:81
#define QIB_7322_SendCtrl_0_offset
void * memset(void *dest, int character, size_t len) __nonnull

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

◆ qib7322_fini_send()

static void qib7322_fini_send ( struct qib7322 qib7322)
static

Shut down send datapath.

Parameters
qib7322QIB7322 device

Definition at line 716 of file qib7322.c.

716  {
717  struct QIB_7322_SendCtrl sendctrl;
718 
719  /* Disable sending and DMA of SendBufAvail */
720  memset ( &sendctrl, 0, sizeof ( sendctrl ) );
722  mb();
723 
724  /* Ensure hardware has seen this disable */
726 
727  free_dma ( qib7322->sendbufavail, sizeof ( *qib7322->sendbufavail ) );
731 }
static void qib7322_destroy_send_bufs(struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs)
Destroy send buffer set.
Definition: qib7322.c:479
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
struct QIB_7322_SendBufAvail * sendbufavail
Send buffer availability (reported by hardware)
Definition: qib7322.c:112
#define QIB_7322_SendCtrl_offset
A QIB7322 HCA.
Definition: qib7322.c:100
struct qib7322_send_buffers * send_bufs_vl15_port0
VL15 port 0 send buffers.
Definition: qib7322.c:116
struct qib7322_send_buffers * send_bufs_small
Small send buffers.
Definition: qib7322.c:114
struct qib7322_send_buffers * send_bufs_vl15_port1
VL15 port 1 send buffers.
Definition: qib7322.c:118
void mb(void)
Memory barrier.
static void free_dma(void *ptr, size_t size)
Free memory allocated with malloc_dma()
Definition: malloc.h:81
void * memset(void *dest, int character, size_t len) __nonnull

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

◆ qib7322_create_recv_wq()

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.

748  {
749  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
750  struct ib_work_queue *wq = &qp->recv;
751  struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
752  struct QIB_7322_RcvHdrAddr0 rcvhdraddr;
753  struct QIB_7322_RcvHdrTailAddr0 rcvhdrtailaddr;
754  struct QIB_7322_RcvHdrHead0 rcvhdrhead;
755  struct QIB_7322_scalar rcvegrindexhead;
756  struct QIB_7322_RcvCtrl rcvctrl;
757  struct QIB_7322_RcvCtrl_P rcvctrlp;
758  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
759  unsigned int ctx = qib7322_ctx ( ibdev, qp );
760  int rc;
761 
762  /* Reset context information */
763  memset ( &qib7322_wq->header_prod, 0,
764  sizeof ( qib7322_wq->header_prod ) );
765  qib7322_wq->header_cons = 0;
766  qib7322_wq->eager_prod = 0;
767  qib7322_wq->eager_cons = 0;
768 
769  /* Allocate receive header buffer */
772  if ( ! qib7322_wq->header ) {
773  rc = -ENOMEM;
774  goto err_alloc_header;
775  }
776 
777  /* Enable context in hardware */
778  memset ( &rcvhdraddr, 0, sizeof ( rcvhdraddr ) );
779  BIT_FILL_1 ( &rcvhdraddr, RcvHdrAddr,
780  ( virt_to_bus ( qib7322_wq->header ) >> 2 ) );
781  qib7322_writeq_array8b ( qib7322, &rcvhdraddr,
783  memset ( &rcvhdrtailaddr, 0, sizeof ( rcvhdrtailaddr ) );
784  BIT_FILL_1 ( &rcvhdrtailaddr, RcvHdrTailAddr,
785  ( virt_to_bus ( &qib7322_wq->header_prod ) >> 2 ) );
786  qib7322_writeq_array8b ( qib7322, &rcvhdrtailaddr,
788  memset ( &rcvhdrhead, 0, sizeof ( rcvhdrhead ) );
789  BIT_FILL_1 ( &rcvhdrhead, counter, 1 );
790  qib7322_writeq_array64k ( qib7322, &rcvhdrhead,
792  memset ( &rcvegrindexhead, 0, sizeof ( rcvegrindexhead ) );
793  BIT_FILL_1 ( &rcvegrindexhead, Value, 1 );
794  qib7322_writeq_array64k ( qib7322, &rcvegrindexhead,
796  qib7322_readq_port ( qib7322, &rcvctrlp,
798  BIT_SET ( &rcvctrlp, ContextEnable[ctx], 1 );
799  qib7322_writeq_port ( qib7322, &rcvctrlp,
802  BIT_SET ( &rcvctrl, IntrAvail[ctx], 1 );
804 
805  DBGC ( qib7322, "QIB7322 %p port %d QPN %ld CTX %d hdrs [%lx,%lx) prod "
806  "%lx\n", qib7322, port, qp->qpn, ctx,
807  virt_to_bus ( qib7322_wq->header ),
808  ( virt_to_bus ( qib7322_wq->header )
810  virt_to_bus ( &qib7322_wq->header_prod ) );
811  return 0;
812 
813  free_dma ( qib7322_wq->header, QIB7322_RECV_HEADERS_SIZE );
814  err_alloc_header:
815  return rc;
816 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define QIB_7322_RcvCtrl_offset
void * header
Receive header ring.
Definition: qib7322.c:84
#define QIB7322_RECV_HEADERS_ALIGN
RX header alignment.
Definition: qib7322.h:300
#define qib7322_writeq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:179
unsigned int eager_cons
Eager array consumer index.
Definition: qib7322.c:96
#define qib7322_writeq_array8b(_qib7322, _ptr, _offset, _idx)
Definition: qib7322.c:175
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define DBGC(...)
Definition: compiler.h:505
#define QIB_7322_RcvHdrHead0_offset
#define BIT_SET(_ptr, _field, _value)
Definition: pseudobit.h:238
#define qib7322_writeq_array64k(_qib7322, _ptr, _offset, _idx)
Definition: qib7322.c:177
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
unsigned int eager_prod
Eager array producer index.
Definition: qib7322.c:94
#define QIB_7322_RcvCtrl_0_offset
#define ENOMEM
Not enough space.
Definition: errno.h:534
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
An Infiniband Work Queue.
Definition: infiniband.h:100
#define QIB_7322_RcvEgrIndexHead0_offset
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
unsigned int port
Port number.
Definition: infiniband.h:418
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
#define QIB7322_RECV_HEADERS_SIZE
Total size of an RX header ring.
Definition: qib7322.h:296
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:159
static unsigned int qib7322_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Get queue pair context number.
Definition: qib7322.c:397
#define QIB_7322_RcvHdrAddr0_offset
A QIB7322 HCA.
Definition: qib7322.c:100
struct QIB_7322_scalar header_prod
Receive header producer offset (written by hardware)
Definition: qib7322.c:86
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
#define BIT_FILL_1(_ptr, _field1,...)
Definition: pseudobit.h:185
unsigned int header_cons
Receive header consumer offset.
Definition: qib7322.c:88
#define QIB_7322_RcvHdrTailAddr0_offset
static void *__malloc malloc_dma(size_t size, size_t phys_align)
Allocate memory for DMA.
Definition: malloc.h:66
A QIB7322 receive work queue.
Definition: qib7322.c:82
static void free_dma(void *ptr, size_t size)
Free memory allocated with malloc_dma()
Definition: malloc.h:81
void * memset(void *dest, int character, size_t len) __nonnull

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(), qib7322::ibdev, malloc_dma(), memset(), port, ib_device::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, qp, rc, and virt_to_bus().

Referenced by qib7322_create_qp().

◆ qib7322_destroy_recv_wq()

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.

825  {
826  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
827  struct ib_work_queue *wq = &qp->recv;
828  struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
829  struct QIB_7322_RcvCtrl rcvctrl;
830  struct QIB_7322_RcvCtrl_P rcvctrlp;
831  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
832  unsigned int ctx = qib7322_ctx ( ibdev, qp );
833 
834  /* Disable context in hardware */
835  qib7322_readq_port ( qib7322, &rcvctrlp,
837  BIT_SET ( &rcvctrlp, ContextEnable[ctx], 0 );
838  qib7322_writeq_port ( qib7322, &rcvctrlp,
841  BIT_SET ( &rcvctrl, IntrAvail[ctx], 0 );
843 
844  /* Make sure the hardware has seen that the context is disabled */
846  mb();
847 
848  /* Free headers ring */
849  free_dma ( qib7322_wq->header, QIB7322_RECV_HEADERS_SIZE );
850 }
#define QIB_7322_RcvCtrl_offset
void * header
Receive header ring.
Definition: qib7322.c:84
#define qib7322_writeq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:179
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define BIT_SET(_ptr, _field, _value)
Definition: pseudobit.h:238
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
#define QIB_7322_RcvCtrl_0_offset
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
An Infiniband Work Queue.
Definition: infiniband.h:100
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
unsigned int port
Port number.
Definition: infiniband.h:418
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
#define QIB7322_RECV_HEADERS_SIZE
Total size of an RX header ring.
Definition: qib7322.h:296
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:159
static unsigned int qib7322_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Get queue pair context number.
Definition: qib7322.c:397
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
void mb(void)
Memory barrier.
A QIB7322 receive work queue.
Definition: qib7322.c:82
static void free_dma(void *ptr, size_t size)
Free memory allocated with malloc_dma()
Definition: malloc.h:81

References BIT_SET, ctx, free_dma(), qib7322_recv_work_queue::header, ib_get_drvdata(), ib_wq_get_drvdata(), qib7322::ibdev, mb(), port, ib_device::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 qp.

Referenced by qib7322_create_qp(), and qib7322_destroy_qp().

◆ qib7322_init_recv()

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.

858  {
859  struct QIB_7322_RcvCtrl rcvctrl;
860  struct QIB_7322_RcvCtrl_0 rcvctrlp;
861  struct QIB_7322_RcvQPMapTableA_0 rcvqpmaptablea0;
862  struct QIB_7322_RcvQPMapTableB_0 rcvqpmaptableb0;
863  struct QIB_7322_RcvQPMapTableA_1 rcvqpmaptablea1;
864  struct QIB_7322_RcvQPMapTableB_1 rcvqpmaptableb1;
865  struct QIB_7322_RcvQPMulticastContext_0 rcvqpmcastctx0;
866  struct QIB_7322_RcvQPMulticastContext_1 rcvqpmcastctx1;
867  struct QIB_7322_scalar rcvegrbase;
868  struct QIB_7322_scalar rcvhdrentsize;
869  struct QIB_7322_scalar rcvhdrcnt;
870  struct QIB_7322_RcvBTHQP_0 rcvbthqp;
871  struct QIB_7322_RxCreditVL0_0 rxcreditvl;
872  unsigned int contextcfg;
873  unsigned long egrbase;
874  unsigned int eager_array_size_kernel;
875  unsigned int eager_array_size_user;
876  unsigned int ctx;
877 
878  /* Select configuration based on number of contexts */
879  switch ( QIB7322_NUM_CONTEXTS ) {
880  case 6:
881  contextcfg = QIB7322_CONTEXTCFG_6CTX;
882  eager_array_size_kernel = QIB7322_EAGER_ARRAY_SIZE_6CTX_KERNEL;
883  eager_array_size_user = QIB7322_EAGER_ARRAY_SIZE_6CTX_USER;
884  break;
885  case 10:
886  contextcfg = QIB7322_CONTEXTCFG_10CTX;
887  eager_array_size_kernel = QIB7322_EAGER_ARRAY_SIZE_10CTX_KERNEL;
888  eager_array_size_user = QIB7322_EAGER_ARRAY_SIZE_10CTX_USER;
889  break;
890  case 18:
891  contextcfg = QIB7322_CONTEXTCFG_18CTX;
892  eager_array_size_kernel = QIB7322_EAGER_ARRAY_SIZE_18CTX_KERNEL;
893  eager_array_size_user = QIB7322_EAGER_ARRAY_SIZE_18CTX_USER;
894  break;
895  default:
896  linker_assert ( 0, invalid_QIB7322_NUM_CONTEXTS );
897  return -EINVAL;
898  }
899 
900  /* Configure number of contexts */
901  memset ( &rcvctrl, 0, sizeof ( rcvctrl ) );
902  BIT_FILL_2 ( &rcvctrl,
903  TailUpd, 1,
904  ContextCfg, contextcfg );
906 
907  /* Map QPNs to contexts */
908  memset ( &rcvctrlp, 0, sizeof ( rcvctrlp ) );
909  BIT_FILL_3 ( &rcvctrlp,
910  RcvIBPortEnable, 1,
911  RcvQPMapEnable, 1,
912  RcvPartitionKeyDisable, 1 );
915  memset ( &rcvqpmaptablea0, 0, sizeof ( rcvqpmaptablea0 ) );
916  BIT_FILL_6 ( &rcvqpmaptablea0,
917  RcvQPMapContext0, 0,
918  RcvQPMapContext1, 2,
919  RcvQPMapContext2, 4,
920  RcvQPMapContext3, 6,
921  RcvQPMapContext4, 8,
922  RcvQPMapContext5, 10 );
923  qib7322_writeq ( qib7322, &rcvqpmaptablea0,
925  memset ( &rcvqpmaptableb0, 0, sizeof ( rcvqpmaptableb0 ) );
926  BIT_FILL_3 ( &rcvqpmaptableb0,
927  RcvQPMapContext6, 12,
928  RcvQPMapContext7, 14,
929  RcvQPMapContext8, 16 );
930  qib7322_writeq ( qib7322, &rcvqpmaptableb0,
932  memset ( &rcvqpmaptablea1, 0, sizeof ( rcvqpmaptablea1 ) );
933  BIT_FILL_6 ( &rcvqpmaptablea1,
934  RcvQPMapContext0, 1,
935  RcvQPMapContext1, 3,
936  RcvQPMapContext2, 5,
937  RcvQPMapContext3, 7,
938  RcvQPMapContext4, 9,
939  RcvQPMapContext5, 11 );
940  qib7322_writeq ( qib7322, &rcvqpmaptablea1,
942  memset ( &rcvqpmaptableb1, 0, sizeof ( rcvqpmaptableb1 ) );
943  BIT_FILL_3 ( &rcvqpmaptableb1,
944  RcvQPMapContext6, 13,
945  RcvQPMapContext7, 15,
946  RcvQPMapContext8, 17 );
947  qib7322_writeq ( qib7322, &rcvqpmaptableb1,
949 
950  /* Map multicast QPNs to contexts */
951  memset ( &rcvqpmcastctx0, 0, sizeof ( rcvqpmcastctx0 ) );
952  BIT_FILL_1 ( &rcvqpmcastctx0, RcvQpMcContext, 0 );
953  qib7322_writeq ( qib7322, &rcvqpmcastctx0,
955  memset ( &rcvqpmcastctx1, 0, sizeof ( rcvqpmcastctx1 ) );
956  BIT_FILL_1 ( &rcvqpmcastctx1, RcvQpMcContext, 1 );
957  qib7322_writeq ( qib7322, &rcvqpmcastctx1,
959 
960  /* Configure receive header buffer sizes */
961  memset ( &rcvhdrcnt, 0, sizeof ( rcvhdrcnt ) );
962  BIT_FILL_1 ( &rcvhdrcnt, Value, QIB7322_RECV_HEADER_COUNT );
964  memset ( &rcvhdrentsize, 0, sizeof ( rcvhdrentsize ) );
965  BIT_FILL_1 ( &rcvhdrentsize, Value, ( QIB7322_RECV_HEADER_SIZE >> 2 ) );
966  qib7322_writeq ( qib7322, &rcvhdrentsize,
968 
969  /* Calculate eager array start addresses for each context */
971  egrbase = BIT_GET ( &rcvegrbase, Value );
972  for ( ctx = 0 ; ctx < QIB7322_MAX_PORTS ; ctx++ ) {
973  qib7322->recv_wq[ctx].eager_array = egrbase;
974  qib7322->recv_wq[ctx].eager_entries = eager_array_size_kernel;
975  egrbase += ( eager_array_size_kernel *
976  sizeof ( struct QIB_7322_RcvEgr ) );
977  }
978  for ( ; ctx < QIB7322_NUM_CONTEXTS ; ctx++ ) {
979  qib7322->recv_wq[ctx].eager_array = egrbase;
980  qib7322->recv_wq[ctx].eager_entries = eager_array_size_user;
981  egrbase += ( eager_array_size_user *
982  sizeof ( struct QIB_7322_RcvEgr ) );
983  }
984  for ( ctx = 0 ; ctx < QIB7322_NUM_CONTEXTS ; ctx++ ) {
985  DBGC ( qib7322, "QIB7322 %p CTX %d eager array at %lx (%d "
986  "entries)\n", qib7322, ctx,
989  }
990 
991  /* Set the BTH QP for Infinipath packets to an unused value */
992  memset ( &rcvbthqp, 0, sizeof ( rcvbthqp ) );
993  BIT_FILL_1 ( &rcvbthqp, RcvBTHQP, QIB7322_QP_IDETH );
996 
997  /* Assign initial credits */
998  memset ( &rxcreditvl, 0, sizeof ( rxcreditvl ) );
999  BIT_FILL_1 ( &rxcreditvl, RxMaxCreditVL, QIB7322_MAX_CREDITS_VL0 );
1000  qib7322_writeq_array8b ( qib7322, &rxcreditvl,
1002  qib7322_writeq_array8b ( qib7322, &rxcreditvl,
1004  BIT_FILL_1 ( &rxcreditvl, RxMaxCreditVL, QIB7322_MAX_CREDITS_VL15 );
1005  qib7322_writeq_array8b ( qib7322, &rxcreditvl,
1007  qib7322_writeq_array8b ( qib7322, &rxcreditvl,
1009 
1010  return 0;
1011 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
#define QIB7322_MAX_CREDITS_VL0
Number of credits to advertise for VL0.
Definition: qib7322.h:326
#define QIB_7322_RcvCtrl_1_offset
#define BIT_FILL_6(_ptr, _field1,...)
Definition: pseudobit.h:210
#define QIB_7322_RcvCtrl_offset
#define QIB_7322_RcvQPMapTableB_1_offset
#define qib7322_writeq_array8b(_qib7322, _ptr, _offset, _idx)
Definition: qib7322.c:175
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define QIB7322_EAGER_ARRAY_SIZE_6CTX_KERNEL
ContextCfg values for different numbers of contexts.
Definition: qib7322.h:262
#define DBGC(...)
Definition: compiler.h:505
#define QIB7322_EAGER_ARRAY_SIZE_10CTX_KERNEL
Definition: qib7322.h:264
#define QIB_7322_RcvBTHQP_0_offset
#define QIB_7322_RcvHdrCnt_offset
#define QIB_7322_RxCreditVL0_1_offset
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
unsigned int eager_entries
Number of entries in eager array.
Definition: qib7322.c:92
#define QIB7322_NUM_CONTEXTS
Number of contexts (including kernel context)
Definition: qib7322.h:252
#define QIB_7322_RcvCtrl_0_offset
#define QIB_7322_RxCreditVL0_0_offset
#define QIB7322_EAGER_ARRAY_SIZE_18CTX_USER
Definition: qib7322.h:267
struct qib7322_recv_work_queue recv_wq[QIB7322_NUM_CONTEXTS]
Receive work queues.
Definition: qib7322.c:109
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
#define QIB7322_EAGER_ARRAY_SIZE_10CTX_USER
Definition: qib7322.h:265
#define QIB_7322_RcvBTHQP_1_offset
#define BIT_FILL_3(_ptr, _field1,...)
Definition: pseudobit.h:195
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
#define QIB7322_EAGER_ARRAY_SIZE_18CTX_KERNEL
Definition: qib7322.h:266
#define QIB7322_RECV_HEADER_SIZE
Maximum size of each RX header.
Definition: qib7322.h:293
#define QIB7322_MAX_PORTS
QIB7322 maximum number of ports.
Definition: qib7322.h:169
#define QIB_7322_RcvEgrBase_offset
A QIB7322 HCA.
Definition: qib7322.c:100
#define QIB_7322_RcvQPMapTableA_0_offset
#define BIT_FILL_2(_ptr, _field1,...)
Definition: pseudobit.h:190
#define QIB7322_QP_IDETH
QPN used for Infinipath Packets.
Definition: qib7322.h:334
#define QIB_7322_RcvQPMapTableA_1_offset
#define QIB7322_RECV_HEADER_COUNT
Number of RX headers per context.
Definition: qib7322.h:287
#define BIT_FILL_1(_ptr, _field1,...)
Definition: pseudobit.h:185
#define QIB7322_EAGER_ARRAY_SIZE_6CTX_USER
Definition: qib7322.h:263
#define QIB_7322_RcvHdrEntSize_offset
unsigned long eager_array
Offset within register space of the eager array.
Definition: qib7322.c:90
#define QIB_7322_RcvQPMulticastContext_0_offset
#define QIB_7322_RcvQPMulticastContext_1_offset
#define linker_assert(condition, error_symbol)
Assert a condition at link-time.
Definition: assert.h:68
#define QIB_7322_RcvQPMapTableB_0_offset
#define QIB7322_MAX_CREDITS_VL15
Number of credits to advertise for VL15.
Definition: qib7322.h:320
void * memset(void *dest, int character, size_t len) __nonnull

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

◆ qib7322_fini_recv()

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.

1018  {
1019  /* Nothing to do; all contexts were already disabled when the
1020  * queue pairs were destroyed
1021  */
1022 }

Referenced by qib7322_probe(), and qib7322_remove().

◆ qib7322_create_cq()

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.

1039  {
1040  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1041  static int cqn;
1042 
1043  /* The hardware has no concept of completion queues. We
1044  * simply use the association between CQs and WQs (already
1045  * handled by the IB core) to decide which WQs to poll.
1046  *
1047  * We do set a CQN, just to avoid confusing debug messages
1048  * from the IB core.
1049  */
1050  cq->cqn = ++cqn;
1051  DBGC ( qib7322, "QIB7322 %p CQN %ld created\n", qib7322, cq->cqn );
1052 
1053  return 0;
1054 }
#define DBGC(...)
Definition: compiler.h:505
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
A QIB7322 HCA.
Definition: qib7322.c:100
unsigned long cqn
Completion queue number.
Definition: infiniband.h:230
__be32 cqn
Definition: CIB_PRM.h:29

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

◆ qib7322_destroy_cq()

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.

1063  {
1064  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1065 
1066  /* Nothing to do */
1067  DBGC ( qib7322, "QIB7322 %p CQN %ld destroyed\n", qib7322, cq->cqn );
1068 }
#define DBGC(...)
Definition: compiler.h:505
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
A QIB7322 HCA.
Definition: qib7322.c:100
unsigned long cqn
Completion queue number.
Definition: infiniband.h:230

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

◆ qib7322_create_qp()

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.

1085  {
1086  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1087  unsigned int ctx;
1088  int rc;
1089 
1090  /* Allocate a context and QPN */
1091  if ( ( rc = qib7322_alloc_ctx ( ibdev, qp ) ) != 0 )
1092  goto err_alloc_ctx;
1093  ctx = qib7322_ctx ( ibdev, qp );
1094 
1095  /* Set work-queue private data pointers */
1096  ib_wq_set_drvdata ( &qp->send, &qib7322->send_wq[ctx] );
1097  ib_wq_set_drvdata ( &qp->recv, &qib7322->recv_wq[ctx] );
1098 
1099  /* Create receive work queue */
1100  if ( ( rc = qib7322_create_recv_wq ( ibdev, qp ) ) != 0 )
1101  goto err_create_recv_wq;
1102 
1103  /* Create send work queue */
1104  if ( ( rc = qib7322_create_send_wq ( ibdev, qp ) ) != 0 )
1105  goto err_create_send_wq;
1106 
1107  return 0;
1108 
1110  err_create_send_wq:
1112  err_create_recv_wq:
1113  qib7322_free_ctx ( ibdev, qp );
1114  err_alloc_ctx:
1115  return rc;
1116 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int qib7322_create_send_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create send work queue.
Definition: qib7322.c:572
static void qib7322_destroy_send_wq(struct ib_device *ibdev __unused, struct ib_queue_pair *qp)
Destroy send work queue.
Definition: qib7322.c:609
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static void qib7322_free_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Free a context.
Definition: qib7322.c:408
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
struct qib7322_recv_work_queue recv_wq[QIB7322_NUM_CONTEXTS]
Receive work queues.
Definition: qib7322.c:109
static int qib7322_create_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create receive work queue.
Definition: qib7322.c:747
static void qib7322_destroy_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy receive work queue.
Definition: qib7322.c:824
static unsigned int qib7322_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Get queue pair context number.
Definition: qib7322.c:397
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
struct qib7322_send_work_queue send_wq[QIB7322_NUM_CONTEXTS]
Send work queues.
Definition: qib7322.c:107
static int qib7322_alloc_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Allocate a context and set queue pair number.
Definition: qib7322.c:368
static __always_inline void ib_wq_set_drvdata(struct ib_work_queue *wq, void *priv)
Set Infiniband work queue driver-private data.
Definition: infiniband.h:608

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

◆ qib7322_modify_qp()

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.

1126  {
1127  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1128 
1129  /* Nothing to do; the hardware doesn't have a notion of queue
1130  * keys
1131  */
1132  DBGC2 ( qib7322, "QIB7322 %p QPN %ld modified\n", qib7322, qp->qpn );
1133  return 0;
1134 }
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
#define DBGC2(...)
Definition: compiler.h:522

References DBGC2, ib_get_drvdata(), qib7322::ibdev, and qp.

◆ qib7322_destroy_qp()

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.

1143  {
1144 
1147  qib7322_free_ctx ( ibdev, qp );
1148 }
static void qib7322_destroy_send_wq(struct ib_device *ibdev __unused, struct ib_queue_pair *qp)
Destroy send work queue.
Definition: qib7322.c:609
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static void qib7322_free_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Free a context.
Definition: qib7322.c:408
static void qib7322_destroy_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy receive work queue.
Definition: qib7322.c:824
struct arbelprm_qp_db_record qp
Definition: arbel.h:13

References qib7322::ibdev, qib7322_destroy_recv_wq(), qib7322_destroy_send_wq(), qib7322_free_ctx(), and qp.

◆ qib7322_post_send()

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.

1169  {
1170  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1171  struct ib_work_queue *wq = &qp->send;
1172  struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
1173  struct QIB_7322_SendPbc sendpbc;
1174  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
1175  uint8_t header_buf[IB_MAX_HEADER_SIZE];
1176  struct io_buffer headers;
1177  int send_buf;
1178  unsigned long start_offset;
1179  unsigned long offset;
1180  size_t len;
1181  ssize_t frag_len;
1182  uint32_t *data;
1183 
1184  /* Allocate send buffer and calculate offset */
1185  send_buf = qib7322_alloc_send_buf ( qib7322, qib7322_wq->send_bufs );
1186  if ( send_buf < 0 )
1187  return send_buf;
1188  start_offset = offset =
1190  send_buf );
1191 
1192  /* Store I/O buffer and send buffer index */
1193  assert ( wq->iobufs[qib7322_wq->prod] == NULL );
1194  wq->iobufs[qib7322_wq->prod] = iobuf;
1195  qib7322_wq->used[qib7322_wq->prod] = send_buf;
1196 
1197  /* Construct headers */
1198  iob_populate ( &headers, header_buf, 0, sizeof ( header_buf ) );
1199  iob_reserve ( &headers, sizeof ( header_buf ) );
1200  ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), dest );
1201 
1202  /* Calculate packet length */
1203  len = ( ( sizeof ( sendpbc ) + iob_len ( &headers ) +
1204  iob_len ( iobuf ) + 3 ) & ~3 );
1205 
1206  /* Construct send per-buffer control word */
1207  memset ( &sendpbc, 0, sizeof ( sendpbc ) );
1208  BIT_FILL_3 ( &sendpbc,
1209  LengthP1_toibc, ( ( len >> 2 ) - 1 ),
1210  Port, port,
1211  VL15, ( ( qp->type == IB_QPT_SMI ) ? 1 : 0 ) );
1212 
1213  /* Write SendPbc */
1214  DBG_DISABLE ( DBGLVL_IO );
1215  qib7322_writeq ( qib7322, &sendpbc, offset );
1216  offset += sizeof ( sendpbc );
1217 
1218  /* Write headers */
1219  for ( data = headers.data, frag_len = iob_len ( &headers ) ;
1220  frag_len > 0 ; data++, offset += 4, frag_len -= 4 ) {
1222  }
1223 
1224  /* Write data */
1225  for ( data = iobuf->data, frag_len = iob_len ( iobuf ) ;
1226  frag_len > 0 ; data++, offset += 4, frag_len -= 4 ) {
1228  }
1229  DBG_ENABLE ( DBGLVL_IO );
1230 
1231  assert ( ( start_offset + len ) == offset );
1232  DBGC2 ( qib7322, "QIB7322 %p QPN %ld TX %04x(%04x) posted [%lx,%lx)\n",
1233  qib7322, qp->qpn, send_buf, qib7322_wq->prod,
1234  start_offset, offset );
1235 
1236  /* Increment producer counter */
1237  qib7322_wq->prod = ( ( qib7322_wq->prod + 1 ) & ( wq->num_wqes - 1 ) );
1238 
1239  return 0;
1240 }
static int qib7322_alloc_send_buf(struct qib7322 *qib7322, struct qib7322_send_buffers *send_bufs)
Allocate a send buffer.
Definition: qib7322.c:491
#define DBGLVL_IO
Definition: compiler.h:322
uint16_t * used
Send buffer usage.
Definition: qib7322.c:74
A QIB7322 send work queue.
Definition: qib7322.c:70
#define DBG_ENABLE(level)
Definition: compiler.h:313
struct qib7322_send_buffers * send_bufs
Send buffer set.
Definition: qib7322.c:72
#define DBG_DISABLE(level)
Definition: compiler.h:312
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
Definition: iobuf.h:186
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
unsigned int prod
Producer index.
Definition: qib7322.c:76
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An Infiniband Work Queue.
Definition: infiniband.h:100
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
unsigned int num_wqes
Number of work queue entries.
Definition: infiniband.h:112
static void * dest
Definition: strings.h:176
#define BIT_FILL_3(_ptr, _field1,...)
Definition: pseudobit.h:195
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
unsigned int port
Port number.
Definition: infiniband.h:418
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
unsigned char uint8_t
Definition: stdint.h:10
uint8_t headers[IB_MAX_HEADER_SIZE]
Definition: arbel.h:14
unsigned int uint32_t
Definition: stdint.h:12
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
#define iob_reserve(iobuf, len)
Definition: iobuf.h:63
uint32_t len
Length.
Definition: ena.h:14
#define DBGC2(...)
Definition: compiler.h:522
void * data
Start of data.
Definition: iobuf.h:44
static void qib7322_writel(struct qib7322 *qib7322, uint32_t dword, unsigned long offset)
Write QIB7322 dword register.
Definition: qib7322.c:189
signed long ssize_t
Definition: stdint.h:7
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
int ib_push(struct ib_device *ibdev, struct io_buffer *iobuf, struct ib_queue_pair *qp, size_t payload_len, const struct ib_address_vector *dest)
Add IB headers.
Definition: ib_packet.c:52
#define IB_MAX_HEADER_SIZE
Maximum size required for IB headers.
Definition: ib_packet.h:156
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.
Definition: qib7322.c:557
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:32
struct io_buffer ** iobufs
I/O buffers assigned to work queue.
Definition: infiniband.h:124

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

◆ qib7322_complete_send()

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.

1251  {
1252  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1253  struct ib_work_queue *wq = &qp->send;
1254  struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
1255  struct io_buffer *iobuf;
1256  unsigned int send_buf;
1257 
1258  /* Parse completion */
1259  send_buf = qib7322_wq->used[wqe_idx];
1260  DBGC2 ( qib7322, "QIB7322 %p QPN %ld TX %04x(%04x) complete\n",
1261  qib7322, qp->qpn, send_buf, wqe_idx );
1262 
1263  /* Complete work queue entry */
1264  iobuf = wq->iobufs[wqe_idx];
1265  assert ( iobuf != NULL );
1266  ib_complete_send ( ibdev, qp, iobuf, 0 );
1267  wq->iobufs[wqe_idx] = NULL;
1268 
1269  /* Free send buffer */
1270  qib7322_free_send_buf ( qib7322, qib7322_wq->send_bufs, send_buf );
1271 }
uint16_t * used
Send buffer usage.
Definition: qib7322.c:74
A QIB7322 send work queue.
Definition: qib7322.c:70
struct qib7322_send_buffers * send_bufs
Send buffer set.
Definition: qib7322.c:72
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An Infiniband Work Queue.
Definition: infiniband.h:100
void ib_complete_send(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc)
Complete send work queue entry.
Definition: infiniband.c:515
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
static void qib7322_free_send_buf(struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs, unsigned int send_buf)
Free a send buffer.
Definition: qib7322.c:517
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
#define DBGC2(...)
Definition: compiler.h:522
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
A persistent I/O buffer.
Definition: iobuf.h:32
struct io_buffer ** iobufs
I/O buffers assigned to work queue.
Definition: infiniband.h:124

References assert(), DBGC2, ib_complete_send(), ib_get_drvdata(), ib_wq_get_drvdata(), qib7322::ibdev, ib_work_queue::iobufs, NULL, qib7322_free_send_buf(), qp, qib7322_send_work_queue::send_bufs, and qib7322_send_work_queue::used.

Referenced by qib7322_poll_send_wq().

◆ qib7322_poll_send_wq()

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.

1280  {
1281  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1282  struct ib_work_queue *wq = &qp->send;
1283  struct qib7322_send_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
1284  unsigned int send_buf;
1285 
1286  /* Look for completions */
1287  while ( wq->fill ) {
1288 
1289  /* Check to see if send buffer has completed */
1290  send_buf = qib7322_wq->used[qib7322_wq->cons];
1291  if ( qib7322_send_buf_in_use ( qib7322, send_buf ) )
1292  break;
1293 
1294  /* Complete this buffer */
1295  qib7322_complete_send ( ibdev, qp, qib7322_wq->cons );
1296 
1297  /* Increment consumer counter */
1298  qib7322_wq->cons = ( ( qib7322_wq->cons + 1 ) &
1299  ( wq->num_wqes - 1 ) );
1300  }
1301 }
uint16_t * used
Send buffer usage.
Definition: qib7322.c:74
A QIB7322 send work queue.
Definition: qib7322.c:70
static int qib7322_send_buf_in_use(struct qib7322 *qib7322, unsigned int send_buf)
Check to see if send buffer is in use.
Definition: qib7322.c:533
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
An Infiniband Work Queue.
Definition: infiniband.h:100
static void qib7322_complete_send(struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int wqe_idx)
Complete send work queue entry.
Definition: qib7322.c:1249
unsigned int num_wqes
Number of work queue entries.
Definition: infiniband.h:112
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
unsigned int fill
Number of occupied work queue entries.
Definition: infiniband.h:114
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
unsigned int cons
Consumer index.
Definition: qib7322.c:78

References qib7322_send_work_queue::cons, ib_work_queue::fill, ib_get_drvdata(), ib_wq_get_drvdata(), qib7322::ibdev, ib_work_queue::num_wqes, qib7322_complete_send(), qib7322_send_buf_in_use(), qp, and qib7322_send_work_queue::used.

Referenced by qib7322_poll_cq().

◆ qib7322_post_recv()

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.

1313  {
1314  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1315  struct ib_work_queue *wq = &qp->recv;
1316  struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
1317  struct QIB_7322_RcvEgr rcvegr;
1318  struct QIB_7322_scalar rcvegrindexhead;
1319  unsigned int ctx = qib7322_ctx ( ibdev, qp );
1320  physaddr_t addr;
1321  size_t len;
1322  unsigned int wqe_idx;
1323  unsigned int bufsize;
1324 
1325  /* Sanity checks */
1326  addr = virt_to_bus ( iobuf->data );
1327  len = iob_tailroom ( iobuf );
1328  if ( addr & ( QIB7322_EAGER_BUFFER_ALIGN - 1 ) ) {
1329  DBGC ( qib7322, "QIB7322 %p QPN %ld misaligned RX buffer "
1330  "(%08lx)\n", qib7322, qp->qpn, addr );
1331  return -EINVAL;
1332  }
1333  if ( len != QIB7322_RECV_PAYLOAD_SIZE ) {
1334  DBGC ( qib7322, "QIB7322 %p QPN %ld wrong RX buffer size "
1335  "(%zd)\n", qib7322, qp->qpn, len );
1336  return -EINVAL;
1337  }
1338 
1339  /* Calculate eager producer index and WQE index */
1340  wqe_idx = ( qib7322_wq->eager_prod & ( wq->num_wqes - 1 ) );
1341  assert ( wq->iobufs[wqe_idx] == NULL );
1342 
1343  /* Store I/O buffer */
1344  wq->iobufs[wqe_idx] = iobuf;
1345 
1346  /* Calculate buffer size */
1347  switch ( QIB7322_RECV_PAYLOAD_SIZE ) {
1348  case 2048: bufsize = QIB7322_EAGER_BUFFER_2K; break;
1349  case 4096: bufsize = QIB7322_EAGER_BUFFER_4K; break;
1350  case 8192: bufsize = QIB7322_EAGER_BUFFER_8K; break;
1351  case 16384: bufsize = QIB7322_EAGER_BUFFER_16K; break;
1352  case 32768: bufsize = QIB7322_EAGER_BUFFER_32K; break;
1353  case 65536: bufsize = QIB7322_EAGER_BUFFER_64K; break;
1354  default: linker_assert ( 0, invalid_rx_payload_size );
1356  }
1357 
1358  /* Post eager buffer */
1359  memset ( &rcvegr, 0, sizeof ( rcvegr ) );
1360  BIT_FILL_2 ( &rcvegr,
1361  Addr, ( addr >> 11 ),
1362  BufSize, bufsize );
1363  qib7322_writeq_array8b ( qib7322, &rcvegr, qib7322_wq->eager_array,
1364  qib7322_wq->eager_prod );
1365  DBGC2 ( qib7322, "QIB7322 %p QPN %ld RX egr %04x(%04x) posted "
1366  "[%lx,%lx)\n", qib7322, qp->qpn, qib7322_wq->eager_prod,
1367  wqe_idx, addr, ( addr + len ) );
1368 
1369  /* Increment producer index */
1370  qib7322_wq->eager_prod = ( ( qib7322_wq->eager_prod + 1 ) &
1371  ( qib7322_wq->eager_entries - 1 ) );
1372 
1373  /* Update head index */
1374  memset ( &rcvegrindexhead, 0, sizeof ( rcvegrindexhead ) );
1375  BIT_FILL_1 ( &rcvegrindexhead,
1376  Value, ( ( qib7322_wq->eager_prod + 1 ) &
1377  ( qib7322_wq->eager_entries - 1 ) ) );
1378  qib7322_writeq_array64k ( qib7322, &rcvegrindexhead,
1380 
1381  return 0;
1382 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
#define QIB7322_EAGER_BUFFER_ALIGN
Eager buffer required alignment.
Definition: qib7322.h:270
#define qib7322_writeq_array8b(_qib7322, _ptr, _offset, _idx)
Definition: qib7322.c:175
#define DBGC(...)
Definition: compiler.h:505
#define qib7322_writeq_array64k(_qib7322, _ptr, _offset, _idx)
Definition: qib7322.c:177
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
unsigned int eager_entries
Number of entries in eager array.
Definition: qib7322.c:92
unsigned int eager_prod
Eager array producer index.
Definition: qib7322.c:94
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An Infiniband Work Queue.
Definition: infiniband.h:100
#define QIB_7322_RcvEgrIndexHead0_offset
unsigned int num_wqes
Number of work queue entries.
Definition: infiniband.h:112
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
Definition: iobuf.h:171
u32 addr
Definition: sky2.h:8
static unsigned int qib7322_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Get queue pair context number.
Definition: qib7322.c:397
A QIB7322 HCA.
Definition: qib7322.c:100
unsigned long physaddr_t
Definition: stdint.h:20
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
#define BIT_FILL_2(_ptr, _field1,...)
Definition: pseudobit.h:190
uint32_t len
Length.
Definition: ena.h:14
#define DBGC2(...)
Definition: compiler.h:522
#define BIT_FILL_1(_ptr, _field1,...)
Definition: pseudobit.h:185
void * data
Start of data.
Definition: iobuf.h:44
A QIB7322 receive work queue.
Definition: qib7322.c:82
uint8_t bufsize
Size of the packet, in bytes.
Definition: int13.h:12
unsigned long eager_array
Offset within register space of the eager array.
Definition: qib7322.c:90
#define linker_assert(condition, error_symbol)
Assert a condition at link-time.
Definition: assert.h:68
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
#define QIB7322_RECV_PAYLOAD_SIZE
RX payload size.
Definition: qib7322.h:306
void * memset(void *dest, int character, size_t len) __nonnull
struct io_buffer ** iobufs
I/O buffers assigned to work queue.
Definition: infiniband.h:124

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(), qib7322::ibdev, 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, qp, and virt_to_bus().

◆ qib7322_complete_recv()

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.

1393  {
1394  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1395  struct ib_work_queue *wq = &qp->recv;
1396  struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
1397  struct QIB_7322_RcvHdrFlags *rcvhdrflags;
1398  struct QIB_7322_RcvEgr rcvegr;
1399  struct io_buffer headers;
1400  struct io_buffer *iobuf;
1401  struct ib_queue_pair *intended_qp;
1402  struct ib_address_vector dest;
1403  struct ib_address_vector source;
1404  unsigned int rcvtype;
1405  unsigned int pktlen;
1406  unsigned int egrindex;
1407  unsigned int useegrbfr;
1408  unsigned int iberr, mkerr, tiderr, khdrerr, mtuerr;
1409  unsigned int lenerr, parityerr, vcrcerr, icrcerr;
1410  unsigned int err;
1411  unsigned int hdrqoffset;
1412  unsigned int header_len;
1413  unsigned int padded_payload_len;
1414  unsigned int wqe_idx;
1415  size_t payload_len;
1416  int qp0;
1417  int rc;
1418 
1419  /* RcvHdrFlags are at the end of the header entry */
1420  rcvhdrflags = ( qib7322_wq->header + header_offs +
1421  QIB7322_RECV_HEADER_SIZE - sizeof ( *rcvhdrflags ) );
1422  rcvtype = BIT_GET ( rcvhdrflags, RcvType );
1423  pktlen = ( BIT_GET ( rcvhdrflags, PktLen ) << 2 );
1424  egrindex = BIT_GET ( rcvhdrflags, EgrIndex );
1425  useegrbfr = BIT_GET ( rcvhdrflags, UseEgrBfr );
1426  hdrqoffset = ( BIT_GET ( rcvhdrflags, HdrqOffset ) << 2 );
1427  iberr = BIT_GET ( rcvhdrflags, IBErr );
1428  mkerr = BIT_GET ( rcvhdrflags, MKErr );
1429  tiderr = BIT_GET ( rcvhdrflags, TIDErr );
1430  khdrerr = BIT_GET ( rcvhdrflags, KHdrErr );
1431  mtuerr = BIT_GET ( rcvhdrflags, MTUErr );
1432  lenerr = BIT_GET ( rcvhdrflags, LenErr );
1433  parityerr = BIT_GET ( rcvhdrflags, ParityErr );
1434  vcrcerr = BIT_GET ( rcvhdrflags, VCRCErr );
1435  icrcerr = BIT_GET ( rcvhdrflags, ICRCErr );
1436  header_len = ( QIB7322_RECV_HEADER_SIZE - hdrqoffset -
1437  sizeof ( *rcvhdrflags ) );
1438  padded_payload_len = ( pktlen - header_len - 4 /* ICRC */ );
1439  err = ( iberr | mkerr | tiderr | khdrerr | mtuerr |
1440  lenerr | parityerr | vcrcerr | icrcerr );
1441  /* IB header is placed immediately before RcvHdrFlags */
1442  iob_populate ( &headers, ( ( ( void * ) rcvhdrflags ) - header_len ),
1443  header_len, header_len );
1444 
1445  /* Dump diagnostic information */
1446  DBGC2 ( qib7322, "QIB7322 %p QPN %ld RX egr %04x%s hdr %d type %d len "
1447  "%d(%d+%d+4)%s%s%s%s%s%s%s%s%s%s%s\n", qib7322, qp->qpn,
1448  egrindex, ( useegrbfr ? "" : "(unused)" ),
1449  ( header_offs / QIB7322_RECV_HEADER_SIZE ),
1450  rcvtype, pktlen, header_len, padded_payload_len,
1451  ( err ? " [Err" : "" ), ( iberr ? " IB" : "" ),
1452  ( mkerr ? " MK" : "" ), ( tiderr ? " TID" : "" ),
1453  ( khdrerr ? " KHdr" : "" ), ( mtuerr ? " MTU" : "" ),
1454  ( lenerr ? " Len" : "" ), ( parityerr ? " Parity" : ""),
1455  ( vcrcerr ? " VCRC" : "" ), ( icrcerr ? " ICRC" : "" ),
1456  ( err ? "]" : "" ) );
1457  DBGCP_HDA ( qib7322, hdrqoffset, headers.data,
1458  ( header_len + sizeof ( *rcvhdrflags ) ) );
1459 
1460  /* Parse header to generate address vector */
1461  qp0 = ( qp->qpn == 0 );
1462  intended_qp = NULL;
1463  if ( ( rc = ib_pull ( ibdev, &headers, ( qp0 ? &intended_qp : NULL ),
1464  &payload_len, &dest, &source ) ) != 0 ) {
1465  DBGC ( qib7322, "QIB7322 %p could not parse headers: %s\n",
1466  qib7322, strerror ( rc ) );
1467  err = 1;
1468  }
1469  if ( ! intended_qp )
1470  intended_qp = qp;
1471 
1472  /* Complete this buffer and any skipped buffers. Note that
1473  * when the hardware runs out of buffers, it will repeatedly
1474  * report the same buffer (the tail) as a TID error, and that
1475  * it also has a habit of sometimes skipping over several
1476  * buffers at once.
1477  */
1478  while ( 1 ) {
1479 
1480  /* If we have caught up to the producer counter, stop.
1481  * This will happen when the hardware first runs out
1482  * of buffers and starts reporting TID errors against
1483  * the eager buffer it wants to use next.
1484  */
1485  if ( qib7322_wq->eager_cons == qib7322_wq->eager_prod )
1486  break;
1487 
1488  /* If we have caught up to where we should be after
1489  * completing this egrindex, stop. We phrase the test
1490  * this way to avoid completing the entire ring when
1491  * we receive the same egrindex twice in a row.
1492  */
1493  if ( ( qib7322_wq->eager_cons ==
1494  ( ( egrindex + 1 ) & ( qib7322_wq->eager_entries - 1 ))))
1495  break;
1496 
1497  /* Identify work queue entry and corresponding I/O
1498  * buffer.
1499  */
1500  wqe_idx = ( qib7322_wq->eager_cons & ( wq->num_wqes - 1 ) );
1501  iobuf = wq->iobufs[wqe_idx];
1502  assert ( iobuf != NULL );
1503  wq->iobufs[wqe_idx] = NULL;
1504 
1505  /* Complete the eager buffer */
1506  if ( qib7322_wq->eager_cons == egrindex ) {
1507  /* Completing the eager buffer described in
1508  * this header entry.
1509  */
1510  if ( payload_len <= iob_tailroom ( iobuf ) ) {
1511  iob_put ( iobuf, payload_len );
1512  rc = ( err ?
1513  -EIO : ( useegrbfr ? 0 : -ECANCELED ) );
1514  } else {
1515  DBGC ( qib7322, "QIB7322 %p bad payload len "
1516  "%zd\n", qib7322, payload_len );
1517  rc = -EPROTO;
1518  }
1519  /* Redirect to target QP if necessary */
1520  if ( qp != intended_qp ) {
1521  DBGC2 ( qib7322, "QIB7322 %p redirecting QPN "
1522  "%ld => %ld\n",
1523  qib7322, qp->qpn, intended_qp->qpn );
1524  /* Compensate for incorrect fill levels */
1525  qp->recv.fill--;
1526  intended_qp->recv.fill++;
1527  }
1528  ib_complete_recv ( ibdev, intended_qp, &dest, &source,
1529  iobuf, rc );
1530  } else {
1531  /* Completing on a skipped-over eager buffer */
1532  ib_complete_recv ( ibdev, qp, &dest, &source, iobuf,
1533  -ECANCELED );
1534  }
1535 
1536  /* Clear eager buffer */
1537  memset ( &rcvegr, 0, sizeof ( rcvegr ) );
1538  qib7322_writeq_array8b ( qib7322, &rcvegr,
1539  qib7322_wq->eager_array,
1540  qib7322_wq->eager_cons );
1541 
1542  /* Increment consumer index */
1543  qib7322_wq->eager_cons = ( ( qib7322_wq->eager_cons + 1 ) &
1544  ( qib7322_wq->eager_entries - 1 ) );
1545  }
1546 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:116
void * header
Receive header ring.
Definition: qib7322.c:84
unsigned int eager_cons
Eager array consumer index.
Definition: qib7322.c:96
#define qib7322_writeq_array8b(_qib7322, _ptr, _offset, _idx)
Definition: qib7322.c:175
int ib_pull(struct ib_device *ibdev, struct io_buffer *iobuf, struct ib_queue_pair **qp, size_t *payload_len, struct ib_address_vector *dest, struct ib_address_vector *source)
Remove IB headers.
Definition: ib_packet.c:133
#define DBGC(...)
Definition: compiler.h:505
struct ib_work_queue recv
Receive queue.
Definition: infiniband.h:180
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
Definition: iobuf.h:186
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
unsigned int eager_entries
Number of entries in eager array.
Definition: qib7322.c:92
unsigned int eager_prod
Eager array producer index.
Definition: qib7322.c:94
#define ECANCELED
Operation canceled.
Definition: errno.h:343
#define DBGCP_HDA(...)
Definition: compiler.h:540
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An Infiniband Work Queue.
Definition: infiniband.h:100
unsigned long qpn
Queue pair number.
Definition: infiniband.h:165
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
unsigned int num_wqes
Number of work queue entries.
Definition: infiniband.h:112
static void * dest
Definition: strings.h:176
#define EPROTO
Protocol error.
Definition: errno.h:624
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
Definition: iobuf.h:171
unsigned int fill
Number of occupied work queue entries.
Definition: infiniband.h:114
#define QIB7322_RECV_HEADER_SIZE
Maximum size of each RX header.
Definition: qib7322.h:293
uint8_t headers[IB_MAX_HEADER_SIZE]
Definition: arbel.h:14
A QIB7322 HCA.
Definition: qib7322.c:100
An Infiniband Queue Pair.
Definition: infiniband.h:157
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
#define DBGC2(...)
Definition: compiler.h:522
#define EIO
Input/output error.
Definition: errno.h:433
void ib_complete_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *dest, struct ib_address_vector *source, struct io_buffer *iobuf, int rc)
Complete receive work queue entry.
Definition: infiniband.c:536
An Infiniband Address Vector.
Definition: infiniband.h:72
A QIB7322 receive work queue.
Definition: qib7322.c:82
unsigned long eager_array
Offset within register space of the eager array.
Definition: qib7322.c:90
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:32
struct io_buffer ** iobufs
I/O buffers assigned to work queue.
Definition: infiniband.h:124

References assert(), BIT_GET, DBGC, DBGC2, DBGCP_HDA, dest, 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, headers, ib_complete_recv(), ib_get_drvdata(), ib_pull(), ib_wq_get_drvdata(), qib7322::ibdev, 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().

◆ qib7322_poll_recv_wq()

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.

1555  {
1556  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1557  struct ib_work_queue *wq = &qp->recv;
1558  struct qib7322_recv_work_queue *qib7322_wq = ib_wq_get_drvdata ( wq );
1559  struct QIB_7322_RcvHdrHead0 rcvhdrhead;
1560  unsigned int ctx = qib7322_ctx ( ibdev, qp );
1561  unsigned int header_prod;
1562 
1563  /* Check for received packets */
1564  header_prod = ( BIT_GET ( &qib7322_wq->header_prod, Value ) << 2 );
1565  if ( header_prod == qib7322_wq->header_cons )
1566  return;
1567 
1568  /* Process all received packets */
1569  while ( qib7322_wq->header_cons != header_prod ) {
1570 
1571  /* Complete the receive */
1572  qib7322_complete_recv ( ibdev, qp, qib7322_wq->header_cons );
1573 
1574  /* Increment the consumer offset */
1575  qib7322_wq->header_cons += QIB7322_RECV_HEADER_SIZE;
1576  qib7322_wq->header_cons %= QIB7322_RECV_HEADERS_SIZE;
1577 
1578  /* QIB7322 has only one send buffer per port for VL15,
1579  * which almost always leads to send buffer exhaustion
1580  * and dropped MADs. Mitigate this by refusing to
1581  * process more than one VL15 MAD per poll, which will
1582  * enforce interleaved TX/RX polls.
1583  */
1584  if ( qp->type == IB_QPT_SMI )
1585  break;
1586  }
1587 
1588  /* Update consumer offset */
1589  memset ( &rcvhdrhead, 0, sizeof ( rcvhdrhead ) );
1590  BIT_FILL_2 ( &rcvhdrhead,
1591  RcvHeadPointer, ( qib7322_wq->header_cons >> 2 ),
1592  counter, 1 );
1593  qib7322_writeq_array64k ( qib7322, &rcvhdrhead,
1595 }
static void qib7322_complete_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int header_offs)
Complete receive work queue entry.
Definition: qib7322.c:1391
#define QIB_7322_RcvHdrHead0_offset
#define qib7322_writeq_array64k(_qib7322, _ptr, _offset, _idx)
Definition: qib7322.c:177
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
An Infiniband Work Queue.
Definition: infiniband.h:100
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
Definition: infiniband.h:619
#define QIB7322_RECV_HEADERS_SIZE
Total size of an RX header ring.
Definition: qib7322.h:296
#define QIB7322_RECV_HEADER_SIZE
Maximum size of each RX header.
Definition: qib7322.h:293
static unsigned int qib7322_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Get queue pair context number.
Definition: qib7322.c:397
A QIB7322 HCA.
Definition: qib7322.c:100
struct QIB_7322_scalar header_prod
Receive header producer offset (written by hardware)
Definition: qib7322.c:86
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
#define BIT_FILL_2(_ptr, _field1,...)
Definition: pseudobit.h:190
unsigned int header_cons
Receive header consumer offset.
Definition: qib7322.c:88
A QIB7322 receive work queue.
Definition: qib7322.c:82
void * memset(void *dest, int character, size_t len) __nonnull

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(), qib7322::ibdev, memset(), qib7322_complete_recv(), qib7322_ctx(), QIB7322_RECV_HEADER_SIZE, QIB7322_RECV_HEADERS_SIZE, qib7322_writeq_array64k, QIB_7322_RcvHdrHead0_offset, and qp.

Referenced by qib7322_poll_cq().

◆ qib7322_poll_cq()

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.

1604  {
1605  struct ib_work_queue *wq;
1606 
1607  /* Poll associated send and receive queues */
1608  list_for_each_entry ( wq, &cq->work_queues, list ) {
1609  if ( wq->is_send ) {
1610  qib7322_poll_send_wq ( ibdev, wq->qp );
1611  } else {
1612  qib7322_poll_recv_wq ( ibdev, wq->qp );
1613  }
1614  }
1615 }
static void qib7322_poll_send_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Poll send work queue.
Definition: qib7322.c:1279
struct ib_completion_queue * cq
Associated completion queue.
Definition: infiniband.h:106
An Infiniband Work Queue.
Definition: infiniband.h:100
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:420
struct list_head work_queues
List of work queues completing to this queue.
Definition: infiniband.h:242
static void qib7322_poll_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Poll receive work queue.
Definition: qib7322.c:1554
struct ib_queue_pair * qp
Containing queue pair.
Definition: infiniband.h:102
struct list_head list
List of work queues on this completion queue.
Definition: infiniband.h:108
int is_send
"Is a send queue" flag
Definition: infiniband.h:104

References ib_work_queue::cq, 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.

◆ qib7322_poll_eq()

static void qib7322_poll_eq ( struct ib_device ibdev)
static

Poll event queue.

Parameters
ibdevInfiniband device

Definition at line 1629 of file qib7322.c.

1629  {
1630  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1631  struct QIB_7322_ErrStatus_0 errstatus;
1632  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
1633 
1634  /* Check for and clear status bits */
1635  DBG_DISABLE ( DBGLVL_IO );
1636  qib7322_readq_port ( qib7322, &errstatus,
1638  if ( errstatus.u.qwords[0] ) {
1639  DBGC ( qib7322, "QIB7322 %p port %d status %08x%08x\n", qib7322,
1640  port, errstatus.u.dwords[1], errstatus.u.dwords[0] );
1641  qib7322_writeq_port ( qib7322, &errstatus,
1643  }
1644  DBG_ENABLE ( DBGLVL_IO );
1645 
1646  /* Check for link status changes */
1647  if ( BIT_GET ( &errstatus, IBStatusChanged ) )
1648  qib7322_link_state_changed ( ibdev );
1649 }
#define DBGLVL_IO
Definition: compiler.h:322
#define QIB_7322_ErrClear_0_offset
#define qib7322_writeq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:179
#define DBG_ENABLE(level)
Definition: compiler.h:313
#define DBGC(...)
Definition: compiler.h:505
#define DBG_DISABLE(level)
Definition: compiler.h:312
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
unsigned int port
Port number.
Definition: infiniband.h:418
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:159
A QIB7322 HCA.
Definition: qib7322.c:100
#define QIB_7322_ErrStatus_0_offset
static void qib7322_link_state_changed(struct ib_device *ibdev)
Handle link state change.
Definition: qib7322.c:223

References BIT_GET, DBG_DISABLE, DBG_ENABLE, DBGC, DBGLVL_IO, ib_get_drvdata(), qib7322::ibdev, port, ib_device::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.

◆ qib7322_link_speed_supported()

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.

1665  {
1667  struct QIB_7322_Revision revision;
1668  unsigned int supported;
1669  unsigned int boardid;
1670 
1671  /* Read the active feature mask */
1674  switch ( port ) {
1675  case 0 :
1676  supported = BIT_GET ( &features, Port0_Link_Speed_Supported );
1677  break;
1678  case 1 :
1679  supported = BIT_GET ( &features, Port1_Link_Speed_Supported );
1680  break;
1681  default:
1682  DBGC ( qib7322, "QIB7322 %p port %d is invalid\n",
1683  qib7322, port );
1684  supported = 0;
1685  break;
1686  }
1687 
1688  /* Apply hacks for specific board IDs */
1690  boardid = BIT_GET ( &revision, BoardID );
1691  switch ( boardid ) {
1692  case QIB7322_BOARD_QMH7342 :
1693  DBGC2 ( qib7322, "QIB7322 %p is a QMH7342; forcing QDR-only\n",
1694  qib7322 );
1695  supported = IB_LINK_SPEED_QDR;
1696  break;
1697  default:
1698  /* Do nothing */
1699  break;
1700  }
1701 
1702  DBGC2 ( qib7322, "QIB7322 %p port %d %s%s%s%s\n", qib7322, port,
1703  ( supported ? "supports" : "disabled" ),
1704  ( ( supported & IB_LINK_SPEED_SDR ) ? " SDR" : "" ),
1705  ( ( supported & IB_LINK_SPEED_DDR ) ? " DDR" : "" ),
1706  ( ( supported & IB_LINK_SPEED_QDR ) ? " QDR" : "" ) );
1707  return supported;
1708 }
#define IB_LINK_SPEED_QDR
Definition: ib_mad.h:146
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define DBGC(...)
Definition: compiler.h:505
#define IB_LINK_SPEED_SDR
Definition: ib_mad.h:144
#define QIB_7322_Revision_offset
Definition: qib_7322_regs.h:38
u8 port
Port number.
Definition: CIB_PRM.h:31
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
uint32_t revision
Definition: ib_mad.h:20
uint32_t features
Supported features.
Definition: ena.h:16
A QIB7322 HCA.
Definition: qib7322.c:100
#define DBGC2(...)
Definition: compiler.h:522
#define IB_LINK_SPEED_DDR
Definition: ib_mad.h:145
#define QIB_7322_active_feature_mask_offset

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

Referenced by qib7322_probe().

◆ qib7322_open()

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.

1716  {
1717  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1718  struct QIB_7322_IBCCtrlA_0 ibcctrla;
1719  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
1720 
1721  /* Enable link */
1722  qib7322_readq_port ( qib7322, &ibcctrla,
1724  BIT_SET ( &ibcctrla, IBLinkEn, 1 );
1725  qib7322_writeq_port ( qib7322, &ibcctrla,
1727 
1728  return 0;
1729 }
#define qib7322_writeq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:179
#define BIT_SET(_ptr, _field, _value)
Definition: pseudobit.h:238
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
#define QIB_7322_IBCCtrlA_0_offset
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
unsigned int port
Port number.
Definition: infiniband.h:418
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:159
A QIB7322 HCA.
Definition: qib7322.c:100

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

◆ qib7322_close()

static void qib7322_close ( struct ib_device ibdev)
static

Close Infiniband link.

Parameters
ibdevInfiniband device

Definition at line 1736 of file qib7322.c.

1736  {
1737  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1738  struct QIB_7322_IBCCtrlA_0 ibcctrla;
1739  unsigned int port = ( ibdev->port - QIB7322_PORT_BASE );
1740 
1741  /* Disable link */
1742  qib7322_readq_port ( qib7322, &ibcctrla,
1744  BIT_SET ( &ibcctrla, IBLinkEn, 0 );
1745  qib7322_writeq_port ( qib7322, &ibcctrla,
1747 }
#define qib7322_writeq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:179
#define BIT_SET(_ptr, _field, _value)
Definition: pseudobit.h:238
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
#define QIB_7322_IBCCtrlA_0_offset
u8 port
Port number.
Definition: CIB_PRM.h:31
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
unsigned int port
Port number.
Definition: infiniband.h:418
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
Definition: qib7322.c:159
A QIB7322 HCA.
Definition: qib7322.c:100

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

◆ qib7322_mcast_attach()

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.

1766  {
1767  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1768 
1769  ( void ) qib7322;
1770  ( void ) qp;
1771  ( void ) gid;
1772  return 0;
1773 }
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
u8 gid[16]
Definition: CIB_PRM.h:31

References gid, ib_get_drvdata(), qib7322::ibdev, and qp.

◆ qib7322_mcast_detach()

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.

1784  {
1785  struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1786 
1787  ( void ) qib7322;
1788  ( void ) qp;
1789  ( void ) gid;
1790  }
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
A QIB7322 HCA.
Definition: qib7322.c:100
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
u8 gid[16]
Definition: CIB_PRM.h:31

References gid, ib_get_drvdata(), qib7322::ibdev, and qp.

◆ qib7322_i2c_read_bit()

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.

1833  {
1834  struct qib7322 *qib7322 =
1835  container_of ( basher, struct qib7322, i2c.basher );
1836  struct QIB_7322_EXTStatus extstatus;
1837  unsigned int status;
1838 
1839  DBG_DISABLE ( DBGLVL_IO );
1840 
1842  status = ( BIT_GET ( &extstatus, GPIOIn ) & qib7322_i2c_bits[bit_id] );
1843 
1844  DBG_ENABLE ( DBGLVL_IO );
1845 
1846  return status;
1847 }
#define DBGLVL_IO
Definition: compiler.h:322
#define DBG_ENABLE(level)
Definition: compiler.h:313
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define DBG_DISABLE(level)
Definition: compiler.h:312
static unsigned int qib7322_i2c_bits[]
QIB7322 I2C bit to GPIO mappings.
Definition: qib7322.c:1819
uint8_t status
Status.
Definition: ena.h:16
struct i2c_bit_basher i2c
I2C bit-bashing interface.
Definition: qib7322.c:121
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
struct bit_basher basher
Bit-bashing interface.
Definition: i2c.h:95
A QIB7322 HCA.
Definition: qib7322.c:100
#define QIB_7322_EXTStatus_offset

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.

◆ qib7322_i2c_write_bit()

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.

1857  {
1858  struct qib7322 *qib7322 =
1859  container_of ( basher, struct qib7322, i2c.basher );
1860  struct QIB_7322_EXTCtrl extctrl;
1861  struct QIB_7322_GPIO gpioout;
1862  unsigned int bit = qib7322_i2c_bits[bit_id];
1863  unsigned int outputs = 0;
1864  unsigned int output_enables = 0;
1865 
1866  DBG_DISABLE ( DBGLVL_IO );
1867 
1868  /* Read current GPIO mask and outputs */
1871 
1872  /* Update outputs and output enables. I2C lines are tied
1873  * high, so we always set the output to 0 and use the output
1874  * enable to control the line.
1875  */
1876  output_enables = BIT_GET ( &extctrl, GPIOOe );
1877  output_enables = ( ( output_enables & ~bit ) | ( ~data & bit ) );
1878  outputs = BIT_GET ( &gpioout, GPIO );
1879  outputs = ( outputs & ~bit );
1880  BIT_SET ( &extctrl, GPIOOe, output_enables );
1881  BIT_SET ( &gpioout, GPIO, outputs );
1882 
1883  /* Write the output enable first; that way we avoid logic
1884  * hazards.
1885  */
1888  mb();
1889 
1890  DBG_ENABLE ( DBGLVL_IO );
1891 }
#define DBGLVL_IO
Definition: compiler.h:322
static unsigned int unsigned int bit
Definition: bigint.h:205
#define DBG_ENABLE(level)
Definition: compiler.h:313
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define QIB_7322_GPIOOut_offset
#define DBG_DISABLE(level)
Definition: compiler.h:312
#define BIT_SET(_ptr, _field, _value)
Definition: pseudobit.h:238
static unsigned int qib7322_i2c_bits[]
QIB7322 I2C bit to GPIO mappings.
Definition: qib7322.c:1819
struct i2c_bit_basher i2c
I2C bit-bashing interface.
Definition: qib7322.c:121
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
struct bit_basher basher
Bit-bashing interface.
Definition: i2c.h:95
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
#define QIB_7322_EXTCtrl_offset
A QIB7322 HCA.
Definition: qib7322.c:100
void mb(void)
Memory barrier.
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12

References i2c_bit_basher::basher, bit, BIT_GET, BIT_SET, container_of, data, 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.

◆ qib7322_init_i2c()

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.

1905  {
1906  static int try_eeprom_address[] = { 0x51, 0x50 };
1907  unsigned int i;
1908  int rc;
1909 
1910  /* Initialise bus */
1911  if ( ( rc = init_i2c_bit_basher ( &qib7322->i2c,
1912  &qib7322_i2c_basher_ops ) ) != 0 ) {
1913  DBGC ( qib7322, "QIB7322 %p could not initialise I2C bus: %s\n",
1914  qib7322, strerror ( rc ) );
1915  return rc;
1916  }
1917 
1918  /* Probe for devices */
1919  for ( i = 0 ; i < ( sizeof ( try_eeprom_address ) /
1920  sizeof ( try_eeprom_address[0] ) ) ; i++ ) {
1921  init_i2c_eeprom ( &qib7322->eeprom, try_eeprom_address[i] );
1922  if ( ( rc = i2c_check_presence ( &qib7322->i2c.i2c,
1923  &qib7322->eeprom ) ) == 0 ) {
1924  DBGC2 ( qib7322, "QIB7322 %p found EEPROM at %02x\n",
1925  qib7322, try_eeprom_address[i] );
1926  return 0;
1927  }
1928  }
1929 
1930  DBGC ( qib7322, "QIB7322 %p could not find EEPROM\n", qib7322 );
1931  return -ENODEV;
1932 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int i2c_check_presence(struct i2c_interface *i2c, struct i2c_device *i2cdev)
Check presence of I2C device.
Definition: i2c.h:135
#define DBGC(...)
Definition: compiler.h:505
static struct bit_basher_operations qib7322_i2c_basher_ops
QIB7322 I2C bit-bashing interface operations.
Definition: qib7322.c:1894
struct i2c_device eeprom
I2C serial EEPROM.
Definition: qib7322.c:123
static __always_inline void init_i2c_eeprom(struct i2c_device *i2cdev, unsigned int dev_addr)
Initialise generic I2C EEPROM device.
Definition: i2c.h:149
struct i2c_bit_basher i2c
I2C bit-bashing interface.
Definition: qib7322.c:121
struct i2c_interface i2c
I2C interface.
Definition: i2c.h:93
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define ENODEV
No such device.
Definition: errno.h:509
A QIB7322 HCA.
Definition: qib7322.c:100
#define DBGC2(...)
Definition: compiler.h:522
int init_i2c_bit_basher(struct i2c_bit_basher *i2cbit, struct bit_basher_operations *bash_op)
Initialise I2C bit-bashing interface.
Definition: i2c_bit.c:387

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

Referenced by qib7322_probe().

◆ qib7322_read_eeprom()

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.

1940  {
1941  struct i2c_interface *i2c = &qib7322->i2c.i2c;
1942  union ib_guid *guid = &qib7322->guid;
1943  int rc;
1944 
1945  /* Read GUID */
1946  if ( ( rc = i2c->read ( i2c, &qib7322->eeprom,
1948  sizeof ( *guid ) ) ) != 0 ) {
1949  DBGC ( qib7322, "QIB7322 %p could not read GUID: %s\n",
1950  qib7322, strerror ( rc ) );
1951  return rc;
1952  }
1953  DBGC2 ( qib7322, "QIB7322 %p has GUID " IB_GUID_FMT "\n",
1954  qib7322, IB_GUID_ARGS ( guid ) );
1955 
1956  /* Read serial number (debug only) */
1957  if ( DBG_LOG ) {
1959 
1960  serial[ sizeof ( serial ) - 1 ] = '\0';
1961  if ( ( rc = i2c->read ( i2c, &qib7322->eeprom,
1963  ( sizeof ( serial ) - 1 ) ) ) != 0 ) {
1964  DBGC ( qib7322, "QIB7322 %p could not read serial: "
1965  "%s\n", qib7322, strerror ( rc ) );
1966  return rc;
1967  }
1968  DBGC2 ( qib7322, "QIB7322 %p has serial number \"%s\"\n",
1969  qib7322, serial );
1970  }
1971 
1972  return 0;
1973 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define DBGC(...)
Definition: compiler.h:505
#define QIB7322_EEPROM_GUID_OFFSET
GUID offset within EEPROM.
Definition: qib7322.h:193
#define IB_GUID_ARGS(guid)
Infiniband Globally Unique Identifier debug message arguments.
Definition: ib_packet.h:29
An I2C interface.
Definition: i2c.h:57
struct i2c_device eeprom
I2C serial EEPROM.
Definition: qib7322.c:123
#define QIB7322_EEPROM_SERIAL_OFFSET
Board serial number offset within EEPROM.
Definition: qib7322.h:199
#define IB_GUID_FMT
Infiniband Globally Unique Identifier debug message format.
Definition: ib_packet.h:26
struct i2c_bit_basher i2c
I2C bit-bashing interface.
Definition: qib7322.c:121
struct i2c_interface i2c
I2C interface.
Definition: i2c.h:93
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
An Infiniband Globally Unique Identifier.
Definition: ib_packet.h:18
uint64_t serial
Serial number.
Definition: edd.h:30
unsigned char uint8_t
Definition: stdint.h:10
int(* read)(struct i2c_interface *i2c, struct i2c_device *i2cdev, unsigned int offset, uint8_t *data, unsigned int len)
Read data from I2C device.
Definition: i2c.h:68
A QIB7322 HCA.
Definition: qib7322.c:100
uint64_t guid
GUID.
Definition: edd.h:30
#define DBGC2(...)
Definition: compiler.h:522
#define QIB7322_EEPROM_SERIAL_SIZE
Board serial number size within EEPROM.
Definition: qib7322.h:202
union ib_guid guid
Base GUID.
Definition: qib7322.c:126
#define DBG_LOG
Definition: compiler.h:317

References DBG_LOG, DBGC, DBGC2, qib7322::eeprom, guid, qib7322::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().

◆ qib7322_ahb_wait()

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.

1988  {
1989  struct QIB_7322_ahb_transaction_reg transaction;
1990  unsigned int i;
1991 
1992  /* Wait for Ready bit to be asserted */
1993  for ( i = 0 ; i < QIB7322_AHB_MAX_WAIT_US ; i++ ) {
1994  qib7322_readq ( qib7322, &transaction,
1996  if ( BIT_GET ( &transaction, ahb_rdy ) )
1997  return 0;
1998  udelay ( 1 );
1999  }
2000 
2001  DBGC ( qib7322, "QIB7322 %p timed out waiting for AHB transaction\n",
2002  qib7322 );
2003  return -ETIMEDOUT;
2004 }
#define QIB7322_AHB_MAX_WAIT_US
Maximum time for wait for AHB, in us.
Definition: qib7322.h:337
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define DBGC(...)
Definition: compiler.h:505
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
#define QIB_7322_ahb_transaction_reg_offset
A QIB7322 HCA.
Definition: qib7322.c:100
#define ETIMEDOUT
Connection timed out.
Definition: errno.h:669

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

◆ qib7322_ahb_request()

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.

2014  {
2015  struct QIB_7322_ahb_access_ctrl access;
2016  int rc;
2017 
2018  /* Request ownership */
2019  memset ( &access, 0, sizeof ( access ) );
2020  BIT_FILL_2 ( &access,
2021  sw_ahb_sel, 1,
2022  sw_sel_ahb_trgt, QIB7322_AHB_LOC_TARGET ( location ) );
2024 
2025  /* Wait for ownership to be granted */
2026  if ( ( rc = qib7322_ahb_wait ( qib7322 ) ) != 0 ) {
2027  DBGC ( qib7322, "QIB7322 %p could not obtain AHB ownership: "
2028  "%s\n", qib7322, strerror ( rc ) );
2029  return rc;
2030  }
2031 
2032  return 0;
2033 }
#define QIB_7322_ahb_access_ctrl_offset
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define DBGC(...)
Definition: compiler.h:505
#define QIB7322_AHB_LOC_TARGET(_location)
Definition: qib7322.h:341
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
A QIB7322 HCA.
Definition: qib7322.c:100
static int qib7322_ahb_wait(struct qib7322 *qib7322)
Wait for AHB transaction to complete.
Definition: qib7322.c:1988
#define BIT_FILL_2(_ptr, _field1,...)
Definition: pseudobit.h:190
void * memset(void *dest, int character, size_t len) __nonnull

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

◆ qib7322_ahb_release()

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.

2040  {
2041  struct QIB_7322_ahb_access_ctrl access;
2042 
2043  memset ( &access, 0, sizeof ( access ) );
2045 }
#define QIB_7322_ahb_access_ctrl_offset
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
A QIB7322 HCA.
Definition: qib7322.c:100
void * memset(void *dest, int character, size_t len) __nonnull

References memset(), qib7322_writeq, and QIB_7322_ahb_access_ctrl_offset.

Referenced by qib7322_ahb_mod_reg().

◆ qib7322_ahb_read()

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.

2058  {
2060  int rc;
2061 
2062  /* Avoid returning uninitialised data on error */
2063  *data = 0;
2064 
2065  /* Initiate transaction */
2066  memset ( &xact, 0, sizeof ( xact ) );
2067  BIT_FILL_2 ( &xact,
2068  ahb_address, QIB7322_AHB_LOC_ADDRESS ( location ),
2069  write_not_read, 0 );
2071 
2072  /* Wait for transaction to complete */
2073  if ( ( rc = qib7322_ahb_wait ( qib7322 ) ) != 0 )
2074  return rc;
2075 
2076  /* Read transaction data */
2078  *data = BIT_GET ( &xact, ahb_data );
2079  return 0;
2080 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
#define QIB_7322_ahb_transaction_reg_offset
A QIB7322 HCA.
Definition: qib7322.c:100
static int qib7322_ahb_wait(struct qib7322 *qib7322)
Wait for AHB transaction to complete.
Definition: qib7322.c:1988
#define QIB7322_AHB_LOC_ADDRESS(_location)
QIB7322 AHB locations.
Definition: qib7322.h:340
uint32_t xact
Requester transaction ID.
Definition: eth_slow.h:18
#define BIT_FILL_2(_ptr, _field1,...)
Definition: pseudobit.h:190
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
void * memset(void *dest, int character, size_t len) __nonnull

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

Referenced by qib7322_ahb_mod_reg().

◆ qib7322_ahb_write()

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.

2093  {
2095  int rc;
2096 
2097  /* Initiate transaction */
2098  memset ( &xact, 0, sizeof ( xact ) );
2099  BIT_FILL_3 ( &xact,
2100  ahb_address, QIB7322_AHB_LOC_ADDRESS ( location ),
2101  write_not_read, 1,
2102  ahb_data, data );
2104 
2105  /* Wait for transaction to complete */
2106  if ( ( rc = qib7322_ahb_wait ( qib7322 ) ) != 0 )
2107  return rc;
2108 
2109  return 0;
2110 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define BIT_FILL_3(_ptr, _field1,...)
Definition: pseudobit.h:195
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
#define QIB_7322_ahb_transaction_reg_offset
A QIB7322 HCA.
Definition: qib7322.c:100
static int qib7322_ahb_wait(struct qib7322 *qib7322)
Wait for AHB transaction to complete.
Definition: qib7322.c:1988
#define QIB7322_AHB_LOC_ADDRESS(_location)
QIB7322 AHB locations.
Definition: qib7322.h:340
uint32_t xact
Requester transaction ID.
Definition: eth_slow.h:18
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
void * memset(void *dest, int character, size_t len) __nonnull

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

Referenced by qib7322_ahb_mod_reg().

◆ qib7322_ahb_mod_reg()

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.

2122  {
2123  uint32_t old_value;
2124  uint32_t new_value;
2125  int rc;
2126 
2127  DBG_DISABLE ( DBGLVL_IO );
2128 
2129  /* Sanity check */
2130  assert ( ( value & mask ) == value );
2131 
2132  /* Acquire bus ownership */
2133  if ( ( rc = qib7322_ahb_request ( qib7322, location ) ) != 0 )
2134  goto out;
2135 
2136  /* Read existing value */
2137  if ( ( rc = qib7322_ahb_read ( qib7322, location, &old_value ) ) != 0 )
2138  goto out_release;
2139 
2140  /* Update value */
2141  new_value = ( ( old_value & ~mask ) | value );
2142  DBGCP ( qib7322, "QIB7322 %p AHB %x %#08x => %#08x\n",
2143  qib7322, location, old_value, new_value );
2144  if ( ( rc = qib7322_ahb_write ( qib7322, location, new_value ) ) != 0 )
2145  goto out_release;
2146 
2147  out_release:
2148  /* Release bus */
2150  out:
2151  DBG_ENABLE ( DBGLVL_IO );
2152  return rc;
2153 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define DBGLVL_IO
Definition: compiler.h:322
#define DBG_ENABLE(level)
Definition: compiler.h:313
#define DBG_DISABLE(level)
Definition: compiler.h:312
static int qib7322_ahb_write(struct qib7322 *qib7322, unsigned int location, uint32_t data)
Write data via AHB.
Definition: qib7322.c:2092
static int qib7322_ahb_read(struct qib7322 *qib7322, unsigned int location, uint32_t *data)
Read data via AHB.
Definition: qib7322.c:2057
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void qib7322_ahb_release(struct qib7322 *qib7322)
Release ownership of the AHB.
Definition: qib7322.c:2040
__be32 out[4]
Definition: CIB_PRM.h:36
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
unsigned int uint32_t
Definition: stdint.h:12
static int qib7322_ahb_request(struct qib7322 *qib7322, unsigned int location)
Request ownership of the AHB.
Definition: qib7322.c:2013
A QIB7322 HCA.
Definition: qib7322.c:100
#define DBGCP(...)
Definition: compiler.h:539

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

Referenced by qib7322_ahb_mod_reg_all().

◆ qib7322_ahb_mod_reg_all()

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.

2165  {
2166  unsigned int port;
2167  unsigned int channel;
2168  unsigned int location;
2169  int rc;
2170 
2171  for ( port = 0 ; port < QIB7322_MAX_PORTS ; port++ ) {
2172  for ( channel = 0 ; channel < QIB7322_MAX_WIDTH ; channel++ ) {
2173  location = QIB7322_AHB_LOCATION ( port, channel, reg );
2174  if ( ( rc = qib7322_ahb_mod_reg ( qib7322, location,
2175  value, mask ) ) != 0 )
2176  return rc;
2177  }
2178  }
2179  return 0;
2180 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int qib7322_ahb_mod_reg(struct qib7322 *qib7322, unsigned int location, uint32_t value, uint32_t mask)
Read/modify/write AHB register.
Definition: qib7322.c:2121
u8 port
Port number.
Definition: CIB_PRM.h:31
uint32_t channel
RNDIS channel.
Definition: netvsc.h:14
#define QIB7322_AHB_LOCATION(_port, _channel, _register)
Definition: qib7322.h:352
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
static unsigned int unsigned int reg
Definition: intel.h:245
#define QIB7322_MAX_PORTS
QIB7322 maximum number of ports.
Definition: qib7322.h:169
A QIB7322 HCA.
Definition: qib7322.c:100
#define QIB7322_MAX_WIDTH
QIB7322 maximum width.
Definition: qib7322.h:172

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

Referenced by qib7322_init_ib_serdes().

◆ qib7322_init_ib_serdes()

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.

2195  {
2196  struct QIB_7322_IBCCtrlA_0 ibcctrla;
2197  struct QIB_7322_IBCCtrlB_0 ibcctrlb;
2198  struct QIB_7322_IBPCSConfig_0 ibpcsconfig;
2199 
2200  /* Configure sensible defaults for IBC */
2201  memset ( &ibcctrla, 0, sizeof ( ibcctrla ) );
2202  BIT_FILL_5 ( &ibcctrla, /* Tuning values taken from Linux driver */
2203  FlowCtrlPeriod, 0x03,
2204  FlowCtrlWaterMark, 0x05,
2205  MaxPktLen, ( ( QIB7322_RECV_HEADER_SIZE +
2207  4 /* ICRC */ ) >> 2 ),
2208  PhyerrThreshold, 0xf,
2209  OverrunThreshold, 0xf );
2212 
2213  /* Force SDR only to avoid needing all the DDR tuning,
2214  * Mellanox compatibility hacks etc. SDR is plenty for
2215  * boot-time operation.
2216  */
2218  BIT_SET ( &ibcctrlb, IB_ENHANCED_MODE, 0 );
2219  BIT_SET ( &ibcctrlb, SD_SPEED_SDR, 1 );
2220  BIT_SET ( &ibcctrlb, SD_SPEED_DDR, 0 );
2221  BIT_SET ( &ibcctrlb, SD_SPEED_QDR, 0 );
2222  BIT_SET ( &ibcctrlb, IB_NUM_CHANNELS, 1 ); /* 4X only */
2223  BIT_SET ( &ibcctrlb, IB_LANE_REV_SUPPORTED, 0 );
2224  BIT_SET ( &ibcctrlb, HRTBT_ENB, 0 );
2225  BIT_SET ( &ibcctrlb, HRTBT_AUTO, 0 );
2228 
2229  /* Tune SerDes */
2230  qib7322_ahb_mod_reg_all ( qib7322, 2, 0, 0x00000e00UL );
2231 
2232  /* Bring XGXS out of reset */
2233  memset ( &ibpcsconfig, 0, sizeof ( ibpcsconfig ) );
2236 
2237  return 0;
2238 }
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.
Definition: qib7322.c:2164
#define BIT_FILL_5(_ptr, _field1,...)
Definition: pseudobit.h:205
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define BIT_SET(_ptr, _field, _value)
Definition: pseudobit.h:238
#define QIB_7322_IBCCtrlA_0_offset
#define QIB_7322_IBPCSConfig_0_offset
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
#define QIB_7322_IBCCtrlA_1_offset
#define QIB7322_RECV_HEADER_SIZE
Maximum size of each RX header.
Definition: qib7322.h:293
#define QIB_7322_IBCCtrlB_0_offset
A QIB7322 HCA.
Definition: qib7322.c:100
#define QIB_7322_IBCCtrlB_1_offset
#define QIB_7322_IBPCSConfig_1_offset
#define QIB7322_RECV_PAYLOAD_SIZE
RX payload size.
Definition: qib7322.h:306
void * memset(void *dest, int character, size_t len) __nonnull

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

◆ qib7322_reset()

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.

2254  {
2255  struct QIB_7322_Control control;
2256  struct pci_config_backup backup;
2257 
2258  /* Back up PCI configuration space */
2259  pci_backup ( pci, &backup, NULL );
2260 
2261  /* Assert reset */
2262  memset ( &control, 0, sizeof ( control ) );
2263  BIT_FILL_1 ( &control, SyncReset, 1 );
2265 
2266  /* Wait for reset to complete */
2267  mdelay ( 1000 );
2268 
2269  /* Restore PCI configuration space */
2270  pci_restore ( pci, &backup, NULL );
2271 }
void pci_backup(struct pci_device *pci, struct pci_config_backup *backup, const uint8_t *exclude)
Back up PCI configuration space.
Definition: pcibackup.c:66
#define QIB_7322_Control_offset
Definition: qib_7322_regs.h:54
#define qib7322_writeq(_qib7322, _ptr, _offset)
Definition: qib7322.c:173
A PCI configuration space backup.
Definition: pcibackup.h:15
uint32_t control
Control.
Definition: myson.h:14
A QIB7322 HCA.
Definition: qib7322.c:100
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:78
void pci_restore(struct pci_device *pci, struct pci_config_backup *backup, const uint8_t *exclude)
Restore PCI configuration space.
Definition: pcibackup.c:85
#define BIT_FILL_1(_ptr, _field1,...)
Definition: pseudobit.h:185
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
void * memset(void *dest, int character, size_t len) __nonnull

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

Referenced by qib7322_probe().

◆ qib7322_probe()

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.

2280  {
2281  struct qib7322 *qib7322;
2282  struct QIB_7322_Revision revision;
2283  struct ib_device *ibdev;
2284  unsigned int link_speed_supported;
2285  int i;
2286  int rc;
2287 
2288  /* Allocate QIB7322 device */
2289  qib7322 = zalloc ( sizeof ( *qib7322 ) );
2290  if ( ! qib7322 ) {
2291  rc = -ENOMEM;
2292  goto err_alloc_qib7322;
2293  }
2294  pci_set_drvdata ( pci, qib7322 );
2295 
2296  /* Fix up PCI device */
2297  adjust_pci_device ( pci );
2298 
2299  /* Map PCI BARs */
2301  DBGC2 ( qib7322, "QIB7322 %p has BAR at %08lx\n",
2302  qib7322, pci->membase );
2303 
2304  /* Reset device */
2305  qib7322_reset ( qib7322, pci );
2306 
2307  /* Print some general data */
2309  DBGC2 ( qib7322, "QIB7322 %p board %02lx v%ld.%ld.%ld.%ld\n", qib7322,
2310  BIT_GET ( &revision, BoardID ),
2311  BIT_GET ( &revision, R_SW ),
2312  BIT_GET ( &revision, R_Arch ),
2313  BIT_GET ( &revision, R_ChipRevMajor ),
2314  BIT_GET ( &revision, R_ChipRevMinor ) );
2315 
2316  /* Initialise I2C subsystem */
2317  if ( ( rc = qib7322_init_i2c ( qib7322 ) ) != 0 )
2318  goto err_init_i2c;
2319 
2320  /* Read EEPROM parameters */
2321  if ( ( rc = qib7322_read_eeprom ( qib7322 ) ) != 0 )
2322  goto err_read_eeprom;
2323 
2324  /* Initialise send datapath */
2325  if ( ( rc = qib7322_init_send ( qib7322 ) ) != 0 )
2326  goto err_init_send;
2327 
2328  /* Initialise receive datapath */
2329  if ( ( rc = qib7322_init_recv ( qib7322 ) ) != 0 )
2330  goto err_init_recv;
2331 
2332  /* Initialise the IB SerDes */
2333  if ( ( rc = qib7322_init_ib_serdes ( qib7322 ) ) != 0 )
2334  goto err_init_ib_serdes;
2335 
2336  /* Allocate Infiniband devices */
2337  for ( i = 0 ; i < QIB7322_MAX_PORTS ; i++ ) {
2340  if ( ! link_speed_supported )
2341  continue;
2342  ibdev = alloc_ibdev ( 0 );
2343  if ( ! ibdev ) {
2344  rc = -ENOMEM;
2345  goto err_alloc_ibdev;
2346  }
2347  qib7322->ibdev[i] = ibdev;
2348  ibdev->dev = &pci->dev;
2349  ibdev->op = &qib7322_ib_operations;
2350  ibdev->port = ( QIB7322_PORT_BASE + i );
2351  ibdev->link_width_enabled = ibdev->link_width_supported =
2352  IB_LINK_WIDTH_4X; /* 1x does not work */
2353  ibdev->link_speed_enabled = ibdev->link_speed_supported =
2354  IB_LINK_SPEED_SDR; /* to avoid need for link tuning */
2355  memcpy ( &ibdev->node_guid, &qib7322->guid,
2356  sizeof ( ibdev->node_guid ) );
2357  memcpy ( &ibdev->gid.s.guid, &qib7322->guid,
2358  sizeof ( ibdev->gid.s.guid ) );
2359  assert ( ( ibdev->gid.s.guid.bytes[7] & i ) == 0 );
2360  ibdev->gid.s.guid.bytes[7] |= i;
2361  ib_set_drvdata ( ibdev, qib7322 );
2362  }
2363 
2364  /* Register Infiniband devices */
2365  for ( i = 0 ; i < QIB7322_MAX_PORTS ; i++ ) {
2366  if ( ! qib7322->ibdev[i] )
2367  continue;
2368  if ( ( rc = register_ibdev ( qib7322->ibdev[i] ) ) != 0 ) {
2369  DBGC ( qib7322, "QIB7322 %p port %d could not register "
2370  "IB device: %s\n", qib7322, i, strerror ( rc ) );
2371  goto err_register_ibdev;
2372  }
2373  }
2374 
2375  return 0;
2376 
2377  i = QIB7322_MAX_PORTS;
2378  err_register_ibdev:
2379  for ( i-- ; i >= 0 ; i-- ) {
2380  if ( qib7322->ibdev[i] )
2381  unregister_ibdev ( qib7322->ibdev[i] );
2382  }
2383  i = QIB7322_MAX_PORTS;
2384  err_alloc_ibdev:
2385  for ( i-- ; i >= 0 ; i-- )
2386  ibdev_put ( qib7322->ibdev[i] );
2387  err_init_ib_serdes:
2389  err_init_send:
2391  err_init_recv:
2392  err_read_eeprom:
2393  err_init_i2c:
2394  iounmap ( qib7322->regs );
2395  free ( qib7322 );
2396  err_alloc_qib7322:
2397  return rc;
2398 }
void unregister_ibdev(struct ib_device *ibdev)
Unregister Infiniband device.
Definition: infiniband.c:1005
static __always_inline void ib_set_drvdata(struct ib_device *ibdev, void *priv)
Set Infiniband device driver-private data.
Definition: infiniband.h:696
unsigned long membase
Memory base.
Definition: pci.h:194
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
union ib_guid guid
Definition: ib_packet.h:40
union ib_gid gid
Port GID (comprising GID prefix and port GUID)
Definition: infiniband.h:439
static struct ib_device_operations qib7322_ib_operations
QIB7322 Infiniband operations.
Definition: qib7322.c:1793
#define qib7322_readq(_qib7322, _ptr, _offset)
Definition: qib7322.c:153
#define DBGC(...)
Definition: compiler.h:505
#define IB_LINK_SPEED_SDR
Definition: ib_mad.h:144
struct device * dev
Underlying device.
Definition: infiniband.h:410
uint8_t link_speed_enabled
Link speed enabled.
Definition: infiniband.h:433
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition: pci.c:149
static int qib7322_init_ib_serdes(struct qib7322 *qib7322)
Initialise the IB SerDes.
Definition: qib7322.c:2195
struct device dev
Generic device.
Definition: pci.h:189
uint8_t link_width_enabled
Link width enabled.
Definition: infiniband.h:427
uint8_t link_width_supported
Link width supported.
Definition: infiniband.h:425
#define QIB_7322_Revision_offset
Definition: qib_7322_regs.h:38
An Infiniband device.
Definition: infiniband.h:398
#define IB_LINK_WIDTH_4X
Definition: ib_mad.h:140
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition: pci.h:338
#define ENOMEM
Not enough space.
Definition: errno.h:534
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int qib7322_init_send(struct qib7322 *qib7322)
Initialise send datapath.
Definition: qib7322.c:623
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
struct ib_device_operations * op
Infiniband operations.
Definition: infiniband.h:416
static void qib7322_reset(struct qib7322 *qib7322, struct pci_device *pci)
Reset QIB7322.
Definition: qib7322.c:2254
static void qib7322_fini_recv(struct qib7322 *qib7322 __unused)
Shut down receive datapath.
Definition: qib7322.c:1018
static int qib7322_init_i2c(struct qib7322 *qib7322)
Initialise QIB7322 I2C subsystem.
Definition: qib7322.c:1905
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
Definition: pseudobit.h:235
static int qib7322_init_recv(struct qib7322 *qib7322)
Initialise receive datapath.
Definition: qib7322.c:858
uint32_t revision
Definition: ib_mad.h:20
#define QIB7322_BAR0_SIZE
QIB7322 memory BAR size.
Definition: qib7322.h:163
unsigned int port
Port number.
Definition: infiniband.h:418
static __always_inline void ibdev_put(struct ib_device *ibdev)
Drop reference to Infiniband device.
Definition: infiniband.h:597
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
static unsigned int qib7322_link_speed_supported(struct qib7322 *qib7322, unsigned int port)
Determine supported link speeds.
Definition: qib7322.c:1664
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
struct ib_device * alloc_ibdev(size_t priv_size)
Allocate Infiniband device.
Definition: infiniband.c:937
#define QIB7322_PORT_BASE
QIB7322 base port number.
Definition: qib7322.h:166
union ib_guid node_guid
Node GUID.
Definition: infiniband.h:437
#define QIB7322_MAX_PORTS
QIB7322 maximum number of ports.
Definition: qib7322.h:169
int register_ibdev(struct ib_device *ibdev)
Register Infiniband device.
Definition: infiniband.c:964
static void qib7322_fini_send(struct qib7322 *qib7322)
Shut down send datapath.
Definition: qib7322.c:716
A QIB7322 HCA.
Definition: qib7322.c:100
#define DBGC2(...)
Definition: compiler.h:522
union ib_guid guid
Base GUID.
Definition: qib7322.c:126
void iounmap(volatile const void *io_addr)
Unmap I/O address.
uint8_t bytes[8]
Definition: ib_packet.h:19
uint8_t link_speed_supported
Link speed supported.
Definition: infiniband.h:431
static int qib7322_read_eeprom(struct qib7322 *qib7322)
Read EEPROM parameters.
Definition: qib7322.c:1940
void * regs
Registers.
Definition: qib7322.c:102
void * ioremap(unsigned long bus_addr, size_t len)
Map bus address as an I/O address.
struct ib_gid::@532 s

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, revision, ib_gid::s, strerror(), unregister_ibdev(), and zalloc().

◆ qib7322_remove()

static void qib7322_remove ( struct pci_device pci)
static

Remove PCI device.

Parameters
pciPCI device

Definition at line 2405 of file qib7322.c.

2405  {
2406  struct qib7322 *qib7322 = pci_get_drvdata ( pci );
2407  int i;
2408 
2409  for ( i = ( QIB7322_MAX_PORTS - 1 ) ; i >= 0 ; i-- ) {
2410  if ( qib7322->ibdev[i] )
2411  unregister_ibdev ( qib7322->ibdev[i] );
2412  }
2413  for ( i = ( QIB7322_MAX_PORTS - 1 ) ; i >= 0 ; i-- )
2414  ibdev_put ( qib7322->ibdev[i] );
2417  iounmap ( qib7322->regs );
2418  free ( qib7322 );
2419 }
void unregister_ibdev(struct ib_device *ibdev)
Unregister Infiniband device.
Definition: infiniband.c:1005
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
Definition: qib7322.c:128
static void qib7322_fini_recv(struct qib7322 *qib7322 __unused)
Shut down receive datapath.
Definition: qib7322.c:1018
static __always_inline void ibdev_put(struct ib_device *ibdev)
Drop reference to Infiniband device.
Definition: infiniband.h:597
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
#define QIB7322_MAX_PORTS
QIB7322 maximum number of ports.
Definition: qib7322.h:169
static void qib7322_fini_send(struct qib7322 *qib7322)
Shut down send datapath.
Definition: qib7322.c:716
A QIB7322 HCA.
Definition: qib7322.c:100
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:348
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void * regs
Registers.
Definition: qib7322.c:102

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

Variable Documentation

◆ __attribute__

◆ qib7322_ib_operations

struct ib_device_operations qib7322_ib_operations
static
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,
}
static void qib7322_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
Definition: qib7322.c:1062
static int qib7322_mcast_attach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Attach to multicast group.
Definition: qib7322.c:1764
static void qib7322_close(struct ib_device *ibdev)
Close Infiniband link.
Definition: qib7322.c:1736
static int qib7322_post_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf)
Post receive work queue entry.
Definition: qib7322.c:1311
static void qib7322_mcast_detach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Detach from multicast group.
Definition: qib7322.c:1782
static void qib7322_destroy_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
Definition: qib7322.c:1142
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.
Definition: qib7322.c:1166
static int qib7322_open(struct ib_device *ibdev)
Initialise Infiniband link.
Definition: qib7322.c:1716
static int qib7322_set_pkey_table(struct ib_device *ibdev __unused, union ib_mad *mad __unused)
Set partition key table.
Definition: qib7322.c:348
static void qib7322_poll_eq(struct ib_device *ibdev)
Poll event queue.
Definition: qib7322.c:1629
static int qib7322_set_port_info(struct ib_device *ibdev, union ib_mad *mad)
Set port information.
Definition: qib7322.c:307
static void qib7322_poll_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Poll completion queue.
Definition: qib7322.c:1603
static int qib7322_create_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create queue pair.
Definition: qib7322.c:1084
static int qib7322_modify_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Modify queue pair.
Definition: qib7322.c:1125
static int qib7322_create_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Create completion queue.
Definition: qib7322.c:1038

QIB7322 Infiniband operations.

Definition at line 1793 of file qib7322.c.

Referenced by qib7322_probe().

◆ qib7322_i2c_bits

unsigned int qib7322_i2c_bits[]
static
Initial value:
= {
}
Serial clock.
Definition: i2c.h:114
#define QIB7322_GPIO_SDA
QIB7322 I2C SDA line GPIO number.
Definition: qib7322.h:190
Serial data.
Definition: i2c.h:116
#define QIB7322_GPIO_SCL
QIB7322 I2C SCL line GPIO number.
Definition: qib7322.h:187

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

◆ qib7322_i2c_basher_ops

struct bit_basher_operations qib7322_i2c_basher_ops
static
Initial value:
= {
}
static int qib7322_i2c_read_bit(struct bit_basher *basher, unsigned int bit_id)
Read QIB7322 I2C line status.
Definition: qib7322.c:1832
static void qib7322_i2c_write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
Write QIB7322 I2C line status.
Definition: qib7322.c:1856

QIB7322 I2C bit-bashing interface operations.

Definition at line 1894 of file qib7322.c.

Referenced by qib7322_init_i2c().

◆ qib7322_nics

struct pci_device_id qib7322_nics[]
static
Initial value:
= {
PCI_ROM ( 0x1077, 0x7322, "iba7322", "IBA7322 QDR InfiniBand HCA", 0 ),
}
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition: pci.h:283

Definition at line 2421 of file qib7322.c.

◆ __pci_driver

struct pci_driver qib7322_driver __pci_driver
Initial value:
= {
.ids = qib7322_nics,
.id_count = ( sizeof ( qib7322_nics ) / sizeof ( qib7322_nics[0] ) ),
.probe = qib7322_probe,
}
static struct xen_remove_from_physmap * remove
Definition: xenmem.h:39
static struct pci_device_id qib7322_nics[]
Definition: qib7322.c:2421
static int qib7322_probe(struct pci_device *pci)
Probe PCI device.
Definition: qib7322.c:2280
static void qib7322_remove(struct pci_device *pci)
Remove PCI device.
Definition: qib7322.c:2405

Definition at line 2425 of file qib7322.c.