Skip to content

Commit

Permalink
net: ipa: compute proper aggregation limit
Browse files Browse the repository at this point in the history
commit c579409 upstream.

The aggregation byte limit for an endpoint is currently computed
based on the endpoint's receive buffer size.

However, some bytes at the front of each receive buffer are reserved
on the assumption that--as with SKBs--it might be useful to insert
data (such as headers) before what lands in the buffer.

The aggregation byte limit currently doesn't take into account that
reserved space, and as a result, aggregation could require space
past that which is available in the buffer.

Fix this by reducing the size used to compute the aggregation byte
limit by the NET_SKB_PAD offset reserved for each receive buffer.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
alexelder authored and gregkh committed Jun 6, 2022
1 parent cf2fbc5 commit 23cb9ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ipa/ipa_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,13 +722,15 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint)

if (endpoint->data->aggregation) {
if (!endpoint->toward_ipa) {
u32 buffer_size;
bool close_eof;
u32 limit;

val |= u32_encode_bits(IPA_ENABLE_AGGR, AGGR_EN_FMASK);
val |= u32_encode_bits(IPA_GENERIC, AGGR_TYPE_FMASK);

limit = ipa_aggr_size_kb(IPA_RX_BUFFER_SIZE);
buffer_size = IPA_RX_BUFFER_SIZE - NET_SKB_PAD;
limit = ipa_aggr_size_kb(buffer_size);
val |= aggr_byte_limit_encoded(version, limit);

limit = IPA_AGGR_TIME_LIMIT;
Expand Down

0 comments on commit 23cb9ef

Please sign in to comment.