From patchwork Wed Jan 31 17:05:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2030711dyb; Wed, 31 Jan 2024 09:08:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpA5XNAm9/8Z+p5ItSPkpuvnDSZuxe30AEbqm1wq+9q24ZUgp/Oeq9OsJd0lXxvjHbi+0R X-Received: by 2002:a05:6214:1c0d:b0:686:ad1a:ecb7 with SMTP id u13-20020a0562141c0d00b00686ad1aecb7mr2914522qvc.42.1706720915351; Wed, 31 Jan 2024 09:08:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706720915; cv=pass; d=google.com; s=arc-20160816; b=egx+De7Ywawgi5dyc29uGq0CcddN7zsC61g7T+eul7h1lUKC0H3uO60jxExScGf5VP Db9GnOvfUwQmNSbYgfV6VRqqhnea2Y1MyzrQf4KAW6ivcn73ZW3xA7BO2l3Npi39mT+Z Q/GM73qq7YRpW7BioGU/d2adr22PRXfRNFRt+CFG9HPYCfbAwfplGVDZLEFiOCNlWpt6 1UAOY/6cNlOZuI8s5Lkx1cv1up16Gb4NOfxRsUGMuFukkq8xUS5/yPB7g0iZ8IU5U3w+ 7T46oixpKtqWesO39vH7rRjdL89P1Gjkyt7uz6tyjsHKkNpn59UL1MDHoF45n2wwOk2V L2gA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=IkvhI6vtPfiPln4tUcqH80fwSanMFUL9bEC5Xw22hss=; fh=0YgRbyAws+XycBLlV0kAqAVxxVGMZC6xr8Y0JMYfbK0=; b=cYUR3IjOidNwD5Cq21m1YGeNMQiLf45LhzeOsctXOfsOky0Tu6XCUtkwPRX4rMjfqH HjYQtlZyGF+BtKd3zWmLmCQ0pggjFpRi7VmeaMwhrNCzgPhvPaYjyXGyE4wACT3Y25nM l+GW1H7DQQwueWO2mvFGbwqs79IOumhe/dT+l6gAazuhDEVKdRk710y1wkzIHLlIsWgm jDd56eTBYV+v2+t5MYgJ4ff+xZaMefW/le7z/fccR64sB2/zMBa/lkqDMGbUz8+Ez1z6 Zrkd7qpt0qB7qSC0APEgPUgyoLWN7KTX8lFyy8rT6qM3Ygv2lHhAxLAPLn4sq33t0bXq p1fQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCWAklA/WALTm5hF7/1QFPPKOVlmYz0jxTEa/bX+CsHycfM1R5b04VXkdQ0chUcy3FCePa3aU11Rz1KzPaDh6U6MLMS6EQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z19-20020a0cf013000000b0068c71536ed4si501924qvk.41.2024.01.31.09.08.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:08:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 77A0D1C260B1 for ; Wed, 31 Jan 2024 17:07:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0F7012F5A3; Wed, 31 Jan 2024 17:06:03 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D72112DD9A; Wed, 31 Jan 2024 17:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720762; cv=none; b=RGWi46HY2bdvT9Xlcwa81JwBuMTN5mr9dP8vUhm8+1X0ZTwV2GoN5F2iYrnQ/p+XagR5lTkygfWMKCJC13iWI/ffTs8nszesvich38nPrJYoscHC/jKNNuNisRdQnzI4CeZW1FHgcdfie/2eTdYDV37sHvnOUaCT0Z+/d3vN0e0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720762; c=relaxed/simple; bh=jP6QldFPdAD5uJhr8/CvILmn76QiLrkdjUHamTufTEg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=u44YTGBxqAosyROGTUnaPO8YXTuK4jRv/OCXiJ2oerhq8PMs19TNnpJf7NACUypBlHngEmIfzRejiMk5eWiUhbPPMGHfeRxN7yMHZDJL/0IinglrU8xAatUqCxzkFH2Ar5JrqfLwND7gitD6euAhN6/Lmzben62w1EsJ6T7NUuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="196315527" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Feb 2024 02:05:58 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 4A7EE40344F5; Thu, 1 Feb 2024 02:05:55 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/8] net: ravb: Count packets in GbEth RX (not descriptors) Date: Wed, 31 Jan 2024 17:05:17 +0000 Message-Id: <20240131170523.30048-4-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789626590515673349 X-GMAIL-MSGID: 1789626590515673349 The units of "work done" in the RX path should be packets instead of descriptors, as large packets can be spread over multiple descriptors. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 5a6a2a7a9e7a..077c189bcc6f 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -830,6 +830,7 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) struct ravb_rx_desc *desc; struct sk_buff *skb; dma_addr_t dma_addr; + int rx_packets = 0; u8 desc_status; u16 pkt_len; u8 die_dt; @@ -841,9 +842,8 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) limit = priv->dirty_rx[q] + priv->num_rx_ring[q] - priv->cur_rx[q]; stats = &priv->stats[q]; - limit = min(limit, budget); desc = &priv->gbeth_rx_ring[entry]; - for (i = 0; i < limit && desc->die_dt != DT_FEMPTY; i++) { + for (i = 0; i < limit && rx_packets < budget && desc->die_dt != DT_FEMPTY; i++) { /* Descriptor type must be checked before all other reads */ dma_rmb(); desc_status = desc->msc; @@ -876,7 +876,7 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) if (ndev->features & NETIF_F_RXCSUM) ravb_rx_csum_gbeth(skb); napi_gro_receive(&priv->napi[q], skb); - stats->rx_packets++; + rx_packets++; stats->rx_bytes += pkt_len; break; case DT_FSTART: @@ -906,7 +906,7 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) ravb_rx_csum_gbeth(skb); napi_gro_receive(&priv->napi[q], priv->rx_1st_skb); - stats->rx_packets++; + rx_packets++; stats->rx_bytes += pkt_len; break; } @@ -945,7 +945,8 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) desc->die_dt = DT_FEMPTY; } - return i; + stats->rx_packets += rx_packets; + return rx_packets; } /* Packet receive function for Ethernet AVB */