aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2010-06-11 19:44:15 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:01:47 -0400
commitd99ee45b7cb89803b79745dc3014ba64bfd02b7d (patch)
tree92b852881f8031946f914f081accbe9cd22ad51e
parent8690cb8359d8e9f8d7ca12791ef7ea32b709df8b (diff)
[SCSI] libfcoe: Use fka_period as periodic timeouts to age out fcf if
keep alives are disabled due to fd_flags set and also stop updating keep alive values in that case. Update select fcf time only if fcf is not already selected or select time is not already determined from parse adv, and then have select time cleared only once after fcf is selected. Changed deadline check to time_after_eq() from time_after() since now next timeout will be on exact 2.5 times FKA followed by first advertisement. Signed-off-by: Vasu Dev <vasu.dev@intel.com> 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>
-rw-r--r--drivers/scsi/fcoe/libfcoe.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 3ab3db39fc52..4893098b3d3f 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -594,7 +594,7 @@ static unsigned long fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip)
594 } 594 }
595 595
596 deadline += fcf->fka_period; 596 deadline += fcf->fka_period;
597 if (time_after(jiffies, deadline)) { 597 if (time_after_eq(jiffies, deadline)) {
598 if (fip->sel_fcf == fcf) 598 if (fip->sel_fcf == fcf)
599 fip->sel_fcf = NULL; 599 fip->sel_fcf = NULL;
600 list_del(&fcf->list); 600 list_del(&fcf->list);
@@ -612,12 +612,11 @@ static unsigned long fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip)
612 sel_time = fcf->time; 612 sel_time = fcf->time;
613 } 613 }
614 } 614 }
615 if (sel_time) { 615 if (sel_time && !fip->sel_fcf && !fip->sel_time) {
616 sel_time += msecs_to_jiffies(FCOE_CTLR_START_DELAY); 616 sel_time += msecs_to_jiffies(FCOE_CTLR_START_DELAY);
617 fip->sel_time = sel_time; 617 fip->sel_time = sel_time;
618 } else {
619 fip->sel_time = 0;
620 } 618 }
619
621 return next_timer; 620 return next_timer;
622} 621}
623 622
@@ -775,7 +774,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb)
775 * ignored after a usable solicited advertisement 774 * ignored after a usable solicited advertisement
776 * has been received. 775 * has been received.
777 */ 776 */
778 if (fcf == fip->sel_fcf) { 777 if (fcf == fip->sel_fcf && !fcf->fd_flags) {
779 fip->ctlr_ka_time -= fcf->fka_period; 778 fip->ctlr_ka_time -= fcf->fka_period;
780 fip->ctlr_ka_time += new.fka_period; 779 fip->ctlr_ka_time += new.fka_period;
781 if (time_before(fip->ctlr_ka_time, fip->timer.expires)) 780 if (time_before(fip->ctlr_ka_time, fip->timer.expires))
@@ -813,7 +812,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb)
813 * If this is the first validated FCF, note the time and 812 * If this is the first validated FCF, note the time and
814 * set a timer to trigger selection. 813 * set a timer to trigger selection.
815 */ 814 */
816 if (mtu_valid && !fip->sel_time && fcoe_ctlr_fcf_usable(fcf)) { 815 if (mtu_valid && !fip->sel_fcf && fcoe_ctlr_fcf_usable(fcf)) {
817 fip->sel_time = jiffies + 816 fip->sel_time = jiffies +
818 msecs_to_jiffies(FCOE_CTLR_START_DELAY); 817 msecs_to_jiffies(FCOE_CTLR_START_DELAY);
819 if (!timer_pending(&fip->timer) || 818 if (!timer_pending(&fip->timer) ||
@@ -1187,6 +1186,8 @@ static void fcoe_ctlr_timeout(unsigned long arg)
1187 fip->port_ka_time = jiffies + 1186 fip->port_ka_time = jiffies +
1188 msecs_to_jiffies(FIP_VN_KA_PERIOD); 1187 msecs_to_jiffies(FIP_VN_KA_PERIOD);
1189 fip->ctlr_ka_time = jiffies + sel->fka_period; 1188 fip->ctlr_ka_time = jiffies + sel->fka_period;
1189 if (time_after(next_timer, fip->ctlr_ka_time))
1190 next_timer = fip->ctlr_ka_time;
1190 } else { 1191 } else {
1191 printk(KERN_NOTICE "libfcoe: host%d: " 1192 printk(KERN_NOTICE "libfcoe: host%d: "
1192 "FIP Fibre-Channel Forwarder timed out. " 1193 "FIP Fibre-Channel Forwarder timed out. "