From: Jiri Pirko <jiri@resnulli.us>
To: Zhouyi Zhou <zhouzhouyi@gmail.com>
Cc: davem@davemloft.net, steffen.klassert@secunet.com,
fan.du@windriver.com, dborkman@redhat.com,
minipli@googlemail.com, tgraf@suug.ch, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Zhouyi Zhou <yizhouzhou@ict.ac.cn>
Subject: Re: [PATCH] netdev: pktgen xmit packet through vlan interface
Date: Mon, 5 May 2014 17:43:18 +0200 [thread overview]
Message-ID: <20140505154318.GC2944@minipsycho.brq.redhat.com> (raw)
In-Reply-To: <1399015092-28643-1-git-send-email-zhouzhouyi@gmail.com>
Fri, May 02, 2014 at 09:18:12AM CEST, zhouzhouyi@gmail.com wrote:
>As http://www.spinics.net/lists/netdev/msg165015.html
>pktgen generates shared packet through vlan interface will cause
>oops because of duplicate entering tc queue.
>
>Try to solve this problem by means of packet clone instead of sharing.
Isn't this prohibited by:
dev->priv_flags &= ~(IFF_TX_SKB_SHARING);
?
>
>Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
>---
> net/core/pktgen.c | 20 +++++++++++++++++---
> 1 files changed, 17 insertions(+), 3 deletions(-)
>
>diff --git a/net/core/pktgen.c b/net/core/pktgen.c
>index 0304f98..ced07fc 100644
>--- a/net/core/pktgen.c
>+++ b/net/core/pktgen.c
>@@ -3297,6 +3297,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
> netdev_tx_t (*xmit)(struct sk_buff *, struct net_device *)
> = odev->netdev_ops->ndo_start_xmit;
> struct netdev_queue *txq;
>+ struct sk_buff *nskb = NULL;
> u16 queue_map;
> int ret;
>
>@@ -3347,8 +3348,18 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
> pkt_dev->last_ok = 0;
> goto unlock;
> }
>- atomic_inc(&(pkt_dev->skb->users));
>- ret = (*xmit)(pkt_dev->skb, odev);
>+
>+ if (pkt_dev->clone_skb && is_vlan_dev(odev)) {
>+ nskb = skb_clone(pkt_dev->skb, GFP_ATOMIC);
>+ ret = -ENOMEM;
>+ if (nskb)
>+ ret = (*xmit)(nskb, odev);
>+ else
>+ nskb = ERR_PTR(ret);
>+ } else {
>+ atomic_inc(&(pkt_dev->skb->users));
>+ ret = (*xmit)(pkt_dev->skb, odev);
>+ }
>
> switch (ret) {
> case NETDEV_TX_OK:
>@@ -3372,7 +3383,10 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
> case NETDEV_TX_LOCKED:
> case NETDEV_TX_BUSY:
> /* Retry it next time */
>- atomic_dec(&(pkt_dev->skb->users));
>+ if (nskb && !IS_ERR(nskb))
>+ kfree_skb(nskb);
>+ else
>+ atomic_dec(&(pkt_dev->skb->users));
> pkt_dev->last_ok = 0;
> }
> unlock:
>--
>1.7.1
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2014-05-05 15:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-02 7:18 [PATCH] netdev: pktgen xmit packet through vlan interface Zhouyi Zhou
2014-05-02 13:19 ` Jesper Dangaard Brouer
2014-05-02 14:00 ` John Fastabend
2014-05-02 14:55 ` Zhouyi Zhou
2014-05-05 15:12 ` Jesper Dangaard Brouer
2014-05-05 16:24 ` Ben Greear
2014-05-06 1:51 ` Zhouyi Zhou
2014-05-02 16:18 ` Sergei Shtylyov
2014-05-03 0:58 ` Zhouyi Zhou
2014-05-05 15:43 ` Jiri Pirko [this message]
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=20140505154318.GC2944@minipsycho.brq.redhat.com \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=fan.du@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minipli@googlemail.com \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=tgraf@suug.ch \
--cc=yizhouzhou@ict.ac.cn \
--cc=zhouzhouyi@gmail.com \
/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).