License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-10-25 05:27:43 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Oracle. All rights reserved.
|
|
|
|
*
|
|
|
|
* Support for backward direction RPCs on RPC/RDMA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
2015-10-25 05:28:08 +08:00
|
|
|
#include <linux/sunrpc/xprt.h>
|
|
|
|
#include <linux/sunrpc/svc.h>
|
2015-10-25 05:28:32 +08:00
|
|
|
#include <linux/sunrpc/svc_xprt.h>
|
2018-05-08 03:27:16 +08:00
|
|
|
#include <linux/sunrpc/svc_rdma.h>
|
2015-10-25 05:27:43 +08:00
|
|
|
|
|
|
|
#include "xprt_rdma.h"
|
2018-05-08 03:27:05 +08:00
|
|
|
#include <trace/events/rpcrdma.h>
|
2015-10-25 05:27:43 +08:00
|
|
|
|
|
|
|
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
|
|
|
|
# define RPCDBG_FACILITY RPCDBG_TRANS
|
|
|
|
#endif
|
|
|
|
|
2015-12-17 06:22:23 +08:00
|
|
|
#undef RPCRDMA_BACKCHANNEL_DEBUG
|
2015-10-25 05:28:08 +08:00
|
|
|
|
2015-10-25 05:27:43 +08:00
|
|
|
static void rpcrdma_bc_free_rqst(struct rpcrdma_xprt *r_xprt,
|
|
|
|
struct rpc_rqst *rqst)
|
|
|
|
{
|
|
|
|
struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
|
|
|
|
struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
|
|
|
|
|
|
|
|
spin_lock(&buf->rb_reqslock);
|
|
|
|
list_del(&req->rl_all);
|
|
|
|
spin_unlock(&buf->rb_reqslock);
|
|
|
|
|
2016-09-15 22:56:26 +08:00
|
|
|
rpcrdma_destroy_req(req);
|
2015-10-25 05:27:43 +08:00
|
|
|
}
|
|
|
|
|
2018-05-05 03:35:09 +08:00
|
|
|
static int rpcrdma_bc_setup_reqs(struct rpcrdma_xprt *r_xprt,
|
|
|
|
unsigned int count)
|
2015-10-25 05:27:43 +08:00
|
|
|
{
|
2018-05-05 03:35:09 +08:00
|
|
|
struct rpc_xprt *xprt = &r_xprt->rx_xprt;
|
|
|
|
struct rpc_rqst *rqst;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < (count << 1); i++) {
|
|
|
|
struct rpcrdma_regbuf *rb;
|
|
|
|
struct rpcrdma_req *req;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
req = rpcrdma_create_req(r_xprt);
|
|
|
|
if (IS_ERR(req))
|
|
|
|
return PTR_ERR(req);
|
|
|
|
rqst = &req->rl_slot;
|
|
|
|
|
|
|
|
rqst->rq_xprt = xprt;
|
|
|
|
INIT_LIST_HEAD(&rqst->rq_bc_list);
|
|
|
|
__set_bit(RPC_BC_PA_IN_USE, &rqst->rq_bc_pa_state);
|
|
|
|
spin_lock_bh(&xprt->bc_pa_lock);
|
|
|
|
list_add(&rqst->rq_bc_pa_list, &xprt->bc_pa_list);
|
|
|
|
spin_unlock_bh(&xprt->bc_pa_lock);
|
|
|
|
|
|
|
|
size = r_xprt->rx_data.inline_rsize;
|
|
|
|
rb = rpcrdma_alloc_regbuf(size, DMA_TO_DEVICE, GFP_KERNEL);
|
|
|
|
if (IS_ERR(rb))
|
|
|
|
goto out_fail;
|
|
|
|
req->rl_sendbuf = rb;
|
|
|
|
xdr_buf_init(&rqst->rq_snd_buf, rb->rg_base,
|
|
|
|
min_t(size_t, size, PAGE_SIZE));
|
|
|
|
}
|
2015-10-25 05:27:43 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
out_fail:
|
|
|
|
rpcrdma_bc_free_rqst(r_xprt, rqst);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* xprt_rdma_bc_setup - Pre-allocate resources for handling backchannel requests
|
|
|
|
* @xprt: transport associated with these backchannel resources
|
|
|
|
* @reqs: number of concurrent incoming requests to expect
|
|
|
|
*
|
|
|
|
* Returns 0 on success; otherwise a negative errno
|
|
|
|
*/
|
|
|
|
int xprt_rdma_bc_setup(struct rpc_xprt *xprt, unsigned int reqs)
|
|
|
|
{
|
|
|
|
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* The backchannel reply path returns each rpc_rqst to the
|
|
|
|
* bc_pa_list _after_ the reply is sent. If the server is
|
|
|
|
* faster than the client, it can send another backward
|
|
|
|
* direction request before the rpc_rqst is returned to the
|
|
|
|
* list. The client rejects the request in this case.
|
|
|
|
*
|
|
|
|
* Twice as many rpc_rqsts are prepared to ensure there is
|
|
|
|
* always an rpc_rqst available as soon as a reply is sent.
|
|
|
|
*/
|
2015-10-25 05:27:51 +08:00
|
|
|
if (reqs > RPCRDMA_BACKWARD_WRS >> 1)
|
|
|
|
goto out_err;
|
|
|
|
|
2018-05-05 03:35:09 +08:00
|
|
|
rc = rpcrdma_bc_setup_reqs(r_xprt, reqs);
|
2015-10-25 05:27:43 +08:00
|
|
|
if (rc)
|
|
|
|
goto out_free;
|
|
|
|
|
2018-05-05 03:35:09 +08:00
|
|
|
r_xprt->rx_buf.rb_bc_srv_max_requests = reqs;
|
2015-10-25 05:27:43 +08:00
|
|
|
request_module("svcrdma");
|
2017-12-21 05:31:37 +08:00
|
|
|
trace_xprtrdma_cb_setup(r_xprt, reqs);
|
2015-10-25 05:27:43 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
out_free:
|
|
|
|
xprt_rdma_bc_destroy(xprt, reqs);
|
|
|
|
|
2015-10-25 05:27:51 +08:00
|
|
|
out_err:
|
2015-10-25 05:27:43 +08:00
|
|
|
pr_err("RPC: %s: setup backchannel transport failed\n", __func__);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2015-10-25 05:28:32 +08:00
|
|
|
/**
|
|
|
|
* xprt_rdma_bc_up - Create transport endpoint for backchannel service
|
|
|
|
* @serv: server endpoint
|
|
|
|
* @net: network namespace
|
|
|
|
*
|
|
|
|
* The "xprt" is an implied argument: it supplies the name of the
|
|
|
|
* backchannel transport class.
|
|
|
|
*
|
|
|
|
* Returns zero on success, negative errno on failure
|
|
|
|
*/
|
|
|
|
int xprt_rdma_bc_up(struct svc_serv *serv, struct net *net)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = svc_create_xprt(serv, "rdma-bc", net, PF_INET, 0, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-05-03 02:40:40 +08:00
|
|
|
/**
|
|
|
|
* xprt_rdma_bc_maxpayload - Return maximum backchannel message size
|
|
|
|
* @xprt: transport
|
|
|
|
*
|
|
|
|
* Returns maximum size, in bytes, of a backchannel message
|
|
|
|
*/
|
|
|
|
size_t xprt_rdma_bc_maxpayload(struct rpc_xprt *xprt)
|
|
|
|
{
|
|
|
|
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
|
|
|
|
struct rpcrdma_create_data_internal *cdata = &r_xprt->rx_data;
|
|
|
|
size_t maxmsg;
|
|
|
|
|
|
|
|
maxmsg = min_t(unsigned int, cdata->inline_rsize, cdata->inline_wsize);
|
2016-11-29 23:52:08 +08:00
|
|
|
maxmsg = min_t(unsigned int, maxmsg, PAGE_SIZE);
|
2016-05-03 02:40:40 +08:00
|
|
|
return maxmsg - RPCRDMA_HDRLEN_MIN;
|
|
|
|
}
|
|
|
|
|
2017-12-15 09:57:31 +08:00
|
|
|
static int rpcrdma_bc_marshal_reply(struct rpc_rqst *rqst)
|
2015-10-25 05:27:59 +08:00
|
|
|
{
|
2017-08-11 00:47:44 +08:00
|
|
|
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt);
|
2015-10-25 05:27:59 +08:00
|
|
|
struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
|
2017-08-11 00:47:44 +08:00
|
|
|
__be32 *p;
|
|
|
|
|
|
|
|
rpcrdma_set_xdrlen(&req->rl_hdrbuf, 0);
|
|
|
|
xdr_init_encode(&req->rl_stream, &req->rl_hdrbuf,
|
|
|
|
req->rl_rdmabuf->rg_base);
|
|
|
|
|
|
|
|
p = xdr_reserve_space(&req->rl_stream, 28);
|
|
|
|
if (unlikely(!p))
|
|
|
|
return -EIO;
|
|
|
|
*p++ = rqst->rq_xid;
|
|
|
|
*p++ = rpcrdma_version;
|
|
|
|
*p++ = cpu_to_be32(r_xprt->rx_buf.rb_bc_srv_max_requests);
|
|
|
|
*p++ = rdma_msg;
|
|
|
|
*p++ = xdr_zero;
|
|
|
|
*p++ = xdr_zero;
|
|
|
|
*p = xdr_zero;
|
2015-10-25 05:27:59 +08:00
|
|
|
|
2017-10-20 22:47:55 +08:00
|
|
|
if (rpcrdma_prepare_send_sges(r_xprt, req, RPCRDMA_HDRLEN_MIN,
|
|
|
|
&rqst->rq_snd_buf, rpcrdma_noch))
|
xprtrdma: Use gathered Send for large inline messages
An RPC Call message that is sent inline but that has a data payload
(ie, one or more items in rq_snd_buf's page list) must be "pulled
up:"
- call_allocate has to reserve enough RPC Call buffer space to
accommodate the data payload
- call_transmit has to memcopy the rq_snd_buf's page list and tail
into its head iovec before it is sent
As the inline threshold is increased beyond its current 1KB default,
however, this means data payloads of more than a few KB are copied
by the host CPU. For example, if the inline threshold is increased
just to 4KB, then NFS WRITE requests up to 4KB would involve a
memcpy of the NFS WRITE's payload data into the RPC Call buffer.
This is an undesirable amount of participation by the host CPU.
The inline threshold may be much larger than 4KB in the future,
after negotiation with a peer server.
Instead of copying the components of rq_snd_buf into its head iovec,
construct a gather list of these components, and send them all in
place. The same approach is already used in the Linux server's
RPC-over-RDMA reply path.
This mechanism also eliminates the need for rpcrdma_tail_pullup,
which is used to manage the XDR pad and trailing inline content when
a Read list is present.
This requires that the pages in rq_snd_buf's page list be DMA-mapped
during marshaling, and unmapped when a data-bearing RPC is
completed. This is slightly less efficient for very small I/O
payloads, but significantly more efficient as data payload size and
inline threshold increase past a kilobyte.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-09-15 22:57:24 +08:00
|
|
|
return -EIO;
|
2017-12-21 05:31:37 +08:00
|
|
|
|
|
|
|
trace_xprtrdma_cb_reply(rqst);
|
2015-10-25 05:27:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-12-15 09:57:31 +08:00
|
|
|
/**
|
|
|
|
* xprt_rdma_bc_send_reply - marshal and send a backchannel reply
|
|
|
|
* @rqst: RPC rqst with a backchannel RPC reply in rq_snd_buf
|
|
|
|
*
|
|
|
|
* Caller holds the transport's write lock.
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* %0 if the RPC message has been sent
|
|
|
|
* %-ENOTCONN if the caller should reconnect and call again
|
|
|
|
* %-EIO if a permanent error occurred and the request was not
|
|
|
|
* sent. Do not try to send this message again.
|
|
|
|
*/
|
|
|
|
int xprt_rdma_bc_send_reply(struct rpc_rqst *rqst)
|
|
|
|
{
|
|
|
|
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt);
|
|
|
|
struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (!xprt_connected(rqst->rq_xprt))
|
|
|
|
goto drop_connection;
|
|
|
|
|
|
|
|
rc = rpcrdma_bc_marshal_reply(rqst);
|
|
|
|
if (rc < 0)
|
|
|
|
goto failed_marshal;
|
|
|
|
|
2018-05-05 03:35:20 +08:00
|
|
|
rpcrdma_post_recvs(r_xprt, true);
|
2017-12-15 09:57:31 +08:00
|
|
|
if (rpcrdma_ep_post(&r_xprt->rx_ia, &r_xprt->rx_ep, req))
|
|
|
|
goto drop_connection;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
failed_marshal:
|
|
|
|
if (rc != -ENOTCONN)
|
|
|
|
return rc;
|
|
|
|
drop_connection:
|
|
|
|
xprt_disconnect_done(rqst->rq_xprt);
|
|
|
|
return -ENOTCONN;
|
|
|
|
}
|
|
|
|
|
2015-10-25 05:27:43 +08:00
|
|
|
/**
|
|
|
|
* xprt_rdma_bc_destroy - Release resources for handling backchannel requests
|
|
|
|
* @xprt: transport associated with these backchannel resources
|
|
|
|
* @reqs: number of incoming requests to destroy; ignored
|
|
|
|
*/
|
|
|
|
void xprt_rdma_bc_destroy(struct rpc_xprt *xprt, unsigned int reqs)
|
|
|
|
{
|
|
|
|
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
|
|
|
|
struct rpc_rqst *rqst, *tmp;
|
|
|
|
|
|
|
|
spin_lock_bh(&xprt->bc_pa_lock);
|
|
|
|
list_for_each_entry_safe(rqst, tmp, &xprt->bc_pa_list, rq_bc_pa_list) {
|
|
|
|
list_del(&rqst->rq_bc_pa_list);
|
|
|
|
spin_unlock_bh(&xprt->bc_pa_lock);
|
|
|
|
|
|
|
|
rpcrdma_bc_free_rqst(r_xprt, rqst);
|
|
|
|
|
|
|
|
spin_lock_bh(&xprt->bc_pa_lock);
|
|
|
|
}
|
|
|
|
spin_unlock_bh(&xprt->bc_pa_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* xprt_rdma_bc_free_rqst - Release a backchannel rqst
|
|
|
|
* @rqst: request to release
|
|
|
|
*/
|
|
|
|
void xprt_rdma_bc_free_rqst(struct rpc_rqst *rqst)
|
|
|
|
{
|
2018-05-05 03:35:20 +08:00
|
|
|
struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
|
2015-10-25 05:27:43 +08:00
|
|
|
struct rpc_xprt *xprt = rqst->rq_xprt;
|
|
|
|
|
2015-12-17 06:22:23 +08:00
|
|
|
dprintk("RPC: %s: freeing rqst %p (req %p)\n",
|
2018-05-05 03:35:20 +08:00
|
|
|
__func__, rqst, req);
|
|
|
|
|
|
|
|
rpcrdma_recv_buffer_put(req->rl_reply);
|
|
|
|
req->rl_reply = NULL;
|
2015-12-17 06:22:23 +08:00
|
|
|
|
2015-10-25 05:27:43 +08:00
|
|
|
spin_lock_bh(&xprt->bc_pa_lock);
|
|
|
|
list_add_tail(&rqst->rq_bc_pa_list, &xprt->bc_pa_list);
|
|
|
|
spin_unlock_bh(&xprt->bc_pa_lock);
|
|
|
|
}
|
2015-10-25 05:28:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* rpcrdma_bc_receive_call - Handle a backward direction call
|
2018-01-04 04:38:17 +08:00
|
|
|
* @r_xprt: transport receiving the call
|
2015-10-25 05:28:08 +08:00
|
|
|
* @rep: receive buffer containing the call
|
|
|
|
*
|
|
|
|
* Operational assumptions:
|
|
|
|
* o Backchannel credits are ignored, just as the NFS server
|
|
|
|
* forechannel currently does
|
|
|
|
* o The ULP manages a replay cache (eg, NFSv4.1 sessions).
|
|
|
|
* No replay detection is done at the transport level
|
|
|
|
*/
|
|
|
|
void rpcrdma_bc_receive_call(struct rpcrdma_xprt *r_xprt,
|
|
|
|
struct rpcrdma_rep *rep)
|
|
|
|
{
|
|
|
|
struct rpc_xprt *xprt = &r_xprt->rx_xprt;
|
|
|
|
struct svc_serv *bc_serv;
|
|
|
|
struct rpcrdma_req *req;
|
|
|
|
struct rpc_rqst *rqst;
|
|
|
|
struct xdr_buf *buf;
|
|
|
|
size_t size;
|
|
|
|
__be32 *p;
|
|
|
|
|
2017-08-04 02:30:11 +08:00
|
|
|
p = xdr_inline_decode(&rep->rr_stream, 0);
|
|
|
|
size = xdr_stream_remaining(&rep->rr_stream);
|
|
|
|
|
2015-10-25 05:28:08 +08:00
|
|
|
#ifdef RPCRDMA_BACKCHANNEL_DEBUG
|
|
|
|
pr_info("RPC: %s: callback XID %08x, length=%u\n",
|
2017-08-04 02:30:11 +08:00
|
|
|
__func__, be32_to_cpup(p), size);
|
|
|
|
pr_info("RPC: %s: %*ph\n", __func__, size, p);
|
2015-10-25 05:28:08 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Grab a free bc rqst */
|
|
|
|
spin_lock(&xprt->bc_pa_lock);
|
|
|
|
if (list_empty(&xprt->bc_pa_list)) {
|
|
|
|
spin_unlock(&xprt->bc_pa_lock);
|
|
|
|
goto out_overflow;
|
|
|
|
}
|
|
|
|
rqst = list_first_entry(&xprt->bc_pa_list,
|
|
|
|
struct rpc_rqst, rq_bc_pa_list);
|
|
|
|
list_del(&rqst->rq_bc_pa_list);
|
|
|
|
spin_unlock(&xprt->bc_pa_lock);
|
|
|
|
|
|
|
|
/* Prepare rqst */
|
|
|
|
rqst->rq_reply_bytes_recvd = 0;
|
|
|
|
rqst->rq_bytes_sent = 0;
|
2017-08-04 02:30:11 +08:00
|
|
|
rqst->rq_xid = *p;
|
2016-02-15 23:23:59 +08:00
|
|
|
|
|
|
|
rqst->rq_private_buf.len = size;
|
2015-10-25 05:28:08 +08:00
|
|
|
|
|
|
|
buf = &rqst->rq_rcv_buf;
|
|
|
|
memset(buf, 0, sizeof(*buf));
|
|
|
|
buf->head[0].iov_base = p;
|
|
|
|
buf->head[0].iov_len = size;
|
|
|
|
buf->len = size;
|
|
|
|
|
|
|
|
/* The receive buffer has to be hooked to the rpcrdma_req
|
2017-08-04 02:30:11 +08:00
|
|
|
* so that it is not released while the req is pointing
|
|
|
|
* to its buffer, and so that it can be reposted after
|
|
|
|
* the Upper Layer is done decoding it.
|
2015-10-25 05:28:08 +08:00
|
|
|
*/
|
|
|
|
req = rpcr_to_rdmar(rqst);
|
|
|
|
req->rl_reply = rep;
|
2017-12-21 05:31:37 +08:00
|
|
|
trace_xprtrdma_cb_call(rqst);
|
2015-10-25 05:28:08 +08:00
|
|
|
|
|
|
|
/* Queue rqst for ULP's callback service */
|
|
|
|
bc_serv = xprt->bc_serv;
|
|
|
|
spin_lock(&bc_serv->sv_cb_lock);
|
|
|
|
list_add(&rqst->rq_bc_list, &bc_serv->sv_cb_list);
|
|
|
|
spin_unlock(&bc_serv->sv_cb_lock);
|
|
|
|
|
|
|
|
wake_up(&bc_serv->sv_cb_waitq);
|
|
|
|
|
|
|
|
r_xprt->rx_stats.bcall_count++;
|
|
|
|
return;
|
|
|
|
|
|
|
|
out_overflow:
|
|
|
|
pr_warn("RPC/RDMA backchannel overflow\n");
|
|
|
|
xprt_disconnect_done(xprt);
|
|
|
|
/* This receive buffer gets reposted automatically
|
|
|
|
* when the connection is re-established.
|
|
|
|
*/
|
|
|
|
return;
|
|
|
|
}
|