/* SPDX-License-Identifier: (GPL-2.0 OR MIT) * Google virtual Ethernet (gve) driver * * Copyright (C) 2015-2019 Google, Inc. */ /* GVE Transmit Descriptor formats */ #ifndef _GVE_DESC_H_ #define _GVE_DESC_H_ #include <linux/build_bug.h> /* A note on seg_addrs * * Base addresses encoded in seg_addr are not assumed to be physical * addresses. The ring format assumes these come from some linear address * space. This could be physical memory, kernel virtual memory, user virtual * memory. * If raw dma addressing is not supported then gVNIC uses lists of registered * pages. Each queue is assumed to be associated with a single such linear * address space to ensure a consistent meaning for seg_addrs posted to its * rings. */ struct gve_tx_pkt_desc { … } __packed; struct gve_tx_mtd_desc { … } __packed; struct gve_tx_seg_desc { … } __packed; /* GVE Transmit Descriptor Types */ #define GVE_TXD_STD … #define GVE_TXD_TSO … #define GVE_TXD_SEG … #define GVE_TXD_MTD … /* GVE Transmit Descriptor Flags for Std Pkts */ #define GVE_TXF_L4CSUM … #define GVE_TXF_TSTAMP … /* GVE Transmit Descriptor Flags for TSO Segs */ #define GVE_TXSF_IPV6 … /* GVE Transmit Descriptor Options for MTD Segs */ #define GVE_MTD_SUBTYPE_PATH … #define GVE_MTD_PATH_STATE_DEFAULT … #define GVE_MTD_PATH_STATE_TIMEOUT … #define GVE_MTD_PATH_STATE_CONGESTION … #define GVE_MTD_PATH_STATE_RETRANSMIT … #define GVE_MTD_PATH_HASH_NONE … #define GVE_MTD_PATH_HASH_L4 … /* GVE Receive Packet Descriptor */ /* The start of an ethernet packet comes 2 bytes into the rx buffer. * gVNIC adds this padding so that both the DMA and the L3/4 protocol header * access is aligned. */ #define GVE_RX_PAD … struct gve_rx_desc { … } __packed; static_assert(…); /* If the device supports raw dma addressing then the addr in data slot is * the dma address of the buffer. * If the device only supports registered segments then the addr is a byte * offset into the registered segment (an ordered list of pages) where the * buffer is. */ gve_rx_data_slot; /* GVE Receive Packet Descriptor Seq No */ #define GVE_SEQNO(x) … /* GVE Receive Packet Descriptor Flags */ #define GVE_RXFLG(x) … #define GVE_RXF_FRAG … #define GVE_RXF_IPV4 … #define GVE_RXF_IPV6 … #define GVE_RXF_TCP … #define GVE_RXF_UDP … #define GVE_RXF_ERR … #define GVE_RXF_PKT_CONT … /* GVE IRQ */ #define GVE_IRQ_ACK … #define GVE_IRQ_MASK … #define GVE_IRQ_EVENT … static inline bool gve_needs_rss(__be16 flag) { … } static inline u8 gve_next_seqno(u8 seq) { … } #endif /* _GVE_DESC_H_ */