[dpdk-dev,2/2] net/tap: allow RSS flow action

Message ID 1507042556-9839-2-git-send-email-matan@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Matan Azrad Oct. 3, 2017, 2:55 p.m. UTC
  One of the main identified use cases for the tap PMD is to be used in
combination with the fail-safe PMD as a fallback for a physical device.

Fail-safe is very strict about making sure its current configuration is
properly applied to all slave devices, they get rejected otherwise in
order to maintain a consistent state.

The problem is that tap's RSS support is currently limited to the
default (non-Toeplitz) balancing performed by the kernel on all Rx
queues. While proper RSS support emulation in the tap PMD is a work in
progress, the lack of rte_flow counterpart prevents validation of the
above use case in the meantime.

Given that unlike most PMDs, tap is more about convenience than
performance, support for the RSS action can be temporarily faked with
a minimum amount of code and mostly correct behavior by treating it
like a QUEUE action. Traffic is directed to the first queue of the set.

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/tap/tap_flow.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
  

Comments

Pascal Mazon Oct. 4, 2017, 8:19 a.m. UTC | #1
Hi,

What you say stands to reason, I'm basically ok with your patch, except
for one remark.
The rest of the file has no line breaks anywhere, please remove the two
you added.

Best regards,
Pascal

On 03/10/2017 16:55, Matan Azrad wrote:
> One of the main identified use cases for the tap PMD is to be used in
> combination with the fail-safe PMD as a fallback for a physical device.
>
> Fail-safe is very strict about making sure its current configuration is
> properly applied to all slave devices, they get rejected otherwise in
> order to maintain a consistent state.
>
> The problem is that tap's RSS support is currently limited to the
> default (non-Toeplitz) balancing performed by the kernel on all Rx
> queues. While proper RSS support emulation in the tap PMD is a work in
> progress, the lack of rte_flow counterpart prevents validation of the
> above use case in the meantime.
>
> Given that unlike most PMDs, tap is more about convenience than
> performance, support for the RSS action can be temporarily faked with
> a minimum amount of code and mostly correct behavior by treating it
> like a QUEUE action. Traffic is directed to the first queue of the set.
>
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/tap/tap_flow.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
> index aa33960..28d793f 100644
> --- a/drivers/net/tap/tap_flow.c
> +++ b/drivers/net/tap/tap_flow.c
> @@ -1089,6 +1089,7 @@ struct tap_flow_items {
>  			const struct rte_flow_action_queue *queue =
>  				(const struct rte_flow_action_queue *)
>  				actions->conf;
> +
>  			if (action)
>  				goto exit_action_not_supported;
>  			action = 1;
> @@ -1097,6 +1098,20 @@ struct tap_flow_items {
>  				goto exit_action_not_supported;
>  			if (flow)
>  				err = add_action_skbedit(flow, queue->index);
> +		} else if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) {
> +			/* Fake RSS support. */
> +			const struct rte_flow_action_rss *rss =
> +				(const struct rte_flow_action_rss *)
> +				actions->conf;
> +
> +			if (action)
> +				goto exit_action_not_supported;
> +			action = 1;
> +			if (!rss || rss->num < 1 ||
> +			    (rss->queue[0] > pmd->dev->data->nb_rx_queues - 1))
> +				goto exit_action_not_supported;
> +			if (flow)
> +				err = add_action_skbedit(flow, rss->queue[0]);
>  		} else {
>  			goto exit_action_not_supported;
>  		}
  
Pascal Mazon Oct. 4, 2017, 8:37 a.m. UTC | #2
Hi,

I was a little too quick earlier. The line breaks are justified because
they follow the list of variable declarations.

So I ack the whole patch series.

Acked-by: Pascal Mazon <pascal.mazon@6wind.com>

On 04/10/2017 10:19, Pascal Mazon wrote:
> Hi,
>
> What you say stands to reason, I'm basically ok with your patch, except
> for one remark.
> The rest of the file has no line breaks anywhere, please remove the two
> you added.
>
> Best regards,
> Pascal
>
> On 03/10/2017 16:55, Matan Azrad wrote:
>> One of the main identified use cases for the tap PMD is to be used in
>> combination with the fail-safe PMD as a fallback for a physical device.
>>
>> Fail-safe is very strict about making sure its current configuration is
>> properly applied to all slave devices, they get rejected otherwise in
>> order to maintain a consistent state.
>>
>> The problem is that tap's RSS support is currently limited to the
>> default (non-Toeplitz) balancing performed by the kernel on all Rx
>> queues. While proper RSS support emulation in the tap PMD is a work in
>> progress, the lack of rte_flow counterpart prevents validation of the
>> above use case in the meantime.
>>
>> Given that unlike most PMDs, tap is more about convenience than
>> performance, support for the RSS action can be temporarily faked with
>> a minimum amount of code and mostly correct behavior by treating it
>> like a QUEUE action. Traffic is directed to the first queue of the set.
>>
>> Signed-off-by: Matan Azrad <matan@mellanox.com>
>> ---
>>  drivers/net/tap/tap_flow.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
>> index aa33960..28d793f 100644
>> --- a/drivers/net/tap/tap_flow.c
>> +++ b/drivers/net/tap/tap_flow.c
>> @@ -1089,6 +1089,7 @@ struct tap_flow_items {
>>  			const struct rte_flow_action_queue *queue =
>>  				(const struct rte_flow_action_queue *)
>>  				actions->conf;
>> +
>>  			if (action)
>>  				goto exit_action_not_supported;
>>  			action = 1;
>> @@ -1097,6 +1098,20 @@ struct tap_flow_items {
>>  				goto exit_action_not_supported;
>>  			if (flow)
>>  				err = add_action_skbedit(flow, queue->index);
>> +		} else if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) {
>> +			/* Fake RSS support. */
>> +			const struct rte_flow_action_rss *rss =
>> +				(const struct rte_flow_action_rss *)
>> +				actions->conf;
>> +
>> +			if (action)
>> +				goto exit_action_not_supported;
>> +			action = 1;
>> +			if (!rss || rss->num < 1 ||
>> +			    (rss->queue[0] > pmd->dev->data->nb_rx_queues - 1))
>> +				goto exit_action_not_supported;
>> +			if (flow)
>> +				err = add_action_skbedit(flow, rss->queue[0]);
>>  		} else {
>>  			goto exit_action_not_supported;
>>  		}
  
Ferruh Yigit Oct. 5, 2017, 9:34 p.m. UTC | #3
<...>

>> On 03/10/2017 16:55, Matan Azrad wrote:
>>> One of the main identified use cases for the tap PMD is to be used in
>>> combination with the fail-safe PMD as a fallback for a physical device.
>>>
>>> Fail-safe is very strict about making sure its current configuration is
>>> properly applied to all slave devices, they get rejected otherwise in
>>> order to maintain a consistent state.
>>>
>>> The problem is that tap's RSS support is currently limited to the
>>> default (non-Toeplitz) balancing performed by the kernel on all Rx
>>> queues. While proper RSS support emulation in the tap PMD is a work in
>>> progress, the lack of rte_flow counterpart prevents validation of the
>>> above use case in the meantime.
>>>
>>> Given that unlike most PMDs, tap is more about convenience than
>>> performance, support for the RSS action can be temporarily faked with
>>> a minimum amount of code and mostly correct behavior by treating it
>>> like a QUEUE action. Traffic is directed to the first queue of the set.
>>>
>>> Signed-off-by: Matan Azrad <matan@mellanox.com>

> Acked-by: Pascal Mazon <pascal.mazon@6wind.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
index aa33960..28d793f 100644
--- a/drivers/net/tap/tap_flow.c
+++ b/drivers/net/tap/tap_flow.c
@@ -1089,6 +1089,7 @@  struct tap_flow_items {
 			const struct rte_flow_action_queue *queue =
 				(const struct rte_flow_action_queue *)
 				actions->conf;
+
 			if (action)
 				goto exit_action_not_supported;
 			action = 1;
@@ -1097,6 +1098,20 @@  struct tap_flow_items {
 				goto exit_action_not_supported;
 			if (flow)
 				err = add_action_skbedit(flow, queue->index);
+		} else if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) {
+			/* Fake RSS support. */
+			const struct rte_flow_action_rss *rss =
+				(const struct rte_flow_action_rss *)
+				actions->conf;
+
+			if (action)
+				goto exit_action_not_supported;
+			action = 1;
+			if (!rss || rss->num < 1 ||
+			    (rss->queue[0] > pmd->dev->data->nb_rx_queues - 1))
+				goto exit_action_not_supported;
+			if (flow)
+				err = add_action_skbedit(flow, rss->queue[0]);
 		} else {
 			goto exit_action_not_supported;
 		}