From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id F36817E75 for ; Fri, 24 Oct 2014 05:16:15 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 23 Oct 2014 20:24:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,778,1406617200"; d="scan'208";a="619585291" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by fmsmga002.fm.intel.com with ESMTP; 23 Oct 2014 20:24:04 -0700 Received: from kmsmsx152.gar.corp.intel.com (172.21.73.87) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 24 Oct 2014 11:22:44 +0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by KMSMSX152.gar.corp.intel.com (172.21.73.87) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 24 Oct 2014 11:22:43 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.156]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.44]) with mapi id 14.03.0195.001; Fri, 24 Oct 2014 11:22:43 +0800 From: "Liang, Cunming" To: "dev@dpdk.org" , "Doherty, Declan" Thread-Topic: [dpdk-dev] [PATCH v4 5/8] test app: adding support for generating variable sized packet bursts Thread-Index: AQHP3JUy6Yay3YAA7Uer5w7ImDhRh5w+ubsQ Date: Fri, 24 Oct 2014 03:22:42 +0000 Message-ID: References: <1408456313-28812-1-git-send-email-declan.doherty@intel.com> <1412071079-7355-1-git-send-email-declan.doherty@intel.com> <1412071079-7355-6-git-send-email-declan.doherty@intel.com> In-Reply-To: <1412071079-7355-6-git-send-email-declan.doherty@intel.com> Accept-Language: zh-CN, 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 v4 5/8] test app: adding support for generating variable sized packet bursts X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:16:17 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty > Sent: Tuesday, September 30, 2014 5:58 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v4 5/8] test app: adding support for generatin= g > variable sized packet bursts >=20 >=20 > Signed-off-by: Declan Doherty > --- > app/test/packet_burst_generator.c | 25 ++++++++----------------- > app/test/packet_burst_generator.h | 6 +++++- > app/test/test_link_bonding.c | 14 +++++++++----- > 3 files changed, 22 insertions(+), 23 deletions(-) >=20 > diff --git a/app/test/packet_burst_generator.c > b/app/test/packet_burst_generator.c > index 9e747a4..b2824dc 100644 > --- a/app/test/packet_burst_generator.c > +++ b/app/test/packet_burst_generator.c > @@ -74,8 +74,7 @@ static inline void > copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned = offset) > { > if (offset + len <=3D pkt->data_len) { > - rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset, > - buf, (size_t) len); > + rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset, buf, > (size_t) len); > return; > } > copy_buf_to_pkt_segs(buf, len, pkt, offset); > @@ -191,20 +190,12 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uin= t32_t > src_addr, > */ > #define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned ch= ar. > */ >=20 > -#define TXONLY_DEF_PACKET_LEN 64 > -#define TXONLY_DEF_PACKET_LEN_128 128 > - > -uint16_t tx_pkt_length =3D TXONLY_DEF_PACKET_LEN; > -uint16_t tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT] =3D { > - TXONLY_DEF_PACKET_LEN_128, > -}; > - > -uint8_t tx_pkt_nb_segs =3D 1; >=20 > int > generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_bur= st, > struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, > - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst) > + uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, > + uint8_t pkt_len, uint8_t nb_pkt_segs) > { > int i, nb_pkt =3D 0; > size_t eth_hdr_size; > @@ -221,9 +212,9 @@ nomore_mbuf: > break; > } >=20 > - pkt->data_len =3D tx_pkt_seg_lengths[0]; > + pkt->data_len =3D pkt_len; > pkt_seg =3D pkt; > - for (i =3D 1; i < tx_pkt_nb_segs; i++) { > + for (i =3D 1; i < nb_pkt_segs; i++) { > pkt_seg->next =3D rte_pktmbuf_alloc(mp); > if (pkt_seg->next =3D=3D NULL) { > pkt->nb_segs =3D i; > @@ -231,7 +222,7 @@ nomore_mbuf: > goto nomore_mbuf; > } > pkt_seg =3D pkt_seg->next; > - pkt_seg->data_len =3D tx_pkt_seg_lengths[i]; > + pkt_seg->data_len =3D pkt_len; > } > pkt_seg->next =3D NULL; /* Last segment of packet. */ >=20 > @@ -259,8 +250,8 @@ nomore_mbuf: > * Complete first mbuf of packet and append it to the > * burst of packets to be transmitted. > */ > - pkt->nb_segs =3D tx_pkt_nb_segs; > - pkt->pkt_len =3D tx_pkt_length; > + pkt->nb_segs =3D nb_pkt_segs; > + pkt->pkt_len =3D pkt_len; > pkt->l2_len =3D eth_hdr_size; >=20 > if (ipv4) { > diff --git a/app/test/packet_burst_generator.h > b/app/test/packet_burst_generator.h > index 5b3cd6c..f86589e 100644 > --- a/app/test/packet_burst_generator.h > +++ b/app/test/packet_burst_generator.h > @@ -47,6 +47,9 @@ extern "C" { > #define IPV4_ADDR(a, b, c, d)(((a & 0xff) << 24) | ((b & 0xff) << 16) | = \ > ((c & 0xff) << 8) | (d & 0xff)) >=20 > +#define PACKET_BURST_GEN_PKT_LEN 60 > +#define PACKET_BURST_GEN_PKT_LEN_128 128 > + >=20 > void > initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_= mac, > @@ -68,7 +71,8 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_= t > src_addr, > int > generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_bur= st, > struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, > - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst); > + uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, > + uint8_t pkt_len, uint8_t nb_pkt_segs); >=20 > #ifdef __cplusplus > } > diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c > index 1a847eb..50355a3 100644 > --- a/app/test/test_link_bonding.c > +++ b/app/test/test_link_bonding.c > @@ -1338,7 +1338,8 @@ generate_test_burst(struct rte_mbuf **pkts_burst, > uint16_t burst_size, > /* Generate burst of packets to transmit */ > generated_burst_size =3D generate_packet_burst(test_params- > >mbuf_pool, > pkts_burst, test_params->pkt_eth_hdr, vlan, ip_hdr, > ipv4, > - test_params->pkt_udp_hdr, burst_size); > + test_params->pkt_udp_hdr, burst_size, > PACKET_BURST_GEN_PKT_LEN_128, > + 1); > if (generated_burst_size !=3D burst_size) { > printf("Failed to generate packet burst"); > return -1; > @@ -2056,7 +2057,7 @@ test_activebackup_tx_burst(void) > /* Generate a burst of packets to transmit */ > generated_burst_size =3D generate_packet_burst(test_params- > >mbuf_pool, > pkts_burst, test_params->pkt_eth_hdr, 0, > test_params->pkt_ipv4_hdr, > - 1, test_params->pkt_udp_hdr, burst_size); > + 1, test_params->pkt_udp_hdr, burst_size, > PACKET_BURST_GEN_PKT_LEN, 1); > if (generated_burst_size !=3D burst_size) > return -1; >=20 > @@ -2709,7 +2710,8 @@ test_balance_l2_tx_burst(void) > /* Generate a burst 1 of packets to transmit */ > if (generate_packet_burst(test_params->mbuf_pool, &pkts_burst[0][0], > test_params->pkt_eth_hdr, 0, test_params- > >pkt_ipv4_hdr, 1, > - test_params->pkt_udp_hdr, burst_size[0]) !=3D > burst_size[0]) > + test_params->pkt_udp_hdr, burst_size[0], > + PACKET_BURST_GEN_PKT_LEN, 1) !=3D burst_size[0]) > return -1; >=20 > initialize_eth_header(test_params->pkt_eth_hdr, > @@ -2718,7 +2720,8 @@ test_balance_l2_tx_burst(void) > /* Generate a burst 2 of packets to transmit */ > if (generate_packet_burst(test_params->mbuf_pool, &pkts_burst[1][0], > test_params->pkt_eth_hdr, 0, test_params- > >pkt_ipv4_hdr, 1, > - test_params->pkt_udp_hdr, burst_size[1]) !=3D > burst_size[1]) > + test_params->pkt_udp_hdr, burst_size[1], > + PACKET_BURST_GEN_PKT_LEN, 1) !=3D burst_size[1]) > return -1; >=20 > /* Send burst 1 on bonded port */ > @@ -3672,7 +3675,8 @@ test_broadcast_tx_burst(void) > /* Generate a burst of packets to transmit */ > generated_burst_size =3D generate_packet_burst(test_params- > >mbuf_pool, > pkts_burst, test_params->pkt_eth_hdr, 0, > test_params->pkt_ipv4_hdr, > - 1, test_params->pkt_udp_hdr, burst_size); > + 1, test_params->pkt_udp_hdr, burst_size, > PACKET_BURST_GEN_PKT_LEN, > + 1); > if (generated_burst_size !=3D burst_size) > return -1; >=20 > -- > 1.7.12.2 Acked-by: Cunming Liang