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 9BC64A0540; Fri, 2 Dec 2022 04:27:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36A3A40689; Fri, 2 Dec 2022 04:27:42 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2058.outbound.protection.outlook.com [40.107.220.58]) by mails.dpdk.org (Postfix) with ESMTP id E079F40687 for ; Fri, 2 Dec 2022 04:27:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dRmxQQTw7RfOT+yQwAMnOJirc5JWFU/xaYUhewh1m6GviZgdmik7SrARXkWmHlseR8hgi0jqYYqOd4FZ5JjM5fgjnrxEMPK2LjH2/jVMR9auw/SmyP599Xbl9UI1xicVnKGROxhyLfFo6BJ0k5OXDmwCGGl2Dw2wOsjTZVuHgItV5d/bqao5gLtuDL9+MWKFPrKIrFhq5JqDTJe0ixytq94Zcyi8O6IxCA4OuDVqBxqemdOFL+jEFe7yeh0L/S2dSNlufFtKGEdZR7BzTDRg/1gAvqfOtCdEMSefzUZClpQKHaAopuO/+5+7rx1B+dUsPmytdFXjNs6AM8WO8nGy/A== 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=zE1wOPiFVFoMpgV/psgT4k394B4rOPC0r1mPeeeX9/4=; b=n6TjX3rkUWwRPAmdGXY33w+Jd59pqTjIIWDvR5yGAbBlIVasihSEDJzBLaJRRIoHWBntiiSzwxZxl/2r+qEOrOU6pLl9cgd3HSRYo0T6hCht83uf+Q4RgssDaioFLJ+mBulSoomfMMfRCV6jdKkdIwVMw/rQc9lf2AXucuoEIne3PIYbgn2t757KetFBFi3xxvfPvKZ2TT5RAzieEm/t67sZuk6h6sHRm+BO0tfcPKzETgYTXqDWsoHyjR/XzWllZHouAOGpsPG93BG+YKN9Zd9wBEHJtfqBEGMuVD3zDWKCOvD/NKia02qudayYXD+xSNa/ech1PJGRhHFObjx++g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=zE1wOPiFVFoMpgV/psgT4k394B4rOPC0r1mPeeeX9/4=; b=Lhgtx2z5r/t5YP4s7He06ZLcAn1FnqKR0GosSMxYNUmMbXhZjoL4ezmHaE7C6w4xETu29mEb7bI05oLRZEHrosWbabXLXwwUBHc/ZFSn8pb+g/CR6RlPy4t9pWcojkGUrGiI60MTszFrDhkJ/75vXDP/8BAlv3HleNk8zlawyrqROp4fOJoOyZph38dxpNPQtZI5k8t9WHMMDQ9EqbS8ABZajufQlV0jYRy7T1UqIBaeKU3nZA3bMp8hEIyJfLdmip8Oc3ZT6PITdC6nsgGpfqhmdWiwH3uLovFXPeffX0k/9l/6QSn0vepuDXjpQvZ/PebI0VXOdtiXGVwJ8g/OtQ== Received: from BN9PR12MB5273.namprd12.prod.outlook.com (2603:10b6:408:11e::22) by BL1PR12MB5287.namprd12.prod.outlook.com (2603:10b6:208:317::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Fri, 2 Dec 2022 03:27:38 +0000 Received: from BN9PR12MB5273.namprd12.prod.outlook.com ([fe80::434f:ddd2:c15c:bf21]) by BN9PR12MB5273.namprd12.prod.outlook.com ([fe80::434f:ddd2:c15c:bf21%5]) with mapi id 15.20.5880.010; Fri, 2 Dec 2022 03:27:38 +0000 From: Rongwei Liu To: Stephen Hemminger CC: Matan Azrad , Slava Ovsiienko , Ori Kam , "NBU-Contact-Thomas Monjalon (EXTERNAL)" , Ferruh Yigit , Andrew Rybchenko , "dev@dpdk.org" , Raslan Darawsheh Subject: RE: [RFC 2/2] ethdev: add API to set process to primary or secondary Thread-Topic: [RFC 2/2] ethdev: add API to set process to primary or secondary Thread-Index: AQHZBV3QxRLFAA1PMkalUGQUV2RsBq5ZI0eAgADK4JA= Date: Fri, 2 Dec 2022 03:27:38 +0000 Message-ID: References: <20221201082005.732252-1-rongweil@nvidia.com> <20221201082005.732252-3-rongweil@nvidia.com> <20221201071011.1fd30f68@hermes.local> In-Reply-To: <20221201071011.1fd30f68@hermes.local> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR12MB5273:EE_|BL1PR12MB5287:EE_ x-ms-office365-filtering-correlation-id: d7a1a6ba-e104-4624-4278-08dad41529e9 x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dnda2HGKdI8H2vB6nIja/twhW14kRRMR0LpDNL6d8ijgVCqRfbVxGcqTv82Nhu5O4WfAKuEJ/lgpE4h6LkxbOcJWbL/HqzMZJGiddeXs7b1dOekov4KL8lgYGhIOcxC8SSjgPTiivJfgZiPxrVLZygFulv7WVCJGlMZJ7Kb4FqgvSuv3uQDntuq8e2y888UAI3Ow8i2fc9GgzWAR84CIqfHtMSyD4dh7zDnVwvQGydbwwHI024y4CxlSPCcr0Cynew5LsjDkzIdR7V/Ri0DkewXj6V+FhsKxj0Y2JH2W2nBxSKSSWi4gsyEj3SZcR+73huznexdNsy80oyfOrgLky1ik/GgH7rSg0PEeeEQrPsU/L8BGlW7HTPb5Iu7BiQ4wHX+oS138tLtrImgMfs1wyzEtXT9z2A/U44uRPUBqal/JzJhReQfs1K//KgzWJkURlMKwvPQ0sRfI1cdbGtScyUU4TbKzhGvz1x699o61piLQkjQnglpfsnFGpp1EkiBhpVVNEqgXG5AV9HC78AVKeMZIDMXifWR1iETgvJu5I7HEzZgoTpiI5GYPsiOgdcsxtd/7gFi4o+6bhG4KPQNWfX5RAsFlALnHFgGBJ3/d4H4OvepVJ+q4zHJdy86E4018ugeMd0ENz81dxeyxRsap+Cmf6MkvQw8JIwjtnNOTCRpB96YGV01aOBkB4DXi1z4h3feA/hwZ4kIoNGMqMpRqzg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN9PR12MB5273.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(136003)(366004)(346002)(39860400002)(396003)(451199015)(55016003)(86362001)(38070700005)(33656002)(9686003)(478600001)(2906002)(7696005)(53546011)(107886003)(26005)(71200400001)(76116006)(6506007)(4326008)(41300700001)(5660300002)(66476007)(64756008)(54906003)(66446008)(66946007)(66556008)(6916009)(8676002)(316002)(8936002)(52536014)(122000001)(83380400001)(38100700002)(186003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?CjL9pN/dIJNcHmqsa9VaEm/mESwmBqL0ZMGOXZHvq89k8Rx5PRPhwZUvmvqD?= =?us-ascii?Q?Lx5SFJcSIlUAfr2Ya17d5MzQzCJvzCO/jQnWxTDCcr9oE3asnlJ9Yq+oJUN2?= =?us-ascii?Q?GB6jXaL74iBMvNUV8qEJ941ND0l++uC3468O3qlm1a19YrwwUPNL/R5FEGHN?= =?us-ascii?Q?6mMVEJSPcu6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?us-ascii?Q?WNt2hLuxb3lez3OHjO08qXX/RYmKULVi0vzUqf0llwbr1nDdOmz+B4WO3VJb?= =?us-ascii?Q?gxn4ZDioC+Q/HG8AH6ka5dgn0iwhXGguqfe3DP5582NbzyWPJLR0GGXRg6Rq?= =?us-ascii?Q?Qj1YmSK9pm6CiaV2Nkl/Z4yVJwW4v5Ji/iZqzHvvWkufSAq/ujQ73HOY7gON?= =?us-ascii?Q?CkIf4ZBgH/Wet4BjpiJ9n7F7WJ1v+4oNGrllsejtxOSNxVzWnw2EcavYzmEj?= =?us-ascii?Q?mwfuNnI/8WBOXJMQQHZ6lyVwUlNu0ZoWqem4Z40Pv5NFFEFN7rKbYfcV5MIX?= =?us-ascii?Q?hX0leykGXRQvaSyV3FBfLZGwNKIoeD89q2XHBUZa+qIflZmu9oQCDAk6C8Wv?= =?us-ascii?Q?Ex8b4+WUvJ+0AckSreUc7Yg8hOgcPhV0keufYxF1jJ+uZ+Cd4yjjxb2pP0jq?= =?us-ascii?Q?+jnPwfBgaCmJU4U043Vp+aI7Rthw3x0kxuKgt/YFDUjpFE2NNcly7qDXV2Ef?= =?us-ascii?Q?QuuKZCvHTfFCeYPm1qz4rxO41ey2U5RyEdjVyC5x?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR12MB5273.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7a1a6ba-e104-4624-4278-08dad41529e9 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2022 03:27:38.8743 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: aMozzxOQhDGBn+WLIgU/AsvjGL/hpaY0gQiAPNniY18m0vwwzSOtvdRroBTenuUNqr6cmM1aAiYTHAGo0Hur6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5287 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 BR Rongwei > -----Original Message----- > From: Stephen Hemminger > Sent: Thursday, December 1, 2022 23:10 > To: Rongwei Liu > Cc: Matan Azrad ; Slava Ovsiienko > ; Ori Kam ; NBU-Contact- > Thomas Monjalon (EXTERNAL) ; Ferruh Yigit > ; Andrew Rybchenko > ; dev@dpdk.org; Raslan Darawsheh > > Subject: Re: [RFC 2/2] ethdev: add API to set process to primary or secon= dary >=20 > External email: Use caution opening links or attachments >=20 >=20 > On Thu, 1 Dec 2022 10:20:05 +0200 > Rongwei Liu wrote: >=20 > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice > > + * > > + * Set the rte_eth process to the primary or secondary role which > > +affects > > + * the flow rules offloading. It doesn't allow multiple processes to > > +be the > > + * same role unless no offload rules are set. > > + * The primary process's flow rules are effective immediately while > > +the secondary > > + * process's rules will be queued in hardware until it becomes > > +primary or no > > + * primary process is alive. > > + * The primary application will always receive traffic while the > > +secondary > > + * application will receive traffic when no matching rules are > > +present from > > + * the primary application. > > + * > > + * The application is primary by default if this API is not called. > > + * > > + * When a process transforms from a secondary to a primary role, all > > +preceding > > + * flow rules which are queued by hardware will be effective immediate= ly. > > + * Before role transition, all the rules set by the primary process > > +should be > > + * flushed first. > > + * > > + * When role flag "RTE_ETH_PROCESS_NIC_DUP_WITH_SECONDARY" is set, > > +NIC domain > > + * flow rules are effective immediately even if a process is secondary= . > > + * > > + * @param active > > + * Process primary (role) or not (secondary). > > + * @param flag > > + * The role flag. > > + * @return > > + * - (>=3D0) Number of rte devices which have been switched successf= ully. > > + * - (-EINVAL) if bad parameter. > > + */ > > +__rte_experimental > > +int rte_eth_process_set_primary(bool primary, uint32_t flag); >=20 > The state of the devices and the system is really unstable if this fails.= There is > no rollback here. >=20 Assume application is calling rte_eth_process_set_primary(false); Once failed, call all preceding successful ports as rte_eth_process_set_pri= mary(true); What do you think? > I think this should have a PMD capability flag so that application can ch= eck > that device supports doing this. And it would have to be opt-in so that e= xisting > devices would always fail. If device doesn't support it, it can set the ethdev callback to NULL or ret= urn failure for all devices. Then the devices' state will be consistent.