From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 0E053FAE8 for ; Tue, 20 Dec 2016 10:38:24 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id f82so124962131wmf.1 for ; Tue, 20 Dec 2016 01:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Ek++rxrCIuIUbnXLOFUmjvvZPrgnod8R9ZDlIyHV2Bw=; b=bHPSR0QwktiymbWNNoJPO+F8xSzthoW022Uvhf+fgEf78h30noeErgQFZLD8m74ZNH XWLnyS6qrMpUKRubJD3vC1T4kJT4hOuW2DT0FfNM2gs/Mhmz8xCPH003B+trWZBYTbzu ayshVLy1LlyOc4LVAn2DvKpQUPK7qL4lKqlIklbcBM51EnI9Dp0sqVbkQub6/+RVGTOR bZ66UucT/HB9VXHjmHqf1Q/oLGEX4zPdQC1Av1APmJ0NN9ANmcbLWgmS3dBZIvAPG9Ow olypWcd5x4DGjEzIOqD2ZB+lLufjYBmXXE+YtZnLxKYb/3umcPhjKBO7BLWA/C2ZaU8N nUYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ek++rxrCIuIUbnXLOFUmjvvZPrgnod8R9ZDlIyHV2Bw=; b=SwLoJqG1DJcjtPXpKK7C7sgOG4z1GF4LkmskpIN3FiiN4NhHKmPLW9ygaAcIQfL3Rl h0aqfah8MSOjx9u4MrmEcFHGx3Me4JNwnLjIGaYELQDukwQ65Wg6zchiGBqUvla2yWw2 kwWekYhVy8YK2IcEO7EUy1eolsfcr3kI4j9uroNMKXIAYyY6o/vB1/kb20JWeo7seysj 4aN9XV4zGa9t5HVn8BxOxJZpgebtQZJsKT56eElwMg4Zbn37YU4EPrWFMFWxLCqIKKAz mLpbw/ZrdCUlhfEZvL9MesQhTigquvP2RCBbGUtzL/bJ33CpwzcXssdj4VrlOJlZf4FD TBgA== X-Gm-Message-State: AIkVDXJ5RfN2k7QyeJ7SU95PFZjLByAqK+4QO/tf90knm8B5E+CnmW4N7O+c+eUn8zgCIUjG X-Received: by 10.28.129.209 with SMTP id c200mr998889wmd.53.1482226703780; Tue, 20 Dec 2016 01:38:23 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id d10sm24586586wja.20.2016.12.20.01.38.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2016 01:38:22 -0800 (PST) Date: Tue, 20 Dec 2016 10:38:15 +0100 From: Adrien Mazarguil To: "Xing, Beilei" Cc: "dev@dpdk.org" , "Pei, Yulong" Message-ID: <20161220093815.GO10340@6wind.com> References: <3318a43c9e105caaf4d5b13d6e4fcce774fb522f.1481903839.git.adrien.mazarguil@6wind.com> <94479800C636CB44BD422CB454846E013157433C@SHSMSX101.ccr.corp.intel.com> <20161219101943.GJ10340@6wind.com> <94479800C636CB44BD422CB454846E0131574785@SHSMSX101.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94479800C636CB44BD422CB454846E0131574785@SHSMSX101.ccr.corp.intel.com> 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: Tue, 20 Dec 2016 09:38:24 -0000 On Tue, Dec 20, 2016 at 01:57:46AM +0000, Xing, Beilei wrote: > > -----Original Message----- > > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > > Sent: Monday, December 19, 2016 6:20 PM > > To: Xing, Beilei > > Cc: dev@dpdk.org; Pei, Yulong > > Subject: Re: [dpdk-dev] [PATCH v2 06/25] app/testpmd: implement basic > > support for rte_flow > > > > Hi Beilei, > > > > On Mon, Dec 19, 2016 at 08:37:20AM +0000, Xing, Beilei wrote: > > > 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 > > > > > > > > Add basic management functions for the generic flow API (validate, > > > > create, destroy, flush, query and list). Flow rule objects and > > > > properties are arranged in lists associated with each port. > > > > > > > > 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, > > > sizeof(struct rte_flow_error)); Since both cause and message may be NULL > > regardless of the error type, if there's no error.cause and error.message > > returned from PMD, Segmentation fault will happen in port_flow_complain. > > > PS: This issue doesn't happen if add "export EXTRA_CFLAGS=' -g O0'" when > > compiling. > > > > Actually, PMDs must fill the error structure only in case of error if the > > application provides one, it's not optional. I didn't initialize this structure for > > this reason. > > > > I suggest we initialize it with a known poisoning value for debugging purposes > > though, to make it fail every time. Does it sound reasonable? Done for v3 by the way. > OK, I see. Do you want PMD to allocate the memory for cause and message of error, and must fill the cause and message if error exists, right? > So is it possible to set NULL for pointers of cause and message in application? then PMD can judge if it's need to allocate or overlap memory. PMDs never allocate this structure, applications do and initialize it however they want. They only provide a non-NULL pointer if they want additional details in case of error. It will likely be allocated on the stack in most cases (as in testpmd). >>From a PMD standpoint, the contents of this structure must be updated in case of non-NULL pointer and error state. Now the message pointer can be allocated dynamically but it's not recommended, it's far easier to make it point to some constant string. Applications won't free it anyway, so PMDs would have to do it during dev_close(). Please see "Verbose error reporting" documentation section. -- Adrien Mazarguil 6WIND