public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Max Gurtovoy <maxg@mellanox.com>
Cc: Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagig@mellanox.com>,
	linux-rdma@vger.kernel.org, target-devel@vger.kernel.org
Subject: Re: [PATCH 2/4] IB/isert: convert to new CQ API
Date: Wed, 17 Feb 2016 15:18:52 +0100	[thread overview]
Message-ID: <20160217141852.GA15646@lst.de> (raw)
In-Reply-To: <56C364B8.6010807@mellanox.com>

On Tue, Feb 16, 2016 at 08:04:40PM +0200, Max Gurtovoy wrote:
>> @@ -977,7 +959,10 @@ isert_post_recvm(struct isert_conn *isert_conn, u32 count)
>>
>>   	for (rx_wr = isert_conn->rx_wr, i = 0; i < count; i++, rx_wr++) {
>>   		rx_desc = &isert_conn->rx_descs[i];
>> -		rx_wr->wr_id = (uintptr_t)rx_desc;
>> +
>> +		rx_desc->rx_cqe.done = isert_recv_done;
>
> perhaps we can do it once in isert_alloc_rx_descriptors ?

Ok.

>> +static void
>> +isert_recv_done(struct ib_cq *cq, struct ib_wc *wc)
>>   {
>> +	struct isert_conn *isert_conn = wc->qp->qp_context;
>> +	struct ib_device *ib_dev = isert_conn->cm_id->device;
>> +	struct iser_rx_desc *rx_desc =
>> +		container_of(wc->wr_cqe, struct iser_rx_desc, rx_cqe);
>
> maybe we can define it as:
> static inline struct iser_rx_desc *
> isert_rx(struct ib_cqe *rx_cqe)
> {
>    return container_of(rx_cqe, struct iser_rx_desc, rx_cqe);
> }
> in the .h file ?

There is just a single use of this pattern, but if everyone prefers
the helper I can add it.

>> +	struct iscsi_hdr *hdr = &rx_desc->iscsi_header;
>>   	struct iser_ctrl *iser_ctrl = &rx_desc->iser_header;
>>   	uint64_t read_va = 0, write_va = 0;
>
>
>
>> +	if (unlikely(wc->status != IB_WC_SUCCESS)) {
>> +		isert_print_wc(wc);
>> +		if (!--isert_conn->post_recv_buf_count)
>
> maybe we can do isert_conn->post_recv_buf_count-- once at the beginning of 
> the function?

I'd rather not move the assignment around in this patch.  If you
think this can sensible be done please send a follow up patch that
also explains why it's safe.

> maybe we can do isert_conn->post_recv_buf_count-- once at the beginning of 
> the function?

Same as above.

>> +	struct iser_tx_desc *desc =
>> +		container_of(wc->wr_cqe, struct iser_tx_desc, tx_cqe);
>
> maybe we can define it as:
> static inline struct iser_tx_desc *
> isert_tx(struct ib_cqe *tx_cqe)
> {
>    return container_of(tx_cqe, struct iser_tx_desc, tx_cqe);
> }

We've got a couple more instances of this one, so this might be
worth it.

  reply	other threads:[~2016-02-17 14:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 20:10 isert: convert to the new CQ API and a few random cleanups Christoph Hellwig
2016-02-15 20:10 ` [PATCH 1/4] IB/isert: properly type the login buffer Christoph Hellwig
     [not found]   ` <1455567060-18381-2-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-02-16  4:40     ` Leon Romanovsky
     [not found]       ` <20160216044058.GA27580-2ukJVAZIZ/Y@public.gmane.org>
2016-02-17 10:29         ` Christoph Hellwig
2016-02-16 17:19     ` Max Gurtovoy
2016-02-17 10:33       ` Christoph Hellwig
2016-02-16  6:47   ` Or Gerlitz
2016-02-15 20:10 ` [PATCH 2/4] IB/isert: convert to new CQ API Christoph Hellwig
2016-02-16 18:04   ` Max Gurtovoy
2016-02-17 14:18     ` Christoph Hellwig [this message]
2016-02-18 12:32       ` Max Gurtovoy
     [not found] ` <1455567060-18381-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-02-15 20:10   ` [PATCH 3/4] IB/isert: kill struct isert_rdma_wr Christoph Hellwig
     [not found]     ` <1455567060-18381-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-02-17  9:03       ` Max Gurtovoy
2016-02-15 20:11   ` [PATCH 4/4] IB/isert: the kill ->isert_cmd back pointer in the struct iser_tx_desc Christoph Hellwig
2016-02-17  9:31     ` Max Gurtovoy
2016-02-17 14:19       ` Christoph Hellwig
2016-02-16 10:53 ` isert: convert to the new CQ API and a few random cleanups Sagi Grimberg

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=20160217141852.GA15646@lst.de \
    --to=hch@lst.de \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maxg@mellanox.com \
    --cc=sagig@mellanox.com \
    --cc=target-devel@vger.kernel.org \
    /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