From: Jijie Shao <shaojijie@huawei.com>
To: Simon Horman <horms@kernel.org>
Cc: <shaojijie@huawei.com>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<andrew+netdev@lunn.ch>, <shenjian15@huawei.com>,
<liuyonglong@huawei.com>, <chenhao418@huawei.com>,
<huangdonghua3@h-partners.com>, <yangshuaisong@h-partners.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 4/5] net: hns3: differentiate autoneg default values between copper and fiber
Date: Mon, 22 Jun 2026 21:11:09 +0800 [thread overview]
Message-ID: <17c623e2-9c7b-4e0a-a0ce-99c77dd0465e@huawei.com> (raw)
In-Reply-To: <20260618153450.909964-1-horms@kernel.org>
on 2026/6/18 23:34, Simon Horman wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> Full review at: https://sashiko.dev
> ---
> net: hns3: differentiate autoneg default values between copper and fiber
>
> This commit addresses a link loss issue during driver initialization on
> optical ports connected to forced-mode remote switches. It modifies
> hclge_init_ae_dev to set autonegotiation based on media type. Copper ports
> retain the AUTONEG_ENABLE default, while optical ports inherit the firmware
> pre-configured autoneg setting.
>
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
>> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
>> @@ -11916,6 +11916,9 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
>> if (ret)
>> goto err_ptp_uninit;
>>
>> + if (hdev->hw.mac.media_type != HNAE3_MEDIA_TYPE_COPPER)
>> + hdev->hw.mac.req_autoneg = hdev->hw.mac.autoneg;
>> +
> [Severity: High]
> Does this apply the wrong speed when autonegotiation is disabled on fiber
> ports?
>
> During driver initialization, hclge_update_port_info() dynamically probes
> the SFP module and updates mac->speed, but does not update mac->req_speed,
> which retains its statically configured default capability.
>
> When hdev->hw.mac.autoneg is 0 (forced-mode), req_autoneg becomes 0, and
> then hclge_set_autoneg_speed_dup() uses req_speed:
>
> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:hclge_set_autoneg_speed_dup() {
> ...
> if (!hdev->hw.mac.req_autoneg) {
> ret = hclge_cfg_mac_speed_dup_hw(hdev, hdev->hw.mac.req_speed,
> ...
> }
>
> Could this override the dynamically probed SFP speed with the static default
> speed?
[Reject] This is initializing the path. mac->speed has been parsed in hclge_configure()
and an initial value has been assigned to req_speed.
>
> [Severity: High]
> Does this unconditionally disable autonegotiation for V1 optical hardware?
>
> Looking at hclge_update_port_info(), it only queries SFP information via
> hclge_get_sfp_info() for V2 hardware. For V1 hardware, it falls back to
> hclge_get_sfp_speed(), which leaves mac->autoneg uninitialized (0):
>
> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:hclge_update_port_info() {
> ...
> if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {
> speed = mac->speed;
> ret = hclge_get_sfp_info(hdev, mac);
> } else {
> speed = HCLGE_MAC_SPEED_UNKNOWN;
> ret = hclge_get_sfp_speed(hdev, &speed);
> }
> ...
> }
>
> If mac->autoneg is left as 0, wouldn't req_autoneg unconditionally be set
> to 0 here, overriding the speed and breaking connectivity for V1 devices?
[Reject] No, this process is the same as before the modification.
Before the modification, mac->autoneg was not actively assigned a value (it was initialized to 0 by default).
Thanks,
Jijie Shao
next prev parent reply other threads:[~2026-06-22 13:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 11:27 [PATCH net 0/5] net: hns3: fix configuration deadlocks and refactor link setup Jijie Shao
2026-06-17 11:27 ` [PATCH net 1/5] net: hns3: unify copper port ksettings configuration path Jijie Shao
2026-06-18 15:33 ` Simon Horman
2026-06-22 13:30 ` Jijie Shao
2026-06-17 11:27 ` [PATCH net 2/5] net: hns3: refactor MAC autoneg and speed configuration Jijie Shao
2026-06-18 15:34 ` Simon Horman
2026-06-22 13:18 ` Jijie Shao
2026-06-17 11:27 ` [PATCH net 3/5] net: hns3: fix permanent link down deadlock after reset Jijie Shao
2026-06-17 11:27 ` [PATCH net 4/5] net: hns3: differentiate autoneg default values between copper and fiber Jijie Shao
2026-06-18 15:34 ` Simon Horman
2026-06-22 13:11 ` Jijie Shao [this message]
2026-06-17 11:27 ` [PATCH net 5/5] net: hns3: fix init failure caused by lane_num contamination Jijie Shao
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=17c623e2-9c7b-4e0a-a0ce-99c77dd0465e@huawei.com \
--to=shaojijie@huawei.com \
--cc=andrew+netdev@lunn.ch \
--cc=chenhao418@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=huangdonghua3@h-partners.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shenjian15@huawei.com \
--cc=yangshuaisong@h-partners.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