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);
794 bnx2fc_return_rqe(tgt, 1);
795 spin_unlock_bh(&tgt->tgt_lock);
803 spin_lock_bh(&tgt->tgt_lock);
806 bnx2fc_get_next_rqe(tgt, 1);
808 BNX2FC_TGT_DBG(tgt, "Unsol Warning Frame OX_ID = 0x%x\n", xid);
809 BNX2FC_TGT_DBG(tgt, "err_warn_bitmap = %08x:%08x",
812 BNX2FC_TGT_DBG(tgt, "buf_offsets - tx = 0x%x, rx = 0x%x",
816 BNX2FC_TGT_DBG(tgt, "xid(0x%x) out of FW range\n", xid);
829 BNX2FC_TGT_DBG(tgt, "warn = 0x%x\n", err_warn);
847 BNX2FC_TGT_DBG(tgt, "Unsolicited warning\n");
849 bnx2fc_return_rqe(tgt, 1);
850 spin_unlock_bh(&tgt->tgt_lock);
859 void bnx2fc_process_cq_compl(struct bnx2fc_rport *tgt, u16 wqe,
863 struct fcoe_port *port = tgt->port;
872 spin_lock_bh(&tgt->tgt_lock);
879 spin_unlock_bh(&tgt->tgt_lock);
896 spin_unlock_bh(&tgt->tgt_lock);
954 spin_unlock_bh(&tgt->tgt_lock);
957 void bnx2fc_arm_cq(struct bnx2fc_rport *tgt)
959 struct b577xx_fcoe_rx_doorbell *rx_db = &tgt->rx_db;
963 rx_db->doorbell_cq_cons = tgt->cq_cons_idx | (tgt->cq_curr_toggle_bit <<
966 writel(cpu_to_le32(msg), tgt->ctx_base);
970 static struct bnx2fc_work *bnx2fc_alloc_work(struct bnx2fc_rport *tgt, u16 wqe,
980 work->tgt = tgt;
991 static bool bnx2fc_pending_work(struct bnx2fc_rport *tgt, unsigned int wqe)
998 struct fcoe_port *port = tgt->port;
1028 rq_data = bnx2fc_get_next_rqe(tgt, 1);
1033 bnx2fc_get_next_rqe(tgt, 1);
1041 bnx2fc_return_rqe(tgt, 1);
1048 work = bnx2fc_alloc_work(tgt, wqe, rq_data_buff,
1058 bnx2fc_process_cq_compl(tgt, wqe,
1064 int bnx2fc_process_new_cqes(struct bnx2fc_rport *tgt)
1078 spin_lock_bh(&tgt->cq_lock);
1080 if (!tgt->cq) {
1082 spin_unlock_bh(&tgt->cq_lock);
1085 cq = tgt->cq;
1086 cq_cons = tgt->cq_cons_idx;
1090 (tgt->cq_curr_toggle_bit <<
1096 bnx2fc_process_unsol_compl(tgt, wqe);
1098 if (bnx2fc_pending_work(tgt, wqe))
1102 tgt->cq_cons_idx++;
1105 if (tgt->cq_cons_idx == BNX2FC_CQ_WQES_MAX) {
1106 tgt->cq_cons_idx = 0;
1108 tgt->cq_curr_toggle_bit =
1109 1 - tgt->cq_curr_toggle_bit;
1114 if (tgt->ctx_base)
1115 bnx2fc_arm_cq(tgt);
1116 atomic_add(num_free_sqes, &tgt->free_sqes);
1118 spin_unlock_bh(&tgt->cq_lock);
1134 struct bnx2fc_rport *tgt = hba->tgt_ofld_list[conn_id];
1136 if (!tgt) {
1141 bnx2fc_process_new_cqes(tgt);
1156 struct bnx2fc_rport *tgt;
1163 tgt = hba->tgt_ofld_list[conn_id];
1164 if (!tgt) {
1168 BNX2FC_TGT_DBG(tgt, "Entered ofld compl - context_id = 0x%x\n",
1170 interface = tgt->port->priv;
1179 tgt->context_id = context_id;
1185 set_bit(BNX2FC_FLAG_CTX_ALLOC_FAILURE, &tgt->flags);
1189 set_bit(BNX2FC_FLAG_OFFLOADED, &tgt->flags);
1192 set_bit(BNX2FC_FLAG_OFLD_REQ_CMPL, &tgt->flags);
1193 wake_up_interruptible(&tgt->ofld_wait);
1208 struct bnx2fc_rport *tgt;
1215 tgt = hba->tgt_ofld_list[conn_id];
1216 if (!tgt) {
1221 BNX2FC_TGT_DBG(tgt, "Enable compl - context_id = 0x%x\n",
1228 if (tgt->context_id != context_id) {
1232 interface = tgt->port->priv;
1239 set_bit(BNX2FC_FLAG_ENABLED, &tgt->flags);
1242 set_bit(BNX2FC_FLAG_OFLD_REQ_CMPL, &tgt->flags);
1243 wake_up_interruptible(&tgt->ofld_wait);
1250 struct bnx2fc_rport *tgt;
1254 tgt = hba->tgt_ofld_list[conn_id];
1255 if (!tgt) {
1260 BNX2FC_TGT_DBG(tgt, PFX "disable_cmpl: conn_id %d\n", conn_id);
1265 set_bit(BNX2FC_FLAG_DISABLE_FAILED, &tgt->flags);
1266 set_bit(BNX2FC_FLAG_UPLD_REQ_COMPL, &tgt->flags);
1267 wake_up_interruptible(&tgt->upld_wait);
1270 BNX2FC_TGT_DBG(tgt, "disable successful\n");
1271 clear_bit(BNX2FC_FLAG_OFFLOADED, &tgt->flags);
1272 clear_bit(BNX2FC_FLAG_ENABLED, &tgt->flags);
1273 set_bit(BNX2FC_FLAG_DISABLED, &tgt->flags);
1274 set_bit(BNX2FC_FLAG_UPLD_REQ_COMPL, &tgt->flags);
1275 wake_up_interruptible(&tgt->upld_wait);
1282 struct bnx2fc_rport *tgt;
1286 tgt = hba->tgt_ofld_list[conn_id];
1287 if (!tgt) {
1292 BNX2FC_TGT_DBG(tgt, "destroy_cmpl: conn_id %d\n", conn_id);
1300 BNX2FC_TGT_DBG(tgt, "upload successful\n");
1301 clear_bit(BNX2FC_FLAG_DISABLED, &tgt->flags);
1302 set_bit(BNX2FC_FLAG_DESTROYED, &tgt->flags);
1303 set_bit(BNX2FC_FLAG_UPLD_REQ_COMPL, &tgt->flags);
1304 wake_up_interruptible(&tgt->upld_wait);
1413 void bnx2fc_add_2_sq(struct bnx2fc_rport *tgt, u16 xid)
1417 sqe = &tgt->sq[tgt->sq_prod_idx];
1421 sqe->wqe |= tgt->sq_curr_toggle_bit << FCOE_SQE_TOGGLE_BIT_SHIFT;
1424 if (++tgt->sq_prod_idx == BNX2FC_SQ_WQES_MAX) {
1425 tgt->sq_prod_idx = 0;
1426 tgt->sq_curr_toggle_bit = 1 - tgt->sq_curr_toggle_bit;
1430 void bnx2fc_ring_doorbell(struct bnx2fc_rport *tgt)
1432 struct b577xx_doorbell_set_prod *sq_db = &tgt->sq_db;
1436 sq_db->prod = tgt->sq_prod_idx |
1437 (tgt->sq_curr_toggle_bit << 15);
1439 writel(cpu_to_le32(msg), tgt->ctx_base);
1443 int bnx2fc_map_doorbell(struct bnx2fc_rport *tgt)
1445 u32 context_id = tgt->context_id;
1446 struct fcoe_port *port = tgt->port;
1455 tgt->ctx_base = ioremap(reg_base + reg_off, 4);
1456 if (!tgt->ctx_base)
1461 char *bnx2fc_get_next_rqe(struct bnx2fc_rport *tgt, u8 num_items)
1463 char *buf = (char *)tgt->rq + (tgt->rq_cons_idx * BNX2FC_RQ_BUF_SZ);
1465 if (tgt->rq_cons_idx + num_items > BNX2FC_RQ_WQES_MAX)
1468 tgt->rq_cons_idx += num_items;
1470 if (tgt->rq_cons_idx >= BNX2FC_RQ_WQES_MAX)
1471 tgt->rq_cons_idx -= BNX2FC_RQ_WQES_MAX;
1476 void bnx2fc_return_rqe(struct bnx2fc_rport *tgt, u8 num_items)
1479 u32 next_prod_idx = tgt->rq_prod_idx + num_items;
1484 tgt->rq_prod_idx = next_prod_idx;
1485 tgt->conn_db->rq_prod = tgt->rq_prod_idx;
1494 struct bnx2fc_rport *tgt = seq_clnp_req->tgt;
1500 u32 context_id = tgt->context_id;
1573 struct bnx2fc_rport *tgt = io_req->tgt;
1574 u32 context_id = tgt->context_id;
1584 if (tgt->dev_type == TYPE_TAPE)
1610 struct bnx2fc_rport *tgt = io_req->tgt;
1649 if (tgt->dev_type == TYPE_TAPE)
1671 context_id = tgt->context_id;
1708 struct bnx2fc_rport *tgt = io_req->tgt;
1711 int dev_type = tgt->dev_type;
1796 context_id = tgt->context_id;