diff options
author | Joe Eykholt <jeykholt@cisco.com> | 2010-07-20 18:19:47 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-28 10:05:51 -0400 |
commit | fdb068c6cd6e30d43664f856d3530715a5742713 (patch) | |
tree | a500212cc66aee42c7a3659ff0cfecbfb9be6b18 | |
parent | f90377abcab2e305450ee76a0f9042907560c5d8 (diff) |
[SCSI] libfcoe: convert FIP to lock with mutex instead of spin lock
It turns out most of the FIP work is now done from worker threads
or process context now, so there's no need to use a spin lock.
Change to use mutex instead of spin lock and delayed_work instead
of a timer.
This will make it nicer for the VN_port to VN_port feature that
will interact more with the libfc layers requiring that
spinlocks not be held.
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.c | 116 | ||||
-rw-r--r-- | include/scsi/libfcoe.h | 9 |
2 files changed, 57 insertions, 68 deletions
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c index f009191063f1..e510888e78ca 100644 --- a/drivers/scsi/fcoe/libfcoe.c +++ b/drivers/scsi/fcoe/libfcoe.c | |||
@@ -113,7 +113,7 @@ void fcoe_ctlr_init(struct fcoe_ctlr *fip) | |||
113 | fip->state = FIP_ST_LINK_WAIT; | 113 | fip->state = FIP_ST_LINK_WAIT; |
114 | fip->mode = FIP_ST_AUTO; | 114 | fip->mode = FIP_ST_AUTO; |
115 | INIT_LIST_HEAD(&fip->fcfs); | 115 | INIT_LIST_HEAD(&fip->fcfs); |
116 | spin_lock_init(&fip->lock); | 116 | mutex_init(&fip->ctlr_mutex); |
117 | fip->flogi_oxid = FC_XID_UNKNOWN; | 117 | fip->flogi_oxid = FC_XID_UNKNOWN; |
118 | setup_timer(&fip->timer, fcoe_ctlr_timeout, (unsigned long)fip); | 118 | setup_timer(&fip->timer, fcoe_ctlr_timeout, (unsigned long)fip); |
119 | INIT_WORK(&fip->timer_work, fcoe_ctlr_timer_work); | 119 | INIT_WORK(&fip->timer_work, fcoe_ctlr_timer_work); |
@@ -159,10 +159,10 @@ void fcoe_ctlr_destroy(struct fcoe_ctlr *fip) | |||
159 | cancel_work_sync(&fip->recv_work); | 159 | cancel_work_sync(&fip->recv_work); |
160 | skb_queue_purge(&fip->fip_recv_list); | 160 | skb_queue_purge(&fip->fip_recv_list); |
161 | 161 | ||
162 | spin_lock_bh(&fip->lock); | 162 | mutex_lock(&fip->ctlr_mutex); |
163 | fip->state = FIP_ST_DISABLED; | 163 | fip->state = FIP_ST_DISABLED; |
164 | fcoe_ctlr_reset_fcfs(fip); | 164 | fcoe_ctlr_reset_fcfs(fip); |
165 | spin_unlock_bh(&fip->lock); | 165 | mutex_unlock(&fip->ctlr_mutex); |
166 | del_timer_sync(&fip->timer); | 166 | del_timer_sync(&fip->timer); |
167 | cancel_work_sync(&fip->timer_work); | 167 | cancel_work_sync(&fip->timer_work); |
168 | } | 168 | } |
@@ -255,19 +255,19 @@ static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf) | |||
255 | */ | 255 | */ |
256 | void fcoe_ctlr_link_up(struct fcoe_ctlr *fip) | 256 | void fcoe_ctlr_link_up(struct fcoe_ctlr *fip) |
257 | { | 257 | { |
258 | spin_lock_bh(&fip->lock); | 258 | mutex_lock(&fip->ctlr_mutex); |
259 | if (fip->state == FIP_ST_NON_FIP || fip->state == FIP_ST_AUTO) { | 259 | if (fip->state == FIP_ST_NON_FIP || fip->state == FIP_ST_AUTO) { |
260 | spin_unlock_bh(&fip->lock); | 260 | mutex_unlock(&fip->ctlr_mutex); |
261 | fc_linkup(fip->lp); | 261 | fc_linkup(fip->lp); |
262 | } else if (fip->state == FIP_ST_LINK_WAIT) { | 262 | } else if (fip->state == FIP_ST_LINK_WAIT) { |
263 | fip->state = fip->mode; | 263 | fip->state = fip->mode; |
264 | spin_unlock_bh(&fip->lock); | 264 | mutex_unlock(&fip->ctlr_mutex); |
265 | if (fip->state == FIP_ST_AUTO) | 265 | if (fip->state == FIP_ST_AUTO) |
266 | LIBFCOE_FIP_DBG(fip, "%s", "setting AUTO mode.\n"); | 266 | LIBFCOE_FIP_DBG(fip, "%s", "setting AUTO mode.\n"); |
267 | fc_linkup(fip->lp); | 267 | fc_linkup(fip->lp); |
268 | fcoe_ctlr_solicit(fip, NULL); | 268 | fcoe_ctlr_solicit(fip, NULL); |
269 | } else | 269 | } else |
270 | spin_unlock_bh(&fip->lock); | 270 | mutex_unlock(&fip->ctlr_mutex); |
271 | } | 271 | } |
272 | EXPORT_SYMBOL(fcoe_ctlr_link_up); | 272 | EXPORT_SYMBOL(fcoe_ctlr_link_up); |
273 | 273 | ||
@@ -300,11 +300,11 @@ int fcoe_ctlr_link_down(struct fcoe_ctlr *fip) | |||
300 | int link_dropped; | 300 | int link_dropped; |
301 | 301 | ||
302 | LIBFCOE_FIP_DBG(fip, "link down.\n"); | 302 | LIBFCOE_FIP_DBG(fip, "link down.\n"); |
303 | spin_lock_bh(&fip->lock); | 303 | mutex_lock(&fip->ctlr_mutex); |
304 | fcoe_ctlr_reset(fip); | 304 | fcoe_ctlr_reset(fip); |
305 | link_dropped = fip->state != FIP_ST_LINK_WAIT; | 305 | link_dropped = fip->state != FIP_ST_LINK_WAIT; |
306 | fip->state = FIP_ST_LINK_WAIT; | 306 | fip->state = FIP_ST_LINK_WAIT; |
307 | spin_unlock_bh(&fip->lock); | 307 | mutex_unlock(&fip->ctlr_mutex); |
308 | 308 | ||
309 | if (link_dropped) | 309 | if (link_dropped) |
310 | fc_linkdown(fip->lp); | 310 | fc_linkdown(fip->lp); |
@@ -577,12 +577,12 @@ static unsigned long fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip) | |||
577 | unsigned long sel_time = 0; | 577 | unsigned long sel_time = 0; |
578 | struct fcoe_dev_stats *stats; | 578 | struct fcoe_dev_stats *stats; |
579 | 579 | ||
580 | stats = per_cpu_ptr(fip->lp->dev_stats, get_cpu()); | ||
581 | |||
580 | list_for_each_entry_safe(fcf, next, &fip->fcfs, list) { | 582 | list_for_each_entry_safe(fcf, next, &fip->fcfs, list) { |
581 | deadline = fcf->time + fcf->fka_period + fcf->fka_period / 2; | 583 | deadline = fcf->time + fcf->fka_period + fcf->fka_period / 2; |
582 | if (fip->sel_fcf == fcf) { | 584 | if (fip->sel_fcf == fcf) { |
583 | if (time_after(jiffies, deadline)) { | 585 | if (time_after(jiffies, deadline)) { |
584 | stats = per_cpu_ptr(fip->lp->dev_stats, | ||
585 | smp_processor_id()); | ||
586 | stats->MissDiscAdvCount++; | 586 | stats->MissDiscAdvCount++; |
587 | printk(KERN_INFO "libfcoe: host%d: " | 587 | printk(KERN_INFO "libfcoe: host%d: " |
588 | "Missing Discovery Advertisement " | 588 | "Missing Discovery Advertisement " |
@@ -601,8 +601,6 @@ static unsigned long fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip) | |||
601 | WARN_ON(!fip->fcf_count); | 601 | WARN_ON(!fip->fcf_count); |
602 | fip->fcf_count--; | 602 | fip->fcf_count--; |
603 | kfree(fcf); | 603 | kfree(fcf); |
604 | stats = per_cpu_ptr(fip->lp->dev_stats, | ||
605 | smp_processor_id()); | ||
606 | stats->VLinkFailureCount++; | 604 | stats->VLinkFailureCount++; |
607 | } else { | 605 | } else { |
608 | if (time_after(next_timer, deadline)) | 606 | if (time_after(next_timer, deadline)) |
@@ -612,6 +610,7 @@ static unsigned long fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip) | |||
612 | sel_time = fcf->time; | 610 | sel_time = fcf->time; |
613 | } | 611 | } |
614 | } | 612 | } |
613 | put_cpu(); | ||
615 | if (sel_time && !fip->sel_fcf && !fip->sel_time) { | 614 | if (sel_time && !fip->sel_fcf && !fip->sel_time) { |
616 | sel_time += msecs_to_jiffies(FCOE_CTLR_START_DELAY); | 615 | sel_time += msecs_to_jiffies(FCOE_CTLR_START_DELAY); |
617 | fip->sel_time = sel_time; | 616 | fip->sel_time = sel_time; |
@@ -768,7 +767,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
768 | if (fcoe_ctlr_parse_adv(fip, skb, &new)) | 767 | if (fcoe_ctlr_parse_adv(fip, skb, &new)) |
769 | return; | 768 | return; |
770 | 769 | ||
771 | spin_lock_bh(&fip->lock); | 770 | mutex_lock(&fip->ctlr_mutex); |
772 | first = list_empty(&fip->fcfs); | 771 | first = list_empty(&fip->fcfs); |
773 | found = NULL; | 772 | found = NULL; |
774 | list_for_each_entry(fcf, &fip->fcfs, list) { | 773 | list_for_each_entry(fcf, &fip->fcfs, list) { |
@@ -847,7 +846,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
847 | mod_timer(&fip->timer, fip->sel_time); | 846 | mod_timer(&fip->timer, fip->sel_time); |
848 | } | 847 | } |
849 | out: | 848 | out: |
850 | spin_unlock_bh(&fip->lock); | 849 | mutex_unlock(&fip->ctlr_mutex); |
851 | } | 850 | } |
852 | 851 | ||
853 | /** | 852 | /** |
@@ -1108,11 +1107,12 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, | |||
1108 | if (is_vn_port) | 1107 | if (is_vn_port) |
1109 | fc_lport_reset(vn_port); | 1108 | fc_lport_reset(vn_port); |
1110 | else { | 1109 | else { |
1111 | spin_lock_bh(&fip->lock); | 1110 | mutex_lock(&fip->ctlr_mutex); |
1112 | per_cpu_ptr(lport->dev_stats, | 1111 | per_cpu_ptr(lport->dev_stats, |
1113 | smp_processor_id())->VLinkFailureCount++; | 1112 | get_cpu())->VLinkFailureCount++; |
1113 | put_cpu(); | ||
1114 | fcoe_ctlr_reset(fip); | 1114 | fcoe_ctlr_reset(fip); |
1115 | spin_unlock_bh(&fip->lock); | 1115 | mutex_unlock(&fip->ctlr_mutex); |
1116 | 1116 | ||
1117 | fc_lport_reset(fip->lp); | 1117 | fc_lport_reset(fip->lp); |
1118 | fcoe_ctlr_solicit(fip, NULL); | 1118 | fcoe_ctlr_solicit(fip, NULL); |
@@ -1166,7 +1166,7 @@ static int fcoe_ctlr_recv_handler(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
1166 | if (ntohs(fiph->fip_dl_len) * FIP_BPW + sizeof(*fiph) > skb->len) | 1166 | if (ntohs(fiph->fip_dl_len) * FIP_BPW + sizeof(*fiph) > skb->len) |
1167 | goto drop; | 1167 | goto drop; |
1168 | 1168 | ||
1169 | spin_lock_bh(&fip->lock); | 1169 | mutex_lock(&fip->ctlr_mutex); |
1170 | state = fip->state; | 1170 | state = fip->state; |
1171 | if (state == FIP_ST_AUTO) { | 1171 | if (state == FIP_ST_AUTO) { |
1172 | fip->map_dest = 0; | 1172 | fip->map_dest = 0; |
@@ -1174,7 +1174,7 @@ static int fcoe_ctlr_recv_handler(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
1174 | state = FIP_ST_ENABLED; | 1174 | state = FIP_ST_ENABLED; |
1175 | LIBFCOE_FIP_DBG(fip, "Using FIP mode\n"); | 1175 | LIBFCOE_FIP_DBG(fip, "Using FIP mode\n"); |
1176 | } | 1176 | } |
1177 | spin_unlock_bh(&fip->lock); | 1177 | mutex_unlock(&fip->ctlr_mutex); |
1178 | if (state != FIP_ST_ENABLED) | 1178 | if (state != FIP_ST_ENABLED) |
1179 | goto drop; | 1179 | goto drop; |
1180 | 1180 | ||
@@ -1240,19 +1240,38 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip) | |||
1240 | /** | 1240 | /** |
1241 | * fcoe_ctlr_timeout() - FIP timeout handler | 1241 | * fcoe_ctlr_timeout() - FIP timeout handler |
1242 | * @arg: The FCoE controller that timed out | 1242 | * @arg: The FCoE controller that timed out |
1243 | * | ||
1244 | * Ages FCFs. Triggers FCF selection if possible. Sends keep-alives. | ||
1245 | */ | 1243 | */ |
1246 | static void fcoe_ctlr_timeout(unsigned long arg) | 1244 | static void fcoe_ctlr_timeout(unsigned long arg) |
1247 | { | 1245 | { |
1248 | struct fcoe_ctlr *fip = (struct fcoe_ctlr *)arg; | 1246 | struct fcoe_ctlr *fip = (struct fcoe_ctlr *)arg; |
1247 | |||
1248 | schedule_work(&fip->timer_work); | ||
1249 | } | ||
1250 | |||
1251 | /** | ||
1252 | * fcoe_ctlr_timer_work() - Worker thread function for timer work | ||
1253 | * @work: Handle to a FCoE controller | ||
1254 | * | ||
1255 | * Ages FCFs. Triggers FCF selection if possible. | ||
1256 | * Sends keep-alives and resets. | ||
1257 | */ | ||
1258 | static void fcoe_ctlr_timer_work(struct work_struct *work) | ||
1259 | { | ||
1260 | struct fcoe_ctlr *fip; | ||
1261 | struct fc_lport *vport; | ||
1262 | u8 *mac; | ||
1263 | u8 reset = 0; | ||
1264 | u8 send_ctlr_ka = 0; | ||
1265 | u8 send_port_ka = 0; | ||
1249 | struct fcoe_fcf *sel; | 1266 | struct fcoe_fcf *sel; |
1250 | struct fcoe_fcf *fcf; | 1267 | struct fcoe_fcf *fcf; |
1251 | unsigned long next_timer; | 1268 | unsigned long next_timer; |
1252 | 1269 | ||
1253 | spin_lock_bh(&fip->lock); | 1270 | fip = container_of(work, struct fcoe_ctlr, timer_work); |
1271 | |||
1272 | mutex_lock(&fip->ctlr_mutex); | ||
1254 | if (fip->state == FIP_ST_DISABLED) { | 1273 | if (fip->state == FIP_ST_DISABLED) { |
1255 | spin_unlock_bh(&fip->lock); | 1274 | mutex_unlock(&fip->ctlr_mutex); |
1256 | return; | 1275 | return; |
1257 | } | 1276 | } |
1258 | 1277 | ||
@@ -1286,7 +1305,7 @@ static void fcoe_ctlr_timeout(unsigned long arg) | |||
1286 | "FIP Fibre-Channel Forwarder timed out. " | 1305 | "FIP Fibre-Channel Forwarder timed out. " |
1287 | "Starting FCF discovery.\n", | 1306 | "Starting FCF discovery.\n", |
1288 | fip->lp->host->host_no); | 1307 | fip->lp->host->host_no); |
1289 | fip->reset_req = 1; | 1308 | reset = 1; |
1290 | schedule_work(&fip->timer_work); | 1309 | schedule_work(&fip->timer_work); |
1291 | } | 1310 | } |
1292 | } | 1311 | } |
@@ -1294,7 +1313,7 @@ static void fcoe_ctlr_timeout(unsigned long arg) | |||
1294 | if (sel && !sel->fd_flags) { | 1313 | if (sel && !sel->fd_flags) { |
1295 | if (time_after_eq(jiffies, fip->ctlr_ka_time)) { | 1314 | if (time_after_eq(jiffies, fip->ctlr_ka_time)) { |
1296 | fip->ctlr_ka_time = jiffies + sel->fka_period; | 1315 | fip->ctlr_ka_time = jiffies + sel->fka_period; |
1297 | fip->send_ctlr_ka = 1; | 1316 | send_ctlr_ka = 1; |
1298 | } | 1317 | } |
1299 | if (time_after(next_timer, fip->ctlr_ka_time)) | 1318 | if (time_after(next_timer, fip->ctlr_ka_time)) |
1300 | next_timer = fip->ctlr_ka_time; | 1319 | next_timer = fip->ctlr_ka_time; |
@@ -1302,37 +1321,14 @@ static void fcoe_ctlr_timeout(unsigned long arg) | |||
1302 | if (time_after_eq(jiffies, fip->port_ka_time)) { | 1321 | if (time_after_eq(jiffies, fip->port_ka_time)) { |
1303 | fip->port_ka_time = jiffies + | 1322 | fip->port_ka_time = jiffies + |
1304 | msecs_to_jiffies(FIP_VN_KA_PERIOD); | 1323 | msecs_to_jiffies(FIP_VN_KA_PERIOD); |
1305 | fip->send_port_ka = 1; | 1324 | send_port_ka = 1; |
1306 | } | 1325 | } |
1307 | if (time_after(next_timer, fip->port_ka_time)) | 1326 | if (time_after(next_timer, fip->port_ka_time)) |
1308 | next_timer = fip->port_ka_time; | 1327 | next_timer = fip->port_ka_time; |
1309 | } | 1328 | } |
1310 | if (!list_empty(&fip->fcfs)) | 1329 | if (!list_empty(&fip->fcfs)) |
1311 | mod_timer(&fip->timer, next_timer); | 1330 | mod_timer(&fip->timer, next_timer); |
1312 | if (fip->send_ctlr_ka || fip->send_port_ka) | 1331 | mutex_unlock(&fip->ctlr_mutex); |
1313 | schedule_work(&fip->timer_work); | ||
1314 | spin_unlock_bh(&fip->lock); | ||
1315 | } | ||
1316 | |||
1317 | /** | ||
1318 | * fcoe_ctlr_timer_work() - Worker thread function for timer work | ||
1319 | * @work: Handle to a FCoE controller | ||
1320 | * | ||
1321 | * Sends keep-alives and resets which must not | ||
1322 | * be called from the timer directly, since they use a mutex. | ||
1323 | */ | ||
1324 | static void fcoe_ctlr_timer_work(struct work_struct *work) | ||
1325 | { | ||
1326 | struct fcoe_ctlr *fip; | ||
1327 | struct fc_lport *vport; | ||
1328 | u8 *mac; | ||
1329 | int reset; | ||
1330 | |||
1331 | fip = container_of(work, struct fcoe_ctlr, timer_work); | ||
1332 | spin_lock_bh(&fip->lock); | ||
1333 | reset = fip->reset_req; | ||
1334 | fip->reset_req = 0; | ||
1335 | spin_unlock_bh(&fip->lock); | ||
1336 | 1332 | ||
1337 | if (reset) { | 1333 | if (reset) { |
1338 | fc_lport_reset(fip->lp); | 1334 | fc_lport_reset(fip->lp); |
@@ -1340,12 +1336,10 @@ static void fcoe_ctlr_timer_work(struct work_struct *work) | |||
1340 | fcoe_ctlr_solicit(fip, NULL); | 1336 | fcoe_ctlr_solicit(fip, NULL); |
1341 | } | 1337 | } |
1342 | 1338 | ||
1343 | if (fip->send_ctlr_ka) { | 1339 | if (send_ctlr_ka) |
1344 | fip->send_ctlr_ka = 0; | ||
1345 | fcoe_ctlr_send_keep_alive(fip, NULL, 0, fip->ctl_src_addr); | 1340 | fcoe_ctlr_send_keep_alive(fip, NULL, 0, fip->ctl_src_addr); |
1346 | } | 1341 | |
1347 | if (fip->send_port_ka) { | 1342 | if (send_port_ka) { |
1348 | fip->send_port_ka = 0; | ||
1349 | mutex_lock(&fip->lp->lp_mutex); | 1343 | mutex_lock(&fip->lp->lp_mutex); |
1350 | mac = fip->get_src_addr(fip->lp); | 1344 | mac = fip->get_src_addr(fip->lp); |
1351 | fcoe_ctlr_send_keep_alive(fip, fip->lp, 1, mac); | 1345 | fcoe_ctlr_send_keep_alive(fip, fip->lp, 1, mac); |
@@ -1402,9 +1396,9 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport, | |||
1402 | if (op == ELS_LS_ACC && fh->fh_r_ctl == FC_RCTL_ELS_REP && | 1396 | if (op == ELS_LS_ACC && fh->fh_r_ctl == FC_RCTL_ELS_REP && |
1403 | fip->flogi_oxid == ntohs(fh->fh_ox_id)) { | 1397 | fip->flogi_oxid == ntohs(fh->fh_ox_id)) { |
1404 | 1398 | ||
1405 | spin_lock_bh(&fip->lock); | 1399 | mutex_lock(&fip->ctlr_mutex); |
1406 | if (fip->state != FIP_ST_AUTO && fip->state != FIP_ST_NON_FIP) { | 1400 | if (fip->state != FIP_ST_AUTO && fip->state != FIP_ST_NON_FIP) { |
1407 | spin_unlock_bh(&fip->lock); | 1401 | mutex_unlock(&fip->ctlr_mutex); |
1408 | return -EINVAL; | 1402 | return -EINVAL; |
1409 | } | 1403 | } |
1410 | fip->state = FIP_ST_NON_FIP; | 1404 | fip->state = FIP_ST_NON_FIP; |
@@ -1424,13 +1418,13 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport, | |||
1424 | fip->map_dest = 0; | 1418 | fip->map_dest = 0; |
1425 | } | 1419 | } |
1426 | fip->flogi_oxid = FC_XID_UNKNOWN; | 1420 | fip->flogi_oxid = FC_XID_UNKNOWN; |
1427 | spin_unlock_bh(&fip->lock); | 1421 | mutex_unlock(&fip->ctlr_mutex); |
1428 | fc_fcoe_set_mac(fr_cb(fp)->granted_mac, fh->fh_d_id); | 1422 | fc_fcoe_set_mac(fr_cb(fp)->granted_mac, fh->fh_d_id); |
1429 | } else if (op == ELS_FLOGI && fh->fh_r_ctl == FC_RCTL_ELS_REQ && sa) { | 1423 | } else if (op == ELS_FLOGI && fh->fh_r_ctl == FC_RCTL_ELS_REQ && sa) { |
1430 | /* | 1424 | /* |
1431 | * Save source MAC for point-to-point responses. | 1425 | * Save source MAC for point-to-point responses. |
1432 | */ | 1426 | */ |
1433 | spin_lock_bh(&fip->lock); | 1427 | mutex_lock(&fip->ctlr_mutex); |
1434 | if (fip->state == FIP_ST_AUTO || fip->state == FIP_ST_NON_FIP) { | 1428 | if (fip->state == FIP_ST_AUTO || fip->state == FIP_ST_NON_FIP) { |
1435 | memcpy(fip->dest_addr, sa, ETH_ALEN); | 1429 | memcpy(fip->dest_addr, sa, ETH_ALEN); |
1436 | fip->map_dest = 0; | 1430 | fip->map_dest = 0; |
@@ -1439,7 +1433,7 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport, | |||
1439 | "Setting non-FIP mode\n"); | 1433 | "Setting non-FIP mode\n"); |
1440 | fip->state = FIP_ST_NON_FIP; | 1434 | fip->state = FIP_ST_NON_FIP; |
1441 | } | 1435 | } |
1442 | spin_unlock_bh(&fip->lock); | 1436 | mutex_unlock(&fip->ctlr_mutex); |
1443 | } | 1437 | } |
1444 | return 0; | 1438 | return 0; |
1445 | } | 1439 | } |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 81aee1c4c2f3..7d18b500f2c1 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -75,14 +75,12 @@ enum fip_state { | |||
75 | * @flogi_count: number of FLOGI attempts in AUTO mode. | 75 | * @flogi_count: number of FLOGI attempts in AUTO mode. |
76 | * @map_dest: use the FC_MAP mode for destination MAC addresses. | 76 | * @map_dest: use the FC_MAP mode for destination MAC addresses. |
77 | * @spma: supports SPMA server-provided MACs mode | 77 | * @spma: supports SPMA server-provided MACs mode |
78 | * @send_ctlr_ka: need to send controller keep alive | ||
79 | * @send_port_ka: need to send port keep alives | ||
80 | * @dest_addr: MAC address of the selected FC forwarder. | 78 | * @dest_addr: MAC address of the selected FC forwarder. |
81 | * @ctl_src_addr: the native MAC address of our local port. | 79 | * @ctl_src_addr: the native MAC address of our local port. |
82 | * @send: LLD-supplied function to handle sending FIP Ethernet frames | 80 | * @send: LLD-supplied function to handle sending FIP Ethernet frames |
83 | * @update_mac: LLD-supplied function to handle changes to MAC addresses. | 81 | * @update_mac: LLD-supplied function to handle changes to MAC addresses. |
84 | * @get_src_addr: LLD-supplied function to supply a source MAC address. | 82 | * @get_src_addr: LLD-supplied function to supply a source MAC address. |
85 | * @lock: lock protecting this structure. | 83 | * @ctlr_mutex: lock protecting this structure. |
86 | * | 84 | * |
87 | * This structure is used by all FCoE drivers. It contains information | 85 | * This structure is used by all FCoE drivers. It contains information |
88 | * needed by all FCoE low-level drivers (LLDs) as well as internal state | 86 | * needed by all FCoE low-level drivers (LLDs) as well as internal state |
@@ -106,18 +104,15 @@ struct fcoe_ctlr { | |||
106 | u16 user_mfs; | 104 | u16 user_mfs; |
107 | u16 flogi_oxid; | 105 | u16 flogi_oxid; |
108 | u8 flogi_count; | 106 | u8 flogi_count; |
109 | u8 reset_req; | ||
110 | u8 map_dest; | 107 | u8 map_dest; |
111 | u8 spma; | 108 | u8 spma; |
112 | u8 send_ctlr_ka; | ||
113 | u8 send_port_ka; | ||
114 | u8 dest_addr[ETH_ALEN]; | 109 | u8 dest_addr[ETH_ALEN]; |
115 | u8 ctl_src_addr[ETH_ALEN]; | 110 | u8 ctl_src_addr[ETH_ALEN]; |
116 | 111 | ||
117 | void (*send)(struct fcoe_ctlr *, struct sk_buff *); | 112 | void (*send)(struct fcoe_ctlr *, struct sk_buff *); |
118 | void (*update_mac)(struct fc_lport *, u8 *addr); | 113 | void (*update_mac)(struct fc_lport *, u8 *addr); |
119 | u8 * (*get_src_addr)(struct fc_lport *); | 114 | u8 * (*get_src_addr)(struct fc_lport *); |
120 | spinlock_t lock; | 115 | struct mutex ctlr_mutex; |
121 | }; | 116 | }; |
122 | 117 | ||
123 | /** | 118 | /** |