From patchwork Mon Dec 21 14:42: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: 7896251 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 2E7A89F349 for ; Mon, 21 Dec 2015 14:43:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3182C2056D for ; Mon, 21 Dec 2015 14:43:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 37E202055C for ; Mon, 21 Dec 2015 14:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751304AbbLUOnI (ORCPT ); Mon, 21 Dec 2015 09:43:08 -0500 Received: from resqmta-ch2-10v.sys.comcast.net ([69.252.207.42]:42136 "EHLO resqmta-ch2-10v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbbLUOnG (ORCPT ); Mon, 21 Dec 2015 09:43:06 -0500 Received: from resomta-ch2-19v.sys.comcast.net ([69.252.207.115]) by resqmta-ch2-10v.sys.comcast.net with comcast id wEht1r0022VvR6D01Ej5W2; Mon, 21 Dec 2015 14:43:05 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-19v.sys.comcast.net with comcast id wEj51r0011PgSZ601Ej5kM; Mon, 21 Dec 2015 14:43:05 +0000 Received: by gentwo.org (Postfix, from userid 1001) id 852B92216; Mon, 21 Dec 2015 08:43:03 -0600 (CST) Message-Id: <20151221144303.455957565@linux.com> Date: Mon, 21 Dec 2015 08:42:54 -0600 From: Christoph Lameter To: dledford@redhat.com Cc: ira.weiny@intel.com Cc: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Cc: Erez Shitrit Subject: [PATCH 2/2] Move multicast specific code out of ipoib_main.c References: <20151221144252.575119561@linux.com> Content-Disposition: inline; filename=0002-Move-multicast-specific-code-out-of-ipoib_main.c.patch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1450708985; bh=sWyfME/csywClk/fadzsMVPHoyr8b92PKk3asnf9Uts=; h=Received:Received:Received:Message-Id:Date:From:To:Subject: Content-Type; b=msK7fd1tTr237HjmXVOmnBBeVK2+c/aUnZsTT2foTC2jpOfIV+0CY7iQ5cB7fbZWc +my9S5HVPl8ZR75AOOBObD1nxsp4zgODbE5pY/dvgpT7m0s7V7x0QucZym5f7Dh1Eo 3chFPn3BkBiddTORY042uLEUp7qsZUFjOoqnfVK8KHAC+KQGdk2GoyWDqsTxhDqN4Q CfIw+WFPK/IMf4wbu6ZiAtq1HocodGRq67r1uvTpIdZfSCWqnVqEavgE9HAbFyAKTn bLt0T2WeIm8QI8IUTBZR7b1+REPQZTeDShiKixq+V9IEGKXXY8toM5zGL3ZOr9ccf+ LlP9OgkncSIbA== 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,RP_MATCHES_RCVD,T_DKIM_INVALID,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 V1->V2: - Rename function as requested by Ira 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..a924933 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_and_add_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..620d9ca 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_and_add_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..ab79b87 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_and_add_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;