49#define EINFO_EIO_ADMIN_UNSET \
50 __einfo_uniqify ( EINFO_EIO, 0x00, "Uncompleted" )
51#define EIO_ADMIN_UNSET \
52 __einfo_error ( EINFO_EIO_ADMIN_UNSET )
53#define EINFO_EIO_ADMIN_ABORTED \
54 __einfo_uniqify ( EINFO_EIO, 0x10, "Aborted" )
55#define EIO_ADMIN_ABORTED \
56 __einfo_error ( EINFO_EIO_ADMIN_ABORTED )
57#define EINFO_EIO_ADMIN_EXISTS \
58 __einfo_uniqify ( EINFO_EIO, 0x11, "Already exists" )
59#define EIO_ADMIN_EXISTS \
60 __einfo_error ( EINFO_EIO_ADMIN_EXISTS )
61#define EINFO_EIO_ADMIN_CANCELLED \
62 __einfo_uniqify ( EINFO_EIO, 0x12, "Cancelled" )
63#define EIO_ADMIN_CANCELLED \
64 __einfo_error ( EINFO_EIO_ADMIN_CANCELLED )
65#define EINFO_EIO_ADMIN_DATALOSS \
66 __einfo_uniqify ( EINFO_EIO, 0x13, "Data loss" )
67#define EIO_ADMIN_DATALOSS \
68 __einfo_error ( EINFO_EIO_ADMIN_DATALOSS )
69#define EINFO_EIO_ADMIN_DEADLINE \
70 __einfo_uniqify ( EINFO_EIO, 0x14, "Deadline exceeded" )
71#define EIO_ADMIN_DEADLINE \
72 __einfo_error ( EINFO_EIO_ADMIN_DEADLINE )
73#define EINFO_EIO_ADMIN_PRECONDITION \
74 __einfo_uniqify ( EINFO_EIO, 0x15, "Failed precondition" )
75#define EIO_ADMIN_PRECONDITION \
76 __einfo_error ( EINFO_EIO_ADMIN_PRECONDITION )
77#define EINFO_EIO_ADMIN_INTERNAL \
78 __einfo_uniqify ( EINFO_EIO, 0x16, "Internal error" )
79#define EIO_ADMIN_INTERNAL \
80 __einfo_error ( EINFO_EIO_ADMIN_INTERNAL )
81#define EINFO_EIO_ADMIN_INVAL \
82 __einfo_uniqify ( EINFO_EIO, 0x17, "Invalid argument" )
83#define EIO_ADMIN_INVAL \
84 __einfo_error ( EINFO_EIO_ADMIN_INVAL )
85#define EINFO_EIO_ADMIN_NOT_FOUND \
86 __einfo_uniqify ( EINFO_EIO, 0x18, "Not found" )
87#define EIO_ADMIN_NOT_FOUND \
88 __einfo_error ( EINFO_EIO_ADMIN_NOT_FOUND )
89#define EINFO_EIO_ADMIN_RANGE \
90 __einfo_uniqify ( EINFO_EIO, 0x19, "Out of range" )
91#define EIO_ADMIN_RANGE \
92 __einfo_error ( EINFO_EIO_ADMIN_RANGE )
93#define EINFO_EIO_ADMIN_PERM \
94 __einfo_uniqify ( EINFO_EIO, 0x1a, "Permission denied" )
95#define EIO_ADMIN_PERM \
96 __einfo_error ( EINFO_EIO_ADMIN_PERM )
97#define EINFO_EIO_ADMIN_UNAUTH \
98 __einfo_uniqify ( EINFO_EIO, 0x1b, "Unauthenticated" )
99#define EIO_ADMIN_UNAUTH \
100 __einfo_error ( EINFO_EIO_ADMIN_UNAUTH )
101#define EINFO_EIO_ADMIN_RESOURCE \
102 __einfo_uniqify ( EINFO_EIO, 0x1c, "Resource exhausted" )
103#define EIO_ADMIN_RESOURCE \
104 __einfo_error ( EINFO_EIO_ADMIN_RESOURCE )
105#define EINFO_EIO_ADMIN_UNAVAIL \
106 __einfo_uniqify ( EINFO_EIO, 0x1d, "Unavailable" )
107#define EIO_ADMIN_UNAVAIL \
108 __einfo_error ( EINFO_EIO_ADMIN_UNAVAIL )
109#define EINFO_EIO_ADMIN_NOTSUP \
110 __einfo_uniqify ( EINFO_EIO, 0x1e, "Unimplemented" )
111#define EIO_ADMIN_NOTSUP \
112 __einfo_error ( EINFO_EIO_ADMIN_NOTSUP )
113#define EINFO_EIO_ADMIN_UNKNOWN \
114 __einfo_uniqify ( EINFO_EIO, 0x1f, "Unknown error" )
115#define EIO_ADMIN_UNKNOWN \
116 __einfo_error ( EINFO_EIO_ADMIN_UNKNOWN )
117#define EIO_ADMIN( status ) \
118 EUNIQ ( EINFO_EIO, ( (status) & 0x1f ), \
119 EIO_ADMIN_UNSET, EIO_ADMIN_ABORTED, EIO_ADMIN_EXISTS, \
120 EIO_ADMIN_CANCELLED, EIO_ADMIN_DATALOSS, \
121 EIO_ADMIN_DEADLINE, EIO_ADMIN_PRECONDITION, \
122 EIO_ADMIN_INTERNAL, EIO_ADMIN_INVAL, \
123 EIO_ADMIN_NOT_FOUND, EIO_ADMIN_RANGE, EIO_ADMIN_PERM, \
124 EIO_ADMIN_UNAUTH, EIO_ADMIN_RESOURCE, \
125 EIO_ADMIN_UNAVAIL, EIO_ADMIN_NOTSUP, EIO_ADMIN_UNKNOWN )
206 DBGC ( gve,
"GVE %p skipping reset\n", gve );
226 DBGC ( gve,
"GVE %p reset timed out (PFN %#08x devstat %#08x)\n",
246 static char buf[ 8 ];
248 snprintf ( buf,
sizeof ( buf ),
"%s-%s",
265 size_t scratch_len =
sizeof ( *scratch->
buf );
270 if ( ! admin->
cmd ) {
277 if ( ! scratch->
buf ) {
282 DBGC ( gve,
"GVE %p AQ at [%08lx,%08lx) scratch [%08lx,%08lx)\n",
283 gve, virt_to_phys ( admin->
cmd ),
284 ( virt_to_phys ( admin->
cmd ) + admin_len ),
285 virt_to_phys ( scratch->
buf ),
286 ( virt_to_phys ( scratch->
buf ) + scratch_len ) );
305 size_t scratch_len =
sizeof ( *scratch->
buf );
382 if ( evt == admin->
prod )
394 DBGC ( gve,
"GVE %p AQ %#02x %s (completed %#02x, status %#08x)\n",
395 gve, admin->
prod, ( pfn ?
"timed out" :
"saw reset" ), evt,
422 DBGC2 ( gve,
"GVE %p AQ %#02x command %#04x request:\n",
441 DBGC ( gve,
"GVE %p AQ %#02x command %#04x failed: %#08x\n",
448 DBGC2 ( gve,
"GVE %p AQ %#02x command %#04x result:\n",
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",
621 DBGC ( gve,
"GVE %p IRQ %d doorbell +%#04x\n", gve, i, db_off );
622 irqs->
db[i] = ( gve->
db + db_off );
664 for ( i = 0 ; i < qpl->
count ; i++ ) {
726 if (
queue->cmplt.raw ) {
728 queue->cmplt.raw ) );
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 );
874 DBGC ( gve,
"GVE %p IRQs at [%08lx,%08lx)\n",
875 gve, virt_to_phys ( irqs->
irq ),
876 ( virt_to_phys ( irqs->
irq ) + irqs_len ) );
880 if ( ! events->
event ) {
884 DBGC ( gve,
"GVE %p events at [%08lx,%08lx)\n",
885 gve, virt_to_phys ( events->
event ),
886 ( virt_to_phys ( events->
event ) + events_len ) );
925 uint32_t id,
unsigned int buffers ) {
944 DBGC ( gve,
"GVE %p QPL %#08x at [%08lx,%08lx)\n",
945 gve, qpl->
id, virt_to_phys ( qpl->
data ),
946 ( virt_to_phys ( qpl->
data ) +
len ) );
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 ) {
1089 size_t desc_len = (
queue->count *
stride->desc );
1090 size_t cmplt_len = (
queue->count *
stride->cmplt );
1091 size_t res_len =
sizeof ( *
queue->res );
1118 for ( i = 0 ; i < (
sizeof ( gve->
tx_iobuf ) /
1119 sizeof ( gve->
tx_iobuf[0] ) ) ; i++ ) {
1150 goto err_register_tx;
1154 goto err_register_rx;
1231 DBGC ( gve,
"GVE %p startup failed: %s\n", gve,
strerror (
rc ) );
1269 DBGC ( gve,
"GVE %p synthesising host reset\n", gve );
1283 DBGC2 ( gve,
"GVE %p idle but not in reset\n", gve );
1288 DBGC ( gve,
"GVE %p watchdog detected reset by host\n", gve );
1306 goto err_alloc_shared;
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 "
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",
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];
1698 unsigned int refill;
1713 while ( refill-- ) {
1716 index = (
rx->prod++ & (
rx->count - 1 ) );
1720 dqo = &
rx->desc.rx.dqo[
index];
1724 DBGC2 ( gve,
"GVE %p RXD %#04x:%#02x at %#08llx\n",
1726 ( (
unsigned long long )
1743 DBGC2 ( gve,
"GVE %p RXD %#04x ready\n", gve,
rx->prod );
1867 DBGC ( gve,
"GVE %p failed to get device description: %s\n",
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:
2007 PCI_ROM ( 0x1ae0, 0x0042,
"gve",
"gVNIC", 0 ),
#define NULL
NULL pointer (VOID *)
typeof(acpi_finder=acpi_find)
ACPI table finder.
struct arbelprm_rc_send_wqe rc
unsigned long long uint64_t
#define build_assert(condition)
Assert a condition at build time (after dead code elimination)
#define assert(condition)
Assert a condition at run-time.
struct bofm_section_header done
uint16_t offset
Offset to command line.
static union @024010030001061367220137227263210031030210157031 opts
"cert<xxx>" option list
uint32_t next
Next descriptor address.
uint32_t addr
Buffer address.
uint64_t tag
Identity tag.
uint8_t id
Request identifier.
uint32_t type
Operating system type.
struct ena_llq_option stride
Descriptor strides.
struct ena_llq_option desc
Descriptor counts.
uint16_t mode
Acceleration mode.
uint32_t doorbell
Doorbell register offset.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
static struct net_device * netdev
#define __unused
Declare a variable or data structure as unused.
static unsigned int count
Number of entries.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EINVAL
Invalid argument.
#define ETIMEDOUT
Connection timed out.
#define ENOMEM
Not enough space.
#define EIO
Input/output error.
#define ECANCELED
Operation canceled.
#define ENETDOWN
Network is down.
#define ENODEV
No such device.
#define ECONNRESET
Connection reset.
static void gve_free_queue(struct gve_nic *gve, struct gve_queue *queue)
Free descriptor queue.
static int gve_admin_wait(struct gve_nic *gve)
Wait for admin queue command to complete.
static void gve_close(struct net_device *netdev)
Close network device.
static void gve_remove(struct pci_device *pci)
Remove PCI device.
static void gve_startup(struct gve_nic *gve)
Device startup process.
static void gve_free_shared(struct gve_nic *gve)
Free shared queue resources.
static struct process_descriptor gve_startup_desc
Device startup process descriptor.
static unsigned int gve_next(unsigned int seq)
Calculate next receive sequence number.
static int gve_reset(struct gve_nic *gve)
Reset hardware.
static int gve_admin(struct gve_nic *gve)
Issue admin queue command.
static const char * gve_mode_name(unsigned int mode)
Get operating mode name (for debugging)
static void gve_restart(struct gve_nic *gve)
Trigger startup process.
static int gve_setup(struct gve_nic *gve)
Set up admin queue and get device description.
static int gve_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
static int gve_configure(struct gve_nic *gve)
Configure device resources.
static int gve_unregister(struct gve_nic *gve, struct gve_qpl *qpl)
Unregister page list.
static void gve_poll_tx(struct net_device *netdev)
Poll for completed transmissions.
static int gve_register(struct gve_nic *gve, struct gve_qpl *qpl)
Register queue page list.
static struct pci_device_id gve_nics[]
GVE PCI device IDs.
static void gve_cancel_tx(struct gve_nic *gve)
Cancel any pending transmissions.
static int gve_describe(struct gve_nic *gve)
Get device descriptor.
static const struct gve_queue_type gve_tx_type
Transmit descriptor queue type.
static size_t gve_offset(struct gve_queue *queue, unsigned int tag)
Get buffer offset (within queue page list allocation)
static int gve_alloc_shared(struct gve_nic *gve)
Allocate shared queue resources.
static int gve_admin_simple(struct gve_nic *gve, unsigned int opcode, unsigned int id)
Issue simple admin queue command.
static int gve_open(struct net_device *netdev)
Open network device.
static int gve_admin_alloc(struct gve_nic *gve)
Allocate admin queue.
static void gve_create_tx_param(struct gve_queue *queue, uint32_t qpl, union gve_admin_command *cmd)
Construct command to create transmit queue.
static int gve_start(struct gve_nic *gve)
Start up device.
static physaddr_t gve_address(struct gve_queue *queue, unsigned int tag)
Get buffer address (within queue page list address space)
static void gve_refill_rx(struct net_device *netdev)
Refill receive queue.
#define EIO_ADMIN(status)
static union gve_admin_command * gve_admin_command(struct gve_nic *gve)
Get next available admin queue command slot.
static struct net_device_operations gve_operations
GVE network device operations.
static void gve_admin_free(struct gve_nic *gve)
Free admin queue.
static void gve_create_rx_param(struct gve_queue *queue, uint32_t qpl, union gve_admin_command *cmd)
Construct command to create receive queue.
static int gve_probe(struct pci_device *pci)
Probe PCI device.
static int gve_create_queue(struct gve_nic *gve, struct gve_queue *queue)
Create transmit or receive queue.
static const struct gve_queue_type gve_rx_type
Receive descriptor queue type.
static void gve_poll_rx(struct net_device *netdev)
Poll for received packets.
static int gve_deconfigure(struct gve_nic *gve)
Deconfigure device resources.
static int gve_alloc_queue(struct gve_nic *gve, struct gve_queue *queue)
Allocate descriptor queue.
static void gve_admin_enable(struct gve_nic *gve)
Enable admin queue.
static int gve_destroy_queue(struct gve_nic *gve, struct gve_queue *queue)
Destroy transmit or receive queue.
static void * gve_buffer(struct gve_queue *queue, unsigned int tag)
Get buffer address.
static void gve_stop(struct gve_nic *gve)
Stop device.
static void gve_poll(struct net_device *netdev)
Poll for completed and received packets.
static void gve_watchdog(struct retry_timer *timer, int over __unused)
Reset recovery watchdog.
static int gve_alloc_qpl(struct gve_nic *gve, struct gve_qpl *qpl, uint32_t id, unsigned int buffers)
Allocate queue page list.
static void gve_free_qpl(struct gve_nic *nic __unused, struct gve_qpl *qpl)
Free queue page list.
Google Virtual Ethernet network driver.
#define GVE_OPT_DQO_QPL
Out-of-order descriptor queues with queue page list addressing.
#define GVE_GQI_RXF_ERROR
Receive error.
#define GVE_DQO_TXF_PKT
Transmit completion packet flag.
#define GVE_IRQ_COUNT
Number of interrupt channels.
#define GVE_CFG_ADMIN_PFN
Admin queue page frame number (for older devices)
#define GVE_DQO_TX_TYPE_LAST
Last transmit descriptor in a packet.
#define GVE_PAGE_SIZE
Page size.
#define GVE_DB_BAR
Doorbell BAR.
#define GVE_ADMIN_DESCRIBE_VER
Device descriptor version.
#define GVE_ADMIN_COUNT
Number of admin queue commands.
#define GVE_WATCHDOG_TIMEOUT
Time between reset recovery checks.
#define GVE_GQI_IRQ_DISABLE
Disable in-order queue interrupt.
#define GVE_DQO_RXL_GEN
Receive completion generation flag.
#define GVE_RX_IRQ
Receive queue interrupt channel.
#define GVE_CFG_SIZE
Configuration BAR size.
#define GVE_MODE_DQO
Use out-of-order queues.
#define GVE_RESET_MAX_RETRY
Maximum number of times to reattempt device reset.
#define GVE_BUF_SIZE
Queue data buffer size.
#define GVE_ALIGN
Address alignment.
#define GVE_DQO_IRQ_REARM
Rearm out-of-order queue interrupt.
#define GVE_RX_QPL
Receive queue page list ID.
#define GVE_CFG_DRVSTAT
Driver status.
#define GVE_CFG_DRVSTAT_RUN
Run admin queue.
#define GVE_ADMIN_CREATE_RX
Create receive queue command.
#define GVE_CFG_ADMIN_DB
Admin queue doorbell.
#define GVE_GQI_TX_TYPE_CONT
Continuation of packet transmit descriptor type.
#define GVE_TX_FILL
Maximum number of transmit buffers.
#define GVE_CFG_BAR
Configuration BAR.
#define GVE_ADMIN_DESTROY_TX
Destroy transmit queue command.
#define GVE_TX_QPL
Transmit queue page list ID.
#define GVE_GQI_RX_SEQ_MASK
Receive sequence number mask.
#define GVE_FORMAT(mode)
Descriptor queue format.
#define GVE_CFG_ADMIN_EVT
Admin queue event counter.
#define GVE_ADMIN_MAX_WAIT_MS
Maximum time to wait for admin queue commands.
#define GVE_CFG_ADMIN_LEN
Admin queue base address length (16-bit register)
#define GVE_DQO_TX_TYPE_PACKET
Normal packet transmit descriptor type.
#define GVE_ADMIN_CONFIGURE
Configure device resources command.
#define GVE_GQI_RX_PAD
Padding at the start of all received packets.
#define GVE_ADMIN_UNREGISTER
Unregister page list command.
#define GVE_RX_FILL
Maximum number of receive buffers.
#define GVE_ADMIN_DESTROY_RX
Destroy receive queue command.
#define GVE_ADMIN_CREATE_TX
Create transmit queue command.
#define GVE_BUF_PER_PAGE
Number of data buffers per page.
#define GVE_ADMIN_REGISTER
Register page list command.
#define GVE_MODE_QPL
Operating mode.
#define GVE_DQO_TXF_GEN
Transmit completion generation flag.
#define GVE_OPT_GQI_QPL
In-order descriptor queues with queue page list addressing.
#define GVE_CFG_DEVSTAT
Device status.
#define GVE_RESET_MAX_WAIT_MS
Maximum time to wait for reset.
#define GVE_ADMIN_DECONFIGURE
Deconfigure device resources command.
#define GVE_GQI_RXF_MORE
Receive packet continues into next descriptor.
#define GVE_TX_IRQ
Tranmsit queue interrupt channel.
#define GVE_OPT_DQO_RDA
Out-of-order descriptor queues with raw DMA addressing.
#define GVE_OPT_GQI_RDA
In-order descriptor queues with raw DMA addressing.
#define GVE_CFG_ADMIN_BASE_LO
Admin queue base address low 32 bits.
#define GVE_DQO_RXF_LAST
Last receive descriptor in a packet.
#define GVE_RAW_QPL
Raw DMA addressing queue page list ID.
#define GVE_GQI_TX_TYPE_START
Start of packet transmit descriptor type.
#define GVE_ADMIN_STATUS_OK
Command succeeded.
#define GVE_DQO_RXS_ERROR
Receive error.
#define GVE_CFG_ADMIN_BASE_HI
Admin queue base address high 32 bits.
#define GVE_ADMIN_DESCRIBE
Describe device command.
#define GVE_QPL_MAX
Maximum number of pages per queue.
u16 seq
802.11 Sequence Control field
#define be32_to_cpu(value)
#define cpu_to_be16(value)
#define cpu_to_le64(value)
#define le16_to_cpu(value)
#define le64_to_cpu(value)
#define cpu_to_be32(value)
#define cpu_to_le16(value)
#define cpu_to_be64(value)
#define be16_to_cpu(value)
static unsigned int unsigned int bit
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
void startup(void)
Start up iPXE.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define iob_put(iobuf, len)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_pull(iobuf, len)
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
static __always_inline void dma_set_mask_64bit(struct dma_device *dma)
Set 64-bit addressable space mask.
void dma_free(struct dma_mapping *map, void *addr, size_t len)
Unmap and free DMA-coherent buffer.
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 * 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 netdev_link_err(struct net_device *netdev, int rc)
Mark network device as having a specific link state.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
void netdev_tx_defer(struct net_device *netdev, struct io_buffer *iobuf)
Defer transmitted packet.
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
int register_netdev(struct net_device *netdev)
Register network device.
Network device management.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
unsigned long pci_bar_size(struct pci_device *pci, unsigned int reg)
Get the size of a PCI BAR.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
#define __pci_driver
Declare a PCI driver.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
#define PCI_REVISION
PCI revision.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
int pci_msix_enable(struct pci_device *pci, struct pci_msix *msix)
Enable MSI-X interrupts.
void pci_msix_disable(struct pci_device *pci, struct pci_msix *msix)
Disable MSI-X interrupts.
static void pci_msix_mask(struct pci_msix *msix, unsigned int vector)
Mask MSI-X interrupt vector.
static void pci_msix_unmask(struct pci_msix *msix, unsigned int vector)
Unmask MSI-X interrupt vector.
void process_del(struct process *process)
Remove process from process list.
void process_add(struct process *process)
Add process to process list.
#define PROC_DESC_ONCE(object_type, process, _step)
Define a process descriptor for a process that runs only once.
static void process_init_stopped(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process without adding to process list.
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
void stop_timer(struct retry_timer *timer)
Stop timer.
#define offsetof(type, field)
Get offset of a field within a structure.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
Create receive queue command.
Create transmit queue command.
uint32_t prod
Producer counter.
union gve_admin_command * cmd
Commands.
struct dma_mapping map
DMA mapping.
A transmit or receive buffer descriptor.
uint64_t addr
Address (within queue page list address space)
An out-of-order receive completion.
uint16_t len
Length and generation bit.
An out-of-order receive descriptor.
struct gve_buffer buf
Buffer descriptor.
An out-of-order transmit completion.
struct gve_dqo_tx_tag tag
Tag.
uint8_t flags
Completion flags.
An out-of-order transmit descriptor.
uint16_t len
Length of this descriptor.
struct gve_dqo_tx_tag tag
Tag.
struct gve_buffer buf
Buffer descriptor.
uint8_t type
Descriptor type and flags.
int8_t count
Number of descriptors covered by this completion.
uint8_t id
Buffer index within queue page list.
struct gve_event * event
Event counters.
struct dma_mapping map
DMA mapping.
unsigned int count
Actual number of event counters.
An in-order receive completion descriptor.
uint8_t seq
Sequence number.
An in-order receive descriptor.
An in-order transmit descriptor.
uint16_t total
Total length of this packet.
uint8_t count
Number of descriptors in this packet.
uint16_t len
Length of this descriptor.
uint32_t db_idx
Interrupt doorbell index (within doorbell BAR)
struct dma_mapping map
DMA mapping.
volatile uint32_t * db[GVE_IRQ_COUNT]
Interrupt doorbells.
struct gve_irq * irq
Interrupt channels.
A Google Virtual Ethernet NIC.
uint8_t revision
PCI revision.
uint32_t options
Supported options.
struct gve_scratch scratch
Scratch buffer.
unsigned int mode
Operating mode.
void * cfg
Configuration registers.
struct gve_queue tx
Transmit queue.
struct io_buffer * tx_iobuf[GVE_TX_FILL]
Transmit I/O buffers (indexed by tag)
void * db
Doorbell registers.
struct net_device * netdev
Network device.
unsigned int seq
Receive sequence number.
struct gve_events events
Event counters.
struct pci_msix msix
Dummy MSI-X interrupt.
struct gve_irqs irqs
Interrupt channels.
uint32_t activity
Reset recovery recorded activity counter.
uint8_t rx_tag[GVE_RX_FILL]
Receive tag ring.
uint8_t tx_chain[GVE_TX_FILL]
Transmit tag chain.
uint8_t tx_tag[GVE_TX_FILL]
Transmit tag ring.
struct gve_admin admin
Admin queue.
unsigned int retries
Startup process retry counter.
struct process startup
Startup process.
struct retry_timer watchdog
Reset recovery watchdog timer.
struct gve_queue rx
Receive queue.
struct dma_device * dma
DMA device.
uint16_t len
Length (excluding this header)
uint64_t addr[GVE_QPL_MAX]
Page address.
void * data
Page addresses.
struct dma_mapping map
Page mapping.
unsigned int count
Number of pages.
unsigned int id
Queue page list ID.
physaddr_t base
Queue page list base device address.
uint8_t create
Command to create queue.
uint32_t qpl
Queue page list ID.
const struct gve_queue_type * type
Queue type.
unsigned int count
Number of descriptors (must be a power of two)
uint32_t cons
Consumer counter.
Scratch buffer for admin queue commands.
struct dma_mapping map
DMA mapping.
union gve_scratch::@025171361064105355267231004351370162360052020120 * buf
Buffer contents.
struct gve_pages pages
Page address list.
struct gve_device_descriptor desc
Device descriptor.
void * data
Start of data.
Network device operations.
A PCI device ID list entry.
struct device dev
Generic device.
struct dma_device dma
DMA device.
int(* probe)(struct pci_device *pci)
Probe device.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
u8 rx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets from the AP.
static struct xen_remove_from_physmap * remove