From patchwork Mon May 6 20:39:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13655992 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 196FB1591E8 for ; Mon, 6 May 2024 20:39:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715027997; cv=none; b=lFMcEeoXWF0D09xGzKrg6Q8LkwD4NkzzQBj1eE3bqlLfB8FpboCF85uEEk9SdDumOxrwlmf8g6wUKScU+AgFr7ogPZF+p8N8M4udsLgP6u0+iTw7WroItHYtye9oq+JmTZuBwkyC8KLqmNoV2rYYe2JMdd/SqEgsoAsLU4MpcrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715027997; c=relaxed/simple; bh=mWSCYtO2kXP1iew/GPMYRO3MMHdMvoVoDzDEgPSQcHQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bOX4dQtY4YJZsZbcjJ2GfW/XtfywHg7Oa4UxTRQOo4Ykjqn5wJ/yvo9/GvKcW3ux+C9/TzDyL9R7orJJI7TzeRqeMaMFyJU6bJ5YJgyBAMuqKG57G6S0a7EGqlzGnV7cjDDWkbjQUMJxZXqtXtZ5gYW9eO1pQtjNKoqfng1ynpM= 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=NJDCsfGQ; arc=none smtp.client-ip=209.85.210.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NJDCsfGQ" Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-6f05b8fc6c1so850683a34.0 for ; Mon, 06 May 2024 13:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715027995; x=1715632795; 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=NJDCsfGQLvKCQcOl4ynJtSkXZN9X2DUIvGNWYMLbpisSf+GW8sweofOmcBFT3ffrfE Wk0Hfu0BABgvvFcbiUXL5Zw6WZzfH7h3/4X8ZQt5REr0bQWjIJkKzk0YmQN9ukmWAtaY 5GdG1yIt4bIb4OfahqysUqMv/lab6cES/bvMop2rZlpt4skyi0rn6VEFoBRbAZLJVRXw J5pk8NDLVJhScE2v1xaGioux5jk0mlJXmlgbE8R5FOCgTSck/50xlQrdIxDorA2S96LE Sz0e6+tUTItpmCjQsMTVLeJvr/dx4z7xW+seFfA35pNa4389XADNivJ1mTtteFVbFsC4 HOQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715027995; x=1715632795; 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=VdPZ6Mt4BHwcUbXeL5mCZ68CPvul27DkHwckq8m6Aci0VR4Cj1vg1ib9UIovveMw2e 4FTI/yLYNxEpAEYCROcy3tKquLEyqnNZAUpVy9Gnyxd7KNkYcM4dKhDajQitK6IbU9GP wjGSh4W3i4Mmsd0hNNfcjRtl4sy+jFd0i7YG/vopwdJvmfrWsX1HNhFhsyyXqFpl7Dq9 8vpXFwbMNfavo6SnGc9xx9LMBzxdNTqDHFqiCc97E7ZsvrdS/3jXjNYx/pjfpDUAf9Kg +4YMZnClhr0asLsSgTpJKz9NU+J5gu0bDlj3JiFTt++E8UWkRoiP2Ra/Z08ljEfpVDaS 7/xg== X-Gm-Message-State: AOJu0YzFwJsEMdn0Ln1W9Zawn4JMH6Y5elo7VJVMPohkmKUexqHhVgJ3 fBUDL6ud27erUmLqHo5Xw4jDxEk5A+OgWswWVmWU+6wp4PmaoFDYd/rURg== X-Google-Smtp-Source: AGHT+IG6hXN9Yq++1pUtm8QOHd0vMxk6ifQkNzVr2Lb4DOGLR1Q6qHJIyXZtlxSb3ulZX/rT2FoZ+Q== X-Received: by 2002:a05:6870:d8cb:b0:23e:5cd0:faae with SMTP id of11-20020a056870d8cb00b0023e5cd0faaemr12871623oac.34.1715027994766; Mon, 06 May 2024 13:39:54 -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 gk12-20020a0568703c0c00b0023bcaacf426sm2107715oab.9.2024.05.06.13.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 13:39:54 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 1/8] qmi: wds: Fix up enum naming Date: Mon, 6 May 2024 15:39:23 -0500 Message-ID: <20240506203952.55806-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 20:39:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13655993 Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.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 09A6A15B0FF for ; Mon, 6 May 2024 20:39:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715027998; cv=none; b=LJWIyA0QWpQWGX4zj4qDFvZXO2h16yMTCOpmdir5V6r6KCcSq32aoub3uauhRnitC40e5Gf56KXzBDpvw7LZXWDUZXM/rZpSl81gstIoZ5ww42doiQapBVMw3jKpuhnya5Olstf7BKwxuvCIgaUlbjSTEhqgXNssPDX74323Mm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715027998; c=relaxed/simple; bh=IB12SvtU1tIxRMGxj881rFVkgvfKoc6j7I8SrP0sgd8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eZMfKKMAjaeOsMkvXYNwvPgzzx1TyPzwpidg3Y5n06CZfr5kO+lNUdp2EeNYtKeQG5AFmfgjbkFxBRq2JsgSTl8QFrmEk1/DvG2BhRuD5LqaltAwKCn81fLBvmp4gxIkSWsY2mdIbwtqGpdrgt3yNZuvj4+3MfMbx5OUrjlhSJo= 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=Z19K0ELE; arc=none smtp.client-ip=209.85.160.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="Z19K0ELE" Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-23d39e4c0d9so1545023fac.0 for ; Mon, 06 May 2024 13:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715027996; x=1715632796; 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=CaXuzs9lIddVyxClqvE3a0ZWOREKyb3zVVHNQ7sv4bg=; b=Z19K0ELECkodCmNZAP71CYN3+FfvGiO5eYDY5PQ9HLuJ046H+hxIqIKfkYa6nxb7u+ eaIQcEK1rDPxRrfdC0k4r5fdtmvIAAJponWgcnMPJDwM6s8yo2DxBlHOD/jWZmXCR1Ue jJ+GCsRVKwEQCWidjx5fgp3mUnFLXsrM+E73WqTMowFc57qx6Cu8A4Fw5rkYgzgdjlid IawX/t+1eITX7zBvMAGRaGEHGI5TYhRD/DePBV/XX3pP8rL9ecE6Kuu2b3F0TdSToZm2 AOqFfH5/oUdtXwtmYwDxlPHB1srQBUhs6juZxSegTHVXueZCWMwkhetI5RXIFOu/WMkX Wcgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715027996; x=1715632796; 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=CaXuzs9lIddVyxClqvE3a0ZWOREKyb3zVVHNQ7sv4bg=; b=SyEZDC5cnTz9XHPdlPnSijKQo8zvwpZhJiFAK78CRqBz/QIwZ17Jlgn2EU4tCBxZq7 3rUPb+0ldiU7Hbkp31QiJbNc98khtj5Ws1hCRbxz+Y77WQ5eacx8e/bRj3oaqRH/LdGh iVQyYqHEdpFutQH2N931nMWfXjnyTMifl77jM/OY62E4M8t2PAVW+wVENZ0yx+YXtkFs oAjPAUC8F0jaYpu1XW+s7sgCCKcbFF6ACzD3CmLsXBZ9vduShuFECIOtJK1Ku22jjcq2 bIDEbrxdWxAA3iOYdQmSlgmFpr+QY+iYBVuKE+MnbLuaUaV7PoGLN/JaLzQUhdvDiguq H91g== X-Gm-Message-State: AOJu0Yx8ercEba4bntauMgyTa8O/KF79fAZx6uXm9Hj4xnMlBlQQBNxT x8/yIM/NtGPXc0QTNJ9OHyyoKsqhpKe7ArQwrDwTasbf8CtF+fwcMb45Zg== X-Google-Smtp-Source: AGHT+IEg7/UoelbSTK2aY82br+60+EAvsgfnG8Vd6gzgO2WilQm5UMYXmXSBGZvvmu5UY1zNA/gvmA== X-Received: by 2002:a05:6870:a408:b0:23f:9d1b:fe49 with SMTP id m8-20020a056870a40800b0023f9d1bfe49mr4092702oal.11.1715027995621; Mon, 06 May 2024 13:39:55 -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 gk12-20020a0568703c0c00b0023bcaacf426sm2107715oab.9.2024.05.06.13.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 13:39:55 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 2/8] qmi: gprs: use Extended Data Bearer Technology Date: Mon, 6 May 2024 15:39:24 -0500 Message-ID: <20240506203952.55806-2-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506203952.55806-1-denkenz@gmail.com> References: <20240506203952.55806-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 | 19 ++++++++++++-- drivers/qmimodem/wds.c | 55 +++++++++++++++++++++++++++++++++++++++++ drivers/qmimodem/wds.h | 39 +++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 2 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index ebb235545e21..0cf3e95a56aa 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -152,8 +152,7 @@ static int handle_ss_info(struct qmi_result *result, struct ofono_gprs *gprs) 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 +173,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 +198,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 20:39:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13655994 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.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 6710815B15C for ; Mon, 6 May 2024 20:39:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715027999; cv=none; b=dW8CNmp/5t99IqT2yjuqLlvRRLv97AOy9QPHQ3lqAaLQO+CigsyhWie06V0LSrlOiXfRPJuFU3+gt82IKT5yHtd8aB2i/Y/Zi+FaFucaPtsfBP9bt9vAw7dlEMnvVfuFhIUwpTcsluB0KTPPsyFYWxgfP6IjFOOTLfTaUNbdQX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715027999; c=relaxed/simple; bh=YbViJ6031WMF/7kqXJvjLfqYtlyo5M9IYSjfHEPbNWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CuS+tzXlmcYKHrjH2I0pO1ktsM/017YcRkD0xUHLwU9UMQqnRQU3XtvBYj/4q+EUqEm7dVApz2EKNJ1pVJc3MBrXQO5kmPQopQOm19ifyfElgeDzsfQr7Bln1enWARvqtNCjkyHaQkRpZ42uRF5yOBYwMG2IFZqCWG7g7RnILqg= 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=CjVGl2aD; arc=none smtp.client-ip=209.85.160.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="CjVGl2aD" Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-23db0b5dd28so1675867fac.2 for ; Mon, 06 May 2024 13:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715027996; x=1715632796; 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=41FMOYQ+VGM0yAl1WQBGlOIgPSpo/6L47RObb6IBoTY=; b=CjVGl2aDbxMymz1meJAFm8KHjKhxGVeJXXIc7hDDkoRkb8PBgrjBQgLdCl2l92WwlU 4xQf9mucG8hyDsjIqUQxhb7UqJmAlonldx8k+MvUNvCKnIcCoP3z4EZ0/CPZaTFuHc+T HIr83evsHxQ8aU5xlVcTmYp7ZkhIRnpWp3S1fUPj8Hv1Ak9xxg0UntXNAtuEXJxsDUQg 0ruABWaF/OKHK1EGEygXNboNJRyWVCkxFJu6mj/nWnxpG+bdAVPvJJJCz7i1A55xRLV2 qhcVuquJCW0YmQt7BWmvE4gP9+9NWn7nPkD6umiFfDApfLdcfcMVcxwdUkioUTThmBau 18kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715027996; x=1715632796; 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=41FMOYQ+VGM0yAl1WQBGlOIgPSpo/6L47RObb6IBoTY=; b=TMCsnzQZ1CVYJPj56CqTJ1pOg17dnJp8rHbMg1lDMNJV32l0C8yDnASYB7S9zNtJWV kn8PkLQybCl/OTTnlnHnzG1F0dBg3LIDdBeuk7JFLv6yXYdqOQx09SIK9RwhuUOqwUNB KckokSBwBhyd3RT1u+BT2Vz61C30/859e1oM3Y8JqDwuj+IxjN7uZz6cacpbndIWFbC5 mvig+bjBQl34D+yzlWvJOns0nas1vziBmb+Pvlp7PQeMEF0lURAE4613OAX/Fm7kICXD R8mBiwQTXurWBGOZHDSDR4wSMdx94A7YtCq+bC74BeFhZc9ixPiTp/D8Z351KnkP5qJ8 3k+A== X-Gm-Message-State: AOJu0YzcProVEz0wOv65PcoEMeuu18p3BW+TqKgVmIa7dtk8BJLO+tF2 ZXnXdbXfwLN//7MA2zrNKYbV2VR6cfiRuP2qlhepnKn9/0pNgzEA1smrPA== X-Google-Smtp-Source: AGHT+IExR4ycTScczSB12O23nNE4w0XTGkiSIeXdt54myc4v82cT6Br2ke7LHfP6O/tqv/I86d8PiQ== X-Received: by 2002:a05:6870:b692:b0:23f:dd5:f7a8 with SMTP id cy18-20020a056870b69200b0023f0dd5f7a8mr7870801oab.37.1715027996196; Mon, 06 May 2024 13:39:56 -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 gk12-20020a0568703c0c00b0023bcaacf426sm2107715oab.9.2024.05.06.13.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 13:39:55 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 3/8] qmi: netreg: Print network capability Date: Mon, 6 May 2024 15:39:25 -0500 Message-ID: <20240506203952.55806-3-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506203952.55806-1-denkenz@gmail.com> References: <20240506203952.55806-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 | 26 --------- drivers/qmimodem/nas.c | 74 +++++++++++++++++++++++-- drivers/qmimodem/nas.h | 37 ++++++------- drivers/qmimodem/network-registration.c | 15 +++++ 4 files changed, 99 insertions(+), 53 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index 0cf3e95a56aa..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,16 +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; - /* DC is optional so only notify on successful extraction */ - 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 20:39:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13655995 Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.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 074121591E8 for ; Mon, 6 May 2024 20:39:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715027999; cv=none; b=dYgy3V+wkkGr/Fnwcqu1dONv18HGhmNiJuvPyTwV2Blt8NuSzmALQOryQGnyJQXakROBc8uf2seNJoD2xyOd7R/4pOFKmj3MMW5yqHWJtv+gOA/ZH9LL7EBTMrnAB1/oazoOstMDJQGJWBjSUNewMM14k/pBkmcvOqR7iiJ9XDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715027999; c=relaxed/simple; bh=lINYXOGbLTHSvwwokATBhpzuGvJk/brwcirFVxlEZdk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=enlrp7fh+Hb5F74bOXbQ+EQWpkDl+vqobxT9rGp8voBtgUJwrdwJI52C9/zN+V/ZFlf67woJSBobKVRAyFK/oBA5tP77kEg9t0N00fzhpEzuweaVnz88oZ+LM8tBXpYSKNvkNx6sDv/45OTVhlNc6xJ8Tkd+MuKcaep6BAZi1pc= 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=PdzGcCND; arc=none smtp.client-ip=209.85.160.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="PdzGcCND" Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-23fb052ca41so751521fac.0 for ; Mon, 06 May 2024 13:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715027997; x=1715632797; 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=PdzGcCNDb8e+MB43VW8nzhEpR2d8W4dN3sF7DMx2+25aRsTW7LTMf19OM1vn/1Cvy5 5FhNJht/BPOqL3vVoZKO8YhZ/liXgcNsVAzJXZQM1F0NSqgC5PjVO9R8JW4Ew/flV95B yZuyFlSIs0s8HohXEcP8qB/xlqPuqkFYLAnE+m54GxDIbDzrrQg5V4jOL7T3NkM9ii1e D2CeBTYLwfaCVqszGL0odybn8noD1w+spm5+HMvevx/MCgP3XUAAdnye7t/shq+4Yp1+ 9I9XEkCAI/uSvmSL399CQYjdlAX14U8Wh7E2Ud6mYW7rtwMY10DgZ06NfHWvhIpN8wIW 9zIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715027997; x=1715632797; 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=YJQJvk2fhDM3wDjdGKAzj5rw/z4EM0GmIQgU6Nmw/OyTagy98rQPrwZtwsSB0z5CZ6 Rh/9Exjevn3UTR02pKOXyJodvPokRpvg8LGRRst8EYIiue8xwuES6dxHTyEJbQv4C+nq uYhtIXO/HI4gC9AfHh4lzBCFz71wgUYFQrmRePgkPOwWOrmbv1NPazJcaG8v7nDnRno3 kCKyobRfIobY4KXzR8qLt0/m5w2RoSnmzdCCMNFpsHUZT7J+ApdSHiOQpvT6mccN03Dn Pow5+UJpWMbjqqRKvjQ6suhL2rQPn2nRF/eEZcZA08+yE44WKfre4VdVSSvwspcrhcHv 8aFg== X-Gm-Message-State: AOJu0YxCu4EkBL1h1/Bj2Po1+Ii0Ue8EErP/X3YW0HLvzI1zc4NbQdFn duLmRUCUVqvEjL520M2zeC5TcUGm3MZsRPvN8Eqg6/qbiWSj7XhIfTp9kA== X-Google-Smtp-Source: AGHT+IHaNGgEtXgMmj8i+ohsH7Xb7LtDLMsrFwVma4FqNxT9XjByYk9bgNu1h4NmsOLYiEPYQpAO9g== X-Received: by 2002:a05:6870:f101:b0:22d:fa53:5695 with SMTP id k1-20020a056870f10100b0022dfa535695mr14185993oac.25.1715027996984; Mon, 06 May 2024 13:39:56 -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 gk12-20020a0568703c0c00b0023bcaacf426sm2107715oab.9.2024.05.06.13.39.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 13:39:56 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 4/8] qmi: gprs: Remove IP Support Type parsing Date: Mon, 6 May 2024 15:39:26 -0500 Message-ID: <20240506203952.55806-4-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506203952.55806-1-denkenz@gmail.com> References: <20240506203952.55806-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 20:39:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13655996 Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC9D115B547 for ; Mon, 6 May 2024 20:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715028000; cv=none; b=lSz7YQZKDd9upGKSE2PlqRN8D0UAJWYlN8OtsB/xBTQajHbJA4lMAKZqBuayZBwSJCpO8U4olAm/gdf9pXUFznNNdbOCWLLaN+ynoH+k7gfR94U52xs2RljSF+knnsAVpgj9+aFPjAmAdsRPwSjgwusWVnU3wefcHAilnmXi0BI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715028000; c=relaxed/simple; bh=OaeFjocujl7in4tYx4myFtQ/NKp5Uw6nPMofcNLZ7zY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HoV9tv4fKwvgnlgPK6SscSo4hkdCMwyokmOgZ8hzmMHav2H86lI/FXokkJnlln5SCS/IeOZpcRtRJfTh8OhHeZAYFhWVUaIKZd6Cpz/54+rxAES1mfMQCGlMCuL0OcEzLsqJ4ADzjGZYhpWYpal34K7bYC1nYq8usoHoZQT39MI= 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=W23jXvzw; arc=none smtp.client-ip=209.85.160.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W23jXvzw" Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-23bd61fbd64so1687382fac.0 for ; Mon, 06 May 2024 13:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715027998; x=1715632798; 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=W23jXvzwALxpXAEV2PbAcFHIdcMdK1hZEQhVnN/HtHAGo35xjO8d3wiHfHn7SL7lwo T69krBJoygxBjEAEKTbJozEksFFE6ZSitvNlCG20h9ZyEpk7f9K4Q29nVjBithLQ+Ouq CpywxjAjQS/to43TP/XY6ysRUxvFTPGV7itWUivJTuek+RpmijEzKPUeT2dqiGq2kPsa GnGRKDSJ/T/aVV9/woIWZMkwhhgpo/BIJu9jwitezJC2TkyRoX00JcWPeUSZMCODkL92 pZdZY7PzZGt1YDqG6oVzTZKdofPKnldJRJ7K8MXhxs0W9uc+2zMCqFTykLl2w2+Zr86i enfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715027998; x=1715632798; 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=iDFty85I4Zy97wcc6paKuNYD3ud/htygrZYlKh5OladKV6AXAXlC00Iw7s3kWEGhk+ uOx0a/91+am4lXi18QwDpV42gkW6K6d09I2WgopG7iHIeb4yPi98D0kddUb9btBHzjUQ D2BfUdXxWPiqfcx8nBVDtmxNoQEcOA/Oy9zEOYRdhwIEExhuGA9XVujymvWg9D/9Avyp bZ7kze/9u0OjxBYh0nvWg96vUm2tZsAqHwS7VCOYY07Bick5OGFlH3Wgmn2Z/I7ULMZY LvcmzKdJgKt7UzffM18km2LzmWngx/cTaM4DLz6b5i+l5yLPxb5tCAhocg6nQl3v/P+D teHQ== X-Gm-Message-State: AOJu0YyNS0Z5Vog2gvefAJ1Hpshn38FBrmqUYE6KXoJJWii0XR20mX4b GBcnh30R/Oqy1cXU5FYL8ZMufBm04QYNoQVPH9KOxiPfIWohx+r/KyywKw== X-Google-Smtp-Source: AGHT+IEs+XI4GdPkja9vDqeUdm95/LFgoM0WrRb7XU5f+2MRTUtcBpIc5UFDF22l0GOvi6JHVULWLQ== X-Received: by 2002:a05:6870:1703:b0:229:e689:7c1b with SMTP id h3-20020a056870170300b00229e6897c1bmr13689198oae.7.1715027997837; Mon, 06 May 2024 13:39:57 -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 gk12-20020a0568703c0c00b0023bcaacf426sm2107715oab.9.2024.05.06.13.39.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 13:39:57 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 5/8] qmi: gprs: Remove magic number use Date: Mon, 6 May 2024 15:39:27 -0500 Message-ID: <20240506203952.55806-5-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506203952.55806-1-denkenz@gmail.com> References: <20240506203952.55806-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 20:39: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: 13655997 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B331F1591E8 for ; Mon, 6 May 2024 20:39:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715028001; cv=none; b=D3aYQWJdEYAF4Q2aQ8zcGShKYLrak/ZE9aoFZdX6+uHYVGOFA0Da+GBEW3ePDluYZXEKJs/JAwQwzPLwo22IcPWY9f9idy5alGC6IMny/uNpSZ6hwHbDXeVVZTbtCKTu8mgBcZeU4w6zYo22YyKSbRvSHMiCe8puSnufh8HVhZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715028001; c=relaxed/simple; bh=g7s3V2XQJQbcMGIdYGMCQvcUmNQ2E1E3wHx5PDT4Hx0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lHH2ffhONHkh3QWvpWbTci0UBsebCok/f4C4mv/e7Vg/Gto0J8eyKcqBUgaD7cp+vD8Vu07A+DzRk4PWOocbQdD5oNA6pJ5ungLtlM70fL7xP0WQimXVTswEJTkwJKa2TQ3jsaqkZwoTs4P8L+morAgk2VGrBMaUX8p5yKwFsMk= 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=EI9g7edh; arc=none smtp.client-ip=209.85.210.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EI9g7edh" Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6ed3587b93bso1545885a34.1 for ; Mon, 06 May 2024 13:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715027998; x=1715632798; 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=EI9g7edhb+kZypXAIFE/Fs4SC9kZvEVuPXOAEYXUKISAKC6F1gmrdD8KdOaL8FY0KL P9jyjb+Bm9Lo0td9NRygwPOHPvqOmdaXOJbc9fclQUlJzXnto3CXS6/ndZ6KIpSKW8Eu mRHH7qMW6P6JOhfmulhUreTWZUGnewT9xCQJi1qHSwTum1nYWzDhlkqI96GgnO20Uqnp 0owUdk/15/mocINKepoNDJ2x+7me2xsx8TQRV9onasjpK+/AWv0kUx5jAubNyIrF73xr e+4vjWsQoW7/sARJIKKH5gaQXKMePI0RCPu1baYMgVEZh74R2vTW0NqIHRdUdjluq4qJ vBQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715027998; x=1715632798; 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=Wq2UUsNnD3+dt88h5EDc8Pdwq2zuhfQ81tqDVow6Dc83F/m8T5SZ6IEgHxfvjmpget /dWRwQig9kwkOeGS+k+GaI/2StwoZch6+i/8VBuggH0+49AU38hJOg+prb0TptF35nfH CMC85IRvW07XuthUMcsew6HtCHCrECzkhwSo/QnTU9vLAOLDCaBrePNWryw7ZePZlqdm trPAlEze3LOxl1kH4TUhIzrQ2BKWjQe0HLdIqlmUWAxC3/SHII/RHrzBZqvAaQzO15xR Q76ze7vawc0eV3U7TbBo4+Dd3YwU/iTu1c57dsDNtUZLBuUpJsvFuAoUG7X9S+yllBTn p76g== X-Gm-Message-State: AOJu0YyPs3sqjnyhuUMDjbkeGCPH9053lilu56jJPhO2Dyr35IaLCv/P Ttibvt5QObcl0rIPhJlFn/isSkHgKTx/oKyA3RRiqMjqptA6i7ZuBSO1HQ== X-Google-Smtp-Source: AGHT+IGzDhvu/B3qXeofFkBBCurjXapHpvJf1bHr5Ey147bbsl116fZmMP2XkjVDmKFBAL+bOGT45A== X-Received: by 2002:a05:6870:210e:b0:23c:1f34:730 with SMTP id f14-20020a056870210e00b0023c1f340730mr12975197oae.49.1715027998557; Mon, 06 May 2024 13:39:58 -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 gk12-20020a0568703c0c00b0023bcaacf426sm2107715oab.9.2024.05.06.13.39.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 13:39:58 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 6/8] qmi: gprs-context: Split out IPv4 setting processing Date: Mon, 6 May 2024 15:39:28 -0500 Message-ID: <20240506203952.55806-6-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506203952.55806-1-denkenz@gmail.com> References: <20240506203952.55806-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 20:39: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: 13655998 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C66315B54F for ; Mon, 6 May 2024 20:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715028001; cv=none; b=mWQhsb9nsiJOVAoVjoXDcoNm/9qSl7Cy6w+NwxDJfoU3ovATGsiQ5naiqxxT6fbR1tfqydnmGqx3B3yQrLBtC6qsCoPOhRM2NgQAyoagA+GnqHZz4plbcTYf/5K0IWFhhBo76IEXZiNRiJhnG3vf/xZtaFhJmnAqaOwSE7VjiDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715028001; c=relaxed/simple; bh=Tt1aSqDTUv5Y2PSAfgtLpOu+g3b/5j+as2ygg+5YTek=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XqMOGW0O7JiXq5G6wxV1ZKcWzgbMwSU+HVeFxpfFdRKr8zz5c6LlQIJ1QMtL+fkegaIr10L9PjB1p74djns9tqDQ8Dm3N97GZgqHCH2hI6CKFBOy86NTk/F3xvAm6TxIT1Yn//VXxJ9lPgICRpdDK4eQUZXICBQFB6qutNs25qI= 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=UiyJFfgN; arc=none smtp.client-ip=209.85.160.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UiyJFfgN" Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-23eff8c9a1dso1380571fac.0 for ; Mon, 06 May 2024 13:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715027999; x=1715632799; 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=W4hi2yMVCMFpCThc6x9WbhJtpmYDPcwRS5/mvQxE2ds=; b=UiyJFfgNNisYWIAMKKeJoiwr+il4M91KJSS6fQ7dm/G+alGT3ttT5gvkUp5IHoJMz2 3ZequonZtVohe1dmBFLdXgo8OzLVUnSARlTfCQRMLQA+a7aCa4lJQlAX03VCRXd0Ip6V pHxDHL4tcGA8Zh1+2d6/54otzt9V7mVRKW9gjjzw7SN3yzNK88gYILrcyS5EDeldyFhy AV4+o0gAwlVTX4UNYns6biQgdSrk7HHaDZy9rTavj4pK8I7Aj7ykyLRme8zG7xvrKR6k Hw+4KIQnVtRxrXwhIMIQefkyERepoMz8JlHwhi7e2GnIIcUS7r2DPjEWnIsS7PIfSyKm wsxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715027999; x=1715632799; 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=W4hi2yMVCMFpCThc6x9WbhJtpmYDPcwRS5/mvQxE2ds=; b=LEBBpNd5t/ZF1zC5iEwEBDdrd7Q8IPhuwcRBXwI1JejTN+ShkuN/vgHXsyEBD1/s/8 DtPhTkyRz70BxyrXSnQEIxEWeE1lsN5ZCe15fL3nmUKPSZ/ZxhZUzw6vlDfCzQ68gqXf PgoUIJB4s5WkgDQ2uFOci2rhneBj6d71Wn4pm3Lbzj2iPCyVRBpwhWub848KFOxVif0d WZipTAEv13iBx/4GYJvEGDiGiuwz8chf9+PQgJVsnGxEt3S1KATTCAQDjdUJ8CsD+/kc YCT4kOWPNBcWx403BnM8fatjbda9UaNp5pd0LToHhqoJDyvQsiSVV0crI/ZN/4LedX5z AWtA== X-Gm-Message-State: AOJu0YyXsKX9ijo+GcByk0VqmE3umUHoy+JzeGLsEfNVegk7OOHpl8Mn PCqmUZ6GaBxXNJowB6XrfO6/emaN+XuzJ935HRZa+bbHScL1Huvy2s7xtw== X-Google-Smtp-Source: AGHT+IFqtQXzBbOaU+7R5KrYPY1qFDRw5tbGuIhaa94MKzLrIrbmejQ2T2a/ef1q0a2tygwQyK8yJQ== X-Received: by 2002:a05:6870:8326:b0:23d:417c:675 with SMTP id p38-20020a056870832600b0023d417c0675mr15210719oae.41.1715027999405; Mon, 06 May 2024 13:39:59 -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 gk12-20020a0568703c0c00b0023bcaacf426sm2107715oab.9.2024.05.06.13.39.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 13:39:59 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 7/8] qmi: gprs-context: Parse IPv6 context settings Date: Mon, 6 May 2024 15:39:29 -0500 Message-ID: <20240506203952.55806-7-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506203952.55806-1-denkenz@gmail.com> References: <20240506203952.55806-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..8a40f91d7871 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) + 1) { + 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) + 1) { + const struct in6_addr *dns2 = tlv; + + inet_ntop(AF_INET6, dns2, dns2str, sizeof(dns2str)); + dns[0] = 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 20:39: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: 13655999 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F86515B545 for ; Mon, 6 May 2024 20:40:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715028002; cv=none; b=ID0m5ouJBnpBEs1ym+EMYgLRtLogiwec6ryj6LU8++PmJgYQx6zN6lAH6rhSoC9SJgDU3LUxSbyelKpgEq3muD1lP1BYArzN+KOLz1VqLgAm5zZIv4qLU552ueUwf+UcBoMU8RA3GOq9fU/0kUN17qiV54+h2XPX9aMQ7DGdstE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715028002; c=relaxed/simple; bh=eorzlpp88bYIN8lNEORiwkTjtn+qAQ/4gWi26O2huaI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n6PTM02Y11zCMIwsNeH9KdIdgruUZBve2zNqhh9GewzYHxZfCUX9Y9Yguxl8sdLudHzSF4RRd7BWDeQh2Yvf/89wUmwTWK9DILbRff7aVUc/4oYZReGDd4VuJoZMbaeKXnk4GRwm/WpVJgeMmXF7EgvOQhozxdXpG0esDxxyVzs= 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=DHJYOzhq; arc=none smtp.client-ip=209.85.210.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DHJYOzhq" Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6f0378cd80bso1330193a34.3 for ; Mon, 06 May 2024 13:40:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715028000; x=1715632800; 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=TrdHPzhES3q+09uw4lDBYE0WuGrSt8P5mtr9rFvlwJ8=; b=DHJYOzhqKylYWoaAX++DlYUVMTJQgzdNQZzQRIT+09EdhPhsvlwbG2Umq5kza0spRg xJe3L1yDiuCgP74MOlSR1O2dxsOpb7taEfPvQJ2Q20bWINKkeN2uVTDziWLGKdgVTnZ/ vmRKB1I3EGzqCBP33dot4jkQG1qbRtewNN6p8zqciv+eJhWSUQVL5+1C0F1X6fYurrnA 8OlO6O1TInIusLBY+jbCFlHOWFuWSULCWxu8bak/ayoT1YzfS5pj6ieYlyQ/4NwtMjwX YnzsrJR+WGMM9UMs38z/mYhTBQojvnvH8abRebml0vjqMf0fcbT7+WRQQCwn603mPA72 h0Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715028000; x=1715632800; 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=TrdHPzhES3q+09uw4lDBYE0WuGrSt8P5mtr9rFvlwJ8=; b=jmzxmk2EBuwQd1NkkIVpwoSvA4LQ5/E06HbzvSwSCXVlR6A7CHSTtzKi8yupF1K76U WIoNkzMaUVs6QdKHXrrjoHTicOEXLkQMmWllgpyxJ+gRDAojjwpTK+9H0F1Ow3Z8dndJ ezmoiBgGOmmiqUEzmGNAkVxl02OHF+9HImbzOpuR6UjzMu7STjN3PW4AB9XpM4QKjhfO 0lKAubQ5QlNvm6rkdyTzSNAlXTPgW4NYrUOUIN5VV2jyE0AQ2Y1XFALvPQQD24nqNGX7 vGUPIkOtbqXD4oZoBal+z89osrPOfo1AVp6ge5b3zxJ2McxjNKhekjV+o7CiHvTmViy9 h4Pw== X-Gm-Message-State: AOJu0YzncPFukV/Kr6yV636CVU19ToyjjF936V+s32/lOgIqJZTDAq4u szXmgK0KoXK688WSjogRsDOOqPElO9tK4DqwZyLyOh4B3jesXILibjfzHw== X-Google-Smtp-Source: AGHT+IGgupCU3VL/2I6iAi6I83VrfaZtNX4BLya+u4T2z9Sx4zQamsN/VeWF8gs71zzSIKcf09ThFg== X-Received: by 2002:a05:6870:818b:b0:23f:eea9:ae35 with SMTP id k11-20020a056870818b00b0023feea9ae35mr2200516oae.41.1715028000068; Mon, 06 May 2024 13:40:00 -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 gk12-20020a0568703c0c00b0023bcaacf426sm2107715oab.9.2024.05.06.13.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 13:39:59 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 8/8] qmi: gprs-context: Obtain initial bearer IP support Date: Mon, 6 May 2024 15:39:30 -0500 Message-ID: <20240506203952.55806-8-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506203952.55806-1-denkenz@gmail.com> References: <20240506203952.55806-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 8a40f91d7871..f133eb8682c2 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,