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: 13902664 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?uahuNfgZk9ENVPOo68U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1eVQxtLQaV9Kt?= =?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?Kp43ReyZVEP0j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7lFdsvFe4xmzOc+?= =?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;