Lines Matching refs:lport
76 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev);
77 static int bnx2fc_lport_config(struct fc_lport *lport);
78 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba);
96 static void bnx2fc_port_shutdown(struct fc_lport *lport);
133 static inline struct net_device *bnx2fc_netdev(const struct fc_lport *lport) in bnx2fc_netdev() argument
136 ((struct fcoe_port *)lport_priv(lport))->priv)->netdev; in bnx2fc_netdev()
179 static void bnx2fc_abort_io(struct fc_lport *lport) in bnx2fc_abort_io() argument
189 static void bnx2fc_cleanup(struct fc_lport *lport) in bnx2fc_cleanup() argument
191 struct fcoe_port *port = lport_priv(lport); in bnx2fc_cleanup()
264 static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp) in bnx2fc_xmit() argument
282 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_xmit()
290 if (!lport->link_up) { in bnx2fc_xmit()
291 BNX2FC_HBA_DBG(lport, "bnx2fc_xmit link down\n"); in bnx2fc_xmit()
298 BNX2FC_HBA_DBG(lport, "FCF not selected yet!\n"); in bnx2fc_xmit()
302 if (fcoe_ctlr_els_send(ctlr, lport, skb)) in bnx2fc_xmit()
323 BNX2FC_HBA_DBG(lport, "xmit: Frame is for offloaded session " in bnx2fc_xmit()
393 if (lport->seq_offload && fr_max_payload(fp)) { in bnx2fc_xmit()
402 stats = per_cpu_ptr(lport->stats, get_cpu()); in bnx2fc_xmit()
408 fr_dev(fp) = lport; in bnx2fc_xmit()
410 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
412 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
430 struct fc_lport *lport; in bnx2fc_rcv() local
440 lport = ctlr->lp; in bnx2fc_rcv()
442 if (unlikely(lport == NULL)) { in bnx2fc_rcv()
469 fr->fr_dev = lport; in bnx2fc_rcv()
512 struct fc_lport *lport; in bnx2fc_recv_frame() local
527 lport = fr->fr_dev; in bnx2fc_recv_frame()
528 if (unlikely(lport == NULL)) { in bnx2fc_recv_frame()
547 fr_dev(fp) = lport; in bnx2fc_recv_frame()
560 phys_port = lport_priv(lport); in bnx2fc_recv_frame()
567 BNX2FC_HBA_DBG(lport, "FC frame d_id mismatch with MAC %pM.\n", in bnx2fc_recv_frame()
573 vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
577 BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); in bnx2fc_recv_frame()
584 BNX2FC_HBA_DBG(lport, "Wrong source address: mac:%pM dest_addr:%pM.\n", in bnx2fc_recv_frame()
620 if (lport->port_id != ntoh24(fh->fh_d_id) && !vn_port) { in bnx2fc_recv_frame()
621 …BNX2FC_HBA_DBG(lport, "Dropping frame due to destination mismatch: lport->port_id=%x fh->d_id=%x.\… in bnx2fc_recv_frame()
622 lport->port_id, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
627 stats = per_cpu_ptr(lport->stats, smp_processor_id()); in bnx2fc_recv_frame()
640 fc_exch_recv(lport, fp); in bnx2fc_recv_frame()
685 struct fc_lport *lport = shost_priv(shost); in bnx2fc_get_host_stats() local
686 struct fcoe_port *port = lport_priv(lport); in bnx2fc_get_host_stats()
705 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n"); in bnx2fc_get_host_stats()
734 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev) in bnx2fc_shost_config() argument
736 struct fcoe_port *port = lport_priv(lport); in bnx2fc_shost_config()
739 struct Scsi_Host *shost = lport->host; in bnx2fc_shost_config()
746 if (lport->vport) in bnx2fc_shost_config()
752 rc = scsi_add_host(lport->host, dev); in bnx2fc_shost_config()
757 if (!lport->vport) in bnx2fc_shost_config()
758 fc_host_max_npiv_vports(lport->host) = USHRT_MAX; in bnx2fc_shost_config()
759 snprintf(fc_host_symbolic_name(lport->host), 256, in bnx2fc_shost_config()
767 static int bnx2fc_link_ok(struct fc_lport *lport) in bnx2fc_link_ok() argument
769 struct fcoe_port *port = lport_priv(lport); in bnx2fc_link_ok()
799 static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev) in bnx2fc_net_config() argument
807 port = lport_priv(lport); in bnx2fc_net_config()
817 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_net_config()
824 fcoe_link_speed_update(lport); in bnx2fc_net_config()
826 if (!lport->vport) { in bnx2fc_net_config()
830 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn); in bnx2fc_net_config()
831 fc_set_wwnn(lport, wwnn); in bnx2fc_net_config()
837 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn); in bnx2fc_net_config()
838 fc_set_wwpn(lport, wwpn); in bnx2fc_net_config()
869 struct fc_lport *lport; in bnx2fc_indicate_netevent() local
926 lport = ctlr->lp; in bnx2fc_indicate_netevent()
927 BNX2FC_HBA_DBG(lport, "netevent handler - event=%s %ld\n", in bnx2fc_indicate_netevent()
930 fcoe_link_speed_update(lport); in bnx2fc_indicate_netevent()
934 if (link_possible && !bnx2fc_link_ok(lport)) { in bnx2fc_indicate_netevent()
942 fc_set_mfs(lport, BNX2FC_MFS); in bnx2fc_indicate_netevent()
958 mutex_lock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
959 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_indicate_netevent()
962 mutex_unlock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
963 fc_host_port_type(lport->host) = in bnx2fc_indicate_netevent()
965 per_cpu_ptr(lport->stats, in bnx2fc_indicate_netevent()
968 fcoe_clean_pending_queue(lport); in bnx2fc_indicate_netevent()
993 static int bnx2fc_libfc_config(struct fc_lport *lport) in bnx2fc_libfc_config() argument
997 memcpy(&lport->tt, &bnx2fc_libfc_fcn_templ, in bnx2fc_libfc_config()
999 fc_elsct_init(lport); in bnx2fc_libfc_config()
1000 fc_exch_init(lport); in bnx2fc_libfc_config()
1001 fc_disc_init(lport); in bnx2fc_libfc_config()
1002 fc_disc_config(lport, lport); in bnx2fc_libfc_config()
1006 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba) in bnx2fc_em_config() argument
1015 if (!fc_exch_mgr_alloc(lport, FC_CLASS_3, fcoe_min_xid, in bnx2fc_em_config()
1024 static int bnx2fc_lport_config(struct fc_lport *lport) in bnx2fc_lport_config() argument
1026 lport->link_up = 0; in bnx2fc_lport_config()
1027 lport->qfull = 0; in bnx2fc_lport_config()
1028 lport->max_retry_count = BNX2FC_MAX_RETRY_CNT; in bnx2fc_lport_config()
1029 lport->max_rport_retry_count = BNX2FC_MAX_RPORT_RETRY_CNT; in bnx2fc_lport_config()
1030 lport->e_d_tov = 2 * 1000; in bnx2fc_lport_config()
1031 lport->r_a_tov = 10 * 1000; in bnx2fc_lport_config()
1033 lport->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS | in bnx2fc_lport_config()
1035 lport->does_npiv = 1; in bnx2fc_lport_config()
1037 memset(&lport->rnid_gen, 0, sizeof(struct fc_els_rnid_gen)); in bnx2fc_lport_config()
1038 lport->rnid_gen.rnid_atype = BNX2FC_RNID_HBA; in bnx2fc_lport_config()
1041 if (fc_lport_init_stats(lport)) in bnx2fc_lport_config()
1045 fc_lport_config(lport); in bnx2fc_lport_config()
1082 static void bnx2fc_update_src_mac(struct fc_lport *lport, u8 *addr) in bnx2fc_update_src_mac() argument
1084 struct fcoe_port *port = lport_priv(lport); in bnx2fc_update_src_mac()
1094 static u8 *bnx2fc_get_src_mac(struct fc_lport *lport) in bnx2fc_get_src_mac() argument
1098 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_get_src_mac()
1179 static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport) in bnx2fc_free_vport() argument
1185 if (blport->lport == lport) { in bnx2fc_free_vport()
1216 bnx2fc_free_vport(interface->hba, port->lport); in bnx2fc_vport_destroy()
1217 bnx2fc_port_shutdown(port->lport); in bnx2fc_vport_destroy()
1225 struct fc_lport *lport = vport->dd_data; in bnx2fc_vport_disable() local
1229 fc_fabric_logoff(lport); in bnx2fc_vport_disable()
1231 lport->boot_time = jiffies; in bnx2fc_vport_disable()
1232 fc_fabric_login(lport); in bnx2fc_vport_disable()
1233 fc_vport_setlink(lport); in bnx2fc_vport_disable()
1498 struct fc_lport *lport, *n_port; in bnx2fc_if_create() local
1515 lport = libfc_host_alloc(&bnx2fc_shost_template, sizeof(*port)); in bnx2fc_if_create()
1517 lport = libfc_vport_create(vport, sizeof(*port)); in bnx2fc_if_create()
1519 if (!lport) { in bnx2fc_if_create()
1523 shost = lport->host; in bnx2fc_if_create()
1524 port = lport_priv(lport); in bnx2fc_if_create()
1525 port->lport = lport; in bnx2fc_if_create()
1531 rc = bnx2fc_lport_config(lport); in bnx2fc_if_create()
1538 fc_set_wwnn(lport, vport->node_name); in bnx2fc_if_create()
1539 fc_set_wwpn(lport, vport->port_name); in bnx2fc_if_create()
1542 rc = bnx2fc_net_config(lport, interface->netdev); in bnx2fc_if_create()
1548 rc = bnx2fc_shost_config(lport, parent); in bnx2fc_if_create()
1556 rc = bnx2fc_libfc_config(lport); in bnx2fc_if_create()
1561 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_if_create()
1568 rc = bnx2fc_em_config(lport, hba); in bnx2fc_if_create()
1572 rc = fc_exch_mgr_list_clone(n_port, lport); in bnx2fc_if_create()
1583 blport->lport = lport; in bnx2fc_if_create()
1587 return lport; in bnx2fc_if_create()
1592 scsi_host_put(lport->host); in bnx2fc_if_create()
1609 struct fc_lport *lport = ctlr->lp; in bnx2fc_interface_cleanup() local
1610 struct fcoe_port *port = lport_priv(lport); in bnx2fc_interface_cleanup()
1617 fcoe_clean_pending_queue(lport); in bnx2fc_interface_cleanup()
1621 bnx2fc_free_vport(hba, lport); in bnx2fc_interface_cleanup()
1624 static void bnx2fc_if_destroy(struct fc_lport *lport) in bnx2fc_if_destroy() argument
1628 bnx2fc_clean_rx_queue(lport); in bnx2fc_if_destroy()
1631 fc_remove_host(lport->host); in bnx2fc_if_destroy()
1632 scsi_remove_host(lport->host); in bnx2fc_if_destroy()
1638 fc_exch_mgr_free(lport); in bnx2fc_if_destroy()
1641 fc_lport_free_stats(lport); in bnx2fc_if_destroy()
1644 scsi_host_put(lport->host); in bnx2fc_if_destroy()
1650 struct fc_lport *lport = ctlr->lp; in __bnx2fc_destroy() local
1651 struct fcoe_port *port = lport_priv(lport); in __bnx2fc_destroy()
1700 struct fc_lport *lport; in bnx2fc_destroy_work() local
1703 lport = port->lport; in bnx2fc_destroy_work()
1705 BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n"); in bnx2fc_destroy_work()
1707 bnx2fc_if_destroy(lport); in bnx2fc_destroy_work()
1842 struct fc_lport *lport; in bnx2fc_ulp_start() local
1854 lport = ctlr->lp; in bnx2fc_ulp_start()
1857 lport->tt.frame_send = bnx2fc_xmit; in bnx2fc_ulp_start()
1865 static void bnx2fc_port_shutdown(struct fc_lport *lport) in bnx2fc_port_shutdown() argument
1868 fc_fabric_logoff(lport); in bnx2fc_port_shutdown()
1869 fc_lport_destroy(lport); in bnx2fc_port_shutdown()
1875 struct fc_lport *lport; in bnx2fc_stop() local
1881 lport = ctlr->lp; in bnx2fc_stop()
1882 bnx2fc_port_shutdown(lport); in bnx2fc_stop()
1884 mutex_lock(&lport->lp_mutex); in bnx2fc_stop()
1885 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_stop()
1888 mutex_unlock(&lport->lp_mutex); in bnx2fc_stop()
1889 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_stop()
1891 fcoe_clean_pending_queue(lport); in bnx2fc_stop()
2002 struct fc_lport *lport; in bnx2fc_start_disc() local
2012 lport = ctlr->lp; in bnx2fc_start_disc()
2013 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n"); in bnx2fc_start_disc()
2015 if (!bnx2fc_link_ok(lport) && interface->enabled) { in bnx2fc_start_disc()
2016 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n"); in bnx2fc_start_disc()
2018 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in bnx2fc_start_disc()
2031 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_start_disc()
2034 fc_lport_init(lport); in bnx2fc_start_disc()
2035 fc_fabric_login(lport); in bnx2fc_start_disc()
2130 static uint bnx2fc_npiv_create_vports(struct fc_lport *lport, in bnx2fc_npiv_create_vports() argument
2140 BNX2FC_HBA_DBG(lport, "Exceeded count max of npiv table\n"); in bnx2fc_npiv_create_vports()
2147 BNX2FC_HBA_DBG(lport, "First NPIV table entries invalid.\n"); in bnx2fc_npiv_create_vports()
2162 wwnn = lport->wwnn; in bnx2fc_npiv_create_vports()
2171 BNX2FC_HBA_DBG(lport, "Creating vport %s:%s.\n", wwnn_str, in bnx2fc_npiv_create_vports()
2173 if (fc_vport_create(lport->host, 0, &vpid)) in bnx2fc_npiv_create_vports()
2176 BNX2FC_HBA_DBG(lport, "Failed to create vport\n"); in bnx2fc_npiv_create_vports()
2187 struct fc_lport *lport; in __bnx2fc_enable() local
2201 lport = ctlr->lp; in __bnx2fc_enable()
2209 if (!lport) in __bnx2fc_enable()
2212 if (!lport->host) in __bnx2fc_enable()
2225 bnx2fc_npiv_create_vports(lport, npiv_tbl); in __bnx2fc_enable()
2312 struct fc_lport *lport; in _bnx2fc_create() local
2389 lport = bnx2fc_if_create(interface, &cdev->dev, 0); in _bnx2fc_create()
2390 if (!lport) { in _bnx2fc_create()
2400 lport->boot_time = jiffies; in _bnx2fc_create()
2403 ctlr->lp = lport; in _bnx2fc_create()
2411 !bnx2fc_link_ok(lport)) { in _bnx2fc_create()
2413 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in _bnx2fc_create()
2417 BNX2FC_HBA_DBG(lport, "create: START DISC\n"); in _bnx2fc_create()
2583 struct fc_lport *lport = shost_priv(shost); in bnx2fc_fcoe_reset() local
2584 fc_lport_reset(lport); in bnx2fc_fcoe_reset()
2923 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_show() local
2924 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_show()
2936 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_store() local
2937 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_store()