All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Eli Dorfman (Voltaire)" <dorfman.eli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
Cc: linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Vladimir Koushnir
	<vladimirk-smomgflXvOZWk0Htik3J/w@public.gmane.org>
Subject: [PATCH] Delete port only after GID OUT trap was sent
Date: Thu, 04 Feb 2010 20:12:20 +0200	[thread overview]
Message-ID: <4B6B0E04.808@gmail.com> (raw)

Send GID OUT trap first and only then remove the port.
This is done to allow SM check that subscriber and trap source
are permitted to access each other.

Signed-off-by: Eli Dorfman <elid-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 opensm/opensm/osm_drop_mgr.c |   56 ++++++++++++++++++++---------------------
 1 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/opensm/opensm/osm_drop_mgr.c b/opensm/opensm/osm_drop_mgr.c
index 879e21f..111582e 100644
--- a/opensm/opensm/osm_drop_mgr.c
+++ b/opensm/opensm/osm_drop_mgr.c
@@ -180,6 +180,33 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 		goto Exit;
 	}
 
+	/* issue a notice - trap 65 */
+	/* details of the notice */
+	notice.generic_type = 0x83;	/* is generic subn mgt type */
+	ib_notice_set_prod_type_ho(&notice, 4);	/* A class manager generator */
+	/* endport ceases to be reachable */
+	notice.g_or_v.generic.trap_num = CL_HTON16(65);
+	/* The sm_base_lid is saved in network order already. */
+	notice.issuer_lid = sm->p_subn->sm_base_lid;
+	/* following C14-72.1.2 and table 119 p725 */
+	/* we need to provide the GID */
+	port_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
+	port_gid.unicast.interface_id = port_guid;
+	memcpy(&(notice.data_details.ntc_64_67.gid),
+	       &(port_gid), sizeof(ib_gid_t));
+
+	/* According to page 653 - the issuer gid in this case of trap
+	   is the SM gid, since the SM is the initiator of this trap. */
+	notice.issuer_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
+	notice.issuer_gid.unicast.interface_id = sm->p_subn->sm_port_guid;
+
+	status = osm_report_notice(sm->p_log, sm->p_subn, &notice);
+	if (status != IB_SUCCESS) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0103: "
+			"Error sending trap reports (%s)\n",
+			ib_get_err_str(status));
+	}
+
 	p_sm_guid_tbl = &sm->p_subn->sm_guid_tbl;
 	p_sm = (osm_remote_sm_t *) cl_qmap_remove(p_sm_guid_tbl, port_guid);
 	if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_guid_tbl)) {
@@ -217,35 +244,6 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 
 	osm_port_delete(&p_port);
 
-	/* issue a notice - trap 65 */
-
-	/* details of the notice */
-	notice.generic_type = 0x83;	/* is generic subn mgt type */
-	ib_notice_set_prod_type_ho(&notice, 4);	/* A class manager generator */
-	/* endport ceases to be reachable */
-	notice.g_or_v.generic.trap_num = CL_HTON16(65);
-	/* The sm_base_lid is saved in network order already. */
-	notice.issuer_lid = sm->p_subn->sm_base_lid;
-	/* following C14-72.1.2 and table 119 p725 */
-	/* we need to provide the GID */
-	port_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
-	port_gid.unicast.interface_id = port_guid;
-	memcpy(&(notice.data_details.ntc_64_67.gid),
-	       &(port_gid), sizeof(ib_gid_t));
-
-	/* According to page 653 - the issuer gid in this case of trap
-	   is the SM gid, since the SM is the initiator of this trap. */
-	notice.issuer_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
-	notice.issuer_gid.unicast.interface_id = sm->p_subn->sm_port_guid;
-
-	status = osm_report_notice(sm->p_log, sm->p_subn, &notice);
-	if (status != IB_SUCCESS) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0103: "
-			"Error sending trap reports (%s)\n",
-			ib_get_err_str(status));
-		goto Exit;
-	}
-
 	OSM_LOG(sm->p_log, OSM_LOG_INFO,
 		"Removed port with GUID:0x%016" PRIx64
 		" LID range [%u, %u] of node:%s\n",
-- 
1.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2010-02-04 18:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04 18:12 Eli Dorfman (Voltaire) [this message]
     [not found] ` <4B6B0E04.808-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-02-11 15:58   ` [PATCH] Delete port only after GID OUT trap was sent Sasha Khapyorsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B6B0E04.808@gmail.com \
    --to=dorfman.eli-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org \
    --cc=vladimirk-smomgflXvOZWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.