mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: <cai.huoqing@linux.dev>, <andrew+netdev@lunn.ch>,
	<davem@davemloft.net>, <edumazet@kernel.org>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] net: hinic: Don't fail probe when firmware lacks rx-vlan-filter
Date: Mon, 23 Nov 2026 14:32:54 +0800	[thread overview]
Message-ID: <0e15bc66-3737-4e6e-92dd-3b54e95e224c@huawei.com> (raw)
In-Reply-To: <20261116021858.273519-1-ruanjinjie@huawei.com>

Ping.

在 2026/11/16 10:18, Jinjie Ruan 写道:
> nic_dev_init() calls set_features() with force_change set, so it
> unconditionally sends HINIC_PORT_CMD_SET_VLAN_FILTER once
> NETIF_F_HW_VLAN_CTAG_FILTER is advertised.  Firmware that predates
> rx-vlan-filter support answers with HINIC_MGMT_CMD_UNSUPPORTED (0xff).
> 
> hinic_set_vlan_fliter() already distinguishes that status and returns it
> without a message, but set_features() treats any non-zero return as
> fatal: it folds it into err and returns -EIO, and nic_dev_init() then
> bails out without printing a sub-error either.  The only visible symptom
> is
> 
> 	hinic 0000:29:00.0: Failed to initialize NIC device
> 	hinic 0000:29:00.0: probe with driver hinic failed with error -5
> 
> and the device stays unusable although nothing is actually broken.
> 
> Treat HINIC_MGMT_CMD_UNSUPPORTED as "feature not available": keep probing
> and drop the feature from the advertised set.  Write netdev->features
> back whenever failed_features is non-empty, not only on the fatal path,
> so the cleared bit really takes effect.
> 
> Fixes: 2acf960e3be6 ("net: hinic: Add support for configuration of rx-vlan-filter by ethtool")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
>  drivers/net/ethernet/huawei/hinic/hinic_main.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c
> index 34ed5ea9e46e..e837140f7c17 100644
> --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c
> +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c
> @@ -1098,16 +1098,26 @@ static int set_features(struct hinic_dev *nic_dev,
>  		ret = hinic_set_vlan_fliter(nic_dev,
>  					    !!(features &
>  					       NETIF_F_HW_VLAN_CTAG_FILTER));
> -		if (ret) {
> +		if (ret == HINIC_MGMT_CMD_UNSUPPORTED) {
> +			dev_info(&nic_dev->hwdev->hwif->pdev->dev,
> +				 "Firmware does not support rx-vlan-filter, feature disabled\n");
> +			failed_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
> +		} else if (ret) {
>  			err = ret;
>  			failed_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
>  		}
>  	}
>  
> -	if (err) {
> +	/*
> +	 * A feature the firmware rejects is dropped from the advertised set,
> +	 * whether it was rejected fatally or not (e.g. rx-vlan-filter on
> +	 * firmware that predates it).
> +	 */
> +	if (failed_features)
>  		nic_dev->netdev->features = features ^ failed_features;
> +
> +	if (err)
>  		return -EIO;
> -	}
>  
>  	return 0;
>  }


      parent reply	other threads:[~2026-11-23  6:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  2:18 Jinjie Ruan
2026-11-19  2:21 ` netdev-bot+sashiko
2026-11-23  6:32 ` Jinjie Ruan [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=0e15bc66-3737-4e6e-92dd-3b54e95e224c@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=cai.huoqing@linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®