Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3716349rdb; Sun, 10 Dec 2023 18:32:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEscqxeKi7y7NTZtLE2fulpdyFwxNvR2WizMV2gATpDN9nJ2WKFp7f1DQQdcmd+WHh8/Hg8 X-Received: by 2002:a05:6808:2385:b0:3b9:ec87:857 with SMTP id bp5-20020a056808238500b003b9ec870857mr1983939oib.84.1702261948864; Sun, 10 Dec 2023 18:32:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702261948; cv=none; d=google.com; s=arc-20160816; b=LqEwvXf2YvHBYCJIxERNliYmKMuikuoxk0p8e+Hstqf/zx5WOLxc2jU/gkqqe9YoMT O/yl+/nx3l2KpCPZf14DvK5hHQOJWmpdGOuuMzQBjNCvwVTTLjqMLPCZGCZMGJGFJwMG mFGkxGCDn/udCX5foaA04HovnuK1f0ezDxkg8QxM7BLp3b38zB8r+Xv/BNa57bZfckym /l/m9kCBYwYOCs2GQcgCbLuZ9+TfNERXIOHSoT3vX06aC9n7zXCfrUYk14qN3ebvM9g5 Sbnd4nTipIuiY+F5vYg/ttgCLIcRicldar3DxDl1oyPCZ/Ximik5LW8k7WXH86vibJh0 9cFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HouHsz1uaePLpszMT2mH2FTninYfWbRVq4FwC5IEOJI=; fh=28Gsh8p/Rrgoh0ZJgxMb30MiNZzzGa/AucmCEg5DMJI=; b=wQIiCOpNJFApxDfuFiVroBNKIN7uAP8ylY8Qc1hnGg2ddH+O0Vq/oytkMsFeEuVxbW X4at2b6R84Mh9lqcdXt6n9UJwqNEWwdiMWdapDlKD8qfqNfLgAW4WPOSWwtJcUlGMvfG zy8z6jwDmrT9gah5QxOxMntxp1ueAS9l4dAPP1ynYoUwFjIWELVX+r5J7anyovSMBT0Y 3t8mJTR2w/IWxzwTPxj6X6hny3NtNIWmWIM1EDTMxHWpBOLUuyUKWAdEsk17UBm5DIxP Gh03r9OywHBNZ8Cf9Yxk12fPGyUOmQNadRneYaXqMvLtcS9aFT8sZ80EfxD9srqwZ+K3 kIZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bv127-20020a632e85000000b005c671034477si5161233pgb.539.2023.12.10.18.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 18:32:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 85250805E2D7; Sun, 10 Dec 2023 18:32:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232363AbjLKCcM (ORCPT + 99 others); Sun, 10 Dec 2023 21:32:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232903AbjLKCcK (ORCPT ); Sun, 10 Dec 2023 21:32:10 -0500 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D61D0107; Sun, 10 Dec 2023 18:32:15 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4SpQHm5hrBz17N0Y; Mon, 11 Dec 2023 10:12:36 +0800 (CST) Received: from kwepemm000007.china.huawei.com (unknown [7.193.23.189]) by mail.maildlp.com (Postfix) with ESMTPS id ADCF3140558; Mon, 11 Dec 2023 10:12:39 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemm000007.china.huawei.com (7.193.23.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Dec 2023 10:12:39 +0800 From: Jijie Shao To: , , , , , CC: , , , , , Subject: [PATCH net-next 5/6] net: hns3: Add support for some CMIS transceiver modules Date: Mon, 11 Dec 2023 10:08:15 +0800 Message-ID: <20231211020816.69434-6-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231211020816.69434-1-shaojijie@huawei.com> References: <20231211020816.69434-1-shaojijie@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm000007.china.huawei.com (7.193.23.189) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sun, 10 Dec 2023 18:32:26 -0800 (PST) From: Hao Lan Add two more SFF-8024 Identifier Values that according to the standard support the Common Management Interface Specification (CMIS) memory map so the hns3 driver will be able to dump, parse and print their EEPROM contents.This two SFF-8024 Identifier Values are SFF8024_ID_QSFP_DD (0x18) and SFF8024_ID_QSFP_PLUS_CMIS (0x1E). Signed-off-by: Hao Lan Signed-off-by: Jijie Shao --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 8 ++++++++ drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 38e796f61475..eed6c6393801 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -1819,6 +1819,14 @@ static int hns3_get_module_info(struct net_device *netdev, modinfo->type = ETH_MODULE_SFF_8636; modinfo->eeprom_len = ETH_MODULE_SFF_8636_MAX_LEN; break; + case SFF8024_ID_QSFP_DD: + case SFF8024_ID_QSFP_PLUS_CMIS: + modinfo->type = ETH_MODULE_SFF_8636; + if (sfp_type.flat_mem & HNS3_CMIS_FLAT_MEMORY) + modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN; + else + modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; + break; default: netdev_err(netdev, "Optical module unknown: %#x\n", sfp_type.type); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h index da207d1d9aa9..34504ed2c086 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h @@ -12,9 +12,11 @@ struct hns3_stats { int stats_offset; }; +#define HNS3_CMIS_FLAT_MEMORY BIT(7) struct hns3_sfp_type { u8 type; u8 ext_type; + u8 flat_mem; }; struct hns3_pflag_desc { -- 2.30.0