IB/ipoib: Fix for potential no-carrier state
authorAlex Estrin <alex.estrin@intel.com>
Thu, 1 Feb 2018 18:55:41 +0000 (10:55 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:50:24 +0000 (07:50 +0200)
[ Upstream commit 1029361084d18cc270f64dfd39529fafa10cfe01 ]

On reboot SM can program port pkey table before ipoib registered its
event handler, which could result in missing pkey event and leave root
interface with initial pkey value from index 0.

Since OPA port starts with invalid pkey in index 0, root interface will
fail to initialize and stay down with no-carrier flag.

For IB ipoib interface may end up with pkey different from value
opensm put in pkey table idx 0, resulting in connectivity issues
(different mcast groups, for example).

Close the window by calling event handler after registration
to make sure ipoib pkey is in sync with port pkey table.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/ulp/ipoib/ipoib_main.c

index 0df7d4504c0691aba341fd8fad01cae4fc03c3c8..17c5bc7e8957446b4f31aa76cd19bb99501d198b 100644 (file)
@@ -2119,6 +2119,9 @@ static struct net_device *ipoib_add_port(const char *format,
                goto event_failed;
        }
 
+       /* call event handler to ensure pkey in sync */
+       queue_work(ipoib_workqueue, &priv->flush_heavy);
+
        result = register_netdev(priv->dev);
        if (result) {
                printk(KERN_WARNING "%s: couldn't register ipoib port %d; error %d\n",