uasp: MS UAS Protocol implementation - Infrastructure
Subsystems (2)
PATCH 1/4 uasp: MS UAS Protocol implementation - Infrastructure
This patch implements the infrastructure for the UASP function driver. The UASP Function driver registers as a second configuration of the MS Function driver.
A new module parameter was added to the mass_storage module:
bool use_uasp. (default = 0)
If this parameter is set to true, the mass_storage module will register with the UASP configuration as the devices first configuration and operate according to the UAS protocol.
The number of buffers used by the mass_storage device was increased to 4 since UASP uses 4 endpoints instead of 2 used by the BOT protocol (implemented by f_mass_storage.c)
It defines the API for COMMAND/TASK MANAGEMENT IU implementation.
--- drivers/usb/gadget/f_mass_storage.c | 28 +- drivers/usb/gadget/f_uasp.c | 2398 +++++++++++++++++++++++++++++++++++ drivers/usb/gadget/f_uasp.h | 414 ++++++ drivers/usb/gadget/mass_storage.c | 67 +- drivers/usb/gadget/storage_common.c | 3 +- drivers/usb/gadget/uasp_cmdiu.c | 91 ++ drivers/usb/gadget/uasp_tmiu.c | 61 + 7 files changed, 3043 insertions(+), 19 deletions(-) create mode 100644 drivers/usb/gadget/f_uasp.c create mode 100644 drivers/usb/gadget/f_uasp.h create mode 100644 drivers/usb/gadget/uasp_cmdiu.c create mode 100644 drivers/usb/gadget/uasp_tmiu.c
drivers/usb/gadget/f_mass_storage.c +16 -12
@@ -2741,7 +2741,8 @@ static inline void fsg_common_put(struct fsg_common *common)static struct fsg_common *fsg_common_init (struct fsg_common *common,struct usb_composite_dev *cdev, -struct fsg_config *cfg) +struct fsg_config *cfg, +int start_thread) {struct usb_gadget *gadget = cdev->gadget;struct fsg_buffhd *bh;
@@ -2890,12 +2891,14 @@ buffhds_first_it:kref_init (&common->ref);/* Tell the thread to start working */ - common->thread_task = -kthread_create (fsg_main_thread, common, - cfg->thread_name ?:"file-storage" ); -if (IS_ERR (common->thread_task)) { - rc =PTR_ERR (common->thread_task); - goto error_release; +if (start_thread) { + common->thread_task = +kthread_create (fsg_main_thread, common, + cfg->thread_name ?:"file-storage" ); +if (IS_ERR (common->thread_task)) { + rc =PTR_ERR (common->thread_task); + goto error_release; + } }init_completion (&common->thread_notifier);init_waitqueue_head (&common->fsg_wait);
@@ -2926,10 +2929,11 @@ buffhds_first_it: }kfree (pathbuf); -DBG (common,"I/O thread pid: %d\n" ,task_pid_nr (common->thread_task)); - -wake_up_process (common->thread_task); - +if (start_thread) { +DBG (common,"I/O thread pid: %d\n" , +task_pid_nr (common->thread_task)); +wake_up_process (common->thread_task); + }return common; error_luns:
@@ -3197,6 +3201,6 @@ fsg_common_from_params(struct fsg_common *common, {struct fsg_config cfg;fsg_config_from_params (&cfg, params); -return fsg_common_init (common, cdev, &cfg); +return fsg_common_init (common, cdev, &cfg,1 ); }
drivers/usb/gadget/f_uasp.c new file +2398 -0
2,398 lines not on this page · raw message
drivers/usb/gadget/f_uasp.h new file +414 -0
414 lines not on this page · raw message
drivers/usb/gadget/mass_storage.c +61 -6
100 lines not on this page · raw message
drivers/usb/gadget/storage_common.c +2 -1
@@ -220,6 +220,7 @@ struct interrupt_data {#define SS_UNRECOVERED_READ_ERROR 0x031100#define SS_WRITE_ERROR 0x030c02#define SS_WRITE_PROTECTED 0x072700 +#define SS_OVERLAPPED_COMMANDS_ATTEMPTED 0x0b4e00#define SK (x) ((u8) ((x) >> 16))/* Sense Key byte, etc. */ #define ASC (x) ((u8) ((x) >> 8))
@@ -263,7 +264,7 @@ static struct fsg_lun *fsg_lun_from_dev(struct device *dev)#define DELAYED_STATUS (EP0_BUFSIZE + 999)/* An impossibly large value */ /* Number of buffers we will use. 2 is enough for double-buffering */ -#define FSG_NUM_BUFFERS 2 +#define FSG_NUM_BUFFERS 4/* Default size of buffer length. */ #define FSG_BUFLEN ((u32)16384)
drivers/usb/gadget/uasp_cmdiu.c new file +91 -0
22 lines not on this page · raw message
drivers/usb/gadget/uasp_tmiu.c new file +61 -0
61 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 4 lines
1.6.3.3 -- Sent by a Consultant for Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
Part of the diff is not shown here. View the raw message.
Quoted 3 lines · Tatyana Brokhman
This patch implements the infrastructure for the UASP function driver. The UASP Function driver registers as a second configuration of the MS Function driver.
We now have a proper scsi target infrastructure in drivers/target, please use it.
Quoted 11 lines · Tatyana Brokhman
Quoted 1 line
This patch implements the infrastructure for the UASP function
driver.
Quoted 1 line
The UASP Function driver registers as a second configuration of the
MS
Quoted 1 line
Function driver.
We now have a proper scsi target infrastructure in
drivers/target, please use it.
Hi Christoph
Thank you for your input. Could you please specify the exact location of the scsi target infrastructure you're referring to? Drivers/target is missing. Also, if you could point me out to an example where this infrastructure is used or any documentation on it, it would be very helpful.
Thanks,
Tanya Brokhman
Consultant for Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
Hello.
Quoted 11 lines · Tanya Brokhman
Quoted 6 lines
Quoted 3 lines
This patch implements the infrastructure for the UASP function driver. The UASP Function driver registers as a second configuration of the MS Function driver.
We now have a proper scsi target infrastructure in
drivers/target, please use it.Hi Christoph
Thank you for your input. Could you please specify the exact location of the scsi target infrastructure you're referring to? Drivers/target is missing.
Look at the recent kernel tree -- it's there.
Quoted 2 lines
Also, if you could point me out to an example where this infrastructure is used or any documentation on it, it would be very helpful.
Documentation should be in Documentation/target/?..
WBR, Sergei