diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2020-07-17 00:16:34 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-19 18:28:34 -0700 |
commit | c7a3a8cd9d41ee0a32659fc99d98ec83af803b77 (patch) | |
tree | f4d091b5276c329c4fb8082a1a9386752d13fcee /drivers | |
parent | 89f4a198c9cad3775f952129a82018b84995d923 (diff) |
net: mvneta: move rxq->left_size on the stack
Allocate rxq->left_size on mvneta_rx_swbm stack since it is used just
in sw bm napi_poll
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/marvell/mvneta.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 8b7f6fcd4cca..2c9277e73cef 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -698,8 +698,6 @@ struct mvneta_rx_queue { /* Index of first RX DMA descriptor to refill */ int first_to_refill; u32 refill_num; - - int left_size; }; static enum cpuhp_state online_hpstate; @@ -2228,7 +2226,7 @@ static void mvneta_swbm_rx_frame(struct mvneta_port *pp, struct mvneta_rx_desc *rx_desc, struct mvneta_rx_queue *rxq, - struct xdp_buff *xdp, + struct xdp_buff *xdp, int *size, struct page *page, struct mvneta_stats *stats) { @@ -2262,7 +2260,7 @@ mvneta_swbm_rx_frame(struct mvneta_port *pp, sinfo = xdp_get_shared_info_from_buff(xdp); sinfo->nr_frags = 0; - rxq->left_size = rx_desc->data_size - len; + *size = rx_desc->data_size - len; rx_desc->buf_phys_addr = 0; } @@ -2270,7 +2268,7 @@ static void mvneta_swbm_add_rx_fragment(struct mvneta_port *pp, struct mvneta_rx_desc *rx_desc, struct mvneta_rx_queue *rxq, - struct xdp_buff *xdp, + struct xdp_buff *xdp, int *size, struct page *page) { struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp); @@ -2278,11 +2276,11 @@ mvneta_swbm_add_rx_fragment(struct mvneta_port *pp, enum dma_data_direction dma_dir; int data_len, len; - if (rxq->left_size > MVNETA_MAX_RX_BUF_SIZE) { + if (*size > MVNETA_MAX_RX_BUF_SIZE) { len = MVNETA_MAX_RX_BUF_SIZE; data_len = len; } else { - len = rxq->left_size; + len = *size; data_len = len - ETH_FCS_LEN; } dma_dir = page_pool_get_dma_dir(rxq->page_pool); @@ -2300,7 +2298,7 @@ mvneta_swbm_add_rx_fragment(struct mvneta_port *pp, rx_desc->buf_phys_addr = 0; } - rxq->left_size -= len; + *size -= len; } static struct sk_buff * @@ -2341,7 +2339,7 @@ static int mvneta_rx_swbm(struct napi_struct *napi, struct mvneta_port *pp, int budget, struct mvneta_rx_queue *rxq) { - int rx_proc = 0, rx_todo, refill; + int rx_proc = 0, rx_todo, refill, size = 0; struct net_device *dev = pp->dev; struct xdp_buff xdp_buf = { .frame_sz = PAGE_SIZE, @@ -2378,25 +2376,25 @@ static int mvneta_rx_swbm(struct napi_struct *napi, goto next; } - frame_sz = rx_desc->data_size - ETH_FCS_LEN; + size = rx_desc->data_size; + frame_sz = size - ETH_FCS_LEN; desc_status = rx_desc->status; - mvneta_swbm_rx_frame(pp, rx_desc, rxq, &xdp_buf, page, - &ps); + mvneta_swbm_rx_frame(pp, rx_desc, rxq, &xdp_buf, + &size, page, &ps); } else { if (unlikely(!xdp_buf.data_hard_start)) continue; mvneta_swbm_add_rx_fragment(pp, rx_desc, rxq, &xdp_buf, - page); + &size, page); } /* Middle or Last descriptor */ if (!(rx_status & MVNETA_RXD_LAST_DESC)) /* no last descriptor this time */ continue; - if (rxq->left_size) { - rxq->left_size = 0; + if (size) { mvneta_xdp_put_buff(pp, rxq, &xdp_buf, -1, true); goto next; } @@ -3372,7 +3370,6 @@ static void mvneta_rxq_deinit(struct mvneta_port *pp, rxq->descs_phys = 0; rxq->first_to_refill = 0; rxq->refill_num = 0; - rxq->left_size = 0; } static int mvneta_txq_sw_init(struct mvneta_port *pp, |