From patchwork Tue Sep 10 10:50:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Line Holen X-Patchwork-Id: 2865191 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4154ABF43F for ; Tue, 10 Sep 2013 10:50:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 064922031C for ; Tue, 10 Sep 2013 10:50:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DB80202FF for ; Tue, 10 Sep 2013 10:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751090Ab3IJKuR (ORCPT ); Tue, 10 Sep 2013 06:50:17 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:24994 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011Ab3IJKuQ convert rfc822-to-8bit (ORCPT ); Tue, 10 Sep 2013 06:50:16 -0400 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r8AAoDrx022237 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 10 Sep 2013 10:50:14 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8AAoCQi016284 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Sep 2013 10:50:13 GMT Received: from abhmt114.oracle.com (abhmt114.oracle.com [141.146.116.66]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8AAoCBI016269; Tue, 10 Sep 2013 10:50:12 GMT MIME-Version: 1.0 Message-ID: Date: Tue, 10 Sep 2013 03:50:12 -0700 (PDT) From: Line Holen To: Hal Cc: Linux-Rdma Subject: [PATCH v2] opensm: Clean up event subscriptions if a port goes away X-Mailer: Zimbra on Oracle Beehive Content-Disposition: inline X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Event subscriptions needs to be cleaned up if a port goes away. If the port comes online again later it may no longer want to receive the events on the same QPN. If the "old" QPN is used for something else the SM forwarding events may cause QKey violations. This behavior is made configurable and it needs to be explicitly enabled (default is off). Signed-off-by: Line Holen --- -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/opensm/osm_inform.h b/include/opensm/osm_inform.h index f737441..8cefc20 100644 --- a/include/opensm/osm_inform.h +++ b/include/opensm/osm_inform.h @@ -2,6 +2,7 @@ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2013 Oracle and/or its affiliates. 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 @@ -200,6 +201,35 @@ void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log, void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log, IN osm_infr_t * p_infr); +/****f* OpenSM: Inform Record/osm_infr_remove_subscriptions +* NAME +* osm_infr_remove_subscriptions +* +* DESCRIPTION +* Remove all event subscriptions of a port +* +* SYNOPSIS +*/ +ib_api_status_t +osm_infr_remove_subscriptions(IN osm_subn_t * p_subn, IN osm_log_t * p_log, + IN ib_net64_t port_guid); +/* +* PARAMETERS +* p_subn +* [in] Pointer to the subnet object +* +* p_log +* [in] Pointer to the log object +* +* port_guid +* [in] PortGUID of the subscriber that should be removed +* +* RETURN +* CL_SUCCESS if port_guid had any subscriptions being removed +* CL_NOT_FOUND if port_guid did not have any active subscriptions +* SEE ALSO +*********/ + /****f* OpenSM: Inform Record/osm_report_notice * NAME * osm_report_notice diff --git a/include/opensm/osm_subnet.h b/include/opensm/osm_subnet.h index 463ffea..19f2079 100644 --- a/include/opensm/osm_subnet.h +++ b/include/opensm/osm_subnet.h @@ -5,6 +5,7 @@ * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. + * Copyright (c) 2013 Oracle and/or its affiliates. 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 @@ -325,6 +326,7 @@ typedef struct osm_subn_opt { boolean_t daemon; boolean_t sm_inactive; boolean_t babbling_port_policy; + boolean_t drop_event_subscriptions; boolean_t use_optimized_slvl; osm_qos_options_t qos_options; osm_qos_options_t qos_ca_options; @@ -595,6 +597,9 @@ typedef struct osm_subn_opt { * babbling_port_policy * OpenSM will enforce its "babbling" port policy. * +* drop_event_subscriptions +* OpenSM will drop event subscriptions if the port goes away. +* * use_optimized_slvl * Use optimized SLtoVLMappingTable programming if * device indicates it supports this. diff --git a/opensm/osm_drop_mgr.c b/opensm/osm_drop_mgr.c index b309273..4276fe9 100644 --- a/opensm/osm_drop_mgr.c +++ b/opensm/osm_drop_mgr.c @@ -3,6 +3,7 @@ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. + * Copyright (c) 2013 Oracle and/or its affiliates. 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 @@ -276,6 +277,15 @@ 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); + /* Delete event forwarding subscriptions */ + if (sm->p_subn->opt.drop_event_subscriptions) { + if (osm_infr_remove_subscriptions(sm->p_subn, sm->p_log, port_guid) + == CL_SUCCESS) + OSM_LOG(sm->p_log, OSM_LOG_DEBUG, + "Removed event subscriptions for port 0x%016" PRIx64 "\n", + cl_ntoh64(port_guid)); + } + /* initialize the p_node - may need to get node_desc later */ p_node = p_port->p_node; diff --git a/opensm/osm_inform.c b/opensm/osm_inform.c index 804c414..716a124 100644 --- a/opensm/osm_inform.c +++ b/opensm/osm_inform.c @@ -282,6 +282,37 @@ void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log, OSM_LOG_EXIT(p_log); } +ib_api_status_t osm_infr_remove_subscriptions(IN osm_subn_t * p_subn, + IN osm_log_t * p_log, + IN ib_net64_t port_guid) +{ + cl_list_item_t *p_list_item; + osm_infr_t *p_infr; + ib_api_status_t status = CL_NOT_FOUND; + + OSM_LOG_ENTER(p_log); + + /* go over all inform info available at the subnet */ + /* match to the given GID and delete subscriptions if match */ + p_list_item = cl_qlist_head(&p_subn->sa_infr_list); + while (p_list_item != cl_qlist_end(&p_subn->sa_infr_list)) { + + p_infr = (osm_infr_t *)p_list_item; + p_list_item = cl_qlist_next(p_list_item); + + if (port_guid != p_infr->inform_record.subscriber_gid.unicast.interface_id) + continue; + + /* Remove this event subscription */ + osm_infr_remove_from_db(p_subn, p_log, p_infr); + + status = CL_SUCCESS; + } + + OSM_LOG_EXIT(p_log); + return (status); +} + /********************************************************************** * Send a report: * Given a target address to send to and the notice. diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c index 0ad8ed6..9fc670b 100644 --- a/opensm/osm_subnet.c +++ b/opensm/osm_subnet.c @@ -776,6 +776,7 @@ static const opt_rec_t opt_tbl[] = { { "daemon", OPT_OFFSET(daemon), opts_parse_boolean, NULL, 0 }, { "sm_inactive", OPT_OFFSET(sm_inactive), opts_parse_boolean, NULL, 1 }, { "babbling_port_policy", OPT_OFFSET(babbling_port_policy), opts_parse_boolean, NULL, 1 }, + { "drop_event_subscriptions", OPT_OFFSET(drop_event_subscriptions), opts_parse_boolean, NULL, 1 }, { "use_optimized_slvl", OPT_OFFSET(use_optimized_slvl), opts_parse_boolean, NULL, 1 }, #ifdef ENABLE_OSM_PERF_MGR { "perfmgr", OPT_OFFSET(perfmgr), opts_parse_boolean, NULL, 0 }, @@ -1480,6 +1481,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt) p_opt->daemon = FALSE; p_opt->sm_inactive = FALSE; p_opt->babbling_port_policy = FALSE; + p_opt->drop_event_subscriptions = FALSE; p_opt->use_optimized_slvl = FALSE; #ifdef ENABLE_OSM_PERF_MGR p_opt->perfmgr = FALSE; @@ -2533,11 +2535,14 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts) "sm_inactive %s\n\n" "# Babbling Port Policy\n" "babbling_port_policy %s\n\n" + "# Drop event subscriptions if the port goes away\n" + "drop_event_subscriptions %s\n\n" "# Use Optimized SLtoVLMapping programming if supported by device\n" "use_optimized_slvl %s\n\n", p_opts->daemon ? "TRUE" : "FALSE", p_opts->sm_inactive ? "TRUE" : "FALSE", p_opts->babbling_port_policy ? "TRUE" : "FALSE", + p_opts->drop_event_subscriptions ? "TRUE" : "FALSE", p_opts->use_optimized_slvl ? "TRUE" : "FALSE"); #ifdef ENABLE_OSM_PERF_MGR