Search code examples
infinibandrdmamellanox

Issue in SA query Infiniband


What is the parameter context passed to the function ib_sa_path_rec_get from ib_sa?


Solution

  • It is common for asynchronous functions in the kernel to accept a callback function and a context pointer. Once the handling is complete, the callback function is called passing the context pointer as one of its parameters. This allows the caller to identify the specific invocation for which the callback is being called.

    In the case of ib_sa_path_rec_get, you can see for example one of the calls to this functions in the IPoIB module. The call passes a callback function path_rec_completion and a context of type struct ipoib_path *. Once the SA query handling is complete, the callback function is called, and it uses the context parameter to identify the ipoib_path struct for which the function is being called.