From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 9A36EB33E for ; Mon, 19 Dec 2016 09:37:25 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP; 19 Dec 2016 00:37:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,372,1477983600"; d="scan'208";a="41409105" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 19 Dec 2016 00:37:24 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 19 Dec 2016 00:37:22 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.97]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.9]) with mapi id 14.03.0248.002; Mon, 19 Dec 2016 16:37:20 +0800 From: "Xing, Beilei" To: Adrien Mazarguil , "dev@dpdk.org" CC: "Pei, Yulong" Thread-Topic: [dpdk-dev] [PATCH v2 06/25] app/testpmd: implement basic support for rte_flow Thread-Index: AQHSV7lWnYlRiP1Qk0yAoi1kidJ2E6EO60/Q Date: Mon, 19 Dec 2016 08:37:20 +0000 Message-ID: <94479800C636CB44BD422CB454846E013157433C@SHSMSX101.ccr.corp.intel.com> References: <3318a43c9e105caaf4d5b13d6e4fcce774fb522f.1481903839.git.adrien.mazarguil@6wind.com> In-Reply-To: <3318a43c9e105caaf4d5b13d6e4fcce774fb522f.1481903839.git.adrien.mazarguil@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 06/25] app/testpmd: implement basic support for rte_flow 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: Mon, 19 Dec 2016 08:37:26 -0000 Hi Adrien, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Adrien Mazarguil > Sent: Saturday, December 17, 2016 12:25 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v2 06/25] app/testpmd: implement basic > support for rte_flow >=20 > Add basic management functions for the generic flow API (validate, create= , > destroy, flush, query and list). Flow rule objects and properties are arr= anged > in lists associated with each port. >=20 > Signed-off-by: Adrien Mazarguil > +/** Create flow rule. */ > +int > +port_flow_create(portid_t port_id, > + const struct rte_flow_attr *attr, > + const struct rte_flow_item *pattern, > + const struct rte_flow_action *actions) { > + struct rte_flow *flow; > + struct rte_port *port; > + struct port_flow *pf; > + uint32_t id; > + struct rte_flow_error error; > + I think there should be memset for error here, e.g. memset(&error, 0, sizeo= f(struct rte_flow_error)); Since both cause and message may be NULL regardless of the error type, if t= here's no error.cause and error.message returned from PMD, Segmentation fau= lt will happen in port_flow_complain. PS: This issue doesn't happen if add "export EXTRA_CFLAGS=3D' -g O0'" when = compiling. Thanks Beilei > + flow =3D rte_flow_create(port_id, attr, pattern, actions, &error); > + if (!flow) > + return port_flow_complain(&error); > + port =3D &ports[port_id]; > + if (port->flow_list) { > + if (port->flow_list->id =3D=3D UINT32_MAX) { > + printf("Highest rule ID is already assigned, delete" > + " it first"); > + rte_flow_destroy(port_id, flow, NULL); > + return -ENOMEM; > + } > + id =3D port->flow_list->id + 1; > + } else > + id =3D 0; > + pf =3D port_flow_new(attr, pattern, actions); > + if (!pf) { > + int err =3D rte_errno; > + > + printf("Cannot allocate flow: %s\n", rte_strerror(err)); > + rte_flow_destroy(port_id, flow, NULL); > + return -err; > + } > + pf->next =3D port->flow_list; > + pf->id =3D id; > + pf->flow =3D flow; > + port->flow_list =3D pf; > + printf("Flow rule #%u created\n", pf->id); > + return 0; > +} > +