aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fcoe
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 12:28:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 12:28:53 -0400
commit4dfddf503670d8def0fddb497e628130fc4522a8 (patch)
treef4bbf85589c13a1994fef75622ec80c48684f475 /drivers/scsi/fcoe
parentd4e65476bc68dbc9231b3c772b71f1576579b6fb (diff)
parent14bf41dcef651c13911a1715e83220732a3a4071 (diff)
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley: "This update includes the usual round of major driver updates (hpsa, be2iscsi, hisi_sas, zfcp, cxlflash). There's a new incarnation of hpsa called smartpqi for which a driver is added, there's some cleanup work of the ibm vscsi target and updates to libfc, plus a whole host of minor fixes and updates and finally the removal of several ISA drivers which seem not to have been used for years" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (173 commits) scsi: mvsas: Mark symbols static where possible scsi: pm8001: Mark symbols static where possible scsi: arcmsr: Simplify user_len checking scsi: fcoe: fix off by one in eth2fc_speed() scsi: dtc: remove from tree scsi: t128: remove from tree scsi: pas16: remove from tree scsi: u14-34f: remove from tree scsi: ultrastor: remove from tree scsi: in2000: remove from tree scsi: wd7000: remove from tree scsi: scsi_dh_alua: Fix memory leak in alua_rtpg() scsi: lpfc: Mark symbols static where possible scsi: hpsa: correct call to hpsa_do_reset scsi: ufs: Get a TM service response from the correct offset scsi: ibmvfc: Fix I/O hang when port is not mapped scsi: megaraid_sas: clean function declarations in megaraid_sas_base.c up scsi: ipr: Remove redundant messages at adapter init time scsi: ipr: Don't log unnecessary 9084 error details scsi: smartpqi: raid bypass lba calculation fix ...
Diffstat (limited to 'drivers/scsi/fcoe')
-rw-r--r--drivers/scsi/fcoe/fcoe_transport.c53
1 files changed, 36 insertions, 17 deletions
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index 7028dd37e5dd..375c536cbc68 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -83,6 +83,41 @@ static struct notifier_block libfcoe_notifier = {
83 .notifier_call = libfcoe_device_notification, 83 .notifier_call = libfcoe_device_notification,
84}; 84};
85 85
86static const struct {
87 u32 fc_port_speed;
88#define SPEED_2000 2000
89#define SPEED_4000 4000
90#define SPEED_8000 8000
91#define SPEED_16000 16000
92#define SPEED_32000 32000
93 u32 eth_port_speed;
94} fcoe_port_speed_mapping[] = {
95 { FC_PORTSPEED_1GBIT, SPEED_1000 },
96 { FC_PORTSPEED_2GBIT, SPEED_2000 },
97 { FC_PORTSPEED_4GBIT, SPEED_4000 },
98 { FC_PORTSPEED_8GBIT, SPEED_8000 },
99 { FC_PORTSPEED_10GBIT, SPEED_10000 },
100 { FC_PORTSPEED_16GBIT, SPEED_16000 },
101 { FC_PORTSPEED_20GBIT, SPEED_20000 },
102 { FC_PORTSPEED_25GBIT, SPEED_25000 },
103 { FC_PORTSPEED_32GBIT, SPEED_32000 },
104 { FC_PORTSPEED_40GBIT, SPEED_40000 },
105 { FC_PORTSPEED_50GBIT, SPEED_50000 },
106 { FC_PORTSPEED_100GBIT, SPEED_100000 },
107};
108
109static inline u32 eth2fc_speed(u32 eth_port_speed)
110{
111 int i;
112
113 for (i = 0; i < ARRAY_SIZE(fcoe_port_speed_mapping); i++) {
114 if (fcoe_port_speed_mapping[i].eth_port_speed == eth_port_speed)
115 return fcoe_port_speed_mapping[i].fc_port_speed;
116 }
117
118 return FC_PORTSPEED_UNKNOWN;
119}
120
86/** 121/**
87 * fcoe_link_speed_update() - Update the supported and actual link speeds 122 * fcoe_link_speed_update() - Update the supported and actual link speeds
88 * @lport: The local port to update speeds for 123 * @lport: The local port to update speeds for
@@ -126,23 +161,7 @@ int fcoe_link_speed_update(struct fc_lport *lport)
126 SUPPORTED_40000baseLR4_Full)) 161 SUPPORTED_40000baseLR4_Full))
127 lport->link_supported_speeds |= FC_PORTSPEED_40GBIT; 162 lport->link_supported_speeds |= FC_PORTSPEED_40GBIT;
128 163
129 switch (ecmd.base.speed) { 164 lport->link_speed = eth2fc_speed(ecmd.base.speed);
130 case SPEED_1000:
131 lport->link_speed = FC_PORTSPEED_1GBIT;
132 break;
133 case SPEED_10000:
134 lport->link_speed = FC_PORTSPEED_10GBIT;
135 break;
136 case SPEED_20000:
137 lport->link_speed = FC_PORTSPEED_20GBIT;
138 break;
139 case SPEED_40000:
140 lport->link_speed = FC_PORTSPEED_40GBIT;
141 break;
142 default:
143 lport->link_speed = FC_PORTSPEED_UNKNOWN;
144 break;
145 }
146 return 0; 165 return 0;
147 } 166 }
148 return -1; 167 return -1;