From: Haiyue Wang <haiyue.wang@intel.com>
To: dev@dpdk.org, ferruh.yigit@intel.com, xiaolong.ye@intel.com
Cc: ray.kinsella@intel.com, bernard.iremonger@intel.com,
chenmin.sun@intel.com, Haiyue Wang <haiyue.wang@intel.com>
Subject: [dpdk-dev] [PATCH v3 2/4] net/i40e: add Rx/Tx burst mode get callbacks
Date: Mon, 14 Oct 2019 23:35:55 +0800 [thread overview]
Message-ID: <20191014153557.88467-3-haiyue.wang@intel.com> (raw)
In-Reply-To: <20191014153557.88467-1-haiyue.wang@intel.com>
Retrieve burst mode options according to the selected Rx/Tx burst
function name.
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
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(+)
diff --git a/doc/guides/nics/features/i40e.ini b/doc/guides/nics/features/i40e.ini
index 980bcc5b2..e5ae6ded0 100644
--- a/doc/guides/nics/features/i40e.ini
+++ b/doc/guides/nics/features/i40e.ini
@@ -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
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2ca14da3b..77a46832c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -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,
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 261954b9a..2ddaffbeb 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -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);
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index bfe161f2c..09c01f67c 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3022,6 +3022,51 @@ i40e_set_rx_function(struct rte_eth_dev *dev)
}
}
+int
+i40e_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
+ struct rte_eth_burst_mode *mode)
+{
+ eth_rx_burst_t pkt_burst = dev->rx_pkt_burst;
+ uint64_t options;
+
+ if (pkt_burst == i40e_recv_scattered_pkts)
+ options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SCATTERED;
+ else if (pkt_burst == i40e_recv_pkts_bulk_alloc)
+ options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_BULK_ALLOC;
+ else if (pkt_burst == i40e_recv_pkts)
+ options = RTE_ETH_BURST_SCALAR;
+#ifdef RTE_ARCH_X86
+ else if (pkt_burst == i40e_recv_scattered_pkts_vec_avx2)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2 |
+ RTE_ETH_BURST_SCATTERED;
+ else if (pkt_burst == i40e_recv_pkts_vec_avx2)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2;
+ else if (pkt_burst == i40e_recv_scattered_pkts_vec)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE |
+ RTE_ETH_BURST_SCATTERED;
+ else if (pkt_burst == i40e_recv_pkts_vec)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE;
+#elif defined(RTE_ARCH_ARM64)
+ else if (pkt_burst == i40e_recv_scattered_pkts_vec)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_NEON |
+ RTE_ETH_BURST_SCATTERED;
+ else if (pkt_burst == i40e_recv_pkts_vec)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_NEON;
+#elif defined(RTE_ARCH_PPC_64)
+ else if (pkt_burst == i40e_recv_scattered_pkts_vec)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_ALTIVEC |
+ RTE_ETH_BURST_SCATTERED;
+ else if (pkt_burst == i40e_recv_pkts_vec)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_ALTIVEC;
+#endif
+ else
+ options = 0;
+
+ mode->options = options;
+
+ return options != 0 ? 0 : -EINVAL;
+}
+
void __attribute__((cold))
i40e_set_tx_function_flag(struct rte_eth_dev *dev, struct i40e_tx_queue *txq)
{
@@ -3115,6 +3160,37 @@ i40e_set_tx_function(struct rte_eth_dev *dev)
}
}
+int
+i40e_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
+ struct rte_eth_burst_mode *mode)
+{
+ eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
+ uint64_t options;
+
+ if (pkt_burst == i40e_xmit_pkts_simple)
+ options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SIMPLE;
+ else if (pkt_burst == i40e_xmit_pkts)
+ options = RTE_ETH_BURST_SCALAR;
+#ifdef RTE_ARCH_X86
+ else if (pkt_burst == i40e_xmit_pkts_vec_avx2)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2;
+ else if (pkt_burst == i40e_xmit_pkts_vec)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE;
+#elif defined(RTE_ARCH_ARM64)
+ else if (pkt_burst == i40e_xmit_pkts_vec)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_NEON;
+#elif defined(RTE_ARCH_PPC_64)
+ else if (pkt_burst == i40e_xmit_pkts_vec)
+ options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_ALTIVEC;
+#endif
+ else
+ options = 0;
+
+ mode->options = options;
+
+ return options != 0 ? 0 : -EINVAL;
+}
+
void __attribute__((cold))
i40e_set_default_ptype_table(struct rte_eth_dev *dev)
{
--
2.17.1
next prev parent reply other threads:[~2019-10-14 15:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 15:35 [dpdk-dev] [PATCH v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting " Haiyue Wang
2019-10-14 16:39 ` Ferruh Yigit
2019-10-15 1:02 ` Wang, Haiyue
2019-10-15 1:39 ` Wang, Haiyue
2019-10-15 7:58 ` Ferruh Yigit
2019-10-14 15:35 ` Haiyue Wang [this message]
2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 3/4] net/ice: add Rx/Tx burst mode get callbacks Haiyue Wang
2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191014153557.88467-3-haiyue.wang@intel.com \
--to=haiyue.wang@intel.com \
--cc=bernard.iremonger@intel.com \
--cc=chenmin.sun@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=ray.kinsella@intel.com \
--cc=xiaolong.ye@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).