1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
5 #include "cn10k_ethdev.h"
8 #define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \
9 uint16_t __rte_noinline __rte_hot cn10k_nix_xmit_pkts_##name( \
10 void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts) \
14 /* For TSO inner checksum is a must */ \
15 if (((flags) & NIX_TX_OFFLOAD_TSO_F) && \
16 !((flags) & NIX_TX_OFFLOAD_L3_L4_CSUM_F)) \
18 return cn10k_nix_xmit_pkts(tx_queue, tx_pkts, pkts, cmd, \
26 pick_tx_func(struct rte_eth_dev *eth_dev,
27 const eth_tx_burst_t tx_burst[2][2][2][2][2][2][2])
29 struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
31 /* [SEC] [TSP] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
32 eth_dev->tx_pkt_burst = tx_burst
33 [!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_SECURITY_F)]
34 [!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)]
35 [!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)]
36 [!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)]
37 [!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_VLAN_QINQ_F)]
38 [!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F)]
39 [!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F)];
43 cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
45 struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
47 const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2][2] = {
48 #define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \
49 [f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
55 const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2][2] = {
56 #define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \
57 [f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
63 const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2][2] = {
64 #define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \
65 [f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
71 const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[2][2][2][2][2][2][2] = {
72 #define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags) \
73 [f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_mseg_##name,
79 if (dev->scalar_ena) {
80 pick_tx_func(eth_dev, nix_eth_tx_burst);
81 if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS)
82 pick_tx_func(eth_dev, nix_eth_tx_burst_mseg);
84 pick_tx_func(eth_dev, nix_eth_tx_vec_burst);
85 if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS)
86 pick_tx_func(eth_dev, nix_eth_tx_vec_burst_mseg);