wda: add option for enabling flow-control
authorDavid Bauer <[email protected]>
Sun, 27 Jul 2025 19:10:53 +0000 (21:10 +0200)
committerDavid Bauer <[email protected]>
Mon, 28 Jul 2025 20:09:36 +0000 (22:09 +0200)
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 <[email protected]>
data/qmi-service-wda.json
uqmi/commands-wda.c
uqmi/commands-wda.h

index ffa3e3191fdda207372d2bf3776a953044f0be74..f64ec55bc7663c57ecb897790a9e3fff54325409 100644 (file)
                      "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",
index ae7106ebde5fa64362357a4e4cea94a7bd4c72fe..fb205b4ff4c9e39d6fc6119f2a31ac5df28ba2d9 100644 (file)
@@ -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)
 {
index b4876d517c69b7e81e1695de2ad7e80072601413..c9b6828242f703b2c04851468e8ae8fdb06dd61b 100644 (file)
@@ -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 <proto>:        Set uplink aggregation protocol (proto: tlp|qc-cm|mbim|rndis|qmap|qmapv5)\n" \
                "    --ul-datagram-max-count <count>:          Set uplink aggregation max datagrams (number)\n" \
                "    --ul-datagram-max-size <size>:            Set uplink aggregation max datagram size (bytes)\n" \
+               "    --flow-control <state>:                   Enable flow-control (state: 0|1)\n" \
                "  --wda-get-data-format:                      Get data format\n" \