From: Or Gerlitz <ogerlitz@voltaire.com>
To: Sean Hefty <sean.hefty@intel.com>
Cc: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: Re: [openib-general] [PATCH 5/6] iser RDMA CM (CMA) and IB verbsinteraction
Date: Sun, 30 Apr 2006 15:30:17 +0300 [thread overview]
Message-ID: <4454ADD9.20909@voltaire.com> (raw)
In-Reply-To: <ORSMSX401EXUIEAOeIi0000001c@orsmsx401.amr.corp.intel.com>
Sean Hefty wrote:
>> +static int iser_free_device_ib_res(struct iser_device *device)
>> +{
>> + BUG_ON(device->mr == NULL);
>> +
>> + tasklet_kill(&device->cq_tasklet);
>> +
>> + (void)ib_dereg_mr(device->mr);
>> + (void)ib_destroy_cq(device->cq);
>> + (void)ib_dealloc_pd(device->pd);
>> +
>> + device->mr = NULL;
>> + device->cq = NULL;
>> + device->pd = NULL;
>> + return 0;
>> +}
>
> Can you eliminate the return code?
Yes
>> +static int iser_free_ib_conn_res(struct iser_conn *ib_conn)
>> +{
>> + BUG_ON(ib_conn == NULL);
>> +
>> + iser_err("freeing conn %p cma_id %p fmr pool %p qp %p\n",
>> + ib_conn, ib_conn->cma_id,
>> + ib_conn->fmr_pool, ib_conn->qp);
>> +
>> + /* qp is created only once both addr & route are resolved */
>> + if (ib_conn->fmr_pool != NULL)
>> + ib_destroy_fmr_pool(ib_conn->fmr_pool);
>> +
>> + if (ib_conn->qp != NULL)
>> + rdma_destroy_qp(ib_conn->cma_id);
>> +
>> + if (ib_conn->cma_id != NULL)
>> + rdma_destroy_id(ib_conn->cma_id);
> Are the NULL checks needed above? Neither iser_create_device_ib_res() or
> iser_create_ib_conn_res() set the values to NULL if an error occurred.
we are dealing here with connection resources so the (shared among ib
conns) device resources are irrelevant. The ib conn struct is kzallec-ed
on creation, where later iser_free_ib_conn_res() can be called when only
a ***subset*** of the resources was allocated. Examples are instant
error from rdma_addr_resolve() or getting ADDR/ROUTE ERROR vs. CONNECT
ERROR cma events, in the first three cases only the cma id should be
destroyed while on the latter there's a need to destroy the fmr pool and
the qp.
>> +/**
>> + * based on the resolved device node GUID see if there already allocated
>> + * device for this device. If there's no such, create one.
>> + */
>> +static
>> +struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
>> +{
>> + struct list_head *p_list;
>> + struct iser_device *device = NULL;
>> +
>> + mutex_lock(&ig.device_list_mutex);
>> +
>> + p_list = ig.device_list.next;
>> + while (p_list != &ig.device_list) {
>> + device = list_entry(p_list, struct iser_device, ig_list);
>> + /* find if there's a match using the node GUID */
>> + if (device->ib_device->node_guid == cma_id->device->node_guid)
>> + break;
>> + }
>> +
>> + if (device == NULL) {
>> + device = kzalloc(sizeof *device, GFP_KERNEL);
>> + if (device == NULL)
>> + goto end;
> goto out; // see below
>> + /* assign this device to the device */
>> + device->ib_device = cma_id->device;
>> + /* init the device and link it into ig device list */
>> + if (iser_create_device_ib_res(device)) {
>> + kfree(device);
>> + device = NULL;
>> + goto end;
>> + }
>> + list_add(&device->ig_list, &ig.device_list);
>> + }
>> +end:
>> + BUG_ON(device == NULL);
>> + device->refcount++;
>
> out:
OK
Or.
next prev parent reply other threads:[~2006-04-30 12:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-27 12:30 [PATCH 0/6] iSER (iSCSI Extensions for RDMA) initiator Or Gerlitz
2006-04-27 12:30 ` [PATCH 1/6] iSER's Makefile and Kconfig Or Gerlitz
2006-04-27 12:31 ` [PATCH 2/6] iscsi_iser header file Or Gerlitz
2006-04-27 12:31 ` [PATCH 3/6] open iscsi iser transport provider code Or Gerlitz
2006-04-27 12:32 ` [PATCH 4/6] iser initiator Or Gerlitz
2006-04-27 12:32 ` [PATCH 5/6] iser RDMA CM (CMA) and IB verbs interaction Or Gerlitz
2006-04-27 12:33 ` [PATCH 6/6] iser handling of memory for RDMA Or Gerlitz
2006-04-28 23:05 ` [openib-general] [PATCH 5/6] iser RDMA CM (CMA) and IB verbsinteraction Sean Hefty
2006-04-30 12:30 ` Or Gerlitz [this message]
2006-05-01 13:02 ` Or Gerlitz
2006-05-04 13:00 ` [openib-general] [PATCH 5/6] iser RDMA CM (CMA) and IB verbs interaction Or Gerlitz
2006-05-04 13:06 ` Or Gerlitz
2006-04-27 17:01 ` [PATCH 3/6] open iscsi iser transport provider code Stephen Hemminger
2006-04-27 16:58 ` [PATCH 2/6] iscsi_iser header file Stephen Hemminger
2006-04-27 12:40 ` [PATCH 1/6] iSER's Makefile and Kconfig Jan-Benedict Glaw
2006-04-27 12:44 ` Or Gerlitz
2006-05-01 18:32 ` [PATCH 0/6] iSER (iSCSI Extensions for RDMA) initiator Roland Dreier
2006-05-02 7:56 ` Or Gerlitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4454ADD9.20909@voltaire.com \
--to=ogerlitz@voltaire.com \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
--cc=sean.hefty@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).