From: David Bauer Date: Sun, 27 Jul 2025 19:10:53 +0000 (+0200) Subject: wda: add option for enabling flow-control X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=7aef6458a03c81e4e8f5ac4a1c8c9c5425867f06;p=project%2Fuqmi.git 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 --- 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" \