Commit c7a3a8cd authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by David S. Miller

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: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 89f4a198
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment