From: Cunming Liang <cunming.liang@intel.com> To: dev@dpdk.org Subject: [dpdk-dev] [PATCH v5 1/3] app/test: allow to create packets in different sizes Date: Fri, 24 Oct 2014 13:58:00 +0800 Message-ID: <1414130282-17981-2-git-send-email-cunming.liang@intel.com> (raw) In-Reply-To: <1414130282-17981-1-git-send-email-cunming.liang@intel.com> adding support to allow packet burst generator to create packets in differenct sizes Signed-off-by: Cunming Liang <cunming.liang@intel.com> Acked-by: Declan Doherty <declan.doherty@intel.com> --- app/test/packet_burst_generator.c | 26 ++++++++---------------- app/test/packet_burst_generator.h | 11 +++++++-- app/test/test_link_bonding.c | 39 ++++++++++++++++++++++++------------ 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 9e747a4..017139b 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -191,20 +191,12 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, */ #define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned char. */ -#define TXONLY_DEF_PACKET_LEN 64 -#define TXONLY_DEF_PACKET_LEN_128 128 - -uint16_t tx_pkt_length = TXONLY_DEF_PACKET_LEN; -uint16_t tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT] = { - TXONLY_DEF_PACKET_LEN_128, -}; - -uint8_t tx_pkt_nb_segs = 1; - int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - 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) + 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 pkt_len, + uint8_t nb_pkt_segs) { int i, nb_pkt = 0; size_t eth_hdr_size; @@ -221,9 +213,9 @@ nomore_mbuf: break; } - pkt->data_len = tx_pkt_seg_lengths[0]; + pkt->data_len = pkt_len; pkt_seg = pkt; - for (i = 1; i < tx_pkt_nb_segs; i++) { + for (i = 1; i < nb_pkt_segs; i++) { pkt_seg->next = rte_pktmbuf_alloc(mp); if (pkt_seg->next == NULL) { pkt->nb_segs = i; @@ -231,7 +223,7 @@ nomore_mbuf: goto nomore_mbuf; } pkt_seg = pkt_seg->next; - pkt_seg->data_len = tx_pkt_seg_lengths[i]; + pkt_seg->data_len = pkt_len; } pkt_seg->next = NULL; /* Last segment of packet. */ @@ -259,8 +251,8 @@ nomore_mbuf: * Complete first mbuf of packet and append it to the * burst of packets to be transmitted. */ - pkt->nb_segs = tx_pkt_nb_segs; - pkt->pkt_len = tx_pkt_length; + pkt->nb_segs = nb_pkt_segs; + pkt->pkt_len = pkt_len; pkt->l2_len = eth_hdr_size; if (ipv4) { diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 5b3cd6c..fe992ac 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -47,10 +47,13 @@ extern "C" { #define IPV4_ADDR(a, b, c, d)(((a & 0xff) << 24) | ((b & 0xff) << 16) | \ ((c & 0xff) << 8) | (d & 0xff)) +#define PACKET_BURST_GEN_PKT_LEN 60 +#define PACKET_BURST_GEN_PKT_LEN_128 128 void initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint8_t vlan_enabled, uint16_t van_id); + struct ether_addr *dst_mac, uint8_t vlan_enabled, + uint16_t van_id); uint16_t initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, @@ -67,8 +70,10 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - 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); + 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 pkt_len, + uint8_t nb_pkt_segs); #ifdef __cplusplus } diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 214d2a2..d407e4f 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -1192,9 +1192,12 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, } /* Generate burst of packets to transmit */ - generated_burst_size = 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); + generated_burst_size = + 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, + PACKET_BURST_GEN_PKT_LEN_128, 1); if (generated_burst_size != burst_size) { printf("Failed to generate packet burst"); return -1; @@ -1781,9 +1784,12 @@ test_activebackup_tx_burst(void) } /* Generate a burst of packets to transmit */ - generated_burst_size = 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); + generated_burst_size = + 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, + PACKET_BURST_GEN_PKT_LEN, 1); if (generated_burst_size != burst_size) return -1; @@ -2435,8 +2441,10 @@ 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]) != burst_size[0]) + test_params->pkt_eth_hdr, 0, + test_params->pkt_ipv4_hdr, 1, + test_params->pkt_udp_hdr, burst_size[0], + PACKET_BURST_GEN_PKT_LEN, 1) != burst_size[0]) return -1; initialize_eth_header(test_params->pkt_eth_hdr, @@ -2444,8 +2452,10 @@ 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]) != burst_size[1]) + test_params->pkt_eth_hdr, 0, + test_params->pkt_ipv4_hdr, 1, + test_params->pkt_udp_hdr, burst_size[1], + PACKET_BURST_GEN_PKT_LEN, 1) != burst_size[1]) return -1; /* Send burst 1 on bonded port */ @@ -3263,9 +3273,12 @@ test_broadcast_tx_burst(void) } /* Generate a burst of packets to transmit */ - generated_burst_size = 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); + generated_burst_size = + 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, + PACKET_BURST_GEN_PKT_LEN, 1); if (generated_burst_size != burst_size) return -1; -- 1.7.4.1
next prev parent reply other threads:[~2014-10-24 5:49 UTC|newest] Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-08-25 6:12 [dpdk-dev] [PATCH 0/5] app/test: unit test to measure cycles per packet Cunming Liang 2014-08-25 6:12 ` [dpdk-dev] [PATCH 1/5] app/test: unit test for rx and tx cycles/packet Cunming Liang 2014-08-25 6:12 ` [dpdk-dev] [PATCH 2/5] app/test: measure standalone rx or " Cunming Liang 2014-08-25 6:12 ` [dpdk-dev] [PATCH 3/5] ixgbe/vpmd: add fix to store unaligned mbuf point array Cunming Liang 2014-08-25 6:12 ` [dpdk-dev] [PATCH 4/5] app/test: add unit test to measure RX burst cycles Cunming Liang 2014-08-25 6:12 ` [dpdk-dev] [PATCH 5/5] app/test: allow to create packets in different sizes Cunming Liang 2014-09-03 1:46 ` [dpdk-dev] [PATCH 0/5] app/test: unit test to measure cycles per packet Zhan, Zhaochen 2014-10-10 12:29 ` [dpdk-dev] [PATCH v2 0/4] " Cunming Liang 2014-10-10 12:29 ` [dpdk-dev] [PATCH v2 1/4] app/test: unit test for rx and tx cycles/packet Cunming Liang 2014-10-10 17:52 ` Neil Horman 2014-10-12 11:10 ` Liang, Cunming [not found] ` <E115CCD9D858EF4F90C690B0DCB4D8972262B720@IRSMSX108.ger.corp.intel.com> 2014-10-14 0:54 ` Liang, Cunming 2014-10-21 10:33 ` Neil Horman 2014-10-21 10:43 ` Richardson, Bruce 2014-10-21 13:37 ` Neil Horman 2014-10-21 22:43 ` Ananyev, Konstantin 2014-10-21 13:17 ` Liang, Cunming 2014-10-22 14:03 ` Neil Horman 2014-10-22 14:48 ` Liang, Cunming 2014-10-22 14:53 ` Ananyev, Konstantin 2014-10-22 15:09 ` Richardson, Bruce 2014-10-24 3:06 ` Liang, Cunming 2014-10-10 12:29 ` [dpdk-dev] [PATCH v2 2/4] app/test: measure standalone rx or " Cunming Liang 2014-10-10 12:30 ` [dpdk-dev] [PATCH v2 3/4] app/test: add unit test to measure RX burst cycles Cunming Liang 2014-10-10 12:30 ` [dpdk-dev] [PATCH v2 4/4] app/test: allow to create packets in different sizes Cunming Liang 2014-10-20 8:13 ` [dpdk-dev] [PATCH v3 0/2] app/test: unit test to measure cycles per packet Cunming Liang 2014-10-20 8:13 ` [dpdk-dev] [PATCH v3 1/2] app/test: allow to create packets in different sizes Cunming Liang 2014-10-20 8:13 ` [dpdk-dev] [PATCH v3 2/2] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang 2014-10-21 2:40 ` [dpdk-dev] [PATCH v3 0/2] app/test: unit test to measure cycles per packet Liu, Yong 2014-10-24 5:39 ` [dpdk-dev] [PATCH v4 0/3] " Cunming Liang 2014-10-24 5:39 ` [dpdk-dev] [PATCH v4 1/3] app/test: allow to create packets in different sizes Cunming Liang 2014-10-24 5:39 ` [dpdk-dev] [PATCH v4 2/3] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang 2014-10-24 5:39 ` [dpdk-dev] [PATCH v4 3/3] ethdev: fix wrong error return refer to API definition Cunming Liang 2014-10-24 5:57 ` [dpdk-dev] [PATCH v5 0/3] app/test: unit test to measure cycles per packet Cunming Liang 2014-10-24 5:58 ` Cunming Liang [this message] 2014-10-24 5:58 ` [dpdk-dev] [PATCH v5 2/3] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang 2014-10-24 5:58 ` [dpdk-dev] [PATCH v5 3/3] ethdev: fix wrong error return refere to API definition Cunming Liang 2014-10-27 1:20 ` [dpdk-dev] [PATCH v6 0/3] app/test: unit test to measure cycles per packet Cunming Liang 2014-10-27 1:20 ` [dpdk-dev] [PATCH v6 1/3] app/test: allow to create packets in different sizes Cunming Liang 2014-10-27 1:20 ` [dpdk-dev] [PATCH v6 2/3] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang 2014-11-11 23:28 ` Thomas Monjalon 2014-11-12 6:32 ` Liang, Cunming 2014-10-27 1:20 ` [dpdk-dev] [PATCH v6 3/3] ethdev: fix wrong error return refere to API definition Cunming Liang 2014-10-27 16:03 ` Ananyev, Konstantin 2014-10-27 1:45 ` [dpdk-dev] [PATCH v6 0/3] app/test: unit test to measure cycles per packet Liu, Yong 2014-10-29 5:06 ` Liang, Cunming 2014-11-12 6:24 ` [dpdk-dev] [PATCH v7 0/7] " Cunming Liang 2014-11-12 6:24 ` [dpdk-dev] [PATCH v7 1/7] app/test: allow to create packets in different sizes Cunming Liang 2014-11-12 6:24 ` [dpdk-dev] [PATCH v7 2/7] ixgbe:clean scattered_rx configure in dev_stop Cunming Liang 2014-11-12 7:53 ` Thomas Monjalon 2014-11-12 8:21 ` Liang, Cunming 2014-11-12 9:24 ` Thomas Monjalon 2014-11-12 10:29 ` Liang, Cunming 2014-11-12 10:32 ` Thomas Monjalon 2014-11-12 10:42 ` Liang, Cunming 2014-11-12 6:24 ` [dpdk-dev] [PATCH v7 3/7] ether: new API to format eth_addr in string Cunming Liang 2014-11-12 6:24 ` [dpdk-dev] [PATCH v7 4/7] app/testpmd: cleanup eth_addr print Cunming Liang 2014-11-12 6:24 ` [dpdk-dev] [PATCH v7 5/7] examples: " Cunming Liang 2014-11-12 6:24 ` [dpdk-dev] [PATCH v7 6/7] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang 2014-11-12 6:24 ` [dpdk-dev] [PATCH v7 7/7] ethdev: fix wrong error return refere to API definition Cunming Liang 2014-11-12 23:50 ` [dpdk-dev] [PATCH v7 0/7] app/test: unit test to measure cycles per packet Thomas Monjalon 2014-10-24 5:59 ` [dpdk-dev] [PATCH v4 0/3] " Liang, Cunming [not found] ` <1414130090-17910-1-git-send-email-y> [not found] ` <1414130090-17910-4-git-send-email-y> 2014-10-24 11:04 ` [dpdk-dev] [PATCH v5 3/3] ethdev: fix wrong error return refere to API definition Ananyev, Konstantin 2014-10-27 0:58 ` Liang, Cunming 2014-10-28 12:21 ` [dpdk-dev] [PATCH v2 0/4] app/test: unit test to measure cycles per packet Neil Horman
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1414130282-17981-2-git-send-email-cunming.liang@intel.com \ --to=cunming.liang@intel.com \ --cc=dev@dpdk.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
DPDK patches and discussions This inbox may be cloned and mirrored by anyone: git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \ dev@dpdk.org public-inbox-index dev Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.dev AGPL code for this site: git clone https://public-inbox.org/public-inbox.git