summaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorShiji Yang <yangshiji66@qq.com>2023-05-25 18:35:20 +0800
committerDavid Bauer <mail@david-bauer.net>2023-09-08 18:06:30 +0200
commit7189b4578466a8a4c570ee328895d8a97a942893 (patch)
treefec1d09f9a74424b9923ba257d63e0c94183bf07 /target/linux
parent5f59d28bc3434d5b582310579096fa839f86e1df (diff)
downloadopenwrt-7189b4578466a8a4c570ee328895d8a97a942893.tar.gz
openwrt-7189b4578466a8a4c570ee328895d8a97a942893.tar.bz2
openwrt-7189b4578466a8a4c570ee328895d8a97a942893.zip
ath79: fix ethernet driver build errors on kernel 6.1
Some net APIs have changed on the new kernel. Update them to fix compile errors. Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c14
-rw-r--r--target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c13
2 files changed, 22 insertions, 5 deletions
diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c
index 104b9320b9..e5adc821d2 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c
@@ -80,8 +80,15 @@ static void ag71xx_ethtool_set_msglevel(struct net_device *dev, u32 msg_level)
ag->msg_enable = msg_level;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)
+static void ag71xx_ethtool_get_ringparam(struct net_device *dev,
+ struct ethtool_ringparam *er,
+ struct kernel_ethtool_ringparam *kernel_ring,
+ struct netlink_ext_ack *extack)
+#else
static void ag71xx_ethtool_get_ringparam(struct net_device *dev,
struct ethtool_ringparam *er)
+#endif
{
struct ag71xx *ag = netdev_priv(dev);
@@ -99,8 +106,15 @@ static void ag71xx_ethtool_get_ringparam(struct net_device *dev,
er->tx_pending /= AG71XX_TX_RING_DS_PER_PKT;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)
+static int ag71xx_ethtool_set_ringparam(struct net_device *dev,
+ struct ethtool_ringparam *er,
+ struct kernel_ethtool_ringparam *kernel_ring,
+ struct netlink_ext_ack *extack)
+#else
static int ag71xx_ethtool_set_ringparam(struct net_device *dev,
struct ethtool_ringparam *er)
+#endif
{
struct ag71xx *ag = netdev_priv(dev);
unsigned tx_size;
diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 06ebbd8ea3..8f95210e0f 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -333,7 +333,7 @@ static unsigned char *ag71xx_speed_str(struct ag71xx *ag)
return "?";
}
-static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char *mac)
+static void ag71xx_hw_set_macaddr(struct ag71xx *ag, const unsigned char *mac)
{
u32 t;
@@ -1166,7 +1166,7 @@ static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
switch (cmd) {
case SIOCSIFHWADDR:
if (copy_from_user
- (dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr)))
+ ((void*)dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr)))
return -EFAULT;
return 0;
@@ -1669,10 +1669,9 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->stop_desc->ctrl = 0;
ag->stop_desc->next = (u32) ag->stop_desc_dma;
- of_get_mac_address(np, dev->dev_addr);
- if (!is_valid_ether_addr(dev->dev_addr)) {
+ if (of_get_ethdev_address(np, dev)) {
dev_err(&pdev->dev, "invalid MAC address, using random address\n");
- eth_random_addr(dev->dev_addr);
+ eth_hw_addr_random(dev);
}
err = of_get_phy_mode(np, &ag->phy_if_mode);
@@ -1699,7 +1698,11 @@ static int ag71xx_probe(struct platform_device *pdev)
break;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)
+ netif_napi_add_weight(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT);
+#else
netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT);
+#endif
ag71xx_dump_regs(ag);