Rate This Document
Findability
Accuracy
Completeness
Readability

Obtaining the KAE Queue Usage Information

Question

How do I obtain the KAE queue usage information?

Answer

  1. Create the get_kae_queue_info.sh script file.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    #!/bin/bash
    
    if [ -f "/etc/modprobe.d/hisi_sec2.conf" ]; then
        hisi_sec2_queue_str=$(cat /etc/modprobe.d/hisi_sec2.conf | awk '/pf_q_num=/')
        hisi_sec2_queue=${hisi_sec2_queue_str##*=}
        hisi_sec2_queue_total=${hisi_sec2_queue%% *}
    else
         hisi_sec2_queue_total="NULL"
    fi
    
    ls /sys/class/uacce | grep "hisi_sec2-*" 
    if [ "$?" == "0" ]; then
        hisi_sec2_queue_space=$(cat /sys/class/uacce/hisi_sec2-*/attrs/available_instances | awk '{printf "%s ",$1}')
    else
        hisi_sec2_queue_space="NULL NULL"
        echo -e "\e[1;31mno hisi_sec2 acclerator device \e[0m"
    fi
    
    
    if [ -f "/etc/modprobe.d/hisi_hpre.conf" ]; then
        hisi_hpre_queue_str=$(cat /etc/modprobe.d/hisi_hpre.conf | awk '/pf_q_num=/')
        hisi_hpre_queue=${hisi_hpre_queue_str##*=}
        hisi_hpre_queue_total=${hisi_hpre_queue%% *}
    else
        hisi_hpre_queue_total="NULL"
    fi
    
    ls /sys/class/uacce | grep "hisi_hpre-*" 
    if [ "$?" == "0" ]; then
        hisi_hpre_queue_space=$(cat /sys/class/uacce/hisi_hpre-*/attrs/available_instances | awk '{printf "%s ",$1}')
    else
        hisi_hpre_queue_space="NULL NULL"
        echo -e "\e[1;31mno hisi_hpre accelrator device \e[0m"
    fi
    
    
    if [ -f "/etc/modprobe.d/hisi_zip.conf" ];then
        hisi_zip_queue_str=$(cat /etc/modprobe.d/hisi_zip.conf | awk '/pf_q_num=/')
        hisi_zip_queue=${hisi_zip_queue_str##*=}
        hisi_zip_queue_total=${hisi_zip_queue%% *}
    else
        hisi_zip_queue_total="NULL"
    fi
    
    ls /sys/class/uacce | grep "hisi_zip-*"
    if [ "$?" == "0" ]; then
        hisi_zip_queue_space=$(cat /sys/class/uacce/hisi_zip-*/attrs/available_instances | awk '{printf "%s ",$1}')
    else
        hisi_zip_queue_space="NULL NULL"
        echo -e "\e[1;31mno hisi_zip accelerator device\e[0m"
    fi
    
    
    echo $hisi_sec_queue_total
    echo -e "\e[1;33m get kae queue info \e[0m"
    echo -e "================================================================="
    echo -e "\e[1;33m engines          supported alg         total         left \e[0m"
    echo -e "-----------------------------------------------------------------"
    echo  "hisi_sec2        AES/MD5/SM3/SM4       $hisi_sec2_queue_total $hisi_sec2_queue_total      $hisi_sec2_queue_space "
    echo  "hisi_hpre        RSA/DH                $hisi_hpre_queue_total $hisi_hpre_queue_total      $hisi_hpre_queue_space "
    echo  "hisi_zip         zlib/gzip             $hisi_zip_queue_total $hisi_zip_queue_total      $hisi_zip_queue_space "
    
  2. Execute this script file.
    1
    bash  get_kae_queue_info.sh
    

    The following information is displayed:

    Engine file, engine queue name, algorithms supported by the engine, total number of queues, and number of remaining queues

    • If the KAE is properly installed and the license is obtained, the information shown in Figure 1 is displayed.
      Figure 1 Command output when the KAE and license are properly installed
    • If the KAE is properly installed but the license is not installed, the information shown in Figure 2 is displayed.
      Figure 2 Command output when the KAE is installed but the license is not installed
    • If the KAE is not installed, the result shown in Figure 3 is displayed.
      Figure 3 Command output when the KAE is not installed
    • If the KAE queues are being used, the information shown in Figure 4 is displayed.
      Figure 4 Command output when KAE queues are being used
    • You can run the following command to obtain the queue information in real time. Figure 5 shows the command output.
      1
      watch –n 1 bash get_kae_queue_info.sh  
      
      This command indicates that information is displayed every second.
      Figure 5 Result of obtaining real-time queue information