|
@@ -3382,56 +3382,32 @@ static int hermon_bofm_update ( struct bofm_device *bofm, unsigned int mport,
|
3382
|
3382
|
union {
|
3383
|
3383
|
uint8_t bytes[8];
|
3384
|
3384
|
uint32_t dwords[2];
|
3385
|
|
- uint64_t qword;
|
3386
|
3385
|
} buf;
|
3387
|
|
- uint8_t *mac_copy = &buf.bytes[ sizeof ( buf.bytes ) - ETH_ALEN ];
|
3388
|
3386
|
int rc;
|
3389
|
3387
|
|
3390
|
3388
|
/* Prepare MAC address */
|
3391
|
3389
|
memset ( &buf, 0, sizeof ( buf ) );
|
3392
|
|
- memcpy ( mac_copy, mac, ETH_ALEN );
|
|
3390
|
+ memcpy ( &buf.bytes[ sizeof ( buf.bytes ) - ETH_ALEN ], mac,
|
|
3391
|
+ ETH_ALEN );
|
3393
|
3392
|
|
3394
|
|
- /* Current BOFM versions are unable to create entries with
|
3395
|
|
- * mport>1, which means that only the port 1 MAC address can
|
3396
|
|
- * be explicitly specified. Work around this by using the
|
3397
|
|
- * provided MAC address as a base address for all subsequent
|
3398
|
|
- * ports. For example, if BOFM assigns the address
|
3399
|
|
- *
|
3400
|
|
- * 00:1A:64:76:00:09 for port 1
|
3401
|
|
- *
|
3402
|
|
- * then we will assign the addresses
|
3403
|
|
- *
|
3404
|
|
- * 00:1A:64:76:00:09 for port 1
|
3405
|
|
- * 00:1A:64:76:00:0a for port 2
|
3406
|
|
- *
|
3407
|
|
- * Note that hermon->cap.num_ports is not yet defined at this
|
3408
|
|
- * point.
|
3409
|
|
- */
|
3410
|
|
- for ( ; mport <= HERMON_MAX_PORTS ; mport++ ) {
|
3411
|
|
-
|
3412
|
|
- /* Modify static configuration */
|
3413
|
|
- memset ( &stat_cfg, 0, sizeof ( stat_cfg ) );
|
3414
|
|
- MLX_FILL_2 ( &stat_cfg, 36,
|
3415
|
|
- mac_m, 1,
|
3416
|
|
- mac_high, ntohl ( buf.dwords[0] ) );
|
3417
|
|
- MLX_FILL_1 ( &stat_cfg, 37, mac_low, ntohl ( buf.dwords[1] ) );
|
3418
|
|
- if ( ( rc = hermon_mod_stat_cfg ( hermon, mport,
|
|
3393
|
+ /* Modify static configuration */
|
|
3394
|
+ memset ( &stat_cfg, 0, sizeof ( stat_cfg ) );
|
|
3395
|
+ MLX_FILL_2 ( &stat_cfg, 36,
|
|
3396
|
+ mac_m, 1,
|
|
3397
|
+ mac_high, ntohl ( buf.dwords[0] ) );
|
|
3398
|
+ MLX_FILL_1 ( &stat_cfg, 37, mac_low, ntohl ( buf.dwords[1] ) );
|
|
3399
|
+ if ( ( rc = hermon_mod_stat_cfg ( hermon, mport,
|
3419
|
3400
|
HERMON_MOD_STAT_CFG_SET,
|
3420
|
3401
|
HERMON_MOD_STAT_CFG_OFFSET ( mac_m ),
|
3421
|
3402
|
&stat_cfg ) ) != 0 ) {
|
3422
|
|
- DBGC ( hermon, "Hermon %p port %d could not modify "
|
3423
|
|
- "configuration: %s\n",
|
3424
|
|
- hermon, mport, strerror ( rc ) );
|
3425
|
|
- return rc;
|
3426
|
|
- }
|
3427
|
|
-
|
3428
|
|
- DBGC ( hermon, "Hermon %p port %d updated MAC address to %s\n",
|
3429
|
|
- hermon, mport, eth_ntoa ( mac_copy ) );
|
3430
|
|
-
|
3431
|
|
- /* Increment MAC address */
|
3432
|
|
- buf.qword = cpu_to_be64 ( be64_to_cpu ( buf.qword ) + 1 );
|
|
3403
|
+ DBGC ( hermon, "Hermon %p port %d could not modify "
|
|
3404
|
+ "configuration: %s\n", hermon, mport, strerror ( rc ) );
|
|
3405
|
+ return rc;
|
3433
|
3406
|
}
|
3434
|
3407
|
|
|
3408
|
+ DBGC ( hermon, "Hermon %p port %d updated MAC address to %s\n",
|
|
3409
|
+ hermon, mport, eth_ntoa ( mac ) );
|
|
3410
|
+
|
3435
|
3411
|
return 0;
|
3436
|
3412
|
}
|
3437
|
3413
|
|