• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _GPXE_IB_SRP_H
2 #define _GPXE_IB_SRP_H
3 
4 /** @file
5  *
6  * SCSI RDMA Protocol over Infiniband
7  *
8  */
9 
10 FILE_LICENCE ( BSD2 );
11 
12 #include <stdint.h>
13 #include <gpxe/infiniband.h>
14 #include <gpxe/srp.h>
15 
16 /** SRP initiator port identifier for Infiniband */
17 struct ib_srp_initiator_port_id {
18 	/** Identifier extension */
19 	struct ib_gid_half id_ext;
20 	/** IB channel adapter GUID */
21 	struct ib_gid_half hca_guid;
22 } __attribute__ (( packed ));
23 
24 /** SRP target port identifier for Infiniband */
25 struct ib_srp_target_port_id {
26 	/** Identifier extension */
27 	struct ib_gid_half id_ext;
28 	/** I/O controller GUID */
29 	struct ib_gid_half ioc_guid;
30 } __attribute__ (( packed ));
31 
32 /**
33  * Get Infiniband-specific initiator port ID
34  *
35  * @v port_ids		SRP port IDs
36  * @ret initiator_port_id  Infiniband-specific initiator port ID
37  */
38 static inline __always_inline struct ib_srp_initiator_port_id *
ib_srp_initiator_port_id(struct srp_port_ids * port_ids)39 ib_srp_initiator_port_id ( struct srp_port_ids *port_ids ) {
40 	return ( ( struct ib_srp_initiator_port_id * ) &port_ids->initiator );
41 }
42 
43 /**
44  * Get Infiniband-specific target port ID
45  *
46  * @v port_ids		SRP port IDs
47  * @ret target_port_id	Infiniband-specific target port ID
48  */
49 static inline __always_inline struct ib_srp_target_port_id *
ib_srp_target_port_id(struct srp_port_ids * port_ids)50 ib_srp_target_port_id ( struct srp_port_ids *port_ids ) {
51 	return ( ( struct ib_srp_target_port_id * ) &port_ids->target );
52 }
53 
54 /** Infiniband-specific SRP parameters */
55 struct ib_srp_parameters {
56 	/** Source GID */
57 	struct ib_gid sgid;
58 	/** Destination GID */
59 	struct ib_gid dgid;
60 	/** Service ID */
61 	struct ib_gid_half service_id;
62 	/** Partition key */
63 	uint16_t pkey;
64 };
65 
66 /**
67  * Get Infiniband-specific transport parameters
68  *
69  * @v srp		SRP device
70  * @ret ib_params	Infiniband-specific transport parameters
71  */
72 static inline __always_inline struct ib_srp_parameters *
ib_srp_params(struct srp_device * srp)73 ib_srp_params ( struct srp_device *srp ) {
74 	return srp_transport_priv ( srp );
75 }
76 
77 extern struct srp_transport_type ib_srp_transport;
78 
79 #endif /* _GPXE_IB_SRP_H */
80