From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, nbd@nbd.name,
john@phrozen.org, sean.wang@mediatek.com,
Mark-MC.Lee@mediatek.com, sujuan.chen@mediatek.com,
daniel@makrotopia.org, leon@kernel.org
Subject: Re: [PATCH v5 net-next 5/5] net: ethernet: mtk_wed: add reset/reset_complete callbacks
Date: Thu, 12 Jan 2023 20:25:03 +0100 [thread overview]
Message-ID: <Y8Bej+76EiNyApWE@lore-desk> (raw)
In-Reply-To: <CAKgT0UeX0n0b887MWUXiO54-PBMhxgSKPTab9AX3LPk3R4fS+w@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4765 bytes --]
> On Thu, Jan 12, 2023 at 8:26 AM Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> >
> > > On Wed, 2023-01-11 at 18:22 +0100, Lorenzo Bianconi wrote:
> > > > Introduce reset and reset_complete wlan callback to schedule WLAN driver
> > > > reset when ethernet/wed driver is resetting.
> > > >
> > > > Tested-by: Daniel Golle <daniel@makrotopia.org>
> > > > Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
> > > > Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
> > > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > > > ---
> > > > drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 ++++
> > > > drivers/net/ethernet/mediatek/mtk_wed.c | 40 +++++++++++++++++++++
> > > > drivers/net/ethernet/mediatek/mtk_wed.h | 8 +++++
> > > > include/linux/soc/mediatek/mtk_wed.h | 2 ++
> > > > 4 files changed, 57 insertions(+)
> > > >
> > >
> > > Do we have any updates on the implementation that would be making use
> > > of this? It looks like there was a discussion for the v2 of this set to
> > > include a link to an RFC posting that would make use of this set.
> >
> > I posted the series to linux-wireless mailing list adding netdev one in cc:
> > https://lore.kernel.org/linux-wireless/cover.1673103214.git.lorenzo@kernel.org/T/#md34b4ffcb07056794378fa4e8079458ecca69109
>
> Thanks. It would be useful to include this link in the next revision
> to make it easier to review.
ack, will do.
>
> > >
> > > > diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > > > index 1af74e9a6cd3..0147e98009c2 100644
> > > > --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > > > +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > > > @@ -3924,6 +3924,11 @@ static void mtk_pending_work(struct work_struct *work)
> > > > set_bit(MTK_RESETTING, ð->state);
> > > >
> > > > mtk_prepare_for_reset(eth);
> > > > + mtk_wed_fe_reset();
> > > > + /* Run again reset preliminary configuration in order to avoid any
> > > > + * possible race during FE reset since it can run releasing RTNL lock.
> > > > + */
> > > > + mtk_prepare_for_reset(eth);
> > > >
> > > > /* stop all devices to make sure that dma is properly shut down */
> > > > for (i = 0; i < MTK_MAC_COUNT; i++) {
> > > > @@ -3961,6 +3966,8 @@ static void mtk_pending_work(struct work_struct *work)
> > > >
> > > > clear_bit(MTK_RESETTING, ð->state);
> > > >
> > > > + mtk_wed_fe_reset_complete();
> > > > +
> > > > rtnl_unlock();
> > > > }
> > > >
> > > > diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
> > > > index a6271449617f..4854993f2941 100644
> > > > --- a/drivers/net/ethernet/mediatek/mtk_wed.c
> > > > +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
> > > > @@ -206,6 +206,46 @@ mtk_wed_wo_reset(struct mtk_wed_device *dev)
> > > > iounmap(reg);
> > > > }
> > > >
> > > > +void mtk_wed_fe_reset(void)
> > > > +{
> > > > + int i;
> > > > +
> > > > + mutex_lock(&hw_lock);
> > > > +
> > > > + for (i = 0; i < ARRAY_SIZE(hw_list); i++) {
> > > > + struct mtk_wed_hw *hw = hw_list[i];
> > > > + struct mtk_wed_device *dev = hw->wed_dev;
> > > > +
> > > > + if (!dev || !dev->wlan.reset)
> > > > + continue;
> > > > +
> > > > + /* reset callback blocks until WLAN reset is completed */
> > > > + if (dev->wlan.reset(dev))
> > > > + dev_err(dev->dev, "wlan reset failed\n");
> > >
> > > The reason why having the consumer would be useful are cases like this.
> > > My main concern is if the error value might be useful to actually
> > > expose rather than just treating it as a boolean. Usually for things
> > > like this I prefer to see the result captured and if it indicates error
> > > we return the error value since this could be one of several possible
> > > causes for the error assuming this returns an int and not a bool.
> >
> > we can have 2 independent wireless chips connected here so, if the first one
> > fails, should we exit or just log the error?
>
> I would think you should log the error. I notice in your wireless
> implementation you can return BUSY or TIMEOUT. Rather than doing the
> dev_err in your reset function to distinguish between the two you
> could just return the error and leave the printing of the error to
> this dev_err message.
ack, will do.
>
> Also a follow-on question I had. It looks like reset_complete returns
> an int but it is being ignored and in your implementation it is just
> returning 0. Should that be a void instead of an int?
>
ack, will do.
Regards,
Lorenzo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2023-01-12 19:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 17:22 [PATCH v5 net-next 0/5] net: ethernet: mtk_wed: introduce reset support Lorenzo Bianconi
2023-01-11 17:22 ` [PATCH v5 net-next 1/5] net: ethernet: mtk_eth_soc: introduce mtk_hw_reset utility routine Lorenzo Bianconi
2023-01-11 17:22 ` [PATCH v5 net-next 2/5] net: ethernet: mtk_eth_soc: introduce mtk_hw_warm_reset support Lorenzo Bianconi
2023-01-11 17:22 ` [PATCH v5 net-next 3/5] net: ethernet: mtk_eth_soc: align reset procedure to vendor sdk Lorenzo Bianconi
2023-01-11 17:22 ` [PATCH v5 net-next 4/5] net: ethernet: mtk_eth_soc: add dma checks to mtk_hw_reset_check Lorenzo Bianconi
2023-01-11 17:22 ` [PATCH v5 net-next 5/5] net: ethernet: mtk_wed: add reset/reset_complete callbacks Lorenzo Bianconi
2023-01-12 16:15 ` Alexander H Duyck
2023-01-12 16:26 ` Lorenzo Bianconi
2023-01-12 18:13 ` Alexander Duyck
2023-01-12 19:25 ` Lorenzo Bianconi [this message]
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=Y8Bej+76EiNyApWE@lore-desk \
--to=lorenzo.bianconi@redhat.com \
--cc=Mark-MC.Lee@mediatek.com \
--cc=alexander.duyck@gmail.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=john@phrozen.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sean.wang@mediatek.com \
--cc=sujuan.chen@mediatek.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 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).