diff --git a/src/ucp/api/ucp.h b/src/ucp/api/ucp.h index 4f9e6834d79..d1b78c3f6cb 100644 --- a/src/ucp/api/ucp.h +++ b/src/ucp/api/ucp.h @@ -268,7 +268,8 @@ enum ucp_ep_params_field { /**< Connection request field */ UCP_EP_PARAM_FIELD_CONN_REQUEST = UCS_BIT(6), UCP_EP_PARAM_FIELD_NAME = UCS_BIT(7), /**< Endpoint name */ - UCP_EP_PARAM_FIELD_LOCAL_SOCK_ADDR = UCS_BIT(8) /**< Local socket Address */ + UCP_EP_PARAM_FIELD_LOCAL_SOCK_ADDR = UCS_BIT(8), /**< Local socket Address */ + UCP_EP_PARAM_FIELD_TRAFFIC_CLASS = UCS_BIT(9) /**< Traffic class */ }; diff --git a/src/ucp/api/ucp_def.h b/src/ucp/api/ucp_def.h index 95b138b313d..1592219d6f9 100644 --- a/src/ucp/api/ucp_def.h +++ b/src/ucp/api/ucp_def.h @@ -788,6 +788,23 @@ typedef struct ucp_ep_params { */ ucs_sock_addr_t local_sockaddr; + /** + * Traffic class for this endpoint, as a full 8-bit Type of Service value: + * a 6-bit Differentiated Services Code Point (DSCP) followed by 2 ECN + * bits. On InfiniBand it is used as the GRH Traffic Class; on RoCEv2 its + * upper 6 bits are used as the DSCP field of the IP header. It overrides + * the transport's default traffic class for this endpoint only, using the + * same format. + * + * Currently implemented by the RC transport over mlx5 devices with DEVX + * enabled, including the GGA and GDAKI transports which are based on it. + * Transports which do not support it, such as DC, ignore this value and + * keep using their default traffic class. + * + * This setting is optional. To enable it, the corresponding @ref + * UCP_EP_PARAM_FIELD_TRAFFIC_CLASS bit in the field mask must be set. + */ + uint8_t traffic_class; } ucp_ep_params_t; diff --git a/src/uct/api/v2/uct_v2.h b/src/uct/api/v2/uct_v2.h index 982dc190d25..5e38f3b73ac 100644 --- a/src/uct/api/v2/uct_v2.h +++ b/src/uct/api/v2/uct_v2.h @@ -374,7 +374,10 @@ typedef enum { UCT_EP_CONNECT_TO_EP_PARAM_FIELD_DEVICE_ADDR_LENGTH = UCS_BIT(0), /** Endpoint address length */ - UCT_EP_CONNECT_TO_EP_PARAM_FIELD_EP_ADDR_LENGTH = UCS_BIT(1) + UCT_EP_CONNECT_TO_EP_PARAM_FIELD_EP_ADDR_LENGTH = UCS_BIT(1), + + /** Traffic class */ + UCT_EP_CONNECT_TO_EP_PARAM_FIELD_TRAFFIC_CLASS = UCS_BIT(2) } uct_ep_connect_to_ep_param_field_t; @@ -729,6 +732,25 @@ typedef struct uct_ep_connect_to_ep_params { * default minimal length according to the address buffer contents. */ size_t ep_addr_length; + + /** + * Traffic class for this endpoint, as a full 8-bit Type of Service value: + * a 6-bit Differentiated Services Code Point (DSCP) followed by 2 ECN + * bits. On InfiniBand it is used as the GRH Traffic Class; on RoCEv2 its + * upper 6 bits are used as the DSCP field of the IP header. It overrides + * the interface's default traffic class for this endpoint only, using the + * same format. + * + * Currently implemented by the RC transport over mlx5 devices with DEVX + * enabled, including the GGA and GDAKI transports which are based on it. + * Transports which do not support it, such as DC, ignore this value and + * keep using their default traffic class. + * + * This setting is optional. To enable it, the corresponding @ref + * UCT_EP_CONNECT_TO_EP_PARAM_FIELD_TRAFFIC_CLASS bit in the field mask + * must be set. + */ + uint8_t traffic_class; } uct_ep_connect_to_ep_params_t;