-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net: Add timeout to various send functions #86127
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could go this way if we retain stable APIs compability.
subsys/net/ip/net_core.c
Outdated
int net_send_data(struct net_pkt *pkt) | ||
{ | ||
return net_try_send_data(pkt, K_FOREVER); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert this to an inline function instead?
394ca9b
to
1246770
Compare
|
@@ -2609,7 +2609,7 @@ static int context_sendto(struct net_context *context, | |||
net_pkt_set_ll_proto_type(pkt, | |||
ntohs(ll_dst_addr->sll_protocol)); | |||
|
|||
net_if_queue_tx(net_pkt_iface(pkt), pkt); | |||
net_if_try_queue_tx(net_pkt_iface(pkt), pkt, timeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context_sendto()
has actually more places where data is passed to the lower layer (net_send_data()
calls above and below).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
1246770
to
6ea9993
Compare
Added timeouts to more send functions in |
6ea9993
to
737abd7
Compare
Fix compliance issues. |
737abd7
to
d7b8255
Compare
|
d7b8255
to
46437c4
Compare
Rebased |
46437c4
to
0c874da
Compare
Reorder declarations in header files, so they are known for static inline functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good addition to me.
0c874da
to
d209da8
Compare
|
I'd personally keep it just in case. Just realized, IPv6 ND has probably a similar scenario not handled here (NA reply for NS, in |
Will add it to the variatn without |
d209da8
to
fcda5ab
Compare
|
fcda5ab
to
dc9e004
Compare
More compliance/ci fixes |
dc9e004
to
1df789c
Compare
Rebased |
Allows to send with different timeouts to not block caller in some situations. Stable API is kept and just calls `try`-variant with a timeout of `K_FOREVER`. Signed-off-by: Cla Mattia Galliard <[email protected]>
Use the newly added timeout in various send functions from within net_context_sendto. Signed-off-by: Cla Mattia Galliard <[email protected]>
This ensures system stays operational in arp-flood situation. Signed-off-by: Cla Mattia Galliard <[email protected]>
This ensures system stays operation in lldp-flood situation. Signed-off-by: Cla Mattia Galliard <[email protected]>
This ensure system stays operational in icmp flood situation. Signed-off-by: Cla Mattia Galliard <[email protected]>
1df789c
to
5309999
Compare
Fixed silly mistake. |
This is just to discuss the idea. I can bring into better format, if we agree on approach.
Basic idea is adding timeout to various send function. To keep stable API, functions are renamed with
_try
-prefix. Original functions just call the_try
-variant with timeoutK_FOREVER
.Fixes: #85981
Timeout can be used to early drop some request for arp and icmp to avoid being slowed when in a flood situation.
Looking forward to your thoughts.