usb: gadget: f_tcm: Limit number of sessions
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Wed, 11 Dec 2024 00:32:25 +0000 (00:32 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Dec 2024 07:56:06 +0000 (08:56 +0100)
Only allocate up to UASP_SS_EP_COMP_NUM_STREAMS number of session tags.
We should not be using more than UASP_SS_EP_COMP_NUM_STREAMS of tags due
to the number of commands limit we imposed. Each command uses a unique
tag. Any more than that is unnecessary. By limiting it, we can detect an
issue in our driver immediately should we run out of session tags.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/017016ffcab2f3c284d863fc42483b83dbd21b35.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/tcm.h

index 6cb05dcd19ff04b81d60eca025e8508b9900724a..385bc2cdefb6edb6269f812f43c6678556e6ad08 100644 (file)
@@ -24,7 +24,7 @@ enum {
 #define USB_G_ALT_INT_BBB       0
 #define USB_G_ALT_INT_UAS       1
 
-#define USB_G_DEFAULT_SESSION_TAGS     128
+#define USB_G_DEFAULT_SESSION_TAGS     UASP_SS_EP_COMP_NUM_STREAMS
 
 struct tcm_usbg_nexus {
        struct se_session *tvn_se_sess;