aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc.h7
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_els.c2
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c116
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_hwi.c39
4 files changed, 101 insertions, 63 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index f2b8875a6863..0578fa0dc14b 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -228,13 +228,16 @@ struct bnx2fc_interface {
228 struct packet_type fip_packet_type; 228 struct packet_type fip_packet_type;
229 struct workqueue_struct *timer_work_queue; 229 struct workqueue_struct *timer_work_queue;
230 struct kref kref; 230 struct kref kref;
231 struct fcoe_ctlr ctlr;
232 u8 vlan_enabled; 231 u8 vlan_enabled;
233 int vlan_id; 232 int vlan_id;
234 bool enabled; 233 bool enabled;
235}; 234};
236 235
237#define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_interface, ctlr) 236#define bnx2fc_from_ctlr(x) \
237 ((struct bnx2fc_interface *)((x) + 1))
238
239#define bnx2fc_to_ctlr(x) \
240 ((struct fcoe_ctlr *)(((struct fcoe_ctlr *)(x)) - 1))
238 241
239struct bnx2fc_lport { 242struct bnx2fc_lport {
240 struct list_head list; 243 struct list_head list;
diff --git a/drivers/scsi/bnx2fc/bnx2fc_els.c b/drivers/scsi/bnx2fc/bnx2fc_els.c
index cf3bdcdefb20..bdbbb13b8534 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_els.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_els.c
@@ -900,7 +900,7 @@ struct fc_seq *bnx2fc_elsct_send(struct fc_lport *lport, u32 did,
900{ 900{
901 struct fcoe_port *port = lport_priv(lport); 901 struct fcoe_port *port = lport_priv(lport);
902 struct bnx2fc_interface *interface = port->priv; 902 struct bnx2fc_interface *interface = port->priv;
903 struct fcoe_ctlr *fip = &interface->ctlr; 903 struct fcoe_ctlr *fip = bnx2fc_to_ctlr(interface);
904 struct fc_frame_header *fh = fc_frame_header_get(fp); 904 struct fc_frame_header *fh = fc_frame_header_get(fp);
905 905
906 switch (op) { 906 switch (op) {
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 1f04c14f7088..cb9bf364170b 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -244,6 +244,7 @@ static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp)
244 struct sk_buff *skb; 244 struct sk_buff *skb;
245 struct fc_frame_header *fh; 245 struct fc_frame_header *fh;
246 struct bnx2fc_interface *interface; 246 struct bnx2fc_interface *interface;
247 struct fcoe_ctlr *ctlr;
247 struct bnx2fc_hba *hba; 248 struct bnx2fc_hba *hba;
248 struct fcoe_port *port; 249 struct fcoe_port *port;
249 struct fcoe_hdr *hp; 250 struct fcoe_hdr *hp;
@@ -256,6 +257,7 @@ static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp)
256 257
257 port = (struct fcoe_port *)lport_priv(lport); 258 port = (struct fcoe_port *)lport_priv(lport);
258 interface = port->priv; 259 interface = port->priv;
260 ctlr = bnx2fc_to_ctlr(interface);
259 hba = interface->hba; 261 hba = interface->hba;
260 262
261 fh = fc_frame_header_get(fp); 263 fh = fc_frame_header_get(fp);
@@ -268,12 +270,12 @@ static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp)
268 } 270 }
269 271
270 if (unlikely(fh->fh_r_ctl == FC_RCTL_ELS_REQ)) { 272 if (unlikely(fh->fh_r_ctl == FC_RCTL_ELS_REQ)) {
271 if (!interface->ctlr.sel_fcf) { 273 if (!ctlr->sel_fcf) {
272 BNX2FC_HBA_DBG(lport, "FCF not selected yet!\n"); 274 BNX2FC_HBA_DBG(lport, "FCF not selected yet!\n");
273 kfree_skb(skb); 275 kfree_skb(skb);
274 return -EINVAL; 276 return -EINVAL;
275 } 277 }
276 if (fcoe_ctlr_els_send(&interface->ctlr, lport, skb)) 278 if (fcoe_ctlr_els_send(ctlr, lport, skb))
277 return 0; 279 return 0;
278 } 280 }
279 281
@@ -346,14 +348,14 @@ static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp)
346 /* fill up mac and fcoe headers */ 348 /* fill up mac and fcoe headers */
347 eh = eth_hdr(skb); 349 eh = eth_hdr(skb);
348 eh->h_proto = htons(ETH_P_FCOE); 350 eh->h_proto = htons(ETH_P_FCOE);
349 if (interface->ctlr.map_dest) 351 if (ctlr->map_dest)
350 fc_fcoe_set_mac(eh->h_dest, fh->fh_d_id); 352 fc_fcoe_set_mac(eh->h_dest, fh->fh_d_id);
351 else 353 else
352 /* insert GW address */ 354 /* insert GW address */
353 memcpy(eh->h_dest, interface->ctlr.dest_addr, ETH_ALEN); 355 memcpy(eh->h_dest, ctlr->dest_addr, ETH_ALEN);
354 356
355 if (unlikely(interface->ctlr.flogi_oxid != FC_XID_UNKNOWN)) 357 if (unlikely(ctlr->flogi_oxid != FC_XID_UNKNOWN))
356 memcpy(eh->h_source, interface->ctlr.ctl_src_addr, ETH_ALEN); 358 memcpy(eh->h_source, ctlr->ctl_src_addr, ETH_ALEN);
357 else 359 else
358 memcpy(eh->h_source, port->data_src_addr, ETH_ALEN); 360 memcpy(eh->h_source, port->data_src_addr, ETH_ALEN);
359 361
@@ -403,6 +405,7 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev,
403{ 405{
404 struct fc_lport *lport; 406 struct fc_lport *lport;
405 struct bnx2fc_interface *interface; 407 struct bnx2fc_interface *interface;
408 struct fcoe_ctlr *ctlr;
406 struct fc_frame_header *fh; 409 struct fc_frame_header *fh;
407 struct fcoe_rcv_info *fr; 410 struct fcoe_rcv_info *fr;
408 struct fcoe_percpu_s *bg; 411 struct fcoe_percpu_s *bg;
@@ -410,7 +413,8 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev,
410 413
411 interface = container_of(ptype, struct bnx2fc_interface, 414 interface = container_of(ptype, struct bnx2fc_interface,
412 fcoe_packet_type); 415 fcoe_packet_type);
413 lport = interface->ctlr.lp; 416 ctlr = bnx2fc_to_ctlr(interface);
417 lport = ctlr->lp;
414 418
415 if (unlikely(lport == NULL)) { 419 if (unlikely(lport == NULL)) {
416 printk(KERN_ERR PFX "bnx2fc_rcv: lport is NULL\n"); 420 printk(KERN_ERR PFX "bnx2fc_rcv: lport is NULL\n");
@@ -758,11 +762,13 @@ static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev)
758{ 762{
759 struct bnx2fc_hba *hba; 763 struct bnx2fc_hba *hba;
760 struct bnx2fc_interface *interface; 764 struct bnx2fc_interface *interface;
765 struct fcoe_ctlr *ctlr;
761 struct fcoe_port *port; 766 struct fcoe_port *port;
762 u64 wwnn, wwpn; 767 u64 wwnn, wwpn;
763 768
764 port = lport_priv(lport); 769 port = lport_priv(lport);
765 interface = port->priv; 770 interface = port->priv;
771 ctlr = bnx2fc_to_ctlr(interface);
766 hba = interface->hba; 772 hba = interface->hba;
767 773
768 /* require support for get_pauseparam ethtool op. */ 774 /* require support for get_pauseparam ethtool op. */
@@ -781,13 +787,13 @@ static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev)
781 787
782 if (!lport->vport) { 788 if (!lport->vport) {
783 if (fcoe_get_wwn(netdev, &wwnn, NETDEV_FCOE_WWNN)) 789 if (fcoe_get_wwn(netdev, &wwnn, NETDEV_FCOE_WWNN))
784 wwnn = fcoe_wwn_from_mac(interface->ctlr.ctl_src_addr, 790 wwnn = fcoe_wwn_from_mac(ctlr->ctl_src_addr,
785 1, 0); 791 1, 0);
786 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn); 792 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn);
787 fc_set_wwnn(lport, wwnn); 793 fc_set_wwnn(lport, wwnn);
788 794
789 if (fcoe_get_wwn(netdev, &wwpn, NETDEV_FCOE_WWPN)) 795 if (fcoe_get_wwn(netdev, &wwpn, NETDEV_FCOE_WWPN))
790 wwpn = fcoe_wwn_from_mac(interface->ctlr.ctl_src_addr, 796 wwpn = fcoe_wwn_from_mac(ctlr->ctl_src_addr,
791 2, 0); 797 2, 0);
792 798
793 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn); 799 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn);
@@ -824,6 +830,7 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
824 struct fc_lport *lport; 830 struct fc_lport *lport;
825 struct fc_lport *vport; 831 struct fc_lport *vport;
826 struct bnx2fc_interface *interface, *tmp; 832 struct bnx2fc_interface *interface, *tmp;
833 struct fcoe_ctlr *ctlr;
827 int wait_for_upload = 0; 834 int wait_for_upload = 0;
828 u32 link_possible = 1; 835 u32 link_possible = 1;
829 836
@@ -874,7 +881,8 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
874 if (interface->hba != hba) 881 if (interface->hba != hba)
875 continue; 882 continue;
876 883
877 lport = interface->ctlr.lp; 884 ctlr = bnx2fc_to_ctlr(interface);
885 lport = ctlr->lp;
878 BNX2FC_HBA_DBG(lport, "netevent handler - event=%s %ld\n", 886 BNX2FC_HBA_DBG(lport, "netevent handler - event=%s %ld\n",
879 interface->netdev->name, event); 887 interface->netdev->name, event);
880 888
@@ -889,8 +897,8 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
889 * on a stale vlan 897 * on a stale vlan
890 */ 898 */
891 if (interface->enabled) 899 if (interface->enabled)
892 fcoe_ctlr_link_up(&interface->ctlr); 900 fcoe_ctlr_link_up(ctlr);
893 } else if (fcoe_ctlr_link_down(&interface->ctlr)) { 901 } else if (fcoe_ctlr_link_down(ctlr)) {
894 mutex_lock(&lport->lp_mutex); 902 mutex_lock(&lport->lp_mutex);
895 list_for_each_entry(vport, &lport->vports, list) 903 list_for_each_entry(vport, &lport->vports, list)
896 fc_host_port_type(vport->host) = 904 fc_host_port_type(vport->host) =
@@ -995,9 +1003,11 @@ static int bnx2fc_fip_recv(struct sk_buff *skb, struct net_device *dev,
995 struct net_device *orig_dev) 1003 struct net_device *orig_dev)
996{ 1004{
997 struct bnx2fc_interface *interface; 1005 struct bnx2fc_interface *interface;
1006 struct fcoe_ctlr *ctlr;
998 interface = container_of(ptype, struct bnx2fc_interface, 1007 interface = container_of(ptype, struct bnx2fc_interface,
999 fip_packet_type); 1008 fip_packet_type);
1000 fcoe_ctlr_recv(&interface->ctlr, skb); 1009 ctlr = bnx2fc_to_ctlr(interface);
1010 fcoe_ctlr_recv(ctlr, skb);
1001 return 0; 1011 return 0;
1002} 1012}
1003 1013
@@ -1155,6 +1165,7 @@ static int bnx2fc_interface_setup(struct bnx2fc_interface *interface)
1155{ 1165{
1156 struct net_device *netdev = interface->netdev; 1166 struct net_device *netdev = interface->netdev;
1157 struct net_device *physdev = interface->hba->phys_dev; 1167 struct net_device *physdev = interface->hba->phys_dev;
1168 struct fcoe_ctlr *ctlr = bnx2fc_to_ctlr(interface);
1158 struct netdev_hw_addr *ha; 1169 struct netdev_hw_addr *ha;
1159 int sel_san_mac = 0; 1170 int sel_san_mac = 0;
1160 1171
@@ -1169,7 +1180,7 @@ static int bnx2fc_interface_setup(struct bnx2fc_interface *interface)
1169 1180
1170 if ((ha->type == NETDEV_HW_ADDR_T_SAN) && 1181 if ((ha->type == NETDEV_HW_ADDR_T_SAN) &&
1171 (is_valid_ether_addr(ha->addr))) { 1182 (is_valid_ether_addr(ha->addr))) {
1172 memcpy(interface->ctlr.ctl_src_addr, ha->addr, 1183 memcpy(ctlr->ctl_src_addr, ha->addr,
1173 ETH_ALEN); 1184 ETH_ALEN);
1174 sel_san_mac = 1; 1185 sel_san_mac = 1;
1175 BNX2FC_MISC_DBG("Found SAN MAC\n"); 1186 BNX2FC_MISC_DBG("Found SAN MAC\n");
@@ -1225,18 +1236,20 @@ static void bnx2fc_release_transport(void)
1225static void bnx2fc_interface_release(struct kref *kref) 1236static void bnx2fc_interface_release(struct kref *kref)
1226{ 1237{
1227 struct bnx2fc_interface *interface; 1238 struct bnx2fc_interface *interface;
1239 struct fcoe_ctlr *ctlr;
1228 struct net_device *netdev; 1240 struct net_device *netdev;
1229 1241
1230 interface = container_of(kref, struct bnx2fc_interface, kref); 1242 interface = container_of(kref, struct bnx2fc_interface, kref);
1231 BNX2FC_MISC_DBG("Interface is being released\n"); 1243 BNX2FC_MISC_DBG("Interface is being released\n");
1232 1244
1245 ctlr = bnx2fc_to_ctlr(interface);
1233 netdev = interface->netdev; 1246 netdev = interface->netdev;
1234 1247
1235 /* tear-down FIP controller */ 1248 /* tear-down FIP controller */
1236 if (test_and_clear_bit(BNX2FC_CTLR_INIT_DONE, &interface->if_flags)) 1249 if (test_and_clear_bit(BNX2FC_CTLR_INIT_DONE, &interface->if_flags))
1237 fcoe_ctlr_destroy(&interface->ctlr); 1250 fcoe_ctlr_destroy(ctlr);
1238 1251
1239 kfree(interface); 1252 kfree(ctlr);
1240 1253
1241 dev_put(netdev); 1254 dev_put(netdev);
1242 module_put(THIS_MODULE); 1255 module_put(THIS_MODULE);
@@ -1330,32 +1343,36 @@ struct bnx2fc_interface *bnx2fc_interface_create(struct bnx2fc_hba *hba,
1330 enum fip_state fip_mode) 1343 enum fip_state fip_mode)
1331{ 1344{
1332 struct bnx2fc_interface *interface; 1345 struct bnx2fc_interface *interface;
1346 struct fcoe_ctlr *ctlr;
1347 int size;
1333 int rc = 0; 1348 int rc = 0;
1334 1349
1335 interface = kzalloc(sizeof(*interface), GFP_KERNEL); 1350 size = (sizeof(*interface) + sizeof(struct fcoe_ctlr));
1336 if (!interface) { 1351 ctlr = kzalloc(size, GFP_KERNEL);
1352 if (!ctlr) {
1337 printk(KERN_ERR PFX "Unable to allocate interface structure\n"); 1353 printk(KERN_ERR PFX "Unable to allocate interface structure\n");
1338 return NULL; 1354 return NULL;
1339 } 1355 }
1356 interface = fcoe_ctlr_priv(ctlr);
1340 dev_hold(netdev); 1357 dev_hold(netdev);
1341 kref_init(&interface->kref); 1358 kref_init(&interface->kref);
1342 interface->hba = hba; 1359 interface->hba = hba;
1343 interface->netdev = netdev; 1360 interface->netdev = netdev;
1344 1361
1345 /* Initialize FIP */ 1362 /* Initialize FIP */
1346 fcoe_ctlr_init(&interface->ctlr, fip_mode); 1363 fcoe_ctlr_init(ctlr, fip_mode);
1347 interface->ctlr.send = bnx2fc_fip_send; 1364 ctlr->send = bnx2fc_fip_send;
1348 interface->ctlr.update_mac = bnx2fc_update_src_mac; 1365 ctlr->update_mac = bnx2fc_update_src_mac;
1349 interface->ctlr.get_src_addr = bnx2fc_get_src_mac; 1366 ctlr->get_src_addr = bnx2fc_get_src_mac;
1350 set_bit(BNX2FC_CTLR_INIT_DONE, &interface->if_flags); 1367 set_bit(BNX2FC_CTLR_INIT_DONE, &interface->if_flags);
1351 1368
1352 rc = bnx2fc_interface_setup(interface); 1369 rc = bnx2fc_interface_setup(interface);
1353 if (!rc) 1370 if (!rc)
1354 return interface; 1371 return interface;
1355 1372
1356 fcoe_ctlr_destroy(&interface->ctlr); 1373 fcoe_ctlr_destroy(ctlr);
1357 dev_put(netdev); 1374 dev_put(netdev);
1358 kfree(interface); 1375 kfree(ctlr);
1359 return NULL; 1376 return NULL;
1360} 1377}
1361 1378
@@ -1373,6 +1390,7 @@ struct bnx2fc_interface *bnx2fc_interface_create(struct bnx2fc_hba *hba,
1373static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface, 1390static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
1374 struct device *parent, int npiv) 1391 struct device *parent, int npiv)
1375{ 1392{
1393 struct fcoe_ctlr *ctlr = bnx2fc_to_ctlr(interface);
1376 struct fc_lport *lport, *n_port; 1394 struct fc_lport *lport, *n_port;
1377 struct fcoe_port *port; 1395 struct fcoe_port *port;
1378 struct Scsi_Host *shost; 1396 struct Scsi_Host *shost;
@@ -1383,7 +1401,7 @@ static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
1383 1401
1384 blport = kzalloc(sizeof(struct bnx2fc_lport), GFP_KERNEL); 1402 blport = kzalloc(sizeof(struct bnx2fc_lport), GFP_KERNEL);
1385 if (!blport) { 1403 if (!blport) {
1386 BNX2FC_HBA_DBG(interface->ctlr.lp, "Unable to alloc blport\n"); 1404 BNX2FC_HBA_DBG(ctlr->lp, "Unable to alloc blport\n");
1387 return NULL; 1405 return NULL;
1388 } 1406 }
1389 1407
@@ -1479,7 +1497,8 @@ static void bnx2fc_net_cleanup(struct bnx2fc_interface *interface)
1479 1497
1480static void bnx2fc_interface_cleanup(struct bnx2fc_interface *interface) 1498static void bnx2fc_interface_cleanup(struct bnx2fc_interface *interface)
1481{ 1499{
1482 struct fc_lport *lport = interface->ctlr.lp; 1500 struct fcoe_ctlr *ctlr = bnx2fc_to_ctlr(interface);
1501 struct fc_lport *lport = ctlr->lp;
1483 struct fcoe_port *port = lport_priv(lport); 1502 struct fcoe_port *port = lport_priv(lport);
1484 struct bnx2fc_hba *hba = interface->hba; 1503 struct bnx2fc_hba *hba = interface->hba;
1485 1504
@@ -1519,7 +1538,8 @@ static void bnx2fc_if_destroy(struct fc_lport *lport)
1519 1538
1520static void __bnx2fc_destroy(struct bnx2fc_interface *interface) 1539static void __bnx2fc_destroy(struct bnx2fc_interface *interface)
1521{ 1540{
1522 struct fc_lport *lport = interface->ctlr.lp; 1541 struct fcoe_ctlr *ctlr = bnx2fc_to_ctlr(interface);
1542 struct fc_lport *lport = ctlr->lp;
1523 struct fcoe_port *port = lport_priv(lport); 1543 struct fcoe_port *port = lport_priv(lport);
1524 1544
1525 bnx2fc_interface_cleanup(interface); 1545 bnx2fc_interface_cleanup(interface);
@@ -1543,13 +1563,15 @@ static int bnx2fc_destroy(struct net_device *netdev)
1543{ 1563{
1544 struct bnx2fc_interface *interface = NULL; 1564 struct bnx2fc_interface *interface = NULL;
1545 struct workqueue_struct *timer_work_queue; 1565 struct workqueue_struct *timer_work_queue;
1566 struct fcoe_ctlr *ctlr;
1546 int rc = 0; 1567 int rc = 0;
1547 1568
1548 rtnl_lock(); 1569 rtnl_lock();
1549 mutex_lock(&bnx2fc_dev_lock); 1570 mutex_lock(&bnx2fc_dev_lock);
1550 1571
1551 interface = bnx2fc_interface_lookup(netdev); 1572 interface = bnx2fc_interface_lookup(netdev);
1552 if (!interface || !interface->ctlr.lp) { 1573 ctlr = bnx2fc_to_ctlr(interface);
1574 if (!interface || !ctlr->lp) {
1553 rc = -ENODEV; 1575 rc = -ENODEV;
1554 printk(KERN_ERR PFX "bnx2fc_destroy: interface or lport not found\n"); 1576 printk(KERN_ERR PFX "bnx2fc_destroy: interface or lport not found\n");
1555 goto netdev_err; 1577 goto netdev_err;
@@ -1646,6 +1668,7 @@ static void bnx2fc_ulp_start(void *handle)
1646{ 1668{
1647 struct bnx2fc_hba *hba = handle; 1669 struct bnx2fc_hba *hba = handle;
1648 struct bnx2fc_interface *interface; 1670 struct bnx2fc_interface *interface;
1671 struct fcoe_ctlr *ctlr;
1649 struct fc_lport *lport; 1672 struct fc_lport *lport;
1650 1673
1651 mutex_lock(&bnx2fc_dev_lock); 1674 mutex_lock(&bnx2fc_dev_lock);
@@ -1657,7 +1680,8 @@ static void bnx2fc_ulp_start(void *handle)
1657 1680
1658 list_for_each_entry(interface, &if_list, list) { 1681 list_for_each_entry(interface, &if_list, list) {
1659 if (interface->hba == hba) { 1682 if (interface->hba == hba) {
1660 lport = interface->ctlr.lp; 1683 ctlr = bnx2fc_to_ctlr(interface);
1684 lport = ctlr->lp;
1661 /* Kick off Fabric discovery*/ 1685 /* Kick off Fabric discovery*/
1662 printk(KERN_ERR PFX "ulp_init: start discovery\n"); 1686 printk(KERN_ERR PFX "ulp_init: start discovery\n");
1663 lport->tt.frame_send = bnx2fc_xmit; 1687 lport->tt.frame_send = bnx2fc_xmit;
@@ -1677,13 +1701,14 @@ static void bnx2fc_port_shutdown(struct fc_lport *lport)
1677 1701
1678static void bnx2fc_stop(struct bnx2fc_interface *interface) 1702static void bnx2fc_stop(struct bnx2fc_interface *interface)
1679{ 1703{
1704 struct fcoe_ctlr *ctlr = bnx2fc_to_ctlr(interface);
1680 struct fc_lport *lport; 1705 struct fc_lport *lport;
1681 struct fc_lport *vport; 1706 struct fc_lport *vport;
1682 1707
1683 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) 1708 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags))
1684 return; 1709 return;
1685 1710
1686 lport = interface->ctlr.lp; 1711 lport = ctlr->lp;
1687 bnx2fc_port_shutdown(lport); 1712 bnx2fc_port_shutdown(lport);
1688 1713
1689 mutex_lock(&lport->lp_mutex); 1714 mutex_lock(&lport->lp_mutex);
@@ -1692,7 +1717,7 @@ static void bnx2fc_stop(struct bnx2fc_interface *interface)
1692 FC_PORTTYPE_UNKNOWN; 1717 FC_PORTTYPE_UNKNOWN;
1693 mutex_unlock(&lport->lp_mutex); 1718 mutex_unlock(&lport->lp_mutex);
1694 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; 1719 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN;
1695 fcoe_ctlr_link_down(&interface->ctlr); 1720 fcoe_ctlr_link_down(ctlr);
1696 fcoe_clean_pending_queue(lport); 1721 fcoe_clean_pending_queue(lport);
1697} 1722}
1698 1723
@@ -1804,6 +1829,7 @@ exit:
1804 1829
1805static void bnx2fc_start_disc(struct bnx2fc_interface *interface) 1830static void bnx2fc_start_disc(struct bnx2fc_interface *interface)
1806{ 1831{
1832 struct fcoe_ctlr *ctlr = bnx2fc_to_ctlr(interface);
1807 struct fc_lport *lport; 1833 struct fc_lport *lport;
1808 int wait_cnt = 0; 1834 int wait_cnt = 0;
1809 1835
@@ -1814,18 +1840,18 @@ static void bnx2fc_start_disc(struct bnx2fc_interface *interface)
1814 return; 1840 return;
1815 } 1841 }
1816 1842
1817 lport = interface->ctlr.lp; 1843 lport = ctlr->lp;
1818 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n"); 1844 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n");
1819 1845
1820 if (!bnx2fc_link_ok(lport) && interface->enabled) { 1846 if (!bnx2fc_link_ok(lport) && interface->enabled) {
1821 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n"); 1847 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n");
1822 fcoe_ctlr_link_up(&interface->ctlr); 1848 fcoe_ctlr_link_up(ctlr);
1823 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; 1849 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT;
1824 set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state); 1850 set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state);
1825 } 1851 }
1826 1852
1827 /* wait for the FCF to be selected before issuing FLOGI */ 1853 /* wait for the FCF to be selected before issuing FLOGI */
1828 while (!interface->ctlr.sel_fcf) { 1854 while (!ctlr->sel_fcf) {
1829 msleep(250); 1855 msleep(250);
1830 /* give up after 3 secs */ 1856 /* give up after 3 secs */
1831 if (++wait_cnt > 12) 1857 if (++wait_cnt > 12)
@@ -1889,19 +1915,21 @@ static void bnx2fc_ulp_init(struct cnic_dev *dev)
1889static int bnx2fc_disable(struct net_device *netdev) 1915static int bnx2fc_disable(struct net_device *netdev)
1890{ 1916{
1891 struct bnx2fc_interface *interface; 1917 struct bnx2fc_interface *interface;
1918 struct fcoe_ctlr *ctlr;
1892 int rc = 0; 1919 int rc = 0;
1893 1920
1894 rtnl_lock(); 1921 rtnl_lock();
1895 mutex_lock(&bnx2fc_dev_lock); 1922 mutex_lock(&bnx2fc_dev_lock);
1896 1923
1897 interface = bnx2fc_interface_lookup(netdev); 1924 interface = bnx2fc_interface_lookup(netdev);
1898 if (!interface || !interface->ctlr.lp) { 1925 ctlr = bnx2fc_to_ctlr(interface);
1926 if (!interface || !ctlr->lp) {
1899 rc = -ENODEV; 1927 rc = -ENODEV;
1900 printk(KERN_ERR PFX "bnx2fc_disable: interface or lport not found\n"); 1928 printk(KERN_ERR PFX "bnx2fc_disable: interface or lport not found\n");
1901 } else { 1929 } else {
1902 interface->enabled = false; 1930 interface->enabled = false;
1903 fcoe_ctlr_link_down(&interface->ctlr); 1931 fcoe_ctlr_link_down(ctlr);
1904 fcoe_clean_pending_queue(interface->ctlr.lp); 1932 fcoe_clean_pending_queue(ctlr->lp);
1905 } 1933 }
1906 1934
1907 mutex_unlock(&bnx2fc_dev_lock); 1935 mutex_unlock(&bnx2fc_dev_lock);
@@ -1913,17 +1941,19 @@ static int bnx2fc_disable(struct net_device *netdev)
1913static int bnx2fc_enable(struct net_device *netdev) 1941static int bnx2fc_enable(struct net_device *netdev)
1914{ 1942{
1915 struct bnx2fc_interface *interface; 1943 struct bnx2fc_interface *interface;
1944 struct fcoe_ctlr *ctlr;
1916 int rc = 0; 1945 int rc = 0;
1917 1946
1918 rtnl_lock(); 1947 rtnl_lock();
1919 mutex_lock(&bnx2fc_dev_lock); 1948 mutex_lock(&bnx2fc_dev_lock);
1920 1949
1921 interface = bnx2fc_interface_lookup(netdev); 1950 interface = bnx2fc_interface_lookup(netdev);
1922 if (!interface || !interface->ctlr.lp) { 1951 ctlr = bnx2fc_to_ctlr(interface);
1952 if (!interface || !ctlr->lp) {
1923 rc = -ENODEV; 1953 rc = -ENODEV;
1924 printk(KERN_ERR PFX "bnx2fc_enable: interface or lport not found\n"); 1954 printk(KERN_ERR PFX "bnx2fc_enable: interface or lport not found\n");
1925 } else if (!bnx2fc_link_ok(interface->ctlr.lp)) { 1955 } else if (!bnx2fc_link_ok(ctlr->lp)) {
1926 fcoe_ctlr_link_up(&interface->ctlr); 1956 fcoe_ctlr_link_up(ctlr);
1927 interface->enabled = true; 1957 interface->enabled = true;
1928 } 1958 }
1929 1959
@@ -1944,6 +1974,7 @@ static int bnx2fc_enable(struct net_device *netdev)
1944 */ 1974 */
1945static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode) 1975static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
1946{ 1976{
1977 struct fcoe_ctlr *ctlr;
1947 struct bnx2fc_interface *interface; 1978 struct bnx2fc_interface *interface;
1948 struct bnx2fc_hba *hba; 1979 struct bnx2fc_hba *hba;
1949 struct net_device *phys_dev; 1980 struct net_device *phys_dev;
@@ -2010,6 +2041,7 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
2010 goto ifput_err; 2041 goto ifput_err;
2011 } 2042 }
2012 2043
2044 ctlr = bnx2fc_to_ctlr(interface);
2013 interface->vlan_id = vlan_id; 2045 interface->vlan_id = vlan_id;
2014 interface->vlan_enabled = 1; 2046 interface->vlan_enabled = 1;
2015 2047
@@ -2035,10 +2067,10 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
2035 lport->boot_time = jiffies; 2067 lport->boot_time = jiffies;
2036 2068
2037 /* Make this master N_port */ 2069 /* Make this master N_port */
2038 interface->ctlr.lp = lport; 2070 ctlr->lp = lport;
2039 2071
2040 if (!bnx2fc_link_ok(lport)) { 2072 if (!bnx2fc_link_ok(lport)) {
2041 fcoe_ctlr_link_up(&interface->ctlr); 2073 fcoe_ctlr_link_up(ctlr);
2042 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; 2074 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT;
2043 set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state); 2075 set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state);
2044 } 2076 }
diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
index afd570962b8c..2ca6bfe4ce5e 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
@@ -167,6 +167,7 @@ int bnx2fc_send_session_ofld_req(struct fcoe_port *port,
167{ 167{
168 struct fc_lport *lport = port->lport; 168 struct fc_lport *lport = port->lport;
169 struct bnx2fc_interface *interface = port->priv; 169 struct bnx2fc_interface *interface = port->priv;
170 struct fcoe_ctlr *ctlr = bnx2fc_to_ctlr(interface);
170 struct bnx2fc_hba *hba = interface->hba; 171 struct bnx2fc_hba *hba = interface->hba;
171 struct kwqe *kwqe_arr[4]; 172 struct kwqe *kwqe_arr[4];
172 struct fcoe_kwqe_conn_offload1 ofld_req1; 173 struct fcoe_kwqe_conn_offload1 ofld_req1;
@@ -314,13 +315,13 @@ int bnx2fc_send_session_ofld_req(struct fcoe_port *port,
314 ofld_req4.src_mac_addr_mid[1] = port->data_src_addr[2]; 315 ofld_req4.src_mac_addr_mid[1] = port->data_src_addr[2];
315 ofld_req4.src_mac_addr_hi[0] = port->data_src_addr[1]; 316 ofld_req4.src_mac_addr_hi[0] = port->data_src_addr[1];
316 ofld_req4.src_mac_addr_hi[1] = port->data_src_addr[0]; 317 ofld_req4.src_mac_addr_hi[1] = port->data_src_addr[0];
317 ofld_req4.dst_mac_addr_lo[0] = interface->ctlr.dest_addr[5]; 318 ofld_req4.dst_mac_addr_lo[0] = ctlr->dest_addr[5];
318 /* fcf mac */ 319 /* fcf mac */
319 ofld_req4.dst_mac_addr_lo[1] = interface->ctlr.dest_addr[4]; 320 ofld_req4.dst_mac_addr_lo[1] = ctlr->dest_addr[4];
320 ofld_req4.dst_mac_addr_mid[0] = interface->ctlr.dest_addr[3]; 321 ofld_req4.dst_mac_addr_mid[0] = ctlr->dest_addr[3];
321 ofld_req4.dst_mac_addr_mid[1] = interface->ctlr.dest_addr[2]; 322 ofld_req4.dst_mac_addr_mid[1] = ctlr->dest_addr[2];
322 ofld_req4.dst_mac_addr_hi[0] = interface->ctlr.dest_addr[1]; 323 ofld_req4.dst_mac_addr_hi[0] = ctlr->dest_addr[1];
323 ofld_req4.dst_mac_addr_hi[1] = interface->ctlr.dest_addr[0]; 324 ofld_req4.dst_mac_addr_hi[1] = ctlr->dest_addr[0];
324 325
325 ofld_req4.lcq_addr_lo = (u32) tgt->lcq_dma; 326 ofld_req4.lcq_addr_lo = (u32) tgt->lcq_dma;
326 ofld_req4.lcq_addr_hi = (u32)((u64) tgt->lcq_dma >> 32); 327 ofld_req4.lcq_addr_hi = (u32)((u64) tgt->lcq_dma >> 32);
@@ -351,6 +352,7 @@ static int bnx2fc_send_session_enable_req(struct fcoe_port *port,
351{ 352{
352 struct kwqe *kwqe_arr[2]; 353 struct kwqe *kwqe_arr[2];
353 struct bnx2fc_interface *interface = port->priv; 354 struct bnx2fc_interface *interface = port->priv;
355 struct fcoe_ctlr *ctlr = bnx2fc_to_ctlr(interface);
354 struct bnx2fc_hba *hba = interface->hba; 356 struct bnx2fc_hba *hba = interface->hba;
355 struct fcoe_kwqe_conn_enable_disable enbl_req; 357 struct fcoe_kwqe_conn_enable_disable enbl_req;
356 struct fc_lport *lport = port->lport; 358 struct fc_lport *lport = port->lport;
@@ -374,12 +376,12 @@ static int bnx2fc_send_session_enable_req(struct fcoe_port *port,
374 enbl_req.src_mac_addr_hi[1] = port->data_src_addr[0]; 376 enbl_req.src_mac_addr_hi[1] = port->data_src_addr[0];
375 memcpy(tgt->src_addr, port->data_src_addr, ETH_ALEN); 377 memcpy(tgt->src_addr, port->data_src_addr, ETH_ALEN);
376 378
377 enbl_req.dst_mac_addr_lo[0] = interface->ctlr.dest_addr[5]; 379 enbl_req.dst_mac_addr_lo[0] = ctlr->dest_addr[5];
378 enbl_req.dst_mac_addr_lo[1] = interface->ctlr.dest_addr[4]; 380 enbl_req.dst_mac_addr_lo[1] = ctlr->dest_addr[4];
379 enbl_req.dst_mac_addr_mid[0] = interface->ctlr.dest_addr[3]; 381 enbl_req.dst_mac_addr_mid[0] = ctlr->dest_addr[3];
380 enbl_req.dst_mac_addr_mid[1] = interface->ctlr.dest_addr[2]; 382 enbl_req.dst_mac_addr_mid[1] = ctlr->dest_addr[2];
381 enbl_req.dst_mac_addr_hi[0] = interface->ctlr.dest_addr[1]; 383 enbl_req.dst_mac_addr_hi[0] = ctlr->dest_addr[1];
382 enbl_req.dst_mac_addr_hi[1] = interface->ctlr.dest_addr[0]; 384 enbl_req.dst_mac_addr_hi[1] = ctlr->dest_addr[0];
383 385
384 port_id = fc_host_port_id(lport->host); 386 port_id = fc_host_port_id(lport->host);
385 if (port_id != tgt->sid) { 387 if (port_id != tgt->sid) {
@@ -419,6 +421,7 @@ int bnx2fc_send_session_disable_req(struct fcoe_port *port,
419 struct bnx2fc_rport *tgt) 421 struct bnx2fc_rport *tgt)
420{ 422{
421 struct bnx2fc_interface *interface = port->priv; 423 struct bnx2fc_interface *interface = port->priv;
424 struct fcoe_ctlr *ctlr = bnx2fc_to_ctlr(interface);
422 struct bnx2fc_hba *hba = interface->hba; 425 struct bnx2fc_hba *hba = interface->hba;
423 struct fcoe_kwqe_conn_enable_disable disable_req; 426 struct fcoe_kwqe_conn_enable_disable disable_req;
424 struct kwqe *kwqe_arr[2]; 427 struct kwqe *kwqe_arr[2];
@@ -440,12 +443,12 @@ int bnx2fc_send_session_disable_req(struct fcoe_port *port,
440 disable_req.src_mac_addr_hi[0] = tgt->src_addr[1]; 443 disable_req.src_mac_addr_hi[0] = tgt->src_addr[1];
441 disable_req.src_mac_addr_hi[1] = tgt->src_addr[0]; 444 disable_req.src_mac_addr_hi[1] = tgt->src_addr[0];
442 445
443 disable_req.dst_mac_addr_lo[0] = interface->ctlr.dest_addr[5]; 446 disable_req.dst_mac_addr_lo[0] = ctlr->dest_addr[5];
444 disable_req.dst_mac_addr_lo[1] = interface->ctlr.dest_addr[4]; 447 disable_req.dst_mac_addr_lo[1] = ctlr->dest_addr[4];
445 disable_req.dst_mac_addr_mid[0] = interface->ctlr.dest_addr[3]; 448 disable_req.dst_mac_addr_mid[0] = ctlr->dest_addr[3];
446 disable_req.dst_mac_addr_mid[1] = interface->ctlr.dest_addr[2]; 449 disable_req.dst_mac_addr_mid[1] = ctlr->dest_addr[2];
447 disable_req.dst_mac_addr_hi[0] = interface->ctlr.dest_addr[1]; 450 disable_req.dst_mac_addr_hi[0] = ctlr->dest_addr[1];
448 disable_req.dst_mac_addr_hi[1] = interface->ctlr.dest_addr[0]; 451 disable_req.dst_mac_addr_hi[1] = ctlr->dest_addr[0];
449 452
450 port_id = tgt->sid; 453 port_id = tgt->sid;
451 disable_req.s_id[0] = (port_id & 0x000000FF); 454 disable_req.s_id[0] = (port_id & 0x000000FF);