From: Ouyang Changchun Date: Fri, 26 Sep 2014 05:00:53 +0000 (+0800) Subject: ethdev: rename flag for queue start and stop X-Git-Tag: spdx-start~10375 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3111eae26e2296ec049e6dfc3c0c522d7b9e1c62;p=dpdk.git ethdev: rename flag for queue start and stop Rename start_?x_per_q to ?x_deferred_start and add comments. Signed-off-by: Changchun Ouyang Acked-by: Thomas Monjalon --- diff --git a/examples/vhost/main.c b/examples/vhost/main.c index c81b8f5179..c23d453551 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -3604,9 +3604,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 60b24c5d85..bbc602243b 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; /**< Do not start queue with 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; /**< Do not start queue with 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 a00d6ca445..26f179909e 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 f6c4873125..809c1f0024 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 099699cfb0..7c5b6a8d33 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 4478592be6..af932e3d7b 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 52ec99e561..d436151344 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 7b5ac0ee96..eb89715cfa 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h @@ -126,7 +126,7 @@ 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; /**< not in global 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 +207,7 @@ 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; /**< not in global dev start. */ }; struct ixgbe_txq_ops {