[Intel-wired-lan] [PATCH v3 10/11] igc: Add setup link functionality

Shannon Nelson shannon.nelson at oracle.com
Mon Jul 9 16:13:05 UTC 2018


On 7/4/2018 8:19 AM, Neftin, Sasha wrote:
> On 6/29/2018 18:03, Shannon Nelson wrote:
>> On 6/24/2018 1:45 AM, Sasha Neftin wrote:

[...]

>>> +/**
>>> + *  igc_wait_autoneg - Wait for auto-neg completion
>>> + *  @hw: pointer to the HW structure
>>> + *
>>> + *  Waits for auto-negotiation to complete or for the 
>>> auto-negotiation time
>>> + *  limit to expire, which ever happens first.
>>> + **/
>>> +static s32 igc_wait_autoneg(struct e1000_hw *hw)
>>> +{
>>> +    s32 ret_val = 0;
>>> +    u16 i, phy_status;
>>> +
>>> +    /* Break after autoneg completes or PHY_AUTO_NEG_LIMIT expires. */
>>> +    for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) {
>>> +        ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
>>> +        if (ret_val)
>>> +            break;
>>> +        ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
>>> +        if (ret_val)
>>> +            break;
>>> +        if (phy_status & MII_SR_AUTONEG_COMPLETE)
>>> +            break;
>>> +        msleep(100);
>>> +    }
>>> +
>>> +    /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation
>>> +     * has completed.
>>> +     */
>>
>> Should you return an error value if the wait time expired?
>>
> ret_val is returned. do you mean something else?

Should some non-zero value be returned if the for-loop ran out and 
MII_SR_AUTONEG_COMPLETE was never set?

sln



More information about the Intel-wired-lan mailing list