From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80075.outbound.protection.outlook.com [40.107.8.75]) by dpdk.org (Postfix) with ESMTP id D44034CA5 for ; Wed, 3 Oct 2018 17:11:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iT0NeDOP/9BF/MoTxk1VzK5LMSpRoYuJdErhqJmynbU=; b=x6pQmzhrKz2/lZyatMWi/zBhUzARzYTqNUZrpweTc34J5+XO3IgOsSubGsJuCYtpL8TiTleBL2G20qQFP00XfaowZYgePLtSr5gJQAe1/QkuDe+95jntOURys6fWUnXcu0j86EDWmTDPSbofJmT6fsdoeLHUEdACfeTJOP4N3D8= Received: from DB5PR05MB1254.eurprd05.prod.outlook.com (10.162.157.140) by DB5PR05MB1238.eurprd05.prod.outlook.com (10.161.245.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.22; Wed, 3 Oct 2018 15:11:28 +0000 Received: from DB5PR05MB1254.eurprd05.prod.outlook.com ([fe80::3516:b329:5c35:51a5]) by DB5PR05MB1254.eurprd05.prod.outlook.com ([fe80::3516:b329:5c35:51a5%2]) with mapi id 15.20.1185.026; Wed, 3 Oct 2018 15:11:28 +0000 From: Raslan Darawsheh To: "Iremonger, Bernard" , "Wu, Jingjing" CC: Thomas Monjalon , "dev@dpdk.org" , Shahaf Shuler , "Xueming(Steven) Li" , Ori Katz , "jerin.jacob@caviumnetworks.com" , "david.marchand@6wind.com" Thread-Topic: [PATCH v2 1/3] app/testpmd: move dumping packets to a separate function Thread-Index: AQHUVAT4+O56diyQ4Eq0UB7BuKFsK6UMAZCAgAGs4XA= Date: Wed, 3 Oct 2018 15:11:28 +0000 Message-ID: References: <1536739583-29166-2-git-send-email-rasland@mellanox.com> <1537793304-27883-1-git-send-email-rasland@mellanox.com> <8CEF83825BEC744B83065625E567D7C260D0B986@IRSMSX107.ger.corp.intel.com> In-Reply-To: <8CEF83825BEC744B83065625E567D7C260D0B986@IRSMSX107.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; x-originating-ip: [82.213.2.186] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5PR05MB1238; 6:+bX69pLRSYYDn/+s2wLY/xgneVq6Vk7fLRjFznAJKkT9lFc1s7i/YMsMoO0GNuY904cF1FLYh82ENa+zFN1SuwMCxgdpp8Ts9CfhsDBBydQcpFysE9VaCw+8OfmWabrswivdc5Jy32qE6xWpvmlL2q2PuHSz6RCgOMgwJLTTXQUhvqJXoP6Gx6eXRYQD7btu4VysR7MNqb88lQbnhiuruAL+bHxyHF7gJpQdXxJ+q+pZaPxKuAAt3siARlYkxpF9JmtkSUlyIGa1QSlvth6icBBEq59iUglMSTkyhH5H7guQLu/G6xAOndkUFSkjdYImIgDoGSjatWU6EXKGO0cDtCkcqWsjGYlMxnp78EosTCguKBBqtjYJQjqnQtSgcdVAmXsdKIkwAJiXkNCaMFUehMXvd62sJjRgiNh+7wJhSxtRG5fQAVa/u4x4S/RZsFJsKV7nUbDT+R/7lRFSgLE0zw==; 5:rAQKPpaq+8DCFO01WTogxGTgSdTbXhry8qPf0ZcGj7goQjEIQ9Q6OonViJdMX+BRwXX3jZ0X01NaR4i4PBAxohPEavbB6MBNjQeXDaRtagiJhsAs4WTTf3y/ZdJkGCEHUFUWRAmzoUn1aAdBoVy58XLlqlytJN3BX7zzyYQjAuo=; 7:gXsgkK86QvVYki/4JXCy51O0nH+1cCHS8kBCVi54BvKdW6GDVOsTCEzPmuLBhkCbt//FzbBQA4ZebFxSkpwxTHPI6jxoACeF+GznxA+9ZTkL6QNrPCyj0EGtie1wo51D3FB4ADvnnXO5wW1R+ua4TjHaDVKoyp4FEFFYaXsy9mnWdI3aXI584Srq9xUzoFJb2TbA0+gQ3zNjZ3flM+ZTddOfcSfIpT5k5Ntk5byK1uYNFUrntTiVKRrFGZ1NK8/3 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: e91b1e21-28b6-4c6c-9ed3-08d629427e49 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB5PR05MB1238; x-ms-traffictypediagnostic: DB5PR05MB1238: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231355)(944501410)(52105095)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB5PR05MB1238; BCL:0; PCL:0; RULEID:; SRVR:DB5PR05MB1238; x-forefront-prvs: 0814A2C7A3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(39860400002)(136003)(376002)(346002)(13464003)(189003)(199004)(71200400001)(102836004)(53936002)(76176011)(6116002)(8936002)(6436002)(9686003)(6506007)(3846002)(8676002)(55016002)(81156014)(53546011)(81166006)(14454004)(305945005)(7736002)(486006)(476003)(478600001)(446003)(33656002)(74316002)(97736004)(68736007)(2900100001)(99286004)(11346002)(186003)(7696005)(5250100002)(26005)(2906002)(316002)(110136005)(54906003)(86362001)(106356001)(5660300001)(229853002)(25786009)(66066001)(4326008)(6246003)(105586002)(71190400001)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR05MB1238; H:DB5PR05MB1254.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: +44LqfQTEP1yn6fMhuGG1/gDT6s+McoX2IGClWmrHoJQY6kW+HNtHw5QOXneTt7nC+44223a9APBq//p+j3KAEPSyJUUcGD5c5THpYDiMviMvlfI2Of9HcPBBZvTxf1VPDjO4AZWUu2K4VRtunlG85gi2DPfiksTw7DkGEr/2DQpwV46verIVZTZ2ZzPx6l6cj+DOQW4FhU33TYiS+8ZWoFU2TRBZtBotNW0vpbOtBImB+bWcJf0BvqoDQPx23JIPj7yAG8SOOOO6F9aiIONi3Z9J37VYbtZew0bydrrckgZAsoPL2i2HNaUqzxggyhPkQbuSxqE1osEDEY/M6TgaUq/hxiVeXfMoRsl8PtOHuQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e91b1e21-28b6-4c6c-9ed3-08d629427e49 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2018 15:11:28.1647 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1238 Subject: Re: [dpdk-dev] [PATCH v2 1/3] app/testpmd: move dumping packets to a separate function 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: Wed, 03 Oct 2018 15:11:34 -0000 Hi Iremonger Berrnard,=20 Thx for the review, you are right about that I'm fixing these issues and I'= m sending a new version with the fixes now. Kindest regards, Raslan Darawsheh > -----Original Message----- > From: Iremonger, Bernard > Sent: Tuesday, October 2, 2018 4:36 PM > To: Raslan Darawsheh ; Wu, Jingjing > > Cc: Thomas Monjalon ; dev@dpdk.org; Shahaf > Shuler ; Xueming(Steven) Li > ; Ori Katz ; > jerin.jacob@caviumnetworks.com; david.marchand@6wind.com > Subject: RE: [PATCH v2 1/3] app/testpmd: move dumping packets to a > separate function >=20 > Hi Raslan, >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Raslan > Darawsheh > > Sent: Monday, September 24, 2018 1:49 PM > > To: Wu, Jingjing > > Cc: Thomas Monjalon ; dev@dpdk.org; Shahaf > Shuler > > ; Raslan Darawsheh ; > > Xueming(Steven) Li ; Ori Katz > > ; jerin.jacob@caviumnetworks.com; > > david.marchand@6wind.com > > Subject: [dpdk-dev] [PATCH v2 1/3] app/testpmd: move dumping packets > > to a separate function > > > > verbosity for the received/sent packets is needed in all of the > > forwarding engines so moving it to be in a separate function > > > > Signed-off-by: Raslan Darawsheh > > --- > > app/test-pmd/Makefile | 1 + >=20 > The app/test-pmd/meson.build should be updated for the util.c file. >=20 > > app/test-pmd/rxonly.c | 134 ++----------------------------------------= ---- > > app/test-pmd/util.c | 144 > > ++++++++++++++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 148 insertions(+), 131 deletions(-) create mode > > 100644 app/test-pmd/util.c > > > > > diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c new file mode > > 100644 index 0000000..97c8349 > > --- /dev/null > > +++ b/app/test-pmd/util.c > > @@ -0,0 +1,144 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(c) 2010-2018 Mellanox technology. > > + */ > > + > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "testpmd.h" > > + > > +static inline void > > +print_ether_addr(const char *what, struct ether_addr *eth_addr) { > > + char buf[ETHER_ADDR_FMT_SIZE]; > > + ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); > > + printf("%s%s", what, buf); > > +} > > + > > +static inline void > > +dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf > *pkts[], > > + uint16_t nb_pkts, int is_rx) > > +{ > > + struct rte_mbuf *mb; > > + struct ether_hdr *eth_hdr; > > + uint16_t eth_type; > > + uint64_t ol_flags; > > + uint16_t i, packet_type; > > + uint16_t is_encapsulation; > > + char buf[256]; > > + struct rte_net_hdr_lens hdr_lens; > > + uint32_t sw_packet_type; > > + > > + if (!nb_pkts) > > + return; > > + printf("port %u/queue %u: %s %u packets\n", > > + port_id, queue, > > + is_rx ? "received" : "sent", > > + (unsigned int) nb_pkts); > > + for (i =3D 0; i < nb_pkts; i++) { > > + mb =3D pkts[i]; > > + eth_hdr =3D rte_pktmbuf_mtod(mb, struct ether_hdr *); > > + eth_type =3D RTE_BE_TO_CPU_16(eth_hdr->ether_type); > > + ol_flags =3D mb->ol_flags; > > + packet_type =3D mb->packet_type; > > + is_encapsulation =3D RTE_ETH_IS_TUNNEL_PKT(packet_type); > > + > > + print_ether_addr(" src=3D", ð_hdr->s_addr); > > + print_ether_addr(" - dst=3D", ð_hdr->d_addr); > > + printf(" - type=3D0x%04x - length=3D%u - nb_segs=3D%d", > > + eth_type, (unsigned int) mb->pkt_len, > > + (int)mb->nb_segs); >=20 > Should the following line be reinstated here: > if (ol_flags & PKT_RX_RSS_HASH) { >=20 > > + printf(" - RSS hash=3D0x%x", (unsigned int) mb->hash.rss); > > + printf(" - RSS queue=3D0x%x", (unsigned int) queue); >=20 > Should the following line be reinstated here: > } >=20 > > + if (ol_flags & PKT_RX_FDIR) { > > + printf(" - FDIR matched "); > > + if (ol_flags & PKT_RX_FDIR_ID) > > + printf("ID=3D0x%x", > > + mb->hash.fdir.hi); > > + else if (ol_flags & PKT_RX_FDIR_FLX) > > + printf("flex bytes=3D0x%08x %08x", > > + mb->hash.fdir.hi, mb->hash.fdir.lo); > > + else > > + printf("hash=3D0x%x ID=3D0x%x ", > > + mb->hash.fdir.hash, mb->hash.fdir.id); > > + } > > + if (ol_flags & PKT_RX_TIMESTAMP) > > + printf(" - timestamp %"PRIu64" ", mb->timestamp); > > + if (ol_flags & PKT_RX_VLAN_STRIPPED) > > + printf(" - VLAN tci=3D0x%x", mb->vlan_tci); > > + if (ol_flags & PKT_RX_QINQ_STRIPPED) > > + printf(" - QinQ VLAN tci=3D0x%x, VLAN tci outer=3D0x%x", > > + mb->vlan_tci, mb->vlan_tci_outer); > > + if (mb->packet_type) { > > + rte_get_ptype_name(mb->packet_type, buf, > > sizeof(buf)); > > + printf(" - hw ptype: %s", buf); > > + } > > + sw_packet_type =3D rte_net_get_ptype(mb, &hdr_lens, > > + RTE_PTYPE_ALL_MASK); > > + rte_get_ptype_name(sw_packet_type, buf, sizeof(buf)); > > + printf(" - sw ptype: %s", buf); > > + if (sw_packet_type & RTE_PTYPE_L2_MASK) > > + printf(" - l2_len=3D%d", hdr_lens.l2_len); > > + if (sw_packet_type & RTE_PTYPE_L3_MASK) >=20 > The following blank line can be removed: >=20 > > + > > + printf(" - l4_len=3D%d", hdr_lens.l4_len); > > + if (sw_packet_type & RTE_PTYPE_TUNNEL_MASK) > > + printf(" - tunnel_len=3D%d", hdr_lens.tunnel_len); > > + if (sw_packet_type & RTE_PTYPE_INNER_L2_MASK) > > + printf(" - inner_l2_len=3D%d", hdr_lens.inner_l2_len); > > + if (sw_packet_type & RTE_PTYPE_INNER_L4_MASK) > > + printf(" - inner_l4_len=3D%d", hdr_lens.inner_l4_len); > > + if (is_encapsulation) { > > + struct ipv4_hdr *ipv4_hdr; > > + struct ipv6_hdr *ipv6_hdr; > > + struct udp_hdr *udp_hdr; > > + uint8_t l2_len; > > + uint8_t l3_len; > > + uint8_t l4_len; > > + uint8_t l4_proto; > > + struct vxlan_hdr *vxlan_hdr; > > + > > + l2_len =3D sizeof(struct ether_hdr); > > + > > + /* Do not support ipv4 option field */ > > + if (RTE_ETH_IS_IPV4_HDR(packet_type)) { > > + l3_len =3D sizeof(struct ipv4_hdr); > > + ipv4_hdr =3D rte_pktmbuf_mtod_offset(mb, > > + struct ipv4_hdr *, > > + l2_len); > > + l4_proto =3D ipv4_hdr->next_proto_id; > > + } else { > > + l3_len =3D sizeof(struct ipv6_hdr); > > + ipv6_hdr =3D rte_pktmbuf_mtod_offset(mb, > > + struct ipv6_hdr *, > > + l2_len); > > + l4_proto =3D ipv6_hdr->proto; > > + } > > + if (l4_proto =3D=3D IPPROTO_UDP) { > > + udp_hdr =3D rte_pktmbuf_mtod_offset(mb, > > + struct udp_hdr *, > > + l2_len + l3_len); > > + l4_len =3D sizeof(struct udp_hdr); > > + vxlan_hdr =3D rte_pktmbuf_mtod_offset(mb, > > + struct vxlan_hdr *, > > + l2_len + l3_len + l4_len); > > + > > + printf(" - VXLAN packet: packet type =3D%d, " > > + "Destination UDP port =3D%d, VNI =3D %d", > > + packet_type, >=20 > Suggest using local variables for be_to_cpu conversions to solve long lin= e > issue. >=20 > > + RTE_BE_TO_CPU_16(udp_hdr- > >dst_port), > > + rte_be_to_cpu_32(vxlan_hdr->vx_vni) > >> > > 8); > > + } > > + } > > + printf(" - %s queue=3D0x%x", is_rx ? "Receive" : "Send", > > + (unsigned int) queue); > > + printf("\n"); > > + rte_get_rx_ol_flag_list(mb->ol_flags, buf, sizeof(buf)); > > + printf(" ol_flags: %s\n", buf); > > + } > > +} > > -- > > 2.7.4 >=20 > Regards, >=20 > Bernard. >=20