On Tue, Apr 10, 2018 at 09:34:13PM +0800, Xueming Li wrote:
> In some environments it is desirable to have the NIC perform RSS
> normally on the packet regardless of the number of queues configured.
> The RSS hash result that is stored in the mbuf can then be used by
> the application to make decisions about how to distribute workloads
> to threads, secondary processes, or even virtual machines if the
> application is a virtual switch.
>
> Signed-off-by: Xueming Li <xuemi...@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 71 
> +++++++++++++++++++-------------------------
>  1 file changed, 30 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 5784f2ee0..9efe00086 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -1252,48 +1252,37 @@ mlx5_flow_convert_rss(struct rte_eth_dev *dev, struct 
> mlx5_flow_parse *parser)
>                       parser->queue[i].ibv_attr = NULL;
>               }
>       }
> -     if (parser->rss_conf.types) {
> -             /* Remove impossible flow according to the RSS configuration. */
> -             for (i = hmin; i != (hmax + 1); ++i) {
> -                     if (!parser->queue[i].ibv_attr)
> -                             continue;
> -                     if (parser->rss_conf.types &
> -                         hash_rxq_init[i].dpdk_rss_hf) {
> -                             parser->queue[i].hash_fields =
> -                                     hash_rxq_init[i].hash_fields;
> -                             found = 1;
> -                             continue;
> -                     }
> -                     /* L4 flow could be used for L3 RSS. */
> -                     if (i == parser->layer && i < ip &&
> -                         (hash_rxq_init[ip].dpdk_rss_hf &
> -                          parser->rss_conf.types)) {
> -                             parser->queue[i].hash_fields =
> -                                     hash_rxq_init[ip].hash_fields;
> -                             found = 1;
> -                             continue;
> -                     }
> -                     /* L3 flow and L4 hash: non-rss L3 flow. */
> -                     if (i == parser->layer && i == ip && found)
> -                             /* IP pattern and L4 HF. */
> -                             continue;
> -                     rte_free(parser->queue[i].ibv_attr);
> -                     parser->queue[i].ibv_attr = NULL;
> +     /* Remove impossible flow according to the RSS configuration. */
> +     for (i = hmin; i != (hmax + 1); ++i) {
> +             if (!parser->queue[i].ibv_attr)
> +                     continue;
> +             if (parser->rss_conf.types &
> +                 hash_rxq_init[i].dpdk_rss_hf) {
> +                     parser->queue[i].hash_fields =
> +                             hash_rxq_init[i].hash_fields;
> +                     found = 1;
> +                     continue;
>               }
> -             if (!found)
> -                     DRV_LOG(WARNING,
> -                             "port %u rss hash function doesn't match "
> -                             "pattern", dev->data->port_id);
> -     } else {
> -             /* Remove any other flow. */
> -             for (i = hmin; i != (hmax + 1); ++i) {
> -                     if (i == parser->layer || !parser->queue[i].ibv_attr)
> -                             continue;
> -                     rte_free(parser->queue[i].ibv_attr);
> -                     parser->queue[i].ibv_attr = NULL;
> +             /* L4 flow could be used for L3 RSS. */
> +             if (i == parser->layer && i < ip &&
> +                 (hash_rxq_init[ip].dpdk_rss_hf &
> +                  parser->rss_conf.types)) {
> +                     parser->queue[i].hash_fields =
> +                             hash_rxq_init[ip].hash_fields;
> +                     found = 1;
> +                     continue;
>               }
> -             parser->rss_conf.queue_num = 1;
> +             /* L3 flow and L4 hash: non-rss L3 flow. */
> +             if (i == parser->layer && i == ip && found)
> +                     /* IP pattern and L4 HF. */
> +                     continue;
> +             rte_free(parser->queue[i].ibv_attr);
> +             parser->queue[i].ibv_attr = NULL;
>       }
> +     if (!found)
> +             DRV_LOG(WARNING,
> +                     "port %u rss hash function doesn't match "
> +                     "pattern", dev->data->port_id);
>       return 0;
>  }
>  
> @@ -2326,8 +2315,8 @@ mlx5_flow_dump(struct rte_eth_dev *dev __rte_unused,
>               (void *)flow->frxq[i].hrxq->ind_table,
>               flow->frxq[i].hash_fields |
>               (flow->tunnel &&
> -              flow->rss_conf.rss_level ? (uint32_t)IBV_RX_HASH_INNER : 0),
> -             flow->queues_n,
> +              flow->rss_conf.level ? (uint32_t)IBV_RX_HASH_INNER : 0),
> +             flow->rss_conf.queue_num,
>               flow->frxq[i].ibv_attr->num_of_specs,
>               flow->frxq[i].ibv_attr->size,
>               flow->frxq[i].ibv_attr->priority,
> -- 
> 2.13.3

Seems, this code should make part of
"[PATCH v2 07/15] net/mlx5: support tunnel RSS level", as it re-works
the code added there, in addition this feature is already present in
tree for non tunnel packets.

Any reason why it is not merged in the previous commit?

Thanks,

-- 
Nélio Laranjeiro
6WIND

Reply via email to