Raphael Vicente Rosa | 32c5322 | 2022-01-28 15:54:37 +0100 | [diff] [blame^] | 1 | --- |
| 2 | # qat tasks/qat.yml |
| 3 | # |
| 4 | # SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org> |
| 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | - name: Blacklist kernel QAT drivers |
| 8 | blockinfile: |
| 9 | create: true |
| 10 | dest: /etc/modprobe.d/blacklist-intel_qat.conf |
| 11 | mode: 0644 |
| 12 | block: | |
| 13 | # Blacklist kernel QAT drivers |
| 14 | blacklist qat_c62x |
| 15 | blacklist qat_c62xvf |
| 16 | blacklist qat_c6xx |
| 17 | blacklist qat_c6xxvf |
| 18 | blacklist qat_c3xxx |
| 19 | blacklist qat_c3xxxvf |
| 20 | blacklist qat_d15xx |
| 21 | blacklist qat_d15xxvf |
| 22 | blacklist qat_c4xxx |
| 23 | blacklist qat_c4xxxvf |
| 24 | blacklist intel_qat |
| 25 | backup: true |
| 26 | notify: reboot qat |
| 27 | |
| 28 | - name: Flush handlers |
| 29 | meta: flush_handlers |
| 30 | |
| 31 | - name: Install QAT driver compile requirements |
| 32 | apt: |
| 33 | name: |
| 34 | - "libboost-all-dev" |
| 35 | - "pciutils-dev" |
| 36 | - "libssl-dev" |
| 37 | - "build-essential" |
| 38 | - "pkg-config" |
| 39 | - "yasm" |
| 40 | state: "present" |
| 41 | update_cache: true |
| 42 | |
| 43 | - name: Create root folder for QAT driver |
| 44 | file: |
| 45 | path: "{{ sriov_qat_driver_dir }}" |
| 46 | state: directory |
| 47 | owner: root |
| 48 | group: root |
| 49 | mode: "0644" |
| 50 | |
| 51 | - name: Download QAT driver .tgz file |
| 52 | get_url: |
| 53 | url: "{{ sriov_qat_latest_url }}" |
| 54 | dest: "{{ sriov_qat_driver_dir }}/{{ sriov_qat_latest_name }}" |
| 55 | owner: "root" |
| 56 | group: "root" |
| 57 | mode: "0644" |
| 58 | checksum: "{{ sriov_qat_checksum }}" |
| 59 | |
| 60 | - name: Unarchive QAT driver .tgz file |
| 61 | when: not sriov_qat_dkms_enabled |
| 62 | unarchive: |
| 63 | remote_src: true |
| 64 | list_files: true |
| 65 | src: "{{ sriov_qat_driver_dir }}/{{ sriov_qat_latest_name }}" |
| 66 | dest: "{{ sriov_qat_driver_dir }}" |
| 67 | owner: "root" |
| 68 | group: "root" |
| 69 | creates: "{{ sriov_qat_driver_dir }}/configure" |
| 70 | |
| 71 | - name: Configure QAT driver with SR-IOV host |
| 72 | when: not sriov_qat_dkms_enabled |
| 73 | command: |
| 74 | cmd: "./configure --enable-icp-sriov=host" |
| 75 | chdir: "{{ sriov_qat_driver_dir }}" |
| 76 | creates: "{{ sriov_qat_driver_dir }}/config.status" |
| 77 | |
| 78 | - name: Run the default target as root |
| 79 | when: not sriov_qat_dkms_enabled |
| 80 | command: |
| 81 | cmd: make |
| 82 | chdir: "{{ sriov_qat_driver_dir }}" |
| 83 | creates: "{{ sriov_qat_driver_dir }}/build/intel_qat.ko" |
| 84 | |
| 85 | - name: Run 'install' target as root |
| 86 | when: not sriov_qat_dkms_enabled |
| 87 | command: |
| 88 | chdir: "{{ sriov_qat_driver_dir }}" |
| 89 | cmd: "make install" |
| 90 | creates: "/usr/local/bin/adf_ctl" |
| 91 | |
| 92 | # - name: Run 'install-samples' target as root |
| 93 | # # command: |
| 94 | # chdir: "{{ sriov_qat_driver_dir }}" |
| 95 | # cmd: "make install-samples" |
| 96 | # creates: "{{ sriov_qat_driver_dir }}/build/cpa_sample_code" |
| 97 | # become: yes |
| 98 | |
| 99 | - name: Create sriov_qat system servqat |
| 100 | template: |
| 101 | src: "{{ item.src }}" |
| 102 | dest: "{{ item.dest }}" |
| 103 | mode: "{{ item.mode }}" |
| 104 | owner: root |
| 105 | group: root |
| 106 | loop: |
| 107 | - { |
| 108 | src: "sriov_qat.sh.j2", |
| 109 | dest: "/usr/local/bin/sriov_qat.sh", |
| 110 | mode: "a+x", |
| 111 | } |
| 112 | - { |
| 113 | src: "sriov_qat.service.j2", |
| 114 | dest: "/etc/systemd/system/sriov_qat.service", |
| 115 | mode: 644, |
| 116 | } |
| 117 | notify: enable sriov_qat.service |