From patchwork Thu Jun 5 16:29:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Estrin, Alex" X-Patchwork-Id: 4307221 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B938E9F1D6 for ; Thu, 5 Jun 2014 16:30:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D6F74201EC for ; Thu, 5 Jun 2014 16:30:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DBE39201D5 for ; Thu, 5 Jun 2014 16:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751251AbaFEQax (ORCPT ); Thu, 5 Jun 2014 12:30:53 -0400 Received: from mga14.intel.com ([192.55.52.115]:35664 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751118AbaFEQax (ORCPT ); Thu, 5 Jun 2014 12:30:53 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 05 Jun 2014 09:25:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,981,1392192000"; d="scan'208";a="542998178" Received: from sedona.ch.intel.com ([143.182.228.65]) by fmsmga001.fm.intel.com with ESMTP; 05 Jun 2014 09:29:34 -0700 Received: from phlsvlogin03.ph.intel.com (phlsvlogin03.ph.intel.com [10.228.195.69]) by sedona.ch.intel.com (8.13.6/8.14.3/Standard MailSET/Hub) with ESMTP id s55GTYvb022031; Thu, 5 Jun 2014 09:29:34 -0700 Received: from phlsvlogin03.ph.intel.com (localhost [127.0.0.1]) by phlsvlogin03.ph.intel.com with ESMTP id s55GTXtw007526; Thu, 5 Jun 2014 12:29:33 -0400 Subject: [PATCH 1/1] IPoOB: Improve parent interface p_key handling. To: Roland Dreier From: Alex Estrin Cc: linux-rdma@vger.kernel.org, Ira Weiny Date: Thu, 05 Jun 2014 12:29:33 -0400 Message-ID: <20140605162933.7504.94163.stgit@phlsvlogin03.ph.intel.com> User-Agent: StGit/0.16 MIME-Version: 1.0 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 With reference to commit c2904141696ee19551f1553944446f23cdd5d95e. It was noticed that parent interface keeps sending broadcast group join requests if p_key index 0 is invalid. That creates unnecessary noise on a fabric: ib0: multicast join failed for ff12:401b:8000:0000:0000:0000:ffff:ffff, status -22 Proposed patch re-init resources, then brings interface up only if p_key idx 0 is valid either on bootup or on PKEY_CHANGE event. Otherwise it keeps interface quiet. Reviewed-by: Ira Weiny Signed-off-by: Alex Estrin --- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) -- 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/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 6a7003d..3201fe5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -669,6 +669,12 @@ int ipoib_ib_dev_open(struct net_device *dev) struct ipoib_dev_priv *priv = netdev_priv(dev); int ret; + if (!(priv->pkey & 0x7fff)) { + ipoib_warn(priv, "Invalid P_Key\n"); + clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); + return -1; + } + if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &priv->pkey_index)) { ipoib_warn(priv, "P_Key 0x%04x not found\n", priv->pkey); clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); @@ -714,7 +720,8 @@ static void ipoib_pkey_dev_check_presence(struct net_device *dev) struct ipoib_dev_priv *priv = netdev_priv(dev); u16 pkey_index = 0; - if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &pkey_index)) + if (!(priv->pkey & 0x7fff) || + ib_find_pkey(priv->ca, priv->port, priv->pkey, &pkey_index)) clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); else set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); @@ -987,12 +994,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, up_read(&priv->vlan_rwsem); if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) { - /* for non-child devices must check/update the pkey value here */ - if (level == IPOIB_FLUSH_HEAVY && - !test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) - update_parent_pkey(priv); - ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); - return; + if (level < IPOIB_FLUSH_HEAVY) { + ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); + return; + } } if (!test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) { @@ -1038,8 +1043,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, ipoib_ib_dev_down(dev, 0); if (level == IPOIB_FLUSH_HEAVY) { - ipoib_ib_dev_stop(dev, 0); - ipoib_ib_dev_open(dev); + if (test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) + ipoib_ib_dev_stop(dev, 0); + if (ipoib_ib_dev_open(dev) != 0) + return; } /*