403Webshell
Server IP : 15.235.198.142  /  Your IP : 216.73.216.155
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/src/linux-headers-6.8.0-60/tools/testing/selftests/drivers/net/mlxsw/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/src/linux-headers-6.8.0-60/tools/testing/selftests/drivers/net/mlxsw/mlxsw_lib.sh
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

##############################################################################
# Defines

if [[ ! -v MLXSW_CHIP ]]; then
	MLXSW_CHIP=$(devlink -j dev info $DEVLINK_DEV | jq -r '.[][]["driver"]')
	if [ -z "$MLXSW_CHIP" ]; then
		echo "SKIP: Device $DEVLINK_DEV doesn't support devlink info command"
		exit 1
	fi
fi

MLXSW_SPECTRUM_REV=$(case $MLXSW_CHIP in
			     mlxsw_spectrum)
				     echo 1 ;;
			     mlxsw_spectrum*)
				     echo ${MLXSW_CHIP#mlxsw_spectrum} ;;
			     *)
				     echo "Couldn't determine Spectrum chip revision." \
					  > /dev/stderr ;;
		     esac)

mlxsw_on_spectrum()
{
	local rev=$1; shift
	local op="=="
	local rev2=${rev%+}

	if [[ $rev2 != $rev ]]; then
		op=">="
	fi

	((MLXSW_SPECTRUM_REV $op rev2))
}

__mlxsw_only_on_spectrum()
{
	local rev=$1; shift
	local caller=$1; shift
	local src=$1; shift

	if ! mlxsw_on_spectrum "$rev"; then
		log_test_skip $src:$caller "(Spectrum-$rev only)"
		return 1
	fi
}

mlxsw_only_on_spectrum()
{
	local caller=${FUNCNAME[1]}
	local src=${BASH_SOURCE[1]}
	local rev

	for rev in "$@"; do
		if __mlxsw_only_on_spectrum "$rev" "$caller" "$src"; then
			return 0
		fi
	done

	return 1
}

mlxsw_max_descriptors_get()
{
	local spectrum_rev=$MLXSW_SPECTRUM_REV

	case $spectrum_rev in
	1) echo 81920 ;;
	2) echo 136960 ;;
	3) echo 204800 ;;
	4) echo 220000 ;;
	*) echo "Unknown max descriptors for chip revision." > /dev/stderr
	   return 1 ;;
	esac
}

Youez - 2016 - github.com/yon3zu
LinuXploit