Re: [PATCH net-next v2 RESEND] net/usb/r8153_ecm: support ECM mode for RTL8153

From: Marek Szyprowski
Date: Fri Nov 13 2020 - 10:30:01 EST


Hi Hayes,

On 04.11.2020 03:19, Hayes Wang wrote:
> Support ECM mode based on cdc_ether with relative mii functions,
> when CONFIG_USB_RTL8152 is not set, or the device is not supported
> by r8152 driver.
>
> Both r8152 and r8153_ecm would check the return value of
> rtl8152_get_version() in porbe(). If rtl8152_get_version()
> return none zero value, the r8152 is used for the device
> with vendor mode. Otherwise, the r8153_ecm is used for the
> device with ECM mode.
>
> Signed-off-by: Hayes Wang <hayeswang@xxxxxxxxxxx>

This patch landed recently in linux-next and breaks ethernet operation
on Samsung Exynos5422 Odroid XU4/HC1 boards when kernel is compiled from
arm/configs/multi_v7_defconfig. The main problem is that the hardware is
bound to r8153_ecm driver, not to the r8152. Manually switching the
drivers by "echo 4-1:2.0 >/sys/bus/usb/drivers/r8153_ecm/unbind && echo
4-1:2.0 >/sys/bus/usb/drivers/r8152/bind" fixes ethernet operation.

This is because in multi_v7_defconfig r8153_ecm driver is built-in (as
it is tied to CONFIG_USB_NET_CDCETHER), while the r8152 driver is
compiled as module and loaded when r8153_ecm has already bound.

I think that r8153_ecm driver should have a separate Kconfig symbol,
which matches the r8152 driver (either both are built-in or both as
modules), otherwise those 2 drivers cannot properly detect their cases.

> ---
> drivers/net/usb/Makefile | 2 +-
> drivers/net/usb/r8152.c | 30 +------
> drivers/net/usb/r8153_ecm.c | 162 ++++++++++++++++++++++++++++++++++++
> include/linux/usb/r8152.h | 37 ++++++++
> 4 files changed, 204 insertions(+), 27 deletions(-)
> create mode 100644 drivers/net/usb/r8153_ecm.c
> create mode 100644 include/linux/usb/r8152.h
>
> > ...

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland