From: Andrew Lunn <andrew@lunn.ch>
To: Jeremy Linton <jeremy.linton@arm.com>
Cc: netdev@vger.kernel.org, steve.glendinning@shawell.net,
sergei.shtylyov@cogentembedded.com, will.deacon@arm.com
Subject: Re: [PATCH 3/4] net: smsc911x: Move interrupt handler before open
Date: Thu, 1 Sep 2016 22:50:49 +0200 [thread overview]
Message-ID: <20160901205049.GC16864@lunn.ch> (raw)
In-Reply-To: <1472760909-19688-4-git-send-email-jeremy.linton@arm.com>
On Thu, Sep 01, 2016 at 03:15:08PM -0500, Jeremy Linton wrote:
> In preparation for the allocating/enabling interrupts
> in the ndo_open routine move the irq handler before it.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
It would of been nice if you had emphasised there was not functional
change...
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
> ---
> drivers/net/ethernet/smsc/smsc911x.c | 122 +++++++++++++++++------------------
> 1 file changed, 61 insertions(+), 61 deletions(-)
>
> diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
> index 823ad3f..c2e56f0 100644
> --- a/drivers/net/ethernet/smsc/smsc911x.c
> +++ b/drivers/net/ethernet/smsc/smsc911x.c
> @@ -1507,6 +1507,67 @@ static void smsc911x_disable_irq_chip(struct net_device *dev)
> smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF);
> }
>
> +static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
> +{
> + struct net_device *dev = dev_id;
> + struct smsc911x_data *pdata = netdev_priv(dev);
> + u32 intsts = smsc911x_reg_read(pdata, INT_STS);
> + u32 inten = smsc911x_reg_read(pdata, INT_EN);
> + int serviced = IRQ_NONE;
> + u32 temp;
> +
> + if (unlikely(intsts & inten & INT_STS_SW_INT_)) {
> + temp = smsc911x_reg_read(pdata, INT_EN);
> + temp &= (~INT_EN_SW_INT_EN_);
> + smsc911x_reg_write(pdata, INT_EN, temp);
> + smsc911x_reg_write(pdata, INT_STS, INT_STS_SW_INT_);
> + pdata->software_irq_signal = 1;
> + smp_wmb();
> + serviced = IRQ_HANDLED;
> + }
> +
> + if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) {
> + /* Called when there is a multicast update scheduled and
> + * it is now safe to complete the update */
> + SMSC_TRACE(pdata, intr, "RX Stop interrupt");
> + smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_);
> + if (pdata->multicast_update_pending)
> + smsc911x_rx_multicast_update_workaround(pdata);
> + serviced = IRQ_HANDLED;
> + }
> +
> + if (intsts & inten & INT_STS_TDFA_) {
> + temp = smsc911x_reg_read(pdata, FIFO_INT);
> + temp |= FIFO_INT_TX_AVAIL_LEVEL_;
> + smsc911x_reg_write(pdata, FIFO_INT, temp);
> + smsc911x_reg_write(pdata, INT_STS, INT_STS_TDFA_);
> + netif_wake_queue(dev);
> + serviced = IRQ_HANDLED;
> + }
> +
> + if (unlikely(intsts & inten & INT_STS_RXE_)) {
> + SMSC_TRACE(pdata, intr, "RX Error interrupt");
> + smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_);
> + serviced = IRQ_HANDLED;
> + }
> +
> + if (likely(intsts & inten & INT_STS_RSFL_)) {
> + if (likely(napi_schedule_prep(&pdata->napi))) {
> + /* Disable Rx interrupts */
> + temp = smsc911x_reg_read(pdata, INT_EN);
> + temp &= (~INT_EN_RSFL_EN_);
> + smsc911x_reg_write(pdata, INT_EN, temp);
> + /* Schedule a NAPI poll */
> + __napi_schedule(&pdata->napi);
> + } else {
> + SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed");
> + }
> + serviced = IRQ_HANDLED;
> + }
> +
> + return serviced;
> +}
> +
> static int smsc911x_open(struct net_device *dev)
> {
> struct smsc911x_data *pdata = netdev_priv(dev);
> @@ -1820,67 +1881,6 @@ static void smsc911x_set_multicast_list(struct net_device *dev)
> spin_unlock_irqrestore(&pdata->mac_lock, flags);
> }
>
> -static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
> -{
> - struct net_device *dev = dev_id;
> - struct smsc911x_data *pdata = netdev_priv(dev);
> - u32 intsts = smsc911x_reg_read(pdata, INT_STS);
> - u32 inten = smsc911x_reg_read(pdata, INT_EN);
> - int serviced = IRQ_NONE;
> - u32 temp;
> -
> - if (unlikely(intsts & inten & INT_STS_SW_INT_)) {
> - temp = smsc911x_reg_read(pdata, INT_EN);
> - temp &= (~INT_EN_SW_INT_EN_);
> - smsc911x_reg_write(pdata, INT_EN, temp);
> - smsc911x_reg_write(pdata, INT_STS, INT_STS_SW_INT_);
> - pdata->software_irq_signal = 1;
> - smp_wmb();
> - serviced = IRQ_HANDLED;
> - }
> -
> - if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) {
> - /* Called when there is a multicast update scheduled and
> - * it is now safe to complete the update */
> - SMSC_TRACE(pdata, intr, "RX Stop interrupt");
> - smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_);
> - if (pdata->multicast_update_pending)
> - smsc911x_rx_multicast_update_workaround(pdata);
> - serviced = IRQ_HANDLED;
> - }
> -
> - if (intsts & inten & INT_STS_TDFA_) {
> - temp = smsc911x_reg_read(pdata, FIFO_INT);
> - temp |= FIFO_INT_TX_AVAIL_LEVEL_;
> - smsc911x_reg_write(pdata, FIFO_INT, temp);
> - smsc911x_reg_write(pdata, INT_STS, INT_STS_TDFA_);
> - netif_wake_queue(dev);
> - serviced = IRQ_HANDLED;
> - }
> -
> - if (unlikely(intsts & inten & INT_STS_RXE_)) {
> - SMSC_TRACE(pdata, intr, "RX Error interrupt");
> - smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_);
> - serviced = IRQ_HANDLED;
> - }
> -
> - if (likely(intsts & inten & INT_STS_RSFL_)) {
> - if (likely(napi_schedule_prep(&pdata->napi))) {
> - /* Disable Rx interrupts */
> - temp = smsc911x_reg_read(pdata, INT_EN);
> - temp &= (~INT_EN_RSFL_EN_);
> - smsc911x_reg_write(pdata, INT_EN, temp);
> - /* Schedule a NAPI poll */
> - __napi_schedule(&pdata->napi);
> - } else {
> - SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed");
> - }
> - serviced = IRQ_HANDLED;
> - }
> -
> - return serviced;
> -}
> -
> #ifdef CONFIG_NET_POLL_CONTROLLER
> static void smsc911x_poll_controller(struct net_device *dev)
> {
> --
> 2.5.5
>
next prev parent reply other threads:[~2016-09-01 21:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-01 20:15 [PATCH v3 0/4] net: smsc911x: Move phy and interrupt config Jeremy Linton
2016-09-01 20:15 ` [PATCH 1/4] net: smsc911x: Remove multiple exit points from smsc911x_open Jeremy Linton
2016-09-01 20:43 ` Andrew Lunn
2016-09-01 20:15 ` [PATCH 2/4] net: smsc911x: Fix register_netdev, phy startup, driver unload ordering Jeremy Linton
2016-09-01 20:49 ` Andrew Lunn
2016-09-03 21:19 ` Sergei Shtylyov
2016-09-01 20:15 ` [PATCH 3/4] net: smsc911x: Move interrupt handler before open Jeremy Linton
2016-09-01 20:50 ` Andrew Lunn [this message]
2016-09-01 20:15 ` [PATCH 4/4] net: smsc911x: Move interrupt allocation to open/stop Jeremy Linton
2016-09-01 20:56 ` Andrew Lunn
2016-09-02 16:53 ` Will Deacon
2016-09-03 19:23 ` Sergei Shtylyov
2016-09-03 20:30 ` Sergei Shtylyov
2016-09-04 2:45 ` Andrew Lunn
2016-09-01 21:07 ` [PATCH v3 0/4] net: smsc911x: Move phy and interrupt config Sergei Shtylyov
2016-09-03 0:28 ` David Miller
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=20160901205049.GC16864@lunn.ch \
--to=andrew@lunn.ch \
--cc=jeremy.linton@arm.com \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=steve.glendinning@shawell.net \
--cc=will.deacon@arm.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).