DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ajit Kumar <Ajit.Kumar@amd.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH] net/axgbe: retry transient SFP I2C read failures
Date: Thu, 19 Nov 2026 08:36:40 -0800	[thread overview]
Message-ID: <20261119083640.6c3a3ea0@phoenix.local> (raw)
In-Reply-To: <20261119035140.2074510-1-Ajit.Kumar@amd.com>

[-- Attachment #1: Type: text/plain, Size: 2524 bytes --]

On Thu, 19 Nov 2026 09:21:40 +0530
Ajit Kumar <Ajit.Kumar@amd.com> wrote:

>  
> +/*
> + * The very first I2C transaction a port issues against its SFP cage
> + * (GPIO-expander / mux), right after axgbe_phy_init(), can legitimately
> + * find that device not yet ready to respond -- observed in the field
> + * as either a quick NACK (-ENOTCONN, IC_TX_ABRT_7B_ADDR_NOACK) or a
> + * full hardware stall with zero bus activity until axgbe_i2c_xfer()'s
> + * own 1-second timeout fires (-ETIMEDOUT). This is distinct from the
> + * cross-port bus-contention race fixed by axgbe_i2c_mdio_bus_mutex in
> + * axgbe_phy_get_comm_ownership(): it reproduces on a single port with
> + * no other port active at all, immediately after that port's own
> + * phy_init(), so serializing the bus does not help with it.
> + *
> + * Retry on these two codes as well as the existing -EAGAIN, with a
> + * short settle delay first, since an immediate retry is unlikely to
> + * help if the device is still completing its own power-on sequence.
> + *
> + * Cost: on the -ETIMEDOUT path this adds up to one more full internal
> + * 1-second timeout per phase for a genuinely persistent (non-
> + * transient) fault. This is bounded to each port's first post-init
> + * access -- a one-time bring-up cost, not a recurring one paid on
> + * every subsequent link_update() poll -- and, like any I2C/MDIO bus
> + * access, runs while axgbe_i2c_mdio_bus_mutex is held, so it can
> + * delay other ports' bus access by the same amount, same as any other
> + * access to this bus.
> + *
> + * Validated on two independent physical units (AMD CRB V3C48 and
> + * Advantech FWA-1081): 0 I2C errors across 30 iterations of the
> + * original cross-port repro plus a dedicated solo-access repro, which
> + * now links up cleanly on both ports; both failed deterministically
> + * without this change.
> + */
> +static inline bool axgbe_i2c_retryable(int ret)
> +{
> +	return ret == -EAGAIN || ret == -ENOTCONN || ret == -ETIMEDOUT;
> +}

The code is fine, but this a great example of an AI slop comment!

If you coach AI to write better commit messages and comments it will
produce something like:

/*
 * The SFP cage mux/GPIO expander may not respond to the first access
 * after phy_init(), either NACKing (-ENOTCONN) or stalling until the
 * transfer times out (-ETIMEDOUT). Retry those as well as arbitration
 * loss (-EAGAIN), after a short delay to let the device settle.
 */

See attached CLAUDE.md for hints how to help reduce this kind of mess.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: CLAUDE.md --]
[-- Type: text/markdown, Size: 1383 bytes --]

## Style

Avoid sounding like everything was generated by an LLM
1. Limit em dashes:   Max one per short paragraph. Less is better. Replace extras with commas, semicolons, or restructured phrasing. 
2. Kill formulaic structures:   Avoid “It’s not just X; it’s Y” phrasing. Rework neat triplets and symmetry—variety beats rhythm.
3. Purge buzzwords:   Remove or translate vague hype terms (e.g., *elevate, robust, impactful, leverage, delve*). Use precise, plain alternatives.
4. Delete strained metaphors:   Cut weird similes or analogies that don’t land. If you wince when reading it, it goes.
5. Cut redundancy and filler:   Eliminate repeated clarifications, preamble, and excessive transitions. Get to the point, then stop.
6. Inject human voice:   Use first-person when appropriate. Add a brief observation, reaction, or informal aside. Allow small imperfections that signal a real writer.
7. Loosen formality (where context allows):   Use contractions naturally (don’t, can’t, won’t). Avoid robotic phrasing. Let the tone match the platform (Slack ≠ policy doc).
8. Vary sentence rhythm:   Break uniformity. Mix short, medium, and long sentences to avoid “AI flatline” pacing.
9. Anchor the point of view:   Stick to a consistent perspective (I, you, we). Use active voice unless there’s a reason not to.
10. Prefer plaintext over markup

      reply	other threads:[~2026-11-19 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  3:51 [PATCH] net/axgbe: retry transient SFP I2C read failures Ajit Kumar
2026-11-19 16:36 ` Stephen Hemminger [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=20261119083640.6c3a3ea0@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=Ajit.Kumar@amd.com \
    --cc=dev@dpdk.org \
    /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