Skip to contentSkip to conversation

Misuses of dev_info->if_index in embedded drivers.

dpdk-dev Stephen Hemminger 3 participants 3 messages Aug 24, 2020

lore
Share & tools
lore
#0 lore raw

The use of if_index in some drivers is wrong.
It does not match the user expectation in the documentation.

This code:

dpaa2/dpaa2_ethdev.c:   dev_info->if_index = priv->hw_id;
pfe/pfe_ethdev.c:       dev_info->if_index = internals->id;

Does match:
struct rte_eth_dev_info {
struct rte_device *device; /** Generic device information */ const char *driver_name; /**< Device Driver name. */ unsigned int if_index; /**< Index to bound host interface, or 0 if none.
Use if_indextoname() to translate into an interface name. */

Also, this code is unnecessary.

#1 lore raw
Quoted 7 lines · Stephen Hemminger

The use of if_index in some drivers is wrong.
It does not match the user expectation in the documentation.

This code:

dpaa2/dpaa2_ethdev.c:   dev_info->if_index = priv->hw_id;
pfe/pfe_ethdev.c:       dev_info->if_index = internals->id;
Quoted 9 lines

Does match:
struct rte_eth_dev_info {
struct rte_device *device; /** Generic device information */ const char *driver_name; /**< Device Driver name. */ unsigned int if_index; /**< Index to bound host interface, or 0 if none.
Use if_indextoname() to translate into an interface name. */

Also, this code is unnecessary.

'if_index' is needed only for some PMDs interact with kernel, like af_packet, pcap, tap, af_xdp, ...

Agree that it should not be needed for 'dpaa2' or 'pfe'.

#2 lore raw
Quoted 26 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, August 24, 2020 8:49 PM
To: Stephen Hemminger <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>
Cc: [email protected]; Gagandeep Singh <[email protected]>; Akhil Goyal <[email protected]>
Subject: Re: [dpdk-dev] Misuses of dev_info->if_index in embedded drivers.

Quoted 4 lines · Stephen Hemminger

The use of if_index in some drivers is wrong.
It does not match the user expectation in the documentation.

This code:

Quoted 8 lines
dpaa2/dpaa2_ethdev.c:   dev_info->if_index = priv->hw_id;
pfe/pfe_ethdev.c:       dev_info->if_index = internals->id;

Does match:
struct rte_eth_dev_info {
struct rte_device *device; /** Generic device information */ const char *driver_name; /**< Device Driver name. */ unsigned int if_index; /**< Index to bound host interface, or 0 if

none.

Quoted 2 lines

Use if_indextoname() to translate into an interface name. */

Quoted 7 lines
Quoted 2 lines

Also, this code is unnecessary.

'if_index' is needed only for some PMDs interact with kernel, like af_packet, pcap, tap, af_xdp, ...

Agree that it should not be needed for 'dpaa2' or 'pfe'.

[Hemant] ok. We will check and remove it.