#include <linux/atomic.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/dma-direction.h>
#include <linux/dma-mapping.h>
#include <linux/gfp.h>
#include <linux/err.h>
#include <linux/iopoll.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/list.h>
#include <linux/minmax.h>
#include <linux/mm.h>
#include <linux/netdevice.h>
#include <linux/pm_runtime.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
#include "t7xx_dpmaif.h"
#include "t7xx_hif_dpmaif.h"
#include "t7xx_hif_dpmaif_rx.h"
#include "t7xx_netdev.h"
#include "t7xx_pci.h"
#define DPMAIF_BAT_COUNT …
#define DPMAIF_FRG_COUNT …
#define DPMAIF_PIT_COUNT …
#define DPMAIF_BAT_CNT_THRESHOLD …
#define DPMAIF_PIT_CNT_THRESHOLD …
#define DPMAIF_RX_PUSH_THRESHOLD_MASK …
#define DPMAIF_NOTIFY_RELEASE_COUNT …
#define DPMAIF_POLL_PIT_TIME_US …
#define DPMAIF_POLL_PIT_MAX_TIME_US …
#define DPMAIF_WQ_TIME_LIMIT_MS …
#define DPMAIF_CS_RESULT_PASS …
#define DES_PT_PD …
#define DES_PT_MSG …
#define PKT_BUF_FRAG …
static unsigned int t7xx_normal_pit_bid(const struct dpmaif_pit *pit_info)
{ … }
static int t7xx_dpmaif_update_bat_wr_idx(struct dpmaif_ctrl *dpmaif_ctrl,
const unsigned int q_num, const unsigned int bat_cnt)
{ … }
static bool t7xx_alloc_and_map_skb_info(const struct dpmaif_ctrl *dpmaif_ctrl,
const unsigned int size, struct dpmaif_bat_skb *cur_skb)
{ … }
static void t7xx_unmap_bat_skb(struct device *dev, struct dpmaif_bat_skb *bat_skb_base,
unsigned int index)
{ … }
int t7xx_dpmaif_rx_buf_alloc(struct dpmaif_ctrl *dpmaif_ctrl,
const struct dpmaif_bat_request *bat_req,
const unsigned int q_num, const unsigned int buf_cnt,
const bool initial)
{ … }
static int t7xx_dpmaifq_release_pit_entry(struct dpmaif_rx_queue *rxq,
const unsigned int rel_entry_num)
{ … }
static void t7xx_dpmaif_set_bat_mask(struct dpmaif_bat_request *bat_req, unsigned int idx)
{ … }
static int t7xx_frag_bat_cur_bid_check(struct dpmaif_rx_queue *rxq,
const unsigned int cur_bid)
{ … }
static void t7xx_unmap_bat_page(struct device *dev, struct dpmaif_bat_page *bat_page_base,
unsigned int index)
{ … }
int t7xx_dpmaif_rx_frag_alloc(struct dpmaif_ctrl *dpmaif_ctrl, struct dpmaif_bat_request *bat_req,
const unsigned int buf_cnt, const bool initial)
{ … }
static int t7xx_dpmaif_set_frag_to_skb(const struct dpmaif_rx_queue *rxq,
const struct dpmaif_pit *pkt_info,
struct sk_buff *skb)
{ … }
static int t7xx_dpmaif_get_frag(struct dpmaif_rx_queue *rxq,
const struct dpmaif_pit *pkt_info,
const struct dpmaif_cur_rx_skb_info *skb_info)
{ … }
static int t7xx_bat_cur_bid_check(struct dpmaif_rx_queue *rxq, const unsigned int cur_bid)
{ … }
static int t7xx_dpmaif_read_pit_seq(const struct dpmaif_pit *pit)
{ … }
static int t7xx_dpmaif_check_pit_seq(struct dpmaif_rx_queue *rxq,
const struct dpmaif_pit *pit)
{ … }
static unsigned int t7xx_dpmaif_avail_pkt_bat_cnt(struct dpmaif_bat_request *bat_req)
{ … }
static int t7xx_dpmaif_release_bat_entry(const struct dpmaif_rx_queue *rxq,
const unsigned int rel_entry_num,
const enum bat_type buf_type)
{ … }
static int t7xx_dpmaif_pit_release_and_add(struct dpmaif_rx_queue *rxq)
{ … }
static int t7xx_dpmaif_bat_release_and_add(const struct dpmaif_rx_queue *rxq)
{ … }
static int t7xx_dpmaif_frag_bat_release_and_add(const struct dpmaif_rx_queue *rxq)
{ … }
static void t7xx_dpmaif_parse_msg_pit(const struct dpmaif_rx_queue *rxq,
const struct dpmaif_pit *msg_pit,
struct dpmaif_cur_rx_skb_info *skb_info)
{ … }
static int t7xx_dpmaif_set_data_to_skb(const struct dpmaif_rx_queue *rxq,
const struct dpmaif_pit *pkt_info,
struct dpmaif_cur_rx_skb_info *skb_info)
{ … }
static int t7xx_dpmaif_get_rx_pkt(struct dpmaif_rx_queue *rxq,
const struct dpmaif_pit *pkt_info,
struct dpmaif_cur_rx_skb_info *skb_info)
{ … }
static int t7xx_dpmaifq_rx_notify_hw(struct dpmaif_rx_queue *rxq)
{ … }
static void t7xx_dpmaif_rx_skb(struct dpmaif_rx_queue *rxq,
struct dpmaif_cur_rx_skb_info *skb_info)
{ … }
static int t7xx_dpmaif_rx_start(struct dpmaif_rx_queue *rxq, const unsigned int pit_cnt,
const unsigned int budget, int *once_more)
{ … }
static unsigned int t7xx_dpmaifq_poll_pit(struct dpmaif_rx_queue *rxq)
{ … }
static int t7xx_dpmaif_napi_rx_data_collect(struct dpmaif_ctrl *dpmaif_ctrl,
const unsigned int q_num,
const unsigned int budget, int *once_more)
{ … }
int t7xx_dpmaif_napi_rx_poll(struct napi_struct *napi, const int budget)
{ … }
void t7xx_dpmaif_irq_rx_done(struct dpmaif_ctrl *dpmaif_ctrl, const unsigned int que_mask)
{ … }
static void t7xx_dpmaif_base_free(const struct dpmaif_ctrl *dpmaif_ctrl,
const struct dpmaif_bat_request *bat_req)
{ … }
int t7xx_dpmaif_bat_alloc(const struct dpmaif_ctrl *dpmaif_ctrl, struct dpmaif_bat_request *bat_req,
const enum bat_type buf_type)
{ … }
void t7xx_dpmaif_bat_free(const struct dpmaif_ctrl *dpmaif_ctrl, struct dpmaif_bat_request *bat_req)
{ … }
static int t7xx_dpmaif_rx_alloc(struct dpmaif_rx_queue *rxq)
{ … }
static void t7xx_dpmaif_rx_buf_free(const struct dpmaif_rx_queue *rxq)
{ … }
int t7xx_dpmaif_rxq_init(struct dpmaif_rx_queue *queue)
{ … }
void t7xx_dpmaif_rxq_free(struct dpmaif_rx_queue *queue)
{ … }
static void t7xx_dpmaif_bat_release_work(struct work_struct *work)
{ … }
int t7xx_dpmaif_bat_rel_wq_alloc(struct dpmaif_ctrl *dpmaif_ctrl)
{ … }
void t7xx_dpmaif_bat_wq_rel(struct dpmaif_ctrl *dpmaif_ctrl)
{ … }
void t7xx_dpmaif_rx_stop(struct dpmaif_ctrl *dpmaif_ctrl)
{ … }
static void t7xx_dpmaif_stop_rxq(struct dpmaif_rx_queue *rxq)
{ … }
void t7xx_dpmaif_rx_clear(struct dpmaif_ctrl *dpmaif_ctrl)
{ … }