> > Yes, I agree, but I don't think it is the case here. > > >It will cause segment fault in enqueue/dequeue. > > Hmm, have you debug it? Which line caused the segfault? > > You can refer to test_rawdev_enqdeq function in skeleton_rawdev_test.c, what > it does is similar to my suggestion, and you just need one alloc/free. > Of course I debug on it. It will cause seg fault at rte_memcpy. Because buffers[0]->buf_addr is not right. You can see the debug log. (gdb) p test_pkts_send[0].buf_addr $3 = (void *) 0x5555562784c0 (gdb) n 164 rte_rawdev_set_attr(dev_id, "spad14", val); (gdb) ntb_attr_set(): Set attribute (spad14) Value (0) 165 val = size; (gdb) 166 rte_rawdev_set_attr(dev_id, "spad15", val); (gdb) ntb_attr_set(): Set attribute (spad15) Value (35) 175 rte_rawdev_enqueue_buffers(dev_id, (struct rte_rawdev_buf **)&test_pkts_send, 1, (void *)size); (gdb)
Thread 1 "ntb_fwd" hit Breakpoint 2, ntb_enqueue_bufs (dev=0x555556023b80 <rte_rawdevices>, buffers=0x7fffffff7fe0, count=1, context=0x23) at /home/xiaoyun/ntb/dpdk-next-net-intel/drivers/raw/ntb_rawdev/ntb_rawdev.c:244 244 struct ntb_hw *hw = dev->dev_private; (gdb) n 248 if (hw->ntb_ops->get_peer_mw_addr == NULL) (gdb) 249 return -ENOTSUP; (gdb) p buffers[0]->buf_addr $4 = (void *) 0x6f77206f6c6c6568 (gdb) p &buffers[0]->buf_addr $5 = (void **) 0x5555562784c0 > Thanks, > Xiaolong > > > > >I will free twice. > > > >> > >2.17.1 > >> > >