|
#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 int | gve_reset (struct gve_nic *gve) |
| Reset hardware. 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, union gve_admin_command *cmd) |
| Construct command to create transmit queue. More...
|
|
static void | gve_create_rx_param (struct gve_queue *queue, 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_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 size_t | gve_address (struct gve_queue *queue, unsigned int index) |
| Get buffer address (within queue page list address space) More...
|
|
static userptr_t | gve_buffer (struct gve_queue *queue, unsigned int index) |
| Get buffer address. 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 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_admin_alloc |
( |
struct gve_nic * |
gve | ) |
|
|
static |
Allocate admin queue.
- Parameters
-
- Return values
-
Definition at line 191 of file gve.c.
200 size_t scratch_len =
sizeof ( *scratch->
buf );
205 if ( ! admin->
cmd ) {
219 if ( ! events->
event ) {
226 if ( ! scratch->
buf ) {
231 DBGC ( gve,
"GVE %p AQ at [%08lx,%08lx)\n",
struct dma_device * dma
DMA device.
struct arbelprm_rc_send_wqe rc
struct dma_mapping map
DMA mapping.
struct gve_event * event
Event counters.
union gve_scratch::@46 * buf
Buffer contents.
#define GVE_ALIGN
Address alignment.
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
#define GVE_EVENT_MAX
Maximum number of event counters.
#define ENOMEM
Not enough space.
void dma_free(struct dma_mapping *map, void *addr, size_t len)
Unmap and free DMA-coherent buffer.
struct dma_mapping map
DMA mapping.
struct gve_irqs irqs
Interrupt channels.
void * dma_alloc(struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align)
Allocate and map DMA-coherent buffer.
struct gve_events events
Event counters.
#define GVE_ADMIN_COUNT
Number of admin queue commands.
#define GVE_IRQ_COUNT
Number of interrupt channels.
Scratch buffer for admin queue commands.
struct dma_mapping map
DMA mapping.
struct gve_irq * irq
Interrupt channels.
union gve_admin_command * cmd
Commands.
struct dma_mapping map
DMA mapping.
static __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
struct gve_admin admin
Admin queue.
struct gve_scratch scratch
Scratch buffer.
References gve_nic::admin, gve_scratch::buf, gve_admin::cmd, DBGC, dma(), gve_nic::dma, dma_alloc(), dma_free(), ENOMEM, gve_events::event, gve_nic::events, GVE_ADMIN_COUNT, GVE_ALIGN, GVE_EVENT_MAX, GVE_IRQ_COUNT, gve_irqs::irq, gve_nic::irqs, gve_scratch::map, gve_admin::map, gve_events::map, gve_irqs::map, rc, gve_nic::scratch, and virt_to_phys().
Referenced by gve_probe().
Issue admin queue command.
- Parameters
-
- Return values
-
Definition at line 367 of file gve.c.
383 DBGC2 ( gve,
"GVE %p AQ %#02x command %#04x request:\n",
402 DBGC ( gve,
"GVE %p AQ %#02x command %#04x failed: %#08x\n",
409 DBGC2 ( gve,
"GVE %p AQ %#02x command %#04x result:\n",
struct arbelprm_rc_send_wqe rc
#define GVE_ADMIN_STATUS_OK
Command succeeded.
#define GVE_CFG_ADMIN_DB
Admin queue doorbell.
#define be32_to_cpu(value)
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
uint32_t prod
Producer counter.
void * cfg
Configuration registers.
char * strerror(int errno)
Retrieve string representation of error number.
#define EIO_ADMIN(status)
#define GVE_ADMIN_COUNT
Number of admin queue commands.
static int gve_admin_wait(struct gve_nic *gve)
Wait for admin queue command to complete.
union gve_admin_command * cmd
Commands.
struct gve_admin admin
Admin queue.
References gve_nic::admin, be32_to_cpu, bswap_32, gve_nic::cfg, cmd, gve_admin::cmd, DBGC, DBGC2, DBGC2_HDA, DBGC_HDA, EIO_ADMIN, GVE_ADMIN_COUNT, GVE_ADMIN_STATUS_OK, gve_admin_wait(), GVE_CFG_ADMIN_DB, index, opcode, gve_admin::prod, rc, status, strerror(), wmb(), and writel().
static int gve_describe |
( |
struct gve_nic * |
gve | ) |
|
|
static |
Get device descriptor.
- Parameters
-
- Return values
-
Definition at line 449 of file gve.c.
465 DBGC2 ( gve,
"GVE %p device descriptor:\n", gve );
474 DBGC ( gve,
"GVE %p using %d TX, %d RX, %d/%d events\n",
483 DBGC ( gve,
"GVE %p MAC %s (\"%s\") MTU %zd\n",
struct arbelprm_rc_send_wqe rc
#define GVE_ADMIN_DESCRIBE
Describe device command.
union gve_scratch::@46 * buf
Buffer contents.
struct gve_device_descriptor desc
Device descriptor.
size_t mtu
Maximum transmission unit length.
uint64_t desc
Microcode descriptor list physical address.
struct gve_queue rx
Receive queue.
struct gve_queue tx
Transmit queue.
#define GVE_EVENT_MAX
Maximum number of event counters.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct dma_mapping map
DMA mapping.
#define build_assert(condition)
Assert a condition at build time (after dead code elimination)
static struct net_device * netdev
#define be16_to_cpu(value)
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.
#define cpu_to_be32(value)
unsigned int count
Number of descriptors (must be a power of two)
struct gve_events events
Event counters.
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)
struct net_device * netdev
Network device.
#define GVE_ADMIN_DESCRIBE_VER
Device descriptor version.
size_t max_pkt_len
Maximum packet length.
static __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
struct gve_scratch scratch
Scratch buffer.
References be16_to_cpu, gve_scratch::buf, build_assert, cmd, gve_events::count, gve_queue::count, cpu_to_be32, cpu_to_be64, DBGC, DBGC2, DBGC2_HDA, desc, gve_scratch::desc, dma(), ETH_ALEN, ETH_HLEN, eth_ntoa(), gve_nic::events, gve_admin_command(), GVE_ADMIN_DESCRIBE, GVE_ADMIN_DESCRIBE_VER, GVE_EVENT_MAX, net_device::hw_addr, inet_ntoa(), gve_scratch::map, net_device::max_pkt_len, memcpy(), net_device::mtu, netdev, gve_nic::netdev, rc, gve_nic::rx, gve_nic::scratch, and gve_nic::tx.
Referenced by gve_setup().
static int gve_configure |
( |
struct gve_nic * |
gve | ) |
|
|
static |
Configure device resources.
- Parameters
-
- Return values
-
Definition at line 496 of file gve.c.
523 DBGC ( gve,
"GVE %p IRQ %d doorbell +%#04x\n", gve, i, db_off );
524 irqs->
db[i] = ( gve->
db + db_off );
struct arbelprm_rc_send_wqe rc
struct dma_mapping map
DMA mapping.
struct gve_event * event
Event counters.
#define GVE_IRQ_DISABLE
Disable interrupts.
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.
static __always_inline 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(), gve_events::event, gve_nic::events, gve_admin_command(), GVE_ADMIN_CONFIGURE, GVE_IRQ_COUNT, GVE_IRQ_DISABLE, gve_irqs::irq, gve_nic::irqs, gve_events::map, gve_irqs::map, rc, and writel().
Referenced by gve_start().
static int gve_register |
( |
struct gve_nic * |
gve, |
|
|
struct gve_qpl * |
qpl |
|
) |
| |
|
static |
Register queue page list.
- Parameters
-
gve | GVE device |
qpl | Queue page list |
- Return values
-
Definition at line 554 of file gve.c.
562 for ( i = 0 ; i < qpl->
count ; i++ ) {
#define GVE_PAGE_SIZE
Page size.
struct arbelprm_rc_send_wqe rc
union gve_scratch::@46 * buf
Buffer contents.
physaddr_t dma_phys(struct dma_mapping *map, physaddr_t addr)
Get DMA address from physical address.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
uint64_t addr[GVE_QPL_MAX]
Page address.
#define GVE_ADMIN_REGISTER
Register page list command.
struct dma_mapping map
Page mapping.
struct dma_mapping map
DMA mapping.
unsigned int count
Number of pages.
struct gve_pages pages
Page address list.
unsigned int id
Queue page list ID.
#define cpu_to_be32(value)
userptr_t data
Page addresses.
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 __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
struct gve_scratch scratch
Scratch buffer.
References addr, gve_pages::addr, gve_scratch::buf, cmd, gve_qpl::count, cpu_to_be32, cpu_to_be64, gve_qpl::data, dma(), dma_phys(), gve_admin_command(), GVE_ADMIN_REGISTER, GVE_PAGE_SIZE, gve_qpl::id, gve_scratch::map, gve_qpl::map, gve_scratch::pages, rc, gve_nic::scratch, and user_to_phys().
Referenced by gve_start().
Allocate descriptor queue.
- Parameters
-
gve | GVE device |
queue | Descriptor queue |
- Return values
-
Definition at line 817 of file gve.c.
820 size_t desc_len = (
queue->count *
type->desc_len );
821 size_t cmplt_len = (
queue->count *
type->cmplt_len );
822 size_t res_len =
sizeof ( *
queue->res );
829 if ( (
queue->count == 0 ) ||
831 DBGC ( gve,
"GVE %p %s invalid queue size %d\n",
842 DBGC ( gve,
"GVE %p %s using QPL %#08x with %d/%d descriptors\n",
847 queue->fill ) ) != 0 )
853 if ( !
queue->desc ) {
857 DBGC ( gve,
"GVE %p %s descriptors at [%08lx,%08lx)\n",
865 if ( !
queue->cmplt ) {
869 DBGC ( gve,
"GVE %p %s completions at [%08lx,%08lx)\n",
876 if ( !
queue->res ) {
884 for ( i = 0 ; i <
queue->count ; i++ ) {
#define EINVAL
Invalid argument.
struct dma_device * dma
DMA device.
struct arbelprm_rc_send_wqe rc
uint32_t type
Operating system type.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
#define GVE_ALIGN
Address alignment.
A transmit or receive buffer descriptor.
#define ENOMEM
Not enough space.
void dma_free(struct dma_mapping *map, void *addr, size_t len)
Unmap and free DMA-coherent buffer.
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.
static int gve_alloc_qpl(struct gve_nic *gve, struct gve_qpl *qpl, uint32_t id, unsigned int buffers)
Allocate queue page list.
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
static size_t gve_address(struct gve_queue *queue, unsigned int index)
Get buffer address (within queue page list address space)
void * dma_alloc(struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align)
Allocate and map DMA-coherent buffer.
void dma_ufree(struct dma_mapping *map, userptr_t addr, size_t len)
Unmap and free DMA-coherent buffer from external (user) memory.
#define cpu_to_be64(value)
userptr_t 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.
uint16_t offset
Offset to command line.
static __always_inline 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 gve_buffer::addr, assert(), copy_to_user(), cpu_to_be64, DBGC, dma(), gve_nic::dma, dma_alloc(), dma_free(), dma_ufree(), dma_umalloc(), EINVAL, ENOMEM, gve_address(), GVE_ALIGN, gve_alloc_qpl(), gve_free_qpl(), memset(), offset, queue, rc, type, and user_to_phys().
Referenced by gve_open().
static int gve_start |
( |
struct gve_nic * |
gve | ) |
|
|
static |
Start up device.
- Parameters
-
- Return values
-
Definition at line 937 of file gve.c.
946 for ( i = 0 ; i < (
sizeof ( gve->
tx_iobuf ) /
947 sizeof ( gve->
tx_iobuf[0] ) ) ; i++ ) {
966 goto err_register_tx;
970 goto err_register_rx;
struct arbelprm_rc_send_wqe rc
static int gve_destroy_queue(struct gve_nic *gve, struct gve_queue *queue)
Destroy transmit or receive queue.
static int gve_deconfigure(struct gve_nic *gve)
Deconfigure device resources.
static int gve_register(struct gve_nic *gve, struct gve_qpl *qpl)
Register queue page list.
struct gve_queue rx
Receive queue.
struct gve_queue tx
Transmit queue.
#define ECANCELED
Operation canceled.
void memset_user(userptr_t userptr, off_t offset, int c, size_t len)
Fill user buffer with a constant byte.
static struct net_device * netdev
static int gve_create_queue(struct gve_nic *gve, struct gve_queue *queue)
Create transmit or receive queue.
struct io_buffer * tx_iobuf[GVE_TX_FILL]
Transmit I/O buffers.
unsigned int seq
Receive sequence number.
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
static unsigned int gve_next(unsigned int seq)
Calculate next receive sequence number.
u8 rx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets from the AP.
static int gve_unregister(struct gve_nic *gve, struct gve_qpl *qpl)
Unregister page list.
struct net_device * netdev
Network device.
static int gve_configure(struct gve_nic *gve)
Configure device resources.
#define NULL
NULL pointer (VOID *)
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
References ECANCELED, gve_configure(), gve_create_queue(), gve_deconfigure(), gve_destroy_queue(), gve_next(), gve_register(), gve_unregister(), memset_user(), netdev, gve_nic::netdev, netdev_tx_complete_err(), NULL, rc, rx, gve_nic::rx, gve_nic::seq, tx, gve_nic::tx, and gve_nic::tx_iobuf.
Referenced by gve_startup().
Transmit packet.
- Parameters
-
netdev | Network device |
iobuf | I/O buffer |
- Return values
-
Definition at line 1175 of file gve.c.
1192 if ( ( (
tx->prod -
tx->cons ) +
count ) >
tx->fill ) {
1211 index = (
tx->prod++ & (
tx->count - 1 ) );
1222 sizeof (
desc.pkt ) );
1223 DBGC2 ( gve,
"GVE %p TX %#04x %#02x:%#02x len %#04x/%#04x at " #define cpu_to_be16(value)
void netdev_tx_defer(struct net_device *netdev, struct io_buffer *iobuf)
Defer transmitted packet.
uint64_t desc
Microcode descriptor list physical address.
A transmit or receive buffer descriptor.
#define GVE_TX_TYPE_CONT
Continuation of packet transmit descriptor type.
struct gve_queue tx
Transmit queue.
#define GVE_TX_FILL
Maximum number of transmit buffers.
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
#define be16_to_cpu(value)
uint16_t count
Number of entries.
#define GVE_TX_TYPE_START
Start of packet transmit descriptor type.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
A Google Virtual Ethernet NIC.
struct io_buffer * tx_iobuf[GVE_TX_FILL]
Transmit I/O buffers.
static size_t gve_address(struct gve_queue *queue, unsigned int index)
Get buffer address (within queue page list address space)
#define ENETDOWN
Network is down.
void * data
Start of data.
uint16_t offset
Offset to command line.
#define GVE_BUF_SIZE
Queue data buffer size.
#define NULL
NULL pointer (VOID *)
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
void * memset(void *dest, int character, size_t len) __nonnull
References assert(), be16_to_cpu, bswap_32, copy_to_user(), count, cpu_to_be16, io_buffer::data, DBGC2, desc, ENETDOWN, gve_address(), GVE_BUF_SIZE, GVE_TX_FILL, GVE_TX_TYPE_CONT, GVE_TX_TYPE_START, index, iob_len(), len, memset(), netdev, netdev_link_ok(), netdev_tx_defer(), NULL, offset, net_device::priv, tx, gve_nic::tx, gve_nic::tx_iobuf, wmb(), and writel().
static void gve_poll_rx |
( |
struct net_device * |
netdev | ) |
|
|
static |
Poll for received packets.
- Parameters
-
Definition at line 1271 of file gve.c.
1295 sizeof ( cmplt.pkt ) );
1304 DBGC2 ( gve,
"GVE %p RX %#04x %#02x:%#02x len %#04zx at " 1305 "%#08zx\n", gve,
index, cmplt.pkt.seq, cmplt.pkt.flags,
1320 for ( ;
rx->cons !=
cons ;
rx->cons++ ) {
1323 index = (
rx->cons & (
rx->count - 1 ) );
1327 sizeof ( cmplt.pkt.len ) );
#define iob_pull(iobuf, len)
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.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
#define GVE_RXF_MORE
Receive packet continues into next descriptor.
A receive completion descriptor.
#define offsetof(type, field)
Get offset of a field within a structure.
A transmit or receive buffer descriptor.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
struct gve_queue rx
Receive queue.
u16 seq
802.11 Sequence Control field
#define ENOMEM
Not enough space.
#define GVE_RX_SEQ_MASK
Receive sequence number mask.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
void * priv
Driver private data.
static struct net_device * netdev
#define be16_to_cpu(value)
uint16_t cons
Consumer index.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
A Google Virtual Ethernet NIC.
static size_t gve_address(struct gve_queue *queue, unsigned int index)
Get buffer address (within queue page list address space)
unsigned int seq
Receive sequence number.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
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.
uint16_t offset
Offset to command line.
typeof(acpi_finder=acpi_find)
ACPI table finder.
#define GVE_RXF_ERROR
Receive error.
#define NULL
NULL pointer (VOID *)
#define GVE_RX_PAD
Padding at the start of all received packets.
References alloc_iob(), assert(), be16_to_cpu, cons, copy_from_user(), DBGC2, EIO, ENOMEM, gve_rx_packet::flags, gve_address(), gve_next(), GVE_RX_PAD, GVE_RX_SEQ_MASK, GVE_RXF_ERROR, GVE_RXF_MORE, index, iob_len(), iob_pull, iob_put, len, gve_rx_packet::len, netdev, netdev_rx(), netdev_rx_err(), NULL, offset, offsetof, gve_rx_completion::pkt, net_device::priv, rc, rx, gve_nic::rx, seq, gve_rx_packet::seq, gve_nic::seq, and typeof().
Referenced by gve_poll().
Probe PCI device.
- Parameters
-
- Return values
-
Definition at line 1487 of file gve.c.
1490 unsigned long cfg_start;
1491 unsigned long db_start;
1492 unsigned long db_size;
1505 memset ( gve, 0,
sizeof ( *gve ) );
1517 DBGC ( gve,
"GVE %p is revision %#02x\n", gve, gve->
revision );
1551 goto err_register_netdev;
1556 err_register_netdev:
struct dma_device * dma
DMA device.
struct arbelprm_rc_send_wqe rc
struct dma_device dma
DMA device.
#define GVE_CFG_BAR
Configuration BAR.
static void process_init(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process and add to process list.
static int gve_admin_alloc(struct gve_nic *gve)
Allocate admin queue.
static __always_inline void dma_set_mask_64bit(struct dma_device *dma)
Set 64-bit addressable space mask.
struct dma_device * dma
DMA device.
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.
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.
A Google Virtual Ethernet NIC.
static void gve_watchdog(struct retry_timer *timer, int over __unused)
Reset recovery watchdog.
struct device * dev
Underlying hardware device.
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(), netdev, gve_nic::netdev, netdev_init(), netdev_nullify(), netdev_put(), NULL, pci_bar_size(), pci_bar_start(), pci_ioremap(), pci_read_config_byte(), PCI_REVISION, pci_set_drvdata(), net_device::priv, process_init(), rc, net_device::refcnt, register_netdev(), gve_nic::revision, gve_nic::rx, gve_nic::startup, gve_nic::tx, gve_queue::type, unregister_netdev(), and gve_nic::watchdog.