Skip to contentSkip to conversation

sfc: Feed GRO result into RX allocation policy and interrupt moderation

PATCH Applied Ben Hutchings 2 participants 2 messages Oct 29, 2009 – Oct 30, 2009

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 sfc: Feed GRO result into RX allocation policy and interrupt moderation

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.

---
 drivers/net/sfc/rx.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
drivers/net/sfc/rx.c +11 -2
index 4b65c62..9277e9a 100644
@@ -445,6 +445,7 @@ 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) {
@@ -452,6 +453,7 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
 
 		if (!skb) {
 			put_page(rx_buf->page);
+			gro_result = GRO_DROP;
 			goto out;
 		}
 
@@ -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);
@@ -476,9 +478,16 @@ out:
 		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,
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer
#1 lore raw

From: Ben Hutchings <[email protected]>
Date: Thu, 29 Oct 2009 17:21:24 +0000

Quoted 8 lines

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.

I'll pull net-2.6 into net-next-2.6 before applying this patch and the next one.

But you need to tell me that such dependencies exist when you submit patches like this, ok?