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 96B34A0C44; Mon, 14 Jun 2021 14:42:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EC5B4067A; Mon, 14 Jun 2021 14:42:36 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id A1BB94003F for ; Mon, 14 Jun 2021 14:42:34 +0200 (CEST) IronPort-SDR: rb6JxWhGrwfdxilJqaDPyM9p+735msADlVIOaRPR6JQjkkBbIWXYukoYYZwphCE3I8VqdtG9Tv 0R4N73lM+T9A== X-IronPort-AV: E=McAfee;i="6200,9189,10014"; a="269651807" X-IronPort-AV: E=Sophos;i="5.83,273,1616482800"; d="scan'208";a="269651807" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2021 05:42:30 -0700 IronPort-SDR: ZN3DMudP7dQttiN99hYMqfbAVpkcUJS4iZ+gGJGTYjlrmYt3kZjCcVx7EmiTMou2dGOSNCwoY9 Luku/SwACVuw== X-IronPort-AV: E=Sophos;i="5.83,273,1616482800"; d="scan'208";a="451579636" Received: from amandee1-mobl.gar.corp.intel.com (HELO [10.213.127.90]) ([10.213.127.90]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2021 05:42:27 -0700 To: Ivan Malov , dev@dpdk.org Cc: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Ori Kam , Ray Kinsella , Neil Horman References: <20210527082504.3495-1-ivan.malov@oktetlabs.ru> From: "Singh, Aman Deep" Message-ID: <97d647fc-011a-d99b-4cf6-c2d35350a8bc@intel.com> Date: Mon, 14 Jun 2021 18:12:23 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210527082504.3495-1-ivan.malov@oktetlabs.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [dpdk-dev] [RFC PATCH] ethdev: add support for testpmd-compliant flow rule dumping 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 Sender: "dev" Hi Ivan, As a suggestion, can we add a check for debug log_level in "rte_flow_snprint" itself. So we can avoid CPU time, in cases where we don't want these logs. On 5/27/2021 1:55 PM, Ivan Malov wrote: > DPDK applications (for example, OvS) or tests which use RTE > flow API need to log created or rejected flow rules to help > to recognise what goes right or wrong. From this standpoint, > testpmd-compliant format is nice for the purpose because it > allows to copy-paste the flow rules and debug using testpmd. > > Recognisable pattern items: > VOID, VF, PF, PHY_PORT, PORT_ID, ETH, VLAN, IPV4, IPV6, UDP, > TCP, VXLAN, NVGRE, GENEVE, MARK, PPPOES, PPPOED. > > Recognisable actions: > VOID, JUMP, MARK, FLAG, QUEUE, DROP, COUNT, RSS, PF, VF, PHY_PORT, > PORT_ID, OF_POP_VLAN, OF_PUSH_VLAN, OF_SET_VLAN_VID, > OF_SET_VLAN_PCP, VXLAN_ENCAP, VXLAN_DECAP. > > Recognisable RSS types (action RSS): > IPV4, FRAG_IPV4, NONFRAG_IPV4_TCP, NONFRAG_IPV4_UDP, NONFRAG_IPV4_OTHER, > IPV6, FRAG_IPV6, NONFRAG_IPV6_TCP, NONFRAG_IPV6_UDP, NONFRAG_IPV6_OTHER, > IPV6_EX, IPV6_TCP_EX, IPV6_UDP_EX, L3_SRC_ONLY, L3_DST_ONLY, > L4_SRC_ONLY, L4_DST_ONLY. > > Unrecognised parts of the flow specification are represented by > tokens "{unknown}" and "{unknown bits}". Interested parties are > welcome to extend this tool to recognise more items and actions. > > Signed-off-by: Ivan Malov > > +int > +rte_flow_snprint(char *buf, size_t buf_size, size_t *nb_chars_total, > + const struct rte_flow_attr *attr, > + const struct rte_flow_item pattern[], > + const struct rte_flow_action actions[]) > +{ > + int rc; > + Like add a check with "rte_log_can_log()" and return from here. > + if (buf == NULL && buf_size != 0) > + return -EINVAL; > + > + *nb_chars_total = 0; > + > + rc = rte_flow_snprint_attr(buf, buf_size, nb_chars_total, attr); > + if (rc != 0) > + return rc; > + > + rc = rte_flow_snprint_pattern(buf, buf_size, nb_chars_total, pattern); > + if (rc != 0) > + return rc; > + > + rc = rte_flow_snprint_actions(buf, buf_size, nb_chars_total, actions); > + if (rc != 0) > + return rc; > + > + return 0; > +} Regards Aman