public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jijie Shao <shaojijie@huawei.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <shaojijie@huawei.com>, <yisen.zhuang@huawei.com>,
	<salil.mehta@huawei.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<horms@kernel.org>, <shenjian15@huawei.com>,
	<wangpeiyang1@huawei.com>, <liuyonglong@huawei.com>,
	<sudongming1@huawei.com>, <xujunsheng@huawei.com>,
	<shiyongbang@huawei.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH net-next 05/10] net: hibmcge: Implement some .ndo functions
Date: Thu, 1 Aug 2024 21:08:54 +0800	[thread overview]
Message-ID: <ec6dce47-0e6f-46b3-85ab-075851385f75@huawei.com> (raw)
In-Reply-To: <e57e3748-6ee5-42d5-8715-ec652fc6310f@lunn.ch>


on 2024/8/1 20:36, Andrew Lunn wrote:
> On Thu, Aug 01, 2024 at 08:33:38PM +0800, Jijie Shao wrote:
>> on 2024/8/1 20:18, Andrew Lunn wrote:
>>> On Thu, Aug 01, 2024 at 05:13:33PM +0800, Jijie Shao wrote:
>>>> 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.
>>> Ah, interesting.
>>>
>>> I see a test in __dev_open(), which is what you are saying here. But i
>>> would also expect a test in rtnetlink, or maybe dev_set_mac_address().
>>> We don't want every driver having to repeat this test in their
>>> .ndo_set_mac_address, when it could be done once in the core.
>>>
>>> 	Andrew
>> Hi:
>> I did the following test on my device:
>>
>> insmod hibmcge.ko
>> hibmcge: no symbol version for module_layout
>> hibmcge: loading out-of-tree module taints kernel.
>> hibmcge: module verification failed: signature and/or required key missing - tainting kernel
>> hibmcge 0000:83:00.1: enabling device (0140 -> 0142)
>> Generic PHY mii-0000:83:00.1:02: attached PHY driver (mii_bus:phy_addr=mii-0000:83:00.1:02, irq=POLL)
>> hibmcge 0000:83:00.1 enp131s0f1: renamed from eth0
>> IPv6: ADDRCONF(NETDEV_CHANGE): enp131s0f1: link becomes ready
>> hibmcge 0000:83:00.1: link up!
>>
>> ifconfig enp131s0f1 hw ether FF:FF:FF:FF:FF:FF
>>
>> ip a
>> 6: enp131s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
>>      link/ether ff:ff:ff:ff:ff:ff brd ff:ff:ff:ff:ff:ff permaddr 08:02:00:00:08:08
>> ifconfig enp131s0f1 up
>> ifconfig enp131s0f1 down up
>> SIOCSIFFLAGS: Cannot assign requested address
>> hibmcge 0000:83:00.1: link down!
>>
>> uname -a
>> Linux localhost.localdomain 6.4.0+ #1 SMP Fri Mar 15 14:44:20 CST 2024 aarch64 aarch64 aarch64 GNU/Linux
>>
>>
>>
>> So I'm not sure what's wrong. I also implemented ndo_validate_addr by eth_validate_addr.
> I agree. I don't see a test. Please could you include a patch to
> dev_set_mac_address() to validate the address there before calling
> into the driver. It might also be worth a search to see if anybody
> else has tried this before, and failed. There might be a good reason
> you cannot validate it.
>
> 	Andrew

sure, I will include that in V2

Thanks,

Jijie Shao


  reply	other threads:[~2024-08-01 13:08 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31  9:42 [RFC PATCH net-next 00/10] Add support of HIBMCGE Ethernet Driver Jijie Shao
2024-07-31  9:42 ` [RFC PATCH net-next 01/10] net: hibmcge: Add pci table supported in this module Jijie Shao
2024-07-31  9:42 ` [RFC PATCH net-next 02/10] net: hibmcge: Add read/write registers supported through the bar space Jijie Shao
2024-08-05 12:55   ` Simon Horman
2024-08-05 13:08     ` Jijie Shao
2024-07-31  9:42 ` [RFC PATCH net-next 03/10] net: hibmcge: Add mdio and hardware configuration supported in this module Jijie Shao
2024-08-01  0:42   ` Andrew Lunn
2024-08-01  9:04     ` Jijie Shao
2024-08-01 12:07       ` Andrew Lunn
2024-07-31  9:42 ` [RFC PATCH net-next 04/10] net: hibmcge: Add interrupt " Jijie Shao
2024-07-31 13:14   ` Joe Damato
2024-08-01 11:31     ` Jijie Shao
2024-08-05 12:57   ` Simon Horman
2024-08-05 13:29     ` Jijie Shao
2024-07-31  9:42 ` [RFC PATCH net-next 05/10] net: hibmcge: Implement some .ndo functions Jijie Shao
2024-08-01  0:51   ` Andrew Lunn
2024-08-01  9:13     ` Jijie Shao
2024-08-01 12:18       ` Andrew Lunn
2024-08-01 12:33         ` Jijie Shao
2024-08-01 12:36           ` Andrew Lunn
2024-08-01 13:08             ` Jijie Shao [this message]
2024-07-31  9:42 ` [RFC PATCH net-next 06/10] net: hibmcge: Implement .ndo_start_xmit function Jijie Shao
2024-07-31  9:42 ` [RFC PATCH net-next 07/10] net: hibmcge: Implement rx_poll function to receive packets Jijie Shao
2024-07-31 13:23   ` Joe Damato
2024-08-01 11:58     ` Jijie Shao
2024-07-31  9:42 ` [RFC PATCH net-next 08/10] net: hibmcge: Implement workqueue and some ethtool_ops functions Jijie Shao
2024-08-01  1:10   ` Andrew Lunn
2024-08-01 11:10     ` Jijie Shao
2024-08-01 12:26       ` Andrew Lunn
2024-08-01 13:06         ` Jijie Shao
2024-08-01 20:16           ` Andrew Lunn
2024-07-31  9:42 ` [RFC PATCH net-next 09/10] net: hibmcge: Add a Makefile and update Kconfig for hibmcge Jijie Shao
2024-08-01  1:13   ` Andrew Lunn
2024-08-01 12:15     ` Jijie Shao
2024-08-01 12:33       ` Andrew Lunn
2024-07-31  9:42 ` [RFC PATCH net-next 10/10] net: hibmcge: Add maintainer " 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=ec6dce47-0e6f-46b3-85ab-075851385f75@huawei.com \
    --to=shaojijie@huawei.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=salil.mehta@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=shiyongbang@huawei.com \
    --cc=sudongming1@huawei.com \
    --cc=wangpeiyang1@huawei.com \
    --cc=xujunsheng@huawei.com \
    --cc=yisen.zhuang@huawei.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