From: Simon Horman <horms@kernel.org>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Wen Gu <guwen@linux.alibaba.com>,
Philo Lu <lulie@linux.alibaba.com>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Lukas Bulwahn <lukas.bulwahn@redhat.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Vivian Wang <wangruikang@iscas.ac.cn>,
Troy Mitchell <troy.mitchell@linux.spacemit.com>,
Dust Li <dust.li@linux.alibaba.com>
Subject: Re: [PATCH net-next v11 3/5] eea: probe the netdevice and create adminq
Date: Sat, 8 Nov 2025 15:47:50 +0000 [thread overview]
Message-ID: <aQ9mJvir26jPv_WC@horms.kernel.org> (raw)
In-Reply-To: <20251107054955.16236-4-xuanzhuo@linux.alibaba.com>
On Fri, Nov 07, 2025 at 01:49:53PM +0800, Xuan Zhuo wrote:
...
> diff --git a/drivers/net/ethernet/alibaba/eea/eea_net.c b/drivers/net/ethernet/alibaba/eea/eea_net.c
...
> +static int eea_netdev_init_features(struct net_device *netdev,
> + struct eea_net *enet,
> + struct eea_device *edev)
> +{
> + struct eea_aq_cfg *cfg;
> + int err;
> + u32 mtu;
> +
> + cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
> + if (!cfg)
> + return -ENOMEM;
> +
> + err = eea_adminq_query_cfg(enet, cfg);
> + if (err)
> + goto err_free;
> +
> + mtu = le16_to_cpu(cfg->mtu);
> + if (mtu < ETH_MIN_MTU) {
> + dev_err(edev->dma_dev, "The device gave us an invalid MTU. Here we can only exit the initialization. %d < %d",
> + mtu, ETH_MIN_MTU);
> + err = -EINVAL;
> + goto err_free;
> + }
> +
> + eea_update_cfg(enet, edev, cfg);
> +
> + netdev->priv_flags |= IFF_UNICAST_FLT;
> + netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
> +
> + netdev->hw_features |= NETIF_F_HW_CSUM;
> + netdev->hw_features |= NETIF_F_GRO_HW;
> + netdev->hw_features |= NETIF_F_SG;
> + netdev->hw_features |= NETIF_F_TSO;
> + netdev->hw_features |= NETIF_F_TSO_ECN;
> + netdev->hw_features |= NETIF_F_TSO6;
> + netdev->hw_features |= NETIF_F_GSO_UDP_L4;
> +
> + netdev->features |= NETIF_F_HIGHDMA;
> + netdev->features |= NETIF_F_HW_CSUM;
> + netdev->features |= NETIF_F_SG;
> + netdev->features |= NETIF_F_GSO_ROBUST;
> + netdev->features |= netdev->hw_features & NETIF_F_ALL_TSO;
> + netdev->features |= NETIF_F_RXCSUM;
> + netdev->features |= NETIF_F_GRO_HW;
> +
> + netdev->vlan_features = netdev->features;
> +
> + eth_hw_addr_set(netdev, cfg->mac);
> +
> + enet->speed = SPEED_UNKNOWN;
> + enet->duplex = DUPLEX_UNKNOWN;
> +
> + netdev->min_mtu = ETH_MIN_MTU;
> +
> + netdev->mtu = mtu;
> +
> + /* If jumbo frames are already enabled, then the returned MTU will be a
> + * jumbo MTU, and the driver will automatically enable jumbo frame
> + * support by default.
> + */
> + netdev->max_mtu = mtu;
> +
> + netif_carrier_on(netdev);
> +
> +err_free:
> + kfree(cfg);
> +
> + return 0;
This always returns 0, even on error.
If there is no error, then err will be 0. Otherwise, err will be a negative
error value. So I think this can by addressed by simply replacing the
line above with:
return err;
> +}
...
next prev parent reply other threads:[~2025-11-08 15:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 5:49 [PATCH net-next v11 0/5] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor Xuan Zhuo
2025-11-07 5:49 ` [PATCH net-next v11 1/5] eea: introduce PCI framework Xuan Zhuo
2025-11-07 5:49 ` [PATCH net-next v11 2/5] eea: introduce ring and descriptor structures Xuan Zhuo
2025-11-07 5:49 ` [PATCH net-next v11 3/5] eea: probe the netdevice and create adminq Xuan Zhuo
2025-11-08 15:47 ` Simon Horman [this message]
2025-11-07 5:49 ` [PATCH net-next v11 4/5] eea: create/destroy rx,tx queues for netdevice open and stop Xuan Zhuo
2025-11-07 5:49 ` [PATCH net-next v11 5/5] eea: introduce ethtool support Xuan Zhuo
2025-11-07 6:08 ` [PATCH net-next v11 0/5] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor Xuan Zhuo
-- strict thread matches above, loose matches on Subject: below --
2025-11-07 5:48 [PATCH net-next v11 2/5] eea: introduce ring and descriptor structures Xuan Zhuo
2025-11-07 5:48 ` [PATCH net-next v11 3/5] eea: probe the netdevice and create adminq Xuan Zhuo
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=aQ9mJvir26jPv_WC@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dust.li@linux.alibaba.com \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=guwen@linux.alibaba.com \
--cc=kuba@kernel.org \
--cc=lorenzo@kernel.org \
--cc=lukas.bulwahn@redhat.com \
--cc=lulie@linux.alibaba.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=troy.mitchell@linux.spacemit.com \
--cc=vadim.fedorenko@linux.dev \
--cc=wangruikang@iscas.ac.cn \
--cc=xuanzhuo@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).