aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/fcoe/libfcoe.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 58ad3c7a454f..26381f00e4e5 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -231,6 +231,33 @@ void fcoe_ctlr_destroy(struct fcoe_ctlr *fip)
231EXPORT_SYMBOL(fcoe_ctlr_destroy); 231EXPORT_SYMBOL(fcoe_ctlr_destroy);
232 232
233/** 233/**
234 * fcoe_ctlr_announce() - announce new selection
235 * @fip: The FCoE controller
236 *
237 * Also sets the destination MAC for FCoE and control packets
238 */
239static void fcoe_ctlr_announce(struct fcoe_ctlr *fip)
240{
241 struct fcoe_fcf *sel = fip->sel_fcf;
242
243 if (sel && !compare_ether_addr(sel->fcf_mac, fip->dest_addr))
244 return;
245 if (!is_zero_ether_addr(fip->dest_addr)) {
246 printk(KERN_NOTICE "libfcoe: host%d: "
247 "FIP Fibre-Channel Forwarder MAC %pM deselected\n",
248 fip->lp->host->host_no, fip->dest_addr);
249 memset(fip->dest_addr, 0, ETH_ALEN);
250 }
251 if (sel) {
252 printk(KERN_INFO "libfcoe: host%d: FIP selected "
253 "Fibre-Channel Forwarder MAC %pM\n",
254 fip->lp->host->host_no, sel->fcf_mac);
255 memcpy(fip->dest_addr, sel->fcf_mac, ETH_ALEN);
256 fip->map_dest = 0;
257 }
258}
259
260/**
234 * fcoe_ctlr_fcoe_size() - Return the maximum FCoE size required for VN_Port 261 * fcoe_ctlr_fcoe_size() - Return the maximum FCoE size required for VN_Port
235 * @fip: The FCoE controller to get the maximum FCoE size from 262 * @fip: The FCoE controller to get the maximum FCoE size from
236 * 263 *
@@ -1420,24 +1447,15 @@ static void fcoe_ctlr_timer_work(struct work_struct *work)
1420 1447
1421 if (sel != fcf) { 1448 if (sel != fcf) {
1422 fcf = sel; /* the old FCF may have been freed */ 1449 fcf = sel; /* the old FCF may have been freed */
1450 fcoe_ctlr_announce(fip);
1423 if (sel) { 1451 if (sel) {
1424 printk(KERN_INFO "libfcoe: host%d: FIP selected "
1425 "Fibre-Channel Forwarder MAC %pM\n",
1426 fip->lp->host->host_no, sel->fcf_mac);
1427 memcpy(fip->dest_addr, sel->fcf_mac, ETH_ALEN);
1428 fip->map_dest = 0;
1429 fip->port_ka_time = jiffies + 1452 fip->port_ka_time = jiffies +
1430 msecs_to_jiffies(FIP_VN_KA_PERIOD); 1453 msecs_to_jiffies(FIP_VN_KA_PERIOD);
1431 fip->ctlr_ka_time = jiffies + sel->fka_period; 1454 fip->ctlr_ka_time = jiffies + sel->fka_period;
1432 if (time_after(next_timer, fip->ctlr_ka_time)) 1455 if (time_after(next_timer, fip->ctlr_ka_time))
1433 next_timer = fip->ctlr_ka_time; 1456 next_timer = fip->ctlr_ka_time;
1434 } else { 1457 } else
1435 printk(KERN_NOTICE "libfcoe: host%d: "
1436 "FIP Fibre-Channel Forwarder timed out. "
1437 "Starting FCF discovery.\n",
1438 fip->lp->host->host_no);
1439 reset = 1; 1458 reset = 1;
1440 }
1441 } 1459 }
1442 1460
1443 if (sel && !sel->fd_flags) { 1461 if (sel && !sel->fd_flags) {