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()
511 struct fc_lport *lport; in bnx2fc_recv_frame() local
526 lport = fr->fr_dev; in bnx2fc_recv_frame()
527 if (unlikely(lport == NULL)) { in bnx2fc_recv_frame()
544 stats = per_cpu_ptr(lport->stats, get_cpu()); in bnx2fc_recv_frame()
551 fr_dev(fp) = lport; in bnx2fc_recv_frame()
564 phys_port = lport_priv(lport); in bnx2fc_recv_frame()
571 BNX2FC_HBA_DBG(lport, "FC frame d_id mismatch with MAC %pM.\n", in bnx2fc_recv_frame()
577 vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
581 BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); in bnx2fc_recv_frame()
588 BNX2FC_HBA_DBG(lport, "Wrong source address: mac:%pM dest_addr:%pM.\n", in bnx2fc_recv_frame()
624 if (lport->port_id != ntoh24(fh->fh_d_id) && !vn_port) { in bnx2fc_recv_frame()
625 …BNX2FC_HBA_DBG(lport, "Dropping frame due to destination mismatch: lport->port_id=%x fh->d_id=%x.\… in bnx2fc_recv_frame()
626 lport->port_id, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
634 stats = per_cpu_ptr(lport->stats, get_cpu()); in bnx2fc_recv_frame()
643 fc_exch_recv(lport, fp); in bnx2fc_recv_frame()
688 struct fc_lport *lport = shost_priv(shost); in bnx2fc_get_host_stats() local
689 struct fcoe_port *port = lport_priv(lport); in bnx2fc_get_host_stats()
708 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n"); in bnx2fc_get_host_stats()
737 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev) in bnx2fc_shost_config() argument
739 struct fcoe_port *port = lport_priv(lport); in bnx2fc_shost_config()
742 struct Scsi_Host *shost = lport->host; in bnx2fc_shost_config()
749 if (lport->vport) in bnx2fc_shost_config()
755 rc = scsi_add_host(lport->host, dev); in bnx2fc_shost_config()
760 if (!lport->vport) in bnx2fc_shost_config()
761 fc_host_max_npiv_vports(lport->host) = USHRT_MAX; in bnx2fc_shost_config()
762 snprintf(fc_host_symbolic_name(lport->host), 256, in bnx2fc_shost_config()
770 static int bnx2fc_link_ok(struct fc_lport *lport) in bnx2fc_link_ok() argument
772 struct fcoe_port *port = lport_priv(lport); in bnx2fc_link_ok()
802 static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev) in bnx2fc_net_config() argument
810 port = lport_priv(lport); in bnx2fc_net_config()
820 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_net_config()
827 fcoe_link_speed_update(lport); in bnx2fc_net_config()
829 if (!lport->vport) { in bnx2fc_net_config()
833 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn); in bnx2fc_net_config()
834 fc_set_wwnn(lport, wwnn); in bnx2fc_net_config()
840 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn); in bnx2fc_net_config()
841 fc_set_wwpn(lport, wwpn); in bnx2fc_net_config()
872 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()
1530 rc = bnx2fc_lport_config(lport); in bnx2fc_if_create()
1537 fc_set_wwnn(lport, vport->node_name); in bnx2fc_if_create()
1538 fc_set_wwpn(lport, vport->port_name); in bnx2fc_if_create()
1541 rc = bnx2fc_net_config(lport, interface->netdev); in bnx2fc_if_create()
1547 rc = bnx2fc_shost_config(lport, parent); in bnx2fc_if_create()
1555 rc = bnx2fc_libfc_config(lport); in bnx2fc_if_create()
1560 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_if_create()
1567 rc = bnx2fc_em_config(lport, hba); in bnx2fc_if_create()
1571 rc = fc_exch_mgr_list_clone(n_port, lport); in bnx2fc_if_create()
1582 blport->lport = lport; in bnx2fc_if_create()
1586 return lport; in bnx2fc_if_create()
1591 scsi_host_put(lport->host); in bnx2fc_if_create()
1608 struct fc_lport *lport = ctlr->lp; in bnx2fc_interface_cleanup() local
1609 struct fcoe_port *port = lport_priv(lport); in bnx2fc_interface_cleanup()
1616 fcoe_clean_pending_queue(lport); in bnx2fc_interface_cleanup()
1620 bnx2fc_free_vport(hba, lport); in bnx2fc_interface_cleanup()
1623 static void bnx2fc_if_destroy(struct fc_lport *lport) in bnx2fc_if_destroy() argument
1627 bnx2fc_clean_rx_queue(lport); in bnx2fc_if_destroy()
1630 fc_remove_host(lport->host); in bnx2fc_if_destroy()
1631 scsi_remove_host(lport->host); in bnx2fc_if_destroy()
1637 fc_exch_mgr_free(lport); in bnx2fc_if_destroy()
1640 fc_lport_free_stats(lport); in bnx2fc_if_destroy()
1643 scsi_host_put(lport->host); in bnx2fc_if_destroy()
1649 struct fc_lport *lport = ctlr->lp; in __bnx2fc_destroy() local
1650 struct fcoe_port *port = lport_priv(lport); in __bnx2fc_destroy()
1698 struct fc_lport *lport; in bnx2fc_port_destroy() local
1700 lport = port->lport; in bnx2fc_port_destroy()
1701 BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport); in bnx2fc_port_destroy()
1703 bnx2fc_if_destroy(lport); in bnx2fc_port_destroy()
1838 struct fc_lport *lport; in bnx2fc_ulp_start() local
1850 lport = ctlr->lp; in bnx2fc_ulp_start()
1853 lport->tt.frame_send = bnx2fc_xmit; in bnx2fc_ulp_start()
1861 static void bnx2fc_port_shutdown(struct fc_lport *lport) in bnx2fc_port_shutdown() argument
1864 fc_fabric_logoff(lport); in bnx2fc_port_shutdown()
1865 fc_lport_destroy(lport); in bnx2fc_port_shutdown()
1871 struct fc_lport *lport; in bnx2fc_stop() local
1877 lport = ctlr->lp; in bnx2fc_stop()
1878 bnx2fc_port_shutdown(lport); in bnx2fc_stop()
1880 mutex_lock(&lport->lp_mutex); in bnx2fc_stop()
1881 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_stop()
1884 mutex_unlock(&lport->lp_mutex); in bnx2fc_stop()
1885 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_stop()
1887 fcoe_clean_pending_queue(lport); in bnx2fc_stop()
1998 struct fc_lport *lport; in bnx2fc_start_disc() local
2008 lport = ctlr->lp; in bnx2fc_start_disc()
2009 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n"); in bnx2fc_start_disc()
2011 if (!bnx2fc_link_ok(lport) && interface->enabled) { in bnx2fc_start_disc()
2012 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n"); in bnx2fc_start_disc()
2014 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in bnx2fc_start_disc()
2027 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_start_disc()
2030 fc_lport_init(lport); in bnx2fc_start_disc()
2031 fc_fabric_login(lport); in bnx2fc_start_disc()
2126 static uint bnx2fc_npiv_create_vports(struct fc_lport *lport, in bnx2fc_npiv_create_vports() argument
2136 BNX2FC_HBA_DBG(lport, "Exceeded count max of npiv table\n"); in bnx2fc_npiv_create_vports()
2143 BNX2FC_HBA_DBG(lport, "First NPIV table entries invalid.\n"); in bnx2fc_npiv_create_vports()
2158 wwnn = lport->wwnn; in bnx2fc_npiv_create_vports()
2167 BNX2FC_HBA_DBG(lport, "Creating vport %s:%s.\n", wwnn_str, in bnx2fc_npiv_create_vports()
2169 if (fc_vport_create(lport->host, 0, &vpid)) in bnx2fc_npiv_create_vports()
2172 BNX2FC_HBA_DBG(lport, "Failed to create vport\n"); in bnx2fc_npiv_create_vports()
2183 struct fc_lport *lport; in __bnx2fc_enable() local
2197 lport = ctlr->lp; in __bnx2fc_enable()
2205 if (!lport) in __bnx2fc_enable()
2208 if (!lport->host) in __bnx2fc_enable()
2221 bnx2fc_npiv_create_vports(lport, npiv_tbl); in __bnx2fc_enable()
2308 struct fc_lport *lport; in _bnx2fc_create() local
2385 lport = bnx2fc_if_create(interface, &cdev->dev, 0); in _bnx2fc_create()
2386 if (!lport) { in _bnx2fc_create()
2396 lport->boot_time = jiffies; in _bnx2fc_create()
2399 ctlr->lp = lport; in _bnx2fc_create()
2407 !bnx2fc_link_ok(lport)) { in _bnx2fc_create()
2409 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in _bnx2fc_create()
2413 BNX2FC_HBA_DBG(lport, "create: START DISC\n"); in _bnx2fc_create()
2576 struct fc_lport *lport = shost_priv(shost); in bnx2fc_fcoe_reset() local
2577 fc_lport_reset(lport); in bnx2fc_fcoe_reset()
2916 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_show() local
2917 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_show()
2929 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_store() local
2930 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_store()