Hi,
How should flow offload handle an nftables policy that assigns one
packet priority to the original direction and another to the reply?
I ran into this while testing hardware queue selection on a MediaTek
MT7986 router. The OpenWrt 6.18 tree carries a patch that records the
priority of the packet that creates a flow and reuses it in both
directions. My results below are for that tree. I have not tested an
unmodified mainline kernel.
I reproduced the issue in QEMU on x86_64 without a MediaTek driver.
Two network namespaces exchange traffic through a forwarding namespace.
Before "flow add", an nftables forward chain sets skb priority to
4d54:c towards the server and zero on replies. Egress counters check
the priority in each direction.
In the IPv4 UDP echo test, only 1 of 140 packets towards the server
had the configured priority. All 140 replies had the expected zero
priority. The forward rule saw just two packets. With an experimental
change that tracks priority per direction, all 140 packets in each
direction had the expected priority. The modified kernel also passed
the other seven IPv4/IPv6 cases, including delayed replies and one-way
UDP. The control run stopped at the first failure.
On a Netcore N60 Pro (MT7986, Linux 6.18.60), three outgoing UDP flows
configured for queues 12, 11 and 9 all used queue 1 on the control
image. On the experimental image they used queues 12, 11 and 9,
respectively. Replies used queue 3 on both images. The router images
also differed in driver changes, so the QEMU test is the cleaner
comparison.
Would it make sense to learn the priority from the first classified
packet in each direction and defer hardware offload for a direction
whose priority is still unknown? In particular, is there an existing
way to offload one-way UDP without guessing the priority of a future
reply? The policy in these tests is constant within each direction.
I've attached the reproducer, the two QEMU logs and the experimental
diff against the OpenWrt tree.
OpenWrt flowtable patch:
https://github.com/openwrt/openwrt/blob/34565ce09e36908a7a3b6f368f02e334d5256518/target/linux/generic/pending-6.18/708-netfilter-flowtable-carry-a-priority-into-the-offload.patch
Thanks,
Alexander
[RFC] netfilter: preserving per-direction packet priority across flow offload
- From
- st71…@gmail.com (Александр Загузин)
- Organization
- Usenet Network
- Message-ID
- <CABi…@mail.gmail.com>
- Date
- Newsgroups
- linux.kernel.netdev