]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[SCSI] libfcoe: move some timer code to make it reusable.
authorJoe Eykholt <jeykholt@cisco.com>
Wed, 1 Dec 2010 00:19:46 +0000 (16:19 -0800)
committerJames Bottomley <James.Bottomley@suse.de>
Tue, 21 Dec 2010 18:24:29 +0000 (12:24 -0600)
Move some of the code in fcoe_ctlr_timer_work() to
fcoe_ctlr_select() so that it can be shared
with another function in a forthcoming patch.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/fcoe/libfcoe.c

index 26381f00e4e5350084d3de1641c4af1874c618fa..4d0be20cb73d23d50e3cdaae4b80c86f46bfda57 100644 (file)
@@ -1391,6 +1391,13 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip)
                        best = fcf;
        }
        fip->sel_fcf = best;
+       if (best) {
+               fip->port_ka_time = jiffies +
+                       msecs_to_jiffies(FIP_VN_KA_PERIOD);
+               fip->ctlr_ka_time = jiffies + best->fka_period;
+               if (time_before(fip->ctlr_ka_time, fip->timer.expires))
+                       mod_timer(&fip->timer, fip->ctlr_ka_time);
+       }
 }
 
 /**
@@ -1449,9 +1456,6 @@ static void fcoe_ctlr_timer_work(struct work_struct *work)
                fcf = sel;              /* the old FCF may have been freed */
                fcoe_ctlr_announce(fip);
                if (sel) {
-                       fip->port_ka_time = jiffies +
-                               msecs_to_jiffies(FIP_VN_KA_PERIOD);
-                       fip->ctlr_ka_time = jiffies + sel->fka_period;
                        if (time_after(next_timer, fip->ctlr_ka_time))
                                next_timer = fip->ctlr_ka_time;
                } else