From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Gerd Hoffmann" <kraxel@redhat.com>
Cc: <qemu-devel@nongnu.org>, "Kevin Wolf" <kwolf@redhat.com>
Subject: Re: [PATCH v2 08/10] usb/msd: Rename mode to cbw_state, and tweak names
Date: Sat, 12 Apr 2025 15:33:28 +1000 [thread overview]
Message-ID: <D94EYEYWM728.2K81YKH9JOHYL@gmail.com> (raw)
In-Reply-To: <104dc731-10bf-4e79-91fd-7b58e6033bca@linaro.org>
On Fri Apr 11, 2025 at 8:37 PM AEST, Philippe Mathieu-Daudé wrote:
> On 11/4/25 10:04, Nicholas Piggin wrote:
>> This reflects a little better what it does, particularly with a
>> subsequent change to relax the order packets are seen in. This
>> field is not the general state of the MSD state machine, rather
>> it follows packets that are completed as part of a CBW command.
>>
>> The difference is a bit subtle, so for a concrete example, the
>> next change will permit the host to send a CSW packet before it
>> sends the associated CBW packet. In that case the CSW packet
>> will be tracked and the MSD state machine will move, but this
>> mode / cbw_state field would remain unchanged (in the "expecting
>> CBW" state), until the CBW packet arrives.
>>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>> include/hw/usb/msd.h | 12 +++++------
>> hw/usb/dev-storage.c | 50 +++++++++++++++++++++++---------------------
>> 2 files changed, 32 insertions(+), 30 deletions(-)
>>
>> diff --git a/include/hw/usb/msd.h b/include/hw/usb/msd.h
>> index a40d15f5def..c109544f632 100644
>> --- a/include/hw/usb/msd.h
>> +++ b/include/hw/usb/msd.h
>> @@ -10,11 +10,11 @@
>> #include "hw/usb.h"
>> #include "hw/scsi/scsi.h"
>>
>> -enum USBMSDMode {
>> - USB_MSDM_CBW, /* Command Block. */
>> - USB_MSDM_DATAOUT, /* Transfer data to device. */
>> - USB_MSDM_DATAIN, /* Transfer data from device. */
>> - USB_MSDM_CSW /* Command Status. */
>
> Since modifying this, please add
>
> typedef
Done.
Thanks,
Nick
>
>> +enum USBMSDCBWState {
>> + USB_MSD_CBW_NONE, /* Ready, waiting for CBW packet. */
>> + USB_MSD_CBW_DATAOUT, /* Expecting DATA-OUT (to device) packet */
>> + USB_MSD_CBW_DATAIN, /* Expecting DATA-IN (from device) packet */
>> + USB_MSD_CBW_CSW /* No more data, expecting CSW packet. */
>> }
>
> USBMSDCBWState;
>
>>
>> struct QEMU_PACKED usb_msd_csw {
>> @@ -26,7 +26,7 @@ struct QEMU_PACKED usb_msd_csw {
>>
>> struct MSDState {
>> USBDevice dev;
>> - enum USBMSDMode mode;
>> + enum USBMSDCBWState cbw_state;
>
> USBMSDCBWState cbw_state;
>
>> uint32_t scsi_off;
>> uint32_t scsi_len;
>> uint32_t data_len;
next prev parent reply other threads:[~2025-04-12 5:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 8:04 [PATCH v2 00/10] usb/msd: Permit relaxed ordering of IN packets Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 01/10] usb/msd: Split in and out packet handling Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 02/10] usb/msd: Ensure packet structure layout is correct Nicholas Piggin
2025-04-11 10:18 ` Philippe Mathieu-Daudé
2025-04-11 10:21 ` Philippe Mathieu-Daudé
2025-04-11 10:23 ` Philippe Mathieu-Daudé
2025-04-12 5:32 ` Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 03/10] usb/msd: Improved handling of mass storage reset Nicholas Piggin
2025-04-11 10:19 ` Philippe Mathieu-Daudé
2025-04-11 8:04 ` [PATCH v2 04/10] usb/msd: Improve packet validation error logging Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 05/10] usb/msd: Allow CBW packet size greater than 31 Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 06/10] usb/msd: Split async packet tracking into data and csw Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 07/10] usb/msd: Add some additional assertions Nicholas Piggin
2025-04-11 10:27 ` Philippe Mathieu-Daudé
2025-04-11 8:04 ` [PATCH v2 08/10] usb/msd: Rename mode to cbw_state, and tweak names Nicholas Piggin
2025-04-11 10:28 ` Philippe Mathieu-Daudé
2025-04-11 10:37 ` Philippe Mathieu-Daudé
2025-04-12 5:33 ` Nicholas Piggin [this message]
2025-04-11 8:04 ` [PATCH v2 09/10] usb/msd: Permit a DATA-IN or CSW packet before CBW packet Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 10/10] usb/msd: Add more tracing Nicholas Piggin
2025-04-11 10:36 ` Philippe Mathieu-Daudé
2025-04-12 5:33 ` Nicholas Piggin
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=D94EYEYWM728.2K81YKH9JOHYL@gmail.com \
--to=npiggin@gmail.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).