Go to main content

man pages section 4: Device and Network Interfaces

Exit Print View

Updated: Wednesday, July 27, 2022



usmp - user SMP command interface


#include <sys/sas/impl/usmp.h>
ioctl(int fildes, int request, struct usmp_cmd *cmd);


The smp driver supports this ioctl(2), which provides a generic user-level interface for sending SMP commands to SMP target devices. SMP target devices are generally SAS switches or expanders. Each usmp call directs the smp(4D) driver to express a specific SMP function, and includes the data transfer to and from the designated SMP target device.

The usmp_cmd structure is defined in <sys/scsi/impl/usmp.h> and includes the following:

caddr_t     usmp_req;         /* address of smp request frame */
caddr_t     usmp_rsp;         /* address of smp response frame */
size_t      usmp_reqsize;     /* byte size of smp request frame */
size_t      usmp_rspsize;     /* byte size of smp response frame */
int         usmp_timeout;     /* command timeout */

The fields of the usmp_cmd structure have the following descriptions:


The address of the buffer containing the smp request frame. The data format should conform to the definition in the Serial Attached SCSI protocol.


The address of the buffer used to hold the smp response frame.


The size in byte of the smp request frame buffer.


The size in byte of the smp response frame buffer. The size of the buffer should not be less than eight bytes. If the buffer size is less than eight bytes the smp(4D) driver immediately returns EINVAL. If the buffer size is less than that specified for the specific SMP function in the Serial Attached SCSI protocol definition, the response data might be truncated.


The time in seconds to allow for completion of the command. If it is not set in user-level, the default value is 60.

The common headers of smp request and response frames are found in two structures: usmp_req and usmp_rsp, both of which are defined in <sys/scsi/impl/smp_frames.h>.

The structures include the following fields:

struct usmp_req {
  uint8_t smpo_frametype;   /* SMP frame type, should be 0x40 */
  uint8_t smpo_function;    /* SMP function being requested */
  uint8_t smpo_reserved;    /* reserved byte */
  uint8_t smpo_reqsize;     /* number of dwords that follow */
  uint8_t smpo_msgframe[1]  /* request bytes based on SMP function
                                 plus 4-byte CRC code */

struct usmp_rsp {
  uint8_t smpi_frametype;   /* SMP frame type, should be 0x41 */
  uint8_t smpi_function;    /* SMP function being requested */
  uint8_t smpi_result;      /* SMP function result */
  uint8_t smpi_rspsize;     /* number of dwords that follow */
  uint8_t smpi_msgframe[1]; /* response bytes based on SMP function */


The ioctl supported by the SMP target driver through the usmp interface is:


The argument is a pointer to a usmp_cmd structure.



One or more of the usmp_cmd, usmp_req or usmp_rsp structures point to an invalid address.


A parameter has an incorrect, or unsupported value.


An error occurred during the execution of the command.


Device has gone.


No memory available.


The response buffer is shorter than required, and the data is truncated.


A process without PRIV_SYS_DEVICES privilege tried to execute the USMPCMD ioctl.


Command timeout.


See attributes(7) for a description of the following attributes:

Interface Stability

See Also

ioctl(2), mpt(4D), smp(4D), attributes(7)

ANSI Small Computer System Interface – 4 (SCSI-4)


usmp commands are designed for topology control, device accessibility, and SAS expander and switch configuration. Usage of usmp is restricted to processes running with the PRIV_SYS_DEVICES privilege, regardless of the file permissions on the device node.

User-level applications are not required to fill in the four bytes of SAS CRC code in the SMP request frame. The smp(4D) driver manages this for usmp if the SAS HBA does not.