From patchwork Fri Jun 2 09:46:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 102428 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp915879vqr; Fri, 2 Jun 2023 03:08:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4FkAMcAu1LdIv/EvWom2ztSGiMF4DTGBdIvwqNqA1EIAFTV94LnTz1asLZwxJsbJZ8f9f6 X-Received: by 2002:a92:c742:0:b0:33d:1072:361d with SMTP id y2-20020a92c742000000b0033d1072361dmr4298319ilp.20.1685700523514; Fri, 02 Jun 2023 03:08:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685700523; cv=pass; d=google.com; s=arc-20160816; b=w3guWCHPMuQpth3VdPyeDgVzGAOmhUroxjNZ+v0+nFO2mlp8mnYN9sPQqwfeZ+fPEI 1r4pGuRUe7EuqyGrRUPQMzHwdgnM6u7TxZbe73urgwJf3t164bYtVEIT0NKn3fTGQZuX wo62rg3R6Kgp9By7aQ4O5zyRi7OZDIwpsfKtaG59WrC+HwnoMVrPYSe1c9moFfbkgOhK 3dY9fxuJwDYMtPRqowsoUJFweAGCFIlz6d4YMa5my+p+EXwsvi5jVJbIYlJ4dWVBuqIs D+qtxIwCRe4gMIlY6TxwLXWkMk1M8vr3RQ+UerVSTTrDXP2g/0iJT7JNRRI/J/vNVfFj kTQg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vkqLFC/kchqxIkF1WNrIpFC/bBUjjIRYS/T3h65wS3E=; b=sw778EFKF8ImofLzUZ2OD53XCQ8Npx5+I1mR/FrJhq0P6ZWZ5YRJFe4UgGXDeIXAlS fTaKfGYFyLbYCqYZbU8Od45VBAg98I5YkUEUb1rqYyGqZlPRHv2GdkCXMLyLvdd0yn6C uHkvug1/rmHoyFOISl4OweDvjxHhIfghs/pnb+vDal+c8ZUk2ExGwMlzQ4N4WRGlJDTL Y4DSmWoEIzkuZtummYCar4MsQ6spcAN/pl+cvQJe/Y4r+ZIb3MtlHfwwnamwbebz+RoH p331pfpCzgGaVv2/PVJNiJhXAyBs8qpow4+ld9+LYL+W2kO8jRDq9/4HttBlSAZ1RP7T 0+ng== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=qY0tZR4I; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g19-20020a633753000000b00541710a9d44si786707pgn.114.2023.06.02.03.08.31; Fri, 02 Jun 2023 03:08:43 -0700 (PDT) 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=@nxp.com header.s=selector2 header.b=qY0tZR4I; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235085AbjFBJwH (ORCPT + 99 others); Fri, 2 Jun 2023 05:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235023AbjFBJwD (ORCPT ); Fri, 2 Jun 2023 05:52:03 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2078.outbound.protection.outlook.com [40.107.7.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4835133; Fri, 2 Jun 2023 02:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SfdXc5Dcd6lWAudyMxMaUQrWfdrzVvj9cv5YjVeGGyEb3DJuEb+N07ahRElU8VyV/5UB1Ck7kyLrcNi6HyUJa682HfpQtl/7nM+Ch+7MKzM9iefHvjzTmwVPB7RrRvT66M3vTNA81gVLWvzCjCYxj4bRwzV+pu1D1CPQEkP2VTjp4B/y0Zpa1IMLtHgreYxXX13lmYDoQono6OEwQladfU36lLSPTvbsvsnCFUd5VGUTxZID5yxFJRSlLeNdKwbH+OJsk59IWQqdLF+eGLNlSGjYvJCGwGsPUPdVwyKUJhxgekQ6fCD0OD7sjGSPSIdF28T3TgeklkRq1zz/CYQTTQ== 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=vkqLFC/kchqxIkF1WNrIpFC/bBUjjIRYS/T3h65wS3E=; b=bYOLyyIMl8Av1nYoQFRMFcXXIoxuTnynmIPuarGp5QCALaLwxnhPnfpEQGlwyjBNPGF3iDx/n1V57dB+PPSnYXrYq67BQAZfRBDeQdwJ6s7wGh5gYXZL1U24vi0IiUBi4SvtTHlv2SlterTMSLPQAXhFp12ytPSpKuP4oz+MLobEFmhSJ4pnPF6TT+Hio2B3Y9HDyShb6cprzUHfcSHqE0TgxVDTGoU4iuD5m55a7c4IPF0LfJb/YaRfSQ0NqYm+jaHXHiifrCtPkm68DPiJYdEOWRjc9hHxtnpxYpmv3k4Cyloyza234WnVO2d5CvDppFjZsuQi4HH3Z66y+U6lKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vkqLFC/kchqxIkF1WNrIpFC/bBUjjIRYS/T3h65wS3E=; b=qY0tZR4IWNnmgSS/YNjsJtSqkS8qYax5GnmZVVf0Je8b15VNHZf4lG32z1MzoNK1AAPqB+nA2wd/AOmCYPtsr1oqXjnFLjdXl4Vv2rdUl7TM1JWAq3uBEBQak+hFuGkxhgyLN2JaKVjpkwkJOFGcYvvnE/5SXyT8hf/dGZ+ULlk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM5PR04MB3139.eurprd04.prod.outlook.com (2603:10a6:206:8::20) by AS8PR04MB8165.eurprd04.prod.outlook.com (2603:10a6:20b:3fd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Fri, 2 Jun 2023 09:51:59 +0000 Received: from AM5PR04MB3139.eurprd04.prod.outlook.com ([fe80::682b:185:581f:7ea2]) by AM5PR04MB3139.eurprd04.prod.outlook.com ([fe80::682b:185:581f:7ea2%4]) with mapi id 15.20.6433.018; Fri, 2 Jun 2023 09:51:59 +0000 From: wei.fang@nxp.com To: claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.or, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH net 1/2] net: enetc: correct the statistics of rx bytes Date: Fri, 2 Jun 2023 17:46:58 +0800 Message-Id: <20230602094659.965523-2-wei.fang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230602094659.965523-1-wei.fang@nxp.com> References: <20230602094659.965523-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0043.apcprd02.prod.outlook.com (2603:1096:4:1f6::19) To AM5PR04MB3139.eurprd04.prod.outlook.com (2603:10a6:206:8::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM5PR04MB3139:EE_|AS8PR04MB8165:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bd598d5-000d-41f6-0b3c-08db634f01d5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ywrleg1xFWKRNmP24Yq0sCaFUWJjhflLmUcSzY9YVC478eKGoHIHWaUuThhUZnnHB4cISmfhszgdbRr3N+G0jwm0WPKkTJ4GslZpzaAHPsqTWGZBMYKv23Hph/8YLNBQ7nXecPpEz3o/akHl0AIiatwSbFaloWs88cYvQfcnuocxMOJs4mAZVpQqoBdVC4M5gqCSe9nuaLhqfwrcHU5vNvlu6RBObwsJV4Z4XJrR1jN4ONRijVtnAjFwsPYr8hu+zD6PgaxJL7/Fsc0Y5wTKFancIItSqb2nSkemSCAAScSgpmynxQF9yTjwywGt6TGh9y8gbB/F3m8rWQ17zjAcAfTKHeBDz2+47LNZpRRP750pN5KdqvVphoDBTJPX9o/jdZAbaS5D/1L714QBRm169w0zOSAccZO/pLWkJAvoYC2ftPOzheoSkF111M+d2nlVga+To4KMRvuBcE+aRw2P/CZYdbJTI/DDxt2lO86WmRuzk88FGuMKLkJ6j5E5KzFREJu5u2OfCaXkqB3z+JYgVArYH8sy/7bDNLhyoh2rldP+I3Rib/qJh9kBsSPRUmH4kFslik0JF2HDoO079I5LFrue7i7NZfRjsnrpl74tK7LRFBbqpaxbT3AuL7orkaQCpX3t8a5Ch/77TnRjXNSNPA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM5PR04MB3139.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(376002)(346002)(136003)(366004)(451199021)(9686003)(1076003)(6512007)(26005)(6506007)(83380400001)(186003)(38100700002)(38350700002)(41300700001)(6486002)(52116002)(2616005)(4326008)(478600001)(66946007)(66476007)(921005)(66556008)(316002)(5660300002)(7416002)(8936002)(8676002)(86362001)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sopJXL7ssz+2+jrfUlqKVBerFqzAI6Rfty8z9HSkFPvgsV6FRbA9SVAd6BYffVJDPTqlyF6wwJtCWavleD6kvH1E0TVHZvmtHOLt5hZWFkllRJzVXjhAxxfkVMbIgZIN9xvpLnN4CXfavrQgPtSWXBdOVDf1Nb72ru7cFVvimghcuec/MKMkArnlIAcurZmdgvW4ru6mTC02sg07CwzUs+87Iwb1lPVe9fA0MYGC5MBfCqn46MmD6LLjWkuqTWCqSBwghVaSQSXE/YkXVOTp1YD06/W6unr1n7wEyQVODapZbKF1W0/TIWpn67MKl9i9mq8uQJPbHrT4TfEbH+isOGkhuNjosEt6qInLX42chJfkeTixxVAr4+xQx3/raf0FPm3YLu/d8NB7784J4AKO5gKkSFvbICWpcnfnv/7/HkRBGxdx/SLimJKolrPWqaB3Zwpmnr2ICtN46fUxb8QgighrHbWNF5j2GoFZCP7RhLgh27TacmAoVLlu5l/mpZB4OtUjyvxtDdUlBP3sNp+XftEOyJ4P4ZOi7LYtMn5wgygru9Z9eEmRFpqsD3c38nSsIunGntFPc+UDsqccJaiFs5Tb3GaFf0rlrFYS4ejM2u3nH7hoFCKuGiqngm2h7qZyYRs5Kpxm62BAM3MDCGkv75EiFfrHcgTeFXCEVhU91D09TwMRmwXllLYIn/fZzHU18Kli/olNjQO1LQ/4Oh485WCtds/Di1hjTc7RDpk/nGIkbXd1Vq9K7ggabxBPM9oh1wSIqLriqTRetcILm8RFG4PdHHmleTYDLqKrnDm3bYYbwDX9/rXxZYhKxv3hk7NMZuXYYm0qnSjldV7bJBZrs9vMR+FxCHe81SmgG70Ul/ip4QAAGqhkAm/9R0W0xJAodXC99vWEHPvy3s5+V8HKObVJseouGGeL4AuPTqhtJHp04o2WolTxJu5d6mg8FClZLiO5K4Rg30f8mG+fvfXAkCEOHjgLZyDyaRtRByeQLfRSQOLNc/n23RppSUBGhEBsXURz/77caDdY0i9h0hhu33F7rkbNNCfN2dmj/JyqZTDliTDDZqnoy61pb1KnQSy/dJOsDk/Kj0VydKb/Gh5vUj1/AJ7FJinJn22Tcj1fra9fSD7kEsKg1fTCs1q+Y2d+/ZKkZ6EmZLAfSEN1O54KB768IOPPckq5JN/5ozuNsQyVF9rLInNVbA0dRCO0rheqBaPh7dePZG+bIBwU3ZeIimRwM4nKYrCKU7J+EU9iBw7tfbUc8xVzDK+RR9eOltj5UBAyvcjmX2KVQwIQU4mjpq987ljIVfdtah+62lt+zWelFCVCeI2MUVAfVbUg/OT4xv34fU6OB6IE6UX3JF2Y/oJYNu5eHR+Jwq0poQDxmW4u6p9XqsXrpYKb11DxY/IyAIHc1rwpvyIdEq6tEtPzmsgtul+hEHgivD2Mb0m2snfCYou16LaL1T/TpR9gdc4P7kfUcI/PJJsZYkUQ17k5+ahsH20KwaQYTzplDME5r127jX3JT2/YfXwqqC3eIfAQ40E32+8AeEJ0vGcASt0iH44wUagfmhtWQ3wOS293syJuifPue+oaRwnOGzkv6+HW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6bd598d5-000d-41f6-0b3c-08db634f01d5 X-MS-Exchange-CrossTenant-AuthSource: AM5PR04MB3139.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 09:51:58.9090 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W8IXeHS6yGVFg8+zeB+AZlMTTnAIbNBNvfwfDHeqElF1KdSr3Z+Uo3SPwKEOb6fe4+xkqFB9lTDnAUeo2E76fA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8165 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767584319133041708?= X-GMAIL-MSGID: =?utf-8?q?1767585112056153357?= From: Wei Fang The rx_bytes of struct net_device_stats should count the length of ethernet frames excluding the FCS. However, there are two problems with the rx_bytes statistics of the current enetc driver. one is that the length of VLAN header is not counted if the VLAN extraction feature is enabled. The other is that the length of L2 header is not counted, because eth_type_trans() is invoked before updating rx_bytes which will subtract the length of L2 header from skb->len. BTW, the rx_bytes statistics of XDP path also have similar problem, I will fix it in another patch. Fixes: a800abd3ecb9 ("net: enetc: move skb creation into enetc_build_skb") Signed-off-by: Wei Fang Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 3c4fa26f0f9b..d6c0f3f46c2a 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -1229,7 +1229,13 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, if (!skb) break; - rx_byte_cnt += skb->len; + /* When set, the outer VLAN header is extracted and reported + * in the receive buffer descriptor. So rx_byte_cnt should + * add the length of the extracted VLAN header. + */ + if (bd_status & ENETC_RXBD_FLAG_VLAN) + rx_byte_cnt += VLAN_HLEN; + rx_byte_cnt += skb->len + ETH_HLEN; rx_frm_cnt++; napi_gro_receive(napi, skb); From patchwork Fri Jun 2 09:46:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 102434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp921786vqr; Fri, 2 Jun 2023 03:21:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4NqRTxIrTgK3JFfHPXr14/uCH9R+EFEe/JYoW6XSh/0/VB8NjvJ7qdb+TnrVMrBHe+G0ii X-Received: by 2002:a05:6358:6f8e:b0:123:1a41:3d8 with SMTP id s14-20020a0563586f8e00b001231a4103d8mr8349618rwn.29.1685701316328; Fri, 02 Jun 2023 03:21:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685701316; cv=pass; d=google.com; s=arc-20160816; b=T4L+ajMdqRq2b0kIMPZ+sr61x6jkRAmm73SlwPbKAe7dTS2ZEfX85qOgAIvxVJdp/e OAq2uNzxEHzVsebcaGITjTI8PoZaccSegPSif6SvFKtUnJMzgLpMEpUElauuaVNW6Wrh 54lEsl9e3ZIT1V1XHDO+JNezvbHI5NU6wdwtcpH2WWXWG8n9nnrXPGmtL2svli1vlscM j9vplGQN55/RVPRPpirNlOM2qv4Tpt+mFzGKggYfzx5B88gpVqGho+W1JeSbYfip8wLU Zi04NhJWIBOBYPYnusihSsg4R4QiiQTGa5xt1L+rMCiXXnCZEqfoaBPKWE2SSAo6GKFM sWAQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8rtw7onmBotbH9Y9CCEXhcB9EEdeyAerPAAusH5Rcjs=; b=0uUg2karLQJeaVb+SxA7s7hSRYHxG8ZK/wYcbIlG0IICXpTlKAugdjA7Cn0lQjrXun HbSSxq+c6MSV3G5G3IF6fSQHQ1EICIbqCtja8EH++5+G5x008R1CY3uNeSKOWs0vi1r2 1CJj6CAaVINP4OF8F/Vl3mXHta5G2xgp5VbFTytW+LuHkEh6mTwI0TDUJ2D2hzflRrSW U/bmhSJiXI6rW8eVvhrN/X91KFrxaTgWkByu1p95F5nuyII+SWEVINmQDIc53jTseIle ykAXrg6fs7fGXhVYklXNaWz7fboADI4SJSvbZnGVESgJ+by7oI7UbRM215wVYqqDwnWH Gaig== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=gX6W1XJH; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gm11-20020a17090b100b00b00252873f1500si2551924pjb.138.2023.06.02.03.21.34; Fri, 02 Jun 2023 03:21:56 -0700 (PDT) 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=@nxp.com header.s=selector2 header.b=gX6W1XJH; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234706AbjFBJwR (ORCPT + 99 others); Fri, 2 Jun 2023 05:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235023AbjFBJwL (ORCPT ); Fri, 2 Jun 2023 05:52:11 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2057.outbound.protection.outlook.com [40.107.7.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1642196; Fri, 2 Jun 2023 02:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J2mc2ZeaGD3bFIK0FfpoujwUZ7By1DbRLqNic9x5JNB5+hY0cL4pt6LK/gPfBQtMI4YyJRyT9FDw0E+jSudI5TdIbDHHm6uQRGDKWOTz9+KuysVD1dDj6PZi8AWL/fT/bPmn+QniaywfwMn2F+pM7tOEDnDgVmwQE2sxoTXS0rf7VJ/MFi7fE65Q1i8Rh0yBIaWrwB5rxyO7/ZBGexyZ/7QD+3suERyJisurownoXs0kWmOlmK33ysfRwLZA4zUUkuuSLLxfiFH8yHQ/0MlnNlgF4FDTff6SCRLdoehnti6XgGb9s08ETG/yBoEJI373t2ihUJjzmw526o0Of9EcSg== 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=8rtw7onmBotbH9Y9CCEXhcB9EEdeyAerPAAusH5Rcjs=; b=MMcUPeRHppBAaVXZSqtCUUqk64gD1+3IGh7USvQjnZNhVgyin+/3l/tFhxCBbrSuPMjkyD53/auUfTN6vqOujJ4TrvfI7mrR1lZPFA8vrl6/Uu1PB1HLaIDnnK66e99ULXuT4GyIIoWBk3qZh3oj2rV54HSELqsYuKf9Uo6icCzNxwZ+D/3Tj6WGKm6+EEyCTuuVOu65Q2uWR1Hyx7Qdzz+XEu0q8fehn7eikrRShDQBWffGte4qL4LxjVyUJ2ZtY/C0st6R6/jQ1YWoBVy64hQw8AdyzqZd1rHhJzFeEwIEjEIazaPwgW4t6QJUK5hptBQUPyVgK0BoifHDj2yP0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8rtw7onmBotbH9Y9CCEXhcB9EEdeyAerPAAusH5Rcjs=; b=gX6W1XJHHUgqiyurf02qyAKheAbHvEbJnVStmfupYd+S/NJtv5J7TpgxSwaNBsL40dhUh31nz0yXoYNw1iR8BOU34q9aTZa8sUkf6C0N8e6tLYjnb/iYh+8tmuj1GQHBac5W+ek6qX7cK6UVLBJVOyhMksXPi3bwc7RdJwIn0p8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM5PR04MB3139.eurprd04.prod.outlook.com (2603:10a6:206:8::20) by AS8PR04MB8165.eurprd04.prod.outlook.com (2603:10a6:20b:3fd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Fri, 2 Jun 2023 09:52:04 +0000 Received: from AM5PR04MB3139.eurprd04.prod.outlook.com ([fe80::682b:185:581f:7ea2]) by AM5PR04MB3139.eurprd04.prod.outlook.com ([fe80::682b:185:581f:7ea2%4]) with mapi id 15.20.6433.018; Fri, 2 Jun 2023 09:52:04 +0000 From: wei.fang@nxp.com To: claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.or, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH net 2/2] net: enetc: correct rx_bytes statistics of XDP Date: Fri, 2 Jun 2023 17:46:59 +0800 Message-Id: <20230602094659.965523-3-wei.fang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230602094659.965523-1-wei.fang@nxp.com> References: <20230602094659.965523-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0043.apcprd02.prod.outlook.com (2603:1096:4:1f6::19) To AM5PR04MB3139.eurprd04.prod.outlook.com (2603:10a6:206:8::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM5PR04MB3139:EE_|AS8PR04MB8165:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ef0d031-b9f8-4226-0d87-08db634f0534 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TO148P3Ea7iMordwhRomgjWl4WNC2wy8JTdrVGKMO1Gf0Npi2tGJZxWWRWDqsXWlbZMEB0XlL2JTsPrbNMbfQ3UA8GfT7iLhF8XB5P2byHIXvC5Hpfn9py01UyqHq/QaPnU1PWo/QRLdcqD19ImANYbyJqLl5K7Qh/IRlNdL7j8ik9ilTRIQ762/aC3MNjO1AoBhImfjfw5KR8om3Bhf06RIBMEVCB1w/JSt6vT6XLFQo9DjLNrElUJuEIFRgQ6VG7/uGUIhY5PwX5elieQ0hwagqeQP8rHda8Jn9vk2b+xhUjm00ve+R6gXXyCzi4g4rvp9CeCqSswYaDO9gvz9J1tsz+e9VBuS0mWd/GEXfp55r8U7G1NUTRcHt/86B8rsZfaNhygU7br1ppHpni88WFE6y/cg5y0w3QDyea3vvGmlA8IsB+ljsgsT6zXxHljQZENc5/gyXi3IlzEmpWGDEHYCzHKcEBIIkDAtTJcPmlXjY1WrNs6gacupZn4a9UdmC60iys3gWdiwDZRZ0/qxwEEPt9Oo+WLtZJ6hwz6YgUAx13fy5XJsCGRGuZUPVf2o2tlLOi0PVgDp9ijzTtjd7xVbOlpgYGA9uwefY6B4o2efAYYw8MhkDarSNel6xGqpaCCX5xAcUgKmAUFO3yV3ow== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM5PR04MB3139.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(376002)(346002)(136003)(366004)(451199021)(9686003)(1076003)(6512007)(26005)(6506007)(83380400001)(186003)(38100700002)(38350700002)(41300700001)(6486002)(6666004)(52116002)(2616005)(4326008)(478600001)(66946007)(66476007)(921005)(66556008)(316002)(5660300002)(7416002)(8936002)(8676002)(86362001)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yep+gz874TjzyZhPFFPvBHHSDy1QCWz/6wOyMyezu80AT3T7Wld/94WWqA5SxrltTy0Dq4Sjy5fSqLhTkvhtSNNz5hwQp4tPTDTq8Cmkjs5kkEkW046ZnNLdNWYTB4afXuZQcU4uXOPMhTG8XGUZNvKlPX34xL1JYG134BzIBQ6Zz3uUpdQuMbpzgexLKBFgVisbwIxW7FdAjSQcnd1YCkHlvPTBc3zrMZjTSawo/ytqBJzaNXeemW2sbHpt4kvJD51x+gt75VadQO/QAoPomax6DMZoV0ZhJv0Av0lQhVxlm0opAXVrEg2YM9DSsE0gXavRVmBbZXbeyFpCUN7p9UlplYEs6EAydq4mGuKCQrMZ0+NWRj3J3t0an5gFIjqFfQbhre86PCwVke+1FuKimMickaGWXAmDklj58WivZhVjOTMF65wLj4RTeTfDNwp8q0vXHNrceRkSEWJOhSW6bryIqG29Jr4c5eWGRRf4nEgqINs9LIzUM24D+VIg+gdQnaDPfT9++5zZPT1URI6sTN0OTvl8RTKWC9OE++bwnjMctZfx5S/sxgdGqm7FFmTaNP5GDt6MpKohOo9a0w4f8DEm/6gfXRHJWSOwL5I5aKGAjrRXsgJBQolPw/OpOsf9z5mvOS2kqZjmzid0uMMrBDQqm13NMlMR0LlmuPJVQr6udn3Id8g1Pl/mlsM2JNq06hyZfjgJtgkepWAY9RJNYvqUnXz//TJHtxFqcGD9AmsYKO/crHQSDhYGfc0PrhfZ2dejgga6sRqqIY3NTCNsqdHZkv+GCZFhLnI5auRlFTlY2w5gMsEnUsKKYf2e3sytxeiKIjvX4sps1wWkD3e7IQtFafvxR6gM/4yY/jaheuiogJeMEcS7wfXjBYQ43oEtnHVb9YWMQLgtzOKBgjnKcl4JrWUOh04/IF2JMB1KybehGppAiGRXIk0Xh96uRHChaOjRERMKkG7SDm3bvUakckDqcdqPSog/yIOQ5o/PAGSwS+B3V1UQdYQNcIG8/gGR/j+U3YIO0ZdKw4DrK+bmPBRAhiZqoCkey9hxsPw7pNY36qLhhJmNsZYM3obH4xiMfWgIQx9E6HkM8bpxMvdddbsmL15ePoaex01Io/hz9F6TKuNVnGe1s4AkAGGtYibinGGx6BdGL6hDa436xf3bYAif5jNgo0RCQJymfRdOxL+bKF1cMoS7AlIgbz0r5LO1EYHLvS9dVTkaazaIDBhKcRFca8y9vflciJ6J5oXMn2MJJxA7ScxJX7rE5m8r0PovgZCLkir4uyCXfkc6+Cy0TrJOzmh7UDvtV5UjFn1SFTgiaBbz6dz4DXmgpaMRvIpkCGSNIJ0HZ80KKE4nTx4Sr5mkBlIw+fufVehBbgCvuCxgY30KnZeiIGL6u+o7Y996cGgVrl/zc1DESBP1AbNg+oiJZdfQduKsZfg3CKR3KEqcVbQU5Snv+6iLZoSr1T7WhLwd2bj+xMKv7W2sgdV1/hbCDm9qAFmqcU5kcvsH7q4RYoH45oUKSl9XdnoiVQa+t+LvrlpZeqtjdW+HbnjKEIXIoNJTjJ0kKgslnD+CJqrJnOg91GrWWgW+G62/Vbk2 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ef0d031-b9f8-4226-0d87-08db634f0534 X-MS-Exchange-CrossTenant-AuthSource: AM5PR04MB3139.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 09:52:04.7351 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: G7hX6d9m8eIkgnzA3qF/+gTwP7Sf8Sgaun8JB0LR7/bY4RyhQldCGkoL8R39XM6kUo2n22jGWUQWlAybP7TIVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8165 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767585943246849267?= X-GMAIL-MSGID: =?utf-8?q?1767585943246849267?= From: Wei Fang The rx_bytes statistics of XDP are always zero, because rx_byte_cnt is not updated after it is initialized to 0. So fix it. Fixes: d1b15102dd16 ("net: enetc: add support for XDP_DROP and XDP_PASS") Signed-off-by: Wei Fang Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index d6c0f3f46c2a..9e1b2536e9a9 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -1571,6 +1571,14 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, enetc_build_xdp_buff(rx_ring, bd_status, &rxbd, &i, &cleaned_cnt, &xdp_buff); + /* When set, the outer VLAN header is extracted and reported + * in the receive buffer descriptor. So rx_byte_cnt should + * add the length of the extracted VLAN header. + */ + if (bd_status & ENETC_RXBD_FLAG_VLAN) + rx_byte_cnt += VLAN_HLEN; + rx_byte_cnt += xdp_get_buff_len(&xdp_buff); + xdp_act = bpf_prog_run_xdp(prog, &xdp_buff); switch (xdp_act) {