From patchwork Fri Oct 16 17:35:48 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: 7419751 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 A0EBFBEEA4 for ; Fri, 16 Oct 2015 17:35:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9040D20622 for ; Fri, 16 Oct 2015 17:35:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6771520621 for ; Fri, 16 Oct 2015 17:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754231AbbJPRfv (ORCPT ); Fri, 16 Oct 2015 13:35:51 -0400 Received: from resqmta-ch2-02v.sys.comcast.net ([69.252.207.34]:60961 "EHLO resqmta-ch2-02v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754042AbbJPRfv (ORCPT ); Fri, 16 Oct 2015 13:35:51 -0400 Received: from resomta-ch2-20v.sys.comcast.net ([69.252.207.116]) by resqmta-ch2-02v.sys.comcast.net with comcast id VtaX1r00F2XD5SV01tbptB; Fri, 16 Oct 2015 17:35:49 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-20v.sys.comcast.net with comcast id Vtbo1r00Q1PgSZ601tbpwz; Fri, 16 Oct 2015 17:35:49 +0000 Received: by gentwo.org (Postfix, from userid 1001) id BC2871003; Fri, 16 Oct 2015 12:35:48 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id B9D2DD50; Fri, 16 Oct 2015 12:35:48 -0500 (CDT) Date: Fri, 16 Oct 2015 12:35:48 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Doug Ledford cc: linux-rdma@vger.kernel.org Subject: [PATCH] ipoib mcast sendonly join: Isolate common list remove code Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1445016949; bh=x52N3hsbqiQ4fyJKW6R9CSWaoHhwMvCTRKCGYidob5Y=; h=Received:Received:Received:Received:Date:From:To:Subject: Message-ID:Content-Type; b=Gd5se68UZGgWsBH/fSGzz4fFIRdEOOA6e2QYHFHYiwgjAKpwl5zMc51pcUYlR/N1Z 25cdXZvTGXFt8Gj6At+/YaPaOmLdqmpI2wXxuejKlnPGX9mx6Fw4H+DT9nw98/K7oF vA/efKc13Z3qVX0fTqpthyRGsptpxsUr52s1Pb/UVJzoeU4j3LIBuRJfS87pDXQvQ0 VSnoIR+d0ALeu2pb85uhw5btEnY0kNu9Epb77jE2fHsqTTlO46GyT0B5MZEqkukYB7 vuD/64/D4WPqqA9BMYjpFWFk0dveznQO4Vaz2MgBIyrjAgFzOZT/ssOQa8g84NbQog Ax1ujfqeiVIPQ== 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 From: Christoph Lameter Subject: ipoib mcast sendonly join: Isolate common list remove code Code cleanup to remove multicast specific code from ipoib_main.c The removal of a list of multicast groups occurs in three places. Create a new function ipoib_mcast_remove_list(). Use this new function in ipoib_main.c too. That in turn allows the dropping of two functions that were exported from ipoib_multicast.c for expiration of mc groups. 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.h =================================================================== --- linux.orig/drivers/infiniband/ulp/ipoib/ipoib.h +++ linux/drivers/infiniband/ulp/ipoib/ipoib.h @@ -495,7 +495,6 @@ void ipoib_dev_cleanup(struct net_device void ipoib_mcast_join_task(struct work_struct *work); void ipoib_mcast_carrier_on_task(struct work_struct *work); void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb); -void ipoib_mcast_free(struct ipoib_mcast *mc); void ipoib_mcast_restart_task(struct work_struct *work); int ipoib_mcast_start_thread(struct net_device *dev); @@ -549,7 +548,7 @@ 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); +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); int ipoib_init_qp(struct net_device *dev); Index: linux/drivers/infiniband/ulp/ipoib/ipoib_main.c =================================================================== --- linux.orig/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ linux/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1150,7 +1150,7 @@ static void __ipoib_reap_neigh(struct ip unsigned long flags; int i; LIST_HEAD(remove_list); - struct ipoib_mcast *mcast, *tmcast; + struct ipoib_mcast *mcast; struct net_device *dev = priv->dev; if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags)) @@ -1207,10 +1207,7 @@ 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(dev, mcast); - ipoib_mcast_free(mcast); - } + ipoib_mcast_remove_list(dev, &remove_list); } static void ipoib_reap_neigh(struct work_struct *work) Index: linux/drivers/infiniband/ulp/ipoib/ipoib_multicast.c =================================================================== --- linux.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ linux/drivers/infiniband/ulp/ipoib/ipoib_multicast.c @@ -106,7 +106,7 @@ static void __ipoib_mcast_schedule_join_ queue_delayed_work(priv->wq, &priv->mcast_task, 0); } -void ipoib_mcast_free(struct ipoib_mcast *mcast) +static void ipoib_mcast_free(struct ipoib_mcast *mcast) { struct net_device *dev = mcast->dev; int tx_dropped = 0; @@ -677,7 +677,7 @@ int ipoib_mcast_stop_thread(struct net_d return 0; } -int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) +static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) { struct ipoib_dev_priv *priv = netdev_priv(dev); int ret = 0; @@ -704,6 +704,16 @@ int ipoib_mcast_leave(struct net_device return 0; } +void ipoib_mcast_remove_list(struct net_device *dev, struct list_head *remove_list) +{ + struct ipoib_mcast *mcast, *tmcast; + + list_for_each_entry_safe(mcast, tmcast, remove_list, list) { + ipoib_mcast_leave(dev, mcast); + ipoib_mcast_free(mcast); + } +} + void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb) { struct ipoib_dev_priv *priv = netdev_priv(dev); @@ -810,10 +820,7 @@ void ipoib_mcast_dev_flush(struct net_de if (test_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags)) wait_for_completion(&mcast->done); - list_for_each_entry_safe(mcast, tmcast, &remove_list, list) { - ipoib_mcast_leave(dev, mcast); - ipoib_mcast_free(mcast); - } + ipoib_mcast_remove_list(dev, &remove_list); } static int ipoib_mcast_addr_is_valid(const u8 *addr, const u8 *broadcast) @@ -939,10 +946,7 @@ void ipoib_mcast_restart_task(struct wor if (test_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags)) wait_for_completion(&mcast->done); - list_for_each_entry_safe(mcast, tmcast, &remove_list, list) { - ipoib_mcast_leave(mcast->dev, mcast); - ipoib_mcast_free(mcast); - } + ipoib_mcast_remove_list(mcast->dev, &remove_list); /* * Double check that we are still up