From 4c58af1430b0cc1b540383a83958187e0a6a0973 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 28 Jul 2025 22:11:24 +0200 Subject: [PATCH] uqmi: add knobs --- ...add-option-for-enabling-flow-control.patch | 111 ++++++++++++++++++ .../0002-uqmi-extend-get-data-format.patch | 85 ++++++++++++++ .../patches/0003-qmi-wda-add-qos-format.patch | 86 ++++++++++++++ 3 files changed, 282 insertions(+) create mode 100644 package/network/utils/uqmi/patches/0001-wda-add-option-for-enabling-flow-control.patch create mode 100644 package/network/utils/uqmi/patches/0002-uqmi-extend-get-data-format.patch create mode 100644 package/network/utils/uqmi/patches/0003-qmi-wda-add-qos-format.patch diff --git a/package/network/utils/uqmi/patches/0001-wda-add-option-for-enabling-flow-control.patch b/package/network/utils/uqmi/patches/0001-wda-add-option-for-enabling-flow-control.patch new file mode 100644 index 0000000000..d59dc32260 --- /dev/null +++ b/package/network/utils/uqmi/patches/0001-wda-add-option-for-enabling-flow-control.patch @@ -0,0 +1,111 @@ +From 7aef6458a03c81e4e8f5ac4a1c8c9c5425867f06 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Sun, 27 Jul 2025 21:10:53 +0200 +Subject: [PATCH 1/3] wda: add option for enabling flow-control + +In conjunction with QMAP, the modem can perform flow-control towards the +host. + +Add the necessary option for activating flow-control by configuring the +modem data format. + +Signed-off-by: David Bauer +--- + data/qmi-service-wda.json | 5 +++++ + uqmi/commands-wda.c | 23 +++++++++++++++++++++++ + uqmi/commands-wda.h | 2 ++ + 3 files changed, 30 insertions(+) + +diff --git a/data/qmi-service-wda.json b/data/qmi-service-wda.json +index ffa3e31..f64ec55 100644 +--- a/data/qmi-service-wda.json ++++ b/data/qmi-service-wda.json +@@ -89,6 +89,11 @@ + "mandatory" : "no", + "type" : "TLV", + "format" : "guint32" }, ++ { "name" : "Flow Control", ++ "id" : "0x1A", ++ "mandatory" : "no", ++ "type" : "TLV", ++ "format" : "guint8" }, + { "name" : "Uplink Data Aggregation Max Datagrams", + "id" : "0x1B", + "type" : "TLV", +diff --git a/uqmi/commands-wda.c b/uqmi/commands-wda.c +index ae7106e..fb205b4 100644 +--- a/uqmi/commands-wda.c ++++ b/uqmi/commands-wda.c +@@ -50,6 +50,7 @@ static struct { + uint32_t max_size_ul; + uint32_t max_datagrams_ul; + QmiWdaDataAggregationProtocol aggregation_protocol_ul; ++ int8_t flow_control; + } wda_aggregation_info = { + .max_size_dl = 0, + .max_datagrams_dl = 0, +@@ -57,6 +58,7 @@ static struct { + .max_size_ul = 0, + .max_datagrams_ul = 0, + .aggregation_protocol_ul = QMI_WDA_DATA_AGGREGATION_PROTOCOL_DISABLED, ++ .flow_control = -1, + }; + + #define cmd_wda_set_data_format_cb no_cb +@@ -75,6 +77,9 @@ cmd_wda_set_data_format_send(struct qmi_msg *msg, QmiWdaLinkLayerProtocol link_l + QMI_INIT(downlink_minimum_padding, 0), + }; + ++ if (wda_aggregation_info.flow_control >= 0) ++ qmi_set(&data_req, flow_control, wda_aggregation_info.flow_control); ++ + qmi_set_wda_set_data_format_request(msg, &data_req); + } + +@@ -185,6 +190,24 @@ static enum qmi_cmd_result cmd_wda_uplink_data_aggregation_max_size_prepare( + return QMI_CMD_DONE; + } + ++#define cmd_wda_flow_control_cb no_cb ++ ++static enum qmi_cmd_result cmd_wda_flow_control_prepare( ++ struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, ++ char *arg) ++{ ++ uint32_t val = strtoul(arg, NULL, 10); ++ ++ if (val != 0 && val != 1) { ++ uqmi_add_error("Invalid value (valid: 0, 1)"); ++ return QMI_CMD_EXIT; ++ } ++ ++ wda_aggregation_info.flow_control = !!val; ++ ++ return QMI_CMD_DONE; ++} ++ + static void + cmd_wda_get_data_format_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg) + { +diff --git a/uqmi/commands-wda.h b/uqmi/commands-wda.h +index b4876d5..c9b6828 100644 +--- a/uqmi/commands-wda.h ++++ b/uqmi/commands-wda.h +@@ -27,6 +27,7 @@ + __uqmi_command(wda_uplink_data_aggregation_protocol, ul-aggregation-protocol, required, CMD_TYPE_OPTION), \ + __uqmi_command(wda_uplink_data_aggregation_max_datagrams, ul-datagram-max-count, required, CMD_TYPE_OPTION), \ + __uqmi_command(wda_uplink_data_aggregation_max_size, ul-datagram-max-size, required, CMD_TYPE_OPTION), \ ++ __uqmi_command(wda_flow_control, flow-control, required, CMD_TYPE_OPTION), \ + __uqmi_command(wda_get_data_format, wda-get-data-format, no, QMI_SERVICE_WDA) + + +@@ -38,5 +39,6 @@ + " --ul-aggregation-protocol : Set uplink aggregation protocol (proto: tlp|qc-cm|mbim|rndis|qmap|qmapv5)\n" \ + " --ul-datagram-max-count : Set uplink aggregation max datagrams (number)\n" \ + " --ul-datagram-max-size : Set uplink aggregation max datagram size (bytes)\n" \ ++ " --flow-control : Enable flow-control (state: 0|1)\n" \ + " --wda-get-data-format: Get data format\n" \ + +-- +2.47.2 + diff --git a/package/network/utils/uqmi/patches/0002-uqmi-extend-get-data-format.patch b/package/network/utils/uqmi/patches/0002-uqmi-extend-get-data-format.patch new file mode 100644 index 0000000000..ef02e8fdd2 --- /dev/null +++ b/package/network/utils/uqmi/patches/0002-uqmi-extend-get-data-format.patch @@ -0,0 +1,85 @@ +From 65e5e2bf82a2a95ea3b44bbf6d0f35e372e90ed3 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Mon, 28 Jul 2025 03:57:24 +0200 +Subject: [PATCH 2/3] uqmi: extend get-data-format + +With QMAP, more settings for the modem data format are relevant. Include +them into the iget-data-foramt output. + +Signed-off-by: David Bauer +--- + uqmi/commands-wda.c | 52 +++++++++++++++++++++++++++++++++++---------- + 1 file changed, 41 insertions(+), 11 deletions(-) + +diff --git a/uqmi/commands-wda.c b/uqmi/commands-wda.c +index fb205b4..2f93c03 100644 +--- a/uqmi/commands-wda.c ++++ b/uqmi/commands-wda.c +@@ -208,23 +208,53 @@ static enum qmi_cmd_result cmd_wda_flow_control_prepare( + return QMI_CMD_DONE; + } + ++static const char * ++wda_link_layer_protocol_to_string(QmiWdaLinkLayerProtocol proto) ++{ ++ for (int i = 0; i < ARRAY_SIZE(link_modes); i++) { ++ if (link_modes[i].val == proto) ++ return link_modes[i].name; ++ } ++ return "unknown"; ++} ++ ++static const char * ++wda_data_aggregation_protocol_to_string(QmiWdaDataAggregationProtocol proto) ++{ ++ for (int i = 0; i < ARRAY_SIZE(aggregation_protocols); i++) { ++ if (aggregation_protocols[i].aggreg == proto) ++ return aggregation_protocols[i].name; ++ } ++ return "unknown"; ++} ++ + static void + cmd_wda_get_data_format_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg) + { + struct qmi_wda_get_data_format_response res; +- const char *name = "unknown"; +- int i; ++ void *root; + + qmi_parse_wda_get_data_format_response(msg, &res); +- for (i = 0; i < ARRAY_SIZE(link_modes); i++) { +- if (link_modes[i].val != res.data.link_layer_protocol) +- continue; +- +- name = link_modes[i].name; +- break; +- } +- +- blobmsg_add_string(&status, NULL, name); ++ root = blobmsg_open_table(&status, NULL); ++ blobmsg_add_u8(&status, "qos-format", res.data.qos_format); ++ blobmsg_add_string(&status, "link-layer-protocol", ++ wda_link_layer_protocol_to_string(res.data.link_layer_protocol)); ++ blobmsg_add_string(&status, "data-aggregation-protocol", ++ wda_data_aggregation_protocol_to_string(res.data.uplink_data_aggregation_protocol)); ++ blobmsg_add_u32(&status, "uplink-data-aggregation-max-datagrams", ++ res.data.uplink_data_aggregation_max_datagrams); ++ blobmsg_add_u32(&status, "uplink-data-aggregation-max-size", ++ res.data.uplink_data_aggregation_max_size); ++ blobmsg_add_string(&status, "downlink-data-aggregation-protocol", ++ wda_data_aggregation_protocol_to_string(res.data.downlink_data_aggregation_protocol)); ++ blobmsg_add_u32(&status, "downlink-data-aggregation-max-datagrams", ++ res.data.downlink_data_aggregation_max_datagrams); ++ blobmsg_add_u32(&status, "downlink-data-aggregation-max-size", ++ res.data.downlink_data_aggregation_max_size); ++ blobmsg_add_u32(&status, "download-minimum-padding", ++ res.data.download_minimum_padding); ++ blobmsg_add_u8(&status, "flow-control", res.data.flow_control); ++ blobmsg_close_table(&status, root); + } + + static enum qmi_cmd_result +-- +2.47.2 + diff --git a/package/network/utils/uqmi/patches/0003-qmi-wda-add-qos-format.patch b/package/network/utils/uqmi/patches/0003-qmi-wda-add-qos-format.patch new file mode 100644 index 0000000000..ed63c093a6 --- /dev/null +++ b/package/network/utils/uqmi/patches/0003-qmi-wda-add-qos-format.patch @@ -0,0 +1,86 @@ +From f6ea5bece16e5270024c9885bce77ef60e74fb7a Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Mon, 28 Jul 2025 18:39:18 +0200 +Subject: [PATCH 3/3] qmi-wda: add qos-format + +--- + uqmi/commands-wda.c | 22 ++++++++++++++++++++++ + uqmi/commands-wda.h | 2 ++ + 2 files changed, 24 insertions(+) + +diff --git a/uqmi/commands-wda.c b/uqmi/commands-wda.c +index 2f93c03..62b185f 100644 +--- a/uqmi/commands-wda.c ++++ b/uqmi/commands-wda.c +@@ -51,6 +51,7 @@ static struct { + uint32_t max_datagrams_ul; + QmiWdaDataAggregationProtocol aggregation_protocol_ul; + int8_t flow_control; ++ int8_t qos_format; + } wda_aggregation_info = { + .max_size_dl = 0, + .max_datagrams_dl = 0, +@@ -59,6 +60,7 @@ static struct { + .max_datagrams_ul = 0, + .aggregation_protocol_ul = QMI_WDA_DATA_AGGREGATION_PROTOCOL_DISABLED, + .flow_control = -1, ++ .qos_format = -1, + }; + + #define cmd_wda_set_data_format_cb no_cb +@@ -79,6 +81,9 @@ cmd_wda_set_data_format_send(struct qmi_msg *msg, QmiWdaLinkLayerProtocol link_l + + if (wda_aggregation_info.flow_control >= 0) + qmi_set(&data_req, flow_control, wda_aggregation_info.flow_control); ++ ++ if (wda_aggregation_info.qos_format >= 0) ++ qmi_set(&data_req, qos_format, wda_aggregation_info.qos_format); + + qmi_set_wda_set_data_format_request(msg, &data_req); + } +@@ -208,6 +213,23 @@ static enum qmi_cmd_result cmd_wda_flow_control_prepare( + return QMI_CMD_DONE; + } + ++#define cmd_wda_qos_format_cb no_cb ++ ++static enum qmi_cmd_result cmd_wda_qos_format_prepare( ++ struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, ++ char *arg) ++{ ++ uint32_t val = strtoul(arg, NULL, 10); ++ ++ if (val != 0 && val != 1) { ++ uqmi_add_error("Invalid value (valid: 0, 1)"); ++ return QMI_CMD_EXIT; ++ } ++ ++ wda_aggregation_info.qos_format = !!val; ++ return QMI_CMD_DONE; ++} ++ + static const char * + wda_link_layer_protocol_to_string(QmiWdaLinkLayerProtocol proto) + { +diff --git a/uqmi/commands-wda.h b/uqmi/commands-wda.h +index c9b6828..b8a92ea 100644 +--- a/uqmi/commands-wda.h ++++ b/uqmi/commands-wda.h +@@ -28,6 +28,7 @@ + __uqmi_command(wda_uplink_data_aggregation_max_datagrams, ul-datagram-max-count, required, CMD_TYPE_OPTION), \ + __uqmi_command(wda_uplink_data_aggregation_max_size, ul-datagram-max-size, required, CMD_TYPE_OPTION), \ + __uqmi_command(wda_flow_control, flow-control, required, CMD_TYPE_OPTION), \ ++ __uqmi_command(wda_qos_format, qos-format, required, CMD_TYPE_OPTION), \ + __uqmi_command(wda_get_data_format, wda-get-data-format, no, QMI_SERVICE_WDA) + + +@@ -40,5 +41,6 @@ + " --ul-datagram-max-count : Set uplink aggregation max datagrams (number)\n" \ + " --ul-datagram-max-size : Set uplink aggregation max datagram size (bytes)\n" \ + " --flow-control : Enable flow-control (state: 0|1)\n" \ ++ " --qos-format : Enable QoS format (state: 0|1)\n" \ + " --wda-get-data-format: Get data format\n" \ + +-- +2.47.2 + -- 2.30.2