31 #include <linux/kernel.h>
103 if (work->word2.s.bufs == 0) {
107 buffer_ptr.
s.pool = wqe_pool.
s.wqe_pool;
108 buffer_ptr.
s.size = 128;
109 buffer_ptr.
s.addr = cvmx_ptr_to_phys(work->packet_data);
110 if (
likely(!work->word2.s.not_IP)) {
114 (pip_ip_offset.
s.offset << 3) -
115 work->word2.s.ip_offset;
116 buffer_ptr.
s.addr += (work->word2.s.is_v6 ^ 1) << 2;
126 buffer_ptr.
s.addr += pip_gbl_cfg.
s.nip_shf;
129 buffer_ptr = work->packet_ptr;
130 remaining_bytes = work->len;
132 while (remaining_bytes) {
134 ((buffer_ptr.
s.addr >> 7) - buffer_ptr.
s.back) << 7;
136 (
unsigned long long)start_of_buffer);
141 (
unsigned long long)buffer_ptr.
s.addr);
145 data_address = (
uint8_t *) cvmx_phys_to_ptr(buffer_ptr.
s.addr);
146 end_of_data = data_address + buffer_ptr.
s.size;
148 while (data_address < end_of_data) {
149 if (remaining_bytes == 0)
155 if (remaining_bytes && (count == 7)) {
165 cvmx_phys_to_ptr(buffer_ptr.
s.addr - 8);
191 red_marks.
s.drop = drop_thresh;
192 red_marks.
s.pass = pass_thresh;
197 red_param.
s.prb_con =
198 (255ul << 24) / (red_marks.
s.pass - red_marks.
s.drop);
199 red_param.
s.avg_con = 1;
200 red_param.
s.new_con = 255;
201 red_param.
s.use_pcnt = 1;
228 page_cnt.
s.bp_enb = 0;
229 page_cnt.
s.page_cnt = 100;
230 for (interface = 0;
interface < 2; interface++) {
231 for (port = cvmx_helper_get_first_ipd_port(interface);
232 port < cvmx_helper_get_last_ipd_port(interface); port++)
237 for (queue = 0; queue < 8; queue++)
242 ipd_bp_prt_red_end.
u64 = 0;
243 ipd_bp_prt_red_end.
s.prt_enb = 0;
246 red_port_enable.
u64 = 0;
247 red_port_enable.
s.prt_enb = 0xfffffffffull;
248 red_port_enable.
s.avg_dly = 10000;
249 red_port_enable.
s.prb_dly = 10000;
274 gmx_tx_prts.
u64 = cvmx_read_csr(CVMX_GMXX_TX_PRTS(interface));
275 gmx_tx_prts.
s.prts = num_ports;
276 cvmx_write_csr(CVMX_GMXX_TX_PRTS(interface), gmx_tx_prts.
u64);
294 gmx_rx_prts.
u64 = cvmx_read_csr(CVMX_GMXX_RX_PRTS(interface));
295 gmx_rx_prts.
s.prts = num_ports;
296 cvmx_write_csr(CVMX_GMXX_RX_PRTS(interface), gmx_rx_prts.
u64);
304 if (interface == 0) {
306 pko_mode.
s.mode0 = 4;
307 else if (num_ports == 2)
308 pko_mode.
s.mode0 = 3;
309 else if (num_ports <= 4)
310 pko_mode.
s.mode0 = 2;
311 else if (num_ports <= 8)
312 pko_mode.
s.mode0 = 1;
314 pko_mode.
s.mode0 = 0;
317 pko_mode.
s.mode1 = 4;
318 else if (num_ports == 2)
319 pko_mode.
s.mode1 = 3;
320 else if (num_ports <= 4)
321 pko_mode.
s.mode1 = 2;
322 else if (num_ports <= 8)
323 pko_mode.
s.mode1 = 1;
325 pko_mode.
s.mode1 = 0;
337 gmx_tx_thresh.
u64 = cvmx_read_csr(CVMX_GMXX_TXX_THRESH(0, interface));
341 gmx_tx_thresh.
s.cnt = 0x40;
345 gmx_tx_thresh.
s.cnt = 0x100 / 1;
346 else if (num_ports == 2)
347 gmx_tx_thresh.
s.cnt = 0x100 / 2;
349 gmx_tx_thresh.
s.cnt = 0x100 / 4;
357 for (index = 0; index < num_ports; index++)
358 cvmx_write_csr(CVMX_GMXX_TXX_THRESH(index, interface),
399 else if (ipd_port < 32)
401 else if (ipd_port < 36)
403 else if (ipd_port < 40)
406 cvmx_dprintf(
"cvmx_helper_get_interface_num: Illegal IPD "
423 return ipd_port & 15;
424 else if (ipd_port < 36)
426 else if (ipd_port < 40)
430 "Illegal IPD port number\n");