Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d97379a authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

tcp: move sk_mark_napi_id() at the right place



sk_mark_napi_id() is used to record for a flow napi id of incoming
packets for busypoll sake.
We should do this only on established flows, not on listeners.

This was 'working' by virtue of the socket cloning, but doing
this on SYN packets in unecessary cache line dirtying.

Even if we move sk_napi_id in the same cache line than sk_lock,
we are working to make SYN processing lockless, so it is desirable
to set sk_napi_id only for established flows.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2e1af7d7
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1429,6 +1429,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
		struct dst_entry *dst = sk->sk_rx_dst;
		struct dst_entry *dst = sk->sk_rx_dst;


		sock_rps_save_rxhash(sk, skb);
		sock_rps_save_rxhash(sk, skb);
		sk_mark_napi_id(sk, skb);
		if (dst) {
		if (dst) {
			if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif ||
			if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif ||
			    dst->ops->check(dst, 0) == NULL) {
			    dst->ops->check(dst, 0) == NULL) {
@@ -1450,6 +1451,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)


		if (nsk != sk) {
		if (nsk != sk) {
			sock_rps_save_rxhash(nsk, skb);
			sock_rps_save_rxhash(nsk, skb);
			sk_mark_napi_id(sk, skb);
			if (tcp_child_process(sk, nsk, skb)) {
			if (tcp_child_process(sk, nsk, skb)) {
				rsk = nsk;
				rsk = nsk;
				goto reset;
				goto reset;
@@ -1661,7 +1663,6 @@ int tcp_v4_rcv(struct sk_buff *skb)
	if (sk_filter(sk, skb))
	if (sk_filter(sk, skb))
		goto discard_and_relse;
		goto discard_and_relse;


	sk_mark_napi_id(sk, skb);
	skb->dev = NULL;
	skb->dev = NULL;


	bh_lock_sock_nested(sk);
	bh_lock_sock_nested(sk);
+2 −1
Original line number Original line Diff line number Diff line
@@ -1293,6 +1293,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
		struct dst_entry *dst = sk->sk_rx_dst;
		struct dst_entry *dst = sk->sk_rx_dst;


		sock_rps_save_rxhash(sk, skb);
		sock_rps_save_rxhash(sk, skb);
		sk_mark_napi_id(sk, skb);
		if (dst) {
		if (dst) {
			if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif ||
			if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif ||
			    dst->ops->check(dst, np->rx_dst_cookie) == NULL) {
			    dst->ops->check(dst, np->rx_dst_cookie) == NULL) {
@@ -1322,6 +1323,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
		 */
		 */
		if (nsk != sk) {
		if (nsk != sk) {
			sock_rps_save_rxhash(nsk, skb);
			sock_rps_save_rxhash(nsk, skb);
			sk_mark_napi_id(sk, skb);
			if (tcp_child_process(sk, nsk, skb))
			if (tcp_child_process(sk, nsk, skb))
				goto reset;
				goto reset;
			if (opt_skb)
			if (opt_skb)
@@ -1454,7 +1456,6 @@ static int tcp_v6_rcv(struct sk_buff *skb)
	if (sk_filter(sk, skb))
	if (sk_filter(sk, skb))
		goto discard_and_relse;
		goto discard_and_relse;


	sk_mark_napi_id(sk, skb);
	skb->dev = NULL;
	skb->dev = NULL;


	bh_lock_sock_nested(sk);
	bh_lock_sock_nested(sk);