• Parav Pandit's avatar
    devlink: Always use user_ptr[0] for devlink and simplify post_doit · 637989b5
    Parav Pandit authored
    Currently devlink instance is searched on all doit() operations.
    But it is optionally stored into user_ptr[0]. This requires
    rediscovering devlink again doing post_doit().
    
    Few devlink commands related to port shared buffers needs 3 pointers
    (devlink, devlink_port, and devlink_sb) while executing doit commands.
    Though devlink pointer can be derived from the devlink_port during
    post_doit() operation when doit() callback has acquired devlink
    instance lock, relying on such scheme to access devlik pointer makes
    code very fragile.
    
    Hence, to avoid ambiguity in post_doit() and to avoid searching
    devlink instance again, simplify code by always storing devlink
    instance in user_ptr[0] and derive devlink_sb pointer in their
    respective callback routines.
    Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
    Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
    Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    637989b5
devlink.c 245 KB