Bladeren bron

[infiniband] Expose supported and enabled link speeds and widths

tags/v0.9.8
Michael Brown 15 jaren geleden
bovenliggende
commit
0095e18d4c
4 gewijzigde bestanden met toevoegingen van 61 en 23 verwijderingen
  1. 11
    3
      src/drivers/infiniband/linda.c
  2. 12
    4
      src/include/gpxe/infiniband.h
  3. 18
    7
      src/net/infiniband/ib_gma.c
  4. 20
    9
      src/net/infiniband/ib_smc.c

+ 11
- 3
src/drivers/infiniband/linda.c Bestand weergeven

@@ -231,9 +231,9 @@ static void linda_link_state_changed ( struct ib_device *ibdev ) {
231 231
 
232 232
 	/* Notify Infiniband core of link state change */
233 233
 	ibdev->port_state = ( link_state + 1 );
234
-	ibdev->link_width =
234
+	ibdev->link_width_active =
235 235
 		( link_width ? IB_LINK_WIDTH_4X : IB_LINK_WIDTH_1X );
236
-	ibdev->link_speed =
236
+	ibdev->link_speed_active =
237 237
 		( link_speed ? IB_LINK_SPEED_DDR : IB_LINK_SPEED_SDR );
238 238
 	ib_link_state_changed ( ibdev );
239 239
 }
@@ -2213,7 +2213,7 @@ static int linda_init_ib_serdes ( struct linda *linda ) {
2213 2213
 	linda_writeq ( linda, &ibcctrl, QIB_7220_IBCCtrl_offset );
2214 2214
 
2215 2215
 	/* Force SDR only to avoid needing all the DDR tuning,
2216
-	 * Mellanox compatibiltiy hacks etc.  SDR is plenty for
2216
+	 * Mellanox compatibility hacks etc.  SDR is plenty for
2217 2217
 	 * boot-time operation.
2218 2218
 	 */
2219 2219
 	linda_readq ( linda, &ibcddrctrl, QIB_7220_IBCDDRCtrl_offset );
@@ -2311,6 +2311,14 @@ static int linda_probe ( struct pci_device *pci,
2311 2311
 		BIT_GET ( &revision, R_ChipRevMajor ),
2312 2312
 		BIT_GET ( &revision, R_ChipRevMinor ) );
2313 2313
 
2314
+	/* Record link capabilities.  Note that we force SDR only to
2315
+	 * avoid having to carry extra code for DDR tuning etc.
2316
+	 */
2317
+	ibdev->link_width_enabled = ibdev->link_width_supported =
2318
+		( IB_LINK_WIDTH_4X | IB_LINK_WIDTH_1X );
2319
+	ibdev->link_speed_enabled = ibdev->link_speed_supported =
2320
+		IB_LINK_SPEED_SDR;
2321
+
2314 2322
 	/* Initialise I2C subsystem */
2315 2323
 	if ( ( rc = linda_init_i2c ( linda ) ) != 0 )
2316 2324
 		goto err_init_i2c;

+ 12
- 4
src/include/gpxe/infiniband.h Bestand weergeven

@@ -376,10 +376,18 @@ struct ib_device {
376 376
 
377 377
 	/** Port state */
378 378
 	uint8_t port_state;
379
-	/** Link width */
380
-	uint8_t link_width;
381
-	/** Link speed */
382
-	uint8_t link_speed;
379
+	/** Link width supported */
380
+	uint8_t link_width_supported;
381
+	/** Link width enabled */
382
+	uint8_t link_width_enabled;
383
+	/** Link width active */
384
+	uint8_t link_width_active;
385
+	/** Link speed supported */
386
+	uint8_t link_speed_supported;
387
+	/** Link speed enabled */
388
+	uint8_t link_speed_enabled;
389
+	/** Link speed active */
390
+	uint8_t link_speed_active;
383 391
 	/** Port GID */
384 392
 	struct ib_gid gid;
385 393
 	/** Port LID */

+ 18
- 7
src/net/infiniband/ib_gma.c Bestand weergeven

@@ -204,16 +204,17 @@ static union ib_mad * ib_sma_get_port_info ( struct ib_gma *gma,
204 204
 	port_info->lid = ntohs ( ibdev->lid );
205 205
 	port_info->mastersm_lid = ntohs ( ibdev->sm_lid );
206 206
 	port_info->local_port_num = ibdev->port;
207
-	port_info->link_width_enabled = ibdev->link_width;
208
-	port_info->link_width_supported = ibdev->link_width;
209
-	port_info->link_width_active = ibdev->link_width;
207
+	port_info->link_width_enabled = ibdev->link_width_enabled;
208
+	port_info->link_width_supported = ibdev->link_width_supported;
209
+	port_info->link_width_active = ibdev->link_width_active;
210 210
 	port_info->link_speed_supported__port_state =
211
-		( ( ibdev->link_speed << 4 ) | ibdev->port_state );
211
+		( ( ibdev->link_speed_supported << 4 ) | ibdev->port_state );
212 212
 	port_info->port_phys_state__link_down_def_state =
213 213
 		( ( IB_PORT_PHYS_STATE_POLLING << 4 ) |
214 214
 		  IB_PORT_PHYS_STATE_POLLING );
215 215
 	port_info->link_speed_active__link_speed_enabled =
216
-		( ( ibdev->link_speed << 4 ) | ibdev->link_speed );
216
+		( ( ibdev->link_speed_active << 4 ) |
217
+		  ibdev->link_speed_enabled );
217 218
 	port_info->neighbour_mtu__mastersm_sl =
218 219
 		( ( IB_MTU_2048 << 4 ) | ibdev->sm_sl );
219 220
 	port_info->vl_cap__init_type = ( IB_VL_0 << 4 );
@@ -236,17 +237,27 @@ static union ib_mad * ib_sma_set_port_info ( struct ib_gma *gma,
236 237
 					     union ib_mad *mad ) {
237 238
 	struct ib_device *ibdev = gma->ibdev;
238 239
 	const struct ib_port_info *port_info = &mad->smp.smp_data.port_info;
240
+	unsigned int link_width_enabled;
241
+	unsigned int link_speed_enabled;
239 242
 	int rc;
240 243
 
241 244
 	memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
242 245
 		 sizeof ( ibdev->gid.u.half[0] ) );
243 246
 	ibdev->lid = ntohs ( port_info->lid );
244 247
 	ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
248
+	if ( ( link_width_enabled = port_info->link_width_enabled ) )
249
+		ibdev->link_width_enabled = link_width_enabled;
250
+	if ( ( link_speed_enabled =
251
+	       ( port_info->link_speed_active__link_speed_enabled & 0xf ) ) )
252
+		ibdev->link_speed_enabled = link_speed_enabled;
245 253
 	ibdev->sm_sl = ( port_info->neighbour_mtu__mastersm_sl & 0xf );
254
+	DBGC ( gma, "GMA %p set LID %04x SMLID %04x link width %02x speed "
255
+	       "%02x\n", gma, ibdev->lid, ibdev->sm_lid,
256
+	       ibdev->link_width_enabled, ibdev->link_speed_enabled );
246 257
 
247 258
 	if ( ( rc = ib_set_port_info ( ibdev, port_info ) ) != 0 ) {
248
-		DBGC ( ibdev, "IBDEV %p could not set port information: %s\n",
249
-		       ibdev, strerror ( rc ) );
259
+		DBGC ( gma, "GMA %p could not set port information: %s\n",
260
+		       gma, strerror ( rc ) );
250 261
 		mad->hdr.status =
251 262
 			htons ( IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR );
252 263
 	}

+ 20
- 9
src/net/infiniband/ib_smc.c Bestand weergeven

@@ -131,7 +131,9 @@ static int ib_smc_get_pkey_table ( struct ib_device *ibdev,
131 131
  */
132 132
 int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
133 133
 	union ib_mad mad;
134
-	union ib_smp_data *smp = &mad.smp.smp_data;
134
+	struct ib_port_info *port_info = &mad.smp.smp_data.port_info;
135
+	struct ib_guid_info *guid_info = &mad.smp.smp_data.guid_info;
136
+	struct ib_pkey_table *pkey_table = &mad.smp.smp_data.pkey_table;
135 137
 	int rc;
136 138
 
137 139
 	/* Port info gives us the link state, the first half of the
@@ -139,24 +141,33 @@ int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
139 141
 	 */
140 142
 	if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
141 143
 		return rc;
142
-	ibdev->port_state =
143
-		( smp->port_info.link_speed_supported__port_state & 0x0f );
144
-	memcpy ( &ibdev->gid.u.half[0], smp->port_info.gid_prefix,
144
+	memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
145 145
 		 sizeof ( ibdev->gid.u.half[0] ) );
146
-	ibdev->lid = ntohs ( smp->port_info.lid );
147
-	ibdev->sm_lid = ntohs ( smp->port_info.mastersm_lid );
148
-	ibdev->sm_sl = ( smp->port_info.neighbour_mtu__mastersm_sl & 0xf );
146
+	ibdev->lid = ntohs ( port_info->lid );
147
+	ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
148
+	ibdev->link_width_enabled = port_info->link_width_enabled;
149
+	ibdev->link_width_supported = port_info->link_width_supported;
150
+	ibdev->link_width_active = port_info->link_width_active;
151
+	ibdev->link_speed_supported =
152
+		( port_info->link_speed_supported__port_state >> 4 );
153
+	ibdev->port_state =
154
+		( port_info->link_speed_supported__port_state & 0xf );
155
+	ibdev->link_speed_active =
156
+		( port_info->link_speed_active__link_speed_enabled >> 4 );
157
+	ibdev->link_speed_enabled =
158
+		( port_info->link_speed_active__link_speed_enabled & 0xf );
159
+	ibdev->sm_sl = ( port_info->neighbour_mtu__mastersm_sl & 0xf );
149 160
 
150 161
 	/* GUID info gives us the second half of the port GID */
151 162
 	if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
152 163
 		return rc;
153
-	memcpy ( &ibdev->gid.u.half[1], smp->guid_info.guid[0],
164
+	memcpy ( &ibdev->gid.u.half[1], guid_info->guid[0],
154 165
 		 sizeof ( ibdev->gid.u.half[1] ) );
155 166
 
156 167
 	/* Get partition key */
157 168
 	if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
158 169
 		return rc;
159
-	ibdev->pkey = ntohs ( smp->pkey_table.pkey[0] );
170
+	ibdev->pkey = ntohs ( pkey_table->pkey[0] );
160 171
 
161 172
 	DBGC ( ibdev, "IBDEV %p port GID is %08x:%08x:%08x:%08x\n", ibdev,
162 173
 	       htonl ( ibdev->gid.u.dwords[0] ),

Laden…
Annuleren
Opslaan