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 D1C37A050D for ; Wed, 30 Mar 2022 16:24:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 953EB428EC; Wed, 30 Mar 2022 16:24:18 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id D061942864; Wed, 30 Mar 2022 16:24:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648650255; x=1680186255; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=N59AsrdJ+7zMYYlbdJJFn4T810HG4+n//7POjNOCLIY=; b=NuMcsMA32STpF2UD0+QtGvJvY5YiDxIA506XnH1HSDObCPmrYbjU0BTK OaX/pZ1eQzV6hlAPqdleIMm7bhXoFZoKI0l2PYeY9bAXB5GVJGb1a32Ga p7l6nY3lXWZ73NpNMnBKK7KebA5iF+22Xs1HVUHkOsM2JTelFSEdOZf24 /XIRdSrpqTwWFY2dPfEdifnb+Cslw/8c/AtypmHDtcNhvsBSyzO7U5689 8ompVBHbw/IPi8hDN01/Mn1PHzvfPuqO84zoHFh+14ImYblSjTIRDOYFR 85rzgUnlwM/FPAJi9n4gMH7JNhcl/1fqfTnkH7mvNOCzz6LLDAotd50fF g==; X-IronPort-AV: E=McAfee;i="6200,9189,10301"; a="240150726" X-IronPort-AV: E=Sophos;i="5.90,222,1643702400"; d="scan'208";a="240150726" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 07:24:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,222,1643702400"; d="scan'208";a="695115942" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga001.fm.intel.com with ESMTP; 30 Mar 2022 07:24:13 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 30 Mar 2022 07:24:13 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 30 Mar 2022 07:24:13 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 30 Mar 2022 07:24:13 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.47) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 30 Mar 2022 07:24:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FmMKjhnZcdEXq21/DqQegRxmCLA5BOQ51DEPEdzmoicgPi3f2RZAnstxjElauEZ3gndsfB9lZX6KWWWQUhiuLJNIRp3DLAtiqr6fXvHMMp+jIb31skm7cYzRW9fS+vnQ4WK3JTjfFv1Wj0khhLx19RFp9bcOPmhipItZqcxMOsqGb1yq+mbWtl8G437h8I2Yqzr2kmoj4YepL9Q27pbtmWOIOonR+pEe2+a3C14gxf4H7rjt7ZL+7vsvS45DcpNlKb2ZOkl4Nrj+XIEt7ki4odTMIfvyLzXCiOOyX5PhIVdeESRnd8FEKWkrk5JjNoowsX7A1tOpFdqfXu1kKE986Q== 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=8A5649mhG9TCHN7BNzHa4kb1C0JXsmKbut+EK729vQY=; b=IKTpZcf0r+NJ48t8ECS4/bWrseMpyRSUjsoqVILv6+uE1IyHhxnRngEdTOIu0gw2d9d4DX2h8Klqgn70l7zU3bTiJpph5uZrqcDhGsW11ExKyOsLDXuaTB03JUBo0OHA2dr+qUqNw9bzcRH4VZ3TmzXOQn683py8LN6bjfIbvGEmppEp2a1Vn4QVLrPumoQ/j5ajVOamv+083uNrPPbDU7K3Ikgw0gAMcYdTBLf310xpFZLhhRiPYLrbyawoLECcGyPc1M36m0tUYxdvFpOis0Pc7FW6my5XaqhulZm7VHmBxQvz3b+iiTfvX7u0Lh/pgYLxGQ3atBRzqWbUlGojMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) by DM5PR11MB1257.namprd11.prod.outlook.com (2603:10b6:3:12::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.22; Wed, 30 Mar 2022 14:24:11 +0000 Received: from MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::c3c:359:d9c4:3a54]) by MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::c3c:359:d9c4:3a54%4]) with mapi id 15.20.5123.020; Wed, 30 Mar 2022 14:24:11 +0000 Message-ID: <4f68f319-a533-5170-149b-623acf8bb30d@intel.com> Date: Wed, 30 Mar 2022 19:53:59 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] app/testpmd: fix use of indirect action after port close Content-Language: en-US To: Dmitry Kozlyuk , CC: , Matan Azrad , Xiaoyun Li , Yuying Zhang References: <20220307164821.821406-1-dkozlyuk@nvidia.com> From: "Singh, Aman Deep" In-Reply-To: <20220307164821.821406-1-dkozlyuk@nvidia.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BM1PR01CA0103.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::19) To MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b369652-66d4-4b95-98ac-08da1258f59c X-MS-TrafficTypeDiagnostic: DM5PR11MB1257:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Reik6sNkpg8fBpShvumNX/fxTBSqGtnin2lHmquCvedvype/IWJp7GfVFX9IR1f9777CNiut9ktIwka8ufpY9lC5c/cMICvKLVV6bOFO6htG8PEpCqDIFitkjiD7SdiBtW2ycpAlvtG9g++gZmtQWB+nvjhR57COprZUofGhGF412d3sC1rYWVh33JbD7ps4uowjFMhyAc8JaXnJbeAhFGQPr20ywCRcD0ofV+ovmJ2THZqBx0Tw/0BcZEwP2ku0D7AcQjvJwpQjwIR9RpU/Tl103BsFS998JJ9xftJ2nV5x6zAw/XluQZGjPivTTCkcMQLwnMfP0xFbtHvkuguPxiy7el7p5WKRNuI6XARhhuREM3DdDacWR9KLrsy8ownw949qiwDEADXyGcbKZW5yB48fOKVqU3aNqyUSxZCWXBHtG4f/bE99UcwXp/Xf0c03jF7hzME2YQ5E2DlJGBqvqT+hPZpOIn+/M+fKdvuQZhktIFbJiLPhrYAapnt1hrAyow98afzNqw9B+GDsz93c1E99zeY/F587cXy2uA5vjyKh8+YUsllI1osV5HOkHsqdK74xumo09qiGLfHxGLSm8WAEOlz38sFMyLfpgIZeCWcLIWii+un+VEhVSC4MmLbLkSNJV7/8KEkLsMGj8CWvQEhF6mFXhvO/HlQrb4IWkULybdKrUec+KKHKpi0zQxn9EIQF1vXV6AvgoDQH7HlECKic1gu30OzszTRCA1qgS0k= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB0062.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(5660300002)(2616005)(6506007)(26005)(8936002)(107886003)(186003)(53546011)(508600001)(38100700002)(2906002)(6666004)(6512007)(82960400001)(6486002)(31696002)(83380400001)(31686004)(86362001)(66556008)(36756003)(8676002)(54906003)(66476007)(316002)(4326008)(66946007)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MnM1QUFkTSt5SmUrQWNSV3F5S2grcmlDZjRKYmw4K2h0RzVkTnA5YXVlM3hJ?= =?utf-8?B?VDJBUkZ1NUpGT25sK01YYm1BMGd3aFgwaWgvZEVYUUM1NXJRSnJUeDR2dllX?= =?utf-8?B?SlI3ZnAxWW9tZnVzSytHUVVwTFkwSVhRdmR5RnhOQmhlVHZkUjhuc2xIZ2FX?= =?utf-8?B?M29lMDFOV2puNFExNWhZcUlxMjNGZ2xzaTVqNmgwVEFCRWxCZ1RUd2txRjky?= =?utf-8?B?eVF5NlVlM1R2T3ovcjNSbUhJRDNyWjNjbW90b1FiL2xNeWdrd0ROTW0yZzJh?= =?utf-8?B?YnVXWi9PdUliNzFqUVJhTnFqaTNrakN6dm1XN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TmFyUWtjbUUwYVljQzdjc05iVXlJL1hka05aSlFBcEdZVUlFbk5ZYVdmWTBx?= =?utf-8?B?ZU1yMFZuOFZZOVdLbzZrTi9oc3pNdHBCYUp3b1NHaUk0QUpwMjlrZmthYTJ4?= =?utf-8?B?OGFEYzgzN05yU0xJR3dvZ0s1Vlg4YldSZnR1aVJpdlg3K1RYcTBxaE9obkRH?= =?utf-8?B?NGZUMmZ3WVJNU3dBSmhsRnBCcDhDUXpZaU5iZHRjYjJycTR1Uk43U25TeW4r?= =?utf-8?Q?pfjnyv++IBBya1w4=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 1b369652-66d4-4b95-98ac-08da1258f59c X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB0062.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 14:24:11.7042 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hEOS/sQqczM1Rvkkoj7ScF+w07irqkcsRRhi7euhbkemO+1mC0o99yXXcFGC1fxENfOaPFvDwIyNsRiqnJCTsusmsWtnskaolz0saSazWcM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1257 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi Dmitry, On 3/7/2022 10:18 PM, Dmitry Kozlyuk wrote: > When a port was closed, indirect actions could remain > with their handles no longer valid. > If a newly attached device was assigned the same ID as the closed port, > those indirect actions became accessible again. > Any attempt to use them resulted in an undefined behavior. > Automatically flush indirect actions when a port is closed. > > Fixes: 4b61b8774be9 ("ethdev: introduce indirect flow action") > Cc: stable@dpdk.org > > Signed-off-by: Dmitry Kozlyuk > Acked-by: Matan Azrad > --- From: guides/prog_guide/rte_flow.rst /"If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised,// //this means that the PMD can keep at least some indirect actions// //across device stop and start. /Please check, if we are inline with the guidelines given in the section. / / > app/test-pmd/config.c | 31 +++++++++++++++++++++++++++++++ > app/test-pmd/testpmd.c | 1 + > app/test-pmd/testpmd.h | 1 + > 3 files changed, 33 insertions(+) > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index cc8e7aa138..04baa319e0 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -1844,6 +1844,37 @@ port_action_handle_destroy(portid_t port_id, > return ret; > } > > +int > +port_action_handle_flush(portid_t port_id) > +{ > + struct rte_port *port; > + struct port_indirect_action **tmp; > + int ret = 0; > + > + if (port_id_is_invalid(port_id, ENABLED_WARN) || > + port_id == (portid_t)RTE_PORT_ALL) > + return -EINVAL; > + port = &ports[port_id]; > + tmp = &port->actions_list; > + while (*tmp != NULL) { > + struct rte_flow_error error; > + struct port_indirect_action *pia = *tmp; > + > + /* Poisoning to make sure PMDs update it in case of error. */ > + memset(&error, 0x44, sizeof(error)); > + if (pia->handle != NULL && > + rte_flow_action_handle_destroy > + (port_id, pia->handle, &error) != 0) { > + printf("Indirect action #%u not destroyed\n", pia->id); > + ret = port_flow_complain(&error); > + tmp = &pia->next; > + } else { > + *tmp = pia->next; > + free(pia); > + } > + } > + return ret; > +} > > /** Get indirect action by port + id */ > struct rte_flow_action_handle * > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index fe2ce19f99..f07f76f8f5 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -3139,6 +3139,7 @@ close_port(portid_t pid) > if (is_proc_primary()) { > port_flow_flush(pi); > port_flex_item_flush(pi); > + port_action_handle_flush(pi); > rte_eth_dev_close(pi); > } > > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h > index 31f766c965..e25663e5b3 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -907,6 +907,7 @@ int port_action_handle_create(portid_t port_id, uint32_t id, > const struct rte_flow_action *action); > int port_action_handle_destroy(portid_t port_id, > uint32_t n, const uint32_t *action); > +int port_action_handle_flush(portid_t port_id); > struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id, > uint32_t id); > int port_action_handle_update(portid_t port_id, uint32_t id,