failed:
atomic_dec(&kgnilnd_data.kgn_nconns);
- LIBCFS_FREE(conn->gnc_tx_ref_table, GNILND_MAX_MSG_ID * sizeof(void *));
+ kgnilnd_vfree(conn->gnc_tx_ref_table,
+ GNILND_MAX_MSG_ID * sizeof(void *));
LIBCFS_FREE(conn, sizeof(*conn));
return rc;
}
kgnilnd_peer_decref(conn->gnc_peer);
if (conn->gnc_tx_ref_table != NULL) {
- LIBCFS_FREE(conn->gnc_tx_ref_table,
- GNILND_MAX_MSG_ID * sizeof(void *));
+ kgnilnd_vfree(conn->gnc_tx_ref_table,
+ GNILND_MAX_MSG_ID * sizeof(void *));
}
LIBCFS_FREE(conn, sizeof(*conn));
/* Only free the buffer if we used it */
if (tx->tx_buffer_copy != NULL) {
- vfree(tx->tx_buffer_copy);
+ kgnilnd_vfree(tx->tx_buffer_copy, tx->tx_rdma_desc.length);
tx->tx_buffer_copy = NULL;
CDEBUG(D_MALLOC, "vfreed buffer2\n");
}
if (tx->tx_buffer_copy == NULL) {
/* Allocate the largest copy buffer we will need, this will prevent us from overwriting data
* and require at most we allocate a few extra bytes. */
- tx->tx_buffer_copy = vmalloc(desc_nob);
+ tx->tx_buffer_copy = kgnilnd_vzalloc(desc_nob);
if (!tx->tx_buffer_copy) {
/* allocation of buffer failed nak the rdma */
rc = kgnilnd_mem_register(conn->gnc_device->gnd_handle, (__u64)tx->tx_buffer_copy, desc_nob, NULL, GNI_MEM_READWRITE, &tx->tx_buffer_copy_map_key);
if (rc != GNI_RC_SUCCESS) {
/* Registration Failed nak rdma and kill the tx. */
- vfree(tx->tx_buffer_copy);
+ kgnilnd_vfree(tx->tx_buffer_copy,
+ desc_nob);
tx->tx_buffer_copy = NULL;
kgnilnd_nak_rdma(tx->tx_conn, tx->tx_msg.gnm_type, -EFAULT, cookie, tx->tx_msg.gnm_srcnid);
kgnilnd_tx_done(tx, -EFAULT);
kgnilnd_unmap_buffer(tx, 0);
if (tx->tx_buffer_copy != NULL) {
- vfree(tx->tx_buffer_copy);
+ kgnilnd_vfree(tx->tx_buffer_copy, desc_nob);
tx->tx_buffer_copy = NULL;
}
LIBCFS_FREE(fma_blk->gnm_bit_array, BITS_TO_LONGS(num_mbox) * sizeof (unsigned long));
free_blk:
if (fma_blk->gnm_state == GNILND_FMABLK_VIRT) {
- LIBCFS_FREE(fma_blk->gnm_block, fma_blk->gnm_blk_size);
+ kgnilnd_vfree(fma_blk->gnm_block, fma_blk->gnm_blk_size);
} else {
kmem_cache_free(kgnilnd_data.kgn_mbox_cache, fma_blk->gnm_block);
}
if (fma_blk->gnm_state == GNILND_FMABLK_PHYS) {
kmem_cache_free(kgnilnd_data.kgn_mbox_cache, fma_blk->gnm_block);
} else {
- LIBCFS_FREE(fma_blk->gnm_block, fma_blk->gnm_blk_size);
+ kgnilnd_vfree(fma_blk->gnm_block, fma_blk->gnm_blk_size);
}
fma_blk->gnm_state = GNILND_FMABLK_FREED;