From patchwork Mon Jan 20 13:45:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 64925 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 707BCA0528; Mon, 20 Jan 2020 14:46:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 334664C93; Mon, 20 Jan 2020 14:46:18 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id A85854C93 for ; Mon, 20 Jan 2020 14:46:16 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00KDjpma018863; Mon, 20 Jan 2020 05:46:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=UrQQEq13lRIAjNSoCyPQOu6RcQaSpSJUjMXSH2FxoJU=; b=dnvQ1HcZX6Ol+rPIxQExXBxdrYXk8YMvz2Ao4UcgLOBru2fQee7D1ANZlEGNyDx/vYGe AJ7PmTe/OFGRciSpFAV9Dk1peoDal1vWYGEPmjl7c+6oSY+ihI8eL9SXFGye+/s9qxoc gRu83KLbCKHrt1PpZc34kKYGXPfyNkoXKThNm1rXtAN2DEnFW2NvSUWYkTMaTuXJ0z/N P/flAaOUSUKtUGMU1pHQEYr1cjAe+XdtSaccSAX6QNsGY9fTGL1Qe9Ez8uuwoyJ3q2jU oswyV70qyPd8kMD1rzBkx3hz6xg76d/3dqMlyO/Z9Q0mpBKvhCqeVIRfDN9XHYvTrRo/ RQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2xm08v6jja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 20 Jan 2020 05:46:15 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 20 Jan 2020 05:46:14 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 20 Jan 2020 05:46:14 -0800 Received: from ajoseph83.caveonetworks.com (unknown [10.29.45.60]) by maili.marvell.com (Postfix) with ESMTP id 988F33F703F; Mon, 20 Jan 2020 05:46:10 -0800 (PST) From: Anoob Joseph To: Akhil Goyal , Radu Nicolau , Thomas Monjalon CC: Anoob Joseph , Jerin Jacob , Narayana Prasad , Ankur Dwivedi , Archana Muniganti , Tejasree Kondoj , Vamsi Attunuru , "Lukasz Bartosik" , Konstantin Ananyev , Date: Mon, 20 Jan 2020 19:15:12 +0530 Message-ID: <1579527918-360-7-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1579527918-360-1-git-send-email-anoobj@marvell.com> References: <1575808249-31135-1-git-send-email-anoobj@marvell.com> <1579527918-360-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-20_02:2020-01-20, 2020-01-20 signatures=0 Subject: [dpdk-dev] [PATCH v2 06/12] examples/ipsec-secgw: add routines to display config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add routines to display the eventmode configuration and provide an overview of the devices used. Signed-off-by: Anoob Joseph Signed-off-by: Lukasz Bartosik --- examples/ipsec-secgw/event_helper.c | 207 ++++++++++++++++++++++++++++++++++++ examples/ipsec-secgw/event_helper.h | 14 +++ 2 files changed, 221 insertions(+) diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c index e6569c1..883cb19 100644 --- a/examples/ipsec-secgw/event_helper.c +++ b/examples/ipsec-secgw/event_helper.c @@ -822,6 +822,210 @@ eh_initialize_tx_adapter(struct eventmode_conf *em_conf) return 0; } +static void +eh_display_operating_mode(struct eventmode_conf *em_conf) +{ + char sched_types[][32] = { + "RTE_SCHED_TYPE_ORDERED", + "RTE_SCHED_TYPE_ATOMIC", + "RTE_SCHED_TYPE_PARALLEL", + }; + EH_LOG_INFO("Operating mode:"); + + EH_LOG_INFO("\tScheduling type: \t%s", + sched_types[em_conf->ext_params.sched_type]); + + EH_LOG_INFO(""); +} + +static void +eh_display_event_dev_conf(struct eventmode_conf *em_conf) +{ + char queue_mode[][32] = { + "", + "ATQ (ALL TYPE QUEUE)", + "SINGLE LINK", + }; + char print_buf[256] = { 0 }; + int i; + + EH_LOG_INFO("Event Device Configuration:"); + + for (i = 0; i < em_conf->nb_eventdev; i++) { + sprintf(print_buf, + "\tDev ID: %-2d \tQueues: %-2d \tPorts: %-2d", + em_conf->eventdev_config[i].eventdev_id, + em_conf->eventdev_config[i].nb_eventqueue, + em_conf->eventdev_config[i].nb_eventport); + sprintf(print_buf + strlen(print_buf), + "\tQueue mode: %s", + queue_mode[em_conf->eventdev_config[i].ev_queue_mode]); + EH_LOG_INFO("%s", print_buf); + } + EH_LOG_INFO(""); +} + +static void +eh_display_rx_adapter_conf(struct eventmode_conf *em_conf) +{ + int nb_rx_adapter = em_conf->nb_rx_adapter; + struct rx_adapter_connection_info *conn; + struct rx_adapter_conf *adapter; + char print_buf[256] = { 0 }; + int i, j; + + EH_LOG_INFO("Rx adapters configured: %d", nb_rx_adapter); + + for (i = 0; i < nb_rx_adapter; i++) { + adapter = &(em_conf->rx_adapter[i]); + EH_LOG_INFO( + "\tRx adaper ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d" + "\tRx core: %-2d", + adapter->adapter_id, + adapter->nb_connections, + adapter->eventdev_id, + adapter->rx_core_id); + + for (j = 0; j < adapter->nb_connections; j++) { + conn = &(adapter->conn[j]); + + sprintf(print_buf, + "\t\tEthdev ID: %-2d", conn->ethdev_id); + + if (conn->ethdev_rx_qid == -1) + sprintf(print_buf + strlen(print_buf), + "\tEth rx queue: %-2s", "ALL"); + else + sprintf(print_buf + strlen(print_buf), + "\tEth rx queue: %-2d", + conn->ethdev_rx_qid); + + sprintf(print_buf + strlen(print_buf), + "\tEvent queue: %-2d", conn->eventq_id); + EH_LOG_INFO("%s", print_buf); + } + } + EH_LOG_INFO(""); +} + +static void +eh_display_tx_adapter_conf(struct eventmode_conf *em_conf) +{ + int nb_tx_adapter = em_conf->nb_tx_adapter; + struct tx_adapter_connection_info *conn; + struct tx_adapter_conf *adapter; + char print_buf[256] = { 0 }; + int i, j; + + EH_LOG_INFO("Tx adapters configured: %d", nb_tx_adapter); + + for (i = 0; i < nb_tx_adapter; i++) { + adapter = &(em_conf->tx_adapter[i]); + sprintf(print_buf, + "\tTx adapter ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d", + adapter->adapter_id, + adapter->nb_connections, + adapter->eventdev_id); + if (adapter->tx_core_id == (uint32_t)-1) + sprintf(print_buf + strlen(print_buf), + "\tTx core: %-2s", "[INTERNAL PORT]"); + else if (adapter->tx_core_id == RTE_MAX_LCORE) + sprintf(print_buf + strlen(print_buf), + "\tTx core: %-2s", "[NONE]"); + else + sprintf(print_buf + strlen(print_buf), + "\tTx core: %-2d,\tInput event queue: %-2d", + adapter->tx_core_id, adapter->tx_ev_queue); + + EH_LOG_INFO("%s", print_buf); + + for (j = 0; j < adapter->nb_connections; j++) { + conn = &(adapter->conn[j]); + + sprintf(print_buf, + "\t\tEthdev ID: %-2d", conn->ethdev_id); + + if (conn->ethdev_tx_qid == -1) + sprintf(print_buf + strlen(print_buf), + "\tEth tx queue: %-2s", "ALL"); + else + sprintf(print_buf + strlen(print_buf), + "\tEth tx queue: %-2d", + conn->ethdev_tx_qid); + EH_LOG_INFO("%s", print_buf); + } + } + EH_LOG_INFO(""); +} + +static void +eh_display_link_conf(struct eventmode_conf *em_conf) +{ + struct eh_event_link_info *link; + char print_buf[256] = { 0 }; + int i; + + EH_LOG_INFO("Links configured: %d", em_conf->nb_link); + + for (i = 0; i < em_conf->nb_link; i++) { + link = &(em_conf->link[i]); + + sprintf(print_buf, + "\tEvent dev ID: %-2d\tEvent port: %-2d", + link->eventdev_id, + link->event_port_id); + + if (em_conf->ext_params.all_ev_queue_to_ev_port) + sprintf(print_buf + strlen(print_buf), + "Event queue: %-2s\t", "ALL"); + else + sprintf(print_buf + strlen(print_buf), + "Event queue: %-2d\t", link->eventq_id); + + sprintf(print_buf + strlen(print_buf), + "Lcore: %-2d", link->lcore_id); + EH_LOG_INFO("%s", print_buf); + } + EH_LOG_INFO(""); +} + +void +eh_display_conf(struct eh_conf *conf) +{ + struct eventmode_conf *em_conf; + + if (conf == NULL) { + EH_LOG_ERR("Invalid event helper configuration"); + return; + } + + if (conf->mode != EH_PKT_TRANSFER_MODE_EVENT) + return; + + if (conf->mode_params == NULL) { + EH_LOG_ERR("Invalid event mode parameters"); + return; + } + + /* Get eventmode conf */ + em_conf = (struct eventmode_conf *)(conf->mode_params); + + /* Display user exposed operating modes */ + eh_display_operating_mode(em_conf); + + /* Display event device conf */ + eh_display_event_dev_conf(em_conf); + + /* Display Rx adapter conf */ + eh_display_rx_adapter_conf(em_conf); + + /* Display Tx adapter conf */ + eh_display_tx_adapter_conf(em_conf); + + /* Display event-lcore link */ + eh_display_link_conf(em_conf); +} + int32_t eh_devs_init(struct eh_conf *conf) { @@ -855,6 +1059,9 @@ eh_devs_init(struct eh_conf *conf) return ret; } + /* Display the current configuration */ + eh_display_conf(conf); + /* Stop eth devices before setting up adapter */ RTE_ETH_FOREACH_DEV(port_id) { diff --git a/examples/ipsec-secgw/event_helper.h b/examples/ipsec-secgw/event_helper.h index e76d764..d7191a6 100644 --- a/examples/ipsec-secgw/event_helper.h +++ b/examples/ipsec-secgw/event_helper.h @@ -17,6 +17,11 @@ extern "C" { RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,))) +#define EH_LOG_INFO(...) \ + RTE_LOG(INFO, EH, \ + RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ + __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,))) + /* Max event devices supported */ #define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS @@ -218,6 +223,15 @@ eh_devs_uninit(struct eh_conf *conf); uint8_t eh_get_tx_queue(struct eh_conf *conf, uint8_t eventdev_id); +/** + * Display event mode configuration + * + * @param conf + * Event helper configuration + */ +void +eh_display_conf(struct eh_conf *conf); + #ifdef __cplusplus } #endif