* * Initialize the hardware * **********************************************************************/
| 823 | * |
| 824 | **********************************************************************/ |
| 825 | static int |
| 826 | em_hardware_init(struct e1000_hw *hw) |
| 827 | { |
| 828 | uint32_t rx_buf_size; |
| 829 | int diag; |
| 830 | |
| 831 | /* Issue a global reset */ |
| 832 | e1000_reset_hw(hw); |
| 833 | |
| 834 | /* Let the firmware know the OS is in control */ |
| 835 | em_hw_control_acquire(hw); |
| 836 | |
| 837 | /* |
| 838 | * These parameters control the automatic generation (Tx) and |
| 839 | * response (Rx) to Ethernet PAUSE frames. |
| 840 | * - High water mark should allow for at least two standard size (1518) |
| 841 | * frames to be received after sending an XOFF. |
| 842 | * - Low water mark works best when it is very near the high water mark. |
| 843 | * This allows the receiver to restart by sending XON when it has |
| 844 | * drained a bit. Here we use an arbitrary value of 1500 which will |
| 845 | * restart after one full frame is pulled from the buffer. There |
| 846 | * could be several smaller frames in the buffer and if so they will |
| 847 | * not trigger the XON until their total number reduces the buffer |
| 848 | * by 1500. |
| 849 | * - The pause time is fairly large at 1000 x 512ns = 512 usec. |
| 850 | */ |
| 851 | rx_buf_size = em_get_rx_buffer_size(hw); |
| 852 | |
| 853 | hw->fc.high_water = rx_buf_size - |
| 854 | PMD_ROUNDUP(RTE_ETHER_MAX_LEN * 2, 1024); |
| 855 | hw->fc.low_water = hw->fc.high_water - 1500; |
| 856 | |
| 857 | if (hw->mac.type == e1000_80003es2lan) |
| 858 | hw->fc.pause_time = UINT16_MAX; |
| 859 | else |
| 860 | hw->fc.pause_time = EM_FC_PAUSE_TIME; |
| 861 | |
| 862 | hw->fc.send_xon = 1; |
| 863 | |
| 864 | /* Set Flow control, use the tunable location if sane */ |
| 865 | if (em_fc_setting <= e1000_fc_full) |
| 866 | hw->fc.requested_mode = em_fc_setting; |
| 867 | else |
| 868 | hw->fc.requested_mode = e1000_fc_none; |
| 869 | |
| 870 | /* Workaround: no TX flow ctrl for PCH */ |
| 871 | if (hw->mac.type == e1000_pchlan) |
| 872 | hw->fc.requested_mode = e1000_fc_rx_pause; |
| 873 | |
| 874 | /* Override - settings for PCH2LAN, ya its magic :) */ |
| 875 | if (hw->mac.type == e1000_pch2lan) { |
| 876 | hw->fc.high_water = 0x5C20; |
| 877 | hw->fc.low_water = 0x5048; |
| 878 | hw->fc.pause_time = 0x0650; |
| 879 | hw->fc.refresh_time = 0x0400; |
| 880 | } else if (hw->mac.type == e1000_pch_lpt || |
| 881 | hw->mac.type == e1000_pch_spt || |
| 882 | hw->mac.type == e1000_pch_cnp || |
no test coverage detected