drivers/net: cleanup Tx buffers
cover drivers/net: cleanup Tx buffers
From: Di ChenxuX <[email protected]>
Add support to the drivers inclulding fm10k, i40e, ice, ixgbe
for the API rte_eth_tx_done_cleanup to
force free consumed buffers on Tx ring.
Di ChenxuX (4):
net/fm10k: cleanup Tx buffers
net/i40e: cleanup Tx buffers
net/ice: cleanup Tx buffers
net/ixgbe: cleanup Tx buffers
drivers/net/fm10k/fm10k.h | 2 ++ drivers/net/fm10k/fm10k_ethdev.c | 1 + drivers/net/fm10k/fm10k_rxtx.c | 45 +++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 40 +++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 41 ++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 39 +++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ 13 files changed, 177 insertions(+)
Signature · 1 line
2.17.1
PATCH 1/4 net/fm10k: cleanup Tx buffers
From: Di ChenxuX <[email protected]>
Add support to the fm10k driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/fm10k/fm10k.h | 2 ++ drivers/net/fm10k/fm10k_ethdev.c | 1 + drivers/net/fm10k/fm10k_rxtx.c | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+)
drivers/net/fm10k/fm10k.h +2 -0
@@ -342,6 +342,8 @@ uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t fm10k_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int fm10k_tx_done_cleanup (void *txq,uint32_t free_cnt); +int fm10k_rxq_vec_setup (struct fm10k_rx_queue *rxq);int fm10k_rx_vec_condition_check (struct rte_eth_dev *);void fm10k_rx_queue_release_mbufs_vec (struct fm10k_rx_queue *rxq);
drivers/net/fm10k/fm10k_ethdev.c +1 -0
@@ -2838,6 +2838,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = { .reta_query = fm10k_reta_query, .rss_hash_update = fm10k_rss_hash_update, .rss_hash_conf_get = fm10k_rss_hash_conf_get, + .tx_done_cleanup = fm10k_tx_done_cleanup, }; static int ftag_check_handler(__rte_unused const char *key,
drivers/net/fm10k/fm10k_rxtx.c +45 -0
51 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 2/4 net/i40e: cleanup Tx buffers
In reply to Chenxu DiFrom: Di ChenxuX <[email protected]>
Add support to the i40e driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 40 +++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + 4 files changed, 43 insertions(+)
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -509,6 +509,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/*
drivers/net/i40e/i40e_rxtx.c +40 -0
@@ -2467,6 +2467,46 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) } } +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt) +{ +struct i40e_tx_queue *q = (struct i40e_tx_queue *)txq; +struct i40e_tx_entry *sw_ring; +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_cleaned; + +int count =0 ; + +if (q ==NULL ) +return -ENODEV ; + + sw_ring = q->sw_ring; + tx_cleaned = q->last_desc_cleaned; + tx_id = sw_ring[q->last_desc_cleaned].next_id; +if ((q->tx_ring[tx_id].cmd_type_offset_bsz & +rte_cpu_to_le_64 (I40E_TXD_QW1_DTYPE_MASK )) != +rte_cpu_to_le_64 (I40E_TX_DESC_DTYPE_DESC_DONE )) +return 0 ; + +do { +if (sw_ring[tx_id].mbuf ==NULL ) +break ; + +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); + sw_ring[tx_id].mbuf =NULL ; + sw_ring[tx_id].last_id = tx_id; + +/* Move to next segemnt. */ + tx_cleaned = tx_id; + tx_id = sw_ring[tx_id].next_id; + count++; + }while (count != (int )free_cnt); + + q->nb_tx_free += (uint16_t )count; + q->last_desc_cleaned = tx_cleaned; + +return count; +} +void i40e_reset_tx_queue (struct i40e_tx_queue *txq) {
drivers/net/i40e/i40e_rxtx.h +1 -0
@@ -204,6 +204,7 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void i40e_reset_rx_queue (struct i40e_rx_queue *rxq);void i40e_reset_tx_queue (struct i40e_tx_queue *txq);void i40e_tx_queue_release_mbufs (struct i40e_tx_queue *txq); +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt);int i40e_alloc_rx_queue_mbufs (struct i40e_rx_queue *rxq);void i40e_rx_queue_release_mbufs (struct i40e_rx_queue *rxq);
Signature · 1 line
2.17.1
PATCH 3/4 net/ice: cleanup Tx buffers
In reply to Chenxu DiFrom: Di ChenxuX <[email protected]>
Add support to the ice driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 41 ++++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + 3 files changed, 43 insertions(+)
drivers/net/ice/ice_ethdev.c +1 -0
@@ -160,6 +160,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ice/ice_rxtx.c +41 -0
47 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +1 -0
@@ -170,6 +170,7 @@ int ice_rx_descriptor_status(void *rx_queue, uint16_t offset);int ice_tx_descriptor_status (void *tx_queue,uint16_t offset);void ice_set_default_ptype_table (struct rte_eth_dev *dev);const uint32_t *ice_dev_supported_ptypes_get (struct rte_eth_dev *dev); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_rx_vec_dev_check (struct rte_eth_dev *dev);int ice_tx_vec_dev_check (struct rte_eth_dev *dev);
Signature · 1 line
2.17.1
PATCH 4/4 net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiFrom: Di ChenxuX <[email protected]>
Add support to the ixgbe driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 39 ++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ 3 files changed, 43 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -0
@@ -591,6 +591,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/*
@@ -639,6 +640,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ixgbe/ixgbe_rxtx.c +39 -0
@@ -2306,6 +2306,45 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt) +{ +struct ixgbe_tx_queue *q = (struct ixgbe_tx_queue *)txq; +struct ixgbe_tx_entry *sw_ring; +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_cleaned; + +int count =0 ; + +if (q ==NULL ) +return -ENODEV ; + + sw_ring = q->sw_ring; + tx_cleaned = q->last_desc_cleaned; + tx_id = sw_ring[q->last_desc_cleaned].next_id; +if (!(q->tx_ring[tx_id].wb.status & +IXGBE_TXD_STAT_DD )) +return 0 ; + +do { +if (sw_ring[tx_id].mbuf ==NULL ) +break ; + +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); + sw_ring[tx_id].mbuf =NULL ; + sw_ring[tx_id].last_id = tx_id; + +/* Move to next segemnt. */ + tx_cleaned = tx_id; + tx_id = sw_ring[tx_id].next_id; + count++; + }while (count != (int )free_cnt); + + q->nb_tx_free += (uint16_t )count; + q->last_desc_cleaned = tx_cleaned; + +return count; +} +static void __attribute__((cold))ixgbe_tx_free_swring (struct ixgbe_tx_queue *txq) {
drivers/net/ixgbe/ixgbe_rxtx.h +2 -0
@@ -285,6 +285,8 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ];
Signature · 1 line
2.17.1
v2 cover drivers/net: cleanup Tx buffers
In reply to Chenxu DiAdd support to the drivers inclulding fm10k, i40e, ice, ixgbe and igb vf for the API rte_eth_tx_done_cleanup to
force free consumed buffers on Tx ring.
---
v2:
added code about igb vf.
Chenxu Di (5):
net/e1000: cleanup Tx buffers
net/fm10k: cleanup Tx buffers
net/i40e: cleanup Tx buffers
net/ice: cleanup Tx buffers
net/ixgbe: cleanup Tx buffers
drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/fm10k/fm10k.h | 2 ++ drivers/net/fm10k/fm10k_ethdev.c | 1 + drivers/net/fm10k/fm10k_rxtx.c | 45 +++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 40 +++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 41 ++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 39 +++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ 14 files changed, 178 insertions(+)
Signature · 1 line
2.17.1
PATCH v2 1/5 net/fm10k: cleanup Tx buffers
From: Di ChenxuX <[email protected]>
Add support to the fm10k driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/fm10k/fm10k.h | 2 ++ drivers/net/fm10k/fm10k_ethdev.c | 1 + drivers/net/fm10k/fm10k_rxtx.c | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+)
drivers/net/fm10k/fm10k.h +2 -0
@@ -342,6 +342,8 @@ uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t fm10k_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int fm10k_tx_done_cleanup (void *txq,uint32_t free_cnt); +int fm10k_rxq_vec_setup (struct fm10k_rx_queue *rxq);int fm10k_rx_vec_condition_check (struct rte_eth_dev *);void fm10k_rx_queue_release_mbufs_vec (struct fm10k_rx_queue *rxq);
drivers/net/fm10k/fm10k_ethdev.c +1 -0
@@ -2897,6 +2897,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = { .reta_query = fm10k_reta_query, .rss_hash_update = fm10k_rss_hash_update, .rss_hash_conf_get = fm10k_rss_hash_conf_get, + .tx_done_cleanup = fm10k_tx_done_cleanup, }; static int ftag_check_handler(__rte_unused const char *key,
drivers/net/fm10k/fm10k_rxtx.c +45 -0
51 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 2/5 net/i40e: cleanup Tx buffers
In reply to Chenxu DiFrom: Di ChenxuX <[email protected]>
Add support to the i40e driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 40 +++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + 4 files changed, 43 insertions(+)
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/*
drivers/net/i40e/i40e_rxtx.c +40 -0
@@ -2455,6 +2455,46 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) } } +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt) +{ +struct i40e_tx_queue *q = (struct i40e_tx_queue *)txq; +struct i40e_tx_entry *sw_ring; +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_cleaned; + +int count =0 ; + +if (q ==NULL ) +return -ENODEV ; + + sw_ring = q->sw_ring; + tx_cleaned = q->last_desc_cleaned; + tx_id = sw_ring[q->last_desc_cleaned].next_id; +if ((q->tx_ring[tx_id].cmd_type_offset_bsz & +rte_cpu_to_le_64 (I40E_TXD_QW1_DTYPE_MASK )) != +rte_cpu_to_le_64 (I40E_TX_DESC_DTYPE_DESC_DONE )) +return 0 ; + +do { +if (sw_ring[tx_id].mbuf ==NULL ) +break ; + +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); + sw_ring[tx_id].mbuf =NULL ; + sw_ring[tx_id].last_id = tx_id; + +/* Move to next segemnt. */ + tx_cleaned = tx_id; + tx_id = sw_ring[tx_id].next_id; + count++; + }while (count != (int )free_cnt); + + q->nb_tx_free += (uint16_t )count; + q->last_desc_cleaned = tx_cleaned; + +return count; +} +void i40e_reset_tx_queue (struct i40e_tx_queue *txq) {
drivers/net/i40e/i40e_rxtx.h +1 -0
@@ -212,6 +212,7 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void i40e_reset_rx_queue (struct i40e_rx_queue *rxq);void i40e_reset_tx_queue (struct i40e_tx_queue *txq);void i40e_tx_queue_release_mbufs (struct i40e_tx_queue *txq); +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt);int i40e_alloc_rx_queue_mbufs (struct i40e_rx_queue *rxq);void i40e_rx_queue_release_mbufs (struct i40e_rx_queue *rxq);
Signature · 1 line
2.17.1
PATCH v2 3/5 net/ice: cleanup Tx buffers
In reply to Chenxu DiFrom: Di ChenxuX <[email protected]>
Add support to the ice driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 41 ++++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + 3 files changed, 43 insertions(+)
drivers/net/ice/ice_ethdev.c +1 -0
@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ice/ice_rxtx.c +41 -0
47 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +1 -0
@@ -183,6 +183,7 @@ int ice_rx_descriptor_status(void *rx_queue, uint16_t offset);int ice_tx_descriptor_status (void *tx_queue,uint16_t offset);void ice_set_default_ptype_table (struct rte_eth_dev *dev);const uint32_t *ice_dev_supported_ptypes_get (struct rte_eth_dev *dev); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_rx_vec_dev_check (struct rte_eth_dev *dev);int ice_tx_vec_dev_check (struct rte_eth_dev *dev);
Signature · 1 line
2.17.1
PATCH v2 4/5 net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiFrom: Di ChenxuX <[email protected]>
Add support to the ixgbe driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 39 ++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ 3 files changed, 43 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -0
@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/*
@@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ixgbe/ixgbe_rxtx.c +39 -0
@@ -2306,6 +2306,45 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt) +{ +struct ixgbe_tx_queue *q = (struct ixgbe_tx_queue *)txq; +struct ixgbe_tx_entry *sw_ring; +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_cleaned; + +int count =0 ; + +if (q ==NULL ) +return -ENODEV ; + + sw_ring = q->sw_ring; + tx_cleaned = q->last_desc_cleaned; + tx_id = sw_ring[q->last_desc_cleaned].next_id; +if (!(q->tx_ring[tx_id].wb.status & +IXGBE_TXD_STAT_DD )) +return 0 ; + +do { +if (sw_ring[tx_id].mbuf ==NULL ) +break ; + +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); + sw_ring[tx_id].mbuf =NULL ; + sw_ring[tx_id].last_id = tx_id; + +/* Move to next segemnt. */ + tx_cleaned = tx_id; + tx_id = sw_ring[tx_id].next_id; + count++; + }while (count != (int )free_cnt); + + q->nb_tx_free += (uint16_t )count; + q->last_desc_cleaned = tx_cleaned; + +return count; +} +static void __attribute__((cold))ixgbe_tx_free_swring (struct ixgbe_tx_queue *txq) {
drivers/net/ixgbe/ixgbe_rxtx.h +2 -0
@@ -285,6 +285,8 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ];
Signature · 1 line
2.17.1
PATCH v2 5/5 net/e1000: cleanup Tx buffers
In reply to Chenxu DiAdd support to the igb vf for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/e1000/igb_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -446,6 +446,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_descriptor_status = eth_igb_tx_descriptor_status, .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, + .tx_done_cleanup = eth_igb_tx_done_cleanup, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get,
Signature · 1 line
2.17.1
v3 cover drivers/net: cleanup Tx buffers
In reply to Chenxu DiAdd support to the drivers inclulding fm10k, i40e, ice, ixgbe
and igb vf for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
---
v2:
added code about igb vf.
v3:
changed infomation of author
Chenxu Di (5):
net/fm10k: cleanup Tx buffers
net/i40e: cleanup Tx buffers
net/ice: cleanup Tx buffers
net/ixgbe: cleanup Tx buffers
net/e1000: cleanup Tx buffers
drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/fm10k/fm10k.h | 2 ++ drivers/net/fm10k/fm10k_ethdev.c | 1 + drivers/net/fm10k/fm10k_rxtx.c | 45 +++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 40 +++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 41 ++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 39 +++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ 14 files changed, 178 insertions(+)
Signature · 1 line
2.17.1
PATCH v3 1/5 net/fm10k: cleanup Tx buffers
Add support to the fm10k driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/fm10k/fm10k.h | 2 ++ drivers/net/fm10k/fm10k_ethdev.c | 1 + drivers/net/fm10k/fm10k_rxtx.c | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+)
drivers/net/fm10k/fm10k.h +2 -0
@@ -342,6 +342,8 @@ uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t fm10k_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int fm10k_tx_done_cleanup (void *txq,uint32_t free_cnt); +int fm10k_rxq_vec_setup (struct fm10k_rx_queue *rxq);int fm10k_rx_vec_condition_check (struct rte_eth_dev *);void fm10k_rx_queue_release_mbufs_vec (struct fm10k_rx_queue *rxq);
drivers/net/fm10k/fm10k_ethdev.c +1 -0
@@ -2897,6 +2897,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = { .reta_query = fm10k_reta_query, .rss_hash_update = fm10k_rss_hash_update, .rss_hash_conf_get = fm10k_rss_hash_conf_get, + .tx_done_cleanup = fm10k_tx_done_cleanup, }; static int ftag_check_handler(__rte_unused const char *key,
drivers/net/fm10k/fm10k_rxtx.c +45 -0
51 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 2/5 net/i40e: cleanup Tx buffers
In reply to Chenxu DiAdd support to the i40e driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 40 +++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + 4 files changed, 43 insertions(+)
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/*
drivers/net/i40e/i40e_rxtx.c +40 -0
@@ -2455,6 +2455,46 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) } } +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt) +{ +struct i40e_tx_queue *q = (struct i40e_tx_queue *)txq; +struct i40e_tx_entry *sw_ring; +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_cleaned; + +int count =0 ; + +if (q ==NULL ) +return -ENODEV ; + + sw_ring = q->sw_ring; + tx_cleaned = q->last_desc_cleaned; + tx_id = sw_ring[q->last_desc_cleaned].next_id; +if ((q->tx_ring[tx_id].cmd_type_offset_bsz & +rte_cpu_to_le_64 (I40E_TXD_QW1_DTYPE_MASK )) != +rte_cpu_to_le_64 (I40E_TX_DESC_DTYPE_DESC_DONE )) +return 0 ; + +do { +if (sw_ring[tx_id].mbuf ==NULL ) +break ; + +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); + sw_ring[tx_id].mbuf =NULL ; + sw_ring[tx_id].last_id = tx_id; + +/* Move to next segemnt. */ + tx_cleaned = tx_id; + tx_id = sw_ring[tx_id].next_id; + count++; + }while (count != (int )free_cnt); + + q->nb_tx_free += (uint16_t )count; + q->last_desc_cleaned = tx_cleaned; + +return count; +} +void i40e_reset_tx_queue (struct i40e_tx_queue *txq) {
drivers/net/i40e/i40e_rxtx.h +1 -0
@@ -212,6 +212,7 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void i40e_reset_rx_queue (struct i40e_rx_queue *rxq);void i40e_reset_tx_queue (struct i40e_tx_queue *txq);void i40e_tx_queue_release_mbufs (struct i40e_tx_queue *txq); +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt);int i40e_alloc_rx_queue_mbufs (struct i40e_rx_queue *rxq);void i40e_rx_queue_release_mbufs (struct i40e_rx_queue *rxq);
Signature · 1 line
2.17.1
PATCH v3 3/5 net/ice: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ice driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 41 ++++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + 3 files changed, 43 insertions(+)
drivers/net/ice/ice_ethdev.c +1 -0
@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ice/ice_rxtx.c +41 -0
47 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +1 -0
@@ -183,6 +183,7 @@ int ice_rx_descriptor_status(void *rx_queue, uint16_t offset);int ice_tx_descriptor_status (void *tx_queue,uint16_t offset);void ice_set_default_ptype_table (struct rte_eth_dev *dev);const uint32_t *ice_dev_supported_ptypes_get (struct rte_eth_dev *dev); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_rx_vec_dev_check (struct rte_eth_dev *dev);int ice_tx_vec_dev_check (struct rte_eth_dev *dev);
Signature · 1 line
2.17.1
PATCH v3 4/5 net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ixgbe driver for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 39 ++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ 3 files changed, 43 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -0
@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/*
@@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ixgbe/ixgbe_rxtx.c +39 -0
@@ -2306,6 +2306,45 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt) +{ +struct ixgbe_tx_queue *q = (struct ixgbe_tx_queue *)txq; +struct ixgbe_tx_entry *sw_ring; +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_cleaned; + +int count =0 ; + +if (q ==NULL ) +return -ENODEV ; + + sw_ring = q->sw_ring; + tx_cleaned = q->last_desc_cleaned; + tx_id = sw_ring[q->last_desc_cleaned].next_id; +if (!(q->tx_ring[tx_id].wb.status & +IXGBE_TXD_STAT_DD )) +return 0 ; + +do { +if (sw_ring[tx_id].mbuf ==NULL ) +break ; + +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); + sw_ring[tx_id].mbuf =NULL ; + sw_ring[tx_id].last_id = tx_id; + +/* Move to next segemnt. */ + tx_cleaned = tx_id; + tx_id = sw_ring[tx_id].next_id; + count++; + }while (count != (int )free_cnt); + + q->nb_tx_free += (uint16_t )count; + q->last_desc_cleaned = tx_cleaned; + +return count; +} +static void __attribute__((cold))ixgbe_tx_free_swring (struct ixgbe_tx_queue *txq) {
drivers/net/ixgbe/ixgbe_rxtx.h +2 -0
@@ -285,6 +285,8 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ];
Signature · 1 line
2.17.1
PATCH v3 5/5 net/e1000: cleanup Tx buffers
In reply to Chenxu DiAdd support to the igb vf for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/e1000/igb_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -446,6 +446,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_descriptor_status = eth_igb_tx_descriptor_status, .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, + .tx_done_cleanup = eth_igb_tx_done_cleanup, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get,
Signature · 1 line
2.17.1
v4 cover drivers/net: cleanup Tx buffers
In reply to Chenxu DiAdd support to the drivers inclulding fm10k, i40e, ice, ixgbe
and igb vf for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
---
v2:
added code about igb vf.
v3:
changed information of author
v4:
changed code.
Chenxu Di (5):
net/fm10k: cleanup Tx buffers
net/i40e: cleanup Tx buffers
net/ice: cleanup Tx buffers
net/ixgbe: cleanup Tx buffers
net/e1000: cleanup Tx buffers
drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/fm10k/fm10k.h | 2 + drivers/net/fm10k/fm10k_ethdev.c | 1 + drivers/net/fm10k/fm10k_rxtx.c | 45 +++++++++++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 122 +++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 123 ++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 121 +++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 + 14 files changed, 424 insertions(+)
Signature · 1 line
2.17.1
PATCH v4 1/5 net/fm10k: cleanup Tx buffers
Add support to the fm10k driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/fm10k/fm10k.h | 2 ++ drivers/net/fm10k/fm10k_ethdev.c | 1 + drivers/net/fm10k/fm10k_rxtx.c | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+)
drivers/net/fm10k/fm10k.h +2 -0
@@ -342,6 +342,8 @@ uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t fm10k_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int fm10k_tx_done_cleanup (void *txq,uint32_t free_cnt); +int fm10k_rxq_vec_setup (struct fm10k_rx_queue *rxq);int fm10k_rx_vec_condition_check (struct rte_eth_dev *);void fm10k_rx_queue_release_mbufs_vec (struct fm10k_rx_queue *rxq);
drivers/net/fm10k/fm10k_ethdev.c +1 -0
@@ -2897,6 +2897,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = { .reta_query = fm10k_reta_query, .rss_hash_update = fm10k_rss_hash_update, .rss_hash_conf_get = fm10k_rss_hash_conf_get, + .tx_done_cleanup = fm10k_tx_done_cleanup, }; static int ftag_check_handler(__rte_unused const char *key,
drivers/net/fm10k/fm10k_rxtx.c +45 -0
51 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 2/5 net/i40e: cleanup Tx buffers
In reply to Chenxu DiAdd support to the i40e driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 122 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + 4 files changed, 125 insertions(+)
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/*
drivers/net/i40e/i40e_rxtx.c +122 -0
128 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx.h +1 -0
@@ -212,6 +212,7 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void i40e_reset_rx_queue (struct i40e_rx_queue *rxq);void i40e_reset_tx_queue (struct i40e_tx_queue *txq);void i40e_tx_queue_release_mbufs (struct i40e_tx_queue *txq); +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt);int i40e_alloc_rx_queue_mbufs (struct i40e_rx_queue *rxq);void i40e_rx_queue_release_mbufs (struct i40e_rx_queue *rxq);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v4 2/5] net/i40e: cleanup Tx buffers
Quoted 71 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Chenxu Di
Sent: Tuesday, December 24, 2019 10:39 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [dpdk-dev] [PATCH v4 2/5] net/i40e: cleanup Tx buffersAdd support to the i40e driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 122 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + 4 files changed, 125 insertions(+)drivers/net/i40e/i40e_ethdev.c +1
-0@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, }; /* store statistics names and its offset in stats structure */ diff --git
a/drivers/net/i40e/i40e_ethdev_vf.cb/drivers/net/i40e/i40e_ethdev_vf.cindex5dba0928b..0ca5417d7100644drivers/net/i40e/i40e_ethdev_vf.c +1
-0@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* drivers/net/i40e/i40e_rxtx.c index renamed from drivers/net/i40e/i40e_rxtx.c +0
-0
17dc8c78f..e75733b8e100644drivers/net/i40e/i40e_rxtx.c +17
-0@@ -2455,6 +2455,128 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) } } +int i40e_tx_done_cleanup (void *q,uint32_t free_cnt) { +struct i40e_tx_queue *txq = (struct i40e_tx_queue *)q; +struct i40e_tx_entry *sw_ring; +volatile struct i40e_tx_desc *txr; +uint16_t tx_first;/* First segment analyzed. */ +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_last;/* Last segment in the current packet. */ +uint16_t tx_next;/* First segment of the next packet. */ +int count; + +if (txq ==NULL ) +return -ENODEV ; + + count =0 ; + sw_ring = txq->sw_ring; + txr = txq->tx_ring; +
drivers/net/i40e/i40e_rxtx.c i40e_tx_queue_release_mbufs(struct · line 2485
Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c +10
-0+/* +* tx_tail is the last sent packet on the sw_ring. Goto the end +* of that packet (the last segment in the packet chain) and +* then the next segment will be the start of the oldest segment +* in the sw_ring. This is the first packet that will be +* attempted to be freed. +*/ + +/* Get last segment in most recently added packet. */ + tx_first = sw_ring[txq->tx_tail].last_id;
Should be tx_last more readable here? And then tx_first = sw_ring[tx_last].next_id?
Quoted 9 lines
drivers/net/i40e/i40e_rxtx.c +9
-0+ +/* Get the next segment, which is the oldest segment in ring. */ + tx_first = sw_ring[tx_first].next_id; + +/* Set the current index to the first. */ + tx_id = tx_first; + +/* +* Loop through each packet. For each packet, verify that an
drivers/net/i40e/i40e_rxtx.c i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq)
Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c +9
-0+* mbuf exists and that the last segment is free. If so, free +* it and move on. +*/ +while (1 ) { + tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { + if ((txr[tx_last].cmd_type_offset_bsz & + rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
Is the logic reversed? '!=' means the mbuf is still in use.
drivers/net/i40e/i40e_rxtx.c i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) · line 2509
Quoted 7 lines
drivers/net/i40e/i40e_rxtx.c +6
-0+ rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) { +/* +* Increment the number of packets +* freed. +*/ + count++;
Should 'count++' be after free mbuf?
Quoted 11 lines
drivers/net/i40e/i40e_rxtx.c +10
-0+ +/* Get the start of the next packet. */ + tx_next = sw_ring[tx_last].next_id; + +/* +* Loop through all segments in a +* packet. +*/ + do { +rte_pktmbuf_free_seg(sw_ring[tx_id].mbuf);
drivers/net/i40e/i40e_rxtx.c i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) · line 2523
Quoted 4 lines
drivers/net/i40e/i40e_rxtx.c +4
-0+ sw_ring[tx_id].mbuf =NULL ; + sw_ring[tx_id].last_id = tx_id; + +/* Move to next segemnt. */
Typo: segemnt -> segment
Quoted 27 lines
drivers/net/i40e/i40e_rxtx.c +27
-0+ tx_id = sw_ring[tx_id].next_id; + + }while (tx_id != tx_next); + +if (unlikely (count == (int )free_cnt)) +break ; + }else { +/* +* mbuf still in use, nothing left to +* free. +*/ +break ; + } + }else { +/* +* There are multiple reasons to be here: +* 1) All the packets on the ring have been +* freed - tx_id is equal to tx_first +* and some packets have been freed. +* - Done, exit +* 2) Interfaces has not sent a rings worth of +* packets yet, so the segment after tail is +* still empty. Or a previous call to this +* function freed some of the segments but +* not all so there is a hole in the list. +* Hopefully this is a rare case. +* - Walk the list and find the next mbuf. If
drivers/net/i40e/i40e_rxtx.c i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) · line 2560
Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c +10
-0+* there isn't one, then done. +*/ +if (likely (tx_id == tx_first && count !=0 )) +break ; + +/* +* Walk the list and find the next mbuf, if any. +*/ + do { + /* Move to next segemnt. */
Typo: segemnt -> segment
Quoted 35 lines
drivers/net/i40e/i40e_rxtx.c +19
-0+ tx_id = sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break ; + + }while (tx_id != tx_first); + +/* +* Determine why previous loop bailed. If there +* is not an mbuf, done. +*/ +if (sw_ring[tx_id].mbuf ==NULL ) +break ; + } + } + +return count; +} +void i40e_reset_tx_queue(struct i40e_tx_queue *txq) { diff --git
a/drivers/net/i40e/i40e_rxtx.hb/drivers/net/i40e/i40e_rxtx.hindex2106bb355..8f11f011a100644drivers/net/i40e/i40e_rxtx.h +0
-0@@ -212,6 +212,7 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void
i40e_reset_rx_queue(struct i40e_rx_queue *rxq); voidi40e_reset_tx_queue(struct i40e_tx_queue *txq); voidi40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq); +inti40e_tx_done_cleanup(void *txq, uint32_t free_cnt);
inti40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq); voidi40e_rx_queue_release_mbufs(struct i40e_rx_queue *rxq);--
2.17.1
PATCH v4 3/5 net/ice: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ice driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 123 +++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + 3 files changed, 125 insertions(+)
drivers/net/ice/ice_ethdev.c +1 -0
@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ice/ice_rxtx.c +123 -0
129 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +1 -0
@@ -183,6 +183,7 @@ int ice_rx_descriptor_status(void *rx_queue, uint16_t offset);int ice_tx_descriptor_status (void *tx_queue,uint16_t offset);void ice_set_default_ptype_table (struct rte_eth_dev *dev);const uint32_t *ice_dev_supported_ptypes_get (struct rte_eth_dev *dev); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_rx_vec_dev_check (struct rte_eth_dev *dev);int ice_tx_vec_dev_check (struct rte_eth_dev *dev);
Signature · 1 line
2.17.1
PATCH v4 4/5 net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ixgbe driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 121 +++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 + 3 files changed, 125 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -0
@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/*
@@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ixgbe/ixgbe_rxtx.c +121 -0
127 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_rxtx.h +2 -0
@@ -285,6 +285,8 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ];
Signature · 1 line
2.17.1
PATCH v4 5/5 net/e1000: cleanup Tx buffers
In reply to Chenxu DiAdd support to the igb vf for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/e1000/igb_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -446,6 +446,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_descriptor_status = eth_igb_tx_descriptor_status, .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, + .tx_done_cleanup = eth_igb_tx_done_cleanup, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get,
Signature · 1 line
2.17.1
v6 cover drivers/net: cleanup Tx buffers
In reply to Chenxu DiAdd support to the drivers inclulding i40e, ice, ixgbe and igb vf for the API rte_eth_tx_done_cleanup to force
free consumed buffers on Tx ring.
---
v2:
added code about igb vf.
v3:
changed information of author
v4:
changed code.
v5:
fixed code and notes.
removed code for fm10k.
v6:
fixed checkpatch warnings
Chenxu Di (4):
net/i40e: cleanup Tx buffers
net/ice: cleanup Tx buffers
net/ixgbe: cleanup Tx buffers
net/e1000: cleanup Tx buffers
drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 121 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 118 +++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 116 ++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 + 11 files changed, 365 insertions(+)
Signature · 1 line
2.17.1
PATCH v6 1/4 net/i40e: cleanup Tx buffers
Add support to the i40e driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 121 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + 4 files changed, 124 insertions(+)
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/*
drivers/net/i40e/i40e_rxtx.c +121 -0
127 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx.h +1 -0
@@ -212,6 +212,7 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void i40e_reset_rx_queue (struct i40e_rx_queue *rxq);void i40e_reset_tx_queue (struct i40e_tx_queue *txq);void i40e_tx_queue_release_mbufs (struct i40e_tx_queue *txq); +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt);int i40e_alloc_rx_queue_mbufs (struct i40e_rx_queue *rxq);void i40e_rx_queue_release_mbufs (struct i40e_rx_queue *rxq);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v6 1/4] net/i40e: cleanup Tx buffers
Quoted 61 lines
Add support to the i40e driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 121 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + 4 files changed, 124 insertions(+)drivers/net/i40e/i40e_ethdev.c +1
-0@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* store statistics names and its offset in stats structure */ drivers/net/i40e/i40e_ethdev_vf.c +1
-0@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* drivers/net/i40e/i40e_rxtx.c +15
-0@@ -2455,6 +2455,127 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) } } +int i40e_tx_done_cleanup (void *q,uint32_t free_cnt) +{ +struct i40e_tx_queue *txq = (struct i40e_tx_queue *)q; +struct i40e_tx_entry *sw_ring; +volatile struct i40e_tx_desc *txr; +uint16_t tx_first;/* First segment analyzed. */ +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_last;/* Last segment in the current packet. */ +uint16_t tx_next;/* First segment of the next packet. */ +int count; + +if (txq ==NULL ) +return -ENODEV ; + + count =0 ;
drivers/net/i40e/i40e_rxtx.c i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) · line 2482
Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c +10
-0+ sw_ring = txq->sw_ring; + txr = txq->tx_ring; + +/* +* tx_tail is the last sent packet on the sw_ring. Goto the end +* of that packet (the last segment in the packet chain) and +* then the next segment will be the start of the oldest segment +* in the sw_ring. This is the first packet that will be +* attempted to be freed. +*/
Pretty much same comments as for ixgbe.
Quoted 113 lines
drivers/net/i40e/i40e_rxtx.c +96
-0+ +/* Get last segment in most recently added packet. */ + tx_last = sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. */ + tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ + tx_id = tx_first; + +/* +* Loop through each packet. For each packet, verify that an +* mbuf exists and that the last segment is free. If so, free +* it and move on. +*/ +while (1 ) { + tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if ((txr[tx_last].cmd_type_offset_bsz & +rte_cpu_to_le_64 (I40E_TXD_QW1_DTYPE_MASK )) != +rte_cpu_to_le_64 (I40E_TX_DESC_DTYPE_DESC_DONE )) +/* +* mbuf still in use, nothing left to +* free. +*/ +break ; + +/* Get the start of the next packet. */ + tx_next = sw_ring[tx_last].next_id; + +/* +* Loop through all segments in a +* packet. +*/ +do { +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); + sw_ring[tx_id].mbuf =NULL ; + sw_ring[tx_id].last_id = tx_id; + +/* Move to next segment. */ + tx_id = sw_ring[tx_id].next_id; + + }while (tx_id != tx_next); + +/* +* Increment the number of packets +* freed. +*/ + count++; + +if (unlikely (count == (int )free_cnt)) +break ; + }else { +/* +* There are multiple reasons to be here: +* 1) All the packets on the ring have been +* freed - tx_id is equal to tx_first +* and some packets have been freed. +* - Done, exit +* 2) Interfaces has not sent a rings worth of +* packets yet, so the segment after tail is +* still empty. Or a previous call to this +* function freed some of the segments but +* not all so there is a hole in the list. +* Hopefully this is a rare case. +* - Walk the list and find the next mbuf. If +* there isn't one, then done. +*/ +if (likely (tx_id == tx_first && count !=0 )) +break ; + +/* +* Walk the list and find the next mbuf, if any. +*/ +do { +/* Move to next segment. */ + tx_id = sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break ; + + }while (tx_id != tx_first); + +/* +* Determine why previous loop bailed. If there +* is not an mbuf, done. +*/ +if (sw_ring[tx_id].mbuf ==NULL ) +break ; + } + } + +return count; +} +void i40e_reset_tx_queue (struct i40e_tx_queue *txq) {drivers/net/i40e/i40e_rxtx.h +1
-1@@ -212,6 +212,7 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void i40e_reset_rx_queue (struct i40e_rx_queue *rxq);void i40e_reset_tx_queue (struct i40e_tx_queue *txq);void i40e_tx_queue_release_mbufs (struct i40e_tx_queue *txq); +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt);int i40e_alloc_rx_queue_mbufs (struct i40e_rx_queue *rxq);void i40e_rx_queue_release_mbufs (struct i40e_rx_queue *rxq); --2.17.1
PATCH v6 2/4 net/ice: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ice driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 118 +++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + 3 files changed, 120 insertions(+)
drivers/net/ice/ice_ethdev.c +1 -0
@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ice/ice_rxtx.c +118 -0
124 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +1 -0
@@ -183,6 +183,7 @@ int ice_rx_descriptor_status(void *rx_queue, uint16_t offset);int ice_tx_descriptor_status (void *tx_queue,uint16_t offset);void ice_set_default_ptype_table (struct rte_eth_dev *dev);const uint32_t *ice_dev_supported_ptypes_get (struct rte_eth_dev *dev); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_rx_vec_dev_check (struct rte_eth_dev *dev);int ice_tx_vec_dev_check (struct rte_eth_dev *dev);
Signature · 1 line
2.17.1
PATCH v6 3/4 net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ixgbe driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 116 +++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 + 3 files changed, 120 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -0
@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/*
@@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ixgbe/ixgbe_rxtx.c +116 -0
122 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_rxtx.h +2 -0
@@ -285,6 +285,8 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ];
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffers
Hi,
Quoted 15 lines
Add support to the ixgbe driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 116 +++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 + 3 files changed, 120 insertions(+)drivers/net/ixgbe/ixgbe_ethdev.c +0
-0
drivers/net/ixgbe/ixgbe_ethdev.c static const struct eth_dev_ops ixgbe_eth_dev_ops = { · line 604
Quoted 4 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1
-0@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup,
Don't see how we can have one tx_done_cleanup() for different tx functions? Vector and scalar TX path use different format for sw_ring[] entries. Also offload and simile TX paths use different method to track used/free descriptors, and use different functions to free them:
offload uses tx_entry next_id, last_id plus txq. last_desc_cleaned, while simple TX paths use tx_next_dd.
Quoted 16 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1
-0};/* @@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */ drivers/net/ixgbe/ixgbe_rxtx.c +0
-0
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2309
Quoted 4 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-0@@ -2306,6 +2306,122 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +int ixgbe_tx_done_cleanup (void *q,uint32_t free_cnt)
That seems to work only for offload(full) TX path (ixgbe_xmit_pkts). Simple(fast) path seems not covered by this function.
Quoted 12 lines
drivers/net/ixgbe/ixgbe_rxtx.c +12
-0+{ +struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)q; +struct ixgbe_tx_entry *sw_ring; +volatile union ixgbe_adv_tx_desc *txr; +uint16_t tx_first;/* First segment analyzed. */ +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_last;/* Last segment in the current packet. */ +uint16_t tx_next;/* First segment of the next packet. */ +int count; + +if (txq ==NULL ) +return -ENODEV ;
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq)
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+ + count =0 ; + sw_ring = txq->sw_ring; + txr = txq->tx_ring; + +/* +* tx_tail is the last sent packet on the sw_ring. Goto the end +* of that packet (the last segment in the packet chain) and +* then the next segment will be the start of the oldest segment +* in the sw_ring.
Not sure I understand the sentence above.tx_tail is the value of TDT HW register (most recently armed by SW TD). last_id is the index of last descriptor for multi-seg packet. next_id is just the index of next descriptor in HW TD ring. How do you conclude that it will be the ' oldest segment in the sw_ring'?
Another question why do you need to write your own functions? Why can't you reuse existing ixgbe_xmit_cleanup() for full(offload) path and ixgbe_tx_free_bufs() for simple path?
Yes, ixgbe_xmit_cleanup() doesn't free mbufs, but at least it could be used to determine finished TX descriptors.
Based on that you can you can free appropriate sw_ring[] entries.
Quoted 112 lines
This is the first packet that will be
drivers/net/ixgbe/ixgbe_rxtx.c +93
-0+* attempted to be freed. +*/ + +/* Get last segment in most recently added packet. */ + tx_last = sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. */ + tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ + tx_id = tx_first; + +/* +* Loop through each packet. For each packet, verify that an +* mbuf exists and that the last segment is free. If so, free +* it and move on. +*/ +while (1 ) { + tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (!(txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD )) +break ; + +/* Get the start of the next packet. */ + tx_next = sw_ring[tx_last].next_id; + +/* +* Loop through all segments in a +* packet. +*/ +do { +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); + sw_ring[tx_id].mbuf =NULL ; + sw_ring[tx_id].last_id = tx_id; + +/* Move to next segment. */ + tx_id = sw_ring[tx_id].next_id; + + }while (tx_id != tx_next); + +/* +* Increment the number of packets +* freed. +*/ + count++; + +if (unlikely (count == (int )free_cnt)) +break ; + }else { +/* +* There are multiple reasons to be here: +* 1) All the packets on the ring have been +* freed - tx_id is equal to tx_first +* and some packets have been freed. +* - Done, exit +* 2) Interfaces has not sent a rings worth of +* packets yet, so the segment after tail is +* still empty. Or a previous call to this +* function freed some of the segments but +* not all so there is a hole in the list. +* Hopefully this is a rare case. +* - Walk the list and find the next mbuf. If +* there isn't one, then done. +*/ +if (likely (tx_id == tx_first && count !=0 )) +break ; + +/* +* Walk the list and find the next mbuf, if any. +*/ +do { +/* Move to next segment. */ + tx_id = sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break ; + + }while (tx_id != tx_first); + +/* +* Determine why previous loop bailed. If there +* is not an mbuf, done. +*/ +if (sw_ring[tx_id].mbuf ==NULL ) +break ; + } + } + +return count; +} +static void __attribute__((cold))ixgbe_tx_free_swring (struct ixgbe_tx_queue *txq) {drivers/net/ixgbe/ixgbe_rxtx.h +2
-1@@ -285,6 +285,8 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ]; --2.17.1
Re: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffers
Hi,
Quoted 29 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Monday, December 30, 2019 8:54 PM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffersHi,
Quoted 19 lines
Add support to the ixgbe driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 116 +++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 + 3 files changed, 120 insertions(+)drivers/net/ixgbe/ixgbe_ethdev.c +0
-0@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get,
Quoted 9 lines
drivers/net/ixgbe/ixgbe_ethdev.c static const struct eth_dev_ops ixgbe_eth_dev_ops · line 604
Quoted 1 line
drivers/net/ixgbe/ixgbe_ethdev.c +1
-0+.tx_done_cleanup = ixgbe_tx_done_cleanup,Don't see how we can have one
tx_done_cleanup()for different tx functions? Vector and scalar TX path use different format for sw_ring[] entries. Also offload and simile TX paths use different method to track used/free descriptors, and use different functions to free them:
offload usestx_entrynext_id,last_idplus txq.last_desc_cleaned, while simple TX paths usetx_next_dd.
This patches will be not include function for Vector, and I will update my code to Make it work for offload and simple .
Quoted 20 lines
drivers/net/ixgbe/ixgbe_ethdev.c static const struct eth_dev_ops ixgbevf_eth_dev_ops
Quoted 5 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0
-0};/* @@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops= {
Quoted 14 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1
-1.reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, +.tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c
b/drivers/net/ixgbe/ixgbe_rxtx.cindexfa572d184..520b9c756100644drivers/net/ixgbe/ixgbe_rxtx.c +0
-0@@ -2306,6 +2306,122 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } }
Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2309
Quoted 1 line
drivers/net/ixgbe/ixgbe_rxtx.c +1
-0+int ixgbe_tx_done_cleanup (void *q,uint32_t free_cnt)That seems to work only for offload(full) TX path (
ixgbe_xmit_pkts). Simple(fast) path seems not covered by this function.
Same as above
Quoted 18 lines
Quoted 18 lines
drivers/net/ixgbe/ixgbe_rxtx.c +18
-0+{ +struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)q;struct +ixgbe_tx_entry *sw_ring;volatile union ixgbe_adv_tx_desc *txr; +uint16_t tx_first;/* First segment analyzed. */ +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_last;/* Last segment in the current packet. */ uint16_t +tx_next;/* First segment of the next packet. */ int count; + +if (txq ==NULL ) +return -ENODEV ; + +count =0 ; +sw_ring = txq->sw_ring; +txr = txq->tx_ring; + +/* +* tx_tail is the last sent packet on the sw_ring. Goto the end +* of that packet (the last segment in the packet chain) and
Quoted 9 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct · line 2328
Quoted 2 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-0+* then the next segment will be the start of the oldest segment +* in the sw_ring. Not sure I understand the sentence above.
tx_tailis the value of TDT HW register (most recently armed by SW TD).last_idis the index of last descriptor for multi-seg packet.next_idis just the index of next descriptor in HW TD ring. How do you conclude that it will be the ' oldest segment in thesw_ring'?
The tx_tail is the last sent packet on the sw_ring. While the xmit_cleanup or Tx_free_bufs will be call when the nb_tx_free < tx_free_thresh .
So the sw_ring[tx_tail].next_id must be the begin of mbufs which are not used or
Already freed . then begin the loop until the mbuf is used and begin to free them.
Quoted 7 lines
Another question why do you need to write your own functions?
Why can't you reuse existingixgbe_xmit_cleanup()for full(offload) path andixgbe_tx_free_bufs()for simple path?
Yes,ixgbe_xmit_cleanup()doesn't free mbufs, but at least it could be used to determine finished TX descriptors.
Based on that you can you can free appropriate sw_ring[] entries.
The reason why I don't reuse existing function is that they all free several mbufs While the free_cnt of the API rte_eth_tx_done_cleanup() is the number of packets. It also need to be done that check which mbuffs are from the same packet.
Quoted 109 lines
Quoted 108 lines
This is the first packet that will be
+ * attempted to be freed.
+ */drivers/net/ixgbe/ixgbe_rxtx.c +87
-0+ +/* Get last segment in most recently added packet. */ tx_last = +sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. */ +tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ tx_id = tx_first; + +/* +* Loop through each packet. For each packet, verify that an +* mbuf exists and that the last segment is free. If so, free +* it and move on. +*/ +while (1 ) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (!(txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD )) +break ; + +/* Get the start of the next packet. */ tx_next = +sw_ring[tx_last].next_id; + +/* +* Loop through all segments in a +* packet. +*/ +do { +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); +sw_ring[tx_id].mbuf =NULL ; +sw_ring[tx_id].last_id = tx_id; + +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +}while (tx_id != tx_next); + +/* +* Increment the number of packets +* freed. +*/ +count++; + +if (unlikely (count == (int )free_cnt))break ; }else { +/* +* There are multiple reasons to be here: +* 1) All the packets on the ring have been +* freed - tx_id is equal to tx_first +* and some packets have been freed. +* - Done, exit +* 2) Interfaces has not sent a rings worth of +* packets yet, so the segment after tail is +* still empty. Or a previous call to this +* function freed some of the segments but +* not all so there is a hole in the list. +* Hopefully this is a rare case. +* - Walk the list and find the next mbuf. If +* there isn't one, then done. +*/ +if (likely (tx_id == tx_first && count !=0 ))break ; + +/* +* Walk the list and find the next mbuf, if any. +*/ +do { +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break ; + +}while (tx_id != tx_first); + +/* +* Determine why previous loop bailed. If there +* is not an mbuf, done. +*/ +if (sw_ring[tx_id].mbuf ==NULL ) +break ; +} +} + +return count; +} +static void __attribute__((cold)) ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq) { diff --git
a/drivers/net/ixgbe/ixgbe_rxtx.hb/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..2c3770af6100644drivers/net/ixgbe/ixgbe_rxtx.h +0
-0@@ -285,6 +285,8 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct
rte_eth_dev*dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +2
-1+int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ]; --2.17.1
Re: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffers
Quoted 103 lines
Quoted 20 lines
Quoted 20 lines
Add support to the ixgbe driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 116 +++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 + 3 files changed, 120 insertions(+)drivers/net/ixgbe/ixgbe_ethdev.c +0
-0@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get,Quoted 9 lines
drivers/net/ixgbe/ixgbe_ethdev.c static const struct eth_dev_ops ixgbe_eth_dev_ops · line 604
Quoted 1 line
drivers/net/ixgbe/ixgbe_ethdev.c +1
-0+.tx_done_cleanup = ixgbe_tx_done_cleanup,Don't see how we can have one
tx_done_cleanup()for different tx functions? Vector and scalar TX path use different format for sw_ring[] entries. Also offload and simile TX paths use different method to track used/free descriptors, and use different functions to free them:
offload usestx_entrynext_id,last_idplus txq.last_desc_cleaned, while simple TX paths usetx_next_dd.This patches will be not include function for Vector, and I will update my code to Make it work for offload and simple .
Quoted 20 lines
drivers/net/ixgbe/ixgbe_ethdev.c static const struct eth_dev_ops ixgbevf_eth_dev_ops
Quoted 5 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0
-0};/* @@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops= {
Quoted 14 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1
-1.reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, +.tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c
b/drivers/net/ixgbe/ixgbe_rxtx.cindexfa572d184..520b9c756100644drivers/net/ixgbe/ixgbe_rxtx.c +0
-0@@ -2306,6 +2306,122 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } }Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2309
Quoted 1 line
drivers/net/ixgbe/ixgbe_rxtx.c +1
-0+int ixgbe_tx_done_cleanup (void *q,uint32_t free_cnt)That seems to work only for offload(full) TX path (
ixgbe_xmit_pkts). Simple(fast) path seems not covered by this function.Same as above
Quoted 18 lines
Quoted 18 lines
drivers/net/ixgbe/ixgbe_rxtx.c +18
-0+{ +struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)q;struct +ixgbe_tx_entry *sw_ring;volatile union ixgbe_adv_tx_desc *txr; +uint16_t tx_first;/* First segment analyzed. */ +uint16_t tx_id;/* Current segment being processed. */ +uint16_t tx_last;/* Last segment in the current packet. */ uint16_t +tx_next;/* First segment of the next packet. */ int count; + +if (txq ==NULL ) +return -ENODEV ; + +count =0 ; +sw_ring = txq->sw_ring; +txr = txq->tx_ring; + +/* +* tx_tail is the last sent packet on the sw_ring. Goto the end +* of that packet (the last segment in the packet chain) and Quoted 9 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct · line 2328
Quoted 2 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-0+* then the next segment will be the start of the oldest segment +* in the sw_ring. Not sure I understand the sentence above.
tx_tailis the value of TDT HW register (most recently armed by SW TD).last_idis the index of last descriptor for multi-seg packet.next_idis just the index of next descriptor in HW TD ring. How do you conclude that it will be the ' oldest segment in thesw_ring'?The
tx_tailis the last sent packet on thesw_ring. While thexmit_cleanuporTx_free_bufswill be call when thenb_tx_free<tx_free_thresh.
So the sw_ring[tx_tail].next_id must be the begin of mbufs which are not used or
Already freed . then begin the loop until the mbuf is used and begin to free them.Quoted 7 lines
Another question why do you need to write your own functions?
Why can't you reuse existingixgbe_xmit_cleanup()for full(offload) path andixgbe_tx_free_bufs()for simple path?
Yes,ixgbe_xmit_cleanup()doesn't free mbufs, but at least it could be used to determine finished TX descriptors.
Based on that you can you can free appropriate sw_ring[] entries.
Quoted 3 lines
The reason why I don't reuse existing function is that they all free several mbufs While the
free_cntof the APIrte_eth_tx_done_cleanup()is the number of packets. It also need to be done that check which mbuffs are from the same packet.
At first, I don't see anything bad if tx_done_cleanup() will free only some segments from the packet. As long as it is safe - there is no problem with that.
I think rte_eth_tx_done_cleanup() operates on mbuf, not packet quantities. But in our case I think it doesn't matter, as ixgbe_xmit_cleanup()
mark TXDs as free only when HW is done with all TXDs for that packet.
As long as there is a way to reuse existing code and avoid duplication (without introducing any degradation) - we should use it.
And I think there is a very good opportunity here to reuse existing ixgbe_xmit_cleanup() for tx_done_cleanup() implementation.
Moreover because your code doesn't follow ixgbe_xmit_pkts()/ixgbe_xmit_cleanup() logic and infrastructure, it introduces unnecessary scans over TXD ring, and in some cases doesn't work as expected:
+ while (1) {
+ tx_last = sw_ring[tx_id].last_id;
+
+ if (sw_ring[tx_last].mbuf) {
+ if (txr[tx_last].wb.status &
+ IXGBE_TXD_STAT_DD) {
...
+ } else {
+ /*
+ * mbuf still in use, nothing left to
+ * free.
+ */
+ break;
It is not correct to expect that IXGBE_TXD_STAT_DD will be set on last TXD for *every* packet. We set IXGBE_TXD_CMD_RS bit only on threshold packet last descriptor.
Plus ixgbe_xmit_cleanup() can cleanup TXD wb.status.
So I strongly recommend to reuse ixgbe_xmit_cleanup() here.
It would be much less error prone and will help to avoid code duplication.
Konstantin
Quoted 112 lines
Quoted 111 lines
Quoted 110 lines
This is the first packet that will be
+ * attempted to be freed.
+ */drivers/net/ixgbe/ixgbe_rxtx.c +87
-0+ +/* Get last segment in most recently added packet. */ tx_last = +sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. */ +tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ tx_id = tx_first; + +/* +* Loop through each packet. For each packet, verify that an +* mbuf exists and that the last segment is free. If so, free +* it and move on. +*/ +while (1 ) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (!(txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD )) +break ; + +/* Get the start of the next packet. */ tx_next = +sw_ring[tx_last].next_id; + +/* +* Loop through all segments in a +* packet. +*/ +do { +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); +sw_ring[tx_id].mbuf =NULL ; +sw_ring[tx_id].last_id = tx_id; + +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +}while (tx_id != tx_next); + +/* +* Increment the number of packets +* freed. +*/ +count++; + +if (unlikely (count == (int )free_cnt))break ; }else { +/* +* There are multiple reasons to be here: +* 1) All the packets on the ring have been +* freed - tx_id is equal to tx_first +* and some packets have been freed. +* - Done, exit +* 2) Interfaces has not sent a rings worth of +* packets yet, so the segment after tail is +* still empty. Or a previous call to this +* function freed some of the segments but +* not all so there is a hole in the list. +* Hopefully this is a rare case. +* - Walk the list and find the next mbuf. If +* there isn't one, then done. +*/ +if (likely (tx_id == tx_first && count !=0 ))break ; + +/* +* Walk the list and find the next mbuf, if any. +*/ +do { +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break ; + +}while (tx_id != tx_first); + +/* +* Determine why previous loop bailed. If there +* is not an mbuf, done. +*/ +if (sw_ring[tx_id].mbuf ==NULL ) +break ; +} +} + +return count; +} +static void __attribute__((cold)) ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq) { diff --git
a/drivers/net/ixgbe/ixgbe_rxtx.hb/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..2c3770af6100644drivers/net/ixgbe/ixgbe_rxtx.h +0
-0@@ -285,6 +285,8 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct
rte_eth_dev*dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +2
-1+int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ]; --2.17.1
Re: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffers
Quoted 12 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Monday, January 6, 2020 7:36 AM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffersQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
Add support to the ixgbe driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.
[snip]
Quoted 68 lines
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
+ *
tx_tailis the last sent packet on thesw_ring. Goto the end
+ * of that packet (the last segment in the packet chain) and
+ * then the next segment will be the start of the oldest segment
+ * in thesw_ring.Not sure I understand the sentence above.
tx_tailis the value of TDT HW register (most recently armed by SW TD).last_idis the index of last descriptor for multi-seg packet.next_idis just the index of next descriptor in HW TD ring. How do you conclude that it will be the ' oldest segment in thesw_ring'?Quoted 2 lines
The
tx_tailis the last sent packet on thesw_ring. While thexmit_cleanuporTx_free_bufswill be call when thenb_tx_free<
tx_free_thresh.Quoted 2 lines
So the sw_ring[tx_tail].next_id must be the begin of mbufs which are not used or Already freed . then begin the loop until the mbuf is used and
begin to free them.
Quoted 12 lines
Quoted 11 lines
Another question why do you need to write your own functions? Why can't you reuse existing
ixgbe_xmit_cleanup()for full(offload) path andixgbe_tx_free_bufs()for simple path?
Yes,ixgbe_xmit_cleanup()doesn't free mbufs, but at least it could be used to determine finished TX descriptors.
Based on that you can you can free appropriate sw_ring[] entries.Quoted 2 lines
The reason why I don't reuse existing function is that they all free several mbufs While the
free_cntof the APIrte_eth_tx_done_cleanup()is thenumber of packets.
Quoted 1 line
It also need to be done that check which mbuffs are from the same packet.
At first, I don't see anything bad if
tx_done_cleanup()will free only some segments from the packet. As long as it is safe - there is no problem with that. I thinkrte_eth_tx_done_cleanup()operates on mbuf, not packet quantities. But in our case I think it doesn't matter, asixgbe_xmit_cleanup()mark TXDs as free only when HW is done with all TXDs for that packet.
As long as there is a way to reuse existing code and avoid duplication (without introducing any degradation) - we should use it.
And I think there is a very good opportunity here to reuse existingixgbe_xmit_cleanup()fortx_done_cleanup()implementation.
Moreover because your code doesn't follow ixgbe_xmit_pkts()/ixgbe_xmit_cleanup()
logic and infrastructure, it introduces unnecessary scans over TXD ring, and in some cases doesn't work as expected:drivers/net/ixgbe/ixgbe_rxtx.c +12
-0+while (1 ) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD ) { +}else { +/* +* mbuf still in use, nothing left to +* free. +*/ +break ;It is not correct to expect that
IXGBE_TXD_STAT_DDwill be set on last TXD for *every* packet.
We setIXGBE_TXD_CMD_RSbit only on threshold packet last descriptor. Plusixgbe_xmit_cleanup()can cleanup TXD wb.status.
Quoted 5 lines
So I strongly recommend to reuse
ixgbe_xmit_cleanup()here.
It would be much less error prone and will help to avoid code duplication.Konstantin
At first.
The function ixgbe_xmit_cleanup(struct ixgbe_tx_queue *txq) will cleanup TXD wb.status. the number of status cleanuped is always txq->tx_rs_thresh.
The API rte_eth_tx_done_cleanup() in rte_eth_dev.h show that
@param free_cnt
* Maximum number of packets to free. Use 0 to indicate all possible packets
* should be freed. Note that a packet may be using multiple mbufs.
a number must be set while ixgbe_xmit_cleanup and ixgbe_tx_free_bufs only have one parameter txq. And what should do is not only free buffers and status but also check which bufs are from
One packet and count the packet freed.
So I think it can't be implemented that reuse function xmit_cleanup without change it. And create a new function with the code of xmit_cleanup will cause many duplication.
Above all , it seem not a perfect idea to reuse ixgbe_xmit_cleanup().
Second.
The function in patch is copy from code in igb_rxtx.c. it already updated in 2017, The commit id is 8d907d2b79f7a54c809f1c44970ff455fa2865e1.
I trust the logic of code is right.
Actually it don't complete for ixgbe, i40e and ice, while it don't change the value of last_desc_cleaned and tx_next_dd. And it's beginning prefer last_desc_cleaned or
tx_next_dd(for offload or simple) to tx_tail.
So, I suggest to use the old function and fix the issue.
Quoted 114 lines
Quoted 113 lines
Quoted 112 lines
Quoted 111 lines
This is the first packet that will be
+ * attempted to be freed.
+ */drivers/net/ixgbe/ixgbe_rxtx.c +87
-0+ +/* Get last segment in most recently added packet. */ tx_last = +sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. */ +tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ tx_id = tx_first; + +/* +* Loop through each packet. For each packet, verify that an +* mbuf exists and that the last segment is free. If so, free +* it and move on. +*/ +while (1 ) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (!(txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD )) +break ; + +/* Get the start of the next packet. */ tx_next = +sw_ring[tx_last].next_id; + +/* +* Loop through all segments in a +* packet. +*/ +do { +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); +sw_ring[tx_id].mbuf =NULL ; +sw_ring[tx_id].last_id = tx_id; + +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +}while (tx_id != tx_next); + +/* +* Increment the number of packets +* freed. +*/ +count++; + +if (unlikely (count == (int )free_cnt))break ; }else { +/* +* There are multiple reasons to be here: +* 1) All the packets on the ring have been +* freed - tx_id is equal to tx_first +* and some packets have been freed. +* - Done, exit +* 2) Interfaces has not sent a rings worth of +* packets yet, so the segment after tail is +* still empty. Or a previous call to this +* function freed some of the segments but +* not all so there is a hole in the list. +* Hopefully this is a rare case. +* - Walk the list and find the next mbuf. If +* there isn't one, then done. +*/ +if (likely (tx_id == tx_first && count !=0 ))break ; + +/* +* Walk the list and find the next mbuf, if any. +*/ +do { +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break ; + +}while (tx_id != tx_first); + +/* +* Determine why previous loop bailed. If there +* is not an mbuf, done. +*/ +if (sw_ring[tx_id].mbuf ==NULL ) +break ; +} +} + +return count; +} + static void __attribute__((cold)) ixgbe_tx_free_swring(struct
ixgbe_tx_queue*txq) { diff --gita/drivers/net/ixgbe/ixgbe_rxtx.hb/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..2c3770af6100644drivers/net/ixgbe/ixgbe_rxtx.h +0
-0@@ -285,6 +285,8 @@ int
ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +2
-1+int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ]; --2.17.1
Re: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffers
Quoted 73 lines
Quoted 73 lines
Quoted 14 lines
Quoted 7 lines
Quoted 6 lines
+ *
tx_tailis the last sent packet on thesw_ring. Goto the end
+ * of that packet (the last segment in the packet chain) and
+ * then the next segment will be the start of the oldest segment
+ * in thesw_ring.Quoted 6 lines
Not sure I understand the sentence above.
tx_tailis the value of TDT HW register (most recently armed by SW TD).last_idis the index of last descriptor for multi-seg packet.next_idis just the index of next descriptor in HW TD ring. How do you conclude that it will be the ' oldest segment in thesw_ring'?Quoted 2 lines
The
tx_tailis the last sent packet on thesw_ring. While thexmit_cleanuporTx_free_bufswill be call when thenb_tx_free<
tx_free_thresh.Quoted 2 lines
So the sw_ring[tx_tail].next_id must be the begin of mbufs which are not used or Already freed . then begin the loop until the mbuf is used and
begin to free them.
Quoted 12 lines
Quoted 11 lines
Another question why do you need to write your own functions? Why can't you reuse existing
ixgbe_xmit_cleanup()for full(offload) path andixgbe_tx_free_bufs()for simple path?
Yes,ixgbe_xmit_cleanup()doesn't free mbufs, but at least it could be used to determine finished TX descriptors.
Based on that you can you can free appropriate sw_ring[] entries.Quoted 2 lines
The reason why I don't reuse existing function is that they all free several mbufs While the
free_cntof the APIrte_eth_tx_done_cleanup()is thenumber of packets.
Quoted 1 line
It also need to be done that check which mbuffs are from the same packet.
At first, I don't see anything bad if
tx_done_cleanup()will free only some segments from the packet. As long as it is safe - there is no problem with that. I thinkrte_eth_tx_done_cleanup()operates on mbuf, not packet quantities. But in our case I think it doesn't matter, asixgbe_xmit_cleanup()mark TXDs as free only when HW is done with all TXDs for that packet.
As long as there is a way to reuse existing code and avoid duplication (without introducing any degradation) - we should use it.
And I think there is a very good opportunity here to reuse existingixgbe_xmit_cleanup()fortx_done_cleanup()implementation.
Moreover because your code doesn’t follow ixgbe_xmit_pkts()/ixgbe_xmit_cleanup()
logic and infrastructure, it introduces unnecessary scans over TXD ring, and in some cases doesn't work as expected:drivers/net/ixgbe/ixgbe_rxtx.c +12
-0+while (1 ) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD ) { +}else { +/* +* mbuf still in use, nothing left to +* free. +*/ +break ;It is not correct to expect that
IXGBE_TXD_STAT_DDwill be set on last TXD for *every* packet.
We setIXGBE_TXD_CMD_RSbit only on threshold packet last descriptor. Plusixgbe_xmit_cleanup()can cleanup TXD wb.status.So I strongly recommend to reuse
ixgbe_xmit_cleanup()here.
It would be much less error prone and will help to avoid code duplication.
Quoted 6 lines
Quoted 2 lines
Konstantin
At first.
The functionixgbe_xmit_cleanup(struct ixgbe_tx_queue *txq)will cleanup TXD wb.status. the number of status cleanuped is alwaystxq->tx_rs_thresh.
Yes, and what's wrong with it?
Review
Quoted 5 lines
The API
rte_eth_tx_done_cleanup()inrte_eth_dev.hshow that
@paramfree_cnt(quoted diff) +0
-0* Maximum number of packets to free. Use 0 to indicate all possible packets * should be freed. Note that a packet may be using multiple mbufs.
I don't think it is a good approach, better would be to report number of freed mbufs, but ok, as it is a public API, we probably need to keep it as it is.
Quoted 1 line
a number must be set while
ixgbe_xmit_cleanupandixgbe_tx_free_bufsonly have one parameter txq.
Yes, ixgbe_xmit_cleanup() cleans up at least txq->tx_rs_thresh TXDs. So if user requested more packets to be freed we can call ixgbe_xmit_cleanup() in a loop.
Quoted 2 lines
And what should do is not only free buffers and status but also check which bufs are from
One packet and count the packet freed.
ixgbe_xmit_cleanup() itself doesn't free mbufs itself. It only cleans up TXDs.
So in tx_done_cleanup() after calling ixgbe_xmit_cleanup() you'll still need to go through sw_ring[]
entries that correspond to free TXDs and call mbuf_seg_free(). You can count number of full packets here.
Quoted 2 lines
So I think it can't be implemented that reuse function
xmit_cleanupwithout change it. And create a new function with the code ofxmit_cleanupwill cause many duplication.
I don't think it would.
I think all we need here is something like that
(note it is schematic one, doesn't take into accounf that TXD ring is circular):
tx_done_cleanup(..., uint32_t cnt)
{
/* we have txq->nb_tx_free TXDs starting from txq->tx_tail.
Scan them first and free as many mbufs as we can.
If we need more mbufs to free call ixgbe_xmit_cleanup()
to free more TXDs. */
swr = txq->sw_ring;
txr = txq->tx_ring;
id = txq->tx_tail;
free = txq->nb_tx_free;
for (n = 0; n < cnt && free != 0; ) {
for (j = 0; j != free && n < cnt; j++) {
swe = &swr[id + j];
if (swe->mbuf != NULL) {
rte_pktmbuf_free_seg(swe->mbuf);
swe->mbuf = NULL;
}
n += (swe->last_id == id + j)
}
if (n < cnt) {
ixgbe_xmit_cleanup(txq);
free = txq->nb_tx_free - free;
}
}
return n;
}Quoted 2 lines
Above all , it seem not a perfect idea to reuse
ixgbe_xmit_cleanup().
Totally disagree, see above.
Quoted 4 lines
Second.
The function in patch is copy from code inigb_rxtx.c. it already updated in 2017, The commit id is8d907d2b79f7a54c809f1c44970ff455fa2865e1.
I realized that.
But I think it as a problem, not a positive thing.
While they do have some similarities, igb abd ixgbe are PMDs for different devices, and their TX code differs quite a lot. Let say igb doesn't use tx_rs_threshold, but instead set RS bit for each last TXD.
So, just blindly copying tx_done_cleanup() from igb to ixgbe doesn't look like a good idea to me.
Quoted 122 lines
I trust the logic of code is right.
Actually it don't complete for ixgbe, i40e and ice, while it don't change the value oflast_desc_cleanedandtx_next_dd. And it's beginning preferlast_desc_cleanedor
tx_next_dd(for offload or simple)totx_tail.So, I suggest to use the old function and fix the issue.
Quoted 114 lines
Quoted 113 lines
Quoted 112 lines
Quoted 111 lines
This is the first packet that will be
+ * attempted to be freed.
+ */drivers/net/ixgbe/ixgbe_rxtx.c +87
-0+ +/* Get last segment in most recently added packet. */ tx_last = +sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. */ +tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ tx_id = tx_first; + +/* +* Loop through each packet. For each packet, verify that an +* mbuf exists and that the last segment is free. If so, free +* it and move on. +*/ +while (1 ) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (!(txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD )) +break ; + +/* Get the start of the next packet. */ tx_next = +sw_ring[tx_last].next_id; + +/* +* Loop through all segments in a +* packet. +*/ +do { +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); +sw_ring[tx_id].mbuf =NULL ; +sw_ring[tx_id].last_id = tx_id; + +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +}while (tx_id != tx_next); + +/* +* Increment the number of packets +* freed. +*/ +count++; + +if (unlikely (count == (int )free_cnt))break ; }else { +/* +* There are multiple reasons to be here: +* 1) All the packets on the ring have been +* freed - tx_id is equal to tx_first +* and some packets have been freed. +* - Done, exit +* 2) Interfaces has not sent a rings worth of +* packets yet, so the segment after tail is +* still empty. Or a previous call to this +* function freed some of the segments but +* not all so there is a hole in the list. +* Hopefully this is a rare case. +* - Walk the list and find the next mbuf. If +* there isn't one, then done. +*/ +if (likely (tx_id == tx_first && count !=0 ))break ; + +/* +* Walk the list and find the next mbuf, if any. +*/ +do { +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break ; + +}while (tx_id != tx_first); + +/* +* Determine why previous loop bailed. If there +* is not an mbuf, done. +*/ +if (sw_ring[tx_id].mbuf ==NULL ) +break ; +} +} + +return count; +} + static void __attribute__((cold)) ixgbe_tx_free_swring(struct
ixgbe_tx_queue*txq) { diff --gita/drivers/net/ixgbe/ixgbe_rxtx.hb/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..2c3770af6100644drivers/net/ixgbe/ixgbe_rxtx.h +0
-0@@ -285,6 +285,8 @@ int
ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +2
-1+int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ]; --2.17.1
Re: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffers
Hi
Quoted 105 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Monday, January 6, 2020 9:26 PM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffersQuoted 33 lines
Quoted 33 lines
Quoted 14 lines
Quoted 7 lines
Quoted 6 lines
+ *
tx_tailis the last sent packet on thesw_ring. Goto the
+ end
+ * of that packet (the last segment in the packet chain) and
+ * then the next segment will be the start of the oldest
+ segment
+ * in thesw_ring.Quoted 6 lines
Not sure I understand the sentence above.
tx_tailis the value of TDT HW register (most recently armed by SW TD).last_idis the index of last descriptor for multi-seg packet.next_idis just the index of next descriptor in HW TD ring. How do you conclude that it will be the ' oldest segment in thesw_ring'?Quoted 2 lines
The
tx_tailis the last sent packet on thesw_ring. While thexmit_cleanuporTx_free_bufswill be call when thenb_tx_free<
tx_free_thresh.Quoted 3 lines
So the sw_ring[tx_tail].next_id must be the begin of mbufs which are not used or Already freed . then begin the loop until the mbuf is used and
begin to free them.
Quoted 12 lines
Quoted 11 lines
Another question why do you need to write your own functions? Why can't you reuse existing
ixgbe_xmit_cleanup()for full(offload) path andixgbe_tx_free_bufs()for simple path?
Yes,ixgbe_xmit_cleanup()doesn't free mbufs, but at least it could be used to determine finished TX descriptors. Based on that you can you can free appropriate sw_ring[] entries.Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
The reason why I don't reuse existing function is that they all free several mbufs While the
free_cntof the APIrte_eth_tx_done_cleanup()is thenumber of packets.
Quoted 1 line
It also need to be done that check which mbuffs are from the same packet.
At first, I don't see anything bad if
tx_done_cleanup()will free only some segments from the packet. As long as it is safe - there is noproblem with that.
Quoted 32 lines
Quoted 32 lines
I think
rte_eth_tx_done_cleanup()operates on mbuf, not packet quantities. But in our case I think it doesn't matter, asixgbe_xmit_cleanup()mark TXDs as free only when HW is done with all TXDs for that packet. As long as there is a way to reuse existing code and avoid duplication (without introducing any degradation) - we should use it. And I think there is a very good opportunity here to reuse existingixgbe_xmit_cleanup()fortx_done_cleanup()implementation. Moreover because your code doesn’t follow ixgbe_xmit_pkts()/ixgbe_xmit_cleanup()
logic and infrastructure, it introduces unnecessary scans over TXD ring, and in some cases doesn't work as expected:drivers/net/ixgbe/ixgbe_rxtx.c +12
-0+while (1 ) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD ) { +}else { +/* +* mbuf still in use, nothing left to +* free. +*/ +break ;It is not correct to expect that
IXGBE_TXD_STAT_DDwill be set on last TXD for
*every* packet.
We setIXGBE_TXD_CMD_RSbit only on threshold packet last descriptor. Plusixgbe_xmit_cleanup()can cleanup TXD wb.status.Quoted 8 lines
Quoted 5 lines
So I strongly recommend to reuse
ixgbe_xmit_cleanup()here.
It would be much less error prone and will help to avoid code duplication.Konstantin
At first.
The functionixgbe_xmit_cleanup(struct ixgbe_tx_queue *txq)will cleanupTXD wb.status.
Quoted 1 line
the number of status cleanuped is always
txq->tx_rs_thresh.Yes, and what's wrong with it?
Quoted 5 lines
The API
rte_eth_tx_done_cleanup()inrte_eth_dev.hshow that @paramfree_cnt
* Maximum number of packets to free. Use 0 to indicate all possible packets
* should be freed. Note that a packet may be using multiple mbufs.I don't think it is a good approach, better would be to report number of freed mbufs, but ok, as it is a public API, we probably need to keep it as it is.
Quoted 7 lines
Quoted 1 line
a number must be set while
ixgbe_xmit_cleanupandixgbe_tx_free_bufsonlyhave one parameter txq.
Yes,
ixgbe_xmit_cleanup()cleans up at leasttxq->tx_rs_threshTXDs. So if user requested more packets to be freed we can callixgbe_xmit_cleanup()in a loop.
That is a great idea and I discuss with my workmate about it today. there is also some Question that we don’t confirm.
Actually it can call ixgbe_xmit_cleanup() in a loop if user requested more packets, How to deal with the MOD. For example:
The default tx_rs_thresh is 32.if the count of mbufs we need free is 50. We can call ixgbe_xmit_cleanup() one time to free 32 mbufs.
Then how about other 18 mbufs.
1.If we do nothing, it looks not good.
2.if we call ixgbe_xmit_cleanup() successfully, we free 14 mbufs more. 3.if we call ixgbe_xmit_cleanup() fail, the status of No.32 mbufs is not DD
While No .18 is DD. So we do not free 18 mbufs what we can and should free.
We have try some plans about it, likes add parameter for ixgbe_xmit_cleanup(), change
Tx_rs_thresh or copy the code or ixgbe_xmit_cleanup() as a new function with more
Parameter. But all of them seem not perfect.
So can you give some comment about it? It seems not easy as we think by reuse function.
Quoted 192 lines
Quoted 2 lines
And what should do is not only free buffers and status but also check which bufs are from One packet and count the packet freed.
ixgbe_xmit_cleanup()itself doesn't free mbufs itself.
It only cleans up TXDs.
So intx_done_cleanup()after callingixgbe_xmit_cleanup()you'll still need to go through sw_ring[] entries that correspond to free TXDs and callmbuf_seg_free(). You can count number of full packets here.Quoted 1 line
So I think it can't be implemented that reuse function
xmit_cleanupwithoutchange it.
Quoted 1 line
And create a new function with the code of
xmit_cleanupwill cause manyduplication.
I don't think it would.
I think all we need here is something like that (note it is schematic one, doesn't take into accounf that TXD ring is circular):
tx_done_cleanup(..., uint32_t cnt){ /* we have txq->nb_tx_free TXDs starting from txq->tx_tail. Scan them first and free as many mbufs as we can. If we need more mbufs to free call ixgbe_xmit_cleanup() to free more TXDs. */ swr = txq->sw_ring; txr = txq->tx_ring; id = txq->tx_tail; free = txq->nb_tx_free; for (n = 0; n < cnt && free != 0; ) { for (j = 0; j != free && n < cnt; j++) { swe = &swr[id + j]; if (swe->mbuf != NULL) { rte_pktmbuf_free_seg(swe->mbuf); swe->mbuf = NULL; } n += (swe->last_id == id + j) } if (n < cnt) { ixgbe_xmit_cleanup(txq); free = txq->nb_tx_free - free; } } return n; }Quoted 2 lines
Above all , it seem not a perfect idea to reuse
ixgbe_xmit_cleanup().Totally disagree, see above.
Quoted 4 lines
Second.
The function in patch is copy from code inigb_rxtx.c. it already updated in 2017, The commit id is
8d907d2b79f7a54c809f1c44970ff455fa2865e1.I realized that.
But I think it as a problem, not a positive thing.
While they do have some similarities, igb abd ixgbe are PMDs for different devices, and their TX code differs quite a lot. Let say igb doesn't usetx_rs_threshold, but instead set RS bit for each last TXD.
So, just blindly copyingtx_done_cleanup()from igb to ixgbe doesn't look like a good idea to me.Quoted 4 lines
I trust the logic of code is right.
Actually it don't complete for ixgbe, i40e and ice, while it don't change the value oflast_desc_cleanedandtx_next_dd. And it's beginning preferlast_desc_cleanedortx_next_dd(for offload or simple)to
tx_tail.Quoted 118 lines
So, I suggest to use the old function and fix the issue.
Quoted 114 lines
Quoted 113 lines
Quoted 112 lines
Quoted 111 lines
This is the first packet that will be
+ * attempted to be freed.
+ */drivers/net/ixgbe/ixgbe_rxtx.c +84
-0+ +/* Get last segment in most recently added packet. */ tx_last += sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. +*/ tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ tx_id = tx_first; + +/* +* Loop through each packet. For each packet, verify that an +* mbuf exists and that the last segment is free. If so, free +* it and move on. +*/ +while (1 ) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (!(txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD )) +break ; + +/* Get the start of the next packet. */ tx_next = +sw_ring[tx_last].next_id; + +/* +* Loop through all segments in a +* packet. +*/ +do { +rte_pktmbuf_free_seg (sw_ring[tx_id].mbuf); +sw_ring[tx_id].mbuf =NULL ; +sw_ring[tx_id].last_id = tx_id; + +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +}while (tx_id != tx_next); + +/* +* Increment the number of packets +* freed. +*/ +count++; + +if (unlikely (count == (int )free_cnt))break ; }else { +/* +* There are multiple reasons to be here: +* 1) All the packets on the ring have been +* freed - tx_id is equal to tx_first +* and some packets have been freed. +* - Done, exit +* 2) Interfaces has not sent a rings worth of +* packets yet, so the segment after tail is +* still empty. Or a previous call to this +* function freed some of the segments but +* not all so there is a hole in the list. +* Hopefully this is a rare case. +* - Walk the list and find the next mbuf. If +* there isn't one, then done. +*/ +if (likely (tx_id == tx_first && count !=0 ))break ; + +/* +* Walk the list and find the next mbuf, if any. +*/ +do { +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break ; + +}while (tx_id != tx_first); + +/* +* Determine why previous loop bailed. If there +* is not an mbuf, done. +*/ +if (sw_ring[tx_id].mbuf ==NULL )break ; } } + +return count; +} + static void __attribute__((cold))
ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq){ diff --gita/drivers/net/ixgbe/ixgbe_rxtx.hb/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..2c3770af6100644drivers/net/ixgbe/ixgbe_rxtx.h +0
-0@@ -285,6 +285,8 @@ int
ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +2
-0+int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ]; extern const uint32_tptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX];
--
2.17.1
Re: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffers
Hi Chenxu,
Quoted 116 lines
Quoted 96 lines
Quoted 33 lines
Quoted 33 lines
Quoted 14 lines
Quoted 7 lines
Quoted 6 lines
+ *
tx_tailis the last sent packet on thesw_ring. Goto the
+ end
+ * of that packet (the last segment in the packet chain) and
+ * then the next segment will be the start of the oldest
+ segment
+ * in thesw_ring.Quoted 6 lines
Not sure I understand the sentence above.
tx_tailis the value of TDT HW register (most recently armed by SW TD).last_idis the index of last descriptor for multi-seg packet.next_idis just the index of next descriptor in HW TD ring. How do you conclude that it will be the ' oldest segment in thesw_ring'?Quoted 2 lines
The
tx_tailis the last sent packet on thesw_ring. While thexmit_cleanuporTx_free_bufswill be call when thenb_tx_free<
tx_free_thresh.Quoted 3 lines
So the sw_ring[tx_tail].next_id must be the begin of mbufs which are not used or Already freed . then begin the loop until the mbuf is used and
begin to free them.
Quoted 12 lines
Quoted 11 lines
Another question why do you need to write your own functions? Why can't you reuse existing
ixgbe_xmit_cleanup()for full(offload) path andixgbe_tx_free_bufs()for simple path?
Yes,ixgbe_xmit_cleanup()doesn't free mbufs, but at least it could be used to determine finished TX descriptors. Based on that you can you can free appropriate sw_ring[] entries.Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
The reason why I don't reuse existing function is that they all free several mbufs While the
free_cntof the APIrte_eth_tx_done_cleanup()is thenumber of packets.
Quoted 1 line
It also need to be done that check which mbuffs are from the same packet.
At first, I don't see anything bad if
tx_done_cleanup()will free only some segments from the packet. As long as it is safe - there is noproblem with that.
Quoted 32 lines
Quoted 32 lines
I think
rte_eth_tx_done_cleanup()operates on mbuf, not packet quantities. But in our case I think it doesn't matter, asixgbe_xmit_cleanup()mark TXDs as free only when HW is done with all TXDs for that packet. As long as there is a way to reuse existing code and avoid duplication (without introducing any degradation) - we should use it. And I think there is a very good opportunity here to reuse existingixgbe_xmit_cleanup()fortx_done_cleanup()implementation. Moreover because your code doesn’t follow ixgbe_xmit_pkts()/ixgbe_xmit_cleanup()
logic and infrastructure, it introduces unnecessary scans over TXD ring, and in some cases doesn't work as expected:(quoted diff) +12
-0+while (1) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD) { +} else { +/* + * mbuf still in use, nothing left to + * free. + */ +break;It is not correct to expect that
IXGBE_TXD_STAT_DDwill be set on last TXD for
*every* packet.
We setIXGBE_TXD_CMD_RSbit only on threshold packet last descriptor. Plusixgbe_xmit_cleanup()can cleanup TXD wb.status.Quoted 8 lines
Quoted 5 lines
So I strongly recommend to reuse
ixgbe_xmit_cleanup()here.
It would be much less error prone and will help to avoid code duplication.Konstantin
At first.
The functionixgbe_xmit_cleanup(struct ixgbe_tx_queue *txq)will cleanupTXD wb.status.
Quoted 1 line
the number of status cleanuped is always
txq->tx_rs_thresh.Yes, and what's wrong with it?
Quoted 5 lines
The API
rte_eth_tx_done_cleanup()inrte_eth_dev.hshow that @paramfree_cnt
* Maximum number of packets to free. Use 0 to indicate all possible packets
* should be freed. Note that a packet may be using multiple mbufs.I don't think it is a good approach, better would be to report number of freed mbufs, but ok, as it is a public API, we probably need to keep it as it is.
Quoted 7 lines
Quoted 1 line
a number must be set while
ixgbe_xmit_cleanupandixgbe_tx_free_bufsonlyhave one parameter txq.
Yes,
ixgbe_xmit_cleanup()cleans up at leasttxq->tx_rs_threshTXDs. So if user requested more packets to be freed we can callixgbe_xmit_cleanup()in a loop.That is a great idea and I discuss with my workmate about it today. there is also some Question that we don’t confirm.
Actually it can callixgbe_xmit_cleanup()in a loop if user requested more packets, How to deal with the MOD. For example:
The defaulttx_rs_threshis 32.if the count of mbufs we need free is 50. We can callixgbe_xmit_cleanup()one time to free 32 mbufs.
Then how about other 18 mbufs.
1.If we do nothing, it looks not good.
2.if we callixgbe_xmit_cleanup()successfully, we free 14 mbufs more. 3.if we callixgbe_xmit_cleanup()fail, the status of No.32 mbufs is not DD
While No .18 is DD. So we do not free 18 mbufs what we can and should free.
Quoted 5 lines
We have try some plans about it, likes add parameter for
ixgbe_xmit_cleanup(), change
Tx_rs_threshor copy the code orixgbe_xmit_cleanup()as a new function with more
Parameter. But all of them seem not perfect.So can you give some comment about it? It seems not easy as we think by reuse function.
My thought about it:
for situations when cnt % rs_thresh != 0
we'll still call ixgbe_xmit_cleanup() cnt / rs_thresh + 1 times. But then, we can free just cnt % rs_thresh mbufs, while keeping rest of them intact.
Let say at some moment we have txq->nb_tx_free==0,
and user called tx_done_cleanup(txq, ..., cnt==50)
So we call ixgbe_xmit_cleanup(txq) first time.
Suppose it frees 32 TXDs, then we walk through corresponding sw_ring[] entries and let say free 32 packets (one mbuf per packet). Then we call ixgbe_xmit_cleanup(txq) second time. Suppose it will free another 32 TXDs, we again walk thour sw_ring[], but free only first 18 mbufs and return.
Suppose we call tx_done_cleanup(txq, cnt=50) immediately again. Now txq->nb_tx_free==64, so we can start to scan sw_entries[] from tx_tail straightway. We'll skip first 50 entries as they are already empty, then free remaining 14 mbufs, then will call ixgbe_xmit_cleanup(txq) again, and if it would be successful, will scan and free another 32 sw_ring[] entries.
Then again will call ixgbe_xmit_cleanup(txq), but will free only first 8 available sw_ring[].mbuf.
Probably a bit easier with the code:
tx_done_cleanup(..., uint32_t cnt)
{
swr = txq->sw_ring;
txr = txq->tx_ring;
id = txq->tx_tail;
if (txq->nb_tx_free == 0)
ixgbe_xmit_cleanup(txq);
free = txq->nb_tx_free;
for (n = 0; n < cnt && free != 0; ) {
for (j = 0; j != free && n < cnt; j++) {
swe = &swr[id + j];
if (swe->mbuf != NULL) {
rte_pktmbuf_free_seg(swe->mbuf);
swe->mbuf = NULL;
/* last segment in the packet, increment packet count */
n += (swe->last_id == id + j);
}
}
if (n < cnt) {
ixgbe_xmit_cleanup(txq);
free = txq->nb_tx_free - free;
}
}
return n;
}For the situation when there are less then rx_thresh free TXDs ((txq->tx_ring[desc_to_clean_to].wb.status & IXGBE_TXD_STAT_DD) == 0) we do nothing - in that case we consider there are no more mbufs to free.
Quoted 195 lines
Quoted 194 lines
Quoted 4 lines
And what should do is not only free buffers and status but also check which bufs are from One packet and count the packet freed.
ixgbe_xmit_cleanup()itself doesn't free mbufs itself.
It only cleans up TXDs.
So intx_done_cleanup()after callingixgbe_xmit_cleanup()you'll still need to go through sw_ring[] entries that correspond to free TXDs and callmbuf_seg_free(). You can count number of full packets here.Quoted 1 line
So I think it can't be implemented that reuse function
xmit_cleanupwithoutchange it.
Quoted 1 line
And create a new function with the code of
xmit_cleanupwill cause manyduplication.
I don't think it would.
I think all we need here is something like that (note it is schematic one, doesn't take into accounf that TXD ring is circular):
tx_done_cleanup(..., uint32_t cnt){ /* we have txq->nb_tx_free TXDs starting from txq->tx_tail. Scan them first and free as many mbufs as we can. If we need more mbufs to free call ixgbe_xmit_cleanup() to free more TXDs. */ swr = txq->sw_ring; txr = txq->tx_ring; id = txq->tx_tail; free = txq->nb_tx_free; for (n = 0; n < cnt && free != 0; ) { for (j = 0; j != free && n < cnt; j++) { swe = &swr[id + j]; if (swe->mbuf != NULL) { rte_pktmbuf_free_seg(swe->mbuf); swe->mbuf = NULL; } n += (swe->last_id == id + j) } if (n < cnt) { ixgbe_xmit_cleanup(txq); free = txq->nb_tx_free - free; } } return n; }Quoted 2 lines
Above all , it seem not a perfect idea to reuse
ixgbe_xmit_cleanup().Totally disagree, see above.
Quoted 4 lines
Second.
The function in patch is copy from code inigb_rxtx.c. it already updated in 2017, The commit id is
8d907d2b79f7a54c809f1c44970ff455fa2865e1.I realized that.
But I think it as a problem, not a positive thing.
While they do have some similarities, igb abd ixgbe are PMDs for different devices, and their TX code differs quite a lot. Let say igb doesn't usetx_rs_threshold, but instead set RS bit for each last TXD.
So, just blindly copyingtx_done_cleanup()from igb to ixgbe doesn't look like a good idea to me.Quoted 4 lines
I trust the logic of code is right.
Actually it don't complete for ixgbe, i40e and ice, while it don't change the value oflast_desc_cleanedandtx_next_dd. And it's beginning preferlast_desc_cleanedortx_next_dd(for offload or simple)to
tx_tail.Quoted 118 lines
So, I suggest to use the old function and fix the issue.
Quoted 114 lines
Quoted 113 lines
Quoted 112 lines
Quoted 111 lines
This is the first packet that will be
+ * attempted to be freed.
+ */(quoted diff) +84
-0+ +/* Get last segment in most recently added packet. */ tx_last += sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. +*/ tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ tx_id = tx_first; + +/* + * Loop through each packet. For each packet, verify that an + * mbuf exists and that the last segment is free. If so, free + * it and move on. + */ +while (1) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (!(txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD)) +break; + +/* Get the start of the next packet. */ tx_next = +sw_ring[tx_last].next_id; + +/* + * Loop through all segments in a + * packet. + */ +do { +rte_pktmbuf_free_seg(sw_ring[tx_id].mbuf); +sw_ring[tx_id].mbuf = NULL; +sw_ring[tx_id].last_id = tx_id; + +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +} while (tx_id != tx_next); + +/* + * Increment the number of packets + * freed. + */ +count++; + +if (unlikely(count == (int)free_cnt)) break; } else { +/* + * There are multiple reasons to be here: + * 1) All the packets on the ring have been + * freed - tx_id is equal to tx_first + * and some packets have been freed. + * - Done, exit + * 2) Interfaces has not sent a rings worth of + * packets yet, so the segment after tail is + * still empty. Or a previous call to this + * function freed some of the segments but + * not all so there is a hole in the list. + * Hopefully this is a rare case. + * - Walk the list and find the next mbuf. If + * there isn't one, then done. + */ +if (likely(tx_id == tx_first && count != 0)) break; + +/* + * Walk the list and find the next mbuf, if any. + */ +do { +/* Move to next segment. */ +tx_id = sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break; + +} while (tx_id != tx_first); + +/* + * Determine why previous loop bailed. If there + * is not an mbuf, done. + */ +if (sw_ring[tx_id].mbuf == NULL) break; } } + +return count; +} + static void __attribute__((cold))
ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq){ diff --gita/drivers/net/ixgbe/ixgbe_rxtx.hb/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..2c3770af6100644drivers/net/ixgbe/ixgbe_rxtx.h +0
-0@@ -285,6 +285,8 @@ int
ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +2
-0+int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ]; extern const uint32_tptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX];
--
2.17.1
Re: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffers
Hi, Konstantin
Thanks for your read.
for our research, we don't think it is a good plan that reuse ixgbe_xmit_cleanup() or ixgbe_tx_free_bufs. following two opinion will show the reason.
first, it doesn't solve the isituations when cnt % rs_thresh != 0 even by using your plan.
For example, the parameters of API rte_eth_tx_done_cleanup free_cnt=0, that means we want to free all possible mbufs(one mbuf per packet). we find it after checking that No.18 mbuf status is DD, and the status of mbuf after No.19 is in use.
If the plan is that call ixgbe_xmit_cleanup() cnt /rs_thresh + 1 times( 1 in this example).
After ixgbe_xmit_cleanup() the value of last_desc_cleaned is not same as the actual.
the function ixgbe_xmit_pkts will call ixgbe_xmit_cleanup automatically when nb_tx_free<tx_free_thresh, mbufs before last_desc_cleaned (No.19~No.31 for this example)will not be freed
however, all of above is for ixgbe_xmit_pkts() and ixgbe_xmit_cleanup(). if that for ixgbe_xmit_pkts_simple() and ixgbe_tx_free_bufs(),it may be worse. because the free buff action is in the function ixgbe_tx_free_bufs, we won't do free in the outside code. And no mbufs will be freed.
If you do free in outside code for the MOD mbufs and update the value of tx_next_dd and nb_tx_free. there is no need to call ixgbe_tx_free_bufs.
here is two case about tx_done_cleanup and ixgbe_tx_free_bufs. it may be more detail
Case 1
Status:
Suppose before calling tx_done_cleanup(..., uint32_t cnt), txq status are as followings. one mbuf per packet txq->tx_rs_thresh = 32; clean mbuf from index id txr[id+9].wb.status & IXGBE_TXD_STAT_DD != 0. // means we cloud free 10 packets txr[id+31].wb.status & IXGBE_TXD_STAT_DD == 0. // means we cloud not clean 32 packets
Process Flow:
tx_done_cleanup(..., 10) be invoked to free 10 packets.
Firstly ,tx_done_cleanup will invoke ixgbe_xmit_cleanup to count how many mbufs could free.
But ixgbe_xmit_cleanup will return -1 (means no mbufs to free), please ref code bellow
status = txr[desc_to_clean_to].wb.status;
if (!(status & rte_cpu_to_le_32(IXGBE_TXD_STAT_DD))) {
PMD_TX_FREE_LOG(DEBUG,
"TX descriptor %4u is not done"
"(port=%d queue=%d)",
desc_to_clean_to,
txq->port_id, txq->queue_id);
/* Failed to clean any descriptors, better luck next time */
return -(1);
}Result:
We do nothing
Expect:
Free 10 packets.
Thoughts:
If we try to check status from txr[id].wb.status to txr[id+31].wb.status one by one, we could find txr[id].wb.status, txr[id+1].wb.status, txr[id+2].wb.status ……txr[id+9].wb.status, all of them status are IXGBE_TXD_STAT_DD, so actually we have the ability to free 10 packets.
Case 2:
Status:
Suppose before calling tx_done_cleanup(..., uint32_t cnt), txq status are as followings.
one mbuf per packet
txq->tx_rs_thresh = 32;
clean mbuf from index id
txr[id+31].wb.status & IXGBE_TXD_STAT_DD != 0. // means we cloud free 32 packets
Process Flow:
tx_done_cleanup(..., 10) be invoked to free 10 packets.
When tx_done_cleanup invoke ixgbe_tx_free_bufs free bufs, it will free 32 packets..
Result:
Free 32 packets.
Expect:
Free 10 packets.
Thoughts:
If we try to check status from txr[id].wb.status to txr[id+31].wb.status one by one, we could find txr[id].wb.status, txr[id+1].wb.status, txr[id+2].wb.status ……txr[id+10].wb.status, all of them status are IXGBE_TXD_STAT_DD, so we have the ability to free 10 packets only.
second, we have a lot of codes what is same as it in function ixgbe_xmit_cleanup.
we do analysis for function ixgbe_tx_free_bufs and ixgbe_xmit_cleanup and segment their actions.
the actual action of codes are following points:
1. Determine the start position of the free action.
2. Check whether the status of the end position is DD
3. Free ( set status=0 in xmit_cleanup() while call rte_mempool_put_bulk() in tx_free_bufs())
4. Update location variables( last_desc_cleaned in xmit_cleanup() and tx_next_dd in tx_free_bufs() and nb_tx_free in both).
If reuse ixgbe_xmit_cleanup, we need get the number of mbufs before calling ixgbe_xmit_cleanup() We also need to implement the following actions:
1. Determine the starting position
2. Find the last mbuf of each PKT and confirm whether its status is DD
3. Free (don't do for tx_free_bufs())
4. call xmit_cleanup function in loop.
By comparison, it is possible to see that 3/4 functions of ixgbe_xmit_cleanup are already being called before, it means that ixgbe_xmit_cleanup is not highly reusable, the repeat codes is so many.
following code is the main code in ixgbe_xmit_cleanup() and the action code.
1.
last_desc_cleaned = txq->last_desc_cleaned;
2.
/* Determine the last descriptor needing to be cleaned */
desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
if (desc_to_clean_to >= nb_tx_desc)
desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
/* Check to make sure the last descriptor to clean is done */
desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
status = txr[desc_to_clean_to].wb.status;
if (!(status & rte_cpu_to_le_32(IXGBE_TXD_STAT_DD))) {
PMD_TX_FREE_LOG(DEBUG,
return -(1);
}
3.
/* Figure out how many descriptors will be cleaned */
if (last_desc_cleaned > desc_to_clean_to)
nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned) +
desc_to_clean_to);
else
nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
last_desc_cleaned);
txr[desc_to_clean_to].wb.status = 0;
4.
/* Update the txq to reflect the last descriptor that was cleaned */
txq->last_desc_cleaned = desc_to_clean_to;
txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);Quoted 408 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Tuesday, January 7, 2020 10:10 PM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffersHi Chenxu,
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
+ *
tx_tailis the last sent packet on thesw_ring. Goto
+ the end
+ * of that packet (the last segment in the packet chain)
+ and
+ * then the next segment will be the start of the oldest
+ segment
+ * in thesw_ring.Not sure I understand the sentence above.
tx_tailis the value of TDT HW register (most recently armed by SWTD).
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
last_idis the index of last descriptor for multi-seg packet.next_idis just the index of next descriptor in HW TD ring. How do you conclude that it will be the ' oldest segment in the
sw_ring'?Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 5 lines
Quoted 1 line
The
tx_tailis the last sent packet on thesw_ring. While thexmit_cleanuporTx_free_bufswill be call when thenb_tx_free<
tx_free_thresh.Quoted 3 lines
So the sw_ring[tx_tail].next_id must be the begin of mbufs which are not used or Already freed . then begin the loop until the mbuf is used and
begin to free them.
Quoted 12 lines
Quoted 11 lines
Another question why do you need to write your own functions? Why can't you reuse existing
ixgbe_xmit_cleanup()for full(offload) path andixgbe_tx_free_bufs()for simple path?
Yes,ixgbe_xmit_cleanup()doesn't free mbufs, but at least it could be used to determine finished TX descriptors. Based on that you can you can free appropriate sw_ring[] entries.Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
The reason why I don't reuse existing function is that they all free several mbufs While the
free_cntof the APIrte_eth_tx_done_cleanup()is thenumber of packets.
Quoted 1 line
It also need to be done that check which mbuffs are from the same
packet.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
At first, I don't see anything bad if
tx_done_cleanup()will free only some segments from the packet. As long as it is safe - there is noproblem with that.
Quoted 1 line
Quoted 1 line
I think
rte_eth_tx_done_cleanup()operates on mbuf, not packetquantities.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
But in our case I think it doesn't matter, as
ixgbe_xmit_cleanup()mark TXDs as free only when HW is done with allTXDs for that packet.
Quoted 40 lines
Quoted 40 lines
Quoted 33 lines
Quoted 33 lines
As long as there is a way to reuse existing code and avoid duplication (without introducing any degradation) - we should use it. And I think there is a very good opportunity here to reuse existing
ixgbe_xmit_cleanup()fortx_done_cleanup()implementation. Moreover because your code doesn’t follow ixgbe_xmit_pkts()/ixgbe_xmit_cleanup()
logic and infrastructure, it introduces unnecessary scans over TXD ring, and in some cases doesn't work as expected:(quoted diff) +12
-0+while (1) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD) { +} else { +/* + * mbuf still in use, nothing left to + * free. + */ +break;It is not correct to expect that
IXGBE_TXD_STAT_DDwill be set on last TXD for
*every* packet.
We setIXGBE_TXD_CMD_RSbit only on threshold packet last descriptor. Plusixgbe_xmit_cleanup()can cleanup TXD wb.status.So I strongly recommend to reuse
ixgbe_xmit_cleanup()here.
It would be much less error prone and will help to avoid code duplication.Quoted 6 lines
Quoted 2 lines
Konstantin
At first.
The functionixgbe_xmit_cleanup(struct ixgbe_tx_queue *txq)will cleanupTXD wb.status.
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
the number of status cleanuped is always
txq->tx_rs_thresh.Yes, and what's wrong with it?
Quoted 4 lines
The API
rte_eth_tx_done_cleanup()inrte_eth_dev.hshow that @paramfree_cnt
* Maximum number of packets to free. Use 0 to indicate all possiblepackets
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
* should be freed. Note that a packet may be using multiple mbufs.
I don't think it is a good approach, better would be to report number of freed mbufs, but ok, as it is a public API, we probably need to
keep it as it is.
Quoted 22 lines
Quoted 9 lines
Quoted 3 lines
a number must be set while
ixgbe_xmit_cleanupandixgbe_tx_free_bufsonlyhave one parameter txq.
Yes,
ixgbe_xmit_cleanup()cleans up at leasttxq->tx_rs_threshTXDs. So if user requested more packets to be freed we can callixgbe_xmit_cleanup()in a loop.That is a great idea and I discuss with my workmate about it today. there is also some Question that we don’t confirm.
Actually it can callixgbe_xmit_cleanup()in a loop if user requested more packets, How to deal with the MOD. For example:
The defaulttx_rs_threshis 32.if the count of mbufs we need free is 50. We can callixgbe_xmit_cleanup()one time to free 32 mbufs.
Then how about other 18 mbufs.
1.If we do nothing, it looks not good.
2.if we callixgbe_xmit_cleanup()successfully, we free 14 mbufs more. 3.if we callixgbe_xmit_cleanup()fail, the status of No.32 mbufs is not DD
While No .18 is DD. So we do not free 18 mbufs what we can and should free.Quoted 3 lines
We have try some plans about it, likes add parameter for
ixgbe_xmit_cleanup(), changeTx_rs_threshor copy the code orixgbe_xmit_cleanup()as a new function with more Parameter. But all of themseem not perfect.
Quoted 2 lines
So can you give some comment about it? It seems not easy as we think by
reuse function.
My thought about it:
for situations when cnt %rs_thresh!= 0 we'll still callixgbe_xmit_cleanup()cnt /rs_thresh+ 1 times.
But then, we can free just cnt %rs_threshmbufs, while keeping rest of them intact.Let say at some moment we have txq->nb_tx_free==0, and user called
tx_done_cleanup(txq, ..., cnt==50)So we callixgbe_xmit_cleanup(txq)first time. Suppose it frees 32 TXDs, then we walk through corresponding sw_ring[] entries and let say free 32 packets (one mbuf per packet).
Then we callixgbe_xmit_cleanup(txq)second time.
Suppose it will free another 32 TXDs, we again walk thour sw_ring[], but free only first 18 mbufs and return.
Suppose we calltx_done_cleanup(txq, cnt=50)immediately again.
Now txq->nb_tx_free==64, so we can start to scan sw_entries[] fromtx_tailstraightway. We'll skip first 50 entries as they are already empty, then free remaining 14 mbufs, then will callixgbe_xmit_cleanup(txq)again, and if it would be successful, will scan and free another 32 sw_ring[] entries.
Then again will callixgbe_xmit_cleanup(txq), but will free
only first 8 available sw_ring[].mbuf.
Probably a bit easier with the code:
tx_done_cleanup(..., uint32_t cnt){ swr = txq->sw_ring; txr = txq->tx_ring; id = txq->tx_tail; if (txq->nb_tx_free == 0) ixgbe_xmit_cleanup(txq); free = txq->nb_tx_free; for (n = 0; n < cnt && free != 0; ) { for (j = 0; j != free && n < cnt; j++) { swe = &swr[id + j]; if (swe->mbuf != NULL) { rte_pktmbuf_free_seg(swe->mbuf); swe->mbuf = NULL; /* last segment in the packet, increment packet count */ n += (swe->last_id == id + j); } } if (n < cnt) { ixgbe_xmit_cleanup(txq); free = txq->nb_tx_free - free; } } return n; }For the situation when there are less then
rx_threshfree TXDs ((txq-Quoted 1 line
tx_ring[desc_to_clean_to].wb.status &
IXGBE_TXD_STAT_DD) == 0) we donothing - in that case we consider there are no more mbufs to free.
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
And what should do is not only free buffers and status but also check which bufs are from One packet and count the packet freed.
ixgbe_xmit_cleanup()itself doesn't free mbufs itself.
It only cleans up TXDs.
So intx_done_cleanup()after callingixgbe_xmit_cleanup()you'll still need to go through sw_ring[] entries that correspond to free TXDs andcall
mbuf_seg_free().Quoted 193 lines
Quoted 192 lines
You can count number of full packets here.
Quoted 2 lines
So I think it can't be implemented that reuse function
xmit_cleanupwithoutchange it.
Quoted 2 lines
And create a new function with the code of
xmit_cleanupwill cause manyduplication.
I don't think it would.
I think all we need here is something like that (note it is schematic one, doesn't take into accounf that TXD ring is circular):
tx_done_cleanup(..., uint32_t cnt){ /* we have txq->nb_tx_free TXDs starting from txq->tx_tail. Scan them first and free as many mbufs as we can. If we need more mbufs to free call ixgbe_xmit_cleanup() to free more TXDs. */ swr = txq->sw_ring; txr = txq->tx_ring; id = txq->tx_tail; free = txq->nb_tx_free; for (n = 0; n < cnt && free != 0; ) { for (j = 0; j != free && n < cnt; j++) { swe = &swr[id + j]; if (swe->mbuf != NULL) { rte_pktmbuf_free_seg(swe->mbuf); swe->mbuf = NULL; } n += (swe->last_id == id + j) } if (n < cnt) { ixgbe_xmit_cleanup(txq); free = txq->nb_tx_free - free; } } return n; }Quoted 2 lines
Above all , it seem not a perfect idea to reuse
ixgbe_xmit_cleanup().Totally disagree, see above.
Quoted 4 lines
Second.
The function in patch is copy from code inigb_rxtx.c. it already updated in 2017, The commit id is
8d907d2b79f7a54c809f1c44970ff455fa2865e1.I realized that.
But I think it as a problem, not a positive thing.
While they do have some similarities, igb abd ixgbe are PMDs for different devices, and their TX code differs quite a lot. Let say igb doesn't usetx_rs_threshold, but instead set RS bit for each last TXD. So, just blindly copyingtx_done_cleanup()from igb to ixgbe doesn't look like a good idea to me.Quoted 5 lines
I trust the logic of code is right.
Actually it don't complete for ixgbe, i40e and ice, while it don't change the value oflast_desc_cleanedandtx_next_dd. And it's beginning preferlast_desc_cleanedortx_next_dd(for offload or simple)to
tx_tail.Quoted 122 lines
So, I suggest to use the old function and fix the issue.
Quoted 118 lines
Quoted 117 lines
Quoted 116 lines
Quoted 115 lines
This is the first packet that will be
+ * attempted to be freed.
+ */(quoted diff) +87
-0+ +/* Get last segment in most recently added packet. */ +tx_last = sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. +*/ tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ tx_id = +tx_first; + +/* + * Loop through each packet. For each packet, verify that +an + * mbuf exists and that the last segment is free. If so, +free + * it and move on. + */ +while (1) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { if (!(txr[tx_last].wb.status +& +IXGBE_TXD_STAT_DD)) +break; + +/* Get the start of the next packet. */ tx_next = +sw_ring[tx_last].next_id; + +/* + * Loop through all segments in a + * packet. + */ +do { +rte_pktmbuf_free_seg(sw_ring[tx_id].mbuf); +sw_ring[tx_id].mbuf = NULL; sw_ring[tx_id].last_id = +tx_id; + +/* Move to next segment. */ tx_id = +sw_ring[tx_id].next_id; + +} while (tx_id != tx_next); + +/* + * Increment the number of packets + * freed. + */ +count++; + +if (unlikely(count == (int)free_cnt)) break; } else { +/* + * There are multiple reasons to be here: + * 1) All the packets on the ring have been + * freed - tx_id is equal to tx_first + * and some packets have been freed. + * - Done, exit + * 2) Interfaces has not sent a rings worth of + * packets yet, so the segment after tail is + * still empty. Or a previous call to this + * function freed some of the segments but + * not all so there is a hole in the list. + * Hopefully this is a rare case. + * - Walk the list and find the next mbuf. If + * there isn't one, then done. + */ +if (likely(tx_id == tx_first && count != 0)) break; + +/* + * Walk the list and find the next mbuf, if any. + */ +do { +/* Move to next segment. */ tx_id = +sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break; + +} while (tx_id != tx_first); + +/* + * Determine why previous loop bailed. If there + * is not an mbuf, done. + */ +if (sw_ring[tx_id].mbuf == NULL) break; } } + +return count; +} + static void __attribute__((cold))
ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq){ diff --gita/drivers/net/ixgbe/ixgbe_rxtx.hb/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..2c3770af6
100644drivers/net/ixgbe/ixgbe_rxtx.h +0
-0@@ -285,6 +285,8 @@ int
ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +2
-0+int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ]; extern const uint32_tptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX];
--
2.17.1
Re: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffers
Hi Chenxu,
Quoted 4 lines
Thanks for your read.
for our research, we don't think it is a good plan that reuse
ixgbe_xmit_cleanup()orixgbe_tx_free_bufs. following two opinion will show the reason.
I think there is a main misunderstandings between us:
TXD.DD bit setting.
You expect that for every completed packet packet HW will set DD bit. For ixgbe it is not the case.
For ixgbe (and AFAIK for i40e) we don't set RS bit for every packet. Instead we set it for a bunch of packets: tx_rs_thresh value. That's one of the optimizations ixgbe PMD does.
So valid assumption is to check DD bit only for TXDs where RS bit is set. That's how both ixgbe_xmit_cleanup() or ixgbe_tx_free_bufs() works. All TXDs between last_desc_cleaned and desc_to_clean_to
(or between tx_next_dd and tx_next_dd + tx_rs_thresh) are considered by PMD as 'still busy', even in reality some of them might already be not.
Yes, it means that in some cases some of them mbufs will be considered by PMD as still in use, while they are really not.
But I don't think it is a critical thing.
Having TXD and related mbufs management logic within PMD consistent is much more important.
In other words, I still think reusing exiting functions (ixgbe_xmit_cleanup() and ixgbe_tx_free_bufs) for tx_cleanup_done() is a better option then trying to create new ones.
BTW, as a side question, do you guys have any vehicle to test these functions? AFAIK, right now this function is not called from any app:
find app examples/ -type f -name '*.[h,c]' | xargs grep -l rte_eth_tx_done_cleanup <empty>
Quoted 549 lines
first, it doesn't solve the isituations when cnt %
rs_thresh!= 0 even by using your plan.For example, the parameters of API
rte_eth_tx_done_cleanupfree_cnt=0, that means we want to free all possible mbufs(one mbuf per packet). we find it after checking that
No.18 mbuf status is DD, and the status of mbuf after No.19 is in use.If the plan is that call
ixgbe_xmit_cleanup()cnt /rs_thresh + 1 times( 1 in this example).
Afterixgbe_xmit_cleanup()the value oflast_desc_cleanedis not same as the actual.
the functionixgbe_xmit_pktswill callixgbe_xmit_cleanupautomatically when nb_tx_free<tx_free_thresh, mbufs beforelast_desc_cleaned(No.19~No.31 for this example)will not be freedhowever, all of above is for
ixgbe_xmit_pkts()andixgbe_xmit_cleanup(). if that forixgbe_xmit_pkts_simple()and ixgbe_tx_free_bufs(),it may be worse.
because the free buff action is in the functionixgbe_tx_free_bufs, we won't do free in the outside code. And no mbufs will be freed.If you do free in outside code for the MOD mbufs and update the value of
tx_next_ddandnb_tx_free. there is no need to callixgbe_tx_free_bufs.here is two case about
tx_done_cleanupandixgbe_tx_free_bufs. it may be more detailCase 1
Status:Suppose before calling tx_done_cleanup(..., uint32_t cnt), txq status are as followings. one mbuf per packet txq->tx_rs_thresh = 32; clean mbuf from index id txr[id+9].wb.status & IXGBE_TXD_STAT_DD != 0. // means we cloud free 10 packets txr[id+31].wb.status & IXGBE_TXD_STAT_DD == 0. // means we cloud not clean 32 packetsProcess Flow:
tx_done_cleanup(..., 10) be invoked to free 10 packets. Firstly ,tx_done_cleanup will invoke ixgbe_xmit_cleanup to count how many mbufs could free. But ixgbe_xmit_cleanup will return -1 (means no mbufs to free), please ref code bellow status = txr[desc_to_clean_to].wb.status; if (!(status & rte_cpu_to_le_32(IXGBE_TXD_STAT_DD))) { PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done" "(port=%d queue=%d)", desc_to_clean_to, txq->port_id, txq->queue_id); /* Failed to clean any descriptors, better luck next time */ return -(1); }Result:
We do nothingExpect:
Free 10 packets.Thoughts:
If we try to check status from txr[id].wb.status to txr[id+31].wb.status one by one, we could find txr[id].wb.status,
txr[id+1].wb.status, txr[id+2].wb.status ……txr[id+9].wb.status, all of them status areIXGBE_TXD_STAT_DD, so actually we have the ability to free 10 packets.Case 2:
Status:
Suppose before callingtx_done_cleanup(..., uint32_t cnt), txq status are as followings.one mbuf per packet
txq->tx_rs_thresh= 32;
clean mbuf from index id
txr[id+31].wb.status &IXGBE_TXD_STAT_DD!= 0. // means we cloud free 32 packetsProcess Flow:
tx_done_cleanup(..., 10)be invoked to free 10 packets.
Whentx_done_cleanupinvokeixgbe_tx_free_bufsfree bufs, it will free 32 packets..Result:
Free 32 packets.Expect:
Free 10 packets.Thoughts:
If we try to check status from txr[id].wb.status to txr[id+31].wb.status one by one, we could find txr[id].wb.status,
txr[id+1].wb.status, txr[id+2].wb.status ……txr[id+10].wb.status, all of them status areIXGBE_TXD_STAT_DD, so we have the ability to free 10 packets only.second, we have a lot of codes what is same as it in function
ixgbe_xmit_cleanup.we do analysis for function
ixgbe_tx_free_bufsandixgbe_xmit_cleanupand segment their actions.
the actual action of codes are following points:
1. Determine the start position of the free action.
2. Check whether the status of the end position is DD
3. Free ( set status=0 inxmit_cleanup()while callrte_mempool_put_bulk()intx_free_bufs())
4. Update locationvariables( last_desc_cleaned in xmit_cleanup() and tx_next_dd in tx_free_bufs() and nb_tx_free in both).If reuse
ixgbe_xmit_cleanup, we need get the number of mbufs before callingixgbe_xmit_cleanup()We also need to implement the following actions:
1. Determine the starting position
2. Find the last mbuf of each PKT and confirm whether its status is DD
3. Free (don't do fortx_free_bufs())
4. callxmit_cleanupfunction in loop.By comparison, it is possible to see that 3/4 functions of
ixgbe_xmit_cleanupare already being called before, it means thatixgbe_xmit_cleanupis not highly reusable, the repeat codes is so many.following code is the main code in
ixgbe_xmit_cleanup()and the action code.1.
last_desc_cleaned = txq->last_desc_cleaned;2.
/* Determine the last descriptor needing to be cleaned */ desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh); if (desc_to_clean_to >= nb_tx_desc) desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc); /* Check to make sure the last descriptor to clean is done */ desc_to_clean_to = sw_ring[desc_to_clean_to].last_id; status = txr[desc_to_clean_to].wb.status; if (!(status & rte_cpu_to_le_32(IXGBE_TXD_STAT_DD))) { PMD_TX_FREE_LOG(DEBUG, return -(1); } 3. /* Figure out how many descriptors will be cleaned */ if (last_desc_cleaned > desc_to_clean_to) nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned) + desc_to_clean_to); else nb_tx_to_clean = (uint16_t)(desc_to_clean_to - last_desc_cleaned); txr[desc_to_clean_to].wb.status = 0; 4. /* Update the txq to reflect the last descriptor that was cleaned */ txq->last_desc_cleaned = desc_to_clean_to; txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);Quoted 401 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Tuesday, January 7, 2020 10:10 PM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 3/4] net/ixgbe: cleanup Tx buffersHi Chenxu,
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
+ *
tx_tailis the last sent packet on thesw_ring. Goto
+ the end
+ * of that packet (the last segment in the packet chain)
+ and
+ * then the next segment will be the start of the oldest
+ segment
+ * in thesw_ring.Not sure I understand the sentence above.
tx_tailis the value of TDT HW register (most recently armed by SWTD).
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
last_idis the index of last descriptor for multi-seg packet.next_idis just the index of next descriptor in HW TD ring. How do you conclude that it will be the ' oldest segment in the
sw_ring'?Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 5 lines
Quoted 1 line
The
tx_tailis the last sent packet on thesw_ring. While thexmit_cleanuporTx_free_bufswill be call when thenb_tx_free<
tx_free_thresh.Quoted 3 lines
So the sw_ring[tx_tail].next_id must be the begin of mbufs which are not used or Already freed . then begin the loop until the mbuf is used and
begin to free them.
Quoted 12 lines
Quoted 11 lines
Another question why do you need to write your own functions? Why can't you reuse existing
ixgbe_xmit_cleanup()for full(offload) path andixgbe_tx_free_bufs()for simple path?
Yes,ixgbe_xmit_cleanup()doesn't free mbufs, but at least it could be used to determine finished TX descriptors. Based on that you can you can free appropriate sw_ring[] entries.Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
The reason why I don't reuse existing function is that they all free several mbufs While the
free_cntof the APIrte_eth_tx_done_cleanup()is thenumber of packets.
Quoted 1 line
It also need to be done that check which mbuffs are from the same
packet.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
At first, I don't see anything bad if
tx_done_cleanup()will free only some segments from the packet. As long as it is safe - there is noproblem with that.
Quoted 1 line
Quoted 1 line
I think
rte_eth_tx_done_cleanup()operates on mbuf, not packetquantities.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
But in our case I think it doesn't matter, as
ixgbe_xmit_cleanup()mark TXDs as free only when HW is done with allTXDs for that packet.
Quoted 40 lines
Quoted 40 lines
Quoted 33 lines
Quoted 33 lines
As long as there is a way to reuse existing code and avoid duplication (without introducing any degradation) - we should use it. And I think there is a very good opportunity here to reuse existing
ixgbe_xmit_cleanup()fortx_done_cleanup()implementation. Moreover because your code doesn’t follow ixgbe_xmit_pkts()/ixgbe_xmit_cleanup()
logic and infrastructure, it introduces unnecessary scans over TXD ring, and in some cases doesn't work as expected:(quoted diff) +12
-0+while (1) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { +if (txr[tx_last].wb.status & +IXGBE_TXD_STAT_DD) { +} else { +/* + * mbuf still in use, nothing left to + * free. + */ +break;It is not correct to expect that
IXGBE_TXD_STAT_DDwill be set on last TXD for
*every* packet.
We setIXGBE_TXD_CMD_RSbit only on threshold packet last descriptor. Plusixgbe_xmit_cleanup()can cleanup TXD wb.status.So I strongly recommend to reuse
ixgbe_xmit_cleanup()here.
It would be much less error prone and will help to avoid code duplication.Quoted 6 lines
Quoted 2 lines
Konstantin
At first.
The functionixgbe_xmit_cleanup(struct ixgbe_tx_queue *txq)will cleanupTXD wb.status.
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
the number of status cleanuped is always
txq->tx_rs_thresh.Yes, and what's wrong with it?
Quoted 4 lines
The API
rte_eth_tx_done_cleanup()inrte_eth_dev.hshow that @paramfree_cnt
* Maximum number of packets to free. Use 0 to indicate all possiblepackets
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
* should be freed. Note that a packet may be using multiple mbufs.
I don't think it is a good approach, better would be to report number of freed mbufs, but ok, as it is a public API, we probably need to
keep it as it is.
Quoted 22 lines
Quoted 9 lines
Quoted 3 lines
a number must be set while
ixgbe_xmit_cleanupandixgbe_tx_free_bufsonlyhave one parameter txq.
Yes,
ixgbe_xmit_cleanup()cleans up at leasttxq->tx_rs_threshTXDs. So if user requested more packets to be freed we can callixgbe_xmit_cleanup()in a loop.That is a great idea and I discuss with my workmate about it today. there is also some Question that we don’t confirm.
Actually it can callixgbe_xmit_cleanup()in a loop if user requested more packets, How to deal with the MOD. For example:
The defaulttx_rs_threshis 32.if the count of mbufs we need free is 50. We can callixgbe_xmit_cleanup()one time to free 32 mbufs.
Then how about other 18 mbufs.
1.If we do nothing, it looks not good.
2.if we callixgbe_xmit_cleanup()successfully, we free 14 mbufs more. 3.if we callixgbe_xmit_cleanup()fail, the status of No.32 mbufs is not DD
While No .18 is DD. So we do not free 18 mbufs what we can and should free.Quoted 3 lines
We have try some plans about it, likes add parameter for
ixgbe_xmit_cleanup(), changeTx_rs_threshor copy the code orixgbe_xmit_cleanup()as a new function with more Parameter. But all of themseem not perfect.
Quoted 2 lines
So can you give some comment about it? It seems not easy as we think by
reuse function.
My thought about it:
for situations when cnt %rs_thresh!= 0 we'll still callixgbe_xmit_cleanup()cnt /rs_thresh+ 1 times.
But then, we can free just cnt %rs_threshmbufs, while keeping rest of them intact.Let say at some moment we have txq->nb_tx_free==0, and user called
tx_done_cleanup(txq, ..., cnt==50)So we callixgbe_xmit_cleanup(txq)first time. Suppose it frees 32 TXDs, then we walk through corresponding sw_ring[] entries and let say free 32 packets (one mbuf per packet).
Then we callixgbe_xmit_cleanup(txq)second time.
Suppose it will free another 32 TXDs, we again walk thour sw_ring[], but free only first 18 mbufs and return.
Suppose we calltx_done_cleanup(txq, cnt=50)immediately again.
Now txq->nb_tx_free==64, so we can start to scan sw_entries[] fromtx_tailstraightway. We'll skip first 50 entries as they are already empty, then free remaining 14 mbufs, then will callixgbe_xmit_cleanup(txq)again, and if it would be successful, will scan and free another 32 sw_ring[] entries.
Then again will callixgbe_xmit_cleanup(txq), but will free
only first 8 available sw_ring[].mbuf.
Probably a bit easier with the code:
tx_done_cleanup(..., uint32_t cnt){ swr = txq->sw_ring; txr = txq->tx_ring; id = txq->tx_tail; if (txq->nb_tx_free == 0) ixgbe_xmit_cleanup(txq); free = txq->nb_tx_free; for (n = 0; n < cnt && free != 0; ) { for (j = 0; j != free && n < cnt; j++) { swe = &swr[id + j]; if (swe->mbuf != NULL) { rte_pktmbuf_free_seg(swe->mbuf); swe->mbuf = NULL; /* last segment in the packet, increment packet count */ n += (swe->last_id == id + j); } } if (n < cnt) { ixgbe_xmit_cleanup(txq); free = txq->nb_tx_free - free; } } return n; }For the situation when there are less then
rx_threshfree TXDs ((txq-Quoted 1 line
tx_ring[desc_to_clean_to].wb.status &
IXGBE_TXD_STAT_DD) == 0) we donothing - in that case we consider there are no more mbufs to free.
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
And what should do is not only free buffers and status but also check which bufs are from One packet and count the packet freed.
ixgbe_xmit_cleanup()itself doesn't free mbufs itself.
It only cleans up TXDs.
So intx_done_cleanup()after callingixgbe_xmit_cleanup()you'll still need to go through sw_ring[] entries that correspond to free TXDs andcall
mbuf_seg_free().Quoted 187 lines
Quoted 187 lines
You can count number of full packets here.
Quoted 2 lines
So I think it can't be implemented that reuse function
xmit_cleanupwithoutchange it.
Quoted 2 lines
And create a new function with the code of
xmit_cleanupwill cause manyduplication.
I don't think it would.
I think all we need here is something like that (note it is schematic one, doesn't take into accounf that TXD ring is circular):
tx_done_cleanup(..., uint32_t cnt){ /* we have txq->nb_tx_free TXDs starting from txq->tx_tail. Scan them first and free as many mbufs as we can. If we need more mbufs to free call ixgbe_xmit_cleanup() to free more TXDs. */ swr = txq->sw_ring; txr = txq->tx_ring; id = txq->tx_tail; free = txq->nb_tx_free; for (n = 0; n < cnt && free != 0; ) { for (j = 0; j != free && n < cnt; j++) { swe = &swr[id + j]; if (swe->mbuf != NULL) { rte_pktmbuf_free_seg(swe->mbuf); swe->mbuf = NULL; } n += (swe->last_id == id + j) } if (n < cnt) { ixgbe_xmit_cleanup(txq); free = txq->nb_tx_free - free; } } return n; }Quoted 2 lines
Above all , it seem not a perfect idea to reuse
ixgbe_xmit_cleanup().Totally disagree, see above.
Quoted 4 lines
Second.
The function in patch is copy from code inigb_rxtx.c. it already updated in 2017, The commit id is
8d907d2b79f7a54c809f1c44970ff455fa2865e1.I realized that.
But I think it as a problem, not a positive thing.
While they do have some similarities, igb abd ixgbe are PMDs for different devices, and their TX code differs quite a lot. Let say igb doesn't usetx_rs_threshold, but instead set RS bit for each last TXD. So, just blindly copyingtx_done_cleanup()from igb to ixgbe doesn't look like a good idea to me.Quoted 5 lines
I trust the logic of code is right.
Actually it don't complete for ixgbe, i40e and ice, while it don't change the value oflast_desc_cleanedandtx_next_dd. And it's beginning preferlast_desc_cleanedortx_next_dd(for offload or simple)to
tx_tail.Quoted 118 lines
So, I suggest to use the old function and fix the issue.
Quoted 115 lines
Quoted 115 lines
Quoted 115 lines
Quoted 115 lines
This is the first packet that will be
+ * attempted to be freed.
+ */(quoted diff) +87
-0+ +/* Get last segment in most recently added packet. */ +tx_last = sw_ring[txq->tx_tail].last_id; + +/* Get the next segment, which is the oldest segment in ring. +*/ tx_first = sw_ring[tx_last].next_id; + +/* Set the current index to the first. */ tx_id = +tx_first; + +/* + * Loop through each packet. For each packet, verify that +an + * mbuf exists and that the last segment is free. If so, +free + * it and move on. + */ +while (1) { +tx_last = sw_ring[tx_id].last_id; + +if (sw_ring[tx_last].mbuf) { if (!(txr[tx_last].wb.status +& +IXGBE_TXD_STAT_DD)) +break; + +/* Get the start of the next packet. */ tx_next = +sw_ring[tx_last].next_id; + +/* + * Loop through all segments in a + * packet. + */ +do { +rte_pktmbuf_free_seg(sw_ring[tx_id].mbuf); +sw_ring[tx_id].mbuf = NULL; sw_ring[tx_id].last_id = +tx_id; + +/* Move to next segment. */ tx_id = +sw_ring[tx_id].next_id; + +} while (tx_id != tx_next); + +/* + * Increment the number of packets + * freed. + */ +count++; + +if (unlikely(count == (int)free_cnt)) break; } else { +/* + * There are multiple reasons to be here: + * 1) All the packets on the ring have been + * freed - tx_id is equal to tx_first + * and some packets have been freed. + * - Done, exit + * 2) Interfaces has not sent a rings worth of + * packets yet, so the segment after tail is + * still empty. Or a previous call to this + * function freed some of the segments but + * not all so there is a hole in the list. + * Hopefully this is a rare case. + * - Walk the list and find the next mbuf. If + * there isn't one, then done. + */ +if (likely(tx_id == tx_first && count != 0)) break; + +/* + * Walk the list and find the next mbuf, if any. + */ +do { +/* Move to next segment. */ tx_id = +sw_ring[tx_id].next_id; + +if (sw_ring[tx_id].mbuf) +break; + +} while (tx_id != tx_first); + +/* + * Determine why previous loop bailed. If there + * is not an mbuf, done. + */ +if (sw_ring[tx_id].mbuf == NULL) break; } } + +return count; +} + static void __attribute__((cold))
ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq){ diff --gita/drivers/net/ixgbe/ixgbe_rxtx.hb/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..2c3770af6
100644drivers/net/ixgbe/ixgbe_rxtx.h +0
-0@@ -285,6 +285,8 @@ int
ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +2
-0+int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ]; extern const uint32_tptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX];
--
2.17.1
PATCH v6 4/4 net/e1000: cleanup Tx buffers
In reply to Chenxu DiAdd support to the igb vf for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/e1000/igb_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -446,6 +446,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_descriptor_status = eth_igb_tx_descriptor_status, .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, + .tx_done_cleanup = eth_igb_tx_done_cleanup, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get,
Signature · 1 line
2.17.1
v7 cover drivers/net: cleanup Tx buffers
In reply to Chenxu DiAdd support to the drivers inclulding i40e, ice, ixgbe and igb vf for the API rte_eth_tx_done_cleanup to force
free consumed buffers on Tx ring.
---
v7:
changed the design of code, reuse exist function.
Chenxu Di (4):
net/i40e: cleanup Tx buffers
net/ice: cleanup Tx buffers
net/ixgbe: cleanup Tx buffers
net/e1000: cleanup Tx buffers
drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev.c | 3 + drivers/net/i40e/i40e_ethdev_vf.c | 3 + drivers/net/i40e/i40e_rxtx.c | 151 +++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 8 ++ drivers/net/ice/ice_ethdev.c | 3 + drivers/net/ice/ice_rxtx.c | 155 +++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 11 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 4 + drivers/net/ixgbe/ixgbe_rxtx.c | 156 +++++++++++++++++++++++++++++- drivers/net/ixgbe/ixgbe_rxtx.h | 10 ++ 11 files changed, 504 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
PATCH v7 1/4 net/i40e: cleanup Tx buffers
Add support to the i40e driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/i40e/i40e_ethdev.c | 3 + drivers/net/i40e/i40e_ethdev_vf.c | 3 + drivers/net/i40e/i40e_rxtx.c | 151 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 8 ++ 4 files changed, 165 insertions(+)
drivers/net/i40e/i40e_ethdev.c +3 -0
@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
@@ -1358,6 +1359,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) dev->tx_pkt_burst = i40e_xmit_pkts; dev->tx_pkt_prepare = i40e_prep_pkts; +i40e_set_tx_done_cleanup_func (i40e_tx_done_cleanup_scalar); +/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different * RX function */
drivers/net/i40e/i40e_ethdev_vf.c +3 -0
@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/*
@@ -1473,6 +1474,8 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &i40e_recv_pkts; eth_dev->tx_pkt_burst = &i40e_xmit_pkts; +i40e_set_tx_done_cleanup_func (i40e_tx_done_cleanup_scalar); +/* * For secondary processes, we don't initialise any further as primary * has already done this work.
drivers/net/i40e/i40e_rxtx.c +151 -0
172 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx.h +8 -0
@@ -173,6 +173,8 @@ union i40e_tx_offload { uint64_t outer_l3_len:16; /**< outer L3 Header Length */ }; }; +typedef int (*i40e_tx_done_cleanup_t )(struct i40e_tx_queue *txq, +uint32_t free_cnt);int i40e_dev_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id);int i40e_dev_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);
@@ -212,6 +214,12 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void i40e_reset_rx_queue (struct i40e_rx_queue *rxq);void i40e_reset_tx_queue (struct i40e_tx_queue *txq);void i40e_tx_queue_release_mbufs (struct i40e_tx_queue *txq); +void i40e_set_tx_done_cleanup_func (i40e_tx_done_cleanup_t fn); +i40e_tx_done_cleanup_t i40e_get_tx_done_cleanup_func (void ); +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt); +int i40e_tx_done_cleanup_scalar (struct i40e_tx_queue *txq,uint32_t free_cnt); +int i40e_tx_done_cleanup_vec (struct i40e_tx_queue *txq,uint32_t free_cnt); +int i40e_tx_done_cleanup_simple (struct i40e_tx_queue *txq,uint32_t free_cnt);int i40e_alloc_rx_queue_mbufs (struct i40e_rx_queue *rxq);void i40e_rx_queue_release_mbufs (struct i40e_rx_queue *rxq);
Signature · 1 line
2.17.1
PATCH v7 2/4 net/ice: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ice driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ice/ice_ethdev.c | 3 + drivers/net/ice/ice_rxtx.c | 155 +++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 11 +++ 3 files changed, 169 insertions(+)
drivers/net/ice/ice_ethdev.c +3 -0
@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
@@ -2137,6 +2138,8 @@ ice_dev_init(struct rte_eth_dev *dev) dev->tx_pkt_burst = ice_xmit_pkts; dev->tx_pkt_prepare = ice_prep_pkts; +ice_set_tx_done_cleanup_func (ice_tx_done_cleanup_scalar); +/* for secondary processes, we don't initialise any further as primary * has already done this work. */
drivers/net/ice/ice_rxtx.c +155 -0
183 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +11 -0
@@ -135,6 +135,9 @@ union ice_tx_offload { }; }; +typedef int (*ice_tx_done_cleanup_t )(struct ice_tx_queue *txq, +uint32_t free_cnt); + int ice_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc,
@@ -183,6 +186,7 @@ int ice_rx_descriptor_status(void *rx_queue, uint16_t offset);int ice_tx_descriptor_status (void *tx_queue,uint16_t offset);void ice_set_default_ptype_table (struct rte_eth_dev *dev);const uint32_t *ice_dev_supported_ptypes_get (struct rte_eth_dev *dev); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_rx_vec_dev_check (struct rte_eth_dev *dev);int ice_tx_vec_dev_check (struct rte_eth_dev *dev);
@@ -202,4 +206,11 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue,uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc); +void ice_set_tx_done_cleanup_func (ice_tx_done_cleanup_t fn); +ice_tx_done_cleanup_t ice_get_tx_done_cleanup_func (void ); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt); +int ice_tx_done_cleanup_scalar (struct ice_tx_queue *txq,uint32_t free_cnt); +int ice_tx_done_cleanup_vec (struct ice_tx_queue *txq,uint32_t free_cnt); +int ice_tx_done_cleanup_simple (struct ice_tx_queue *txq,uint32_t free_cnt); +#endif /* _ICE_RXTX_H_ */
Signature · 1 line
2.17.1
PATCH v7 3/4 net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ixgbe driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 4 + drivers/net/ixgbe/ixgbe_rxtx.c | 156 ++++++++++++++++++++++++++++++- drivers/net/ixgbe/ixgbe_rxtx.h | 10 ++ 3 files changed, 169 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +4 -0
@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/*
@@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
@@ -1101,6 +1103,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) eth_dev->rx_pkt_burst = &ixgbe_recv_pkts; eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts; eth_dev->tx_pkt_prepare = &ixgbe_prep_pkts; +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_scalar);/* * For secondary processes, we don't initialise any further as primary
@@ -1580,6 +1583,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) eth_dev->dev_ops = &ixgbevf_eth_dev_ops; eth_dev->rx_pkt_burst = &ixgbe_recv_pkts; eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts; +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_scalar);/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different
drivers/net/ixgbe/ixgbe_rxtx.c +155 -1
182 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_rxtx.h +10 -0
@@ -253,6 +253,8 @@ struct ixgbe_txq_ops { IXGBE_ADVTXD_DCMD_DEXT |\ IXGBE_ADVTXD_DCMD_EOP) +typedef int (*ixgbe_tx_done_cleanup_t )(struct ixgbe_tx_queue *txq, +uint32_t free_cnt);/* Takes an ethdev and a queue and sets up the tx function to be used based on * the queue parameters. Used in tx_queue_setup by primary process and then
@@ -285,6 +287,14 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +void ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_t fn); +ixgbe_tx_done_cleanup_t ixgbe_get_tx_done_cleanup_func (void ); + +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_scalar (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_vec (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ];
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v7 3/4] net/ixgbe: cleanup Tx buffers
Hi Chenxu,
Good progress wih _full_version, but still some issues remains I think. More comments inline.
Konstantin
Quoted 49 lines
Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ixgbe/ixgbe_ethdev.c | 4 + drivers/net/ixgbe/ixgbe_rxtx.c | 156 ++++++++++++++++++++++++++++++- drivers/net/ixgbe/ixgbe_rxtx.h | 10 ++ 3 files changed, 169 insertions(+), 1 deletion(-)drivers/net/ixgbe/ixgbe_ethdev.c +4
-0@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/* @@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_tx_done_cleanup, };/* store statistics names and its offset in stats structure */ @@ -1101,6 +1103,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) eth_dev->rx_pkt_burst = &ixgbe_recv_pkts; eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts; eth_dev->tx_pkt_prepare = &ixgbe_prep_pkts; +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_scalar);/* * For secondary processes, we don't initialise any further as primary @@ -1580,6 +1583,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) eth_dev->dev_ops = &ixgbevf_eth_dev_ops; eth_dev->rx_pkt_burst = &ixgbe_recv_pkts; eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts; +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_scalar);/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different drivers/net/ixgbe/ixgbe_rxtx.c +0
-0
drivers/net/ixgbe/ixgbe_rxtx.c uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, · line 95
Quoted 4 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-0@@ -92,6 +92,8 @@ uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);#endif +static ixgbe_tx_done_cleanup_t ixgbe_tx_done_cleanup_op;
You can't have just one static variable here.
There could be several ixgbe devices and they could be configured in a different way. I.E. txpkt_burst() is per device, so tx_done_cleanup() also has to be per device. Probably the easiest way is to add new entry for tx_done_cleanup into struct ixgbe_txq_ops, and set it properly in ixgbe_set_tx_function().
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2312
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +3
-0+/********************************************************************* * * TX functions @@ -2306,6 +2308,152 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +int +ixgbe_tx_done_cleanup_scalar (struct ixgbe_tx_queue *txq,uint32_t free_cnt)
As a nit I would change _scalar to _full or so.
Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c +5
-0+{ +uint32_t pkt_cnt; +uint16_t i; +uint16_t tx_last; +uint16_t tx_id;
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2327
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+uint16_t nb_tx_to_clean; +uint16_t nb_tx_free_last; +struct ixgbe_tx_entry *swr_ring = txq->sw_ring; + +/* Start free mbuf from the next of tx_tail */ + tx_last = txq->tx_tail; + tx_id = swr_ring[tx_last].next_id; + +if (txq->nb_tx_free ==0 ) +if (ixgbe_xmit_cleanup (txq))
As a nit it could be just if (ixgbe_set_tx_function && ixgbe_xmit_cleanup(txq))
Quoted 20 lines
drivers/net/ixgbe/ixgbe_rxtx.c +20
-0+return 0 ; + + nb_tx_to_clean = txq->nb_tx_free; + nb_tx_free_last = txq->nb_tx_free; +if (!free_cnt) + free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count the amount of +* freeable mubfs and packets. +*/ +for (pkt_cnt =0 ; pkt_cnt < free_cnt; ) { +for (i =0 ; i < nb_tx_to_clean && + pkt_cnt < free_cnt && + tx_id != tx_last; i++) { +if (swr_ring[tx_id].mbuf !=NULL ) { +rte_pktmbuf_free_seg (swr_ring[tx_id].mbuf); + swr_ring[tx_id].mbuf =NULL ; + +/* +* last segment in the packet,
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2357
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+* increment packet count +*/ + pkt_cnt += (swr_ring[tx_id].last_id == tx_id); + } + + tx_id = swr_ring[tx_id].next_id; + } + +if (tx_id == tx_last || txq->tx_rs_thresh + > txq->nb_tx_desc - txq->nb_tx_free)
First condition (tx_id == tx_last) is porbably redundant here.
Quoted 25 lines
drivers/net/ixgbe/ixgbe_rxtx.c +25
-0+break ; + +if (pkt_cnt < free_cnt) { +if (ixgbe_xmit_cleanup (txq)) +break ; + + nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last; + nb_tx_free_last = txq->nb_tx_free; + } + } + +PMD_TX_FREE_LOG (DEBUG , +"Free %u Packets successfully " +"(port=%d queue=%d)" , + pkt_cnt, txq->port_id, txq->queue_id); + +return (int )pkt_cnt; +} + +int +ixgbe_tx_done_cleanup_vec(struct ixgbe_tx_queue *txq __rte_unused, + uint32_t free_cnt __rte_unused) +{ +return -ENOTSUP ; +}
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2392
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+ +int +ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq, +uint32_t free_cnt) +{ +uint16_t i; +uint16_t tx_first; +uint16_t tx_id; +uint32_t pkt_cnt; +struct ixgbe_tx_entry *swr_ring = txq->sw_ring;
Looks overcomplicated here.
TX simple (and vec) doesn't support mulsti-seg packets,
So one TXD - one mbuf, and one packet.
And ixgbe_tx_free_bufs() always retunrs/frees either 0 or tx_rs_thresh mbufs/packets. So it probably can be something like that:
ixgbe_tx_done_cleanup_simple(struct ixgbe_tx_queue *txq, uint32_t free_cnt) {
If (free_cnt == 0)
free_cnt = txq->nb_desc;
cnt = free_cnt - free_cnt % txq->tx_rs_thesh;
for (i = 0; i < cnt; i+= n) {
n = ixgbe_tx_free_bufs(txq);
if (n == 0)
break;
}
return i;
}Quoted 121 lines
drivers/net/ixgbe/ixgbe_rxtx.c +71
-1+ +/* Start free mbuf from tx_first */ + tx_first = txq->tx_next_dd - (txq->tx_rs_thresh -1 ); + tx_id = tx_first; + +/* while free_cnt is 0, +* suppose one mbuf per packet, +* try to free packets as many as possible +*/ +if (free_cnt ==0 ) + free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count freeable packets */ +for (pkt_cnt =0 ; pkt_cnt < free_cnt; ) { +if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh) +break ; + +if (!ixgbe_tx_free_bufs (txq)) +break ; + +for (i =0 ; i != txq->tx_rs_thresh && + tx_id != tx_first; i++) { +/* last segment in the packet, +* increment packet count +*/ + pkt_cnt += (tx_id == swr_ring[tx_id].last_id); + tx_id = swr_ring[tx_id].next_id; + } + +if (tx_id == tx_first) +break ; + } + +PMD_TX_FREE_LOG (DEBUG , +"Free %u packets successfully " +"(port=%d queue=%d)" , + pkt_cnt, txq->port_id, txq->queue_id); + +return (int )pkt_cnt; +} + +int +ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt) +{ +ixgbe_tx_done_cleanup_t func =ixgbe_get_tx_done_cleanup_func (); + +if (!func) +return -ENOTSUP ; + +return func (txq, free_cnt); +} + +void +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_t fn) +{ + ixgbe_tx_done_cleanup_op = fn; +} + +ixgbe_tx_done_cleanup_t +ixgbe_get_tx_done_cleanup_func (void ) +{ +return ixgbe_tx_done_cleanup_op; +} +static void __attribute__((cold))ixgbe_tx_free_swring (struct ixgbe_tx_queue *txq) {@@ -2398,9 +2546,14 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) ixgbe_txq_vec_setup(txq) == 0)) { PMD_INIT_LOG(DEBUG, "Vector tx enabled."); dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; - } else + ixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_vec); + } else {#endif dev->tx_pkt_burst = ixgbe_xmit_pkts_simple; +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_simple); +#ifdef RTE_IXGBE_INC_VECTOR + } +#endif }else {PMD_INIT_LOG (DEBUG ,"Using full-featured tx code path" ); PMD_INIT_LOG(DEBUG,@@ -2412,6 +2565,7 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) (unsigned long)RTE_PMD_IXGBE_TX_MAX_BURST); dev->tx_pkt_burst = ixgbe_xmit_pkts; dev->tx_pkt_prepare = ixgbe_prep_pkts; +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_scalar); } }drivers/net/ixgbe/ixgbe_rxtx.h +10
-1@@ -253,6 +253,8 @@ struct ixgbe_txq_ops { IXGBE_ADVTXD_DCMD_DEXT |\ IXGBE_ADVTXD_DCMD_EOP) +typedef int (*ixgbe_tx_done_cleanup_t )(struct ixgbe_tx_queue *txq, +uint32_t free_cnt);/* Takes an ethdev and a queue and sets up the tx function to be used based on * the queue parameters. Used in tx_queue_setup by primary process and then @@ -285,6 +287,14 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +void ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_t fn); +ixgbe_tx_done_cleanup_t ixgbe_get_tx_done_cleanup_func (void ); + +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_scalar (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_vec (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ]; --2.17.1
Re: [dpdk-dev] [PATCH v7 3/4] net/ixgbe: cleanup Tx buffers
hi, Konstantin
thanks for your opinion, I have fixed almost in new version patch except one.
Quoted 133 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, January 9, 2020 10:02 PM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v7 3/4] net/ixgbe: cleanup Tx buffersHi Chenxu,
Good progress wih
_full_version, but still some issues remains I think. More comments inline.
Konstantindrivers/net/ixgbe/ixgbe_ethdev.c static const struct eth_dev_ops ixgbevf_eth_dev_ops
Quoted 22 lines
Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ixgbe/ixgbe_ethdev.c | 4 + drivers/net/ixgbe/ixgbe_rxtx.c | 156 ++++++++++++++++++++++++++++++- drivers/net/ixgbe/ixgbe_rxtx.h | 10 ++ 3 files changed, 169 insertions(+), 1 deletion(-)drivers/net/ixgbe/ixgbe_ethdev.c +1
-0@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, +.tx_done_cleanup = ixgbe_tx_done_cleanup, };/* @@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops= {
drivers/net/ixgbe/ixgbe_rxtx.c uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue,
Quoted 28 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1
-1.reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, +.tx_done_cleanup = ixgbe_tx_done_cleanup, }; /* store statistics names and its offset in stats structure */ @@ -1101,6 +1103,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev,void
*init_params__rte_unused)eth_dev->rx_pkt_burst=&ixgbe_recv_pkts;eth_dev->tx_pkt_burst=&ixgbe_xmit_pkts;eth_dev->tx_pkt_prepare=&ixgbe_prep_pkts; +ixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_scalar);/*
* For secondary processes, we don't initialise any further as
primary @@ -1580,6 +1583,7 @@eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)eth_dev->dev_ops=&ixgbevf_eth_dev_ops;eth_dev->rx_pkt_burst=&ixgbe_recv_pkts;eth_dev->tx_pkt_burst=&ixgbe_xmit_pkts;drivers/net/ixgbe/ixgbe_ethdev.c +1
-0+ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_scalar);/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different (quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_rxtx.cindexfa572d184..122dae425100644drivers/net/ixgbe/ixgbe_rxtx.c +0
-0@@ -92,6 +92,8 @@ uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue,struct
rte_mbuf**tx_pkts,drivers/net/ixgbe/ixgbe_rxtx.c uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, · line 95
Quoted 4 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-0uint16_t nb_pkts);#endif +static ixgbe_tx_done_cleanup_t ixgbe_tx_done_cleanup_op;You can't have just one static variable here.
There could be several ixgbe devices and they could be configured in a different way.
I.E.txpkt_burst()is per device, sotx_done_cleanup()also has to be per device. Probably the easiest way is to add new entry fortx_done_cleanupinto structixgbe_txq_ops, and set it properly inixgbe_set_tx_function().drivers/net/ixgbe/ixgbe_rxtx.c uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, · line 97
Quoted 2 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-0+/****************************************************************
*****drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct · line 2312
Quoted 8 lines
drivers/net/ixgbe/ixgbe_rxtx.c +3
-0* * TX functions @@ -2306,6 +2308,152 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +int +ixgbe_tx_done_cleanup_scalar (struct ixgbe_tx_queue *txq,uint32_t +free_cnt)As a nit I would change
_scalarto_fullor so.Quoted 4 lines
drivers/net/ixgbe/ixgbe_rxtx.c +4
-0+{ +uint32_t pkt_cnt; +uint16_t i; +uint16_t tx_last;drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2327
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+uint16_t tx_id; +uint16_t nb_tx_to_clean; +uint16_t nb_tx_free_last; +struct ixgbe_tx_entry *swr_ring = txq->sw_ring; + +/* Start free mbuf from the next of tx_tail */ tx_last = +txq->tx_tail; tx_id = swr_ring[tx_last].next_id; + +if (txq->nb_tx_free ==0 ) +if (ixgbe_xmit_cleanup (txq))As a nit it could be just if (
ixgbe_set_tx_function&&ixgbe_xmit_cleanup(txq))Quoted 21 lines
drivers/net/ixgbe/ixgbe_rxtx.c +21
-0+return 0 ; + +nb_tx_to_clean = txq->nb_tx_free; +nb_tx_free_last = txq->nb_tx_free; +if (!free_cnt) +free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count the amount of +* freeable mubfs and packets. +*/ +for (pkt_cnt =0 ; pkt_cnt < free_cnt; ) {for (i =0 ; i < +nb_tx_to_clean && pkt_cnt < free_cnt && tx_id != tx_last; i++) {if +(swr_ring[tx_id].mbuf !=NULL ) { +rte_pktmbuf_free_seg (swr_ring[tx_id].mbuf); +swr_ring[tx_id].mbuf =NULL ; + +/* +* last segment in the packet, +* increment packet count +*/ +pkt_cnt += (swr_ring[tx_id].last_id == tx_id); }
Quoted 9 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2357
Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx.c +6
-0+ +tx_id = swr_ring[tx_id].next_id; +} + +if (tx_id == tx_last || txq->tx_rs_thresh +> txq->nb_tx_desc - txq->nb_tx_free)First condition (
tx_id==tx_last) is porbably redundant here.
I think it is necessary. The txq may transmit packets when the API called. So txq->nb_tx_free may be changed.
If (tx_id == tx_last) , it will break the loop above and the function should be done and return. However if more than txq->tx_rs_thresh numbers packet send into txq while function doing. It will not return. And fall in endless loop
Quoted 163 lines
Quoted 15 lines
drivers/net/ixgbe/ixgbe_rxtx.c +15
-0+break ; + +if (pkt_cnt < free_cnt) { +if (ixgbe_xmit_cleanup (txq)) +break ; + +nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last; nb_tx_free_last = +txq->nb_tx_free; } } + +PMD_TX_FREE_LOG (DEBUG , +"Free %u Packets successfully " +"(port=%d queue=%d)" , +pkt_cnt, txq->port_id, txq->queue_id); + +return (int )pkt_cnt;drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq)
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+} + +int +ixgbe_tx_done_cleanup_vec(struct ixgbe_tx_queue *txq __rte_unused, +uint32_t free_cnt __rte_unused) { return -ENOTSUP; } + +int +ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq,uint32_t +free_cnt) {uint16_t i;uint16_t tx_first;uint16_t tx_id;uint32_t +pkt_cnt;struct ixgbe_tx_entry *swr_ring = txq->sw_ring;Looks overcomplicated here.
TX simple (and vec) doesn't support mulsti-seg packets, So one TXD - one mbuf, and one packet.
Andixgbe_tx_free_bufs()always retunrs/frees either 0 ortx_rs_threshmbufs/packets.
So it probably can be something like that:ixgbe_tx_done_cleanup_simple(struct ixgbe_tx_queue *txq, uint32_t free_cnt) { If (free_cnt == 0) free_cnt = txq->nb_desc; cnt = free_cnt - free_cnt % txq->tx_rs_thesh; for (i = 0; i < cnt; i+= n) { n = ixgbe_tx_free_bufs(txq); if (n == 0) break; } return i; }Quoted 73 lines
drivers/net/ixgbe/ixgbe_rxtx.c +57
-0+ +/* Start free mbuf from tx_first */ +tx_first = txq->tx_next_dd - (txq->tx_rs_thresh -1 ); tx_id = +tx_first; + +/* while free_cnt is 0, +* suppose one mbuf per packet, +* try to free packets as many as possible */ if (free_cnt ==0 ) +free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count freeable packets */ for (pkt_cnt = +0 ; pkt_cnt < free_cnt; ) {if (txq->nb_tx_desc - txq->nb_tx_free < +txq->tx_rs_thresh)break ; + +if (!ixgbe_tx_free_bufs (txq)) +break ; + +for (i =0 ; i != txq->tx_rs_thresh && tx_id != tx_first; i++) { +/* last segment in the packet, +* increment packet count +*/ +pkt_cnt += (tx_id == swr_ring[tx_id].last_id); tx_id = +swr_ring[tx_id].next_id; } + +if (tx_id == tx_first) +break ; +} + +PMD_TX_FREE_LOG (DEBUG , +"Free %u packets successfully " +"(port=%d queue=%d)" , +pkt_cnt, txq->port_id, txq->queue_id); + +return (int )pkt_cnt; +} + +int +ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt) { +ixgbe_tx_done_cleanup_t func =ixgbe_get_tx_done_cleanup_func (); + +if (!func) +return -ENOTSUP ; + +return func (txq, free_cnt); +} + +void +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_t fn) { +ixgbe_tx_done_cleanup_op = fn; } + +ixgbe_tx_done_cleanup_t +ixgbe_get_tx_done_cleanup_func (void ) +{ +return ixgbe_tx_done_cleanup_op; +} +static void __attribute__((cold)) ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq) { @@ -2398,9 +2546,14 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) ixgbe_txq_vec_setup(txq) == 0)) { PMD_INIT_LOG(DEBUG, "Vector tx enabled."); dev->tx_pkt_burst =
ixgbe_xmit_pkts_vec; -} elsedrivers/net/ixgbe/ixgbe_rxtx.c +6
-0+ixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_vec); +}else {#endif dev->tx_pkt_burst = ixgbe_xmit_pkts_simple; +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_simple); +#ifdef RTE_IXGBE_INC_VECTOR +} +#endif }else {PMD_INIT_LOG (DEBUG ,"Using full-featured tx code path" );Quoted 1 line
PMD_INIT_LOG(DEBUG, @@ -2412,6 +2565,7 @@
ixgbe_set_tx_function(struct
Quoted 12 lines
rte_eth_dev*dev, structixgbe_tx_queue*txq) (unsigned long)RTE_PMD_IXGBE_TX_MAX_BURST);dev->tx_pkt_burst=ixgbe_xmit_pkts;dev->tx_pkt_prepare=ixgbe_prep_pkts;drivers/net/ixgbe/ixgbe_rxtx.c +1
-0+ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_scalar); } }(quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..a52597aa9100644drivers/net/ixgbe/ixgbe_rxtx.h struct ixgbe_txq_ops { · line 259
Quoted 7 lines
drivers/net/ixgbe/ixgbe_rxtx.h +2
-0@@ -253,6 +253,8 @@ struct ixgbe_txq_ops { IXGBE_ADVTXD_DCMD_DEXT |\ IXGBE_ADVTXD_DCMD_EOP) +typedef int (*ixgbe_tx_done_cleanup_t )(struct ixgbe_tx_queue *txq, +uint32_t free_cnt);/* Takes an ethdev and a queue and sets up the tx function to be used based on
Quoted 20 lines
drivers/net/ixgbe/ixgbe_rxtx.h +0
-0* the queue parameters. Used in tx_queue_setup by primary process and then @@ -285,6 +287,14 @@ int
ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +9
-1+void ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_t fn); +ixgbe_tx_done_cleanup_t ixgbe_get_tx_done_cleanup_func (void ); + +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt);int +ixgbe_tx_done_cleanup_scalar (struct ixgbe_tx_queue *txq,uint32_t +free_cnt);int ixgbe_tx_done_cleanup_vec (struct ixgbe_tx_queue *txq, +uint32_t free_cnt);int ixgbe_tx_done_cleanup_simple (struct +ixgbe_tx_queue *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ]; --2.17.1
Re: [dpdk-dev] [PATCH v7 3/4] net/ixgbe: cleanup Tx buffers
Hi Chenxu,
Quoted 147 lines
hi, Konstantin
thanks for your opinion, I have fixed almost in new version patch except one.
Quoted 133 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, January 9, 2020 10:02 PM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v7 3/4] net/ixgbe: cleanup Tx buffersHi Chenxu,
Good progress wih
_full_version, but still some issues remains I think. More comments inline.
Konstantindrivers/net/ixgbe/ixgbe_ethdev.c static const struct eth_dev_ops ixgbevf_eth_dev_ops
Quoted 22 lines
Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ixgbe/ixgbe_ethdev.c | 4 + drivers/net/ixgbe/ixgbe_rxtx.c | 156 ++++++++++++++++++++++++++++++- drivers/net/ixgbe/ixgbe_rxtx.h | 10 ++ 3 files changed, 169 insertions(+), 1 deletion(-)drivers/net/ixgbe/ixgbe_ethdev.c +1
-0@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, +.tx_done_cleanup = ixgbe_tx_done_cleanup, };/* @@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops= {
drivers/net/ixgbe/ixgbe_rxtx.c uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue,
Quoted 28 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1
-1.reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, +.tx_done_cleanup = ixgbe_tx_done_cleanup, }; /* store statistics names and its offset in stats structure */ @@ -1101,6 +1103,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev,void
*init_params__rte_unused)eth_dev->rx_pkt_burst=&ixgbe_recv_pkts;eth_dev->tx_pkt_burst=&ixgbe_xmit_pkts;eth_dev->tx_pkt_prepare=&ixgbe_prep_pkts; +ixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_scalar);/*
* For secondary processes, we don't initialise any further as
primary @@ -1580,6 +1583,7 @@eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)eth_dev->dev_ops=&ixgbevf_eth_dev_ops;eth_dev->rx_pkt_burst=&ixgbe_recv_pkts;eth_dev->tx_pkt_burst=&ixgbe_xmit_pkts;drivers/net/ixgbe/ixgbe_ethdev.c +1
-0+ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_scalar);/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different (quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_rxtx.cindexfa572d184..122dae425100644drivers/net/ixgbe/ixgbe_rxtx.c +0
-0@@ -92,6 +92,8 @@ uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue,struct
rte_mbuf**tx_pkts,drivers/net/ixgbe/ixgbe_rxtx.c uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, · line 95
Quoted 4 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-0uint16_t nb_pkts);#endif +static ixgbe_tx_done_cleanup_t ixgbe_tx_done_cleanup_op;You can't have just one static variable here.
There could be several ixgbe devices and they could be configured in a different way.
I.E.txpkt_burst()is per device, sotx_done_cleanup()also has to be per device. Probably the easiest way is to add new entry fortx_done_cleanupinto structixgbe_txq_ops, and set it properly inixgbe_set_tx_function().drivers/net/ixgbe/ixgbe_rxtx.c uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, · line 97
Quoted 2 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-0+/****************************************************************
*****drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct · line 2312
Quoted 8 lines
drivers/net/ixgbe/ixgbe_rxtx.c +3
-0* * TX functions @@ -2306,6 +2308,152 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +int +ixgbe_tx_done_cleanup_scalar (struct ixgbe_tx_queue *txq,uint32_t +free_cnt)As a nit I would change
_scalarto_fullor so.Quoted 4 lines
drivers/net/ixgbe/ixgbe_rxtx.c +4
-0+{ +uint32_t pkt_cnt; +uint16_t i; +uint16_t tx_last;drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2327
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+uint16_t tx_id; +uint16_t nb_tx_to_clean; +uint16_t nb_tx_free_last; +struct ixgbe_tx_entry *swr_ring = txq->sw_ring; + +/* Start free mbuf from the next of tx_tail */ tx_last = +txq->tx_tail; tx_id = swr_ring[tx_last].next_id; + +if (txq->nb_tx_free ==0 ) +if (ixgbe_xmit_cleanup (txq))As a nit it could be just if (
ixgbe_set_tx_function&&ixgbe_xmit_cleanup(txq))Quoted 21 lines
drivers/net/ixgbe/ixgbe_rxtx.c +21
-0+return 0 ; + +nb_tx_to_clean = txq->nb_tx_free; +nb_tx_free_last = txq->nb_tx_free; +if (!free_cnt) +free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count the amount of +* freeable mubfs and packets. +*/ +for (pkt_cnt =0 ; pkt_cnt < free_cnt; ) {for (i =0 ; i < +nb_tx_to_clean && pkt_cnt < free_cnt && tx_id != tx_last; i++) {if +(swr_ring[tx_id].mbuf !=NULL ) { +rte_pktmbuf_free_seg (swr_ring[tx_id].mbuf); +swr_ring[tx_id].mbuf =NULL ; + +/* +* last segment in the packet, +* increment packet count +*/ +pkt_cnt += (swr_ring[tx_id].last_id == tx_id); }Quoted 9 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2357
Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx.c +6
-0+ +tx_id = swr_ring[tx_id].next_id; +} + +if (tx_id == tx_last || txq->tx_rs_thresh +> txq->nb_tx_desc - txq->nb_tx_free)First condition (
tx_id==tx_last) is porbably redundant here.
Quoted 1 line
I think it is necessary. The txq may transmit packets when the API called.
Nope it is not possible.
All ethdev RX/TX API is not thread safe.
It will be a race condition that most likely will cause either crash or memory corruption.
Quoted 170 lines
So
txq->nb_tx_freemay be changed.If (
tx_id==tx_last) , it will break the loop above and the function should be done and return. However if more thantxq->tx_rs_threshnumbers packet send into txq while function doing. It will not return. And fall in endless loopQuoted 163 lines
Quoted 15 lines
drivers/net/ixgbe/ixgbe_rxtx.c +15
-0+break ; + +if (pkt_cnt < free_cnt) { +if (ixgbe_xmit_cleanup (txq)) +break ; + +nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last; nb_tx_free_last = +txq->nb_tx_free; } } + +PMD_TX_FREE_LOG (DEBUG , +"Free %u Packets successfully " +"(port=%d queue=%d)" , +pkt_cnt, txq->port_id, txq->queue_id); + +return (int )pkt_cnt;drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq)
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+} + +int +ixgbe_tx_done_cleanup_vec(struct ixgbe_tx_queue *txq __rte_unused, +uint32_t free_cnt __rte_unused) { return -ENOTSUP; } + +int +ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq,uint32_t +free_cnt) {uint16_t i;uint16_t tx_first;uint16_t tx_id;uint32_t +pkt_cnt;struct ixgbe_tx_entry *swr_ring = txq->sw_ring;Looks overcomplicated here.
TX simple (and vec) doesn't support mulsti-seg packets, So one TXD - one mbuf, and one packet.
Andixgbe_tx_free_bufs()always retunrs/frees either 0 ortx_rs_threshmbufs/packets.
So it probably can be something like that:ixgbe_tx_done_cleanup_simple(struct ixgbe_tx_queue *txq, uint32_t free_cnt) { If (free_cnt == 0) free_cnt = txq->nb_desc; cnt = free_cnt - free_cnt % txq->tx_rs_thesh; for (i = 0; i < cnt; i+= n) { n = ixgbe_tx_free_bufs(txq); if (n == 0) break; } return i; }Quoted 73 lines
drivers/net/ixgbe/ixgbe_rxtx.c +57
-0+ +/* Start free mbuf from tx_first */ +tx_first = txq->tx_next_dd - (txq->tx_rs_thresh -1 ); tx_id = +tx_first; + +/* while free_cnt is 0, +* suppose one mbuf per packet, +* try to free packets as many as possible */ if (free_cnt ==0 ) +free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count freeable packets */ for (pkt_cnt = +0 ; pkt_cnt < free_cnt; ) {if (txq->nb_tx_desc - txq->nb_tx_free < +txq->tx_rs_thresh)break ; + +if (!ixgbe_tx_free_bufs (txq)) +break ; + +for (i =0 ; i != txq->tx_rs_thresh && tx_id != tx_first; i++) { +/* last segment in the packet, +* increment packet count +*/ +pkt_cnt += (tx_id == swr_ring[tx_id].last_id); tx_id = +swr_ring[tx_id].next_id; } + +if (tx_id == tx_first) +break ; +} + +PMD_TX_FREE_LOG (DEBUG , +"Free %u packets successfully " +"(port=%d queue=%d)" , +pkt_cnt, txq->port_id, txq->queue_id); + +return (int )pkt_cnt; +} + +int +ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt) { +ixgbe_tx_done_cleanup_t func =ixgbe_get_tx_done_cleanup_func (); + +if (!func) +return -ENOTSUP ; + +return func (txq, free_cnt); +} + +void +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_t fn) { +ixgbe_tx_done_cleanup_op = fn; } + +ixgbe_tx_done_cleanup_t +ixgbe_get_tx_done_cleanup_func (void ) +{ +return ixgbe_tx_done_cleanup_op; +} +static void __attribute__((cold)) ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq) { @@ -2398,9 +2546,14 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) ixgbe_txq_vec_setup(txq) == 0)) { PMD_INIT_LOG(DEBUG, "Vector tx enabled."); dev->tx_pkt_burst =
ixgbe_xmit_pkts_vec; -} elsedrivers/net/ixgbe/ixgbe_rxtx.c +6
-0+ixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_vec); +}else {#endif dev->tx_pkt_burst = ixgbe_xmit_pkts_simple; +ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_simple); +#ifdef RTE_IXGBE_INC_VECTOR +} +#endif }else {PMD_INIT_LOG (DEBUG ,"Using full-featured tx code path" );Quoted 1 line
PMD_INIT_LOG(DEBUG, @@ -2412,6 +2565,7 @@
ixgbe_set_tx_function(struct
Quoted 12 lines
rte_eth_dev*dev, structixgbe_tx_queue*txq) (unsigned long)RTE_PMD_IXGBE_TX_MAX_BURST);dev->tx_pkt_burst=ixgbe_xmit_pkts;dev->tx_pkt_prepare=ixgbe_prep_pkts;drivers/net/ixgbe/ixgbe_rxtx.c +1
-0+ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_scalar); } }(quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_rxtx.hindex505d344b9..a52597aa9100644drivers/net/ixgbe/ixgbe_rxtx.h struct ixgbe_txq_ops { · line 259
Quoted 7 lines
drivers/net/ixgbe/ixgbe_rxtx.h +2
-0@@ -253,6 +253,8 @@ struct ixgbe_txq_ops { IXGBE_ADVTXD_DCMD_DEXT |\ IXGBE_ADVTXD_DCMD_EOP) +typedef int (*ixgbe_tx_done_cleanup_t )(struct ixgbe_tx_queue *txq, +uint32_t free_cnt);/* Takes an ethdev and a queue and sets up the tx function to be used based on
Quoted 20 lines
drivers/net/ixgbe/ixgbe_rxtx.h +0
-0* the queue parameters. Used in tx_queue_setup by primary process and then @@ -285,6 +287,14 @@ int
ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); intixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); voidixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);drivers/net/ixgbe/ixgbe_rxtx.h +9
-1+void ixgbe_set_tx_done_cleanup_func (ixgbe_tx_done_cleanup_t fn); +ixgbe_tx_done_cleanup_t ixgbe_get_tx_done_cleanup_func (void ); + +int ixgbe_tx_done_cleanup (void *txq,uint32_t free_cnt);int +ixgbe_tx_done_cleanup_scalar (struct ixgbe_tx_queue *txq,uint32_t +free_cnt);int ixgbe_tx_done_cleanup_vec (struct ixgbe_tx_queue *txq, +uint32_t free_cnt);int ixgbe_tx_done_cleanup_simple (struct +ixgbe_tx_queue *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ]; --2.17.1
PATCH v7 4/4 net/e1000: cleanup Tx buffers
In reply to Chenxu DiAdd support to the igb vf for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/e1000/igb_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -446,6 +446,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_descriptor_status = eth_igb_tx_descriptor_status, .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, + .tx_done_cleanup = eth_igb_tx_done_cleanup, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get,
Signature · 1 line
2.17.1
v8 cover drivers/net: cleanup Tx buffers
In reply to Chenxu DiAdd support to the drivers inclulding i40e, ice, ixgbe and igb vf for the API rte_eth_tx_done_cleanup to force
free consumed buffers on Tx ring.
---
v8:
deleted function pointer by using other way.
v7:
changed the design of code, reuse exist function.
Chenxu Di (4):
net/i40e: cleanup Tx buffers
net/ice: cleanup Tx buffers
net/ixgbe: cleanup Tx buffers
net/e1000: cleanup Tx buffers
drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 109 +++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 4 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 113 ++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 5 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 109 +++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 8 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 1 + drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 1 + 13 files changed, 355 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
PATCH v8 1/4 net/i40e: cleanup Tx buffers
Add support to the i40e driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 109 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 4 ++ 4 files changed, 115 insertions(+)
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/*
drivers/net/i40e/i40e_rxtx.c +109 -0
115 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx.h +4 -0
@@ -212,6 +212,10 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void i40e_reset_rx_queue (struct i40e_rx_queue *rxq);void i40e_reset_tx_queue (struct i40e_tx_queue *txq);void i40e_tx_queue_release_mbufs (struct i40e_tx_queue *txq); +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt); +int i40e_tx_done_cleanup_full (struct i40e_tx_queue *txq,uint32_t free_cnt); +int i40e_tx_done_cleanup_vec (struct i40e_tx_queue *txq,uint32_t free_cnt); +int i40e_tx_done_cleanup_simple (struct i40e_tx_queue *txq,uint32_t free_cnt);int i40e_alloc_rx_queue_mbufs (struct i40e_rx_queue *rxq);void i40e_rx_queue_release_mbufs (struct i40e_rx_queue *rxq);
Signature · 1 line
2.17.1
PATCH v8 2/4 net/ice: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ice driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 113 +++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 5 ++ 3 files changed, 119 insertions(+)
drivers/net/ice/ice_ethdev.c +1 -0
@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ice/ice_rxtx.c +113 -0
125 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +5 -0
@@ -202,4 +202,9 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue,uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt); +int ice_tx_done_cleanup_full (struct ice_tx_queue *txq,uint32_t free_cnt); +int ice_tx_done_cleanup_vec (struct ice_tx_queue *txq,uint32_t free_cnt); +int ice_tx_done_cleanup_simple (struct ice_tx_queue *txq,uint32_t free_cnt); +#endif /* _ICE_RXTX_H_ */
Signature · 1 line
2.17.1
PATCH v8 3/4 net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ixgbe driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 109 ++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 8 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 1 + drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 1 + 5 files changed, 120 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -0
@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/*
@@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ixgbe/ixgbe_rxtx.c +109 -0
121 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_rxtx.h +7 -1
@@ -238,6 +238,7 @@ struct ixgbe_txq_ops {void (*release_mbufs)(struct ixgbe_tx_queue *txq);void (*free_swring)(struct ixgbe_tx_queue *txq);void (*reset)(struct ixgbe_tx_queue *txq); +int (*txq_done_cleanup)(struct ixgbe_tx_queue *txq,uint32_t free_cnt); };/*
@@ -253,7 +254,6 @@ struct ixgbe_txq_ops {IXGBE_ADVTXD_DCMD_DEXT |\ IXGBE_ADVTXD_DCMD_EOP) -/* Takes an ethdev and a queue and sets up the tx function to be used based on * the queue parameters. Used in tx_queue_setup by primary process and then * in dev_init by secondary process when attaching to an existing ethdev.
@@ -285,6 +285,12 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +int ixgbe_dev_tx_done_cleanup (void *tx_queue,uint32_t free_cnt); +int ixgbe_tx_done_cleanup (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_full (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_vec (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ];
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +1 -0
@@ -559,6 +559,7 @@ static const struct ixgbe_txq_ops vec_txq_ops = { .release_mbufs = ixgbe_tx_queue_release_mbufs_vec, .free_swring = ixgbe_tx_free_swring, .reset = ixgbe_reset_tx_queue, + .txq_done_cleanup = ixgbe_tx_done_cleanup_vec, }; int __attribute__((cold))
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +1 -0
@@ -730,6 +730,7 @@ static const struct ixgbe_txq_ops vec_txq_ops = { .release_mbufs = ixgbe_tx_queue_release_mbufs_vec, .free_swring = ixgbe_tx_free_swring, .reset = ixgbe_reset_tx_queue, + .txq_done_cleanup = ixgbe_tx_done_cleanup_vec, }; int __attribute__((cold))
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v8 3/4] net/ixgbe: cleanup Tx buffers
Quoted 182 lines
Add support to the ixgbe driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 109 ++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 8 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 1 + drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 1 + 5 files changed, 120 insertions(+), 1 deletion(-)drivers/net/ixgbe/ixgbe_ethdev.c +2
-0@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/* @@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/* store statistics names and its offset in stats structure */ drivers/net/ixgbe/ixgbe_rxtx.c +109
-0@@ -2306,6 +2306,114 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +int +ixgbe_tx_done_cleanup_full (struct ixgbe_tx_queue *txq,uint32_t free_cnt) +{ +uint32_t pkt_cnt; +uint16_t i; +uint16_t tx_last; +uint16_t tx_id; +uint16_t nb_tx_to_clean; +uint16_t nb_tx_free_last; +struct ixgbe_tx_entry *swr_ring = txq->sw_ring; + +/* Start free mbuf from the next of tx_tail */ + tx_last = txq->tx_tail; + tx_id = swr_ring[tx_last].next_id; + +if (txq->nb_tx_free ==0 &&ixgbe_xmit_cleanup (txq)) +return 0 ; + + nb_tx_to_clean = txq->nb_tx_free; + nb_tx_free_last = txq->nb_tx_free; +if (!free_cnt) + free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count the amount of +* freeable mubfs and packets. +*/ +for (pkt_cnt =0 ; pkt_cnt < free_cnt; ) { +for (i =0 ; i < nb_tx_to_clean && + pkt_cnt < free_cnt && + tx_id != tx_last; i++) { +if (swr_ring[tx_id].mbuf !=NULL ) { +rte_pktmbuf_free_seg (swr_ring[tx_id].mbuf); + swr_ring[tx_id].mbuf =NULL ; + +/* +* last segment in the packet, +* increment packet count +*/ + pkt_cnt += (swr_ring[tx_id].last_id == tx_id); + } + + tx_id = swr_ring[tx_id].next_id; + } + +if (txq->tx_rs_thresh > txq->nb_tx_desc - + txq->nb_tx_free || tx_id == tx_last) +break ; + +if (pkt_cnt < free_cnt) { +if (ixgbe_xmit_cleanup (txq)) +break ; + + nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last; + nb_tx_free_last = txq->nb_tx_free; + } + } + +return (int )pkt_cnt; +} + +int +ixgbe_tx_done_cleanup_vec(struct ixgbe_tx_queue *txq __rte_unused, + uint32_t free_cnt __rte_unused) +{ +return -ENOTSUP ; +} + +int +ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq, +uint32_t free_cnt) +{ +int i, n, cnt; + +if (free_cnt ==0 || free_cnt > txq->nb_tx_desc) + free_cnt = txq->nb_tx_desc; + + cnt = free_cnt - free_cnt % txq->tx_rs_thresh; + +for (i =0 ; i < cnt; i += n) { +if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh) +break ; + + n =ixgbe_tx_free_bufs (txq); + +if (n ==0 ) +break ; + } + +return i; +} + +int +ixgbe_dev_tx_done_cleanup (void *tx_queue,uint32_t free_cnt) +{ +struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; +return txq->ops->txq_done_cleanup (txq, free_cnt); +} + +int +ixgbe_tx_done_cleanup (struct ixgbe_tx_queue *txq,uint32_t free_cnt) +{ +/* Use a simple Tx queue (no offloads, no multi segs) if possible */ +if (txq->offloads ==0 ) +return ixgbe_tx_done_cleanup_simple (txq, free_cnt); +else +return ixgbe_tx_done_cleanup_full (txq, free_cnt); +} +static void __attribute__((cold))ixgbe_tx_free_swring (struct ixgbe_tx_queue *txq) {@@ -2375,6 +2483,7 @@ static const struct ixgbe_txq_ops def_txq_ops = { .release_mbufs = ixgbe_tx_queue_release_mbufs, .free_swring = ixgbe_tx_free_swring, .reset = ixgbe_reset_tx_queue, + .txq_done_cleanup = ixgbe_tx_done_cleanup, };/* Takes an ethdev and a queue and sets up the tx function to be used based on drivers/net/ixgbe/ixgbe_rxtx.h +1
-1@@ -238,6 +238,7 @@ struct ixgbe_txq_ops {void (*release_mbufs)(struct ixgbe_tx_queue *txq);void (*free_swring)(struct ixgbe_tx_queue *txq);void (*reset)(struct ixgbe_tx_queue *txq); +int (*txq_done_cleanup)(struct ixgbe_tx_queue *txq,uint32_t free_cnt); };/* @@ -253,7 +254,6 @@ struct ixgbe_txq_ops {IXGBE_ADVTXD_DCMD_DEXT |\ IXGBE_ADVTXD_DCMD_EOP) -/* Takes an ethdev and a queue and sets up the tx function to be used based on * the queue parameters. Used in tx_queue_setup by primary process and then * in dev_init by secondary process when attaching to an existing ethdev.
drivers/net/ixgbe/ixgbe_rxtx.h int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); · line 288
Quoted 4 lines
drivers/net/ixgbe/ixgbe_rxtx.h +1
-0@@ -285,6 +285,12 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +int ixgbe_dev_tx_done_cleanup (void *tx_queue,uint32_t free_cnt);
As a nit: I don't think you need to make these 4 functions below extrernal. _cleanup(), cleanup_full and cleanup_simple can be static ones in ixgbe_rxtx.c
_cleanup_vec() can be static in ixgbe_rxtx_vec_common.h BTW, I think _cleanup_vec() will be identical to cleanup_simple().
Apart, from that:
As a side notice, I think we need to add into test-pmd ability to call/test tx_cleanup_done (either as a separate command, or new fwd mode, or...). But that probably subject for separate patch series.
Quoted 34 lines
drivers/net/ixgbe/ixgbe_rxtx.h +5
-0+int ixgbe_tx_done_cleanup (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_full (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_vec (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +int ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq,uint32_t free_cnt); +extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ];drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +1
-0@@ -559,6 +559,7 @@ static const struct ixgbe_txq_ops vec_txq_ops = { .release_mbufs = ixgbe_tx_queue_release_mbufs_vec, .free_swring = ixgbe_tx_free_swring, .reset = ixgbe_reset_tx_queue, + .txq_done_cleanup = ixgbe_tx_done_cleanup_vec, }; int __attribute__((cold))drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +1
-1@@ -730,6 +730,7 @@ static const struct ixgbe_txq_ops vec_txq_ops = { .release_mbufs = ixgbe_tx_queue_release_mbufs_vec, .free_swring = ixgbe_tx_free_swring, .reset = ixgbe_reset_tx_queue, + .txq_done_cleanup = ixgbe_tx_done_cleanup_vec, }; int __attribute__((cold)) --2.17.1
PATCH v8 4/4 net/e1000: cleanup Tx buffers
In reply to Chenxu DiAdd support to the igb vf for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/e1000/igb_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -446,6 +446,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_descriptor_status = eth_igb_tx_descriptor_status, .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, + .tx_done_cleanup = eth_igb_tx_done_cleanup, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get,
Signature · 1 line
2.17.1
v9 cover drivers/net: cleanup Tx buffers
In reply to Chenxu DiAdd support to the drivers inclulding i40e, ice, ixgbe and igb vf for the API rte_eth_tx_done_cleanup to force
free consumed buffers on Tx ring.
---
v9:
removed function pointer in ixgbe.
changed function to static.
v8:
deleted function pointer by using other way.
v7:
changed the design of code, reuse exist function.
Chenxu Di (4):
net/i40e: cleanup Tx buffers
net/ice: cleanup Tx buffers
net/ixgbe: cleanup Tx buffers
net/e1000: cleanup Tx buffers
drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 107 ++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 111 ++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 2 + drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 109 +++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 +- 11 files changed, 337 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
PATCH v9 1/4 net/i40e: cleanup Tx buffers
Add support to the i40e driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 107 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + 4 files changed, 110 insertions(+)
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .mac_addr_set = i40e_set_default_mac_addr, .mtu_set = i40e_dev_mtu_set, .tm_ops_get = i40e_tm_ops_get, + .tx_done_cleanup = i40e_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, .mtu_set = i40evf_dev_mtu_set, .mac_addr_set = i40evf_set_default_mac_addr, + .tx_done_cleanup = i40e_tx_done_cleanup, };/*
drivers/net/i40e/i40e_rxtx.c +107 -0
113 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx.h +1 -0
@@ -212,6 +212,7 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);void i40e_reset_rx_queue (struct i40e_rx_queue *rxq);void i40e_reset_tx_queue (struct i40e_tx_queue *txq);void i40e_tx_queue_release_mbufs (struct i40e_tx_queue *txq); +int i40e_tx_done_cleanup (void *txq,uint32_t free_cnt);int i40e_alloc_rx_queue_mbufs (struct i40e_rx_queue *rxq);void i40e_rx_queue_release_mbufs (struct i40e_rx_queue *rxq);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v9 1/4] net/i40e: cleanup Tx buffers
Quoted 9 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Chenxu Di
Sent: Monday, January 13, 2020 9:57 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [dpdk-dev] [PATCH v9 1/4] net/i40e: cleanup Tx buffers
Quoted 5 lines
Add support to the i40e driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>---
Quoted 2 lines
--
2.17.1
PATCH v9 2/4 net/ice: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ice driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 111 +++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 2 + 3 files changed, 114 insertions(+)
drivers/net/ice/ice_ethdev.c +1 -0
@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ice/ice_rxtx.c +111 -0
123 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +2 -0
@@ -202,4 +202,6 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue,uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt); +#endif /* _ICE_RXTX_H_ */
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v9 2/4] net/ice: cleanup Tx buffers
Quoted 10 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Monday, January 13, 2020 5:57 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v9 2/4] net/ice: cleanup Tx buffers
Quoted 4 lines
Add support to the ice driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>
Quoted 158 lines
--- drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 111 +++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 2 + 3 files changed, 114 insertions(+)drivers/net/ice/ice_ethdev.c index renamed from drivers/net/ice/ice_ethdev.c +0
-0
de189daba..b55cdbf74100644drivers/net/ice/ice_ethdev.c +1
-0@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, }; /* store statistics names and its offset in stats structure */ diff --git
a/drivers/net/ice/ice_rxtx.cb/drivers/net/ice/ice_rxtx.cindex2db174456..8f12df807100644drivers/net/ice/ice_rxtx.c +3
-0@@ -863,6 +863,9 @@ ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)return 0 ; } + + + int ice_rx_queue_setup(struct rte_eth_dev *dev,drivers/net/ice/ice_rxtx.c +105
-0uint16_t queue_idx,@@ -2643,6 +2646,114 @@ ice_tx_free_bufs(struct ice_tx_queue *txq)return txq->tx_rs_thresh; } +static int +ice_tx_done_cleanup_full (struct ice_tx_queue *txq, +uint32_t free_cnt) +{ +struct ice_tx_entry *swr_ring = txq->sw_ring; +uint16_t i, tx_last, tx_id; +uint16_t nb_tx_free_last; +uint16_t nb_tx_to_clean; +uint32_t pkt_cnt; + +/* Start free mbuf from the next of tx_tail */ + tx_last = txq->tx_tail; + tx_id = swr_ring[tx_last].next_id; + +if (txq->nb_tx_free ==0 &&ice_xmit_cleanup (txq)) +return 0 ; + + nb_tx_to_clean = txq->nb_tx_free; + nb_tx_free_last = txq->nb_tx_free; +if (!free_cnt) + free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count the amount of +* freeable mubfs and packets. +*/ +for (pkt_cnt =0 ; pkt_cnt < free_cnt; ) { +for (i =0 ; i < nb_tx_to_clean && + pkt_cnt < free_cnt && + tx_id != tx_last; i++) { +if (swr_ring[tx_id].mbuf !=NULL ) { +rte_pktmbuf_free_seg (swr_ring[tx_id].mbuf); + swr_ring[tx_id].mbuf =NULL ; + +/* +* last segment in the packet, +* increment packet count +*/ + pkt_cnt += (swr_ring[tx_id].last_id == tx_id); + } + + tx_id = swr_ring[tx_id].next_id; + } + +if (txq->tx_rs_thresh > txq->nb_tx_desc - + txq->nb_tx_free || tx_id == tx_last) +break ; + +if (pkt_cnt < free_cnt) { +if (ice_xmit_cleanup (txq)) +break ; + + nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last; + nb_tx_free_last = txq->nb_tx_free; + } + } + +return (int )pkt_cnt; +} + +static int +ice_tx_done_cleanup_vec(struct ice_tx_queue *txq __rte_unused, + uint32_t free_cnt __rte_unused) +{ +return -ENOTSUP ; +} + +static int +ice_tx_done_cleanup_simple (struct ice_tx_queue *txq, +uint32_t free_cnt) +{ +int i, n, cnt; + +if (free_cnt ==0 || free_cnt > txq->nb_tx_desc) + free_cnt = txq->nb_tx_desc; + + cnt = free_cnt - free_cnt % txq->tx_rs_thresh; + +for (i =0 ; i < cnt; i += n) { +if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh) +break ; + + n =ice_tx_free_bufs (txq); + +if (n ==0 ) +break ; + } + +return i; +} + +int +ice_tx_done_cleanup (void *txq,uint32_t free_cnt) { +struct ice_tx_queue *q = (struct ice_tx_queue *)txq; +struct rte_eth_dev *dev = &rte_eth_devices[q->port_id]; +struct ice_adapter *ad = +ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); + +#ifdef RTE_ARCH_X86 +if (ad->tx_vec_allowed) +return ice_tx_done_cleanup_vec (q, free_cnt);#endif +if (ad->tx_simple_allowed) +return ice_tx_done_cleanup_simple (q, free_cnt); +else +return ice_tx_done_cleanup_full (q, free_cnt); } + /* Populate 4 descriptors with data from 4 mbufs */ static inline void
tx4(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkts)diff --gita/drivers/net/ice/ice_rxtx.hb/drivers/net/ice/ice_rxtx.hindex9e3d2cd07..0946ee69e100644drivers/net/ice/ice_rxtx.h +2
-0@@ -202,4 +202,6 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t ice_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t nb_pkts);int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc); +int ice_tx_done_cleanup (void *txq,uint32_t free_cnt); +#endif /* _ICE_RXTX_H_ */
--
2.17.1
Re: [dpdk-dev] [PATCH v9 2/4] net/ice: cleanup Tx buffers
In reply to Chenxu DiQuoted 4 lines · Chenxu Di
Add support to the ice driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>
<...>
Quoted 33 lines
drivers/net/ice/ice_rxtx.c +33
-0+static int +ice_tx_done_cleanup_vec(struct ice_tx_queue *txq __rte_unused, + uint32_t free_cnt __rte_unused) +{ +return -ENOTSUP ; +} + +static int +ice_tx_done_cleanup_simple (struct ice_tx_queue *txq, +uint32_t free_cnt) +{ +int i, n, cnt; + +if (free_cnt ==0 || free_cnt > txq->nb_tx_desc) + free_cnt = txq->nb_tx_desc; + + cnt = free_cnt - free_cnt % txq->tx_rs_thresh; + +for (i =0 ; i < cnt; i += n) { +if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh) +break ; + + n =ice_tx_free_bufs (txq); + +if (n ==0 ) +break ; + } + +return i; +} + +int +ice_tx_done_cleanup (void *txq,uint32_t free_cnt)
drivers/net/ice/ice_rxtx.c ice_tx_free_bufs(struct ice_tx_queue *txq) · line 2750
Quoted 10 lines
drivers/net/ice/ice_rxtx.c +10
-0+{ +struct ice_tx_queue *q = (struct ice_tx_queue *)txq; +struct rte_eth_dev *dev = &rte_eth_devices[q->port_id]; +struct ice_adapter *ad = +ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); + +#ifdef RTE_ARCH_X86 +if (ad->tx_vec_allowed) +return ice_tx_done_cleanup_vec (q, free_cnt); +#endif
Hi Chenxu,
This is causing build error for non x86 builds [1], wrapping the 'ice_tx_done_cleanup_vec()' with #ifdef can solve the error, but instead why not remove the #ifdef completely.
Would the 'tx_vec_allowed' be set when it is non x86, I think it shouldn't, IF so #ifdef can go away.
[1].../dpdk/drivers/net/ice/ice_rxtx.c:2709:1: error: ‘ice_tx_done_cleanup_vec’ defined but not used [-Werror=unused-function]
ice_tx_done_cleanup_vec(struct ice_tx_queue *txq __rte_unused, ^~~~~~~~~~~~~~~~~~~~~~~
Re: [dpdk-dev] [PATCH v9 2/4] net/ice: cleanup Tx buffers
Quoted 58 lines · Ferruh Yigit
Quoted 4 lines · Chenxu Di
Add support to the ice driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]><...>
Quoted 33 lines
drivers/net/ice/ice_rxtx.c +33
-0+static int +ice_tx_done_cleanup_vec(struct ice_tx_queue *txq __rte_unused, + uint32_t free_cnt __rte_unused) +{ +return -ENOTSUP ; +} + +static int +ice_tx_done_cleanup_simple (struct ice_tx_queue *txq, +uint32_t free_cnt) +{ +int i, n, cnt; + +if (free_cnt ==0 || free_cnt > txq->nb_tx_desc) + free_cnt = txq->nb_tx_desc; + + cnt = free_cnt - free_cnt % txq->tx_rs_thresh; + +for (i =0 ; i < cnt; i += n) { +if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh) +break ; + + n =ice_tx_free_bufs (txq); + +if (n ==0 ) +break ; + } + +return i; +} + +int +ice_tx_done_cleanup (void *txq,uint32_t free_cnt)drivers/net/ice/ice_rxtx.c ice_tx_free_bufs(struct ice_tx_queue *txq) · line 2750
Quoted 10 lines
drivers/net/ice/ice_rxtx.c +10
-0+{ +struct ice_tx_queue *q = (struct ice_tx_queue *)txq; +struct rte_eth_dev *dev = &rte_eth_devices[q->port_id]; +struct ice_adapter *ad = +ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); + +#ifdef RTE_ARCH_X86 +if (ad->tx_vec_allowed) +return ice_tx_done_cleanup_vec (q, free_cnt); +#endif Hi Chenxu,
This is causing build error for non x86 builds [1], wrapping the '
ice_tx_done_cleanup_vec()' with #ifdef can solve the error, but instead why not remove the #ifdef completely.
Quoted 9 lines
Would the '
tx_vec_allowed' be set when it is non x86, I think it shouldn't, IF so #ifdef can go away.[1]
.../dpdk/drivers/net/ice/ice_rxtx.c:2709:1: error: ‘ice_tx_done_cleanup_vec’ defined but not used [-Werror=unused-function]
ice_tx_done_cleanup_vec(structice_tx_queue*txq__rte_unused, ^~~~~~~~~~~~~~~~~~~~~~~
Hi Chenxu, Xiaolong,
I will fix the build error while merging, by wrapping 'ice_tx_done_cleanup_vec' with "#ifdef RTE_ARCH_X86",
BUT can you please make an incremental patch to remove the #ifdef?
Thanks,
ferruh
Re: [dpdk-dev] [PATCH v9 2/4] net/ice: cleanup Tx buffers
Quoted 76 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, January 15, 2020 10:34 PM
To: Di, ChenxuX <[email protected]>; Ye, Xiaolong <[email protected]>
Cc: [email protected]; Yang, Qiming <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v9 2/4] net/ice: cleanup Tx buffersQuoted 56 lines · Ferruh Yigit
Quoted 4 lines · Chenxu Di
Add support to the ice driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]><...>
Quoted 31 lines
drivers/net/ice/ice_rxtx.c +31
-0+static int +ice_tx_done_cleanup_vec(struct ice_tx_queue *txq __rte_unused, + uint32_t free_cnt __rte_unused) +{ +return -ENOTSUP ; +} + +static int +ice_tx_done_cleanup_simple (struct ice_tx_queue *txq, +uint32_t free_cnt) +{ +int i, n, cnt; + +if (free_cnt ==0 || free_cnt > txq->nb_tx_desc) + free_cnt = txq->nb_tx_desc; + + cnt = free_cnt - free_cnt % txq->tx_rs_thresh; + +for (i =0 ; i < cnt; i += n) { +if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh) +break ; + + n =ice_tx_free_bufs (txq); + +if (n ==0 ) +break ; + } + +return i; +} +drivers/net/ice/ice_rxtx.c ice_tx_free_bufs(struct ice_tx_queue *txq)
Quoted 10 lines
drivers/net/ice/ice_rxtx.c +10
-0+int +ice_tx_done_cleanup (void *txq,uint32_t free_cnt) { +struct ice_tx_queue *q = (struct ice_tx_queue *)txq; +struct rte_eth_dev *dev = &rte_eth_devices[q->port_id]; +struct ice_adapter *ad = +ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); + +#ifdef RTE_ARCH_X86 +if (ad->tx_vec_allowed) +return ice_tx_done_cleanup_vec (q, free_cnt);#endif Hi Chenxu,
This is causing build error for non x86 builds [1], wrapping the '
ice_tx_done_cleanup_vec()' with #ifdef can solve the error, but instead why not remove the #ifdef completely.Quoted 9 lines
Would the '
tx_vec_allowed' be set when it is non x86, I think it shouldn't, IF so #ifdef can go away.[1]
.../dpdk/drivers/net/ice/ice_rxtx.c:2709:1: error: ‘ice_tx_done_cleanup_vec’ defined but not used [-Werror=unused-function] ice_tx_done_cleanup_vec(structice_tx_queue*txq__rte_unused, ^~~~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines
Hi Chenxu, Xiaolong,
I will fix the build error while merging, by wrapping '
ice_tx_done_cleanup_vec' with "#ifdefRTE_ARCH_X86",
BUT can you please make an incremental patch to remove the #ifdef?
Hi, Xiaolong, Ferruh
Sorry about that, it may be an error while I delete the parentheses of the if ... else ...
And what should I do now, update a new version patch? Or add another patch with only removing the #ifdef?
Quoted 2 lines
Thanks,
ferruh
PATCH 1/1 net/ice: cleanup for vec path check
Move the conditional compilation block to the inner check helper, so we can reduce the number of multiple ifdef check pairs used.
--- drivers/net/ice/ice_rxtx.c | 9 --------- drivers/net/ice/ice_rxtx_vec_common.h | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/net/ice/ice_rxtx.c +0 -9
@@ -2753,14 +2753,12 @@ ice_tx_done_cleanup_full(struct ice_tx_queue *txq,return (int )pkt_cnt; } -#ifdef RTE_ARCH_X86 static int ice_tx_done_cleanup_vec(struct ice_tx_queue *txq __rte_unused, uint32_t free_cnt __rte_unused) {return -ENOTSUP ; } -#endif static int ice_tx_done_cleanup_simple(struct ice_tx_queue *txq,
@@ -2794,10 +2792,8 @@ ice_tx_done_cleanup(void *txq, uint32_t free_cnt)struct ice_adapter *ad =ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); -#ifdef RTE_ARCH_X86 if (ad->tx_vec_allowed)return ice_tx_done_cleanup_vec (q, free_cnt); -#endif if (ad->tx_simple_allowed)return ice_tx_done_cleanup_simple (q, free_cnt);else
@@ -2953,7 +2949,6 @@ ice_set_rx_function(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE ();struct ice_adapter *ad =ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); -#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i;bool use_avx2 = false;
@@ -2998,8 +2993,6 @@ ice_set_rx_function(struct rte_eth_dev *dev)return ; } -#endif -if (dev->data->scattered_rx) {/* Set the non-LRO scattered function */ PMD_INIT_LOG(DEBUG,
@@ -3131,7 +3124,6 @@ ice_set_tx_function(struct rte_eth_dev *dev) {struct ice_adapter *ad =ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); -#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i;bool use_avx2 = false;
@@ -3167,7 +3159,6 @@ ice_set_tx_function(struct rte_eth_dev *dev)return ; } -#endif if (ad->tx_simple_allowed) {PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." );
drivers/net/ice/ice_rxtx_vec_common.h +8 -0
@@ -267,6 +267,7 @@ ice_tx_vec_queue_default(struct ice_tx_queue *txq)static inline int ice_rx_vec_dev_check_default (struct rte_eth_dev *dev) { +#ifdef RTE_ARCH_X86 int i;struct ice_rx_queue *rxq; struct ice_adapter *ad =
@@ -283,11 +284,15 @@ ice_rx_vec_dev_check_default(struct rte_eth_dev *dev) }return 0 ; +#else +return -1 ; +#endif }static inline int ice_tx_vec_dev_check_default (struct rte_eth_dev *dev) { +#ifdef RTE_ARCH_X86 int i;struct ice_tx_queue *txq;
@@ -298,6 +303,9 @@ ice_tx_vec_dev_check_default(struct rte_eth_dev *dev) }return 0 ; +#else +return -1 ; +#endif }#endif
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH] net/ice: cleanup for vec path check
Quoted 4 lines · Xiaolong Ye
Move the conditional compilation block to the inner check helper, so we can reduce the number of multiple ifdef check pairs used.
Signed-off-by Xiaolong Ye <[email protected]>
<...>
Quoted 12 lines
drivers/net/ice/ice_rxtx.c +0
-2@@ -2794,10 +2792,8 @@ ice_tx_done_cleanup(void *txq, uint32_t free_cnt)struct ice_adapter *ad =ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); -#ifdef RTE_ARCH_X86 if (ad->tx_vec_allowed)return ice_tx_done_cleanup_vec (q, free_cnt); -#endif if (ad->tx_simple_allowed)return ice_tx_done_cleanup_simple (q, free_cnt);else
drivers/net/ice/ice_rxtx.c ice_set_rx_function(struct rte_eth_dev *dev) · line 2954
Quoted 7 lines
drivers/net/ice/ice_rxtx.c +0
-1@@ -2953,7 +2949,6 @@ ice_set_rx_function(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE ();struct ice_adapter *ad =ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); -#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i;bool use_avx2 = false;
The build is still failing for arm, some defines like 'RTE_CPUFLAG_AVX2' & 'RTE_CPUFLAG_AVX512F' or functions 'ice_rxq_vec_setup', 'ice_recv_pkts_vec', 'ice_recv_scattered_pkts_vec' etc only defined for x86
It looks like more work is required, to created dummy versions of these failin functions also moving 'ice_rx_vec_dev_check()' form 'ice_rxtx_vec_sse.c' to 'ice_rxtx.c', otherwise we are having chicken-egg problem. So needs something similar to done in i40e.
If it is too much work for rc1, we can with existing #ifdef for now, up to you.
Re: [dpdk-dev] [PATCH] net/ice: cleanup for vec path check
In reply to Xiaolong YeQuoted 11 lines
-----Original Message-----
From: Ye, Xiaolong <[email protected]>
Sent: Thursday, January 16, 2020 3:10 PM
To: Yang, Qiming <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Di, ChenxuX <[email protected]>; Ye, Xiaolong <[email protected]>
Subject: [PATCH] net/ice: cleanup for vec path check
Quoted 4 lines
Move the conditional compilation block to the inner check helper, so we can reduce the number of multiple ifdef check pairs used.
Signed-off-by Xiaolong Ye <[email protected]>
Quoted 105 lines
--- drivers/net/ice/ice_rxtx.c | 9 --------- drivers/net/ice/ice_rxtx_vec_common.h | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-)drivers/net/ice/ice_rxtx.c index renamed from drivers/net/ice/ice_rxtx.c +0
-0
71adba809..8feeeb828100644drivers/net/ice/ice_rxtx.c +0
-2@@ -2753,14 +2753,12 @@ ice_tx_done_cleanup_full(struct ice_tx_queue *txq,return (int )pkt_cnt; } -#ifdef RTE_ARCH_X86 static int ice_tx_done_cleanup_vec(struct ice_tx_queue *txq __rte_unused, uint32_t free_cnt __rte_unused) {return -ENOTSUP ; } -#endif static int ice_tx_done_cleanup_simple(struct ice_tx_queue *txq, @@ -2794,10 +2792,8@@
ice_tx_done_cleanup(void *txq, uint32_t free_cnt)drivers/net/ice/ice_rxtx.c +0
-6struct ice_adapter *ad =ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); -#ifdef RTE_ARCH_X86 if (ad->tx_vec_allowed) return ice_tx_done_cleanup_vec(q, free_cnt); -#endifif (ad->tx_simple_allowed)return ice_tx_done_cleanup_simple (q, free_cnt);else @@ -2953,7 +2949,6 @@ ice_set_rx_function(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE ();struct ice_adapter *ad =ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); -#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i;bool use_avx2 = false;@@ -2998,8 +2993,6 @@ ice_set_rx_function(struct rte_eth_dev *dev)return ; } -#endif -if (dev->data->scattered_rx) {/* Set the non-LRO scattered function */ PMD_INIT_LOG(DEBUG,@@ -3131,7 +3124,6 @@ ice_set_tx_function(struct rte_eth_dev *dev) {struct ice_adapter *ad =ICE_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); -#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i;bool use_avx2 = false;@@ -3167,7 +3159,6 @@ ice_set_tx_function(struct rte_eth_dev *dev)return ; } -#endif if (ad->tx_simple_allowed) { PMD_INIT_LOG(DEBUG, "Simple tx finally be used."); diff --git
a/drivers/net/ice/ice_rxtx_vec_common.hb/drivers/net/ice/ice_rxtx_vec_common.h
index6b57ff2ae..223aac878100644drivers/net/ice/ice_rxtx_vec_common.h +8
-1@@ -267,6 +267,7 @@ ice_tx_vec_queue_default(struct ice_tx_queue *txq)static inline int ice_rx_vec_dev_check_default (struct rte_eth_dev *dev) { +#ifdef RTE_ARCH_X86 int i;struct ice_rx_queue *rxq; struct ice_adapter *ad =@@ -283,11 +284,15 @@ ice_rx_vec_dev_check_default(struct rte_eth_dev *dev) }return 0 ; +#else +return -1 ; +#endif }static inline int ice_tx_vec_dev_check_default (struct rte_eth_dev *dev) { +#ifdef RTE_ARCH_X86 int i;struct ice_tx_queue *txq;@@ -298,6 +303,9 @@ ice_tx_vec_dev_check_default(struct rte_eth_dev *dev) }return 0 ; +#else +return -1 ; +#endif }#endif --2.17.1
Re: [dpdk-dev] [PATCH v9 2/4] net/ice: cleanup Tx buffers
In reply to Chenxu DiQuoted 27 lines · Chenxu Di
Add support to the ice driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 111 +++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 2 + 3 files changed, 114 insertions(+)drivers/net/ice/ice_ethdev.c +1
-0@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .filter_ctrl = ice_dev_filter_ctrl, .udp_tunnel_port_add = ice_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dev_udp_tunnel_port_del, + .tx_done_cleanup = ice_tx_done_cleanup, };/* store statistics names and its offset in stats structure */ drivers/net/ice/ice_rxtx.c +0
-0
drivers/net/ice/ice_rxtx.c ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) · line 868
Quoted 6 lines
drivers/net/ice/ice_rxtx.c +3
-0@@ -863,6 +863,9 @@ ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)return 0 ; } + + +
These empty lines removed on next-net, fyi.
PATCH v9 3/4 net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiAdd support to the ixgbe driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 109 +++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 +- 3 files changed, 112 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -0
@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/*
@@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/* store statistics names and its offset in stats structure */
drivers/net/ixgbe/ixgbe_rxtx.c +109 -0
115 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_rxtx.h +1 -1
@@ -253,7 +253,6 @@ struct ixgbe_txq_ops {IXGBE_ADVTXD_DCMD_DEXT |\ IXGBE_ADVTXD_DCMD_EOP) -/* Takes an ethdev and a queue and sets up the tx function to be used based on * the queue parameters. Used in tx_queue_setup by primary process and then * in dev_init by secondary process when attaching to an existing ethdev.
@@ -284,6 +283,7 @@ uint16_t ixgbe_recv_scattered_pkts_vec(void *rx_queue,int ixgbe_rx_vec_dev_conf_condition_check (struct rte_eth_dev *dev);int ixgbe_rxq_vec_setup (struct ixgbe_rx_queue *rxq);void ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq); +int ixgbe_dev_tx_done_cleanup (void *tx_queue,uint32_t free_cnt);extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX ];extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX ];
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v9 3/4] net/ixgbe: cleanup Tx buffers
Quoted 9 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Chenxu Di
Sent: Monday, January 13, 2020 9:57 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [dpdk-dev] [PATCH v9 3/4] net/ixgbe: cleanup Tx buffers
Quoted 5 lines
Add support to the ixgbe driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>---
Quoted 2 lines
--
2.17.1
Re: [dpdk-dev] [PATCH v9 3/4] net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiQuoted 4 lines · Chenxu Di
Add support to the ixgbe driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>
<...>
drivers/net/ixgbe/ixgbe_rxtx.h struct ixgbe_txq_ops { · line 258
Quoted 8 lines
drivers/net/ixgbe/ixgbe_rxtx.h +0
-1@@ -253,7 +253,6 @@ struct ixgbe_txq_ops {IXGBE_ADVTXD_DCMD_DEXT |\ IXGBE_ADVTXD_DCMD_EOP) -/* Takes an ethdev and a queue and sets up the tx function to be used based on * the queue parameters. Used in tx_queue_setup by primary process and then * in dev_init by secondary process when attaching to an existing ethdev.
Also this change has been removed in next-net, it is irrelevantt to the pathch.
Re: [dpdk-dev] [PATCH v9 3/4] net/ixgbe: cleanup Tx buffers
In reply to Chenxu DiQuoted 137 lines · Chenxu Di
Add support to the ixgbe driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 109 +++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 +- 3 files changed, 112 insertions(+), 1 deletion(-)drivers/net/ixgbe/ixgbe_ethdev.c +2
-0@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/* @@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/* store statistics names and its offset in stats structure */ drivers/net/ixgbe/ixgbe_rxtx.c +99
-0@@ -2306,6 +2306,115 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +static int +ixgbe_tx_done_cleanup_full (struct ixgbe_tx_queue *txq,uint32_t free_cnt) +{ +struct ixgbe_tx_entry *swr_ring = txq->sw_ring; +uint16_t i, tx_last, tx_id; +uint16_t nb_tx_free_last; +uint16_t nb_tx_to_clean; +uint32_t pkt_cnt; + +/* Start free mbuf from the next of tx_tail */ + tx_last = txq->tx_tail; + tx_id = swr_ring[tx_last].next_id; + +if (txq->nb_tx_free ==0 &&ixgbe_xmit_cleanup (txq)) +return 0 ; + + nb_tx_to_clean = txq->nb_tx_free; + nb_tx_free_last = txq->nb_tx_free; +if (!free_cnt) + free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count the amount of +* freeable mubfs and packets. +*/ +for (pkt_cnt =0 ; pkt_cnt < free_cnt; ) { +for (i =0 ; i < nb_tx_to_clean && + pkt_cnt < free_cnt && + tx_id != tx_last; i++) { +if (swr_ring[tx_id].mbuf !=NULL ) { +rte_pktmbuf_free_seg (swr_ring[tx_id].mbuf); + swr_ring[tx_id].mbuf =NULL ; + +/* +* last segment in the packet, +* increment packet count +*/ + pkt_cnt += (swr_ring[tx_id].last_id == tx_id); + } + + tx_id = swr_ring[tx_id].next_id; + } + +if (txq->tx_rs_thresh > txq->nb_tx_desc - + txq->nb_tx_free || tx_id == tx_last) +break ; + +if (pkt_cnt < free_cnt) { +if (ixgbe_xmit_cleanup (txq)) +break ; + + nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last; + nb_tx_free_last = txq->nb_tx_free; + } + } + +return (int )pkt_cnt; +} + +static int +ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq, +uint32_t free_cnt) +{ +int i, n, cnt; + +if (free_cnt ==0 || free_cnt > txq->nb_tx_desc) + free_cnt = txq->nb_tx_desc; + + cnt = free_cnt - free_cnt % txq->tx_rs_thresh; + +for (i =0 ; i < cnt; i += n) { +if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh) +break ; + + n =ixgbe_tx_free_bufs (txq); + +if (n ==0 ) +break ; + } + +return i; +} + +static int +ixgbe_tx_done_cleanup_vec(struct ixgbe_tx_queue *txq __rte_unused, + uint32_t free_cnt __rte_unused) +{ +return -ENOTSUP ; +} + +int +ixgbe_dev_tx_done_cleanup (void *tx_queue,uint32_t free_cnt) +{ +struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; + if (txq->offloads == 0 && +#ifdef RTE_LIBRTE_SECURITY + !(txq->using_ipsec) && +#endif + txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) +#ifdef RTE_IXGBE_INC_VECTOR
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2417
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && + (rte_eal_process_type () !=RTE_PROC_PRIMARY || + txq->sw_ring_v !=NULL )) +return ixgbe_tx_done_cleanup_vec (txq, free_cnt); +#endif +return ixgbe_tx_done_cleanup_simple (txq, free_cnt); + +return ixgbe_tx_done_cleanup_full (txq, free_cnt); +} +
Missing curly parantheses in the 'if' blocks are causing confusion on which return patch to take.
the above code is like this:
if (txq->offloads == 0 && ...)
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && ...)
return ixgbe_tx_done_cleanup_vec(txq, free_cnt);
return ixgbe_tx_done_cleanup_simple(txq, free_cnt); <----- [*]
return ixgbe_tx_done_cleanup_full(txq, free_cnt);
It is not clear, and looks like wrong based on indentation, when to get the [*] path above.
I will add curly parantheses while merging.
Btw, why we need "#ifdef RTE_IXGBE_INC_VECTOR" here, can't we remove it?
Re: [dpdk-dev] [PATCH v9 3/4] net/ixgbe: cleanup Tx buffers
Quoted 159 lines · Ferruh Yigit
Quoted 137 lines · Chenxu Di
Add support to the ixgbe driver for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/ixgbe/ixgbe_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 109 +++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 +- 3 files changed, 112 insertions(+), 1 deletion(-)drivers/net/ixgbe/ixgbe_ethdev.c +2
-0@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, .tm_ops_get = ixgbe_tm_ops_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/* @@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .reta_query = ixgbe_dev_rss_reta_query, .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get = ixgbe_dev_rss_hash_conf_get, + .tx_done_cleanup = ixgbe_dev_tx_done_cleanup, };/* store statistics names and its offset in stats structure */ drivers/net/ixgbe/ixgbe_rxtx.c +99
-0@@ -2306,6 +2306,115 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) } } +static int +ixgbe_tx_done_cleanup_full (struct ixgbe_tx_queue *txq,uint32_t free_cnt) +{ +struct ixgbe_tx_entry *swr_ring = txq->sw_ring; +uint16_t i, tx_last, tx_id; +uint16_t nb_tx_free_last; +uint16_t nb_tx_to_clean; +uint32_t pkt_cnt; + +/* Start free mbuf from the next of tx_tail */ + tx_last = txq->tx_tail; + tx_id = swr_ring[tx_last].next_id; + +if (txq->nb_tx_free ==0 &&ixgbe_xmit_cleanup (txq)) +return 0 ; + + nb_tx_to_clean = txq->nb_tx_free; + nb_tx_free_last = txq->nb_tx_free; +if (!free_cnt) + free_cnt = txq->nb_tx_desc; + +/* Loop through swr_ring to count the amount of +* freeable mubfs and packets. +*/ +for (pkt_cnt =0 ; pkt_cnt < free_cnt; ) { +for (i =0 ; i < nb_tx_to_clean && + pkt_cnt < free_cnt && + tx_id != tx_last; i++) { +if (swr_ring[tx_id].mbuf !=NULL ) { +rte_pktmbuf_free_seg (swr_ring[tx_id].mbuf); + swr_ring[tx_id].mbuf =NULL ; + +/* +* last segment in the packet, +* increment packet count +*/ + pkt_cnt += (swr_ring[tx_id].last_id == tx_id); + } + + tx_id = swr_ring[tx_id].next_id; + } + +if (txq->tx_rs_thresh > txq->nb_tx_desc - + txq->nb_tx_free || tx_id == tx_last) +break ; + +if (pkt_cnt < free_cnt) { +if (ixgbe_xmit_cleanup (txq)) +break ; + + nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last; + nb_tx_free_last = txq->nb_tx_free; + } + } + +return (int )pkt_cnt; +} + +static int +ixgbe_tx_done_cleanup_simple (struct ixgbe_tx_queue *txq, +uint32_t free_cnt) +{ +int i, n, cnt; + +if (free_cnt ==0 || free_cnt > txq->nb_tx_desc) + free_cnt = txq->nb_tx_desc; + + cnt = free_cnt - free_cnt % txq->tx_rs_thresh; + +for (i =0 ; i < cnt; i += n) { +if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh) +break ; + + n =ixgbe_tx_free_bufs (txq); + +if (n ==0 ) +break ; + } + +return i; +} + +static int +ixgbe_tx_done_cleanup_vec(struct ixgbe_tx_queue *txq __rte_unused, + uint32_t free_cnt __rte_unused) +{ +return -ENOTSUP ; +} + +int +ixgbe_dev_tx_done_cleanup (void *tx_queue,uint32_t free_cnt) +{ +struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; + if (txq->offloads == 0 && +#ifdef RTE_LIBRTE_SECURITY + !(txq->using_ipsec) && +#endif + txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) +#ifdef RTE_IXGBE_INC_VECTORdrivers/net/ixgbe/ixgbe_rxtx.c ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) · line 2417
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +10
-0+if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && + (rte_eal_process_type () !=RTE_PROC_PRIMARY || + txq->sw_ring_v !=NULL )) +return ixgbe_tx_done_cleanup_vec (txq, free_cnt); +#endif +return ixgbe_tx_done_cleanup_simple (txq, free_cnt); + +return ixgbe_tx_done_cleanup_full (txq, free_cnt); +} +Missing curly parantheses in the 'if' blocks are causing confusion on which return patch to take.
the above code is like this:
if (txq->offloads== 0 && ...)
if (txq->tx_rs_thresh<=RTE_IXGBE_TX_MAX_FREE_BUF_SZ&& ...)return ixgbe_tx_done_cleanup_vec(txq, free_cnt);return
ixgbe_tx_done_cleanup_simple(txq, free_cnt); <----- [*]
returnixgbe_tx_done_cleanup_full(txq, free_cnt);
Quoted 7 lines
It is not clear, and looks like wrong based on indentation, when to get the [*] path above.
I will add curly parantheses while merging.
Btw, why we need "#ifdef
RTE_IXGBE_INC_VECTOR" here, can't we remove it?
Since 'ixgbe_tx_done_cleanup_vec()' already implemented in this file, instead of vector specific files, I am removing the ifdef.
So making changes [1] and function becomes [2]. Please validate it in next-net.
[1]
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index a2e85ed5b..f41dc13d5 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2403,14 +2403,15 @@ ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_tfree_cnt)
#ifdef RTE_LIBRTE_SECURITY
!(txq->using_ipsec) &&
#endif
- txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST)
-#ifdef RTE_IXGBE_INC_VECTOR
+ txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) {
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ &&
(rte_eal_process_type() != RTE_PROC_PRIMARY ||
- txq->sw_ring_v != NULL))
+ txq->sw_ring_v != NULL)) {
return ixgbe_tx_done_cleanup_vec(txq, free_cnt); -#endif
- return ixgbe_tx_done_cleanup_simple(txq, free_cnt);
+ } else {
+ return ixgbe_tx_done_cleanup_simple(txq, free_cnt);
+ }
+ }
return ixgbe_tx_done_cleanup_full(txq, free_cnt);
}
[2]
int
ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)
{
struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
if (txq->offloads == 0 &&
#ifdef RTE_LIBRTE_SECURITY
!(txq->using_ipsec) &&
#endif
txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) {
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ &&
(rte_eal_process_type() != RTE_PROC_PRIMARY ||
txq->sw_ring_v != NULL)) {
return ixgbe_tx_done_cleanup_vec(txq, free_cnt);
} else {
return ixgbe_tx_done_cleanup_simple(txq, free_cnt);
}
}
return ixgbe_tx_done_cleanup_full(txq, free_cnt);}
PATCH v9 4/4 net/e1000: cleanup Tx buffers
In reply to Chenxu DiAdd support to the igb vf for the API rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.
--- drivers/net/e1000/igb_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/e1000/igb_ethdev.c +1 -0
@@ -446,6 +446,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_descriptor_status = eth_igb_tx_descriptor_status, .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, + .tx_done_cleanup = eth_igb_tx_done_cleanup, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get,
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v9 4/4] net/e1000: cleanup Tx buffers
Quoted 14 lines
Add support to the igb vf for the API
rte_eth_tx_done_cleanup
to force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>--- drivers/net/e1000/igb_ethdev.c | 1 + 1 file changed, 1 insertion(+)drivers/net/e1000/igb_ethdev.c +0
-0
drivers/net/e1000/igb_ethdev.c static const struct eth_dev_ops igbvf_eth_dev_ops = {
Quoted 8 lines
drivers/net/e1000/igb_ethdev.c +1
-1@@ -446,6 +446,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_descriptor_status = eth_igb_tx_descriptor_status, .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, + .tx_done_cleanup = eth_igb_tx_done_cleanup, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get, --
Quoted 1 line
2.17.1
Re: [dpdk-dev] [PATCH v9 4/4] net/e1000: cleanup Tx buffers
In reply to Chenxu Didrivers/net/e1000/igb_ethdev.c
Quoted 12 lines · Chenxu Di
Add support to the igb vf for the API
rte_eth_tx_done_cleanupto force free consumed buffers on Tx ring.Signed-off-by Chenxu Di <[email protected]>---
drivers/net/e1000/igb_ethdev.c| 1 +1 file changed, 1 insertion(+)drivers/net/e1000/igb_ethdev.c +0
-0
What about em_ethdev.c in e1000 dir, do we need to add support as well?
Thanks,
Xiaolong
Quoted 11 lines
drivers/net/e1000/igb_ethdev.c +1
-0@@ -446,6 +446,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_descriptor_status = eth_igb_tx_descriptor_status, .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, + .tx_done_cleanup = eth_igb_tx_done_cleanup, .set_mc_addr_list = eth_igb_set_mc_addr_list, .rxq_info_get = igb_rxq_info_get, .txq_info_get = igb_txq_info_get,Signature · 1 line
2.17.1
Ye Xiaolong
AppliedQuoted 12 lines · Chenxu Di
From: Di ChenxuX <[email protected]>
Add support to the drivers inclulding fm10k, i40e, ice, ixgbe for the API
rte_eth_tx_done_cleanupto
force free consumed buffers on Tx ring.Di ChenxuX (4):
net/fm10k: cleanup Tx buffers
net/i40e: cleanup Tx buffers
net/ice: cleanup Tx buffers
net/ixgbe: cleanup Tx buffers
Quoted 18 lines
drivers/net/fm10k/fm10k.h | 2 ++ drivers/net/fm10k/fm10k_ethdev.c | 1 + drivers/net/fm10k/fm10k_rxtx.c | 45 +++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 40 +++++++++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_rxtx.c | 41 ++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 39 +++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ 13 files changed, 177 insertions(+)Signature · 1 line
2.17.1
Applied to dpdk-next-net-intel, Thanks.