From patchwork Wed May 1 20:51:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651130 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) (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 74E1829405 for ; Wed, 1 May 2024 20:51:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596707; cv=none; b=t8XLZ8AAi6gjCGVLfYAqb6poPLR1hZCKauJZ00/HqOJLMy3vR8n748WdKYbovq6OgIGz6bicaPoTzzI1mPro5M0OjB3IOD5rGBTDWTm4nw+sC6bqHElg6c8GUINUXoHVNwU1cYhuLZilhL6gGiP5auGFoPFnPQ1mL++UlsFi+Xo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596707; c=relaxed/simple; bh=3s7eg/2w/9QwkI7eZ4wLM+/CycYV6qWhRpz/taZIxbg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tYmQVwTPxD+e2kLAHRj1FHXkhfkepjQxakDFPyDAGmNTnSMVyVQqGG7/j2gb8Z6+whSMUFTBsJ7ZBNPxKGH5Dcc/8bhxAGMWbDmEv31tEpFd1a6u18O1PqL6VeyGj4SOIxGBOxodlbp+0PoSqzDLUFl1K5I9s+A334dJbDHh+0A= 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=MjBLwOl9; arc=none smtp.client-ip=209.85.160.41 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="MjBLwOl9" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-2343ae31a9bso3499034fac.1 for ; Wed, 01 May 2024 13:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714596705; x=1715201505; 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=LhSTyREFXvRkGlEPxmtGbcAOQ39xmpQcQUpoaHOFwEg=; b=MjBLwOl9Y9VQByGnBCBgSXCt8HSOhOGYvngIAFCM9wY5Y2nwY2jLgLH1VhHESMI7F5 C5hFTd4hPaU7wqsP6BnhmQXQQCY6KIm7z2b4AZ23kHHnZTE7EJyUL8AHP12lo6VYVgLf 8Luus22TSv6kxBuW8UdmsAxPrkWq54I5JEQoLVUQBOaAjlB2ZaaaHsiyCcht9AMlJV0M CbXbK4EyJ9KWaagMePcFFnQiOJJcr6ECm+/7gaDwlxzaKufKLW/r6jSKOxenKnvD0Kcu Bkz8wEEUA+Ss3wRxRrWHZyiSVsz4IAuA1lVl9PyhlmW7f1RISOqoFbRBSQY0abceKilE s3zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714596705; x=1715201505; 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=LhSTyREFXvRkGlEPxmtGbcAOQ39xmpQcQUpoaHOFwEg=; b=wfUnF2iwXzGGvaACtGLyDUR1xnasiAmkUABBkCxaseLErcZWgXw0S5IdT6H+wyKMQr lHejrW48ClDbXUGSiDXSKxiZjg6FirjgmApMkJdASn0mwwxRNnOe+QWqAqPDTxFerQL2 ixaoCG9vVkbyl1F+JuY5n3wP8HPL4/NQge/YXrHhR9ouBqDr0ZcUA5Y2pEaEKFvlnKRY elsNf87u1RjXN8+ZEK7WX1HDaSpCvY/mpAomaRwerfvME1ncr9bR4fv0/f2MZCV1e0lR odEqndd+NAKXPMXTjev8whSf93P27w10SWmt466/xzq5p4G9wy92nbvcRBlmvYuA1DiM e8aA== X-Gm-Message-State: AOJu0YwtKsPU/D3lKRN60sHb20F51MwJY/j/dhG+Hw6tMzJ9Lj5Qylvi X7Nq98GZF3kpKmPZzzLpY4AYK3yZ3IUeo50+5A1B3fZtx1PS/eXkPN7n+Q== X-Google-Smtp-Source: AGHT+IF+O1FyTi7K8KxaeBLVBUXIP/eU7Hepzq6VK8ofgKAMWO1MzOjSpOy56EioDcG3Z0vfgERkSA== X-Received: by 2002:a05:6870:420d:b0:239:8e67:6f10 with SMTP id u13-20020a056870420d00b002398e676f10mr142076oac.30.1714596705276; Wed, 01 May 2024 13:51: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 or3-20020a0568715c0300b00234bc052521sm5883658oac.10.2024.05.01.13.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 13:51:44 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 1/6] qmi: gprs: register to NAS indications earlier Date: Wed, 1 May 2024 15:51:22 -0500 Message-ID: <20240501205142.12777-1-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We can register to NAS indications much earlier, as soon as the NAS service handle is created. Since the handle is now a 'lightweight' handle, all service registrations are automatically unregistered when the handle is destroyed. There's no need to track the registered indication id and to remove it separately. --- drivers/qmimodem/gprs.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index 738271905848..bca1897ea02f 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -39,7 +39,6 @@ struct gprs_data { struct qmi_service *nas; struct qmi_service *wds; unsigned int default_profile; - uint16_t serving_system_indication_id; }; static bool extract_ss_info(struct qmi_result *result, int *status, int *tech) @@ -306,10 +305,6 @@ static void get_default_profile_cb(struct qmi_result *result, void *user_data) */ qmi_service_send(data->nas, QMI_NAS_GET_SERVING_SYSTEM, NULL, ss_info_notify, gprs, NULL); - data->serving_system_indication_id = - qmi_service_register(data->nas, - QMI_NAS_SERVING_SYSTEM_INDICATION, - ss_info_notify, gprs, NULL); ofono_gprs_register(gprs); return; @@ -369,6 +364,8 @@ static void create_nas_cb(struct qmi_service *service, void *user_data) } data->nas = service; + qmi_service_register(data->nas, QMI_NAS_SERVING_SYSTEM_INDICATION, + ss_info_notify, gprs, NULL); qmi_service_create_shared(data->dev, QMI_SERVICE_WDS, create_wds_cb, gprs, NULL); @@ -403,13 +400,6 @@ static void qmi_gprs_remove(struct ofono_gprs *gprs) ofono_gprs_set_data(gprs, NULL); qmi_service_free(data->wds); - - if (data->serving_system_indication_id) { - qmi_service_unregister(data->nas, - data->serving_system_indication_id); - data->serving_system_indication_id = 0; - } - qmi_service_free(data->nas); l_free(data); From patchwork Wed May 1 20:51:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651131 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.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 12C43146D7D for ; Wed, 1 May 2024 20:51:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596708; cv=none; b=ZTeFyuFUkdeeG+iPU8cq60r0K14DoRxT3E3yYlI8sIXkgNnrWl7rGjwgkXG/MXW2/DxiqtGZuKWkRuNvgU2qHztA171PswvTjPF8Q42P2O3TdTGOgHRg8wB5tEX9++ERReVxcKqI1zJ31rIVGWZnPOjX7Fz/hjw5YQ8yo7k0O5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596708; c=relaxed/simple; bh=81RpkgqfyJKWDHVsOKvCKjD5cKl36YPVLUTQrimX/Jw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ShNLfdGJLYm4Rc++LriLV72YzwM5ytzG/7FlLrYbzRFHiaMZWBqsH8elGoLhxvymCIClgz78BOkjZ7TmV7JmKnNvabCJZtyS1uuE2miG5QLsV9TaIsBB8RRyUYEycpkqYCR3ouUvwMkQDUhW58Po+/aXB9/DNROGz6a951x6X1c= 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=E8IOlCaA; arc=none smtp.client-ip=209.85.161.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="E8IOlCaA" Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-5b1bbff09f8so90476eaf.1 for ; Wed, 01 May 2024 13:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714596706; x=1715201506; 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=g6UHh7+nWzKG7FiETnzVDRmr5ppMz3HFtEGMnF6T2gk=; b=E8IOlCaAehpsfTZNGyJvEvWqhZh5Eeqjg/iOwad79QA/j52z37XXndCb3sXsBJXaCn yfa7NAMnndHHc0BmS+O9SaWejFR+qaQafJaLIaltJtGPmqO6xCTfIRSg+2dANov5lZMa 6XJ/OpUqKdfEuFOKj2r8RCUYp1LCuYDMT1Ul6pq1gjMED5D2YJnaqrrT4wa550JFZacF RhE4khJescOur6qRQm2rVXfG0JbPa4ff20GzStgTDa6h9OulSgAmeQFPGhN4DI424/EM PCIy4xLcac8lyHyMdfa3oVHYLqiDjgdRA2ZMBkc1k477f/9sFkjM9WxhGVvMV/NAjInG BlZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714596706; x=1715201506; 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=g6UHh7+nWzKG7FiETnzVDRmr5ppMz3HFtEGMnF6T2gk=; b=BZ7+AioUvwt4Mcwl//gVeK/3/VnfULmLYhp/IW3V89X5PBu0ZDXSsNgTkio3Foe1k4 qiAzvd2AjavIzVVGFDFtAB80+NPq9W0voIs9Mka/Uo2G+VO2ewhCwe4RdweGJy36/I60 ueQe7CDWmWr0ePJeXtEn2JKlw0vsRWUouTM7/AXKDHtVpP+/ROJZfPZIbxCGg7z5LZvd uvVuiDonOOY9/aQu8pzUzChAq50H7SbJ1xpshoGNCfMaDVGUtnlN7Oi2YUJRJyXntsWF Wodi3EolqeyUuzU/9vBUtUjfXv/o7TanRt1jf3+odHAGGFgHrf55UmilLd/iua2zFQUJ WvhA== X-Gm-Message-State: AOJu0YxU+wzlDc7ppjt0zH2YSxBbmUmvlwkBQBEpsJIEVEr6pdkkTygV EEZJSJ+H5NvU67I1Ea4GxmDSO2KbSFpDGbPKsv2Keaa5PWcpM7u0TSCNtw== X-Google-Smtp-Source: AGHT+IGPg7Dl/hPdo3oNbRduiW3CryWszbIeZ/887YHSjash6EoraoiWaeEoI+LKdHA1NR4KK8NWNA== X-Received: by 2002:a05:6871:826:b0:23a:f308:b25d with SMTP id q38-20020a056871082600b0023af308b25dmr384047oap.25.1714596706000; Wed, 01 May 2024 13:51: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 or3-20020a0568715c0300b00234bc052521sm5883658oac.10.2024.05.01.13.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 13:51:45 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 2/6] qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER request Date: Wed, 1 May 2024 15:51:23 -0500 Message-ID: <20240501205142.12777-2-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501205142.12777-1-denkenz@gmail.com> References: <20240501205142.12777-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This will allow request to be re-arranged into a new sequence easier in the future. --- drivers/qmimodem/gprs.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index bca1897ea02f..0122998a090e 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -275,7 +275,8 @@ static void qmi_attached_status(struct ofono_gprs *gprs, l_free(cbd); } -static void get_default_profile_cb(struct qmi_result *result, void *user_data) +static void get_default_profile_number_cb(struct qmi_result *result, + void *user_data) { static const uint8_t RESULT_DEFAULT_PROFILE_NUMBER = 0x1; struct ofono_gprs *gprs = user_data; @@ -312,9 +313,8 @@ error: ofono_gprs_remove(gprs); } -static void create_wds_cb(struct qmi_service *service, void *user_data) +static int get_default_profile_number_request(struct ofono_gprs *gprs) { - struct ofono_gprs *gprs = user_data; struct gprs_data *data = ofono_gprs_get_data(gprs); struct { uint8_t type; @@ -323,7 +323,27 @@ static void create_wds_cb(struct qmi_service *service, void *user_data) .type = QMI_WDS_PROFILE_TYPE_3GPP, .family = QMI_WDS_PROFILE_FAMILY_EMBEDDED, }; - struct qmi_param *param; + struct qmi_param *param = qmi_param_new(); + + /* + * Query the default profile. We never change the default profile + * number, so querying it once should be sufficient + */ + qmi_param_append(param, QMI_WDS_PARAM_PROFILE_TYPE, sizeof(p), &p); + + if (qmi_service_send(data->wds, QMI_WDS_GET_DEFAULT_PROFILE_NUMBER, + param, get_default_profile_number_cb, + gprs, NULL) > 0) + return 0; + + qmi_param_free(param); + return -EIO; +} + +static void create_wds_cb(struct qmi_service *service, void *user_data) +{ + struct ofono_gprs *gprs = user_data; + struct gprs_data *data = ofono_gprs_get_data(gprs); DBG(""); @@ -334,18 +354,8 @@ static void create_wds_cb(struct qmi_service *service, void *user_data) data->wds = service; - /* - * Query the default profile. We never change the default profile - * number, so querying it once should be sufficient - */ - param = qmi_param_new(); - qmi_param_append(param, QMI_WDS_PARAM_PROFILE_TYPE, sizeof(p), &p); - - if (qmi_service_send(data->wds, QMI_WDS_GET_DEFAULT_PROFILE_NUMBER, - param, get_default_profile_cb, gprs, NULL) > 0) + if (get_default_profile_number_request(gprs) >= 0) return; - - qmi_param_free(param); error: ofono_gprs_remove(gprs); } From patchwork Wed May 1 20:51:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651132 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.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 A7A871635B5 for ; Wed, 1 May 2024 20:51:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596709; cv=none; b=X6uQI9kKsWdP0wx5VIUBXPAjhUuzJeJ3ppvKPFFeNrJZwb3R1VGdsyP+qEDDGWL6EAKtczwpHJxfSgQFIJcQZWVZgCihnXcQD7+MCPS4snfVsFVZl5HQZG1Hm8cJwkJjb6/ud0dSIhQcitUUUt1cRGIwZJ/Cay5rp5qRzfs50FQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596709; c=relaxed/simple; bh=T2uNYmn5yh7pCiWwKBH3OJrP0krP9UlMCXfsmOxYdYg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LG1hKaRcyO8dEvftmcyCDu5eu1SRZU4EUq55LJ4CZuRSaGUk//V4zOKvD8VUl/Y6bueh1RY0viAEyLxtYyoy6GOsa0bE7crYuJhZTKh4DsJV0TWQLbXOSeyDZD3Hy3Bewe0QHH5pwbcPcEqJF7lYQRY5l8JMiw7kVizH++FjK8E= 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=i7NnwE3V; arc=none smtp.client-ip=209.85.160.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="i7NnwE3V" Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-23d1c4c14ceso1134523fac.0 for ; Wed, 01 May 2024 13:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714596706; x=1715201506; 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=SshdI/Es0zzeCfaeppsP7uyYv8BqbEBkzHfg9iP7FVA=; b=i7NnwE3VTMGXNDDp2zWRlm7awkSQH/MIujCnJj5GnNgKFz3nUd49RKruHsbX4r5H5T XWvDlNCer8ehpS2TY4hd3fJloNas15o3fxbfYIkyRqh0nXJyPpWHJn6DzeULKqbeUnuu RtyOr+pDSURXfVxKFNI+VFwqMFtM96bCY6xZqo3FH2qFDF+7cBS7BrnqtFsG5d1qjLAy BLRiqFACmygL67TkORCYMGchp4JzwAYHypJMJ4nB4sJ8VTRPMArvHGkNN/NLHpgIa4Ep ZdCdArpDrEhdoUJBPZbvIhLgx9q2vzSCwHfUFyUDZC2IAKij534GpOjuJBLwMqiW9A3y oeNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714596706; x=1715201506; 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=SshdI/Es0zzeCfaeppsP7uyYv8BqbEBkzHfg9iP7FVA=; b=N6C6XKS/kdqSV4JS5coLg9Itpi0byQCge7ZLaSAZBY4VL2g0/e/gwkiN661Rdi3zjY upyR+EQYyOCRJ+rPZrU2Wrd7OqJJ1HsRpE+sIRNAcBs971N1k2jUjzIpn0UIatwfriS+ QWE+l87afuOpYX/YPaqzDOsI7k3scv5+NutlsQUPNUsPDwOc/PDABVzAFoiLdc9c1JGv 4t4x4IXyUn2NKM3zvenazIM6gZhfd/SS+f3vxp+hPhEHnaBYYgVbx++Q1Zi61leJo95E yrFkoxXbdO34rbmBDE2zg0YxoFKmQKG5GG40/lR0uO3NT+2ka0ba9SRFtONKAQBDTd5F /rsA== X-Gm-Message-State: AOJu0YxKcYqccYnT1EckGCyeDWnPl39cv9egYk2W6AIdmvYwlI4dWBcl NiSC1uStuouq35xxbamUg+7dsdNYn3Lp6CRH0p1acylMyTBl4EGuvvo25w== X-Google-Smtp-Source: AGHT+IHIHgEk6XuXYNYsZsGXl2Vme3IptcCIMOgTOqpnm0awR/Mgm2LmGTRXKenK8ad5qK3uSr9YvA== X-Received: by 2002:a05:6870:e40b:b0:23c:659b:fb3c with SMTP id n11-20020a056870e40b00b0023c659bfb3cmr4163481oag.19.1714596706726; Wed, 01 May 2024 13:51: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 or3-20020a0568715c0300b00234bc052521sm5883658oac.10.2024.05.01.13.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 13:51:46 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 3/6] qmi: gprs: register and listen to event reports Date: Wed, 1 May 2024 15:51:24 -0500 Message-ID: <20240501205142.12777-3-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501205142.12777-1-denkenz@gmail.com> References: <20240501205142.12777-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is mostly useful to obtain inter and intra RAT changes, data bearer changes, data transfer statistics, etc. --- drivers/qmimodem/gprs.c | 88 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 79 insertions(+), 9 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index 0122998a090e..aac28db387bb 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -184,6 +184,13 @@ static void ss_info_notify(struct qmi_result *result, void *user_data) ofono_gprs_status_notify(gprs, status); } +static void event_report_notify(struct qmi_result *result, void *user_data) +{ + DBG(""); + + qmi_result_print_tlvs(result); +} + static void attach_detach_cb(struct qmi_result *result, void *user_data) { struct cb_data *cbd = user_data; @@ -275,6 +282,74 @@ static void qmi_attached_status(struct ofono_gprs *gprs, l_free(cbd); } +static void set_event_report_cb(struct qmi_result *result, void *user_data) +{ + struct ofono_gprs *gprs = user_data; + struct gprs_data *data = ofono_gprs_get_data(gprs); + uint16_t error; + + DBG(""); + + if (qmi_result_set_error(result, &error)) { + ofono_error("Get default profile error: %hd", error); + goto error; + } + + /* + * First get the SS info - the modem may already be connected, + * and the state-change notification may never arrive + */ + qmi_service_send(data->nas, QMI_NAS_GET_SERVING_SYSTEM, NULL, + ss_info_notify, gprs, NULL); + + ofono_gprs_register(gprs); + return; +error: + ofono_gprs_remove(gprs); +} + +static int set_event_report_request(struct ofono_gprs *gprs) +{ + static const uint8_t PARAM_CHANNEL_RATE = 0x10; + static const uint8_t PARAM_TRANSFER_STATISTICS = 0x11; + static const uint8_t PARAM_DATA_BEARER_TECHNOLOGY = 0x12; + static const uint8_t PARAM_DORMANCY_STATUS = 0x13; + static const uint8_t PARAM_CURRENT_DATA_BEARER_TECHNOLOGY = 0x15; + static const uint8_t PARAM_PREFERRED_DATA_SYSTEM = 0x18; + static const uint8_t PARAM_DATA_SYSTEM_STATUS = 0x1A; + static const uint8_t PARAM_LIMITED_DATA_SYSTEM_STATUS = 0x1C; + static const uint8_t PARAM_PDN_FILTER_REMOVALS = 0x1D; + static const uint8_t PARAM_DATA_BEARER_TECHNOLOGY_EXTENDED = 0x1E; + + struct gprs_data *data = ofono_gprs_get_data(gprs); + struct { + uint8_t interval; + uint32_t indicators; + } __attribute((packed)) ts = { + .interval = 5, + .indicators = ~0, /* register for everything */ + }; + struct qmi_param *param = qmi_param_new(); + + qmi_param_append_uint8(param, PARAM_CHANNEL_RATE, 1); + qmi_param_append(param, PARAM_TRANSFER_STATISTICS, sizeof(ts), &ts); + qmi_param_append_uint8(param, PARAM_DATA_BEARER_TECHNOLOGY, 1); + qmi_param_append_uint8(param, PARAM_DORMANCY_STATUS, 1); + qmi_param_append_uint8(param, PARAM_CURRENT_DATA_BEARER_TECHNOLOGY, 1); + qmi_param_append_uint8(param, PARAM_PREFERRED_DATA_SYSTEM, 1); + qmi_param_append_uint8(param, PARAM_DATA_SYSTEM_STATUS, 1); + qmi_param_append_uint8(param, PARAM_LIMITED_DATA_SYSTEM_STATUS, 1); + qmi_param_append_uint8(param, PARAM_PDN_FILTER_REMOVALS, 1); + qmi_param_append_uint8(param, PARAM_DATA_BEARER_TECHNOLOGY_EXTENDED, 1); + + if (qmi_service_send(data->wds, QMI_WDS_EVENT_REPORT, + param, set_event_report_cb, gprs, NULL) > 0) + return 0; + + qmi_param_free(param); + return -EIO; +} + static void get_default_profile_number_cb(struct qmi_result *result, void *user_data) { @@ -300,15 +375,8 @@ static void get_default_profile_number_cb(struct qmi_result *result, data->default_profile = index; ofono_gprs_set_cid_range(gprs, index, index); - /* - * First get the SS info - the modem may already be connected, - * and the state-change notification may never arrive - */ - qmi_service_send(data->nas, QMI_NAS_GET_SERVING_SYSTEM, NULL, - ss_info_notify, gprs, NULL); - - ofono_gprs_register(gprs); - return; + if (set_event_report_request(gprs) >= 0) + return; error: ofono_gprs_remove(gprs); } @@ -353,6 +421,8 @@ static void create_wds_cb(struct qmi_service *service, void *user_data) } data->wds = service; + qmi_service_register(data->wds, QMI_WDS_EVENT_REPORT, + event_report_notify, gprs, NULL); if (get_default_profile_number_request(gprs) >= 0) return; From patchwork Wed May 1 20:51:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651133 Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.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 7D7EB1649CF for ; Wed, 1 May 2024 20:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596709; cv=none; b=PcGr3tmcgW4td3jBwFQHidn6sfsjtd90WlnoWjuIrMlPdltoVE+yrUXJUL6rtidhsAAFPq07yKDsXLCHJpSwteXBs7pz+I9pAOFzNrWWgzzbp7fbNY9Q0bIxR+WuXptYi6jk90lo4Ru+FhgX4It8iUdXPHewoaiBitC2XbmZWHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596709; c=relaxed/simple; bh=sdIHL4pkY+21nw20w162O+jALIari5/M9hiCYEvfZME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vFs0DVeLjTat1l1orJYQbS1jsZBH9lAGhvyngWAMeRr0NMA8cHl3bPasFe00VPmPALOoJM7IxW1iQxKczmvE6UMt5rquZNdOhKxIEAXHb7x8twkfuS33P0ZTdpSZVCohcPKKDx16V1PlIHxCjN4ccfdpCUajCR/A5ZCvuaY9gWE= 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=UUDwtNJn; arc=none smtp.client-ip=209.85.161.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="UUDwtNJn" Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5ac8c73cf88so4552346eaf.2 for ; Wed, 01 May 2024 13:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714596707; x=1715201507; 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=EjqP/j6PnixFFFnqp9f/ygGDoivkA9vgewsqaqO5wkQ=; b=UUDwtNJn1KHa3TtW0TA+TBS3RvxcdVVpIOoR5HvHCzglKWRN80a8QLkilMfSRDlAoJ 28iXHNDyX0Zd1eK94TM0Tqofs2ZHLX7bXfyyx0i2bf15HpbSYJ9jsIcDi4FBDIzQ6C8g UXx58aqiDEePWT833PrH6bL4uTgGfQotiG3mGfTHawR3UD1mgSsRHMM8eNEtszBG2zj8 yK1+g+U83hOg2C7gwavteR9eOu0iR26CVxEKFuJm4lUvtvQs7hfjXMlLC8QuteyCRPKo Y5ioxm2Rf58rZAKhm303MOqfTFG9AM86NhuRADtel/jnBsnhvvZRzarH/bP1bsYYqh+q xlsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714596707; x=1715201507; 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=EjqP/j6PnixFFFnqp9f/ygGDoivkA9vgewsqaqO5wkQ=; b=obb9rqFEmJF61zh8w2LAcI9HYtIlug89mleZtPjAxr8Owb2ZDblepMwvdtJ3FMo8Vb QMqPQSmnlWI6UAMeTbDNyeritaIHRp4c90c2sNTWBB7QAmnYdgdLyAR28zeWGx0F/uiW mi60OKELr1RRFZu9E/MI7w+ioWOkhuXKFk8c9F9Us4Y+WpTRmzTvttE7BmmAShQ9MJ0H Ky8+pxvsjNsl4dBUBZOU8O+i4vMDFHPYzTDIQDwKtRTA0Dl+E8J/a241AjLbW0Lk2DpY aeWdF7IN76+ow3PRiO8XDmXEWS9/n2uqkgjcKbk1JRpRcwYwOAP1YRRV8p6U384FaS45 rIGw== X-Gm-Message-State: AOJu0Yy35vhk1Ci/WcB+SCvXU4zseM6JKvWhJjOp1YcGl70Y5j2PoD8n 44gquVxd5GKtdYGMqK8WKe1szwICqznW/2A3CIEP40R1kWcscTP9CAQvbA== X-Google-Smtp-Source: AGHT+IG1VgtWEcRAx+39SUOH4KzTN7MsUVr9SdSnLZev4Y0FRhPbYByj1zVpABXKatwH7v+eaBM0nA== X-Received: by 2002:a05:6870:b153:b0:23c:58bb:be68 with SMTP id a19-20020a056870b15300b0023c58bbbe68mr4089700oal.6.1714596707570; Wed, 01 May 2024 13:51: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 or3-20020a0568715c0300b00234bc052521sm5883658oac.10.2024.05.01.13.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 13:51:47 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 4/6] qmi: gprs: Register for other notifications Date: Wed, 1 May 2024 15:51:25 -0500 Message-ID: <20240501205142.12777-4-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501205142.12777-1-denkenz@gmail.com> References: <20240501205142.12777-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Register for additional notifications via Indication Register command. --- drivers/qmimodem/gprs.c | 46 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index aac28db387bb..8329f56a2ba8 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -191,6 +191,13 @@ static void event_report_notify(struct qmi_result *result, void *user_data) qmi_result_print_tlvs(result); } +static void profile_changed_notify(struct qmi_result *result, void *user_data) +{ + DBG(""); + + qmi_result_print_tlvs(result); +} + static void attach_detach_cb(struct qmi_result *result, void *user_data) { struct cb_data *cbd = user_data; @@ -282,7 +289,7 @@ static void qmi_attached_status(struct ofono_gprs *gprs, l_free(cbd); } -static void set_event_report_cb(struct qmi_result *result, void *user_data) +static void indication_register_cb(struct qmi_result *result, void *user_data) { struct ofono_gprs *gprs = user_data; struct gprs_data *data = ofono_gprs_get_data(gprs); @@ -308,6 +315,41 @@ error: ofono_gprs_remove(gprs); } +static int indication_register_request(struct ofono_gprs *gprs) +{ + static const uint8_t PARAM_PROFILE_CHANGES = 0x19; + + struct gprs_data *data = ofono_gprs_get_data(gprs); + struct qmi_param *param = qmi_param_new(); + + qmi_param_append_uint8(param, PARAM_PROFILE_CHANGES, 1); + + if (qmi_service_send(data->wds, QMI_WDS_INDICATION_REGISTER, + param, indication_register_cb, gprs, NULL) > 0) + return 0; + + qmi_param_free(param); + return -EIO; +} + +static void set_event_report_cb(struct qmi_result *result, void *user_data) +{ + struct ofono_gprs *gprs = user_data; + uint16_t error; + + DBG(""); + + if (qmi_result_set_error(result, &error)) { + ofono_error("Get default profile error: %hd", error); + goto error; + } + + if (indication_register_request(gprs) >= 0) + return; +error: + ofono_gprs_remove(gprs); +} + static int set_event_report_request(struct ofono_gprs *gprs) { static const uint8_t PARAM_CHANNEL_RATE = 0x10; @@ -423,6 +465,8 @@ static void create_wds_cb(struct qmi_service *service, void *user_data) data->wds = service; qmi_service_register(data->wds, QMI_WDS_EVENT_REPORT, event_report_notify, gprs, NULL); + qmi_service_register(data->wds, QMI_WDS_PROFILE_CHANGED, + profile_changed_notify, gprs, NULL); if (get_default_profile_number_request(gprs) >= 0) return; From patchwork Wed May 1 20:51:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651134 Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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 2BCC31649D5 for ; Wed, 1 May 2024 20:51:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596710; cv=none; b=N2kiT6UWInEbXSMCHjoVPI+cO62T4D/jEKPKl8aKZAjD6wqcvXcBt+B6lkLkoJu42/HV3NAYlYMIR/hLWBRBFiWvVFdaTlOur8RI0h4PSGDfhVwtpmGXNTmiQOO+7O9eqtBNmOjWMl21eNF0oL7fTNbgv14n0pChJzOvopMjE0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596710; c=relaxed/simple; bh=Gunr/qjMIkclvQedyJBGfjBytEGAYK6OuLgGc6JmGsM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t3MvwZQzwJVXl6yvqictyHC3NG7LnERyy9qo5UNxPvNF/5ApyJywthBRZI4VX8qrX1CcV5u5+eEirApkgfta8K80lKUhG138ltcQkylBhLnIuwIQnOz8KaxEdPcJEWZRXPigAWDbgDnZPprN5e1qITKoYc10WLQmARJb2X1SwFU= 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=J6erMoWm; arc=none smtp.client-ip=209.85.210.42 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="J6erMoWm" Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-6eb55942409so3512898a34.1 for ; Wed, 01 May 2024 13:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714596708; x=1715201508; 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=4r3pNIa4+6LSENenGG6k/WQKcRgRsvSXIdXsDs5j2ec=; b=J6erMoWm6iBuWQuubj3yckJbw4bDxPY5xdx6QEVEbN+C9JuJDE5vIXNOkqXT4ARrE9 gE9+AGpXjF63uQ8xvcgfF84VeWFK9OOIXNFx0KpIQv7csxnBg5P7qB6Y6lxr8BuJ6nZS uNTgAm74C7AjXIlUD1WlW649h8d+xPQObArfeUby2j7StgcnGhdPYQbC7IrDZhj9ZAG2 iu1LhULmGa+abyBGOFok3FLL/a/A3RBy6jVMGA60gy4sbrEZv9k6fmIVh8OfHI9TwrpQ UtP+6RxjqlH96EpnRRl+Gr0jvmUZQFHNkgvsP5pRD8OcxgBxGU4wD47JWyjeMl9lD+5C FYMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714596708; x=1715201508; 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=4r3pNIa4+6LSENenGG6k/WQKcRgRsvSXIdXsDs5j2ec=; b=S9geVEObcFH+apNC4kQAJ1wJ++afGChAZzMZfQqG6et1w+kl2MbQ0p5NAaxnfKxu9o uLXHQpBsKTKyiXbPLtu1DO2fvZORzA8u2gvKhB68xSwHwelflX4ulg/8zANgSt6AY9aO MNkw03V+b1LZiLT6wFrIHi07cIca6jOCWM7lxa2C9ZIKSqUs5O8My6re4Mtd0XIRz4+7 gBAO7/d/4bMx7Eihy1u1IMOh8Jb5wgYUkf3SBECouwYCp8xGRjzWvHLHcS8lN6bZhtYK Wm4qVrUvFnMmVxcBNQXF34JaFsrZI+YVQaAHyMUdipVgX2BqOZYigCy1VrwgItA7RkHH 5iew== X-Gm-Message-State: AOJu0YxaqD2qUlhlToJ2gDoH3nH3nTiGZdZAMkgT+0xMNbqfvjkaekbg tYSuNvIAuF1zDz4c6Z7TGFmG08CSZjW2zFh+JHIzFfoY+398hbYMl/lAxg== X-Google-Smtp-Source: AGHT+IHHMK4B58t/KskA9ev1kzM+ZcdLC/tnIiLSW/Mke/kMUjQYsoBE4ciiEUXkJRwwRs4X7BM7Aw== X-Received: by 2002:a05:6870:4713:b0:22e:15fd:e247 with SMTP id b19-20020a056870471300b0022e15fde247mr4201063oaq.5.1714596708229; Wed, 01 May 2024 13:51: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 or3-20020a0568715c0300b00234bc052521sm5883658oac.10.2024.05.01.13.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 13:51:48 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 5/6] qmi: wds: add utility to parse Data System Status tlv Date: Wed, 1 May 2024 15:51:26 -0500 Message-ID: <20240501205142.12777-5-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501205142.12777-1-denkenz@gmail.com> References: <20240501205142.12777-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/wds.c | 38 ++++++++++++++++++++++++++++++++++++++ drivers/qmimodem/wds.h | 17 +++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/drivers/qmimodem/wds.c b/drivers/qmimodem/wds.c index d126f4712921..77e22f443db0 100644 --- a/drivers/qmimodem/wds.c +++ b/drivers/qmimodem/wds.c @@ -5,6 +5,11 @@ * SPDX-License-Identifier: LGPL-2.1-or-later */ +#include +#include + +#include + #include "src/common.h" #include "wds.h" @@ -37,3 +42,36 @@ int qmi_wds_pdp_type_from_ofono(enum ofono_gprs_proto proto) return -ENOENT; } + +int qmi_wds_parse_data_system_status(const void *dss, uint16_t len) +{ + const size_t network_info_size = sizeof(uint8_t) + 2 * sizeof(uint32_t); + uint8_t num_networks; + uint8_t network; + uint32_t rat_mask; + + if (len < 2 * sizeof(uint8_t)) + return -EBADMSG; + + /* uint8_t preferred network type followed by number of network infos */ + num_networks = l_get_u8(dss + 1); + + len -= 2 * sizeof(uint8_t); + dss += 2 * sizeof(uint8_t); + + if (len != num_networks * network_info_size) + return -EBADMSG; + + while (len >= network_info_size) { + network = l_get_u8(dss); + rat_mask = l_get_le32(dss + 1); + + if (network == QMI_WDS_PROFILE_TYPE_3GPP) + return rat_mask; + + len -= network_info_size; + dss += network_info_size; + } + + return -ENOENT; +} diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h index d896fd8cc535..94f1c028bd81 100644 --- a/drivers/qmimodem/wds.h +++ b/drivers/qmimodem/wds.h @@ -68,6 +68,21 @@ enum qmi_wds_profile_family { QMI_WDS_PROFILE_FAMILY_TETHERED = 0x01, }; +enum qmi_wds_3gpp_rat { + QMI_WDS_3GPP_RAT_WCDMA = 0x01, + QMI_WDS_RAT_3GPP_GPRS = 0x02, + QMI_WDS_RAT_3GPP_HSDPA = 0x04, + QMI_WDS_RAT_3GPP_HSUPA = 0x08, + QMI_WDS_RAT_3GPP_EDGE = 0x10, + QMI_WDS_RAT_3GPP_LTE = 0x20, + QMI_WDS_RAT_3GPP_HSDPAPLUS = 0x40, + QMI_WDS_RAT_3GPP_DCHSDPAPLUS = 0x80, + QMI_WDS_RAT_3GPP_64QAM = 0x100, + QMI_WDS_RAT_3GPP_TDSCDMA = 0x200, + QMI_WDS_RAT_3GPP_5GNR = 0x400, + QMI_WDS_RAT_3GPP_NULL_BEARER = 0x8000, +}; + enum qmi_wds_command { QMI_WDS_RESET = 0x00, QMI_WDS_EVENT_REPORT = 0x01, @@ -111,3 +126,5 @@ enum qmi_wds_command { int qmi_wds_auth_from_ofono(enum ofono_gprs_auth_method method); int qmi_wds_pdp_type_from_ofono(enum ofono_gprs_proto proto); + +int qmi_wds_parse_data_system_status(const void *dss, uint16_t len); From patchwork Wed May 1 20:51:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651135 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) (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 C69991635B5 for ; Wed, 1 May 2024 20:51:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596711; cv=none; b=ZEDe8hoIi48CIBC1AXPeA8U5+GJy5aw8V+56oFvnumK1yRD2H7tNA3QInkNtjSyka7ctWuVYmV/Sc7TxBprAc6iPLaR7c8IwM93eEc/er36wmYn07MFSifq+WYFWeD7CeqSG0sGN9t2ON1PbbmthdZ4uQiwU6lCb+AZGnHk97bY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714596711; c=relaxed/simple; bh=v5kf1cPWnpyOcgxDnM833nGyyDhhHKN/BQPUJCBt9r0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jot4Foq6gldoOYeNLwBu7F0hxTw78Xd0VhHUXo9tq/CiAD1UEQPI88THimKOtKhM8sS75YSkgI7YUCA5Al77zOFMPirW63RBH2qt0sT62CeHB/P2QXdMtXXgur33OtnnneLlQNd7iY5wSNn9Oh8X8oR7OW5y/jMrfc7ULLeWgNE= 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=gpQRogNG; arc=none smtp.client-ip=209.85.160.41 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="gpQRogNG" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-23da78d835cso373625fac.1 for ; Wed, 01 May 2024 13:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714596709; x=1715201509; 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=czT/NyS0EkWiZkNj+C4NAl+OImgYqjSv7JQCs7lMJuA=; b=gpQRogNGfmKgAEOOgkpXjwar/EpXPhfskgtOWageINtCIOCMrm6qpqnUkY0PQh4pr5 nP0BZFbwGCPn0c4SQ6cbQC7nb+01mTXfeddmu652M/YIP+GVF0ESa2aJZIUMWLcZqRDm axgywa2lPESiofxhUpf4bxOMe7IcykZZ6oFc0dDVnJiGzdVu0s5fBSfUMwcxtK+DfPFj gjWNmW+puldEXuDm2k++TtXLR4hlCHAt7sk1EB2UAuXyoU64RqXMOZGbnoHnUTnjezYx pzlW8Fzzp7vs6Be1GTpt1vkdvqeKoDXsw/v/4X0kprpEKdap4vr2q1YxbMMEQX3Kgb4m l+mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714596709; x=1715201509; 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=czT/NyS0EkWiZkNj+C4NAl+OImgYqjSv7JQCs7lMJuA=; b=mlGVOs07G7WVH/bDg65eS8GPQ4v6eEpFUPrh8MQya34sWjF/YR5O2N7hqkIQSgJeV+ EhO4GhwujPMhOvf3gKvioeDw3RYBA2n9YPaHMaFYhKzY0OtX7ECalIg6yOjK/O3EZNjT anwZdP7iM9GjlDXuFDhhVM7sGky8tF8596Yn9AVe4J7z3NOWZo3BGPrgX911y4HYwA/9 76ZX69vrAfbHRArSyuIW5s4dOlj4khn6yLHCMfnWTn2CMLM3fX7GkMKTtYUN2d6/GeJN PpUn4fgKF0kVzlCu50wpmpIboGcFW0iDIW5s/K54nmYq/eg6mTFTfp/xwFT28WY0g7AI mwkg== X-Gm-Message-State: AOJu0YzEtHh0wrM2kC11xGGMIs5HScMxgSyl+1dfajHIROp7GbDC6B4w RuB05vsRmkA7Un86R0RWwm7/zVC8V13yL6Gjt/m7WTP0HBnHOo0QeNNucA== X-Google-Smtp-Source: AGHT+IFqk2KEAESZVBSpRW6vnOyi27gdGV/59qS1ceHApKzWDB/ogoy20wtKDso0f625vNyzxHgz6A== X-Received: by 2002:a05:6870:701e:b0:235:489d:cea2 with SMTP id u30-20020a056870701e00b00235489dcea2mr4299573oae.7.1714596708837; Wed, 01 May 2024 13:51: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 or3-20020a0568715c0300b00234bc052521sm5883658oac.10.2024.05.01.13.51.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 13:51:48 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 6/6] qmi: gprs: Obtain LTE attach parameters after indication Date: Wed, 1 May 2024 15:51:27 -0500 Message-ID: <20240501205142.12777-6-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501205142.12777-1-denkenz@gmail.com> References: <20240501205142.12777-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It seems this TLV/Indication combination is needed in order for the GET_LTE_ATTACH_PARAMETERS command to succeed: ofonod[3257238]: Failed to query LTE attach params: 74 ofonod[3257238]: LTE bearer established but APN not set --- drivers/qmimodem/gprs.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index 8329f56a2ba8..662fea41fc2f 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -151,19 +151,6 @@ static int handle_ss_info(struct qmi_result *result, struct ofono_gprs *gprs) if (!extract_ss_info(result, &status, &tech)) return -1; - if (status == NETWORK_REGISTRATION_STATUS_REGISTERED) { - if (tech == ACCESS_TECHNOLOGY_EUTRAN) { - /* On LTE we are effectively always attached; and - * the default bearer is established as soon as the - * network is joined. We just need to query the - * parameters in effect on the default bearer and - * let the ofono core know about the activated - * context. - */ - get_lte_attach_params(gprs); - } - } - /* DC is optional so only notify on successful extraction */ if (extract_dc_info(result, &bearer_tech)) ofono_gprs_bearer_notify(gprs, bearer_tech); @@ -186,8 +173,31 @@ static void ss_info_notify(struct qmi_result *result, void *user_data) static void event_report_notify(struct qmi_result *result, void *user_data) { + static const uint8_t RESULT_DATA_SYSTEM_STATUS = 0x24; + struct ofono_gprs *gprs = user_data; + const void *tlv; + uint16_t len; + DBG(""); + /* + * On LTE we are effectively always attached; and the default bearer is + * established as soon as the network is joined. We just need to query + * the parameters in effect on the default bearer and let the ofono core + * know about the activated context. + */ + tlv = qmi_result_get(result, RESULT_DATA_SYSTEM_STATUS, &len); + if (tlv) { + int r = qmi_wds_parse_data_system_status(tlv, len); + static const uint32_t lte_5g = QMI_WDS_RAT_3GPP_LTE | + QMI_WDS_RAT_3GPP_5GNR; + + if (r >= 0 && (r & lte_5g)) + get_lte_attach_params(gprs); + + return; + } + qmi_result_print_tlvs(result); }