Netdev List
 help / color / mirror / Atom feed
* [PATCH stable 4.4 03/11] net: modify skb_rbtree_purge to return the truesize of all purged skbs.
From: Mao Wenan @ 2019-01-23  2:19 UTC (permalink / raw)
  To: netdev, gregkh, eric.dumazet, davem, stable, edumazet
In-Reply-To: <1548209986-83527-1-git-send-email-maowenan@huawei.com>

From: Peter Oskolkov <posk@google.com>

[ Upstream commit 385114dec8a49b5e5945e77ba7de6356106713f4 ]

Tested: see the next patch is the series.

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
 include/linux/skbuff.h | 2 +-
 net/core/skbuff.c      | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index a490dd7..8bfefdd 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2273,7 +2273,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
 		kfree_skb(skb);
 }
 
-void skb_rbtree_purge(struct rb_root *root);
+unsigned int skb_rbtree_purge(struct rb_root *root);
 
 void *netdev_alloc_frag(unsigned int fragsz);
 
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 8a57bba..49f73fb 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2380,23 +2380,27 @@ EXPORT_SYMBOL(skb_queue_purge);
 /**
  *	skb_rbtree_purge - empty a skb rbtree
  *	@root: root of the rbtree to empty
+ *	Return value: the sum of truesizes of all purged skbs.
  *
  *	Delete all buffers on an &sk_buff rbtree. Each buffer is removed from
  *	the list and one reference dropped. This function does not take
  *	any lock. Synchronization should be handled by the caller (e.g., TCP
  *	out-of-order queue is protected by the socket lock).
  */
-void skb_rbtree_purge(struct rb_root *root)
+unsigned int skb_rbtree_purge(struct rb_root *root)
 {
 	struct rb_node *p = rb_first(root);
+	unsigned int sum = 0;
 
 	while (p) {
 		struct sk_buff *skb = rb_entry(p, struct sk_buff, rbnode);
 
 		p = rb_next(p);
 		rb_erase(&skb->rbnode, root);
+		sum += skb->truesize;
 		kfree_skb(skb);
 	}
+	return sum;
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH stable 4.4 01/11] net: speed up skb_rbtree_purge()
From: Mao Wenan @ 2019-01-23  2:19 UTC (permalink / raw)
  To: netdev, gregkh, eric.dumazet, davem, stable, edumazet
In-Reply-To: <1548209986-83527-1-git-send-email-maowenan@huawei.com>

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 7c90584c66cc4b033a3b684b0e0950f79e7b7166 ]

As measured in my prior patch ("sch_netem: faster rb tree removal"),
rbtree_postorder_for_each_entry_safe() is nice looking but much slower
than using rb_next() directly, except when tree is small enough
to fit in CPU caches (then the cost is the same)

Also note that there is not even an increase of text size :
$ size net/core/skbuff.o.before net/core/skbuff.o
   text	   data	    bss	    dec	    hex	filename
  40711	   1298	      0	  42009	   a419	net/core/skbuff.o.before
  40711	   1298	      0	  42009	   a419	net/core/skbuff.o

From: Eric Dumazet <edumazet@google.com>

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
 net/core/skbuff.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 9703924..8a57bba 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2388,12 +2388,15 @@ EXPORT_SYMBOL(skb_queue_purge);
  */
 void skb_rbtree_purge(struct rb_root *root)
 {
-	struct sk_buff *skb, *next;
+	struct rb_node *p = rb_first(root);
 
-	rbtree_postorder_for_each_entry_safe(skb, next, root, rbnode)
-		kfree_skb(skb);
+	while (p) {
+		struct sk_buff *skb = rb_entry(p, struct sk_buff, rbnode);
 
-	*root = RB_ROOT;
+		p = rb_next(p);
+		rb_erase(&skb->rbnode, root);
+		kfree_skb(skb);
+	}
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH stable 4.4 04/11] inet: frags: get rif of inet_frag_evicting()
From: Mao Wenan @ 2019-01-23  2:19 UTC (permalink / raw)
  To: netdev, gregkh, eric.dumazet, davem, stable, edumazet
In-Reply-To: <1548209986-83527-1-git-send-email-maowenan@huawei.com>

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 399d1404be660d355192ff4df5ccc3f4159ec1e4 ]

This refactors ip_expire() since one indentation level is removed.

Note: in the future, we should try hard to avoid the skb_clone()
since this is a serious performance cost.
Under DDOS, the ICMP message wont be sent because of rate limits.

Fact that ip6_expire_frag_queue() does not use skb_clone() is
disturbing too. Presumably IPv6 should have the same
issue than the one we fixed in commit ec4fbd64751d
("inet: frag: release spinlock before calling icmp_send()")

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
 include/net/inet_frag.h |  5 ----
 net/ipv4/ip_fragment.c  | 66 ++++++++++++++++++++++++-------------------------
 net/ipv6/reassembly.c   |  4 ---
 3 files changed, 32 insertions(+), 43 deletions(-)

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index c26a6e4..09472b8 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -123,11 +123,6 @@ static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f
 		inet_frag_destroy(q, f);
 }
 
-static inline bool inet_frag_evicting(struct inet_frag_queue *q)
-{
-	return !hlist_unhashed(&q->list_evictor);
-}
-
 /* Memory Tracking Functions. */
 
 static inline int frag_mem_limit(struct netns_frags *nf)
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 4e64879..264f382 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -194,8 +194,11 @@ static bool frag_expire_skip_icmp(u32 user)
  */
 static void ip_expire(unsigned long arg)
 {
-	struct ipq *qp;
+	struct sk_buff *clone, *head;
+	const struct iphdr *iph;
 	struct net *net;
+	struct ipq *qp;
+	int err;
 
 	qp = container_of((struct inet_frag_queue *) arg, struct ipq, q);
 	net = container_of(qp->q.net, struct net, ipv4.frags);
@@ -209,45 +212,40 @@ static void ip_expire(unsigned long arg)
 	ipq_kill(qp);
 	IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS);
 
-	if (!inet_frag_evicting(&qp->q)) {
-		struct sk_buff *clone, *head = qp->q.fragments;
-		const struct iphdr *iph;
-		int err;
-
-		IP_INC_STATS_BH(net, IPSTATS_MIB_REASMTIMEOUT);
+	head = qp->q.fragments;
 
-		if (!(qp->q.flags & INET_FRAG_FIRST_IN) || !qp->q.fragments)
-			goto out;
+	IP_INC_STATS_BH(net, IPSTATS_MIB_REASMTIMEOUT);
 
-		head->dev = dev_get_by_index_rcu(net, qp->iif);
-		if (!head->dev)
-			goto out;
+	if (!(qp->q.flags & INET_FRAG_FIRST_IN) || !head)
+		goto out;
 
+	head->dev = dev_get_by_index_rcu(net, qp->iif);
+	if (!head->dev)
+		goto out;
 
-		/* skb has no dst, perform route lookup again */
-		iph = ip_hdr(head);
-		err = ip_route_input_noref(head, iph->daddr, iph->saddr,
+	/* skb has no dst, perform route lookup again */
+	iph = ip_hdr(head);
+	err = ip_route_input_noref(head, iph->daddr, iph->saddr,
 					   iph->tos, head->dev);
-		if (err)
-			goto out;
+	if (err)
+		goto out;
 
-		/* Only an end host needs to send an ICMP
-		 * "Fragment Reassembly Timeout" message, per RFC792.
-		 */
-		if (frag_expire_skip_icmp(qp->user) &&
-		    (skb_rtable(head)->rt_type != RTN_LOCAL))
-			goto out;
-
-		clone = skb_clone(head, GFP_ATOMIC);
-
-		/* Send an ICMP "Fragment Reassembly Timeout" message. */
-		if (clone) {
-			spin_unlock(&qp->q.lock);
-			icmp_send(clone, ICMP_TIME_EXCEEDED,
-				  ICMP_EXC_FRAGTIME, 0);
-			consume_skb(clone);
-			goto out_rcu_unlock;
-		}
+	/* Only an end host needs to send an ICMP
+	 * "Fragment Reassembly Timeout" message, per RFC792.
+	 */
+	if (frag_expire_skip_icmp(qp->user) &&
+	    (skb_rtable(head)->rt_type != RTN_LOCAL))
+		goto out;
+
+	clone = skb_clone(head, GFP_ATOMIC);
+
+	/* Send an ICMP "Fragment Reassembly Timeout" message. */
+	if (clone) {
+		spin_unlock(&qp->q.lock);
+		icmp_send(clone, ICMP_TIME_EXCEEDED,
+			  ICMP_EXC_FRAGTIME, 0);
+		consume_skb(clone);
+		goto out_rcu_unlock;
 	}
 out:
 	spin_unlock(&qp->q.lock);
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 58f2139..ee4789b 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -146,10 +146,6 @@ void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
 		goto out_rcu_unlock;
 
 	IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
-
-	if (inet_frag_evicting(&fq->q))
-		goto out_rcu_unlock;
-
 	IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMTIMEOUT);
 
 	/* Don't send error if the first segment did not arrive. */
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH stable 4.4 07/11] ip: add helpers to process in-order fragments faster.
From: Mao Wenan @ 2019-01-23  2:19 UTC (permalink / raw)
  To: netdev, gregkh, eric.dumazet, davem, stable, edumazet
In-Reply-To: <1548209986-83527-1-git-send-email-maowenan@huawei.com>

From: Peter Oskolkov <posk@google.com>

[ Upstream commit 353c9cb360874e737fb000545f783df756c06f9a ]

This patch introduces several helper functions/macros that will be
used in the follow-up patch. No runtime changes yet.

The new logic (fully implemented in the second patch) is as follows:

* Nodes in the rb-tree will now contain not single fragments, but lists
  of consecutive fragments ("runs").

* At each point in time, the current "active" run at the tail is
  maintained/tracked. Fragments that arrive in-order, adjacent
  to the previous tail fragment, are added to this tail run without
  triggering the re-balancing of the rb-tree.

* If a fragment arrives out of order with the offset _before_ the tail run,
  it is inserted into the rb-tree as a single fragment.

* If a fragment arrives after the current tail fragment (with a gap),
  it starts a new "tail" run, as is inserted into the rb-tree
  at the end as the head of the new run.

skb->cb is used to store additional information
needed here (suggested by Eric Dumazet).

Reported-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Peter Oskolkov <posk@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
 include/net/inet_frag.h |  4 +++
 net/ipv4/ip_fragment.c  | 74 ++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 74 insertions(+), 4 deletions(-)

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 861d24c..e7d9577 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -48,6 +48,7 @@ struct inet_frag_queue {
 	struct sk_buff		*fragments;  /* Used in IPv6. */
 	struct rb_root		rb_fragments; /* Used in IPv4. */
 	struct sk_buff		*fragments_tail;
+	struct sk_buff		*last_run_head;
 	ktime_t			stamp;
 	int			len;
 	int			meat;
@@ -118,6 +119,9 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
 void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
 				   const char *prefix);
 
+/* Free all skbs in the queue; return the sum of their truesizes. */
+unsigned int inet_frag_rbtree_purge(struct rb_root *root);
+
 static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
 {
 	if (atomic_dec_and_test(&q->refcnt))
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index e820eb9..73ec3a9 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -58,13 +58,57 @@
 static int sysctl_ipfrag_max_dist __read_mostly = 64;
 static const char ip_frag_cache_name[] = "ip4-frags";
 
-struct ipfrag_skb_cb
-{
+/* Use skb->cb to track consecutive/adjacent fragments coming at
+ * the end of the queue. Nodes in the rb-tree queue will
+ * contain "runs" of one or more adjacent fragments.
+ *
+ * Invariants:
+ * - next_frag is NULL at the tail of a "run";
+ * - the head of a "run" has the sum of all fragment lengths in frag_run_len.
+ */
+struct ipfrag_skb_cb {
 	struct inet_skb_parm	h;
-	int			offset;
+	int                     offset;
+	struct sk_buff		*next_frag;
+	int			frag_run_len;
 };
 
-#define FRAG_CB(skb)	((struct ipfrag_skb_cb *)((skb)->cb))
+#define FRAG_CB(skb)		((struct ipfrag_skb_cb *)((skb)->cb))
+
+static void ip4_frag_init_run(struct sk_buff *skb)
+{
+	BUILD_BUG_ON(sizeof(struct ipfrag_skb_cb) > sizeof(skb->cb));
+
+	FRAG_CB(skb)->next_frag = NULL;
+	FRAG_CB(skb)->frag_run_len = skb->len;
+}
+
+/* Append skb to the last "run". */
+static void ip4_frag_append_to_last_run(struct inet_frag_queue *q,
+					struct sk_buff *skb)
+{
+	RB_CLEAR_NODE(&skb->rbnode);
+	FRAG_CB(skb)->next_frag = NULL;
+
+	FRAG_CB(q->last_run_head)->frag_run_len += skb->len;
+	FRAG_CB(q->fragments_tail)->next_frag = skb;
+	q->fragments_tail = skb;
+}
+
+/* Create a new "run" with the skb. */
+static void ip4_frag_create_run(struct inet_frag_queue *q, struct sk_buff *skb)
+{
+	if (q->last_run_head)
+		rb_link_node(&skb->rbnode, &q->last_run_head->rbnode,
+			     &q->last_run_head->rbnode.rb_right);
+	else
+		rb_link_node(&skb->rbnode, NULL, &q->rb_fragments.rb_node);
+	rb_insert_color(&skb->rbnode, &q->rb_fragments);
+
+	ip4_frag_init_run(skb);
+	q->fragments_tail = skb;
+	q->last_run_head = skb;
+}
 
 /* Describe an entry in the "incomplete datagrams" queue. */
 struct ipq {
@@ -721,6 +765,28 @@ struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user)
 }
 EXPORT_SYMBOL(ip_check_defrag);
 
+unsigned int inet_frag_rbtree_purge(struct rb_root *root)
+{
+	struct rb_node *p = rb_first(root);
+	unsigned int sum = 0;
+
+	while (p) {
+		struct sk_buff *skb = rb_entry(p, struct sk_buff, rbnode);
+
+		p = rb_next(p);
+		rb_erase(&skb->rbnode, root);
+		while (skb) {
+			struct sk_buff *next = FRAG_CB(skb)->next_frag;
+
+			sum += skb->truesize;
+			kfree_skb(skb);
+			skb = next;
+		}
+	}
+	return sum;
+}
+EXPORT_SYMBOL(inet_frag_rbtree_purge);
+
 #ifdef CONFIG_SYSCTL
 static int zero;
 
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH net-next v1] l2tp: fix reading optional fields
From: Jacob Wen @ 2019-01-23  2:30 UTC (permalink / raw)
  To: netdev; +Cc: jchapman

Use pskb_may_pull() to make sure the optional fields are in skb linear
parts.

Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
---
v1: fix warning: ISO C90 forbids mixed declarations and code
---
 net/l2tp/l2tp_core.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 26f1d435696a..c0dfa2bcd218 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -627,6 +627,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
 
 	/* Parse and check optional cookie */
 	if (session->peer_cookie_len > 0) {
+		if (!pskb_may_pull(skb, ptr - optr + session->peer_cookie_len))
+			goto discard;
 		if (memcmp(ptr, &session->peer_cookie[0], session->peer_cookie_len)) {
 			l2tp_info(tunnel, L2TP_MSG_DATA,
 				  "%s: cookie mismatch (%u/%u). Discarding.\n",
@@ -649,6 +651,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
 	L2TP_SKB_CB(skb)->has_seq = 0;
 	if (tunnel->version == L2TP_HDR_VER_2) {
 		if (hdrflags & L2TP_HDRFLAG_S) {
+			if (!pskb_may_pull(skb, ptr - optr + 4))
+				goto discard;
 			ns = ntohs(*(__be16 *) ptr);
 			ptr += 2;
 			nr = ntohs(*(__be16 *) ptr);
@@ -663,8 +667,12 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
 				 session->name, ns, nr, session->nr);
 		}
 	} else if (session->l2specific_type == L2TP_L2SPECTYPE_DEFAULT) {
-		u32 l2h = ntohl(*(__be32 *) ptr);
+		u32 l2h;
+
+		if (!pskb_may_pull(skb, ptr - optr + 4))
+			goto discard;
 
+		l2h = ntohl(*(__be32 *) ptr);
 		if (l2h & 0x40000000) {
 			ns = l2h & 0x00ffffff;
 
@@ -729,6 +737,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
 	if (tunnel->version == L2TP_HDR_VER_2) {
 		/* If offset bit set, skip it. */
 		if (hdrflags & L2TP_HDRFLAG_O) {
+			if (!pskb_may_pull(skb, ptr - optr + 2))
+				goto discard;
 			offset = ntohs(*(__be16 *)ptr);
 			ptr += 2 + offset;
 		}
-- 
2.17.1


^ permalink raw reply related

* Re: [PATCH net-next 2/4] net: IP6 defrag: use rbtrees for IPv6 defrag
From: Eric Dumazet @ 2019-01-23  2:49 UTC (permalink / raw)
  To: Tom Herbert, Peter Oskolkov
  Cc: David Miller, Linux Kernel Network Developers, Peter Oskolkov,
	Eric Dumazet, Florian Westphal
In-Reply-To: <CALx6S340zCDJSSN+0AofHYCLJyyc7d6H+=mRay2uUjv=Uh5NxA@mail.gmail.com>



On 01/22/2019 06:13 PM, Tom Herbert wrote:
> On Tue, Jan 22, 2019 at 5:13 PM Peter Oskolkov <posk@google.com> wrote:
>>
>> On Tue, Jan 22, 2019 at 5:04 PM Tom Herbert <tom@herbertland.com> wrote:
>>>
>>> On Tue, Jan 22, 2019 at 4:53 PM Peter Oskolkov <posk@google.com> wrote:
>>>>
>>>> On Tue, Jan 22, 2019 at 4:37 PM Tom Herbert <tom@herbertland.com> wrote:
>>>>>
>>>>> On Tue, Jan 22, 2019 at 10:03 AM Peter Oskolkov <posk@google.com> wrote:
>>>>>>
>>>>>> Currently, IPv6 defragmentation code drops non-last fragments that
>>>>>> are smaller than 1280 bytes: see
>>>>>> commit 0ed4229b08c1 ("ipv6: defrag: drop non-last frags smaller than min mtu")
>>>>>>
>>>>> Peter,
>>>>>
>>>>> I'm a bit confused on why so much code is required to undo this patch
>>>>> which was a whole three lines of code to begin with.
>>>>
>>>> I agree that if the goal is to just lower the 1280 IPv6 fragment
>>>> limit, but keep it reasonably high, then my patchset is not needed.
>>>> However, if the decision (ultimately by David Miller, I guess) is to
>>>> accept fragments of any size, as the standard seems to imply, then
>>>> something similar to what I suggested here is needed, I think. This
>>>> was done in IPv4...
>>>
>>> Peter,
>>>
>>> Sorry, I'm still not following. Before "ipv6: defrag: drop non-last
>>> frags smaller than min mtu" wouldn't we have accepted fragments of any
>>> size? Are you saying that things were previously broken otherwise?
>>
>> Yes, before the patch you reference above, fragments of any size had
>> been accepted. And this had been identified as a DDOS threat and
>> mitigated in IPv6 by setting the 1280 fragment limit and in IPv4 by
>> using rbtrees. The IPv4/IPv6 difference was due to the belief, at the
>> time, that IPv6 standard actually required non-last fragments less
>> than 1280 to be dropped, while IPv4 standard required accepting
>> fragments of any size.
>>
>> So things were broken in the sense of having this DDOS vulnerability,
>> and the vulnerability was fixed in IPv4 and IPv6 using different
>> approaches...
> 
> I see, thanks for the explanation! Even if there is a limit on
> fragment size, it should be configurable so your patches would still
> be relevant. As for eliminating the limit completely, I think that
> question is what is the remaining DOSability with a tiny fragment
> attack. Have you done any analysis that might shed light on that?
>

Given that we have no limit for IPv4, IPv6 should behave the same.

We already have memory limits, so the rbtree handling make sure any
incoming fragment will find the insertion point in O(log2(N)),
which is good enough, even if N is around 8000.





^ permalink raw reply

* Re: [PATCH net-next v2 1/4] net: phy: start state machine in phy_start only
From: S-k, Shyam-sundar @ 2019-01-23  2:50 UTC (permalink / raw)
  To: Heiner Kallweit, Lendacky, Thomas, Andrew Lunn
  Cc: Florian Fainelli, David Miller, netdev@vger.kernel.org
In-Reply-To: <cab82f78-a331-b607-3505-4a03f8db9d50@gmail.com>

Hi Heiner

On 1/23/2019 12:39 AM, Heiner Kallweit wrote:
> On 22.01.2019 15:46, Lendacky, Thomas wrote:
>> On 1/21/19 12:36 PM, Heiner Kallweit wrote:
>>> On 21.01.2019 17:35, Andrew Lunn wrote:
>>>> On Sun, Jan 20, 2019 at 10:01:15AM +0100, Heiner Kallweit wrote:
>>>>> The state machine is a no-op before phy_start() has been called.
>>>>> Therefore let's enable it in phy_start() only. In phy_start()
>>>>> let's call phy_start_machine() instead of phy_trigger_machine().
>>>>> phy_start_machine is an alias for phy_trigger_machine but it makes
>>>>> clearer that we start the state machine here instead of just
>>>>> triggering a run.
>>>> Hi Heiner
>>>>
>>>> Documentation/networking/phy.txt has a section "Doing it all yourself"
>>>> It would be good to review that, and make sure that documentation is
>>>> still valid. I'm not sure any MAC driver actually does do it all
>>>> itself. So it might be worth reviewing the whole document and making
>>>> updates to remove parts of the text.
>>>>
>>> Right. I figured out that I have update phy.txt anyway because I
>>> recently removed phy_stop_interrupts which is referenced in the
>>> documentation. OK if we leave the patch series as is and I submit
>>> the documentation update as a separate patch?
>> I think you need to be careful here and not break what is allowed in the
>> "Doing it all yourself" section. The amd-xgbe driver makes use of this
>> functionality and does not use phy_start()/phy_stop(). Specifically, it
>> does:
>>   get_phy_device();
>>   phy_device_register();
>>   phy_attach_direct();
>>
>> At which point it uses phy_start_aneg(), phy_read(), phy_write(),
>> phy_read_status() and phy_aneg_done().
>>
> Thanks for the hint, Tom. I *think* the changes should be safe.
> However, if AMD has a regression test suite I'd appreciate if you could
> test the changes upfront or once they reach net-next.
>
Can you please cc: on your changes so you I can verify them before they get pushed upstream?

^ permalink raw reply

* Re: [PATCH net-next v1] l2tp: fix reading optional fields
From: Eric Dumazet @ 2019-01-23  2:51 UTC (permalink / raw)
  To: Jacob Wen, netdev; +Cc: jchapman
In-Reply-To: <20190123023050.29062-1-jian.w.wen@oracle.com>



On 01/22/2019 06:30 PM, Jacob Wen wrote:
> Use pskb_may_pull() to make sure the optional fields are in skb linear
> parts.
> 
> Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
> ---
> v1: fix warning: ISO C90 forbids mixed declarations and code
> ---
>  net/l2tp/l2tp_core.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
> index 26f1d435696a..c0dfa2bcd218 100644
> --- a/net/l2tp/l2tp_core.c
> +++ b/net/l2tp/l2tp_core.c
> @@ -627,6 +627,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
>  
>  	/* Parse and check optional cookie */
>  	if (session->peer_cookie_len > 0) {
> +		if (!pskb_may_pull(skb, ptr - optr + session->peer_cookie_len))
> +			goto discard;

This is completely buggy.

After pskb_may_pull(), the ptr and optr pointers might point to freed data.

So the memcmp() might crash hard.

>  		if (memcmp(ptr, &session->peer_cookie[0], session->peer_cookie_len)) {
>  			l2tp_info(tunnel, L2TP_MSG_DATA,
>  				  "%s: cookie mismatch (%u/%u). Discarding.\n",
> @@ -649,6 +651,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
>  	L2TP_SKB_CB(skb)->has_seq = 0;
>  	if (tunnel->version == L2TP_HDR_VER_2) {
>  		if (hdrflags & L2TP_HDRFLAG_S) {
> +			if (!pskb_may_pull(skb, ptr - optr + 4))
> +				goto discard;
>  			ns = ntohs(*(__be16 *) ptr);
>  			ptr += 2;
>  			nr = ntohs(*(__be16 *) ptr);
> @@ -663,8 +667,12 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
>  				 session->name, ns, nr, session->nr);
>  		}
>  	} else if (session->l2specific_type == L2TP_L2SPECTYPE_DEFAULT) {
> -		u32 l2h = ntohl(*(__be32 *) ptr);
> +		u32 l2h;
> +
> +		if (!pskb_may_pull(skb, ptr - optr + 4))
> +			goto discard;
>  
> +		l2h = ntohl(*(__be32 *) ptr);
>  		if (l2h & 0x40000000) {
>  			ns = l2h & 0x00ffffff;
>  
> @@ -729,6 +737,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
>  	if (tunnel->version == L2TP_HDR_VER_2) {
>  		/* If offset bit set, skip it. */
>  		if (hdrflags & L2TP_HDRFLAG_O) {
> +			if (!pskb_may_pull(skb, ptr - optr + 2))
> +				goto discard;
>  			offset = ntohs(*(__be16 *)ptr);
>  			ptr += 2 + offset;
>  		}
> 

^ permalink raw reply

* Re: [PATCH bpf-next] bpf: sock recvbuff must be limited by rmem_max in bpf_setsockopt()
From: 邵亚方(基础平台部) @ 2019-01-23  1:58 UTC (permalink / raw)
  To: Martin Lau
  Cc: Yafang Shao, Lawrence Brakmo, ast@kernel.org,
	daniel@iogearbox.net, netdev@vger.kernel.org
In-Reply-To: <20190122174245.soq5nqela6jpzvlg@kafai-mbp.dhcp.thefacebook.com>



> On 23 Jan 2019, at 1:42 AM, Martin Lau <kafai@fb.com> wrote:
> 
> On Sat, Jan 19, 2019 at 02:20:30PM +0800, Yafang Shao wrote:
>> When sock recvbuff is set by bpf_setsockopt(), the value must by limited
>> by rmem_max.
>> It is the same with sendbuff.
>> 
>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> For bug fixes, please target the bpf branch instead of bpf-next
> and please also add the Fixes tag:
> Fixes: 8c4b4c7e9ff0 ("bpf: Add setsockopt helper function to bpf”)

Sure.
Will change it and send V2.

Thanks
Yafang

> Patch LGTM,
> Acked-by: Martin KaFai Lau <kafai@fb.com>
> 
> Cc: Lawrence Brakmo, thought?
> 
>> ---
>> net/core/filter.c | 2 ++
>> 1 file changed, 2 insertions(+)
>> 
>> diff --git a/net/core/filter.c b/net/core/filter.c
>> index 447dd1b..f30b58a 100644
>> --- a/net/core/filter.c
>> +++ b/net/core/filter.c
>> @@ -4111,10 +4111,12 @@ static unsigned long bpf_xdp_copy(void *dst_buff, const void *src_buff,
>> 		/* Only some socketops are supported */
>> 		switch (optname) {
>> 		case SO_RCVBUF:
>> +			val = min_t(u32, val, sysctl_rmem_max);
>> 			sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
>> 			sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF);
>> 			break;
>> 		case SO_SNDBUF:
>> +			val = min_t(u32, val, sysctl_wmem_max);
>> 			sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
>> 			sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
>> 			break;
>> -- 
>> 1.8.3.1
>> 


^ permalink raw reply

* [PATCH net-next] net: udp Allow CHECKSUM_UNNECESSARY packets to do GRO.
From: Mao Wenan @ 2019-01-23  3:33 UTC (permalink / raw)
  To: netdev, davem, edumazet

When udp4_gro_receive() get one packet that uh->check=0,
skb_gro_checksum_validate_zero_check() will set the
skb->ip_summed = CHECKSUM_UNNECESSARY;
skb->csum_level = 0;
Then udp_gro_receive() will flush the packet which is not CHECKSUM_PARTIAL,
It is not our expect,  because check=0 in udp header indicates this
packet is no need to caculate checksum, we should go further to do GRO.

This patch changes the value of csum_cnt according to skb->csum_level.
---
 include/linux/netdevice.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1377d08..9c819f1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2764,6 +2764,7 @@ static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
 		 * during GRO. This saves work if we fallback to normal path.
 		 */
 		__skb_incr_checksum_unnecessary(skb);
+		NAPI_GRO_CB(skb)->csum_cnt = skb->csum_level + 1;
 	}
 }
 
-- 
1.8.3.1


^ permalink raw reply related

* Re: [PATCH iproute2-next v2] devlink: Add health command support
From: David Ahern @ 2019-01-23  3:37 UTC (permalink / raw)
  To: Aya Levin, netdev, David S. Miller, Jiri Pirko
  Cc: Moshe Shemesh, Eran Ben Elisha, Tal Alon, Ariel Almog
In-Reply-To: <1547976434-4142-1-git-send-email-ayal@mellanox.com>

On 1/20/19 2:27 AM, Aya Levin wrote:
> diff --git a/devlink/devlink.c b/devlink/devlink.c
> index 3651e90c1159..9fc19668ccd0 100644
> --- a/devlink/devlink.c
> +++ b/devlink/devlink.c
> @@ -1,4 +1,5 @@
>  /*
> + *

extra newline

>   * devlink.c	Devlink tool
>   *
>   *              This program is free software; you can redistribute it and/or
> @@ -22,7 +23,7 @@
>  #include <linux/devlink.h>
>  #include <libmnl/libmnl.h>
>  #include <netinet/ether.h>
> -
> +#include <sys/sysinfo.h>
>  #include "SNAPSHOT.h"
>  #include "list.h"
>  #include "mnlg.h"
> @@ -40,6 +41,12 @@
>  #define PARAM_CMODE_DRIVERINIT_STR "driverinit"
>  #define PARAM_CMODE_PERMANENT_STR "permanent"
>  
> +#define HEALTH_REPORTER_STATE_HEALTHY_STR "healthy"
> +#define HEALTH_REPORTER_STATE_ERROR_STR "error"
> +#define HEALTH_REPORTER_GRACE_PERIOD_STR "grace_period"
> +#define HEALTH_REPORTER_AUTO_RECOVER_STR "auto_recover"
> +#define HEALTH_REPORTER_TS_LEN 80
> +
>  static int g_new_line_count;
>  
>  #define pr_err(args...) fprintf(stderr, ##args)
> @@ -199,6 +206,10 @@ static void ifname_map_free(struct ifname_map *ifname_map)
>  #define DL_OPT_REGION_SNAPSHOT_ID	BIT(22)
>  #define DL_OPT_REGION_ADDRESS		BIT(23)
>  #define DL_OPT_REGION_LENGTH		BIT(24)
> +#define DL_OPT_HANDLE_HEALTH		BIT(25)
> +#define DL_OPT_HEALTH_REPORTER_NAME	BIT(26)
> +#define DL_OPT_HEALTH_REPORTER_DEV	BIT(27)
> +
>  

extra newline


>  struct dl_opts {
>  	uint32_t present; /* flags of present items */
> @@ -230,6 +241,10 @@ struct dl_opts {
>  	uint32_t region_snapshot_id;
>  	uint64_t region_address;
>  	uint64_t region_length;
> +	const char *reporter_name;
> +	const char *reporter_param_name;
> +	const char *reporter_param_value;
> +
>  };
>  
>  struct dl {
> @@ -959,7 +974,7 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required,
>  		if (err)
>  			return err;
>  		o_found |= handle_bit;
> -	} else if (o_required & DL_OPT_HANDLE) {
> +	} else if (DL_OPT_HANDLE) {

typo? Seems like o_required is required.


>  		err = dl_argv_handle(dl, &opts->bus_name, &opts->dev_name);
>  		if (err)
>  			return err;
> @@ -1178,6 +1193,15 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required,
>  			if (err)
>  				return err;
>  			o_found |= DL_OPT_REGION_LENGTH;
> +		} else if (dl_argv_match(dl, "reporter") &&
> +			   (o_all & DL_OPT_HEALTH_REPORTER_NAME)) {
> +			dl_arg_inc(dl);
> +			err = dl_argv_str(dl, &opts->reporter_name);
> +			if (err)
> +				return err;
> +			o_found |= DL_OPT_HEALTH_REPORTER_NAME;
> +			o_found |= DL_OPT_HANDLE;
> +			break;

why the break? It is the only option that breaks after a match. If it is
required, please add a comment why for future readers.


>  		} else {
>  			pr_err("Unknown option \"%s\"\n", dl_argv(dl));
>  			return -EINVAL;
> @@ -1298,6 +1322,12 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required,
>  		return -EINVAL;
>  	}
>  
> +	if ((o_required & DL_OPT_HEALTH_REPORTER_NAME) &&
> +	    !(o_found & DL_OPT_HEALTH_REPORTER_NAME)) {
> +		pr_err("Reporter name expected.\n");
> +		return -EINVAL;
> +	}

I realize your are following suit with this change, but these checks for
'required and not found' are getting really long. There is a better way
to do this.


> +
>  	return 0;
>  }
>  
> @@ -1382,6 +1412,9 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl)
>  	if (opts->present & DL_OPT_REGION_LENGTH)
>  		mnl_attr_put_u64(nlh, DEVLINK_ATTR_REGION_CHUNK_LEN,
>  				 opts->region_length);
> +	if (opts->present & DL_OPT_HEALTH_REPORTER_NAME)
> +		mnl_attr_put_strz(nlh, DEVLINK_ATTR_HEALTH_REPORTER_NAME,
> +				  opts->reporter_name);
>  }
>  
>  static int dl_argv_parse_put(struct nlmsghdr *nlh, struct dl *dl,
> @@ -1513,6 +1546,8 @@ static void __pr_out_handle_start(struct dl *dl, struct nlattr **tb,
>  				__pr_out_newline();
>  				__pr_out_indent_inc();
>  				arr_last_handle_set(dl, bus_name, dev_name);
> +			} else {
> +				__pr_out_indent_inc();
>  			}
>  		} else {
>  			pr_out("%s%s", buf, content ? ":" : "");
> @@ -5557,11 +5592,502 @@ static int cmd_region(struct dl *dl)
>  	return -ENOENT;
>  }
>  
> +static int cmd_health_set_params(struct dl *dl)
> +{
> +	struct nlmsghdr *nlh;
> +	uint64_t period;
> +	bool auto_recover;
> +	int err;
> +
> +	nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_HEALTH_REPORTER_SET,
> +			       NLM_F_REQUEST | NLM_F_ACK);
> +	err = dl_argv_parse(dl, DL_OPT_HANDLE |
> +			    DL_OPT_HEALTH_REPORTER_NAME, 0);
> +	if (err)
> +		return err;
> +
> +	err = dl_argv_str(dl, &dl->opts.reporter_param_name);
> +	if (err)
> +		return err;
> +	err = dl_argv_str(dl, &dl->opts.reporter_param_value);
> +	if (err)
> +		return err;
> +	dl_opts_put(nlh, dl);
> +
> +	if (!strncmp(dl->opts.reporter_param_name,
> +		     HEALTH_REPORTER_GRACE_PERIOD_STR, strlen("garce"))) {
> +		err = strtouint64_t(dl->opts.reporter_param_value, &period);
> +		if (err)
> +			goto err_param_value_parse;
> +		mnl_attr_put_u64(nlh, DEVLINK_ATTR_HEALTH_REPORTER_PERIOD,
> +				 period);
> +	} else if (!strncmp(dl->opts.reporter_param_name,
> +			    HEALTH_REPORTER_AUTO_RECOVER_STR,
> +			    strlen("auto"))) {
> +		err = strtobool(dl->opts.reporter_param_value, &auto_recover);
> +		if (err)
> +			goto err_param_value_parse;
> +		mnl_attr_put_u8(nlh, DEVLINK_ATTR_HEALTH_REPORTER_AUTO_REC,
> +				(uint8_t)auto_recover);
> +	} else {
> +		printf("Parameter name: %s  is not supported\n",
> +		       dl->opts.reporter_param_name);
> +		return -ENOTSUP;
> +	}
> +
> +	return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL);
> +
> +err_param_value_parse:
> +	pr_err("Value \"%s\" is not a number or not within range\n",
> +	       dl->opts.param_value);
> +	return err;
> +}
> +
> +static int cmd_health_dump_clear(struct dl *dl)
> +{
> +	struct nlmsghdr *nlh;
> +	int err;
> +
> +	nlh = mnlg_msg_prepare(dl->nlg,
> +			       DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,
> +			       NLM_F_REQUEST | NLM_F_ACK);
> +
> +	err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE |
> +				DL_OPT_HEALTH_REPORTER_NAME, 0);
> +	if (err)
> +		return err;
> +
> +	dl_opts_put(nlh, dl);
> +	return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL);
> +}
> +
> +static int health_value_show(struct dl *dl, int type, struct nlattr *nl_data)
> +{
> +	const char *str;
> +	uint8_t *data;
> +	uint32_t len;
> +	uint64_t u64;
> +	uint32_t u32;
> +	uint16_t u16;
> +	uint8_t u8;
> +	int i;
> +
> +	switch (type) {
> +	case MNL_TYPE_FLAG:
> +		if (dl->json_output)
> +			jsonw_string(dl->jw, nl_data ? "true" : "false");
> +		else
> +			pr_out("%s ", nl_data ? "true" : "false");
> +		break;
> +	case MNL_TYPE_U8:
> +		u8 = mnl_attr_get_u8(nl_data);
> +		if (dl->json_output)
> +			jsonw_uint(dl->jw, u8);
> +		else
> +			pr_out("%u ", u8);
> +		break;
> +	case MNL_TYPE_U16:
> +		u16 = mnl_attr_get_u16(nl_data);
> +		if (dl->json_output)
> +			jsonw_uint(dl->jw, u16);
> +		else
> +			pr_out("%u ", u16);
> +		break;
> +	case MNL_TYPE_U32:
> +		u32 = mnl_attr_get_u32(nl_data);
> +		if (dl->json_output)
> +			jsonw_uint(dl->jw, u32);
> +		else
> +			pr_out("%u ", u32);
> +		break;
> +	case MNL_TYPE_U64:
> +		u64 = mnl_attr_get_u64(nl_data);
> +		if (dl->json_output)
> +			jsonw_u64(dl->jw, u64);
> +		else
> +			pr_out("%lu ", u64);
> +		break;
> +	case MNL_TYPE_STRING:
> +	case MNL_TYPE_NUL_STRING:
> +		str = mnl_attr_get_str(nl_data);
> +		if (dl->json_output)
> +			jsonw_string(dl->jw, str);
> +		else
> +			pr_out("%s ", str);
> +		break;
> +	case MNL_TYPE_BINARY:
> +		len = mnl_attr_get_payload_len(nl_data);
> +		data = mnl_attr_get_payload(nl_data);
> +		i = 0;
> +		while (i < len) {
> +			if (dl->json_output)
> +				jsonw_printf(dl->jw, "%d", data[i]);
> +			else
> +				pr_out("%02x ", data[i]);
> +			i++;
> +		}

If 'len' is an arbitrary size then line lengths can be ridiculous here.


> +		break;
> +	default:
> +		return -EINVAL;
> +	}
> +	return MNL_CB_OK;
> +}
> +

...

> +static int jiffies_to_logtime(uint64_t jiffies, char *output)
> +{
> +	struct sysinfo s_info;
> +	struct tm *info;
> +	time_t now, sec;
> +	int err;
> +
> +	time(&now);
> +	info = localtime(&now);
> +	strftime(output, HEALTH_REPORTER_TS_LEN, "%Y-%b-%d %H:%M:%S", info);

This strftime should really be done in the error path of sysinfo as
opposed to every call to this function calling strftime twice.

> +	err = sysinfo(&s_info);
> +	if (err)
> +		return err;
> +	/*substruct uptime in sec from now
> +	 * add jiffies and 5 minutes factor*/

fix the comment style.


> +	sec = now - (s_info.uptime - jiffies/1000) + 300;
> +	info = localtime(&sec);
> +	strftime(output, HEALTH_REPORTER_TS_LEN, "%Y-%b-%d %H:%M:%S", info);
> +
> +	return 0;
> +}
> +


^ permalink raw reply

* Re: [PATCH v3 0/5] net: Add support for Qualcomm ethqos
From: David Miller @ 2019-01-23  3:38 UTC (permalink / raw)
  To: vkoul
  Cc: netdev, linux-arm-msm, niklas.cassel, bjorn.andersson, robh+dt,
	mark.rutland, devicetree, peppe.cavallaro, alexandre.torgue,
	joabreu, andrew, f.fainelli, vivien.didelot
In-Reply-To: <20190121091318.20079-1-vkoul@kernel.org>

From: Vinod Koul <vkoul@kernel.org>
Date: Mon, 21 Jan 2019 14:43:13 +0530

> Some Qualcomm SoCs sport a ethqos controller which use DW ip, so add
> the glue driver which uses stmmac driver along with DT bindings for
> this device.
> 
> This controller supports rgmii mode and doesn't work with existing
> phy drivers as they do not remove the phy delay delay in this mode,
> so fix the two phy drivers tested with this.
> 
> Changes in v3:
>  - Add description in DT and rename the file and compatible as suggested by
>    Rob
>  - Update changelog for QCA8K driver
>  - Update AT803x phy disable delay for all RGMxx modes
> 
> Changes in v2:
>  - Fix the example in dt-binding
>  - Remove DT property for disable the delay and disable delay for RGMII mode
>    in AT803x and QCA8K PHY drivers

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next] devlink: Add missing check of nlmsg_put
From: David Miller @ 2019-01-23  4:09 UTC (permalink / raw)
  To: yuehaibing; +Cc: jiri, netdev, kernel-janitors
In-Reply-To: <1548063293-17855-1-git-send-email-yuehaibing@huawei.com>

From: YueHaibing <yuehaibing@huawei.com>
Date: Mon, 21 Jan 2019 09:34:53 +0000

> nlmsg_put may fail, this fix add a check of its return value.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Applied.

^ permalink raw reply

* Re: [v3, 0/6] External trigger stamp fifo support for ptp_qoriq
From: David Miller @ 2019-01-23  4:23 UTC (permalink / raw)
  To: yangbo.lu
  Cc: netdev, devicetree, linux-arm-kernel, richardcochran, robh+dt,
	shawnguo
In-Reply-To: <20190121104143.46782-1-yangbo.lu@nxp.com>

From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Mon, 21 Jan 2019 18:41:37 +0800

> This patch-set is to add external trigger stamp fifo support by a new
> binding "fsl,extts-fifo", and to add fiper pulse loopback support which
> is very useful for validating trigger without external hardware.
> Also fixed issues in interrupt enabling/handling.
> 
> "fsl,extts-fifo" is required to be added into 1588 timer dts node whose
> hardware supports it. The work will be done for some QorIQ platforms dts in
> the near future.

Series applied to net-next.

^ permalink raw reply

* Re: [PATCH] ath: move spin_lock_bh to spin_lock in tasklet
From: Kalle Valo @ 2019-01-23  4:25 UTC (permalink / raw)
  To: 姜智伟
  Cc: ath9k-devel, davem, linux-wireless, netdev, linux-kernel
In-Reply-To: <CANHzP_uiEoYaSg4fC1gHHjc=gRLjaxt8S3=p6a-rkg5-WjR7MA@mail.gmail.com>

姜智伟 <qq282012236@gmail.com> writes:

> Will do, thanks! 

Also don't send HTML mail :) Maillists drop those automatically.

-- 
Kalle Valo

^ permalink raw reply

* [PATCH v2 bpf] bpf: sock recvbuff must be limited by rmem_max in bpf_setsockopt()
From: Yafang Shao @ 2019-01-23  4:37 UTC (permalink / raw)
  To: kafai, brakmo, ast, daniel; +Cc: netdev, shaoyafang, Yafang Shao

When sock recvbuff is set by bpf_setsockopt(), the value must by limited
by rmem_max.
It is the same with sendbuff.

Fixes: 8c4b4c7e9ff0 ("bpf: Add setsockopt helper function to bpf")
Acked-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Lawrence Brakmo <brakmo@fb.com>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 net/core/filter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/filter.c b/net/core/filter.c
index 7559d68..7a54dc1 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4112,10 +4112,12 @@ static unsigned long bpf_xdp_copy(void *dst_buff, const void *src_buff,
 		/* Only some socketops are supported */
 		switch (optname) {
 		case SO_RCVBUF:
+			val = min_t(u32, val, sysctl_rmem_max);
 			sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
 			sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF);
 			break;
 		case SO_SNDBUF:
+			val = min_t(u32, val, sysctl_wmem_max);
 			sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
 			sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
 			break;
-- 
1.8.3.1


^ permalink raw reply related

* Re: [PATCH net-next 0/4] selftests: forwarding: Add tests for VXLAN routing
From: David Miller @ 2019-01-23  4:41 UTC (permalink / raw)
  To: idosch; +Cc: netdev, roopa, mlxsw
In-Reply-To: <20190121132231.25507-1-idosch@mellanox.com>

From: Ido Schimmel <idosch@mellanox.com>
Date: Mon, 21 Jan 2019 13:22:51 +0000

> VXLAN routing allows hosts in different overlay networks (i.e.,
> different VNIs) to communicate with one another.
> 
> Two popular routing models are asymmetric and symmetric routing.
> 
> In asymmetric routing the ingress VTEP routes the packet into the
> correct VXLAN tunnel, whereas the egress VTEP only bridges the packet to
> the correct host. Therefore, packets in different directions use
> different VNIs - the target VNI.
> 
> In symmetric routing both the ingress and egress VTEPs perform routing
> in the overlay network into / from the VXLAN tunnel. Packets in
> different directions use the same VNI - the L3 VNI. Different tenants
> (VRFs) use different L3 VNIs.
> 
> Patch #1 adds a test for asymmetric routing. Patches #2-#3 reuse the
> topology and add test cases for ARP decapsulation and suppression.
> 
> Patch #4 adds a test for symmetric routing.

Series applied, thanks!

^ permalink raw reply

* Re: [PATCH] net/ipv6: lower the level of "link is not ready" messages
From: David Miller @ 2019-01-23  4:43 UTC (permalink / raw)
  To: lkundrak; +Cc: kuznet, yoshfuji, netdev, linux-kernel, thaller
In-Reply-To: <20190121135419.615989-1-lkundrak@v3.sk>

From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 21 Jan 2019 14:54:20 +0100

> This message gets logged far too often for how interesting is it.
> 
> Most distributions nowadays configure NetworkManager to use randomly
> generated MAC addresses for Wi-Fi network scans. The interfaces end up
> being periodically brought down for the address change. When they're
> subsequently brought back up, the message is logged, eventually flooding
> the log.
> 
> Perhaps the message is not all that helpful: it seems to be more
> interesting to hear when the addrconf actually start, not when it does
> not. Let's lower its level.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

This has always bugged me too.

Applied, thanks!

^ permalink raw reply

* Re: [PATCH net-next] cxgb4/cxgb4vf: Link management changes
From: David Miller @ 2019-01-23  4:43 UTC (permalink / raw)
  To: vishal; +Cc: netdev, nirranjan, indranil, dt, leedom, arjun
In-Reply-To: <1548070931-18613-1-git-send-email-vishal@chelsio.com>

From: Vishal Kulkarni <vishal@chelsio.com>
Date: Mon, 21 Jan 2019 17:12:11 +0530

> 1) Speed should be supported by Physical Port Capabilities.
> 2) report Forward Error Correction mode which are available.
> 3) Added few comments.
> 
> Signed-off-by: Casey Leedom <leedom@chelsio.com>
> Signed-off-by: Vishal Kulkarni <vishal@chelsio.com>
> Signed-off-by: Arjun Vynipadath <arjun@chelsio.com>

Applied.

^ permalink raw reply

* Re: [PATCH] net: fec: get regulator optional
From: David Miller @ 2019-01-23  4:52 UTC (permalink / raw)
  To: stefan
  Cc: fugang.duan, marcel.ziswiler, max.krummenacher, dev, netdev,
	linux-kernel
In-Reply-To: <20190121145847.30223-1-stefan@agner.ch>

From: Stefan Agner <stefan@agner.ch>
Date: Mon, 21 Jan 2019 15:58:47 +0100

> According to the device tree binding the phy-supply property is
> optional. Use the regulator_get_optional API accordingly. The
> code already handles NULL just fine.
> 
> This gets rid of the following warning:
>   fec 2188000.ethernet: 2188000.ethernet supply phy not found, using dummy regulator
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>

Applied.

^ permalink raw reply

* Re: [PATCH net-next 0/2] SPDX tags for PHY and MDIO drivers
From: David Miller @ 2019-01-23  4:53 UTC (permalink / raw)
  To: andrew; +Cc: netdev, f.fainelli, hkallweit1
In-Reply-To: <1548093951-15765-1-git-send-email-andrew@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 21 Jan 2019 19:05:49 +0100

> This patchset adds SPDX tags to files where the license information is
> clear and consistent. It also removes redundent license text when an
> SPDX header is present.

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH] net: phy: Fixup GPLv2+ SPDX tags based on license text
From: David Miller @ 2019-01-23  4:57 UTC (permalink / raw)
  To: andrew; +Cc: netdev, f.fainelli, hkallweit1, david.wu, lidongpo, schmitzmic
In-Reply-To: <1548094129-15993-1-git-send-email-andrew@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 21 Jan 2019 19:08:49 +0100

> A few PHY drivers have the GPLv2+ license text. They then either have
> a MODULE_LICENSE() of GPLv2 only, or an SPDX tag of GPLv2 only.
> 
> Since the license text is much easier to understand than either the
> SPDX tag or the MODULE_LICENSE, use it as the definitive source of the
> licence, and fixup the others when there are contradictions.
> 
> Cc: David Wu <david.wu@rock-chips.com>
> Cc: Dongpo Li <lidongpo@hisilicon.com>
> Cc: Michael Schmitz <schmitzmic@gmail.com>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Applied, thanks for fixing this Andrew.

^ permalink raw reply

* Re: [PATCH net-next] net: phy: Fixup GPLv2 SPDX tags based on license text
From: David Miller @ 2019-01-23  4:58 UTC (permalink / raw)
  To: andrew
  Cc: netdev, f.fainelli, hkallweit1, rmk+kernel, jonas.jensen,
	laurentp, paulius.zaleckas, scottwood
In-Reply-To: <1548094219-16119-1-git-send-email-andrew@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 21 Jan 2019 19:10:19 +0100

> A few PHY drivers have the GPLv2 license text. They then either have
> a MODULE_LICENSE() of GPLv2+, or an SPDX tag of GPLv2+.
> 
> Since the license text is much easier to understand than either the
> SPDX tag or the MODULE_LICENSE, use it as the definitive source of the
> licence, and fixup with others when there are contradictions.
> 
> Cc: Russell King <rmk+kernel@armlinux.org.uk>
> Cc: Jonas Jensen <jonas.jensen@gmail.com>
> Cc: Laurent Pinchart <laurentp@cse-semaphore.com>
> Cc: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
> Cc: Scott Wood <scottwood@freescale.com>
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> Acked-by: Andrew F. Davis <afd@ti.com>
> Acked-by: Dan Murphy <dmurphy@ti.com>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Applied.

^ permalink raw reply

* Re: [PATCH] devlink: Use DIV_ROUND_UP_ULL in DEVLINK_HEALTH_SIZE_TO_BUFFERS
From: David Miller @ 2019-01-23  5:00 UTC (permalink / raw)
  To: natechancellor; +Cc: jiri, eranbe, moshe, netdev, linux-kernel
In-Reply-To: <20190122042301.14142-1-natechancellor@gmail.com>

From: Nathan Chancellor <natechancellor@gmail.com>
Date: Mon, 21 Jan 2019 21:23:01 -0700

> When building this code on a 32-bit platform such as ARM, there is a
> link time error (lld error shown, happpens with ld.bfd too):
> 
> ld.lld: error: undefined symbol: __aeabi_uldivmod
>>>> referenced by devlink.c
>>>>               net/core/devlink.o:(devlink_health_buffers_create) in archive built-in.a
> 
> This happens when using a regular division symbol with a u64 dividend.
> Use DIV_ROUND_UP_ULL, which wraps do_div, to avoid this situation.
> 
> Fixes: cb5ccfbe73b3 ("devlink: Add health buffer support")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Applied to net-next.

^ permalink raw reply

* Re: [PATCH net-next 1/1] bnx2x: Bump up driver version to 1.713.36
From: David Miller @ 2019-01-23  5:02 UTC (permalink / raw)
  To: sudarsana.kalluru; +Cc: netdev, Michal.Kalderon
In-Reply-To: <20190122110520.15961-1-sudarsana.kalluru@cavium.com>

From: Sudarsana Reddy Kalluru <sudarsana.kalluru@cavium.com>
Date: Tue, 22 Jan 2019 03:05:20 -0800

> Recently, there were bunch of fixes to bnx2x driver, the code is now
> aligned to out-of-box driver version 1.713.36. This patch updates
> bnx2x driver version to 1.713.36.
> 
> Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
> Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>

Applied.

^ permalink raw reply


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