Skip to contentSkip to conversation

netdev-afxdp: Add start qid support.

PATCH Ilya Maximets 2 participants 3 messages Feb 8, 2021 – Feb 9, 2021 6 messages not in the archive BPF

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CALDO+Sa=ohgXUzpY1E2E9CPoYEDZK9AVOTSznZ0WvUD54zEQXA@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CALDO+SabDwkLb85dxAV8R=iRgUyOAy9Q1JKDGXPTVJ+4bCTR9A@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 50 lines · Toshiaki Makita
Quoted 40 lines · William Tu
Quoted 39 lines · Gregory Rose
Quoted 20 lines · William Tu
Quoted 19 lines · Gregory Rose
Quoted 17 lines · William Tu

Mellanox card has different XSK design. It requires users to create dedicated queues for XSK. Unlike Intel's NIC which loads XDP program to all queues, Mellanox only loads XDP program to a subset of its queue.

When OVS uses AF_XDP with mlx5, it doesn't replace the existing RX and TX queues in the channel with XSK RX and XSK TX queues, but it creates an additional pair of queues for XSK in that channel. To distinguish regular and XSK queues, mlx5 uses a different range of qids. That means, if the card has 24 queues, queues 0..11 correspond to regular queues, and queues 12..23 are XSK queues.
In this case, we should attach the netdev-afxdp with 'start-qid=12'.

I tested using Mellanox Connect-X 6Dx, by setting 'start-qid=1', and:

     $ ethtool -L enp2s0f0np0 combined 1
     # queue 0 is for non-XDP traffic, queue 1 is for XSK
     $ ethtool -N enp2s0f0np0 flow-type udp4 action 1
note: we need additionally add flow-redirect rule to queue 1
Quoted 9 lines
Quoted 3 lines

Seems awfully hardware dependent.  Is this just for Mellanox or does it have general usefulness?

It is just Mellanox's design which requires pre-configure the flow-director. I only have cards from Intel and Mellanox so I don't know about other vendors.

Thanks,
William

I think we need to abstract the HW layer a little bit.  This start-qid option is specific to a single piece of HW, at least at this point. We should expect that further HW  specific requirements for different NIC vendors will come up in the future.  I suggest adding a hw_options:mellanox:start-qid type hierarchy  so that as new HW requirements come up we can easily scale.  It will also make adding new vendors easier in the future.

Quoted 8 lines
Quoted 6 lines

Even with NIC vendors you can't always count on each new generation design to always keep old requirements and methods for feature enablement.

What do you think?

Thanks for the feedback.
So far I don't know whether other vendors will need this option or not.

Quoted 6 lines

FWIU, this api "The lower half of the available amount of RX queues are regular queues, and the upper half are XSK RX queues." is the result of long discussion to support dedicated/isolated XSK rings, which is not meant for a mellanox-specific feature.

https://patchwork.ozlabs.org/project/netdev/cover/[email protected]/
https://patchwork.ozlabs.org/project/netdev/cover/[email protected]/

Toshiaki Makita

Thanks for the links. Very helpful.

From what I understand lower half of queues should still work, i.e. it should still be possible to attach AF_XDP socket to them. But they will not work in zero-copy mode ("generic" only?). William, could you check that? Does it work and with which mode "best-effort" ends up with? And what kind of errors libbpf returns if we're trying to enable zero-copy?

There are still few unanswered questions in those discussions and a clear lack of documentation. It seems that it's a work-in-progress, intermediate step towards some better user API. However it's unclear how this API will look like and when it will be implemented.

For BPF list and maintainers:

Is it possible to have some of this behavior documented?
How can application determine which netdevs are using this upper/bottom half schema for their regular and xsk channels/queues? How users should do that without digging into the kernel code or spending few hours googling for presentations from some conferences?

And I actually failed to find any written reference to the fact that I have to manually configure redirection of the traffic in order to receive it on XSK queues/channels and not on regular ones. This is very confusing and hard to understand, especially for a regular OVS user who is not familiar with XDP and kernel internals and just wants to utilize faster userspace networking.

Quoted 6 lines
Quoted 6 lines

I think adding another "hw_options" is a little confusing because this is already an option on the device.
Looking at AF_XDP driver at DPDK, it also has similar option:
see start_queue
https://doc.dpdk.org/guides/nics/af_xdp.html

This option for DPDK mainly positioned as a way to utilize multi-queue and a way to create different DPDK ports from different ranges of queues of the same device, so it's not exactly the same thing. But I see that it likely had a double purpose that wasn't mentioned in a commit message or documentation.

I think, for now we can have this option in OVS in a same way, i.e. as a way to partition the device or as a way to use particular range of queues from the device instead of using it as a whole. This way we will not need to have any vendor-specific knobs while allowing to use generic knob to utilize vendor-specific restrictions at the same time.

BTW, I didn't look at the patch itself yet, will get back with the actual review later.

Best regards, Ilya Maximets.

#7 lore raw
Quoted 59 lines · Ilya Maximets
Quoted 50 lines · Toshiaki Makita
Quoted 40 lines · William Tu
Quoted 39 lines · Gregory Rose
Quoted 20 lines · William Tu
Quoted 19 lines · Gregory Rose
Quoted 17 lines · William Tu

Mellanox card has different XSK design. It requires users to create dedicated queues for XSK. Unlike Intel's NIC which loads XDP program to all queues, Mellanox only loads XDP program to a subset of its queue.

When OVS uses AF_XDP with mlx5, it doesn't replace the existing RX and TX queues in the channel with XSK RX and XSK TX queues, but it creates an additional pair of queues for XSK in that channel. To distinguish regular and XSK queues, mlx5 uses a different range of qids. That means, if the card has 24 queues, queues 0..11 correspond to regular queues, and queues 12..23 are XSK queues.
In this case, we should attach the netdev-afxdp with 'start-qid=12'.

I tested using Mellanox Connect-X 6Dx, by setting 'start-qid=1', and:

     $ ethtool -L enp2s0f0np0 combined 1
     # queue 0 is for non-XDP traffic, queue 1 is for XSK
     $ ethtool -N enp2s0f0np0 flow-type udp4 action 1
note: we need additionally add flow-redirect rule to queue 1
Quoted 9 lines
Quoted 3 lines

Seems awfully hardware dependent. Is this just for Mellanox or does it have general usefulness?

It is just Mellanox's design which requires pre-configure the flow-director. I only have cards from Intel and Mellanox so I don't know about other vendors.

Thanks,
William

I think we need to abstract the HW layer a little bit. This start-qid option is specific to a single piece of HW, at least at this point. We should expect that further HW specific requirements for different NIC vendors will come up in the future. I suggest adding a hw_options:mellanox:start-qid type hierarchy so that as new HW requirements come up we can easily scale. It will also make adding new vendors easier in the future.

Quoted 8 lines
Quoted 6 lines

Even with NIC vendors you can't always count on each new generation design to always keep old requirements and methods for feature enablement.

What do you think?

Thanks for the feedback.
So far I don't know whether other vendors will need this option or not.

Quoted 6 lines

FWIU, this api "The lower half of the available amount of RX queues are regular queues, and the upper half are XSK RX queues." is the result of long discussion to support dedicated/isolated XSK rings, which is not meant for a mellanox-specific feature.

https://patchwork.ozlabs.org/project/netdev/cover/[email protected]/
https://patchwork.ozlabs.org/project/netdev/cover/[email protected]/

Toshiaki Makita

Quoted 8 lines

Thanks for the links. Very helpful.

From what I understand lower half of queues should still work, i.e. it should still be possible to attach AF_XDP socket to them. But they will not work in zero-copy mode ("generic" only?). William, could you check that? Does it work and with which mode "best-effort" ends up with? And what kind of errors libbpf returns if we're trying to enable zero-copy?

Thanks for your feedback.
Yes, only zero-copy mode needs to be aware of this, meaning zero-copy mode has to use the upper half of the queues (the start-qid option here). Native mode and SKB mode works OK on upper and lower queues. When attaching zc XSK to lower half queue, libbpf returns EINVAL at xsk_socket__create().

William

#8 lore raw
Quoted 69 lines · William Tu
Quoted 59 lines · Ilya Maximets
Quoted 50 lines · Toshiaki Makita
Quoted 40 lines · William Tu
Quoted 39 lines · Gregory Rose
Quoted 20 lines · William Tu
Quoted 19 lines · Gregory Rose
Quoted 17 lines · William Tu

Mellanox card has different XSK design. It requires users to create dedicated queues for XSK. Unlike Intel's NIC which loads XDP program to all queues, Mellanox only loads XDP program to a subset of its queue.

When OVS uses AF_XDP with mlx5, it doesn't replace the existing RX and TX queues in the channel with XSK RX and XSK TX queues, but it creates an additional pair of queues for XSK in that channel. To distinguish regular and XSK queues, mlx5 uses a different range of qids. That means, if the card has 24 queues, queues 0..11 correspond to regular queues, and queues 12..23 are XSK queues.
In this case, we should attach the netdev-afxdp with 'start-qid=12'.

I tested using Mellanox Connect-X 6Dx, by setting 'start-qid=1', and:

     $ ethtool -L enp2s0f0np0 combined 1
     # queue 0 is for non-XDP traffic, queue 1 is for XSK
     $ ethtool -N enp2s0f0np0 flow-type udp4 action 1
note: we need additionally add flow-redirect rule to queue 1
Quoted 9 lines
Quoted 3 lines

Seems awfully hardware dependent. Is this just for Mellanox or does it have general usefulness?

It is just Mellanox's design which requires pre-configure the flow-director. I only have cards from Intel and Mellanox so I don't know about other vendors.

Thanks,
William

I think we need to abstract the HW layer a little bit. This start-qid option is specific to a single piece of HW, at least at this point. We should expect that further HW specific requirements for different NIC vendors will come up in the future. I suggest adding a hw_options:mellanox:start-qid type hierarchy so that as new HW requirements come up we can easily scale. It will also make adding new vendors easier in the future.

Quoted 8 lines
Quoted 6 lines

Even with NIC vendors you can't always count on each new generation design to always keep old requirements and methods for feature enablement.

What do you think?

Thanks for the feedback.
So far I don't know whether other vendors will need this option or not.

Quoted 6 lines

FWIU, this api "The lower half of the available amount of RX queues are regular queues, and the upper half are XSK RX queues." is the result of long discussion to support dedicated/isolated XSK rings, which is not meant for a mellanox-specific feature.

https://patchwork.ozlabs.org/project/netdev/cover/[email protected]/
https://patchwork.ozlabs.org/project/netdev/cover/[email protected]/

Toshiaki Makita

Quoted 8 lines

Thanks for the links. Very helpful.

From what I understand lower half of queues should still work, i.e. it should still be possible to attach AF_XDP socket to them. But they will not work in zero-copy mode ("generic" only?). William, could you check that? Does it work and with which mode "best-effort" ends up with? And what kind of errors libbpf returns if we're trying to enable zero-copy?

Quoted 6 lines

Thanks for your feedback.
Yes, only zero-copy mode needs to be aware of this, meaning zero-copy mode has to use the upper half of the queues (the start-qid option here). Native mode and SKB mode works OK on upper and lower queues. When attaching zc XSK to lower half queue, libbpf returns EINVAL at xsk_socket__create().

OK. Thanks for checking.