[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e8a56b1f-f3f3-4081-8c0d-4b829e659780@huawei.com>
Date: Thu, 1 Aug 2024 17:13:33 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: Andrew Lunn <andrew@...n.ch>
CC: <shaojijie@...wei.com>, <yisen.zhuang@...wei.com>,
<salil.mehta@...wei.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <horms@...nel.org>,
<shenjian15@...wei.com>, <wangpeiyang1@...wei.com>, <liuyonglong@...wei.com>,
<sudongming1@...wei.com>, <xujunsheng@...wei.com>, <shiyongbang@...wei.com>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH net-next 05/10] net: hibmcge: Implement some .ndo
functions
on 2024/8/1 8:51, Andrew Lunn wrote:
>> +static int hbg_net_set_mac_address(struct net_device *dev, void *addr)
>> +{
>> + struct hbg_priv *priv = netdev_priv(dev);
>> + u8 *mac_addr;
>> +
>> + mac_addr = ((struct sockaddr *)addr)->sa_data;
>> + if (ether_addr_equal(dev->dev_addr, mac_addr))
>> + return 0;
>> +
>> + if (!is_valid_ether_addr(mac_addr))
>> + return -EADDRNOTAVAIL;
> How does the core pass you an invalid MAC address?
According to my test,
in the 6.4 rc4 kernel version, invalid mac address is allowed to be configured.
An error is reported only when ifconfig ethx up.
>
>> +static int hbg_net_change_mtu(struct net_device *dev, int new_mtu)
>> +{
>> + struct hbg_priv *priv = netdev_priv(dev);
>> + bool is_opened = hbg_nic_is_open(priv);
>> + u32 frame_len;
>> +
>> + if (new_mtu == dev->mtu)
>> + return 0;
>> +
>> + if (new_mtu < priv->dev_specs.min_mtu || new_mtu > priv->dev_specs.max_mtu)
>> + return -EINVAL;
> You just need to set dev->min_mtu and dev->max_mtu, and the core will
> do this validation for you.
Thanks, I'll test it,and if it works I'll remove the judgement
>
>> + dev_info(&priv->pdev->dev,
>> + "change mtu from %u to %u\n", dev->mtu, new_mtu);
> dev_dbg() Don't spam the log for normal operations.
okay, Thanks!
Powered by blists - more mailing lists