[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1412122303.16704.15.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Tue, 30 Sep 2014 17:11:43 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Alexei Starovoitov <ast@...mgrid.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net: pktgen: packet bursting via skb->xmit_more
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);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists