Browse Source

Get number of maximum queues for NIC

It's needed for configure multiq for dpdk

Change-Id: Iffa1a6c872b46230de6e9ab3b8f34cb727661571
Partial-Bug: #1643920
Mikhail 2 years ago
parent
commit
8ed8caf30a
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      agent

+ 22
- 0
agent View File

@@ -581,6 +581,26 @@ class NodeAgent
581 581
     end
582 582
   end
583 583
 
584
+  def _get_max_queues(ifname)
585
+    data = `ethtool -l #{ifname}`
586
+    # Example of output to parse:
587
+    # Channel parameters for ens4f0:
588
+    #  Pre-set maximums:
589
+    #  RX:		0
590
+    #  TX:		0
591
+    #  Other:		1
592
+    #  Combined:	63
593
+    # Current hardware settings:
594
+    #  RX:		0
595
+    #  TX:		0
596
+    #  Other:		1
597
+    #  Combined:	40
598
+    return nil if $?.to_i != 0
599
+    return data.scan(/Pre-set maximums:.*?Combined:\s*(\d+)/m).join.to_i
600
+  rescue
601
+    return nil
602
+  end
603
+
584 604
   def _detailed
585 605
     detailed_meta = {
586 606
       :system => _system_info,
@@ -684,6 +704,8 @@ class NodeAgent
684 704
         int_meta[:interface_properties][:pci_id] = nic_pci_id(int)
685 705
         # Get numa node
686 706
         int_meta[:interface_properties][:numa_node] = nic_numa_node(int_meta[:bus_info])
707
+        # Get maximum queues
708
+        int_meta[:interface_properties][:max_queues] = _get_max_queues(int)
687 709
         detailed_meta[:interfaces] << int_meta
688 710
       end
689 711
     rescue Exception => e

Loading…
Cancel
Save