Add interface name parameter for DPDK configs
Implemented parameter 'iface' in the nics dictionaries which allows users to reference the interfaces by name instead of only 'pci_id' in the values.yaml. This can ease the configuration of interfaces that may have differing PCI addresses among the servers. 'pci_id' will take precedence if both are configured. Change-Id: I93248bb580460c48fff01130d80e2bfe31dadf72
This commit is contained in:
parent
b5876e3274
commit
6c7dee608c
@ -196,6 +196,12 @@ function process_dpdk_nics {
|
||||
while IFS= read -r nic; do
|
||||
local port_name=$(get_dpdk_config_value ${nic} '.name')
|
||||
local pci_id=$(get_dpdk_config_value ${nic} '.pci_id')
|
||||
local iface=$(get_dpdk_config_value ${nic} '.iface')
|
||||
if [ -n ${iface} ] && [ -z ${pci_id} ]; then
|
||||
local pci_id=$(get_address_by_nicname ${iface})
|
||||
else
|
||||
iface=$(get_name_by_pci_id "${pci_id}")
|
||||
fi
|
||||
local bridge=$(get_dpdk_config_value ${nic} '.bridge')
|
||||
local vf_index=$(get_dpdk_config_value ${nic} '.vf_index')
|
||||
|
||||
@ -203,8 +209,6 @@ function process_dpdk_nics {
|
||||
migrate_ip "${pci_id}" "${bridge}"
|
||||
fi
|
||||
|
||||
iface=$(get_name_by_pci_id "${pci_id}")
|
||||
|
||||
if [ -n "${iface}" ]; then
|
||||
ip link set ${iface} promisc on
|
||||
if [ -n "${vf_index}" ]; then
|
||||
@ -292,6 +296,12 @@ function process_dpdk_bonds {
|
||||
echo $bond | jq -r -c '.nics[]' > /tmp/nics_array
|
||||
while IFS= read -r nic; do
|
||||
local pci_id=$(get_dpdk_config_value ${nic} '.pci_id')
|
||||
local iface=$(get_dpdk_config_value ${nic} '.iface')
|
||||
if [ -n ${iface} ] && [ -z ${pci_id} ]; then
|
||||
local pci_id=$(get_address_by_nicname ${iface})
|
||||
else
|
||||
iface=$(get_name_by_pci_id "${pci_id}")
|
||||
fi
|
||||
local nic_name=$(get_dpdk_config_value ${nic} '.name')
|
||||
local pmd_rxq_affinity=$(get_dpdk_config_value ${nic} '.pmd_rxq_affinity')
|
||||
local vf_index=$(get_dpdk_config_value ${nic} '.vf_index')
|
||||
@ -302,8 +312,6 @@ function process_dpdk_bonds {
|
||||
ip_migrated=true
|
||||
fi
|
||||
|
||||
iface=$(get_name_by_pci_id "${pci_id}")
|
||||
|
||||
if [ -n "${iface}" ]; then
|
||||
ip link set ${iface} promisc on
|
||||
if [ -n "${vf_index}" ]; then
|
||||
@ -407,6 +415,19 @@ function get_driver_by_address {
|
||||
fi
|
||||
}
|
||||
|
||||
function get_address_by_nicname {
|
||||
if [[ -e /sys/class/net/$1 ]]; then
|
||||
local pci_address=$(readlink -f /sys/class/net/$1/device | xargs basename)
|
||||
if [[ -e /sys/bus/pci/devices/${pci_address} ]]; then
|
||||
echo ${pci_address}
|
||||
else
|
||||
echo "PCI id for interface $1 cannot be found" >&2
|
||||
fi
|
||||
else
|
||||
echo "Interface name $1 cannot be found" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
function init_ovs_dpdk_bridge {
|
||||
bridge=$1
|
||||
ovs-vsctl --db=unix:${OVS_SOCKET} --may-exist add-br ${bridge} \
|
||||
|
@ -2223,6 +2223,9 @@ conf:
|
||||
# must NOT be provided here.
|
||||
nics:
|
||||
- name: dpdk0
|
||||
# Optionally, instead of using pci_id you can use the name of
|
||||
# the interface. If both are used, pci_id has presedence.
|
||||
# iface: eth0
|
||||
pci_id: '0000:05:00.0'
|
||||
# Set VF Index in case some particular VF(s) need to be
|
||||
# used with ovs-dpdk.
|
||||
@ -2265,6 +2268,9 @@ conf:
|
||||
# ovs_options: "bond_mode=active-backup"
|
||||
# nics:
|
||||
# - name: dpdk_b0s0
|
||||
# # Optionally, instead of using pci_id you can use the name of
|
||||
# # the interface. If both are used, pci_id has presedence.
|
||||
# # iface: eth0
|
||||
# pci_id: '0000:06:00.0'
|
||||
# pmd_rxq_affinity: "0:3,1:27"
|
||||
# # Set VF Index in case some particular VF(s) need to be
|
||||
|
11
releasenotes/notes/neutron-b2247f89a5f258aa.yaml
Normal file
11
releasenotes/notes/neutron-b2247f89a5f258aa.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
# To create a new release note related to a specific chart:
|
||||
# reno new <chart_name>
|
||||
#
|
||||
# To create a new release note for a common change (when multiple charts
|
||||
# are changed):
|
||||
# reno new common
|
||||
neutron:
|
||||
- |
|
||||
Add interface name parameter for DPDK configs
|
||||
...
|
Loading…
x
Reference in New Issue
Block a user