mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
rxrpc: Support service upgrade from a kernel service
Provide support for a kernel service to make use of the service upgrade
facility. This involves:
(1) Pass an upgrade request flag to rxrpc_kernel_begin_call().
(2) Make rxrpc_kernel_recv_data() return the call's current service ID so
that the caller can detect service upgrade and see what the service
was upgraded to.
Signed-off-by: David Howells <[email protected]>
This commit is contained in:
parent
8a5f2166a6
commit
a68f4a27f5
6 changed files with 34 additions and 10 deletions
|
|
@ -265,6 +265,7 @@ static int rxrpc_listen(struct socket *sock, int backlog)
|
|||
* @tx_total_len: Total length of data to transmit during the call (or -1)
|
||||
* @gfp: The allocation constraints
|
||||
* @notify_rx: Where to send notifications instead of socket queue
|
||||
* @upgrade: Request service upgrade for call
|
||||
*
|
||||
* Allow a kernel service to begin a call on the nominated socket. This just
|
||||
* sets up all the internal tracking structures and allocates connection and
|
||||
|
|
@ -279,7 +280,8 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
|
|||
unsigned long user_call_ID,
|
||||
s64 tx_total_len,
|
||||
gfp_t gfp,
|
||||
rxrpc_notify_rx_t notify_rx)
|
||||
rxrpc_notify_rx_t notify_rx,
|
||||
bool upgrade)
|
||||
{
|
||||
struct rxrpc_conn_parameters cp;
|
||||
struct rxrpc_call *call;
|
||||
|
|
@ -304,6 +306,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
|
|||
cp.key = key;
|
||||
cp.security_level = 0;
|
||||
cp.exclusive = false;
|
||||
cp.upgrade = upgrade;
|
||||
cp.service_id = srx->srx_service;
|
||||
call = rxrpc_new_client_call(rx, &cp, srx, user_call_ID, tx_total_len,
|
||||
gfp);
|
||||
|
|
|
|||
|
|
@ -607,6 +607,7 @@ wait_error:
|
|||
* @_offset: The running offset into the buffer.
|
||||
* @want_more: True if more data is expected to be read
|
||||
* @_abort: Where the abort code is stored if -ECONNABORTED is returned
|
||||
* @_service: Where to store the actual service ID (may be upgraded)
|
||||
*
|
||||
* Allow a kernel service to receive data and pick up information about the
|
||||
* state of a call. Returns 0 if got what was asked for and there's more
|
||||
|
|
@ -624,7 +625,7 @@ wait_error:
|
|||
*/
|
||||
int rxrpc_kernel_recv_data(struct socket *sock, struct rxrpc_call *call,
|
||||
void *buf, size_t size, size_t *_offset,
|
||||
bool want_more, u32 *_abort)
|
||||
bool want_more, u32 *_abort, u16 *_service)
|
||||
{
|
||||
struct iov_iter iter;
|
||||
struct kvec iov;
|
||||
|
|
@ -680,6 +681,8 @@ int rxrpc_kernel_recv_data(struct socket *sock, struct rxrpc_call *call,
|
|||
read_phase_complete:
|
||||
ret = 1;
|
||||
out:
|
||||
if (_service)
|
||||
*_service = call->service_id;
|
||||
mutex_unlock(&call->user_mutex);
|
||||
_leave(" = %d [%zu,%d]", ret, *_offset, *_abort);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue