From: Wujiahai wujiahai@huawei.com
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAMW2S CVE: NA
-----------------------------------------
1. The initialization sequence of the edma_host.timer and edma_host is optimized when the iBMA initializes the edma driver. 2. Change the iBMA driver version.
Fixes: ea190d90c609 ("Huawei BMA: Adding Huawei BMA driver: host_edma_drv") Signed-off-by: Wujiahai wujiahai@huawei.com --- .../ethernet/huawei/bma/cdev_drv/bma_cdev.c | 2 +- .../ethernet/huawei/bma/edma_drv/bma_pci.h | 2 +- .../ethernet/huawei/bma/edma_drv/edma_host.c | 80 ++++++++----------- .../huawei/bma/kbox_drv/kbox_include.h | 2 +- .../ethernet/huawei/bma/veth_drv/veth_hb.h | 2 +- 5 files changed, 38 insertions(+), 50 deletions(-)
diff --git a/drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c b/drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c index 0ca73d40e6d8..4be8a4fc6cec 100644 --- a/drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c +++ b/drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c @@ -28,7 +28,7 @@ #ifdef DRV_VERSION #define CDEV_VERSION MICRO_TO_STR(DRV_VERSION) #else -#define CDEV_VERSION "0.3.7" +#define CDEV_VERSION "0.3.8" #endif
#define CDEV_DEFAULT_NUM 4 diff --git a/drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h b/drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h index 0f6098ee5560..d1c62a77a434 100644 --- a/drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h +++ b/drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h @@ -71,7 +71,7 @@ struct bma_pci_dev_s { #ifdef DRV_VERSION #define BMA_VERSION MICRO_TO_STR(DRV_VERSION) #else -#define BMA_VERSION "0.3.7" +#define BMA_VERSION "0.3.8" #endif
#ifdef CONFIG_ARM64 diff --git a/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c b/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c index cf6e4fd1de3c..4641e359e8fc 100644 --- a/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c +++ b/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c @@ -1319,47 +1319,15 @@ int edma_host_init(struct edma_host_s *edma_host)
edma_host->pdev = bma_dev->bma_pci_dev->pdev;
-#ifdef EDMA_TIMER - #ifdef HAVE_TIMER_SETUP - timer_setup(&edma_host->timer, edma_host_timeout, 0); - #else - setup_timer(&edma_host->timer, edma_host_timeout, - (unsigned long)edma_host); - #endif - (void)mod_timer(&edma_host->timer, jiffies_64 + TIMER_INTERVAL_CHECK); -#ifdef USE_DMA - #ifdef HAVE_TIMER_SETUP - timer_setup(&edma_host->dma_timer, edma_host_dma_timeout, 0); - - #else - setup_timer(&edma_host->dma_timer, edma_host_dma_timeout, - (unsigned long)edma_host); - #endif - (void)mod_timer(&edma_host->dma_timer, - jiffies_64 + DMA_TIMER_INTERVAL_CHECK); -#endif - -#else - init_completion(&edma_host->msg_ready); - - edma_host->edma_thread = - kthread_run(edma_host_thread, (void *)edma_host, "edma_host_msg"); - - if (IS_ERR(edma_host->edma_thread)) { - BMA_LOG(DLOG_ERROR, "kernel_run edma_host_msg failed\n"); - return PTR_ERR(edma_host->edma_thread); - } -#endif - edma_host->msg_send_buf = kmalloc(HOST_MAX_SEND_MBX_LEN, GFP_KERNEL); if (!edma_host->msg_send_buf) { BMA_LOG(DLOG_ERROR, "malloc msg_send_buf failed!"); ret = -ENOMEM; - goto failed1; + return ret; }
edma_host->msg_send_write = 0; - + /* init send_msg_lock before timer setup */ spin_lock_init(&edma_host->send_msg_lock);
tasklet_init(&edma_host->tasklet, @@ -1392,6 +1360,38 @@ int edma_host_init(struct edma_host_s *edma_host) edma_host->h2b_state = H2BSTATE_IDLE; edma_host->b2h_state = B2HSTATE_IDLE;
+#ifdef EDMA_TIMER + #ifdef HAVE_TIMER_SETUP + timer_setup(&edma_host->timer, edma_host_timeout, 0); + #else + setup_timer(&edma_host->timer, edma_host_timeout, + (unsigned long)edma_host); + #endif + (void)mod_timer(&edma_host->timer, jiffies_64 + TIMER_INTERVAL_CHECK); +#ifdef USE_DMA + #ifdef HAVE_TIMER_SETUP + timer_setup(&edma_host->dma_timer, edma_host_dma_timeout, 0); + + #else + setup_timer(&edma_host->dma_timer, edma_host_dma_timeout, + (unsigned long)edma_host); + #endif + (void)mod_timer(&edma_host->dma_timer, + jiffies_64 + DMA_TIMER_INTERVAL_CHECK); +#endif + +#else + init_completion(&edma_host->msg_ready); + + edma_host->edma_thread = + kthread_run(edma_host_thread, (void *)edma_host, "edma_host_msg"); + + if (IS_ERR(edma_host->edma_thread)) { + BMA_LOG(DLOG_ERROR, "kernel_run edma_host_msg failed\n"); + return PTR_ERR(edma_host->edma_thread); + } +#endif + #ifdef HAVE_TIMER_SETUP timer_setup(&edma_host->heartbeat_timer, edma_host_heartbeat_timer, 0); @@ -1415,18 +1415,6 @@ int edma_host_init(struct edma_host_s *edma_host) BMA_LOG(DLOG_ERROR, "thread ok\n"); #endif return 0; - -failed1: -#ifdef EDMA_TIMER - (void)del_timer_sync(&edma_host->timer); -#ifdef USE_DMA - (void)del_timer_sync(&edma_host->dma_timer); -#endif -#else - kthread_stop(edma_host->edma_thread); - complete(&edma_host->msg_ready); -#endif - return ret; }
void edma_host_cleanup(struct edma_host_s *edma_host) diff --git a/drivers/net/ethernet/huawei/bma/kbox_drv/kbox_include.h b/drivers/net/ethernet/huawei/bma/kbox_drv/kbox_include.h index efc108a5a9d8..8371903e2c33 100644 --- a/drivers/net/ethernet/huawei/bma/kbox_drv/kbox_include.h +++ b/drivers/net/ethernet/huawei/bma/kbox_drv/kbox_include.h @@ -23,7 +23,7 @@ #ifdef DRV_VERSION #define KBOX_VERSION MICRO_TO_STR(DRV_VERSION) #else -#define KBOX_VERSION "0.3.7" +#define KBOX_VERSION "0.3.8" #endif
#define UNUSED(x) (x = x) diff --git a/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.h b/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.h index f54d2df2771e..f03e6eccde6c 100644 --- a/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.h +++ b/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.h @@ -31,7 +31,7 @@ extern "C" { #ifdef DRV_VERSION #define VETH_VERSION MICRO_TO_STR(DRV_VERSION) #else -#define VETH_VERSION "0.3.7" +#define VETH_VERSION "0.3.8" #endif
#define MODULE_NAME "veth"