| .. | .. |
|---|
| 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 | { |
|---|
| .. | .. |
|---|
| 348 | 337 | printk(KERN_NOTICE "libfcoe: host%d: " |
|---|
| 349 | 338 | "FIP Fibre-Channel Forwarder MAC %pM deselected\n", |
|---|
| 350 | 339 | fip->lp->host->host_no, fip->dest_addr); |
|---|
| 351 | | - memset(fip->dest_addr, 0, ETH_ALEN); |
|---|
| 340 | + eth_zero_addr(fip->dest_addr); |
|---|
| 352 | 341 | } |
|---|
| 353 | 342 | if (sel) { |
|---|
| 354 | 343 | printk(KERN_INFO "libfcoe: host%d: FIP selected " |
|---|
| .. | .. |
|---|
| 461 | 450 | switch (fip->mode) { |
|---|
| 462 | 451 | default: |
|---|
| 463 | 452 | LIBFCOE_FIP_DBG(fip, "invalid mode %d\n", fip->mode); |
|---|
| 464 | | - /* fall-through */ |
|---|
| 453 | + fallthrough; |
|---|
| 465 | 454 | case FIP_MODE_AUTO: |
|---|
| 466 | 455 | LIBFCOE_FIP_DBG(fip, "%s", "setting AUTO mode.\n"); |
|---|
| 467 | | - /* fall-through */ |
|---|
| 456 | + fallthrough; |
|---|
| 468 | 457 | case FIP_MODE_FABRIC: |
|---|
| 469 | 458 | case FIP_MODE_NON_FIP: |
|---|
| 470 | 459 | mutex_unlock(&fip->ctlr_mutex); |
|---|
| .. | .. |
|---|
| 599 | 588 | /** |
|---|
| 600 | 589 | * fcoe_ctlr_encaps() - Encapsulate an ELS frame for FIP, without sending it |
|---|
| 601 | 590 | * @fip: The FCoE controller for the ELS frame |
|---|
| 591 | + * @lport: The local port |
|---|
| 602 | 592 | * @dtype: The FIP descriptor type for the frame |
|---|
| 603 | 593 | * @skb: The FCoE ELS frame including FC header but no FCoE headers |
|---|
| 604 | 594 | * @d_id: The destination port ID. |
|---|
| .. | .. |
|---|
| 783 | 773 | fc_fcoe_set_mac(mac, fh->fh_d_id); |
|---|
| 784 | 774 | fip->update_mac(lport, mac); |
|---|
| 785 | 775 | } |
|---|
| 786 | | - /* fall through */ |
|---|
| 776 | + fallthrough; |
|---|
| 787 | 777 | case ELS_LS_RJT: |
|---|
| 788 | 778 | op = fr_encaps(fp); |
|---|
| 789 | 779 | if (op) |
|---|
| .. | .. |
|---|
| 1031 | 1021 | { |
|---|
| 1032 | 1022 | struct fcoe_fcf *fcf; |
|---|
| 1033 | 1023 | struct fcoe_fcf new; |
|---|
| 1034 | | - unsigned long sol_tov = msecs_to_jiffies(FCOE_CTRL_SOL_TOV); |
|---|
| 1024 | + unsigned long sol_tov = msecs_to_jiffies(FCOE_CTLR_SOL_TOV); |
|---|
| 1035 | 1025 | int first = 0; |
|---|
| 1036 | 1026 | int mtu_valid; |
|---|
| 1037 | 1027 | int found = 0; |
|---|
| .. | .. |
|---|
| 1314 | 1304 | /** |
|---|
| 1315 | 1305 | * fcoe_ctlr_recv_els() - Handle an incoming link reset frame |
|---|
| 1316 | 1306 | * @fip: The FCoE controller that received the frame |
|---|
| 1317 | | - * @fh: The received FIP header |
|---|
| 1307 | + * @skb: The received FIP packet |
|---|
| 1318 | 1308 | * |
|---|
| 1319 | 1309 | * There may be multiple VN_Port descriptors. |
|---|
| 1320 | 1310 | * The overall length has already been checked. |
|---|
| .. | .. |
|---|
| 1787 | 1777 | |
|---|
| 1788 | 1778 | /** |
|---|
| 1789 | 1779 | * fcoe_ctlr_timeout() - FIP timeout handler |
|---|
| 1790 | | - * @arg: The FCoE controller that timed out |
|---|
| 1780 | + * @t: Timer context use to obtain the controller reference |
|---|
| 1791 | 1781 | */ |
|---|
| 1792 | 1782 | static void fcoe_ctlr_timeout(struct timer_list *t) |
|---|
| 1793 | 1783 | { |
|---|
| .. | .. |
|---|
| 1899 | 1889 | /** |
|---|
| 1900 | 1890 | * fcoe_ctlr_recv_flogi() - Snoop pre-FIP receipt of FLOGI response |
|---|
| 1901 | 1891 | * @fip: The FCoE controller |
|---|
| 1892 | + * @lport: The local port |
|---|
| 1902 | 1893 | * @fp: The FC frame to snoop |
|---|
| 1903 | 1894 | * |
|---|
| 1904 | 1895 | * Snoop potential response to FLOGI or even incoming FLOGI. |
|---|
| .. | .. |
|---|
| 1978 | 1969 | * |
|---|
| 1979 | 1970 | * Returns: u64 fc world wide name |
|---|
| 1980 | 1971 | */ |
|---|
| 1981 | | -u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], |
|---|
| 1972 | +u64 fcoe_wwn_from_mac(unsigned char mac[ETH_ALEN], |
|---|
| 1982 | 1973 | unsigned int scheme, unsigned int port) |
|---|
| 1983 | 1974 | { |
|---|
| 1984 | 1975 | u64 wwn; |
|---|
| .. | .. |
|---|
| 2170 | 2161 | |
|---|
| 2171 | 2162 | /** |
|---|
| 2172 | 2163 | * fcoe_ctlr_disc_stop_locked() - stop discovery in VN2VN mode |
|---|
| 2173 | | - * @fip: The FCoE controller |
|---|
| 2164 | + * @lport: The local port |
|---|
| 2174 | 2165 | * |
|---|
| 2175 | 2166 | * Called with ctlr_mutex held. |
|---|
| 2176 | 2167 | */ |
|---|
| .. | .. |
|---|
| 2191 | 2182 | |
|---|
| 2192 | 2183 | /** |
|---|
| 2193 | 2184 | * fcoe_ctlr_disc_stop() - stop discovery in VN2VN mode |
|---|
| 2194 | | - * @fip: The FCoE controller |
|---|
| 2185 | + * @lport: The local port |
|---|
| 2195 | 2186 | * |
|---|
| 2196 | 2187 | * Called through the local port template for discovery. |
|---|
| 2197 | 2188 | * Called without the ctlr_mutex held. |
|---|
| .. | .. |
|---|
| 2207 | 2198 | |
|---|
| 2208 | 2199 | /** |
|---|
| 2209 | 2200 | * fcoe_ctlr_disc_stop_final() - stop discovery for shutdown in VN2VN mode |
|---|
| 2210 | | - * @fip: The FCoE controller |
|---|
| 2201 | + * @lport: The local port |
|---|
| 2211 | 2202 | * |
|---|
| 2212 | 2203 | * Called through the local port template for discovery. |
|---|
| 2213 | 2204 | * Called without the ctlr_mutex held. |
|---|
| .. | .. |
|---|
| 2274 | 2265 | * fcoe_ctlr_vn_parse - parse probe request or response |
|---|
| 2275 | 2266 | * @fip: The FCoE controller |
|---|
| 2276 | 2267 | * @skb: incoming packet |
|---|
| 2277 | | - * @rdata: buffer for resulting parsed VN entry plus fcoe_rport |
|---|
| 2268 | + * @frport: parsed FCoE rport from the probe request |
|---|
| 2278 | 2269 | * |
|---|
| 2279 | 2270 | * Returns non-zero error number on error. |
|---|
| 2280 | 2271 | * Does not consume the packet. |
|---|
| .. | .. |
|---|
| 2413 | 2404 | /** |
|---|
| 2414 | 2405 | * fcoe_ctlr_vn_probe_req() - handle incoming VN2VN probe request. |
|---|
| 2415 | 2406 | * @fip: The FCoE controller |
|---|
| 2416 | | - * @rdata: parsed remote port with frport from the probe request |
|---|
| 2407 | + * @frport: parsed FCoE rport from the probe request |
|---|
| 2417 | 2408 | * |
|---|
| 2418 | 2409 | * Called with ctlr_mutex held. |
|---|
| 2419 | 2410 | */ |
|---|
| 2420 | 2411 | static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip, |
|---|
| 2421 | | - struct fc_rport_priv *rdata) |
|---|
| 2412 | + struct fcoe_rport *frport) |
|---|
| 2422 | 2413 | { |
|---|
| 2423 | | - struct fcoe_rport *frport = fcoe_ctlr_rport(rdata); |
|---|
| 2424 | | - |
|---|
| 2425 | | - if (rdata->ids.port_id != fip->port_id) |
|---|
| 2414 | + if (frport->rdata.ids.port_id != fip->port_id) |
|---|
| 2426 | 2415 | return; |
|---|
| 2427 | 2416 | |
|---|
| 2428 | 2417 | switch (fip->state) { |
|---|
| .. | .. |
|---|
| 2442 | 2431 | * Probe's REC bit is not set. |
|---|
| 2443 | 2432 | * If we don't reply, we will change our address. |
|---|
| 2444 | 2433 | */ |
|---|
| 2445 | | - if (fip->lp->wwpn > rdata->ids.port_name && |
|---|
| 2434 | + if (fip->lp->wwpn > frport->rdata.ids.port_name && |
|---|
| 2446 | 2435 | !(frport->flags & FIP_FL_REC_OR_P2P)) { |
|---|
| 2447 | 2436 | LIBFCOE_FIP_DBG(fip, "vn_probe_req: " |
|---|
| 2448 | 2437 | "port_id collision\n"); |
|---|
| .. | .. |
|---|
| 2450 | 2439 | frport->enode_mac, 0); |
|---|
| 2451 | 2440 | break; |
|---|
| 2452 | 2441 | } |
|---|
| 2453 | | - /* fall through */ |
|---|
| 2442 | + fallthrough; |
|---|
| 2454 | 2443 | case FIP_ST_VNMP_START: |
|---|
| 2455 | 2444 | LIBFCOE_FIP_DBG(fip, "vn_probe_req: " |
|---|
| 2456 | 2445 | "restart VN2VN negotiation\n"); |
|---|
| .. | .. |
|---|
| 2466 | 2455 | /** |
|---|
| 2467 | 2456 | * fcoe_ctlr_vn_probe_reply() - handle incoming VN2VN probe reply. |
|---|
| 2468 | 2457 | * @fip: The FCoE controller |
|---|
| 2469 | | - * @rdata: parsed remote port with frport from the probe request |
|---|
| 2458 | + * @frport: parsed FCoE rport from the probe request |
|---|
| 2470 | 2459 | * |
|---|
| 2471 | 2460 | * Called with ctlr_mutex held. |
|---|
| 2472 | 2461 | */ |
|---|
| 2473 | 2462 | static void fcoe_ctlr_vn_probe_reply(struct fcoe_ctlr *fip, |
|---|
| 2474 | | - struct fc_rport_priv *rdata) |
|---|
| 2463 | + struct fcoe_rport *frport) |
|---|
| 2475 | 2464 | { |
|---|
| 2476 | | - if (rdata->ids.port_id != fip->port_id) |
|---|
| 2465 | + if (frport->rdata.ids.port_id != fip->port_id) |
|---|
| 2477 | 2466 | return; |
|---|
| 2478 | 2467 | switch (fip->state) { |
|---|
| 2479 | 2468 | case FIP_ST_VNMP_START: |
|---|
| .. | .. |
|---|
| 2496 | 2485 | /** |
|---|
| 2497 | 2486 | * fcoe_ctlr_vn_add() - Add a VN2VN entry to the list, based on a claim reply. |
|---|
| 2498 | 2487 | * @fip: The FCoE controller |
|---|
| 2499 | | - * @new: newly-parsed remote port with frport as a template for new rdata |
|---|
| 2488 | + * @new: newly-parsed FCoE rport as a template for new rdata |
|---|
| 2500 | 2489 | * |
|---|
| 2501 | 2490 | * Called with ctlr_mutex held. |
|---|
| 2502 | 2491 | */ |
|---|
| 2503 | | -static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) |
|---|
| 2492 | +static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fcoe_rport *new) |
|---|
| 2504 | 2493 | { |
|---|
| 2505 | 2494 | struct fc_lport *lport = fip->lp; |
|---|
| 2506 | 2495 | struct fc_rport_priv *rdata; |
|---|
| .. | .. |
|---|
| 2508 | 2497 | struct fcoe_rport *frport; |
|---|
| 2509 | 2498 | u32 port_id; |
|---|
| 2510 | 2499 | |
|---|
| 2511 | | - port_id = new->ids.port_id; |
|---|
| 2500 | + port_id = new->rdata.ids.port_id; |
|---|
| 2512 | 2501 | if (port_id == fip->port_id) |
|---|
| 2513 | 2502 | return; |
|---|
| 2514 | 2503 | |
|---|
| .. | .. |
|---|
| 2525 | 2514 | rdata->disc_id = lport->disc.disc_id; |
|---|
| 2526 | 2515 | |
|---|
| 2527 | 2516 | 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)) { |
|---|
| 2517 | + if ((ids->port_name != -1 && |
|---|
| 2518 | + ids->port_name != new->rdata.ids.port_name) || |
|---|
| 2519 | + (ids->node_name != -1 && |
|---|
| 2520 | + ids->node_name != new->rdata.ids.node_name)) { |
|---|
| 2530 | 2521 | mutex_unlock(&rdata->rp_mutex); |
|---|
| 2531 | 2522 | LIBFCOE_FIP_DBG(fip, "vn_add rport logoff %6.6x\n", port_id); |
|---|
| 2532 | 2523 | fc_rport_logoff(rdata); |
|---|
| 2533 | 2524 | mutex_lock(&rdata->rp_mutex); |
|---|
| 2534 | 2525 | } |
|---|
| 2535 | | - ids->port_name = new->ids.port_name; |
|---|
| 2536 | | - ids->node_name = new->ids.node_name; |
|---|
| 2526 | + ids->port_name = new->rdata.ids.port_name; |
|---|
| 2527 | + ids->node_name = new->rdata.ids.node_name; |
|---|
| 2537 | 2528 | mutex_unlock(&rdata->rp_mutex); |
|---|
| 2538 | 2529 | |
|---|
| 2539 | 2530 | frport = fcoe_ctlr_rport(rdata); |
|---|
| 2540 | 2531 | LIBFCOE_FIP_DBG(fip, "vn_add rport %6.6x %s state %d\n", |
|---|
| 2541 | 2532 | port_id, frport->fcoe_len ? "old" : "new", |
|---|
| 2542 | 2533 | rdata->rp_state); |
|---|
| 2543 | | - *frport = *fcoe_ctlr_rport(new); |
|---|
| 2534 | + frport->fcoe_len = new->fcoe_len; |
|---|
| 2535 | + frport->flags = new->flags; |
|---|
| 2536 | + frport->login_count = new->login_count; |
|---|
| 2537 | + memcpy(frport->enode_mac, new->enode_mac, ETH_ALEN); |
|---|
| 2538 | + memcpy(frport->vn_mac, new->vn_mac, ETH_ALEN); |
|---|
| 2544 | 2539 | frport->time = 0; |
|---|
| 2545 | 2540 | } |
|---|
| 2546 | 2541 | |
|---|
| .. | .. |
|---|
| 2572 | 2567 | /** |
|---|
| 2573 | 2568 | * fcoe_ctlr_vn_claim_notify() - handle received FIP VN2VN Claim Notification |
|---|
| 2574 | 2569 | * @fip: The FCoE controller |
|---|
| 2575 | | - * @new: newly-parsed remote port with frport as a template for new rdata |
|---|
| 2570 | + * @new: newly-parsed FCoE rport as a template for new rdata |
|---|
| 2576 | 2571 | * |
|---|
| 2577 | 2572 | * Called with ctlr_mutex held. |
|---|
| 2578 | 2573 | */ |
|---|
| 2579 | 2574 | static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, |
|---|
| 2580 | | - struct fc_rport_priv *new) |
|---|
| 2575 | + struct fcoe_rport *new) |
|---|
| 2581 | 2576 | { |
|---|
| 2582 | | - struct fcoe_rport *frport = fcoe_ctlr_rport(new); |
|---|
| 2583 | | - |
|---|
| 2584 | | - if (frport->flags & FIP_FL_REC_OR_P2P) { |
|---|
| 2577 | + if (new->flags & FIP_FL_REC_OR_P2P) { |
|---|
| 2585 | 2578 | LIBFCOE_FIP_DBG(fip, "send probe req for P2P/REC\n"); |
|---|
| 2586 | 2579 | fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0); |
|---|
| 2587 | 2580 | return; |
|---|
| .. | .. |
|---|
| 2590 | 2583 | case FIP_ST_VNMP_START: |
|---|
| 2591 | 2584 | case FIP_ST_VNMP_PROBE1: |
|---|
| 2592 | 2585 | case FIP_ST_VNMP_PROBE2: |
|---|
| 2593 | | - if (new->ids.port_id == fip->port_id) { |
|---|
| 2586 | + if (new->rdata.ids.port_id == fip->port_id) { |
|---|
| 2594 | 2587 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " |
|---|
| 2595 | 2588 | "restart, state %d\n", |
|---|
| 2596 | 2589 | fip->state); |
|---|
| .. | .. |
|---|
| 2599 | 2592 | break; |
|---|
| 2600 | 2593 | case FIP_ST_VNMP_CLAIM: |
|---|
| 2601 | 2594 | case FIP_ST_VNMP_UP: |
|---|
| 2602 | | - if (new->ids.port_id == fip->port_id) { |
|---|
| 2603 | | - if (new->ids.port_name > fip->lp->wwpn) { |
|---|
| 2595 | + if (new->rdata.ids.port_id == fip->port_id) { |
|---|
| 2596 | + if (new->rdata.ids.port_name > fip->lp->wwpn) { |
|---|
| 2604 | 2597 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " |
|---|
| 2605 | 2598 | "restart, port_id collision\n"); |
|---|
| 2606 | 2599 | fcoe_ctlr_vn_restart(fip); |
|---|
| .. | .. |
|---|
| 2612 | 2605 | break; |
|---|
| 2613 | 2606 | } |
|---|
| 2614 | 2607 | 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, |
|---|
| 2608 | + new->rdata.ids.port_id); |
|---|
| 2609 | + fcoe_ctlr_vn_send(fip, FIP_SC_VN_CLAIM_REP, new->enode_mac, |
|---|
| 2610 | + min((u32)new->fcoe_len, |
|---|
| 2618 | 2611 | fcoe_ctlr_fcoe_size(fip))); |
|---|
| 2619 | 2612 | fcoe_ctlr_vn_add(fip, new); |
|---|
| 2620 | 2613 | break; |
|---|
| 2621 | 2614 | default: |
|---|
| 2622 | 2615 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " |
|---|
| 2623 | | - "ignoring claim from %x\n", new->ids.port_id); |
|---|
| 2616 | + "ignoring claim from %x\n", |
|---|
| 2617 | + new->rdata.ids.port_id); |
|---|
| 2624 | 2618 | break; |
|---|
| 2625 | 2619 | } |
|---|
| 2626 | 2620 | } |
|---|
| .. | .. |
|---|
| 2628 | 2622 | /** |
|---|
| 2629 | 2623 | * fcoe_ctlr_vn_claim_resp() - handle received Claim Response |
|---|
| 2630 | 2624 | * @fip: The FCoE controller that received the frame |
|---|
| 2631 | | - * @new: newly-parsed remote port with frport from the Claim Response |
|---|
| 2625 | + * @new: newly-parsed FCoE rport from the Claim Response |
|---|
| 2632 | 2626 | * |
|---|
| 2633 | 2627 | * Called with ctlr_mutex held. |
|---|
| 2634 | 2628 | */ |
|---|
| 2635 | 2629 | static void fcoe_ctlr_vn_claim_resp(struct fcoe_ctlr *fip, |
|---|
| 2636 | | - struct fc_rport_priv *new) |
|---|
| 2630 | + struct fcoe_rport *new) |
|---|
| 2637 | 2631 | { |
|---|
| 2638 | 2632 | LIBFCOE_FIP_DBG(fip, "claim resp from from rport %x - state %s\n", |
|---|
| 2639 | | - new->ids.port_id, fcoe_ctlr_state(fip->state)); |
|---|
| 2633 | + new->rdata.ids.port_id, fcoe_ctlr_state(fip->state)); |
|---|
| 2640 | 2634 | if (fip->state == FIP_ST_VNMP_UP || fip->state == FIP_ST_VNMP_CLAIM) |
|---|
| 2641 | 2635 | fcoe_ctlr_vn_add(fip, new); |
|---|
| 2642 | 2636 | } |
|---|
| .. | .. |
|---|
| 2644 | 2638 | /** |
|---|
| 2645 | 2639 | * fcoe_ctlr_vn_beacon() - handle received beacon. |
|---|
| 2646 | 2640 | * @fip: The FCoE controller that received the frame |
|---|
| 2647 | | - * @new: newly-parsed remote port with frport from the Beacon |
|---|
| 2641 | + * @new: newly-parsed FCoE rport from the Beacon |
|---|
| 2648 | 2642 | * |
|---|
| 2649 | 2643 | * Called with ctlr_mutex held. |
|---|
| 2650 | 2644 | */ |
|---|
| 2651 | 2645 | static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip, |
|---|
| 2652 | | - struct fc_rport_priv *new) |
|---|
| 2646 | + struct fcoe_rport *new) |
|---|
| 2653 | 2647 | { |
|---|
| 2654 | 2648 | struct fc_lport *lport = fip->lp; |
|---|
| 2655 | 2649 | struct fc_rport_priv *rdata; |
|---|
| 2656 | 2650 | struct fcoe_rport *frport; |
|---|
| 2657 | 2651 | |
|---|
| 2658 | | - frport = fcoe_ctlr_rport(new); |
|---|
| 2659 | | - if (frport->flags & FIP_FL_REC_OR_P2P) { |
|---|
| 2652 | + if (new->flags & FIP_FL_REC_OR_P2P) { |
|---|
| 2660 | 2653 | LIBFCOE_FIP_DBG(fip, "p2p beacon while in vn2vn mode\n"); |
|---|
| 2661 | 2654 | fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0); |
|---|
| 2662 | 2655 | return; |
|---|
| 2663 | 2656 | } |
|---|
| 2664 | | - rdata = fc_rport_lookup(lport, new->ids.port_id); |
|---|
| 2657 | + rdata = fc_rport_lookup(lport, new->rdata.ids.port_id); |
|---|
| 2665 | 2658 | if (rdata) { |
|---|
| 2666 | | - if (rdata->ids.node_name == new->ids.node_name && |
|---|
| 2667 | | - rdata->ids.port_name == new->ids.port_name) { |
|---|
| 2659 | + if (rdata->ids.node_name == new->rdata.ids.node_name && |
|---|
| 2660 | + rdata->ids.port_name == new->rdata.ids.port_name) { |
|---|
| 2668 | 2661 | frport = fcoe_ctlr_rport(rdata); |
|---|
| 2662 | + |
|---|
| 2669 | 2663 | LIBFCOE_FIP_DBG(fip, "beacon from rport %x\n", |
|---|
| 2670 | 2664 | rdata->ids.port_id); |
|---|
| 2671 | 2665 | if (!frport->time && fip->state == FIP_ST_VNMP_UP) { |
|---|
| .. | .. |
|---|
| 2688 | 2682 | * Don't add the neighbor yet. |
|---|
| 2689 | 2683 | */ |
|---|
| 2690 | 2684 | LIBFCOE_FIP_DBG(fip, "beacon from new rport %x. sending claim notify\n", |
|---|
| 2691 | | - new->ids.port_id); |
|---|
| 2685 | + new->rdata.ids.port_id); |
|---|
| 2692 | 2686 | if (time_after(jiffies, |
|---|
| 2693 | 2687 | fip->sol_time + msecs_to_jiffies(FIP_VN_ANN_WAIT))) |
|---|
| 2694 | 2688 | fcoe_ctlr_vn_send_claim(fip); |
|---|
| .. | .. |
|---|
| 2773 | 2767 | mutex_lock(&fip->ctlr_mutex); |
|---|
| 2774 | 2768 | switch (sub) { |
|---|
| 2775 | 2769 | case FIP_SC_VN_PROBE_REQ: |
|---|
| 2776 | | - fcoe_ctlr_vn_probe_req(fip, &frport.rdata); |
|---|
| 2770 | + fcoe_ctlr_vn_probe_req(fip, &frport); |
|---|
| 2777 | 2771 | break; |
|---|
| 2778 | 2772 | case FIP_SC_VN_PROBE_REP: |
|---|
| 2779 | | - fcoe_ctlr_vn_probe_reply(fip, &frport.rdata); |
|---|
| 2773 | + fcoe_ctlr_vn_probe_reply(fip, &frport); |
|---|
| 2780 | 2774 | break; |
|---|
| 2781 | 2775 | case FIP_SC_VN_CLAIM_NOTIFY: |
|---|
| 2782 | | - fcoe_ctlr_vn_claim_notify(fip, &frport.rdata); |
|---|
| 2776 | + fcoe_ctlr_vn_claim_notify(fip, &frport); |
|---|
| 2783 | 2777 | break; |
|---|
| 2784 | 2778 | case FIP_SC_VN_CLAIM_REP: |
|---|
| 2785 | | - fcoe_ctlr_vn_claim_resp(fip, &frport.rdata); |
|---|
| 2779 | + fcoe_ctlr_vn_claim_resp(fip, &frport); |
|---|
| 2786 | 2780 | break; |
|---|
| 2787 | 2781 | case FIP_SC_VN_BEACON: |
|---|
| 2788 | | - fcoe_ctlr_vn_beacon(fip, &frport.rdata); |
|---|
| 2782 | + fcoe_ctlr_vn_beacon(fip, &frport); |
|---|
| 2789 | 2783 | break; |
|---|
| 2790 | 2784 | default: |
|---|
| 2791 | 2785 | LIBFCOE_FIP_DBG(fip, "vn_recv unknown subcode %d\n", sub); |
|---|
| .. | .. |
|---|
| 2802 | 2796 | * fcoe_ctlr_vlan_parse - parse vlan discovery request or response |
|---|
| 2803 | 2797 | * @fip: The FCoE controller |
|---|
| 2804 | 2798 | * @skb: incoming packet |
|---|
| 2805 | | - * @rdata: buffer for resulting parsed VLAN entry plus fcoe_rport |
|---|
| 2799 | + * @frport: parsed FCoE rport from the probe request |
|---|
| 2806 | 2800 | * |
|---|
| 2807 | 2801 | * Returns non-zero error number on error. |
|---|
| 2808 | 2802 | * Does not consume the packet. |
|---|
| .. | .. |
|---|
| 2901 | 2895 | * @fip: The FCoE controller |
|---|
| 2902 | 2896 | * @sub: sub-opcode for vlan notification or vn2vn vlan notification |
|---|
| 2903 | 2897 | * @dest: The destination Ethernet MAC address |
|---|
| 2904 | | - * @min_len: minimum size of the Ethernet payload to be sent |
|---|
| 2905 | 2898 | */ |
|---|
| 2906 | 2899 | static void fcoe_ctlr_vlan_send(struct fcoe_ctlr *fip, |
|---|
| 2907 | 2900 | enum fip_vlan_subcode sub, |
|---|
| .. | .. |
|---|
| 2961 | 2954 | /** |
|---|
| 2962 | 2955 | * fcoe_ctlr_vlan_disk_reply() - send FIP VLAN Discovery Notification. |
|---|
| 2963 | 2956 | * @fip: The FCoE controller |
|---|
| 2957 | + * @frport: The newly-parsed FCoE rport from the Discovery Request |
|---|
| 2964 | 2958 | * |
|---|
| 2965 | 2959 | * Called with ctlr_mutex held. |
|---|
| 2966 | 2960 | */ |
|---|
| 2967 | 2961 | static void fcoe_ctlr_vlan_disc_reply(struct fcoe_ctlr *fip, |
|---|
| 2968 | | - struct fc_rport_priv *rdata) |
|---|
| 2962 | + struct fcoe_rport *frport) |
|---|
| 2969 | 2963 | { |
|---|
| 2970 | | - struct fcoe_rport *frport = fcoe_ctlr_rport(rdata); |
|---|
| 2971 | 2964 | enum fip_vlan_subcode sub = FIP_SC_VL_NOTE; |
|---|
| 2972 | 2965 | |
|---|
| 2973 | 2966 | if (fip->mode == FIP_MODE_VN2VN) |
|---|
| .. | .. |
|---|
| 2978 | 2971 | |
|---|
| 2979 | 2972 | /** |
|---|
| 2980 | 2973 | * fcoe_ctlr_vlan_recv - vlan request receive handler for VN2VN mode. |
|---|
| 2981 | | - * @lport: The local port |
|---|
| 2982 | | - * @fp: The received frame |
|---|
| 2983 | | - * |
|---|
| 2974 | + * @fip: The FCoE controller |
|---|
| 2975 | + * @skb: The received FIP packet |
|---|
| 2984 | 2976 | */ |
|---|
| 2985 | 2977 | static int fcoe_ctlr_vlan_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) |
|---|
| 2986 | 2978 | { |
|---|
| .. | .. |
|---|
| 2998 | 2990 | } |
|---|
| 2999 | 2991 | mutex_lock(&fip->ctlr_mutex); |
|---|
| 3000 | 2992 | if (sub == FIP_SC_VL_REQ) |
|---|
| 3001 | | - fcoe_ctlr_vlan_disc_reply(fip, &frport.rdata); |
|---|
| 2993 | + fcoe_ctlr_vlan_disc_reply(fip, &frport); |
|---|
| 3002 | 2994 | mutex_unlock(&fip->ctlr_mutex); |
|---|
| 3003 | 2995 | |
|---|
| 3004 | 2996 | drop: |
|---|
| .. | .. |
|---|
| 3024 | 3016 | fc_frame_free(fp); |
|---|
| 3025 | 3017 | } |
|---|
| 3026 | 3018 | |
|---|
| 3027 | | -/** |
|---|
| 3028 | | - * fcoe_ctlr_disc_recv - start discovery for VN2VN mode. |
|---|
| 3029 | | - * @fip: The FCoE controller |
|---|
| 3019 | +/* |
|---|
| 3020 | + * fcoe_ctlr_disc_start - start discovery for VN2VN mode. |
|---|
| 3030 | 3021 | * |
|---|
| 3031 | 3022 | * This sets a flag indicating that remote ports should be created |
|---|
| 3032 | 3023 | * and started for the peers we discover. We use the disc_callback |
|---|