Skip to contentSkip to conversation

net/vmxnet3: set the queue shared buffer at start

PATCH In review Chas Williams 3 participants 4 messages Jan 17, 2018 – Mar 13, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/vmxnet3: set the queue shared buffer at start

From: "Charles (Chas) Williams" <[email protected]>

If a reconfiguration happens, queuedesc is reallocated. Any queues that are preserved point to the previous queuedesc since the queues are only configured during queue setup. Delay configuration of the shared queue pointers until device start when queuedesc is no longer changing.

Fixes 8618d19b52b1 ("net/vmxnet3: reallocate shared memzone on re-config")
---
 drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 ++++
 drivers/net/vmxnet3/vmxnet3_rxtx.c   | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/vmxnet3/vmxnet3_ethdev.c +4 -0
index d3b704b..776a0da 100644
@@ -644,6 +644,8 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
 		Vmxnet3_TxQueueDesc *tqd = &hw->tqd_start[i];
 		vmxnet3_tx_queue_t *txq  = dev->data->tx_queues[i];
 
+		txq->shared = &hw->tqd_start[i];
+
 		tqd->ctrl.txNumDeferred  = 0;
 		tqd->ctrl.txThreshold    = 1;
 		tqd->conf.txRingBasePA   = txq->cmd_ring.basePA;
@@ -664,6 +666,8 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
 		Vmxnet3_RxQueueDesc *rqd  = &hw->rqd_start[i];
 		vmxnet3_rx_queue_t *rxq   = dev->data->rx_queues[i];
 
+		rxq->shared = &hw->rqd_start[i];
+
 		rqd->conf.rxRingBasePA[0] = rxq->cmd_ring[0].basePA;
 		rqd->conf.rxRingBasePA[1] = rxq->cmd_ring[1].basePA;
 		rqd->conf.compRingBasePA  = rxq->comp_ring.basePA;
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -2
index f9416f3..64f24e6 100644
@@ -908,7 +908,7 @@ vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev,
 
 	txq->queue_id = queue_idx;
 	txq->port_id = dev->data->port_id;
-	txq->shared = &hw->tqd_start[queue_idx];
+	txq->shared = NULL; /* set in vmxnet3_setup_driver_shared() */
 	txq->hw = hw;
 	txq->qid = queue_idx;
 	txq->stopped = TRUE;
@@ -1011,7 +1011,7 @@ vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	rxq->mp = mp;
 	rxq->queue_id = queue_idx;
 	rxq->port_id = dev->data->port_id;
-	rxq->shared = &hw->rqd_start[queue_idx];
+	rxq->shared = NULL; /* set in vmxnet3_setup_driver_shared() */
 	rxq->hw = hw;
 	rxq->qid1 = queue_idx;
 	rxq->qid2 = queue_idx + hw->num_rx_queues;
Signature · 1 line
2.9.5
#1 lore raw

PATCH 2/2 net/vmxnet3: keep consistent link status

From: "Charles (Chas) Williams" <[email protected]>

Bonding may examine the link properties to ensure that matching interfaces are bound together. If the link is going to have fixed properties, these need to remain consistent regardless of the link_status or the state of the adapter.

---
 drivers/net/vmxnet3/vmxnet3_ethdev.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/net/vmxnet3/vmxnet3_ethdev.c +15 -5
index 776a0da..d5379dd 100644
@@ -267,6 +267,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
 	struct rte_pci_device *pci_dev;
 	struct vmxnet3_hw *hw = eth_dev->data->dev_private;
 	uint32_t mac_hi, mac_lo, ver;
+	struct rte_eth_link link;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -369,6 +370,13 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
 	memset(hw->saved_tx_stats, 0, sizeof(hw->saved_tx_stats));
 	memset(hw->saved_rx_stats, 0, sizeof(hw->saved_rx_stats));
 
+	/* set the initial link status */
+	memset(&link, 0, sizeof(link));
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_speed = ETH_SPEED_NUM_10G;
+	link.link_autoneg = ETH_LINK_SPEED_FIXED;
+	vmxnet3_dev_atomic_write_link_status(eth_dev, &link);
+
 	return 0;
 }
 
@@ -857,6 +865,9 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev)
 
 	/* Clear recorded link status */
 	memset(&link, 0, sizeof(link));
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_speed = ETH_SPEED_NUM_10G;
+	link.link_autoneg = ETH_LINK_SPEED_FIXED;
 	vmxnet3_dev_atomic_write_link_status(dev, &link);
 }
 
@@ -1145,12 +1156,11 @@ __vmxnet3_dev_link_update(struct rte_eth_dev *dev,
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK);
 	ret = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
 
-	if (ret & 0x1) {
+	if (ret & 0x1)
 		link.link_status = ETH_LINK_UP;
-		link.link_duplex = ETH_LINK_FULL_DUPLEX;
-		link.link_speed = ETH_SPEED_NUM_10G;
-		link.link_autoneg = ETH_LINK_AUTONEG;
-	}
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_speed = ETH_SPEED_NUM_10G;
+	link.link_autoneg = ETH_LINK_AUTONEG;
 
 	vmxnet3_dev_atomic_write_link_status(dev, &link);
 
Signature · 1 line
2.9.5
Acked-by on v1 1/2
#2 lore raw
In reply to Chas Williams
Quoted 10 lines · Chas Williams

From: "Charles (Chas) Williams" <[email protected]>

If a reconfiguration happens, queuedesc is reallocated. Any queues that are preserved point to the previous queuedesc since the queues are only configured during queue setup. Delay configuration of the shared queue pointers until device start when queuedesc is no longer changing.

Fixes 8618d19b52b1 ("net/vmxnet3: reallocate shared memzone on re-config")
#3 lore raw
Quoted 11 lines · Shrikrishna Khare
Quoted 7 lines · Chas Williams

From: "Charles (Chas) Williams" <[email protected]>

If a reconfiguration happens, queuedesc is reallocated. Any queues that are preserved point to the previous queuedesc since the queues are only configured during queue setup. Delay configuration of the shared queue pointers until device start when queuedesc is no longer changing.

Quoted 5 lines
Quoted 3 lines
Fixes 8618d19b52b1 ("net/vmxnet3: reallocate shared memzone on re-config")

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