728x90
    • dpdk-lcore-mask : Host OS용 할당된 코어
    • dpdk-socket-mem : dpdk socket 메모리 용량
    • pmd-cpu-mask : PMD용 할당된 코어
    [root@rhosp-dpdk-comp-1 ~]# ovs-vsctl get Open_vSwitch . other_config
    {dpdk-extra="-n 4", dpdk-init="true", dpdk-lcore-mask="3000000003", dpdk-socket-mem="1024,1024", pmd-cpu-mask="c00000000c"}
    • core 값은 hex값으로 변환되어 설정되므로 확인이 어렵다. 아래 파이썬 스크립트를 생성하여 쉽게 변환하여 확인 가능.

    hexmask_converter.py 파일 생성

     # vi hexmask_converter.py

    #!/usr/bin/python
    
    import sys
    
    def hex_to_comma_list(hex_mask):
        binary = bin(int(hex_mask, 16))[2:]
        reversed_binary = binary[::-1]
        i = 0
        output = ""
        for bit in reversed_binary:
            if bit == '1':
                output = output + str(i) + ','
            i = i + 1
        return output[:-1]
    
    def comma_list_to_hex(cpus):
        cpu_arr = cpus.split(",")
        binary_mask = 0
        for cpu in cpu_arr:
            binary_mask = binary_mask | (1 << int(cpu))
        return format(binary_mask, '02x')
    
    if len(sys.argv) != 2:
        print("Please provide a hex CPU mask or comma separated CPU list")
        sys.exit(2)
    
    user_input = sys.argv[1]
    
    try:
      print(hex_to_comma_list(user_input))
    except:
      print(comma_list_to_hex(user_input))

     

    위에서 확인한 mask 값을 참고하여 hexmask_converter.py로 변환

    dpdk-lcore-mask="3000000003"
    pmd-cpu-mask="c00000000c"
    # chmod +x hexmask_converter.py
    
    # ./hexmask_converter.py 3000000003
    0,1,36,37
    
    # ./hexmask_converter.py c00000000c
    2,3,38,39

     

     

    - 10진수 값을 hex로 변환도 가능

    # ./hexmask_converter.py 0,1,36,37
    3000000003
    
    # ./hexmask_converter.py 2,3,38,39
    c00000000c

     

     

     

     

     

    'OpenvSwitch' 카테고리의 다른 글

    OVS Offload Model 설명  (0) 2022.04.07
    • 네이버 블러그 공유하기
    • 네이버 밴드에 공유하기
    • 페이스북 공유하기
    • 카카오스토리 공유하기