Fix bugs found in raw/ifpga development for arrow creek
cover Fix bugs found in raw/ifpga development for arrow creek
This patchset is bug fix for raw/ifpga driver.
Changes:
* Fix SPI transaction.
* Fix pthread cannot join.
* Fix ifpga devices cleanup function.
* Fix port feature ID.
Tianfei Zhang (2):
raw/ifpga/base: fix SPI transaction
raw/ifpga: fix pthread cannot join
Wei Huang (2):
raw/ifpga: fix ifpga devices cleanup function
raw/ifpga/base: fix port feature ID
drivers/raw/ifpga/base/ifpga_defines.h | 6 +- drivers/raw/ifpga/base/opae_spi.c | 12 ++ drivers/raw/ifpga/base/opae_spi.h | 4 + drivers/raw/ifpga/base/opae_spi_transaction.c | 215 +++++++++++++++----------- drivers/raw/ifpga/ifpga_rawdev.c | 12 +- 5 files changed, 150 insertions(+), 99 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/4 raw/ifpga/base: fix SPI transaction
From: Tianfei Zhang <[email protected]>
When EOP is detected, 2 more bytes should be received (may be a SPI_PACKET_ESC before last valid byte) then rx should be finished.
--- drivers/raw/ifpga/base/opae_spi.c | 12 ++ drivers/raw/ifpga/base/opae_spi.h | 4 + drivers/raw/ifpga/base/opae_spi_transaction.c | 215 +++++++++++++++----------- 3 files changed, 140 insertions(+), 91 deletions(-)
drivers/raw/ifpga/base/opae_spi.c +12 -0
@@ -239,6 +239,18 @@ int spi_command(struct altera_spi_device *dev, unsigned int chip_select,return 0 ; } +int spi_write (struct altera_spi_device *dev,unsigned int chip_select, +unsigned int wlen,void *wdata) +{ +return spi_command (dev, chip_select, wlen, wdata,0 ,NULL ); +} + +int spi_read (struct altera_spi_device *dev,unsigned int chip_select, +unsigned int rlen,void *rdata) +{ +return spi_command (dev, chip_select,0 ,NULL , rlen, rdata); +} +struct altera_spi_device *altera_spi_alloc (void *base,int type) { struct altera_spi_device *spi_dev =
drivers/raw/ifpga/base/opae_spi.h +4 -0
@@ -117,6 +117,10 @@ struct spi_tran_header {u32 addr; }; +int spi_read (struct altera_spi_device *dev,unsigned int chip_select, +unsigned int rlen,void *rdata); +int spi_write (struct altera_spi_device *dev,unsigned int chip_select, +unsigned int wlen,void *wdata);int spi_command (struct altera_spi_device *dev,unsigned int chip_select,unsigned int wlen,void *wdata,unsigned int rlen,void *rdata);void spi_cs_deactivate (struct altera_spi_device *dev);
drivers/raw/ifpga/base/opae_spi_transaction.c +124 -91
275 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 2/4 raw/ifpga: fix pthread cannot join
In reply to Wei HuangFrom: Tianfei Zhang <[email protected]>
When we want to close a thread, we should set a flag to thread handler function.
--- drivers/raw/ifpga/ifpga_rawdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/raw/ifpga/ifpga_rawdev.c +4 -4
@@ -497,7 +497,7 @@ static int set_surprise_link_check_aer(int gsd_enable, ret;#define MS 1000 -while (1 ) { +while (ifpga_monitor_start) { gsd_enable =0 ;for (i =0 ; i <IFPGA_RAWDEV_NUM ; i++) { ifpga_rdev = &ifpga_rawdevices[i];
@@ -544,7 +544,9 @@ static int set_surprise_link_check_aer( {int ret; -if (ifpga_monitor_start ==1 ) { +if (ifpga_monitor_start ==1 && ifpga_monitor_start_thread) { + ifpga_monitor_start =0 ; + ret =pthread_cancel (ifpga_monitor_start_thread);if (ret)IFPGA_RAWDEV_PMD_ERR ("Can't cancel the thread" );
@@ -553,8 +555,6 @@ static int set_surprise_link_check_aer(if (ret)IFPGA_RAWDEV_PMD_ERR ("Can't join the thread" ); - ifpga_monitor_start =0 ; -return ret; }
Signature · 1 line
1.8.3.1
PATCH 3/4 raw/ifpga: fix ifpga devices cleanup function
In reply to Wei HuangUse rte_dev_remove() to replace rte_rawdev_pmd_release() in ifpga_rawdev_cleanup(), resources occupied by ifpga raw devices such as threads can be released correctly.
--- drivers/raw/ifpga/ifpga_rawdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/raw/ifpga/ifpga_rawdev.c +3 -1
@@ -1787,12 +1787,14 @@ int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,void ifpga_rawdev_cleanup (void ) {struct ifpga_rawdev *dev; +struct rte_rawdev *rdev;unsigned int i;for (i =0 ; i <IFPGA_RAWDEV_NUM ; i++) { dev = &ifpga_rawdevices[i];if (dev->rawdev) { -rte_rawdev_pmd_release (dev->rawdev); + rdev = dev->rawdev; +rte_dev_remove (rdev->device); dev->rawdev =NULL ; } }
Signature · 1 line
1.8.3.1
PATCH 4/4 raw/ifpga/base: fix port feature ID
In reply to Wei HuangFix ID value of port features to match the definition from hardware.
--- drivers/raw/ifpga/base/ifpga_defines.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/raw/ifpga/base/ifpga_defines.h +3 -3
@@ -93,9 +93,9 @@ enum fpga_id_type {#define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER#define PORT_FEATURE_ID_ERROR 0x10 -#define PORT_FEATURE_ID_UMSG 0x12 -#define PORT_FEATURE_ID_UINT 0x13 -#define PORT_FEATURE_ID_STP 0x14 +#define PORT_FEATURE_ID_UMSG 0x11 +#define PORT_FEATURE_ID_UINT 0x12 +#define PORT_FEATURE_ID_STP 0x13#define PORT_FEATURE_ID_UAFU FEATURE_ID_AFU/*
Signature · 1 line
1.8.3.1
RE: [PATCH v1 4/4] raw/ifpga/base: fix port feature ID
Hi Wei,
Some issues of ci/iol-x86_64-unit-testing, pls check it. Thanks a lot.
Thanks,
Rosen
-----Original Message-----
From: Huang, Wei <[email protected]>
Sent: Tuesday, January 18, 2022 11:18 AM
To: [email protected]; Xu, Rosen <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Zhang, Tianfei <[email protected]>; Yigit, Ferruh <[email protected]>; Huang, Wei <[email protected]>
Subject: [PATCH v1 4/4] raw/ifpga/base: fix port feature ID
Fix ID value of port features to match the definition from hardware.
--- drivers/raw/ifpga/base/ifpga_defines.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/raw/ifpga/base/ifpga_defines.h +3 -1
@@ -93,9 +93,9 @@ enum fpga_id_type {#define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER #define PORT_FEATURE_ID_ERROR 0x10 -#define PORT_FEATURE_ID_UMSG 0x12 -#define PORT_FEATURE_ID_UINT 0x13 -#define PORT_FEATURE_ID_STP 0x14 +#define PORT_FEATURE_ID_UMSG 0x11 +#define PORT_FEATURE_ID_UINT 0x12 +#define PORT_FEATURE_ID_STP 0x13#define PORT_FEATURE_ID_UAFU FEATURE_ID_AFU/* --
1.8.3.1
v2 cover Fix bugs found in raw/ifpga development for arrow creek
In reply to Wei HuangThis patchset is bug fix for raw/ifpga driver.
Changes since v1:
* Refine commit log.
Tianfei Zhang (2):
raw/ifpga/base: fix SPI transaction
raw/ifpga: fix pthread cannot join
Wei Huang (2):
raw/ifpga: fix ifpga devices cleanup function
raw/ifpga/base: fix port feature ID
drivers/raw/ifpga/base/ifpga_defines.h | 6 +- drivers/raw/ifpga/base/opae_spi.c | 12 ++ drivers/raw/ifpga/base/opae_spi.h | 4 + drivers/raw/ifpga/base/opae_spi_transaction.c | 215 +++++++++++++++----------- drivers/raw/ifpga/ifpga_rawdev.c | 12 +- 5 files changed, 150 insertions(+), 99 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/4 raw/ifpga/base: fix SPI transaction
From: Tianfei Zhang <[email protected]>
When EOP is detected, 2 more bytes should be received (may be a SPI_PACKET_ESC before last valid byte) then rx should be finished.
--- drivers/raw/ifpga/base/opae_spi.c | 12 ++ drivers/raw/ifpga/base/opae_spi.h | 4 + drivers/raw/ifpga/base/opae_spi_transaction.c | 215 +++++++++++++++----------- 3 files changed, 140 insertions(+), 91 deletions(-)
drivers/raw/ifpga/base/opae_spi.c +12 -0
@@ -239,6 +239,18 @@ int spi_command(struct altera_spi_device *dev, unsigned int chip_select,return 0 ; } +int spi_write (struct altera_spi_device *dev,unsigned int chip_select, +unsigned int wlen,void *wdata) +{ +return spi_command (dev, chip_select, wlen, wdata,0 ,NULL ); +} + +int spi_read (struct altera_spi_device *dev,unsigned int chip_select, +unsigned int rlen,void *rdata) +{ +return spi_command (dev, chip_select,0 ,NULL , rlen, rdata); +} +struct altera_spi_device *altera_spi_alloc (void *base,int type) { struct altera_spi_device *spi_dev =
drivers/raw/ifpga/base/opae_spi.h +4 -0
@@ -117,6 +117,10 @@ struct spi_tran_header {u32 addr; }; +int spi_read (struct altera_spi_device *dev,unsigned int chip_select, +unsigned int rlen,void *rdata); +int spi_write (struct altera_spi_device *dev,unsigned int chip_select, +unsigned int wlen,void *wdata);int spi_command (struct altera_spi_device *dev,unsigned int chip_select,unsigned int wlen,void *wdata,unsigned int rlen,void *rdata);void spi_cs_deactivate (struct altera_spi_device *dev);
drivers/raw/ifpga/base/opae_spi_transaction.c +124 -91
275 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 2/4 raw/ifpga: fix pthread cannot join
In reply to Wei HuangFrom: Tianfei Zhang <[email protected]>
When we want to close a thread, we should set a flag to thread handler function.
--- drivers/raw/ifpga/ifpga_rawdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/raw/ifpga/ifpga_rawdev.c +4 -4
@@ -497,7 +497,7 @@ static int set_surprise_link_check_aer(int gsd_enable, ret;#define MS 1000 -while (1 ) { +while (ifpga_monitor_start) { gsd_enable =0 ;for (i =0 ; i <IFPGA_RAWDEV_NUM ; i++) { ifpga_rdev = &ifpga_rawdevices[i];
@@ -544,7 +544,9 @@ static int set_surprise_link_check_aer( {int ret; -if (ifpga_monitor_start ==1 ) { +if (ifpga_monitor_start ==1 && ifpga_monitor_start_thread) { + ifpga_monitor_start =0 ; + ret =pthread_cancel (ifpga_monitor_start_thread);if (ret)IFPGA_RAWDEV_PMD_ERR ("Can't cancel the thread" );
@@ -553,8 +555,6 @@ static int set_surprise_link_check_aer(if (ret)IFPGA_RAWDEV_PMD_ERR ("Can't join the thread" ); - ifpga_monitor_start =0 ; -return ret; }
Signature · 1 line
1.8.3.1
PATCH v2 3/4 raw/ifpga: fix ifpga devices cleanup function
In reply to Wei HuangUse rte_dev_remove() to replace rte_rawdev_pmd_release() in ifpga_rawdev_cleanup(), resources occupied by ifpga raw devices such as threads can be released correctly.
--- drivers/raw/ifpga/ifpga_rawdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/raw/ifpga/ifpga_rawdev.c +3 -1
@@ -1787,12 +1787,14 @@ int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,void ifpga_rawdev_cleanup (void ) {struct ifpga_rawdev *dev; +struct rte_rawdev *rdev;unsigned int i;for (i =0 ; i <IFPGA_RAWDEV_NUM ; i++) { dev = &ifpga_rawdevices[i];if (dev->rawdev) { -rte_rawdev_pmd_release (dev->rawdev); + rdev = dev->rawdev; +rte_dev_remove (rdev->device); dev->rawdev =NULL ; } }
Signature · 1 line
1.8.3.1
PATCH v2 4/4 raw/ifpga/base: fix port feature ID
In reply to Wei HuangFix ID value of port features to match the definition from hardware.
--- drivers/raw/ifpga/base/ifpga_defines.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/raw/ifpga/base/ifpga_defines.h +3 -3
@@ -93,9 +93,9 @@ enum fpga_id_type {#define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER#define PORT_FEATURE_ID_ERROR 0x10 -#define PORT_FEATURE_ID_UMSG 0x12 -#define PORT_FEATURE_ID_UINT 0x13 -#define PORT_FEATURE_ID_STP 0x14 +#define PORT_FEATURE_ID_UMSG 0x11 +#define PORT_FEATURE_ID_UINT 0x12 +#define PORT_FEATURE_ID_STP 0x13#define PORT_FEATURE_ID_UAFU FEATURE_ID_AFU/*
Signature · 1 line
1.8.3.1