Linux wireless drivers development
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: Michal Kazior <michal.kazior@tieto.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	"ath10k@lists.infradead.org" <ath10k@lists.infradead.org>
Subject: Re: [PATCH 1/8] ath10k: cleanup ath10k_pci_wait_for_target_init()
Date: Wed, 26 Mar 2014 13:10:11 +0200	[thread overview]
Message-ID: <87ha6lz04s.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <CA+BoTQ=N_L53c2Pgw3RQYcJx4-xp9fSOYvbeEUHgFCtSoP3QRA@mail.gmail.com> (Michal Kazior's message of "Wed, 26 Mar 2014 10:52:59 +0100")

Michal Kazior <michal.kazior@tieto.com> writes:

> On 26 March 2014 10:28, Kalle Valo <kvalo@qca.qualcomm.com> wrote:
>> Michal Kazior <michal.kazior@tieto.com> writes:
>
> [...]
>
>>>> -       while (wait_limit-- &&
>>>> -              !(ioread32(ar_pci->mem + FW_INDICATOR_ADDRESS) &
>>>> -                FW_IND_INITIALIZED)) {
>>>> +       timeout = jiffies + msecs_to_jiffies(wait);
>>>> +
>>>> +       do {
>>>> +               val = ath10k_pci_read32(ar, FW_INDICATOR_ADDRESS);
>>>> +               if (val == FW_IND_INITIALIZED)
>>>> +                       break;
>
> Ah, for some reason I've missed this earlier. You seem to replace &
> with ==. I wonder if that's okay?

No, it's not. Good catch, I'll change it back to '&'.

> FW indicator may contain FW_IND_EVENT_PENDING (i.e. firmware crashed
> bit) too.

I'm guessing that FW_IND_INITIALIZED should be the only bit set if
initialisation has happened correctly, but we cannot be certain (right
now). Hence I'll change it back to '&'.

> It might be a good idea to check for that too and return a different
> errno?

Maybe. But to keep this patch simple, I don't add that right now. We can
create a new patch for that.

>>> It might be worth to add:
>>>
>>>  if (val == 0xFFFFFFFF)
>>>    return -EIO;
>>
>> What does receiving 0xFFFFFFFF mean here? PCI bus kaput?
>
> A simple grepping (find drivers/net/ethernet/ -type f -name '*.[ch]' |
> xargs grep -nC5 ioread32 | grep -C5 -i 0xffffffff) turns out results
> like this:
>
>  drivers/net/ethernet/cisco/enic/vnic_rq.c-200-  }
>  drivers/net/ethernet/cisco/enic/vnic_rq.c-201-
>  drivers/net/ethernet/cisco/enic/vnic_rq.c-202-  /* Use current
> fetch_index as the ring starting point */
>  drivers/net/ethernet/cisco/enic/vnic_rq.c:203:  fetch_index =
> ioread32(&rq->ctrl->fetch_index);
>  drivers/net/ethernet/cisco/enic/vnic_rq.c-204-
>  drivers/net/ethernet/cisco/enic/vnic_rq.c-205-  if (fetch_index ==
> 0xFFFFFFFF) { /* check for hardware gone  */
>  drivers/net/ethernet/cisco/enic/vnic_rq.c-206-          /* Hardware
> surprise removal: reset fetch_index */
>  drivers/net/ethernet/cisco/enic/vnic_rq.c-207-          fetch_index = 0;
>  drivers/net/ethernet/cisco/enic/vnic_rq.c-208-  }
>
>
>> Do we really want to stop trying after receiving that? What harm would
>> it cause to keep on trying? We would return an error anyway after the
>> timeout, right?
>
> Yes. It's harmless but having the check allows to discern a real
> timeout (target doesn't wake up for some reason) and a pci-e link
> issue.

Ok, I'll add the test you suggested.

-- 
Kalle Valo

  reply	other threads:[~2014-03-26 11:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25  9:14 [PATCH 0/8] ath10k: small cleanups to pci.c Kalle Valo
2014-03-25  9:15 ` [PATCH 1/8] ath10k: cleanup ath10k_pci_wait_for_target_init() Kalle Valo
2014-03-25  9:32   ` Michal Kazior
2014-03-26  9:28     ` Kalle Valo
2014-03-26  9:52       ` Michal Kazior
2014-03-26 11:10         ` Kalle Valo [this message]
2014-03-25  9:15 ` [PATCH 2/8] ath10k: add module parameter to disable cold reset Kalle Valo
2014-03-25  9:15 ` [PATCH 3/8] ath10k: fix name of target_ps module parameter Kalle Valo
2014-03-25  9:15 ` [PATCH 4/8] ath10k: advertise only firmware API 2 files Kalle Valo
2014-03-25  9:15 ` [PATCH 5/8] ath10k: delete ar_pci->fw_indicator_address Kalle Valo
2014-03-25  9:15 ` [PATCH 6/8] ath10k: improve pci debug messages Kalle Valo
2014-03-25  9:15 ` [PATCH 7/8] ath10k: add module parameter values to the pci info print Kalle Valo
2014-03-25  9:15 ` [PATCH 8/8] ath10k: print chip id during boot Kalle Valo

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=87ha6lz04s.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@qca.qualcomm.com \
    --cc=ath10k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=michal.kazior@tieto.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