Commit 63ec1c7c authored by Russell King's avatar Russell King Committed by David S. Miller

net: sfp: allow fault processing to transition to other states

Add the next state to sfp_sm_fault() so that it can branch to other
states. This will be necessary to improve the initialisation path.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eefa6f1f
...@@ -1334,7 +1334,7 @@ static bool sfp_los_event_inactive(struct sfp *sfp, unsigned int event) ...@@ -1334,7 +1334,7 @@ static bool sfp_los_event_inactive(struct sfp *sfp, unsigned int event)
event == SFP_E_LOS_LOW); event == SFP_E_LOS_LOW);
} }
static void sfp_sm_fault(struct sfp *sfp, bool warn) static void sfp_sm_fault(struct sfp *sfp, unsigned int next_state, bool warn)
{ {
if (sfp->sm_retries && !--sfp->sm_retries) { if (sfp->sm_retries && !--sfp->sm_retries) {
dev_err(sfp->dev, dev_err(sfp->dev,
...@@ -1344,7 +1344,7 @@ static void sfp_sm_fault(struct sfp *sfp, bool warn) ...@@ -1344,7 +1344,7 @@ static void sfp_sm_fault(struct sfp *sfp, bool warn)
if (warn) if (warn)
dev_err(sfp->dev, "module transmit fault indicated\n"); dev_err(sfp->dev, "module transmit fault indicated\n");
sfp_sm_next(sfp, SFP_S_TX_FAULT, T_FAULT_RECOVER); sfp_sm_next(sfp, next_state, T_FAULT_RECOVER);
} }
} }
...@@ -1684,14 +1684,14 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event) ...@@ -1684,14 +1684,14 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
case SFP_S_INIT: case SFP_S_INIT:
if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT) if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT)
sfp_sm_fault(sfp, true); sfp_sm_fault(sfp, SFP_S_TX_FAULT, true);
else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR)
init_done: sfp_sm_link_check_los(sfp); init_done: sfp_sm_link_check_los(sfp);
break; break;
case SFP_S_WAIT_LOS: case SFP_S_WAIT_LOS:
if (event == SFP_E_TX_FAULT) if (event == SFP_E_TX_FAULT)
sfp_sm_fault(sfp, true); sfp_sm_fault(sfp, SFP_S_TX_FAULT, true);
else if (sfp_los_event_inactive(sfp, event)) else if (sfp_los_event_inactive(sfp, event))
sfp_sm_link_up(sfp); sfp_sm_link_up(sfp);
break; break;
...@@ -1699,7 +1699,7 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event) ...@@ -1699,7 +1699,7 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
case SFP_S_LINK_UP: case SFP_S_LINK_UP:
if (event == SFP_E_TX_FAULT) { if (event == SFP_E_TX_FAULT) {
sfp_sm_link_down(sfp); sfp_sm_link_down(sfp);
sfp_sm_fault(sfp, true); sfp_sm_fault(sfp, SFP_S_TX_FAULT, true);
} else if (sfp_los_event_active(sfp, event)) { } else if (sfp_los_event_active(sfp, event)) {
sfp_sm_link_down(sfp); sfp_sm_link_down(sfp);
sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0); sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
...@@ -1715,7 +1715,7 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event) ...@@ -1715,7 +1715,7 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
case SFP_S_REINIT: case SFP_S_REINIT:
if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT) { if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT) {
sfp_sm_fault(sfp, false); sfp_sm_fault(sfp, SFP_S_TX_FAULT, false);
} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
dev_info(sfp->dev, "module transmit fault recovered\n"); dev_info(sfp->dev, "module transmit fault recovered\n");
sfp_sm_link_check_los(sfp); sfp_sm_link_check_los(sfp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment