From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH v10 06/11] net/failsafe: support flow API Date: Mon, 17 Jul 2017 19:15:41 +0200 Message-ID: <20170717171541.GT11154@bidouze.vm.6wind.com> References: <2230acd3-1119-22ab-5456-858d90e9f789@intel.com> <20170717161917.GR11154@bidouze.vm.6wind.com> <972f3812-a24a-4510-fc13-44c104a6aca9@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org To: Ferruh Yigit Return-path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id A5CA7532C for ; Mon, 17 Jul 2017 19:15:50 +0200 (CEST) Received: by mail-wm0-f47.google.com with SMTP id b134so876488wma.0 for ; Mon, 17 Jul 2017 10:15:50 -0700 (PDT) Content-Disposition: inline In-Reply-To: <972f3812-a24a-4510-fc13-44c104a6aca9@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Jul 17, 2017 at 05:34:53PM +0100, Ferruh Yigit wrote: > On 7/17/2017 5:19 PM, Gaëtan Rivet wrote: > > On Mon, Jul 17, 2017 at 05:03:46PM +0100, Ferruh Yigit wrote: > >> On 7/15/2017 6:57 PM, Gaetan Rivet wrote: > >>> Signed-off-by: Gaetan Rivet > >>> Acked-by: Olga Shern > >> > >> <...> > >> > >>> + > >>> + flow = fs_flow_allocate(attr, patterns, actions); > >>> + FOREACH_SUBDEV_ST(sdev, i, dev, DEV_ACTIVE) { > >>> + flow->flows[i] = rte_flow_create(PORT_ID(sdev), > >>> + attr, patterns, actions, error); > >> > >> Should SUB_ID(sdev) used here? And in related functions. > >> flow->flows[SUB_ID(sdev)] = ... > >> > > > > The SUB_ID(sdev) is the index in the sub_device array allocated in > > private data for the fail-safe. It is also used for the sub_rte_flow in > > the rte_flow (which sports an array of rte_flow pointers for each > > sub_device). > > I got this part, let me ask another way, is it always guarantied, even > after some hotplug, "i" in FOREACH_SUBDEV_ST(sdev, i, dev, DEV_ACTIVE) > will be same with SUB_ID(sdev) ? > Ah, yes. Sub_device slots are static, allocated once at launch and reserved for only one device corresponding to its declaration. Thus, the PORT_ID() can change, but the SUB_ID() is always the same. > > > > PORT_ID(sdev) is the index in the rte_eth_devices array, meaning that > > the rte_flow_create function is actually called using the public API on > > the port. > > > > This allows to trigger the additional operations usually done within the > > ether API (storing the configuration in the eth_dev_data structure, some > > side management), and following eventual changes automatically from the > > fail-safe level. > > > >>> + if (flow->flows[i] == NULL) { > >>> + ERROR("Failed to create flow on sub_device %d", > >>> + i); > >>> + goto err; > >>> + } > >> <...> > >> > > > -- Gaëtan Rivet 6WIND