All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Siwik, Grzegorz" <grzegorz.siwik@intel.com>
To: Nick Lowe <nick.lowe@gmail.com>,
	"Nguyen, Anthony L" <anthony.l.nguyen@intel.com>
Cc: "kuba@kernel.org" <kuba@kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"sassmann@redhat.com" <sassmann@redhat.com>,
	"Switzer, David" <david.switzer@intel.com>
Subject: RE: [PATCH net-next 2/6] igb: Add double-check MTA_REGISTER for i210 and i211
Date: Thu, 13 May 2021 12:19:26 +0000	[thread overview]
Message-ID: <DM6PR11MB34493E49EE53F58A96DF4BAC84519@DM6PR11MB3449.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CADSoG1uYJGygF9rm+15BE4gy=RU9EBbmGv_+pzddrKLJLdV14w@mail.gmail.com>

Hi all,

> > > Looks like a potential infinite loop on persistent failure.
> > > Also you don't need "is_failed", you can use while (i >= 0), or 
> > > assign i = hw->mac.mta_reg_count, or consider using a goto.
> >
> > We will make a follow on patch to address these issues.
> >
> > Thanks,
> > Tony

> The patch for this that has been queued is as follows:

+     int failed_cnt = 3;
+     bool is_failed;
+     int i;
+
+     do {
+          is_failed = false;
+          for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) {
+               if (array_rd32(E1000_MTA, i) != hw->mac.mta_shadow[i]) {
+                    is_failed = true;
+                    array_wr32(E1000_MTA, i, hw->mac.mta_shadow[i]);
+                    wrfl();
+               }
+          }
+          if (is_failed && --failed_cnt <= 0) {
+               hw_dbg("Failed to update MTA_REGISTER, too many retries");
+               break;
+          }
+     } while (is_failed);

> https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git/commit/?h=dev-queue&id=9db33b54fb98525e323d0d3f16b01778f17b9493

> This will not reset the counter when checking each register and it will not debug output which register failed, this does not seem optimal.

> Could it make more sense to instead do something like this? (Untested)

I cannot agree for this part. In your solution we are checking every register 3 times. 
Entire MTA_ARRAY you will check MTA_REG_COUNT*3 times.
In my code this is worst case scenario - in best scenario I'm checking every MTA only one time.
Please remember that performance is also really important
Also the problem is that i21x devices could not always accept MTA_REGISTER setting. My code has been tested and verified as working.
In my opinion we don't have to know which E1000_MTA register has failed, but we should know that there is problem with entire MTA_REGISTER.
When I was checking this with test script for over 11M iterations this issue never happened more than one time in row. 

> +     int i;
> +     int attempt;
> +     for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) {
> +          for (attempt = 3; attempt >= 1; attempt--) {
> +               if (array_rd32(E1000_MTA, i) != hw->mac.mta_shadow[i]) {
> +                    array_wr32(E1000_MTA, i, hw->mac.mta_shadow[i]);
> +                    wrfl();
> +
> +                    if (attempt == 1 && array_rd32(E1000_MTA, i) !=
> hw->mac.mta_shadow[i]) {
> +                         hw_dbg("Failed to update MTA_REGISTER %d,
> too many retries\n", i);
> +                    }
> +               }
> +          }
> +     }

> Best,

> Nick

Best Regards,
Grzegorz

  parent reply	other threads:[~2021-05-13 12:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16 20:44 [PATCH net-next 0/6][pull request] 1GbE Intel Wired LAN Driver Updates 2021-04-16 Tony Nguyen
2021-04-16 20:44 ` [PATCH net-next 1/6] igb: Redistribute memory for transmit packet buffers when in Qav mode Tony Nguyen
2021-04-16 20:44 ` [PATCH net-next 2/6] igb: Add double-check MTA_REGISTER for i210 and i211 Tony Nguyen
2021-04-16 21:12   ` Jakub Kicinski
2021-04-20 16:22     ` Nguyen, Anthony L
2021-05-10 13:43       ` Nick Lowe
2021-05-10 14:01         ` Nick Lowe
2021-05-13 12:19         ` Siwik, Grzegorz [this message]
2021-04-16 20:44 ` [PATCH net-next 3/6] igc: Enable internal i225 PPS Tony Nguyen
2021-04-16 20:44 ` [PATCH net-next 4/6] igc: enable auxiliary PHC functions for the i225 Tony Nguyen
2021-04-16 20:44 ` [PATCH net-next 5/6] igc: Fix overwrites return value Tony Nguyen
2021-04-16 20:45 ` [PATCH net-next 6/6] igc: Expose LPI counters Tony Nguyen
2021-04-17  0:20 ` [PATCH net-next 0/6][pull request] 1GbE Intel Wired LAN Driver Updates 2021-04-16 patchwork-bot+netdevbpf

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=DM6PR11MB34493E49EE53F58A96DF4BAC84519@DM6PR11MB3449.namprd11.prod.outlook.com \
    --to=grzegorz.siwik@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=david.switzer@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nick.lowe@gmail.com \
    --cc=sassmann@redhat.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.