xdp-project / xdp-tutorial

XDP tutorial
2.33k stars 562 forks source link

'xsk_socket__create_shared' function throws a segmentation error #351

Closed arukshani closed 1 year ago

arukshani commented 1 year ago

Hi,

I've been trying to extend the 'advanced03-AF_XDP' program to use the same UMEM with multiple xdp sockets that belong to different NICs. However, the following line throws a segmentation fault error when I run my program.

Any idea why I get this error and how to get it fixed?

ret = xsk_socket__create_shared(&xsk_info->xsk, cfg->ifname,
                 cfg->xsk_if_queue, umem->umem, &xsk_info->rx,
                 &xsk_info->tx, &xsk_info->fq,  &xsk_info->cq, &xsk_cfg);

Thanks!

tohojo commented 1 year ago

Maybe @magnus-karlsson can answer this?

magnus-karlsson commented 1 year ago

Hard to say since I do not know what the values of your parameters are. But maybe you have not created dedicated fill and completion rings for each socket? That is the difference between sharing sockets between the same netdev/queue_id and different netdevs/queue_ids. Take a look at the AF_XDP_forwarding example.

arukshani commented 1 year ago

thanks! AF_XDP_forwarding example works.