From patchwork Thu Sep 24 17:00:05 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: 7258271 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 2FD2BBEEC1 for ; Thu, 24 Sep 2015 17:00:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 338C420888 for ; Thu, 24 Sep 2015 17:00:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 305B020887 for ; Thu, 24 Sep 2015 17:00:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756040AbbIXRAI (ORCPT ); Thu, 24 Sep 2015 13:00:08 -0400 Received: from resqmta-ch2-07v.sys.comcast.net ([69.252.207.39]:52962 "EHLO resqmta-ch2-07v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754239AbbIXRAH (ORCPT ); Thu, 24 Sep 2015 13:00:07 -0400 Received: from resomta-ch2-20v.sys.comcast.net ([69.252.207.116]) by resqmta-ch2-07v.sys.comcast.net with comcast id M4y11r0092XD5SV01505kR; Thu, 24 Sep 2015 17:00:05 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-20v.sys.comcast.net with comcast id M5051r00H1PgSZ601505zj; Thu, 24 Sep 2015 17:00:05 +0000 Received: by gentwo.org (Postfix, from userid 1001) id 358DBA8C4; Thu, 24 Sep 2015 12:00:05 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 33C5C9E27; Thu, 24 Sep 2015 12:00:05 -0500 (CDT) Date: Thu, 24 Sep 2015 12:00:05 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Or Gerlitz cc: Or Gerlitz , Doug Ledford , "linux-rdma@vger.kernel.org" Subject: [PATCH] Expire sendonly joins (was Re: [PATCH rdma-rc 0/2] Add mechanism for ipoib neigh state change notifications) In-Reply-To: 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=1443114005; bh=fy1CteS6LwNDX2DZ7BGxkTtb8+m+ZHwijqQ3QCwr26s=; h=Received:Received:Received:Received:Date:From:To:Subject: Message-ID:Content-Type; b=ORBvGW/s5tl//MEODZ2B8iTryWTVh2LnR/OWr+N3dlWs0HJrrayfY+n2gyutpZ2Wa bWOffqCWG1LDRAdz+clizKj+OT1jzTJ2pBCKU0uzSdV4SdDvAxcnySFvVNN2xjEwaa CsuJi3oNl879m+ERwkfgQifEL00XvPjVgbJCLKm87jCa4u3jWzKO0U85J/l9DJGqoU rWMA7Gxk7rLyAOoNRI1jbbpjzj+RW9hAPoCcH3MFyk2jqOrUsUmj4762Pw7I3tCShH 1AW+49m4lKPbOtfSWIhVKwPNYXpCl4phRC6KZTUmI51juTkdVjIVfQpHz+7pFUgBoA ixguCoW2/Z8og== 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 Ok here is the fixed up and tested V2 of the patch. Can this go in with Doug's patch? Subject: ipoib: Expire sendonly multicast joins on neighbor expiration V2 Add mcast_leave functionality to __ipoib_reap_neighbor. 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-23 09:51:19.259274231 -0500 +++ linux/drivers/infiniband/ulp/ipoib/ipoib_main.c 2015-09-23 09:59:59.803289023 -0500 @@ -1149,6 +1149,9 @@ unsigned long dt; unsigned long flags; int i; + LIST_HEAD(remove_list); + struct ipoib_mcast *mcast, *tmcast; + struct net_device *dev = priv->dev; if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags)) return; @@ -1176,6 +1179,19 @@ 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); + } + } + rcu_assign_pointer(*np, rcu_dereference_protected(neigh->hnext, lockdep_is_held(&priv->lock))); @@ -1191,6 +1207,8 @@ out_unlock: spin_unlock_irqrestore(&priv->lock, flags); + list_for_each_entry_safe(mcast, tmcast, &remove_list, list) + ipoib_mcast_leave(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-23 09:51:19.259274231 -0500 +++ linux/drivers/infiniband/ulp/ipoib/ipoib.h 2015-09-23 09:51:19.255274231 -0500 @@ -548,6 +548,8 @@ 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-23 09:51:19.259274231 -0500 +++ linux/drivers/infiniband/ulp/ipoib/ipoib_multicast.c 2015-09-23 09:51:19.255274231 -0500 @@ -158,7 +158,7 @@ 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; @@ -705,7 +705,7 @@ 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;