Skip to contentSkip to conversation

rte-flow: unmatched ingress traffic default action

DISCUSSION Robin Jarry 2 participants 7 messages Oct 17, 2022 – Oct 18, 2022

lore
Share & tools
lore
#0 lore raw

Hi Ori, all,

From what I can read in the docs in the "Isolated Mode"[1] section:

Quoted 4 lines

The general expectation for ingress traffic is that flow rules process it first; the remaining unmatched or pass-through traffic usually ends up in a queue (with or without RSS, locally or in some sub-device instance) depending on the global configuration settings of a port.

[1]: https://doc.dpdk.org/guides/prog_guide/rte_flow.html#flow-isolated-mode

Should I read "general expectation" as a simple recommendation or is it a requirement from the RTE flow API?

I realize that this eventually will depend on each driver, firmware and/or hardware. However, would it be reasonable to rely on such a behaviour to implement preemptive queue redirection prior to regular RSS?

For the sake of argument, let's say I have 3 RX queues configured with an RSS redirection table set as follows:

    0 1 0 1 0 1 0 1 0 1 ..... 1 0 1

And I configure a single flow:

    struct rte_flow_error error;
    struct rte_flow *flow;

    flow = rte_flow_create(
        port_id,
        (const struct rte_flow_attr){ .ingress = 1 },
        (const struct rte_flow_item []) {
            {
                .type = RTE_FLOW_ITEM_TYPE_ETH,
                .spec = &(const struct rte_flow_item_eth){
                    .type = htons(0x1234),
                },
                .mask = &(const struct rte_flow_item_eth){
                    .type = htons(0xffff),
                },
            },
            { .type = RTE_FLOW_ITEM_TYPE_END },
        },
        (const struct rte_flow_action actions[]){
            {
                .type = RTE_FLOW_ACTION_TYPE_QUEUE,
                .conf = &(const struct rte_flow_action_queue) {
                    .index = 2,
                },
            },
            { .type = RTE_FLOW_ACTION_TYPE_END },
        },
        &error,
    );

Can I expect *all* ingress traffic *not* matching ether_type=0x1234 to be redirected to queues 0 and 1 following the default RSS algorithm?

If folks from NIC vendors could comment on their own implementation, it would be much appreciated.

Thanks in advance.

Signature · 3 lines
Robin Jarry
Principal Software Engineer
Red Hat
#1 lore raw

Hi Jarry,

Quoted 13 lines

-----Original Message-----
From: Robin Jarry <[email protected]>
Sent: Monday, 17 October 2022 17:49

Hi Ori, all,

From what I can read in the docs in the "Isolated Mode"[1] section:

Quoted 4 lines

The general expectation for ingress traffic is that flow rules process it first; the remaining unmatched or pass-through traffic usually ends up in a queue (with or without RSS, locally or in some sub-device instance) depending on the global configuration settings of a port.

Quoted 6 lines

[1]: https://doc.dpdk.org/guides/prog_guide/rte_flow.html#flow-isolated-
mode

Should I read "general expectation" as a simple recommendation or is it a requirement from the RTE flow API?

I think the wording in the doc should change since it is not clear.
So let me clarify it.
The idea of isolated mode is that the DPDK application will only get traffic that the application actively requested.
When working in isolated mode (relevant only for ingress traffic), the DPDK port can only receive traffic that the application configured a matching rule.
If no matching rule was set the packet is moved to the next application/kernel or dropped if no such application/kernel exists.

Quoted 42 lines

I realize that this eventually will depend on each driver, firmware and/or hardware. However, would it be reasonable to rely on such a behaviour to implement preemptive queue redirection prior to regular RSS?

For the sake of argument, let's say I have 3 RX queues configured with an RSS redirection table set as follows:

    0 1 0 1 0 1 0 1 0 1 ..... 1 0 1

And I configure a single flow:

    struct rte_flow_error error;
    struct rte_flow *flow;

    flow = rte_flow_create(
        port_id,
        (const struct rte_flow_attr){ .ingress = 1 },
        (const struct rte_flow_item []) {
            {
                .type = RTE_FLOW_ITEM_TYPE_ETH,
                .spec = &(const struct rte_flow_item_eth){
                    .type = htons(0x1234),
                },
                .mask = &(const struct rte_flow_item_eth){
                    .type = htons(0xffff),
                },
            },
            { .type = RTE_FLOW_ITEM_TYPE_END },
        },
        (const struct rte_flow_action actions[]){
            {
                .type = RTE_FLOW_ACTION_TYPE_QUEUE,
                .conf = &(const struct rte_flow_action_queue) {
                    .index = 2,
                },
            },
            { .type = RTE_FLOW_ACTION_TYPE_END },
        },
        &error,
    );
Quoted 3 lines

Can I expect *all* ingress traffic *not* matching ether_type=0x1234 to be redirected to queues 0 and 1 following the default RSS algorithm?

No, all traffic not matching the rule will be moved to the kernel in case of a bifurcated driver, MLX5 for example, or dropped assuming there is no other application with a matching rule.

Quoted 9 lines

If folks from NIC vendors could comment on their own implementation, it would be much appreciated.

Thanks in advance.

--
Robin Jarry
Principal Software Engineer
Red Hat

Best,
Ori

#2 lore raw

Hi Ori,

Ori Kam, Oct 18, 2022 at 09:41:

Quoted 6 lines
Quoted 2 lines

Should I read "general expectation" as a simple recommendation or is it a requirement from the RTE flow API?

I think the wording in the doc should change since it is not clear. So let me clarify it.

Quoted 8 lines

The idea of isolated mode is that the DPDK application will only get traffic that the application actively requested.

When working in isolated mode (relevant only for ingress traffic), the DPDK port can only receive traffic that the application configured a matching rule. If no matching rule was set the packet is moved to the next application/kernel or dropped if no such application/kernel exists.

Oh I was not clear enough. I *don't* use the isolated mode. The "general expectation" I am referring to seems to be in the non-isolated mode.

Quoted 7 lines
Quoted 3 lines

Can I expect *all* ingress traffic *not* matching ether_type=0x1234 to be redirected to queues 0 and 1 following the default RSS algorithm?

No, all traffic not matching the rule will be moved to the kernel in case of a bifurcated driver, MLX5 for example, or dropped assuming there is no other application with a matching rule.

This is also in regular (non-isolated) mode?

Thanks!

Robin

#3 lore raw

Hi Jarry,

Quoted 29 lines

-----Original Message-----
From: Robin Jarry <[email protected]>
Sent: Tuesday, 18 October 2022 11:13

Hi Ori,

Ori Kam, Oct 18, 2022 at 09:41:

Quoted 6 lines
Quoted 2 lines

Should I read "general expectation" as a simple recommendation or is it a requirement from the RTE flow API?

I think the wording in the doc should change since it is not clear. So let me clarify it.

Quoted 8 lines

The idea of isolated mode is that the DPDK application will only get traffic that the application actively requested.

When working in isolated mode (relevant only for ingress traffic), the DPDK port can only receive traffic that the application configured a matching rule. If no matching rule was set the packet is moved to the next application/kernel or dropped if no such application/kernel exists.

Oh I was not clear enough. I *don't* use the isolated mode. The "general expectation" I am referring to seems to be in the non-isolated mode.

Quoted 4 lines
Quoted 3 lines

Can I expect *all* ingress traffic *not* matching ether_type=0x1234 to be redirected to queues 0 and 1 following the default RSS algorithm?

Quoted 5 lines
Quoted 3 lines

No, all traffic not matching the rule will be moved to the kernel in case of a bifurcated driver, MLX5 for example, or dropped assuming there is no other application with a matching rule.

This is also in regular (non-isolated) mode?

No, in non-isolated mode PMD will insert default rules based on the configuration, for example matching on the mac/vlan

Best,
Ori

Quoted 4 lines

Thanks!

Robin

#4 lore raw

Ori Kam, Oct 18, 2022 at 11:16:

Quoted 4 lines
Quoted 1 line

This is also in regular (non-isolated) mode?

No, in non-isolated mode PMD will insert default rules based on the configuration, for example matching on the mac/vlan

And eventually redirecting packets in queues following the RSS configuration?

Do you think this is something that can be relied upon across different PMDs/NICs?

#5 lore raw
Quoted 6 lines

-----Original Message-----
From: Robin Jarry <[email protected]>
Sent: Tuesday, 18 October 2022 12:36

Quoted 8 lines

Ori Kam, Oct 18, 2022 at 11:16:

Quoted 4 lines
Quoted 1 line

This is also in regular (non-isolated) mode?

No, in non-isolated mode PMD will insert default rules based on the configuration, for example matching on the mac/vlan

And eventually redirecting packets in queues following the RSS configuration?

Yes.

Quoted 3 lines

Do you think this is something that can be relied upon across different PMDs/NICs?

Unless I'm missing something, yes this is the basis of DPDK. (I assume you are talking about non-isolated mode)

#6 lore raw

Ori Kam, Oct 18, 2022 at 12:11:

Quoted 5 lines
Quoted 2 lines

Do you think this is something that can be relied upon across different PMDs/NICs?

Unless I'm missing something, yes this is the basis of DPDK. (I assume you are talking about non-isolated mode)

Yes I am. Thanks a lot for the precisions.