33 #ifndef __CVMX_IPD_H__
34 #define __CVMX_IPD_H__
47 #ifndef CVMX_ENABLE_LEN_M8_FIX
48 #define CVMX_ENABLE_LEN_M8_FIX 0
75 static inline void cvmx_ipd_config(
uint64_t mbuff_size,
93 first_skip.
s.skip_sz = first_mbuff_skip;
96 not_first_skip.
u64 = 0;
97 not_first_skip.
s.skip_sz = not_first_mbuff_skip;
101 size.
s.mb_size = mbuff_size;
104 first_back_struct.u64 = 0;
105 first_back_struct.s.back = first_back;
108 second_back_struct.
u64 = 0;
109 second_back_struct.
s.back = second_back;
113 wqe_pool.
s.wqe_pool = wqe_fpa_pool;
117 ipd_ctl_reg.
s.opc_mode = cache_mode;
118 ipd_ctl_reg.
s.pbp_en = back_pres_enable_flag;
128 static inline void cvmx_ipd_enable(
void)
132 if (ipd_reg.s.ipd_en) {
134 (
"Warning: Enabling IPD when IPD already enabled.\n");
136 ipd_reg.s.ipd_en = 1;
137 #if CVMX_ENABLE_LEN_M8_FIX
139 ipd_reg.s.len_m8 =
TRUE;
147 static inline void cvmx_ipd_disable(
void)
151 ipd_reg.s.ipd_en = 0;
158 static inline void cvmx_ipd_free_ptr(
void)
171 if (ipd_ctl_status.s.no_wptr)
176 if (ipd_ptr_count.s.wqev_cnt) {
178 ipd_wqe_ptr_valid.
u64 =
181 cvmx_fpa_free(cvmx_phys_to_ptr
186 cvmx_fpa_free(cvmx_phys_to_ptr
192 if (ipd_ptr_count.s.wqe_pcnt) {
195 ipd_pwp_ptr_fifo_ctl.
u64 =
197 for (i = 0; i < ipd_ptr_count.s.wqe_pcnt; i++) {
198 ipd_pwp_ptr_fifo_ctl.s.cena = 0;
199 ipd_pwp_ptr_fifo_ctl.s.raddr =
200 ipd_pwp_ptr_fifo_ctl.s.max_cnts +
201 (ipd_pwp_ptr_fifo_ctl.s.wraddr +
202 i) % ipd_pwp_ptr_fifo_ctl.s.max_cnts;
204 ipd_pwp_ptr_fifo_ctl.u64);
205 ipd_pwp_ptr_fifo_ctl.u64 =
208 cvmx_fpa_free(cvmx_phys_to_ptr
210 ipd_pwp_ptr_fifo_ctl.s.
214 cvmx_fpa_free(cvmx_phys_to_ptr
216 ipd_pwp_ptr_fifo_ctl.s.
220 ipd_pwp_ptr_fifo_ctl.s.cena = 1;
222 ipd_pwp_ptr_fifo_ctl.u64);
226 if (ipd_ptr_count.s.pktv_cnt) {
228 ipd_pkt_ptr_valid.
u64 =
230 cvmx_fpa_free(cvmx_phys_to_ptr
231 (ipd_pkt_ptr_valid.s.ptr << 7),
239 ipd_prc_port_ptr_fifo_ctl;
240 ipd_prc_port_ptr_fifo_ctl.
u64 =
243 for (i = 0; i < ipd_prc_port_ptr_fifo_ctl.s.max_pkt;
245 ipd_prc_port_ptr_fifo_ctl.s.cena = 0;
246 ipd_prc_port_ptr_fifo_ctl.s.raddr =
247 i % ipd_prc_port_ptr_fifo_ctl.s.max_pkt;
249 ipd_prc_port_ptr_fifo_ctl.u64);
250 ipd_prc_port_ptr_fifo_ctl.u64 =
253 cvmx_fpa_free(cvmx_phys_to_ptr
255 ipd_prc_port_ptr_fifo_ctl.s.
259 ipd_prc_port_ptr_fifo_ctl.s.cena = 1;
261 ipd_prc_port_ptr_fifo_ctl.u64);
265 if (ipd_ptr_count.s.pfif_cnt) {
268 ipd_prc_hold_ptr_fifo_ctl;
270 ipd_prc_hold_ptr_fifo_ctl.
u64 =
273 for (i = 0; i < ipd_ptr_count.s.pfif_cnt; i++) {
274 ipd_prc_hold_ptr_fifo_ctl.s.cena = 0;
275 ipd_prc_hold_ptr_fifo_ctl.s.raddr =
276 (ipd_prc_hold_ptr_fifo_ctl.s.praddr +
277 i) % ipd_prc_hold_ptr_fifo_ctl.s.max_pkt;
279 ipd_prc_hold_ptr_fifo_ctl.u64);
280 ipd_prc_hold_ptr_fifo_ctl.u64 =
283 cvmx_fpa_free(cvmx_phys_to_ptr
285 ipd_prc_hold_ptr_fifo_ctl.s.
289 ipd_prc_hold_ptr_fifo_ctl.s.cena = 1;
291 ipd_prc_hold_ptr_fifo_ctl.u64);
295 if (ipd_ptr_count.s.pkt_pcnt) {
298 ipd_pwp_ptr_fifo_ctl.
u64 =
301 for (i = 0; i < ipd_ptr_count.s.pkt_pcnt; i++) {
302 ipd_pwp_ptr_fifo_ctl.s.cena = 0;
303 ipd_pwp_ptr_fifo_ctl.s.raddr =
304 (ipd_pwp_ptr_fifo_ctl.s.praddr +
305 i) % ipd_pwp_ptr_fifo_ctl.s.max_cnts;
307 ipd_pwp_ptr_fifo_ctl.u64);
308 ipd_pwp_ptr_fifo_ctl.u64 =
310 cvmx_fpa_free(cvmx_phys_to_ptr
315 ipd_pwp_ptr_fifo_ctl.s.cena = 1;
317 ipd_pwp_ptr_fifo_ctl.u64);
324 ipd_ctl_status.s.reset = 1;
332 pip_sft_rst.s.rst = 1;