From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 69F03A494 for ; Tue, 16 Jan 2018 03:41:01 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2018 18:41:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,366,1511856000"; d="scan'208";a="10670076" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga008.fm.intel.com with ESMTP; 15 Jan 2018 18:41:00 -0800 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 Jan 2018 18:41:00 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 Jan 2018 18:40:59 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.189]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Tue, 16 Jan 2018 10:40:58 +0800 From: "Lu, Wenzhuo" To: Yongseok Koh , "Wu, Jingjing" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: make txonly mode generate multiple flows Thread-Index: AQHTdelWZAgb3g6rPE+a5B/3rjH9waN1+Vug Date: Tue, 16 Jan 2018 02:40:57 +0000 Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC09093B710FEA@shsmsx102.ccr.corp.intel.com> References: <20171215211125.39177-1-yskoh@mellanox.com> In-Reply-To: <20171215211125.39177-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] app/testpmd: make txonly mode generate multiple flows 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, 16 Jan 2018 02:41:01 -0000 Hi Yongseok, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yongseok Koh > Sent: Saturday, December 16, 2017 5:11 AM > To: Wu, Jingjing > Cc: dev@dpdk.org; Yongseok Koh > Subject: [dpdk-dev] [PATCH] app/testpmd: make txonly mode generate > multiple flows >=20 > Testpmd can generate multiple flows without taking much cost and this > could be a simple traffic generator for developer's quick tests. IP desti= nation > address is varied. >=20 > Signed-off-by: Yongseok Koh > --- > app/test-pmd/txonly.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index > 309c73893..aa4c379c4 100644 > --- a/app/test-pmd/txonly.c > +++ b/app/test-pmd/txonly.c > @@ -73,7 +73,7 @@ > #define UDP_DST_PORT 1024 >=20 > #define IP_SRC_ADDR ((192U << 24) | (168 << 16) | (0 << 8) | 1) -#define > IP_DST_ADDR ((192U << 24) | (168 << 16) | (0 << 8) | 2) > +#define IP_DST_ADDR ((192U << 24) | (168 << 16)) >=20 > #define IP_DEFTTL 64 /* from RFC 1340. */ > #define IP_VERSION 0x40 > @@ -81,6 +81,7 @@ > #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) >=20 > static struct ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packe= ts. */ > +static __thread uint8_t ip_var; /**< IP address variation */ > static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packet= s. > */ >=20 > static void > @@ -187,6 +188,7 @@ pkt_burst_transmit(struct fwd_stream *fs) > struct rte_mbuf *pkt_seg; > struct rte_mempool *mbp; > struct ether_hdr eth_hdr; > + struct ipv4_hdr *ip_hdr; > uint16_t nb_tx; > uint16_t nb_pkt; > uint16_t vlan_tci, vlan_tci_outer; > @@ -263,6 +265,14 @@ pkt_burst_transmit(struct fwd_stream *fs) > copy_buf_to_pkt(ð_hdr, sizeof(eth_hdr), pkt, 0); > copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, > sizeof(struct ether_hdr)); > + ip_hdr =3D rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, > + sizeof(struct ether_hdr)); > + /* > + * Generate multiple flows by varying IP dest addr. > + */ > + ip_hdr->dst_addr =3D > + rte_cpu_to_be_32(IP_DST_ADDR | (ip_var++ << 8) | > + (rte_lcore_id() + 1)); Just curious if we can avoid call rte_lcore_id for every packet? And suggest to add more explanation here, like purpose, scenario. So when w= e want to change the behavior, for example, like adding a parameter to make= IP addresses configurable, we know what we will break. > copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, > sizeof(struct ether_hdr) + > sizeof(struct ipv4_hdr)); > -- > 2.11.0