get Rx/Tx packet burst mode information
v3 cover get Rx/Tx packet burst mode information
v2 -> v3:
1) Add 'Burst mode info' feature matrix.
v1 -> v2:
1). Change the return type of dev_ops callback from 'void' to
'int'.
2). Update the ice/i40 PMD patches with clear git commit log.
RFCv3 -> v1:
https://patchwork.dpdk.org/patch/59103/
https://patchwork.dpdk.org/patch/59104/
https://patchwork.dpdk.org/patch/59105/
https://patchwork.dpdk.org/patch/59106/
1). Use the function 'rte_bsf64' to iterate the options for
getting the name.
Haiyue Wang (4):
ethdev: add the API for getting burst mode information net/i40e: add Rx/Tx burst mode get callbacks net/ice: add Rx/Tx burst mode get callbacks app/testpmd: show the Rx/Tx burst mode description
app/test-pmd/config.c | 29 +++++++++ doc/guides/nics/features.rst | 11 ++++ doc/guides/nics/features/default.ini | 1 + doc/guides/nics/features/i40e.ini | 1 + doc/guides/nics/features/ice.ini | 1 + doc/guides/rel_notes/release_19_11.rst | 9 +++ drivers/net/i40e/i40e_ethdev.c | 2 + drivers/net/i40e/i40e_ethdev.h | 4 ++ drivers/net/i40e/i40e_rxtx.c | 76 ++++++++++++++++++++++ drivers/net/ice/ice_ethdev.c | 2 + drivers/net/ice/ice_rxtx.c | 58 +++++++++++++++++ drivers/net/ice/ice_rxtx.h | 4 ++ lib/librte_ethdev/rte_ethdev.c | 71 ++++++++++++++++++++ lib/librte_ethdev/rte_ethdev.h | 82 ++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_core.h | 5 ++ lib/librte_ethdev/rte_ethdev_version.map | 5 ++ 16 files changed, 361 insertions(+)
Signature · 1 line
2.17.1
PATCH v3 1/4 ethdev: add the API for getting burst mode information
Some PMDs have more than one RX/TX burst paths, add the ethdev API that allows an application to retrieve the mode information about Rx/Tx packet burst such as Scalar or Vector, and Vector technology like AVX2.
--- doc/guides/nics/features.rst | 11 ++++ doc/guides/nics/features/default.ini | 1 + doc/guides/rel_notes/release_19_11.rst | 9 +++ lib/librte_ethdev/rte_ethdev.c | 71 ++++++++++++++++++++ lib/librte_ethdev/rte_ethdev.h | 82 ++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_core.h | 5 ++ lib/librte_ethdev/rte_ethdev_version.map | 5 ++ 7 files changed, 184 insertions(+)
doc/guides/nics/features.rst +11 -0
@@ -871,6 +871,17 @@ Supports Tx queue setup after device started. * **[provides] rte_eth_dev_info**: ``dev_capa:RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP``. * **[related] API**: ``rte_eth_dev_info_get()``. +.. _nic_features_burst_mode_info: + +Burst mode info +--------------- + +Supports to get Rx/Tx packet burst mode information. + +* **[implements] eth_dev_ops**: ``rx_burst_mode_get``, ``tx_burst_mode_get``. +* **[related] API**: ``rte_eth_rx_burst_mode_get()``, ``rte_eth_tx_burst_mode_get()``, + ``rte_eth_burst_mode_option_name()``. + .. _nic_features_other: Other dev ops not represented by a Feature
doc/guides/nics/features/default.ini +1 -0
@@ -19,6 +19,7 @@ Free Tx mbuf on demand = Queue start/stop = Runtime Rx queue setup = Runtime Tx queue setup = +Burst mode info = MTU update = Jumbo frame = Scattered Rx =
doc/guides/rel_notes/release_19_11.rst +9 -0
@@ -83,6 +83,15 @@ New Features Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag. +* **Added RX/TX packet burst mode get API.** + + Added two new functions ``rte_eth_rx_burst_mode_get`` and + ``rte_eth_tx_burst_mode_get`` that allow an application + to retrieve the mode information about RX/TX packet burst + such as Scalar or Vector, and Vector technology like AVX2. + Another new function ``rte_eth_burst_mode_option_name`` is + provided for burst mode options stringification. + * **Updated the Intel ice driver.** Updated the Intel ice driver with new features and improvements, including:
lib/librte_ethdev/rte_ethdev.c +71 -0
77 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev.h +82 -0
94 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev_core.h +5 -0
@@ -294,6 +294,9 @@ typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,typedef void (*eth_txq_info_get_t )(struct rte_eth_dev *dev,uint16_t tx_queue_id,struct rte_eth_txq_info *qinfo); +typedef int (*eth_burst_mode_get_t )(struct rte_eth_dev *dev, +uint16_t queue_id,struct rte_eth_burst_mode *mode); +typedef int (*mtu_set_t )(struct rte_eth_dev *dev,uint16_t mtu);/**< @internal Set MTU. */
@@ -542,6 +545,8 @@ struct eth_dev_ops {eth_dev_infos_get_t dev_infos_get;/**< Get device info. */ eth_rxq_info_get_t rxq_info_get;/**< retrieve RX queue information. */ eth_txq_info_get_t txq_info_get;/**< retrieve TX queue information. */ +eth_burst_mode_get_t rx_burst_mode_get;/**< Get RX burst mode */ +eth_burst_mode_get_t tx_burst_mode_get;/**< Get TX burst mode */ eth_fw_version_get_t fw_version_get;/**< Get firmware version. */ eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;/**< Get packet types supported and identified by device. */
lib/librte_ethdev/rte_ethdev_version.map +5 -0
@@ -283,4 +283,9 @@ EXPERIMENTAL { # added in 19.08 rte_eth_read_clock; + + # added in 19.11 + rte_eth_rx_burst_mode_get; + rte_eth_tx_burst_mode_get; + rte_eth_burst_mode_option_name; };
Signature · 1 line
2.17.1
PATCH v3 2/4 net/i40e: add Rx/Tx burst mode get callbacks
In reply to Haiyue WangRetrieve burst mode options according to the selected Rx/Tx burst function name.
--- doc/guides/nics/features/i40e.ini | 1 + drivers/net/i40e/i40e_ethdev.c | 2 + drivers/net/i40e/i40e_ethdev.h | 4 ++ drivers/net/i40e/i40e_rxtx.c | 76 +++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+)
doc/guides/nics/features/i40e.ini +1 -0
@@ -11,6 +11,7 @@ Rx interrupt = Y Queue start/stop = Y Runtime Rx queue setup = Y Runtime Tx queue setup = Y +Burst mode info = Y Jumbo frame = Y Scattered Rx = Y TSO = Y
drivers/net/i40e/i40e_ethdev.c +2 -0
@@ -502,6 +502,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, + .rx_burst_mode_get = i40e_rx_burst_mode_get, + .tx_burst_mode_get = i40e_tx_burst_mode_get, .mirror_rule_set = i40e_mirror_rule_set, .mirror_rule_reset = i40e_mirror_rule_reset, .timesync_enable = i40e_timesync_enable,
drivers/net/i40e/i40e_ethdev.h +4 -0
@@ -1209,6 +1209,10 @@ void i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo);void i40e_txq_info_get (struct rte_eth_dev *dev,uint16_t queue_id,struct rte_eth_txq_info *qinfo); +int i40e_rx_burst_mode_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_burst_mode *mode); +int i40e_tx_burst_mode_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_burst_mode *mode);struct i40e_ethertype_filter *i40e_sw_ethertype_filter_lookup (struct i40e_ethertype_rule *ethertype_rule,const struct i40e_ethertype_filter_input *input);
drivers/net/i40e/i40e_rxtx.c +76 -0
88 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 3/4 net/ice: add Rx/Tx burst mode get callbacks
In reply to Haiyue WangRetrieve burst mode options according to the selected Rx/Tx burst function name.
--- doc/guides/nics/features/ice.ini | 1 + drivers/net/ice/ice_ethdev.c | 2 ++ drivers/net/ice/ice_rxtx.c | 58 ++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 4 +++ 4 files changed, 65 insertions(+)
doc/guides/nics/features/ice.ini +1 -0
@@ -10,6 +10,7 @@ Link status event = Y Rx interrupt = Y Fast mbuf free = Y Queue start/stop = Y +Burst mode info = Y MTU update = Y Jumbo frame = Y Scattered Rx = Y
drivers/net/ice/ice_ethdev.c +2 -0
@@ -167,6 +167,8 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .vlan_pvid_set = ice_vlan_pvid_set, .rxq_info_get = ice_rxq_info_get, .txq_info_get = ice_txq_info_get, + .rx_burst_mode_get = ice_rx_burst_mode_get, + .tx_burst_mode_get = ice_tx_burst_mode_get, .get_eeprom_length = ice_get_eeprom_length, .get_eeprom = ice_get_eeprom, .rx_queue_count = ice_rx_queue_count,
drivers/net/ice/ice_rxtx.c +58 -0
70 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +4 -0
@@ -168,6 +168,10 @@ void ice_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo);void ice_txq_info_get (struct rte_eth_dev *dev,uint16_t queue_id,struct rte_eth_txq_info *qinfo); +int ice_rx_burst_mode_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_burst_mode *mode); +int ice_tx_burst_mode_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_burst_mode *mode);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);
Signature · 1 line
2.17.1
PATCH v3 4/4 app/testpmd: show the Rx/Tx burst mode description
In reply to Haiyue WangAdd the 'Burst mode' section into command 'show rxq|txq info <port_id> <queue_id>' to show the Rx/Tx burst mode description like:
"Burst mode: Vector AVX2 Scattered"
--- app/test-pmd/config.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
app/test-pmd/config.c +29 -0
@@ -346,9 +346,25 @@ nic_stats_mapping_display(portid_t port_id) nic_stats_mapping_border, nic_stats_mapping_border); } +static void +burst_mode_options_display (uint64_t options) +{ +int offset; + +while (options !=0 ) { + offset =rte_bsf64 (options); + +printf (" %s" , +rte_eth_burst_mode_option_name (1ULL << offset)); + + options &= ~(1ULL << offset); + } +} +void rx_queue_infos_display (portid_t port_id,uint16_t queue_id) { +struct rte_eth_burst_mode mode;struct rte_eth_rxq_info qinfo;int32_t rc;static const char *info_border ="*********************" ;
@@ -376,12 +392,19 @@ rx_queue_infos_display(portid_t port_id, uint16_t queue_id)printf ("\nRX scattered packets: %s" , (qinfo.scattered_rx !=0 ) ?"on" :"off" );printf ("\nNumber of RXDs: %hu" , qinfo.nb_desc); + +if (rte_eth_rx_burst_mode_get (port_id, queue_id, &mode) ==0 ) { +printf ("\nBurst mode:" ); +burst_mode_options_display (mode.options); + } +printf ("\n" ); }void tx_queue_infos_display (portid_t port_id,uint16_t queue_id) { +struct rte_eth_burst_mode mode;struct rte_eth_txq_info qinfo;int32_t rc;static const char *info_border ="*********************" ;
@@ -405,6 +428,12 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id)printf ("\nTX deferred start: %s" , (qinfo.conf.tx_deferred_start !=0 ) ?"on" :"off" );printf ("\nNumber of TXDs: %hu" , qinfo.nb_desc); + +if (rte_eth_tx_burst_mode_get (port_id, queue_id, &mode) ==0 ) { +printf ("\nBurst mode:" ); +burst_mode_options_display (mode.options); + } +printf ("\n" ); }
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information
In reply to Haiyue WangQuoted 7 lines · Haiyue Wang
Some PMDs have more than one RX/TX burst paths, add the ethdev API that allows an application to retrieve the mode information about Rx/Tx packet burst such as Scalar or Vector, and Vector technology like AVX2.
Signed-off-by Haiyue Wang <[email protected]>
As far as I can see Bernard has ack only on testpmd patch, 4/4, not for reset of the patchset, can you please confirm this offline?
Quoted 1 line
Reviewed-by Xiaolong Ye <[email protected]>
<...>
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +12
-0+const char * +rte_eth_burst_mode_option_name (uint64_t option) +{ +switch (option) { +case RTE_ETH_BURST_SCALAR :return "Scalar" ; +case RTE_ETH_BURST_VECTOR :return "Vector" ; + +case RTE_ETH_BURST_ALTIVEC :return "AltiVec" ; +case RTE_ETH_BURST_NEON :return "Neon" ; +case RTE_ETH_BURST_SSE :return "SSE" ; +case RTE_ETH_BURST_AVX2 :return "AVX2" ; +case RTE_ETH_BURST_AVX512 :return "AVX512" ;
lib/librte_ethdev/rte_ethdev.c rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, · line 4282
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ +case RTE_ETH_BURST_SCATTERED :return "Scattered" ; +case RTE_ETH_BURST_BULK_ALLOC :return "Bulk Alloc" ; +case RTE_ETH_BURST_SIMPLE :return "Simple" ; + +case RTE_ETH_BURST_PER_QUEUE :return "Per Queue" ; + } + +return "" ; +}
Hi Haiyue,
The string representation of a vector mode is a data, and I think better to keep it separately as an array instead of keeping this information in the function and make the function use that data.
So that when new type are added it won't require to update the function itself.
'rte_rx_offload_names' and 'rte_eth_dev_rx_offload_name()' is the good sample of what I mentioned above.
Thanks,
ferruh
Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information
Hi,
Quoted 14 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, October 15, 2019 00:39
To: Wang, Haiyue <[email protected]>; [email protected]; Ye, Xiaolong <[email protected]>
Cc: Kinsella, Ray <[email protected]>; Iremonger, Bernard <[email protected]>; Sun, Chenmin <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add the API for getting burst mode informationQuoted 5 lines · Haiyue Wang
Some PMDs have more than one RX/TX burst paths, add the ethdev API that allows an application to retrieve the mode information about Rx/Tx packet burst such as Scalar or Vector, and Vector technology like AVX2.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Haiyue Wang <[email protected]>As far as I can see Bernard has ack only on testpmd patch, 4/4, not for reset of the patchset, can you please confirm this offline?
I checked it, yes, will remove other three ACKs, sorry for not so strict.
Quoted 29 lines
Quoted 1 line
Reviewed-by Xiaolong Ye <[email protected]><...>
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +12
-0+const char * +rte_eth_burst_mode_option_name (uint64_t option) +{ +switch (option) { +case RTE_ETH_BURST_SCALAR :return "Scalar" ; +case RTE_ETH_BURST_VECTOR :return "Vector" ; + +case RTE_ETH_BURST_ALTIVEC :return "AltiVec" ; +case RTE_ETH_BURST_NEON :return "Neon" ; +case RTE_ETH_BURST_SSE :return "SSE" ; +case RTE_ETH_BURST_AVX2 :return "AVX2" ; +case RTE_ETH_BURST_AVX512 :return "AVX512" ;lib/librte_ethdev/rte_ethdev.c rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, · line 4282
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ +case RTE_ETH_BURST_SCATTERED :return "Scattered" ; +case RTE_ETH_BURST_BULK_ALLOC :return "Bulk Alloc" ; +case RTE_ETH_BURST_SIMPLE :return "Simple" ; + +case RTE_ETH_BURST_PER_QUEUE :return "Per Queue" ; + } + +return "" ; +}Hi Haiyue,
Quoted 8 lines
The string representation of a vector mode is a data, and I think better to keep it separately as an array instead of keeping this information in the function and make the function use that data.
So that when new type are added it won't require to update the function itself.'
rte_rx_offload_names' and 'rte_eth_dev_rx_offload_name()' is the good sample of what I mentioned above.
+1, will update it.
Quoted 2 lines
Thanks,
ferruh
Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information
In reply to Ferruh YigitQuoted 49 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, October 15, 2019 00:39
To: Wang, Haiyue <[email protected]>; [email protected]; Ye, Xiaolong <[email protected]>
Cc: Kinsella, Ray <[email protected]>; Iremonger, Bernard <[email protected]>; Sun, Chenmin <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add the API for getting burst mode informationQuoted 7 lines · Haiyue Wang
Some PMDs have more than one RX/TX burst paths, add the ethdev API that allows an application to retrieve the mode information about Rx/Tx packet burst such as Scalar or Vector, and Vector technology like AVX2.
Signed-off-by Haiyue Wang <[email protected]>As far as I can see Bernard has ack only on testpmd patch, 4/4, not for reset of the patchset, can you please confirm this offline?
Quoted 1 line
Reviewed-by Xiaolong Ye <[email protected]><...>
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +12
-0+const char * +rte_eth_burst_mode_option_name (uint64_t option) +{ +switch (option) { +case RTE_ETH_BURST_SCALAR :return "Scalar" ; +case RTE_ETH_BURST_VECTOR :return "Vector" ; + +case RTE_ETH_BURST_ALTIVEC :return "AltiVec" ; +case RTE_ETH_BURST_NEON :return "Neon" ; +case RTE_ETH_BURST_SSE :return "SSE" ; +case RTE_ETH_BURST_AVX2 :return "AVX2" ; +case RTE_ETH_BURST_AVX512 :return "AVX512" ;lib/librte_ethdev/rte_ethdev.c rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, · line 4282
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ +case RTE_ETH_BURST_SCATTERED :return "Scattered" ; +case RTE_ETH_BURST_BULK_ALLOC :return "Bulk Alloc" ; +case RTE_ETH_BURST_SIMPLE :return "Simple" ; + +case RTE_ETH_BURST_PER_QUEUE :return "Per Queue" ; + } + +return "" ; +}Hi Haiyue,
Quoted 5 lines
The string representation of a vector mode is a data, and I think better to keep it separately as an array instead of keeping this information in the function and make the function use that data.
So that when new type are added it won't require to update the function itself.
Hi Ferruh,
Even the vector mode is a data, it still is a bit field option, if we treated them differently, that will make 'rte_eth_burst_mode_option_name' ugly like:
switch (option) {
case RTE_ETH_BURST_SCALAR: return "Scalar";
case RTE_ETH_BURST_VECTOR: return "Vector";
case RTE_ETH_BURST_SCATTERED: return "Scattered";
case RTE_ETH_BURST_BULK_ALLOC: return "Bulk Alloc";
case RTE_ETH_BURST_SIMPLE: return "Simple";
case RTE_ETH_BURST_PER_QUEUE: return "Per Queue";
}static const struct {
uint64_t vector;
const char *name;
} rte_burst_vector_names[] = {
{ RTE_ETH_BURST_ALTIVEC, "AltiVec" },
{ RTE_ETH_BURST_NEON, "Neon" },
{ RTE_ETH_BURST_SSE, "SSE" },
{ RTE_ETH_BURST_AVX2, "AVX2" },
{ RTE_ETH_BURST_AVX512, "AVX512" },
}; for (i = 0; i < RTE_DIM(rte_burst_vector_names); ++i) {
if (option == rte_burst_ vector _names[i].option)
return rte_burst_option_names[i].name;
}Why just put them together ?
static const struct {
uint64_t option;
const char *name;
} rte_burst_option_names[] = {
{ RTE_ETH_BURST_SCALAR, "Scalar" },
{ RTE_ETH_BURST_VECTOR, "Vector" },
{ RTE_ETH_BURST_ALTIVEC, "AltiVec" },
{ RTE_ETH_BURST_NEON, "Neon" },
{ RTE_ETH_BURST_SSE, "SSE" },
{ RTE_ETH_BURST_AVX2, "AVX2" },
{ RTE_ETH_BURST_AVX512, "AVX512" },
{ RTE_ETH_BURST_SCATTERED, "Scattered" },
{ RTE_ETH_BURST_BULK_ALLOC, "Bulk Alloc" },
{ RTE_ETH_BURST_SIMPLE, "Simple" },
{ RTE_ETH_BURST_PER_QUEUE, "Per Queue" },
};const char *rte_eth_burst_mode_option_name(uint64_t option)
{
const char *name = "";
unsigned int i;
for (i = 0; i < RTE_DIM(rte_burst_option_names); ++i) {
if (option == rte_burst_option_names[i].option) {
name = rte_burst_option_names[i].name;
break;
}
}
return name;
}Quoted 5 lines
'
rte_rx_offload_names' and 'rte_eth_dev_rx_offload_name()' is the good sample of what I mentioned above.Thanks,
ferruh
Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information
Quoted 54 lines · Haiyue
Quoted 54 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, October 15, 2019 00:39
To: Wang, Haiyue <[email protected]>; [email protected]; Ye, Xiaolong <[email protected]>
Cc: Kinsella, Ray <[email protected]>; Iremonger, Bernard <[email protected]>; Sun, Chenmin <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add the API for getting burst mode informationQuoted 7 lines · Haiyue Wang
Some PMDs have more than one RX/TX burst paths, add the ethdev API that allows an application to retrieve the mode information about Rx/Tx packet burst such as Scalar or Vector, and Vector technology like AVX2.
Signed-off-by Haiyue Wang <[email protected]>As far as I can see Bernard has ack only on testpmd patch, 4/4, not for reset of the patchset, can you please confirm this offline?
Quoted 1 line
Reviewed-by Xiaolong Ye <[email protected]><...>
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +12
-0+const char * +rte_eth_burst_mode_option_name (uint64_t option) +{ +switch (option) { +case RTE_ETH_BURST_SCALAR :return "Scalar" ; +case RTE_ETH_BURST_VECTOR :return "Vector" ; + +case RTE_ETH_BURST_ALTIVEC :return "AltiVec" ; +case RTE_ETH_BURST_NEON :return "Neon" ; +case RTE_ETH_BURST_SSE :return "SSE" ; +case RTE_ETH_BURST_AVX2 :return "AVX2" ; +case RTE_ETH_BURST_AVX512 :return "AVX512" ;lib/librte_ethdev/rte_ethdev.c rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, · line 4282
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ +case RTE_ETH_BURST_SCATTERED :return "Scattered" ; +case RTE_ETH_BURST_BULK_ALLOC :return "Bulk Alloc" ; +case RTE_ETH_BURST_SIMPLE :return "Simple" ; + +case RTE_ETH_BURST_PER_QUEUE :return "Per Queue" ; + } + +return "" ; +}Hi Haiyue,
The string representation of a vector mode is a data, and I think better to keep it separately as an array instead of keeping this information in the function and make the function use that data.
So that when new type are added it won't require to update the function itself.
<...>
Quoted 23 lines
Why just put them together ?
static const struct { uint64_t option; const char *name; } rte_burst_option_names[] = { { RTE_ETH_BURST_SCALAR, "Scalar" }, { RTE_ETH_BURST_VECTOR, "Vector" }, { RTE_ETH_BURST_ALTIVEC, "AltiVec" }, { RTE_ETH_BURST_NEON, "Neon" }, { RTE_ETH_BURST_SSE, "SSE" }, { RTE_ETH_BURST_AVX2, "AVX2" }, { RTE_ETH_BURST_AVX512, "AVX512" }, { RTE_ETH_BURST_SCATTERED, "Scattered" }, { RTE_ETH_BURST_BULK_ALLOC, "Bulk Alloc" }, { RTE_ETH_BURST_SIMPLE, "Simple" }, { RTE_ETH_BURST_PER_QUEUE, "Per Queue" }, };const char *
rte_eth_burst_mode_option_name(uint64_t option)
Quoted 13 lines
{
const char *name = "";
unsigned int i;
for (i = 0; i < RTE_DIM(rte_burst_option_names); ++i) {
if (option == rte_burst_option_names[i].option) {
name = rte_burst_option_names[i].name;
break;
}
}
return name;
}+1, this my intention, thanks.