lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 2 May 2014 22:55:55 +0800
From:	Zhouyi Zhou <zhouzhouyi@...il.com>
To:	John Fastabend <john.r.fastabend@...el.com>
Cc:	Jesper Dangaard Brouer <brouer@...hat.com>,
	David Miller <davem@...emloft.net>,
	steffen.klassert@...unet.com, fan.du@...driver.com,
	dborkman@...hat.com, Mathias Krause <minipli@...glemail.com>,
	tgraf@...g.ch, "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Zhouyi Zhou <yizhouzhou@....ac.cn>
Subject: Re: [PATCH] netdev: pktgen xmit packet through vlan interface

Thanks for reviewing

On Fri, May 2, 2014 at 10:00 PM, John Fastabend
<john.r.fastabend@...el.com> wrote:
> On 5/2/2014 6:19 AM, Jesper Dangaard Brouer wrote:
>>
>> On Fri,  2 May 2014 15:18:12 +0800
>> Zhouyi Zhou <zhouzhouyi@...il.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.
>>
>>
>> I really don't like adding this stuff to the fast path of pktgen.


>>
>> Why would you use pktgen on a VLAN?

I use pktgen on a VLAN under a special circumstance.

>
>
> Its a good way to test qdiscs. When you run pktgen over the VLAN
> you exercise the lower devices qdisc.
>
> Although I never submitted a patch like this because I figured it
> was a corner case and we would want to keep the hotpath clean.
>

I think is_vlan_dev(odev) have great chances to be in a cache line
that seldom got reset. Could we only judge is_vlan_dev(odev) in my
first if statement?


Also I guess if (nskb && !IS_ERR(nskb)) happens in rarely reached
cases when the interface is not overload.

>
>>
>> Why don't you use the "vlan_id" feature available in pktgen, and send
>> in the lower real device?

Could we automatically convert the VLAN device's joining effort to
real device + vlan_id settings in pkt_dev.
or could we issue a warning or a suggestion
when user try to add a VLAN device to the pktgen thread?

>>
>>
>>
>>> Signed-off-by: Zhouyi Zhou <yizhouzhou@....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:
>>
>>
>>
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ