bce(4) and lagg(4) fix [was: bce(4) sees all incoming frames as 2026 bytes in length]

pluknet pluknet at gmail.com
Thu Apr 30 13:33:02 UTC 2009


2009/4/30 Nikolay Denev <ndenev at gmail.com>:
> On Apr 30, 2009, at 3:04 PM, Nikolay Denev wrote:
> [snip]
>>>
>>> I think I got it.
>>>
>>> It seems that the mbuf fields m_pkthdr.len and m_len are not updated to
>>> the real packet size pkt_len.
>>> Well, actually they are updated, but only if we have ZERO_COPY_SOCKETS
>>> defined.
>>>
>>> After I added this :
>>>
>>>   m0->m_pkthdr.len = m0->m_len = pkt_len;
>>>
>>> at about line 5930 in if_bce.c, the frame length reported by tcpdump
>>> seems correct.
>>>
>>> P.S.: I guess this could be the cause for the lagg(4) over bce(4)
>>> problems too?
>>>
>>> P.S.2: This fix will probably break the ZERO_COPY_SOCKETS case, but
>>> should be fairly easy to make it a "proper" fix.
>>>
>>> Regards,
>>> Niki Denev
>>>
>>
>> I can confirm that with this fix I was able to create lagg(4) interface in
>> "failover" mode with only one member, a  bce(4) interface, and it seems to
>> work OK.
>>
>>
>
> Here is the patch :
>
> --- sys/dev/bce/if_bce.c.orig   2009-04-30 14:06:54.000000000 +0200
> +++ sys/dev/bce/if_bce.c        2009-04-30 14:11:32.000000000 +0200
> @@ -5926,6 +5926,11 @@
>                        goto bce_rx_int_next_rx;
>                }
>
> +#ifndef ZERO_COPY_SOCKETS
> +               /* Adjust the packet length to match the received data. */
> +               m0->m_pkthdr.len = m0->m_len = pkt_len;
> +#endif
> +
>                /* Send the packet to the appropriate interface. */
>                m0->m_pkthdr.rcvif = ifp;
>

Ha-ha, you was fast! The only note: I think the comment part should be
consistent
with ZERO_COPY_SOCKETS case.

Thank you.

-- 
wbr,
pluknet


More information about the freebsd-net mailing list