Merge "ovs-dpdkctl.sh function list_dpdk_nics only grabs the first nic"

This commit is contained in:
Zuul 2018-10-01 10:04:02 +00:00 committed by Gerrit Code Review
commit 225d7c70a1

View File

@ -94,8 +94,7 @@ function gen_config {
for nic in $(list_dpdk_nics); do for nic in $(list_dpdk_nics); do
set_value $nic driver ${dpdk_interface_driver:-"uio_pci_generic"} set_value $nic driver ${dpdk_interface_driver:-"uio_pci_generic"}
done done
set_value ovs pci_whitelist "'${pci_whitelist:-$(generate_pciwhitelist)}'" set_value ovs pci_whitelist "${pci_whitelist:-$(generate_pciwhitelist)}"
} }
function bind_nic { function bind_nic {
@ -106,11 +105,10 @@ function bind_nic {
function unbind_nic { function unbind_nic {
echo $1 > /sys/bus/pci/drivers/$2/unbind echo $1 > /sys/bus/pci/drivers/$2/unbind
echo > /sys/bus/pci/devices/$1/driver_override echo > /sys/bus/pci/devices/$1/driver_override
} }
function list_dpdk_nics { function list_dpdk_nics {
for nic in $(crudini --get $CONFIG_FILE ovs port_mappings | cut -d : -f 1); do for nic in $(get_value ovs port_mappings | tr ',' '\n' | cut -d : -f 1); do
echo $nic; echo $nic;
done done
} }
@ -152,7 +150,7 @@ function get_driver_by_address {
} }
function get_port_bridge { function get_port_bridge {
for pair in $(get_value ovs port_mappings); do for pair in $(get_value ovs port_mappings | tr ',' '\n'); do
nic=`echo $pair | cut -f 1 -d ":"` nic=`echo $pair | cut -f 1 -d ":"`
if [[ "$nic" == "$1" ]]; then if [[ "$nic" == "$1" ]]; then
bridge=`echo $pair | cut -f 2 -d ":"` bridge=`echo $pair | cut -f 2 -d ":"`
@ -209,7 +207,6 @@ function init_ovs_interfaces {
dpdk_port_number=$((dpdk_port_number+1)) dpdk_port_number=$((dpdk_port_number+1))
done done
} }
function init { function init {
@ -381,7 +378,6 @@ function uninstall {
if [ -e "$CONFIG_FILE" ]; then if [ -e "$CONFIG_FILE" ]; then
rm -f "$CONFIG_FILE" rm -f "$CONFIG_FILE"
fi fi
} }
function usage { function usage {