From: John Fastabend <john.fastabend@gmail.com>
To: netdev@vger.kernel.org
Cc: alexei.starovoitov@gmail.com, davem@davemloft.net, jhs@mojatatu.com
Subject: Re: [PATCH] net: pktgen: support injecting packets for qdisc testing
Date: Fri, 08 Jan 2016 07:38:36 -0800 [thread overview]
Message-ID: <568FD7FC.8020005@gmail.com> (raw)
In-Reply-To: <568FD5B7.2060602@gmail.com>
On 16-01-08 07:28 AM, John Fastabend wrote:
> On 16-01-07 06:09 PM, John Fastabend wrote:
>> Add another xmit_mode to pktgen to allow testing xmit functionality
>> of qdiscs. The new mode "queue_xmit" injects packets at
>> __dev_queue_xmit() so that qdisc is called.
>>
>> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>> ---
>
>
> [...]
>
>> } while (--burst > 0);
>> goto out; /* Skips xmit_mode M_START_XMIT */
>> + } else if (pkt_dev->xmit_mode == M_QUEUE_XMIT) {
>> + atomic_add(burst, &pkt_dev->skb->users);
>> + local_bh_disable();
>> +
>> + do {
>> + ret = dev_queue_xmit(pkt_dev->skb);
>> + switch (ret) {
>> + case NET_XMIT_SUCCESS:
>> + case NET_XMIT_DROP:
>> + case NET_XMIT_CN:
>> + case NET_XMIT_POLICED:
>> + /* These are all valid return codes for a qdisc so
>> + * unlike start_xmit report this as successful
>> + * transactions. I expect testers will be also be
>> + * reviewing qdisc stats for more details.
>> + */
>> + pkt_dev->last_ok = 1;
>> + pkt_dev->sofar++;
>> + pkt_dev->seq_num++;
>> + pkt_dev->tx_bytes += pkt_dev->last_pkt_size;
>> + break;
>> + case NETDEV_TX_LOCKED:
>> + case NETDEV_TX_BUSY:
>> + /* qdisc may call dev_hard_start_xmit directly in cases
>> + * where no queues exist e.g. loopback device, virtual
>> + * devices, etc. In this case we need to handle
>> + * NETDEV_TX_ codes.
>> + */
>> + pkt_dev->errors++;
>> + break;
>> + default:
>> + net_info_ratelimited("%s xmit error: %d\n",
>> + pkt_dev->odevname, ret);
>> + pkt_dev->errors++;
>> + break;
>> + }
>> + } while (--burst > 0);
>
>
> oops missed the case where burst != 0 here and we need to do an
> atomic_sub on skb->users.
>
> .John
>
Also I'll respin this with a change so xmit_{drop|cn|policed} are not
counted as tx_bytes and pkts sent (idea from Jamal). However I won't
abort the burst because I do like this stressing the entry point of my
qdisc.
.John
next prev parent reply other threads:[~2016-01-08 15:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-08 2:09 [PATCH] net: pktgen: support injecting packets for qdisc testing John Fastabend
2016-01-08 2:28 ` John Fastabend
2016-01-08 14:38 ` Jamal Hadi Salim
2016-01-08 15:24 ` John Fastabend
2016-01-09 0:41 ` John Fastabend
2016-01-10 14:09 ` Jamal Hadi Salim
2016-01-11 5:21 ` John Fastabend
2016-01-08 15:28 ` John Fastabend
2016-01-08 15:38 ` John Fastabend [this message]
2016-01-08 21:36 ` Eric Dumazet
2016-01-08 21:55 ` John Fastabend
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=568FD7FC.8020005@gmail.com \
--to=john.fastabend@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).