Skip to contentSkip to conversation

opensm: Add multicast support for alias GUIDs

PATCH In review Hal Rosenstock 1 participant 1 message Apr 29, 2011 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 6/13 opensm: Add multicast support for alias GUIDs

Quoted 1 line

From 725f4c8b87bf134bcfe2605d221e7757217e5e30 Mon Sep 17 00:00:00 2001

From: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/[email protected]>
Date: Thu, 28 Apr 2011 23:52:51 +0300
Subject: [PATCH] opensm: Add multicast support for alias GUIDs

Add mcm_alias_port_tbl to osm_mgrp and use this for port GID/GUIDs. Move scope_state, proxy_join, and port_gid from osm_mcm_port to osm_mcm_alias_guid. This is the basis for SA queries. Still use mcm_port_tbl for multicast routing.

In osm_drop_mgr::drop_mgr_remove_port, remove multicast ports sooner. Rewrite osm_mgrp_delete_port to be based on mcm alias port table. Change osm_mgrp_delete_port to take port rather than port guid as parameter.

---
 include/opensm/osm_mcm_port.h   |  130 +++++++++++++++++++++-----
 include/opensm/osm_multicast.h  |   44 ++++++++-
 opensm/osm_drop_mgr.c           |   14 ++--
 opensm/osm_mcm_port.c           |   34 ++++++-
 opensm/osm_multicast.c          |  194 +++++++++++++++++++++++++++++++-------
 opensm/osm_sa.c                 |   12 +-
 opensm/osm_sa_mcmember_record.c |   74 ++++++++-------
 opensm/osm_sa_path_record.c     |    5 +-
 8 files changed, 386 insertions(+), 121 deletions(-)
include/opensm/osm_mcm_port.h +107 -23
index 096f5f8..347e14a 100644
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2010 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
@@ -78,9 +78,6 @@ typedef struct osm_mcm_port {
 	cl_list_item_t list_item;
 	osm_port_t *port;
 	struct osm_mgrp *mgrp;
-	ib_gid_t port_gid;
-	uint8_t scope_state;
-	boolean_t proxy_join;
 } osm_mcm_port_t;
 /*
 * FIELDS
@@ -96,17 +93,6 @@ typedef struct osm_mcm_port {
 *	mgrp
 *		The pointer to multicast group where this port is member of
 *
-*	port_gid
-*		GID of the member port
-*
-*	scope_state
-*
-*	proxy_join
-*		If FALSE - Join was performed by the endport identified
-*		by PortGID. If TRUE - Join was performed on behalf of
-*		the endport identified by PortGID by another port within
-*		the same partition.
-*
 * SEE ALSO
 *	MCM Port Object
 *********/
@@ -121,8 +107,7 @@ typedef struct osm_mcm_port {
 *
 * SYNOPSIS
 */
-osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t * port, IN struct osm_mgrp *mgrp,
-				 IN ib_member_rec_t *mcmr, IN boolean_t proxy);
+osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t * port, IN struct osm_mgrp *mgrp);
 /*
 * PARAMETERS
 *	port
@@ -131,12 +116,6 @@ osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t * port, IN struct osm_mgrp *mgrp,
 *	mgrp
 *		[in] Pointer to multicast group where this port is joined
 *
-*	mcmr
-*		[in] Pointer to MCMember record of the join request
-*
-*	proxy
-*		[in] proxy_join state analyzed from the request
-*
 * RETURN VALUES
 *	Pointer to the allocated and initialized MCM Port object.
 *
@@ -171,5 +150,110 @@ void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm);
 *	MCM Port Object, osm_mcm_port_new
 *********/
 
+/****s* OpenSM: MCM Port Object/osm_mcm_alias_guid_t
+* NAME
+*	osm_mcm_alias_guid_t
+*
+* DESCRIPTION
+*	This object represents an alias guid for a mcm port.
+*
+*	The osm_mcm_alias_guid_t object should be treated as opaque and should
+*	be manipulated only through the provided functions.
+*
+* SYNOPSIS
+*/
+typedef struct osm_mcm_alias_guid {
+	cl_map_item_t map_item;
+	ib_net64_t alias_guid;
+	osm_mcm_port_t *p_base_mcm_port;
+	ib_gid_t port_gid;
+	uint8_t scope_state;
+	boolean_t proxy_join;
+} osm_mcm_alias_guid_t;
+/*
+* FIELDS
+*	map_item
+*		Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!
+*
+*	alias_guid
+*		Alias GUID for port obtained from SM GUIDInfo attribute
+*
+*	p_base_mcm_port
+*		Pointer to osm_mcm_port_t for base port GUID
+*
+*	port_gid
+*		GID of the member port
+*
+*	scope_state
+*
+*	proxy_join
+*		If FALSE - Join was performed by the endport identified
+*		by PortGID. If TRUE - Join was performed on behalf of
+*		the endport identified by PortGID by another port within
+*		the same partition.
+*
+* SEE ALSO
+*	MCM Port, Physical Port, Physical Port Table
+*/
+
+/****f* OpenSM: MCM Port Object/osm_mcm_alias_guid_new
+* NAME
+*	osm_mcm_alias_guid_new
+*
+* DESCRIPTION
+*	This function allocates and initializes an mcm alias guid object.
+*
+* SYNOPSIS
+*/
+osm_mcm_alias_guid_t *osm_mcm_alias_guid_new(IN osm_mcm_port_t *p_base_mcm_port,
+					     IN ib_member_rec_t *mcmr,
+					     IN boolean_t proxy);
+/*
+* PARAMETERS
+*	p_base_mcm_port
+*		[in] Pointer to the mcm port for this base GUID
+*
+*	mcmr
+*		[in] Pointer to MCMember record of the join request
+*
+*	proxy
+*		[in] proxy_join state analyzed from the request
+*
+* RETURN VALUE
+*	Pointer to the initialized mcm alias guid object.
+*
+* NOTES
+*	Allows calling other mcm alias guid methods.
+*
+* SEE ALSO
+*       MCM Port Object
+*********/
+
+/****f* OpenSM: MCM Port Object/osm_mcm_alias_guid_delete
+* NAME
+*	osm_mcm_alias_guid_delete
+*
+* DESCRIPTION
+*	This function destroys and deallocates an mcm alias guid object.
+*
+* SYNOPSIS
+*/
+void osm_mcm_alias_guid_delete(IN OUT osm_mcm_alias_guid_t ** pp_mcm_alias_guid);
+/*
+* PARAMETERS
+*	pp_mcm_alias_guid
+*		[in][out] Pointer to a pointer to an mcm alias guid object to
+*		delete. On return, this pointer is NULL.
+*
+* RETURN VALUE
+*	This function does not return a value.
+*
+* NOTES
+*	Performs any necessary cleanup of the specified mcm alias guid object.
+*
+* SEE ALSO
+*	MCM Port Object
+*********/
+
 END_C_DECLS
 #endif				/* _OSM_MCM_PORT_H_ */
include/opensm/osm_multicast.h +39 -5

85 lines not on this page · raw message

opensm/osm_drop_mgr.c +7 -7
index 10b51e2..9dba310 100644
@@ -209,6 +209,13 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 			ib_get_err_str(status));
 	}
 
+	while (!cl_is_qlist_empty(&p_port->mcm_list)) {
+		mcm_port = cl_item_obj(cl_qlist_head(&p_port->mcm_list),
+				       mcm_port, list_item);
+		osm_mgrp_delete_port(sm->p_subn, sm->p_log, mcm_port->mgrp,
+				     p_port);
+	}
+
 	p_alias_guid_tbl = &sm->p_subn->alias_port_guid_tbl;
 	p_alias_guid_check = (osm_alias_guid_t *) cl_qmap_head(p_alias_guid_tbl);
 	while (p_alias_guid_check != (osm_alias_guid_t *) cl_qmap_end(p_alias_guid_tbl)) {
@@ -249,13 +256,6 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 
 	drop_mgr_clean_physp(sm, p_port->p_physp);
 
-	while (!cl_is_qlist_empty(&p_port->mcm_list)) {
-		mcm_port = cl_item_obj(cl_qlist_head(&p_port->mcm_list),
-				       mcm_port, list_item);
-		osm_mgrp_delete_port(sm->p_subn, sm->p_log, mcm_port->mgrp,
-				     p_port->guid);
-	}
-
 	/* initialize the p_node - may need to get node_desc later */
 	p_node = p_port->p_node;
 
opensm/osm_mcm_port.c +28 -6
index ace1d07..2b08a6d 100644
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2010 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
@@ -49,8 +49,7 @@
 #include <opensm/osm_mcm_port.h>
 #include <opensm/osm_multicast.h>
 
-osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t *port, IN osm_mgrp_t *mgrp,
-				 IN ib_member_rec_t *mcmr, IN boolean_t proxy)
+osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t *port, IN osm_mgrp_t *mgrp)
 {
 	osm_mcm_port_t *p_mcm;
 
@@ -59,9 +58,6 @@ osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t *port, IN osm_mgrp_t *mgrp,
 		memset(p_mcm, 0, sizeof(*p_mcm));
 		p_mcm->port = port;
 		p_mcm->mgrp = mgrp;
-		p_mcm->port_gid = mcmr->port_gid;
-		p_mcm->scope_state = mcmr->scope_state;
-		p_mcm->proxy_join = proxy;
 	}
 
 	return p_mcm;
@@ -70,5 +66,31 @@ osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t *port, IN osm_mgrp_t *mgrp,
 void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm)
 {
 	CL_ASSERT(p_mcm);
+
 	free(p_mcm);
 }
+
+osm_mcm_alias_guid_t *osm_mcm_alias_guid_new(IN osm_mcm_port_t *p_base_mcm_port,
+					     IN ib_member_rec_t *mcmr,
+					     IN boolean_t proxy)
+{
+	osm_mcm_alias_guid_t *p_mcm_alias_guid;
+
+	p_mcm_alias_guid = calloc(1, sizeof(*p_mcm_alias_guid));
+	if (p_mcm_alias_guid) {
+		p_mcm_alias_guid->alias_guid = mcmr->port_gid.unicast.interface_id;
+		p_mcm_alias_guid->p_base_mcm_port = p_base_mcm_port;
+		p_mcm_alias_guid->port_gid.unicast.prefix = mcmr->port_gid.unicast.prefix;
+		p_mcm_alias_guid->port_gid.unicast.interface_id = mcmr->port_gid.unicast.interface_id;
+		p_mcm_alias_guid->scope_state = mcmr->scope_state;
+		p_mcm_alias_guid->proxy_join = proxy;
+	}
+
+	return p_mcm_alias_guid;
+}
+
+void osm_mcm_alias_guid_delete(IN OUT osm_mcm_alias_guid_t ** pp_mcm_alias_guid)
+{
+	free(*pp_mcm_alias_guid);
+	*pp_mcm_alias_guid = NULL;
+}
opensm/osm_multicast.c +158 -36

303 lines not on this page · raw message

opensm/osm_sa.c +6 -6
index 0142b59..6b033fd 100644
@@ -532,14 +532,14 @@ opensm_dump_to_file(osm_opensm_t * p_osm, const char *file_name,
 static void mcast_mgr_dump_one_port(cl_map_item_t * p_map_item, void *cxt)
 {
 	FILE *file = ((struct opensm_dump_context *)cxt)->file;
-	osm_mcm_port_t *p_mcm_port = (osm_mcm_port_t *) p_map_item;
+	osm_mcm_alias_guid_t *p_mcm_alias_guid = (osm_mcm_alias_guid_t *) p_map_item;
 
 	fprintf(file, "mcm_port: "
 		"port_gid=0x%016" PRIx64 ":0x%016" PRIx64 " "
 		"scope_state=0x%02x proxy_join=0x%x" "\n\n",
-		cl_ntoh64(p_mcm_port->port_gid.unicast.prefix),
-		cl_ntoh64(p_mcm_port->port_gid.unicast.interface_id),
-		p_mcm_port->scope_state, p_mcm_port->proxy_join);
+		cl_ntoh64(p_mcm_alias_guid->port_gid.unicast.prefix),
+		cl_ntoh64(p_mcm_alias_guid->port_gid.unicast.interface_id),
+		p_mcm_alias_guid->scope_state, p_mcm_alias_guid->proxy_join);
 }
 
 static void sa_dump_one_mgrp(osm_mgrp_t *p_mgrp, void *cxt)
@@ -574,7 +574,7 @@ static void sa_dump_one_mgrp(osm_mgrp_t *p_mgrp, void *cxt)
 	dump_context.p_osm = p_osm;
 	dump_context.file = file;
 
-	cl_qmap_apply_func(&p_mgrp->mcm_port_tbl,
+	cl_qmap_apply_func(&p_mgrp->mcm_alias_port_tbl,
 			   mcast_mgr_dump_one_port, &dump_context);
 }
 
@@ -1113,7 +1113,7 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
 			proxy = val;
 
 			guid = mcmr.port_gid.unicast.interface_id;
-			port = osm_get_port_by_guid(&p_osm->subn, guid);
+			port = osm_get_port_by_alias_guid(&p_osm->subn, guid);
 			if (port &&
 			    cl_qmap_get(&p_mgrp->mcm_port_tbl, guid) ==
 			    cl_qmap_end(&p_mgrp->mcm_port_tbl) &&
opensm/osm_sa_mcmember_record.c +39 -35

210 lines not on this page · raw message

opensm/osm_sa_path_record.c +2 -3
index 3ebaa4f..bf0f5e3 100644
@@ -1496,9 +1496,8 @@ static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa,
 
 	/* If SGID and/or SLID specified, should validate as member of MC group */
 	if (comp_mask & IB_PR_COMPMASK_SGID) {
-		port = osm_get_port_by_guid(sa->p_subn,
-					    p_pr->sgid.unicast.interface_id);
-		if (!port || !osm_mgrp_get_mcm_port(p_mgrp, port->guid))
+		if (!osm_mgrp_get_mcm_alias_guid(p_mgrp,
+						 p_pr->sgid.unicast.interface_id))
 			goto Exit;
 	}
 
Signature · 6 lines
1.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html