Lines Matching refs:ddp
116 if (cdev->ddp) in cxgbi_device_destroy()
1285 static inline int ddp_find_unused_entries(struct cxgbi_ddp_info *ddp, in ddp_find_unused_entries() argument
1300 spin_lock(&ddp->map_lock); in ddp_find_unused_entries()
1303 if (ddp->gl_map[k]) in ddp_find_unused_entries()
1308 ddp->gl_map[k] = gl; in ddp_find_unused_entries()
1309 spin_unlock(&ddp->map_lock); in ddp_find_unused_entries()
1314 spin_unlock(&ddp->map_lock); in ddp_find_unused_entries()
1320 static inline void ddp_unmark_entries(struct cxgbi_ddp_info *ddp, in ddp_unmark_entries() argument
1323 spin_lock(&ddp->map_lock); in ddp_unmark_entries()
1324 memset(&ddp->gl_map[start], 0, in ddp_unmark_entries()
1326 spin_unlock(&ddp->map_lock); in ddp_unmark_entries()
1461 struct cxgbi_ddp_info *ddp = cdev->ddp; in ddp_tag_release() local
1464 idx = (tag >> PPOD_IDX_SHIFT) & ddp->idx_mask; in ddp_tag_release()
1465 if (idx < ddp->nppods) { in ddp_tag_release()
1466 struct cxgbi_gather_list *gl = ddp->gl_map[idx]; in ddp_tag_release()
1479 ddp_unmark_entries(ddp, idx, npods); in ddp_tag_release()
1480 ddp_release_gl(gl, ddp->pdev); in ddp_tag_release()
1482 pr_warn("tag 0x%x, idx %u > max %u.\n", tag, idx, ddp->nppods); in ddp_tag_release()
1490 struct cxgbi_ddp_info *ddp = cdev->ddp; in ddp_tag_reserve() local
1499 if (ddp->idx_last == ddp->nppods) in ddp_tag_reserve()
1500 idx = ddp_find_unused_entries(ddp, 0, ddp->nppods, in ddp_tag_reserve()
1503 idx = ddp_find_unused_entries(ddp, ddp->idx_last + 1, in ddp_tag_reserve()
1504 ddp->nppods, npods, in ddp_tag_reserve()
1506 if (idx < 0 && ddp->idx_last >= npods) { in ddp_tag_reserve()
1507 idx = ddp_find_unused_entries(ddp, 0, in ddp_tag_reserve()
1508 min(ddp->idx_last + npods, ddp->nppods), in ddp_tag_reserve()
1524 hdr.pgsz_tag_clr = htonl(tag & ddp->rsvd_tag_mask); in ddp_tag_reserve()
1532 ddp->idx_last = idx; in ddp_tag_reserve()
1541 ddp_unmark_entries(ddp, idx, npods); in ddp_tag_reserve()
1554 if (page_idx >= DDP_PGIDX_MAX || !cdev->ddp || in cxgbi_ddp_reserve()
1580 struct cxgbi_ddp_info *ddp = container_of(kref, in ddp_destroy() local
1583 struct cxgbi_device *cdev = ddp->cdev; in ddp_destroy()
1586 pr_info("kref 0, destroy ddp 0x%p, cdev 0x%p.\n", ddp, cdev); in ddp_destroy()
1588 while (i < ddp->nppods) { in ddp_destroy()
1589 struct cxgbi_gather_list *gl = ddp->gl_map[i]; in ddp_destroy()
1600 cxgbi_free_big_mem(ddp); in ddp_destroy()
1605 struct cxgbi_ddp_info *ddp = cdev->ddp; in cxgbi_ddp_cleanup() local
1608 "cdev 0x%p, release ddp 0x%p.\n", cdev, ddp); in cxgbi_ddp_cleanup()
1609 cdev->ddp = NULL; in cxgbi_ddp_cleanup()
1610 if (ddp) in cxgbi_ddp_cleanup()
1611 return kref_put(&ddp->refcnt, ddp_destroy); in cxgbi_ddp_cleanup()
1620 struct cxgbi_ddp_info *ddp; in cxgbi_ddp_init() local
1629 ddp = cxgbi_alloc_big_mem(sizeof(struct cxgbi_ddp_info) + in cxgbi_ddp_init()
1633 if (!ddp) { in cxgbi_ddp_init()
1637 ddp->gl_map = (struct cxgbi_gather_list **)(ddp + 1); in cxgbi_ddp_init()
1638 cdev->ddp = ddp; in cxgbi_ddp_init()
1640 spin_lock_init(&ddp->map_lock); in cxgbi_ddp_init()
1641 kref_init(&ddp->refcnt); in cxgbi_ddp_init()
1643 ddp->cdev = cdev; in cxgbi_ddp_init()
1644 ddp->pdev = cdev->pdev; in cxgbi_ddp_init()
1645 ddp->llimit = llimit; in cxgbi_ddp_init()
1646 ddp->ulimit = ulimit; in cxgbi_ddp_init()
1647 ddp->max_txsz = min_t(unsigned int, max_txsz, ULP2_MAX_PKT_SIZE); in cxgbi_ddp_init()
1648 ddp->max_rxsz = min_t(unsigned int, max_rxsz, ULP2_MAX_PKT_SIZE); in cxgbi_ddp_init()
1649 ddp->nppods = ppmax; in cxgbi_ddp_init()
1650 ddp->idx_last = ppmax; in cxgbi_ddp_init()
1651 ddp->idx_bits = bits; in cxgbi_ddp_init()
1652 ddp->idx_mask = (1 << bits) - 1; in cxgbi_ddp_init()
1653 ddp->rsvd_tag_mask = (1 << (bits + PPOD_IDX_SHIFT)) - 1; in cxgbi_ddp_init()
1656 cdev->tag_format.rsvd_bits = ddp->idx_bits; in cxgbi_ddp_init()
1666 ddp->max_txsz - ISCSI_PDU_NONPAYLOAD_LEN); in cxgbi_ddp_init()
1668 ddp->max_rxsz - ISCSI_PDU_NONPAYLOAD_LEN); 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()