Skip to content

Commit

Permalink
net: mvneta: avoid possible cache misses in mvneta_rx_swbm
Browse files Browse the repository at this point in the history
Do not use rx_desc pointers if possible since rx descriptors are stored in
uncached memory and dereferencing rx_desc pointers generate extra loads.
This patch improves XDP_DROP performance of ~ 110Kpps (700Kpps vs 590Kpps)
on Marvell Espressobin

Analyzed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lorenzo Bianconi authored and David S. Miller committed Sep 30, 2020
1 parent 2b2706a commit 879456b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/net/ethernet/marvell/mvneta.c
Original file line number Diff line number Diff line change
Expand Up @@ -2236,19 +2236,22 @@ mvneta_swbm_rx_frame(struct mvneta_port *pp,
enum dma_data_direction dma_dir;
struct skb_shared_info *sinfo;

if (rx_desc->data_size > MVNETA_MAX_RX_BUF_SIZE) {
if (*size > MVNETA_MAX_RX_BUF_SIZE) {
len = MVNETA_MAX_RX_BUF_SIZE;
data_len += len;
} else {
len = rx_desc->data_size;
len = *size;
data_len += len - ETH_FCS_LEN;
}
*size = *size - len;

dma_dir = page_pool_get_dma_dir(rxq->page_pool);
dma_sync_single_for_cpu(dev->dev.parent,
rx_desc->buf_phys_addr,
len, dma_dir);

rx_desc->buf_phys_addr = 0;

/* Prefetch header */
prefetch(data);

Expand All @@ -2259,9 +2262,6 @@ mvneta_swbm_rx_frame(struct mvneta_port *pp,

sinfo = xdp_get_shared_info_from_buff(xdp);
sinfo->nr_frags = 0;

*size = rx_desc->data_size - len;
rx_desc->buf_phys_addr = 0;
}

static void
Expand Down Expand Up @@ -2375,7 +2375,7 @@ static int mvneta_rx_swbm(struct napi_struct *napi,

size = rx_desc->data_size;
frame_sz = size - ETH_FCS_LEN;
desc_status = rx_desc->status;
desc_status = rx_status;

mvneta_swbm_rx_frame(pp, rx_desc, rxq, &xdp_buf,
&size, page);
Expand Down

0 comments on commit 879456b

Please sign in to comment.