Lines Matching refs:lport
74 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev);
75 static int bnx2fc_lport_config(struct fc_lport *lport);
76 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba);
94 static void bnx2fc_port_shutdown(struct fc_lport *lport);
131 static inline struct net_device *bnx2fc_netdev(const struct fc_lport *lport) in bnx2fc_netdev() argument
134 ((struct fcoe_port *)lport_priv(lport))->priv)->netdev; in bnx2fc_netdev()
177 static void bnx2fc_abort_io(struct fc_lport *lport) in bnx2fc_abort_io() argument
187 static void bnx2fc_cleanup(struct fc_lport *lport) in bnx2fc_cleanup() argument
189 struct fcoe_port *port = lport_priv(lport); in bnx2fc_cleanup()
262 static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp) in bnx2fc_xmit() argument
280 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_xmit()
288 if (!lport->link_up) { in bnx2fc_xmit()
289 BNX2FC_HBA_DBG(lport, "bnx2fc_xmit link down\n"); in bnx2fc_xmit()
296 BNX2FC_HBA_DBG(lport, "FCF not selected yet!\n"); in bnx2fc_xmit()
300 if (fcoe_ctlr_els_send(ctlr, lport, skb)) in bnx2fc_xmit()
321 BNX2FC_HBA_DBG(lport, "xmit: Frame is for offloaded session " in bnx2fc_xmit()
391 if (lport->seq_offload && fr_max_payload(fp)) { in bnx2fc_xmit()
400 stats = per_cpu_ptr(lport->stats, get_cpu()); in bnx2fc_xmit()
406 fr_dev(fp) = lport; in bnx2fc_xmit()
408 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
410 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
428 struct fc_lport *lport; in bnx2fc_rcv() local
438 lport = ctlr->lp; in bnx2fc_rcv()
440 if (unlikely(lport == NULL)) { in bnx2fc_rcv()
467 fr->fr_dev = lport; in bnx2fc_rcv()
510 struct fc_lport *lport; in bnx2fc_recv_frame() local
525 lport = fr->fr_dev; in bnx2fc_recv_frame()
526 if (unlikely(lport == NULL)) { in bnx2fc_recv_frame()
545 fr_dev(fp) = lport; in bnx2fc_recv_frame()
558 phys_port = lport_priv(lport); in bnx2fc_recv_frame()
565 BNX2FC_HBA_DBG(lport, "FC frame d_id mismatch with MAC %pM.\n", in bnx2fc_recv_frame()
571 vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
575 BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); in bnx2fc_recv_frame()
582 BNX2FC_HBA_DBG(lport, "Wrong source address: mac:%pM dest_addr:%pM.\n", in bnx2fc_recv_frame()
618 if (lport->port_id != ntoh24(fh->fh_d_id) && !vn_port) { in bnx2fc_recv_frame()
619 …BNX2FC_HBA_DBG(lport, "Dropping frame due to destination mismatch: lport->port_id=%x fh->d_id=%x.\… in bnx2fc_recv_frame()
620 lport->port_id, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
625 stats = per_cpu_ptr(lport->stats, smp_processor_id()); in bnx2fc_recv_frame()
638 fc_exch_recv(lport, fp); in bnx2fc_recv_frame()
680 struct fc_lport *lport = shost_priv(shost); in bnx2fc_get_host_stats() local
681 struct fcoe_port *port = lport_priv(lport); in bnx2fc_get_host_stats()
700 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n"); in bnx2fc_get_host_stats()
729 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev) in bnx2fc_shost_config() argument
731 struct fcoe_port *port = lport_priv(lport); in bnx2fc_shost_config()
734 struct Scsi_Host *shost = lport->host; in bnx2fc_shost_config()
741 if (lport->vport) in bnx2fc_shost_config()
747 rc = scsi_add_host(lport->host, dev); in bnx2fc_shost_config()
752 if (!lport->vport) in bnx2fc_shost_config()
753 fc_host_max_npiv_vports(lport->host) = USHRT_MAX; in bnx2fc_shost_config()
754 snprintf(fc_host_symbolic_name(lport->host), 256, in bnx2fc_shost_config()
762 static int bnx2fc_link_ok(struct fc_lport *lport) in bnx2fc_link_ok() argument
764 struct fcoe_port *port = lport_priv(lport); in bnx2fc_link_ok()
794 static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev) in bnx2fc_net_config() argument
802 port = lport_priv(lport); in bnx2fc_net_config()
812 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_net_config()
819 fcoe_link_speed_update(lport); in bnx2fc_net_config()
821 if (!lport->vport) { in bnx2fc_net_config()
825 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn); in bnx2fc_net_config()
826 fc_set_wwnn(lport, wwnn); in bnx2fc_net_config()
832 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn); in bnx2fc_net_config()
833 fc_set_wwpn(lport, wwpn); in bnx2fc_net_config()
864 struct fc_lport *lport; in bnx2fc_indicate_netevent() local
921 lport = ctlr->lp; in bnx2fc_indicate_netevent()
922 BNX2FC_HBA_DBG(lport, "netevent handler - event=%s %ld\n", in bnx2fc_indicate_netevent()
925 fcoe_link_speed_update(lport); in bnx2fc_indicate_netevent()
929 if (link_possible && !bnx2fc_link_ok(lport)) { in bnx2fc_indicate_netevent()
937 fc_set_mfs(lport, BNX2FC_MFS); in bnx2fc_indicate_netevent()
953 mutex_lock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
954 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_indicate_netevent()
957 mutex_unlock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
958 fc_host_port_type(lport->host) = in bnx2fc_indicate_netevent()
960 per_cpu_ptr(lport->stats, in bnx2fc_indicate_netevent()
963 fcoe_clean_pending_queue(lport); in bnx2fc_indicate_netevent()
988 static int bnx2fc_libfc_config(struct fc_lport *lport) in bnx2fc_libfc_config() argument
992 memcpy(&lport->tt, &bnx2fc_libfc_fcn_templ, in bnx2fc_libfc_config()
994 fc_elsct_init(lport); in bnx2fc_libfc_config()
995 fc_exch_init(lport); in bnx2fc_libfc_config()
996 fc_disc_init(lport); in bnx2fc_libfc_config()
997 fc_disc_config(lport, lport); in bnx2fc_libfc_config()
1001 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba) in bnx2fc_em_config() argument
1010 if (!fc_exch_mgr_alloc(lport, FC_CLASS_3, fcoe_min_xid, in bnx2fc_em_config()
1019 static int bnx2fc_lport_config(struct fc_lport *lport) in bnx2fc_lport_config() argument
1021 lport->link_up = 0; in bnx2fc_lport_config()
1022 lport->qfull = 0; in bnx2fc_lport_config()
1023 lport->max_retry_count = BNX2FC_MAX_RETRY_CNT; in bnx2fc_lport_config()
1024 lport->max_rport_retry_count = BNX2FC_MAX_RPORT_RETRY_CNT; in bnx2fc_lport_config()
1025 lport->e_d_tov = 2 * 1000; in bnx2fc_lport_config()
1026 lport->r_a_tov = 10 * 1000; in bnx2fc_lport_config()
1028 lport->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS | in bnx2fc_lport_config()
1030 lport->does_npiv = 1; in bnx2fc_lport_config()
1032 memset(&lport->rnid_gen, 0, sizeof(struct fc_els_rnid_gen)); in bnx2fc_lport_config()
1033 lport->rnid_gen.rnid_atype = BNX2FC_RNID_HBA; in bnx2fc_lport_config()
1036 if (fc_lport_init_stats(lport)) in bnx2fc_lport_config()
1040 fc_lport_config(lport); in bnx2fc_lport_config()
1078 static void bnx2fc_update_src_mac(struct fc_lport *lport, u8 *addr) in bnx2fc_update_src_mac() argument
1080 struct fcoe_port *port = lport_priv(lport); in bnx2fc_update_src_mac()
1090 static u8 *bnx2fc_get_src_mac(struct fc_lport *lport) in bnx2fc_get_src_mac() argument
1094 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_get_src_mac()
1175 static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport) in bnx2fc_free_vport() argument
1181 if (blport->lport == lport) { in bnx2fc_free_vport()
1212 bnx2fc_free_vport(interface->hba, port->lport); in bnx2fc_vport_destroy()
1213 bnx2fc_port_shutdown(port->lport); in bnx2fc_vport_destroy()
1221 struct fc_lport *lport = vport->dd_data; in bnx2fc_vport_disable() local
1225 fc_fabric_logoff(lport); in bnx2fc_vport_disable()
1227 lport->boot_time = jiffies; in bnx2fc_vport_disable()
1228 fc_fabric_login(lport); in bnx2fc_vport_disable()
1229 fc_vport_setlink(lport); in bnx2fc_vport_disable()
1494 struct fc_lport *lport, *n_port; in bnx2fc_if_create() local
1511 lport = libfc_host_alloc(&bnx2fc_shost_template, sizeof(*port)); in bnx2fc_if_create()
1513 lport = libfc_vport_create(vport, sizeof(*port)); in bnx2fc_if_create()
1515 if (!lport) { in bnx2fc_if_create()
1519 shost = lport->host; in bnx2fc_if_create()
1520 port = lport_priv(lport); in bnx2fc_if_create()
1521 port->lport = lport; in bnx2fc_if_create()
1527 rc = bnx2fc_lport_config(lport); in bnx2fc_if_create()
1534 fc_set_wwnn(lport, vport->node_name); in bnx2fc_if_create()
1535 fc_set_wwpn(lport, vport->port_name); in bnx2fc_if_create()
1538 rc = bnx2fc_net_config(lport, interface->netdev); in bnx2fc_if_create()
1544 rc = bnx2fc_shost_config(lport, parent); in bnx2fc_if_create()
1552 rc = bnx2fc_libfc_config(lport); in bnx2fc_if_create()
1557 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_if_create()
1564 rc = bnx2fc_em_config(lport, hba); in bnx2fc_if_create()
1568 rc = fc_exch_mgr_list_clone(n_port, lport); in bnx2fc_if_create()
1579 blport->lport = lport; in bnx2fc_if_create()
1583 return lport; in bnx2fc_if_create()
1588 scsi_host_put(lport->host); in bnx2fc_if_create()
1605 struct fc_lport *lport = ctlr->lp; in bnx2fc_interface_cleanup() local
1606 struct fcoe_port *port = lport_priv(lport); in bnx2fc_interface_cleanup()
1613 fcoe_clean_pending_queue(lport); in bnx2fc_interface_cleanup()
1617 bnx2fc_free_vport(hba, lport); in bnx2fc_interface_cleanup()
1620 static void bnx2fc_if_destroy(struct fc_lport *lport) in bnx2fc_if_destroy() argument
1624 bnx2fc_clean_rx_queue(lport); in bnx2fc_if_destroy()
1627 fc_remove_host(lport->host); in bnx2fc_if_destroy()
1628 scsi_remove_host(lport->host); in bnx2fc_if_destroy()
1634 fc_exch_mgr_free(lport); in bnx2fc_if_destroy()
1637 fc_lport_free_stats(lport); in bnx2fc_if_destroy()
1640 scsi_host_put(lport->host); in bnx2fc_if_destroy()
1646 struct fc_lport *lport = ctlr->lp; in __bnx2fc_destroy() local
1647 struct fcoe_port *port = lport_priv(lport); in __bnx2fc_destroy()
1697 struct fc_lport *lport; in bnx2fc_destroy_work() local
1700 lport = port->lport; in bnx2fc_destroy_work()
1702 BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n"); in bnx2fc_destroy_work()
1704 bnx2fc_if_destroy(lport); in bnx2fc_destroy_work()
1839 struct fc_lport *lport; in bnx2fc_ulp_start() local
1851 lport = ctlr->lp; in bnx2fc_ulp_start()
1854 lport->tt.frame_send = bnx2fc_xmit; in bnx2fc_ulp_start()
1862 static void bnx2fc_port_shutdown(struct fc_lport *lport) in bnx2fc_port_shutdown() argument
1865 fc_fabric_logoff(lport); in bnx2fc_port_shutdown()
1866 fc_lport_destroy(lport); in bnx2fc_port_shutdown()
1872 struct fc_lport *lport; in bnx2fc_stop() local
1878 lport = ctlr->lp; in bnx2fc_stop()
1879 bnx2fc_port_shutdown(lport); in bnx2fc_stop()
1881 mutex_lock(&lport->lp_mutex); in bnx2fc_stop()
1882 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_stop()
1885 mutex_unlock(&lport->lp_mutex); in bnx2fc_stop()
1886 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_stop()
1888 fcoe_clean_pending_queue(lport); in bnx2fc_stop()
1999 struct fc_lport *lport; in bnx2fc_start_disc() local
2009 lport = ctlr->lp; in bnx2fc_start_disc()
2010 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n"); in bnx2fc_start_disc()
2012 if (!bnx2fc_link_ok(lport) && interface->enabled) { in bnx2fc_start_disc()
2013 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n"); in bnx2fc_start_disc()
2015 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in bnx2fc_start_disc()
2028 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_start_disc()
2031 fc_lport_init(lport); in bnx2fc_start_disc()
2032 fc_fabric_login(lport); in bnx2fc_start_disc()
2127 static uint bnx2fc_npiv_create_vports(struct fc_lport *lport, in bnx2fc_npiv_create_vports() argument
2137 BNX2FC_HBA_DBG(lport, "Exceeded count max of npiv table\n"); in bnx2fc_npiv_create_vports()
2144 BNX2FC_HBA_DBG(lport, "First NPIV table entries invalid.\n"); in bnx2fc_npiv_create_vports()
2159 wwnn = lport->wwnn; in bnx2fc_npiv_create_vports()
2168 BNX2FC_HBA_DBG(lport, "Creating vport %s:%s.\n", wwnn_str, in bnx2fc_npiv_create_vports()
2170 if (fc_vport_create(lport->host, 0, &vpid)) in bnx2fc_npiv_create_vports()
2173 BNX2FC_HBA_DBG(lport, "Failed to create vport\n"); in bnx2fc_npiv_create_vports()
2184 struct fc_lport *lport; in __bnx2fc_enable() local
2198 lport = ctlr->lp; in __bnx2fc_enable()
2206 if (!lport) in __bnx2fc_enable()
2209 if (!lport->host) in __bnx2fc_enable()
2222 bnx2fc_npiv_create_vports(lport, npiv_tbl); in __bnx2fc_enable()
2309 struct fc_lport *lport; in _bnx2fc_create() local
2386 lport = bnx2fc_if_create(interface, &cdev->dev, 0); in _bnx2fc_create()
2387 if (!lport) { in _bnx2fc_create()
2397 lport->boot_time = jiffies; in _bnx2fc_create()
2400 ctlr->lp = lport; in _bnx2fc_create()
2408 !bnx2fc_link_ok(lport)) { in _bnx2fc_create()
2410 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in _bnx2fc_create()
2414 BNX2FC_HBA_DBG(lport, "create: START DISC\n"); in _bnx2fc_create()
2580 struct fc_lport *lport = shost_priv(shost); in bnx2fc_fcoe_reset() local
2581 fc_lport_reset(lport); in bnx2fc_fcoe_reset()
2919 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_show() local
2920 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_show()
2932 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_store() local
2933 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_store()