zoukankan      html  css  js  c++  java
  • dpdk 驱动初始化

    [root@localhost memzone]# gdb  build/app/TestMalloc 
    GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-119.el7
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "aarch64-redhat-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>...
    Reading symbols from /data1/dpdk-19.11/demo/memzone/build/app/TestMalloc...done.
    (gdb) b /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3144
    Breakpoint 1 at 0x781de4: file /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c, line 3144.
    (gdb) set args 3  -c 0xff  
    (gdb) r
    Starting program: /data1/dpdk-19.11/demo/memzone/build/app/TestMalloc 3  -c 0xff  
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    EAL: Detected 128 lcore(s)
    EAL: Detected 4 NUMA nodes
    [New Thread 0xffffbe43d910 (LWP 15888)]
    EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
    [New Thread 0xffffbdc2d910 (LWP 15889)]
    EAL: Selected IOVA mode 'PA'
    EAL: No available hugepages reported in hugepages-2048kB
    EAL: Probing VFIO support...
    EAL: VFIO support initialized
    [New Thread 0xffffbd40d910 (LWP 15890)]
    [New Thread 0xffffbcbfd910 (LWP 15891)]
    [New Thread 0xffffbc3ed910 (LWP 15892)]
    [New Thread 0xffffbbbdd910 (LWP 15893)]
    [New Thread 0xffffbb3cd910 (LWP 15894)]
    [New Thread 0xffffbabbd910 (LWP 15895)]
    [New Thread 0xffffba3ad910 (LWP 15896)]
    EAL: PCI device 0000:05:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:200 net_hinic
    EAL:   using IOMMU type 1 (Type 1)
    
    Breakpoint 1, hinic_pci_probe (pci_drv=0xe231e0 <rte_hinic_pmd>, pci_dev=0x116eac0)
        at /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3147
    3147            return rte_eth_dev_pci_generic_probe(pci_dev,
    (gdb) bt
    #0  hinic_pci_probe (pci_drv=0xe231e0 <rte_hinic_pmd>, pci_dev=0x116eac0)
        at /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3147
    #1  0x00000000005d7cbc in rte_pci_probe_one_driver (dr=0xe231e0 <rte_hinic_pmd>, dev=0x116eac0)
        at /data1/dpdk-19.11/drivers/bus/pci/pci_common.c:199
    #2  0x00000000005d7eb4 in pci_probe_all_drivers (dev=0x116eac0)
        at /data1/dpdk-19.11/drivers/bus/pci/pci_common.c:274
    #3  0x00000000005d7f80 in rte_pci_probe () at /data1/dpdk-19.11/drivers/bus/pci/pci_common.c:309
    #4  0x00000000005a5588 in rte_bus_probe () at /data1/dpdk-19.11/lib/librte_eal/common/eal_common_bus.c:72
    #5  0x000000000058a948 in rte_eal_init (argc=4, argv=0xfffffffff558)
        at /data1/dpdk-19.11/lib/librte_eal/linux/eal/eal.c:1258
    #6  0x0000000000464d24 in main (argc=4, argv=0xfffffffff558) at /data1/dpdk-19.11/demo/memzone/main.c:40
    (gdb) p *pci_dev
    $1 = {next = {tqe_next = 0x1113120, tqe_prev = 0x1105fc0}, device = {next = {tqe_next = 0x0, tqe_prev = 0x0}, 
        name = 0x11753e0 "0000:05:00.0", driver = 0x0, bus = 0xe1db18 <rte_pci_bus>, numa_node = 0, devargs = 0x0}, 
      addr = {domain = 0, bus = 5 '05', devid = 0 '00', function = 0 '00'}, id = {class_id = 131072, 
        vendor_id = 6629, device_id = 512, subsystem_vendor_id = 6629, subsystem_device_id = 53561}, mem_resource = {
        {phys_addr = 8796221997056, len = 131072, addr = 0x8300000000}, {phys_addr = 0, len = 0, addr = 0x0}, {
          phys_addr = 8796237856768, len = 32768, addr = 0x0}, {phys_addr = 0, len = 0, addr = 0x0}, {
          phys_addr = 8796095119360, len = 1048576, addr = 0x8300030000}, {phys_addr = 0, len = 0, addr = 0x0}}, 
      intr_handle = {{vfio_dev_fd = 62, uio_cfg_fd = 62}, fd = 63, type = RTE_INTR_HANDLE_VFIO_MSIX, max_intr = 0, 
        nb_efd = 0, efd_counter_size = 0 '00', efds = {0 <repeats 512 times>}, elist = {{status = 0, fd = 0, 
            epfd = 0, epdata = {event = 0, data = 0x0, cb_fun = 0x0, cb_arg = 0x0}} <repeats 512 times>}, 
        intr_vec = 0x0}, driver = 0xe231e0 <rte_hinic_pmd>, max_vfs = 0, kdrv = RTE_KDRV_VFIO, 
      name = "0000:05:00.00000000000", vfio_req_intr_handle = {{vfio_dev_fd = 62, uio_cfg_fd = 62}, 
        fd = 64, type = RTE_INTR_HANDLE_VFIO_REQ, max_intr = 0, nb_efd = 0, efd_counter_size = 0 '00', efds = {
          0 <repeats 512 times>}, elist = {{status = 0, fd = 0, epfd = 0, epdata = {event = 0, data = 0x0, 
              cb_fun = 0x0, cb_arg = 0x0}} <repeats 512 times>}, intr_vec = 0x0}}
    (gdb) set print pretty on
    (gdb) p *pci_dev
    $2 = {
      next = {
        tqe_next = 0x1113120, 
        tqe_prev = 0x1105fc0
      }, 
      device = {
        next = {
          tqe_next = 0x0, 
          tqe_prev = 0x0
        }, 
        name = 0x11753e0 "0000:05:00.0", 
        driver = 0x0, 
        bus = 0xe1db18 <rte_pci_bus>, 
        numa_node = 0, 
        devargs = 0x0
      }, 
      addr = {
        domain = 0, 
        bus = 5 '05', 
        devid = 0 '00', 
        function = 0 '00'
      }, 
      id = {
        class_id = 131072, 
        vendor_id = 6629, 
        device_id = 512, 
        subsystem_vendor_id = 6629, 
        subsystem_device_id = 53561
      }, 
      mem_resource = {{
          phys_addr = 8796221997056, 
    ---Type <return> to continue, or q <return> to quit---
          len = 131072, 
          addr = 0x8300000000
        }, {
          phys_addr = 0, 
          len = 0, 
          addr = 0x0
        }, {
          phys_addr = 8796237856768, 
          len = 32768, 
          addr = 0x0
        }, {
          phys_addr = 0, 
          len = 0, 
          addr = 0x0
        }, {
          phys_addr = 8796095119360, 
          len = 1048576, 
          addr = 0x8300030000
        }, {
          phys_addr = 0, 
          len = 0, 
          addr = 0x0
        }}, 
      intr_handle = {
        {
          vfio_dev_fd = 62, 
          uio_cfg_fd = 62
        }, 
        fd = 63, 
        type = RTE_INTR_HANDLE_VFIO_MSIX, 
        max_intr = 0, 
    ---Type <return> to continue, or q <return> to quit---
        nb_efd = 0, 
        efd_counter_size = 0 '00', 
        efds = {0 <repeats 512 times>}, 
        elist = {{
            status = 0, 
            fd = 0, 
            epfd = 0, 
            epdata = {
              event = 0, 
              data = 0x0, 
              cb_fun = 0x0, 
              cb_arg = 0x0
            }
          } <repeats 512 times>}, 
        intr_vec = 0x0
      }, 
      driver = 0xe231e0 <rte_hinic_pmd>, 
      max_vfs = 0, 
      kdrv = RTE_KDRV_VFIO, 
      name = "0000:05:00.00000000000", 
      vfio_req_intr_handle = {
        {
          vfio_dev_fd = 62, 
          uio_cfg_fd = 62
        }, 
        fd = 64, 
        type = RTE_INTR_HANDLE_VFIO_REQ, 
        max_intr = 0, 
        nb_efd = 0, 
        efd_counter_size = 0 '00', 
        efds = {0 <repeats 512 times>}, 
    ---Type <return> to continue, or q <return> to quit---
        elist = {{
            status = 0, 
            fd = 0, 
            epfd = 0, 
            epdata = {
              event = 0, 
              data = 0x0, 
              cb_fun = 0x0, 
              cb_arg = 0x0
            }
          } <repeats 512 times>}, 
        intr_vec = 0x0
      }
    }
    (gdb) 
    (gdb) p *(pci_dev->intr_handle)
    Structure has no component named operator*.
    (gdb) p pci_dev->intr_handle)
    Junk after end of expression.
    (gdb) p pci_dev->intr_handle
    $3 = {
      {
        vfio_dev_fd = 62, 
        uio_cfg_fd = 62
      }, 
      fd = 63, 
      type = RTE_INTR_HANDLE_VFIO_MSIX, 
      max_intr = 0, 
      nb_efd = 0, 
      efd_counter_size = 0 '00', 
      efds = {0 <repeats 512 times>}, 
      elist = {{
          status = 0, 
          fd = 0, 
          epfd = 0, 
          epdata = {
            event = 0, 
            data = 0x0, 
            cb_fun = 0x0, 
            cb_arg = 0x0
          }
        } <repeats 512 times>}, 
      intr_vec = 0x0
    }
    (gdb) 
    [root@localhost ~]# lsof -d 63
    COMMAND     PID USER   FD      TYPE             DEVICE SIZE/OFF   NODE NAME
    master    10657 root   63u     unix 0xffff805fcbfb5e80      0t0 104560 socket
    TestMallo 15885 root   63u  a_inode               0,13        0   8356 [eventfd]
    [root@localhost ~]# lsof -d 62
    COMMAND     PID USER   FD      TYPE             DEVICE SIZE/OFF   NODE NAME
    master    10657 root   62u     unix 0xffff805fcbfb5a00      0t0 104559 public/showq
    TestMallo 15885 root   62u  a_inode               0,13        0   8356 [vfio-device]
    [root@localhost ~]# ps -elf | grep 10657
    5 S root      10657      1  0  80   0 -   342 SyS_ep Aug25 ?        00:00:03 /usr/libexec/postfix/master -w
    4 S postfix   10701  10657  0  80   0 -   345 SyS_ep Aug25 ?        00:00:00 qmgr -l -t unix -u
    4 S postfix   14671  10657  0  80   0 -   344 SyS_ep 21:41 ?        00:00:00 pickup -l -t unix -u
    0 S root      16472  16388  0  80   0 -  1730 pipe_w 22:16 pts/3    00:00:00 grep --color=auto 10657
    [root@localhost ~]# ps -elf | grep 15885
    4 t root      15885  15792  0  80   0 - 8390110 ptrace 22:04 pts/2  00:00:00 /data1/dpdk-19.11/demo/memzone/build/app/TestMalloc 3 -c 0xff
    0 S root      16486  16388  0  80   0 -  1729 pipe_w 22:16 pts/3    00:00:00 grep --color=auto 15885
    [root@localhost ~]# 
    gdb) b
    Note: breakpoint 2 also set at pc 0x781a28.
    Breakpoint 4 at 0x781a28: file /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c, line 3029.
    (gdb) bt 
    #0  hinic_func_init (eth_dev=0x1001380 <rte_eth_devices>)
        at /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3029
    #1  0x0000000000781d2c in hinic_dev_init (eth_dev=0x1001380 <rte_eth_devices>)
        at /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3105
    #2  0x000000000077bf98 in rte_eth_dev_pci_generic_probe (pci_dev=0x116eac0, private_data_size=1320, 
        dev_init=0x781c48 <hinic_dev_init>)
        at /data1/dpdk-19.11/arm64-armv8a-linuxapp-gcc/include/rte_ethdev_pci.h:164
    #3  0x0000000000781df8 in hinic_pci_probe (pci_drv=0xe231e0 <rte_hinic_pmd>, pci_dev=0x116eac0)
        at /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3147
    #4  0x00000000005d7cbc in rte_pci_probe_one_driver (dr=0xe231e0 <rte_hinic_pmd>, dev=0x116eac0)
        at /data1/dpdk-19.11/drivers/bus/pci/pci_common.c:199
    #5  0x00000000005d7eb4 in pci_probe_all_drivers (dev=0x116eac0)
        at /data1/dpdk-19.11/drivers/bus/pci/pci_common.c:274
    #6  0x00000000005d7f80 in rte_pci_probe () at /data1/dpdk-19.11/drivers/bus/pci/pci_common.c:309
    #7  0x00000000005a5588 in rte_bus_probe () at /data1/dpdk-19.11/lib/librte_eal/common/eal_common_bus.c:72
    #8  0x000000000058a948 in rte_eal_init (argc=4, argv=0xfffffffff558)
        at /data1/dpdk-19.11/lib/librte_eal/linux/eal/eal.c:1258
    #9  0x0000000000464d24 in main (argc=4, argv=0xfffffffff558) at /data1/dpdk-19.11/demo/memzone/main.c:40
    (gdb) 
    (gdb) p pci_dev->intr_handle
    $4 = {
      {
        vfio_dev_fd = 62, 
        uio_cfg_fd = 62
      }, 
      fd = 63, 
      type = RTE_INTR_HANDLE_VFIO_MSIX, 
      max_intr = 0, 
      nb_efd = 0, 
      efd_counter_size = 0 '00', 
      efds = {0 <repeats 512 times>}, 
      elist = {{
          status = 0, 
          fd = 0, 
          epfd = 0, 
          epdata = {
            event = 0, 
            data = 0x0, 
            cb_fun = 0x0, 
            cb_arg = 0x0
          }
        } <repeats 512 times>}, 
      intr_vec = 0x0
    }
    (gdb) p *nic_dev
    $6 = {
      hwdev = 0x13ff9a180, 
      txqs = 0x13febda00, 
      rxqs = 0x13febd900, 
      cpy_mpool = 0x13febd600, 
      num_qps = 0, 
      num_sq = 0, 
      num_rq = 0, 
      mtu_size = 0, 
      rss_tmpl_idx = 0 '00', 
      rss_indir_flag = 0 '00', 
      num_rss = 0 '00', 
      rx_queue_list = '00' <repeats 63 times>, 
      vfta = {0 <repeats 128 times>}, 
      default_addr = {
        addr_bytes = "D241221244233", <incomplete sequence 353>
      }, 
      mc_list = 0x13ff9a280, 
      flags = 0, 
      nic_cap = {
        max_sqs = 16, 
        max_rqs = 16, 
        vf_max_sqs = 4, 
        vf_max_rqs = 4, 
        lro_en = 0, 
        lro_sz = 15 '17', 
        tso_sz = 15 '17'
      }, 
      rx_mode_status = 0, 
      dev_status = 0, 
      proc_dev_name = "hinic-0000:05:00.0", '00' <repeats 13 times>, 
    ---Type <return> to continue, or q <return> to quit---
      default_cos = 4, 
      rx_csum_en = 0, 
      filter = {
        pkt_type = 0 '00', 
        qid = 0 '00', 
        type_mask = 0, 
        fivetuple_list = {
          tqh_first = 0x0, 
          tqh_last = 0x0
        }, 
        pkt_filters = {{
            pkt_proto = 0, 
            qid = 0 '00', 
            enable = 0
          } <repeats 64 times>}
      }, 
      filter_ntuple_list = {
        tqh_first = 0x0, 
        tqh_last = 0x0
      }, 
      filter_ethertype_list = {
        tqh_first = 0x0, 
        tqh_last = 0x0
      }, 
      filter_fdir_rule_list = {
        tqh_first = 0x0, 
        tqh_last = 0x0
      }, 
      hinic_flow_list = {
        tqh_first = 0x0, 
        tqh_last = 0x0
    ---Type <return> to continue, or q <return> to quit---
      }
    }
    (gdb) 
    (gdb) p *pci_dev
    $7 = {
      next = {
        tqe_next = 0x1113120, 
        tqe_prev = 0x1105fc0
      }, 
      device = {
        next = {
          tqe_next = 0x0, 
          tqe_prev = 0x0
        }, 
        name = 0x11753e0 "0000:05:00.0", 
        driver = 0x0, 
        bus = 0xe1db18 <rte_pci_bus>, 
        numa_node = 0, 
        devargs = 0x0
      }, 
      addr = {
        domain = 0, 
        bus = 5 '05', 
        devid = 0 '00', 
        function = 0 '00'
      }, 
      id = {
        class_id = 131072, 
        vendor_id = 6629, 
        device_id = 512, 
        subsystem_vendor_id = 6629, 
        subsystem_device_id = 53561
      }, 
      mem_resource = {{
          phys_addr = 8796221997056, 
    ---Type <return> to continue, or q <return> to quit---
          len = 131072, 
          addr = 0x8300000000
        }, {
          phys_addr = 0, 
          len = 0, 
          addr = 0x0
        }, {
          phys_addr = 8796237856768, 
          len = 32768, 
          addr = 0x0
        }, {
          phys_addr = 0, 
          len = 0, 
          addr = 0x0
        }, {
          phys_addr = 8796095119360, 
          len = 1048576, 
          addr = 0x8300030000
        }, {
          phys_addr = 0, 
          len = 0, 
          addr = 0x0
        }}, 
      intr_handle = {
        {
          vfio_dev_fd = 62, 
          uio_cfg_fd = 62
        }, 
        fd = 63, 
        type = RTE_INTR_HANDLE_VFIO_MSIX, 
        max_intr = 0, 
    ---Type <return> to continue, or q <return> to quit---
        nb_efd = 0, 
        efd_counter_size = 0 '00', 
        efds = {0 <repeats 512 times>}, 
        elist = {{
            status = 0, 
            fd = 0, 
            epfd = 0, 
            epdata = {
              event = 0, 
              data = 0x0, 
              cb_fun = 0x0, 
              cb_arg = 0x0
            }
          } <repeats 512 times>}, 
        intr_vec = 0x0
      }, 
      driver = 0xe231e0 <rte_hinic_pmd>, 
      max_vfs = 0, 
      kdrv = RTE_KDRV_VFIO, 
      name = "0000:05:00.00000000000", 
      vfio_req_intr_handle = {
        {
          vfio_dev_fd = 62, 
          uio_cfg_fd = 62
        }, 
        fd = 64, 
        type = RTE_INTR_HANDLE_VFIO_REQ, 
        max_intr = 0, 
        nb_efd = 0, 
        efd_counter_size = 0 '00', 
        efds = {0 <repeats 512 times>}, 
    ---Type <return> to continue, or q <return> to quit---
        elist = {{
            status = 0, 
            fd = 0, 
            epfd = 0, 
            epdata = {
              event = 0, 
              data = 0x0, 
              cb_fun = 0x0, 
              cb_arg = 0x0
            }
          } <repeats 512 times>}, 
        intr_vec = 0x0
      }
    }
    (gdb) 
    (gdb) 
    (gdb) c
    Continuing.
    net_hinic: Initialize 0000:05:00.0 in primary successfully
    EAL: PCI device 0000:06:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:200 net_hinic
    
    Breakpoint 1, hinic_pci_probe (pci_drv=0xe231e0 <rte_hinic_pmd>, pci_dev=0x1113120)
        at /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3147
    3147            return rte_eth_dev_pci_generic_probe(pci_dev,
    (gdb) c
    Continuing.
    net_hinic: Initializing pf hinic-0000:06:00.0 in primary process
    net_hinic: Device 0000:06:00.0 hwif attribute:
    net_hinic: func_idx:1, p2p_idx:1, pciintf_idx:0, vf_in_pf:0, ppf_idx:0, global_vf_id:135, func_type:0
    net_hinic: num_aeqs:4, num_ceqs:4, num_irqs:32, dma_attr:2
    net_hinic: Get public resource capability:
    net_hinic: host_id: 0x0, ep_id: 0x1, intr_type: 0x0, max_cos_id: 0x7, er_id: 0x1, port_id: 0x1
    net_hinic: host_total_function: 0xf2, host_oq_id_mask_val: 0x8, max_vf: 0x78
    net_hinic: pf_num: 0x2, pf_id_start: 0x0, vf_num: 0xf0, vf_id_start: 0x10
    net_hinic: Get l2nic resource capability:
    net_hinic: max_sqs: 0x10, max_rqs: 0x10, vf_max_sqs: 0x4, vf_max_rqs: 0x4
    
    Breakpoint 2, hinic_func_init (eth_dev=0x1005480 <rte_eth_devices+16640>)
        at /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3029
    3029            rc = rte_intr_callback_register(&pci_dev->intr_handle,
    (gdb) c
    Continuing.
    net_hinic: Initialize 0000:06:00.0 in primary successfully
    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
    mz addr: 100015028, mz->addr :13fd84f80 , mz->addr_64 : 13fd84f80
    arr addr: fffffffff3e8 
    arr addr: 13fd83f00 
    hello from core 1
    socket id  0
    hello from core 2
    socket id  0
    hello from core 3
    socket id  0
    hello from core 4
    socket id  0
    hello from core 5
    socket id  0
    hello from core 6
    socket id  0
    hello from core 7
    socket id  0
    hello from core 0
    socket id  0

      80000200000-80008afffff : PCI Bus 0000:05
            80000200000-800002fffff : 0000:05:00.0
            80000300000-80007afffff : 0000:05:00.0
            80007b00000-80007b1ffff : 0000:05:00.0
            80007b20000-8000829ffff : 0000:05:00.0
            800082a0000-80008a1ffff : 0000:05:00.0
            80008a20000-80008a27fff : 0000:05:00.0
  • 相关阅读:
    MIP技术进展月报第3期:MIP小姐姐听说,你想改改MIP官网?
    MIP技术进展月报第2期: 数据绑定,异步脚本加速
    WebP 在减少图片体积和流量上的效果如何?MIP技术实践分享
    改造MIP获得搜索青睐,轻松完成SEO
    MIP 技术进展月报:储存功能全新上线,MIP-Cache域名升级,校验更严谨
    【转】W3C中国与百度联合组织移动网页加速技术研讨会
    百度将与W3C中国召开MIP技术研讨会
    【公告】MIP组件审核平台故障-影响说明
    【公告】关于8.8MIP组件审核平台故障的说明
    MIP 移动网页加速器视频教程全新发布
  • 原文地址:https://www.cnblogs.com/dream397/p/13630964.html
Copyright © 2011-2022 走看看