Sfoglia il codice sorgente

[infiniband] Allow for the creation of multicast groups

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 anni fa
parent
commit
5a7fd2cc90
3 ha cambiato i file con 18 aggiunte e 11 eliminazioni
  1. 1
    1
      src/drivers/net/ipoib.c
  2. 1
    1
      src/include/ipxe/ib_mcast.h
  3. 16
    9
      src/net/infiniband/ib_mcast.c

+ 1
- 1
src/drivers/net/ipoib.c Vedi File

@@ -770,7 +770,7 @@ static int ipoib_join_broadcast_group ( struct ipoib_device *ipoib ) {
770 770
 	/* Join multicast group */
771 771
 	if ( ( rc = ib_mcast_join ( ipoib->ibdev, ipoib->qp,
772 772
 				    &ipoib->broadcast.membership,
773
-				    &ipoib->broadcast.av,
773
+				    &ipoib->broadcast.av, 0,
774 774
 				    ipoib_join_complete ) ) != 0 ) {
775 775
 		DBGC ( ipoib, "IPoIB %p could not join broadcast group: %s\n",
776 776
 		       ipoib, strerror ( rc ) );

+ 1
- 1
src/include/ipxe/ib_mcast.h Vedi File

@@ -33,7 +33,7 @@ struct ib_mc_membership {
33 33
 
34 34
 extern int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
35 35
 			   struct ib_mc_membership *membership,
36
-			   struct ib_address_vector *av,
36
+			   struct ib_address_vector *av, unsigned int mask,
37 37
 			   void ( * joined ) ( struct ib_mc_membership *memb,
38 38
 					       int rc ) );
39 39
 

+ 16
- 9
src/net/infiniband/ib_mcast.c Vedi File

@@ -43,25 +43,32 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
43 43
  *
44 44
  * @v ibdev		Infiniband device
45 45
  * @v av		Address vector
46
- * @v join		Join (rather than leave) group
46
+ * @v method		Method (IB_MGMT_METHOD_SET or IB_MGMT_METHOD_DELETE)
47
+ * @v mask		Additional component mask
47 48
  * @v mad		MAD to fill in
48 49
  */
49 50
 static void ib_mcast_mad ( struct ib_device *ibdev,
50 51
 			   struct ib_address_vector *av,
51
-			   int join, union ib_mad *mad ) {
52
+			   unsigned int method, unsigned int mask,
53
+			   union ib_mad *mad ) {
52 54
 	struct ib_mad_sa *sa = &mad->sa;
53 55
 
54 56
 	/* Construct multicast membership record request */
55 57
 	memset ( sa, 0, sizeof ( *sa ) );
56 58
 	sa->mad_hdr.mgmt_class = IB_MGMT_CLASS_SUBN_ADM;
57 59
 	sa->mad_hdr.class_version = IB_SA_CLASS_VERSION;
58
-	sa->mad_hdr.method =
59
-		( join ? IB_MGMT_METHOD_SET : IB_MGMT_METHOD_DELETE );
60
+	sa->mad_hdr.method = method;
60 61
 	sa->mad_hdr.attr_id = htons ( IB_SA_ATTR_MC_MEMBER_REC );
61 62
 	sa->sa_hdr.comp_mask[1] =
62 63
 		htonl ( IB_SA_MCMEMBER_REC_MGID | IB_SA_MCMEMBER_REC_PORT_GID |
63
-			IB_SA_MCMEMBER_REC_JOIN_STATE );
64
-	sa->sa_data.mc_member_record.scope__join_state = 1;
64
+			IB_SA_MCMEMBER_REC_JOIN_STATE | mask );
65
+	sa->sa_data.mc_member_record.qkey = htonl ( av->qkey );
66
+	sa->sa_data.mc_member_record.pkey =
67
+		htons ( ibdev->pkey | IB_PKEY_FULL );
68
+	sa->sa_data.mc_member_record.rate_selector__rate = av->rate;
69
+	sa->sa_data.mc_member_record.sl__flow_label__hop_limit =
70
+		htonl ( av->sl << 28 );
71
+	sa->sa_data.mc_member_record.scope__join_state = 0x01;
65 72
 	memcpy ( &sa->sa_data.mc_member_record.mgid, &av->gid,
66 73
 		 sizeof ( sa->sa_data.mc_member_record.mgid ) );
67 74
 	memcpy ( &sa->sa_data.mc_member_record.port_gid, &ibdev->gid,
@@ -144,7 +151,7 @@ static struct ib_mad_transaction_operations ib_mcast_op = {
144 151
  */
145 152
 int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
146 153
 		    struct ib_mc_membership *membership,
147
-		    struct ib_address_vector *av,
154
+		    struct ib_address_vector *av, unsigned int mask,
148 155
 		    void ( * complete ) ( struct ib_mc_membership *membership,
149 156
 					  int rc ) ) {
150 157
 	union ib_mad mad;
@@ -171,7 +178,7 @@ int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
171 178
 	membership->attached = 1;
172 179
 
173 180
 	/* Initiate multicast membership join */
174
-	ib_mcast_mad ( ibdev, av, 1, &mad );
181
+	ib_mcast_mad ( ibdev, av, IB_MGMT_METHOD_SET, mask, &mad );
175 182
 	membership->madx = ib_create_madx ( ibdev, ibdev->gsi, &mad, NULL,
176 183
 					    &ib_mcast_op );
177 184
 	if ( ! membership->madx ) {
@@ -226,7 +233,7 @@ void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
226 233
 	}
227 234
 
228 235
 	/* Send a single group leave MAD */
229
-	ib_mcast_mad ( ibdev, av, 0, &mad );
236
+	ib_mcast_mad ( ibdev, av, IB_MGMT_METHOD_DELETE, 0, &mad );
230 237
 	if ( ( rc = ib_mi_send ( ibdev, ibdev->gsi, &mad, NULL ) ) != 0 ) {
231 238
 		DBGC ( ibdev, "IBDEV %s QPN %#lx could not send leave request: "
232 239
 		       "%s\n", ibdev->name, qp->qpn, strerror ( rc ) );

Loading…
Annulla
Salva