| 131 | } |
| 132 | |
| 133 | int |
| 134 | sfc_tx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index, |
| 135 | uint16_t nb_tx_desc, unsigned int socket_id, |
| 136 | const struct rte_eth_txconf *tx_conf) |
| 137 | { |
| 138 | struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); |
| 139 | sfc_ethdev_qid_t ethdev_qid; |
| 140 | const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); |
| 141 | unsigned int txq_entries; |
| 142 | unsigned int evq_entries; |
| 143 | unsigned int txq_max_fill_level; |
| 144 | struct sfc_txq_info *txq_info; |
| 145 | struct sfc_evq *evq; |
| 146 | struct sfc_txq *txq; |
| 147 | int rc = 0; |
| 148 | struct sfc_dp_tx_qcreate_info info; |
| 149 | uint64_t offloads; |
| 150 | struct sfc_dp_tx_hw_limits hw_limits; |
| 151 | |
| 152 | ethdev_qid = sfc_ethdev_tx_qid_by_txq_sw_index(sas, sw_index); |
| 153 | |
| 154 | sfc_log_init(sa, "TxQ = %d (internal %u)", ethdev_qid, sw_index); |
| 155 | |
| 156 | memset(&hw_limits, 0, sizeof(hw_limits)); |
| 157 | hw_limits.txq_max_entries = sa->txq_max_entries; |
| 158 | hw_limits.txq_min_entries = sa->txq_min_entries; |
| 159 | |
| 160 | rc = sa->priv.dp_tx->qsize_up_rings(nb_tx_desc, &hw_limits, |
| 161 | &txq_entries, &evq_entries, |
| 162 | &txq_max_fill_level); |
| 163 | if (rc != 0) |
| 164 | goto fail_size_up_rings; |
| 165 | SFC_ASSERT(txq_entries >= sa->txq_min_entries); |
| 166 | SFC_ASSERT(txq_entries <= sa->txq_max_entries); |
| 167 | SFC_ASSERT(txq_entries >= nb_tx_desc); |
| 168 | SFC_ASSERT(txq_max_fill_level <= nb_tx_desc); |
| 169 | |
| 170 | offloads = tx_conf->offloads; |
| 171 | /* Add device level Tx offloads if the queue is an ethdev Tx queue */ |
| 172 | if (ethdev_qid != SFC_ETHDEV_QID_INVALID) |
| 173 | offloads |= sa->eth_dev->data->dev_conf.txmode.offloads; |
| 174 | |
| 175 | rc = sfc_tx_qcheck_conf(sa, txq_max_fill_level, tx_conf, offloads); |
| 176 | if (rc != 0) |
| 177 | goto fail_bad_conf; |
| 178 | |
| 179 | SFC_ASSERT(sw_index < sfc_sa2shared(sa)->txq_count); |
| 180 | txq_info = &sfc_sa2shared(sa)->txq_info[sw_index]; |
| 181 | |
| 182 | txq_info->entries = txq_entries; |
| 183 | |
| 184 | rc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_TX, sw_index, |
| 185 | evq_entries, socket_id, &evq); |
| 186 | if (rc != 0) |
| 187 | goto fail_ev_qinit; |
| 188 | |
| 189 | txq = &sa->txq_ctrl[sw_index]; |
| 190 | txq->hw_index = sw_index; |
no test coverage detected