• Jason Gunthorpe's avatar
    RDMA/cm: Make it clear that there is no concurrency in cm_sidr_req_handler() · 083bfdbf
    Jason Gunthorpe authored
    ib_create_cm_id() immediately places the id in the xarray, so it is visible
    to network traffic.
    
    The state is initially set to IB_CM_IDLE and all the MAD handlers will
    test this state under lock and refuse to advance from IDLE, so adding to
    the xarray is harmless.
    
    Further, the set to IB_CM_SIDR_REQ_RCVD also excludes all MAD handlers.
    
    However, the local_id isn't even used for SIDR mode, and there will be no
    input MADs related to the newly created ID.
    
    So, make the whole flow simpler so it can be understood:
     - Do not put the SIDR cm_id in the xarray. This directly shows that there
       is no concurrency
     - Delete the confusing work_count and pending_list manipulations. This
       mechanism is only used by MAD handlers and timewait, neither of which
       apply to SIDR.
     - Add a few comments and rename 'cur_cm_id_priv' to 'listen_cm_id_priv'
     - Move other loose sets up to immediately after cm_id creation so that
       the cm_id is fully configured right away. This fixes an oversight where
       the service_id will not be returned back on a IB_SIDR_UNSUPPORTED
       reject.
    
    Link: https://lore.kernel.org/r/20200310092545.251365-8-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    083bfdbf
cm.c 128 KB