* [PATCH 0/2] net: usb: qmi_wwan: new mux_id sysfs file @ 2021-01-25 15:22 Daniele Palmas 2021-01-25 15:22 ` [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces Daniele Palmas 2021-01-25 15:22 ` [PATCH net-next 2/2] net: qmi_wwan: document qmap/mux_id sysfs file Daniele Palmas 0 siblings, 2 replies; 10+ messages in thread From: Daniele Palmas @ 2021-01-25 15:22 UTC (permalink / raw) To: Bjørn Mork, David S . Miller, Jakub Kicinski Cc: netdev, linux-usb, Aleksander Morgado, Daniele Palmas 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 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces 2021-01-25 15:22 [PATCH 0/2] net: usb: qmi_wwan: new mux_id sysfs file Daniele Palmas @ 2021-01-25 15:22 ` Daniele Palmas 2021-01-25 16:14 ` Bjørn Mork ` (2 more replies) 2021-01-25 15:22 ` [PATCH net-next 2/2] net: qmi_wwan: document qmap/mux_id sysfs file Daniele Palmas 1 sibling, 3 replies; 10+ messages in thread From: Daniele Palmas @ 2021-01-25 15:22 UTC (permalink / raw) To: Bjørn Mork, David S . Miller, Jakub Kicinski Cc: netdev, linux-usb, Aleksander Morgado, Daniele Palmas 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 <dnlplm@gmail•com> --- drivers/net/usb/qmi_wwan.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 7ea113f51074..9b85e2ed4760 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -218,6 +218,31 @@ 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; + ssize_t count = 0; + + priv = netdev_priv(dev); + count += scnprintf(&buf[count], PAGE_SIZE - count, + "0x%02x\n", priv->mux_id); + + return count; +} + +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 +265,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 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces 2021-01-25 15:22 ` [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces Daniele Palmas @ 2021-01-25 16:14 ` Bjørn Mork 2021-01-27 2:02 ` Jakub Kicinski 2021-01-25 16:33 ` Aleksander Morgado 2021-01-27 7:58 ` Greg KH 2 siblings, 1 reply; 10+ messages in thread From: Bjørn Mork @ 2021-01-25 16:14 UTC (permalink / raw) To: Daniele Palmas Cc: David S . Miller, Jakub Kicinski, netdev, linux-usb, Aleksander Morgado Daniele Palmas <dnlplm@gmail•com> writes: > 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 <dnlplm@gmail•com> Acked-by: Bjørn Mork <bjorn@mork•no> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces 2021-01-25 16:14 ` Bjørn Mork @ 2021-01-27 2:02 ` Jakub Kicinski 2021-01-27 7:26 ` Bjørn Mork 0 siblings, 1 reply; 10+ messages in thread From: Jakub Kicinski @ 2021-01-27 2:02 UTC (permalink / raw) To: Bjørn Mork Cc: Daniele Palmas, David S . Miller, netdev, linux-usb, Aleksander Morgado On Mon, 25 Jan 2021 17:14:28 +0100 Bjørn Mork wrote: > Daniele Palmas <dnlplm@gmail•com> writes: > > > 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 <dnlplm@gmail•com> > > Acked-by: Bjørn Mork <bjorn@mork•no> We got two patches adding new sysfs files for QMI in close succession - is there a sense of how much this interface will grow over time? It's no secret that we prefer netlink in networking land. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces 2021-01-27 2:02 ` Jakub Kicinski @ 2021-01-27 7:26 ` Bjørn Mork 2021-01-29 2:00 ` Jakub Kicinski 0 siblings, 1 reply; 10+ messages in thread From: Bjørn Mork @ 2021-01-27 7:26 UTC (permalink / raw) To: Jakub Kicinski Cc: Daniele Palmas, David S . Miller, netdev, linux-usb, Aleksander Morgado Jakub Kicinski <kuba@kernel•org> writes: > On Mon, 25 Jan 2021 17:14:28 +0100 Bjørn Mork wrote: >> Daniele Palmas <dnlplm@gmail•com> writes: >> >> > 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 <dnlplm@gmail•com> >> >> Acked-by: Bjørn Mork <bjorn@mork•no> > > We got two patches adding new sysfs files for QMI in close succession - > is there a sense of how much this interface will grow over time? The honest answer is no. I do not expect this interface to grow at all. But then I didn't expect it to grow before the two recent additions either... Both are results of feedback from the userspace developers actually using this interface. If I try to look into the future, then I do believe the first addition, the "pass_through" flag, makes further changes unnecessary. It allows the "rmnet" driver to take over all the functionality related to qmap/qmimux. The rmnet driver has a proper netlink interface for management. This is how the design should have been from the start, and would have been if the "rmnet" driver had existed when we added qmap support to qmi_wwan. Or if I had been aware that someone was working on such a driver. So why do we still need this last addition discussed here? Well, there are users of the qmi_wwan internal qmimux interface. They should move to "rmnet", but this might take some time and we obviously can't remove the old interface in any case. But there is a design flaw in that interface, which makes it rather difficult to use. This last addition fixes that flaw. I'll definitely accept the judgement if you want to put your foot down and say that this has to stop here, and that we are better served without this last fix. > It's no secret that we prefer netlink in networking land. Yes. But given that we have the sysfs interface for managing this qmimux feature, I don't see netlink as an alternative to this patch. The same really applies to the previous sysfs attribute, adding another flag to a set which is already exposed as sysfs attributes. The good news is that it allowed further qmimux handling to be offloaded to "rmnet", which does have a netlink interface. Bjørn ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces 2021-01-27 7:26 ` Bjørn Mork @ 2021-01-29 2:00 ` Jakub Kicinski 0 siblings, 0 replies; 10+ messages in thread From: Jakub Kicinski @ 2021-01-29 2:00 UTC (permalink / raw) To: Bjørn Mork Cc: Daniele Palmas, David S . Miller, netdev, linux-usb, Aleksander Morgado On Wed, 27 Jan 2021 08:26:13 +0100 Bjørn Mork wrote: > Jakub Kicinski <kuba@kernel•org> writes: > > We got two patches adding new sysfs files for QMI in close succession - > > is there a sense of how much this interface will grow over time? > > The honest answer is no. > > I do not expect this interface to grow at all. But then I didn't expect > it to grow before the two recent additions either... Both are results > of feedback from the userspace developers actually using this interface. > > If I try to look into the future, then I do believe the first addition, > the "pass_through" flag, makes further changes unnecessary. It allows > the "rmnet" driver to take over all the functionality related to > qmap/qmimux. The rmnet driver has a proper netlink interface for > management. This is how the design should have been from the start, and > would have been if the "rmnet" driver had existed when we added qmap > support to qmi_wwan. Or if I had been aware that someone was working on > such a driver. > > So why do we still need this last addition discussed here? Well, there > are users of the qmi_wwan internal qmimux interface. They should move > to "rmnet", but this might take some time and we obviously can't remove > the old interface in any case. But there is a design flaw in that > interface, which makes it rather difficult to use. This last addition > fixes that flaw. > > I'll definitely accept the judgement if you want to put your foot down > and say that this has to stop here, and that we are better served > without this last fix. > > > It's no secret that we prefer netlink in networking land. > > Yes. But given that we have the sysfs interface for managing this > qmimux feature, I don't see netlink as an alternative to this patch. > > The same really applies to the previous sysfs attribute, adding another > flag to a set which is already exposed as sysfs attributes. > > The good news is that it allowed further qmimux handling to be offloaded > to "rmnet", which does have a netlink interface. Thanks for the explanation. I'll trust you on this one :) I applied v2 and added the acks from v1. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces 2021-01-25 15:22 ` [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces Daniele Palmas 2021-01-25 16:14 ` Bjørn Mork @ 2021-01-25 16:33 ` Aleksander Morgado 2021-01-27 7:58 ` Greg KH 2 siblings, 0 replies; 10+ messages in thread From: Aleksander Morgado @ 2021-01-25 16:33 UTC (permalink / raw) To: Daniele Palmas Cc: Bjørn Mork, David S . Miller, Jakub Kicinski, netdev, linux-usb On Mon, Jan 25, 2021 at 4:23 PM Daniele Palmas <dnlplm@gmail•com> wrote: > > 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 <dnlplm@gmail•com> Thanks for doing this! Acked-by: Aleksander Morgado <aleksander@aleksander•es> -- Aleksander https://aleksander.es ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces 2021-01-25 15:22 ` [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces Daniele Palmas 2021-01-25 16:14 ` Bjørn Mork 2021-01-25 16:33 ` Aleksander Morgado @ 2021-01-27 7:58 ` Greg KH 2 siblings, 0 replies; 10+ messages in thread From: Greg KH @ 2021-01-27 7:58 UTC (permalink / raw) To: Daniele Palmas Cc: Bjørn Mork, David S . Miller, Jakub Kicinski, netdev, linux-usb, Aleksander Morgado On Mon, Jan 25, 2021 at 04:22:34PM +0100, Daniele Palmas wrote: > 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 <dnlplm@gmail•com> > --- > drivers/net/usb/qmi_wwan.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c > index 7ea113f51074..9b85e2ed4760 100644 > --- a/drivers/net/usb/qmi_wwan.c > +++ b/drivers/net/usb/qmi_wwan.c > @@ -218,6 +218,31 @@ 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; > + ssize_t count = 0; > + > + priv = netdev_priv(dev); > + count += scnprintf(&buf[count], PAGE_SIZE - count, > + "0x%02x\n", priv->mux_id); Odd way to do this, please just use sysfs_emit(). It looks like you cut/pasted this from some other more complex logic. thanks, greg k-h ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next 2/2] net: qmi_wwan: document qmap/mux_id sysfs file 2021-01-25 15:22 [PATCH 0/2] net: usb: qmi_wwan: new mux_id sysfs file Daniele Palmas 2021-01-25 15:22 ` [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces Daniele Palmas @ 2021-01-25 15:22 ` Daniele Palmas 2021-01-25 16:14 ` Bjørn Mork 1 sibling, 1 reply; 10+ messages in thread From: Daniele Palmas @ 2021-01-25 15:22 UTC (permalink / raw) To: Bjørn Mork, David S . Miller, Jakub Kicinski Cc: netdev, linux-usb, Aleksander Morgado, Daniele Palmas Document qmap/mux_id sysfs file showing qmimux interface id Signed-off-by: Daniele Palmas <dnlplm@gmail•com> --- 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 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 2/2] net: qmi_wwan: document qmap/mux_id sysfs file 2021-01-25 15:22 ` [PATCH net-next 2/2] net: qmi_wwan: document qmap/mux_id sysfs file Daniele Palmas @ 2021-01-25 16:14 ` Bjørn Mork 0 siblings, 0 replies; 10+ messages in thread From: Bjørn Mork @ 2021-01-25 16:14 UTC (permalink / raw) To: Daniele Palmas Cc: David S . Miller, Jakub Kicinski, netdev, linux-usb, Aleksander Morgado Daniele Palmas <dnlplm@gmail•com> writes: > Document qmap/mux_id sysfs file showing qmimux interface id > > Signed-off-by: Daniele Palmas <dnlplm@gmail•com> Acked-by: Bjørn Mork <bjorn@mork•no> ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-01-29 2:01 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-01-25 15:22 [PATCH 0/2] net: usb: qmi_wwan: new mux_id sysfs file Daniele Palmas 2021-01-25 15:22 ` [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces Daniele Palmas 2021-01-25 16:14 ` Bjørn Mork 2021-01-27 2:02 ` Jakub Kicinski 2021-01-27 7:26 ` Bjørn Mork 2021-01-29 2:00 ` Jakub Kicinski 2021-01-25 16:33 ` Aleksander Morgado 2021-01-27 7:58 ` Greg KH 2021-01-25 15:22 ` [PATCH net-next 2/2] net: qmi_wwan: document qmap/mux_id sysfs file Daniele Palmas 2021-01-25 16:14 ` Bjørn Mork
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox