diff mbox series

[net-next] udp: allow changing mapping of a socket to queue

Message ID 20210627075740.68554-1-xiangxia.m.yue@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] udp: allow changing mapping of a socket to queue | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers fail 4 maintainers not CCed: yoshfuji@linux-ipv6.org dsahern@kernel.org davem@davemloft.net kuba@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 14 this patch: 14
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 14 this patch: 14
netdev/header_inline success Link

Commit Message

Tonghao Zhang June 27, 2021, 7:57 a.m. UTC
There are many containers running on host. These containers
share the host resources(e.g. netdev rx/tx queue). For isolating
tx/rx queue, when the process migrated to other cpu, we hope
this process will use tx/rx queue mapped to this cpu.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 net/ipv4/udp.c         | 2 ++
 net/ipv4/udp_offload.c | 4 ++++
 2 files changed, 6 insertions(+)

Comments

Jakub Kicinski June 28, 2021, 6:38 p.m. UTC | #1
On Sun, 27 Jun 2021 15:57:40 +0800 Tonghao Zhang wrote:
> There are many containers running on host. These containers
> share the host resources(e.g. netdev rx/tx queue). For isolating
> tx/rx queue, when the process migrated to other cpu, we hope
> this process will use tx/rx queue mapped to this cpu.

What's the impact? UDP packets would never get out of order within the
source system and now they will? Could you explain why that's safe?
diff mbox series

Patch

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 15f5504adf5b..72104c45e6b4 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -950,6 +950,8 @@  static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
 		uh->check = CSUM_MANGLED_0;
 
 send:
+	/* pick tx queue for this skb list. */
+	skb->ooo_okay = true;
 	err = ip_send_skb(sock_net(sk), skb);
 	if (err) {
 		if (err == -ENOBUFS && !inet->recverr) {
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 54e06b88af69..62683efca647 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -269,6 +269,7 @@  struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
 	struct udphdr *uh;
 	unsigned int mss;
 	bool copy_dtor;
+	bool ooo_okay;
 	__sum16 check;
 	__be16 newlen;
 
@@ -286,6 +287,8 @@  struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
 	if (copy_dtor)
 		gso_skb->destructor = NULL;
 
+	ooo_okay = gso_skb->ooo_okay;
+	gso_skb->ooo_okay = 0;
 	segs = skb_segment(gso_skb, features);
 	if (IS_ERR_OR_NULL(segs)) {
 		if (copy_dtor)
@@ -293,6 +296,7 @@  struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
 		return segs;
 	}
 
+	segs->ooo_okay = ooo_okay;
 	/* GSO partial and frag_list segmentation only requires splitting
 	 * the frame into an MSS multiple and possibly a remainder, both
 	 * cases return a GSO skb. So update the mss now.