From patchwork Tue Mar 14 06:58:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13173768 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07C27C6FD1F for ; Tue, 14 Mar 2023 06:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230198AbjCNG64 (ORCPT ); Tue, 14 Mar 2023 02:58:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjCNG6w (ORCPT ); Tue, 14 Mar 2023 02:58:52 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4865765457 for ; Mon, 13 Mar 2023 23:58:51 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id k2so7695195pll.8 for ; Mon, 13 Mar 2023 23:58:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678777130; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rpsCt7dTcK8K9Djze8VmfX/PXwfwibnuykrlNvnzQ74=; b=JbtLbiz2AyJsuNP/DSaXyAsS2CuMx8e3uYlOe0YVjJJBrsqjF3eW/ro+t83U5jNjRJ wruFpB+lHQr5H4Ey6Q8djxzZPh2ZKtMSMj3S5HN1fi9N2Lzlco0P8Pa20+az8qRrALii im31PJAHDSQDYbPo//sgdv7+p7v/3oQPr9/VuZWVfsipZov2kDsRyHs9KP8wv1CXF44J 1ISb9PYbF5q0OYRriD6JROvc8bqqg7PlHpPf44qwn/CbQN9X4pLvRQESJd6+PWG8XGku aBx5wWk/lrpLfG3W5P0ps8rc01lcoR8KsObdPQ32MLIPsJVRjwx5MEM9i2Xuy/lEST5V X0ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678777130; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rpsCt7dTcK8K9Djze8VmfX/PXwfwibnuykrlNvnzQ74=; b=Xve1VdRUgoGxK9YGf8/8fARBLPGMzk/CKqppXd4fsGL9LpxC+LH0nTPmoOmtxqhq3T ABwV4BQII3/6n8cbcO62KJ3ZCrjc+E2SmPSeYM95ZI4HuQioJeM5fVQrYLB85MJB6PKN KB8mJbDhT8jKG5LWxddQ6SYMrCQyNVP0f3YebpWMpkHcRBoTMgilRgVA/cGDwyBOq4qV TtaToHVn4J1T5dVo/rADOG0qaNyZhGFHhcRcTyb8eFCJPMVLaJ5g2f8k2RS9jdQrAU2/ leOSA8qAl+T0y0btcdbnBPMUU1xdKVDROwmutr8dHx7YssGXcORilb8SPxKqRm8zWtWQ Rvhw== X-Gm-Message-State: AO0yUKUqL0mMxXiIvV6rpzhYrX4LQjABDIi5LEJiM+kqVVyFaUQ082+L wmpKZEQlajraRcb5ro/q9b76R1WWVAaemRXv X-Google-Smtp-Source: AK7set/SgFNZamQxPBMlEP+6z8TbCksnuQONeM09dnJbMk4TMA0dEkL8qCnJX4PhsiFP6as2yGBFxA== X-Received: by 2002:a05:6a20:8e09:b0:d4:7339:d120 with SMTP id y9-20020a056a208e0900b000d47339d120mr6609872pzj.54.1678777130405; Mon, 13 Mar 2023 23:58:50 -0700 (PDT) Received: from localhost.localdomain ([8.218.113.75]) by smtp.gmail.com with ESMTPSA id j20-20020a62b614000000b005dae7d1b61asm808291pff.154.2023.03.13.23.58.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 23:58:49 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Stephen Hemminger , Davide Caratti , Pedro Tammela , Marcelo Leitner , Phil Sutter , Hangbin Liu Subject: [PATCH net 2/2] net/sched: act_api: add specific EXT_WARN_MSG for tc action Date: Tue, 14 Mar 2023 14:58:02 +0800 Message-Id: <20230314065802.1532741-3-liuhangbin@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230314065802.1532741-1-liuhangbin@gmail.com> References: <20230314065802.1532741-1-liuhangbin@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In my previous commit 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") I didn't notice the tc action use different enum with filter. So we can't use TCA_EXT_WARN_MSG directly for tc action. Let's add a TCA_ACT_EXT_WARN_MSG for tc action specifically and put this param before going to the TCA_ACT_TAB nest. Fixes: 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") Signed-off-by: Hangbin Liu --- include/uapi/linux/rtnetlink.h | 1 + net/sched/act_api.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index 25a0af57dd5e..5ad3448a1fa7 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h @@ -789,6 +789,7 @@ enum { TCA_ROOT_FLAGS, TCA_ROOT_COUNT, TCA_ROOT_TIME_DELTA, /* in msecs */ + TCA_ACT_EXT_WARN_MSG, __TCA_ROOT_MAX, #define TCA_ROOT_MAX (__TCA_ROOT_MAX - 1) }; diff --git a/net/sched/act_api.c b/net/sched/act_api.c index fce522886099..f960cb534ca0 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -1589,6 +1589,10 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[], t->tca__pad1 = 0; t->tca__pad2 = 0; + if (extack && extack->_msg && + nla_put_string(skb, TCA_ACT_EXT_WARN_MSG, extack->_msg)) + goto out_nlmsg_trim; + nest = nla_nest_start_noflag(skb, TCA_ACT_TAB); if (!nest) goto out_nlmsg_trim; @@ -1598,10 +1602,6 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[], nla_nest_end(skb, nest); - if (extack && extack->_msg && - nla_put_string(skb, TCA_EXT_WARN_MSG, extack->_msg)) - goto out_nlmsg_trim; - nlh->nlmsg_len = skb_tail_pointer(skb) - b; return skb->len;