Skip to content

Commit

Permalink
sfc: Feed GRO result into RX allocation policy and interrupt moderation
Browse files Browse the repository at this point in the history
When GRO is successfully merging received packets, we should allocate
raw page buffers rather than skbs that will be discarded by GRO.
Otherwise, we should allocate skbs.

GRO also benefits from higher interrupt moderation, so increase the
score for mergeable RX packets.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Oct 30, 2009
1 parent c7c4b3b commit 18e1d2b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions drivers/net/sfc/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,15 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
bool checksummed)
{
struct napi_struct *napi = &channel->napi_str;
gro_result_t gro_result;

/* Pass the skb/page into the LRO engine */
if (rx_buf->page) {
struct sk_buff *skb = napi_get_frags(napi);

if (!skb) {
put_page(rx_buf->page);
gro_result = GRO_DROP;
goto out;
}

Expand All @@ -467,7 +469,7 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
skb->ip_summed =
checksummed ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE;

napi_gro_frags(napi);
gro_result = napi_gro_frags(napi);

out:
EFX_BUG_ON_PARANOID(rx_buf->skb);
Expand All @@ -476,9 +478,16 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
EFX_BUG_ON_PARANOID(!rx_buf->skb);
EFX_BUG_ON_PARANOID(!checksummed);

napi_gro_receive(napi, rx_buf->skb);
gro_result = napi_gro_receive(napi, rx_buf->skb);
rx_buf->skb = NULL;
}

if (gro_result == GRO_NORMAL) {
channel->rx_alloc_level += RX_ALLOC_FACTOR_SKB;
} else if (gro_result != GRO_DROP) {
channel->rx_alloc_level += RX_ALLOC_FACTOR_LRO;
channel->irq_mod_score += 2;
}
}

void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
Expand Down

0 comments on commit 18e1d2b

Please sign in to comment.