[dpdk-dev] [PATCH v5 01/11] ethdev: add API to query packet type filling info

2016-03-01 Thread Tan, Jianfeng


On 3/1/2016 2:29 PM, Panu Matilainen wrote:
> On 02/29/2016 06:41 PM, Tan, Jianfeng wrote:
>> Hi Panu,
>>
>> On 2/29/2016 7:34 PM, Panu Matilainen wrote:
> [...]
>>>
>>> More importantly, to export a function you need to add an entry for it
>>> in rte_ether_version.map.
>>
>> Oh, yes, thanks for pointing out this, I'll change this and update
>> rte_ether_version.map.
>>
>> Is it like this? Before or after DPDK_2.2 {}?
>> DPDK_2.3 {
>>  global:
>>
>>  rte_eth_dev_get_ptype_info;
>>
>>  local: *;
>> };
>
> Sorry I didn't have a chance to reply to this yesterday and I see you 
> already posted a v6 with the above, which is almost but not quite 
> there: it needs to inherit from DPDK_2.2, ie
>
> DPDK_2.3 {
>  global:
>
>  rte_eth_dev_get_ptype_info;
>
>  local: *;
> } DPDK_2.2;
>
> ...but if there are no other reasons to respin the series perhaps 
> Thomas can fixup that while applying.

OK, thanks. Should I add this new API into _API Changes_ section in 
doc/guides/rel_notes/release_16_04.rst?

>
> Then there's the actual version, which should optimally be DPDK_16.04 
> but that's purely cosmetical. There are a number of patches floating 
> around with DPDK_2.3 {} and librte_eal actually has one on board, so 
> clearly the dust from versioning change has not yet settled.

Maybe Thomas can give some advice here? DPDK_2.3 or DPDK_16.04 be used here?

Thanks,
Jianfeng

>
> - Panu -
>
>>
>> Thanks,
>> Jianfeng
>>
>>>
>>> - Panu -
>>>
>>>
>>
>



[dpdk-dev] [PATCH v5 01/11] ethdev: add API to query packet type filling info

2016-03-01 Thread Thomas Monjalon
2016-03-01 08:29, Panu Matilainen:
> DPDK_2.3 {
>   global:
> 
>   rte_eth_dev_get_ptype_info;
> 
>   local: *;
> } DPDK_2.2;
> 
> ...but if there are no other reasons to respin the series perhaps Thomas 
> can fixup that while applying.
> 
> Then there's the actual version, which should optimally be DPDK_16.04 
> but that's purely cosmetical. There are a number of patches floating 
> around with DPDK_2.3 {} and librte_eal actually has one on board, so 
> clearly the dust from versioning change has not yet settled.

Yes it must be 16.04.
I've just sent a patch for EAL:
http://dpdk.org/ml/archives/dev/2016-March/034266.html
Thanks


[dpdk-dev] [PATCH v5 01/11] ethdev: add API to query packet type filling info

2016-03-01 Thread Panu Matilainen
On 02/29/2016 06:41 PM, Tan, Jianfeng wrote:
> Hi Panu,
>
> On 2/29/2016 7:34 PM, Panu Matilainen wrote:
[...]
>>
>> More importantly, to export a function you need to add an entry for it
>> in rte_ether_version.map.
>
> Oh, yes, thanks for pointing out this, I'll change this and update
> rte_ether_version.map.
>
> Is it like this? Before or after DPDK_2.2 {}?
> DPDK_2.3 {
>  global:
>
>  rte_eth_dev_get_ptype_info;
>
>  local: *;
> };

Sorry I didn't have a chance to reply to this yesterday and I see you 
already posted a v6 with the above, which is almost but not quite there: 
it needs to inherit from DPDK_2.2, ie

DPDK_2.3 {
  global:

  rte_eth_dev_get_ptype_info;

  local: *;
} DPDK_2.2;

...but if there are no other reasons to respin the series perhaps Thomas 
can fixup that while applying.

Then there's the actual version, which should optimally be DPDK_16.04 
but that's purely cosmetical. There are a number of patches floating 
around with DPDK_2.3 {} and librte_eal actually has one on board, so 
clearly the dust from versioning change has not yet settled.

- Panu -

>
> Thanks,
> Jianfeng
>
>>
>> - Panu -
>>
>>
>



[dpdk-dev] [PATCH v5 01/11] ethdev: add API to query packet type filling info

2016-03-01 Thread Tan, Jianfeng
Hi Panu,

On 2/29/2016 7:34 PM, Panu Matilainen wrote:
> On 02/26/2016 09:34 AM, Jianfeng Tan wrote:
>> Add a new API rte_eth_dev_get_ptype_info to query whether/what packet
>> type can be filled by given pmd rx burst function.
>>
>> Signed-off-by: Jianfeng Tan 
>> ---
>>   lib/librte_ether/rte_ethdev.c | 26 ++
>>   lib/librte_ether/rte_ethdev.h | 26 ++
>>   2 files changed, 52 insertions(+)
>>
> [...]
>> diff --git a/lib/librte_ether/rte_ethdev.h 
>> b/lib/librte_ether/rte_ethdev.h
>> index 16da821..16f32a0 100644
>> --- a/lib/librte_ether/rte_ethdev.h
>> +++ b/lib/librte_ether/rte_ethdev.h
>> @@ -1021,6 +1021,9 @@ typedef void (*eth_dev_infos_get_t)(struct 
>> rte_eth_dev *dev,
>>   struct rte_eth_dev_info *dev_info);
>>   /**< @internal Get specific informations of an Ethernet device. */
>>
>> +typedef const uint32_t *(*eth_dev_ptype_info_get_t)(struct 
>> rte_eth_dev *dev);
>> +/**< @internal Get ptype info of eth_rx_burst_t. */
>> +
>>   typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
>>   uint16_t queue_id);
>>   /**< @internal Start rx and tx of a queue of an Ethernet device. */
>> @@ -1347,6 +1350,7 @@ struct eth_dev_ops {
>>   eth_queue_stats_mapping_set_t queue_stats_mapping_set;
>>   /**< Configure per queue stat counter mapping. */
>>   eth_dev_infos_get_tdev_infos_get; /**< Get device info. */
>> +eth_dev_ptype_info_get_t   dev_ptype_info_get; /** Get ptype 
>> info */
>>   mtu_set_t  mtu_set; /**< Set MTU. */
>>   vlan_filter_set_t  vlan_filter_set;  /**< Filter VLAN 
>> Setup. */
>>   vlan_tpid_set_tvlan_tpid_set;  /**< Outer VLAN 
>> TPID Setup. */
>> @@ -2268,6 +2272,28 @@ void rte_eth_macaddr_get(uint8_t port_id, 
>> struct ether_addr *mac_addr);
>
> Technically this is an ABI break but its marked internal and I guess 
> it falls into the "drivers only" territory similar to what was 
> discussed in this thead: 
> http://dpdk.org/ml/archives/dev/2016-January/032348.html so its 
> probably ok.

Yes, I think so too.

>
>>   void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info 
>> *dev_info);
>>
>>   /**
>> + * Retrieve the packet type 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 pointer to store adequent packet types, allocated by 
>> caller.
>> + * @param num
>> + *  Size of the array pointed by param ptypes.
>> + * @return
>> + *   - (>0) Number of ptypes supported. If it exceeds param num, 
>> exceeding
>> + *  packet types will not be filled in the given array.
>> + *   - (0 or -ENOTSUP) if PMD does not fill the specified ptype.
>> + *   - (-ENODEV) if *port_id* invalid.
>> + */
>> +extern int rte_eth_dev_get_ptype_info(uint8_t port_id,
>> +  uint32_t ptype_mask,
>> +  uint32_t *ptypes,
>> +  int num);
>> +
>> +/**
>>* Retrieve the MTU of an Ethernet device.
>>*
>>* @param port_id
>>
>
> "extern" is redundant in headers. We just saw a round of removing them 
> (commit dd34ff1f0e03b2c5e4a97e9fbcba5c8238aac573), lets not add them 
> back :)
>
> More importantly, to export a function you need to add an entry for it 
> in rte_ether_version.map.

Oh, yes, thanks for pointing out this, I'll change this and update 
rte_ether_version.map.

Is it like this? Before or after DPDK_2.2 {}?
DPDK_2.3 {
 global:

 rte_eth_dev_get_ptype_info;

 local: *;
};

Thanks,
Jianfeng

>
> - Panu -
>
>



[dpdk-dev] [PATCH v5 01/11] ethdev: add API to query packet type filling info

2016-02-29 Thread Panu Matilainen
On 02/26/2016 09:34 AM, Jianfeng Tan wrote:
> Add a new API rte_eth_dev_get_ptype_info to query whether/what packet
> type can be filled by given pmd rx burst function.
>
> Signed-off-by: Jianfeng Tan 
> ---
>   lib/librte_ether/rte_ethdev.c | 26 ++
>   lib/librte_ether/rte_ethdev.h | 26 ++
>   2 files changed, 52 insertions(+)
>
[...]
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 16da821..16f32a0 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -1021,6 +1021,9 @@ typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev 
> *dev,
>   struct rte_eth_dev_info *dev_info);
>   /**< @internal Get specific informations of an Ethernet device. */
>
> +typedef const uint32_t *(*eth_dev_ptype_info_get_t)(struct rte_eth_dev *dev);
> +/**< @internal Get ptype info of eth_rx_burst_t. */
> +
>   typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
>   uint16_t queue_id);
>   /**< @internal Start rx and tx of a queue of an Ethernet device. */
> @@ -1347,6 +1350,7 @@ struct eth_dev_ops {
>   eth_queue_stats_mapping_set_t queue_stats_mapping_set;
>   /**< Configure per queue stat counter mapping. */
>   eth_dev_infos_get_tdev_infos_get; /**< Get device info. */
> + eth_dev_ptype_info_get_t   dev_ptype_info_get; /** Get ptype info */
>   mtu_set_t  mtu_set; /**< Set MTU. */
>   vlan_filter_set_t  vlan_filter_set;  /**< Filter VLAN Setup. */
>   vlan_tpid_set_tvlan_tpid_set;  /**< Outer VLAN TPID 
> Setup. */
> @@ -2268,6 +2272,28 @@ void rte_eth_macaddr_get(uint8_t port_id, struct 
> ether_addr *mac_addr);

Technically this is an ABI break but its marked internal and I guess it 
falls into the "drivers only" territory similar to what was discussed in 
this thead: http://dpdk.org/ml/archives/dev/2016-January/032348.html so 
its probably ok.

>   void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info 
> *dev_info);
>
>   /**
> + * Retrieve the packet type 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 pointer to store adequent packet types, allocated by caller.
> + * @param num
> + *  Size of the array pointed by param ptypes.
> + * @return
> + *   - (>0) Number of ptypes supported. If it exceeds param num, exceeding
> + *  packet types will not be filled in the given array.
> + *   - (0 or -ENOTSUP) if PMD does not fill the specified ptype.
> + *   - (-ENODEV) if *port_id* invalid.
> + */
> +extern int rte_eth_dev_get_ptype_info(uint8_t port_id,
> +   uint32_t ptype_mask,
> +   uint32_t *ptypes,
> +   int num);
> +
> +/**
>* Retrieve the MTU of an Ethernet device.
>*
>* @param port_id
>

"extern" is redundant in headers. We just saw a round of removing them 
(commit dd34ff1f0e03b2c5e4a97e9fbcba5c8238aac573), lets not add them back :)

More importantly, to export a function you need to add an entry for it 
in rte_ether_version.map.

- Panu -




[dpdk-dev] [PATCH v5 01/11] ethdev: add API to query packet type filling info

2016-02-26 Thread Jianfeng Tan
Add a new API rte_eth_dev_get_ptype_info to query whether/what packet
type can be filled by given pmd rx burst function.

Signed-off-by: Jianfeng Tan 
---
 lib/librte_ether/rte_ethdev.c | 26 ++
 lib/librte_ether/rte_ethdev.h | 26 ++
 2 files changed, 52 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 1257965..66dc7c5 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1576,6 +1576,32 @@ rte_eth_dev_info_get(uint8_t port_id, struct 
rte_eth_dev_info *dev_info)
dev_info->driver_name = dev->data->drv_name;
 }

+int
+rte_eth_dev_get_ptype_info(uint8_t port_id, uint32_t ptype_mask,
+  uint32_t *ptypes, int num)
+{
+   int i, j;
+   struct rte_eth_dev *dev;
+   const uint32_t *all_ptypes;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+   dev = _eth_devices[port_id];
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_ptype_info_get, -ENOTSUP);
+   all_ptypes = (*dev->dev_ops->dev_ptype_info_get)(dev);
+
+   if (!all_ptypes)
+   return 0;
+
+   for (i = 0, j = 0; all_ptypes[i] != RTE_PTYPE_UNKNOWN; ++i)
+   if (all_ptypes[i] & ptype_mask) {
+   if (j < num)
+   ptypes[j] = all_ptypes[i];
+   j++;
+   }
+
+   return j;
+}
+
 void
 rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr)
 {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 16da821..16f32a0 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1021,6 +1021,9 @@ typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev 
*dev,
struct rte_eth_dev_info *dev_info);
 /**< @internal Get specific informations of an Ethernet device. */

+typedef const uint32_t *(*eth_dev_ptype_info_get_t)(struct rte_eth_dev *dev);
+/**< @internal Get ptype info of eth_rx_burst_t. */
+
 typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
uint16_t queue_id);
 /**< @internal Start rx and tx of a queue of an Ethernet device. */
@@ -1347,6 +1350,7 @@ struct eth_dev_ops {
eth_queue_stats_mapping_set_t queue_stats_mapping_set;
/**< Configure per queue stat counter mapping. */
eth_dev_infos_get_tdev_infos_get; /**< Get device info. */
+   eth_dev_ptype_info_get_t   dev_ptype_info_get; /** Get ptype info */
mtu_set_t  mtu_set; /**< Set MTU. */
vlan_filter_set_t  vlan_filter_set;  /**< Filter VLAN Setup. */
vlan_tpid_set_tvlan_tpid_set;  /**< Outer VLAN TPID 
Setup. */
@@ -2268,6 +2272,28 @@ void rte_eth_macaddr_get(uint8_t port_id, struct 
ether_addr *mac_addr);
 void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info);

 /**
+ * Retrieve the packet type 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 pointer to store adequent packet types, allocated by caller.
+ * @param num
+ *  Size of the array pointed by param ptypes.
+ * @return
+ *   - (>0) Number of ptypes supported. If it exceeds param num, exceeding
+ *  packet types will not be filled in the given array.
+ *   - (0 or -ENOTSUP) if PMD does not fill the specified ptype.
+ *   - (-ENODEV) if *port_id* invalid.
+ */
+extern int rte_eth_dev_get_ptype_info(uint8_t port_id,
+ uint32_t ptype_mask,
+ uint32_t *ptypes,
+ int num);
+
+/**
  * Retrieve the MTU of an Ethernet device.
  *
  * @param port_id
-- 
2.1.4