[v1,2/4] net/i40e: support to get the Rx/Tx burst mode
Checks
Commit Message
According to the selected Rx/Tx burst function name, retrieve the
related burst mode options.
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 2 +
drivers/net/i40e/i40e_ethdev.h | 4 ++
drivers/net/i40e/i40e_rxtx.c | 72 ++++++++++++++++++++++++++++++++++
3 files changed, 78 insertions(+)
Comments
What about `add Rx/Tx burst mode get callbacks` form the commit subject?
On 09/26, Haiyue Wang wrote:
>According to the selected Rx/Tx burst function name, retrieve the
>related burst mode options.
>
How about:
Retrieve burst mode options according to the selected Rx/Tx burst function
name.
Thanks,
Xiaolong
> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Thursday, September 26, 2019 21:50
> To: Wang, Haiyue <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Kinsella, Ray <ray.kinsella@intel.com>;
> Iremonger, Bernard <bernard.iremonger@intel.com>; Sun, Chenmin <chenmin.sun@intel.com>
> Subject: Re: [PATCH v1 2/4] net/i40e: support to get the Rx/Tx burst mode
>
> What about `add Rx/Tx burst mode get callbacks` form the commit subject?
>
+1, this makes patch clear, thanks.
> On 09/26, Haiyue Wang wrote:
> >According to the selected Rx/Tx burst function name, retrieve the
> >related burst mode options.
> >
>
> How about:
>
> Retrieve burst mode options according to the selected Rx/Tx burst function
> name.
>
+1, clear log, really. ;-)
> Thanks,
> Xiaolong
@@ -493,6 +493,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,
@@ -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);
+void i40e_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+ struct rte_eth_burst_mode *mode);
+void 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);
@@ -3028,6 +3028,49 @@ i40e_set_rx_function(struct rte_eth_dev *dev)
}
}
+void
+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;
+}
+
void __attribute__((cold))
i40e_set_tx_function_flag(struct rte_eth_dev *dev, struct i40e_tx_queue *txq)
{
@@ -3121,6 +3164,35 @@ i40e_set_tx_function(struct rte_eth_dev *dev)
}
}
+void
+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;
+}
+
void __attribute__((cold))
i40e_set_default_ptype_table(struct rte_eth_dev *dev)
{