Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(C) 2021 Marvell. 3 : : */ 4 : : 5 : : #include "cn9k_ethdev.h" 6 : : #include "cn9k_tx.h" 7 : : 8 : : static __rte_used 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 : : /* [TS] [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 : : #if defined(RTE_ARCH_ARM64) 24 : : static int 25 : : cn9k_nix_tx_queue_count(void *tx_queue) 26 : : { 27 : : struct cn9k_eth_txq *txq = (struct cn9k_eth_txq *)tx_queue; 28 : : 29 : : return cnxk_nix_tx_queue_count(txq->fc_mem, txq->sqes_per_sqb_log2); 30 : : } 31 : : 32 : : static int 33 : : cn9k_nix_tx_queue_sec_count(void *tx_queue) 34 : : { 35 : : struct cn9k_eth_txq *txq = (struct cn9k_eth_txq *)tx_queue; 36 : : 37 : : return cnxk_nix_tx_queue_sec_count(txq->fc_mem, txq->sqes_per_sqb_log2, txq->cpt_fc); 38 : : } 39 : : #endif 40 : : 41 : : void 42 : 0 : cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev) 43 : : { 44 : : #if defined(RTE_ARCH_ARM64) 45 : : struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); 46 : : 47 : : const eth_tx_burst_t nix_eth_tx_burst[NIX_TX_OFFLOAD_MAX] = { 48 : : #define T(name, sz, flags)[flags] = cn9k_nix_xmit_pkts_##name, 49 : : NIX_TX_FASTPATH_MODES 50 : : #undef T 51 : : }; 52 : : 53 : : const eth_tx_burst_t nix_eth_tx_burst_mseg[NIX_TX_OFFLOAD_MAX] = { 54 : : #define T(name, sz, flags)[flags] = cn9k_nix_xmit_pkts_mseg_##name, 55 : : NIX_TX_FASTPATH_MODES 56 : : #undef T 57 : : }; 58 : : 59 : : const eth_tx_burst_t nix_eth_tx_vec_burst[NIX_TX_OFFLOAD_MAX] = { 60 : : #define T(name, sz, flags)[flags] = cn9k_nix_xmit_pkts_vec_##name, 61 : : NIX_TX_FASTPATH_MODES 62 : : #undef T 63 : : }; 64 : : 65 : : const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[NIX_TX_OFFLOAD_MAX] = { 66 : : #define T(name, sz, flags)[flags] = cn9k_nix_xmit_pkts_vec_mseg_##name, 67 : : NIX_TX_FASTPATH_MODES 68 : : #undef T 69 : : }; 70 : : 71 : : if (dev->scalar_ena || dev->tx_mark) { 72 : : pick_tx_func(eth_dev, nix_eth_tx_burst); 73 : : if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) 74 : : pick_tx_func(eth_dev, nix_eth_tx_burst_mseg); 75 : : } else { 76 : : pick_tx_func(eth_dev, nix_eth_tx_vec_burst); 77 : : if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) 78 : : pick_tx_func(eth_dev, nix_eth_tx_vec_burst_mseg); 79 : : } 80 : : if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY) 81 : : eth_dev->tx_queue_count = cn9k_nix_tx_queue_sec_count; 82 : : else 83 : : eth_dev->tx_queue_count = cn9k_nix_tx_queue_count; 84 : : 85 : : 86 : : rte_mb(); 87 : : #else 88 : : RTE_SET_USED(eth_dev); 89 : : #endif 90 : 0 : }