From nobody Mon Nov 23 10:33:12 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794819606; b=WBcv54Fop/mSTO8T8UnrueCWJrxH9nfPgBVY56h0136bOOhefp6hLI99j3QFt8SjlNk1 1bWluneZ+HS0pxCBKcy9kJm2xK6fxT1goQfQOWCtVj41oer8QW4Bb1oBt+fEc3oejKBTp QzxtxcHNZxXLrnlsPDozqPPhDtkY5IfvIFG1/TB3U3ZbXlcpgyb6L82Rh88AmZQ2Eqy3r ywBH1ni2o7SlB8MsZEm68eRndqo12mZaPkwILHeBnZBR8PK5/AyQEHf0ARMdS5mgpvegU C+8jD8yQyPJBc3CTGkI2JmqR6jh4eJpi/0qGXwab0/eBZlHbBinRzYjoT/eHujuvKdA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794819606; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=Z1T9rHVfS5D3FC+BJOtynV5uEujPCuJ4oTq6T5KpuEM=; b=yoIR9Gt8zwcYatA/jyqet+ftXyyd6O/LaZNc5Z9T3K5pBcJhGyOg9nC4PDdmOiVP2RIt kKXS2Pp6huyhs0v+rJhRwTPIu8tWWB3Y1U22PLcd3Q+hIWTlWgL1X+DLh3RZPrEb4yFWe 4aYh6rjwsUYBbbCR+RBsddvXq0frfnvjcySQ1MbM7b7t1mq358CkQawoa+vK6GgvKYg5o Q42zQVpFNoq8yBjRfNTXfXPMQ0JunVMDnBtDG77s1pGprFKIr6CKNflVUwgCvwsXz4k0D i/AqRpNPFNp5+1cJo6MMkyxK6uoMsUamWf0IRD3nHqq+yOXlM9mdMpv2qSnPkF9Kp0w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=tNfvVtRt; arc=none smtp.remote-ip=209.85.160.53 Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3B4C606A329 for ; Mon, 16 Nov 2026 09:00:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C3B4C606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=tNfvVtRt Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-43bf9548df4so4517120fac.0 for ; Mon, 16 Nov 2026 01:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794819605; x=1795424405; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Z1T9rHVfS5D3FC+BJOtynV5uEujPCuJ4oTq6T5KpuEM=; b=tNfvVtRtVFeRRn6F4Yx1d12ky5HuQRQs2iLfreCcdSy23EJ0j8AB+6MDzN7qAtW3TG Xkg9tkpLQ9Ycslf07hEjqdo5C6YG9Ze/3eLBP8KZJycBbohlgm2+zOdATtDnCyugMaz3 eY9dWP3Q9pWhM5PFi1w7+b11LbCoeW2fVYvq5KM92aSPTm+TGN/d7NYkX7hnWdj+eNV3 0p8sCnp1eb/TccoVzAvnXjHD1dRS+shv4nQlHZ89ZOl4EJ1rZuqqfgco4b6XBW2mfNDB R/5X8q5ShHuD2k5iHoNuqywYlRPASkWjGakYGodZ6eVAJWosO/EcCPpM8w33jGvlQNyy O1YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794819605; x=1795424405; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Z1T9rHVfS5D3FC+BJOtynV5uEujPCuJ4oTq6T5KpuEM=; b=lYAOqNcn+jcHipTVjjaELBfDsuR/MXCv1zLRsJc71zoR08avsKWpi/IwvhsZ2iompg et9bHGcgaCrYf6QGXwjGHWTPUaCiZ+iXcL5zQv7loImLadLndM87grqVkPGWmGNBPaPx DtJNb+7RjhkI/XHKCe8IYuP7gjeEcIcodYW8CNnG/Xm1AbHOYWRr7ZIOeqdjA7H/VAPE z3L8Yc8GncKN1KugwPnDrYxidESgHWMOIgmyFvlaaDkKt12QCM91p9lLmoPD41u9owVI jCJXcChjBkf5LMBVMwO2GrvGYF4TMpEf4O/r0dKYJnb4Nk1fWC7wP4rOz7ZhAzHMvGA2 KqsA== X-Forwarded-Encrypted: i=1; AL+hErEeWdAKsgdo6Oe/ywR5NsBUnfoe1eIkF0aFjVGXLcrSTbYOqDcuTv6904G9kPDoNtoWGZkgAVxXFekMBw4=@vger.kernel.org X-Gm-Message-State: APuU4Z9HCvh7Xkk9Yn9dovLXAMoHeh2cD9CIHxrODNrC/Sz5uT9/EIAm zNxg0MFw5Gj/oBNVBnOy5yB0OU0nX4kLHTSKzzooozrYHaAjEdWljioE X-Gm-Gg: AYBFou2lj9U1KS1sg6AXIQpCTp9zPixXaRBPIYt8EB8wl4o/BjpMUlBqMVowqdPYl6M fxS8N+Ij03UO1PAChlYXwhyIxXnjjzovo5d4HtgV4nj4rQKjGEthi77JLXFQRgwIbooxPrbDK+E goLXjQdPpzK+B/8exuZwZ6LNvDIEzdUwtkbjbuHrfdMaWmcTdTdwPD6NxHK4tuuadiQ/yx89y4C cIzM/xhpVMnmx8wyvIVAOjyxldXBddU4zgVZ4x/0O0PTfI5lrJgJxWIHCU3gCi3Z+CmzfyY8b9L 3g62ld7v8h0f33D4+6085SHSBWs7DL/OhpwYorXZNTLrEFUc5ldXjrqo7TPPc+bVTrjsjBHkstj dOwBtop1g0aAuLHHJQ0KtZlemCA8VInDDRj7Qgat4cOZDru9iwATrzxen2GO/IVrqmYP9Lc258Z t+jr41rkIMvQotaGXCxVak3IDWbU/FZ9jFa/y9VcLQL2HNGHIgY5KY2QmQxVOuudGQeI8skaTkU FUrvyBnP3mom9LUabnai2OSPXNrgZZoOA128CE6xrUcxExsNQISCbdoCFoHEVlCWrJVTVpxIeQv xjuUvYWvb9KHudbYm5wDPDzHjL7X6LR+InhI+QVzOVQZp8ngEuPVUzmo6iMB7LhWYznN1TS22Vs 4ANQEJ37TOKrud3s/hx5LS+PSwszYq2A1VtDdS6KFFFDIxn/tjWhHxaNGUxEVf6RyfYkknwMexp 0mp3nvsYMLSNnNclmB8oXaYzkNAoZhpACywM7RtIS2h0RuauBDIw8= X-Received: by 2002:a05:6808:4d06:b0:572:86c8:6b4c with SMTP id 5614622812f47-57286c86d22mr4614870b6e.6.1794819604482; Mon, 16 Nov 2026 01:00:04 -0800 (PST) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 5614622812f47-5750329397bsm719177b6e.6.2026.11.16.01.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 01:00:03 -0800 (PST) From: James Hilliard Date: Mon, 16 Nov 2026 01:59:57 -0700 Subject: [PATCH net-next v6 1/3] docs: networking: correct the PHY statistics group name X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-submit-acx00-phy-stats-v1-v6-1-8feef8e76cd5@gmail.com> References: <20261116-submit-acx00-phy-stats-v1-v6-0-8feef8e76cd5@gmail.com> In-Reply-To: <20261116-submit-acx00-phy-stats-v1-v6-0-8feef8e76cd5@gmail.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan , Randy Dunlap Cc: Oleksij Rempel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Hilliard X-Mailer: b4 0.17-dev The ETHTOOL_STATS_PHY group is exported as phydev by stats_std_names[], but the ethtool netlink documentation lists it as phy. Use the exported name so the documented group matches the statistics string set returned to userspace. Signed-off-by: James Hilliard Reviewed-by: Andrew Lunn --- Documentation/networking/ethtool-netlink.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/n= etworking/ethtool-netlink.rst index eba226c79ec3..8659761ebc69 100644 --- a/Documentation/networking/ethtool-netlink.rst +++ b/Documentation/networking/ethtool-netlink.rst @@ -1665,7 +1665,7 @@ the ``ETHTOOL_A_STATS_GROUPS`` bitset. Currently defi= ned values are: ETHTOOL_STATS_ETH_PHY eth-phy Basic IEEE 802.3 PHY statistics (30.3.2.1= .*) ETHTOOL_STATS_ETH_CTRL eth-ctrl Basic IEEE 802.3 MAC Ctrl statistics (30.= 3.3.*) ETHTOOL_STATS_RMON rmon RMON (RFC 2819) statistics - ETHTOOL_STATS_PHY phy Additional PHY statistics, not defined by= IEEE + ETHTOOL_STATS_PHY phydev Additional PHY statistics, not defined by= IEEE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D= =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D =20 Each group should have a corresponding ``ETHTOOL_A_STATS_GRP`` in the repl= y. --=20 2.53.0 From nobody Mon Nov 23 10:33:12 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794819607; b=W8p0Nfe/mB2lnA9StoJWCzuPlr9jN7titMIaIo30YbexA3c3RSgedWeGLQMmvofcfiTZ xUsMXtpdYBGvWq3rVuJcIOE+NhFLgbIAqVElqwKF+Qsz6qIFVpldl4DnUkVCkDnGao7LQ n7lRQDT5NdT6SVmvTolfA+rMlSjOZ9FKCsDvGwnL+dIstAraMsMdkAqnGLnTZl2xwydFe /RUGqB3erzRw7MRwBm0gPM1Rpgu4f+CHs7nCEOH21z47j7Q/hRhK0AfXeFNKtAMzCnWcL xhGyO5ZdhXZJoysIt4aEns7XdWVVdDIttA17M7Z6Q/aYJN19BHpNgsgq9QJghkoEczg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794819607; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=muvZdkuFtn0hfXPNvFEMPR8KK69nJzaQNXj8cS0B7Og=; b=lu4UBrPU+uMWN72ZwK7oNAicldA9KELvadqSw4NQoF5ohcnG5sQWOArEQRm64i/3OzqE X9o8XVfPgW9S0pdWnMGdEr6ySd4cHHg+P9/172pGAaAs8P52j8kd7EV/xQzbEKBeZ9s6U jRRiMH9t6D0ALOe3wrF5qTJDT0LyE7DYWkcM2WnivZSLoPt5QwGqgSeVt1RzoXyy9KfM9 e+Qd0v6RUrVSQ4FN7nv8Qd2VSpOSQV+D/nQzOPd9JjQUAj3HQkk9aAvJq1CJcyVqYhf1d iAO/zn56lvix3zn496sY3eiYdoUh9IvSUrQjoiTU+v/oCRZFj3tXR/bYUuSSspaBoXQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ntpUZCCb; arc=none smtp.remote-ip=209.85.160.51 Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EB19606A888 for ; Mon, 16 Nov 2026 09:00:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3EB19606A888 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ntpUZCCb Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-451a49abd8aso3433512fac.3 for ; Mon, 16 Nov 2026 01:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794819606; x=1795424406; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=muvZdkuFtn0hfXPNvFEMPR8KK69nJzaQNXj8cS0B7Og=; b=ntpUZCCbXm2wFhbFbXhsgDTYNZw2HUGWwUUSI1oSVaNaS9so3zTtXeSudQXXoe+UBf Gfiusd+Co2+kmkuAsIQnUcjr1kF7T6FsXcXTbOWDCfK2fy6p59B2mnYdGl8b1f6W2aGu nH+Dd4hUUABrz9JMx9W8SVvgirD5x5KLgWo8ACb/I5IgI6ClVp2y09eIODbmF6qwqS7R 1HNijtv7tuMN32q6NnPYe68MyuYAagEaTQD0UD9cpEeSiuA9vLSA+4h5i9rYaqbOImsQ z94qxCJb3F4FZzrEhETMsravLSPaxpVXOV7eiIHRVSx6TsJPtaco9zPon1VrBL7ROL5c FSJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794819606; x=1795424406; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=muvZdkuFtn0hfXPNvFEMPR8KK69nJzaQNXj8cS0B7Og=; b=nbNRHUCfBedpCHQqZD/Q3RvNt7+e86WCuQ+lK5lQCdKY/gd3uHUW78bNNHA+8quEOJ iqCC+QpwZJH6VMKaGH3PCap+tFbSr0JfUgto/QdP16NcMAGPHz0vp5yNWw+Lg+SmhS5R YXCBwWO2BfaG8H7QmwLXK9MG2wNn7HhcDwtdjKsMAnzWam/iTE1dahJyAET1eMjenTme dHKSBjXq0rGQ4lXkX2qJUgghtzp20JpGXb/YfLzP5JjWm6UgbERdj5opqb4fvnyUu5Mn Vaqt8mbZcgOC+XSO6CMJXtRTaZpeTQOBvc5n3EC78XDW/GyeGLsq+oJgbUv94t3lmhiI pIfw== X-Forwarded-Encrypted: i=1; AL+hErEAhqpTJnaJX/5l6b80Nx8dCr+A0yfsAcw9MO/mIxSFP9dW8OSSFh7ohB8JHBjeyHHsJK0HPqNC2YMUbKk=@vger.kernel.org X-Gm-Message-State: APuU4Z+KIF0wgMpf/QUSrr9xDR89jTH9QAwtmqlovZqJY+7Qc/D82kqn VOh5aTOM8/Kt21r3nCkOtvL9hmWwienh8KAJQJt9hSYAPGcmYXBF6/P6 X-Gm-Gg: AYBFou3zz2x7CEUCoom4i5dVeneeWwgSYgAadCm7Nen3aiBGpvnN27SXSjAXBmU9fHH BxMSaZXzkCXtj7zNFAsKodAQM8YWjyBvbYhRzNNxPAwJO03b4h6qKcexBoFMUaWSN3DKtarqGoS FurGUU5PAc3V84f6HXKvBTu44kMKLJzv8nISnZVqoX+yMHhruH19ebqX28Rg30kuQAi5gS2kGZg KhduywouMaJIk50psSbDq2Qk/bkmqZidDkFOU4QFu39M4gmQQOhNyCSjYubxzacyNwsE4x1rNfW j17WhiwfNJe4tmdVfFahqE9Hyc5zwFep271umJpbng3lDu/80VI3TEa2MLLFH/9H+opRI4nDhFg y08rD6dsq8SUeNzZVZ0TLGSIGPuwR9M1YOHWtE6bxAzygo33/kolgmUB2h88lkmsKhSdaTGavbn DC9vS1t8IJurwSkHR1x6nJlC2/MSNQHGzyXlc3BrqIBO2gJuLYc4f7jilUMxnsgaQUXrgVdp2Vs fW5fqj1+dYWlYKhhW9WcMOEpJL0GdUStNP06m0T0ff3Z5bJ9I0X2M2SUgrWI/DSd9bgeCkET23C CRuOgpTFOGE5JTmjhOel0ICR0NvXNZQh8zXzJpcFe+L+waQkO/daWpPtafzunYlQFf8RteLw9Qs +IJ6WHDbGs3J9B06a8JxW938irhg/W9/U+ow9xm5EuDcujpkoFlLuiGHOeNCDpm2+f6cCwzZ5IC E6J4K6cnWeTQpkoRaE5pgPeh43C25YY3l3rchW8Zo+tkgG1yKoqapveIM3QvFDIFCXlDZEMwKX X-Received: by 2002:a05:6808:4f60:b0:572:d0fb:ae61 with SMTP id 5614622812f47-572d10afddemr4314071b6e.49.1794819605661; Mon, 16 Nov 2026 01:00:05 -0800 (PST) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 5614622812f47-5750329397bsm719177b6e.6.2026.11.16.01.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 01:00:05 -0800 (PST) From: James Hilliard Date: Mon, 16 Nov 2026 01:59:58 -0700 Subject: [PATCH net-next v6 2/3] ethtool: include errored frames in PHY receive byte counts X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-submit-acx00-phy-stats-v1-v6-2-8feef8e76cd5@gmail.com> References: <20261116-submit-acx00-phy-stats-v1-v6-0-8feef8e76cd5@gmail.com> In-Reply-To: <20261116-submit-acx00-phy-stats-v1-v6-0-8feef8e76cd5@gmail.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan , Randy Dunlap Cc: Oleksij Rempel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Hilliard X-Mailer: b4 0.17-dev Some PHYs count bytes in all received frames, including frames with errors. A successful-byte count cannot be derived by subtracting a frame error count because the lengths of damaged frames are not available separately. No in-tree PHY driver currently reports rx_bytes. Define this existing counter to include bytes in frames with errors so drivers can report their hardware byte count through it. The counter describes reception at the PHY, independently of MAC or host filtering. Signed-off-by: James Hilliard --- include/linux/ethtool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index c3a41fbd5426..9c3f079d9573 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -481,7 +481,7 @@ struct ethtool_eth_phy_stats { /** * struct ethtool_phy_stats - PHY-level statistics counters * @rx_packets: Total successfully received frames - * @rx_bytes: Total successfully received bytes + * @rx_bytes: Total received bytes * @rx_errors: Total received frames with errors (e.g., CRC errors) * @tx_packets: Total successfully transmitted frames * @tx_bytes: Total successfully transmitted bytes --=20 2.53.0 From nobody Mon Nov 23 10:33:12 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.171 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794819609; b=sSm5ragjs2wNTbUL9i+03WsD7jsBQoHrJEFsJ/C5sxsJutiElMZfP7ZKxPY0KGNSRWjv 7SMQ5Yoqn3r0wTQXQxKkCZ8tt2IUK7UENB0uIdlZYtXbXXRNARlPKvOBQC+iVAlZ1NssA sxZ7h++S2wgAnQubcqXs4dFteyBCzUV+uRSXzDgu66YTd3mZTc6k5ollaC+o5isjdb7I1 OcsNqJiPO5DbSFkDboVrMHZCq1VH41XWJacGjWIKh3PVW+fIlvMpFs0vlbu+l2TsVm6xm hfm6oH0TKq97se4J9pVzNFKdqZhA3zpDzbJRpCKQKpMpgNUCWQR54dvhbB7QDVj3Yeg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794819609; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=1HiJZr7PWBhg7c3NtSNfrad3eJhRA2sFgk4i49zzVgw=; b=UgM7BSVYg3pZbEOCEwo4pMPG44uGtsBEgeUFJRijYoJIbUTTjjhC/nE02BnClsvh+5GB iTxaXrdD+UP1plGT+ErO/nLXAGfW1uuk5Kv9X+W4v3lD1/4CxiWhipN6OyCIUmfR0qx/X bavS/cbv8pd23Yl14m+6LhXqdH8e8e7jCTYdaJUIYjOz4bUDNXINFJVx5XvwSrJtX7Txt X89cDTp1jADwOcpc6dKxD+/zukMQj3PELs0/cEztT+I3aGJpUNvlY5jCJVhLEDFtDJ9yt QGs9pAJGvfIkVtRzCXpStb3/HGFcvHVXyRERXPimCWF8n1i9efGG28u4Vq7sd1xh6mQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=EEnC7r1b; arc=none smtp.remote-ip=209.85.167.171 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AD16606A8A0 for ; Mon, 16 Nov 2026 09:00:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9AD16606A8A0 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=EEnC7r1b Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-4ed6d69bdfaso2729262b6e.3 for ; Mon, 16 Nov 2026 01:00:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794819607; x=1795424407; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1HiJZr7PWBhg7c3NtSNfrad3eJhRA2sFgk4i49zzVgw=; b=EEnC7r1bPWpSVWkos9N5ngz4fzBEqtsTv4/xjUH72N+Jgi2TEA4X4ARYOnMMxFRzQy e4nHEDxV3eyhz/7TZ+ia5tny1PPSY1eRziGONjvslojjcD7x53KW+RXgyJ+CoPvBML17 hApGC4UZzyAh07W3jUNIXGtpRYUxmsQRDiHUDbKZA5lR/0v8mtlkiPgZ3EBqzCMJLurY eqj/SbBfekA0A2VmmJOj1y2tv/3E0xVVSw2wxWjPev9HHbLU/zEghbJbbYYz7MP8Q8VM RYo20Ygz6hnWpra8KJRrtJqad/45gC/EvP7m22u2SNSZtyJqWdLVlh4c8l7+tG12U69K zLYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794819607; x=1795424407; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=1HiJZr7PWBhg7c3NtSNfrad3eJhRA2sFgk4i49zzVgw=; b=Bm+e9Mig47K5AprqJOOn0+orpmXRPu6fxN+zcan8y1C+H8B6TL/RILVZZCvMB7Wntk z15vc2qCak8RjB/m2HUfdKJWHhXih+a7+cxJoyepiQynsIrupMBiLnDLGedxiTpxehwT /HiUK5Uy2zMTwGvOq9/h7DwU/ihieOG2uy5UwFLGnpRkHi6ZJ8GQT0II7/zFfdWHN8H7 bgmASQcdqHjf8OZeokcQFsyV/1hZVIHspP/ty4WUVFBWmWXsJLrLoP+4/uwKpv4RYxuZ bzamDDIvco9HW6ZWH19PZgIwb9mAH5jc/jqNrWLLB8OIpZct85Z7ES574fH/zDRA6KFW 0kKg== X-Forwarded-Encrypted: i=1; AL+hErEdx7ju5pl91NedtwX0Cs7AAx/8bwcg11hNdSn87IOTqMDMyS1j66G8SHzjqFgNGsv7vbY4mPdXQgUuGvQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+4QYwwPUgNRegMxN7w+d/hJyzP/izAG+ALXerulj+c3bGRKckR ZFVSay6iByM8uecf7Qwb57PDmsUXNa4VTCR6oKcl2SlnceavmTSiGUPl X-Gm-Gg: AYBFou3Sey815AYm6YDDxNOxYbcAhTabBiDYNANW56be9ohXXaQUDEBG2fiWz8W+agw og17SNKAZay0dFrZPAWImc8wmtq96s9eFjQk0u88lx9+CNFDDkvVlFroQrEVSl4aJuvM+Sml6wL Dy7qIzh/Xo78EnVorL59EKpiLC/2nmUlndGF4bMBLlISoZ/gj15reDNme5qDnr9hungOk6+4QIn /SMBnOlenlXGoD4P3wHkCvMX2F2I1T8vwLBKwQnm8fZeuPVTu513V8P71etEQTKwaOp1t/P3rmX IxwL87fRSNOvJY5K3qzy3oKPjcNdOmy/Lf8LeG9hk9jZ9zDI7mMt9TcxZOP8VBfDL2pRkj6oVGw oVvhOghoU22at+Qm+gqc+GIdu4JsXSOVadJ8is+KcOJcQD3xEOzdBaheGfPW2AlsuGJ3rrivH0X yxOSWyNm1wopNzcsdz+R1+Vnxi1/cJEfd3YpEd/IA7VMjA/UM+hfJoQOjypXTsvkGlS53BNdO9R xrTx3rIQzVaHi+RQIBzqT1dDtdrkKLoWrtuDMs5uzovdMEEydias/kuukSjq7vVg9qEJcnZOkti 2HaZndIWhSsJbj2rQhMed+Ihh0YlBfVIY3mtxXW3UXurxJ8Xgfu6igdDwnOit0FClEZND+QySTW CFgw0/starbL5Je03NvuYLvohqamzBD0NbH+yA4a2+1fTcWu9Z13Fmhv1Er7ayWQA7wvEfSvvTJ JWv+TSF4EuC/xKTma2eB23IbEhuGbmiCDQgbT6cPhlBHrZGyBDibc= X-Received: by 2002:a05:6808:3089:b0:573:8745:a99c with SMTP id 5614622812f47-5738745ad73mr3144377b6e.62.1794819607303; Mon, 16 Nov 2026 01:00:07 -0800 (PST) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 5614622812f47-5750329397bsm719177b6e.6.2026.11.16.01.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 01:00:06 -0800 (PST) From: James Hilliard Date: Mon, 16 Nov 2026 01:59:59 -0700 Subject: [PATCH net-next v6 3/3] net: phy: acx00: report receive statistics X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-submit-acx00-phy-stats-v1-v6-3-8feef8e76cd5@gmail.com> References: <20261116-submit-acx00-phy-stats-v1-v6-0-8feef8e76cd5@gmail.com> In-Reply-To: <20261116-submit-acx00-phy-stats-v1-v6-0-8feef8e76cd5@gmail.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan , Randy Dunlap Cc: Oleksij Rempel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Hilliard X-Mailer: b4 0.17-dev AC200 and AC300 count received frames including those with CRC errors. Subtract the CRC-error count to report successful frames through the existing PHY rx_packets statistic, and report CRC errors through rx_errors. Report the hardware byte total through rx_bytes, including bytes in frames with CRC errors. The free-running packet and CRC-error counters both wrap at 2^32. Read each counter high/low/high to detect a carry, and bracket the packet read with an unchanged CRC count before subtracting. Their difference also wraps at 2^32. Accumulate its wrap-adjusted deltas in a 64-bit total. Hardware measurements on AC200 and AC300 established a receive-byte modulus of 4,000,000,000. The byte counts include Ethernet headers, padding and FCS, but exclude preamble and SFD. Apply that modulus to byte deltas and skip byte samples at or above it without changing their baseline. Bound sampling retries to avoid retaining the PHY and MDIO locks indefinitely. When CRC errors keep arriving, update rx_errors from the latest stable error read without advancing the successful-frame baseline. A later coherent pair accounts for the intervening successful frames. Collect bytes independently of that pair. An unstable sample is not an MDIO error: returning a synthetic error from update_stats would make phylib take the link down. Real MDIO errors, including page-restoration failures, still propagate. Serialize sampling, reporting and power transitions with the package mutex. Commit samples only after page restoration succeeds, and return cached totals from get_phy_stats without further MDIO access. Invalidate baselines before soft_reset or power-off, since phylib may already have reset the counters. Take a best-effort snapshot before suspend and start new intervals on resume, including when WoL retained power while polling stopped. Keep a separate sampling time for each counter and discard deltas after gaps of at least 320 seconds, including system sleep and register-read time. At 100 Mb/s, that bounds the byte counter and conservatively bounds the frame counters even at one frame per received byte. Retain accumulated totals across these gaps and power transitions, without inventing an unobservable number of counter cycles. Signed-off-by: James Hilliard --- drivers/net/phy/xpowers/acx00.c | 223 ++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 220 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/xpowers/acx00.c b/drivers/net/phy/xpowers/acx0= 0.c index cee6c7ff0278..0015816fad07 100644 --- a/drivers/net/phy/xpowers/acx00.c +++ b/drivers/net/phy/xpowers/acx00.c @@ -8,12 +8,14 @@ =20 #include #include +#include #include #include #include #include #include #include +#include =20 #include "../phylib.h" #include "acx00.h" @@ -31,6 +33,7 @@ #define ACX00_PAGE_2 2 #define ACX00_PAGE_6 6 #define ACX00_PAGE_8 8 +#define ACX00_PAGE_9 9 =20 #define ACX00_PAGE0_GLOBAL_CONFIG_REG 0x13 #define ACX00_PAGE0_XMII_RX_CLOCK_INVERT BIT(12) @@ -76,6 +79,26 @@ (ACX00_PAGE8_AUTO_CAL_TX_LEVEL_ADJUST_BYPASS | \ ACX00_PAGE8_AUTO_CAL_LOW_CAL_OPAQUE_BITS) =20 +#define ACX00_PAGE9_RX_BYTES_HIGH_REG 0x19 +#define ACX00_PAGE9_RX_PACKETS_HIGH_REG 0x1b +#define ACX00_PAGE9_RX_CRC_ERRORS_HIGH_REG 0x1d + +/* + * AC200 and AC300 hardware testing confirmed that the receive byte counter + * wraps at 4,000,000,000 rather than 2^32. + */ +#define ACX00_RX_BYTES_WRAP 4000000000ULL +/* At 100 Mb/s, a full byte-counter cycle takes at least 320 seconds. */ +#define ACX00_STATS_MAX_INTERVAL_MS (ACX00_RX_BYTES_WRAP * 8 / (SPEED_100= * 1000)) +#define ACX00_COUNTER_READ_ATTEMPTS 3 + +enum acx00_ephy_stat { + ACX00_STAT_RX_PACKETS, + ACX00_STAT_RX_CRC_ERRORS, + ACX00_STAT_RX_BYTES, + ACX00_NUM_STATS, +}; + /* * Another integration of this exact-ID PHY documents its digital vendor * register map, which also matches the observed ACx00 reset values. The A= Cx00 @@ -86,11 +109,16 @@ struct acx00_ephy_priv { struct phy_device *phydev; struct acx00_ephy_control *control; - /* Serializes package state and multi-register power sequences. */ + /* Serializes package state, power sequences and statistics. */ struct mutex state_lock; bool is_ac300; bool use_low_calibration_tuning; bool xmii_rx_clock_inverted; + bool stats_active; + u8 stats_valid; + ktime_t stats_start[ACX00_NUM_STATS]; + u32 stats_last[ACX00_NUM_STATS]; + u64 stats[ACX00_NUM_STATS]; }; =20 static int acx00_ephy_read_page(struct phy_device *phydev) @@ -110,6 +138,169 @@ static int acx00_ephy_write_page(struct phy_device *p= hydev, int page) FIELD_PREP(ACX00_PAGE_SELECT_MASK, page)); } =20 +/* Return 0 on success, 1 for an unstable sample, or a negative MDIO error= . */ +static int acx00_ephy_read_counter(struct phy_device *phydev, u8 reg, u32 = *count) +{ + int high, low, check; + int i; + + /* The free-running counter can carry while its two halves are read. */ + for (i =3D 0; i < ACX00_COUNTER_READ_ATTEMPTS; i++) { + high =3D __phy_read(phydev, reg); + if (high < 0) + return high; + low =3D __phy_read(phydev, reg + 1); + if (low < 0) + return low; + check =3D __phy_read(phydev, reg); + if (check < 0) + return check; + if (high !=3D check) + continue; + + *count =3D (u32)high << 16 | low; + return 0; + } + + return 1; +} + +/* Return a mask of usable counters, or a negative MDIO error. */ +static int acx00_ephy_read_counts(struct phy_device *phydev, u32 *counts) +{ + u32 packets, errors; + int ret; + int i; + + ret =3D acx00_ephy_read_counter(phydev, ACX00_PAGE9_RX_CRC_ERRORS_HIGH_RE= G, + &counts[ACX00_STAT_RX_CRC_ERRORS]); + if (ret) + return ret < 0 ? ret : 0; + + /* Bracket the packet counter with an unchanged CRC count. */ + for (i =3D 0; i < ACX00_COUNTER_READ_ATTEMPTS; i++) { + ret =3D acx00_ephy_read_counter(phydev, ACX00_PAGE9_RX_PACKETS_HIGH_REG, + &packets); + if (ret < 0) + return ret; + if (ret) + break; + ret =3D acx00_ephy_read_counter(phydev, ACX00_PAGE9_RX_CRC_ERRORS_HIGH_R= EG, + &errors); + if (ret < 0) + return ret; + if (ret) + break; + if (errors =3D=3D counts[ACX00_STAT_RX_CRC_ERRORS]) { + /* Both hardware counters and their difference wrap at 2^32. */ + counts[ACX00_STAT_RX_PACKETS] =3D packets - errors; + return BIT(ACX00_STAT_RX_PACKETS) | BIT(ACX00_STAT_RX_CRC_ERRORS); + } + counts[ACX00_STAT_RX_CRC_ERRORS] =3D errors; + } + + /* Keep reporting errors even when no coherent packet sample is possible.= */ + return BIT(ACX00_STAT_RX_CRC_ERRORS); +} + +static int __acx00_ephy_update_stats(struct phy_device *phydev) +{ + struct acx00_ephy_priv *priv =3D phydev->priv; + u32 counts[ACX00_NUM_STATS]; + ktime_t start; + int oldpage; + int valid; + int ret; + int i; + + lockdep_assert_held(&priv->state_lock); + + if (!priv->stats_active) + return 0; + + start =3D ktime_get_boottime(); + oldpage =3D phy_select_page(phydev, ACX00_PAGE_9); + if (oldpage < 0) + return phy_restore_page(phydev, oldpage, oldpage); + + valid =3D acx00_ephy_read_counts(phydev, counts); + if (valid < 0) { + ret =3D valid; + goto out_restore_page; + } + + ret =3D acx00_ephy_read_counter(phydev, ACX00_PAGE9_RX_BYTES_HIGH_REG, + &counts[ACX00_STAT_RX_BYTES]); + if (ret < 0) + goto out_restore_page; + if (!ret && counts[ACX00_STAT_RX_BYTES] < ACX00_RX_BYTES_WRAP) + valid |=3D BIT(ACX00_STAT_RX_BYTES); + ret =3D valid; + +out_restore_page: + ret =3D phy_restore_page(phydev, oldpage, ret); + if (ret < 0) + return ret; + + for (i =3D 0; i < ACX00_NUM_STATS; i++) { + u64 count; + + if (!(ret & BIT(i))) + continue; + count =3D counts[i]; + + /* Include sleep and read time; unseen cycles cannot be recovered. */ + if ((priv->stats_valid & BIT(i)) && + ktime_ms_delta(ktime_get_boottime(), priv->stats_start[i]) < + (s64)ACX00_STATS_MAX_INTERVAL_MS) { + if (count < priv->stats_last[i]) + count +=3D i =3D=3D ACX00_STAT_RX_BYTES ? + ACX00_RX_BYTES_WRAP : BIT_ULL(32); + priv->stats[i] +=3D count - priv->stats_last[i]; + } + priv->stats_last[i] =3D counts[i]; + priv->stats_start[i] =3D start; + priv->stats_valid |=3D BIT(i); + } + + return 0; +} + +static int acx00_ephy_update_stats(struct phy_device *phydev) +{ + struct acx00_ephy_priv *priv =3D phydev->priv; + int ret; + + mutex_lock(&priv->state_lock); + ret =3D __acx00_ephy_update_stats(phydev); + mutex_unlock(&priv->state_lock); + + return ret; +} + +static void acx00_ephy_get_phy_stats(struct phy_device *phydev, + struct ethtool_eth_phy_stats *eth_stats, + struct ethtool_phy_stats *stats) +{ + struct acx00_ephy_priv *priv =3D phydev->priv; + + mutex_lock(&priv->state_lock); + stats->rx_packets =3D priv->stats[ACX00_STAT_RX_PACKETS]; + stats->rx_errors =3D priv->stats[ACX00_STAT_RX_CRC_ERRORS]; + stats->rx_bytes =3D priv->stats[ACX00_STAT_RX_BYTES]; + mutex_unlock(&priv->state_lock); +} + +static void acx00_ephy_snapshot_stats(struct phy_device *phydev) +{ + int ret; + + /* Statistics collection must not prevent reset or power management. */ + ret =3D __acx00_ephy_update_stats(phydev); + if (ret) + phydev_dbg(phydev, "failed to snapshot statistics: %pe\n", ERR_PTR(ret)); +} + static int acx00_ephy_control_power_on(struct acx00_ephy_priv *priv) { lockdep_assert_held(&priv->state_lock); @@ -122,6 +313,10 @@ static int acx00_ephy_control_power_off(struct acx00_e= phy_priv *priv) { lockdep_assert_held(&priv->state_lock); =20 + /* Even a failed power-off can have reset the hardware counter. */ + priv->stats_active =3D false; + priv->stats_valid =3D 0; + return priv->control->power_off(priv->control); } =20 @@ -350,6 +545,10 @@ static int acx00_ephy_soft_reset(struct phy_device *ph= ydev) =20 mutex_lock(&priv->state_lock); =20 + /* phylib may already have reset the counters before calling us. */ + priv->stats_active =3D false; + priv->stats_valid =3D 0; + ret =3D acx00_ephy_set_interface(phydev); if (ret) goto out_power_off; @@ -475,10 +674,21 @@ static int __acx00_ephy_config_init(struct phy_device= *phydev) =20 /* Restore the standard EEE policy retained by phylib across resets. */ ret =3D genphy_c45_an_config_eee_aneg(phydev); - if (ret <=3D 0) + if (ret < 0) return ret; + if (ret > 0) { + ret =3D genphy_restart_aneg(phydev); + if (ret) + return ret; + } + + if (!priv->stats_active) { + /* Establish a new baseline after reset, retaining the software total. */ + priv->stats_active =3D true; + acx00_ephy_snapshot_stats(phydev); + } =20 - return genphy_restart_aneg(phydev); + return 0; } =20 static int acx00_ephy_config_init(struct phy_device *phydev) @@ -534,6 +744,9 @@ static int acx00_ephy_resume(struct phy_device *phydev) int ret; =20 mutex_lock(&priv->state_lock); + /* WoL can keep the PHY counting while phylib polling is stopped. */ + priv->stats_active =3D false; + priv->stats_valid =3D 0; ret =3D __acx00_ephy_power_on_and_resume(phydev); mutex_unlock(&priv->state_lock); =20 @@ -550,6 +763,8 @@ static int acx00_ephy_suspend(struct phy_device *phydev) mutex_lock(&phydev->lock); mutex_lock(&priv->state_lock); =20 + acx00_ephy_snapshot_stats(phydev); + ret =3D genphy_suspend(phydev); if (ret) goto out_unlock; @@ -616,6 +831,8 @@ static struct phy_driver acx00_ephy_driver[] =3D { .soft_reset =3D acx00_ephy_soft_reset, .config_init =3D acx00_ephy_config_init, .disable_autonomous_eee =3D acx00_ephy_disable_autonomous_eee, + .get_phy_stats =3D acx00_ephy_get_phy_stats, + .update_stats =3D acx00_ephy_update_stats, .suspend =3D acx00_ephy_suspend, .resume =3D acx00_ephy_resume, }, --=20 2.53.0