diff mbox

[PATCHv2] api: implement odp_pktio_name

Message ID 1421155043-7257-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Jan. 13, 2015, 1:17 p.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 v2: fix doxygen header

 platform/linux-generic/include/api/odp_packet_io.h | 13 +++++++++++++
 platform/linux-generic/odp_packet_io.c             | 11 +++++++++++
 2 files changed, 24 insertions(+)

Comments

Mike Holmes Jan. 13, 2015, 2:58 p.m. UTC | #1
I think we all agreed that new APIs must come with a validation test.

The description need to explain why we need this API  so it makes sense in
the git log.
As Ola D pointed out, as a user you really need the git history to be
descriptive when moving between ODP versions.

On 13 January 2015 at 08:17, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>  v2: fix doxygen header
>
>  platform/linux-generic/include/api/odp_packet_io.h | 13 +++++++++++++
>  platform/linux-generic/odp_packet_io.c             | 11 +++++++++++
>  2 files changed, 24 insertions(+)
>
> diff --git a/platform/linux-generic/include/api/odp_packet_io.h
> b/platform/linux-generic/include/api/odp_packet_io.h
> index 0c34f29..c0ced4f 100644
> --- a/platform/linux-generic/include/api/odp_packet_io.h
> +++ b/platform/linux-generic/include/api/odp_packet_io.h
> @@ -169,6 +169,19 @@ size_t odp_pktio_mac_addr(odp_pktio_t id, void
> *mac_addr,
>                           size_t addr_size);
>
>  /**
> + * Packet IO interface name
> + *
> + * Return the interface name from a pktio handle. This is the
> + * name that was passed to the odp_pktio_open() call.
> + *
> + * @param id ODP Packet IO handle.
> + *
> + * @retval Pointer to the interface name.
> + * @retval NULL if packet handle is invalid.
> + */
> +const char *odp_pktio_name(odp_pktio_t id);
> +
> +/**
>   * @}
>   */
>
> diff --git a/platform/linux-generic/odp_packet_io.c
> b/platform/linux-generic/odp_packet_io.c
> index cd109d2..7b08edf 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -746,3 +746,14 @@ size_t odp_pktio_mac_addr(odp_pktio_t id, void
> *mac_addr,
>
>         return ETH_ALEN;
>  }
> +
> +const char *odp_pktio_name(odp_pktio_t id)
> +{
> +       pktio_entry_t *entry;
> +
> +       entry = get_pktio_entry(id);
> +       if (entry == NULL)
> +               return NULL;
> +
> +       return entry->s.name;
> +}
> --
> 1.8.5.1.163.gd7aced9
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Anders Roxell Jan. 13, 2015, 3:02 p.m. UTC | #2
On 13 January 2015 at 15:58, Mike Holmes <mike.holmes@linaro.org> wrote:
>  I think we all agreed that new APIs must come with a validation test.

+1

>
> The description need to explain why we need this API  so it makes sense in
> the git log.
> As Ola D pointed out, as a user you really need the git history to be
> descriptive when moving between ODP versions.

+1

>
> On 13 January 2015 at 08:17, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>> ---
>>  v2: fix doxygen header
>>
>>  platform/linux-generic/include/api/odp_packet_io.h | 13 +++++++++++++
>>  platform/linux-generic/odp_packet_io.c             | 11 +++++++++++
>>  2 files changed, 24 insertions(+)
>>
>> diff --git a/platform/linux-generic/include/api/odp_packet_io.h
>> b/platform/linux-generic/include/api/odp_packet_io.h
>> index 0c34f29..c0ced4f 100644
>> --- a/platform/linux-generic/include/api/odp_packet_io.h
>> +++ b/platform/linux-generic/include/api/odp_packet_io.h
>> @@ -169,6 +169,19 @@ size_t odp_pktio_mac_addr(odp_pktio_t id, void
>> *mac_addr,
>>                           size_t addr_size);
>>
>>  /**
>> + * Packet IO interface name
>> + *
>> + * Return the interface name from a pktio handle. This is the
>> + * name that was passed to the odp_pktio_open() call.
>> + *
>> + * @param id ODP Packet IO handle.
>> + *
>> + * @retval Pointer to the interface name.
>> + * @retval NULL if packet handle is invalid.
>> + */
>> +const char *odp_pktio_name(odp_pktio_t id);
>> +
>> +/**
>>   * @}
>>   */
>>
>> diff --git a/platform/linux-generic/odp_packet_io.c
>> b/platform/linux-generic/odp_packet_io.c
>> index cd109d2..7b08edf 100644
>> --- a/platform/linux-generic/odp_packet_io.c
>> +++ b/platform/linux-generic/odp_packet_io.c
>> @@ -746,3 +746,14 @@ size_t odp_pktio_mac_addr(odp_pktio_t id, void
>> *mac_addr,
>>
>>         return ETH_ALEN;
>>  }
>> +
>> +const char *odp_pktio_name(odp_pktio_t id)
>> +{
>> +       pktio_entry_t *entry;
>> +
>> +       entry = get_pktio_entry(id);
>> +       if (entry == NULL)
>> +               return NULL;
>> +
>> +       return entry->s.name;
>> +}
>> --
>> 1.8.5.1.163.gd7aced9
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> --
> Mike Holmes
> Linaro  Sr Technical Manager
> LNG - ODP
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov Jan. 13, 2015, 3:31 p.m. UTC | #3
On 01/13/2015 06:02 PM, Anders Roxell wrote:
> On 13 January 2015 at 15:58, Mike Holmes <mike.holmes@linaro.org> wrote:
>>   I think we all agreed that new APIs must come with a validation test.
> +1
>
>> The description need to explain why we need this API  so it makes sense in
>> the git log.
>> As Ola D pointed out, as a user you really need the git history to be
>> descriptive when moving between ODP versions.
> +1
>

And why do we need this api? Debug?

Maxim.

>> On 13 January 2015 at 08:17, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>>> ---
>>>   v2: fix doxygen header
>>>
>>>   platform/linux-generic/include/api/odp_packet_io.h | 13 +++++++++++++
>>>   platform/linux-generic/odp_packet_io.c             | 11 +++++++++++
>>>   2 files changed, 24 insertions(+)
>>>
>>> diff --git a/platform/linux-generic/include/api/odp_packet_io.h
>>> b/platform/linux-generic/include/api/odp_packet_io.h
>>> index 0c34f29..c0ced4f 100644
>>> --- a/platform/linux-generic/include/api/odp_packet_io.h
>>> +++ b/platform/linux-generic/include/api/odp_packet_io.h
>>> @@ -169,6 +169,19 @@ size_t odp_pktio_mac_addr(odp_pktio_t id, void
>>> *mac_addr,
>>>                            size_t addr_size);
>>>
>>>   /**
>>> + * Packet IO interface name
>>> + *
>>> + * Return the interface name from a pktio handle. This is the
>>> + * name that was passed to the odp_pktio_open() call.
>>> + *
>>> + * @param id ODP Packet IO handle.
>>> + *
>>> + * @retval Pointer to the interface name.
>>> + * @retval NULL if packet handle is invalid.
>>> + */
>>> +const char *odp_pktio_name(odp_pktio_t id);
>>> +
>>> +/**
>>>    * @}
>>>    */
>>>
>>> diff --git a/platform/linux-generic/odp_packet_io.c
>>> b/platform/linux-generic/odp_packet_io.c
>>> index cd109d2..7b08edf 100644
>>> --- a/platform/linux-generic/odp_packet_io.c
>>> +++ b/platform/linux-generic/odp_packet_io.c
>>> @@ -746,3 +746,14 @@ size_t odp_pktio_mac_addr(odp_pktio_t id, void
>>> *mac_addr,
>>>
>>>          return ETH_ALEN;
>>>   }
>>> +
>>> +const char *odp_pktio_name(odp_pktio_t id)
>>> +{
>>> +       pktio_entry_t *entry;
>>> +
>>> +       entry = get_pktio_entry(id);
>>> +       if (entry == NULL)
>>> +               return NULL;
>>> +
>>> +       return entry->s.name;
>>> +}
>>> --
>>> 1.8.5.1.163.gd7aced9
>>>
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>> --
>> Mike Holmes
>> Linaro  Sr Technical Manager
>> LNG - ODP
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h
index 0c34f29..c0ced4f 100644
--- a/platform/linux-generic/include/api/odp_packet_io.h
+++ b/platform/linux-generic/include/api/odp_packet_io.h
@@ -169,6 +169,19 @@  size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr,
 			  size_t addr_size);
 
 /**
+ * Packet IO interface name
+ *
+ * Return the interface name from a pktio handle. This is the
+ * name that was passed to the odp_pktio_open() call.
+ *
+ * @param id ODP Packet IO handle.
+ *
+ * @retval Pointer to the interface name.
+ * @retval NULL if packet handle is invalid.
+ */
+const char *odp_pktio_name(odp_pktio_t id);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index cd109d2..7b08edf 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -746,3 +746,14 @@  size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr,
 
 	return ETH_ALEN;
 }
+
+const char *odp_pktio_name(odp_pktio_t id)
+{
+	pktio_entry_t *entry;
+
+	entry = get_pktio_entry(id);
+	if (entry == NULL)
+		return NULL;
+
+	return entry->s.name;
+}