usb/net: Fix MTU size

Commit 766101c was a wrong fix as NETUSB_MTU is the actual network MTU.
Instead of using this value in EEM/ECM drivers, a relevant value should
be set for each there.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-02-11 16:48:47 +01:00 committed by Anas Nashif
parent 846f84a20f
commit 28f499ee15
3 changed files with 8 additions and 4 deletions

View file

@ -27,6 +27,8 @@ LOG_MODULE_REGISTER(usb_ecm);
#include <class/usb_cdc.h>
#include "netusb.h"
#define ECM_FRAME_SIZE 1522
#define USB_CDC_ECM_REQ_TYPE 0x21
#define USB_CDC_SET_ETH_PKT_FILTER 0x43
@ -101,7 +103,7 @@ USBD_CLASS_DESCR_DEFINE(primary, 0) struct usb_cdc_ecm_config cdc_ecm_cfg = {
.bDescriptorSubtype = ETHERNET_FUNC_DESC,
.iMACAddress = 4,
.bmEthernetStatistics = sys_cpu_to_le32(0), /* None */
.wMaxSegmentSize = sys_cpu_to_le16(NETUSB_MTU),
.wMaxSegmentSize = sys_cpu_to_le16(ECM_FRAME_SIZE),
.wNumberMCFilters = sys_cpu_to_le16(0), /* None */
.bNumberPowerFilters = 0, /* No wake up */
},
@ -191,7 +193,7 @@ static struct usb_ep_cfg_data ecm_ep_data[] = {
},
};
static u8_t tx_buf[NETUSB_MTU], rx_buf[NETUSB_MTU];
static u8_t tx_buf[ECM_FRAME_SIZE], rx_buf[ECM_FRAME_SIZE];
static int ecm_class_handler(struct usb_setup_packet *setup, s32_t *len,
u8_t **data)

View file

@ -19,7 +19,9 @@ LOG_MODULE_REGISTER(usb_eem);
#include <class/usb_cdc.h>
#include "netusb.h"
static u8_t tx_buf[NETUSB_MTU], rx_buf[NETUSB_MTU];
#define EEM_FRAME_SIZE 1522
static u8_t tx_buf[EEM_FRAME_SIZE], rx_buf[EEM_FRAME_SIZE];
struct usb_cdc_eem_config {
struct usb_if_descriptor if0;

View file

@ -8,7 +8,7 @@
* USB definitions
*/
#define NETUSB_MTU 1522
#define NETUSB_MTU 1500
#define CDC_ECM_INT_EP_ADDR 0x83
#define CDC_ECM_IN_EP_ADDR 0x82