From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id 66472374F for ; Tue, 2 May 2017 09:03:29 +0200 (CEST) Received: by mail-wr0-f178.google.com with SMTP id w50so73172394wrc.0 for ; Tue, 02 May 2017 00:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FmEfewVoqVgea1bTc2xYNvwkzl26T0JyV7nyFg9/9DQ=; b=1rdTKT5BZ45byg4uJHXHydzBbPfKpcncopb8J+XQ6tOPo5tzoRZjebcGGoUQYQqa/9 YU4p72XdiHUtWQwrFP6lbAxu6QujHtII7/auxlM3DxTjFE8YsAaigaoLX9UtIufpmbee JoeW/LPI6ecVzRp81doZnAOrfteecVBE6HZX9lkOjTV0v64nebuLYRHFGy11RaFYLwv5 XOhnaoXVFX+v3LPSR8QK/cig0QHO9mm7QjDBkW0Cw2aaJ4EPxLEWFyMrogm4qrR6U6rz drI27r9KoYrAZ7xeJrGzH3aO0tWNTv3kgplCjIcRi/aR1wcIwpbilqaejWIh5FPgq18L VsvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FmEfewVoqVgea1bTc2xYNvwkzl26T0JyV7nyFg9/9DQ=; b=XtP3MFjlJnxY2rN778UTY9s/2vgY2s9nhGEeeqBiaqAvDTv9B7JTjcwxBD2Q19eD0X SaA9/XPl6qlmsadOQAsG0b1LpZQvEWJ5munV9zna5tN4Mkxv4WMKBXnQdiu2dQ0vQxg7 lt8a0D6Iwi/3xyPbQKwWOYligAxpZ579ARUvQHwpl8cS7KmTVoh+oYjStHoNOf9cxpjQ tJrt7WGXKzbyFcsBVFK9IwG9b36S41RAiVIhFanpT+ACfPt3rUzQN8mlME+rpdV343xK Vm5Ztm5uokTqI7JfOrUV2ENG7L8F3blOn8SjTLO88eKL9tnKUhg39eldCmKBJSFWbOpO vJBg== X-Gm-Message-State: AN3rC/7CEjdime7FdCJZ4jeky23MS46Z/IkWQAqtkfILLbFJbak8S0Ev aCslxluiAhIp/UOG X-Received: by 10.223.142.213 with SMTP id q79mr17172951wrb.25.1493708608997; Tue, 02 May 2017 00:03:28 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id z90sm24335855wrc.36.2017.05.02.00.03.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 May 2017 00:03:28 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: "Wu, Jingjing" , "Lu, Wenzhuo" Date: Tue, 2 May 2017 09:03:18 +0200 Message-Id: <1493708598-24306-1-git-send-email-gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1493374226-24245-1-git-send-email-gaetan.rivet@6wind.com> References: <1493374226-24245-1-git-send-email-gaetan.rivet@6wind.com> Subject: [dpdk-dev] [PATCH v2] app/testpmd: configure event display 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: , X-List-Received-Date: Tue, 02 May 2017 07:03:29 -0000 Add two parameters to testpmd: --print-event --mask-event To enable or disable to printing of events. This display is configured on a per-event basis. By default, all except VF_MBOX are displayed. Fixes: 76ad4a2d82d4 ("app/testpmd: add generic event handler") Cc: "Lu, Wenzhuo" Signed-off-by: Gaetan Rivet --- Additionally, I'm thinking about runtime commands for events, in the form event show event print event mask where show could display the state of the masking for this event as well as statistics for the event. print and mask would do the same as the two parameters introduced by this patch. But this is a little heavier and I wanted to propose this fix as soon as possible. v1 -> v2: * Rebased on top of master * Fixed typos in doc --- app/test-pmd/parameters.c | 46 +++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.c | 13 +++++++++- app/test-pmd/testpmd.h | 2 ++ doc/guides/testpmd_app_ug/run_app.rst | 8 ++++++ 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 787e143..5a07dea 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -206,6 +206,10 @@ usage(char* progname) printf(" --no-rmv-interrupt: disable device removal interrupt.\n"); printf(" --bitrate-stats=N: set the logical core N to perform " "bit-rate calculation.\n"); + printf(" --print-event : " + "enable print of designated event"); + printf(" --mask-event : " + "disable print of designated event"); } #ifdef RTE_LIBRTE_CMDLINE @@ -503,6 +507,36 @@ parse_ringnuma_config(const char *q_arg) return 0; } +static int +parse_event_printing_config(const char *optarg, int enable) +{ + uint32_t mask = 0; + + if (!strcmp(optarg, "unknown")) + mask = UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN; + else if (!strcmp(optarg, "intr_lsc")) + mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_LSC; + else if (!strcmp(optarg, "queue_state")) + mask = UINT32_C(1) << RTE_ETH_EVENT_QUEUE_STATE; + else if (!strcmp(optarg, "intr_reset")) + mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET; + else if (!strcmp(optarg, "vf_mbox")) + mask = UINT32_C(1) << RTE_ETH_EVENT_VF_MBOX; + else if (!strcmp(optarg, "macsec")) + mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC; + else if (!strcmp(optarg, "intr_rmv")) + mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV; + else { + fprintf(stderr, "Invalid event: %s\n", optarg); + return -1; + } + if (enable) + event_print_mask |= mask; + else + event_print_mask &= ~mask; + return 0; +} + void launch_args_parse(int argc, char** argv) { @@ -581,6 +615,8 @@ launch_args_parse(int argc, char** argv) { "disable-link-check", 0, 0, 0 }, { "no-lsc-interrupt", 0, 0, 0 }, { "no-rmv-interrupt", 0, 0, 0 }, + { "print-event", 1, 0, 0 }, + { "mask-event", 1, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1036,6 +1072,16 @@ launch_args_parse(int argc, char** argv) lsc_interrupt = 0; if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt")) rmv_interrupt = 0; + if (!strcmp(lgopts[opt_idx].name, "print-event")) + if (parse_event_printing_config(optarg, 1)) { + rte_exit(EXIT_FAILURE, + "invalid print-event argument\n"); + } + if (!strcmp(lgopts[opt_idx].name, "mask-event")) + if (parse_event_printing_config(optarg, 0)) { + rte_exit(EXIT_FAILURE, + "invalid mask-event argument\n"); + } break; case 'h': diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index dfe6442..b9c385e 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -282,6 +282,17 @@ uint8_t lsc_interrupt = 1; /* enabled by default */ uint8_t rmv_interrupt = 1; /* enabled by default */ /* + * Display or mask ether events + * Default to all events except VF_MBOX + */ +uint32_t event_print_mask = (UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN) | + (UINT32_C(1) << RTE_ETH_EVENT_INTR_LSC) | + (UINT32_C(1) << RTE_ETH_EVENT_QUEUE_STATE) | + (UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET) | + (UINT32_C(1) << RTE_ETH_EVENT_MACSEC) | + (UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV); + +/* * NIC bypass mode configuration options. */ #ifdef RTE_NIC_BYPASS @@ -1806,7 +1817,7 @@ eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param) fprintf(stderr, "\nPort %" PRIu8 ": %s called upon invalid event %d\n", port_id, __func__, type); fflush(stderr); - } else { + } else if (event_print_mask & (UINT32_C(1) << type)) { printf("\nPort %" PRIu8 ": %s event\n", port_id, event_desc[type]); fflush(stdout); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 8b3d903..3c6a59a 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -308,6 +308,8 @@ extern uint8_t no_link_check; /**`` + + Enable printing the occurrence of the designated event. + +* ``--mask-event `` + + Disable printing the occurrence of the designated event. -- 2.1.4