From patchwork Mon May 6 21:57:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13656043 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.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 2D6DC27269 for ; Mon, 6 May 2024 21:58:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032688; cv=none; b=facyJR1D7AhQBKhrfb8jeSZSf/ubCW1D3VTYQRnqWfA3481KMIsfaWeAQH0qleXea4UNi+HC99WVzfvn2MlWy2aCznm39PbDSxNlorbpefsqvYi4SOgkAc7miDd/CHc2dxQIim5SET0vgzA3Jy3YAUie5jTd3GVrDnu8VuT06ek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032688; c=relaxed/simple; bh=mWSCYtO2kXP1iew/GPMYRO3MMHdMvoVoDzDEgPSQcHQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fwPvqRtYNr3mmlUu5tSyLobo2DnDZi+w/F5yk4rRN5HHGP2sA+T7mNg7REWgWVA7R37veH7uG2IiDHxQoHGgFmiZXviXCGCKvRtprLuCFYGAPvB44PBjJxYpp1PuteCVG5R2V1CiPCmG4iDZ8xn2m7nVgf0oKAy5AvJNZsMdIo4= 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=Y06d5owB; arc=none smtp.client-ip=209.85.161.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="Y06d5owB" Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5ac90ad396dso1508223eaf.3 for ; Mon, 06 May 2024 14:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715032686; x=1715637486; 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=e+6WUjHPVlhw/U9dfcyIm8mVKlaCvLZeH63jCeDW7Z4=; b=Y06d5owBe4rQKfFBEwmyAsoowg1t334FyKn8CjZZC8c3ymYxvEd/0DzFqR1XGqfXrl +4L6QJYbKp9A04/IsJ3hgzW/M+96A8Q2fItSq7Jcn84SofaJPGIHO6aXvmVFl0X1hUuw SepVfEFJR+t0Y6tKpnl0i4ERXntH0lOsllftdVX52gh7qUxQmgxZnEMn6Ls+Uz/splRr Z0CzgEuymg5uDW6WUxh5+Rz9LZrBPD9WE/+pldvsF55oZHtoUvflEpgIrMVui9aCc8kt 9ZOQNHWhhEUH8Y5nBaQjYBVUeUoD8X9Z3KD8DkHHObT1A8sGU2aNG84cyNONmd1Mc3Wd IUkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715032686; x=1715637486; 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=e+6WUjHPVlhw/U9dfcyIm8mVKlaCvLZeH63jCeDW7Z4=; b=ORvvtks1qtHhpfkIguzA4wfDXSXom6JJTpKbdj34yjFj10h0L1seaDJRRkRGkcakzv vCzKAu+DRSchxuMv6COzPOv1jKijwQ+QBQz9CV2YxLH+d5fWItvKN+N301HgrD/3QxM1 mom9FfDDW1meKWTLrNm0CnJsQS2ibHWsvaCy6yP0QmfWVH9OsQLKthGYlQ/aCvDSRlFt gvQbRGBfwPNkZyVbHPiIX7pB2i9yv6fj/d42+aUDSGSWyt7NaJRxLnKD8a8J2RqGp6LJ I5p3NtVcTBBcCBKeWIpBIUM/Wks2P7wXCAu8nUWRDb2wABYu2AXTByM7kRdcKWBsZHkV I2KA== X-Gm-Message-State: AOJu0Yx+6H0/+c2AFsPalf/2jPwnEQivNNUYKlil3ngTOm31Dils5Ehu RijOhF7HjXqJoUZESWV33SEHLoGZ0Oag+KufGGkGPvv62NESI42p0uw2fw== X-Google-Smtp-Source: AGHT+IETOgdZ/tWz/QAIQVMA94TI4KQUC6G8F/OobpugR0bXQu996jn1pX+Q9QqrB9D/OAUANes1Mg== X-Received: by 2002:a4a:d07:0:b0:5af:739f:1b83 with SMTP id 7-20020a4a0d07000000b005af739f1b83mr11554341oob.0.1715032685959; Mon, 06 May 2024 14:58:05 -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 bi8-20020a05682008c800b005afb5a216c5sm2128102oob.15.2024.05.06.14.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 14:58:05 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 1/8] qmi: wds: Fix up enum naming Date: Mon, 6 May 2024 16:57:55 -0500 Message-ID: <20240506215804.57124-1-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fixes: e075175baff2 ("qmi: wds: add utility to parse Data System Status tlv") --- drivers/qmimodem/wds.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h index 94f1c028bd81..218587c3e437 100644 --- a/drivers/qmimodem/wds.h +++ b/drivers/qmimodem/wds.h @@ -68,8 +68,8 @@ enum qmi_wds_profile_family { QMI_WDS_PROFILE_FAMILY_TETHERED = 0x01, }; -enum qmi_wds_3gpp_rat { - QMI_WDS_3GPP_RAT_WCDMA = 0x01, +enum qmi_wds_rat_3gpp { + QMI_WDS_RAT_3GPP_WCDMA = 0x01, QMI_WDS_RAT_3GPP_GPRS = 0x02, QMI_WDS_RAT_3GPP_HSDPA = 0x04, QMI_WDS_RAT_3GPP_HSUPA = 0x08, From patchwork Mon May 6 21:57:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13656044 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.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 0292915B0FE for ; Mon, 6 May 2024 21:58:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032689; cv=none; b=GQT25tkR+fs5BFfQaEKhfeDCxE4YY/9db8Gv0bfZLKRhiuHVS5ccOYUgCRV5BRuQdQ7bLGapKhqAOlA0tlK5J/bT4Eg3vUhNelem+z3n5aj1Xisl5RjOJJ6azAcL0l3Rui3s4a98iQ29mD92b6UmEUcYP+znuF7BhPW1a3Y3nmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032689; c=relaxed/simple; bh=TNp+sBADUHaZ5ZfGsbHdQkG2TO0iBao7JjqhYKXnzbc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mN5NHUqmsvNnzJZJZlZJgHJ57CpkGBWLdF7jPA7CcGv405GqABxpBxZEVUCB2MwFItd+G6oJqMlaoO/XUzMhDRc2yNgp7WvColHmDR6GS/uXJmMs89z8JYyiDFK5goK1Zs8ZsS9x/M5CLfsca+59TkGejSyFv4UqEdEH96ihr60= 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=W6BiCPpK; arc=none smtp.client-ip=209.85.161.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="W6BiCPpK" Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5b1ffd24c58so1315155eaf.2 for ; Mon, 06 May 2024 14:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715032687; x=1715637487; 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=KOgBfdbVhNBiD4mFtVHohxEIQ+nXvyisFWt91q/kgf4=; b=W6BiCPpKhO2Hv3jmNtk7JgHbmkBJXfvldvtTdI7vpl7eCle7S8X9iNnJo+u3e6Pmy5 oxOe2Lhd3npTCXUgxNN43o6NFt3lIo5qGv8yZZiJimw3vu8BArqzow+/TTXivpeR+IAj eacT+UniR15cAXZEHrH++3YAScyfsN74utmdCgPcqZ1+J/hXgfTs4n1kjHL3hZqr7REq n8k+74yI31HbQMTQCBQQ6+4Cv8DEg4OkI/RWh1E0qtsrPmzcT9BLHPX3m3j4x3Anh5Dq VaByuPmnD03jtnyofNHzCgDuhulGTK9INREUUiVDzDtz6xvbRlbSpZcnZ780boDKZZOC HQlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715032687; x=1715637487; 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=KOgBfdbVhNBiD4mFtVHohxEIQ+nXvyisFWt91q/kgf4=; b=LtBjwbKavVSfd3yNusyQJGzN7jnMmpwMcBb3wd5VFiVF1ghuasKNOMWsjJ/g2a9XLE +946r4Uy7WVUpusI4L02apeNua0VPAUD01pg7RtqcKPgCJxl57pZZTwzgApFmx3hSU9J U7lrRLc+MoYorE9tPItonqWttf7K1VNHA2uw5o7viPY3TpEHreiKrrJoIydqw1h0af+Y xjFcHnPtGFbwNHJL01Fyu1l4XaJ9poILq1a5MUqxrmJeSHtHwYRHrWM6aoSIYHDJiTzs T6Kfkpp0VyIZGUG5DP+vhBzajxtB2wzeqAI34A0dZyCJysYwAB2+zqS0qejWQcWQ1BD+ e5Mg== X-Gm-Message-State: AOJu0Yy2iA2MQY7U1XzZWjLxL7h76MTv1X+kXYN6wN6VidwawoWTrhIt Dqod3vpv1uDeHoGw1GgqhB7/MWWHomUeIWXgIlTGaE2960cp1p7eAfgbrA== X-Google-Smtp-Source: AGHT+IEywk9FLxlVy5h4HqNIiG28qCgvK6r2alJhbiMq5LcQMJVN9FYr71fheG2roXWzFIOqrr74Qg== X-Received: by 2002:a4a:4bc6:0:b0:5aa:4d6d:2674 with SMTP id q189-20020a4a4bc6000000b005aa4d6d2674mr10871004ooa.2.1715032686689; Mon, 06 May 2024 14:58:06 -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 bi8-20020a05682008c800b005afb5a216c5sm2128102oob.15.2024.05.06.14.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 14:58:06 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 2/8] qmi: gprs: use Extended Data Bearer Technology Date: Mon, 6 May 2024 16:57:56 -0500 Message-ID: <20240506215804.57124-2-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506215804.57124-1-denkenz@gmail.com> References: <20240506215804.57124-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This TLV is reported by WDS "Event Report" indication and contains a better representation of the current bearer compared to the Data Service Capability TLV reported in the NAS Serving System indication. TLV: type = "Extended Data Bearer Technology" (0x2a) length = 16 value = 00:00:00:00:03:00:00:00:00:10:00:00:00:00:00:00 translated = [ data_bearer_technology = '3gpp' radio_access_technology = '3gpp-lte' extended_data_bearer_technology_3gpp = 'lte-fdd' ...] TLV: type = "Data Service Capability" (0x11) length = 2 value = 01:0B translated = { [0] = 'lte '} Some of the 5G and more esoteric technologies are not yet handled in this commit. Support for these technologies needs to be added in the core first. Modify the logic in the gprs driver to use this new mechanism. --- drivers/qmimodem/gprs.c | 20 ++++++++++++--- drivers/qmimodem/wds.c | 55 +++++++++++++++++++++++++++++++++++++++++ drivers/qmimodem/wds.h | 39 +++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 3 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index ebb235545e21..e406eba3b19a 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -151,9 +151,7 @@ static int handle_ss_info(struct qmi_result *result, struct ofono_gprs *gprs) if (!extract_ss_info(result, &status, &tech)) return -1; - /* DC is optional so only notify on successful extraction */ - if (extract_dc_info(result, &bearer_tech)) - ofono_gprs_bearer_notify(gprs, bearer_tech); + extract_dc_info(result, &bearer_tech); return status; } @@ -174,6 +172,7 @@ 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; + static const uint8_t RESULT_EXTENDED_DATA_BEARER_TECHNOLOGY = 0x2a; struct ofono_gprs *gprs = user_data; const void *tlv; uint16_t len; @@ -198,6 +197,21 @@ static void event_report_notify(struct qmi_result *result, void *user_data) return; } + tlv = qmi_result_get(result, + RESULT_EXTENDED_DATA_BEARER_TECHNOLOGY, &len); + if (tlv) { + int r = qmi_wds_parse_extended_data_bearer_technology(tlv, len); + + if (r < 0) { + ofono_warn("extended_data_bearer_technology: %s(%d)", + strerror(-r), r); + return; + } + + ofono_gprs_bearer_notify(gprs, r); + return; + } + qmi_result_print_tlvs(result); } diff --git a/drivers/qmimodem/wds.c b/drivers/qmimodem/wds.c index 77e22f443db0..ced0c5e5308d 100644 --- a/drivers/qmimodem/wds.c +++ b/drivers/qmimodem/wds.c @@ -75,3 +75,58 @@ int qmi_wds_parse_data_system_status(const void *dss, uint16_t len) return -ENOENT; } + +int qmi_wds_parse_extended_data_bearer_technology(const void *edbt, uint16_t len) +{ + uint32_t technology; + uint32_t rat; + uint32_t so; + int bearer; + + if (len != sizeof(uint32_t) * 2 + sizeof(uint64_t)) + return -EBADMSG; + + technology = l_get_le32(edbt); + rat = l_get_le32(edbt + sizeof(uint32_t)); + so = l_get_le64(edbt + sizeof(uint32_t) * 2); + + if (technology != QMI_WDS_PROFILE_TYPE_3GPP) + return -EINVAL; + + switch (rat) { + case QMI_WDS_RAT_WCDMA: + bearer = PACKET_BEARER_UMTS; + break; + case QMI_WDS_RAT_LTE: + bearer = PACKET_BEARER_EPS; + break; + default: + return -ENOENT; + } + + if (so & (QMI_WDS_SO_LTE_LIMITED | QMI_WDS_SO_LTE_FDD | + QMI_WDS_SO_LTE_TDD)) + return PACKET_BEARER_EPS; + + if (so & (QMI_WDS_SO_HSDPAPLUS | QMI_WDS_SO_DC_HSDPAPLUS | + QMI_WDS_SO_64_QAM | QMI_WDS_SO_HSPA)) + return PACKET_BEARER_HSUPA_HSDPA; + + if (so & (QMI_WDS_SO_HSUPA | QMI_WDS_SO_DC_HSUPA)) + return PACKET_BEARER_HSUPA; + + if (so & QMI_WDS_SO_HSDPA) + return PACKET_BEARER_HSDPA; + + if (so & QMI_WDS_SO_WCDMA) + return PACKET_BEARER_UMTS; + + if (so & QMI_WDS_SO_EDGE) + return PACKET_BEARER_EGPRS; + + if (so & QMI_WDS_SO_GPRS) + return PACKET_BEARER_GPRS; + + /* Fall back to rat */ + return bearer; +} diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h index 218587c3e437..026402e7a3f6 100644 --- a/drivers/qmimodem/wds.h +++ b/drivers/qmimodem/wds.h @@ -83,6 +83,43 @@ enum qmi_wds_rat_3gpp { QMI_WDS_RAT_3GPP_NULL_BEARER = 0x8000, }; +enum qmi_wds_rat { + QMI_WDS_RAT_WCDMA = 0x01, + QMI_WDS_RAT_GERAN = 0x02, + QMI_WDS_RAT_LTE = 0x03, + QMI_WDS_RAT_TDSCDMA = 0x04, + QMI_WDS_RAT_WLAN = 0x05, +}; + +enum qmi_wds_service_option { + QMI_WDS_SO_WCDMA = 0x01ULL, + QMI_WDS_SO_HSDPA = 0x02ULL, + QMI_WDS_SO_HSUPA = 0x04ULL, + QMI_WDS_SO_HSDPAPLUS = 0x08ULL, + QMI_WDS_SO_DC_HSDPAPLUS = 0x10ULL, + QMI_WDS_SO_64_QAM = 0x20ULL, + QMI_WDS_SO_HSPA = 0x40ULL, + QMI_WDS_SO_GPRS = 0x80ULL, + QMI_WDS_SO_EDGE = 0x100ULL, + QMI_WDS_SO_GSM = 0x200ULL, + QMI_WDS_SO_S2B = 0x400ULL, + QMI_WDS_SO_LTE_LIMITED = 0x800ULL, + QMI_WDS_SO_LTE_FDD = 0x1000ULL, + QMI_WDS_SO_LTE_TDD = 0x2000ULL, + QMI_WDS_SO_TDSCDMA = 0x4000ULL, + QMI_WDS_SO_DC_HSUPA = 0x8000ULL, + QMI_WDS_SO_LTE_CA_DL = 0x10000ULL, + QMI_WDS_SO_LTE_CA_UL = 0x20000ULL, + QMI_WDS_SO_S2B_LIMITED = 0x40000ULL, + QMI_WDS_SO_FOUR_POINT_FIVE_G = 0x80000ULL, + QMI_WDS_SO_FOUR_POINT_FIVE_G_PLUS = 0x100000ULL, + QMI_WDS_SO_5G_TDD = 0x10000000000ULL, + QMI_WDS_SO_5G_SUB6 = 0x20000000000ULL, + QMI_WDS_SO_5G_MMWAVE = 0x40000000000ULL, + QMI_WDS_SO_5G_NSA = 0x80000000000ULL, + QMI_WDS_SO_5G_SA = 0x100000000000ULL, +}; + enum qmi_wds_command { QMI_WDS_RESET = 0x00, QMI_WDS_EVENT_REPORT = 0x01, @@ -128,3 +165,5 @@ 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); +int qmi_wds_parse_extended_data_bearer_technology(const void *edbt, + uint16_t len); From patchwork Mon May 6 21:57:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13656045 Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.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 DF6EE27269 for ; Mon, 6 May 2024 21:58:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032690; cv=none; b=jxdllxUrFdwOc7cuvBIQ7lOuFh9U7KSHF0YRUGfFx0GFZ7XYyrP0e9VUkfl7Tns2ht1m4QADojsDA8SWxYJloXo1SxgVFtWW65QgfHeqd9hnkqEVcyGl+xKJNdQxN4tZBW6iFZmSCIra6N+vkDryWxacpUb4yL9Xu1CdEGb+YR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032690; c=relaxed/simple; bh=7qL3YG4Ft8H0L0xNHKQgX4b+4eax3GeSO7SDbfekV98=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VoiVT4mAbsru4vK+7zZlwisJkMm8q3Xn+oOR2Y7u9Md/1opQe/+h4T1dMtc39PvpfcM8fQDCXYhQGUQI12dF5YNXQVI6VrdEJVJ4HIn1wGtzzw0VS2dk6KuziVNfoTlC6nERIsqiubiI2yfDxO/xYQ27VkmkJ2AWklqkLgbUvmw= 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=ZFg41q3G; arc=none smtp.client-ip=209.85.161.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="ZFg41q3G" Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5b203c9933dso1302904eaf.3 for ; Mon, 06 May 2024 14:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715032688; x=1715637488; 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=YL6BWKmc3Ajq8Dxl4BibiTwvEytnLgPe7mWyZHjFhvU=; b=ZFg41q3GkGYEVL3YVpts1behRLexuDOCJiUxxJWoYbYzfNA516Rhnn8HopqeO2m17j tUx3ekLXlNDnFy0ldR7SW5p5/Oxm0PiCf4U3TAzwQLO1Gm9orRdZvQe64u8AYuUHmXRe vzs8oN1uJ4gEKlsTv4caoC8QAOOH2Y9RxIMiAcLpkPVLZbVmPC8rCxiMrZAuEc8+3O0X Zm1oxI5lpxz2cdN7HZOk2emi3zzjS2WCNiE7siUO8FLRh9nkJR6fupCVYVflnlXtqnym /zRrr1SJdNJFEhpe44fEgGZ51EVfyd0QA12XPPfxK4iteB0uYlkFW1shTL+Mt59x/Ab/ XK1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715032688; x=1715637488; 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=YL6BWKmc3Ajq8Dxl4BibiTwvEytnLgPe7mWyZHjFhvU=; b=mbOcn+/vpwpbF4ANWogFtC+oBZz7pQFaDpb/2Zdjzu5iXazRVNVDE3D3I5NyyUnKLh qhCqAa2RjxqZHwGgtVZrFxr/D5IpTpdT7k36FRXpHxCVaVhbjP/k4rrAPrk1IRfTOMLN FZgwVR3DJpCfIO+HDIq4OphTRdcnR1YkQb0L1FFSm0C8pYuoWy1VCend+rq3XnK/iXTd vEcg7duL+yCqjrXR0X5sIhSs0e4bZyPzFq8zYzUi2mpcBO3Gyg2kzAZvcH9c07K+RMY5 fXd/abgLRsNGeVgK63EQzUVsHESqtNchWgRofdmUCvUytpvKVIODptZxE5l8HMu3M+Y6 X78g== X-Gm-Message-State: AOJu0YwcY8ba++zg1z4YelMFwA3YKgyqKCcrQilkzQZjFiWgcgijWDRB d92Y+tFCN3hBvvtLLC379mH/Y6h3VGEIgJS/Y7BsLuf3BOsKhDLXx8lBCQ== X-Google-Smtp-Source: AGHT+IHwaI5I7HgQC8WuKRRd+KY3/MeW7k0z1YnN1kX9f+gc9eqKSlna7E85WmdOJjRAx5+cVjD0JA== X-Received: by 2002:a4a:aec2:0:b0:5a4:75f2:54d0 with SMTP id v2-20020a4aaec2000000b005a475f254d0mr12038111oon.9.1715032687632; Mon, 06 May 2024 14:58:07 -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 bi8-20020a05682008c800b005afb5a216c5sm2128102oob.15.2024.05.06.14.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 14:58:07 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 3/8] qmi: netreg: Print network capability Date: Mon, 6 May 2024 16:57:57 -0500 Message-ID: <20240506215804.57124-3-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506215804.57124-1-denkenz@gmail.com> References: <20240506215804.57124-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since gprs driver no longer uses DATA_CAPABILITY_STATUS TLV to report the bearer to the core, move the parsing of this element to network-registration atom driver. Introduce a new utility to convert the DATA_CAPABILITY_STATUS TLV to a string list. For now, simply print the capability when this TLV is received. While here, eliminate CDMA specific enumerations as they're now obsolete. --- drivers/qmimodem/gprs.c | 25 --------- drivers/qmimodem/nas.c | 74 +++++++++++++++++++++++-- drivers/qmimodem/nas.h | 37 ++++++------- drivers/qmimodem/network-registration.c | 15 +++++ 4 files changed, 99 insertions(+), 52 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index e406eba3b19a..3ee0ce36307c 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -68,28 +68,6 @@ static bool extract_ss_info(struct qmi_result *result, int *status, int *tech) return true; } -static bool extract_dc_info(struct qmi_result *result, int *bearer_tech) -{ - const struct qmi_nas_data_capability *dc; - uint16_t len; - int i; - - DBG(""); - - dc = qmi_result_get(result, QMI_NAS_RESULT_DATA_CAPABILITY_STATUS, &len); - if (!dc) - return false; - - *bearer_tech = -1; - for (i = 0; i < dc->cap_count; i++) { - DBG("radio tech in use %d", dc->cap[i]); - - *bearer_tech = qmi_nas_cap_to_bearer_tech(dc->cap[i]); - } - - return true; -} - static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data) { struct ofono_gprs *gprs = user_data; @@ -144,15 +122,12 @@ static int handle_ss_info(struct qmi_result *result, struct ofono_gprs *gprs) { int status; int tech; - int bearer_tech; DBG(""); if (!extract_ss_info(result, &status, &tech)) return -1; - extract_dc_info(result, &bearer_tech); - return status; } diff --git a/drivers/qmimodem/nas.c b/drivers/qmimodem/nas.c index 630f901d8eb6..6146958cb869 100644 --- a/drivers/qmimodem/nas.c +++ b/drivers/qmimodem/nas.c @@ -19,6 +19,8 @@ * */ +#include + #include "nas.h" #include "src/common.h" @@ -37,6 +39,70 @@ int qmi_nas_rat_to_tech(uint8_t rat) return -1; } +static const char *qmi_nas_data_capability_to_string( + enum qmi_nas_data_capability cap) +{ + switch(cap) { + case QMI_NAS_DATA_CAPABILITY_NONE: + return "none"; + case QMI_NAS_DATA_CAPABILITY_GPRS: + return "gprs"; + case QMI_NAS_DATA_CAPABILITY_EDGE: + return "edge"; + case QMI_NAS_DATA_CAPABILITY_HSDPA: + return "hsdpa"; + case QMI_NAS_DATA_CAPABILITY_HSUPA: + return "hsupa"; + case QMI_NAS_DATA_CAPABILITY_WCDMA: + return "wcdma"; + case QMI_NAS_DATA_CAPABILITY_GSM: + return "gsm"; + case QMI_NAS_DATA_CAPABILITY_LTE: + return "lte"; + case QMI_NAS_DATA_CAPABILITY_HSDPA_PLUS: + return "hsdpa-plus"; + case QMI_NAS_DATA_CAPABILITY_DC_HSDPA_PLUS: + return "dc-hsdpa-plus"; + default: + break; + } + + return NULL; +} + +char **qmi_nas_data_capability_status_to_string_list(const void *tlv, + uint16_t len) +{ + uint8_t num; + uint8_t cap; + uint8_t i; + char **ret; + + if (len < 1) + return NULL; + + num = l_get_u8(tlv); + if (len != num + 1) + return NULL; + + ret = l_new(char *, num + 1); + tlv += 1; + + for (i = 0; i < num; i++) { + const char *v; + + cap = l_get_u8(tlv + i); + v = qmi_nas_data_capability_to_string(cap); + + if (v) + ret[i] = l_strdup(v); + else + ret[i] = l_strdup_printf("0x%02x", cap); + } + + return ret; +} + int qmi_nas_cap_to_bearer_tech(int cap_tech) { @@ -48,16 +114,12 @@ int qmi_nas_cap_to_bearer_tech(int cap_tech) return PACKET_BEARER_GPRS; case QMI_NAS_DATA_CAPABILITY_EDGE: return PACKET_BEARER_EGPRS; - case QMI_NAS_DATA_CAPABILITY_EVDO_REV_0: - case QMI_NAS_DATA_CAPABILITY_EVDO_REV_A: - case QMI_NAS_DATA_CAPABILITY_EVDO_REV_B: - return PACKET_BEARER_UMTS; case QMI_NAS_DATA_CAPABILITY_HSDPA: return PACKET_BEARER_HSDPA; case QMI_NAS_DATA_CAPABILITY_HSUPA: return PACKET_BEARER_HSUPA; - case QMI_NAS_DATA_CAPABILITY_HSDPA_PLUS: - case QMI_NAS_DATA_CAPABILITY_DC_HSDPA_PLUS: + case QMI_NAS_DATA_CAPABILITY_HSDPA_PLUS: + case QMI_NAS_DATA_CAPABILITY_DC_HSDPA_PLUS: /* * HSPAP is HSPA+; which ofono doesn't define; * so, if differentiating HSPA and HSPA+ is diff --git a/drivers/qmimodem/nas.h b/drivers/qmimodem/nas.h index cb0a927bf049..937486282dbc 100644 --- a/drivers/qmimodem/nas.h +++ b/drivers/qmimodem/nas.h @@ -107,27 +107,6 @@ struct qmi_nas_serving_system { } __attribute__((__packed__)); #define QMI_NAS_RESULT_ROAMING_STATUS 0x10 /* uint8 */ -#define QMI_NAS_RESULT_DATA_CAPABILITY_STATUS 0x11 /* uint8 */ -struct qmi_nas_data_capability { - uint8_t cap_count; - uint8_t cap[0]; -} __attribute__((__packed__)); - -#define QMI_NAS_DATA_CAPABILITY_NONE 0x00 -#define QMI_NAS_DATA_CAPABILITY_GPRS 0x01 -#define QMI_NAS_DATA_CAPABILITY_EDGE 0x02 -#define QMI_NAS_DATA_CAPABILITY_HSDPA 0x03 -#define QMI_NAS_DATA_CAPABILITY_HSUPA 0x04 -#define QMI_NAS_DATA_CAPABILITY_WCDMA 0x05 -#define QMI_NAS_DATA_CAPABILITY_CDMA 0x06 -#define QMI_NAS_DATA_CAPABILITY_EVDO_REV_0 0x07 -#define QMI_NAS_DATA_CAPABILITY_EVDO_REV_A 0x08 -#define QMI_NAS_DATA_CAPABILITY_GSM 0x09 -#define QMI_NAS_DATA_CAPABILITY_EVDO_REV_B 0x0A -#define QMI_NAS_DATA_CAPABILITY_LTE 0x0B -#define QMI_NAS_DATA_CAPABILITY_HSDPA_PLUS 0x0C -#define QMI_NAS_DATA_CAPABILITY_DC_HSDPA_PLUS 0x0D - #define QMI_NAS_RESULT_CURRENT_PLMN 0x12 struct qmi_nas_current_plmn { uint16_t mcc; @@ -180,6 +159,19 @@ struct qmi_nas_home_network { #define QMI_NAS_RESULT_SYSTEM_SELECTION_PREF_MODE 0x11 +enum qmi_nas_data_capability { + QMI_NAS_DATA_CAPABILITY_NONE = 0x00, + QMI_NAS_DATA_CAPABILITY_GPRS = 0x01, + QMI_NAS_DATA_CAPABILITY_EDGE = 0x02, + QMI_NAS_DATA_CAPABILITY_HSDPA = 0x03, + QMI_NAS_DATA_CAPABILITY_HSUPA = 0x04, + QMI_NAS_DATA_CAPABILITY_WCDMA = 0x05, + QMI_NAS_DATA_CAPABILITY_GSM = 0x09, + QMI_NAS_DATA_CAPABILITY_LTE = 0x0B, + QMI_NAS_DATA_CAPABILITY_HSDPA_PLUS = 0x0C, + QMI_NAS_DATA_CAPABILITY_DC_HSDPA_PLUS = 0x0D, +}; + enum qmi_nas_command { /* Reset NAS service state variables */ QMI_NAS_RESET = 0x00, @@ -231,4 +223,7 @@ enum qmi_nas_command { }; int qmi_nas_rat_to_tech(uint8_t rat); + +char **qmi_nas_data_capability_status_to_string_list(const void *tlv, + uint16_t len); int qmi_nas_cap_to_bearer_tech(int cap_tech); diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c index 2e2e4a10dbf8..9041199b0b53 100644 --- a/drivers/qmimodem/network-registration.c +++ b/drivers/qmimodem/network-registration.c @@ -94,11 +94,13 @@ static bool extract_ss_info(struct qmi_result *result, int *status, enum roaming_status *roaming, struct ofono_network_operator *operator) { + static const uint8_t RESULT_DATA_CAPABILITY_STATUS = 0x11; const struct qmi_nas_serving_system *ss; const struct qmi_nas_current_plmn *plmn; uint8_t i, roaming_status; uint16_t value16, len, opname_len; uint32_t value32; + const void *dcs; DBG(""); @@ -163,6 +165,19 @@ static bool extract_ss_info(struct qmi_result *result, int *status, DBG("%s (%s:%s)", operator->name, operator->mcc, operator->mnc); } + dcs = qmi_result_get(result, RESULT_DATA_CAPABILITY_STATUS, &len); + if (dcs) { + _auto_(l_strv_free) char **techs = + qmi_nas_data_capability_status_to_string_list(dcs, len); + + if (techs) { + _auto_(l_free) char *joined = + l_strjoinv(techs, ','); + + DBG("radio techs in use: %s", joined); + } + } + if (qmi_result_get_uint16(result, QMI_NAS_RESULT_LOCATION_AREA_CODE, &value16)) *lac = value16; From patchwork Mon May 6 21:57:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13656046 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.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 8D7AA15B57D for ; Mon, 6 May 2024 21:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032690; cv=none; b=RDkFKtwSsXL1OoF5S1ThSSF3aSliq8WJh147q1DCw1L4SjgwXFdarZ5QkxXC8rNGcI/IJlm/QboIUZz1Uh7mox0pWjG2qM3FlTC5jwA6KtLkxajHueFYsznDQqy9D1i5hEG9vglqDOpmgNRjo9kpMK+ERrwwWnMaC4DK9BKL3cY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032690; c=relaxed/simple; bh=lINYXOGbLTHSvwwokATBhpzuGvJk/brwcirFVxlEZdk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fkBoSVUkX5rz0IMMKOjQNhI00bU01dvXMT+9c0mw1S9HVCstT+MAAEZz3PWY2NTsD+EX19/EipiCGGNBeIAxxraoiDXjlRhhbr34jgVtePUM0ZrTCsgRiix5dSO79M/cnkHEvdFv3DrvN4w3CmGRcjxEm9b8PViMNWkCDoiAT9U= 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=i49F6Imv; arc=none smtp.client-ip=209.85.161.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="i49F6Imv" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5b2054d51e4so1035693eaf.0 for ; Mon, 06 May 2024 14:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715032688; x=1715637488; 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=vI0hSvO6xGJrJjnSr6uGeOWfJJ9YqrBHn9aso4OqzVY=; b=i49F6ImvdTi8Vo3RjP05msXMVhn/6knhIVphxPeu9IoWceQjxI+99uDLUbXwXE5/TM t9vuN0hhzGwUKrkMRdaujdeItZDvL73KI4JqCsvU+R9oH5DWde681JV97fXRel5zYtmd VXhxkOVDrjgAoPji6cWh0kOeqG5aRqK8GdmzSSaVOWadIphcn3iRZEZOe8f2DnkRj/o5 hOnV3UKXPVXfNn8e2/FF7YtV8vB55sudapwLpap4cAupkax//S/4e1yILsQhR7pLSNz/ Sri2/rvGM7vFEWjA4e0q7LYTCS34ksmp2sXym5RkH6ZjxZhfr3ZGxJqu0UssLOmAWwKv SL7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715032688; x=1715637488; 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=vI0hSvO6xGJrJjnSr6uGeOWfJJ9YqrBHn9aso4OqzVY=; b=ay4gnrt1ySKN0LfyNfrdcf1LAX14gS9TCn8cyw+tMF6aNeRiBXvdduEXSzBUuVNIlC /YsZiNsnZIDyggL0aEuvG3YzWJfLyCcUs9x+PSy9M22rVCbHUSExotFJttedkNi4/dv+ HrIgNgDK9F8jcX8+sW4Mw4Mx6KTnnVWbM4tG42kKckaeB1Yptbcb7OHg9dpYED+2rUQ+ nzUER4zaDdlYM+rik3UxLA9p400xzwdhmzuTCH54VIRUrME7gdaWpJdzbYo1wcQbnluM 2/6HLVg2FWIKciW75yxG7E5CkytABKHc5DhL8VrONUV2F5gFwigjGBzkKOUFQ8aSveQ+ 0IaA== X-Gm-Message-State: AOJu0YxIj2vkbNSHPOC7Hw/YFTolOmAZW/a+iqDemUWpk8GY44I1Dccz T3GmamOzU9KCTwI+cRVReXWO5f4rmBcNxJzbUmTPn8yVC1pexBfN+L+0Ug== X-Google-Smtp-Source: AGHT+IF3/74LqsLcx0fwzOJJ4jlQG3bcL/6GhUMXLWM/9gRbvW8wYYfYUJ822/+uQzs2iqKLxRR3iw== X-Received: by 2002:a4a:aa41:0:b0:5aa:67ac:856f with SMTP id y1-20020a4aaa41000000b005aa67ac856fmr10159696oom.4.1715032688430; Mon, 06 May 2024 14:58:08 -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 bi8-20020a05682008c800b005afb5a216c5sm2128102oob.15.2024.05.06.14.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 14:58:08 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 4/8] qmi: gprs: Remove IP Support Type parsing Date: Mon, 6 May 2024 16:57:58 -0500 Message-ID: <20240506215804.57124-4-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506215804.57124-1-denkenz@gmail.com> References: <20240506215804.57124-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This code was only used to print a message to log. Remove it for now. The IP type will actually be used by gprs-context driver to determine whether IPv4, IPv6 or Dual IP family interface should be activated. --- drivers/qmimodem/gprs.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index 3ee0ce36307c..fce975def9c2 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -74,7 +74,6 @@ static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data) struct gprs_data *data = ofono_gprs_get_data(gprs); char *apn = NULL; uint16_t error; - uint8_t iptype; DBG(""); @@ -90,9 +89,6 @@ static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data) goto noapn; } - if (qmi_result_get_uint8(result, 0x11, &iptype)) - ofono_info("LTE attach IP type: %hhd", iptype); - ofono_gprs_cid_activated(gprs, data->default_profile, apn); l_free(apn); From patchwork Mon May 6 21:57:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13656047 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.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 8D1C215B995 for ; Mon, 6 May 2024 21:58:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032691; cv=none; b=Roo7vESYgH2ceYr0J9xajPCtP9JmolRPE411kVJeTepUWGagwB9LR6k+K7F8pJ6BAHOO7j4FuJhbDV6iJoRRtfIzOSRL3eEdKCVGtOAKatz9uqzIi2P6HmKmUV9aGGgOp9kCSSGKSgtBZR9/mbd7pPj/lA/kPTKqdLJ2bzaSY8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032691; c=relaxed/simple; bh=OaeFjocujl7in4tYx4myFtQ/NKp5Uw6nPMofcNLZ7zY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hiDVfEgznMjqUVqITiq1IhK7eqwGHOWJJG9OEMoW/LQCAee9fHrUnKx/qXlscAxCutLyplr2a7ZOk+uZrCqzDEHHejNxtWf6KYRcaT79g4qPKJOyCvqr9U4BAx+0jeQNTSKYiLFjbo2cgWl6dWxx+pD3IpJRvk6jbWkwvH9N5GQ= 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=gap14Q3L; arc=none smtp.client-ip=209.85.161.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="gap14Q3L" Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5b206b78b47so827361eaf.2 for ; Mon, 06 May 2024 14:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715032689; x=1715637489; 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=wzoQTka9ikZkJsgGRty2DPEw6KSUgOn234UT0oIM600=; b=gap14Q3LO4sGj7n35MAwQWGbuxQWyR247deMBoDNP8eqRANO7Va5ma3LxtalyrNmjy 87Nb+sKp5sDDH+W23ip9cIiE7ffG4WFs/3gffB62lAvl22ld+NAlE1e39J6xwb/YkMPF 7NMPi3qUlyuKNXULaYsigrxVjVl2FwHB/Qdir13LRYSGN4lt7z9Pbmw56d+GQ/oXikXw Rmy0gyBowBGTL7SDwe9QuI9s1s7RI8doTM+MlWA5ozjCQceqNXN2tPmZA2kUXSUiC3hr z1EUFp3Bhuju0Nk5r30cCZhnDVFbLZCX4bIXdGvWZrvVj+4/zm9EjMhGFFsaw5rXcf63 JusQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715032689; x=1715637489; 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=wzoQTka9ikZkJsgGRty2DPEw6KSUgOn234UT0oIM600=; b=dsvirAIkLz8RIBIEfvPH8I4sOXgCjjFMOYPe/aV/xUzy3pfycvKBxzBepttcACKB9Z wszd6FwvOVyFv44jJn+2FgUd4wn3yyEndvY0WrGUiA2xXX6FV2rHMyoFWToEcNvkloow Nac7dcuIlwmQRSXmkxyVg4B8Je8iKMZp5FGN8DyVrG+iz77qvbiDy+/GW8jevA8q896K 2eRQ+46bFhZeR//h7eZCeoNt3olb3HxeZPe3tC7qnR5kIVSyw7Mg3k2WZ/V2scdzDj42 4BgSG8GoPQbC42noL/9aEnrc5EUBwb6FRgopYNutVtp2fu5rQFpDFSEbV5eFkd0F0DrB aH6A== X-Gm-Message-State: AOJu0YwXjpYb/Ppc0UG0TE9/F27lqLfL6wpVtSik+cj4CUxPZLABiyIy bLgBTZUGGFIe24mIaDOFSumW3ntAunUftrJ3gEWk0f2qP2GKTFQQoW/AOw== X-Google-Smtp-Source: AGHT+IEMUQigLGusX3FjKtLqXhdRyseT0zoNbuvUxtA1DK9qYOWzj4qCsfWZAltK+gzB/AtsehF5/A== X-Received: by 2002:a05:6820:2a08:b0:5b2:2b9:a503 with SMTP id dr8-20020a0568202a0800b005b202b9a503mr5873336oob.1.1715032689373; Mon, 06 May 2024 14:58:09 -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 bi8-20020a05682008c800b005afb5a216c5sm2128102oob.15.2024.05.06.14.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 14:58:08 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 5/8] qmi: gprs: Remove magic number use Date: Mon, 6 May 2024 16:57:59 -0500 Message-ID: <20240506215804.57124-5-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506215804.57124-1-denkenz@gmail.com> References: <20240506215804.57124-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/gprs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index fce975def9c2..2a0d52317cbb 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -70,6 +70,7 @@ static bool extract_ss_info(struct qmi_result *result, int *status, int *tech) static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data) { + static const uint8_t PARAM_APN = 0x10; struct ofono_gprs *gprs = user_data; struct gprs_data *data = ofono_gprs_get_data(gprs); char *apn = NULL; @@ -83,7 +84,7 @@ static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data) } /* APN */ - apn = qmi_result_get_string(result, 0x10); + apn = qmi_result_get_string(result, PARAM_APN); if (!apn) { DBG("Default profile has no APN setting"); goto noapn; From patchwork Mon May 6 21:58:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13656048 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.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 4546015B57D for ; Mon, 6 May 2024 21:58:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032692; cv=none; b=DWjciQYjgstnvN0N/VIKjSdk5ss26nqxRIDfdog93xWGHl0zPcX7z8MgoJQTYYE/2hsxhcu6jwg/uxVpwxxIPRUJj+qmujC3zEtxrllxleDfg3xBqQTqwe7CJ4dfgJM1nCmgy2763yzSGBfW1DGl3p40sqsqhFyCh1urtlAssuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032692; c=relaxed/simple; bh=g7s3V2XQJQbcMGIdYGMCQvcUmNQ2E1E3wHx5PDT4Hx0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kfaPMHq84et+lG6Jtqd/dFDY5gDJyxjmtLB9J/fBLMwt7xsB+utyGV9zAg/MyDX9gc1XMVhrDU0TDyTHA7/DNP2WJ+aMW23aMynbyecRczKT0gmJT70yBE1qO8p1Gc9YfQcNK3VEk/t5OV77oWNxVKeCitRn5//Zv1aJWq/OrXQ= 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=gKBOa71O; arc=none smtp.client-ip=209.85.161.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="gKBOa71O" Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5ac8c73cf88so1646529eaf.2 for ; Mon, 06 May 2024 14:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715032690; x=1715637490; 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=D0hIRCPoPC2tCs8yrpNf8IHi+7O88VAjVuHbsMAdko8=; b=gKBOa71ONL16erPUHtinPkuEsapdIXNUGp6VQN3rxoyr6Pfg+KWHHfGqA+oY84jKCS FvSzn6h01vC8mGD59/RTF0MFaBzcbp8gDEGvQ7PyvjJxKwPvEvmLc7kdspk3azdC1ySE uyReh5L4N0Srq/4Xlp2SlWzFDSVJ7fEWhQWrFhfO4Jd+5uXhGlz3/CqkDDEl7vFiPiCM puX82sW+insZ8ZP/V96jio8xGPnZQYJwbeZg7DSHKgGfn6rQ1tntqDvZK0kw39A0+bXe jnZRWBJN/2VkH98Sr0R4YibGyK6O+iqkMQH9jvtN3zFJUvxOcdhOLXqFO4RLzhzJQwoa f1Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715032690; x=1715637490; 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=D0hIRCPoPC2tCs8yrpNf8IHi+7O88VAjVuHbsMAdko8=; b=CXZvmhaiLWD+O+fHj/cJYABXb84u92fkHkcaE2imgKgULOhZaT3CN5r+diZ1NgtaeM XE2udWTokuIXTpMvEErHL/YakdTtsk4gIq0d6ajDn8R2yydtqUSM5j2XrjC/icF+ekwP CYBtgT4l+hNeGnDhJmOYjVEL4Gxm819sB3uB/pXpJReeY4Ii8rug8inVRnR92DWSstDU jCt7gwZyHndLsE2BS8wShzfqrEnd7a3gny36dWEN4DY69ztXiIUw0q3N4r1Pbefz2efk 65TUzIw0UCV9UUZ+3Pt8et2pYq/uEhworXzZ66Pl0DsMll94mBEoqH5rWoZjHctdOdXm 7Qvg== X-Gm-Message-State: AOJu0YzDDiOMbhBXrIpdhCarfr3hsEHWhhDimOP6Se3rkrCUnuDOCWu0 1uaOc6qXyJd8n5ZST64xN2UsZBj+xojNqbTEM82T7wz1OmMlrll95cTWBw== X-Google-Smtp-Source: AGHT+IFrMEk/zCTfHqL92stTfwsbY1gQlBclzKULjuCqpgRbyEg8smkneWa3hPtyA4Zpu7ctqb34Yw== X-Received: by 2002:a4a:b047:0:b0:5b2:f7c:a717 with SMTP id g7-20020a4ab047000000b005b20f7ca717mr4209789oon.9.1715032690081; Mon, 06 May 2024 14:58:10 -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 bi8-20020a05682008c800b005afb5a216c5sm2128102oob.15.2024.05.06.14.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 14:58:09 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 6/8] qmi: gprs-context: Split out IPv4 setting processing Date: Mon, 6 May 2024 16:58:00 -0500 Message-ID: <20240506215804.57124-6-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506215804.57124-1-denkenz@gmail.com> References: <20240506215804.57124-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Prepare to support IPv6 bearers by moving IPv4 bearer context processing into its own function. get_settings_ipv4() will be called if the reported IP Family TLV reports ipv4. --- drivers/qmimodem/gprs-context.c | 69 ++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index 9ac57c893725..99d42e7b5e1f 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -78,44 +78,20 @@ static void pkt_status_notify(struct qmi_result *result, void *user_data) } } -static void get_settings_cb(struct qmi_result *result, void *user_data) +static void get_settings_ipv4(struct ofono_gprs_context *gc, + struct qmi_result *result) { - static const uint8_t RESULT_PDP_TYPE = 0x11; /* uint8 */ - static const uint8_t RESULT_APN = 0x14; /* string */ static const uint8_t RESULT_PRIMARY_DNS = 0x15; static const uint8_t RESULT_SECONDARY_DNS = 0x16; static const uint8_t RESULT_IP_ADDRESS = 0x1e; static const uint8_t RESULT_GATEWAY = 0x20; static const uint8_t RESULT_GATEWAY_NETMASK = 0x21; - static const uint8_t RESULT_IP_FAMILY = 0x2b; /* uint8 */ - struct cb_data *cbd = user_data; - ofono_gprs_context_cb_t cb = cbd->cb; - struct ofono_gprs_context *gc = cbd->user; - uint8_t pdp_type, ip_family; uint32_t ip_addr; struct in_addr addr; char* straddr; - char* apn; const char *dns[3] = { NULL, NULL, NULL }; char dns_buf[2][INET_ADDRSTRLEN]; - DBG(""); - - if (qmi_result_set_error(result, NULL)) - goto done; - - apn = qmi_result_get_string(result, RESULT_APN); - if (apn) { - DBG("APN: %s", apn); - l_free(apn); - } - - if (qmi_result_get_uint8(result, RESULT_PDP_TYPE, &pdp_type)) - DBG("PDP type %d", pdp_type); - - if (qmi_result_get_uint8(result, RESULT_IP_FAMILY, &ip_family)) - DBG("IP family %d", ip_family); - if (qmi_result_get_uint32(result, RESULT_IP_ADDRESS, &ip_addr)) { addr.s_addr = htonl(ip_addr); straddr = inet_ntoa(addr); @@ -151,6 +127,47 @@ static void get_settings_cb(struct qmi_result *result, void *user_data) if (dns[0]) ofono_gprs_context_set_ipv4_dns_servers(gc, dns); +} + +static void get_settings_cb(struct qmi_result *result, void *user_data) +{ + static const uint8_t RESULT_PDP_TYPE = 0x11; /* uint8 */ + static const uint8_t RESULT_APN = 0x14; /* string */ + static const uint8_t RESULT_IP_FAMILY = 0x2b; /* uint8 */ + struct cb_data *cbd = user_data; + ofono_gprs_context_cb_t cb = cbd->cb; + struct ofono_gprs_context *gc = cbd->user; + uint8_t pdp_type, ip_family; + char* apn; + + DBG(""); + + if (qmi_result_set_error(result, NULL)) + goto done; + + apn = qmi_result_get_string(result, RESULT_APN); + if (apn) { + DBG("APN: %s", apn); + l_free(apn); + } + + if (qmi_result_get_uint8(result, RESULT_PDP_TYPE, &pdp_type)) + DBG("PDP type %d", pdp_type); + + if (!qmi_result_get_uint8(result, RESULT_IP_FAMILY, &ip_family)) { + ofono_error("No IP family in results"); + goto done; + } + + switch (ip_family) { + case QMI_WDS_IP_FAMILY_IPV4: + get_settings_ipv4(gc, result); + break; + case QMI_WDS_IP_FAMILY_IPV6: + break; + default: + break; + } done: CALLBACK_WITH_SUCCESS(cb, cbd->data); From patchwork Mon May 6 21:58:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13656049 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 EABDE15B98E for ; Mon, 6 May 2024 21:58:11 +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=1715032693; cv=none; b=OLGBfkZ5uX6ddQHf+GDNOONJd9q9bh54LLBHPinlQ/QWZNfUDNIB+exLHJNfkJYNm5d7gK36/68UVfKm7NPtjMO4hoYVmVEESVWRbkA7XtKATbTMsZscLoWeuUgOndgS29z8BTqp8d0OXIrto4irXXr9PguC6qiMhncSNjN0ibg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032693; c=relaxed/simple; bh=vfmPdbCFuX5OfVIYp7dZ7aoRSEr3WV1BeBepJ95sl1k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uanwfOBTQkNdGSB0O1NPyA7Anlbj4WRZvC3evF5y7IN5/nhygJwwGXlyxYxgD3kRoCAvv5usyY4rGWrBC+7+v7fjjYLNGUwIQAfy6saEcF34J87mmOUSmSnpiYIMLGIzN6JkVZyeRr7yKo4qpFHKEY7z/xu5nUXwgFs57ibWZck= 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=J/ZqMxOJ; 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="J/ZqMxOJ" Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5aa1bf6cb40so1774145eaf.1 for ; Mon, 06 May 2024 14:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715032691; x=1715637491; 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=Yezz1QzPICQ6CPdtRMH3SXqKohdJsC/65gfQ71jQVGc=; b=J/ZqMxOJTnWHAcWeoCmXzcJ6hmRSd8wOrZfiKowwS3aoylC6HlputORAbQEqsBPKL3 JjyRRzmjPskhboTVsM0zGt6SKiZazXnAf3Dk6bTfjp4dlWWdQSzMsXaIqltjml9lbcLx DDc8vCtfZf4u2+0iVmE4Xt1a6ERcsseGFhcCCBTR4b4H6wsj9xvaQGdPR6vmIFrn08wx VcUT+ap5cGrcIJ+FcJakGehAwAxuVH0wiljiooA9TH2m13/25rgnGWN8hEO9qKrrx44T 4n5g+pPs7Fo7O4/4vpBkaB3PfwlvUzKd3hjdFb699YkyxWQKuvrjymH+bcjJqWm3wnQL C4rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715032691; x=1715637491; 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=Yezz1QzPICQ6CPdtRMH3SXqKohdJsC/65gfQ71jQVGc=; b=FX3+YP2cM5DTuEOT/rotouOlzaG38JJQLtWsEfPH1JrVdjh/bxXyvNhtxK0OAmmmgI eSF3MCHj13q9cn1E8fS5FFJRxVyxbrxLTqLj/QX8quQg28ef3bTb173NiGIQ0to8x7di BvmKErQcLgyaPogvAK2xa/IYD6d50SrEXQggDqDEg5qHnyvJeSpkQNYhFITBXvT+zl27 uJnewqswMvAi2Elk6QFoscwaXEWsUpNfRbcDPJsAwkoOpDkax/lhqnCYFlPBn/o3Sie+ WexnX5x8o0Xh6RqRoFOiARmcLwT2NZ62PLqBy5HU0jl7ycf6qsceLLQsVmfdVgZwNpxJ 8NNg== X-Gm-Message-State: AOJu0YxK9bqUoDIef0MJXCeAmJI0WaNLWz4wF/C4Y5eJycmjRY9Mt6/5 7roc2kA5lfXJNp6CUDpkdgFJiMCkzAJ7UlEx/Y/ZPDr1nMw6lk8td9S3gw== X-Google-Smtp-Source: AGHT+IGe/cpxuRuArNBxlWQkaqHaLdNcYdEzl6euJaPoXI3BtToZPTYprs1aaS17cL3BiW0PFb2JiA== X-Received: by 2002:a4a:d07:0:b0:5af:739f:1b83 with SMTP id 7-20020a4a0d07000000b005af739f1b83mr11554455oob.0.1715032690824; Mon, 06 May 2024 14:58:10 -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 bi8-20020a05682008c800b005afb5a216c5sm2128102oob.15.2024.05.06.14.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 14:58:10 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 7/8] qmi: gprs-context: Parse IPv6 context settings Date: Mon, 6 May 2024 16:58:01 -0500 Message-ID: <20240506215804.57124-7-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506215804.57124-1-denkenz@gmail.com> References: <20240506215804.57124-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Similarly to get_settings_ipv4, add get_settings_ipv6 function which will parse the relevant TLVs present when GET_SETTINGS response indicates IPv6 family is in use. --- drivers/qmimodem/gprs-context.c | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index 99d42e7b5e1f..21ef1237758e 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -78,6 +78,63 @@ static void pkt_status_notify(struct qmi_result *result, void *user_data) } } +static void get_settings_ipv6(struct ofono_gprs_context *gc, + struct qmi_result *result) +{ + static const uint8_t RESULT_IP_ADDRESS = 0x25; + static const uint8_t RESULT_GATEWAY = 0x26; + static const uint8_t RESULT_PRIMARY_DNS = 0x27; + static const uint8_t RESULT_SECONDARY_DNS = 0x28; + static const uint8_t RESULT_MTU = 0x29; + const char *dns[3] = { NULL, NULL, NULL }; + char dns1str[INET6_ADDRSTRLEN]; + char dns2str[INET6_ADDRSTRLEN]; + char ipv6str[INET6_ADDRSTRLEN]; + const void *tlv; + uint16_t len; + uint32_t mtu; + + tlv = qmi_result_get(result, RESULT_IP_ADDRESS, &len); + if (tlv && len == sizeof(struct in6_addr) + 1) { + const struct in6_addr *ip = tlv; + uint8_t prefix_len = l_get_u8(ip + 1); + + inet_ntop(AF_INET6, ip, ipv6str, sizeof(ipv6str)); + ofono_gprs_context_set_ipv6_address(gc, ipv6str); + ofono_gprs_context_set_ipv6_prefix_length(gc, prefix_len); + } + + tlv = qmi_result_get(result, RESULT_GATEWAY, &len); + if (tlv && len == sizeof(struct in6_addr) + 1) { + const struct in6_addr *gw = tlv; + + inet_ntop(AF_INET6, gw, ipv6str, sizeof(ipv6str)); + ofono_gprs_context_set_ipv6_gateway(gc, ipv6str); + } + + tlv = qmi_result_get(result, RESULT_PRIMARY_DNS, &len); + if (tlv && len == sizeof(struct in6_addr)) { + const struct in6_addr *dns1 = tlv; + + inet_ntop(AF_INET6, dns1, dns1str, sizeof(dns1str)); + dns[0] = dns1str; + } + + tlv = qmi_result_get(result, RESULT_SECONDARY_DNS, &len); + if (tlv && len == sizeof(struct in6_addr)) { + const struct in6_addr *dns2 = tlv; + + inet_ntop(AF_INET6, dns2, dns2str, sizeof(dns2str)); + dns[1] = dns2str; + } + + if (dns[0]) + ofono_gprs_context_set_ipv6_dns_servers(gc, dns); + + if (qmi_result_get_uint32(result, RESULT_MTU, &mtu)) + DBG("MTU: %u", mtu); +} + static void get_settings_ipv4(struct ofono_gprs_context *gc, struct qmi_result *result) { @@ -164,6 +221,7 @@ static void get_settings_cb(struct qmi_result *result, void *user_data) get_settings_ipv4(gc, result); break; case QMI_WDS_IP_FAMILY_IPV6: + get_settings_ipv6(gc, result); break; default: break; From patchwork Mon May 6 21:58:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13656050 Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.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 B5BEB15B995 for ; Mon, 6 May 2024 21:58:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032694; cv=none; b=tTCr2ln1mp1nFLSEuUmmHDV7KRr+cqJt39UHJ31//SCiDaF3KvSJ4vR7YAswTkl0nx05Dpbvo+hZ2OOsf2BWsdms9heV6usxYybS0LYIF9SqQvR6pwMXwVlczVAVbdqioBFcz4U7yPOTERvvm/YujMw9ZLh/oisjTte0nJU2kYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715032694; c=relaxed/simple; bh=Gg4FUUxImDFijCMY1yf5Hm+htsp0/LOZYBMlD7LKeLw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gYqCfzoag7TzsS3LHgOj68luJgHSpPah/s5/qHNJ/KKuoz7tiOITqCR1OaQrC5UFmBDb6thtXARdds3d5cQI87x1W3hZN58xVacq5qgO6NLUa/+Z4rmJTspcBB+2575Fpk8vOALaJNjNVq6fvT7UCabEiLyJpXuk0Pv87apK+dY= 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=ZHCcBgu6; arc=none smtp.client-ip=209.85.161.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="ZHCcBgu6" Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5acb737b508so1033816eaf.0 for ; Mon, 06 May 2024 14:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715032692; x=1715637492; 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=7Bv8p6sCluT97Kxfk2HWuslVDffgzuyEwgnnR+kGTY0=; b=ZHCcBgu6E1zPzqBJn8bPHCJiPKcsgQiyEzMwlyidH4TNzC5DA/pWYaws2A+qyCsw58 GwunxluzJq6ZhhlZlVrVVNdv78jzbVnqfkmvL5XDlGLO4Mbd9Qdc7QwIY+pOV9Yjp/gY yWJnoQ8lqKwjIIT4wtMV62uZzF8Ajc43csWMz9T8JFlaH5qF7av0wdIkMR0L6oZy7QQF cs5ToUJGBACDB0s8MZox4PO5kvqJQWRv8ceuTUy2aFSsKfnB23l4tnouOK8wUVxHRCTZ 6PPtz7iDUfSygIV4ly0JGC+ZZfa7aBaUYlsag7rDjdCs2UCiPa2kFp1U2XXMSW8+E3Lb /UqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715032692; x=1715637492; 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=7Bv8p6sCluT97Kxfk2HWuslVDffgzuyEwgnnR+kGTY0=; b=Oj5ks/DkeG/31TT6D0cHCOazEKyO+4yL1ph7rIiH1Sa8Z8EkvHZT2RGK7DJ/c4Gpgk l5nCJAggxy8+cZOjZCQIKcYlRnVvWkQ+v7SQfeUqbbMXHwDJc0K2FCzY+SwzqCF+NDIx VZgseP6M41K4Uq/N3BYMALBjCeUp/eKFi5eKw2cqbnLEdJM8rzqFzaFemvVXhiiergyp I2eEaxAlHwlriqnvuCx50F+aDe8fnC/bMkicGUhdHrwkMAQcIwK+rHfAVravDE6Bd3Aj cLy3tM4HPKiwXfa5ePwmfeHYI/c5LP0J7R7trpER9pI4altqixGxMQQP3ggcj8b4gm7z WixQ== X-Gm-Message-State: AOJu0Yya/wxohZyREA97e/I+XTQZuB4mpyjj6wHOHefDEM0Z7zKBMYRM T8YxVaWbPiAiv/7GQ2j1oPW6lyklEH+lyp+pwAeG35YXHua04TV7qvrFlA== X-Google-Smtp-Source: AGHT+IEHVyqSThoIewC0PJLwJUWMJAIVvNesIi84Ztk0R2+Psld44niOuL+PZcHrdgT+s86rEg4kvw== X-Received: by 2002:a4a:4bc6:0:b0:5b1:bf03:d1c6 with SMTP id q189-20020a4a4bc6000000b005b1bf03d1c6mr12178083ooa.1.1715032691615; Mon, 06 May 2024 14:58:11 -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 bi8-20020a05682008c800b005afb5a216c5sm2128102oob.15.2024.05.06.14.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 14:58:11 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 8/8] qmi: gprs-context: Obtain initial bearer IP support Date: Mon, 6 May 2024 16:58:02 -0500 Message-ID: <20240506215804.57124-8-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506215804.57124-1-denkenz@gmail.com> References: <20240506215804.57124-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 .read_settings is used by the core to setup the network interface for the initial bearer. This initial bearer is typically an internet context, but can be something else, depending on the carrier. The initial bearer might also be configured by the network itself, and can be IPv4, IPv6 or dual stack. Have the gprs-context driver query the initial attach parameters to obtain this information, and only then invoke the WDS Start Network command. Supporting Dual Stack contexts requires multiple WDS handles to be allocated, with each handle issuing a Start Network request with a different IP family preference. This is currently not supported by the underlying QMUX/QRTR transport. For now, choose invoke Start Network with IPv4 family preference for IPV4 and Dual Stack contexts, and IPv6 famiily preference for IPv6 contexts. --- drivers/qmimodem/gprs-context.c | 64 ++++++++++++++++++++++++++++----- drivers/qmimodem/wds.h | 6 ++++ 2 files changed, 61 insertions(+), 9 deletions(-) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index 21ef1237758e..e04821c3ca6d 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -282,6 +282,55 @@ error: CALLBACK_WITH_FAILURE(cb, cbd->data); } +static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data) +{ + static const uint8_t RESULT_IP_SUPPORT_TYPE = 0x11; + struct cb_data *cbd = user_data; + ofono_gprs_context_cb_t cb = cbd->cb; + struct ofono_gprs_context *gc = cbd->user; + struct gprs_context_data *data = ofono_gprs_context_get_data(gc); + uint16_t error; + uint8_t iptype; + struct qmi_param *param; + uint8_t ip_family; + + DBG(""); + + if (qmi_result_set_error(result, &error)) + goto error; + + if (!qmi_result_get_uint8(result, RESULT_IP_SUPPORT_TYPE, &iptype)) + goto error; + + switch (iptype) { + case QMI_WDS_IP_SUPPORT_IPV4: + ip_family = QMI_WDS_IP_FAMILY_IPV4; + break; + case QMI_WDS_IP_SUPPORT_IPV6: + ip_family = QMI_WDS_IP_FAMILY_IPV6; + break; + case QMI_WDS_IP_SUPPORT_IPV4V6: + ip_family = QMI_WDS_IP_FAMILY_IPV4; + break; + default: + goto error; + } + + param = qmi_param_new_uint8(QMI_WDS_PARAM_IP_FAMILY, ip_family); + + if (qmi_service_send(data->wds, QMI_WDS_START_NETWORK, param, + start_net_cb, cbd, cb_data_unref) > 0) { + cb_data_ref(cbd); + return; + } + + qmi_param_free(param); + +error: + data->active_context = 0; + CALLBACK_WITH_FAILURE(cb, cbd->data); +} + /* * This function gets called for "automatic" contexts, those which are * not activated via activate_primary. For these, we will still need @@ -299,18 +348,15 @@ static void qmi_gprs_read_settings(struct ofono_gprs_context* gc, DBG("cid %u", cid); - data->active_context = cid; - - cbd->user = gc; - - if (qmi_service_send(data->wds, QMI_WDS_START_NETWORK, NULL, - start_net_cb, cbd, cb_data_unref) > 0) + if (qmi_service_send(data->wds, QMI_WDS_GET_LTE_ATTACH_PARAMETERS, + NULL, get_lte_attach_param_cb, cbd, + cb_data_unref) > 0) { + data->active_context = cid; + cbd->user = gc; return; - - data->active_context = 0; + } CALLBACK_WITH_FAILURE(cb, cbd->data); - l_free(cbd); } diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h index 026402e7a3f6..a308767177a3 100644 --- a/drivers/qmimodem/wds.h +++ b/drivers/qmimodem/wds.h @@ -46,6 +46,12 @@ enum qmi_wds_pdp_type { QMI_WDS_PDP_TYPE_IPV4V6 = 0x03, }; +enum qmi_wds_ip_support { + QMI_WDS_IP_SUPPORT_IPV4 = 0x00, + QMI_WDS_IP_SUPPORT_IPV6 = 0x01, + QMI_WDS_IP_SUPPORT_IPV4V6 = 0x02, +}; + enum qmi_wds_ip_family { QMI_WDS_IP_FAMILY_UNKNOWN = 0, QMI_WDS_IP_FAMILY_IPV4 = 4,