IB/hfi1: Fix MAD port poll for active cables
authorDean Luick <dean.luick@intel.com>
Thu, 14 Apr 2016 15:31:48 +0000 (08:31 -0700)
committerDoug Ledford <dledford@redhat.com>
Thu, 28 Apr 2016 20:32:29 +0000 (16:32 -0400)
A MAD directive to start polling must go through the normal
link tuning and start steps in order to correctly handle
active cables.

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/staging/rdma/hfi1/mad.c

index d1e7f4d7cf6fdf3fb32d699af45348201511b38d..ed58cf21e790e24048a550983758e0f1aa351a36 100644 (file)
@@ -999,7 +999,21 @@ static int set_port_states(struct hfi1_pportdata *ppd, struct opa_smp *smp,
                        break;
                }
 
-               set_link_state(ppd, link_state);
+               if ((link_state == HLS_DN_POLL ||
+                    link_state == HLS_DN_DOWNDEF)) {
+                       /*
+                        * Going to poll.  No matter what the current state,
+                        * always move offline first, then tune and start the
+                        * link.  This correctly handles a FM link bounce and
+                        * a link enable.  Going offline is a no-op if already
+                        * offline.
+                        */
+                       set_link_state(ppd, HLS_DN_OFFLINE);
+                       tune_serdes(ppd);
+                       start_link(ppd);
+               } else {
+                       set_link_state(ppd, link_state);
+               }
                if (link_state == HLS_DN_DISABLE &&
                    (ppd->offline_disabled_reason >
                     HFI1_ODR_MASK(OPA_LINKDOWN_REASON_SMA_DISABLED) ||