public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche-Sjgp3cTcYWE@public.gmane.org>
To: "nmoreychaisemartin-IBi9RG/b67k@public.gmane.org"
	<nmoreychaisemartin-IBi9RG/b67k@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: "bvanassche-HInyCGIudOg@public.gmane.org"
	<bvanassche-HInyCGIudOg@public.gmane.org>,
	"stable-Xl5UnYtxxKxKUA01WzcqbQ@public.gmane.org"
	<stable-Xl5UnYtxxKxKUA01WzcqbQ@public.gmane.org>,
	"hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org"
	<hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Subject: Re: [PATCH rdma-core 2/2] srp_daemon: fix CQ handling
Date: Tue, 12 Dec 2017 17:38:54 +0000	[thread overview]
Message-ID: <1513100334.2999.21.camel@wdc.com> (raw)
In-Reply-To: <e584830f-64a0-d5b6-c3b7-1cb6e0f4df90-IBi9RG/b67k@public.gmane.org>

On Tue, 2017-12-12 at 18:28 +0100, Nicolas Morey-Chaisemartin wrote:
> Le 12/12/2017 à 18:04, Bart Van Assche a écrit :
> > On Tue, 2017-12-12 at 15:08 +0100, Nicolas Morey-Chaisemartin wrote:
> > > +	if (ret < 0) {
> > > +		pr_err("poll CQ failed\n");
> > > +		return ret;
> > > +	}
> > > +
> > > +	if (ret > 0 && wc->status != IBV_WC_SUCCESS) {
> > > +		if (!stop_threads(sync_res))
> > > +			pr_err("got bad completion with status: 0x%x\n",
> > > +			       wc->status);
> > > +		return -ret;
> > > +	}
> > > +
> > > +	return ret;
> > > +}
> > 
> > This function can return negative values, positive values or zero. Please
> > modify it such that either 0 or a negative Unix error code is returned. This
> > will make it easier to read this function and also the code that calls this
> > function.
> 
> We still need to differenciate between OK with 0 completions polled, and OK with 1 completion.
> I did it this way to limit the side effect of factoring the code.
> Would you want poll_cq_once to return -EAGAIN  when no completion was found?

Hello Nicolas,

If you think another approach would work better for the return values than
what I proposed it's fine to use that approach. My primary concern is that
the meaning of the return values gets documented and also that the meaning
of the return values is clear without having to read the implementation of
this function.

Bart.

      parent reply	other threads:[~2017-12-12 17:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <05bbb67fea5e3cae535c0d9d21866cf8ad76f74f.1513087686.git.NMoreyChaisemartin@suse.com>
     [not found] ` <05bbb67fea5e3cae535c0d9d21866cf8ad76f74f.1513087686.git.NMoreyChaisemartin-IBi9RG/b67k@public.gmane.org>
2017-12-12 14:08   ` [PATCH rdma-core 2/2] srp_daemon: fix CQ handling Nicolas Morey-Chaisemartin
     [not found]     ` <19c1241b-6a22-f8c2-32a2-6233f62cc39c-IBi9RG/b67k@public.gmane.org>
2017-12-12 17:04       ` Bart Van Assche
     [not found]         ` <1513098293.2999.15.camel-Sjgp3cTcYWE@public.gmane.org>
2017-12-12 17:28           ` Nicolas Morey-Chaisemartin
     [not found]             ` <e584830f-64a0-d5b6-c3b7-1cb6e0f4df90-IBi9RG/b67k@public.gmane.org>
2017-12-12 17:38               ` Bart Van Assche [this message]

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=1513100334.2999.21.camel@wdc.com \
    --to=bart.vanassche-sjgp3ctcywe@public.gmane.org \
    --cc=bvanassche-HInyCGIudOg@public.gmane.org \
    --cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nmoreychaisemartin-IBi9RG/b67k@public.gmane.org \
    --cc=stable-Xl5UnYtxxKxKUA01WzcqbQ@public.gmane.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