aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/mellanox
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2022-05-10 10:57:43 +0200
committerPeter Mikus <pmikus@cisco.com>2022-05-10 10:09:11 +0000
commit9e5fff4c2f51f77f9bb44f09914e428a8e377597 (patch)
treedd7729a761572cb9925837aa547cc1be30982e92 /fdio.infra.ansible/roles/mellanox
parent89b26f0793d19434731e2d97f02939494369c739 (diff)
feat(infra): Mellanox compatibility Matrix
Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: Iec87340aed64dd72e5289bd13af27c177f92c466
Diffstat (limited to 'fdio.infra.ansible/roles/mellanox')
-rw-r--r--fdio.infra.ansible/roles/mellanox/defaults/main.yaml11
-rw-r--r--fdio.infra.ansible/roles/mellanox/tasks/main.yaml57
-rw-r--r--fdio.infra.ansible/roles/mellanox/tasks/ofed.yaml42
3 files changed, 68 insertions, 42 deletions
diff --git a/fdio.infra.ansible/roles/mellanox/defaults/main.yaml b/fdio.infra.ansible/roles/mellanox/defaults/main.yaml
index 0caaae1e1a..a12a613f74 100644
--- a/fdio.infra.ansible/roles/mellanox/defaults/main.yaml
+++ b/fdio.infra.ansible/roles/mellanox/defaults/main.yaml
@@ -18,4 +18,13 @@ packages_by_arch:
x86_64:
- []
-mellanox_version: "5.2-1.0.4.0"
+mellanox_download_url: "http://content.mellanox.com/ofed"
+mellanox_extract_dir: "/opt"
+
+mellanox_cx5_compatibility_matrix:
+ dpdk21.02:
+ # https://doc.dpdk.org/guides/rel_notes/release_21_02.html
+ ofed: "5.3-1.0.5.0"
+ dpdk22.03:
+ # https://doc.dpdk.org/guides/rel_notes/release_22_03.html
+ ofed: "5.5-1.0.3.2"
diff --git a/fdio.infra.ansible/roles/mellanox/tasks/main.yaml b/fdio.infra.ansible/roles/mellanox/tasks/main.yaml
index 3cccdb7727..75964304ca 100644
--- a/fdio.infra.ansible/roles/mellanox/tasks/main.yaml
+++ b/fdio.infra.ansible/roles/mellanox/tasks/main.yaml
@@ -8,60 +8,35 @@
when:
- ansible_distribution|lower == 'ubuntu'
tags:
- - mellanox-inst-prerequisites
+ - mellanox-inst-drivers
- name: Inst - Prerequisites
package:
name: "{{ packages | flatten(levels=1) }}"
state: latest
tags:
- - mellanox-inst-prerequisites
+ - mellanox-inst-drivers
-- name: Inst - Check Presence of Mellanox Hardware
+- name: Inst - Check Presence of Mellanox CX-5
shell: "lspci | grep Mellanox | awk '{print $1}'"
register: mellanox_pcis
failed_when: false
changed_when: false
tags:
- - mellanox-inst
+ - mellanox-inst-drivers
-- name: Inst - Get OFED
- get_url:
- url: "http://content.mellanox.com/ofed/MLNX_OFED-{{ mellanox_version }}/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz"
- dest: "/opt/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz"
- mode: 0644
- when: mellanox_pcis.stdout_lines | length > 0
+- name: Inst - Get Mellanox CX-5 OFED driver versions
+ set_fact:
+ ofed: "{{ mellanox_cx5_compatibility_matrix[mellanox_cx5_matrix]['ofed'] }}"
+ when: >
+ mellanox_pcis is defined
tags:
- - mellanox-inst
+ - mellanox-inst-drivers
-- name: Inst - Extract OFED
- unarchive:
- remote_src: true
- src: "/opt/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz"
- dest: "/opt/"
- creates: "/opt/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}"
- register: mellanox_firmware_extracted
- when: mellanox_pcis.stdout_lines | length > 0
+- name: Inst - Driver Mellanox CX-5
+ import_tasks: ofed.yaml
+ when: >
+ mellanox_pcis.stdout_lines | length > 0 and
+ mellanox_cx5_matrix is defined
tags:
- - mellanox-inst
-
-- name: Inst - OFED
- command: "./mlnxofedinstall --with-mft --dpdk --force --upstream-libs"
- args:
- chdir: "/opt/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}"
- when: mellanox_pcis.stdout_lines | length > 0 and mellanox_firmware_extracted
- tags:
- - mellanox-inst
-
-- name: Switch Infiniband to Ethernet
- command: "mlxconfig --yes --dev {{ item }} set LINK_TYPE_P1=2 LINK_TYPE_P2=2"
- with_items: "{{ mellanox_pcis.stdout_lines }}"
- tags:
- - mellanox-conf
-
-- name: FIX qemu-system removal
- package:
- name: "qemu-system"
- state: latest
- tags:
- - mellanox-inst
+ - mellanox-inst-drivers
diff --git a/fdio.infra.ansible/roles/mellanox/tasks/ofed.yaml b/fdio.infra.ansible/roles/mellanox/tasks/ofed.yaml
new file mode 100644
index 0000000000..ed7d483db9
--- /dev/null
+++ b/fdio.infra.ansible/roles/mellanox/tasks/ofed.yaml
@@ -0,0 +1,42 @@
+---
+# file: roles/intel/tasks/i40e.yaml
+
+- name: Inst - Get OFED
+ get_url:
+ url: "{{ mellanox_download_url }}/MLNX_OFED-{{ ofed }}/MLNX_OFED_LINUX-{{ ofed }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz"
+ dest: "{{ mellanox_extract_dir }}/MLNX_OFED_LINUX-{{ ofed }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz"
+ mode: "0644"
+ when: mellanox_pcis.stdout_lines | length > 0
+ tags:
+ - mellanox-inst-drivers
+
+- name: Inst - Extract OFED
+ unarchive:
+ remote_src: true
+ src: "{{ mellanox_extract_dir }}/MLNX_OFED_LINUX-{{ ofed }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz"
+ dest: "{{ mellanox_extract_dir }}/"
+ creates: "{{ mellanox_extract_dir }}/MLNX_OFED_LINUX-{{ ofed }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}"
+ register: mellanox_firmware_extracted
+ tags:
+ - mellanox-inst-drivers
+
+- name: Inst - OFED
+ command: "./mlnxofedinstall --with-mft --dpdk --force --upstream-libs --without-fw-update"
+ args:
+ chdir: "{{ mellanox_extract_dir }}/MLNX_OFED_LINUX-{{ ofed }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}"
+ when: mellanox_firmware_extracted
+ tags:
+ - mellanox-inst-drivers
+
+- name: Inst - Switch Infiniband to Ethernet
+ command: "mlxconfig --yes --dev {{ item }} set LINK_TYPE_P1=2 LINK_TYPE_P2=2"
+ with_items: "{{ mellanox_pcis.stdout_lines }}"
+ tags:
+ - mellanox-inst-drivers
+
+- name: FIX qemu-system removal
+ package:
+ name: "qemu-system"
+ state: latest
+ tags:
+ - mellanox-inst-drivers
"n">pci_addr); if (!mp->use_random_mac) { clib_memcpy (ap->mac_addr, mp->mac_address, 6); ap->mac_addr_set = 1; } ap->rxq_size = ntohs (mp->rx_ring_sz); ap->txq_size = ntohs (mp->tx_ring_sz); ap->sw_if_index = (u32) ~ 0; ap->features = clib_net_to_host_u64 (mp->features); virtio_pci_create_if (vm, ap); reg = vl_api_client_index_to_registration (mp->client_index); if (!reg) return;; rmp = vl_msg_api_alloc (sizeof (*rmp)); rmp->_vl_msg_id = htons (VL_API_VIRTIO_PCI_CREATE_REPLY); rmp->context = mp->context; rmp->retval = htonl (ap->rv); rmp->sw_if_index = htonl (ap->sw_if_index); vl_api_send_msg (reg, (u8 *) rmp); } static void virtio_pci_send_sw_interface_event_deleted (vpe_api_main_t * am, vl_api_registration_t * reg, u32 sw_if_index) { vl_api_sw_interface_event_t *mp; mp = vl_msg_api_alloc (sizeof (*mp)); clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_EVENT); mp->sw_if_index = htonl (sw_if_index); mp->admin_up_down = 0; mp->link_up_down = 0; mp->deleted = 1; vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_virtio_pci_delete_t_handler (vl_api_virtio_pci_delete_t * mp) { vnet_main_t *vnm = vnet_get_main (); vlib_main_t *vm = vlib_get_main (); virtio_main_t *vim = &virtio_main; int rv = 0; vnet_hw_interface_t *hw; virtio_if_t *vif; vpe_api_main_t *vam = &vpe_api_main; vl_api_virtio_pci_delete_reply_t *rmp; vl_api_registration_t *reg; u32 sw_if_index = ntohl (mp->sw_if_index); hw = vnet_get_sup_hw_interface (vnm, htonl (mp->sw_if_index)); if (hw == NULL || virtio_device_class.index != hw->dev_class_index) { rv = VNET_API_ERROR_INVALID_INTERFACE; goto reply; } vif = pool_elt_at_index (vim->interfaces, hw->dev_instance); rv = virtio_pci_delete_if (vm, vif); reply: reg = vl_api_client_index_to_registration (mp->client_index); if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); rmp->_vl_msg_id = htons (VL_API_VIRTIO_PCI_DELETE_REPLY); rmp->context = mp->context; rmp->retval = htonl (rv); vl_api_send_msg (reg, (u8 *) rmp); if (!rv) { virtio_pci_send_sw_interface_event_deleted (vam, reg, sw_if_index); } } static void virtio_pci_send_sw_interface_details (vpe_api_main_t * am, vl_api_registration_t * reg, virtio_if_t * vif, u32 context) { vl_api_sw_interface_virtio_pci_details_t *mp; mp = vl_msg_api_alloc (sizeof (*mp)); clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_VIRTIO_PCI_DETAILS); mp->pci_addr = htonl (vif->pci_addr.as_u32); mp->sw_if_index = htonl (vif->sw_if_index); mp->rx_ring_sz = htons (vif->rx_ring_sz); mp->tx_ring_sz = htons (vif->tx_ring_sz); clib_memcpy (mp->mac_addr, vif->mac_addr, 6); mp->features = clib_host_to_net_u64 (vif->features); mp->context = context; vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_sw_interface_virtio_pci_dump_t_handler (vl_api_sw_interface_virtio_pci_dump_t * mp) { vpe_api_main_t *am = &vpe_api_main; vl_api_registration_t *reg; virtio_main_t *vmx = &virtio_main; virtio_if_t *vif; reg = vl_api_client_index_to_registration (mp->client_index); if (!reg) return; pool_foreach (vif, vmx->interfaces, ( { if (vif->type == VIRTIO_IF_TYPE_PCI) { virtio_pci_send_sw_interface_details (am, reg, vif, mp->context);} } )); } #define vl_msg_name_crc_list #include <vnet/vnet_all_api_h.h> #undef vl_msg_name_crc_list static void setup_message_id_table (api_main_t * am) { #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); foreach_vl_msg_name_crc_virtio; #undef _ } static clib_error_t * virtio_pci_api_hookup (vlib_main_t * vm) { api_main_t *am = &api_main; #define _(N,n) \ vl_msg_api_set_handlers(VL_API_##N, #n, \ vl_api_##n##_t_handler, \ vl_noop_handler, \ vl_api_##n##_t_endian, \ vl_api_##n##_t_print, \ sizeof(vl_api_##n##_t), 1); foreach_virtio_pci_api_msg; #undef _ /* * Set up the (msg_name, crc, message-id) table */ setup_message_id_table (am); return 0; } VLIB_API_INIT_FUNCTION (virtio_pci_api_hookup); /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */