From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3269AA0550; Fri, 26 Aug 2022 14:42:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F724410DC; Fri, 26 Aug 2022 14:42:38 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 72D374281C for ; Fri, 26 Aug 2022 14:42:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661517755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YKSGSxB5cINiiWOCBCte+SiCLNhgvQZYypOgd5gxVqQ=; b=I5WtuU2242ObZu+PQa8pYRLC84iOr0QMke/puKClsGjJNKKq/v1v1bnQTc0qZE4bufqclO XVLBQUsGiwolmqxhk52IcJqf7Ase94Ogc6X1kQT1TWr//xU8pjp/G3TxkQNnBs7BIp/lVK E5DrlENy96/NOCCRyjiGrix4Ldx5jPE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-584-YioAnvJXOqKqKDc_usrxXA-1; Fri, 26 Aug 2022 08:42:33 -0400 X-MC-Unique: YioAnvJXOqKqKDc_usrxXA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0A7A4802E5D; Fri, 26 Aug 2022 12:42:33 +0000 (UTC) Received: from fchome.redhat.com (unknown [10.40.193.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id A02004010FA1; Fri, 26 Aug 2022 12:42:31 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, bruce.richardson@intel.com, Aman Singh , Yuying Zhang Subject: [PATCH v4 04/27] app/testpmd: drop PCI register commands Date: Fri, 26 Aug 2022 14:41:45 +0200 Message-Id: <20220826124208.671400-5-david.marchand@redhat.com> In-Reply-To: <20220826124208.671400-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220826124208.671400-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Those commands date back to the early stages of DPDK when only PCI devices were supported. At the time, developers may have used those commands to help in debugging their buggy^Wwork in progress drivers. Removing them, we can drop the dependency on the PCI bus and library and make testpmd bus agnostic. Signed-off-by: David Marchand Acked-by: Bruce Richardson --- app/test-pmd/cmdline.c | 339 +------------------- app/test-pmd/config.c | 195 ----------- app/test-pmd/csumonly.c | 1 - app/test-pmd/flowgen.c | 1 - app/test-pmd/iofwd.c | 1 - app/test-pmd/macfwd.c | 1 - app/test-pmd/macswap.c | 1 - app/test-pmd/meson.build | 2 +- app/test-pmd/parameters.c | 1 - app/test-pmd/rxonly.c | 1 - app/test-pmd/testpmd.c | 1 - app/test-pmd/testpmd.h | 72 +---- app/test-pmd/txonly.c | 1 - doc/guides/testpmd_app_ug/testpmd_funcs.rst | 81 ----- 14 files changed, 4 insertions(+), 694 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b4fe9dfb17..4697b7c494 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -89,7 +88,6 @@ static void cmd_help_brief_parsed(__rte_unused void *parsed_result, "information.\n" " help config : Configuration information.\n" " help ports : Configuring ports.\n" - " help registers : Reading and setting port registers.\n" " help filters : Filters configuration help.\n" " help traffic_management : Traffic Management commands.\n" " help devices : Device related commands.\n" @@ -799,34 +797,6 @@ static void cmd_help_long_parsed(void *parsed_result, ); } - if (show_all || !strcmp(res->section, "registers")) { - - cmdline_printf( - cl, - "\n" - "Registers:\n" - "----------\n\n" - - "read reg (port_id) (address)\n" - " Display value of a port register.\n\n" - - "read regfield (port_id) (address) (bit_x) (bit_y)\n" - " Display a port register bit field.\n\n" - - "read regbit (port_id) (address) (bit_x)\n" - " Display a single port register bit.\n\n" - - "write reg (port_id) (address) (value)\n" - " Set value of a port register.\n\n" - - "write regfield (port_id) (address) (bit_x) (bit_y)" - " (value)\n" - " Set bit field of a port register.\n\n" - - "write regbit (port_id) (address) (bit_x) (value)\n" - " Set single bit value of a port register.\n\n" - ); - } if (show_all || !strcmp(res->section, "filters")) { cmdline_printf( @@ -1077,13 +1047,13 @@ static cmdline_parse_token_string_t cmd_help_long_help = static cmdline_parse_token_string_t cmd_help_long_section = TOKEN_STRING_INITIALIZER(struct cmd_help_long_result, section, - "all#control#display#config#ports#registers#" + "all#control#display#config#ports#" "filters#traffic_management#devices#drivers"); static cmdline_parse_inst_t cmd_help_long = { .f = cmd_help_long_parsed, .data = NULL, - .help_str = "help all|control|display|config|ports|register|" + .help_str = "help all|control|display|config|ports|" "filters|traffic_management|devices|drivers: " "Show help", .tokens = { @@ -7390,305 +7360,6 @@ static cmdline_parse_inst_t cmd_showfwdall = { }, }; -/* *** READ PORT REGISTER *** */ -struct cmd_read_reg_result { - cmdline_fixed_string_t read; - cmdline_fixed_string_t reg; - portid_t port_id; - uint32_t reg_off; -}; - -static void -cmd_read_reg_parsed(void *parsed_result, - __rte_unused struct cmdline *cl, - __rte_unused void *data) -{ - struct cmd_read_reg_result *res = parsed_result; - port_reg_display(res->port_id, res->reg_off); -} - -static cmdline_parse_token_string_t cmd_read_reg_read = - TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, read, "read"); -static cmdline_parse_token_string_t cmd_read_reg_reg = - TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, reg, "reg"); -static cmdline_parse_token_num_t cmd_read_reg_port_id = - TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, port_id, RTE_UINT16); -static cmdline_parse_token_num_t cmd_read_reg_reg_off = - TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, reg_off, RTE_UINT32); - -static cmdline_parse_inst_t cmd_read_reg = { - .f = cmd_read_reg_parsed, - .data = NULL, - .help_str = "read reg ", - .tokens = { - (void *)&cmd_read_reg_read, - (void *)&cmd_read_reg_reg, - (void *)&cmd_read_reg_port_id, - (void *)&cmd_read_reg_reg_off, - NULL, - }, -}; - -/* *** READ PORT REGISTER BIT FIELD *** */ -struct cmd_read_reg_bit_field_result { - cmdline_fixed_string_t read; - cmdline_fixed_string_t regfield; - portid_t port_id; - uint32_t reg_off; - uint8_t bit1_pos; - uint8_t bit2_pos; -}; - -static void -cmd_read_reg_bit_field_parsed(void *parsed_result, - __rte_unused struct cmdline *cl, - __rte_unused void *data) -{ - struct cmd_read_reg_bit_field_result *res = parsed_result; - port_reg_bit_field_display(res->port_id, res->reg_off, - res->bit1_pos, res->bit2_pos); -} - -static cmdline_parse_token_string_t cmd_read_reg_bit_field_read = - TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result, read, - "read"); -static cmdline_parse_token_string_t cmd_read_reg_bit_field_regfield = - TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result, - regfield, "regfield"); -static cmdline_parse_token_num_t cmd_read_reg_bit_field_port_id = - TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, port_id, - RTE_UINT16); -static cmdline_parse_token_num_t cmd_read_reg_bit_field_reg_off = - TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, reg_off, - RTE_UINT32); -static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit1_pos = - TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit1_pos, - RTE_UINT8); -static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit2_pos = - TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit2_pos, - RTE_UINT8); - -static cmdline_parse_inst_t cmd_read_reg_bit_field = { - .f = cmd_read_reg_bit_field_parsed, - .data = NULL, - .help_str = "read regfield : " - "Read register bit field between bit_x and bit_y included", - .tokens = { - (void *)&cmd_read_reg_bit_field_read, - (void *)&cmd_read_reg_bit_field_regfield, - (void *)&cmd_read_reg_bit_field_port_id, - (void *)&cmd_read_reg_bit_field_reg_off, - (void *)&cmd_read_reg_bit_field_bit1_pos, - (void *)&cmd_read_reg_bit_field_bit2_pos, - NULL, - }, -}; - -/* *** READ PORT REGISTER BIT *** */ -struct cmd_read_reg_bit_result { - cmdline_fixed_string_t read; - cmdline_fixed_string_t regbit; - portid_t port_id; - uint32_t reg_off; - uint8_t bit_pos; -}; - -static void -cmd_read_reg_bit_parsed(void *parsed_result, - __rte_unused struct cmdline *cl, - __rte_unused void *data) -{ - struct cmd_read_reg_bit_result *res = parsed_result; - port_reg_bit_display(res->port_id, res->reg_off, res->bit_pos); -} - -static cmdline_parse_token_string_t cmd_read_reg_bit_read = - TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result, read, "read"); -static cmdline_parse_token_string_t cmd_read_reg_bit_regbit = - TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result, - regbit, "regbit"); -static cmdline_parse_token_num_t cmd_read_reg_bit_port_id = - TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, port_id, - RTE_UINT16); -static cmdline_parse_token_num_t cmd_read_reg_bit_reg_off = - TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, reg_off, - RTE_UINT32); -static cmdline_parse_token_num_t cmd_read_reg_bit_bit_pos = - TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, bit_pos, - RTE_UINT8); - -static cmdline_parse_inst_t cmd_read_reg_bit = { - .f = cmd_read_reg_bit_parsed, - .data = NULL, - .help_str = "read regbit : 0 <= bit_x <= 31", - .tokens = { - (void *)&cmd_read_reg_bit_read, - (void *)&cmd_read_reg_bit_regbit, - (void *)&cmd_read_reg_bit_port_id, - (void *)&cmd_read_reg_bit_reg_off, - (void *)&cmd_read_reg_bit_bit_pos, - NULL, - }, -}; - -/* *** WRITE PORT REGISTER *** */ -struct cmd_write_reg_result { - cmdline_fixed_string_t write; - cmdline_fixed_string_t reg; - portid_t port_id; - uint32_t reg_off; - uint32_t value; -}; - -static void -cmd_write_reg_parsed(void *parsed_result, - __rte_unused struct cmdline *cl, - __rte_unused void *data) -{ - struct cmd_write_reg_result *res = parsed_result; - port_reg_set(res->port_id, res->reg_off, res->value); -} - -static cmdline_parse_token_string_t cmd_write_reg_write = - TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, write, "write"); -static cmdline_parse_token_string_t cmd_write_reg_reg = - TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, reg, "reg"); -static cmdline_parse_token_num_t cmd_write_reg_port_id = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, port_id, RTE_UINT16); -static cmdline_parse_token_num_t cmd_write_reg_reg_off = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, reg_off, RTE_UINT32); -static cmdline_parse_token_num_t cmd_write_reg_value = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, value, RTE_UINT32); - -static cmdline_parse_inst_t cmd_write_reg = { - .f = cmd_write_reg_parsed, - .data = NULL, - .help_str = "write reg ", - .tokens = { - (void *)&cmd_write_reg_write, - (void *)&cmd_write_reg_reg, - (void *)&cmd_write_reg_port_id, - (void *)&cmd_write_reg_reg_off, - (void *)&cmd_write_reg_value, - NULL, - }, -}; - -/* *** WRITE PORT REGISTER BIT FIELD *** */ -struct cmd_write_reg_bit_field_result { - cmdline_fixed_string_t write; - cmdline_fixed_string_t regfield; - portid_t port_id; - uint32_t reg_off; - uint8_t bit1_pos; - uint8_t bit2_pos; - uint32_t value; -}; - -static void -cmd_write_reg_bit_field_parsed(void *parsed_result, - __rte_unused struct cmdline *cl, - __rte_unused void *data) -{ - struct cmd_write_reg_bit_field_result *res = parsed_result; - port_reg_bit_field_set(res->port_id, res->reg_off, - res->bit1_pos, res->bit2_pos, res->value); -} - -static cmdline_parse_token_string_t cmd_write_reg_bit_field_write = - TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result, write, - "write"); -static cmdline_parse_token_string_t cmd_write_reg_bit_field_regfield = - TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result, - regfield, "regfield"); -static cmdline_parse_token_num_t cmd_write_reg_bit_field_port_id = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, port_id, - RTE_UINT16); -static cmdline_parse_token_num_t cmd_write_reg_bit_field_reg_off = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, reg_off, - RTE_UINT32); -static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit1_pos = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit1_pos, - RTE_UINT8); -static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit2_pos = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit2_pos, - RTE_UINT8); -static cmdline_parse_token_num_t cmd_write_reg_bit_field_value = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, value, - RTE_UINT32); - -static cmdline_parse_inst_t cmd_write_reg_bit_field = { - .f = cmd_write_reg_bit_field_parsed, - .data = NULL, - .help_str = "write regfield " - ": " - "Set register bit field between bit_x and bit_y included", - .tokens = { - (void *)&cmd_write_reg_bit_field_write, - (void *)&cmd_write_reg_bit_field_regfield, - (void *)&cmd_write_reg_bit_field_port_id, - (void *)&cmd_write_reg_bit_field_reg_off, - (void *)&cmd_write_reg_bit_field_bit1_pos, - (void *)&cmd_write_reg_bit_field_bit2_pos, - (void *)&cmd_write_reg_bit_field_value, - NULL, - }, -}; - -/* *** WRITE PORT REGISTER BIT *** */ -struct cmd_write_reg_bit_result { - cmdline_fixed_string_t write; - cmdline_fixed_string_t regbit; - portid_t port_id; - uint32_t reg_off; - uint8_t bit_pos; - uint8_t value; -}; - -static void -cmd_write_reg_bit_parsed(void *parsed_result, - __rte_unused struct cmdline *cl, - __rte_unused void *data) -{ - struct cmd_write_reg_bit_result *res = parsed_result; - port_reg_bit_set(res->port_id, res->reg_off, res->bit_pos, res->value); -} - -static cmdline_parse_token_string_t cmd_write_reg_bit_write = - TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result, write, - "write"); -static cmdline_parse_token_string_t cmd_write_reg_bit_regbit = - TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result, - regbit, "regbit"); -static cmdline_parse_token_num_t cmd_write_reg_bit_port_id = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, port_id, - RTE_UINT16); -static cmdline_parse_token_num_t cmd_write_reg_bit_reg_off = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, reg_off, - RTE_UINT32); -static cmdline_parse_token_num_t cmd_write_reg_bit_bit_pos = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, bit_pos, - RTE_UINT8); -static cmdline_parse_token_num_t cmd_write_reg_bit_value = - TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, value, - RTE_UINT8); - -static cmdline_parse_inst_t cmd_write_reg_bit = { - .f = cmd_write_reg_bit_parsed, - .data = NULL, - .help_str = "write regbit 0|1: " - "0 <= bit_x <= 31", - .tokens = { - (void *)&cmd_write_reg_bit_write, - (void *)&cmd_write_reg_bit_regbit, - (void *)&cmd_write_reg_bit_port_id, - (void *)&cmd_write_reg_bit_reg_off, - (void *)&cmd_write_reg_bit_bit_pos, - (void *)&cmd_write_reg_bit_value, - NULL, - }, -}; - /* *** READ A RING DESCRIPTOR OF A PORT RX/TX QUEUE *** */ struct cmd_read_rxd_txd_result { cmdline_fixed_string_t read; @@ -14222,12 +13893,6 @@ static cmdline_parse_ctx_t builtin_ctx[] = { (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_queue_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, - (cmdline_parse_inst_t *)&cmd_read_reg, - (cmdline_parse_inst_t *)&cmd_read_reg_bit_field, - (cmdline_parse_inst_t *)&cmd_read_reg_bit, - (cmdline_parse_inst_t *)&cmd_write_reg, - (cmdline_parse_inst_t *)&cmd_write_reg_bit_field, - (cmdline_parse_inst_t *)&cmd_write_reg_bit, (cmdline_parse_inst_t *)&cmd_read_rxd_txd, (cmdline_parse_inst_t *)&cmd_stop, (cmdline_parse_inst_t *)&cmd_mac_addr, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index a2939867c4..3a53b616d8 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -1138,200 +1137,6 @@ vlan_id_is_invalid(uint16_t vlan_id) return 1; } -static int -port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off) -{ - const struct rte_pci_device *pci_dev; - const struct rte_bus *bus; - uint64_t pci_len; - - if (reg_off & 0x3) { - fprintf(stderr, - "Port register offset 0x%X not aligned on a 4-byte boundary\n", - (unsigned int)reg_off); - return 1; - } - - if (!ports[port_id].dev_info.device) { - fprintf(stderr, "Invalid device\n"); - return 0; - } - - bus = rte_bus_find_by_device(ports[port_id].dev_info.device); - if (bus && !strcmp(bus->name, "pci")) { - pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device); - } else { - fprintf(stderr, "Not a PCI device\n"); - return 1; - } - - pci_len = pci_dev->mem_resource[0].len; - if (reg_off >= pci_len) { - fprintf(stderr, - "Port %d: register offset %u (0x%X) out of port PCI resource (length=%"PRIu64")\n", - port_id, (unsigned int)reg_off, (unsigned int)reg_off, - pci_len); - return 1; - } - return 0; -} - -static int -reg_bit_pos_is_invalid(uint8_t bit_pos) -{ - if (bit_pos <= 31) - return 0; - fprintf(stderr, "Invalid bit position %d (must be <= 31)\n", bit_pos); - return 1; -} - -#define display_port_and_reg_off(port_id, reg_off) \ - printf("port %d PCI register at offset 0x%X: ", (port_id), (reg_off)) - -static inline void -display_port_reg_value(portid_t port_id, uint32_t reg_off, uint32_t reg_v) -{ - display_port_and_reg_off(port_id, (unsigned)reg_off); - printf("0x%08X (%u)\n", (unsigned)reg_v, (unsigned)reg_v); -} - -void -port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_x) -{ - uint32_t reg_v; - - - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; - if (port_reg_off_is_invalid(port_id, reg_off)) - return; - if (reg_bit_pos_is_invalid(bit_x)) - return; - reg_v = port_id_pci_reg_read(port_id, reg_off); - display_port_and_reg_off(port_id, (unsigned)reg_off); - printf("bit %d=%d\n", bit_x, (int) ((reg_v & (1 << bit_x)) >> bit_x)); -} - -void -port_reg_bit_field_display(portid_t port_id, uint32_t reg_off, - uint8_t bit1_pos, uint8_t bit2_pos) -{ - uint32_t reg_v; - uint8_t l_bit; - uint8_t h_bit; - - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; - if (port_reg_off_is_invalid(port_id, reg_off)) - return; - if (reg_bit_pos_is_invalid(bit1_pos)) - return; - if (reg_bit_pos_is_invalid(bit2_pos)) - return; - if (bit1_pos > bit2_pos) - l_bit = bit2_pos, h_bit = bit1_pos; - else - l_bit = bit1_pos, h_bit = bit2_pos; - - reg_v = port_id_pci_reg_read(port_id, reg_off); - reg_v >>= l_bit; - if (h_bit < 31) - reg_v &= ((1 << (h_bit - l_bit + 1)) - 1); - display_port_and_reg_off(port_id, (unsigned)reg_off); - printf("bits[%d, %d]=0x%0*X (%u)\n", l_bit, h_bit, - ((h_bit - l_bit) / 4) + 1, (unsigned)reg_v, (unsigned)reg_v); -} - -void -port_reg_display(portid_t port_id, uint32_t reg_off) -{ - uint32_t reg_v; - - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; - if (port_reg_off_is_invalid(port_id, reg_off)) - return; - reg_v = port_id_pci_reg_read(port_id, reg_off); - display_port_reg_value(port_id, reg_off, reg_v); -} - -void -port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos, - uint8_t bit_v) -{ - uint32_t reg_v; - - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; - if (port_reg_off_is_invalid(port_id, reg_off)) - return; - if (reg_bit_pos_is_invalid(bit_pos)) - return; - if (bit_v > 1) { - fprintf(stderr, "Invalid bit value %d (must be 0 or 1)\n", - (int) bit_v); - return; - } - reg_v = port_id_pci_reg_read(port_id, reg_off); - if (bit_v == 0) - reg_v &= ~(1 << bit_pos); - else - reg_v |= (1 << bit_pos); - port_id_pci_reg_write(port_id, reg_off, reg_v); - display_port_reg_value(port_id, reg_off, reg_v); -} - -void -port_reg_bit_field_set(portid_t port_id, uint32_t reg_off, - uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value) -{ - uint32_t max_v; - uint32_t reg_v; - uint8_t l_bit; - uint8_t h_bit; - - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; - if (port_reg_off_is_invalid(port_id, reg_off)) - return; - if (reg_bit_pos_is_invalid(bit1_pos)) - return; - if (reg_bit_pos_is_invalid(bit2_pos)) - return; - if (bit1_pos > bit2_pos) - l_bit = bit2_pos, h_bit = bit1_pos; - else - l_bit = bit1_pos, h_bit = bit2_pos; - - if ((h_bit - l_bit) < 31) - max_v = (1 << (h_bit - l_bit + 1)) - 1; - else - max_v = 0xFFFFFFFF; - - if (value > max_v) { - fprintf(stderr, "Invalid value %u (0x%x) must be < %u (0x%x)\n", - (unsigned)value, (unsigned)value, - (unsigned)max_v, (unsigned)max_v); - return; - } - reg_v = port_id_pci_reg_read(port_id, reg_off); - reg_v &= ~(max_v << l_bit); /* Keep unchanged bits */ - reg_v |= (value << l_bit); /* Set changed bits */ - port_id_pci_reg_write(port_id, reg_off, reg_v); - display_port_reg_value(port_id, reg_off, reg_v); -} - -void -port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t reg_v) -{ - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; - if (port_reg_off_is_invalid(port_id, reg_off)) - return; - port_id_pci_reg_write(port_id, reg_off, reg_v); - display_port_reg_value(port_id, reg_off, reg_v); -} - static uint32_t eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu) { diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 1a3fd9ce8a..144f28819c 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 1e01120ae9..fd6abc0f41 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c index 71849aaf96..8fafdec548 100644 --- a/app/test-pmd/iofwd.c +++ b/app/test-pmd/iofwd.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 79c9241d00..beb220fbb4 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index acb0fd7fb4..4f8deb3382 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index 74399178dd..8488efc138 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON') ext_deps += jansson_dep endif -deps += ['ethdev', 'cmdline', 'bus_pci'] +deps += ['ethdev', 'cmdline'] if dpdk_conf.has('RTE_CRYPTO_SCHEDULER') deps += 'crypto_scheduler' endif diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index e3c9757f3f..c77624302f 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c index 04457010f4..d528d4f34e 100644 --- a/app/test-pmd/rxonly.c +++ b/app/test-pmd/rxonly.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index addcbcac85..ee686393c5 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index fb2f5195d3..e4ba7147a3 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -7,8 +7,6 @@ #include -#include -#include #ifdef RTE_LIB_GRO #include #endif @@ -267,7 +265,7 @@ struct port_txqueue { * The data structure associated with each port. */ struct rte_port { - struct rte_eth_dev_info dev_info; /**< PCI info + driver name */ + struct rte_eth_dev_info dev_info; /**< Device info + driver name */ struct rte_eth_conf dev_conf; /**< Port configuration. */ struct rte_ether_addr eth_addr; /**< Port ethernet address */ struct rte_eth_stats stats; /**< Last port statistics */ @@ -801,65 +799,6 @@ mbuf_pool_find(unsigned int sock_id, uint16_t idx) return rte_mempool_lookup((const char *)pool_name); } -/** - * Read/Write operations on a PCI register of a port. - */ -static inline uint32_t -port_pci_reg_read(struct rte_port *port, uint32_t reg_off) -{ - const struct rte_pci_device *pci_dev; - const struct rte_bus *bus; - void *reg_addr; - uint32_t reg_v; - - if (!port->dev_info.device) { - fprintf(stderr, "Invalid device\n"); - return 0; - } - - bus = rte_bus_find_by_device(port->dev_info.device); - if (bus && !strcmp(bus->name, "pci")) { - pci_dev = RTE_DEV_TO_PCI(port->dev_info.device); - } else { - fprintf(stderr, "Not a PCI device\n"); - return 0; - } - - reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off); - reg_v = *((volatile uint32_t *)reg_addr); - return rte_le_to_cpu_32(reg_v); -} - -#define port_id_pci_reg_read(pt_id, reg_off) \ - port_pci_reg_read(&ports[(pt_id)], (reg_off)) - -static inline void -port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v) -{ - const struct rte_pci_device *pci_dev; - const struct rte_bus *bus; - void *reg_addr; - - if (!port->dev_info.device) { - fprintf(stderr, "Invalid device\n"); - return; - } - - bus = rte_bus_find_by_device(port->dev_info.device); - if (bus && !strcmp(bus->name, "pci")) { - pci_dev = RTE_DEV_TO_PCI(port->dev_info.device); - } else { - fprintf(stderr, "Not a PCI device\n"); - return; - } - - reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off); - *((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v); -} - -#define port_id_pci_reg_write(pt_id, reg_off, reg_value) \ - port_pci_reg_write(&ports[(pt_id)], (reg_off), (reg_value)) - static inline void get_start_cycles(uint64_t *start_tsc) { @@ -922,15 +861,6 @@ void update_fwd_ports(portid_t new_pid); void set_fwd_eth_peer(portid_t port_id, char *peer_addr); void port_mtu_set(portid_t port_id, uint16_t mtu); -void port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_pos); -void port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos, - uint8_t bit_v); -void port_reg_bit_field_display(portid_t port_id, uint32_t reg_off, - uint8_t bit1_pos, uint8_t bit2_pos); -void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off, - uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value); -void port_reg_display(portid_t port_id, uint32_t reg_off); -void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value); int port_action_handle_create(portid_t port_id, uint32_t id, const struct rte_flow_indir_action_conf *conf, const struct rte_flow_action *action); diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index e1bc78b73d..021624952d 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 330e34427d..7dacd6fb04 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -55,7 +55,6 @@ These are divided into sections and can be accessed using help, help section or help display : Displaying port, stats and config information. help config : Configuration information. help ports : Configuring ports. - help registers : Reading and setting port registers. help filters : Filters configuration help. help traffic_management : Traffic Management commands. help devices : Device related commands. @@ -2356,86 +2355,6 @@ manage link bonding devices from within testpmd interactive prompt. See :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information. -Register Functions ------------------- - -The Register Functions can be used to read from and write to registers on the network card referenced by a port number. -This is mainly useful for debugging purposes. -Reference should be made to the appropriate datasheet for the network card for details on the register addresses -and fields that can be accessed. - -read reg -~~~~~~~~ - -Display the value of a port register:: - - testpmd> read reg (port_id) (address) - -For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller:: - - testpmd> read reg 0 0xEE00 - port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241) - -read regfield -~~~~~~~~~~~~~ - -Display a port register bit field:: - - testpmd> read regfield (port_id) (address) (bit_x) (bit_y) - -For example, reading the lowest two bits from the register in the example above:: - - testpmd> read regfield 0 0xEE00 0 1 - port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1) - -read regbit -~~~~~~~~~~~ - -Display a single port register bit:: - - testpmd> read regbit (port_id) (address) (bit_x) - -For example, reading the lowest bit from the register in the example above:: - - testpmd> read regbit 0 0xEE00 0 - port 0 PCI register at offset 0xEE00: bit 0=1 - -write reg -~~~~~~~~~ - -Set the value of a port register:: - - testpmd> write reg (port_id) (address) (value) - -For example, to clear a register:: - - testpmd> write reg 0 0xEE00 0x0 - port 0 PCI register at offset 0xEE00: 0x00000000 (0) - -write regfield -~~~~~~~~~~~~~~ - -Set bit field of a port register:: - - testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value) - -For example, writing to the register cleared in the example above:: - - testpmd> write regfield 0 0xEE00 0 1 2 - port 0 PCI register at offset 0xEE00: 0x00000002 (2) - -write regbit -~~~~~~~~~~~~ - -Set single bit value of a port register:: - - testpmd> write regbit (port_id) (address) (bit_x) (value) - -For example, to set the high bit in the register from the example above:: - - testpmd> write regbit 0 0xEE00 31 1 - port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658) - Traffic Metering and Policing ----------------------------- -- 2.37.2