6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
20 local iface vf_count device
24 echo "Setting interface $iface max vf count to $vf_count"
25 device=$(/bin/mst status -v | grep -E "net-${iface}[[:space:]]+" | awk '{print $2}')
26 /bin/mlxconfig --yes --dev $device set NUM_OF_VFS=$vf_count
31 local -r CONF_FILE="/etc/sriov/sriov.conf"
34 local item iface vf_count
36 [[ -r $CONF_FILE ]] && source $CONF_FILE
38 if [[ -n "$SRIOV_VF_COUNTS" ]]
40 for item in $SRIOV_VF_COUNTS
44 if /sbin/ethtool -i $iface | grep -qE '^driver:[[:space:]]+mlx5_core$'
46 old_count=$(</sys/class/net/$iface/device/sriov_totalvfs)
47 [[ $old_count -eq $vf_count ]] && continue
48 [[ $mst_started -eq 0 ]] && /bin/mst start
50 set_max_vf_count $iface $vf_count