Lines Matching refs:tgt
169 * @tgt: bnx2fc_rport structure pointer
172 struct bnx2fc_rport *tgt)
183 struct fc_rport_priv *rdata = tgt->rdata;
184 struct fc_rport *rport = tgt->rport;
198 conn_id = (u16)tgt->fcoe_conn_id;
202 ofld_req1.sq_addr_lo = (u32) tgt->sq_dma;
203 ofld_req1.sq_addr_hi = (u32)((u64) tgt->sq_dma >> 32);
205 ofld_req1.rq_pbl_addr_lo = (u32) tgt->rq_pbl_dma;
206 ofld_req1.rq_pbl_addr_hi = (u32)((u64) tgt->rq_pbl_dma >> 32);
208 ofld_req1.rq_first_pbe_addr_lo = (u32) tgt->rq_dma;
210 (u32)((u64) tgt->rq_dma >> 32);
223 ofld_req2.cq_addr_lo = (u32) tgt->cq_dma;
224 ofld_req2.cq_addr_hi = (u32)((u64)tgt->cq_dma >> 32);
226 ofld_req2.xferq_addr_lo = (u32) tgt->xferq_dma;
227 ofld_req2.xferq_addr_hi = (u32)((u64)tgt->xferq_dma >> 32);
229 ofld_req2.conn_db_addr_lo = (u32)tgt->conn_db_dma;
230 ofld_req2.conn_db_addr_hi = (u32)((u64)tgt->conn_db_dma >> 32);
254 tgt->sid = port_id;
273 ofld_req3.confq_first_pbe_addr_lo = tgt->confq_dma;
274 ofld_req3.confq_first_pbe_addr_hi = (u32)((u64) tgt->confq_dma >> 32);
293 if (tgt->dev_type == TYPE_TAPE) {
332 ofld_req4.lcq_addr_lo = (u32) tgt->lcq_dma;
333 ofld_req4.lcq_addr_hi = (u32)((u64) tgt->lcq_dma >> 32);
335 ofld_req4.confq_pbl_base_addr_lo = (u32) tgt->confq_pbl_dma;
337 (u32)((u64) tgt->confq_pbl_dma >> 32);
354 * @tgt: bnx2fc_rport structure pointer
357 struct bnx2fc_rport *tgt)
365 struct fc_rport *rport = tgt->rport;
383 memcpy(tgt->src_addr, port->data_src_addr, ETH_ALEN);
393 if (port_id != tgt->sid) {
395 "sid = 0x%x\n", port_id, tgt->sid);
396 port_id = tgt->sid;
410 enbl_req.context_id = tgt->context_id;
411 enbl_req.conn_id = tgt->fcoe_conn_id;
424 * @tgt: bnx2fc_rport structure pointer
427 struct bnx2fc_rport *tgt)
434 struct fc_rport *rport = tgt->rport;
445 disable_req.src_mac_addr_lo[0] = tgt->src_addr[5];
446 disable_req.src_mac_addr_lo[1] = tgt->src_addr[4];
447 disable_req.src_mac_addr_mid[0] = tgt->src_addr[3];
448 disable_req.src_mac_addr_mid[1] = tgt->src_addr[2];
449 disable_req.src_mac_addr_hi[0] = tgt->src_addr[1];
450 disable_req.src_mac_addr_hi[1] = tgt->src_addr[0];
459 port_id = tgt->sid;
469 disable_req.context_id = tgt->context_id;
470 disable_req.conn_id = tgt->fcoe_conn_id;
489 * @tgt: bnx2fc_rport structure pointer
492 struct bnx2fc_rport *tgt)
504 destroy_req.context_id = tgt->context_id;
505 destroy_req.conn_id = tgt->fcoe_conn_id;
548 void bnx2fc_process_l2_frame_compl(struct bnx2fc_rport *tgt,
552 struct fcoe_port *port = tgt->port;
566 BNX2FC_TGT_DBG(tgt, "Unable to allocate unsol_work\n");
570 BNX2FC_TGT_DBG(tgt, "l2_frame_compl l2_oxid = 0x%x, frame_len = %d\n",
626 static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
636 struct bnx2fc_interface *interface = tgt->port->priv;
643 BNX2FC_TGT_DBG(tgt, "Entered UNSOL COMPLETION wqe = 0x%x\n", wqe);
651 spin_lock_bh(&tgt->tgt_lock);
652 rq_data = (unsigned char *)bnx2fc_get_next_rqe(tgt, num_rq);
653 spin_unlock_bh(&tgt->tgt_lock);
662 BNX2FC_TGT_DBG(tgt, "Memory alloc failure\n");
667 spin_lock_bh(&tgt->tgt_lock);
669 bnx2fc_get_next_rqe(tgt, 1);
670 spin_unlock_bh(&tgt->tgt_lock);
676 bnx2fc_process_l2_frame_compl(tgt, buf, frame_len,
681 spin_lock_bh(&tgt->tgt_lock);
682 bnx2fc_return_rqe(tgt, num_rq);
683 spin_unlock_bh(&tgt->tgt_lock);
691 spin_lock_bh(&tgt->tgt_lock);
694 bnx2fc_get_next_rqe(tgt, 1);
696 BNX2FC_TGT_DBG(tgt, "Unsol Error Frame OX_ID = 0x%x\n", xid);
697 BNX2FC_TGT_DBG(tgt, "err_warn_bitmap = %08x:%08x\n",
700 BNX2FC_TGT_DBG(tgt, "buf_offsets - tx = 0x%x, rx = 0x%x\n",
704 BNX2FC_TGT_DBG(tgt, "xid(0x%x) out of FW range\n",
748 BNX2FC_TGT_DBG(tgt, "err = 0x%x\n", err_warn);
749 if (tgt->dev_type != TYPE_TAPE)
758 BNX2FC_TGT_DBG(tgt, "REC TOV popped for xid - 0x%x\n",
764 spin_unlock_bh(&tgt->tgt_lock);
766 spin_lock_bh(&tgt->tgt_lock);
795 bnx2fc_return_rqe(tgt, 1);
796 spin_unlock_bh(&tgt->tgt_lock);
804 spin_lock_bh(&tgt->tgt_lock);
807 bnx2fc_get_next_rqe(tgt, 1);
809 BNX2FC_TGT_DBG(tgt, "Unsol Warning Frame OX_ID = 0x%x\n", xid);
810 BNX2FC_TGT_DBG(tgt, "err_warn_bitmap = %08x:%08x",
813 BNX2FC_TGT_DBG(tgt, "buf_offsets - tx = 0x%x, rx = 0x%x",
817 BNX2FC_TGT_DBG(tgt, "xid(0x%x) out of FW range\n", xid);
830 BNX2FC_TGT_DBG(tgt, "warn = 0x%x\n", err_warn);
848 BNX2FC_TGT_DBG(tgt, "Unsolicited warning\n");
850 bnx2fc_return_rqe(tgt, 1);
851 spin_unlock_bh(&tgt->tgt_lock);
860 void bnx2fc_process_cq_compl(struct bnx2fc_rport *tgt, u16 wqe,
864 struct fcoe_port *port = tgt->port;
873 spin_lock_bh(&tgt->tgt_lock);
880 spin_unlock_bh(&tgt->tgt_lock);
897 spin_unlock_bh(&tgt->tgt_lock);
955 spin_unlock_bh(&tgt->tgt_lock);
958 void bnx2fc_arm_cq(struct bnx2fc_rport *tgt)
960 struct b577xx_fcoe_rx_doorbell *rx_db = &tgt->rx_db;
964 rx_db->doorbell_cq_cons = tgt->cq_cons_idx | (tgt->cq_curr_toggle_bit <<
967 writel(cpu_to_le32(msg), tgt->ctx_base);
971 static struct bnx2fc_work *bnx2fc_alloc_work(struct bnx2fc_rport *tgt, u16 wqe,
981 work->tgt = tgt;
992 static bool bnx2fc_pending_work(struct bnx2fc_rport *tgt, unsigned int wqe)
999 struct fcoe_port *port = tgt->port;
1029 rq_data = bnx2fc_get_next_rqe(tgt, 1);
1034 bnx2fc_get_next_rqe(tgt, 1);
1042 bnx2fc_return_rqe(tgt, 1);
1049 work = bnx2fc_alloc_work(tgt, wqe, rq_data_buff,
1059 bnx2fc_process_cq_compl(tgt, wqe,
1065 int bnx2fc_process_new_cqes(struct bnx2fc_rport *tgt)
1079 spin_lock_bh(&tgt->cq_lock);
1081 if (!tgt->cq) {
1083 spin_unlock_bh(&tgt->cq_lock);
1086 cq = tgt->cq;
1087 cq_cons = tgt->cq_cons_idx;
1091 (tgt->cq_curr_toggle_bit <<
1097 bnx2fc_process_unsol_compl(tgt, wqe);
1099 if (bnx2fc_pending_work(tgt, wqe))
1103 tgt->cq_cons_idx++;
1106 if (tgt->cq_cons_idx == BNX2FC_CQ_WQES_MAX) {
1107 tgt->cq_cons_idx = 0;
1109 tgt->cq_curr_toggle_bit =
1110 1 - tgt->cq_curr_toggle_bit;
1115 if (tgt->ctx_base)
1116 bnx2fc_arm_cq(tgt);
1117 atomic_add(num_free_sqes, &tgt->free_sqes);
1119 spin_unlock_bh(&tgt->cq_lock);
1135 struct bnx2fc_rport *tgt = hba->tgt_ofld_list[conn_id];
1137 if (!tgt) {
1142 bnx2fc_process_new_cqes(tgt);
1157 struct bnx2fc_rport *tgt;
1164 tgt = hba->tgt_ofld_list[conn_id];
1165 if (!tgt) {
1169 BNX2FC_TGT_DBG(tgt, "Entered ofld compl - context_id = 0x%x\n",
1171 interface = tgt->port->priv;
1180 tgt->context_id = context_id;
1186 set_bit(BNX2FC_FLAG_CTX_ALLOC_FAILURE, &tgt->flags);
1190 set_bit(BNX2FC_FLAG_OFFLOADED, &tgt->flags);
1193 set_bit(BNX2FC_FLAG_OFLD_REQ_CMPL, &tgt->flags);
1194 wake_up_interruptible(&tgt->ofld_wait);
1209 struct bnx2fc_rport *tgt;
1216 tgt = hba->tgt_ofld_list[conn_id];
1217 if (!tgt) {
1222 BNX2FC_TGT_DBG(tgt, "Enable compl - context_id = 0x%x\n",
1229 if (tgt->context_id != context_id) {
1233 interface = tgt->port->priv;
1240 set_bit(BNX2FC_FLAG_ENABLED, &tgt->flags);
1243 set_bit(BNX2FC_FLAG_OFLD_REQ_CMPL, &tgt->flags);
1244 wake_up_interruptible(&tgt->ofld_wait);
1251 struct bnx2fc_rport *tgt;
1255 tgt = hba->tgt_ofld_list[conn_id];
1256 if (!tgt) {
1261 BNX2FC_TGT_DBG(tgt, PFX "disable_cmpl: conn_id %d\n", conn_id);
1266 set_bit(BNX2FC_FLAG_DISABLE_FAILED, &tgt->flags);
1267 set_bit(BNX2FC_FLAG_UPLD_REQ_COMPL, &tgt->flags);
1268 wake_up_interruptible(&tgt->upld_wait);
1271 BNX2FC_TGT_DBG(tgt, "disable successful\n");
1272 clear_bit(BNX2FC_FLAG_OFFLOADED, &tgt->flags);
1273 clear_bit(BNX2FC_FLAG_ENABLED, &tgt->flags);
1274 set_bit(BNX2FC_FLAG_DISABLED, &tgt->flags);
1275 set_bit(BNX2FC_FLAG_UPLD_REQ_COMPL, &tgt->flags);
1276 wake_up_interruptible(&tgt->upld_wait);
1283 struct bnx2fc_rport *tgt;
1287 tgt = hba->tgt_ofld_list[conn_id];
1288 if (!tgt) {
1293 BNX2FC_TGT_DBG(tgt, "destroy_cmpl: conn_id %d\n", conn_id);
1301 BNX2FC_TGT_DBG(tgt, "upload successful\n");
1302 clear_bit(BNX2FC_FLAG_DISABLED, &tgt->flags);
1303 set_bit(BNX2FC_FLAG_DESTROYED, &tgt->flags);
1304 set_bit(BNX2FC_FLAG_UPLD_REQ_COMPL, &tgt->flags);
1305 wake_up_interruptible(&tgt->upld_wait);
1414 void bnx2fc_add_2_sq(struct bnx2fc_rport *tgt, u16 xid)
1418 sqe = &tgt->sq[tgt->sq_prod_idx];
1422 sqe->wqe |= tgt->sq_curr_toggle_bit << FCOE_SQE_TOGGLE_BIT_SHIFT;
1425 if (++tgt->sq_prod_idx == BNX2FC_SQ_WQES_MAX) {
1426 tgt->sq_prod_idx = 0;
1427 tgt->sq_curr_toggle_bit = 1 - tgt->sq_curr_toggle_bit;
1431 void bnx2fc_ring_doorbell(struct bnx2fc_rport *tgt)
1433 struct b577xx_doorbell_set_prod *sq_db = &tgt->sq_db;
1437 sq_db->prod = tgt->sq_prod_idx |
1438 (tgt->sq_curr_toggle_bit << 15);
1440 writel(cpu_to_le32(msg), tgt->ctx_base);
1444 int bnx2fc_map_doorbell(struct bnx2fc_rport *tgt)
1446 u32 context_id = tgt->context_id;
1447 struct fcoe_port *port = tgt->port;
1456 tgt->ctx_base = ioremap(reg_base + reg_off, 4);
1457 if (!tgt->ctx_base)
1462 char *bnx2fc_get_next_rqe(struct bnx2fc_rport *tgt, u8 num_items)
1464 char *buf = (char *)tgt->rq + (tgt->rq_cons_idx * BNX2FC_RQ_BUF_SZ);
1466 if (tgt->rq_cons_idx + num_items > BNX2FC_RQ_WQES_MAX)
1469 tgt->rq_cons_idx += num_items;
1471 if (tgt->rq_cons_idx >= BNX2FC_RQ_WQES_MAX)
1472 tgt->rq_cons_idx -= BNX2FC_RQ_WQES_MAX;
1477 void bnx2fc_return_rqe(struct bnx2fc_rport *tgt, u8 num_items)
1480 u32 next_prod_idx = tgt->rq_prod_idx + num_items;
1485 tgt->rq_prod_idx = next_prod_idx;
1486 tgt->conn_db->rq_prod = tgt->rq_prod_idx;
1495 struct bnx2fc_rport *tgt = seq_clnp_req->tgt;
1501 u32 context_id = tgt->context_id;
1574 struct bnx2fc_rport *tgt = io_req->tgt;
1575 u32 context_id = tgt->context_id;
1585 if (tgt->dev_type == TYPE_TAPE)
1611 struct bnx2fc_rport *tgt = io_req->tgt;
1650 if (tgt->dev_type == TYPE_TAPE)
1672 context_id = tgt->context_id;
1709 struct bnx2fc_rport *tgt = io_req->tgt;
1712 int dev_type = tgt->dev_type;
1797 context_id = tgt->context_id;