summaryrefslogtreecommitdiffstats
path: root/src/drivers/infiniband
diff options
context:
space:
mode:
authorMichael Brown2011-04-07 14:53:28 +0200
committerMichael Brown2011-04-08 02:11:08 +0200
commit15c120041da3e4a9357b20933c14adcf32d667b8 (patch)
treec11dc9e20da13d4a65498f2dec93a926d52616f1 /src/drivers/infiniband
parent[arbel] Stop firmware only once on shutdown (diff)
downloadipxe-15c120041da3e4a9357b20933c14adcf32d667b8.tar.gz
ipxe-15c120041da3e4a9357b20933c14adcf32d667b8.tar.xz
ipxe-15c120041da3e4a9357b20933c14adcf32d667b8.zip
[hermon] Work around missing mport support in current BOFM implementations
Current BOFM versions are unable to create entries with mport>1, which means that only the port 1 MAC address can be explicitly specified. Work around this by using the provided MAC address as a base address for all subsequent ports. For example, if BOFM assigns the address 00:1A:64:76:00:09 for port 1 then we will assign the addresses 00:1A:64:76:00:09 for port 1 00:1A:64:76:00:0a for port 2 Future BOFM versions that may correctly support mport will work with this scheme without modification provided that the BOFM entries are created in increasing order of mport. Since BOFM tools tend to generate entries in increasing order (of slot, port, etc), this is not an unreasonable compromise. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/infiniband')
-rw-r--r--src/drivers/infiniband/hermon.c54
1 files changed, 39 insertions, 15 deletions
diff --git a/src/drivers/infiniband/hermon.c b/src/drivers/infiniband/hermon.c
index 7a487c91..f44166f8 100644
--- a/src/drivers/infiniband/hermon.c
+++ b/src/drivers/infiniband/hermon.c
@@ -3382,31 +3382,55 @@ static int hermon_bofm_update ( struct bofm_device *bofm, unsigned int mport,
union {
uint8_t bytes[8];
uint32_t dwords[2];
+ uint64_t qword;
} buf;
+ uint8_t *mac_copy = &buf.bytes[ sizeof ( buf.bytes ) - ETH_ALEN ];
int rc;
/* Prepare MAC address */
memset ( &buf, 0, sizeof ( buf ) );
- memcpy ( &buf.bytes[ sizeof ( buf.bytes ) - ETH_ALEN ], mac,
- ETH_ALEN );
+ memcpy ( mac_copy, mac, ETH_ALEN );
- /* Modify static configuration */
- memset ( &stat_cfg, 0, sizeof ( stat_cfg ) );
- MLX_FILL_2 ( &stat_cfg, 36,
- mac_m, 1,
- mac_high, ntohl ( buf.dwords[0] ) );
- MLX_FILL_1 ( &stat_cfg, 37, mac_low, ntohl ( buf.dwords[1] ) );
- if ( ( rc = hermon_mod_stat_cfg ( hermon, mport,
+ /* Current BOFM versions are unable to create entries with
+ * mport>1, which means that only the port 1 MAC address can
+ * be explicitly specified. Work around this by using the
+ * provided MAC address as a base address for all subsequent
+ * ports. For example, if BOFM assigns the address
+ *
+ * 00:1A:64:76:00:09 for port 1
+ *
+ * then we will assign the addresses
+ *
+ * 00:1A:64:76:00:09 for port 1
+ * 00:1A:64:76:00:0a for port 2
+ *
+ * Note that hermon->cap.num_ports is not yet defined at this
+ * point.
+ */
+ for ( ; mport <= HERMON_MAX_PORTS ; mport++ ) {
+
+ /* Modify static configuration */
+ memset ( &stat_cfg, 0, sizeof ( stat_cfg ) );
+ MLX_FILL_2 ( &stat_cfg, 36,
+ mac_m, 1,
+ mac_high, ntohl ( buf.dwords[0] ) );
+ MLX_FILL_1 ( &stat_cfg, 37, mac_low, ntohl ( buf.dwords[1] ) );
+ if ( ( rc = hermon_mod_stat_cfg ( hermon, mport,
HERMON_MOD_STAT_CFG_SET,
HERMON_MOD_STAT_CFG_OFFSET ( mac_m ),
&stat_cfg ) ) != 0 ) {
- DBGC ( hermon, "Hermon %p port %d could not modify "
- "configuration: %s\n", hermon, mport, strerror ( rc ) );
- return rc;
- }
+ DBGC ( hermon, "Hermon %p port %d could not modify "
+ "configuration: %s\n",
+ hermon, mport, strerror ( rc ) );
+ return rc;
+ }
- DBGC ( hermon, "Hermon %p port %d updated MAC address to %s\n",
- hermon, mport, eth_ntoa ( mac ) );
+ DBGC ( hermon, "Hermon %p port %d updated MAC address to %s\n",
+ hermon, mport, eth_ntoa ( mac_copy ) );
+
+ /* Increment MAC address */
+ buf.qword = cpu_to_be64 ( be64_to_cpu ( buf.qword ) + 1 );
+ }
return 0;
}