Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp262733pxb; Thu, 12 Nov 2020 03:15:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwgZeO3RtFr79AqMZYvci4QmGfSD1U2Cfi8fdwU0tAh83MX+10Ze4N+rByYxyt/ljbS8P2 X-Received: by 2002:aa7:cc0e:: with SMTP id q14mr4389934edt.326.1605179757029; Thu, 12 Nov 2020 03:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605179757; cv=none; d=google.com; s=arc-20160816; b=JGxcKQL0UfQgbIiShGUcQc6+fmqaDQTFSHHNG4JEUwXeKqXpqBfwQmSaY4BMLE6Cr6 qtd7Y50JGDytyWjbHxbEPMeR6xFh4L2y5b/uFPiX0SMovMwHG2MW6EzSYmRJrxQeGZ/n zoeyTgMcQ9OFYgZ7ubDgJUCqlqoeohdYY2bsdAuVxYkwTOsl+x1oXB+jJdA/KXFTwI1e EHzA0uUtkmlWHk1bGnSeuBR1IUuuOyVFD4w5MiLBLqF8h4kykZWxuRPr6qC9+QnjjqSf 5lE1ADtf191k+19FGdpT2soP3bzaVxXU8lSVDrJm8a9GpxX0RZdquGdK1CYQ8YcCg5xh xQgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=t1pdCeyp/Dvzku3Y54x16meEdju3+1zInH0bmOMDDL0=; b=OVohEE9WRZYgODiDDLGbl2zMUeBy/nl1ni/maiTzCWlHqXRZwzJc+WTOHawB1JIWbE OrXk1YZIkPegkPRd3J3EXVCahwdwprN+u3LDOIfcgf5FzcFnUapcOU81lZs+b2UIkpnd 2KVg9vxNZAenPYIFLTIQEsHKUAZb8NjIGzJhsZgyLHzEoZ+ygOoUcxdkpt6Dq3AOz8in x7kLHZ640wlKPriMuQnCK00ypxzACpdiMXxYUnPEIlx5T+3heb1T6FbpOSwoq0d3TN99 431JXxpA9Qke71+AuFtKZPST2jheAXmX0KutXbAF+UaImq3MNCy1IxFvAGRsjvCPfS5f kp1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XtJAfKg8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id os24si3460940ejb.272.2020.11.12.03.15.32; Thu, 12 Nov 2020 03:15:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XtJAfKg8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727964AbgKLLML (ORCPT + 99 others); Thu, 12 Nov 2020 06:12:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgKLLMJ (ORCPT ); Thu, 12 Nov 2020 06:12:09 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 908C0C0613D1; Thu, 12 Nov 2020 03:12:09 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id 33so5558941wrl.7; Thu, 12 Nov 2020 03:12:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=t1pdCeyp/Dvzku3Y54x16meEdju3+1zInH0bmOMDDL0=; b=XtJAfKg8cmV/weC4CRM0DfyVs6/MmiX/gtIGuFegWgMaPHAg/Sm2ZMgBs6NAlDSxG3 Dk2Wx50IcCLt+PF2mn3CfEaoKMHX+WrMB4oTfihQeXZejwZW9qAsbv/SBJe2dpDPT6vu rnUJcp9+MwooScc7SjIR7+pEWrY63qgM4dRjZcynqwGqHU1FfuEvC9WcsSD6hM2Snxa1 T8Z0HcpLo/mFl0rcT/Qu3j6W/v7Mmujy5ep7ckxehw+2AUHRo7PrA2k+e2h/U/flduSO f5EO9GD+f/EyvK3pfYJZer8yfpzliQKOp77D8ei241UcvngqiCcYdC20Qyp/wzlHobUz YCCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=t1pdCeyp/Dvzku3Y54x16meEdju3+1zInH0bmOMDDL0=; b=t9nBzLoPh1SdwWv6jFQ1IINbjCckmdpL9mK6QKAgpdS1ijVOPjakHUqINiJ5K3Gn+P IQrqXipBXwvpiABssTNpn6lpW36abUQM9/tEBUiAacrTtdrABkpnxO1CUiX77u43IepQ bejO7q5JkAo9LgaWVv1nMU3Q+yTPZQqWR3std6FZjwHnR/o7np/pB7zte0Wx2pKBvmdK nKOe7TR6zGVoo4zIPmKnzdPBTVYOyLKs1HNr5sd/8uuxlMrjd2AW5I3vEv/pFpdMIWQ2 tSPQL+QrTXkYK78fXL5YWPQAZkCM8Ru9n/ZXjbPuMjMgiWZ0kM2MOIf0uXRA4g3d7pZA E0zg== X-Gm-Message-State: AOAM532p/0wQFe6+xWMUO7p1OVDv2R+43bwg9qoo7WlwSMZenJNJwM8j k5QQ34aAshdPJRWFHFWDDIk= X-Received: by 2002:adf:ea03:: with SMTP id q3mr5462838wrm.141.1605179528311; Thu, 12 Nov 2020 03:12:08 -0800 (PST) Received: from ubux1.panoulu.local ([2a00:1d50:3:0:1cd1:d2e:7b13:dc30]) by smtp.gmail.com with ESMTPSA id g11sm6456484wrq.7.2020.11.12.03.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 03:12:07 -0800 (PST) From: Lev Stipakov X-Google-Original-From: Lev Stipakov To: Pravin B Shelar , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org Cc: Lev Stipakov Subject: [PATCH 2/3] net: openvswitch: use core API for updating TX stats Date: Thu, 12 Nov 2020 13:11:50 +0200 Message-Id: <20201112111150.34361-1-lev@openvpn.net> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add") has added function "dev_sw_netstats_tx_add()" to update net device per-cpu TX stats. Use this function instead of own code. While on it, replace "len" variable with "skb->len". Signed-off-by: Lev Stipakov --- net/openvswitch/vport-internal_dev.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c index 1e30d8df3ba5..116738d36e02 100644 --- a/net/openvswitch/vport-internal_dev.c +++ b/net/openvswitch/vport-internal_dev.c @@ -33,23 +33,17 @@ static struct internal_dev *internal_dev_priv(struct net_device *netdev) static netdev_tx_t internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) { - int len, err; + int err; - len = skb->len; rcu_read_lock(); err = ovs_vport_receive(internal_dev_priv(netdev)->vport, skb, NULL); rcu_read_unlock(); - if (likely(!err)) { - struct pcpu_sw_netstats *tstats = this_cpu_ptr(netdev->tstats); - - u64_stats_update_begin(&tstats->syncp); - tstats->tx_bytes += len; - tstats->tx_packets++; - u64_stats_update_end(&tstats->syncp); - } else { + if (likely(!err)) + dev_sw_netstats_tx_add(netdev, 1, skb->len); + else netdev->stats.tx_errors++; - } + return NETDEV_TX_OK; } -- 2.25.1