• Jakub Kicinski's avatar
    nfp: register devlink after app is created · bcc93a23
    Jakub Kicinski authored
    Devlink used to have two global locks: devlink lock and port lock,
    our lock ordering looked like this:
    
      devlink lock -> driver's pf->lock -> devlink port lock
    
    After recent changes port lock was replaced with per-instance
    lock.  Unfortunately, new per-instance lock is taken on most
    operations now.  This means we can only grab the pf->lock from
    the port split/unsplit ops.  Lock ordering looks like this:
    
      devlink lock -> driver's pf->lock -> devlink instance lock
    
    Since we can't take pf->lock from most devlink ops, make sure
    nfp_apps are prepared to service them as soon as devlink is
    registered.  Locking the pf must be pushed down after
    nfp_app_init() callback.
    
    The init order looks like this:
     nfp_app_init
     devlink_register
     nfp_app_start
     netdev/port_register
    
    As soon as app_init is done nfp_apps must be ready to service
    devlink-related callbacks.  apps can only register their own
    devlink objects from nfp_app_start.
    
    Fixes: 2406e7e5 ("devlink: Add per devlink instance lock")
    Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
    Reviewed-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    bcc93a23
nfp_net_main.c 19.5 KB