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()
181 static void bnx2fc_abort_io(struct fc_lport *lport) in bnx2fc_abort_io() argument
191 static void bnx2fc_cleanup(struct fc_lport *lport) in bnx2fc_cleanup() argument
193 struct fcoe_port *port = lport_priv(lport); in bnx2fc_cleanup()
266 static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp) in bnx2fc_xmit() argument
284 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_xmit()
292 if (!lport->link_up) { in bnx2fc_xmit()
293 BNX2FC_HBA_DBG(lport, "bnx2fc_xmit link down\n"); in bnx2fc_xmit()
300 BNX2FC_HBA_DBG(lport, "FCF not selected yet!\n"); in bnx2fc_xmit()
304 if (fcoe_ctlr_els_send(ctlr, lport, skb)) in bnx2fc_xmit()
325 BNX2FC_HBA_DBG(lport, "xmit: Frame is for offloaded session " in bnx2fc_xmit()
395 if (lport->seq_offload && fr_max_payload(fp)) { in bnx2fc_xmit()
404 stats = per_cpu_ptr(lport->stats, get_cpu()); in bnx2fc_xmit()
410 fr_dev(fp) = lport; in bnx2fc_xmit()
412 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
414 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
432 struct fc_lport *lport; in bnx2fc_rcv() local
444 lport = ctlr->lp; in bnx2fc_rcv()
446 if (unlikely(lport == NULL)) { in bnx2fc_rcv()
476 fr->fr_dev = lport; in bnx2fc_rcv()
519 struct fc_lport *lport; in bnx2fc_recv_frame() local
534 lport = fr->fr_dev; in bnx2fc_recv_frame()
535 if (unlikely(lport == NULL)) { in bnx2fc_recv_frame()
554 fr_dev(fp) = lport; in bnx2fc_recv_frame()
567 phys_port = lport_priv(lport); in bnx2fc_recv_frame()
574 BNX2FC_HBA_DBG(lport, "FC frame d_id mismatch with MAC %pM.\n", in bnx2fc_recv_frame()
580 vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
584 BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); in bnx2fc_recv_frame()
591 BNX2FC_HBA_DBG(lport, "Wrong source address: mac:%pM dest_addr:%pM.\n", in bnx2fc_recv_frame()
627 if (lport->port_id != ntoh24(fh->fh_d_id) && !vn_port) { in bnx2fc_recv_frame()
628 …BNX2FC_HBA_DBG(lport, "Dropping frame due to destination mismatch: lport->port_id=%x fh->d_id=%x.\… in bnx2fc_recv_frame()
629 lport->port_id, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
634 stats = per_cpu_ptr(lport->stats, smp_processor_id()); in bnx2fc_recv_frame()
647 fc_exch_recv(lport, fp); in bnx2fc_recv_frame()
689 struct fc_lport *lport = shost_priv(shost); in bnx2fc_get_host_stats() local
690 struct fcoe_port *port = lport_priv(lport); in bnx2fc_get_host_stats()
709 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n"); in bnx2fc_get_host_stats()
738 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev) in bnx2fc_shost_config() argument
740 struct fcoe_port *port = lport_priv(lport); in bnx2fc_shost_config()
743 struct Scsi_Host *shost = lport->host; in bnx2fc_shost_config()
750 if (lport->vport) in bnx2fc_shost_config()
756 rc = scsi_add_host(lport->host, dev); in bnx2fc_shost_config()
761 if (!lport->vport) in bnx2fc_shost_config()
762 fc_host_max_npiv_vports(lport->host) = USHRT_MAX; in bnx2fc_shost_config()
763 snprintf(fc_host_symbolic_name(lport->host), 256, in bnx2fc_shost_config()
771 static int bnx2fc_link_ok(struct fc_lport *lport) in bnx2fc_link_ok() argument
773 struct fcoe_port *port = lport_priv(lport); in bnx2fc_link_ok()
803 static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev) in bnx2fc_net_config() argument
811 port = lport_priv(lport); in bnx2fc_net_config()
821 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_net_config()
826 setup_timer(&port->timer, fcoe_queue_timer, (unsigned long) lport); in bnx2fc_net_config()
828 fcoe_link_speed_update(lport); in bnx2fc_net_config()
830 if (!lport->vport) { in bnx2fc_net_config()
834 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn); in bnx2fc_net_config()
835 fc_set_wwnn(lport, wwnn); in bnx2fc_net_config()
841 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn); in bnx2fc_net_config()
842 fc_set_wwpn(lport, wwpn); in bnx2fc_net_config()
873 struct fc_lport *lport; in bnx2fc_indicate_netevent() local
930 lport = ctlr->lp; in bnx2fc_indicate_netevent()
931 BNX2FC_HBA_DBG(lport, "netevent handler - event=%s %ld\n", in bnx2fc_indicate_netevent()
934 fcoe_link_speed_update(lport); in bnx2fc_indicate_netevent()
938 if (link_possible && !bnx2fc_link_ok(lport)) { in bnx2fc_indicate_netevent()
946 fc_set_mfs(lport, BNX2FC_MFS); in bnx2fc_indicate_netevent()
962 mutex_lock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
963 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_indicate_netevent()
966 mutex_unlock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
967 fc_host_port_type(lport->host) = in bnx2fc_indicate_netevent()
969 per_cpu_ptr(lport->stats, in bnx2fc_indicate_netevent()
972 fcoe_clean_pending_queue(lport); in bnx2fc_indicate_netevent()
997 static int bnx2fc_libfc_config(struct fc_lport *lport) in bnx2fc_libfc_config() argument
1001 memcpy(&lport->tt, &bnx2fc_libfc_fcn_templ, in bnx2fc_libfc_config()
1003 fc_elsct_init(lport); in bnx2fc_libfc_config()
1004 fc_exch_init(lport); in bnx2fc_libfc_config()
1005 fc_disc_init(lport); in bnx2fc_libfc_config()
1006 fc_disc_config(lport, lport); in bnx2fc_libfc_config()
1010 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba) in bnx2fc_em_config() argument
1019 if (!fc_exch_mgr_alloc(lport, FC_CLASS_3, fcoe_min_xid, in bnx2fc_em_config()
1028 static int bnx2fc_lport_config(struct fc_lport *lport) in bnx2fc_lport_config() argument
1030 lport->link_up = 0; in bnx2fc_lport_config()
1031 lport->qfull = 0; in bnx2fc_lport_config()
1032 lport->max_retry_count = BNX2FC_MAX_RETRY_CNT; in bnx2fc_lport_config()
1033 lport->max_rport_retry_count = BNX2FC_MAX_RPORT_RETRY_CNT; in bnx2fc_lport_config()
1034 lport->e_d_tov = 2 * 1000; in bnx2fc_lport_config()
1035 lport->r_a_tov = 10 * 1000; in bnx2fc_lport_config()
1037 lport->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS | in bnx2fc_lport_config()
1039 lport->does_npiv = 1; in bnx2fc_lport_config()
1041 memset(&lport->rnid_gen, 0, sizeof(struct fc_els_rnid_gen)); in bnx2fc_lport_config()
1042 lport->rnid_gen.rnid_atype = BNX2FC_RNID_HBA; in bnx2fc_lport_config()
1045 if (fc_lport_init_stats(lport)) in bnx2fc_lport_config()
1049 fc_lport_config(lport); in bnx2fc_lport_config()
1087 static void bnx2fc_update_src_mac(struct fc_lport *lport, u8 *addr) in bnx2fc_update_src_mac() argument
1089 struct fcoe_port *port = lport_priv(lport); in bnx2fc_update_src_mac()
1099 static u8 *bnx2fc_get_src_mac(struct fc_lport *lport) in bnx2fc_get_src_mac() argument
1103 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_get_src_mac()
1184 static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport) in bnx2fc_free_vport() argument
1190 if (blport->lport == lport) { in bnx2fc_free_vport()
1221 bnx2fc_free_vport(interface->hba, port->lport); in bnx2fc_vport_destroy()
1222 bnx2fc_port_shutdown(port->lport); in bnx2fc_vport_destroy()
1230 struct fc_lport *lport = vport->dd_data; in bnx2fc_vport_disable() local
1234 fc_fabric_logoff(lport); in bnx2fc_vport_disable()
1236 lport->boot_time = jiffies; in bnx2fc_vport_disable()
1237 fc_fabric_login(lport); in bnx2fc_vport_disable()
1238 fc_vport_setlink(lport); in bnx2fc_vport_disable()
1503 struct fc_lport *lport, *n_port; in bnx2fc_if_create() local
1520 lport = libfc_host_alloc(&bnx2fc_shost_template, sizeof(*port)); in bnx2fc_if_create()
1522 lport = libfc_vport_create(vport, sizeof(*port)); in bnx2fc_if_create()
1524 if (!lport) { in bnx2fc_if_create()
1528 shost = lport->host; in bnx2fc_if_create()
1529 port = lport_priv(lport); in bnx2fc_if_create()
1530 port->lport = lport; in bnx2fc_if_create()
1536 rc = bnx2fc_lport_config(lport); in bnx2fc_if_create()
1543 fc_set_wwnn(lport, vport->node_name); in bnx2fc_if_create()
1544 fc_set_wwpn(lport, vport->port_name); in bnx2fc_if_create()
1547 rc = bnx2fc_net_config(lport, interface->netdev); in bnx2fc_if_create()
1553 rc = bnx2fc_shost_config(lport, parent); in bnx2fc_if_create()
1561 rc = bnx2fc_libfc_config(lport); in bnx2fc_if_create()
1566 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_if_create()
1573 rc = bnx2fc_em_config(lport, hba); in bnx2fc_if_create()
1577 rc = fc_exch_mgr_list_clone(n_port, lport); in bnx2fc_if_create()
1588 blport->lport = lport; in bnx2fc_if_create()
1592 return lport; in bnx2fc_if_create()
1597 scsi_host_put(lport->host); in bnx2fc_if_create()
1614 struct fc_lport *lport = ctlr->lp; in bnx2fc_interface_cleanup() local
1615 struct fcoe_port *port = lport_priv(lport); in bnx2fc_interface_cleanup()
1622 fcoe_clean_pending_queue(lport); in bnx2fc_interface_cleanup()
1626 bnx2fc_free_vport(hba, lport); in bnx2fc_interface_cleanup()
1629 static void bnx2fc_if_destroy(struct fc_lport *lport) in bnx2fc_if_destroy() argument
1633 bnx2fc_clean_rx_queue(lport); in bnx2fc_if_destroy()
1636 fc_remove_host(lport->host); in bnx2fc_if_destroy()
1637 scsi_remove_host(lport->host); in bnx2fc_if_destroy()
1643 fc_exch_mgr_free(lport); in bnx2fc_if_destroy()
1646 fc_lport_free_stats(lport); in bnx2fc_if_destroy()
1649 scsi_host_put(lport->host); in bnx2fc_if_destroy()
1655 struct fc_lport *lport = ctlr->lp; in __bnx2fc_destroy() local
1656 struct fcoe_port *port = lport_priv(lport); in __bnx2fc_destroy()
1706 struct fc_lport *lport; in bnx2fc_destroy_work() local
1709 lport = port->lport; in bnx2fc_destroy_work()
1711 BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n"); in bnx2fc_destroy_work()
1713 bnx2fc_if_destroy(lport); in bnx2fc_destroy_work()
1848 struct fc_lport *lport; in bnx2fc_ulp_start() local
1860 lport = ctlr->lp; in bnx2fc_ulp_start()
1863 lport->tt.frame_send = bnx2fc_xmit; in bnx2fc_ulp_start()
1871 static void bnx2fc_port_shutdown(struct fc_lport *lport) in bnx2fc_port_shutdown() argument
1874 fc_fabric_logoff(lport); in bnx2fc_port_shutdown()
1875 fc_lport_destroy(lport); in bnx2fc_port_shutdown()
1881 struct fc_lport *lport; in bnx2fc_stop() local
1887 lport = ctlr->lp; in bnx2fc_stop()
1888 bnx2fc_port_shutdown(lport); in bnx2fc_stop()
1890 mutex_lock(&lport->lp_mutex); in bnx2fc_stop()
1891 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_stop()
1894 mutex_unlock(&lport->lp_mutex); in bnx2fc_stop()
1895 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_stop()
1897 fcoe_clean_pending_queue(lport); in bnx2fc_stop()
2009 struct fc_lport *lport; in bnx2fc_start_disc() local
2019 lport = ctlr->lp; in bnx2fc_start_disc()
2020 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n"); in bnx2fc_start_disc()
2022 if (!bnx2fc_link_ok(lport) && interface->enabled) { in bnx2fc_start_disc()
2023 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n"); in bnx2fc_start_disc()
2025 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in bnx2fc_start_disc()
2038 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_start_disc()
2041 fc_lport_init(lport); in bnx2fc_start_disc()
2042 fc_fabric_login(lport); in bnx2fc_start_disc()
2137 static uint bnx2fc_npiv_create_vports(struct fc_lport *lport, in bnx2fc_npiv_create_vports() argument
2147 BNX2FC_HBA_DBG(lport, "Exceeded count max of npiv table\n"); in bnx2fc_npiv_create_vports()
2154 BNX2FC_HBA_DBG(lport, "First NPIV table entries invalid.\n"); in bnx2fc_npiv_create_vports()
2169 wwnn = lport->wwnn; in bnx2fc_npiv_create_vports()
2178 BNX2FC_HBA_DBG(lport, "Creating vport %s:%s.\n", wwnn_str, in bnx2fc_npiv_create_vports()
2180 if (fc_vport_create(lport->host, 0, &vpid)) in bnx2fc_npiv_create_vports()
2183 BNX2FC_HBA_DBG(lport, "Failed to create vport\n"); in bnx2fc_npiv_create_vports()
2194 struct fc_lport *lport; in __bnx2fc_enable() local
2208 lport = ctlr->lp; in __bnx2fc_enable()
2216 if (!lport) in __bnx2fc_enable()
2219 if (!lport->host) in __bnx2fc_enable()
2232 bnx2fc_npiv_create_vports(lport, npiv_tbl); in __bnx2fc_enable()
2319 struct fc_lport *lport; in _bnx2fc_create() local
2396 lport = bnx2fc_if_create(interface, &cdev->dev, 0); in _bnx2fc_create()
2397 if (!lport) { in _bnx2fc_create()
2407 lport->boot_time = jiffies; in _bnx2fc_create()
2410 ctlr->lp = lport; in _bnx2fc_create()
2418 !bnx2fc_link_ok(lport)) { in _bnx2fc_create()
2420 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in _bnx2fc_create()
2424 BNX2FC_HBA_DBG(lport, "create: START DISC\n"); in _bnx2fc_create()
2590 struct fc_lport *lport = shost_priv(shost); in bnx2fc_fcoe_reset() local
2591 fc_lport_reset(lport); in bnx2fc_fcoe_reset()
2929 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_show() local
2930 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_show()
2942 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_store() local
2943 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_store()