iPXE
infiniband.h
Go to the documentation of this file.
1 #ifndef _IPXE_INFINIBAND_H
2 #define _IPXE_INFINIBAND_H
3 
4 /** @file
5  *
6  * Infiniband protocol
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <ipxe/refcnt.h>
14 #include <ipxe/device.h>
15 #include <ipxe/tables.h>
16 #include <ipxe/ib_packet.h>
17 #include <ipxe/ib_mad.h>
18 #include <ipxe/if_ether.h>
19 
20 /** Subnet management interface QPN */
21 #define IB_QPN_SMI 0
22 
23 /** Subnet management interface queue key */
24 #define IB_QKEY_SMI 0
25 
26 /** General service interface QPN */
27 #define IB_QPN_GSI 1
28 
29 /** General service interface queue key */
30 #define IB_QKEY_GSI 0x80010000UL
31 
32 /** Broadcast QPN */
33 #define IB_QPN_BROADCAST 0xffffffUL
34 
35 /** QPN mask */
36 #define IB_QPN_MASK 0xffffffUL
37 
38 /** Default Infiniband partition key */
39 #define IB_PKEY_DEFAULT 0xffff
40 
41 /** Infiniband partition key full membership flag */
42 #define IB_PKEY_FULL 0x8000
43 
44 /**
45  * Maximum payload size
46  *
47  * This is currently hard-coded in various places (drivers, subnet
48  * management agent, etc.) to 2048.
49  */
50 #define IB_MAX_PAYLOAD_SIZE 2048
51 
52 struct ib_device;
53 struct ib_queue_pair;
54 struct ib_address_vector;
55 struct ib_completion_queue;
56 struct ib_mad_interface;
57 
58 /** Infiniband transmission rates */
59 enum ib_rate {
63  IB_RATE_5 = 5,
69 };
70 
71 /** An Infiniband Address Vector */
73  /** Queue Pair Number */
74  unsigned long qpn;
75  /** Queue key
76  *
77  * Not specified for received packets.
78  */
79  unsigned long qkey;
80  /** Local ID */
81  unsigned int lid;
82  /** Rate
83  *
84  * Not specified for received packets.
85  */
86  enum ib_rate rate;
87  /** Service level */
88  unsigned int sl;
89  /** GID is present */
90  unsigned int gid_present;
91  /** GID, if present */
92  union ib_gid gid;
93  /** VLAN is present */
94  unsigned int vlan_present;
95  /** VLAN, if present */
96  unsigned int vlan;
97 };
98 
99 /** An Infiniband Work Queue */
101  /** Containing queue pair */
102  struct ib_queue_pair *qp;
103  /** "Is a send queue" flag */
104  int is_send;
105  /** Associated completion queue */
107  /** List of work queues on this completion queue */
108  struct list_head list;
109  /** Packet sequence number */
111  /** Number of work queue entries */
112  unsigned int num_wqes;
113  /** Number of occupied work queue entries */
114  unsigned int fill;
115  /** Next work queue entry index
116  *
117  * This is the index of the next entry to be filled (i.e. the
118  * first empty entry). This value is not bounded by num_wqes;
119  * users must logical-AND with (num_wqes-1) to generate an
120  * array index.
121  */
122  unsigned long next_idx;
123  /** I/O buffers assigned to work queue */
124  struct io_buffer **iobufs;
125  /** Driver private data */
126  void *drv_priv;
127 };
128 
129 /** An Infiniband multicast GID */
131  /** List of multicast GIDs on this QP */
132  struct list_head list;
133  /** Multicast GID */
134  union ib_gid gid;
135 };
136 
137 /** An Infiniband queue pair type */
144 };
145 
146 /** Infiniband queue pair operations */
148  /** Allocate receive I/O buffer
149  *
150  * @v len Maximum receive length
151  * @ret iobuf I/O buffer (or NULL if out of memory)
152  */
153  struct io_buffer * ( * alloc_iob ) ( size_t len );
154 };
155 
156 /** An Infiniband Queue Pair */
158  /** Containing Infiniband device */
159  struct ib_device *ibdev;
160  /** List of queue pairs on this Infiniband device */
161  struct list_head list;
162  /** Queue pair name */
163  const char *name;
164  /** Queue pair number */
165  unsigned long qpn;
166  /** Externally-visible queue pair number
167  *
168  * This may differ from the real queue pair number (e.g. when
169  * the HCA cannot use the management QPNs 0 and 1 as hardware
170  * QPNs and needs to remap them).
171  */
172  unsigned long ext_qpn;
173  /** Queue pair type */
175  /** Queue key */
176  unsigned long qkey;
177  /** Send queue */
179  /** Receive queue */
181  /** List of multicast GIDs */
182  struct list_head mgids;
183  /** Address vector */
185  /** Queue pair operations */
187  /** Driver private data */
188  void *drv_priv;
189  /** Queue owner private data */
190  void *owner_priv;
191 };
192 
193 /** Infiniband completion queue operations */
195  /**
196  * Complete Send WQE
197  *
198  * @v ibdev Infiniband device
199  * @v qp Queue pair
200  * @v iobuf I/O buffer
201  * @v rc Completion status code
202  */
203  void ( * complete_send ) ( struct ib_device *ibdev,
204  struct ib_queue_pair *qp,
205  struct io_buffer *iobuf, int rc );
206  /**
207  * Complete Receive WQE
208  *
209  * @v ibdev Infiniband device
210  * @v qp Queue pair
211  * @v dest Destination address vector, or NULL
212  * @v source Source address vector, or NULL
213  * @v iobuf I/O buffer
214  * @v rc Completion status code
215  */
216  void ( * complete_recv ) ( struct ib_device *ibdev,
217  struct ib_queue_pair *qp,
218  struct ib_address_vector *dest,
219  struct ib_address_vector *source,
220  struct io_buffer *iobuf, int rc );
221 };
222 
223 /** An Infiniband Completion Queue */
225  /** Containing Infiniband device */
226  struct ib_device *ibdev;
227  /** List of completion queues on this Infiniband device */
228  struct list_head list;
229  /** Completion queue number */
230  unsigned long cqn;
231  /** Number of completion queue entries */
232  unsigned int num_cqes;
233  /** Next completion queue entry index
234  *
235  * This is the index of the next entry to be filled (i.e. the
236  * first empty entry). This value is not bounded by num_wqes;
237  * users must logical-AND with (num_wqes-1) to generate an
238  * array index.
239  */
240  unsigned long next_idx;
241  /** List of work queues completing to this queue */
243  /** Completion queue operations */
245  /** Driver private data */
246  void *drv_priv;
247 };
248 
249 /**
250  * Infiniband device operations
251  *
252  * These represent a subset of the Infiniband Verbs.
253  */
255  /** Create completion queue
256  *
257  * @v ibdev Infiniband device
258  * @v cq Completion queue
259  * @ret rc Return status code
260  */
261  int ( * create_cq ) ( struct ib_device *ibdev,
262  struct ib_completion_queue *cq );
263  /** Destroy completion queue
264  *
265  * @v ibdev Infiniband device
266  * @v cq Completion queue
267  */
268  void ( * destroy_cq ) ( struct ib_device *ibdev,
269  struct ib_completion_queue *cq );
270  /** Create queue pair
271  *
272  * @v ibdev Infiniband device
273  * @v qp Queue pair
274  * @ret rc Return status code
275  */
276  int ( * create_qp ) ( struct ib_device *ibdev,
277  struct ib_queue_pair *qp );
278  /** Modify queue pair
279  *
280  * @v ibdev Infiniband device
281  * @v qp Queue pair
282  * @ret rc Return status code
283  */
284  int ( * modify_qp ) ( struct ib_device *ibdev,
285  struct ib_queue_pair *qp );
286  /** Destroy queue pair
287  *
288  * @v ibdev Infiniband device
289  * @v qp Queue pair
290  */
291  void ( * destroy_qp ) ( struct ib_device *ibdev,
292  struct ib_queue_pair *qp );
293  /** Post send work queue entry
294  *
295  * @v ibdev Infiniband device
296  * @v qp Queue pair
297  * @v dest Destination address vector
298  * @v iobuf I/O buffer
299  * @ret rc Return status code
300  *
301  * If this method returns success, the I/O buffer remains
302  * owned by the queue pair. If this method returns failure,
303  * the I/O buffer is immediately released; the failure is
304  * interpreted as "failure to enqueue buffer".
305  */
306  int ( * post_send ) ( struct ib_device *ibdev,
307  struct ib_queue_pair *qp,
308  struct ib_address_vector *dest,
309  struct io_buffer *iobuf );
310  /** Post receive work queue entry
311  *
312  * @v ibdev Infiniband device
313  * @v qp Queue pair
314  * @v iobuf I/O buffer
315  * @ret rc Return status code
316  *
317  * If this method returns success, the I/O buffer remains
318  * owned by the queue pair. If this method returns failure,
319  * the I/O buffer is immediately released; the failure is
320  * interpreted as "failure to enqueue buffer".
321  */
322  int ( * post_recv ) ( struct ib_device *ibdev,
323  struct ib_queue_pair *qp,
324  struct io_buffer *iobuf );
325  /** Poll completion queue
326  *
327  * @v ibdev Infiniband device
328  * @v cq Completion queue
329  *
330  * The relevant completion handler (specified at completion
331  * queue creation time) takes ownership of the I/O buffer.
332  */
333  void ( * poll_cq ) ( struct ib_device *ibdev,
334  struct ib_completion_queue *cq );
335  /**
336  * Poll event queue
337  *
338  * @v ibdev Infiniband device
339  */
340  void ( * poll_eq ) ( struct ib_device *ibdev );
341  /**
342  * Open port
343  *
344  * @v ibdev Infiniband device
345  * @ret rc Return status code
346  */
347  int ( * open ) ( struct ib_device *ibdev );
348  /**
349  * Close port
350  *
351  * @v ibdev Infiniband device
352  */
353  void ( * close ) ( struct ib_device *ibdev );
354  /** Attach to multicast group
355  *
356  * @v ibdev Infiniband device
357  * @v qp Queue pair
358  * @v gid Multicast GID
359  * @ret rc Return status code
360  */
361  int ( * mcast_attach ) ( struct ib_device *ibdev,
362  struct ib_queue_pair *qp,
363  union ib_gid *gid );
364  /** Detach from multicast group
365  *
366  * @v ibdev Infiniband device
367  * @v qp Queue pair
368  * @v gid Multicast GID
369  */
370  void ( * mcast_detach ) ( struct ib_device *ibdev,
371  struct ib_queue_pair *qp,
372  union ib_gid *gid );
373  /** Set port information
374  *
375  * @v ibdev Infiniband device
376  * @v mad Set port information MAD
377  *
378  * This method is required only by adapters that do not have
379  * an embedded SMA.
380  */
381  int ( * set_port_info ) ( struct ib_device *ibdev, union ib_mad *mad );
382  /** Set partition key table
383  *
384  * @v ibdev Infiniband device
385  * @v mad Set partition key table MAD
386  *
387  * This method is required only by adapters that do not have
388  * an embedded SMA.
389  */
390  int ( * set_pkey_table ) ( struct ib_device *ibdev,
391  union ib_mad *mad );
392 };
393 
394 /** Maximum length of an Infiniband device name */
395 #define IBDEV_NAME_LEN 8
396 
397 /** An Infiniband device */
398 struct ib_device {
399  /** Reference counter */
400  struct refcnt refcnt;
401  /** List of Infiniband devices */
402  struct list_head list;
403  /** List of open Infiniband devices */
405  /** Index of this Infiniband device */
406  unsigned int index;
407  /** Name of this Infiniband device */
409  /** Underlying device */
410  struct device *dev;
411  /** List of completion queues */
412  struct list_head cqs;
413  /** List of queue pairs */
414  struct list_head qps;
415  /** Infiniband operations */
417  /** Port number */
418  unsigned int port;
419  /** Port open request counter */
420  unsigned int open_count;
421 
422  /** Port state */
424  /** Link width supported */
426  /** Link width enabled */
428  /** Link width active */
430  /** Link speed supported */
432  /** Link speed enabled */
434  /** Link speed active */
436  /** Node GUID */
438  /** Port GID (comprising GID prefix and port GUID) */
439  union ib_gid gid;
440  /** Port LID */
442  /** Subnet manager LID */
444  /** Subnet manager SL */
446  /** Partition key */
448 
449  /** RDMA key
450  *
451  * This is a single key allowing unrestricted access to
452  * memory.
453  */
455 
456  /** Subnet management interface */
458  /** General services interface */
460 
461  /** IPoIB LEMAC (if non-default) */
463 
464  /** Driver private data */
465  void *drv_priv;
466 };
467 
468 /** An Infiniband upper-layer driver */
469 struct ib_driver {
470  /** Name */
471  const char *name;
472  /** Probe device
473  *
474  * @v ibdev Infiniband device
475  * @ret rc Return status code
476  */
477  int ( * probe ) ( struct ib_device *ibdev );
478  /** Notify of device or link state change
479  *
480  * @v ibdev Infiniband device
481  */
482  void ( * notify ) ( struct ib_device *ibdev );
483  /** Remove device
484  *
485  * @v ibdev Infiniband device
486  */
487  void ( * remove ) ( struct ib_device *ibdev );
488 };
489 
490 /** Infiniband driver table */
491 #define IB_DRIVERS __table ( struct ib_driver, "ib_drivers" )
492 
493 /** Declare an Infiniband driver */
494 #define __ib_driver __table_entry ( IB_DRIVERS, 01 )
495 
496 extern int ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
498  struct ib_completion_queue **new_cq );
499 extern void ib_destroy_cq ( struct ib_device *ibdev,
500  struct ib_completion_queue *cq );
501 extern void ib_poll_cq ( struct ib_device *ibdev,
502  struct ib_completion_queue *cq );
503 extern int ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
504  unsigned int num_send_wqes,
505  struct ib_completion_queue *send_cq,
506  unsigned int num_recv_wqes,
507  struct ib_completion_queue *recv_cq,
509  const char *name, struct ib_queue_pair **new_qp );
510 extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
511 extern void ib_destroy_qp ( struct ib_device *ibdev,
512  struct ib_queue_pair *qp );
513 extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
514  unsigned long qpn );
515 extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
516  union ib_gid *gid );
517 extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
518  unsigned long qpn, int is_send );
519 extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
520  struct ib_address_vector *dest,
521  struct io_buffer *iobuf );
522 extern int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
523  struct io_buffer *iobuf );
524 extern void ib_complete_send ( struct ib_device *ibdev,
525  struct ib_queue_pair *qp,
526  struct io_buffer *iobuf, int rc );
527 extern void ib_complete_recv ( struct ib_device *ibdev,
528  struct ib_queue_pair *qp,
529  struct ib_address_vector *dest,
530  struct ib_address_vector *source,
531  struct io_buffer *iobuf, int rc );
532 extern void ib_refill_recv ( struct ib_device *ibdev,
533  struct ib_queue_pair *qp );
534 extern int ib_open ( struct ib_device *ibdev );
535 extern void ib_close ( struct ib_device *ibdev );
536 extern int ib_link_rc ( struct ib_device *ibdev );
537 extern int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
538  union ib_gid *gid );
539 extern void ib_mcast_detach ( struct ib_device *ibdev,
540  struct ib_queue_pair *qp, union ib_gid *gid );
541 extern int ib_count_ports ( struct ib_device *ibdev );
542 extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
543 extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
544 extern struct ib_device * alloc_ibdev ( size_t priv_size );
545 extern int register_ibdev ( struct ib_device *ibdev );
546 extern void unregister_ibdev ( struct ib_device *ibdev );
547 extern struct ib_device * find_ibdev ( union ib_gid *gid );
548 extern struct ib_device * last_opened_ibdev ( void );
549 extern void ib_link_state_changed ( struct ib_device *ibdev );
550 extern void ib_poll_eq ( struct ib_device *ibdev );
551 extern struct list_head ib_devices;
552 
553 /** Iterate over all network devices */
554 #define for_each_ibdev( ibdev ) \
555  list_for_each_entry ( (ibdev), &ib_devices, list )
556 
557 /**
558  * Check link state of Infiniband device
559  *
560  * @v ibdev Infiniband device
561  * @ret link_up Link is up
562  */
563 static inline __always_inline int
564 ib_link_ok ( struct ib_device *ibdev ) {
565  return ( ibdev->port_state == IB_PORT_STATE_ACTIVE );
566 }
567 
568 /**
569  * Check whether or not Infiniband device is open
570  *
571  * @v ibdev Infiniband device
572  * @v is_open Infiniband device is open
573  */
574 static inline __attribute__ (( always_inline )) int
575 ib_is_open ( struct ib_device *ibdev ) {
576  return ( ibdev->open_count > 0 );
577 }
578 
579 /**
580  * Get reference to Infiniband device
581  *
582  * @v ibdev Infiniband device
583  * @ret ibdev Infiniband device
584  */
585 static inline __always_inline struct ib_device *
586 ibdev_get ( struct ib_device *ibdev ) {
587  ref_get ( &ibdev->refcnt );
588  return ibdev;
589 }
590 
591 /**
592  * Drop reference to Infiniband device
593  *
594  * @v ibdev Infiniband device
595  */
596 static inline __always_inline void
597 ibdev_put ( struct ib_device *ibdev ) {
598  ref_put ( &ibdev->refcnt );
599 }
600 
601 /**
602  * Set Infiniband work queue driver-private data
603  *
604  * @v wq Work queue
605  * @v priv Private data
606  */
607 static inline __always_inline void
608 ib_wq_set_drvdata ( struct ib_work_queue *wq, void *priv ) {
609  wq->drv_priv = priv;
610 }
611 
612 /**
613  * Get Infiniband work queue driver-private data
614  *
615  * @v wq Work queue
616  * @ret priv Private data
617  */
618 static inline __always_inline void *
620  return wq->drv_priv;
621 }
622 
623 /**
624  * Set Infiniband queue pair driver-private data
625  *
626  * @v qp Queue pair
627  * @v priv Private data
628  */
629 static inline __always_inline void
631  qp->drv_priv = priv;
632 }
633 
634 /**
635  * Get Infiniband queue pair driver-private data
636  *
637  * @v qp Queue pair
638  * @ret priv Private data
639  */
640 static inline __always_inline void *
642  return qp->drv_priv;
643 }
644 
645 /**
646  * Set Infiniband queue pair owner-private data
647  *
648  * @v qp Queue pair
649  * @v priv Private data
650  */
651 static inline __always_inline void
653  qp->owner_priv = priv;
654 }
655 
656 /**
657  * Get Infiniband queue pair owner-private data
658  *
659  * @v qp Queue pair
660  * @ret priv Private data
661  */
662 static inline __always_inline void *
664  return qp->owner_priv;
665 }
666 
667 /**
668  * Set Infiniband completion queue driver-private data
669  *
670  * @v cq Completion queue
671  * @v priv Private data
672  */
673 static inline __always_inline void
675  cq->drv_priv = priv;
676 }
677 
678 /**
679  * Get Infiniband completion queue driver-private data
680  *
681  * @v cq Completion queue
682  * @ret priv Private data
683  */
684 static inline __always_inline void *
686  return cq->drv_priv;
687 }
688 
689 /**
690  * Set Infiniband device driver-private data
691  *
692  * @v ibdev Infiniband device
693  * @v priv Private data
694  */
695 static inline __always_inline void
696 ib_set_drvdata ( struct ib_device *ibdev, void *priv ) {
697  ibdev->drv_priv = priv;
698 }
699 
700 /**
701  * Get Infiniband device driver-private data
702  *
703  * @v ibdev Infiniband device
704  * @ret priv Private data
705  */
706 static inline __always_inline void *
707 ib_get_drvdata ( struct ib_device *ibdev ) {
708  return ibdev->drv_priv;
709 }
710 
711 #endif /* _IPXE_INFINIBAND_H */
struct ib_mad_interface * smi
Subnet management interface.
Definition: infiniband.h:457
#define __attribute__(x)
Definition: compiler.h:10
static __always_inline void ib_set_drvdata(struct ib_device *ibdev, void *priv)
Set Infiniband device driver-private data.
Definition: infiniband.h:696
void ib_close(struct ib_device *ibdev)
Close port.
Definition: infiniband.c:716
int(* set_port_info)(struct ib_device *ibdev, union ib_mad *mad)
Set port information.
Definition: infiniband.h:381
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Definition: ath9k_hw.c:1984
unsigned short uint16_t
Definition: stdint.h:11
int(* set_pkey_table)(struct ib_device *ibdev, union ib_mad *mad)
Set partition key table.
Definition: infiniband.h:390
void(* 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 WQE.
Definition: infiniband.h:216
static __always_inline int ib_link_ok(struct ib_device *ibdev)
Check link state of Infiniband device.
Definition: infiniband.h:564
void ib_refill_recv(struct ib_device *ibdev, struct ib_queue_pair *qp)
Refill receive work queue.
Definition: infiniband.c:556
int(* probe)(struct ib_device *ibdev)
Probe device.
Definition: infiniband.h:477
int ib_count_ports(struct ib_device *ibdev)
Count Infiniband HCA ports.
Definition: infiniband.c:822
char name[IBDEV_NAME_LEN]
Name of this Infiniband device.
Definition: infiniband.h:408
union ib_gid gid
Port GID (comprising GID prefix and port GUID)
Definition: infiniband.h:439
static int ib_is_open(struct ib_device *ibdev)
Check whether or not Infiniband device is open.
Definition: infiniband.h:575
Infiniband device operations.
Definition: infiniband.h:254
struct list_head mgids
List of multicast GIDs.
Definition: infiniband.h:182
void(* poll_eq)(struct ib_device *ibdev)
Poll event queue.
Definition: infiniband.h:340
int(* open)(struct ib_device *ibdev)
Open port.
Definition: infiniband.h:347
unsigned int open_count
Port open request counter.
Definition: infiniband.h:420
int ib_create_cq(struct ib_device *ibdev, unsigned int num_cqes, struct ib_completion_queue_operations *op, struct ib_completion_queue **new_cq)
Create completion queue.
Definition: infiniband.c:98
int(* post_recv)(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf)
Post receive work queue entry.
Definition: infiniband.h:322
void(* mcast_detach)(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Detach from multicast group.
Definition: infiniband.h:370
uint16_t lid
Port LID.
Definition: infiniband.h:441
uint8_t type
Type.
Definition: ena.h:16
void ib_poll_eq(struct ib_device *ibdev)
Poll event queue.
Definition: infiniband.c:898
void ib_mcast_detach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Detach from multicast group.
Definition: infiniband.c:789
void ib_link_state_changed(struct ib_device *ibdev)
Notify of Infiniband link state change.
Definition: infiniband.c:637
struct device * dev
Underlying device.
Definition: infiniband.h:410
void(* notify)(struct ib_device *ibdev)
Notify of device or link state change.
Definition: infiniband.h:482
static __always_inline void * ib_qp_get_drvdata(struct ib_queue_pair *qp)
Get Infiniband queue pair driver-private data.
Definition: infiniband.h:641
void * owner_priv
Queue owner private data.
Definition: infiniband.h:190
struct ib_mad_interface * gsi
General services interface.
Definition: infiniband.h:459
void * drv_priv
Driver private data.
Definition: infiniband.h:465
An Infiniband upper-layer driver.
Definition: infiniband.h:469
int ib_set_pkey_table(struct ib_device *ibdev, union ib_mad *mad)
Set partition key table.
Definition: infiniband.c:867
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
uint32_t psn
Packet sequence number.
Definition: infiniband.h:110
An Infiniband management interface.
Definition: ib_mi.h:88
unsigned int gid_present
GID is present.
Definition: infiniband.h:90
struct ib_work_queue recv
Receive queue.
Definition: infiniband.h:180
int ib_set_port_info(struct ib_device *ibdev, union ib_mad *mad)
Set port information.
Definition: infiniband.c:842
unsigned int vlan
VLAN, if present.
Definition: infiniband.h:96
uint8_t link_speed_enabled
Link speed enabled.
Definition: infiniband.h:433
static __always_inline struct ib_device * ibdev_get(struct ib_device *ibdev)
Get reference to Infiniband device.
Definition: infiniband.h:586
An Infiniband Global Identifier.
Definition: ib_packet.h:33
__be32 qpn
Definition: CIB_PRM.h:29
#define IBDEV_NAME_LEN
Maximum length of an Infiniband device name.
Definition: infiniband.h:395
struct list_head list
List of multicast GIDs on this QP.
Definition: infiniband.h:132
unsigned long qkey
Queue key.
Definition: infiniband.h:176
uint8_t link_width_enabled
Link width enabled.
Definition: infiniband.h:427
uint8_t link_width_supported
Link width supported.
Definition: infiniband.h:425
A doubly-linked list entry (or list head)
Definition: list.h:18
enum ib_rate rate
Rate.
Definition: infiniband.h:86
A reference counter.
Definition: refcnt.h:26
unsigned int index
Index of this Infiniband device.
Definition: infiniband.h:406
int(* mcast_attach)(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Attach to multicast group.
Definition: infiniband.h:361
An Infiniband device.
Definition: infiniband.h:398
struct ib_completion_queue * cq
Associated completion queue.
Definition: infiniband.h:106
struct ib_work_queue * ib_find_wq(struct ib_completion_queue *cq, unsigned long qpn, int is_send)
Find work queue belonging to completion queue.
Definition: infiniband.c:396
A hardware device.
Definition: device.h:73
Infiniband completion queue operations.
Definition: infiniband.h:194
enum ib_queue_pair_type type
Queue pair type.
Definition: infiniband.h:174
Infiniband queue pair operations.
Definition: infiniband.h:147
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
Definition: infiniband.h:707
unsigned long qkey
Queue key.
Definition: infiniband.h:79
struct ib_device_operations * op
Infiniband operations.
Definition: infiniband.h:416
struct list_head ib_devices
List of Infiniband devices.
Definition: infiniband.c:52
An Infiniband Work Queue.
Definition: infiniband.h:100
struct ib_queue_pair_operations * op
Queue pair operations.
Definition: infiniband.h:186
const char * name
Queue pair name.
Definition: infiniband.h:163
unsigned long ext_qpn
Externally-visible queue pair number.
Definition: infiniband.h:172
int ib_post_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf)
Post receive work queue entry.
Definition: infiniband.c:470
unsigned long qpn
Queue pair number.
Definition: infiniband.h:165
int(* modify_qp)(struct ib_device *ibdev, struct ib_queue_pair *qp)
Modify queue pair.
Definition: infiniband.h:284
uint16_t sm_lid
Subnet manager LID.
Definition: infiniband.h:443
struct refcnt refcnt
Reference counter.
Definition: infiniband.h:400
void ib_destroy_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
Definition: infiniband.c:314
void * drv_priv
Driver private data.
Definition: infiniband.h:246
struct list_head list
List of queue pairs on this Infiniband device.
Definition: infiniband.h:161
unsigned int num_wqes
Number of work queue entries.
Definition: infiniband.h:112
static void * dest
Definition: strings.h:176
uint8_t sm_sl
Subnet manager SL.
Definition: infiniband.h:445
struct list_head work_queues
List of work queues completing to this queue.
Definition: infiniband.h:242
uint32_t rdma_key
RDMA key.
Definition: infiniband.h:454
struct list_head list
List of Infiniband devices.
Definition: infiniband.h:402
struct ib_completion_queue_operations * op
Completion queue operations.
Definition: infiniband.h:244
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
static __always_inline void ib_cq_set_drvdata(struct ib_completion_queue *cq, void *priv)
Set Infiniband completion queue driver-private data.
Definition: infiniband.h:674
ib_queue_pair_type
An Infiniband queue pair type.
Definition: infiniband.h:138
static __always_inline void * ib_qp_get_ownerdata(struct ib_queue_pair *qp)
Get Infiniband queue pair owner-private data.
Definition: infiniband.h:663
#define ref_get(refcnt)
Get additional reference to object.
Definition: refcnt.h:92
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 __always_inline
Declare a function to be always inline.
Definition: compiler.h:611
An Infiniband Globally Unique Identifier.
Definition: ib_packet.h:18
union ib_guid node_guid
Node GUID.
Definition: infiniband.h:437
unsigned int fill
Number of occupied work queue entries.
Definition: infiniband.h:114
An Infiniband Completion Queue.
Definition: infiniband.h:224
unsigned char uint8_t
Definition: stdint.h:10
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint8_t link_width_active
Link width active.
Definition: infiniband.h:429
unsigned long qpn
Queue Pair Number.
Definition: infiniband.h:74
#define ETH_ALEN
Definition: if_ether.h:8
struct ib_address_vector av
Address vector.
Definition: infiniband.h:184
struct ib_queue_pair * qp
Containing queue pair.
Definition: infiniband.h:102
int(* create_qp)(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create queue pair.
Definition: infiniband.h:276
unsigned int uint32_t
Definition: stdint.h:12
struct ib_device * ibdev
Containing Infiniband device.
Definition: infiniband.h:159
unsigned long next_idx
Next work queue entry index.
Definition: infiniband.h:122
void(* destroy_cq)(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
Definition: infiniband.h:268
unsigned long next_idx
Next completion queue entry index.
Definition: infiniband.h:240
struct list_head list
List of work queues on this completion queue.
Definition: infiniband.h:108
An Infiniband Queue Pair.
Definition: infiniband.h:157
struct list_head cqs
List of completion queues.
Definition: infiniband.h:412
ib_rate
Infiniband transmission rates.
Definition: infiniband.h:59
unsigned int sl
Service level.
Definition: infiniband.h:88
struct ib_queue_pair * ib_find_qp_mgid(struct ib_device *ibdev, union ib_gid *gid)
Find queue pair by multicast GID.
Definition: infiniband.c:372
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
struct ib_device * alloc_ibdev(size_t priv_size)
Allocate Infiniband device.
Definition: infiniband.c:937
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
union ib_gid gid
Multicast GID.
Definition: infiniband.h:134
void * drv_priv
Driver private data.
Definition: infiniband.h:188
void(* destroy_qp)(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
Definition: infiniband.h:291
struct list_head list
List of completion queues on this Infiniband device.
Definition: infiniband.h:228
uint32_t len
Length.
Definition: ena.h:14
static struct tlan_private * priv
Definition: tlan.c:224
uint8_t link_speed_active
Link speed active.
Definition: infiniband.h:435
int ib_modify_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Modify queue pair.
Definition: infiniband.c:294
#define IB_PORT_STATE_ACTIVE
Definition: ib_mad.h:154
Infiniband packet format.
void(* remove)(struct ib_device *ibdev)
Remove device.
Definition: infiniband.h:487
union ib_gid gid
GID, if present.
Definition: infiniband.h:92
int ib_open(struct ib_device *ibdev)
Open port.
Definition: infiniband.c:652
int ib_link_rc(struct ib_device *ibdev)
Get link state.
Definition: infiniband.c:594
uint8_t port_state
Port state.
Definition: infiniband.h:423
void(* close)(struct ib_device *ibdev)
Close port.
Definition: infiniband.h:353
void(* complete_send)(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc)
Complete Send WQE.
Definition: infiniband.h:203
int ib_create_qp(struct ib_device *ibdev, enum ib_queue_pair_type type, unsigned int num_send_wqes, struct ib_completion_queue *send_cq, unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq, struct ib_queue_pair_operations *op, const char *name, struct ib_queue_pair **new_qp)
Create queue pair.
Definition: infiniband.c:199
unsigned long cqn
Completion queue number.
Definition: infiniband.h:230
Reference counting.
unsigned int num_cqes
Number of completion queue entries.
Definition: infiniband.h:232
Linker tables.
int(* 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: infiniband.h:306
A management datagram.
Definition: ib_mad.h:610
uint8_t link_speed_supported
Link speed supported.
Definition: infiniband.h:431
struct list_head qps
List of queue pairs.
Definition: infiniband.h:414
Device model.
void ib_poll_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Poll completion queue.
Definition: infiniband.c:161
Infiniband management datagrams.
struct list_head open_list
List of open Infiniband devices.
Definition: infiniband.h:404
uint16_t pkey
Partition key.
Definition: infiniband.h:447
An Infiniband Address Vector.
Definition: infiniband.h:72
const char * name
Name.
Definition: infiniband.h:471
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
An Infiniband multicast GID.
Definition: infiniband.h:130
int register_ibdev(struct ib_device *ibdev)
Register Infiniband device.
Definition: infiniband.c:964
void unregister_ibdev(struct ib_device *ibdev)
Unregister Infiniband device.
Definition: infiniband.c:1005
unsigned int lid
Local ID.
Definition: infiniband.h:81
void * drv_priv
Driver private data.
Definition: infiniband.h:126
unsigned int vlan_present
VLAN is present.
Definition: infiniband.h:94
void ib_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
Definition: infiniband.c:145
int is_send
"Is a send queue" flag
Definition: infiniband.h:104
u8 gid[16]
Definition: CIB_PRM.h:31
uint8_t lemac[ETH_ALEN]
IPoIB LEMAC (if non-default)
Definition: infiniband.h:462
static __always_inline void * ib_cq_get_drvdata(struct ib_completion_queue *cq)
Get Infiniband completion queue driver-private data.
Definition: infiniband.h:685
struct ib_device * ibdev
Containing Infiniband device.
Definition: infiniband.h:226
int ib_post_send(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *dest, struct io_buffer *iobuf)
Post send work queue entry.
Definition: infiniband.c:416
static __always_inline void ib_qp_set_ownerdata(struct ib_queue_pair *qp, void *priv)
Set Infiniband queue pair owner-private data.
Definition: infiniband.h:652
void(* poll_cq)(struct ib_device *ibdev, struct ib_completion_queue *cq)
Poll completion queue.
Definition: infiniband.h:333
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
struct ib_device * last_opened_ibdev(void)
Get most recently opened Infiniband device.
Definition: infiniband.c:1043
union ib_mad mad
Definition: arbel.h:12
static __always_inline void ib_qp_set_drvdata(struct ib_queue_pair *qp, void *priv)
Set Infiniband queue pair driver-private data.
Definition: infiniband.h:630
struct ib_queue_pair * ib_find_qp_qpn(struct ib_device *ibdev, unsigned long qpn)
Find queue pair by QPN.
Definition: infiniband.c:354
int(* create_cq)(struct ib_device *ibdev, struct ib_completion_queue *cq)
Create completion queue.
Definition: infiniband.h:261
struct ib_device * find_ibdev(union ib_gid *gid)
Find Infiniband device by GID.
Definition: infiniband.c:1028
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106
int ib_mcast_attach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Attach to multicast group.
Definition: infiniband.c:752
A persistent I/O buffer.
Definition: iobuf.h:32
struct ib_work_queue send
Send queue.
Definition: infiniband.h:178
struct io_buffer ** iobufs
I/O buffers assigned to work queue.
Definition: infiniband.h:124