From patchwork Wed Dec 11 00:31:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849685 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 955FB175A5; Wed, 11 Dec 2024 00:33:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877240; cv=fail; b=qE/hx5S07MlooYHbjvBF+mB5AGaGMyrKU0vZRjCaxQdwF5FH90toipf0zibWrUvYR4KPokXTQ+JGagxl2U/q83seaZfizjfpZn2V2pRqEnl0/vAAx2As9HY1D3DM9H6YBMjpPKY9dUuOdr4fs3VsDdaQZCPLaH9tu30rxqbH8oI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877240; c=relaxed/simple; bh=zylX45SclTToMx0DKHZf6XKtosEehJttd1LWg5QBgsA=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=iUTN9BM5AnFx538UoP0RqqzplkOMFiePElpXZ/cPuhUOrlxanan6GGsvQgD7et00utYUI2zCZMgtz86Sqc+HyIlDu5/2w1c4wNm6jHonYX5sAGOC0X/LRrZ9e2O2ZfgFmIfbcfuK+zuRka92bi3INVnULRX1obsa1dmBtTMfyBs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=j0rax64f; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=hg2/tpOr; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=L3hsCgck reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="j0rax64f"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="hg2/tpOr"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="L3hsCgck" Received: from pps.filterd (m0297265.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAM1Z1I017223; Tue, 10 Dec 2024 16:31:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=nQ3ToMYy/+k055h48KltP9+nYtIVZ5K25YxXgWLUcp0=; b=j0rax64fcu0t 4haZk7OhWHMrW59jWrc8f3jNPA+fkY1NpSdipM35me5xUwlWMPNaljJ9GpgXy2kE J+2FGsizwCbtlyqB8J4PR9vTqW41Ey+D8ri1/T8Otpu/Ke1Z/Z6moMvEr995Rm89 xNRbacWB8o9RxJdFqfmKDGWIk69b5e2RBb19eK3v/IhVfMumBFNUcNkLKgs1J2ya raS8SbNKOpctSZrQ+p0n25O7R74Vo3iUinsCfHlWJVz9EdZUxEZVmxkYuGR8Pm39 w21Izyujxfc2GrX1jq95AZdqZjBaMf8E42IWwlFuqkZgU4lMHFCqw5vrDG8OfD3Q XpC2RW65Aw== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cp60t0vf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877110; bh=zylX45SclTToMx0DKHZf6XKtosEehJttd1LWg5QBgsA=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=hg2/tpOrRbya1z1L2dsunFsSejHoONESjYFkscluSk9uzZLCzoFElcjrH+hhINvxR N/6GN9qpBnk3jiJkdfIBFn2K63ZhNAwCGuVk5UpM/DbSxuZfE0dARQy5zZg38Ms5Jo Z0+AV+yisaRf4eugn3cVK/3hJkZHvZ6BzO4Ka0WUpYsRz6fSkg55j8hnUAnWbscIli DZ8PDS4sGRbzJ7CmDZ5MbsM44/me/CFapH3BwXbnYt9IYZ4C4juBsAgJ6RB7Tw7uMW W5zU2mGxADo5LGvKeyYA1c05D7eMa7EQ9AeJqPaV8GQlb+jN6kAOg0pTff4Pc0mZys Co1haxYGJ0dCA== Received: from mailhost.synopsys.com (badc-mailhost3.synopsys.com [10.192.0.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 951074012B; Wed, 11 Dec 2024 00:31:50 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay1.synopsys.com [10.4.161.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id CF594A0068; Wed, 11 Dec 2024 00:31:49 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=L3hsCgck; dkim-atps=neutral Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2046.outbound.protection.outlook.com [104.47.57.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id E14A8405DB; Wed, 11 Dec 2024 00:31:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cD4QgMLikQJpITq3AQ/SZW6BwBrLv0Zk4IxPI+w8aAmc3YfxGkk0vzX4nlFb9kayQwIo/CeENAFkoEciMBrQCeHovnjCk5qLf/0meyYhLHhIGtrgcXBLUjwLSh6oHQsBjV/olW1O4JseOPELaD5z8w97sfBU7fGKAZvqfsJj37h/8J/xteazSObcQyyMUs9YFqTbZJmXuDwbC/XaW4lLO0AAqtVcgtBebJFOmL1a0oX8bmtVJTq3j22hI6GRl7arAiKC5nmV4t0pKOyW3a9kcvhe6NlmKJvis0q++yvCtrBahPxk49HZnE8+nVsN5L87fomerYqXdd/gGgwhQSIuTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nQ3ToMYy/+k055h48KltP9+nYtIVZ5K25YxXgWLUcp0=; b=bwL0+Tv04ADsdKtiq+ODInUHM04553WCShTcCLBYZV3C8oE+PL73DWw2RU+GjWBfhqS9U4VYaENVddhgYuFX1wiLDKTGa5/r3pb6HtFIeNDr49F2xSfixouwzAuzinBu5qpZgcu6LYruB0Qp13uZb2X5q86JV76T8F2gpDOKOlCtOimU6+0e90vS9c3+TBMlscwckcWzteNimeoM/EsbPZlNEuYyXGdFvu0bZxuIxErb/ZevVv08Hy9CvCCD0dXe/9tDUaovt+zSL6K9Vk39f51hMnFpnb7KASp1MAFmEBcclPf8Pdk/dvpd5JjzwybccqTjbDSTNhlHBZOyO+6vQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nQ3ToMYy/+k055h48KltP9+nYtIVZ5K25YxXgWLUcp0=; b=L3hsCgckqqQcxj0c1KlboJCM8g38EJhWOLcrZaCLWnwNeuz4R6Dy0YILd/ZJHHhMBELPShRBDIixNd3443a0Q+svRjIayLYbOuAGR8os2W1xUCutNe+CrYWdIHla346Ekc+R7dtosD1DWPO/qpDMQ1J02q6G18sPLaHiRoSR+VA= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CH3PR12MB7691.namprd12.prod.outlook.com (2603:10b6:610:151::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Wed, 11 Dec 2024 00:31:44 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:31:43 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Nicholas Bellinger , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , "stable@vger.kernel.org" , Homura Akemi , Alan Stern , Christoph Hellwig Subject: [PATCH v3 02/28] usb: gadget: f_tcm: Translate error to sense Thread-Topic: [PATCH v3 02/28] usb: gadget: f_tcm: Translate error to sense Thread-Index: AQHbS2QNKrRIrx5sSEKLaYoqRp+CIQ== Date: Wed, 11 Dec 2024 00:31:43 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CH3PR12MB7691:EE_ x-ms-office365-filtering-correlation-id: 87027d97-6e6d-45c7-b693-08dd197b2fdd x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?fgb3nPWmQGiHU8gJWnPIc3EIlZ?= =?iso-8859-1?q?Z+i1VsjewknaHqiEOfYIBI/02ATde6IIO2KXwalWWx5712D0/5qmJ5TLvF2Y?= =?iso-8859-1?q?/SIFUDHvB8yDrNsRnfTnw3/FRe9S9zNKZ/QN1OHIqkszbEMzTOtXlx8M2hPa?= =?iso-8859-1?q?hplZWiaU6OhjdJ12IYGieeyJ2JegTASrmxG9CRu8R14QutQn2IJmfHPsCh8R?= =?iso-8859-1?q?i8Clb9PGTNh2gYeArL0I2ZSOywy33T7avl+nA3o3aQT5uD6zztTJh7WLciVn?= =?iso-8859-1?q?ZRQkhqoeVRQCEBfQ5VZ7v0gn/3RRDobG5F9bNDBxPiWsUSFQ/tYR6r8qFHOr?= =?iso-8859-1?q?/7+65iPeTLzV/GaQWTqflmgJOvGKNcPM7fJAztDqoIPvImHrhuhpQVdukid/?= =?iso-8859-1?q?LcAglctlfH1nI8V+JRtB3kNPWr0txIe7FB6P3be/AiKKO06l3TNadVsVximz?= =?iso-8859-1?q?rayHLy+DmQlT+cjT8XgURZTVN6bgfAjQHToxVLi+xao3RJKRqQm9yXqeVQoN?= =?iso-8859-1?q?pXqyscbGdue59z+AHSC7AWKUwfHGESCCzl5LLhIPuNQ5IspnlI1s/aR3JY70?= =?iso-8859-1?q?PLAz8Y8FihRycNg8D1ryscdeEsHNELILRBxsMRliMbEKy7KLLE3roPv3bmhv?= =?iso-8859-1?q?lhST5R3CjWJTFuuB7kk20d3qaBaS1U3jLQh+4Tr07LRaEAlD3T8laKmvNxE7?= =?iso-8859-1?q?XhiL5HEwFJ9ycMIUGQZZjUQOdPpASCBXAK1koJbRZbrZJvHQilz8FLcNxR3A?= =?iso-8859-1?q?IrSf6pvFCXPpvVQuGhaGSdEUQKMBUIiABuzZlsll5G41/JFrBEaVQPCk+ZWb?= =?iso-8859-1?q?p/9JUw9Cw61pFPqLD4P44igmWgBd4EA7LrmfeA0f8ITQuhaTonJ6KAL18TD7?= =?iso-8859-1?q?0yzKXqMxl85tiujH2Sj3kcXJmWshEuTkiuIbmHJ5JU1/oqycUwmCcbVsU1KB?= =?iso-8859-1?q?Ldj6tR5nik+skrhNDCpobIuT7ihfmbvCrmh8Cv45VfHDb17KY5/t4xYKxWyl?= =?iso-8859-1?q?rjlGD+G/CJLjFIB7DNXegkypzwLNmmV7zhM7ASYsDYcg7Am7VETZs8GqLfud?= =?iso-8859-1?q?rkOqDVVW27ejHmnsZ5NMIjSk4iOVe74KMUaR4EJhi4DIxwiQ+pvstZKj9TQ/?= =?iso-8859-1?q?/NKBcdc41AWrdmPg2aFkNtNzh7mXEWgrjGXGAenSrQx+XX7FojbWV53hmIli?= =?iso-8859-1?q?se6V3BsEFiaJ0J2qt0iXvbXs2md3zg80mfflXMHBAbhsVQqMIAbxXfu6z8KB?= =?iso-8859-1?q?ApIdZEK3zAl+e63xt/I8thsrn1iDOEiDf8WBNofr6PtN3VkMVIOdgpNm0wmX?= =?iso-8859-1?q?QwQjqp72J1pfGtsemJax3lfe6arNIX0F5vcfIqa/qmsvDO7wRZMrJOa60GWz?= =?iso-8859-1?q?evyg6IqOlj0lFoAlc5PjVsv7XNviY4AqczNgdfFs8vFMsCGOFUojtPdH5XOY?= =?iso-8859-1?q?XtXX/P4PD3KmMrFVMU4O9b2g=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?JqidUwfpqH+WhLa0qf6UPQu?= =?iso-8859-1?q?OYGkJuwKGFMS0CDrn6Xj73pBcyGOmhzrqxQaGg6MgaBswNN9FL4rKso+Ptnh?= =?iso-8859-1?q?JZuRICiFVFESTHS4xKszMjIBL7egx2WDvI4qI1nEx6cnxjS3yZF7BMeIlIKV?= =?iso-8859-1?q?c6jwN19s+qBcNn0jyAXdP6OqnKIhl6DoSIxot4F7e9bdBQ1OQPO02Ra6N41Q?= =?iso-8859-1?q?Y5ySr2M/GfOR0moMpJ83SvGCNYN90J7hixegxFLVK+WidTqUOqDNE/ymr9Dr?= =?iso-8859-1?q?/lX3PIPQAninBgzlGiVNwIJ3FjQj9oiFd5KOvEzmcFGYLicNkwAyRoEs6NLf?= =?iso-8859-1?q?aoaMj0KZ/CNVovSzroD30lmVvq1Stdkoyrf4PuFwdl5ofU2QN0vvhRlTCqi+?= =?iso-8859-1?q?Qln2SbSm++QJGQutFsit/IlgaSyxlhzh45ymlspcgyFiKECNpQEMT4obT+DX?= =?iso-8859-1?q?QKu6PWRpZe9fltBXY4+5gyMHor71xcMQdZ13yID4Ic1bM0GaJS12Y+M6RjLc?= =?iso-8859-1?q?DJxz6TUe90T+MaL2QlyivxbLfUsZ/qqmQsrOkanMDGLR+FaCWWnPhF/rSP5k?= =?iso-8859-1?q?PvLJJ4bn6LS1J7Lho2nCRkxGAclJ1ZYnacXbB9Jiiwd5lpGFxh/z60lBmtDs?= =?iso-8859-1?q?zOYOkfx5Ju5XCm3Ep3TAgvvr9BEZRPWtNta4X+RtJMEekbDyhOyqX3m6ndq4?= =?iso-8859-1?q?ntiFX82QnWW03/R8TUvLVgpatjRjvDvee7IULaC+40bJl/ib4RRdMrd1yH71?= =?iso-8859-1?q?xSB7vvCOUlKGVtvnAZMG2m4GwBZuJuGfzvkp4y1/KrB4FIVZcEg8ltpUmsku?= =?iso-8859-1?q?YexkngvdRcbyBfMC+voSUNDT7wJCDqugq47V7ZzubRMUrqdxNxlNgpUAQ4VV?= =?iso-8859-1?q?tUHlIegrx431A3xFShim4OFrgAkDWnVxsSIvgFaNo3BmKLmB1+yAXrrwfM9R?= =?iso-8859-1?q?d/j+HEV9IpnM1mDXJ3gasifHZVhXQBpTGLiCZFxYBPdavgRmk/8RqOIfTzI8?= =?iso-8859-1?q?E8BRYVEqnd7toVjXfptT9iONywvkjlib8VZ8pzpZeW5MFSUrMos4B6GK7YNH?= =?iso-8859-1?q?Hdy0h3kqZj6DmXIaNKG8dUN0rU6nREvYECtALnKoFuBfVhFrgP6E8vmaozL2?= =?iso-8859-1?q?OFecU8t6pt9/nAdvz4PLLb6Mwkb23i4/6G3H0FVETXRWNTgErJMtxx/ViNXN?= =?iso-8859-1?q?XVFGryU3Xz3EFgtNnMR9Zn/A8229CrnoqVuHsVNueSvWXu+K74bpaUwgGxvq?= =?iso-8859-1?q?Qhb4yQAd4uI1IoYGxf6CbgaxnkoYJeaVehjh5xHNbJMASQRFlo8UR9xUOcks?= =?iso-8859-1?q?NNhHIEfwMDcj2y3nssCggt05L58ddczAw2dTsXc6xip/9bybZYOu13FqCyzL?= =?iso-8859-1?q?LDBhqxyDOkZdLCwG9Q/wD1roHzWo+wkFYSooPP96ef0y1wSc3c4tsp43OxNe?= =?iso-8859-1?q?ykT8E678fBqCiznzJqitHr+OeCMvh3sMZRMLupafYNIonhnJK+MSzXs3MWfN?= =?iso-8859-1?q?gnMs4NrPBGpmy3+4uli7Gx6ft08hdMhBN8ahdEe8XhmxvGZHs/8ivCXZeLHH?= =?iso-8859-1?q?rf48TWkxtnf5Lw0JpEgAnUWg92CliLo3bQpY3MO5SPSvO4vdqfOzVtRFVz7U?= =?iso-8859-1?q?qFyTIOtQl6qCkCeFg?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HJK/Xvsz5fCilRU2aO9yjnainJnEv9sgg3Ty8PzCFy3Ur4pXd0VWBnO0eJGxDjVM56ypb8gJZblb2OvW7BdziXLlb3XPTRuqUfMVNddHxrj53eox+5nAf4ZBpFGdU4UYNj/PM00a8aXiwSaz5gfHstDHCiZUDVE13jjKjRhCWa6qjjdIIfdaFP/Hz8V8jLdIUbFTN8+CGItRyUo2PcZrS5tYootRt+OhN+XQR69krb/mCVJbQzL7RKZjqnuKK5P3o+UU6ad8+rOtpGzxJRY2P+tq4Fa0y3jfxyMV+dNxRoUz6sMPnriwHq4/tZ0CE4BohOq6p2092ym+Qyf0xg7IBKJ33wsAecKx0CT29tXyH6xHgBYwhZqSJH5bN9v9gqI7VNgPSgpmol5xpLM9dHuTDHVtJEwKWwnYZY5Nuw8sPaycdmBzCy1zUQONSlGQgroVSuh9X1AVJz9Efk2eI3W7l+nYUwDO8mn8QC5iGJQhRJ+d+bEaRCsk+HyomjKvgc2H89vXlgTDYez0wZ1TR5VXhV2L6z2df3R2t2Bslr7/h8qZwWv/WOGplJNBFSLQqIrX/NoiAeexXmVpdztfRl4ad0+/NKoXN0VNlcmFMeQjUU5qHfhMGSPVBDAx7Nb35Xxcke7XGsbzzZNPXbeDWM/ZrQ== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87027d97-6e6d-45c7-b693-08dd197b2fdd X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:31:43.0638 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mhYBx5k9OKpWS2Y4LzkIPff3wTi3H8RaGootRGjA8WbDBP938aR1BH1uDcHCbpv6uwzQob2aSSfyiCJQQE8YpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7691 X-Authority-Analysis: v=2.4 cv=Z9YWHGRA c=1 sm=1 tr=0 ts=6758dd77 cx=c_pps a=t4gDRyhI9k+KZ5gXRQysFQ==:117 a=t4gDRyhI9k+KZ5gXRQysFQ==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=VwQbUJbxAAAA:8 a=jIQo8A4GAAAA:8 a=uci9V5TbMvxmTE9LAKsA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-ORIG-GUID: gkAtT4gl-tddLJSRWpsfLZxazeWaU_nr X-Proofpoint-GUID: gkAtT4gl-tddLJSRWpsfLZxazeWaU_nr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 bulkscore=0 clxscore=1011 lowpriorityscore=0 phishscore=0 adultscore=0 mlxlogscore=883 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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: stable@vger.kernel.org Signed-off-by: Thinh Nguyen --- drivers/usb/gadget/function/f_tcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 6313302a5b96..88b8b94fdb1e 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1061,7 +1061,7 @@ static void usbg_cmd_work(struct work_struct *work) out: transport_send_check_condition_and_sense(se_cmd, - TCM_UNSUPPORTED_SCSI_OPCODE, 1); + TCM_UNSUPPORTED_SCSI_OPCODE, 0); } static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu, @@ -1189,7 +1189,7 @@ static void bot_cmd_work(struct work_struct *work) out: transport_send_check_condition_and_sense(se_cmd, - TCM_UNSUPPORTED_SCSI_OPCODE, 1); + TCM_UNSUPPORTED_SCSI_OPCODE, 0); } static int bot_submit_command(struct f_uas *fu, From patchwork Wed Dec 11 00:32:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849681 Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A7E4CA4E; Wed, 11 Dec 2024 00:34:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.156.19 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877264; cv=fail; b=DQVGdNi2ebtY23WTiuMJzM9SisxVP9aLQZ0I0RM8hSSnapQ4Hv+Q9Ulpz1WAuZNZa8hrLyBI1utCgmw+S4qcBWMRJxU8dozYL1/qtBZrBUv503aAEoMJxJsHgL0IDcFvJIXwqfVeBUovkvy/4KRqZPx7a+wury9T6BQGeZrPEVA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877264; c=relaxed/simple; bh=LYI3x5/5UgqsBpZUS+S/i0iKZBhuzGAbzpWdDq7ULYs=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=uUxgCM5uC/CQocduqNcxU0vhuViWqRBylAgI72Rpvp/g+Mcj/aMtMhl2Ahg+Vmp7Hvyj7k9WXSzgMq/FIhaaFA2sREsXdUOHIrbicLlrLeYe+CqiGE9cBMKfFREdqirPcOnjwv9NyFD7Uq11VMWuZhJj8nM/ceuEObQ6oL1BVDI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=WUIr2/00; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=PbCwJjjd; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=fuSO0iIq reason="signature verification failed"; arc=fail smtp.client-ip=148.163.156.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="WUIr2/00"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="PbCwJjjd"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="fuSO0iIq" Received: from pps.filterd (m0098571.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BANjYjd019385; Tue, 10 Dec 2024 16:32:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=lGdUHFaxgK2sH2aCiw4tL86EZHe4lYLV3BiPV0osGAE=; b=WUIr2/0047hP PyRtOtw+tb0HsbTj4mDjuqSFgHobHHu9u+FX+3ZpIefDNv7ZeO1NdUpgVwjmZX8T /Hsv4ESjCCTvUP9EyJZy56y8raYTm92pye/30VMYRSMnhI2kGlo+dptcuG9phvBU Ylv2Wc4xiwYx3eeQGiLyBR9mGRGr9vk60ht4wllLPWl8kTSda27yAVx5E0B7qunC dSagP1wuZrGQOCfu5Kmd6Z+A4mzGyq4WdFuxjaT79xhONNdqRWkR2rhDxVkaRW9b mnvpvGhfLYe7NQoPIt0xaO1thsdwQQ3A9YEUpDitmVNl42xiqb+cSQkbbiwbCIKA JnjvSOcDfg== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cp8t9vh2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:32:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877132; bh=LYI3x5/5UgqsBpZUS+S/i0iKZBhuzGAbzpWdDq7ULYs=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=PbCwJjjdcvnT+X6gBSw2OJyvyhdrZp7TQOFNZyyptpdc+N2Z/57KrTzmtB9sz8Ear nqzVXbt9sNNAGgV1MxCKriOyh+uc0cTyUAG0Lm1KzYWj+EYCybXCZFXDk+LzxITnBx ySFwtMEdGTVJsUoA3813IThTCzMGtrNeEm+vd7e5V+UBw8Xwe68/t5XAONnt63UASt C4MXhEuSMo7+iA4iOeP+d9kXcBzZHdcBNJjgqjatcRICC2VD2FgMBzswvGdIMMxv+1 VcWgN/i2pcD3YpCE7Oc51v5wo0jkde/W51Aoeor4nO+u4llIichMxAOcLGPE1O6n8R our0xntVIgDTg== Received: from mailhost.synopsys.com (badc-mailhost4.synopsys.com [10.192.0.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 1376B40126; Wed, 11 Dec 2024 00:32:12 +0000 (UTC) Received: from o365relay-in.synopsys.com (sv2-o365relay3.synopsys.com [10.202.1.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id E8088A005E; Wed, 11 Dec 2024 00:32:11 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=fuSO0iIq; dkim-atps=neutral Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 535DB40148; Wed, 11 Dec 2024 00:32:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RaeVjvTrsfge6UwSYhZZ6D5G1qiEhg3KnO4uF8tqzIYxL21dXEuEoZLYN2Gpx+QcTlcD2682hDQKRqj+TJBgEUqBLAws1JYS3IejLCCnntWMznXelk4glRoqa7fAz3UZ0HtNhhprXSIv8tXIZLiLB5+0LKf63FeMAvqyPJj3OyGdbAn4CVK78YGymmYj4wXka2RlbOsiF+kwzCx8m+4zKhcMu0vrh9CYvIEcgFFwGu4tAy0bhNP4uYC50NUo2l8o+4TswAQpOkD3LHsoO7aJ9DwsVjxFP4KGY9rmOzSJaiC/RcMp/SIewZH4Q0xuJqxtb/WZ2BYofNvDmovZ/iyh5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lGdUHFaxgK2sH2aCiw4tL86EZHe4lYLV3BiPV0osGAE=; b=c4azKhENrgdB/xzlD3AnnGlceTzAqnHl9lzDmTJcFSB+HL+yCwCphKSAdsluWEIBmEg/MkfjJpZFnS8ABT74TOInAhSdywvwSbL6kAR3ui5djYq1fG0lwwo6m2GO78SLj6m81qXvjT2nQcfFnFRYQrFA45uvG0FQvAftXA1ydKPArF4Q6F7l71axbEowQe2T8CDNR2sSdaMjX49f8tfgcKjsMlk25LxrJigs0NBtsc7qPX8urDqxCHrSQ2eDZImZ5UdEVjZ/+SZjbLinT9fJU6YE+6EHh+ietVMPfKno34piJ7vYfBx9kH3BQrefQjLb3uD9yP3pCXx/gwiJIXE3Ew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lGdUHFaxgK2sH2aCiw4tL86EZHe4lYLV3BiPV0osGAE=; b=fuSO0iIqqaQeV1t+hf/JC/X87W0mZEAA68DQkYIlP2zMO0g99QM18TkyNPLfFPg0KblZEPZ23xonbMCEBvycjTivVD0fad+Sf816jii7kbjSTlFNnDt99hKOgs5Wwwxb4TusEkiBYPZwMgm99jGNDZf12cwUTPtUJGugVb6tn+k= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CH3PR12MB7691.namprd12.prod.outlook.com (2603:10b6:610:151::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Wed, 11 Dec 2024 00:32:07 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:32:07 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Nicholas Bellinger , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , "stable@vger.kernel.org" , Homura Akemi , Alan Stern , Christoph Hellwig Subject: [PATCH v3 06/28] usb: gadget: f_tcm: Don't prepare BOT write request twice Thread-Topic: [PATCH v3 06/28] usb: gadget: f_tcm: Don't prepare BOT write request twice Thread-Index: AQHbS2Qba4VAzDTcF0+prwyD9wf8iA== Date: Wed, 11 Dec 2024 00:32:07 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CH3PR12MB7691:EE_ x-ms-office365-filtering-correlation-id: 875f473a-d749-4b7f-3bc0-08dd197b3e28 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?nNK93poZZv8vqpHmMueLgEaOo3?= =?iso-8859-1?q?RcT0sWecE8pFm1UlYb7GJ7VxTMPYVpV2Ci/lT3B+RGzE8ptQdxwVG28MfzOQ?= =?iso-8859-1?q?E09QsCUfyX/9fwU3jekbTIeG19MkhpqcWGG0lkbT0sy7myhc/zCyZxsPZHjx?= =?iso-8859-1?q?5Nt8jriEQ3hdellEr1XbAk7lBAiPqtqR5W6tvZPA3UOEuEiNMvxgoI8xxrTX?= =?iso-8859-1?q?3O6OtoEO3YDdMMycbZDVaBMslxei76mEFiEg5AwnSwQ3SFvACzf53D5OuLII?= =?iso-8859-1?q?NepWEvPFXA0xh0uQ7tO+T2E0Hq1GNnugyGKTPZpYrXgUQZ4/Xn1o1p6deb5k?= =?iso-8859-1?q?QeTus04qtcj9mJPRqD5BhPGinYjPu9h8LMDosYX1QWpEqyNFT7Nn3gL1cA2V?= =?iso-8859-1?q?ADJ7/17tjHzhTYjrnP1RTYAXwST3bhpeptPbWJMkh7fL1XXZx3tKSDhl7xw2?= =?iso-8859-1?q?I53i3x1lRj28JfhHmnO+ISKduCReP859nRrIVJylsxZdnWpiixpdvfS9+IS/?= =?iso-8859-1?q?hmhtmxO4LoCYzV+9aaI4DMOQUwylewkdbvOHwkpfHIAxycO5pO06ahtERvJ8?= =?iso-8859-1?q?H7iHKZRE2lDoNgTmihbM6/Aa9FHM2V6Dzbl8nUd4gtbIAfw+EzbMGIKs/M51?= =?iso-8859-1?q?SY6ylyUJRReDIIfbLoihKlZYqSXYNUaKfoE8Nx/uG2E2/7cuW3uSXxjEApvX?= =?iso-8859-1?q?A71gH5Ang/0OpOhvfFOruLZBLzYnjYT5T66p/wo6VXqwEg7nhIkdnUlqeYmU?= =?iso-8859-1?q?X+x+Fy7ag+Z3SyV5OpcpHej9pfJ6BcejXuZiov3FT+xqBMVufmuTersJqtMw?= =?iso-8859-1?q?z+T2CZPeRV5AGrzBKcg8M74nAui/j6Ng8WOkzzWWjuxr4XM68yB3E4fWzMkP?= =?iso-8859-1?q?P9nHWseoxUw1FyO1DwHpm4JgsSX359Y7UxT8dwviCSSSTKbu1g3eSLWtqyJv?= =?iso-8859-1?q?Yq0GV9NJYEp5D0U40ConyEyRUyBYkZTuB6KGAHaDBaAWk+O7W5G6Vwz6dqia?= =?iso-8859-1?q?7wV9EVvKFVNkTfljHWwTOUzjmjTxBOdTDiFAcWRoIgAi+6mLwTW9omLMay3m?= =?iso-8859-1?q?fEMpjPk3H5fog+5K6Gj6wPj0EpaRrfBIppYs1UODjZsbxzUhjFy9gWrXgc+a?= =?iso-8859-1?q?f2iFQecExhlfrR/GOKCwIWCvh9VAziqlfpbriOjzsqdYpIBMpObTkvjrfAuQ?= =?iso-8859-1?q?6GCynEnQQxrOcfwLRyfcVSy+9W6Qw7qPOfGU0SeN+T+4jB7owGFTEOagmyP9?= =?iso-8859-1?q?8ImYahbS3bvxSBAiQxegrEpI/RTRDq8uf8X4YzNHTpi6lXEYvq4iyqisUoZC?= =?iso-8859-1?q?kua4Nw/O22GxKC9u0nHrj2et32yMB+FTSUD1QGoDeTRTPZFHOSN836b6hC/E?= =?iso-8859-1?q?SZYSJ7C80bq/FK3uzbxyLzEISqfkHjqsdZPyVERw7nAN3cGB4mXaxokdK2te?= =?iso-8859-1?q?jCZBVSLNwXbunA9pc9D+K0WQ=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?3LeHpqxtFoTjCnDLz7QqTnq?= =?iso-8859-1?q?HFsxbhcidk45jAjcH8uNwYnI+5Gn9nQV7xSjcBHQGgXadNBjEGiYk/wNCD5T?= =?iso-8859-1?q?/EkiLBkN7ZZZ3smP9nNyAvvh+2vVF2xvywchyqqGHw2OGBOD2G4558VV2dEU?= =?iso-8859-1?q?aF5oIXf6+lkxq7IGBfj9uSyiOWsifR0kt8UOoe8AhvshJgJCVGp7/5226w+L?= =?iso-8859-1?q?88CgOU4fDK4Fjra2CpCxE0Lw8QQ2m9DmuTWx2X73NyOqcaWp25UNXO7Hnm5J?= =?iso-8859-1?q?jI03S2WLi07jTuFlkLrEJnmfoKDE7NGN8AWJSxZw7aXB6JZDP5md0W1YBpac?= =?iso-8859-1?q?uwO0SkzonuOXgU3PD0IgwC6Af8esEB9Chv/6rAnAHbXLPos5RnczWBaFJOPn?= =?iso-8859-1?q?UHeGHJkciqPIt5Ck7lixuS0f/QITTK/lE2xKSEvcWsgZV9lWKqN7eq2rMhgv?= =?iso-8859-1?q?WKhE9YcmobU4E5ehzC7ET5Gwz4K8QmBUcRax2Cn+UkIS04zVSlyPmrIn+cAq?= =?iso-8859-1?q?VnyYrw1AyhTxv6uNoVFV6Rs2UxiquiTgNSvNstX9Wz+2yKpt2Xcse/96fRJF?= =?iso-8859-1?q?aIWuMOov3L51+D9pFtLhErM18iBbaUYH13ccxxS3mt8JACWp/+8dnUoFn1hQ?= =?iso-8859-1?q?h3s54cwKIouuZg5cc0XAsCPttFm4azH+yXSwoFFKojdb4KuHPAsryu3IRPy5?= =?iso-8859-1?q?dmAa52Lhxpv82WvqUNglyvg9z0ndc/TgpFiq9wR0o6BeZYHlqqGCzY2Zn/rR?= =?iso-8859-1?q?XeXqbyTacUelx0gygw/qjupO6oJU54LTAGdvdQAyLDGIHalqbRUqguZRRXrd?= =?iso-8859-1?q?JY4XpZ19LHwEAoyyv4ETJRZihx2hOV+n+BoKC/GQlBxXFItDyXY57R5hgJTc?= =?iso-8859-1?q?qkgHytnQlH8++HroKEAPWgFPHHDqMt2W174Pruktjs8LmAIREwC+14+CF6AN?= =?iso-8859-1?q?zeZc/W+q/g8t/840L/Cw+N7hZr4uJSmoJlg8IxCjkIHsnfVkc5PXUPvPJUmS?= =?iso-8859-1?q?OjuzDD36BPOzZhij91ocsM5n4ZGwgbNeV9b8WnV2UkkIRU/t/UEGfmn3SMrU?= =?iso-8859-1?q?viMa4bvp0zODzAnPPt61tNzpg+Y2BOsmLCIo8BpfBovNRxemO4JI7WTIbYWK?= =?iso-8859-1?q?uUstQIg2uuXeY9HxD8AXfUUzSIeqV1nnKkKUgMqRa9SLMxF8wFDBNxCen7Cj?= =?iso-8859-1?q?9yNKNpoDhe5H3FB7s2JMlYQjsy4x7oZRbAfxK2xncGjAuVrE0fdjevl2RAVL?= =?iso-8859-1?q?I8JeTuFW5YKB9JLYH+4LpgTiDArj5oL0S0cYqkpDJYRoreFnnzMKzlEppt4q?= =?iso-8859-1?q?hTvEfvclmykXYWHE9gmW2WZ35hVFIN80gMrUXPBQbGvAQe+qpesBcXV0Je+X?= =?iso-8859-1?q?o5B5+/bVY2MeoC0nDB6svAo8NliBEif4/wPCqnSwaku9FkKIuJ9SeCFwhzPZ?= =?iso-8859-1?q?n2ZhGNnXomJ12RdcqzctPGwTsdwSqf4q6KJIMBSR/J05rC5oh8gQdaLidYfC?= =?iso-8859-1?q?25t1CSyoMxAx+N95wVqSKxx6BBBF6eoxt2IGXAc4cjRcarTl46GjUwlrlGeq?= =?iso-8859-1?q?8A7ikafEhukiXFvXsv7K2TYTIbWYCX4uqBt0BDwz9F8YHZsuzK7S2Z/NOEuE?= =?iso-8859-1?q?tx/6MHIDA4WypBVwG?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: umHc6Ud1RRVocvZp9qOlmFuh0GUyiws2UUUinxMk95thEAqBnqFLL5WAX0wkifqr2uYBggvzqaQF2f43gheVt6zxr95XFDVITMo7n3NBmQU0PCEJP1OF4LgquiuC5kDvLV/Gbw5osBXCwqdfCQx0AxOKUYL9R+JmZXvmediNWgnb1j/p1S7sd7gRHSsRthODnBy55k6yIbmgzsMv7Cn1E3YUHjJVqdp+ztQoH80Cir44+Gzfc5HkQgRhtbMeejAV90jcP+1n9Wdf5yu+o3kQOt8Rik8CSf72LZpMdSWlIbjUHormhwpBlwLosjehHLgIRNgQULtZm5XjZtiDbjAHW96oso8afyq9zDcbP1Ysvp8DphX5QtC1tAxPZh+vwOi/LjE4dS0H2+C7GRMzamN7Pvgj7d3KiAc/KFTD8wmxXanz2bLuIFceB7CtCNVuzoio3S/aX5LCYy8oWD7EMW1poT+y1bGB3JtVY+T5PE3jnTU4ZQA70NQFPkqbbIrcMmC2K7P66ZRUh4eWtK0bgKWfVQ7pfogrmHYPmk8t1SUF2fUHEq+LQyQgXOWJ5UK8zKNbKjmnta2lCSy7HE8MBtYf8grhS/nDNdIezE8sjH0mpp9wzVuL25NAH6Ryp1sOINEEhLcOoez9LiylQ8UvZMPIuw== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 875f473a-d749-4b7f-3bc0-08dd197b3e28 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:32:07.0451 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NVdMhDUei0+vtRcpw3yxncaW22UN0cYGJxjCSHQMBHxJ1YUnMflNZiZ/eo0D2ZJI0eIdzZMqRXc0QZ/F0tJ+Pg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7691 X-Proofpoint-GUID: bghzpIoZMAxexHUz5K8GKZtwt4wFV0BN X-Proofpoint-ORIG-GUID: bghzpIoZMAxexHUz5K8GKZtwt4wFV0BN X-Authority-Analysis: v=2.4 cv=KdsosRYD c=1 sm=1 tr=0 ts=6758dd8c cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=VwQbUJbxAAAA:8 a=jIQo8A4GAAAA:8 a=6lpbQM8GuGKqb_z4f3IA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 adultscore=0 spamscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 clxscore=1015 mlxlogscore=566 suspectscore=0 phishscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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: stable@vger.kernel.org Signed-off-by: Thinh Nguyen --- drivers/usb/gadget/function/f_tcm.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index b35e0446d467..4fd56ae056a3 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -245,7 +245,6 @@ static int bot_send_write_request(struct usbg_cmd *cmd) { struct f_uas *fu = cmd->fu; struct se_cmd *se_cmd = &cmd->se_cmd; - struct usb_gadget *gadget = fuas_to_gadget(fu); int ret; init_completion(&cmd->write_complete); @@ -256,22 +255,6 @@ static int bot_send_write_request(struct usbg_cmd *cmd) return -EINVAL; } - if (!gadget->sg_supported) { - cmd->data_buf = kmalloc(se_cmd->data_length, GFP_KERNEL); - if (!cmd->data_buf) - return -ENOMEM; - - fu->bot_req_out->buf = cmd->data_buf; - } else { - fu->bot_req_out->buf = NULL; - fu->bot_req_out->num_sgs = se_cmd->t_data_nents; - fu->bot_req_out->sg = se_cmd->t_data_sg; - } - - fu->bot_req_out->complete = usbg_data_write_cmpl; - fu->bot_req_out->length = se_cmd->data_length; - fu->bot_req_out->context = cmd; - ret = usbg_prepare_w_request(cmd, fu->bot_req_out); if (ret) goto cleanup; From patchwork Wed Dec 11 00:32:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849693 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F0C62451C9 for ; Wed, 11 Dec 2024 00:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877150; cv=fail; b=hyvO8EPufHQGMZOPO3nlqWsRlscD0D3L2Xao8lVtP0jics1+7mAeMkxdvu9LQ7mX3F4hC98CcRip+b4ujk+ITvNwArgFkMW+q3GSe97h4k+1RQLyO0TOcJ7zwgp8v1rn8aqYjNzxeyDCxS3FVFcf6d7TC7ZMwY0zIZA5caVnJbU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877150; c=relaxed/simple; bh=FomZa8pYUDsO3wYxLs/kVqaIMPcbI4bVVXblAspuwJU=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=bX9BslzWo2SFlEUogWN5YAZ7IPSV+fM4lmHEGKj/ahqHE8Ay2Ik6/yYs6VGHCEE27YNAwsTPDxadrJqcUs6ZBH+O0uvGmSVc2IYmFFxoICYvJUoFDxd6fqGi8jJgEdJAfQ7XFc6uoie4J13gOzGn8ggtwQF+Kiac6lgZvy4CKTA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=rGV7hynB; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=bUsLZr7h; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=T2VbB3kf reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="rGV7hynB"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="bUsLZr7h"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="T2VbB3kf" Received: from pps.filterd (m0297265.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAM1fN8017231; Tue, 10 Dec 2024 16:32:24 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=8n6r/mx0km7e6fzyNwSa167DGRNIm87bm3eRiND/UvQ=; b=rGV7hynBG5D2 cna+AtQRauqGTn+81odtS8pKr+Y0IHFItKeg55ehMDYEkyBYv2xVRXyrZ0ug2n/u jztQrPCooif0YrDTP0OCUBpSxMPp217oNbPc5cqDoKvJql+hIvvMesrqCW0rBLvb bgRwqBhl3Yg5I+7ptC9+J3Nd/TfoVlTF+WM+Khb0v+Uf1zCSoQgxuwLweIAdvJAS HtbP3a+Xse7v2uPRpeUidxiK9Vgm5B7dPSeHh7zSKuka3BiaF4T3BkOjGzVoMPpW xeM8u4L0SrEgOqLnPxPYK0BUBbIRL3z9hrAKZGi1284P9bZa7sT9uBl31NTyO8TH s2tEcIrd5w== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cp60t0xj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877143; bh=FomZa8pYUDsO3wYxLs/kVqaIMPcbI4bVVXblAspuwJU=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=bUsLZr7hyjQwoZkagBSCX6wUuF39hTK0LTrnqqvGHATEpFijKJXuc8mera4G/GBBK qR3bgipTBO9F5AT1xXEWHQbSlIRNXoUEZ+OxIXhXC+illDJZ5VAwX2SqoIyGiQZrgz lT1E2+EH5RaxcsLyUcqPwcT1BF3sntG6QuoJXEoF4nZN0CD65+0Eb7nju50LqufOEp N1RG11BdoYn9CdK3UMJY81p0EoKNe+aXRZQyAV4Qsx4TwFDffzkbyY2sGWSW5s6h7x dSLNHeSWgKK4oIyqTm68py1VatvFdiPnCH7G0DcbYfgncuPznEIFh5pVSoJwOGPtmC 6TnDJT/cc1wEw== Received: from mailhost.synopsys.com (us03-mailhost1.synopsys.com [10.4.17.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 236B540126; Wed, 11 Dec 2024 00:32:23 +0000 (UTC) Received: from o365relay-in.synopsys.com (sv2-o365relay1.synopsys.com [10.202.1.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id D708AA0082; Wed, 11 Dec 2024 00:32:22 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=T2VbB3kf; dkim-atps=neutral Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2049.outbound.protection.outlook.com [104.47.51.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 8C81F4052F; Wed, 11 Dec 2024 00:32:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R40UNO2s66iArrw9CqYrtE+w3Ff8FJ/tFFRXcVh0REjnUq3XbRsDCoAjQXUNpBR+XadLEO75TYCoaWIBBrP9OFQz5rdhHPyVpBP9TiIMPBU8J8Z8PRLDYHiwfKGz+KfJczwDmn5OK8sd9ZYoKPgxaPh+ZUTqI5o2qZwmB6q5pPCGTh4MI+L+CxQCfqBA7bWI45w7Oj7XwdFaCjkQTlRLBJA7SeBSXKiamGCjVj8ohRDHTWLvPNGbxmx0lzcE+HD+EDmQXv3/L4AsJyl0ohmdI0zOQ8PIroJDegoByfX80tk9Q9Yf5Mpc9eA1z63RQa0Urbk+MOgYs1YWzBeIHCHwpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8n6r/mx0km7e6fzyNwSa167DGRNIm87bm3eRiND/UvQ=; b=advPoxhV9znZ2HhCZMSJ3b7PQMz9e5v5mTnt/YNnLF1v122tj+ovfkyfnfp+sR8iGB2X+D5KxHtxcPDvL5Ojid2f9hMpz8Wi+NNeWIv34ZAwVP1l1DsKJQo1ShW4MeRawbl3AdBD0A9e83h/mlzk31cFRu/WAzMtTc/syhW97OPsIv9+qhNf4wkcM1smif0Fq1HCX2DHay9MQ8bJRI0WkxYQAlTgmUamYD69xVe+u0p0e1TOZVE/2Xszwh/+JrHHPaa7aTf0XgBWJo1ciOUJTJOZTP85LDHhqNEoU9TOFf7WWiQUS+U6i2UO3ufX5oxI3XMZ9LzzGQiTZapIEQtP+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8n6r/mx0km7e6fzyNwSa167DGRNIm87bm3eRiND/UvQ=; b=T2VbB3kfK1uOnGKSrU8cohEV8Bc6COS5PXvJLmlxqR+EyorVUqyIiB6V0L/TBTuufB+Ye4j8J9eCti83CMW94yeaw0rxEGXeTSNAxOX630J4HyrP1VlLfr6PKvtwQRykpHJoTyqf/NoZBYFFpv9qnD96GfXyfhvw99zfU+rGcyk= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CH3PR12MB7691.namprd12.prod.outlook.com (2603:10b6:610:151::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Wed, 11 Dec 2024 00:32:19 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:32:19 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 08/28] usb: gadget: f_tcm: Increase bMaxBurst Thread-Topic: [PATCH v3 08/28] usb: gadget: f_tcm: Increase bMaxBurst Thread-Index: AQHbS2QilL41oIyArE2Gkp8gHuzGIg== Date: Wed, 11 Dec 2024 00:32:19 +0000 Message-ID: <9d6265db4d138e542f281988362bc4392b034d43.1733876548.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CH3PR12MB7691:EE_ x-ms-office365-filtering-correlation-id: 642e1116-0710-4eeb-a4b6-08dd197b4576 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?ch3LBR4j+mge4mqrlmAwLw/WWO?= =?iso-8859-1?q?6AGHPZYr9UIIOHj2j3W/S/uKj5Dya0tLPWbMqv/FfzrmvE0KSQV3fOtuLxxL?= =?iso-8859-1?q?QjtLZQoYQ0EdpoPUomRX2DevGiGLIqeM1MRUbnNrm8i1lRYAU/+ry1uXUtQR?= =?iso-8859-1?q?l2eobB9TPbnaUQfQ22TdusD7fAvA7fWfF7ZWyKkV3dspvsocLTabMIyCmxyt?= =?iso-8859-1?q?U+a+J8+319vwKTXgRjHtSU8HGy6IHcXUppJHstgjHZE8AwAdcumTB6C7w3Qj?= =?iso-8859-1?q?zw6V/Jeqt6u7fjz8DF/oCSbtOu6GvR3VUZCZA3l0edMfjB5kgBx/7MyE6mhP?= =?iso-8859-1?q?13lRU/0Gymfq9EtI1vkhOiThQixBgF5QpkfJ/3Lw+K5/bi+wNyQjz/xGqhJ+?= =?iso-8859-1?q?EDIOnIYcS7E0zUYf/Dq0etFPtEd9qIz76NtOqGjkg/h40NAvC6tcg+ukGUZP?= =?iso-8859-1?q?EzvzIM40U8RgWm4abVMMvSUtXPsFUBzOvhD3m6z/MXupfcV1N5sMFifAM51N?= =?iso-8859-1?q?cUgRR91WOi2lfpUyHFmkJvwDWGbhJXwBzWe0+P+W7si4N3ubWvMgbLrmD+kD?= =?iso-8859-1?q?0XDIRwfVqwgKQxfrik/JCRopWoqJDRr9Hg6OgQZmFYOGKdBzSUw3+QKr3fDB?= =?iso-8859-1?q?sbKyrnY7B2Ps6SZlGoNiCn0ZULCc7dUAxRXdvMhyX7wDZN3XCZuVrP5SmuiL?= =?iso-8859-1?q?urRhn23KExJu7uMrexHsWPOrWljaoyiKwZjNbiwcbfHlE3axVIuqmRwiv6Ba?= =?iso-8859-1?q?28WX7jaIFKYc1wwRIUnY1/cYGMqQPzz32KdO5jY2UVMNXTw6mhHRF6SKGehY?= =?iso-8859-1?q?b+XMWxkXC4ogwatJamjSfdZ7tlSJXEGP460OadkVAyXOVeOZnuBl8jvsm2Is?= =?iso-8859-1?q?18UZDEdpSu8Ck5PbHg/nPI6hH6PUXKZTelMTLaiIj7wV/61ctYTCyMud7Zs0?= =?iso-8859-1?q?VPK8noSJw05fAZNhYoHQtGFOPk5Cjfrjt4FN2OvZCNAvLkx+ChOnJ7ajLgQa?= =?iso-8859-1?q?SFaJHNUZnYVynlnDXyoJ3cOs5RVFAZdplaeUAZ2ue5jWgevxYrowbG/+lNVY?= =?iso-8859-1?q?l1TrE5/5JbnkMBgVy2mmCJ00vhe8aEPF7aPvLovfcw2MOHKjk0upErEQKVC8?= =?iso-8859-1?q?hMCE74VmzK3CYYhChm00jFeXHgBayKG5NbhkV9FZWMFDwymBAwRqgumd6E0N?= =?iso-8859-1?q?zVHXiN674JaiAsTtbpycc4iyql4X+yu4hr4t6LK8nKpWFspYq6grK8MQEHfl?= =?iso-8859-1?q?JNXEa4bL03W9PtaBqOy+MJsH6qt5ZY++PHhIRzgahIJCYZfflnHhi883I9NO?= =?iso-8859-1?q?YFUAhD/uEDA9HT2ycZp7k9RJ4snA0N/edvPMgOfznbvwdPF2aA6GxkXLOEsC?= =?iso-8859-1?q?KBD0Q9llckMGOuQHEbt96Q1py/rG2B+ntoqxIxRpQU6l9jyW7GWfjFCHTFda?= =?iso-8859-1?q?jUuG5G4Dt4ysWnoMqG775fUA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?XvsbFcorvPpWxKHYxAlFfC4?= =?iso-8859-1?q?Ae8uAyufzyNns9tpeP981I7BSU4VcxosL0Ck7pA50qR+i6/KJXRziolPMvQp?= =?iso-8859-1?q?s/04OvlNMugc18+bIuJkLWeBOYJP9+FtMhm0vx0bThXYVac4fqSZ7nP5EW45?= =?iso-8859-1?q?nSNpFEbYVpOsiL3EFCs4i+SC6SXFCiL4yGn0y/wS8KURyiqCmqOLFbNY4tUQ?= =?iso-8859-1?q?BqZhld/KG/J+zdMleV1GqxmOYCBGm6VgqH0daNAu3PgP1cuJq9X+eBqjhfQB?= =?iso-8859-1?q?Yea7VyQ7wY3keD4i6X1thqFpTlDRtUjkA0DYuq7a66IWJ6lRLlx6Hc8NQC+K?= =?iso-8859-1?q?V8BHXrbeezyHcFK5jyaPrh/D13FrhDUtt5UZZKJkEu/bDOgiLslNMUI7ge+s?= =?iso-8859-1?q?0O0juuZIB+UY2Vceigh9AsJFWDcSRCM9eUAa8bIQlE+/LxSmOdR3LZ2CkhEv?= =?iso-8859-1?q?qnN3MolS1QkFe/6shJ9nGlj7ZwPNrnkZF+bSVUMgsPeYl9YGfGfLf0TZZjQh?= =?iso-8859-1?q?ygiCHpPeVN9VJzwYvfHVJ+wR7z45Jaa6x0IDdNo7vbWxq/x0QiUv0DE0AX8/?= =?iso-8859-1?q?BUdw9o2qu/21biHIf+UPYiVkC6WjFP+67rDrokQVRyNoDHcTtT3AFF7J/9jx?= =?iso-8859-1?q?Vb3vyXJ6LN1UOi1/D2gg+EFjYrIUut59sR6vvfB+2Ia36QnpGovlLugGKfAQ?= =?iso-8859-1?q?XV9xBZahsuLx/0Ucbp1heTQImt4wzMUYxwgaNRJ54V+gf5NQ4dV1t278EjSY?= =?iso-8859-1?q?09rub+82o/tTcYnelQ8ouK28UibZVc7F2gz0m/FstkhW2Z7ZZFbMmSJIMBhD?= =?iso-8859-1?q?t+II1PXf9d/jczFMN8j4pYub7NwSmuzaPLFyt3V2N0bO3napU8rmAbw7Qe/s?= =?iso-8859-1?q?uz4exdCTFaEkT3ABKdw6Ai4y3XhxKvQF2HhI/mmD6kv2RA/CFHm63ZyTemZK?= =?iso-8859-1?q?7cQH2y2Q27HPa77pUmzH2/1gMOKWu5UGoOhAzzYIfyXDK7kZM/n01s2vr271?= =?iso-8859-1?q?gIURpKqFR9ov7LUFHUa09Mn6e9glPWRYpDuUfl7uqB4QPGejspvyHkhdNjbd?= =?iso-8859-1?q?MLvMOlNfrd3NEQNyDTXqJWLjzc/Zi/a3MKOH9fMLZXarrG8rKkY5IgHvyTaF?= =?iso-8859-1?q?ziOQYyHmwcco6dIH+0+y4LNag88lWMzRLKjAPucq1Pm5x4vtGcqmUWdgAJC7?= =?iso-8859-1?q?e/JLPI82mMeC22Ry0oUg0MrICiZMVej2+5+FVR9tmvTsn0GMl9n+RBQo0DiE?= =?iso-8859-1?q?hQoEApqkfONBbfeHs8GXwcTAIpFepzXCA3JV2ZZBW4DY/eWm0PZhW5STHjiW?= =?iso-8859-1?q?Yf3cPg27RT9Yr5s8V+cUFP31pEnr2vWIgAdDbtwkMbuDKaw3FmEfqtMV4TKP?= =?iso-8859-1?q?Ajb6u8aj2VDqcTbQ9Cb2OXD34XLLnT+32FOXo29QwAruMzA3zJVOp7ca/77Q?= =?iso-8859-1?q?TPE4rC4a+epUqXIrYjFAkilgVVFNQ42CkI5djN5NR11VNH5g6Cjur9wg8Vpr?= =?iso-8859-1?q?0eoKlgwmReaOfUDYM3QFfVKhxtEFPIudlYk+RL9imLFk9L/zbGzcgZZzxXfO?= =?iso-8859-1?q?8/SFuPauUjYSvTCnCxC1+Bp4nsrpl1PRsgd+z3xbPLjSaA1v9xofwm6O+e1+?= =?iso-8859-1?q?wDpmV2sFmhcrk6KhyyzDqc7q6Jy+WgLeaq+xnWw=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sGyK4qF//1QrwwTLcPdf62MoIguDviySQaePQZSzsxCOSKgpWxVSx+Uxq2i1ijpgXD+RVTLBNJEbtYS/i1bwWJ2hcHudN+LwG+UEOFuMhHkaMXGMQC1z48hHPJl/GkDIhnDOcxaVdRCgwN8b74uoNoxjjlhDrrOUpC25D+f0zriGmUD4O0UQzStu6CwnawNcrn3ZfnL9hLcounXXbx+XGLLDeD9eMQ6ccMk7lQWLDfAJlVM39TDO9+6s3/LV/FJoZBlScJ/di0Rv1lNLjIF5hftKsyW1I20cv9WVms0vWKDsIjljmCZjLojiAMDF6zQkXh1ynbuTTK9kLGcqgVcM6AvMy66ibRrJNChew22eR8cpdwAK3O3cQ+tD8HKtfF5JqiRdyNc2T3IkyifKA7hluH3akVXTk5EvcPjDYXwuZpbnHgH3eOHf0uoyBnaZUwB7S+QVxHLLLt2BOj6RUiADLfUog0tKtJcw7ZABZ5lelFhJzekIULX3gVVcQTogOD/X+Rd2w37eqVwFo5KA20yXmzsSf3braBkeqxrZhJV94qqJ76uWSds7bNdfwTHGQDczyBrc3q0kZ2kBOAbDnP5VNC3wVaI5N7klB7TMCknjE9DdF27SclwmdY140Z2LvQc2KfapNwAHNRt1e6vLExC/UQ== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 642e1116-0710-4eeb-a4b6-08dd197b4576 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:32:19.3279 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Q/WMuUo+f70BZznufch+xVKfcgC072XIja2IUktdBxa09qYitp5EdXzwVtOAphKvqmsP0hrbtxljOIQkqR+tLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7691 X-Authority-Analysis: v=2.4 cv=Z9YWHGRA c=1 sm=1 tr=0 ts=6758dd98 cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=MxBP6jBeIhJ25oVtBTAA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-ORIG-GUID: PiVbKDDQE5teq-EqR5JkW39rJDj4ocGC X-Proofpoint-GUID: PiVbKDDQE5teq-EqR5JkW39rJDj4ocGC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 adultscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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 --- drivers/usb/gadget/function/f_tcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 4fd56ae056a3..1c93f07daa7b 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1724,7 +1724,7 @@ static struct usb_endpoint_descriptor uasp_ss_bi_desc = { static struct usb_ss_ep_comp_descriptor uasp_bi_ep_comp_desc = { .bLength = sizeof(uasp_bi_ep_comp_desc), .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, - .bMaxBurst = 0, + .bMaxBurst = 15, .bmAttributes = UASP_SS_EP_COMP_LOG_STREAMS, .wBytesPerInterval = 0, }; @@ -1732,7 +1732,7 @@ static struct usb_ss_ep_comp_descriptor uasp_bi_ep_comp_desc = { static struct usb_ss_ep_comp_descriptor bot_bi_ep_comp_desc = { .bLength = sizeof(bot_bi_ep_comp_desc), .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, - .bMaxBurst = 0, + .bMaxBurst = 15, }; static struct usb_endpoint_descriptor uasp_bo_desc = { @@ -1767,12 +1767,14 @@ static struct usb_endpoint_descriptor uasp_ss_bo_desc = { static struct usb_ss_ep_comp_descriptor uasp_bo_ep_comp_desc = { .bLength = sizeof(uasp_bo_ep_comp_desc), .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, + .bMaxBurst = 15, .bmAttributes = UASP_SS_EP_COMP_LOG_STREAMS, }; static struct usb_ss_ep_comp_descriptor bot_bo_ep_comp_desc = { .bLength = sizeof(bot_bo_ep_comp_desc), .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, + .bMaxBurst = 15, }; static struct usb_endpoint_descriptor uasp_status_desc = { From patchwork Wed Dec 11 00:32:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849692 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8E7811CAF for ; Wed, 11 Dec 2024 00:32:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877161; cv=fail; b=L3XHTatjPvf6Is+WwaSe0q4YtiB2JDlF2PD6FeCEcjwXvirIoqEAdNjPgPyKA98WBwH0E/8V4pLDbsaWww4lvNM+lcxut/l0vauKMpGjWPC1YerEmmhgcmviLr2uwXy1k8+abWVx+9zIEWhHztXudBuPVtceeAfW9ZCW9wZbdMk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877161; c=relaxed/simple; bh=fAYeKuswwk8CWWN5neXlVnMxMswBcm8yoZfb0JX3JxA=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=j6hiwR8Iqi0g5v20zDcytvgy1N2xfGKymWDU0J96idMWFGuxKzFnlcRO9LaTeBh5B7Kv9i5buhL8iRfiiDA7A2TlHuTOHdl6Vv/wLIJ2hhlbcNqL6+G9oUusybOPHlNP5zSSOv7Kg+MkPpk8QBQld4/LcjmXHK78wDW1lmlSRGw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=dcJ1KICL; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=PiA8ONTk; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=CZmb6flA reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="dcJ1KICL"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="PiA8ONTk"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="CZmb6flA" Received: from pps.filterd (m0098572.ppops.net [127.0.0.1]) by mx0b-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAM3rVb000519; Tue, 10 Dec 2024 16:32:36 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=Pn3Y5dWVLqyySaQTBEIxR7YkNlmL9LyJ79G08YFYd28=; b=dcJ1KICL+iCm +dBRb3ji4bCSWdmGbjST8obYLScoVi89WbcNbuGj7YzK27PMbSCXrQGt+FiHxWwb XouKsZKCjLHTfp15H9XZ2EL2SO2PpmmAsM7/lfD8hvNGQvrQ9QpWJ1Cy/NkJwuYd JDdRqf+3LkKvSpP0E/je6hEXhxl32uJ4Jmi/tckNiGl50L8bdbiPt/ju3cedRAFb HE9CXsXL/fLpkAuKMuXZ5h05qEjip71QF1TDBaXSu9WXvTpWu2AgWkbqu7pPjeFL dlg3x6wtwQbgdua+l+mYECFZG+3TK7oCM0eQJD6l/5vkv21+kMG+nHJPmOMk9FGr 410OVvnpkw== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0b-00230701.pphosted.com (PPS) with ESMTPS id 43cnvka156-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:32:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877154; bh=fAYeKuswwk8CWWN5neXlVnMxMswBcm8yoZfb0JX3JxA=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=PiA8ONTkmzElsFyg+czUxn/Ycxu3O/kRgFs/82e6aotuT0cR3wmI8AOD8QzzoInMM RU4qBOIdFxpvzzIz2FO5ZgZAFx6xhlYE39tgrgTzwUee+9kSPDAN4zdaZj6tzh5Ewl cjOBKNGeNRZ2ychaakXKUBLGR9XvDoiH5dN8rNgpv/+9bkjPD99KhqH0bIIuRZ2DFu lOTjk0aZ/m0URj8JWFEKc1QBV6VCdHkUp6Meog+ZqxY1DQJjPQ3nkid7B1i6Q76213 IK031Kjcujx4YF0jJ4SNsrf5crDIBJvYVKydn9GDEzdWovgG+ITp+OiTDAr6zGRkwg TkpATIqWbExhA== Received: from mailhost.synopsys.com (badc-mailhost4.synopsys.com [10.192.0.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 8C27440126; Wed, 11 Dec 2024 00:32:34 +0000 (UTC) Received: from o365relay-in.synopsys.com (sv2-o365relay1.synopsys.com [10.202.1.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 1AD3FA005E; Wed, 11 Dec 2024 00:32:34 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=CZmb6flA; dkim-atps=neutral Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id DCE95401EF; Wed, 11 Dec 2024 00:32:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SLC+F33h3hY7zkNsuHF4UcVoUGr2jhE4NY94flPe8vAbgYjVs7fu+0MEwRM4aYdzmhcbbxOwc3Nj2m2cEnA70I6cc081MasptEnJhNStgsA9PEu5cpxAOu8irTQdjgE6jj1g3Wsega7xRHk8m69bTIpnWbeH1q3lL/7hOxJ5NdMOmZj6cKJgUpsxzCPF3ZgJ/qPXA5KAs0AjulGOkAG2Gljvsz6cu+e32yeYkdRcnEF1CSjbyUbWXAAd2wsKbaAaXe3Lmfq91sHpjTwnzOEJphcNH1cfqMwjUPDCKxfjoigjOctP7VdK9Lw6OEOUBwRDj4+BCbwS1x9L7HojEWZNDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Pn3Y5dWVLqyySaQTBEIxR7YkNlmL9LyJ79G08YFYd28=; b=RzraxKwq6k19WKPtK723efLSp33jYUfLPuBCW86KjjFYYL8+E2MC1hb19KTZSR4w/U5J/0fpHS+yrKaVRgMtfA/aBc9SA6mmOuzYp0GQi9uGrl7jpzl8m0DQGPiyTYFrMpEHBYxF4F792FcOCNe1PiNPuccS4FU3F40z8IDVGJ6V26GMMEJ0qMQ7TzYE77Ate1zuqbE5C9bt+Q7pfR7goL2+iDaEZjN0vCTjP5yba8ZNoaQRLFfzGFg4b96CglZJZsGdCsFg/uJ2ZpA1/QNoxqYdkn17nCg5kRJReNSJfaAi3SDKHCr0XcvH8imZmci1lOTTlei4NBv9JnZzftYmVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Pn3Y5dWVLqyySaQTBEIxR7YkNlmL9LyJ79G08YFYd28=; b=CZmb6flAcMKBOk7gbXPKrWvj2kpJSl30PCHMZX/YbVUNMoFtzExqcqTUCqnNSRF310gwJuc3jMWGhK5wwECi6N5f017Ekt0kcwAzXUlyDP99b/rx/QCG2PWlpFU8pjJOH21yvPXbBFVT2wuaVP3SNBdBzwSbuDzBv9l/DRFK2UM= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CH3PR12MB7691.namprd12.prod.outlook.com (2603:10b6:610:151::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Wed, 11 Dec 2024 00:32:31 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:32:31 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 10/28] usb: gadget: f_tcm: Get stream by sbitmap number Thread-Topic: [PATCH v3 10/28] usb: gadget: f_tcm: Get stream by sbitmap number Thread-Index: AQHbS2Qq1ekOkVqun0y/WCDmHzhqTQ== Date: Wed, 11 Dec 2024 00:32:31 +0000 Message-ID: <169f67261162c16342bc8543db93c259b05ead0b.1733876548.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CH3PR12MB7691:EE_ x-ms-office365-filtering-correlation-id: a176251a-9eef-4fb0-cffc-08dd197b4c9d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?iv/jt04l4N/dhQGXD0HVcRPveZ?= =?iso-8859-1?q?/fqy/ismf4zM2aVROni/ihaQOBsAYmqcV9KUthQ4hcIsQ3PAcCI5X79moHHP?= =?iso-8859-1?q?zYCEZVPFThwDi1a5Y8/YuGdSBn49BUMb5Z5Sg/Kqi6ce3eSwQcO8kllcOe5V?= =?iso-8859-1?q?YlvFkdwqhnmGI9KD/8kCLULJwLRafUWV8FP/J+oXyoitmKIdKdkw5Ln65063?= =?iso-8859-1?q?d457dNO2DgQe+vV5T09pmESqEk04dzO8o4SIvKRDPtFVcyVk4IYL3e0VllQo?= =?iso-8859-1?q?zVscl84GWZuaKvkSxd/sdq7ffXwzHUSnWK15jfNXazai3ifvXxoEx4tzROSo?= =?iso-8859-1?q?LwYOoLxrU18HeOummXU65oaVjkvPMyYxPwXFoYvmjn4iwpX8tufpZgcGZ4m8?= =?iso-8859-1?q?rlR84jM3DnZBZ5xGh/I5qixb3FL8XjYYR626RTmI3gGDgb8U0SnNNrcgsmQB?= =?iso-8859-1?q?Z3+WJuaAzscEHIPbLehgXRoUfr5q31puKUH1LUrWhNi+6chXbyV5zEK/xwgU?= =?iso-8859-1?q?aDNnBEIx0stPeA/OU5fMjp3WhwYRQkXAVtYk8QjzTawDeBsC5LIDhRSnNmc1?= =?iso-8859-1?q?jiZrIryf/0OOa1ytGNBC62+rlBvpTJKisc9nxNoyJVEXuyiIgm8AdplltF+a?= =?iso-8859-1?q?ULkfN9grkqH34i5eOaOclCFZNKaCPJ0RhG7DRnwSU8qhoX8rnWzzn0yZXzSu?= =?iso-8859-1?q?Cvch2V0yXh6Z7aC+0hhJKQYUNunP1xPEak4WDFSwBRVjXwAgIUsfe7KZNn32?= =?iso-8859-1?q?JEkAe6UkSTVvVvNpSqIZEgdsqNetc9Ao7EgrAB8fDjIkF41+TrNrWdZohpi0?= =?iso-8859-1?q?kVZiXKNo04ZNd1Aa5LVtnrSqEax8oeIh7/1PRNQNKkXKQe3lDLIUq7BnzwSf?= =?iso-8859-1?q?xGzFHDh7bwh7ZzRl7T6l/uJFqnKWqqSmEJeDOl4twmzYXmq30L75wEGP0BWU?= =?iso-8859-1?q?VPzn+vR18xVbJS4S9m0VCT22bjwPAadKEpjWJPiSYiIVgJtaWY5n9kLgSiMQ?= =?iso-8859-1?q?vtHbpD5numZYmXorJLYiPgsdRjvQb+HFE/mTiZOHu5f3OPwgA7B3R5u5V/fe?= =?iso-8859-1?q?SllDFrAJ4ozZ7+4gX0FrJct48dYwXOiY2SvXfh09fx3/PSfthJwYNvDNlLtk?= =?iso-8859-1?q?JkyZ6W+KJNuW01U4Iugj/WIhzP+xYIyrlBq9hfjb1ZPbDsJa0d29AqPkft23?= =?iso-8859-1?q?rXBodMMZ2xdePlvRMfWLExqKFwk72tM3uP4FTarmfL0fmHZz5048neEEdABp?= =?iso-8859-1?q?c5rD1bJWQduMdyNY6RDH+MsKRV5gCFtqqFwvrR7mtwcEZB1QHcwfKCflT+vo?= =?iso-8859-1?q?pLniAvRgg3aoMuHE8RtE6QVgflXLgMMahQDerwv6GiElF22M7022499aX0Ir?= =?iso-8859-1?q?uTn0x5biSO2W64/ofvljFCAukxs6h3oCIEy/KRfjJV2FG8YPRxT3Gb0mch/T?= =?iso-8859-1?q?LSf+ccuDKxvFaic8z+sFWVqA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?qH9RTCV3QbwaNSPHOGZ7Asb?= =?iso-8859-1?q?B5UA0xaSEKaA6eTFplxzbp9w9NpvUmAnBO7BzwcREbXwHOTjGwgWmV16likJ?= =?iso-8859-1?q?DvPFJVe4QA/Hh33YHcg2W0XERozakkBP3rd7naZDoQgCfekYAVZ0w/jcmPaw?= =?iso-8859-1?q?Bj10RdPUHGDC2/1gaqrUrYgZ4XYwxR0XTkVaxR4vFgRA3P9m+V+BXM4svtFz?= =?iso-8859-1?q?p5vLllxkC5tq6wiCEcwG6hfggq4SePz9cbLcJh+BPsj9eOwhAKaFISZqE0Rq?= =?iso-8859-1?q?coj9SUpZUzRqz1COuDUCL52HXVx+trTUp+DYeb7pUie2Vx0TbIXSBXaY5eIU?= =?iso-8859-1?q?EXKcsCEqRW2P/Yr3ozyxZACwMJt0KkGVX9hThr0PBxhtZCD7hlZWCFasx98I?= =?iso-8859-1?q?rGcHbCjQ6GaUAD6EaLUS+dJoJuzdy9vByxLuP4A+rCyD6kKPHFgnbol2S2XX?= =?iso-8859-1?q?9zf+Q/217KNMezO+9PMAu1fwjf+LZixHC30031TwTYIKs3wyQSn2PgXutCWA?= =?iso-8859-1?q?Peu+8kjFo66E7u52/t787komvWu2vhYsU7IV/I7fmTfZJ8WRSriufozGGzAS?= =?iso-8859-1?q?37l2/LkljLDGdxLPC/ByYolgl/vf58blBKEwD984FKWQ7NnAoi/Jcl3R96oV?= =?iso-8859-1?q?mH+929X7t4/72ZY+vo3KXM0/JwQZW4LL+cMJr+LR6qpPIrqMBR2BomNb9hse?= =?iso-8859-1?q?j0PiOMUedfvNQThKJteqyLXcUAcJJeRhel8ptc4zfnvCb/t2M3pnTocTpg64?= =?iso-8859-1?q?NJ9C/7+hDB7bsUmQk77ZR+iPxNnqG/ZQ5h6xpw+x05jzVZUuC93+j8Q/A1tq?= =?iso-8859-1?q?oiatMpz6Lkwb16mdLrBmRae6CXiJ7CdwHwuo/5aeB1BKj6JXBuPevQ1dIdlF?= =?iso-8859-1?q?k1sDJXVBkT2y6gxIPh9io4GxklMPIh+Df2eC/BJNBoeFdrsMSFlsCP147dLe?= =?iso-8859-1?q?s/AirpomVp1nHLd/hIAeoX07trY+LnBc7+LvgCdhbxfDemdqxAal4a9Wu3v3?= =?iso-8859-1?q?3zJmoAMRbe4qbs50HjhszYeRYs3OdOSq/sCI3UEZj8Cby4AiSgxVtdgKG/2g?= =?iso-8859-1?q?Ych4bUQd93+QTrjKLAtgBtUqaDm2FoGkWA6wsXRWraidXiAA0m+BP82a/KiB?= =?iso-8859-1?q?Rk6IL1MFGPwckWWLlo9hyhuSa/kn+iKToEB0VApGBJp1oIXbNfAJ/wo30guq?= =?iso-8859-1?q?HzeenJe1nJ6nqJDpLTHJpUO+VvsZjfD4q8GnUTII8YQuv9CFmNjZhkczgd/g?= =?iso-8859-1?q?XYqRC21i5QzloCWmXdQIynOYeSjserts7JNZv72ENVgErU8zogscmjfIuO43?= =?iso-8859-1?q?MVK6iypdgQAQGyabWPv4d35i8Wu82/oxZZUEpxa0lKROZH9JUPcQ+s1E5J06?= =?iso-8859-1?q?AOMlAJvTLU+rcrDzv23g+GIzUJ8TzHmWkp66aOTiyGIuOSmaKn0BLijIDsf4?= =?iso-8859-1?q?aZy/QjO2HbAAhLwJD0547U/+zgu5XJbZo75mmRxFopMqf9+Uc9l2sYrv6Uxv?= =?iso-8859-1?q?zOLwJgpmqhe3RkpwE+XvJp/gpHuDbyX+DPgUU0Ej2Bg4fF6bTUpWBKc56+E2?= =?iso-8859-1?q?2/hik4fG65LQiub5k+7lPwHWkXKiztus2yqJyImmmaWG7zU9K1iyUJiirr8m?= =?iso-8859-1?q?sqxYIRNcY6by5QZbDEFFwFIjUr9Vn6gAmOvOPGw=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: /kH1IxmISgrr0KnGLA8aI2nWpL3ZFh63Up3vD9DVNY2elZI1f4xc3+Zxqj2K9Dh0EooZXExWrwhxlsEzI/DgtzXyMhehCmDTtuVbt/in9bVRdH6Ut5tIn2z9gRXlsK+t7zFy047Di86OLZHK5pRZTxDVW53UvX/MSLES6d3ff8HvAWVq8BJc0LvSSrbX1Xoy1Y1wn+UbK7TdDcbCTWm5mTdpQ5LidyxSWiHZgZW/mtYSMROV4CG7CyUQhtPIjU6wU6gxz35W5E4ZqHO91uwr5AF+NsuNSsq6BB9T9AdFMGYF+6R1vH2ktHFMfxJP68XZnAHiwP+dkuGy/HcTLHwUpK24mAXVg2gBJjiPerX8q6ogbCF4C+3nE1mNSmxkhlbstybZxfnGCI3rhOJLzE4efgsdgqtCElr93A/wxzaf5auED/aBiADkg6zVW0t7DBoc2plpy1vau242hRZHkYlssBDhFQDENhu4wNffESUjfXb53qz3p7d3m+rSHS2dGMn6RTJnoXzYsS/tggIfLQYgQhiJ+EX7X8A5lEI60t/gCa4RsJ8aa32c9ZsXRV7/EHXZf7wuTLxH+Y5tO3q7EISLrywLFcTFnHNUF5IFZHxX2KFM34o0B3trcP5Jm64U/S4fOUYRGu/XKXhYhBNjiVn2Xw== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a176251a-9eef-4fb0-cffc-08dd197b4c9d X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:32:31.3305 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 2rzZjNHQhOw4RvIfMgtGI2tTmdkzuq44bR0wcU9IyaiCpsp+x2aYRBRYDqXyMQwrx8/3UcAvvkpUu+BDKa6SMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7691 X-Authority-Analysis: v=2.4 cv=fNPD3Yae c=1 sm=1 tr=0 ts=6758dda3 cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=W-950U-e_TmYsRHEapIA:9 a=wPNLvfGTeEIA:10 a=VI-E8fl1FWJz5TsTLJMq:22 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-ORIG-GUID: J3AuuaqicM7KJ-uTNZ7rRxciCblL5tL6 X-Proofpoint-GUID: J3AuuaqicM7KJ-uTNZ7rRxciCblL5tL6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=999 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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 --- drivers/usb/gadget/function/f_tcm.c | 26 ++++++-------------------- drivers/usb/gadget/function/tcm.h | 1 - 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 1c93f07daa7b..a908bbd04b09 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -491,7 +491,7 @@ static int uasp_prepare_r_request(struct usbg_cmd *cmd) struct se_cmd *se_cmd = &cmd->se_cmd; struct f_uas *fu = cmd->fu; struct usb_gadget *gadget = fuas_to_gadget(fu); - struct uas_stream *stream = cmd->stream; + struct uas_stream *stream = &fu->stream[se_cmd->map_tag]; if (!gadget->sg_supported) { cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC); @@ -523,7 +523,7 @@ static void uasp_prepare_status(struct usbg_cmd *cmd) { struct se_cmd *se_cmd = &cmd->se_cmd; struct sense_iu *iu = &cmd->sense_iu; - struct uas_stream *stream = cmd->stream; + struct uas_stream *stream = &cmd->fu->stream[se_cmd->map_tag]; cmd->state = UASP_QUEUE_COMMAND; iu->iu_id = IU_ID_STATUS; @@ -544,8 +544,8 @@ static void uasp_prepare_status(struct usbg_cmd *cmd) static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) { struct usbg_cmd *cmd = req->context; - struct uas_stream *stream = cmd->stream; struct f_uas *fu = cmd->fu; + struct uas_stream *stream = &fu->stream[cmd->se_cmd.map_tag]; int ret; if (req->status < 0) @@ -595,7 +595,7 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) static int uasp_send_status_response(struct usbg_cmd *cmd) { struct f_uas *fu = cmd->fu; - struct uas_stream *stream = cmd->stream; + struct uas_stream *stream = &fu->stream[cmd->se_cmd.map_tag]; struct sense_iu *iu = &cmd->sense_iu; iu->tag = cpu_to_be16(cmd->tag); @@ -609,7 +609,7 @@ static int uasp_send_status_response(struct usbg_cmd *cmd) static int uasp_send_read_response(struct usbg_cmd *cmd) { struct f_uas *fu = cmd->fu; - struct uas_stream *stream = cmd->stream; + struct uas_stream *stream = &fu->stream[cmd->se_cmd.map_tag]; struct sense_iu *iu = &cmd->sense_iu; int ret; @@ -653,7 +653,7 @@ static int uasp_send_write_request(struct usbg_cmd *cmd) { struct f_uas *fu = cmd->fu; struct se_cmd *se_cmd = &cmd->se_cmd; - struct uas_stream *stream = cmd->stream; + struct uas_stream *stream = &fu->stream[se_cmd->map_tag]; struct sense_iu *iu = &cmd->sense_iu; int ret; @@ -1104,17 +1104,6 @@ static int usbg_submit_command(struct f_uas *fu, } memcpy(cmd->cmd_buf, cmd_iu->cdb, cmd_len); - if (fu->flags & USBG_USE_STREAMS) { - if (cmd->tag > UASP_SS_EP_COMP_NUM_STREAMS) - goto err; - if (!cmd->tag) - cmd->stream = &fu->stream[0]; - else - cmd->stream = &fu->stream[cmd->tag - 1]; - } else { - cmd->stream = &fu->stream[0]; - } - switch (cmd_iu->prio_attr & 0x7) { case UAS_HEAD_TAG: cmd->prio_attr = TCM_HEAD_TAG; @@ -1140,9 +1129,6 @@ static int usbg_submit_command(struct f_uas *fu, queue_work(tpg->workqueue, &cmd->work); return 0; -err: - usbg_release_cmd(&cmd->se_cmd); - return -EINVAL; } static void bot_cmd_work(struct work_struct *work) diff --git a/drivers/usb/gadget/function/tcm.h b/drivers/usb/gadget/function/tcm.h index 385bc2cdefb6..cf469c19eaca 100644 --- a/drivers/usb/gadget/function/tcm.h +++ b/drivers/usb/gadget/function/tcm.h @@ -80,7 +80,6 @@ struct usbg_cmd { u16 prio_attr; struct sense_iu sense_iu; enum uas_state state; - struct uas_stream *stream; /* BOT only */ __le32 bot_tag; From patchwork Wed Dec 11 00:32:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849691 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B51DBE573 for ; Wed, 11 Dec 2024 00:32:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877174; cv=fail; b=eetrSW/wxyUnP3F0kiCtYV3wIs70NGt84FRAvDiVAiYPUJQrGHfWnL1jRXzonKqLyIKCJef7iwK1usll1MiAiGfFqcn5vmNv+df3Et7q7sqe8xzSfZOGtVW+csRPHuz47w/PU3GGTfzwmphazYI5Ld7pyp1Xy9PllRlHGCsSiV4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877174; c=relaxed/simple; bh=s+Y1wqh4PMvPM77pGrBUQc5l04AS9w+OIbxssKROCmU=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=jBrgbx7WhskdYILrgcgwXs37H4AB5GiEgbil/FdwDTvXm6/lUKGgXIEtIiIQZtoiMP0znJ+sHm04aEE5Ng+i8cSldf3jrx5RqNXnPIHLyL0LZebTk8hMjq+FmXdruEjbsTMShCpXFefIcT1YhhPr4WyVzxOktr73tWfNjRT5Dmc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=ujIZCTW+; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=QHrslhrC; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=UzQBCcWv reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="ujIZCTW+"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="QHrslhrC"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="UzQBCcWv" Received: from pps.filterd (m0297265.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAM3qEJ017428; Tue, 10 Dec 2024 16:32:49 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=/vUPAoV4Z+6LjBwFiK0/lfi8/ExrWD54nkRrG+y0MMo=; b=ujIZCTW+u6nQ UDKxewSmLdjdRInDo0Sq0fZIh9pPMjM5/L8uCkRiaYIMV2TwVtScoTJCVeaL3RdT HsnECbXH33EZpPzsTFnrgbE29/e8jBnPihzBQY6OIntXXgItcfaLmynpSxCPw1vq FCJEx831ECG4WxsnOGbyuUnA30X8HCvDXxl7T7+gY+EOr6rGGhsL/d6ijuUM5PfQ 82J7a7G6pVVqvXX6K0G4rxClFBU+mgibwuv597iIoMuQcHtTGA23Ss3Z4pWUyRdK FtpaPFDhcd4ljs+zBwcVyZ08z+KykilXfObuvh8bW1/VxOk7YBZEzNl6NMe9UzCi LJTRBUTnEA== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cp60t116-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877167; bh=s+Y1wqh4PMvPM77pGrBUQc5l04AS9w+OIbxssKROCmU=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=QHrslhrCxkIVcNaT/L5rFT1J296YwuIkzPiCq+AWJaYwa6BiVRVo23yoJqDgx315l 0HI5X0XV+wmXv0oZP45A2yHsDUsrK7/snJQxrrvtb78R3Y52ZMO1nY5lgtekEQAGAK zB/5UlztVHiBVle8hmvWoxYDY3HpaKFK5f1ovpH5tV+8eRmwFJxVjB4f1cJKHXsfMM 11XJr5XbEylnqo7eOgcLu9dwm36IuhkxFYbTDe9hG4bcjEryJxjvVbixtBJ91kcrzV JyXKMSBf2Z4rFrYGtof2OpZEBvzSWyEFfAzgkzaZlhTqy3bzAgX+T8hbA1oTQuUSPQ QON0ZIXKtzzRg== Received: from mailhost.synopsys.com (us03-mailhost1.synopsys.com [10.4.17.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 59E0540126; Wed, 11 Dec 2024 00:32:47 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay3.synopsys.com [10.4.161.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 20B0AA0082; Wed, 11 Dec 2024 00:32:47 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=UzQBCcWv; dkim-atps=neutral Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2047.outbound.protection.outlook.com [104.47.51.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id B4BD34041D; Wed, 11 Dec 2024 00:32:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AKMQCFX7Lhf5dakIJ4ZQzp/80q+/dI9Jjvl5309zgDCrpzp4HFY2sNP36EjXK0vJoWQVpxTTvFzqdhU23t/hIlKV4aNskYorWX31DOvP8eTWn6QkhKmBEm1kIUmrbgAp22ylttZIH60CF7Ax6ORmAFV0Bfy+JMmTvwzQEXk9dTy5Aybf6qRaNVUY1t/fWLl7JLMj3mmwcKuJoCSgkt6EJ/vPmzxxuhhImBI9PRDFKeAjibPQxc7zSYEK4iceeNBqRpK3GP8X/wpnryX5wpOqUKrAOXqD1y7CaIl0enbNW9cJ1B6Q2sVpyS+ZI9wP5rc9rjBqWVprBXZQgKaW8rI8SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/vUPAoV4Z+6LjBwFiK0/lfi8/ExrWD54nkRrG+y0MMo=; b=d0HcNIXRPlwZYsj+YDM6XYQrBmzT3CmeZSGMFjTjdnibPM1CdkUb55ge6pCjai4SJR+5ZTx/OOeb2saim8zKOPVqfeqLgIe8jbGPLL/DFrPhE25QDuRrz2MVRSsYMvh6OhpBowjK+KkhKSUwTM3m+7+onWur1wEU6zVzmYRGdgvzWz8lJAStZQ97m8w97T9hdtHXDiN+i+PeV38rO1PPX+X2thQKksbGUdGLNuUt5VjmaSR3ITpKHaz+R/YVX+cAu8Cx55tUucEODZ5swuROipVuxDo3l7XqpBL8k3813uyr7fAIEnEWTSIebh+lOWU/8xYUTwLqeZIYA+oY7cj2yA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/vUPAoV4Z+6LjBwFiK0/lfi8/ExrWD54nkRrG+y0MMo=; b=UzQBCcWvjQ41/dxqw54IwfPIsZ48PGYXW5aUHCLNhqxAk2MDAkvudCikWpCdtvxA0kIPTJgIguFNuGRQQvJ1hNJWCwl16rcOh2euwSXYdOsSq3lXnGDPy6MOQsBE8AI9v5JhTIk8w2k/MsyxWjDIpjvjmwb2Zhb0IJokFzeQARk= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:32:43 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:32:43 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 12/28] usb: gadget: f_tcm: Allocate matching number of commands to streams Thread-Topic: [PATCH v3 12/28] usb: gadget: f_tcm: Allocate matching number of commands to streams Thread-Index: AQHbS2QxFqD4F+Za4USHnh777XmgSA== Date: Wed, 11 Dec 2024 00:32:43 +0000 Message-ID: <2d806120dcc10c88fef21865b7bc1d2b6604fe42.1733876548.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: 218d645d-814b-4e4b-5c9d-08dd197b53ce x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?Pj7b5fxNzIcvnXxEqykAxjTtX5?= =?iso-8859-1?q?NM5x1ysDXVF6RmXCrq4uWzhhVWwXnD4SRnGcUXgJq8OaUPPg1vdLXvsVWlgG?= =?iso-8859-1?q?/U92iHwPYB2Xn9APYLSJaifDO4dAk7F6YY8W7aBGYLdLH1/bDGDB4GJwmbKy?= =?iso-8859-1?q?Ti8ryhR3evNZfdThQfo+LwljxTu3x2/HOq8fL+JYjEF6DLVFQ2Mx4INXByas?= =?iso-8859-1?q?zp7ga9d+qsXkrKpFzwEwovnRvKx7oq2oy/H6qsYgJmEeL2ZdvtYTk6aVZSwd?= =?iso-8859-1?q?2wnFhTHfVU2dlLbnFhBWZpL8QeM0hzQbj5f8aws7jWqXx8HDmMTlSWdqkiYP?= =?iso-8859-1?q?xen/4tq9gUqXYchVeGLWu6yxefhJeBOLLjHyjxQraCHJI3x0ToD4oGtGJG6y?= =?iso-8859-1?q?OY1soiCv2AvvaODQi7DQGYRi5TLRlWlsCIpQJveKbknfwtXLQRd1CjqSGRJW?= =?iso-8859-1?q?FMKiPJP96HsKsk8QTnIc44nconnxaU/G+ZfuMDqza0eC57eM290z/J20r1Tu?= =?iso-8859-1?q?htPeignCFCLXpb7NR2bs0mNN2REltDJjv4VdblA+4oPvtVcFNsgW8QJWXq7H?= =?iso-8859-1?q?L+UZLI8IYTvXdxFvCFN94VGPzicrCTjAVVLhgis+o9KXZ8jiQdI07gFCTIv5?= =?iso-8859-1?q?m3/THoi+TDcmSJvjrW/d7N818tO54MH6iT2fGTI2ZFYwpv4AeswosylB8Cr3?= =?iso-8859-1?q?kpLKvLjzjIQwZzSI4+QfW+UsKM3MQ6iH1tdr0yrLn+lYGVjLAKSZOVVnfgk7?= =?iso-8859-1?q?D3kckcg9Vgu1Rbs+hW8v+z9JNZLeVfKHxaQ/6nNFJ6ZxkPCwLnoiAFsoDx9+?= =?iso-8859-1?q?osZi2nTrfv7Au3+FRD0ngtAfzPAEHXh+Q3VHYx3DHS9ZDacs6PVpl1y2kiJd?= =?iso-8859-1?q?+iskiQ7jel8H/VguTI+a+GIqxFabCPP3+YCZ9P7m8JeFMO1mKhZO07SSzI36?= =?iso-8859-1?q?Shjz16egYAbeaFptTT9Y+w2sf0jRMN81MqBdJL3Gg2Xo3r1k3xzaL8hv2yHP?= =?iso-8859-1?q?cAxRIpzb2Vh7m3mYZxlvcjLtbYBcdqhj27nOKsq1cQuC80+ik0x1YJbwQilf?= =?iso-8859-1?q?zflJoxhrrH3rdn6uXIcEp7X9f5JLF/E2hcUsH9cg7igY3a5ATUrcj7p8E4Kg?= =?iso-8859-1?q?yJz8JrJHldF5NXBsJ3+pzc7tiDpECOZAzxrERRHZ3E2lysmNwa+2z+B+9AK3?= =?iso-8859-1?q?mEwrmdodcagKBtuV6K8lzT5FIpJQmVYTwjl9N3jZ8NXzKhhyP7/4o0fTUqzw?= =?iso-8859-1?q?nlAKa9jmspPAhUs/8xdVz5A/qSCi9UUx80Xq7OooqJROQp2psylwL7TNKXt/?= =?iso-8859-1?q?aRne1Zo0SFHx+8pJF2UY0xMRzm22fTGOwZ/oLw6g4sGFXNP1lOhYx7+l7PY2?= =?iso-8859-1?q?ZZm7GWsxDei9J+3zPLcjvZgmiInFU2FG3bQRv6IexQTEy+gmXnxF6PisHiYx?= =?iso-8859-1?q?Y80DVZRMMqTm/lCtKvAPMkNA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?6FYSCP9JTmp7X1e7qsEd8rL?= =?iso-8859-1?q?xga7QSBXRAaBM86cid4MzT3wcXbVBC0OsrytDRToefRKiCraECMwoQ7q5jES?= =?iso-8859-1?q?atwjEQEdIh2ci95rsflx7dp9NohaQrmWgBxWAXgQpTK30ZJrgc4/KLGT0erU?= =?iso-8859-1?q?l/nbP0fSP9RgzzolxbV6TYCS/5CUizKuK+Dtne84YyygmLJmvrgacKnzv4xk?= =?iso-8859-1?q?uFIef0ZuAeZJtBrgehZNYrbYaXu2hOKHDf1b5oU/ovwV2XH36JfPVR1e5Qao?= =?iso-8859-1?q?ovnozq6Phx7fGGhqIfDZFZ8/6x2glXz4g1gABkeU3HwS3R6so1eDsA1Uxfrt?= =?iso-8859-1?q?yMwQDPYIJqE1OgH4yjDNq/mAX+dyVjdzUTnnPI1V3a3GyfQinbD1SBCsV61i?= =?iso-8859-1?q?FEjSVbMyBMKRgbYMRZ67TjAv/niooupSUsoMjHBkCGMMxmNavD/54zfve5F3?= =?iso-8859-1?q?4LC9DIvmRGWCrmffHCZURgV6WpiVNGz2DkBwVMF5cMpu1KlEDKmBUl8zGV1t?= =?iso-8859-1?q?tu1n/bribYiPJXq5phm7+KLhzPVAoheQxwlXlT1pHQmxWhRXNtxvQiUC9c0s?= =?iso-8859-1?q?zCdZx6UrCi/8Y8VB2kLycJb7+LRnq3T2W6sbclsXBG8CktnxYdS5jqBnilMN?= =?iso-8859-1?q?D1WecSsZxlezD6kl0cPtG1kKNGCSqHGF5+Np3JqxcbVXFHQW8qAHSvVxVFI/?= =?iso-8859-1?q?hhOHHSgsHje+bh06Dymui7Ax0x7uaA9Uyt3K//dHDFG3EFWKKCt45Py4NUNu?= =?iso-8859-1?q?Q9Y/lJZ5WSzJeSu1JtswNL0ILckEsqWQoFMnQZnVSUk40SCXh3uYay1A/ln7?= =?iso-8859-1?q?bil7Yql6Onc+AV6lDUy90lPuaHzc+tHUNqYG2O1tj0l0RVmeUuwvY0yynvxP?= =?iso-8859-1?q?loK/tq3ZqBHzYDwCy6+mhqdrPtWIHpI1hAFhi2pPMwTyMjAv3OlQzYj7EgnJ?= =?iso-8859-1?q?Z4H88USIax439ZfMy+sEA+H+vgmXAVnr/RXdXyns0/6PGsKr/g8Y7cGaxxTy?= =?iso-8859-1?q?kJM1dH9SG7AGMmCfwyJVyNAXWQzX3D81aK4LsGM4yhKqtt0JaGRmuJPpRiSp?= =?iso-8859-1?q?gggTdfMio8ZYaTKx7I2HpslrG/XkWYxLFXRkdlncrgKo3NXrmCSplHVxeU0s?= =?iso-8859-1?q?MkmOnMtACGw0MFKxq+Lb2+S10RjPdqqanKp2z0XGNzeVk2F+o3TPu89/rnM7?= =?iso-8859-1?q?zJhL/kfRjcC7DhmIi1B0kXqo2OXN9RTpgrKzjgoelsaUi/Vk5qkZ3FcagHC9?= =?iso-8859-1?q?C2LURP0xjwclcGZmBQBtRXJg6zXWBsQZC3/UDulRtLh1OyRYzzOp6FasxCyz?= =?iso-8859-1?q?oqIKso4gjRRmk2OUJ9RW5qRl1Uis3hkHD0uC8hd3EEy3ubm2UnSWtorvARNM?= =?iso-8859-1?q?uaY8ThtiOB4jONaunP5RodeaHWipioNkUnWJxajUGoxlIW+zm0KjJu33Tb3a?= =?iso-8859-1?q?SmLGM2rEO+Q6BT5B4QyGkfZCfXfw6zLvT6ZvmbG0L/BjobbUXGvsR0NkuZeR?= =?iso-8859-1?q?aoBQN0dXVxORgWyyGf8xckeh9y+Mfby8kau+hc7j5BMAEeZyRhF5m4y0R/sD?= =?iso-8859-1?q?di3aMv5fyU8J8QCnLhOumimDPwpBKYuXTU+0cXyPT5SBelvx/sQI9IYi+MvV?= =?iso-8859-1?q?uPNG9LgKLpr5KwXkaMQjrLsUJTnXc8XpV6OsZYw=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: PWdeFQ/aDG3R9duIx55NLYHFOkF5M+nAX93sR+m+vCsr/9n3i2EBOKevktDWATH9Z9lDU7Ryx9Tls20QFF8DK/3XwaADeXczDAzoDzSjIUb3yxKLkxPn3Ik7i9vU0xRecgDP3q6WhMHToi3KmKvNZkaCw6Zrbtt9VIQj/spNDnysDghlA+qozY+e6vjlxer9HbYreu/cqhqllP5gpfpY/NmSaneZKwgBUMVzHvRKQ5+7p8kq7hz9y5ZV0WbF+E6bIZMM/VCk6LzUbODdL8XIoxE138O3dKF2o/5ltprsp1lJUiSYqGJmlUgNu1qm+tGVEDtMP04cE0gMtU+YNcgtYRnZ64x+jh7HBeu68ZJbI8o9kqIPfypc7Qj2wJrzHtfyHANq7JzU5WWPDD7iIdDQFNv+AVMYLROCN+pvm1DSvTX7Ivrk/pwaXTxk6XqidfxVPhxOJNkC24pS9C2aL2BXIRNGVKDi2F681cwdaiGY650XGoWJKhqIEX72nTelXZESSMRM5n+dwSG8ThawH45xRwS1V1mNfTeZi7EjGy2kzfXAF10a1uakvA9VoGikDLS3Iaqe1isxCe3x88Xi4knjAYS1PVawk0SI6mpCgYldEHIGq/kPrCts3/vCA0VpNhOR9eJl0sCm7nh/YKzOsqpMxQ== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 218d645d-814b-4e4b-5c9d-08dd197b53ce X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:32:43.4129 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NNByvbLIVWACrCE9CZdt33zvll7ss07CEgka8s+fvMy22aMKNbpUAgAISjk1v3IiflySamUjxSGiVpxHgeGl5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=Z9YWHGRA c=1 sm=1 tr=0 ts=6758ddb0 cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=TH2HjKJD5bRpUVrW1iQA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-ORIG-GUID: 7zAkdcjPjJ2HbHXkHpn1--I4O96J-JY6 X-Proofpoint-GUID: 7zAkdcjPjJ2HbHXkHpn1--I4O96J-JY6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 adultscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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 --- drivers/usb/gadget/function/f_tcm.c | 107 ++++++++++++++-------------- drivers/usb/gadget/function/tcm.h | 10 ++- 2 files changed, 61 insertions(+), 56 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index a594ed1359fc..a3e886294c40 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -50,7 +50,7 @@ static int bot_enqueue_cmd_cbw(struct f_uas *fu) if (fu->flags & USBG_BOT_CMD_PEND) return 0; - ret = usb_ep_queue(fu->ep_out, fu->cmd.req, GFP_ATOMIC); + ret = usb_ep_queue(fu->ep_out, fu->cmd[0].req, GFP_ATOMIC); if (!ret) fu->flags |= USBG_BOT_CMD_PEND; return ret; @@ -136,7 +136,7 @@ static void bot_send_bad_status(struct usbg_cmd *cmd) } req->complete = bot_err_compl; req->context = cmd; - req->buf = fu->cmd.buf; + req->buf = fu->cmd[0].buf; usb_ep_queue(ep, req, GFP_KERNEL); } else { bot_enqueue_sense_code(fu, cmd); @@ -297,8 +297,8 @@ static int bot_prepare_reqs(struct f_uas *fu) if (!fu->bot_req_out) goto err_out; - fu->cmd.req = usb_ep_alloc_request(fu->ep_out, GFP_KERNEL); - if (!fu->cmd.req) + fu->cmd[0].req = usb_ep_alloc_request(fu->ep_out, GFP_KERNEL); + if (!fu->cmd[0].req) goto err_cmd; fu->bot_status.req = usb_ep_alloc_request(fu->ep_in, GFP_KERNEL); @@ -310,27 +310,27 @@ static int bot_prepare_reqs(struct f_uas *fu) fu->bot_status.req->complete = bot_status_complete; fu->bot_status.csw.Signature = cpu_to_le32(US_BULK_CS_SIGN); - fu->cmd.buf = kmalloc(fu->ep_out->maxpacket, GFP_KERNEL); - if (!fu->cmd.buf) + fu->cmd[0].buf = kmalloc(fu->ep_out->maxpacket, GFP_KERNEL); + if (!fu->cmd[0].buf) goto err_buf; - fu->cmd.req->complete = bot_cmd_complete; - fu->cmd.req->buf = fu->cmd.buf; - fu->cmd.req->length = fu->ep_out->maxpacket; - fu->cmd.req->context = fu; + fu->cmd[0].req->complete = bot_cmd_complete; + fu->cmd[0].req->buf = fu->cmd[0].buf; + fu->cmd[0].req->length = fu->ep_out->maxpacket; + fu->cmd[0].req->context = fu; ret = bot_enqueue_cmd_cbw(fu); if (ret) goto err_queue; return 0; err_queue: - kfree(fu->cmd.buf); - fu->cmd.buf = NULL; + kfree(fu->cmd[0].buf); + fu->cmd[0].buf = NULL; err_buf: usb_ep_free_request(fu->ep_in, fu->bot_status.req); err_sts: - usb_ep_free_request(fu->ep_out, fu->cmd.req); - fu->cmd.req = NULL; + usb_ep_free_request(fu->ep_out, fu->cmd[0].req); + fu->cmd[0].req = NULL; err_cmd: usb_ep_free_request(fu->ep_out, fu->bot_req_out); fu->bot_req_out = NULL; @@ -355,16 +355,16 @@ static void bot_cleanup_old_alt(struct f_uas *fu) usb_ep_free_request(fu->ep_in, fu->bot_req_in); usb_ep_free_request(fu->ep_out, fu->bot_req_out); - usb_ep_free_request(fu->ep_out, fu->cmd.req); + usb_ep_free_request(fu->ep_out, fu->cmd[0].req); usb_ep_free_request(fu->ep_in, fu->bot_status.req); - kfree(fu->cmd.buf); + kfree(fu->cmd[0].buf); fu->bot_req_in = NULL; fu->bot_req_out = NULL; - fu->cmd.req = NULL; + fu->cmd[0].req = NULL; fu->bot_status.req = NULL; - fu->cmd.buf = NULL; + fu->cmd[0].buf = NULL; } static void bot_set_alt(struct f_uas *fu) @@ -461,10 +461,14 @@ static void uasp_cleanup_one_stream(struct f_uas *fu, struct uas_stream *stream) static void uasp_free_cmdreq(struct f_uas *fu) { - usb_ep_free_request(fu->ep_cmd, fu->cmd.req); - kfree(fu->cmd.buf); - fu->cmd.req = NULL; - fu->cmd.buf = NULL; + int i; + + for (i = 0; i < USBG_NUM_CMDS; i++) { + usb_ep_free_request(fu->ep_cmd, fu->cmd[i].req); + kfree(fu->cmd[i].buf); + fu->cmd[i].req = NULL; + fu->cmd[i].buf = NULL; + } } static void uasp_cleanup_old_alt(struct f_uas *fu) @@ -479,7 +483,7 @@ static void uasp_cleanup_old_alt(struct f_uas *fu) usb_ep_disable(fu->ep_status); usb_ep_disable(fu->ep_cmd); - for (i = 0; i < UASP_SS_EP_COMP_NUM_STREAMS; i++) + for (i = 0; i < USBG_NUM_CMDS; i++) uasp_cleanup_one_stream(fu, &fu->stream[i]); uasp_free_cmdreq(fu); } @@ -582,7 +586,8 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) case UASP_QUEUE_COMMAND: transport_generic_free_cmd(&cmd->se_cmd, 0); - usb_ep_queue(fu->ep_cmd, fu->cmd.req, GFP_ATOMIC); + usb_ep_queue(fu->ep_cmd, cmd->req, GFP_ATOMIC); + break; default: @@ -697,7 +702,7 @@ static int uasp_send_write_request(struct usbg_cmd *cmd) return ret; } -static int usbg_submit_command(struct f_uas *, void *, unsigned int); +static int usbg_submit_command(struct f_uas *, struct usb_request *); static void uasp_cmd_complete(struct usb_ep *ep, struct usb_request *req) { @@ -707,7 +712,7 @@ static void uasp_cmd_complete(struct usb_ep *ep, struct usb_request *req) if (req->status < 0) return; - ret = usbg_submit_command(fu, req->buf, req->actual); + ret = usbg_submit_command(fu, req); /* * Once we tune for performance enqueue the command req here again so * we can receive a second command while we processing this one. Pay @@ -716,7 +721,7 @@ static void uasp_cmd_complete(struct usb_ep *ep, struct usb_request *req) */ if (!ret) return; - usb_ep_queue(fu->ep_cmd, fu->cmd.req, GFP_ATOMIC); + usb_ep_queue(fu->ep_cmd, req, GFP_ATOMIC); } static int uasp_alloc_stream_res(struct f_uas *fu, struct uas_stream *stream) @@ -745,24 +750,24 @@ static int uasp_alloc_stream_res(struct f_uas *fu, struct uas_stream *stream) return -ENOMEM; } -static int uasp_alloc_cmd(struct f_uas *fu) +static int uasp_alloc_cmd(struct f_uas *fu, int i) { - fu->cmd.req = usb_ep_alloc_request(fu->ep_cmd, GFP_KERNEL); - if (!fu->cmd.req) + fu->cmd[i].req = usb_ep_alloc_request(fu->ep_cmd, GFP_KERNEL); + if (!fu->cmd[i].req) goto err; - fu->cmd.buf = kmalloc(fu->ep_cmd->maxpacket, GFP_KERNEL); - if (!fu->cmd.buf) + fu->cmd[i].buf = kmalloc(fu->ep_cmd->maxpacket, GFP_KERNEL); + if (!fu->cmd[i].buf) goto err_buf; - fu->cmd.req->complete = uasp_cmd_complete; - fu->cmd.req->buf = fu->cmd.buf; - fu->cmd.req->length = fu->ep_cmd->maxpacket; - fu->cmd.req->context = fu; + fu->cmd[i].req->complete = uasp_cmd_complete; + fu->cmd[i].req->buf = fu->cmd[i].buf; + fu->cmd[i].req->length = fu->ep_cmd->maxpacket; + fu->cmd[i].req->context = fu; return 0; err_buf: - usb_ep_free_request(fu->ep_cmd, fu->cmd.req); + usb_ep_free_request(fu->ep_cmd, fu->cmd[i].req); err: return -ENOMEM; } @@ -771,26 +776,22 @@ static int uasp_prepare_reqs(struct f_uas *fu) { int ret; int i; - int max_streams; - - if (fu->flags & USBG_USE_STREAMS) - max_streams = UASP_SS_EP_COMP_NUM_STREAMS; - else - max_streams = 1; - for (i = 0; i < max_streams; i++) { + for (i = 0; i < USBG_NUM_CMDS; i++) { ret = uasp_alloc_stream_res(fu, &fu->stream[i]); if (ret) goto err_cleanup; } - ret = uasp_alloc_cmd(fu); - if (ret) - goto err_free_stream; + for (i = 0; i < USBG_NUM_CMDS; i++) { + ret = uasp_alloc_cmd(fu, i); + if (ret) + goto err_free_stream; - ret = usb_ep_queue(fu->ep_cmd, fu->cmd.req, GFP_ATOMIC); - if (ret) - goto err_free_stream; + ret = usb_ep_queue(fu->ep_cmd, fu->cmd[i].req, GFP_ATOMIC); + if (ret) + goto err_free_stream; + } return 0; @@ -1060,10 +1061,9 @@ static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu, static void usbg_release_cmd(struct se_cmd *); -static int usbg_submit_command(struct f_uas *fu, - void *cmdbuf, unsigned int len) +static int usbg_submit_command(struct f_uas *fu, struct usb_request *req) { - struct command_iu *cmd_iu = cmdbuf; + struct command_iu *cmd_iu = req->buf; struct usbg_cmd *cmd; struct usbg_tpg *tpg = fu->tpg; struct tcm_usbg_nexus *tv_nexus; @@ -1113,6 +1113,7 @@ static int usbg_submit_command(struct f_uas *fu, } cmd->unpacked_lun = scsilun_to_int(&cmd_iu->lun); + cmd->req = req; INIT_WORK(&cmd->work, usbg_cmd_work); queue_work(tpg->workqueue, &cmd->work); diff --git a/drivers/usb/gadget/function/tcm.h b/drivers/usb/gadget/function/tcm.h index cf469c19eaca..cd8d06419d5f 100644 --- a/drivers/usb/gadget/function/tcm.h +++ b/drivers/usb/gadget/function/tcm.h @@ -16,6 +16,8 @@ #define UASP_SS_EP_COMP_LOG_STREAMS 5 #define UASP_SS_EP_COMP_NUM_STREAMS (1 << UASP_SS_EP_COMP_LOG_STREAMS) +#define USBG_NUM_CMDS UASP_SS_EP_COMP_NUM_STREAMS + enum { USB_G_STR_INT_UAS = 0, USB_G_STR_INT_BBB, @@ -24,7 +26,7 @@ enum { #define USB_G_ALT_INT_BBB 0 #define USB_G_ALT_INT_UAS 1 -#define USB_G_DEFAULT_SESSION_TAGS UASP_SS_EP_COMP_NUM_STREAMS +#define USB_G_DEFAULT_SESSION_TAGS USBG_NUM_CMDS struct tcm_usbg_nexus { struct se_session *tvn_se_sess; @@ -75,6 +77,8 @@ struct usbg_cmd { struct completion write_complete; struct kref ref; + struct usb_request *req; + /* UAS only */ u16 tag; u16 prio_attr; @@ -116,14 +120,14 @@ struct f_uas { #define USBG_IS_BOT (1 << 3) #define USBG_BOT_CMD_PEND (1 << 4) - struct usbg_cdb cmd; + struct usbg_cdb cmd[USBG_NUM_CMDS]; struct usb_ep *ep_in; struct usb_ep *ep_out; /* UAS */ struct usb_ep *ep_status; struct usb_ep *ep_cmd; - struct uas_stream stream[UASP_SS_EP_COMP_NUM_STREAMS]; + struct uas_stream stream[USBG_NUM_CMDS]; /* BOT */ struct bot_status bot_status; From patchwork Wed Dec 11 00:32:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849690 Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C606C8494 for ; Wed, 11 Dec 2024 00:33:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.156.19 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877185; cv=fail; b=Kzow9pSp34TpelIBwWVp2bUkk+RmrTfonq4K5O/09CowZ+oaCLVajo8RQi1akKsoEVod+P94jbNAZpWIow6XoJf3Sf0YV6lwlmVA/mtf41lM+Rwy2aN5Tz1o7PU7b54wp50BSoPW31fcOJjMs4Gx1N3r5gW1+OtZzSoQ/UnHZ00= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877185; c=relaxed/simple; bh=0fx+SRMyzKxxo9CO5A76Ok9xSR5EnWE5hqDPm7nxU14=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=lQ779wg79/aSu1SHHdFE2ZmfcJZdXk+5N0YyMa5diYVtFIo3vK8zF3I3N0CXpZ8IPIFxYOOpA4RX41CWBDgmJ8nTpqXrxK3/YBU66AyA3KyU2Opf345UDNHbE6j0+yMPWsO0EIrK9jxZ5jOqFh16Uw6Bbd91M7JvIExHoi2zOLM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=LvV2akBx; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=Uw2IZSzG; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=OBhv+STA reason="signature verification failed"; arc=fail smtp.client-ip=148.163.156.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="LvV2akBx"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="Uw2IZSzG"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="OBhv+STA" Received: from pps.filterd (m0297266.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAMVk5v010832; Tue, 10 Dec 2024 16:32:59 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=8Bv1tBnG1SyZ8ix4xy59Ksw+STI4cVhg+BbSg/TVKq0=; b=LvV2akBxIbF0 vCyhUihqkHfw4DECaPV73UZt4ibOhD+o7DvA3neFepIHrnjo8Eb25qxGOkSh5gTg SOs7rPYnSD5SHInf1gDk+vN+jUuPehjBwzbzFZ0VMZr93rt7R8icHr6OVLmmC7Db GHYZ/bbxmVgSzkYFF9y8aar7KTeZel1uDOftS3wsC1EDeGz6V2/ijJca+Jz6Ll7J ETJ4ZUR2xA9oCQum5snhaA0aUb7H65WDh+m4GncGlp4yHFe+KfhKj77HjioN3IcJ 4mPc5NnkV+yBQGj9PrRcqIXQq2FOUfInXlNrC2z8/OtPH9T7LpyJTZqe2rI/i1eO MqS726839A== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cpgb9pxp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:32:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877178; bh=0fx+SRMyzKxxo9CO5A76Ok9xSR5EnWE5hqDPm7nxU14=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=Uw2IZSzGe4ROXRmLLU7vkhMVl2Ic3JYoxL1O3vhGGo8/4IXE9U+fD6wovI95NWTuK z++x7yWPpJbhhfhwMkvgziNi33d4LDDU3194Yf9jCgGmu6RBM+7uZ8p08NNs44mENA CRxTC3e/zmAoM1/0NrndnT5BQRf7xYx6SctCSsGkN6uE333h4YnpzFcWoFHKPGLYop XjGQdjLuEgl6mK9PVjURLDDlcBlHnY0H5/lI4Xc6rRs4onfiI78hCUiOSk59u7ZSCx 2pxbkyGqSmFnhmK+SJvJ1mhUjhhJ0m/b9XzOWo3wXxPU6Cl79Ee6oXhn7iy/zu/A9t EUdNN/0kCRQeQ== Received: from mailhost.synopsys.com (badc-mailhost3.synopsys.com [10.192.0.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id AE62940593; Wed, 11 Dec 2024 00:32:58 +0000 (UTC) Received: from o365relay-in.synopsys.com (sv2-o365relay1.synopsys.com [10.202.1.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 7EDD7A0068; Wed, 11 Dec 2024 00:32:58 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=OBhv+STA; dkim-atps=neutral Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2177.outbound.protection.outlook.com [104.47.73.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 37F67401EF; Wed, 11 Dec 2024 00:32:58 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jKDW6C71p5ZLYS/K4NrdqOMgUkMNiR/RTtD21hwbqh3JuSPdksYn1xwgWWGOqME7SOqYZnEc0DRqfzLQ7Mw73SiuxD7XOnGCbOywpsYIdzMc0fa6p92kittaCrsGTUx4izL4bRn5up3ko2iVGCuOX1r4/hotonfaG7VVdsH/2diCcVhaV0tSHZYQ+Ce/DYDGr4xeJWEmOqTrOUE71iyX0G9n5iPejuGDazSvfcBMhEkmikfptHIqeNa9o3qYSs2zI1MwyF7zFHegETAXBn/p8JLPv6cxxx19s9BKxjHXGSC9ykP781p+1mYQrDuRVl1kSxjnUW41i8WECI14LHRppA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8Bv1tBnG1SyZ8ix4xy59Ksw+STI4cVhg+BbSg/TVKq0=; b=ZVISBL1wBf8g60h4pP0zyAqQaLDDKBetYBmNJZoFKGqY5RDiL6PvaVDeoyYnWNZ29Af8BtjynXkUuL9NW3Tk8lmQwnD8eFJUX6t2l0Gn6Wrjy+I3epjO21klnFAXsj83d06r73ArCoeTq42j39VJIaIa55wC4uN+mWULPzScLASLhPIWksx6fDvTv7jIwpuYnXtdxgSrFpdZuIHl01hVKNpBdK1/g8ZOpbHpwcTpo6k/oEHacmhapZK4vrXYOeIoHTHM3CJEx7cOerNjPrhArF6esE3wHgZbJ5+Os68e7F4HN8yV2Gr9vnHoiQ+JkJpMieG4VLEd3R7U5tPZ8kLHCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8Bv1tBnG1SyZ8ix4xy59Ksw+STI4cVhg+BbSg/TVKq0=; b=OBhv+STAPKicYf/ObypjL9JVBaqCsqisigtZhV4ifkuTBoTVXyPlLRAjNEJoDpwkB2dB0sGE+4rLGGSTt46U3YIdu2EV0fWQuWCxc4zh+41reJH6KYBndRrMVjIJxpzYRchqZRcL4P4rw5PI7/OMirfiMnyzPFWY1VgimoFAhOs= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:32:55 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:32:55 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 14/28] usb: gadget: f_tcm: Use extra number of commands Thread-Topic: [PATCH v3 14/28] usb: gadget: f_tcm: Use extra number of commands Thread-Index: AQHbS2Q4FnDID5Kh7USAYQZK7+RvqA== Date: Wed, 11 Dec 2024 00:32:55 +0000 Message-ID: <256f2ec8f5e042ab692d9593144fa75f3d3ce94b.1733876548.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: e31e769a-9b29-42ec-8e86-08dd197b5ae9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?tykEZclPwwZ3B8Ga39muqaP6PK?= =?iso-8859-1?q?Lv4GyDGy7Gif31Ck3/43vHNb7Fv69tS68SqyLMGInmUFSB46Pm3RqVIii73J?= =?iso-8859-1?q?R0pEoh6e3MDbulN98sYC/vfQN5cWP3jd2jPFMty8+QQyXHhmAaiMg+axzWS2?= =?iso-8859-1?q?Humc/nsLChgbbFYcSuGJH5sIaUHgf/KmcY5fT1QbOR2N0Clpn99bcj1AW3Q/?= =?iso-8859-1?q?stA3AjjI1AwX0PrZGcpYYVOFGxcKtrtMzjwv64qaHB5R0dF3vAP9rpAsguho?= =?iso-8859-1?q?Bunwm8ZqTKMds9MS3C5XJUbMneQzlsOXs9gYJvbD4vjnVf11brJpSqZINmsQ?= =?iso-8859-1?q?0IBvHoBnvw1AC+bPoA+EJtzoRNbN7Au3BK1tsMCazrpj5a6bNqdyeUlwM67Q?= =?iso-8859-1?q?H+0F6sJM6N7kb7phoUEY+jrQelOw+PrUv2DQJJWdjLBKvX6kDvbwnxMw+KXb?= =?iso-8859-1?q?+jn0Cq4hJIGAi+IcGRr3KGBri2mYEIUpudOMu5NJ2205AlXgq6FyDxQVxSzL?= =?iso-8859-1?q?eU7QaF+zWAzWbMUj8uUfG7ld9m18zedy4OQFPebAA33u+D7NmwB0yAWLN5wp?= =?iso-8859-1?q?SfLCeUa0Ox8TL14Q1+dosMU3IH/2OaX7on/FmXP/AGuqgQbynO7oU7CAey21?= =?iso-8859-1?q?kpEjWE+VI+E805EKIDq7JTYG6wQO4AXMfFcYJRF4kkXUr2ZZ/G6Tpikp4Ny9?= =?iso-8859-1?q?992flqofHRMAXeVwbdgVWwPuE/+hisGP/dJvIwcIQCSvpyHh9nU2yr6C97aD?= =?iso-8859-1?q?sOgYCKi7Df4QpC3eGaQ5sJkScdpobihAvBgie7+kWMDZYbHZRU4V3VpaUOLa?= =?iso-8859-1?q?arPLXttzNXWgLQ6FdEllXD1rwBOmfn96PgnxUnNXw3+8zE4Tto8Xb9akoXWT?= =?iso-8859-1?q?KRv3NEWBRErwNDvBfMqJ6bCQAqinZl22GgfACOiu9BDjg8ioMhMrVeNQ08xW?= =?iso-8859-1?q?5e3uWc1CM7+l4eqJ5C2uin1lx+PBSbTHZRqQChw+kF3M6CXGc/RR+6NwTVi0?= =?iso-8859-1?q?ML5fZsSYYKx5objom7j8tA8FLagQhy7inPK71/AfTAiUuBj/P2NKrwuO3eSN?= =?iso-8859-1?q?LO6COrMru46YloyH04S5N5jBIoJpp34HLs06k6VvEGdTnMOtPsLb8tVbahgN?= =?iso-8859-1?q?Pr4mzuKPjV8WvadGrr15sDVrPpDN0VJCn828KHOdBVsWwRkLBv3fhH179cVt?= =?iso-8859-1?q?9md/ePVkwaDZJoie7kIQmGLmbT3vPit0VexFrwrDd3So2/CdI/RmJ3Rr6Afh?= =?iso-8859-1?q?ZefPoNCfgh5fpprxVnrZHDjyAWvOB6itME51+EIxb+Ej9kecgKVOYambVWbJ?= =?iso-8859-1?q?xr7mtmCPasNI4Mzi47BW3x9aRJoEl0aePdd77IbkLTVCYwqDw+qVfaC6veQE?= =?iso-8859-1?q?3QIKr+mSu9Bn09Q5AYAxhelig9mbtQgqq2kwaob4DLiwWulHh2LsTo1Qr/ij?= =?iso-8859-1?q?pBRDSSN0tquoEyVz50GOLiag=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?kiIu7/l6C1AONyN7un1ybct?= =?iso-8859-1?q?pxyE6oNX3Rfl4MkydcvWWpTzjvqsXh5Fqr/wngibindXPy7dHhcpW/vZC0tU?= =?iso-8859-1?q?SgdCowJa3HVZT6K3PZZS9RclKB1F7fRKZBhuYpaZUKkDns9pS9A6eE5Zr3Sh?= =?iso-8859-1?q?m8NSVD0dNrRGsWl1zEelYeTX8+FnfmC/sLFhufGOI2LFs36w3xh76S8EhG/I?= =?iso-8859-1?q?+RV5rkcIgswbpoGbCI6eIk0t6iPRae/fXe8T7e1gIGbmj4SqfE5T3qAXZ/df?= =?iso-8859-1?q?1AxulPeIHMD5ia4mucVZa0LWxqplGSvwbVd2RKqNWKxnDMYdigwCUsDW81GA?= =?iso-8859-1?q?DJKGld7i0mJWZsWkbhxSEUZM11jN1XQKuOIKDwyH7+QeaxdW6fa3+RePQbBb?= =?iso-8859-1?q?TL9pxxpdPQ3YqizDHHFtrB4aF1zG64bgEFpfQczQwYdtbBUyEqCuABBAQHBC?= =?iso-8859-1?q?sUo2+wc1UQFWUj4AZPoxaqljDDTWJR78ngC4x0Ef6U2IzPH4OpdC11dxpdpD?= =?iso-8859-1?q?iuu789HHuPCoIEoz5TeLNOsF/F3l1jPb3EPvKx+vW68x8FaC1VL4DI0iZVCo?= =?iso-8859-1?q?NcwVxpypI5XcOj8YkOCFzCWgN6jcjGdVv4D2gBt7RrIKOCyeif+NAVcHa4/0?= =?iso-8859-1?q?35hXsAAVg3TZgTawIGONoQ8xFC8MwmpHerDYhtkxgz9i8jFlU8wiA28uJw7c?= =?iso-8859-1?q?nQ6BCTmlkd63cGOPcAVN2f9a7TlNbrSaOQ1YQfYNBQsdf8/3udzFQpuEDUYO?= =?iso-8859-1?q?/Zh1+5e/Ty/0i4+E+Bcf8tCWHTX91Rw5Fnl0OPlmdEMiLFgwmosoRxar9yEf?= =?iso-8859-1?q?/sESSUuP5vx64jkbmXKegKdZO7V03wA3pc9WI5+QCEyHpxCm5z+K2tmtzXJG?= =?iso-8859-1?q?h7HSaeo8Igovq5fzT4N1SVQxEqzvcy6Cs22mzutOUG8XifKnCwkqT0dLjfDM?= =?iso-8859-1?q?+b/S0MkxKOtluS75b1ywrdUA3gNUl1qvLlgT21+bocGMUE1JTszWRBJhJnUg?= =?iso-8859-1?q?+A4W22rot5MYs5Q7s7T4ZNI0DvbYYj4RYtdjI6FlAOP3CDNxVisdgVrIigsM?= =?iso-8859-1?q?jKippwPxtMXZ7KhKJ9yBgDmCpNW4m5T4bC28+f3EXPVFe14fG/wZTLiRHdBV?= =?iso-8859-1?q?axRLPFUHyoQQVnB/MA8npWNjXz9FntT+TcDYYgSdCvz2AN4I0QDLYwAvQc7R?= =?iso-8859-1?q?dzI56dcIA9VNxx8DSbzYantDAbGbYm3GKDu5xibn4DZcGa1y1fhnlzonaCxW?= =?iso-8859-1?q?S15pk/CKZxVsy8lOHK3bMSPbEu7rU6nvp0q1WX2LtMoZtC6OPfh/u3ZRw9AH?= =?iso-8859-1?q?rgG6RNluAtoa2vwYjYNsQF+W9Pgug8JS7kza1wJ36JF6MVV1P6e8jOD3M25E?= =?iso-8859-1?q?rY29C5z4jWcysXGCWrea7akehu/3ziezMzkS1Orqn4dQdJ7g/4i9782ykjof?= =?iso-8859-1?q?WKXpsnFMEezEvTSAK30cg4mKXYtC47HQqu/OzVG2sw6P5EtIhHvPzjjw3uhx?= =?iso-8859-1?q?c7DC9Ax8d998n4Pz0WGEnbF7xUdT2UdxHrTle15fa9a3s5L0N4zJ1SvxpWKt?= =?iso-8859-1?q?EqUCc1BJzaxFM5m8gXIz7R32sbK3fyo4jD7kh9CLNzdvVNr3yoPhVdpgrSUs?= =?iso-8859-1?q?bVhoy5fYX3TFDXA8Xyq+yrQlPdu74+6ox1/MKrA=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ePNlvcnli4csyYgjZBC6pQwkX/43dpF5FAnEgKfvL5iwjf7doSNP3ZK8LdcTC1H+Hcdt/UEdrVJTg4nclx6J2nJfeqBHnu2j3yRHL0TyPL3kUjq6cEs8wXX+Hf20tsz0+mBuXyWHEuFY4x/gOJMuyELrZrUf1hIFHfIOcOad/91ewMTZYmuUu3eqvEP/DvZhqfU0bFbq2UkjHXqEXpdNpjX33Cigvrx9s0U7HmBi8LuOnt4hRNonpOP3n9QDoSrhQ+pCYJgZ5aCD4Pj2eRYt8BufbfyQFFk7TE6TRkzImEPbnAxwFSqkNnv5eYncStU8OaKp+rSivvEvG9VQI5bQZboAk3JSkppjTNq10LlUN0co95YrH50xtvyxAvyBRpPsBPSJeyYj2Xw2e6jgxfTuCSilVWbZbweDNH/VHxyxbzKeWngamFYcQJNSTflUPIc3U3+eVcr/dzVDsf+3XJqUt5A3cx2Oieaiw+3V1G3M2j03scoQi/3wklRsJLQTYp7yPX47elhus+CgcKq2cVKUnrhco/myzTDogV2L1yux82N99yidlbx5UjXmb9W6YcjKOW5ZV8OsJqMBCl8gCwHsr8Gs+vMYFHdbOcVAOkj4Izwa8LbKbAYKJC7B/WYbB/BwMUrzA0nlPHauOagZYMC60w== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e31e769a-9b29-42ec-8e86-08dd197b5ae9 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:32:55.2787 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hr1oz6kC+sSn7BiR255gpB2pjiZqAtwmdYOiKOeT2PzxOVGpft6JpVNALcMO1rhLrP/MfUIfWP6js8JuJuTbKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=d+8PyQjE c=1 sm=1 tr=0 ts=6758ddbb cx=c_pps a=t4gDRyhI9k+KZ5gXRQysFQ==:117 a=t4gDRyhI9k+KZ5gXRQysFQ==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=VNPyIQiSFAi4eIlpKKsA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-GUID: Zy8b348m1uQMQfhc9QTWBRXp7c-38hnC X-Proofpoint-ORIG-GUID: Zy8b348m1uQMQfhc9QTWBRXp7c-38hnC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=951 suspectscore=0 spamscore=0 clxscore=1015 adultscore=0 phishscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 To properly respond to host sending more commands than the number of streams the device advertises, the device needs to be able to reject the command with a response. Allocate an extra request to handle 1 more command than the number of streams. Signed-off-by: Thinh Nguyen --- drivers/usb/gadget/function/tcm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/tcm.h b/drivers/usb/gadget/function/tcm.h index cd8d06419d5f..9d614a7f2ac0 100644 --- a/drivers/usb/gadget/function/tcm.h +++ b/drivers/usb/gadget/function/tcm.h @@ -16,7 +16,7 @@ #define UASP_SS_EP_COMP_LOG_STREAMS 5 #define UASP_SS_EP_COMP_NUM_STREAMS (1 << UASP_SS_EP_COMP_LOG_STREAMS) -#define USBG_NUM_CMDS UASP_SS_EP_COMP_NUM_STREAMS +#define USBG_NUM_CMDS (UASP_SS_EP_COMP_NUM_STREAMS + 1) enum { USB_G_STR_INT_UAS = 0, From patchwork Wed Dec 11 00:33:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849689 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8552923BE for ; Wed, 11 Dec 2024 00:33:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877200; cv=fail; b=lwp7sGwQAK8jChUf17Izsr+HkM3wCvIQMNEZoHfThRuvZzhRVFt1R/ZqXI+JUxE0KvVv+nJSv4IfRslmG5TzADqtw5SpxlF5wPn+7tNp1q2hWx1wjtmyQ65J8njFBH9rIyOUzRzmAmlW1sacNpoC/Uc5TfToCYEH/UaCmbkiq4o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877200; c=relaxed/simple; bh=8zZoTXW5qVtWkzoT61faOWYj4oVmiQdL7RLDuQjxHv0=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=UYF59uG4SZWHKyIDr4VCKsvaObYoZpTOK2OduilpfJ0NlemdqVsKkl2zzek+9jWgk+S7nYITSBGK7w4eNIrbIsrf090phIHV29VsHmCaKLUxkTk7E1F1RR3G2fDxWEZXiDjZgTsviiacersvX6KRjHFQVra/zqeI/UEAihNkFRM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=e5wQ35Qh; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=Lwu8E5UW; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=Sy1uFBK5 reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="e5wQ35Qh"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="Lwu8E5UW"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="Sy1uFBK5" Received: from pps.filterd (m0297265.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAM2wCo017317; Tue, 10 Dec 2024 16:33:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=/KtrrhzhXgyiX6znEeHqUF3DWfAsq7WvxwnQrAIRwto=; b=e5wQ35QhBVf9 CYQG4hpvz7wbJ5nc+9WBHq9kssSu/xe5ecBa5+Ryqx7UMvK68z/O0nlxi3V9uhQR GpVEf53c1TTlMP8y+PLHyLgYVs4Fp8CAmfHqfHnvxLP1upEhJYwbXJAJz3eFyuAQ nRHwGbLMgiQPFJhuFOft8v12Wt3wHULyQ9DNhS147ZRVCGthAPjfGCqAIUCw3ISe eYMzvJafG6Zs1u1Hcw4kRoBk2B/GjpqsQDIXLZYe72vxBeRHwWUNkF7KWPlKrM1b I1s6F9rnfXhK8OW2AFlzOmg0whHpr2GtLgsxjy0l+YngBGf7fRumgcg9nW5s3qs7 nVNL8e4NHw== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cp60t12s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:33:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877191; bh=8zZoTXW5qVtWkzoT61faOWYj4oVmiQdL7RLDuQjxHv0=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=Lwu8E5UWLYgsknQMXX5aD4uCF/z5Abps3ThbQIQDElgG7tRQuD5aT4ixQqxpRVe3E nJKIVYrnsKONutdldYms4MQrgZfBRENk9DGlzpf3uScJjtU642felpIRdSLZFTKtI+ kx2iCLy0v6zzZBzKFVkIWX/MSOh0XF6lI/7+LcfYX/ou4PcupMG2NnTj6rdEJmIYwD xgoGdJqvyv+F5c79nou3Xbsv8QBycfAjNTd5hL8IpIEcdzNlK+pu/XLm2EkFpILoL0 RlBOIoWW5l5eP+jo2WdNe0VusUReTxwhWGi4j/353KBCw29WYbUcrZ8qjJziXQoLJz EKxDHkdd63NVQ== Received: from mailhost.synopsys.com (sv2-mailhost2.synopsys.com [10.205.2.134]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 5D9D9401F2; Wed, 11 Dec 2024 00:33:11 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay1.synopsys.com [10.4.161.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 3A013A009C; Wed, 11 Dec 2024 00:33:11 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=Sy1uFBK5; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id E588F405AD; Wed, 11 Dec 2024 00:33:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i2JCizYC9uc3GsRT4xm8al9IuG/x5/mmJNyt1q+9ALLKu7BURsRiBzNKHmc+YH99T6jh+wLUL5V5A1jNzDVx8GL3zDlfo77UiJSWdyr18Uuy/5aNxuJdGaTBxAxKaZ0aVdeLsNkGx+RWI1ZwCRrrUxDcIh3rsK/rgrpKQhEnvW+v6w63alAmvjdGU8iXPe2EYjzXiVx9euIWjsv0wlt3hX8c00TArm+qT3lvBZy8nqQ3KPvf3DsYmKDX0N8hDKJXt1VH6yuFvvlyQziC8ycjqNNLxHeeO4b4eYRlP1Q+WXBle6e2UH+hfJQK2jYy16GfXlUsA6Q+IlWDdHevktfQCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/KtrrhzhXgyiX6znEeHqUF3DWfAsq7WvxwnQrAIRwto=; b=fkaDmfanBc/c4+gxaHW2cGOWh4S8a3ZhE6jYxagvatzIXddZEAYH65gJ6tCV2+pI4T1qxgEqvFsLB2ofSXMeFBDwoYkVuTFAyi58GPrYqw3u+PodMYqRILK56ihkjkVOCqsTlzY2fl5sjOyOIUkfr3YCejaYGSjT7mwRF2S/eyu72inx0fyj+yvGK7hToXbZY83nhC2ma1XrGGBtWkvKL3EagpFhu7Kkitl3MLuWVVwgUfIJleyFtUo5haUcPo0AiDpz9HdG5LnR4MpZAm7KNQ7QBHZYCPMjo+5cxxdhgz31C3HIlXuAgQ2F8rVA8y4Vh04UGZ80cAK2Zt+FCrItjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/KtrrhzhXgyiX6znEeHqUF3DWfAsq7WvxwnQrAIRwto=; b=Sy1uFBK51KS4jDqCYiq7vZ4tO5BSm6xeaAHMlGXUZGKV7ObOZqM9G4IhMvbCMlc8zuDMaTU9yMEWXZggpKlJYM4KX9lnJfGkJd5eSWVhY5C/aMrrHX9pihdJCwwKwrI7FVkijDVjnYde7EsDOMl5hpp1ndAaEHbN5PTJUNe7y1E= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:33:07 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:33:07 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 16/28] usb: gadget: f_tcm: Execute command on write completion Thread-Topic: [PATCH v3 16/28] usb: gadget: f_tcm: Execute command on write completion Thread-Index: AQHbS2Q/RQy42qOpnkqk31dnR8JLyg== Date: Wed, 11 Dec 2024 00:33:07 +0000 Message-ID: <9f6b1c6946cf49eeba0173e405678b9b7786636b.1733876548.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: 545654c3-055c-412f-f18c-08dd197b621e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?hisIVYS//C9ByeGyNZrMiDKJWe?= =?iso-8859-1?q?D0t5yQZg/OGlrULBoWc+Se+VSnENlkQT5L4VKo+LgBvyiJ+iRitl3W0Z9gyA?= =?iso-8859-1?q?xtJy8sSKanLsSOyg4f6fG1LLm9mQvk1Z1NpWfinPniP8CoXfbmz5/2GYAprt?= =?iso-8859-1?q?eMkFKTCIv70z9+FKhcw1VArIr14Quv733KpurRqGxCY99pYB72ty6oEmX7nh?= =?iso-8859-1?q?/b7yIkNo52zlRjDjQOspm/ABnWJ3K/cf28H41OBmHkn+pyPAfaW+xFvlkGJj?= =?iso-8859-1?q?VWAh2CAGxI5c1tMYuvZYovQbY3ErJmp6G7ZQ56QVtjtmY21/AmD0XiVk2mC4?= =?iso-8859-1?q?aBZG028nlP51kRRrmQvt+SzeBrKsDl+lGQo//PPHdCrmqFWEag+NErT9/qT9?= =?iso-8859-1?q?EjeegRP61VBgngJn7Q1E5taMG4Zad3rNN5LeRDxXkHQHLUT85xSSP3bUGpWA?= =?iso-8859-1?q?1zFTZVnvMqj1z2fpfXgAF30NqVSLqYeq97t8wktqLtxGYGy0/D5nC3SLsvsW?= =?iso-8859-1?q?O6ZIY00wEdVgHGYg9KCi80dvHlnC/VHKPKgY40Nh2ye/A1kmbGbOhvT2gH6t?= =?iso-8859-1?q?B3Js2seHsXDXbuDxRY+PftE6IlCi+Q0q1+5fCUOVooAd5Rv09skU0LrbTDzm?= =?iso-8859-1?q?jN83GIDsfGvkoN9fg4qxpqzae3hbfs3m3hHL14P0aAQdnlDDuXfaLRxeAShv?= =?iso-8859-1?q?2I1KT+5XF/dT3J69PE3v3kDCbmAknkgDLBkBKgYEgCYlKa6h7IZM+hdCpLlk?= =?iso-8859-1?q?Etdn+xYimJ/nfq+vEFLSd5sXnAdHLXTlNGQ7n8563bl1X/EC1H+hia9EezHR?= =?iso-8859-1?q?7f6R1hj3M3hWvaOcS1cBGv1vtGUlGrCIHRA+L5GBXI6ynPwrgWMmD9IOkMc0?= =?iso-8859-1?q?NV6Sk8eeV7ILJd8WkF5kwf2udyyih6AhmTGEf0IzaSeF6RH2C26X68x75bmt?= =?iso-8859-1?q?vmw/D+uj72oIbOxPgqgl7tRtkBqhQgpkCPRoh/W2Z6v2O0xxm7PVciU0VNGv?= =?iso-8859-1?q?AKxOB8UXwd/iOUnEHVtYKU0FuXZd/hjN6gx8Vc62hKgayHbpkiLmxTMP1QpE?= =?iso-8859-1?q?ehidiiy4bpN2qiKhnwNpb7LCIPe9UCcM4NiHrxqZ7NU+VgC43/g2Gp8Bayh5?= =?iso-8859-1?q?hllg5FhQ6zGuowr3yzjilrvTtiyfU2rl/Z73lORHALIM1bSWZCUOq2R9x8uv?= =?iso-8859-1?q?hUQj3Zyt1dNt+UB0kFFDcsnj7M/rlB2T9V6LvcmRSZPyx0b5KAEZu/3ytmDq?= =?iso-8859-1?q?L/ZJqm5751vjpSm4vnYbu9AYyiu2harQo6a4NffE9PazzH+dlaO0/pWKKpP9?= =?iso-8859-1?q?gjgLOOOpcAVZlr9tT7tDdbNaNzWN6CChClzdSjVx8B9xMY4jKbFxZq3gTjWH?= =?iso-8859-1?q?XIJRLWC7MOad0VBg/SUScnORGoNVyDPGg6Lx1PuXi6O1YW0YRxm6Xz80u9MI?= =?iso-8859-1?q?P7gQBeRPvYlJuQO/J3I9Hwtg=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?YBJymfOaLxTihwF1ExjdCrk?= =?iso-8859-1?q?HwIKdtHCarRExBNZWxG+0MYlCdNgZG99usG+PZyI1TBKRXpwZY572ivSK0F2?= =?iso-8859-1?q?f4wcqcS7Mki1sHMjDe+Y6saanc6DBk9uRxYv5Hw5ICTqR8gpa8i8ucI+1ej8?= =?iso-8859-1?q?9iPI1FDwakyHiXgga6H+h1rfG2wt2Ns13YANyepfVmRKsALFjHoBhfeNlJu0?= =?iso-8859-1?q?+hU5rEPwhESHzGCBHPKJDmes0AchvLTyW/I84pYTJAEYR3GIjEbmyc5yalyf?= =?iso-8859-1?q?x2qqYiOPQC7fzsPNXjAUX+mTjZM2S0OnBrHQsvyxTiKmlKEuhHbZscxwNMwB?= =?iso-8859-1?q?PhlSaqZUX03p9aNOR0DztPZ0KvVHI0wAHpMQpN1cv7hzSC/7igiaKMTpugJP?= =?iso-8859-1?q?qn2Fxo6V2khKuIO2FQzfpDXaw7cbh4pxicp3AWA2EV7iFLNuWOzFyguLCFQ5?= =?iso-8859-1?q?ys2uZgcwpQ8ooTSe4pt4G0VKm6Gg/MfdIlq3vBUv0d2A3wOKlkahiZhGG1xt?= =?iso-8859-1?q?iC+3mGXTVy7h5APj4jHHe06PmXSq7HNVyamdDButR/htlT+1cUtrgRv3m5Y9?= =?iso-8859-1?q?HUjlu1cFVZcQfugPeGnQqXCyhw2NGXPE04unqE5T+ps9r5SwGMN3faR437V0?= =?iso-8859-1?q?SKuw3m2RjF0GAPev+PfjqecJptdGdULNA6mL992irWpNV2LDBpF4hjyqhFHD?= =?iso-8859-1?q?SwJ9N99sZe4BDbfzZ4aVad1ANNAvI5eNw9OROqclNE6M86jSFR9c/DlyL1J0?= =?iso-8859-1?q?H6RHrIBqWZm7wFwW1+8Xr4N6NAyNR2vKJPa+23GslkDzXcLVhWEtz1OX5/lw?= =?iso-8859-1?q?8GjFjDORCYhhKHZ2J8iRIe8PAfD7+bH3o7qxCL7xgf5m4ezqsgTQjmUzz8eQ?= =?iso-8859-1?q?c8C0DIAhuzhgblrtbtR6JoBfQUv+6iEXjozW8UY3Kox5NoMqTiMB0MU4lt5E?= =?iso-8859-1?q?lQ5PnXcpk8w88oDP1uVlIqgqf8Ct461K5xMppD4nalD10bagQYLDQ6yaIVGt?= =?iso-8859-1?q?ebEY3ZKbiNiJfFemG6hIRoh88MeolyNSuehKjmH/batEa6hpUMoOqhoa6a9F?= =?iso-8859-1?q?Ml17ZtvMY4U/EAjMoGvr6n19i4URiC4FL1jYCJpI/U3inYJ777oaH9JDeXdS?= =?iso-8859-1?q?brbbJZuFUG6jypOZQizstg7VDy2JM4ICdKwgblwd3iXIeLj4Gd94zCjHPVAX?= =?iso-8859-1?q?c+xBvORr1CSgZabfZUtc5KUALe1g7Qht6ODdPLQWaB6LyEpH5S3gC3HY6/fw?= =?iso-8859-1?q?hGtj1w/YIovUH18uVvt90VMvVKYHs41O03rI8CE+WAVbvgVGEc9hlniu4BTn?= =?iso-8859-1?q?a3hnmSjAUGBJIORoXzemJCjNHYSXIoe4kdafRLZRw35PcWLqnfGUhGGGgsmN?= =?iso-8859-1?q?l4/xNuDMgIQNjcNomQflshzaSb8QlmHqX9/nbCJA0188RTLQXV3ivclv8sNm?= =?iso-8859-1?q?pa23RVMhflP7p+4pe4/uEMp/uR56XtOlBrXd1DdyzQcvjt/4PoKdVlldUtE3?= =?iso-8859-1?q?FW07/n2NtN+mgknsM517WLsLup1vmkrUVyjhbjx/d+b3K4oU3xGCF4fLJUWl?= =?iso-8859-1?q?hb+QK0Gj4fSd1f6Zel/DY6T7+54VEqqGpCqCBx6vO4XswTouCB4K33PtXmOo?= =?iso-8859-1?q?ZpaTN64tL41K7vtRK+2IlDig4hczR02Y8E25l9g=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UQc8E+JpQ0ExWtWjReYRDLUuCx1hDUJiLHi/ycPi8d2BdETkQxj64FCugrgcsTzjhj7+5P/6yF+Y0ehm04zXrK/pg5hw9DpdB182QqN0B7byfnzFvyOyx1Tfu39/5Fs3A2xBkPf8aWG//HSj2T02HXvBZQutn9zK8XJhNvGVm/3GMQjS7BDbI7Qi7HN757yJtHwwgNWzYNfkdRQgntPe1zZWYWXR5Fney6t6MdAwxeW9DjBXucrdu5og4kwfHGW8iguf/4PZ51s2+R70wFv86YwfL67nL0d7qumkuiFX3bH2oGLaVNkwe6RH3em+/NqnhYoKRN3OzW+7pO3qLOAp9zqQwV6qk50Dur6c3DbD7W3NzXGZ9XnnA4MzaJftWBwX4Gr/iyhGWOl2wBP6zc8rgjvRzFkUwNl0fbHiHFCnkD9A4T4NfryfQcVVlTGWZnvClrJKp3HY7QC3uLq4C40f7+ZAZ9kO6U3Ai5QLEuzX4PJ8FIZmmsXRq4hzXvUc9hNgrHCsxaAogOdIaOj94548atK8NVoKMG9IRV/TSOnjO71+TYbI81vwE2qc8Irs2NQpcgnscD86glgHlHHu2hGGcjfIE3/xZDQ0p7GR87WxgNRXwjsVLbp0zXizwM26V2plH9xpPdonBkZuO/xqL50zRA== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 545654c3-055c-412f-f18c-08dd197b621e X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:33:07.3933 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: MzxEPfpzYQcZ6W6VJxEyu6WxOgUgjRfA9XWOlg5+BKBoSSb5+TcTxRav0vyAvFfv2n+z8+QROl9sQ5hS1r4dCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=Z9YWHGRA c=1 sm=1 tr=0 ts=6758ddc8 cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=yKPNG9v0iw303YuVllIA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-ORIG-GUID: NGeZPgzHUmAJXv_IHRuJtzwtsecrbDUS X-Proofpoint-GUID: NGeZPgzHUmAJXv_IHRuJtzwtsecrbDUS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 adultscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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 --- drivers/usb/gadget/function/f_tcm.c | 39 +++++++++++++++++++++++------ drivers/usb/gadget/function/tcm.h | 4 ++- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index f43fa964d2b5..50c0703e8df6 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -244,10 +244,8 @@ static int usbg_prepare_w_request(struct usbg_cmd *, struct usb_request *); static int bot_send_write_request(struct usbg_cmd *cmd) { struct f_uas *fu = cmd->fu; - struct se_cmd *se_cmd = &cmd->se_cmd; int ret; - init_completion(&cmd->write_complete); cmd->fu = fu; if (!cmd->data_len) { @@ -262,8 +260,6 @@ static int bot_send_write_request(struct usbg_cmd *cmd) if (ret) pr_err("%s(%d)\n", __func__, __LINE__); - wait_for_completion(&cmd->write_complete); - target_execute_cmd(se_cmd); cleanup: return ret; } @@ -664,7 +660,6 @@ static int uasp_send_write_request(struct usbg_cmd *cmd) struct sense_iu *iu = &cmd->sense_iu; int ret; - init_completion(&cmd->write_complete); cmd->fu = fu; iu->tag = cpu_to_be16(cmd->tag); @@ -696,8 +691,6 @@ static int uasp_send_write_request(struct usbg_cmd *cmd) pr_err("%s(%d)\n", __func__, __LINE__); } - wait_for_completion(&cmd->write_complete); - target_execute_cmd(se_cmd); cleanup: return ret; } @@ -922,6 +915,8 @@ static void usbg_data_write_cmpl(struct usb_ep *ep, struct usb_request *req) struct usbg_cmd *cmd = req->context; struct se_cmd *se_cmd = &cmd->se_cmd; + cmd->state = UASP_QUEUE_COMMAND; + if (req->status < 0) { pr_err("%s() state %d transfer failed\n", __func__, cmd->state); goto cleanup; @@ -934,7 +929,8 @@ static void usbg_data_write_cmpl(struct usb_ep *ep, struct usb_request *req) se_cmd->data_length); } - complete(&cmd->write_complete); + cmd->flags |= USBG_CMD_PENDING_DATA_WRITE; + queue_work(cmd->fu->tpg->workqueue, &cmd->work); return; cleanup: @@ -965,6 +961,8 @@ static int usbg_prepare_w_request(struct usbg_cmd *cmd, struct usb_request *req) req->complete = usbg_data_write_cmpl; req->length = se_cmd->data_length; req->context = cmd; + + cmd->state = UASP_SEND_STATUS; return 0; } @@ -1012,6 +1010,17 @@ static void usbg_cmd_work(struct work_struct *work) struct usbg_tpg *tpg; int dir, flags = (TARGET_SCF_UNKNOWN_SIZE | TARGET_SCF_ACK_KREF); + /* + * Note: each command will spawn its own process, and each stage of the + * command is processed sequentially. Should this no longer be the case, + * locking is needed. + */ + if (cmd->flags & USBG_CMD_PENDING_DATA_WRITE) { + target_execute_cmd(&cmd->se_cmd); + cmd->flags &= ~USBG_CMD_PENDING_DATA_WRITE; + return; + } + se_cmd = &cmd->se_cmd; tpg = cmd->fu->tpg; tv_nexus = tpg->tpg_nexus; @@ -1028,6 +1037,7 @@ static void usbg_cmd_work(struct work_struct *work) target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, 0, cmd->prio_attr, dir, flags); + return; out: @@ -1111,6 +1121,7 @@ static int usbg_submit_command(struct f_uas *fu, struct usb_request *req) cmd->unpacked_lun = scsilun_to_int(&cmd_iu->lun); cmd->req = req; + cmd->flags = 0; INIT_WORK(&cmd->work, usbg_cmd_work); queue_work(tpg->workqueue, &cmd->work); @@ -1126,6 +1137,17 @@ static void bot_cmd_work(struct work_struct *work) struct usbg_tpg *tpg; int dir; + /* + * Note: each command will spawn its own process, and each stage of the + * command is processed sequentially. Should this no longer be the case, + * locking is needed. + */ + if (cmd->flags & USBG_CMD_PENDING_DATA_WRITE) { + target_execute_cmd(&cmd->se_cmd); + cmd->flags &= ~USBG_CMD_PENDING_DATA_WRITE; + return; + } + se_cmd = &cmd->se_cmd; tpg = cmd->fu->tpg; tv_nexus = tpg->tpg_nexus; @@ -1190,6 +1212,7 @@ static int bot_submit_command(struct f_uas *fu, cmd->is_read = cbw->Flags & US_BULK_FLAG_IN ? 1 : 0; cmd->data_len = le32_to_cpu(cbw->DataTransferLength); cmd->se_cmd.tag = le32_to_cpu(cmd->bot_tag); + cmd->flags = 0; INIT_WORK(&cmd->work, bot_cmd_work); queue_work(tpg->workqueue, &cmd->work); diff --git a/drivers/usb/gadget/function/tcm.h b/drivers/usb/gadget/function/tcm.h index 9d614a7f2ac0..adf4c415140f 100644 --- a/drivers/usb/gadget/function/tcm.h +++ b/drivers/usb/gadget/function/tcm.h @@ -74,11 +74,13 @@ struct usbg_cmd { struct se_cmd se_cmd; void *data_buf; /* used if no sg support available */ struct f_uas *fu; - struct completion write_complete; struct kref ref; struct usb_request *req; + u32 flags; +#define USBG_CMD_PENDING_DATA_WRITE BIT(0) + /* UAS only */ u16 tag; u16 prio_attr; From patchwork Wed Dec 11 00:33:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849688 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E74E5CA4E for ; Wed, 11 Dec 2024 00:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877210; cv=fail; b=Pxaft50LWeyiPZ9N6/F+egC9TcWMg2KAkRzkG76sxb1aVH1cmSl0WpW0ItAzSm5PQWgvx6nNoUuwL2Z/stgy+VmdBMRhgqmTY8cdiKnk7bmF2RiSwj1JenI59ahpGg8aVPJM+GyOR5UEsCXbz8MYwFHgk9goktfCAhxKMouXxWc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877210; c=relaxed/simple; bh=Wuji6LT2OhYc0BxG1tvqdSfRboHVXVHkGAv7h5Cufrw=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=j3qYkCkPvIhraI6418V2OBe0hML5Hk9dP0wnuOyRwFOrjP3DOLWVbQLaV0GSTRxSSJbnNKauFGv5p2IAlgPiEKbyu6jtq4cXesMnsd6X0nmL5ygI74AHcuIJsXpTyXsQUFm9kDfvg1ueJU6HQFV3X9GgHzY8d0LavvPDrnaFt7g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=VLXb4GWw; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=G8nBt9bx; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=cEf/P7DB reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="VLXb4GWw"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="G8nBt9bx"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="cEf/P7DB" Received: from pps.filterd (m0297265.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAM2nrY017323; Tue, 10 Dec 2024 16:33:25 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=o2XUnWvwqfaCpfgeNN9GdHQINg6fjBlV3tOJX4Wv6K4=; b=VLXb4GWwCyz2 bddr/MfcNF+ZHcx0L+BNi+fuz0Mf3hFvEdPNSlsYtSdbiMrDoq/7v+u6km6RE9ZV uV7lSqd9cFQAJoslGAYtjCTi6QUkoJo+kGB323tvsuIRswlSVRcFXwWtWRmceCBq Oob8mSw7I5QgET+ruP3SbRipJixOClV+HqezTM+bghtQlUi2UqBAa7lrI9lo2584 X24ZS/p5vnWY679EsqRRLSdws57L49V/B0alAuo2UN5+A25MY0f8dHG89u7kQa28 v38dMlLESE5IrceDgrK4HB9E2waEH2QTF02wnJroJEMoMJQEskZ7Q0jBmM99cxoi 6pjdgEp3Xw== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cp60t13e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:33:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877203; bh=Wuji6LT2OhYc0BxG1tvqdSfRboHVXVHkGAv7h5Cufrw=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=G8nBt9bxv+uHEnq1b219anqDLPrUwo01rz+1xpXv7QUl4cPUmzVdbf4k1D7vLT119 LBnAyHMPkhV09N+tAZ5nDXmmZz5BTQq1oBQW5Jd2/OXKj8pYuX9GvXDnq2bLW7yT6b CZbr7vywlobD9II2rFsEIskuOpf3peXdvQ5aSozPSodXHpUZvVQIgfzvvpr3wEBXyI 8XzTrmrf9QwsPyxeA01yNvEYOcVkE01xUtYhLBgWKW2gl4aXKpkWrgTP7HwSyCv0h/ 0vtOtdxSYPdz2Cb7NE6gyNMr8jbz9ukAEEHka0ZfoAd1z/Ys2REWi1Ccgf2wU3K7H/ FXjaTD3ZZIFlw== Received: from mailhost.synopsys.com (us03-mailhost2.synopsys.com [10.4.17.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 68A2940126; Wed, 11 Dec 2024 00:33:23 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay1.synopsys.com [10.4.161.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id A3848A008F; Wed, 11 Dec 2024 00:33:22 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=cEf/P7DB; dkim-atps=neutral Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2044.outbound.protection.outlook.com [104.47.56.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 7126B405DB; Wed, 11 Dec 2024 00:33:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bCgJ/x2nJmCqSAhAWtz9g54XAHGyX49KWQdASkgNQikLK5lEWoLIf1mnUZFvfMYfmgN4dXcWYVkCFzIw5ZzCNMcCs0k21feTsKa4z14nXjxCDqJIIZlVz/OACUqLFXL6il960ZsDoXiNU+55veCsiamSBUb31Y8kB5GnJA0i4cKQ1DkMq8lmT2ZKs5rFkzQMURfFkTiq99il2hfPLOWKGeksyUP0DMSDXUU67W3qpqC9d+RiWwBOovMbw8q4ss2NP526r8jRbRbdJBkvRCSKqdXtMyGqSjgSm2jA1Q88A20JtrNLjrV4Wj4UmXLUCpkQOLfMdPF0vqR2VZIypVnlsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o2XUnWvwqfaCpfgeNN9GdHQINg6fjBlV3tOJX4Wv6K4=; b=mecg9rxfSkyem27utp2tJ1ri4LmbbqKwK7GrD7F3O3pACY0RUW7UkGzoifkqJa4PxD48nhsbO3LgRMZpzrgCtSHy1o66K2nvd0v6J4p0JBj0CwjLbXVRr1gQxemwRgiL1NXHfEWzdLYShjFtJVI1PsoI4a7pvqYwu+fGlFiOvG/LokJS4uTeXoJne9s7vvFNFeHTSD65g6200htOrX6xf8m0f5SdxYZvboOgkysziUO26C59eaS9jZgL1jFJDX2rSeQAiRiuDyU69fYOsVt75UOeOCwB7mm1whLzDDoUahTbHWvx5yBVNsHNbYYGE5E26HfykaawgaUEPXs6BAmvbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o2XUnWvwqfaCpfgeNN9GdHQINg6fjBlV3tOJX4Wv6K4=; b=cEf/P7DBq9Q/Pyd0+nNa0ptnXAyiuLI5AuUgTLQ3ShTsPX0JBo/MBOnyqf+w0CEQzjfRqenAuJiMsCMjXildktg3VXYKYHIjpEEkO0wJOO/ABTph8gmydVQJeQG1jed8Zib7E/P4ZDQVfdD5HPyJT5lQvp9cj8Pyye9l6lMzdXY= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:33:19 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:33:19 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 18/28] usb: gadget: f_tcm: Handle abort command Thread-Topic: [PATCH v3 18/28] usb: gadget: f_tcm: Handle abort command Thread-Index: AQHbS2RG8nGEvVWhYUear+K57kyW9g== Date: Wed, 11 Dec 2024 00:33:19 +0000 Message-ID: <6d2a05f120a0384e36b5150b50eec53a0991f400.1733876548.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: e8ec236a-01a4-4c5e-2ceb-08dd197b694d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?1oa1uFOOHx9h+psGveFFZ1B3cO?= =?iso-8859-1?q?KXjIPLx9dQ1OeJPQYdbM6lciqL7ztGYy4H0LOnBKD1TTZ4Zk33hV7ULT68g+?= =?iso-8859-1?q?2LBR1ZZGD6OiY0XiQLDwRrpiNztu5MHjX+sZVFHX5wroFwT2meUYhD3KdiaP?= =?iso-8859-1?q?/brjt7dey0acGvmSSoExOEu3IcqReK/uFd3dkMrUkA4BlDmh42iaTmDAcbYv?= =?iso-8859-1?q?aEK3WDYUFhOZzVXevHq8BpC9ux7Wvy1inM3+CUVyQpT+XRIvVPcDjhu+50QE?= =?iso-8859-1?q?pZ1IfyZeE8aKr3KZGWTFD9b3ZMw1QnarKj4xSq9X4IDe70v2EcOP7Y+hcFx5?= =?iso-8859-1?q?nNR3qaiu9Tzr72G9PJswFCPmRvPUY18z6YZzY1Vga33G2nslL7jZwYuxWTOt?= =?iso-8859-1?q?hijJ3bsqXzjnpPhlGqavwjQZfb0cPOTMXazEJlUbOiuYhDJyO8+jMlExFDrI?= =?iso-8859-1?q?vOtHedN9cEo/6f0tDVsrJVf8QD1PvIa9r/fwrrO+tStlol3E/w2TSBZ27Zr+?= =?iso-8859-1?q?MSgqMpe0Qbk/KwnkVGUMUc6tGeuirzwNdoNsryLAF7GJdooIsRIeirxBRqfw?= =?iso-8859-1?q?HjFpBmoVse0ZD21FZ8o4si4ZlKCLDYI+sDqsAI0byw5GOAMKCeTqBDyMLi5Z?= =?iso-8859-1?q?mQ/LQQ8nIf3i75/n+QAXETg4ZrMiTKfu1H7kVrnv9W6cit3mGfKXLo1SlMu5?= =?iso-8859-1?q?mEdAbF3alXnb9F7bNiPYe76/s9NPVZCMKIVSILXs1wSBfSbnX2aKqa+OzpWW?= =?iso-8859-1?q?Tp17V0lE0m3NLidsqerjcNw017Hi8ntlFbvyNrqobFyM4Dt0J2C8t5wD1bW0?= =?iso-8859-1?q?LM1wPiOX2rIQ/L87GD+iDwF/2zvGW8o4UINJRAqRf6yOJ0zb0dMnpVV+DOnH?= =?iso-8859-1?q?7+ulJhL7/cpzUWWPjtBQtm1di1dGB7i0aXoRf7lcOUYyzdeWalXKAtct5ZRv?= =?iso-8859-1?q?NVeSO/kMitA87Hq09VD4WPHviJ0La4kuBw2UOz7Os24k4OlnY7VVEaaiiT7/?= =?iso-8859-1?q?MtZg0DR9heFyKjzYVid7c7l5yDTBq0M+1f3T218Zi1fsv3vGGl8EdEZIk4gG?= =?iso-8859-1?q?GdY7Cu19ZFl6+eQEI0WVZBKAdPxIJn27RY1vxAzTJXrQLFmOmy1gKX0/7/F2?= =?iso-8859-1?q?XkiNswwBhn8Og1sE3qa45yVn7mC0S6BJFWai8Nl1vDRWMwqU4qEqIZI0kXz1?= =?iso-8859-1?q?am3ywWYQzXIrYSugG+qu1w8WPGyYJvbR+USjfuRaCPB6f1RwFJNoOa7N/3/J?= =?iso-8859-1?q?ervqBWfzGRcX5DTf12rYK7cdvX8asqYePLiaxuNPOrP0IE0BF9ujKefr95oT?= =?iso-8859-1?q?dOLHQDc6IYusndz94EdxP0MtXrwjv9bIgAtl8eh3E4xjhshRI5s4tYIoNbMa?= =?iso-8859-1?q?YfPeLM6mW50QGF7/IiC+Ys04vIq/Tgwg0iAAHtCCNWZGhMqZTGVyp2IQEbTc?= =?iso-8859-1?q?FL9DhJrYIk41TtpyjwwIjp6Q=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?/fefm371Z3b0NDCg5TNRnG9?= =?iso-8859-1?q?HwXoHwdqLHzmijiElms0s92qh8LGYo//GUlutbA6YRf7uVAw0nmSAOzwpV4o?= =?iso-8859-1?q?HUgr9uE32IOyw48kKiNDB7AaR6SM6fZvEmbBOsSacqJE/YAvrPi7zy2XmqEX?= =?iso-8859-1?q?NJEl9cLK0E0eFYTNOuPdJe8MKTmGaWISspLlrmIV8un+gdV9TKMs6ye/yJbD?= =?iso-8859-1?q?9u91J9lFnuxPCT6OG34zERLiQT2+IuKC02qkbLFIFwi7s9W3dqVavDzHJTc+?= =?iso-8859-1?q?oirTHW14LTV4pFBW/bRz4XUDCG4gB/zTV23Si+7Vp2O1f6AX7QMhUzMbYI4v?= =?iso-8859-1?q?GzAbxTfZx9yBgkH2e0gLOwIp1VwjVkzim+nO8aDZ0hbyt61Qor1spsAB3V1C?= =?iso-8859-1?q?AqOWOTL64QtNdfR6XojfRrsib5C8mx9qi0QJerERCye9067CFGS3lNBbuoj5?= =?iso-8859-1?q?VISYeqy98DRmg49Y13dR3MbKvjT+l+lQYFxL5j9OXPZ4Wo1Uq4Bj5yYuuV4I?= =?iso-8859-1?q?S1JLFZ527cYbMluCMJ7I9s11tkDrA0gJ//fgRIoZB+kejqVpVzrefCz3HAmh?= =?iso-8859-1?q?DMWZJf4EnA/zVnpZYn8sjY3Yz5krT5Pwq5xGqriKWd1oiHw8RKbG/CknXiTB?= =?iso-8859-1?q?GfWyaCcQ3JgAlfPyG4xYwON/7oZ15Uy7ks+5VOKOzKDNeJe1VIuxFJVNoGN/?= =?iso-8859-1?q?i/Kt8dgJnAvtwc7fTJe3ZXekPZwiycS2rqJmb99C8Hu8kdnLdo+QRUWJ9KkJ?= =?iso-8859-1?q?W+BjsqnV8Ol/OAsgPnqXaZ+ODI3AStwFO3JZYcCQ94S741V5InopQyzSoVkj?= =?iso-8859-1?q?wY9IFnfvx5JpSALqJnEI8DPXFnuLgJsvTx0wxu0lmk/dK/HmC3/FUNPD1b9H?= =?iso-8859-1?q?toBVZiQKaah7ClHs4SFgzBz7UZVeFEFwE3VJ/xgrP/oL0KGuIaAPq3tYZrb+?= =?iso-8859-1?q?oz0UZ4RN3furYDZeBOr/AWKSVHcQmUC8yO46i3k9e669uCCOV3fYKTMxcoSR?= =?iso-8859-1?q?yloS42hTQOU8QT+gRyvbJMA1xgIHaZVDPMkCMd2L9vymxfYCtRUNHNt5SwWR?= =?iso-8859-1?q?48Cded7nb6S0yKNsfNUmKEs+NJRdhG2fCuqWfPTh23gGU9WEq+b9TANThSHR?= =?iso-8859-1?q?V1hUcGKGhC/LZp9mjBVJvBvt5CvHxfAB5FYigqiKPxqEw5l9ta8Rhyt1tRWH?= =?iso-8859-1?q?C0p3b7CEwbKA8QJWmMZWyFAjm579UDXb107myEk+nW97xB8N1/hFrLQhTTUc?= =?iso-8859-1?q?mxpAMS5od0Ln1xPKiSex5pZz3UpyF3poIYMFpbFrntbGgPrvi0V4VgpPZXHM?= =?iso-8859-1?q?FeiQMvvmmHBKoDkE7AwNkDdypZJFY78RgAw3660cH/JG6g9YOOZxnjcof7Od?= =?iso-8859-1?q?S61IjHfSF8HARZshXYbqH0JVzx1nGpuxPWjW4DAPZzWYr+YMYi5p1tQf1eL6?= =?iso-8859-1?q?6qRSMYIOivLnIm3wd2O2PwP6YK4e/ZCHXG3qkHXW4uTIt+TFvdLrx83ibpYg?= =?iso-8859-1?q?TILyysO8V2o3Drr0jO2Te/vfjFYqYs1ZcEB7XcgMFGamNaGAE9jVL/m8AtVz?= =?iso-8859-1?q?b/DYPzVxyfD9ngbiZmQq6irjOaMS6/tqNSHZlgBJCXiQDvLmLkDYi/oeb363?= =?iso-8859-1?q?EfxM2sqWvAwDT9ugopKdr+zxCgNuiACg3Qw0h/g=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ffiC/6+smkCJDu+UtlXmv9m98SFKyvGzUkwwzfKKpjbb+gETuqNEO2tJPMWqimAUy2vNjP+eAIQ5QTCmG6u6X+fyk/APsKsgYFTcz7jGVRlbL5Wg305BJq6pwzgBdr4uTXRjogs+xhbe4MlVnqVkYZ2lKu5up/IDuCbJOKICXepLHyUw3MM11/mr8nutSCbdDgeEswZ+nfWS7yGW8YMLG8pusBrXoG9Elw/mITSH081ykl1WcjRR5qzMKYN41lVL8A1xOQ28BcP/xAGj25FW/rOKFuo6gHy35arvGW777H/CHeWzNo+zLcCGfp3oYQqdTrJ9l/mqEFBFZyzc7GvZTJ2rHWueEq1+xemeHNsnqxgZKaYR3oUwkUX0xBbC8qpV/hrS33QP1nVXK7rw/j3wowR4nItAyOU+31WEkHIm4eh7oS02PIkMM5Bjz18FnPzzG1Dy675SIn+FvIc+6ZwE6HtTRt+AI+pWcK+39333Eb553TUEzvnN8ofxiIHPF9c2yDyvzV3JqHk3OtdLBOqwn/4Cr9PgVlQbieYWpXMTzew5m3uhLf/JD4t8mYacqLBKAskWMjkFLM+Itje+MKmE0GRpodpX/pug7wt7B8mhY2iiJa6rnHfRQFsnSQxtymtZ+s0+rOGjqIQzpVBdMyR0cg== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8ec236a-01a4-4c5e-2ceb-08dd197b694d X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:33:19.4275 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: fo2YVQQVu2UCtmtTpoGLNmXbOUKucjv7HHWdxlqrB4lOgjrVLUCwKMit5tBnRaF4diqDyod04j1nKq+pCXXhKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=Z9YWHGRA c=1 sm=1 tr=0 ts=6758ddd4 cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=Shp3TScI-t8v02M12rUA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-ORIG-GUID: 9blWPjtOuDl1mqdIK7W89BnOLM1qrPOU X-Proofpoint-GUID: 9blWPjtOuDl1mqdIK7W89BnOLM1qrPOU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 adultscore=0 mlxlogscore=973 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 Implement usbg_aborted_task() to cancel aborted outstanding requests. Signed-off-by: Thinh Nguyen --- drivers/usb/gadget/function/f_tcm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 696d34e04e7d..2a74414c7fd1 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1257,6 +1257,24 @@ static void usbg_queue_tm_rsp(struct se_cmd *se_cmd) static void usbg_aborted_task(struct se_cmd *se_cmd) { + struct usbg_cmd *cmd = container_of(se_cmd, struct usbg_cmd, se_cmd); + struct f_uas *fu = cmd->fu; + struct usb_gadget *gadget = fuas_to_gadget(fu); + struct uas_stream *stream = &fu->stream[se_cmd->map_tag]; + int ret = 0; + + if (stream->req_out->status == -EINPROGRESS) + ret = usb_ep_dequeue(fu->ep_out, stream->req_out); + else if (stream->req_in->status == -EINPROGRESS) + ret = usb_ep_dequeue(fu->ep_in, stream->req_in); + else if (stream->req_status->status == -EINPROGRESS) + ret = usb_ep_dequeue(fu->ep_status, stream->req_status); + + if (ret) + dev_err(&gadget->dev, "Failed to abort cmd tag %d, (%d)\n", + cmd->tag, ret); + + cmd->state = UASP_QUEUE_COMMAND; } static const char *usbg_check_wwn(const char *name) From patchwork Wed Dec 11 00:33:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849687 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 409671C683 for ; Wed, 11 Dec 2024 00:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877221; cv=fail; b=ahF0au1hScxjcugCq8jSvXiT3RV/qND5cbepPn0tA+M8GGxMX1Z6w9lTJM3JlqVxW1klsk4dIjflEv2x/J+XW5WKMTphr2YvGiu9oRr50gNFv7Snao8eTfgdoIEL8z5DX3Ixozu0g455SSVxwxVyKs1DMjgEQyzA/zQ4HGKKSCQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877221; c=relaxed/simple; bh=PuyhBbFwjB0sJmxNEgQITo4QkZTXcn7FaSQ7Hgy1TxQ=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=coiG7EHuNepi/ZXs8r6KhmU6ezF2kb1/FdAnOpp63NsGrabhzisbxLQ31JEmuxHqraDr2LV/S3k0Gbl+sBbKbKtKhwcm+3dqL/SMXuXv6etw5Hf3sS8i1DNq8wCmjRxYdBfx7FxKf0DQbr2ItP4gjtVsuXE5+24t9u4oD7xAx2E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=SAFwC2TB; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=L+Ouhgx9; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=Y882D3Ai reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="SAFwC2TB"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="L+Ouhgx9"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="Y882D3Ai" Received: from pps.filterd (m0098572.ppops.net [127.0.0.1]) by mx0b-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAMtPgV000581; Tue, 10 Dec 2024 16:33:36 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=aHURBgCdOxhTFPlNJ9N5wX/XJt7Lu8g/HA2e5EA3Klc=; b=SAFwC2TBQQmg CoO7mZdovOoNFUKM5Xm/2h2Qp9JhumGAaGc24eO6FNYyoYdHDA4aaCZBnsMMbWYb EUbtFaVNE/mXzZkDoIIMKKrnO0w4PnxyzcdlOr5B7N2WWaxDIAzIb1WfsmypLcMZ 2a8pUozNaee6qh6Q44VGfIQ7YTZWH7T/IUi3EVQkIg+L7G2sruLAN95ih3gsTvlE GUXfqlsfj6809hkDddfh+PhlsQ2TPwBo0X01trQFWYARcKa/cG/qd0Za9hZElZQa NiM/JzvFmWs9dqKLnjRTTauNeMp+j/xuZ0Owqdfdm5z8u+Y3cGVp5iBrkNOhbOHM ixjNIimzfw== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0b-00230701.pphosted.com (PPS) with ESMTPS id 43cnvka198-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:33:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877214; bh=PuyhBbFwjB0sJmxNEgQITo4QkZTXcn7FaSQ7Hgy1TxQ=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=L+Ouhgx9OwAmTPG8XN1YFRJsf7GwuGEshnDXawAGE4HJV9PaRbVX+qiNO3d71SsjD 7ZthBreeWI+iv/67BgdiuNoAYl79fLsmbYwKnB4bFpBYQ1HBRZPKw41TWus3sZHpzD SWox7jGru600Z/81rCM1bubpELFUmBgkbpGM9fv1o8Ni1e+8oQc5+YbSgT5VAcA1No dC8n4n2Y/j9g80YN4u76La5uE6Xa9Pv1lQgu7WOE9jJp4pvijowhmcHzzvZyp0VpDe 1niKh3KDsCkVEglCwDKFgzJQ9mXRq78FI91i3kmS7B1SnSef035sQiIR0cAly/5Uur KuQbehjLL6Jdw== Received: from mailhost.synopsys.com (badc-mailhost4.synopsys.com [10.192.0.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 7D1BE405EC; Wed, 11 Dec 2024 00:33:34 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay1.synopsys.com [10.4.161.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 60970A005E; Wed, 11 Dec 2024 00:33:34 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=Y882D3Ai; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 1ABCF405AD; Wed, 11 Dec 2024 00:33:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZW7OhDpx2L2zsL7BNxWOkZ1vSmsLPtLiYfwn7tWz4kfuoaB6s/DF0RNYzQMeFUkVUZcvvpX5enuJOcXDXSGlip8Ms6T5Rb4ltmpCm4lPoJNuMGYXOdW/v4LTJIDFBmfCJuhZ6lyqaHtbymyXThLpCO4xqYrPUQNBzzn/7qVNgbnmuGoJzCSJHrj8mVwzFSolPs7XPfAg35bLGy8vtxZ8lJhDjUH08dbczUXkob51BfcqVMNgkmeUHdUebmRPGvCzq4erwuEN8IWF0jtKB65a/fa6EYsFdLJCQnzUQC3U/N62zY+qlQmKEDHwabdb0IPFRNtk67gkjSMLuJIDFh1Afg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aHURBgCdOxhTFPlNJ9N5wX/XJt7Lu8g/HA2e5EA3Klc=; b=fNsgd5BpFgatKzTXp9gFUsRwaWMtIvXSl3RFonjHi54JXig/NnOHJ43sJu34J8gUUhfQUC7U1HCIz1qr2m0QFoDkNdTTbOMvGNQlo49m8DmguyLmr1Hvquyn5fpMVUrVvX97KfDcyOSmmQO7IWQxYlPDtJ2Rnc0rk4zSaHiJqL/nEhSsg5FzIyqBaJgUuWstxYhe7cpAYYUsW2jlEhsVnDhIPVXrHUU4ZoV5xCN56ThU7FhG/Uo6f0tEmjEHIHsQCAH4F0WT2JHXw/HpLXWuwW+MweaDU2MzOxlM+U+RygoUXrzKp0vICuJ0JxmQY7hu03DcZpBUWKSafGBsGwF+aQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aHURBgCdOxhTFPlNJ9N5wX/XJt7Lu8g/HA2e5EA3Klc=; b=Y882D3AiSMUyNArGS5Qaeq1SpK6U0kZJUj4MR0wyVA2kLbnYSO4/jzny97NR1HwyCRnN9j5Xf9XkZNwaMKrtIWx2Fp6cCYVUrHMAqcSsJZkAwjVrVEvMOJrSmBNd9rgVYdjgeCuy9on9+CT1whLhuAJvOINnUds0s18IQZD0LMs= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:33:31 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:33:31 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 20/28] usb: gadget: f_tcm: Stop proceeding further on -ESHUTDOWN Thread-Topic: [PATCH v3 20/28] usb: gadget: f_tcm: Stop proceeding further on -ESHUTDOWN Thread-Index: AQHbS2ROWD2GU/49i0mc5sRQS4rGvA== Date: Wed, 11 Dec 2024 00:33:31 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: 46314ebe-51c8-4d4f-276a-08dd197b7098 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?cLd5Ttx7eXBQYTSgEQPmP8ogBa?= =?iso-8859-1?q?X8LEWNDAfA0eryZYGFjWV2yp7I3RbXcHWB9it+FyaD8McTn3vMGG66cEHOCS?= =?iso-8859-1?q?yX6gyYK21+aE9lPhDCCHoLFvqO5yWU8f4V3CrTadAybfN793aVHOc9Y5fBM0?= =?iso-8859-1?q?5JtHPBOQ7LHx+0wiFcrhMAcbLjsuLCuFx7dFpOjdRXdjvmQMoTnd4bRzKr/f?= =?iso-8859-1?q?KRd3SgNKJxusravxnqHktLzINt2HFirnHMI8rkWBFqhHhNbRXk7knKYhVLHo?= =?iso-8859-1?q?aGksveqATQRXoULelRbn+ceWDoEN+5dpsky+dE6a2Gso/gr9VqGfzZfE9zkb?= =?iso-8859-1?q?X2AJhAKg0ulYudfm48Q5iiiJ6cQURfLPCdeDZJrkSe5fXo/94RJMa5xlhHH7?= =?iso-8859-1?q?6y4RuOFhSLkxy+qefmFZWGlyQ66i9UMiCzUp7+xE5aDbvJ1jWu+NRtebVg5W?= =?iso-8859-1?q?hOhi7r4R7UgTl9NqmmdBtmgmvrUr3iIkfebO7gozqdpOm/qX/FEhiWv9qUS3?= =?iso-8859-1?q?tKqjPbDsPNM57T/+uc4jDzGmm9fvcKWZwS/zXmTKQtTQC7ykURLnNbWpALYe?= =?iso-8859-1?q?/2oqESSFQRP7dat/k/jfIHxzOAQfGtKA/2iM+vMZARPFjfRaEir3Zst0/vzI?= =?iso-8859-1?q?uZTwO4t/tlsxdlZYP0Lg9MctDGE0LPiX5vgQNKyDgt9Cj5glregxZ7v4iGt6?= =?iso-8859-1?q?W13GI0PDAhIg0Rw2aXpZWW4RXXyfxY0j0P4Lvjinu0bDBgQ75a1oUfFiDkF9?= =?iso-8859-1?q?ghjG1ykZd/KGUuEgxNUhaAWX/35+d2PywGISGH8bIbiOycevDaNvpjaC4z5J?= =?iso-8859-1?q?Dj/dsDtK/V/SM9TMmsGixM2sgF2W7Nb2SXtJWwempi5qkDRiCtDj/vcw0+7w?= =?iso-8859-1?q?O/dDP/cRW0SFfPmkcrBDpop0zublxBcIZG41SHM3TiXGuzRiP9ZGg+xUQhj4?= =?iso-8859-1?q?9E6l9b0NhVkXkGxAroAXCfZTZkmEQJfVvDJq1/tzdFV48YbFcHENqS8arU9b?= =?iso-8859-1?q?03kItfVPeolenFe4CYRVHbg+vk0+ZtepZLRf0C62IiQZtCczHB3Lfqq21YOB?= =?iso-8859-1?q?zg6YJAkmJlR8QT6/AmJpexwXzWy2WArKniVh21Jjv8f50/Vx8DCvBC9p8REs?= =?iso-8859-1?q?cer6SaZkeliPS93qq4aaBiapk0ka8+uejuEz4bnnvIlljfx8alxmkYJhl4Q9?= =?iso-8859-1?q?MfpqzKJttGT3IT2rcYo3UZWT8tBiGgX8fQS1pwaRZVHGAfekIVzRDavgwZ3J?= =?iso-8859-1?q?5C7+ENNzGQpsqk7FFuigbomqK4Ij9kS3MyTqbzjuzRM6QNG9dOUSmMXxoCj2?= =?iso-8859-1?q?Ztz1CnsXuhraV+M5CfpNl0VBVnnbOh78+oNUCChU5CUYiRqfQqfAGTkbHwSs?= =?iso-8859-1?q?s6xMRzMAGX1fPbf9UpkFbOYEvUMKqH1+oiymxp76EWH5So8sF7qh7yI3HSQA?= =?iso-8859-1?q?ZuOGOhCceTuMw0rdHdcnEzNw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?Hv1WYU6R6uhvMDFvJ5l+xEm?= =?iso-8859-1?q?midDdxOuSD/aCYr1roo4uM+T1iNQaAZiokJiTU5FMy9JNeyH+Dg8yHfvOkrh?= =?iso-8859-1?q?bcvbCJNUvx+rm6YI160pTJI0l1VALYwK4QVS+gFtC9k6Qma6YF28gTum8s3a?= =?iso-8859-1?q?Hs12yaUn8fx5dWhovo3wiAzi/ydT8KoP9jt2eAWjHAtqkOp+AVVyF3Hy+YO6?= =?iso-8859-1?q?lhiyKpCnF8ZCHERC+jFEDhVVZxYPuFBs5L22yW2iCyH0Kj8NkKgk4YRYmRoQ?= =?iso-8859-1?q?bINlRiE1ewO74h8EZv6iSsUw6FJ9R4gTEjN/OsjkDqdp72V7zQjHmg2BjAm0?= =?iso-8859-1?q?y8E5wNhGiB/Lyaa9e5VYSIrR61WWY1PXulL7HW6XWznSxyK4fYma4zr84/9P?= =?iso-8859-1?q?B956nZIG0RKloHA0tgl/B7/KuDS/ieiamTZGtskIeZk9bOgMW3QOvTiLUzB9?= =?iso-8859-1?q?AC7YCIzSfixFRgiZrS+427jGw8hxFFkv5UrXieTKWIM9015K8kBZ6LueJzMr?= =?iso-8859-1?q?0/RJg3uJsJQl6H0GMvvl0t3RNwd/5Ia6vC/CNoY+WKKh0lcx/+HCIyM3E2ZD?= =?iso-8859-1?q?OTfTJNraVwRIFE/Aqog3zOk6oEghypnKz4J6C2zzv/xZJjfHcBXTS09FPpGh?= =?iso-8859-1?q?SGPxZJpQk+XkzGmRQFsQT4D8ZcbjZnzwbRfe0HKPxuoIEG/ZL13A6vOnwi6W?= =?iso-8859-1?q?hSiebG0nH0XEJ/GkdsNvht1q31JYYoltsbrYzrg+yE9IG2pylY+c/lOoM4as?= =?iso-8859-1?q?Ggn1BU1uUs2kolI4Pb0qeYCvMNanx8PFLM0nh9Tae75uwUeV4xtDQohOJerv?= =?iso-8859-1?q?sHbSM3d/Q5zBdEQdPd7MHeCOVa8vREoILmjs0Tqab8ueHId+UTqkGqEuSwsP?= =?iso-8859-1?q?I7eEIhuxWvfD0hp8licB/SZ1OOyf6AYBSbNHCAT8QmZ/uGIVnHLuahO7kLqP?= =?iso-8859-1?q?fMGof5AZg8op+Puc2urskwIjx8M8TCLwSRMVNtRi/z1D9YeYJKhSTjh8/NI3?= =?iso-8859-1?q?B3tk5DogaBSK/Pbp+GKzE2+PlxI5LVFwCwFLUu8QWnVunnxLmLS3unqW08lP?= =?iso-8859-1?q?9tNecl6/D8Db3Em92IQgE04g1z28SkhOjJEDmpsoWs4LJBSbnZy+Ykyavd1+?= =?iso-8859-1?q?9vyhOEcXQEbHceOw4paTsa1/JTsNW/nPHUpSpbmNZE65TaBC1vu4jB9Lfdah?= =?iso-8859-1?q?/bEvNGiTwYXxftxHnu7vsPgkr2TWXzHQaw9WYDKR5YEc2bwFU4DPmSd2THZT?= =?iso-8859-1?q?izRBeTIfNxDXQVFL7u+UYdcj1AEa9FFX0RBR/OMvQY1xUYycoNt0WgnrzfNh?= =?iso-8859-1?q?m3ye6G2LOPbP548iv+C0Jc6PezL/wNWqLXV9uNbdjCT5amuU2/cPMzQzTEkK?= =?iso-8859-1?q?SfyWxZ2W45d9zw9F2Ct/ST24xr/TgmRt83Aw9RSCMwBs7V9rrtoN9jHkU35d?= =?iso-8859-1?q?YFYAj+ipn+2fYPGmCdb+AXeDIDL+VSCF26BcXbi3R3E8URo7dsMTTIyk0Cdb?= =?iso-8859-1?q?nMZWgflV5IxaXVB0Ia5dmQvjn75lluK9KiwUy/sG32U/CyHqkMJ1R4NOiv8g?= =?iso-8859-1?q?nH9d0zPJZdixuDnVOMXHDwaH/f+xNeF5vA1dBQ05LKqHXD36I65+MI1Mvy6M?= =?iso-8859-1?q?aSGJPL/dBSovZW3v3kDoJM333yUqrq42k7KWP5w=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: EzK/TtGD8ehAMU27RhNoGif7TGHSoVil4CO6KbQRdo4Jy39WJYYS3lcZzTBWCQN4xp0wCEXaW36QsbovOk8hFiWhkMNGZfspC/TQT/dZMnFaRr/pDQik+jpjN2xjc21nNJuB6IPf34fZ0ay23IdTjKYUiqqZ7Wb6mUXCj10mkoVkj/n+SU2rNwg452im9zsa7JoavWzyY4wJbPwma5+crqJgF/pdNWTY+OXaCO1W6L6LssW0M0+4HFYgw/hWQzLuISVRqrJmZokjkJtecaoV4Gui87S3m+J10PB5/suWD21PZ6qTuntWsIzl7M1PTFep+Ver3M6eQ0Q6SiDBqf4jLj7nD/cO20D4Az/9Ji+DRq6eY+mkKUSIV555LoWbHOBIRy1BnysLUIMu9ZFwHvOwTzdPbe9WzE+2ihXnJ+EhFaPUdY53dGSsowsxlrj/ObQvBaUBYV+tSOa8l7PTmYVxJTc+ud81ZfxVVNl9rNLUmGJpgC++tBuc2cgWRZbdzo81yBCer/lh8eWcZmgsyESyeSIPjM3hcPLTz3GfUqDxwdwA4i63mt75yc50HGqnihWrERVBt93reCRimG8VwuOHizeNfN0Mc6DMLiI1o5TEhPp8jBxdXe+xg3htUHvTnCWiLb1BLYLt5ToA3m3wZjk51g== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46314ebe-51c8-4d4f-276a-08dd197b7098 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:33:31.6665 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xDw+wM7uUcqwC2qvE9XbjXZ+wLb4rMFyV4trkZejy2+ZpI11HlnpnPrbhGFETEU+q86ueUcsVJ34dTrnvii+1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=fNPD3Yae c=1 sm=1 tr=0 ts=6758dddf cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=CU69Gs6ASZi2hjXg0JQA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-ORIG-GUID: 2AbITtMbTSsUn_y8BBVX6Dx9S00nW0oF X-Proofpoint-GUID: 2AbITtMbTSsUn_y8BBVX6Dx9S00nW0oF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=999 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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 --- drivers/usb/gadget/function/f_tcm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 8a5aa58e166e..6aa341c1472a 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -62,10 +62,11 @@ static void bot_status_complete(struct usb_ep *ep, struct usb_request *req) struct f_uas *fu = cmd->fu; transport_generic_free_cmd(&cmd->se_cmd, 0); - if (req->status < 0) { - pr_err("ERR %s(%d)\n", __func__, __LINE__); + if (req->status == -ESHUTDOWN) return; - } + + if (req->status < 0) + pr_err("ERR %s(%d)\n", __func__, __LINE__); /* CSW completed, wait for next CBW */ bot_enqueue_cmd_cbw(fu); @@ -276,6 +277,9 @@ static void bot_cmd_complete(struct usb_ep *ep, struct usb_request *req) struct f_uas *fu = req->context; int ret; + if (req->status == -ESHUTDOWN) + return; + fu->flags &= ~USBG_BOT_CMD_PEND; if (req->status < 0) From patchwork Wed Dec 11 00:33:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849686 Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EADCC8494 for ; Wed, 11 Dec 2024 00:33:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.156.19 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877235; cv=fail; b=j1HxEmvU7y5lWX1Ou6WENybaYlifYqzIUQUxyY9wJdNeVYm7F4TvWlO070KO+iyyBrcd8+Fte4GJnPrHX0Arn+TTbybGT0sk76sGZjJyoOHC54EzDf8SkAq8gG064/c8sxTG2cA0K1JevXDv2rZwG6hbtH5qah3oo/bEVg8Jdl0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877235; c=relaxed/simple; bh=K3yn4bl7Vm+aQH5AXRcpRd3WK0uzcUthnC8bl4anqA4=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=Ye1qolnnc6OumBGudtZf9WlYKsvCnWZ8tLOycvXVGDHAahSOqxkO+mutnMDiV/lkBfc7kXg7Q/InNmH397bPQgK8OVS2ErRy4Ggz9v4Y2iHoxJxPIAe7U5Zxy78S8dMy3/OXt7XdZ4S/UWBorArN4SSGIYqsgCCm0VpZzFtv8Yw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=qFfyWaYE; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=RStNcXY1; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=pqZ93DqB reason="signature verification failed"; arc=fail smtp.client-ip=148.163.156.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="qFfyWaYE"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="RStNcXY1"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="pqZ93DqB" Received: from pps.filterd (m0297266.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAM4hrn010844; Tue, 10 Dec 2024 16:33:49 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=0oBiYzwvtCSuIZePvlIuhOaq2hACT7HFmKFR8MM0LI0=; b=qFfyWaYEYt3N prVu0vmYfO/xycpuMEH4prWpvyl9HqIrcGCh++RG2TSCeXC0RYKyHbj5uHEv2x+C C9RKPFKFss93CAmAhiGNDIAK4FQRNEIZRZxO++AprQKMynUmIzJYwKo0fEf6rbuA cFEAuLasHqw+2qmNKd3tfjLPyXAZLU+DgoNEiWOHrHbv1GcMV5QiQDk605jHVwfj FuWN8oEHaUlTHH9GbMUlVDNw+NArENCef0ap6Ck/bsRXDF9YJGB8bignvIn7M8zp 4BUY563UKQtcCyu29Pg/qTRMlo1VEmT/CFfEY/o6/ZirwWt06GOk++9XPmzNpTZV cEHyrDPUpQ== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cpgb9q3j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:33:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877228; bh=K3yn4bl7Vm+aQH5AXRcpRd3WK0uzcUthnC8bl4anqA4=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=RStNcXY1ngcF3U/0aUe2Khk2YlDkSm80zOrEb8Zp8d3I/rYdXszKW0HTgxlL1O2/v f0br20i25viD6KlZ8A3Dp36BIQVamqIbbmAl569ZaEgES6GPIvNgQd/ObktJYeTlfa sEZB/MXBvzHQq8WZkJ6YfOyq3KyeeULPr4SBca+R17Lm/Gi+SKmQFelPaF8zljsLWi Xff1DI4l3wOUSx9agOgRWOJuc9QZNb4bptVGf6Wbquw0qXpJRr+Eympc43oHgHLhdn 7GTq4U4rAs18aeYGgxCUnCEn+P0lbYVr6PfBzymytX2fm0PpVx+sORpV/jx8fjheXB WhBP53QjT6U7w== Received: from mailhost.synopsys.com (us03-mailhost1.synopsys.com [10.4.17.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 80C0F4012B; Wed, 11 Dec 2024 00:33:48 +0000 (UTC) Received: from o365relay-in.synopsys.com (sv2-o365relay3.synopsys.com [10.202.1.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 60225A0082; Wed, 11 Dec 2024 00:33:48 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=pqZ93DqB; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 1EA28401E9; Wed, 11 Dec 2024 00:33:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PnVmDxoBWfwgnqhGD5enPBbRJ6KKxQdP9EkInjXuPLBegfFT7nhBHHfZNkR45SrvwsxKvMR1KuwYOm2DwpE/GSL+ifSuJOrBVzvBbta8XQUYaltS+1Pam+asJAxPq/c+iAGWB9ymWtpBVr2mZgOMCFVEgaNZqEmJ/KFDDAlfzyZ237XmhcFFLrsYS2MYh+vIYL5IjKTRw5MMKSWCLo4xq8ZRskDuEeY0zwEQONx4RHBnOdKTFlfonYp6naQpMGnl6cvUmL0fDybINV7Rw35iaJ9DVf6nPr2gvVWWmGBjOKRrKzfiaomaZk/AuurzyV3nQcJxbbV2HFspJeT3G15++g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0oBiYzwvtCSuIZePvlIuhOaq2hACT7HFmKFR8MM0LI0=; b=wH1sFro5006y88NCcXvpYnFehUKTBr8iK2cVoMuDPAZ61vUuSheyem+h8IWEPBFWWj9oBL7WwGuohx2EBxY96WAroOnv35ZWGGC6s/DnTavx6DwJD12HAA9ZNgAPKyC4npdq6a18Xjz2lpPUkyqDa888PEZHBRWnVRXPHDTgQ83+fN+0Gh09467a2BHreUIUCMjgzDJaDKir4uGR+Ytp9fKnXPtIDXaBHI710kkzLyk0RleTmC39zL0iML0ndiBOH+TSGcRQdeqmPWOAZoXXEJRqqcZm5R7R9Y4vZ/j/61Vu32AqNG8QujKUUpqSfujcR15vZnK0OYQIxtS8d8R/ew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0oBiYzwvtCSuIZePvlIuhOaq2hACT7HFmKFR8MM0LI0=; b=pqZ93DqB0EQDo+gKsrV/rWWdXcE0OOn12pbHX/B2Slq/BI4VXhITKnjhL40ikXBlWAWaGe/fYR2GwbEKdtK0uIfiQqhSYjec/4D2svsVRrZd11DsiMMu/u/JB1xgC9U+GJ/euU9WKtmjxqSRYZTbaKoDu2jP86tjbwc6c6P+FsI= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:33:45 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:33:44 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 22/28] usb: gadget: f_tcm: Send sense on cancelled transfer Thread-Topic: [PATCH v3 22/28] usb: gadget: f_tcm: Send sense on cancelled transfer Thread-Index: AQHbS2RW9FPQmof2Ukqr4QKSb+VIqA== Date: Wed, 11 Dec 2024 00:33:44 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: 5501b1da-e32d-4388-c733-08dd197b787d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?OzZ12lAHeYWrHz2NgUIqxHuFNS?= =?iso-8859-1?q?nKwzEuWq/FGY0Df7ntdpnGZtgcQ8Y7BUvaMjumU4yFdxSM0uuSpp+Ba/9rtD?= =?iso-8859-1?q?s6S5bMH1e4LnFA+Xdbt3f6HCUQGQXn7c8FqVA0QWpumQc4XqYQHxVkLBhtOC?= =?iso-8859-1?q?a+EDEZVHy5JD1sgT/uoBDQGEQDHtCc3oCcxL+AOtyw7ZnPpzSNvU0dDqbFMV?= =?iso-8859-1?q?SbyOKhDzWOgiAEzfCXjXVtzcHThvC8qlJfoZJDjn3DD3rV61a6Y8b4yuyMEs?= =?iso-8859-1?q?4e9cRGwHAQOQ0N9QudFGw+aKWRHl9jc0wKgB0mkgdW562mkG5cQuS+f+Myb1?= =?iso-8859-1?q?6ng+D/IJL3iPkfrkS46ZM/N7o+0fvEksDaqBFwEOI/263Ft18k2vKZIUZnCn?= =?iso-8859-1?q?+IWc11DfOfEcvUJ9PzzxoUw+dc9g4vcGhgEiISp1qOXMnAVzrM/er64T1biw?= =?iso-8859-1?q?Li8Dt+Cq5mI2y0/o/F7qn85oEoweSTzrl4dBstS7h0a774kppPN+4e1AkCXO?= =?iso-8859-1?q?VH26ep2EZoYL2+cNod2ciKMmsSFuMojtPB624pcATjQyzsLSugFbYvSdz8ed?= =?iso-8859-1?q?Gc7wF26bxdLIHU1vwJc99fO/Dt37jBWeEd4kjlUqGMvbrasaKh1hSZQNaARb?= =?iso-8859-1?q?iFjyOWtRj39K/UyZj/Hzbf7gqVs2HFkWfvPQEVDC0sODNhDOlOeHm+5oJXPG?= =?iso-8859-1?q?VuYTHVx9fg32Lr0IScW/eQ59hZiFlu+0jyRIa+5sClLJX07MgTFY5YF+Vzyb?= =?iso-8859-1?q?nkvxsXapZ35vXSsAyPppCa3wQB+qmv1ZiTjETYiQ4FrsucJtXGJOrzusXjC1?= =?iso-8859-1?q?katdduNhsi2XickmiuyH4505lGgSC4wHH86QwBdH2/RSNgMyp4Tv85FI8MgG?= =?iso-8859-1?q?yX56Vt53oQ0zTpav/MNSOGNeqkFOrI7DFc+Kd8MCmVSOlPJfq7XfKA52VaXf?= =?iso-8859-1?q?3sbqT+7A3FNL/lShyfVI60KQNtCJggMzAYipOr4Z2aKYSw9bQLznwWx1k1OV?= =?iso-8859-1?q?cI5MTmoUGQfbnXfw2zdAOLIAn7nieYV7LoCMaPzPQp+Pz427sciAUURe+t5o?= =?iso-8859-1?q?X+/xBlw4YTlZ2+Q0pAJVERm4ENZmoIG8GD/WhNb+u94ds8IhmPSy0/wgnvok?= =?iso-8859-1?q?cSDMUk7QK2Wc0lEWb8nzkr0GFZh8ERnY9sFHvRIW9l4ibxNtL70dtGBSQhsT?= =?iso-8859-1?q?yMhBw8eyoCDqUiLc1GIBIulJs64jyqf9iP/I9oHa7sIahvAXLy0hhsf7TNu0?= =?iso-8859-1?q?IoE+cPaa7YVC3qoDLx4Zyi0bxqySRumWDrwz8dmnBKwS29sbes0HavV0G1gx?= =?iso-8859-1?q?19FElHUWzD5tM9vwz9dYh2pbw+mWZRSMx1DbgQqCN9J8cLokCkaFtlwXxb62?= =?iso-8859-1?q?+8KXqjSHUU9TS/lI2wvOiqdfWM7H6iG7xELj72tfAf3ktL+jT3kXQ9r/gCAp?= =?iso-8859-1?q?Bn2JNyA5PCOJmwxesF6qQbtA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?phUf50iMRBLJPr0OMznGs+f?= =?iso-8859-1?q?VJfg/k4/nqB0fZkcPnyq26kzxrWOufvK+LhpKRZmbChLYXg3iqbJ0iT2NQGO?= =?iso-8859-1?q?4Dg+D7SQUNQjQyrVtCpM4g/lXqh/KHrc0wfPV+Yqr8tWT56E31FI0xMEjMHD?= =?iso-8859-1?q?ajYPrpFVU7hF1OTUIjWYSywGYOcPIbN6RYjUP+hl03xf1ui05DGPkhdNLvvu?= =?iso-8859-1?q?rFmAqVlt48oEc9uOVqAaBbo2G59DBe8NZ2IEF7KCz1kLBE3xIDPdvBJG05mB?= =?iso-8859-1?q?G6ROVDInE31tgl4166sK+dmBcuJwt7ckziiyd6pCFfQrInuE9p06197vHb+R?= =?iso-8859-1?q?G6AaHMQ/kl+Bezbpk2MmjFfQQXLRC1gF0U1BQ5dbrzAhT8+9ISzDMqa5Q9jV?= =?iso-8859-1?q?TRePQZRG2pG74taytVvS+iHZ0XrQ/bMHQveyPulTuP4dSwtbtPIyUVmPRbCk?= =?iso-8859-1?q?aW1hbSMX/OZHlHSmTHDJtwR9chCIBJQpKYcZLjmN6xckkNquDwzlpkF994hS?= =?iso-8859-1?q?pnX7xS09eCmHwRf2C2FuSJTLdOSRcrxSsOzrfb24MoL/ZbntGqtfwVaUiH2K?= =?iso-8859-1?q?de162G5Umr6LaV3RCYRcm2oTCzv2VEqAuocXBF7a8NtbV1CSg6AjaLdu0WOU?= =?iso-8859-1?q?tOJVvMBByrq2iTrjH4g4i0601As949hn2Soxn4dOBSM0JRdryoZoali1I4vC?= =?iso-8859-1?q?KkG6Mf0mM2Ld5nnYnXzMvs+4zHMJUUCBn92byCCu2SQQ4/Td73FynVfemsZw?= =?iso-8859-1?q?8Mz0tca5TvSo9sBOAZV9441BXJT/0aQs/woKwuHLSlTP9DReO0ll0hMTUwmg?= =?iso-8859-1?q?aEOs09n57wVO6W5mRqPKHZW1gNCaBW7xyFN/88Qw+OybSI4MStz3gbCBDbs7?= =?iso-8859-1?q?zHcgk7fVuTqjvSK7+THUQ6+AqrN8sLm79f8SwcTugh1GSI9oXV9nwA6TGseZ?= =?iso-8859-1?q?JTbYJVi7Yz+9vqVSE1Vtv7dK5xscu0Coxt4KqH0YVLxaAA08WD17q+mq1E3s?= =?iso-8859-1?q?wzr8GsbhVhzB5KzJMQlUMHP8UJJRhYjbfnFuwH+esO4CjWN2ny+vMkAFExy9?= =?iso-8859-1?q?yMU1jZ8lvixRHzekZ0t39esHZKBJ+amk81k8pn1Uq9MCVisX8GNgg1Netiwk?= =?iso-8859-1?q?EHOcIeyLFuycF3v6YkTW9WAM9d3Vy5/wkMzq0eGYctVvcAv7488NEkXs+WME?= =?iso-8859-1?q?OduEWZynkE3hqm2BSXjmr1r23WsX+GWDaFfuVTGsnCizomoU/C2VYBgXwCm7?= =?iso-8859-1?q?jo3LjPWREvJLTEA+mKIHMvKy3qOAY5++LsavyK6vpYn0bn+36LXoVAeFKxxj?= =?iso-8859-1?q?mBvw7XCB+HU75oZTWwU3lvGILeCSUvoWtTtfZqNusB/qiuXkR91CpI/OcW3/?= =?iso-8859-1?q?xrJV7mUPLrNdO6Uf7SCUBxpGuJNGIqBLa66DGR4IwLSchj02BhA3Rgx6sL4G?= =?iso-8859-1?q?hZLx69M6GnIE1l4KaBw96sQMsOrrZ6ZEIv0/UNAWAQ3kkcC8hx3kBXB5F6V0?= =?iso-8859-1?q?MJrlnGV/DYlQ6PKW5f4TFUppoPr+hMz3nwrQ/elYBZWzXKuCFJpaIv4iTqiG?= =?iso-8859-1?q?UXzFthuG74dC714CIT3gevVdy1eyUPsJGFS5B9iF6L7EzIQqqxIP0TwOrxQP?= =?iso-8859-1?q?shhbgdPZlFqOfMXBL4AV/qwfdyKQ1Jttgb6mhFQ=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: chsLKoQm+X0olRpCWpQKMkXGMZL0s+SrdKSI4GUfr+QqhPtNnHXsdj7I0wsYxvC/yJjkJSIN6SX3Dd/D1y2c/rtr1Jkk7fwPY+80Bct1ZnXaQZDuC5kEyUwXs2/NS2QS2tZf430Ls86Bsw9VJN6wWl3v2QE7X//ugTbjwzUdF4ux9C1vKe5QB5Bdavty9q348+JCzt8EQ0vuGdhfSDJ0ifoZBQzPL6UzLaIG/+g5giRZM2xYYK5RAZka9XS69e+qzxP3n4a5tL0rrRw3jO/wDJRV9DywBMBUyWqpirSXFpz19g2qbgqPyYureDXdx6YM2mBJ+lHmLiiV3UVkZBaoto2OEJUxPBz1Lzj06eMwcoumweZ3XY4J6z9WjCT4inC8DI4r7F89Td7bX6i6KrBNuh976vOLK513d7ra7BXnpsfG1kQGpTaHKbqvgeW9ywCs75idJaQvmz7h6Cw8c2jwzvBXJHyTAjVcTXYR2KWtvWFYuXQtL+ngXR3SfOWuaGFaHRr3FSf1cqXrr03e7L5ZIgHYfuIsqlZGW6aHZlUueJR8w4YZfVcON9mJyrTFbzXlKEyulDOxof+o74DK372QMyi621WhV78e2i8FlITVLH2VRnSTO6cGRhgqmL2NhSzi/Je2hP5ddw/UJKCt4dT55A== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5501b1da-e32d-4388-c733-08dd197b787d X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:33:44.9602 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: +Mlr7D4rc2Tty0ppT+YnsB1RM2EAy77MbBmnY73GdUo9j0WFPTojpDWn1NTWdoWE7wqJC6BgURHdxn5WqeXWpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=d+8PyQjE c=1 sm=1 tr=0 ts=6758dded cx=c_pps a=t4gDRyhI9k+KZ5gXRQysFQ==:117 a=t4gDRyhI9k+KZ5gXRQysFQ==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=qYIINIrsRnFWRYGy51QA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-GUID: 5MK5wF19Kyd7-hyrksLvpvWNPfq0fs0F X-Proofpoint-ORIG-GUID: 5MK5wF19Kyd7-hyrksLvpvWNPfq0fs0F X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=824 suspectscore=0 spamscore=0 clxscore=1015 adultscore=0 phishscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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 --- drivers/usb/gadget/function/f_tcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index da594767ba98..c6bdd6023588 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -948,7 +948,8 @@ static void usbg_data_write_cmpl(struct usb_ep *ep, struct usb_request *req) cleanup: target_put_sess_cmd(se_cmd); - transport_generic_free_cmd(&cmd->se_cmd, 0); + transport_send_check_condition_and_sense(se_cmd, + TCM_CHECK_CONDITION_ABORT_CMD, 0); } static int usbg_prepare_w_request(struct usbg_cmd *cmd, struct usb_request *req) From patchwork Wed Dec 11 00:33:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849684 Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 066B817C8B for ; Wed, 11 Dec 2024 00:33:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.156.19 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877242; cv=fail; b=RVwsqAZBNd6vjaEwupA5Y3NMi+4iYzcazBRgUznNKF4wBkSgGz9NdZZzoVOIYwy6VQWC3N5bjja5pynnmy3pBgwDWxFAjjPblNX6JdkJANy8KtwQYZ0eJ0+d3CCYP9MhN0IdUaa0VUAtCoA/kMipc0hZCs4GjaF7g4aIEFESiic= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877242; c=relaxed/simple; bh=Lr15AbdgDncZ98FAo+OWYqHL624Iax+ytDIK1SHQ5p4=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=ShMDRhbGTqYPDeyf6n8VhG81CxT+NJ93y+eDEyzXz20KbnZszyPacEk7vzy5c0Bmh07ocRC+N7+DZ+LOAc364oWZkmY6lwZZ+GfBFc0RvFLGxRkCioIPsMpoRn26gZnDgwoVJQftdz1i5KncwKHUrudqay5aOHbf+p2rqesbAE4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=nLL5kMGz; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=lDv43Z4l; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=NcqEgnjI reason="signature verification failed"; arc=fail smtp.client-ip=148.163.156.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="nLL5kMGz"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="lDv43Z4l"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="NcqEgnjI" Received: from pps.filterd (m0297266.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAMVk65010832; Tue, 10 Dec 2024 16:33:55 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=klS7lpgVmvLHoVeehrhlIaompsbJx6W9uWqzgEjmnLA=; b=nLL5kMGzsx/h 4ccum1H88qtuUlU+RbQrmKSRBrseBEAXLluHfBHcdfaAYZhaaykKzywSDJ9CKE87 oB9D5bXhm66mnf5R5en9DwP8BAeIFuk4Mm8g1TrpKzhFxJkgu40mSAMcLRF4fskg pKaDhEPBqwwMN/lFcmhlT7Afm1eTXT4yHsU+hhyyWAl3zX79cxEjJT+6y37htudh +x9+e4sMytnC7SbWTPqfI1+eBDCJ7JdlBEg7AC4ebaciuQ06UtMfk7QnREAj356N WZDcFHsD6Hnjb7VBD5G4ejNBgftFe0h5Yf7L85odsqcnc0qRijnMR+DG+e25l1m5 hh7xDdN8jw== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cpgb9q3w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:33:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877234; bh=Lr15AbdgDncZ98FAo+OWYqHL624Iax+ytDIK1SHQ5p4=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=lDv43Z4l7UdzSwgTKsRCYEWB6VoF/H88xCmqGu3mBRLLfV8h5AzWIISAl6VpGJmx0 TDxnRd1AHHpo3eifo1UXjV2cFWOp/+apFshsLWgIzO6ikgEteojqpeJiLgElYQBfB+ Bp6IREfL4mvWRIi1dZ/levOOmlzKE4wr8N1+Km30CukMx8cwqa8OWL5rH0bHW7qc02 oQoBPgNcwYVLWNhDDdoh5hP0DI+c7VFl0H8Fg0wHw1X9hvjeJvtARUhhqOHZzJXqkJ 7D5bdRsp5qsCUB/p/7FPx6jo1mcXb1Orz3KoVKzlj9UbFUGJBKGza5nUo5E6nwWUm7 SsMjdQ7m5RCRw== Received: from mailhost.synopsys.com (sv1-mailhost1.synopsys.com [10.205.2.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 1D776401F8; Wed, 11 Dec 2024 00:33:54 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay1.synopsys.com [10.4.161.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id B798EA005F; Wed, 11 Dec 2024 00:33:53 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=NcqEgnjI; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2046.outbound.protection.outlook.com [104.47.66.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 67EF1405EA; Wed, 11 Dec 2024 00:33:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lQCm9gfoFt0KVbdmUbGhz7X32SrfzeMr9e8vugR9GZPl4y4m5gCUa/3/bnxlHTuBoVWLBh504GavmxXuHeH8idMItrRfgjL+gnWs3czHCO+/BJqsyV4l7bYtAvKXHMI4Yac5iCoWOys9c3LBiMB4UhzDxgWO5I8RCuoOGBc+5Kz/IXHKDpWHdA++J6WHtrmD7UMpANzqiYnFI0gPmvtmdcojYWQwFkjE429jyNURmOEHMwMLPxeNYlB72F3sEkcKaFVN7pFdOVQ8CRMifZQ0A2CIbxrxTYBAFv/DaxzI31YIAEsY+i0WN3Hkmr2SFvRokEII4QlGAE10gUj4sCYXhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=klS7lpgVmvLHoVeehrhlIaompsbJx6W9uWqzgEjmnLA=; b=Pwpa1/niLwyld4TfUyuWGQWmnxOFaHem0klEthOlP6ZUvguegbBKIC2x9TiUX9mVDATTmq9mLb+WSVpy0kfYnQbrG9SbQhmdsluMeE2iTS0FuBnVtp73xwm3yqqrzxafq+6TTc0lS1uK+iBR/A/zdsPnqZkNB1k/yWQMqZkXKJewV+h3N9gkbFRJIxrGNNHNmjqqedBP52oU/fENuQ+ibfymdAV83nmCugCQV4HEq8k5LW58wROF587vwOF8VsR7FYFmlepNnzJiXZlCrLRwsGdKwqPSgZRn/5JlElxl8PeEo/sQXPQr36fcwfPMeaDJIJ7ZR4q/8c+b2XJWwFhebQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=klS7lpgVmvLHoVeehrhlIaompsbJx6W9uWqzgEjmnLA=; b=NcqEgnjIOqw9mVlElJvqRoC8ca01NV+qtCCh62HwVxARPlZao95AI8W7WzxDVLvUODXxMbNopoiSPSdihlMSE2nfat5sENu1quL0lohEuqDy5n4hCEe50FH00p27ETg+J7gCntX4ROGltNG3+NsLlGSq5GUH5pSPWDinKOGC1Xg= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:33:51 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:33:51 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 23/28] usb: gadget: f_tcm: Handle TASK_MANAGEMENT commands Thread-Topic: [PATCH v3 23/28] usb: gadget: f_tcm: Handle TASK_MANAGEMENT commands Thread-Index: AQHbS2RZIqz1YKbGoEi+NnLha4u+vg== Date: Wed, 11 Dec 2024 00:33:50 +0000 Message-ID: <50339586e36509dadb9c208b3314530993e673b6.1733876548.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: e77703d6-3d41-437e-a1cd-08dd197b7c13 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?znoP2vOeJaABCckVQnslBZtPNP?= =?iso-8859-1?q?/hK3f/XZJ5XyAeJ/fh01GMv8SUOkTobGlOJm7oKK19DnJjshOx689u76y1aM?= =?iso-8859-1?q?Md99+LuGFulv7l4JCn23v1/sE+nh/fyIsEfaqyN/R08CV0QvR4vdnHsM6/ml?= =?iso-8859-1?q?Uec308Ny30L5Ao+o58FkwAnW+vLOmayz80/Yz8XvJF780xbWpMD71YFVjoaB?= =?iso-8859-1?q?jSarETktP47VxQMJ0AJ9JOZxwwl9dR8gorFT+nfB5EUwVmJ6UU93j+i+oagE?= =?iso-8859-1?q?RTRRyKAQVtmeo8/z5LltbgH6/HZcDeZHkuePysKiW1ILok1jbHRXevPgKaOi?= =?iso-8859-1?q?kTnQXcYvpaieOAdSpVDhqWhDf/iP3HiLsC3x34SCOaQMlrlF26eXbQPkVj4+?= =?iso-8859-1?q?1OwkefX2kyfgYJ2i0M7g9SdfomVYo2eBV2RiKtFreMymxy0pT7vx3mIczfkE?= =?iso-8859-1?q?EVF5dUjsfEmdu+0WEDiGIh2LoiPFv6/jDqHAEY7Wer1+yq3PRrMfhnhpK7XN?= =?iso-8859-1?q?V1/+TyfUYDU7MNyzCIKdy3nQI8b7/inh5MMA0qd7/Fkg3tOBldh2AQsGO75o?= =?iso-8859-1?q?jwfRcHYueu35wlXDJGpEp+DSrd7oncAocPMTsEc3cpWo8MKTjyY7oHS3mJZi?= =?iso-8859-1?q?Ln+VJQj1s2xpWXLTj3sxonf6m2XGQs/4XPJVgsHi72gCXAKy3emCFDaihlu9?= =?iso-8859-1?q?uJP4jwVmZ1XH6nxo6cbKKUUFUgPRAqMMElXLok8wDW8uCYn/ZYRXybA7Fr1m?= =?iso-8859-1?q?4YaRdctBztJleO9AdzQCIBrsjWmRGmOH+DKQuDz0i4Qc9hcRx843JkdnJrUG?= =?iso-8859-1?q?JQFPXy0yPqYbAW/+pzPyCZBwXftr15ECzidcPvcO9AFYWa7ZLvoe+3YkCNDm?= =?iso-8859-1?q?kWO8mt0WWPou+4Uni5C7sbyNctQEpNBun8u/oGB2uES2lD1ojXh1oBeHe+7S?= =?iso-8859-1?q?Rq+bZxbe0r8y0AT15XKP/0Gm+xQ1Q80VeiWHAwSi4G8sRgOQZm4PsCmsDP1L?= =?iso-8859-1?q?ZlerV+f2NJftnnpVvp/R1r4h6XcP53tUWneeu+RLpAdviemqIwMXfjOMsXwD?= =?iso-8859-1?q?YnEI6yxdPZse2MZGmzmHPa5r/wrzyx2mN2Nz8AAMjmgPGoB8sd8RoTxr1dE9?= =?iso-8859-1?q?jGEyJRBE7cWl8gxvk1IkfiZOY28SMv7UcaPsiI9f/2SCDeTc3G1/dj4TyAs+?= =?iso-8859-1?q?VfknAF2OA1occ8ywsQQi2n1ZFfNBv8Ixy0YI/7LqpcMQXck2NeFyRC46kGPT?= =?iso-8859-1?q?jDrq1OffKuq355NdwHbiN6TZXhl/ph/ihQqNpweTafjJPkVgFyAC1nSqvPVV?= =?iso-8859-1?q?8g9upBFa/h6xo6oOXGuunfJPm14yf3vvmhhti8y9BOCyYaHLakE7q0aorcn1?= =?iso-8859-1?q?Jp4FQmnZcWglLdI3qQmyy/68W2era8t+3b2PkaPFwc8eLeE731PE1UU3lun1?= =?iso-8859-1?q?Lo4yGPaygxfFfegHQwbur0FQ=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?FpyWK72DzxNwFvq8I3TNuaj?= =?iso-8859-1?q?S6Ktm7rs3SCF8Vvt7px0Uy8TZ2l1LjwfeE5IJww2LLQfF7Nn8AbJCiXZuOjd?= =?iso-8859-1?q?QZSgMA/T5gPtzVOMrRMWFAOudgS+AFShCgiBd2csiIxDkVY4qLTDgCcHilZk?= =?iso-8859-1?q?9TMZr5WwIeoNZKWNX0ZAiZLMRp69osvIgsHfxxKgpNuIT0I4bPtjs5ZuQyoZ?= =?iso-8859-1?q?Y2rOO6UtmV6VDVuZXYgxSZfM408Uz/sh/HWd9BuiHMnroIDBdgNhv0ou+i2+?= =?iso-8859-1?q?l1BdoYqiBvwoANSvLC3pbfD7yurjE98+LSNc1VzMTcp9JNtYn9oosNQz0Bya?= =?iso-8859-1?q?ZjfJuF0ExTgMFwNTbN/5XQ8ESb3blVum6TRNHUVuUbLj6Y7qs8x8ZTAxTYkI?= =?iso-8859-1?q?W151Rm2SpzDvgZ4XjJndTenTH3DiFODJqM+JjQr3Yt5jgmIqIfT/jYo7IQFs?= =?iso-8859-1?q?Qs1IoywYSePK8SFSOk2Kqgqqqn228p1onr9bBxlpNVWzHoL+jz787SB8aWzj?= =?iso-8859-1?q?mABaNrvAg6tcDCnGuJ5WLqy6Rh/Aq5Uk1kki76bdQnKaetbJnyNy72dc6ecc?= =?iso-8859-1?q?LzQmuaRWQbfgnk6ky6gxyfOtJtqL6fOyhZixLkbbhwe+fsRS/K8ALgOIWEuP?= =?iso-8859-1?q?HDIKtppiSxuFCHUUcbRr2oZkM4vY4f8OsIN4dYWDs45IqrnNnBb2pjVvRuxO?= =?iso-8859-1?q?jhwfa63cEay6SSN/Cu5yXAzzhVoL81oFfCmuAwrmhJcdx6F1xjy17CjZFtWc?= =?iso-8859-1?q?NDN0xEPivjAnSw/1q8XSIuKntZ6g1nXkcmkhh8jHXx5FSrj/EUfero08xM/i?= =?iso-8859-1?q?n9fr0412O+T8fLjtcpLfhtD7l7ZbKH+CXZZAFbWi6km4Vj2d7Wi/2RKZAE9E?= =?iso-8859-1?q?BHrlB79O2UDjAhDSBHEhFeQbfo2fZuH4SOPhghRDMF+xYZh4WtZmpufH9NtF?= =?iso-8859-1?q?P2ihx4H4iwFIvUqgrHA8sXGPN3NHZAknpLnPFiuzyMOzSES8r/1dJzETGRKs?= =?iso-8859-1?q?jlD1+zjpiH6lVDyh7RB5ikHeeoV0th6yANTmnpX+cx9yPnJwI+pqBdufBnml?= =?iso-8859-1?q?nam6FZDgWjukp8deCxq7OHLPCo/K6gQjixtdZ1tA0Ym4OycSi536NKI/sHZd?= =?iso-8859-1?q?CxlASYzmg2lTofK73boVozB2ktLy8WnKUWE/m2EuY2PS/pxsjSG2Z0cFaDn4?= =?iso-8859-1?q?rmfWnahMhurf/IX7dPIzq+oPyiRKlQVf+fn6IhkMVmuBAZH2nBlXz9JgtY1c?= =?iso-8859-1?q?jAhVRmCZMM9ucuenQ6ywgwLb9dZyDsCqa/BFqi7sNNnMOZEj5iyhwhJIQvu+?= =?iso-8859-1?q?k68yLKOIr+WlVxBkdhW2oprnrjX9UarZmQuZ8lKp5jH6Q5EU3inLs1sTLuYI?= =?iso-8859-1?q?xlaK5KUDbHvbszaFfi+5zgrFDyET1QgHOPFrNSNUXOrnG4K7gbxfsTYuQCrX?= =?iso-8859-1?q?ACUD5iEH5B/MXzdGjiTBhGSvPzD76fzQJ420N30Q/AtY+D7UEv2FFEtjhVo3?= =?iso-8859-1?q?/GCmtEpCmb/QlccGi+q8bDk3XtLzvxXM1V4nEF4VePFXXxT2iOELNkvfayvi?= =?iso-8859-1?q?1V7zpiYZJa42l3E/NWxm7VT784Q7l8WsqLdXcg/YqyO9SUJ8V+NV7wVHW9cw?= =?iso-8859-1?q?zeqIF0Any8lqfi3xGdFUZBdJKVNMCI7f3Usi5FA=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: j9XT/shZF6TwZKAlkgOiDq3Qk55nMZ2G/X/lfa+2Q1gz7Mp+1vHtuWey5zY8RAkV3+YRB68s76NDIJ8Grf124ZI7PSqjAOO93dQmAiYuWf+oJYnYwv26fzK1g+ADYrwnXh8htVvcmMmqIuHxcVco2lR+hQPtP/SZnhaDmjt82mXriQvAxBG2/jzIERpUBckG5ocEvqs8TNztt2NtNJdi/TenugMIN0vJ1P8oFm6EG/KE4EOVCGERuSd+MEIx6xhIqHSJZ2SZEK056DmSeWMhK/Vs5JuYGjDMZGY7xuxFPPvnZmeJxq6lW1oT/1oa/EPwb+MvlCZ6v3WsErCTqwaKEkIVBwPXwfVRMwf4r7XXbaZ6o+T/CUh9fFtE/S07w0zhc66pWnZtHt1O6ml8TfJR1U6gwm/EfD9jun7Pa9O73FvNzhBi65UH57Dg3366JWo+aJy7p0pwZ9TRoOQE3sHQwVjN4Uny7xE2sa1OI+fuKHu4FgIQHUWb0j7ifi+zzzsGNWOBsBEUulLh800e3cNhILVwCuRuy4X2EKhDOJH5/j+NdBpzpO5tE0qp6yPz0qAmZWG0xoqV0iO6iupke02BP1pJyk+pz/BQ9uzI//URyB3u+soq4gYJ81wwl7GhT2s7zkjcgtu8UPx/TnmCSPopQA== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e77703d6-3d41-437e-a1cd-08dd197b7c13 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:33:50.9757 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: KN5uQLXF04ZJI8/A6LH0EHI0hyW4PmhOMLE17i24RcpOTjppGyTLbA2RYE9ylDusvja8AYdRiI8isgN8qqHeSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=d+8PyQjE c=1 sm=1 tr=0 ts=6758ddf2 cx=c_pps a=t4gDRyhI9k+KZ5gXRQysFQ==:117 a=t4gDRyhI9k+KZ5gXRQysFQ==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=mpyWSJtGwHFLCFruFkwA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-GUID: aBHDLRwi63KrAtPDE3QwFxOUcKee0Zwv X-Proofpoint-ORIG-GUID: aBHDLRwi63KrAtPDE3QwFxOUcKee0Zwv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=999 suspectscore=0 spamscore=0 clxscore=1015 adultscore=0 phishscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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 --- drivers/usb/gadget/function/f_tcm.c | 220 +++++++++++++++++++++++++--- drivers/usb/gadget/function/tcm.h | 5 + 2 files changed, 206 insertions(+), 19 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index c6bdd6023588..3e04ce40a4a0 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -449,6 +450,45 @@ static int usbg_bot_setup(struct usb_function *f, /* Start uas.c code */ +static int tcm_to_uasp_response(enum tcm_tmrsp_table code) +{ + switch (code) { + case TMR_FUNCTION_FAILED: + return RC_TMF_FAILED; + case TMR_FUNCTION_COMPLETE: + case TMR_TASK_DOES_NOT_EXIST: + return RC_TMF_COMPLETE; + case TMR_LUN_DOES_NOT_EXIST: + return RC_INCORRECT_LUN; + case TMR_FUNCTION_REJECTED: + case TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED: + default: + return RC_TMF_NOT_SUPPORTED; + } +} + +static unsigned char uasp_to_tcm_func(int code) +{ + switch (code) { + case TMF_ABORT_TASK: + return TMR_ABORT_TASK; + case TMF_ABORT_TASK_SET: + return TMR_ABORT_TASK_SET; + case TMF_CLEAR_TASK_SET: + return TMR_CLEAR_TASK_SET; + case TMF_LOGICAL_UNIT_RESET: + return TMR_LUN_RESET; + case TMF_CLEAR_ACA: + return TMR_CLEAR_ACA; + case TMF_I_T_NEXUS_RESET: + case TMF_QUERY_TASK: + case TMF_QUERY_TASK_SET: + case TMF_QUERY_ASYNC_EVENT: + default: + return TMR_UNKNOWN; + } +} + static void uasp_cleanup_one_stream(struct f_uas *fu, struct uas_stream *stream) { /* We have either all three allocated or none */ @@ -552,6 +592,61 @@ static void uasp_prepare_status(struct usbg_cmd *cmd) stream->req_status->complete = uasp_status_data_cmpl; } +static void uasp_prepare_response(struct usbg_cmd *cmd) +{ + struct se_cmd *se_cmd = &cmd->se_cmd; + struct response_iu *rsp_iu = &cmd->response_iu; + struct uas_stream *stream = &cmd->fu->stream[se_cmd->map_tag]; + + cmd->state = UASP_QUEUE_COMMAND; + rsp_iu->iu_id = IU_ID_RESPONSE; + rsp_iu->tag = cpu_to_be16(cmd->tag); + + if (cmd->tmr_rsp != RC_RESPONSE_UNKNOWN) + rsp_iu->response_code = cmd->tmr_rsp; + else + rsp_iu->response_code = + tcm_to_uasp_response(se_cmd->se_tmr_req->response); + + /* + * The UASP driver must support all the task management functions listed + * in Table 20 of UAS-r04. To remain compliant while indicate that the + * TMR did not go through, report RC_TMF_FAILED instead of + * RC_TMF_NOT_SUPPORTED and print a warning to the user. + */ + switch (cmd->tmr_func) { + case TMF_ABORT_TASK: + case TMF_ABORT_TASK_SET: + case TMF_CLEAR_TASK_SET: + case TMF_LOGICAL_UNIT_RESET: + case TMF_CLEAR_ACA: + case TMF_I_T_NEXUS_RESET: + case TMF_QUERY_TASK: + case TMF_QUERY_TASK_SET: + case TMF_QUERY_ASYNC_EVENT: + if (rsp_iu->response_code == RC_TMF_NOT_SUPPORTED) { + struct usb_gadget *gadget = fuas_to_gadget(cmd->fu); + + dev_warn(&gadget->dev, "TMF function %d not supported\n", + cmd->tmr_func); + rsp_iu->response_code = RC_TMF_FAILED; + } + break; + default: + break; + } + + stream->req_status->is_last = 1; + stream->req_status->stream_id = cmd->tag; + stream->req_status->context = cmd; + stream->req_status->length = sizeof(struct response_iu); + stream->req_status->buf = rsp_iu; + stream->req_status->complete = uasp_status_data_cmpl; +} + +static void usbg_release_cmd(struct se_cmd *se_cmd); +static int uasp_send_tm_response(struct usbg_cmd *cmd); + static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) { struct usbg_cmd *cmd = req->context; @@ -590,9 +685,23 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) break; case UASP_QUEUE_COMMAND: - transport_generic_free_cmd(&cmd->se_cmd, 0); - usb_ep_queue(fu->ep_cmd, cmd->req, GFP_ATOMIC); + /* + * If no command submitted to target core here, just free the + * bitmap index. This is for the cases where f_tcm handles + * status response instead of the target core. + */ + if (cmd->tmr_rsp != RC_RESPONSE_UNKNOWN) { + struct se_session *se_sess; + + se_sess = fu->tpg->tpg_nexus->tvn_se_sess; + sbitmap_queue_clear(&se_sess->sess_tag_pool, + cmd->se_cmd.map_tag, + cmd->se_cmd.map_cpu); + } else { + transport_generic_free_cmd(&cmd->se_cmd, 0); + } + usb_ep_queue(fu->ep_cmd, cmd->req, GFP_ATOMIC); break; default: @@ -616,6 +725,18 @@ static int uasp_send_status_response(struct usbg_cmd *cmd) return usb_ep_queue(fu->ep_status, stream->req_status, GFP_ATOMIC); } +static int uasp_send_tm_response(struct usbg_cmd *cmd) +{ + struct f_uas *fu = cmd->fu; + struct uas_stream *stream = &fu->stream[cmd->se_cmd.map_tag]; + struct response_iu *iu = &cmd->response_iu; + + iu->tag = cpu_to_be16(cmd->tag); + cmd->fu = fu; + uasp_prepare_response(cmd); + return usb_ep_queue(fu->ep_status, stream->req_status, GFP_ATOMIC); +} + static int uasp_send_read_response(struct usbg_cmd *cmd) { struct f_uas *fu = cmd->fu; @@ -1016,9 +1137,23 @@ static int usbg_send_read_response(struct se_cmd *se_cmd) return uasp_send_read_response(cmd); } -static void usbg_cmd_work(struct work_struct *work) +static void usbg_submit_tmr(struct usbg_cmd *cmd) +{ + struct se_session *se_sess; + struct se_cmd *se_cmd; + int flags = TARGET_SCF_ACK_KREF; + + se_cmd = &cmd->se_cmd; + se_sess = cmd->fu->tpg->tpg_nexus->tvn_se_sess; + + target_submit_tmr(se_cmd, se_sess, + cmd->response_iu.add_response_info, + cmd->unpacked_lun, NULL, uasp_to_tcm_func(cmd->tmr_func), + GFP_ATOMIC, cmd->tag, flags); +} + +static void usbg_submit_cmd(struct usbg_cmd *cmd) { - struct usbg_cmd *cmd = container_of(work, struct usbg_cmd, work); struct se_cmd *se_cmd; struct tcm_usbg_nexus *tv_nexus; struct usbg_tpg *tpg; @@ -1059,6 +1194,29 @@ static void usbg_cmd_work(struct work_struct *work) TCM_UNSUPPORTED_SCSI_OPCODE, 0); } +static void usbg_cmd_work(struct work_struct *work) +{ + struct usbg_cmd *cmd = container_of(work, struct usbg_cmd, work); + + /* + * Failure is detected by f_tcm here. Skip submitting the command to the + * target core if we already know the failing response and send the usb + * response to the host directly. + */ + if (cmd->tmr_rsp != RC_RESPONSE_UNKNOWN) + goto skip; + + if (cmd->tmr_func) + usbg_submit_tmr(cmd); + else + usbg_submit_cmd(cmd); + + return; + +skip: + uasp_send_tm_response(cmd); +} + static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu, struct tcm_usbg_nexus *tv_nexus, u32 scsi_tag) { @@ -1085,34 +1243,58 @@ static void usbg_release_cmd(struct se_cmd *); static int usbg_submit_command(struct f_uas *fu, struct usb_request *req) { - struct command_iu *cmd_iu = req->buf; + struct iu *iu = req->buf; struct usbg_cmd *cmd; struct usbg_tpg *tpg = fu->tpg; struct tcm_usbg_nexus *tv_nexus; + struct command_iu *cmd_iu; u32 cmd_len; u16 scsi_tag; - if (cmd_iu->iu_id != IU_ID_COMMAND) { - pr_err("Unsupported type %d\n", cmd_iu->iu_id); - return -EINVAL; - } - tv_nexus = tpg->tpg_nexus; if (!tv_nexus) { pr_err("Missing nexus, ignoring command\n"); return -EINVAL; } - cmd_len = (cmd_iu->len & ~0x3) + 16; - if (cmd_len > USBG_MAX_CMD) - return -EINVAL; - - scsi_tag = be16_to_cpup(&cmd_iu->tag); + scsi_tag = be16_to_cpup(&iu->tag); cmd = usbg_get_cmd(fu, tv_nexus, scsi_tag); if (IS_ERR(cmd)) { pr_err("usbg_get_cmd failed\n"); return -ENOMEM; } + + cmd->req = req; + cmd->fu = fu; + cmd->tag = scsi_tag; + cmd->se_cmd.tag = scsi_tag; + cmd->tmr_func = 0; + cmd->tmr_rsp = RC_RESPONSE_UNKNOWN; + cmd->flags = 0; + + cmd_iu = (struct command_iu *)iu; + + /* Command and Task Management IUs share the same LUN offset */ + cmd->unpacked_lun = scsilun_to_int(&cmd_iu->lun); + + if (iu->iu_id != IU_ID_COMMAND && iu->iu_id != IU_ID_TASK_MGMT) { + cmd->tmr_rsp = RC_INVALID_INFO_UNIT; + goto skip; + } + + if (iu->iu_id == IU_ID_TASK_MGMT) { + struct task_mgmt_iu *tm_iu; + + tm_iu = (struct task_mgmt_iu *)iu; + cmd->tmr_func = tm_iu->function; + goto skip; + } + + cmd_len = (cmd_iu->len & ~0x3) + 16; + if (cmd_len > USBG_MAX_CMD) { + target_free_tag(tv_nexus->tvn_se_sess, &cmd->se_cmd); + return -EINVAL; + } memcpy(cmd->cmd_buf, cmd_iu->cdb, cmd_len); switch (cmd_iu->prio_attr & 0x7) { @@ -1134,10 +1316,7 @@ static int usbg_submit_command(struct f_uas *fu, struct usb_request *req) break; } - cmd->unpacked_lun = scsilun_to_int(&cmd_iu->lun); - cmd->req = req; - cmd->flags = 0; - +skip: INIT_WORK(&cmd->work, usbg_cmd_work); queue_work(tpg->workqueue, &cmd->work); @@ -1270,6 +1449,9 @@ static void usbg_release_cmd(struct se_cmd *se_cmd) static void usbg_queue_tm_rsp(struct se_cmd *se_cmd) { + struct usbg_cmd *cmd = container_of(se_cmd, struct usbg_cmd, se_cmd); + + uasp_send_tm_response(cmd); } static void usbg_aborted_task(struct se_cmd *se_cmd) diff --git a/drivers/usb/gadget/function/tcm.h b/drivers/usb/gadget/function/tcm.h index adf4c415140f..d37358f09819 100644 --- a/drivers/usb/gadget/function/tcm.h +++ b/drivers/usb/gadget/function/tcm.h @@ -85,8 +85,13 @@ struct usbg_cmd { u16 tag; u16 prio_attr; struct sense_iu sense_iu; + struct response_iu response_iu; enum uas_state state; + int tmr_func; + int tmr_rsp; +#define RC_RESPONSE_UNKNOWN 0xff + /* BOT only */ __le32 bot_tag; unsigned int csw_code; From patchwork Wed Dec 11 00:33:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849683 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8359422339 for ; Wed, 11 Dec 2024 00:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877246; cv=fail; b=B44zT+ABm5wCmnO/kcGg8r/dV2F9/wYrUGDTiqWnm4dHYYhROTiPgR8S6ITP6HkteD6pxFGVJ+KioDef2NK+r8SpoJ8top4fPMmKOLu3QfPpNAesrdC4MFI8RviOjWTKQe1qSTVkNtPIOTy3UjnWPMCPkDI4crcjvCXqPuv5tgE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877246; c=relaxed/simple; bh=dbAQUnC1izYOFoUbny3aT/bLDQGwx6Jqor3LDPMZkYk=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=Q0VXry/DrSHVz0W7E5OXvpeLGuC5gT74Cw9r26v5HyI4VRgfg6KG7xlvtXQ8gB3MGOk8yJ3fPs4NXus33uexWbQhdx/QNcAqsqo9fMV2FQD/uY6S3ivs1Fe3Gj0ksC8u1umW3sZpZRsNpIvLxUF5wgtlYcAOBpkv9DSN9oY+Sm8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=saDVUjKn; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=EY5WWDdK; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=XsskEE2L reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="saDVUjKn"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="EY5WWDdK"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="XsskEE2L" Received: from pps.filterd (m0098572.ppops.net [127.0.0.1]) by mx0b-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAMtPgY000581; Tue, 10 Dec 2024 16:34:01 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=3Z4QLJrjh7iu4dKRFZjUzlHhnmWq84RJWby0PHV7H90=; b=saDVUjKntyMQ KAbRjq69oExSt66uVe2FF79MfHjbxpeml5jGdpbSVXAWuspZQ6yNKpdB7QCYRAtB B0JOowakpeBhgyni9m96O6r+cihYJM6QHg/Kc/PZA3OrACOWzqWQmbUWwQt+DNlN dn+NwOSZoes18RP+L5GrflZbQMG8wURxtYz1c8qbNjJnG3HmCsQPk+3qjaND5nPg yqazVw1W47aCkYtCbGJU0h0NeP92bnV8hPrPAV/Zqw7SgMTqa4BffJXyTYuw1PBm FlxfjKEZ1so1Xn4uTb8zmpuq+442HiU6itwJ3vf2dfReOz5bTxW6caL5FMmaQkz8 Lcef5jjnBg== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0b-00230701.pphosted.com (PPS) with ESMTPS id 43cnvka1b3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:34:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877239; bh=dbAQUnC1izYOFoUbny3aT/bLDQGwx6Jqor3LDPMZkYk=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=EY5WWDdKQ/vJ/N1dmuqAuBZ5FPRGcc6vehja4+lHp1rP1INTR5hEcJPMO1mqvo9y0 w20c6r/Sxuq0s+YdIwIAKMqRPYxg9UAlmWqUHY96WzIG0v1AfLx30kMwuEmaWJvZWz zpIlx3WXcjV9BwyGlxA7LerjrDTVo9W3zSoYoLuGPaFYuvANg33pA06EtrBpQvKUoX e27cCeDPQjI4yxmsvkxz0XX1FlQEGSnV9G8oHAJBSUjsjlVi4B/IE50QXMg+X9BpUQ bt2ryJXtPkJr4uVBeJGP1LZgoxwSYD3KtnANWpO13pMnEukXRWEUjXh9Smh5a2YHVn GKb6/RaSktJTQ== Received: from mailhost.synopsys.com (sv1-mailhost2.synopsys.com [10.205.2.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 9ED92404CE; Wed, 11 Dec 2024 00:33:59 +0000 (UTC) Received: from o365relay-in.synopsys.com (sv2-o365relay3.synopsys.com [10.202.1.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 8E31AA0078; Wed, 11 Dec 2024 00:33:59 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=XsskEE2L; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 463DB401E9; Wed, 11 Dec 2024 00:33:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m1dBfOGKkSpDTHDw2YuUk9QW2+d9Q7u8g3F+wcAfaafzQQCj3H0l0+G04a03+UaOt/KPt9N60P8OY+Ts1GtZBB0MXPWmwvuurPsGR/kswLd/RDA6LtCXDztVJxezs5JoJpW3ZP+JGLxoGBb208sU2gtWL8eA9mehIFYRl6k4y19rY9aqgfGi0XTWtYVFfldeBvKnbrBtpTavA3nmso5rfcrmHAx5l+6bospEAdppLIkHl+XfrjgVxl8E9sWoFxn+AyoOtmraHqAdR/TK9JCXiKVODJe7gnGgDm4EE9EGdNu7QnOiMoLsL2ed/q6X1eioKmvA98q0UY1HCjr75t36gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3Z4QLJrjh7iu4dKRFZjUzlHhnmWq84RJWby0PHV7H90=; b=rmr2cxoAi2y3gZiUYux0TXRhk6Fs/VELA+8nimL1T3KOy3tpuKIbtDhSbB8hXrbAqizbvJe+0aTESfSyhQgsGY2GzIEmFREBPkDiMba39WObic29aG+7Hm3JwuVZvPeB4VhB/RHmsePoRycukJTxsKBwLTJb3PUem0//GIHgo5DW2NOHb/cfaumzaXwOQLN5kcglX7rU++6zwbaCqsXc4yKqZ4/oRdvn57AREpVu0rg6MFegeznY9pelGl9LnEPDEYh0EAMJasGfzfW/V9VOuFVuBEHI5VckvfJGhb3/DJkNepSso8U+QygPPk1a5UTxkg19iCIRnqzfR0tKyD1Raw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3Z4QLJrjh7iu4dKRFZjUzlHhnmWq84RJWby0PHV7H90=; b=XsskEE2L8TS30QjzhfWDrn1ebarqxMnAjF840dEs4+98sUOo8TBrVKpyK97VpCpyY/7NsBrLKO4GqDVi1SbGxYJB4K9nhPeIxT8FyA44FSpp1YufYFMwy7up8Dnv5qzy1hhnjtf+z8HdTsjtUTIvRWVpB/Fqo7VydmGbhQ6y/k8= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:33:57 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:33:56 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 24/28] usb: gadget: f_tcm: Check overlapped command Thread-Topic: [PATCH v3 24/28] usb: gadget: f_tcm: Check overlapped command Thread-Index: AQHbS2RdbqcIeOJElUCGpUAsYUcPKQ== Date: Wed, 11 Dec 2024 00:33:56 +0000 Message-ID: <6bffc2903d0cd1e7c7afca837053a48e883d8903.1733876548.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: 6c815565-ff78-421c-4815-08dd197b7fa5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?6w2STqr/hP5rl0n0p7ZzQlIBTE?= =?iso-8859-1?q?kGVC2q6+uKfCja3ltk8wwcBEL082cbGhxt1cwJHl8ihLSIAwfl5lmuUh2RAB?= =?iso-8859-1?q?voyIj+QK1H0tjKo++5gUU4fWMN4X6YdpiMbt7/GxMjRR1rhmrUWfANjtwDLr?= =?iso-8859-1?q?9NZLWR8z3AXeQNVNbkOVyc1LWPe8+DANUgu23qVV1CFFwimfgu6s/8QASHQh?= =?iso-8859-1?q?/5mpimHBLn7eJ/gn42ysJQc8rmz4JhVMOPIm6jmZZEZUb/wz6vDNFfb3643F?= =?iso-8859-1?q?Cy97Omnibyp+j6LHAa6giefjocn4q70RDR2IwPDKsWXMXX9eYG9eAKMx5vl2?= =?iso-8859-1?q?U4MTF7HItWio5rjoJihQAzAS0nLKQlw4SWHe9iRUb2sh1d2u8Z0yrRnBSlOa?= =?iso-8859-1?q?uahuNfgZk9ENVPOo68UZ/fLN7hjSsfr1vLwPSZT+XfyIXG5U+gTr+kNKY9uz?= =?iso-8859-1?q?OuSGqP2bU/GqkWKFof1wsyGMm40sQS3cjISIvgLTKVLLRstUUSV+f16BcfgK?= =?iso-8859-1?q?e8ZcW9lKF8WKh3sc9qeZ11pnYk9vZa7jt1QSdi0C+wURYlGjXRrvrTz8qHTw?= =?iso-8859-1?q?nCfHxTYATe1apu3UrSmc6FUBUAhnv54BKXtZjmveUm5N16EK0k1m+RniZROb?= =?iso-8859-1?q?rjhaaA+IzlDypOC2KW6iU+RdeTqD65eyK00BWZ9oznOr/psFciDNOMqv5Mnu?= =?iso-8859-1?q?6ydEFjK5ZNvLU8NoGpk4VlLlJ+nD2fdFb0vH7OthUrdQ2pevvHOrlkKrCpLZ?= =?iso-8859-1?q?yB8M60anTedbzGQ0qbXPxvUwQhD+69O3ZyljR3Kav57xMZ6aDQ0vx7EfKAra?= =?iso-8859-1?q?a7eIww7U2xiKd2UiIALoyVWYp5Yj/jLgKUD/z+aTHT0a1QpOPVIPpZSHpAt3?= =?iso-8859-1?q?gOs4IoyyVI+q4sdXPlUYBXnizoWNE0yKeBO/2683KEdbFUa164dOhEoYhWj2?= =?iso-8859-1?q?yJyx6dtl1GX98LEZM6QIICds9YJnZ+0wRknei6O7wRyb5XFTFNIAUSPtj13t?= =?iso-8859-1?q?4B/PT+xhnfykkNkjOIdzQ8htIkHGWhlNxDx2rRwBk7oiWEE2UwvST693Xxgj?= =?iso-8859-1?q?cVi7zk8vdDFeIMjzw6mTScq+bj0jMGE2Id8DOyyFY6kVDNaU/nWyDjveCilf?= =?iso-8859-1?q?EevxehXaLsoSuFrfQKTo8MsQcbEIFU/iGSEqSGqNFU89owKFdvYCIsTIdPCk?= =?iso-8859-1?q?A1QqBiCjcFv3y1GleE1LLJyyIm5YUI+MGZGBcQL6U/Hjk9cNYqamPMe1VX9I?= =?iso-8859-1?q?OmmAyCx57bebTPHvZXoX8BtM9oONTcVtXsCEsy5YeZ/N+uG1eVQxtLQaV9Kt?= =?iso-8859-1?q?cjo2E71m5lxUXUnHLAQxGSlYAjkgOR+eCe9eNlGJfzg+/SBfOB+FVc6yKwcD?= =?iso-8859-1?q?CxGdtPMWs3AAKT6EGzKcC/B+q6hVYtWyWIMdadCCM7dvbPbH+WB/Tum4n2jp?= =?iso-8859-1?q?bjlkG6dSJUczOnmqyoWevh4g=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?MyUP0H5DIdBz0k5sMw5yysZ?= =?iso-8859-1?q?1T4tzHh9evpcrJP3YLq0qJia4iHDZ1zIZ5VtAZFgx+npvzqaKrr1XrIyNJBW?= =?iso-8859-1?q?1Z7yQEXfdSBJcQJUssv8KzgbKiP28V1/MGXM7q2UoB8DGhNzH7JaxWE6B0Zj?= =?iso-8859-1?q?copIXMpFgzijDLPQ7olOiFWgYNP9fEf1zT53BQJSLI1F+u6tqPip4B6D/dLk?= =?iso-8859-1?q?A/x62GfCxMUnDM/45z/1qHbH49jbsgGWHtERSFlxSdQp6A2zQXPMLQxGz1xz?= =?iso-8859-1?q?m0kvhHCKFRUN/98xKskXqMZzRB2R19bS1u/0infRc4SmsyGc+jli1U7sWkXz?= =?iso-8859-1?q?QM1oUiyQWWXQ+IJSOt5I2UR3C5kqwFp5Yj370tvFa9PWXhHtS2uJMLZRVQLt?= =?iso-8859-1?q?4YV2Toq8E994ct9pCMHMaYbhncTrpZ3CwpPzJZYtCNatPxQmrIDxHQKV8qY/?= =?iso-8859-1?q?vaGph5klbIH6xD5SeR6300biDExlAePKN8F+MuQEvvTSnas3h1HHesxvma9a?= =?iso-8859-1?q?Kp43ReyZVEP0jynUwbwGl75NuePAE4BT7FgPqDYbkOfeOgU4YzLD9r3mg5Ea?= =?iso-8859-1?q?J9v7OS+WPo79Bhrzj3Z+m/sAzQDFZMSU/GZEuuxaDs15Bo9Q496Xyqz1AO4l?= =?iso-8859-1?q?AKYA3cF2CaaWMe9sQW20Yx2IBeadmEAfFWz2ys4qtpKvLxUjZt3D03kDVc9B?= =?iso-8859-1?q?GCIcoBdoSilxmKjRh1OLrR6UqIsJwH888INJ9x995skMpzECdbX1LDIk+Kj2?= =?iso-8859-1?q?NTbe2GDEEWE+oP700yp51SuXiPtRD0edVs47J9qQ0BlLEjXLzR/EXFCoC8dU?= =?iso-8859-1?q?z4IKArg5Uag5QvUWllPVVSf5F8g8/P7pMkRx09AEvgERfsify6K3byy87fbL?= =?iso-8859-1?q?xMJaxeSovOQ564sxtjD8YgqCw+Pxj3deUPnB4d+vFLxb0VO2NHHb89kpbY4e?= =?iso-8859-1?q?7Fr37vgz8eE35T9i3yYF+fpQHFSDxREmKUZsFqVZnY2fmWMNF3sSmQ+nCAb0?= =?iso-8859-1?q?wI0qTxYeloRZ/wbeSE9zBSnFReP0KIQtYt2d+8DY1xNt48zKESsnGFuO8AUW?= =?iso-8859-1?q?6oXbL23kadPPgciV4wOTzdlfj1nRx87SwfvtgD3rK94AbIb+4b7UPiaMmUMe?= =?iso-8859-1?q?kvCFvMWswrrmVHakCGMd1q8USs0VwEUMmBVKIk1mzaYzNwb2E1sZfJaplfrJ?= =?iso-8859-1?q?8gm9SDvzi+Ub9qrJFW7QvxMSIBXXqkDiWSzhfN5f65ACXDtUQWHuKcQGHRb4?= =?iso-8859-1?q?HaOM2ZzigxX51rGmCywc9fonJxO1WgImBsc3x7NKdlc7GhsNpvMP2ZXnTDSE?= =?iso-8859-1?q?jDzhdfbbMWIeBE68ZmkSg0x8TZhPMWdPvHQNjrCjwdWX7Kh1XGl295Pjf5ly?= =?iso-8859-1?q?6y7L01BEuA9uYB4KQVE7BZzUBWOFl53FxFZoinyglFClx7lFdsvFe4xmzOc+?= =?iso-8859-1?q?bmaidgT4ujyvcaM9vt2HeeYswk7M4AUWVMIdgufF3AehMVif1pmP1QzrFT2K?= =?iso-8859-1?q?TqSPmKH68zGz4ETcL/G4ju7O3/+nWJuhSpt/M6vTnLU7G2rkEVYK80ruZgUE?= =?iso-8859-1?q?9LAHkth0B7eSaL5G5a9u63t2ReG2O3H4OLKPxerLnxd+OTmFTsifv6wtG8Mf?= =?iso-8859-1?q?VMvkfWuuXms4drKt5Wn7EycD1yVi6lvSL4hsLGA=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bLsTH7+oZygsb9WjbF8kBolhTqJhzpcY7vgVkI9OymXGZFssBGw32HFfLZ7k2DEk3+cjo8Jrwf4pIB81WQFydi9LAufKYe0FLIoZwDk4+ysK15sPimfjEq3MeXibRRpIZ52QO+o8AL1u5VB09aRv1V3yLyYOXIEE+PHXgu6CP+suSOPc1ob0EI+tHMU5WpyHEcjBnSKR2J2BWhrhJqkzXPGFneiiWgjaxRVnjq7JRygUbXopoVa3DjuvQztHp7+muA3z23g5U7vggXo9IOn+8bfQPMwjDHrDlX1ZB+YuSiKORll0gKeibbJkYben3WQl/H2jPkY4RzZt6n1qYJ0qIChYe3hPEp35Eb0PBkldX/R0fI9vW3dhe1w2/sLRU8duQascVEK+vHszRzMZOgWIXhYF5aCnx5IOvR/awaB4jAy22LcQNC0/fVQ0q+SSDphDRmND0tokFQeZkp+ZaxN3UZ37lKsXZdI5xtV0azxZRZpoZtzgxBemb3KvWh+QS46NcYcqR2dGR8RHuiX1tl9MbW75sPMgkMVkIfC/jN75wogJVe0I05EdiQ4jrIBFT+bP/gN5hf+BSvAa/94a8nV1R/R4QeRBTxTq250hUg9oJakKh+CBeF1CxCwBDpCA8AVGdVVOQQ5hxPQQvc38bkwBvQ== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c815565-ff78-421c-4815-08dd197b7fa5 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:33:56.9648 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ibqkhzY3dsimtA3oKxPOhOae0eak8/a/bTnDA/ZOdqbCRQwBcAGWHnVpotPCb+iXVlBNbiZ8/ntmlqy6ebfY9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=fNPD3Yae c=1 sm=1 tr=0 ts=6758ddf8 cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=INPJFlJSa4UCX1VCkcwA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-ORIG-GUID: Bz-tCvcRE4mZLBRGlR0MUitteiWAYiox X-Proofpoint-GUID: Bz-tCvcRE4mZLBRGlR0MUitteiWAYiox X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=999 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 If there's an overlapped command tag, cancel the command and respond with RC_OVERLAPPED_TAG to host. Signed-off-by: Thinh Nguyen --- drivers/usb/gadget/function/f_tcm.c | 123 +++++++++++++++++++++++++++- drivers/usb/gadget/function/tcm.h | 5 ++ 2 files changed, 127 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 3e04ce40a4a0..0c7a41568f40 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -685,12 +685,25 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) break; case UASP_QUEUE_COMMAND: + /* + * Overlapped command detected and cancelled. + * So send overlapped attempted status. + */ + if (cmd->tmr_rsp == RC_OVERLAPPED_TAG && + req->status == -ECONNRESET) { + uasp_send_tm_response(cmd); + return; + } + + hash_del(&stream->node); + /* * If no command submitted to target core here, just free the * bitmap index. This is for the cases where f_tcm handles * status response instead of the target core. */ - if (cmd->tmr_rsp != RC_RESPONSE_UNKNOWN) { + if (cmd->tmr_rsp != RC_OVERLAPPED_TAG && + cmd->tmr_rsp != RC_RESPONSE_UNKNOWN) { struct se_session *se_sess; se_sess = fu->tpg->tpg_nexus->tvn_se_sess; @@ -702,6 +715,7 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) } usb_ep_queue(fu->ep_cmd, cmd->req, GFP_ATOMIC); + complete(&stream->cmd_completion); break; default: @@ -710,6 +724,7 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) return; cleanup: + hash_del(&stream->node); transport_generic_free_cmd(&cmd->se_cmd, 0); } @@ -842,6 +857,8 @@ static void uasp_cmd_complete(struct usb_ep *ep, struct usb_request *req) static int uasp_alloc_stream_res(struct f_uas *fu, struct uas_stream *stream) { + init_completion(&stream->cmd_completion); + stream->req_in = usb_ep_alloc_request(fu->ep_in, GFP_KERNEL); if (!stream->req_in) goto out; @@ -1046,6 +1063,9 @@ static void usbg_data_write_cmpl(struct usb_ep *ep, struct usb_request *req) cmd->state = UASP_QUEUE_COMMAND; if (req->status == -ESHUTDOWN) { + struct uas_stream *stream = &cmd->fu->stream[se_cmd->map_tag]; + + hash_del(&stream->node); target_put_sess_cmd(se_cmd); transport_generic_free_cmd(&cmd->se_cmd, 0); return; @@ -1069,6 +1089,14 @@ static void usbg_data_write_cmpl(struct usb_ep *ep, struct usb_request *req) cleanup: target_put_sess_cmd(se_cmd); + + /* Command was aborted due to overlapped tag */ + if (cmd->state == UASP_QUEUE_COMMAND && + cmd->tmr_rsp == RC_OVERLAPPED_TAG) { + uasp_send_tm_response(cmd); + return; + } + transport_send_check_condition_and_sense(se_cmd, TCM_CHECK_CONDITION_ABORT_CMD, 0); } @@ -1137,6 +1165,8 @@ static int usbg_send_read_response(struct se_cmd *se_cmd) return uasp_send_read_response(cmd); } +static void usbg_aborted_task(struct se_cmd *se_cmd); + static void usbg_submit_tmr(struct usbg_cmd *cmd) { struct se_session *se_sess; @@ -1214,6 +1244,74 @@ static void usbg_cmd_work(struct work_struct *work) return; skip: + if (cmd->tmr_rsp == RC_OVERLAPPED_TAG) { + struct f_uas *fu = cmd->fu; + struct se_session *se_sess; + struct uas_stream *stream = NULL; + struct hlist_node *tmp; + struct usbg_cmd *active_cmd = NULL; + + se_sess = cmd->fu->tpg->tpg_nexus->tvn_se_sess; + + hash_for_each_possible_safe(fu->stream_hash, stream, tmp, node, cmd->tag) { + int i = stream - &fu->stream[0]; + + active_cmd = &((struct usbg_cmd *)se_sess->sess_cmd_map)[i]; + if (active_cmd->tag == cmd->tag) + break; + } + + /* Sanity check */ + if (!stream || (active_cmd && active_cmd->tag != cmd->tag)) { + usbg_submit_command(cmd->fu, cmd->req); + return; + } + + reinit_completion(&stream->cmd_completion); + + /* + * A UASP command consists of the command, data, and status + * stages, each operating sequentially from different endpoints. + * + * Each USB endpoint operates independently, and depending on + * hardware implementation, a completion callback for a transfer + * from one endpoint may not reflect the order of completion on + * the wire. This is particularly true for devices with + * endpoints that have independent interrupts and event buffers. + * + * The driver must still detect misbehaving hosts and respond + * with an overlap status. To reduce false overlap failures, + * allow the active and matching stream ID a brief 1ms to + * complete before responding with an overlap command failure. + * Overlap failure should be rare. + */ + wait_for_completion_timeout(&stream->cmd_completion, msecs_to_jiffies(1)); + + /* If the previous stream is completed, retry the command. */ + if (!hash_hashed(&stream->node)) { + usbg_submit_command(cmd->fu, cmd->req); + return; + } + + /* + * The command isn't submitted to the target core, so we're safe + * to remove the bitmap index from the session tag pool. + */ + sbitmap_queue_clear(&se_sess->sess_tag_pool, + cmd->se_cmd.map_tag, + cmd->se_cmd.map_cpu); + + /* + * Overlap command tag detected. Cancel any pending transfer of + * the command submitted to target core. + */ + active_cmd->tmr_rsp = RC_OVERLAPPED_TAG; + usbg_aborted_task(&active_cmd->se_cmd); + + /* Send the response after the transfer is aborted. */ + return; + } + uasp_send_tm_response(cmd); } @@ -1247,6 +1345,8 @@ static int usbg_submit_command(struct f_uas *fu, struct usb_request *req) struct usbg_cmd *cmd; struct usbg_tpg *tpg = fu->tpg; struct tcm_usbg_nexus *tv_nexus; + struct uas_stream *stream; + struct hlist_node *tmp; struct command_iu *cmd_iu; u32 cmd_len; u16 scsi_tag; @@ -1282,6 +1382,23 @@ static int usbg_submit_command(struct f_uas *fu, struct usb_request *req) goto skip; } + hash_for_each_possible_safe(fu->stream_hash, stream, tmp, node, scsi_tag) { + struct usbg_cmd *active_cmd; + struct se_session *se_sess; + int i = stream - &fu->stream[0]; + + se_sess = cmd->fu->tpg->tpg_nexus->tvn_se_sess; + active_cmd = &((struct usbg_cmd *)se_sess->sess_cmd_map)[i]; + + if (active_cmd->tag == scsi_tag) { + cmd->tmr_rsp = RC_OVERLAPPED_TAG; + goto skip; + } + } + + stream = &fu->stream[cmd->se_cmd.map_tag]; + hash_add(fu->stream_hash, &stream->node, scsi_tag); + if (iu->iu_id == IU_ID_TASK_MGMT) { struct task_mgmt_iu *tm_iu; @@ -1293,6 +1410,7 @@ static int usbg_submit_command(struct f_uas *fu, struct usb_request *req) cmd_len = (cmd_iu->len & ~0x3) + 16; if (cmd_len > USBG_MAX_CMD) { target_free_tag(tv_nexus->tvn_se_sess, &cmd->se_cmd); + hash_del(&stream->node); return -EINVAL; } memcpy(cmd->cmd_buf, cmd_iu->cdb, cmd_len); @@ -1443,6 +1561,7 @@ static void usbg_release_cmd(struct se_cmd *se_cmd) se_cmd); struct se_session *se_sess = se_cmd->se_sess; + cmd->tag = 0; kfree(cmd->data_buf); target_free_tag(se_sess, se_cmd); } @@ -2467,6 +2586,8 @@ static struct usb_function *tcm_alloc(struct usb_function_instance *fi) fu->function.disable = tcm_disable; fu->function.free_func = tcm_free; fu->tpg = tpg_instances[i].tpg; + + hash_init(fu->stream_hash); mutex_unlock(&tpg_instances_lock); return &fu->function; diff --git a/drivers/usb/gadget/function/tcm.h b/drivers/usb/gadget/function/tcm.h index d37358f09819..f6d6c86d10b3 100644 --- a/drivers/usb/gadget/function/tcm.h +++ b/drivers/usb/gadget/function/tcm.h @@ -4,6 +4,7 @@ #include /* #include */ +#include #include #include #include @@ -103,6 +104,9 @@ struct uas_stream { struct usb_request *req_in; struct usb_request *req_out; struct usb_request *req_status; + + struct completion cmd_completion; + struct hlist_node node; }; struct usbg_cdb { @@ -135,6 +139,7 @@ struct f_uas { struct usb_ep *ep_status; struct usb_ep *ep_cmd; struct uas_stream stream[USBG_NUM_CMDS]; + DECLARE_HASHTABLE(stream_hash, UASP_SS_EP_COMP_LOG_STREAMS); /* BOT */ struct bot_status bot_status; From patchwork Wed Dec 11 00:34:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849682 Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B55CCA4E for ; Wed, 11 Dec 2024 00:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.156.19 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877258; cv=fail; b=crHWWa2aFNBR03MuyvDx/12mJWLRBrHAzsnDRUKB5vqY/gB3OAlMEkGqtuy+LcdYHV4uNdh5954KWWFlSxyK5usZFoCRgwjT0FwbjtODiuJe0Kt9ScXIR4TO6qJnSxyBRkPEg/xB/kzKu/yGyHS1+f7kMyDXC2WGvdYyYXXt4qQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877258; c=relaxed/simple; bh=9L2IAuCjH/PEhYIKdck9J+rJoEsVBY/N7sMUVS34im8=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=jY5TCmcOCjroDVpT7q4IofuS8hwEHaZEpJJb6bLxZriz1RyHwufqGZR7txzLA5LuWuIOSNe0MN13Drsbi7BWa927OwheJRXZVTRL/94IT0ctm3IjqooKo8yKdPxvsAm9g4QXnuGd05nAqXcmMhf1GwlgrVxnKZdM+Cznplo/5bY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=lHwzgcEk; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=maSa7Iin; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=A2iVHweC reason="signature verification failed"; arc=fail smtp.client-ip=148.163.156.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="lHwzgcEk"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="maSa7Iin"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="A2iVHweC" Received: from pps.filterd (m0297266.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BAMb3X4010915; Tue, 10 Dec 2024 16:34:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=COZSMrh7Ppa1IKffqRR2qjKczBoB1qStFDrYh/Z+TkQ=; b=lHwzgcEkoFiK +MjF5sUlM3btMC1CaXohQci+q2DthaRfHDkVpyq4I+Kip9MRR6PUBUnbrJAzRjvY Ys0PCjdEv6X5xbtP2LP7mWgyGktPI/WnFvC0NfA7bpU+ej4XFTryxNMV2RVyMDuF LkBG1o1YR+emU6muXqub7wM6Dfxkc9NeXq0NoWbIUqoKtdYTgd7GS9NedF9/hxS8 31WagbMoSzA5h3pE0dBO8mgjpU6leEyp+OTqa9G5vfJAr4ibTpqHqW0rQqLcin3V yfZ9xa0y4IRDxys3jLsUnMltq+/hWiQE61tWMy6sQTYaSp5gcQ/LtfSRTdgAotVS Dbgvpj0BrA== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 43cpgb9q6x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:34:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877252; bh=9L2IAuCjH/PEhYIKdck9J+rJoEsVBY/N7sMUVS34im8=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=maSa7IineQabjLCt9yCcrliTxfhpxHJjTnBci+Z1ZsW1VXZZXvoc0VmstMADeM/WO B7l5Api6qZzgVHk9DejZFa43Xp1NyJfysCQDeqhA2rFxq5hAUh3t+OH1nvLLJ86trs 6kIW3xWm5dXfv8HvoiPVvMDy6tT2GlOZ0wpDfj/V0WxBFaW2zbgeyJTxnFZPrnw6Cw a5zcOOZSqvlZrJwfW2kjgQoi3mmytajtUWZAtuiqCOFiD2t3U6vI90t1n+t5PQnggH efqakiuhVJwtJ/MtMpYm3/NJGs46xcjqP4VtUVntC9Oi/GDA94g+V1S6ZZEmEZ8nHR Dt6BPxhWTGdEw== Received: from mailhost.synopsys.com (us03-mailhost2.synopsys.com [10.4.17.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 1C1D24012B; Wed, 11 Dec 2024 00:34:12 +0000 (UTC) Received: from o365relay-in.synopsys.com (sv2-o365relay3.synopsys.com [10.202.1.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id EE142A008F; Wed, 11 Dec 2024 00:34:11 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=A2iVHweC; dkim-atps=neutral Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2048.outbound.protection.outlook.com [104.47.51.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 941D6401E9; Wed, 11 Dec 2024 00:34:11 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lIpSDlv9Ptg+aphtbSMsy7KZSLkwMVHDLlapVTVEzyP9LElFhAxYa2MVm/OsbXd3Yh1RT7jN3mxqBas/r3rengUFSmpgU0Vn+2fADzI0Beme93cFziT0jY/mvTilkE20ORQ1xuJytn06EXowR/44RaeJFGiVfnO/xkgNPi8c1sSutgvEDurQh1Rf5ocAL7MlVkRQonSEWBCg6G1gK+45s4oTGkZWuVJQatWFq+IcDds4bTpREgDVO3pdhbGWqj2yPhpSioUahHLeoncas39pZYYQBWHSyWNTAu7vaT7fCpx/wyC7llyuJWFuEbTy+boA4Ej6Pez2ANMMVaTBsfzNYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=COZSMrh7Ppa1IKffqRR2qjKczBoB1qStFDrYh/Z+TkQ=; b=Al+XEFy4vBDqrxyDHqVAGC6QWXrK2GhcY3c+CqSOEkLe0dS0QeFpZaH/DXmJdso1N1at7gJaxwwXGdXVwsnpc3kucUIbLiqsu/PW/sAMqEC/1Wo9t4WQrMlMk1VJDPbGHeyRyVlZfKM9uec/QbkYRU8Rz99dE/BGVJYAU+5XCCNWrYe087oaM6uasWbzeJSMqDfXaaK2ZJn4Gaap3wJGANnWR04bRZKQBU9aaBwFeOU4ddU+x3zFmcDaCGb029aokhB5qhepfqRs1Nov5B62xDWrPjH6fFPDw8T+eapc57V+6lKf6UVkw9h0jgIK2Wl7tyV1GyPEbw7DFkYBjLHoeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=COZSMrh7Ppa1IKffqRR2qjKczBoB1qStFDrYh/Z+TkQ=; b=A2iVHweCz1SIWdGUk8lSntXdSzAHUCtjZeCwPIR+mm0nXHctCd52uioTg9K3ci1ZHXSJY5Ug2bg14PC0NuunmLU8+8nUipMsujAvz4YJrlJq3JnIb8kGgKm0uxe1LHYu4FwQ80xN35cC3CVxmRD41yvbM6Uhe2SSZTSu1F+NgTc= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:34:09 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:34:09 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 26/28] usb: gadget: f_tcm: Requeue command request on error Thread-Topic: [PATCH v3 26/28] usb: gadget: f_tcm: Requeue command request on error Thread-Index: AQHbS2Rkq59gyV7T7EKgSHPIgOy4XA== Date: Wed, 11 Dec 2024 00:34:09 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: f9e4dec9-c342-4d08-41f2-08dd197b86df x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?lbD4nf8HRMET/rY9+ze9TTthMs?= =?iso-8859-1?q?Odfy+GB6QPcAqzFJFkuR/XUAvEIjM2JEagqygKKzNQen0kIuPTtjSqq9L2dz?= =?iso-8859-1?q?nFLPhSeHVFEyk+ghwLB+VtPE8Eqyk1S0+JfUEYR8INmKbojJrJUjgByPQQtt?= =?iso-8859-1?q?5WbMItekaPjhNKNWgYU4+huQnp5jo1O9ceCi5psD6BJyMYU1P9UoYsVjCVNM?= =?iso-8859-1?q?GaKrp1v30Wmse2vV6S97nq+WYp3YNBodEdcu45HojfNjS+3J8KaYOKYwcJx8?= =?iso-8859-1?q?Ks+tUNSoZ73e6fhj/lazLM5mDiwO4VqDprtH99WI9sCpIXL8sWykw1vrTXq5?= =?iso-8859-1?q?6ykMW1Ng9azJYjTwSJhyzRVYn0ZYN6rskQA7RqTLgHFt1QxizormBZiws1RC?= =?iso-8859-1?q?/DMUz/gu4XE3gRWp6ASpyKBX2twGp1fLX+KMAya6ERqNN+5q3hPPIdn3LPba?= =?iso-8859-1?q?Q3xRCuIKOAwNp+OtCKX7oX6nuye0fkWXTLHIf2GF7NVwTNO7aMu94tf6Br9i?= =?iso-8859-1?q?jM4OZr7X5fEpZu/ewZ72+a+d6CUeQKk0MCJe53Lewg7UIOCKtZwsqIYNcpeg?= =?iso-8859-1?q?nJbEjVNlu3/9MsbIwsmOG1asDUsH4GHVYjtieePDIRHy4vbWjozBFpZjqKar?= =?iso-8859-1?q?QbnRj+lvm79VI4pCQDqEI0z+/N7u7yzwqx+pgS0bbipFs1vdFnxKkU68qgZy?= =?iso-8859-1?q?EIogXM9650mn8L9r7S1VdJtGrj+MdeWjJvBi6jdBfCXCyqCqa+BSnHoMsTGx?= =?iso-8859-1?q?48Gmjr7Ka9ZYmFy42xZDx7oxZ1KbPc/5LP6NQn+m5f6zSnVriLyZ0ryVd1RP?= =?iso-8859-1?q?CS9SILC5f8dYp71bbzm5/IyCwq0G9kDDdgZrffjM9imIk+vDvy+gSSwnRZYt?= =?iso-8859-1?q?1Mri4whtX2XYHBcK08q3J8pOUAHyKibk1D3GcjUwn4NQTB4iUTAVmJXvfTCD?= =?iso-8859-1?q?H0cO9LC0N62eXnvMPxCW2C0oDCkSFEzKk6Vu25tu6qaKgixBu3lvB8WOC9G1?= =?iso-8859-1?q?2aE4KA7bNn1VuPrcrVQxwrEjKGsH/cnajS5JcM1AAfNZ/uW4wPgFL5XHLNif?= =?iso-8859-1?q?B3EaIuzxBROEETdqa7YJtKH+F2TDzzhJ69yadwINUaCA2j/LUrCZP47qV6fd?= =?iso-8859-1?q?FR9hZNTqZSgdKCHcHYEOisfqTev4b6aQUTRrN6/K9XNLJf8s3vldr/EbETVa?= =?iso-8859-1?q?jb710gY9kBMJStR9JnJ6nbprFgN/TGONyj+WoOknyNjDFKr7PLS4krB6EpIL?= =?iso-8859-1?q?zgAiyiWHC1SfL3F5rYg0g9VtSXeFmqNWC0kdCwwPzwLHq9R05on8MlJeepOJ?= =?iso-8859-1?q?6QQ+ytLFxXIx4qsk0AEVVWhBdI2dTCMGgDatxWMbsDUGQpjfa2FhbRJkkIMe?= =?iso-8859-1?q?XAJ6vfAakAGnqn+fp3WCnaz82Tkb3+jYEN7MMZsWz6xCeD/1jTUjyyPMCN/K?= =?iso-8859-1?q?f6bBXDl+hExFLUaOuIC8I9Tg=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?jCVyOrSz2W75z5Tq7CT57wP?= =?iso-8859-1?q?WClUyikMCQk4Rv0HvvuG+22uozAQJMChDB5JGJTEBRI4H/DacuNeyr+7FKEV?= =?iso-8859-1?q?aOVIBefoMF1tY//tg7xDjWjCqfxUBCcALPb2GtQXPSTMZzs/6a+9oQoXFgK1?= =?iso-8859-1?q?KppXBH4cxe6Pdx1gCCPclR5gJ1OCkO03JAmYitZkTZwuDdfxIZTaIdv/nzWr?= =?iso-8859-1?q?Mh6mx7ldw2mtWdoJlTMd6VE6rxHQxNLU2yPzKTJ1ZSwvXI/5PXxIvzqDFoBX?= =?iso-8859-1?q?8fn8wgj9JQ657ENXOrOo0RJvq4rGkswrcOWIthT0LRfUFiQW9D9Qq5e+aKXe?= =?iso-8859-1?q?wDSVA7g9aeIrs+JXXoW+/SD+aPq5833oA4HRhjA1/4zrj5nuHpKM4UzgvqsV?= =?iso-8859-1?q?3iR6n++P8sw1+n1Rm0IuXemhaDwvc3m7ixzDJ5iBqNmBI3h+++9o/+qMo/S8?= =?iso-8859-1?q?n2kgDRgNWMBwM1xNHM+pwi2LsK6gpe3wtiT6xfbfwfhEM58ax5kmMvDhSrvX?= =?iso-8859-1?q?8uPb69zMZjXXofYWnrva69TQpgIcbVatBNh6atbpCdN2A8p5VSvp3zs+Jmwh?= =?iso-8859-1?q?KxqubMihkFf2QuPHaa22VRYupWrl7Ya6TxgYmZOL/q6opnthemDiVt4qU8TR?= =?iso-8859-1?q?l3g/NV2lBmfUTia5DH7YC+tGIW1mjwqwJTWCAk2Kl1HPG4V7aSs7TzxVeor3?= =?iso-8859-1?q?Y678Tk0B6f+lawxc2Sa8G+PSqLq098UHd9cYqwk+KUIlrEw0ES4xDSkIOt27?= =?iso-8859-1?q?5a6RI4OnncuY9b68gHqcT7t77G1TpkBM2uStMSUVlF+62SXDat/GuT/7qY5r?= =?iso-8859-1?q?oqnxoH1F33vCVzC9ZcWW4zbvPjNyKM2Gd6YKaHFmZYfxqU4hrrPF4GkZe+lc?= =?iso-8859-1?q?Wg26+d/mU/VO+c7zWzg5X9M2mXuE4q0bmca4ix58ujjK/QoWEIPOWUVX1aTl?= =?iso-8859-1?q?jbC2ttlEJNYkfmGKSR9spQ+Vd6rh17/XCBotF+WO0fycdpwtoXZTwF2vv/Uy?= =?iso-8859-1?q?QK3E+725z8GjnvKeqX7v+K1Z8H5yti6L5KE2DUPP3mjvcIxWYWAyO1H3bNKx?= =?iso-8859-1?q?W0VLgn68A6AKXqD59p40FImCD0MZiXVmx52jCy830vXGyLGGeoNjd+wKEBvF?= =?iso-8859-1?q?YnBuyYzk081n1OYVQohgH/AWVZxB6R7stjAvCIua6yFrLNQIYTnZHjLoZCWq?= =?iso-8859-1?q?yW8adzC4sM+o/t2Yvw/ZtiHCT8eyyeVVE8stgOcg83bKLj3Swnxiznjhr6P/?= =?iso-8859-1?q?f+HdLzzKuknW7cfgh5J3Y9HPeRkg3oX5bRxyf1fGMwpnfnU7RIjeOA6+l/zd?= =?iso-8859-1?q?hCn7wrM3i0I8ENqWnqNI+MQDL+9XpQP3O0OP64FlrNQOyH7cmHgUyHjpZQ/a?= =?iso-8859-1?q?q4oKY6PR/cD4pX3eNj0a+HMxPoyuxRMXzYcV5zixUFMsUigfiToVeDG/o3Z4?= =?iso-8859-1?q?h6CGnuGOFDK7xUDUwFNsjS5EdpiU0gh8hoCLQz4xNAVXd99Wm51P/rsBJWQP?= =?iso-8859-1?q?yXHADysRrScOSuWw4eS713/HLPOej0fZs/kuUwU/Z8V+0iVpWmK0rAdS8FN7?= =?iso-8859-1?q?fL/krlTVoG+0twL1KywXzLQKFntukgQ0cFKIarYAjEV9MqYOl8UVe5Y7ujsY?= =?iso-8859-1?q?pJ9/gngNm6a5KLvlXc0no4iXN/jU3eIEYBhDDQg=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: G2Np1HJgK7hEXOMhc/m+xN8qZ7c+0aGvDYmxohw6SVP2GByCDuMToisLIQ7dBcDOsvwg0w2EMjaEjzutjVcDJYTto/0xnKiQWi25bBu42Eii2wiq/1s5CdhwCnYDifMkYoiUFqkNsTH8n4DrLZhPebIWJczUCA7UTZoUQhrEswN4EFXJdhIZ3qoZz6gk9ePV3lN2034iW9vAdTiwjwoYVUqkNEfN7uyYR+7c1sszRf2mwwlvESRdFmjPaJJGS/hb4Q/vinhmCWXgMfY9KmDgYsNmkWITYqUSvYVbb/HcK6ID/JMFHeDeH+1yV/0vdtuyo6cHqop2wDkhZ956NrdrAXOGzxJqRafcx9f7A5h9PpwzPvEArqwxE7j5Q7IJxGtgBsEWP+7xvku6ZtkUfYs0oJgM/VeCK7/2F4Hok7seghmnYQVFoMiMfCWhRIuo4jMzXAFCSR+IrMqmgo29Xda3uboenKoB4zQHSgIZ7Te43BRZpqqXBbCb3d13SvEYbUKMv0fjs+fj6ul27hSIqfg9H1pr4XdWIO2X3R9vLQLCKuAv+8oe+7+nZn9mW2EEg6fI9Or1IAmCnGtkmYQI5ibxjgJpspl31HzvSSK6QQflPMySW0RYjx7GWJFayMQiCcDF2L8Mj+kkCHQYKx062OWIeQ== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9e4dec9-c342-4d08-41f2-08dd197b86df X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:34:09.0824 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LLpNu14j9JtjuFpGBfE8ZNP89e//oijstrSGyk0dw1g7O9g1MCSxWst2FQ8//dhkY7xERl57H0XR4jvMF79dyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=d+8PyQjE c=1 sm=1 tr=0 ts=6758de04 cx=c_pps a=t4gDRyhI9k+KZ5gXRQysFQ==:117 a=t4gDRyhI9k+KZ5gXRQysFQ==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=1q4YP0GZM9u6_G6hc2UA:9 a=wPNLvfGTeEIA:10 a=4SauJWYdb0nqdwkJk2DW:22 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-GUID: LdmOkPlTiIEkBSIpR6Ez8XSykFPMElEC X-Proofpoint-ORIG-GUID: LdmOkPlTiIEkBSIpR6Ez8XSykFPMElEC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=999 suspectscore=0 spamscore=0 clxscore=1015 adultscore=0 phishscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 If there's error on command request, make sure to requeue to receive the next one. Signed-off-by: Thinh Nguyen --- drivers/usb/gadget/function/f_tcm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 7ea48845f8c3..be7d8df360d9 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -283,8 +283,13 @@ static void bot_cmd_complete(struct usb_ep *ep, struct usb_request *req) fu->flags &= ~USBG_BOT_CMD_PEND; - if (req->status < 0) + if (req->status < 0) { + struct usb_gadget *gadget = fuas_to_gadget(fu); + + dev_err(&gadget->dev, "BOT command req err (%d)\n", req->status); + bot_enqueue_cmd_cbw(fu); return; + } ret = bot_submit_command(fu, req->buf, req->actual); if (ret) { From patchwork Wed Dec 11 00:34:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 849680 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF0971CF96 for ; Wed, 11 Dec 2024 00:34:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877270; cv=fail; b=X8qUcvIPPRzY8fhjLnDfLghbq4BJ4MCiw20QMHvbSWtTkOyJRks3TO0v7nuNZ2umcx3RZG3gZXitQS+V7nuSWeBBTl03fqfb1ilw2Trgz5/mCl2IcokoXVqdr2SUvcbC+XY/192lK3WJqcKmQ1GxZ4TCGGEw5DDaJ+tocg3xnng= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733877270; c=relaxed/simple; bh=lIznTCoEIJkzpfgBe1i2JrPO1IyBOZOAI6NFXLkn094=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=EavvwT8fk88mwePke5P/WPlVYcgqgtXiVwQGY5FXnp3EMFsJbm5kcO8troDEeaAgegZjW1oaLHlh/w/W5EAiYmjVPFICuuMGveHucyLN/qKdN0f2Go4VLpxM1CahWnPqjXZde0XVGRufdjDOP4qp17sEV7fr8GGFZRq4IKGBaRs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=GvWUavv9; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=k50iAmuP; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=dJpZehZe reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="GvWUavv9"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="k50iAmuP"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="dJpZehZe" Received: from pps.filterd (m0098572.ppops.net [127.0.0.1]) by mx0b-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BALFNFd000621; Tue, 10 Dec 2024 16:34:25 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=eF7AdIpJilRWnqukgEa9PaTfHSbUOTS/C+GNnaZ4/aA=; b=GvWUavv9+N0i oKEtWReVsVqlZlleYkc88jrlOo5lYZDdxWoEj+mcavpV2HbL2MAVY1CeWhE6HOsz +/P2KfzCmUEX/qCdDdfEsMOXzuAXZS+RyVtVVmO/powSysWDEepDhFilJ0SquA8/ P7TCl+Aki1sHzjXSsIw/0nrTuW7SZmE4KwPZZmNOYBQQ7+6ZpnsE411lRuMoz9Vv hq6zITIAhirWFvbOyDFA7SNoR0likfkkhjtZkEqPhPFYdwIkrMBhJQ9XdNPne2DB is9K0DGRlOyi7sWm12p2LQvLEC4aF1plxUwCYy8IuSHlzeaT0aquTQt4yXMIey8a 9z8vsvkvAw== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0b-00230701.pphosted.com (PPS) with ESMTPS id 43cnvka1d8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Dec 2024 16:34:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733877264; bh=lIznTCoEIJkzpfgBe1i2JrPO1IyBOZOAI6NFXLkn094=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=k50iAmuPupqnBEDk3cBr2PBdJpzGQEYumXr4zSCdstyY6vx5hsjTPnTu7+pL7QiuE 1NdlrKmxXeWuT6aJ1n1YOez/bhJTUULf82yQ70RcxDISf8+aFwn1x83NbTt1Po8sYr x5bNugy7vY71MKr2DAgKzq2I14pxbdEe1+hM7mo5srbAw7eXniFr+b9WYVBV5dNVn8 9sHG1i8pk/16KGBFdczsFERzdvieoPXRoKxMlWJm2lKBKuBlCB5BBFfqPoYLJcK/+o HHYi1aqhUmPSRA1ovyxhRFzg1rifX5pE6fyvpjO4JtqIZe6N+e2cm+I15si8EUlkjE lJ7RpH7S3R93w== Received: from mailhost.synopsys.com (badc-mailhost4.synopsys.com [10.192.0.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 5EFFD401F2; Wed, 11 Dec 2024 00:34:24 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay3.synopsys.com [10.4.161.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 0C3ECA005E; Wed, 11 Dec 2024 00:34:24 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=dJpZehZe; dkim-atps=neutral Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2046.outbound.protection.outlook.com [104.47.51.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id A54EA404CF; Wed, 11 Dec 2024 00:34:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cjujbtdBnrV6r8y02SM7Fbijofn8HYB/PFizemo0QKM7/33fWqWYZz7pjk/+kayLOinOHNZXiqBSAA7BAksew0/kyCTAKhYxZMNH6d8j1OIJLVc+v1fQUxcq5DfF4738EFhdMvb5UvBc2XZmwiyuMCrLAxCv2ZQrSLcYWDdol8M6z/q5kREA2vYPIla/AiV55kgbDWSmH3y0b4j0BCxFE2q0Q9GUwf0+ezPKCWU4mM6eGaIqHKaV4pSonPMixN3skNh6QSGubOPA6uAsFt0EROujSrMX05kn+ujTdtQuOJzunmuSFiov+vu3nFGp/MTkwpeLBUOXUzI16XKE0XcPrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eF7AdIpJilRWnqukgEa9PaTfHSbUOTS/C+GNnaZ4/aA=; b=ScN/4Xt6EGbS2zcgTYx0PVstGHGyOXZlpv+8MAeTaInaQTs4FHrHqkp1L3b5BD0borhOXfSNMpnTnYrYf345GxlhfPt5yiqbwnjtDPP7SOyNWlMrnWwtj7XDwt8oEfr9DZkDpVtNZaJC7TL9vlqi2EntpqCe0K+d0tt51wZVEvxg3++wWR1Vg0+kvWFpkfdtQz5Nre8gRuUNllutv+L5MXD49x3666lOpd0EkN/Ivb2utUhKHLkrcLxtJnnQYjy2ilAmPqYJb/GVpdSTIWAbTIwMgiWjnWp4waXxeo0nCKUcgL1WTZU9GiEBao8TZZk8UdAGpVpLgKuh3zi4VFSnPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eF7AdIpJilRWnqukgEa9PaTfHSbUOTS/C+GNnaZ4/aA=; b=dJpZehZejQ7vST3TKIZ2ad17LbN/+cePbGGxDxNfHLCFcJGzvaKI6NcZGR6PJZCJEsCB3mLtupRxxLDOkfOuL0xlyGb5KnKOL84PWp0tZrLQX6qsHMWQwrfdwgJN56RiwgAuvQRN/cMcB/136FpEnQ6xD5XQrGn0QolYo/WtvHk= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 00:34:21 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%7]) with mapi id 15.20.8251.008; Wed, 11 Dec 2024 00:34:21 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , Sebastian Andrzej Siewior CC: "linux-usb@vger.kernel.org" , Homura Akemi Subject: [PATCH v3 28/28] usb: gadget: f_tcm: Refactor goto check_condition Thread-Topic: [PATCH v3 28/28] usb: gadget: f_tcm: Refactor goto check_condition Thread-Index: AQHbS2RrD6OM9L5Az0eXkpJxO9GO4g== Date: Wed, 11 Dec 2024 00:34:20 +0000 Message-ID: <8442364f51f2788d2a191997581a8eda7a143272.1733876548.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|CY8PR12MB7635:EE_ x-ms-office365-filtering-correlation-id: 78b72ba0-af44-45f0-de2b-08dd197b8df7 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?mgjHqzMcNTCGWOTQTetdZQACeM?= =?iso-8859-1?q?yMGrJG4bcPOYzoAZK1rAFIe6Rw2iNDGb4Ce5LMz93o/pnU+qcqLjeuX1aZjs?= =?iso-8859-1?q?+0khS6PsyV/73ymU/n1q2qhTGYsaXf188ozcxNo0ZsrbaBom5dcFrKXRoNEo?= =?iso-8859-1?q?KBXu5+6EgvbT/QK9aZrb8bgNUPiZS2s4NQQARWFU143QMUvRXBbO9MsUBYLi?= =?iso-8859-1?q?F9DrffBjDAWF/S0JOrBWBiu4x+0yHlwBonhh1+VlwV4ZScUsOiIt5DrAwJTG?= =?iso-8859-1?q?WKNkaHCUu/7tDLUTqa1xpIfExB0vZeoOhvTcoWdTslpfZYobrcuPyPHZOG4f?= =?iso-8859-1?q?1zW5qvt+FO0NpijPWWdxOA9AaryUuGi9MmbVxt9r19ioOY+Js2ivWIPmsfRP?= =?iso-8859-1?q?/kLjC7ZJND4cHR1l7r3XiVuihw7AxUgRjW1/MlyayRRjla8tlr82g/Wj0kwH?= =?iso-8859-1?q?xrRDIeFzf7A1+/GwS18GmZP8dFRujbxF1gqXZOVygEJpjTnCs7vPHWFPrOTK?= =?iso-8859-1?q?w/wGPeagxQdAzI34C0jmQVc568x4+DpQ8b3/hmcDXanZpH2LdwiYFDPtjRF8?= =?iso-8859-1?q?ZWBHLZ9j/inUKxpoazJbi894Zl4NVXXl2XKM2g3gJD2kZqh0QmvaLWcvLl2q?= =?iso-8859-1?q?Hphpu7SbP2P/SU7+IN8Ayqyg/UUmmvIyEn4KJTHGGA0t/s6MUsx4VjlUht/+?= =?iso-8859-1?q?kDXq+AGBoK7hX7fnxZ1NgqrR72Of2A7SsKPniClhcNt+gpQqjVoeNeZZ7vuD?= =?iso-8859-1?q?6NnsdG5dfTugDmUipGegeSSUA4YHBGvKavs4yiRpGT37tIftkIpayCqVlxJu?= =?iso-8859-1?q?W6nhZVuwVPa1u9G2x2EHZozKnuifUcrtTJA3u5n/KGeWRPYQ7f7lTuHe8bau?= =?iso-8859-1?q?6dc/puG+zkCjaGdWeybD8y3aUece8zM8RkkyrCTCXRUqEPkYCe+wxfRM/rcz?= =?iso-8859-1?q?Pu4l1bp/KgM0NSm1FZ5Qaf6lSfCxiJqkJ17N4TW5mR2U7mnj7CC7NTjvVMRE?= =?iso-8859-1?q?haWotIjlP82OuYZQcd7xaCje8x95RmfDqIwfw4hIeNqQT27htDXVYRIiAga5?= =?iso-8859-1?q?lV5tQxNwc3JT+gaxrtuLC1I4o+Zad8EmzkD+OzWtQf/5nmWSck3njQvp7ovW?= =?iso-8859-1?q?uGtsf0EKSqhmu/rmXNGFH5fNtw6d7/ZNH4fyaM/7AFEZvot04I6Kckyocvwa?= =?iso-8859-1?q?GLtpUYG9LqS4eP2mCVsLacveuJxupCEoCPTnBjCUx5/eDLcT741yrYXPrdpq?= =?iso-8859-1?q?NBmqWYyWiT9/sorYdFOHEgbgHLAQSjZ32QYgp83xzp0pEqlyQpC9Wh2+g3vB?= =?iso-8859-1?q?tcEydPz1PyyLJwiLQ6T9VapwS+7xJoHgoc4K3gjSSUclB19dRB1I6qO6SKJp?= =?iso-8859-1?q?5t+xPXdPLSeIkK7dV7zpLbevSiiS7GzzyeW7S3A552mEFHoAxTp3iPaWpnG1?= =?iso-8859-1?q?vKD0Ok8hRJYB+6EHuRl8J4rQ=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5990.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?RkWqPjmIlta21Ai/P1yEijQ?= =?iso-8859-1?q?G7PogOzFJ6HJNSH/24lOFcLTPLCGoD36FzClkS2fiGXId9l+FNB3qF0x08mT?= =?iso-8859-1?q?GMy2tz0UE2KQ3uR+hREW5Jm2peT7+PF/RgsisPKf5C+JSoJMsC1RCBPa3WL6?= =?iso-8859-1?q?eO1SxU2pkh2YRg7jkjKH/Av2nJeMZWyv1ttoeK82Iuqywjno4IEjOujdjXUI?= =?iso-8859-1?q?v+HGAv0RlfTOxPZC4TJ0/ONqgXvGHw8NxzfDVaOAKtz3XrzaxTNXF64D3+Z0?= =?iso-8859-1?q?FytCX2yTJN9ISD/W9/ztjy1iX8qazUlmSJplHJXekRIF0ulIcl2++NJBmx24?= =?iso-8859-1?q?LB6H9XiFpimZOjwObvG1FTC5eSYov/6q2sTzERks+6vLca0Nb+9d99nMXapC?= =?iso-8859-1?q?To5bQ0J2kzvtl3gg7WXALXspUmn3KVooSBJU6E6gJ0w+ycVTqRU5hdu92U8g?= =?iso-8859-1?q?jh3hdgpJ3aokmuaVBc6k+XO6l4K3V9SahfJ3GgMoTZ2jJl8QtFmH2CIRSNFI?= =?iso-8859-1?q?Vex1RkcbeRhtAOkl40srsWsxJnsKfrOXFzFsg/ilaOvQVtbPZ3KK12FfE85y?= =?iso-8859-1?q?uC8YxPpYEsqPDq1v5ZLPhxc7aVmltTH2uyu1TxW2YRUR1R5q5R3qsI4hAGEE?= =?iso-8859-1?q?clpyIpTf/IUpqcLtldnxjKMYOdeuaaUUXqag0d1a43dOa3iEkuQQvh+EcVHr?= =?iso-8859-1?q?u46NYkmEvsIe3YBs4kRlNs9zWQjhhAuMcQeQyOPZSPF5efIrSh1GOnBUN/oU?= =?iso-8859-1?q?YVEP50U2ouq9ckkbDU3XeBMrt5Q6eBNyuzamdj7iMsZre/beDq8WdfpR4G9c?= =?iso-8859-1?q?UKQ3Tb0jTkqR6JmOz6Ses21WN3hoia6nBKSokWsvTd50AYy1J6nw+InVbSVI?= =?iso-8859-1?q?GSe5gv8U4lknxd3V69s9zCMGbzUCUWzUtWLW76aCeqTbH646r6AU3HT6QMgC?= =?iso-8859-1?q?GfG8feVklklhR0schZ6k9sITv18z88qSRdTM7g+r/A4LDTt7/LeoNnvehxXN?= =?iso-8859-1?q?NiLKtgsDFPSVle8GZg5ummg0e3GJ11aVDcx5AK7VNIjJqbz7qzcTnvH5jQDo?= =?iso-8859-1?q?L2LhYO0lmrlQHWPzDzQjAzkLRm+GbTahXaNzx3EGIUVMLyiFNgkkNkfU3nna?= =?iso-8859-1?q?AdJ0MFOboKP/HwC8RxMQYpHlDAhDW1kbWRK10nYlA/ywz+DIJu1diVS08aJc?= =?iso-8859-1?q?kJGzqWKNklMqGHtsZPeiUnUqPTVJr6nMqny4AEM+AnicQeQK2yshYAgY4ASA?= =?iso-8859-1?q?z70CF3NuHuVaG3qn+rFLemlBhJDpZYJQsFdlvfZ6LobZ3brqTGrxHwOSjKrn?= =?iso-8859-1?q?vwY9ytZx7x+C1q56/I6eq/dSY5xgriwnhlro0Jur/nG2no94rHz4h90mbfFg?= =?iso-8859-1?q?bs3sui4CWUsrSziGGIm47AJFgYHw96s5B2FZ61UEQwgPTPwAeSAiq+mBQO88?= =?iso-8859-1?q?eYnCJlLFFmMbAQbocGTJ9CZGWpdJZBWMlACb1HYgLl315VL7qkOM88PweSS4?= =?iso-8859-1?q?TvwmeyaDcwLVAw3j6isUH/IZePZa8mW6DH0u4qPSE6ejclXH3Uft414NLv21?= =?iso-8859-1?q?swunCWZozHwkEgTdkzrP2XEvRXY6N8xndda+n5HUMYK4ovKXtMneymF33xxS?= =?iso-8859-1?q?v5DBB+JxeW9Tr97QB0AHPE87DuiZITnnUi5p8iw=3D=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: gNnCbjQnKv6QIknkSrSYKVYeoVsAyf2tPXZLz91YMGzwik5C9XYl3NNTwbwOfa3u8/GYaCFr2VlK04XIKa6GPLQ51m00yScYGZH3ijY1wWtas6tgVCkDH9yJBAPoFmI1LSf+HxRHPH8aiMZ+QBeyh0nU1mxeb5/kl8X/sAsr7UEcPf+Kfcei+NFWDKN3YRnYMZRYpwh21R1lZ1LlrtBvlO3E3K4TMMlec16YDL3plNvyUfs75MUla44VBbimCPHtSBz3N9vxIVTtsi6C9ZrWmpALZ5sDIafScYhwOe/grV/9vTwJb1E3zn+qu3se911QLe+l1AquCk5by9AYVDnkInUw7ndzIkR935yYOdm74QDKtCHBPQieZAWdh7eM0ZsTS63ISRTnlelyf1dAFjRkm4O6ZbYrYn+tNPp6uyfj5GT1TeeM+A7yTuKrAn7aASN6sAzBOIntBeTew5KHYMZ0c5I+5etYY9hFsi7mt6VzcVNntQGvlcvqFOYK/hmot5kVDB3zRXG/jPryQFlOnZOS4gBsq8sLy6M53seROX6BXUB6Y5Cp3P6rlXMdRm8csS9YqkyiVVAWuofw/PeCepO7tUCE/5IL8oO8SkwScYpC6+tqxmKgWQn1QWw6rIrT7QcFsUTYjEGjWQkqJodG2NEeLA== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78b72ba0-af44-45f0-de2b-08dd197b8df7 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2024 00:34:20.9802 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: V0CRt3TOVWyO+Bs8XUnrz+l55BcHDrpq8hhTXXLnp+e1V1tBb8/KMODcPk1GwRhn5fwp6/aF8pM1Osp2C9TWBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 X-Authority-Analysis: v=2.4 cv=fNPD3Yae c=1 sm=1 tr=0 ts=6758de11 cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=Y8aRv1srGp9X5m9hZioA:9 a=wPNLvfGTeEIA:10 a=EEFIF99-17FBX5V1_l-D:22 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-ORIG-GUID: kEMSI4M19t97bzhwZKDdoV7wJibX9TjV X-Proofpoint-GUID: kEMSI4M19t97bzhwZKDdoV7wJibX9TjV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=999 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412110002 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 --- drivers/usb/gadget/function/f_tcm.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 72e7d4558eef..5a2e1237f85c 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1223,14 +1223,8 @@ static void usbg_submit_cmd(struct usbg_cmd *cmd) tpg = cmd->fu->tpg; tv_nexus = tpg->tpg_nexus; dir = get_cmd_dir(cmd->cmd_buf); - if (dir < 0) { - __target_init_cmd(se_cmd, - tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, - tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, - cmd->prio_attr, cmd->sense_iu.sense, - cmd->unpacked_lun, NULL); + if (dir < 0) goto out; - } target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, 0, @@ -1239,6 +1233,11 @@ static void usbg_submit_cmd(struct usbg_cmd *cmd) return; out: + __target_init_cmd(se_cmd, + tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, + tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, + cmd->prio_attr, cmd->sense_iu.sense, + cmd->unpacked_lun, NULL); transport_send_check_condition_and_sense(se_cmd, TCM_UNSUPPORTED_SCSI_OPCODE, 0); } @@ -1484,14 +1483,8 @@ static void bot_cmd_work(struct work_struct *work) tpg = cmd->fu->tpg; tv_nexus = tpg->tpg_nexus; dir = get_cmd_dir(cmd->cmd_buf); - if (dir < 0) { - __target_init_cmd(se_cmd, - tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, - tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, - cmd->prio_attr, cmd->sense_iu.sense, - cmd->unpacked_lun, NULL); + if (dir < 0) goto out; - } target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, @@ -1499,6 +1492,11 @@ static void bot_cmd_work(struct work_struct *work) return; out: + __target_init_cmd(se_cmd, + tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, + tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, + cmd->prio_attr, cmd->sense_iu.sense, + cmd->unpacked_lun, NULL); transport_send_check_condition_and_sense(se_cmd, TCM_UNSUPPORTED_SCSI_OPCODE, 0); }