Commit 29e03ec7 authored by David Howells's avatar David Howells Committed by Jakub Kicinski
Browse files

rxrpc: Use umin() and umax() rather than min_t()/max_t() where possible



Use umin() and umax() rather than min_t()/max_t() where the type specified
is an unsigned type.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://patch.msgid.link/20241204074710.990092-4-dhowells@redhat.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0e56ebde
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -233,8 +233,7 @@ static void rxrpc_close_tx_phase(struct rxrpc_call *call)

static bool rxrpc_tx_window_has_space(struct rxrpc_call *call)
{
	unsigned int winsize = min_t(unsigned int, call->tx_winsize,
				     call->cong_cwnd + call->cong_extra);
	unsigned int winsize = umin(call->tx_winsize, call->cong_cwnd + call->cong_extra);
	rxrpc_seq_t window = call->acks_hard_ack, wtop = window + winsize;
	rxrpc_seq_t tx_top = call->tx_top;
	int space;
@@ -467,7 +466,7 @@ bool rxrpc_input_call_event(struct rxrpc_call *call, struct sk_buff *skb)
		} else {
			unsigned long nowj = jiffies, delayj, nextj;

			delayj = max(nsecs_to_jiffies(delay), 1);
			delayj = umax(nsecs_to_jiffies(delay), 1);
			nextj = nowj + delayj;
			if (time_before(nextj, call->timer.expires) ||
			    !timer_pending(&call->timer)) {
+2 −2
Original line number Diff line number Diff line
@@ -220,9 +220,9 @@ static struct rxrpc_call *rxrpc_alloc_client_call(struct rxrpc_sock *rx,
		__set_bit(RXRPC_CALL_EXCLUSIVE, &call->flags);

	if (p->timeouts.normal)
		call->next_rx_timo = min(p->timeouts.normal, 1);
		call->next_rx_timo = umin(p->timeouts.normal, 1);
	if (p->timeouts.idle)
		call->next_req_timo = min(p->timeouts.idle, 1);
		call->next_req_timo = umin(p->timeouts.idle, 1);
	if (p->timeouts.hard)
		call->hard_timo = p->timeouts.hard;

+1 −1
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ static bool rxrpc_may_reuse_conn(struct rxrpc_connection *conn)
	distance = id - id_cursor;
	if (distance < 0)
		distance = -distance;
	limit = max_t(unsigned long, atomic_read(&rxnet->nr_conns) * 4, 1024);
	limit = umax(atomic_read(&rxnet->nr_conns) * 4, 1024);
	if (distance > limit)
		goto mark_dont_reuse;

+5 −8
Original line number Diff line number Diff line
@@ -44,8 +44,7 @@ static void rxrpc_congestion_management(struct rxrpc_call *call,

	if (test_and_clear_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags)) {
		summary->retrans_timeo = true;
		call->cong_ssthresh = max_t(unsigned int,
					    summary->flight_size / 2, 2);
		call->cong_ssthresh = umax(summary->flight_size / 2, 2);
		cwnd = 1;
		if (cwnd >= call->cong_ssthresh &&
		    call->cong_mode == RXRPC_CALL_SLOW_START) {
@@ -113,8 +112,7 @@ static void rxrpc_congestion_management(struct rxrpc_call *call,

		change = rxrpc_cong_begin_retransmission;
		call->cong_mode = RXRPC_CALL_FAST_RETRANSMIT;
		call->cong_ssthresh = max_t(unsigned int,
					    summary->flight_size / 2, 2);
		call->cong_ssthresh = umax(summary->flight_size / 2, 2);
		cwnd = call->cong_ssthresh + 3;
		call->cong_extra = 0;
		call->cong_dup_acks = 0;
@@ -206,9 +204,8 @@ void rxrpc_congestion_degrade(struct rxrpc_call *call)
	rxrpc_inc_stat(call->rxnet, stat_tx_data_cwnd_reset);
	call->tx_last_sent = now;
	call->cong_mode = RXRPC_CALL_SLOW_START;
	call->cong_ssthresh = max_t(unsigned int, call->cong_ssthresh,
				    call->cong_cwnd * 3 / 4);
	call->cong_cwnd = max_t(unsigned int, call->cong_cwnd / 2, RXRPC_MIN_CWND);
	call->cong_ssthresh = umax(call->cong_ssthresh, call->cong_cwnd * 3 / 4);
	call->cong_cwnd = umax(call->cong_cwnd / 2, RXRPC_MIN_CWND);
}

/*
@@ -709,7 +706,7 @@ static void rxrpc_input_ack_trailer(struct rxrpc_call *call, struct sk_buff *skb
		call->tx_winsize = rwind;
	}

	mtu = min(ntohl(trailer->maxMTU), ntohl(trailer->ifMTU));
	mtu = umin(ntohl(trailer->maxMTU), ntohl(trailer->ifMTU));

	peer = call->peer;
	if (mtu < peer->maxdata) {
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ static int none_init_connection_security(struct rxrpc_connection *conn,
 */
static struct rxrpc_txbuf *none_alloc_txbuf(struct rxrpc_call *call, size_t remain, gfp_t gfp)
{
	return rxrpc_alloc_data_txbuf(call, min_t(size_t, remain, RXRPC_JUMBO_DATALEN), 1, gfp);
	return rxrpc_alloc_data_txbuf(call, umin(remain, RXRPC_JUMBO_DATALEN), 1, gfp);
}

static int none_secure_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
Loading