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

Function eth_igb_tx_init

dpdk/drivers/net/e1000/igb_rxtx.c:2575–2623  ·  view source on GitHub ↗

* * Enable transmit unit. * **********************************************************************/

Source from the content-addressed store, hash-verified

2573 *
2574 **********************************************************************/
2575void
2576eth_igb_tx_init(struct rte_eth_dev *dev)
2577{
2578 struct e1000_hw *hw;
2579 struct igb_tx_queue *txq;
2580 uint32_t tctl;
2581 uint32_t txdctl;
2582 uint16_t i;
2583
2584 hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
2585
2586 /* Setup the Base and Length of the Tx Descriptor Rings. */
2587 for (i = 0; i < dev->data->nb_tx_queues; i++) {
2588 uint64_t bus_addr;
2589 txq = dev->data->tx_queues[i];
2590 bus_addr = txq->tx_ring_phys_addr;
2591
2592 E1000_WRITE_REG(hw, E1000_TDLEN(txq->reg_idx),
2593 txq->nb_tx_desc *
2594 sizeof(union e1000_adv_tx_desc));
2595 E1000_WRITE_REG(hw, E1000_TDBAH(txq->reg_idx),
2596 (uint32_t)(bus_addr >> 32));
2597 E1000_WRITE_REG(hw, E1000_TDBAL(txq->reg_idx), (uint32_t)bus_addr);
2598
2599 /* Setup the HW Tx Head and Tail descriptor pointers. */
2600 E1000_WRITE_REG(hw, E1000_TDT(txq->reg_idx), 0);
2601 E1000_WRITE_REG(hw, E1000_TDH(txq->reg_idx), 0);
2602
2603 /* Setup Transmit threshold registers. */
2604 txdctl = E1000_READ_REG(hw, E1000_TXDCTL(txq->reg_idx));
2605 txdctl |= txq->pthresh & 0x1F;
2606 txdctl |= ((txq->hthresh & 0x1F) << 8);
2607 txdctl |= ((txq->wthresh & 0x1F) << 16);
2608 txdctl |= E1000_TXDCTL_QUEUE_ENABLE;
2609 E1000_WRITE_REG(hw, E1000_TXDCTL(txq->reg_idx), txdctl);
2610 dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
2611 }
2612
2613 /* Program the Transmit Control Register. */
2614 tctl = E1000_READ_REG(hw, E1000_TCTL);
2615 tctl &= ~E1000_TCTL_CT;
2616 tctl |= (E1000_TCTL_PSP | E1000_TCTL_RTLC | E1000_TCTL_EN |
2617 (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT));
2618
2619 e1000_config_collision_dist(hw);
2620
2621 /* This write will effectively turn on the transmit unit. */
2622 E1000_WRITE_REG(hw, E1000_TCTL, tctl);
2623}
2624
2625/*********************************************************************
2626 *

Callers 1

eth_igb_startFunction · 0.85

Calls 1

Tested by

no test coverage detected