Netdev List
 help / color / mirror / Atom feed
* [PATCH v3 net-next 1/7] tcp: do not assume TCP code is non preemptible
From: Eric Dumazet @ 2016-04-29 21:16 UTC (permalink / raw)
  To: David S . Miller
  Cc: netdev, Eric Dumazet, Soheil Hassas Yeganeh, Alexei Starovoitov,
	Marcelo Ricardo Leitner, Eric Dumazet
In-Reply-To: <1461964613-4872-1-git-send-email-edumazet@google.com>

We want to to make TCP stack preemptible, as draining prequeue
and backlog queues can take lot of time.

Many SNMP updates were assuming that BH (and preemption) was disabled.

Need to convert some __NET_INC_STATS() calls to NET_INC_STATS()
and some __TCP_INC_STATS() to TCP_INC_STATS()

Before using this_cpu_ptr(net->ipv4.tcp_sk) in tcp_v4_send_reset()
and tcp_v4_send_ack(), we add an explicit preempt disabled section.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
---
 net/ipv4/tcp.c           |  2 +-
 net/ipv4/tcp_cdg.c       | 20 +++++-----
 net/ipv4/tcp_cubic.c     | 20 +++++-----
 net/ipv4/tcp_fastopen.c  | 12 +++---
 net/ipv4/tcp_input.c     | 96 ++++++++++++++++++++++++------------------------
 net/ipv4/tcp_ipv4.c      | 14 ++++---
 net/ipv4/tcp_minisocks.c |  2 +-
 net/ipv4/tcp_output.c    | 11 +++---
 net/ipv4/tcp_recovery.c  |  4 +-
 net/ipv4/tcp_timer.c     | 10 +++--
 net/ipv6/tcp_ipv6.c      | 12 +++---
 11 files changed, 104 insertions(+), 99 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index cb4d1cabb42c..b24c6ed4a04f 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3095,7 +3095,7 @@ void tcp_done(struct sock *sk)
 	struct request_sock *req = tcp_sk(sk)->fastopen_rsk;
 
 	if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
-		__TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);
+		TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);
 
 	tcp_set_state(sk, TCP_CLOSE);
 	tcp_clear_xmit_timers(sk);
diff --git a/net/ipv4/tcp_cdg.c b/net/ipv4/tcp_cdg.c
index 3c00208c37f4..ccce8a55f1e1 100644
--- a/net/ipv4/tcp_cdg.c
+++ b/net/ipv4/tcp_cdg.c
@@ -155,11 +155,11 @@ static void tcp_cdg_hystart_update(struct sock *sk)
 
 			ca->last_ack = now_us;
 			if (after(now_us, ca->round_start + base_owd)) {
-				__NET_INC_STATS(sock_net(sk),
-						LINUX_MIB_TCPHYSTARTTRAINDETECT);
-				__NET_ADD_STATS(sock_net(sk),
-						LINUX_MIB_TCPHYSTARTTRAINCWND,
-						tp->snd_cwnd);
+				NET_INC_STATS(sock_net(sk),
+					      LINUX_MIB_TCPHYSTARTTRAINDETECT);
+				NET_ADD_STATS(sock_net(sk),
+					      LINUX_MIB_TCPHYSTARTTRAINCWND,
+					      tp->snd_cwnd);
 				tp->snd_ssthresh = tp->snd_cwnd;
 				return;
 			}
@@ -174,11 +174,11 @@ static void tcp_cdg_hystart_update(struct sock *sk)
 					 125U);
 
 			if (ca->rtt.min > thresh) {
-				__NET_INC_STATS(sock_net(sk),
-						LINUX_MIB_TCPHYSTARTDELAYDETECT);
-				__NET_ADD_STATS(sock_net(sk),
-						LINUX_MIB_TCPHYSTARTDELAYCWND,
-						tp->snd_cwnd);
+				NET_INC_STATS(sock_net(sk),
+					      LINUX_MIB_TCPHYSTARTDELAYDETECT);
+				NET_ADD_STATS(sock_net(sk),
+					      LINUX_MIB_TCPHYSTARTDELAYCWND,
+					      tp->snd_cwnd);
 				tp->snd_ssthresh = tp->snd_cwnd;
 			}
 		}
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
index 59155af9de5d..0ce946e395e1 100644
--- a/net/ipv4/tcp_cubic.c
+++ b/net/ipv4/tcp_cubic.c
@@ -402,11 +402,11 @@ static void hystart_update(struct sock *sk, u32 delay)
 			ca->last_ack = now;
 			if ((s32)(now - ca->round_start) > ca->delay_min >> 4) {
 				ca->found |= HYSTART_ACK_TRAIN;
-				__NET_INC_STATS(sock_net(sk),
-						LINUX_MIB_TCPHYSTARTTRAINDETECT);
-				__NET_ADD_STATS(sock_net(sk),
-						LINUX_MIB_TCPHYSTARTTRAINCWND,
-						tp->snd_cwnd);
+				NET_INC_STATS(sock_net(sk),
+					      LINUX_MIB_TCPHYSTARTTRAINDETECT);
+				NET_ADD_STATS(sock_net(sk),
+					      LINUX_MIB_TCPHYSTARTTRAINCWND,
+					      tp->snd_cwnd);
 				tp->snd_ssthresh = tp->snd_cwnd;
 			}
 		}
@@ -423,11 +423,11 @@ static void hystart_update(struct sock *sk, u32 delay)
 			if (ca->curr_rtt > ca->delay_min +
 			    HYSTART_DELAY_THRESH(ca->delay_min >> 3)) {
 				ca->found |= HYSTART_DELAY;
-				__NET_INC_STATS(sock_net(sk),
-						LINUX_MIB_TCPHYSTARTDELAYDETECT);
-				__NET_ADD_STATS(sock_net(sk),
-						LINUX_MIB_TCPHYSTARTDELAYCWND,
-						tp->snd_cwnd);
+				NET_INC_STATS(sock_net(sk),
+					      LINUX_MIB_TCPHYSTARTDELAYDETECT);
+				NET_ADD_STATS(sock_net(sk),
+					      LINUX_MIB_TCPHYSTARTDELAYCWND,
+					      tp->snd_cwnd);
 				tp->snd_ssthresh = tp->snd_cwnd;
 			}
 		}
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index a1498d507e42..54d9f9b0120f 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -255,9 +255,9 @@ static bool tcp_fastopen_queue_check(struct sock *sk)
 		spin_lock(&fastopenq->lock);
 		req1 = fastopenq->rskq_rst_head;
 		if (!req1 || time_after(req1->rsk_timer.expires, jiffies)) {
-			spin_unlock(&fastopenq->lock);
 			__NET_INC_STATS(sock_net(sk),
 					LINUX_MIB_TCPFASTOPENLISTENOVERFLOW);
+			spin_unlock(&fastopenq->lock);
 			return false;
 		}
 		fastopenq->rskq_rst_head = req1->dl_next;
@@ -282,7 +282,7 @@ struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
 	struct sock *child;
 
 	if (foc->len == 0) /* Client requests a cookie */
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENCOOKIEREQD);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENCOOKIEREQD);
 
 	if (!((sysctl_tcp_fastopen & TFO_SERVER_ENABLE) &&
 	      (syn_data || foc->len >= 0) &&
@@ -311,13 +311,13 @@ fastopen:
 		child = tcp_fastopen_create_child(sk, skb, dst, req);
 		if (child) {
 			foc->len = -1;
-			__NET_INC_STATS(sock_net(sk),
-					LINUX_MIB_TCPFASTOPENPASSIVE);
+			NET_INC_STATS(sock_net(sk),
+				      LINUX_MIB_TCPFASTOPENPASSIVE);
 			return child;
 		}
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENPASSIVEFAIL);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENPASSIVEFAIL);
 	} else if (foc->len > 0) /* Client presents an invalid cookie */
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENPASSIVEFAIL);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENPASSIVEFAIL);
 
 	valid_foc.exp = foc->exp;
 	*foc = valid_foc;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 1fb19c91e091..ac85fb42a5a2 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -869,7 +869,7 @@ static void tcp_update_reordering(struct sock *sk, const int metric,
 		else
 			mib_idx = LINUX_MIB_TCPSACKREORDER;
 
-		__NET_INC_STATS(sock_net(sk), mib_idx);
+		NET_INC_STATS(sock_net(sk), mib_idx);
 #if FASTRETRANS_DEBUG > 1
 		pr_debug("Disorder%d %d %u f%u s%u rr%d\n",
 			 tp->rx_opt.sack_ok, inet_csk(sk)->icsk_ca_state,
@@ -1062,7 +1062,7 @@ static bool tcp_check_dsack(struct sock *sk, const struct sk_buff *ack_skb,
 	if (before(start_seq_0, TCP_SKB_CB(ack_skb)->ack_seq)) {
 		dup_sack = true;
 		tcp_dsack_seen(tp);
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPDSACKRECV);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPDSACKRECV);
 	} else if (num_sacks > 1) {
 		u32 end_seq_1 = get_unaligned_be32(&sp[1].end_seq);
 		u32 start_seq_1 = get_unaligned_be32(&sp[1].start_seq);
@@ -1071,7 +1071,7 @@ static bool tcp_check_dsack(struct sock *sk, const struct sk_buff *ack_skb,
 		    !before(start_seq_0, start_seq_1)) {
 			dup_sack = true;
 			tcp_dsack_seen(tp);
-			__NET_INC_STATS(sock_net(sk),
+			NET_INC_STATS(sock_net(sk),
 					LINUX_MIB_TCPDSACKOFORECV);
 		}
 	}
@@ -1289,7 +1289,7 @@ static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
 
 	if (skb->len > 0) {
 		BUG_ON(!tcp_skb_pcount(skb));
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_SACKSHIFTED);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_SACKSHIFTED);
 		return false;
 	}
 
@@ -1314,7 +1314,7 @@ static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
 	tcp_unlink_write_queue(skb, sk);
 	sk_wmem_free_skb(sk, skb);
 
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_SACKMERGED);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_SACKMERGED);
 
 	return true;
 }
@@ -1473,7 +1473,7 @@ noop:
 	return skb;
 
 fallback:
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_SACKSHIFTFALLBACK);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_SACKSHIFTFALLBACK);
 	return NULL;
 }
 
@@ -1661,7 +1661,7 @@ tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb,
 				mib_idx = LINUX_MIB_TCPSACKDISCARD;
 			}
 
-			__NET_INC_STATS(sock_net(sk), mib_idx);
+			NET_INC_STATS(sock_net(sk), mib_idx);
 			if (i == 0)
 				first_sack_index = -1;
 			continue;
@@ -1913,7 +1913,7 @@ void tcp_enter_loss(struct sock *sk)
 	skb = tcp_write_queue_head(sk);
 	is_reneg = skb && (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED);
 	if (is_reneg) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSACKRENEGING);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSACKRENEGING);
 		tp->sacked_out = 0;
 		tp->fackets_out = 0;
 	}
@@ -2399,7 +2399,7 @@ static bool tcp_try_undo_recovery(struct sock *sk)
 		else
 			mib_idx = LINUX_MIB_TCPFULLUNDO;
 
-		__NET_INC_STATS(sock_net(sk), mib_idx);
+		NET_INC_STATS(sock_net(sk), mib_idx);
 	}
 	if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) {
 		/* Hold old state until something *above* high_seq
@@ -2421,7 +2421,7 @@ static bool tcp_try_undo_dsack(struct sock *sk)
 	if (tp->undo_marker && !tp->undo_retrans) {
 		DBGUNDO(sk, "D-SACK");
 		tcp_undo_cwnd_reduction(sk, false);
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPDSACKUNDO);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPDSACKUNDO);
 		return true;
 	}
 	return false;
@@ -2436,9 +2436,9 @@ static bool tcp_try_undo_loss(struct sock *sk, bool frto_undo)
 		tcp_undo_cwnd_reduction(sk, true);
 
 		DBGUNDO(sk, "partial loss");
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSUNDO);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSUNDO);
 		if (frto_undo)
-			__NET_INC_STATS(sock_net(sk),
+			NET_INC_STATS(sock_net(sk),
 					LINUX_MIB_TCPSPURIOUSRTOS);
 		inet_csk(sk)->icsk_retransmits = 0;
 		if (frto_undo || tcp_is_sack(tp))
@@ -2563,7 +2563,7 @@ static void tcp_mtup_probe_failed(struct sock *sk)
 
 	icsk->icsk_mtup.search_high = icsk->icsk_mtup.probe_size - 1;
 	icsk->icsk_mtup.probe_size = 0;
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMTUPFAIL);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMTUPFAIL);
 }
 
 static void tcp_mtup_probe_success(struct sock *sk)
@@ -2583,7 +2583,7 @@ static void tcp_mtup_probe_success(struct sock *sk)
 	icsk->icsk_mtup.search_low = icsk->icsk_mtup.probe_size;
 	icsk->icsk_mtup.probe_size = 0;
 	tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMTUPSUCCESS);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMTUPSUCCESS);
 }
 
 /* Do a simple retransmit without using the backoff mechanisms in
@@ -2647,7 +2647,7 @@ static void tcp_enter_recovery(struct sock *sk, bool ece_ack)
 	else
 		mib_idx = LINUX_MIB_TCPSACKRECOVERY;
 
-	__NET_INC_STATS(sock_net(sk), mib_idx);
+	NET_INC_STATS(sock_net(sk), mib_idx);
 
 	tp->prior_ssthresh = 0;
 	tcp_init_undo(tp);
@@ -2740,7 +2740,7 @@ static bool tcp_try_undo_partial(struct sock *sk, const int acked)
 
 		DBGUNDO(sk, "partial recovery");
 		tcp_undo_cwnd_reduction(sk, true);
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPPARTIALUNDO);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPPARTIALUNDO);
 		tcp_try_keep_open(sk);
 		return true;
 	}
@@ -3434,7 +3434,7 @@ bool tcp_oow_rate_limited(struct net *net, const struct sk_buff *skb,
 		s32 elapsed = (s32)(tcp_time_stamp - *last_oow_ack_time);
 
 		if (0 <= elapsed && elapsed < sysctl_tcp_invalid_ratelimit) {
-			__NET_INC_STATS(net, mib_idx);
+			NET_INC_STATS(net, mib_idx);
 			return true;	/* rate-limited: don't send yet! */
 		}
 	}
@@ -3467,7 +3467,7 @@ static void tcp_send_challenge_ack(struct sock *sk, const struct sk_buff *skb)
 		challenge_count = 0;
 	}
 	if (++challenge_count <= sysctl_tcp_challenge_ack_limit) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPCHALLENGEACK);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPCHALLENGEACK);
 		tcp_send_ack(sk);
 	}
 }
@@ -3516,7 +3516,7 @@ static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)
 		tcp_set_ca_state(sk, TCP_CA_CWR);
 		tcp_end_cwnd_reduction(sk);
 		tcp_try_keep_open(sk);
-		__NET_INC_STATS(sock_net(sk),
+		NET_INC_STATS(sock_net(sk),
 				LINUX_MIB_TCPLOSSPROBERECOVERY);
 	} else if (!(flag & (FLAG_SND_UNA_ADVANCED |
 			     FLAG_NOT_DUP | FLAG_DATA_SACKED))) {
@@ -3621,14 +3621,14 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
 
 		tcp_in_ack_event(sk, CA_ACK_WIN_UPDATE);
 
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPACKS);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPACKS);
 	} else {
 		u32 ack_ev_flags = CA_ACK_SLOWPATH;
 
 		if (ack_seq != TCP_SKB_CB(skb)->end_seq)
 			flag |= FLAG_DATA;
 		else
-			__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPPUREACKS);
+			NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPPUREACKS);
 
 		flag |= tcp_ack_update_window(sk, skb, ack, ack_seq);
 
@@ -4131,7 +4131,7 @@ static void tcp_dsack_set(struct sock *sk, u32 seq, u32 end_seq)
 		else
 			mib_idx = LINUX_MIB_TCPDSACKOFOSENT;
 
-		__NET_INC_STATS(sock_net(sk), mib_idx);
+		NET_INC_STATS(sock_net(sk), mib_idx);
 
 		tp->rx_opt.dsack = 1;
 		tp->duplicate_sack[0].start_seq = seq;
@@ -4155,7 +4155,7 @@ static void tcp_send_dupack(struct sock *sk, const struct sk_buff *skb)
 
 	if (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&
 	    before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST);
 		tcp_enter_quickack_mode(sk);
 
 		if (tcp_is_sack(tp) && sysctl_tcp_dsack) {
@@ -4305,7 +4305,7 @@ static bool tcp_try_coalesce(struct sock *sk,
 
 	atomic_add(delta, &sk->sk_rmem_alloc);
 	sk_mem_charge(sk, delta);
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVCOALESCE);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVCOALESCE);
 	TCP_SKB_CB(to)->end_seq = TCP_SKB_CB(from)->end_seq;
 	TCP_SKB_CB(to)->ack_seq = TCP_SKB_CB(from)->ack_seq;
 	TCP_SKB_CB(to)->tcp_flags |= TCP_SKB_CB(from)->tcp_flags;
@@ -4393,7 +4393,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
 	tcp_ecn_check_ce(tp, skb);
 
 	if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);
 		tcp_drop(sk, skb);
 		return;
 	}
@@ -4402,7 +4402,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
 	tp->pred_flags = 0;
 	inet_csk_schedule_ack(sk);
 
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOQUEUE);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOQUEUE);
 	SOCK_DEBUG(sk, "out of order segment: rcv_next %X seq %X - %X\n",
 		   tp->rcv_nxt, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
 
@@ -4457,7 +4457,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
 	if (skb1 && before(seq, TCP_SKB_CB(skb1)->end_seq)) {
 		if (!after(end_seq, TCP_SKB_CB(skb1)->end_seq)) {
 			/* All the bits are present. Drop. */
-			__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE);
+			NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE);
 			tcp_drop(sk, skb);
 			skb = NULL;
 			tcp_dsack_set(sk, seq, end_seq);
@@ -4496,7 +4496,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
 		__skb_unlink(skb1, &tp->out_of_order_queue);
 		tcp_dsack_extend(sk, TCP_SKB_CB(skb1)->seq,
 				 TCP_SKB_CB(skb1)->end_seq);
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE);
 		tcp_drop(sk, skb1);
 	}
 
@@ -4661,7 +4661,7 @@ queue_and_out:
 
 	if (!after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt)) {
 		/* A retransmit, 2nd most common case.  Force an immediate ack. */
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST);
 		tcp_dsack_set(sk, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
 
 out_of_window:
@@ -4707,7 +4707,7 @@ static struct sk_buff *tcp_collapse_one(struct sock *sk, struct sk_buff *skb,
 
 	__skb_unlink(skb, list);
 	__kfree_skb(skb);
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVCOLLAPSED);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVCOLLAPSED);
 
 	return next;
 }
@@ -4866,7 +4866,7 @@ static bool tcp_prune_ofo_queue(struct sock *sk)
 	bool res = false;
 
 	if (!skb_queue_empty(&tp->out_of_order_queue)) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_OFOPRUNED);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_OFOPRUNED);
 		__skb_queue_purge(&tp->out_of_order_queue);
 
 		/* Reset SACK state.  A conforming SACK implementation will
@@ -4895,7 +4895,7 @@ static int tcp_prune_queue(struct sock *sk)
 
 	SOCK_DEBUG(sk, "prune_queue: c=%x\n", tp->copied_seq);
 
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_PRUNECALLED);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_PRUNECALLED);
 
 	if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)
 		tcp_clamp_window(sk);
@@ -4925,7 +4925,7 @@ static int tcp_prune_queue(struct sock *sk)
 	 * drop receive data on the floor.  It will get retransmitted
 	 * and hopefully then we'll have sufficient space.
 	 */
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_RCVPRUNED);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_RCVPRUNED);
 
 	/* Massive buffer overcommit. */
 	tp->pred_flags = 0;
@@ -5184,7 +5184,7 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
 	if (tcp_fast_parse_options(skb, th, tp) && tp->rx_opt.saw_tstamp &&
 	    tcp_paws_discard(sk, skb)) {
 		if (!th->rst) {
-			__NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
+			NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
 			if (!tcp_oow_rate_limited(sock_net(sk), skb,
 						  LINUX_MIB_TCPACKSKIPPEDPAWS,
 						  &tp->last_oow_ack_time))
@@ -5236,8 +5236,8 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
 	if (th->syn) {
 syn_challenge:
 		if (syn_inerr)
-			__TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNCHALLENGE);
+			TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNCHALLENGE);
 		tcp_send_challenge_ack(sk, skb);
 		goto discard;
 	}
@@ -5352,7 +5352,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
 				tcp_data_snd_check(sk);
 				return;
 			} else { /* Header too small */
-				__TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
+				TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
 				goto discard;
 			}
 		} else {
@@ -5380,7 +5380,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
 
 					__skb_pull(skb, tcp_header_len);
 					tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq);
-					__NET_INC_STATS(sock_net(sk),
+					NET_INC_STATS(sock_net(sk),
 							LINUX_MIB_TCPHPHITSTOUSER);
 					eaten = 1;
 				}
@@ -5403,7 +5403,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
 
 				tcp_rcv_rtt_measure_ts(sk, skb);
 
-				__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPHITS);
+				NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPHITS);
 
 				/* Bulk data transfer: receiver */
 				eaten = tcp_queue_rcv(sk, skb, tcp_header_len,
@@ -5460,8 +5460,8 @@ step5:
 	return;
 
 csum_error:
-	__TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
-	__TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
+	TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
+	TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
 
 discard:
 	tcp_drop(sk, skb);
@@ -5553,13 +5553,13 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack,
 				break;
 		}
 		tcp_rearm_rto(sk);
-		__NET_INC_STATS(sock_net(sk),
+		NET_INC_STATS(sock_net(sk),
 				LINUX_MIB_TCPFASTOPENACTIVEFAIL);
 		return true;
 	}
 	tp->syn_data_acked = tp->syn_data;
 	if (tp->syn_data_acked)
-		__NET_INC_STATS(sock_net(sk),
+		NET_INC_STATS(sock_net(sk),
 				LINUX_MIB_TCPFASTOPENACTIVE);
 
 	tcp_fastopen_add_skb(sk, synack);
@@ -5595,7 +5595,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
 		if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr &&
 		    !between(tp->rx_opt.rcv_tsecr, tp->retrans_stamp,
 			     tcp_time_stamp)) {
-			__NET_INC_STATS(sock_net(sk),
+			NET_INC_STATS(sock_net(sk),
 					LINUX_MIB_PAWSACTIVEREJECTED);
 			goto reset_and_undo;
 		}
@@ -5965,7 +5965,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 		    (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&
 		     after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt))) {
 			tcp_done(sk);
-			__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONDATA);
+			NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONDATA);
 			return 1;
 		}
 
@@ -6022,7 +6022,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 		if (sk->sk_shutdown & RCV_SHUTDOWN) {
 			if (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&
 			    after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt)) {
-				__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONDATA);
+				NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONDATA);
 				tcp_reset(sk);
 				return 1;
 			}
@@ -6224,7 +6224,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
 	 * timeout.
 	 */
 	if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
 		goto drop;
 	}
 
@@ -6271,7 +6271,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
 			if (dst && strict &&
 			    !tcp_peer_is_proven(req, dst, true,
 						tmp_opt.saw_tstamp)) {
-				__NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSPASSIVEREJECTED);
+				NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSPASSIVEREJECTED);
 				goto drop_and_release;
 			}
 		}
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 87b173b563b0..761bc492c5e3 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -692,6 +692,7 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
 		     offsetof(struct inet_timewait_sock, tw_bound_dev_if));
 
 	arg.tos = ip_hdr(skb)->tos;
+	preempt_disable();
 	ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
 			      skb, &TCP_SKB_CB(skb)->header.h4.opt,
 			      ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
@@ -699,6 +700,7 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
 
 	__TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
 	__TCP_INC_STATS(net, TCP_MIB_OUTRSTS);
+	preempt_enable();
 
 #ifdef CONFIG_TCP_MD5SIG
 out:
@@ -774,12 +776,14 @@ static void tcp_v4_send_ack(struct net *net,
 	if (oif)
 		arg.bound_dev_if = oif;
 	arg.tos = tos;
+	preempt_disable();
 	ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
 			      skb, &TCP_SKB_CB(skb)->header.h4.opt,
 			      ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
 			      &arg, arg.iov[0].iov_len);
 
 	__TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
+	preempt_enable();
 }
 
 static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)
@@ -1151,12 +1155,12 @@ static bool tcp_v4_inbound_md5_hash(const struct sock *sk,
 		return false;
 
 	if (hash_expected && !hash_location) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
 		return true;
 	}
 
 	if (!hash_expected && hash_location) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
 		return true;
 	}
 
@@ -1342,7 +1346,7 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
 	return newsk;
 
 exit_overflow:
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
 exit_nonewsk:
 	dst_release(dst);
 exit:
@@ -1432,8 +1436,8 @@ discard:
 	return 0;
 
 csum_err:
-	__TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
-	__TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
+	TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
+	TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
 	goto discard;
 }
 EXPORT_SYMBOL(tcp_v4_do_rcv);
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index ffbfecdae471..4b95ec4ed2c8 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -337,7 +337,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
 		 * socket up.  We've got bigger problems than
 		 * non-graceful socket closings.
 		 */
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPTIMEWAITOVERFLOW);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPTIMEWAITOVERFLOW);
 	}
 
 	tcp_update_metrics(sk);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 1a487ff95d4c..25d527922b18 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2221,14 +2221,13 @@ bool tcp_schedule_loss_probe(struct sock *sk)
 /* Thanks to skb fast clones, we can detect if a prior transmit of
  * a packet is still in a qdisc or driver queue.
  * In this case, there is very little point doing a retransmit !
- * Note: This is called from BH context only.
  */
 static bool skb_still_in_host_queue(const struct sock *sk,
 				    const struct sk_buff *skb)
 {
 	if (unlikely(skb_fclone_busy(sk, skb))) {
-		__NET_INC_STATS(sock_net(sk),
-				LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES);
+		NET_INC_STATS(sock_net(sk),
+			      LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES);
 		return true;
 	}
 	return false;
@@ -2290,7 +2289,7 @@ void tcp_send_loss_probe(struct sock *sk)
 	tp->tlp_high_seq = tp->snd_nxt;
 
 probe_sent:
-	__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSPROBES);
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSPROBES);
 	/* Reset s.t. tcp_rearm_rto will restart timer from now */
 	inet_csk(sk)->icsk_pending = 0;
 rearm_timer:
@@ -2699,7 +2698,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
 			tp->retrans_stamp = tcp_skb_timestamp(skb);
 
 	} else if (err != -EBUSY) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL);
 	}
 
 	if (tp->undo_retrans < 0)
@@ -2823,7 +2822,7 @@ begin_fwd:
 		if (tcp_retransmit_skb(sk, skb, segs))
 			return;
 
-		__NET_INC_STATS(sock_net(sk), mib_idx);
+		NET_INC_STATS(sock_net(sk), mib_idx);
 
 		if (tcp_in_cwnd_reduction(sk))
 			tp->prr_out += tcp_skb_pcount(skb);
diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c
index e0d0afaf15be..e36df4fcfeba 100644
--- a/net/ipv4/tcp_recovery.c
+++ b/net/ipv4/tcp_recovery.c
@@ -65,8 +65,8 @@ int tcp_rack_mark_lost(struct sock *sk)
 			if (scb->sacked & TCPCB_SACKED_RETRANS) {
 				scb->sacked &= ~TCPCB_SACKED_RETRANS;
 				tp->retrans_out -= tcp_skb_pcount(skb);
-				__NET_INC_STATS(sock_net(sk),
-						LINUX_MIB_TCPLOSTRETRANSMIT);
+				NET_INC_STATS(sock_net(sk),
+					      LINUX_MIB_TCPLOSTRETRANSMIT);
 			}
 		} else if (!(scb->sacked & TCPCB_RETRANS)) {
 			/* Original data are sent sequentially so stop early
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 35f643d8ffbb..debdd8b33e69 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -162,8 +162,8 @@ static int tcp_write_timeout(struct sock *sk)
 			if (tp->syn_fastopen || tp->syn_data)
 				tcp_fastopen_cache_set(sk, 0, NULL, true, 0);
 			if (tp->syn_data && icsk->icsk_retransmits == 1)
-				__NET_INC_STATS(sock_net(sk),
-						LINUX_MIB_TCPFASTOPENACTIVEFAIL);
+				NET_INC_STATS(sock_net(sk),
+					      LINUX_MIB_TCPFASTOPENACTIVEFAIL);
 		}
 		retry_until = icsk->icsk_syn_retries ? : net->ipv4.sysctl_tcp_syn_retries;
 		syn_set = true;
@@ -178,8 +178,8 @@ static int tcp_write_timeout(struct sock *sk)
 			    tp->bytes_acked <= tp->rx_opt.mss_clamp) {
 				tcp_fastopen_cache_set(sk, 0, NULL, true, 0);
 				if (icsk->icsk_retransmits == net->ipv4.sysctl_tcp_retries1)
-					__NET_INC_STATS(sock_net(sk),
-							LINUX_MIB_TCPFASTOPENACTIVEFAIL);
+					NET_INC_STATS(sock_net(sk),
+						      LINUX_MIB_TCPFASTOPENACTIVEFAIL);
 			}
 			/* Black hole detection */
 			tcp_mtu_probing(icsk, sk);
@@ -209,6 +209,7 @@ static int tcp_write_timeout(struct sock *sk)
 	return 0;
 }
 
+/* Called with BH disabled */
 void tcp_delack_timer_handler(struct sock *sk)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
@@ -493,6 +494,7 @@ out_reset_timer:
 out:;
 }
 
+/* Called with BH disabled */
 void tcp_write_timer_handler(struct sock *sk)
 {
 	struct inet_connection_sock *icsk = inet_csk(sk);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 52914714b923..7bdc9c9c231b 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -649,12 +649,12 @@ static bool tcp_v6_inbound_md5_hash(const struct sock *sk,
 		return false;
 
 	if (hash_expected && !hash_location) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
 		return true;
 	}
 
 	if (!hash_expected && hash_location) {
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
 		return true;
 	}
 
@@ -825,9 +825,9 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
 	if (!IS_ERR(dst)) {
 		skb_dst_set(buff, dst);
 		ip6_xmit(ctl_sk, buff, &fl6, NULL, tclass);
-		__TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
+		TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
 		if (rst)
-			__TCP_INC_STATS(net, TCP_MIB_OUTRSTS);
+			TCP_INC_STATS(net, TCP_MIB_OUTRSTS);
 		return;
 	}
 
@@ -1276,8 +1276,8 @@ discard:
 	kfree_skb(skb);
 	return 0;
 csum_err:
-	__TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
-	__TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
+	TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
+	TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
 	goto discard;
 
 
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* Re: [PATCH net-next V1 00/11] Mellanox 100G extending mlx5 ethtool support
From: Saeed Mahameed @ 2016-04-29 21:14 UTC (permalink / raw)
  To: David Miller
  Cc: Saeed Mahameed, Linux Netdev List, Or Gerlitz, Tal Alon,
	Eran Ben Elisha
In-Reply-To: <20160429.163446.928550855039136205.davem@davemloft.net>

On Fri, Apr 29, 2016 at 11:34 PM, David Miller <davem@davemloft.net> wrote:
> From: Saeed Mahameed <saeedm@dev.mellanox.co.il>
> Date: Fri, 29 Apr 2016 23:27:06 +0300
>
>> but my concerns is when features A and B requires firmware commands A then B
>> and firmware command B fails, there is no gurantee that roll back for
>> firmware command A will work.
>>
>> this is why in case of B fails we keep the state (new A and prev B)
>> rather than try to go back to (prev A and prev B).
>
> That's a limitation of your firmware I would say.
>
> Users do not expect the semantics you will be providing, if "change A and B"
> fails both states must not be changed.
>
> This is an unwavering requirement, you must do everything you can to
> meet that expection.
>
> You cannot say "our firmware does this so, you might get partial
> updates."  That simply is not acceptable.

Got it, we'll revisit this area of code and make meet the requirement.

Thank you Dave.

^ permalink raw reply

* Re: [PATCH v2 net-next 0/7] net: make TCP preemptible
From: Eric Dumazet @ 2016-04-29 20:53 UTC (permalink / raw)
  To: David Miller; +Cc: edumazet, netdev, soheil, ast, marcelo.leitner
In-Reply-To: <20160429.163958.6363647244164609.davem@davemloft.net>

On Fri, 2016-04-29 at 16:39 -0400, David Miller wrote:
> From: Eric Dumazet <edumazet@google.com>
> Date: Thu, 28 Apr 2016 20:10:42 -0700
> 
> > Most of TCP stack assumed it was running from BH handler.
> 
> Assuming you are respinning this to fix that stats bumping typo.
> 
> You should really look into how that got corrupted. :)
> 

I had corruptions issues and a dying HDD one month ago.

I have a brand new HDD, but maybe the SSD I use for my git trees is
dying as well :(

But I've seen this strange patterns in the past, it might be the old
text editor I am using.

I filed a bug for it, it might be the time to compile it on 64bit ;)

$ m -V
	6.30 [18 Mai 2000]
	Compile par GNUC version 2.95.2 19991024 (release) Date May 18 2000
Heure 23:48:40
Usage:      m [-VR] [-c fic] [+ligne] [file1 file2 ...]


I don't remember I edited this file after the git format-patch,
but then it is Friday afternoon ;)

Thanks

^ permalink raw reply

* Re: [PATCH v2 net-next 0/7] net: make TCP preemptible
From: David Miller @ 2016-04-29 20:39 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, soheil, ast, marcelo.leitner, eric.dumazet
In-Reply-To: <1461899449-8096-1-git-send-email-edumazet@google.com>

From: Eric Dumazet <edumazet@google.com>
Date: Thu, 28 Apr 2016 20:10:42 -0700

> Most of TCP stack assumed it was running from BH handler.

Assuming you are respinning this to fix that stats bumping typo.

You should really look into how that got corrupted. :)

^ permalink raw reply

* Re: [PATCH net-next V1 00/11] Mellanox 100G extending mlx5 ethtool support
From: David Miller @ 2016-04-29 20:34 UTC (permalink / raw)
  To: saeedm; +Cc: saeedm, netdev, ogerlitz, talal, eranbe
In-Reply-To: <CALzJLG_a4s54MwCzOHMeCp0i5F5pyb-PHY_AFA-ok2JT5S62wQ@mail.gmail.com>

From: Saeed Mahameed <saeedm@dev.mellanox.co.il>
Date: Fri, 29 Apr 2016 23:27:06 +0300

> but my concerns is when features A and B requires firmware commands A then B
> and firmware command B fails, there is no gurantee that roll back for
> firmware command A will work.
> 
> this is why in case of B fails we keep the state (new A and prev B)
> rather than try to go back to (prev A and prev B).

That's a limitation of your firmware I would say.

Users do not expect the semantics you will be providing, if "change A and B"
fails both states must not be changed.

This is an unwavering requirement, you must do everything you can to
meet that expection.

You cannot say "our firmware does this so, you might get partial
updates."  That simply is not acceptable.

^ permalink raw reply

* Re: [PATCH net-next 00/12] Mellanox 100G mlx5 ethernet aRFS support
From: David Miller @ 2016-04-29 20:31 UTC (permalink / raw)
  To: saeedm; +Cc: netdev, ogerlitz, talal, eranbe
In-Reply-To: <1461883002-8912-1-git-send-email-saeedm@mellanox.com>

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Fri, 29 Apr 2016 01:36:30 +0300

> This series adds accelerated RFS support for the mlx5e driver.

Series applied, thanks Saeed.

^ permalink raw reply

* Re: [PATCH net-next V1 00/11] Mellanox 100G extending mlx5 ethtool support
From: Saeed Mahameed @ 2016-04-29 20:27 UTC (permalink / raw)
  To: David Miller
  Cc: Saeed Mahameed, Linux Netdev List, Or Gerlitz, Tal Alon,
	Eran Ben Elisha
In-Reply-To: <20160426.174150.2239494413467110.davem@davemloft.net>

On Wed, Apr 27, 2016 at 12:41 AM, David Miller <davem@davemloft.net> wrote:
> From: Saeed Mahameed <saeedm@dev.mellanox.co.il>
> Date: Tue, 26 Apr 2016 23:55:03 +0300
>
>> It will be a nightmare to rollback in such case.  What if the rollback failed ?
>
> It is absolutely essential to handle this properly.
>
> Which means you must have a prepare/commit model, wherein the prepare
> phase makes sure to pre-allocate all necessary resources, and only if
> all the prepare phase preparations succeed will the commit phase run.
>
> The commit phase cannot error, because all of the resources have been
> allocated successfully already.
>
> This way there are no issues of "rolling back" because you never
> actually move the state forward until you can guarantee that you can
> do everything.

Right, for pure software/kernel resources this is the right way to go,
Actually we already have a patch that is similar of what you described,
we are aiming to push it towards 4.8.

but my concerns is when features A and B requires firmware commands A then B
and firmware command B fails, there is no gurantee that roll back for
firmware command A will work.

this is why in case of B fails we keep the state (new A and prev B)
rather than try to go back to (prev A and prev B).

^ permalink raw reply

* Re: [PATCH v3 net-next 0/2] net: ethernet: enc28j60: small improvements
From: David Miller @ 2016-04-29 20:23 UTC (permalink / raw)
  To: mhei; +Cc: jic23, afd, broonie, netdev
In-Reply-To: <1461873975-6368-1-git-send-email-mhei@heimpold.de>

From: Michael Heimpold <mhei@heimpold.de>
Date: Thu, 28 Apr 2016 22:06:13 +0200

> This series of two patches adds the following improvements to the driver:
> 
> 1) Rework the central SPI read function so that it is compatible with
>    SPI masters which only support half duplex transfers.
> 
> 2) Add a device tree binding for the driver.
> 
> Changelog:
> 
> v3: * renamed and improved binding documentation as
>       suggested by Rob Herring
> 
> v2: * took care of Arnd Bergmann's review comments
>       - allow to specify MAC address via DT
>       - unconditionally define DT id table
>     * increased the driver version minor number
>     * driver author's email address bounces, removed from address list
> 
> v1: * Initial submission

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next v2 0/5] bridge: per-vlan stats
From: Nikolay Aleksandrov @ 2016-04-29 20:19 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, roopa, stephen, jhs
In-Reply-To: <20160429.161208.1214717753456694357.davem@davemloft.net>

On 04/29/2016 10:12 PM, David Miller wrote:
> From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> Date: Fri, 29 Apr 2016 21:49:17 +0200
> 
>> Because that is not needed for the per-vlan stats to work, I did to
>> unify the paths and simplify the pvid code but I can easily drop it
>> and revert back to using the direct pvid id.  The only fetch will be
>> the stats per-cpu pointer then. Would that be acceptable ?
> 
> It would be a step in the right direction, for sure.
> 

Okay, just one more thing I forgot to mention - please note that my code swaps
an unconditional smp_rmb() (in br_get_pvid()) for a pointer fetch, I'm not sure
the pointer fetch is slower as it's probably already in the cache if that vlan
is used.

Anyway, I will resubmit without that patch.

Thanks,
 Nik

^ permalink raw reply

* Re: [PATCH net-next] net: constify is_skb_forwardable's arguments
From: David Miller @ 2016-04-29 20:15 UTC (permalink / raw)
  To: nikolay; +Cc: netdev, roopa
In-Reply-To: <1461859168-6217-1-git-send-email-nikolay@cumulusnetworks.com>

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Thu, 28 Apr 2016 17:59:28 +0200

> is_skb_forwardable is not supposed to change anything so constify its
> arguments
> 
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next v2 0/5] bridge: per-vlan stats
From: David Miller @ 2016-04-29 20:12 UTC (permalink / raw)
  To: nikolay; +Cc: netdev, roopa, stephen, jhs
In-Reply-To: <5723BABD.4080005@cumulusnetworks.com>

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Fri, 29 Apr 2016 21:49:17 +0200

> Because that is not needed for the per-vlan stats to work, I did to
> unify the paths and simplify the pvid code but I can easily drop it
> and revert back to using the direct pvid id.  The only fetch will be
> the stats per-cpu pointer then. Would that be acceptable ?

It would be a step in the right direction, for sure.

^ permalink raw reply

* Re: [PATCH v4 net-next 2/2] ppp: add rtnetlink device creation support
From: David Miller @ 2016-04-29 20:10 UTC (permalink / raw)
  To: g.nault; +Cc: netdev, linux-ppp, paulus, stephen, wharms
In-Reply-To: <20160428155530.GA24359@alphalink.fr>

From: Guillaume Nault <g.nault@alphalink.fr>
Date: Thu, 28 Apr 2016 17:55:30 +0200

> Define PPP device handler for use with rtnetlink.
> The only PPP specific attribute is IFLA_PPP_DEV_FD. It is mandatory and
> contains the file descriptor of the associated /dev/ppp instance (the
> file descriptor which would have been used for ioctl(PPPIOCNEWUNIT) in
> the ioctl-based API). The PPP device is removed when this file
> descriptor is released (same behaviour as with ioctl based PPP
> devices).
> 
> PPP devices created with the rtnetlink API behave like the ones created
> with ioctl(PPPIOCNEWUNIT). In particular existing ioctls work the same
> way, no matter how the PPP device was created.
> The rtnl callbacks are also assigned to ioctl based PPP devices. This
> way, rtnl messages have the same effect on any PPP devices.
> The immediate effect is that all PPP devices, even ioctl-based
> ones, can now be removed with "ip link del".
> 
> A minor difference still exists between ioctl and rtnl based PPP
> interfaces: in the device name, the number following the "ppp" prefix
> corresponds to the PPP unit number for ioctl based devices, while it is
> just an unrelated incrementing index for rtnl ones.
> 
> Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>

Series applied, thanks for doing this work!

^ permalink raw reply

* Re: [PATCH net-next v2 0/5] bridge: per-vlan stats
From: Nikolay Aleksandrov @ 2016-04-29 19:49 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, roopa, stephen, jhs
In-Reply-To: <20160429.153326.652947047579122837.davem@davemloft.net>

On 04/29/2016 09:33 PM, David Miller wrote:
> From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> Date: Thu, 28 Apr 2016 17:52:46 +0200
> 
>> This set adds support for bridge per-vlan statistics.
> 
> Between the counter bumps in fast paths and new levels of pointer
> indirection in order to RCU things, I have to agree with Stephen
> that this new overhead is really pushing it.
> 
> All of this new overhead contributes to the transactional overhead
> for every single packet.
> 
> Sorry I'm not going to apply this for now, unless you can come up
> with something significantly cheaper.
> 
> Thanks.
> 

Okay, thanks for the feedback. Is this about the RCUfication of the pvid ?
Because that is not needed for the per-vlan stats to work, I did to unify the paths
and simplify the pvid code but I can easily drop it and revert back to using
the direct pvid id.
The only fetch will be the stats per-cpu pointer then. Would that be acceptable ?

Cheers,
 Nik

^ permalink raw reply

* Re: [RFC PATCH 2/5] mlx5: Add support for UDP tunnel segmentation with outer checksum offload
From: Alexander Duyck @ 2016-04-29 19:36 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Matthew Finlay, Alexander Duyck, Eugenia Emantayev, Bruce W Allan,
	Saeed Mahameed, Linux Netdev List, intel-wired-lan, Ariel Elior,
	Michael Chan
In-Reply-To: <CALzJLG8yme_8a+aH+2VT8atq0wrEK208K1HB-iSQUtDipAyPXA@mail.gmail.com>

On Fri, Apr 29, 2016 at 12:27 PM, Saeed Mahameed
<saeedm@dev.mellanox.co.il> wrote:
> On Fri, Apr 29, 2016 at 4:59 AM, Alexander Duyck
> <alexander.duyck@gmail.com> wrote:
>> On Thu, Apr 28, 2016 at 6:18 PM, Matthew Finlay <Matt@mellanox.com> wrote:
>>>
>>>
>>>
>>>
>>>
>>>>>
>>>>> The mlx5 hardware requires the outer UDP checksum is not set when offloading encapsulated packets.
>>>>
>>>>The Intel documentation said the same thing.  That was due to the fact
>>>>that the hardware didn't computer the outer UDP header checksum.  I
>>>>suspect the Mellanox hardware has the same issue.  Also I have tested
>>>>on a ConnectX-4 board with the latest firmware and what I am seeing is
>>>>that with my patches applied the outer checksum is being correctly
>>>>applied for segmentation offloads.
>>>>
>>>>My thought is that that the hardware appears to ignore the UDP
>>>>checksum so if it is non-zero you cannot guarantee the checksum would
>>>>be correct on the last frame if it is a different size than the rest
>>>>of the segments.  In the case of these patches that issue has been
>>>>resolved as I have precomputed the UDP checksum for the outer UDP
>>>>header and all of the segments will be the same length so there should
>>>>be no variation in the UDP checksum of the outer header.  Unless you
>>>>can tell my exactly the reason why we cannot provide the outer UDP
>>>>checksum I would assume that the reason is due to the fact that the
>>>>hardware doesn't compute it so you cannot handle a fragment on the end
>>>>which is resolved already via GSO_PARTIAL.
>>>
>>> I will check internally and verify there are no unforeseen issues with setting the outer UDP checksum in this scenario.
>>
>> Thanks.  Any idea how long it should be.  I know I was getting a
>> auto-reply about people being out until May 1st due to a holiday so I
>> am just wondering if we should have Dave drop this patch set and I
>> submit a v2 when you can get me the feedback next week, or if we run
>> with the patches as-is for now and be prepared to revert if anything
>> should come up.
>>
>
> Alex,
>
> I reviewed your patches and other than  the claim about mlx4,
> everything seems to be ok.
> I took the liberty to apply your patches and play around with them
> only on mlx5 for now,
> It seems that it works and HW do correctly calculate the IPv6 outer
> UDP sum as illustrated in the log from the tcpdump on the receiver
> [1], I also noticed that the GSO also works on the xmitter and the HW
> ignores the outer sum as expected.
>
> Matt, I think you still need to do the homework and see if we didn't
> miss anything here, but theoretically and practically what Alex did
> here should work.
> Tariq will also check what went wrong with mlx4 outer ipv6 support,
> but this shouldn't block this series.
>
> Side notes:
> - Alex, you will need to rebase the series, it didn't apply smoothly.
> - BTW mlx5 on RX side will provide csum complete and not csum unnecessary.
>
> Saeed.
>
> [1]
> 21:28:15.474287 e4:1d:2d:5c:f2:e8 > e4:1d:2d:5c:f2:d4, ethertype IPv6
> (0x86dd), length 1514: (hlim 64, next-header UDP (17) payload length:
> 1460) 2001::37:4.58006 > 2001::36:4.4789: [udp sum ok] VXLAN, flags
> [I] (0x08), vni 46
> 66:cb:6e:a4:31:4e > b6:bf:9b:61:31:62, ethertype IPv4 (0x0800), length
> 1444: (tos 0x0, ttl 64, id 64920, offset 0, flags [DF], proto TCP (6),
> length 1430)
>     56.0.37.4.53614 > 56.0.36.4.commplex-link: Flags [.], cksum 0xd6cc
> (correct), seq 1911713070:1911714448, ack 1, win 218, options
> [nop,nop,TS val 183853011 ecr 183840106], length 1378


Thanks.  I'll probably resubmit next week after your latest set of 12
patches gets applied.

- Alex

^ permalink raw reply

* Re: [PATCH net-next v2 0/5] bridge: per-vlan stats
From: David Miller @ 2016-04-29 19:33 UTC (permalink / raw)
  To: nikolay; +Cc: netdev, roopa, stephen, jhs
In-Reply-To: <1461858771-4732-1-git-send-email-nikolay@cumulusnetworks.com>

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Thu, 28 Apr 2016 17:52:46 +0200

> This set adds support for bridge per-vlan statistics.

Between the counter bumps in fast paths and new levels of pointer
indirection in order to RCU things, I have to agree with Stephen
that this new overhead is really pushing it.

All of this new overhead contributes to the transactional overhead
for every single packet.

Sorry I'm not going to apply this for now, unless you can come up
with something significantly cheaper.

Thanks.

^ permalink raw reply

* Re: [RFC PATCH 2/5] mlx5: Add support for UDP tunnel segmentation with outer checksum offload
From: Saeed Mahameed @ 2016-04-29 19:27 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Matthew Finlay, Alexander Duyck, Eugenia Emantayev, Bruce W Allan,
	Saeed Mahameed, Linux Netdev List, intel-wired-lan, Ariel Elior,
	Michael Chan
In-Reply-To: <CAKgT0UeGJY0kntN6KeXmqZEY3k=uND4RXY+RG94q0Da2Tt2rWg@mail.gmail.com>

On Fri, Apr 29, 2016 at 4:59 AM, Alexander Duyck
<alexander.duyck@gmail.com> wrote:
> On Thu, Apr 28, 2016 at 6:18 PM, Matthew Finlay <Matt@mellanox.com> wrote:
>>
>>
>>
>>
>>
>>>>
>>>> The mlx5 hardware requires the outer UDP checksum is not set when offloading encapsulated packets.
>>>
>>>The Intel documentation said the same thing.  That was due to the fact
>>>that the hardware didn't computer the outer UDP header checksum.  I
>>>suspect the Mellanox hardware has the same issue.  Also I have tested
>>>on a ConnectX-4 board with the latest firmware and what I am seeing is
>>>that with my patches applied the outer checksum is being correctly
>>>applied for segmentation offloads.
>>>
>>>My thought is that that the hardware appears to ignore the UDP
>>>checksum so if it is non-zero you cannot guarantee the checksum would
>>>be correct on the last frame if it is a different size than the rest
>>>of the segments.  In the case of these patches that issue has been
>>>resolved as I have precomputed the UDP checksum for the outer UDP
>>>header and all of the segments will be the same length so there should
>>>be no variation in the UDP checksum of the outer header.  Unless you
>>>can tell my exactly the reason why we cannot provide the outer UDP
>>>checksum I would assume that the reason is due to the fact that the
>>>hardware doesn't compute it so you cannot handle a fragment on the end
>>>which is resolved already via GSO_PARTIAL.
>>
>> I will check internally and verify there are no unforeseen issues with setting the outer UDP checksum in this scenario.
>
> Thanks.  Any idea how long it should be.  I know I was getting a
> auto-reply about people being out until May 1st due to a holiday so I
> am just wondering if we should have Dave drop this patch set and I
> submit a v2 when you can get me the feedback next week, or if we run
> with the patches as-is for now and be prepared to revert if anything
> should come up.
>

Alex,

I reviewed your patches and other than  the claim about mlx4,
everything seems to be ok.
I took the liberty to apply your patches and play around with them
only on mlx5 for now,
It seems that it works and HW do correctly calculate the IPv6 outer
UDP sum as illustrated in the log from the tcpdump on the receiver
[1], I also noticed that the GSO also works on the xmitter and the HW
ignores the outer sum as expected.

Matt, I think you still need to do the homework and see if we didn't
miss anything here, but theoretically and practically what Alex did
here should work.
Tariq will also check what went wrong with mlx4 outer ipv6 support,
but this shouldn't block this series.

Side notes:
- Alex, you will need to rebase the series, it didn't apply smoothly.
- BTW mlx5 on RX side will provide csum complete and not csum unnecessary.

Saeed.

[1]
21:28:15.474287 e4:1d:2d:5c:f2:e8 > e4:1d:2d:5c:f2:d4, ethertype IPv6
(0x86dd), length 1514: (hlim 64, next-header UDP (17) payload length:
1460) 2001::37:4.58006 > 2001::36:4.4789: [udp sum ok] VXLAN, flags
[I] (0x08), vni 46
66:cb:6e:a4:31:4e > b6:bf:9b:61:31:62, ethertype IPv4 (0x0800), length
1444: (tos 0x0, ttl 64, id 64920, offset 0, flags [DF], proto TCP (6),
length 1430)
    56.0.37.4.53614 > 56.0.36.4.commplex-link: Flags [.], cksum 0xd6cc
(correct), seq 1911713070:1911714448, ack 1, win 218, options
[nop,nop,TS val 183853011 ecr 183840106], length 1378

^ permalink raw reply

* [PATCH] Bluetooth: Use hci_conn_hash_lookup_le
From: Julia Lawall @ 2016-04-29 19:22 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: kernel-janitors, Gustavo Padovan, Johan Hedberg, David S. Miller,
	linux-bluetooth, netdev, linux-kernel

Use the function hci_conn_hash_lookup_le that integrates type testing for
looking up LE connections.  See the patch 1b51c7b6 that introduced this
function for more details.

The semantic patch that (sort of) fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression hdev,addr;
symbol UNKNOWN;
@@

-       hci_conn_hash_lookup_ba(hdev, LE_LINK, addr)
+       hci_conn_hash_lookup_le(hdev, addr, UNKNOWN)
// </smpl>

UNKNOWN has to be replaced by the address type from the usage context.  In
the second case, a subsequent test on the address type is removed also.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---

This was done by analogy with f5ad4ff and from the explanation in
1b51c7b6.  It is not tested, and I don't really know if it is correct.

 net/bluetooth/mgmt.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9e4b931..5a61245 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4773,7 +4773,8 @@ static int get_conn_info(struct sock *sk, struct hci_dev *hdev, void *data,
 		conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK,
 					       &cp->addr.bdaddr);
 	else
-		conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr);
+		conn = hci_conn_hash_lookup_le(hdev, &cp->addr.bdaddr,
+					       cp->addr.type);
 
 	if (!conn || conn->state != BT_CONNECTED) {
 		err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO,
@@ -5009,13 +5010,10 @@ static bool is_connected(struct hci_dev *hdev, bdaddr_t *addr, u8 type)
 {
 	struct hci_conn *conn;
 
-	conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, addr);
+	conn = hci_conn_hash_lookup_le(hdev, addr, type);
 	if (!conn)
 		return false;
 
-	if (conn->dst_type != type)
-		return false;
-
 	if (conn->state != BT_CONNECTED)
 		return false;
 

^ permalink raw reply related

* Re: [PATCH net-next] net: ethernet: stmmac: update MDIO support for GMAC4
From: David Miller @ 2016-04-29 19:14 UTC (permalink / raw)
  To: alexandre.torgue; +Cc: netdev, peppe.cavallaro
In-Reply-To: <1461851805-15201-1-git-send-email-alexandre.torgue@st.com>

From: Alexandre TORGUE <alexandre.torgue@st.com>
Date: Thu, 28 Apr 2016 15:56:45 +0200

> On new GMAC4 IP, MAC_MDIO_address register has been updated, and bitmaps
> changed. This patch takes into account those changes.
> 
> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next] vxlan: fix initialization with custom link parameters
From: David Miller @ 2016-04-29 19:09 UTC (permalink / raw)
  To: jbenc; +Cc: netdev, nicolas.dichtel
In-Reply-To: <7c19200582d6f4272cee914934f428775e405e89.1461854177.git.jbenc@redhat.com>

From: Jiri Benc <jbenc@redhat.com>
Date: Thu, 28 Apr 2016 16:36:30 +0200

> Commit 0c867c9bf84c ("vxlan: move Ethernet initialization to a separate
> function") changed initialization order and as an unintended result, when the
> user specifies additional link parameters (such as IFLA_ADDRESS) while
> creating vxlan interface, those are overwritten by vxlan_ether_setup later.
> 
> It's necessary to call ether_setup from withing the ->setup callback. That
> way, the correct parameters are set by rtnl_create_link later. This is done
> also for VXLAN-GPE, as we don't know the interface type yet at that point,
> and changed to the correct interface type later.
> 
> Fixes: 0c867c9bf84c ("vxlan: move Ethernet initialization to a separate function")
> Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Signed-off-by: Jiri Benc <jbenc@redhat.com>

Applied, thanks Jiri.

^ permalink raw reply

* Re: [net-next PATCH V4 0/5] samples/bpf: Improve user experience
From: David Miller @ 2016-04-29 18:26 UTC (permalink / raw)
  To: brouer
  Cc: netdev, linux-kbuild, bblanco, naveen.n.rao, borkmann,
	alexei.starovoitov
In-Reply-To: <20160428121949.16807.84828.stgit@firesoul>

From: Jesper Dangaard Brouer <brouer@redhat.com>
Date: Thu, 28 Apr 2016 14:20:48 +0200

> It is a steep learning curve getting started with using the eBPF
> examples in samples/bpf/.  There are several dependencies, and
> specific versions of these dependencies.  Invoking make in the correct
> manor is also slightly obscure.
> 
> This patchset cleanup, document and hopefully improves the first time
> user experience with the eBPF samples directory by auto-detecting
> certain scenarios.
> 
> V4:
>  - Address Naveen's nitpicks
>  - Handle/fail if extra args are passed in LLC or CLANG (David Laight)
> 
> V3:
>  - Add Alexei's ACKs
>  - Remove README paragraph about LLVM experimental BPF target
>    as it only existed between LLVM version 3.6 to 3.7.
> 
> V2:
>  - Adjusted recommend minimum versions to 3.7.1
>  - Included clang build instructions
>  - New patch adding CLANG variable and validation of command

Series applied, thanks Jesper.

^ permalink raw reply

* Re: [PATCHv3] netem: Segment GSO packets on enqueue
From: Stephen Hemminger @ 2016-04-29 18:19 UTC (permalink / raw)
  To: Neil Horman
  Cc: netdev, Jamal Hadi Salim, David S. Miller, netem, eric.dumazet
In-Reply-To: <1461951348-3920-1-git-send-email-nhorman@tuxdriver.com>

On Fri, 29 Apr 2016 13:35:48 -0400
Neil Horman <nhorman@tuxdriver.com> wrote:

> This was recently reported to me, and reproduced on the latest net kernel, when
> attempting to run netperf from a host that had a netem qdisc attached to the
> egress interface:
> 
> [  788.073771] ------------[ cut here ]------------
> [  788.096716] WARNING: at net/core/dev.c:2253 skb_warn_bad_offload+0xcd/0xda()
> [  788.129521] bnx2: caps=(0x00000001801949b3, 0x0000000000000000) len=2962
> data_len=0 gso_size=1448 gso_type=1 ip_summed=3
> [  788.182150] Modules linked in: sch_netem kvm_amd kvm crc32_pclmul ipmi_ssif
> ghash_clmulni_intel sp5100_tco amd64_edac_mod aesni_intel lrw gf128mul
> glue_helper ablk_helper edac_mce_amd cryptd pcspkr sg edac_core hpilo ipmi_si
> i2c_piix4 k10temp fam15h_power hpwdt ipmi_msghandler shpchp acpi_power_meter
> pcc_cpufreq nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c
> sd_mod crc_t10dif crct10dif_generic mgag200 syscopyarea sysfillrect sysimgblt
> i2c_algo_bit drm_kms_helper ahci ata_generic pata_acpi ttm libahci
> crct10dif_pclmul pata_atiixp tg3 libata crct10dif_common drm crc32c_intel ptp
> serio_raw bnx2 r8169 hpsa pps_core i2c_core mii dm_mirror dm_region_hash dm_log
> dm_mod
> [  788.465294] CPU: 16 PID: 0 Comm: swapper/16 Tainted: G        W
> ------------   3.10.0-327.el7.x86_64 #1
> [  788.511521] Hardware name: HP ProLiant DL385p Gen8, BIOS A28 12/17/2012
> [  788.542260]  ffff880437c036b8 f7afc56532a53db9 ffff880437c03670
> ffffffff816351f1
> [  788.576332]  ffff880437c036a8 ffffffff8107b200 ffff880633e74200
> ffff880231674000
> [  788.611943]  0000000000000001 0000000000000003 0000000000000000
> ffff880437c03710
> [  788.647241] Call Trace:
> [  788.658817]  <IRQ>  [<ffffffff816351f1>] dump_stack+0x19/0x1b
> [  788.686193]  [<ffffffff8107b200>] warn_slowpath_common+0x70/0xb0
> [  788.713803]  [<ffffffff8107b29c>] warn_slowpath_fmt+0x5c/0x80
> [  788.741314]  [<ffffffff812f92f3>] ? ___ratelimit+0x93/0x100
> [  788.767018]  [<ffffffff81637f49>] skb_warn_bad_offload+0xcd/0xda
> [  788.796117]  [<ffffffff8152950c>] skb_checksum_help+0x17c/0x190
> [  788.823392]  [<ffffffffa01463a1>] netem_enqueue+0x741/0x7c0 [sch_netem]
> [  788.854487]  [<ffffffff8152cb58>] dev_queue_xmit+0x2a8/0x570
> [  788.880870]  [<ffffffff8156ae1d>] ip_finish_output+0x53d/0x7d0
> ...
> 
> The problem occurs because netem is not prepared to handle GSO packets (as it
> uses skb_checksum_help in its enqueue path, which cannot manipulate these
> frames).
> 
> The solution I think is to simply segment the skb in a simmilar fashion to the
> way we do in __dev_queue_xmit (via validate_xmit_skb), with some minor changes.
> When we decide to corrupt an skb, if the frame is GSO, we segment it, corrupt
> the first segment, and enqueue the remaining ones.
> 
> tested successfully by myself on the latest net kernel, to whcih this applies
> 
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> CC: Jamal Hadi Salim <jhs@mojatatu.com>
> CC: "David S. Miller" <davem@davemloft.net>
> CC: netem@lists.linux-foundation.org
> CC: eric.dumazet@gmail.com
> 

This looks like a good idea.

Please cleanup the formatting issues:

This was recently reported to me, and reproduced on the latest net kernel, when

WARNING: 'whcih' may be misspelled - perhaps 'which'?
#93: 
tested successfully by myself on the latest net kernel, to whcih this applies

ERROR: "foo* bar" should be "foo *bar"
#130: FILE: net/sched/sch_netem.c:402:
+static struct sk_buff* netem_segment(struct sk_buff *skb, struct Qdisc *sch)


CHECK: braces {} should be used on all arms of this statement
#164: FILE: net/sched/sch_netem.c:479:
+		if (skb_is_gso(skb)) {
[...]
+		} else
[...]

CHECK: braces {} should be used on all arms of this statement
#198: FILE: net/sched/sch_netem.c:562:
+			if (rc != NET_XMIT_SUCCESS) {
[...]
+			} else
[...]

^ permalink raw reply

* Re: [PATCH net] ip_tunnel: fix preempt warning in ip tunnel creation/updating
From: David Miller @ 2016-04-29 18:11 UTC (permalink / raw)
  To: pabeni
  Cc: netdev, kuznet, tgraf, pshelar, jbenc, hannes, sergei.shtylyov,
	tom, eric.dumazet
In-Reply-To: <b21056e2495c485a2084d058d03e1f95480b3510.1461834203.git.pabeni@redhat.com>

From: Paolo Abeni <pabeni@redhat.com>
Date: Thu, 28 Apr 2016 11:04:51 +0200

> After the commit e09acddf873b ("ip_tunnel: replace dst_cache with generic
> implementation"), a preemption debug warning is triggered on ip4
> tunnels updating; the dst cache helper needs to be invoked in unpreemptible
> context.
> 
> We don't need to load the cache on tunnel update, so this commit fixes
> the warning replacing the load with a dst cache reset, which is
> preempt safe.
> 
> Fixes: e09acddf873b ("ip_tunnel: replace dst_cache with generic
> implementation")
> 
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Applied, thanks Paolo.

^ permalink raw reply

* Re: [PATCH] mdio_bus: Fix MDIO bus scanning in __mdiobus_register()
From: Marek Vasut @ 2016-04-29 18:11 UTC (permalink / raw)
  To: Sergei Shtylyov, netdev
  Cc: Arnd Bergmann, David S . Miller, Dinh Nguyen, Florian Fainelli
In-Reply-To: <572381DA.5030607@cogentembedded.com>

On 04/29/2016 05:46 PM, Sergei Shtylyov wrote:
> Hello.

Hi!

> On 04/29/2016 02:45 PM, Marek Vasut wrote:
> 
>>>     First of all, thank you for the patch!
>>>     You beat me to it (and not only me). :-)
>>
>> Heh, hacking at night has it's perks :)
> 
>    I know, I'm just supposed to work on different things. :-)
> 
>>> On 4/29/2016 4:09 AM, Marek Vasut wrote:
>>>
>>>> Since commit b74766a0a0feeef5c779709cc5d109451c0d5b17 in linux-next,
>>>> ( phylib: don't return NULL from get_phy_device() ), phy_get_device()
>>>
>>>     scripts/checkpatch.pl now enforces certain commit citing style,
>>> yours
>>> doesn't quite match it.
>>
>> Ha, I didn't know that checkpatch can now warn about this too, nice. Is
>> that in next already ? I just tried checkpatch and it doesn't warn
>> about it.
> 
>    It's been merged long ago. Actually, I've just run this script from
> the current Linus' tree on your patch, here's the results:

Oh, got it now.

> ERROR: Please use git commit description style 'commit <12+ chars of
> sha1> ("<title line>")' - ie: 'commit fatal: bad o ("cc5d109451c0d5b17")'
> #4:
> Since commit b74766a0a0feeef5c779709cc5d109451c0d5b17 in linux-next,
> 
> WARNING: 'immediatelly' may be misspelled - perhaps 'immediately'?
> #23:
> 'if (IS_ERR(phydev))' condition and the loop exits immediatelly if the
> 
> total: 1 errors, 1 warnings, 0 checks, 8 lines checked

Ha, this is embarrassing .

>> Anyway, regarding this format, do you want V2 ? Originally, I had the
>> full commit info in the message, but that was just taking space and
>> it is not the commit which is important in the message, so I trimmed
>> it down.
> 
>    I'll let DaveM decide.

OK

>>>> will return ERR_PTR(-ENODEV) instead of NULL if the PHY device ID is
>>>> all ones.
>>>>
>>>> This causes problem with stmmac driver and likely some other drivers
>>>> which call mdiobus_register(). I triggered this bug on SoCFPGA MCVEVK
>>>> board with linux-next 20160427 and 20160428. In case of the stmmac, if
>>>> there is no PHY node specified in the DT for the stmmac block, the
>>>> stmmac
>>>> driver ( drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c function
>>>> stmmac_mdio_register() ) will call mdiobus_register() , which will
>>>> register the MDIO bus and probe for the PHY.
>>>>
>>>> The mdiobus_register() resp. __mdiobus_register() iterates over all of
>>>> the addresses on the MDIO bus and calls mdiobus_scan() for each of
>>>> them,
>>>> which invokes get_phy_device(). Before the aforementioned patch, the
>>>> mdiobus_scan() would return NULL if no PHY was found on a given address
>>>> and mdiobus_register() would continue and try the next PHY address.
>>>> Now,
>>>> mdiobus_scan() returns ERR_PTR(-ENODEV), which is caught by the
>>>> 'if (IS_ERR(phydev))' condition and the loop exits immediatelly if the
>>>> PHY address does not contain PHY.
>>>>
>>>> Repair this by explicitly checking for the ERR_PTR(-ENODEV) and if this
>>>> error comes around, continue with the next PHY address.
>>>>
>>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>>> Cc: David S. Miller <davem@davemloft.net>
>>>> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
>>>> Cc: Florian Fainelli <f.fainelli@gmail.com>
>>>> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>>
>>> Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>>
>>>> ---
>>>>   drivers/net/phy/mdio_bus.c | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> NOTE: I don't quite like this explicit check , but I don't have better
>>>> idea now.
>>>
>>>     It's fine. I was going to do just the same :-)
>>
>> OK, I'm glad I'm not alone on this one :)
>>
>>>> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
>>>> index 499003ee..388f992 100644
>>>> --- a/drivers/net/phy/mdio_bus.c
>>>> +++ b/drivers/net/phy/mdio_bus.c
>>>> @@ -333,7 +333,7 @@ int __mdiobus_register(struct mii_bus *bus, struct
>>>> module *owner)
>>>>               struct phy_device *phydev;
>>>>
>>>>               phydev = mdiobus_scan(bus, i);
>>>> -            if (IS_ERR(phydev)) {
>>>> +            if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) {
>>>
>>>     Parens around the second operand of && are not really needed
>>> though...
>>
>> While I agree, I also prefer to make things obvious when reading the
>> code by adding the parenthesis. It's a matter of taste I think. Just let
>> me know if I should spin V2 without them :)
> 
>    Again, let DaveM decide. But I don't think the code being patched
> uses parens in such cases... I wouldn't, for sure.
> 
>> Thanks for the review!
> 
>    You've saved me some work (but I still need to analyze the other call
> paths).

If there is something you want to test on the stmmac, let me know.

>>> [...]
> 
> MBR, Sergei
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply

* [PATCH v2 3/3] dtb: xgene: Add channel property
From: Iyappan Subramanian @ 2016-04-29 18:10 UTC (permalink / raw)
  To: davem, netdev, devicetree; +Cc: linux-arm-kernel, patches, Iyappan Subramanian
In-Reply-To: <1461953415-9741-1-git-send-email-isubramanian@apm.com>

Added 'channel' property, describing ethernet to CPU channel number.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 arch/arm64/boot/dts/apm/apm-shadowcat.dtsi | 1 +
 arch/arm64/boot/dts/apm/apm-storm.dtsi     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/apm/apm-shadowcat.dtsi b/arch/arm64/boot/dts/apm/apm-shadowcat.dtsi
index a055a5d..ba04877 100644
--- a/arch/arm64/boot/dts/apm/apm-shadowcat.dtsi
+++ b/arch/arm64/boot/dts/apm/apm-shadowcat.dtsi
@@ -653,6 +653,7 @@
 				     <0 113 4>,
 				     <0 114 4>,
 				     <0 115 4>;
+			channel = <12>;
 			port-id = <1>;
 			dma-coherent;
 			clocks = <&xge1clk 0>;
diff --git a/arch/arm64/boot/dts/apm/apm-storm.dtsi b/arch/arm64/boot/dts/apm/apm-storm.dtsi
index ae4a173..5147d76 100644
--- a/arch/arm64/boot/dts/apm/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm/apm-storm.dtsi
@@ -993,6 +993,7 @@
 				     <0x0 0x65 0x4>,
 				     <0x0 0x66 0x4>,
 				     <0x0 0x67 0x4>;
+			channel = <0>;
 			dma-coherent;
 			clocks = <&xge0clk 0>;
 			/* mac address will be overwritten by the bootloader */
-- 
1.9.1

^ permalink raw reply related

* [PATCH v2 2/3] Documentation: dtb: xgene: Add channel property
From: Iyappan Subramanian @ 2016-04-29 18:10 UTC (permalink / raw)
  To: davem, netdev, devicetree; +Cc: linux-arm-kernel, patches, Iyappan Subramanian
In-Reply-To: <1461953415-9741-1-git-send-email-isubramanian@apm.com>

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 Documentation/devicetree/bindings/net/apm-xgene-enet.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
index 078060a..05f705e3 100644
--- a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
+++ b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
@@ -18,6 +18,8 @@ Required properties for all the ethernet interfaces:
   - First is the Rx interrupt.  This irq is mandatory.
   - Second is the Tx completion interrupt.
     This is supported only on SGMII based 1GbE and 10GbE interfaces.
+- channel: Ethernet to CPU, start channel (prefetch buffer) number
+  - Must map to the first irq and irqs must be sequential
 - port-id: Port number (0 or 1)
 - clocks: Reference to the clock entry.
 - local-mac-address: MAC address assigned to this device
-- 
1.9.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox