gve.h (c5c34f5793f384ed2895584c6e2350b059c3f161) | gve.h (2cb67ab153d59473d67713c709a198922b7e87a3) |
---|---|
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_H_ 8#define _GVE_H_ --- 210 unchanged lines hidden (view full) --- 219 220/* Tracks the memory in the fifo occupied by a segment of a packet */ 221struct gve_tx_iovec { 222 u32 iov_offset; /* offset into this segment */ 223 u32 iov_len; /* length */ 224 u32 iov_padding; /* padding associated with this segment */ 225}; 226 | 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_H_ 8#define _GVE_H_ --- 210 unchanged lines hidden (view full) --- 219 220/* Tracks the memory in the fifo occupied by a segment of a packet */ 221struct gve_tx_iovec { 222 u32 iov_offset; /* offset into this segment */ 223 u32 iov_len; /* length */ 224 u32 iov_padding; /* padding associated with this segment */ 225}; 226 |
227struct gve_tx_dma_buf { 228 DEFINE_DMA_UNMAP_ADDR(dma); 229 DEFINE_DMA_UNMAP_LEN(len); 230}; 231 | |
232/* Tracks the memory in the fifo occupied by the skb. Mapped 1:1 to a desc 233 * ring entry but only used for a pkt_desc not a seg_desc 234 */ 235struct gve_tx_buffer_state { 236 struct sk_buff *skb; /* skb for this pkt */ 237 union { 238 struct gve_tx_iovec iov[GVE_TX_MAX_IOVEC]; /* segments of this pkt */ | 227/* Tracks the memory in the fifo occupied by the skb. Mapped 1:1 to a desc 228 * ring entry but only used for a pkt_desc not a seg_desc 229 */ 230struct gve_tx_buffer_state { 231 struct sk_buff *skb; /* skb for this pkt */ 232 union { 233 struct gve_tx_iovec iov[GVE_TX_MAX_IOVEC]; /* segments of this pkt */ |
239 struct gve_tx_dma_buf buf; | 234 struct { 235 DEFINE_DMA_UNMAP_ADDR(dma); 236 DEFINE_DMA_UNMAP_LEN(len); 237 }; |
240 }; 241}; 242 243/* A TX buffer - each queue has one */ 244struct gve_tx_fifo { 245 void *base; /* address of base of FIFO */ 246 u32 size; /* total size */ 247 atomic_t available; /* how much space is still available */ --- 27 unchanged lines hidden (view full) --- 275 struct sk_buff *skb; /* skb for this packet */ 276 277 /* 0th element corresponds to the linear portion of `skb`, should be 278 * unmapped with `dma_unmap_single`. 279 * 280 * All others correspond to `skb`'s frags and should be unmapped with 281 * `dma_unmap_page`. 282 */ | 238 }; 239}; 240 241/* A TX buffer - each queue has one */ 242struct gve_tx_fifo { 243 void *base; /* address of base of FIFO */ 244 u32 size; /* total size */ 245 atomic_t available; /* how much space is still available */ --- 27 unchanged lines hidden (view full) --- 273 struct sk_buff *skb; /* skb for this packet */ 274 275 /* 0th element corresponds to the linear portion of `skb`, should be 276 * unmapped with `dma_unmap_single`. 277 * 278 * All others correspond to `skb`'s frags and should be unmapped with 279 * `dma_unmap_page`. 280 */ |
283 struct gve_tx_dma_buf bufs[MAX_SKB_FRAGS + 1]; | 281 DEFINE_DMA_UNMAP_ADDR(dma[MAX_SKB_FRAGS + 1]); 282 DEFINE_DMA_UNMAP_LEN(len[MAX_SKB_FRAGS + 1]); |
284 u16 num_bufs; 285 286 /* Linked list index to next element in the list, or -1 if none */ 287 s16 next; 288 289 /* Linked list index to prev element in the list, or -1 if none. 290 * Used for tracking either outstanding miss completions or prematurely 291 * freed packets. --- 529 unchanged lines hidden (view full) --- 821netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev); 822bool gve_tx_poll(struct gve_notify_block *block, int budget); 823int gve_tx_alloc_rings(struct gve_priv *priv); 824void gve_tx_free_rings_gqi(struct gve_priv *priv); 825__be32 gve_tx_load_event_counter(struct gve_priv *priv, 826 struct gve_tx_ring *tx); 827/* rx handling */ 828void gve_rx_write_doorbell(struct gve_priv *priv, struct gve_rx_ring *rx); | 283 u16 num_bufs; 284 285 /* Linked list index to next element in the list, or -1 if none */ 286 s16 next; 287 288 /* Linked list index to prev element in the list, or -1 if none. 289 * Used for tracking either outstanding miss completions or prematurely 290 * freed packets. --- 529 unchanged lines hidden (view full) --- 820netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev); 821bool gve_tx_poll(struct gve_notify_block *block, int budget); 822int gve_tx_alloc_rings(struct gve_priv *priv); 823void gve_tx_free_rings_gqi(struct gve_priv *priv); 824__be32 gve_tx_load_event_counter(struct gve_priv *priv, 825 struct gve_tx_ring *tx); 826/* rx handling */ 827void gve_rx_write_doorbell(struct gve_priv *priv, struct gve_rx_ring *rx); |
829bool gve_rx_poll(struct gve_notify_block *block, int budget); | 828int gve_rx_poll(struct gve_notify_block *block, int budget); 829bool gve_rx_work_pending(struct gve_rx_ring *rx); |
830int gve_rx_alloc_rings(struct gve_priv *priv); 831void gve_rx_free_rings_gqi(struct gve_priv *priv); | 830int gve_rx_alloc_rings(struct gve_priv *priv); 831void gve_rx_free_rings_gqi(struct gve_priv *priv); |
832bool gve_clean_rx_done(struct gve_rx_ring *rx, int budget, 833 netdev_features_t feat); | |
834/* Reset */ 835void gve_schedule_reset(struct gve_priv *priv); 836int gve_reset(struct gve_priv *priv, bool attempt_teardown); 837int gve_adjust_queues(struct gve_priv *priv, 838 struct gve_queue_config new_rx_config, 839 struct gve_queue_config new_tx_config); 840/* report stats handling */ 841void gve_handle_report_stats(struct gve_priv *priv); 842/* exported by ethtool.c */ 843extern const struct ethtool_ops gve_ethtool_ops; 844/* needed by ethtool */ 845extern const char gve_version_str[]; 846#endif /* _GVE_H_ */ | 832/* Reset */ 833void gve_schedule_reset(struct gve_priv *priv); 834int gve_reset(struct gve_priv *priv, bool attempt_teardown); 835int gve_adjust_queues(struct gve_priv *priv, 836 struct gve_queue_config new_rx_config, 837 struct gve_queue_config new_tx_config); 838/* report stats handling */ 839void gve_handle_report_stats(struct gve_priv *priv); 840/* exported by ethtool.c */ 841extern const struct ethtool_ops gve_ethtool_ops; 842/* needed by ethtool */ 843extern const char gve_version_str[]; 844#endif /* _GVE_H_ */ |