diff mbox series

[01/11] gobi: Limit number of premultiplexed contexts to 4

Message ID 20240709225047.1427626-1-denkenz@gmail.com (mailing list archive)
State Superseded
Commit 3076113d2867953ab2466de469ffbe8512e56df7
Headers show
Series [01/11] gobi: Limit number of premultiplexed contexts to 4 | expand

Commit Message

Denis Kenzior July 9, 2024, 10:50 p.m. UTC
4 was chosen somewhat arbitrarily, but it is the maximum that the
qmi_wwan_q driver can support out of the box.  The only limit is the
number of clients under QMI.  Two WDS clients are typically required for
each active context, one for IPv4 and one for IPv6.  The total number of
clients cannot exceed 255 (uint8).
---
 plugins/gobi.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Comments

patchwork-bot+ofono@kernel.org July 11, 2024, 5:53 p.m. UTC | #1
Hello:

This series was applied to ofono.git (master)
by Denis Kenzior <denkenz@gmail.com>:

On Tue,  9 Jul 2024 17:50:20 -0500 you wrote:
> 4 was chosen somewhat arbitrarily, but it is the maximum that the
> qmi_wwan_q driver can support out of the box.  The only limit is the
> number of clients under QMI.  Two WDS clients are typically required for
> each active context, one for IPv4 and one for IPv6.  The total number of
> clients cannot exceed 255 (uint8).
> ---
>  plugins/gobi.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)

Here is the summary with links:
  - [01/11] gobi: Limit number of premultiplexed contexts to 4
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=3076113d2867
  - [02/11] gobi: Request dedicated WDS services for contexts
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=a47296c79b10
  - [03/11] qmi: Enable _auto_ use for some classes
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=b46004b53763
  - [04/11] qmi: gprs-context: Declare qmi_service objects using _auto_
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=766aa0ac819d
  - [05/11] qmi: Pass two dedicated WDS services to gprs-context
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=151823bdc330
  - [06/11] qmi: gprs-context: Remove parsing of unused TLVs
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=4921cfec9723
  - [07/11] qmi: gprs-context: Treat IP family TLV as mandatory
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=90db5ebd6aef
  - [08/11] qmi: gprs-context: Set up WDS service for IPv6
    (no matching commit)
  - [09/11] qmi: gprs-context: refactor detach_shutdown path
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=d617baf9e089
  - [10/11] qmi: gprs-context: refactor deactivate_primary
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=f25f481d45e8
  - [11/11] qmi: gprs-context: Dual-Stack context activation support
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=3ee784aa9d9c

You are awesome, thank you!
diff mbox series

Patch

diff --git a/plugins/gobi.c b/plugins/gobi.c
index 88e4c7fc4887..b6df849de47e 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -55,6 +55,8 @@ 
 #define GOBI_VOICE	(1 << 6)
 #define GOBI_WDA	(1 << 7)
 
+#define MAX_CONTEXTS 4
+
 struct service_request {
 	struct qmi_service **member;
 	uint32_t service_type;
@@ -75,6 +77,7 @@  struct gobi_data {
 	int num_service_requests;
 	unsigned long features;
 	unsigned int discover_attempts;
+	uint8_t n_premux;
 	uint8_t oper_mode;
 	int main_net_ifindex;
 	char main_net_name[IFNAMSIZ];
@@ -124,6 +127,7 @@  static int gobi_probe(struct ofono_modem *modem)
 	const char *ifname;
 	int ifindex;
 	const char *bus;
+	int n_premux;
 
 	DBG("%p", modem);
 
@@ -132,10 +136,11 @@  static int gobi_probe(struct ofono_modem *modem)
 	ifname = ofono_modem_get_string(modem, "NetworkInterface");
 	ifindex = ofono_modem_get_integer(modem, "NetworkInterfaceIndex");
 	bus = ofono_modem_get_string(modem, "Bus");
+	n_premux = ofono_modem_get_integer(modem, "NumPremuxInterfaces");
 
 	DBG("net: %s[%s](%d) %s", ifname, if_driver, ifindex, bus);
 
-	if (!if_driver || !ifname || !ifindex || !bus)
+	if (!if_driver || !ifname || !ifindex || !bus || n_premux < 0)
 		return -EPROTO;
 
 	data = l_new(struct gobi_data, 1);
@@ -145,6 +150,13 @@  static int gobi_probe(struct ofono_modem *modem)
 	else if (!strcmp(if_driver, "qmi_wwan"))
 		data->using_qmi_wwan = true;
 
+	if (n_premux > MAX_CONTEXTS) {
+		l_warn("NumPremuxInterfaces > %d, limiting to %d",
+				MAX_CONTEXTS, MAX_CONTEXTS);
+		n_premux = MAX_CONTEXTS;
+	}
+
+	data->n_premux = n_premux;
 	data->main_net_ifindex =
 		ofono_modem_get_integer(modem, "NetworkInterfaceIndex");
 	l_strlcpy(data->main_net_name,
@@ -753,7 +765,6 @@  static void gobi_pre_sim(struct ofono_modem *modem)
 static void gobi_setup_gprs(struct ofono_modem *modem)
 {
 	struct gobi_data *data = ofono_modem_get_data(modem);
-	int n_premux = ofono_modem_get_integer(modem, "NumPremuxInterfaces");
 	struct ofono_gprs *gprs;
 	struct ofono_gprs_context *gc;
 	const char *interface;
@@ -770,7 +781,7 @@  static void gobi_setup_gprs(struct ofono_modem *modem)
 	}
 
 	/* Simple case of 802.3 interface, no QMAP */
-	if (n_premux == 0) {
+	if (data->n_premux == 0) {
 		interface = ofono_modem_get_string(modem, "NetworkInterface");
 
 		gc = ofono_gprs_context_create(modem, 0, "qmimodem", -1,
@@ -793,7 +804,7 @@  static void gobi_setup_gprs(struct ofono_modem *modem)
 		ofono_modem_get_integer(modem, "MaxAggregationSize");
 	DBG("max_aggregation_size: %u", data->max_aggregation_size);
 
-	for (i = 0; i < n_premux; i++) {
+	for (i = 0; i < data->n_premux; i++) {
 		int mux_id;
 
 		sprintf(buf, "PremuxInterface%dMuxId", i + 1);