Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4858e403 authored by David Howells's avatar David Howells
Browse files

rxrpc: Pass the input handler's data skb reference to the Rx ring



Pass the reference held on a DATA skb in the rxrpc input handler into the
Rx ring rather than getting an additional ref for this and then dropping
the original ref at the end.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent e2de6c40
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -422,7 +422,8 @@ static void rxrpc_input_dup_data(struct rxrpc_call *call, rxrpc_seq_t seq,
}

/*
 * Process a DATA packet, adding the packet to the Rx ring.
 * Process a DATA packet, adding the packet to the Rx ring.  The caller's
 * packet ref must be passed on or discarded.
 */
static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)
{
@@ -441,8 +442,10 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)
	       sp->hdr.serial, seq0, sp->hdr.flags, sp->nr_subpackets);

	state = READ_ONCE(call->state);
	if (state >= RXRPC_CALL_COMPLETE)
	if (state >= RXRPC_CALL_COMPLETE) {
		rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
		return;
	}

	if (call->state == RXRPC_CALL_SERVER_RECV_REQUEST) {
		unsigned long timo = READ_ONCE(call->next_req_timo);
@@ -555,6 +558,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)
		 * Barriers against rxrpc_recvmsg_data() and rxrpc_rotate_rx_window()
		 * and also rxrpc_fill_out_ack().
		 */
		if (!terminal)
			rxrpc_get_skb(skb, rxrpc_skb_rx_got);
		call->rxtx_annotations[ix] = annotation;
		smp_wmb();
@@ -616,6 +620,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)

unlock:
	spin_unlock(&call->input_lock);
	rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
	_leave(" [queued]");
}

@@ -1024,7 +1029,7 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
	switch (sp->hdr.type) {
	case RXRPC_PACKET_TYPE_DATA:
		rxrpc_input_data(call, skb);
		break;
		goto no_free;

	case RXRPC_PACKET_TYPE_ACK:
		rxrpc_input_ack(call, skb);
@@ -1051,6 +1056,8 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
		break;
	}

	rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
no_free:
	_leave("");
}

@@ -1375,8 +1382,11 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb)
		mutex_unlock(&call->user_mutex);
	}

	/* Process a call packet; this either discards or passes on the ref
	 * elsewhere.
	 */
	rxrpc_input_call_packet(call, skb);
	goto discard;
	goto out;

discard:
	rxrpc_free_skb(skb, rxrpc_skb_rx_freed);