[rfc,6/6] nvme: support rdma transport type
diff mbox series

Message ID 20200803064835.67927-7-sagi@grimberg.me
State New
Headers show
Series
  • blktests: Add support to run nvme tests with tcp/rdma transports
Related show

Commit Message

Sagi Grimberg Aug. 3, 2020, 6:48 a.m. UTC
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 tests/nvme/rc | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Yi Zhang Aug. 5, 2020, 8:57 a.m. UTC | #1
On 8/3/20 2:48 PM, Sagi Grimberg wrote:
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
>   tests/nvme/rc | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
>
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 69ab7d2f3964..31d02fefa70e 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -5,6 +5,7 @@
>   # Test specific to NVMe devices
>   
>   . common/rc
> +. common/multipath-over-rdma
>   
>   def_traddr="127.0.0.1"
>   def_adrfam="ipv4"
> @@ -25,6 +26,12 @@ _nvme_requires() {
>   		_have_modules nvmet nvme-core nvme-tcp nvmet-tcp
>   		_have_configfs
>   		;;
> +	rdma)
> +		_have_modules nvmet nvme-core nvme-rdma nvmet-rdma
> +		_have_configfs
> +		_have_program rdma
> +		_have_modules rdma_rxe siw
> +		;;
>   	*)
>   		SKIP_REASON="unsupported nvme_trtype=${nvme_trtype}"
>   		return 1
> @@ -115,6 +122,9 @@ _cleanup_nvmet() {
>   		modprobe -r nvmet-${nvme_trtype} 2>/dev/null
>   	fi
>   	modprobe -r nvmet 2>/dev/null
> +	if [[ "${nvme_trtype}" == "rdma" ]]; then
> +		stop_soft_rdma
> +	fi
>   }
>   
# nvme_trtype=rdma ./check nvme/030
nvme/030 (ensure the discovery generation counter is updated appropriately)
nvme/030 (ensure the discovery generation counter is updated 
appropriately) [passed]
     runtime  0.616s  ...  0.520s 460: unload_module: command not found

The unload_module[1] was defined in [2], how about move the definition 
to [3],

[1]
_cleanup_nvmet->stop_soft_rdma->unload_module

[2]
./tests/nvmeof-mp/rc

[3]
common/multipath-over-rdma

>   _setup_nvmet() {
> @@ -124,6 +134,11 @@ _setup_nvmet() {
>   		modprobe nvmet-${nvme_trtype}
>   	fi
>   	modprobe nvme-${nvme_trtype}
> +	if [[ "${nvme_trtype}" == "rdma" ]]; then
> +		start_soft_rdma
> +		rdma_intfs=$(rdma_network_interfaces)
> +		def_traddr=$(get_ipv4_addr ${rdma_intfs[0]})
> +	fi
>   }
>   
>   _nvme_disconnect_ctrl() {
Sagi Grimberg Aug. 5, 2020, 5:59 p.m. UTC | #2
> # nvme_trtype=rdma ./check nvme/030
> nvme/030 (ensure the discovery generation counter is updated appropriately)
> nvme/030 (ensure the discovery generation counter is updated 
> appropriately) [passed]
>      runtime  0.616s  ...  0.520s 460: unload_module: command not found
> 
> The unload_module[1] was defined in [2], how about move the definition 
> to [3],
> 
> [1]
> _cleanup_nvmet->stop_soft_rdma->unload_module
> 
> [2]
> ./tests/nvmeof-mp/rc
> 
> [3]
> common/multipath-over-rdma

Right, I had this change locally:
--
diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma
index 676d2837fb06..e54b2a96153c 100644
--- a/common/multipath-over-rdma
+++ b/common/multipath-over-rdma
@@ -457,7 +457,7 @@ stop_soft_rdma() {
                                 fi
                         done
         )
-       if ! unload_module rdma_rxe 10; then
+       if ! modprobe -r rdma_rxe; then
                 echo "Unloading rdma_rxe failed"
                 return 1
         fi
@@ -469,7 +469,7 @@ stop_soft_rdma() {
                                         echo "Failed to unbind the siw 
driver from ${i%_siw}"
                         done
         )
-       if ! unload_module siw 10; then
+       if ! modprobe -r siw; then
                 echo "Unloading siw failed"
                 return 1
         fi
--

I'm not at all sure why the retry mechanism that unload_module does
is needed at all...

Bart?

Patch
diff mbox series

diff --git a/tests/nvme/rc b/tests/nvme/rc
index 69ab7d2f3964..31d02fefa70e 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -5,6 +5,7 @@ 
 # Test specific to NVMe devices
 
 . common/rc
+. common/multipath-over-rdma
 
 def_traddr="127.0.0.1"
 def_adrfam="ipv4"
@@ -25,6 +26,12 @@  _nvme_requires() {
 		_have_modules nvmet nvme-core nvme-tcp nvmet-tcp
 		_have_configfs
 		;;
+	rdma)
+		_have_modules nvmet nvme-core nvme-rdma nvmet-rdma
+		_have_configfs
+		_have_program rdma
+		_have_modules rdma_rxe siw
+		;;
 	*)
 		SKIP_REASON="unsupported nvme_trtype=${nvme_trtype}"
 		return 1
@@ -115,6 +122,9 @@  _cleanup_nvmet() {
 		modprobe -r nvmet-${nvme_trtype} 2>/dev/null
 	fi
 	modprobe -r nvmet 2>/dev/null
+	if [[ "${nvme_trtype}" == "rdma" ]]; then
+		stop_soft_rdma
+	fi
 }
 
 _setup_nvmet() {
@@ -124,6 +134,11 @@  _setup_nvmet() {
 		modprobe nvmet-${nvme_trtype}
 	fi
 	modprobe nvme-${nvme_trtype}
+	if [[ "${nvme_trtype}" == "rdma" ]]; then
+		start_soft_rdma
+		rdma_intfs=$(rdma_network_interfaces)
+		def_traddr=$(get_ipv4_addr ${rdma_intfs[0]})
+	fi
 }
 
 _nvme_disconnect_ctrl() {