From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 659352BF4 for ; Tue, 2 Oct 2018 10:02:05 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Oct 2018 01:02:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,331,1534834800"; d="scan'208";a="95258981" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by fmsmga001.fm.intel.com with ESMTP; 02 Oct 2018 01:01:47 -0700 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.248]) by irsmsx110.ger.corp.intel.com ([169.254.15.182]) with mapi id 14.03.0319.002; Tue, 2 Oct 2018 09:01:47 +0100 From: "Singh, Jasvinder" To: "Pattan, Reshma" , "dev@dpdk.org" , "Dumitrescu, Cristian" Thread-Topic: [PATCH] net/softnic: add flow flush API Thread-Index: AQHUWaU1dpUp7UUVFk+J5mfbzRFG+6UK+BLw Date: Tue, 2 Oct 2018 08:01:47 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D3362859E@IRSMSX103.ger.corp.intel.com> References: <1538411914-12721-1-git-send-email-reshma.pattan@intel.com> In-Reply-To: <1538411914-12721-1-git-send-email-reshma.pattan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmEyYjE2OTctMTMxNC00YjRiLTlmZDQtNTlmMGJlYmM5NDBlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaFN1SncyV3lnYjZVajFxVGRIOHYrK3ZESm9NbVphSFE2ZlpVb2RLdXBZY3l3SGc5STVOZU1FNnhQMDAzUkM4bSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/softnic: add flow flush API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Oct 2018 08:02:06 -0000 > --- 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; > } >=20 > +static int > +pmd_flow_flush(struct rte_eth_dev *dev, > + struct rte_flow_error *error) > +{ > + struct pmd_internals *softnic =3D dev->data->dev_private; > + struct pipeline *pipeline; > + int status; > + uint32_t i =3D 0; > + > + TAILQ_FOREACH(pipeline, &softnic->pipeline_list, node) { Removing elements when iterating tailq lists with TAILQ_FOREACH macro is no= t safe. Instead, use TAILQ_FOREACH_SAFE for safe tailq element removal within the = loop. > + /* Remove all the flows added to the tables. */ > + for (i =3D 0; i < pipeline->n_tables; i++) { > + struct softnic_table *table; > + struct rte_flow *flow; > + > + table =3D &pipeline->table[i]; > + TAILQ_FOREACH(flow, &table->flows, node) { > + /* Rule delete. */ > + status =3D 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 =3D { > .validate =3D pmd_flow_validate, > .create =3D pmd_flow_create, > .destroy =3D pmd_flow_destroy, > - .flush =3D NULL, > + .flush =3D pmd_flow_flush, > .query =3D pmd_flow_query, > .isolate =3D NULL, > }; > -- > 2.17.1