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
281 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_xmit()
289 if (!lport->link_up) { in bnx2fc_xmit()
290 BNX2FC_HBA_DBG(lport, "bnx2fc_xmit link down\n"); in bnx2fc_xmit()
297 BNX2FC_HBA_DBG(lport, "FCF not selected yet!\n"); in bnx2fc_xmit()
301 if (fcoe_ctlr_els_send(ctlr, lport, skb)) in bnx2fc_xmit()
322 BNX2FC_HBA_DBG(lport, "xmit: Frame is for offloaded session " in bnx2fc_xmit()
392 if (lport->seq_offload && fr_max_payload(fp)) { in bnx2fc_xmit()
401 this_cpu_inc(lport->stats->TxFrames); in bnx2fc_xmit()
402 this_cpu_add(lport->stats->TxWords, wlen); in bnx2fc_xmit()
405 fr_dev(fp) = lport; in bnx2fc_xmit()
407 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
409 fcoe_check_wait_queue(lport, skb); in bnx2fc_xmit()
427 struct fc_lport *lport; in bnx2fc_rcv() local
437 lport = ctlr->lp; in bnx2fc_rcv()
439 if (unlikely(lport == NULL)) { in bnx2fc_rcv()
466 fr->fr_dev = lport; in bnx2fc_rcv()
510 struct fc_lport *lport; in bnx2fc_recv_frame() local
524 lport = fr->fr_dev; in bnx2fc_recv_frame()
525 if (unlikely(lport == NULL)) { in bnx2fc_recv_frame()
542 this_cpu_inc(lport->stats->RxFrames); in bnx2fc_recv_frame()
543 this_cpu_add(lport->stats->RxWords, fr_len / FCOE_WORD_TO_BYTE); 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()
630 crc_err = this_cpu_inc_return(lport->stats->InvalidCRCCount); in bnx2fc_recv_frame()
637 fc_exch_recv(lport, fp); in bnx2fc_recv_frame()
682 struct fc_lport *lport = shost_priv(shost); in bnx2fc_get_host_stats() local
683 struct fcoe_port *port = lport_priv(lport); in bnx2fc_get_host_stats()
702 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n"); in bnx2fc_get_host_stats()
731 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev) in bnx2fc_shost_config() argument
733 struct fcoe_port *port = lport_priv(lport); in bnx2fc_shost_config()
736 struct Scsi_Host *shost = lport->host; in bnx2fc_shost_config()
743 if (lport->vport) in bnx2fc_shost_config()
749 rc = scsi_add_host(lport->host, dev); in bnx2fc_shost_config()
754 if (!lport->vport) in bnx2fc_shost_config()
755 fc_host_max_npiv_vports(lport->host) = USHRT_MAX; in bnx2fc_shost_config()
756 snprintf(fc_host_symbolic_name(lport->host), 256, in bnx2fc_shost_config()
764 static int bnx2fc_link_ok(struct fc_lport *lport) in bnx2fc_link_ok() argument
766 struct fcoe_port *port = lport_priv(lport); in bnx2fc_link_ok()
796 static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev) in bnx2fc_net_config() argument
804 port = lport_priv(lport); in bnx2fc_net_config()
814 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_net_config()
821 fcoe_link_speed_update(lport); in bnx2fc_net_config()
823 if (!lport->vport) { in bnx2fc_net_config()
827 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn); in bnx2fc_net_config()
828 fc_set_wwnn(lport, wwnn); in bnx2fc_net_config()
834 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn); in bnx2fc_net_config()
835 fc_set_wwpn(lport, wwpn); in bnx2fc_net_config()
866 struct fc_lport *lport; in bnx2fc_indicate_netevent() local
920 lport = ctlr->lp; in bnx2fc_indicate_netevent()
921 BNX2FC_HBA_DBG(lport, "netevent handler - event=%s %ld\n", in bnx2fc_indicate_netevent()
924 fcoe_link_speed_update(lport); in bnx2fc_indicate_netevent()
928 if (link_possible && !bnx2fc_link_ok(lport)) { in bnx2fc_indicate_netevent()
936 fc_set_mfs(lport, BNX2FC_MFS); in bnx2fc_indicate_netevent()
952 mutex_lock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
953 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_indicate_netevent()
956 mutex_unlock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
957 fc_host_port_type(lport->host) = in bnx2fc_indicate_netevent()
959 this_cpu_inc(lport->stats->LinkFailureCount); in bnx2fc_indicate_netevent()
960 fcoe_clean_pending_queue(lport); in bnx2fc_indicate_netevent()
985 static int bnx2fc_libfc_config(struct fc_lport *lport) in bnx2fc_libfc_config() argument
989 memcpy(&lport->tt, &bnx2fc_libfc_fcn_templ, in bnx2fc_libfc_config()
991 fc_elsct_init(lport); in bnx2fc_libfc_config()
992 fc_exch_init(lport); in bnx2fc_libfc_config()
993 fc_disc_init(lport); in bnx2fc_libfc_config()
994 fc_disc_config(lport, lport); in bnx2fc_libfc_config()
998 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba) in bnx2fc_em_config() argument
1007 if (!fc_exch_mgr_alloc(lport, FC_CLASS_3, fcoe_min_xid, in bnx2fc_em_config()
1016 static int bnx2fc_lport_config(struct fc_lport *lport) in bnx2fc_lport_config() argument
1018 lport->link_up = 0; in bnx2fc_lport_config()
1019 lport->qfull = 0; in bnx2fc_lport_config()
1020 lport->max_retry_count = BNX2FC_MAX_RETRY_CNT; in bnx2fc_lport_config()
1021 lport->max_rport_retry_count = BNX2FC_MAX_RPORT_RETRY_CNT; in bnx2fc_lport_config()
1022 lport->e_d_tov = 2 * 1000; in bnx2fc_lport_config()
1023 lport->r_a_tov = 10 * 1000; in bnx2fc_lport_config()
1025 lport->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS | in bnx2fc_lport_config()
1027 lport->does_npiv = 1; in bnx2fc_lport_config()
1029 memset(&lport->rnid_gen, 0, sizeof(struct fc_els_rnid_gen)); in bnx2fc_lport_config()
1030 lport->rnid_gen.rnid_atype = BNX2FC_RNID_HBA; in bnx2fc_lport_config()
1033 if (fc_lport_init_stats(lport)) in bnx2fc_lport_config()
1037 fc_lport_config(lport); in bnx2fc_lport_config()
1074 static void bnx2fc_update_src_mac(struct fc_lport *lport, u8 *addr) in bnx2fc_update_src_mac() argument
1076 struct fcoe_port *port = lport_priv(lport); in bnx2fc_update_src_mac()
1086 static u8 *bnx2fc_get_src_mac(struct fc_lport *lport) in bnx2fc_get_src_mac() argument
1090 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_get_src_mac()
1171 static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport) in bnx2fc_free_vport() argument
1177 if (blport->lport == lport) { in bnx2fc_free_vport()
1208 bnx2fc_free_vport(interface->hba, port->lport); in bnx2fc_vport_destroy()
1209 bnx2fc_port_shutdown(port->lport); in bnx2fc_vport_destroy()
1217 struct fc_lport *lport = vport->dd_data; in bnx2fc_vport_disable() local
1221 fc_fabric_logoff(lport); in bnx2fc_vport_disable()
1223 lport->boot_time = jiffies; in bnx2fc_vport_disable()
1224 fc_fabric_login(lport); in bnx2fc_vport_disable()
1225 fc_vport_setlink(lport); in bnx2fc_vport_disable()
1490 struct fc_lport *lport, *n_port; in bnx2fc_if_create() local
1507 lport = libfc_host_alloc(&bnx2fc_shost_template, sizeof(*port)); in bnx2fc_if_create()
1509 lport = libfc_vport_create(vport, sizeof(*port)); in bnx2fc_if_create()
1511 if (!lport) { in bnx2fc_if_create()
1515 shost = lport->host; in bnx2fc_if_create()
1516 port = lport_priv(lport); in bnx2fc_if_create()
1517 port->lport = lport; in bnx2fc_if_create()
1522 rc = bnx2fc_lport_config(lport); in bnx2fc_if_create()
1529 fc_set_wwnn(lport, vport->node_name); in bnx2fc_if_create()
1530 fc_set_wwpn(lport, vport->port_name); in bnx2fc_if_create()
1533 rc = bnx2fc_net_config(lport, interface->netdev); in bnx2fc_if_create()
1539 rc = bnx2fc_shost_config(lport, parent); in bnx2fc_if_create()
1547 rc = bnx2fc_libfc_config(lport); in bnx2fc_if_create()
1552 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_if_create()
1559 rc = bnx2fc_em_config(lport, hba); in bnx2fc_if_create()
1563 rc = fc_exch_mgr_list_clone(n_port, lport); in bnx2fc_if_create()
1574 blport->lport = lport; in bnx2fc_if_create()
1578 return lport; in bnx2fc_if_create()
1583 scsi_host_put(lport->host); in bnx2fc_if_create()
1600 struct fc_lport *lport = ctlr->lp; in bnx2fc_interface_cleanup() local
1601 struct fcoe_port *port = lport_priv(lport); in bnx2fc_interface_cleanup()
1608 fcoe_clean_pending_queue(lport); in bnx2fc_interface_cleanup()
1612 bnx2fc_free_vport(hba, lport); in bnx2fc_interface_cleanup()
1615 static void bnx2fc_if_destroy(struct fc_lport *lport) in bnx2fc_if_destroy() argument
1619 bnx2fc_clean_rx_queue(lport); in bnx2fc_if_destroy()
1622 fc_remove_host(lport->host); in bnx2fc_if_destroy()
1623 scsi_remove_host(lport->host); in bnx2fc_if_destroy()
1629 fc_exch_mgr_free(lport); in bnx2fc_if_destroy()
1632 fc_lport_free_stats(lport); in bnx2fc_if_destroy()
1635 scsi_host_put(lport->host); in bnx2fc_if_destroy()
1641 struct fc_lport *lport = ctlr->lp; in __bnx2fc_destroy() local
1642 struct fcoe_port *port = lport_priv(lport); in __bnx2fc_destroy()
1690 struct fc_lport *lport; in bnx2fc_port_destroy() local
1692 lport = port->lport; in bnx2fc_port_destroy()
1693 BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport); in bnx2fc_port_destroy()
1695 bnx2fc_if_destroy(lport); in bnx2fc_port_destroy()
1830 struct fc_lport *lport; in bnx2fc_ulp_start() local
1842 lport = ctlr->lp; in bnx2fc_ulp_start()
1845 lport->tt.frame_send = bnx2fc_xmit; in bnx2fc_ulp_start()
1853 static void bnx2fc_port_shutdown(struct fc_lport *lport) in bnx2fc_port_shutdown() argument
1856 fc_fabric_logoff(lport); in bnx2fc_port_shutdown()
1857 fc_lport_destroy(lport); in bnx2fc_port_shutdown()
1863 struct fc_lport *lport; in bnx2fc_stop() local
1869 lport = ctlr->lp; in bnx2fc_stop()
1870 bnx2fc_port_shutdown(lport); in bnx2fc_stop()
1872 mutex_lock(&lport->lp_mutex); in bnx2fc_stop()
1873 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_stop()
1876 mutex_unlock(&lport->lp_mutex); in bnx2fc_stop()
1877 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_stop()
1879 fcoe_clean_pending_queue(lport); in bnx2fc_stop()
1990 struct fc_lport *lport; in bnx2fc_start_disc() local
2000 lport = ctlr->lp; in bnx2fc_start_disc()
2001 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n"); in bnx2fc_start_disc()
2003 if (!bnx2fc_link_ok(lport) && interface->enabled) { in bnx2fc_start_disc()
2004 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n"); in bnx2fc_start_disc()
2006 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in bnx2fc_start_disc()
2019 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_start_disc()
2022 fc_lport_init(lport); in bnx2fc_start_disc()
2023 fc_fabric_login(lport); in bnx2fc_start_disc()
2118 static uint bnx2fc_npiv_create_vports(struct fc_lport *lport, in bnx2fc_npiv_create_vports() argument
2128 BNX2FC_HBA_DBG(lport, "Exceeded count max of npiv table\n"); in bnx2fc_npiv_create_vports()
2135 BNX2FC_HBA_DBG(lport, "First NPIV table entries invalid.\n"); in bnx2fc_npiv_create_vports()
2150 wwnn = lport->wwnn; in bnx2fc_npiv_create_vports()
2159 BNX2FC_HBA_DBG(lport, "Creating vport %s:%s.\n", wwnn_str, in bnx2fc_npiv_create_vports()
2161 if (fc_vport_create(lport->host, 0, &vpid)) in bnx2fc_npiv_create_vports()
2164 BNX2FC_HBA_DBG(lport, "Failed to create vport\n"); in bnx2fc_npiv_create_vports()
2175 struct fc_lport *lport; in __bnx2fc_enable() local
2189 lport = ctlr->lp; in __bnx2fc_enable()
2197 if (!lport) in __bnx2fc_enable()
2200 if (!lport->host) in __bnx2fc_enable()
2213 bnx2fc_npiv_create_vports(lport, npiv_tbl); in __bnx2fc_enable()
2300 struct fc_lport *lport; in _bnx2fc_create() local
2377 lport = bnx2fc_if_create(interface, &cdev->dev, 0); in _bnx2fc_create()
2378 if (!lport) { in _bnx2fc_create()
2388 lport->boot_time = jiffies; in _bnx2fc_create()
2391 ctlr->lp = lport; in _bnx2fc_create()
2399 !bnx2fc_link_ok(lport)) { in _bnx2fc_create()
2401 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in _bnx2fc_create()
2405 BNX2FC_HBA_DBG(lport, "create: START DISC\n"); in _bnx2fc_create()
2568 struct fc_lport *lport = shost_priv(shost); in bnx2fc_fcoe_reset() local
2569 fc_lport_reset(lport); in bnx2fc_fcoe_reset()
2907 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_show() local
2908 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_show()
2920 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_store() local
2921 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_store()