QoS (AT+C5GQOS, AT+CGEQOS) with QMI?
Martin Maurer
martin.maurer at mmeacs.de
Sat Nov 25 10:40:31 UTC 2023
New approach for QoS:
In file src/qmicli/qmicli-wds.c
I added some code (almost at end of the function marked with MMM, libqmi
1.34, everything else unchanged) to create an QoS entry to a profile:
static gboolean
create_profile_input_create (const gchar *str,
QmiMessageWdsCreateProfileInput **input,
GError **error)
{
GError *parse_error = NULL;
CreateModifyProfileProperties props = {};
gboolean success = FALSE;
gchar **split;
g_assert (input && !*input);
split = g_strsplit (str, ",", 2);
if (g_strv_length (split) < 1) {
g_set_error (error,
QMI_CORE_ERROR,
QMI_CORE_ERROR_FAILED,
"expected at least 1 arguments for 'wds create
profile' command");
goto out;
}
g_strstrip (split[0]);
if (g_str_equal (split[0], "3gpp"))
props.profile_type = QMI_WDS_PROFILE_TYPE_3GPP;
else if (g_str_equal (split[0], "3gpp2"))
props.profile_type = QMI_WDS_PROFILE_TYPE_3GPP2;
else {
g_set_error (error,
QMI_CORE_ERROR,
QMI_CORE_ERROR_FAILED,
"invalid profile type. Expected '3gpp' or '3gpp2'.'");
goto out;
}
if (split[1]) {
if (!qmicli_parse_key_value_string (split[1],
&parse_error,
create_modify_profile_properties_handle,
&props)) {
g_set_error (error,
QMI_CORE_ERROR,
QMI_CORE_ERROR_FAILED,
"couldn't parse input string: %s",
parse_error->message);
g_error_free (parse_error);
goto out;
}
}
/* Create input bundle */
*input = qmi_message_wds_create_profile_input_new ();
/* Profile type is required */
qmi_message_wds_create_profile_input_set_profile_type (*input,
props.profile_type, NULL);
if (props.context_number)
qmi_message_wds_create_profile_input_set_pdp_context_number (*input,
props.context_number, NULL);
if (props.pdp_type_set)
qmi_message_wds_create_profile_input_set_pdp_type (*input,
props.pdp_type, NULL);
if (props.apn_type_set)
qmi_message_wds_create_profile_input_set_apn_type_mask (*input,
props.apn_type, NULL);
if (props.name)
qmi_message_wds_create_profile_input_set_profile_name (*input,
props.name, NULL);
if (props.apn)
qmi_message_wds_create_profile_input_set_apn_name (*input,
props.apn, NULL);
if (props.auth_set)
qmi_message_wds_create_profile_input_set_authentication
(*input, props.auth, NULL);
if (props.username)
qmi_message_wds_create_profile_input_set_username (*input,
props.username, NULL);
if (props.password)
qmi_message_wds_create_profile_input_set_password (*input,
props.password, NULL);
if (props.no_roaming_set)
qmi_message_wds_create_profile_input_set_roaming_disallowed_flag
(*input, props.no_roaming, NULL);
if (props.disabled_set)
qmi_message_wds_create_profile_input_set_apn_disabled_flag
(*input, props.disabled, NULL);
// MMM
printf("MMM\n");
/**
* qmi_message_wds_create_profile_input_set_umts_minimum_qos:
* @self: a #QmiMessageWdsCreateProfileInput.
* @value_umts_minimum_qos_traffic_class: a #QmiWdsTrafficClass.
* @value_umts_minimum_qos_max_uplink_bitrate: a #guint32.
* @value_umts_minimum_qos_max_downlink_bitrate: a #guint32.
* @value_umts_minimum_qos_guaranteed_uplink_bitrate: a #guint32.
* @value_umts_minimum_qos_guaranteed_downlink_bitrate: a #guint32.
* @value_umts_minimum_qos_qos_delivery_order: a #QmiWdsDeliveryOrder.
* @value_umts_minimum_qos_maximum_sdu_size: a #guint32.
* @value_umts_minimum_qos_sdu_error_ratio: a #QmiWdsSduErrorRatio.
* @value_umts_minimum_qos_residual_bit_error_ratio: a
#QmiWdsSduResidualBitErrorRatio.
* @value_umts_minimum_qos_delivery_erroneous_sdu: a
#QmiWdsSduErroneousDelivery.
* @value_umts_minimum_qos_transfer_delay: a #guint32.
* @value_umts_minimum_qos_traffic_handling_priority: a #guint32.
* @error: Return location for error or %NULL.
*/
{
//
https://lazka.github.io/pgi-docs/Qmi-1.0/enums.html#Qmi.WdsTrafficClass
QmiWdsTrafficClass trafficClass = { 0 };
//
guint32 max_uplink_bitrate = 1000000;
//
guint32 max_downlink_bitrate = 1000000;
//
guint32 guaranteed_uplink_bitrate = 50000;
//
guint32 guaranteed_download_bitrate = 50000;
//
https://lazka.github.io/pgi-docs/Qmi-1.0/enums.html#Qmi.WdsDeliveryOrder
QmiWdsDeliveryOrder deliveryOrder = { 0 };
//
guint32 maximum_sdu_size = 1200;
//
https://lazka.github.io/pgi-docs/Qmi-1.0/enums.html#Qmi.WdsSduErrorRatio
QmiWdsSduErrorRatio sduErrorRatio = { 0 };
//
https://lazka.github.io/pgi-docs/Qmi-1.0/enums.html#Qmi.WdsSduResidualBitErrorRatio
QmiWdsSduResidualBitErrorRatio sduResidualBitErrorRatio = { 0 };
//
https://lazka.github.io/pgi-docs/Qmi-1.0/enums.html#Qmi.WdsSduErroneousDelivery
QmiWdsSduErroneousDelivery sduErroneousDelivery = { 0 };
guint32 transfer_delay = 20;
guint32 traffic_handling_priority = 0;
qmi_message_wds_create_profile_input_set_umts_minimum_qos(*input,
trafficClass, max_uplink_bitrate, max_downlink_bitrate, guaran
teed_uplink_bitrate, guaranteed_download_bitrate, deliveryOrder,
maximum_sdu_size, sduErrorRatio, sduResidualBitErrorRatio, sduErroneous
Delivery, transfer_delay, traffic_handling_priority, NULL);
}
printf("MMM\n");
// MMM
success = TRUE;
out:
g_strfreev (split);
g_free (props.name);
g_free (props.apn);
g_free (props.username);
g_free (props.password);
return success;
}
Then I am calling, to try to create a profile with QoS:
~/libqmi $ sudo ./build/src/qmicli/qmicli -v -p -d /dev/cdc-wdm0
--wds-create-profile=3gpp
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] opening device with
flags 'proxy, auto'...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] automatically selecting
QMI mode
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] created endpoint
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] sent message...
<<<<<< RAW:
<<<<<< length = 28
<<<<<< data = 01:1B:00:00:00:00:00:01:00:FF:10:00...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] sent generic request
(translated)...
<<<<<< QMUX:
<<<<<< length = 27
<<<<<< flags = 0x00
<<<<<< service = "ctl"
<<<<<< client = 0
<<<<<< QMI:
<<<<<< flags = "none"
<<<<<< transaction = 1
<<<<<< tlv_length = 16
<<<<<< message = "Internal Proxy Open" (0xFF00)
<<<<<< TLV:
<<<<<< type = "Device Path" (0x01)
<<<<<< length = 13
<<<<<< value = 2F:64:65:76:2F:63:64:63:2D:77:64:6D:30
<<<<<< translated = /dev/cdc-wdm0
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] received message...
<<<<<< RAW:
<<<<<< length = 19
<<<<<< data = 01:12:00:80:00:00:01:01:00:FF:07:00...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] received generic
response (translated)...
<<<<<< QMUX:
<<<<<< length = 18
<<<<<< flags = 0x80
<<<<<< service = "ctl"
<<<<<< client = 0
<<<<<< QMI:
<<<<<< flags = "response"
<<<<<< transaction = 1
<<<<<< tlv_length = 7
<<<<<< message = "Internal Proxy Open" (0xFF00)
<<<<<< TLV:
<<<<<< type = "Result" (0x02)
<<<<<< length = 4
<<<<<< value = 00:00:00:00
<<<<<< translated = SUCCESS
[25 Nov 2023, 10:29:01] [Debug] QMI Device at '/dev/cdc-wdm0' ready
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] assuming service 'wds'
is supported...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] allocating new client ID...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] sent message...
<<<<<< RAW:
<<<<<< length = 16
<<<<<< data = 01:0F:00:00:00:00:00:02:22:00:04:00...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] sent generic request
(translated)...
<<<<<< QMUX:
<<<<<< length = 15
<<<<<< flags = 0x00
<<<<<< service = "ctl"
<<<<<< client = 0
<<<<<< QMI:
<<<<<< flags = "none"
<<<<<< transaction = 2
<<<<<< tlv_length = 4
<<<<<< message = "Allocate CID" (0x0022)
<<<<<< TLV:
<<<<<< type = "Service" (0x01)
<<<<<< length = 1
<<<<<< value = 01
<<<<<< translated = wds
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] received message...
<<<<<< RAW:
<<<<<< length = 24
<<<<<< data = 01:17:00:80:00:00:01:02:22:00:0C:00...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] received generic
response (translated)...
<<<<<< QMUX:
<<<<<< length = 23
<<<<<< flags = 0x80
<<<<<< service = "ctl"
<<<<<< client = 0
<<<<<< QMI:
<<<<<< flags = "response"
<<<<<< transaction = 2
<<<<<< tlv_length = 12
<<<<<< message = "Allocate CID" (0x0022)
<<<<<< TLV:
<<<<<< type = "Result" (0x02)
<<<<<< length = 4
<<<<<< value = 00:00:00:00
<<<<<< translated = SUCCESS
<<<<<< TLV:
<<<<<< type = "Allocation Info" (0x01)
<<<<<< length = 2
<<<<<< value = 01:0E
<<<<<< translated = [ service = 'wds' cid = '14' ]
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] registered 'wds'
(version unknown) client with ID '14'
MMM
qmi_message_wds_create_profile_input_set_umts_minimum_qos
qmi_message_wds_create_profile_input_set_umts_minimum_qos Pos 2
MMM
[25 Nov 2023, 10:29:01] [Debug] Asynchronously creating new profile...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] sent message...
<<<<<< RAW:
<<<<<< length = 53
<<<<<< data = 01:34:00:00:01:0E:00:01:00:27:00:28...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] sent generic request
(translated)...
<<<<<< QMUX:
<<<<<< length = 52
<<<<<< flags = 0x00
<<<<<< service = "wds"
<<<<<< client = 14
<<<<<< QMI:
<<<<<< flags = "none"
<<<<<< transaction = 1
<<<<<< tlv_length = 40
<<<<<< message = "Create Profile" (0x0027)
<<<<<< TLV:
<<<<<< type = "UMTS Minimum QoS" (0x18)
<<<<<< length = 33
<<<<<< value =
00:40:42:0F:00:40:42:0F:00:50:C3:00:00:50:C3:00:00:00:B0:04:00:00:00:00:00:14:00:00:00:00:00:00:00
<<<<<< translated = [ traffic_class = 'subscribed' max_uplink_bitrate
= '1000000' max_downlink_bitrate = '1000000' guaranteed_uplink_bitrate =
'50000' guaranteed_downlink_bitrate = '50000' qos_delivery_order =
'subscribe' maximum_sdu_size = '1200' sdu_error_ratio = 'subscribe'
residual_bit_error_ratio = 'subscribe' delivery_erroneous_sdu =
'subscribe' transfer_delay = '20' traffic_handling_priority = '0' ]
<<<<<< TLV:
<<<<<< type = "Profile Type" (0x01)
<<<<<< length = 1
<<<<<< value = 00
<<<<<< translated = 3gpp
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] received message...
<<<<<< RAW:
<<<<<< length = 25
<<<<<< data = 01:18:00:80:01:0E:02:01:00:27:00:0C...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] received generic
response (translated)...
<<<<<< QMUX:
<<<<<< length = 24
<<<<<< flags = 0x80
<<<<<< service = "wds"
<<<<<< client = 14
<<<<<< QMI:
<<<<<< flags = "response"
<<<<<< transaction = 1
<<<<<< tlv_length = 12
<<<<<< message = "Create Profile" (0x0027)
<<<<<< TLV:
<<<<<< type = "Result" (0x02)
<<<<<< length = 4
<<<<<< value = 01:00:51:00
<<<<<< translated = FAILURE: ExtendedInternal
<<<<<< TLV:
<<<<<< type = "Extended Error Code" (0xe0)
<<<<<< length = 2
<<<<<< value = 01:00
<<<<<< translated = fail
create_profile_ready
qmi_message_wds_create_profile_output_get_result 1 1
qmi_message_wds_create_profile_output_get_result Pos 2 1
error: couldn't create profile: ds profile error: fail
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] releasing 'wds' client
with flags 'release-cid'...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] unregistered 'wds'
client with ID '14'
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] sent message...
<<<<<< RAW:
<<<<<< length = 17
<<<<<< data = 01:10:00:00:00:00:00:03:23:00:05:00...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] sent generic request
(translated)...
<<<<<< QMUX:
<<<<<< length = 16
<<<<<< flags = 0x00
<<<<<< service = "ctl"
<<<<<< client = 0
<<<<<< QMI:
<<<<<< flags = "none"
<<<<<< transaction = 3
<<<<<< tlv_length = 5
<<<<<< message = "Release CID" (0x0023)
<<<<<< TLV:
<<<<<< type = "Release Info" (0x01)
<<<<<< length = 2
<<<<<< value = 01:0E
<<<<<< translated = [ service = 'wds' cid = '14' ]
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] received message...
<<<<<< RAW:
<<<<<< length = 24
<<<<<< data = 01:17:00:80:00:00:01:03:23:00:0C:00...
[25 Nov 2023, 10:29:01] [Debug] [/dev/cdc-wdm0] received generic
response (translated)...
<<<<<< QMUX:
<<<<<< length = 23
<<<<<< flags = 0x80
<<<<<< service = "ctl"
<<<<<< client = 0
<<<<<< QMI:
<<<<<< flags = "response"
<<<<<< transaction = 3
<<<<<< tlv_length = 12
<<<<<< message = "Release CID" (0x0023)
<<<<<< TLV:
<<<<<< type = "Result" (0x02)
<<<<<< length = 4
<<<<<< value = 00:00:00:00
<<<<<< translated = SUCCESS
<<<<<< TLV:
<<<<<< type = "Release Info" (0x01)
<<<<<< length = 2
<<<<<< value = 01:0E
<<<<<< translated = [ service = 'wds' cid = '14' ]
[25 Nov 2023, 10:29:01] [Debug] Client released
[25 Nov 2023, 10:29:01] [Debug] Closed
~/libqmi $
Tried it with Quectel RM520N-GL and Cinterion MV31, but both behave the
same.
Any idea what could be wrong? Do I need to adjust some content of the
QoS parameters? I have only choosen some random values,
but perhaps the must be different so that radio module accepts the request?
More information about the libqmi-devel
mailing list