Lines Matching refs:cdev

67 int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base,  in cxgbi_device_portmap_create()  argument
70 struct cxgbi_ports_map *pmap = &cdev->pmap; in cxgbi_device_portmap_create()
76 pr_warn("cdev 0x%p, portmap OOM %u.\n", cdev, max_conn); in cxgbi_device_portmap_create()
87 void cxgbi_device_portmap_cleanup(struct cxgbi_device *cdev) in cxgbi_device_portmap_cleanup() argument
89 struct cxgbi_ports_map *pmap = &cdev->pmap; in cxgbi_device_portmap_cleanup()
99 csk, cdev); in cxgbi_device_portmap_cleanup()
110 static inline void cxgbi_device_destroy(struct cxgbi_device *cdev) in cxgbi_device_destroy() argument
113 "cdev 0x%p, p# %u.\n", cdev, cdev->nports); in cxgbi_device_destroy()
114 cxgbi_hbas_remove(cdev); in cxgbi_device_destroy()
115 cxgbi_device_portmap_cleanup(cdev); in cxgbi_device_destroy()
116 if (cdev->dev_ddp_cleanup) in cxgbi_device_destroy()
117 cdev->dev_ddp_cleanup(cdev); in cxgbi_device_destroy()
119 cxgbi_ddp_cleanup(cdev); in cxgbi_device_destroy()
120 if (cdev->ddp) in cxgbi_device_destroy()
121 cxgbi_ddp_cleanup(cdev); in cxgbi_device_destroy()
122 if (cdev->pmap.max_connect) in cxgbi_device_destroy()
123 cxgbi_free_big_mem(cdev->pmap.port_csk); in cxgbi_device_destroy()
124 kfree(cdev); in cxgbi_device_destroy()
130 struct cxgbi_device *cdev; in cxgbi_device_register() local
132 cdev = kzalloc(sizeof(*cdev) + extra + nports * in cxgbi_device_register()
136 if (!cdev) { in cxgbi_device_register()
140 cdev->ports = (struct net_device **)(cdev + 1); in cxgbi_device_register()
141 cdev->hbas = (struct cxgbi_hba **)(((char*)cdev->ports) + nports * in cxgbi_device_register()
144 cdev->dd_data = ((char *)cdev->hbas) + in cxgbi_device_register()
146 spin_lock_init(&cdev->pmap.lock); in cxgbi_device_register()
149 list_add_tail(&cdev->list_head, &cdev_list); in cxgbi_device_register()
153 list_add_tail_rcu(&cdev->rcu_node, &cdev_rcu_list); in cxgbi_device_register()
157 "cdev 0x%p, p# %u.\n", cdev, nports); in cxgbi_device_register()
158 return cdev; in cxgbi_device_register()
162 void cxgbi_device_unregister(struct cxgbi_device *cdev) in cxgbi_device_unregister() argument
166 cdev, cdev->nports, cdev->nports ? cdev->ports[0]->name : ""); in cxgbi_device_unregister()
169 list_del(&cdev->list_head); in cxgbi_device_unregister()
173 list_del_rcu(&cdev->rcu_node); in cxgbi_device_unregister()
177 cxgbi_device_destroy(cdev); in cxgbi_device_unregister()
183 struct cxgbi_device *cdev, *tmp; in cxgbi_device_unregister_all() local
186 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { in cxgbi_device_unregister_all()
187 if ((cdev->flags & flag) == flag) { in cxgbi_device_unregister_all()
189 cxgbi_device_unregister(cdev); in cxgbi_device_unregister_all()
199 struct cxgbi_device *cdev, *tmp; in cxgbi_device_find_by_lldev() local
202 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { in cxgbi_device_find_by_lldev()
203 if (cdev->lldev == lldev) { in cxgbi_device_find_by_lldev()
205 return cdev; in cxgbi_device_find_by_lldev()
220 struct cxgbi_device *cdev, *tmp; in cxgbi_device_find_by_netdev() local
231 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { in cxgbi_device_find_by_netdev()
232 for (i = 0; i < cdev->nports; i++) { in cxgbi_device_find_by_netdev()
233 if (ndev == cdev->ports[i]) { in cxgbi_device_find_by_netdev()
234 cdev->hbas[i]->vdev = vdev; in cxgbi_device_find_by_netdev()
238 return cdev; in cxgbi_device_find_by_netdev()
253 struct cxgbi_device *cdev; in cxgbi_device_find_by_netdev_rcu() local
263 list_for_each_entry_rcu(cdev, &cdev_rcu_list, rcu_node) { in cxgbi_device_find_by_netdev_rcu()
264 for (i = 0; i < cdev->nports; i++) { in cxgbi_device_find_by_netdev_rcu()
265 if (ndev == cdev->ports[i]) { in cxgbi_device_find_by_netdev_rcu()
266 cdev->hbas[i]->vdev = vdev; in cxgbi_device_find_by_netdev_rcu()
270 return cdev; in cxgbi_device_find_by_netdev_rcu()
287 struct cxgbi_device *cdev, *tmp; in cxgbi_device_find_by_mac() local
297 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { in cxgbi_device_find_by_mac()
298 for (i = 0; i < cdev->nports; i++) { in cxgbi_device_find_by_mac()
299 if (!memcmp(ndev->dev_addr, cdev->ports[i]->dev_addr, in cxgbi_device_find_by_mac()
301 cdev->hbas[i]->vdev = vdev; in cxgbi_device_find_by_mac()
305 return cdev; in cxgbi_device_find_by_mac()
317 void cxgbi_hbas_remove(struct cxgbi_device *cdev) in cxgbi_hbas_remove() argument
323 "cdev 0x%p, p#%u.\n", cdev, cdev->nports); in cxgbi_hbas_remove()
325 for (i = 0; i < cdev->nports; i++) { in cxgbi_hbas_remove()
326 chba = cdev->hbas[i]; in cxgbi_hbas_remove()
328 cdev->hbas[i] = NULL; in cxgbi_hbas_remove()
330 pci_dev_put(cdev->pdev); in cxgbi_hbas_remove()
337 int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun, in cxgbi_hbas_add() argument
345 log_debug(1 << CXGBI_DBG_DEV, "cdev 0x%p, p#%u.\n", cdev, cdev->nports); in cxgbi_hbas_add()
347 for (i = 0; i < cdev->nports; i++) { in cxgbi_hbas_add()
351 cdev, i, cdev->ports[i]->name); in cxgbi_hbas_add()
363 chba->cdev = cdev; in cxgbi_hbas_add()
364 chba->ndev = cdev->ports[i]; in cxgbi_hbas_add()
369 cdev, i, cdev->ports[i]->name, chba); in cxgbi_hbas_add()
371 pci_dev_get(cdev->pdev); in cxgbi_hbas_add()
372 err = iscsi_host_add(shost, &cdev->pdev->dev); in cxgbi_hbas_add()
375 cdev, i, cdev->ports[i]->name); in cxgbi_hbas_add()
376 pci_dev_put(cdev->pdev); in cxgbi_hbas_add()
381 cdev->hbas[i] = chba; in cxgbi_hbas_add()
387 cxgbi_hbas_remove(cdev); in cxgbi_hbas_add()
407 static struct cxgbi_sock *find_sock_on_port(struct cxgbi_device *cdev, in find_sock_on_port() argument
410 struct cxgbi_ports_map *pmap = &cdev->pmap; in find_sock_on_port()
437 struct cxgbi_device *cdev = csk->cdev; in sock_get_port() local
438 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_get_port()
445 cdev, csk->port_id, cdev->ports[csk->port_id]->name); in sock_get_port()
464 cdev, csk->port_id, cdev->ports[csk->port_id]->name); in sock_get_port()
481 cdev, csk->port_id, in sock_get_port()
482 cdev->ports[csk->port_id]->name, in sock_get_port()
491 cdev, csk->port_id, cdev->ports[csk->port_id]->name, in sock_get_port()
498 struct cxgbi_device *cdev = csk->cdev; in sock_put_port() local
499 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_put_port()
513 cdev, csk->port_id, in sock_put_port()
514 cdev->ports[csk->port_id]->name, in sock_put_port()
526 cdev, csk->port_id, cdev->ports[csk->port_id]->name, in sock_put_port()
553 static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev) in cxgbi_sock_create() argument
562 if (cdev->csk_alloc_cpls(csk) < 0) { in cxgbi_sock_create()
574 csk->cdev = cdev; in cxgbi_sock_create()
578 log_debug(1 << CXGBI_DBG_SOCK, "cdev 0x%p, new csk 0x%p.\n", cdev, csk); in cxgbi_sock_create()
602 struct cxgbi_device *cdev; in cxgbi_check_route() local
642 cdev = cxgbi_device_find_by_netdev(ndev, &port); in cxgbi_check_route()
643 if (!cdev) { in cxgbi_check_route()
652 port, ndev->name, cdev); in cxgbi_check_route()
654 csk = cxgbi_sock_create(cdev); in cxgbi_check_route()
659 csk->cdev = cdev; in cxgbi_check_route()
703 struct cxgbi_device *cdev; in cxgbi_check_route6() local
743 cdev = cxgbi_device_find_by_netdev(ndev, &port); in cxgbi_check_route6()
744 if (!cdev) in cxgbi_check_route6()
745 cdev = cxgbi_device_find_by_mac(ndev, &port); in cxgbi_check_route6()
746 if (!cdev) { in cxgbi_check_route6()
755 ndev->name, cdev); in cxgbi_check_route6()
757 csk = cxgbi_sock_create(cdev); in cxgbi_check_route6()
762 csk->cdev = cdev; in cxgbi_check_route6()
839 csk->cdev->csk_release_offload_resources(csk); in cxgbi_sock_closed()
870 csk->cdev->csk_send_abort_req(csk); in need_active_close()
872 csk->cdev->csk_send_close_req(csk); in need_active_close()
1046 if (csk->cdev->csk_push_tx_frames(csk, 0)) in cxgbi_sock_rcv_wr_ack()
1060 while (i < csk->cdev->nmtus - 1 && csk->cdev->mtus[i + 1] <= mtu) in cxgbi_sock_find_best_mtu()
1075 if (csk->advmss < csk->cdev->mtus[0] - 40) in cxgbi_sock_select_mss()
1076 csk->advmss = csk->cdev->mtus[0] - 40; in cxgbi_sock_select_mss()
1111 struct cxgbi_device *cdev = csk->cdev; in cxgbi_sock_send_pdus() local
1146 if (unlikely(skb_headroom(skb) < cdev->skb_tx_rsvd)) { in cxgbi_sock_send_pdus()
1148 csk, skb_headroom(skb), cdev->skb_tx_rsvd); in cxgbi_sock_send_pdus()
1172 cdev->csk_push_tx_frames(csk, 1); in cxgbi_sock_send_pdus()
1464 struct cxgbi_device *cdev = chba->cdev; in ddp_tag_release() local
1465 struct cxgbi_ddp_info *ddp = cdev->ddp; in ddp_tag_release()
1482 cdev->csk_ddp_clear(chba, tag, idx, npods); in ddp_tag_release()
1493 struct cxgbi_device *cdev = csk->cdev; in ddp_tag_reserve() local
1494 struct cxgbi_ddp_info *ddp = cdev->ddp; in ddp_tag_reserve()
1495 struct cxgbi_tag_format *tformat = &cdev->tag_format; in ddp_tag_reserve()
1532 err = cdev->csk_ddp_set(csk, &hdr, idx, npods, gl); in ddp_tag_reserve()
1553 struct cxgbi_device *cdev = csk->cdev; in cxgbi_ddp_reserve() local
1554 struct cxgbi_tag_format *tformat = &cdev->tag_format; in cxgbi_ddp_reserve()
1558 if (page_idx >= DDP_PGIDX_MAX || !cdev->ddp || in cxgbi_ddp_reserve()
1571 gl = ddp_make_gl(xferlen, sgl, sgcnt, cdev->pdev, gfp); in cxgbi_ddp_reserve()
1577 ddp_release_gl(gl, cdev->pdev); in cxgbi_ddp_reserve()
1587 struct cxgbi_device *cdev = ddp->cdev; in ddp_destroy() local
1590 pr_info("kref 0, destroy ddp 0x%p, cdev 0x%p.\n", ddp, cdev); in ddp_destroy()
1598 pr_info("cdev 0x%p, ddp %d + %d.\n", cdev, i, npods); in ddp_destroy()
1607 int cxgbi_ddp_cleanup(struct cxgbi_device *cdev) in cxgbi_ddp_cleanup() argument
1609 struct cxgbi_ddp_info *ddp = cdev->ddp; in cxgbi_ddp_cleanup()
1612 "cdev 0x%p, release ddp 0x%p.\n", cdev, ddp); in cxgbi_ddp_cleanup()
1613 cdev->ddp = NULL; in cxgbi_ddp_cleanup()
1620 int cxgbi_ddp_init(struct cxgbi_device *cdev, in cxgbi_ddp_init() argument
1638 pr_warn("cdev 0x%p, ddp ppmax %u OOM.\n", cdev, ppmax); in cxgbi_ddp_init()
1642 cdev->ddp = ddp; in cxgbi_ddp_init()
1647 ddp->cdev = cdev; in cxgbi_ddp_init()
1648 ddp->pdev = cdev->pdev; in cxgbi_ddp_init()
1659 cdev->tag_format.sw_bits = sw_tag_idx_bits + sw_tag_age_bits; in cxgbi_ddp_init()
1660 cdev->tag_format.rsvd_bits = ddp->idx_bits; in cxgbi_ddp_init()
1661 cdev->tag_format.rsvd_shift = PPOD_IDX_SHIFT; in cxgbi_ddp_init()
1662 cdev->tag_format.rsvd_mask = (1 << cdev->tag_format.rsvd_bits) - 1; in cxgbi_ddp_init()
1665 cdev->ports[0]->name, cdev->tag_format.sw_bits, in cxgbi_ddp_init()
1666 cdev->tag_format.rsvd_bits, cdev->tag_format.rsvd_shift, in cxgbi_ddp_init()
1667 cdev->tag_format.rsvd_mask); in cxgbi_ddp_init()
1669 cdev->tx_max_size = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD, in cxgbi_ddp_init()
1671 cdev->rx_max_size = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD, in cxgbi_ddp_init()
1676 cdev->ports[0]->name, cdev->tx_max_size, ddp->max_txsz, in cxgbi_ddp_init()
1677 cdev->rx_max_size, ddp->max_rxsz); in cxgbi_ddp_init()
1694 struct cxgbi_tag_format *tformat = &chba->cdev->tag_format; in task_release_itt()
1698 "cdev 0x%p, release tag 0x%x.\n", chba->cdev, tag); in task_release_itt()
1713 struct cxgbi_tag_format *tformat = &chba->cdev->tag_format; in task_reserve_itt()
1739 chba->cdev, task, sw_tag, task->itt, sess->age, tag, *hdr_itt); in task_reserve_itt()
1747 struct cxgbi_device *cdev = cconn->chba->cdev; in cxgbi_parse_pdu_itt() local
1751 sw_bits = cxgbi_tag_nonrsvd_bits(&cdev->tag_format, tag); in cxgbi_parse_pdu_itt()
1759 cdev, tag, itt, sw_bits, idx ? *idx : 0xFFFFF, in cxgbi_parse_pdu_itt()
1884 struct cxgbi_device *cdev = csk->cdev; in csk_return_rx_credits() local
1891 csk->rcv_wup, cdev->rx_credit_thres, in csk_return_rx_credits()
1900 if (unlikely(cdev->rx_credit_thres == 0)) in csk_return_rx_credits()
1904 if (must_send || credits >= cdev->rx_credit_thres) in csk_return_rx_credits()
1905 csk->rcv_wup += cdev->csk_send_rx_credits(csk, credits); in csk_return_rx_credits()
1910 struct cxgbi_device *cdev = csk->cdev; in cxgbi_conn_pdu_ready() local
1956 err + cdev->skb_rx_extra); in cxgbi_conn_pdu_ready()
2096 struct cxgbi_device *cdev = cconn->chba->cdev; in cxgbi_conn_alloc_pdu() local
2106 if (SKB_MAX_HEAD(cdev->skb_tx_rsvd) > (512 * MAX_SKB_FRAGS) && in cxgbi_conn_alloc_pdu()
2112 SKB_MAX_HEAD(cdev->skb_tx_rsvd), in cxgbi_conn_alloc_pdu()
2115 tdata->skb = alloc_skb(cdev->skb_tx_rsvd + headroom, GFP_ATOMIC); in cxgbi_conn_alloc_pdu()
2118 struct net_device *ndev = cdev->ports[csk->port_id]; in cxgbi_conn_alloc_pdu()
2123 skb_reserve(tdata->skb, cdev->skb_tx_rsvd); in cxgbi_conn_alloc_pdu()
2133 task, opcode, tdata->skb, cdev->skb_tx_rsvd, headroom, in cxgbi_conn_alloc_pdu()
2357 struct cxgbi_device *cdev = cconn->chba->cdev; in cxgbi_conn_max_xmit_dlength() local
2358 unsigned int headroom = SKB_MAX_HEAD(cdev->skb_tx_rsvd); in cxgbi_conn_max_xmit_dlength()
2362 max = min(cconn->chba->cdev->tx_max_size, max); in cxgbi_conn_max_xmit_dlength()
2376 unsigned int max = cconn->chba->cdev->rx_max_size; in cxgbi_conn_max_recv_dlength()
2411 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, in cxgbi_set_conn_param()
2418 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, in cxgbi_set_conn_param()
2542 err = csk->cdev->csk_ddp_setup_pgidx(csk, csk->tid, page_idx, 0); in cxgbi_bind_conn()
2594 cls_session = iscsi_session_setup(chba->cdev->itp, shost, in cxgbi_create_session()
2684 struct cxgbi_sock *csk = find_sock_on_port(chba->cdev, in cxgbi_get_host_param()
2742 hba = csk->cdev->hbas[csk->port_id]; in cxgbi_ep_connect()
2743 else if (hba != csk->cdev->hbas[csk->port_id]) { in cxgbi_ep_connect()
2747 csk->cdev->hbas[csk->port_id], csk->port_id); in cxgbi_ep_connect()
2757 err = csk->cdev->csk_init_act_open(csk); in cxgbi_ep_connect()