[dpdk-dev] [PATCH v10 06/11] net/failsafe: support flow API
Gaëtan Rivet
gaetan.rivet at 6wind.com
Mon Jul 17 19:15:41 CEST 2017
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 <gaetan.rivet at 6wind.com>
> >>> Acked-by: Olga Shern <olgas at mellanox.com>
> >>
> >> <...>
> >>
> >>> +
> >>> + 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
More information about the dev
mailing list