Lines Matching defs:ln

117 	struct csio_lnode *ln;
122 ln = (struct csio_lnode *) tmp;
123 if (ln->portid == portid)
124 return ln;
270 struct csio_lnode *ln = fdmi_req->lnode;
273 csio_ln_dbg(ln, "WR error:%x in processing fdmi rpa cmd\n",
275 CSIO_INC_STATS(ln, n_fdmi_err);
280 csio_ln_dbg(ln, "fdmi rpa cmd rejected reason %x expl %x\n",
299 struct csio_lnode *ln = fdmi_req->lnode;
307 csio_ln_dbg(ln, "WR error:%x in processing fdmi rhba cmd\n",
309 CSIO_INC_STATS(ln, n_fdmi_err);
314 csio_ln_dbg(ln, "fdmi rhba cmd rejected reason %x expl %x\n",
319 CSIO_INC_STATS(ln, n_fdmi_err);
330 memcpy(&port_name->portname, csio_ln_wwpn(ln), 8);
352 if (hw->pport[ln->portid].link_speed == FW_PORT_CAP_SPEED_1G)
354 else if (hw->pport[ln->portid].link_speed == FW_PORT_CAP_SPEED_10G)
356 else if (hw->pport[ln->portid].link_speed == FW_PORT_CAP32_SPEED_25G)
358 else if (hw->pport[ln->portid].link_speed == FW_PORT_CAP32_SPEED_40G)
360 else if (hw->pport[ln->portid].link_speed == FW_PORT_CAP32_SPEED_50G)
362 else if (hw->pport[ln->portid].link_speed == FW_PORT_CAP32_SPEED_100G)
370 mfs = ln->ln_sparm.csp.sp_bb_data;
392 CSIO_INC_STATS(ln, n_fdmi_err);
393 csio_ln_dbg(ln, "Failed to issue fdmi rpa req\n");
412 struct csio_lnode *ln = fdmi_req->lnode;
419 csio_ln_dbg(ln, "WR error:%x in processing fdmi dprt cmd\n",
421 CSIO_INC_STATS(ln, n_fdmi_err);
425 CSIO_INC_STATS(ln, n_fdmi_err);
430 csio_ln_dbg(ln, "fdmi dprt cmd rejected reason %x expl %x\n",
442 memcpy(&hbaid->id, csio_ln_wwpn(ln), 8); /* HBA identifer */
448 memcpy(&reg_pl->port[0].portname, csio_ln_wwpn(ln), 8);
457 csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_NODENAME, csio_ln_wwnn(ln),
499 CSIO_INC_STATS(ln, n_fdmi_err);
500 csio_ln_dbg(ln, "Failed to issue fdmi rhba req\n");
513 struct csio_lnode *ln = fdmi_req->lnode;
520 csio_ln_dbg(ln, "WR error:%x in processing fdmi dhba cmd\n",
522 CSIO_INC_STATS(ln, n_fdmi_err);
526 CSIO_INC_STATS(ln, n_fdmi_err);
531 csio_ln_dbg(ln, "fdmi dhba cmd rejected reason %x expl %x\n",
544 memcpy(&port_name->portname, csio_ln_wwpn(ln), 8);
551 CSIO_INC_STATS(ln, n_fdmi_err);
552 csio_ln_dbg(ln, "Failed to issue fdmi dprt req\n");
559 * @ln: lnode
565 csio_ln_fdmi_start(struct csio_lnode *ln, void *context)
573 if (!(ln->flags & CSIO_LNF_FDMI_ENABLE))
577 CSIO_INC_STATS(ln, n_fdmi_err);
583 fdmi_req = ln->mgmt_req;
584 fdmi_req->lnode = ln;
594 memcpy(&hbaid->id, csio_ln_wwpn(ln), 8);
600 CSIO_INC_STATS(ln, n_fdmi_err);
601 csio_ln_dbg(ln, "Failed to issue fdmi dhba req\n");
612 * Reads vnp response and updates ln parameters.
617 struct csio_lnode *ln = ((struct csio_lnode *)mbp->priv);
633 memcpy(ln->mac, rsp->vnport_mac, sizeof(ln->mac));
635 ln->nport_id = ntohl(nport_id);
636 ln->nport_id = ln->nport_id >> 8;
644 memcpy(csio_ln_wwnn(ln), rsp->vnport_wwnn, 8);
645 memcpy(csio_ln_wwpn(ln), rsp->vnport_wwpn, 8);
649 ln->ln_sparm.csp.sp_hi_ver = csp->sp_hi_ver;
650 ln->ln_sparm.csp.sp_lo_ver = csp->sp_lo_ver;
651 ln->ln_sparm.csp.sp_bb_cred = csp->sp_bb_cred;
652 ln->ln_sparm.csp.sp_features = csp->sp_features;
653 ln->ln_sparm.csp.sp_bb_data = csp->sp_bb_data;
654 ln->ln_sparm.csp.sp_r_a_tov = csp->sp_r_a_tov;
655 ln->ln_sparm.csp.sp_e_d_tov = csp->sp_e_d_tov;
659 ln->ln_sparm.clsp[2].cp_class = clsp->cp_class;
660 ln->ln_sparm.clsp[2].cp_init = clsp->cp_init;
661 ln->ln_sparm.clsp[2].cp_recip = clsp->cp_recip;
662 ln->ln_sparm.clsp[2].cp_rdfs = clsp->cp_rdfs;
669 csio_lnode_async_event(ln, CSIO_LN_FC_ATTRIB_UPDATE);
674 * @ln: lnode
680 csio_ln_vnp_read(struct csio_lnode *ln,
683 struct csio_hw *hw = ln->hwp;
694 csio_fcoe_vnp_read_init_mb(ln, mbp,
696 ln->fcf_flowid,
697 ln->vnp_flowid,
712 * @ln: lnode
715 * Issues mbox cmd to bring up FCOE link on port associated with given ln.
718 csio_fcoe_enable_link(struct csio_lnode *ln, bool enable)
720 struct csio_hw *hw = ln->hwp;
734 portid = ln->portid;
740 csio_write_fcoe_link_cond_init_mb(ln, mbp, CSIO_MB_DEFAULT_TMO,
764 memcpy(csio_ln_wwnn(ln), lcmd->vnport_wwnn, 8);
765 memcpy(csio_ln_wwpn(ln), lcmd->vnport_wwpn, 8);
778 * @ln: lnode
780 * read fcf response and Update ln fcf information.
785 struct csio_lnode *ln = (struct csio_lnode *)mbp->priv;
793 csio_ln_err(ln, "FCOE FCF cmd failed with ret x%x\n",
800 fcf_info = ln->fcfinfo;
825 * @ln: lnode
831 csio_ln_read_fcf_entry(struct csio_lnode *ln,
834 struct csio_hw *hw = ln->hwp;
844 csio_fcoe_read_fcf_init_mb(ln, mbp, CSIO_MB_DEFAULT_TMO,
845 ln->portid, ln->fcf_flowid, cbfn);
876 struct csio_lnode *ln = NULL;
879 ln = csio_ln_lookup_by_vnpi(hw, vnpi);
880 if (!ln) {
882 ln = csio_ln_lookup_by_portid(hw, portid);
883 if (!ln) {
891 if (ln->vnp_flowid != CSIO_INVALID_IDX) {
896 if (!ln) {
904 ln->portid = portid;
906 ln->vnp_flowid = vnpi;
907 ln->dev_num &= ~0xFFFF;
908 ln->dev_num |= vnpi;
912 ln->fcf_flowid = fcfi;
916 CSIO_INC_STATS(ln, n_link_up);
919 csio_post_event(&ln->sm, CSIO_LNE_LINKUP);
924 * @ln - FCOE lnode
935 csio_post_event_rns(struct csio_lnode *ln, enum csio_rn_ev evt)
937 struct csio_rnode *rnhead = (struct csio_rnode *) &ln->rnhead;
949 * @ln - FCOE lnode
957 csio_cleanup_rns(struct csio_lnode *ln)
959 struct csio_rnode *rnhead = (struct csio_rnode *) &ln->rnhead;
965 csio_put_rnode(ln, rn);
972 * @ln - FCOE lnode
983 csio_post_event_lns(struct csio_lnode *ln, enum csio_ln_ev evt)
989 if (csio_is_npiv_ln(ln)) {
990 csio_post_event(&ln->sm, evt);
994 sln = ln;
1002 csio_post_event(&ln->sm, evt);
1007 * @ln - FCOE Lnode
1015 csio_ln_down(struct csio_lnode *ln)
1017 csio_post_event_lns(ln, CSIO_LNE_LINK_DOWN);
1039 struct csio_lnode *ln;
1042 ln = csio_ln_lookup_by_vnpi(hw, vnpi);
1043 if (ln) {
1044 fp = ln->fcfinfo;
1045 CSIO_INC_STATS(ln, n_link_down);
1048 if (!csio_is_lnode_ready(ln)) {
1049 csio_ln_warn(ln,
1053 CSIO_INC_STATS(ln, n_evt_drop);
1059 csio_ln_warn(ln,
1062 CSIO_INC_STATS(ln, n_evt_drop);
1067 if (ln->fcf_flowid != fcfi) {
1068 csio_ln_warn(ln,
1071 CSIO_INC_STATS(ln, n_evt_drop);
1078 csio_ln_down(ln);
1091 * @ln: Lnode module
1096 csio_is_lnode_ready(struct csio_lnode *ln)
1098 return (csio_get_state(ln) == csio_lns_ready);
1106 * @ln - FCOE lnode.
1114 csio_lns_uninit(struct csio_lnode *ln, enum csio_ln_ev evt)
1116 struct csio_hw *hw = csio_lnode_to_hw(ln);
1120 CSIO_INC_STATS(ln, n_evt_sm[evt]);
1123 csio_set_state(&ln->sm, csio_lns_online);
1125 if (csio_is_phys_ln(ln)) {
1126 rv = csio_ln_read_fcf_entry(ln,
1130 CSIO_INC_STATS(ln, n_err);
1135 list_add_tail(&ln->fcfinfo->list, &rln->fcf_lsthead);
1138 rv = csio_ln_vnp_read(ln, csio_ln_vnp_read_cbfn);
1141 CSIO_INC_STATS(ln, n_err);
1149 csio_ln_dbg(ln,
1150 "unexp ln event %d recv from did:x%x in "
1151 "ln state[uninit].\n", evt, ln->nport_id);
1152 CSIO_INC_STATS(ln, n_evt_unexp);
1159 * @ln - FCOE lnode.
1167 csio_lns_online(struct csio_lnode *ln, enum csio_ln_ev evt)
1169 struct csio_hw *hw = csio_lnode_to_hw(ln);
1171 CSIO_INC_STATS(ln, n_evt_sm[evt]);
1174 csio_ln_warn(ln,
1176 "Ignoring linkup on port:%d\n", ln->portid);
1177 CSIO_INC_STATS(ln, n_evt_drop);
1181 csio_set_state(&ln->sm, csio_lns_ready);
1184 csio_lnode_async_event(ln, CSIO_LN_FC_LINKUP);
1191 csio_set_state(&ln->sm, csio_lns_uninit);
1192 if (csio_is_phys_ln(ln)) {
1194 list_del_init(&ln->fcfinfo->list);
1199 csio_ln_dbg(ln,
1200 "unexp ln event %d recv from did:x%x in "
1201 "ln state[uninit].\n", evt, ln->nport_id);
1202 CSIO_INC_STATS(ln, n_evt_unexp);
1210 * @ln - FCOE lnode.
1218 csio_lns_ready(struct csio_lnode *ln, enum csio_ln_ev evt)
1220 struct csio_hw *hw = csio_lnode_to_hw(ln);
1222 CSIO_INC_STATS(ln, n_evt_sm[evt]);
1225 csio_ln_dbg(ln,
1227 "in ln state[ready].\n", evt, ln->nport_id);
1228 CSIO_INC_STATS(ln, n_evt_drop);
1232 csio_set_state(&ln->sm, csio_lns_offline);
1233 csio_post_event_rns(ln, CSIO_RNFE_DOWN);
1236 csio_lnode_async_event(ln, CSIO_LN_FC_LINKDOWN);
1239 if (csio_is_phys_ln(ln)) {
1241 list_del_init(&ln->fcfinfo->list);
1246 csio_set_state(&ln->sm, csio_lns_offline);
1247 csio_post_event_rns(ln, CSIO_RNFE_DOWN);
1253 csio_lnode_async_event(ln, CSIO_LN_FC_LINKDOWN);
1256 if (csio_is_phys_ln(ln)) {
1258 list_del_init(&ln->fcfinfo->list);
1263 csio_set_state(&ln->sm, csio_lns_uninit);
1264 csio_post_event_rns(ln, CSIO_RNFE_CLOSE);
1268 csio_set_state(&ln->sm, csio_lns_offline);
1269 csio_post_event_rns(ln, CSIO_RNFE_DOWN);
1273 csio_ln_dbg(ln,
1274 "unexp ln event %d recv from did:x%x in "
1275 "ln state[uninit].\n", evt, ln->nport_id);
1276 CSIO_INC_STATS(ln, n_evt_unexp);
1284 * @ln - FCOE lnode.
1292 csio_lns_offline(struct csio_lnode *ln, enum csio_ln_ev evt)
1294 struct csio_hw *hw = csio_lnode_to_hw(ln);
1298 CSIO_INC_STATS(ln, n_evt_sm[evt]);
1301 csio_set_state(&ln->sm, csio_lns_online);
1303 if (csio_is_phys_ln(ln)) {
1304 rv = csio_ln_read_fcf_entry(ln,
1308 CSIO_INC_STATS(ln, n_err);
1313 list_add_tail(&ln->fcfinfo->list, &rln->fcf_lsthead);
1316 rv = csio_ln_vnp_read(ln, csio_ln_vnp_read_cbfn);
1319 CSIO_INC_STATS(ln, n_err);
1326 csio_ln_dbg(ln,
1328 "in ln state[offline].\n", evt, ln->nport_id);
1329 CSIO_INC_STATS(ln, n_evt_drop);
1333 csio_set_state(&ln->sm, csio_lns_uninit);
1334 csio_post_event_rns(ln, CSIO_RNFE_CLOSE);
1338 csio_ln_dbg(ln,
1339 "unexp ln event %d recv from did:x%x in "
1340 "ln state[offline]\n", evt, ln->nport_id);
1341 CSIO_INC_STATS(ln, n_evt_unexp);
1362 * @ln - lnode
1367 csio_lnode_state_to_str(struct csio_lnode *ln, int8_t *str)
1369 if (csio_get_state(ln) == csio_lns_uninit) {
1373 if (csio_get_state(ln) == csio_lns_ready) {
1377 if (csio_get_state(ln) == csio_lns_offline) {
1485 struct csio_lnode *ln;
1553 ln = csio_ln_lookup_by_vnpi(hw, vnpi);
1554 if (!ln) {
1562 rn = csio_confirm_rnode(ln, rdev_flowid,
1565 csio_ln_dbg(ln,
1573 ln->prev_evt = ln->cur_evt;
1574 ln->cur_evt = rdev_wr->event_cause;
1575 CSIO_INC_STATS(ln, n_evt_fw[rdev_wr->event_cause]);
1580 csio_ln_dbg(ln,
1584 csio_post_event(&ln->sm, evt);
1615 * @ln: lnode
1620 csio_lnode_start(struct csio_lnode *ln)
1623 if (csio_is_phys_ln(ln) && !(ln->flags & CSIO_LNF_LINK_ENABLE)) {
1624 rv = csio_fcoe_enable_link(ln, 1);
1625 ln->flags |= CSIO_LNF_LINK_ENABLE;
1633 * @ln: lnode
1639 csio_lnode_stop(struct csio_lnode *ln)
1641 csio_post_event_lns(ln, CSIO_LNE_DOWN_LINK);
1642 if (csio_is_phys_ln(ln) && (ln->flags & CSIO_LNF_LINK_ENABLE)) {
1643 csio_fcoe_enable_link(ln, 0);
1644 ln->flags &= ~CSIO_LNF_LINK_ENABLE;
1646 csio_ln_dbg(ln, "stopping ln :%p\n", ln);
1651 * @ln: lnode
1658 csio_lnode_close(struct csio_lnode *ln)
1660 csio_post_event_lns(ln, CSIO_LNE_CLOSE);
1661 if (csio_is_phys_ln(ln))
1662 ln->vnp_flowid = CSIO_INVALID_IDX;
1664 csio_ln_dbg(ln, "closed ln :%p\n", ln);
1729 struct csio_lnode *ln = io_req->lnode;
1763 ln->nport_id, rn->nport_id,
1831 * @ln: lnode
1834 csio_ln_fdmi_init(struct csio_lnode *ln)
1836 struct csio_hw *hw = csio_lnode_to_hw(ln);
1840 ln->mgmt_req = kzalloc(sizeof(struct csio_ioreq), GFP_KERNEL);
1841 if (!ln->mgmt_req) {
1842 csio_ln_err(ln, "Failed to alloc ioreq for FDMI\n");
1848 dma_buf = &ln->mgmt_req->dma_buf;
1854 kfree(ln->mgmt_req);
1855 ln->mgmt_req = NULL;
1859 ln->flags |= CSIO_LNF_FDMI_ENABLE;
1865 * @ln: lnode
1868 csio_ln_fdmi_exit(struct csio_lnode *ln)
1871 struct csio_hw *hw = csio_lnode_to_hw(ln);
1873 if (!ln->mgmt_req)
1876 dma_buf = &ln->mgmt_req->dma_buf;
1881 kfree(ln->mgmt_req);
1886 csio_scan_done(struct csio_lnode *ln, unsigned long ticks,
1895 if (!ln->tgt_scan_tick)
1896 ln->tgt_scan_tick = ticks;
1898 if (((ticks - ln->tgt_scan_tick) >= delta_scan_ticks)) {
1899 if (!ln->last_scan_ntgts)
1900 ln->last_scan_ntgts = ln->n_scsi_tgts;
1902 if (ln->last_scan_ntgts == ln->n_scsi_tgts)
1905 ln->last_scan_ntgts = ln->n_scsi_tgts;
1907 ln->tgt_scan_tick = ticks;
1926 struct csio_lnode *ln;
1932 ln = (struct csio_lnode *) tmp;
1936 csio_lnode_start(ln);
1941 csio_lnode_close(ln);
1945 csio_lnode_stop(ln);
1968 struct csio_lnode *ln;
1974 ln = (struct csio_lnode *) tmp;
1975 if (ln->portid != portid)
1979 csio_lnode_stop(ln);
1981 csio_lnode_start(ln);
1987 * @ln: lnode
1991 csio_ln_init(struct csio_lnode *ln)
1995 struct csio_hw *hw = csio_lnode_to_hw(ln);
1997 csio_init_state(&ln->sm, csio_lns_uninit);
1998 ln->vnp_flowid = CSIO_INVALID_IDX;
1999 ln->fcf_flowid = CSIO_INVALID_IDX;
2001 if (csio_is_root_ln(ln)) {
2005 ln->fcfinfo = kzalloc(sizeof(struct csio_fcf_info), GFP_KERNEL);
2006 if (!ln->fcfinfo) {
2007 csio_ln_err(ln, "Failed to alloc FCF record\n");
2012 INIT_LIST_HEAD(&ln->fcf_lsthead);
2013 kref_init(&ln->fcfinfo->kref);
2015 if (csio_fdmi_enable && csio_ln_fdmi_init(ln))
2025 if (csio_is_npiv_ln(ln)) {
2027 pln = csio_parent_lnode(ln);
2029 ln->fcfinfo = pln->fcfinfo;
2032 ln->fcfinfo = kzalloc(sizeof(struct csio_fcf_info),
2034 if (!ln->fcfinfo) {
2035 csio_ln_err(ln, "Failed to alloc FCF info\n");
2040 kref_init(&ln->fcfinfo->kref);
2042 if (csio_fdmi_enable && csio_ln_fdmi_init(ln))
2046 } /* if (!csio_is_root_ln(ln)) */
2054 csio_ln_exit(struct csio_lnode *ln)
2058 csio_cleanup_rns(ln);
2059 if (csio_is_npiv_ln(ln)) {
2060 pln = csio_parent_lnode(ln);
2063 kref_put(&ln->fcfinfo->kref, csio_free_fcfinfo);
2065 csio_ln_fdmi_exit(ln);
2067 ln->fcfinfo = NULL;
2072 * @ln: lnode
2075 csio_lnode_init(struct csio_lnode *ln, struct csio_hw *hw,
2081 csio_lnode_to_hw(ln) = hw;
2085 ln->pln = pln;
2087 ln->pln = NULL;
2090 ln->n_scsi_tgts = 0;
2091 ln->last_scan_ntgts = 0;
2092 ln->tgt_scan_tick = 0;
2095 INIT_LIST_HEAD(&ln->rnhead);
2096 INIT_LIST_HEAD(&ln->cln_head);
2099 ln->params.log_level = hw->params.log_level;
2101 if (csio_ln_init(ln))
2106 list_add_tail(&ln->sm.sm_list, pln ? &pln->cln_head : &hw->sln_head);
2115 csio_lnode_to_hw(ln) = NULL;
2121 * @ln: lnode
2125 csio_lnode_exit(struct csio_lnode *ln)
2127 struct csio_hw *hw = csio_lnode_to_hw(ln);
2129 csio_ln_exit(ln);
2134 list_del_init(&ln->sm.sm_list);
2139 if (ln->pln)
2140 ln->pln->num_vports--;
2150 csio_lnode_to_hw(ln) = NULL;