diff mbox series

[net-next] tcp: make tcp_rcv_state_process() drop monitor friendly

Message ID 3eb95fd0-2046-c000-9c0b-c7c7e05ce04a@163.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tcp: make tcp_rcv_state_process() drop monitor friendly | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/cc_maintainers warning 3 maintainers not CCed: davem@davemloft.net yoshfuji@linux-ipv6.org pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 27 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jianguo Wu March 23, 2022, 1:04 p.m. UTC
From: Jianguo Wu <wujianguo@chinatelecom.cn>

In tcp_rcv_state_process(), should not call tcp_drop() for same case,
like after process ACK packet in TCP_LAST_ACK state, it should call
consume_skb() instead of tcp_drop() to be drop monitor friendly,
otherwise every last ack will be report as dropped packet by drop monitor.

Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
---
 net/ipv4/tcp_input.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Eric Dumazet March 23, 2022, 1:40 p.m. UTC | #1
On Wed, Mar 23, 2022 at 6:05 AM Jianguo Wu <wujianguo106@163.com> wrote:
>
> From: Jianguo Wu <wujianguo@chinatelecom.cn>
>
> In tcp_rcv_state_process(), should not call tcp_drop() for same case,
> like after process ACK packet in TCP_LAST_ACK state, it should call
> consume_skb() instead of tcp_drop() to be drop monitor friendly,
> otherwise every last ack will be report as dropped packet by drop monitor.
>
> Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
> ---

1) net-next is closed

2) Same remarks as for the other patch.
   You mark the packet as consumed, while maybe we had to throw away
some payload from it ?

You will have to wait for net-next being open,
then send patches with one change at a time, with clear explanations
and possibly packetdrill tests.

I am concerned about all these patches making future backports
difficult because of merge conflicts.
Jianguo Wu March 24, 2022, 2:33 a.m. UTC | #2
Hi,
    Thanks for your reply. This is more complicated than I thought, i will do some more dig.

在 2022/3/23 21:40, Eric Dumazet 写道:
> On Wed, Mar 23, 2022 at 6:05 AM Jianguo Wu <wujianguo106@163.com> wrote:
>>
>> From: Jianguo Wu <wujianguo@chinatelecom.cn>
>>
>> In tcp_rcv_state_process(), should not call tcp_drop() for same case,
>> like after process ACK packet in TCP_LAST_ACK state, it should call
>> consume_skb() instead of tcp_drop() to be drop monitor friendly,
>> otherwise every last ack will be report as dropped packet by drop monitor.
>>
>> Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
>> ---
> 
> 1) net-next is closed
> 
> 2) Same remarks as for the other patch.
>    You mark the packet as consumed, while maybe we had to throw away
> some payload from it ?
> 
> You will have to wait for net-next being open,
> then send patches with one change at a time, with clear explanations
> and possibly packetdrill tests.
> 
> I am concerned about all these patches making future backports
> difficult because of merge conflicts.
diff mbox series

Patch

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 2088f93..feb6f83 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6574,7 +6574,8 @@  int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 			inet_csk_reset_keepalive_timer(sk, tmo);
 		} else {
 			tcp_time_wait(sk, TCP_FIN_WAIT2, tmo);
-			goto discard;
+			consume_skb(skb);
+			return 0;
 		}
 		break;
 	}
@@ -6582,7 +6583,8 @@  int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 	case TCP_CLOSING:
 		if (tp->snd_una == tp->write_seq) {
 			tcp_time_wait(sk, TCP_TIME_WAIT, 0);
-			goto discard;
+			consume_skb(skb);
+			return 0;
 		}
 		break;

@@ -6590,7 +6592,8 @@  int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 		if (tp->snd_una == tp->write_seq) {
 			tcp_update_metrics(sk);
 			tcp_done(sk);
-			goto discard;
+			consume_skb(skb);
+			return 0;
 		}
 		break;
 	}