DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] Introduce if_index field to struct rte_eth_dev_info
@ 2014-01-08  9:46 Mats Liljegren
  2014-01-09  6:30 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Mats Liljegren @ 2014-01-08  9:46 UTC (permalink / raw)
  To: Thomas Monjalon, stephen; +Cc: dev

This field is intended for pcap to describe the name of the interface
as known to Linux. It is an interface index, but can be translated into
an interface name using if_indextoname() function.

When using pcap, interrupt affinity becomes important, and this field
gives the application a chance to ensure that interrupt affinity is set
to the lcore handling the device.

Signed-off-by: Mats Liljegren <mats.liljegren@enea.com>
---
 lib/librte_ether/rte_ethdev.c | 1 +
 lib/librte_ether/rte_ethdev.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 859ec92..38c1ea1 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1037,6 +1037,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct
rte_eth_dev_info *dev_info)
        /* Default device offload capabilities to zero */
        dev_info->rx_offload_capa = 0;
        dev_info->tx_offload_capa = 0;
+       dev_info->if_index = -1;
        FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
        (*dev->dev_ops->dev_infos_get)(dev, dev_info);
        dev_info->pci_dev = dev->pci_dev;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 302d378..5b80e5d 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -787,6 +787,7 @@ struct rte_eth_conf {
 struct rte_eth_dev_info {
        struct rte_pci_device *pci_dev; /**< Device PCI information. */
        const char *driver_name; /**< Device Driver name. */
+       int if_index; /**< Index to bounded host interface, or -1 if
none. Use if_indextoname() to translate into an interface name. */
        uint32_t min_rx_bufsize; /**< Minimum size of RX buffer. */
        uint32_t max_rx_pktlen; /**< Maximum configurable length of RX pkt. */
        uint16_t max_rx_queues; /**< Maximum number of RX queues. */
-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] Introduce if_index field to struct rte_eth_dev_info
  2014-01-08  9:46 [dpdk-dev] [PATCH 1/2] Introduce if_index field to struct rte_eth_dev_info Mats Liljegren
@ 2014-01-09  6:30 ` Stephen Hemminger
  2014-01-09  8:44   ` Mats Liljegren
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2014-01-09  6:30 UTC (permalink / raw)
  To: Mats Liljegren; +Cc: dev

Technically in Linux ifindex is unsigned 32 bit value. And 0 is
reserved as a marker.
Therefore why not use that semantic.

On Wed, Jan 8, 2014 at 1:46 AM, Mats Liljegren
<liljegren.mats2@gmail.com> wrote:
> This field is intended for pcap to describe the name of the interface
> as known to Linux. It is an interface index, but can be translated into
> an interface name using if_indextoname() function.
>
> When using pcap, interrupt affinity becomes important, and this field
> gives the application a chance to ensure that interrupt affinity is set
> to the lcore handling the device.
>
> Signed-off-by: Mats Liljegren <mats.liljegren@enea.com>
> ---
>  lib/librte_ether/rte_ethdev.c | 1 +
>  lib/librte_ether/rte_ethdev.h | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 859ec92..38c1ea1 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -1037,6 +1037,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct
> rte_eth_dev_info *dev_info)
>         /* Default device offload capabilities to zero */
>         dev_info->rx_offload_capa = 0;
>         dev_info->tx_offload_capa = 0;
> +       dev_info->if_index = -1;
>         FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
>         (*dev->dev_ops->dev_infos_get)(dev, dev_info);
>         dev_info->pci_dev = dev->pci_dev;
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 302d378..5b80e5d 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -787,6 +787,7 @@ struct rte_eth_conf {
>  struct rte_eth_dev_info {
>         struct rte_pci_device *pci_dev; /**< Device PCI information. */
>         const char *driver_name; /**< Device Driver name. */
> +       int if_index; /**< Index to bounded host interface, or -1 if
> none. Use if_indextoname() to translate into an interface name. */
>         uint32_t min_rx_bufsize; /**< Minimum size of RX buffer. */
>         uint32_t max_rx_pktlen; /**< Maximum configurable length of RX pkt. */
>         uint16_t max_rx_queues; /**< Maximum number of RX queues. */
> --
> 1.8.3.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] Introduce if_index field to struct rte_eth_dev_info
  2014-01-09  6:30 ` Stephen Hemminger
@ 2014-01-09  8:44   ` Mats Liljegren
  2014-01-09  9:01     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Mats Liljegren @ 2014-01-09  8:44 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Thu, Jan 9, 2014 at 7:30 AM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> Technically in Linux ifindex is unsigned 32 bit value. And 0 is
> reserved as a marker.
> Therefore why not use that semantic.
>
> On Wed, Jan 8, 2014 at 1:46 AM, Mats Liljegren
> <liljegren.mats2@gmail.com> wrote:
>> This field is intended for pcap to describe the name of the interface
>> as known to Linux. It is an interface index, but can be translated into
>> an interface name using if_indextoname() function.
>>
>> When using pcap, interrupt affinity becomes important, and this field
>> gives the application a chance to ensure that interrupt affinity is set
>> to the lcore handling the device.
>>
>> Signed-off-by: Mats Liljegren <mats.liljegren@enea.com>
>> ---
>>  lib/librte_ether/rte_ethdev.c | 1 +
>>  lib/librte_ether/rte_ethdev.h | 1 +
>>  2 files changed, 2 insertions(+)
>>
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
>> index 859ec92..38c1ea1 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -1037,6 +1037,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct
>> rte_eth_dev_info *dev_info)
>>         /* Default device offload capabilities to zero */
>>         dev_info->rx_offload_capa = 0;
>>         dev_info->tx_offload_capa = 0;
>> +       dev_info->if_index = -1;
>>         FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
>>         (*dev->dev_ops->dev_infos_get)(dev, dev_info);
>>         dev_info->pci_dev = dev->pci_dev;
>> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
>> index 302d378..5b80e5d 100644
>> --- a/lib/librte_ether/rte_ethdev.h
>> +++ b/lib/librte_ether/rte_ethdev.h
>> @@ -787,6 +787,7 @@ struct rte_eth_conf {
>>  struct rte_eth_dev_info {
>>         struct rte_pci_device *pci_dev; /**< Device PCI information. */
>>         const char *driver_name; /**< Device Driver name. */
>> +       int if_index; /**< Index to bounded host interface, or -1 if
>> none. Use if_indextoname() to translate into an interface name. */
>>         uint32_t min_rx_bufsize; /**< Minimum size of RX buffer. */
>>         uint32_t max_rx_pktlen; /**< Maximum configurable length of RX pkt. */
>>         uint16_t max_rx_queues; /**< Maximum number of RX queues. */
>> --
>> 1.8.3.2

You're right. I'm too used to int and -1...

I'll prepare new patches.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] Introduce if_index field to struct rte_eth_dev_info
  2014-01-09  8:44   ` Mats Liljegren
@ 2014-01-09  9:01     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2014-01-09  9:01 UTC (permalink / raw)
  To: Mats Liljegren; +Cc: dev

09/01/2014 09:44, Mats Liljegren:
> I'll prepare new patches.

As you may know (and as described in http://dpdk.org/dev#send), you can use 
these options to send new versions of your patches:
	git send-email --subject-prefix 'PATCH v3' --annotate

Thank you
-- 
Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-09  9:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-08  9:46 [dpdk-dev] [PATCH 1/2] Introduce if_index field to struct rte_eth_dev_info Mats Liljegren
2014-01-09  6:30 ` Stephen Hemminger
2014-01-09  8:44   ` Mats Liljegren
2014-01-09  9:01     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).