Skip to content

Commit 69316ee

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[SCSI] libfcoe: update FIP FCF announcements
Move the announcement code to a separate function for reuse in a forthcoming patch. For messages regarding FCF timeout and selection, use the previously-announced FCF MAC address (dest_addr) in the fcoe_ctlr struct. Only print (announce) the FCF if it is new. Print MAC for timed-out or deselected FCFs. Signed-off-by: Joe Eykholt <[email protected]> Signed-off-by: Robert Love <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent b5fe5e9 commit 69316ee

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

drivers/scsi/fcoe/libfcoe.c

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,33 @@ void fcoe_ctlr_destroy(struct fcoe_ctlr *fip)
230230
}
231231
EXPORT_SYMBOL(fcoe_ctlr_destroy);
232232

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+
*/
239+
static 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+
233260
/**
234261
* fcoe_ctlr_fcoe_size() - Return the maximum FCoE size required for VN_Port
235262
* @fip: The FCoE controller to get the maximum FCoE size from
@@ -1420,24 +1447,15 @@ static void fcoe_ctlr_timer_work(struct work_struct *work)
14201447

14211448
if (sel != fcf) {
14221449
fcf = sel; /* the old FCF may have been freed */
1450+
fcoe_ctlr_announce(fip);
14231451
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;
14291452
fip->port_ka_time = jiffies +
14301453
msecs_to_jiffies(FIP_VN_KA_PERIOD);
14311454
fip->ctlr_ka_time = jiffies + sel->fka_period;
14321455
if (time_after(next_timer, fip->ctlr_ka_time))
14331456
next_timer = fip->ctlr_ka_time;
1434-
} 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);
1457+
} else
14391458
reset = 1;
1440-
}
14411459
}
14421460

14431461
if (sel && !sel->fd_flags) {

0 commit comments

Comments
 (0)