[ofa-general] [PATCH] opensm: PortInfo requests for discovered switches
Sasha Khapyorsky
sashak at voltaire.com
Sat Feb 28 09:36:35 PST 2009
Request PortInfo for all switch ports right on first NodeInfo
receiving and don't wait for SwitchInfo request results. This will
simplify a subnet discovery flow and speed it up.
Remove switch->discovery_count which is not needed anymore.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
opensm/include/opensm/osm_switch.h | 6 ---
opensm/opensm/osm_node_info_rcv.c | 83 ++++++++++++++----------------------
opensm/opensm/osm_perfmgr.c | 1 -
opensm/opensm/osm_state_mgr.c | 1 -
opensm/opensm/osm_sw_info_rcv.c | 71 ------------------------------
5 files changed, 32 insertions(+), 130 deletions(-)
diff --git a/opensm/include/opensm/osm_switch.h b/opensm/include/opensm/osm_switch.h
index 6279727..3e3626b 100644
--- a/opensm/include/opensm/osm_switch.h
+++ b/opensm/include/opensm/osm_switch.h
@@ -103,7 +103,6 @@ typedef struct osm_switch {
uint8_t *lft;
uint8_t *new_lft;
osm_mcast_tbl_t mcast_tbl;
- uint32_t discovery_count;
unsigned endport_links;
unsigned need_update;
void *priv;
@@ -145,11 +144,6 @@ typedef struct osm_switch {
* mcast_tbl
* Multicast forwarding table for this switch.
*
-* discovery_count
-* The number of times this switch has been discovered
-* during the current fabric sweep. This number is reset
-* to zero at the start of a sweep.
-*
* need_update
* When set indicates that switch was probably reset, so
* fwd tables and rest cached data should be flushed
diff --git a/opensm/opensm/osm_node_info_rcv.c b/opensm/opensm/osm_node_info_rcv.c
index ac86b9a..e40fc82 100644
--- a/opensm/opensm/osm_node_info_rcv.c
+++ b/opensm/opensm/osm_node_info_rcv.c
@@ -244,51 +244,43 @@ _exit:
}
/**********************************************************************
- The plock must be held before calling this function.
**********************************************************************/
-static void
-__osm_ni_rcv_process_new_node(IN osm_sm_t * sm,
- IN osm_node_t * const p_node,
- IN const osm_madw_t * const p_madw)
+static void ni_rcv_get_port_info(IN osm_sm_t * sm, IN osm_node_t * node,
+ IN const osm_madw_t * madw)
{
- ib_api_status_t status = IB_SUCCESS;
osm_madw_context_t context;
- osm_physp_t *p_physp;
- ib_node_info_t *p_ni;
- ib_smp_t *p_smp;
- uint8_t port_num;
+ osm_physp_t *physp;
+ ib_node_info_t *ni;
+ unsigned port, num_ports;
+ ib_api_status_t status;
- OSM_LOG_ENTER(sm->p_log);
+ ni = ib_smp_get_payload_ptr(osm_madw_get_smp_ptr(madw));
- p_smp = osm_madw_get_smp_ptr(p_madw);
- p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
- port_num = ib_node_info_get_local_port_num(p_ni);
+ if (ni->node_type == IB_NODE_TYPE_SWITCH) {
+ port = 0;
+ num_ports = osm_node_get_num_physp(node);
+ } else {
+ port = ib_node_info_get_local_port_num(ni);
+ num_ports = port + 1;
+ }
- /*
- Request PortInfo & NodeDescription attributes for the port
- that responded to the NodeInfo attribute.
- Because this is a channel adapter or router, we are
- not allowed to request PortInfo for the other ports.
- Set the context union properly, so the recipient
- knows which node & port are relevant.
- */
- p_physp = osm_node_get_physp_ptr(p_node, port_num);
+ physp = osm_node_get_physp_ptr(node, port);
- context.pi_context.node_guid = p_ni->node_guid;
- context.pi_context.port_guid = p_ni->port_guid;
+ context.pi_context.node_guid = osm_node_get_node_guid(node);
+ context.pi_context.port_guid = osm_physp_get_port_guid(physp);
context.pi_context.set_method = FALSE;
context.pi_context.light_sweep = FALSE;
context.pi_context.active_transition = FALSE;
- status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
- IB_MAD_ATTR_PORT_INFO,
- cl_hton32(port_num), CL_DISP_MSGID_NONE, &context);
- if (status != IB_SUCCESS)
- OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D02: "
- "Failure initiating PortInfo request (%s)\n",
- ib_get_err_str(status));
-
- OSM_LOG_EXIT(sm->p_log);
+ for (; port < num_ports; port++) {
+ status = osm_req_get(sm, osm_physp_get_dr_path_ptr(physp),
+ IB_MAD_ATTR_PORT_INFO, cl_hton32(port),
+ CL_DISP_MSGID_NONE, &context);
+ if (status != IB_SUCCESS)
+ OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR OD02: "
+ "Failure initiating PortInfo request (%s)\n",
+ ib_get_err_str(status));
+ }
}
/**********************************************************************
@@ -359,7 +351,7 @@ __osm_ni_rcv_process_new_ca_or_router(IN osm_sm_t * sm,
{
OSM_LOG_ENTER(sm->p_log);
- __osm_ni_rcv_process_new_node(sm, p_node, p_madw);
+ ni_rcv_get_port_info(sm, p_node, p_madw);
/*
A node guid of 0 is the corner case that indicates
@@ -384,10 +376,8 @@ __osm_ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
ib_smp_t *p_smp;
osm_port_t *p_port;
osm_port_t *p_port_check;
- osm_madw_context_t context;
uint8_t port_num;
osm_physp_t *p_physp;
- ib_api_status_t status;
osm_dr_path_t *p_dr_path;
osm_bind_handle_t h_bind;
@@ -461,19 +451,7 @@ __osm_ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
p_smp->initial_path);
}
- context.pi_context.node_guid = p_ni->node_guid;
- context.pi_context.port_guid = p_ni->port_guid;
- context.pi_context.set_method = FALSE;
- context.pi_context.light_sweep = FALSE;
-
- status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
- IB_MAD_ATTR_PORT_INFO,
- cl_hton32(port_num), CL_DISP_MSGID_NONE, &context);
-
- if (status != IB_SUCCESS)
- OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D13: "
- "Failure initiating PortInfo request (%s)\n",
- ib_get_err_str(status));
+ ni_rcv_get_port_info(sm, p_node, p_madw);
Exit:
OSM_LOG_EXIT(sm->p_log);
@@ -513,6 +491,9 @@ __osm_ni_rcv_process_switch(IN osm_sm_t * sm,
"Failure initiating SwitchInfo request (%s)\n",
ib_get_err_str(status));
+ if (p_node->discovery_count == 1)
+ ni_rcv_get_port_info(sm, p_node, p_madw);
+
OSM_LOG_EXIT(sm->p_log);
}
@@ -536,7 +517,7 @@ __osm_ni_rcv_process_existing_switch(IN osm_sm_t * sm,
*/
if (p_node->discovery_count == 1)
__osm_ni_rcv_process_switch(sm, p_node, p_madw);
- else if (!p_node->sw || p_node->sw->discovery_count == 0) {
+ else if (!p_node->sw) {
/* we don't have the SwitchInfo - retry to get it */
OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
"Retry to get SwitchInfo on node GUID:0x%" PRIx64 "\n",
diff --git a/opensm/opensm/osm_perfmgr.c b/opensm/opensm/osm_perfmgr.c
index 6d325cb..58b5dc2 100644
--- a/opensm/opensm/osm_perfmgr.c
+++ b/opensm/opensm/osm_perfmgr.c
@@ -726,7 +726,6 @@ static void reset_port_count(cl_map_item_t * const p_map_item, void *cxt)
static void reset_switch_count(cl_map_item_t * const p_map_item, void *cxt)
{
osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
- p_sw->discovery_count = 0;
p_sw->need_update = 0;
}
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index a1efd1a..0d7cf15 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -115,7 +115,6 @@ __osm_state_mgr_reset_switch_count(IN cl_map_item_t * const p_map_item,
{
osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
- p_sw->discovery_count = 0;
p_sw->need_update = 1;
}
diff --git a/opensm/opensm/osm_sw_info_rcv.c b/opensm/opensm/osm_sw_info_rcv.c
index 751c6f4..2f2775a 100644
--- a/opensm/opensm/osm_sw_info_rcv.c
+++ b/opensm/opensm/osm_sw_info_rcv.c
@@ -55,53 +55,6 @@
#include <opensm/osm_helper.h>
#include <opensm/osm_opensm.h>
-/**********************************************************************
- The plock must be held before calling this function.
-**********************************************************************/
-static void si_rcv_get_port_info(IN osm_sm_t * sm, IN osm_switch_t * const p_sw)
-{
- osm_madw_context_t context;
- uint8_t port_num;
- osm_physp_t *p_physp;
- osm_node_t *p_node;
- uint8_t num_ports;
- ib_api_status_t status = IB_SUCCESS;
-
- OSM_LOG_ENTER(sm->p_log);
-
- CL_ASSERT(p_sw);
-
- p_node = p_sw->p_node;
-
- CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
-
- /*
- Request PortInfo attribute for each port on the switch.
- */
- p_physp = osm_node_get_physp_ptr(p_node, 0);
-
- context.pi_context.node_guid = osm_node_get_node_guid(p_node);
- context.pi_context.port_guid = osm_physp_get_port_guid(p_physp);
- context.pi_context.set_method = FALSE;
- context.pi_context.light_sweep = FALSE;
- context.pi_context.active_transition = FALSE;
-
- num_ports = osm_node_get_num_physp(p_node);
-
- for (port_num = 0; port_num < num_ports; port_num++) {
- status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
- IB_MAD_ATTR_PORT_INFO, cl_hton32(port_num),
- CL_DISP_MSGID_NONE, &context);
- if (status != IB_SUCCESS)
- /* continue the loop despite the error */
- OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3602: "
- "Failure initiating PortInfo request (%s)\n",
- ib_get_err_str(status));
- }
-
- OSM_LOG_EXIT(sm->p_log);
-}
-
#if 0
/**********************************************************************
The plock must be held before calling this function.
@@ -307,12 +260,6 @@ static void si_rcv_process_new(IN osm_sm_t * sm, IN osm_node_t * const p_node,
info we just received.
*/
osm_switch_set_switch_info(p_sw, p_si);
- p_sw->discovery_count++;
-
- /*
- Get the PortInfo attribute for every port.
- */
- si_rcv_get_port_info(sm, p_sw);
/*
Don't bother retrieving the current unicast and multicast tables
@@ -392,24 +339,6 @@ static boolean_t si_rcv_process_existing(IN osm_sm_t * sm,
OSM_LOG_DEBUG);
is_change_detected = TRUE;
}
- } else {
- /*
- This is a heavy sweep. Get information regardless
- of the state change bit.
- */
- p_sw->discovery_count++;
- OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
- "discovery_count is:%u\n",
- p_sw->discovery_count);
-
- /* If this is the first discovery - then get the port_info */
- if (p_sw->discovery_count == 1)
- si_rcv_get_port_info(sm, p_sw);
- else
- OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
- "Not discovering again through switch:0x%"
- PRIx64 "\n",
- osm_node_get_node_guid(p_sw->p_node));
}
}
--
1.6.1.2.319.gbd9e
More information about the general
mailing list