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);
108 "\t\t0x04 - lport events, link, mtu, etc.\n"
133 static inline struct net_device *bnx2fc_netdev(const struct fc_lport *lport)
136 ((struct fcoe_port *)lport_priv(lport))->priv)->netdev;
179 static void bnx2fc_abort_io(struct fc_lport *lport)
189 static void bnx2fc_cleanup(struct fc_lport *lport)
191 struct fcoe_port *port = lport_priv(lport);
261 * @lport: the associated local port
264 static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp)
281 port = (struct fcoe_port *)lport_priv(lport);
289 if (!lport->link_up) {
290 BNX2FC_HBA_DBG(lport, "bnx2fc_xmit link down\n");
297 BNX2FC_HBA_DBG(lport, "FCF not selected yet!\n");
301 if (fcoe_ctlr_els_send(ctlr, lport, skb))
322 BNX2FC_HBA_DBG(lport, "xmit: Frame is for offloaded session "
392 if (lport->seq_offload && fr_max_payload(fp)) {
401 this_cpu_inc(lport->stats->TxFrames);
402 this_cpu_add(lport->stats->TxWords, wlen);
405 fr_dev(fp) = lport;
407 fcoe_check_wait_queue(lport, skb);
409 fcoe_check_wait_queue(lport, skb);
427 struct fc_lport *lport;
436 lport = ctlr->lp;
438 if (unlikely(lport == NULL)) {
439 printk(KERN_ERR PFX "bnx2fc_rcv: lport is NULL\n");
463 fr->fr_dev = lport;
507 struct fc_lport *lport;
521 lport = fr->fr_dev;
522 if (unlikely(lport == NULL)) {
523 printk(KERN_ERR PFX "Invalid lport struct\n");
539 this_cpu_inc(lport->stats->RxFrames);
540 this_cpu_add(lport->stats->RxWords, fr_len / FCOE_WORD_TO_BYTE);
544 fr_dev(fp) = lport;
557 phys_port = lport_priv(lport);
564 BNX2FC_HBA_DBG(lport, "FC frame d_id mismatch with MAC %pM.\n",
570 vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id));
574 BNX2FC_HBA_DBG(lport, "fpma mismatch\n");
581 BNX2FC_HBA_DBG(lport, "Wrong source address: mac:%pM dest_addr:%pM.\n",
614 * have on record for lport and the search for a NPIV port came up
617 if (lport->port_id != ntoh24(fh->fh_d_id) && !vn_port) {
618 BNX2FC_HBA_DBG(lport, "Dropping frame due to destination mismatch: lport->port_id=%x fh->d_id=%x.\n",
619 lport->port_id, ntoh24(fh->fh_d_id));
627 crc_err = this_cpu_inc_return(lport->stats->InvalidCRCCount);
634 fc_exch_recv(lport, fp);
679 struct fc_lport *lport = shost_priv(shost);
680 struct fcoe_port *port = lport_priv(lport);
699 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n");
728 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev)
730 struct fcoe_port *port = lport_priv(lport);
733 struct Scsi_Host *shost = lport->host;
740 if (lport->vport)
746 rc = scsi_add_host(lport->host, dev);
751 if (!lport->vport)
752 fc_host_max_npiv_vports(lport->host) = USHRT_MAX;
753 snprintf(fc_host_symbolic_name(lport->host), 256,
761 static int bnx2fc_link_ok(struct fc_lport *lport)
763 struct fcoe_port *port = lport_priv(lport);
793 static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev)
801 port = lport_priv(lport);
811 if (fc_set_mfs(lport, BNX2FC_MFS))
818 fcoe_link_speed_update(lport);
820 if (!lport->vport) {
824 BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn);
825 fc_set_wwnn(lport, wwnn);
831 BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn);
832 fc_set_wwpn(lport, wwpn);
863 struct fc_lport *lport;
917 lport = ctlr->lp;
918 BNX2FC_HBA_DBG(lport, "netevent handler - event=%s %ld\n",
921 fcoe_link_speed_update(lport);
925 if (link_possible && !bnx2fc_link_ok(lport)) {
933 fc_set_mfs(lport, BNX2FC_MFS);
949 mutex_lock(&lport->lp_mutex);
950 list_for_each_entry(vport, &lport->vports, list)
953 mutex_unlock(&lport->lp_mutex);
954 fc_host_port_type(lport->host) =
956 this_cpu_inc(lport->stats->LinkFailureCount);
957 fcoe_clean_pending_queue(lport);
982 static int bnx2fc_libfc_config(struct fc_lport *lport)
986 memcpy(&lport->tt, &bnx2fc_libfc_fcn_templ,
988 fc_elsct_init(lport);
989 fc_exch_init(lport);
990 fc_disc_init(lport);
991 fc_disc_config(lport, lport);
995 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba)
1004 if (!fc_exch_mgr_alloc(lport, FC_CLASS_3, fcoe_min_xid,
1013 static int bnx2fc_lport_config(struct fc_lport *lport)
1015 lport->link_up = 0;
1016 lport->qfull = 0;
1017 lport->max_retry_count = BNX2FC_MAX_RETRY_CNT;
1018 lport->max_rport_retry_count = BNX2FC_MAX_RPORT_RETRY_CNT;
1019 lport->e_d_tov = 2 * 1000;
1020 lport->r_a_tov = 10 * 1000;
1022 lport->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS |
1024 lport->does_npiv = 1;
1026 memset(&lport->rnid_gen, 0, sizeof(struct fc_els_rnid_gen));
1027 lport->rnid_gen.rnid_atype = BNX2FC_RNID_HBA;
1030 if (fc_lport_init_stats(lport))
1034 fc_lport_config(lport);
1065 * @lport: The local port
1071 static void bnx2fc_update_src_mac(struct fc_lport *lport, u8 *addr)
1073 struct fcoe_port *port = lport_priv(lport);
1079 * bnx2fc_get_src_mac - return the ethernet source address for an lport
1081 * @lport: libfc port
1083 static u8 *bnx2fc_get_src_mac(struct fc_lport *lport)
1087 port = (struct fcoe_port *)lport_priv(lport);
1168 static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport)
1174 if (blport->lport == lport) {
1205 bnx2fc_free_vport(interface->hba, port->lport);
1206 bnx2fc_port_shutdown(port->lport);
1214 struct fc_lport *lport = vport->dd_data;
1218 fc_fabric_logoff(lport);
1220 lport->boot_time = jiffies;
1221 fc_fabric_login(lport);
1222 fc_vport_setlink(lport);
1487 struct fc_lport *lport, *n_port;
1504 lport = libfc_host_alloc(&bnx2fc_shost_template, sizeof(*port));
1506 lport = libfc_vport_create(vport, sizeof(*port));
1508 if (!lport) {
1512 shost = lport->host;
1513 port = lport_priv(lport);
1514 port->lport = lport;
1519 rc = bnx2fc_lport_config(lport);
1526 fc_set_wwnn(lport, vport->node_name);
1527 fc_set_wwpn(lport, vport->port_name);
1529 /* Configure netdev and networking properties of the lport */
1530 rc = bnx2fc_net_config(lport, interface->netdev);
1536 rc = bnx2fc_shost_config(lport, parent);
1544 rc = bnx2fc_libfc_config(lport);
1549 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN;
1556 rc = bnx2fc_em_config(lport, hba);
1560 rc = fc_exch_mgr_list_clone(n_port, lport);
1571 blport->lport = lport;
1575 return lport;
1580 scsi_host_put(lport->host);
1597 struct fc_lport *lport = ctlr->lp;
1598 struct fcoe_port *port = lport_priv(lport);
1605 fcoe_clean_pending_queue(lport);
1609 bnx2fc_free_vport(hba, lport);
1612 static void bnx2fc_if_destroy(struct fc_lport *lport)
1616 bnx2fc_clean_rx_queue(lport);
1619 fc_remove_host(lport->host);
1620 scsi_remove_host(lport->host);
1623 * Note that only the physical lport will have the exchange manager.
1626 fc_exch_mgr_free(lport);
1629 fc_lport_free_stats(lport);
1632 scsi_host_put(lport->host);
1638 struct fc_lport *lport = ctlr->lp;
1639 struct fcoe_port *port = lport_priv(lport);
1671 printk(KERN_ERR PFX "bnx2fc_destroy: interface or lport not found\n");
1687 struct fc_lport *lport;
1689 lport = port->lport;
1690 BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport);
1692 bnx2fc_if_destroy(lport);
1827 struct fc_lport *lport;
1839 lport = ctlr->lp;
1842 lport->tt.frame_send = bnx2fc_xmit;
1850 static void bnx2fc_port_shutdown(struct fc_lport *lport)
1853 fc_fabric_logoff(lport);
1854 fc_lport_destroy(lport);
1860 struct fc_lport *lport;
1866 lport = ctlr->lp;
1867 bnx2fc_port_shutdown(lport);
1869 mutex_lock(&lport->lp_mutex);
1870 list_for_each_entry(vport, &lport->vports, list)
1873 mutex_unlock(&lport->lp_mutex);
1874 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN;
1876 fcoe_clean_pending_queue(lport);
1987 struct fc_lport *lport;
1997 lport = ctlr->lp;
1998 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n");
2000 if (!bnx2fc_link_ok(lport) && interface->enabled) {
2001 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n");
2003 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT;
2016 if (fc_set_mfs(lport, BNX2FC_MFS))
2019 fc_lport_init(lport);
2020 fc_fabric_login(lport);
2078 pr_err(PFX "__bnx2fc_disable: lport not found\n");
2115 static uint bnx2fc_npiv_create_vports(struct fc_lport *lport,
2125 BNX2FC_HBA_DBG(lport, "Exceeded count max of npiv table\n");
2132 BNX2FC_HBA_DBG(lport, "First NPIV table entries invalid.\n");
2147 wwnn = lport->wwnn;
2156 BNX2FC_HBA_DBG(lport, "Creating vport %s:%s.\n", wwnn_str,
2158 if (fc_vport_create(lport->host, 0, &vpid))
2161 BNX2FC_HBA_DBG(lport, "Failed to create vport\n");
2172 struct fc_lport *lport;
2176 pr_err(PFX "__bnx2fc_enable: lport not found\n");
2186 lport = ctlr->lp;
2194 if (!lport)
2197 if (!lport->host)
2210 bnx2fc_npiv_create_vports(lport, npiv_tbl);
2297 struct fc_lport *lport;
2374 lport = bnx2fc_if_create(interface, &cdev->dev, 0);
2375 if (!lport) {
2385 lport->boot_time = jiffies;
2388 ctlr->lp = lport;
2396 !bnx2fc_link_ok(lport)) {
2398 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT;
2402 BNX2FC_HBA_DBG(lport, "create: START DISC\n");
2410 * lport should be holding a reference taken in bnx2fc_if_create
2565 struct fc_lport *lport = shost_priv(shost);
2566 fc_lport_reset(lport);
2902 struct fc_lport *lport = shost_priv(shost);
2903 struct fcoe_port *port = lport_priv(lport);
2915 struct fc_lport *lport = shost_priv(shost);
2916 struct fcoe_port *port = lport_priv(lport);