diff options
author | Christian Iversen <ci@iversenit.dk> | 2021-01-28 21:29:57 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-02-01 11:44:54 +0000 |
commit | 8b07c88df8ec53a5bd554d940d3b2bd5f0caa27a (patch) | |
tree | 38b2a71efde42e185338845f8c15f8d016d1b9d3 | |
parent | d948ac6c6127c23c77d9e8fd6299ffa588f09f64 (diff) | |
download | ipxe-8b07c88df8ec53a5bd554d940d3b2bd5f0caa27a.tar.gz |
[hermon] Add support for port management event
Inspired by Flexboot, the function hermon_event_port_mgmnt_change() is
added to handle the HERMON_EV_PORT_MGMNT_CHANGE event type, which
updates the Infiniband subsystem.
Signed-off-by: Christian Iversen <ci@iversenit.dk>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/drivers/infiniband/hermon.c | 29 | ||||
-rw-r--r-- | src/drivers/infiniband/hermon.h | 10 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/drivers/infiniband/hermon.c b/src/drivers/infiniband/hermon.c index 061ee81c7..68ce5d4a0 100644 --- a/src/drivers/infiniband/hermon.c +++ b/src/drivers/infiniband/hermon.c @@ -2121,6 +2121,32 @@ static void hermon_event_port_state_change ( struct hermon *hermon, } /** + * Handle port management event + * + * @v hermon Hermon device + * @v eqe Port management change event queue entry + */ +static void hermon_event_port_mgmnt_change ( struct hermon *hermon, + union hermonprm_event_entry *eqe){ + unsigned int port; + + /* Get port */ + port = ( MLX_GET ( &eqe->port_mgmnt_change, port ) - 1 ); + DBGC ( hermon, "Hermon %p port %d management change\n", + hermon, ( port + 1 ) ); + + /* Sanity check */ + if ( port >= hermon->cap.num_ports ) { + DBGC ( hermon, "Hermon %p port %d does not exist!\n", + hermon, ( port + 1 ) ); + return; + } + + /* Update MAD parameters */ + ib_smc_update ( hermon->port[port].ibdev, hermon_mad ); +} + +/** * Poll event queue * * @v ibdev Infiniband device @@ -2169,6 +2195,9 @@ static void hermon_poll_eq ( struct ib_device *ibdev ) { case HERMON_EV_PORT_STATE_CHANGE: hermon_event_port_state_change ( hermon, eqe ); break; + case HERMON_EV_PORT_MGMNT_CHANGE: + hermon_event_port_mgmnt_change ( hermon, eqe ); + break; default: DBGC ( hermon, "Hermon %p EQN %#lx unrecognised event " "type %#02x:%#02x\n", diff --git a/src/drivers/infiniband/hermon.h b/src/drivers/infiniband/hermon.h index b4d95d23e..fddd7fd41 100644 --- a/src/drivers/infiniband/hermon.h +++ b/src/drivers/infiniband/hermon.h @@ -123,6 +123,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #define HERMON_SET_PORT_GID_TABLE 0x0500 #define HERMON_EV_PORT_STATE_CHANGE 0x09 +#define HERMON_EV_PORT_MGMNT_CHANGE 0x1d #define HERMON_SCHED_QP0 0x3f #define HERMON_SCHED_DEFAULT 0x83 @@ -217,6 +218,13 @@ struct hermonprm_port_state_change_event_st { struct hermonprm_port_state_change_st data; } __attribute__ (( packed )); +struct hermonprm_port_mgmnt_change_event_st { + pseudo_bit_t reserved[0x00020]; +/* -------------- */ + pseudo_bit_t port[0x00008]; + pseudo_bit_t reserved0[0x00018]; +} __attribute__ (( packed )); + struct hermonprm_sense_port_st { pseudo_bit_t reserved0[0x00020]; /* -------------- */ @@ -460,6 +468,7 @@ struct MLX_DECLARE_STRUCT ( hermonprm_mod_stat_cfg_input_mod ); struct MLX_DECLARE_STRUCT ( hermonprm_mpt ); struct MLX_DECLARE_STRUCT ( hermonprm_mtt ); struct MLX_DECLARE_STRUCT ( hermonprm_port_state_change_event ); +struct MLX_DECLARE_STRUCT ( hermonprm_port_mgmnt_change_event ); struct MLX_DECLARE_STRUCT ( hermonprm_qp_db_record ); struct MLX_DECLARE_STRUCT ( hermonprm_qp_ee_state_transitions ); struct MLX_DECLARE_STRUCT ( hermonprm_query_dev_cap ); @@ -530,6 +539,7 @@ union hermonprm_completion_entry { union hermonprm_event_entry { struct hermonprm_event_queue_entry generic; struct hermonprm_port_state_change_event port_state_change; + struct hermonprm_port_mgmnt_change_event port_mgmnt_change; } __attribute__ (( packed )); union hermonprm_doorbell_register { |