Message ID | 20161228124728.26619-3-leon@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Wed, 2016-12-28 at 14:47 +0200, Leon Romanovsky wrote: > From: Feras Daoud <ferasda@mellanox.com> > > When changing the connection mode, the ipoib_set_mode function > did not check if the previous connection mode equals to the > new one. This commit adds the required check and return 0 if the new > mode equals to the previous one. > > Fixes: 839fcaba355a ("IPoIB: Connected mode experimental support") > Signed-off-by: Feras Daoud <ferasda@mellanox.com> > Signed-off-by: Erez Shitrit <erezsh@mellanox.com> > Reviewed-by: Alex Vesker <valex@mellanox.com> > Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> > Signed-off-by: Leon Romanovsky <leon@kernel.org> > --- > drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c > b/drivers/infiniband/ulp/ipoib/ipoib_main.c > index a550cc6..1787f6b 100644 > --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c > +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c > @@ -474,6 +474,14 @@ int ipoib_set_mode(struct net_device *dev, const > char *buf) > { > struct ipoib_dev_priv *priv = netdev_priv(dev); > > + if ((test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags) && > + !strcmp(buf, "connected\n")) || > + (!test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags) && > + !strcmp(buf, "datagram\n"))) { > + ipoib_dbg(priv, "already in that mode, goes > out.\n"); There is no need for any message here. Nothing unexpected is happening.
On Thu, Jan 12, 2017 at 01:47:06PM -0500, Doug Ledford wrote: > On Wed, 2016-12-28 at 14:47 +0200, Leon Romanovsky wrote: > > From: Feras Daoud <ferasda@mellanox.com> > > > > When changing the connection mode, the ipoib_set_mode function > > did not check if the previous connection mode equals to the > > new one. This commit adds the required check and return 0 if the new > > mode equals to the previous one. > > > > Fixes: 839fcaba355a ("IPoIB: Connected mode experimental support") > > Signed-off-by: Feras Daoud <ferasda@mellanox.com> > > Signed-off-by: Erez Shitrit <erezsh@mellanox.com> > > Reviewed-by: Alex Vesker <valex@mellanox.com> > > Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> > > Signed-off-by: Leon Romanovsky <leon@kernel.org> > > --- > > drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c > > b/drivers/infiniband/ulp/ipoib/ipoib_main.c > > index a550cc6..1787f6b 100644 > > --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c > > +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c > > @@ -474,6 +474,14 @@ int ipoib_set_mode(struct net_device *dev, const > > char *buf) > > { > > struct ipoib_dev_priv *priv = netdev_priv(dev); > > > > + if ((test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags) && > > + !strcmp(buf, "connected\n")) || > > + (!test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags) && > > + !strcmp(buf, "datagram\n"))) { > > + ipoib_dbg(priv, "already in that mode, goes > > out.\n"); > > There is no need for any message here. Nothing unexpected is > happening. Right, Thank you fixing it. > > -- > Doug Ledford <dledford@redhat.com> > GPG KeyID: B826A3330E572FDD > > Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index a550cc6..1787f6b 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -474,6 +474,14 @@ int ipoib_set_mode(struct net_device *dev, const char *buf) { struct ipoib_dev_priv *priv = netdev_priv(dev); + if ((test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags) && + !strcmp(buf, "connected\n")) || + (!test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags) && + !strcmp(buf, "datagram\n"))) { + ipoib_dbg(priv, "already in that mode, goes out.\n"); + return 0; + } + /* flush paths if we switch modes so that connections are restarted */ if (IPOIB_CM_SUPPORTED(dev->dev_addr) && !strcmp(buf, "connected\n")) { set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);