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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 DBF66C433E0 for ; Thu, 28 May 2020 12:10:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1532215A4 for ; Thu, 28 May 2020 12:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590667854; bh=Z+uy5yhJX/VO1nMXG5zNBbhdtJXhOPuA8ZgWm1w1Ky8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Kpf+lpdPewtEY1Im5BhjCd34upn3nufZAWMGh233quSPZ9DMnlVHF2ILKs7zZVK14 mougUMHSPINeI2b/iaXcU1ztxHBRLbVREbfYKDCuTLJ/NKQRMeeeUHK4hhW1Bm+Z8j nubFKKlKr33XsvI2MNVLmJwwCPsuNiLmFy32MuC0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389648AbgE1MKx (ORCPT ); Thu, 28 May 2020 08:10:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:48292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388659AbgE1L4R (ORCPT ); Thu, 28 May 2020 07:56:17 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 37CE820757; Thu, 28 May 2020 11:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590666977; bh=Z+uy5yhJX/VO1nMXG5zNBbhdtJXhOPuA8ZgWm1w1Ky8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYQAU4NBVi7XfvyuTGSidl/JRntlxRUBF613BYeJdpoS2364A5E9qpFoQsp6ybDaB L+dIFOMS6GsMJdf4MIZXCsI7sf133Vwi+sdinvv1cTvpnuO0/r2OGqmWYk8z+X9vUP Dwcrp7x6LQZHP5uZXMAdQHs9eBZbqLHQ3EYAvtXU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Roman Mashak , Jamal Hadi Salim , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.6 14/47] net sched: fix reporting the first-time use timestamp Date: Thu, 28 May 2020 07:55:27 -0400 Message-Id: <20200528115600.1405808-14-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200528115600.1405808-1-sashal@kernel.org> References: <20200528115600.1405808-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roman Mashak [ Upstream commit b15e62631c5f19fea9895f7632dae9c1b27fe0cd ] When a new action is installed, firstuse field of 'tcf_t' is explicitly set to 0. Value of zero means "new action, not yet used"; as a packet hits the action, 'firstuse' is stamped with the current jiffies value. tcf_tm_dump() should return 0 for firstuse if action has not yet been hit. Fixes: 48d8ee1694dd ("net sched actions: aggregate dumping of actions timeinfo") Cc: Jamal Hadi Salim Signed-off-by: Roman Mashak Acked-by: Jamal Hadi Salim Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/net/act_api.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index 71347a90a9d1..050c0246dee8 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -69,7 +69,8 @@ static inline void tcf_tm_dump(struct tcf_t *dtm, const struct tcf_t *stm) { dtm->install = jiffies_to_clock_t(jiffies - stm->install); dtm->lastuse = jiffies_to_clock_t(jiffies - stm->lastuse); - dtm->firstuse = jiffies_to_clock_t(jiffies - stm->firstuse); + dtm->firstuse = stm->firstuse ? + jiffies_to_clock_t(jiffies - stm->firstuse) : 0; dtm->expires = jiffies_to_clock_t(stm->expires); } -- 2.25.1