write(2)/read(2) commands ------------------------- There is only one buffer/struct defined for writing/reading to the sol_umad driver: struct ib_user_mad { struct ib_user_mad_hdr hdr; /* Header struct */ u64 data[0]; /* MAD payload data */ }; where 'struct ib_user_mad_hdr' is: struct ib_user_mad_hdr { uint32_t id; /* ID of agent MAD received with/to be sent */ /* with */ uint32_t status; /* 0 on successful receive, ETIMEDOUT if no */ /* response received (transaction ID in */ /* data[] will be set to TID of original */ /* request) (ignored on send) */ uint32_t timeout_ms; /* Milliseconds to wait for response (unset */ /* on receive) */ uint32_t retries; /* Number of automatic retries to attempt */ uint32_t length; /* */ uint32_t qpn; /* Remote QP number received from/to be sent */ /* to */ uint32_t qkey; /* Remote Q_Key to be sent with (unset on */ /* receive) */ uint16_t lid; /* Remote lid received from/to be sent to */ uint8_t sl; /* Service level received with/to be sent */ /* with */ uint8_t path_bits; /* Local path bits received with/to be sent */ /* with */ uint8_t grh_present; /* If set, GRH was received/should be sent */ uint8_t gid_index; /* Local GID index to send with (unset on */ /* receive) */ uint8_t hop_limit; /* Hop limit in GRH */ uint8_t traffic_class; /* Traffic class in GRH */ uint8_t gid[16]; /* Remote GID in GRH */ uint32_t flow_label; /* Flow label in GRH */ uint16_t pkey_index; /* P_Key index */ uint8_t reserved[6]; }; ioctl(2) commands ----------------- There are three ioctl requests supported: IB_USER_MAD_REGISTER_AGENT /* MAD registration request */ IB_USER_MAD_UNREGISTER_AGENT /* MAD unregistration request */ IB_USER_MAD_ENABLE_PKEY /* Enable extended interface request */ Details of which are: ioctl request: IB_USER_MAD_REGISTER_AGENT ioctl arg: pointer to an struct ib_user_mad_reg_req defined as: struct ib_user_mad_reg_req { uint32_t id; /* Set by the kernel; used to identify agent */ /* in future requests */ packed_ulong method_mask[IB_USER_MAD_LONGS_PER_METHOD_MASK]; /* The caller will receive unsolicited MADs */ /* for any method where @method_mask = 1 */ uint8_t qpn; /* Queue pair number; must be 0 or 1 */ uint8_t mgmt_class; /* Indicates which management class of MADs */ /* should be receive by the caller. This */ /* field is only required if the user wishes */ /* to receive unsolicited MADs, otherwise it */ /* should be 0. */ uint8_t mgmt_class_version; /* Indicates which version of MADs for the */ /* given management class to receive */ uint8_t oui[3]; /* Indicates IEEE OUI when mgmt_class is a */ /* vendor class in the range from 0x30 to */ /* 0x4f. Otherwise not used. */ uint8_t rmpp_version; /* If set, indicates the RMPP version */ /* used */ }; ioctl request: IB_USER_MAD_UNREGISTER_AGENT ioctl arg: pointer to an uint32_t that is the 'id' obtained from a previous IB_USER_MAD_REGISTER_AGENT operation. ioctl request: IB_USER_MAD_ENABLE_PKEY ioctl arg: NULL This ioctl enables the newer read(2)/write(2) interface defined by struct ib_user_mad above. This interface allows specifying/receiving the P_Key index. To use this interface, an application must call the IB_USER_MAD_ENABLE_PKEY ioctl on the user MAD file handle before any other actions with the file handle.