• Jason Gunthorpe's avatar
    IB/ipoib: Move all uninit code into ndo_uninit · 7cbee87c
    Jason Gunthorpe authored
    Currently uninit is sometimes done twice in error flows, and is sprinkled
    a bit all over the place.
    
    Improve the clarity of the design by moving all uninit only into
    ndo_uinit.
    
    Some duplication is removed:
     - Sometimes IPOIB_STOP_NEIGH_GC was done before unregister, but
       this duplicates the process in ipoib_neigh_hash_init
     - Flushing priv->wq was sometimes done before unregister,
       but that duplicates what has been done in ndo_uninit
    
    Uniniting the IB event queue must remain before unregister_netdev as it
    requires the RTNL lock to be dropped, this is moved to a helper to make
    that flow really clear and remove some duplication in error flows.
    
    If register_netdev fails (and ndo_init is NULL) then it almost always
    calls ndo_uninit, which lets us remove all the extra code from the error
    unwinds. The next patch in the series will close the 'almost always' hole
    by pairing a proper ndo_init with ndo_uninit.
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
    7cbee87c
ipoib.h 22.7 KB