All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Doug Ledford <dledford@redhat.com>,
	"Nicholas A. Bellinger" <nab@linux-iscsi.org>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	target-devel <target-devel@vger.kernel.org>
Subject: Re: [PATCH 4/4] IB/srpt: Convert to percpu_ida tag allocation
Date: Thu, 7 Apr 2016 15:43:38 +0200	[thread overview]
Message-ID: <20160407134338.GC17477@lst.de> (raw)
In-Reply-To: <57055C25.4060304@sandisk.com>

> +static struct srpt_send_ioctx *srpt_tag_to_ioctx(struct srpt_rdma_ch *ch,
> +						 int tag)
> +{
> +	return &((struct srpt_send_ioctx *)ch->sess->sess_cmd_map)[tag];
> +}
> +
> +static int srpt_ioctx_to_tag(struct srpt_rdma_ch *ch,
> +			     struct srpt_send_ioctx *ioctx)
> +{
> +	return ioctx - (struct srpt_send_ioctx *)ch->sess->sess_cmd_map;
> +}

This is really something the core code should be doing..

I have to admit I really don't understand why the target core is trying
to force everyone to use the ida allocator - the 'tag' concept here
isn't really useful to most drivers.

> +	for (i = 0; i < ch->rq_size; i++) {
> +		struct srpt_send_ioctx *ioctx = srpt_tag_to_ioctx(ch, i);
> +
> +		if (srpt_init_ioctx(sdev, &ioctx->ioctx, ch->rsp_size,
> +				    DMA_TO_DEVICE) < 0) {
> +			pr_err("Initialization of I/O context %d/%d failed\n",
> +			       i, ch->rq_size);
> +			goto deregister_session;
> +		}
> +		ioctx->ch = ch;
> +	}

E.g. here it would be really nice if the the driver had to just provide
init_cmd and cleanup_cmd methods, and the core would iterate over
the map, and call them on each cmds without the need for the
casts and pointer arithmetics in each driver.

But I guess for now this will do it:

Reviewed-by: Christoph Hellwig <hch@lst.de>

  reply	other threads:[~2016-04-07 13:43 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06 18:56 [PATCH 0/4] IB/srpt and the percpu_ida conversion Bart Van Assche
2016-04-06 18:56 ` [PATCH 1/4] IB/srpt: Revert "Convert to percpu_ida tag allocation" Bart Van Assche
2016-04-06 18:57 ` [PATCH 2/4] IB/srpt: Report login failures only once Bart Van Assche
     [not found]   ` <57055BFF.9060607-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-07 13:40     ` Christoph Hellwig
2016-04-06 18:57 ` [PATCH 3/4] IB/srpt: Introduce two helper functions Bart Van Assche
2016-04-07 13:40   ` Christoph Hellwig
2016-04-07 22:29 ` [PATCH 0/4] IB/srpt and the percpu_ida conversion Nicholas A. Bellinger
     [not found]   ` <1460068181.18732.23.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-07 22:38     ` Bart Van Assche
2016-04-07 23:01   ` Christoph Hellwig
     [not found]     ` <20160407230110.GA9842-jcswGhMUV9g@public.gmane.org>
2016-04-07 23:24       ` Nicholas A. Bellinger
2016-04-07 23:34         ` Bart Van Assche
2016-04-07 23:47           ` Nicholas A. Bellinger
2016-04-07 23:49             ` Bart Van Assche
2016-04-08  8:16           ` Jack Wang
     [not found]         ` <1460071464.18732.57.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-07 23:47           ` Bart Van Assche
     [not found] ` <57055BC6.7070402-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-06 18:57   ` [PATCH 4/4] IB/srpt: Convert to percpu_ida tag allocation Bart Van Assche
2016-04-07 13:43     ` Christoph Hellwig [this message]
2016-04-07 23:03     ` Christoph Hellwig
2016-04-07 23:31       ` Nicholas A. Bellinger
2016-04-07 22:55   ` [PATCH] IB/srpt: Revert "Convert to percpu_ida tag allocation" Bart Van Assche
2016-04-07 23:37     ` Nicholas A. Bellinger
     [not found]       ` <1460072224.18732.67.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-07 23:44         ` Bart Van Assche
     [not found]           ` <5706F0E8.5020705-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-07 23:52             ` Nicholas A. Bellinger
     [not found]               ` <1460073123.18732.80.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-07 23:54                 ` Christoph Hellwig
2016-04-08  0:00                   ` Nicholas A. Bellinger
2016-04-08  0:00                 ` Doug Ledford
2016-04-07 23:49       ` Linus Torvalds
     [not found]         ` <CA+55aFwOnCeKzg4SuceZm98DgN-tV7aCdtrenAS93LP7GqrZtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-07 23:56           ` Nicholas A. Bellinger
     [not found]             ` <1460073392.18732.83.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-08  0:13               ` Linus Torvalds

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=20160407134338.GC17477@lst.de \
    --to=hch@lst.de \
    --cc=bart.vanassche@sandisk.com \
    --cc=dledford@redhat.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=sagi@grimberg.me \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.