xref: /linux/drivers/net/ethernet/google/gve/gve_utils.h (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
1 /* SPDX-License-Identifier: (GPL-2.0 OR MIT)
2  * Google virtual Ethernet (gve) driver
3  *
4  * Copyright (C) 2015-2021 Google, Inc.
5  */
6 
7 #ifndef _GVE_UTILS_H
8 #define _GVE_UTILS_H
9 
10 #include <linux/etherdevice.h>
11 
12 #include "gve.h"
13 
14 bool gve_tx_was_added_to_block(struct gve_priv *priv, int queue_idx);
15 void gve_tx_remove_from_block(struct gve_priv *priv, int queue_idx);
16 void gve_tx_add_to_block(struct gve_priv *priv, int queue_idx);
17 
18 bool gve_rx_was_added_to_block(struct gve_priv *priv, int queue_idx);
19 void gve_rx_remove_from_block(struct gve_priv *priv, int queue_idx);
20 void gve_rx_add_to_block(struct gve_priv *priv, int queue_idx);
21 
22 struct sk_buff *gve_rx_copy_data(struct net_device *dev, struct napi_struct *napi,
23 				 u8 *data, u16 len);
24 
25 struct sk_buff *gve_rx_copy(struct net_device *dev, struct napi_struct *napi,
26 			    struct gve_rx_slot_page_info *page_info, u16 len);
27 
28 /* Decrement pagecnt_bias. Set it back to INT_MAX if it reached zero. */
29 void gve_dec_pagecnt_bias(struct gve_rx_slot_page_info *page_info);
30 
31 void gve_add_napi(struct gve_priv *priv, int ntfy_idx,
32 		  int (*gve_poll)(struct napi_struct *, int));
33 void gve_remove_napi(struct gve_priv *priv, int ntfy_idx);
34 #endif /* _GVE_UTILS_H */
35 
36