diff mbox

[rdma-next,1/2] IB/ipoib: Update broadcast object if PKey value was changed in index 0

Message ID 20170319091855.8419-1-leon@kernel.org (mailing list archive)
State Accepted
Headers show

Commit Message

Leon Romanovsky March 19, 2017, 9:18 a.m. UTC
From: Feras Daoud <ferasda@mellanox.com>

Update the broadcast address in the priv->broadcast object when the
Pkey value changes in index 0, otherwise the multicast GID value will
keep the previous value of the PKey, and will not be updated.
This leads to interface state down because the interface will keep the
old PKey value.

For example, in SR-IOV environment, if the PF changes the value of PKey
index 0 for one of the VFs, then the VF receives PKey change event that
triggers heavy flush. This flush calls update_parent_pkey that update the
broadcast object and its relevant members. If in this case the multicast
GID will not be updated, the interface state will be down.

Fixes: c2904141696e ("IPoIB: Fix pkey change flow for virtualization environments")
Signed-off-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Reviewed-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
---
 drivers/infiniband/ulp/ipoib/ipoib_ib.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Doug Ledford April 24, 2017, 4:03 p.m. UTC | #1
On Sun, 2017-03-19 at 11:18 +0200, Leon Romanovsky wrote:
> From: Feras Daoud <ferasda@mellanox.com>
> 
> Update the broadcast address in the priv->broadcast object when the
> Pkey value changes in index 0, otherwise the multicast GID value will
> keep the previous value of the PKey, and will not be updated.
> This leads to interface state down because the interface will keep
> the
> old PKey value.
> 
> For example, in SR-IOV environment, if the PF changes the value of
> PKey
> index 0 for one of the VFs, then the VF receives PKey change event
> that
> triggers heavy flush. This flush calls update_parent_pkey that update
> the
> broadcast object and its relevant members. If in this case the
> multicast
> GID will not be updated, the interface state will be down.
> 
> Fixes: c2904141696e ("IPoIB: Fix pkey change flow for virtualization
> environments")
> Signed-off-by: Feras Daoud <ferasda@mellanox.com>
> Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
> Reviewed-by: Alex Vesker <valex@mellanox.com>
> Signed-off-by: Leon Romanovsky <leon@kernel.org>

Thanks, applied.
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 12c4f84a6639..4c80681922c5 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -967,6 +967,19 @@  static inline int update_parent_pkey(struct ipoib_dev_priv *priv)
 		 */
 		priv->dev->broadcast[8] = priv->pkey >> 8;
 		priv->dev->broadcast[9] = priv->pkey & 0xff;
+
+		/*
+		 * Update the broadcast address in the priv->broadcast object,
+		 * in case it already exists, otherwise no one will do that.
+		 */
+		if (priv->broadcast) {
+			spin_lock_irq(&priv->lock);
+			memcpy(priv->broadcast->mcmember.mgid.raw,
+			       priv->dev->broadcast + 4,
+			sizeof(union ib_gid));
+			spin_unlock_irq(&priv->lock);
+		}
+
 		return 0;
 	}