All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@free.fr>
To: Patrick McHardy <kaber@trash.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Andrian Nord <nightnord@gmail.com>,
	lxc-users@lists.sourceforge.net,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [Lxc-users] Bad checksums and lost packets with macvlan on dummy
Date: Tue, 01 Mar 2011 21:04:42 +0100	[thread overview]
Message-ID: <4D6D515A.8060707@free.fr> (raw)
In-Reply-To: <4D6D2402.6020705@trash.net>

On 03/01/2011 05:51 PM, Patrick McHardy wrote:
> On 01.03.2011 14:29, Daniel Lezcano wrote:
>> On 02/28/2011 08:45 AM, Eric Dumazet wrote:
>>>> In the normal case, dummy0 is supposed to drop the packets. But with
>>>> macvlan these packets are broadcasted to the other macvlan ports, so no
>>>> checksum is computed when the packets are transmitted between macvlan1
>>>> and macvlan2.
>>> So where frames get bad checksums ?
>>>
>>> In this "bridge" mode, I suspect the broadcast is done _before_ sending
>>> frame to dummy, so maybe macvlan should not inherit from lowerdev in
>>> this particular case ?
>> Hi Eric,
>>
>> yes, you are right, the packets are sent before.
>>
>> In the 'macvlan_queue_xmit', the code checks the dev is in 'bridge'
>> mode. If so, it looks if there is a destination port for the packet and
>> then calls the 'forward' callback which is 'dev_forward_skb'.
>>
>> I was able to reproduce the same problem with qemu and an emulated
>> 'e1000' card instead of dummy0. The packets are dropped too.
>>
>> Patrick, do you have any suggestions to fix this ?
> Since the frames are only looped back locally, I suppose the easiest
> fix would be to mark them with CHECKSUM_UNNECESSARY. Alternatively
> we need to complete the checksum manually, similar to what
> dev_hard_start_xmit() does.

That sounds very simple to fix, maybe too much simple :)

I did the following change:

---
  drivers/net/macvlan.c |    1 +
  1 file changed, 1 insertion(+)

Index: linux-next/drivers/net/macvlan.c
===================================================================
--- linux-next.orig/drivers/net/macvlan.c
+++ linux-next/drivers/net/macvlan.c
@@ -222,6 +222,7 @@ static int macvlan_queue_xmit(struct sk_

         if (vlan->mode == MACVLAN_MODE_BRIDGE) {
                 const struct ethhdr *eth = (void *)skb->data;
+               skb->ip_summed = CHECKSUM_UNNECESSARY;

                 /* send to other bridge ports directly */
                 if (is_multicast_ether_addr(eth->h_dest)) {


and that fixed the problem. Do you think it is acceptable ?

Thanks

   -- Daniel

  reply	other threads:[~2011-03-01 20:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110221150710.GA5651@nord.niifaq.ru>
     [not found] ` <4D6282DB.2080204@free.fr>
     [not found]   ` <20110221153421.GA6602@nord.niifaq.ru>
2011-02-21 16:07     ` [Lxc-users] Huge ammount of invalid checksum packets on macvlan Daniel Lezcano
     [not found]       ` <4D628DC3.9000400-GANU6spQydw@public.gmane.org>
2011-02-21 17:39         ` Andrian Nord
2011-02-23 17:13       ` [Lxc-users] Bad checksums and lost packets with macvlan on dummy Andrian Nord
2011-02-24 10:20         ` Daniel Lezcano
2011-02-26 20:38           ` Andrian Nord
2011-02-27 15:14         ` Daniel Lezcano
2011-02-27 19:50           ` Eric Dumazet
2011-02-27 20:35             ` Daniel Lezcano
2011-02-28  7:45               ` [Lxc-users] " Eric Dumazet
2011-03-01 13:29                 ` Daniel Lezcano
2011-03-01 16:51                   ` Patrick McHardy
2011-03-01 20:04                     ` Daniel Lezcano [this message]
2011-03-02 11:03                       ` Patrick McHardy
2011-03-02 16:03                         ` Daniel Lezcano
2011-03-02 18:03                           ` Patrick McHardy
2011-03-02 18:33                             ` Daniel Lezcano
2011-03-03 14:30                               ` Changli Gao
2011-03-08 14:41                               ` Patrick McHardy
     [not found]                                 ` <4D764030.8020202-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org>
2011-03-12 21:59                                   ` Daniel Lezcano
2011-03-12 22:07                                     ` [Lxc-users] " Daniel Lezcano

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=4D6D515A.8060707@free.fr \
    --to=daniel.lezcano@free.fr \
    --cc=eric.dumazet@gmail.com \
    --cc=kaber@trash.net \
    --cc=lxc-users@lists.sourceforge.net \
    --cc=netdev@vger.kernel.org \
    --cc=nightnord@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.