[dpdk-dev,v2,1/7] net/tap: use correct tap name

Message ID 050aa06c03aa4b56f703d74a8d8a792de5e075f4.1486026370.git.pascal.mazon@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Pascal Mazon Feb. 2, 2017, 4:17 p.m. UTC
  dev->data->name contains the device name, e.g. "net_tap0".
dev->data->dev_private->name contains the actual iface name,
e.g. "dtap0".

In any case, the name must to be consistent with the tun_alloc() call in
eth_dev_tap_create().

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---
 drivers/net/tap/rte_eth_tap.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
  

Comments

Wiles, Keith Feb. 2, 2017, 4:23 p.m. UTC | #1
> On Feb 2, 2017, at 10:17 AM, Pascal Mazon <pascal.mazon@6wind.com> wrote:

> 

> dev->data->name contains the device name, e.g. "net_tap0".

> dev->data->dev_private->name contains the actual iface name,

> e.g. "dtap0".

> 

> In any case, the name must to be consistent with the tun_alloc() call in

> eth_dev_tap_create().

> 

> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>

> —


Acked-by: Keith Wiles <keith.wiles@intel.com>


Regards,
Keith
  
Wiles, Keith Feb. 2, 2017, 4:24 p.m. UTC | #2
> On Feb 2, 2017, at 10:23 AM, Wiles, Keith <keith.wiles@intel.com> wrote:

> 

> 

>> On Feb 2, 2017, at 10:17 AM, Pascal Mazon <pascal.mazon@6wind.com> wrote:

>> 

>> dev->data->name contains the device name, e.g. "net_tap0".

>> dev->data->dev_private->name contains the actual iface name,

>> e.g. "dtap0".

>> 

>> In any case, the name must to be consistent with the tun_alloc() call in

>> eth_dev_tap_create().

>> 

>> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>

>> —

> 

> Acked-by: Keith Wiles <keith.wiles@intel.com>


Acked-by: Keith Wiles <keith.wiles@intel.com> for the series 1-7


> 

> Regards,

> Keith

> 


Regards,
Keith
  
Ferruh Yigit Feb. 2, 2017, 9:55 p.m. UTC | #3
On 2/2/2017 4:24 PM, Wiles, Keith wrote:
> 
>> On Feb 2, 2017, at 10:23 AM, Wiles, Keith <keith.wiles@intel.com> wrote:
>>
>>
>>> On Feb 2, 2017, at 10:17 AM, Pascal Mazon <pascal.mazon@6wind.com> wrote:
>>>
>>> dev->data->name contains the device name, e.g. "net_tap0".
>>> dev->data->dev_private->name contains the actual iface name,
>>> e.g. "dtap0".
>>>
>>> In any case, the name must to be consistent with the tun_alloc() call in
>>> eth_dev_tap_create().
>>>
>>> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
>>> —
>>
>> Acked-by: Keith Wiles <keith.wiles@intel.com>
> 
> Acked-by: Keith Wiles <keith.wiles@intel.com> for the series 1-7

Series applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 91f63f5468b2..8faf08551b9e 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -410,6 +410,7 @@  tap_setup_queue(struct rte_eth_dev *dev,
 		struct pmd_internals *internals,
 		uint16_t qid)
 {
+	struct pmd_internals *pmd = dev->data->dev_private;
 	struct rx_queue *rx = &internals->rxq[qid];
 	struct tx_queue *tx = &internals->txq[qid];
 	int fd;
@@ -419,11 +420,10 @@  tap_setup_queue(struct rte_eth_dev *dev,
 		fd = tx->fd;
 		if (fd < 0) {
 			RTE_LOG(INFO, PMD, "Add queue to TAP %s for qid %d\n",
-				dev->data->name, qid);
-			fd = tun_alloc(dev->data->name);
+				pmd->name, qid);
+			fd = tun_alloc(pmd->name);
 			if (fd < 0) {
-				RTE_LOG(ERR, PMD, "tun_alloc(%s) failed\n",
-					dev->data->name);
+				RTE_LOG(ERR, PMD, "tun_alloc(%s) failed\n", pmd->name);
 				return -1;
 			}
 		}
@@ -493,7 +493,7 @@  tap_rx_queue_setup(struct rte_eth_dev *dev,
 
 	internals->fds[rx_queue_id] = fd;
 	RTE_LOG(INFO, PMD, "RX TAP device name %s, qid %d on fd %d\n",
-		dev->data->name, rx_queue_id, internals->rxq[rx_queue_id].fd);
+		internals->name, rx_queue_id, internals->rxq[rx_queue_id].fd);
 
 	return 0;
 }
@@ -516,7 +516,7 @@  tap_tx_queue_setup(struct rte_eth_dev *dev,
 		return -1;
 
 	RTE_LOG(INFO, PMD, "TX TAP device name %s, qid %d on fd %d\n",
-		dev->data->name, tx_queue_id, internals->txq[tx_queue_id].fd);
+		internals->name, tx_queue_id, internals->txq[tx_queue_id].fd);
 
 	return 0;
 }