History log of /linux-6.15/drivers/usb/gadget/function/f_tcm.c (Results 1 – 25 of 72)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3
# d7123c77 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Refactor goto check_condition

Move the command initialization before the check_condition to after the
goto statement for a cleaner look. No functional change here.

Signed-off-by

usb: gadget: f_tcm: Refactor goto check_condition

Move the command initialization before the check_condition to after the
goto statement for a cleaner look. No functional change here.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/8442364f51f2788d2a191997581a8eda7a143272.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# de92fb3f 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Track BOT command kref

Set TARGET_SCF_ACK_KREF flag and allow f_tcm to take the BOT command
reference. A usb request may be canceled, the f_tcm knows this. Let it
decides if the

usb: gadget: f_tcm: Track BOT command kref

Set TARGET_SCF_ACK_KREF flag and allow f_tcm to take the BOT command
reference. A usb request may be canceled, the f_tcm knows this. Let it
decides if the command should be freed. This is the same as how the UAS
interface is done.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/e791c639e91b5d91a8787f5d6902e8c58f1dc172.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 3ce3b210 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Requeue command request on error

If there's error on command request, make sure to requeue to receive the
next one.

Signed-off-by: Thinh Nguyen <[email protected]>
Link:

usb: gadget: f_tcm: Requeue command request on error

If there's error on command request, make sure to requeue to receive the
next one.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/d4e55c13be8f83f99ee55f7b979a99e2c14fc4c8.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# a4d7274d 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Stall on invalid CBW

If the BOT command CBW is invalid, make sure to respond by setting
status endpoint STALL until the next proper CBW or reset.

Signed-off-by: Thinh Nguyen <Th

usb: gadget: f_tcm: Stall on invalid CBW

If the BOT command CBW is invalid, make sure to respond by setting
status endpoint STALL until the next proper CBW or reset.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/96022e2d5225f01a20263a4ba9c2e2c8a63328b8.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 29ed1705 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Check overlapped command

If there's an overlapped command tag, cancel the command and respond
with RC_OVERLAPPED_TAG to host.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.

usb: gadget: f_tcm: Check overlapped command

If there's an overlapped command tag, cancel the command and respond
with RC_OVERLAPPED_TAG to host.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/6bffc2903d0cd1e7c7afca837053a48e883d8903.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 20e9ab60 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Handle TASK_MANAGEMENT commands

Handle target_core_fabric_ops TASK MANAGEMENT functions and their
response. If a TASK MANAGEMENT command is received, the driver will
interpret th

usb: gadget: f_tcm: Handle TASK_MANAGEMENT commands

Handle target_core_fabric_ops TASK MANAGEMENT functions and their
response. If a TASK MANAGEMENT command is received, the driver will
interpret the function TMF_*, translate to TMR_*, and fire off a command
work executing target_submit_tmr(). On completion, it will handle the
TASK MANAGEMENT response through uasp_send_tm_response().

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/50339586e36509dadb9c208b3314530993e673b6.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 1d5d4e11 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Send sense on cancelled transfer

If the transfer is cancelled due to a disconnect or driver tear down
(error code -ESHUTDOWN), then just free the command. However, if it got
canc

usb: gadget: f_tcm: Send sense on cancelled transfer

If the transfer is cancelled due to a disconnect or driver tear down
(error code -ESHUTDOWN), then just free the command. However, if it got
cancelled due to other reasons, then send a sense CHECK CONDITION status
with TCM_CHECK_CONDITION_ABORT_CMD status to host notifying the delivery
failure. Note that this is separate from TASK MANAGEMENT function abort
task command, which will require a separate response IU.

See UAS-r04 section 8.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/f2ae293c1fc39df4d242a2f724584bf4ec105ece.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 47261521 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Save CPU ID per command

Normally we don't care about the CPU id, but if we ever use
TARGET_SCF_USE_CPUID, then we need to save the cpuid.

Signed-off-by: Thinh Nguyen <Thinh.Nguy

usb: gadget: f_tcm: Save CPU ID per command

Normally we don't care about the CPU id, but if we ever use
TARGET_SCF_USE_CPUID, then we need to save the cpuid.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/ab45e37314405d9cdd7a8e3b761c654400bb2270.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 2d6d0c69 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Stop proceeding further on -ESHUTDOWN

If the error code is -ESHUTDOWN, stop processing the request/command
further and prepare for teardown. -ESHUTDOWN is for device reset or
dis

usb: gadget: f_tcm: Stop proceeding further on -ESHUTDOWN

If the error code is -ESHUTDOWN, stop processing the request/command
further and prepare for teardown. -ESHUTDOWN is for device reset or
disconnection.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/b14410cce6bc7b8a0b43da23a8e0cf1ed1fa8ab6.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 89e4ec50 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Cleanup requests on ep disable

There may be different reasons for the transfer to be cancelled. Don't
blindly free the command without checking its status. We may still need
to p

usb: gadget: f_tcm: Cleanup requests on ep disable

There may be different reasons for the transfer to be cancelled. Don't
blindly free the command without checking its status. We may still need
to properly respond to cancelled command. Check and only free the
command on endpoint disable.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/6c4ae2b4c2a9037bdcb6f909e173a94b11f04657.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 76003eb6 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Handle abort command

Implement usbg_aborted_task() to cancel aborted outstanding requests.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/

usb: gadget: f_tcm: Handle abort command

Implement usbg_aborted_task() to cancel aborted outstanding requests.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/6d2a05f120a0384e36b5150b50eec53a0991f400.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 360715d5 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Minor cleanup redundant code

The status request preparation is done in uasp_prepare_status(). Remove
duplicate code. No functional change here.

Signed-off-by: Thinh Nguyen <Thin

usb: gadget: f_tcm: Minor cleanup redundant code

The status request preparation is done in uasp_prepare_status(). Remove
duplicate code. No functional change here.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/2b2200a9022296f520e26f61ed6aaa6eb34d466f.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 70fda9e6 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Execute command on write completion

Don't just wait for the data write completion and execute the target
command. We need to verify if the request completed successfully and not

usb: gadget: f_tcm: Execute command on write completion

Don't just wait for the data write completion and execute the target
command. We need to verify if the request completed successfully and not
just sending invalid data. The verification is done in the write request
completion routine. Queue the same work of the command to execute the
target_execute_cmd() on data write.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/9f6b1c6946cf49eeba0173e405678b9b7786636b.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 5cf091d5 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Return ATA cmd direction

Check ATA Pass-Through for direction.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/c22215f7925581684a13eae9a1

usb: gadget: f_tcm: Return ATA cmd direction

Check ATA Pass-Through for direction.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/c22215f7925581684a13eae9a14afb47fb60c061.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 0d2d759c 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Handle multiple commands in parallel

Resubmit command on completion to fetch more commands and service them
in parallel. Increase the number of work in a queue. Each work will be

usb: gadget: f_tcm: Handle multiple commands in parallel

Resubmit command on completion to fetch more commands and service them
in parallel. Increase the number of work in a queue. Each work will be
for each command allowing them to be processed concurrently. Also, set
them to be unbounded by cpu to improve performance.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/933cf7191b672bf4cfbea4df19af1b08dc1baca9.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# a570559a 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Allocate matching number of commands to streams

We can handle multiple commands concurently. Each command services a
stream id. At the moment, the driver will handle 32 outstandi

usb: gadget: f_tcm: Allocate matching number of commands to streams

We can handle multiple commands concurently. Each command services a
stream id. At the moment, the driver will handle 32 outstanding streams,
which is equivalent to 32 commands. Make sure to allocate a matching
number of commands to the number of streams.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/2d806120dcc10c88fef21865b7bc1d2b6604fe42.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 34579e98 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Don't set static stream_id

Host can assign stream ID value greater than number of streams
allocated. The tcm function needs to keep track of which stream is
available to assign t

usb: gadget: f_tcm: Don't set static stream_id

Host can assign stream ID value greater than number of streams
allocated. The tcm function needs to keep track of which stream is
available to assign the stream ID. This patch doesn't track that, but at
least it makes sure that there's no Oops if the host send tag with a
value greater than the number of supported streams.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/d57b7dfd228199cef811206b1b83ec649f742752.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 1f0d96f5 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Get stream by sbitmap number

We prepare same number of sbitmap as the number of streams. Use the
returned sbitmap number as index to the selected stream for a usbg_cmd.

Signed-o

usb: gadget: f_tcm: Get stream by sbitmap number

We prepare same number of sbitmap as the number of streams. Use the
returned sbitmap number as index to the selected stream for a usbg_cmd.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/169f67261162c16342bc8543db93c259b05ead0b.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# d0c188cd 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Increase bMaxBurst

Currently the default bMaxBurst is 0. Set default bMaxBurst to 15 (i.e.
16 bursts) to Data IN and OUT endpoints to improve performance. It
should be fine for a

usb: gadget: f_tcm: Increase bMaxBurst

Currently the default bMaxBurst is 0. Set default bMaxBurst to 15 (i.e.
16 bursts) to Data IN and OUT endpoints to improve performance. It
should be fine for a controller that supports less than 16 bursts. It
should be able to negotiate properly with the host at packet level for
the end of burst.

If the controller can't handle a burst of 16, and high performance isn't
important, the user can use BOT protocol from mass_storage gadget driver
instead.

Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/9d6265db4d138e542f281988362bc4392b034d43.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 94d9bf67 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Don't prepare BOT write request twice

The duplicate kmalloc here is causing memory leak. The request
preparation in bot_send_write_request is also done in
usbg_prepare_w_request.

usb: gadget: f_tcm: Don't prepare BOT write request twice

The duplicate kmalloc here is causing memory leak. The request
preparation in bot_send_write_request is also done in
usbg_prepare_w_request. Remove the duplicate work.

Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT")
Cc: [email protected]
Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/f4f26c3d586cde0d46f8c3bcb4e8ae32311b650d.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 25224c1f 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint

Match usb endpoint using fullspeed endpoint descriptor to make sure the
wMaxPacketSize for fullspeed descriptors is automatically configured

usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint

Match usb endpoint using fullspeed endpoint descriptor to make sure the
wMaxPacketSize for fullspeed descriptors is automatically configured.

Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT")
Cc: [email protected]
Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/e4507bc824aed6e7c7f5a718392ab6a7c1480a7f.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 3b997089 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Fix Get/SetInterface return value

Check to make sure that the GetInterface and SetInterface are for valid
interface. Return proper alternate setting number on GetInterface.

Fixe

usb: gadget: f_tcm: Fix Get/SetInterface return value

Check to make sure that the GetInterface and SetInterface are for valid
interface. Return proper alternate setting number on GetInterface.

Fixes: 0b8b1a1fede0 ("usb: gadget: f_tcm: Provide support to get alternate setting in tcm function")
Cc: [email protected]
Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/ffd91b4640945ea4d3b4f4091cf1abbdbd9cf4fc.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 3b2a52e8 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Decrement command ref count on cleanup

We submitted the command with TARGET_SCF_ACK_KREF, which requires
acknowledgment of command completion. If the command fails, make sure to

usb: gadget: f_tcm: Decrement command ref count on cleanup

We submitted the command with TARGET_SCF_ACK_KREF, which requires
acknowledgment of command completion. If the command fails, make sure to
decrement the ref count.

Fixes: cff834c16d23 ("usb-gadget/tcm: Convert to TARGET_SCF_ACK_KREF I/O krefs")
Cc: [email protected]
Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/3c667b4d9c8b0b580346a69ff53616b6a74cfea2.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# 98fa00fd 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Translate error to sense

When respond with check_condition error status, clear from_transport
input so the target layer can translate the sense reason reported by
f_tcm.

Fixes:

usb: gadget: f_tcm: Translate error to sense

When respond with check_condition error status, clear from_transport
input so the target layer can translate the sense reason reported by
f_tcm.

Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT")
Cc: [email protected]
Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/b2a5577efe7abd0af0051229622cf7d3be5cdcd0.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


# c225d006 11-Dec-2024 Thinh Nguyen <[email protected]>

usb: gadget: f_tcm: Don't free command immediately

Don't prematurely free the command. Wait for the status completion of
the sense status. It can be freed then. Otherwise we will double-free
the com

usb: gadget: f_tcm: Don't free command immediately

Don't prematurely free the command. Wait for the status completion of
the sense status. It can be freed then. Otherwise we will double-free
the command.

Fixes: cff834c16d23 ("usb-gadget/tcm: Convert to TARGET_SCF_ACK_KREF I/O krefs")
Cc: [email protected]
Signed-off-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/ae919ac431f16275e05ec819bdffb3ac5f44cbe1.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


123