DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: Ori Kam <orika@mellanox.com>, Matan Azrad <matan@mellanox.com>,
	Yongseok Koh <yskoh@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Slava Ovsiienko <viacheslavo@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH v2 3/3] net/mlx5: add jump action support for NIC
Date: Wed, 3 Apr 2019 10:16:36 +0000	[thread overview]
Message-ID: <AM6PR0502MB37977046F934824B6E75DCF1C3570@AM6PR0502MB3797.eurprd05.prod.outlook.com> (raw)
Message-ID: <20190403101636.6w6btGHCtabAQCVVa7_ovn39Sllk6ldkxO0K1n7zqyU@z> (raw)
In-Reply-To: <1553790741-69362-4-git-send-email-orika@mellanox.com>

Thursday, March 28, 2019 6:33 PM, Ori Kam:
> Subject: [PATCH v2 3/3] net/mlx5: add jump action support for NIC
> 
> When using Direct Rules we can add actions to jump between tables.
> This is extra useful since rule insertion rate is much higher on other tables
> compared to table zero.
> 
> if no group is selected the rule is added to group 0.
> 
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5.h         |   6 +
>  drivers/net/mlx5/mlx5_flow.h    |  15 ++-
>  drivers/net/mlx5/mlx5_flow_dv.c | 278
> +++++++++++++++++++++++++++++++++++-----
>  drivers/net/mlx5/mlx5_glue.c    |  13 ++
>  drivers/net/mlx5/mlx5_glue.h    |   1 +
>  5 files changed, 282 insertions(+), 31 deletions(-)
> 

[...]

>  /**
>   * Register the flow matcher.
>   *
> @@ -2784,6 +2952,9 @@ struct field_modify_info modify_tcp[] = {
>  		.match_mask = (void *)&matcher->mask,
>  	};
>  	struct mlx5_flow_tbl_resource *tbl = NULL;
> +#ifndef HAVE_MLX5DV_DR
> +	struct mlx5_flow_tbl_resource tbl_tmp; #endif
> 
>  	/* Lookup from cache. */
>  	LIST_FOREACH(cache_matcher, &priv->matchers, next) { @@ -
> 2805,33 +2976,24 @@ struct field_modify_info modify_tcp[] = {
>  			return 0;
>  		}
>  	}
> -#ifdef HAVE_MLX5DV_DR
> -	if (matcher->egress) {
> -		tbl = &priv->tx_tbl[matcher->group];
> -		if (!tbl->obj)
> -			tbl->obj = mlx5_glue->dr_create_flow_tbl
> -				(priv->tx_ns,
> -				 matcher->group * MLX5_GROUP_FACTOR);
> -	} else {
> -		tbl = &priv->rx_tbl[matcher->group];
> -		if (!tbl->obj)
> -			tbl->obj = mlx5_glue->dr_create_flow_tbl
> -				(priv->rx_ns,
> -				 matcher->group * MLX5_GROUP_FACTOR);
> -	}
> -	if (!tbl->obj)
> -		return rte_flow_error_set(error, ENOMEM,
> -
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> -					  NULL, "cannot create table");
> -
> -	rte_atomic32_inc(&tbl->refcnt);
> -#endif
>  	/* Register new matcher. */
>  	cache_matcher = rte_calloc(__func__, 1, sizeof(*cache_matcher),
> 0);
>  	if (!cache_matcher)
>  		return rte_flow_error_set(error, ENOMEM,
> 
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
>  					  "cannot allocate matcher memory");
> +#ifdef HAVE_MLX5DV_DR
> +	tbl = flow_dv_tbl_resource_get(dev, matcher->group *
> MLX5_GROUP_FACTOR,
> +				       matcher->egress, error);
> +	if (!tbl) {
> +		rte_free(cache_matcher);
> +		return rte_flow_error_set(error, ENOMEM,
> +
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> +					  NULL, "cannot create table");
> +	}
> +#else
> +	tbl = &tbl_tmp;
> +#endif

I suggest to have the HAVE_MLX5DV_DR inside the flow_dv_tbl_resource_get (return NULL if no DR support). 
Then we can have a cleaner code of this function. 



  parent reply	other threads:[~2019-04-03 10:16 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 15:38 [dpdk-dev] [PATCH 0/3]net/mlx5: Add Direct Rule support Ori Kam
2019-03-20 15:38 ` Ori Kam
2019-03-20 15:39 ` [dpdk-dev] [PATCH 1/3] net/mlx5: prepare Direct Verbs for Direct Rule Ori Kam
2019-03-20 15:39   ` Ori Kam
2019-03-20 15:39 ` [dpdk-dev] [PATCH 2/3] net/mlx5: add Direct Rules API Ori Kam
2019-03-20 15:39   ` Ori Kam
2019-03-20 15:39 ` [dpdk-dev] [PATCH 3/3] net/mlx5: add jump action support for NIC Ori Kam
2019-03-20 15:39   ` Ori Kam
2019-03-28 16:32 ` [dpdk-dev] [PATCH v2 0/3] net/mlx5: Add Direct Rule support Ori Kam
2019-03-28 16:32   ` Ori Kam
2019-03-28 16:32   ` [dpdk-dev] [PATCH v2 1/3] net/mlx5: prepare Direct Verbs for Direct Rule Ori Kam
2019-03-28 16:32     ` Ori Kam
2019-04-01 14:38     ` Slava Ovsiienko
2019-04-01 14:38       ` Slava Ovsiienko
2019-04-03 10:15     ` Shahaf Shuler
2019-04-03 10:15       ` Shahaf Shuler
2019-03-28 16:32   ` [dpdk-dev] [PATCH v2 2/3] net/mlx5: add Direct Rules API Ori Kam
2019-03-28 16:32     ` Ori Kam
2019-04-01 14:38     ` Slava Ovsiienko
2019-04-01 14:38       ` Slava Ovsiienko
2019-03-28 16:32   ` [dpdk-dev] [PATCH v2 3/3] net/mlx5: add jump action support for NIC Ori Kam
2019-03-28 16:32     ` Ori Kam
2019-04-01 14:38     ` Slava Ovsiienko
2019-04-01 14:38       ` Slava Ovsiienko
2019-04-03 10:16     ` Shahaf Shuler [this message]
2019-04-03 10:16       ` Shahaf Shuler
2019-04-03 10:17   ` [dpdk-dev] [PATCH v2 0/3] net/mlx5: Add Direct Rule support Shahaf Shuler
2019-04-03 10:17     ` Shahaf Shuler
2019-04-03 13:21   ` [dpdk-dev] [PATCH v3 " Ori Kam
2019-04-03 13:21     ` Ori Kam
2019-04-03 13:21     ` [dpdk-dev] [PATCH v3 1/3] net/mlx5: prepare Direct Verbs for Direct Rule Ori Kam
2019-04-03 13:21       ` Ori Kam
2019-04-03 13:21     ` [dpdk-dev] [PATCH v3 2/3] net/mlx5: add Direct Rules API Ori Kam
2019-04-03 13:21       ` Ori Kam
2019-04-03 13:21     ` [dpdk-dev] [PATCH v3 3/3] net/mlx5: add jump action support for NIC Ori Kam
2019-04-03 13:21       ` Ori Kam
2019-04-04  5:26       ` Shahaf Shuler
2019-04-04  5:26         ` Shahaf Shuler
2019-04-04  9:54   ` [dpdk-dev] [PATCH v4 0/3] net/mlx5: Add Direct Rule support Ori Kam
2019-04-04  9:54     ` Ori Kam
2019-04-04  9:54     ` [dpdk-dev] [PATCH v4 1/3] net/mlx5: prepare Direct Verbs for Direct Rule Ori Kam
2019-04-04  9:54       ` Ori Kam
2019-04-12 23:51       ` dwilder
2019-04-12 23:51         ` dwilder
2019-04-13  0:16         ` Yongseok Koh
2019-04-13  0:16           ` Yongseok Koh
2019-04-04  9:54     ` [dpdk-dev] [PATCH v4 2/3] net/mlx5: add Direct Rules API Ori Kam
2019-04-04  9:54       ` Ori Kam
2019-04-04  9:54     ` [dpdk-dev] [PATCH v4 3/3] net/mlx5: add jump action support for NIC Ori Kam
2019-04-04  9:54       ` Ori Kam
2019-04-04 11:01     ` [dpdk-dev] [PATCH v4 0/3] net/mlx5: Add Direct Rule support Shahaf Shuler
2019-04-04 11:01       ` Shahaf Shuler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM6PR0502MB37977046F934824B6E75DCF1C3570@AM6PR0502MB3797.eurprd05.prod.outlook.com \
    --to=shahafs@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=orika@mellanox.com \
    --cc=viacheslavo@mellanox.com \
    --cc=yskoh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).