bnx2x: Link-flap avoidance in switch dependent mode
[pandora-kernel.git] / drivers / net / ethernet / broadcom / bnx2x / bnx2x_main.c
index b4c9dea..649880d 100644 (file)
@@ -9780,6 +9780,21 @@ static bool bnx2x_prev_is_path_marked(struct bnx2x *bp)
        return rc;
 }
 
+bool bnx2x_port_after_undi(struct bnx2x *bp)
+{
+       struct bnx2x_prev_path_list *entry;
+       bool val;
+
+       down(&bnx2x_prev_sem);
+
+       entry = bnx2x_prev_path_get_entry(bp);
+       val = !!(entry && (entry->undi & (1 << BP_PORT(bp))));
+
+       up(&bnx2x_prev_sem);
+
+       return val;
+}
+
 static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi)
 {
        struct bnx2x_prev_path_list *tmp_list;
@@ -10036,7 +10051,6 @@ static int bnx2x_prev_unload(struct bnx2x *bp)
 {
        int time_counter = 10;
        u32 rc, fw, hw_lock_reg, hw_lock_val;
-       struct bnx2x_prev_path_list *prev_list;
        BNX2X_DEV_INFO("Entering Previous Unload Flow\n");
 
        /* clear hw from errors which may have resulted from an interrupted
@@ -10107,8 +10121,7 @@ static int bnx2x_prev_unload(struct bnx2x *bp)
        }
 
        /* Mark function if its port was used to boot from SAN */
-       prev_list = bnx2x_prev_path_get_entry(bp);
-       if (prev_list && (prev_list->undi & (1 << BP_PORT(bp))))
+       if (bnx2x_port_after_undi(bp))
                bp->link_params.feature_config_flags |=
                        FEATURE_CONFIG_BOOT_FROM_SAN;