struct ib_device *ibdev = port->ibdev;
int rc;
+ /* Use Ethernet MAC as eIPoIB local EMAC */
+ memcpy ( ibdev->lemac, port->eth_mac.raw, ETH_ALEN );
+
/* Initialise parameters using SMC */
ib_smc_init ( ibdev, hermon_mad );
struct hermon_port *port ) {
struct net_device *netdev = port->netdev;
struct ib_device *ibdev = port->ibdev;
- struct hermonprm_query_port_cap query_port;
- union {
- uint8_t bytes[8];
- uint32_t dwords[2];
- } mac;
int rc;
- /* Retrieve MAC address */
- if ( ( rc = hermon_cmd_query_port ( hermon, ibdev->port,
- &query_port ) ) != 0 ) {
- DBGC ( hermon, "Hermon %p port %d could not query port: %s\n",
- hermon, ibdev->port, strerror ( rc ) );
- goto err_query_port;
- }
- mac.dwords[0] = htonl ( MLX_GET ( &query_port, mac_47_32 ) );
- mac.dwords[1] = htonl ( MLX_GET ( &query_port, mac_31_0 ) );
- memcpy ( netdev->hw_addr,
- &mac.bytes[ sizeof ( mac.bytes ) - ETH_ALEN ], ETH_ALEN );
+ /* Set MAC address */
+ memcpy ( netdev->hw_addr, port->eth_mac.raw, ETH_ALEN );
/* Register network device */
if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
err_register_nvo:
unregister_netdev ( netdev );
err_register_netdev:
- err_query_port:
return rc;
}
( ( ib_supported && eth_supported ) ? " and" : "" ),
( eth_supported ? " Ethernet" : "" ) );
+ /* Record Ethernet MAC address */
+ port->eth_mac.part.h = htons ( MLX_GET ( &query_port, mac_47_32 ) );
+ port->eth_mac.part.l = htonl ( MLX_GET ( &query_port, mac_31_0 ) );
+
/* Sense network, if applicable */
if ( ib_supported && eth_supported ) {
struct hermon_port *port );
};
+/** A Hermon port Ethernet MAC address */
+union hermon_port_mac {
+ struct {
+ uint16_t h;
+ uint32_t l;
+ } __attribute__ (( packed )) part;
+ uint8_t raw[ETH_ALEN];
+};
+
/** A Hermon port */
struct hermon_port {
/** Infiniband device */
struct ib_completion_queue *eth_cq;
/** Ethernet queue pair */
struct ib_queue_pair *eth_qp;
+ /** Ethernet MAC */
+ union hermon_port_mac eth_mac;
/** Port type */
struct hermon_port_type *type;
/** Non-volatile option storage */