iPXE
arbel.h
Go to the documentation of this file.
1 #ifndef _ARBEL_H
2 #define _ARBEL_H
3 
4 /** @file
5  *
6  * Mellanox Arbel Infiniband HCA driver
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <ipxe/ib_packet.h>
14 #include "mlx_bitops.h"
15 #include "MT25218_PRM.h"
16 
17 /*
18  * Hardware constants
19  *
20  */
21 
22 /* Ports in existence */
23 #define ARBEL_NUM_PORTS 2
24 #define ARBEL_PORT_BASE 1
25 
26 /* PCI BARs */
27 #define ARBEL_PCI_CONFIG_BAR PCI_BASE_ADDRESS_0
28 #define ARBEL_PCI_CONFIG_BAR_SIZE 0x100000
29 #define ARBEL_PCI_UAR_BAR PCI_BASE_ADDRESS_2
30 #define ARBEL_PCI_UAR_IDX 1
31 #define ARBEL_PCI_UAR_SIZE 0x1000
32 
33 /* Device reset */
34 #define ARBEL_RESET_OFFSET 0x0f0010
35 #define ARBEL_RESET_MAGIC 0x01000000UL
36 #define ARBEL_RESET_WAIT_TIME_MS 1000
37 
38 /* UAR context table (UCE) resource types */
39 #define ARBEL_UAR_RES_NONE 0x00
40 #define ARBEL_UAR_RES_CQ_CI 0x01
41 #define ARBEL_UAR_RES_CQ_ARM 0x02
42 #define ARBEL_UAR_RES_SQ 0x03
43 #define ARBEL_UAR_RES_RQ 0x04
44 #define ARBEL_UAR_RES_GROUP_SEP 0x07
45 
46 /* Work queue entry and completion queue entry opcodes */
47 #define ARBEL_OPCODE_SEND 0x0a
48 #define ARBEL_OPCODE_RECV_ERROR 0xfe
49 #define ARBEL_OPCODE_SEND_ERROR 0xff
50 
51 /* HCA command register opcodes */
52 #define ARBEL_HCR_QUERY_DEV_LIM 0x0003
53 #define ARBEL_HCR_QUERY_FW 0x0004
54 #define ARBEL_HCR_INIT_HCA 0x0007
55 #define ARBEL_HCR_CLOSE_HCA 0x0008
56 #define ARBEL_HCR_INIT_IB 0x0009
57 #define ARBEL_HCR_CLOSE_IB 0x000a
58 #define ARBEL_HCR_SW2HW_MPT 0x000d
59 #define ARBEL_HCR_MAP_EQ 0x0012
60 #define ARBEL_HCR_SW2HW_EQ 0x0013
61 #define ARBEL_HCR_HW2SW_EQ 0x0014
62 #define ARBEL_HCR_SW2HW_CQ 0x0016
63 #define ARBEL_HCR_HW2SW_CQ 0x0017
64 #define ARBEL_HCR_QUERY_CQ 0x0018
65 #define ARBEL_HCR_RST2INIT_QPEE 0x0019
66 #define ARBEL_HCR_INIT2RTR_QPEE 0x001a
67 #define ARBEL_HCR_RTR2RTS_QPEE 0x001b
68 #define ARBEL_HCR_RTS2RTS_QPEE 0x001c
69 #define ARBEL_HCR_2RST_QPEE 0x0021
70 #define ARBEL_HCR_QUERY_QPEE 0x0022
71 #define ARBEL_HCR_CONF_SPECIAL_QP 0x0023
72 #define ARBEL_HCR_MAD_IFC 0x0024
73 #define ARBEL_HCR_READ_MGM 0x0025
74 #define ARBEL_HCR_WRITE_MGM 0x0026
75 #define ARBEL_HCR_MGID_HASH 0x0027
76 #define ARBEL_HCR_RUN_FW 0x0ff6
77 #define ARBEL_HCR_DISABLE_LAM 0x0ff7
78 #define ARBEL_HCR_ENABLE_LAM 0x0ff8
79 #define ARBEL_HCR_UNMAP_ICM 0x0ff9
80 #define ARBEL_HCR_MAP_ICM 0x0ffa
81 #define ARBEL_HCR_UNMAP_ICM_AUX 0x0ffb
82 #define ARBEL_HCR_MAP_ICM_AUX 0x0ffc
83 #define ARBEL_HCR_SET_ICM_SIZE 0x0ffd
84 #define ARBEL_HCR_UNMAP_FA 0x0ffe
85 #define ARBEL_HCR_MAP_FA 0x0fff
86 
87 /* Service types */
88 #define ARBEL_ST_RC 0x00
89 #define ARBEL_ST_UD 0x03
90 #define ARBEL_ST_MLX 0x07
91 
92 /* MTUs */
93 #define ARBEL_MTU_2048 0x04
94 
95 #define ARBEL_NO_EQ 64
96 
97 #define ARBEL_INVALID_LKEY 0x00000100UL
98 
99 #define ARBEL_PAGE_SIZE ( ( size_t ) 4096 )
100 
101 #define ARBEL_RDB_ENTRY_SIZE ( ( size_t ) 32 )
102 
103 #define ARBEL_DB_POST_SND_OFFSET 0x10
104 #define ARBEL_DB_EQ_OFFSET(_eqn) ( 0x08 * (_eqn) )
105 
106 #define ARBEL_QPEE_OPT_PARAM_QKEY 0x00000020UL
107 
108 #define ARBEL_MAP_EQ ( 0UL << 31 )
109 #define ARBEL_UNMAP_EQ ( 1UL << 31 )
110 
111 #define ARBEL_EV_PORT_STATE_CHANGE 0x09
112 
113 #define ARBEL_LOG_MULTICAST_HASH_SIZE 3
114 
115 #define ARBEL_PM_STATE_ARMED 0x00
116 #define ARBEL_PM_STATE_REARM 0x01
117 #define ARBEL_PM_STATE_MIGRATED 0x03
118 
119 #define ARBEL_RETRY_MAX 0x07
120 
121 /*
122  * Datatypes that seem to be missing from the autogenerated documentation
123  *
124  */
127 /* -------------- */
128  pseudo_bit_t hash[0x00010];
130 } __attribute__ (( packed ));
131 
134 /* -------------- */
135  pseudo_bit_t value[0x00020];
136 } __attribute__ (( packed ));
137 
140 /* -------------- */
158  pseudo_bit_t gpio[0x00001];
162 } __attribute__ (( packed ));
163 
165  pseudo_bit_t ci[0x00020];
166 } __attribute__ (( packed ));
167 
171 } __attribute__ (( packed ));
172 
173 /*
174  * Wrapper structures for hardware datatypes
175  *
176  */
177 
178 struct MLX_DECLARE_STRUCT ( arbelprm_access_lam );
179 struct MLX_DECLARE_STRUCT ( arbelprm_completion_queue_context );
180 struct MLX_DECLARE_STRUCT ( arbelprm_completion_queue_entry );
181 struct MLX_DECLARE_STRUCT ( arbelprm_completion_with_error );
182 struct MLX_DECLARE_STRUCT ( arbelprm_cq_arm_db_record );
183 struct MLX_DECLARE_STRUCT ( arbelprm_cq_ci_db_record );
184 struct MLX_DECLARE_STRUCT ( arbelprm_event_mask );
185 struct MLX_DECLARE_STRUCT ( arbelprm_event_queue_entry );
186 struct MLX_DECLARE_STRUCT ( arbelprm_eq_set_ci );
187 struct MLX_DECLARE_STRUCT ( arbelprm_eqc );
188 struct MLX_DECLARE_STRUCT ( arbelprm_hca_command_register );
189 struct MLX_DECLARE_STRUCT ( arbelprm_init_hca );
190 struct MLX_DECLARE_STRUCT ( arbelprm_init_ib );
191 struct MLX_DECLARE_STRUCT ( arbelprm_mad_ifc );
192 struct MLX_DECLARE_STRUCT ( arbelprm_mgm_entry );
193 struct MLX_DECLARE_STRUCT ( arbelprm_mgm_hash );
194 struct MLX_DECLARE_STRUCT ( arbelprm_mpt );
195 struct MLX_DECLARE_STRUCT ( arbelprm_port_state_change_event );
196 struct MLX_DECLARE_STRUCT ( arbelprm_qp_db_record );
197 struct MLX_DECLARE_STRUCT ( arbelprm_qp_ee_state_transitions );
198 struct MLX_DECLARE_STRUCT ( arbelprm_query_dev_lim );
199 struct MLX_DECLARE_STRUCT ( arbelprm_query_fw );
200 struct MLX_DECLARE_STRUCT ( arbelprm_queue_pair_ee_context_entry );
201 struct MLX_DECLARE_STRUCT ( arbelprm_recv_wqe_segment_next );
202 struct MLX_DECLARE_STRUCT ( arbelprm_scalar_parameter );
203 struct MLX_DECLARE_STRUCT ( arbelprm_send_doorbell );
204 struct MLX_DECLARE_STRUCT ( arbelprm_ud_address_vector );
205 struct MLX_DECLARE_STRUCT ( arbelprm_virtual_physical_mapping );
206 struct MLX_DECLARE_STRUCT ( arbelprm_wqe_segment_ctrl_mlx );
207 struct MLX_DECLARE_STRUCT ( arbelprm_wqe_segment_ctrl_send );
208 struct MLX_DECLARE_STRUCT ( arbelprm_wqe_segment_data_ptr );
209 struct MLX_DECLARE_STRUCT ( arbelprm_wqe_segment_next );
210 struct MLX_DECLARE_STRUCT ( arbelprm_wqe_segment_ud );
211 
212 /*
213  * Composite hardware datatypes
214  *
215  */
216 
217 #define ARBEL_MAX_GATHER 2
218 
220  struct arbelprm_wqe_segment_next next;
221  struct arbelprm_wqe_segment_ctrl_send ctrl;
222  struct arbelprm_wqe_segment_ud ud;
223  struct arbelprm_wqe_segment_data_ptr data[ARBEL_MAX_GATHER];
224 } __attribute__ (( packed ));
225 
227  struct arbelprm_wqe_segment_next next;
228  struct arbelprm_wqe_segment_ctrl_mlx ctrl;
229  struct arbelprm_wqe_segment_data_ptr data[ARBEL_MAX_GATHER];
231 } __attribute__ (( packed ));
232 
234  struct arbelprm_wqe_segment_next next;
235  struct arbelprm_wqe_segment_ctrl_send ctrl;
236  struct arbelprm_wqe_segment_data_ptr data[ARBEL_MAX_GATHER];
237 } __attribute__ (( packed ));
238 
239 #define ARBEL_MAX_SCATTER 2
240 
242  /* The autogenerated header is inconsistent between send and
243  * receive WQEs. The "ctrl" structure for receive WQEs is
244  * defined to include the "next" structure. Since the "ctrl"
245  * part of the "ctrl" structure contains only "reserved, must
246  * be zero" bits, we ignore its definition and provide
247  * something more usable.
248  */
249  struct arbelprm_recv_wqe_segment_next next;
250  uint32_t ctrl[2]; /* All "reserved, must be zero" */
251  struct arbelprm_wqe_segment_data_ptr data[ARBEL_MAX_SCATTER];
252 } __attribute__ (( packed ));
253 
255  struct arbelprm_completion_queue_entry normal;
256  struct arbelprm_completion_with_error error;
257 } __attribute__ (( packed ));
258 
260  struct arbelprm_event_queue_entry generic;
261  struct arbelprm_port_state_change_event port_state_change;
262 } __attribute__ (( packed ));
263 
265  struct arbelprm_cq_arm_db_record cq_arm;
266  struct arbelprm_cq_ci_db_record cq_ci;
267  struct arbelprm_qp_db_record qp;
268 } __attribute__ (( packed ));
269 
271  struct arbelprm_send_doorbell send;
273 } __attribute__ (( packed ));
274 
276  struct arbelprm_eq_set_ci ci;
278 } __attribute__ (( packed ));
279 
281  struct arbelprm_mad_ifc ifc;
282  union ib_mad mad;
283 } __attribute__ (( packed ));
284 
285 /*
286  * iPXE-specific definitions
287  *
288  */
289 
290 /** Arbel device limits */
292  /** Number of reserved QPs */
293  unsigned int reserved_qps;
294  /** QP context entry size */
296  /** Extended QP context entry size */
298  /** Number of reserved SRQs */
299  unsigned int reserved_srqs;
300  /** SRQ context entry size */
302  /** Number of reserved EEs */
303  unsigned int reserved_ees;
304  /** EE context entry size */
306  /** Extended EE context entry size */
308  /** Number of reserved CQs */
309  unsigned int reserved_cqs;
310  /** CQ context entry size */
312  /** Number of reserved EQs */
313  unsigned int reserved_eqs;
314  /** Number of reserved MTTs */
315  unsigned int reserved_mtts;
316  /** MTT entry size */
318  /** Number of reserved MRWs */
319  unsigned int reserved_mrws;
320  /** MPT entry size */
322  /** Number of reserved RDBs */
323  unsigned int reserved_rdbs;
324  /** EQ context entry size */
326  /** Number of reserved UARs */
327  unsigned int reserved_uars;
328  /** UAR scratchpad entry size */
330 };
331 
332 /** Alignment of Arbel send work queue entries */
333 #define ARBEL_SEND_WQE_ALIGN 128
334 
335 /** An Arbel send work queue entry */
337  struct arbelprm_wqe_segment_next next;
342 } __attribute__ (( packed ));
343 
344 /** An Arbel send work queue */
346  /** Doorbell record number */
347  unsigned int doorbell_idx;
348  /** Work queue entries */
350  /** Size of work queue */
351  size_t wqe_size;
352 };
353 
354 /** Alignment of Arbel receive work queue entries */
355 #define ARBEL_RECV_WQE_ALIGN 64
356 
357 /** An Arbel receive work queue entry */
361 } __attribute__ (( packed ));
362 
363 /** An Arbel receive work queue */
365  /** Doorbell record number */
366  unsigned int doorbell_idx;
367  /** Work queue entries */
369  /** Size of work queue */
370  size_t wqe_size;
371  /** GRH buffers (if applicable) */
373  /** Size of GRB buffers */
374  size_t grh_size;
375 };
376 
377 /** Number of special queue pairs */
378 #define ARBEL_NUM_SPECIAL_QPS 4
379 
380 /** Number of queue pairs reserved for the "special QP" block
381  *
382  * The special QPs must be in (2n,2n+1) pairs, hence we need to
383  * reserve one extra QP to allow for alignment.
384  */
385 #define ARBEL_RSVD_SPECIAL_QPS ( ARBEL_NUM_SPECIAL_QPS + 1 )
386 
387 /** Maximum number of allocatable queue pairs
388  *
389  * This is a policy decision, not a device limit.
390  */
391 #define ARBEL_MAX_QPS 8
392 
393 /** Queue pair number randomisation mask */
394 #define ARBEL_QPN_RANDOM_MASK 0xfff000
395 
396 /** Arbel queue pair state */
402 };
403 
404 /** An Arbel queue pair */
406  /** Send work queue */
408  /** Receive work queue */
410  /** Queue state */
412 };
413 
414 /** Maximum number of allocatable completion queues
415  *
416  * This is a policy decision, not a device limit.
417  */
418 #define ARBEL_MAX_CQS 8
419 
420 /** An Arbel completion queue */
422  /** Consumer counter doorbell record number */
423  unsigned int ci_doorbell_idx;
424  /** Arm queue doorbell record number */
425  unsigned int arm_doorbell_idx;
426  /** Completion queue entries */
428  /** Size of completion queue */
429  size_t cqe_size;
430 };
431 
432 /** Maximum number of allocatable event queues
433  *
434  * This is a policy decision, not a device limit.
435  */
436 #define ARBEL_MAX_EQS 64
437 
438 /** A Arbel event queue */
440  /** Event queue entries */
442  /** Size of event queue */
443  size_t eqe_size;
444  /** Event queue number */
445  unsigned long eqn;
446  /** Next event queue entry index */
447  unsigned long next_idx;
448  /** Doorbell register */
449  void *doorbell;
450 };
451 
452 /** Number of event queue entries
453  *
454  * This is a policy decision.
455  */
456 #define ARBEL_NUM_EQES 4
457 
458 
459 /** An Arbel resource bitmask */
461 
462 /** Size of an Arbel resource bitmask */
463 #define ARBEL_BITMASK_SIZE(max_entries) \
464  ( ( (max_entries) + ( 8 * sizeof ( arbel_bitmask_t ) ) - 1 ) / \
465  ( 8 * sizeof ( arbel_bitmask_t ) ) )
466 
467 /** An Arbel device */
468 struct arbel {
469  /** PCI device */
470  struct pci_device *pci;
471  /** PCI configuration registers */
472  void *config;
473  /** PCI user Access Region */
474  void *uar;
475  /** Event queue consumer index doorbells */
477 
478  /** Command input mailbox */
479  void *mailbox_in;
480  /** Command output mailbox */
481  void *mailbox_out;
482 
483  /** Device open request counter */
484  unsigned int open_count;
485 
486  /** Firmware size */
487  size_t firmware_len;
488  /** Firmware area in external memory
489  *
490  * This is allocated when first needed, and freed only on
491  * final teardown, in order to avoid memory map changes at
492  * runtime.
493  */
495  /** ICM size */
496  size_t icm_len;
497  /** ICM AUX size */
498  size_t icm_aux_len;
499  /** ICM area
500  *
501  * This is allocated when first needed, and freed only on
502  * final teardown, in order to avoid memory map changes at
503  * runtime.
504  */
505  void *icm;
506  /** Offset within ICM of doorbell records */
508  /** Doorbell records */
510  /** Event queue */
512  /** Unrestricted LKey
513  *
514  * Used to get unrestricted memory access.
515  */
516  unsigned long lkey;
517 
518  /** Completion queue in-use bitmask */
520  /** Queue pair in-use bitmask */
522 
523  /** Device limits */
525  /** Special QPN base */
526  unsigned long special_qpn_base;
527  /** QPN base */
528  unsigned long qpn_base;
529 
530  /** Infiniband devices */
532 };
533 
534 /** Global protection domain */
535 #define ARBEL_GLOBAL_PD 0x123456
536 
537 /** Memory key prefix */
538 #define ARBEL_MKEY_PREFIX 0x77000000UL
539 
540 /*
541  * HCA commands
542  *
543  */
544 
545 #define ARBEL_HCR_BASE 0x80680
546 #define ARBEL_HCR_REG(x) ( ARBEL_HCR_BASE + 4 * (x) )
547 #define ARBEL_HCR_MAX_WAIT_MS 2000
548 #define ARBEL_MBOX_ALIGN 4096
549 #define ARBEL_MBOX_SIZE 512
550 
551 /* HCA command is split into
552  *
553  * bits 11:0 Opcode
554  * bit 12 Input uses mailbox
555  * bit 13 Output uses mailbox
556  * bits 22:14 Input parameter length (in dwords)
557  * bits 31:23 Output parameter length (in dwords)
558  *
559  * Encoding the information in this way allows us to cut out several
560  * parameters to the arbel_command() call.
561  */
562 #define ARBEL_HCR_IN_MBOX 0x00001000UL
563 #define ARBEL_HCR_OUT_MBOX 0x00002000UL
564 #define ARBEL_HCR_OPCODE( _command ) ( (_command) & 0xfff )
565 #define ARBEL_HCR_IN_LEN( _command ) ( ( (_command) >> 12 ) & 0x7fc )
566 #define ARBEL_HCR_OUT_LEN( _command ) ( ( (_command) >> 21 ) & 0x7fc )
567 
568 /** Build HCR command from component parts */
569 #define ARBEL_HCR_INOUT_CMD( _opcode, _in_mbox, _in_len, \
570  _out_mbox, _out_len ) \
571  ( (_opcode) | \
572  ( (_in_mbox) ? ARBEL_HCR_IN_MBOX : 0 ) | \
573  ( ( (_in_len) / 4 ) << 14 ) | \
574  ( (_out_mbox) ? ARBEL_HCR_OUT_MBOX : 0 ) | \
575  ( ( (_out_len) / 4 ) << 23 ) )
576 
577 #define ARBEL_HCR_IN_CMD( _opcode, _in_mbox, _in_len ) \
578  ARBEL_HCR_INOUT_CMD ( _opcode, _in_mbox, _in_len, 0, 0 )
579 
580 #define ARBEL_HCR_OUT_CMD( _opcode, _out_mbox, _out_len ) \
581  ARBEL_HCR_INOUT_CMD ( _opcode, 0, 0, _out_mbox, _out_len )
582 
583 #define ARBEL_HCR_VOID_CMD( _opcode ) \
584  ARBEL_HCR_INOUT_CMD ( _opcode, 0, 0, 0, 0 )
585 
586 /*
587  * Doorbell record allocation
588  *
589  * The doorbell record map looks like:
590  *
591  * ARBEL_MAX_CQS * Arm completion queue doorbell
592  * ARBEL_MAX_QPS * Send work request doorbell
593  * Group separator
594  * ...(empty space)...
595  * ARBEL_MAX_QPS * Receive work request doorbell
596  * ARBEL_MAX_CQS * Completion queue consumer counter update doorbell
597  */
598 
599 #define ARBEL_MAX_DOORBELL_RECORDS 512
600 #define ARBEL_GROUP_SEPARATOR_DOORBELL \
601  ( ARBEL_MAX_CQS + ARBEL_RSVD_SPECIAL_QPS + ARBEL_MAX_QPS )
602 
603 /**
604  * Get arm completion queue doorbell index
605  *
606  * @v arbel Arbel device
607  * @v cq Completion queue
608  * @ret doorbell_idx Doorbell index
609  */
610 static inline unsigned int
612  struct ib_completion_queue *cq ) {
613  return ( cq->cqn - arbel->limits.reserved_cqs );
614 }
615 
616 /**
617  * Get send work request doorbell index
618  *
619  * @v arbel Arbel device
620  * @v qp Queue pair
621  * @ret doorbell_idx Doorbell index
622  */
623 static inline unsigned int
625  return ( ARBEL_MAX_CQS +
626  ( ( qp->qpn & ~ARBEL_QPN_RANDOM_MASK ) -
627  arbel->special_qpn_base ) );
628 }
629 
630 /**
631  * Get receive work request doorbell index
632  *
633  * @v arbel Arbel device
634  * @v qp Queue pair
635  * @ret doorbell_idx Doorbell index
636  */
637 static inline unsigned int
640  ( ( qp->qpn & ~ARBEL_QPN_RANDOM_MASK ) -
641  arbel->special_qpn_base ) - 1 );
642 }
643 
644 /**
645  * Get completion queue consumer counter doorbell index
646  *
647  * @v arbel Arbel device
648  * @v cq Completion queue
649  * @ret doorbell_idx Doorbell index
650  */
651 static inline unsigned int
653  struct ib_completion_queue *cq ) {
654  return ( ARBEL_MAX_DOORBELL_RECORDS -
655  ( cq->cqn - arbel->limits.reserved_cqs ) - 1 );
656 }
657 
658 #endif /* _ARBEL_H */
struct arbelprm_port_state_change_st data
Definition: arbel.h:170
struct arbelprm_wqe_segment_ud ud
Definition: arbel.h:222
struct ib_global_route_header * grh
GRH buffers (if applicable)
Definition: arbel.h:372
An Arbel send work queue entry.
Definition: arbel.h:336
arbel_bitmask_t cq_inuse[ARBEL_BITMASK_SIZE(ARBEL_MAX_CQS)]
Completion queue in-use bitmask.
Definition: arbel.h:519
static unsigned int arbel_cq_arm_doorbell_idx(struct arbel *arbel, struct ib_completion_queue *cq)
Get arm completion queue doorbell index.
Definition: arbel.h:611
static unsigned int arbel_send_doorbell_idx(struct arbel *arbel, struct ib_queue_pair *qp)
Get send work request doorbell index.
Definition: arbel.h:624
Arbel device limits.
Definition: arbel.h:291
unsigned int reserved_srqs
Number of reserved SRQs.
Definition: arbel.h:299
unsigned int reserved_mtts
Number of reserved MTTs.
Definition: arbel.h:315
union arbel_recv_wqe * wqe
Work queue entries.
Definition: arbel.h:368
An Arbel send work queue.
Definition: arbel.h:345
pseudo_bit_t send_queue_drained[0x00001]
Definition: arbel.h:144
pseudo_bit_t srq_catastrophe[0x00001]
Definition: arbel.h:155
void * eq_ci_doorbells
Event queue consumer index doorbells.
Definition: arbel.h:476
pseudo_bit_t clientreregister[0x00001]
Definition: arbel.h:159
uint8_t headers[IB_MAX_HEADER_SIZE]
Definition: arbel.h:230
size_t eeec_entry_size
Extended EE context entry size.
Definition: arbel.h:307
static unsigned int arbel_cq_ci_doorbell_idx(struct arbel *arbel, struct ib_completion_queue *cq)
Get completion queue consumer counter doorbell index.
Definition: arbel.h:652
An Arbel receive work queue entry.
Definition: arbel.h:358
struct ib_device * ibdev[ARBEL_NUM_PORTS]
Infiniband devices.
Definition: arbel.h:531
pseudo_bit_t completion[0x00001]
Definition: arbel.h:141
size_t eqc_entry_size
EQ context entry size.
Definition: arbel.h:325
struct arbelprm_eq_set_ci ci
Definition: arbel.h:276
pseudo_bit_t wq_access_violation[0x00001]
Definition: arbel.h:154
arbel_queue_pair_state
Arbel queue pair state.
Definition: arbel.h:397
struct arbelprm_wqe_segment_data_ptr data[ARBEL_MAX_SCATTER]
Definition: arbel.h:251
void * mailbox_out
Command output mailbox.
Definition: arbel.h:481
unsigned int doorbell_idx
Doorbell record number.
Definition: arbel.h:366
size_t wqe_size
Size of work queue.
Definition: arbel.h:351
struct arbelprm_wqe_segment_data_ptr data[ARBEL_MAX_GATHER]
Definition: arbel.h:229
void * config
PCI configuration registers.
Definition: arbel.h:472
struct arbelprm_mad_ifc ifc
Definition: arbel.h:281
unsigned int reserved_eqs
Number of reserved EQs.
Definition: arbel.h:313
unsigned long eqn
Event queue number.
Definition: arbel.h:445
unsigned int doorbell_idx
Doorbell record number.
Definition: arbel.h:347
#define ARBEL_MAX_GATHER
Definition: arbel.h:217
pseudo_bit_t reserved1[0x00010]
Definition: arbel.h:129
pseudo_bit_t command_done[0x00001]
Definition: arbel.h:151
unsigned long lkey
Unrestricted LKey.
Definition: arbel.h:516
pseudo_bit_t communication_established[0x00001]
Definition: arbel.h:143
unsigned char pseudo_bit_t
Datatype used to represent a bit in the pseudo-structures.
Definition: nx_bitops.h:37
uint32_t arbel_bitmask_t
An Arbel resource bitmask.
Definition: arbel.h:460
union arbel_send_wqe * wqe
Work queue entries.
Definition: arbel.h:349
struct arbelprm_qp_db_record qp
Definition: arbel.h:267
size_t cqc_entry_size
CQ context entry size.
Definition: arbel.h:311
Definition: arbel.h:259
union arbelprm_doorbell_record * db_rec
Doorbell records.
Definition: arbel.h:509
size_t eqpc_entry_size
Extended QP context entry size.
Definition: arbel.h:297
unsigned int ci_doorbell_idx
Consumer counter doorbell record number.
Definition: arbel.h:423
void * icm
ICM area.
Definition: arbel.h:505
struct arbel_event_queue eq
Event queue.
Definition: arbel.h:511
pseudo_bit_t qpc_catastrophe[0x00001]
Definition: arbel.h:147
size_t grh_size
Size of GRB buffers.
Definition: arbel.h:374
union arbelprm_event_entry * eqe
Event queue entries.
Definition: arbel.h:441
struct arbelprm_send_doorbell send
Definition: arbel.h:271
An Infiniband device.
Definition: infiniband.h:398
struct arbelprm_wqe_segment_next next
Definition: arbel.h:234
unsigned int reserved_rdbs
Number of reserved RDBs.
Definition: arbel.h:323
size_t srqc_entry_size
SRQ context entry size.
Definition: arbel.h:301
#define ARBEL_QPN_RANDOM_MASK
Queue pair number randomisation mask.
Definition: arbel.h:394
struct arbelprm_mlx_send_wqe mlx
Definition: arbel.h:339
Mellanox bit operations.
struct arbelprm_event_queue_entry generic
Definition: arbel.h:260
pseudo_bit_t wq_catastrophe[0x00001]
Definition: arbel.h:146
#define ARBEL_SEND_WQE_ALIGN
Alignment of Arbel send work queue entries.
Definition: arbel.h:333
union arbelprm_completion_entry * cqe
Completion queue entries.
Definition: arbel.h:427
size_t db_rec_offset
Offset within ICM of doorbell records.
Definition: arbel.h:507
struct arbelprm_cq_ci_db_record cq_ci
Definition: arbel.h:266
size_t cqe_size
Size of completion queue.
Definition: arbel.h:429
An Infiniband Global Route Header.
Definition: ib_packet.h:89
struct arbelprm_completion_with_error error
Definition: arbel.h:256
pseudo_bit_t path_migration_failed[0x00001]
Definition: arbel.h:148
unsigned int arm_doorbell_idx
Arm queue doorbell record number.
Definition: arbel.h:425
size_t eqe_size
Size of event queue.
Definition: arbel.h:443
union ib_mad mad
Definition: arbel.h:282
An Arbel receive work queue.
Definition: arbel.h:364
An Arbel completion queue.
Definition: arbel.h:421
pseudo_bit_t cq_error[0x00001]
Definition: arbel.h:145
An Arbel queue pair.
Definition: arbel.h:405
size_t mtt_entry_size
MTT entry size.
Definition: arbel.h:317
#define ARBEL_MAX_CQS
Maximum number of allocatable completion queues.
Definition: arbel.h:418
struct arbelprm_completion_queue_entry normal
Definition: arbel.h:255
struct arbelprm_wqe_segment_next next
Definition: arbel.h:220
A PCI device.
Definition: pci.h:210
pseudo_bit_t srq_rq_limit[0x00001]
Definition: arbel.h:157
unsigned int reserved_cqs
Number of reserved CQs.
Definition: arbel.h:309
size_t eec_entry_size
EE context entry size.
Definition: arbel.h:305
void * uar
PCI user Access Region.
Definition: arbel.h:474
An Infiniband Completion Queue.
Definition: infiniband.h:224
void * doorbell
Doorbell register.
Definition: arbel.h:449
pseudo_bit_t reserved[0x00020]
Definition: arbel.h:169
pseudo_bit_t reserved0[0x00020]
Definition: arbel.h:133
unsigned char uint8_t
Definition: stdint.h:10
size_t wqe_size
Size of work queue.
Definition: arbel.h:370
uint8_t force_align[ARBEL_SEND_WQE_ALIGN]
Definition: arbel.h:341
enum arbel_queue_pair_state state
Queue state.
Definition: arbel.h:411
struct arbelprm_wqe_segment_next next
Definition: arbel.h:337
unsigned int uint32_t
Definition: stdint.h:12
unsigned int reserved_mrws
Number of reserved MRWs.
Definition: arbel.h:319
unsigned int reserved_ees
Number of reserved EEs.
Definition: arbel.h:303
size_t icm_aux_len
ICM AUX size.
Definition: arbel.h:498
pseudo_bit_t port_state_change[0x00001]
Definition: arbel.h:150
struct arbelprm_wqe_segment_next next
Definition: arbel.h:227
pseudo_bit_t path_migration_armed[0x00001]
Definition: arbel.h:160
unsigned long qpn_base
QPN base.
Definition: arbel.h:528
struct arbelprm_ud_send_wqe ud
Definition: arbel.h:338
An Infiniband Queue Pair.
Definition: infiniband.h:157
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static unsigned int arbel_recv_doorbell_idx(struct arbel *arbel, struct ib_queue_pair *qp)
Get receive work request doorbell index.
Definition: arbel.h:638
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
pseudo_bit_t reserved3[0x00008]
Definition: arbel.h:161
struct arbelprm_wqe_segment_ctrl_send ctrl
Definition: arbel.h:235
struct arbelprm_port_state_change_event port_state_change
Definition: arbel.h:261
unsigned int reserved_qps
Number of reserved QPs.
Definition: arbel.h:293
pseudo_bit_t reserved0[0x00020]
Definition: arbel.h:139
#define ARBEL_NUM_PORTS
Definition: arbel.h:23
size_t qpc_entry_size
QP context entry size.
Definition: arbel.h:295
size_t firmware_len
Firmware size.
Definition: arbel.h:487
pseudo_bit_t wq_invalid_request[0x00001]
Definition: arbel.h:153
size_t uar_scratch_entry_size
UAR scratchpad entry size.
Definition: arbel.h:329
uint32_t ctrl[2]
Definition: arbel.h:250
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:340
struct arbelprm_wqe_segment_ctrl_mlx ctrl
Definition: arbel.h:228
pseudo_bit_t reserved1[0x00001]
Definition: arbel.h:149
struct arbelprm_recv_wqe_segment_next next
Definition: arbel.h:249
struct arbel_dev_limits limits
Device limits.
Definition: arbel.h:524
#define ARBEL_MAX_SCATTER
Definition: arbel.h:239
Infiniband packet format.
struct arbelprm_recv_wqe recv
Definition: arbel.h:359
uint8_t force_align[ARBEL_RECV_WQE_ALIGN]
Definition: arbel.h:360
unsigned long cqn
Completion queue number.
Definition: infiniband.h:230
size_t icm_len
ICM size.
Definition: arbel.h:496
void * firmware_area
Firmware area in external memory.
Definition: arbel.h:494
A management datagram.
Definition: ib_mad.h:610
pseudo_bit_t srq_last_wqe[0x00001]
Definition: arbel.h:156
unsigned int open_count
Device open request counter.
Definition: arbel.h:484
struct arbel_dev_limits __attribute__
unsigned long next_idx
Next event queue entry index.
Definition: arbel.h:447
unsigned long special_qpn_base
Special QPN base.
Definition: arbel.h:526
struct arbel_recv_work_queue recv
Receive work queue.
Definition: arbel.h:409
A GPIO pin.
Definition: gpio.h:18
unsigned int reserved_uars
Number of reserved UARs.
Definition: arbel.h:327
pseudo_bit_t reserved2[0x00005]
Definition: arbel.h:152
struct pci_device * pci
PCI device.
Definition: arbel.h:470
#define ARBEL_RECV_WQE_ALIGN
Alignment of Arbel receive work queue entries.
Definition: arbel.h:355
pseudo_bit_t value[0x00020]
Definition: arbel.h:135
struct arbelprm_wqe_segment_data_ptr data[ARBEL_MAX_GATHER]
Definition: arbel.h:236
struct arbelprm_cq_arm_db_record cq_arm
Definition: arbel.h:265
struct arbelprm_wqe_segment_ctrl_send ctrl
Definition: arbel.h:221
Definition: arbel.h:254
struct arbelprm_wqe_segment_data_ptr data[ARBEL_MAX_GATHER]
Definition: arbel.h:223
struct arbel_send_work_queue send
Send work queue.
Definition: arbel.h:407
struct MLX_DECLARE_STRUCT(arbelprm_access_lam)
An Arbel device.
Definition: arbel.h:468
pseudo_bit_t reserved0[0x00020]
Definition: arbel.h:126
arbel_bitmask_t qp_inuse[ARBEL_BITMASK_SIZE(ARBEL_MAX_QPS)]
Queue pair in-use bitmask.
Definition: arbel.h:521
unsigned long int dword
Definition: smc9000.h:40
#define ARBEL_BITMASK_SIZE(max_entries)
Size of an Arbel resource bitmask.
Definition: arbel.h:463
pseudo_bit_t hash[0x00010]
Definition: arbel.h:128
A Arbel event queue.
Definition: arbel.h:439
#define IB_MAX_HEADER_SIZE
Maximum size required for IB headers.
Definition: ib_packet.h:156
size_t mpt_entry_size
MPT entry size.
Definition: arbel.h:321
void * mailbox_in
Command input mailbox.
Definition: arbel.h:479
#define ARBEL_MAX_QPS
Maximum number of allocatable queue pairs.
Definition: arbel.h:391
pseudo_bit_t ci[0x00020]
Definition: arbel.h:165
#define ARBEL_MAX_DOORBELL_RECORDS
Definition: arbel.h:599
pseudo_bit_t path_migration_succeeded[0x00001]
Definition: arbel.h:142