Home | History | Annotate | Download | only in gpxe
      1 #ifndef _GPXE_IB_PATHREC_H
      2 #define _GPXE_IB_PATHREC_H
      3 
      4 /** @file
      5  *
      6  * Infiniband path records
      7  *
      8  */
      9 
     10 FILE_LICENCE ( GPL2_OR_LATER );
     11 
     12 #include <gpxe/infiniband.h>
     13 
     14 struct ib_mad_transaction;
     15 struct ib_path;
     16 
     17 /** Infiniband path operations */
     18 struct ib_path_operations {
     19 	/** Handle path transaction completion
     20 	 *
     21 	 * @v ibdev		Infiniband device
     22 	 * @v path		Path
     23 	 * @v rc		Status code
     24 	 * @v av		Address vector, or NULL on error
     25 	 */
     26 	void ( * complete ) ( struct ib_device *ibdev,
     27 			      struct ib_path *path, int rc,
     28 			      struct ib_address_vector *av );
     29 };
     30 
     31 /** An Infiniband path */
     32 struct ib_path {
     33 	/** Infiniband device */
     34 	struct ib_device *ibdev;
     35 	/** Address vector */
     36 	struct ib_address_vector av;
     37 	/** Management transaction */
     38 	struct ib_mad_transaction *madx;
     39 	/** Path operations */
     40 	struct ib_path_operations *op;
     41 	/** Owner private data */
     42 	void *owner_priv;
     43 };
     44 
     45 /**
     46  * Set Infiniband path owner-private data
     47  *
     48  * @v path		Path
     49  * @v priv		Private data
     50  */
     51 static inline __always_inline void
     52 ib_path_set_ownerdata ( struct ib_path *path, void *priv ) {
     53 	path->owner_priv = priv;
     54 }
     55 
     56 /**
     57  * Get Infiniband path owner-private data
     58  *
     59  * @v path		Path
     60  * @ret priv		Private data
     61  */
     62 static inline __always_inline void *
     63 ib_path_get_ownerdata ( struct ib_path *path ) {
     64 	return path->owner_priv;
     65 }
     66 
     67 extern struct ib_path *
     68 ib_create_path ( struct ib_device *ibdev, struct ib_address_vector *av,
     69 		 struct ib_path_operations *op );
     70 extern void ib_destroy_path ( struct ib_device *ibdev,
     71 			      struct ib_path *path );
     72 
     73 extern int ib_resolve_path ( struct ib_device *ibdev,
     74 			     struct ib_address_vector *av );
     75 
     76 #endif /* _GPXE_IB_PATHREC_H */
     77