MCPcopy Create free account
hub / github.com/F-Stack/f-stack / i40e_switch_tx_queue

Function i40e_switch_tx_queue

dpdk/drivers/net/i40e/i40e_ethdev.c:6326–6384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6324}
6325
6326int
6327i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on)
6328{
6329 uint32_t reg;
6330 uint16_t j;
6331
6332 /**
6333 * Set or clear TX Queue Disable flags,
6334 * which is required by hardware.
6335 */
6336 i40e_pre_tx_queue_cfg(hw, q_idx, on);
6337 rte_delay_us(I40E_PRE_TX_Q_CFG_WAIT_US);
6338
6339 /* Wait until the request is finished */
6340 for (j = 0; j < I40E_CHK_Q_ENA_COUNT; j++) {
6341 rte_delay_us(I40E_CHK_Q_ENA_INTERVAL_US);
6342 reg = I40E_READ_REG(hw, I40E_QTX_ENA(q_idx));
6343 if (!(((reg >> I40E_QTX_ENA_QENA_REQ_SHIFT) & 0x1) ^
6344 ((reg >> I40E_QTX_ENA_QENA_STAT_SHIFT)
6345 & 0x1))) {
6346 break;
6347 }
6348 }
6349 if (on) {
6350 if (reg & I40E_QTX_ENA_QENA_STAT_MASK)
6351 return I40E_SUCCESS; /* already on, skip next steps */
6352
6353 I40E_WRITE_REG(hw, I40E_QTX_HEAD(q_idx), 0);
6354 reg |= I40E_QTX_ENA_QENA_REQ_MASK;
6355 } else {
6356 if (!(reg & I40E_QTX_ENA_QENA_STAT_MASK))
6357 return I40E_SUCCESS; /* already off, skip next steps */
6358 reg &= ~I40E_QTX_ENA_QENA_REQ_MASK;
6359 }
6360 /* Write the register */
6361 I40E_WRITE_REG(hw, I40E_QTX_ENA(q_idx), reg);
6362 /* Check the result */
6363 for (j = 0; j < I40E_CHK_Q_ENA_COUNT; j++) {
6364 rte_delay_us(I40E_CHK_Q_ENA_INTERVAL_US);
6365 reg = I40E_READ_REG(hw, I40E_QTX_ENA(q_idx));
6366 if (on) {
6367 if ((reg & I40E_QTX_ENA_QENA_REQ_MASK) &&
6368 (reg & I40E_QTX_ENA_QENA_STAT_MASK))
6369 break;
6370 } else {
6371 if (!(reg & I40E_QTX_ENA_QENA_REQ_MASK) &&
6372 !(reg & I40E_QTX_ENA_QENA_STAT_MASK))
6373 break;
6374 }
6375 }
6376 /* Check if it is timeout */
6377 if (j >= I40E_CHK_Q_ENA_COUNT) {
6378 PMD_DRV_LOG(ERR, "Failed to %s tx queue[%u]",
6379 (on ? "enable" : "disable"), q_idx);
6380 return I40E_ERR_TIMEOUT;
6381 }
6382
6383 return I40E_SUCCESS;

Callers 5

i40e_fdir_setupFunction · 0.85
i40e_fdir_teardownFunction · 0.85
i40e_dev_tx_queue_startFunction · 0.85
i40e_dev_tx_queue_stopFunction · 0.85

Calls 1

i40e_pre_tx_queue_cfgFunction · 0.85

Tested by

no test coverage detected