Expose the active Tx burst mode and its offloads via the tx_burst_mode_get callback so applications can query how each queue sends packets. The string is derived from the Tx burst function actually installed on the device, so it reports the compact CQE path only when that path is really in use, and also lists the enabled offloads. Advertise the new capability in the feature matrix.
Signed-off-by: Jiacheng Ye <[email protected]> --- doc/guides/nics/features/hinic3.ini | 1 + drivers/net/hinic3/hinic3_ethdev.c | 2 ++ drivers/net/hinic3/hinic3_tx.c | 31 +++++++++++++++++++++++++++++ drivers/net/hinic3/hinic3_tx.h | 2 ++ 4 files changed, 36 insertions(+) diff --git a/doc/guides/nics/features/hinic3.ini b/doc/guides/nics/features/hinic3.ini index 81c3e85410..ba30a850e9 100644 --- a/doc/guides/nics/features/hinic3.ini +++ b/doc/guides/nics/features/hinic3.ini @@ -9,6 +9,7 @@ Link speed configuration = Y Rx interrupt = Y Queue start/stop = Y Runtime queue setup = Y +Burst mode info = Y MTU update = Y Scattered Rx = Y TSO = Y diff --git a/drivers/net/hinic3/hinic3_ethdev.c b/drivers/net/hinic3/hinic3_ethdev.c index a80b4e8b5e..793e0f84ad 100644 --- a/drivers/net/hinic3/hinic3_ethdev.c +++ b/drivers/net/hinic3/hinic3_ethdev.c @@ -3835,6 +3835,7 @@ static const struct eth_dev_ops hinic3_pmd_ops = { .mac_addr_add = hinic3_mac_addr_add, .set_mc_addr_list = hinic3_set_mc_addr_list, .flow_ops_get = hinic3_dev_filter_ctrl, + .tx_burst_mode_get = hinic3_tx_burst_mode_get, .fec_get_capability = hinic3_fec_capability_get, .fec_get = hinic3_fec_get, .fec_set = hinic3_fec_set, @@ -3889,6 +3890,7 @@ static const struct eth_dev_ops hinic3_pmd_vf_ops = { .set_mc_addr_list = hinic3_set_mc_addr_list, .flow_ops_get = hinic3_dev_filter_ctrl, .eth_dev_priv_dump = hinic3_eth_dev_priv_dump, + .tx_burst_mode_get = hinic3_tx_burst_mode_get, }; /** diff --git a/drivers/net/hinic3/hinic3_tx.c b/drivers/net/hinic3/hinic3_tx.c index a9dcb99095..ff5e5a4922 100644 --- a/drivers/net/hinic3/hinic3_tx.c +++ b/drivers/net/hinic3/hinic3_tx.c @@ -1507,6 +1507,37 @@ hinic3_flush_txqs(struct hinic3_nic_dev *nic_dev) } } +int +hinic3_tx_burst_mode_get(struct rte_eth_dev *dev, + uint16_t tx_queue_id, + struct rte_eth_burst_mode *mode) +{ + uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads; + struct hinic3_nic_dev *nic_dev; + struct hinic3_txq *txq = NULL; + + nic_dev = HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(dev); + txq = nic_dev->txqs[tx_queue_id]; + if (!txq) + return -EINVAL; + + snprintf(mode->info, sizeof(mode->info), + "%s%s%s%s%s", + dev->tx_pkt_burst == hinic3_xmit_pkts_compact_cqe ? + "compact CQE" : "scalar", + (tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) ? " + MULTI" : "", + (tx_offloads & (RTE_ETH_TX_OFFLOAD_TCP_TSO | + RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO)) ? " + TSO" : "", + (tx_offloads & (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | + RTE_ETH_TX_OFFLOAD_UDP_CKSUM | + RTE_ETH_TX_OFFLOAD_TCP_CKSUM | + RTE_ETH_TX_OFFLOAD_SCTP_CKSUM | + RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM)) ? " + CKSUM" : "", + (tx_offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) ? " + VLAN" : ""); + + return 0; +} + /** * It is responsible for sending data packets. * diff --git a/drivers/net/hinic3/hinic3_tx.h b/drivers/net/hinic3/hinic3_tx.h index e0a2606428..6bdf71f59d 100644 --- a/drivers/net/hinic3/hinic3_tx.h +++ b/drivers/net/hinic3/hinic3_tx.h @@ -396,4 +396,6 @@ uint16_t hinic3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb int hinic3_stop_sq(struct hinic3_txq *txq); int hinic3_start_all_sqs(struct rte_eth_dev *eth_dev); int hinic3_tx_done_cleanup(void *txq, uint32_t free_cnt); +int hinic3_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, + struct rte_eth_burst_mode *mode); #endif /**< _HINIC3_TX_H_ */ -- 2.33.0

