All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] udp: allow changing mapping of a socket to queue
@ 2021-06-27  7:57 Tonghao Zhang
  2021-06-28 18:38 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Tonghao Zhang @ 2021-06-27  7:57 UTC (permalink / raw)
  To: netdev; +Cc: Tonghao Zhang

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(+)

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.
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] udp: allow changing mapping of a socket to queue
  2021-06-27  7:57 [PATCH net-next] udp: allow changing mapping of a socket to queue Tonghao Zhang
@ 2021-06-28 18:38 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2021-06-28 18:38 UTC (permalink / raw)
  To: Tonghao Zhang; +Cc: netdev

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-28 18:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-27  7:57 [PATCH net-next] udp: allow changing mapping of a socket to queue Tonghao Zhang
2021-06-28 18:38 ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.