Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2738104rwb; Wed, 30 Nov 2022 10:10:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf6BbHAdFbZZtbai5xFAp2jOs9+pJUpUvz2GtIyZwyTg/l7zIXHguYUWtPTZO+slPL3IV78F X-Received: by 2002:a17:907:9c04:b0:7c0:9bbf:92cd with SMTP id ld4-20020a1709079c0400b007c09bbf92cdmr4198371ejc.465.1669831828481; Wed, 30 Nov 2022 10:10:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669831828; cv=pass; d=google.com; s=arc-20160816; b=uwKIqr5DL25dCAPuQeZbNmmnlWfEy4v4cqj9lWRV5qrwx+zhAZhKfMbwjjVGjEeWxu tWoxBiz8rtM/srAIJmCWuVbm3GZLGw/57Z2Dk4fRkicRpIg0qsT4tv7f5/qrfLm4/J3S XhqJom137KnhkLsSTKSxxbo+qTWMIW55z+c5GSieNq/g/MIkKf1IDMzI0KEv32bFWKMF j46zVr3fJQzJNqKylkaVgrXdxWlu78TDOjuPVxDOE7rAOADRT8XWKyxzL+wBo/Xl6lph CssfZ9l0T86FxP87rI58tS1C3Kq2Siu3BT9ufpV0EYyaK242cNmYDgV1i4NFTy+Gm13T dnGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=bjaYWtrI8UYqBos1F7geCuWw8CGhiNE9FKjj8yvTDVo=; b=qFWZXMFEHxu+ZoGM2fBtyZ6Zvn6S+DtG4pZlPg+PWxqXm+Wh4PaZoJuB3WT9TgWsFD q2/Kyl/6er8ij76CqyuOopWhgiBLvtsXmNwMiZo1qZLnYMjOQWQ1X74Xqosct4SEw/Kg iJZ/aIxSFzD8M+HLFR9caB7zNUq4f+Od5PaonPJwyjJweGkD9H6PX3nwCsKjoujq3ldK 5VH/w6LeBT2/C9oOXcNAS4fErOwo9Iw8kaTVKGvECiBLHoSXTsskC7GJxBAoNhk0mmtg ajfdQB4mv2qp/Po6nF70MvkD4loyXndCDxrJ5WF6Qec9J5g/DIyU8kkdyHHVwR7c6EmF NiIQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=m+y9DpMO; dkim=pass header.i=@microchiptechnology.onmicrosoft.com header.s=selector2-microchiptechnology-onmicrosoft-com header.b=YJGE+QJ8; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n26-20020aa7db5a000000b0045d4015cdcesi1763121edt.51.2022.11.30.10.10.07; Wed, 30 Nov 2022 10:10:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=m+y9DpMO; dkim=pass header.i=@microchiptechnology.onmicrosoft.com header.s=selector2-microchiptechnology-onmicrosoft-com header.b=YJGE+QJ8; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230041AbiK3P5q (ORCPT + 83 others); Wed, 30 Nov 2022 10:57:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbiK3P5l (ORCPT ); Wed, 30 Nov 2022 10:57:41 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53B896314; Wed, 30 Nov 2022 07:57:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669823859; x=1701359859; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=E/2ASbzlwqghXk+d1CVbPhH/tU7kjBGAmU0fxBfbFMU=; b=m+y9DpMO+HIBj8vvs0l/ZpnENDZL3LMDe2hzdCKKN9kQVK7rNF44DRlI xtb6MF8HFx8xtReZk8l1H7hoDlF0ZIF5rtYttUvgonZpScZji/S17U26A XPN0LXEzcL6O78s7VA+iivCG6ZBXQvI1YutKlLCupZPcxqMjnx9blM2hw vjdUu3coid9EQdRTr6Mn4c25NVHvAzJ/yBA3SIQMC4ZQ8EuecvRo0VHv9 8CfqvmXwt6aMV9weNib/vOHIJ58ikPzmLbbqXziHqUFwCjmC8XOPjtJ8G r/ztyLCg85nVoj5X5pygInN0QGr4RMlpjqknHbklrPEjZcNsPg0VtjjfT w==; X-IronPort-AV: E=Sophos;i="5.96,206,1665471600"; d="scan'208";a="125821796" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 Nov 2022 08:57:36 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Wed, 30 Nov 2022 08:57:36 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12 via Frontend Transport; Wed, 30 Nov 2022 08:57:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XFXh9UtrPXWWHkLTjFBivwhg+7Ty5UwwxFdmTI21J7Mw1veKtcuQdcwKuZhDznwEMPECdXTQe1HHuFepN8Ru7TUzamVd30cVHQRRTGZyqX1dINlOMuoKBkv8x2EXt/4hG5+7ha0HGLvol6JP7C1+Ym3OwTOfxfp653gTNQkVxKMGuTIPJshMYIfGrVTp/4AfnxnfKYzbtQyyWkt/VmCwPYO4glWuckRKH71S0sWUdZ659n163EVobKYZoNSh5ufLTYn46DtdmYSI4DCgZREOYnqG/q5aQcX9LlOnf7/J+mWIq9vqx6suBUa+pWwibaN73/MXuH7qIAueRKaTBSr3Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=bjaYWtrI8UYqBos1F7geCuWw8CGhiNE9FKjj8yvTDVo=; b=D7dOCU4ol4A4yo18QI17fLOKD0WNt0bz18UDpCqNFOxD9Pi4iLrbUMkFC9AdEaqcYcJfXI6id7u+HTz7Pcfo1mm2KG08tpiokfTjoVU38T8wDQfaVIJEOvRzWTPGWMqlF0I2myJqqkDRK6K4f7agbBSh+YxWNj3twx+tw5GR6U+AUkjcp9+2WH5c34NovDeyU8M1d4ItIc1KWkzHl71iOl0fvZ7wDdrsoYJ2A2aBrX8MOGKakBikxW7QVqREuDOANFxvjFPcBHMwoKw19EQ0YYysHNrxE9va8lgXA8AnHi8A9BeZdc/f5cdTCaGNr2FAFIR42DPGwVWc73kdCioEmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bjaYWtrI8UYqBos1F7geCuWw8CGhiNE9FKjj8yvTDVo=; b=YJGE+QJ8IAGMUHWFbltBjvxN8N3lnNQPTe3DtULxhBmHmt0apYKpYrjv8KY9JRiYsYw056XgVjJqDBuOxyMn+05wOuZN4kd+iD+OQB+Tt1Z4+ndxBC97U/r3jGLKyxC/RzcipjohcjJ1VB5akyiyINXgD/z4/oviLK0UUXFQgi8= Received: from MWHPR11MB1693.namprd11.prod.outlook.com (2603:10b6:300:2b::21) by SA0PR11MB4558.namprd11.prod.outlook.com (2603:10b6:806:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Wed, 30 Nov 2022 15:57:35 +0000 Received: from MWHPR11MB1693.namprd11.prod.outlook.com ([fe80::5928:21d9:268f:3481]) by MWHPR11MB1693.namprd11.prod.outlook.com ([fe80::5928:21d9:268f:3481%10]) with mapi id 15.20.5857.023; Wed, 30 Nov 2022 15:57:35 +0000 From: To: CC: , , , , , , , Subject: RE: [PATCH net-next v3] dsa: lan9303: Add 3 ethtool stats Thread-Topic: [PATCH net-next v3] dsa: lan9303: Add 3 ethtool stats Thread-Index: AQHZA2vPxK4eDIuP5kOkg3W32g1dkK5U02GAgALOauA= Date: Wed, 30 Nov 2022 15:57:35 +0000 Message-ID: References: <20221128205521.32116-1-jerry.ray@microchip.com> <20221128210515.kqvdshlh3phmdpxx@skbuf> In-Reply-To: <20221128210515.kqvdshlh3phmdpxx@skbuf> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microchip.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MWHPR11MB1693:EE_|SA0PR11MB4558:EE_ x-ms-office365-filtering-correlation-id: 13bb3574-ebbc-434e-e275-08dad2eb990c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: afWDzNwHoSl0ArUljEzSjpgmFY5aSES3TWJ2qy8h7T+AagqBZXFDt1TWxkCs6cvVw4388tjH8iUaPMIgdt7YY4zuPkR0HtjxkXtisq1zyu2K5GdcXaKE+CeJ2m9f24I/M6Fxu9S9IfXRW2J996lEnE14iMGW7huwDUBQLrEvSq3APiKvqVQXpkw0Wj7bzNvjOP9ezE1Mglkt5yW3aIC+3U1YfYoSgg03G7rKIMvLuUUkwT7DhFJJmjdS94TCpknwDuOIj1Ko1+5knPsEAsGsPNDCq6QUAr5/6VqmSg09oEICKu0lq44w0pOZPTswr1S9wGK9V7mvgyaR5zceBj1d44dZWZSu/gnxBv3Qdl9PcMPw5D+eYpeLyl+XGyybqY3tyHo231CMvhefCwAWL/UYKcX+HFA7JD/xUJrLAnVTCp8WYQEFgX9d2W7H8vWFYD6h+JxcZRcmty4l59GCP2eOF+O5fFhCaAqHPieWUhA9SMUo8xiPbp1GHJyOtHuVFpFRLQ7J+OXY5d2tHcCw4CV6jFaqTRmQUuvdkV+rKq8U928KSAwC7p3OeQBOD6l8VgzMYwljXAo4R4+V7yE2WB+z5FQF/ggTtjg20Z14ny3TIFRjK3OtSP/KBzp7gA82BjE/ewlQlkEA6DOlVzlx596Nc3FVCfmmZ6ood23VZM3F5orOeCm9iu9oRA3yc61gsBikjKzKEhwjgOexM6/OYYLBzDu8UejU3zjPED79DKDBcUQRM3aeiNTzqRdxoGjesl2R x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1693.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(136003)(396003)(39860400002)(366004)(376002)(451199015)(6506007)(2906002)(6916009)(66476007)(4326008)(66556008)(41300700001)(54906003)(186003)(64756008)(316002)(8676002)(52536014)(8936002)(76116006)(9686003)(71200400001)(5660300002)(33656002)(86362001)(478600001)(26005)(66946007)(66446008)(7696005)(122000001)(38070700005)(38100700002)(83380400001)(55016003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?yxarYRalWUSs4eGmCqO43KBx/O22i/BEjZFt9QgTs1Wy4/rMizPlS6vAg4kG?= =?us-ascii?Q?0YEKU6jaTK3YIzM4o4VFT8zTDYP6cx37BRdsPy3Rh+/piJ8yFI+NJu9VdL4I?= =?us-ascii?Q?s5sF+HWfVmKndYl9ZAvwZGY81nghfNOGgc1wizqXT4vcn1m+DxF04GOTht82?= =?us-ascii?Q?VUKxrIHlh50wYdDbu+0RmBqbD0I3YhdTRk2nXgd7qHPRbnYo08R4fzchZ7jO?= =?us-ascii?Q?RanVU0H+dnN6++98F3IouxzCxNKmNuodxva+WonrtmYV+jQL5r1bjy4628c1?= =?us-ascii?Q?ph5SHG9HQrZO9BHQeF5mJOneqZGUBGIAIYwr7iopUyArV0YBFElcomaGwfdX?= =?us-ascii?Q?KIb8vlPhwyytClc5UWNtnJJ5lCFRUmrjhYhTq8OUQC2tFfGpjLtzHKMAX53p?= =?us-ascii?Q?BrzTqvHR5/UJVKQHPxXp92aBjZrkodUzAXh8132eOZU/HnCNWT46sCt3v9XB?= =?us-ascii?Q?QRvyWjlYnQ0zQytVRXiUQ9lWuZUTIvC3Ipfu9RpBzXT1VqeNp1VIVhBUab90?= =?us-ascii?Q?pzO9LZs61NtJTV/J/29kvl0sdMwBGeaAIc1sYw/bmhl7v1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WumijLM3qQlmWMloyCO9cGagISbsEPCY8U?= =?us-ascii?Q?BACv9AtEFSbDL9g7xzONdZ1fCgRKGTSvP4a+fKCnKdyqh83qJNsICM/+wLZZ?= =?us-ascii?Q?Zrs5T4LraWW6eQT9kcgnmKtiXP1DoZJLLfamqhR7?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1693.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13bb3574-ebbc-434e-e275-08dad2eb990c X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2022 15:57:35.3096 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ktpedLb3eH5NJiRFRmqY9ZMTgAGspGsOUYX2sHHGUjfI7okdakO9lnUXa2VOCqcHT0huW/NubKSEFsX79WZELA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4558 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port, >> uint64_t *data) >> { >> struct lan9303 *chip =3D ds->priv; >> - unsigned int u; >> + unsigned int i, u; >> >> for (u =3D 0; u < ARRAY_SIZE(lan9303_mib); u++) { >> u32 reg; >> int ret; >> >> - ret =3D lan9303_read_switch_port( >> - chip, port, lan9303_mib[u].offset, ®); >> - >> + /* Read Port-based MIB stats. */ >> + ret =3D lan9303_read_switch_port(chip, port, >> + lan9303_mib[u].offset, >> + ®); > >Speaking of unrelated changes... > Cleaning up a warning generated from checkpatch >> if (ret) >> dev_warn(chip->dev, "Reading status port %d reg %u= failed\n", >> port, lan9303_mib[u].offset); > >...If lan9303_read_switch_port() fails, should we copy kernel stack >uninitialized memory (reg) to user space? > Good catch. I'll zero out the returned stat. >> data[u] =3D reg; >> } >> + for (i =3D 0; i < ARRAY_SIZE(lan9303_switch_mib); i++) { >> + u32 reg; >> + int ret; >> + >> + /* Read Switch stats indexed by port. */ >> + ret =3D lan9303_read_switch_reg(chip, >> + (lan9303_switch_mib[i].offse= t + >> + port), ®); >> + if (ret) >> + dev_warn(chip->dev, "Reading status port %d reg %u= failed\n", >> + port, lan9303_switch_mib[i].offset); > >Because the same, existing pattern is also used for new code here. > Ditto >> + data[i + u] =3D reg; >> + } >> } >> >> static int lan9303_get_sset_count(struct dsa_switch *ds, int port, int = sset) >> @@ -1017,7 +1061,7 @@ static int lan9303_get_sset_count(struct dsa_switc= h *ds, int port, int sset) >> if (sset !=3D ETH_SS_STATS) >> return 0; >> >> - return ARRAY_SIZE(lan9303_mib); >> + return ARRAY_SIZE(lan9303_mib) + ARRAY_SIZE(lan9303_switch_mib); >> } >> >> static int lan9303_phy_read(struct dsa_switch *ds, int phy, int regnum) >> -- >> 2.17.1 >> >