From: Subject: RE: [PATCH] r8152: limit MAC pass-through to one device Date: Wed, 10 Oct 2018 17:18:17 +0000 Message-ID: References: <20181010142933.31051-1-oneukum@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: , , , Return-path: Received: from esa6.dell-outbound.iphmx.com ([68.232.149.229]:3228 "EHLO esa6.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbeJKAlh (ORCPT ); Wed, 10 Oct 2018 20:41:37 -0400 Received: from pps.filterd (m0142693.ppops.net [127.0.0.1]) by mx0a-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9AHIP8a133269 for ; Wed, 10 Oct 2018 13:18:26 -0400 Received: from esa6.dell-outbound2.iphmx.com (esa6.dell-outbound2.iphmx.com [68.232.154.99]) by mx0a-00154901.pphosted.com with ESMTP id 2n1mvm89rd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 10 Oct 2018 13:18:26 -0400 In-Reply-To: <20181010142933.31051-1-oneukum@suse.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: >=20 > MAC address having to be unique, a MAC coming from the host > must be used at most once at a time. Hence the users must > be recorded and additional users must fall back to conventional > methods. I checked with the internal team and actually applies pass through MAC on b= oth Windows Realtek driver and in UEFI network stack this applies to ALL suppor= ted Realtek devices (R8153-AD). >=20 > Signed-off-by: Oliver Neukum > Fixes: 34ee32c9a5696 ("r8152: Add support for setting pass through MAC ad= dress on > RTL8153-AD") > --- > drivers/net/usb/r8152.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c > index f1b5201cc320..7345a2258ee4 100644 > --- a/drivers/net/usb/r8152.c > +++ b/drivers/net/usb/r8152.c > @@ -766,6 +766,9 @@ enum tx_csum_stat { > TX_CSUM_NONE > }; >=20 > +/* pass through MACs are per host, hence concurrent use is forbidden */ > +static struct r8152 *pass_through_user =3D NULL; > + > /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast= ). > * The RTL chips use a 64 element hash table based on the Ethernet CRC. > */ > @@ -1221,7 +1224,14 @@ static int set_ethernet_addr(struct r8152 *tp) > * or system doesn't provide valid _SB.AMAC this will be > * be expected to non-zero > */ > - ret =3D vendor_mac_passthru_addr_read(tp, &sa); > + if (!pass_through_user) { > + ret =3D vendor_mac_passthru_addr_read(tp, &sa); > + if (ret >=3D 0) > + /* we must record the user against concurrent use > */ > + pass_through_user =3D tp; > + } else { > + ret =3D -EBUSY; > + } > if (ret < 0) > ret =3D pla_ocp_read(tp, PLA_BACKUP, 8, sa.sa_data); > } > @@ -5304,6 +5314,8 @@ static void rtl8152_disconnect(struct usb_interface= *intf) > cancel_delayed_work_sync(&tp->hw_phy_work); > tp->rtl_ops.unload(tp); > free_netdev(tp->netdev); > + if (pass_through_user =3D=3D tp) > + pass_through_user =3D NULL; > } > } >=20 > -- > 2.16.4