diff options
Diffstat (limited to 'arch/mips/mach-octeon/cvmx-helper-util.c')
-rw-r--r-- | arch/mips/mach-octeon/cvmx-helper-util.c | 248 |
1 files changed, 0 insertions, 248 deletions
diff --git a/arch/mips/mach-octeon/cvmx-helper-util.c b/arch/mips/mach-octeon/cvmx-helper-util.c index 92298fd8d1e..6d775eee924 100644 --- a/arch/mips/mach-octeon/cvmx-helper-util.c +++ b/arch/mips/mach-octeon/cvmx-helper-util.c @@ -182,127 +182,6 @@ const char *cvmx_helper_interface_mode_to_string(cvmx_helper_interface_mode_t mo } /** - * Debug routine to dump the packet structure to the console - * - * @param work Work queue entry containing the packet to dump - * @return - */ -int cvmx_helper_dump_packet(cvmx_wqe_t *work) -{ - u64 count; - u64 remaining_bytes; - union cvmx_buf_ptr buffer_ptr; - cvmx_buf_ptr_pki_t bptr; - cvmx_wqe_78xx_t *wqe = (void *)work; - u64 start_of_buffer; - u8 *data_address; - u8 *end_of_data; - - if (octeon_has_feature(OCTEON_FEATURE_CN78XX_WQE)) { - cvmx_pki_dump_wqe(wqe); - cvmx_wqe_pki_errata_20776(work); - } else { - debug("WORD0 = %lx\n", (unsigned long)work->word0.u64); - debug("WORD1 = %lx\n", (unsigned long)work->word1.u64); - debug("WORD2 = %lx\n", (unsigned long)work->word2.u64); - debug("Packet Length: %u\n", cvmx_wqe_get_len(work)); - debug(" Input Port: %u\n", cvmx_wqe_get_port(work)); - debug(" QoS: %u\n", cvmx_wqe_get_qos(work)); - debug(" Buffers: %u\n", cvmx_wqe_get_bufs(work)); - } - - if (cvmx_wqe_get_bufs(work) == 0) { - int wqe_pool; - - if (octeon_has_feature(OCTEON_FEATURE_CN78XX_WQE)) { - debug("%s: ERROR: Unexpected bufs==0 in WQE\n", __func__); - return -1; - } - wqe_pool = (int)cvmx_fpa_get_wqe_pool(); - buffer_ptr.u64 = 0; - buffer_ptr.s.pool = wqe_pool; - - buffer_ptr.s.size = 128; - buffer_ptr.s.addr = cvmx_ptr_to_phys(work->packet_data); - if (cvmx_likely(!work->word2.s.not_IP)) { - union cvmx_pip_ip_offset pip_ip_offset; - - pip_ip_offset.u64 = csr_rd(CVMX_PIP_IP_OFFSET); - buffer_ptr.s.addr += - (pip_ip_offset.s.offset << 3) - work->word2.s.ip_offset; - buffer_ptr.s.addr += (work->word2.s.is_v6 ^ 1) << 2; - } else { - /* - * WARNING: This code assume that the packet - * is not RAW. If it was, we would use - * PIP_GBL_CFG[RAW_SHF] instead of - * PIP_GBL_CFG[NIP_SHF]. - */ - union cvmx_pip_gbl_cfg pip_gbl_cfg; - - pip_gbl_cfg.u64 = csr_rd(CVMX_PIP_GBL_CFG); - buffer_ptr.s.addr += pip_gbl_cfg.s.nip_shf; - } - } else { - buffer_ptr = work->packet_ptr; - } - - remaining_bytes = cvmx_wqe_get_len(work); - - while (remaining_bytes) { - /* native cn78xx buffer format, unless legacy-translated */ - if (octeon_has_feature(OCTEON_FEATURE_CN78XX_WQE) && !wqe->pki_wqe_translated) { - bptr.u64 = buffer_ptr.u64; - /* XXX- assumes cache-line aligned buffer */ - start_of_buffer = (bptr.addr >> 7) << 7; - debug(" Buffer Start:%llx\n", (unsigned long long)start_of_buffer); - debug(" Buffer Data: %llx\n", (unsigned long long)bptr.addr); - debug(" Buffer Size: %u\n", bptr.size); - data_address = (uint8_t *)cvmx_phys_to_ptr(bptr.addr); - end_of_data = data_address + bptr.size; - } else { - start_of_buffer = ((buffer_ptr.s.addr >> 7) - buffer_ptr.s.back) << 7; - debug(" Buffer Start:%llx\n", (unsigned long long)start_of_buffer); - debug(" Buffer I : %u\n", buffer_ptr.s.i); - debug(" Buffer Back: %u\n", buffer_ptr.s.back); - debug(" Buffer Pool: %u\n", buffer_ptr.s.pool); - debug(" Buffer Data: %llx\n", (unsigned long long)buffer_ptr.s.addr); - debug(" Buffer Size: %u\n", buffer_ptr.s.size); - data_address = (uint8_t *)cvmx_phys_to_ptr(buffer_ptr.s.addr); - end_of_data = data_address + buffer_ptr.s.size; - } - - debug("\t\t"); - count = 0; - while (data_address < end_of_data) { - if (remaining_bytes == 0) - break; - - remaining_bytes--; - debug("%02x", (unsigned int)*data_address); - data_address++; - if (remaining_bytes && count == 7) { - debug("\n\t\t"); - count = 0; - } else { - count++; - } - } - debug("\n"); - - if (remaining_bytes) { - if (octeon_has_feature(OCTEON_FEATURE_CN78XX_WQE) && - !wqe->pki_wqe_translated) - buffer_ptr.u64 = *(uint64_t *)cvmx_phys_to_ptr(bptr.addr - 8); - else - buffer_ptr.u64 = - *(uint64_t *)cvmx_phys_to_ptr(buffer_ptr.s.addr - 8); - } - } - return 0; -} - -/** * @INTERNAL * * Extract NO_WPTR mode from PIP/IPD register @@ -678,68 +557,6 @@ void cvmx_helper_free_packet_data(cvmx_wqe_t *work) } } -void cvmx_helper_setup_legacy_red(int pass_thresh, int drop_thresh) -{ - unsigned int node = cvmx_get_node_num(); - int aura, bpid; - int buf_cnt; - bool ena_red = 0, ena_drop = 0, ena_bp = 0; - -#define FPA_RED_AVG_DLY 1 -#define FPA_RED_LVL_DLY 3 -#define FPA_QOS_AVRG 0 - /* Trying to make it backward compatible with older chips */ - - /* Setting up avg_dly and prb_dly, enable bits */ - if (octeon_has_feature(OCTEON_FEATURE_FPA3)) { - cvmx_fpa3_config_red_params(node, FPA_QOS_AVRG, - FPA_RED_LVL_DLY, FPA_RED_AVG_DLY); - } - - /* Disable backpressure on queued buffers which is aura in 78xx*/ - /* - * Assumption is that all packets from all interface and ports goes - * in same poolx/aurax for backward compatibility - */ - aura = cvmx_fpa_get_packet_pool(); - buf_cnt = cvmx_fpa_get_packet_pool_buffer_count(); - pass_thresh = buf_cnt - pass_thresh; - drop_thresh = buf_cnt - drop_thresh; - /* Map aura to bpid 0*/ - bpid = 0; - cvmx_pki_write_aura_bpid(node, aura, bpid); - /* Don't enable back pressure */ - ena_bp = 0; - /* enable RED */ - ena_red = 1; - /* - * This will enable RED on all interfaces since - * they all have packet buffer coming from same aura - */ - cvmx_helper_setup_aura_qos(node, aura, ena_red, ena_drop, pass_thresh, - drop_thresh, ena_bp, 0); -} - -/** - * Setup Random Early Drop to automatically begin dropping packets. - * - * @param pass_thresh - * Packets will begin slowly dropping when there are less than - * this many packet buffers free in FPA 0. - * @param drop_thresh - * All incoming packets will be dropped when there are less - * than this many free packet buffers in FPA 0. - * Return: Zero on success. Negative on failure - */ -int cvmx_helper_setup_red(int pass_thresh, int drop_thresh) -{ - if (octeon_has_feature(OCTEON_FEATURE_PKI)) - cvmx_helper_setup_legacy_red(pass_thresh, drop_thresh); - else - cvmx_ipd_setup_red(pass_thresh, drop_thresh); - return 0; -} - /** * @INTERNAL * Setup the common GMX settings that determine the number of @@ -980,35 +797,6 @@ int cvmx_helper_get_bpid(int interface, int port) } /** - * Display interface statistics. - * - * @param port IPD/PKO port number - * - * Return: none - */ -void cvmx_helper_show_stats(int port) -{ - cvmx_pip_port_status_t status; - cvmx_pko_port_status_t pko_status; - - /* ILK stats */ - if (octeon_has_feature(OCTEON_FEATURE_ILK)) - __cvmx_helper_ilk_show_stats(); - - /* PIP stats */ - cvmx_pip_get_port_stats(port, 0, &status); - debug("port %d: the number of packets - ipd: %d\n", port, - (int)status.packets); - - /* PKO stats */ - cvmx_pko_get_port_status(port, 0, &pko_status); - debug("port %d: the number of packets - pko: %d\n", port, - (int)pko_status.packets); - - /* TODO: other stats */ -} - -/** * Returns the interface number for an IPD/PKO port number. * * @param ipd_port IPD/PKO port number @@ -1187,39 +975,3 @@ int cvmx_helper_get_interface_index_num(int ipd_port) return -1; } - -/** - * Prints out a buffer with the address, hex bytes, and ASCII - * - * @param addr Start address to print on the left - * @param[in] buffer array of bytes to print - * @param count Number of bytes to print - */ -void cvmx_print_buffer_u8(unsigned int addr, const uint8_t *buffer, - size_t count) -{ - uint i; - - while (count) { - unsigned int linelen = count < 16 ? count : 16; - - debug("%08x:", addr); - - for (i = 0; i < linelen; i++) - debug(" %0*x", 2, buffer[i]); - - while (i++ < 17) - debug(" "); - - for (i = 0; i < linelen; i++) { - if (buffer[i] >= 0x20 && buffer[i] < 0x7f) - debug("%c", buffer[i]); - else - debug("."); - } - debug("\n"); - addr += linelen; - buffer += linelen; - count -= linelen; - } -} |