Browse Source

[infiniband] Expose supported and enabled link speeds and widths

tags/v0.9.8
Michael Brown 15 years ago
parent
commit
0095e18d4c

+ 11
- 3
src/drivers/infiniband/linda.c View File

231
 
231
 
232
 	/* Notify Infiniband core of link state change */
232
 	/* Notify Infiniband core of link state change */
233
 	ibdev->port_state = ( link_state + 1 );
233
 	ibdev->port_state = ( link_state + 1 );
234
-	ibdev->link_width =
234
+	ibdev->link_width_active =
235
 		( link_width ? IB_LINK_WIDTH_4X : IB_LINK_WIDTH_1X );
235
 		( link_width ? IB_LINK_WIDTH_4X : IB_LINK_WIDTH_1X );
236
-	ibdev->link_speed =
236
+	ibdev->link_speed_active =
237
 		( link_speed ? IB_LINK_SPEED_DDR : IB_LINK_SPEED_SDR );
237
 		( link_speed ? IB_LINK_SPEED_DDR : IB_LINK_SPEED_SDR );
238
 	ib_link_state_changed ( ibdev );
238
 	ib_link_state_changed ( ibdev );
239
 }
239
 }
2213
 	linda_writeq ( linda, &ibcctrl, QIB_7220_IBCCtrl_offset );
2213
 	linda_writeq ( linda, &ibcctrl, QIB_7220_IBCCtrl_offset );
2214
 
2214
 
2215
 	/* Force SDR only to avoid needing all the DDR tuning,
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
 	 * boot-time operation.
2217
 	 * boot-time operation.
2218
 	 */
2218
 	 */
2219
 	linda_readq ( linda, &ibcddrctrl, QIB_7220_IBCDDRCtrl_offset );
2219
 	linda_readq ( linda, &ibcddrctrl, QIB_7220_IBCDDRCtrl_offset );
2311
 		BIT_GET ( &revision, R_ChipRevMajor ),
2311
 		BIT_GET ( &revision, R_ChipRevMajor ),
2312
 		BIT_GET ( &revision, R_ChipRevMinor ) );
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
 	/* Initialise I2C subsystem */
2322
 	/* Initialise I2C subsystem */
2315
 	if ( ( rc = linda_init_i2c ( linda ) ) != 0 )
2323
 	if ( ( rc = linda_init_i2c ( linda ) ) != 0 )
2316
 		goto err_init_i2c;
2324
 		goto err_init_i2c;

+ 12
- 4
src/include/gpxe/infiniband.h View File

376
 
376
 
377
 	/** Port state */
377
 	/** Port state */
378
 	uint8_t port_state;
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
 	/** Port GID */
391
 	/** Port GID */
384
 	struct ib_gid gid;
392
 	struct ib_gid gid;
385
 	/** Port LID */
393
 	/** Port LID */

+ 18
- 7
src/net/infiniband/ib_gma.c View File

204
 	port_info->lid = ntohs ( ibdev->lid );
204
 	port_info->lid = ntohs ( ibdev->lid );
205
 	port_info->mastersm_lid = ntohs ( ibdev->sm_lid );
205
 	port_info->mastersm_lid = ntohs ( ibdev->sm_lid );
206
 	port_info->local_port_num = ibdev->port;
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
 	port_info->link_speed_supported__port_state =
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
 	port_info->port_phys_state__link_down_def_state =
212
 	port_info->port_phys_state__link_down_def_state =
213
 		( ( IB_PORT_PHYS_STATE_POLLING << 4 ) |
213
 		( ( IB_PORT_PHYS_STATE_POLLING << 4 ) |
214
 		  IB_PORT_PHYS_STATE_POLLING );
214
 		  IB_PORT_PHYS_STATE_POLLING );
215
 	port_info->link_speed_active__link_speed_enabled =
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
 	port_info->neighbour_mtu__mastersm_sl =
218
 	port_info->neighbour_mtu__mastersm_sl =
218
 		( ( IB_MTU_2048 << 4 ) | ibdev->sm_sl );
219
 		( ( IB_MTU_2048 << 4 ) | ibdev->sm_sl );
219
 	port_info->vl_cap__init_type = ( IB_VL_0 << 4 );
220
 	port_info->vl_cap__init_type = ( IB_VL_0 << 4 );
236
 					     union ib_mad *mad ) {
237
 					     union ib_mad *mad ) {
237
 	struct ib_device *ibdev = gma->ibdev;
238
 	struct ib_device *ibdev = gma->ibdev;
238
 	const struct ib_port_info *port_info = &mad->smp.smp_data.port_info;
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
 	int rc;
242
 	int rc;
240
 
243
 
241
 	memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
244
 	memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
242
 		 sizeof ( ibdev->gid.u.half[0] ) );
245
 		 sizeof ( ibdev->gid.u.half[0] ) );
243
 	ibdev->lid = ntohs ( port_info->lid );
246
 	ibdev->lid = ntohs ( port_info->lid );
244
 	ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
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
 	ibdev->sm_sl = ( port_info->neighbour_mtu__mastersm_sl & 0xf );
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
 	if ( ( rc = ib_set_port_info ( ibdev, port_info ) ) != 0 ) {
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
 		mad->hdr.status =
261
 		mad->hdr.status =
251
 			htons ( IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR );
262
 			htons ( IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR );
252
 	}
263
 	}

+ 20
- 9
src/net/infiniband/ib_smc.c View File

131
  */
131
  */
132
 int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
132
 int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
133
 	union ib_mad mad;
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
 	int rc;
137
 	int rc;
136
 
138
 
137
 	/* Port info gives us the link state, the first half of the
139
 	/* Port info gives us the link state, the first half of the
139
 	 */
141
 	 */
140
 	if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
142
 	if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
141
 		return rc;
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
 		 sizeof ( ibdev->gid.u.half[0] ) );
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
 	/* GUID info gives us the second half of the port GID */
161
 	/* GUID info gives us the second half of the port GID */
151
 	if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
162
 	if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
152
 		return rc;
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
 		 sizeof ( ibdev->gid.u.half[1] ) );
165
 		 sizeof ( ibdev->gid.u.half[1] ) );
155
 
166
 
156
 	/* Get partition key */
167
 	/* Get partition key */
157
 	if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
168
 	if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
158
 		return rc;
169
 		return rc;
159
-	ibdev->pkey = ntohs ( smp->pkey_table.pkey[0] );
170
+	ibdev->pkey = ntohs ( pkey_table->pkey[0] );
160
 
171
 
161
 	DBGC ( ibdev, "IBDEV %p port GID is %08x:%08x:%08x:%08x\n", ibdev,
172
 	DBGC ( ibdev, "IBDEV %p port GID is %08x:%08x:%08x:%08x\n", ibdev,
162
 	       htonl ( ibdev->gid.u.dwords[0] ),
173
 	       htonl ( ibdev->gid.u.dwords[0] ),

Loading…
Cancel
Save