From: Eric Dumazet <eric.dumazet@gmail.com>
To: Alexei Starovoitov <ast@plumgrid.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jesper Dangaard Brouer <brouer@redhat.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net: pktgen: packet bursting via skb->xmit_more
Date: Tue, 30 Sep 2014 17:11:43 -0700 [thread overview]
Message-ID: <1412122303.16704.15.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <1412121820-28633-1-git-send-email-ast@plumgrid.com>
On Tue, 2014-09-30 at 17:03 -0700, Alexei Starovoitov wrote:
...
> static void pktgen_xmit(struct pktgen_dev *pkt_dev)
> {
> + unsigned int burst = ACCESS_ONCE(pkt_dev->burst), burst_cnt;
> struct net_device *odev = pkt_dev->odev;
> struct netdev_queue *txq;
> + bool more;
> int ret;
>
> /* If device is offline, then don't send */
> @@ -3347,8 +3363,14 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
> pkt_dev->last_ok = 0;
> goto unlock;
> }
> - atomic_inc(&(pkt_dev->skb->users));
> - ret = netdev_start_xmit(pkt_dev->skb, odev, txq, false);
> + atomic_add(burst, &pkt_dev->skb->users);
> +
> + burst_cnt = 0;
> +
It seems you dont really need @burst_cnt or @more in this function.
xmit_more:
ret = netdev_start_xmit(pkt_dev->skb, odev, txq, --burst > 0);
> +xmit_more:
> + more = ++burst_cnt < burst;
> +
> + ret = netdev_start_xmit(pkt_dev->skb, odev, txq, more);
>
> switch (ret) {
> case NETDEV_TX_OK:
> @@ -3356,6 +3378,8 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
> pkt_dev->sofar++;
> pkt_dev->seq_num++;
> pkt_dev->tx_bytes += pkt_dev->last_pkt_size;
> + if (more && !netif_xmit_frozen_or_drv_stopped(txq))
> + goto xmit_more;
if (burst > 0 && !netif_xmit_frozen_or_drv_stopped(txq))
goto xmit_more
> break;
> case NET_XMIT_DROP:
> case NET_XMIT_CN:
> @@ -3374,6 +3398,9 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
> atomic_dec(&(pkt_dev->skb->users));
> pkt_dev->last_ok = 0;
> }
> +
> + if (unlikely(burst - burst_cnt > 0))
> + atomic_sub(burst - burst_cnt, &pkt_dev->skb->users);
if (unlikely(burst))
atomic_sub(burst, &pkt_dev->skb->users);
> unlock:
> HARD_TX_UNLOCK(odev, txq);
>
> @@ -3572,6 +3599,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
> pkt_dev->svlan_p = 0;
> pkt_dev->svlan_cfi = 0;
> pkt_dev->svlan_id = 0xffff;
> + pkt_dev->burst = 1;
> pkt_dev->node = -1;
>
> err = pktgen_setup_dev(t->net, pkt_dev, ifname);
next prev parent reply other threads:[~2014-10-01 0:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 0:03 [PATCH net-next] net: pktgen: packet bursting via skb->xmit_more Alexei Starovoitov
2014-10-01 0:11 ` Eric Dumazet [this message]
2014-10-01 0:18 ` Alexei Starovoitov
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=1412122303.16704.15.camel@edumazet-glaptop2.roam.corp.google.com \
--to=eric.dumazet@gmail.com \
--cc=ast@plumgrid.com \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.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