| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 5 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 6 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 9 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 10 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 11 | | - * more details. |
|---|
| 12 | | - * |
|---|
| 13 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 14 | | - * this program; if not, write to the Free Software Foundation, Inc., |
|---|
| 15 | | - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
|---|
| 16 | 4 | * |
|---|
| 17 | 5 | * Maintained at www.Open-FCoE.org |
|---|
| 18 | 6 | */ |
|---|
| .. | .. |
|---|
| 286 | 274 | .this_id = -1, |
|---|
| 287 | 275 | .cmd_per_lun = 3, |
|---|
| 288 | 276 | .can_queue = FCOE_MAX_OUTSTANDING_COMMANDS, |
|---|
| 289 | | - .use_clustering = ENABLE_CLUSTERING, |
|---|
| 290 | 277 | .sg_tablesize = SG_ALL, |
|---|
| 291 | 278 | .max_sectors = 0xffff, |
|---|
| 292 | 279 | .track_queue_depth = 1, |
|---|
| .. | .. |
|---|
| 658 | 645 | return 0; |
|---|
| 659 | 646 | } |
|---|
| 660 | 647 | |
|---|
| 661 | | -/** |
|---|
| 648 | +/* |
|---|
| 662 | 649 | * fcoe_netdev_features_change - Updates the lport's offload flags based |
|---|
| 663 | 650 | * on the LLD netdev's FCoE feature flags |
|---|
| 664 | 651 | */ |
|---|
| .. | .. |
|---|
| 1263 | 1250 | /* attach to scsi transport */ |
|---|
| 1264 | 1251 | fcoe_nport_scsi_transport = |
|---|
| 1265 | 1252 | fc_attach_transport(&fcoe_nport_fc_functions); |
|---|
| 1253 | + if (!fcoe_nport_scsi_transport) |
|---|
| 1254 | + goto err; |
|---|
| 1255 | + |
|---|
| 1266 | 1256 | fcoe_vport_scsi_transport = |
|---|
| 1267 | 1257 | fc_attach_transport(&fcoe_vport_fc_functions); |
|---|
| 1268 | | - |
|---|
| 1269 | | - if (!fcoe_nport_scsi_transport) { |
|---|
| 1270 | | - printk(KERN_ERR "fcoe: Failed to attach to the FC transport\n"); |
|---|
| 1271 | | - return -ENODEV; |
|---|
| 1272 | | - } |
|---|
| 1258 | + if (!fcoe_vport_scsi_transport) |
|---|
| 1259 | + goto err_vport; |
|---|
| 1273 | 1260 | |
|---|
| 1274 | 1261 | return 0; |
|---|
| 1262 | + |
|---|
| 1263 | +err_vport: |
|---|
| 1264 | + fc_release_transport(fcoe_nport_scsi_transport); |
|---|
| 1265 | +err: |
|---|
| 1266 | + printk(KERN_ERR "fcoe: Failed to attach to the FC transport\n"); |
|---|
| 1267 | + return -ENODEV; |
|---|
| 1275 | 1268 | } |
|---|
| 1276 | 1269 | |
|---|
| 1277 | 1270 | /** |
|---|
| .. | .. |
|---|
| 1535 | 1528 | return -ENOMEM; |
|---|
| 1536 | 1529 | } |
|---|
| 1537 | 1530 | frag = &skb_shinfo(skb)->frags[skb_shinfo(skb)->nr_frags - 1]; |
|---|
| 1538 | | - cp = kmap_atomic(skb_frag_page(frag)) |
|---|
| 1539 | | - + frag->page_offset; |
|---|
| 1531 | + cp = kmap_atomic(skb_frag_page(frag)) + skb_frag_off(frag); |
|---|
| 1540 | 1532 | } else { |
|---|
| 1541 | 1533 | cp = skb_put(skb, tlen); |
|---|
| 1542 | 1534 | } |
|---|
| .. | .. |
|---|
| 1631 | 1623 | else |
|---|
| 1632 | 1624 | fr_flags(fp) |= FCPHF_CRC_UNCHECKED; |
|---|
| 1633 | 1625 | |
|---|
| 1634 | | - fh = (struct fc_frame_header *) skb_transport_header(skb); |
|---|
| 1635 | 1626 | fh = fc_frame_header_get(fp); |
|---|
| 1636 | 1627 | if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA && fh->fh_type == FC_TYPE_FCP) |
|---|
| 1637 | 1628 | return 0; |
|---|
| .. | .. |
|---|
| 1670 | 1661 | struct fc_stats *stats; |
|---|
| 1671 | 1662 | struct fcoe_crc_eof crc_eof; |
|---|
| 1672 | 1663 | struct fc_frame *fp; |
|---|
| 1673 | | - struct fcoe_port *port; |
|---|
| 1674 | 1664 | struct fcoe_hdr *hp; |
|---|
| 1675 | 1665 | |
|---|
| 1676 | 1666 | fr = fcoe_dev_from_skb(skb); |
|---|
| .. | .. |
|---|
| 1688 | 1678 | skb_end_pointer(skb), skb->csum, |
|---|
| 1689 | 1679 | skb->dev ? skb->dev->name : "<NULL>"); |
|---|
| 1690 | 1680 | |
|---|
| 1691 | | - port = lport_priv(lport); |
|---|
| 1692 | 1681 | skb_linearize(skb); /* check for skb_is_nonlinear is within skb_linearize */ |
|---|
| 1693 | 1682 | |
|---|
| 1694 | 1683 | /* |
|---|
| .. | .. |
|---|
| 1859 | 1848 | struct net_device *netdev = netdev_notifier_info_to_dev(ptr); |
|---|
| 1860 | 1849 | struct fcoe_ctlr *ctlr; |
|---|
| 1861 | 1850 | struct fcoe_interface *fcoe; |
|---|
| 1862 | | - struct fcoe_port *port; |
|---|
| 1863 | 1851 | struct fc_stats *stats; |
|---|
| 1864 | 1852 | u32 link_possible = 1; |
|---|
| 1865 | 1853 | u32 mfs; |
|---|
| .. | .. |
|---|
| 1897 | 1885 | break; |
|---|
| 1898 | 1886 | case NETDEV_UNREGISTER: |
|---|
| 1899 | 1887 | list_del(&fcoe->list); |
|---|
| 1900 | | - port = lport_priv(ctlr->lp); |
|---|
| 1901 | 1888 | fcoe_vport_remove(lport); |
|---|
| 1902 | 1889 | mutex_lock(&fcoe_config_mutex); |
|---|
| 1903 | 1890 | fcoe_if_destroy(lport); |
|---|
| .. | .. |
|---|
| 1928 | 1915 | case FCOE_CTLR_ENABLED: |
|---|
| 1929 | 1916 | case FCOE_CTLR_UNUSED: |
|---|
| 1930 | 1917 | fcoe_ctlr_link_up(ctlr); |
|---|
| 1931 | | - }; |
|---|
| 1918 | + } |
|---|
| 1932 | 1919 | } else if (fcoe_ctlr_link_down(ctlr)) { |
|---|
| 1933 | 1920 | switch (cdev->enabled) { |
|---|
| 1934 | 1921 | case FCOE_CTLR_DISABLED: |
|---|
| .. | .. |
|---|
| 1940 | 1927 | stats->LinkFailureCount++; |
|---|
| 1941 | 1928 | put_cpu(); |
|---|
| 1942 | 1929 | fcoe_clean_pending_queue(lport); |
|---|
| 1943 | | - }; |
|---|
| 1930 | + } |
|---|
| 1944 | 1931 | } |
|---|
| 1945 | 1932 | out: |
|---|
| 1946 | 1933 | return rc; |
|---|
| .. | .. |
|---|
| 2042 | 2029 | |
|---|
| 2043 | 2030 | /** |
|---|
| 2044 | 2031 | * fcoe_ctlr_mode() - Switch FIP mode |
|---|
| 2045 | | - * @cdev: The FCoE Controller that is being modified |
|---|
| 2032 | + * @ctlr_dev: The FCoE Controller that is being modified |
|---|
| 2046 | 2033 | * |
|---|
| 2047 | 2034 | * When the FIP mode has been changed we need to update |
|---|
| 2048 | 2035 | * the multicast addresses to ensure we get the correct |
|---|
| .. | .. |
|---|
| 2149 | 2136 | |
|---|
| 2150 | 2137 | /** |
|---|
| 2151 | 2138 | * fcoe_dcb_create() - Initialize DCB attributes and hooks |
|---|
| 2152 | | - * @netdev: The net_device object of the L2 link that should be queried |
|---|
| 2153 | | - * @port: The fcoe_port to bind FCoE APP priority with |
|---|
| 2154 | | - * @ |
|---|
| 2139 | + * @fcoe: The new FCoE interface |
|---|
| 2155 | 2140 | */ |
|---|
| 2156 | 2141 | static void fcoe_dcb_create(struct fcoe_interface *fcoe) |
|---|
| 2157 | 2142 | { |
|---|
| .. | .. |
|---|
| 2622 | 2607 | fc_lport_logo_resp(seq, fp, lport); |
|---|
| 2623 | 2608 | } |
|---|
| 2624 | 2609 | |
|---|
| 2625 | | -/** |
|---|
| 2610 | +/* |
|---|
| 2626 | 2611 | * fcoe_elsct_send - FCoE specific ELS handler |
|---|
| 2627 | 2612 | * |
|---|
| 2628 | 2613 | * This does special case handling of FIP encapsualted ELS exchanges for FCoE, |
|---|