Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(C) 2021 Marvell. 3 : : */ 4 : : 5 : : #include "cn10k_ethdev.h" 6 : : #include "cn10k_tx.h" 7 : : 8 : : static __rte_used inline void 9 [ # # ]: 0 : pick_tx_func(struct rte_eth_dev *eth_dev, 10 : : const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX]) 11 : : { 12 : : struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); 13 : : 14 : : /* [SEC] [TSP] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */ 15 : 0 : eth_dev->tx_pkt_burst = 16 : 0 : tx_burst[dev->tx_offload_flags & (NIX_TX_OFFLOAD_MAX - 1)]; 17 : : 18 [ # # ]: 0 : if (eth_dev->data->dev_started) 19 : 0 : rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = 20 : : eth_dev->tx_pkt_burst; 21 : 0 : } 22 : : 23 : : void 24 : 0 : cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev) 25 : : { 26 : : #if defined(RTE_ARCH_ARM64) 27 : : struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); 28 : : 29 : : const eth_tx_burst_t nix_eth_tx_burst[NIX_TX_OFFLOAD_MAX] = { 30 : : #define T(name, sz, flags)[flags] = cn10k_nix_xmit_pkts_##name, 31 : : 32 : : NIX_TX_FASTPATH_MODES 33 : : #undef T 34 : : }; 35 : : 36 : : const eth_tx_burst_t nix_eth_tx_burst_mseg[NIX_TX_OFFLOAD_MAX] = { 37 : : #define T(name, sz, flags)[flags] = cn10k_nix_xmit_pkts_mseg_##name, 38 : : 39 : : NIX_TX_FASTPATH_MODES 40 : : #undef T 41 : : }; 42 : : 43 : : const eth_tx_burst_t nix_eth_tx_vec_burst[NIX_TX_OFFLOAD_MAX] = { 44 : : #define T(name, sz, flags)[flags] = cn10k_nix_xmit_pkts_vec_##name, 45 : : 46 : : NIX_TX_FASTPATH_MODES 47 : : #undef T 48 : : }; 49 : : 50 : : const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[NIX_TX_OFFLOAD_MAX] = { 51 : : #define T(name, sz, flags)[flags] = cn10k_nix_xmit_pkts_vec_mseg_##name, 52 : : 53 : : NIX_TX_FASTPATH_MODES 54 : : #undef T 55 : : }; 56 : : 57 : : if (dev->scalar_ena || dev->tx_mark) { 58 : : pick_tx_func(eth_dev, nix_eth_tx_burst); 59 : : if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) 60 : : pick_tx_func(eth_dev, nix_eth_tx_burst_mseg); 61 : : } else { 62 : : pick_tx_func(eth_dev, nix_eth_tx_vec_burst); 63 : : if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) 64 : : pick_tx_func(eth_dev, nix_eth_tx_vec_burst_mseg); 65 : : } 66 : : 67 : : rte_mb(); 68 : : #else 69 : : RTE_SET_USED(eth_dev); 70 : : #endif 71 : 0 : }