Lines Matching refs:cdev

63 int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base,  in cxgbi_device_portmap_create()  argument
66 struct cxgbi_ports_map *pmap = &cdev->pmap; in cxgbi_device_portmap_create()
72 pr_warn("cdev 0x%p, portmap OOM %u.\n", cdev, max_conn); in cxgbi_device_portmap_create()
83 void cxgbi_device_portmap_cleanup(struct cxgbi_device *cdev) in cxgbi_device_portmap_cleanup() argument
85 struct cxgbi_ports_map *pmap = &cdev->pmap; in cxgbi_device_portmap_cleanup()
95 csk, cdev); in cxgbi_device_portmap_cleanup()
106 static inline void cxgbi_device_destroy(struct cxgbi_device *cdev) in cxgbi_device_destroy() argument
109 "cdev 0x%p, p# %u.\n", cdev, cdev->nports); in cxgbi_device_destroy()
110 cxgbi_hbas_remove(cdev); in cxgbi_device_destroy()
111 cxgbi_device_portmap_cleanup(cdev); in cxgbi_device_destroy()
112 if (cdev->dev_ddp_cleanup) in cxgbi_device_destroy()
113 cdev->dev_ddp_cleanup(cdev); in cxgbi_device_destroy()
115 cxgbi_ddp_cleanup(cdev); in cxgbi_device_destroy()
116 if (cdev->ddp) in cxgbi_device_destroy()
117 cxgbi_ddp_cleanup(cdev); in cxgbi_device_destroy()
118 if (cdev->pmap.max_connect) in cxgbi_device_destroy()
119 cxgbi_free_big_mem(cdev->pmap.port_csk); in cxgbi_device_destroy()
120 kfree(cdev); in cxgbi_device_destroy()
126 struct cxgbi_device *cdev; in cxgbi_device_register() local
128 cdev = kzalloc(sizeof(*cdev) + extra + nports * in cxgbi_device_register()
132 if (!cdev) { in cxgbi_device_register()
136 cdev->ports = (struct net_device **)(cdev + 1); in cxgbi_device_register()
137 cdev->hbas = (struct cxgbi_hba **)(((char*)cdev->ports) + nports * in cxgbi_device_register()
140 cdev->dd_data = ((char *)cdev->hbas) + in cxgbi_device_register()
142 spin_lock_init(&cdev->pmap.lock); in cxgbi_device_register()
145 list_add_tail(&cdev->list_head, &cdev_list); in cxgbi_device_register()
149 list_add_tail_rcu(&cdev->rcu_node, &cdev_rcu_list); in cxgbi_device_register()
153 "cdev 0x%p, p# %u.\n", cdev, nports); in cxgbi_device_register()
154 return cdev; in cxgbi_device_register()
158 void cxgbi_device_unregister(struct cxgbi_device *cdev) in cxgbi_device_unregister() argument
162 cdev, cdev->nports, cdev->nports ? cdev->ports[0]->name : ""); in cxgbi_device_unregister()
165 list_del(&cdev->list_head); in cxgbi_device_unregister()
169 list_del_rcu(&cdev->rcu_node); in cxgbi_device_unregister()
173 cxgbi_device_destroy(cdev); in cxgbi_device_unregister()
179 struct cxgbi_device *cdev, *tmp; in cxgbi_device_unregister_all() local
182 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { in cxgbi_device_unregister_all()
183 if ((cdev->flags & flag) == flag) { in cxgbi_device_unregister_all()
185 cxgbi_device_unregister(cdev); in cxgbi_device_unregister_all()
195 struct cxgbi_device *cdev, *tmp; in cxgbi_device_find_by_lldev() local
198 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { in cxgbi_device_find_by_lldev()
199 if (cdev->lldev == lldev) { in cxgbi_device_find_by_lldev()
201 return cdev; in cxgbi_device_find_by_lldev()
216 struct cxgbi_device *cdev, *tmp; in cxgbi_device_find_by_netdev() local
227 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { in cxgbi_device_find_by_netdev()
228 for (i = 0; i < cdev->nports; i++) { in cxgbi_device_find_by_netdev()
229 if (ndev == cdev->ports[i]) { in cxgbi_device_find_by_netdev()
230 cdev->hbas[i]->vdev = vdev; in cxgbi_device_find_by_netdev()
234 return cdev; in cxgbi_device_find_by_netdev()
249 struct cxgbi_device *cdev; in cxgbi_device_find_by_netdev_rcu() local
259 list_for_each_entry_rcu(cdev, &cdev_rcu_list, rcu_node) { in cxgbi_device_find_by_netdev_rcu()
260 for (i = 0; i < cdev->nports; i++) { in cxgbi_device_find_by_netdev_rcu()
261 if (ndev == cdev->ports[i]) { in cxgbi_device_find_by_netdev_rcu()
262 cdev->hbas[i]->vdev = vdev; in cxgbi_device_find_by_netdev_rcu()
266 return cdev; in cxgbi_device_find_by_netdev_rcu()
283 struct cxgbi_device *cdev, *tmp; in cxgbi_device_find_by_mac() local
293 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { in cxgbi_device_find_by_mac()
294 for (i = 0; i < cdev->nports; i++) { in cxgbi_device_find_by_mac()
295 if (!memcmp(ndev->dev_addr, cdev->ports[i]->dev_addr, in cxgbi_device_find_by_mac()
297 cdev->hbas[i]->vdev = vdev; in cxgbi_device_find_by_mac()
301 return cdev; in cxgbi_device_find_by_mac()
313 void cxgbi_hbas_remove(struct cxgbi_device *cdev) in cxgbi_hbas_remove() argument
319 "cdev 0x%p, p#%u.\n", cdev, cdev->nports); in cxgbi_hbas_remove()
321 for (i = 0; i < cdev->nports; i++) { in cxgbi_hbas_remove()
322 chba = cdev->hbas[i]; in cxgbi_hbas_remove()
324 cdev->hbas[i] = NULL; in cxgbi_hbas_remove()
326 pci_dev_put(cdev->pdev); in cxgbi_hbas_remove()
333 int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun, in cxgbi_hbas_add() argument
341 log_debug(1 << CXGBI_DBG_DEV, "cdev 0x%p, p#%u.\n", cdev, cdev->nports); in cxgbi_hbas_add()
343 for (i = 0; i < cdev->nports; i++) { in cxgbi_hbas_add()
347 cdev, i, cdev->ports[i]->name); in cxgbi_hbas_add()
359 chba->cdev = cdev; in cxgbi_hbas_add()
360 chba->ndev = cdev->ports[i]; in cxgbi_hbas_add()
365 cdev, i, cdev->ports[i]->name, chba); in cxgbi_hbas_add()
367 pci_dev_get(cdev->pdev); in cxgbi_hbas_add()
368 err = iscsi_host_add(shost, &cdev->pdev->dev); in cxgbi_hbas_add()
371 cdev, i, cdev->ports[i]->name); in cxgbi_hbas_add()
372 pci_dev_put(cdev->pdev); in cxgbi_hbas_add()
377 cdev->hbas[i] = chba; in cxgbi_hbas_add()
383 cxgbi_hbas_remove(cdev); in cxgbi_hbas_add()
403 static struct cxgbi_sock *find_sock_on_port(struct cxgbi_device *cdev, in find_sock_on_port() argument
406 struct cxgbi_ports_map *pmap = &cdev->pmap; in find_sock_on_port()
433 struct cxgbi_device *cdev = csk->cdev; in sock_get_port() local
434 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_get_port()
441 cdev, csk->port_id, cdev->ports[csk->port_id]->name); in sock_get_port()
460 cdev, csk->port_id, cdev->ports[csk->port_id]->name); in sock_get_port()
477 cdev, csk->port_id, in sock_get_port()
478 cdev->ports[csk->port_id]->name, in sock_get_port()
487 cdev, csk->port_id, cdev->ports[csk->port_id]->name, in sock_get_port()
494 struct cxgbi_device *cdev = csk->cdev; in sock_put_port() local
495 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_put_port()
509 cdev, csk->port_id, in sock_put_port()
510 cdev->ports[csk->port_id]->name, in sock_put_port()
522 cdev, csk->port_id, cdev->ports[csk->port_id]->name, in sock_put_port()
549 static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev) in cxgbi_sock_create() argument
558 if (cdev->csk_alloc_cpls(csk) < 0) { in cxgbi_sock_create()
570 csk->cdev = cdev; in cxgbi_sock_create()
574 log_debug(1 << CXGBI_DBG_SOCK, "cdev 0x%p, new csk 0x%p.\n", cdev, csk); in cxgbi_sock_create()
598 struct cxgbi_device *cdev; in cxgbi_check_route() local
638 cdev = cxgbi_device_find_by_netdev(ndev, &port); in cxgbi_check_route()
639 if (!cdev) { in cxgbi_check_route()
648 port, ndev->name, cdev); in cxgbi_check_route()
650 csk = cxgbi_sock_create(cdev); in cxgbi_check_route()
655 csk->cdev = cdev; in cxgbi_check_route()
699 struct cxgbi_device *cdev; in cxgbi_check_route6() local
739 cdev = cxgbi_device_find_by_netdev(ndev, &port); in cxgbi_check_route6()
740 if (!cdev) in cxgbi_check_route6()
741 cdev = cxgbi_device_find_by_mac(ndev, &port); in cxgbi_check_route6()
742 if (!cdev) { in cxgbi_check_route6()
751 ndev->name, cdev); in cxgbi_check_route6()
753 csk = cxgbi_sock_create(cdev); in cxgbi_check_route6()
758 csk->cdev = cdev; in cxgbi_check_route6()
835 csk->cdev->csk_release_offload_resources(csk); in cxgbi_sock_closed()
866 csk->cdev->csk_send_abort_req(csk); in need_active_close()
868 csk->cdev->csk_send_close_req(csk); in need_active_close()
1042 if (csk->cdev->csk_push_tx_frames(csk, 0)) in cxgbi_sock_rcv_wr_ack()
1056 while (i < csk->cdev->nmtus - 1 && csk->cdev->mtus[i + 1] <= mtu) in cxgbi_sock_find_best_mtu()
1071 if (csk->advmss < csk->cdev->mtus[0] - 40) in cxgbi_sock_select_mss()
1072 csk->advmss = csk->cdev->mtus[0] - 40; in cxgbi_sock_select_mss()
1107 struct cxgbi_device *cdev = csk->cdev; in cxgbi_sock_send_pdus() local
1129 if (csk->write_seq - csk->snd_una >= cdev->snd_win) { in cxgbi_sock_send_pdus()
1133 csk->snd_una, cdev->snd_win); in cxgbi_sock_send_pdus()
1142 if (unlikely(skb_headroom(skb) < cdev->skb_tx_rsvd)) { in cxgbi_sock_send_pdus()
1144 csk, skb_headroom(skb), cdev->skb_tx_rsvd); in cxgbi_sock_send_pdus()
1168 cdev->csk_push_tx_frames(csk, 1); in cxgbi_sock_send_pdus()
1460 struct cxgbi_device *cdev = chba->cdev; in ddp_tag_release() local
1461 struct cxgbi_ddp_info *ddp = cdev->ddp; in ddp_tag_release()
1478 cdev->csk_ddp_clear(chba, tag, idx, npods); in ddp_tag_release()
1489 struct cxgbi_device *cdev = csk->cdev; in ddp_tag_reserve() local
1490 struct cxgbi_ddp_info *ddp = cdev->ddp; in ddp_tag_reserve()
1491 struct cxgbi_tag_format *tformat = &cdev->tag_format; in ddp_tag_reserve()
1528 err = cdev->csk_ddp_set(csk, &hdr, idx, npods, gl); in ddp_tag_reserve()
1549 struct cxgbi_device *cdev = csk->cdev; in cxgbi_ddp_reserve() local
1550 struct cxgbi_tag_format *tformat = &cdev->tag_format; in cxgbi_ddp_reserve()
1554 if (page_idx >= DDP_PGIDX_MAX || !cdev->ddp || in cxgbi_ddp_reserve()
1567 gl = ddp_make_gl(xferlen, sgl, sgcnt, cdev->pdev, gfp); in cxgbi_ddp_reserve()
1573 ddp_release_gl(gl, cdev->pdev); in cxgbi_ddp_reserve()
1583 struct cxgbi_device *cdev = ddp->cdev; in ddp_destroy() local
1586 pr_info("kref 0, destroy ddp 0x%p, cdev 0x%p.\n", ddp, cdev); in ddp_destroy()
1594 pr_info("cdev 0x%p, ddp %d + %d.\n", cdev, i, npods); in ddp_destroy()
1603 int cxgbi_ddp_cleanup(struct cxgbi_device *cdev) in cxgbi_ddp_cleanup() argument
1605 struct cxgbi_ddp_info *ddp = cdev->ddp; in cxgbi_ddp_cleanup()
1608 "cdev 0x%p, release ddp 0x%p.\n", cdev, ddp); in cxgbi_ddp_cleanup()
1609 cdev->ddp = NULL; in cxgbi_ddp_cleanup()
1616 int cxgbi_ddp_init(struct cxgbi_device *cdev, in cxgbi_ddp_init() argument
1634 pr_warn("cdev 0x%p, ddp ppmax %u OOM.\n", cdev, ppmax); in cxgbi_ddp_init()
1638 cdev->ddp = ddp; in cxgbi_ddp_init()
1643 ddp->cdev = cdev; in cxgbi_ddp_init()
1644 ddp->pdev = cdev->pdev; in cxgbi_ddp_init()
1655 cdev->tag_format.sw_bits = sw_tag_idx_bits + sw_tag_age_bits; in cxgbi_ddp_init()
1656 cdev->tag_format.rsvd_bits = ddp->idx_bits; in cxgbi_ddp_init()
1657 cdev->tag_format.rsvd_shift = PPOD_IDX_SHIFT; in cxgbi_ddp_init()
1658 cdev->tag_format.rsvd_mask = (1 << cdev->tag_format.rsvd_bits) - 1; in cxgbi_ddp_init()
1661 cdev->ports[0]->name, cdev->tag_format.sw_bits, in cxgbi_ddp_init()
1662 cdev->tag_format.rsvd_bits, cdev->tag_format.rsvd_shift, in cxgbi_ddp_init()
1663 cdev->tag_format.rsvd_mask); in cxgbi_ddp_init()
1665 cdev->tx_max_size = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD, in cxgbi_ddp_init()
1667 cdev->rx_max_size = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD, in cxgbi_ddp_init()
1672 cdev->ports[0]->name, cdev->tx_max_size, ddp->max_txsz, in cxgbi_ddp_init()
1673 cdev->rx_max_size, ddp->max_rxsz); in cxgbi_ddp_init()
1690 struct cxgbi_tag_format *tformat = &chba->cdev->tag_format; in task_release_itt()
1694 "cdev 0x%p, release tag 0x%x.\n", chba->cdev, tag); in task_release_itt()
1709 struct cxgbi_tag_format *tformat = &chba->cdev->tag_format; in task_reserve_itt()
1735 chba->cdev, task, sw_tag, task->itt, sess->age, tag, *hdr_itt); in task_reserve_itt()
1743 struct cxgbi_device *cdev = cconn->chba->cdev; in cxgbi_parse_pdu_itt() local
1747 sw_bits = cxgbi_tag_nonrsvd_bits(&cdev->tag_format, tag); in cxgbi_parse_pdu_itt()
1755 cdev, tag, itt, sw_bits, idx ? *idx : 0xFFFFF, in cxgbi_parse_pdu_itt()
1880 struct cxgbi_device *cdev = csk->cdev; in csk_return_rx_credits() local
1887 csk->rcv_wup, cdev->rx_credit_thres, in csk_return_rx_credits()
1888 cdev->rcv_win); in csk_return_rx_credits()
1896 if (unlikely(cdev->rx_credit_thres == 0)) in csk_return_rx_credits()
1899 must_send = credits + 16384 >= cdev->rcv_win; in csk_return_rx_credits()
1900 if (must_send || credits >= cdev->rx_credit_thres) in csk_return_rx_credits()
1901 csk->rcv_wup += cdev->csk_send_rx_credits(csk, credits); in csk_return_rx_credits()
1906 struct cxgbi_device *cdev = csk->cdev; in cxgbi_conn_pdu_ready() local
1952 err + cdev->skb_rx_extra); in cxgbi_conn_pdu_ready()
2092 struct cxgbi_device *cdev = cconn->chba->cdev; in cxgbi_conn_alloc_pdu() local
2102 if (SKB_MAX_HEAD(cdev->skb_tx_rsvd) > (512 * MAX_SKB_FRAGS) && in cxgbi_conn_alloc_pdu()
2108 SKB_MAX_HEAD(cdev->skb_tx_rsvd), in cxgbi_conn_alloc_pdu()
2111 tdata->skb = alloc_skb(cdev->skb_tx_rsvd + headroom, GFP_ATOMIC); in cxgbi_conn_alloc_pdu()
2114 struct net_device *ndev = cdev->ports[csk->port_id]; in cxgbi_conn_alloc_pdu()
2119 skb_reserve(tdata->skb, cdev->skb_tx_rsvd); in cxgbi_conn_alloc_pdu()
2129 task, opcode, tdata->skb, cdev->skb_tx_rsvd, headroom, in cxgbi_conn_alloc_pdu()
2353 struct cxgbi_device *cdev = cconn->chba->cdev; in cxgbi_conn_max_xmit_dlength() local
2354 unsigned int headroom = SKB_MAX_HEAD(cdev->skb_tx_rsvd); in cxgbi_conn_max_xmit_dlength()
2358 max = min(cconn->chba->cdev->tx_max_size, max); in cxgbi_conn_max_xmit_dlength()
2372 unsigned int max = cconn->chba->cdev->rx_max_size; in cxgbi_conn_max_recv_dlength()
2407 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, in cxgbi_set_conn_param()
2414 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, in cxgbi_set_conn_param()
2538 err = csk->cdev->csk_ddp_setup_pgidx(csk, csk->tid, page_idx, 0); in cxgbi_bind_conn()
2590 cls_session = iscsi_session_setup(chba->cdev->itp, shost, in cxgbi_create_session()
2680 struct cxgbi_sock *csk = find_sock_on_port(chba->cdev, in cxgbi_get_host_param()
2738 hba = csk->cdev->hbas[csk->port_id]; in cxgbi_ep_connect()
2739 else if (hba != csk->cdev->hbas[csk->port_id]) { in cxgbi_ep_connect()
2743 csk->cdev->hbas[csk->port_id], csk->port_id); in cxgbi_ep_connect()
2753 err = csk->cdev->csk_init_act_open(csk); in cxgbi_ep_connect()