* txgbe_setup_fc - Set up flow control * @hw: pointer to hardware structure * * Called at init time to set up flow control. **/
| 84 | * Called at init time to set up flow control. |
| 85 | **/ |
| 86 | s32 txgbe_setup_fc(struct txgbe_hw *hw) |
| 87 | { |
| 88 | s32 err = 0; |
| 89 | u32 reg = 0; |
| 90 | u16 reg_cu = 0; |
| 91 | u32 value = 0; |
| 92 | u64 reg_bp = 0; |
| 93 | |
| 94 | /* Validate the requested mode */ |
| 95 | if (hw->fc.strict_ieee && hw->fc.requested_mode == txgbe_fc_rx_pause) { |
| 96 | DEBUGOUT("txgbe_fc_rx_pause not valid in strict IEEE mode"); |
| 97 | err = TXGBE_ERR_INVALID_LINK_SETTINGS; |
| 98 | goto out; |
| 99 | } |
| 100 | |
| 101 | /* |
| 102 | * 10gig parts do not have a word in the EEPROM to determine the |
| 103 | * default flow control setting, so we explicitly set it to full. |
| 104 | */ |
| 105 | if (hw->fc.requested_mode == txgbe_fc_default) |
| 106 | hw->fc.requested_mode = txgbe_fc_full; |
| 107 | |
| 108 | /* |
| 109 | * The possible values of fc.requested_mode are: |
| 110 | * 0: Flow control is completely disabled |
| 111 | * 1: Rx flow control is enabled (we can receive pause frames, |
| 112 | * but not send pause frames). |
| 113 | * 2: Tx flow control is enabled (we can send pause frames but |
| 114 | * we do not support receiving pause frames). |
| 115 | * 3: Both Rx and Tx flow control (symmetric) are enabled. |
| 116 | * other: Invalid. |
| 117 | */ |
| 118 | switch (hw->fc.requested_mode) { |
| 119 | case txgbe_fc_none: |
| 120 | /* Flow control completely disabled by software override. */ |
| 121 | break; |
| 122 | case txgbe_fc_tx_pause: |
| 123 | /* |
| 124 | * Tx Flow control is enabled, and Rx Flow control is |
| 125 | * disabled by software override. |
| 126 | */ |
| 127 | reg |= SR_MII_MMD_AN_ADV_PAUSE_ASM; |
| 128 | reg_bp |= SR_AN_MMD_ADV_REG1_PAUSE_ASM; |
| 129 | break; |
| 130 | case txgbe_fc_rx_pause: |
| 131 | /* |
| 132 | * Rx Flow control is enabled and Tx Flow control is |
| 133 | * disabled by software override. Since there really |
| 134 | * isn't a way to advertise that we are capable of RX |
| 135 | * Pause ONLY, we will advertise that we support both |
| 136 | * symmetric and asymmetric Rx PAUSE, as such we fall |
| 137 | * through to the fc_full statement. Later, we will |
| 138 | * disable the adapter's ability to send PAUSE frames. |
| 139 | */ |
| 140 | case txgbe_fc_full: |
| 141 | /* Flow control (both Rx and Tx) is enabled by SW override. */ |
| 142 | reg |= SR_MII_MMD_AN_ADV_PAUSE_SYM | |
| 143 | SR_MII_MMD_AN_ADV_PAUSE_ASM; |
no test coverage detected