lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 23 Aug 2022 15:48:13 +0000
From:   Hau <hau@...ltek.com>
To:     Andrew Lunn <andrew@...n.ch>
CC:     "hkallweit1@...il.com" <hkallweit1@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        nic_swsd <nic_swsd@...ltek.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "davem@...emloft.net" <davem@...emloft.net>
Subject: RE: [PATCH v3 net-next] r8169: add support for rtl8168h(revid 0x2a) + rtl8211fs fiber application

> > > > @@ -914,8 +952,12 @@ static void r8168g_mdio_write(struct
> > > rtl8169_private *tp, int reg, int value)
> > > >  	if (tp->ocp_base != OCP_STD_PHY_BASE)
> > > >  		reg -= 0x10;
> > > >
> > > > -	if (tp->ocp_base == OCP_STD_PHY_BASE && reg == MII_BMCR)
> > > > +	if (tp->ocp_base == OCP_STD_PHY_BASE && reg == MII_BMCR) {
> > > > +		if (tp->sfp_if_type != RTL_SFP_IF_NONE && value &
> > > BMCR_PDOWN)
> > > > +			return;
> > > > +
> > >
> > > Please could you explain this change.
> > H/W has issue. If we power down phy, then H/W will become abnormal.
> 
> Does the MAC break, or the PHY? If the PHY is the problem, the work around
> should be in the PHY driver, not the MAC driver.
>
It is a workaround. We did not get the root cause yet.

> > > > +/* MDIO bus init function */
> > > > +static int rtl_mdio_bitbang_init(struct rtl8169_private *tp) {
> > > > +	struct bb_info *bitbang;
> > > > +	struct device *d = tp_to_dev(tp);
> > > > +	struct mii_bus *new_bus;
> > > > +
> > > > +	/* create bit control struct for PHY */
> > > > +	bitbang = devm_kzalloc(d, sizeof(struct bb_info), GFP_KERNEL);
> > > > +	if (!bitbang)
> > > > +		return -ENOMEM;
> > > > +
> > > > +	/* bitbang init */
> > > > +	bitbang->tp = tp;
> > > > +	bitbang->ctrl.ops = &bb_ops;
> > > > +	bitbang->ctrl.op_c22_read = MDIO_READ;
> > > > +	bitbang->ctrl.op_c22_write = MDIO_WRITE;
> > > > +
> > > > +	/* MII controller setting */
> > > > +	new_bus = devm_mdiobus_alloc(d);
> > > > +	if (!new_bus)
> > > > +		return -ENOMEM;
> > > > +
> > > > +	new_bus->read = mdiobb_read;
> > > > +	new_bus->write = mdiobb_write;
> > > > +	new_bus->priv = &bitbang->ctrl;
> > >
> > > Please use alloc_mdio_bitbang().
> > >
> > I have tried to use alloc_mdio_bitbang(). But I will get error message "
> rmmod: ERROR: Module r8169 is in use " when I try to unload r8169.
> > After debug, I found it is cause by "__module_get(ctrl->ops->owner); " in
> alloc_mdio_bitbang().
> 
> void free_mdio_bitbang(struct mii_bus *bus) {
>         struct mdiobb_ctrl *ctrl = bus->priv;
> 
>         module_put(ctrl->ops->owner);
>         mdiobus_free(bus);
> }
> 
> Make sure your cleanup is symmetrical to your setup.
> 
I have tried to call free_mdio_bitbang() in rtl_remove_one (). But when I try to unload r8169, rtl_remove_one() did not get called.
So there is no chance to call free_mdio_bitbang().

------Please consider the environment before printing this e-mail.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ