zoukankan      html  css  js  c++  java
  • dpdk helloword

    [root@localhost helloworld]# cat main.c 
    /* SPDX-License-Identifier: BSD-3-Clause
     * Copyright(c) 2010-2014 Intel Corporation
     */
    
    #include <stdio.h>
    #include <string.h>
    #include <stdint.h>
    #include <errno.h>
    #include <sys/queue.h>
    
    #include <rte_memory.h>
    #include <rte_launch.h>
    #include <rte_eal.h>
    #include <rte_per_lcore.h>
    #include <rte_lcore.h>
    #include <rte_debug.h>
    #include <unistd.h>
    static int
    lcore_hello(__attribute__((unused)) void *arg)
    {
            unsigned lcore_id,  socket_id;
            lcore_id = rte_lcore_id();
            socket_id = rte_socket_id();
            printf("hello from core %u
    ", lcore_id);
            printf("socket id  %u
    ", socket_id);
            sleep(60); 
            return 0;
    }
    
    int
    main(int argc, char **argv)
    {
            int ret;
            unsigned lcore_id;
    
            ret = rte_eal_init(argc, argv);
            if (ret < 0)
                    rte_panic("Cannot init EAL
    ");
    
            /* call lcore_hello() on every slave lcore */
            RTE_LCORE_FOREACH_SLAVE(lcore_id) { 
                    rte_eal_remote_launch(lcore_hello, NULL, lcore_id);
            }
    
            /* call it on master lcore too */
            lcore_hello(NULL);
    
            rte_eal_mp_wait_lcore();
            return 0;
    }
    [root@localhost helloworld]# ./build/app/helloworld 
    EAL: Detected 128 lcore(s)
    EAL: Detected 4 NUMA nodes
    EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
    EAL: Selected IOVA mode 'PA'
    EAL: Probing VFIO support...
    EAL: VFIO support initialized
    EAL: PCI device 0000:05:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:200 net_hinic
    net_hinic: Initializing pf hinic-0000:05:00.0 in primary process
    net_hinic: Device 0000:05:00.0 hwif attribute:
    net_hinic: func_idx:0, p2p_idx:0, pciintf_idx:0, vf_in_pf:0, ppf_idx:0, global_vf_id:15, func_type:2
    net_hinic: num_aeqs:4, num_ceqs:4, num_irqs:32, dma_attr:2
    net_hinic: API CMD poll status timeout
    net_hinic: chain type: 0x7
    net_hinic: chain hw cpld error: 0x1
    net_hinic: chain hw check error: 0x0
    net_hinic: chain hw current fsm: 0x0
    net_hinic: chain hw current ci: 0x0
    net_hinic: Chain hw current pi: 0x1
    net_hinic: Send msg to mgmt failed
    net_hinic: Failed to get board info, err: -110, status: 0x0, out size: 0x0
    net_hinic: Check card workmode failed, dev_name: 0000:05:00.0
    net_hinic: Create nic device failed, dev_name: 0000:05:00.0
    net_hinic: Initialize 0000:05:00.0 in primary failed
    EAL: Requested device 0000:05:00.0 cannot be used
    EAL: PCI device 0000:06:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:200 net_hinic
    EAL: PCI device 0000:7d:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:a222 net_hns3
    EAL: PCI device 0000:7d:00.1 on NUMA socket 0
    EAL:   probe driver: 19e5:a221 net_hns3
    EAL: PCI device 0000:7d:00.2 on NUMA socket 0
    EAL:   probe driver: 19e5:a222 net_hns3
    EAL: PCI device 0000:7d:00.3 on NUMA socket 0
    EAL:   probe driver: 19e5:a221 net_hns3
    hello from core 1
    socket id  0
    hello from core 2
    socket id  0
    hello from core 3
    hello from core 4
    hello from core 6
    socket id  0
    hello from core 7
    hello from core 8
    socket id  0
    hello from core 11
    hello from core 12
    socket id  0
    socket id  0
    hello from core 14
    socket id  0
    hello from core 15
    socket id  0
    hello from core 16
    socket id  0
    hello from core 5
    hello from core 18
    socket id  0
    hello from core 19
    socket id  0
    hello from core 20
    socket id  0
    hello from core 17
    socket id  0
    hello from core 9
    hello from core 23
    socket id  0
    hello from core 24
    socket id  0
    socket id  0
    hello from core 21
    socket id  0
    socket id  0
    hello from core 28
    socket id  0
    hello from core 29
    socket id  0
    hello from core 13
    hello from core 31
    socket id  0
    hello from core 27
    socket id  0
    socket id  0
    hello from core 10
    socket id  0
    hello from core 32
    hello from core 33
    socket id  1
    hello from core 25
    socket id  0
    hello from core 22
    socket id  0
    socket id  0
    hello from core 36
    hello from core 37
    socket id  1
    hello from core 34
    hello from core 39
    socket id  1
    hello from core 35
    socket id  1
    socket id  1
    hello from core 43
    socket id  1
    hello from core 47
    socket id  1
    hello from core 26
    hello from core 49
    hello from core 50
    socket id  1
    socket id  1
    hello from core 42
    socket id  1
    hello from core 44
    socket id  1
    hello from core 46
    socket id  1
    hello from core 38
    socket id  1
    socket id  1
    socket id  0
    hello from core 40
    socket id  1
    hello from core 41
    socket id  1
    hello from core 51
    socket id  1
    hello from core 30
    socket id  0
    hello from core 53
    socket id  1
    hello from core 57
    socket id  1
    socket id  0
    hello from core 56
    socket id  1
    socket id  1
    socket id  0
    hello from core 52
    socket id  1
    hello from core 59
    socket id  1
    hello from core 48
    socket id  1
    hello from core 45
    socket id  1
    hello from core 55
    socket id  1
    hello from core 54
    socket id  1
    hello from core 58
    socket id  1
    hello from core 60
    socket id  1
    hello from core 61
    socket id  1
    hello from core 62
    socket id  1
    hello from core 63
    socket id  1
    hello from core 64
    socket id  2
    hello from core 65
    hello from core 66
    socket id  2
    socket id  2
    hello from core 68
    socket id  2
    hello from core 69
    socket id  2
    hello from core 71
    socket id  2
    hello from core 70
    hello from core 73
    socket id  2
    socket id  2
    hello from core 75
    socket id  2
    hello from core 74
    hello from core 77
    socket id  2
    hello from core 78
    hello from core 79
    socket id  2
    hello from core 72
    hello from core 81
    socket id  2
    hello from core 86
    socket id  2
    hello from core 80
    socket id  2
    hello from core 89
    socket id  2
    hello from core 83
    socket id  2
    hello from core 92
    socket id  2
    socket id  2
    hello from core 94
    socket id  2
    hello from core 95
    socket id  2
    hello from core 76
    socket id  2
    hello from core 82
    socket id  2
    hello from core 84
    socket id  2
    socket id  2
    hello from core 93
    socket id  2
    hello from core 87
    socket id  2
    socket id  2
    hello from core 90
    socket id  2
    hello from core 85
    socket id  2
    hello from core 88
    hello from core 91
    socket id  2
    hello from core 67
    socket id  2
    socket id  2
    hello from core 96
    socket id  3
    hello from core 97
    socket id  3
    hello from core 98
    hello from core 100
    socket id  3
    hello from core 99
    socket id  3
    hello from core 101
    hello from core 107
    hello from core 108
    socket id  3
    hello from core 105
    socket id  3
    socket id  3
    hello from core 115
    socket id  3
    hello from core 116
    socket id  3
    hello from core 109
    socket id  3
    hello from core 110
    hello from core 120
    socket id  3
    hello from core 112
    hello from core 122
    socket id  3
    socket id  3
    hello from core 102
    socket id  3
    hello from core 125
    socket id  3
    hello from core 126
    socket id  3
    hello from core 119
    socket id  3
    hello from core 106
    socket id  3
    hello from core 127
    socket id  3
    hello from core 113
    socket id  3
    hello from core 123
    socket id  3
    socket id  3
    hello from core 117
    socket id  3
    hello from core 118
    socket id  3
    socket id  3
    hello from core 111
    socket id  3
    hello from core 121
    socket id  3
    hello from core 114
    socket id  3
    hello from core 103
    socket id  3
    hello from core 0
    socket id  0
    socket id  3
    hello from core 124
    socket id  3
    hello from core 104
    socket id  3
    [root@localhost dpdk-ring-ping]# ps -mo pid,tid,%cpu,psr -p  125616
       PID    TID %CPU PSR
    125616      - 63.4   -
         - 125616 59.1   0
         - 125617  0.0   0
         - 125618  0.0   0
    --------------------------- 0号cpu跑了三个线程
    - 125619 0.0 1 - 125620 0.0 2 - 125621 0.0 3 - 125622 0.0 4 - 125623 0.0 5 - 125624 0.0 6 - 125625 0.0 7 - 125626 0.0 8 - 125627 0.0 9 - 125628 0.0 10 - 125629 0.0 11 - 125630 0.0 12 - 125631 0.0 13 - 125632 0.0 14 - 125633 0.0 15 - 125634 0.0 16 - 125635 0.0 17 - 125636 0.0 18 - 125637 0.0 19 - 125638 0.0 20 - 125639 0.0 21 - 125640 0.0 22 - 125641 0.0 23 - 125642 0.0 24 - 125643 0.0 25 - 125644 0.0 26 - 125645 0.0 27 - 125646 0.0 28 - 125647 0.0 29 - 125648 0.0 30 - 125649 0.0 31 - 125650 0.0 32 - 125651 0.0 33 - 125652 0.0 34 - 125653 0.0 35 - 125654 0.0 36 - 125655 0.0 37 - 125656 0.0 38 - 125657 0.0 39 - 125658 0.0 40 - 125659 0.0 41 - 125660 0.0 42 - 125661 0.0 43 - 125662 0.0 44 - 125663 0.0 45 - 125664 0.0 46 - 125665 0.0 47 - 125666 0.0 48 - 125667 0.0 49 - 125668 0.0 50 - 125669 0.0 51 - 125670 0.0 52 - 125671 0.0 53 - 125672 0.0 54 - 125673 0.0 55 - 125674 0.0 56 - 125675 0.0 57 - 125676 0.0 58 - 125677 0.0 59 - 125678 0.0 60 - 125679 0.0 61 - 125680 0.0 62 - 125681 0.0 63 - 125682 0.0 64 - 125683 0.0 65 - 125684 0.0 66 - 125685 0.0 67 - 125686 0.0 68 - 125687 0.0 69 - 125688 0.0 70 - 125689 0.0 71 - 125690 0.0 72 - 125691 0.0 73 - 125692 0.0 74 - 125693 0.0 75 - 125694 0.0 76 - 125695 0.0 77 - 125696 0.0 78 - 125697 0.0 79 - 125698 0.0 80 - 125699 0.0 81 - 125700 0.0 82 - 125701 0.0 83 - 125702 0.0 84 - 125703 0.0 85 - 125704 0.0 86 - 125705 0.0 87 - 125706 0.0 88 - 125707 0.0 89 - 125708 0.0 90 - 125709 0.0 91 - 125710 0.0 92 - 125711 0.0 93 - 125712 0.0 94 - 125713 0.0 95 - 125714 0.0 96 - 125715 0.0 97 - 125716 0.0 98 - 125717 0.0 99 - 125718 0.0 100 - 125719 0.0 101 - 125720 0.0 102 - 125721 0.0 103 - 125722 0.0 104 - 125723 0.0 105 - 125724 0.0 106 - 125725 0.0 107 - 125726 0.0 108 - 125727 0.0 109 - 125728 0.0 110 - 125729 0.0 111 - 125730 0.0 112 - 125731 0.0 113 - 125732 0.0 114 - 125733 0.0 115 - 125734 0.0 116 - 125735 0.0 117 - 125736 0.0 118 - 125737 0.0 119 - 125738 0.0 120 - 125739 0.0 121 - 125740 0.0 122 - 125741 0.0 123 - 125742 0.0 124 - 125743 0.0 125 - 125744 0.0 126 - 125745 0.0 127 [root@localhost dpdk-ring-ping]# ps -T -p 125616 PID SPID TTY TIME CMD 125616 125616 pts/1 00:00:10 helloworld 125616 125617 pts/1 00:00:00 eal-intr-thread 125616 125618 pts/1 00:00:00 rte_mp_handle 125616 125619 pts/1 00:00:00 lcore-slave-1 125616 125620 pts/1 00:00:00 lcore-slave-2 125616 125621 pts/1 00:00:00 lcore-slave-3 125616 125622 pts/1 00:00:00 lcore-slave-4 125616 125623 pts/1 00:00:00 lcore-slave-5 125616 125624 pts/1 00:00:00 lcore-slave-6 125616 125625 pts/1 00:00:00 lcore-slave-7 125616 125626 pts/1 00:00:00 lcore-slave-8 125616 125627 pts/1 00:00:00 lcore-slave-9 125616 125628 pts/1 00:00:00 lcore-slave-10 125616 125629 pts/1 00:00:00 lcore-slave-11 125616 125630 pts/1 00:00:00 lcore-slave-12 125616 125631 pts/1 00:00:00 lcore-slave-13 125616 125632 pts/1 00:00:00 lcore-slave-14 125616 125633 pts/1 00:00:00 lcore-slave-15 125616 125634 pts/1 00:00:00 lcore-slave-16 125616 125635 pts/1 00:00:00 lcore-slave-17 125616 125636 pts/1 00:00:00 lcore-slave-18 125616 125637 pts/1 00:00:00 lcore-slave-19 125616 125638 pts/1 00:00:00 lcore-slave-20 125616 125639 pts/1 00:00:00 lcore-slave-21 125616 125640 pts/1 00:00:00 lcore-slave-22 125616 125641 pts/1 00:00:00 lcore-slave-23 125616 125642 pts/1 00:00:00 lcore-slave-24 125616 125643 pts/1 00:00:00 lcore-slave-25 125616 125644 pts/1 00:00:00 lcore-slave-26 125616 125645 pts/1 00:00:00 lcore-slave-27 125616 125646 pts/1 00:00:00 lcore-slave-28 125616 125647 pts/1 00:00:00 lcore-slave-29 125616 125648 pts/1 00:00:00 lcore-slave-30 125616 125649 pts/1 00:00:00 lcore-slave-31 125616 125650 pts/1 00:00:00 lcore-slave-32 125616 125651 pts/1 00:00:00 lcore-slave-33 125616 125652 pts/1 00:00:00 lcore-slave-34 125616 125653 pts/1 00:00:00 lcore-slave-35 125616 125654 pts/1 00:00:00 lcore-slave-36 125616 125655 pts/1 00:00:00 lcore-slave-37 125616 125656 pts/1 00:00:00 lcore-slave-38 125616 125657 pts/1 00:00:00 lcore-slave-39 125616 125658 pts/1 00:00:00 lcore-slave-40 125616 125659 pts/1 00:00:00 lcore-slave-41 125616 125660 pts/1 00:00:00 lcore-slave-42 125616 125661 pts/1 00:00:00 lcore-slave-43 125616 125662 pts/1 00:00:00 lcore-slave-44 125616 125663 pts/1 00:00:00 lcore-slave-45 125616 125664 pts/1 00:00:00 lcore-slave-46 125616 125665 pts/1 00:00:00 lcore-slave-47 125616 125666 pts/1 00:00:00 lcore-slave-48 125616 125667 pts/1 00:00:00 lcore-slave-49 125616 125668 pts/1 00:00:00 lcore-slave-50 125616 125669 pts/1 00:00:00 lcore-slave-51 125616 125670 pts/1 00:00:00 lcore-slave-52 125616 125671 pts/1 00:00:00 lcore-slave-53 125616 125672 pts/1 00:00:00 lcore-slave-54 125616 125673 pts/1 00:00:00 lcore-slave-55 125616 125674 pts/1 00:00:00 lcore-slave-56 125616 125675 pts/1 00:00:00 lcore-slave-57 125616 125676 pts/1 00:00:00 lcore-slave-58 125616 125677 pts/1 00:00:00 lcore-slave-59 125616 125678 pts/1 00:00:00 lcore-slave-60 125616 125679 pts/1 00:00:00 lcore-slave-61 125616 125680 pts/1 00:00:00 lcore-slave-62 125616 125681 pts/1 00:00:00 lcore-slave-63 125616 125682 pts/1 00:00:00 lcore-slave-64 125616 125683 pts/1 00:00:00 lcore-slave-65 125616 125684 pts/1 00:00:00 lcore-slave-66 125616 125685 pts/1 00:00:00 lcore-slave-67 125616 125686 pts/1 00:00:00 lcore-slave-68 125616 125687 pts/1 00:00:00 lcore-slave-69 125616 125688 pts/1 00:00:00 lcore-slave-70 125616 125689 pts/1 00:00:00 lcore-slave-71 125616 125690 pts/1 00:00:00 lcore-slave-72 125616 125691 pts/1 00:00:00 lcore-slave-73 125616 125692 pts/1 00:00:00 lcore-slave-74 125616 125693 pts/1 00:00:00 lcore-slave-75 125616 125694 pts/1 00:00:00 lcore-slave-76 125616 125695 pts/1 00:00:00 lcore-slave-77 125616 125696 pts/1 00:00:00 lcore-slave-78 125616 125697 pts/1 00:00:00 lcore-slave-79 125616 125698 pts/1 00:00:00 lcore-slave-80 125616 125699 pts/1 00:00:00 lcore-slave-81 125616 125700 pts/1 00:00:00 lcore-slave-82 125616 125701 pts/1 00:00:00 lcore-slave-83 125616 125702 pts/1 00:00:00 lcore-slave-84 125616 125703 pts/1 00:00:00 lcore-slave-85 125616 125704 pts/1 00:00:00 lcore-slave-86 125616 125705 pts/1 00:00:00 lcore-slave-87 125616 125706 pts/1 00:00:00 lcore-slave-88 125616 125707 pts/1 00:00:00 lcore-slave-89 125616 125708 pts/1 00:00:00 lcore-slave-90 125616 125709 pts/1 00:00:00 lcore-slave-91 125616 125710 pts/1 00:00:00 lcore-slave-92 125616 125711 pts/1 00:00:00 lcore-slave-93 125616 125712 pts/1 00:00:00 lcore-slave-94 125616 125713 pts/1 00:00:00 lcore-slave-95 125616 125714 pts/1 00:00:00 lcore-slave-96 125616 125715 pts/1 00:00:00 lcore-slave-97 125616 125716 pts/1 00:00:00 lcore-slave-98 125616 125717 pts/1 00:00:00 lcore-slave-99 125616 125718 pts/1 00:00:00 lcore-slave-100 125616 125719 pts/1 00:00:00 lcore-slave-101 125616 125720 pts/1 00:00:00 lcore-slave-102 125616 125721 pts/1 00:00:00 lcore-slave-103 125616 125722 pts/1 00:00:00 lcore-slave-104 125616 125723 pts/1 00:00:00 lcore-slave-105 125616 125724 pts/1 00:00:00 lcore-slave-106 125616 125725 pts/1 00:00:00 lcore-slave-107 125616 125726 pts/1 00:00:00 lcore-slave-108 125616 125727 pts/1 00:00:00 lcore-slave-109 125616 125728 pts/1 00:00:00 lcore-slave-110 125616 125729 pts/1 00:00:00 lcore-slave-111 125616 125730 pts/1 00:00:00 lcore-slave-112 125616 125731 pts/1 00:00:00 lcore-slave-113 125616 125732 pts/1 00:00:00 lcore-slave-114 125616 125733 pts/1 00:00:00 lcore-slave-115 125616 125734 pts/1 00:00:00 lcore-slave-116 125616 125735 pts/1 00:00:00 lcore-slave-117 125616 125736 pts/1 00:00:00 lcore-slave-118 125616 125737 pts/1 00:00:00 lcore-slave-119 125616 125738 pts/1 00:00:00 lcore-slave-120 125616 125739 pts/1 00:00:00 lcore-slave-121 125616 125740 pts/1 00:00:00 lcore-slave-122 125616 125741 pts/1 00:00:00 lcore-slave-123 125616 125742 pts/1 00:00:00 lcore-slave-124 125616 125743 pts/1 00:00:00 lcore-slave-125 125616 125744 pts/1 00:00:00 lcore-slave-126 125616 125745 pts/1 00:00:00 lcore-slave-127 [root@localhost dpdk-ring-ping]#
        if (rte_ctrl_thread_create(&mp_handle_tid, "rte_mp_handle",
                            NULL, mp_handle, NULL) < 0) {
                    RTE_LOG(ERR, EAL, "failed to create mp thead: %s
    ",
                            strerror(errno));
                    close(mp_fd);
                    close(dir_fd);
                    mp_fd = -1;
                    return -1;
            }
    static void *
    mp_handle(void *arg __rte_unused)
    {
            struct mp_msg_internal msg;
            struct sockaddr_un sa;
    
            while (1) {
                    if (read_msg(&msg, &sa) == 0)
                            process_msg(&msg, &sa);
            }
    
            return NULL;
    }
    open_socket_fd(void)
    {
            struct sockaddr_un un;
    
            peer_name[0] = '';
            if (rte_eal_process_type() == RTE_PROC_SECONDARY)
                    snprintf(peer_name, sizeof(peer_name),
                                    "%d_%"PRIx64, getpid(), rte_rdtsc());
    
            mp_fd = socket(AF_UNIX, SOCK_DGRAM, 0);
            if (mp_fd < 0) {
                    RTE_LOG(ERR, EAL, "failed to create unix socket
    ");
                    return -1;
            }
    
            memset(&un, 0, sizeof(un));
            un.sun_family = AF_UNIX;
    
            create_socket_path(peer_name, un.sun_path, sizeof(un.sun_path));
    
            unlink(un.sun_path); /* May still exist since last run */
    
            if (bind(mp_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
                    RTE_LOG(ERR, EAL, "failed to bind %s: %s
    ",
                            un.sun_path, strerror(errno));
                    close(mp_fd);
                    return -1;
            }
              //EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
            RTE_LOG(INFO, EAL, "Multi-process socket %s
    ", un.sun_path);
            return mp_fd;
    }

    1、初始化全局socket
    rte_eal_init() --> rte_mp_channel_init()
    1
    rte_eal_init() --> rte_mp_channel_init()
    (1)生成进程间通信共享文件过滤变量mp_filter,值为” mp_socket_* “。
    (2)生成进程间通信共享文件所在的目录mp_dir_path,值为”/var/run/dpdk/rte”。
    (3)调用open_socket_fd()函数创建SOCK_DGRAM类型的socket, 保存在全局变量mp_fd中,并用bind()函数将mp_fd 与通信文件进行绑定。
    如果是主进程,则通信文件为:

    /var/run/dpdk/rte/mp_socket
    1
    /var/run/dpdk/rte/mp_socket
    如果是次进程,则通信文件为:

    /var/run/dpdk/rte/mp_socket_<pid>_<rdtsc>
    1
    /var/run/dpdk/rte/mp_socket_<pid>_<rdtsc>
    如果是次进程,则根据通信文件/var/run/dpdk/rte/mp_socket 向主进程发送消息,
    而主进程通过通信文件

    /var/run/dpdk/rte/mp_socket_<pid>_<rdtsc>
    1
    /var/run/dpdk/rte/mp_socket_<pid>_<rdtsc>
    向所有次进程发送消息。

    次进程之间没有消息通信。

    (4)创建消息处理线程,线程名为”rte_mp_handle”,线程处理函数为mp_handle()函数

    static void *mp_handle(void *arg __rte_unused)
    {
    struct mp_msg_internal msg;
    struct sockaddr_un sa;

    while (1) {
    if (read_msg(&msg, &sa) == 0)
    process_msg(&msg, &sa);
    }

    return NULL;
    }
     
    static void *mp_handle(void *arg __rte_unused)
    {
    struct mp_msg_internal msg;
    struct sockaddr_un sa;

    while (1) {
    if (read_msg(&msg, &sa) == 0)
    process_msg(&msg, &sa);
    }

    return NULL;
    }
    每个DPDK进程启动后,都会启动一个进程间消息处理的线程,进行DPDK进程间的消息处理。

    2、消息读取函数read_msg()
    该函数是对recvmsg()函数的封装,该函数对消息传递的各项结构进行赋值与封装,
    函数也会得到struct sockaddr_un 结构的通信沟通文件路径。
    之后将接收到的消息赋值到msg中,并由process_msg()函数处理。

    3、消息处理函数process_msg()
    该函数用来处理接收到的消息。
    (1)函数首先判断消息的类型,如果是响应的消息MP_REP,或要求忽略的消息MP_IGN,
    则去pending列表pending_requests中查找被挂起的消息,根据消息类型对消息做同步或异步处理。
    (2)之后,根据消息的msg->name,即地址,从action_entry_list列表中查找对应的entry。
    如果没有找到,则判断如果消息是一个请求消息,且DPDK初始化还没有完成,则发送一个空消息,告诉请求者忽略当前进程的存在。
    如果找到了,就调用对应的消息处理回调函数,对消息做对应的处理。

    [root@localhost dpdk-stable-17.11.2]# ls /var/run/dpdk/rte/
    config                      fbarray_memseg-2048k-1-2    fbarray_memseg-2048k-3-1    fbarray_memseg-524288k-2-0
    fbarray_memseg-2048k-0-0    fbarray_memseg-2048k-1-3    fbarray_memseg-2048k-3-2    fbarray_memseg-524288k-2-1
    fbarray_memseg-2048k-0-1    fbarray_memseg-2048k-2-0    fbarray_memseg-2048k-3-3    fbarray_memseg-524288k-3-0
    fbarray_memseg-2048k-0-2    fbarray_memseg-2048k-2-1    fbarray_memseg-524288k-0-0  fbarray_memseg-524288k-3-1
    fbarray_memseg-2048k-0-3    fbarray_memseg-2048k-2-2    fbarray_memseg-524288k-0-1  fbarray_memzone
    fbarray_memseg-2048k-1-0    fbarray_memseg-2048k-2-3    fbarray_memseg-524288k-1-0  hugepage_info
    fbarray_memseg-2048k-1-1    fbarray_memseg-2048k-3-0    fbarray_memseg-524288k-1-1  mp_socket
    [root@localhost dpdk-stable-17.11.2]# ls /var/run/dpdk/rte/mp_socket 
    /var/run/dpdk/rte/mp_socket
    [root@localhost dpdk-stable-17.11.2]# 

    [root@localhost dpdk-stable-17.11.2]# ls /var/run/dpdk/rte/mp_socket
    /var/run/dpdk/rte/mp_socket
    [root@localhost dpdk-stable-17.11.2]# cat /var/run/dpdk/rte/hugepage_info
    /dev/hugepages@@@@

    cat /var/run/dpdk/rte/config 
    c
     memzone
    H memseg-524288k-0-0@0@ memseg-524288k-0-1@0    `memseg-524288k-1-0@0@

  • 相关阅读:
    使用node.js搭建本地服务器
    使用Vue前端框架实现知乎日报app
    Echarts的使用
    [LeetCode] 642. Design Search Autocomplete System 设计搜索自动补全系统
    [LeetCode] 249. Group Shifted Strings 分组偏移字符串
    [LeetCode] 298. Binary Tree Longest Consecutive Sequence 二叉树最长连续序列
    [LeetCode] 128. Longest Consecutive Sequence 求最长连续序列
    [LeetCode] 227. Basic Calculator II 基本计算器 II
    [LeetCode] 224. Basic Calculator 基本计算器
    [LeetCode] 117. Populating Next Right Pointers in Each Node II 每个节点的右向指针 II
  • 原文地址:https://www.cnblogs.com/dream397/p/13577295.html
Copyright © 2011-2022 走看看