Re: [PATCH 1/2] [v4] net: emac: emac gigabit ethernet controller driver

Timur Tabi
2016-05-10T23:18:35Z

Florian Fainelli wrote:
> Are you utilizing the PHYLIB APIs properly? You need at least a
> phy_start() to start the PHY state machine, and an adjust_link callback
> to be provided to phy_connect() (or of_phy_connect()) to manage link
> state changes. And that's the very basic minimum here, there could be
> additional APIs that you may end up using.
>
> There are tons of example in tree of drivers doing this, bcmgenet,
> bcmsysport, tg3 etc.

Thank you. I think I finally got phylib working, more or less.

Unfortunately, it seems I have some kind of race condition. The driver
has a lot that's wrong with it, and I'm trying to fix it all. One crazy
the driver does is it create a workqueue to handle a lot of the tasks
that would normally be handled in the interrupt handler itself.

With phylib support, I know my driver can call phy_mac_interrupt() when
it gets a link status change interrupt. I then have an .adjust_link
callback which starts or stops the mac accordingly.

My problem is that I'm not really sure what adjust_link is supposed to
be doing. In addition, it seems that I need to keep the workqueue
running, otherwise the interface will not function. I bring the
interface up, and the driver reports success, but pings do not work.

I'm getting really frustrated. The sample code isn't really helping a
whole lot, because I lack a fundamental understanding of what needs to
be done. None of the documentation I've read is helpful, and I don't
know how to debug it.

Can you give me some advice on how to debug this?

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation collaborative project.