From patchwork Thu Sep 17 14:42:02 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: 7208061 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6350FBEEC1 for ; Thu, 17 Sep 2015 14:42:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4CAED207B1 for ; Thu, 17 Sep 2015 14:42:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35D3D207A4 for ; Thu, 17 Sep 2015 14:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751339AbbIQOmG (ORCPT ); Thu, 17 Sep 2015 10:42:06 -0400 Received: from resqmta-ch2-12v.sys.comcast.net ([69.252.207.44]:40473 "EHLO resqmta-ch2-12v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbbIQOmG (ORCPT ); Thu, 17 Sep 2015 10:42:06 -0400 Received: from resomta-ch2-06v.sys.comcast.net ([69.252.207.102]) by resqmta-ch2-12v.sys.comcast.net with comcast id JEgb1r0052D5gil01Ei3gG; Thu, 17 Sep 2015 14:42:03 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-06v.sys.comcast.net with comcast id JEi21r00g1PgSZ601Ei3Ew; Thu, 17 Sep 2015 14:42:03 +0000 Received: by gentwo.org (Postfix, from userid 1001) id D93E11847; Thu, 17 Sep 2015 09:42:02 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id D786817F4; Thu, 17 Sep 2015 09:42:02 -0500 (CDT) Date: Thu, 17 Sep 2015 09:42:02 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Or Gerlitz cc: Doug Ledford , linux-rdma@vger.kernel.org Subject: Re: [PATCH rdma-rc 0/2] Add mechanism for ipoib neigh state change notifications In-Reply-To: <1442486283-9699-1-git-send-email-ogerlitz@mellanox.com> Message-ID: References: <1442486283-9699-1-git-send-email-ogerlitz@mellanox.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1442500923; bh=tC6VNYw/ITkESd49uYUclKg793BtV7fkd2oU9uTTMNU=; h=Received:Received:Received:Received:Date:From:To:Subject: Message-ID:Content-Type; b=cvqUd2NOLnucZNXZDMhJU44CNbE3ej1wKZOTtbdXBuqwTKHF3r+XmdRfBmBlFJFtA 5VE8yZcxnigTYHIg9PyEbqR8wNuosWQVP095o2qB4fTvDk1nSAvs9ye6gVLBJcIi5d a686eLxKTPeGlTJ7JALx+0wVo/HCpwJuxAyC3yJ4edwMCQPhGosTjcyMNcTXFHcq2+ TmKNoJv5FvAyfQOTZSuzFWBL2KvItQrhBbPPZqkaDbmnZdQTpeQhLnHxeqGXfEJuqk UESX2aiorE1RA+DSpYUIjJnL6WyqcR+/If41bl93MS8qH4KEqwXlOmwj4I/vkLfJM7 cuId1ohBqVNSA== 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 Could we simplify it a bit. This compiles but avoids all the generalizations and workqueues. Had to export two new functions from ipoib_multicast.c though. Subject: ipoib: Expire sendonly multicast joins on neighbor expiration Add mcast_leave functionality to __ipoib_reap_neighbor. Based on Erez work. Signed-off-by: Christoph Lameter --- 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 Index: linux/drivers/infiniband/ulp/ipoib/ipoib_main.c =================================================================== --- linux.orig/drivers/infiniband/ulp/ipoib/ipoib_main.c 2015-09-09 13:14:03.412350354 -0500 +++ linux/drivers/infiniband/ulp/ipoib/ipoib_main.c 2015-09-17 09:34:03.169844055 -0500 @@ -1149,6 +1149,8 @@ static void __ipoib_reap_neigh(struct ip unsigned long dt; unsigned long flags; int i; + LIST_HEAD(remove_list); + struct ipoib_mcast *mcast, *tmcast; if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags)) return; @@ -1176,6 +1178,18 @@ static void __ipoib_reap_neigh(struct ip lockdep_is_held(&priv->lock))) != NULL) { /* was the neigh idle for two GC periods */ if (time_after(neigh_obsolete, neigh->alive)) { + + /* Is this multicast ? */ + if (neigh->daddr[4] == 0xff) { + mcast = __ipoib_mcast_find(priv->dev, neigh->daddr + 4); + + 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); + } + } + rcu_assign_pointer(*np, rcu_dereference_protected(neigh->hnext, lockdep_is_held(&priv->lock))); @@ -1191,6 +1205,8 @@ static void __ipoib_reap_neigh(struct ip out_unlock: spin_unlock_irqrestore(&priv->lock, flags); + list_for_each_entry_safe(mcast, tmcast, &remove_list, list) + ipoib_mcast_leave(priv->dev, mcast); } static void ipoib_reap_neigh(struct work_struct *work) Index: linux/drivers/infiniband/ulp/ipoib/ipoib.h =================================================================== --- linux.orig/drivers/infiniband/ulp/ipoib/ipoib.h 2015-09-09 13:14:03.412350354 -0500 +++ linux/drivers/infiniband/ulp/ipoib/ipoib.h 2015-09-17 09:36:17.342455845 -0500 @@ -548,6 +548,8 @@ void ipoib_path_iter_read(struct ipoib_p int ipoib_mcast_attach(struct net_device *dev, u16 mlid, union ib_gid *mgid, int set_qkey); +int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast); +struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid); int ipoib_init_qp(struct net_device *dev); int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca); Index: linux/drivers/infiniband/ulp/ipoib/ipoib_multicast.c =================================================================== --- linux.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c 2015-09-09 13:14:03.412350354 -0500 +++ linux/drivers/infiniband/ulp/ipoib/ipoib_multicast.c 2015-09-17 09:36:55.305497262 -0500 @@ -153,7 +153,7 @@ static struct ipoib_mcast *ipoib_mcast_a return mcast; } -static struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid) +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; @@ -675,7 +675,7 @@ int ipoib_mcast_stop_thread(struct net_d return 0; } -static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) +int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) { struct ipoib_dev_priv *priv = netdev_priv(dev); int ret = 0;