6818478 Disable IOC enumeration by default
authorRamaswamy Tummala <Ramaswamy.Tummala@Sun.COM>
Mon, 28 Jun 2010 23:30:25 -0700
changeset 12723 a1945ef29715
parent 12722 0cc41f673f9d
child 12724 f08debe63952
6818478 Disable IOC enumeration by default 6953257 ibdm_get_waittime() - "hca" pointer should be changed at end of loop
usr/src/uts/common/io/ib/mgt/ibdm/ibdm.c
--- a/usr/src/uts/common/io/ib/mgt/ibdm/ibdm.c	Tue Jun 29 15:11:58 2010 +0530
+++ b/usr/src/uts/common/io/ib/mgt/ibdm/ibdm.c	Mon Jun 28 23:30:25 2010 -0700
@@ -159,6 +159,7 @@
 #ifdef DEBUG
 int	ibdm_ignore_saa_event = 0;
 #endif
+int	ibdm_enumerate_iocs = 0;
 
 /* Modload support */
 static struct modlmisc ibdm_modlmisc	= {
@@ -735,7 +736,7 @@
 	    NULL) != IBT_SUCCESS)
 		return;
 
-	if (port->pa_sa_hdl != NULL)
+	if (port->pa_sa_hdl != NULL || port->pa_pkey_tbl != NULL)
 		return;
 
 	if (ibt_query_hca_ports(port->pa_hca_hdl, port->pa_port_num,
@@ -758,31 +759,40 @@
 
 	ibt_free_portinfo(pinfop, size);
 
-	event_args.is_event_callback = ibdm_saa_event_cb;
-	event_args.is_event_callback_arg = port;
-	if (ibmf_sa_session_open(port->pa_port_guid, 0, &event_args,
-	    IBMF_VERSION, 0, &port->pa_sa_hdl) != IBMF_SUCCESS) {
-		IBTF_DPRINTF_L2("ibdm", "\tinitialize_port: "
-		    "sa access registration failed");
-		return;
-	}
-	ibmf_reg.ir_ci_guid		= port->pa_hca_guid;
-	ibmf_reg.ir_port_num		= port->pa_port_num;
-	ibmf_reg.ir_client_class	= DEV_MGT_MANAGER;
-
-	if (ibmf_register(&ibmf_reg, IBMF_VERSION, 0, NULL, NULL,
-	    &port->pa_ibmf_hdl, &port->pa_ibmf_caps) != IBMF_SUCCESS) {
-		IBTF_DPRINTF_L2("ibdm", "\tinitialize_port: "
-		    "IBMF registration failed");
-		(void) ibdm_fini_port(port);
-		return;
-	}
-	if (ibmf_setup_async_cb(port->pa_ibmf_hdl, IBMF_QP_HANDLE_DEFAULT,
-	    ibdm_ibmf_recv_cb, 0, 0) != IBMF_SUCCESS) {
-		IBTF_DPRINTF_L2("ibdm", "\tinitialize_port: "
-		    "IBMF setup recv cb failed");
-		(void) ibdm_fini_port(port);
-		return;
+	if (ibdm_enumerate_iocs) {
+		event_args.is_event_callback = ibdm_saa_event_cb;
+		event_args.is_event_callback_arg = port;
+		if (ibmf_sa_session_open(port->pa_port_guid, 0, &event_args,
+		    IBMF_VERSION, 0, &port->pa_sa_hdl) != IBMF_SUCCESS) {
+			IBTF_DPRINTF_L2("ibdm", "\tinitialize_port: "
+			    "sa access registration failed");
+			(void) ibdm_fini_port(port);
+			return;
+		}
+
+		ibmf_reg.ir_ci_guid		= port->pa_hca_guid;
+		ibmf_reg.ir_port_num		= port->pa_port_num;
+		ibmf_reg.ir_client_class	= DEV_MGT_MANAGER;
+
+		if (ibmf_register(&ibmf_reg, IBMF_VERSION, 0, NULL, NULL,
+		    &port->pa_ibmf_hdl, &port->pa_ibmf_caps) != IBMF_SUCCESS) {
+			IBTF_DPRINTF_L2("ibdm", "\tinitialize_port: "
+			    "IBMF registration failed");
+			(void) ibdm_fini_port(port);
+			return;
+		}
+
+		if (ibmf_setup_async_cb(port->pa_ibmf_hdl,
+		    IBMF_QP_HANDLE_DEFAULT,
+		    ibdm_ibmf_recv_cb, 0, 0) != IBMF_SUCCESS) {
+			IBTF_DPRINTF_L2("ibdm", "\tinitialize_port: "
+			    "IBMF setup recv cb failed");
+			(void) ibdm_fini_port(port);
+			return;
+		}
+	} else {
+		port->pa_sa_hdl = NULL;
+		port->pa_ibmf_hdl = NULL;
 	}
 
 	for (ii = 0; ii < port->pa_npkeys; ii++) {
@@ -805,6 +815,11 @@
 {
 	int ret;
 
+	if (ibdm_enumerate_iocs == 0) {
+		port->pa_pkey_tbl[ii].pt_qp_hdl = NULL;
+		return;
+	}
+
 	if ((ret = ibmf_alloc_qp(port->pa_ibmf_hdl, pkey, IB_GSI_QKEY,
 	    IBMF_ALT_QP_MAD_NO_RMPP, &port->pa_pkey_tbl[ii].pt_qp_hdl)) !=
 	    IBMF_SUCCESS) {
@@ -1084,6 +1099,12 @@
 	if (ibdm_uninit_hca(head) != IBDM_SUCCESS)
 		(void) ibdm_handle_hca_attach(hca_guid);
 
+#ifdef DEBUG
+	if (ibdm_enumerate_iocs == 0) {
+		ASSERT(ibdm.ibdm_dp_gidlist_head == NULL);
+	}
+#endif
+
 	/*
 	 * Now clean up the HCA lists in the gidlist.
 	 */
@@ -1228,6 +1249,11 @@
 
 	IBTF_DPRINTF_L5("ibdm", "\tport_attr_ibmf_fini:");
 
+	if (ibdm_enumerate_iocs == 0) {
+		ASSERT(port_attr->pa_pkey_tbl[ii].pt_qp_hdl == NULL);
+		return (IBDM_SUCCESS);
+	}
+
 	if (port_attr->pa_pkey_tbl[ii].pt_qp_hdl) {
 		ibmf_status = ibmf_tear_down_async_cb(port_attr->pa_ibmf_hdl,
 		    port_attr->pa_pkey_tbl[ii].pt_qp_hdl, 0);
@@ -4691,7 +4717,8 @@
 			}
 			hca = hca->hl_next;
 		}
-		IBTF_DPRINTF_L4("ibdm", "\tget_waittime %llx", wait_time);
+		IBTF_DPRINTF_L2("ibdm", "\tget_waittime: wait_time = %ld secs",
+		    (long)wait_time);
 		return (wait_time);
 	}
 
@@ -4701,8 +4728,10 @@
 			temp = ((temp >= dft_wait) ? 0 : (dft_wait - temp));
 			wait_time = (temp > wait_time) ? temp : wait_time;
 		}
-	}
-	IBTF_DPRINTF_L4("ibdm", "\tget_waittime %llx", wait_time);
+		hca = hca->hl_next;
+	}
+	IBTF_DPRINTF_L2("ibdm", "\tget_waittime: wait_time = %ld secs",
+	    (long)wait_time);
 	return (wait_time);
 }
 
@@ -4715,6 +4744,13 @@
 	mutex_enter(&ibdm.ibdm_hl_mutex);
 
 	while ((wait_time = ibdm_get_waittime(hca_guid, dft_wait)) > 0) {
+		if (wait_time > dft_wait) {
+			IBTF_DPRINTF_L1("ibdm",
+			    "\tibnex_port_settle_wait: wait_time = %ld secs; "
+			    "Resetting to %d secs",
+			    (long)wait_time, dft_wait);
+			wait_time = dft_wait;
+		}
 		delta = drv_usectohz(wait_time * 1000000);
 		(void) cv_reltimedwait(&ibdm.ibdm_port_settle_cv,
 		    &ibdm.ibdm_hl_mutex, delta, TR_CLOCK_TICK);
@@ -4961,6 +4997,10 @@
 
 	IBTF_DPRINTF_L4("ibdm", "\tibnex_probe_ioc: (%llX, %llX, %d) Begin",
 	    iou, ioc_guid, reprobe_flag);
+
+	if (ibdm_enumerate_iocs == 0)
+		return (NULL);
+
 	/* Check whether we know this already */
 	ioc_info = ibdm_get_ioc_info_with_gid(ioc_guid, &gid_info);
 	if (ioc_info == NULL) {
@@ -5157,6 +5197,9 @@
 ibdm_ioc_info_t *
 ibdm_ibnex_get_ioc_info(ib_guid_t ioc_guid)
 {
+	if (ibdm_enumerate_iocs == 0)
+		return (NULL);
+
 	/* will not use the gid_info pointer, so the second arg is NULL */
 	return (ibdm_get_ioc_info_with_gid(ioc_guid, NULL));
 }
@@ -5172,6 +5215,9 @@
 	ibdm_ioc_info_t		*ioc;
 	ibdm_dp_gidinfo_t	*gid_list;
 
+	if (ibdm_enumerate_iocs == 0)
+		return (0);
+
 	mutex_enter(&ibdm.ibdm_mutex);
 	ibdm_sweep_fabric(0);
 
@@ -5220,6 +5266,9 @@
 
 	IBTF_DPRINTF_L4("ibdm", "\tget_ioc_list: Enter");
 
+	if (ibdm_enumerate_iocs == 0)
+		return (NULL);
+
 	mutex_enter(&ibdm.ibdm_mutex);
 	if (list_flag != IBDM_IBNEX_DONOT_PROBE)
 		ibdm_sweep_fabric(list_flag == IBDM_IBNEX_REPROBE_ALL);
@@ -5705,6 +5754,7 @@
 	IBTF_DPRINTF_L4("ibdm", "\tsaa_event_cb(%x, %x, %x, %x)\n",
 	    ibmf_saa_handle, ibmf_saa_event, event_details,
 	    callback_arg);
+
 #ifdef DEBUG
 	if (ibdm_ignore_saa_event)
 		return;
@@ -6683,6 +6733,9 @@
 	IBTF_DPRINTF_L4(ibdm_string, "\treset_all_dgids(%X)",
 	    port_sa_hdl);
 
+	if (ibdm_enumerate_iocs == 0)
+		return;
+
 	ASSERT(!MUTEX_HELD(&ibdm.ibdm_mutex));
 	ASSERT(!MUTEX_HELD(&ibdm.ibdm_hl_mutex));