0

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

S. Salman
  • 590
  • 1
  • 6
  • 22

1 Answers1

2

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.

haggai_e
  • 4,689
  • 1
  • 24
  • 37
  • can we get serveice_level and dlid without ib_sa_path_rec_get query? Also do we even require to query these if two machines are connected directly and dlid is fixed? – S. Salman Jul 28 '16 at 09:50
  • If you know the dlid by other means then you don't need the query, but if you want your code to be portable you need to query the SM. – haggai_e Jul 28 '16 at 14:28