All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Simon Derr <simon.derr@bull.net>
Cc: netdev@vger.kernel.org, ericvh@gmail.com
Subject: Re: [PATCH 10/10] 9P: Add cancelled() to the transport functions.
Date: Tue, 02 Jul 2013 20:49:25 +0400	[thread overview]
Message-ID: <51D30495.6060103@cogentembedded.com> (raw)
In-Reply-To: <1372770684-25573-11-git-send-email-simon.derr@bull.net>

Hello.

On 02-07-2013 17:11, Simon Derr wrote:

> RDMA needs to post a buffer for each incoming reply.
> Hence it needs to keep count of these and needs to be
> aware of whether a flushed request has received a reply
> or not.

> This patch adds the cancelled() callback to the transport modules.
> It is called when RFLUSH has been received and that the corresponding
> request will never receive a reply.

> Signed-off-by: Simon Derr <simon.derr@bull.net>
> ---
>   include/net/9p/transport.h |    3 +++
>   net/9p/client.c            |   11 ++++++++---
>   net/9p/trans_rdma.c        |   10 ++++++++++
>   3 files changed, 21 insertions(+), 3 deletions(-)

> diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
> index adcbb20..77a0578 100644
> --- a/include/net/9p/transport.h
> +++ b/include/net/9p/transport.h
[...]
> @@ -55,6 +57,7 @@ struct p9_trans_module {
>   	void (*close) (struct p9_client *);
>   	int (*request) (struct p9_client *, struct p9_req_t *req);
>   	int (*cancel) (struct p9_client *, struct p9_req_t *req);
> +	int (*cancelled) (struct p9_client *, struct p9_req_t *req);

    There should be no space before ( opening the parameter list.
scripts/checkpatch.pl should have warned you here.

>   	int (*zc_request)(struct p9_client *, struct p9_req_t *,
>   			  char *, char *, int , int, int, int);
>   };
> diff --git a/net/9p/client.c b/net/9p/client.c
> index 44691b9..61e0455 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -676,11 +676,16 @@ static int p9_client_flush(struct p9_client *c, struct p9_req_t *oldreq)
>
>
>   	/* if we haven't received a response for oldreq,
> -	   remove it from the list. */
> +	   remove it from the list, and notify the transport
> +	   layer that the reply will never arrive. */

    The preferred style of the multi-line commnets in the networking 
code is:

	/* bla
	 * bla
	 */

>   	spin_lock(&c->lock);
> -	if (oldreq->status == REQ_STATUS_FLSH)
> +	if (oldreq->status == REQ_STATUS_FLSH) {
>   		list_del(&oldreq->req_list);
> -	spin_unlock(&c->lock);
> +		spin_unlock(&c->lock);
> +		if (c->trans_mod->cancelled)
> +			c->trans_mod->cancelled(c, req);
> +	} else
> +		spin_unlock(&c->lock);

    According to Documentation/CodingStyle chapter 3, both arms of the 
*if* statment should have {} if one arm has it.

> diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
> index 8f68df5..9e6c220 100644
> --- a/net/9p/trans_rdma.c
> +++ b/net/9p/trans_rdma.c
> @@ -588,6 +588,16 @@ static int rdma_cancel(struct p9_client *client, struct p9_req_t *req)
>   	return 1;
>   }
>
> +/* A request has been fully flushed without a reply.
> + * That means we have posted one buffer in excess.
> + */
> +static int rdma_cancelled(struct p9_client *client, struct p9_req_t *req)
> +{
> +	struct p9_trans_rdma *rdma = client->trans;

    Empty line wouldn't hurt here, after declaration.

> +	atomic_inc(&rdma->excess_rc);
> +	return 0;
> +}
> +

WBR, Sergei

      reply	other threads:[~2013-07-02 16:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 13:11 [PATCH 00/10] Improve 9P/RDMA Simon Derr
2013-07-02 13:11 ` [PATCH 01/10] 9P: Fix fcall allocation for rdma Simon Derr
2013-07-02 13:11 ` [PATCH 02/10] 9P/RDMA: rdma_request() needs not allocate req->rc Simon Derr
2013-07-02 13:11 ` [PATCH 03/10] 9pnet: refactor struct p9_fcall alloc code Simon Derr
2013-07-02 16:40   ` Sergei Shtylyov
2013-07-02 13:11 ` [PATCH 04/10] 9P/RDMA: increase P9_RDMA_MAXSIZE to 1MB Simon Derr
2013-07-02 13:11 ` [PATCH 05/10] 9P/RDMA: Protect against duplicate replies Simon Derr
2013-07-02 13:11 ` [PATCH 06/10] 9P/RDMA: Use a semaphore to protect the RQ Simon Derr
2013-07-02 13:11 ` [PATCH 07/10] 9P/RDMA: Do not free req->rc in error handling in rdma_request() Simon Derr
2013-07-02 13:11 ` [PATCH 08/10] 9P/RDMA: Improve error handling in rdma_request Simon Derr
2013-07-02 13:11 ` [PATCH 09/10] 9P/RDMA: count posted buffers without a pending request Simon Derr
2013-07-02 13:11 ` [PATCH 10/10] 9P: Add cancelled() to the transport functions Simon Derr
2013-07-02 16:49   ` Sergei Shtylyov [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=51D30495.6060103@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=ericvh@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=simon.derr@bull.net \
    /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.