Add QMI Device Service Request Rate-limit Option
v2 cover Add QMI Device Service Request Rate-limit Option
Certain modems, among them the Quectel Wireless Solutions Co., Ltd. (2c7c) BG96 CAT-M1/NB-IoT modem (0296), have a firmware issue where they can lock up and hang (not responding to subsequent commands) due to high QMI service request arrival rates.
QMI service request rate limiting is achieved by:
1. Adding a new, optional options structure to qmi_qmux_device_new that has its rate-limit "quirk" and minimum request period fields set when the modem "RequestThrottleTimeUs" integer property is set.
2. Adding logic to the QMI driver that, when a minimum request period is set, limits the QMI service request rate accordingly.
(1) and (2) are used by the udevng and gobi plugins such that when the modem vendor and model match 2c7c/0296, then the option to rate limit QMI service requests is set to no more than one every 2,000 us.
Grant Erickson (7):
qmi: Added enumeration for device quirk flags.
qmi: Added structure for device options.
qmi: Added device options parameter to 'qmi_qmux_device_new'.
qmi: Implement QMI service request rate limiting in 'can_write_data'.
qmi: Handle request rate limit option in 'qmi_qmux_device_new'.
udevng: Set the QMI minimum service request period for Quectel BG96
modems.
gobi: Pass QMI qmux device options to 'qmi_qmux_device_new'.
drivers/qmimodem/qmi.c | 45 +++++++++++++++++++++++++++++++++++++++++- drivers/qmimodem/qmi.h | 40 ++++++++++++++++++++++++++++++++++++- plugins/gobi.c | 22 ++++++++++++++++++++- plugins/udevng.c | 14 +++++++++++++ 4 files changed, 118 insertions(+), 3 deletions(-)
Signature · 1 line
2.45.0
PATCH v2 1/7 qmi: Added enumeration for device quirk flags.
Defines device-specific "quirks" that may alter the default behavior of the QMI driver for a specific, instantiated device.
--- drivers/qmimodem/qmi.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/qmimodem/qmi.h +18 -0
@@ -56,6 +56,24 @@ enum qmi_error { QMI_ERROR_INVALID_QMI_COMMAND = 71, }; +/** +* This defines device-specific "quirks" that may alter the default +* behavior of the QMI driver for a specific, instantiated device. +*/ +enum qmi_qmux_device_quirk { +/** +* The device has no "quirks". +*/ +QMI_QMUX_DEVICE_QUIRK_NONE =0x00 , + +/** +* The device has a "quirk" where it can lock up and hang (not +* responding to subsequent commands) due to high QMI service +* request arrival rates. +*/ +QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT =0x01 +}; +typedef void (*qmi_destroy_func_t )(void *user_data);struct qmi_service ;
Signature · 1 line
2.45.0
PATCH v2 2/7 qmi: Added structure for device options.
In reply to Grant EricksonDefines options that may alter the default behavior of the QMI driver for a specific, instantiated device.
--- drivers/qmimodem/qmi.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/qmimodem/qmi.h +19 -0
@@ -74,6 +74,25 @@ enum qmi_qmux_device_quirk { QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT = 0x01 }; +/** +* Defines options that may alter the default behavior of the QMI +* driver for a specific, instantiated device. +*/ +struct qmi_qmux_device_options { +/** +* Device-specific "quirk". +*/ +enum qmi_qmux_device_quirk quirks; + +/** +* If quirks has #QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT set, this +* is the minimum period, in microseconds, in which back-to-back +* QMI service requests may be sent to avoid triggering a +* firmware lock up and hang. +*/ +unsigned int min_req_period_us; +}; +typedef void (*qmi_destroy_func_t )(void *user_data);struct qmi_service ;
Signature · 1 line
2.45.0
PATCH v2 3/7 qmi: Added device options parameter to 'qmi_qmux_device_new'.
In reply to Grant EricksonAn optional pointer to immutable device options that may alter the default behavior of the QMI driver for the instantiated device.
--- drivers/qmimodem/qmi.c | 3 ++- drivers/qmimodem/qmi.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/qmimodem/qmi.c +2 -1
@@ -1567,7 +1567,8 @@ static const struct qmi_transport_ops qmux_ops = { .write = qmi_qmux_device_write, }; -struct qmi_qmux_device *qmi_qmux_device_new (const char *device) +struct qmi_qmux_device *qmi_qmux_device_new (const char *device, +const struct qmi_qmux_device_options *options) {struct qmi_qmux_device *qmux;int fd;
drivers/qmimodem/qmi.h +2 -1
@@ -107,7 +107,8 @@ typedef void (*qmi_qrtr_node_lookup_done_func_t)(void *);typedef void (*qmi_service_result_func_t )(struct qmi_result *,void *); -struct qmi_qmux_device *qmi_qmux_device_new (const char *device); +struct qmi_qmux_device *qmi_qmux_device_new (const char *device, +const struct qmi_qmux_device_options *options);void qmi_qmux_device_free (struct qmi_qmux_device *qmux);void qmi_qmux_device_set_debug (struct qmi_qmux_device *qmux,qmi_debug_func_t func,void *user_data);
Signature · 1 line
2.45.0
PATCH v2 4/7 qmi: Implement QMI service request rate limiting in 'can_write_data'.
In reply to Grant EricksonDetermine if we need to rate-limit QMI services requests to a transport-specific minimum request period. If so, return true so that the queue can be retried again later.
Adds the following data members to 'qmi_transport':
* Minimum request period
- The minimum period, in microseconds, for back-to-back QMI service requests.
* Last request time
- Time, in microseconds, when the last QMI service request was sent.
to support the implementation.
--- drivers/qmimodem/qmi.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/qmimodem/qmi.c +32 -0
@@ -92,6 +92,18 @@ struct qmi_transport {const struct qmi_transport_ops *ops;struct debug_data debug; bool writer_active : 1; + +/** +* If specified via qmi_qmux_device_options, the minimum period +* for back-to-back QMI service requests. +*/ +unsigned int min_req_period_us; + +/** +* The time, in microseconds, when the last QMI service request +* was sent. +*/ +uint64_t last_req_sent_time_us; };struct qmi_qmux_device {
@@ -653,8 +665,25 @@ static bool can_write_data(struct l_io *io, void *user_data) {struct qmi_transport *transport = user_data;struct qmi_request *req; +const bool throttle_enabled = transport->min_req_period_us >0 ; +uint64_t now; +uint64_t delta;int r; +/* +* Determine if we need to rate-limit commands to a +* transport-specific minimum request period. If so, +* return true so that the queue can be retried again +* later. +*/ +if (throttle_enabled && transport->last_req_sent_time_us !=0 ) { + now =l_time_now (); + delta =l_time_diff (now, transport->last_req_sent_time_us); + +if (delta < transport->min_req_period_us) +return true; + } + req =l_queue_pop_head (transport->req_queue);if (!req)return false;
@@ -665,6 +694,9 @@ static bool can_write_data(struct l_io *io, void *user_data)return false; } +if (throttle_enabled) + transport->last_req_sent_time_us = now; +if (l_queue_length (transport->req_queue) >0 )return true;
Signature · 1 line
2.45.0
PATCH v2 5/7 qmi: Handle request rate limit option in 'qmi_qmux_device_new'.
In reply to Grant EricksonIf options are specified and QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT is asserted, set the qmux transport minimum service request period from the specified options.
--- drivers/qmimodem/qmi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/qmimodem/qmi.c +10 -0
@@ -1611,6 +1611,16 @@ struct qmi_qmux_device *qmi_qmux_device_new(const char *device, qmux = l_new(struct qmi_qmux_device, 1); +if (options !=NULL ) { +if ((options->quirks &QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT ) + ==QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT ) { + qmux->transport.min_req_period_us = options->min_req_period_us; + +ofono_info ("QMI minimum service request period %u us" , + qmux->transport.min_req_period_us); + } + } +if (qmi_transport_open (&qmux->transport, fd, &qmux_ops) <0 ) {close (fd);l_free (qmux);
Signature · 1 line
2.45.0
PATCH v2 6/7 udevng: Set the QMI minimum service request period for Quectel BG96 modems.
In reply to Grant EricksonThe Quectel Wireless Solutions Co., Ltd. (2c7c) BG96 CAT-M1/NB-IoT modem (0296) has a firmware issue where it can lock up and hang (not responding to subsequent commands) due to high QMI service request arrival rates. If the vendor and model match those, then rate limit QMI service requests to no more than one every 2,000 us.
--- plugins/udevng.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
plugins/udevng.c +14 -0
@@ -1118,6 +1118,20 @@ static gboolean setup_quectelqmi(struct modem_info *modem)DBG ("%s" , modem->syspath); +/* +* The Quectel Wireless Solutions Co., Ltd. (2c7c) BG96 +* CAT-M1/NB-IoT modem (0296) has a firmware issue where it can +* lock up and hang (not responding to subsequent commands) due to +* high QMI service request arrival rates. If the vendor and model +* match those, then rate limit QMI service requests to no more +* than one every 2,000 us. +*/ +if (l_streq0 (modem->vendor,"2c7c" )) { +if (l_streq0 (modem->model,"0296" )) +ofono_modem_set_integer (modem->modem, +"RequestThrottleTimeUs" ,2000 ); + } +for (list = modem->devices; list; list =g_slist_next (list)) {const struct device_info *info = list->data; const char *subsystem =
Signature · 1 line
2.45.0
PATCH v2 7/7 gobi: Pass QMI qmux device options to 'qmi_qmux_device_new'.
In reply to Grant EricksonIf the QMI minimum service request period property is set on the modem object, then set the appropriate QMI QMUX device option quirk and value.
--- plugins/gobi.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
plugins/gobi.c +21 -1
@@ -842,9 +842,19 @@ error:__shutdown_device (modem); } +/* +* Enable the modem. The following modem properties are optionally set: +* +* RequestThrottleTimeUs +* The minimum period, in microseconds, in which back-to-back * +* modem service requests may be sent. +* +*/ static int gobi_enable (struct ofono_modem *modem) {struct gobi_data *data =ofono_modem_get_data (modem); +struct qmi_qmux_device_options options = {QMI_QMUX_DEVICE_QUIRK_NONE ,0 }; +int min_req_period_us;const char *device;DBG ("%p" , modem);
@@ -853,7 +863,17 @@ static int gobi_enable(struct ofono_modem *modem)if (!device)return -EINVAL ; - data->device =qmi_qmux_device_new (device); +/* +* If the QMI minimum service request period property is set, then +* set the appropriate QMI QMUX device quirk and value. +*/ + min_req_period_us =ofono_modem_get_integer (modem,"RequestThrottleTimeUs" ); +if (min_req_period_us >0 ) { + options.quirks |=QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT ; + options.min_req_period_us = min_req_period_us; + } + + data->device =qmi_qmux_device_new (device, &options);if (!data->device)return -EIO ;
Signature · 1 line
2.45.0
Re: [PATCH v2 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data'.
In reply to Grant EricksonHi Grant,
Quoted 69 lines · Grant Erickson
Determine if we need to rate-limit QMI services requests to a transport-specific minimum request period. If so, return true so that the queue can be retried again later.
Adds the following data members to '
qmi_transport':* Minimum request period
- The minimum period, in microseconds, for back-to-back QMI service requests.* Last request time
- Time, in microseconds, when the last QMI service request was sent.to support the implementation.
--- drivers/qmimodem/qmi.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)drivers/qmimodem/qmi.c +29
-0@@ -92,6 +92,18 @@ struct qmi_transport {const struct qmi_transport_ops *ops;struct debug_data debug; bool writer_active : 1; + +/** +* If specified via qmi_qmux_device_options, the minimum period +* for back-to-back QMI service requests. +*/ +unsigned int min_req_period_us; + +/** +* The time, in microseconds, when the last QMI service request +* was sent. +*/ +uint64_t last_req_sent_time_us; };struct qmi_qmux_device {@@ -653,8 +665,25 @@ static bool can_write_data(struct l_io *io, void *user_data) {struct qmi_transport *transport = user_data;struct qmi_request *req; +const bool throttle_enabled = transport->min_req_period_us >0 ; +uint64_t now; +uint64_t delta;int r; +/* +* Determine if we need to rate-limit commands to a +* transport-specific minimum request period. If so, +* return true so that the queue can be retried again +* later. +*/ +if (throttle_enabled && transport->last_req_sent_time_us !=0 ) { + now =l_time_now (); + delta =l_time_diff (now, transport->last_req_sent_time_us); + +if (delta < transport->min_req_period_us) +return true; + } + req =l_queue_pop_head (transport->req_queue);if (!req)return false;
drivers/qmimodem/qmi.c static bool can_write_data(struct l_io *io, void *user_data) · line 698
Quoted 5 lines
drivers/qmimodem/qmi.c +2
-0@@ -665,6 +694,9 @@ static bool can_write_data(struct l_io *io, void *user_data)return false; } +if (throttle_enabled) + transport->last_req_sent_time_us = now;
Pretty sure this won't work and gcc will complain. Compilers are still not great at tying together multiple conditionals... You might still be better off keeping this inside the if() you added above...
Also, don't you need last_req_sent_time_us to be initialized to be non-zero somehow? Otherwise it is dumb luck that last_req_sent_time_us is set to anything the first time (probably garbage data)
Confirmed. CI complains:
Alpine (musl) gcc optimized
===========================
Configure: PASS
Build: FAIL
drivers/qmimodem/qmi.c: In function 'can_write_data':
drivers/qmimodem/qmi.c:698:50: error: 'now' may be used uninitialized
[-Werror=maybe-uninitialized]
698 | transport->last_req_sent_time_us = now;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ drivers/qmimodem/qmi.c:669:18: note: 'now' was declared here
669 | uint64_t now;
| ^~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:4090: drivers/qmimodem/qmi.o] Error 1 make[1]: Target 'all-am' not remade because of errors.
make: *** [Makefile:2405: all] Error 2
drivers/qmimodem/qmi.c static bool can_write_data(struct l_io *io, void *user_data) · line 702
Quoted 4 lines
drivers/qmimodem/qmi.c +1
-0+if (l_queue_length (transport->req_queue) >0 )return true;
Regards,
-Denis
Re: [PATCH v2 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data'.
Quoted 37 lines · Denis Kenzior
Quoted 36 lines · Grant Erickson
Determine if we need to rate-limit QMI services requests to a transport-specific minimum request period. If so, return true so that the queue can be retried again later.
Adds the following data members to 'qmi_transport':
* Minimum request period
- The minimum period, in microseconds, for back-to-back QMI service requests.
* Last request time
- Time, in microseconds, when the last QMI service request was sent.
to support the implementation.
---drivers/qmimodem/qmi.c +16
-0@@ -653,8 +665,25 @@ static bool can_write_data(struct l_io *io, void *user_data) {struct qmi_transport *transport = user_data;struct qmi_request *req; +const bool throttle_enabled = transport->min_req_period_us >0 ; +uint64_t now; +uint64_t delta;int r; +/* +* Determine if we need to rate-limit commands to a +* transport-specific minimum request period. If so, +* return true so that the queue can be retried again +* later. +*/ + if (throttle_enabled && transport->last_req_sent_time_us != 0) { + now =l_time_now (); + delta =l_time_diff (now, transport->last_req_sent_time_us); + +if (delta < transport->min_req_period_us) +return true; + } + req =l_queue_pop_head (transport->req_queue);if (!req)
Quoted 8 lines
drivers/qmimodem/qmi.c static bool can_write_data(struct l_io *io, void *user_data) · line 697
Quoted 6 lines
drivers/qmimodem/qmi.c +1
-0return false;@@ -665,6 +694,9 @@ static bool can_write_data(struct l_io *io, void *user_data)return false; } + if (throttle_enabled) + transport->last_req_sent_time_us = now;Pretty sure this won't work and gcc will complain.
Surprisingly, GCC 8.2.0 didn’t squawk about it:
% ${SYSROOT}usr/bin/arm-dey-linux-gnueabi/arm-dey-linux-gnueabi-gcc --version arm-dey-linux-gnueabi-gcc (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% ${SYSROOT}usr/bin/arm-dey-linux-gnueabi/arm-dey-linux-gnueabi-gcc
-DHAVE_CONFIG_H -I. -I${PROJECTROOT}third_party/ofono/repo -I./include -I./src -I${PROJECTROOT}third_party/ofono/repo/src
-I${PROJECTROOT}third_party/ofono/repo/gdbus
-I${PROJECTROOT}third_party/ofono/repo/gisi
-I${PROJECTROOT}third_party/ofono/repo/gatchat
-I${PROJECTROOT}third_party/ofono/repo/gril --sysroot=${PROJECTROOT}rootfs
-isystem ${SYSROOT}usr/include -I${PROJECTROOT}results/${BUILDPRODUCT}/digi/dey/8.2.0/${BUILDCONFIG}/third_party/linux/linux-dey/include -I${PROJECTROOT}results/${BUILDPRODUCT}/digi/dey/8.2.0/${BUILDCONFIG}/third_party/dbus/usr/include/dbus-1.0 -I${PROJECTROOT}results/${BUILDPRODUCT}/digi/dey/8.2.0/${BUILDCONFIG}/third_party/dbus/usr/lib/dbus-1.0/include -I${PROJECTROOT}results/${BUILDPRODUCT}/digi/dey/8.2.0/${BUILDCONFIG}/third_party/glib/usr/include/gio-unix-2.0 -I${PROJECTROOT}results/${BUILDPRODUCT}/digi/dey/8.2.0/${BUILDCONFIG}/third_party/glib/usr/include/glib-2.0 -I${PROJECTROOT}results/${BUILDPRODUCT}/digi/dey/8.2.0/${BUILDCONFIG}/third_party/glib/usr/lib/glib-2.0/include -I${PROJECTROOT}results/${BUILDPRODUCT}/digi/dey/8.2.0/${BUILDCONFIG}/third_party/ell/usr/include -I${PROJECTROOT}results/${BUILDPRODUCT}/digi/dey/8.2.0/${BUILDCONFIG}/third_party/eudev/usr/include -DOFONO_PLUGIN_BUILTIN -DPLUGINDIR=\""/usr/lib/ofono/plugins"\"
-DUNITDIR=\""./unit/"\" --sysroot=${PROJECTROOT}rootfs -mcpu=cortex-a8
-mfloat-abi=hard -mfpu=neon -fno-omit-frame-pointer -fno-strict-aliasing
-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MT drivers/qmimodem/qmi.o -MD -MP
-MF $depbase.Tpo -c -o drivers/qmimodem/qmi.o ${PROJECTROOT}third_party/ofono/repo/drivers/qmimodem/qmi.c && mv -f
$depbase.Tpo $depbase.Po
I’ve another evaluation branch with GCC 12.3.1. I’ll cross-check there.
Quoted 1 line
Compilers are still not great at tying together multiple conditionals... You might still be better off keeping this inside the
if()you added above...
There are two separate actions to be taken:
1. Performing the rate limit check before the request is dequeued and sent.
2. Setting the last sent time after the request is dequeued and successfully sent.
So, there need to be two, separate conditional blocks for each.
Quoted 1 line
Also, don't you need
last_req_sent_time_usto be initialized to be non-zero somehow? Otherwise it is dumb luck thatlast_req_sent_time_usis set to anything the first time (probably garbage data)
I thought about zero-initializing it in ‘qmi_qmux_device_new’; however, diving into the implementation of ‘l_new’, it appears as though all memory is zeroed out, so the zero-initialization seemed redundant.
I’ll have a v3 shortly based on the feedback from GCC 12.3.1.
Best,
Grant
Signature · 5 lines
Principal Nuovations [email protected] https://www.nuovations.com/
Re: [PATCH v2 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data'.
Quoted 6 lines · Grant Erickson
Quoted 1 line · Denis Kenzior
Pretty sure this won't work and gcc will complain.
Surprisingly, GCC 8.2.0 didn’t squawk about it:
Surprisingly, GCC 12.3.1 didn’t squawk about it either:
% ${SYSROOT}/bin/arm-none-linux-gnueabihf-gcc --version arm-none-linux-gnueabihf-gcc (Arm GNU Toolchain 12.3.Rel1 (Build arm-12.35)) 12.3.1 20230626 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
${SYSROOT}/bin/arm-none-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.
-I${PROJECTROOT}/third_party/ofono/repo -I./include -I./src
-I${PROJECTROOT}/third_party/ofono/repo/src
-I${PROJECTROOT}/third_party/ofono/repo/gdbus
-I${PROJECTROOT}/third_party/ofono/repo/gisi
-I${PROJECTROOT}/third_party/ofono/repo/gatchat
-I${PROJECTROOT}/third_party/ofono/repo/gril
--sysroot=${SYSROOT}/arm-none-linux-gnueabihf/libc
-D_POSIX_C_SOURCE=201112L -D_DEFAULT_SOURCE
-D_XOPEN_SOURCE -isystem ${SYSROOT}/arm-none-linux-gnueabihf/libc/usr/include -I${PROJECTROOT}/results/${BUILDPRODUCT}/arm/gnu-toolchain/12.3.1/${BUILDCONFIG}/third_party/linux/linux-dey/include -I${PROJECTROOT}/results/${BUILDPRODUCT}/arm/gnu-toolchain/12.3.1/${BUILDCONFIG}/third_party/dbus/usr/include/dbus-1.0 -I${PROJECTROOT}/results/${BUILDPRODUCT}/arm/gnu-toolchain/12.3.1/${BUILDCONFIG}/third_party/dbus/usr/lib/dbus-1.0/include -I${PROJECTROOT}/results/${BUILDPRODUCT}/arm/gnu-toolchain/12.3.1/${BUILDCONFIG}/third_party/glib/usr/include/gio-unix-2.0 -I${PROJECTROOT}/results/${BUILDPRODUCT}/arm/gnu-toolchain/12.3.1/${BUILDCONFIG}/third_party/glib/usr/include/glib-2.0 -I${PROJECTROOT}/results/${BUILDPRODUCT}/arm/gnu-toolchain/12.3.1/${BUILDCONFIG}/third_party/glib/usr/lib/glib-2.0/include -I${PROJECTROOT}/results/${BUILDPRODUCT}/arm/gnu-toolchain/12.3.1/${BUILDCONFIG}/third_party/ell/usr/include -I${PROJECTROOT}/results/${BUILDPRODUCT}/arm/gnu-toolchain/12.3.1/${BUILDCONFIG}/third_party/eudev/usr/include -DOFONO_PLUGIN_BUILTIN -DPLUGINDIR=\""/usr/lib/ofono/plugins"\" -DUNITDIR=\""./unit/"\" --sysroot=${SYSROOT}/arm-none-linux-gnueabihf/libc -mcpu=cortex-a8
-mfloat-abi=hard -mfpu=neon -fno-omit-frame-pointer -fno-strict-aliasing
-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MT drivers/qmimodem/qmi.o -MD -MP -MF
$depbase.Tpo -c -o drivers/qmimodem/qmi.o${PROJECTROOT}/third_party/ofono/repo/drivers/qmimodem/qmi.c &&\ mv -f
$depbase.Tpo $depbase.Po
Regardless, I’ll address it and have a v3 shortly.
Signature · 5 lines
Principal Nuovations [email protected] https://www.nuovations.com/
Re: [PATCH v2 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data'.
In reply to Grant EricksonHi Grant,
Quoted 5 lines
There are two separate actions to be taken:
1. Performing the rate limit check before the request is dequeued and sent.
2. Setting the last sent time after the request is dequeued and successfully sent.
I'd rearrange the whole thing such that 2 isn't needed. If you update the last sent time in 1, the worst that can happen is that the write() will fail. Which will probably trigger a socket close shortly afterward anyway.
Quoted 3 lines
So, there need to be two, separate conditional blocks for each.
Only if you want to deal with compiler warnings ;)
Quoted 3 lines
Quoted 1 line
Also, don't you need
last_req_sent_time_usto be initialized to be non-zero somehow? Otherwise it is dumb luck thatlast_req_sent_time_usis set to anything the first time (probably garbage data)I thought about zero-initializing it in ‘qmi_qmux_device_new’; however, diving into the
That is not what I'm talking about. l_new does indeed zero-initialize everything. Explicit init to 0 is not needed (or wanted). See my reply to v3.
implementation of ‘l_new’, it appears as though all memory is zeroed out, so the zero-initialization seemed redundant.
Quoted 1 line
Regards,
-Denis