@@ -250,6 +250,7 @@ typedef struct osm_subn_opt {
ib_net64_t sa_key;
ib_net64_t subnet_prefix;
ib_net16_t m_key_lease_period;
+ uint8_t m_key_protect_bits;
uint32_t sweep_interval;
uint32_t max_wire_smps;
uint32_t max_wire_smps2;
@@ -889,6 +889,11 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
sizeof(p_pi->m_key_lease_period)))
send_set = TRUE;
+ p_pi->mkey_lmc = 0;
+ ib_port_info_set_mpb(p_pi, p_mgr->p_subn->opt.m_key_protect_bits);
+ if (ib_port_info_get_mpb(p_pi) != ib_port_info_get_mpb(p_old_pi))
+ send_set = TRUE;
+
/*
we want to set the timeout for both the switch port 0
and the CA ports
@@ -910,12 +915,10 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
sizeof(p_pi->link_width_enabled)))
send_set = TRUE;
- /* M_KeyProtectBits are currently always zero */
- p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;
+ /* p_pi->mkey_lmc is initialized earlier */
+ ib_port_info_set_lmc(p_pi, p_mgr->p_subn->opt.lmc);
if (ib_port_info_get_lmc(p_pi) !=
- ib_port_info_get_lmc(p_old_pi) ||
- ib_port_info_get_mpb(p_pi) !=
- ib_port_info_get_mpb(p_old_pi))
+ ib_port_info_get_lmc(p_old_pi))
send_set = TRUE;
/* calc new op_vls and mtu */
@@ -996,12 +999,10 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
/* Determine if enhanced switch port 0 and if so set LMC */
if (osm_switch_sp0_is_lmc_capable(p_node->sw, p_mgr->p_subn)) {
- /* M_KeyProtectBits are currently always zero */
- p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;
+ /* p_pi->mkey_lmc is initialized earlier */
+ ib_port_info_set_lmc(p_pi, p_mgr->p_subn->opt.lmc);
if (ib_port_info_get_lmc(p_pi) !=
- ib_port_info_get_lmc(p_old_pi) ||
- ib_port_info_get_mpb(p_pi) !=
- ib_port_info_get_mpb(p_old_pi))
+ ib_port_info_get_lmc(p_old_pi))
send_set = TRUE;
}
}
@@ -240,8 +240,8 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
sizeof(p_pi->m_key_lease_period)))
send_set = TRUE;
- /* M_KeyProtectBits are currently always zero */
p_pi->mkey_lmc = 0;
+ ib_port_info_set_mpb(p_pi, sm->p_subn->opt.m_key_protect_bits);
if (esp0 == FALSE || sm->p_subn->opt.lmc_esp0)
ib_port_info_set_lmc(p_pi, sm->p_subn->opt.lmc);
if (ib_port_info_get_lmc(p_old_pi) !=
@@ -699,6 +699,7 @@ static const opt_rec_t opt_tbl[] = {
{ "sa_key", OPT_OFFSET(sa_key), opts_parse_net64, NULL, 1 },
{ "subnet_prefix", OPT_OFFSET(subnet_prefix), opts_parse_net64, NULL, 1 },
{ "m_key_lease_period", OPT_OFFSET(m_key_lease_period), opts_parse_net16, NULL, 1 },
+ { "m_key_protection_level", OPT_OFFSET(m_key_protect_bits), opts_parse_uint8, NULL, 1 },
{ "sweep_interval", OPT_OFFSET(sweep_interval), opts_parse_uint32, NULL, 1 },
{ "max_wire_smps", OPT_OFFSET(max_wire_smps), opts_parse_uint32, NULL, 1 },
{ "max_wire_smps2", OPT_OFFSET(max_wire_smps2), opts_parse_uint32, NULL, 1 },
@@ -1318,6 +1319,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
p_opt->sa_key = OSM_DEFAULT_SA_KEY;
p_opt->subnet_prefix = IB_DEFAULT_SUBNET_PREFIX;
p_opt->m_key_lease_period = 0;
+ p_opt->m_key_protect_bits = 0;
p_opt->sweep_interval = OSM_DEFAULT_SWEEP_INTERVAL_SECS;
p_opt->max_wire_smps = OSM_DEFAULT_SMP_MAX_ON_WIRE;
p_opt->max_wire_smps2 = p_opt->max_wire_smps;
@@ -2071,6 +2073,8 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
"m_key 0x%016" PRIx64 "\n\n"
"# The lease period used for the M_Key on this subnet in [sec]\n"
"m_key_lease_period %u\n\n"
+ "# The protection level used for the M_Key on this subnet\n"
+ "m_key_protection_level %u\n\n"
"# SM_Key value of the SM used for SM authentication\n"
"sm_key 0x%016" PRIx64 "\n\n"
"# SM_Key value to qualify rcv SA queries as 'trusted'\n"
@@ -2152,6 +2156,7 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
cl_ntoh64(p_opts->guid),
cl_ntoh64(p_opts->m_key),
cl_ntoh16(p_opts->m_key_lease_period),
+ p_opts->m_key_protect_bits,
cl_ntoh64(p_opts->sm_key),
cl_ntoh64(p_opts->sa_key),
cl_ntoh64(p_opts->subnet_prefix),
The M_Key Protection Level for the subnet may now be set in the config file by specifying a numeric value for m_key_protection_level (defaults to 0). Signed-off-by: Jim Foraker <foraker1@llnl.gov> --- include/opensm/osm_subnet.h | 1 + opensm/osm_lid_mgr.c | 21 +++++++++++---------- opensm/osm_link_mgr.c | 2 +- opensm/osm_subnet.c | 5 +++++ 4 files changed, 18 insertions(+), 11 deletions(-)