Commit 35f9b2f4 authored by Bailey Forrest's avatar Bailey Forrest Committed by David S. Miller
Browse files

gve: gve_rx_copy: Move padding to an argument



Future use cases will have a different padding value.

Signed-off-by: default avatarBailey Forrest <bcf@google.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Reviewed-by: default avatarCatherine Sullivan <csully@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dbdaa675
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -350,7 +350,7 @@ gve_rx_qpl(struct device *dev, struct net_device *netdev,
			gve_rx_flip_buff(page_info, &data_slot->qpl_offset);
		}
	} else {
		skb = gve_rx_copy(netdev, napi, page_info, len);
		skb = gve_rx_copy(netdev, napi, page_info, len, GVE_RX_PAD);
		if (skb) {
			u64_stats_update_begin(&rx->statss);
			rx->rx_copied_pkt++;
@@ -392,7 +392,7 @@ static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc,

	if (len <= priv->rx_copybreak) {
		/* Just copy small packets */
		skb = gve_rx_copy(dev, napi, page_info, len);
		skb = gve_rx_copy(dev, napi, page_info, len, GVE_RX_PAD);
		u64_stats_update_begin(&rx->statss);
		rx->rx_copied_pkt++;
		rx->rx_copybreak_pkt++;
+3 −2
Original line number Diff line number Diff line
@@ -45,10 +45,11 @@ void gve_rx_add_to_block(struct gve_priv *priv, int queue_idx)
}

struct sk_buff *gve_rx_copy(struct net_device *dev, struct napi_struct *napi,
			    struct gve_rx_slot_page_info *page_info, u16 len)
			    struct gve_rx_slot_page_info *page_info, u16 len,
			    u16 pad)
{
	struct sk_buff *skb = napi_alloc_skb(napi, len);
	void *va = page_info->page_address + GVE_RX_PAD +
	void *va = page_info->page_address + pad +
		   (page_info->page_offset ? PAGE_SIZE / 2 : 0);

	if (unlikely(!skb))
+2 −1
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ void gve_rx_remove_from_block(struct gve_priv *priv, int queue_idx);
void gve_rx_add_to_block(struct gve_priv *priv, int queue_idx);

struct sk_buff *gve_rx_copy(struct net_device *dev, struct napi_struct *napi,
			    struct gve_rx_slot_page_info *page_info, u16 len);
			    struct gve_rx_slot_page_info *page_info, u16 len,
			    u16 pad);

#endif /* _GVE_UTILS_H */