1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Huawei Technologies Co., Ltd
5 #ifndef _HINIC_PMD_RX_H_
6 #define _HINIC_PMD_RX_H_
8 #define HINIC_DEFAULT_RX_FREE_THRESH 32
10 #define HINIC_RSS_OFFLOAD_ALL ( \
13 ETH_RSS_NONFRAG_IPV4_TCP | \
14 ETH_RSS_NONFRAG_IPV4_UDP | \
17 ETH_RSS_NONFRAG_IPV6_TCP | \
18 ETH_RSS_NONFRAG_IPV6_UDP | \
20 ETH_RSS_IPV6_TCP_EX | \
23 enum rq_completion_fmt {
27 struct hinic_rq_ctrl {
38 } __rte_cache_aligned;
40 struct hinic_rq_cqe_sect {
45 struct hinic_rq_bufdesc {
51 struct hinic_rq_ctrl ctrl;
53 struct hinic_rq_cqe_sect cqe_sect;
54 struct hinic_rq_bufdesc buf_desc;
57 struct hinic_rxq_stats {
66 /* Attention, Do not add any member in hinic_rx_info
67 * as rxq bulk rearm mode will write mbuf in rx_info
69 struct hinic_rx_info {
70 struct rte_mbuf *mbuf;
75 volatile u16 *pi_virt_addr;
88 struct hinic_rxq_stats rxq_stats;
90 struct hinic_nic_dev *nic_dev;
92 struct hinic_rx_info *rx_info;
93 volatile struct hinic_rq_cqe *rx_cqe;
95 dma_addr_t cqe_start_paddr;
96 void *cqe_start_vaddr;
97 struct rte_mempool *mb_pool;
100 int hinic_setup_rx_resources(struct hinic_rxq *rxq);
102 void hinic_free_all_rx_resources(struct rte_eth_dev *eth_dev);
104 void hinic_free_all_rx_mbuf(struct rte_eth_dev *eth_dev);
106 void hinic_free_rx_resources(struct hinic_rxq *rxq);
108 u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16 nb_pkts);
110 void hinic_free_all_rx_mbufs(struct hinic_rxq *rxq);
112 void hinic_rx_alloc_pkts(struct hinic_rxq *rxq);
114 void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hinic_rxq_stats *stats);
116 void hinic_rxq_stats_reset(struct hinic_rxq *rxq);
118 int hinic_config_mq_mode(struct rte_eth_dev *dev, bool on);
120 int hinic_rx_configure(struct rte_eth_dev *dev);
122 void hinic_rx_remove_configure(struct rte_eth_dev *dev);
124 void hinic_get_func_rx_buf_size(struct hinic_nic_dev *nic_dev);
126 int hinic_create_rq(struct hinic_hwdev *hwdev, u16 q_id,
127 u16 rq_depth, unsigned int socket_id);
129 void hinic_destroy_rq(struct hinic_hwdev *hwdev, u16 q_id);
131 #endif /* _HINIC_PMD_RX_H_ */