2 ## Copyright (c) 2020 Intel Corporation.
4 ## Licensed under the Apache License, Version 2.0 (the "License");
5 ## you may not use this file except in compliance with the License.
6 ## You may obtain a copy of the License at
8 ## http://www.apache.org/licenses/LICENSE-2.0
10 ## Unless required by applicable law or agreed to in writing, software
11 ## distributed under the License is distributed on an "AS IS" BASIS,
12 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ## See the License for the specific language governing permissions and
14 ## limitations under the License.
17 # check if the selected driver module is available on host
18 - name: Check that selected driver module is available
19 # if modinfo fails, lookup loaded modules as modinfo might return error
20 # for igb_uio and potentially other modules not included with the kernel
21 shell: "modinfo {{ vf_driver }} || grep {{ vf_driver }} /proc/modules || grep {{ vf_driver }} /lib/modules/$(uname -r)/modules.builtin"
22 register: shell_result
27 # get a list of VFs PCI addresses and save the configuration
28 - name: attach VFs driver
30 - name: fetch VFs pci addresses for a PF
31 shell: "for vf in /sys/class/net/{{ pfname }}/device/virtfn*;do basename $(readlink -f $vf);done"
37 - name: save VF driver binding
39 path: "{{ sriov_config_path }}/bmra_interfaces"
40 line: "{{ this_item }} {{ vf_driver }}"
41 regexp: "^{{ this_item }}"
46 loop: "{{ vf_pciids.stdout_lines }}"
50 - vf_pciids.stderr|length == 0
51 - vf_pciids.stdout_lines|length > 0
52 when: shell_result.rc == 0