DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xing, Beilei" <beilei.xing@intel.com>
To: "Li, Xiaoyun" <xiaoyun.li@intel.com>,
	"Zhang, Qi Z" <qi.z.zhang@intel.com>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: select fdir config automatically
Date: Sat, 29 Sep 2018 08:36:59 +0000	[thread overview]
Message-ID: <94479800C636CB44BD422CB454846E013224C3C2@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20180928110303.90561-1-xiaoyun.li@intel.com>



> -----Original Message-----
> From: Li, Xiaoyun
> Sent: Friday, September 28, 2018 7:03 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>
> Subject: [PATCH v2] net/i40e: select fdir config automatically
> 
> I40e driver needed users to config exact fdir mode to create rte_flow rules
> but it shouldn't. This patch allows users to create rte_flow rules without
> configuring fdir mode and let the driver select the config automatically. And
> remove the workaround in flow_filtering example.
> 
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> ---
> v2:
>  * Added fdir teardown in i40e_flow_flush_fdir_filter.
>  * Replace TAILQ_FIRST with TAILQ_EMPTY which is more intuitive.
>  * Remove the workaround in flow_filtering example since the driver will
>  * set the fdir config automatically.
> ---
>  drivers/net/i40e/i40e_flow.c   | 35 +++++++++++++++++++++++++++++-----
>  examples/flow_filtering/main.c | 16 ----------------
>  2 files changed, 30 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index
> c67b264de..68ae00a27 100644
> --- a/drivers/net/i40e/i40e_flow.c
> +++ b/drivers/net/i40e/i40e_flow.c
> @@ -3127,6 +3127,7 @@ i40e_flow_parse_fdir_filter(struct rte_eth_dev
> *dev,
>  			    struct rte_flow_error *error,
>  			    union i40e_filter_t *filter)
>  {
> +	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-
> >dev_private);
>  	struct i40e_fdir_filter_conf *fdir_filter =
>  		&filter->fdir_filter;
>  	int ret;
> @@ -3148,14 +3149,29 @@ i40e_flow_parse_fdir_filter(struct rte_eth_dev
> *dev,
> 
>  	if (dev->data->dev_conf.fdir_conf.mode !=
>  	    RTE_FDIR_MODE_PERFECT) {
> -		rte_flow_error_set(error, ENOTSUP,
> -				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> -				   NULL,
> -				   "Check the mode in fdir_conf.");
> -		return -rte_errno;
> +		/* Enable fdir when fdir flow is added at first time. */
> +		ret = i40e_fdir_setup(pf);
> +		if (ret != I40E_SUCCESS) {
> +			rte_flow_error_set(error, ENOTSUP,
> +					   RTE_FLOW_ERROR_TYPE_HANDLE,
> +					   NULL, "Failed to setup fdir.");
> +			return -rte_errno;
> +		}
> +		ret = i40e_fdir_configure(dev);
> +		if (ret < 0) {
> +			rte_flow_error_set(error, ENOTSUP,
> +					   RTE_FLOW_ERROR_TYPE_HANDLE,
> +					   NULL, "Failed to configure fdir.");
> +			goto err;
> +		}
> +
> +		dev->data->dev_conf.fdir_conf.mode =
> RTE_FDIR_MODE_PERFECT;
>  	}
> 
>  	return 0;
> +err:
> +	i40e_fdir_teardown(pf);
> +	return -rte_errno;
>  }
> 
>  /* Parse to get the action info of a tunnel filter @@ -4708,6 +4724,13 @@
> i40e_flow_destroy(struct rte_eth_dev *dev,
>  	case RTE_ETH_FILTER_FDIR:
>  		ret = i40e_flow_add_del_fdir_filter(dev,
>  		       &((struct i40e_fdir_filter *)flow->rule)->fdir, 0);
> +
> +		/* If the last flow is destroyed, disable fdir. */
> +		if (!ret && !TAILQ_EMPTY(&pf->fdir.fdir_list)) {

Should be if (!ret && TAILQ_EMPTY(&pf->fdir.fdir_list)) here?

> +			i40e_fdir_teardown(pf);
> +			dev->data->dev_conf.fdir_conf.mode =
> +				   RTE_FDIR_MODE_NONE;
> +		}
>  		break;
>  	case RTE_ETH_FILTER_HASH:
>  		ret = i40e_config_rss_filter_del(dev, @@ -4900,6 +4923,8
> @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf)
>  			pf->fdir.inset_flag[pctype] = 0;
>  	}
> 
> +	i40e_fdir_teardown(pf);
> +
>  	return ret;
>  }
> 
> diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
> index b3f85b563..a73d120e3 100644
> --- a/examples/flow_filtering/main.c
> +++ b/examples/flow_filtering/main.c
> @@ -131,22 +131,6 @@ init_port(void)
>  				DEV_TX_OFFLOAD_SCTP_CKSUM  |
>  				DEV_TX_OFFLOAD_TCP_TSO,
>  		},
> -		/*
> -		 * Initialize fdir_conf of rte_eth_conf.
> -		 * Fdir is used in flow filtering for I40e,
> -		 * so rte_flow rules involve some fdir
> -		 * configurations. In long term it's better
> -		 * that drivers don't require any fdir
> -		 * configuration for rte_flow, but we need to
> -		 * get this workaround so that sample app can
> -		 * run on I40e.
> -		 */
> -		.fdir_conf = {
> -			.mode = RTE_FDIR_MODE_PERFECT,
> -			.pballoc = RTE_FDIR_PBALLOC_64K,
> -			.status = RTE_FDIR_REPORT_STATUS,
> -			.drop_queue = 127,
> -		},
>  	};
>  	struct rte_eth_txconf txq_conf;
>  	struct rte_eth_rxconf rxq_conf;
> --
> 2.17.1

  reply	other threads:[~2018-09-29  8:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-28  7:24 [dpdk-dev] [PATCH] " Xiaoyun Li
2018-09-28  8:40 ` Xing, Beilei
2018-09-28 10:38   ` Li, Xiaoyun
2018-09-28 11:03 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
2018-09-29  8:36   ` Xing, Beilei [this message]
2018-09-29  8:40     ` Li, Xiaoyun
2018-09-29  8:44 ` [dpdk-dev] [PATCH v3] " Xiaoyun Li
2018-09-30  2:08 ` [dpdk-dev] [PATCH v4] net/i40e: config fdir automatically Xiaoyun Li
2018-09-30  2:29 ` [dpdk-dev] [PATCH v5] " Xiaoyun Li
2018-09-30  2:41   ` Xing, Beilei
2018-09-30  3:31     ` Zhang, Qi Z

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=94479800C636CB44BD422CB454846E013224C3C2@SHSMSX101.ccr.corp.intel.com \
    --to=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=xiaoyun.li@intel.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).