All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] IB multicast cleanup patches
@ 2015-12-11 18:16 Christoph Lameter
  2015-12-11 18:16 ` [PATCH 1/2] ipoib mcast sendonly join: Isolate common list remove code Christoph Lameter
  2015-12-11 18:16 ` [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c Christoph Lameter
  0 siblings, 2 replies; 9+ messages in thread
From: Christoph Lameter @ 2015-12-11 18:16 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe, Erez Shitrit

This patchset cleans up the code a bit after the last round of multicast
patches related to the sendonly join logic. Some of the bits of code
landed in ipoib_main.c instead of ipoib_multicast.c.

- Move the multicast bits into that file so that everything is neatly together
- Reduce the number of functions exported from ipoib_multicast.c

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] ipoib mcast sendonly join: Isolate common list remove code
  2015-12-11 18:16 [PATCH 0/2] IB multicast cleanup patches Christoph Lameter
@ 2015-12-11 18:16 ` Christoph Lameter
       [not found]   ` <20151211181724.185428150-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
  2015-12-11 18:16 ` [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c Christoph Lameter
  1 sibling, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2015-12-11 18:16 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe, Erez Shitrit

[-- Attachment #1: 0001-ipoib-mcast-sendonly-join-Isolate-common-list-remove.patch --]
[-- Type: text/plain, Size: 5131 bytes --]

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 <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/ulp/ipoib/ipoib.h           |  3 +--
 drivers/infiniband/ulp/ipoib/ipoib_main.c      |  7 ++-----
 drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 24 ++++++++++++++----------
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 3ede103..989c409 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -495,7 +495,6 @@ void ipoib_dev_cleanup(struct net_device *dev);
 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_path_iter *iter,
 
 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);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 7d32818..483ff20 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1150,7 +1150,7 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
 	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 ipoib_dev_priv *priv)
 
 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)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index f357ca6..8acb420a 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -106,7 +106,7 @@ static void __ipoib_mcast_schedule_join_thread(struct ipoib_dev_priv *priv,
 		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_device *dev)
 	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 *dev, struct ipoib_mcast *mcast)
 	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_device *dev)
 		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 work_struct *work)
 		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
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c.
  2015-12-11 18:16 [PATCH 0/2] IB multicast cleanup patches Christoph Lameter
  2015-12-11 18:16 ` [PATCH 1/2] ipoib mcast sendonly join: Isolate common list remove code Christoph Lameter
@ 2015-12-11 18:16 ` Christoph Lameter
       [not found]   ` <20151211181724.290844844-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2015-12-11 18:16 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe, Erez Shitrit

[-- Attachment #1: 0002-ipoib-mcast-sendonly-join-Move-multicast-specific-co.patch --]
[-- Type: text/plain, Size: 4168 bytes --]

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 <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
---
 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;
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] ipoib mcast sendonly join: Isolate common list remove code
       [not found]   ` <20151211181724.185428150-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
@ 2015-12-11 23:10     ` ira.weiny
  0 siblings, 0 replies; 9+ messages in thread
From: ira.weiny @ 2015-12-11 23:10 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe, Erez Shitrit

On Fri, Dec 11, 2015 at 12:16:53PM -0600, Christoph Lameter wrote:
> 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 <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

> ---
>  drivers/infiniband/ulp/ipoib/ipoib.h           |  3 +--
>  drivers/infiniband/ulp/ipoib/ipoib_main.c      |  7 ++-----
>  drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 24 ++++++++++++++----------
>  3 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
> index 3ede103..989c409 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib.h
> +++ b/drivers/infiniband/ulp/ipoib/ipoib.h
> @@ -495,7 +495,6 @@ void ipoib_dev_cleanup(struct net_device *dev);
>  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_path_iter *iter,
>  
>  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);
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> index 7d32818..483ff20 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> @@ -1150,7 +1150,7 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
>  	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 ipoib_dev_priv *priv)
>  
>  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)
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> index f357ca6..8acb420a 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> @@ -106,7 +106,7 @@ static void __ipoib_mcast_schedule_join_thread(struct ipoib_dev_priv *priv,
>  		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_device *dev)
>  	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 *dev, struct ipoib_mcast *mcast)
>  	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_device *dev)
>  		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 work_struct *work)
>  		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
> -- 
> 2.5.0
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c.
       [not found]   ` <20151211181724.290844844-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
@ 2015-12-11 23:21     ` ira.weiny
       [not found]       ` <20151211232143.GC7855-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: ira.weiny @ 2015-12-11 23:21 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe, Erez Shitrit

On Fri, Dec 11, 2015 at 12:16:54PM -0600, Christoph Lameter wrote:
> 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 <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
> ---
>  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);

I think I would rather see this called something like

ipoib_add_to_list_sendonly

Or something...

Calling it iboib_check* sounds like it should return a bool.

>  
>  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) {

Odd to see a mgid variable which is only u8?

How about "gid_prefix"?

Ira

> +		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;
> -- 
> 2.5.0
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c.
       [not found]       ` <20151211232143.GC7855-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
@ 2015-12-11 23:24         ` ira.weiny
  2015-12-14 16:04         ` Christoph Lameter
  1 sibling, 0 replies; 9+ messages in thread
From: ira.weiny @ 2015-12-11 23:24 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe, Erez Shitrit

On Fri, Dec 11, 2015 at 06:21:43PM -0500, ira. weiny wrote:
> On Fri, Dec 11, 2015 at 12:16:54PM -0600, Christoph Lameter wrote:
> > 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 <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
> > ---
> >  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);
> 
> I think I would rather see this called something like
> 
> ipoib_add_to_list_sendonly
> 
> Or something...
> 
> Calling it iboib_check* sounds like it should return a bool.
> 
> >  
> >  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) {
> 
> Odd to see a mgid variable which is only u8?
> 
> How about "gid_prefix"?

Nevermind on this one, I misread this, it's a pointer to the full gid...

Ira

> 
> Ira
> 
> > +		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;
> > -- 
> > 2.5.0
> > 
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c.
       [not found]       ` <20151211232143.GC7855-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
  2015-12-11 23:24         ` ira.weiny
@ 2015-12-14 16:04         ` Christoph Lameter
       [not found]           ` <alpine.DEB.2.20.1512141000470.25235-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2015-12-14 16:04 UTC (permalink / raw)
  To: ira.weiny
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe,
	Erez Shitrit

On Fri, 11 Dec 2015, ira.weiny wrote:

> I think I would rather see this called something like
>
> ipoib_add_to_list_sendonly
>
> Or something...
>
> Calling it iboib_check* sounds like it should return a bool.

Hmm... It only adds the multicast group if the check was successful.

How about

		ipoib_check_and_add_mcast_sendonly()


> > +void ipoib_check_mcast_sendonly(struct ipoib_dev_priv *priv, u8 *mgid,
> > +				struct list_head *remove_list)
> > +{
> > +	/* Is this multicast ? */
> > +	if (*mgid == 0xff) {
>
> Odd to see a mgid variable which is only u8?
>
> How about "gid_prefix"?

That is only used in the qib driver and there it is a field.

mgid is a pointer to the seres of bytes of the MGID and the first byte of
that signifies multicast if 0xff....

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c.
       [not found]           ` <alpine.DEB.2.20.1512141000470.25235-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
@ 2015-12-14 16:07             ` Weiny, Ira
       [not found]               ` <2807E5FD2F6FDA4886F6618EAC48510E1CC1C353-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Weiny, Ira @ 2015-12-14 16:07 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe,
	Erez Shitrit

> 
> On Fri, 11 Dec 2015, ira.weiny wrote:
> 
> > I think I would rather see this called something like
> >
> > ipoib_add_to_list_sendonly
> >
> > Or something...
> >
> > Calling it iboib_check* sounds like it should return a bool.
> 
> Hmm... It only adds the multicast group if the check was successful.
> 
> How about
> 
> 		ipoib_check_and_add_mcast_sendonly()

Better.

> 
> 
> > > +void ipoib_check_mcast_sendonly(struct ipoib_dev_priv *priv, u8
> *mgid,
> > > +				struct list_head *remove_list)
> > > +{
> > > +	/* Is this multicast ? */
> > > +	if (*mgid == 0xff) {
> >
> > Odd to see a mgid variable which is only u8?
> >
> > How about "gid_prefix"?
> 
> That is only used in the qib driver and there it is a field.
> 
> mgid is a pointer to the seres of bytes of the MGID and the first byte of that
> signifies multicast if 0xff....

Understood, I misread the code at first.

Ira

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c.
       [not found]               ` <2807E5FD2F6FDA4886F6618EAC48510E1CC1C353-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2015-12-14 16:24                 ` Christoph Lameter
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Lameter @ 2015-12-14 16:24 UTC (permalink / raw)
  To: Weiny, Ira
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe,
	Erez Shitrit

On Mon, 14 Dec 2015, Weiny, Ira wrote:

> > How about
> >=20
> > 		ipoib_check_and_add_mcast_sendonly()
>
> Better.

Fixup patch:


Subject: ipoib: Fix up naming of ipoib_check_and_add_mcast_sendonly

Signed-off-by: Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>

Index: linux/drivers/infiniband/ulp/ipoib/ipoib.h
===================================================================
--- linux.orig/drivers/infiniband/ulp/ipoib/ipoib.h
+++ linux/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -549,7 +549,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);
 void ipoib_mcast_remove_list(struct net_device *dev, struct list_head *remove_list);
-void ipoib_check_mcast_sendonly(struct ipoib_dev_priv *priv, u8 *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);
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
@@ -1179,7 +1179,7 @@ static void __ipoib_reap_neigh(struct ip
 			/* was the neigh idle for two GC periods */
 			if (time_after(neigh_obsolete, neigh->alive)) {

-				ipoib_check_mcast_sendonly(priv, neigh->daddr + 4, &remove_list);
+				ipoib_check_and_add_mcast_sendonly(priv, neigh->daddr + 4, &remove_list);

 				rcu_assign_pointer(*np,
 						   rcu_dereference_protected(neigh->hnext,
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
@@ -708,7 +708,7 @@ static int ipoib_mcast_leave(struct net_
  * 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,
+void ipoib_check_and_add_mcast_sendonly(struct ipoib_dev_priv *priv, u8 *mgid,
 				struct list_head *remove_list)
 {
 	/* Is this multicast ? */
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-12-14 16:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11 18:16 [PATCH 0/2] IB multicast cleanup patches Christoph Lameter
2015-12-11 18:16 ` [PATCH 1/2] ipoib mcast sendonly join: Isolate common list remove code Christoph Lameter
     [not found]   ` <20151211181724.185428150-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
2015-12-11 23:10     ` ira.weiny
2015-12-11 18:16 ` [PATCH 2/2] ipoib mcast sendonly join: Move multicast specific code out of ipoib_main.c Christoph Lameter
     [not found]   ` <20151211181724.290844844-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
2015-12-11 23:21     ` ira.weiny
     [not found]       ` <20151211232143.GC7855-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-11 23:24         ` ira.weiny
2015-12-14 16:04         ` Christoph Lameter
     [not found]           ` <alpine.DEB.2.20.1512141000470.25235-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2015-12-14 16:07             ` Weiny, Ira
     [not found]               ` <2807E5FD2F6FDA4886F6618EAC48510E1CC1C353-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-12-14 16:24                 ` Christoph Lameter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.