Message ID | 20240227084722.27110-1-hkelam@marvell.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-82885-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2572166dyb; Tue, 27 Feb 2024 00:57:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVqH8JGD6vJgN4YveE5l0gjnfN4XU8XKWX3Yh/SOKDbWo1T5VQkl0c77rbmCqunyDJSXieaSCeAt1qDZrOPsBmPNaqe0w== X-Google-Smtp-Source: AGHT+IEmFPlp+b3PtRIUQGdUXziN7A3YChKt/YoLEBBM9sygm4PSnAb7B75u5ZpthR/7NcdK+Imc X-Received: by 2002:a05:6808:1153:b0:3c1:ac81:259c with SMTP id u19-20020a056808115300b003c1ac81259cmr1616428oiu.47.1709024270407; Tue, 27 Feb 2024 00:57:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709024270; cv=pass; d=google.com; s=arc-20160816; b=BZAk8KbeuM4KGKm/Hdr1CBtHX92j4nf/cOIsn1FeYbSL02vMWM4lHirWOGkxeGa4KV AHK8miyZPXUcndL9eRGltUbX2w98FqHnHuXcLemeReWyUsIM/4bybpQHgnvDGvS4BqNF 6o5vmtuX62qr9PlohOSd7k7HbGCZ97qonLKNScqqE/irVeIfsYL1t4yXhDj4hfeRtUY7 N7cLF2tUXtxHWxm6nOS1RE2drvTcM7QMtpExlOG0zsT4+4bAbcoTnDmkES06pa5vFWeG UqmkzOB1R8P7X8ZaBvNVWqre2b+/46FP3j4Uh373KyiS47FqAM/Ay2PtuNy81ePU94WG EaXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from:dkim-signature; bh=0UTqIdO9lhrgAtpQJ6u95vzHcLEzYJKBHUIHpWzRYZM=; fh=GZAvylyH0tRiHgo6YjmDcBXEp4BNes+PAA6FwyYO73Y=; b=Pf0hRbQjjQZu8ytnJXvLP2P6Ra4PEjlgo9tQN7tCio8A/BkkA0vBVuoVKeVkPRSTgw yfk+LQ9Cg93+L2K9/OK0TYHc/MlnY6Nnzr1uYjZodN9EtwLVjr9GHZqXQJyphxA4pCTH tMCD67Xj0qWq3nY1gWRqy4pOiojCPNOkgr+M4O8kMJF3D4gJvVP6WK0zvj+rA3aQxXI3 CdCP0qzSJ5kZHz+YqWSRY4C5NXwbVZIVAAuquT5q8fwiIaeXVmmEWZauW5G0a+tHCVeN 3sdh4WTIAztLcbeo4RxZeTnUNIj0M8jHEYhqAlMgc6pQc91Grht5wAo65LicY2IRETD5 HVng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BAAHNGCx; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-82885-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82885-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id lp21-20020a056a003d5500b006e53f1931f6si1738112pfb.63.2024.02.27.00.57.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 00:57:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82885-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BAAHNGCx; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-82885-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82885-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5A3EDB26F2F for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 08:48:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 069621332AA; Tue, 27 Feb 2024 08:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="BAAHNGCx" Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (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 C92B77BAE7; Tue, 27 Feb 2024 08:47:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709023667; cv=none; b=Qsc9t3hO2eESCZPX5814QkVSkegkxfJ9gM/RPFU1fC2GbA+qLGPZnVBFVFUR3rny+coqbGveLo/ghrOZIc25NJEU6D90+er0oxAtGiC87bp6NTVRYpLPQwKRKGoXVz6RQ+7PiyNk/HuSBHZBJ6ZMU6es7P6C25sSuT8ErEOl8Yw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709023667; c=relaxed/simple; bh=nkC19/00v/rubX28CJkyPWJwtpAXys7cf6QL/2swOBg=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=aMJyEnjckcr6ELkakTWDsQqw09JVK5IZ+e/OQXnwLvAIzTU02pOuxNVQlit6B/LkeG4awABkL/H4WMnJz8+rNh1sOGqMdSousvcMcrQtRqWeZq+wU00Qri9JXWwF0wXPDrlAq2XGjyFe1u/PFBwjuiOYrhpz9XRc6zxsPhEQrN0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=BAAHNGCx; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41QNNxBx011614; Tue, 27 Feb 2024 00:47:29 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= pfpt0220; bh=0UTqIdO9lhrgAtpQJ6u95vzHcLEzYJKBHUIHpWzRYZM=; b=BAA HNGCxqFOjwXNLNY8squFgCkA7L/VhsB5s4ffNtAfxfr+5U7hVq9eqs2vpEAHvfwX dqcgN0vSW7dlAHqPAyUAhJK81GxHfyDaKhfPy36U7Cp+kXDyHB1GYku6dzOg1EsP eHPEvEjgKLOrqBaHuB3hO4SdNvGUKolfxVOu8hRwJArerlxm1iCDKnagwVuccG21 i55VPCPyQXTvHNsy9lUN2GclnEY2s5N513vYUrT1NlfiCS4j+p5VD5L9Tcldel1H KWDjTJdYRMmreXR9Rb4YJ2eixVVP5q2GVxmkfjV1LBNsM1mUYeG1A27VvJhWxEKo SYQaJkxKUF/KV6XmIvA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3wfgun8rp2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 00:47:28 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Tue, 27 Feb 2024 00:47:27 -0800 Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 27 Feb 2024 00:47:26 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1258.12 via Frontend Transport; Tue, 27 Feb 2024 00:47:26 -0800 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 68C203F707B; Tue, 27 Feb 2024 00:47:23 -0800 (PST) From: Hariprasad Kelam <hkelam@marvell.com> To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <pabeni@redhat.com>, <kuba@kernel.org>, <edumazet@google.com>, <davem@davemloft.net>, <sbhatta@marvell.com>, <gakula@marvell.com>, <sgoutham@marvell.com> Subject: [net-next PatchV3] octeontx2-pf: Add support to read eeprom information Date: Tue, 27 Feb 2024 14:17:22 +0530 Message-ID: <20240227084722.27110-1-hkelam@marvell.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: lYx5WpYLzmIohgajFVHNu9rldFepWstn X-Proofpoint-GUID: lYx5WpYLzmIohgajFVHNu9rldFepWstn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-26_11,2024-02-26_01,2023-05-22_02 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791620365984363157 X-GMAIL-MSGID: 1792041833371730005 |
Series |
[net-next,PatchV3] octeontx2-pf: Add support to read eeprom information
|
|
Commit Message
Hariprasad Kelam
Feb. 27, 2024, 8:47 a.m. UTC
Add support to read/decode EEPROM module information using ethtool. Usage: ethtool -m <interface> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> Signed-off-by: Sunil Goutham <sgoutham@marvell.com> --- V3 * remove redundant checks as stack is already doing it. V2 * consider length and offset fields while copying the eeprom data. .../marvell/octeontx2/nic/otx2_ethtool.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) -- 2.17.1
Comments
Tue, Feb 27, 2024 at 09:47:22AM CET, hkelam@marvell.com wrote: >Add support to read/decode EEPROM module information using ethtool. >Usage: ethtool -m <interface> > >Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> >Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
On Tue, Feb 27, 2024 at 02:17:22PM +0530, Hariprasad Kelam wrote: > Add support to read/decode EEPROM module information using ethtool. > Usage: ethtool -m <interface> > > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> > Signed-off-by: Sunil Goutham <sgoutham@marvell.com> > --- > V3 * remove redundant checks as stack is already doing it. So still only access to the first 256 bytes, using the old internal API. Disappointing. And the Signed-of-by: appear to be in the wrong order. Andrew
> On Tue, Feb 27, 2024 at 02:17:22PM +0530, Hariprasad Kelam wrote: > > Add support to read/decode EEPROM module information using ethtool. > > Usage: ethtool -m <interface> > > > > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> > > Signed-off-by: Sunil Goutham <sgoutham@marvell.com> > > --- > > V3 * remove redundant checks as stack is already doing it. > > So still only access to the first 256 bytes, using the old internal API. > Firmware and Kernel shares the data over a shared memory region. Firmware <-- Shared memory --> Kernel As per our design, firmware updates the shared memory region by reading eeprom data from the MAC. Upon receiving ethtool request to read eeprom data, Kernel maps this shared memory and copies the eeprom data to the user. Currently firmware supports updating only the first page of eeprom. Due to this we are limited to support the first page. , using the old internal API. While copying the data, the current patch does considers the offset/length fields. ethtool -m ethx offset x length x Could please point us what are we missing here? Thanks, Hariprasad k > Disappointing. > > And the Signed-of-by: appear to be in the wrong order. > > Andrew
On Tue, 2024-02-27 at 16:47 +0100, Andrew Lunn wrote: > On Tue, Feb 27, 2024 at 02:17:22PM +0530, Hariprasad Kelam wrote: > > Add support to read/decode EEPROM module information using ethtool. > > Usage: ethtool -m <interface> > > > > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> > > Signed-off-by: Sunil Goutham <sgoutham@marvell.com> > > --- > > V3 * remove redundant checks as stack is already doing it. > > So still only access to the first 256 bytes, using the old internal > API. > > Disappointing. > > And the Signed-of-by: appear to be in the wrong order. To clarify: If Sunil is the author of this patch, you should put his SoB first and add a From: tag before the changelog, see: https://elixir.bootlin.com/linux/v6.8-rc6/source/Documentation/process/6.Followthrough.rst#L199 @Andrew: it looks like the firmware interface is going to be limited for the time being, are ok with that? Cheers, Paolo
> @Andrew: it looks like the firmware interface is going to be limited > for the time being, are ok with that? Yes, i'm O.K. with it, just disappointed. Maybe the next version of the firmware will allow more? Andrew
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c index 7f786de61014..55ec0792038f 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c @@ -1184,6 +1184,38 @@ static void otx2_get_link_mode_info(u64 link_mode_bmap, otx2_link_modes); } +static int otx2_get_module_info(struct net_device *netdev, + struct ethtool_modinfo *modinfo) +{ + struct otx2_nic *pfvf = netdev_priv(netdev); + struct cgx_fw_data *rsp; + + rsp = otx2_get_fwdata(pfvf); + if (IS_ERR(rsp)) + return PTR_ERR(rsp); + + modinfo->type = rsp->fwdata.sfp_eeprom.sff_id; + modinfo->eeprom_len = SFP_EEPROM_SIZE; + return 0; +} + +static int otx2_get_module_eeprom(struct net_device *netdev, + struct ethtool_eeprom *ee, + u8 *data) +{ + struct otx2_nic *pfvf = netdev_priv(netdev); + struct cgx_fw_data *rsp; + + memset(data, 0, ee->len); + + rsp = otx2_get_fwdata(pfvf); + if (IS_ERR(rsp)) + return PTR_ERR(rsp); + + memcpy(data, &rsp->fwdata.sfp_eeprom.buf + ee->offset, ee->len); + return 0; +} + static int otx2_get_link_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *cmd) { @@ -1342,6 +1374,8 @@ static const struct ethtool_ops otx2_ethtool_ops = { .set_fecparam = otx2_set_fecparam, .get_link_ksettings = otx2_get_link_ksettings, .set_link_ksettings = otx2_set_link_ksettings, + .get_module_info = otx2_get_module_info, + .get_module_eeprom = otx2_get_module_eeprom, }; void otx2_set_ethtool_ops(struct net_device *netdev)