1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2018-2019 NXP
8 #define HIF_CLIENT_QUEUES_MAX 16
9 #define HIF_RX_PKT_MIN_SIZE RTE_CACHE_LINE_SIZE
11 * HIF_TX_DESC_NT value should be always greter than 4,
12 * Otherwise HIF_TX_POLL_MARK will become zero.
14 #define HIF_RX_DESC_NT 64
15 #define HIF_TX_DESC_NT 2048
17 #define HIF_FIRST_BUFFER BIT(0)
18 #define HIF_LAST_BUFFER BIT(1)
19 #define HIF_DONT_DMA_MAP BIT(2)
20 #define HIF_DATA_VALID BIT(3)
21 #define HIF_TSO BIT(4)
29 /*structure to store client queue info */
31 struct rx_queue_desc *base;
37 struct tx_queue_desc *base;
42 /*Structure to store the client info */
45 struct hif_rx_queue rx_q[HIF_CLIENT_QUEUES_MAX];
47 struct hif_tx_queue tx_q[HIF_CLIENT_QUEUES_MAX];
50 /*HIF hardware buffer descriptor */
86 struct hif_ipsec_hdr {
91 unsigned int packet_type;
93 uint16_t parse_incomplete;
94 unsigned long long ol_flags;
97 /* HIF_CTRL_TX... defines */
98 #define HIF_CTRL_TX_CHECKSUM BIT(2)
100 /* HIF_CTRL_RX... defines */
101 #define HIF_CTRL_RX_OFFSET_OFST (24)
102 #define HIF_CTRL_RX_CHECKSUMMED BIT(2)
103 #define HIF_CTRL_RX_CONTINUED BIT(1)
106 /* To store registered clients in hif layer */
107 struct hif_client client[HIF_CLIENTS_MAX];
110 void *descr_baseaddr_v;
111 unsigned long descr_baseaddr_p;
113 struct hif_desc *rx_base;
116 void *rx_buf_addr[HIF_RX_DESC_NT];
117 void *rx_buf_vaddr[HIF_RX_DESC_NT];
118 int rx_buf_len[HIF_RX_DESC_NT];
120 unsigned int client_id;
121 unsigned int client_ctrl;
122 unsigned int started;
123 unsigned int setuped;
125 struct hif_desc *tx_base;
131 struct hif_desc_sw tx_sw_queue[HIF_TX_DESC_NT];
132 int32_t epoll_fd; /**< File descriptor created for interrupt polling */
134 /* tx_lock synchronizes hif packet tx as well as pfe_hif structure access */
135 rte_spinlock_t tx_lock;
136 /* lock synchronizes hif rx queue processing */
138 struct rte_device *dev;
141 void hif_xmit_pkt(struct pfe_hif *hif, unsigned int client_id, unsigned int
142 q_no, void *data, u32 len, unsigned int flags);
143 void hif_process_client_req(struct pfe_hif *hif, int req, int data1, int
145 int pfe_hif_init(struct pfe *pfe);
146 void pfe_hif_exit(struct pfe *pfe);
147 void pfe_hif_rx_idle(struct pfe_hif *hif);
148 int pfe_hif_rx_process(struct pfe *pfe, int budget);
149 int pfe_hif_init_buffers(struct pfe_hif *hif);
150 void pfe_tx_do_cleanup(struct pfe *pfe);
152 #define __memcpy8(dst, src) memcpy(dst, src, 8)
153 #define __memcpy12(dst, src) memcpy(dst, src, 12)
154 #define __memcpy(dst, src, len) memcpy(dst, src, len)
156 #endif /* _PFE_HIF_H_ */