From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tan, Jianfeng" Subject: Re: [PATCH 01/12] ethdev: add API to query what/if packet type is set Date: Mon, 11 Jan 2016 15:39:08 +0800 Message-ID: <56935C1C.4040900@intel.com> References: <20160104113814.GT3806@6wind.com> <2601191342CEEE43887BDE71AB97725836AE1002@irsmsx105.ger.corp.intel.com> <20160105161423.GE4712@autoinstall.dev.6wind.com> <2601191342CEEE43887BDE71AB97725836AE18E3@irsmsx105.ger.corp.intel.com> <20160106100053.GJ12095@6wind.com> <2601191342CEEE43887BDE71AB97725836AE1B46@irsmsx105.ger.corp.intel.com> <20160106154438.GP12095@6wind.com> <2601191342CEEE43887BDE71AB97725836AE2DBC@irsmsx105.ger.corp.intel.com> <20160106172248.GT12095@6wind.com> <2601191342CEEE43887BDE71AB97725836AE2F5B@irsmsx105.ger.corp.intel.com> <20160107133227.GU12095@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: "Ananyev, Konstantin" , =?UTF-8?Q?N=c3=a9lio_Laranjeiro?= , "dev@dpdk.org" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 08B465A6B for ; Mon, 11 Jan 2016 08:39:10 +0100 (CET) In-Reply-To: <20160107133227.GU12095@6wind.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, According to the proposal, I'm going to fix the definition of this API as below: /** * Retrieve the contextual information of an Ethernet device. * * @param port_id * The port identifier of the Ethernet device. * @param ptype_mask * A hint of what kind of packet type which the caller is interested in * @param ptypes * An array of packet types to be filled with * @param num * Size of ptypes[] * @return * - (>=0) if successful. Indicate number of valid values in ptypes array. * - (-ENOTSUP) if hardware-assisted VLAN stripping not configured. * - (-ENODEV) if *port_id* invalid. */ extern int rte_eth_dev_get_ptype_info(uint8_t port_id, uint32_t ptype_mask, uint32_t ptypes[], uint32_t num); Unresolved issues: 1) When num is exceeded, we just stop there and return num, or return -ENOMEM? The first way has a bug when: what app is exactly asking for is not filled in ptypes[] because of exceeding num, but app believes this API returns with success. 2) if RTE_PTYPE_*_MAX_NUM macros necessary? Without them, we could calculate num through 2^(number of bit 1 in RTE_PTPE_*_MASK). Thanks, Jianfeng