From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BEE70A04C7 for ; Mon, 14 Sep 2020 23:19:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1EF1EDE0; Mon, 14 Sep 2020 23:19:37 +0200 (CEST) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by dpdk.org (Postfix) with ESMTP id BF3E3160 for ; Mon, 14 Sep 2020 23:19:35 +0200 (CEST) Received: by mail-ej1-f48.google.com with SMTP id z22so1987507ejl.7 for ; Mon, 14 Sep 2020 14:19:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Zd57m1byPe89sGxTBpIMpZuT5+acqu2MNye7IXwrS9s=; b=vDr2G7k+WIaYWOo+xfswteJREX6NuSnSFWRnLkGTtvpeAGeeq1TtPBeC5a+FuiS2se SHK/aS27RBXd/jjfyn7cWsPbI5b3oWRRsy622Qsq290QrlDTPDlZD42vNt1BFCNGu50m +5aShJFxOj5aXj8eZfrRzY37/AZ53ZkszZIylM4Le90pMLeIqtHkUSNJ+ydNnh4wV9Pw DSSXsFFepcgf5QLc/ZTKAZNiOAqEtysvO2rTkImv5gy+D6EMA5CnVNk/lafyq9ikeqNu Yqlfccfly+6JiRUgSX3J53rYDVGijF0lukwofgKMFLHG/w+RSWWytUb7i+hbWrTQvRA6 irdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Zd57m1byPe89sGxTBpIMpZuT5+acqu2MNye7IXwrS9s=; b=rBrgQ6Q8Ru6qZLkR0FBgwnrIC1cFk6vGKqHjyY/HwiLEkgj4vouPMl7Sdhaaof4BAE 4AJghYUXa7Rsnht47KrxfhGRUHuIOte6pO7QTXX7HLY6JqpjOU+8AmeDpHk+HhdwFbjj FL4Xpn75ix/TsNSfHMjsQySym/RFq3SK6ckgAYeIFGKORY0y3DfWUFNQIDzKlj7cjtCg belYfOW3ILTpr9sm27flUHsTe0dPv7bGJt400vnur66ImLbblo0Pn9Go8nEigi5y04pU 4JXg9EQlLS6ThibiC4ImJpnrkC9UEMlNNnUFMM8JqhVJ6K75NDI5TCqBRKN8IutZsTuc 0vAA== X-Gm-Message-State: AOAM530pccsWUK22SjYvnkWBwutyl1XlYGSTpoynCgJTofQ8GKutcjai GiCslRYLcCXJGmtz6wHlRl2Fo620j4mMW1QfakH8pBD7mrktLQ== X-Google-Smtp-Source: ABdhPJx5X1Q/YqcnbbjHt8HH4Xujzzp/pbpYPnSdvl1E04hYVIwOVCTrkWt41FW4AS8xOFBofqspPafiOO9IwjEo4p4= X-Received: by 2002:a17:906:594c:: with SMTP id g12mr17222059ejr.347.1600118375482; Mon, 14 Sep 2020 14:19:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ravi Tandon Date: Mon, 14 Sep 2020 23:19:24 +0200 Message-ID: To: "Wiles, Keith" Cc: "users@dpdk.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-users] Replicating PCAP packets read by pktgen for multiple source addresses X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org Sender: "users" Dear Keith, I was able to make it work after some code review by calling rte_pktmbuf_free_bulk, after rte_eth_tx_burst. Regards, Ravi On Mon, Sep 14, 2020 at 7:52 PM Ravi Tandon wrote: > Dear Keith, > > After updating the refcnt value, I am able to transmit packet with > multiple source IPs but the transmission stops after some time, even if I > give > start command again, transmission never starts, please let me know if I > missed something, basically I want transmission forever unless stop command > is triggered. > > The updated code is as below, I added 3 lines having num_src_ip in them to > see whether my packets are transmitted burst x num_src_ip times, but > transmission stopped after sometime, and I am unable to start it > unless I restart pktgen > > static __inline__ void > pktgen_send_burst(port_info_t *info, uint16_t qid) > { > struct mbuf_table *mtab = &info->q[qid].tx_mbufs; > struct rte_mbuf **pkts; > struct qstats_s *qstats; > uint32_t ret, cnt, tap, rnd, tstamp, i; > int32_t seq_idx; > *uint32_t num_src_ip = 5; /*Hard coded for timebeing*/* > > if ((cnt = mtab->len) == 0) > return; > > mtab->len = 0; > pkts = mtab->m_table; > > if (pktgen_tst_port_flags(info, SEND_RANGE_PKTS)) > seq_idx = RANGE_PKT; > else if (pktgen_tst_port_flags(info, SEND_RATE_PACKETS)) > seq_idx = RATE_PKT; > else > seq_idx = SINGLE_PKT; > > tap = pktgen_tst_port_flags(info, PROCESS_TX_TAP_PKTS); > rnd = pktgen_tst_port_flags(info, SEND_RANDOM_PKTS); > tstamp = pktgen_tst_port_flags(info, (SEND_LATENCY_PKTS | > SEND_RATE_PACKETS)); > > qstats = &info->qstats[qid]; > qstats->txpkts += cnt; > for (i = 0; i < cnt; i++) { > qstats->txbytes += rte_pktmbuf_data_len(pkts[i]); > *rte_mbuf_refcnt_update(pkts[i], num_src_ip);* > } > > /* Send all of the packets before we can exit this function */ > while (cnt) { > if (rnd) > pktgen_rnd_bits_apply(info, pkts, cnt, NULL); > > if (tstamp) > pktgen_tstamp_apply(info, pkts, cnt, seq_idx); > > > *for(i = 0; i < num_src_ip; i++) *ret = rte_eth_tx_burst(info->pid, qid, > pkts, cnt); > > if (tap) > pktgen_do_tx_tap(info, pkts, ret); > > pkts += (ret); > cnt -= (ret); > } > } > > > Regards, > Ravi > > On Mon, Sep 14, 2020 at 6:03 PM Ravi Tandon > wrote: > >> Thanks Keith. >> >> I updated the refcnt and it worked. >> >> Regards, >> Ravi >> >> On Mon, Sep 14, 2020 at 3:30 PM Wiles, Keith >> wrote: >> >>> You can edit the packet in the function below, but you have to do that >>> action everytime. Freeing the mbuf I sok, you can look into the refcnt >>> value in the mbuf if you want tx_burst to not free the packet completely. >>> >>> >>> >>> *From: *users >>> *Date: *Sunday, September 13, 2020 at 5:00 PM >>> *To: *users@dpdk.org >>> *Subject: *[dpdk-users] Replicating PCAP packets read by pktgen for >>> multiple source addresses >>> >>> Hi, >>> >>> I want to use pktgen to read a pcap file and play that pcap file say 10 >>> times by editing the source IP address for each run, please let me know >>> what's the best way of doing this. >>> >>> I first thought of editing the source IP in the rte_mbuf pointed by pkts >>> before calling the rte_eth_tx_burst(info->pid, qid, pkts, cnt) function >>> but >>> it seems that rte_eth_tx_burst function frees up the rte_mbuf pointed by >>> pkts after sending the packet once so I cannot edit the pkts buffer >>> again. >>> >>> >>> static __inline__ void >>> trafficgen_send_burst(port_info_t *info, uint16_t qid) >>> { >>> struct mbuf_table *mtab = &info->q[qid].tx_mbufs; >>> struct rte_mbuf **pkts; >>> struct qstats_s *qstats; >>> uint32_t ret, cnt, tap, rnd, tstamp, i; >>> int32_t seq_idx; >>> >>> if ((cnt = mtab->len) == 0) >>> return; >>> >>> mtab->len = 0; >>> pkts = mtab->m_table; >>> >>> if (trafficgen_tst_port_flags(info, SEND_RANGE_PKTS)) >>> seq_idx = RANGE_PKT; >>> else if (trafficgen_tst_port_flags(info, SEND_RATE_PACKETS)) >>> seq_idx = RATE_PKT; >>> else >>> seq_idx = SINGLE_PKT; >>> >>> tap = trafficgen_tst_port_flags(info, PROCESS_TX_TAP_PKTS); >>> rnd = trafficgen_tst_port_flags(info, SEND_RANDOM_PKTS); >>> tstamp = trafficgen_tst_port_flags(info, (SEND_LATENCY_PKTS | >>> SEND_RATE_PACKETS)); >>> >>> qstats = &info->qstats[qid]; >>> qstats->txpkts += cnt; >>> for (i = 0; i < cnt; i++) >>> qstats->txbytes += rte_pktmbuf_data_len(pkts[i]); >>> >>> */*Inserting a for loop here doesn't help as rte_mbuf is freed by >>> rte_eth_tx_burst*/* >>> /* Send all of the packets before we can exit this function */ >>> while (cnt) { >>> >>> if (rnd) >>> trafficgen_rnd_bits_apply(info, pkts, cnt, NULL); >>> >>> if (tstamp) >>> trafficgen_tstamp_apply(info, pkts, cnt, seq_idx); >>> >>> ret = rte_eth_tx_burst(info->pid, qid, pkts, cnt); >>> >>> if (tap) >>> trafficgen_do_tx_tap(info, pkts, ret); >>> >>> pkts += ret; >>> cnt -= ret; >>> } >>> } >>> >>> Basically, I want to resend buffers stored in rte_mbuf again and again, >>> after modifying source IP in each run. >>> >>> Thanks >>> Ravi >>> >>