From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2BBB6A0584; Wed, 19 Oct 2022 15:13:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BFDA42BA5; Wed, 19 Oct 2022 15:13:08 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2074.outbound.protection.outlook.com [40.107.237.74]) by mails.dpdk.org (Postfix) with ESMTP id 777A2410D1 for ; Wed, 19 Oct 2022 15:13:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SQ7gJPnmU3JXgydi9fxb6jQCUzTDjTZUUSAUb7gVa5MpNxqjIsUDM9AeU370y4cFZeT2f6NMXkfIrOxK20Bv4MgiQewmv2Su5VCFJ2w8HqCnpTb4/QrpZT8uo8tujL5Rn9reEKfxrDp16Dq97T78Qm/uOWOSnqZwsGuyT1vSar6qx/wniBPjN91U54bq+LC8o4IwyaWWV8F/LHU6Q715q9GmMdoc5lS9xGFZZJcpRBPo+VUt8yapvbRuT+3mYMmHLPbZaKQlcbDl3EdhL1jHB94aafWckJXd3i1Oydb7cHdxUQAtSbxo9Tdq4AyBL/9uTTIW6cLvrCgAP5L+v8fQlw== 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=WrOOVdua0riNmSpgXhnlvku6mm8oGFh2OJal5KViGeA=; b=KmLUHCP5WVE+DLttS8sDgyrS9mu3VWbH35vRkb/jYyaWVIeopr6NVDI6ZkCshCz2Icbd9cEXIz1pfzCvQj7S6irYCuve1o3QbtJTWSR8QRm12GrslUPPmSR76l1sJ+YcB3otypDNwPrt4ZLOrzR8xGNzkcW1XNU0iqVkq+OSIxuVo/lgiw8wi+Sano9qqkv2Ccl55xQmHADbPOVF4dZ/AW00MfWMG2Lp6T+1AjQTO5a5q//wnx5Oi6udMm3PEw/rjd/DPM52ojtwtDoXujgAJu6g0XjlnJ4BDgcBOkIoNKK/DDUCWIdMDrZiAbq9Epdhj+zOL1OUDVcnC1dKRP5tcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WrOOVdua0riNmSpgXhnlvku6mm8oGFh2OJal5KViGeA=; b=Wop45o12HINgPCsQxuG2+am4JANCJstiXcjBvpNaZKcqn+fOHDTE3oK5mo+WhwcaVdacjQbdEhpvQwJvCZZDYLRGSJW/+/Fk8Jl0zd6jq5K1fIYn3rqJp/wdJWRz9v0dmh/1vqhxJvqFA1goiCrGNEG8IublMVxg4Wu39n4VsHaATEynByZGAvHaGEnxiy6WqATpYXvvLVhVDZ2AwXruYvJU4AS8PewdibyhbaVzUq8KVb9xC1LajOIKh1BXblWsXm/zEW2OQpYRvalFHTuhKxHvVwqt6CH6qHRC8Rz3bL5dre9vEGu87OC2Ew/qu/WAalYVL3rG+Sw32jn1/YGH6Q== Received: from DS7P222CA0007.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::24) by IA0PR12MB7554.namprd12.prod.outlook.com (2603:10b6:208:43e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Wed, 19 Oct 2022 13:13:04 +0000 Received: from DM6NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2e:cafe::b1) by DS7P222CA0007.outlook.office365.com (2603:10b6:8:2e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Wed, 19 Oct 2022 13:13:04 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=nvidia.com; Received-SPF: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT084.mail.protection.outlook.com (10.13.172.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Wed, 19 Oct 2022 13:13:04 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Wed, 19 Oct 2022 06:12:54 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 19 Oct 2022 06:12:54 -0700 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29 via Frontend Transport; Wed, 19 Oct 2022 06:12:53 -0700 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , "Ori Kam" Subject: [PATCH v2 3/3] ethdev: add structure for indirect AGE update Date: Wed, 19 Oct 2022 16:12:28 +0300 Message-ID: <20221019131228.2538941-4-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019131228.2538941-1-michaelba@nvidia.com> References: <20220921145409.511328-1-michaelba@nvidia.com> <20221019131228.2538941-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT084:EE_|IA0PR12MB7554:EE_ X-MS-Office365-Filtering-Correlation-Id: aa1872ee-cd43-4e1d-335c-08dab1d3a848 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /F53iDserNk6K3h5mwDbQc44FgvLwN/5HUFniNXl9c0d5majtDYj9zpaf7LaAISUBG3HgzlbJOavcJbVlThCEmDJTtXnLRd8UFffEFn0e1caW/iSMU0cSg8HDHe8kBEoft3+BwsuTEDZtN6HoDaiinK73zLxFpu2lT1PHvZNsPVcUP9FYHAMjFoy0oQyd7S75/zXUNLwPUSTELQndD1YlX9nS9jwo4lGpQal2tiKm4X1VIf0/Sr5K4JnJAmfoLk3VX7fh2AQdZfC0n3aadaKRG1OH01HT8OIx/fPy9EGUoxgFr040yvmxhp4p0kMrQTY+zMRRuqjmKueQ6eKqjNPYByDPlp3GruMIS8kYsVkamATR6OlLLj+w3ARCCRXuOVqQ6d2GpUTEhSj2HoL0Yq2yoPfcj/AR2qEy+doIJIR9dqOnYQJwQ6Zejrk52/OQV61b1Gix3VAGXEXxaI1HOa5fXZgp9DbZj9/K01+sdOQuzNW1e5mIIWsXaQhjms7aboceUFuEFG7VlrGGrJMEp8WNS7CVL0orxX/AQwQHL9+plxEZ7Z5Xm2VQ2KpLD0FZL4mSg42ztLQXKBdYKTU0cL2hXpl1OXmKW7SRLzpDHXqpaTmFGGhERATnAq46WPg+0UrHbMwv3xOxlCCsUv/LYfd6c3oYO4U1U4EMBztwOZdNEGUrI1c0mhek8aopr3rKfRJjAWTmC6zUbiQsXn/JJGB07vPgY1csjNnvSI5SWeDC6enSErob/gxH43Yn+bB7LbjgusjKAQbWIAFDzNgagcP7A== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(136003)(396003)(346002)(376002)(451199015)(46966006)(36840700001)(40470700004)(6666004)(2616005)(478600001)(6286002)(26005)(36860700001)(83380400001)(336012)(55016003)(7696005)(186003)(1076003)(47076005)(40460700003)(426003)(40480700001)(5660300002)(15650500001)(107886003)(54906003)(6916009)(82310400005)(316002)(4326008)(41300700001)(8936002)(70586007)(70206006)(8676002)(86362001)(36756003)(356005)(7636003)(2906002)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2022 13:13:04.4147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa1872ee-cd43-4e1d-335c-08dab1d3a848 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT084.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7554 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add a new structure for indirect AGE update. This new structure enables: 1. Update timeout value. 2. Stop AGE checking. 3. Start AGE checking. 4. restart AGE checking. Signed-off-by: Michael Baum Acked-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 66 ++++++++++++++++++++++++++++++ app/test-pmd/config.c | 18 +++++--- doc/guides/prog_guide/rte_flow.rst | 25 +++++++++-- lib/ethdev/rte_flow.h | 28 +++++++++++++ 4 files changed, 128 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 992aeb95b3..88108498e0 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -586,6 +586,9 @@ enum index { ACTION_SET_IPV6_DSCP_VALUE, ACTION_AGE, ACTION_AGE_TIMEOUT, + ACTION_AGE_UPDATE, + ACTION_AGE_UPDATE_TIMEOUT, + ACTION_AGE_UPDATE_TOUCH, ACTION_SAMPLE, ACTION_SAMPLE_RATIO, ACTION_SAMPLE_INDEX, @@ -1874,6 +1877,7 @@ static const enum index next_action[] = { ACTION_SET_IPV4_DSCP, ACTION_SET_IPV6_DSCP, ACTION_AGE, + ACTION_AGE_UPDATE, ACTION_SAMPLE, ACTION_INDIRECT, ACTION_MODIFY_FIELD, @@ -2110,6 +2114,14 @@ static const enum index action_age[] = { ZERO, }; +static const enum index action_age_update[] = { + ACTION_AGE_UPDATE, + ACTION_AGE_UPDATE_TIMEOUT, + ACTION_AGE_UPDATE_TOUCH, + ACTION_NEXT, + ZERO, +}; + static const enum index action_sample[] = { ACTION_SAMPLE, ACTION_SAMPLE_RATIO, @@ -2188,6 +2200,9 @@ static int parse_vc_spec(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); static int parse_vc_conf(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); +static int parse_vc_conf_timeout(struct context *, const struct token *, + const char *, unsigned int, void *, + unsigned int); static int parse_vc_item_ecpri_type(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -6206,6 +6221,30 @@ static const struct token token_list[] = { .next = NEXT(action_age, NEXT_ENTRY(COMMON_UNSIGNED)), .call = parse_vc_conf, }, + [ACTION_AGE_UPDATE] = { + .name = "age_update", + .help = "update aging parameter", + .next = NEXT(action_age_update), + .priv = PRIV_ACTION(AGE, + sizeof(struct rte_flow_update_age)), + .call = parse_vc, + }, + [ACTION_AGE_UPDATE_TIMEOUT] = { + .name = "timeout", + .help = "age timeout update value", + .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_update_age, + timeout, 24)), + .next = NEXT(action_age_update, NEXT_ENTRY(COMMON_UNSIGNED)), + .call = parse_vc_conf_timeout, + }, + [ACTION_AGE_UPDATE_TOUCH] = { + .name = "touch", + .help = "this flow is touched", + .next = NEXT(action_age_update, NEXT_ENTRY(COMMON_BOOLEAN)), + .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_update_age, + touch, 1)), + .call = parse_vc_conf, + }, [ACTION_SAMPLE] = { .name = "sample", .help = "set a sample action", @@ -7045,6 +7084,33 @@ parse_vc_conf(struct context *ctx, const struct token *token, return len; } +/** Parse action configuration field. */ +static int +parse_vc_conf_timeout(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size) +{ + struct buffer *out = buf; + struct rte_flow_update_age *update; + + (void)size; + if (ctx->curr != ACTION_AGE_UPDATE_TIMEOUT) + return -1; + /* Token name must match. */ + if (parse_default(ctx, token, str, len, NULL, 0) < 0) + return -1; + /* Nothing else to do if there is no buffer. */ + if (!out) + return len; + /* Point to selected object. */ + ctx->object = out->args.vc.data; + ctx->objmask = NULL; + /* Update the timeout is valid. */ + update = (struct rte_flow_update_age *)out->args.vc.data; + update->timeout_valid = 1; + return len; +} + /** Parse eCPRI common header type field. */ static int parse_vc_item_ecpri_type(struct context *ctx, const struct token *token, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 18f3543887..d036fff095 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1886,6 +1886,7 @@ port_action_handle_update(portid_t port_id, uint32_t id, if (!pia) return -EINVAL; switch (pia->type) { + case RTE_FLOW_ACTION_TYPE_AGE: case RTE_FLOW_ACTION_TYPE_CONNTRACK: update = action->conf; break; @@ -2816,17 +2817,22 @@ port_queue_action_handle_update(portid_t port_id, return -EINVAL; } - if (pia->type == RTE_FLOW_ACTION_TYPE_METER_MARK) { + switch (pia->type) { + case RTE_FLOW_ACTION_TYPE_AGE: + update = action->conf; + break; + case RTE_FLOW_ACTION_TYPE_METER_MARK: rte_memcpy(&mtr_update.meter_mark, action->conf, sizeof(struct rte_flow_action_meter_mark)); mtr_update.profile_valid = 1; - mtr_update.policy_valid = 1; - mtr_update.color_mode_valid = 1; - mtr_update.init_color_valid = 1; - mtr_update.state_valid = 1; + mtr_update.policy_valid = 1; + mtr_update.color_mode_valid = 1; + mtr_update.init_color_valid = 1; + mtr_update.state_valid = 1; update = &mtr_update; - } else { + default: update = action; + break; } if (rte_flow_async_action_handle_update(port_id, queue_id, &attr, diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 565868aeea..1ce0277e65 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2737,7 +2737,7 @@ Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. Action: ``AGE`` ^^^^^^^^^^^^^^^ -Set ageing timeout configuration to a flow. +Set aging timeout configuration to a flow. Event RTE_ETH_EVENT_FLOW_AGED will be reported if timeout passed without any matching on the flow. @@ -2756,8 +2756,8 @@ timeout passed without any matching on the flow. | ``context`` | user input flow context | +--------------+---------------------------------+ -Query structure to retrieve ageing status information of a -shared AGE action, or a flow rule using the AGE action: +Query structure to retrieve aging status information of an +indirect AGE action, or a flow rule using the AGE action: .. _table_rte_flow_query_age: @@ -2773,6 +2773,25 @@ shared AGE action, or a flow rule using the AGE action: | ``sec_since_last_hit`` | out | Seconds since last traffic hit | +------------------------------+-----+----------------------------------------+ +Update structure to modify the parameters of an indirect AGE action. +The update structure is used by ``rte_flow_action_handle_update()`` function. + +.. _table_rte_flow_update_age: + +.. table:: AGE update + + +-------------------+--------------------------------------------------------------+ + | Field | Value | + +===================+==============================================================+ + | ``reserved`` | 6 bits reserved, must be zero | + +-------------------+--------------------------------------------------------------+ + | ``timeout_valid`` | 1 bit, timeout value is valid | + +-------------------+--------------------------------------------------------------+ + | ``timeout`` | 24 bits timeout value | + +-------------------+--------------------------------------------------------------+ + | ``touch`` | 1 bit, touch the AGE action to set ``sec_since_last_hit`` 0 | + +-------------------+--------------------------------------------------------------+ + Action: ``SAMPLE`` ^^^^^^^^^^^^^^^^^^ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 64ec8f0903..a2101e0e11 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2643,6 +2643,7 @@ enum rte_flow_action_type { * See function rte_flow_get_aged_flows * see enum RTE_ETH_EVENT_FLOW_AGED * See struct rte_flow_query_age + * See struct rte_flow_update_age */ RTE_FLOW_ACTION_TYPE_AGE, @@ -2809,6 +2810,33 @@ struct rte_flow_query_age { uint32_t sec_since_last_hit:24; /**< Seconds since last traffic hit. */ }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_AGE + * + * Update indirect AGE action attributes: + * - Timeout can be updated including stop/start action: + * +-------------+-------------+------------------------------+ + * | Old Timeout | New Timeout | Updating | + * +=============+=============+==============================+ + * | 0 | positive | Start aging with new value | + * +-------------+-------------+------------------------------+ + * | positive | 0 | Stop aging | + * +-------------+-------------+------------------------------+ + * | positive | positive | Change timeout to new value | + * +-------------+-------------+------------------------------+ + * - sec_since_last_hit can be reset. + */ +struct rte_flow_update_age { + uint32_t reserved:6; /**< Reserved, must be zero. */ + uint32_t timeout_valid:1; /**< The timeout is valid for update. */ + uint32_t timeout:24; /**< Time in seconds. */ + /**< Means that aging should assume packet passed the aging. */ + uint32_t touch:1; +}; + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice -- 2.25.1