* Re: linux/atm_zatm.h not really usable in userspace since cf00713a655d3019be7faa184402f16c43a0fed3
From: Pascal Terjan @ 2016-10-15 14:33 UTC (permalink / raw)
To: Mikko Rapeli; +Cc: David S. Miller, netdev
In-Reply-To: <20161015140906.GC2831@lakka.kapsi.fi>
On 15 October 2016 at 15:09, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> On Sat, Oct 15, 2016 at 01:05:10PM +0100, Pascal Terjan wrote:
>> It is no longer possible to include <linux/atm_zatm.h> + userspace
>> headers using time, for example <stdlib.h>, this broke for example
>> the build of linux-atm.
>>
>> Reproducer:
>>
>> $ cat test.c
>> #include <linux/atm_zatm.h>
>> #include <stdlib.h>
>
> If possible, please reverse the order of includes to first include glibc
> headers and then Linux kernel uapi ones.
That was what I tried first but this didn't help:
In file included from /usr/include/linux/atm_zatm.h:17:0,
from test.c:2:
/usr/include/linux/time.h:9:8: error: redefinition of 'struct timespec'
struct timespec {
^
In file included from /usr/include/sys/select.h:43:0,
from /usr/include/sys/types.h:219,
from /usr/include/stdlib.h:314,
from test.c:1:
/usr/include/time.h:120:8: note: originally defined here
struct timespec
^
In file included from /usr/include/linux/atm_zatm.h:17:0,
from test.c:2:
/usr/include/linux/time.h:15:8: error: redefinition of 'struct timeval'
struct timeval {
^
In file included from /usr/include/sys/select.h:45:0,
from /usr/include/sys/types.h:219,
from /usr/include/stdlib.h:314,
from test.c:1:
/usr/include/bits/time.h:30:8: note: originally defined here
struct timeval
^
> Kernel uapi headers did not declare their header file dependencies correctly
> and I've been fixing them. I have also tried to fix compatibility issues
> with glibc headers, but unfortunately they only work when glibc headers
> are included before kernel headers. Userspace which has been relying on
> the magic include order for various uapi headers is now unfortunately
> affected. Sorry about that.
In this case no order works, it seems the kernel doesn't handle it in
time.h unlike many other headers
^ permalink raw reply
* Re: Need help with mdiobus_register and phy
From: Timur Tabi @ 2016-10-15 14:39 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn; +Cc: netdev
In-Reply-To: <535FE9FE-0D69-4874-BBF0-F0662C2157DB@gmail.com>
Florian Fainelli wrote:
> After reading the spec again, it does not appear to me that a PHY
> with PDOWN set is guaranteed or even required to respond to other
> register reads such as MII_PHYID1/2, in which case we may have to
> implement a MDIO bus reset routine which clears PDOWN for all PHYs
> that we detect(ed), or as Andrew suggested, utilize the matching by
> compatible string with the PHY OUI in it.
The 8031 does respond normally when PDOWN is set. However, the ID
registers are not available when the SerDes bus is also powered down.
I'll call this PDOWN+. This is a special power-down sequence that the
at803x driver does on suspend. See my other email for details.
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
^ permalink raw reply
* Re: linux/atm_zatm.h not really usable in userspace since cf00713a655d3019be7faa184402f16c43a0fed3
From: Mikko Rapeli @ 2016-10-15 15:10 UTC (permalink / raw)
To: Pascal Terjan; +Cc: David S. Miller, netdev
In-Reply-To: <CA+CX+bjXHVdoMzpKWX9jbBWbPhExq2CMnN+BgwhOOG2PBAfWBQ@mail.gmail.com>
On Sat, Oct 15, 2016 at 03:33:22PM +0100, Pascal Terjan wrote:
> On 15 October 2016 at 15:09, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> > On Sat, Oct 15, 2016 at 01:05:10PM +0100, Pascal Terjan wrote:
> >> It is no longer possible to include <linux/atm_zatm.h> + userspace
> >> headers using time, for example <stdlib.h>, this broke for example
> >> the build of linux-atm.
> >>
> >> Reproducer:
> >>
> >> $ cat test.c
> >> #include <linux/atm_zatm.h>
> >> #include <stdlib.h>
> >
> > If possible, please reverse the order of includes to first include glibc
> > headers and then Linux kernel uapi ones.
>
> That was what I tried first but this didn't help:
>
> In file included from /usr/include/linux/atm_zatm.h:17:0,
> from test.c:2:
> /usr/include/linux/time.h:9:8: error: redefinition of 'struct timespec'
> struct timespec {
> ^
> In file included from /usr/include/sys/select.h:43:0,
> from /usr/include/sys/types.h:219,
> from /usr/include/stdlib.h:314,
> from test.c:1:
> /usr/include/time.h:120:8: note: originally defined here
> struct timespec
> ^
> In file included from /usr/include/linux/atm_zatm.h:17:0,> from test.c:2:
> from test.c:2:
> /usr/include/linux/time.h:15:8: error: redefinition of 'struct timeval'
> struct timeval {
> ^
> In file included from /usr/include/sys/select.h:45:0,
> from /usr/include/sys/types.h:219,
> from /usr/include/stdlib.h:314,
> from test.c:1:
> /usr/include/bits/time.h:30:8: note: originally defined here
> struct timeval
> ^
> > Kernel uapi headers did not declare their header file dependencies correctly
> > and I've been fixing them. I have also tried to fix compatibility issues
> > with glibc headers, but unfortunately they only work when glibc headers
> > are included before kernel headers. Userspace which has been relying on
> > the magic include order for various uapi headers is now unfortunately
> > affected. Sorry about that.
>
> In this case no order works, it seems the kernel doesn't handle it in
> time.h unlike many other headers
Ok, then https://patchwork.kernel.org/patch/9294305/ hasn't been applied yet.
You can apply that or revert cf00713a655d3019be7faa184402f16c43a0fed3
for the time being.
It's a bit tricky to push through changes touching uapi headers for various
kernel sub systems since they may get applied at different order and time.
-Mikko
^ permalink raw reply
* Re: [PATCH] ethtool: Zero memory allocated for statistics
From: Vlad Tsyrklevich @ 2016-10-15 15:13 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <CAH0z3hMSTAWQK550gTpZ3jv1BnEpjHKoCC6wz182YYHLVcesQg@mail.gmail.com>
I agree that we should propagate those errors and I'll prepare a new
change to do so for phy_driver.get_stats(), ethtool_ops.self_test(),
and ethtool_ops.get_ethtool_stats(). However, I still think this
change should be adopted. 3/5 of the cases here are reachable without
any special capabilities and programming defensively at the ethtool
interface can eliminate an entire class of potential driver bugs
instead of fixing them one by one. For example, get_eeprom()
propagates errors but with a brief grep I found that
qlcnic_get_eeprom() will return 0 incorrectly even though it read
nothing for some NICs. Deeper bugs are undoubtedly laying around.
On Sat, Oct 15, 2016 at 5:11 PM, Vlad Tsyrklevich <vlad@tsyrklevich.net> wrote:
> I agree that we should propagate those errors and I'll prepare a new change
> to do so for phy_driver.get_stats(), ethtool_ops.self_test(), and
> ethtool_ops.get_ethtool_stats(). However, I still think this change should
> be adopted. 3/5 of the cases here are reachable without any special
> capabilities and programming defensively at the ethtool interface can
> eliminate an entire class of potential driver bugs instead of fixing them
> one by one. For example, get_eeprom() propagates errors but with a brief
> grep I found that qlcnic_get_eeprom() will return 0 incorrectly even though
> it read nothing for some NICs. Deeper bugs are undoubtedly laying around.
>
> On Sat, Oct 15, 2016 at 3:21 AM David Miller <davem@davemloft.net> wrote:
>>
>> From: Vlad Tsyrklevich <vlad@tsyrklevich.net>
>> Date: Fri, 14 Oct 2016 11:59:18 +0200
>>
>> > enic_get_ethtool_stats()
>>
>> Looknig merely at this shows the real problem.
>>
>> We don't propagate and handle errors for this method.
>>
>> And that's what we should fix, making the get_ethtool_stats() method
>> return an integer error.
>>
>> Then ethtool_get_stats() should return any non-zero value provided by
>> ops->get_ethtool_stats() and not attempt to copy any bytes of 'data'
>> to userspace in that case.
^ permalink raw reply
* Re: linux/atm_zatm.h not really usable in userspace since cf00713a655d3019be7faa184402f16c43a0fed3
From: Pascal Terjan @ 2016-10-15 15:14 UTC (permalink / raw)
To: Mikko Rapeli; +Cc: David S. Miller, netdev
In-Reply-To: <20161015151039.GD2831@lakka.kapsi.fi>
On 15 October 2016 at 16:10, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> On Sat, Oct 15, 2016 at 03:33:22PM +0100, Pascal Terjan wrote:
>> On 15 October 2016 at 15:09, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
>> > On Sat, Oct 15, 2016 at 01:05:10PM +0100, Pascal Terjan wrote:
>> >> It is no longer possible to include <linux/atm_zatm.h> + userspace
>> >> headers using time, for example <stdlib.h>, this broke for example
>> >> the build of linux-atm.
>> >>
>> >> Reproducer:
>> >>
>> >> $ cat test.c
>> >> #include <linux/atm_zatm.h>
>> >> #include <stdlib.h>
>> >
>> > If possible, please reverse the order of includes to first include glibc
>> > headers and then Linux kernel uapi ones.
>>
>> That was what I tried first but this didn't help:
>>
>> In file included from /usr/include/linux/atm_zatm.h:17:0,
>> from test.c:2:
>> /usr/include/linux/time.h:9:8: error: redefinition of 'struct timespec'
>> struct timespec {
>> ^
>> In file included from /usr/include/sys/select.h:43:0,
>> from /usr/include/sys/types.h:219,
>> from /usr/include/stdlib.h:314,
>> from test.c:1:
>> /usr/include/time.h:120:8: note: originally defined here
>> struct timespec
>> ^
>> In file included from /usr/include/linux/atm_zatm.h:17:0,> from test.c:2:
>> from test.c:2:
>> /usr/include/linux/time.h:15:8: error: redefinition of 'struct timeval'
>> struct timeval {
>> ^
>> In file included from /usr/include/sys/select.h:45:0,
>> from /usr/include/sys/types.h:219,
>> from /usr/include/stdlib.h:314,
>> from test.c:1:
>> /usr/include/bits/time.h:30:8: note: originally defined here
>> struct timeval
>> ^
>> > Kernel uapi headers did not declare their header file dependencies correctly
>> > and I've been fixing them. I have also tried to fix compatibility issues
>> > with glibc headers, but unfortunately they only work when glibc headers
>> > are included before kernel headers. Userspace which has been relying on
>> > the magic include order for various uapi headers is now unfortunately
>> > affected. Sorry about that.
>>
>> In this case no order works, it seems the kernel doesn't handle it in
>> time.h unlike many other headers
>
> Ok, then https://patchwork.kernel.org/patch/9294305/ hasn't been applied yet.
> You can apply that or revert cf00713a655d3019be7faa184402f16c43a0fed3
> for the time being.
Ah thanks, I'll take that patch :)
> It's a bit tricky to push through changes touching uapi headers for various
> kernel sub systems since they may get applied at different order and time.
Yeah I can imagine, thanks for doing it
^ permalink raw reply
* Re: [PATCH] ethtool: Zero memory allocated for statistics
From: David Miller @ 2016-10-15 15:18 UTC (permalink / raw)
To: vlad; +Cc: netdev
In-Reply-To: <CAH0z3hMSTAWQK550gTpZ3jv1BnEpjHKoCC6wz182YYHLVcesQg@mail.gmail.com>
From: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Date: Sat, 15 Oct 2016 15:11:08 +0000
> I agree that we should propagate those errors and I'll prepare a new change
> to do so for phy_driver.get_stats(), ethtool_ops.self_test(), and
> ethtool_ops.get_ethtool_stats(). However, I still think this change should
> be adopted. 3/5 of the cases here are reachable without any special
> capabilities and programming defensively at the ethtool interface can
> eliminate an entire class of potential driver bugs instead of fixing them
> one by one. For example, get_eeprom() propagates errors but with a brief
> grep I found that qlcnic_get_eeprom() will return 0 incorrectly even though
> it read nothing for some NICs. Deeper bugs are undoubtedly laying around.
I'm all for defensive program when practical.
But statistics gathering is highly performance sensitive for many
important use cases, so I'm not ready to add a whole bzero() here
unless absolutely, positively, necessary.
Thanks.
^ permalink raw reply
* [PATCH] ipvlan: constify l3mdev_ops structure
From: Julia Lawall @ 2016-10-15 15:40 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
This l3mdev_ops structure is only stored in the l3mdev_ops field of a
net_device structure. This field is declared const, so the l3mdev_ops
structure can be declared as const also. Additionally drop the
__read_mostly annotation.
The semantic patch that adds const is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct l3mdev_ops i@p = { ... };
@ok@
identifier r.i;
struct net_device *e;
position p;
@@
e->l3mdev_ops = &i@p;
@bad@
position p != {r.p,ok.p};
identifier r.i;
struct l3mdev_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct l3mdev_ops i = { ... };
// </smpl>
The effect on the layout of the .o file is shown by the following output
of the size command, first before then after the transformation:
text data bss dec hex filename
7364 466 52 7882 1eca drivers/net/ipvlan/ipvlan_main.o
7412 434 52 7898 1eda drivers/net/ipvlan/ipvlan_main.o
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/net/ipvlan/ipvlan_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -26,7 +26,7 @@ static struct nf_hook_ops ipvl_nfops[] _
},
};
-static struct l3mdev_ops ipvl_l3mdev_ops __read_mostly = {
+static const struct l3mdev_ops ipvl_l3mdev_ops = {
.l3mdev_l3_rcv = ipvlan_l3_rcv,
};
^ permalink raw reply
* [PATCH net] net: pktgen: remove rcu locking in pktgen_change_name()
From: Eric Dumazet @ 2016-10-15 15:50 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Jesper Dangaard Brouer, John Sperbeck
From: Eric Dumazet <edumazet@google.com>
After Jesper commit back in linux-3.18, we trigger a lockdep
splat in proc_create_data() while allocating memory from
pktgen_change_name().
This patch converts t->if_lock to a mutex, since it is now only
used from control path, and adds proper locking to pktgen_change_name()
1) pktgen_thread_lock to protect the outer loop (iterating threads)
2) t->if_lock to protect the inner loop (iterating devices)
Note that before Jesper patch, pktgen_change_name() was lacking proper
protection, but lockdep was not able to detect the problem.
Fixes: 8788370a1d4b ("pktgen: RCU-ify "if_list" to remove lock in next_to_run()")
Reported-by: John Sperbeck <jsperbeck@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
---
net/core/pktgen.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 5219a9e2127a..306b8f0e03c1 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -216,8 +216,8 @@
#define M_QUEUE_XMIT 2 /* Inject packet into qdisc */
/* If lock -- protects updating of if_list */
-#define if_lock(t) spin_lock(&(t->if_lock));
-#define if_unlock(t) spin_unlock(&(t->if_lock));
+#define if_lock(t) mutex_lock(&(t->if_lock));
+#define if_unlock(t) mutex_unlock(&(t->if_lock));
/* Used to help with determining the pkts on receive */
#define PKTGEN_MAGIC 0xbe9be955
@@ -423,7 +423,7 @@ struct pktgen_net {
};
struct pktgen_thread {
- spinlock_t if_lock; /* for list of devices */
+ struct mutex if_lock; /* for list of devices */
struct list_head if_list; /* All device here */
struct list_head th_list;
struct task_struct *tsk;
@@ -2010,11 +2010,13 @@ static void pktgen_change_name(const struct pktgen_net *pn, struct net_device *d
{
struct pktgen_thread *t;
+ mutex_lock(&pktgen_thread_lock);
+
list_for_each_entry(t, &pn->pktgen_threads, th_list) {
struct pktgen_dev *pkt_dev;
- rcu_read_lock();
- list_for_each_entry_rcu(pkt_dev, &t->if_list, list) {
+ if_lock(t);
+ list_for_each_entry(pkt_dev, &t->if_list, list) {
if (pkt_dev->odev != dev)
continue;
@@ -2029,8 +2031,9 @@ static void pktgen_change_name(const struct pktgen_net *pn, struct net_device *d
dev->name);
break;
}
- rcu_read_unlock();
+ if_unlock(t);
}
+ mutex_unlock(&pktgen_thread_lock);
}
static int pktgen_device_event(struct notifier_block *unused,
@@ -3762,7 +3765,7 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn)
return -ENOMEM;
}
- spin_lock_init(&t->if_lock);
+ mutex_init(&t->if_lock);
t->cpu = cpu;
INIT_LIST_HEAD(&t->if_list);
^ permalink raw reply related
* Re: [patch net-next RFC 4/6] Introduce sample tc action
From: Roopa Prabhu @ 2016-10-15 16:34 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, yotamg, idosch, eladr, nogahf, ogerlitz, jhs,
geert+renesas, stephen, xiyou.wangcong, linux
In-Reply-To: <1476276069-5315-5-git-send-email-jiri@resnulli.us>
On 10/12/16, 5:41 AM, Jiri Pirko wrote:
> From: Yotam Gigi <yotam.gi@gmail.com>
>
> This action allow the user to sample traffic matched by tc classifier.
> The sampling consists of choosing packets randomly, truncating them,
> adding some informative metadata regarding the interface and the original
> packet size and mark them with specific mark, to allow further tc rules to
> match and process. The marked sample packets are then injected into the
> device ingress qdisc using netif_receive_skb.
>
> The packets metadata is packed using the ife encapsulation protocol, and
> the outer packet's ethernet dest, source and eth_type, along with the
> rate, mark and the optional truncation size can be configured from
> userspace.
>
> Example:
> To sample ingress traffic from interface eth1, and redirect the sampled
> the sampled packets to interface dummy0, one may use the commands:
>
> tc qdisc add dev eth1 handle ffff: ingress
>
> tc filter add dev eth1 parent ffff: \
> matchall action sample rate 12 mark 17
>
> tc filter add parent ffff: dev eth1 protocol all \
> u32 match mark 172 0xff
> action mirred egress redirect dev dummy0
>
> Where the first command adds an ingress qdisc and the second starts
> sampling every 12'th packet on dev eth0 and marks the sampled packets with
> 17. The command third catches the sampled packets, which are marked with
> 17, and redirects them to dev dummy0.
>
> Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
channeling some feedback from Peter Phaal @sflow inline below:
> ---
>
> diff --git a/include/net/tc_act/tc_sample.h b/include/net/tc_act/tc_sample.h
> new file mode 100644
> index 0000000..a2b445a
> --- /dev/null
> +++ b/include/net/tc_act/tc_sample.h
> @@ -0,0 +1,88 @@
> +#ifndef __NET_TC_SAMPLE_H
> +#define __NET_TC_SAMPLE_H
> +
> +#include <net/act_api.h>
> +#include <linux/tc_act/tc_sample.h>
> +
> +struct tcf_sample {
> + struct tc_action common;
> + u32 rate;
> + u32 mark;
> + bool truncate;
> + u32 trunc_size;
> + u32 packet_counter;
> + u8 eth_dst[ETH_ALEN];
> + u8 eth_src[ETH_ALEN];
> + u16 eth_type;
> + bool eth_type_set;
> + struct list_head tcfm_list;
> +};
> +#define to_sample(a) ((struct tcf_sample *)a)
> +
> +struct sample_packet_metadata {
> + int sample_size;
> + int orig_size;
> + int ifindex;
> +};
> +
This metadata does not look extensible.. can it be made to ?
With sflow in context, you need a pair of ifindex numbers to encode ingress and egress ports. Ideally you would also include a sequence number and a count of the total number of packets that were candidates for sampling. The OVS implementation is a good example, the metadata includes all the actions applied to the packet in the kernel data path.
[snip]
> diff --git a/include/uapi/linux/tc_act/tc_sample.h b/include/uapi/linux/tc_act/tc_sample.h
> new file mode 100644
> index 0000000..654945b
> --- /dev/null
> +++ b/include/uapi/linux/tc_act/tc_sample.h
> @@ -0,0 +1,31 @@
> +#ifndef __LINUX_TC_SAMPLE_H
> +#define __LINUX_TC_SAMPLE_H
> +
> +#include <linux/types.h>
> +#include <linux/pkt_cls.h>
> +#include <linux/if_ether.h>
> +
> +#define TCA_ACT_SAMPLE 26
> +
> +struct tc_sample {
> + tc_gen;
> + __u32 rate; /* sample rate */
> + __u32 mark; /* mark to put on the sampled packets */
> + bool truncate; /* whether to truncate the packets */
> + __u32 trunc_size; /* truncation size */
> + __u8 eth_dst[ETH_ALEN]; /* encapsulated mac destination */
> + __u8 eth_src[ETH_ALEN]; /* encapsulated mac source */
> + bool eth_type_set; /* whether to overrid ethtype */
> + __u16 eth_type; /* encapsulated mac ethtype */
> +};
> +
this does not look extensible and is part of UAPI ..
Doing the minimum in the kernel and leaving the rest to the user space agent is much more flexible. The user space agent can attach additional metadata and offer more flexibility in forwarding (sFlow uses XDR encoding over UDP and is routable over IPv4/IPv6).
> +enum {
> + TCA_SAMPLE_UNSPEC,
> + TCA_SAMPLE_TM,
> + TCA_SAMPLE_PARMS,
> + TCA_SAMPLE_PAD,
> + __TCA_SAMPLE_MAX
> +};
> +#define TCA_SAMPLE_MAX (__TCA_SAMPLE_MAX - 1)
> +
> +#endif
> diff --git a/net/sched/Kconfig b/net/sched/Kconfig
> index 24f7cac..c54ea6b 100644
> --- a/net/sched/Kconfig
> +++ b/net/sched/Kconfig
> @@ -650,6 +650,19 @@ config NET_ACT_MIRRED
> To compile this code as a module, choose M here: the
> module will be called act_mirred.
>
> +config NET_ACT_SAMPLE
> + tristate "Traffic Sampling"
> + depends on NET_CLS_ACT
> + select NET_IFE
> + ---help---
> + Say Y here to allow packet sampling tc action. The packet sample
> + action consists of statistically duplicating packets, truncating them
> + and adding descriptive metadata to them. The duplicated packets are
> + then marked to allow further processing using tc.
> +
> + To compile this code as a module, choose M here: the
> + module will be called act_sample.
> +
> config NET_ACT_IPT
> tristate "IPtables targets"
> depends on NET_CLS_ACT && NETFILTER && IP_NF_IPTABLES
> diff --git a/net/sched/Makefile b/net/sched/Makefile
> index 4bdda36..7b915d2 100644
> --- a/net/sched/Makefile
> +++ b/net/sched/Makefile
[snip]
> +static int tcf_sample(struct sk_buff *skb, const struct tc_action *a,
> + struct tcf_result *res)
> +{
> + struct tcf_sample *s = to_sample(a);
> + struct sample_packet_metadata metadata;
> + static struct ethhdr *ethhdr;
> + struct sk_buff *skb2;
> + int retval;
> + u32 at;
> +
> + tcf_lastuse_update(&s->tcf_tm);
> + bstats_cpu_update(this_cpu_ptr(s->common.cpu_bstats), skb);
> +
> + rcu_read_lock();
> + retval = READ_ONCE(s->tcf_action);
> +
> + if (++s->packet_counter % s->rate == 0) {
The sampling function isn’t random
if (++s->packet_counter % s->rate == 0) {
This is unsuitable for sFlow, which is specific about the random sampling function required. BPF, OVS, and the
ULOG statistics module include efficient kernel based random sampling functions that could be used instead.
Thanks,
Roopa
^ permalink raw reply
* Re: [PATCH] net: limit a number of namespaces which can be cleaned up concurrently
From: Eric W. Biederman @ 2016-10-15 16:36 UTC (permalink / raw)
To: Andrei Vagin; +Cc: Andrei Vagin, netdev, containers, David S. Miller
In-Reply-To: <20161014212642.GA2005@outlook.office365.com>
Andrei Vagin <avagin@virtuozzo.com> writes:
> On Thu, Oct 13, 2016 at 10:06:28PM -0500, Eric W. Biederman wrote:
>> Andrei Vagin <avagin@virtuozzo.com> writes:
>>
>> > On Thu, Oct 13, 2016 at 10:49:38AM -0500, Eric W. Biederman wrote:
>> >> Andrei Vagin <avagin@openvz.org> writes:
>> >>
>> >> > From: Andrey Vagin <avagin@openvz.org>
>> >> >
>> >> > The operation of destroying netns is heavy and it is executed under
>> >> > net_mutex. If many namespaces are destroyed concurrently, net_mutex can
>> >> > be locked for a long time. It is impossible to create a new netns during
>> >> > this period of time.
>> >>
>> >> This may be the right approach or at least the right approach to bound
>> >> net_mutex hold times but I have to take exception to calling network
>> >> namespace cleanup heavy.
>> >>
>> >> The only particularly time consuming operation I have ever found are calls to
>> >> synchronize_rcu/sycrhonize_sched/synchronize_net.
>> >
>> > I booted the kernel with maxcpus=1, in this case these functions work
>> > very fast and the problem is there any way.
>> >
>> > Accoding to perf, we spend a lot of time in kobject_uevent:
>> >
>> > - 99.96% 0.00% kworker/u4:1 [kernel.kallsyms] [k] unregister_netdevice_many
>> > - unregister_netdevice_many
>> > - 99.95% rollback_registered_many
>> > - 99.64% netdev_unregister_kobject
>> > - 33.43% netdev_queue_update_kobjects
>> > - 33.40% kobject_put
>> > - kobject_release
>> > + 33.37% kobject_uevent
>> > + 0.03% kobject_del
>> > + 0.03% sysfs_remove_group
>> > - 33.13% net_rx_queue_update_kobjects
>> > - kobject_put
>> > - kobject_release
>> > + 33.11% kobject_uevent
>> > + 0.01% kobject_del
>> > 0.00% rx_queue_release
>> > - 33.08% device_del
>> > + 32.75% kobject_uevent
>> > + 0.17% device_remove_attrs
>> > + 0.07% dpm_sysfs_remove
>> > + 0.04% device_remove_class_symlinks
>> > + 0.01% kobject_del
>> > + 0.01% device_pm_remove
>> > + 0.01% sysfs_remove_file_ns
>> > + 0.00% klist_del
>> > + 0.00% driver_deferred_probe_del
>> > 0.00% cleanup_glue_dir.isra.14.part.15
>> > 0.00% to_acpi_device_node
>> > 0.00% sysfs_remove_group
>> > 0.00% klist_del
>> > 0.00% device_remove_attrs
>> > + 0.26% call_netdevice_notifiers_info
>> > + 0.04% rtmsg_ifinfo_build_skb
>> > + 0.01% rtmsg_ifinfo_send
>> > 0.00% dev_uc_flush
>> > 0.00% netif_reset_xps_queues_gt
>> >
>> > Someone can listen these uevents, so we can't stop sending them without
>> > breaking backward compatibility. We can try to optimize
>> > kobject_uevent...
>>
>> Oh that is a surprise. We can definitely skip genenerating uevents for
>> network namespaces that are exiting because by definition no one can see
>> those network namespaces. If a socket existed that could see those
>> uevents it would hold a reference to the network namespace and as such
>> the network namespace could not exit.
>>
>> That sounds like it is worth investigating a little more deeply.
>>
>> I am surprised that allocation and freeing is so heavy we are spending
>> lots of time doing that. On the other hand kobj_bcast_filter is very
>> dumb and very late so I expect something can be moved earlier and make
>> that code cheaper with the tiniest bit of work.
>>
>
> I'm sorry, I've collected this data for a kernel with debug options
> (DEBUG_SPINLOCK, PROVE_LOCKING, DEBUG_LIST, etc). If a kernel is
> compiled without debug options, kobject_uevent becomes less expensive,
> but still expensive.
>
> - 98.64% 0.00% kworker/u4:2 [kernel.kallsyms] [k] cleanup_net
> - cleanup_net
> - 98.54% ops_exit_list.isra.4
> - 60.48% default_device_exit_batch
> - 60.40% unregister_netdevice_many
> - rollback_registered_many
> - 59.82% netdev_unregister_kobject
> - 20.10% device_del
> + 19.44% kobject_uevent
> + 0.40% device_remove_attrs
> + 0.17% dpm_sysfs_remove
> + 0.04% device_remove_class_symlinks
> + 0.04% kobject_del
> + 0.01% device_pm_remove
> + 0.01% sysfs_remove_file_ns
> - 19.89% netdev_queue_update_kobjects
> + 19.81% kobject_put
> + 0.07% sysfs_remove_group
> - 19.79% net_rx_queue_update_kobjects
> kobject_put
> - kobject_release
> + 19.77% kobject_uevent
> + 0.02% kobject_del
> 0.01% rx_queue_release
> + 0.02% kset_unregister
> 0.01% pm_runtime_set_memalloc_noio
> 0.01% bus_remove_device
> + 0.45% call_netdevice_notifiers_info
> + 0.07% rtmsg_ifinfo_build_skb
> + 0.04% rtmsg_ifinfo_send
> 0.01% kset_unregister
> + 0.07% rtnl_unlock
> + 19.27% rpcsec_gss_exit_net
> + 5.45% tcp_net_metrics_exit
> + 5.31% sunrpc_exit_net
> + 3.18% ip6addrlbl_net_exit
>
>
> So after removing kobject_uevent, cleanup_net becomes more than two times faster:
>
> 1000 namespaces are cleaned up for 2.8 seconds with uevents, and 1.2 senconds
> without uevents. I do this experiments with max_cpus=1 to exclude synchronize_rcu.
>
> As a summary we can skip generating uevents, but it doesn't solve the original
> problem. If we want to avoid the limit introduced in this patch, we have
> to reduce the time for destroing net namespace in dozen times, don't
> we?
It definitely looks like optimizing kobject_uevent for this case is
worth while.
I would not mind getting the raw cost of network namespace cleanups
below 2.8ms or with uevent cleanups 1.2ms. There is just a lot going on
for a lot of good reasons in the networking stack so that can be tricky.
The larger issue is that there is a trade off between latency and
throughput in network namespace destruction. Consider the case of
vsftpd. Which creates a new network namespace for every connection.
Something like that can wind up with a huge backlog of network
namespaces to clean up while continually creating more. The system will
go OOM if we don't stop and cleanup what we have.
And the batching is very very important for throughput. So the smallest
batch size we could really accept is a batch size that does not hurt
throughput when destroying network namespaces. Otherwise we will have a
growing backlog of network namespaces to cleanup and a system that
eventuallys stops being usable at all. In that context I think a long
hold time on net_mutex is preferable to a system that does not work at
all.
Now I would love to make both the throughput and the latency better I
would be all in favor of that, but that requires some deep changes to
the network namespace initialization and cleanup. Unfortunately I
haven't stared at the problem enough to know what those changes would
need to be. But something where we would not need to serialize network
namespace cleanup between different network namespaces. And ideally
something we could implement incrementally as there is so much
networking code I don't expect we could verify and change verything
overnight.
That plus in practice the bottleneck has always been the synchronize_rcu
calls which tend to take at least a millisecond a piece. Being able
overlap those synchronize_rcu calls in the common case has reduced
the time to run the network stack cleanup code by very dramatic amounts.
Right now I am very happy that the network namespace cleanup code is
working properly. When I started the network stack cleanup code to
cleanup network namespaces I found actual functional bugs. I will be
even happier if we can figure out how to make it all run fast.
But ultimately we have the net_mutex and the rtnl_lock that serialize
things on the setup and cleanup paths and to allow creation to proceed
while cleanup is ongoing we need to find a way to avoid serialization by
either of those, and I have honestly drawn a blank.
So right now my best suggestion for making things better is to find and
fix each little piece we can fix. Until the things are working as best
we can make them work. It is not sexy or glamorous or fast but it makes
things better and is the best that I can see to do.
Eric
> Here is a perf report after skipping generating uevents:
> - 93.27% 0.00% kworker/u4:1 [kernel.kallsyms] [k] cleanup_net
> - cleanup_net
> - 92.97% ops_exit_list.isra.4
> - 35.14% rpcsec_gss_exit_net
> - gss_svc_shutdown_net
> - 17.40% rsc_cache_destroy_net
> + 8.64% cache_unregister_net
> + 8.52% cache_purge
> + 0.22% cache_destroy_net
> + 9.00% cache_unregister_net
> + 8.49% cache_purge
> + 0.15% destroy_use_gss_proxy_proc_entry
> + 0.10% cache_destroy_net
> - 14.35% tcp_net_metrics_exit
> - 7.32% tcp_metrics_flush_all
> + 4.86% _raw_spin_unlock_bh
> 0.59% __local_bh_enable_ip
> 6.12% _raw_spin_lock_bh
> 0.90% _raw_spin_unlock_bh
> - 13.08% sunrpc_exit_net
> - 6.91% ip_map_cache_destroy
> + 3.90% cache_unregister_net
> + 2.86% cache_purge
> + 0.15% cache_destroy_net
> + 5.95% unix_gid_cache_destroy
> + 0.12% rpc_pipefs_exit_net
> + 0.10% rpc_proc_exit
> - 7.35% ip6addrlbl_net_exit
> + call_rcu_sched
> + 3.34% xfrm_net_exit
> + 1.22% ipv6_frags_exit_net
> + 1.17% ipv4_frags_exit_net
> + 0.78% fib_net_exit
> + 0.76% inet6_net_exit
> + 0.76% devinet_exit_net
> + 0.68% addrconf_exit_net
> + 0.63% igmp6_net_exit
> + 0.59% ipv4_mib_exit_net
> + 0.59% uevent_net_exit
>
>> Eric
^ permalink raw reply
* [PATCH] crypto: ccm - avoid scatterlist for MAC encryption
From: Ard Biesheuvel @ 2016-10-15 17:16 UTC (permalink / raw)
To: johannes, luto, sergey.senozhatsky.work, netdev, herbert, davem,
linux-wireless, linux-kernel, j
Cc: Ard Biesheuvel
The CCM code goes out of its way to perform the CTR encryption of the MAC
using the subordinate CTR driver. To this end, it tweaks the input and
output scatterlists so the aead_req 'odata' and/or 'auth_tag' fields [which
may live on the stack] are prepended to the CTR payload. This involves
calling sg_set_buf() on addresses which are not direct mapped, which is
not supported.
Since the calculation of the MAC keystream involves a single call into
the cipher, to which we have a handle already given that the CBC-MAC
calculation uses it as well, just calculate the MAC keystream directly,
and record it in the aead_req private context so we can apply it to the
MAC in cypto_ccm_auth_mac(). This greatly simplifies the scatterlist
manipulation, and no longer requires scatterlists to refer to buffers
that may live on the stack.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
This is an alternative for the patch 'mac80211: aes_ccm: move struct
aead_req off the stack' that I sent out yesterday. IMO, this is a more
correct approach, since it addresses the problem directly in crypto/ccm.c,
which is the only CCM-AES driver that suffers from this issue.
crypto/ccm.c | 55 +++++++++++---------
1 file changed, 29 insertions(+), 26 deletions(-)
diff --git a/crypto/ccm.c b/crypto/ccm.c
index 006d8575ef5c..faa5efcf59e2 100644
--- a/crypto/ccm.c
+++ b/crypto/ccm.c
@@ -46,10 +46,13 @@ struct crypto_ccm_req_priv_ctx {
u8 odata[16];
u8 idata[16];
u8 auth_tag[16];
+ u8 cmac[16];
u32 ilen;
u32 flags;
- struct scatterlist src[3];
- struct scatterlist dst[3];
+ struct scatterlist *src;
+ struct scatterlist *dst;
+ struct scatterlist srcbuf[2];
+ struct scatterlist dstbuf[2];
struct skcipher_request skreq;
};
@@ -280,6 +283,8 @@ static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain,
if (cryptlen)
get_data_to_compute(cipher, pctx, plain, cryptlen);
+ crypto_xor(odata, pctx->cmac, 16);
+
out:
return err;
}
@@ -307,10 +312,12 @@ static inline int crypto_ccm_check_iv(const u8 *iv)
return 0;
}
-static int crypto_ccm_init_crypt(struct aead_request *req, u8 *tag)
+static int crypto_ccm_init_crypt(struct aead_request *req)
{
+ struct crypto_aead *aead = crypto_aead_reqtfm(req);
+ struct crypto_ccm_ctx *ctx = crypto_aead_ctx(aead);
struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req);
- struct scatterlist *sg;
+ struct crypto_cipher *cipher = ctx->cipher;
u8 *iv = req->iv;
int err;
@@ -325,19 +332,16 @@ static int crypto_ccm_init_crypt(struct aead_request *req, u8 *tag)
*/
memset(iv + 15 - iv[0], 0, iv[0] + 1);
- sg_init_table(pctx->src, 3);
- sg_set_buf(pctx->src, tag, 16);
- sg = scatterwalk_ffwd(pctx->src + 1, req->src, req->assoclen);
- if (sg != pctx->src + 1)
- sg_chain(pctx->src, 2, sg);
+ /* prepare the key stream for the auth tag */
+ crypto_cipher_encrypt_one(cipher, pctx->cmac, iv);
- if (req->src != req->dst) {
- sg_init_table(pctx->dst, 3);
- sg_set_buf(pctx->dst, tag, 16);
- sg = scatterwalk_ffwd(pctx->dst + 1, req->dst, req->assoclen);
- if (sg != pctx->dst + 1)
- sg_chain(pctx->dst, 2, sg);
- }
+ /* increment BE counter in IV[] for the actual payload */
+ iv[15] = 1;
+
+ pctx->src = scatterwalk_ffwd(pctx->srcbuf, req->src, req->assoclen);
+ if (req->src != req->dst)
+ pctx->dst = scatterwalk_ffwd(pctx->dstbuf, req->dst,
+ req->assoclen);
return 0;
}
@@ -354,11 +358,11 @@ static int crypto_ccm_encrypt(struct aead_request *req)
u8 *iv = req->iv;
int err;
- err = crypto_ccm_init_crypt(req, odata);
+ err = crypto_ccm_init_crypt(req);
if (err)
return err;
- err = crypto_ccm_auth(req, sg_next(pctx->src), cryptlen);
+ err = crypto_ccm_auth(req, pctx->src, cryptlen);
if (err)
return err;
@@ -369,13 +373,13 @@ static int crypto_ccm_encrypt(struct aead_request *req)
skcipher_request_set_tfm(skreq, ctx->ctr);
skcipher_request_set_callback(skreq, pctx->flags,
crypto_ccm_encrypt_done, req);
- skcipher_request_set_crypt(skreq, pctx->src, dst, cryptlen + 16, iv);
+ skcipher_request_set_crypt(skreq, pctx->src, dst, cryptlen, iv);
err = crypto_skcipher_encrypt(skreq);
if (err)
return err;
/* copy authtag to end of dst */
- scatterwalk_map_and_copy(odata, sg_next(dst), cryptlen,
+ scatterwalk_map_and_copy(odata, dst, cryptlen,
crypto_aead_authsize(aead), 1);
return err;
}
@@ -392,7 +396,7 @@ static void crypto_ccm_decrypt_done(struct crypto_async_request *areq,
pctx->flags = 0;
- dst = sg_next(req->src == req->dst ? pctx->src : pctx->dst);
+ dst = req->src == req->dst ? pctx->src : pctx->dst;
if (!err) {
err = crypto_ccm_auth(req, dst, cryptlen);
@@ -418,12 +422,11 @@ static int crypto_ccm_decrypt(struct aead_request *req)
cryptlen -= authsize;
- err = crypto_ccm_init_crypt(req, authtag);
+ err = crypto_ccm_init_crypt(req);
if (err)
return err;
- scatterwalk_map_and_copy(authtag, sg_next(pctx->src), cryptlen,
- authsize, 0);
+ scatterwalk_map_and_copy(authtag, pctx->src, cryptlen, authsize, 0);
dst = pctx->src;
if (req->src != req->dst)
@@ -432,12 +435,12 @@ static int crypto_ccm_decrypt(struct aead_request *req)
skcipher_request_set_tfm(skreq, ctx->ctr);
skcipher_request_set_callback(skreq, pctx->flags,
crypto_ccm_decrypt_done, req);
- skcipher_request_set_crypt(skreq, pctx->src, dst, cryptlen + 16, iv);
+ skcipher_request_set_crypt(skreq, pctx->src, dst, cryptlen, iv);
err = crypto_skcipher_decrypt(skreq);
if (err)
return err;
- err = crypto_ccm_auth(req, sg_next(dst), cryptlen);
+ err = crypto_ccm_auth(req, dst, cryptlen);
if (err)
return err;
--
2.7.4
^ permalink raw reply related
* Re: [patch net-next RFC 4/6] Introduce sample tc action
From: Roopa Prabhu @ 2016-10-15 17:31 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, yotamg, idosch, eladr, nogahf, ogerlitz, jhs,
geert+renesas, stephen, xiyou.wangcong, linux, Shrijeet Mukherjee
In-Reply-To: <58025A90.9010608@cumulusnetworks.com>
On 10/15/16, 9:34 AM, Roopa Prabhu wrote:
> On 10/12/16, 5:41 AM, Jiri Pirko wrote:
>> From: Yotam Gigi <yotam.gi@gmail.com>
>>
>> This action allow the user to sample traffic matched by tc classifier.
>> The sampling consists of choosing packets randomly, truncating them,
>> adding some informative metadata regarding the interface and the original
>> packet size and mark them with specific mark, to allow further tc rules to
>> match and process. The marked sample packets are then injected into the
>> device ingress qdisc using netif_receive_skb.
>>
>> The packets metadata is packed using the ife encapsulation protocol, and
>> the outer packet's ethernet dest, source and eth_type, along with the
>> rate, mark and the optional truncation size can be configured from
>> userspace.
>>
>> Example:
>> To sample ingress traffic from interface eth1, and redirect the sampled
>> the sampled packets to interface dummy0, one may use the commands:
>>
>> tc qdisc add dev eth1 handle ffff: ingress
>>
>> tc filter add dev eth1 parent ffff: \
>> matchall action sample rate 12 mark 17
>>
>> tc filter add parent ffff: dev eth1 protocol all \
>> u32 match mark 172 0xff
>> action mirred egress redirect dev dummy0
>>
>> Where the first command adds an ingress qdisc and the second starts
>> sampling every 12'th packet on dev eth0 and marks the sampled packets with
>> 17. The command third catches the sampled packets, which are marked with
>> 17, and redirects them to dev dummy0.
>>
>> Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> channeling some feedback from Peter Phaal @sflow inline below:
>
>
If it helps, one more thing that came up was using bpf.
They also use bpf filters for pkt sampling in the non-offloaded case:
http://blog.sflow.com/2016/05/berkeley-packet-filter-bpf.html
so, existing apps (like sflow) that care about packet sampling do prefer to use
a socket api for sample delivery: netlink nflog or bpf like socket filters
also, to keep the software and hardware models the same, wondering if ebpf attach
can be a viable option (have not thought about the offloaded case completely yet).
This would give apps more control on attaching sample headers (like sflow) if needed.
thanks,
Roopa
^ permalink raw reply
* [net:master 10/15] net/ipv6/addrconf.c:1251:14-30: WARNING: Unsigned expression compared with zero: tmp_prefered_lft < 0
From: Julia Lawall @ 2016-10-15 17:46 UTC (permalink / raw)
To: Jiri Bohac; +Cc: netdev, kbuild-all
I haven't checked the entire context, but it could be useful to look at
line 1251.
julia
---------- Forwarded message ----------
Date: Sun, 16 Oct 2016 01:34:18 +0800
From: kbuild test robot <fengguang.wu@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: [net:master 10/15] net/ipv6/addrconf.c:1251:14-30: WARNING: Unsigned
expression compared with zero: tmp_prefered_lft < 0
CC: kbuild-all@01.org
CC: netdev@vger.kernel.org
TO: Jiri Bohac <jbohac@suse.cz>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
head: 9e55d0f95460a067def5400fa5eee5dabb0fc5a5
commit: 76506a986dc31394fd1f2741db037d29c7e57843 [10/15] IPv6: fix DESYNC_FACTOR
:::::: branch date: 21 hours ago
:::::: commit date: 27 hours ago
>> net/ipv6/addrconf.c:1251:14-30: WARNING: Unsigned expression compared with zero: tmp_prefered_lft < 0
git remote add net https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
git remote update net
git checkout 76506a986dc31394fd1f2741db037d29c7e57843
vim +1251 net/ipv6/addrconf.c
76506a986 Jiri Bohac 2016-10-13 1235 if (unlikely(idev->desync_factor > max_desync_factor)) {
76506a986 Jiri Bohac 2016-10-13 1236 if (max_desync_factor > 0) {
76506a986 Jiri Bohac 2016-10-13 1237 get_random_bytes(&idev->desync_factor,
76506a986 Jiri Bohac 2016-10-13 1238 sizeof(idev->desync_factor));
76506a986 Jiri Bohac 2016-10-13 1239 idev->desync_factor %= max_desync_factor;
76506a986 Jiri Bohac 2016-10-13 1240 } else {
76506a986 Jiri Bohac 2016-10-13 1241 idev->desync_factor = 0;
76506a986 Jiri Bohac 2016-10-13 1242 }
76506a986 Jiri Bohac 2016-10-13 1243 }
76506a986 Jiri Bohac 2016-10-13 1244
^1da177e4 Linus Torvalds 2005-04-16 1245 tmp_valid_lft = min_t(__u32,
^1da177e4 Linus Torvalds 2005-04-16 1246 ifp->valid_lft,
7a876b0ef Glenn Wurster 2010-09-27 1247 idev->cnf.temp_valid_lft + age);
76506a986 Jiri Bohac 2016-10-13 1248 tmp_prefered_lft = idev->cnf.temp_prefered_lft + age -
76506a986 Jiri Bohac 2016-10-13 1249 idev->desync_factor;
76506a986 Jiri Bohac 2016-10-13 1250 /* guard against underflow in case of concurrent updates to cnf */
76506a986 Jiri Bohac 2016-10-13 @1251 if (unlikely(tmp_prefered_lft < 0))
76506a986 Jiri Bohac 2016-10-13 1252 tmp_prefered_lft = 0;
76506a986 Jiri Bohac 2016-10-13 1253 tmp_prefered_lft = min_t(__u32, ifp->prefered_lft, tmp_prefered_lft);
^1da177e4 Linus Torvalds 2005-04-16 1254 tmp_plen = ifp->prefix_len;
^1da177e4 Linus Torvalds 2005-04-16 1255 tmp_tstamp = ifp->tstamp;
^1da177e4 Linus Torvalds 2005-04-16 1256 spin_unlock_bh(&ifp->lock);
^1da177e4 Linus Torvalds 2005-04-16 1257
53bd67491 Jiri Pirko 2013-12-06 1258 write_unlock_bh(&idev->lock);
95c385b4d Neil Horman 2007-04-25 1259
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* Re: Need help with mdiobus_register and phy
From: Andrew Lunn @ 2016-10-15 18:02 UTC (permalink / raw)
To: Timur Tabi; +Cc: Florian Fainelli, netdev
In-Reply-To: <58023F90.5070302@codeaurora.org>
On Sat, Oct 15, 2016 at 09:39:12AM -0500, Timur Tabi wrote:
> Florian Fainelli wrote:
> >After reading the spec again, it does not appear to me that a PHY
> >with PDOWN set is guaranteed or even required to respond to other
> >register reads such as MII_PHYID1/2, in which case we may have to
> >implement a MDIO bus reset routine which clears PDOWN for all PHYs
> >that we detect(ed), or as Andrew suggested, utilize the matching by
> >compatible string with the PHY OUI in it.
>
> The 8031 does respond normally when PDOWN is set. However, the ID
> registers are not available when the SerDes bus is also powered
> down. I'll call this PDOWN+. This is a special power-down sequence
> that the at803x driver does on suspend. See my other email for
> details.
So we appear to have two ways to go:
1) Take the SerDes power down out of the suspend code for the at803x.
2) Assume MII_PHYID1/2 registers are not guaranteed to be available
when the PHY is powered down. So get_phy_id should first read
MII_BMCR. If it gets 0xffff, assume there is no PHY there. If the
PDOWN bit is set, power up the PHY. Then reading the ID registers.
Andrew
^ permalink raw reply
* Re: Need help with mdiobus_register and phy
From: Timur Tabi @ 2016-10-15 18:28 UTC (permalink / raw)
To: Andrew Lunn, zefir.kurtisi; +Cc: Florian Fainelli, netdev
In-Reply-To: <20161015180219.GB6918@lunn.ch>
Andrew Lunn wrote:
> 1) Take the SerDes power down out of the suspend code for the at803x.
>
> 2) Assume MII_PHYID1/2 registers are not guaranteed to be available
> when the PHY is powered down. So get_phy_id should first read
> MII_BMCR. If it gets 0xffff, assume there is no PHY there. If the
> PDOWN bit is set, power up the PHY. Then reading the ID registers.
Before we take approach #1, I'd like to hear from the developer of that
patch, Zefir. According to him, that patch is necessary to fix a bug.
I don't know if that bug exists only on his system, though.
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
^ permalink raw reply
* [PATCH 0/2] rds: logging neatening
From: Joe Perches @ 2016-10-15 18:53 UTC (permalink / raw)
To: netdev, linux-rdma, rds-devel
Cc: Santosh Shilimkar, David S. Miller, linux-kernel
Joe Perches (2):
rds: Remove unused rds_conn_error
rds: Remove duplicate prefix from rds_conn_path_error use
net/rds/connection.c | 15 ---------------
net/rds/rds.h | 4 ----
net/rds/threads.c | 3 +--
3 files changed, 1 insertion(+), 21 deletions(-)
--
2.10.0.rc2.1.g053435c
^ permalink raw reply
* [PATCH 2/2] rds: Remove duplicate prefix from rds_conn_path_error use
From: Joe Perches @ 2016-10-15 18:53 UTC (permalink / raw)
To: Santosh Shilimkar
Cc: David S. Miller, netdev, linux-rdma, rds-devel, linux-kernel
In-Reply-To: <cover.1476557523.git.joe@perches.com>
rds_conn_path_error already prefixes "RDS:" to the output.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/rds/threads.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/rds/threads.c b/net/rds/threads.c
index e42df11bf30a..e36e333a0aa0 100644
--- a/net/rds/threads.c
+++ b/net/rds/threads.c
@@ -171,8 +171,7 @@ void rds_connect_worker(struct work_struct *work)
RDS_CONN_DOWN))
rds_queue_reconnect(cp);
else
- rds_conn_path_error(cp,
- "RDS: connect failed\n");
+ rds_conn_path_error(cp, "connect failed\n");
}
}
}
--
2.10.0.rc2.1.g053435c
^ permalink raw reply related
* [PATCH 1/2] rds: Remove unused rds_conn_error
From: Joe Perches @ 2016-10-15 18:53 UTC (permalink / raw)
To: Santosh Shilimkar
Cc: David S. Miller, netdev, linux-rdma, rds-devel, linux-kernel
In-Reply-To: <cover.1476557523.git.joe@perches.com>
This macro's last use was removed in commit d769ef81d5b59
("RDS: Update rds_conn_shutdown to work with rds_conn_path")
so make the macro and the __rds_conn_error function definition
and declaration disappear.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/rds/connection.c | 15 ---------------
net/rds/rds.h | 4 ----
2 files changed, 19 deletions(-)
diff --git a/net/rds/connection.c b/net/rds/connection.c
index f5058559bb08..13f459dad4ef 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -689,21 +689,6 @@ void rds_conn_connect_if_down(struct rds_connection *conn)
}
EXPORT_SYMBOL_GPL(rds_conn_connect_if_down);
-/*
- * An error occurred on the connection
- */
-void
-__rds_conn_error(struct rds_connection *conn, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vprintk(fmt, ap);
- va_end(ap);
-
- rds_conn_drop(conn);
-}
-
void
__rds_conn_path_error(struct rds_conn_path *cp, const char *fmt, ...)
{
diff --git a/net/rds/rds.h b/net/rds/rds.h
index fd0bccb2f9f9..25532a46602f 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -683,10 +683,6 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len,
struct rds_info_lengths *lens,
int (*visitor)(struct rds_connection *, void *),
size_t item_len);
-__printf(2, 3)
-void __rds_conn_error(struct rds_connection *conn, const char *, ...);
-#define rds_conn_error(conn, fmt...) \
- __rds_conn_error(conn, KERN_WARNING "RDS: " fmt)
__printf(2, 3)
void __rds_conn_path_error(struct rds_conn_path *cp, const char *, ...);
--
2.10.0.rc2.1.g053435c
^ permalink raw reply related
* Re: [rds-devel] [PATCH 2/2] rds: Remove duplicate prefix from rds_conn_path_error use
From: Sowmini Varadhan @ 2016-10-15 19:00 UTC (permalink / raw)
To: Joe Perches
Cc: Santosh Shilimkar, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g,
David S. Miller, linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <832b0d2c1b31c10db7692f65f1ba77e779db15e1.1476557523.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
On (10/15/16 11:53), Joe Perches wrote:
>
> rds_conn_path_error already prefixes "RDS:" to the output.
>
> Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
Acked-by: Sowmini Varadhan <sowmini.varadhan-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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
* Re: [rds-devel] [PATCH 1/2] rds: Remove unused rds_conn_error
From: Sowmini Varadhan @ 2016-10-15 19:00 UTC (permalink / raw)
To: Joe Perches
Cc: Santosh Shilimkar, linux-rdma, netdev, rds-devel, David S. Miller,
linux-kernel
In-Reply-To: <01fddf3af8f7757d0e79e4f25d7eb8b246e3d695.1476557523.git.joe@perches.com>
On (10/15/16 11:53), Joe Perches wrote:
> This macro's last use was removed in commit d769ef81d5b59
> ("RDS: Update rds_conn_shutdown to work with rds_conn_path")
> so make the macro and the __rds_conn_error function definition
> and declaration disappear.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
^ permalink raw reply
* [PATCH v2 0/3] support smc91x on mainstone and devicetree
From: Robert Jarzmik @ 2016-10-15 19:27 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Nicolas Pitre,
Russell King - ARM Linux, Arnd Bergmann
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Robert Jarzmik
This serie aims at bringing support to mainstone board on a device-tree based
build, as what is already in place for legacy mainstone.
The bulk of the mainstone "specific" behavior is that a u16 write doesn't work
on a address of the form 4*n + 2, while it works on 4*n.
The legacy workaround was in SMC_outw(), with calls to
machine_is_mainstone(). These calls don't work with a pxa27x-dt machine type,
which is used when a generic device-tree pxa27x machine is used to boot the
mainstone board.
Therefore, this serie enables the smc91c111 adapter of the mainstone board to
work on a device-tree build, exaclty as it's been working for years with the
legacy arch/arm/mach-pxa/mainstone.c definition.
Cheers.
--
Robert
Robert Jarzmik (3):
net: smc91x: isolate u16 writes alignment workaround
net: smc91x: take into account half-word workaround
net: smsc91x: add u16 workaround for pxa platforms
.../devicetree/bindings/net/smsc-lan91c111.txt | 2 +
drivers/net/ethernet/smsc/smc91x.c | 8 ++-
drivers/net/ethernet/smsc/smc91x.h | 78 ++++++++++++----------
3 files changed, 52 insertions(+), 36 deletions(-)
--
2.1.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
* [PATCH v2 1/3] net: smc91x: isolate u16 writes alignment workaround
From: Robert Jarzmik @ 2016-10-15 19:27 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Nicolas Pitre,
Russell King - ARM Linux, Arnd Bergmann
Cc: netdev, devicetree, linux-kernel, Robert Jarzmik
In-Reply-To: <1476559670-25056-1-git-send-email-robert.jarzmik@free.fr>
Writes to u16 has a special handling on 3 PXA platforms, where the
hardware wiring forces these writes to be u32 aligned.
This patch isolates this handling for PXA platforms as before, but
enables this "workaround" to be set up dynamically, which will be the
case in device-tree build types.
This patch was tested on 2 PXA platforms : mainstone, which relies on
the workaround, and lubbock, which doesn't.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
drivers/net/ethernet/smsc/smc91x.c | 6 ++-
drivers/net/ethernet/smsc/smc91x.h | 78 +++++++++++++++++++++-----------------
2 files changed, 48 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index 9b4780f87863..5658c2b28ec8 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -602,7 +602,8 @@ static void smc_hardware_send_pkt(unsigned long data)
SMC_PUSH_DATA(lp, buf, len & ~1);
/* Send final ctl word with the last byte if there is one */
- SMC_outw(((len & 1) ? (0x2000 | buf[len-1]) : 0), ioaddr, DATA_REG(lp));
+ SMC_outw(lp, ((len & 1) ? (0x2000 | buf[len-1]) : 0), ioaddr,
+ DATA_REG(lp));
/*
* If THROTTLE_TX_PKTS is set, we stop the queue here. This will
@@ -2282,6 +2283,9 @@ static int smc_drv_probe(struct platform_device *pdev)
goto out_free_netdev;
}
}
+ lp->half_word_align4 =
+ machine_is_mainstone() || machine_is_stargate2() ||
+ machine_is_pxa_idp();
#if IS_BUILTIN(CONFIG_OF)
match = of_match_device(of_match_ptr(smc91x_match), &pdev->dev);
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
index ea8465467469..dff165ed106d 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -86,11 +86,11 @@
#define SMC_inl(a, r) readl((a) + (r))
#define SMC_outb(v, a, r) writeb(v, (a) + (r))
-#define SMC_outw(v, a, r) \
+#define SMC_outw(lp, v, a, r) \
do { \
unsigned int __v = v, __smc_r = r; \
if (SMC_16BIT(lp)) \
- __SMC_outw(__v, a, __smc_r); \
+ __SMC_outw(lp, __v, a, __smc_r); \
else if (SMC_8BIT(lp)) \
SMC_outw_b(__v, a, __smc_r); \
else \
@@ -107,10 +107,10 @@
#define SMC_IRQ_FLAGS (-1) /* from resource */
/* We actually can't write halfwords properly if not word aligned */
-static inline void __SMC_outw(u16 val, void __iomem *ioaddr, int reg)
+static inline void _SMC_outw_align4(u16 val, void __iomem *ioaddr, int reg,
+ bool use_align4_workaround)
{
- if ((machine_is_mainstone() || machine_is_stargate2() ||
- machine_is_pxa_idp()) && reg & 2) {
+ if (use_align4_workaround) {
unsigned int v = val << 16;
v |= readl(ioaddr + (reg & ~2)) & 0xffff;
writel(v, ioaddr + (reg & ~2));
@@ -119,6 +119,12 @@ static inline void __SMC_outw(u16 val, void __iomem *ioaddr, int reg)
}
}
+#define __SMC_outw(lp, v, a, r) \
+ _SMC_outw_align4((v), (a), (r), \
+ IS_BUILTIN(CONFIG_ARCH_PXA) && ((r) & 2) && \
+ lp->half_word_align4)
+
+
#elif defined(CONFIG_SH_SH4202_MICRODEV)
#define SMC_CAN_USE_8BIT 0
@@ -129,7 +135,7 @@ static inline void __SMC_outw(u16 val, void __iomem *ioaddr, int reg)
#define SMC_inw(a, r) inw((a) + (r) - 0xa0000000)
#define SMC_inl(a, r) inl((a) + (r) - 0xa0000000)
#define SMC_outb(v, a, r) outb(v, (a) + (r) - 0xa0000000)
-#define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000)
+#define SMC_outw(lp, v, a, r) outw(v, (a) + (r) - 0xa0000000)
#define SMC_outl(v, a, r) outl(v, (a) + (r) - 0xa0000000)
#define SMC_insl(a, r, p, l) insl((a) + (r) - 0xa0000000, p, l)
#define SMC_outsl(a, r, p, l) outsl((a) + (r) - 0xa0000000, p, l)
@@ -147,7 +153,7 @@ static inline void __SMC_outw(u16 val, void __iomem *ioaddr, int reg)
#define SMC_inb(a, r) inb(((u32)a) + (r))
#define SMC_inw(a, r) inw(((u32)a) + (r))
#define SMC_outb(v, a, r) outb(v, ((u32)a) + (r))
-#define SMC_outw(v, a, r) outw(v, ((u32)a) + (r))
+#define SMC_outw(lp, v, a, r) outw(v, ((u32)a) + (r))
#define SMC_insw(a, r, p, l) insw(((u32)a) + (r), p, l)
#define SMC_outsw(a, r, p, l) outsw(((u32)a) + (r), p, l)
@@ -175,7 +181,7 @@ static inline void __SMC_outw(u16 val, void __iomem *ioaddr, int reg)
#define SMC_inw(a, r) readw((a) + (r))
#define SMC_inl(a, r) readl((a) + (r))
#define SMC_outb(v, a, r) writeb(v, (a) + (r))
-#define SMC_outw(v, a, r) writew(v, (a) + (r))
+#define SMC_outw(lp, v, a, r) writew(v, (a) + (r))
#define SMC_outl(v, a, r) writel(v, (a) + (r))
#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l)
#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
@@ -207,7 +213,7 @@ static inline void mcf_outsw(void *a, unsigned char *p, int l)
}
#define SMC_inw(a, r) _swapw(readw((a) + (r)))
-#define SMC_outw(v, a, r) writew(_swapw(v), (a) + (r))
+#define SMC_outw(lp, v, a, r) writew(_swapw(v), (a) + (r))
#define SMC_insw(a, r, p, l) mcf_insw(a + r, p, l)
#define SMC_outsw(a, r, p, l) mcf_outsw(a + r, p, l)
@@ -241,7 +247,7 @@ static inline void mcf_outsw(void *a, unsigned char *p, int l)
#define SMC_inw(a, r) ioread16((a) + (r))
#define SMC_inl(a, r) ioread32((a) + (r))
#define SMC_outb(v, a, r) iowrite8(v, (a) + (r))
-#define SMC_outw(v, a, r) iowrite16(v, (a) + (r))
+#define SMC_outw(lp, v, a, r) iowrite16(v, (a) + (r))
#define SMC_outl(v, a, r) iowrite32(v, (a) + (r))
#define SMC_insw(a, r, p, l) ioread16_rep((a) + (r), p, l)
#define SMC_outsw(a, r, p, l) iowrite16_rep((a) + (r), p, l)
@@ -303,6 +309,8 @@ struct smc_local {
/* the low address lines on some platforms aren't connected... */
int io_shift;
+ /* on some platforms a u16 write must be 4-bytes aligned */
+ bool half_word_align4;
struct smc91x_platdata cfg;
};
@@ -457,7 +465,7 @@ smc_pxa_dma_insw(void __iomem *ioaddr, struct smc_local *lp, int reg, int dma,
#if ! SMC_CAN_USE_16BIT
-#define SMC_outw(x, ioaddr, reg) SMC_outw_b(x, ioaddr, reg)
+#define SMC_outw(lp, x, ioaddr, reg) SMC_outw_b(x, ioaddr, reg)
#define SMC_inw(ioaddr, reg) SMC_inw_b(ioaddr, reg)
#define SMC_insw(a, r, p, l) BUG()
#define SMC_outsw(a, r, p, l) BUG()
@@ -909,7 +917,7 @@ static const char * chip_ids[ 16 ] = {
else if (SMC_8BIT(lp)) \
SMC_outb(x, ioaddr, PN_REG(lp)); \
else \
- SMC_outw(x, ioaddr, PN_REG(lp)); \
+ SMC_outw(lp, x, ioaddr, PN_REG(lp)); \
} while (0)
#define SMC_GET_AR(lp) \
@@ -937,7 +945,7 @@ static const char * chip_ids[ 16 ] = {
int __mask; \
local_irq_save(__flags); \
__mask = SMC_inw(ioaddr, INT_REG(lp)) & ~0xff; \
- SMC_outw(__mask | (x), ioaddr, INT_REG(lp)); \
+ SMC_outw(lp, __mask | (x), ioaddr, INT_REG(lp)); \
local_irq_restore(__flags); \
} \
} while (0)
@@ -951,7 +959,7 @@ static const char * chip_ids[ 16 ] = {
if (SMC_8BIT(lp)) \
SMC_outb(x, ioaddr, IM_REG(lp)); \
else \
- SMC_outw((x) << 8, ioaddr, INT_REG(lp)); \
+ SMC_outw(lp, (x) << 8, ioaddr, INT_REG(lp)); \
} while (0)
#define SMC_CURRENT_BANK(lp) SMC_inw(ioaddr, BANK_SELECT)
@@ -961,22 +969,22 @@ static const char * chip_ids[ 16 ] = {
if (SMC_MUST_ALIGN_WRITE(lp)) \
SMC_outl((x)<<16, ioaddr, 12<<SMC_IO_SHIFT); \
else \
- SMC_outw(x, ioaddr, BANK_SELECT); \
+ SMC_outw(lp, x, ioaddr, BANK_SELECT); \
} while (0)
#define SMC_GET_BASE(lp) SMC_inw(ioaddr, BASE_REG(lp))
-#define SMC_SET_BASE(lp, x) SMC_outw(x, ioaddr, BASE_REG(lp))
+#define SMC_SET_BASE(lp, x) SMC_outw(lp, x, ioaddr, BASE_REG(lp))
#define SMC_GET_CONFIG(lp) SMC_inw(ioaddr, CONFIG_REG(lp))
-#define SMC_SET_CONFIG(lp, x) SMC_outw(x, ioaddr, CONFIG_REG(lp))
+#define SMC_SET_CONFIG(lp, x) SMC_outw(lp, x, ioaddr, CONFIG_REG(lp))
#define SMC_GET_COUNTER(lp) SMC_inw(ioaddr, COUNTER_REG(lp))
#define SMC_GET_CTL(lp) SMC_inw(ioaddr, CTL_REG(lp))
-#define SMC_SET_CTL(lp, x) SMC_outw(x, ioaddr, CTL_REG(lp))
+#define SMC_SET_CTL(lp, x) SMC_outw(lp, x, ioaddr, CTL_REG(lp))
#define SMC_GET_MII(lp) SMC_inw(ioaddr, MII_REG(lp))
@@ -987,18 +995,18 @@ static const char * chip_ids[ 16 ] = {
if (SMC_MUST_ALIGN_WRITE(lp)) \
SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 8, 1)); \
else \
- SMC_outw(x, ioaddr, GP_REG(lp)); \
+ SMC_outw(lp, x, ioaddr, GP_REG(lp)); \
} while (0)
-#define SMC_SET_MII(lp, x) SMC_outw(x, ioaddr, MII_REG(lp))
+#define SMC_SET_MII(lp, x) SMC_outw(lp, x, ioaddr, MII_REG(lp))
#define SMC_GET_MIR(lp) SMC_inw(ioaddr, MIR_REG(lp))
-#define SMC_SET_MIR(lp, x) SMC_outw(x, ioaddr, MIR_REG(lp))
+#define SMC_SET_MIR(lp, x) SMC_outw(lp, x, ioaddr, MIR_REG(lp))
#define SMC_GET_MMU_CMD(lp) SMC_inw(ioaddr, MMU_CMD_REG(lp))
-#define SMC_SET_MMU_CMD(lp, x) SMC_outw(x, ioaddr, MMU_CMD_REG(lp))
+#define SMC_SET_MMU_CMD(lp, x) SMC_outw(lp, x, ioaddr, MMU_CMD_REG(lp))
#define SMC_GET_FIFO(lp) SMC_inw(ioaddr, FIFO_REG(lp))
@@ -1009,14 +1017,14 @@ static const char * chip_ids[ 16 ] = {
if (SMC_MUST_ALIGN_WRITE(lp)) \
SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 4, 2)); \
else \
- SMC_outw(x, ioaddr, PTR_REG(lp)); \
+ SMC_outw(lp, x, ioaddr, PTR_REG(lp)); \
} while (0)
#define SMC_GET_EPH_STATUS(lp) SMC_inw(ioaddr, EPH_STATUS_REG(lp))
#define SMC_GET_RCR(lp) SMC_inw(ioaddr, RCR_REG(lp))
-#define SMC_SET_RCR(lp, x) SMC_outw(x, ioaddr, RCR_REG(lp))
+#define SMC_SET_RCR(lp, x) SMC_outw(lp, x, ioaddr, RCR_REG(lp))
#define SMC_GET_REV(lp) SMC_inw(ioaddr, REV_REG(lp))
@@ -1027,12 +1035,12 @@ static const char * chip_ids[ 16 ] = {
if (SMC_MUST_ALIGN_WRITE(lp)) \
SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 8, 0)); \
else \
- SMC_outw(x, ioaddr, RPC_REG(lp)); \
+ SMC_outw(lp, x, ioaddr, RPC_REG(lp)); \
} while (0)
#define SMC_GET_TCR(lp) SMC_inw(ioaddr, TCR_REG(lp))
-#define SMC_SET_TCR(lp, x) SMC_outw(x, ioaddr, TCR_REG(lp))
+#define SMC_SET_TCR(lp, x) SMC_outw(lp, x, ioaddr, TCR_REG(lp))
#ifndef SMC_GET_MAC_ADDR
#define SMC_GET_MAC_ADDR(lp, addr) \
@@ -1049,18 +1057,18 @@ static const char * chip_ids[ 16 ] = {
#define SMC_SET_MAC_ADDR(lp, addr) \
do { \
- SMC_outw(addr[0]|(addr[1] << 8), ioaddr, ADDR0_REG(lp)); \
- SMC_outw(addr[2]|(addr[3] << 8), ioaddr, ADDR1_REG(lp)); \
- SMC_outw(addr[4]|(addr[5] << 8), ioaddr, ADDR2_REG(lp)); \
+ SMC_outw(lp, addr[0]|(addr[1] << 8), ioaddr, ADDR0_REG(lp)); \
+ SMC_outw(lp, addr[2]|(addr[3] << 8), ioaddr, ADDR1_REG(lp)); \
+ SMC_outw(lp, addr[4]|(addr[5] << 8), ioaddr, ADDR2_REG(lp)); \
} while (0)
#define SMC_SET_MCAST(lp, x) \
do { \
const unsigned char *mt = (x); \
- SMC_outw(mt[0] | (mt[1] << 8), ioaddr, MCAST_REG1(lp)); \
- SMC_outw(mt[2] | (mt[3] << 8), ioaddr, MCAST_REG2(lp)); \
- SMC_outw(mt[4] | (mt[5] << 8), ioaddr, MCAST_REG3(lp)); \
- SMC_outw(mt[6] | (mt[7] << 8), ioaddr, MCAST_REG4(lp)); \
+ SMC_outw(lp, mt[0] | (mt[1] << 8), ioaddr, MCAST_REG1(lp)); \
+ SMC_outw(lp, mt[2] | (mt[3] << 8), ioaddr, MCAST_REG2(lp)); \
+ SMC_outw(lp, mt[4] | (mt[5] << 8), ioaddr, MCAST_REG3(lp)); \
+ SMC_outw(lp, mt[6] | (mt[7] << 8), ioaddr, MCAST_REG4(lp)); \
} while (0)
#define SMC_PUT_PKT_HDR(lp, status, length) \
@@ -1069,8 +1077,8 @@ static const char * chip_ids[ 16 ] = {
SMC_outl((status) | (length)<<16, ioaddr, \
DATA_REG(lp)); \
else { \
- SMC_outw(status, ioaddr, DATA_REG(lp)); \
- SMC_outw(length, ioaddr, DATA_REG(lp)); \
+ SMC_outw(lp, status, ioaddr, DATA_REG(lp)); \
+ SMC_outw(lp, length, ioaddr, DATA_REG(lp)); \
} \
} while (0)
--
2.1.4
^ permalink raw reply related
* [PATCH v2 2/3] net: smc91x: take into account half-word workaround
From: Robert Jarzmik @ 2016-10-15 19:27 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Nicolas Pitre,
Russell King - ARM Linux, Arnd Bergmann
Cc: netdev, devicetree, linux-kernel, Robert Jarzmik
In-Reply-To: <1476559670-25056-1-git-send-email-robert.jarzmik@free.fr>
For device-tree builds, platforms such as mainstone, idp and stargate2
must have their u16 writes all aligned on 32 bit boundaries. This is
already enabled in platform data builds, and this patch adds it to
device-tree builds.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
Since v1: rename dt property to pxa-u16-align4
---
drivers/net/ethernet/smsc/smc91x.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index 5658c2b28ec8..c14676805d06 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -2329,6 +2329,8 @@ static int smc_drv_probe(struct platform_device *pdev)
if (!device_property_read_u32(&pdev->dev, "reg-shift",
&val))
lp->io_shift = val;
+ lp->half_word_align4 =
+ device_property_read_bool(&pdev->dev, "pxa-u16-align4");
}
#endif
--
2.1.4
^ permalink raw reply related
* [PATCH v2 3/3] net: smsc91x: add u16 workaround for pxa platforms
From: Robert Jarzmik @ 2016-10-15 19:27 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Nicolas Pitre,
Russell King - ARM Linux, Arnd Bergmann
Cc: netdev, devicetree, linux-kernel, Robert Jarzmik, Jeremy Linton
In-Reply-To: <1476559670-25056-1-git-send-email-robert.jarzmik@free.fr>
Add a workaround for mainstone, idp and stargate2 boards, for u16 writes
which must be aligned on 32 bits addresses.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Jeremy Linton <jeremy.linton@arm.com>
---
Since v1: rename dt property to pxa-u16-align4
change the binding documentation file
---
Documentation/devicetree/bindings/net/smsc-lan91c111.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt
index e77e167593db..309e37eb7c7c 100644
--- a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt
+++ b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt
@@ -13,3 +13,5 @@ Optional properties:
16-bit access only.
- power-gpios: GPIO to control the PWRDWN pin
- reset-gpios: GPIO to control the RESET pin
+- pxa-u16-align4 : Boolean, put in place the workaround the force all
+ u16 writes to be 32 bits aligned
--
2.1.4
^ permalink raw reply related
* Re: [PATCH 1/2] rds: Remove unused rds_conn_error
From: Santosh Shilimkar @ 2016-10-15 19:38 UTC (permalink / raw)
To: Joe Perches
Cc: David S. Miller, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
rds-devel-N0ozoZBvEnrZJqsBc5GL+g,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <01fddf3af8f7757d0e79e4f25d7eb8b246e3d695.1476557523.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
On 10/15/2016 11:53 AM, Joe Perches wrote:
> This macro's last use was removed in commit d769ef81d5b59
> ("RDS: Update rds_conn_shutdown to work with rds_conn_path")
> so make the macro and the __rds_conn_error function definition
> and declaration disappear.
>
> Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
> ---
Had same patch along with few more in the queue but
didn't find time of late to get it on the list.
Thanks for both patches.
Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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