Home | History | Annotate | Download | only in gpxe
      1 #ifndef _GPXE_IB_CM_H
      2 #define _GPXE_IB_CM_H
      3 
      4 /** @file
      5  *
      6  * Infiniband communication management
      7  *
      8  */
      9 
     10 FILE_LICENCE ( GPL2_OR_LATER );
     11 
     12 #include <gpxe/infiniband.h>
     13 #include <gpxe/retry.h>
     14 
     15 struct ib_mad_transaction;
     16 struct ib_connection;
     17 
     18 /** Infiniband connection operations */
     19 struct ib_connection_operations {
     20 	/** Handle change of connection status
     21 	 *
     22 	 * @v ibdev		Infiniband device
     23 	 * @v qp		Queue pair
     24 	 * @v conn		Connection
     25 	 * @v rc		Connection status code
     26 	 * @v private_data	Private data, if available
     27 	 * @v private_data_len	Length of private data
     28 	 */
     29 	void ( * changed ) ( struct ib_device *ibdev, struct ib_queue_pair *qp,
     30 			     struct ib_connection *conn, int rc,
     31 			     void *private_data, size_t private_data_len );
     32 };
     33 
     34 /** An Infiniband connection */
     35 struct ib_connection {
     36 	/** Infiniband device */
     37 	struct ib_device *ibdev;
     38 	/** Queue pair */
     39 	struct ib_queue_pair *qp;
     40 	/** Local communication ID */
     41 	uint32_t local_id;
     42 	/** Remote communication ID */
     43 	uint32_t remote_id;
     44 	/** Target service ID */
     45 	struct ib_gid_half service_id;
     46 	/** Connection operations */
     47 	struct ib_connection_operations *op;
     48 
     49 	/** List of connections */
     50 	struct list_head list;
     51 
     52 	/** Path to target */
     53 	struct ib_path *path;
     54 	/** Connection request management transaction */
     55 	struct ib_mad_transaction *madx;
     56 
     57 	/** Length of connection request private data */
     58 	size_t private_data_len;
     59 	/** Connection request private data */
     60 	uint8_t private_data[0];
     61 };
     62 
     63 extern struct ib_connection *
     64 ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
     65 		 struct ib_gid *dgid, struct ib_gid_half *service_id,
     66 		 void *req_private_data, size_t req_private_data_len,
     67 		 struct ib_connection_operations *op );
     68 extern void ib_destroy_conn ( struct ib_device *ibdev,
     69 			      struct ib_queue_pair *qp,
     70 			      struct ib_connection *conn );
     71 
     72 #endif /* _GPXE_IB_CM_H */
     73