|
| #define | EINFO_EIO_ADMIN_UNSET __einfo_uniqify ( EINFO_EIO, 0x00, "Uncompleted" ) |
| |
| #define | EIO_ADMIN_UNSET __einfo_error ( EINFO_EIO_ADMIN_UNSET ) |
| |
| #define | EINFO_EIO_ADMIN_ABORTED __einfo_uniqify ( EINFO_EIO, 0x10, "Aborted" ) |
| |
| #define | EIO_ADMIN_ABORTED __einfo_error ( EINFO_EIO_ADMIN_ABORTED ) |
| |
| #define | EINFO_EIO_ADMIN_EXISTS __einfo_uniqify ( EINFO_EIO, 0x11, "Already exists" ) |
| |
| #define | EIO_ADMIN_EXISTS __einfo_error ( EINFO_EIO_ADMIN_EXISTS ) |
| |
| #define | EINFO_EIO_ADMIN_CANCELLED __einfo_uniqify ( EINFO_EIO, 0x12, "Cancelled" ) |
| |
| #define | EIO_ADMIN_CANCELLED __einfo_error ( EINFO_EIO_ADMIN_CANCELLED ) |
| |
| #define | EINFO_EIO_ADMIN_DATALOSS __einfo_uniqify ( EINFO_EIO, 0x13, "Data loss" ) |
| |
| #define | EIO_ADMIN_DATALOSS __einfo_error ( EINFO_EIO_ADMIN_DATALOSS ) |
| |
| #define | EINFO_EIO_ADMIN_DEADLINE __einfo_uniqify ( EINFO_EIO, 0x14, "Deadline exceeded" ) |
| |
| #define | EIO_ADMIN_DEADLINE __einfo_error ( EINFO_EIO_ADMIN_DEADLINE ) |
| |
| #define | EINFO_EIO_ADMIN_PRECONDITION __einfo_uniqify ( EINFO_EIO, 0x15, "Failed precondition" ) |
| |
| #define | EIO_ADMIN_PRECONDITION __einfo_error ( EINFO_EIO_ADMIN_PRECONDITION ) |
| |
| #define | EINFO_EIO_ADMIN_INTERNAL __einfo_uniqify ( EINFO_EIO, 0x16, "Internal error" ) |
| |
| #define | EIO_ADMIN_INTERNAL __einfo_error ( EINFO_EIO_ADMIN_INTERNAL ) |
| |
| #define | EINFO_EIO_ADMIN_INVAL __einfo_uniqify ( EINFO_EIO, 0x17, "Invalid argument" ) |
| |
| #define | EIO_ADMIN_INVAL __einfo_error ( EINFO_EIO_ADMIN_INVAL ) |
| |
| #define | EINFO_EIO_ADMIN_NOT_FOUND __einfo_uniqify ( EINFO_EIO, 0x18, "Not found" ) |
| |
| #define | EIO_ADMIN_NOT_FOUND __einfo_error ( EINFO_EIO_ADMIN_NOT_FOUND ) |
| |
| #define | EINFO_EIO_ADMIN_RANGE __einfo_uniqify ( EINFO_EIO, 0x19, "Out of range" ) |
| |
| #define | EIO_ADMIN_RANGE __einfo_error ( EINFO_EIO_ADMIN_RANGE ) |
| |
| #define | EINFO_EIO_ADMIN_PERM __einfo_uniqify ( EINFO_EIO, 0x1a, "Permission denied" ) |
| |
| #define | EIO_ADMIN_PERM __einfo_error ( EINFO_EIO_ADMIN_PERM ) |
| |
| #define | EINFO_EIO_ADMIN_UNAUTH __einfo_uniqify ( EINFO_EIO, 0x1b, "Unauthenticated" ) |
| |
| #define | EIO_ADMIN_UNAUTH __einfo_error ( EINFO_EIO_ADMIN_UNAUTH ) |
| |
| #define | EINFO_EIO_ADMIN_RESOURCE __einfo_uniqify ( EINFO_EIO, 0x1c, "Resource exhausted" ) |
| |
| #define | EIO_ADMIN_RESOURCE __einfo_error ( EINFO_EIO_ADMIN_RESOURCE ) |
| |
| #define | EINFO_EIO_ADMIN_UNAVAIL __einfo_uniqify ( EINFO_EIO, 0x1d, "Unavailable" ) |
| |
| #define | EIO_ADMIN_UNAVAIL __einfo_error ( EINFO_EIO_ADMIN_UNAVAIL ) |
| |
| #define | EINFO_EIO_ADMIN_NOTSUP __einfo_uniqify ( EINFO_EIO, 0x1e, "Unimplemented" ) |
| |
| #define | EIO_ADMIN_NOTSUP __einfo_error ( EINFO_EIO_ADMIN_NOTSUP ) |
| |
| #define | EINFO_EIO_ADMIN_UNKNOWN __einfo_uniqify ( EINFO_EIO, 0x1f, "Unknown error" ) |
| |
| #define | EIO_ADMIN_UNKNOWN __einfo_error ( EINFO_EIO_ADMIN_UNKNOWN ) |
| |
| #define | EIO_ADMIN(status) |
| |
|
| | FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
| |
| static size_t | gve_offset (struct gve_queue *queue, unsigned int tag) |
| | Get buffer offset (within queue page list allocation) More...
|
| |
| static physaddr_t | gve_address (struct gve_queue *queue, unsigned int tag) |
| | Get buffer address (within queue page list address space) More...
|
| |
| static void * | gve_buffer (struct gve_queue *queue, unsigned int tag) |
| | Get buffer address. More...
|
| |
| static int | gve_reset (struct gve_nic *gve) |
| | Reset hardware. More...
|
| |
| static const char * | gve_mode_name (unsigned int mode) |
| | Get operating mode name (for debugging) More...
|
| |
| static int | gve_admin_alloc (struct gve_nic *gve) |
| | Allocate admin queue. More...
|
| |
| static void | gve_admin_free (struct gve_nic *gve) |
| | Free admin queue. More...
|
| |
| static void | gve_admin_enable (struct gve_nic *gve) |
| | Enable admin queue. More...
|
| |
| static union gve_admin_command * | gve_admin_command (struct gve_nic *gve) |
| | Get next available admin queue command slot. More...
|
| |
| static int | gve_admin_wait (struct gve_nic *gve) |
| | Wait for admin queue command to complete. More...
|
| |
| static int | gve_admin (struct gve_nic *gve) |
| | Issue admin queue command. More...
|
| |
| static int | gve_admin_simple (struct gve_nic *gve, unsigned int opcode, unsigned int id) |
| | Issue simple admin queue command. More...
|
| |
| static int | gve_describe (struct gve_nic *gve) |
| | Get device descriptor. More...
|
| |
| static int | gve_configure (struct gve_nic *gve) |
| | Configure device resources. More...
|
| |
| static int | gve_deconfigure (struct gve_nic *gve) |
| | Deconfigure device resources. More...
|
| |
| static int | gve_register (struct gve_nic *gve, struct gve_qpl *qpl) |
| | Register queue page list. More...
|
| |
| static int | gve_unregister (struct gve_nic *gve, struct gve_qpl *qpl) |
| | Unregister page list. More...
|
| |
| static void | gve_create_tx_param (struct gve_queue *queue, uint32_t qpl, union gve_admin_command *cmd) |
| | Construct command to create transmit queue. More...
|
| |
| static void | gve_create_rx_param (struct gve_queue *queue, uint32_t qpl, union gve_admin_command *cmd) |
| | Construct command to create receive queue. More...
|
| |
| static int | gve_create_queue (struct gve_nic *gve, struct gve_queue *queue) |
| | Create transmit or receive queue. More...
|
| |
| static int | gve_destroy_queue (struct gve_nic *gve, struct gve_queue *queue) |
| | Destroy transmit or receive queue. More...
|
| |
| static int | gve_alloc_shared (struct gve_nic *gve) |
| | Allocate shared queue resources. More...
|
| |
| static void | gve_free_shared (struct gve_nic *gve) |
| | Free shared queue resources. More...
|
| |
| static int | gve_alloc_qpl (struct gve_nic *gve, struct gve_qpl *qpl, uint32_t id, unsigned int buffers) |
| | Allocate queue page list. More...
|
| |
| static void | gve_free_qpl (struct gve_nic *nic __unused, struct gve_qpl *qpl) |
| | Free queue page list. More...
|
| |
| static unsigned int | gve_next (unsigned int seq) |
| | Calculate next receive sequence number. More...
|
| |
| static int | gve_alloc_queue (struct gve_nic *gve, struct gve_queue *queue) |
| | Allocate descriptor queue. More...
|
| |
| static void | gve_free_queue (struct gve_nic *gve, struct gve_queue *queue) |
| | Free descriptor queue. More...
|
| |
| static void | gve_cancel_tx (struct gve_nic *gve) |
| | Cancel any pending transmissions. More...
|
| |
| static int | gve_start (struct gve_nic *gve) |
| | Start up device. More...
|
| |
| static void | gve_stop (struct gve_nic *gve) |
| | Stop device. More...
|
| |
| static void | gve_startup (struct gve_nic *gve) |
| | Device startup process. More...
|
| |
| static void | gve_restart (struct gve_nic *gve) |
| | Trigger startup process. More...
|
| |
| static void | gve_watchdog (struct retry_timer *timer, int over __unused) |
| | Reset recovery watchdog. More...
|
| |
| static int | gve_open (struct net_device *netdev) |
| | Open network device. More...
|
| |
| static void | gve_close (struct net_device *netdev) |
| | Close network device. More...
|
| |
| static int | gve_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
| | Transmit packet. More...
|
| |
| static void | gve_poll_tx (struct net_device *netdev) |
| | Poll for completed transmissions. More...
|
| |
| static void | gve_poll_rx (struct net_device *netdev) |
| | Poll for received packets. More...
|
| |
| static void | gve_refill_rx (struct net_device *netdev) |
| | Refill receive queue. More...
|
| |
| static void | gve_poll (struct net_device *netdev) |
| | Poll for completed and received packets. More...
|
| |
| static int | gve_setup (struct gve_nic *gve) |
| | Set up admin queue and get device description. More...
|
| |
| static int | gve_probe (struct pci_device *pci) |
| | Probe PCI device. More...
|
| |
| static void | gve_remove (struct pci_device *pci) |
| | Remove PCI device. More...
|
| |
Google Virtual Ethernet network driver.
Definition in file gve.c.
| static int gve_describe |
( |
struct gve_nic * |
gve | ) |
|
|
static |
Get device descriptor.
- Parameters
-
- Return values
-
Definition at line 488 of file gve.c.
510 DBGC2 ( gve,
"GVE %p device descriptor:\n", gve );
517 DBGC ( gve,
"GVE %p using %d TX, %d RX, %d events\n",
525 DBGC ( gve,
"GVE %p MAC %s (\"%s\") MTU %zd\n",
537 if ( (
offset +
sizeof ( *opt ) ) >
max ) {
538 DBGC ( gve,
"GVE %p underlength option at +%#02zx:\n",
548 DBGC ( gve,
"GVE %p malformed option at +%#02zx:\n",
556 if (
id < ( 8 *
sizeof ( gve->
options ) ) )
559 DBGC ( gve,
"GVE %p supports options %#08x\n", gve, gve->
options );
578 DBGC ( gve,
"GVE %p using %s mode\n",
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
#define GVE_MODE_DQO
Use out-of-order queues.
#define GVE_ADMIN_DESCRIBE
Describe device command.
struct gve_device_descriptor desc
Device descriptor.
size_t mtu
Maximum transmission unit length.
#define offsetof(type, field)
Get offset of a field within a structure.
struct gve_queue rx
Receive queue.
unsigned int mode
Operating mode.
struct gve_queue tx
Transmit queue.
struct ena_llq_option desc
Descriptor counts.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint32_t options
Supported options.
struct dma_mapping map
DMA mapping.
#define GVE_OPT_GQI_QPL
In-order descriptor queues with queue page list addressing.
#define build_assert(condition)
Assert a condition at build time (after dead code elimination)
static struct net_device * netdev
#define be16_to_cpu(value)
#define GVE_OPT_DQO_QPL
Out-of-order descriptor queues with queue page list addressing.
static unsigned int count
Number of entries.
uint8_t id
Request identifier.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
uint16_t len
Length (excluding this header)
#define GVE_MODE_QPL
Operating mode.
static const char * gve_mode_name(unsigned int mode)
Get operating mode name (for debugging)
#define cpu_to_be32(value)
unsigned int count
Number of descriptors (must be a power of two)
struct gve_events events
Event counters.
union gve_scratch::@52 * buf
Buffer contents.
unsigned int count
Actual number of event counters.
static union gve_admin_command * gve_admin_command(struct gve_nic *gve)
Get next available admin queue command slot.
#define cpu_to_be64(value)
static union @447 opts
"cert<xxx>" option list
struct net_device * netdev
Network device.
typeof(acpi_finder=acpi_find)
ACPI table finder.
#define GVE_ADMIN_DESCRIBE_VER
Device descriptor version.
uint16_t offset
Offset to command line.
size_t max_pkt_len
Maximum packet length.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define GVE_OPT_DQO_RDA
Out-of-order descriptor queues with raw DMA addressing.
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
struct gve_scratch scratch
Scratch buffer.
#define GVE_OPT_GQI_RDA
In-order descriptor queues with raw DMA addressing.
References be16_to_cpu, gve_scratch::buf, build_assert, cmd, count, gve_events::count, gve_queue::count, cpu_to_be32, cpu_to_be64, DBGC, DBGC2, DBGC2_HDA, DBGC_HDA, desc, gve_scratch::desc, dma(), EINVAL, ETH_ALEN, ETH_HLEN, eth_ntoa(), gve_nic::events, gve_admin_command(), GVE_ADMIN_DESCRIBE, GVE_ADMIN_DESCRIBE_VER, GVE_MODE_DQO, gve_mode_name(), GVE_MODE_QPL, GVE_OPT_DQO_QPL, GVE_OPT_DQO_RDA, GVE_OPT_GQI_QPL, GVE_OPT_GQI_RDA, net_device::hw_addr, id, gve_option::id, inet_ntoa(), gve_option::len, len, gve_scratch::map, max, net_device::max_pkt_len, memcpy(), gve_nic::mode, net_device::mtu, netdev, gve_nic::netdev, offset, offsetof, gve_nic::options, opts, rc, gve_nic::rx, gve_nic::scratch, gve_nic::tx, and typeof().
Referenced by gve_setup().
| static int gve_configure |
( |
struct gve_nic * |
gve | ) |
|
|
static |
Configure device resources.
- Parameters
-
- Return values
-
Definition at line 590 of file gve.c.
621 DBGC ( gve,
"GVE %p IRQ %d doorbell +%#04x\n", gve, i, db_off );
622 irqs->
db[i] = ( gve->
db + db_off );
struct arbelprm_rc_send_wqe rc
#define GVE_MODE_DQO
Use out-of-order queues.
struct dma_mapping map
DMA mapping.
struct gve_event * event
Event counters.
#define GVE_GQI_IRQ_DISABLE
Disable in-order queue interrupt.
#define GVE_FORMAT(mode)
Descriptor queue format.
unsigned int mode
Operating mode.
void * db
Doorbell registers.
#define be32_to_cpu(value)
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
volatile uint32_t * db[GVE_IRQ_COUNT]
Interrupt doorbells.
struct gve_irqs irqs
Interrupt channels.
#define cpu_to_be32(value)
#define GVE_ADMIN_CONFIGURE
Configure device resources command.
struct gve_events events
Event counters.
#define GVE_IRQ_COUNT
Number of interrupt channels.
unsigned int count
Actual number of event counters.
static union gve_admin_command * gve_admin_command(struct gve_nic *gve)
Get next available admin queue command slot.
#define cpu_to_be64(value)
uint32_t db_idx
Interrupt doorbell index (within doorbell BAR)
struct dma_mapping map
DMA mapping.
struct gve_irq * irq
Interrupt channels.
uint32_t doorbell
Doorbell register offset.
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
References be32_to_cpu, bswap_32, cmd, gve_events::count, cpu_to_be32, cpu_to_be64, gve_irqs::db, gve_nic::db, gve_irq::db_idx, DBGC, dma(), doorbell, gve_events::event, gve_nic::events, gve_admin_command(), GVE_ADMIN_CONFIGURE, GVE_FORMAT, GVE_GQI_IRQ_DISABLE, GVE_IRQ_COUNT, GVE_MODE_DQO, gve_irqs::irq, gve_nic::irqs, gve_events::map, gve_irqs::map, gve_nic::mode, rc, and writel().
Referenced by gve_start().
Create transmit or receive queue.
- Parameters
-
| gve | GVE device |
| queue | Descriptor queue |
- Return values
-
Definition at line 765 of file gve.c.
771 unsigned int evt_idx;
783 for ( i = 0 ; i <
queue->fill ; i++ )
788 buf = (
queue->desc.raw +
stride->desc -
sizeof ( *buf ) );
789 for ( i = 0 ; i <
queue->count ; i++ ) {
792 buf = ( ( (
void * ) buf ) +
stride->desc );
798 cmd->hdr.opcode =
type->create;
809 DBGC ( gve,
"GVE %p %s doorbell +%#04x event counter %d\n",
810 gve,
type->name, db_off, evt_idx );
811 queue->db = ( gve->
db + db_off );
812 assert ( evt_idx < gve->events.count );
struct arbelprm_rc_send_wqe rc
#define GVE_MODE_DQO
Use out-of-order queues.
#define GVE_DQO_IRQ_REARM
Rearm out-of-order queue interrupt.
struct gve_event * event
Event counters.
uint32_t type
Operating system type.
A transmit or receive buffer descriptor.
unsigned int mode
Operating mode.
void * db
Doorbell registers.
#define be32_to_cpu(value)
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
volatile uint32_t * db[GVE_IRQ_COUNT]
Interrupt doorbells.
static void pci_msix_unmask(struct pci_msix *msix, unsigned int vector)
Unmask MSI-X interrupt vector.
struct gve_irqs irqs
Interrupt channels.
struct ena_llq_option stride
Descriptor strides.
struct pci_msix msix
Dummy MSI-X interrupt.
static physaddr_t gve_address(struct gve_queue *queue, unsigned int tag)
Get buffer address (within queue page list address space)
#define GVE_MODE_QPL
Operating mode.
struct gve_events events
Event counters.
uint64_t addr
Address (within queue page list address space)
#define GVE_RAW_QPL
Raw DMA addressing queue page list ID.
static union gve_admin_command * gve_admin_command(struct gve_nic *gve)
Get next available admin queue command slot.
#define cpu_to_be64(value)
uint64_t tag
Identity tag.
if(natsemi->flags &NATSEMI_64BIT) return 1
void * memset(void *dest, int character, size_t len) __nonnull
References gve_buffer::addr, assert(), be32_to_cpu, cmd, cpu_to_be64, gve_irqs::db, gve_nic::db, DBGC, gve_events::event, gve_nic::events, gve_address(), gve_admin_command(), GVE_DQO_IRQ_REARM, GVE_MODE_DQO, GVE_MODE_QPL, GVE_RAW_QPL, if(), gve_nic::irqs, memset(), gve_nic::mode, gve_nic::msix, pci_msix_unmask(), queue, rc, stride, tag, type, and writel().
Referenced by gve_start().
Allocate descriptor queue.
- Parameters
-
| gve | GVE device |
| queue | Descriptor queue |
- Return values
-
Definition at line 996 of file gve.c.
1006 if ( (
queue->count == 0 ) ||
1008 DBGC ( gve,
"GVE %p %s invalid queue size %d\n",
1016 type->stride.dqo :
type->stride.gqi );
1019 res_len =
sizeof ( *
queue->res );
1026 DBGC ( gve,
"GVE %p %s using QPL %#08x with %d/%d descriptors\n",
1031 queue->fill ) ) != 0 )
1037 if ( !
queue->desc.raw ) {
1041 DBGC ( gve,
"GVE %p %s descriptors at [%08lx,%08lx)\n",
1042 gve,
type->name, virt_to_phys (
queue->desc.raw ),
1043 ( virt_to_phys (
queue->desc.raw ) + desc_len ) );
1049 if ( !
queue->cmplt.raw ) {
1053 DBGC ( gve,
"GVE %p %s completions at [%08lx,%08lx)\n",
1054 gve,
type->name, virt_to_phys (
queue->cmplt.raw ),
1055 ( virt_to_phys (
queue->cmplt.raw ) + cmplt_len ) );
1060 if ( !
queue->res ) {
#define EINVAL
Invalid argument.
struct dma_device * dma
DMA device.
struct arbelprm_rc_send_wqe rc
#define GVE_MODE_DQO
Use out-of-order queues.
uint32_t type
Operating system type.
#define GVE_ALIGN
Address alignment.
unsigned int mode
Operating mode.
void dma_free(struct dma_mapping *map, void *addr, size_t len)
Unmap and free DMA-coherent buffer.
#define ENOMEM
Not enough space.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void gve_free_qpl(struct gve_nic *nic __unused, struct gve_qpl *qpl)
Free queue page list.
struct ena_llq_option stride
Descriptor strides.
static int gve_alloc_qpl(struct gve_nic *gve, struct gve_qpl *qpl, uint32_t id, unsigned int buffers)
Allocate queue page list.
void * dma_umalloc(struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align)
Allocate and map DMA-coherent buffer from external (user) memory.
void dma_ufree(struct dma_mapping *map, void *addr, size_t len)
Unmap and free DMA-coherent buffer from external (user) memory.
void * dma_alloc(struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align)
Allocate and map DMA-coherent buffer.
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
void * memset(void *dest, int character, size_t len) __nonnull
References assert(), DBGC, dma(), gve_nic::dma, dma_alloc(), dma_free(), dma_ufree(), dma_umalloc(), EINVAL, ENOMEM, GVE_ALIGN, gve_alloc_qpl(), gve_free_qpl(), GVE_MODE_DQO, memset(), gve_nic::mode, queue, rc, stride, and type.
Referenced by gve_open().
Transmit packet.
- Parameters
-
| netdev | Network device |
| iobuf | I/O buffer |
- Return values
-
Definition at line 1371 of file gve.c.
1393 if ( ( (
tx->prod -
tx->cons ) +
count ) >
tx->fill ) {
1402 index = (
tx->prod++ & (
tx->count - 1 ) );
1420 dqo = &
tx->desc.tx.dqo[
index];
1439 gqi = &
tx->desc.tx.gqi[
index];
1452 DBGC2 ( gve,
"GVE %p TXD %#04x %#02x:%#02x len %#04zx/%#04zx " #define cpu_to_be16(value)
#define GVE_GQI_TX_TYPE_CONT
Continuation of packet transmit descriptor type.
void netdev_tx_defer(struct net_device *netdev, struct io_buffer *iobuf)
Defer transmitted packet.
#define GVE_MODE_DQO
Use out-of-order queues.
uint16_t len
Length of this descriptor.
uint16_t total
Total length of this packet.
uint16_t len
Length of this descriptor.
#define cpu_to_le64(value)
A transmit or receive buffer descriptor.
#define GVE_GQI_TX_TYPE_START
Start of packet transmit descriptor type.
uint8_t type
Descriptor type and flags.
struct gve_dqo_tx_tag tag
Tag.
unsigned int mode
Operating mode.
struct gve_queue tx
Transmit queue.
#define GVE_TX_FILL
Maximum number of transmit buffers.
#define GVE_DQO_TX_TYPE_LAST
Last transmit descriptor in a packet.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
void * priv
Driver private data.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
static struct net_device * netdev
static unsigned int count
Number of entries.
uint8_t count
Number of descriptors in this packet.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
A Google Virtual Ethernet NIC.
struct io_buffer * tx_iobuf[GVE_TX_FILL]
Transmit I/O buffers (indexed by tag)
uint32_t next
Next descriptor address.
static physaddr_t gve_address(struct gve_queue *queue, unsigned int tag)
Get buffer address (within queue page list address space)
#define ENETDOWN
Network is down.
An out-of-order transmit descriptor.
An in-order transmit descriptor.
int8_t count
Number of descriptors covered by this completion.
uint64_t addr
Address (within queue page list address space)
uint8_t tx_chain[GVE_TX_FILL]
Transmit tag chain.
void * data
Start of data.
#define cpu_to_le16(value)
#define GVE_DQO_TX_TYPE_PACKET
Normal packet transmit descriptor type.
#define GVE_BUF_SIZE
Queue data buffer size.
uint16_t offset
Offset to command line.
uint64_t tag
Identity tag.
#define NULL
NULL pointer (VOID *)
uint32_t doorbell
Doorbell register offset.
struct gve_buffer buf
Buffer descriptor.
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
uint8_t id
Buffer index within queue page list.
References gve_buffer::addr, assert(), bswap_32, gve_dqo_tx_descriptor::buf, count, gve_gqi_tx_descriptor::count, gve_dqo_tx_tag::count, cpu_to_be16, cpu_to_le16, cpu_to_le64, io_buffer::data, DBGC2, doorbell, ENETDOWN, gve_address(), GVE_BUF_SIZE, GVE_DQO_TX_TYPE_LAST, GVE_DQO_TX_TYPE_PACKET, GVE_GQI_TX_TYPE_CONT, GVE_GQI_TX_TYPE_START, GVE_MODE_DQO, GVE_TX_FILL, gve_dqo_tx_tag::id, index, iob_len(), len, gve_gqi_tx_descriptor::len, gve_dqo_tx_descriptor::len, memcpy(), gve_nic::mode, netdev, netdev_link_ok(), netdev_tx_defer(), next, NULL, offset, net_device::priv, tag, gve_dqo_tx_descriptor::tag, gve_gqi_tx_descriptor::total, tx, gve_nic::tx, gve_nic::tx_chain, gve_nic::tx_iobuf, gve_gqi_tx_descriptor::type, gve_dqo_tx_descriptor::type, wmb(), and writel().
| static void gve_poll_tx |
( |
struct net_device * |
netdev | ) |
|
|
static |
Poll for completed transmissions.
- Parameters
-
Definition at line 1482 of file gve.c.
1500 gen = (
tx->done &
tx->count );
1501 index = (
tx->done & (
tx->count - 1 ) );
1502 dqo = &
tx->cmplt.tx.dqo[
index];
1506 if ( ( !!
bit ) == ( !! gen ) )
1514 DBGC2 ( gve,
"GVE %p TXC %#04x flags %#02x " 1528 DBGC2 ( gve,
"GVE %p TXC %#04x %#02x:%#02x " 1547 DBGC2 ( gve,
"GVE %p TXC %#04x complete\n",
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
#define GVE_MODE_DQO
Use out-of-order queues.
struct gve_dqo_tx_tag tag
Tag.
uint8_t flags
Completion flags.
static unsigned int unsigned int bit
unsigned int mode
Operating mode.
struct gve_queue tx
Transmit queue.
#define GVE_TX_FILL
Maximum number of transmit buffers.
#define be32_to_cpu(value)
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
void * priv
Driver private data.
static struct net_device * netdev
static unsigned int count
Number of entries.
#define GVE_DQO_TXF_GEN
Transmit completion generation flag.
A Google Virtual Ethernet NIC.
struct io_buffer * tx_iobuf[GVE_TX_FILL]
Transmit I/O buffers (indexed by tag)
int8_t count
Number of descriptors covered by this completion.
uint8_t tx_chain[GVE_TX_FILL]
Transmit tag chain.
An out-of-order transmit completion.
uint64_t tag
Identity tag.
#define NULL
NULL pointer (VOID *)
#define GVE_DQO_TXF_PKT
Transmit completion packet flag.
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
uint8_t id
Buffer index within queue page list.
References assert(), be32_to_cpu, bit, count, gve_dqo_tx_tag::count, DBGC2, gve_dqo_tx_completion::flags, GVE_DQO_TXF_GEN, GVE_DQO_TXF_PKT, GVE_MODE_DQO, GVE_TX_FILL, gve_dqo_tx_tag::id, index, gve_nic::mode, netdev, netdev_tx_complete(), NULL, net_device::priv, rmb, tag, gve_dqo_tx_completion::tag, tx, gve_nic::tx, gve_nic::tx_chain, and gve_nic::tx_iobuf.
Referenced by gve_poll().
| static void gve_poll_rx |
( |
struct net_device * |
netdev | ) |
|
|
static |
Poll for received packets.
- Parameters
-
Definition at line 1564 of file gve.c.
1588 gen = (
done &
rx->count );
1593 dqo = &
rx->cmplt.rx.dqo[
index];
1597 if ( ( !!
bit ) == ( !! gen ) )
1605 DBGC2 ( gve,
"GVE %p RXC %#04x %#02x:%#02x len %#04zx " 1622 gqi = &
rx->cmplt.rx.gqi[
index];
1633 DBGC2 ( gve,
"GVE %p RXC %#04x %#02x:%#02x len %#04zx " 1634 "at %#08zx\n", gve,
index, gqi->
seq,
1651 for ( ;
rx->done !=
done ;
rx->done++ ) {
1654 index = (
rx->done & (
rx->count - 1 ) );
1656 dqo = &
rx->cmplt.rx.dqo[
index];
1662 gqi = &
rx->cmplt.rx.gqi[
index];
#define iob_pull(iobuf, len)
#define GVE_GQI_RX_SEQ_MASK
Receive sequence number mask.
struct arbelprm_rc_send_wqe rc
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
uint16_t len
Length and generation bit.
#define GVE_MODE_DQO
Use out-of-order queues.
#define GVE_GQI_RXF_MORE
Receive packet continues into next descriptor.
#define GVE_DQO_RXS_ERROR
Receive error.
uint8_t seq
Sequence number.
static unsigned int unsigned int bit
A transmit or receive buffer descriptor.
static size_t gve_offset(struct gve_queue *queue, unsigned int tag)
Get buffer offset (within queue page list allocation)
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
struct gve_queue rx
Receive queue.
unsigned int mode
Operating mode.
u16 seq
802.11 Sequence Control field
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define GVE_GQI_RXF_ERROR
Receive error.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define GVE_RX_FILL
Maximum number of receive buffers.
void * priv
Driver private data.
static struct net_device * netdev
#define be16_to_cpu(value)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
A Google Virtual Ethernet NIC.
#define le16_to_cpu(value)
#define GVE_DQO_RXL_GEN
Receive completion generation flag.
unsigned int seq
Receive sequence number.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
An in-order receive completion descriptor.
static unsigned int gve_next(unsigned int seq)
Calculate next receive sequence number.
#define EIO
Input/output error.
u8 rx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets from the AP.
#define cpu_to_le16(value)
#define GVE_BUF_SIZE
Queue data buffer size.
#define GVE_DQO_RXF_LAST
Last receive descriptor in a packet.
uint64_t tag
Identity tag.
An out-of-order receive completion.
#define GVE_GQI_RX_PAD
Padding at the start of all received packets.
#define NULL
NULL pointer (VOID *)
struct bofm_section_header done
References alloc_iob(), assert(), be16_to_cpu, bit, cpu_to_le16, DBGC2, done, EIO, ENOMEM, gve_gqi_rx_completion::flags, gve_dqo_rx_completion::flags, GVE_BUF_SIZE, GVE_DQO_RXF_LAST, GVE_DQO_RXL_GEN, GVE_DQO_RXS_ERROR, GVE_GQI_RX_PAD, GVE_GQI_RX_SEQ_MASK, GVE_GQI_RXF_ERROR, GVE_GQI_RXF_MORE, GVE_MODE_DQO, gve_next(), gve_offset(), GVE_RX_FILL, index, iob_len(), iob_pull, iob_put, le16_to_cpu, len, gve_gqi_rx_completion::len, gve_dqo_rx_completion::len, memcpy(), gve_nic::mode, netdev, netdev_rx(), netdev_rx_err(), NULL, net_device::priv, rc, rmb, rx, gve_nic::rx, seq, gve_gqi_rx_completion::seq, gve_nic::seq, gve_dqo_rx_completion::status, tag, and gve_dqo_rx_completion::tag.
Referenced by gve_poll().
Probe PCI device.
- Parameters
-
- Return values
-
Definition at line 1882 of file gve.c.
1885 unsigned long cfg_start;
1886 unsigned long db_start;
1887 unsigned long db_size;
1900 memset ( gve, 0,
sizeof ( *gve ) );
1915 DBGC ( gve,
"GVE %p is revision %#02x\n", gve, gve->
revision );
1953 goto err_register_netdev;
1958 err_register_netdev:
struct dma_device * dma
DMA device.
struct arbelprm_rc_send_wqe rc
void pci_msix_disable(struct pci_device *pci, struct pci_msix *msix)
Disable MSI-X interrupts.
struct dma_device dma
DMA device.
#define GVE_CFG_BAR
Configuration BAR.
static int gve_admin_alloc(struct gve_nic *gve)
Allocate admin queue.
unsigned long pci_bar_size(struct pci_device *pci, unsigned int reg)
Get the size of a PCI BAR.
static __always_inline void dma_set_mask_64bit(struct dma_device *dma)
Set 64-bit addressable space mask.
struct dma_device * dma
DMA device.
uint8_t rx_tag[GVE_RX_FILL]
Receive tag ring.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct gve_queue rx
Receive queue.
struct device dev
Generic device.
static struct net_device_operations gve_operations
GVE network device operations.
struct gve_queue tx
Transmit queue.
static const struct gve_queue_type gve_tx_type
Transmit descriptor queue type.
#define GVE_DB_BAR
Doorbell BAR.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
void * db
Doorbell registers.
struct retry_timer watchdog
Reset recovery watchdog timer.
struct process startup
Startup process.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
void * priv
Driver private data.
static int gve_reset(struct gve_nic *gve)
Reset hardware.
static struct net_device * netdev
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
void * cfg
Configuration registers.
struct refcnt refcnt
Reference counter.
struct pci_msix msix
Dummy MSI-X interrupt.
int register_netdev(struct net_device *netdev)
Register network device.
#define ENODEV
No such device.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
uint8_t tx_tag[GVE_TX_FILL]
Transmit tag ring.
A Google Virtual Ethernet NIC.
static void gve_watchdog(struct retry_timer *timer, int over __unused)
Reset recovery watchdog.
static void process_init_stopped(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process without adding to process list.
struct device * dev
Underlying hardware device.
int pci_msix_enable(struct pci_device *pci, struct pci_msix *msix)
Enable MSI-X interrupts.
uint8_t revision
PCI revision.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
#define PCI_REVISION
PCI revision.
static const struct gve_queue_type gve_rx_type
Receive descriptor queue type.
struct net_device * netdev
Network device.
static void gve_admin_free(struct gve_nic *gve)
Free admin queue.
static int gve_setup(struct gve_nic *gve)
Set up admin queue and get device description.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
const struct gve_queue_type * type
Queue type.
#define NULL
NULL pointer (VOID *)
static struct process_descriptor gve_startup_desc
Device startup process descriptor.
#define GVE_CFG_SIZE
Configuration BAR size.
void * memset(void *dest, int character, size_t len) __nonnull
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
References adjust_pci_device(), alloc_etherdev(), assert(), gve_nic::cfg, gve_nic::db, DBGC, pci_device::dev, net_device::dev, pci_device::dma, net_device::dma, gve_nic::dma, dma_set_mask_64bit(), ENODEV, ENOMEM, gve_admin_alloc(), gve_admin_free(), GVE_CFG_BAR, GVE_CFG_SIZE, GVE_DB_BAR, gve_operations, gve_reset(), gve_rx_type, gve_setup(), gve_startup_desc, gve_tx_type, gve_watchdog(), iounmap(), memset(), gve_nic::msix, netdev, gve_nic::netdev, netdev_init(), netdev_nullify(), netdev_put(), NULL, pci_bar_size(), pci_bar_start(), pci_ioremap(), pci_msix_disable(), pci_msix_enable(), pci_read_config_byte(), PCI_REVISION, pci_set_drvdata(), net_device::priv, process_init_stopped(), rc, net_device::refcnt, register_netdev(), gve_nic::revision, gve_nic::rx, gve_nic::rx_tag, gve_nic::startup, gve_queue::tag, gve_nic::tx, gve_nic::tx_tag, gve_queue::type, unregister_netdev(), and gve_nic::watchdog.