* [dpdk-dev] [PATCH v3] ethdev: Rename RX/TX enable queue field for queue start and stop
@ 2014-09-26 5:00 Ouyang Changchun
2014-09-29 17:33 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: Ouyang Changchun @ 2014-09-26 5:00 UTC (permalink / raw)
To: dev
V3 change:
- Rename field name to rx_deferred_start/tx_deferred_start in
both ixgbe and i40e PMD.
- Move the doxygen comments for rx_deferred_start after it is declared.
- Simplify/split the long description and move some to doxygen comments of
rte_eth_dev_rx_queue_start and rte_eth_dev_tx_queue_start.
V2 and V1 change:
- Update comments for the field start_rx_per_q for better readability.
- Rename the field name to rx_enable_queue for better readability too.
- Accordingly Update its reference in sample vhost.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
examples/vhost/main.c | 9 +++++++--
lib/librte_ether/rte_ethdev.h | 11 +++++++----
lib/librte_pmd_i40e/i40e_ethdev.c | 4 ++--
lib/librte_pmd_i40e/i40e_ethdev_vf.c | 4 ++--
lib/librte_pmd_i40e/i40e_rxtx.c | 4 ++--
lib/librte_pmd_i40e/i40e_rxtx.h | 4 ++--
lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 8 ++++----
lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 6 ++++--
8 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 85ee8b8..4fd164d 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -3607,9 +3607,14 @@ MAIN(int argc, char *argv[])
char pool_name[RTE_MEMPOOL_NAMESIZE];
char ring_name[RTE_MEMPOOL_NAMESIZE];
- rx_conf_default.start_rx_per_q = (uint8_t)zero_copy;
+ /*
+ * Zero copy defers queue RX/TX start to the time when guest
+ * finishes its startup and packet buffers from that guest are
+ * available.
+ */
+ rx_conf_default.rx_deferred_start = (uint8_t)zero_copy;
rx_conf_default.rx_drop_en = 0;
- tx_conf_default.start_tx_per_q = (uint8_t)zero_copy;
+ tx_conf_default.tx_deferred_start = (uint8_t)zero_copy;
nb_mbuf = num_rx_descriptor
+ num_switching_cores * MBUF_CACHE_SIZE_ZCP
+ num_switching_cores * MAX_PKT_BURST;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 60b24c5..bef8962 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -604,7 +604,7 @@ struct rte_eth_rxconf {
struct rte_eth_thresh rx_thresh; /**< RX ring threshold registers. */
uint16_t rx_free_thresh; /**< Drives the freeing of RX descriptors. */
uint8_t rx_drop_en; /**< Drop packets if no descriptors are available. */
- uint8_t start_rx_per_q; /**< start rx per queue. */
+ uint8_t rx_deferred_start; /**< RX not start in rte_eth_dev_start(). */
};
#define ETH_TXQ_FLAGS_NOMULTSEGS 0x0001 /**< nb_segs=1 for all mbufs */
@@ -625,7 +625,7 @@ struct rte_eth_txconf {
uint16_t tx_rs_thresh; /**< Drives the setting of RS bit on TXDs. */
uint16_t tx_free_thresh; /**< Drives the freeing of TX buffers. */
uint32_t txq_flags; /**< Set flags for the Tx queue */
- uint8_t start_tx_per_q; /**< start tx per queue. */
+ uint8_t tx_deferred_start; /**< TX not start in rte_eth_dev_start(). */
};
/**
@@ -1795,7 +1795,9 @@ extern int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
extern int rte_eth_dev_socket_id(uint8_t port_id);
/*
- * Start specified RX queue of a port
+ * Allocate mbuf from mempool, setup the DMA physical address
+ * and then start RX for specified queue of a port. It is used
+ * when rx_deferred_start flag of the specified queue is true.
*
* @param port_id
* The port identifier of the Ethernet device
@@ -1827,7 +1829,8 @@ extern int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
extern int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
/*
- * Start specified TX queue of a port
+ * Start TX for specified queue of a port. It is used when tx_deferred_start
+ * flag of the specified queue is true.
*
* @param port_id
* The port identifier of the Ethernet device
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index a00d6ca..26f1799 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -3017,7 +3017,7 @@ i40e_vsi_switch_tx_queues(struct i40e_vsi *vsi, bool on)
txq = dev_data->tx_queues[i];
/* Don't operate the queue if not configured or
* if starting only per queue */
- if (!txq->q_set || (on && txq->start_tx_per_q))
+ if (!txq->q_set || (on && txq->tx_deferred_start))
continue;
if (on)
ret = i40e_dev_tx_queue_start(dev, i);
@@ -3095,7 +3095,7 @@ i40e_vsi_switch_rx_queues(struct i40e_vsi *vsi, bool on)
rxq = dev_data->rx_queues[i];
/* Don't operate the queue if not configured or
* if starting only per queue */
- if (!rxq->q_set || (on && rxq->start_rx_per_q))
+ if (!rxq->q_set || (on && rxq->rx_deferred_start))
continue;
if (on)
ret = i40e_dev_rx_queue_start(dev, i);
diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index f6c4873..809c1f0 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -675,7 +675,7 @@ i40evf_start_queues(struct rte_eth_dev *dev)
for (i = 0; i < dev->data->nb_rx_queues; i++) {
rxq = dev_data->rx_queues[i];
- if (rxq->start_rx_per_q)
+ if (rxq->rx_deferred_start)
continue;
if (i40evf_dev_rx_queue_start(dev, i) != 0) {
PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
@@ -685,7 +685,7 @@ i40evf_start_queues(struct rte_eth_dev *dev)
for (i = 0; i < dev->data->nb_tx_queues; i++) {
txq = dev_data->tx_queues[i];
- if (txq->start_tx_per_q)
+ if (txq->tx_deferred_start)
continue;
if (i40evf_dev_tx_queue_start(dev, i) != 0) {
PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
index 099699c..7c5b6a8 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -1609,7 +1609,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,
0 : ETHER_CRC_LEN);
rxq->drop_en = rx_conf->rx_drop_en;
rxq->vsi = vsi;
- rxq->start_rx_per_q = rx_conf->start_rx_per_q;
+ rxq->rx_deferred_start = rx_conf->rx_deferred_start;
/* Allocate the maximun number of RX ring hardware descriptor. */
ring_size = sizeof(union i40e_rx_desc) * I40E_MAX_RING_DESC;
@@ -1895,7 +1895,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
txq->port_id = dev->data->port_id;
txq->txq_flags = tx_conf->txq_flags;
txq->vsi = vsi;
- txq->start_tx_per_q = tx_conf->start_tx_per_q;
+ txq->tx_deferred_start = tx_conf->tx_deferred_start;
#ifdef RTE_LIBRTE_XEN_DOM0
txq->tx_ring_phys_addr = rte_mem_phy2mch(tz->memseg_id, tz->phys_addr);
diff --git a/lib/librte_pmd_i40e/i40e_rxtx.h b/lib/librte_pmd_i40e/i40e_rxtx.h
index 4478592..af932e3 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.h
+++ b/lib/librte_pmd_i40e/i40e_rxtx.h
@@ -112,7 +112,7 @@ struct i40e_rx_queue {
uint16_t max_pkt_len; /* Maximum packet length */
uint8_t hs_mode; /* Header Split mode */
bool q_set; /**< indicate if rx queue has been configured */
- bool start_rx_per_q; /**< don't start this queue in dev start */
+ bool rx_deferred_start; /**< don't start this queue in dev start */
};
struct i40e_tx_entry {
@@ -151,7 +151,7 @@ struct i40e_tx_queue {
uint16_t tx_next_dd;
uint16_t tx_next_rs;
bool q_set; /**< indicate if tx queue has been configured */
- bool start_tx_per_q; /**< don't start this queue in dev start */
+ bool tx_deferred_start; /**< don't start this queue in dev start */
};
int i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 52ec99e..d436151 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1851,7 +1851,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
txq->port_id = dev->data->port_id;
txq->txq_flags = tx_conf->txq_flags;
txq->ops = &def_txq_ops;
- txq->start_tx_per_q = tx_conf->start_tx_per_q;
+ txq->tx_deferred_start = tx_conf->tx_deferred_start;
/*
* Modification to set VFTDT for virtual function if vf is detected
@@ -2121,7 +2121,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
rxq->crc_len = (uint8_t) ((dev->data->dev_conf.rxmode.hw_strip_crc) ?
0 : ETHER_CRC_LEN);
rxq->drop_en = rx_conf->rx_drop_en;
- rxq->start_rx_per_q = rx_conf->start_rx_per_q;
+ rxq->rx_deferred_start = rx_conf->rx_deferred_start;
/*
* Allocate RX ring hardware descriptors. A memzone large enough to
@@ -3693,13 +3693,13 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
for (i = 0; i < dev->data->nb_tx_queues; i++) {
txq = dev->data->tx_queues[i];
- if (!txq->start_tx_per_q)
+ if (!txq->tx_deferred_start)
ixgbe_dev_tx_queue_start(dev, i);
}
for (i = 0; i < dev->data->nb_rx_queues; i++) {
rxq = dev->data->rx_queues[i];
- if (!rxq->start_rx_per_q)
+ if (!rxq->rx_deferred_start)
ixgbe_dev_rx_queue_start(dev, i);
}
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
index 7b5ac0e..228ee02 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
@@ -126,7 +126,8 @@ struct igb_rx_queue {
uint8_t port_id; /**< Device port identifier. */
uint8_t crc_len; /**< 0 if CRC stripped, 4 otherwise. */
uint8_t drop_en; /**< If not 0, set SRRCTL.Drop_En. */
- uint8_t start_rx_per_q;
+ uint8_t rx_deferred_start;
+ /**< don't start this queue in dev start. */
#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
/** need to alloc dummy mbuf, for wraparound when scanning hw ring */
struct rte_mbuf fake_mbuf;
@@ -207,7 +208,8 @@ struct igb_tx_queue {
/** Hardware context0 history. */
struct ixgbe_advctx_info ctx_cache[IXGBE_CTX_NUM];
struct ixgbe_txq_ops *ops; /**< txq ops */
- uint8_t start_tx_per_q;
+ uint8_t tx_deferred_start;
+ /**< don't start this queue in dev start. */
};
struct ixgbe_txq_ops {
--
1.8.4.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH v3] ethdev: Rename RX/TX enable queue field for queue start and stop
2014-09-26 5:00 [dpdk-dev] [PATCH v3] ethdev: Rename RX/TX enable queue field for queue start and stop Ouyang Changchun
@ 2014-09-29 17:33 ` Thomas Monjalon
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2014-09-29 17:33 UTC (permalink / raw)
To: Ouyang Changchun; +Cc: dev
2014-09-26 13:00, Ouyang Changchun:
> V3 change:
> - Rename field name to rx_deferred_start/tx_deferred_start in
> both ixgbe and i40e PMD.
> - Move the doxygen comments for rx_deferred_start after it is declared.
> - Simplify/split the long description and move some to doxygen comments of
> rte_eth_dev_rx_queue_start and rte_eth_dev_tx_queue_start.
>
> V2 and V1 change:
> - Update comments for the field start_rx_per_q for better readability.
> - Rename the field name to rx_enable_queue for better readability too.
> - Accordingly Update its reference in sample vhost.
>
> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked and applied with some minor changes in comments.
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-29 17:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26 5:00 [dpdk-dev] [PATCH v3] ethdev: Rename RX/TX enable queue field for queue start and stop Ouyang Changchun
2014-09-29 17:33 ` 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).