From: Daniele Palmas <dnlplm@gmail.com>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>,
Sergey Ryazanov <ryazanov.s.a@gmail.com>,
Johannes Berg <johannes@sipsolutions.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
David Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, Daniele Palmas <dnlplm@gmail.com>
Subject: [PATCH net-next v3 2/2] net: wwan: add exclusive open mode capability to AT and QCDM ports
Date: Fri, 24 Jul 2026 16:28:18 +0200 [thread overview]
Message-ID: <20260724142909.3270824-3-dnlplm@gmail.com> (raw)
In-Reply-To: <20260724142909.3270824-1-dnlplm@gmail.com>
Add exclusive open mode capability to AT and QCDM ports to improve
compatibility with user-space tools using the Qualcomm diagnostic
device (e.g. libqcdm).
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
---
drivers/net/wwan/wwan_core.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index 8168239e52c3..ffbcf11e4e68 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -42,6 +42,7 @@ static struct dentry *wwan_debugfs_dir;
/* WWAN port flags */
#define WWAN_PORT_TX_OFF 0
+#define WWAN_PORT_EXCLUSIVE 1
/**
* struct wwan_device - The structure that defines a WWAN device
@@ -748,6 +749,12 @@ static int wwan_port_op_start(struct wwan_port *port)
goto out_unlock;
}
+ if (test_bit(WWAN_PORT_EXCLUSIVE, &port->flags) &&
+ !capable(CAP_SYS_ADMIN)) {
+ ret = -EBUSY;
+ goto out_unlock;
+ }
+
/* If port is already started, don't start again */
if (!port->start_count)
ret = port->ops->start(port);
@@ -769,6 +776,7 @@ static void wwan_port_op_stop(struct wwan_port *port)
if (port->ops)
port->ops->stop(port);
skb_queue_purge(&port->rxq);
+ clear_bit(WWAN_PORT_EXCLUSIVE, &port->flags);
}
mutex_unlock(&port->ops_lock);
}
@@ -1031,6 +1039,22 @@ static long wwan_port_fops_at_ioctl(struct wwan_port *port, unsigned int cmd,
break;
}
+ case TIOCEXCL:
+ set_bit(WWAN_PORT_EXCLUSIVE, &port->flags);
+ break;
+
+ case TIOCNXCL:
+ clear_bit(WWAN_PORT_EXCLUSIVE, &port->flags);
+ break;
+
+ case TIOCGEXCL:
+ {
+ int excl = test_bit(WWAN_PORT_EXCLUSIVE, &port->flags);
+
+ ret = put_user(excl, (int __user *)arg);
+ break;
+ }
+
default:
ret = -ENOIOCTLCMD;
}
--
2.43.0
prev parent reply other threads:[~2026-07-24 14:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 14:28 [PATCH net-next v3 0/2] Improve wwan qcdm compatibility with user-space tools Daniele Palmas
2026-07-24 14:28 ` [PATCH net-next v3 1/2] net: wwan: add minimalistic IOCTls support also to QCDM port Daniele Palmas
2026-07-24 14:28 ` Daniele Palmas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260724142909.3270824-3-dnlplm@gmail.com \
--to=dnlplm@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox