Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1449182lqe; Mon, 8 Apr 2024 09:10:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKANngVYg/4EYdyZEQMpKzJNRU4Mybohogh5ki5TT7fWN2YsSzfnOQConPpwhXKognrpSGvlA15kub6Uxqb2fESpNbxZGdTDk7djU4oQ== X-Google-Smtp-Source: AGHT+IHjOz6EMCUYTj/bOkdmLYeOplV1SqeasgryqMqZ/DGUPJTiLp8ixAFPXqVHfzYH9axxtZuD X-Received: by 2002:a17:907:7b89:b0:a51:9d99:78ae with SMTP id ne9-20020a1709077b8900b00a519d9978aemr7475457ejc.67.1712592624928; Mon, 08 Apr 2024 09:10:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712592624; cv=pass; d=google.com; s=arc-20160816; b=MduDzpT9zgzrqs/KR0JwVpMUN7qeSuGRjzvTTIJRBBv7HrloQvDNMiF7oCQsU1N++d omkCTRh10/aTUpmY+vkPGdcOXdBtUuek3cgkeJnoAP8z1+2DW4yQ0Kv9yxfK/EJeNk1p y2iUEiFetCU75PFhiREhPogUBCYiOyZ9Gg9NR4nwPuV0TS4BK0S2bHWQX8eqSylja2qz IXRq5R4weMYvv0WGi5evq+E2BOn1jlhNhmhH1DNMvTT1IdtvzPRwQXI9dYNuaSHrjCjP MLgE93f2csWFp5/1qiIPdkDGQpkEMXEOyyBa6cN8q7fxToNmliRs1Q6ynE8524fsLabh DrZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=yLf9gOuFWFn+mj2cKkeSPV0XXmwiJvp1/2MZm/fvtpw=; fh=Xbm9cggnYGmgIUptp2cLSOdn3zoEOIAlMeBXRqQORnE=; b=nTIP4nVDzQ7OMT//EKwiGPcM1MR1oUNii5R8n8f/DZL0Omf4FtI0sH2dVaaP620Pil bMftmJ5HmWou2sqOzI0XgpsvkY4hGuVa03NSmyHfItBUC3SfRz6BvlIsiNRoOGArkG8U XKkfdQTiHFM7wOu9ivqAqSLA8u9er6y3GKxW99yUi18xuQMtj57vJto1IrQW9n5GyvpI LQ90O2nllfPpCo8vbYgC6NrZ1JOPUzRvwUhx+c69I+KWeM39COQnp/P4abBhP4EylPtn M+Wjy+UJcxhDZotkDqSD/bisgi+fCrN79zNISxRUfUXtDUR1YBwITnF8ikuGXf0diuv+ WpiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=EFGqRsiK; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-135658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135658-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id oz44-20020a1709077dac00b00a51c137fd01si2590421ejc.239.2024.04.08.09.10.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 09:10:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=EFGqRsiK; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-135658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135658-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7F2C71F226DA for ; Mon, 8 Apr 2024 16:10:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E80851422C7; Mon, 8 Apr 2024 16:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="EFGqRsiK" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 A66FE13E88F; Mon, 8 Apr 2024 16:10:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712592616; cv=none; b=QKasl4l9Uo46wMoNYLY3ewHp+taqnNHEqFuECGuKfR2X5DRd9At3mdQtKyh0dDyt/HxPuGScvrCyr9FukdUrz9xVottcw1uMxMTkpKH/nF7dt4YaW7qj5bhysPiS00F1bgs+zAKVJ7mk/4wHN17mVy+TGbX1TCfSDHxSS7CU1nk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712592616; c=relaxed/simple; bh=s+O4kONFViiAAbscvBJlJboLEbxXcxsDb36i+2Uu9so=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t3hA1MHngPfS4VtISFoos6ggumcGw2tU4OWcBOzRwJGHJQcwuk7xcmdJMsQkNHaRjH62XzXm8GqyG4OiaspKVRiwyigBNTfJLXbP7bUO0n4BAkwa7mLOo7ji6MDrQ+HPKi80fkcH57PMLMuQKzaF4V1Pr10U/bVUavfq4xvNGNY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=EFGqRsiK; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=yLf9gOuFWFn+mj2cKkeSPV0XXmwiJvp1/2MZm/fvtpw=; b=EFGqRsiKiVUSn1VLhowgBds29H Im0pHC+mfakvLwEL3aYVF4XSvws1N4rnyWruY/KgEdtqRPaMw5GwyaMLTnBLWEjFtZ0h5BCGS4wsF i8Fm5Bydx/dGMPwVLuliHiV+ApMN/6EyPUiWzEGysAGAAMq5lrcDWhvPsfcWvwJFOfsxINP9x1qgf UDc2AJoqFQCNzFDH0pv3Aso3s+b9O6DFYK54XIY1oM1mRAHWUPE3UnurUevLtQamXVq6Q1Yv7K/Qj mF3JcvMun37PiHtzqXGA+cvEmwm3j5YivHvxcdz/M1cw7zXv2eSAcoBGuM8c3UNW6ggqdpfPkswaX VSgUnP3g==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtrZP-00000000ABB-2GJv; Mon, 08 Apr 2024 16:10:07 +0000 Date: Mon, 8 Apr 2024 17:10:07 +0100 From: Matthew Wilcox To: "Russell King (Oracle)" Cc: Danielle Ratson , netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, corbet@lwn.net, sdf@google.com, kory.maincent@bootlin.com, maxime.chevallier@bootlin.com, vladimir.oltean@nxp.com, przemyslaw.kitszel@intel.com, ahmed.zaki@intel.com, richardcochran@gmail.com, shayagr@amazon.com, paul.greenwalt@intel.com, jiri@resnulli.us, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mlxsw@nvidia.com, petrm@nvidia.com, idosch@nvidia.com Subject: Re: [PATCH net-next 07/10] ethtool: cmis_cdb: Add a layer for supporting CDB commands Message-ID: References: <20240408125340.2084269-1-danieller@nvidia.com> <20240408125340.2084269-8-danieller@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Apr 08, 2024 at 03:55:19PM +0100, Russell King (Oracle) wrote: > On Mon, Apr 08, 2024 at 03:53:37PM +0300, Danielle Ratson wrote: > > +/** > > + * struct ethtool_cmis_cdb_request - CDB commands request fields as decribed in > > + * the CMIS standard > > + * @id: Command ID. > > + * @epl_len: EPL memory length. > > + * @lpl_len: LPL memory length. > > + * @chk_code: Check code for the previous field and the payload. > > + * @resv1: Added to match the CMIS standard request continuity. > > + * @resv2: Added to match the CMIS standard request continuity. > > + * @payload: Payload for the CDB commands. > > + */ > > +struct ethtool_cmis_cdb_request { > > + __be16 id; > > + struct_group(body, > > + u16 epl_len; > > u16 with a struct that also uses __be16 looks suspicious. I'd understand if it were the other way around. The command ID isn't a _number_, it's an ID. You can't add 1 to it and get a meaningful requilt; all you can do is check it for equality, so a u16 makes sense for an ID. That's what I did in NVMe; command_id is typed as a __u16. But a 'length' field is obviously a number. You can meaningfully add and subtract numbers to it. If there's an endian consideration, that's where you'd expect to see it. So I concur, this is supicious. (Oh, you might wonder why namespace ID (nsid) in the NVMe command is an le32 rather than a u32, since it is also an ID. And that's because it's an ID which is exposed to userspace. You wouldn't want to have big endian systems call the namespace 16777216 and little endian systems call it 1)