Skip to contentSkip to conversation

udp: allow changing mapping of a socket to queue

PATCH In review Tonghao Zhang 2 participants 2 messages Jun 27, 2021 – Jun 28, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udp: allow changing mapping of a socket to queue

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.

---
 net/ipv4/udp.c         | 2 ++
 net/ipv4/udp_offload.c | 4 ++++
 2 files changed, 6 insertions(+)
net/ipv4/udp.c +2 -0
index 15f5504adf5b..72104c45e6b4 100644
@@ -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) {
net/ipv4/udp_offload.c +4 -0
index 54e06b88af69..62683efca647 100644
@@ -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.
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 4 lines · 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?