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

Function igb_hardware_init

dpdk/drivers/net/e1000/igb_ethdev.c:1653–1703  ·  view source on GitHub ↗

* * Initialize the hardware * **********************************************************************/

Source from the content-addressed store, hash-verified

1651 *
1652 **********************************************************************/
1653static int
1654igb_hardware_init(struct e1000_hw *hw)
1655{
1656 uint32_t rx_buf_size;
1657 int diag;
1658
1659 /* Let the firmware know the OS is in control */
1660 igb_hw_control_acquire(hw);
1661
1662 /*
1663 * These parameters control the automatic generation (Tx) and
1664 * response (Rx) to Ethernet PAUSE frames.
1665 * - High water mark should allow for at least two standard size (1518)
1666 * frames to be received after sending an XOFF.
1667 * - Low water mark works best when it is very near the high water mark.
1668 * This allows the receiver to restart by sending XON when it has
1669 * drained a bit. Here we use an arbitrary value of 1500 which will
1670 * restart after one full frame is pulled from the buffer. There
1671 * could be several smaller frames in the buffer and if so they will
1672 * not trigger the XON until their total number reduces the buffer
1673 * by 1500.
1674 * - The pause time is fairly large at 1000 x 512ns = 512 usec.
1675 */
1676 rx_buf_size = igb_get_rx_buffer_size(hw);
1677
1678 hw->fc.high_water = rx_buf_size - (RTE_ETHER_MAX_LEN * 2);
1679 hw->fc.low_water = hw->fc.high_water - 1500;
1680 hw->fc.pause_time = IGB_FC_PAUSE_TIME;
1681 hw->fc.send_xon = 1;
1682
1683 /* Set Flow control, use the tunable location if sane */
1684 if ((igb_fc_setting != e1000_fc_none) && (igb_fc_setting < 4))
1685 hw->fc.requested_mode = igb_fc_setting;
1686 else
1687 hw->fc.requested_mode = e1000_fc_none;
1688
1689 /* Issue a global reset */
1690 igb_pf_reset_hw(hw);
1691 E1000_WRITE_REG(hw, E1000_WUC, 0);
1692
1693 diag = e1000_init_hw(hw);
1694 if (diag < 0)
1695 return diag;
1696
1697 E1000_WRITE_REG(hw, E1000_VET,
1698 RTE_ETHER_TYPE_VLAN << 16 | RTE_ETHER_TYPE_VLAN);
1699 e1000_get_phy_info(hw);
1700 e1000_check_for_link(hw);
1701
1702 return 0;
1703}
1704
1705/* This function is based on igb_update_stats_counters() in igb/if_igb.c */
1706static void

Callers 2

eth_igb_dev_initFunction · 0.85
eth_igb_startFunction · 0.85

Calls 6

igb_hw_control_acquireFunction · 0.85
igb_get_rx_buffer_sizeFunction · 0.85
igb_pf_reset_hwFunction · 0.85
e1000_init_hwFunction · 0.85
e1000_get_phy_infoFunction · 0.85
e1000_check_for_linkFunction · 0.85

Tested by

no test coverage detected