Lines Matching +full:port +full:- +full:config

7  * Copyright (c) 2003-2008 Cavium Networks
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 #include <asm/octeon/cvmx-config.h>
35 #include <asm/octeon/cvmx-pko.h>
36 #include <asm/octeon/cvmx-helper.h>
64 return -1; in __cvmx_pko_int()
77 union cvmx_pko_mem_iqueue_ptrs config; in __cvmx_pko_iport_config() local
81 config.u64 = 0; in __cvmx_pko_iport_config()
82 config.s.index = queue; in __cvmx_pko_iport_config()
83 config.s.qid = base_queue + queue; in __cvmx_pko_iport_config()
84 config.s.ipid = pko_port; in __cvmx_pko_iport_config()
85 config.s.tail = (queue == (num_queues - 1)); in __cvmx_pko_iport_config()
86 config.s.s_tail = (queue == static_priority_end); in __cvmx_pko_iport_config()
87 config.s.static_p = (static_priority_base >= 0); in __cvmx_pko_iport_config()
88 config.s.static_q = (queue <= static_priority_end); in __cvmx_pko_iport_config()
89 config.s.qos_mask = 0xff; in __cvmx_pko_iport_config()
95 (CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE - in __cvmx_pko_iport_config()
105 config.s.buf_ptr = cvmx_ptr_to_phys(buf_ptr) >> 7; in __cvmx_pko_iport_config()
107 cvmx_write_csr(CVMX_PKO_MEM_IQUEUE_PTRS, config.u64); in __cvmx_pko_iport_config()
113 int port; in __cvmx_pko_queue_alloc_o68() local
115 for (port = 0; port < 48; port++) in __cvmx_pko_queue_alloc_o68()
116 __cvmx_pko_iport_config(port); in __cvmx_pko_queue_alloc_o68()
121 int port; in __cvmx_pko_port_map_o68() local
124 union cvmx_pko_mem_iport_ptrs config; in __cvmx_pko_port_map_o68() local
129 config.u64 = 0; in __cvmx_pko_port_map_o68()
130 config.s.eid = 31; /* Invalid */ in __cvmx_pko_port_map_o68()
131 for (port = 0; port < 128; port++) { in __cvmx_pko_port_map_o68()
132 config.s.ipid = port; in __cvmx_pko_port_map_o68()
133 cvmx_write_csr(CVMX_PKO_MEM_IPORT_PTRS, config.u64); in __cvmx_pko_port_map_o68()
139 for (port = 0; port < 48; port++) { in __cvmx_pko_port_map_o68()
140 interface = cvmx_helper_get_interface_num(port); in __cvmx_pko_port_map_o68()
141 index = cvmx_helper_get_interface_index_num(port); in __cvmx_pko_port_map_o68()
146 config.s.ipid = port; in __cvmx_pko_port_map_o68()
147 config.s.qos_mask = 0xff; in __cvmx_pko_port_map_o68()
148 config.s.crc = 1; in __cvmx_pko_port_map_o68()
149 config.s.min_pkt = 1; in __cvmx_pko_port_map_o68()
150 config.s.intr = __cvmx_pko_int(interface, index); in __cvmx_pko_port_map_o68()
151 config.s.eid = config.s.intr; in __cvmx_pko_port_map_o68()
152 config.s.pipe = (mode == CVMX_HELPER_INTERFACE_MODE_LOOP) ? in __cvmx_pko_port_map_o68()
153 index : port; in __cvmx_pko_port_map_o68()
154 cvmx_write_csr(CVMX_PKO_MEM_IPORT_PTRS, config.u64); in __cvmx_pko_port_map_o68()
181 * output system. This does chip global config, and should only be
187 union cvmx_pko_reg_cmd_buf config; in cvmx_pko_initialize_global() local
194 config.u64 = 0; in cvmx_pko_initialize_global()
195 config.s.pool = CVMX_FPA_OUTPUT_BUFFER_POOL; in cvmx_pko_initialize_global()
196 config.s.size = CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE / 8 - 1; in cvmx_pko_initialize_global()
198 cvmx_write_csr(CVMX_PKO_REG_CMD_BUF, config.u64); in cvmx_pko_initialize_global()
201 * Chip-specific setup. in cvmx_pko_initialize_global()
214 cvmx_helper_get_last_ipd_port(num_interfaces - 1); in cvmx_pko_initialize_global()
248 * always enable big endian for 3-word command. Does nothing in cvmx_pko_enable()
249 * for 2-word. in cvmx_pko_enable()
283 union cvmx_pko_mem_queue_ptrs config; in cvmx_pko_shutdown() local
289 config.u64 = 0; in cvmx_pko_shutdown()
290 config.s.tail = 1; in cvmx_pko_shutdown()
291 config.s.index = 0; in cvmx_pko_shutdown()
292 config.s.port = CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID; in cvmx_pko_shutdown()
293 config.s.queue = queue & 0x7f; in cvmx_pko_shutdown()
294 config.s.qos_mask = 0; in cvmx_pko_shutdown()
295 config.s.buf_ptr = 0; in cvmx_pko_shutdown()
302 cvmx_write_csr(CVMX_PKO_MEM_QUEUE_PTRS, config.u64); in cvmx_pko_shutdown()
310 * Configure a output port and the associated queues for use.
312 * @port: Port to configure.
313 * @base_queue: First queue number to associate with this port.
314 * @num_queues: Number of queues to associate with this port
316 * allowed to be 0-8. A value of 8 get 8 times the traffic
326 cvmx_pko_status_t cvmx_pko_config_port(uint64_t port, uint64_t base_queue, in cvmx_pko_config_port() argument
332 union cvmx_pko_mem_queue_ptrs config; in cvmx_pko_config_port() local
334 int static_priority_base = -1; in cvmx_pko_config_port()
335 int static_priority_end = -1; in cvmx_pko_config_port()
340 if ((port >= CVMX_PKO_NUM_OUTPUT_PORTS) in cvmx_pko_config_port()
341 && (port != CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID)) { in cvmx_pko_config_port()
342 cvmx_dprintf("ERROR: cvmx_pko_config_port: Invalid port %llu\n", in cvmx_pko_config_port()
343 (unsigned long long)port); in cvmx_pko_config_port()
354 if (port != CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID) { in cvmx_pko_config_port()
362 if (static_priority_base == -1 in cvmx_pko_config_port()
367 if (static_priority_base != -1 in cvmx_pko_config_port()
368 && static_priority_end == -1 in cvmx_pko_config_port()
371 static_priority_end = queue - 1; in cvmx_pko_config_port()
372 else if (static_priority_base != -1 in cvmx_pko_config_port()
373 && static_priority_end == -1 in cvmx_pko_config_port()
374 && queue == num_queues - 1) in cvmx_pko_config_port()
383 if (static_priority_end != -1 in cvmx_pko_config_port()
403 cvmx_dprintf("Port %d: Static priority queue base: %d, " in cvmx_pko_config_port()
404 "end: %d\n", port, in cvmx_pko_config_port()
410 * are either both -1, or are valid start/end queue in cvmx_pko_config_port()
429 config.u64 = 0; in cvmx_pko_config_port()
430 config.s.tail = queue == (num_queues - 1); in cvmx_pko_config_port()
431 config.s.index = queue; in cvmx_pko_config_port()
432 config.s.port = port; in cvmx_pko_config_port()
433 config.s.queue = base_queue + queue; in cvmx_pko_config_port()
436 config.s.static_p = static_priority_base >= 0; in cvmx_pko_config_port()
437 config.s.static_q = (int)queue <= static_priority_end; in cvmx_pko_config_port()
438 config.s.s_tail = (int)queue == static_priority_end; in cvmx_pko_config_port()
447 config.s.qos_mask = 0x00; in cvmx_pko_config_port()
450 config.s.qos_mask = 0x01; in cvmx_pko_config_port()
453 config.s.qos_mask = 0x11; in cvmx_pko_config_port()
456 config.s.qos_mask = 0x49; in cvmx_pko_config_port()
459 config.s.qos_mask = 0x55; in cvmx_pko_config_port()
462 config.s.qos_mask = 0x57; in cvmx_pko_config_port()
465 config.s.qos_mask = 0x77; in cvmx_pko_config_port()
468 config.s.qos_mask = 0x7f; in cvmx_pko_config_port()
471 config.s.qos_mask = 0xff; in cvmx_pko_config_port()
475 config.s.qos_mask = 0xff; in cvmx_pko_config_port()
483 config.s.qos_mask = 0xff; in cvmx_pko_config_port()
488 if (port != CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID) { in cvmx_pko_config_port()
495 - in cvmx_pko_config_port()
508 ("ERROR: cvmx_pko_config_port: Port already setup.\n"); in cvmx_pko_config_port()
522 config.s.buf_ptr = cvmx_ptr_to_phys(buf_ptr); in cvmx_pko_config_port()
524 config.s.buf_ptr = 0; in cvmx_pko_config_port()
530 cvmx_write_csr(CVMX_PKO_MEM_QUEUE_PTRS, config.u64); in cvmx_pko_config_port()
538 * Show map of ports -> queues for different cores.
542 int core, port; in cvmx_pko_show_queue_map() local
545 cvmx_dprintf("port"); in cvmx_pko_show_queue_map()
546 for (port = 0; port < pko_output_ports; port++) in cvmx_pko_show_queue_map()
547 cvmx_dprintf("%3d ", port); in cvmx_pko_show_queue_map()
552 for (port = 0; port < pko_output_ports; port++) { in cvmx_pko_show_queue_map()
554 cvmx_pko_get_base_queue_per_core(port, in cvmx_pko_show_queue_map()
563 * Rate limit a PKO port to a max packets/sec. This function is only
566 * @port: Port to rate limit
573 int cvmx_pko_rate_limit_packets(int port, int packets_s, int burst) in cvmx_pko_rate_limit_packets() argument
579 pko_mem_port_rate0.s.pid = port; in cvmx_pko_rate_limit_packets()
581 cvmx_sysinfo_get()->cpu_clock_hz / packets_s / 16; in cvmx_pko_rate_limit_packets()
586 pko_mem_port_rate1.s.pid = port; in cvmx_pko_rate_limit_packets()
596 * Rate limit a PKO port to a max bits/sec. This function is only
599 * @port: Port to rate limit
606 int cvmx_pko_rate_limit_bits(int port, uint64_t bits_s, int burst) in cvmx_pko_rate_limit_bits() argument
610 uint64_t clock_rate = cvmx_sysinfo_get()->cpu_clock_hz; in cvmx_pko_rate_limit_bits()
614 pko_mem_port_rate0.s.pid = port; in cvmx_pko_rate_limit_bits()
626 pko_mem_port_rate1.s.pid = port; in cvmx_pko_rate_limit_bits()