ASIC_QSFP2_INVERT :
                                                ASIC_QSFP1_INVERT,
                                qsfp_int_mgmt);
+
+                       if ((ppd->offline_disabled_reason >
+                         HFI1_ODR_MASK(
+                         OPA_LINKDOWN_REASONLOCAL_MEDIA_NOT_INSTALLED)) ||
+                         (ppd->offline_disabled_reason ==
+                         HFI1_ODR_MASK(OPA_LINKDOWN_REASON_NONE)))
+                               ppd->offline_disabled_reason =
+                               HFI1_ODR_MASK(
+                               OPA_LINKDOWN_REASONLOCAL_MEDIA_NOT_INSTALLED);
+
                        if (ppd->host_link_state == HLS_DN_POLL) {
                                /*
                                 * The link is still in POLL. This means
                                ret);
                        return -EINVAL;
                }
-               if (ppd->offline_disabled_reason == OPA_LINKDOWN_REASON_NONE)
+               if (ppd->offline_disabled_reason ==
+                               HFI1_ODR_MASK(OPA_LINKDOWN_REASON_NONE))
                        ppd->offline_disabled_reason =
-                       OPA_LINKDOWN_REASON_TRANSIENT;
+                       HFI1_ODR_MASK(OPA_LINKDOWN_REASON_TRANSIENT);
        }
 
        if (do_wait) {
                                ret = -EINVAL;
                        }
                }
-               ppd->offline_disabled_reason = OPA_LINKDOWN_REASON_NONE;
+               ppd->offline_disabled_reason =
+                       HFI1_ODR_MASK(OPA_LINKDOWN_REASON_NONE);
                /*
                 * If an error occurred above, go back to offline.  The
                 * caller may reschedule another attempt.
 
        pi->port_states.ledenable_offlinereason |=
                ppd->is_sm_config_started << 5;
        pi->port_states.ledenable_offlinereason |=
-               ppd->offline_disabled_reason & OPA_PI_MASK_OFFLINE_REASON;
+               ppd->offline_disabled_reason;
 #else
        pi->port_states.offline_reason = ppd->neighbor_normal << 4;
        pi->port_states.offline_reason |= ppd->is_sm_config_started << 5;
-       pi->port_states.offline_reason |= ppd->offline_disabled_reason &
-                                               OPA_PI_MASK_OFFLINE_REASON;
+       pi->port_states.offline_reason |= ppd->offline_disabled_reason;
 #endif /* PI_LED_ENABLE_SUP */
 
        pi->port_states.portphysstate_portstate =
            physical_allowed == HFI_TRANSITION_IGNORED)
                return HFI_TRANSITION_IGNORED;
 
+       /*
+        * A change request of Physical Port State from
+        * 'Offline' to 'Polling' should be ignored.
+        */
+       if ((physical_old == OPA_PORTPHYSSTATE_OFFLINE) &&
+           (physical_new == IB_PORTPHYSSTATE_POLLING))
+               return HFI_TRANSITION_IGNORED;
+
        /*
         * Either physical_allowed or logical_allowed is
         * HFI_TRANSITION_ALLOWED.
                set_link_state(ppd, link_state);
                if (link_state == HLS_DN_DISABLE &&
                    (ppd->offline_disabled_reason >
-                    OPA_LINKDOWN_REASON_SMA_DISABLED ||
+                    HFI1_ODR_MASK(OPA_LINKDOWN_REASON_SMA_DISABLED) ||
                     ppd->offline_disabled_reason ==
-                    OPA_LINKDOWN_REASON_NONE))
+                    HFI1_ODR_MASK(OPA_LINKDOWN_REASON_NONE)))
                        ppd->offline_disabled_reason =
-                       OPA_LINKDOWN_REASON_SMA_DISABLED;
+                       HFI1_ODR_MASK(OPA_LINKDOWN_REASON_SMA_DISABLED);
                /*
                 * Don't send a reply if the response would be sent
                 * through the disabled port.
        psi->port_states.ledenable_offlinereason |=
                ppd->is_sm_config_started << 5;
        psi->port_states.ledenable_offlinereason |=
-               ppd->offline_disabled_reason & OPA_PI_MASK_OFFLINE_REASON;
+               ppd->offline_disabled_reason;
 #else
        psi->port_states.offline_reason = ppd->neighbor_normal << 4;
        psi->port_states.offline_reason |= ppd->is_sm_config_started << 5;
-       psi->port_states.offline_reason |= ppd->offline_disabled_reason &
-                               OPA_PI_MASK_OFFLINE_REASON;
+       psi->port_states.offline_reason |= ppd->offline_disabled_reason;
 #endif /* PI_LED_ENABLE_SUP */
 
        psi->port_states.portphysstate_portstate =