netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] r8152: Add MAC passthrough support to new device
@ 2020-01-14  4:41 Kai-Heng Feng
  2020-01-14  7:51 ` Prashant Malani
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Kai-Heng Feng @ 2020-01-14  4:41 UTC (permalink / raw)
  To: davem, hayeswang
  Cc: Kai-Heng Feng, Jakub Kicinski, Prashant Malani, Grant Grundler,
	Mario Limonciello, David Chen, open list:USB NETWORKING DRIVERS,
	open list:NETWORKING DRIVERS, open list

Device 0xa387 also supports MAC passthrough, therefore add it to the
whitelst.

BugLink: https://bugs.launchpad.net/bugs/1827961/comments/30
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/net/usb/r8152.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index c5ebf35d2488..42dcf1442cc0 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -6657,7 +6657,8 @@ static int rtl8152_probe(struct usb_interface *intf,
 	}
 
 	if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO &&
-	    le16_to_cpu(udev->descriptor.idProduct) == 0x3082)
+	    (le16_to_cpu(udev->descriptor.idProduct) == 0x3082 ||
+	     le16_to_cpu(udev->descriptor.idProduct) == 0xa387))
 		set_bit(LENOVO_MACPASSTHRU, &tp->flags);
 
 	if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial &&
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] r8152: Add MAC passthrough support to new device
  2020-01-14  4:41 [PATCH] r8152: Add MAC passthrough support to new device Kai-Heng Feng
@ 2020-01-14  7:51 ` Prashant Malani
  2020-01-14  8:03   ` Kai-Heng Feng
  2020-01-14  8:23 ` Oliver Neukum
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Prashant Malani @ 2020-01-14  7:51 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: David Miller, Hayes Wang, Jakub Kicinski, Grant Grundler,
	Mario Limonciello, David Chen, open list:USB NETWORKING DRIVERS,
	open list:NETWORKING DRIVERS, open list

On Mon, Jan 13, 2020 at 8:41 PM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> Device 0xa387 also supports MAC passthrough, therefore add it to the
> whitelst.
>
> BugLink: https://bugs.launchpad.net/bugs/1827961/comments/30
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/net/usb/r8152.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index c5ebf35d2488..42dcf1442cc0 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -6657,7 +6657,8 @@ static int rtl8152_probe(struct usb_interface *intf,
>         }
>
>         if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO &&
> -           le16_to_cpu(udev->descriptor.idProduct) == 0x3082)
> +           (le16_to_cpu(udev->descriptor.idProduct) == 0x3082 ||
> +            le16_to_cpu(udev->descriptor.idProduct) == 0xa387))
Perhaps we can try to use #define's for these vendor IDs (like
https://github.com/torvalds/linux/blob/master/drivers/net/usb/r8152.c#L680)
?

>                 set_bit(LENOVO_MACPASSTHRU, &tp->flags);
>
>         if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial &&
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] r8152: Add MAC passthrough support to new device
  2020-01-14  7:51 ` Prashant Malani
@ 2020-01-14  8:03   ` Kai-Heng Feng
  0 siblings, 0 replies; 9+ messages in thread
From: Kai-Heng Feng @ 2020-01-14  8:03 UTC (permalink / raw)
  To: Prashant Malani
  Cc: David Miller, Hayes Wang, Jakub Kicinski, Grant Grundler,
	Mario Limonciello, David Chen, open list:USB NETWORKING DRIVERS,
	open list:NETWORKING DRIVERS, open list



> On Jan 14, 2020, at 15:51, Prashant Malani <pmalani@chromium.org> wrote:
> 
> On Mon, Jan 13, 2020 at 8:41 PM Kai-Heng Feng
> <kai.heng.feng@canonical.com> wrote:
>> 
>> Device 0xa387 also supports MAC passthrough, therefore add it to the
>> whitelst.
>> 
>> BugLink: https://bugs.launchpad.net/bugs/1827961/comments/30
>> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>> ---
>> drivers/net/usb/r8152.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
>> index c5ebf35d2488..42dcf1442cc0 100644
>> --- a/drivers/net/usb/r8152.c
>> +++ b/drivers/net/usb/r8152.c
>> @@ -6657,7 +6657,8 @@ static int rtl8152_probe(struct usb_interface *intf,
>>        }
>> 
>>        if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO &&
>> -           le16_to_cpu(udev->descriptor.idProduct) == 0x3082)
>> +           (le16_to_cpu(udev->descriptor.idProduct) == 0x3082 ||
>> +            le16_to_cpu(udev->descriptor.idProduct) == 0xa387))
> Perhaps we can try to use #define's for these vendor IDs (like
> https://github.com/torvalds/linux/blob/master/drivers/net/usb/r8152.c#L680)
> ?

We can, but it'll bring some inconsistencies inside of rtl8152_table[], since we don't know idProduct for other devices.

Kai-Heng

> 
>>                set_bit(LENOVO_MACPASSTHRU, &tp->flags);
>> 
>>        if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial &&
>> --
>> 2.17.1
>> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] r8152: Add MAC passthrough support to new device
  2020-01-14  4:41 [PATCH] r8152: Add MAC passthrough support to new device Kai-Heng Feng
  2020-01-14  7:51 ` Prashant Malani
@ 2020-01-14  8:23 ` Oliver Neukum
  2020-01-14  9:22   ` Kai-Heng Feng
  2020-01-14 20:33 ` Mario.Limonciello
  2020-01-15  6:19 ` Hayes Wang
  3 siblings, 1 reply; 9+ messages in thread
From: Oliver Neukum @ 2020-01-14  8:23 UTC (permalink / raw)
  To: Kai-Heng Feng, davem, hayeswang
  Cc: Jakub Kicinski, Prashant Malani, Grant Grundler,
	Mario Limonciello, David Chen, open list:USB NETWORKING DRIVERS,
	open list:NETWORKING DRIVERS, open list

Am Dienstag, den 14.01.2020, 12:41 +0800 schrieb Kai-Heng Feng:
> Device 0xa387 also supports MAC passthrough, therefore add it to the
> whitelst.

Hi,

this list is getting longer and longer. Isn't there a way to do
this generically? ACPI?

	Regards
		Oliver


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] r8152: Add MAC passthrough support to new device
  2020-01-14  8:23 ` Oliver Neukum
@ 2020-01-14  9:22   ` Kai-Heng Feng
  0 siblings, 0 replies; 9+ messages in thread
From: Kai-Heng Feng @ 2020-01-14  9:22 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: David Miller, Hayes Wang, Jakub Kicinski, Prashant Malani,
	Grant Grundler, Mario Limonciello, David Chen,
	open list:USB NETWORKING DRIVERS, open list:NETWORKING DRIVERS,
	open list



> On Jan 14, 2020, at 16:23, Oliver Neukum <oneukum@suse.com> wrote:
> 
> Am Dienstag, den 14.01.2020, 12:41 +0800 schrieb Kai-Heng Feng:
>> Device 0xa387 also supports MAC passthrough, therefore add it to the
>> whitelst.
> 
> Hi,
> 
> this list is getting longer and longer. Isn't there a way to do
> this generically? ACPI?

ACPI only provides the MAC address, to write the MAC to r8152 it still requires hardware support.
So we need to use whitelist here, not all r8152 support this feature.

Kai-Heng

> 
> 	Regards
> 		Oliver
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] r8152: Add MAC passthrough support to new device
  2020-01-14  4:41 [PATCH] r8152: Add MAC passthrough support to new device Kai-Heng Feng
  2020-01-14  7:51 ` Prashant Malani
  2020-01-14  8:23 ` Oliver Neukum
@ 2020-01-14 20:33 ` Mario.Limonciello
  2020-01-15  6:40   ` Kai Heng Feng
  2020-01-15  6:19 ` Hayes Wang
  3 siblings, 1 reply; 9+ messages in thread
From: Mario.Limonciello @ 2020-01-14 20:33 UTC (permalink / raw)
  To: kai.heng.feng, davem, hayeswang
  Cc: jakub.kicinski, pmalani, grundler, David.Chen7, linux-usb,
	netdev, linux-kernel



> -----Original Message-----
> From: Kai-Heng Feng <kai.heng.feng@canonical.com>
> Sent: Monday, January 13, 2020 10:41 PM
> To: davem@davemloft.net; hayeswang@realtek.com
> Cc: Kai-Heng Feng; Jakub Kicinski; Prashant Malani; Grant Grundler; Limonciello,
> Mario; Chen7, David; open list:USB NETWORKING DRIVERS; open list:NETWORKING
> DRIVERS; open list
> Subject: [PATCH] r8152: Add MAC passthrough support to new device
> 
> 
> [EXTERNAL EMAIL]
> 
> Device 0xa387 also supports MAC passthrough, therefore add it to the
> whitelst.

Have you confirmed whether this product ID is unique to the products that
support this feature or if it's also re-used in other products?

For Dell's devices there are very specific tests that make sure that this
feature only applies on the products it is supposed to and nothing else
(For example RTL8153-AD checks variant as well as effuse value)
(Example two: RTL8153-BND is a Dell only part).

> 
> BugLink: https://bugs.launchpad.net/bugs/1827961/comments/30
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/net/usb/r8152.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index c5ebf35d2488..42dcf1442cc0 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -6657,7 +6657,8 @@ static int rtl8152_probe(struct usb_interface *intf,
>  	}
> 
>  	if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO &&
> -	    le16_to_cpu(udev->descriptor.idProduct) == 0x3082)
> +	    (le16_to_cpu(udev->descriptor.idProduct) == 0x3082 ||
> +	     le16_to_cpu(udev->descriptor.idProduct) == 0xa387))
>  		set_bit(LENOVO_MACPASSTHRU, &tp->flags);
> 
>  	if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial
> &&
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] r8152: Add MAC passthrough support to new device
  2020-01-14  4:41 [PATCH] r8152: Add MAC passthrough support to new device Kai-Heng Feng
                   ` (2 preceding siblings ...)
  2020-01-14 20:33 ` Mario.Limonciello
@ 2020-01-15  6:19 ` Hayes Wang
  3 siblings, 0 replies; 9+ messages in thread
From: Hayes Wang @ 2020-01-15  6:19 UTC (permalink / raw)
  To: Kai-Heng Feng, davem
  Cc: Jakub Kicinski, Prashant Malani, Grant Grundler,
	Mario Limonciello, David Chen, open list:USB NETWORKING DRIVERS,
	open list:NETWORKING DRIVERS, open list

Kai-Heng Feng [mailto:kai.heng.feng@canonical.com]
> Sent: Tuesday, January 14, 2020 12:41 PM
[...]
>  	if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO &&
> -	    le16_to_cpu(udev->descriptor.idProduct) == 0x3082)
> +	    (le16_to_cpu(udev->descriptor.idProduct) == 0x3082 ||
> +	     le16_to_cpu(udev->descriptor.idProduct) == 0xa387))

How about using
switch (le16_to_cpu(udev->descriptor.idProduct)) {
...
}

>  		set_bit(LENOVO_MACPASSTHRU, &tp->flags);
> 
>  	if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial
> &&
> --
> 2.17.1


Best Regards,
Hayes



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] r8152: Add MAC passthrough support to new device
  2020-01-14 20:33 ` Mario.Limonciello
@ 2020-01-15  6:40   ` Kai Heng Feng
  2020-01-15  7:04     ` Hayes Wang
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Heng Feng @ 2020-01-15  6:40 UTC (permalink / raw)
  To: Mario.Limonciello
  Cc: David Miller, hayeswang, Jakub Kicinski, pmalani, grundler,
	<David.Chen7@dell.com>,
	linux-usb, netdev, linux-kernel



> On Jan 15, 2020, at 4:33 AM, Mario.Limonciello@dell.com wrote:
> 
> 
> 
>> -----Original Message-----
>> From: Kai-Heng Feng <kai.heng.feng@canonical.com>
>> Sent: Monday, January 13, 2020 10:41 PM
>> To: davem@davemloft.net; hayeswang@realtek.com
>> Cc: Kai-Heng Feng; Jakub Kicinski; Prashant Malani; Grant Grundler; Limonciello,
>> Mario; Chen7, David; open list:USB NETWORKING DRIVERS; open list:NETWORKING
>> DRIVERS; open list
>> Subject: [PATCH] r8152: Add MAC passthrough support to new device
>> 
>> 
>> [EXTERNAL EMAIL]
>> 
>> Device 0xa387 also supports MAC passthrough, therefore add it to the
>> whitelst.
> 
> Have you confirmed whether this product ID is unique to the products that
> support this feature or if it's also re-used in other products?

This is unique for Lenovo product.

> 
> For Dell's devices there are very specific tests that make sure that this
> feature only applies on the products it is supposed to and nothing else
> (For example RTL8153-AD checks variant as well as effuse value)
> (Example two: RTL8153-BND is a Dell only part).

Hayes, do you know how macpassthru on Lenovo dock works?

Kai-Heng

> 
>> 
>> BugLink: https://bugs.launchpad.net/bugs/1827961/comments/30
>> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>> ---
>> drivers/net/usb/r8152.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
>> index c5ebf35d2488..42dcf1442cc0 100644
>> --- a/drivers/net/usb/r8152.c
>> +++ b/drivers/net/usb/r8152.c
>> @@ -6657,7 +6657,8 @@ static int rtl8152_probe(struct usb_interface *intf,
>> 	}
>> 
>> 	if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO &&
>> -	    le16_to_cpu(udev->descriptor.idProduct) == 0x3082)
>> +	    (le16_to_cpu(udev->descriptor.idProduct) == 0x3082 ||
>> +	     le16_to_cpu(udev->descriptor.idProduct) == 0xa387))
>> 		set_bit(LENOVO_MACPASSTHRU, &tp->flags);
>> 
>> 	if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial
>> &&
>> --
>> 2.17.1
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] r8152: Add MAC passthrough support to new device
  2020-01-15  6:40   ` Kai Heng Feng
@ 2020-01-15  7:04     ` Hayes Wang
  0 siblings, 0 replies; 9+ messages in thread
From: Hayes Wang @ 2020-01-15  7:04 UTC (permalink / raw)
  To: Kai Heng Feng, Mario.Limonciello
  Cc: David Miller, Jakub Kicinski, pmalani, grundler,
	<David.Chen7@dell.com>,
	linux-usb, netdev, linux-kernel

Kai Heng Feng [mailto:kai.heng.feng@canonical.com]
> Sent: Wednesday, January 15, 2020 2:40 PM
[...]
> >> Device 0xa387 also supports MAC passthrough, therefore add it to the
> >> whitelst.
> >
> > Have you confirmed whether this product ID is unique to the products that
> > support this feature or if it's also re-used in other products?
> 
> This is unique for Lenovo product.
> 
> >
> > For Dell's devices there are very specific tests that make sure that this
> > feature only applies on the products it is supposed to and nothing else
> > (For example RTL8153-AD checks variant as well as effuse value)
> > (Example two: RTL8153-BND is a Dell only part).
> 
> Hayes, do you know how macpassthru on Lenovo dock works?

I don't sure about it.

The Dell's devices use the VID/PID of Realtek, so they have another way
to check which devices support macpassthru.

The Lenovo use their VID/PID, so I guess they only check VID/PID.

Best Regards,
Hayes




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-01-15  7:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-14  4:41 [PATCH] r8152: Add MAC passthrough support to new device Kai-Heng Feng
2020-01-14  7:51 ` Prashant Malani
2020-01-14  8:03   ` Kai-Heng Feng
2020-01-14  8:23 ` Oliver Neukum
2020-01-14  9:22   ` Kai-Heng Feng
2020-01-14 20:33 ` Mario.Limonciello
2020-01-15  6:40   ` Kai Heng Feng
2020-01-15  7:04     ` Hayes Wang
2020-01-15  6:19 ` Hayes Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).