Lines Matching refs:lport

73 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev);
74 static int bnx2fc_lport_config(struct fc_lport *lport);
75 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba);
93 static void bnx2fc_port_shutdown(struct fc_lport *lport);
108 static inline struct net_device *bnx2fc_netdev(const struct fc_lport *lport) in bnx2fc_netdev() argument
111 ((struct fcoe_port *)lport_priv(lport))->priv)->netdev; in bnx2fc_netdev()
158 static void bnx2fc_abort_io(struct fc_lport *lport) in bnx2fc_abort_io() argument
168 static void bnx2fc_cleanup(struct fc_lport *lport) in bnx2fc_cleanup() argument
170 struct fcoe_port *port = lport_priv(lport); in bnx2fc_cleanup()
243 static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp) in bnx2fc_xmit() argument
261 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_xmit()
269 if (!lport->link_up) { in bnx2fc_xmit()
270 BNX2FC_HBA_DBG(lport, "bnx2fc_xmit link down\n"); in bnx2fc_xmit()
277 BNX2FC_HBA_DBG(lport, "FCF not selected yet!\n"); in bnx2fc_xmit()
281 if (fcoe_ctlr_els_send(ctlr, lport, skb)) in bnx2fc_xmit()
302 BNX2FC_HBA_DBG(lport, "xmit: Frame is for offloaded session " in bnx2fc_xmit()
372 if (lport->seq_offload && fr_max_payload(fp)) { in bnx2fc_xmit()
381 stats = per_cpu_ptr(lport->stats, get_cpu()); in bnx2fc_xmit()
387 fr_dev(fp) = lport; in bnx2fc_xmit()
389 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
391 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
409 struct fc_lport *lport; in bnx2fc_rcv() local
421 lport = ctlr->lp; in bnx2fc_rcv()
423 if (unlikely(lport == NULL)) { in bnx2fc_rcv()
453 fr->fr_dev = lport; in bnx2fc_rcv()
496 struct fc_lport *lport; in bnx2fc_recv_frame() local
509 lport = fr->fr_dev; in bnx2fc_recv_frame()
510 if (unlikely(lport == NULL)) { in bnx2fc_recv_frame()
529 fr_dev(fp) = lport; in bnx2fc_recv_frame()
544 vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
548 BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); in bnx2fc_recv_frame()
578 stats = per_cpu_ptr(lport->stats, smp_processor_id()); in bnx2fc_recv_frame()
591 fc_exch_recv(lport, fp); in bnx2fc_recv_frame()
633 struct fc_lport *lport = shost_priv(shost); in bnx2fc_get_host_stats() local
634 struct fcoe_port *port = lport_priv(lport); in bnx2fc_get_host_stats()
651 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n"); in bnx2fc_get_host_stats()
677 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev) in bnx2fc_shost_config() argument
679 struct fcoe_port *port = lport_priv(lport); in bnx2fc_shost_config()
682 struct Scsi_Host *shost = lport->host; in bnx2fc_shost_config()
689 if (lport->vport) in bnx2fc_shost_config()
695 rc = scsi_add_host(lport->host, dev); in bnx2fc_shost_config()
700 if (!lport->vport) in bnx2fc_shost_config()
701 fc_host_max_npiv_vports(lport->host) = USHRT_MAX; in bnx2fc_shost_config()
702 snprintf(fc_host_symbolic_name(lport->host), 256, in bnx2fc_shost_config()
710 static int bnx2fc_link_ok(struct fc_lport *lport) in bnx2fc_link_ok() argument
712 struct fcoe_port *port = lport_priv(lport); in bnx2fc_link_ok()
742 static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev) in bnx2fc_net_config() argument
750 port = lport_priv(lport); in bnx2fc_net_config()
760 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_net_config()
765 setup_timer(&port->timer, fcoe_queue_timer, (unsigned long) lport); in bnx2fc_net_config()
767 fcoe_link_speed_update(lport); in bnx2fc_net_config()
769 if (!lport->vport) { in bnx2fc_net_config()
773 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn); in bnx2fc_net_config()
774 fc_set_wwnn(lport, wwnn); in bnx2fc_net_config()
780 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn); in bnx2fc_net_config()
781 fc_set_wwpn(lport, wwpn); in bnx2fc_net_config()
812 struct fc_lport *lport; in bnx2fc_indicate_netevent() local
869 lport = ctlr->lp; in bnx2fc_indicate_netevent()
870 BNX2FC_HBA_DBG(lport, "netevent handler - event=%s %ld\n", in bnx2fc_indicate_netevent()
873 fcoe_link_speed_update(lport); in bnx2fc_indicate_netevent()
877 if (link_possible && !bnx2fc_link_ok(lport)) { in bnx2fc_indicate_netevent()
885 fc_set_mfs(lport, BNX2FC_MFS); in bnx2fc_indicate_netevent()
901 mutex_lock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
902 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_indicate_netevent()
905 mutex_unlock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
906 fc_host_port_type(lport->host) = in bnx2fc_indicate_netevent()
908 per_cpu_ptr(lport->stats, in bnx2fc_indicate_netevent()
911 fcoe_clean_pending_queue(lport); in bnx2fc_indicate_netevent()
936 static int bnx2fc_libfc_config(struct fc_lport *lport) in bnx2fc_libfc_config() argument
940 memcpy(&lport->tt, &bnx2fc_libfc_fcn_templ, in bnx2fc_libfc_config()
942 fc_elsct_init(lport); in bnx2fc_libfc_config()
943 fc_exch_init(lport); in bnx2fc_libfc_config()
944 fc_rport_init(lport); in bnx2fc_libfc_config()
945 fc_disc_init(lport); in bnx2fc_libfc_config()
946 fc_disc_config(lport, lport); in bnx2fc_libfc_config()
950 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba) in bnx2fc_em_config() argument
959 if (!fc_exch_mgr_alloc(lport, FC_CLASS_3, fcoe_min_xid, in bnx2fc_em_config()
968 static int bnx2fc_lport_config(struct fc_lport *lport) in bnx2fc_lport_config() argument
970 lport->link_up = 0; in bnx2fc_lport_config()
971 lport->qfull = 0; in bnx2fc_lport_config()
972 lport->max_retry_count = BNX2FC_MAX_RETRY_CNT; in bnx2fc_lport_config()
973 lport->max_rport_retry_count = BNX2FC_MAX_RPORT_RETRY_CNT; in bnx2fc_lport_config()
974 lport->e_d_tov = 2 * 1000; in bnx2fc_lport_config()
975 lport->r_a_tov = 10 * 1000; in bnx2fc_lport_config()
977 lport->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS | in bnx2fc_lport_config()
979 lport->does_npiv = 1; in bnx2fc_lport_config()
981 memset(&lport->rnid_gen, 0, sizeof(struct fc_els_rnid_gen)); in bnx2fc_lport_config()
982 lport->rnid_gen.rnid_atype = BNX2FC_RNID_HBA; in bnx2fc_lport_config()
985 if (fc_lport_init_stats(lport)) in bnx2fc_lport_config()
989 fc_lport_config(lport); in bnx2fc_lport_config()
1027 static void bnx2fc_update_src_mac(struct fc_lport *lport, u8 *addr) in bnx2fc_update_src_mac() argument
1029 struct fcoe_port *port = lport_priv(lport); in bnx2fc_update_src_mac()
1039 static u8 *bnx2fc_get_src_mac(struct fc_lport *lport) in bnx2fc_get_src_mac() argument
1043 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_get_src_mac()
1107 static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport) in bnx2fc_free_vport() argument
1113 if (blport->lport == lport) { in bnx2fc_free_vport()
1144 bnx2fc_free_vport(interface->hba, port->lport); in bnx2fc_vport_destroy()
1145 bnx2fc_port_shutdown(port->lport); in bnx2fc_vport_destroy()
1153 struct fc_lport *lport = vport->dd_data; in bnx2fc_vport_disable() local
1157 fc_fabric_logoff(lport); in bnx2fc_vport_disable()
1159 lport->boot_time = jiffies; in bnx2fc_vport_disable()
1160 fc_fabric_login(lport); in bnx2fc_vport_disable()
1161 fc_vport_setlink(lport); in bnx2fc_vport_disable()
1424 struct fc_lport *lport, *n_port; in bnx2fc_if_create() local
1441 lport = libfc_host_alloc(&bnx2fc_shost_template, sizeof(*port)); in bnx2fc_if_create()
1443 lport = libfc_vport_create(vport, sizeof(*port)); in bnx2fc_if_create()
1445 if (!lport) { in bnx2fc_if_create()
1449 shost = lport->host; in bnx2fc_if_create()
1450 port = lport_priv(lport); in bnx2fc_if_create()
1451 port->lport = lport; in bnx2fc_if_create()
1457 rc = bnx2fc_lport_config(lport); in bnx2fc_if_create()
1464 fc_set_wwnn(lport, vport->node_name); in bnx2fc_if_create()
1465 fc_set_wwpn(lport, vport->port_name); in bnx2fc_if_create()
1468 rc = bnx2fc_net_config(lport, interface->netdev); in bnx2fc_if_create()
1474 rc = bnx2fc_shost_config(lport, parent); in bnx2fc_if_create()
1482 rc = bnx2fc_libfc_config(lport); in bnx2fc_if_create()
1487 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_if_create()
1491 rc = bnx2fc_em_config(lport, hba); in bnx2fc_if_create()
1495 rc = fc_exch_mgr_list_clone(n_port, lport); in bnx2fc_if_create()
1506 blport->lport = lport; in bnx2fc_if_create()
1510 return lport; in bnx2fc_if_create()
1515 scsi_host_put(lport->host); in bnx2fc_if_create()
1532 struct fc_lport *lport = ctlr->lp; in bnx2fc_interface_cleanup() local
1533 struct fcoe_port *port = lport_priv(lport); in bnx2fc_interface_cleanup()
1540 fcoe_clean_pending_queue(lport); in bnx2fc_interface_cleanup()
1544 bnx2fc_free_vport(hba, lport); in bnx2fc_interface_cleanup()
1547 static void bnx2fc_if_destroy(struct fc_lport *lport) in bnx2fc_if_destroy() argument
1551 bnx2fc_clean_rx_queue(lport); in bnx2fc_if_destroy()
1554 fc_remove_host(lport->host); in bnx2fc_if_destroy()
1555 scsi_remove_host(lport->host); in bnx2fc_if_destroy()
1561 fc_exch_mgr_free(lport); in bnx2fc_if_destroy()
1564 fc_lport_free_stats(lport); in bnx2fc_if_destroy()
1567 scsi_host_put(lport->host); in bnx2fc_if_destroy()
1573 struct fc_lport *lport = ctlr->lp; in __bnx2fc_destroy() local
1574 struct fcoe_port *port = lport_priv(lport); in __bnx2fc_destroy()
1624 struct fc_lport *lport; in bnx2fc_destroy_work() local
1627 lport = port->lport; in bnx2fc_destroy_work()
1629 BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n"); in bnx2fc_destroy_work()
1631 bnx2fc_if_destroy(lport); in bnx2fc_destroy_work()
1766 struct fc_lport *lport; in bnx2fc_ulp_start() local
1778 lport = ctlr->lp; in bnx2fc_ulp_start()
1781 lport->tt.frame_send = bnx2fc_xmit; in bnx2fc_ulp_start()
1789 static void bnx2fc_port_shutdown(struct fc_lport *lport) in bnx2fc_port_shutdown() argument
1792 fc_fabric_logoff(lport); in bnx2fc_port_shutdown()
1793 fc_lport_destroy(lport); in bnx2fc_port_shutdown()
1799 struct fc_lport *lport; in bnx2fc_stop() local
1805 lport = ctlr->lp; in bnx2fc_stop()
1806 bnx2fc_port_shutdown(lport); in bnx2fc_stop()
1808 mutex_lock(&lport->lp_mutex); in bnx2fc_stop()
1809 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_stop()
1812 mutex_unlock(&lport->lp_mutex); in bnx2fc_stop()
1813 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_stop()
1815 fcoe_clean_pending_queue(lport); in bnx2fc_stop()
1927 struct fc_lport *lport; in bnx2fc_start_disc() local
1937 lport = ctlr->lp; in bnx2fc_start_disc()
1938 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n"); in bnx2fc_start_disc()
1940 if (!bnx2fc_link_ok(lport) && interface->enabled) { in bnx2fc_start_disc()
1941 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n"); in bnx2fc_start_disc()
1943 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in bnx2fc_start_disc()
1956 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_start_disc()
1959 fc_lport_init(lport); in bnx2fc_start_disc()
1960 fc_fabric_login(lport); in bnx2fc_start_disc()
2053 static uint bnx2fc_npiv_create_vports(struct fc_lport *lport, in bnx2fc_npiv_create_vports() argument
2060 BNX2FC_HBA_DBG(lport, "Exceeded count max of npiv table\n"); in bnx2fc_npiv_create_vports()
2067 BNX2FC_HBA_DBG(lport, "First NPIV table entries invalid.\n"); in bnx2fc_npiv_create_vports()
2081 if (fc_vport_create(lport->host, 0, &vpid)) in bnx2fc_npiv_create_vports()
2084 BNX2FC_HBA_DBG(lport, "Failed to create vport\n"); in bnx2fc_npiv_create_vports()
2095 struct fc_lport *lport; in __bnx2fc_enable() local
2109 lport = ctlr->lp; in __bnx2fc_enable()
2117 if (!lport) in __bnx2fc_enable()
2120 if (!lport->host) in __bnx2fc_enable()
2133 bnx2fc_npiv_create_vports(lport, npiv_tbl); in __bnx2fc_enable()
2220 struct fc_lport *lport; in _bnx2fc_create() local
2296 lport = bnx2fc_if_create(interface, &cdev->dev, 0); in _bnx2fc_create()
2297 if (!lport) { in _bnx2fc_create()
2307 lport->boot_time = jiffies; in _bnx2fc_create()
2310 ctlr->lp = lport; in _bnx2fc_create()
2318 !bnx2fc_link_ok(lport)) { in _bnx2fc_create()
2320 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in _bnx2fc_create()
2324 BNX2FC_HBA_DBG(lport, "create: START DISC\n"); in _bnx2fc_create()
2485 struct fc_lport *lport = shost_priv(shost); in bnx2fc_fcoe_reset() local
2486 fc_lport_reset(lport); in bnx2fc_fcoe_reset()