X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Ftxonly.c;h=b37cae574f06b22f5b915f06c8c123b9fa987483;hb=188b8ccdfec3dc5b15b4f55687e7db6b8265ba9f;hp=db8f37afcbe0a3b7ba15e33e3c124a220aa92421;hpb=92ebda07ee58cf6966305ba03b50b81debfb2d98;p=dpdk.git diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index db8f37afcb..b37cae574f 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -93,7 +93,7 @@ tx_mbuf_alloc(struct rte_mempool *mp) m = __rte_mbuf_raw_alloc(mp); __rte_mbuf_sanity_check_raw(m, 0); - return (m); + return m; } static void @@ -210,6 +210,7 @@ pkt_burst_transmit(struct fwd_stream *fs) uint64_t end_tsc; uint64_t core_cycles; #endif + uint32_t nb_segs, pkt_len; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES start_tsc = rte_rdtsc(); @@ -233,7 +234,12 @@ pkt_burst_transmit(struct fwd_stream *fs) } pkt->data_len = tx_pkt_seg_lengths[0]; pkt_seg = pkt; - for (i = 1; i < tx_pkt_nb_segs; i++) { + if (tx_pkt_split == TX_PKT_SPLIT_RND) + nb_segs = random() % tx_pkt_nb_segs + 1; + else + nb_segs = tx_pkt_nb_segs; + pkt_len = pkt->data_len; + for (i = 1; i < nb_segs; i++) { pkt_seg->next = tx_mbuf_alloc(mbp); if (pkt_seg->next == NULL) { pkt->nb_segs = i; @@ -242,6 +248,7 @@ pkt_burst_transmit(struct fwd_stream *fs) } pkt_seg = pkt_seg->next; pkt_seg->data_len = tx_pkt_seg_lengths[i]; + pkt_len += pkt_seg->data_len; } pkt_seg->next = NULL; /* Last segment of packet. */ @@ -266,8 +273,8 @@ pkt_burst_transmit(struct fwd_stream *fs) * 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_segs; + pkt->pkt_len = pkt_len; pkt->ol_flags = ol_flags; pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer;