vppctl enable tap-inject create interface af_xdp host-if ens9 num-rx-queues all set int mac address ens9/0 52:54:00:ba:be:14
sudo ifconfig vpp0 inet 172.16.2.135 netmask 255.255.255.0 up hw ether 52:54:00:ba:be:14 delete interface af_xdp ens9/0 af_xdp_create_if() -->af_xdp_create_queue() -->xsk_umem__create() -->xsk_umem__create_v0_0_4() -->umem->fd = socket(AF_XDP, SOCK_RAW, 0); xsk_set_umem_config(&umem->config, usr_config); setsockopt(umem->fd, SOL_XDP, XDP_UMEM_REG, &mr, sizeof(mr)); xsk_create_umem_rings(umem, umem->fd, fill, comp); -->setsockopt(fd, SOL_XDP, XDP_UMEM_FILL_RING, &umem->config.fill_size, sizeof(umem->config.fill_size)); setsockopt(fd, SOL_XDP, XDP_UMEM_COMPLETION_RING, &umem->config.comp_size, sizeof(umem->config.comp_size)); xsk_get_mmap_offsets(fd, &off); mmap(NULL, off.fr.desc + umem->config.fill_size * sizeof(__u64),PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd,XDP_UMEM_PGOFF_FILL_RING); mmap(NULL, off.cr.desc + umem->config.comp_size * sizeof(__u64), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd, XDP_UMEM_PGOFF_COMPLETION_RING); -->xsk_socket__create() -->xsk_socket__create_shared() -->xsk_set_xdp_socket_config(&xsk->config, usr_config); xsk->fd = umem->fd; ctx = xsk_create_ctx(xsk, umem, ifindex, ifname, queue_id,fill, comp); setsockopt(xsk->fd, SOL_XDP, XDP_RX_RING, &xsk->config.rx_size, sizeof(xsk->config.rx_size)); setsockopt(xsk->fd, SOL_XDP, XDP_TX_RING, &xsk->config.tx_size, sizeof(xsk->config.tx_size)); xsk_get_mmap_offsets(xsk->fd, &off); mmap(NULL, off.rx.desc + xsk->config.rx_size * sizeof(struct xdp_desc), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, xsk->fd, XDP_PGOFF_RX_RING); mmap(NULL, off.tx.desc + xsk->config.tx_size * sizeof(struct xdp_desc), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, xsk->fd, XDP_PGOFF_TX_RING); bind(xsk->fd, (struct sockaddr *)&sxdp, sizeof(sxdp)); /* 第二次绑定会失败,不管是多queue情况下,还是删端口再建立端口,第二次绑定大概率会失败 */ -->ad->pool = vlib_buffer_pool_get_default_for_numa (vm, af_xdp_get_numa(ad->linux_ifname)); ethernet_mac_address_generate (ad->hwaddr); ethernet_register_interface (vnm, af_xdp_device_class.index, ad->dev_instance, ad->hwaddr, &ad->hw_if_index, af_xdp_flag_change); sw = vnet_get_hw_sw_interface (vnm, ad->hw_if_index); hw = vnet_get_hw_interface (vnm, ad->hw_if_index); vnet_hw_if_set_input_node (vnm, ad->hw_if_index, af_xdp_input_node.index); rxq->queue_index = vnet_hw_if_register_rx_queue (vnm, ad->hw_if_index, i, VNET_HW_IF_RXQ_THREAD_ANY) rxq->file_index = clib_file_add (&file_main, &f); vnet_hw_if_set_rx_queue_file_index (vnm, rxq->queue_index, rxq->file_index); (gdb) bt #0 0x00007f6fe0fcf958 in xsk_create_bpf_maps (xsk=0xf1b040) at xsk.c:589 #1 0x00007f6fe0fd01c1 in xsk_init_xdp_res (xsk=0xf1b040, xsks_map_fd=0x0) at xsk.c:800 #2 0x00007f6fe0fd042e in __xsk_setup_xdp_prog (_xdp=0xf1b040, xsks_map_fd=0x0) at xsk.c:886 #3 0x00007f6fe0fd108c in xsk_socket__create_shared (xsk_ptr=0x7f6fe421aa00, ifname=0x7f6fe421a930 "ens9", queue_id=0, umem=0xf88b20, rx=0x7f6fe421aa48, tx=0x7f6fe421ab50, fill=0x7f6fe421aa78, comp=0x7f6fe421ab80, usr_config=0x7f6ffac1ce40) at xsk.c:1170 #4 0x00007f6fe0fd122e in xsk_socket__create (xsk_ptr=0x7f6fe421aa00, ifname=0x7f6fe421a930 "ens9", queue_id=0, umem=0xf88b20, rx=0x7f6fe421aa48, tx=0x7f6fe421ab50, usr_config=0x7f6ffac1ce40) at xsk.c:1206 #5 0x00007f6fe121a237 in af_xdp_create_queue ( vm=0x7f70236bec00 <vlib_global_main>, args=0x7f6ffac1d460, ad=0x7f6fe421a880, qid=0) at /home/beirvin/workspace/flexirouter_new/vpp/src/plugins/af_xdp/device.c:254 #6 0x00007f6fe121879d in af_xdp_create_if ( vm=0x7f70236bec00 <vlib_global_main>, args=0x7f6ffac1d460) at /home/beirvin/workspace/flexirouter_new/vpp/src/plugins/af_xdp/device.c:468 #7 0x00007f6fe1215936 in af_xdp_create_command_fn ( err = bpf_set_link_xdp_fd(xsk->ctx->ifindex, ctx->prog_fd, xsk->config.xdp_flags); af_xdp_create_if() -->af_xdp_create_queue() -->af_xdp_create_queue() -->xsk_socket__create() -->xsk_socket__create_shared() -->__xsk_setup_xdp_prog() -->bpf_set_link_xdp_fd() *// kernel error message occured: libbpf: Kernel error message: virtio_net: Too few free TX rings available*
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#21261): https://lists.fd.io/g/vpp-dev/message/21261 Mute This Topic: https://lists.fd.io/mt/90434107/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-