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 92C4DA00C5; Thu, 1 Dec 2022 16:10:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FF9B42D11; Thu, 1 Dec 2022 16:10:18 +0100 (CET) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by mails.dpdk.org (Postfix) with ESMTP id 706A342D0D for ; Thu, 1 Dec 2022 16:10:14 +0100 (CET) Received: by mail-pj1-f42.google.com with SMTP id v3-20020a17090ac90300b00218441ac0f6so4380289pjt.0 for ; Thu, 01 Dec 2022 07:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=fmJkriwsGWmFkZ7Cm/x3FaqzqfhanXi8HGTTMqsxYwk=; b=iwYal9tEHsLoAlPvgJ+L6F2aSJrWcMiE21J+sRRiD8Pt2POKLIIdKNWkYw3P9pJNay FG8tC5v9pw/syu6TdVabEKenRAzWTbDiBnMvs+nTenGOWzfvBB31nodjGZibqQzZVBZO nZJ0rcKcbLUoAEfBM8xipLZ28lxmr37Wb3GIUs5O9t6tmag21WJr/izYLZaK0dilPzYb akuxXHOIcrc+08ob2OmWmykTAnzEdHiLbMhtrgYnGmbxnQBKLsmVx9jSo5bMY1kcK9R3 csgLbm7nRALDcE5bNIz5OzQBJDr6HKkp5giZ844Su+ODc0W+ZOhlRBrg9rnNeXu/VevC WX6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fmJkriwsGWmFkZ7Cm/x3FaqzqfhanXi8HGTTMqsxYwk=; b=whAj1mgGWdwikySc239YXDwTZcx7IqsfcrzGngfL4fOYC2tUXsUZh0kMVXQzjb+DJU IT191rxMH1llq5rGXQoqojJiu6JgUzFf70jLEwD9c9faFbtx5N1Wg/Ucdgj3cI7VodUq +OVVtdBX2uNXWTCm+gTiyCfcPXrYDH8jcU/dlX23KPwAHuEZ5gxDEDGf66BSaoPRKgG1 GS+ksQ+Am8XyYzEqbPlEeC5HqRB29kepzqUEPI8BBjfe19NjivX2z+965DavAmBzpeRI hJL3mzk/rN99tMXLCLe2jPhdqQmzEuFGyo03IKFLEEZMKinBAQphF4i7D/XJ5GI8ReSZ O6Mg== X-Gm-Message-State: ANoB5plRQVM9B4Hy7X0/YTmKrcFmFOxytWKlIkWk07qaDrno/9KKhJlZ NCRSk49wp3TfQ5Fh3AR4xs5CcA== X-Google-Smtp-Source: AA0mqf4t88Y48pRf1u5zWOzYG6HxhNAIGdoR9J9Rzryuo95AakYQU2n0ULK6WtDvgOb1qGDviImr7Q== X-Received: by 2002:a17:902:8bc4:b0:187:2790:9bc2 with SMTP id r4-20020a1709028bc400b0018727909bc2mr50546097plo.61.1669907413188; Thu, 01 Dec 2022 07:10:13 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id a4-20020a621a04000000b005752b9fec48sm3351941pfa.204.2022.12.01.07.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 07:10:12 -0800 (PST) Date: Thu, 1 Dec 2022 07:10:11 -0800 From: Stephen Hemminger To: Rongwei Liu Cc: , , , , Ferruh Yigit , Andrew Rybchenko , , Subject: Re: [RFC 2/2] ethdev: add API to set process to primary or secondary Message-ID: <20221201071011.1fd30f68@hermes.local> In-Reply-To: <20221201082005.732252-3-rongweil@nvidia.com> References: <20221201082005.732252-1-rongweil@nvidia.com> <20221201082005.732252-3-rongweil@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Thu, 1 Dec 2022 10:20:05 +0200 Rongwei Liu wrote: > +/** > + * @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 immediately. > + * 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 > + * - (>=0) Number of rte devices which have been switched successfully. > + * - (-EINVAL) if bad parameter. > + */ > +__rte_experimental > +int rte_eth_process_set_primary(bool primary, uint32_t flag); The state of the devices and the system is really unstable if this fails. There is no rollback here. I think this should have a PMD capability flag so that application can check that device supports doing this. And it would have to be opt-in so that existing devices would always fail.