From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A807FA04FD; Tue, 14 Jan 2020 05:31:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 19A391C224; Tue, 14 Jan 2020 05:31:51 +0100 (CET) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by dpdk.org (Postfix) with ESMTP id E54B21C223 for ; Tue, 14 Jan 2020 05:31:48 +0100 (CET) Received: by mail-io1-f65.google.com with SMTP id k24so12352336ioc.4 for ; Mon, 13 Jan 2020 20:31:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CqHamWxhZ/UfPtMNTt0bt6PVG40T975n9U2GAkY08Ww=; b=Qr+sz9Ln/CjYquxseDY4Ff9+D9k+uAH0H2KeUfMf6InDFEvWMj8VBjwkJVWz3+fSPv 3KWIg6tPzEuEkBr9L6cSRaCaH3VWDc2XuBN+qI+ZKH27ZvgeWsYsl805nvysxdJyMiV2 ETq4O82XjZkWw2yDvDIi7NnZ5JkUFZQeqlLrETIaAN1EQo/vRIUVjPocDAy6omfrL7lr Jaa8IQbZTYjSJG8o7Mxc7Qz8bk2enO6QivjDC1ybwPHlM39TsAQWduBUEpU5+3LP11pv Ttk82a7amq43t1F6JB4e8SuxvO0cJmWMTa8tYOxtRZbhuMNNz1UY1ltqZvvKu9JBBQZd wiBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CqHamWxhZ/UfPtMNTt0bt6PVG40T975n9U2GAkY08Ww=; b=Hiq1ZoCtfkqcRh9oE4oeu4AEIU5cYD+BwcPUkkQPBLxevE3BDqSiO6T+IChk5h1d3T CUHK5NsrXUz8rLTe2pidJaZyPofy2dczZkmqLFKnVjEjx8vZo4A/x507ISWy9KHPVvC8 UNV0lvXyj2Ze1hhBHmVlXqtnV+ObPRaE/mIzeZ4zFO9hv65chWQvpuzVNDJqrBPYZ+17 QCfEW7zkVMdlVMDuBuHf3gMOmZMbrOXV7urZv+ArtUCiJE6CgXTyGFWhzP2MT1mlFnkC rmk+MKVTND1EibjQ7Tb+6Ebs4HOWhcJPhOVv5NLuRPF2ZHDK9506+zSee5rnNRMHAaYC 4zJA== X-Gm-Message-State: APjAAAW5jLgt/92n3tybksThHprzdHiVUuRVlw7xZGNeS8tS966fPQBP WGuFwUwfKonljbw+LraM6kNquv55Z/R9CRy79KazP2NYHaA= X-Google-Smtp-Source: APXvYqzaZmACseg48nPmApb+9SivOEHSxt1Afw9IWPjST8kHsc6VAQBVX3HGnzrUozEO6K7Nlj9hlK8eUyjcISBkVPQ= X-Received: by 2002:a5e:8e4d:: with SMTP id r13mr14386641ioo.60.1578976308123; Mon, 13 Jan 2020 20:31:48 -0800 (PST) MIME-Version: 1.0 References: <620a2408b0dd370b8483c452d2b5957b3144fac7.1578969179.git.jackmin@mellanox.com> In-Reply-To: <620a2408b0dd370b8483c452d2b5957b3144fac7.1578969179.git.jackmin@mellanox.com> From: Jerin Jacob Date: Tue, 14 Jan 2020 10:01:31 +0530 Message-ID: To: Xiaoyu Min Cc: Slava Ovsiienko , Matan Azrad , Raslan Darawsheh , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , Adrien Mazarguil , Ori Kam , dpdk-dev , Xueming Li Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [RFC 2/4] app/testpmd: new flow dump CLI 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" On Tue, Jan 14, 2020 at 9:15 AM Xiaoyu Min wrote: > > From: Xueming Li > > New flow dump CLI to dump MLX5 PMD specific flows into screen. > > Signed-off-by: Xueming Li > Signed-off-by: Xiaoyu Min > --- > app/test-pmd/Makefile | 4 ++ > app/test-pmd/cmdline_flow.c | 91 +++++++++++++++++++++++++++++++++++++ > app/test-pmd/config.c | 33 ++++++++++++++ > app/test-pmd/meson.build | 3 ++ > app/test-pmd/testpmd.h | 1 + > 5 files changed, 132 insertions(+) > > > +/** Dump all flow rules. */ > +int > +port_flow_dump(portid_t port_id __rte_unused, > + const char *file_name __rte_unused) > +{ > + int ret = 0; > +#ifdef RTE_LIBRTE_MLX5_PMD IMO, It should be the last resort to add driver-specific symbols in testpmd. Why not introduce rte_flow_dump() and hook the MLX driver underneath? > + FILE * file = stdout; > + > + if (file_name && strlen(file_name)) { > + file = fopen(file_name, "w"); > + if (!file) { > + printf("Failed to create file %s: %s\n", file_name, > + strerror(errno)); > + return -errno; > + } > + } > + ret = rte_pmd_mlx5_flow_dump(port_id, file); > + if (ret) > + printf("Failed to dump flow: %s\n", strerror(-ret)); > + else > + printf("Flow dump finished\n"); > + if (file_name && strlen(file_name)) > + fclose(file); > +#else > + printf("MLX5 PMD driver disabled\n"); > +#endif > + return ret; > +}