瀏覽代碼

[infiniband] Add infrastructure for RC queue pairs

Queue pairs are now assumed to be created in the INIT state, with a
call to ib_modify_qp() required to bring the queue pair to the RTS
state.

ib_modify_qp() no longer takes a modification list; callers should
modify the relevant queue pair parameters (e.g. qkey) directly and
then call ib_modify_qp() to synchronise the changes to the hardware.

The packet sequence number is now a property of the queue pair, rather
than of the device.

Each queue pair may have an associated address vector.  For RC queue
pairs, this is the address vector that will be programmed in to the
hardware as the remote address.  For UD queue pairs, it will be used
as the default address vector if none is supplied to ib_post_send().
tags/v0.9.8
Michael Brown 15 年之前
父節點
當前提交
c939bc57ff

+ 2
- 10
src/drivers/infiniband/arbel.c 查看文件

@@ -855,7 +855,6 @@ static int arbel_create_qp ( struct ib_device *ibdev,
855 855
 		     ( virt_to_bus ( arbel_qp->recv.wqe ) >> 6 ) );
856 856
 	MLX_FILL_1 ( &qpctx, 43, qpc_eec_data.rcv_db_record_index,
857 857
 		     arbel_qp->recv.doorbell_idx );
858
-	MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
859 858
 	if ( ( rc = arbel_cmd_rst2init_qpee ( arbel, qp->qpn, &qpctx )) != 0 ){
860 859
 		DBGC ( arbel, "Arbel %p RST2INIT_QPEE failed: %s\n",
861 860
 		       arbel, strerror ( rc ) );
@@ -908,24 +907,17 @@ static int arbel_create_qp ( struct ib_device *ibdev,
908 907
  *
909 908
  * @v ibdev		Infiniband device
910 909
  * @v qp		Queue pair
911
- * @v mod_list		Modification list
912 910
  * @ret rc		Return status code
913 911
  */
914 912
 static int arbel_modify_qp ( struct ib_device *ibdev,
915
-			     struct ib_queue_pair *qp,
916
-			     unsigned long mod_list ) {
913
+			     struct ib_queue_pair *qp ) {
917 914
 	struct arbel *arbel = ib_get_drvdata ( ibdev );
918 915
 	struct arbelprm_qp_ee_state_transitions qpctx;
919
-	unsigned long optparammask = 0;
920 916
 	int rc;
921 917
 
922
-	/* Construct optparammask */
923
-	if ( mod_list & IB_MODIFY_QKEY )
924
-		optparammask |= ARBEL_QPEE_OPT_PARAM_QKEY;
925
-
926 918
 	/* Issue RTS2RTS_QP */
927 919
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
928
-	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, optparammask );
920
+	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, ARBEL_QPEE_OPT_PARAM_QKEY );
929 921
 	MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
930 922
 	if ( ( rc = arbel_cmd_rts2rts_qp ( arbel, qp->qpn, &qpctx ) ) != 0 ){
931 923
 		DBGC ( arbel, "Arbel %p RTS2RTS_QP failed: %s\n",

+ 2
- 10
src/drivers/infiniband/hermon.c 查看文件

@@ -885,7 +885,6 @@ static int hermon_create_qp ( struct ib_device *ibdev,
885 885
 	MLX_FILL_1 ( &qpctx, 41, qpc_eec_data.cqn_rcv, qp->recv.cq->cqn );
886 886
 	MLX_FILL_1 ( &qpctx, 43, qpc_eec_data.db_record_addr_l,
887 887
 		     ( virt_to_phys ( &hermon_qp->recv.doorbell ) >> 2 ) );
888
-	MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
889 888
 	MLX_FILL_1 ( &qpctx, 53, qpc_eec_data.mtt_base_addr_l,
890 889
 		     ( hermon_qp->mtt.mtt_base_addr >> 3 ) );
891 890
 	if ( ( rc = hermon_cmd_rst2init_qp ( hermon, qp->qpn,
@@ -946,24 +945,17 @@ static int hermon_create_qp ( struct ib_device *ibdev,
946 945
  *
947 946
  * @v ibdev		Infiniband device
948 947
  * @v qp		Queue pair
949
- * @v mod_list		Modification list
950 948
  * @ret rc		Return status code
951 949
  */
952 950
 static int hermon_modify_qp ( struct ib_device *ibdev,
953
-			      struct ib_queue_pair *qp,
954
-			      unsigned long mod_list ) {
951
+			      struct ib_queue_pair *qp ) {
955 952
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
956 953
 	struct hermonprm_qp_ee_state_transitions qpctx;
957
-	unsigned long optparammask = 0;
958 954
 	int rc;
959 955
 
960
-	/* Construct optparammask */
961
-	if ( mod_list & IB_MODIFY_QKEY )
962
-		optparammask |= HERMON_QP_OPT_PARAM_QKEY;
963
-
964 956
 	/* Issue RTS2RTS_QP */
965 957
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
966
-	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, optparammask );
958
+	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, HERMON_QP_OPT_PARAM_QKEY );
967 959
 	MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
968 960
 	if ( ( rc = hermon_cmd_rts2rts_qp ( hermon, qp->qpn, &qpctx ) ) != 0 ){
969 961
 		DBGC ( hermon, "Hermon %p RTS2RTS_QP failed: %s\n",

+ 14
- 3
src/drivers/infiniband/linda.c 查看文件

@@ -268,6 +268,18 @@ static int linda_set_port_info ( struct ib_device *ibdev, union ib_mad *mad ) {
268 268
 	return 0;
269 269
 }
270 270
 
271
+/**
272
+ * Set partition key table
273
+ *
274
+ * @v ibdev		Infiniband device
275
+ * @v mad		Set partition key table MAD
276
+ */
277
+static int linda_set_pkey_table ( struct ib_device *ibdev __unused,
278
+				  union ib_mad *mad __unused ) {
279
+	/* Nothing to do */
280
+	return 0;
281
+}
282
+
271 283
 /***************************************************************************
272 284
  *
273 285
  * Context allocation
@@ -852,12 +864,10 @@ static int linda_create_qp ( struct ib_device *ibdev,
852 864
  *
853 865
  * @v ibdev		Infiniband device
854 866
  * @v qp		Queue pair
855
- * @v mod_list		Modification list
856 867
  * @ret rc		Return status code
857 868
  */
858 869
 static int linda_modify_qp ( struct ib_device *ibdev,
859
-			     struct ib_queue_pair *qp,
860
-			     unsigned long mod_list __unused ) {
870
+			     struct ib_queue_pair *qp ) {
861 871
 	struct linda *linda = ib_get_drvdata ( ibdev );
862 872
 
863 873
 	/* Nothing to do; the hardware doesn't have a notion of queue
@@ -1456,6 +1466,7 @@ static struct ib_device_operations linda_ib_operations = {
1456 1466
 	.mcast_attach	= linda_mcast_attach,
1457 1467
 	.mcast_detach	= linda_mcast_detach,
1458 1468
 	.set_port_info	= linda_set_port_info,
1469
+	.set_pkey_table	= linda_set_pkey_table,
1459 1470
 };
1460 1471
 
1461 1472
 /***************************************************************************

+ 1
- 1
src/drivers/net/ipoib.c 查看文件

@@ -521,7 +521,7 @@ static int ipoib_open ( struct net_device *netdev ) {
521 521
 	/* Allocate queue pair */
522 522
 	ipoib->qp = ib_create_qp ( ibdev, IB_QPT_UD,
523 523
 				   IPOIB_NUM_SEND_WQES, ipoib->cq,
524
-				   IPOIB_NUM_RECV_WQES, ipoib->cq, 0 );
524
+				   IPOIB_NUM_RECV_WQES, ipoib->cq );
525 525
 	if ( ! ipoib->qp ) {
526 526
 		DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",
527 527
 		       ipoib );

+ 63
- 51
src/include/gpxe/infiniband.h 查看文件

@@ -47,6 +47,43 @@ struct ib_address_vector;
47 47
 struct ib_completion_queue;
48 48
 struct ib_gma;
49 49
 
50
+/** Infiniband transmission rates */
51
+enum ib_rate {
52
+	IB_RATE_2_5 = 2,
53
+	IB_RATE_10 = 3,
54
+	IB_RATE_30 = 4,
55
+	IB_RATE_5 = 5,
56
+	IB_RATE_20 = 6,
57
+	IB_RATE_40 = 7,
58
+	IB_RATE_60 = 8,
59
+	IB_RATE_80 = 9,
60
+	IB_RATE_120 = 10,
61
+};
62
+
63
+/** An Infiniband Address Vector */
64
+struct ib_address_vector {
65
+	/** Queue Pair Number */
66
+	unsigned long qpn;
67
+	/** Queue key
68
+	 *
69
+	 * Not specified for received packets.
70
+	 */
71
+	unsigned long qkey;
72
+	/** Local ID */
73
+	unsigned int lid;
74
+	/** Rate
75
+	 *
76
+	 * Not specified for received packets.
77
+	 */
78
+	enum ib_rate rate;
79
+	/** Service level */
80
+	unsigned int sl;
81
+	/** GID is present */
82
+	unsigned int gid_present;
83
+	/** GID, if present */
84
+	struct ib_gid gid;
85
+};
86
+
50 87
 /** An Infiniband Work Queue */
51 88
 struct ib_work_queue {
52 89
 	/** Containing queue pair */
@@ -57,6 +94,8 @@ struct ib_work_queue {
57 94
 	struct ib_completion_queue *cq;
58 95
 	/** List of work queues on this completion queue */
59 96
 	struct list_head list;
97
+	/** Packet sequence number */
98
+	uint32_t psn;
60 99
 	/** Number of work queue entries */
61 100
 	unsigned int num_wqes;
62 101
 	/** Number of occupied work queue entries */
@@ -88,6 +127,7 @@ enum ib_queue_pair_type {
88 127
 	IB_QPT_SMA,
89 128
 	IB_QPT_GMA,
90 129
 	IB_QPT_UD,
130
+	IB_QPT_RC,
91 131
 };
92 132
 
93 133
 /** An Infiniband Queue Pair */
@@ -115,54 +155,14 @@ struct ib_queue_pair {
115 155
 	struct ib_work_queue recv;
116 156
 	/** List of multicast GIDs */
117 157
 	struct list_head mgids;
158
+	/** Address vector */
159
+	struct ib_address_vector av;
118 160
 	/** Driver private data */
119 161
 	void *drv_priv;
120 162
 	/** Queue owner private data */
121 163
 	void *owner_priv;
122 164
 };
123 165
 
124
-/** Infiniband queue pair modification flags */
125
-enum ib_queue_pair_mods {
126
-	IB_MODIFY_QKEY = 0x0001,
127
-};
128
-
129
-/** An Infiniband Address Vector */
130
-struct ib_address_vector {
131
-	/** Queue Pair Number */
132
-	unsigned long qpn;
133
-	/** Queue key
134
-	 *
135
-	 * Not specified for received packets.
136
-	 */
137
-	unsigned long qkey;
138
-	/** Local ID */
139
-	unsigned int lid;
140
-	/** Rate
141
-	 *
142
-	 * Not specified for received packets.
143
-	 */
144
-	unsigned int rate;
145
-	/** Service level */
146
-	unsigned int sl;
147
-	/** GID is present */
148
-	unsigned int gid_present;
149
-	/** GID, if present */
150
-	struct ib_gid gid;
151
-};
152
-
153
-/** Infiniband transmission rates */
154
-enum ib_rate {
155
-	IB_RATE_2_5 = 2,
156
-	IB_RATE_10 = 3,
157
-	IB_RATE_30 = 4,
158
-	IB_RATE_5 = 5,
159
-	IB_RATE_20 = 6,
160
-	IB_RATE_40 = 7,
161
-	IB_RATE_60 = 8,
162
-	IB_RATE_80 = 9,
163
-	IB_RATE_120 = 10,
164
-};
165
-
166 166
 /** Infiniband completion queue operations */
167 167
 struct ib_completion_queue_operations {
168 168
 	/**
@@ -250,12 +250,10 @@ struct ib_device_operations {
250 250
 	 *
251 251
 	 * @v ibdev		Infiniband device
252 252
 	 * @v qp		Queue pair
253
-	 * @v mod_list		Modification list
254 253
 	 * @ret rc		Return status code
255 254
 	 */
256 255
 	int ( * modify_qp ) ( struct ib_device *ibdev,
257
-			      struct ib_queue_pair *qp,
258
-			      unsigned long mod_list );
256
+			      struct ib_queue_pair *qp );
259 257
 	/** Destroy queue pair
260 258
 	 *
261 259
 	 * @v ibdev		Infiniband device
@@ -352,6 +350,16 @@ struct ib_device_operations {
352 350
 	 * an embedded SMA.
353 351
 	 */
354 352
 	int ( * set_port_info ) ( struct ib_device *ibdev, union ib_mad *mad );
353
+	/** Set partition key table
354
+	 *
355
+	 * @v ibdev		Infiniband device
356
+	 * @v mad		Set partition key table MAD
357
+	 *
358
+	 * This method is required only by adapters that do not have
359
+	 * an embedded SMA.
360
+	 */
361
+	int ( * set_pkey_table ) ( struct ib_device *ibdev,
362
+				   union ib_mad *mad );
355 363
 };
356 364
 
357 365
 /** An Infiniband device */
@@ -398,8 +406,12 @@ struct ib_device {
398 406
 	/** Partition key */
399 407
 	uint16_t pkey;
400 408
 
401
-	/** Outbound packet sequence number */
402
-	uint32_t psn;
409
+	/** RDMA key
410
+	 *
411
+	 * This is a single key allowing unrestricted access to
412
+	 * memory.
413
+	 */
414
+	uint32_t rdma_key;
403 415
 
404 416
 	/** Subnet management agent */
405 417
 	struct ib_gma *sma;
@@ -422,10 +434,9 @@ extern void ib_poll_cq ( struct ib_device *ibdev,
422 434
 extern struct ib_queue_pair *
423 435
 ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
424 436
 	       unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
425
-	       unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq,
426
-	       unsigned long qkey );
427
-extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp,
428
-			  unsigned long mod_list, unsigned long qkey );
437
+	       unsigned int num_recv_wqes,
438
+	       struct ib_completion_queue *recv_cq );
439
+extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
429 440
 extern void ib_destroy_qp ( struct ib_device *ibdev,
430 441
 			    struct ib_queue_pair *qp );
431 442
 extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
@@ -457,6 +468,7 @@ extern void ib_mcast_detach ( struct ib_device *ibdev,
457 468
 extern int ib_get_hca_info ( struct ib_device *ibdev,
458 469
 			     struct ib_gid_half *hca_guid );
459 470
 extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
471
+extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
460 472
 extern struct ib_device * alloc_ibdev ( size_t priv_size );
461 473
 extern int register_ibdev ( struct ib_device *ibdev );
462 474
 extern void unregister_ibdev ( struct ib_device *ibdev );

+ 43
- 12
src/net/infiniband.c 查看文件

@@ -149,16 +149,17 @@ void ib_poll_cq ( struct ib_device *ibdev,
149 149
  * @v send_cq		Send completion queue
150 150
  * @v num_recv_wqes	Number of receive work queue entries
151 151
  * @v recv_cq		Receive completion queue
152
- * @v qkey		Queue key
153 152
  * @ret qp		Queue pair
153
+ *
154
+ * The queue pair will be left in the INIT state; you must call
155
+ * ib_modify_qp() before it is ready to use for sending and receiving.
154 156
  */
155 157
 struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
156 158
 				      enum ib_queue_pair_type type,
157 159
 				      unsigned int num_send_wqes,
158 160
 				      struct ib_completion_queue *send_cq,
159 161
 				      unsigned int num_recv_wqes,
160
-				      struct ib_completion_queue *recv_cq,
161
-				      unsigned long qkey ) {
162
+				      struct ib_completion_queue *recv_cq ) {
162 163
 	struct ib_queue_pair *qp;
163 164
 	size_t total_size;
164 165
 	int rc;
@@ -175,16 +176,17 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
175 176
 	qp->ibdev = ibdev;
176 177
 	list_add ( &qp->list, &ibdev->qps );
177 178
 	qp->type = type;
178
-	qp->qkey = qkey;
179 179
 	qp->send.qp = qp;
180 180
 	qp->send.is_send = 1;
181 181
 	qp->send.cq = send_cq;
182 182
 	list_add ( &qp->send.list, &send_cq->work_queues );
183
+	qp->send.psn = ( random() & 0xffffffUL );
183 184
 	qp->send.num_wqes = num_send_wqes;
184 185
 	qp->send.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) );
185 186
 	qp->recv.qp = qp;
186 187
 	qp->recv.cq = recv_cq;
187 188
 	list_add ( &qp->recv.list, &recv_cq->work_queues );
189
+	qp->recv.psn = ( random() & 0xffffffUL );
188 190
 	qp->recv.num_wqes = num_recv_wqes;
189 191
 	qp->recv.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) +
190 192
 			    ( num_send_wqes * sizeof ( qp->send.iobufs[0] ) ));
@@ -239,20 +241,15 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
239 241
  *
240 242
  * @v ibdev		Infiniband device
241 243
  * @v qp		Queue pair
242
- * @v mod_list		Modification list
243
- * @v qkey		New queue key, if applicable
244
+ * @v av		New address vector, if applicable
244 245
  * @ret rc		Return status code
245 246
  */
246
-int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp,
247
-		   unsigned long mod_list, unsigned long qkey ) {
247
+int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp ) {
248 248
 	int rc;
249 249
 
250 250
 	DBGC ( ibdev, "IBDEV %p modifying QPN %#lx\n", ibdev, qp->qpn );
251 251
 
252
-	if ( mod_list & IB_MODIFY_QKEY )
253
-		qp->qkey = qkey;
254
-
255
-	if ( ( rc = ibdev->op->modify_qp ( ibdev, qp, mod_list ) ) != 0 ) {
252
+	if ( ( rc = ibdev->op->modify_qp ( ibdev, qp ) ) != 0 ) {
256 253
 		DBGC ( ibdev, "IBDEV %p could not modify QPN %#lx: %s\n",
257 254
 		       ibdev, qp->qpn, strerror ( rc ) );
258 255
 		return rc;
@@ -372,6 +369,7 @@ struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
372 369
 int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
373 370
 		   struct ib_address_vector *av,
374 371
 		   struct io_buffer *iobuf ) {
372
+	struct ib_address_vector av_copy;
375 373
 	int rc;
376 374
 
377 375
 	/* Check queue fill level */
@@ -381,6 +379,14 @@ int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
381 379
 		return -ENOBUFS;
382 380
 	}
383 381
 
382
+	/* Use default address vector if none specified */
383
+	if ( ! av )
384
+		av = &qp->av;
385
+
386
+	/* Make modifiable copy of address vector */
387
+	memcpy ( &av_copy, av, sizeof ( av_copy ) );
388
+	av = &av_copy;
389
+
384 390
 	/* Fill in optional parameters in address vector */
385 391
 	if ( ! av->qkey )
386 392
 		av->qkey = qp->qkey;
@@ -712,6 +718,31 @@ int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad ) {
712 718
 	return 0;
713 719
 };
714 720
 
721
+/**
722
+ * Set partition key table
723
+ *
724
+ * @v ibdev		Infiniband device
725
+ * @v mad		Set partition key table MAD
726
+ */
727
+int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad ) {
728
+	int rc;
729
+
730
+	/* Adapters with embedded SMAs do not need to support this method */
731
+	if ( ! ibdev->op->set_pkey_table ) {
732
+		DBGC ( ibdev, "IBDEV %p does not support setting partition "
733
+		       "key table\n", ibdev );
734
+		return -ENOTSUP;
735
+	}
736
+
737
+	if ( ( rc = ibdev->op->set_pkey_table ( ibdev, mad ) ) != 0 ) {
738
+		DBGC ( ibdev, "IBDEV %p could not set partition key table: "
739
+		       "%s\n", ibdev, strerror ( rc ) );
740
+		return rc;
741
+	}
742
+
743
+	return 0;
744
+};
745
+
715 746
 /***************************************************************************
716 747
  *
717 748
  * Event queues

+ 20
- 4
src/net/infiniband/ib_gma.c 查看文件

@@ -296,8 +296,17 @@ static union ib_mad * ib_sma_set_pkey_table ( struct ib_gma *gma,
296 296
 					      union ib_mad *mad ) {
297 297
 	struct ib_device *ibdev = gma->ibdev;
298 298
 	struct ib_pkey_table *pkey_table = &mad->smp.smp_data.pkey_table;
299
+	int rc;
299 300
 
300 301
 	ibdev->pkey = ntohs ( pkey_table->pkey[0] );
302
+	DBGC ( gma, "GMA %p set pkey %04x\n", gma, ibdev->pkey );
303
+
304
+	if ( ( rc = ib_set_pkey_table ( ibdev, mad ) ) != 0 ) {
305
+		DBGC ( gma, "GMA %p could not set pkey table: %s\n",
306
+		       gma, strerror ( rc ) );
307
+		mad->hdr.status =
308
+			htons ( IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR );
309
+	}
301 310
 
302 311
 	return ib_sma_get_pkey_table ( gma, mad );
303 312
 }
@@ -618,7 +627,7 @@ int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad,
618 627
 struct ib_gma * ib_create_gma ( struct ib_device *ibdev,
619 628
 				enum ib_queue_pair_type type ) {
620 629
 	struct ib_gma *gma;
621
-	unsigned long qkey;
630
+	int rc;
622 631
 
623 632
 	/* Allocate and initialise fields */
624 633
 	gma = zalloc ( sizeof ( *gma ) );
@@ -637,21 +646,28 @@ struct ib_gma * ib_create_gma ( struct ib_device *ibdev,
637 646
 	}
638 647
 
639 648
 	/* Create queue pair */
640
-	qkey = ( ( type == IB_QPT_SMA ) ? IB_QKEY_SMA : IB_QKEY_GMA );
641 649
 	gma->qp = ib_create_qp ( ibdev, type, IB_GMA_NUM_SEND_WQES, gma->cq,
642
-				 IB_GMA_NUM_RECV_WQES, gma->cq, qkey );
650
+				 IB_GMA_NUM_RECV_WQES, gma->cq );
643 651
 	if ( ! gma->qp ) {
644 652
 		DBGC ( gma, "GMA %p could not allocate queue pair\n", gma );
645 653
 		goto err_create_qp;
646 654
 	}
647 655
 	ib_qp_set_ownerdata ( gma->qp, gma );
648
-
649 656
 	DBGC ( gma, "GMA %p running on QPN %#lx\n", gma, gma->qp->qpn );
650 657
 
658
+	/* Set queue key */
659
+	gma->qp->qkey = ( ( type == IB_QPT_SMA ) ? IB_QKEY_SMA : IB_QKEY_GMA );
660
+	if ( ( rc = ib_modify_qp ( ibdev, gma->qp ) ) != 0 ) {
661
+		DBGC ( gma, "GMA %p could not set queue key: %s\n",
662
+		       gma, strerror ( rc ) );
663
+		goto err_modify_qp;
664
+	}
665
+
651 666
 	/* Fill receive ring */
652 667
 	ib_refill_recv ( ibdev, gma->qp );
653 668
 	return gma;
654 669
 
670
+ err_modify_qp:
655 671
 	ib_destroy_qp ( ibdev, gma->qp );
656 672
  err_create_qp:
657 673
 	ib_destroy_cq ( ibdev, gma->cq );

+ 2
- 1
src/net/infiniband/ib_mcast.c 查看文件

@@ -178,7 +178,8 @@ static union ib_mad * ib_handle_mc_member_join ( struct ib_gma *gma,
178 178
 	       ntohl ( gid->u.dwords[3] ), qkey );
179 179
 
180 180
 	/* Set queue key */
181
-	if ( ( rc = ib_modify_qp ( ibdev, qp, IB_MODIFY_QKEY, qkey ) ) != 0 ) {
181
+	qp->qkey = qkey;
182
+	if ( ( rc = ib_modify_qp ( ibdev, qp ) ) != 0 ) {
182 183
 		DBGC ( gma, "GMA %p QPN %lx could not modify qkey: %s\n",
183 184
 		       gma, qp->qpn, strerror ( rc ) );
184 185
 		return NULL;

+ 1
- 1
src/net/infiniband/ib_packet.c 查看文件

@@ -100,7 +100,7 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
100 100
 	bth->se__m__padcnt__tver = ( pad_len << 4 );
101 101
 	bth->pkey = htons ( ibdev->pkey );
102 102
 	bth->dest_qp = htonl ( av->qpn );
103
-	bth->ack__psn = htonl ( ( ibdev->psn++ ) & 0xffffffUL );
103
+	bth->ack__psn = htonl ( ( qp->send.psn++ ) & 0xffffffUL );
104 104
 
105 105
 	/* Construct DETH */
106 106
 	deth->qkey = htonl ( av->qkey );

Loading…
取消
儲存