From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Lixue Liang <lianglixuehao@126.com>, <kuba@kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <jesse.brandeburg@intel.com>, <davem@davemloft.net>,
<edumazet@google.com>, <pabeni@redhat.com>,
<netdev@vger.kernel.org>, <lianglixue@greatwall.com.cn>,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v7] igb: Assign random MAC address instead of fail in case of invalid one
Date: Tue, 13 Dec 2022 11:22:46 -0800 [thread overview]
Message-ID: <3dd48267-d31d-5b4a-3c16-5b186d85988a@intel.com> (raw)
In-Reply-To: <20221213074726.51756-1-lianglixuehao@126.com>
On 12/12/2022 11:47 PM, Lixue Liang wrote:
> From: Lixue Liang <lianglixue@greatwall.com.cn>
>
> Add the module parameter "allow_invalid_mac_address" to control the
> behavior. When set to true, a random MAC address is assigned, and the
> driver can be loaded, allowing the user to correct the invalid MAC address.
Please include Intel Wired LAN, intel-wired-lan@lists.osuosl.org, for
Intel ethernet driver patches.
> Signed-off-by: Lixue Liang <lianglixue@greatwall.com.cn>
> ---
> Changelog:
> * v7:
> - To group each parameter together
> Suggested-by Tony Nguyen <anthony.l.nguyen@intel.com>
> * v6:
> - Modify commit messages and naming of module parameters
> - [PATCH v6] link:
> https://lore.kernel.org/netdev/20220610023922.74892-1-lianglixuehao@126.com/
> Suggested-by Paul <pmenzel@molgen.mpg.de>
> * v5:
> - Through the setting of module parameters, it is allowed to complete
> the loading of the igb network card driver with an invalid MAC address.
> - [PATCH v5] link:
> https://lore.kernel.org/netdev/20220609083904.91778-1-lianglixuehao@126.com/
> Suggested-by <alexander.duyck@gmail.com>
> * v4:
> - Change the igb_mian in the title to igb
> - Fix dev_err message: replace "already assigned random MAC address"
> with "Invalid MAC address. Assigned random MAC address"
> - [PATCH v4] link:
> https://lore.kernel.org/netdev/20220601150428.33945-1-lianglixuehao@126.com/
> Suggested-by Tony <anthony.l.nguyen@intel.com>
>
> * v3:
> - Add space after comma in commit message
> - Correct spelling of MAC address
> - [PATCH v3] link:
> https://lore.kernel.org/netdev/20220530105834.97175-1-lianglixuehao@126.com/
> Suggested-by Paul <pmenzel@molgen.mpg.de>
>
> * v2:
> - Change memcpy to ether_addr_copy
> - Change dev_info to dev_err
> - Fix the description of the commit message
> - Change eth_random_addr to eth_hw_addr_random
> - [PATCH v2] link:
> https://lore.kernel.org/netdev/20220512093918.86084-1-lianglixue@greatwall.com.cn/
> Reported-by: kernel test robot <lkp@intel.com>
>
> drivers/net/ethernet/intel/igb/igb_main.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index f8e32833226c..8ff0c698383c 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -241,6 +241,10 @@ static int debug = -1;
> module_param(debug, int, 0);
> MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
>
> +static bool allow_invalid_mac_address;
> +module_param(allow_invalid_mac_address, bool, 0);
> +MODULE_PARM_DESC(allow_invalid_mac_address, "Allow NIC driver to be loaded with invalid MAC address");
> +
> struct igb_reg_info {
> u32 ofs;
> char *name;
> @@ -3358,9 +3362,16 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> eth_hw_addr_set(netdev, hw->mac.addr);
>
> if (!is_valid_ether_addr(netdev->dev_addr)) {
> - dev_err(&pdev->dev, "Invalid MAC Address\n");
> - err = -EIO;
> - goto err_eeprom;
> + if (!allow_invalid_mac_address) {
> + dev_err(&pdev->dev, "Invalid MAC address\n");
> + err = -EIO;
> + goto err_eeprom;
> + } else {
> + eth_hw_addr_random(netdev);
> + ether_addr_copy(hw->mac.addr, netdev->dev_addr);
> + dev_err(&pdev->dev,
> + "Invalid MAC address. Assigned random MAC address\n");
> + }
> }
>
> igb_set_default_mac_filter(adapter);
next prev parent reply other threads:[~2022-12-13 19:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-13 7:47 Lixue Liang
2022-12-13 19:22 ` Tony Nguyen [this message]
2022-12-14 7:22 ` Leon Romanovsky
2022-12-14 10:02 ` 梁礼学
2022-12-14 16:51 ` Jakub Kicinski
2022-12-14 18:53 ` Leon Romanovsky
2022-12-14 20:50 ` Jakub Kicinski
2022-12-14 21:43 ` Heiner Kallweit
2022-12-14 23:17 ` Alexander Duyck
2022-12-15 3:24 ` 梁礼学
2022-12-15 15:49 ` Alexander H Duyck
2022-12-19 18:25 ` Jacob Keller
2022-12-18 8:41 ` Leon Romanovsky
2022-12-19 15:30 ` Alexander Duyck
2022-12-28 9:15 ` Leon Romanovsky
2022-12-30 16:17 ` Andrew Lunn
2022-12-14 1:12 Lixue Liang
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=3dd48267-d31d-5b4a-3c16-5b186d85988a@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=lianglixue@greatwall.com.cn \
--cc=lianglixuehao@126.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--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®