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
436 lport = ctlr->lp; in bnx2fc_rcv()
438 if (unlikely(lport == NULL)) { in bnx2fc_rcv()
463 fr->fr_dev = lport; in bnx2fc_rcv()
507 struct fc_lport *lport; in bnx2fc_recv_frame() local
521 lport = fr->fr_dev; in bnx2fc_recv_frame()
522 if (unlikely(lport == NULL)) { in bnx2fc_recv_frame()
539 this_cpu_inc(lport->stats->RxFrames); in bnx2fc_recv_frame()
540 this_cpu_add(lport->stats->RxWords, fr_len / FCOE_WORD_TO_BYTE); in bnx2fc_recv_frame()
544 fr_dev(fp) = lport; in bnx2fc_recv_frame()
557 phys_port = lport_priv(lport); in bnx2fc_recv_frame()
564 BNX2FC_HBA_DBG(lport, "FC frame d_id mismatch with MAC %pM.\n", in bnx2fc_recv_frame()
570 vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
574 BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); in bnx2fc_recv_frame()
581 BNX2FC_HBA_DBG(lport, "Wrong source address: mac:%pM dest_addr:%pM.\n", in bnx2fc_recv_frame()
617 if (lport->port_id != ntoh24(fh->fh_d_id) && !vn_port) { in bnx2fc_recv_frame()
618 …BNX2FC_HBA_DBG(lport, "Dropping frame due to destination mismatch: lport->port_id=%x fh->d_id=%x.\… in bnx2fc_recv_frame()
619 lport->port_id, ntoh24(fh->fh_d_id)); in bnx2fc_recv_frame()
627 crc_err = this_cpu_inc_return(lport->stats->InvalidCRCCount); in bnx2fc_recv_frame()
634 fc_exch_recv(lport, fp); in bnx2fc_recv_frame()
679 struct fc_lport *lport = shost_priv(shost); in bnx2fc_get_host_stats() local
680 struct fcoe_port *port = lport_priv(lport); in bnx2fc_get_host_stats()
699 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n"); in bnx2fc_get_host_stats()
728 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev) in bnx2fc_shost_config() argument
730 struct fcoe_port *port = lport_priv(lport); in bnx2fc_shost_config()
733 struct Scsi_Host *shost = lport->host; in bnx2fc_shost_config()
740 if (lport->vport) in bnx2fc_shost_config()
746 rc = scsi_add_host(lport->host, dev); in bnx2fc_shost_config()
751 if (!lport->vport) in bnx2fc_shost_config()
752 fc_host_max_npiv_vports(lport->host) = USHRT_MAX; in bnx2fc_shost_config()
753 snprintf(fc_host_symbolic_name(lport->host), 256, in bnx2fc_shost_config()
761 static int bnx2fc_link_ok(struct fc_lport *lport) in bnx2fc_link_ok() argument
763 struct fcoe_port *port = lport_priv(lport); in bnx2fc_link_ok()
793 static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev) in bnx2fc_net_config() argument
801 port = lport_priv(lport); in bnx2fc_net_config()
811 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_net_config()
818 fcoe_link_speed_update(lport); in bnx2fc_net_config()
820 if (!lport->vport) { in bnx2fc_net_config()
824 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn); in bnx2fc_net_config()
825 fc_set_wwnn(lport, wwnn); in bnx2fc_net_config()
831 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn); in bnx2fc_net_config()
832 fc_set_wwpn(lport, wwpn); in bnx2fc_net_config()
863 struct fc_lport *lport; in bnx2fc_indicate_netevent() local
917 lport = ctlr->lp; in bnx2fc_indicate_netevent()
918 BNX2FC_HBA_DBG(lport, "netevent handler - event=%s %ld\n", in bnx2fc_indicate_netevent()
921 fcoe_link_speed_update(lport); in bnx2fc_indicate_netevent()
925 if (link_possible && !bnx2fc_link_ok(lport)) { in bnx2fc_indicate_netevent()
933 fc_set_mfs(lport, BNX2FC_MFS); in bnx2fc_indicate_netevent()
949 mutex_lock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
950 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_indicate_netevent()
953 mutex_unlock(&lport->lp_mutex); in bnx2fc_indicate_netevent()
954 fc_host_port_type(lport->host) = in bnx2fc_indicate_netevent()
956 this_cpu_inc(lport->stats->LinkFailureCount); in bnx2fc_indicate_netevent()
957 fcoe_clean_pending_queue(lport); in bnx2fc_indicate_netevent()
982 static int bnx2fc_libfc_config(struct fc_lport *lport) in bnx2fc_libfc_config() argument
986 memcpy(&lport->tt, &bnx2fc_libfc_fcn_templ, in bnx2fc_libfc_config()
988 fc_elsct_init(lport); in bnx2fc_libfc_config()
989 fc_exch_init(lport); in bnx2fc_libfc_config()
990 fc_disc_init(lport); in bnx2fc_libfc_config()
991 fc_disc_config(lport, lport); in bnx2fc_libfc_config()
995 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba) in bnx2fc_em_config() argument
1004 if (!fc_exch_mgr_alloc(lport, FC_CLASS_3, fcoe_min_xid, in bnx2fc_em_config()
1013 static int bnx2fc_lport_config(struct fc_lport *lport) in bnx2fc_lport_config() argument
1015 lport->link_up = 0; in bnx2fc_lport_config()
1016 lport->qfull = 0; in bnx2fc_lport_config()
1017 lport->max_retry_count = BNX2FC_MAX_RETRY_CNT; in bnx2fc_lport_config()
1018 lport->max_rport_retry_count = BNX2FC_MAX_RPORT_RETRY_CNT; in bnx2fc_lport_config()
1019 lport->e_d_tov = 2 * 1000; in bnx2fc_lport_config()
1020 lport->r_a_tov = 10 * 1000; in bnx2fc_lport_config()
1022 lport->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS | in bnx2fc_lport_config()
1024 lport->does_npiv = 1; in bnx2fc_lport_config()
1026 memset(&lport->rnid_gen, 0, sizeof(struct fc_els_rnid_gen)); in bnx2fc_lport_config()
1027 lport->rnid_gen.rnid_atype = BNX2FC_RNID_HBA; in bnx2fc_lport_config()
1030 if (fc_lport_init_stats(lport)) in bnx2fc_lport_config()
1034 fc_lport_config(lport); in bnx2fc_lport_config()
1071 static void bnx2fc_update_src_mac(struct fc_lport *lport, u8 *addr) in bnx2fc_update_src_mac() argument
1073 struct fcoe_port *port = lport_priv(lport); in bnx2fc_update_src_mac()
1083 static u8 *bnx2fc_get_src_mac(struct fc_lport *lport) in bnx2fc_get_src_mac() argument
1087 port = (struct fcoe_port *)lport_priv(lport); in bnx2fc_get_src_mac()
1168 static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport) in bnx2fc_free_vport() argument
1174 if (blport->lport == lport) { in bnx2fc_free_vport()
1205 bnx2fc_free_vport(interface->hba, port->lport); in bnx2fc_vport_destroy()
1206 bnx2fc_port_shutdown(port->lport); in bnx2fc_vport_destroy()
1214 struct fc_lport *lport = vport->dd_data; in bnx2fc_vport_disable() local
1218 fc_fabric_logoff(lport); in bnx2fc_vport_disable()
1220 lport->boot_time = jiffies; in bnx2fc_vport_disable()
1221 fc_fabric_login(lport); in bnx2fc_vport_disable()
1222 fc_vport_setlink(lport); in bnx2fc_vport_disable()
1487 struct fc_lport *lport, *n_port; in bnx2fc_if_create() local
1504 lport = libfc_host_alloc(&bnx2fc_shost_template, sizeof(*port)); in bnx2fc_if_create()
1506 lport = libfc_vport_create(vport, sizeof(*port)); in bnx2fc_if_create()
1508 if (!lport) { in bnx2fc_if_create()
1512 shost = lport->host; in bnx2fc_if_create()
1513 port = lport_priv(lport); in bnx2fc_if_create()
1514 port->lport = lport; in bnx2fc_if_create()
1519 rc = bnx2fc_lport_config(lport); in bnx2fc_if_create()
1526 fc_set_wwnn(lport, vport->node_name); in bnx2fc_if_create()
1527 fc_set_wwpn(lport, vport->port_name); in bnx2fc_if_create()
1530 rc = bnx2fc_net_config(lport, interface->netdev); in bnx2fc_if_create()
1536 rc = bnx2fc_shost_config(lport, parent); in bnx2fc_if_create()
1544 rc = bnx2fc_libfc_config(lport); in bnx2fc_if_create()
1549 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_if_create()
1556 rc = bnx2fc_em_config(lport, hba); in bnx2fc_if_create()
1560 rc = fc_exch_mgr_list_clone(n_port, lport); in bnx2fc_if_create()
1571 blport->lport = lport; in bnx2fc_if_create()
1575 return lport; in bnx2fc_if_create()
1580 scsi_host_put(lport->host); in bnx2fc_if_create()
1597 struct fc_lport *lport = ctlr->lp; in bnx2fc_interface_cleanup() local
1598 struct fcoe_port *port = lport_priv(lport); in bnx2fc_interface_cleanup()
1605 fcoe_clean_pending_queue(lport); in bnx2fc_interface_cleanup()
1609 bnx2fc_free_vport(hba, lport); in bnx2fc_interface_cleanup()
1612 static void bnx2fc_if_destroy(struct fc_lport *lport) in bnx2fc_if_destroy() argument
1616 bnx2fc_clean_rx_queue(lport); in bnx2fc_if_destroy()
1619 fc_remove_host(lport->host); in bnx2fc_if_destroy()
1620 scsi_remove_host(lport->host); in bnx2fc_if_destroy()
1626 fc_exch_mgr_free(lport); in bnx2fc_if_destroy()
1629 fc_lport_free_stats(lport); in bnx2fc_if_destroy()
1632 scsi_host_put(lport->host); in bnx2fc_if_destroy()
1638 struct fc_lport *lport = ctlr->lp; in __bnx2fc_destroy() local
1639 struct fcoe_port *port = lport_priv(lport); in __bnx2fc_destroy()
1687 struct fc_lport *lport; in bnx2fc_port_destroy() local
1689 lport = port->lport; in bnx2fc_port_destroy()
1690 BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport); in bnx2fc_port_destroy()
1692 bnx2fc_if_destroy(lport); in bnx2fc_port_destroy()
1827 struct fc_lport *lport; in bnx2fc_ulp_start() local
1839 lport = ctlr->lp; in bnx2fc_ulp_start()
1842 lport->tt.frame_send = bnx2fc_xmit; in bnx2fc_ulp_start()
1850 static void bnx2fc_port_shutdown(struct fc_lport *lport) in bnx2fc_port_shutdown() argument
1853 fc_fabric_logoff(lport); in bnx2fc_port_shutdown()
1854 fc_lport_destroy(lport); in bnx2fc_port_shutdown()
1860 struct fc_lport *lport; in bnx2fc_stop() local
1866 lport = ctlr->lp; in bnx2fc_stop()
1867 bnx2fc_port_shutdown(lport); in bnx2fc_stop()
1869 mutex_lock(&lport->lp_mutex); in bnx2fc_stop()
1870 list_for_each_entry(vport, &lport->vports, list) in bnx2fc_stop()
1873 mutex_unlock(&lport->lp_mutex); in bnx2fc_stop()
1874 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; in bnx2fc_stop()
1876 fcoe_clean_pending_queue(lport); in bnx2fc_stop()
1987 struct fc_lport *lport; in bnx2fc_start_disc() local
1997 lport = ctlr->lp; in bnx2fc_start_disc()
1998 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n"); in bnx2fc_start_disc()
2000 if (!bnx2fc_link_ok(lport) && interface->enabled) { in bnx2fc_start_disc()
2001 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n"); in bnx2fc_start_disc()
2003 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in bnx2fc_start_disc()
2016 if (fc_set_mfs(lport, BNX2FC_MFS)) in bnx2fc_start_disc()
2019 fc_lport_init(lport); in bnx2fc_start_disc()
2020 fc_fabric_login(lport); in bnx2fc_start_disc()
2115 static uint bnx2fc_npiv_create_vports(struct fc_lport *lport, in bnx2fc_npiv_create_vports() argument
2125 BNX2FC_HBA_DBG(lport, "Exceeded count max of npiv table\n"); in bnx2fc_npiv_create_vports()
2132 BNX2FC_HBA_DBG(lport, "First NPIV table entries invalid.\n"); in bnx2fc_npiv_create_vports()
2147 wwnn = lport->wwnn; in bnx2fc_npiv_create_vports()
2156 BNX2FC_HBA_DBG(lport, "Creating vport %s:%s.\n", wwnn_str, in bnx2fc_npiv_create_vports()
2158 if (fc_vport_create(lport->host, 0, &vpid)) in bnx2fc_npiv_create_vports()
2161 BNX2FC_HBA_DBG(lport, "Failed to create vport\n"); in bnx2fc_npiv_create_vports()
2172 struct fc_lport *lport; in __bnx2fc_enable() local
2186 lport = ctlr->lp; in __bnx2fc_enable()
2194 if (!lport) in __bnx2fc_enable()
2197 if (!lport->host) in __bnx2fc_enable()
2210 bnx2fc_npiv_create_vports(lport, npiv_tbl); in __bnx2fc_enable()
2297 struct fc_lport *lport; in _bnx2fc_create() local
2374 lport = bnx2fc_if_create(interface, &cdev->dev, 0); in _bnx2fc_create()
2375 if (!lport) { in _bnx2fc_create()
2385 lport->boot_time = jiffies; in _bnx2fc_create()
2388 ctlr->lp = lport; in _bnx2fc_create()
2396 !bnx2fc_link_ok(lport)) { in _bnx2fc_create()
2398 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; in _bnx2fc_create()
2402 BNX2FC_HBA_DBG(lport, "create: START DISC\n"); in _bnx2fc_create()
2565 struct fc_lport *lport = shost_priv(shost); in bnx2fc_fcoe_reset() local
2566 fc_lport_reset(lport); in bnx2fc_fcoe_reset()
2904 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_show() local
2905 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_show()
2917 struct fc_lport *lport = shost_priv(shost); in bnx2fc_tm_timeout_store() local
2918 struct fcoe_port *port = lport_priv(lport); in bnx2fc_tm_timeout_store()