| 3472 | } |
| 3473 | |
| 3474 | void __rte_cold |
| 3475 | i40e_set_tx_function(struct rte_eth_dev *dev) |
| 3476 | { |
| 3477 | struct i40e_adapter *ad = |
| 3478 | I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); |
| 3479 | int i; |
| 3480 | |
| 3481 | if (rte_eal_process_type() == RTE_PROC_PRIMARY) { |
| 3482 | #ifdef RTE_ARCH_X86 |
| 3483 | ad->tx_use_avx2 = false; |
| 3484 | ad->tx_use_avx512 = false; |
| 3485 | #endif |
| 3486 | if (ad->tx_vec_allowed) { |
| 3487 | for (i = 0; i < dev->data->nb_tx_queues; i++) { |
| 3488 | struct i40e_tx_queue *txq = |
| 3489 | dev->data->tx_queues[i]; |
| 3490 | |
| 3491 | if (txq && i40e_txq_vec_setup(txq)) { |
| 3492 | ad->tx_vec_allowed = false; |
| 3493 | break; |
| 3494 | } |
| 3495 | } |
| 3496 | #ifdef RTE_ARCH_X86 |
| 3497 | ad->tx_use_avx512 = get_avx_supported(1); |
| 3498 | |
| 3499 | if (!ad->tx_use_avx512) |
| 3500 | ad->tx_use_avx2 = get_avx_supported(0); |
| 3501 | #endif |
| 3502 | } |
| 3503 | } |
| 3504 | |
| 3505 | if (ad->tx_simple_allowed) { |
| 3506 | if (ad->tx_vec_allowed && |
| 3507 | rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) { |
| 3508 | #ifdef RTE_ARCH_X86 |
| 3509 | if (ad->tx_use_avx512) { |
| 3510 | #ifdef CC_AVX512_SUPPORT |
| 3511 | PMD_DRV_LOG(NOTICE, "Using AVX512 Vector Tx (port %d).", |
| 3512 | dev->data->port_id); |
| 3513 | dev->tx_pkt_burst = i40e_xmit_pkts_vec_avx512; |
| 3514 | #endif |
| 3515 | } else { |
| 3516 | PMD_INIT_LOG(DEBUG, "Using %sVector Tx (port %d).", |
| 3517 | ad->tx_use_avx2 ? "avx2 " : "", |
| 3518 | dev->data->port_id); |
| 3519 | dev->tx_pkt_burst = ad->tx_use_avx2 ? |
| 3520 | i40e_xmit_pkts_vec_avx2 : |
| 3521 | i40e_xmit_pkts_vec; |
| 3522 | dev->recycle_tx_mbufs_reuse = i40e_recycle_tx_mbufs_reuse_vec; |
| 3523 | } |
| 3524 | #else /* RTE_ARCH_X86 */ |
| 3525 | PMD_INIT_LOG(DEBUG, "Using Vector Tx (port %d).", |
| 3526 | dev->data->port_id); |
| 3527 | dev->tx_pkt_burst = i40e_xmit_pkts_vec; |
| 3528 | dev->recycle_tx_mbufs_reuse = i40e_recycle_tx_mbufs_reuse_vec; |
| 3529 | #endif /* RTE_ARCH_X86 */ |
| 3530 | } else { |
| 3531 | PMD_INIT_LOG(DEBUG, "Simple tx finally be used."); |
no test coverage detected