From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.0 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,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 59612C282C4 for ; Wed, 13 Feb 2019 00:24:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 112D120842 for ; Wed, 13 Feb 2019 00:24:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="l4rgouBR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731701AbfBMAYC (ORCPT ); Tue, 12 Feb 2019 19:24:02 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:45668 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727343AbfBMAYC (ORCPT ); Tue, 12 Feb 2019 19:24:02 -0500 Received: by mail-ed1-f65.google.com with SMTP id d9so410962edh.12 for ; Tue, 12 Feb 2019 16:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=/R2lRI+fFsp39/SmmveFPuy55nPb5weENDCjabe/7wk=; b=l4rgouBROVqtmfIIGKYXXzpJm7Hyzn1TBXC6mbVaUjG6nqksu/EGkNfIC/YnFDo9FS /Zr6AXcI8iIP1SeZ4F+a7GTHGQE7npeiLPlMzgxmnpSuzGOizR41C6FaRuHTkujjTyKO YYxeKXfA3NwnsA4+Ij6/711jRYg5t6F7JfDlM5VKkNt5MDR1z8iIxhw2xzgW1hZMLllQ 4vYJ7E0LV7X7XEgfBaInmEHo8xZES0bQpuB5TF6SHdznmGKofhsdjsL4NZ/46ZgC/mU0 WNhAcrqtVZbSoWZNGpZfLQnzVcnjJoQ7rQTqelj7e6x/b3ELjJFfAKtYs8USA9hV9XG1 oVsw== 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; bh=/R2lRI+fFsp39/SmmveFPuy55nPb5weENDCjabe/7wk=; b=Q21jTTIY8DqqF0kna3k1eS9TfNJFKM/wHYQob1nRwpQQbU/WSkEg3OQ2PTrNgJgk8n 7aT7y633o1mc+VbY8LKCukjg+T/MuJDnPYLb9nBA2/MTEvCYojT8SCbs+8Co7o5C0lVx rExkM4dSIFFPxYn2v/6LzBU/CD2xoZT/yXY4nPTzcP10chod0CFeBp2qtPvTrFgFJTqF 5YdXOuuql88EEH5ETByRquR4/TFnFeX8V6JlB3IzotyVEHr1m0LaMWgvsOvc3DNFT2U5 TxSKD8oMw+IYDb6iApn5Zd35XBbVWeTdUWNquFRUKRd2B6elgK7txgq+BxDna4Y0MZWZ WXjQ== X-Gm-Message-State: AHQUAubwtX+TK8SHe0PURgDr/le2uTM4+9OQkJEU3y2jkjYoa4NVe4cu ngvZ8s0ZU5kMNc1QAyy1jjDV+Q== X-Google-Smtp-Source: AHgI3IbrS2Kd0hJSqQ8aMPcNj5MoUtk5H3Z+ZiOv+fXzXYafRym9JHD9u5FlAOpWy+kM82l5tq8kgA== X-Received: by 2002:a50:a94e:: with SMTP id m14mr5130650edc.133.1550017440657; Tue, 12 Feb 2019 16:24:00 -0800 (PST) Received: from jhurley-Precision-Tower-3420.netronome.com ([80.76.204.157]) by smtp.gmail.com with ESMTPSA id y63sm2638418eda.57.2019.02.12.16.23.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Feb 2019 16:23:59 -0800 (PST) From: John Hurley To: jiri@mellanox.com, davem@davemloft.net Cc: netdev@vger.kernel.org, pablo@netfilter.org, oss-drivers@netronome.com, John Hurley Subject: [PATCH net-next 1/1] flow_offload: fix block stats Date: Wed, 13 Feb 2019 00:23:52 +0000 Message-Id: <1550017432-26306-1-git-send-email-john.hurley@netronome.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org With the introduction of flow_stats_update(), drivers now update the stats fields of the passed tc_cls_flower_offload struct, rather than call tcf_exts_stats_update() directly to update the stats of offloaded TC flower rules. However, if multiple qdiscs are registered to a TC shared block and a flower rule is applied, then, when getting stats for the rule, multiple callbacks may be made. Take this into consideration by modifying flow_stats_update to gather the stats from all callbacks. Currently, the values in tc_cls_flower_offload only account for the last stats callback in the list. Fixes: 3b1903ef97c0 ("flow_offload: add statistics retrieval infrastructure and use it") Signed-off-by: John Hurley Reviewed-by: Jakub Kicinski --- include/net/flow_offload.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index a307ccb..d035183 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -195,9 +195,9 @@ struct flow_stats { static inline void flow_stats_update(struct flow_stats *flow_stats, u64 bytes, u64 pkts, u64 lastused) { - flow_stats->pkts = pkts; - flow_stats->bytes = bytes; - flow_stats->lastused = lastused; + flow_stats->pkts += pkts; + flow_stats->bytes += bytes; + flow_stats->lastused = max_t(u64, flow_stats->lastused, lastused); } #endif /* _NET_FLOW_OFFLOAD_H */ -- 2.7.4