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: David Howells <dhowells@redhat.com>
This commit is contained in:
parent
e2de6c4048
commit
4858e40303
@ -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)
|
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);
|
sp->hdr.serial, seq0, sp->hdr.flags, sp->nr_subpackets);
|
||||||
|
|
||||||
state = READ_ONCE(call->state);
|
state = READ_ONCE(call->state);
|
||||||
if (state >= RXRPC_CALL_COMPLETE)
|
if (state >= RXRPC_CALL_COMPLETE) {
|
||||||
|
rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (call->state == RXRPC_CALL_SERVER_RECV_REQUEST) {
|
if (call->state == RXRPC_CALL_SERVER_RECV_REQUEST) {
|
||||||
unsigned long timo = READ_ONCE(call->next_req_timo);
|
unsigned long timo = READ_ONCE(call->next_req_timo);
|
||||||
@ -555,7 +558,8 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)
|
|||||||
* Barriers against rxrpc_recvmsg_data() and rxrpc_rotate_rx_window()
|
* Barriers against rxrpc_recvmsg_data() and rxrpc_rotate_rx_window()
|
||||||
* and also rxrpc_fill_out_ack().
|
* and also rxrpc_fill_out_ack().
|
||||||
*/
|
*/
|
||||||
rxrpc_get_skb(skb, rxrpc_skb_rx_got);
|
if (!terminal)
|
||||||
|
rxrpc_get_skb(skb, rxrpc_skb_rx_got);
|
||||||
call->rxtx_annotations[ix] = annotation;
|
call->rxtx_annotations[ix] = annotation;
|
||||||
smp_wmb();
|
smp_wmb();
|
||||||
call->rxtx_buffer[ix] = skb;
|
call->rxtx_buffer[ix] = skb;
|
||||||
@ -616,6 +620,7 @@ ack:
|
|||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
spin_unlock(&call->input_lock);
|
spin_unlock(&call->input_lock);
|
||||||
|
rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
|
||||||
_leave(" [queued]");
|
_leave(" [queued]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1024,7 +1029,7 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
|
|||||||
switch (sp->hdr.type) {
|
switch (sp->hdr.type) {
|
||||||
case RXRPC_PACKET_TYPE_DATA:
|
case RXRPC_PACKET_TYPE_DATA:
|
||||||
rxrpc_input_data(call, skb);
|
rxrpc_input_data(call, skb);
|
||||||
break;
|
goto no_free;
|
||||||
|
|
||||||
case RXRPC_PACKET_TYPE_ACK:
|
case RXRPC_PACKET_TYPE_ACK:
|
||||||
rxrpc_input_ack(call, skb);
|
rxrpc_input_ack(call, skb);
|
||||||
@ -1051,6 +1056,8 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
|
||||||
|
no_free:
|
||||||
_leave("");
|
_leave("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1375,8 +1382,11 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb)
|
|||||||
mutex_unlock(&call->user_mutex);
|
mutex_unlock(&call->user_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Process a call packet; this either discards or passes on the ref
|
||||||
|
* elsewhere.
|
||||||
|
*/
|
||||||
rxrpc_input_call_packet(call, skb);
|
rxrpc_input_call_packet(call, skb);
|
||||||
goto discard;
|
goto out;
|
||||||
|
|
||||||
discard:
|
discard:
|
||||||
rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
|
rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
|
||||||
|
Loading…
Reference in New Issue
Block a user