* Re: [PATCH v2 3/8] Documentation: bindings: net: add the Marvell PXA168 Ethernet controller
From: Arnd Bergmann @ 2014-09-09 15:58 UTC (permalink / raw)
To: Antoine Tenart
Cc: sebastian.hesselbarth, alexandre.belloni, thomas.petazzoni, zmxu,
jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410273848-24663-4-git-send-email-antoine.tenart@free-electrons.com>
On Tuesday 09 September 2014 16:44:03 Antoine Tenart wrote:
> +- clocks: pointer to the clock for the device.
> +- clock-names: should be "MFUCLK".
Clock names are normally not capitalized. Are you able to change
that name when providing a binding or make it an anoymous clock?
What does MFU stand for anyway?
Arnd
^ permalink raw reply
* [PATCH net-next] ipv4: udp4_gro_complete() is static
From: Eric Dumazet @ 2014-09-09 15:29 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Tom Herbert
From: Eric Dumazet <edumazet@google.com>
net/ipv4/udp_offload.c:339:5: warning: symbol 'udp4_gro_complete' was
not declared. Should it be static?
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <therbert@google.com>
Fixes: 57c67ff4bd92 ("udp: additional GRO support")
---
net/ipv4/udp_offload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 84e0e05c9c0e..52d5f46abf86 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -336,7 +336,7 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff)
return err;
}
-int udp4_gro_complete(struct sk_buff *skb, int nhoff)
+static int udp4_gro_complete(struct sk_buff *skb, int nhoff)
{
const struct iphdr *iph = ip_hdr(skb);
struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
^ permalink raw reply related
* [PATCH net-next] netns: remove one sparse warning
From: Eric Dumazet @ 2014-09-09 15:24 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
net/core/net_namespace.c:227:18: warning: incorrect type in argument 1
(different address spaces)
net/core/net_namespace.c:227:18: expected void const *<noident>
net/core/net_namespace.c:227:18: got struct net_generic [noderef]
<asn:4>*gen
We can use rcu_access_pointer() here as read-side access to the pointer
was removed at least one grace period ago.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/core/net_namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 7c6b51a58968..7f155175bba8 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -224,7 +224,7 @@ static void net_free(struct net *net)
return;
}
#endif
- kfree(net->gen);
+ kfree(rcu_access_pointer(net->gen));
kmem_cache_free(net_cachep, net);
}
^ permalink raw reply related
* Re: [net-next PATCH v3 02/15] net: rcu-ify tcf_proto
From: Eric Dumazet @ 2014-09-09 15:20 UTC (permalink / raw)
To: John Fastabend; +Cc: xiyou.wangcong, davem, jhs, netdev, paulmck, brouer
In-Reply-To: <540F1975.2080303@gmail.com>
On Tue, 2014-09-09 at 08:15 -0700, John Fastabend wrote:
>
> You mean RCU_INIT_POINTER() correct?
Right, I got this correct for other reviews ;)
>
> And to be clear which special case in rcupdate.h:999 applies here,
>
> * 1. This use of RCU_INIT_POINTER() is NULLing out the pointer -or-
> * 2. The caller has taken whatever steps are required to prevent
> * RCU readers from concurrently accessing this pointer -or-
> * 3. The referenced data structure has already been exposed to
> * readers either at compile time or via rcu_assign_pointer() -and-
> * a. You have not made -any- reader-visible changes to
> * this structure since then -or-
> * b. It is OK for readers accessing this structure from its
> * new location to see the old state of the structure. (For
> * example, the changes were to statistical counters or to
> * other state where exact synchronization is not required.)
>
In fact, everytime we remove an item from rcu protected list, its fine
to use RCU_INIT_POINTER
RCU_INIT_POINTER(*pprev, item->next);
Because we do not touch chain starting from item->next
>
> Its only NULLing out the pointer in special cases (case 1), with the
> qdisc lock dropped like in the last patch for ingress qdisc we may have
> concurrent readers (case 2) doing classification which will be walking
> the filter list, and with the tcf_ops change() its not clear to me that
> we can guarantee the structure has not been updated as stated in (case
> 3a).
>
> So the case here is 3b we are just updating the list structure to skip
> an entry and any old state is correct.
^ permalink raw reply
* Re: [PATCH v2 0/3] net: Add Keystone NetCP ethernet driver support
From: Santosh Shilimkar @ 2014-09-09 15:19 UTC (permalink / raw)
To: Jamal Hadi Salim, David Miller
Cc: netdev, linux-arm-kernel, linux-kernel, robh+dt, grant.likely,
devicetree, sandeep_n, Benjamin LaHaise, shrijeet Mukherjee
In-Reply-To: <540EE809.9020901@mojatatu.com>
On Tuesday 09 September 2014 07:44 AM, Jamal Hadi Salim wrote:
> On 09/08/14 10:41, Santosh Shilimkar wrote:
>
>>> The NetCP plugin module infrastructure use all the standard kernel
>>> infrastructure and its very tiny.
>
> So i found this manual here:
> http://www.silica.com/fileadmin/02_Products/Productdetails/Texas_Instruments/SILICA_TI_66AK2E05-ds.pdf
>
> Glad there is an open document!
> There are a couple of ethernet switch chips I can spot there.
>
All the documentation is open including packet accelerator offload
in ti.com.
> Can i control those with "bridge" or say "brctl" utilities?
>
> I can see the bridge ports are exposed and i should be able to
> control them via ifconfig or ip link. Thats what "standard
> kernel infrastructure" means. Magic hidden in a driver is
> not.
>
There is nothing magic hidden in the driver. The bridge ports
are exposed as standard network interfaces. Currently the
drivers don't support bridge offload functionality and
the bridging is disabled in the switch by default.
> Take a look at recent netconf discussion (as well as earlier
> referenced discussions):
> http://vger.kernel.org/netconf-nf-offload.pdf
>
> Maybe we can help providing you some direction?
> The problem is it doesnt seem that the offload specs for
> those other pieces are open? e.g how do i add an entry
> to the L2 switch?
>
We got such requests from customers but couldn't
support it for Linux. We are also looking for such
support and any direction are welcome. Your slide
deck seems to capture the key topics like L2/IPSEC
offload which we are also interested to hear.
Just to be clear, your point was about L2 switch offload
which the driver don't support at the moment. It might confuse
others. The driver doesn't implements anything non-standard.
Regards,
Santosh
^ permalink raw reply
* [PATCH net-next] ipv6: udp6_gro_complete() is static
From: Eric Dumazet @ 2014-09-09 15:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Tom Herbert
From: Eric Dumazet <edumazet@google.com>
net/ipv6/udp_offload.c:159:5: warning: symbol 'udp6_gro_complete' was
not declared. Should it be static?
Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: 57c67ff4bd92 ("udp: additional GRO support")
Cc: Tom Herbert <therbert@google.com>
---
net/ipv6/udp_offload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
index 89cb9a9b8537..a1ad34b1c4ec 100644
--- a/net/ipv6/udp_offload.c
+++ b/net/ipv6/udp_offload.c
@@ -156,7 +156,7 @@ flush:
return NULL;
}
-int udp6_gro_complete(struct sk_buff *skb, int nhoff)
+static int udp6_gro_complete(struct sk_buff *skb, int nhoff)
{
const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
^ permalink raw reply related
* Re: [net-next PATCH v3 02/15] net: rcu-ify tcf_proto
From: John Fastabend @ 2014-09-09 15:15 UTC (permalink / raw)
To: Eric Dumazet; +Cc: xiyou.wangcong, davem, jhs, netdev, paulmck, brouer
In-Reply-To: <1410265257.11872.154.camel@edumazet-glaptop2.roam.corp.google.com>
On 09/09/2014 05:20 AM, Eric Dumazet wrote:
> On Mon, 2014-09-08 at 22:54 -0700, John Fastabend wrote:
>> rcu'ify tcf_proto this allows calling tc_classify() without holding
>> any locks. Updaters are protected by RTNL.
>>
>> This patch prepares the core net_sched infrastracture for running
>> the classifier/action chains without holding the qdisc lock however
>> it does nothing to ensure cls_xxx and act_xxx types also work without
>> locking. Additional patches are required to address the fall out.
>>
>> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>> ---
>> include/net/sch_generic.h | 9 +++++----
>> net/sched/cls_api.c | 30 +++++++++++++++---------------
>> net/sched/sch_api.c | 10 +++++-----
>> net/sched/sch_atm.c | 22 +++++++++++++---------
>> net/sched/sch_cbq.c | 13 +++++++++----
>> net/sched/sch_choke.c | 17 ++++++++++++-----
>> net/sched/sch_drr.c | 9 ++++++---
>> net/sched/sch_dsmark.c | 9 +++++----
>> net/sched/sch_fq_codel.c | 11 +++++++----
>> net/sched/sch_hfsc.c | 8 ++++----
>> net/sched/sch_htb.c | 15 ++++++++-------
>> net/sched/sch_ingress.c | 8 +++++---
>> net/sched/sch_multiq.c | 8 +++++---
>> net/sched/sch_prio.c | 11 +++++++----
>> net/sched/sch_qfq.c | 9 ++++++---
>> net/sched/sch_sfb.c | 15 +++++++++------
>> net/sched/sch_sfq.c | 11 +++++++----
>> 17 files changed, 128 insertions(+), 87 deletions(-)
[...]
>> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
>> index c28b0d3..e3d3c48 100644
>> --- a/net/sched/cls_api.c
>> +++ b/net/sched/cls_api.c
>> @@ -117,7 +117,6 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
>> {
>> struct net *net = sock_net(skb->sk);
>> struct nlattr *tca[TCA_MAX + 1];
>> - spinlock_t *root_lock;
>> struct tcmsg *t;
>> u32 protocol;
>> u32 prio;
>> @@ -125,7 +124,8 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
>> u32 parent;
>> struct net_device *dev;
>> struct Qdisc *q;
>> - struct tcf_proto **back, **chain;
>> + struct tcf_proto __rcu **back;
>> + struct tcf_proto __rcu **chain;
>> struct tcf_proto *tp;
>> const struct tcf_proto_ops *tp_ops;
>> const struct Qdisc_class_ops *cops;
>> @@ -197,7 +197,9 @@ replay:
>> goto errout;
>>
>> /* Check the chain for existence of proto-tcf with this priority */
>> - for (back = chain; (tp = *back) != NULL; back = &tp->next) {
>> + for (back = chain;
>> + (tp = rtnl_dereference(*back)) != NULL;
>> + back = &tp->next) {
>> if (tp->prio >= prio) {
>> if (tp->prio == prio) {
>> if (!nprio ||
>> @@ -209,8 +211,6 @@ replay:
>> }
>> }
>>
>> - root_lock = qdisc_root_sleeping_lock(q);
>> -
>> if (tp == NULL) {
>> /* Proto-tcf does not exist, create new one */
>>
>> @@ -259,7 +259,8 @@ replay:
>> }
>> tp->ops = tp_ops;
>> tp->protocol = protocol;
>> - tp->prio = nprio ? : TC_H_MAJ(tcf_auto_prio(*back));
>> + tp->prio = nprio ? :
>> + TC_H_MAJ(tcf_auto_prio(rtnl_dereference(*back)));
>> tp->q = q;
>> tp->classify = tp_ops->classify;
>> tp->classid = parent;
>> @@ -280,9 +281,9 @@ replay:
>>
>> if (fh == 0) {
>> if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) {
>> - spin_lock_bh(root_lock);
>> - *back = tp->next;
>> - spin_unlock_bh(root_lock);
>> + struct tcf_proto *next = rtnl_dereference(tp->next);
>> +
>> + rcu_assign_pointer(*back, next);
>
> RCU_ACCESS_POINTER() is sufficient here. (vi +999
> include/linux/rcupdate.h if you want exact details)
>
You mean RCU_INIT_POINTER() correct?
And to be clear which special case in rcupdate.h:999 applies here,
* 1. This use of RCU_INIT_POINTER() is NULLing out the pointer -or-
* 2. The caller has taken whatever steps are required to prevent
* RCU readers from concurrently accessing this pointer -or-
* 3. The referenced data structure has already been exposed to
* readers either at compile time or via rcu_assign_pointer() -and-
* a. You have not made -any- reader-visible changes to
* this structure since then -or-
* b. It is OK for readers accessing this structure from its
* new location to see the old state of the structure. (For
* example, the changes were to statistical counters or to
* other state where exact synchronization is not required.)
Its only NULLing out the pointer in special cases (case 1), with the
qdisc lock dropped like in the last patch for ingress qdisc we may have
concurrent readers (case 2) doing classification which will be walking
the filter list, and with the tcf_ops change() its not clear to me that
we can guarantee the structure has not been updated as stated in (case
3a).
So the case here is 3b we are just updating the list structure to skip
an entry and any old state is correct.
>>
>> tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER);
>> tcf_destroy(tp);
>> @@ -322,10 +323,8 @@ replay:
>> n->nlmsg_flags & NLM_F_CREATE ? TCA_ACT_NOREPLACE : TCA_ACT_REPLACE);
>> if (err == 0) {
>> if (tp_created) {
>> - spin_lock_bh(root_lock);
>> - tp->next = *back;
>> - *back = tp;
>> - spin_unlock_bh(root_lock);
>> + rcu_assign_pointer(tp->next, rtnl_dereference(*back));
>
> The first rcu_assign_pointer() should be an RCU_ACCESS_POINTER() : tp is
> not yet visible to any reader.
RCU_INIT_POINTER()
>
>> + rcu_assign_pointer(*back, tp);
>
> This one is OK.
>
>> }
>> tfilter_notify(net, skb, n, tp, fh, RTM_NEWTFILTER);
>> } else {
>> @@ -420,7 +419,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
>> int s_t;
>> struct net_device *dev;
>> struct Qdisc *q;
>> - struct tcf_proto *tp, **chain;
>> + struct tcf_proto *tp, __rcu **chain;
>> struct tcmsg *tcm = nlmsg_data(cb->nlh);
>> unsigned long cl = 0;
>> const struct Qdisc_class_ops *cops;
>> @@ -454,7 +453,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
>>
>> s_t = cb->args[0];
>>
>> - for (tp = *chain, t = 0; tp; tp = tp->next, t++) {
>> + for (tp = rtnl_dereference(*chain), t = 0;
>> + tp; tp = rtnl_dereference(tp->next), t++) {
>> if (t < s_t)
>> continue;
>> if (TC_H_MAJ(tcm->tcm_info) &&
>> diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
>> index 58bed75..7c57867 100644
>> --- a/net/sched/sch_api.c
>> +++ b/net/sched/sch_api.c
>> @@ -1781,7 +1781,7 @@ int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
>> __be16 protocol = skb->protocol;
>> int err;
>>
>> - for (; tp; tp = tp->next) {
>> + for (; tp; tp = rcu_dereference_bh(tp->next)) {
>> if (tp->protocol != protocol &&
>> tp->protocol != htons(ETH_P_ALL))
>> continue;
>> @@ -1833,15 +1833,15 @@ void tcf_destroy(struct tcf_proto *tp)
>> {
>> tp->ops->destroy(tp);
>> module_put(tp->ops->owner);
>> - kfree(tp);
>> + kfree_rcu(tp, rcu);
>> }
>>
>> -void tcf_destroy_chain(struct tcf_proto **fl)
>> +void tcf_destroy_chain(struct tcf_proto __rcu **fl)
>> {
>> struct tcf_proto *tp;
>>
>> - while ((tp = *fl) != NULL) {
>> - *fl = tp->next;
>> + while ((tp = rtnl_dereference(*fl)) != NULL) {
>> + rcu_assign_pointer(*fl, tp->next);
>
> RCU_ACCESS_POINTER()
RCU_INIT_POINTER(), because the qdisc has already been detached
from any readers. And the last assign is NULL'ing the filter list.
>
>> tcf_destroy(tp);
>> }
>> }
>> diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
>> index 8449b33..9140bb0 100644
>> --- a/net/sched/sch_atm.c
>> +++ b/net/sched/sch_atm.c
>> @@ -41,7 +41,7 @@
>>
>> struct atm_flow_data {
>> struct Qdisc *q; /* FIFO, TBF, etc. */
>> - struct tcf_proto *filter_list;
>> + struct tcf_proto __rcu *filter_list;
>> struct atm_vcc *vcc; /* VCC; NULL if VCC is closed */
>> void (*old_pop)(struct atm_vcc *vcc,
>> struct sk_buff *skb); /* chaining */
>> @@ -142,7 +142,9 @@ static void atm_tc_put(struct Qdisc *sch, unsigned long cl)
>> list_del_init(&flow->list);
>> pr_debug("atm_tc_put: qdisc %p\n", flow->q);
>> qdisc_destroy(flow->q);
>> +
>
> Please refrain doing this cleanups as much as possible ;)
>
>> tcf_destroy_chain(&flow->filter_list);
>> +
>
> Same here
Yep I'll remove the noise in next version.
>
>> if (flow->sock) {
>> pr_debug("atm_tc_put: f_count %ld\n",
>> file_count(flow->sock->file));
>> @@ -273,7 +275,7 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
>> error = -ENOBUFS;
>> goto err_out;
>> }
>> - flow->filter_list = NULL;
>> + RCU_INIT_POINTER(flow->filter_list, NULL);
>> flow->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, classid);
>> if (!flow->q)
>> flow->q = &noop_qdisc;
>> @@ -311,7 +313,7 @@ static int atm_tc_delete(struct Qdisc *sch, unsigned long arg)
>> pr_debug("atm_tc_delete(sch %p,[qdisc %p],flow %p)\n", sch, p, flow);
>> if (list_empty(&flow->list))
>> return -EINVAL;
>> - if (flow->filter_list || flow == &p->link)
>> + if (rtnl_dereference(flow->filter_list) || flow == &p->link)
>
> rcu_access_pointer()
ok and I'll fix the rest of the NL noise as well.
Thanks,
John
--
John Fastabend Intel Corporation
^ permalink raw reply
* ATM MASTER CARD
From: dhl courier @ 2014-09-09 14:45 UTC (permalink / raw)
--
Dear, Beneficiary,
We have commenced the process of the release and payment to you of
your delayed due funds.
The total outstanding payment due in your favor is US$3.2m (Three
million two hundred US dollars only)and this is to be programmed into
our Swift ATM Cash card which will be delivered to your address for
you to use to make a maximum daily withdrawal of US$5,000.
Kindly contact the person responsible for processing of your payment below:
Regional Director,
The Card centre,
Cotonou,Benin Republic.
Mr.Thomas Bocco,
E-mail:dhlcourier320@gmail.com
Tele: +229-686-568-51
You are also required to re-confirm the following information:
1. Your Full names:____
2. Your delivery address:__
3. Your current telephone number:__
4. A copy of your id card or passport _
6. Your country and city:____
7. Your occupation:___
8. Your Age/ Sex:____
Sincerely,
Dr.Suliman Abdullah Aguid.
^ permalink raw reply
* [PATCH net-next] ipv4: rcu cleanup in ip_ra_control()
From: Eric Dumazet @ 2014-09-09 15:11 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
Remove one sparse warning :
net/ipv4/ip_sockglue.c:328:22: warning: incorrect type in assignment (different address spaces)
net/ipv4/ip_sockglue.c:328:22: expected struct ip_ra_chain [noderef] <asn:4>*next
net/ipv4/ip_sockglue.c:328:22: got struct ip_ra_chain *[assigned] ra
And replace one rcu_assign_ptr() by RCU_INIT_POINTER() where applicable.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv4/ip_sockglue.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 455e75bcb167..c373a9ad4555 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -303,7 +303,7 @@ int ip_ra_control(struct sock *sk, unsigned char on,
}
/* dont let ip_call_ra_chain() use sk again */
ra->sk = NULL;
- rcu_assign_pointer(*rap, ra->next);
+ RCU_INIT_POINTER(*rap, ra->next);
spin_unlock_bh(&ip_ra_lock);
if (ra->destructor)
@@ -325,7 +325,7 @@ int ip_ra_control(struct sock *sk, unsigned char on,
new_ra->sk = sk;
new_ra->destructor = destructor;
- new_ra->next = ra;
+ RCU_INIT_POINTER(new_ra->next, ra);
rcu_assign_pointer(*rap, new_ra);
sock_hold(sk);
spin_unlock_bh(&ip_ra_lock);
^ permalink raw reply related
* Re: Fw: [Bug 84061] New: net/batman-adv/gateway_client.c:813: missing sanity check and dodgy coding ?
From: Antonio Quartulli @ 2014-09-09 15:02 UTC (permalink / raw)
To: Stephen Hemminger,
The list for a Better Approach To Mobile Ad-hoc Networking
Cc: netdev
In-Reply-To: <20140908173014.2946e411@uryu.home.lan>
[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]
forwarding to the batman-adv mailing list and commenting inline.
On 09/09/14 02:30, Stephen Hemminger wrote:
>
>
> Begin forwarded message:
>
> Date: Mon, 8 Sep 2014 00:04:40 -0700
> From: "bugzilla-daemon@bugzilla.kernel.org" <bugzilla-daemon@bugzilla.kernel.org>
> To: "stephen@networkplumber.org" <stephen@networkplumber.org>
> Subject: [Bug 84061] New: net/batman-adv/gateway_client.c:813: missing sanity check and dodgy coding ?
>
>
> https://bugzilla.kernel.org/show_bug.cgi?id=84061
>
> Bug ID: 84061
> Summary: net/batman-adv/gateway_client.c:813: missing sanity
> check and dodgy coding ?
> Product: Networking
> Version: 2.5
> Kernel Version: 3.17-rc4
> Hardware: All
> OS: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: Other
> Assignee: shemminger@linux-foundation.org
> Reporter: dcb314@hotmail.com
> Regression: No
>
> net/batman-adv/gateway_client.c:813:31: warning: logical not is only applied to
> the left hand side of comparison [-Wlogical-not-parentheses]
>
> gw_node = batadv_gw_node_get(bat_priv, orig_dst_node);
> if (!gw_node->bandwidth_down == 0)
> goto out;
I think this was meant to be:
if (!gw_node || (gw_node->bandwidth_down == 0))
>
> Function batadv_gw_node_get can return NULL, so there's
> a missing sanity check there and maybe the if condition
> can be reworked for clarity.
>
--
Antonio Quartulli
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* [PATCH iproute2 2/2] ip/vxlan: fix display of maxaddress option
From: Nicolas Dichtel @ 2014-09-09 14:55 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel
In-Reply-To: <1410274511-17709-1-git-send-email-nicolas.dichtel@6wind.com>
Parenthesis are required else maxaddr value is a bool and thus output is always
1 when the option is set.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
ip/iplink_vxlan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 8aa25cd5fe52..d92cfe8156e4 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -361,7 +361,7 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
}
if (tb[IFLA_VXLAN_LIMIT] &&
- (maxaddr = rta_getattr_u32(tb[IFLA_VXLAN_LIMIT]) != 0))
+ ((maxaddr = rta_getattr_u32(tb[IFLA_VXLAN_LIMIT])) != 0))
fprintf(f, "maxaddr %u ", maxaddr);
}
--
2.1.0
^ permalink raw reply related
* [PATCH iproute2 1/2] ip/vxlan: add a help for ageing and maxaddress options
From: Nicolas Dichtel @ 2014-09-09 14:55 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel
These options were missing in usage and man pages.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
ip/iplink_vxlan.c | 1 +
man/man8/ip-link.8.in | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 53c50accde89..8aa25cd5fe52 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -28,6 +28,7 @@ static void explain(void)
fprintf(stderr, " [ dstport PORT ] [ srcport MIN MAX ]\n");
fprintf(stderr, " [ [no]learning ] [ [no]proxy ] [ [no]rsc ]\n");
fprintf(stderr, " [ [no]l2miss ] [ [no]l3miss ]\n");
+ fprintf(stderr, " [ ageing SECONDS ] [ maxaddress NUMBER ]\n");
fprintf(stderr, "\n");
fprintf(stderr, "Where: VNI := 0-16777215\n");
fprintf(stderr, " ADDR := { IP_ADDRESS | any }\n");
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 29d12fb2c773..383917a63669 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -262,6 +262,10 @@ the following additional arguments are supported:
.I "[no]l2miss "
.R " ] [ "
.I "[no]l3miss "
+.R " ] [ "
+.BI ageing " SECONDS "
+.R " ] [ "
+.BI maxaddress " NUMBER "
.R " ]"
.in +8
@@ -326,6 +330,14 @@ are entered into the VXLAN device forwarding database.
.I [no]l3miss
- specifies if netlink IP ADDR miss notifications are generated.
+.sp
+.BI ageing " SECONDS"
+- specifies the lifetime in seconds of FDB entries learnt by the kernel.
+
+.sp
+.BI maxaddress " NUMBER"
+- specifies the maximum number of FDB entries.
+
.in -8
.TP
--
2.1.0
^ permalink raw reply related
* Re: [PATCH v2 1/3] can: c_can_platform: Fix c_can_hw_raminit_ti() and add timeout
From: Roger Quadros @ 2014-09-09 14:54 UTC (permalink / raw)
To: Nishanth Menon, wg, mkl
Cc: tony, tglx, mugunthanvnm, george.cherian, balbi, nsekhar,
sergei.shtylyov, linux-omap, linux-can, netdev
In-Reply-To: <540F13E4.7020907@ti.com>
On 09/09/2014 05:51 PM, Nishanth Menon wrote:
> On 09/09/2014 09:45 AM, Roger Quadros wrote:
> [...]
>>>> /* We look only at the bits of our instance. */
>>>> val &= mask;
>>>> - while ((readl(priv->raminit_ctrlreg) & mask) != val)
>>>> + while ((readl(priv->raminit_ctrlreg) & mask) != val) {
>>>> udelay(1);
>>>> + timeout++;
>>>> +
>>>> + if (timeout == 1000) {
>>>
>>> How did we come up with this number?
>>
>> wild guess ;), that it should be set in a few microseconds and the delay is not too
>> large.
>>
>> Till I don't hear from hardware guys, it will remain a guess.
>>
>
> in cases like these, I suggest using emperical data as point ->
> example doing some 10,000 iterations of the operation and picking up
> the worse case number and double it.
In my tests the bit was either set immediately or never at all.
Not sure if we should increase it further.
>
> Either way, you need to document the same, else a few years down the
> line, when that number is in question, no one will know what it's
> basis was..
>
OK. I'll add a comment there.
cheers,
-roger
^ permalink raw reply
* Re: [PATCH v2 1/3] can: c_can_platform: Fix c_can_hw_raminit_ti() and add timeout
From: Nishanth Menon @ 2014-09-09 14:51 UTC (permalink / raw)
To: Roger Quadros, wg, mkl
Cc: tony, tglx, mugunthanvnm, george.cherian, balbi, nsekhar,
sergei.shtylyov, linux-omap, linux-can, netdev
In-Reply-To: <540F1294.9080107@ti.com>
On 09/09/2014 09:45 AM, Roger Quadros wrote:
[...]
>>> /* We look only at the bits of our instance. */
>>> val &= mask;
>>> - while ((readl(priv->raminit_ctrlreg) & mask) != val)
>>> + while ((readl(priv->raminit_ctrlreg) & mask) != val) {
>>> udelay(1);
>>> + timeout++;
>>> +
>>> + if (timeout == 1000) {
>>
>> How did we come up with this number?
>
> wild guess ;), that it should be set in a few microseconds and the delay is not too
> large.
>
> Till I don't hear from hardware guys, it will remain a guess.
>
in cases like these, I suggest using emperical data as point ->
example doing some 10,000 iterations of the operation and picking up
the worse case number and double it.
Either way, you need to document the same, else a few years down the
line, when that number is in question, no one will know what it's
basis was..
--
Regards,
Nishanth Menon
^ permalink raw reply
* Re: [PATCH 1/5] net: mvberlin_eth: add an Ethernet driver for Marvell Berlin
From: Antoine Tenart @ 2014-09-09 14:51 UTC (permalink / raw)
To: Ezequiel Garcia
Cc: Antoine Tenart, sebastian.hesselbarth, thomas.petazzoni,
alexandre.belloni, zmxu, jszhang, netdev, linux-arm-kernel,
devicetree, linux-kernel
In-Reply-To: <20140829145145.GA7735@arch.cereza>
Ezequiel,
On Fri, Aug 29, 2014 at 11:51:45AM -0300, Ezequiel Garcia wrote:
> Hi Antoine,
>
> A quick look...
Well, it seems Sebastian is right and we can use the existing PXA168
Ethernet driver, so I just sent a new series doing that...
Thanks for the review anyway!
Antoine
--
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply
* Re: [PATCH v2 1/3] can: c_can_platform: Fix c_can_hw_raminit_ti() and add timeout
From: Roger Quadros @ 2014-09-09 14:45 UTC (permalink / raw)
To: Nishanth Menon, wg, mkl
Cc: tony, tglx, mugunthanvnm, george.cherian, balbi, nsekhar,
sergei.shtylyov, linux-omap, linux-can, netdev
In-Reply-To: <540F0FEE.2040202@ti.com>
On 09/09/2014 05:34 PM, Nishanth Menon wrote:
> On 09/09/2014 09:31 AM, Roger Quadros wrote:
>> Pass the correct 'mask' and 'value' bits to c_can_hw_raminit_wait_ti().
>> They seem to have been swapped in the usage instances.
>>
>> TI's RAMINIT DONE mechanism is buggy and may not always be
>> set after the START bit is set. So add a timeout mechanism to
>> c_can_hw_raminit_wait_ti().
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>> drivers/net/can/c_can/c_can_platform.c | 14 +++++++++++---
>> 1 file changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
>> index 109cb44..b144e71 100644
>> --- a/drivers/net/can/c_can/c_can_platform.c
>> +++ b/drivers/net/can/c_can/c_can_platform.c
>> @@ -75,10 +75,18 @@ static void c_can_plat_write_reg_aligned_to_32bit(const struct c_can_priv *priv,
>> static void c_can_hw_raminit_wait_ti(const struct c_can_priv *priv, u32 mask,
>> u32 val)
>> {
>> + int timeout = 0;
>> /* We look only at the bits of our instance. */
>> val &= mask;
>> - while ((readl(priv->raminit_ctrlreg) & mask) != val)
>> + while ((readl(priv->raminit_ctrlreg) & mask) != val) {
>> udelay(1);
>> + timeout++;
>> +
>> + if (timeout == 1000) {
>
> How did we come up with this number?
wild guess ;), that it should be set in a few microseconds and the delay is not too
large.
Till I don't hear from hardware guys, it will remain a guess.
>
>> + dev_err(&priv->dev->dev, "%s: time out\n", __func__);
>> + break;
> lets say we did timeout..
> see below:
>> + }
>> + }
>> }
>>
>> static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)
>> @@ -97,14 +105,14 @@ static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)
>> ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
>> writel(ctrl, priv->raminit_ctrlreg);
>> ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance);
>> - c_can_hw_raminit_wait_ti(priv, ctrl, mask);
>> + c_can_hw_raminit_wait_ti(priv, mask, ctrl);
>>
>> if (enable) {
>> /* Set start bit and wait for the done bit. */
>> ctrl |= CAN_RAMINIT_START_MASK(priv->instance);
>> writel(ctrl, priv->raminit_ctrlreg);
>> ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
>> - c_can_hw_raminit_wait_ti(priv, ctrl, mask);
>> + c_can_hw_raminit_wait_ti(priv, mask, ctrl);
>
> is it possible for us to continue? does it make sense for us to change
> that void to a int and handle error cascading?
I will verify this first to check if the hardware works or not in the failing case.
Considering we never checked for the DONE bit in our earlier TI releases maybe it works.
But I'll verify and get back.
>
>> }
>> spin_unlock(&raminit_lock);
>> }
>>
>
>
cheers,
-roger
^ permalink raw reply
* [PATCH v2 7/8] ARM: dts: berlin: add the Ethernet node
From: Antoine Tenart @ 2014-09-09 14:44 UTC (permalink / raw)
To: sebastian.hesselbarth
Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410273848-24663-1-git-send-email-antoine.tenart@free-electrons.com>
This patch adds the Ethernet node, enabling the network unit on Berlin
BG2Q SoCs.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
arch/arm/boot/dts/berlin2q.dtsi | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
index 400c40fceccc..a216cb621ebc 100644
--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -114,6 +114,15 @@
#interrupt-cells = <3>;
};
+ eth0: ethernet@b90000 {
+ compatible = "marvell,pxa168-eth";
+ reg = <0xb90000 0x10000>;
+ clocks = <&chip CLKID_GETH0>;
+ clock-names = "MFUCLK";
+ interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+ status = "disabled";
+ };
+
cpu-ctrl@dd0000 {
compatible = "marvell,berlin-cpu-ctrl";
reg = <0xdd0000 0x10000>;
--
1.9.1
^ permalink raw reply related
* [PATCH v2 5/8] net: pxa168_eth: get and set the mac address on the Ethernet controller
From: Antoine Tenart @ 2014-09-09 14:44 UTC (permalink / raw)
To: sebastian.hesselbarth
Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410273848-24663-1-git-send-email-antoine.tenart@free-electrons.com>
When changing the MAC address, in addition to updating the dev_addr in
the net_device structure, this patch also update the MAC address
registers (high and low) of the Ethernet controller with the new MAC.
The address stored in these registers is used for IEEE 802.3x Ethernet
flow control, which is already enabled.
This patch also tries reading the MAC address stored in these registers
when probing the driver, to use the MAC address set by the bootloader
and avoid using a random one.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
drivers/net/ethernet/marvell/pxa168_eth.c | 36 +++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 10422f2df6cc..0ecbb3903b71 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -60,6 +60,8 @@
#define PORT_COMMAND 0x0410
#define PORT_STATUS 0x0418
#define HTPR 0x0428
+#define MAC_ADDR_LOW 0x0430
+#define MAC_ADDR_HIGH 0x0438
#define SDMA_CONFIG 0x0440
#define SDMA_CMD 0x0448
#define INT_CAUSE 0x0450
@@ -604,16 +606,42 @@ static void pxa168_eth_set_rx_mode(struct net_device *dev)
update_hash_table_mac_address(pep, NULL, ha->addr);
}
+static void pxa168_eth_get_mac_address(struct net_device *dev,
+ unsigned char *addr)
+{
+ struct pxa168_eth_private *pep = netdev_priv(dev);
+ unsigned int mac_h = rdl(pep, MAC_ADDR_HIGH);
+ unsigned int mac_l = rdl(pep, MAC_ADDR_LOW);
+
+ addr[0] = (mac_h >> 24) & 0xff;
+ addr[1] = (mac_h >> 16) & 0xff;
+ addr[2] = (mac_h >> 8) & 0xff;
+ addr[3] = mac_h & 0xff;
+ addr[4] = (mac_l >> 8) & 0xff;
+ addr[5] = mac_l & 0xff;
+}
+
static int pxa168_eth_set_mac_address(struct net_device *dev, void *addr)
{
struct sockaddr *sa = addr;
struct pxa168_eth_private *pep = netdev_priv(dev);
unsigned char oldMac[ETH_ALEN];
+ u32 mac_h, mac_l;
if (!is_valid_ether_addr(sa->sa_data))
return -EADDRNOTAVAIL;
memcpy(oldMac, dev->dev_addr, ETH_ALEN);
memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
+
+ mac_h = sa->sa_data[0] << 24;
+ mac_h |= sa->sa_data[1] << 16;
+ mac_h |= sa->sa_data[2] << 8;
+ mac_h |= sa->sa_data[3];
+ mac_l = sa->sa_data[4] << 8;
+ mac_l |= sa->sa_data[5];
+ wrl(pep, MAC_ADDR_HIGH, mac_h);
+ wrl(pep, MAC_ADDR_LOW, mac_l);
+
netif_addr_lock_bh(dev);
update_hash_table_mac_address(pep, oldMac, dev->dev_addr);
netif_addr_unlock_bh(dev);
@@ -1494,8 +1522,12 @@ static int pxa168_eth_probe(struct platform_device *pdev)
INIT_WORK(&pep->tx_timeout_task, pxa168_eth_tx_timeout_task);
- dev_info(&pdev->dev, "Using random mac address\n");
- eth_hw_addr_random(dev);
+ /* try reading the mac address, if set by the bootloader */
+ pxa168_eth_get_mac_address(dev, dev->dev_addr);
+ if (!is_valid_ether_addr(dev->dev_addr)) {
+ dev_info(&pdev->dev, "Using random mac address\n");
+ eth_hw_addr_random(dev);
+ }
pep->rx_ring_size = NUM_RX_DESCS;
pep->tx_ring_size = NUM_TX_DESCS;
--
1.9.1
^ permalink raw reply related
* [PATCH v2 8/8] ARM: dts: berlin: enable the Ethernet port on the BG2Q DMP
From: Antoine Tenart @ 2014-09-09 14:44 UTC (permalink / raw)
To: sebastian.hesselbarth
Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410273848-24663-1-git-send-email-antoine.tenart@free-electrons.com>
This patch enables the Ethernet port on the Marvell Berlin2Q DMP board.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
index a357ce02a64e..ea1f99b8eed6 100644
--- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
+++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
@@ -45,3 +45,7 @@
&uart0 {
status = "okay";
};
+
+ð0 {
+ status = "okay";
+};
--
1.9.1
^ permalink raw reply related
* [PATCH v2 6/8] net: pxa168_eth: allow Berlin SoCs to use the pxa168_eth driver
From: Antoine Tenart @ 2014-09-09 14:44 UTC (permalink / raw)
To: sebastian.hesselbarth
Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410273848-24663-1-git-send-email-antoine.tenart@free-electrons.com>
Berlin SoCs have an Ethernet controller compatible with the pxa168.
Allow these SoCs to use the pxa168_eth driver.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
drivers/net/ethernet/marvell/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig
index 1b4fc7c639e6..48b9466d1781 100644
--- a/drivers/net/ethernet/marvell/Kconfig
+++ b/drivers/net/ethernet/marvell/Kconfig
@@ -64,7 +64,7 @@ config MVPP2
config PXA168_ETH
tristate "Marvell pxa168 ethernet support"
- depends on CPU_PXA168
+ depends on CPU_PXA168 || ARCH_BERLIN
select PHYLIB
---help---
This driver supports the pxa168 Ethernet ports.
--
1.9.1
^ permalink raw reply related
* [PATCH v2 4/8] net: pxa168_eth: fix Ethernet flow control status
From: Antoine Tenart @ 2014-09-09 14:44 UTC (permalink / raw)
To: sebastian.hesselbarth
Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410273848-24663-1-git-send-email-antoine.tenart@free-electrons.com>
IEEE 802.3x Ethernet flow control is disabled when bit (1 << 2) is set
in the port status register. Fix the flow control detection in the link
event handling function which was relying on the opposite assumption.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
drivers/net/ethernet/marvell/pxa168_eth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 953112f87c5f..10422f2df6cc 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -163,7 +163,7 @@
/* Bit definitions for Port status */
#define PORT_SPEED_100 (1 << 0)
#define FULL_DUPLEX (1 << 1)
-#define FLOW_CONTROL_ENABLED (1 << 2)
+#define FLOW_CONTROL_DISABLED (1 << 2)
#define LINK_UP (1 << 3)
/* Bit definitions for work to be done */
@@ -885,7 +885,7 @@ static void handle_link_event(struct pxa168_eth_private *pep)
speed = 10;
duplex = (port_status & FULL_DUPLEX) ? 1 : 0;
- fc = (port_status & FLOW_CONTROL_ENABLED) ? 1 : 0;
+ fc = (port_status & FLOW_CONTROL_DISABLED) ? 0 : 1;
netdev_info(dev, "link up, %d Mb/s, %s duplex, flow control %sabled\n",
speed, duplex ? "full" : "half", fc ? "en" : "dis");
if (!netif_carrier_ok(dev))
--
1.9.1
^ permalink raw reply related
* [PATCH v2 3/8] Documentation: bindings: net: add the Marvell PXA168 Ethernet controller
From: Antoine Tenart @ 2014-09-09 14:44 UTC (permalink / raw)
To: sebastian.hesselbarth
Cc: thomas.petazzoni, zmxu, devicetree, netdev, Antoine Tenart,
linux-kernel, alexandre.belloni, jszhang, linux-arm-kernel
In-Reply-To: <1410273848-24663-1-git-send-email-antoine.tenart@free-electrons.com>
This adds the binding documentation for the Marvell PXA168 Ethernet
controller, following its DT support.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
.../devicetree/bindings/net/marvell-pxa168.txt | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/marvell-pxa168.txt
diff --git a/Documentation/devicetree/bindings/net/marvell-pxa168.txt b/Documentation/devicetree/bindings/net/marvell-pxa168.txt
new file mode 100644
index 000000000000..3a5320ad09a3
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/marvell-pxa168.txt
@@ -0,0 +1,22 @@
+* Marvell PXA168 Ethernet Controller
+
+Required properties:
+- compatible: should be "marvell,pxa168-eth".
+- reg: address and length of the register set for the device.
+- interrupts: interrupt for the device.
+- clocks: pointer to the clock for the device.
+- clock-names: should be "MFUCLK".
+
+Optional properties:
+- port-id: should be '0','1' or '2'.
+- phy-addr: MDIO address of the PHY.
+
+Example:
+
+ eth0: ethernet@f7b90000 {
+ compatible = "marvell,pxa168-eth";
+ reg = <0xf7b90000 0x10000>;
+ clocks = <&chip CLKID_GETH0>;
+ clock-names = "MFUCLK";
+ interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+ };
--
1.9.1
^ permalink raw reply related
* [PATCH v2 2/8] net: pxa168_eth: add device tree support
From: Antoine Tenart @ 2014-09-09 14:44 UTC (permalink / raw)
To: sebastian.hesselbarth
Cc: thomas.petazzoni, zmxu, devicetree, netdev, Antoine Tenart,
linux-kernel, alexandre.belloni, jszhang, linux-arm-kernel
In-Reply-To: <1410273848-24663-1-git-send-email-antoine.tenart@free-electrons.com>
Add the device tree support to the pxa168_eth driver.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
drivers/net/ethernet/marvell/pxa168_eth.c | 67 ++++++++++++++++++++-----------
1 file changed, 44 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index b370162dbe02..953112f87c5f 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -193,6 +193,7 @@ struct tx_desc {
struct pxa168_eth_private {
int port_num; /* User Ethernet port number */
+ int phy_addr;
int rx_resource_err; /* Rx ring resource error flag */
@@ -1360,24 +1361,25 @@ static struct phy_device *phy_scan(struct pxa168_eth_private *pep, int phy_addr)
return phydev;
}
-static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex)
+static void phy_init(struct pxa168_eth_private *pep)
{
struct phy_device *phy = pep->phy;
phy_attach(pep->dev, dev_name(&phy->dev), PHY_INTERFACE_MODE_MII);
- if (speed == 0) {
+ if (pep->pd && pep->pd->speed != 0) {
+ phy->autoneg = AUTONEG_DISABLE;
+ phy->advertising = 0;
+ phy->speed = pep->pd->speed;
+ phy->duplex = pep->pd->duplex;
+ } else {
phy->autoneg = AUTONEG_ENABLE;
phy->speed = 0;
phy->duplex = 0;
phy->supported &= PHY_BASIC_FEATURES;
phy->advertising = phy->supported | ADVERTISED_Autoneg;
- } else {
- phy->autoneg = AUTONEG_DISABLE;
- phy->advertising = 0;
- phy->speed = speed;
- phy->duplex = duplex;
}
+
phy_start_aneg(phy);
}
@@ -1385,11 +1387,13 @@ static int ethernet_phy_setup(struct net_device *dev)
{
struct pxa168_eth_private *pep = netdev_priv(dev);
- if (pep->pd->init)
+ if (pep->pd && pep->pd->init)
pep->pd->init();
- pep->phy = phy_scan(pep, pep->pd->phy_addr & 0x1f);
+
+ pep->phy = phy_scan(pep, pep->phy_addr & 0x1f);
if (pep->phy != NULL)
- phy_init(pep, pep->pd->speed, pep->pd->duplex);
+ phy_init(pep);
+
update_hash_table_mac_address(pep, NULL, dev->dev_addr);
return 0;
@@ -1453,12 +1457,12 @@ static int pxa168_eth_probe(struct platform_device *pdev)
printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n");
- clk = clk_get(&pdev->dev, "MFUCLK");
+ clk = devm_clk_get(&pdev->dev, "MFUCLK");
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "Fast Ethernet failed to get clock\n");
return -ENODEV;
}
- clk_enable(clk);
+ clk_prepare_enable(clk);
dev = alloc_etherdev(sizeof(struct pxa168_eth_private));
if (!dev) {
@@ -1475,8 +1479,8 @@ static int pxa168_eth_probe(struct platform_device *pdev)
err = -ENODEV;
goto err_netdev;
}
- pep->base = ioremap(res->start, resource_size(res));
- if (pep->base == NULL) {
+ pep->base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(pep->base)) {
err = -ENOMEM;
goto err_netdev;
}
@@ -1493,16 +1497,26 @@ static int pxa168_eth_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Using random mac address\n");
eth_hw_addr_random(dev);
- pep->pd = dev_get_platdata(&pdev->dev);
pep->rx_ring_size = NUM_RX_DESCS;
- if (pep->pd->rx_queue_size)
- pep->rx_ring_size = pep->pd->rx_queue_size;
-
pep->tx_ring_size = NUM_TX_DESCS;
- if (pep->pd->tx_queue_size)
- pep->tx_ring_size = pep->pd->tx_queue_size;
- pep->port_num = pep->pd->port_number;
+ pep->pd = dev_get_platdata(&pdev->dev);
+ if (pep->pd) {
+ if (pep->pd->rx_queue_size)
+ pep->rx_ring_size = pep->pd->rx_queue_size;
+
+ if (pep->pd->tx_queue_size)
+ pep->tx_ring_size = pep->pd->tx_queue_size;
+
+ pep->port_num = pep->pd->port_number;
+ pep->phy_addr = pep->pd->phy_addr;
+ } else if (pdev->dev.of_node) {
+ of_property_read_u32(pdev->dev.of_node, "port-id",
+ &pep->port_num);
+ of_property_read_u32(pdev->dev.of_node, "phy-addr",
+ &pep->phy_addr);
+ }
+
/* Hardware supports only 3 ports */
BUG_ON(pep->port_num > 2);
netif_napi_add(dev, &pep->napi, pxa168_rx_poll, pep->rx_ring_size);
@@ -1603,6 +1617,12 @@ static int pxa168_eth_suspend(struct platform_device *pdev, pm_message_t state)
#define pxa168_eth_suspend NULL
#endif
+static const struct of_device_id pxa168_eth_of_match[] = {
+ { .compatible = "marvell,pxa168-eth" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, pxa168_eth_of_match)
+
static struct platform_driver pxa168_eth_driver = {
.probe = pxa168_eth_probe,
.remove = pxa168_eth_remove,
@@ -1610,8 +1630,9 @@ static struct platform_driver pxa168_eth_driver = {
.resume = pxa168_eth_resume,
.suspend = pxa168_eth_suspend,
.driver = {
- .name = DRIVER_NAME,
- },
+ .name = DRIVER_NAME,
+ .of_match_table = of_match_ptr(pxa168_eth_of_match),
+ },
};
module_platform_driver(pxa168_eth_driver);
--
1.9.1
^ permalink raw reply related
* [PATCH v2 1/8] net: pxa168_eth: clean up
From: Antoine Tenart @ 2014-09-09 14:44 UTC (permalink / raw)
To: sebastian.hesselbarth
Cc: thomas.petazzoni, zmxu, devicetree, netdev, Antoine Tenart,
linux-kernel, alexandre.belloni, jszhang, linux-arm-kernel
In-Reply-To: <1410273848-24663-1-git-send-email-antoine.tenart@free-electrons.com>
Clean up a bit the pxa168_eth driver before adding the device tree
support.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
drivers/net/ethernet/marvell/pxa168_eth.c | 102 +++++++++++++++---------------
1 file changed, 50 insertions(+), 52 deletions(-)
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 8f5aa7c62b18..b370162dbe02 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -22,27 +22,29 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#include <linux/dma-mapping.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>
-#include <linux/udp.h>
-#include <linux/etherdevice.h>
#include <linux/bitops.h>
+#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/dma-mapping.h>
+#include <linux/etherdevice.h>
#include <linux/ethtool.h>
-#include <linux/platform_device.h>
-#include <linux/module.h>
+#include <linux/in.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/ip.h>
#include <linux/kernel.h>
-#include <linux/workqueue.h>
-#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/of.h>
#include <linux/phy.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/pxa168_eth.h>
+#include <linux/tcp.h>
#include <linux/types.h>
+#include <linux/udp.h>
+#include <linux/workqueue.h>
+
#include <asm/pgtable.h>
#include <asm/cacheflush.h>
-#include <linux/pxa168_eth.h>
#define DRIVER_NAME "pxa168-eth"
#define DRIVER_VERSION "0.3"
@@ -296,7 +298,7 @@ static void abort_dma(struct pxa168_eth_private *pep)
} while (max_retries-- > 0 && delay <= 0);
if (max_retries <= 0)
- printk(KERN_ERR "%s : DMA Stuck\n", __func__);
+ netdev_err(pep->dev, "%s : DMA Stuck\n", __func__);
}
static int ethernet_phy_get(struct pxa168_eth_private *pep)
@@ -507,9 +509,10 @@ static int add_del_hash_entry(struct pxa168_eth_private *pep,
if (i == HOP_NUMBER) {
if (!del) {
- printk(KERN_INFO "%s: table section is full, need to "
- "move to 16kB implementation?\n",
- __FILE__);
+ netdev_info(pep->dev,
+ "%s: table section is full, need to "
+ "move to 16kB implementation?\n",
+ __FILE__);
return -ENOSPC;
} else
return 0;
@@ -726,7 +729,7 @@ static int txq_reclaim(struct net_device *dev, int force)
if (cmd_sts & TX_ERROR) {
if (net_ratelimit())
- printk(KERN_ERR "%s: Error in TX\n", dev->name);
+ netdev_err(dev, "Error in TX\n");
dev->stats.tx_errors++;
}
dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE);
@@ -743,8 +746,7 @@ static void pxa168_eth_tx_timeout(struct net_device *dev)
{
struct pxa168_eth_private *pep = netdev_priv(dev);
- printk(KERN_INFO "%s: TX timeout desc_count %d\n",
- dev->name, pep->tx_desc_count);
+ netdev_info(dev, "TX timeout desc_count %d\n", pep->tx_desc_count);
schedule_work(&pep->tx_timeout_task);
}
@@ -814,9 +816,8 @@ static int rxq_process(struct net_device *dev, int budget)
if ((cmd_sts & (RX_FIRST_DESC | RX_LAST_DESC)) !=
(RX_FIRST_DESC | RX_LAST_DESC)) {
if (net_ratelimit())
- printk(KERN_ERR
- "%s: Rx pkt on multiple desc\n",
- dev->name);
+ netdev_err(dev,
+ "Rx pkt on multiple desc\n");
}
if (cmd_sts & RX_ERROR)
stats->rx_errors++;
@@ -871,7 +872,7 @@ static void handle_link_event(struct pxa168_eth_private *pep)
port_status = rdl(pep, PORT_STATUS);
if (!(port_status & LINK_UP)) {
if (netif_carrier_ok(dev)) {
- printk(KERN_INFO "%s: link down\n", dev->name);
+ netdev_info(dev, "link down\n");
netif_carrier_off(dev);
txq_reclaim(dev, 1);
}
@@ -884,9 +885,8 @@ static void handle_link_event(struct pxa168_eth_private *pep)
duplex = (port_status & FULL_DUPLEX) ? 1 : 0;
fc = (port_status & FLOW_CONTROL_ENABLED) ? 1 : 0;
- printk(KERN_INFO "%s: link up, %d Mb/s, %s duplex, "
- "flow control %sabled\n", dev->name,
- speed, duplex ? "full" : "half", fc ? "en" : "dis");
+ netdev_info(dev, "link up, %d Mb/s, %s duplex, flow control %sabled\n",
+ speed, duplex ? "full" : "half", fc ? "en" : "dis");
if (!netif_carrier_ok(dev))
netif_carrier_on(dev);
}
@@ -1039,9 +1039,8 @@ static void rxq_deinit(struct net_device *dev)
}
}
if (pep->rx_desc_count)
- printk(KERN_ERR
- "Error in freeing Rx Ring. %d skb's still\n",
- pep->rx_desc_count);
+ netdev_err(dev, "Error in freeing Rx Ring. %d skb's still\n",
+ pep->rx_desc_count);
/* Free RX ring */
if (pep->p_rx_desc_area)
dma_free_coherent(pep->dev->dev.parent, pep->rx_desc_area_size,
@@ -1280,15 +1279,15 @@ static int pxa168_smi_read(struct mii_bus *bus, int phy_addr, int regnum)
int val;
if (smi_wait_ready(pep)) {
- printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n");
+ netdev_warn(pep->dev, "pxa168_eth: SMI bus busy timeout\n");
return -ETIMEDOUT;
}
wrl(pep, SMI, (phy_addr << 16) | (regnum << 21) | SMI_OP_R);
/* now wait for the data to be valid */
for (i = 0; !((val = rdl(pep, SMI)) & SMI_R_VALID); i++) {
if (i == PHY_WAIT_ITERATIONS) {
- printk(KERN_WARNING
- "pxa168_eth: SMI bus read not valid\n");
+ netdev_warn(pep->dev,
+ "pxa168_eth: SMI bus read not valid\n");
return -ENODEV;
}
msleep(10);
@@ -1303,7 +1302,7 @@ static int pxa168_smi_write(struct mii_bus *bus, int phy_addr, int regnum,
struct pxa168_eth_private *pep = bus->priv;
if (smi_wait_ready(pep)) {
- printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n");
+ netdev_warn(pep->dev, "pxa168_eth: SMI bus busy timeout\n");
return -ETIMEDOUT;
}
@@ -1311,7 +1310,7 @@ static int pxa168_smi_write(struct mii_bus *bus, int phy_addr, int regnum,
SMI_OP_W | (value & 0xffff));
if (smi_wait_ready(pep)) {
- printk(KERN_ERR "pxa168_eth: SMI bus busy timeout\n");
+ netdev_err(pep->dev, "pxa168_eth: SMI bus busy timeout\n");
return -ETIMEDOUT;
}
@@ -1425,23 +1424,23 @@ static void pxa168_get_drvinfo(struct net_device *dev,
}
static const struct ethtool_ops pxa168_ethtool_ops = {
- .get_settings = pxa168_get_settings,
- .set_settings = pxa168_set_settings,
- .get_drvinfo = pxa168_get_drvinfo,
- .get_link = ethtool_op_get_link,
- .get_ts_info = ethtool_op_get_ts_info,
+ .get_settings = pxa168_get_settings,
+ .set_settings = pxa168_set_settings,
+ .get_drvinfo = pxa168_get_drvinfo,
+ .get_link = ethtool_op_get_link,
+ .get_ts_info = ethtool_op_get_ts_info,
};
static const struct net_device_ops pxa168_eth_netdev_ops = {
- .ndo_open = pxa168_eth_open,
- .ndo_stop = pxa168_eth_stop,
- .ndo_start_xmit = pxa168_eth_start_xmit,
- .ndo_set_rx_mode = pxa168_eth_set_rx_mode,
- .ndo_set_mac_address = pxa168_eth_set_mac_address,
- .ndo_validate_addr = eth_validate_addr,
- .ndo_do_ioctl = pxa168_eth_do_ioctl,
- .ndo_change_mtu = pxa168_eth_change_mtu,
- .ndo_tx_timeout = pxa168_eth_tx_timeout,
+ .ndo_open = pxa168_eth_open,
+ .ndo_stop = pxa168_eth_stop,
+ .ndo_start_xmit = pxa168_eth_start_xmit,
+ .ndo_set_rx_mode = pxa168_eth_set_rx_mode,
+ .ndo_set_mac_address = pxa168_eth_set_mac_address,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_do_ioctl = pxa168_eth_do_ioctl,
+ .ndo_change_mtu = pxa168_eth_change_mtu,
+ .ndo_tx_timeout = pxa168_eth_tx_timeout,
};
static int pxa168_eth_probe(struct platform_device *pdev)
@@ -1456,8 +1455,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
clk = clk_get(&pdev->dev, "MFUCLK");
if (IS_ERR(clk)) {
- printk(KERN_ERR "%s: Fast Ethernet failed to get clock\n",
- DRIVER_NAME);
+ dev_err(&pdev->dev, "Fast Ethernet failed to get clock\n");
return -ENODEV;
}
clk_enable(clk);
@@ -1492,7 +1490,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
INIT_WORK(&pep->tx_timeout_task, pxa168_eth_tx_timeout_task);
- printk(KERN_INFO "%s:Using random mac address\n", DRIVER_NAME);
+ dev_info(&pdev->dev, "Using random mac address\n");
eth_hw_addr_random(dev);
pep->pd = dev_get_platdata(&pdev->dev);
--
1.9.1
^ permalink raw reply related
* [PATCH v2 0/8] ARM: Berlin: Ethernet support
From: Antoine Tenart @ 2014-09-09 14:44 UTC (permalink / raw)
To: sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w
Cc: Antoine Tenart,
alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
zmxu-eYqpPyKDWXRBDgjK7y7TUQ, jszhang-eYqpPyKDWXRBDgjK7y7TUQ,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi all,
This series introduce support for the Ethernet controller on Berlin SoCs,
using the existing pxa168 Ethernet driver. In order to do this, DT
support is added to the driver alongside some other modifications and
fixes.
Version 1 of this series was introducing a new Ethernet driver but thanks
to Sebastian's review it seems we can actually use the existing pxa168
Ethernet driver. This second version uses it.
This has been tested on a Berlin BG2Q DMP board.
Changes since v1:
- removed custom Berlin Ethernet driver
- used the pxa168 Ethernet driver instead
- made modifications to the pxa168 driver (DT support, fixes)
Antoine Tenart (8):
net: pxa168_eth: clean up
net: pxa168_eth: add device tree support
Documentation: bindings: net: add the Marvell PXA168 Ethernet
controller
net: pxa168_eth: fix Ethernet flow control status
net: pxa168_eth: get and set the mac address on the Ethernet
controller
net: pxa168_eth: allow Berlin SoCs to use the pxa168_eth driver
ARM: dts: berlin: add the Ethernet node
ARM: dts: berlin: enable the Ethernet port on the BG2Q DMP
.../devicetree/bindings/net/marvell-pxa168.txt | 22 +++
arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 4 +
arch/arm/boot/dts/berlin2q.dtsi | 9 +
drivers/net/ethernet/marvell/Kconfig | 2 +-
drivers/net/ethernet/marvell/pxa168_eth.c | 207 +++++++++++++--------
5 files changed, 165 insertions(+), 79 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/marvell-pxa168.txt
--
1.9.1
--
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
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