[ofa-general] [PATCH] opensm: move osm_sa_send_error() to osm_sa.c file

Sasha Khapyorsky sashak at voltaire.com
Sat Mar 1 13:05:39 PST 2008


Move osm_sa_send_error() tp osm_sa.c file. Remove empty
osm_sa_response.c file.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/Makefile.am       |    2 +-
 opensm/opensm/osm_sa.c          |   63 ++++++++++++++++++++
 opensm/opensm/osm_sa_response.c |  122 ---------------------------------------
 3 files changed, 64 insertions(+), 123 deletions(-)
 delete mode 100644 opensm/opensm/osm_sa_response.c

diff --git a/opensm/opensm/Makefile.am b/opensm/opensm/Makefile.am
index 50fdae1..d9ebe53 100644
--- a/opensm/opensm/Makefile.am
+++ b/opensm/opensm/Makefile.am
@@ -46,7 +46,7 @@ opensm_SOURCES = main.c osm_console.c osm_db_files.c \
 		 osm_sa_mcmember_record.c osm_sa_node_record.c \
 		 osm_sa_path_record.c osm_sa_pkey_record.c \
 		 osm_sa_portinfo_record.c osm_sa_guidinfo_record.c \
-		 osm_sa_multipath_record.c osm_sa_response.c \
+		 osm_sa_multipath_record.c \
 		 osm_sa_service_record.c osm_sa_slvl_record.c \
 		 osm_sa_sminfo_record.c osm_sa_vlarb_record.c \
 		 osm_sa_sw_info_record.c osm_service.c \
diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
index 498bae8..c557876 100644
--- a/opensm/opensm/osm_sa.c
+++ b/opensm/opensm/osm_sa.c
@@ -68,6 +68,7 @@
 #include <opensm/osm_multicast.h>
 #include <opensm/osm_inform.h>
 #include <opensm/osm_service.h>
+#include <opensm/osm_helper.h>
 #include <vendor/osm_vendor_api.h>
 
 #define  OSM_SA_INITIAL_TID_VALUE 0xabc
@@ -336,6 +337,68 @@ osm_sa_vendor_send(IN osm_bind_handle_t h_bind,
 	return status;
 }
 
+void
+osm_sa_send_error(IN osm_sa_t * sa,
+		  IN const osm_madw_t * const p_madw,
+		  IN const ib_net16_t sa_status)
+{
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	ib_sa_mad_t *p_sa_mad;
+
+	OSM_LOG_ENTER(sa->p_log);
+
+	/* avoid races - if we are exiting - exit */
+	if (osm_exit_flag) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Ignoring requested send after exit\n");
+		goto Exit;
+	}
+
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
+				       p_madw->h_bind, MAD_BLOCK_SIZE,
+				       &p_madw->mad_addr);
+
+	if (p_resp_madw == NULL) {
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2301: "
+			"Unable to acquire response MAD\n");
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+
+	/*  Copy the MAD header back into the response mad */
+	*p_resp_sa_mad = *p_sa_mad;
+	p_resp_sa_mad->status = sa_status;
+
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_SET)
+		p_resp_sa_mad->method = IB_MAD_METHOD_GET;
+
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+
+	/*
+	 * C15-0.1.5 - always return SM_Key = 0 (table 185 p 884)
+	 */
+	p_resp_sa_mad->sm_key = 0;
+
+	/*
+	 * o15-0.2.7 - The PathRecord Attribute ID shall be used in
+	 * the response (to a SubnAdmGetMulti(MultiPathRecord)
+	 */
+	if (p_resp_sa_mad->attr_id == IB_MAD_ATTR_MULTIPATH_RECORD)
+		p_resp_sa_mad->attr_id = IB_MAD_ATTR_PATH_RECORD;
+
+	if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))
+		osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
+
+	osm_sa_vendor_send(osm_madw_get_bind_handle(p_resp_madw),
+			   p_resp_madw, FALSE, sa->p_subn);
+
+Exit:
+	OSM_LOG_EXIT(sa->p_log);
+}
+
 /**********************************************************************
  **********************************************************************/
 /*
diff --git a/opensm/opensm/osm_sa_response.c b/opensm/opensm/osm_sa_response.c
deleted file mode 100644
index 6477aca..0000000
--- a/opensm/opensm/osm_sa_response.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses.  You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- *     Redistribution and use in source and binary forms, with or
- *     without modification, are permitted provided that the following
- *     conditions are met:
- *
- *      - Redistributions of source code must retain the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer.
- *
- *      - Redistributions in binary form must reproduce the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer in the documentation and/or other materials
- *        provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-/*
- * Abstract:
- *    Implementation of osm_sa_resp_t.
- * This object represents the SA query responder.
- * This object is part of the opensm family of objects.
- *
- * Environment:
- *    Linux User Mode
- *
- * $Revision: 1.6 $
- */
-
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif				/* HAVE_CONFIG_H */
-
-#include <string.h>
-#include <iba/ib_types.h>
-#include <complib/cl_debug.h>
-#include <vendor/osm_vendor_api.h>
-#include <opensm/osm_helper.h>
-#include <opensm/osm_opensm.h>
-#include <opensm/osm_sa.h>
-
-/**********************************************************************
- **********************************************************************/
-void
-osm_sa_send_error(IN osm_sa_t * sa,
-		  IN const osm_madw_t * const p_madw,
-		  IN const ib_net16_t sa_status)
-{
-	osm_madw_t *p_resp_madw;
-	ib_sa_mad_t *p_resp_sa_mad;
-	ib_sa_mad_t *p_sa_mad;
-
-	OSM_LOG_ENTER(sa->p_log);
-
-	/* avoid races - if we are exiting - exit */
-	if (osm_exit_flag) {
-		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-			"Ignoring requested send after exit\n");
-		goto Exit;
-	}
-
-	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
-				       p_madw->h_bind, MAD_BLOCK_SIZE,
-				       &p_madw->mad_addr);
-
-	if (p_resp_madw == NULL) {
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2301: "
-			"Unable to acquire response MAD\n");
-		goto Exit;
-	}
-
-	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
-	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
-
-	/*  Copy the MAD header back into the response mad */
-	*p_resp_sa_mad = *p_sa_mad;
-	p_resp_sa_mad->status = sa_status;
-
-	if (p_resp_sa_mad->method == IB_MAD_METHOD_SET)
-		p_resp_sa_mad->method = IB_MAD_METHOD_GET;
-
-	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-
-	/*
-	 * C15-0.1.5 - always return SM_Key = 0 (table 185 p 884)
-	 */
-	p_resp_sa_mad->sm_key = 0;
-
-	/*
-	 * o15-0.2.7 - The PathRecord Attribute ID shall be used in
-	 * the response (to a SubnAdmGetMulti(MultiPathRecord)
-	 */
-	if (p_resp_sa_mad->attr_id == IB_MAD_ATTR_MULTIPATH_RECORD)
-		p_resp_sa_mad->attr_id = IB_MAD_ATTR_PATH_RECORD;
-
-	if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))
-		osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
-
-	osm_sa_vendor_send(osm_madw_get_bind_handle(p_resp_madw),
-			   p_resp_madw, FALSE, sa->p_subn);
-
-Exit:
-	OSM_LOG_EXIT(sa->p_log);
-}
-- 
1.5.4.1.122.gaa8d




More information about the general mailing list