123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
#ifndef _OCTEP_VF_RX_H_
#define _OCTEP_VF_RX_H_
struct octep_vf_oq_desc_hw {
dma_addr_t buffer_ptr;
u64 info_ptr;
};
static_assert(sizeof(struct octep_vf_oq_desc_hw) == 16);
#define OCTEP_VF_OQ_DESC_SIZE (sizeof(struct octep_vf_oq_desc_hw))
#define OCTEP_VF_RX_OFFLOAD_VLAN_STRIP BIT(0)
#define OCTEP_VF_RX_OFFLOAD_IPV4_CKSUM BIT(1)
#define OCTEP_VF_RX_OFFLOAD_UDP_CKSUM BIT(2)
#define OCTEP_VF_RX_OFFLOAD_TCP_CKSUM BIT(3)
#define OCTEP_VF_RX_OFFLOAD_CKSUM (OCTEP_VF_RX_OFFLOAD_IPV4_CKSUM | \
OCTEP_VF_RX_OFFLOAD_UDP_CKSUM | \
OCTEP_VF_RX_OFFLOAD_TCP_CKSUM)
#define OCTEP_VF_RX_IP_CSUM(flags) ((flags) & \
(OCTEP_VF_RX_OFFLOAD_IPV4_CKSUM | \
OCTEP_VF_RX_OFFLOAD_TCP_CKSUM | \
OCTEP_VF_RX_OFFLOAD_UDP_CKSUM))
#define OCTEP_VF_RX_CSUM_IP_VERIFIED BIT(1)
#define OCTEP_VF_RX_CSUM_L4_VERIFIED BIT(2)
#define OCTEP_VF_RX_CSUM_VERIFIED(flags) ((flags) & \
(OCTEP_VF_RX_CSUM_L4_VERIFIED | \
OCTEP_VF_RX_CSUM_IP_VERIFIED))
struct octep_vf_oq_resp_hw_ext {
u64 rsvd:48;
u16 rx_ol_flags;
};
static_assert(sizeof(struct octep_vf_oq_resp_hw_ext) == 8);
#define OCTEP_VF_OQ_RESP_HW_EXT_SIZE (sizeof(struct octep_vf_oq_resp_hw_ext))
struct octep_vf_oq_resp_hw {
__be64 length;
};
static_assert(sizeof(struct octep_vf_oq_resp_hw) == 8);
#define OCTEP_VF_OQ_RESP_HW_SIZE (sizeof(struct octep_vf_oq_resp_hw))
struct octep_vf_rx_buffer {
struct page *page;
u64 len;
};
#define OCTEP_VF_OQ_RECVBUF_SIZE (sizeof(struct octep_vf_rx_buffer))
struct octep_vf_oq_stats {
u64 packets;
u64 bytes;
u64 alloc_failures;
};
#define OCTEP_VF_OQ_STATS_SIZE (sizeof(struct octep_vf_oq_stats))
struct octep_vf_iface_rx_stats {
u64 pkts;
u64 octets;
u64 pause_pkts;
u64 pause_octets;
u64 dmac0_pkts;
u64 dmac0_octets;
u64 dropped_pkts_fifo_full;
u64 dropped_octets_fifo_full;
u64 err_pkts;
u64 dmac1_pkts;
u64 dmac1_octets;
u64 ncsi_dropped_pkts;
u64 ncsi_dropped_octets;
u64 mcast_pkts;
u64 bcast_pkts;
};
struct octep_vf_oq {
u32 q_no;
struct octep_vf_device *octep_vf_dev;
struct net_device *netdev;
struct device *dev;
struct napi_struct *napi;
struct octep_vf_rx_buffer *buff_info;
u8 __iomem *pkts_credit_reg;
u8 __iomem *pkts_sent_reg;
struct octep_vf_oq_stats *stats;
u32 pkts_pending;
u32 last_pkt_count;
u32 host_read_idx;
u32 max_count;
u32 ring_size_mask;
u32 refill_count;
u32 host_refill_idx;
u32 refill_threshold;
u32 buffer_size;
u32 max_single_buffer_size;
struct octep_vf_oq_desc_hw *desc_ring;
dma_addr_t desc_ring_dma;
};
#define OCTEP_VF_OQ_SIZE (sizeof(struct octep_vf_oq))
#endif /* _OCTEP_VF_RX_H_ */