Skip to contentSkip to conversation

net/ark: remove queue offset based on port id

PATCH In review Ed Czeck 2 participants 9 messages Jul 16, 2019 – Jul 22, 2019 Network drivers

lore
Share & tools
lore

Ed Czeck

author
#0 lore raw

PATCH 1/2 net/ark: remove queue offset based on port id

Fixes c33d45af3633 ("net/ark: add Tx initial version")
---
 drivers/net/ark/ark_ethdev_rx.c | 4 +---
 drivers/net/ark/ark_ethdev_tx.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/ark/ark_ethdev_rx.c +1 -3
index 7de1a98..6156730 100644
@@ -127,9 +127,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	uint32_t i;
 	int status;
 
-	/* Future works: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	/* We may already be setup, free memory prior to re-allocation */
 	if (dev->data->rx_queues[queue_idx] != NULL) {
drivers/net/ark/ark_ethdev_tx.c +1 -3
index 1967655..08bcf43 100644
@@ -211,9 +211,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev,
 	struct ark_tx_queue *queue;
 	int status;
 
-	/* Future: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	if (!rte_is_power_of_2(nb_desc)) {
 		PMD_DRV_LOG(ERR,
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/2 net/ark: remove queue offset based on port id

Queue index was incorrectly incremented with port, which caused swizzling of packet placement among queues. This manifested when the number of configured ports was >1 and < nb_queues.

Fixes c33d45af3633 ("net/ark: add Tx initial version")
---
 drivers/net/ark/ark_ethdev_rx.c | 4 +---
 drivers/net/ark/ark_ethdev_tx.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/ark/ark_ethdev_rx.c +1 -3
index 7de1a98..6156730 100644
@@ -127,9 +127,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	uint32_t i;
 	int status;
 
-	/* Future works: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	/* We may already be setup, free memory prior to re-allocation */
 	if (dev->data->rx_queues[queue_idx] != NULL) {
drivers/net/ark/ark_ethdev_tx.c +1 -3
index 1967655..08bcf43 100644
@@ -211,9 +211,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev,
 	struct ark_tx_queue *queue;
 	int status;
 
-	/* Future: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	if (!rte_is_power_of_2(nb_desc)) {
 		PMD_DRV_LOG(ERR,
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH 2/2 net/ark: remove resources when port is close

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the resources for the port can be freed by rte_eth_dev_close()

---
 drivers/net/ark/ark_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ark/ark_ethdev.c +5 -0
index 86e500e..3435728 100644
@@ -261,6 +261,8 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	/* Use dummy function until setup */
 	dev->rx_pkt_burst = &eth_ark_recv_pkts_noop;
 	dev->tx_pkt_burst = &eth_ark_xmit_pkts_noop;
+	/* Let rte_eth_dev_close() release the port resources */
+	dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
 
 	ark->bar0 = (uint8_t *)pci_dev->mem_resource[0].addr;
 	ark->a_bar = (uint8_t *)pci_dev->mem_resource[2].addr;
@@ -706,6 +708,9 @@ eth_ark_dev_close(struct rte_eth_dev *dev)
 		eth_ark_dev_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = 0;
 	}
+
+	rte_free(dev->data->mac_addrs);
+	dev->data->mac_addrs = 0;
 }
 
 static void
Signature · 1 line
2.7.4
#3 lore raw
In reply to Ed Czeck
Quoted 2 lines · Ed Czeck

Queue index was incorrectly incremented with port, which caused swizzling of packet placement among queues.

What is "swizzling of packet placement"?

'qidx' is used to set 'phys_qid', if what the name suggest is correct it is used to access the actual physical queues.

How this was working if you are calculating physical queue indexes wrong? (Of-course except port 0)

Are you actually fixing the multiple port support?

Quoted 2 lines

This manifested
when the number of configured ports was >1 and < nb_queues.

I can see port number ">1", but is the 'nb_queues' limitation real?

If there are 2 queues per port, and you are configuring 3 ports will the original calculation be correct?

Quoted 41 lines
Fixes c33d45af3633 ("net/ark: add Tx initial version")
---
 drivers/net/ark/ark_ethdev_rx.c | 4 +---
 drivers/net/ark/ark_ethdev_tx.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/ark/ark_ethdev_rx.c +1 -3
index 7de1a98..6156730 100644
@@ -127,9 +127,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	uint32_t i;
 	int status;
 
-	/* Future works: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	/* We may already be setup, free memory prior to re-allocation */
 	if (dev->data->rx_queues[queue_idx] != NULL) {
drivers/net/ark/ark_ethdev_tx.c +1 -3
index 1967655..08bcf43 100644
@@ -211,9 +211,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev,
 	struct ark_tx_queue *queue;
 	int status;
 
-	/* Future: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	if (!rte_is_power_of_2(nb_desc)) {
 		PMD_DRV_LOG(ERR,
#4 lore raw
In reply to Ed Czeck
Quoted 4 lines · Ed Czeck
Fixes c33d45af3633 ("net/ark: add Tx initial version")

Hi Ed,

Can you please add some context to commit log, what was the problem, what was its impact, how this is fixed?

Quoted 36 lines
---
 drivers/net/ark/ark_ethdev_rx.c | 4 +---
 drivers/net/ark/ark_ethdev_tx.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/ark/ark_ethdev_rx.c +1 -3
index 7de1a98..6156730 100644
@@ -127,9 +127,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	uint32_t i;
 	int status;
 
-	/* Future works: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	/* We may already be setup, free memory prior to re-allocation */
 	if (dev->data->rx_queues[queue_idx] != NULL) {
drivers/net/ark/ark_ethdev_tx.c +1 -3
index 1967655..08bcf43 100644
@@ -211,9 +211,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev,
 	struct ark_tx_queue *queue;
 	int status;
 
-	/* Future: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	if (!rte_is_power_of_2(nb_desc)) {
 		PMD_DRV_LOG(ERR,
author
#5 lore raw

PATCH 1/2 net/ark: remove queue offset based on port id

In reply to Ed Czeck

Queue index was incorrectly incremented with port, which caused incorrect queue packet placement. This manifested when port number was != 0.

Fixes c33d45af3633 ("net/ark: add Tx initial version")
---
 drivers/net/ark/ark_ethdev_rx.c | 4 +---
 drivers/net/ark/ark_ethdev_tx.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/ark/ark_ethdev_rx.c +1 -3
index 7de1a98..6156730 100644
@@ -127,9 +127,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	uint32_t i;
 	int status;
 
-	/* Future works: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	/* We may already be setup, free memory prior to re-allocation */
 	if (dev->data->rx_queues[queue_idx] != NULL) {
drivers/net/ark/ark_ethdev_tx.c +1 -3
index 1967655..08bcf43 100644
@@ -211,9 +211,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev,
 	struct ark_tx_queue *queue;
 	int status;
 
-	/* Future: divide the Q's evenly with multi-ports */
-	int port = dev->data->port_id;
-	int qidx = port + queue_idx;
+	int qidx = queue_idx;
 
 	if (!rte_is_power_of_2(nb_desc)) {
 		PMD_DRV_LOG(ERR,
Signature · 1 line
2.7.4
author
#6 lore raw

PATCH 2/2 net/ark: remove resources when port is close

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the resources for the port can be freed by rte_eth_dev_close()

---
 drivers/net/ark/ark_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ark/ark_ethdev.c +5 -0
index 86e500e..3435728 100644
@@ -261,6 +261,8 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	/* Use dummy function until setup */
 	dev->rx_pkt_burst = &eth_ark_recv_pkts_noop;
 	dev->tx_pkt_burst = &eth_ark_xmit_pkts_noop;
+	/* Let rte_eth_dev_close() release the port resources */
+	dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
 
 	ark->bar0 = (uint8_t *)pci_dev->mem_resource[0].addr;
 	ark->a_bar = (uint8_t *)pci_dev->mem_resource[2].addr;
@@ -706,6 +708,9 @@ eth_ark_dev_close(struct rte_eth_dev *dev)
 		eth_ark_dev_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = 0;
 	}
+
+	rte_free(dev->data->mac_addrs);
+	dev->data->mac_addrs = 0;
 }
 
 static void
Signature · 1 line
2.7.4
#7 lore raw
In reply to Ed Czeck
Quoted 8 lines · Ed Czeck

Queue index was incorrectly incremented with port, which caused incorrect queue packet placement. This manifested when port number was != 0.

Fixes c33d45af3633 ("net/ark: add Tx initial version")

Hi Ed,

Please add version tag, v#, to the subject prefix, that makes easy to trace the patches, like this is v3 of the patchset.

Also changing patch title as:
net/ark: fix queue packet replacement

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

author
#8 lore raw

PATCH 2/2 net/ark: remove resources when port is close

In reply to Ed Czeck

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the resources for the port can be freed by rte_eth_dev_close()

---
 drivers/net/ark/ark_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ark/ark_ethdev.c +5 -0
index 86e500e..3435728 100644
@@ -261,6 +261,8 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	/* Use dummy function until setup */
 	dev->rx_pkt_burst = &eth_ark_recv_pkts_noop;
 	dev->tx_pkt_burst = &eth_ark_xmit_pkts_noop;
+	/* Let rte_eth_dev_close() release the port resources */
+	dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
 
 	ark->bar0 = (uint8_t *)pci_dev->mem_resource[0].addr;
 	ark->a_bar = (uint8_t *)pci_dev->mem_resource[2].addr;
@@ -706,6 +708,9 @@ eth_ark_dev_close(struct rte_eth_dev *dev)
 		eth_ark_dev_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = 0;
 	}
+
+	rte_free(dev->data->mac_addrs);
+	dev->data->mac_addrs = 0;
 }
 
 static void
Signature · 1 line
2.7.4