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 DAC83C433DF for ; Thu, 28 May 2020 12:01:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA95021655 for ; Thu, 28 May 2020 12:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590667308; bh=XGQY4lkxh1sVy4fv5Bb37M5kyF4uv2WZElrUH33Elkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Te/EAERb2KhYMN/mf+/fA59quWzXqDYmQZpt5gKUrKGmvgr4xF4CphmuvyDO5qC6E rgnEynCX32gDK5YOUpRdpbKvTEznuBajVSn0eCnH+NY1+214ftXaAhlIUYQQGoZWm7 Fr62wNJr2RStg46t08FvbIGn0bzBVEenwAa2cKh0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389108AbgE1L5v (ORCPT ); Thu, 28 May 2020 07:57:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:49436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388916AbgE1L5D (ORCPT ); Thu, 28 May 2020 07:57:03 -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 31F13215A4; Thu, 28 May 2020 11:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590667022; bh=XGQY4lkxh1sVy4fv5Bb37M5kyF4uv2WZElrUH33Elkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=avLHH3Ufe47ouF3ge1A3jRv0bnRILfU9LZ3G6+jMR83AlE57I9ZGRW3+9kJLnhonv +6t8Z74qDUXv/EI2b572oeBVWvy/kU90ZvngyVjYzpzJHEcjXiWv9jBHIpu0ld4YmY tWKqusYfbMfR47ggZbWR/mGQES1/zrDd3wSFT3lg= 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.4 07/26] net sched: fix reporting the first-time use timestamp Date: Thu, 28 May 2020 07:56:35 -0400 Message-Id: <20200528115654.1406165-7-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200528115654.1406165-1-sashal@kernel.org> References: <20200528115654.1406165-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 b18c699681ca..59d05feecfb8 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