From patchwork Fri Dec 11 18:16:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Christoph Lameter (Ampere)" X-Patchwork-Id: 7831851 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EB2689FC45 for ; Fri, 11 Dec 2015 18:17:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F13FB202AE for ; Fri, 11 Dec 2015 18:17:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3FFD2054B for ; Fri, 11 Dec 2015 18:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751223AbbLKSR2 (ORCPT ); Fri, 11 Dec 2015 13:17:28 -0500 Received: from resqmta-ch2-07v.sys.comcast.net ([69.252.207.39]:51878 "EHLO resqmta-ch2-07v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818AbbLKSR0 (ORCPT ); Fri, 11 Dec 2015 13:17:26 -0500 Received: from resomta-ch2-12v.sys.comcast.net ([69.252.207.108]) by resqmta-ch2-07v.sys.comcast.net with comcast id sJHN1r0032LrikM01JHSnL; Fri, 11 Dec 2015 18:17:26 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-12v.sys.comcast.net with comcast id sJHR1r00U1PgSZ601JHRfX; Fri, 11 Dec 2015 18:17:26 +0000 Received: by gentwo.org (Postfix, from userid 1001) id 5DAF1170D; Fri, 11 Dec 2015 12:17:24 -0600 (CST) Message-Id: <20151211181724.290844844@linux.com> Date: Fri, 11 Dec 2015 12:16:54 -0600 From: Christoph Lameter To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Cc: Erez Shitrit Subject: [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c. References: <20151211181652.187735744@linux.com> Content-Disposition: inline; filename=0002-ipoib-mcast-sendonly-join-Move-multicast-specific-co.patch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1449857846; bh=P2k7tBvQBbXwfNRAel7Eh3C3jHqeLgifrP6BjrJM1dg=; h=Received:Received:Received:Message-Id:Date:From:To:Subject: Content-Type; b=lNPWrZDm2zSe5y1OJmDnnKaRnWPp8r4bmi5Guw65EfP9i9FaBJ2JgCNPYi0h0HXLO wnQajsvwBX6UaE8sb5IiGoc5C6NFmsMnNtbbERyKNSfhIDzR+f/FM9viCy4yJhpS1u r7UDW3xERuVoOD8/oDfn/0RWtjM52fD5dY3sF/Fm8iYvoDn2hxEJU0fGpoWdmrgM8L ZNeku9V5IBoVmgH2YjKY3CqgWI2sX0wlqwEbMFrghc+Kwz8znHfJSKhS4Ma/nJir+S nLPnz/2FKtR2h0R9k9ihHZH6I5eVmIGQRKuLYSXN8xes7R5v+hJedld8CMMnaCkdm+ NfpMuSBiwp55g== Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_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 Code cleanup to move multicast specific code that checks for a sendonly join to ipoib_multicast.c. This allows the removal of the export of __ipoib_mcast_find(). Signed-off-by: Christoph Lameter --- drivers/infiniband/ulp/ipoib/ipoib.h | 3 ++- drivers/infiniband/ulp/ipoib/ipoib_main.c | 13 +------------ drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 21 ++++++++++++++++++++- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 989c409..a13f48c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h @@ -549,7 +549,8 @@ void ipoib_path_iter_read(struct ipoib_path_iter *iter, int ipoib_mcast_attach(struct net_device *dev, u16 mlid, union ib_gid *mgid, int set_qkey); void ipoib_mcast_remove_list(struct net_device *dev, struct list_head *remove_list); -struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid); +void ipoib_check_mcast_sendonly(struct ipoib_dev_priv *priv, u8 *mgid, + struct list_head *remove_list); int ipoib_init_qp(struct net_device *dev); int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca); diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 483ff20..6b16428 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1150,7 +1150,6 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) unsigned long flags; int i; LIST_HEAD(remove_list); - struct ipoib_mcast *mcast; struct net_device *dev = priv->dev; if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags)) @@ -1179,18 +1178,8 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) lockdep_is_held(&priv->lock))) != NULL) { /* was the neigh idle for two GC periods */ if (time_after(neigh_obsolete, neigh->alive)) { - u8 *mgid = neigh->daddr + 4; - /* Is this multicast ? */ - if (*mgid == 0xff) { - mcast = __ipoib_mcast_find(dev, mgid); - - if (mcast && test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) { - list_del(&mcast->list); - rb_erase(&mcast->rb_node, &priv->multicast_tree); - list_add_tail(&mcast->list, &remove_list); - } - } + ipoib_check_mcast_sendonly(priv, neigh->daddr + 4, &remove_list); rcu_assign_pointer(*np, rcu_dereference_protected(neigh->hnext, diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 8acb420a..1158819 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c @@ -153,7 +153,7 @@ static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev, return mcast; } -struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid) +static struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid) { struct ipoib_dev_priv *priv = netdev_priv(dev); struct rb_node *n = priv->multicast_tree.rb_node; @@ -704,6 +704,25 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) return 0; } +/* + * Check if the multicast group is sendonly. If so remove it from the maps + * and add to the remove list + */ +void ipoib_check_mcast_sendonly(struct ipoib_dev_priv *priv, u8 *mgid, + struct list_head *remove_list) +{ + /* Is this multicast ? */ + if (*mgid == 0xff) { + struct ipoib_mcast *mcast = __ipoib_mcast_find(priv->dev, mgid); + + if (mcast && test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) { + list_del(&mcast->list); + rb_erase(&mcast->rb_node, &priv->multicast_tree); + list_add_tail(&mcast->list, remove_list); + } + } +} + void ipoib_mcast_remove_list(struct net_device *dev, struct list_head *remove_list) { struct ipoib_mcast *mcast, *tmcast;