diff mbox

[infiniband-diags] scripts: Add mkey support into ibhosts, ibswitches, and ibrouters

Message ID a4a95aaf-f7ff-2ab8-feec-8a206c070044@dev.mellanox.co.il (mailing list archive)
State Accepted, archived
Delegated to: Ira Weiny
Headers show

Commit Message

Hal Rosenstock Nov. 28, 2016, 9:47 p.m. UTC
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Ira Weiny Dec. 20, 2016, 4:51 p.m. UTC | #1
On Mon, Nov 28, 2016 at 04:47:52PM -0500, Hal Rosenstock wrote:
> 
> Signed-off-by: Hal Rosenstock <hal@mellanox.com>
>

Applied:

However, We should have added the common option to the rst/man files for this
to be in the man pages.

19:28:46 > cat opt_y.rst 
.. Define the common option -y

**-y, --m_key <key>**
        use the specified M_key for requests. If non-numeric value (like 'x')
	        is specified then a value will be prompted for.


I went ahead and added a follow on patch to do this.

Thanks,
Ira

> ---
> diff --git a/scripts/ibhosts.in b/scripts/ibhosts.in
> index fda0541..c37260c 100644
> --- a/scripts/ibhosts.in
> +++ b/scripts/ibhosts.in
> @@ -3,19 +3,32 @@
>  IBPATH=${IBPATH:-@IBSCRIPTPATH@}
>  
>  usage() {
> -	echo Usage: `basename $0` "[-h] [<topology-file> | -C ca_name" \
> -	    "-P ca_port -t timeout_ms]"
> +	echo Usage: `basename $0` "[-h] [<topology-file> | -y mkey" \
> +	    "-C ca_name -P ca_port -t timeout_ms]"
>  	exit -1
>  }
>  
>  topofile=""
>  ca_info=""
> +mkey="0"
>  
>  while [ "$1" ]; do
>  	case $1 in
>  	-h | --help)
>  		usage
>  		;;
> +	-y | --m_key)
> +		case $2 in
> +		-*)
> +			usage
> +			;;
> +		esac
> +		if [ x$2 = x ] ; then
> +			usage
> +		fi
> +		shift
> +		mkey="$1"
> +		;;
>  	-P | --Port | -C | --Ca | -t | --timeout)
>  		case $2 in
>  		-*)
> @@ -44,7 +57,7 @@ done
>  if [ "$topofile" ]; then
>  	netcmd="cat $topofile"
>  else
> -	netcmd="$IBPATH/ibnetdiscover $ca_info"
> +	netcmd="$IBPATH/ibnetdiscover -y $mkey $ca_info"
>  fi
>  
>  text="`eval $netcmd`"
> diff --git a/scripts/ibrouters.in b/scripts/ibrouters.in
> index ae66ca4..b3e5a1d 100644
> --- a/scripts/ibrouters.in
> +++ b/scripts/ibrouters.in
> @@ -3,19 +3,32 @@
>  IBPATH=${IBPATH:-@IBSCRIPTPATH@}
>  
>  usage() {
> -	echo Usage: `basename $0` "[-h] [<topology-file> | -C ca_name" \
> -	    "-P ca_port -t timeout_ms]"
> +	echo Usage: `basename $0` "[-h] [<topology-file> | -y mkey" \
> +	    "-C ca_name -P ca_port -t timeout_ms]"
>  	exit -1
>  }
>  
>  topofile=""
>  ca_info=""
> +mkey="0"
>  
>  while [ "$1" ]; do
>  	case $1 in
>  	-h | --help)
>  		usage
>  		;;
> +	-y | --m_key)
> +		case $2 in
> +		-*)
> +			usage
> +			;;
> +		esac
> +		if [ x$2 = x ] ; then
> +			usage
> +		fi
> +		shift
> +		mkey="$1"
> +		;;
>  	-P | --Port | -C | --Ca | -t | --timeout)
>  		case $2 in
>  		-*)
> @@ -44,7 +57,7 @@ done
>  if [ "$topofile" ]; then
>  	netcmd="cat $topofile"
>  else
> -	netcmd="$IBPATH/ibnetdiscover $ca_info"
> +	netcmd="$IBPATH/ibnetdiscover -y $mkey $ca_info"
>  fi
>  
>  text="`eval $netcmd`"
> diff --git a/scripts/ibswitches.in b/scripts/ibswitches.in
> index 0f3aa91..743f1db 100644
> --- a/scripts/ibswitches.in
> +++ b/scripts/ibswitches.in
> @@ -3,19 +3,32 @@
>  IBPATH=${IBPATH:-@IBSCRIPTPATH@}
>  
>  usage() {
> -	echo Usage: `basename $0` "[-h] [<topology-file> | -C ca_name" \
> -	    "-P ca_port -t timeout_ms]"
> +	echo Usage: `basename $0` "[-h] [<topology-file> | -y mkey" \
> +	    "-C ca_name -P ca_port -t timeout_ms]"
>  	exit -1
>  }
>  
>  topofile=""
>  ca_info=""
> +mkey="0"
>  
>  while [ "$1" ]; do
>  	case $1 in
>  	-h | --help)
>  		usage
>  		;;
> +	-y | --m_key)
> +		case $2 in
> +		-*)
> +			usage
> +			;;
> +		esac
> +		if [ x$2 = x ] ; then
> +			usage
> +		fi
> +		shift
> +		mkey="$1"
> +		;;
>  	-P | --Port | -C | --Ca | -t | --timeout)
>  		case $2 in
>  		-*)
> @@ -44,7 +57,7 @@ done
>  if [ "$topofile" ]; then
>  	netcmd="cat $topofile"
>  else
> -	netcmd="$IBPATH/ibnetdiscover $ca_info"
> +	netcmd="$IBPATH/ibnetdiscover -y $mkey $ca_info"
>  fi
>  
>  text="`eval $netcmd`"
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/ibhosts.in b/scripts/ibhosts.in
index fda0541..c37260c 100644
--- a/scripts/ibhosts.in
+++ b/scripts/ibhosts.in
@@ -3,19 +3,32 @@ 
 IBPATH=${IBPATH:-@IBSCRIPTPATH@}
 
 usage() {
-	echo Usage: `basename $0` "[-h] [<topology-file> | -C ca_name" \
-	    "-P ca_port -t timeout_ms]"
+	echo Usage: `basename $0` "[-h] [<topology-file> | -y mkey" \
+	    "-C ca_name -P ca_port -t timeout_ms]"
 	exit -1
 }
 
 topofile=""
 ca_info=""
+mkey="0"
 
 while [ "$1" ]; do
 	case $1 in
 	-h | --help)
 		usage
 		;;
+	-y | --m_key)
+		case $2 in
+		-*)
+			usage
+			;;
+		esac
+		if [ x$2 = x ] ; then
+			usage
+		fi
+		shift
+		mkey="$1"
+		;;
 	-P | --Port | -C | --Ca | -t | --timeout)
 		case $2 in
 		-*)
@@ -44,7 +57,7 @@  done
 if [ "$topofile" ]; then
 	netcmd="cat $topofile"
 else
-	netcmd="$IBPATH/ibnetdiscover $ca_info"
+	netcmd="$IBPATH/ibnetdiscover -y $mkey $ca_info"
 fi
 
 text="`eval $netcmd`"
diff --git a/scripts/ibrouters.in b/scripts/ibrouters.in
index ae66ca4..b3e5a1d 100644
--- a/scripts/ibrouters.in
+++ b/scripts/ibrouters.in
@@ -3,19 +3,32 @@ 
 IBPATH=${IBPATH:-@IBSCRIPTPATH@}
 
 usage() {
-	echo Usage: `basename $0` "[-h] [<topology-file> | -C ca_name" \
-	    "-P ca_port -t timeout_ms]"
+	echo Usage: `basename $0` "[-h] [<topology-file> | -y mkey" \
+	    "-C ca_name -P ca_port -t timeout_ms]"
 	exit -1
 }
 
 topofile=""
 ca_info=""
+mkey="0"
 
 while [ "$1" ]; do
 	case $1 in
 	-h | --help)
 		usage
 		;;
+	-y | --m_key)
+		case $2 in
+		-*)
+			usage
+			;;
+		esac
+		if [ x$2 = x ] ; then
+			usage
+		fi
+		shift
+		mkey="$1"
+		;;
 	-P | --Port | -C | --Ca | -t | --timeout)
 		case $2 in
 		-*)
@@ -44,7 +57,7 @@  done
 if [ "$topofile" ]; then
 	netcmd="cat $topofile"
 else
-	netcmd="$IBPATH/ibnetdiscover $ca_info"
+	netcmd="$IBPATH/ibnetdiscover -y $mkey $ca_info"
 fi
 
 text="`eval $netcmd`"
diff --git a/scripts/ibswitches.in b/scripts/ibswitches.in
index 0f3aa91..743f1db 100644
--- a/scripts/ibswitches.in
+++ b/scripts/ibswitches.in
@@ -3,19 +3,32 @@ 
 IBPATH=${IBPATH:-@IBSCRIPTPATH@}
 
 usage() {
-	echo Usage: `basename $0` "[-h] [<topology-file> | -C ca_name" \
-	    "-P ca_port -t timeout_ms]"
+	echo Usage: `basename $0` "[-h] [<topology-file> | -y mkey" \
+	    "-C ca_name -P ca_port -t timeout_ms]"
 	exit -1
 }
 
 topofile=""
 ca_info=""
+mkey="0"
 
 while [ "$1" ]; do
 	case $1 in
 	-h | --help)
 		usage
 		;;
+	-y | --m_key)
+		case $2 in
+		-*)
+			usage
+			;;
+		esac
+		if [ x$2 = x ] ; then
+			usage
+		fi
+		shift
+		mkey="$1"
+		;;
 	-P | --Port | -C | --Ca | -t | --timeout)
 		case $2 in
 		-*)
@@ -44,7 +57,7 @@  done
 if [ "$topofile" ]; then
 	netcmd="cat $topofile"
 else
-	netcmd="$IBPATH/ibnetdiscover $ca_info"
+	netcmd="$IBPATH/ibnetdiscover -y $mkey $ca_info"
 fi
 
 text="`eval $netcmd`"