forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/scsi/fcoe/fcoe.c
....@@ -1,18 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * 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.
164 *
175 * Maintained at www.Open-FCoE.org
186 */
....@@ -286,7 +274,6 @@
286274 .this_id = -1,
287275 .cmd_per_lun = 3,
288276 .can_queue = FCOE_MAX_OUTSTANDING_COMMANDS,
289
- .use_clustering = ENABLE_CLUSTERING,
290277 .sg_tablesize = SG_ALL,
291278 .max_sectors = 0xffff,
292279 .track_queue_depth = 1,
....@@ -658,7 +645,7 @@
658645 return 0;
659646 }
660647
661
-/**
648
+/*
662649 * fcoe_netdev_features_change - Updates the lport's offload flags based
663650 * on the LLD netdev's FCoE feature flags
664651 */
....@@ -1263,15 +1250,21 @@
12631250 /* attach to scsi transport */
12641251 fcoe_nport_scsi_transport =
12651252 fc_attach_transport(&fcoe_nport_fc_functions);
1253
+ if (!fcoe_nport_scsi_transport)
1254
+ goto err;
1255
+
12661256 fcoe_vport_scsi_transport =
12671257 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;
12731260
12741261 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;
12751268 }
12761269
12771270 /**
....@@ -1535,8 +1528,7 @@
15351528 return -ENOMEM;
15361529 }
15371530 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);
15401532 } else {
15411533 cp = skb_put(skb, tlen);
15421534 }
....@@ -1631,7 +1623,6 @@
16311623 else
16321624 fr_flags(fp) |= FCPHF_CRC_UNCHECKED;
16331625
1634
- fh = (struct fc_frame_header *) skb_transport_header(skb);
16351626 fh = fc_frame_header_get(fp);
16361627 if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA && fh->fh_type == FC_TYPE_FCP)
16371628 return 0;
....@@ -1670,7 +1661,6 @@
16701661 struct fc_stats *stats;
16711662 struct fcoe_crc_eof crc_eof;
16721663 struct fc_frame *fp;
1673
- struct fcoe_port *port;
16741664 struct fcoe_hdr *hp;
16751665
16761666 fr = fcoe_dev_from_skb(skb);
....@@ -1688,7 +1678,6 @@
16881678 skb_end_pointer(skb), skb->csum,
16891679 skb->dev ? skb->dev->name : "<NULL>");
16901680
1691
- port = lport_priv(lport);
16921681 skb_linearize(skb); /* check for skb_is_nonlinear is within skb_linearize */
16931682
16941683 /*
....@@ -1859,7 +1848,6 @@
18591848 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
18601849 struct fcoe_ctlr *ctlr;
18611850 struct fcoe_interface *fcoe;
1862
- struct fcoe_port *port;
18631851 struct fc_stats *stats;
18641852 u32 link_possible = 1;
18651853 u32 mfs;
....@@ -1897,7 +1885,6 @@
18971885 break;
18981886 case NETDEV_UNREGISTER:
18991887 list_del(&fcoe->list);
1900
- port = lport_priv(ctlr->lp);
19011888 fcoe_vport_remove(lport);
19021889 mutex_lock(&fcoe_config_mutex);
19031890 fcoe_if_destroy(lport);
....@@ -1928,7 +1915,7 @@
19281915 case FCOE_CTLR_ENABLED:
19291916 case FCOE_CTLR_UNUSED:
19301917 fcoe_ctlr_link_up(ctlr);
1931
- };
1918
+ }
19321919 } else if (fcoe_ctlr_link_down(ctlr)) {
19331920 switch (cdev->enabled) {
19341921 case FCOE_CTLR_DISABLED:
....@@ -1940,7 +1927,7 @@
19401927 stats->LinkFailureCount++;
19411928 put_cpu();
19421929 fcoe_clean_pending_queue(lport);
1943
- };
1930
+ }
19441931 }
19451932 out:
19461933 return rc;
....@@ -2042,7 +2029,7 @@
20422029
20432030 /**
20442031 * 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
20462033 *
20472034 * When the FIP mode has been changed we need to update
20482035 * the multicast addresses to ensure we get the correct
....@@ -2149,9 +2136,7 @@
21492136
21502137 /**
21512138 * 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
21552140 */
21562141 static void fcoe_dcb_create(struct fcoe_interface *fcoe)
21572142 {
....@@ -2622,7 +2607,7 @@
26222607 fc_lport_logo_resp(seq, fp, lport);
26232608 }
26242609
2625
-/**
2610
+/*
26262611 * fcoe_elsct_send - FCoE specific ELS handler
26272612 *
26282613 * This does special case handling of FIP encapsualted ELS exchanges for FCoE,