aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/rxrpc.txt10
-rw-r--r--include/net/af_rxrpc.h2
-rw-r--r--net/rxrpc/af_rxrpc.c25
3 files changed, 37 insertions, 0 deletions
diff --git a/Documentation/networking/rxrpc.txt b/Documentation/networking/rxrpc.txt
index cd7303d7fa25..ff035a6418e3 100644
--- a/Documentation/networking/rxrpc.txt
+++ b/Documentation/networking/rxrpc.txt
@@ -1056,6 +1056,16 @@ The kernel interface functions are as follows:
1056 This value can be used to determine if the remote client has been 1056 This value can be used to determine if the remote client has been
1057 restarted as it shouldn't change otherwise. 1057 restarted as it shouldn't change otherwise.
1058 1058
1059 (*) Set the maxmimum lifespan on a call.
1060
1061 void rxrpc_kernel_set_max_life(struct socket *sock,
1062 struct rxrpc_call *call,
1063 unsigned long hard_timeout)
1064
1065 This sets the maximum lifespan on a call to hard_timeout (which is in
1066 jiffies). In the event of the timeout occurring, the call will be
1067 aborted and -ETIME or -ETIMEDOUT will be returned.
1068
1059 1069
1060======================= 1070=======================
1061CONFIGURABLE PARAMETERS 1071CONFIGURABLE PARAMETERS
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h
index 78c856cba4f5..c04602ca4a55 100644
--- a/include/net/af_rxrpc.h
+++ b/include/net/af_rxrpc.h
@@ -68,5 +68,7 @@ u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
68bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *, 68bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
69 ktime_t *); 69 ktime_t *);
70bool rxrpc_kernel_call_is_complete(struct rxrpc_call *); 70bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
71void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
72 unsigned long);
71 73
72#endif /* _NET_RXRPC_H */ 74#endif /* _NET_RXRPC_H */
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index ae8c5d7f3bf1..213935fbbbf7 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -443,6 +443,31 @@ void rxrpc_kernel_new_call_notification(
443} 443}
444EXPORT_SYMBOL(rxrpc_kernel_new_call_notification); 444EXPORT_SYMBOL(rxrpc_kernel_new_call_notification);
445 445
446/**
447 * rxrpc_kernel_set_max_life - Set maximum lifespan on a call
448 * @sock: The socket the call is on
449 * @call: The call to configure
450 * @hard_timeout: The maximum lifespan of the call in jiffies
451 *
452 * Set the maximum lifespan of a call. The call will end with ETIME or
453 * ETIMEDOUT if it takes longer than this.
454 */
455void rxrpc_kernel_set_max_life(struct socket *sock, struct rxrpc_call *call,
456 unsigned long hard_timeout)
457{
458 unsigned long now;
459
460 mutex_lock(&call->user_mutex);
461
462 now = jiffies;
463 hard_timeout += now;
464 WRITE_ONCE(call->expect_term_by, hard_timeout);
465 rxrpc_reduce_call_timer(call, hard_timeout, now, rxrpc_timer_set_for_hard);
466
467 mutex_unlock(&call->user_mutex);
468}
469EXPORT_SYMBOL(rxrpc_kernel_set_max_life);
470
446/* 471/*
447 * connect an RxRPC socket 472 * connect an RxRPC socket
448 * - this just targets it at a specific destination; no actual connection 473 * - this just targets it at a specific destination; no actual connection