From patchwork Tue Apr 16 15:14: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: 13632032 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (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 8B51A12F5BE for ; Tue, 16 Apr 2024 15:14:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280492; cv=none; b=ls4J+C/h5jUzAM7XBYPx77Xy1Qe/IHcjf/ZfmNo5cVCF6/5spbTYB7gIH4d4pAzipQ7ugl76LSDuPyxrWgjaTAvriRco8SYp0S1OrSYvDVgxOYMlnQvgoWk6Kw/uig3lfAdqCMkJq4nJ7PabksAKmjUFQMVuVYeEFg6IztCANiw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280492; c=relaxed/simple; bh=5q7yV+X1T8NTe+5wWpca3gc2oT55I2Tbv4OY+c/Chgg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=N5UmpnbttCvrhOerp7TsH2stUVajuHEMuincavnZdMCJ0dziv/qawAVduNVa4KUdPHlde/2VyM3e3EsC+Bum/pmU6Y9ttaCTuU3acOtyEpCiK5KnsRgn+rZk8+Lq7LYw4lmoL9fiOPCar4V0tBb8jUhaT+r64fP5AU+vf5pkVaU= 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=H7XptQq+; arc=none smtp.client-ip=209.85.167.181 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="H7XptQq+" Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3c718ddd87eso635000b6e.0 for ; Tue, 16 Apr 2024 08:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713280490; x=1713885290; 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=WKCZlW4vxj3Ag+1jA+Z1E+aZPmrrEatrCFGdz+9ZsNY=; b=H7XptQq+4oFJR2VOrQOn1VXEVzG+V3TopMmbn+naDjoIXKF7xCKsJHOYhE+SRj93to m4hzPXgfrw4VLC98RS9rM7bxQGkUMV9J6Dc1shLDAs9Tc4l3BQ4cgHJaTJR33RV7mz2+ E0XvWX/HykGsYx5LbC1lIYD3HLfSYVzw0EwXt80vEDhM0WSQuuR40eUQMTzDJdCH8xbn u5S3r6mRjCYidFwu0PunZH1IywfNiCP7yW2mybxbAtxuAGLVKf3q2hjlx5YzdhWBZBit aCsF68kTseiYxa1w8ALhU0FABCpQdjfZPwL/dirlc/mnvRKbkEOxCEX3trT34BR0RMvW pvJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713280490; x=1713885290; 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=WKCZlW4vxj3Ag+1jA+Z1E+aZPmrrEatrCFGdz+9ZsNY=; b=EyFE9AcH6MMmPwWi+IcVSmpUvm0VMe0qQnQv9VdM61Upmq9fDh/jRAPzIy/60OnPzA Ujun0XDMhcT599iboSGj0FBpJ1h0zKerMqGVKPwN96zMIcstErJ5s1kyknwHTVd4bxaA tKrGSFFWhQzzulhqwirCKhFfcXwEQtsM7xbzsbeViQbWooiJB0OyZpQrx2C/9eHaopji G4fJGOR+ZxEJ+hIcm37v/ajFfI7oAfTQOAvVlmLDr7mE/zQS68Ctosf0XIHQMIG6UTyL laWTCd7/n1UEPzmIjvDOXf9T2iDO+bpGVdAd1pQwjvwXvirWllPH7RoxO033hqxE01qr 5+xw== X-Gm-Message-State: AOJu0YyylnL3OzJE+V62xp2NcUoOZ1wj+4M+T5Wy7dwXeJTNK7M1JjJm oJQB2UgtO01QHJpa+MRXKoD15cAYdlQ5Cx9Ejs6kFCkyE0mC2Ekumwvxyw== X-Google-Smtp-Source: AGHT+IHW207hBGg+XBlcYEEeNy5ATEcsO2DckbNRM7adnIGECb8scJ1WjR6SdCm9201vbDySWw0pYQ== X-Received: by 2002:aca:d05:0:b0:3c6:100a:86b2 with SMTP id 5-20020aca0d05000000b003c6100a86b2mr13924846oin.50.1713280490554; Tue, 16 Apr 2024 08:14:50 -0700 (PDT) Received: from localhost.localdomain ([70.114.247.242]) by smtp.gmail.com with ESMTPSA id b17-20020aca2211000000b003c708fc7267sm1085797oic.27.2024.04.16.08.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:14:50 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 1/7] qmimodem: wds: Introduce qmi_wds_ip_family enum Date: Tue, 16 Apr 2024 10:14:28 -0500 Message-ID: <20240416151448.3359644-1-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/gprs-context.c | 4 ++-- drivers/qmimodem/wds.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index 33565252028c..cbe33861968b 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -247,10 +247,10 @@ static void qmi_activate_primary(struct ofono_gprs_context *gc, switch (ctx->proto) { case OFONO_GPRS_PROTO_IP: - ip_family = 4; + ip_family = QMI_WDS_IP_FAMILY_IPV4; break; case OFONO_GPRS_PROTO_IPV6: - ip_family = 6; + ip_family = QMI_WDS_IP_FAMILY_IPV6; break; default: goto error; diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h index ffbebaffe32d..6213f75231db 100644 --- a/drivers/qmimodem/wds.h +++ b/drivers/qmimodem/wds.h @@ -63,6 +63,13 @@ struct qmi_wds_notify_conn_status { #define QMI_WDS_PDP_TYPE_IPV6 0x02 #define QMI_WDS_PDP_TYPE_IPV4V6 0x03 +enum qmi_wds_ip_family { + QMI_WDS_IP_FAMILY_UNKNOWN = 0, + QMI_WDS_IP_FAMILY_IPV4 = 4, + QMI_WDS_IP_FAMILY_IPV6 = 6, + QMI_WDS_IP_FAMILY_UNSPECIFIED = 8, +}; + enum qmi_wds_client_type { QMI_WDS_CLIENT_TYPE_TETHERED = 0x01, }; From patchwork Tue Apr 16 15:14: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: 13632033 Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (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 6BF221304A8 for ; Tue, 16 Apr 2024 15:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280493; cv=none; b=a+XQwPAehd11NKqz3noUIWQY4fp3wio6sv6k1PsilUtmqsQYI+DrhkX4JZgtmnvHFknOLNPdIpLutFLFB590n9qtJ6VB/TYLMfe3BB8srlBEhSUO8mW5KenNOHwqEbngLWZALE/0gFMqL0GIeB0xSkUq6BJ60JaFd3asX8GOtRE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280493; c=relaxed/simple; bh=rkZvzfx43fr3pOeWb6v/v4ctuIQPgB14D/mn4735eU8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IJhGFTPpj+rWKdP5ulMaJbEvWoK+BzkvXj7VyMHhYaarq/q/G65Qh4yX1dPbalgY2Ik0yUiC0ZSO4Hx1xWBl4JdFFzmJk6+YM2810uTpnta5eXQiGnMA/Eb5oc5iDVuZaBSf+nedS73djLN4Y+uTKt1+pTz5EQ1b/8ouiaxqiHQ= 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=aeZ3bygu; arc=none smtp.client-ip=209.85.167.172 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="aeZ3bygu" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3c71c7e2d40so689845b6e.3 for ; Tue, 16 Apr 2024 08:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713280491; x=1713885291; 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=rdJofdHMxVD8ZF0MmsCklun785N5ALoodngrqixhwWM=; b=aeZ3byguYIvFSgTKdpB03BbWR+YwR4H/zap8CIAMx0tslXPY0w879AY21DHEd/iBWf wtQyU/+4HQJGconbylJkZcVJnOr+CGSTHYtwYi4jmokcsnfsmnvZMbiPqJ/7J60v81iG j1GV9+rryQX8+SOO89C1LBuCTrAy5zCJ8x3tlCZRzHZ53KRNH9sLhndxpcSjDVzDgavl kI0ZpZ/bhwFsmBazam+ldeKC+EUZXDBoPHrJVKLd2eW1JLFM+/jUD86VsEgKcdpvhzaN AGf6z3a5PP4N/KqjJLOkd+WkezSASpWBPO0EBEuVZgosbq2I2Lp4NvyRTgnQ9R0KFLd/ q4HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713280491; x=1713885291; 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=rdJofdHMxVD8ZF0MmsCklun785N5ALoodngrqixhwWM=; b=FE6dr49fAhBjOtrXICrImXRnNSogweihzR1jgsI6k14tG8d0KQAPbPwg3za0TP4shk Iw9agZlNKYM4ki3bLLibSS6lkqB+vwYNPP7f+sxRo9AsiJFWriJZ9/AUcAjn3EXwdg7J ipjulg62XlS+tdr+QX26pCkoSjcal6I0thHipe6m+PjBUFzf6pxcgkC28qAYt3RW9y3C MsodiUqHMAPCuO0xUswyXH0VB2Klh26BICrOVPbkwOH73JSXJeX/IiatQI0+1p53NLR+ mgX2aaZiPNIV3UU7+9fFIgZQAU1DlkwkSkqoQ7wpWZ8Rdm3JTJdVQtmQooBqDYGWhKdV UYPg== X-Gm-Message-State: AOJu0YxTPmVb3T29f2LSotCNomID21n5U6zKH0bjR01tDvVSAkTsFHTW cNY+1z8CYVVtVbExToS2WSJRZe5F2i/dzZk3LpLE523HM/3nU3njEZryYQ== X-Google-Smtp-Source: AGHT+IGFxvi3474ROTPB9sXdycHy0mGdU6IFU/N8/lV11DdLITN1an8bfCcO9tkQhMGr29XNrX2C8g== X-Received: by 2002:a05:6808:1911:b0:3c4:e00a:6c2b with SMTP id bf17-20020a056808191100b003c4e00a6c2bmr16219924oib.53.1713280491287; Tue, 16 Apr 2024 08:14:51 -0700 (PDT) Received: from localhost.localdomain ([70.114.247.242]) by smtp.gmail.com with ESMTPSA id b17-20020aca2211000000b003c708fc7267sm1085797oic.27.2024.04.16.08.14.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:14:50 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 2/7] qmi: gprs-context: Do not free/alloc unnecessarily Date: Tue, 16 Apr 2024 10:14:29 -0500 Message-ID: <20240416151448.3359644-2-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240416151448.3359644-1-denkenz@gmail.com> References: <20240416151448.3359644-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In start_net_cb, a new cb_data object is allocated which contains the exact same information as the cb_data object being passed in as userdata. Use cb_data_ref/unref instead. While here, also fix an erroneous invocation of CALLBACK_WITH_SUCCESS if the GET_CURRENT_SETTINGS request was not queued successfully. An error should be generated instead. --- drivers/qmimodem/gprs-context.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index cbe33861968b..1d7449e68ccc 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -166,17 +166,12 @@ static void start_net_cb(struct qmi_result *result, void *user_data) data->pkt_handle = handle; - /* Duplicate cbd, the old one will be freed when this method returns */ - cbd = cb_data_new(cb, cbd->data); - cbd->user = gc; if (qmi_service_send(data->wds, QMI_WDS_GET_CURRENT_SETTINGS, NULL, - get_settings_cb, cbd, l_free) > 0) + get_settings_cb, cbd, cb_data_unref) > 0) { + cb_data_ref(cbd); return; - - CALLBACK_WITH_SUCCESS(cb, cbd->data); - - return; + } error: data->active_context = 0; @@ -205,7 +200,7 @@ static void qmi_gprs_read_settings(struct ofono_gprs_context* gc, cbd->user = gc; if (qmi_service_send(data->wds, QMI_WDS_START_NETWORK, NULL, - start_net_cb, cbd, l_free) > 0) + start_net_cb, cbd, cb_data_unref) > 0) return; data->active_context = 0; @@ -277,7 +272,7 @@ static void qmi_activate_primary(struct ofono_gprs_context *gc, strlen(ctx->password), ctx->password); if (qmi_service_send(data->wds, QMI_WDS_START_NETWORK, param, - start_net_cb, cbd, l_free) > 0) + start_net_cb, cbd, cb_data_unref) > 0) return; qmi_param_free(param); From patchwork Tue Apr 16 15:14: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: 13632034 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (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 1F2E112F5BE for ; Tue, 16 Apr 2024 15:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280494; cv=none; b=AJc544F7vTPdItZ6/Q9/XcPjhKDOAuTciF+LJWYL2J4Ov2xismRAYl8wLyDu2nft8Dt7UkN9W/b9aVnEHlR1b7Os/kYfU4351N2BlCkhyn/6DbuH/NNVXmUhaFi8YfTAN2DJalorRGV/WXvK6wW/r8XfPILKttaJgR0xWnzxJwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280494; c=relaxed/simple; bh=/spuNrbXsLrvDYP/0kcBWeqaGEFTZsDsKgrLZO4UpVY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l3zTrFFWJvmAvs/jPLy066h9SZCmF20bcj4/kBmb8ByN5A/S7/s+GUhTTOvmfgwGjZVznvFoxJHAr6cOedsfyWrzA4TeQ+R++YnLEiprcAkpyJpnqjLJsigzgFnnz4IQLr0yVa11AnDEtlDqikqYeOYf2+Lisdu32YRm2ea0SB8= 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=bpnsJWLL; arc=none smtp.client-ip=209.85.167.170 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="bpnsJWLL" Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3c70d8bb618so1132803b6e.2 for ; Tue, 16 Apr 2024 08:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713280492; x=1713885292; 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=BzKfzYYVa5pORzkJU4nfCQCEZJgpac7TLoOVQUTBdSc=; b=bpnsJWLLNyWdslyZyqIydNinMjAv6rgGh9ZIozFoXGUSExhypgOePpPsrCTyF8lV7m IvMySS/PP+Jqmo6K8+yMG29Z35tWoNfRqUMTC2Eduhr+dCiM6C+bTBdzhxymuO+a6yao kN1YFHB+1CaZIvp29cn7ncLGJF0vzd6vVD39c784O8E8oNY3IJXTAU2HiOhjzIwGb/Zy PrCdydLSxUtNGIyEF2UZH/nf+UfZiAkhFbxXcqezEh5l0F22bVGAQnHWVEOmWQIIZLep GqmhgLvQwpS+va0ehPjklbxd2zqmJqNFgswKWztSrfBG/8Q7FLFSLXI9iME94pgL55DR FQVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713280492; x=1713885292; 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=BzKfzYYVa5pORzkJU4nfCQCEZJgpac7TLoOVQUTBdSc=; b=t8zaHFH4jl0CmVLKPa/eUEH4r8aB6swXKF9gzTEVb7gem0fW7FXdmZgUoxm8u7vPht hOeaf91aAqiGaOPSabbRAt1U3PeVLPc8ZBNSkIu1iwlpg81Q6osKFx+k8Q+99icC2jqo aDf6o/k9iLfAE4vx5TWxCJTCM55QIhzCtCOUxfB7NFg3cjwiRyfmgAeBpQ/mWjeqggZz RZCUwPaGyuDtjBpLyGS8qqhSjasWWnxIPpgFcaMpiUWbmxV8aC0uq+vPdFxVtfCsWdBN 7LAbiwHVcMRnJe4qeuToeReSm3zIuwhVIgtIpPeaFutO/6n6xxiSZxEcn68ksznpai6v 2tqw== X-Gm-Message-State: AOJu0Ywe0QyPeKrOZjFlFTiQI7CCHkjVNfr6f6VdrQWkaue9VXIWL7Mh 788sxKCvL14u2cHGuofhJzpqtJ/UYZemfo0Q00W3BUy7tD5Yl7UQk0HdYA== X-Google-Smtp-Source: AGHT+IFjerzEFV4b6MqaMpflExHvOECzQ4S1jcYvcMS7WnOqKQ72VGZ06SgaTQKJqcxCe5cE+2Liaw== X-Received: by 2002:a05:6808:1596:b0:3c7:291b:3f44 with SMTP id t22-20020a056808159600b003c7291b3f44mr1467870oiw.12.1713280492004; Tue, 16 Apr 2024 08:14:52 -0700 (PDT) Received: from localhost.localdomain ([70.114.247.242]) by smtp.gmail.com with ESMTPSA id b17-20020aca2211000000b003c708fc7267sm1085797oic.27.2024.04.16.08.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:14:51 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 3/7] qmi: gprs-context: Move singleton defines to call site Date: Tue, 16 Apr 2024 10:14:30 -0500 Message-ID: <20240416151448.3359644-3-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240416151448.3359644-1-denkenz@gmail.com> References: <20240416151448.3359644-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 These defines are used only a single time, either as an enumeration for a parameter or result. Move them to be closer to the actual call site and do not use a QMI_WDS prefix. --- drivers/qmimodem/gprs-context.c | 40 ++++++++++++++++++++------------- drivers/qmimodem/wds.h | 17 -------------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index 1d7449e68ccc..ef49e1bcf421 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -44,6 +44,8 @@ struct gprs_context_data { static void pkt_status_notify(struct qmi_result *result, void *user_data) { + static const uint8_t RESULT_CONN_STATUS = 0x01; + static const uint8_t RESULT_IP_FAMILY = 0x12; struct ofono_gprs_context *gc = user_data; struct gprs_context_data *data = ofono_gprs_context_get_data(gc); const struct qmi_wds_notify_conn_status *status; @@ -52,13 +54,13 @@ static void pkt_status_notify(struct qmi_result *result, void *user_data) DBG(""); - status = qmi_result_get(result, QMI_WDS_NOTIFY_CONN_STATUS, &len); + status = qmi_result_get(result, RESULT_CONN_STATUS, &len); if (!status) return; DBG("conn status %d", status->status); - if (qmi_result_get_uint8(result, QMI_WDS_NOTIFY_IP_FAMILY, &ip_family)) + if (qmi_result_get_uint8(result, RESULT_IP_FAMILY, &ip_family)) DBG("ip family %d", ip_family); switch (status->status) { @@ -75,6 +77,14 @@ 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 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; @@ -91,49 +101,46 @@ static void get_settings_cb(struct qmi_result *result, void *user_data) if (qmi_result_set_error(result, NULL)) goto done; - apn = qmi_result_get_string(result, QMI_WDS_RESULT_APN); + apn = qmi_result_get_string(result, RESULT_APN); if (apn) { DBG("APN: %s", apn); l_free(apn); } - if (qmi_result_get_uint8(result, QMI_WDS_RESULT_PDP_TYPE, &pdp_type)) + if (qmi_result_get_uint8(result, RESULT_PDP_TYPE, &pdp_type)) DBG("PDP type %d", pdp_type); - if (qmi_result_get_uint8(result, QMI_WDS_RESULT_IP_FAMILY, &ip_family)) + if (qmi_result_get_uint8(result, RESULT_IP_FAMILY, &ip_family)) DBG("IP family %d", ip_family); - if (qmi_result_get_uint32(result,QMI_WDS_RESULT_IP_ADDRESS, &ip_addr)) { + if (qmi_result_get_uint32(result, RESULT_IP_ADDRESS, &ip_addr)) { addr.s_addr = htonl(ip_addr); straddr = inet_ntoa(addr); DBG("IP addr: %s", straddr); ofono_gprs_context_set_ipv4_address(gc, straddr, 1); } - if (qmi_result_get_uint32(result,QMI_WDS_RESULT_GATEWAY, &ip_addr)) { + if (qmi_result_get_uint32(result, RESULT_GATEWAY, &ip_addr)) { addr.s_addr = htonl(ip_addr); straddr = inet_ntoa(addr); DBG("Gateway: %s", straddr); ofono_gprs_context_set_ipv4_gateway(gc, straddr); } - if (qmi_result_get_uint32(result, - QMI_WDS_RESULT_GATEWAY_NETMASK, &ip_addr)) { + if (qmi_result_get_uint32(result, RESULT_GATEWAY_NETMASK, &ip_addr)) { addr.s_addr = htonl(ip_addr); straddr = inet_ntoa(addr); DBG("Gateway netmask: %s", straddr); ofono_gprs_context_set_ipv4_netmask(gc, straddr); } - if (qmi_result_get_uint32(result, - QMI_WDS_RESULT_PRIMARY_DNS, &ip_addr)) { + if (qmi_result_get_uint32(result, RESULT_PRIMARY_DNS, &ip_addr)) { addr.s_addr = htonl(ip_addr); dns[0] = inet_ntop(AF_INET, &addr, dns_buf[0], sizeof(dns_buf[0])); DBG("Primary DNS: %s", dns[0]); } - if (qmi_result_get_uint32(result, - QMI_WDS_RESULT_SECONDARY_DNS, &ip_addr)) { + if (qmi_result_get_uint32(result, RESULT_SECONDARY_DNS, &ip_addr)) { addr.s_addr = htonl(ip_addr); dns[1] = inet_ntop(AF_INET, &addr, dns_buf[1], sizeof(dns_buf[1])); DBG("Secondary DNS: %s", dns[1]); @@ -148,6 +155,7 @@ done: static void start_net_cb(struct qmi_result *result, void *user_data) { + static const uint8_t RESULT_PACKET_HANDLE = 0x01; struct cb_data *cbd = user_data; ofono_gprs_context_cb_t cb = cbd->cb; struct ofono_gprs_context *gc = cbd->user; @@ -159,7 +167,7 @@ static void start_net_cb(struct qmi_result *result, void *user_data) if (qmi_result_set_error(result, NULL)) goto error; - if (!qmi_result_get_uint32(result, QMI_WDS_RESULT_PKT_HANDLE, &handle)) + if (!qmi_result_get_uint32(result, RESULT_PACKET_HANDLE, &handle)) goto error; DBG("packet handle %d", handle); @@ -314,6 +322,7 @@ static void qmi_deactivate_primary(struct ofono_gprs_context *gc, unsigned int cid, ofono_gprs_context_cb_t cb, void *user_data) { + static const uint8_t PARAM_PACKET_HANDLE = 0x01; struct gprs_context_data *data = ofono_gprs_context_get_data(gc); struct cb_data *cbd = cb_data_new(cb, user_data); struct qmi_param *param; @@ -322,8 +331,7 @@ static void qmi_deactivate_primary(struct ofono_gprs_context *gc, cbd->user = gc; - param = qmi_param_new_uint32(QMI_WDS_PARAM_PKT_HANDLE, - data->pkt_handle); + param = qmi_param_new_uint32(PARAM_PACKET_HANDLE, data->pkt_handle); if (qmi_service_send(data->wds, QMI_WDS_STOP_NETWORK, param, stop_net_cb, cbd, l_free) > 0) diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h index 6213f75231db..398f77c74672 100644 --- a/drivers/qmimodem/wds.h +++ b/drivers/qmimodem/wds.h @@ -30,34 +30,17 @@ #define QMI_WDS_AUTHENTICATION_PAP 0x1 #define QMI_WDS_AUTHENTICATION_CHAP 0x2 -#define QMI_WDS_RESULT_PKT_HANDLE 0x01 /* uint32 */ - -/* Stop WDS network interface */ -#define QMI_WDS_PARAM_PKT_HANDLE 0x01 /* uint32 */ - /* Packet data connection status indication */ -#define QMI_WDS_NOTIFY_CONN_STATUS 0x01 struct qmi_wds_notify_conn_status { uint8_t status; uint8_t reconf; } __attribute__((__packed__)); -#define QMI_WDS_NOTIFY_IP_FAMILY 0x12 /* uint8 */ #define QMI_WDS_CONN_STATUS_DISCONNECTED 0x01 #define QMI_WDS_CONN_STATUS_CONNECTED 0x02 #define QMI_WDS_CONN_STATUS_SUSPENDED 0x03 #define QMI_WDS_CONN_STATUS_AUTHENTICATING 0x04 -/* Get the runtime data session settings */ -#define QMI_WDS_RESULT_PDP_TYPE 0x11 /* uint8 */ -#define QMI_WDS_RESULT_APN 0x14 /* string */ -#define QMI_WDS_RESULT_PRIMARY_DNS 0x15 /* uint32 IPv4 */ -#define QMI_WDS_RESULT_SECONDARY_DNS 0x16 /* uint32 IPv4 */ -#define QMI_WDS_RESULT_IP_ADDRESS 0x1e /* uint32 IPv4 */ -#define QMI_WDS_RESULT_GATEWAY 0x20 /* uint32 IPv4 */ -#define QMI_WDS_RESULT_GATEWAY_NETMASK 0x21 /* uint32 IPv4 */ -#define QMI_WDS_RESULT_IP_FAMILY 0x2b /* uint8 */ - #define QMI_WDS_PDP_TYPE_IPV4 0x00 #define QMI_WDS_PDP_TYPE_PPP 0x01 #define QMI_WDS_PDP_TYPE_IPV6 0x02 From patchwork Tue Apr 16 15:14:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13632035 Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) (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 ACB2B130A43 for ; Tue, 16 Apr 2024 15:14:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280495; cv=none; b=FtipHzvkE9gkzjz/CaO6fZEBGB65c6+cAcf3LHwMkvd9DLz1AdLBZ9k1FYWgGKb3+ipTVjNdXstV89TjrHkF5QrK2LWfMAjpLe7Lp16Tm17fJFGDzmUgrmwBK38gCDjkfDBnDK7H3qXKTsi/crMt1QlHYX3m5p3UeqpNeLWchTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280495; c=relaxed/simple; bh=zHSIwGEmxSi+QiRXVF7x2cWl1zWn+ptTCyNgcy9ogzo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MwzitMqtHp3+ZI1UJ924k8wg38eWaAna8RHTcojy1WNHnq7dwUIAL8WWNvXvCqk/p9olkDyRc0Y8gbzuq9/AuYatcmwFdbUdL6XfqXL21WNBjhJBfOY5XIOSDmD1N9mGsbdVbzNS1fvKbM3AUhlP/RjAEtuFMjk3hd/FdQZxOYs= 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=OcQf0LVv; arc=none smtp.client-ip=209.85.167.177 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="OcQf0LVv" Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3c70ef25e19so1140899b6e.3 for ; Tue, 16 Apr 2024 08:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713280492; x=1713885292; 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=5GtgPZ4dJTn593dqsX6XA77rx66P6gF3r46CjDj+akE=; b=OcQf0LVvsrHrMx1YdGcwF9S8SA5bfEPl3xxND3gWZYdVB368G5tgEeAUsY/O/leCCR J5hScU5CwfXVXA6eSgJkVWh4sr7mQc7Loggp15SMPhOUjhqjO3EIv3AVGplXQDifbyNW lcJvdYF/TkGeAEzmHl4ZTERuASvIq9pCELqzR8WzqJY28BsGqVfcsnLtOONndD8qyIoU sEbETCO/pa71iNFdDMJUaDY8EOFvbMpJpCTWX4znRWtMbq1A2oUMa6YT+681njdXxgzd V3dJfvdci2KKMMfErmMIUVuWNfEmgOj8oBMo1d/9SE55n6Qz2dwqYB2fM2119ylKe0s1 8aTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713280492; x=1713885292; 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=5GtgPZ4dJTn593dqsX6XA77rx66P6gF3r46CjDj+akE=; b=Pf83APSkF9NwyhTVxuwi7QYhGNS2wN9BrDJ4JjoLGANe/taxXkg1mrUmFOU2V0JVs/ fnnjXyCH0bKT7eaVY3XE7leMlAj0iF89rbYX2Aog9ktruvHakQgj28iBIrbgyNQEmEwm zoVjnmrX+ORBzKRpdzbRrTPqD9uYn9SPQ/cTUPbV7Mo7HEmJ7VV3fCo9INfnA35lcan8 TrggOcOtm+VHVcxsEoraR+EU+CCcB7z3kLVMdX7++AiaNEST4vMbLJNCZFRaMKThd/+h YTv2qlLt2DUZ24wv4xunt3zeBK5wkPMWqPDTvLHNISD335o/1FmPEQdULsY6T4rDHIdK IUhg== X-Gm-Message-State: AOJu0YxDa1rWvuPvSspgCQXR7MIi3RvYuji31zFbWo/IDjVgg99IAi+F yb89lbJfQm7lBr7VGIcKqGapfoI/ccjs7f+RyR6H4OOO3M5ohCb3Y4In8Q== X-Google-Smtp-Source: AGHT+IEzOFUZWq2OLb4JW1rZ/6BJibT/NvkqiFrAcd2G1A2IhxPy2kyYFSO4eJ7RyM727bmYCYX0Hw== X-Received: by 2002:a05:6808:aa8:b0:3c5:ef39:9fd7 with SMTP id r8-20020a0568080aa800b003c5ef399fd7mr13891771oij.34.1713280492703; Tue, 16 Apr 2024 08:14:52 -0700 (PDT) Received: from localhost.localdomain ([70.114.247.242]) by smtp.gmail.com with ESMTPSA id b17-20020aca2211000000b003c708fc7267sm1085797oic.27.2024.04.16.08.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:14:52 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 4/7] qmi: gprs-context: Convert QMI_WDS_AUTHENTICATION to an enum Date: Tue, 16 Apr 2024 10:14:31 -0500 Message-ID: <20240416151448.3359644-4-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240416151448.3359644-1-denkenz@gmail.com> References: <20240416151448.3359644-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 QMI uses authentication type as a bitmap, with both PAP and CHAP support being selectable independently. Convert QMI_WDS_AUTHENTICATION* defines to an enumeration, removing QMI_WDS_AUTHENTICATION_NONE. --- drivers/qmimodem/gprs-context.c | 9 +++++---- drivers/qmimodem/wds.h | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index ef49e1bcf421..e726382a223a 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -220,16 +220,17 @@ static void qmi_gprs_read_settings(struct ofono_gprs_context* gc, static uint8_t auth_method_to_qmi_auth(enum ofono_gprs_auth_method method) { + /* QMI uses a bitmap */ switch (method) { case OFONO_GPRS_AUTH_METHOD_CHAP: return QMI_WDS_AUTHENTICATION_CHAP; case OFONO_GPRS_AUTH_METHOD_PAP: return QMI_WDS_AUTHENTICATION_PAP; case OFONO_GPRS_AUTH_METHOD_NONE: - return QMI_WDS_AUTHENTICATION_NONE; + return 0; } - return QMI_WDS_AUTHENTICATION_NONE; + return 0; } static void qmi_activate_primary(struct ofono_gprs_context *gc, @@ -271,11 +272,11 @@ static void qmi_activate_primary(struct ofono_gprs_context *gc, qmi_param_append_uint8(param, QMI_WDS_PARAM_AUTHENTICATION_PREFERENCE, auth); - if (auth != QMI_WDS_AUTHENTICATION_NONE && ctx->username[0] != '\0') + if (auth && ctx->username[0] != '\0') qmi_param_append(param, QMI_WDS_PARAM_USERNAME, strlen(ctx->username), ctx->username); - if (auth != QMI_WDS_AUTHENTICATION_NONE && ctx->password[0] != '\0') + if (auth && ctx->password[0] != '\0') qmi_param_append(param, QMI_WDS_PARAM_PASSWORD, strlen(ctx->password), ctx->password); diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h index 398f77c74672..0e30a0cca8c7 100644 --- a/drivers/qmimodem/wds.h +++ b/drivers/qmimodem/wds.h @@ -26,9 +26,11 @@ #define QMI_WDS_PARAM_PASSWORD 0x18 /* string */ #define QMI_WDS_PARAM_AUTHENTICATION_PREFERENCE 0x16 /* uint8 */ -#define QMI_WDS_AUTHENTICATION_NONE 0x0 -#define QMI_WDS_AUTHENTICATION_PAP 0x1 -#define QMI_WDS_AUTHENTICATION_CHAP 0x2 + +enum qmi_wds_authentication { + QMI_WDS_AUTHENTICATION_PAP = 0x1, + QMI_WDS_AUTHENTICATION_CHAP = 0x2, +}; /* Packet data connection status indication */ struct qmi_wds_notify_conn_status { From patchwork Tue Apr 16 15:14:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13632036 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 754EC130A4A for ; Tue, 16 Apr 2024 15:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280495; cv=none; b=AVsh95xutZ51gI2gAS68Ix4Xs9W9VUxe9IP3qFGMPEeVOglt+Y8VC64aMx0MXwSwZK/D018moZrzSrVJBYJOvcxtk42pjy1BRTmdITRLajo7qN3ahGXMBmyP8/AZU0i2MV0f0rtVZvzlu/LDAFPnSCl4HbgHv5fyTxHLW0RRD7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280495; c=relaxed/simple; bh=djyks+F3mGJvqLrXUlttGEmX8qYUItZB94KTWfCSLPE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FRZvZ8Pc3PJ3tk3Ii7QbNV0+GFiAQJQIRyQIkNfsQH/vjgb8Zcw/lIKD5bR756FuJsM2STHcszlm55WjjN2kV51u2eHDcNlbMwQrRlqZrUVXTC1MnLeyuFdDFFGbbrXOSUsx2jjnxwnoD9e6Pne6FoQeiOaOTtnHysuBqERYhV4= 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=cxSOhyMt; arc=none smtp.client-ip=209.85.167.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cxSOhyMt" Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3c7150cff81so480200b6e.2 for ; Tue, 16 Apr 2024 08:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713280493; x=1713885293; 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=6HxtktstjwcHtnRqcqYSUiT5ls1N6T033KZ+COMPkW0=; b=cxSOhyMtKdoSXG3CpIijyz9XbI/whv5BiRwXOGj0EYLNC/Load59wQxz83i8W9MKcD UrEw5P/1AZVFxUgTv0mvcTQB/Kr2emTiXz5+6xVXP7d8+UAxI7HKQKxQys371lTZtxG6 5qrrW9plf+CzdIe7ZvCWppqvKN7ekAxwS7Nl5h+cYmpyTLxs/jW2XXYj6Ab6eD8lfnjj diwfVn7afijdT91DHIoH8JWxjjM0aHyx3kwSXaCJz78SJuw0ztfgdl4W5/q4Mh2bsryV 3E5BZgywXUzlE6WtVxCgxvl0Q7YWmfu/4pI1zT8jYHFuXVwgav3HHZO57L6OnRSYDxyn ZIiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713280493; x=1713885293; 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=6HxtktstjwcHtnRqcqYSUiT5ls1N6T033KZ+COMPkW0=; b=gEPHQQB6WmACUtcAg7B7goWfWcFsTV4Ia0oPskFiYxRzD7Bvz8YHuVF23KzxzW0PUC ZiVC3OQlbD01Bd4UFE9U07yD8DFVzTycQTmL1wy35T/GMLK4GmdmuSc3BcKxj50uVXXW c5QMz7bopotEOmPLBTYaXfC4KkDus5M1Aeejd8dC7k4SUPz1fjixAD4YGMQU2VRoanL1 W6k6UlAxOgKb4YoxTX2YK8NgS688JUkTCtla7tcWLhCg4Mc+c77QdJFC9EieA7QjgFgY QJNHWYsK+jAMIq3COnW59E45Oce7lz9Td7Kj1UoDnwGD59wCL8g2j9+sTdBew8Ysc3wx 8Q4Q== X-Gm-Message-State: AOJu0YzJrZr++x6WjXOHivR4Hw5/zWYyyutRxgG6zf7hSO2tbOLaO2l0 NkqMUNn9IzDFfr+4MM8MvLtl4Yx+/aTFA81GCTYeJpVAQdQL5ocAaaF+LA== X-Google-Smtp-Source: AGHT+IFBaXi5YsOj0F3SSaBY5UhTQJkigC9FOgWfnLycNzRxfrUKZiLIYZ5eVQ8NyQGqqyDIBTayYA== X-Received: by 2002:a05:6808:2219:b0:3c6:124:9bd6 with SMTP id bd25-20020a056808221900b003c601249bd6mr15665636oib.25.1713280493394; Tue, 16 Apr 2024 08:14:53 -0700 (PDT) Received: from localhost.localdomain ([70.114.247.242]) by smtp.gmail.com with ESMTPSA id b17-20020aca2211000000b003c708fc7267sm1085797oic.27.2024.04.16.08.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:14:53 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 5/7] qmi: wds: Convert defines to enums Date: Tue, 16 Apr 2024 10:14:32 -0500 Message-ID: <20240416151448.3359644-5-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240416151448.3359644-1-denkenz@gmail.com> References: <20240416151448.3359644-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-context.c | 2 +- drivers/qmimodem/wds.h | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index e726382a223a..14da16046f2a 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -64,7 +64,7 @@ static void pkt_status_notify(struct qmi_result *result, void *user_data) DBG("ip family %d", ip_family); switch (status->status) { - case QMI_WDS_CONN_STATUS_DISCONNECTED: + case QMI_WDS_CONNECTION_STATUS_DISCONNECTED: if (data->pkt_handle) { /* The context has been disconnected by the network */ ofono_gprs_context_deactivated(gc, data->active_context); diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h index 0e30a0cca8c7..0cfbd9802531 100644 --- a/drivers/qmimodem/wds.h +++ b/drivers/qmimodem/wds.h @@ -38,15 +38,19 @@ struct qmi_wds_notify_conn_status { uint8_t reconf; } __attribute__((__packed__)); -#define QMI_WDS_CONN_STATUS_DISCONNECTED 0x01 -#define QMI_WDS_CONN_STATUS_CONNECTED 0x02 -#define QMI_WDS_CONN_STATUS_SUSPENDED 0x03 -#define QMI_WDS_CONN_STATUS_AUTHENTICATING 0x04 +enum qmi_wds_connection_status { + QMI_WDS_CONNECTION_STATUS_DISCONNECTED = 0x01, + QMI_WDS_CONNECTION_STATUS_CONNECTED = 0x02, + QMI_WDS_CONNECTION_STATUS_SUSPENDED = 0x03, + QMI_WDS_CONNECTION_STATUS_AUTHENTICATING = 0x04, +}; -#define QMI_WDS_PDP_TYPE_IPV4 0x00 -#define QMI_WDS_PDP_TYPE_PPP 0x01 -#define QMI_WDS_PDP_TYPE_IPV6 0x02 -#define QMI_WDS_PDP_TYPE_IPV4V6 0x03 +enum qmi_wds_pdp_type { + QMI_WDS_PDP_TYPE_IPV4 = 0x00, + QMI_WDS_PDP_TYPE_PPP = 0x01, + QMI_WDS_PDP_TYPE_IPV6 = 0x02, + QMI_WDS_PDP_TYPE_IPV4V6 = 0x03, +}; enum qmi_wds_ip_family { QMI_WDS_IP_FAMILY_UNKNOWN = 0, From patchwork Tue Apr 16 15:14:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13632037 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (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 8915C1304B1 for ; Tue, 16 Apr 2024 15:14:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280496; cv=none; b=tmqwZ+4BLDnOjvlIBuBeE1EFp+Pa6BA7hVRpRC2MUDwirTV60kM2D6jWtOFtlolP5m88YxilB2WXOI+cb2qVKSlLZgOwW/94dJ9KD+v/4kChN2ZPCzU6wBQDC3HAZgWVNXLsPLzmpba8dr1eTsMm/Y11sSSK6EucIJKPF/7ymKw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280496; c=relaxed/simple; bh=9flTpwrrmBlVJXK1xudSUA3Uhl1V6dC+PUekkMrZgaY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e3fRfE08/V2GbEHFJj7C1HN92Udp5731hzGbF9KeGfiE/mY1cd60sNNOwmDoQD+JIX8Ysak3794FdzlHHT9u5P6fkptvJJMvMV54v5/lSbBM8SXEzIxlIwsGJrx48tMgKZQ9w8UnEffWKTjTvECO5MrXDFzMVR5ug+8Ds72Sivk= 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=EZo5eXUo; arc=none smtp.client-ip=209.85.167.180 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="EZo5eXUo" Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3c70ef25e19so1140920b6e.3 for ; Tue, 16 Apr 2024 08:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713280494; x=1713885294; 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=2cvAQegEJEx498SvEhyvDBsfy9IimfKb65ZBzIj8dKU=; b=EZo5eXUo/g5gRMV9C7gDQzWNyQFo7dY4bBzPJoRRHokzSuD47kD0floo4wpoam7EOh HZcuTCyZ4zxentC4VooreZzE0D57FWRk1pVWM6utsTws4BbJI4ayozNmvn0VI0q58BcN n569Cv3pa89ZYRL52MytXmT3YpNJcvFF8Ad6hOo+3gfIOb8JOhouIAWFybu+kTgU6luT Kn0StuPs0oZgyPbIAB5Uz+ZATVvPVFQZqwJaq2JYIz6AlHteAG5CVWP57ciLAj98r/No ZSTZm7papy/q1M+Izfe8LknqaUw6esBmGNuH1QnoAgJvtPSds64ofhAA+gfKiHCAQkS3 XqLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713280494; x=1713885294; 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=2cvAQegEJEx498SvEhyvDBsfy9IimfKb65ZBzIj8dKU=; b=rrtN+8JS+aT/i4IKsK81/MLn7IROA451RY9eTaBvvRzHtWZpu8EoPulBDW07wKZFGw Ir+GGSKEVUN5Bcn9lCRiRRGe1JoYWWZDcdgVYKR3UArNbESpwsWUiJAAw9pExsUI33vu C7jA2RSzN0rlll1GMD0ybb/IVZOS5hh8jLV+MPS27OzD8qiNRAeErqMRx4Ol05klrsRZ 9iEjhzbvYkRyDkW7fOJ8ByDJyQPvnFIlE/+cYFeBhlB/xwwqjISdSrQsjE7TASs3kT9T IwXX/8mkqIWZ7f9Lm/sA1j2H/rkE3mXUqlvlKiqECU6bBKlx7F3DyBakJmq5TikV9FXN ub5g== X-Gm-Message-State: AOJu0YwGGVwK23oPxfLD0CEDhLY6wrofCFz/SVClSznEoS+ohhnCP6NE LbgcuzQtrbuNSHgAXAb3pjuP2X8i27X+en8FsICq40GaSq4ZtU8NeN+92g== X-Google-Smtp-Source: AGHT+IHz+yXtc2U4zWE8VEeo16KJb1cxrtCUElgPu8WsdN10EK50pYfi1DIr+kgxi/LXoivlmnwThw== X-Received: by 2002:a05:6808:274a:b0:3c7:960:b9e7 with SMTP id eh10-20020a056808274a00b003c70960b9e7mr8164179oib.19.1713280494476; Tue, 16 Apr 2024 08:14:54 -0700 (PDT) Received: from localhost.localdomain ([70.114.247.242]) by smtp.gmail.com with ESMTPSA id b17-20020aca2211000000b003c708fc7267sm1085797oic.27.2024.04.16.08.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:14:54 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 6/7] qmi: gprs-context: Remove single-use structure definition Date: Tue, 16 Apr 2024 10:14:33 -0500 Message-ID: <20240416151448.3359644-6-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240416151448.3359644-1-denkenz@gmail.com> References: <20240416151448.3359644-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This structure is defined in wds.h but only used once inside packet_status_notify(). It is unlikely to be used elsewhere since this TLV is specific to the connection status indication. Define/declare this structure directly in the handler instead. --- drivers/qmimodem/gprs-context.c | 5 ++++- drivers/qmimodem/wds.h | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index 14da16046f2a..b1fdfc74cc34 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -48,7 +48,10 @@ static void pkt_status_notify(struct qmi_result *result, void *user_data) static const uint8_t RESULT_IP_FAMILY = 0x12; struct ofono_gprs_context *gc = user_data; struct gprs_context_data *data = ofono_gprs_context_get_data(gc); - const struct qmi_wds_notify_conn_status *status; + const struct { + uint8_t status; + uint8_t reconf; + } __attribute__((__packed__)) *status; uint16_t len; uint8_t ip_family; diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h index 0cfbd9802531..3c9b534c1f82 100644 --- a/drivers/qmimodem/wds.h +++ b/drivers/qmimodem/wds.h @@ -32,12 +32,6 @@ enum qmi_wds_authentication { QMI_WDS_AUTHENTICATION_CHAP = 0x2, }; -/* Packet data connection status indication */ -struct qmi_wds_notify_conn_status { - uint8_t status; - uint8_t reconf; -} __attribute__((__packed__)); - enum qmi_wds_connection_status { QMI_WDS_CONNECTION_STATUS_DISCONNECTED = 0x01, QMI_WDS_CONNECTION_STATUS_CONNECTED = 0x02, From patchwork Tue Apr 16 15:14:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13632038 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (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 5809A1304B9 for ; Tue, 16 Apr 2024 15:14:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280497; cv=none; b=jGrDGHiBZGKIJxjYdjiW1dlP2YBtIRLSKThoZb/6wdxFt1Q4IIbBE9kA3sW+FIXVJnNlsKx9tX3mGUC9GLUbSivOPjh/rVSV8Bxhw5fK6OvHX3oFLcEYWDgFcbhoRSPPvzb69lOQxLtSWzXKsWFoqrUfBCz0ispc8UZNHzD/CYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713280497; c=relaxed/simple; bh=TmrkLp8QAbztndOJqg3SM5jwPMcwo35NoHBEJC7wkKU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZdhFdxFscP1M/4FH2kK7Q9dJjnxOFUEbf1c36a3oDV7i0dI/K3TurUgH04y05krswz8aO+vUrmDxNtx3JNmzOUEkiI/dz6K+Ww9FBEuo/Z9Mo8A0evlpqapzngwQvNWOnjyrjiFOpEgmxIZd89irUQnosEayB+13XFwUAUzAkKs= 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=W56XMPgw; arc=none smtp.client-ip=209.85.167.174 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="W56XMPgw" Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3c728a8035eso211425b6e.3 for ; Tue, 16 Apr 2024 08:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713280495; x=1713885295; 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=gRpBebX0odZpnSbecihT+OrcsDbOa+ZWFxkah4iBqro=; b=W56XMPgwyiEYqgBMrzhTpCaraXXoKBS8XD42pR5RxLtrnGioiqnwv1dGxXR8JTH1Cy 1d8gW6Mo60jaQMdnZ2DLJjWki+mxzoYK47y8sfKYoDqVN+7W3d6g5a6nYPIJ1mOINbAW PKQICHYCy29aVqQc2oYIeTH68p7h1vGhhFxJ+1Osx7ofoDCqzwulQHPmtV6iUmvzKTVX 5cWLYDfDINJXiiBSOnUUOVyG1KjMsuv4v97H9pQV5VmAB8TC8pKudfuRFfVvizfAPFei mDi7v4xP0MU02yF1a9fhQhNvU4moRBQ22OGTd4jUHCtz31R/9KJpoUhq4wPacmwcHYVQ yNng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713280495; x=1713885295; 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=gRpBebX0odZpnSbecihT+OrcsDbOa+ZWFxkah4iBqro=; b=PgHoXadah+8iyF+xbvqN7t5mtT1ws60dEe1yabB7z/tG78cGJClwfmjnSF7wrcxa0z io4WSuP3G/FU3B2Y98P8ZpVtHybU8vsnJMim5rROfH5C+q2rBQ1irXz7zODrKrYTNF+E jOu8GqFAjzh87EauuhrNsVhrteZVPeM1Sv2LG4I5aMKxltaXkkmdyaWZzxzIdgoieQ8+ CDgJOMk2xclkMmOkigE8pxHy5Akcedzlu02yHbbE39KMWPkMub4zWH3lNmuyjJI7nzvx 7imArCn+GgiqJil/WCVi2Ueu7EompLips953M2A9LRJ5If6WvFoXPxokHDWnFQyCS4ow fp+A== X-Gm-Message-State: AOJu0YyPY4n7o+uD/pOMBg97ZRH9JE591SG2agG65MbDMphyJLhmmrSt WQQGSJxbwDbn/oo0MdDw0UuWvmslsUQJqEM9VneErnHxOtfwJspTJg8Kdw== X-Google-Smtp-Source: AGHT+IHIBX3VWAqMURLd5hJWVC1JKNJFkACRrT1IEvgLr4O2oXsIADv66K3F1uy8q3GP11C2J9+IoA== X-Received: by 2002:a05:6808:638b:b0:3c7:2895:2e7c with SMTP id ec11-20020a056808638b00b003c728952e7cmr1288409oib.36.1713280495342; Tue, 16 Apr 2024 08:14:55 -0700 (PDT) Received: from localhost.localdomain ([70.114.247.242]) by smtp.gmail.com with ESMTPSA id b17-20020aca2211000000b003c708fc7267sm1085797oic.27.2024.04.16.08.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:14:54 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 7/7] qmi: gprs-context: Request certain TLVs to be included Date: Tue, 16 Apr 2024 10:14:34 -0500 Message-ID: <20240416151448.3359644-7-denkenz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240416151448.3359644-1-denkenz@gmail.com> References: <20240416151448.3359644-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Explicitly ask WDS service to include certain TLVs in its response. This is mainly needed to obtain the value of the negotiated MTU between the modem and the network. MTU is not included in the response otherwise. --- drivers/qmimodem/gprs-context.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index b1fdfc74cc34..3b5164bfea26 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -159,11 +159,14 @@ done: static void start_net_cb(struct qmi_result *result, void *user_data) { static const uint8_t RESULT_PACKET_HANDLE = 0x01; + static const uint8_t PARAM_REQUESTED_SETTINGS = 0x10; 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); uint32_t handle; + uint32_t requested_settings = 0; + struct qmi_param *param; DBG(""); @@ -177,6 +180,19 @@ static void start_net_cb(struct qmi_result *result, void *user_data) data->pkt_handle = handle; + /* + * Explicitly request certain information to be provided. The requested + * settings is a bit field, with each bit representing whether the + * TLV is included in the GET_CURRENT_SETTINGS response. We request the + * following settings: + * 2 - PDP Type, 3 - APN Name, 4 - DNS, 5 - Granted QOS, + * 6 - Username, 7 - Auth Proto + * 8 - IP Address, 9 - Gateway, 13 - MTU, 14 - DNS List, + * 15 - IP Family, 17 - Extended Technology + */ + L_BITS_SET(&requested_settings, 3, 4, 6, 7, 8, 9, 13, 14, 15, 17); + param = qmi_param_new_uint32(PARAM_REQUESTED_SETTINGS, + requested_settings); if (qmi_service_send(data->wds, QMI_WDS_GET_CURRENT_SETTINGS, NULL, get_settings_cb, cbd, cb_data_unref) > 0) { @@ -184,6 +200,8 @@ static void start_net_cb(struct qmi_result *result, void *user_data) return; } + qmi_param_free(param); + error: data->active_context = 0; CALLBACK_WITH_FAILURE(cb, cbd->data);