.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. |
---|
3 | 4 | * Copyright (c) 2009 Intel Corporation. All rights reserved. |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify it |
---|
6 | | - * under the terms and conditions of the GNU General Public License, |
---|
7 | | - * version 2, as published by the Free Software Foundation. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
---|
10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
12 | | - * more details. |
---|
13 | | - * |
---|
14 | | - * You should have received a copy of the GNU General Public License along with |
---|
15 | | - * this program; if not, write to the Free Software Foundation, Inc., |
---|
16 | | - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
---|
17 | 5 | * |
---|
18 | 6 | * Maintained at www.Open-FCoE.org |
---|
19 | 7 | */ |
---|
.. | .. |
---|
146 | 134 | /** |
---|
147 | 135 | * fcoe_ctlr_init() - Initialize the FCoE Controller instance |
---|
148 | 136 | * @fip: The FCoE controller to initialize |
---|
| 137 | + * @mode: FIP mode to set |
---|
149 | 138 | */ |
---|
150 | 139 | void fcoe_ctlr_init(struct fcoe_ctlr *fip, enum fip_mode mode) |
---|
151 | 140 | { |
---|
.. | .. |
---|
330 | 319 | { |
---|
331 | 320 | struct fcoe_fcf *sel; |
---|
332 | 321 | struct fcoe_fcf *fcf; |
---|
| 322 | + unsigned long flags; |
---|
333 | 323 | |
---|
334 | 324 | mutex_lock(&fip->ctlr_mutex); |
---|
335 | | - spin_lock_bh(&fip->ctlr_lock); |
---|
| 325 | + spin_lock_irqsave(&fip->ctlr_lock, flags); |
---|
336 | 326 | |
---|
337 | 327 | kfree_skb(fip->flogi_req); |
---|
338 | 328 | fip->flogi_req = NULL; |
---|
339 | 329 | list_for_each_entry(fcf, &fip->fcfs, list) |
---|
340 | 330 | fcf->flogi_sent = 0; |
---|
341 | 331 | |
---|
342 | | - spin_unlock_bh(&fip->ctlr_lock); |
---|
| 332 | + spin_unlock_irqrestore(&fip->ctlr_lock, flags); |
---|
343 | 333 | sel = fip->sel_fcf; |
---|
344 | 334 | |
---|
345 | 335 | if (sel && ether_addr_equal(sel->fcf_mac, fip->dest_addr)) |
---|
.. | .. |
---|
348 | 338 | printk(KERN_NOTICE "libfcoe: host%d: " |
---|
349 | 339 | "FIP Fibre-Channel Forwarder MAC %pM deselected\n", |
---|
350 | 340 | fip->lp->host->host_no, fip->dest_addr); |
---|
351 | | - memset(fip->dest_addr, 0, ETH_ALEN); |
---|
| 341 | + eth_zero_addr(fip->dest_addr); |
---|
352 | 342 | } |
---|
353 | 343 | if (sel) { |
---|
354 | 344 | printk(KERN_INFO "libfcoe: host%d: FIP selected " |
---|
.. | .. |
---|
461 | 451 | switch (fip->mode) { |
---|
462 | 452 | default: |
---|
463 | 453 | LIBFCOE_FIP_DBG(fip, "invalid mode %d\n", fip->mode); |
---|
464 | | - /* fall-through */ |
---|
| 454 | + fallthrough; |
---|
465 | 455 | case FIP_MODE_AUTO: |
---|
466 | 456 | LIBFCOE_FIP_DBG(fip, "%s", "setting AUTO mode.\n"); |
---|
467 | | - /* fall-through */ |
---|
| 457 | + fallthrough; |
---|
468 | 458 | case FIP_MODE_FABRIC: |
---|
469 | 459 | case FIP_MODE_NON_FIP: |
---|
470 | 460 | mutex_unlock(&fip->ctlr_mutex); |
---|
.. | .. |
---|
599 | 589 | /** |
---|
600 | 590 | * fcoe_ctlr_encaps() - Encapsulate an ELS frame for FIP, without sending it |
---|
601 | 591 | * @fip: The FCoE controller for the ELS frame |
---|
| 592 | + * @lport: The local port |
---|
602 | 593 | * @dtype: The FIP descriptor type for the frame |
---|
603 | 594 | * @skb: The FCoE ELS frame including FC header but no FCoE headers |
---|
604 | 595 | * @d_id: The destination port ID. |
---|
.. | .. |
---|
709 | 700 | { |
---|
710 | 701 | struct fc_frame *fp; |
---|
711 | 702 | struct fc_frame_header *fh; |
---|
| 703 | + unsigned long flags; |
---|
712 | 704 | u16 old_xid; |
---|
713 | 705 | u8 op; |
---|
714 | 706 | u8 mac[ETH_ALEN]; |
---|
.. | .. |
---|
742 | 734 | op = FIP_DT_FLOGI; |
---|
743 | 735 | if (fip->mode == FIP_MODE_VN2VN) |
---|
744 | 736 | break; |
---|
745 | | - spin_lock_bh(&fip->ctlr_lock); |
---|
| 737 | + spin_lock_irqsave(&fip->ctlr_lock, flags); |
---|
746 | 738 | kfree_skb(fip->flogi_req); |
---|
747 | 739 | fip->flogi_req = skb; |
---|
748 | 740 | fip->flogi_req_send = 1; |
---|
749 | | - spin_unlock_bh(&fip->ctlr_lock); |
---|
| 741 | + spin_unlock_irqrestore(&fip->ctlr_lock, flags); |
---|
750 | 742 | schedule_work(&fip->timer_work); |
---|
751 | 743 | return -EINPROGRESS; |
---|
752 | 744 | case ELS_FDISC: |
---|
.. | .. |
---|
783 | 775 | fc_fcoe_set_mac(mac, fh->fh_d_id); |
---|
784 | 776 | fip->update_mac(lport, mac); |
---|
785 | 777 | } |
---|
786 | | - /* fall through */ |
---|
| 778 | + fallthrough; |
---|
787 | 779 | case ELS_LS_RJT: |
---|
788 | 780 | op = fr_encaps(fp); |
---|
789 | 781 | if (op) |
---|
.. | .. |
---|
838 | 830 | |
---|
839 | 831 | INIT_LIST_HEAD(&del_list); |
---|
840 | 832 | |
---|
841 | | - stats = per_cpu_ptr(fip->lp->stats, get_cpu_light()); |
---|
| 833 | + stats = per_cpu_ptr(fip->lp->stats, get_cpu()); |
---|
842 | 834 | |
---|
843 | 835 | list_for_each_entry_safe(fcf, next, &fip->fcfs, list) { |
---|
844 | 836 | deadline = fcf->time + fcf->fka_period + fcf->fka_period / 2; |
---|
.. | .. |
---|
874 | 866 | sel_time = fcf->time; |
---|
875 | 867 | } |
---|
876 | 868 | } |
---|
877 | | - put_cpu_light(); |
---|
| 869 | + put_cpu(); |
---|
878 | 870 | |
---|
879 | 871 | list_for_each_entry_safe(fcf, next, &del_list, list) { |
---|
880 | 872 | /* Removes fcf from current list */ |
---|
.. | .. |
---|
1031 | 1023 | { |
---|
1032 | 1024 | struct fcoe_fcf *fcf; |
---|
1033 | 1025 | struct fcoe_fcf new; |
---|
1034 | | - unsigned long sol_tov = msecs_to_jiffies(FCOE_CTRL_SOL_TOV); |
---|
| 1026 | + unsigned long sol_tov = msecs_to_jiffies(FCOE_CTLR_SOL_TOV); |
---|
1035 | 1027 | int first = 0; |
---|
1036 | 1028 | int mtu_valid; |
---|
1037 | 1029 | int found = 0; |
---|
.. | .. |
---|
1314 | 1306 | /** |
---|
1315 | 1307 | * fcoe_ctlr_recv_els() - Handle an incoming link reset frame |
---|
1316 | 1308 | * @fip: The FCoE controller that received the frame |
---|
1317 | | - * @fh: The received FIP header |
---|
| 1309 | + * @skb: The received FIP packet |
---|
1318 | 1310 | * |
---|
1319 | 1311 | * There may be multiple VN_Port descriptors. |
---|
1320 | 1312 | * The overall length has already been checked. |
---|
.. | .. |
---|
1723 | 1715 | static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip) |
---|
1724 | 1716 | { |
---|
1725 | 1717 | struct fcoe_fcf *fcf; |
---|
| 1718 | + unsigned long flags; |
---|
1726 | 1719 | int error; |
---|
1727 | 1720 | |
---|
1728 | 1721 | mutex_lock(&fip->ctlr_mutex); |
---|
1729 | | - spin_lock_bh(&fip->ctlr_lock); |
---|
| 1722 | + spin_lock_irqsave(&fip->ctlr_lock, flags); |
---|
1730 | 1723 | LIBFCOE_FIP_DBG(fip, "re-sending FLOGI - reselect\n"); |
---|
1731 | 1724 | fcf = fcoe_ctlr_select(fip); |
---|
1732 | 1725 | if (!fcf || fcf->flogi_sent) { |
---|
.. | .. |
---|
1737 | 1730 | fcoe_ctlr_solicit(fip, NULL); |
---|
1738 | 1731 | error = fcoe_ctlr_flogi_send_locked(fip); |
---|
1739 | 1732 | } |
---|
1740 | | - spin_unlock_bh(&fip->ctlr_lock); |
---|
| 1733 | + spin_unlock_irqrestore(&fip->ctlr_lock, flags); |
---|
1741 | 1734 | mutex_unlock(&fip->ctlr_mutex); |
---|
1742 | 1735 | return error; |
---|
1743 | 1736 | } |
---|
.. | .. |
---|
1754 | 1747 | static void fcoe_ctlr_flogi_send(struct fcoe_ctlr *fip) |
---|
1755 | 1748 | { |
---|
1756 | 1749 | struct fcoe_fcf *fcf; |
---|
| 1750 | + unsigned long flags; |
---|
1757 | 1751 | |
---|
1758 | | - spin_lock_bh(&fip->ctlr_lock); |
---|
| 1752 | + spin_lock_irqsave(&fip->ctlr_lock, flags); |
---|
1759 | 1753 | fcf = fip->sel_fcf; |
---|
1760 | 1754 | if (!fcf || !fip->flogi_req_send) |
---|
1761 | 1755 | goto unlock; |
---|
.. | .. |
---|
1782 | 1776 | } else /* XXX */ |
---|
1783 | 1777 | LIBFCOE_FIP_DBG(fip, "No FCF selected - defer send\n"); |
---|
1784 | 1778 | unlock: |
---|
1785 | | - spin_unlock_bh(&fip->ctlr_lock); |
---|
| 1779 | + spin_unlock_irqrestore(&fip->ctlr_lock, flags); |
---|
1786 | 1780 | } |
---|
1787 | 1781 | |
---|
1788 | 1782 | /** |
---|
1789 | 1783 | * fcoe_ctlr_timeout() - FIP timeout handler |
---|
1790 | | - * @arg: The FCoE controller that timed out |
---|
| 1784 | + * @t: Timer context use to obtain the controller reference |
---|
1791 | 1785 | */ |
---|
1792 | 1786 | static void fcoe_ctlr_timeout(struct timer_list *t) |
---|
1793 | 1787 | { |
---|
.. | .. |
---|
1899 | 1893 | /** |
---|
1900 | 1894 | * fcoe_ctlr_recv_flogi() - Snoop pre-FIP receipt of FLOGI response |
---|
1901 | 1895 | * @fip: The FCoE controller |
---|
| 1896 | + * @lport: The local port |
---|
1902 | 1897 | * @fp: The FC frame to snoop |
---|
1903 | 1898 | * |
---|
1904 | 1899 | * Snoop potential response to FLOGI or even incoming FLOGI. |
---|
.. | .. |
---|
1978 | 1973 | * |
---|
1979 | 1974 | * Returns: u64 fc world wide name |
---|
1980 | 1975 | */ |
---|
1981 | | -u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], |
---|
| 1976 | +u64 fcoe_wwn_from_mac(unsigned char mac[ETH_ALEN], |
---|
1982 | 1977 | unsigned int scheme, unsigned int port) |
---|
1983 | 1978 | { |
---|
1984 | 1979 | u64 wwn; |
---|
.. | .. |
---|
2170 | 2165 | |
---|
2171 | 2166 | /** |
---|
2172 | 2167 | * fcoe_ctlr_disc_stop_locked() - stop discovery in VN2VN mode |
---|
2173 | | - * @fip: The FCoE controller |
---|
| 2168 | + * @lport: The local port |
---|
2174 | 2169 | * |
---|
2175 | 2170 | * Called with ctlr_mutex held. |
---|
2176 | 2171 | */ |
---|
.. | .. |
---|
2191 | 2186 | |
---|
2192 | 2187 | /** |
---|
2193 | 2188 | * fcoe_ctlr_disc_stop() - stop discovery in VN2VN mode |
---|
2194 | | - * @fip: The FCoE controller |
---|
| 2189 | + * @lport: The local port |
---|
2195 | 2190 | * |
---|
2196 | 2191 | * Called through the local port template for discovery. |
---|
2197 | 2192 | * Called without the ctlr_mutex held. |
---|
.. | .. |
---|
2207 | 2202 | |
---|
2208 | 2203 | /** |
---|
2209 | 2204 | * fcoe_ctlr_disc_stop_final() - stop discovery for shutdown in VN2VN mode |
---|
2210 | | - * @fip: The FCoE controller |
---|
| 2205 | + * @lport: The local port |
---|
2211 | 2206 | * |
---|
2212 | 2207 | * Called through the local port template for discovery. |
---|
2213 | 2208 | * Called without the ctlr_mutex held. |
---|
.. | .. |
---|
2274 | 2269 | * fcoe_ctlr_vn_parse - parse probe request or response |
---|
2275 | 2270 | * @fip: The FCoE controller |
---|
2276 | 2271 | * @skb: incoming packet |
---|
2277 | | - * @rdata: buffer for resulting parsed VN entry plus fcoe_rport |
---|
| 2272 | + * @frport: parsed FCoE rport from the probe request |
---|
2278 | 2273 | * |
---|
2279 | 2274 | * Returns non-zero error number on error. |
---|
2280 | 2275 | * Does not consume the packet. |
---|
.. | .. |
---|
2413 | 2408 | /** |
---|
2414 | 2409 | * fcoe_ctlr_vn_probe_req() - handle incoming VN2VN probe request. |
---|
2415 | 2410 | * @fip: The FCoE controller |
---|
2416 | | - * @rdata: parsed remote port with frport from the probe request |
---|
| 2411 | + * @frport: parsed FCoE rport from the probe request |
---|
2417 | 2412 | * |
---|
2418 | 2413 | * Called with ctlr_mutex held. |
---|
2419 | 2414 | */ |
---|
2420 | 2415 | static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip, |
---|
2421 | | - struct fc_rport_priv *rdata) |
---|
| 2416 | + struct fcoe_rport *frport) |
---|
2422 | 2417 | { |
---|
2423 | | - struct fcoe_rport *frport = fcoe_ctlr_rport(rdata); |
---|
2424 | | - |
---|
2425 | | - if (rdata->ids.port_id != fip->port_id) |
---|
| 2418 | + if (frport->rdata.ids.port_id != fip->port_id) |
---|
2426 | 2419 | return; |
---|
2427 | 2420 | |
---|
2428 | 2421 | switch (fip->state) { |
---|
.. | .. |
---|
2442 | 2435 | * Probe's REC bit is not set. |
---|
2443 | 2436 | * If we don't reply, we will change our address. |
---|
2444 | 2437 | */ |
---|
2445 | | - if (fip->lp->wwpn > rdata->ids.port_name && |
---|
| 2438 | + if (fip->lp->wwpn > frport->rdata.ids.port_name && |
---|
2446 | 2439 | !(frport->flags & FIP_FL_REC_OR_P2P)) { |
---|
2447 | 2440 | LIBFCOE_FIP_DBG(fip, "vn_probe_req: " |
---|
2448 | 2441 | "port_id collision\n"); |
---|
.. | .. |
---|
2450 | 2443 | frport->enode_mac, 0); |
---|
2451 | 2444 | break; |
---|
2452 | 2445 | } |
---|
2453 | | - /* fall through */ |
---|
| 2446 | + fallthrough; |
---|
2454 | 2447 | case FIP_ST_VNMP_START: |
---|
2455 | 2448 | LIBFCOE_FIP_DBG(fip, "vn_probe_req: " |
---|
2456 | 2449 | "restart VN2VN negotiation\n"); |
---|
.. | .. |
---|
2466 | 2459 | /** |
---|
2467 | 2460 | * fcoe_ctlr_vn_probe_reply() - handle incoming VN2VN probe reply. |
---|
2468 | 2461 | * @fip: The FCoE controller |
---|
2469 | | - * @rdata: parsed remote port with frport from the probe request |
---|
| 2462 | + * @frport: parsed FCoE rport from the probe request |
---|
2470 | 2463 | * |
---|
2471 | 2464 | * Called with ctlr_mutex held. |
---|
2472 | 2465 | */ |
---|
2473 | 2466 | static void fcoe_ctlr_vn_probe_reply(struct fcoe_ctlr *fip, |
---|
2474 | | - struct fc_rport_priv *rdata) |
---|
| 2467 | + struct fcoe_rport *frport) |
---|
2475 | 2468 | { |
---|
2476 | | - if (rdata->ids.port_id != fip->port_id) |
---|
| 2469 | + if (frport->rdata.ids.port_id != fip->port_id) |
---|
2477 | 2470 | return; |
---|
2478 | 2471 | switch (fip->state) { |
---|
2479 | 2472 | case FIP_ST_VNMP_START: |
---|
.. | .. |
---|
2496 | 2489 | /** |
---|
2497 | 2490 | * fcoe_ctlr_vn_add() - Add a VN2VN entry to the list, based on a claim reply. |
---|
2498 | 2491 | * @fip: The FCoE controller |
---|
2499 | | - * @new: newly-parsed remote port with frport as a template for new rdata |
---|
| 2492 | + * @new: newly-parsed FCoE rport as a template for new rdata |
---|
2500 | 2493 | * |
---|
2501 | 2494 | * Called with ctlr_mutex held. |
---|
2502 | 2495 | */ |
---|
2503 | | -static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) |
---|
| 2496 | +static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fcoe_rport *new) |
---|
2504 | 2497 | { |
---|
2505 | 2498 | struct fc_lport *lport = fip->lp; |
---|
2506 | 2499 | struct fc_rport_priv *rdata; |
---|
.. | .. |
---|
2508 | 2501 | struct fcoe_rport *frport; |
---|
2509 | 2502 | u32 port_id; |
---|
2510 | 2503 | |
---|
2511 | | - port_id = new->ids.port_id; |
---|
| 2504 | + port_id = new->rdata.ids.port_id; |
---|
2512 | 2505 | if (port_id == fip->port_id) |
---|
2513 | 2506 | return; |
---|
2514 | 2507 | |
---|
.. | .. |
---|
2525 | 2518 | rdata->disc_id = lport->disc.disc_id; |
---|
2526 | 2519 | |
---|
2527 | 2520 | ids = &rdata->ids; |
---|
2528 | | - if ((ids->port_name != -1 && ids->port_name != new->ids.port_name) || |
---|
2529 | | - (ids->node_name != -1 && ids->node_name != new->ids.node_name)) { |
---|
| 2521 | + if ((ids->port_name != -1 && |
---|
| 2522 | + ids->port_name != new->rdata.ids.port_name) || |
---|
| 2523 | + (ids->node_name != -1 && |
---|
| 2524 | + ids->node_name != new->rdata.ids.node_name)) { |
---|
2530 | 2525 | mutex_unlock(&rdata->rp_mutex); |
---|
2531 | 2526 | LIBFCOE_FIP_DBG(fip, "vn_add rport logoff %6.6x\n", port_id); |
---|
2532 | 2527 | fc_rport_logoff(rdata); |
---|
2533 | 2528 | mutex_lock(&rdata->rp_mutex); |
---|
2534 | 2529 | } |
---|
2535 | | - ids->port_name = new->ids.port_name; |
---|
2536 | | - ids->node_name = new->ids.node_name; |
---|
| 2530 | + ids->port_name = new->rdata.ids.port_name; |
---|
| 2531 | + ids->node_name = new->rdata.ids.node_name; |
---|
2537 | 2532 | mutex_unlock(&rdata->rp_mutex); |
---|
2538 | 2533 | |
---|
2539 | 2534 | frport = fcoe_ctlr_rport(rdata); |
---|
2540 | 2535 | LIBFCOE_FIP_DBG(fip, "vn_add rport %6.6x %s state %d\n", |
---|
2541 | 2536 | port_id, frport->fcoe_len ? "old" : "new", |
---|
2542 | 2537 | rdata->rp_state); |
---|
2543 | | - *frport = *fcoe_ctlr_rport(new); |
---|
| 2538 | + frport->fcoe_len = new->fcoe_len; |
---|
| 2539 | + frport->flags = new->flags; |
---|
| 2540 | + frport->login_count = new->login_count; |
---|
| 2541 | + memcpy(frport->enode_mac, new->enode_mac, ETH_ALEN); |
---|
| 2542 | + memcpy(frport->vn_mac, new->vn_mac, ETH_ALEN); |
---|
2544 | 2543 | frport->time = 0; |
---|
2545 | 2544 | } |
---|
2546 | 2545 | |
---|
.. | .. |
---|
2572 | 2571 | /** |
---|
2573 | 2572 | * fcoe_ctlr_vn_claim_notify() - handle received FIP VN2VN Claim Notification |
---|
2574 | 2573 | * @fip: The FCoE controller |
---|
2575 | | - * @new: newly-parsed remote port with frport as a template for new rdata |
---|
| 2574 | + * @new: newly-parsed FCoE rport as a template for new rdata |
---|
2576 | 2575 | * |
---|
2577 | 2576 | * Called with ctlr_mutex held. |
---|
2578 | 2577 | */ |
---|
2579 | 2578 | static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, |
---|
2580 | | - struct fc_rport_priv *new) |
---|
| 2579 | + struct fcoe_rport *new) |
---|
2581 | 2580 | { |
---|
2582 | | - struct fcoe_rport *frport = fcoe_ctlr_rport(new); |
---|
2583 | | - |
---|
2584 | | - if (frport->flags & FIP_FL_REC_OR_P2P) { |
---|
| 2581 | + if (new->flags & FIP_FL_REC_OR_P2P) { |
---|
2585 | 2582 | LIBFCOE_FIP_DBG(fip, "send probe req for P2P/REC\n"); |
---|
2586 | 2583 | fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0); |
---|
2587 | 2584 | return; |
---|
.. | .. |
---|
2590 | 2587 | case FIP_ST_VNMP_START: |
---|
2591 | 2588 | case FIP_ST_VNMP_PROBE1: |
---|
2592 | 2589 | case FIP_ST_VNMP_PROBE2: |
---|
2593 | | - if (new->ids.port_id == fip->port_id) { |
---|
| 2590 | + if (new->rdata.ids.port_id == fip->port_id) { |
---|
2594 | 2591 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " |
---|
2595 | 2592 | "restart, state %d\n", |
---|
2596 | 2593 | fip->state); |
---|
.. | .. |
---|
2599 | 2596 | break; |
---|
2600 | 2597 | case FIP_ST_VNMP_CLAIM: |
---|
2601 | 2598 | case FIP_ST_VNMP_UP: |
---|
2602 | | - if (new->ids.port_id == fip->port_id) { |
---|
2603 | | - if (new->ids.port_name > fip->lp->wwpn) { |
---|
| 2599 | + if (new->rdata.ids.port_id == fip->port_id) { |
---|
| 2600 | + if (new->rdata.ids.port_name > fip->lp->wwpn) { |
---|
2604 | 2601 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " |
---|
2605 | 2602 | "restart, port_id collision\n"); |
---|
2606 | 2603 | fcoe_ctlr_vn_restart(fip); |
---|
.. | .. |
---|
2612 | 2609 | break; |
---|
2613 | 2610 | } |
---|
2614 | 2611 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: send reply to %x\n", |
---|
2615 | | - new->ids.port_id); |
---|
2616 | | - fcoe_ctlr_vn_send(fip, FIP_SC_VN_CLAIM_REP, frport->enode_mac, |
---|
2617 | | - min((u32)frport->fcoe_len, |
---|
| 2612 | + new->rdata.ids.port_id); |
---|
| 2613 | + fcoe_ctlr_vn_send(fip, FIP_SC_VN_CLAIM_REP, new->enode_mac, |
---|
| 2614 | + min((u32)new->fcoe_len, |
---|
2618 | 2615 | fcoe_ctlr_fcoe_size(fip))); |
---|
2619 | 2616 | fcoe_ctlr_vn_add(fip, new); |
---|
2620 | 2617 | break; |
---|
2621 | 2618 | default: |
---|
2622 | 2619 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " |
---|
2623 | | - "ignoring claim from %x\n", new->ids.port_id); |
---|
| 2620 | + "ignoring claim from %x\n", |
---|
| 2621 | + new->rdata.ids.port_id); |
---|
2624 | 2622 | break; |
---|
2625 | 2623 | } |
---|
2626 | 2624 | } |
---|
.. | .. |
---|
2628 | 2626 | /** |
---|
2629 | 2627 | * fcoe_ctlr_vn_claim_resp() - handle received Claim Response |
---|
2630 | 2628 | * @fip: The FCoE controller that received the frame |
---|
2631 | | - * @new: newly-parsed remote port with frport from the Claim Response |
---|
| 2629 | + * @new: newly-parsed FCoE rport from the Claim Response |
---|
2632 | 2630 | * |
---|
2633 | 2631 | * Called with ctlr_mutex held. |
---|
2634 | 2632 | */ |
---|
2635 | 2633 | static void fcoe_ctlr_vn_claim_resp(struct fcoe_ctlr *fip, |
---|
2636 | | - struct fc_rport_priv *new) |
---|
| 2634 | + struct fcoe_rport *new) |
---|
2637 | 2635 | { |
---|
2638 | 2636 | LIBFCOE_FIP_DBG(fip, "claim resp from from rport %x - state %s\n", |
---|
2639 | | - new->ids.port_id, fcoe_ctlr_state(fip->state)); |
---|
| 2637 | + new->rdata.ids.port_id, fcoe_ctlr_state(fip->state)); |
---|
2640 | 2638 | if (fip->state == FIP_ST_VNMP_UP || fip->state == FIP_ST_VNMP_CLAIM) |
---|
2641 | 2639 | fcoe_ctlr_vn_add(fip, new); |
---|
2642 | 2640 | } |
---|
.. | .. |
---|
2644 | 2642 | /** |
---|
2645 | 2643 | * fcoe_ctlr_vn_beacon() - handle received beacon. |
---|
2646 | 2644 | * @fip: The FCoE controller that received the frame |
---|
2647 | | - * @new: newly-parsed remote port with frport from the Beacon |
---|
| 2645 | + * @new: newly-parsed FCoE rport from the Beacon |
---|
2648 | 2646 | * |
---|
2649 | 2647 | * Called with ctlr_mutex held. |
---|
2650 | 2648 | */ |
---|
2651 | 2649 | static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip, |
---|
2652 | | - struct fc_rport_priv *new) |
---|
| 2650 | + struct fcoe_rport *new) |
---|
2653 | 2651 | { |
---|
2654 | 2652 | struct fc_lport *lport = fip->lp; |
---|
2655 | 2653 | struct fc_rport_priv *rdata; |
---|
2656 | 2654 | struct fcoe_rport *frport; |
---|
2657 | 2655 | |
---|
2658 | | - frport = fcoe_ctlr_rport(new); |
---|
2659 | | - if (frport->flags & FIP_FL_REC_OR_P2P) { |
---|
| 2656 | + if (new->flags & FIP_FL_REC_OR_P2P) { |
---|
2660 | 2657 | LIBFCOE_FIP_DBG(fip, "p2p beacon while in vn2vn mode\n"); |
---|
2661 | 2658 | fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0); |
---|
2662 | 2659 | return; |
---|
2663 | 2660 | } |
---|
2664 | | - rdata = fc_rport_lookup(lport, new->ids.port_id); |
---|
| 2661 | + rdata = fc_rport_lookup(lport, new->rdata.ids.port_id); |
---|
2665 | 2662 | if (rdata) { |
---|
2666 | | - if (rdata->ids.node_name == new->ids.node_name && |
---|
2667 | | - rdata->ids.port_name == new->ids.port_name) { |
---|
| 2663 | + if (rdata->ids.node_name == new->rdata.ids.node_name && |
---|
| 2664 | + rdata->ids.port_name == new->rdata.ids.port_name) { |
---|
2668 | 2665 | frport = fcoe_ctlr_rport(rdata); |
---|
| 2666 | + |
---|
2669 | 2667 | LIBFCOE_FIP_DBG(fip, "beacon from rport %x\n", |
---|
2670 | 2668 | rdata->ids.port_id); |
---|
2671 | 2669 | if (!frport->time && fip->state == FIP_ST_VNMP_UP) { |
---|
.. | .. |
---|
2688 | 2686 | * Don't add the neighbor yet. |
---|
2689 | 2687 | */ |
---|
2690 | 2688 | LIBFCOE_FIP_DBG(fip, "beacon from new rport %x. sending claim notify\n", |
---|
2691 | | - new->ids.port_id); |
---|
| 2689 | + new->rdata.ids.port_id); |
---|
2692 | 2690 | if (time_after(jiffies, |
---|
2693 | 2691 | fip->sol_time + msecs_to_jiffies(FIP_VN_ANN_WAIT))) |
---|
2694 | 2692 | fcoe_ctlr_vn_send_claim(fip); |
---|
.. | .. |
---|
2773 | 2771 | mutex_lock(&fip->ctlr_mutex); |
---|
2774 | 2772 | switch (sub) { |
---|
2775 | 2773 | case FIP_SC_VN_PROBE_REQ: |
---|
2776 | | - fcoe_ctlr_vn_probe_req(fip, &frport.rdata); |
---|
| 2774 | + fcoe_ctlr_vn_probe_req(fip, &frport); |
---|
2777 | 2775 | break; |
---|
2778 | 2776 | case FIP_SC_VN_PROBE_REP: |
---|
2779 | | - fcoe_ctlr_vn_probe_reply(fip, &frport.rdata); |
---|
| 2777 | + fcoe_ctlr_vn_probe_reply(fip, &frport); |
---|
2780 | 2778 | break; |
---|
2781 | 2779 | case FIP_SC_VN_CLAIM_NOTIFY: |
---|
2782 | | - fcoe_ctlr_vn_claim_notify(fip, &frport.rdata); |
---|
| 2780 | + fcoe_ctlr_vn_claim_notify(fip, &frport); |
---|
2783 | 2781 | break; |
---|
2784 | 2782 | case FIP_SC_VN_CLAIM_REP: |
---|
2785 | | - fcoe_ctlr_vn_claim_resp(fip, &frport.rdata); |
---|
| 2783 | + fcoe_ctlr_vn_claim_resp(fip, &frport); |
---|
2786 | 2784 | break; |
---|
2787 | 2785 | case FIP_SC_VN_BEACON: |
---|
2788 | | - fcoe_ctlr_vn_beacon(fip, &frport.rdata); |
---|
| 2786 | + fcoe_ctlr_vn_beacon(fip, &frport); |
---|
2789 | 2787 | break; |
---|
2790 | 2788 | default: |
---|
2791 | 2789 | LIBFCOE_FIP_DBG(fip, "vn_recv unknown subcode %d\n", sub); |
---|
.. | .. |
---|
2802 | 2800 | * fcoe_ctlr_vlan_parse - parse vlan discovery request or response |
---|
2803 | 2801 | * @fip: The FCoE controller |
---|
2804 | 2802 | * @skb: incoming packet |
---|
2805 | | - * @rdata: buffer for resulting parsed VLAN entry plus fcoe_rport |
---|
| 2803 | + * @frport: parsed FCoE rport from the probe request |
---|
2806 | 2804 | * |
---|
2807 | 2805 | * Returns non-zero error number on error. |
---|
2808 | 2806 | * Does not consume the packet. |
---|
.. | .. |
---|
2901 | 2899 | * @fip: The FCoE controller |
---|
2902 | 2900 | * @sub: sub-opcode for vlan notification or vn2vn vlan notification |
---|
2903 | 2901 | * @dest: The destination Ethernet MAC address |
---|
2904 | | - * @min_len: minimum size of the Ethernet payload to be sent |
---|
2905 | 2902 | */ |
---|
2906 | 2903 | static void fcoe_ctlr_vlan_send(struct fcoe_ctlr *fip, |
---|
2907 | 2904 | enum fip_vlan_subcode sub, |
---|
.. | .. |
---|
2961 | 2958 | /** |
---|
2962 | 2959 | * fcoe_ctlr_vlan_disk_reply() - send FIP VLAN Discovery Notification. |
---|
2963 | 2960 | * @fip: The FCoE controller |
---|
| 2961 | + * @frport: The newly-parsed FCoE rport from the Discovery Request |
---|
2964 | 2962 | * |
---|
2965 | 2963 | * Called with ctlr_mutex held. |
---|
2966 | 2964 | */ |
---|
2967 | 2965 | static void fcoe_ctlr_vlan_disc_reply(struct fcoe_ctlr *fip, |
---|
2968 | | - struct fc_rport_priv *rdata) |
---|
| 2966 | + struct fcoe_rport *frport) |
---|
2969 | 2967 | { |
---|
2970 | | - struct fcoe_rport *frport = fcoe_ctlr_rport(rdata); |
---|
2971 | 2968 | enum fip_vlan_subcode sub = FIP_SC_VL_NOTE; |
---|
2972 | 2969 | |
---|
2973 | 2970 | if (fip->mode == FIP_MODE_VN2VN) |
---|
.. | .. |
---|
2978 | 2975 | |
---|
2979 | 2976 | /** |
---|
2980 | 2977 | * fcoe_ctlr_vlan_recv - vlan request receive handler for VN2VN mode. |
---|
2981 | | - * @lport: The local port |
---|
2982 | | - * @fp: The received frame |
---|
2983 | | - * |
---|
| 2978 | + * @fip: The FCoE controller |
---|
| 2979 | + * @skb: The received FIP packet |
---|
2984 | 2980 | */ |
---|
2985 | 2981 | static int fcoe_ctlr_vlan_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) |
---|
2986 | 2982 | { |
---|
.. | .. |
---|
2998 | 2994 | } |
---|
2999 | 2995 | mutex_lock(&fip->ctlr_mutex); |
---|
3000 | 2996 | if (sub == FIP_SC_VL_REQ) |
---|
3001 | | - fcoe_ctlr_vlan_disc_reply(fip, &frport.rdata); |
---|
| 2997 | + fcoe_ctlr_vlan_disc_reply(fip, &frport); |
---|
3002 | 2998 | mutex_unlock(&fip->ctlr_mutex); |
---|
3003 | 2999 | |
---|
3004 | 3000 | drop: |
---|
.. | .. |
---|
3024 | 3020 | fc_frame_free(fp); |
---|
3025 | 3021 | } |
---|
3026 | 3022 | |
---|
3027 | | -/** |
---|
3028 | | - * fcoe_ctlr_disc_recv - start discovery for VN2VN mode. |
---|
3029 | | - * @fip: The FCoE controller |
---|
| 3023 | +/* |
---|
| 3024 | + * fcoe_ctlr_disc_start - start discovery for VN2VN mode. |
---|
3030 | 3025 | * |
---|
3031 | 3026 | * This sets a flag indicating that remote ports should be created |
---|
3032 | 3027 | * and started for the peers we discover. We use the disc_callback |
---|