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