linux/drivers/net/ethernet/aquantia/atlantic/aq_ring.h

/* SPDX-License-Identifier: GPL-2.0-only */
/* Atlantic Network Driver
 *
 * Copyright (C) 2014-2019 aQuantia Corporation
 * Copyright (C) 2019-2020 Marvell International Ltd.
 */

/* File aq_ring.h: Declaration of functions for Rx/Tx rings. */

#ifndef AQ_RING_H
#define AQ_RING_H

#include "aq_common.h"
#include "aq_vec.h"

#define AQ_XDP_HEADROOM
#define AQ_XDP_TAILROOM

struct page;
struct aq_nic_cfg_s;

struct aq_rxpage {};

/*           TxC       SOP        DX         EOP
 *         +----------+----------+----------+-----------
 *   8bytes|len l3,l4 | pa       | pa       | pa
 *         +----------+----------+----------+-----------
 * 4/8bytes|len pkt   |len pkt   |          | skb
 *         +----------+----------+----------+-----------
 * 4/8bytes|is_gso    |len,flags |len       |len,is_eop
 *         +----------+----------+----------+-----------
 *
 *  This aq_ring_buff_s doesn't have endianness dependency.
 *  It is __packed for cache line optimizations.
 */
struct __packed aq_ring_buff_s {};

struct aq_ring_stats_rx_s {};

struct aq_ring_stats_tx_s {};

aq_ring_stats_s;

enum atl_ring_type {};

struct aq_ring_s {};

struct aq_ring_param_s {};

static inline void *aq_buf_vaddr(struct aq_rxpage *rxpage)
{}

static inline dma_addr_t aq_buf_daddr(struct aq_rxpage *rxpage)
{}

static inline unsigned int aq_ring_next_dx(struct aq_ring_s *self,
					   unsigned int dx)
{}

static inline unsigned int aq_ring_avail_dx(struct aq_ring_s *self)
{}

int aq_ring_tx_alloc(struct aq_ring_s *self,
		     struct aq_nic_s *aq_nic,
		     unsigned int idx,
		     struct aq_nic_cfg_s *aq_nic_cfg);
int aq_ring_rx_alloc(struct aq_ring_s *self,
		     struct aq_nic_s *aq_nic,
		     unsigned int idx,
		     struct aq_nic_cfg_s *aq_nic_cfg);

int aq_ring_init(struct aq_ring_s *self, const enum atl_ring_type ring_type);
void aq_ring_rx_deinit(struct aq_ring_s *self);
void aq_ring_free(struct aq_ring_s *self);
void aq_ring_update_queue_state(struct aq_ring_s *ring);
void aq_ring_queue_wake(struct aq_ring_s *ring);
void aq_ring_queue_stop(struct aq_ring_s *ring);
bool aq_ring_tx_clean(struct aq_ring_s *self);
int aq_xdp_xmit(struct net_device *dev, int num_frames,
		struct xdp_frame **frames, u32 flags);
int aq_ring_rx_clean(struct aq_ring_s *self,
		     struct napi_struct *napi,
		     int *work_done,
		     int budget);
int aq_ring_rx_fill(struct aq_ring_s *self);

int aq_ring_hwts_rx_alloc(struct aq_ring_s *self,
			  struct aq_nic_s *aq_nic, unsigned int idx,
			  unsigned int size, unsigned int dx_size);
void aq_ring_hwts_rx_free(struct aq_ring_s *self);
void aq_ring_hwts_rx_clean(struct aq_ring_s *self, struct aq_nic_s *aq_nic);

unsigned int aq_ring_fill_stats_data(struct aq_ring_s *self, u64 *data);

#endif /* AQ_RING_H */