[PATCH 0/2] net: usb: qmi_wwan: new mux_id sysfs file

STALE2019d LANDED

Revision v1 of 2 in this series; landed in mainline as bbe25b7d6948 on 2021-01-29.

4 messages, 2 authors, 2021-01-29 · open the first message on its own page

[PATCH 0/2] net: usb: qmi_wwan: new mux_id sysfs file

From: Daniele Palmas <hidden>
Date: 2021-01-27 15:40:04

Hello,

this patch series add a sysfs file to let userspace know which mux
id has been used to create a qmimux network interface.

I'm aware that adding new sysfs files is not usually the right path,
but my understanding is that this piece of information can't be
retrieved in any other way and its absence restricts how
userspace application (e.g. like libqmi) can take advantage of the
qmimux implementation in qmi_wwan.

Thanks,
Daniele

v2: used sysfs_emit in mux_id_show

Daniele Palmas (2):
  net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces
  net: qmi_wwan: document qmap/mux_id sysfs file

 Documentation/ABI/testing/sysfs-class-net-qmi | 10 +++++++
 drivers/net/usb/qmi_wwan.c                    | 27 +++++++++++++++++++
 2 files changed, 37 insertions(+)

-- 
2.17.1

[PATCH net-next v2 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces

From: Daniele Palmas <hidden>
Date: 2021-01-27 15:38:02

Add qmimux interface sysfs file qmap/mux_id to show qmap id set
during the interface creation, in order to provide a method for
userspace to associate QMI control channels to network interfaces.

Signed-off-by: Daniele Palmas <redacted>
---
 drivers/net/usb/qmi_wwan.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 7ea113f51074..bcfb1e2788fd 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -218,6 +218,28 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 	return 1;
 }
 
+static ssize_t mux_id_show(struct device *d, struct device_attribute *attr, char *buf)
+{
+	struct net_device *dev = to_net_dev(d);
+	struct qmimux_priv *priv;
+
+	priv = netdev_priv(dev);
+
+	return sysfs_emit(buf, "0x%02x\n", priv->mux_id);
+}
+
+static DEVICE_ATTR_RO(mux_id);
+
+static struct attribute *qmi_wwan_sysfs_qmimux_attrs[] = {
+	&dev_attr_mux_id.attr,
+	NULL,
+};
+
+static struct attribute_group qmi_wwan_sysfs_qmimux_attr_group = {
+	.name = "qmap",
+	.attrs = qmi_wwan_sysfs_qmimux_attrs,
+};
+
 static int qmimux_register_device(struct net_device *real_dev, u8 mux_id)
 {
 	struct net_device *new_dev;
@@ -240,6 +262,8 @@ static int qmimux_register_device(struct net_device *real_dev, u8 mux_id)
 		goto out_free_newdev;
 	}
 
+	new_dev->sysfs_groups[0] = &qmi_wwan_sysfs_qmimux_attr_group;
+
 	err = register_netdevice(new_dev);
 	if (err < 0)
 		goto out_free_newdev;
-- 
2.17.1

[PATCH net-next v2 2/2] net: qmi_wwan: document qmap/mux_id sysfs file

From: Daniele Palmas <hidden>
Date: 2021-01-27 15:38:24

Document qmap/mux_id sysfs file showing qmimux interface id

Signed-off-by: Daniele Palmas <redacted>
---
 Documentation/ABI/testing/sysfs-class-net-qmi | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-class-net-qmi b/Documentation/ABI/testing/sysfs-class-net-qmi
index c310db4ccbc2..ed79f5893421 100644
--- a/Documentation/ABI/testing/sysfs-class-net-qmi
+++ b/Documentation/ABI/testing/sysfs-class-net-qmi
@@ -48,3 +48,13 @@ Description:
 
 		Write a number ranging from 1 to 254 to delete a previously
 		created qmap mux based network device.
+
+What:		/sys/class/net/<qmimux iface>/qmap/mux_id
+Date:		January 2021
+KernelVersion:	5.12
+Contact:	Daniele Palmas <dnlplm@gmail.com>
+Description:
+		Unsigned integer
+
+		Indicates the mux id associated to the qmimux network interface
+		during its creation.
-- 
2.17.1

Re: [PATCH 0/2] net: usb: qmi_wwan: new mux_id sysfs file

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-01-29 02:11:02

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Wed, 27 Jan 2021 16:34:31 +0100 you wrote:
Hello,

this patch series add a sysfs file to let userspace know which mux
id has been used to create a qmimux network interface.

I'm aware that adding new sysfs files is not usually the right path,
but my understanding is that this piece of information can't be
retrieved in any other way and its absence restricts how
userspace application (e.g. like libqmi) can take advantage of the
qmimux implementation in qmi_wwan.

[...]
Here is the summary with links:
  - [net-next,v2,1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces
    https://git.kernel.org/netdev/net-next/c/e594ad980ec2
  - [net-next,v2,2/2] net: qmi_wwan: document qmap/mux_id sysfs file
    https://git.kernel.org/netdev/net-next/c/b4b91e24094a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help