aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fcoe/fcoe_sw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/fcoe/fcoe_sw.c')
-rw-r--r--drivers/scsi/fcoe/fcoe_sw.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/drivers/scsi/fcoe/fcoe_sw.c b/drivers/scsi/fcoe/fcoe_sw.c
index dc4cd5e25760..da210eba1941 100644
--- a/drivers/scsi/fcoe/fcoe_sw.c
+++ b/drivers/scsi/fcoe/fcoe_sw.c
@@ -104,19 +104,19 @@ static struct scsi_host_template fcoe_sw_shost_template = {
104 .max_sectors = 0xffff, 104 .max_sectors = 0xffff,
105}; 105};
106 106
107/* 107/**
108 * fcoe_sw_lport_config - sets up the fc_lport 108 * fcoe_sw_lport_config() - sets up the fc_lport
109 * @lp: ptr to the fc_lport 109 * @lp: ptr to the fc_lport
110 * @shost: ptr to the parent scsi host 110 * @shost: ptr to the parent scsi host
111 * 111 *
112 * Returns: 0 for success 112 * Returns: 0 for success
113 *
114 */ 113 */
115static int fcoe_sw_lport_config(struct fc_lport *lp) 114static int fcoe_sw_lport_config(struct fc_lport *lp)
116{ 115{
117 int i = 0; 116 int i = 0;
118 117
119 lp->link_status = 0; 118 lp->link_up = 0;
119 lp->qfull = 0;
120 lp->max_retry_count = 3; 120 lp->max_retry_count = 3;
121 lp->e_d_tov = 2 * 1000; /* FC-FS default */ 121 lp->e_d_tov = 2 * 1000; /* FC-FS default */
122 lp->r_a_tov = 2 * 2 * 1000; 122 lp->r_a_tov = 2 * 2 * 1000;
@@ -136,16 +136,14 @@ static int fcoe_sw_lport_config(struct fc_lport *lp)
136 return 0; 136 return 0;
137} 137}
138 138
139/* 139/**
140 * fcoe_sw_netdev_config - sets up fcoe_softc for lport and network 140 * fcoe_sw_netdev_config() - Set up netdev for SW FCoE
141 * related properties
142 * @lp : ptr to the fc_lport 141 * @lp : ptr to the fc_lport
143 * @netdev : ptr to the associated netdevice struct 142 * @netdev : ptr to the associated netdevice struct
144 * 143 *
145 * Must be called after fcoe_sw_lport_config() as it will use lport mutex 144 * Must be called after fcoe_sw_lport_config() as it will use lport mutex
146 * 145 *
147 * Returns : 0 for success 146 * Returns : 0 for success
148 *
149 */ 147 */
150static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev) 148static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)
151{ 149{
@@ -181,9 +179,8 @@ static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)
181 if (fc_set_mfs(lp, mfs)) 179 if (fc_set_mfs(lp, mfs))
182 return -EINVAL; 180 return -EINVAL;
183 181
184 lp->link_status = ~FC_PAUSE & ~FC_LINK_UP;
185 if (!fcoe_link_ok(lp)) 182 if (!fcoe_link_ok(lp))
186 lp->link_status |= FC_LINK_UP; 183 lp->link_up = 1;
187 184
188 /* offload features support */ 185 /* offload features support */
189 if (fc->real_dev->features & NETIF_F_SG) 186 if (fc->real_dev->features & NETIF_F_SG)
@@ -191,6 +188,7 @@ static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)
191 188
192 189
193 skb_queue_head_init(&fc->fcoe_pending_queue); 190 skb_queue_head_init(&fc->fcoe_pending_queue);
191 fc->fcoe_pending_queue_active = 0;
194 192
195 /* setup Source Mac Address */ 193 /* setup Source Mac Address */
196 memcpy(fc->ctl_src_addr, fc->real_dev->dev_addr, 194 memcpy(fc->ctl_src_addr, fc->real_dev->dev_addr,
@@ -224,16 +222,15 @@ static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)
224 return 0; 222 return 0;
225} 223}
226 224
227/* 225/**
228 * fcoe_sw_shost_config - sets up fc_lport->host 226 * fcoe_sw_shost_config() - Sets up fc_lport->host
229 * @lp : ptr to the fc_lport 227 * @lp : ptr to the fc_lport
230 * @shost : ptr to the associated scsi host 228 * @shost : ptr to the associated scsi host
231 * @dev : device associated to scsi host 229 * @dev : device associated to scsi host
232 * 230 *
233 * Must be called after fcoe_sw_lport_config) and fcoe_sw_netdev_config() 231 * Must be called after fcoe_sw_lport_config() and fcoe_sw_netdev_config()
234 * 232 *
235 * Returns : 0 for success 233 * Returns : 0 for success
236 *
237 */ 234 */
238static int fcoe_sw_shost_config(struct fc_lport *lp, struct Scsi_Host *shost, 235static int fcoe_sw_shost_config(struct fc_lport *lp, struct Scsi_Host *shost,
239 struct device *dev) 236 struct device *dev)
@@ -261,8 +258,8 @@ static int fcoe_sw_shost_config(struct fc_lport *lp, struct Scsi_Host *shost,
261 return 0; 258 return 0;
262} 259}
263 260
264/* 261/**
265 * fcoe_sw_em_config - allocates em for this lport 262 * fcoe_sw_em_config() - allocates em for this lport
266 * @lp: the port that em is to allocated for 263 * @lp: the port that em is to allocated for
267 * 264 *
268 * Returns : 0 on success 265 * Returns : 0 on success
@@ -279,8 +276,8 @@ static inline int fcoe_sw_em_config(struct fc_lport *lp)
279 return 0; 276 return 0;
280} 277}
281 278
282/* 279/**
283 * fcoe_sw_destroy - FCoE software HBA tear-down function 280 * fcoe_sw_destroy() - FCoE software HBA tear-down function
284 * @netdev: ptr to the associated net_device 281 * @netdev: ptr to the associated net_device
285 * 282 *
286 * Returns: 0 if link is OK for use by FCoE. 283 * Returns: 0 if link is OK for use by FCoE.
@@ -301,7 +298,7 @@ static int fcoe_sw_destroy(struct net_device *netdev)
301 if (!lp) 298 if (!lp)
302 return -ENODEV; 299 return -ENODEV;
303 300
304 fc = fcoe_softc(lp); 301 fc = lport_priv(lp);
305 302
306 /* Logout of the fabric */ 303 /* Logout of the fabric */
307 fc_fabric_logoff(lp); 304 fc_fabric_logoff(lp);
@@ -353,8 +350,8 @@ static struct libfc_function_template fcoe_sw_libfc_fcn_templ = {
353 .frame_send = fcoe_xmit, 350 .frame_send = fcoe_xmit,
354}; 351};
355 352
356/* 353/**
357 * fcoe_sw_create - this function creates the fcoe interface 354 * fcoe_sw_create() - this function creates the fcoe interface
358 * @netdev: pointer the associated netdevice 355 * @netdev: pointer the associated netdevice
359 * 356 *
360 * Creates fc_lport struct and scsi_host for lport, configures lport 357 * Creates fc_lport struct and scsi_host for lport, configures lport
@@ -440,8 +437,8 @@ out_host_put:
440 return rc; 437 return rc;
441} 438}
442 439
443/* 440/**
444 * fcoe_sw_match - the fcoe sw transport match function 441 * fcoe_sw_match() - The FCoE SW transport match function
445 * 442 *
446 * Returns : false always 443 * Returns : false always
447 */ 444 */
@@ -461,8 +458,8 @@ struct fcoe_transport fcoe_sw_transport = {
461 .device = 0xffff, 458 .device = 0xffff,
462}; 459};
463 460
464/* 461/**
465 * fcoe_sw_init - registers fcoe_sw_transport 462 * fcoe_sw_init() - Registers fcoe_sw_transport
466 * 463 *
467 * Returns : 0 on success 464 * Returns : 0 on success
468 */ 465 */
@@ -471,17 +468,22 @@ int __init fcoe_sw_init(void)
471 /* attach to scsi transport */ 468 /* attach to scsi transport */
472 scsi_transport_fcoe_sw = 469 scsi_transport_fcoe_sw =
473 fc_attach_transport(&fcoe_sw_transport_function); 470 fc_attach_transport(&fcoe_sw_transport_function);
471
474 if (!scsi_transport_fcoe_sw) { 472 if (!scsi_transport_fcoe_sw) {
475 printk(KERN_ERR "fcoe_sw_init:fc_attach_transport() failed\n"); 473 printk(KERN_ERR "fcoe_sw_init:fc_attach_transport() failed\n");
476 return -ENODEV; 474 return -ENODEV;
477 } 475 }
476
477 mutex_init(&fcoe_sw_transport.devlock);
478 INIT_LIST_HEAD(&fcoe_sw_transport.devlist);
479
478 /* register sw transport */ 480 /* register sw transport */
479 fcoe_transport_register(&fcoe_sw_transport); 481 fcoe_transport_register(&fcoe_sw_transport);
480 return 0; 482 return 0;
481} 483}
482 484
483/* 485/**
484 * fcoe_sw_exit - unregisters fcoe_sw_transport 486 * fcoe_sw_exit() - Unregisters fcoe_sw_transport
485 * 487 *
486 * Returns : 0 on success 488 * Returns : 0 on success
487 */ 489 */