Commit 0287f9ed authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

gve: fix unused variable/label warnings

On unusual page sizes, we get harmless warnings:

drivers/net/ethernet/google/gve/gve_rx.c:283:6: error: unused variable 'pagecount' [-Werror,-Wunused-variable]
drivers/net/ethernet/google/gve/gve_rx.c:336:1: error: unused label 'have_skb' [-Werror,-Wunused-label]

Change the preprocessor #if to regular if() to avoid this.

Fixes: f5cedc84 ("gve: Add transmit and receive support")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 05cfee98
...@@ -297,41 +297,41 @@ static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc, ...@@ -297,41 +297,41 @@ static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc,
* it so that we can return it to the device. * it so that we can return it to the device.
*/ */
#if PAGE_SIZE == 4096 if (PAGE_SIZE == 4096) {
if (len <= priv->rx_copybreak) { if (len <= priv->rx_copybreak) {
/* Just copy small packets */ /* Just copy small packets */
skb = gve_rx_copy(dev, napi, page_info, len); skb = gve_rx_copy(dev, napi, page_info, len);
goto have_skb; goto have_skb;
} }
if (unlikely(!gve_can_recycle_pages(dev))) { if (unlikely(!gve_can_recycle_pages(dev))) {
skb = gve_rx_copy(dev, napi, page_info, len); skb = gve_rx_copy(dev, napi, page_info, len);
goto have_skb; goto have_skb;
} }
pagecount = page_count(page_info->page); pagecount = page_count(page_info->page);
if (pagecount == 1) { if (pagecount == 1) {
/* No part of this page is used by any SKBs; we attach /* No part of this page is used by any SKBs; we attach
* the page fragment to a new SKB and pass it up the * the page fragment to a new SKB and pass it up the
* stack. * stack.
*/ */
skb = gve_rx_add_frags(dev, napi, page_info, len); skb = gve_rx_add_frags(dev, napi, page_info, len);
if (!skb) if (!skb)
return true; return true;
/* Make sure the kernel stack can't release the page */ /* Make sure the kernel stack can't release the page */
get_page(page_info->page); get_page(page_info->page);
/* "flip" to other packet buffer on this page */ /* "flip" to other packet buffer on this page */
gve_rx_flip_buff(page_info, &rx->data.data_ring[idx]); gve_rx_flip_buff(page_info, &rx->data.data_ring[idx]);
} else if (pagecount >= 2) { } else if (pagecount >= 2) {
/* We have previously passed the other half of this /* We have previously passed the other half of this
* page up the stack, but it has not yet been freed. * page up the stack, but it has not yet been freed.
*/ */
skb = gve_rx_copy(dev, napi, page_info, len); skb = gve_rx_copy(dev, napi, page_info, len);
} else {
WARN(pagecount < 1, "Pagecount should never be < 1");
return false;
}
} else { } else {
WARN(pagecount < 1, "Pagecount should never be < 1"); skb = gve_rx_copy(dev, napi, page_info, len);
return false;
} }
#else
skb = gve_rx_copy(dev, napi, page_info, len);
#endif
have_skb: have_skb:
/* We didn't manage to allocate an skb but we haven't had any /* We didn't manage to allocate an skb but we haven't had any
......
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