Topics

USB ECM buffer size


nicolas lantz <nicolas.lantz@...>
 

Hi,

I am working on a demo using Ethernet Over USB on the nrf52840.

In subsys/usb/class/netusb/

I saw a misalignement probleme between the :
        .wMaxSegmentSize = sys_cpu_to_le16(1514),
        declared in function_ecm.c
and the :
        #define NETUSB_MTU 1500
        declared in netusb.h

As rx_buf & tx_buf are defined with a NETUSB_MTU size, this cause that the frames over 1500 bytes can not be received and are discarded.


Secondly, as fragmentation is not supported (for UDP and TCP datagram), I suggest to increase the  NETUSB_MTU to the maximum of the possible ethernet frame size :1522

These modifications give :
    in netusb.h : #define NETUSB_MTU 1522
    in function_ecm.c : .wMaxSegmentSize = sys_cpu_to_le16(NETUSB_MTU),


Attached a patch.

--
Cordialement,
Nicolas

Nicolas LANTZ
M : +33 (0)6 19 07 43 43
T : +33 (0)9 52 96 81 86
www.ubicore.net


Andrei
 

Hi Nicolas,

On Mon, Jan 28, 2019 at 04:54:12PM +0100, nicolas lantz wrote:
Hi,

I am working on a demo using Ethernet Over USB on the nrf52840.

In subsys/usb/class/netusb/

I saw a misalignement probleme between the :
        .wMaxSegmentSize = sys_cpu_to_le16(1514),
        declared in function_ecm.c
and the :
        #define NETUSB_MTU 1500
        declared in netusb.h

As rx_buf & tx_buf are defined with a NETUSB_MTU size, this cause that the
frames over 1500 bytes can not be received and are discarded.

Secondly, as fragmentation is not supported (for UDP and TCP datagram), I
suggest to increase the  NETUSB_MTU to the maximum of the possible
ethernet frame size :1522

These modifications give :
    in netusb.h : #define NETUSB_MTU 1522
    in function_ecm.c : .wMaxSegmentSize = sys_cpu_to_le16(NETUSB_MTU),

Attached a patch.
Could you make a proper commit and send Pull Request on github?

Best regards
Andrei Emeltchenko