* RE: [PATCH net-next v2 3/3] enetc: Add ENETC PF level external MDIO support
From: Claudiu Manoil @ 2019-02-15 14:41 UTC (permalink / raw)
To: Andrew Lunn
Cc: Shawn Guo, Leo Li, David S . Miller, Alexandru Marginean,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20190215133459.GH5699@lunn.ch>
>-----Original Message-----
>From: Andrew Lunn <andrew@lunn.ch>
>Sent: Friday, February 15, 2019 3:35 PM
>To: Claudiu Manoil <claudiu.manoil@nxp.com>
>Cc: Shawn Guo <shawnguo@kernel.org>; Leo Li <leoyang.li@nxp.com>; David S .
>Miller <davem@davemloft.net>; Alexandru Marginean
><alexandru.marginean@nxp.com>; linux-arm-kernel@lists.infradead.org;
>devicetree@vger.kernel.org; netdev@vger.kernel.org; linux-
>kernel@vger.kernel.org
>Subject: Re: [PATCH net-next v2 3/3] enetc: Add ENETC PF level external MDIO
>support
>
>On Fri, Feb 15, 2019 at 12:10:14PM +0200, Claudiu Manoil wrote:
>> Each ENETC PF has its own MDIO interface, the corresponding
>> MDIO registers are mapped in the ENETC's Port register block.
>> The current patch adds a driver for these PF level MDIO buses,
>> so that each PF can manage directly its own external link.
>>
>> Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
>> Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
>> ---
>> v2 - used readx_poll_timeout()
>> - added mdio node child to the port node
>
>Hi Claudiu
>
>Please document this in the device tree binding.
>
Hi,
I don't really see what bindings would need to be documented, as the node
names and properties used so far are common. Like, the "mdio" node name
is common, the enetc ports are "pci" nodes, nothing special for these.
What's missing?
Regards,
Claudiu
^ permalink raw reply
* [net-next 0/5] clean up SOCK_DEBUG()
From: Yafang Shao @ 2019-02-15 14:49 UTC (permalink / raw)
To: davem; +Cc: daniel, edumazet, netdev, shaoyafang, Yafang Shao
Per discussion with Daniel[1] and Eric[2], the SOCK_DEBUG() is a very
ancient interface, which is not very useful for debugging.
So we'd better clean up it.
After this patchset, the SO_DEBUG interface will not take any effect,
but I still keep it as-is in sock_{s,g}etsockopt() to avoid breaking
applications.
[1] https://patchwork.ozlabs.org/patch/1035573/
[2] https://patchwork.ozlabs.org/patch/1040533
Yafang Shao (5):
tcp: clean up SOCK_DEBUG()
x25: clean up SOCK_DEBUG()
appletalk: clean up SOCK_DEBUG()
dccp: clean up SOCK_DEBUG()
net: sock: remove the definition of SOCK_DEBUG()
include/net/sock.h | 19 -------------------
net/appletalk/ddp.c | 14 --------------
net/core/sock.c | 3 +++
net/dccp/ipv6.c | 2 --
net/ipv4/tcp_input.c | 19 +------------------
net/ipv6/tcp_ipv6.c | 2 --
net/x25/af_x25.c | 12 ------------
net/x25/x25_facilities.c | 32 ++++++++++----------------------
net/x25/x25_out.c | 4 +---
9 files changed, 15 insertions(+), 92 deletions(-)
--
1.8.3.1
^ permalink raw reply
* [net-next 1/5] tcp: clean up SOCK_DEBUG()
From: Yafang Shao @ 2019-02-15 14:49 UTC (permalink / raw)
To: davem; +Cc: daniel, edumazet, netdev, shaoyafang, Yafang Shao
In-Reply-To: <1550242187-29660-1-git-send-email-laoar.shao@gmail.com>
Per discussion with Daniel[1] and Eric[2], the SOCK_DEBUG() is a very
ancient interface, which is not very useful for debugging.
So we'd better clean up it.
This patch cleans up it for TCP.
[1] https://patchwork.ozlabs.org/patch/1035573/
[2] https://patchwork.ozlabs.org/patch/1040533/
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
net/ipv4/tcp_input.c | 19 +------------------
net/ipv6/tcp_ipv6.c | 2 --
2 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 7a027dec..6d2750e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3595,7 +3595,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
* this segment (RFC793 Section 3.9).
*/
if (after(ack, tp->snd_nxt))
- goto invalid_ack;
+ return -1;
if (after(ack, prior_snd_una)) {
flag |= FLAG_SND_UNA_ADVANCED;
@@ -3714,10 +3714,6 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
tcp_process_tlp_ack(sk, ack, flag);
return 1;
-invalid_ack:
- SOCK_DEBUG(sk, "Ack %u after %u:%u\n", ack, tp->snd_una, tp->snd_nxt);
- return -1;
-
old_ack:
/* If data was SACKed, tag it and see if we should send more data.
* If data was DSACKed, see if we can undo a cwnd reduction.
@@ -3731,7 +3727,6 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
tcp_xmit_recovery(sk, rexmit);
}
- SOCK_DEBUG(sk, "Ack %u before %u:%u\n", ack, tp->snd_una, tp->snd_nxt);
return 0;
}
@@ -4432,13 +4427,9 @@ static void tcp_ofo_queue(struct sock *sk)
rb_erase(&skb->rbnode, &tp->out_of_order_queue);
if (unlikely(!after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt))) {
- SOCK_DEBUG(sk, "ofo packet was already received\n");
tcp_drop(sk, skb);
continue;
}
- SOCK_DEBUG(sk, "ofo requeuing : rcv_next %X seq %X - %X\n",
- tp->rcv_nxt, TCP_SKB_CB(skb)->seq,
- TCP_SKB_CB(skb)->end_seq);
tail = skb_peek_tail(&sk->sk_receive_queue);
eaten = tail && tcp_try_coalesce(sk, tail, skb, &fragstolen);
@@ -4502,8 +4493,6 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOQUEUE);
seq = TCP_SKB_CB(skb)->seq;
end_seq = TCP_SKB_CB(skb)->end_seq;
- SOCK_DEBUG(sk, "out of order segment: rcv_next %X seq %X - %X\n",
- tp->rcv_nxt, seq, end_seq);
p = &tp->out_of_order_queue.rb_node;
if (RB_EMPTY_ROOT(&tp->out_of_order_queue)) {
@@ -4779,10 +4768,6 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
if (before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) {
/* Partial packet, seq < rcv_next < end_seq */
- SOCK_DEBUG(sk, "partial packet: rcv_next %X seq %X - %X\n",
- tp->rcv_nxt, TCP_SKB_CB(skb)->seq,
- TCP_SKB_CB(skb)->end_seq);
-
tcp_dsack_set(sk, TCP_SKB_CB(skb)->seq, tp->rcv_nxt);
/* If window is closed, drop tail of packet. But after
@@ -5061,8 +5046,6 @@ static int tcp_prune_queue(struct sock *sk)
{
struct tcp_sock *tp = tcp_sk(sk);
- SOCK_DEBUG(sk, "prune_queue: c=%x\n", tp->copied_seq);
-
NET_INC_STATS(sock_net(sk), LINUX_MIB_PRUNECALLED);
if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index e51cda7..57ef69a1 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -220,8 +220,6 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
u32 exthdrlen = icsk->icsk_ext_hdr_len;
struct sockaddr_in sin;
- SOCK_DEBUG(sk, "connect: ipv4 mapped\n");
-
if (__ipv6_only_sock(sk))
return -ENETUNREACH;
--
1.8.3.1
^ permalink raw reply related
* [net-next 2/5] x25: clean up SOCK_DEBUG()
From: Yafang Shao @ 2019-02-15 14:49 UTC (permalink / raw)
To: davem; +Cc: daniel, edumazet, netdev, shaoyafang, Yafang Shao
In-Reply-To: <1550242187-29660-1-git-send-email-laoar.shao@gmail.com>
Per discussion with Daniel[1] and Eric[2], the SOCK_DEBUG() is a very
ancient interface, which is not very useful for debugging.
So we'd better clean up it.
This patch cleans up it for x25.
[1] https://patchwork.ozlabs.org/patch/1035573/
[2] https://patchwork.ozlabs.org/patch/1040533/
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
net/x25/af_x25.c | 12 ------------
net/x25/x25_facilities.c | 32 ++++++++++----------------------
net/x25/x25_out.c | 4 +---
3 files changed, 11 insertions(+), 37 deletions(-)
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 5121729..5892d05 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -705,7 +705,6 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
x25_insert_socket(sk);
sock_reset_flag(sk, SOCK_ZAPPED);
release_sock(sk);
- SOCK_DEBUG(sk, "x25_bind: socket is bound\n");
out:
return rc;
}
@@ -1148,11 +1147,7 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
goto out;
}
- SOCK_DEBUG(sk, "x25_sendmsg: sendto: Addresses built.\n");
-
/* Build a packet */
- SOCK_DEBUG(sk, "x25_sendmsg: sendto: building packet.\n");
-
if ((msg->msg_flags & MSG_OOB) && len > 32)
len = 32;
@@ -1170,8 +1165,6 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
/*
* Put the data on the end
*/
- SOCK_DEBUG(sk, "x25_sendmsg: Copying user data\n");
-
skb_reset_transport_header(skb);
skb_put(skb, len);
@@ -1194,8 +1187,6 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
/*
* Push down the X.25 header
*/
- SOCK_DEBUG(sk, "x25_sendmsg: Building X.25 Header.\n");
-
if (msg->msg_flags & MSG_OOB) {
if (x25->neighbour->extended) {
asmptr = skb_push(skb, X25_STD_MIN_LEN);
@@ -1228,9 +1219,6 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
skb->data[0] |= X25_Q_BIT;
}
- SOCK_DEBUG(sk, "x25_sendmsg: Built header.\n");
- SOCK_DEBUG(sk, "x25_sendmsg: Transmitting buffer\n");
-
rc = -ENOTCONN;
if (sk->sk_state != TCP_ESTABLISHED)
goto out_kfree_skb;
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c
index ad1734d..74a5284 100644
--- a/net/x25/x25_facilities.c
+++ b/net/x25/x25_facilities.c
@@ -286,10 +286,8 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
/*
* They want reverse charging, we won't accept it.
*/
- if ((theirs.reverse & 0x01 ) && (ours->reverse & 0x01)) {
- SOCK_DEBUG(sk, "X.25: rejecting reverse charging request\n");
+ if ((theirs.reverse & 0x01) && (ours->reverse & 0x01))
return -1;
- }
new->reverse = theirs.reverse;
@@ -298,37 +296,27 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
int theirs_out = theirs.throughput & 0xf0;
int ours_in = ours->throughput & 0x0f;
int ours_out = ours->throughput & 0xf0;
- if (!ours_in || theirs_in < ours_in) {
- SOCK_DEBUG(sk, "X.25: inbound throughput negotiated\n");
+ if (!ours_in || theirs_in < ours_in)
new->throughput = (new->throughput & 0xf0) | theirs_in;
- }
- if (!ours_out || theirs_out < ours_out) {
- SOCK_DEBUG(sk,
- "X.25: outbound throughput negotiated\n");
+
+ if (!ours_out || theirs_out < ours_out)
new->throughput = (new->throughput & 0x0f) | theirs_out;
- }
}
if (theirs.pacsize_in && theirs.pacsize_out) {
- if (theirs.pacsize_in < ours->pacsize_in) {
- SOCK_DEBUG(sk, "X.25: packet size inwards negotiated down\n");
+ if (theirs.pacsize_in < ours->pacsize_in)
new->pacsize_in = theirs.pacsize_in;
- }
- if (theirs.pacsize_out < ours->pacsize_out) {
- SOCK_DEBUG(sk, "X.25: packet size outwards negotiated down\n");
+
+ if (theirs.pacsize_out < ours->pacsize_out)
new->pacsize_out = theirs.pacsize_out;
- }
}
if (theirs.winsize_in && theirs.winsize_out) {
- if (theirs.winsize_in < ours->winsize_in) {
- SOCK_DEBUG(sk, "X.25: window size inwards negotiated down\n");
+ if (theirs.winsize_in < ours->winsize_in)
new->winsize_in = theirs.winsize_in;
- }
- if (theirs.winsize_out < ours->winsize_out) {
- SOCK_DEBUG(sk, "X.25: window size outwards negotiated down\n");
+
+ if (theirs.winsize_out < ours->winsize_out)
new->winsize_out = theirs.winsize_out;
- }
}
return len;
diff --git a/net/x25/x25_out.c b/net/x25/x25_out.c
index 0144271..2a74f26 100644
--- a/net/x25/x25_out.c
+++ b/net/x25/x25_out.c
@@ -77,9 +77,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb)
kfree_skb(skb);
return sent;
}
- SOCK_DEBUG(sk, "x25_output: fragment alloc"
- " failed, err=%d, %d bytes "
- "sent\n", err, sent);
+
return err;
}
--
1.8.3.1
^ permalink raw reply related
* [net-next 3/5] appletalk: clean up SOCK_DEBUG()
From: Yafang Shao @ 2019-02-15 14:49 UTC (permalink / raw)
To: davem; +Cc: daniel, edumazet, netdev, shaoyafang, Yafang Shao
In-Reply-To: <1550242187-29660-1-git-send-email-laoar.shao@gmail.com>
Per discussion with Daniel[1] and Eric[2], the SOCK_DEBUG() is a very
ancient interface, which is not very useful for debugging.
So we'd better clean up it.
This patch cleans up it for appletalk.
[1] https://patchwork.ozlabs.org/patch/1035573/
[2] https://patchwork.ozlabs.org/patch/1040533/
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
net/appletalk/ddp.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 9b6bc5a..326c4fd 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1608,8 +1608,6 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
}
/* Build a packet */
- SOCK_DEBUG(sk, "SK %p: Got address.\n", sk);
-
/* For headers */
size = sizeof(struct ddpehdr) + len + ddp_dl->header_length;
@@ -1628,10 +1626,6 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
goto out;
dev = rt->dev;
-
- SOCK_DEBUG(sk, "SK %p: Size needed %d, device %s\n",
- sk, size, dev->name);
-
size += dev->hard_header_len;
release_sock(sk);
skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err);
@@ -1643,8 +1637,6 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
skb_reserve(skb, dev->hard_header_len);
skb->dev = dev;
- SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk);
-
ddp = skb_put(skb, sizeof(struct ddpehdr));
ddp->deh_len_hops = htons(len + sizeof(*ddp));
ddp->deh_dnet = usat->sat_addr.s_net;
@@ -1654,8 +1646,6 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
ddp->deh_dport = usat->sat_port;
ddp->deh_sport = at->src_port;
- SOCK_DEBUG(sk, "SK %p: Copy user data (%zd bytes).\n", sk, len);
-
err = memcpy_from_msg(skb_put(skb, len), msg, len);
if (err) {
kfree_skb(skb);
@@ -1678,7 +1668,6 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
if (skb2) {
loopback = 1;
- SOCK_DEBUG(sk, "SK %p: send out(copy).\n", sk);
/*
* If it fails it is queued/sent above in the aarp queue
*/
@@ -1687,7 +1676,6 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
}
if (dev->flags & IFF_LOOPBACK || loopback) {
- SOCK_DEBUG(sk, "SK %p: Loop back.\n", sk);
/* loop back */
skb_orphan(skb);
if (ddp->deh_dnode == ATADDR_BCAST) {
@@ -1707,7 +1695,6 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
}
ddp_dl->request(ddp_dl, skb, dev->dev_addr);
} else {
- SOCK_DEBUG(sk, "SK %p: send out.\n", sk);
if (rt->flags & RTF_GATEWAY) {
gsat.sat_addr = rt->gateway;
usat = &gsat;
@@ -1718,7 +1705,6 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
*/
aarp_send_ddp(dev, skb, &usat->sat_addr, NULL);
}
- SOCK_DEBUG(sk, "SK %p: Done write (%zd).\n", sk, len);
out:
release_sock(sk);
--
1.8.3.1
^ permalink raw reply related
* [net-next 4/5] dccp: clean up SOCK_DEBUG()
From: Yafang Shao @ 2019-02-15 14:49 UTC (permalink / raw)
To: davem; +Cc: daniel, edumazet, netdev, shaoyafang, Yafang Shao
In-Reply-To: <1550242187-29660-1-git-send-email-laoar.shao@gmail.com>
Per discussion with Daniel[1] and Eric[2], the SOCK_DEBUG() is a very
ancient interface, which is not very useful for debugging.
So we'd better clean up it.
This patch cleans up it for dccp.
[1] https://patchwork.ozlabs.org/patch/1035573/
[2] https://patchwork.ozlabs.org/patch/1040533/
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
net/dccp/ipv6.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index d5740ba..8e72e50 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -878,8 +878,6 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
u32 exthdrlen = icsk->icsk_ext_hdr_len;
struct sockaddr_in sin;
- SOCK_DEBUG(sk, "connect: ipv4 mapped\n");
-
if (__ipv6_only_sock(sk))
return -ENETUNREACH;
--
1.8.3.1
^ permalink raw reply related
* [net-next 5/5] net: sock: remove the definition of SOCK_DEBUG()
From: Yafang Shao @ 2019-02-15 14:49 UTC (permalink / raw)
To: davem; +Cc: daniel, edumazet, netdev, shaoyafang, Yafang Shao
In-Reply-To: <1550242187-29660-1-git-send-email-laoar.shao@gmail.com>
As SOCK_DEBUG() isn't used any more, we can get ride of it now.
Regarding the SO_DEBUG in sock_{s,g}etsockopt, I think it is better to
keep as-is, because if we return an errno to tell the application that
this optname isn't supported, it may break the application.
The application still can use this option but don't take any effect from
now on.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
include/net/sock.h | 19 -------------------
net/core/sock.c | 3 +++
2 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 6679f3c..4c6b599 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -74,25 +74,6 @@
#include <net/smc.h>
#include <net/l3mdev.h>
-/*
- * This structure really needs to be cleaned up.
- * Most of it is for TCP, and not used by any of
- * the other protocols.
- */
-
-/* Define this to get the SOCK_DBG debugging facility. */
-#define SOCK_DEBUGGING
-#ifdef SOCK_DEBUGGING
-#define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \
- printk(KERN_DEBUG msg); } while (0)
-#else
-/* Validate arguments and do nothing */
-static inline __printf(2, 3)
-void SOCK_DEBUG(const struct sock *sk, const char *msg, ...)
-{
-}
-#endif
-
/* This is the per-socket lock. The spinlock provides a synchronization
* between user contexts and software interrupt processing, whereas the
* mini-semaphore synchronizes multiple users amongst themselves.
diff --git a/net/core/sock.c b/net/core/sock.c
index 71ded4d..a980ff3 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -753,6 +753,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
switch (optname) {
case SO_DEBUG:
+ /* This option doesn't take effect now,
+ * but we need to keep it for backward compatibility.
+ */
if (val && !capable(CAP_NET_ADMIN))
ret = -EACCES;
else
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH net-next v2 3/3] enetc: Add ENETC PF level external MDIO support
From: Andrew Lunn @ 2019-02-15 14:56 UTC (permalink / raw)
To: Claudiu Manoil
Cc: Shawn Guo, Leo Li, David S . Miller, Alexandru Marginean,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <VI1PR04MB488080895C871B6B3ABA571D96600@VI1PR04MB4880.eurprd04.prod.outlook.com>
> Hi,
> I don't really see what bindings would need to be documented, as the node
> names and properties used so far are common. Like, the "mdio" node name
> is common, the enetc ports are "pci" nodes, nothing special for these.
> What's missing?
Hi Claudiu
It is not well defined where to put phy nodes. Some drivers do allow
them directly in the MAC node, some drivers optionally allow an mdio
sub-node, others enforce an mdio sub-node. The name of the sub-node is
also not well defined.
So just documenting that the mdio sub-node is mandatory will help
people writing device trees for their boards.
Andrew
^ permalink raw reply
* Re: [net-next 5/5] net: sock: remove the definition of SOCK_DEBUG()
From: Eric Dumazet @ 2019-02-15 14:58 UTC (permalink / raw)
To: Yafang Shao; +Cc: David Miller, Daniel Borkmann, netdev, shaoyafang
In-Reply-To: <1550242187-29660-6-git-send-email-laoar.shao@gmail.com>
On Fri, Feb 15, 2019 at 6:50 AM Yafang Shao <laoar.shao@gmail.com> wrote:
>
> As SOCK_DEBUG() isn't used any more, we can get ride of it now.
>
No, we are still using this infrastructure from time to time.
I told you I agreed to remove the current (obsolete) TCP call sites,
I never suggested to remove SOCK_DEBUG() completely.
^ permalink raw reply
* [RFC] net: dsa: qca8k: implement rgmii-id mode
From: Michal Vokáč @ 2019-02-15 15:01 UTC (permalink / raw)
To: Vinod Koul, Andrew Lunn
Cc: David S. Miller, netdev, linux-kernel@vger.kernel.org,
Florian Fainelli
Hi,
networking on my boards [1], which are currently in linux-next, suddently
stopped working. I tracked it down to this commit 5ecdd77c61c8 ("net: dsa:
qca8k: disable delay for RGMII mode") [2].
So I think the rgmii-id mode is obviously needed in my case.
I was able to find a couple drivers that read tx/rx-delay or
tx/rx-internal-delay from device tree. Namely:
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
drivers/net/phy/dp83867.c
I would appreciate any hints how to add similar function to qca8k driver
if that is the correct way to go. Can I take some of the above mentioned
drivers as a good example for that? How should the binding look like?
I would expect something like this:
switch@0 {
compatible = "qca,qca8334";
reg = <0>;
switch_ports: ports {
#address-cells = <1>;
#size-cells = <0>;
ethphy0: port@0 {
reg = <0>;
label = "cpu";
phy-mode = "rgmii-id";
qca,tx-delay = <3>;
qca,rx-delay = <3>;
ethernet = <&fec>;
};
};
Thanks in advance,
Michal
[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=87489ec3a77f3e01bcf0d46e353ae7112ec8c4f0
[2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/dsa/qca8k.c?id=5ecdd77c61c8fe1d75ded538701e5e854963c890
^ permalink raw reply
* [PATCH][next] mlxsw: core: fix spelling mistake "temprature" -> "temperature"
From: Colin King @ 2019-02-15 15:11 UTC (permalink / raw)
To: Jiri Pirko, Ido Schimmel, David S . Miller, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
There is a spelling mistake in several dev_err messages, fix these.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
index f1ada4cdbd6b..6956bbebe2f1 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
@@ -208,7 +208,7 @@ static ssize_t mlxsw_hwmon_module_temp_show(struct device *dev,
1);
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mtbr), mtbr_pl);
if (err) {
- dev_err(dev, "Failed to query module temprature sensor\n");
+ dev_err(dev, "Failed to query module temperature sensor\n");
return err;
}
@@ -251,7 +251,7 @@ static ssize_t mlxsw_hwmon_module_temp_fault_show(struct device *dev,
1);
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mtbr), mtbr_pl);
if (err) {
- dev_err(dev, "Failed to query module temprature sensor\n");
+ dev_err(dev, "Failed to query module temperature sensor\n");
return err;
}
@@ -291,7 +291,7 @@ mlxsw_hwmon_module_temp_critical_show(struct device *dev,
err = mlxsw_env_module_temp_thresholds_get(mlxsw_hwmon->core, module,
SFP_TEMP_HIGH_WARN, &temp);
if (err) {
- dev_err(dev, "Failed to query module temprature thresholds\n");
+ dev_err(dev, "Failed to query module temperature thresholds\n");
return err;
}
@@ -314,7 +314,7 @@ mlxsw_hwmon_module_temp_emergency_show(struct device *dev,
err = mlxsw_env_module_temp_thresholds_get(mlxsw_hwmon->core, module,
SFP_TEMP_HIGH_ALARM, &temp);
if (err) {
- dev_err(dev, "Failed to query module temprature thresholds\n");
+ dev_err(dev, "Failed to query module temperature thresholds\n");
return err;
}
--
2.20.1
^ permalink raw reply related
* Re: [PATCH][next] mlxsw: core: fix spelling mistake "temprature" -> "temperature"
From: Ido Schimmel @ 2019-02-15 15:16 UTC (permalink / raw)
To: Colin King
Cc: Jiri Pirko, David S . Miller, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20190215151153.17206-1-colin.king@canonical.com>
On Fri, Feb 15, 2019 at 03:11:53PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> There is a spelling mistake in several dev_err messages, fix these.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Thanks!
^ permalink raw reply
* [PATCH net-next] net: sched: matchall: verify that filter is not NULL in mall_walk()
From: Vlad Buslov @ 2019-02-15 15:17 UTC (permalink / raw)
To: netdev; +Cc: idosch, jhs, xiyou.wangcong, jiri, davem, Vlad Buslov
Check that filter is not NULL before passing it to tcf_walker->fn()
callback. This can happen when mall_change() failed to offload filter to
hardware.
Fixes: ed76f5edccc9 ("net: sched: protect filter_chain list with filter_chain_lock mutex")
Reported-by: Ido Schimmel <idosch@mellanox.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
---
net/sched/cls_matchall.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
index a37137430e61..1f9d481b0fbb 100644
--- a/net/sched/cls_matchall.c
+++ b/net/sched/cls_matchall.c
@@ -247,6 +247,9 @@ static void mall_walk(struct tcf_proto *tp, struct tcf_walker *arg,
if (arg->count < arg->skip)
goto skip;
+
+ if (!head)
+ return;
if (arg->fn(tp, head, arg) < 0)
arg->stop = 1;
skip:
--
2.13.6
^ permalink raw reply related
* [PATCH net-next] net: sched: cgroup: verify that filter is not NULL during walk
From: Vlad Buslov @ 2019-02-15 15:18 UTC (permalink / raw)
To: netdev; +Cc: idosch, jhs, xiyou.wangcong, jiri, davem, Vlad Buslov
Check that filter is not NULL before passing it to tcf_walker->fn()
callback in cls_cgroup_walk(). This can happen when cls_cgroup_change()
failed to set first filter.
Fixes: ed76f5edccc9 ("net: sched: protect filter_chain list with filter_chain_lock mutex")
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
---
net/sched/cls_cgroup.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 1cef3b416094..02b05066b635 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -158,6 +158,8 @@ static void cls_cgroup_walk(struct tcf_proto *tp, struct tcf_walker *arg,
if (arg->count < arg->skip)
goto skip;
+ if (!head)
+ return;
if (arg->fn(tp, head, arg) < 0) {
arg->stop = 1;
return;
--
2.13.6
^ permalink raw reply related
* [PATCH net-next] net: sched: fw: don't set arg->stop in fw_walk() when empty
From: Vlad Buslov @ 2019-02-15 15:20 UTC (permalink / raw)
To: netdev; +Cc: idosch, jhs, xiyou.wangcong, jiri, davem, Vlad Buslov
Some classifiers set arg->stop in their implementation of tp->walk() API
when empty. Most of classifiers do not adhere to that convention. Do not
set arg->stop in fw_walk() to unify tp->walk() behavior among classifier
implementations.
Fixes: ed76f5edccc9 ("net: sched: protect filter_chain list with filter_chain_lock mutex")
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
---
net/sched/cls_fw.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 317151bae73b..4e34966f2ae2 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -362,10 +362,7 @@ static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg,
struct fw_head *head = rtnl_dereference(tp->root);
int h;
- if (head == NULL)
- arg->stop = 1;
-
- if (arg->stop)
+ if (head == NULL || arg->stop)
return;
for (h = 0; h < HTSIZE; h++) {
--
2.13.6
^ permalink raw reply related
* [PATCH net-next] net: sched: route: don't set arg->stop in route4_walk() when empty
From: Vlad Buslov @ 2019-02-15 15:21 UTC (permalink / raw)
To: netdev; +Cc: idosch, jhs, xiyou.wangcong, jiri, davem, Vlad Buslov
Some classifiers set arg->stop in their implementation of tp->walk() API
when empty. Most of classifiers do not adhere to that convention. Do not
set arg->stop in route4_walk() to unify tp->walk() behavior among
classifier implementations.
Fixes: ed76f5edccc9 ("net: sched: protect filter_chain list with filter_chain_lock mutex")
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
---
net/sched/cls_route.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index e590c3a2999d..444d15a75d98 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -567,10 +567,7 @@ static void route4_walk(struct tcf_proto *tp, struct tcf_walker *arg,
struct route4_head *head = rtnl_dereference(tp->root);
unsigned int h, h1;
- if (head == NULL)
- arg->stop = 1;
-
- if (arg->stop)
+ if (head == NULL || arg->stop)
return;
for (h = 0; h <= 256; h++) {
--
2.13.6
^ permalink raw reply related
* Re: [RFC] net: dsa: qca8k: implement rgmii-id mode
From: Andrew Lunn @ 2019-02-15 15:23 UTC (permalink / raw)
To: Michal Vokáč
Cc: Vinod Koul, David S. Miller, netdev, linux-kernel@vger.kernel.org,
Florian Fainelli
In-Reply-To: <0c7428dc-736e-c5c4-13e7-b42052c60cd7@ysoft.com>
On Fri, Feb 15, 2019 at 04:01:08PM +0100, Michal Vokáč wrote:
> Hi,
>
> networking on my boards [1], which are currently in linux-next, suddently
> stopped working. I tracked it down to this commit 5ecdd77c61c8 ("net: dsa:
> qca8k: disable delay for RGMII mode") [2].
>
> So I think the rgmii-id mode is obviously needed in my case.
> I was able to find a couple drivers that read tx/rx-delay or
> tx/rx-internal-delay from device tree. Namely:
>
> drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
> drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> drivers/net/phy/dp83867.c
>
> I would appreciate any hints how to add similar function to qca8k driver
> if that is the correct way to go. Can I take some of the above mentioned
> drivers as a good example for that? How should the binding look like?
>
> I would expect something like this:
>
> switch@0 {
> compatible = "qca,qca8334";
> reg = <0>;
>
> switch_ports: ports {
> #address-cells = <1>;
> #size-cells = <0>;
>
> ethphy0: port@0 {
> reg = <0>;
> label = "cpu";
> phy-mode = "rgmii-id";
> qca,tx-delay = <3>;
> qca,rx-delay = <3>;
> ethernet = <&fec>;
> };
Hi Michal
Your submission used:
+ ethphy0: port@0 {
+ reg = <0>;
+ label = "cpu";
+ phy-mode = "rgmii";
+ ethernet = <&fec>;
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
This is good. If you have a fixed-link you can pass a phy-mode.
The comment that was removed was:
- /* According to the datasheet, RGMII delay is enabled through
- * PORT5_PAD_CTRL for all ports, rather than individual port
- * registers
- */
Is it possible to enable delays per port? Ideally, you want to enable
delays for just selected ports. Add another case for
PHY_INTERFACE_MODE_RGMII_ID to enable the delays.
Andrew
^ permalink raw reply
* [PATCH net-next 03/13] net: mvpp2: do not disable the port if the mode hasn't changed
From: Antoine Tenart @ 2019-02-15 15:32 UTC (permalink / raw)
To: davem, linux
Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
stefanc, ymarkman, mw
In-Reply-To: <20190215153241.6857-1-antoine.tenart@bootlin.com>
The Marvell PPv2 implementation of the Phylink mac_config helper
disables and enables the port, as the link mode can trigger
reconfiguration of the serdes lanes. This patch helps not disabling the
port every time mac_config is called but only when needed, which is an
improvement as the Phylink state machine does call the function every
second.
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 8faa842dc17c..d5a103dd1610 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -4670,9 +4670,10 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode,
return;
}
- /* Make sure the port is disabled when reconfiguring the mode */
- mvpp2_port_disable(port);
if (change_interface) {
+ /* Make sure the port is disabled when reconfiguring the mode */
+ mvpp2_port_disable(port);
+
mvpp22_gop_mask_irq(port);
if (port->priv->hw_version == MVPP22) {
@@ -4682,6 +4683,8 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode,
phy_power_off(port->comphy);
mvpp22_mode_reconfigure(port);
}
+
+ mvpp2_port_enable(port);
}
/* mac (re)configuration */
@@ -4697,8 +4700,6 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode,
if (change_interface)
mvpp22_gop_unmask_irq(port);
-
- mvpp2_port_enable(port);
}
static void mvpp2_mac_link_up(struct net_device *dev, unsigned int mode,
--
2.20.1
^ permalink raw reply related
* Re: [PATCH net-next v4 07/17] net: sched: protect filter_chain list with filter_chain_lock mutex
From: Vlad Buslov @ 2019-02-15 15:35 UTC (permalink / raw)
To: Ido Schimmel
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
ast@kernel.org, daniel@iogearbox.net
In-Reply-To: <20190215113041.GA10511@splinter>
On Fri 15 Feb 2019 at 11:30, Ido Schimmel <idosch@idosch.org> wrote:
> On Fri, Feb 15, 2019 at 10:02:11AM +0000, Vlad Buslov wrote:
>>
>> On Thu 14 Feb 2019 at 18:24, Ido Schimmel <idosch@idosch.org> wrote:
>> > On Mon, Feb 11, 2019 at 10:55:38AM +0200, Vlad Buslov wrote:
>> >> Extend tcf_chain with new filter_chain_lock mutex. Always lock the chain
>> >> when accessing filter_chain list, instead of relying on rtnl lock.
>> >> Dereference filter_chain with tcf_chain_dereference() lockdep macro to
>> >> verify that all users of chain_list have the lock taken.
>> >>
>> >> Rearrange tp insert/remove code in tc_new_tfilter/tc_del_tfilter to execute
>> >> all necessary code while holding chain lock in order to prevent
>> >> invalidation of chain_info structure by potential concurrent change. This
>> >> also serializes calls to tcf_chain0_head_change(), which allows head change
>> >> callbacks to rely on filter_chain_lock for synchronization instead of rtnl
>> >> mutex.
>> >>
>> >> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
>> >> Acked-by: Jiri Pirko <jiri@mellanox.com>
>> >
>> > With this sequence [1] I get the following trace [2]. Bisected it to
>> > this patch. Note that second filter is rejected by the device driver
>> > (that's the intention). I guess it is not properly removed from the
>> > filter chain in the error path?
>> >
>> > Thanks
>> >
>> > [1]
>> > # tc qdisc add dev swp3 clsact
>> > # tc filter add dev swp3 ingress pref 1 matchall skip_sw \
>> > action mirred egress mirror dev swp7
>> > # tc filter add dev swp3 ingress pref 2 matchall skip_sw \
>> > action mirred egress mirror dev swp7
>> > RTNETLINK answers: File exists
>> > We have an error talking to the kernel, -1
>> > # tc qdisc del dev swp3 clsact
>> >
>> > [2]
>> > [ 70.545131] kasan: GPF could be caused by NULL-ptr deref or user memory access
>> > [ 70.553394] general protection fault: 0000 [#1] PREEMPT SMP KASAN PTI
>> > [ 70.560618] CPU: 2 PID: 2268 Comm: tc Not tainted 5.0.0-rc5-custom-02103-g415d39427317 #1304
>> > [ 70.570065] Hardware name: Mellanox Technologies Ltd. MSN2100-CB2FO/SA001017, BIOS 5.6.5 06/07/2016
>> > [ 70.580204] RIP: 0010:mall_reoffload+0x14a/0x760
>> > [ 70.585382] Code: c1 0f 85 ba 05 00 00 31 c0 4d 8d 6c 24 34 b9 06 00 00 00 4c 89 ff f3 48 ab 4c 89 ea 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <0f> b6 14 02 4c 89 e8 83
>> > e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 bd
>> > [ 70.606382] RSP: 0018:ffff888231faefc0 EFLAGS: 00010207
>> > [ 70.612235] RAX: dffffc0000000000 RBX: 1ffff110463f5dfe RCX: 0000000000000000
>> > [ 70.620220] RDX: 0000000000000006 RSI: 1ffff110463f5e01 RDI: ffff888231faf040
>> > [ 70.628206] RBP: ffff8881ef151a00 R08: 0000000000000000 R09: ffffed10463f5dfa
>> > [ 70.636192] R10: ffffed10463f5dfa R11: 0000000000000003 R12: 0000000000000000
>> > [ 70.644177] R13: 0000000000000034 R14: 0000000000000000 R15: ffff888231faf010
>> > [ 70.652163] FS: 00007f46b5bf0800(0000) GS:ffff888236c00000(0000) knlGS:0000000000000000
>> > [ 70.661218] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> > [ 70.667649] CR2: 0000000001d590a8 CR3: 0000000231c3c000 CR4: 00000000001006e0
>> > [ 70.675633] Call Trace:
>> > [ 70.693046] tcf_block_playback_offloads+0x94/0x230
>> > [ 70.710617] __tcf_block_cb_unregister+0xf7/0x2d0
>> > [ 70.734143] mlxsw_sp_setup_tc+0x20f/0x660
>> > [ 70.738739] tcf_block_offload_unbind+0x22b/0x350
>> > [ 70.748898] __tcf_block_put+0x203/0x630
>> > [ 70.769700] tcf_block_put_ext+0x2f/0x40
>> > [ 70.774098] clsact_destroy+0x7a/0xb0
>> > [ 70.782604] qdisc_destroy+0x11a/0x5c0
>> > [ 70.786810] qdisc_put+0x5a/0x70
>> > [ 70.790435] notify_and_destroy+0x8e/0xa0
>> > [ 70.794933] qdisc_graft+0xbb7/0xef0
>> > [ 70.809009] tc_get_qdisc+0x518/0xa30
>> > [ 70.821530] rtnetlink_rcv_msg+0x397/0xa20
>> > [ 70.835510] netlink_rcv_skb+0x132/0x380
>> > [ 70.848419] netlink_unicast+0x4c0/0x690
>> > [ 70.866019] netlink_sendmsg+0x929/0xe10
>> > [ 70.882134] sock_sendmsg+0xc8/0x110
>> > [ 70.886144] ___sys_sendmsg+0x77a/0x8f0
>> > [ 70.924064] __sys_sendmsg+0xf7/0x250
>> > [ 70.955727] do_syscall_64+0x14d/0x610
>>
>> Hi Ido,
>>
>> Thanks for reporting this.
>>
>> I looked at the code and problem seems to be matchall classifier
>> specific. My implementation of unlocked cls API assumes that concurrent
>> insertions are possible and checks for it when deleting "empty" tp.
>> Since classifiers don't expose number of elements, the only way to test
>> this is to do tp->walk() on them and assume that walk callback is called
>> once per filter on every classifier. In your example new tp is created
>> for second filter, filter insertion fails, number of elements on newly
>> created tp is checked with tp->walk() before deleting it. However,
>> matchall classifier always calls the tp->walk() callback once, even when
>> it doesn't have a valid filter (in this case with NULL filter pointer).
>>
>> Possible ways to fix this:
>>
>> 1) Check for NULL filter pointer in tp->walk() callback and ignore it
>> when counting filters on tp - will work but I don't like it because I
>> don't think it is ever correct to call tp->walk() callback with NULL
>> filter pointer.
>>
>> 2) Fix matchall to not call tp->walk() callback with NULL filter
>> pointers - my preferred simple solution.
>>
>> 3) Extend tp API to have direct way to count filters by implementing
>> tp->count - requires change to every classifier. Or maybe add it as
>> optional API that only unlocked classifiers are required to implement
>> and just delete rtnl lock dependent tp's without checking for concurrent
>> insertions.
>>
>> What do you think?
>
> Since the problem is matchall-specific, then it makes sense to fix it in
> matchall like you suggested in option #2.
>
> Can you please use this opportunity and audit other classifiers to
> confirm problem is indeed specific to matchall?
>
Turns out cls_cgroup has the same problem.
Another problem that I found in cls_fw and cls_route is that they set
arg->stop when empty. Both of them have code unchanged since it was
committed initially in 2005 so I assume this convention is no longer
relevant because all other classifiers don't do that (they only set
arg->stop when arg->fn returns negative value).
I sent fixes for all of those cases.
^ permalink raw reply
* [PATCH net-next 11/13] net: mvpp2: reset the XLG MAC in port_reset
From: Antoine Tenart @ 2019-02-15 15:32 UTC (permalink / raw)
To: davem, linux
Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
stefanc, ymarkman, mw
In-Reply-To: <20190215153241.6857-1-antoine.tenart@bootlin.com>
The mvpp2_port_reset helper resets the GMAC but not the XLG MAC, which
is used on PPv2.2 when using the port 0. This patch fixes it, so that
the two MAC are set in reset when needed. In addition, the XLG
configuration function sets the XLG MAC out of reset when called.
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 5d05306e79a8..80406195a255 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -1384,6 +1384,17 @@ static void mvpp2_port_reset(struct mvpp2_port *port)
val = readl(port->base + MVPP2_GMAC_CTRL_2_REG) |
MVPP2_GMAC_PORT_RESET_MASK;
writel(val, port->base + MVPP2_GMAC_CTRL_2_REG);
+
+ if (port->priv->hw_version == MVPP22 && port->gop_id == 0) {
+ /* Set the XLG MAC in reset */
+ val = readl(port->base + MVPP22_XLG_CTRL0_REG) &
+ ~MVPP22_XLG_CTRL0_MAC_RESET_DIS;
+ writel(val, port->base + MVPP22_XLG_CTRL0_REG);
+
+ while (readl(port->base + MVPP22_XLG_CTRL0_REG) &
+ MVPP22_XLG_CTRL0_MAC_RESET_DIS)
+ continue;
+ }
}
/* Change maximum receive size of the port */
@@ -4512,6 +4523,8 @@ static void mvpp2_xlg_config(struct mvpp2_port *port, unsigned int mode,
ctrl0 = readl(port->base + MVPP22_XLG_CTRL0_REG);
ctrl4 = readl(port->base + MVPP22_XLG_CTRL4_REG);
+ ctrl0 |= MVPP22_XLG_CTRL0_MAC_RESET_DIS;
+
if (state->pause & MLO_PAUSE_TX)
ctrl0 |= MVPP22_XLG_CTRL0_TX_FLOW_CTRL_EN;
else
--
2.20.1
^ permalink raw reply related
* [PATCH net-next 12/13] net: mvpp2: fix alignment of MVPP2_GMAC_CONFIG_MII_SPEED definition
From: Antoine Tenart @ 2019-02-15 15:32 UTC (permalink / raw)
To: davem, linux
Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
stefanc, ymarkman, mw
In-Reply-To: <20190215153241.6857-1-antoine.tenart@bootlin.com>
Cosmetic patch fix the alignment of the MVPP2_GMAC_CONFIG_MII_SPEED
macro definition.
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index 7380bddc53b8..6a2b5d0013b0 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
@@ -389,7 +389,7 @@
#define MVPP2_GMAC_IN_BAND_AUTONEG BIT(2)
#define MVPP2_GMAC_IN_BAND_AUTONEG_BYPASS BIT(3)
#define MVPP2_GMAC_IN_BAND_RESTART_AN BIT(4)
-#define MVPP2_GMAC_CONFIG_MII_SPEED BIT(5)
+#define MVPP2_GMAC_CONFIG_MII_SPEED BIT(5)
#define MVPP2_GMAC_CONFIG_GMII_SPEED BIT(6)
#define MVPP2_GMAC_AN_SPEED_EN BIT(7)
#define MVPP2_GMAC_FC_ADV_EN BIT(9)
--
2.20.1
^ permalink raw reply related
* [PATCH net-next 06/13] net: mvpp2: fix a typo in the header
From: Antoine Tenart @ 2019-02-15 15:32 UTC (permalink / raw)
To: davem, linux
Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
stefanc, ymarkman, mw
In-Reply-To: <20190215153241.6857-1-antoine.tenart@bootlin.com>
This cosmetic patch fixes a typo made in a comment in the Marvell PPv2
Ethernet driver header.
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index 96e3f0669032..83fb2b03e789 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
@@ -549,7 +549,7 @@
#define MVPP2_MAX_TSO_SEGS 300
#define MVPP2_MAX_SKB_DESCS (MVPP2_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS)
-/* Dfault number of RXQs in use */
+/* Default number of RXQs in use */
#define MVPP2_DEFAULT_RXQ 1
/* Max number of Rx descriptors */
--
2.20.1
^ permalink raw reply related
* [PATCH net-next 13/13] net: mvpp2: some AN fields require the link to be down when updated
From: Antoine Tenart @ 2019-02-15 15:32 UTC (permalink / raw)
To: davem, linux
Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
stefanc, ymarkman, mw
In-Reply-To: <20190215153241.6857-1-antoine.tenart@bootlin.com>
The GMAC configuration helper modifies values in the auto-negotiation
register. Some of its values require the port to be forced down when
modifying their values. This patches fixes the check made on the bit to
be updated in this register, so that the port is forced down when
needed. This fix cases where some of those parameters were updated, but
not taken into account, such as when using RGMII interfaces.
Fixes: d14e078f23cc ("net: marvell: mvpp2: only reprogram what is necessary on mac_config")
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 80406195a255..0419a18f0a28 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -4641,9 +4641,19 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,
}
}
+/* Some fields of the auto-negotiation register require the port to be down when
+ * their value is updated.
+ */
+#define MVPP2_GMAC_AN_PORT_DOWN_MASK \
+ (MVPP2_GMAC_IN_BAND_AUTONEG | \
+ MVPP2_GMAC_IN_BAND_AUTONEG_BYPASS | \
+ MVPP2_GMAC_CONFIG_MII_SPEED | MVPP2_GMAC_CONFIG_GMII_SPEED | \
+ MVPP2_GMAC_AN_SPEED_EN | MVPP2_GMAC_CONFIG_FULL_DUPLEX | \
+ MVPP2_GMAC_AN_DUPLEX_EN)
+
if ((old_ctrl0 ^ ctrl0) & MVPP2_GMAC_PORT_TYPE_MASK ||
(old_ctrl2 ^ ctrl2) & MVPP2_GMAC_INBAND_AN_MASK ||
- (old_an ^ an) & MVPP2_GMAC_IN_BAND_AUTONEG) {
+ (old_an ^ an) & MVPP2_GMAC_AN_PORT_DOWN_MASK) {
/* Force link down */
old_an &= ~MVPP2_GMAC_FORCE_LINK_PASS;
old_an |= MVPP2_GMAC_FORCE_LINK_DOWN;
--
2.20.1
^ permalink raw reply related
* [PATCH net-next 10/13] net: mvpp2: reset the XPCS while reconfiguring the serdes lanes
From: Antoine Tenart @ 2019-02-15 15:32 UTC (permalink / raw)
To: davem, linux
Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
stefanc, ymarkman, mw
In-Reply-To: <20190215153241.6857-1-antoine.tenart@bootlin.com>
The documentation advises to set the XPCS in reset while reconfiguring
the serdes lanes. This seems to be a good thing to do, but the PPv2
driver wasn't doing it. This patch fixes it.
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 1 +
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index 21ddcac1ceea..7380bddc53b8 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
@@ -481,6 +481,7 @@
/* XPCS registers. PPv2.2 only */
#define MVPP22_XPCS_BASE(port) (0x7400 + (port) * 0x1000)
#define MVPP22_XPCS_CFG0 0x0
+#define MVPP22_XPCS_CFG0_RESET_DIS BIT(0)
#define MVPP22_XPCS_CFG0_PCS_MODE(n) ((n) << 3)
#define MVPP22_XPCS_CFG0_ACTIVE_LANE(n) ((n) << 5)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 4a18f8e54c90..5d05306e79a8 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -1016,13 +1016,19 @@ static void mvpp22_gop_init_10gkr(struct mvpp2_port *port)
void __iomem *xpcs = priv->iface_base + MVPP22_XPCS_BASE(port->gop_id);
u32 val;
- /* XPCS */
+ /* XPCS : Reset the XPCS when reconfiguring the lanes */
+ val = readl(xpcs + MVPP22_XPCS_CFG0);
+ writel(val & ~MVPP22_XPCS_CFG0_RESET_DIS, xpcs + MVPP22_XPCS_CFG0);
+
val = readl(xpcs + MVPP22_XPCS_CFG0);
val &= ~(MVPP22_XPCS_CFG0_PCS_MODE(0x3) |
MVPP22_XPCS_CFG0_ACTIVE_LANE(0x3));
val |= MVPP22_XPCS_CFG0_ACTIVE_LANE(2);
writel(val, xpcs + MVPP22_XPCS_CFG0);
+ val = readl(xpcs + MVPP22_XPCS_CFG0);
+ writel(val | MVPP22_XPCS_CFG0_RESET_DIS, xpcs + MVPP22_XPCS_CFG0);
+
/* MPCS */
val = readl(mpcs + MVPP22_MPCS_CTRL);
val &= ~MVPP22_MPCS_CTRL_FWD_ERR_CONN;
--
2.20.1
^ permalink raw reply related
* [PATCH net-next 07/13] net: mvpp2: fix validate for PPv2.1
From: Antoine Tenart @ 2019-02-15 15:32 UTC (permalink / raw)
To: davem, linux
Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
stefanc, ymarkman, mw
In-Reply-To: <20190215153241.6857-1-antoine.tenart@bootlin.com>
The Phylink validate function is the Marvell PPv2 driver makes a check
on the GoP id. This is valid an has to be done when using PPv2.2 engines
but makes no sense when using PPv2.1. The check done when using an RGMII
interface makes sure the GoP id is not 0, but this breaks PPv2.1. Fixes
it.
Fixes: 0fb628f0f250 ("net: mvpp2: fix phylink handling of invalid PHY modes")
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 2c1de23ca267..f5b299656052 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -4360,7 +4360,7 @@ static void mvpp2_phylink_validate(struct net_device *dev,
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
- if (port->gop_id == 0)
+ if (port->priv->hw_version == MVPP22 && port->gop_id == 0)
goto empty_set;
break;
default:
--
2.20.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox