lkml.org 
[lkml]   [2018]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 096/159] sfp: fix RX_LOS signal handling
    Date
    4.14-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Russell King <rmk+kernel@armlinux.org.uk>


    [ Upstream commit acf1c02f023926b8b04672a9e81b1711ae681619 ]

    The options word is a be16 quantity, so we need to test the flags
    having converted the endian-ness. Convert the flag bits to be16,
    which can be optimised by the compiler, rather than converting a
    variable at runtime.

    Reported-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/net/phy/sfp.c | 8 +++++---
    1 file changed, 5 insertions(+), 3 deletions(-)

    --- a/drivers/net/phy/sfp.c
    +++ b/drivers/net/phy/sfp.c
    @@ -358,7 +358,7 @@ static void sfp_sm_link_check_los(struct
    * SFP_OPTIONS_LOS_NORMAL are set? For now, we assume
    * the same as SFP_OPTIONS_LOS_NORMAL set.
    */
    - if (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED)
    + if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED))
    los ^= SFP_F_LOS;

    if (los)
    @@ -583,7 +583,8 @@ static void sfp_sm_event(struct sfp *sfp
    if (event == SFP_E_TX_FAULT)
    sfp_sm_fault(sfp, true);
    else if (event ==
    - (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ?
    + (sfp->id.ext.options &
    + cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) ?
    SFP_E_LOS_HIGH : SFP_E_LOS_LOW))
    sfp_sm_link_up(sfp);
    break;
    @@ -593,7 +594,8 @@ static void sfp_sm_event(struct sfp *sfp
    sfp_sm_link_down(sfp);
    sfp_sm_fault(sfp, true);
    } else if (event ==
    - (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ?
    + (sfp->id.ext.options &
    + cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) ?
    SFP_E_LOS_LOW : SFP_E_LOS_HIGH)) {
    sfp_sm_link_down(sfp);
    sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);

    \
     
     \ /
      Last update: 2018-02-23 20:23    [W:2.932 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site