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 17:07:57 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2016-01-07 22:50:10 +03:00
|
|
|
/*
|
2018-05-07 22:28:04 +03:00
|
|
|
* Copyright (c) 2015-2018 Oracle. All rights reserved.
|
2016-01-07 22:50:10 +03:00
|
|
|
*
|
|
|
|
* Support for backward direction RPCs on RPC/RDMA (server-side).
|
|
|
|
*/
|
|
|
|
|
2017-02-08 02:02:54 +03:00
|
|
|
#include <linux/module.h>
|
2018-05-07 22:27:16 +03:00
|
|
|
|
2016-01-07 22:50:10 +03:00
|
|
|
#include <linux/sunrpc/svc_rdma.h>
|
2018-05-07 22:27:16 +03:00
|
|
|
|
2016-01-07 22:50:10 +03:00
|
|
|
#include "xprt_rdma.h"
|
2018-05-07 22:27:16 +03:00
|
|
|
#include <trace/events/rpcrdma.h>
|
2016-01-07 22:50:10 +03:00
|
|
|
|
|
|
|
#define RPCDBG_FACILITY RPCDBG_SVCXPRT
|
|
|
|
|
|
|
|
#undef SVCRDMA_BACKCHANNEL_DEBUG
|
|
|
|
|
2017-04-09 20:06:49 +03:00
|
|
|
/**
|
|
|
|
* svc_rdma_handle_bc_reply - Process incoming backchannel reply
|
|
|
|
* @xprt: controlling backchannel transport
|
|
|
|
* @rdma_resp: pointer to incoming transport header
|
|
|
|
* @rcvbuf: XDR buffer into which to decode the reply
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* %0 if @rcvbuf is filled in, xprt_complete_rqst called,
|
|
|
|
* %-EAGAIN if server should call ->recvfrom again.
|
|
|
|
*/
|
|
|
|
int svc_rdma_handle_bc_reply(struct rpc_xprt *xprt, __be32 *rdma_resp,
|
2016-01-07 22:50:10 +03:00
|
|
|
struct xdr_buf *rcvbuf)
|
|
|
|
{
|
|
|
|
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
|
|
|
|
struct kvec *dst, *src = &rcvbuf->head[0];
|
|
|
|
struct rpc_rqst *req;
|
|
|
|
unsigned long cwnd;
|
|
|
|
u32 credits;
|
|
|
|
size_t len;
|
|
|
|
__be32 xid;
|
|
|
|
__be32 *p;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
p = (__be32 *)src->iov_base;
|
|
|
|
len = src->iov_len;
|
2017-04-09 20:06:49 +03:00
|
|
|
xid = *rdma_resp;
|
2016-01-07 22:50:10 +03:00
|
|
|
|
|
|
|
#ifdef SVCRDMA_BACKCHANNEL_DEBUG
|
|
|
|
pr_info("%s: xid=%08x, length=%zu\n",
|
|
|
|
__func__, be32_to_cpu(xid), len);
|
|
|
|
pr_info("%s: RPC/RDMA: %*ph\n",
|
2017-04-09 20:06:49 +03:00
|
|
|
__func__, (int)RPCRDMA_HDRLEN_MIN, rdma_resp);
|
2016-01-07 22:50:10 +03:00
|
|
|
pr_info("%s: RPC: %*ph\n",
|
|
|
|
__func__, (int)len, p);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ret = -EAGAIN;
|
|
|
|
if (src->iov_len < 24)
|
|
|
|
goto out_shortreply;
|
|
|
|
|
2018-08-31 17:21:00 +03:00
|
|
|
spin_lock(&xprt->queue_lock);
|
2016-01-07 22:50:10 +03:00
|
|
|
req = xprt_lookup_rqst(xprt, xid);
|
|
|
|
if (!req)
|
|
|
|
goto out_notfound;
|
|
|
|
|
|
|
|
dst = &req->rq_private_buf.head[0];
|
|
|
|
memcpy(&req->rq_private_buf, &req->rq_rcv_buf, sizeof(struct xdr_buf));
|
|
|
|
if (dst->iov_len < len)
|
|
|
|
goto out_unlock;
|
|
|
|
memcpy(dst->iov_base, p, len);
|
|
|
|
|
2017-04-09 20:06:49 +03:00
|
|
|
credits = be32_to_cpup(rdma_resp + 2);
|
2016-01-07 22:50:10 +03:00
|
|
|
if (credits == 0)
|
|
|
|
credits = 1; /* don't deadlock */
|
|
|
|
else if (credits > r_xprt->rx_buf.rb_bc_max_requests)
|
|
|
|
credits = r_xprt->rx_buf.rb_bc_max_requests;
|
|
|
|
|
2017-08-16 22:30:35 +03:00
|
|
|
spin_lock_bh(&xprt->transport_lock);
|
2016-01-07 22:50:10 +03:00
|
|
|
cwnd = xprt->cwnd;
|
|
|
|
xprt->cwnd = credits << RPC_CWNDSHIFT;
|
|
|
|
if (xprt->cwnd > cwnd)
|
|
|
|
xprt_release_rqst_cong(req->rq_task);
|
2017-08-16 22:30:35 +03:00
|
|
|
spin_unlock_bh(&xprt->transport_lock);
|
|
|
|
|
2016-01-07 22:50:10 +03:00
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
xprt_complete_rqst(req->rq_task, rcvbuf->len);
|
|
|
|
rcvbuf->len = 0;
|
|
|
|
|
|
|
|
out_unlock:
|
2018-08-31 17:21:00 +03:00
|
|
|
spin_unlock(&xprt->queue_lock);
|
2016-01-07 22:50:10 +03:00
|
|
|
out:
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
out_shortreply:
|
|
|
|
dprintk("svcrdma: short bc reply: xprt=%p, len=%zu\n",
|
|
|
|
xprt, src->iov_len);
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
out_notfound:
|
|
|
|
dprintk("svcrdma: unrecognized bc reply: xprt=%p, xid=%08x\n",
|
|
|
|
xprt, be32_to_cpu(xid));
|
|
|
|
goto out_unlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Send a backwards direction RPC call.
|
|
|
|
*
|
|
|
|
* Caller holds the connection's mutex and has already marshaled
|
|
|
|
* the RPC/RDMA request.
|
|
|
|
*
|
2017-04-09 20:06:25 +03:00
|
|
|
* This is similar to svc_rdma_send_reply_msg, but takes a struct
|
|
|
|
* rpc_rqst instead, does not support chunks, and avoids blocking
|
|
|
|
* memory allocation.
|
2016-01-07 22:50:10 +03:00
|
|
|
*
|
|
|
|
* XXX: There is still an opportunity to block in svc_rdma_send()
|
|
|
|
* if there are no SQ entries to post the Send. This may occur if
|
|
|
|
* the adapter has a small maximum SQ depth.
|
|
|
|
*/
|
|
|
|
static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma,
|
2018-05-07 22:28:25 +03:00
|
|
|
struct rpc_rqst *rqst,
|
|
|
|
struct svc_rdma_send_ctxt *ctxt)
|
2016-01-07 22:50:10 +03:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2018-05-07 22:28:25 +03:00
|
|
|
ret = svc_rdma_map_reply_msg(rdma, ctxt, &rqst->rq_snd_buf, NULL);
|
2017-04-09 20:05:44 +03:00
|
|
|
if (ret < 0)
|
2018-05-07 22:28:25 +03:00
|
|
|
return -EIO;
|
2016-01-07 22:50:10 +03:00
|
|
|
|
2017-10-16 19:14:33 +03:00
|
|
|
/* Bump page refcnt so Send completion doesn't release
|
|
|
|
* the rq_buffer before all retransmits are complete.
|
|
|
|
*/
|
|
|
|
get_page(virt_to_page(rqst->rq_buffer));
|
2018-05-07 22:28:15 +03:00
|
|
|
ctxt->sc_send_wr.opcode = IB_WR_SEND;
|
2018-05-07 22:28:25 +03:00
|
|
|
return svc_rdma_send(rdma, &ctxt->sc_send_wr);
|
2016-01-07 22:50:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Server-side transport endpoint wants a whole page for its send
|
|
|
|
* buffer. The client RPC code constructs the RPC header in this
|
|
|
|
* buffer before it invokes ->send_request.
|
|
|
|
*/
|
2016-09-15 17:55:20 +03:00
|
|
|
static int
|
|
|
|
xprt_rdma_bc_allocate(struct rpc_task *task)
|
2016-01-07 22:50:10 +03:00
|
|
|
{
|
|
|
|
struct rpc_rqst *rqst = task->tk_rqstp;
|
2016-09-15 17:55:20 +03:00
|
|
|
size_t size = rqst->rq_callsize;
|
2016-01-07 22:50:10 +03:00
|
|
|
struct page *page;
|
|
|
|
|
2016-09-15 17:55:20 +03:00
|
|
|
if (size > PAGE_SIZE) {
|
2016-01-07 22:50:10 +03:00
|
|
|
WARN_ONCE(1, "svcrdma: large bc buffer request (size %zu)\n",
|
|
|
|
size);
|
2016-09-15 17:55:20 +03:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
2016-01-07 22:50:10 +03:00
|
|
|
|
|
|
|
page = alloc_page(RPCRDMA_DEF_GFP);
|
|
|
|
if (!page)
|
2016-09-15 17:55:20 +03:00
|
|
|
return -ENOMEM;
|
|
|
|
rqst->rq_buffer = page_address(page);
|
2016-10-29 05:22:33 +03:00
|
|
|
|
|
|
|
rqst->rq_rbuffer = kmalloc(rqst->rq_rcvsize, RPCRDMA_DEF_GFP);
|
|
|
|
if (!rqst->rq_rbuffer) {
|
|
|
|
put_page(page);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2016-09-15 17:55:20 +03:00
|
|
|
return 0;
|
2016-01-07 22:50:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-09-15 17:55:29 +03:00
|
|
|
xprt_rdma_bc_free(struct rpc_task *task)
|
2016-01-07 22:50:10 +03:00
|
|
|
{
|
2016-10-29 05:22:33 +03:00
|
|
|
struct rpc_rqst *rqst = task->tk_rqstp;
|
|
|
|
|
2017-10-16 19:14:33 +03:00
|
|
|
put_page(virt_to_page(rqst->rq_buffer));
|
2016-10-29 05:22:33 +03:00
|
|
|
kfree(rqst->rq_rbuffer);
|
2016-01-07 22:50:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
rpcrdma_bc_send_request(struct svcxprt_rdma *rdma, struct rpc_rqst *rqst)
|
|
|
|
{
|
|
|
|
struct rpc_xprt *xprt = rqst->rq_xprt;
|
|
|
|
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
|
2018-05-07 22:28:25 +03:00
|
|
|
struct svc_rdma_send_ctxt *ctxt;
|
2017-02-07 19:58:40 +03:00
|
|
|
__be32 *p;
|
2016-01-07 22:50:10 +03:00
|
|
|
int rc;
|
|
|
|
|
2018-05-07 22:28:25 +03:00
|
|
|
ctxt = svc_rdma_send_ctxt_get(rdma);
|
|
|
|
if (!ctxt)
|
|
|
|
goto drop_connection;
|
|
|
|
|
|
|
|
p = ctxt->sc_xprt_buf;
|
2017-02-07 19:58:40 +03:00
|
|
|
*p++ = rqst->rq_xid;
|
|
|
|
*p++ = rpcrdma_version;
|
|
|
|
*p++ = cpu_to_be32(r_xprt->rx_buf.rb_bc_max_requests);
|
|
|
|
*p++ = rdma_msg;
|
|
|
|
*p++ = xdr_zero;
|
|
|
|
*p++ = xdr_zero;
|
|
|
|
*p = xdr_zero;
|
2018-05-07 22:28:25 +03:00
|
|
|
svc_rdma_sync_reply_hdr(rdma, ctxt, RPCRDMA_HDRLEN_MIN);
|
2016-01-07 22:50:10 +03:00
|
|
|
|
|
|
|
#ifdef SVCRDMA_BACKCHANNEL_DEBUG
|
|
|
|
pr_info("%s: %*ph\n", __func__, 64, rqst->rq_buffer);
|
|
|
|
#endif
|
|
|
|
|
2018-05-07 22:28:25 +03:00
|
|
|
rc = svc_rdma_bc_sendto(rdma, rqst, ctxt);
|
|
|
|
if (rc) {
|
|
|
|
svc_rdma_send_ctxt_put(rdma, ctxt);
|
2016-01-07 22:50:10 +03:00
|
|
|
goto drop_connection;
|
2018-05-07 22:28:25 +03:00
|
|
|
}
|
2016-01-07 22:50:10 +03:00
|
|
|
return rc;
|
|
|
|
|
|
|
|
drop_connection:
|
|
|
|
dprintk("svcrdma: failed to send bc call\n");
|
|
|
|
xprt_disconnect_done(xprt);
|
|
|
|
return -ENOTCONN;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Send an RPC call on the passive end of a transport
|
|
|
|
* connection.
|
|
|
|
*/
|
|
|
|
static int
|
2018-09-04 06:58:59 +03:00
|
|
|
xprt_rdma_bc_send_request(struct rpc_rqst *rqst)
|
2016-01-07 22:50:10 +03:00
|
|
|
{
|
|
|
|
struct svc_xprt *sxprt = rqst->rq_xprt->bc_xprt;
|
|
|
|
struct svcxprt_rdma *rdma;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
dprintk("svcrdma: sending bc call with xid: %08x\n",
|
|
|
|
be32_to_cpu(rqst->rq_xid));
|
|
|
|
|
2018-09-04 06:39:27 +03:00
|
|
|
mutex_lock(&sxprt->xpt_mutex);
|
2016-01-07 22:50:10 +03:00
|
|
|
|
|
|
|
ret = -ENOTCONN;
|
|
|
|
rdma = container_of(sxprt, struct svcxprt_rdma, sc_xprt);
|
|
|
|
if (!test_bit(XPT_DEAD, &sxprt->xpt_flags))
|
|
|
|
ret = rpcrdma_bc_send_request(rdma, rqst);
|
|
|
|
|
|
|
|
mutex_unlock(&sxprt->xpt_mutex);
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
xprt_rdma_bc_close(struct rpc_xprt *xprt)
|
|
|
|
{
|
|
|
|
dprintk("svcrdma: %s: xprt %p\n", __func__, xprt);
|
2018-10-01 21:25:14 +03:00
|
|
|
xprt->cwnd = RPC_CWNDSHIFT;
|
2016-01-07 22:50:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
xprt_rdma_bc_put(struct rpc_xprt *xprt)
|
|
|
|
{
|
|
|
|
dprintk("svcrdma: %s: xprt %p\n", __func__, xprt);
|
|
|
|
|
|
|
|
xprt_free(xprt);
|
|
|
|
module_put(THIS_MODULE);
|
|
|
|
}
|
|
|
|
|
2017-08-01 19:00:39 +03:00
|
|
|
static const struct rpc_xprt_ops xprt_rdma_bc_procs = {
|
2016-01-07 22:50:10 +03:00
|
|
|
.reserve_xprt = xprt_reserve_xprt_cong,
|
|
|
|
.release_xprt = xprt_release_xprt_cong,
|
|
|
|
.alloc_slot = xprt_alloc_slot,
|
2018-05-04 22:34:59 +03:00
|
|
|
.free_slot = xprt_free_slot,
|
2016-01-07 22:50:10 +03:00
|
|
|
.release_request = xprt_release_rqst_cong,
|
|
|
|
.buf_alloc = xprt_rdma_bc_allocate,
|
|
|
|
.buf_free = xprt_rdma_bc_free,
|
|
|
|
.send_request = xprt_rdma_bc_send_request,
|
|
|
|
.set_retrans_timeout = xprt_set_retrans_timeout_def,
|
|
|
|
.close = xprt_rdma_bc_close,
|
|
|
|
.destroy = xprt_rdma_bc_put,
|
|
|
|
.print_stats = xprt_rdma_print_stats
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct rpc_timeout xprt_rdma_bc_timeout = {
|
|
|
|
.to_initval = 60 * HZ,
|
|
|
|
.to_maxval = 60 * HZ,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* It shouldn't matter if the number of backchannel session slots
|
|
|
|
* doesn't match the number of RPC/RDMA credits. That just means
|
|
|
|
* one or the other will have extra slots that aren't used.
|
|
|
|
*/
|
|
|
|
static struct rpc_xprt *
|
|
|
|
xprt_setup_rdma_bc(struct xprt_create *args)
|
|
|
|
{
|
|
|
|
struct rpc_xprt *xprt;
|
|
|
|
struct rpcrdma_xprt *new_xprt;
|
|
|
|
|
|
|
|
if (args->addrlen > sizeof(xprt->addr)) {
|
|
|
|
dprintk("RPC: %s: address too large\n", __func__);
|
|
|
|
return ERR_PTR(-EBADF);
|
|
|
|
}
|
|
|
|
|
|
|
|
xprt = xprt_alloc(args->net, sizeof(*new_xprt),
|
|
|
|
RPCRDMA_MAX_BC_REQUESTS,
|
|
|
|
RPCRDMA_MAX_BC_REQUESTS);
|
|
|
|
if (!xprt) {
|
|
|
|
dprintk("RPC: %s: couldn't allocate rpc_xprt\n",
|
|
|
|
__func__);
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
}
|
|
|
|
|
|
|
|
xprt->timeout = &xprt_rdma_bc_timeout;
|
|
|
|
xprt_set_bound(xprt);
|
|
|
|
xprt_set_connected(xprt);
|
|
|
|
xprt->bind_timeout = RPCRDMA_BIND_TO;
|
|
|
|
xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO;
|
|
|
|
xprt->idle_timeout = RPCRDMA_IDLE_DISC_TO;
|
|
|
|
|
|
|
|
xprt->prot = XPRT_TRANSPORT_BC_RDMA;
|
2018-05-07 22:28:25 +03:00
|
|
|
xprt->tsh_size = 0;
|
2016-01-07 22:50:10 +03:00
|
|
|
xprt->ops = &xprt_rdma_bc_procs;
|
|
|
|
|
|
|
|
memcpy(&xprt->addr, args->dstaddr, args->addrlen);
|
|
|
|
xprt->addrlen = args->addrlen;
|
|
|
|
xprt_rdma_format_addresses(xprt, (struct sockaddr *)&xprt->addr);
|
|
|
|
xprt->resvport = 0;
|
|
|
|
|
|
|
|
xprt->max_payload = xprt_rdma_max_inline_read;
|
|
|
|
|
|
|
|
new_xprt = rpcx_to_rdmax(xprt);
|
|
|
|
new_xprt->rx_buf.rb_bc_max_requests = xprt->max_reqs;
|
|
|
|
|
|
|
|
xprt_get(xprt);
|
|
|
|
args->bc_xprt->xpt_bc_xprt = xprt;
|
|
|
|
xprt->bc_xprt = args->bc_xprt;
|
|
|
|
|
|
|
|
if (!try_module_get(THIS_MODULE))
|
|
|
|
goto out_fail;
|
|
|
|
|
|
|
|
/* Final put for backchannel xprt is in __svc_rdma_free */
|
|
|
|
xprt_get(xprt);
|
|
|
|
return xprt;
|
|
|
|
|
|
|
|
out_fail:
|
|
|
|
xprt_rdma_free_addresses(xprt);
|
|
|
|
args->bc_xprt->xpt_bc_xprt = NULL;
|
2016-11-29 19:04:26 +03:00
|
|
|
args->bc_xprt->xpt_bc_xps = NULL;
|
2016-01-07 22:50:10 +03:00
|
|
|
xprt_put(xprt);
|
|
|
|
xprt_free(xprt);
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct xprt_class xprt_rdma_bc = {
|
|
|
|
.list = LIST_HEAD_INIT(xprt_rdma_bc.list),
|
|
|
|
.name = "rdma backchannel",
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.ident = XPRT_TRANSPORT_BC_RDMA,
|
|
|
|
.setup = xprt_setup_rdma_bc,
|
|
|
|
};
|