mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 06:08:08 +00:00
7285f7744f
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.61 Removed upstreamed: generic/backport-6.1/814-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch[1] generic/backport-6.1/814-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch[2] generic/backport-6.1/814-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch[3] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.61&id=b90b8633ef62314f3a5f5675106e6dcdec981b6f 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.61&id=37495846b1efc23c1767b17ddd6645cc0ccb9946 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.61&id=116671d25915b913374ccdb2956b5fdaff939dc9 Build system: x86/64 Build-tested: x86/64/AMD Cezanne Run-tested: x86/64/AMD Cezanne Signed-off-by: John Audia <therealgraysky@proton.me>
100 lines
3.4 KiB
Diff
100 lines
3.4 KiB
Diff
From 46f9261fd0c133038cc5adbdb91085a1791414c9 Mon Sep 17 00:00:00 2001
|
|
From: popcornmix <popcornmix@gmail.com>
|
|
Date: Tue, 26 Mar 2013 17:26:38 +0000
|
|
Subject: [PATCH] Allow mac address to be set in smsc95xx
|
|
|
|
Signed-off-by: popcornmix <popcornmix@gmail.com>
|
|
|
|
SQUASH: smsc95xx: Use dev_mod_addr to set MAC addr
|
|
|
|
Since adeef3e32146 ("net: constify netdev->dev_addr") it has been
|
|
illegal to write to the dev_addr MAC address field. Later commits
|
|
have added explicit checks that it hasn't been modified by nefarious
|
|
means. The dev_addr_mod helper function is the accepted way to change
|
|
the dev_addr field, so use it.
|
|
|
|
Squash with 96c1def63ee1 ("Allow mac address to be set in smsc95xx").
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
|
---
|
|
drivers/net/usb/smsc95xx.c | 54 ++++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 54 insertions(+)
|
|
|
|
--- a/drivers/net/usb/smsc95xx.c
|
|
+++ b/drivers/net/usb/smsc95xx.c
|
|
@@ -87,6 +87,10 @@ static int packetsize = 2560;
|
|
module_param(packetsize, int, 0644);
|
|
MODULE_PARM_DESC(packetsize, "Override the RX URB packet size");
|
|
|
|
+static char *macaddr = ":";
|
|
+module_param(macaddr, charp, 0);
|
|
+MODULE_PARM_DESC(macaddr, "MAC address");
|
|
+
|
|
static int __must_check smsc95xx_read_reg(struct usbnet *dev, u32 index,
|
|
u32 *data)
|
|
{
|
|
@@ -809,6 +813,52 @@ static int smsc95xx_ioctl(struct net_dev
|
|
return phy_mii_ioctl(netdev->phydev, rq, cmd);
|
|
}
|
|
|
|
+/* Check the macaddr module parameter for a MAC address */
|
|
+static int smsc95xx_is_macaddr_param(struct usbnet *dev, struct net_device *nd)
|
|
+{
|
|
+ int i, j, got_num, num;
|
|
+ u8 mtbl[ETH_ALEN];
|
|
+
|
|
+ if (macaddr[0] == ':')
|
|
+ return 0;
|
|
+
|
|
+ i = 0;
|
|
+ j = 0;
|
|
+ num = 0;
|
|
+ got_num = 0;
|
|
+ while (j < ETH_ALEN) {
|
|
+ if (macaddr[i] && macaddr[i] != ':') {
|
|
+ got_num++;
|
|
+ if ('0' <= macaddr[i] && macaddr[i] <= '9')
|
|
+ num = num * 16 + macaddr[i] - '0';
|
|
+ else if ('A' <= macaddr[i] && macaddr[i] <= 'F')
|
|
+ num = num * 16 + 10 + macaddr[i] - 'A';
|
|
+ else if ('a' <= macaddr[i] && macaddr[i] <= 'f')
|
|
+ num = num * 16 + 10 + macaddr[i] - 'a';
|
|
+ else
|
|
+ break;
|
|
+ i++;
|
|
+ } else if (got_num == 2) {
|
|
+ mtbl[j++] = (u8) num;
|
|
+ num = 0;
|
|
+ got_num = 0;
|
|
+ i++;
|
|
+ } else {
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (j == ETH_ALEN) {
|
|
+ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: "
|
|
+ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2],
|
|
+ mtbl[3], mtbl[4], mtbl[5]);
|
|
+ dev_addr_mod(nd, 0, mtbl, ETH_ALEN);
|
|
+ return 1;
|
|
+ } else {
|
|
+ return 0;
|
|
+ }
|
|
+}
|
|
+
|
|
static void smsc95xx_init_mac_address(struct usbnet *dev)
|
|
{
|
|
u8 addr[ETH_ALEN];
|
|
@@ -832,6 +882,10 @@ static void smsc95xx_init_mac_address(st
|
|
}
|
|
}
|
|
|
|
+ /* Check module parameters */
|
|
+ if (smsc95xx_is_macaddr_param(dev, dev->net))
|
|
+ return;
|
|
+
|
|
/* no useful static MAC address found. generate a random one */
|
|
eth_hw_addr_random(dev->net);
|
|
netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
|