[][kernel][common][eth][Store NETSYS SER event in the eth reset structure instead of using static variables]
[Description]
Refactor the NETSYS SER event to store it in the eth reset structure
instead of using static variables.
[Release-log]
N/A
Change-Id: I718464215e7b43b10bfceb2747eba9e99d3f0f30
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9657616
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c
index 9e9bb16..6dd6414 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c
@@ -407,9 +407,10 @@
atomic_set(&force, 0);
break;
case 1:
- if (atomic_read(&force) == 1)
+ if (atomic_read(&force) == 1) {
+ eth->reset.event = MTK_FE_START_RESET;
schedule_work(ð->pending_work);
- else
+ } else
pr_info(" stat:disable\n");
break;
case 2:
@@ -417,7 +418,7 @@
break;
case 3:
if (atomic_read(&force) == 1) {
- mtk_reset_flag = MTK_FE_STOP_TRAFFIC;
+ eth->reset.event = MTK_FE_STOP_TRAFFIC;
schedule_work(ð->pending_work);
} else
pr_info(" device resetting !!!\n");
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c
index 066ce20..5ebeb97 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c
@@ -31,7 +31,6 @@
static struct mtk_qdma_cfg mtk_qdma_cfg_backup;
static int mtk_rest_cnt = 0;
int mtk_wifi_num;
-u32 mtk_reset_flag = MTK_FE_START_RESET;
bool mtk_stop_fail;
typedef u32 (*mtk_monitor_xdma_func) (struct mtk_eth *eth);
@@ -90,7 +89,7 @@
#if defined(CONFIG_MEDIATEK_NETSYS_V3)
if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE2))
reset_bits |= RSTCTRL_PPE2;
- if (mtk_reset_flag == MTK_FE_START_RESET)
+ if (eth->reset.event == MTK_FE_START_RESET)
reset_bits |= RSTCTRL_WDMA0 | RSTCTRL_WDMA1 | RSTCTRL_WDMA2;
#endif
ethsys_reset(eth, reset_bits);
@@ -130,7 +129,7 @@
#if defined(CONFIG_MEDIATEK_NETSYS_V3)
if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE2))
reset_bits |= RSTCTRL_PPE2;
- if (mtk_reset_flag == MTK_FE_START_RESET)
+ if (eth->reset.event == MTK_FE_START_RESET)
reset_bits |= RSTCTRL_WDMA0 | RSTCTRL_WDMA1 | RSTCTRL_WDMA2;
#endif
@@ -803,7 +802,7 @@
(ret == MTK_FE_STOP_TRAFFIC)) {
if ((atomic_read(&reset_lock) == 0) &&
(atomic_read(&force) == 1)) {
- mtk_reset_flag = ret;
+ eth->reset.event = ret;
schedule_work(ð->pending_work);
}
break;
@@ -1011,7 +1010,7 @@
break;
case MTK_FE_STOP_TRAFFIC_DONE_FAIL:
mtk_stop_fail = true;
- mtk_reset_flag = MTK_FE_START_RESET;
+ eth->reset.event = MTK_FE_START_RESET;
pr_info("%s rcv done event:%lx\n", __func__, event);
complete(&wait_ser_done);
mtk_rest_cnt = mtk_wifi_num;
@@ -1020,7 +1019,7 @@
pr_info("%s rcv fe start reset init event:%lx\n", __func__, event);
if ((atomic_read(&reset_lock) == 0) &&
(atomic_read(&force) == 1)) {
- mtk_reset_flag = MTK_FE_START_RESET;
+ eth->reset.event = MTK_FE_START_RESET;
schedule_work(ð->pending_work);
}
default:
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.h b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.h
index 00390df..e26c57c 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.h
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.h
@@ -78,7 +78,6 @@
extern atomic_t reset_lock;
extern struct completion wait_nat_done;
extern int mtk_wifi_num;
-extern u32 mtk_reset_flag;
extern bool mtk_stop_fail;
irqreturn_t mtk_handle_fe_irq(int irq, void *_eth);
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index ef1b5bc..9c7d772 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -4902,7 +4902,7 @@
if (!eth->netdev[i])
continue;
- if (mtk_reset_flag == MTK_FE_STOP_TRAFFIC) {
+ if (eth->reset.event == MTK_FE_STOP_TRAFFIC) {
pr_info("send MTK_FE_STOP_TRAFFIC event !\n");
call_netdevice_notifiers(MTK_FE_STOP_TRAFFIC,
eth->netdev[i]);
@@ -4979,7 +4979,7 @@
if (!eth->netdev[i])
continue;
- if (mtk_reset_flag == MTK_FE_STOP_TRAFFIC) {
+ if (eth->reset.event == MTK_FE_STOP_TRAFFIC) {
pr_info("send MTK_FE_START_TRAFFIC event !\n");
call_netdevice_notifiers(MTK_FE_START_TRAFFIC,
eth->netdev[i]);
@@ -5001,7 +5001,7 @@
mt753x_set_port_link_state(1);
mtk_phy_config(eth, 1);
- mtk_reset_flag = 0;
+ eth->reset.event = 0;
clear_bit_unlock(MTK_RESETTING, ð->state);
rtnl_unlock();
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 61bad4c..22d1fd2 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -2095,6 +2095,7 @@
struct tdma_monitor tdma_monitor;
struct wdma_monitor wdma_monitor;
struct gdm_monitor gdm_monitor;
+ u32 event;
} reset;
u32 rx_dma_l4_valid;