DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Singh, Jasvinder" <jasvinder.singh@intel.com>
To: "Pattan, Reshma" <reshma.pattan@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	 "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
Subject: Re: [dpdk-dev] [PATCH] net/softnic: add flow flush API
Date: Tue, 2 Oct 2018 08:01:47 +0000	[thread overview]
Message-ID: <54CBAA185211B4429112C315DA58FF6D3362859E@IRSMSX103.ger.corp.intel.com> (raw)
In-Reply-To: <1538411914-12721-1-git-send-email-reshma.pattan@intel.com>



<snip>
> --- a/drivers/net/softnic/rte_eth_softnic_flow.c
> +++ b/drivers/net/softnic/rte_eth_softnic_flow.c
> @@ -1915,6 +1915,50 @@ pmd_flow_destroy(struct rte_eth_dev *dev,
>  	return 0;
>  }
> 
> +static int
> +pmd_flow_flush(struct rte_eth_dev *dev,
> +	struct rte_flow_error *error)
> +{
> +	struct pmd_internals *softnic = dev->data->dev_private;
> +	struct pipeline *pipeline;
> +	int status;
> +	uint32_t i = 0;
> +
> +	TAILQ_FOREACH(pipeline, &softnic->pipeline_list, node) {

Removing elements when iterating tailq lists with TAILQ_FOREACH macro is not safe.
Instead, use TAILQ_FOREACH_SAFE  for safe tailq element removal within the loop.

> +		/* Remove all the flows added to the tables. */
> +		for (i = 0; i < pipeline->n_tables; i++) {
> +			struct softnic_table *table;
> +			struct rte_flow *flow;
> +
> +			table = &pipeline->table[i];
> +			TAILQ_FOREACH(flow, &table->flows, node) {
> +				/* Rule delete. */
> +				status = softnic_pipeline_table_rule_delete
> +						(softnic,
> +						flow->pipeline->name,
> +						flow->table_id,
> +						&flow->match);
> +				if (status)
> +					return rte_flow_error_set(error,
> +						EINVAL,
> +
> 	RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> +						NULL,
> +						"Pipeline table rule delete
> failed");
> +
> +			/* Update dependencies */
> +			if (is_meter_action_enable(softnic, table))
> +				flow_meter_owner_reset(softnic, flow);
Fix Indentation here.
> +				/* Flow delete. */
> +				TAILQ_REMOVE(&table->flows, flow, node);
> +				free(flow);
> +			}
> +		}
> +	}
> +
> +	return 0;
> +}
> +
>  static int
>  pmd_flow_query(struct rte_eth_dev *dev __rte_unused,
>  	struct rte_flow *flow,
> @@ -1971,7 +2015,7 @@ const struct rte_flow_ops pmd_flow_ops = {
>  	.validate = pmd_flow_validate,
>  	.create = pmd_flow_create,
>  	.destroy = pmd_flow_destroy,
> -	.flush = NULL,
> +	.flush = pmd_flow_flush,
>  	.query = pmd_flow_query,
>  	.isolate = NULL,
>  };
> --
> 2.17.1

  reply	other threads:[~2018-10-02  8:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01 16:38 Reshma Pattan
2018-10-02  8:01 ` Singh, Jasvinder [this message]
2018-10-02 14:27 ` [dpdk-dev] [PATCH v2] " Reshma Pattan
2018-10-08  9:10 ` [dpdk-dev] [PATCH v3] " Reshma Pattan
2018-10-08 10:27   ` Singh, Jasvinder
2018-10-08 10:35   ` Dumitrescu, Cristian
2018-10-08 15:10     ` Pattan, Reshma
2018-10-08 11:19 ` [dpdk-dev] [PATCH v4] " Reshma Pattan
2018-10-08 15:33   ` Dumitrescu, Cristian

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=54CBAA185211B4429112C315DA58FF6D3362859E@IRSMSX103.ger.corp.intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=reshma.pattan@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).