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,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 23829C433E0 for ; Tue, 9 Jun 2020 00:27:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD40A207ED for ; Tue, 9 Jun 2020 00:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591662426; bh=jMCYsx4tCSXPZDd8dlXYJXCbMKAEjtLKhfzWxAD9ljk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=01fEO8LTCZ2ZygjpmxNcdZpZ2WpOtG8Fhw4p3QIORsKb8ArlLpq3DyhLxbf8MbVXT Tf6eP9Hxh6D10ifQK8OAaG4DfstY5r33n+WiPWpqJ5VL/O4pvavbMz2MtWQBEZ0NTU ViuyG+YiJ6CV8Yy/v3MpWwq+sQAsY/IMEgzpOADc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732593AbgFIA1E (ORCPT ); Mon, 8 Jun 2020 20:27:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:38142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730324AbgFHXQn (ORCPT ); Mon, 8 Jun 2020 19:16:43 -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 D55B52083E; Mon, 8 Jun 2020 23:16:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591658203; bh=jMCYsx4tCSXPZDd8dlXYJXCbMKAEjtLKhfzWxAD9ljk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1kyNrzKQimZnIV1xnXfdoQC9BpBJtF0IBK2trW2hr3NJFRokkicA4m29rvNxSU8FP UZnlyv5ayIvrN6qNYmyCiuUP/RexqTwe+5h9jo9R8zpVjpzdWkhkYbbSYmim/v2RXh 4iBVpPKPnPtIuNWYmlkS+SgvpvZX7TLf43B3obUI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Roman Mashak , Jamal Hadi Salim , "David S . Miller" , Greg Kroah-Hartman , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.6 222/606] net sched: fix reporting the first-time use timestamp Date: Mon, 8 Jun 2020 19:05:47 -0400 Message-Id: <20200608231211.3363633-222-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608231211.3363633-1-sashal@kernel.org> References: <20200608231211.3363633-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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: Greg Kroah-Hartman --- 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