Skip to content

Commit e090bfb

Browse files
ecree-solarflaredavem330
authored andcommitted
sfc: batch up RX delivery
Improves packet rate of 1-byte UDP receives by up to 10%. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f6ad8c1 commit e090bfb

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

drivers/net/ethernet/sfc/efx.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,17 @@ static int efx_check_disabled(struct efx_nic *efx)
264264
static int efx_process_channel(struct efx_channel *channel, int budget)
265265
{
266266
struct efx_tx_queue *tx_queue;
267+
struct list_head rx_list;
267268
int spent;
268269

269270
if (unlikely(!channel->enabled))
270271
return 0;
271272

273+
/* Prepare the batch receive list */
274+
EFX_WARN_ON_PARANOID(channel->rx_list != NULL);
275+
INIT_LIST_HEAD(&rx_list);
276+
channel->rx_list = &rx_list;
277+
272278
efx_for_each_channel_tx_queue(tx_queue, channel) {
273279
tx_queue->pkts_compl = 0;
274280
tx_queue->bytes_compl = 0;
@@ -291,6 +297,10 @@ static int efx_process_channel(struct efx_channel *channel, int budget)
291297
}
292298
}
293299

300+
/* Receive any packets we queued up */
301+
netif_receive_skb_list(channel->rx_list);
302+
channel->rx_list = NULL;
303+
294304
return spent;
295305
}
296306

@@ -555,6 +565,8 @@ static int efx_probe_channel(struct efx_channel *channel)
555565
goto fail;
556566
}
557567

568+
channel->rx_list = NULL;
569+
558570
return 0;
559571

560572
fail:

drivers/net/ethernet/sfc/net_driver.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ enum efx_sync_events_state {
448448
* __efx_rx_packet(), or zero if there is none
449449
* @rx_pkt_index: Ring index of first buffer for next packet to be delivered
450450
* by __efx_rx_packet(), if @rx_pkt_n_frags != 0
451+
* @rx_list: list of SKBs from current RX, awaiting processing
451452
* @rx_queue: RX queue for this channel
452453
* @tx_queue: TX queues for this channel
453454
* @sync_events_state: Current state of sync events on this channel
@@ -500,6 +501,8 @@ struct efx_channel {
500501
unsigned int rx_pkt_n_frags;
501502
unsigned int rx_pkt_index;
502503

504+
struct list_head *rx_list;
505+
503506
struct efx_rx_queue rx_queue;
504507
struct efx_tx_queue tx_queue[EFX_TXQ_TYPES];
505508

drivers/net/ethernet/sfc/rx.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,12 @@ static void efx_rx_deliver(struct efx_channel *channel, u8 *eh,
634634
return;
635635

636636
/* Pass the packet up */
637-
netif_receive_skb(skb);
637+
if (channel->rx_list != NULL)
638+
/* Add to list, will pass up later */
639+
list_add_tail(&skb->list, channel->rx_list);
640+
else
641+
/* No list, so pass it up now */
642+
netif_receive_skb(skb);
638643
}
639644

640645
/* Handle a received packet. Second half: Touches packet payload. */

0 commit comments

Comments
 (0)