From patchwork Thu Oct 31 22:06:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858387 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 150CA14A4F9 for ; Thu, 31 Oct 2024 22:06:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412406; cv=none; b=rg4VCx3hiTHXaZY9Lko36Ou53cg2XTfL1YVe966/e59ukHsUYGL94VUroYbcEKqAmnsbhgDJn/2KvepcI4/14ROnQjiAfIWSzT8btkzGuKqUBQkdhRHNbcbYcOKFQ2Kelcg5YkeW4x8jQSjRkOBVzDRhIWRJBNQuVr3n8LzDpL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412406; c=relaxed/simple; bh=ABxlf500HygPomN7AXYa0dFLPadkFJoUssczq47ZUJ0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=l59asW6dCJu+xGMJJ0B9iSVFZQuD1hrQrbIiUuTdlvfV0hVgqhxyYuT7x2Z9UmVBracNOeiMQUh5Fx9Wzrq4qOzOBCkz2jsQ9rHGb6hP9/Mofd1uAjPYKnRva5Fh4czQBYX4+h6Jr7/QynrmF1Ul5XFrv6ONVxe56JfsVhjzAIE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mFpcMzKA; arc=none smtp.client-ip=209.85.210.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mFpcMzKA" Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-71808e95ae2so967487a34.0 for ; Thu, 31 Oct 2024 15:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412400; x=1731017200; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mOC8H79dbjnvDjj4pELVeKMX9OKy9bpviIJPwtgwTZc=; b=mFpcMzKAlajBvCWuMDXcUkqlewFdyCFyDz6ptq9vLRGsyASHBkXcgP4kFJwRw5Dxb6 42voqqkRvDDyJZEIpm4vC5JCau46bjGcyITw35rM7UEVE074S2a0ZePXV9OQ50hm+zqY BNGtmFkWmqjn27BtmPVqx+XhDzz/JyAy/3LVzXiIDJZlT2Ua2Wx5GBq50R+QJhFjrUKu q2RdicHrUgAlL4Zl8N3pfsKXd7RiVkCb/p8dwSK8ACfYdRwXRcozUgux81ia4aobCW3g HvNDBRwYc92T6Nleqg6Qs6T+3RL3cFJdVttExBC1Sx6Oqy/p4YX07iUHNCDfkps6K7cU 7uAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412400; x=1731017200; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mOC8H79dbjnvDjj4pELVeKMX9OKy9bpviIJPwtgwTZc=; b=ZOwFJIdv/X/lN1azC/lA5qUqP6hMZzSnoJer2cnYLg1xwjflv1XDdNLqduRe7tfP3s 0f8eFiRukjyY+8Gs8m2nGFX0hbDjrJoS9AKZefl4ZgVTDHlyN7/deDmb/0zRfGVPsK44 XVUYzc6h6y3/Ibcm9lvIpHIQ6T5NLTD3w8xvdRwtvu8qoSE0q5ZEvcG5IM1VL7mfpywD PLVinYcd1w2BXbqUkpBqq7jwMM1yzw5hj/2JANp9WluI8FdfF6snVktmJP4P4Iiv/zNM 3i+dJnkYEgbmUEmjhIQAywWEtTsNQpT2xXUMKg+zrJEA5PJnNvuwgPhAZ+bsuUwNXcnu Tdtg== X-Gm-Message-State: AOJu0Ywz7IxwRrbee9rSZR6glgq69bQDCHc9kTQyE+bSrbxofs9obQDp vSPaaGgOJ+e7iMoL7YLF1+0twIQARWTVgcW+SfGbnsy/TmsW+1NDJuCGzQ== X-Google-Smtp-Source: AGHT+IGECVyA0uJNLsmVUhVDi0TguBeBwBKf8iqc1Iva99174OzHHVOjOZdVSzvMQNJTs5OWWaHWpw== X-Received: by 2002:a05:6830:3103:b0:717:f66a:9d21 with SMTP id 46e09a7af769-7189d679ccfmr1938431a34.16.1730412399978; Thu, 31 Oct 2024 15:06:39 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:39 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 01/13] qmi: validate TLV length Date: Thu, 31 Oct 2024 17:06:08 -0500 Message-ID: <20241031220638.1582166-1-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For qmi_result_get_(u)int[8,16,32], make sure that the length corresponds to the size of the basic type prior to performing the memcpy. --- drivers/qmimodem/qmi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 0ba2e8b9e352..10dbdaac8bf6 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -2311,7 +2311,7 @@ bool qmi_result_get_uint8(struct qmi_result *result, uint8_t type, return false; ptr = tlv_get(result->data, result->length, type, &len); - if (!ptr) + if (!ptr || len != sizeof(uint8_t)) return false; if (value) @@ -2330,7 +2330,7 @@ bool qmi_result_get_int16(struct qmi_result *result, uint8_t type, return false; ptr = tlv_get(result->data, result->length, type, &len); - if (!ptr) + if (!ptr || len != sizeof(int16_t)) return false; memcpy(&tmp, ptr, 2); @@ -2351,7 +2351,7 @@ bool qmi_result_get_uint16(struct qmi_result *result, uint8_t type, return false; ptr = tlv_get(result->data, result->length, type, &len); - if (!ptr) + if (!ptr || len != sizeof(uint16_t)) return false; memcpy(&tmp, ptr, 2); @@ -2373,7 +2373,7 @@ bool qmi_result_get_uint32(struct qmi_result *result, uint8_t type, return false; ptr = tlv_get(result->data, result->length, type, &len); - if (!ptr) + if (!ptr || len != sizeof(uint32_t)) return false; memcpy(&tmp, ptr, 4); @@ -2395,7 +2395,7 @@ bool qmi_result_get_uint64(struct qmi_result *result, uint8_t type, return false; ptr = tlv_get(result->data, result->length, type, &len); - if (!ptr) + if (!ptr || len != sizeof(uint64_t)) return false; memcpy(&tmp, ptr, 8); From patchwork Thu Oct 31 22:06:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858388 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA3A41BF311 for ; Thu, 31 Oct 2024 22:06:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412407; cv=none; b=IL7F1EcnBx5eJYQ5BPVCNwKnVHAecrtKr2mWbYzM+cdADICij/erGQ0B4dDGRIiMUJnV0F2BwYL4uEq/Vwnw/wa3XjwU/jTewSBAUWsLLGGFJSHLyIaHwVdYj/3EwaOWmUnFKVtvk7XEDr3YtcjH7phNTwb8iL/J91ACeX4BLaA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412407; c=relaxed/simple; bh=O9NDoYm5BfihaP6TQdznlFB2ncPu5Sx3anqsMe6AiWU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OirHIuKX8h72jvfHb9A5Y8iip+r/QrMkeWcbfQVcVD2b2MfF75eZLqU8rPe8mV7KuJo1+9B03bQ19ktSi3OF3snAYeV96N2hWL/zqVSe3SVQNjvYzIg9Adqsg3RMRY4EcJ1vruBHeIyyMRypSCCmEWRUD/ACs8u0oZcKRSVshDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QUzU/9/J; arc=none smtp.client-ip=209.85.210.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QUzU/9/J" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-7181eb9ad46so708542a34.1 for ; Thu, 31 Oct 2024 15:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412401; x=1731017201; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uTEFh79suQnSWdh1U1OosoBGup/bjYSedyxyg2O2A7g=; b=QUzU/9/JbPBGRD8FZmKvOAv/ICad/4DlLy9A6X/8jUDR2Zl7i5PoeTHPd2KxkAxKZ9 WdpVdeXdSV+XYKUXaZQk47ET7xuSF503oX91NecPFBWlqUjrZqVTLflZOgm2f9rF28sZ 8kAsudiBefvIdlG/hsXDl4AV/PRWwRTXlUWJamftxX38MjJXIB24wrXskv4XLPknk+HF 6Bkbp5wVOsjiXk8wZ71Hl4sFQxNY21tio2xYD9+icp465MdIj50YARgDRSEOQKBazG/X wYaySeYtPMz7iTqKFSYLxq5jJx7QZCL9AQ2xmM/6Diltbu4JhDdol03pFkbiSQbvIlbP kYmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412401; x=1731017201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uTEFh79suQnSWdh1U1OosoBGup/bjYSedyxyg2O2A7g=; b=tHMDYZdy8AJXmQz4RkM+SAq3H7eycgh5iJx8G+SzpkFZZ3QFk4Jgc5nmMD/Qf7L8/d qCyx5iU8oE2ZiWjBO7a7SzSUmgyvs4nk9bY7xjkVLNi+2vqEYJaWcCvGB/e9fTAJtRJl EAmb8dTMZASgajUsF4bEJoY5HI6QO+G3W1xl8gOC/bhkg1Bg+TtM6x6wE0DKr9AzUCFx K+rE736kCZOCnnfPLaYNuwNlbeCEChKg9FzdrBHo+fJdihbHqE1zzLB0ipS5O5M7eWqs QDqZBEI2rzpCsMl+u0NAsThUyOUd6Wfcp5ABb171U+V3P+sJwjAIISHfLzkL0rHzH46M +mfw== X-Gm-Message-State: AOJu0YzAdbkeDPeMrJZqGTlsXWwr4ZpyDNkmwV7dlmMEHbQ54e4P99sI j6CF3yqlUVpQGg+OEmWwxK8qQYK5BEWrkcox+wtfB5RCK1Tzvr/8U2Tfow== X-Google-Smtp-Source: AGHT+IEE6tEWTL7IyjNMDorF26XFyK3tOBed1gy115igVdZWts48yc+MM9Rz4ts0xH1hzv/gFknMrQ== X-Received: by 2002:a05:6830:6e91:b0:716:a8d5:d501 with SMTP id 46e09a7af769-71868229580mr21226051a34.19.1730412400710; Thu, 31 Oct 2024 15:06:40 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:40 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 02/13] gobi: Clear out service request queue on shutdown Date: Thu, 31 Oct 2024 17:06:09 -0500 Message-ID: <20241031220638.1582166-2-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Not doing so can result in a crash on subsequent .enable() calls ofonod[365853]: #0 0x743188e15ae0 in /usr/lib/libc.so.6 ofonod[365853]: #1 0x472b94 in request_service_cb() at plugins/gobi.c:475 ofonod[365853]: #2 0x45ce9f in qmux_create_client_callback() at drivers/qmimodem/qmi.c:1448 ofonod[365853]: #3 0x45bd87 in __rx_ctl_message() at drivers/qmimodem/qmi.c:993 ofonod[365853]: #4 0x45bf97 in received_qmux_data() at drivers/qmimodem/qmi.c:1041 ofonod[365853]: #5 0x597df3 in io_callback() at ell/io.c:105 (discriminator 1) ofonod[365853]: #6 0x59674a in l_main_iterate() at ell/main.c:461 ofonod[365853]: #7 0x508898 in event_check() at src/main.c:183 ofonod[365853]: #8 0x743189073ae1 in /usr/lib/libglib-2.0.so.0 ofonod[365853]: #9 0x7431890d4816 in /usr/lib/libglib-2.0.so.0 ofonod[365853]: #10 0x743189073787 in /usr/lib/libglib-2.0.so.0 ofonod[365853]: #11 0x508d35 in main() at src/main.c:302 ofonod[365853]: #12 0x743188dfec88 in /usr/lib/libc.so.6 ofonod[365853]: #13 0x743188dfed4c in /usr/lib/libc.so.6 --- plugins/gobi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/gobi.c b/plugins/gobi.c index cb20824cc424..b2c9c3d50ea4 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -251,6 +251,10 @@ static void shutdown_cb(void *user_data) DBG(""); data->discover_attempts = 0; + memset(&data->service_requests, 0, sizeof(data->service_requests)); + data->cur_service_request = 0; + data->num_service_requests = 0; + data->features = 0; qmi_qmux_device_free(data->device); data->device = NULL; From patchwork Thu Oct 31 22:06:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858389 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF0A91CCB4D for ; Thu, 31 Oct 2024 22:06:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412408; cv=none; b=n1A4oUqnobXSJkzrJTN9DWZYTYPXOS+bZhJVQ4igQ3zT7rrUVpIdHqAuQVhLWNFX+zggqamJUI6/NUKhgi0vV9lQMg6wSWn5sQVf2MMLEFyFuAXJkvoPc113gjq8FtD55leiHy0b2AO/FaJ4DnOuQ0kaGtF6isjgXxU1OUDyIZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412408; c=relaxed/simple; bh=boI1wG4U9fGqbhg9LryOgFjVggLT1YikhGc29SyY5IU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bc2od3JtlZbKZJPGvjQrvBCJ3tpx/aQwoXTxCH5xujtCXdQlDNKuMSl7ImFIDLmd+rn4ytTzoWz2LYMcqvtDfaYWU4qIRtEFlC8gs1K+jWHZn4py8QdctvrGQGByawHqA41taO3G8tW43JW02+FA6Hl0ww1EQ9kJ5O5k3vauK4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=B4eTt1fx; arc=none smtp.client-ip=209.85.167.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B4eTt1fx" Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3e602a73ba1so809208b6e.2 for ; Thu, 31 Oct 2024 15:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412401; x=1731017201; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dI+ujphGKonkH/pnb7/SHybvYXL4ovkTfulcizxQDCE=; b=B4eTt1fxPPK434cVl1wDVrAG+Og5mCAkqNlLT9Non03S3Rtchwe/6y4/I++QC8ESY2 DUa7nPX2olvwGTJvymdvpQSahcEce9D6BsPyIWcDFZjuRsqQXdDDkkfkP7s89rRiwVbi 2pTrmZNChyVdS220N5b2PbQYbW24LwGaOW3Io2JjGTulIloHi8tfZUPWdiqyBTfcWH7a Goa2aEloHRK6vOTi3aCZK+ubQ6wCtvv018bMuwZmIBEgqpif28Mn8eybArTUcBVU5Uys vhEgkNv3i0QyfoXaPtF1LQElkWr4qbYtMxHZg1hRdLJzeJ8exgWNmy2517uEMBxBRw9F XIag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412401; x=1731017201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dI+ujphGKonkH/pnb7/SHybvYXL4ovkTfulcizxQDCE=; b=R//0Jt7l6bC3ki5cseAT1YVJ+XjtbUD3IuzB6+YMxcl+5TAk1Cu9+I1g1OKVSDM2uB 6POcUhFH13huuBybn1/vmCjcQwr7YGUN3MNzG6sIdhObmy8ckTURa0Tw4WSRqz8mNud0 aAlgMn2jXDG060QVCLI0rVMhOvVzcTHYEhBQsAhbWv9bfdMgCmoVHggqOiToKIi3DYSy 5N0LDOakQdtcjEr3BKGyaEDh7qzdF3w7gdMP38WfytNm6u+KR1OE78BxyVM9d+9l8sb3 Hf7fas99fsMhUSdTmxSbVjPVYWgHiFx9q8Rqinq2y2REKYeqhLP2vBH5Hr7ralb+b4Iu 5+xg== X-Gm-Message-State: AOJu0Yyj/a60hR0IsqetKAw3IQVIj7g+0f1Sa6iebVsAKT7gZwloI7mE VEpoOOe/wE8egYqW28tY6UqZ9PSL3j9jElBImonPTWQsVFrVKpWwIawb6A== X-Google-Smtp-Source: AGHT+IHDkUxyDBHBI+dm0jFuvuXW+DZmmKzgu4gA/GzjYlRRkvgqY8MDiL02M85sYjYQLf2ZFRyJcA== X-Received: by 2002:a05:6830:2117:b0:710:f5bf:c4df with SMTP id 46e09a7af769-7189b55edcbmr5167460a34.30.1730412401590; Thu, 31 Oct 2024 15:06:41 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:41 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 03/13] simutil: Return early if file is not found Date: Thu, 31 Oct 2024 17:06:10 -0500 Message-ID: <20241031220638.1582166-3-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Certain Elementary Files are only present on SIM (2G) or USIMs (3G/4G). If the file is not relevant to a given generation, its parent2g or parent3g member will be set to 0. Return early if the file is found to be irrelevant for a given phase. This also fixes a runtime sanitizer warning: src/simutil.c:1345:10: runtime error: null pointer passed as argument 1, which is declared to never be null --- src/simutil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simutil.c b/src/simutil.c index a504e9aa8e3b..0fafcb7f77de 100644 --- a/src/simutil.c +++ b/src/simutil.c @@ -1302,7 +1302,7 @@ unsigned int sim_ef_db_get_path_2g(unsigned short id, unsigned char out_path[]) info = bsearch(GUINT_TO_POINTER((unsigned int) id), ef_db, nelem, sizeof(struct sim_ef_info), find_ef_by_id); - if (info == NULL) + if (info == NULL || !info->parent2g) return 0; path[i++] = info->parent2g & 0xff; @@ -1335,7 +1335,7 @@ unsigned int sim_ef_db_get_path_3g(unsigned short id, unsigned char out_path[]) info = bsearch(GUINT_TO_POINTER((unsigned int) id), ef_db, nelem, sizeof(struct sim_ef_info), find_ef_by_id); - if (info == NULL) + if (info == NULL || !info->parent3g) return 0; path[i++] = info->parent3g & 0xff; From patchwork Thu Oct 31 22:06:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858390 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34C041CCEF9 for ; Thu, 31 Oct 2024 22:06:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412408; cv=none; b=uFYISd0GzPIu1j84IhbX+20i0OFMHRcPa7jVMUnoTGdsPZ5JXCy+zWE2nG3kFvoT3n3SYnw2YjHVFxZKDy4WHrwe/tyoMFPVepHBO2IBfrXV4aVKJXoxmlW8QckFbh8oaTJXYX7KKHbDRQy5D2ZIKPtZo/iniw0E8wdNc5tcbhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412408; c=relaxed/simple; bh=Rn4LnbyVRXQkAnTgQMpL4dQobKY5k0oqcrqBfCad/Vw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l4Idd+sKT7v7bW2ZuYv0G2X7KaOzQPii4IyQ+NFjNcEHvlqfwvw/vgP4QH65Mndchu/Au8RbNRrerfBUOjiXzW5czl5wquGFF1e5SxaIGZKOKfzgcDGR/CPjmI0CtUxvW+QJB4BEW2OB+bfh4RmXLEwsxaNztRgpvjt2dxTsAtk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SA5Sh5BU; arc=none smtp.client-ip=209.85.210.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SA5Sh5BU" Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-7187e0041d5so824732a34.2 for ; Thu, 31 Oct 2024 15:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412402; x=1731017202; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=quuTVaKdgdLjjNyy8oNy0TPYvIzhDwJzO+pEs2vG6P8=; b=SA5Sh5BU885OLDLEvh/q6WLyEP0ZJSovOisyRVddXsVdlP51rV9PMHEmHmZOnRrz5Y DOepbAF2MbnOzoETyoshW/s1+IOV4+xmKWYYbMRXblYgGktJyhjDP5UHSLgy/f0gO7xz Cjx4l9wvGXVdSKtRRwNOGa45CKlnMHV0QS20veLHv+5yPLtp95RjhFiRXfVhFStdkDh7 OP9UJIvOADQS+meBZz4GWzkCp2ikrY1vv6GPtkSwPtArgBhCqzqNkN0kXNCr2vfDisN4 0jL/pN4K1Frs5KvoQmNnb9iKe1XJrdA3maKtCdwnh3p5LXKssB9BEj3/Nlg25a0iuhlL 6caw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412402; x=1731017202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=quuTVaKdgdLjjNyy8oNy0TPYvIzhDwJzO+pEs2vG6P8=; b=pf5EM/Xm7nFexJ76W2Obc7693yGDk2Qk7bMHciG7bEYufG3rc/jYgXxnwSwDJAXa2U eirEy/vJNMu3wWLRlBpoMfQhDitLyCyUGSgarBrIrYKzBS87JUfSXHBzKnjBN5ktD5y0 Q+baexnZqwvtSPoW8eAG+P1pHK71DQCRIuodmAN00AfJo6SY5an0hJHGyScHqzCfuQ11 yJqLUcJmh7f6jjLfeOK9WTswF1G6+FtQp82dL3SzP5L65mTDSN2RNh2pPC+OKv0k4VPJ mQl0Sx3GcpUvC2dDO4NjH5C6v6vB2MD3Xnjj9nqx51zbZ8qERLOhyJzKlVD/nLxos21z 6kng== X-Gm-Message-State: AOJu0YyjgLq1YMYVkooGmdh4j37zxUyw9jfnqm8yT6TVIY/40aQUxhxC pNH+olISDU0no7u96iTYbjSR2+Fdfvwi/12WpgQY7HnSc2V0jTLDAbtjKg== X-Google-Smtp-Source: AGHT+IEN3DULmtbEJShxnxbV9+DBike2gZN7M6tDF0e78ztEmwY1rblQenAJnoYjNQ2KnFdXXa3yqA== X-Received: by 2002:a05:6830:34a2:b0:718:9ae5:9030 with SMTP id 46e09a7af769-7189b4cb762mr4674757a34.4.1730412402182; Thu, 31 Oct 2024 15:06:42 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:41 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 04/13] simfs: Quiet sanitizer runtime error Date: Thu, 31 Oct 2024 17:06:11 -0500 Message-ID: <20241031220638.1582166-4-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The arguments passed into memcpy for src and 'n' are NULL pointer and 0 respectively. Strictly speaking null pointers should not be passed to memcpy, and this raises a sanitizer runtime error: src/simfs.c:1057:2: runtime error: null pointer passed as argument 2, which is declared to never be null Use the newly introduced l_memcpy function to avoid triggering the sanitizers --- src/simfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/simfs.c b/src/simfs.c index c86e8d11fd0b..7f0390032bf6 100644 --- a/src/simfs.c +++ b/src/simfs.c @@ -9,7 +9,6 @@ #include #endif -#include #include #include @@ -27,6 +26,8 @@ #include "storage.h" #include "missing.h" +#include + #define SIM_CACHE_MODE 0600 #define SIM_CACHE_BASEPATH STORAGEDIR "/%s-%i" #define SIM_CACHE_VERSION SIM_CACHE_BASEPATH "/version" @@ -1054,7 +1055,7 @@ int sim_fs_read(struct ofono_sim_context *context, int id, op->num_bytes = num_bytes; op->info_only = FALSE; op->context = context; - memcpy(op->path, path, path_len); + l_memcpy(op->path, path, path_len); op->path_len = path_len; g_queue_push_tail(fs->op_q, op); From patchwork Thu Oct 31 22:06:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858391 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEFEB1CCEFE for ; Thu, 31 Oct 2024 22:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412409; cv=none; b=dwNzPkAs3Y6EsZ1I4QITuES8q903vwe/s0Ke4Pe0rN6FWAZj9L9dC1fow98c6l0U+dbBXcJVuYHAGl5j/MOYuEyaFcZxyaCUDv4J8lVCZRRE7QNAIK2f8GKVcSNIirg7Ab2XwnJ/HKb2Yafob7nUbf3IDmi2+iiQ4zJC/OkwNak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412409; c=relaxed/simple; bh=KFXbQSNdIlyeuLbwZ5Oqf3Cb/uQ8X15h2jAUglUp4vs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RRJEm6GkTb9dAWbWWd/tL+hZ5rDNI4pJn3ySLft1FokDNFloiw8VO0iJixH6mmWjguwDSZdqNFaQ1n0RjD0phOfPUqVYHuleYCo91gYr/EqedG4hPsIn7qxp3gU9/SIvWzb0ak8Yu8y5hfnZZmcPqh4K3cb0LWPVJGGZTltEUxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Sbq/yYQi; arc=none smtp.client-ip=209.85.210.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sbq/yYQi" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-71808b6246bso776409a34.2 for ; Thu, 31 Oct 2024 15:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412403; x=1731017203; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YH7lAQDrcwy8/92b+wCUWPt52cL7l1PwGJU01s+beHI=; b=Sbq/yYQi7nfaIcAK9JNlxMIK0Nn2zLZ3Q58Hbboi0SmMkRW1UY/PHuAlf4xhnQrdgA 47LIAmf7I1RqnEP5dQmnGrlHOBa/+VkhZHO6D8h4lQ6KsZSuiO8W466zWFzT7J00iUXa eVE0/l1QWTVAkAUj6BeLcS1eIfMhVfxeArGrwaLTFYGSUGB2nsYcckW8D+NocFyQ8Ujp QfbP1Q3UN7i5fVOvVnIz6fPDaYrw5cXSeLxCufYSL1P+WROqi6Jl+xjw1HhSyZNpRZEn hTTQ//lqXQk1evhjjlszR4DLRHiBhj6UScJTV9AtzZC7Oim0yEjREzkj4qhIjKsgWe3/ jwSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412403; x=1731017203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YH7lAQDrcwy8/92b+wCUWPt52cL7l1PwGJU01s+beHI=; b=ZX1ETp3/tjg6dr8kXE25Ac14evZN0gbxdnOJ8zu9AbMkTDSQBx2euUpHBQ9Em5MnSj DtrRDWO5jBuCY8hxFEqUxrQh5Ous0+Id9ucWQpUiOyn/y+BmnLgXAaTwiQysKv68iGNS d1cDh589qS1hqlHZ6HYK1yN4JB5VvBKnW0aEIN7D2bK4wBvIlD147cjbG8H1FJd6z2KV 5VLUkiWjNRCwpp4iS15gMa8tV9wdUV5Bnn0Pp6Aoo8dS9BypqJcWemIYTq90qocTyyWP v2EOVjc5/uW9k993YY2lbIpE0BVxALaP0rMzyMgyBQCVNxnGi3oPIlnTNVUqil9eoKql 5fcQ== X-Gm-Message-State: AOJu0YxI+Q6Gk209TW8uxImqQ8GBUvnoKNYzK6I6CCtWpCCbITHcH6PD 49cePVZbNEilZz3rBQYjidVAW6l0ssxbhvCAtlT9hw0Y8pXCfl8so5Nkqg== X-Google-Smtp-Source: AGHT+IEtW4CviWZkyBphyXYIFS1S6Sis36ARQf+qqEyWFs8c9XznG5DNNj77ryAnVr/0fClj6TBODw== X-Received: by 2002:a05:6830:2682:b0:716:a8a7:fdd6 with SMTP id 46e09a7af769-719ca1c9d01mr1602988a34.18.1730412402924; Thu, 31 Oct 2024 15:06:42 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:42 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 05/13] radio-settings: quiet sanitizer runtime error Date: Thu, 31 Oct 2024 17:06:12 -0500 Message-ID: <20241031220638.1582166-5-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 src/radio-settings.c:241:17: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' --- src/radio-settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/radio-settings.c b/src/radio-settings.c index 1b56cad0a32a..588a355d4e40 100644 --- a/src/radio-settings.c +++ b/src/radio-settings.c @@ -238,7 +238,7 @@ static DBusMessage *radio_get_properties_reply(DBusMessage *msg, unsigned int i; for (i = 0; i < sizeof(uint32_t) * CHAR_BIT; i++) { - int tech = 1 << i; + unsigned int tech = 1U << i; if (!(rs->available_rats & tech)) continue; From patchwork Thu Oct 31 22:06:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858392 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91E791CDA09 for ; Thu, 31 Oct 2024 22:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412410; cv=none; b=iigrx1Oi17Hbo8ygW358CpmGuhES69vhuUM9FhHAhZ+LFDe0h+iO2DgTs8LoRTOSXd6yqEBz0OwU6NlQiGqraCxjADSIjqp33Qlfu0ytxf+eyWSaanJ+t0cBz5424raVGd2DHQL3aMw//OelJyr06CsA+ON1XgEm7kymxUsH7/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412410; c=relaxed/simple; bh=uDe06164osw9CYJb6V1iemGNHKns6Qcn22xEhdN8t1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nzvt+U23D3udU3Twg7gao3QCpIkGqj1nnSXdzLzmabXRYLcwxlitXupfOEZx6TMf6sUwGsooMqswdLDp1y2PB5T40JhgPxS2OWkveEFHbEwj0t0y7mJIWBgaZ9S3jMVOCwzHi4WSONQhOEJ/RdUFCL9QxZICA4j3nIOkKtnzXGo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QlddOOE4; arc=none smtp.client-ip=209.85.210.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QlddOOE4" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-718998df806so685183a34.1 for ; Thu, 31 Oct 2024 15:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412403; x=1731017203; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m3qofAtWOyRgEnqgVCcOgCIpCuNkP2HLFxPh3ZhjXXs=; b=QlddOOE4UxGiJRGFyZPytetRtGstzUsN3inKPF6ga+i/mTWNVzQUF78MBwsmfOgC80 sT16cwPd0B/a8tF9XRbfDrpnXUkEaWCKGGSLpSS6q5WzPS9F6XlSidymOO12kkMspatY 9ew8NJKbqKItDi+8hjlwwpKK7EQYRO4LhP/qGyKL/W7qBOkDSXW6kkit+d8JR6a0ARB8 QqPOmdpRq+Hd8Qpd9gCYPqFiY5FZpdCE14EGREZ++SRSG6cdKNi9sqL7IJ1HrmBryGr6 v/ET1kIVgyyO1HQ2SCAbSrz5cIuHgb2oCRLwb70kwrLt8dXQ+FiGJ2e0rtumAHvRij2S I0Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412403; x=1731017203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m3qofAtWOyRgEnqgVCcOgCIpCuNkP2HLFxPh3ZhjXXs=; b=sJs58HI6INeZxbKXun6xKVWiiqW+3UrNAkdzis04GLZxB/F8l7X5KBj2gieegg8iwQ sgl9oxrUYgs11TkPFMrHqAr7d4RHyMnck7y9L4vEqOLE+SKBKmiBeB7SKrgUnwKSdgTa WIQDqxJrRfcFQ0qfjGpzvTw4C3INHSIMZW8s9Byd6LpKi5NVnibpCV7GWZKi5MbakfKj 8KRZRiYlJu3WwpSfZd++OaFqKp1om0tt/2mpm076Gz8kKqkc+ods5WJfua5rXZUDy8cb ovmDgGGRyq3kS5IRY4Yb40jQKeL1nh3T7KylXOl1G9oVBzVpwBo6e6VIJ8BVGacejrh1 9ZRQ== X-Gm-Message-State: AOJu0YxlmrnnP22/bN0xuuuecQDF++rWkHVTJRN4aS+VYQc1pyCnMakX I8upASXlZA7Ah8qjxQBcXV7pgfIp9kT7GHriKFJunjTs0BHric8OCy9FHA== X-Google-Smtp-Source: AGHT+IHkWx3UeyDHAK3XZjvxDkLRcITWstzQPzneufNe2zabpNb1i6tHVMZKGx/sAjNiSVVwaRpt9g== X-Received: by 2002:a05:6830:4186:b0:718:d7c:2ef0 with SMTP id 46e09a7af769-719ca1d5640mr1680670a34.18.1730412403469; Thu, 31 Oct 2024 15:06:43 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:43 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 06/13] gprs: Default CID range to 1..NUM_CONTEXTS -1 Date: Thu, 31 Oct 2024 17:06:13 -0500 Message-ID: <20241031220638.1582166-6-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For those drivers where CIDs have no meaning (such as non-AT command based modems), set a default range between 1 and NUM_CONTEXTS - 1 (255). This allows the driver to omit this method invocation. --- src/gprs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gprs.c b/src/gprs.c index 3c71f8084417..c5287661b9d9 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -3082,6 +3082,7 @@ OFONO_DEFINE_ATOM_CREATE(gprs, OFONO_ATOM_TYPE_GPRS, { atom->status = NETWORK_REGISTRATION_STATUS_UNKNOWN; atom->netreg_status = -1; atom->used_pids = l_uintset_new(MAX_CONTEXTS); + atom->used_cids = l_uintset_new_from_range(1, MAX_CONTEXTS - 1); }) static void netreg_watch(struct ofono_atom *atom, From patchwork Thu Oct 31 22:06:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858393 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EB591CDA23 for ; Thu, 31 Oct 2024 22:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412410; cv=none; b=cIg91DFqmUKqrmrpOxxc5SAH8liV/2vsGMGBL+vWiu3pPhF58RbYEtfUXiqgmn0XKp6A5gGVTOV8+RmuBvZIeSR6FIQuV5vt5WUVOsB/3qZGsUteZHxYqAjwny9sL+Tz2sGbrR9xdh/eqLFsyKY3Z+a0TF2h++40S0Qmopqqt5E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412410; c=relaxed/simple; bh=ymBrO29EQNE22bwAZUP9hexAj7y+kzTIolfa/4NXhKg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=he+/3fUCPCE/YVVIC8elw263YH5mBCa5ogW+ALFdwWcyPBSdEMEqP7Upal3Z+JlMZZnIXJJRZ348/5rB3OtZe2qoqMsICaDOsLXZb5IMsT28VeAyOL5/2riHaqlDwdCxJAwWZP9ERppbSpPXIEvQaMmfUEo9AwilMpQl8Rq+p/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O2NmI4BZ; arc=none smtp.client-ip=209.85.210.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O2NmI4BZ" Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-7180e07185bso566064a34.3 for ; Thu, 31 Oct 2024 15:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412404; x=1731017204; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XphyHCtUmZAps71O90LdJfKFfRsLf2MdQS1KVa0Cufg=; b=O2NmI4BZASLgmEyWpQnhmDvrI7fb9UplOyM+JqqtsLjTu16cZSsI771LS3WuQz4veM G+eNYLPp73+ku5PBovBAN/bpuibeNX4ldIMenNyRSRXkDo43cZxu8LKPC6TEcyUn5cbA BlOI1kPwmkwuDTXuwnFffwTwrF8Q4o3LzzmiHz0kC5PK/xleRIgvJ/k2y9O8ZL/jAzS2 +QugS5YcGWMRvUem0JpaZ+gX3YFJ5hjdCMf7VZkD05iiMvJD5egVfjTYASR04SiUdPH/ ERBxTBtBZHCNJkgQsDzvA3UJ0NWQFktMu9kQRNKL2EOM8tAIvYHOME92MumJ8ad4aRFb 6h/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412404; x=1731017204; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XphyHCtUmZAps71O90LdJfKFfRsLf2MdQS1KVa0Cufg=; b=Ttc7r5Hp6AzPyHUDzIs0XV/3+oCViZxG/ZULcXTGXSJv3ylqd+tPMX+zokbztKDU2W FO40/HJ+emWTFJot2Z89UwGBajZ8U0xIjJ8vHak+p2HhhpaMI8wu4pxjnddjNuc5wr1C JCyRM9eSMG+necV9Uk9luQHAUW1TAuD2cQm1v7/RlzBOcpKybARA0oCeAZGZa2KCdVRH 1sk2ELd1U9J+XdHfiR2R3TPIj9PdKLXVy1zOdjDYAs9Yqt/DFNoJE0xHttJoiIXksKxg Q5VmyizhB+l2ztGQjKFKIcBUI49t6GDUX/Eidw6U/Z7ElqCVd0APoLPmedcV9wXVWhpQ NRNw== X-Gm-Message-State: AOJu0YySsbDs6nmdCe1KeL5Rl3ae204Grt5mok9Q7eLB7dDt1jBbqNS/ gX69LyQwb2OO2WBZ6L8F1orSjPDHbHIDcEeaO45Cy5Oi8/1FmZejF04xZA== X-Google-Smtp-Source: AGHT+IFczigt0o69ml+IPv6W17XoYmFPelDRR+ZTGK5gq2OJHr4N+51wV97lCSi/bZ0BGvoUCzvymQ== X-Received: by 2002:a05:6830:6605:b0:718:119:ee15 with SMTP id 46e09a7af769-7186811890cmr21257185a34.10.1730412404142; Thu, 31 Oct 2024 15:06:44 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:43 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 07/13] qmimodem: Drop call to ofono_gprs_set_cid_range Date: Thu, 31 Oct 2024 17:06:14 -0500 Message-ID: <20241031220638.1582166-7-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The intent was to set cid range to only support the default profile number. However, the gprs-context atom never ended up using cid to correlate to the underlying profile number. cid is only used to inform the core about the context that was disconnected. --- drivers/qmimodem/gprs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index 547b32059da4..27060f9fba44 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -400,7 +400,6 @@ static void get_default_profile_number_cb(struct qmi_result *result, DBG("Default profile index: %hhd", index); data->default_profile = index; - ofono_gprs_set_cid_range(gprs, index, index); if (set_event_report_request(gprs) >= 0) return; From patchwork Thu Oct 31 22:06:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858394 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 249DB1CDFB6 for ; Thu, 31 Oct 2024 22:06:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412412; cv=none; b=Q4BtYiisqwn6nFdDm3JuIkOUYSPyA2H9+LF8mhRqr+2wo7Pm5CYQOIb0TiHxtKaXiG8da/uNvjnzeYIuN1GtvEsrWpUlzh7Bdd5WSUocPZAAilfWIUNm7f1x/efUExoy2VEEX5nzHd6Cx8oZ8/o+VMD8bJ28+lWDUDnSSnslGzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412412; c=relaxed/simple; bh=Okk3S1HM1g6gNtefnoPG3ETV0XXja0IyW6xCVU+e98k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bsn0xKsAuaJgl5zov1/uVcBBpvfTC99FxigQgNnjGMdpy4Yza9D9ISWeWepcSxj8KRW2Kil2tT9sRmleejoVS8E+RV9j7ZrirgehSyXVbZYMjYPPdBAJqy+1VhwZAnKD1rkYItjAFapkIqgxoRBSMjQtJTNGPajcHrpzLtnwZ/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WPxaUkaS; arc=none smtp.client-ip=209.85.210.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WPxaUkaS" Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-718065d6364so761043a34.3 for ; Thu, 31 Oct 2024 15:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412405; x=1731017205; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WkcpqLAIqWaqoAEcU0snVUbt7KAKP+bmZalqm6+LTQI=; b=WPxaUkaSqtaphoT43pI9z1CZCQfR+On1caF63m2MeLPC1Nlq43sJhvQeGhGV754s++ WGFzx5TEaRDfnRRmxWqJDaE/QechCiFgsg8rachjXgEtv68i91aQDX0NP4YpkcysQkVT /6+//f3QbJeMdCv3Vnadcvl4W+rcE4M5dYx9iwLToUr3UJ99ZtayAFPNwzc3daoG6aWq MHQIrnHzvCAbfbOgL3bmgbOE0uUDuRWVrNBzKQKxuF2XIeBaICh/w+rpGjWiktPlk5uf 8ucGAkWcoSYKXEirqJEmgGrROxko0Iq5ZijMqg25tPr8LFN8St7QX1aE0YvJ3/2wlGl4 5cWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412405; x=1731017205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WkcpqLAIqWaqoAEcU0snVUbt7KAKP+bmZalqm6+LTQI=; b=nf9Lril8r7eZTLa0Rjm/ScIh7+FLpgNfC/6o5cuGe0bXmsaA0D/JzvV0VHuwWUPKvU mt4Ngwo86KbyKpXBzvSe3Klvs8EMF9HT80ztJTTg7UTkOIq88rW/bnuAAwSXpQ43Qv1A T3XLjKf+ne/cqdLMYdEeX9IDzTrIvELlgYfarUqRj5w3nn/hT83TTUEhV4R6VC2FP1iu 5hgymzkubqECGvG3QIXUalMtJ7I3jRCTDyedw6uyrEu8l4QIHYKdihvYfntIXbUVBKjj EYE9cEow2i4MYoowN4F5a7BW3dVvb+Zf9XcySrnKftB4bJoaeS4D/XDHEJP+ljxMzq1B vpEQ== X-Gm-Message-State: AOJu0YwGrdlnfk5A4VBczVEM5AeKZQASRK/0jXLI7hXmyq/rX2PQ8Kbd LjGKGS0JLysVntQSeMZ8htpLLMntwkpkLuAWGW8TW6oTUPQasrUVdZxp3A== X-Google-Smtp-Source: AGHT+IEUL0y5lb4xvOZUMqa79KGG/6djUzxc18Cx4XmO/WNsycuIqlwA7gZQcSv2g5woz3eTOG8wEg== X-Received: by 2002:a05:6830:4117:b0:718:186a:497d with SMTP id 46e09a7af769-719ca191433mr1724329a34.5.1730412405082; Thu, 31 Oct 2024 15:06:45 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:44 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 08/13] gobi: Remove support for qmi_wwan_q Date: Thu, 31 Oct 2024 17:06:15 -0500 Message-ID: <20241031220638.1582166-8-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Focus this driver purely on qmi_wwan and its quirks. This simplifies the logic considerably. --- plugins/gobi.c | 60 +++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 47 deletions(-) diff --git a/plugins/gobi.c b/plugins/gobi.c index b2c9c3d50ea4..5c3ae0737a15 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -88,8 +88,6 @@ struct gobi_data { uint32_t max_aggregation_size; uint32_t set_powered_id; bool using_mux : 1; - bool using_qmi_wwan : 1; - bool using_qmi_wwan_q : 1; }; static void gobi_debug(const char *str, void *user_data) @@ -111,15 +109,15 @@ static void gobi_io_debug(const char *str, void *user_data) * in order to initialize the driver properly: * * NetworkInterface - * The string that contains the 'main' network device. This can be - * "rmnet_ipa" on SoC systems, or "wwan0" for upstream linux systems. + * The string that contains the 'main' network device. This is typically + * 'wwanX' on upstream linux systems. * * NetworkInterfaceIndex * The index of the main interface given by NetworkInterface * * NetworkInterfaceKernelDriver - * The kernel driver that is being used by the main network device. Certain - * drivers such as 'qmi_wwan' or 'qmi_wwan_q' are treated specifically. + * The kernel driver that is being used by the main network device. Only + * 'qmi_wwan' is supported. * * Bus * The bus of the modem. Values can be "usb", "embedded", or "pci" @@ -131,7 +129,6 @@ static int gobi_probe(struct ofono_modem *modem) const char *ifname; int ifindex; const char *bus; - int n_premux; DBG("%p", modem); @@ -140,32 +137,22 @@ 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 || n_premux < 0) + if (!if_driver || !ifname || !ifindex || !bus) return -EPROTO; - data = l_new(struct gobi_data, 1); - - if (!strcmp(if_driver, "qmi_wwan_q")) - data->using_qmi_wwan_q = true; - 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; - } + if (!L_IN_STRSET(if_driver, "qmi_wwan")) + return -ENOTSUP; - data->n_premux = n_premux; + data = l_new(struct gobi_data, 1); data->main_net_ifindex = ofono_modem_get_integer(modem, "NetworkInterfaceIndex"); l_strlcpy(data->main_net_name, ofono_modem_get_string(modem, "NetworkInterface"), sizeof(data->main_net_name)); + ofono_modem_set_data(modem, data); ofono_modem_set_capabilities(modem, OFONO_MODEM_CAPABILITY_LTE); @@ -423,12 +410,7 @@ static void get_data_format_cb(struct qmi_result *result, void *user_data) if (!qmi_result_get_uint32(result, QMI_WDA_LL_PROTOCOL, &llproto)) goto done; - if (data->using_qmi_wwan) { - const char *interface = - ofono_modem_get_string(modem, "NetworkInterface"); - - setup_qmi_wwan(interface, llproto); - } + setup_qmi_wwan(data->main_net_name, llproto); done: if (qmi_service_send(data->dms, QMI_DMS_GET_CAPS, NULL, @@ -674,10 +656,6 @@ static void powered_up_cb(int error, uint16_t type, if (!param) goto error; - if (data->using_qmi_wwan_q) - l_sysctl_set_u32(1, "/sys/class/net/%s/link_state", - data->main_net_name); - cb_data_ref(cbd); if (qmi_service_send(data->dms, QMI_DMS_SET_OPER_MODE, param, @@ -711,10 +689,6 @@ static void powered_down_cb(int error, uint16_t type, if (!param) goto error; - if (data->using_qmi_wwan_q) - l_sysctl_set_u32(0, "/sys/class/net/%s/link_state", - data->main_net_name); - cb_data_ref(cbd); if (qmi_service_send(data->dms, QMI_DMS_SET_OPER_MODE, param, @@ -792,8 +766,6 @@ static void gobi_setup_gprs(struct ofono_modem *modem) struct gobi_data *data = ofono_modem_get_data(modem); struct ofono_gprs *gprs; struct ofono_gprs_context *gc; - const char *interface; - char buf[256]; int i; gprs = ofono_gprs_create(modem, 0, "qmimodem", @@ -810,8 +782,6 @@ static void gobi_setup_gprs(struct ofono_modem *modem) struct qmi_service *ipv4 = data->context_services[0].wds_ipv4; struct qmi_service *ipv6 = data->context_services[0].wds_ipv6; - interface = ofono_modem_get_string(modem, "NetworkInterface"); - gc = ofono_gprs_context_create(modem, 0, "qmimodem", -1, qmi_service_clone(ipv4), qmi_service_clone(ipv6)); @@ -822,20 +792,16 @@ static void gobi_setup_gprs(struct ofono_modem *modem) } ofono_gprs_add_context(gprs, gc); - ofono_gprs_context_set_interface(gc, interface); + ofono_gprs_context_set_interface(gc, data->main_net_name); return; } - data->using_mux = true; - - data->max_aggregation_size = - ofono_modem_get_integer(modem, "MaxAggregationSize"); - DBG("max_aggregation_size: %u", data->max_aggregation_size); - for (i = 0; i < data->n_premux; i++) { struct qmi_service *ipv4 = data->context_services[i].wds_ipv4; struct qmi_service *ipv6 = data->context_services[i].wds_ipv6; + const char *interface; + char buf[256]; int mux_id; sprintf(buf, "PremuxInterface%dMuxId", i + 1); From patchwork Thu Oct 31 22:06:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858395 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0600D14A4F9 for ; Thu, 31 Oct 2024 22:06:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412412; cv=none; b=F6gQzDGRcqUlX1S1asiFxyfRK+KWEpd6T8j2weOVJAmxGdZ4k2o0oA8S9UTL4vUoyYIuu58RPi5gevgZdf+3UxvPfGI52c/iJB2lzTGSnsndXHBIlqwWmaX01G6VPIz08YygBiUeQXCqe7A3xEz1tYOMhI8O6fTMA38xgXmnsi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412412; c=relaxed/simple; bh=dy5YfC8aR5Yafxj9SZNxALiklkLqMqXx2W3H2NHO3PI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WITQk7O/TNhml7OxvsC/Xn2bW1JXXGvjTZIT+z4RX0T2W9Lrzwwv/5sv+kezdUswvHXGi9wE1FdI9ON0oew6uKK6WGR6teF7EYuDf9YzpEUloOu+YVw3a8kdI0jn7rTJDmV5OGCdFn10JHfd+rZaqo+HGGbkIi4MkZNlAYVvMCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KUk+uLkr; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KUk+uLkr" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-71809fe188cso713759a34.0 for ; Thu, 31 Oct 2024 15:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412406; x=1731017206; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=18AtsgWHDiTaoS1b/PGZ/dqplJ9MnnwXhQdL835lwfA=; b=KUk+uLkrD7raIyA+S0PtDJWxYRg6E+4Xps332+uijN9oEW4xyYZ8CEiT3mDQJM5/kd XiWhiesnxhA0qhygq/kUZ4RmqS6pgs1f4RDS5K9wPmlTuEtGIUHHy+qSuW4eXwKui+06 JOX2FZMnVi9bRncSzGlH1fKe6daxebj2da9cCfc6xf0lL43R+cp0IcHec3Fk0RiXpXte Xw1VxjP9s2PJVj3e321Tlyonk+46QJV0qHtm0vaM8Ek2MWiZ51bsM0AYZ25n492LL7UI DI6FuvrTMj6oTw6rUG8n/Vip0nAkeIpAEfvul8jBPR/Q1glLiGsbZp3uWEpW95kqsbDw Fexg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412406; x=1731017206; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=18AtsgWHDiTaoS1b/PGZ/dqplJ9MnnwXhQdL835lwfA=; b=QsXlgIZ9L6wWMZgJbGBUNZ3/QbsnbEQW/eKEo70ztIGvdi9VGN7GlsOTecN6HnyuEu Sg7lz5QoxbaGx/CfyH7TZch73vMy4TpAsMttJ5WqaGtEsuFvBccfP8eIMMZS1STqRYi/ JlCaQCG1GlVh6tIwbDo2tamLHcyHecMyKsf56TmsRJNnJu08Udu+i4yGbTkEA+4ud3sr mLeCozcrGPnsoGSA/9WPCwnSQPZro20CpbhtL62F0xRarbUkc4xS8R0QGqgeXFTAWX6I HI5xBvgJ4BnnzejKXsR1Qwesuji2nWf8XkZ1+Hk10Dc+GYRBKeobebAYDmiH/RXu5iQ4 Fjhw== X-Gm-Message-State: AOJu0YwVrLyRttXgLhttkIn/gg+ODcdp4x/Op379OsGsYZCCO6I/iscI 9uMI7ShbqR7a79MN3RLR5Sw5rB2wvpT/haTc2A4BNJmVhAR4wdNkEcmVYw== X-Google-Smtp-Source: AGHT+IFNQEsCHSbiz43u6NLRWxqWNwA/On8iZdvUvFVafJYy8OE4qwqVjeHcBy1+ay669xSNhGrlsg== X-Received: by 2002:a05:6830:374a:b0:718:8b6:d628 with SMTP id 46e09a7af769-7189b55a986mr3945576a34.32.1730412405847; Thu, 31 Oct 2024 15:06:45 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:45 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 09/13] udevng: Remove non-upstream qmi_wwan_q support Date: Thu, 31 Oct 2024 17:06:16 -0500 Message-ID: <20241031220638.1582166-9-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This reverts commit: fd1b44514315 ("udevng: Detect Quectel devices that use qmi_wwan_q driver") --- plugins/udevng.c | 71 ++++-------------------------------------------- 1 file changed, 5 insertions(+), 66 deletions(-) diff --git a/plugins/udevng.c b/plugins/udevng.c index f34cdcb731ee..64875a47752b 100644 --- a/plugins/udevng.c +++ b/plugins/udevng.c @@ -1108,19 +1108,6 @@ static gboolean setup_quectel(struct modem_info *modem) return FALSE; } -static gboolean is_premultiplexed(const struct device_info *net) -{ - struct udev_device *parent = udev_device_get_parent(net->udev_device); - - if (!parent) - return FALSE; - - if (g_strcmp0(udev_device_get_subsystem(parent), "net") == 0) - return TRUE; - - return FALSE; -} - static gboolean setup_quectelqmi(struct modem_info *modem) { const struct device_info *net = NULL; @@ -1128,11 +1115,6 @@ static gboolean setup_quectelqmi(struct modem_info *modem) const char *gps = NULL; const char *aux = NULL; GSList *list; - const char *premux_interfaces[8]; - int n_premux = 0; - const char *qmap_size; - - memset(premux_interfaces, 0, sizeof(premux_interfaces)); DBG("%s", modem->syspath); @@ -1144,22 +1126,12 @@ static gboolean setup_quectelqmi(struct modem_info *modem) DBG("%s %s %s %s %s", info->devnode, info->interface, info->number, info->label, subsystem); - if (g_strcmp0(info->interface, "255/255/255") == 0) { - if (g_strcmp0(subsystem, "usbmisc") == 0) { + if (g_strcmp0(info->interface, "255/255/255") == 0 && + g_strcmp0(info->number, "04") == 0) { + if (g_strcmp0(subsystem, "net") == 0) + net = info; + else if (g_strcmp0(subsystem, "usbmisc") == 0) qmi = info; - continue; - } - - if (g_strcmp0(subsystem, "net")) - continue; - - if (is_premultiplexed(info)) { - premux_interfaces[n_premux] = info->devnode; - n_premux += 1; - continue; - } - - net = info; } else if (g_strcmp0(info->interface, "255/0/0") == 0 && g_strcmp0(info->number, "01") == 0) { gps = info->devnode; @@ -1177,44 +1149,12 @@ static gboolean setup_quectelqmi(struct modem_info *modem) if (setup_qmi_qmux(modem, qmi, net) < 0) return FALSE; - qmap_size = udev_device_get_sysattr_value(net->udev_device, - "qmap_size"); - if (qmap_size) { - uint32_t max_aggregation_size; - - if (l_safe_atou32(qmap_size, &max_aggregation_size) == 0) - ofono_modem_set_integer(modem->modem, - "MaxAggregationSize", - max_aggregation_size); - } - if (gps) ofono_modem_set_string(modem->modem, "GPS", gps); if (aux) ofono_modem_set_string(modem->modem, "Aux", aux); - if (n_premux) { - char buf[256]; - int i; - - ofono_modem_set_integer(modem->modem, - "NumPremuxInterfaces", n_premux); - for (i = 0; i < n_premux; i++) { - const char *device = premux_interfaces[i]; - int len = strlen(device); - - if (!len) - continue; - - sprintf(buf, "PremuxInterface%d", i + 1); - ofono_modem_set_string(modem->modem, buf, device); - sprintf(buf, "PremuxInterface%dMuxId", i + 1); - ofono_modem_set_integer(modem->modem, buf, - 0x80 + device[len - 1] - '0'); - } - } - return TRUE; } @@ -2160,7 +2100,6 @@ static struct { { "quectelqmi", "qmi_wwan", "2c7c", "0800" }, { "quectelqmi", "qcserial", "2c7c", "0800" }, { "quectelqmi", "option", "2c7c", "0800" }, - { "quectelqmi", "qmi_wwan_q", "2c7c", "0452" }, { "ublox", "cdc_acm", "1546", "1010" }, { "ublox", "cdc_ncm", "1546", "1010" }, { "ublox", "cdc_acm", "1546", "1102" }, From patchwork Thu Oct 31 22:06:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858396 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC4581BF311 for ; Thu, 31 Oct 2024 22:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412413; cv=none; b=PNBHSUVQGQOLseaD0fU+RTeAo+WgfnAkRRFPUfz/3c9Jz+dSz0319vT1VDuBtjzKgklKJ0/HInIiv7v5VLMRFhQY7xHdr56EBvF2RRdrSC9Oa2ImSd7UZRchM3OzYE08ZIaaNugWfbG4cjswHwfPj22t6ddnQvxUuNVRqam4nSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412413; c=relaxed/simple; bh=HGXJ/r4C6AmiB3QjKmlFK6KmAG6+wwX20S9ietVQRvg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y//md8o33V0DI6IJTjRMH4nBDhOET2ORpwUW46e4zsFMbTKBca8UybWsp1rkw5T35hBTgkMIXXp3RAP0gblFXiZMizIBIp5MpBMccaPO1lTA6MX2J83otWa1fIoGmGoFxAXxFQSBV+no5Qen5mdJyrpWwP9g9TAcgXMyGen57pw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O3KyaBRp; arc=none smtp.client-ip=209.85.210.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O3KyaBRp" Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-715716974baso771338a34.1 for ; Thu, 31 Oct 2024 15:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412406; x=1731017206; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Xng9xLEpYuT45AD+WPG4mpkyy5fbFtYRxR9Zg77oj8E=; b=O3KyaBRp1wvfv4k4RtT49RVmD962kUgvxUBdno/yanl7MaoNJRrQOmqT5mXeLt8b4i pZ1LHxeulwNyOXSihHN4A7VdFuym1ihy9zJWCEDB0kCVQ1pUnH0UCt0Ffpiq6hcY5Esf qkmGAp2mrXw3RvoHgtW4Pf1F7DpLpfMlHiATqgIHai9iWB8kkiwCQrQyavmiBL+MzHrU u9UOD7CZx3qAcOh/68lOgfFzCLZ3K+c498GRMdaUtq8/LKNL1Vh0dJ2U6h7JqVHtQeou 9U+6TJFnq92ZiisCNyXXXpghlbJq/gFYlHbxox7YPo2SOepWfts3WbM9Xg+VDG1+PPVR OF9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412406; x=1731017206; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xng9xLEpYuT45AD+WPG4mpkyy5fbFtYRxR9Zg77oj8E=; b=E7izvxKmAfI4OKpgArb2o455D+AUsPedypyvSd3yhEiADu34h8j3GtFAk+vkELLk+U +LxR+7+n1dr5mTUgXJmlMXD43V3AYl2JMk9PfzzVsc2PYSmg4NNNrYAJoDh6O5kAquhU mosB9gbGS5q4X5dIWnd2m1QI+LocblwlM5/vfYXG5MG3ST6fwJLcYqU7LxLLSfDc748S voBoACPzRUUkuIdKhOlSgtyFQ6NOSa9/77/0eRdljCjcFVTh1xV6esia6k9ehH9WsOaJ tKgHy/XhVr81FtWaRQp25J9YRHpoMnIkKfo0ADS4AEVZcxxQtEVJVmZIxsZKQ/XtBTI/ JXdg== X-Gm-Message-State: AOJu0YwEG8uCNqgSgJpCqc9vsMGIvKEhcsNzUWRf5Bge62K+Enz9pnus ODgdPh+YLBs+x8yidmkZXd9USjZnmEyIGHzPnuGf6Gybk2olQk72Jpncng== X-Google-Smtp-Source: AGHT+IH8kQXPtmPlJxWQjk8iLMNCB0Xq3PVVS+oVD9Rh14NW3VuvzUwrFTPZOZRUkgdQl8nlRQSy9w== X-Received: by 2002:a05:6830:442b:b0:718:41c6:821c with SMTP id 46e09a7af769-719ca174d66mr1971387a34.5.1730412406537; Thu, 31 Oct 2024 15:06:46 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:46 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 10/13] gobi: Bring down the main interface at startup Date: Thu, 31 Oct 2024 17:06:17 -0500 Message-ID: <20241031220638.1582166-10-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The current gobi logic tried to set the qmi_wwan 'raw_ip' state based on the results of wda_get_data_format. If link_layer protocol was 'raw_ip', then 'raw_ip' setting on qmi_wwan was set to 'Y'. For 802.3, 'raw_ip' setting was set to 'N'. Unfortunately this was broken at some point and the setting could not be toggled when the main network device was IFF_UP (default when USB device is detected by the kernel). Fix this by having .enable callback bring the device down at initialization time. oFono core will set the device IFF_UP once the context is activated, and bring it down when the context is deactivated. --- plugins/gobi.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/plugins/gobi.c b/plugins/gobi.c index 5c3ae0737a15..e75a0312f6d0 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -230,13 +230,10 @@ static void add_service_request(struct gobi_data *data, data->service_requests[data->num_service_requests++] = req; } -static void shutdown_cb(void *user_data) +static void __shutdown_device(struct ofono_modem *modem) { - struct ofono_modem *modem = user_data; struct gobi_data *data = ofono_modem_get_data(modem); - DBG(""); - data->discover_attempts = 0; memset(&data->service_requests, 0, sizeof(data->service_requests)); data->cur_service_request = 0; @@ -245,7 +242,15 @@ static void shutdown_cb(void *user_data) qmi_qmux_device_free(data->device); data->device = NULL; +} + +static void shutdown_cb(void *user_data) +{ + struct ofono_modem *modem = user_data; + DBG(""); + + __shutdown_device(modem); ofono_modem_set_powered(modem, FALSE); } @@ -552,11 +557,32 @@ error: shutdown_device(modem); } +static void init_powered_down_cb(int error, uint16_t type, + const void *msg, uint32_t len, + void *user_data) +{ + struct ofono_modem *modem = user_data; + struct gobi_data *data = ofono_modem_get_data(modem); + int r; + + DBG("error: %d", error); + + data->set_powered_id = 0; + + if (error) + goto error; + + r = qmi_qmux_device_discover(data->device, discover_cb, modem, NULL); + if (!r) + return; +error: + __shutdown_device(modem); +} + static int gobi_enable(struct ofono_modem *modem) { struct gobi_data *data = ofono_modem_get_data(modem); const char *device; - int r; DBG("%p", modem); @@ -575,11 +601,15 @@ static int gobi_enable(struct ofono_modem *modem) qmi_qmux_device_set_io_debug(data->device, gobi_io_debug, "QMI: "); - r = qmi_qmux_device_discover(data->device, discover_cb, modem, NULL); - if (!r) + data->set_powered_id = + l_rtnl_set_powered(l_rtnl_get(), data->main_net_ifindex, + false, init_powered_down_cb, + modem, NULL); + if (data->set_powered_id) return -EINPROGRESS; - return r; + __shutdown_device(modem); + return -EIO; } static void power_disable_cb(struct qmi_result *result, void *user_data) From patchwork Thu Oct 31 22:06:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858397 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 562DE1CEADC for ; Thu, 31 Oct 2024 22:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412413; cv=none; b=pCDb2NVWl3I4H9TNImOlA3cKSLo6Afsr6NOGSvy5MBiS8DF4j8jjz7no0Cs935vsEluQp0RYfgqiomceHMPztLmHLIIav+ww+sa5JWfxQrKrGUDA9sfJUgla1lSzMb7dBAObaFPBKkeKHEg1AMunP8IxBgZLIfTzTwQ1QrhDgII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412413; c=relaxed/simple; bh=q1ElaM9ga80dhqToMeINhHvbxqiB5Y7FTOTZpWd7Stk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L1JHf8RRBqzAFieeeCE95OxK9pEqIY7ctOGsGEtrDdUDekuXSxhgZnCk8FGvYXGGEAjSJRic3DaOg8JMnHLdke59bk3zZICoio2dLlUyCJthaEPhjrAT8395yzVt4SDqfz0wjPRpKdyDG9JA7rEbf/p43GqXT7MDu82UQjSTZik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D+3MnHE2; arc=none smtp.client-ip=209.85.210.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D+3MnHE2" Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-7180f2f5fb0so740667a34.1 for ; Thu, 31 Oct 2024 15:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412407; x=1731017207; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=drE4Ha64HpCwbs1I+ZTZp805PWc17XK54HE643nuQ0o=; b=D+3MnHE2VlyDGX60CQstr8zwNCgwj7fKRs4XArY1d4CbPtYVCRmU39K1BpR6jtBEDI gXz5O+E19Y0mHIIhG8OmD2VkrIfvl9iEWT+aHJIjQO+g4A8BECqugsHEXHaGSmiYBXLo EMZ58aj914HdBZy9Q8dVRi75lVdB1YrBan+EnBXy8zV5whuhQrBhFdhxGtKEya4ew7mT 5LE3iGN4CtqMZce35nn5MjGn8QJ29LM6ggQvEff0QT9FSzihsZld4B3QSUEBzwyJNbXN JLfIBSqOBocTiwZzi1Pk2ePljq93RyzWmP0vcTSJzUG0brR4Z0bF1nvFkMK7cHJS91IM euAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412407; x=1731017207; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=drE4Ha64HpCwbs1I+ZTZp805PWc17XK54HE643nuQ0o=; b=ceOQODUdDhFtYKCDBe3ZJkqmkyKc7Z3crgUmGueRJnKWcBs1hQN0gDQlhwdeNsFvoW RwVRddkEhYWxdo8EUTtaxs4ojlxhDRB8sWrAC+rzQdDIZl9YIwksU+CPeJGoD3T/797R moYdbtE7WZRwNzJ7EOtDgRE4Ru+lQqgs+fqeaetbNqwGk/af+xyQHb4QM4Mwo0UFZvlk t6p9QojeordHD0uzoVZbwbsk2XWJjfEl7NHTgz1voLwFeH0S2ehMyLiCt7aphEwysiV/ hvNFRwg5VWNzcRycwrHqVaMdPsFdgib+gPdPniVt2MNwZZC80QPh64IQBAe2onQ3K5Tg 56OQ== X-Gm-Message-State: AOJu0YzsNJSMMXo2ZAAfGanBvPrZe0REhMuSE+SypL7qfTgQE8ShWynw RdxnHZNnEoMwQ6e+MnwQJHx3a4OgBJ/tmD85+bQ8oXe8Re+1ls3AfyYWQg== X-Google-Smtp-Source: AGHT+IF7s4MrYBGuNfRt+HmiFWtqn+baOnCU00p2yFpZM/bDn08ztUjq+RL2HxpRs4mOIJR7LO582A== X-Received: by 2002:a05:6830:310c:b0:718:2eb7:4ebe with SMTP id 46e09a7af769-7189b55cfbdmr4261154a34.27.1730412407202; Thu, 31 Oct 2024 15:06:47 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:46 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 11/13] gobi: Support only "usb" Bus values Date: Thu, 31 Oct 2024 17:06:18 -0500 Message-ID: <20241031220638.1582166-11-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This may change in the future, but for now the gobi driver will only support devices using the qmi_wwan network interface driver. This driver is limited to USB. --- plugins/gobi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/gobi.c b/plugins/gobi.c index e75a0312f6d0..6ad8a4b7f923 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -120,7 +120,7 @@ static void gobi_io_debug(const char *str, void *user_data) * 'qmi_wwan' is supported. * * Bus - * The bus of the modem. Values can be "usb", "embedded", or "pci" + * The bus of the modem. Values can be "usb" */ static int gobi_probe(struct ofono_modem *modem) { @@ -146,6 +146,9 @@ static int gobi_probe(struct ofono_modem *modem) if (!L_IN_STRSET(if_driver, "qmi_wwan")) return -ENOTSUP; + if (!L_IN_STRSET(bus, "usb")) + return -ENOTSUP; + data = l_new(struct gobi_data, 1); data->main_net_ifindex = ofono_modem_get_integer(modem, "NetworkInterfaceIndex"); From patchwork Thu Oct 31 22:06:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858398 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0E441CEE86 for ; Thu, 31 Oct 2024 22:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412414; cv=none; b=F6ZuUcuBRNwU66U5WTCJrCXi6NJGEI5lg9lN8+LDGdT9DOcrv/j7wZeHtSEn+XkUe3S5kr9ZJzJ9zBml7poFk1ZoH09tOGh7GnxIQCnSDiF733ti3zA8Rb8ZmuK8l7oIGm9JrJqrYx3lt6vHk+7rStL8/HRjVsr4jbfkScnAttw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412414; c=relaxed/simple; bh=qI+hPlKxbQUztStjnKxN890v/m3rWUrDNTzEajCrAjw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NvRo0wyufQ8RSmSIKEXH4B1sjLNjgaOQI8SqaRAYk2zO61/65jiE1rmI3Rx6/nNWu3cr8ioF7cS/DYbcmZgeXI1Ckv2EvMlQjw6dpxPNjc5fMx9jmshnNt4gEm6wZdjH2LmoLui6oH17Ft1iwtTk/zXUvNMme+WM3T30X6DcFuk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YDOEJ4Ui; arc=none smtp.client-ip=209.85.210.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YDOEJ4Ui" Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-718078c7f53so711390a34.1 for ; Thu, 31 Oct 2024 15:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412408; x=1731017208; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DjNXH/9skdsA3RHTRJoux70UO5GM2qyjNnz9JkO/RFs=; b=YDOEJ4UidbfxwCUHK0xR8Hc6UzEbwkVM/KTR5L6R9l1jozRr5N7ATs9VGMpVAdqX0E KrNmzqEpY44rrG8LFrZOtHUHOVVyEZGXsIxjV+DJeYkU9jl5eddEYwY8xmVINveCQqT8 weE8wMWC8NihtbS8tkxUauuc2MZULZ6urSFAtZbv0au3SHqTnue+ylHL0Ou3DeFyku6/ CB2UvL7bGC/z7zVfwzme8qh92ySIGWtqHYtH7EXRmKlrGuQSzW1+7uNK6HAGdjvZaKfC xMow2rEHz0iO4o59mhuGTOpfMe/QmbaO+6Zs2HHPZ5K4PdYhlcI8xFQ4Rj1XDQAt7EJK VdhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412408; x=1731017208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DjNXH/9skdsA3RHTRJoux70UO5GM2qyjNnz9JkO/RFs=; b=QQBb8zEXeYynZo8YJp8zTZW4hLFxYb0A3AkqBWNFxvc1gnQQMP9dwu4nJwLLjdGtUH H44RUymPx/ngLgEEZBcIebWGdmXE7oDbv83qEqUb/i/M3z9WSjVu8u+z21ITEFQXp/NV rLtv5aqtimv3kmk+bFKsDARdo/EsocMezuDmt/U0NB5NZXpei8EgnYcTCqUcHO+uuKwZ vPMjpHGcfDuqJwBF79bCFGBLmkEkUzR5neXArS5H0ofDYwAhxFxizZe8vYfCjWRjhZdK SYoIYNxUrTeIbjBxjJMHbi59MXM/pG2XNJV+x/m0Ptn4mafoH+tOZmDbzyr/r75LRIcJ djHw== X-Gm-Message-State: AOJu0Yzi6UPDosg8sKOpnOS9k/+5pDstDJyCEnYIX0g0DD56lLLOT/8c oT5K2igy2wPTOJlbUSgBucl7/UcFtFu1m8G01S1uz4V4SpAzru9aIpDagg== X-Google-Smtp-Source: AGHT+IECYu5O4YmSU9m5Yalxn7bzDfssaRGY0/tyLe5WSc0ySTq08lBV223e+kTan4MszBkDQt2p4A== X-Received: by 2002:a05:6830:6d89:b0:709:3e34:2977 with SMTP id 46e09a7af769-7189d4bc0f6mr2403529a34.7.1730412407809; Thu, 31 Oct 2024 15:06:47 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:47 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 12/13] gobi: document and validate "interfaceNumber" Date: Thu, 31 Oct 2024 17:06:19 -0500 Message-ID: <20241031220638.1582166-12-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- plugins/gobi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/gobi.c b/plugins/gobi.c index 6ad8a4b7f923..54b64acb7871 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -85,6 +85,7 @@ struct gobi_data { uint8_t oper_mode; int main_net_ifindex; char main_net_name[IFNAMSIZ]; + uint8_t interface_number; uint32_t max_aggregation_size; uint32_t set_powered_id; bool using_mux : 1; @@ -115,6 +116,9 @@ static void gobi_io_debug(const char *str, void *user_data) * NetworkInterfaceIndex * The index of the main interface given by NetworkInterface * + * InterfaceNumber + * The USB interface number of the network interface + * * NetworkInterfaceKernelDriver * The kernel driver that is being used by the main network device. Only * 'qmi_wwan' is supported. @@ -127,6 +131,7 @@ static int gobi_probe(struct ofono_modem *modem) struct gobi_data *data; const char *if_driver; const char *ifname; + uint8_t interface_number; int ifindex; const char *bus; @@ -149,12 +154,17 @@ static int gobi_probe(struct ofono_modem *modem) if (!L_IN_STRSET(bus, "usb")) return -ENOTSUP; + if (l_safe_atox8(ofono_modem_get_string(modem, "InterfaceNumber"), + &interface_number) < 0) + return -EINVAL; + data = l_new(struct gobi_data, 1); data->main_net_ifindex = ofono_modem_get_integer(modem, "NetworkInterfaceIndex"); l_strlcpy(data->main_net_name, ofono_modem_get_string(modem, "NetworkInterface"), sizeof(data->main_net_name)); + data->interface_number = interface_number; ofono_modem_set_data(modem, data); ofono_modem_set_capabilities(modem, OFONO_MODEM_CAPABILITY_LTE); From patchwork Thu Oct 31 22:06:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13858399 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B2621CEE91 for ; Thu, 31 Oct 2024 22:06:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412415; cv=none; b=hmWLerzZMcuBn0JjFM2SeXXTjUoYWCgcWo9hmmvpoepzGmD8z5/GHRUMg6XNePF8J/qPbk5bPacDHt24GPYx/wwrfHwo0gBjGvrv9pCg+R6p8yDRl1V8hh2sJFAxPUR/OEqKrxnZIqS+TaMoP2GEYUP7g6gCa8kK1cqj/O6MfWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730412415; c=relaxed/simple; bh=8iwI4CYNvmkG6/t1MmpsVOWSzwmdQkGiJhJkcI37gj4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jqtzxbpgSuiOoixD8SD+u1qtA7+93qMqbss/uPIj2GYBEBzALtcWCss+C8vXNXp8DrFXc5FMfpCCZYuhJwHybCf0G99ejugR0MRSdVs9X54fRGdz+fjPjUpyNKP9GKR/MgHROw6RU9bXPrC/nbAPxbv/KHsSch2AZX22zzVg8ok= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jp/uOIGm; arc=none smtp.client-ip=209.85.210.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jp/uOIGm" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-71811c7eb8dso866343a34.0 for ; Thu, 31 Oct 2024 15:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730412408; x=1731017208; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6wni+vWfXstmxk9EPEv18jU1QK8QaTG115FjggOXVjE=; b=jp/uOIGmvOKsHzwL7c62amhOaBV9eAgDQExP52Pwr0LU0Zw1UtmRM21jzCnCFOJUMU GY0+BYZgdDY/kSxFAHYxA9Cgq/bnuCvFAyvnCpNCILt3v03PbZ+8jWzHFVvxviMRXY27 6rWu3oUiB1xjvK+P8kMQIkHKK/ri0YISssRubOswN6hVuuK23n7LzStdt1bjtl6TBm2Q prWb/ulnlc1lNTJLAwIAQ5HabfLUcUb7r5ZAL4mNcJt+owqqYiv2b/mbrPBryZurzAnf In0iFp4ceAf+b1HXlHhAYFxZRvyXg2fAKaJaMM1Gj4GYrpndzxZDTGRuEBG0c/F6cNPl dLeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730412408; x=1731017208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6wni+vWfXstmxk9EPEv18jU1QK8QaTG115FjggOXVjE=; b=OztHRcJZKCAM33C8zZuG+lB1DqudlUrRqcVL6z/aR5OnVEMrNk0MmjNJeJHD+x1W0O qdap5iv8O7CnvfYCz4BvFx4XE7DBQj4YxdthsWmI8hYbB96ncYNpjW9o1FKusEcxdTcY BZxFUVHlABRSxmtZmkosJcY1Mysv7ItYxWxPIEuDVckm8ncDCkCj5JFzNBqctp4qisf6 0vuSYmxC06rGE1dJJYqIdbuwlI9TsGX56R2sYQZtKDa0N8ofaMXNFcPj6xv1k5gRSA8k wq2zS5EAMfBcfi6FCUu3zWHe3F4XeFzmPJ/BUTOVMPVzuWicoabseXP4Ovy8EIq9pP6m orNQ== X-Gm-Message-State: AOJu0Ywr4pw4NixoGxHS2f5cjPOAiwc+h1y5qScMDhl9tQ5uYNutfcb0 aSXaxL0zgc4hfNISlXe/PSaBazT2QkIAC90QD8A8wU5GCpgibzBZfpin6Q== X-Google-Smtp-Source: AGHT+IF175eA1l9QaW74/u9o1slhdwcagLKm8/X5Ra3KZl/Ds193yY8SVEliYCyU91F4GRDBe5We7Q== X-Received: by 2002:a05:6830:25d6:b0:717:f707:cb92 with SMTP id 46e09a7af769-719ca25e885mr1465358a34.28.1730412408414; Thu, 31 Oct 2024 15:06:48 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7189cccf4a7sm507577a34.73.2024.10.31.15.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 15:06:48 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 13/13] qmi: wda: Convert #defines to an enum Date: Thu, 31 Oct 2024 17:06:20 -0500 Message-ID: <20241031220638.1582166-13-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031220638.1582166-1-denkenz@gmail.com> References: <20241031220638.1582166-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/wda.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/qmimodem/wda.h b/drivers/qmimodem/wda.h index 25bc01eb7565..fd1e1f63ab1e 100644 --- a/drivers/qmimodem/wda.h +++ b/drivers/qmimodem/wda.h @@ -10,6 +10,9 @@ /* Get and set data format interface */ #define QMI_WDA_LL_PROTOCOL 0x11 /* uint32_t */ -#define QMI_WDA_DATA_LINK_PROTOCOL_UNKNOWN 0 -#define QMI_WDA_DATA_LINK_PROTOCOL_802_3 1 -#define QMI_WDA_DATA_LINK_PROTOCOL_RAW_IP 2 + +enum qmi_wda_data_link_protocol { + QMI_WDA_DATA_LINK_PROTOCOL_UNKNOWN = 0x00, + QMI_WDA_DATA_LINK_PROTOCOL_802_3 = 0x01, + QMI_WDA_DATA_LINK_PROTOCOL_RAW_IP = 0x02, +};