All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: add usbfs ioctl to get specific superspeedplus rates
@ 2023-07-21  8:40 Dingyan Li
  2023-07-21 11:04 ` Greg KH
  0 siblings, 1 reply; 34+ messages in thread
From: Dingyan Li @ 2023-07-21  8:40 UTC (permalink / raw)
  To: gregkh, stern, sebastian.reichel; +Cc: linux-usb, linux-kernel

The usbfs interface does not provide any way to get specific
superspeedplus rate, like Gen2x1, Gen1x2 or Gen2x2. Current
API include an USBDEVFS_GET_SPEED ioctl, but it can only return
general superspeedplus speed instead of any specific rates.
Therefore we can't tell whether it's a Gen2x2(20Gbps) device.

This patch introduce a new ioctl USBDEVFS_GET_SSP_RATE to fix
it. Similar information is already available via sysfs, it's
good to add it for usbfs too.

Signed-off-by: Dingyan Li <18500469033@163.com>
---
 drivers/usb/core/devio.c          | 3 +++
 include/uapi/linux/usbdevice_fs.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 1a16a8bdea60..2f57eb163360 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -2783,6 +2783,9 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
 	case USBDEVFS_GET_SPEED:
 		ret = ps->dev->speed;
 		break;
+	case USBDEVFS_GET_SSP_RATE:
+		ret = ps->dev->ssp_rate;
+		break;
 	case USBDEVFS_FORBID_SUSPEND:
 		ret = proc_forbid_suspend(ps);
 		break;
diff --git a/include/uapi/linux/usbdevice_fs.h b/include/uapi/linux/usbdevice_fs.h
index 74a84e02422a..f5522e910329 100644
--- a/include/uapi/linux/usbdevice_fs.h
+++ b/include/uapi/linux/usbdevice_fs.h
@@ -227,5 +227,6 @@ struct usbdevfs_streams {
 #define USBDEVFS_FORBID_SUSPEND    _IO('U', 33)
 #define USBDEVFS_ALLOW_SUSPEND     _IO('U', 34)
 #define USBDEVFS_WAIT_FOR_RESUME   _IO('U', 35)
+#define USBDEVFS_GET_SSP_RATE      _IO('U', 36)
 
 #endif /* _UAPI_LINUX_USBDEVICE_FS_H */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2023-08-20 10:12 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-21  8:40 [PATCH] USB: add usbfs ioctl to get specific superspeedplus rates Dingyan Li
2023-07-21 11:04 ` Greg KH
     [not found]   ` <550dbb46.5bc4.189785b0360.Coremail.18500469033@163.com>
2023-07-21 12:11     ` Greg KH
2023-07-21 12:35   ` Dingyan Li
2023-07-21 14:51     ` Greg KH
2023-07-21 15:43       ` Dingyan Li
2023-07-21 17:26         ` Alan Stern
2023-07-24  9:47       ` Oliver Neukum
2023-07-25 13:24         ` Greg KH
2023-07-25 13:54           ` Dingyan Li
2023-07-25 14:08             ` Oliver Neukum
2023-07-25 14:40               ` Dingyan Li
2023-07-25 15:12                 ` Greg KH
2023-07-25 16:11                   ` Dingyan Li
2023-07-26  8:33                     ` Oliver Neukum
2023-07-26  9:36                       ` Dingyan Li
2023-07-26  9:49                         ` Oliver Neukum
2023-07-26 10:10                           ` Dingyan Li
2023-07-26  1:37           ` Xiaofan Chen
2023-07-26  9:38             ` Oliver Neukum
2023-07-26  3:20               ` Xiaofan Chen
2023-07-26 14:39                 ` Hans de Goede
2023-08-03  6:13                   ` Dingyan Li
2023-08-03 15:10                     ` Alan Stern
2023-08-03 15:39                       ` Hans de Goede
2023-08-03 16:06                         ` Dingyan Li
2023-08-03 17:56                           ` Alan Stern
2023-08-04  4:16                             ` Dingyan Li
2023-08-04 14:55                               ` Alan Stern
2023-08-19  4:32                                 ` Dingyan Li
2023-08-19  5:46                                   ` [PATCH v2] USB: Support 20Gbps speed for ioctl USBDEVFS_GET_SPEED Dingyan Li
2023-08-19 19:03                                     ` Alan Stern
2023-08-20  5:29                                       ` Dingyan Li
2023-08-19 18:46                                   ` Re: Re: Re: [PATCH] USB: add usbfs ioctl to get specific superspeedplus rates Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.