From patchwork Wed May 1 23:21:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651173 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (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 C5401168AE2 for ; Wed, 1 May 2024 23:21:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605709; cv=none; b=Z2zi4IkOYKiMHbvl/oRIqF/VIfoIPKQpoRmV9s+au57zmQSuiG0WLBnfxnu1v/U4kqUBq+yEzhGuzeitMpXggvJmsO9nWu3+P1KpOY3bgvo42Bo5DFIKIg0JJUuMzAtzomsI0T/U5NS0AEJAexVx10ZqZ6iH0I0vbMZEoouS2l4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605709; c=relaxed/simple; bh=3s7eg/2w/9QwkI7eZ4wLM+/CycYV6qWhRpz/taZIxbg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MFP+3AGv+4mOLx/etF1GQnk7aOL2T1JMcs3gyFU7/k1x5FCc3VMFFSuaVwQIpkAJDUuYHPLjHsYXPtBC6rTvHKfebILQCuumMTvYpuBF0D9nA7MmaFAQUMgRpPZy+Unv7CryadCYcS0kwnQFnSubtngIdjUi93RKTF+OzzX2hi4= 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=R0kCbKZA; arc=none smtp.client-ip=209.85.210.47 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="R0kCbKZA" Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-6ee35146ac5so1991118a34.0 for ; Wed, 01 May 2024 16:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714605707; x=1715210507; 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=R0kCbKZA4faXxaujFi7/cTReTmUEbIzh+L0u1uogJnTINuA0tF2jyt4c+HYETJx5+7 Q2vYphWnLKK/3ZAyCLPX2E951ApwvqNQuFOnAbSv0l3AVsoIZsz2y8t4iIIsIi2XOPNq Ry4mpXHFl3r8tAwjVHoiy5g8DqWgEW07391lEVdh8jCfvotSfR2tedKBCk1lsek0H71F x+gEPGPZlwN938dLZGSryb3KwwgwLS1o4iVe5JKy2eKP/BfZvhnIcDrTKj0/47nMQ2Rs hNil2x8DkRe1p8NntqhS0FHMI33to4mdyml0DF0xTA4phcZBbVaMf/nfB+23oWv9DRvd Zxyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714605707; x=1715210507; 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=wtECvqiNQQ0139alt4FnX7sjVE17Ky1qWoW0KLpVnlek2CNsepme7/yPAwlffBhBRw AVHxCdnzz2XWPM9Ev6+8n+k47aWii/5Rk41S4bPbWvvUZo2CeYCPTf2usG9YHcPM3Stt KTqyZKtb3LoEL/cYoPCK7uo1OXoHfGn3cdYa9AZ5hOp/3h/hgW/pc6mw0D+/RKfFBA72 7OOGr+vgVtdJqFl7y42MQEdtbN1X8z1MGjK152DX8gI+VuB1yDmOgB+8NsdsyrMJFWp7 8Fl6tUo/4iSFCaSuY3iLGo/YYa2Bfv9awyWuGejnXrT6lYLAVYeCx4Hdsvgk64GhjveV 7IKw== X-Gm-Message-State: AOJu0Yybt05jKqFvtXQFfQrNyfOXohBhY1fg2W1K7KWTg9yzmB19yn+d qZ1bW7ZRfLdce05if7WsyJrvyZt4iWpiExrQYhADgJz9Nf5hb9Ny/PLPfA== X-Google-Smtp-Source: AGHT+IHUO67EXcBIP5lAcqk4/TS48MtfZhiCiDV2RrY3PPVdn+IZuir1DvozXrY5gpEOWc9l8Insaw== X-Received: by 2002:a05:6830:1bc9:b0:6ed:e67b:8699 with SMTP id v9-20020a0568301bc900b006ede67b8699mr414105ota.18.1714605706714; Wed, 01 May 2024 16:21: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 x11-20020a056830278b00b006ee4e216d02sm1128040otu.14.2024.05.01.16.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 16:21:46 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier Date: Wed, 1 May 2024 18:21:28 -0500 Message-ID: <20240501232144.14025-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 23:21:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651174 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 5A9CA168AEF for ; Wed, 1 May 2024 23:21:48 +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=1714605709; cv=none; b=dzRqZMZl2a5QjGyWRmTDIiIZJ48kMABCMp+TxWeYEOU7bW9Znqvh/MWuOJpjcSP13+S/yRDR2kXyQtf53IVi4CeivZ4lyXW63LKUnd02Dveef9oY636iMg9ao0eDCSH1Jy6fK0Iv3dGyb3nosDQA1ABCtwcjdz/U9u4z7tVLaHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605709; c=relaxed/simple; bh=mRikR+TPi0u8mzUB3SReiH/SNsNVudtIi7iY4VVZBfg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NT9F2DQrLJsE4v7QvWIZ+LghSP/e4IWxUbVjclW8QUP9sqc5OLXQ2Vq4leruFEMv07t/wb22jIAE3Wm/q8fI5GaSkiQRLWEExap0ymIavw6mSiFEOcK+z/PbJYSruUypT6Ux7h3PCX6l/v5byUD0jxerEGWUITwtELJdc7xmj0E= 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=WO26dVHY; 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="WO26dVHY" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-6ef94f1ce39so894159a34.3 for ; Wed, 01 May 2024 16:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714605707; x=1715210507; 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=Cz6f/mYgDeRduQdrtX2spyDbk2Ot7vDBmYMs0Vn0VIA=; b=WO26dVHYVQ6QpCttEBiJlbbAGBTYSBZ1jLybgGcOf0hd3Ru+bU8n7KtEPBSmVESdzF IttBC6d67yKBnnQ8eulklzrrQXHWUcyugzJMcnOleA1D/cifYyu/iybc6RzxNrB4769e T8pz6uMunE+wygsHo4bsJKJJZzQMHVk4GHeditRyQpmWO7089nBZJHgujfYXyb5jLPgq xYpack5kBxfh/HrQml86gVW/TlUktVi0czo01KCzJKQKn18fl7Ps+XqhQltYj2BMUrv6 oYIP7o8Om/LtwQHgoQ+iAsxmd7/QMQg2P8EzQbB24hXGZfin1n4qV2Kz8/FX8wx1l2RN HXmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714605707; x=1715210507; 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=Cz6f/mYgDeRduQdrtX2spyDbk2Ot7vDBmYMs0Vn0VIA=; b=iFNhqzEI+mQTpremY02v5+pTDnNfwFb9dNI7NRa5K8V+QiGLKU1scgcszAPv1bsOiP 8VC61pwRVWfd94US6mhx03l3pD5/CYQ+UugEEOVoW1KLfAqcjgYw93NRHmvFd9LIMKF1 rik+RTY7jJ/wYOLYYPU537LF6THos2Q4eyHTdpi7Y0xWzsQ0IsyoVWpPSVIRFNcniznX u6Oxv6nBwj60bZ0a/1IzPZasCuff6dWzEYWlVLWYqJo7lDt5Ai4pBj6t9tWBRTFLmZ2+ fuT6EZtSbAHsTW60n8Cl2gd8sadyajB09WO7ctgVpa88PvttziyMsfjdanHr/U1ZTidZ GLkQ== X-Gm-Message-State: AOJu0Yw8HLINquZmfYLQsA/TDK0aigI9buwzVa5mqcaZEDajc4xtrjSZ up7v+DFiqPXj3sodMTIBIo5Yl9alkmxDeZnSDr9D4q5eWwKACTo7D58ewg== X-Google-Smtp-Source: AGHT+IGPYlit3D1oz8EZZEcitOO/ZmBdDW5YrT5qjbNbCUZGO7Izd5HCpIEdO7DzPMPcmcqTzhdy6g== X-Received: by 2002:a05:6830:1daa:b0:6eb:8fc7:c570 with SMTP id z10-20020a0568301daa00b006eb8fc7c570mr421842oti.33.1714605707375; Wed, 01 May 2024 16:21: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 x11-20020a056830278b00b006ee4e216d02sm1128040otu.14.2024.05.01.16.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 16:21:47 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 2/6] qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER request Date: Wed, 1 May 2024 18:21:29 -0500 Message-ID: <20240501232144.14025-2-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501232144.14025-1-denkenz@gmail.com> References: <20240501232144.14025-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 | 42 +++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index bca1897ea02f..dbd461731d94 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -101,7 +101,7 @@ static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data) DBG(""); if (qmi_result_set_error(result, &error)) { - ofono_error("Failed to query LTE attach params: %hd", error); + ofono_error("get_lte_attach_param_cb: %hd", error); goto noapn; } @@ -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 23:21:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651175 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 09847168AF6 for ; Wed, 1 May 2024 23:21:48 +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=1714605710; cv=none; b=Cg/q5HFaOGgXYCJ/h2bLbmwd0IgasuanmdmYznvtnJOJMiP4zD8dl69bpRviz5+dpWehyYdtlyJXYmJ1oP9NkfHr3rGBq42XMvWw31Ij/EhJ21rx6eL5uty7QYZWYntfL/tqiVNLGYtx60dxO0NTNqrv5ljwJO0uFzGF0kaY5Ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605710; c=relaxed/simple; bh=P3z5ElUn7xNmU6UohQAVMUt7DdCV5olvYS3dfYN6334=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UjpMHGZg6T4SuohRLd3SOKDnrj2Hc7U6BQSdKSAbmuBJ13mM8vYimavhTO0oqbYLNvDS4tByp1a7kjV+183Jauc/11gEGuLHGmyl9DPhL7NuZ3NR5bMPQ0d/QkadXOt5mcIkPXjA/3t6LHW1FLfbWoyTocOCYT0csjhTdWsWo2E= 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=NVtH/ssH; 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="NVtH/ssH" Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-6ee2fda66easo1983076a34.3 for ; Wed, 01 May 2024 16:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714605708; x=1715210508; 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=3ZjTlxNRGudk/6QpIkbXwD+L/r4fvBdLywaY209hNh8=; b=NVtH/ssH4teeI03p3kcCDMJJ9tF6WSTUC++TAEYsAGZsiya5P2czycFQa9OWVRYD7/ Wx/keUomrjkikfth6MC8ezwFe3Ux7DujsKyIfgn73oPM2FDu4BqA1i/RkR9dkjEgyc6X 3fyR8ousghf+3waLQ5+jCwES6birKSaoHqk2AkreqsBoe1IcB7DRtKf5moufWKL0nHT8 Nqom35p11KI/jqUoPEyyK8kOJMGc2ZPNVGaYdnpRn3b4g+PinGL9vDA7uLH7MEiFLlxU 4xO74lgmAzeRi/Aplth3XuFSMefiq5psq3kKHTsXQ32WImU8l1+lzgOPo5aSrr8xNqDs Sq2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714605708; x=1715210508; 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=3ZjTlxNRGudk/6QpIkbXwD+L/r4fvBdLywaY209hNh8=; b=CePlADJ/2jJ79yGPuV2ufRP/DFs+xqaC1rrbvd9LAWcJx5O6vIT0R70UH1XABShDdC s9Sr08rPi5pB2MFdD93oUAAyPcQtOrHf96mPU9eP8ejZaXIs54Ve5ajbFqrngOG+y9Xk cVLpEh9YIfCHfgcp875/nWRya0/2vJoBOxEvpXrbo9GldLUuVGK+JHm5yqXyT8Yqt3NC /K5McMH1R5msNNzAGvJKmAdAzAX9ZeuQSTYhboxKZ1x7M51wDB+0VDReqectpmAS5CAr S0WSn5F4pN0Y88m/OE5GM8hhmsBM+wtma5MfWGuf0bV0s6ZGJWQzjvmyE7eFzm01ZtyD CQPQ== X-Gm-Message-State: AOJu0YwN30Keiils1HpK4pN4yfN3BEXKOVTM7ERBshmS7qCx21oiFpGU v5yWOMaFhCbEM1cREJZON+Myg/ZdRBUex4IKu7rtaK3fInsx1CVIO6syaQ== X-Google-Smtp-Source: AGHT+IEZWt+hEThiQ4xZbOYeORHYVoRvoiUQ/Usq1xiiYrooWxgjRvMdKUiy2ctWUzy3Ji3w6PzHxg== X-Received: by 2002:a05:6830:6c0a:b0:6ee:575b:8dd5 with SMTP id ds10-20020a0568306c0a00b006ee575b8dd5mr481721otb.20.1714605707982; Wed, 01 May 2024 16:21: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 x11-20020a056830278b00b006ee4e216d02sm1128040otu.14.2024.05.01.16.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 16:21:47 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 3/6] qmi: gprs: register and listen to event reports Date: Wed, 1 May 2024 18:21:30 -0500 Message-ID: <20240501232144.14025-3-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501232144.14025-1-denkenz@gmail.com> References: <20240501232144.14025-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 dbd461731d94..ebbef4475120 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("set_event_report_cb: %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 23:21:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651176 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 62794168AE2 for ; Wed, 1 May 2024 23:21:49 +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=1714605710; cv=none; b=Uq7LZB6MNx0zV3ntQKQjsAbb8p4wn6jxnTI9jGV+j1Y11pDDo7y83Ox9qSi/aD225YCU4kIXLdKQ1tqpnV9NYBphHNQbLhJaM/AIjRH89hHYFCBkKLg7Fq/Ar7FeV6YZ5kvrejpLSf3455Tw9snX5+mZy5QmJBOwXri+uHeQ+Us= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605710; c=relaxed/simple; bh=hsKznquxEBOZm/whxYN0T/K8hU+CPqi7HNkk6/IeSDY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rDGuD/F8eRBl+ljeOYHie+K9XcUtWdVKkaYiw3hW9SbLzHeY2Pne4Qrpdt7f0qCoOoFZebQlhQWrD2RugX7byNfip75kuxzRN/bmH44+TGgYyUSaUh6HnHj5cpMm58BfbeRLtFSBSUPs7zsM5HRGeuG6oUDloUlp+J67xG64Zxw= 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=VpeoQ5KH; 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="VpeoQ5KH" Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6eb8ea5ac95so4300384a34.2 for ; Wed, 01 May 2024 16:21:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714605708; x=1715210508; 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=g9YGcAocKbWGCaQsxwjkN96uQtedAjjKUnGKbgpD9ys=; b=VpeoQ5KHPcP7pvOtt5z1y+sCHU9oJvZe0fUwjrobNq4QqNnhSyuzjOF9yJF2VzTxNA kcqhKRvLaigmfk5/VAZjqXK4rO1blDjoZx5LZ3sSMKMhzIKe1LSGiAaEUxGl1BdEIKiW h6m/xqR504srHgQ3s6B4iYsKQt/Q0JjHERgSnAbOvfcMvrwJvdNTkVWShwex6Er0fA6G S5fRy8X+gnZ8vIuDSzPF9U+EJAGFYRTwlF3L9X7Zt7NttV7qoX87Aa+uGCTM4DFTrH3k JECj4qsyrUfcfwBBeWwkj2Uw1dZ4AHz04+SROhJDl15gOnUJ2TRqQBAzd5kg/LvXCigg himQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714605708; x=1715210508; 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=g9YGcAocKbWGCaQsxwjkN96uQtedAjjKUnGKbgpD9ys=; b=usEbhvzOz4iorAUAdd8mudSHLfTqTVw/Ghh4lg5CpEaOt0ToqVIKJqf75bf7+M/ZAn p4Hq6M2wd7uyiBazCcyG/BadPv04swQLORFC9Rnn2UvXgG1c976zYNCXheopkx+fXJAR vosVmsDW7RzSXiTDKrR2nhoXdUFOlOiA6s/aIGwDtR4LsTh2S5a1XtAfso7ccktU86Wr ZsRRgtODp7c9emlqoeI3QNJ8BP3XGwtx0gBAJ4ANEtqeP5siVbXe6nYDifbG4Tnq1itf hOQhrb4SdD3bD6UopRLFcE95WeRLE5yGvzWNxjS/NQ+YbmOTuz8Oz46rKPi2VCGYoUJy vr1w== X-Gm-Message-State: AOJu0YwkGAy1c1CJpMS1qzWhEoNQu9HCyiqpyLyHk1WmDxsUE1w34mrI jcnKVzxa/9VM5hVY5oyJEXBSrk02IOkgtNWPD21fFyEIrlOjUGs7NvG4+A== X-Google-Smtp-Source: AGHT+IEAeCe3lcc4mzgWi+nMFsQsO24K+74nEMJGWMBYkz2Na5VFoIHN4kGYCqMoCp2K9MLOZ01KeQ== X-Received: by 2002:a9d:65c8:0:b0:6ee:32ab:8124 with SMTP id z8-20020a9d65c8000000b006ee32ab8124mr4792047oth.25.1714605708581; Wed, 01 May 2024 16:21: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 x11-20020a056830278b00b006ee4e216d02sm1128040otu.14.2024.05.01.16.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 16:21:48 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 4/6] qmi: gprs: Register for other notifications Date: Wed, 1 May 2024 18:21:31 -0500 Message-ID: <20240501232144.14025-4-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501232144.14025-1-denkenz@gmail.com> References: <20240501232144.14025-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 | 48 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index ebbef4475120..6bb5879199e6 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); @@ -291,7 +298,7 @@ static void set_event_report_cb(struct qmi_result *result, void *user_data) DBG(""); if (qmi_result_set_error(result, &error)) { - ofono_error("set_event_report_cb: %hd", error); + ofono_error("indication_register_cb: %hd", error); goto error; } @@ -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("set_event_report_cb: %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 23:21:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651177 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 8BC01168AF8 for ; Wed, 1 May 2024 23:21:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605711; cv=none; b=ft0ouXr97aBAPfqm83hx32ICEfkXOhCpbuHVdrmthQAwPnyIsIzxQBrg1M4XbNytU4sg4HfcbMpksJsnPJ6TWR/1bTPRu2nT/wo/zhj6eaAzBO7E+KhobWPESOqxaY6tUqYithBlVziAJLprN/zAOaWUMA5AOKRGF3R+Dp/qgWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605711; c=relaxed/simple; bh=Gunr/qjMIkclvQedyJBGfjBytEGAYK6OuLgGc6JmGsM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OCozxsr9t+2MWv+hjRxvzjoPlGSKThzu3mVo5LXe+snH9n78P5q06vV31MMLKpNqXuhcFu8WZeILlHQ2VINJLwRMRR79NmF2A7EIfBaq8RG91IDJhzvNrl31jppQTPQ8TYs9uAB+IULx5cZx7Qso6RG4v46vDW4omc2Puj/MKmY= 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=TNnfiXLo; arc=none smtp.client-ip=209.85.210.45 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="TNnfiXLo" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6ee135f6a21so2030902a34.2 for ; Wed, 01 May 2024 16:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714605709; x=1715210509; 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=TNnfiXLo222uYQafzds9FmIA0JbPV9XnIpQHPJUaIiOdcMiG9ckPOWQmdwBN/61mL4 6zaecL4dcBOoBBzuctN4QMoYd81QR9OCZ3pxq9NhLK7McSSMFlUpHlb81YGou6IQ1be/ lmZt7jDhd0SHbJ5KwKpbNygAImpXMYBKbio1m5tabNWUHJM+xF9SQRvO/vpwfObnE5RD 20cTPDmoHDjz/9RsV9dVZlKWnHnUwXMTg+lRxPLKU3hG2C6Rv4PK545vYl9mC69BQriT dUDiRz2+FQ3LEgKbjTLhEwVLXzm+GPqFqQcuXN5gpAAR0nZ2vKsEDOS2JvFcQKWr6ZeQ BszQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714605709; x=1715210509; 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=Mk6gVGjkAkZb4NFaZ8QVYTOdWFEjeCSg3GoYBIA29k0RpsDFEYhs/eagBjQFE2zs5N ECWKigizlgzL3Y0PVlE1yFK3cMLIBLOxlsjoyVBDxKys5J35RvSCLsGeMvgAayCuScg+ Bw4b6hQurr/cw8vfu6FJ7/qjI63OyqI1tfT0oJULcxv74a+2GYJZ5Ih6liYyOgQh74TV LtfVJdqBWzBC9+cPEJT1eN9btxg+D2InwROMGxeKFjiXfRHf34Buy6NziXOHBfWm7HKN WrKQq6TRefjiWdoFb7R1PiS48nfZA+rJ7UVluAiOsU71zHfeSnjMxlL4j/4HH3LLI9gF eV8w== X-Gm-Message-State: AOJu0YwlJbUPz2V3lI5wXQhxbPbZVW+wkByhSN93TFr87FbV/2y7Pi1p MNn0oLGPgnmktVchboUp4czWif06BaAmwwiEcjaw347iczOhmBtEKjUpqA== X-Google-Smtp-Source: AGHT+IE1kw52QZ5RQqKAC/Xc3AeSZ+WYr4XUjSl7iHpi1M4a7+lOR0JYXyU6zVa6xpSutUv4orIPFQ== X-Received: by 2002:a9d:66c8:0:b0:6eb:c398:4d2b with SMTP id t8-20020a9d66c8000000b006ebc3984d2bmr4456143otm.30.1714605709384; Wed, 01 May 2024 16:21:49 -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 x11-20020a056830278b00b006ee4e216d02sm1128040otu.14.2024.05.01.16.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 16:21:49 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 5/6] qmi: wds: add utility to parse Data System Status tlv Date: Wed, 1 May 2024 18:21:32 -0500 Message-ID: <20240501232144.14025-5-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501232144.14025-1-denkenz@gmail.com> References: <20240501232144.14025-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 23:21:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13651178 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 06F9A168AE2 for ; Wed, 1 May 2024 23:21:50 +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=1714605712; cv=none; b=FIB8nxqkBDwHYbUfvIeqfHkBz4WFfWm7U3HUJwG8EJBJMndOxXnf7M4CZsh2ko0RpxasOu0QF48Qol78EsU9FRsXoe/dBP1Ga9kuBo6LtkGTS4ipNw4XGG0w86StTXv06UcGur70gn3byJDX9GgCptqaIkqdBP/keJroW+zE+Nk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605712; c=relaxed/simple; bh=412RREiT9dop9hW/4m7vvdyjRg13n44dAeIFfT7+kjs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Dg/nfVXKGcf0ixSnstL2+hfJ+mOIYoVWnMtiA1xgRdhJH43WJwcVPbhllOaSVIH/1qzMIZMASUZEoybCwSavKVFPsJ/bf9gbyKhI45RgGB626EdTBzKprvIY9MY/AccDMu9IrwgMpPKfryxmtsjSiYKn4pAdAjnf+TJeCg4zVL4= 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=jjZ6bbJl; 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="jjZ6bbJl" Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6ef9dee5bddso283070a34.1 for ; Wed, 01 May 2024 16:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714605710; x=1715210510; 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=49gxTyc0oJbq/wVVFaN0KMeI6YcWMiWBngOx+dk9IM4=; b=jjZ6bbJlNlLHXyC98Per60jGcAkZNlL+V9w/2gb4xoVD4EZXj8rw/xgFOYtIqGaUng 8B074oc90dBLkFVOzG8l70YzWbpW5B3JuMr4ZXz8Eqj7Cy5c82kFWKfgFT+SM64uizDb h0tYCI57Trv+pO9YoLosCoKiu/AtrBpwCLI/wN/7GgHjWAY5ie5cXPoM1/K4xllGHC/6 qFZQa6YQ7XSshfXmH9ZvvjFQ840N4GC1o9OhJeVLQvxaPyy3YbK4ddCRCnDCWMTQoxZW jmmJdsdRywJUp4LrtbJA1A7ivnuDm2gV0Hj2cSVkEhnFosR3IxclbVmbVD+wdPWgFD8H IGVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714605710; x=1715210510; 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=49gxTyc0oJbq/wVVFaN0KMeI6YcWMiWBngOx+dk9IM4=; b=iitb+pZMrMnZqsTa0U9XANiyjq38nzAxuvUUUamLHsZGcOk02cN4k0cuieJlSKiLRO QwS+L9FTTpUobmtPZvt4IO7VxgLdU5JKAfDX8ifAArn+angePcbQzHYRh7HdwPonZmnR CZdaEFixCGOJpb+CE1DJczjQm/OgQYMmA/nxbNPE1E12wTEVl/7QVa0KHfdyWAnDy1OT yeRqB6I9pNYZQQCxQtcJBzgeTj9fX+4QBOwgi3O1MSfVVK+RNsdRYRO0MTKzH6BXM120 t32f299nsW3XAviMjqnhjEdKf7JdvglcR3loXh/0pMzB/D+pCJA9s9ku879JkXjDH1v9 Wjxw== X-Gm-Message-State: AOJu0YyYYAQ+gVqgxfOf25HsKyZct+fcGeVv8OXD/aCKr3VVBQyH+7wp XZHDdygkFZOOWXH/6fI7HgjGvZTkeCs1Sd2+QhcpmNzdAbA2zBqiLM8ynA== X-Google-Smtp-Source: AGHT+IFQEqReMhP1rOEOf5I4dnN1GrJ5b2SK9mAA+kxgmb1rcFhE1mrTkLpLsZbBPM5DFCTGviVf6A== X-Received: by 2002:a05:6830:1b63:b0:6ee:f04:41b6 with SMTP id d3-20020a0568301b6300b006ee0f0441b6mr4218828ote.19.1714605710088; Wed, 01 May 2024 16:21:50 -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 x11-20020a056830278b00b006ee4e216d02sm1128040otu.14.2024.05.01.16.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 16:21:49 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 6/6] qmi: gprs: Obtain LTE attach parameters after indication Date: Wed, 1 May 2024 18:21:33 -0500 Message-ID: <20240501232144.14025-6-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240501232144.14025-1-denkenz@gmail.com> References: <20240501232144.14025-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 6bb5879199e6..ebb235545e21 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); }