* Re: [PATCH net-next RFC 2/9] net: dsa: mv88e6xxx: expose switch time as a PTP hardware clock
From: Andrew Lunn @ 2017-09-28 17:03 UTC (permalink / raw)
To: Brandon Streiff
Cc: netdev, linux-kernel, David S. Miller, Florian Fainelli,
Vivien Didelot, Richard Cochran, Erik Hons
In-Reply-To: <1506612341-18061-3-git-send-email-brandon.streiff@ni.com>
> +/* The 32-bit timestamp counter overflows every ~34.3 seconds; this task
> + * forces periodic reads so that we don't miss any wraparounds.
> + */
> +#define MV88E6XXX_TAI_OVERFLOW_PERIOD (34 * HZ / 2)
> +static void mv88e6xxx_ptp_overflow_check(struct work_struct *work)
> +{
> + struct delayed_work *dw = to_delayed_work(work);
> + struct mv88e6xxx_chip *chip =
> + container_of(dw, struct mv88e6xxx_chip, overflow_work);
> + bool timeout = time_is_before_jiffies(chip->last_overflow_check +
> + MV88E6XXX_TAI_OVERFLOW_PERIOD);
> +
> + if (timeout) {
Why do you need this timeout? Do you think the kernel will call this
more often than required?
Also, if it did call this function early, you skip the read, and
reschedule. There is then a danger the next read is after the
wraparound.....
> + mutex_lock(&chip->reg_lock);
> + timecounter_read(&chip->tstamp_tc);
> + chip->last_overflow_check = jiffies;
> + mutex_unlock(&chip->reg_lock);
> + }
> +
> + schedule_delayed_work(&chip->overflow_work,
> + MV88E6XXX_TAI_OVERFLOW_PERIOD);
> +}
Thanks
Andrew
^ permalink raw reply
* Re: [PATCH net-next RFC 2/9] net: dsa: mv88e6xxx: expose switch time as a PTP hardware clock
From: Andrew Lunn @ 2017-09-28 16:56 UTC (permalink / raw)
To: Brandon Streiff
Cc: netdev, linux-kernel, David S. Miller, Florian Fainelli,
Vivien Didelot, Richard Cochran, Erik Hons
In-Reply-To: <1506612341-18061-3-git-send-email-brandon.streiff@ni.com>
On Thu, Sep 28, 2017 at 10:25:34AM -0500, Brandon Streiff wrote:
> This patch adds basic support for exposing the 32-bit timestamp counter
> inside the mv88e6xxx switch code as a ptp_clock.
>
> Signed-off-by: Brandon Streiff <brandon.streiff@ni.com>
> ---
> drivers/net/dsa/mv88e6xxx/Kconfig | 10 +++
> drivers/net/dsa/mv88e6xxx/Makefile | 1 +
> drivers/net/dsa/mv88e6xxx/chip.c | 20 +++++
> drivers/net/dsa/mv88e6xxx/chip.h | 16 ++++
> drivers/net/dsa/mv88e6xxx/ptp.c | 180 +++++++++++++++++++++++++++++++++++++
> drivers/net/dsa/mv88e6xxx/ptp.h | 83 +++++++++++++++++
> 6 files changed, 310 insertions(+)
> create mode 100644 drivers/net/dsa/mv88e6xxx/ptp.c
> create mode 100644 drivers/net/dsa/mv88e6xxx/ptp.h
>
> diff --git a/drivers/net/dsa/mv88e6xxx/Kconfig b/drivers/net/dsa/mv88e6xxx/Kconfig
> index 1aaa7a9..ae9e7f7 100644
> --- a/drivers/net/dsa/mv88e6xxx/Kconfig
> +++ b/drivers/net/dsa/mv88e6xxx/Kconfig
> @@ -18,3 +18,13 @@ config NET_DSA_MV88E6XXX_GLOBAL2
>
> It is required on most chips. If the chip you compile the support for
> doesn't have such registers set, say N here. In doubt, say Y.
> +
> +config NET_DSA_MV88E6XXX_PTP
> + bool "PTP support for Marvell 88E6xxx"
> + default n
> + depends on NET_DSA_MV88E6XXX_GLOBAL2
> + imply NETWORK_PHY_TIMESTAMPING
Hi Brandon
Cool to see this code.
One probably dumb question so far..
It is the MAC which is doing the time stamping, not they PHY?
So why NETWORK_PHY_TIMESTAMPING?
Andrew
^ permalink raw reply
* Re: [patch net] net: dsa: mv88e6xxx: Allow dsa and cpu ports in multiple vlans
From: David Miller @ 2017-09-28 16:45 UTC (permalink / raw)
To: andrew; +Cc: vivien.didelot, netdev
In-Reply-To: <1506375140-2853-1-git-send-email-andrew@lunn.ch>
From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 25 Sep 2017 23:32:20 +0200
> Ports with the same VLAN must all be in the same bridge. However the
> CPU and DSA ports need to be in multiple VLANs spread over multiple
> bridges. So exclude them when performing this test.
>
> Fixes: b2f81d304cee ("net: dsa: add CPU and DSA ports as VLAN members")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Applied and queued up for -stable, thanks.
^ permalink raw reply
* Re: [Patch net-next v2] net_sched: use idr to allocate u32 filter handles
From: David Miller @ 2017-09-28 16:44 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, chrism, jhs
In-Reply-To: <20170925171351.4956-3-xiyou.wangcong@gmail.com>
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 25 Sep 2017 10:13:51 -0700
> Instead of calling u32_lookup_ht() in a loop to find
> a unused handle, just switch to idr API to allocate
> new handles. u32 filters are special as the handle
> could contain a hash table id and a key id, so we
> need two IDR to allocate each of them.
>
> Cc: Chris Mi <chrism@mellanox.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied.
^ permalink raw reply
* Re: [Patch net-next v2] net_sched: use idr to allocate basic filter handles
From: David Miller @ 2017-09-28 16:44 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, chrism, jhs
In-Reply-To: <20170925171351.4956-2-xiyou.wangcong@gmail.com>
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 25 Sep 2017 10:13:50 -0700
> Instead of calling basic_get() in a loop to find
> a unused handle, just switch to idr API to allocate
> new handles.
>
> Cc: Chris Mi <chrism@mellanox.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied.
^ permalink raw reply
* Re: [Patch net-next v2] net_sched: use idr to allocate bpf filter handles
From: David Miller @ 2017-09-28 16:44 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, daniel, chrism, jhs
In-Reply-To: <20170925171351.4956-1-xiyou.wangcong@gmail.com>
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 25 Sep 2017 10:13:49 -0700
> Instead of calling cls_bpf_get() in a loop to find
> a unused handle, just switch to idr API to allocate
> new handles.
>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Chris Mi <chrism@mellanox.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] inetpeer: speed up inetpeer_invalidate_tree()
From: David Miller @ 2017-09-28 16:41 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1506356054.6617.13.camel@edumazet-glaptop3.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 25 Sep 2017 09:14:14 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> 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)
>
> From: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply
* Re: [PATCH net] inetpeer: fix RCU lookup() again
From: David Miller @ 2017-09-28 16:40 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1506354002.6617.10.camel@edumazet-glaptop3.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 25 Sep 2017 08:40:02 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> My prior fix was not complete, as we were dereferencing a pointer
> three times per node, not twice as I initially thought.
>
> Fixes: 4cc5b44b29a9 ("inetpeer: fix RCU lookup()")
> Fixes: b145425f269a ("inetpeer: remove AVL implementation in favor of RB tree")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied.
^ permalink raw reply
* [PATCH v5 2/2] ip_tunnel: add mpls over gre encapsulation
From: Amine Kherbouche @ 2017-09-28 16:34 UTC (permalink / raw)
To: netdev, davem, xeb, roopa; +Cc: amine.kherbouche, equinox
In-Reply-To: <cover.1506616214.git.amine.kherbouche@6wind.com>
This commit introduces the MPLSoGRE support (RFC 4023), using ip tunnel
API.
Encap:
- Add a new iptunnel type mpls.
- Share tx path: gre type mpls loaded from skb->protocol.
Decap:
- pull gre hdr and call mpls_forward().
Signed-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
include/net/gre.h | 1 +
include/uapi/linux/if_tunnel.h | 1 +
net/ipv4/gre_demux.c | 27 +++++++++++++++++++++++++++
net/ipv4/ip_gre.c | 3 +++
net/ipv6/ip6_gre.c | 3 +++
net/mpls/af_mpls.c | 36 ++++++++++++++++++++++++++++++++++++
6 files changed, 71 insertions(+)
diff --git a/include/net/gre.h b/include/net/gre.h
index d25d836..aa3c4d3 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -35,6 +35,7 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
u8 name_assign_type);
int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
bool *csum_err, __be16 proto, int nhs);
+int mpls_gre_rcv(struct sk_buff *skb, int gre_hdr_len);
static inline int gre_calc_hlen(__be16 o_flags)
{
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 2e52088..a2f48c0 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -84,6 +84,7 @@ enum tunnel_encap_types {
TUNNEL_ENCAP_NONE,
TUNNEL_ENCAP_FOU,
TUNNEL_ENCAP_GUE,
+ TUNNEL_ENCAP_MPLS,
};
#define TUNNEL_ENCAP_FLAG_CSUM (1<<0)
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index b798862..40484a3 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -23,6 +23,9 @@
#include <linux/netdevice.h>
#include <linux/if_tunnel.h>
#include <linux/spinlock.h>
+#if IS_ENABLED(CONFIG_MPLS)
+#include <linux/mpls.h>
+#endif
#include <net/protocol.h>
#include <net/gre.h>
@@ -122,6 +125,30 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
}
EXPORT_SYMBOL(gre_parse_header);
+#if IS_ENABLED(CONFIG_MPLS)
+int mpls_gre_rcv(struct sk_buff *skb, int gre_hdr_len)
+{
+ if (unlikely(!pskb_may_pull(skb, gre_hdr_len)))
+ goto drop;
+
+ /* Pop GRE hdr and reset the skb */
+ skb_pull(skb, gre_hdr_len);
+ skb_reset_network_header(skb);
+
+ return mpls_forward(skb, skb->dev, NULL, NULL);
+drop:
+ kfree_skb(skb);
+ return NET_RX_DROP;
+}
+#else
+int mpls_gre_rcv(struct sk_buff *skb, int gre_hdr_len)
+{
+ kfree_skb(skb);
+ return NET_RX_DROP;
+}
+#endif
+EXPORT_SYMBOL(mpls_gre_rcv);
+
static int gre_rcv(struct sk_buff *skb)
{
const struct gre_protocol *proto;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 9cee986..7a50e4f 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -412,6 +412,9 @@ static int gre_rcv(struct sk_buff *skb)
return 0;
}
+ if (unlikely(tpi.proto == htons(ETH_P_MPLS_UC)))
+ return mpls_gre_rcv(skb, hdr_len);
+
if (ipgre_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
return 0;
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index c82d41e..440efb1 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -476,6 +476,9 @@ static int gre_rcv(struct sk_buff *skb)
if (hdr_len < 0)
goto drop;
+ if (unlikely(tpi.proto == htons(ETH_P_MPLS_UC)))
+ return mpls_gre_rcv(skb, hdr_len);
+
if (iptunnel_pull_header(skb, hdr_len, tpi.proto, false))
goto drop;
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 36ea2ad..4274243 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -16,6 +16,7 @@
#include <net/arp.h>
#include <net/ip_fib.h>
#include <net/netevent.h>
+#include <net/ip_tunnels.h>
#include <net/netns/generic.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6.h>
@@ -39,6 +40,36 @@ static int one = 1;
static int label_limit = (1 << 20) - 1;
static int ttl_max = 255;
+#if IS_ENABLED(CONFIG_NET_IP_TUNNEL)
+size_t ipgre_mpls_encap_hlen(struct ip_tunnel_encap *e)
+{
+ return sizeof(struct mpls_shim_hdr);
+}
+
+static const struct ip_tunnel_encap_ops mpls_iptun_ops = {
+ .encap_hlen = ipgre_mpls_encap_hlen,
+};
+
+static int ipgre_tunnel_encap_add_mpls_ops(void)
+{
+ return ip_tunnel_encap_add_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS);
+}
+
+static void ipgre_tunnel_encap_del_mpls_ops(void)
+{
+ ip_tunnel_encap_del_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS);
+}
+#else
+static int ipgre_tunnel_encap_add_mpls_ops(void)
+{
+ return 0;
+}
+
+static void ipgre_tunnel_encap_del_mpls_ops(void)
+{
+}
+#endif
+
static void rtmsg_lfib(int event, u32 label, struct mpls_route *rt,
struct nlmsghdr *nlh, struct net *net, u32 portid,
unsigned int nlm_flags);
@@ -2486,6 +2517,10 @@ static int __init mpls_init(void)
0);
rtnl_register(PF_MPLS, RTM_GETNETCONF, mpls_netconf_get_devconf,
mpls_netconf_dump_devconf, 0);
+ err = ipgre_tunnel_encap_add_mpls_ops();
+ if (err)
+ pr_err("Can't add mpls over gre tunnel ops\n");
+
err = 0;
out:
return err;
@@ -2503,6 +2538,7 @@ static void __exit mpls_exit(void)
dev_remove_pack(&mpls_packet_type);
unregister_netdevice_notifier(&mpls_dev_notifier);
unregister_pernet_subsys(&mpls_net_ops);
+ ipgre_tunnel_encap_del_mpls_ops();
}
module_exit(mpls_exit);
--
2.1.4
^ permalink raw reply related
* [PATCH v5 1/2] mpls: export mpls_forward()
From: Amine Kherbouche @ 2017-09-28 16:34 UTC (permalink / raw)
To: netdev, davem, xeb, roopa; +Cc: amine.kherbouche, equinox
In-Reply-To: <cover.1506616214.git.amine.kherbouche@6wind.com>
Exporting mpls_forward() function to be able to be called from elsewhere
such as MPLSoverGRE in the next commit.
Signed-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
include/linux/mpls.h | 4 ++++
net/mpls/af_mpls.c | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/linux/mpls.h b/include/linux/mpls.h
index 384fb22..b0579ab 100644
--- a/include/linux/mpls.h
+++ b/include/linux/mpls.h
@@ -2,10 +2,14 @@
#define _LINUX_MPLS_H
#include <uapi/linux/mpls.h>
+#include <linux/netdevice.h>
#define MPLS_TTL_MASK (MPLS_LS_TTL_MASK >> MPLS_LS_TTL_SHIFT)
#define MPLS_BOS_MASK (MPLS_LS_S_MASK >> MPLS_LS_S_SHIFT)
#define MPLS_TC_MASK (MPLS_LS_TC_MASK >> MPLS_LS_TC_SHIFT)
#define MPLS_LABEL_MASK (MPLS_LS_LABEL_MASK >> MPLS_LS_LABEL_SHIFT)
+int mpls_forward(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt, struct net_device *orig_dev);
+
#endif /* _LINUX_MPLS_H */
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index c5b9ce4..36ea2ad 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -307,8 +307,8 @@ static bool mpls_egress(struct net *net, struct mpls_route *rt,
return success;
}
-static int mpls_forward(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+int mpls_forward(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt, struct net_device *orig_dev)
{
struct net *net = dev_net(dev);
struct mpls_shim_hdr *hdr;
@@ -442,6 +442,7 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev,
kfree_skb(skb);
return NET_RX_DROP;
}
+EXPORT_SYMBOL(mpls_forward);
static struct packet_type mpls_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_MPLS_UC),
--
2.1.4
^ permalink raw reply related
* [PATCH v5 0/2] Introduce MPLS over GRE
From: Amine Kherbouche @ 2017-09-28 16:34 UTC (permalink / raw)
To: netdev, davem, xeb, roopa; +Cc: amine.kherbouche, equinox
This series introduces the MPLS over GRE encapsulation (RFC 4023).
Various applications of MPLS make use of label stacks with multiple
entries. In some cases, it is possible to replace the top label of
the stack with an IP-based encapsulation, thereby, it is possible for
two LSRs that are adjacent on an LSP to be separated by an IP network,
even if that IP network does not provide MPLS.
Changes in v5:
- Reword first commit title.
Changes in v4:
- Bring back mpls_forward() function exportation patch.
- Move back mpls_gre_rcv() to gre module file and wrap it under
ifdef.
Changes in v3:
- remove mpls_forward() function exportation patch.
- wrap efficiently mpls iptunnel add/del functions and dependent
function/structure.
- move mpls_gre_rcv to af_mpls.c file and export it.
- remove unnecessary functions.
Changes in v2:
- wrap ip tunnel functions under ifdef in mpls file.
- fix indentation.
- check return code.
An example of configuration:
node1 LER1 LER2 node2
+-----+ +------+ +------+ +-----+
| | | | | | | |
| | | |p3 GRE tunnel p4| | | |
| |p1 p2| +-------------------+ |p5 p6| |
| +-------------+ +-------------------+ +------------+| |
| |10.100.0.0/24| | | |10.200.0.0/24| |
| |fd00:100::/64| | 10.125.0.0/24 | |fd00:200::/64| |
| | | | fd00:125::/64 | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
+-----+ +------+ +------+ +-----+
### node1 ###
ip link set p1 up
ip addr add 10.100.0.1/24 dev p1
### LER1 ###
ip link set p2 up
ip addr add 10.100.0.2/24 dev p2
ip link set p3 up
ip addr add 10.125.0.1/24 dev p3
modprobe mpls_router
sysctl -w net.mpls.conf.p2.input=1
sysctl -w net.mpls.conf.p3.input=1
sysctl -w net.mpls.platform_labels=1000
ip link add gre1 type gre ttl 64 local 10.125.0.1 remote 10.125.0.2 dev p3
ip link set dev gre1 up
ip -M route add 111 as 222 dev gre1
ip -M route add 555 as 666 via inet 10.100.0.1 dev p2
### LER2 ###
ip link set p5 up
ip addr add 10.200.0.2/24 dev p5
ip link set p4 up
ip addr add 10.125.0.2/24 dev p4
modprobe mpls_router
sysctl -w net.mpls.conf.p4.input=1
sysctl -w net.mpls.conf.p5.input=1
sysctl -w net.mpls.platform_labels=1000
ip link add gre1 type gre ttl 64 local 10.125.0.2 remote 10.125.0.1 dev p4
ip link set dev gre1 up
ip -M route add 444 as 555 dev gre1
ip -M route add 222 as 333 via inet 10.200.0.1 dev p5
### node2 ###
ip link set p6 up
ip addr add 10.200.0.1/24 dev p6
Now using this scapy to forge and send packets from the port p1 of node1:
p = Ether(src='de:ed:01:0c:41:09', dst='de:ed:01:2f:3b:ba')
p /= MPLS(s=1, ttl=64, label=111)/Raw(load='\xde')
sendp(p, iface="p1", count=20, inter=0.1)
Amine Kherbouche (2):
mpls: export mpls_forward()
ip_tunnel: add mpls over gre encapsulation
include/linux/mpls.h | 4 ++++
include/net/gre.h | 1 +
include/uapi/linux/if_tunnel.h | 1 +
net/ipv4/gre_demux.c | 27 +++++++++++++++++++++++++++
net/ipv4/ip_gre.c | 3 +++
net/ipv6/ip6_gre.c | 3 +++
net/mpls/af_mpls.c | 41 +++++++++++++++++++++++++++++++++++++++--
7 files changed, 78 insertions(+), 2 deletions(-)
--
2.1.4
^ permalink raw reply
* Re: [PATCH net v2 0/3] net: mvpp2: various fixes
From: David Miller @ 2017-09-28 16:34 UTC (permalink / raw)
To: antoine.tenart
Cc: andrew, gregory.clement, thomas.petazzoni, miquel.raynal, nadavh,
linux, linux-kernel, mw, stefanc, netdev
In-Reply-To: <20170925125948.13507-1-antoine.tenart@free-electrons.com>
From: Antoine Tenart <antoine.tenart@free-electrons.com>
Date: Mon, 25 Sep 2017 14:59:45 +0200
> This series contains 3 fixes for the Marvell PPv2 driver.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH] isdn/eicon: do integrity check on cmd->adapter == a->controller early
From: David Miller @ 2017-09-28 16:32 UTC (permalink / raw)
To: mengxu.gatech; +Cc: mac, isdn, netdev, linux-kernel, meng.xu, sanidhya, taesoo
In-Reply-To: <1506266081-22895-1-git-send-email-mengxu.gatech@gmail.com>
From: Meng Xu <mengxu.gatech@gmail.com>
Date: Sun, 24 Sep 2017 11:14:41 -0400
> + /* do the integrity check early */
> + if(((diva_xdi_um_cfg_cmd_t *)data)->adapter != a->controller){
> + DBG_ERR(("A: A(%d) write, invalid controller=%d != %d",
> + ((diva_xdi_um_cfg_cmd_t *)data)->adapter, a->controller));
> +
DBG_ERR() has a trailing semicolon in it's definition, so if you add
another one when you invoke it there will be two ";;".
This whole code base is such a mess, I really think there is little
to no value in trying to make minor changes here.
So unless you are fixing some kind of exploitable hole, please drop
this.
Thank you.
^ permalink raw reply
* Re: [PATCH net-next RFC 1/9] net: dsa: mv88e6xxx: add accessors for PTP/TAI registers
From: Vivien Didelot @ 2017-09-28 16:29 UTC (permalink / raw)
To: Brandon Streiff, netdev
Cc: linux-kernel, David S. Miller, Florian Fainelli, Andrew Lunn,
Richard Cochran, Erik Hons, Brandon Streiff
In-Reply-To: <1506612341-18061-2-git-send-email-brandon.streiff@ni.com>
Hi Brandon,
Brandon Streiff <brandon.streiff@ni.com> writes:
> + .port_ptp_read = mv88e6352_port_ptp_read,
> + .port_ptp_write = mv88e6352_port_ptp_write,
> + .ptp_read = mv88e6352_ptp_read,
> + .ptp_write = mv88e6352_ptp_write,
> + .tai_read = mv88e6352_tai_read,
> + .tai_write = mv88e6352_tai_write,
> + .port_ptp_read = mv88e6390_port_ptp_read,
> + .port_ptp_write = mv88e6390_port_ptp_write,
> + .ptp_read = mv88e6390_ptp_read,
> + .ptp_write = mv88e6390_ptp_write,
> + .tai_read = mv88e6390_tai_read,
> + .tai_write = mv88e6390_tai_write,
Only nitpick: please keep the mv88e63{52,90}_g2_avb_ prefix here.
Otherwise thanks for respecting the code organization, very clear patch:
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Vivien
^ permalink raw reply
* Re: [PATCH net-next 0/3] support changing steering policies in tuntap
From: Willem de Bruijn @ 2017-09-28 16:09 UTC (permalink / raw)
To: Jason Wang; +Cc: Michael S. Tsirkin, Network Development, LKML
In-Reply-To: <26f01b12-396e-6319-0eed-c987930e0ed9@redhat.com>
On Thu, Sep 28, 2017 at 3:23 AM, Jason Wang <jasowang@redhat.com> wrote:
>
>
> On 2017年09月28日 07:25, Willem de Bruijn wrote:
>>>>
>>>> In the future, both simple and sophisticated policy like RSS or other
>>>> guest
>>>> driven steering policies could be done on top.
>>>
>>> IMHO there should be a more practical example before adding all this
>>> indirection. And it would be nice to understand why this queue selection
>>> needs to be tun specific.
>>
>> I was thinking the same and this reminds me of the various strategies
>> implemented in packet fanout. tun_cpu_select_queue is analogous to
>> fanout_demux_cpu though it is tun-specific in that it requires
>> tun->numqueues.
>
>
> Right, the main idea is to introduce a way to change flow steering policy
> for tun. I think fanout policy could be implemented through the API
> introduced in this series. (Current flow caches based automatic steering
> method is tun specific).
>
>>
>> Fanout accrued various strategies until it gained an eBPF variant. Just
>> supporting BPF is probably sufficient here, too.
>
>
> Technically yes, but for tun, it also serve for virt. We probably still need
> some hard coded policy which could be changed by guest until we can accept
> an BPF program from guest I think?
When would a guest choose the policy? As long as this is under control
of a host user, possibly unprivileged, allowing BPF here is moot, as any
user can run socket filter BPF already. Programming from the guest is
indeed different. I don't fully understand that use case.
^ permalink raw reply
* Re: [PATCH net-next] vhost_net: do not stall on zerocopy depletion
From: Willem de Bruijn @ 2017-09-28 16:05 UTC (permalink / raw)
To: Jason Wang
Cc: Network Development, David Miller, Michael S. Tsirkin,
Koichiro Den, virtualization, Willem de Bruijn
In-Reply-To: <a574875f-cea7-e769-ff41-c337c9720d7a@redhat.com>
On Thu, Sep 28, 2017 at 3:41 AM, Jason Wang <jasowang@redhat.com> wrote:
>
>
> On 2017年09月28日 08:25, Willem de Bruijn wrote:
>>
>> From: Willem de Bruijn <willemb@google.com>
>>
>> Vhost-net has a hard limit on the number of zerocopy skbs in flight.
>> When reached, transmission stalls. Stalls cause latency, as well as
>> head-of-line blocking of other flows that do not use zerocopy.
>>
>> Instead of stalling, revert to copy-based transmission.
>>
>> Tested by sending two udp flows from guest to host, one with payload
>> of VHOST_GOODCOPY_LEN, the other too small for zerocopy (1B). The
>> large flow is redirected to a netem instance with 1MBps rate limit
>> and deep 1000 entry queue.
>>
>> modprobe ifb
>> ip link set dev ifb0 up
>> tc qdisc add dev ifb0 root netem limit 1000 rate 1MBit
>>
>> tc qdisc add dev tap0 ingress
>> tc filter add dev tap0 parent ffff: protocol ip \
>> u32 match ip dport 8000 0xffff \
>> action mirred egress redirect dev ifb0
>>
>> Before the delay, both flows process around 80K pps. With the delay,
>> before this patch, both process around 400. After this patch, the
>> large flow is still rate limited, while the small reverts to its
>> original rate. See also discussion in the first link, below.
>>
>> The limit in vhost_exceeds_maxpend must be carefully chosen. When
>> vq->num >> 1, the flows remain correlated. This value happens to
>> correspond to VHOST_MAX_PENDING for vq->num == 256.
>
>
> Have you tested e.g vq->num = 512 or 1024?
I did test with 1024 previously, but let me run that again
with this patch applied.
>
>
>> Allow smaller
>> fractions and ensure correctness also for much smaller values of
>> vq->num, by testing the min() of both explicitly. See also the
>> discussion in the second link below.
>>
>>
>> Link:http://lkml.kernel.org/r/CAF=yD-+Wk9sc9dXMUq1+x_hh=3ThTXa6BnZkygP3tgVpjbp93g@mail.gmail.com
>> Link:http://lkml.kernel.org/r/20170819064129.27272-1-den@klaipeden.com
>> Signed-off-by: Willem de Bruijn <willemb@google.com>
>> ---
>> drivers/vhost/net.c | 14 ++++----------
>> 1 file changed, 4 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> index 58585ec8699e..50758602ae9d 100644
>> --- a/drivers/vhost/net.c
>> +++ b/drivers/vhost/net.c
>> @@ -436,8 +436,8 @@ static bool vhost_exceeds_maxpend(struct vhost_net
>> *net)
>> struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX];
>> struct vhost_virtqueue *vq = &nvq->vq;
>> - return (nvq->upend_idx + vq->num - VHOST_MAX_PEND) % UIO_MAXIOV
>> - == nvq->done_idx;
>> + return (nvq->upend_idx + UIO_MAXIOV - nvq->done_idx) % UIO_MAXIOV
>> >
>> + min(VHOST_MAX_PEND, vq->num >> 2);
>> }
>> /* Expects to be always run from workqueue - which acts as
>> @@ -480,12 +480,6 @@ static void handle_tx(struct vhost_net *net)
>> if (zcopy)
>> vhost_zerocopy_signal_used(net, vq);
>> - /* If more outstanding DMAs, queue the work.
>> - * Handle upend_idx wrap around
>> - */
>> - if (unlikely(vhost_exceeds_maxpend(net)))
>> - break;
>> -
>> head = vhost_net_tx_get_vq_desc(net, vq, vq->iov,
>> ARRAY_SIZE(vq->iov),
>> &out, &in);
>> @@ -509,6 +503,7 @@ static void handle_tx(struct vhost_net *net)
>> len = iov_length(vq->iov, out);
>> iov_iter_init(&msg.msg_iter, WRITE, vq->iov, out, len);
>> iov_iter_advance(&msg.msg_iter, hdr_size);
>> +
>
>
> Looks unnecessary. Other looks good.
Oops, indeed. Thanks.
^ permalink raw reply
* [PATCH net] ppp: fix __percpu annotation
From: Guillaume Nault @ 2017-09-28 15:57 UTC (permalink / raw)
To: netdev; +Cc: Gao Feng, Paul Mackerras
Move sparse annotation right after pointer type.
Fixes sparse warning:
drivers/net/ppp/ppp_generic.c:1422:13: warning: incorrect type in initializer (different address spaces)
drivers/net/ppp/ppp_generic.c:1422:13: expected void const [noderef] <asn:3>*__vpp_verify
drivers/net/ppp/ppp_generic.c:1422:13: got int *<noident>
...
Fixes: e5dadc65f9e0 ("ppp: Fix false xmit recursion detect with two ppp devices")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
drivers/net/ppp/ppp_generic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index a404552555d4..c3f77e3b7819 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -120,7 +120,7 @@ struct ppp {
int n_channels; /* how many channels are attached 54 */
spinlock_t rlock; /* lock for receive side 58 */
spinlock_t wlock; /* lock for transmit side 5c */
- int *xmit_recursion __percpu; /* xmit recursion detect */
+ int __percpu *xmit_recursion; /* xmit recursion detect */
int mru; /* max receive unit 60 */
unsigned int flags; /* control bits 64 */
unsigned int xstate; /* transmit state bits 68 */
--
2.14.2
^ permalink raw reply related
* [PATCH 4/4] arm64: dts: renesas: ulcb: Add EthernetAVB PHY reset
From: Geert Uytterhoeven @ 2017-09-28 15:53 UTC (permalink / raw)
To: David S . Miller, Simon Horman, Magnus Damm
Cc: Sergei Shtylyov, Andrew Lunn, Florian Fainelli,
Niklas Söderlund, netdev, linux-renesas-soc, devicetree,
Geert Uytterhoeven
In-Reply-To: <1506614014-4398-1-git-send-email-geert+renesas@glider.be>
Describe the GPIO used to reset the Ethernet PHY for EthernetAVB.
This allows the driver to reset the PHY during probe and after system
resume.
On ULCB, the enable pin of the regulator providing PHY power is always
pulled high, but the driver may still need to reset the PHY if this
wasn't done by the bootloader before.
Inspired by patches in the BSP for the individual Salvator-X/XS boards
by Kazuya Mizuguchi.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.
---
arch/arm64/boot/dts/renesas/ulcb.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/renesas/ulcb.dtsi b/arch/arm64/boot/dts/renesas/ulcb.dtsi
index dfec9072718b8da1..49cf392fccfb3165 100644
--- a/arch/arm64/boot/dts/renesas/ulcb.dtsi
+++ b/arch/arm64/boot/dts/renesas/ulcb.dtsi
@@ -147,6 +147,7 @@
pinctrl-names = "default";
renesas,no-ether-link;
phy-handle = <&phy0>;
+ reset-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
status = "okay";
phy0: ethernet-phy@0 {
--
2.7.4
^ permalink raw reply related
* [PATCH 1/4] dt-bindings: net: ravb: Document optional reset-gpios property
From: Geert Uytterhoeven @ 2017-09-28 15:53 UTC (permalink / raw)
To: David S . Miller, Simon Horman, Magnus Damm
Cc: Sergei Shtylyov, Andrew Lunn, Florian Fainelli,
Niklas Söderlund, netdev, linux-renesas-soc, devicetree,
Geert Uytterhoeven
In-Reply-To: <1506614014-4398-1-git-send-email-geert+renesas@glider.be>
The optional "reset-gpios" property (part of the generic MDIO bus
properties) lets us describe the GPIO used for resetting the Ethernet
PHY.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Documentation/devicetree/bindings/net/renesas,ravb.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/renesas,ravb.txt b/Documentation/devicetree/bindings/net/renesas,ravb.txt
index c902261893b913f5..4a6ec1ba32d0bf16 100644
--- a/Documentation/devicetree/bindings/net/renesas,ravb.txt
+++ b/Documentation/devicetree/bindings/net/renesas,ravb.txt
@@ -52,6 +52,7 @@ Optional properties:
AVB_LINK signal.
- renesas,ether-link-active-low: boolean, specify when the AVB_LINK signal is
active-low instead of normal active-high.
+- reset-gpios: see mdio.txt in the same directory.
Example:
@@ -99,6 +100,7 @@ Example:
pinctrl-0 = <ðer_pins>;
pinctrl-names = "default";
renesas,no-ether-link;
+ reset-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
#address-cells = <1>;
#size-cells = <0>;
--
2.7.4
^ permalink raw reply related
* [PATCH 3/4] arm64: dts: renesas: salvator-common: Add EthernetAVB PHY reset
From: Geert Uytterhoeven @ 2017-09-28 15:53 UTC (permalink / raw)
To: David S . Miller, Simon Horman, Magnus Damm
Cc: Sergei Shtylyov, Andrew Lunn, Florian Fainelli,
Niklas Söderlund, netdev, linux-renesas-soc, devicetree,
Geert Uytterhoeven
In-Reply-To: <1506614014-4398-1-git-send-email-geert+renesas@glider.be>
Describe the GPIO used to reset the Ethernet PHY for EthernetAVB.
This allows the driver to reset the PHY during probe and after system
resume.
This fixes Ethernet operation after resume from s2ram on Salvator-XS,
where the enable pin of the regulator providing PHY power is connected
to PRESETn, and PSCI powers down the SoC during system suspend.
On Salvator-X, the enable pin is always pulled high, but the driver may
still need to reset the PHY if this wasn't done by the bootloader
before.
Inspired by patches in the BSP for the individual Salvator-X/XS boards
by Kazuya Mizuguchi.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
For proper PHY reset operation during system resume, this depends on
"ravb: Add missing PHY reset during system resume".
However, this patch can be applied independently.
---
arch/arm64/boot/dts/renesas/salvator-common.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
index ed4a8dfead3c2e58..db00e7c484f76eac 100644
--- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
+++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
@@ -296,6 +296,7 @@
pinctrl-names = "default";
renesas,no-ether-link;
phy-handle = <&phy0>;
+ reset-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
status = "okay";
phy0: ethernet-phy@0 {
--
2.7.4
^ permalink raw reply related
* [PATCH 2/4] ravb: Add optional PHY reset during system resume
From: Geert Uytterhoeven @ 2017-09-28 15:53 UTC (permalink / raw)
To: David S . Miller, Simon Horman, Magnus Damm
Cc: Sergei Shtylyov, Andrew Lunn, Florian Fainelli,
Niklas Söderlund, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven
In-Reply-To: <1506614014-4398-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
If the optional "reset-gpios" property is specified in DT, the generic
MDIO bus code takes care of resetting the PHY during device probe.
However, the PHY may still have to be reset explicitly after system
resume.
This allows to restore Ethernet operation after resume from s2ram on
Salvator-XS, where the enable pin of the regulator providing PHY power
is connected to PRESETn, and PSCI suspend powers down the SoC.
Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
---
drivers/net/ethernet/renesas/ravb_main.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index fdf30bfa403bf416..96d1d48e302f8c9a 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -19,6 +19,7 @@
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
+#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
@@ -2268,6 +2269,7 @@ static int __maybe_unused ravb_resume(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
struct ravb_private *priv = netdev_priv(ndev);
+ struct mii_bus *bus = priv->mii_bus;
int ret = 0;
if (priv->wol_enabled) {
@@ -2302,6 +2304,13 @@ static int __maybe_unused ravb_resume(struct device *dev)
* reopen device if it was running before system suspended.
*/
+ /* PHY reset */
+ if (bus->reset_gpiod) {
+ gpiod_set_value_cansleep(bus->reset_gpiod, 1);
+ udelay(bus->reset_delay_us);
+ gpiod_set_value_cansleep(bus->reset_gpiod, 0);
+ }
+
/* Set AVB config mode */
ravb_set_config_mode(ndev);
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 0/4] ravb: Add PHY reset support
From: Geert Uytterhoeven @ 2017-09-28 15:53 UTC (permalink / raw)
To: David S . Miller, Simon Horman, Magnus Damm
Cc: Sergei Shtylyov, Andrew Lunn, Florian Fainelli,
Niklas Söderlund, netdev, linux-renesas-soc, devicetree,
Geert Uytterhoeven
Hi all,
This patch series adds optional PHY reset support during EthernetAVB driver
probe and system resume on the Renesas Salvator-X/XS development boards.
The rationale behind this is twofold:
1. On Salvator-XS, the enable pin of the regulator providing PHY power
is connected to PRESETn, and PSCI powers down the SoC during system
suspend. Hence a PHY reset is needed to restore network functionality
after resume.
2. Linux should not rely on the boot loader having reset the PHY, but
should reset the PHY during driver probe.
The first two patches are destined for David's net-next tree. They update
the EthernetAVB DT bindings, and add support for resetting the PHY during
system resume.
The last two patches are destined for Simon's renesas tree. They add
properties to describe the EthernetAVB PHY reset topology to the common
Salvator-X/XS and ULCB DTS files.
Thanks!
Geert Uytterhoeven (4):
dt-bindings: net: ravb: Document optional reset-gpios property
ravb: Add optional PHY reset during system resume
arm64: dts: renesas: salvator-common: Add EthernetAVB PHY reset
arm64: dts: renesas: ulcb: Add EthernetAVB PHY reset
Documentation/devicetree/bindings/net/renesas,ravb.txt | 2 ++
arch/arm64/boot/dts/renesas/salvator-common.dtsi | 1 +
arch/arm64/boot/dts/renesas/ulcb.dtsi | 1 +
drivers/net/ethernet/renesas/ravb_main.c | 9 +++++++++
4 files changed, 13 insertions(+)
--
2.7.4
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH net] net: mvpp2: Fix clock resource by adding an optional bus clock
From: Gregory CLEMENT @ 2017-09-28 15:52 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Andrew Lunn, Yehuda Yitschak, Marcin Wojtas, Jason Cooper, netdev,
Antoine Tenart, Omri Itach, linux-kernel, Nadav Haklai,
Shadi Ammouri, Igal Liberman, Miquèl Raynal, Hanna Hawa,
David S. Miller, linux-arm-kernel, Sebastian Hesselbarth
In-Reply-To: <20170928174654.630cfefd@windsurf.lan>
Hi Thomas,
On jeu., sept. 28 2017, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:
>> /* List of pointers to port structures */
>> struct mvpp2_port **port_list;
>> @@ -7963,6 +7964,16 @@ static int mvpp2_probe(struct platform_device *pdev)
>> err = clk_prepare_enable(priv->mg_clk);
>> if (err < 0)
>> goto err_gop_clk;
>> +
>> + priv->axi_clk = devm_clk_get(&pdev->dev, "axi_clk");
>> + if (IS_ERR(priv->axi_clk)) {
>> + err = PTR_ERR(priv->axi_clk);
>> + priv->axi_clk = NULL;
>
> You should handle -EPROBE_DEFER here. Indeed, if we have -EPROBE_DEFER,
> we shouldn't treat it as "the clock doesn't exist, so let's skip it and
> continue", but rather as "the clock exists, but isn't ready to use yet,
> let's try later".
You're totally right, I will send a v2 (I will also fix the other issue
you spotted).
Thanks,
Gregory
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply
* Re: [PATCH net-next 2/2] tools: bpf: add bpftool
From: David Miller @ 2017-09-28 15:48 UTC (permalink / raw)
To: kubakici; +Cc: netdev, daniel, alexei.starovoitov, hannes, dsahern, oss-drivers
In-Reply-To: <20170928065912.00a9b6a1@cakuba>
From: Jakub Kicinski <kubakici@wp.pl>
Date: Thu, 28 Sep 2017 06:59:12 -0700
> On Tue, 26 Sep 2017 08:35:22 -0700, Jakub Kicinski wrote:
>> Add a simple tool for querying and updating BPF objects on the system.
>>
>> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>> Reviewed-by: Simon Horman <simon.horman@netronome.com>
>
> Dave, I got some late review nitpicks internally which I think are
> worth addressing. Would you mind dropping this series? I will post v2
> with the cleanups and README included.
Sure.
^ permalink raw reply
* Re: [PATCH net] net: mvpp2: Fix clock resource by adding an optional bus clock
From: Thomas Petazzoni @ 2017-09-28 15:46 UTC (permalink / raw)
To: Gregory CLEMENT
Cc: David S. Miller, linux-kernel, netdev, Jason Cooper, Andrew Lunn,
Sebastian Hesselbarth, linux-arm-kernel, Antoine Tenart,
Miquèl Raynal, Nadav Haklai, Shadi Ammouri, Yehuda Yitschak,
Omri Itach, Hanna Hawa, Igal Liberman, Marcin Wojtas
In-Reply-To: <20170928153923.29003-1-gregory.clement@free-electrons.com>
Hello,
On Thu, 28 Sep 2017 17:39:23 +0200, Gregory CLEMENT wrote:
> diff --git a/Documentation/devicetree/bindings/net/marvell-pp2.txt b/Documentation/devicetree/bindings/net/marvell-pp2.txt
> index 7e2dad08a12e..49e1be6bb6ba 100644
> --- a/Documentation/devicetree/bindings/net/marvell-pp2.txt
> +++ b/Documentation/devicetree/bindings/net/marvell-pp2.txt
> @@ -21,8 +21,9 @@ Required properties:
> - main controller clock (for both armada-375-pp2 and armada-7k-pp2)
> - GOP clock (for both armada-375-pp2 and armada-7k-pp2)
> - MG clock (only for armada-7k-pp2)
> -- clock-names: names of used clocks, must be "pp_clk", "gop_clk" and
> - "mg_clk" (the latter only for armada-7k-pp2).
> + - AXI clock (only for armada-7k-pp2)
> +- clock-names: names of used clocks, must be "pp_clk", "gop_clk", "mg_clk"
> + and "axi"(the 2 latter only for armada-7k-pp2).
Should be "axi_clk" not "axi", otherwise your binding documentation
doesn't match the driver and example.
Also, missing space after "axi".
>
> The ethernet ports are represented by subnodes. At least one port is
> required.
> @@ -78,8 +79,9 @@ Example for marvell,armada-7k-pp2:
> cpm_ethernet: ethernet@0 {
> compatible = "marvell,armada-7k-pp22";
> reg = <0x0 0x100000>, <0x129000 0xb000>;
> - clocks = <&cpm_syscon0 1 3>, <&cpm_syscon0 1 9>, <&cpm_syscon0 1 5>;
> - clock-names = "pp_clk", "gop_clk", "gp_clk";
> + clocks = <&cpm_syscon0 1 3>, <&cpm_syscon0 1 9>,
> + <&cpm_syscon0 1 5>, <&cpm_syscon0 1 18>;
Please indent the second line with one more tab.
> + clock-names = "pp_clk", "gop_clk", "gp_clk", "axi_clk";
>
> eth0: eth0 {
> interrupts = <ICU_GRP_NSR 39 IRQ_TYPE_LEVEL_HIGH>,
> diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
> index dd0ee2691c86..33b6791df2bb 100644
> --- a/drivers/net/ethernet/marvell/mvpp2.c
> +++ b/drivers/net/ethernet/marvell/mvpp2.c
> @@ -792,6 +792,7 @@ struct mvpp2 {
> struct clk *pp_clk;
> struct clk *gop_clk;
> struct clk *mg_clk;
> + struct clk *axi_clk;
>
> /* List of pointers to port structures */
> struct mvpp2_port **port_list;
> @@ -7963,6 +7964,16 @@ static int mvpp2_probe(struct platform_device *pdev)
> err = clk_prepare_enable(priv->mg_clk);
> if (err < 0)
> goto err_gop_clk;
> +
> + priv->axi_clk = devm_clk_get(&pdev->dev, "axi_clk");
> + if (IS_ERR(priv->axi_clk)) {
> + err = PTR_ERR(priv->axi_clk);
> + priv->axi_clk = NULL;
You should handle -EPROBE_DEFER here. Indeed, if we have -EPROBE_DEFER,
we shouldn't treat it as "the clock doesn't exist, so let's skip it and
continue", but rather as "the clock exists, but isn't ready to use yet,
let's try later".
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply
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