From patchwork Mon Oct 5 20:35:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 268077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE648C4363A for ; Mon, 5 Oct 2020 20:35:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B915D21548 for ; Mon, 5 Oct 2020 20:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729207AbgJEUfl (ORCPT ); Mon, 5 Oct 2020 16:35:41 -0400 Received: from mailrelay115.isp.belgacom.be ([195.238.20.142]:49414 "EHLO mailrelay115.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbgJEUfk (ORCPT ); Mon, 5 Oct 2020 16:35:40 -0400 IronPort-SDR: iV/6qVTijZF9FGv5C+vBkRl/DzMIj/Mob6Aa5MbG27kimPkBv35oaW9GiP/jpLlTcc/1qi1TDC MlwviKtVJLhC/0Oy43UtaKnv0Ig0s8c2r+7q0mCISBpGhoqPx9OgwuYMjL3WJpKqtTrjgmrkux ahEZHkNpDk730fpIYq2GtO0ALAMsFjReLU3Omxm5KzTRMUNGS2thhWKaqZ52YJOF+3U2KQLaWc HmG1AKwinT65xxrnOLNenkyL/fE6feQGK4c+oiat+VEW9QuTlxtnm2LYLwUx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cq/eXjjXwnll8He6mmw58XZGq/HvR8LEWTeWDsjcsZEWcWogo+S/TniFucXj5Penm9Qbw86yolCIKpE4jDXJqhgL+f0yehGJ1ZeGRGBkqLEXfyeIWOQ+0MZz6KIs99jjwEUqCsS4E72h61ug/30KFnLunU+y0eq53jyMJ56PbNmkJ6yTshA82D3mSlQ2hqk2YMQDEqmqZyvQg1yUqJ2IB7juZeGNgV4OlGFk88OILQwvJSFd//QETCc82PRVLgRc+pUh8rSddk7dYEYk97U/u4gxzOxSuhAPdBmbWBCrQv8bPa0mS3LcsrmCWO77Uok1RzGpgHDmahnKMqrwU= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2C8CADggntf/xCltltgHAEBAQEBAQcBARIBAQQEAQFHgUgCgRyCUV+NP5JWilmFMYF8CwEBAQEBAQEBATUBAgQBAYRKgjsmOgQNAgMBAQEDAgUBAQYBAQEBAQEFBAGGD0WCNyKDRwsBIyOBPxKDJoJYKaoXM4QQgUSDR4FCgTiIMoUagUE/gRGDToo0BLdNgnGDE4RrklQPIqEfLZJnm2KGSgyBa00gGIMkUBkNnGhCMDcCBgoBAQMJVwE9AY0yAQE X-IPAS-Result: A2C8CADggntf/xCltltgHAEBAQEBAQcBARIBAQQEAQFHgUgCgRyCUV+NP5JWilmFMYF8CwEBAQEBAQEBATUBAgQBAYRKgjsmOgQNAgMBAQEDAgUBAQYBAQEBAQEFBAGGD0WCNyKDRwsBIyOBPxKDJoJYKaoXM4QQgUSDR4FCgTiIMoUagUE/gRGDToo0BLdNgnGDE4RrklQPIqEfLZJnm2KGSgyBa00gGIMkUBkNnGhCMDcCBgoBAQMJVwE9AY0yAQE Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 05 Oct 2020 22:35:38 +0200 From: Fabian Frederick To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: Fabian Frederick Subject: [PATCH 4/9 net-next] bareudp: use dev_sw_netstats_rx_add() Date: Mon, 5 Oct 2020 22:35:15 +0200 Message-Id: <20201005203515.55280-1-fabf@skynet.be> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org use new helper for netstats settings Signed-off-by: Fabian Frederick --- drivers/net/bareudp.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index 841910f1db655..ff0bea1554f9b 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -54,7 +54,6 @@ struct bareudp_dev { static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb) { struct metadata_dst *tun_dst = NULL; - struct pcpu_sw_netstats *stats; struct bareudp_dev *bareudp; unsigned short family; unsigned int len; @@ -160,13 +159,9 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb) len = skb->len; err = gro_cells_receive(&bareudp->gro_cells, skb); - if (likely(err == NET_RX_SUCCESS)) { - stats = this_cpu_ptr(bareudp->dev->tstats); - u64_stats_update_begin(&stats->syncp); - stats->rx_packets++; - stats->rx_bytes += len; - u64_stats_update_end(&stats->syncp); - } + if (likely(err == NET_RX_SUCCESS)) + dev_sw_netstats_rx_add(bareudp->dev, len); + return 0; drop: /* Consume bad packet */