All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hau <hau@realtek.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "hkallweit1@gmail.com" <hkallweit1@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	nic_swsd <nic_swsd@realtek.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>
Subject: RE: [PATCH v3 net-next] r8169: add support for rtl8168h(revid 0x2a) + rtl8211fs fiber application
Date: Wed, 24 Aug 2022 19:20:02 +0000	[thread overview]
Message-ID: <30856551578843f998eac6fd721a6001@realtek.com> (raw)
In-Reply-To: <YwULgfZBDBhnn+Aa@lunn.ch>

> On Tue, Aug 23, 2022 at 03:48:13PM +0000, Hau wrote:
> > > > > > @@ -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.
> 
> O.K, since you are modifying a PHY register, lets assume it is a PHY issue.
> Please put the workaround in the PHY driver.
I will try to do this.

> > > > 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 you probably need to dig into driver/base/dd.c and maybe the drivers/pci,
> to understand why.
In command "rmmod", if module refcnt not equal to 0, It will show error message " Module r8169 is in use ". And "__module_get()" will increase module refcnt.
If module refcnt is not equal to 0, rmmod will not delete module.

Is that possible for us to call alloc_mdio_bitbang() but set owner to null? I have try this setting, command "rmmod" can be executed normally.

Thanks,
Hau

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

  reply	other threads:[~2022-08-24 19:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22 16:07 [PATCH v3 net-next] r8169: add support for rtl8168h(revid 0x2a) + rtl8211fs fiber application Chunhao Lin
2022-08-22 19:58 ` Andrew Lunn
2022-08-23 15:17   ` Hau
2022-08-23 15:31     ` Andrew Lunn
2022-08-23 15:48       ` Hau
2022-08-23 17:16         ` Andrew Lunn
2022-08-24 19:20           ` Hau [this message]
2022-08-22 20:19 ` Heiner Kallweit
2022-08-23 15:34   ` Hau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30856551578843f998eac6fd721a6001@realtek.com \
    --to=hau@realtek.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.