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  /** Total ports on device */
420  unsigned int ports;
421  /** Port open request counter */
422  unsigned int open_count;
423 
424  /** Port state */
426  /** Link width supported */
428  /** Link width enabled */
430  /** Link width active */
432  /** Link speed supported */
434  /** Link speed enabled */
436  /** Link speed active */
438  /** Node GUID */
440  /** Port GID (comprising GID prefix and port GUID) */
441  union ib_gid gid;
442  /** Port LID */
444  /** Subnet manager LID */
446  /** Subnet manager SL */
448  /** Partition key */
450 
451  /** RDMA key
452  *
453  * This is a single key allowing unrestricted access to
454  * memory.
455  */
457 
458  /** Subnet management interface */
460  /** General services interface */
462 
463  /** IPoIB LEMAC (if non-default) */
465 
466  /** Driver private data */
467  void *drv_priv;
468 };
469 
470 /** An Infiniband upper-layer driver */
471 struct ib_driver {
472  /** Name */
473  const char *name;
474  /** Probe device
475  *
476  * @v ibdev Infiniband device
477  * @ret rc Return status code
478  */
479  int ( * probe ) ( struct ib_device *ibdev );
480  /** Notify of device or link state change
481  *
482  * @v ibdev Infiniband device
483  */
484  void ( * notify ) ( struct ib_device *ibdev );
485  /** Remove device
486  *
487  * @v ibdev Infiniband device
488  */
489  void ( * remove ) ( struct ib_device *ibdev );
490 };
491 
492 /** Infiniband driver table */
493 #define IB_DRIVERS __table ( struct ib_driver, "ib_drivers" )
494 
495 /** Declare an Infiniband driver */
496 #define __ib_driver __table_entry ( IB_DRIVERS, 01 )
497 
498 extern int ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
500  struct ib_completion_queue **new_cq );
501 extern void ib_destroy_cq ( struct ib_device *ibdev,
502  struct ib_completion_queue *cq );
503 extern void ib_poll_cq ( struct ib_device *ibdev,
504  struct ib_completion_queue *cq );
505 extern int ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
506  unsigned int num_send_wqes,
507  struct ib_completion_queue *send_cq,
508  unsigned int num_recv_wqes,
509  struct ib_completion_queue *recv_cq,
511  const char *name, struct ib_queue_pair **new_qp );
512 extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
513 extern void ib_destroy_qp ( struct ib_device *ibdev,
514  struct ib_queue_pair *qp );
515 extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
516  unsigned long qpn );
517 extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
518  union ib_gid *gid );
519 extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
520  unsigned long qpn, int is_send );
521 extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
522  struct ib_address_vector *dest,
523  struct io_buffer *iobuf );
524 extern int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
525  struct io_buffer *iobuf );
526 extern void ib_complete_send ( struct ib_device *ibdev,
527  struct ib_queue_pair *qp,
528  struct io_buffer *iobuf, int rc );
529 extern void ib_complete_recv ( struct ib_device *ibdev,
530  struct ib_queue_pair *qp,
531  struct ib_address_vector *dest,
532  struct ib_address_vector *source,
533  struct io_buffer *iobuf, int rc );
534 extern void ib_refill_recv ( struct ib_device *ibdev,
535  struct ib_queue_pair *qp );
536 extern int ib_open ( struct ib_device *ibdev );
537 extern void ib_close ( struct ib_device *ibdev );
538 extern int ib_link_rc ( struct ib_device *ibdev );
539 extern int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
540  union ib_gid *gid );
541 extern void ib_mcast_detach ( struct ib_device *ibdev,
542  struct ib_queue_pair *qp, union ib_gid *gid );
543 extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
544 extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
545 extern struct ib_device * alloc_ibdev ( size_t priv_size );
546 extern int register_ibdev ( struct ib_device *ibdev );
547 extern void unregister_ibdev ( struct ib_device *ibdev );
548 extern struct ib_device * find_ibdev ( union ib_gid *gid );
549 extern struct ib_device * last_opened_ibdev ( void );
550 extern void ib_link_state_changed ( struct ib_device *ibdev );
551 extern void ib_poll_eq ( struct ib_device *ibdev );
552 extern struct list_head ib_devices;
553 
554 /** Iterate over all network devices */
555 #define for_each_ibdev( ibdev ) \
556  list_for_each_entry ( (ibdev), &ib_devices, list )
557 
558 /**
559  * Check link state of Infiniband device
560  *
561  * @v ibdev Infiniband device
562  * @ret link_up Link is up
563  */
564 static inline __always_inline int
565 ib_link_ok ( struct ib_device *ibdev ) {
566  return ( ibdev->port_state == IB_PORT_STATE_ACTIVE );
567 }
568 
569 /**
570  * Check whether or not Infiniband device is open
571  *
572  * @v ibdev Infiniband device
573  * @v is_open Infiniband device is open
574  */
575 static inline __attribute__ (( always_inline )) int
576 ib_is_open ( struct ib_device *ibdev ) {
577  return ( ibdev->open_count > 0 );
578 }
579 
580 /**
581  * Get reference to Infiniband device
582  *
583  * @v ibdev Infiniband device
584  * @ret ibdev Infiniband device
585  */
586 static inline __always_inline struct ib_device *
587 ibdev_get ( struct ib_device *ibdev ) {
588  ref_get ( &ibdev->refcnt );
589  return ibdev;
590 }
591 
592 /**
593  * Drop reference to Infiniband device
594  *
595  * @v ibdev Infiniband device
596  */
597 static inline __always_inline void
598 ibdev_put ( struct ib_device *ibdev ) {
599  ref_put ( &ibdev->refcnt );
600 }
601 
602 /**
603  * Set Infiniband work queue driver-private data
604  *
605  * @v wq Work queue
606  * @v priv Private data
607  */
608 static inline __always_inline void
609 ib_wq_set_drvdata ( struct ib_work_queue *wq, void *priv ) {
610  wq->drv_priv = priv;
611 }
612 
613 /**
614  * Get Infiniband work queue driver-private data
615  *
616  * @v wq Work queue
617  * @ret priv Private data
618  */
619 static inline __always_inline void *
621  return wq->drv_priv;
622 }
623 
624 /**
625  * Set Infiniband queue pair driver-private data
626  *
627  * @v qp Queue pair
628  * @v priv Private data
629  */
630 static inline __always_inline void
632  qp->drv_priv = priv;
633 }
634 
635 /**
636  * Get Infiniband queue pair driver-private data
637  *
638  * @v qp Queue pair
639  * @ret priv Private data
640  */
641 static inline __always_inline void *
643  return qp->drv_priv;
644 }
645 
646 /**
647  * Set Infiniband queue pair owner-private data
648  *
649  * @v qp Queue pair
650  * @v priv Private data
651  */
652 static inline __always_inline void
654  qp->owner_priv = priv;
655 }
656 
657 /**
658  * Get Infiniband queue pair owner-private data
659  *
660  * @v qp Queue pair
661  * @ret priv Private data
662  */
663 static inline __always_inline void *
665  return qp->owner_priv;
666 }
667 
668 /**
669  * Set Infiniband completion queue driver-private data
670  *
671  * @v cq Completion queue
672  * @v priv Private data
673  */
674 static inline __always_inline void
676  cq->drv_priv = priv;
677 }
678 
679 /**
680  * Get Infiniband completion queue driver-private data
681  *
682  * @v cq Completion queue
683  * @ret priv Private data
684  */
685 static inline __always_inline void *
687  return cq->drv_priv;
688 }
689 
690 /**
691  * Set Infiniband device driver-private data
692  *
693  * @v ibdev Infiniband device
694  * @v priv Private data
695  */
696 static inline __always_inline void
697 ib_set_drvdata ( struct ib_device *ibdev, void *priv ) {
698  ibdev->drv_priv = priv;
699 }
700 
701 /**
702  * Get Infiniband device driver-private data
703  *
704  * @v ibdev Infiniband device
705  * @ret priv Private data
706  */
707 static inline __always_inline void *
708 ib_get_drvdata ( struct ib_device *ibdev ) {
709  return ibdev->drv_priv;
710 }
711 
712 #endif /* _IPXE_INFINIBAND_H */
struct ib_mad_interface * smi
Subnet management interface.
Definition: infiniband.h:459
#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:697
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:565
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:479
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:441
static int ib_is_open(struct ib_device *ibdev)
Check whether or not Infiniband device is open.
Definition: infiniband.h:576
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:422
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:443
uint32_t type
Operating system type.
Definition: ena.h:12
void ib_poll_eq(struct ib_device *ibdev)
Poll event queue.
Definition: infiniband.c:878
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:484
static __always_inline void * ib_qp_get_drvdata(struct ib_queue_pair *qp)
Get Infiniband queue pair driver-private data.
Definition: infiniband.h:642
void * owner_priv
Queue owner private data.
Definition: infiniband.h:190
struct ib_mad_interface * gsi
General services interface.
Definition: infiniband.h:461
void * drv_priv
Driver private data.
Definition: infiniband.h:467
An Infiniband upper-layer driver.
Definition: infiniband.h:471
int ib_set_pkey_table(struct ib_device *ibdev, union ib_mad *mad)
Set partition key table.
Definition: infiniband.c:847
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:822
unsigned int vlan
VLAN, if present.
Definition: infiniband.h:96
uint8_t link_speed_enabled
Link speed enabled.
Definition: infiniband.h:435
static __always_inline struct ib_device * ibdev_get(struct ib_device *ibdev)
Get reference to Infiniband device.
Definition: infiniband.h:587
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:429
uint8_t link_width_supported
Link width supported.
Definition: infiniband.h:427
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:708
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:445
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
uint8_t sm_sl
Subnet manager SL.
Definition: infiniband.h:447
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:456
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:598
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:675
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:664
#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:620
#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:439
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:431
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
unsigned int ports
Total ports on device.
Definition: infiniband.h:420
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:917
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
static struct tlan_private * priv
Definition: tlan.c:224
uint8_t link_speed_active
Link speed active.
Definition: infiniband.h:437
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:489
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:425
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.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
Definition: string.h:150
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:433
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:449
An Infiniband Address Vector.
Definition: infiniband.h:72
const char * name
Name.
Definition: infiniband.h:473
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:944
void unregister_ibdev(struct ib_device *ibdev)
Unregister Infiniband device.
Definition: infiniband.c:985
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:464
static __always_inline void * ib_cq_get_drvdata(struct ib_completion_queue *cq)
Get Infiniband completion queue driver-private data.
Definition: infiniband.h:686
uint32_t len
Length.
Definition: ena.h:14
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:653
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:609
struct ib_device * last_opened_ibdev(void)
Get most recently opened Infiniband device.
Definition: infiniband.c:1023
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:631
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:1008
#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:33
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