78 cvmx_helper_get_last_ipd_port(num_interfaces - 1);
80 cvmx_pko_get_base_queue(last_port) +
81 cvmx_pko_get_num_queues(last_port);
85 else if (max_queues <= 64)
90 else if (max_queues <= 128)
121 (
"Warning: Enabling PKO when PKO already enabled.\n");
129 flags.
s.store_be = 1;
140 pko_reg_flags.
s.ena_pko = 0;
148 static void __cvmx_pko_reset(
void)
152 pko_reg_flags.s.reset = 1;
171 config.
s.queue = queue & 0x7f;
172 config.
s.qos_mask = 0;
173 config.
s.buf_ptr = 0;
177 config1.
s.qid7 = queue >> 7;
211 int static_priority_base = -1;
212 int static_priority_end = -1;
216 cvmx_dprintf(
"ERROR: cvmx_pko_config_port: Invalid port %llu\n",
217 (
unsigned long long)port);
223 (
"ERROR: cvmx_pko_config_port: Invalid queue range %llu\n",
224 (
unsigned long long)(base_queue + num_queues));
234 for (queue = 0; queue <
num_queues; queue++) {
236 if (static_priority_base == -1
237 && priority[queue] ==
239 static_priority_base = queue;
241 if (static_priority_base != -1
242 && static_priority_end == -1
245 static_priority_end = queue - 1;
246 else if (static_priority_base != -1
247 && static_priority_end == -1
248 && queue == num_queues - 1)
250 static_priority_end = queue;
257 if (static_priority_end != -1
258 && (
int)queue > static_priority_end
259 && priority[queue] ==
262 "Static priority queues aren't "
263 "contiguous or don't start at "
264 "base queue. q: %d, eq: %d\n",
265 (
int)queue, static_priority_end);
269 if (static_priority_base > 0) {
271 "priority queues don't start at base "
273 static_priority_base);
277 cvmx_dprintf(
"Port %d: Static priority queue base: %d, "
279 static_priority_base, static_priority_end);
291 cvmx_dprintf(
"num queues: %d (%lld,%lld)\n", num_queues,
296 for (queue = 0; queue <
num_queues; queue++) {
300 config1.
s.idx3 = queue >> 3;
301 config1.
s.qid7 = (base_queue + queue) >> 7;
304 config.
s.tail = queue == (num_queues - 1);
305 config.
s.index = queue;
306 config.
s.port =
port;
307 config.
s.queue = base_queue + queue;
309 if (!cvmx_octeon_is_pass1()) {
310 config.
s.static_p = static_priority_base >= 0;
311 config.
s.static_q = (
int)queue <= static_priority_end;
312 config.
s.s_tail = (
int)queue == static_priority_end;
319 switch ((
int)priority[queue]) {
321 config.
s.qos_mask = 0x00;
324 config.
s.qos_mask = 0x01;
327 config.
s.qos_mask = 0x11;
330 config.
s.qos_mask = 0x49;
333 config.
s.qos_mask = 0x55;
336 config.
s.qos_mask = 0x57;
339 config.
s.qos_mask = 0x77;
342 config.
s.qos_mask = 0x7f;
345 config.
s.qos_mask = 0xff;
349 if (!cvmx_octeon_is_pass1()) {
350 config.
s.qos_mask = 0xff;
356 (
unsigned long long)priority[queue]);
357 config.
s.qos_mask = 0xff;
365 (base_queue + queue),
376 "cvmx_pko_config_port: "
377 "Unable to allocate "
382 (
"ERROR: cvmx_pko_config_port: Port already setup.\n");
387 (
"ERROR: cvmx_pko_config_port: Command queue initialization failed.\n");
395 (base_queue + queue));
396 config.
s.buf_ptr = cvmx_ptr_to_phys(buf_ptr);
398 config.
s.buf_ptr = 0;
414 void cvmx_pko_show_queue_map()
417 int pko_output_ports = 36;
420 for (port = 0; port < pko_output_ports; port++)
426 for (port = 0; port < pko_output_ports; port++) {
428 cvmx_pko_get_base_queue_per_core(port,
452 pko_mem_port_rate0.
u64 = 0;
453 pko_mem_port_rate0.
s.pid =
port;
454 pko_mem_port_rate0.
s.rate_pkt =
457 pko_mem_port_rate0.
s.rate_word = 0;
459 pko_mem_port_rate1.
u64 = 0;
460 pko_mem_port_rate1.
s.pid =
port;
461 pko_mem_port_rate1.
s.rate_lim =
462 ((
uint64_t) pko_mem_port_rate0.
s.rate_pkt * burst) >> 8;
485 uint64_t tokens_per_bit = clock_rate * 16 / bits_s;
487 pko_mem_port_rate0.
u64 = 0;
488 pko_mem_port_rate0.
s.pid =
port;
495 pko_mem_port_rate0.
s.rate_pkt = (12 + 8 + 4) * 8 * tokens_per_bit / 256;
497 pko_mem_port_rate0.
s.rate_word = 64 * tokens_per_bit;
499 pko_mem_port_rate1.
u64 = 0;
500 pko_mem_port_rate1.
s.pid =
port;
501 pko_mem_port_rate1.
s.rate_lim = tokens_per_bit * burst / 256;