From patchwork Tue Oct 11 09:35:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 1688516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=corigine.onmicrosoft.com header.i=@corigine.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-corigine-onmicrosoft-com header.b=s76Tvtyk; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MmrHt5yM8z23jS for ; Tue, 11 Oct 2022 20:35:54 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 454F560FEB; Tue, 11 Oct 2022 09:35:52 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 454F560FEB Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=corigine.onmicrosoft.com header.i=@corigine.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-corigine-onmicrosoft-com header.b=s76Tvtyk X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bvpZ-z397lMi; Tue, 11 Oct 2022 09:35:51 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3A8AD60F97; Tue, 11 Oct 2022 09:35:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3A8AD60F97 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 03C5AC0033; Tue, 11 Oct 2022 09:35:50 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id E831FC002D for ; Tue, 11 Oct 2022 09:35:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AF6EF40B63 for ; Tue, 11 Oct 2022 09:35:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org AF6EF40B63 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=corigine.onmicrosoft.com header.i=@corigine.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-corigine-onmicrosoft-com header.b=s76Tvtyk X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ww720lOzOOdF for ; Tue, 11 Oct 2022 09:35:47 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D660A40B5A Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2110.outbound.protection.outlook.com [40.107.244.110]) by smtp2.osuosl.org (Postfix) with ESMTPS id D660A40B5A for ; Tue, 11 Oct 2022 09:35:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oUbc87IBAh0MyJ6h9eM4Y6s/vuPOJ8vPieiZyjpnr9UKmHcroZVw3JUY+xJUysRJj+GkrbAi6gWSn8m/nmDos9yiXAjJPrXs3E7g8jDuz34AfoZo6ifmqUwSlSSaiBllgvHQS7HEriPm51jusJRMr8bLhoU6QLdhpr8K/nHcjZD5JHLmKhmXZ7IvwSluGujhhPFN2zyS8QI6xGmd3HesDnWzuODJ0OLWdi0tXBXgrho7KI2c9LrXgdSoxfpDXF3hRF22nk31xLjlTvNq9LZW4uFit94/BWifDaNwCZkkqDaGTlCmM3nOMBVOg2Sik3Bjr3i1TMsgnhkHgs0q3QQohg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jJGvLh8ZrvfSogSgNQuJD11zKXjhpoPTPwdN8v2qKcQ=; b=ioXYOcw+Ro4DINhsLXhWBqX4J/4yG4724TwAaJsHiaORgY4KimX6b0UDZH5dbXuwch7Ik9L1Rah/2RNk4h0wn/NiViKrt6lOHd5Zf4EpWDjSSVq+nTz51BD36NHAxMzJKCLISM4mAIY+GNomJMuWtnDe5OvFUpeW9Wu90+jIZ4FCzLouNVwT66cHh/W7K8N+WLMYfE5/MoSTRUlhbCbY2xF0qo7BfFlqNztPCYKlxub+/j+Gacf5rrVCbNiIAMizXiYrN6rHjsiNLtXaWF9NxmdxGCYK5y/obi17No8EtoKbhunjunDhDR/mu9u/UMxe57JL8fRM3DreD47SPhkMtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jJGvLh8ZrvfSogSgNQuJD11zKXjhpoPTPwdN8v2qKcQ=; b=s76TvtykxrRWyrhxG/iXXo4mm38zNLR0bXRe/BBl5TO1Ff5+AqLV/XmxZ8nTSfS4BFoSOf4VgGKG0vbZ738sVUhcGiw6yD1aXp3Ps2tBIWfT1VLQAiuA/VEnCiu0Xp9c11WtQbV6bVDJ7etXwB/XLkh0PLEHjXLbZK52W+ExWk0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by BY3PR13MB4977.namprd13.prod.outlook.com (2603:10b6:a03:357::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.18; Tue, 11 Oct 2022 09:35:45 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::b332:10af:929b:f19a]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::b332:10af:929b:f19a%5]) with mapi id 15.20.5723.018; Tue, 11 Oct 2022 09:35:45 +0000 From: Simon Horman To: dev@openvswitch.org Date: Tue, 11 Oct 2022 11:35:27 +0200 Message-Id: <20221011093527.367783-1-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 X-ClientProxiedBy: AS4P190CA0018.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d0::11) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|BY3PR13MB4977:EE_ X-MS-Office365-Filtering-Correlation-Id: 4209ba24-21ee-408f-5e38-08daab6bf8d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WYmG1vjBwl6iMSXkQNd7FHIbp7SQRts1QpgH0y9Ykvyez8UGiSPh052dNLTpmQDhpF7RpQuX71Pd6VhaTnHyfmm4po5U1ssUp3OdvB8MOmYDuWrXd5Xl6SlNB3FBVHWQaCmiNCYvEq7wLHb4m8C04Q0wb8liMImK3eVhXwqo/0NsKASVDplREEQwDFUonM5Qdy2a/eLEm4Ms3lOdTOBF8iQQm5g7AJo6LlgFVJ7UqqpcK41ZBgCpYb9XGD7QDrS5TQ5tsejOZm9O7J+HrDXquAF/AArRneWJEqfFkWVQAimDHuKEjTAnDt8fDknbVoWQ7+g2sfo4qZvDCL08oCPaBSHG3PwypX0o0rIeSXpQco98xYHJiRf0Pj5mVKG8s8ZSyYNfZl0SUKzpAg7bVvlxZP0ptOlN8NtTxIWcUiD1IId2s7XIKZEnbSIDjXmOO+1EC2QVIjzN51Kyfi9TyMCVHCXH+qe3xZqubw+IjjFd5SJcO58YOz+d2ftN+O8xqeqyviyimIKQMhzyVA1jqZNTihFic8OvzY6us3i7rXYBwDYVgexSCfUnv2ljkB61FQEhQ7dJN7sW6kvxIAAUCU/X8eIXGdLMo+85f4Lb7e2J/jJRN82q46npv4HDIkGA96V/K9iGUBML9IJpBp46fHypQO6T8+OvBcBnoQTm20PdfQ0zpry9cBMHsWPPWMTby1+UDaNbxFj3e6vH1VGz6NcbtMFZExtVbhfovCPfOAhf84DYZh7T2bSDh5HNr/Ris4p2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR13MB4842.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(376002)(39840400004)(366004)(136003)(451199015)(6512007)(316002)(86362001)(54906003)(478600001)(6486002)(6916009)(36756003)(38100700002)(52116002)(83380400001)(2616005)(186003)(1076003)(6666004)(107886003)(6506007)(5660300002)(4326008)(8676002)(44832011)(66556008)(8936002)(66476007)(66946007)(41300700001)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jWSse3GAkULm5HBVijfv0s+6TDt1zkodbraA8imjBDFo3lpSPx9FA+fkn7JClQI1sRgMiHiuE4jn3cEWXblNSmKl5XqJxz6UdVZ8ozrqgQne6Bc6MvzgTmN3OucqS5Y34RlIvUwx6oPSgnaHj9YmVSve5opzVSyVc4+LbCiwtGBjC7+k/yTi5B0BaDOs7JRgrTp6l3vjLiPlxWwp4hRQ0GU/t5ZL+F2Hbc92J0fFZ29RwNgQ0E518LSjiy6c14BOvwrvbYZZOvX8xrUJmdxweSD9yEjI7/yKImwI6t4NEDIjPh/vNWaRWFzLBAQ41lv5XrhLm53VfIW7z++riP/hFY7E0exwmFHPYkTDYiQlILU6C2Wr4NqFJUxOuRLjPnNYXRmxhfHx+Y7/9HNr8EMaKNHu6bWJZQcJdyKp8QTYiXr0sBkX11wy0ab2pLxMK+Q8/P457xZ84dkIsatiXnc8RqvuqqGhdn4DCygRV7aUT7GFWpeCLbaQHMO/B9OeKIyYLQslq+1jOZ97L4K55Z5yWhgQ7eqG/G2NcxaR3WeaB8l2Cj5u+S6rowhun2fW09kocT9u02IMPjT/PRglHO0udxGSqVS3CF6bZGiQfiZuu7s3cClpg0FJU93lXz/rXkvbd386tiPZMqkoDZN7wSDk1VXzNzVNG+asxCr6V58c9Vx49VLLreBYHPaD96qjjUkZGU/BsHj1LxTm3Or/K3bLVWDBLqb/szFfL97p55hw7Iv1fGkUVGtMw9DsmE1aAKZ1Q0senr0uxijYARfrZsq/SDSixzXsGgeUYBAkDLwDTaiIffKNdsqlTh4YatZ1BGrtG+VVBPFqHg/TflIrME+wIFVc/xaseS25Gj2cmzWhHoafVt7KoOfwggXpS5mnuJjR3mqexa5g2ufAUushlreVYTHn16haPYaBBSYC6YQ1Qqs1ThPvVVilGfyNNyUAMOfeVgyodkFw6nBgt8Wg5bHOvZXtZ+SPcvXAuuDup+nwLmVe3xlwxf3qmV4D5ufb6W3Qp2qYuftQksBS1VEZNq2q3gBJhrbbZHxuJUe5OFrfD1n7lRMAJLRqJg585nnPK50iU3r0c/Kby3elHqzsSjraXnZHt1G6SMNKPl02FPi6WrNGOYbrPNdqWgO4hA4QbVjcg1IdHVENlSM5KMgIj/HWsa7d75AVtttHDujMvPU5p0nwvy+rpH2AEkTqH/tOJa0wXAtmSXCK3ckp1+8bnLPcJO3uZGWlpILFlqOXecUXyOWAaIj2CtKJaFDOlVqetSV4wNHkLp2CLIrWf7xwMTOnnR5FjdFUEvTCfCsj4HPVhls5DdDYWG0Fj7VkN07RM0Mlbr45lmJVBLRKfrzK2Yu1QvvxogL+05DVZ/pE/pWbDk0jmgtW9S2Sb9pSDZCAZWHtSKHtSV0wfWavwW1xT9aojT/AwA2lqj2lFInxmsoshar4rRzSMiqqqE9xxhTipPveNu87z22ApNQ2DixSDyYnDeSXpV/q9xkxz1x7HlRyP21utlvtaEGWb+7iKVi9FQ3YNacKHtSQphbflTWcQPhyrfJ8KX02RIdxf4r5xt9zHtZ+j/vaBz4IYmfwLQPxG8JJXmaLXrCG6AtDHLM9PrJ6elCyS79nIg3dmSI0KPhi2Qflo9ZO6haOopdjJdbMmm4PzuM3fv0OSEhFsGTuJRnlAQ== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4209ba24-21ee-408f-5e38-08daab6bf8d6 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 09:35:45.2401 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /exzCw0r5J1AJYpytHiSprjCcq89LMtXScNjY7u8yZUwYGT9qLMcAPXacGkce66nsRTOToT7zYMjPG4A3Y2D53/rNqDUOhq9fDRrptKtEg0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR13MB4977 Cc: Simon Horman , oss-drivers@corigine.com, Baowen Zheng , Ilya Maximets Subject: [ovs-dev] [PATCH] netdev-linux: Allow meter to work in tc software datapath X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Baowen Zheng Add tc action flags when adding police action to offload meter table. There is a restriction that the flag of skip_sw/skip_hw should be same for filter rule and the independent created tc actions the rule uses. In this case, if we configure the tc-policy as skip_hw, filter rule will be created with skip_hw flag and the police action according to meter table will have no action flag, then flower rule will fail to add to tc kernel system. In this patch, we will add tc action flag when adding police action to offload a meter table, so it will allow meter table to work in tc software datapath. Signed-off-by: Baowen Zheng Signed-off-by: Simon Horman --- acinclude.m4 | 6 +++--- include/linux/pkt_cls.h | 11 +++++++---- lib/netdev-linux.c | 20 ++++++++++++++------ lib/tc.c | 21 +++++++++++++++++++++ lib/tc.h | 3 +++ 5 files changed, 48 insertions(+), 13 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index ad07989ac29c..aa9af55062f0 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -163,10 +163,10 @@ dnl Configure Linux tc compat. AC_DEFUN([OVS_CHECK_LINUX_TC], [ AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include ], [ - int x = TCA_POLICE_PKTRATE64; + int x = TCA_ACT_FLAGS_SKIP_HW; ])], - [AC_DEFINE([HAVE_TCA_POLICE_PKTRATE64], [1], - [Define to 1 if TCA_POLICE_PKTRATE64 is available.])]) + [AC_DEFINE([HAVE_TCA_ACT_FLAGS_SKIP_HW], [1], + [Define to 1 if TCA_ACT_FLAGS_SKIP_HW is available.])]) AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include ]) diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index ba82e690eba9..a8cd8db5bf88 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h @@ -1,7 +1,7 @@ #ifndef __LINUX_PKT_CLS_WRAPPER_H #define __LINUX_PKT_CLS_WRAPPER_H 1 -#if defined(__KERNEL__) || defined(HAVE_TCA_POLICE_PKTRATE64) +#if defined(__KERNEL__) || defined(HAVE_TCA_ACT_FLAGS_SKIP_HW) #include_next #else @@ -21,9 +21,12 @@ enum { __TCA_ACT_MAX }; -#define TCA_ACT_FLAGS_NO_PERCPU_STATS 1 /* Don't use percpu allocator for - * actions stats. - */ +/* See other TCA_ACT_FLAGS_ * flags in include/net/act_api.h. */ +#define TCA_ACT_FLAGS_NO_PERCPU_STATS (1 << 0) /* Don't use percpu allocator for + * actions stats. + */ +#define TCA_ACT_FLAGS_SKIP_HW (1 << 1) /* don't offload action to HW */ +#define TCA_ACT_FLAGS_SKIP_SW (1 << 2) /* don't use action in SW */ #define TCA_ACT_MAX __TCA_ACT_MAX #define TCA_OLD_COMPAT (TCA_ACT_MAX+1) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index cdc66246ced3..c6422aacefeb 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -2623,10 +2623,17 @@ tc_matchall_fill_police(uint32_t kbits_rate, uint32_t kbits_burst) static void nl_msg_act_police_start_nest(struct ofpbuf *request, uint32_t prio, - size_t *offset, size_t *act_offset) + size_t *offset, size_t *act_offset, + bool single_action) { *act_offset = nl_msg_start_nested(request, prio); nl_msg_put_string(request, TCA_ACT_KIND, "police"); + + /* If police action is added independ from filter, we need to + * add action flag according to tc-policy. */ + if (single_action) { + nl_msg_put_tc_action_flag(request); + } *offset = nl_msg_start_nested(request, TCA_ACT_OPTIONS); } @@ -2642,7 +2649,7 @@ nl_msg_act_police_end_nest(struct ofpbuf *request, size_t offset, static void nl_msg_put_act_police(struct ofpbuf *request, struct tc_police *police, uint64_t pkts_rate, uint64_t pkts_burst, - uint32_t notexceed_act) + uint32_t notexceed_act, bool single_action) { size_t offset, act_offset; uint32_t prio = 0; @@ -2651,7 +2658,8 @@ nl_msg_put_act_police(struct ofpbuf *request, struct tc_police *police, return; } - nl_msg_act_police_start_nest(request, ++prio, &offset, &act_offset); + nl_msg_act_police_start_nest(request, ++prio, &offset, &act_offset, + single_action); if (police->rate.rate) { tc_put_rtab(request, TCA_POLICE_RATE, &police->rate); } @@ -2698,7 +2706,7 @@ tc_add_matchall_policer(struct netdev *netdev, uint32_t kbits_rate, basic_offset = nl_msg_start_nested(&request, TCA_OPTIONS); action_offset = nl_msg_start_nested(&request, TCA_MATCHALL_ACT); nl_msg_put_act_police(&request, &pol_act, kpkts_rate * 1000, - kpkts_burst * 1000, TC_ACT_UNSPEC); + kpkts_burst * 1000, TC_ACT_UNSPEC, false); nl_msg_end_nested(&request, action_offset); nl_msg_end_nested(&request, basic_offset); @@ -5667,7 +5675,7 @@ tc_add_policer(struct netdev *netdev, uint32_t kbits_rate, police_offset = nl_msg_start_nested(&request, TCA_BASIC_ACT); tc_policer_init(&tc_police, kbits_rate, kbits_burst); nl_msg_put_act_police(&request, &tc_police, kpkts_rate * 1000ULL, - kpkts_burst * 1000ULL, TC_ACT_UNSPEC); + kpkts_burst * 1000ULL, TC_ACT_UNSPEC, false); nl_msg_end_nested(&request, police_offset); nl_msg_end_nested(&request, basic_offset); @@ -5702,7 +5710,7 @@ tc_add_policer_action(uint32_t index, uint32_t kbits_rate, offset = nl_msg_start_nested(&request, TCA_ACT_TAB); nl_msg_put_act_police(&request, &tc_police, pkts_rate, pkts_burst, - TC_ACT_PIPE); + TC_ACT_PIPE, true); nl_msg_end_nested(&request, offset); error = tc_transact(&request, NULL); diff --git a/lib/tc.c b/lib/tc.c index 94044cde6060..e46f5cc73c8e 100644 --- a/lib/tc.c +++ b/lib/tc.c @@ -3808,3 +3808,24 @@ tc_set_policy(const char *policy) VLOG_INFO("tc: Using policy '%s'", policy); } + +void +nl_msg_put_tc_action_flag(struct ofpbuf *request) +{ + int flag = 0; + + if (!request) { + return; + } + + if (tc_policy == TC_POLICY_SKIP_HW) { + flag = TCA_ACT_FLAGS_SKIP_HW; + } else if (tc_policy == TC_POLICY_SKIP_SW) { + flag = TCA_ACT_FLAGS_SKIP_SW; + } + + if (flag) { + struct nla_bitfield32 flags = { flag, flag }; + nl_msg_put_unspec(request, TCA_ACT_FLAGS, &flags, sizeof flags); + } +} diff --git a/lib/tc.h b/lib/tc.h index 2e64ad372592..8e3226e89bd4 100644 --- a/lib/tc.h +++ b/lib/tc.h @@ -399,4 +399,7 @@ int tc_parse_action_stats(struct nlattr *action, int tc_dump_tc_action_start(char *name, struct nl_dump *dump); int parse_netlink_to_tc_policer(struct ofpbuf *reply, uint32_t police_idx[]); +void +nl_msg_put_tc_action_flag(struct ofpbuf *request); + #endif /* tc.h */