* [net-next REPOST] 8390 ei_debug : Reenable the use of debugging in 8390 based chips
From: Matthew Whitehead @ 2013-10-15 2:46 UTC (permalink / raw)
To: netdev; +Cc: Matthew Whitehead
Ethernet boards based on the 8390 chip had an '#ifdef notdef' disabling the
use of the debug variable ei_debug. Reenable it for those of us who still
occasionally use it.
Also handle the case of the 'ne' driver which uses 8390p.o rather than
8390.o. In that case ei_debug is aliased to eip_debug so it doesn't clash
with the previously exported ei_debug.
Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
---
drivers/net/ethernet/8390/8390.h | 5 ++++-
drivers/net/ethernet/8390/8390p.c | 1 +
drivers/net/ethernet/8390/axnet_cs.c | 5 -----
drivers/net/ethernet/8390/lib8390.c | 8 ++++++--
drivers/net/ethernet/8390/ne.c | 1 +
5 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/8390/8390.h b/drivers/net/ethernet/8390/8390.h
index 2923c51..e6c547d 100644
--- a/drivers/net/ethernet/8390/8390.h
+++ b/drivers/net/ethernet/8390/8390.h
@@ -21,7 +21,10 @@ struct e8390_pkt_hdr {
unsigned short count; /* header + packet length in bytes */
};
-#ifdef notdef
+#if (defined EI_DEBUG && defined EIP_DEBUG)
+#define ei_debug eip_debug
+extern int eip_debug;
+#elif (defined EI_DEBUG && ! defined EIP_DEBUG)
extern int ei_debug;
#else
#define ei_debug 1
diff --git a/drivers/net/ethernet/8390/8390p.c b/drivers/net/ethernet/8390/8390p.c
index e8fc2e8..0a27dea 100644
--- a/drivers/net/ethernet/8390/8390p.c
+++ b/drivers/net/ethernet/8390/8390p.c
@@ -7,6 +7,7 @@ static const char version[] =
#define ei_outb(_v, _p) outb(_v, _p)
#define ei_inb_p(_p) inb_p(_p)
#define ei_outb_p(_v, _p) outb_p(_v, _p)
+#define EIP_DEBUG 1
#include "lib8390.c"
diff --git a/drivers/net/ethernet/8390/axnet_cs.c b/drivers/net/ethernet/8390/axnet_cs.c
index d801c141..581560c 100644
--- a/drivers/net/ethernet/8390/axnet_cs.c
+++ b/drivers/net/ethernet/8390/axnet_cs.c
@@ -810,11 +810,6 @@ module_pcmcia_driver(axnet_cs_driver);
#define ei_block_input (ei_local->block_input)
#define ei_get_8390_hdr (ei_local->get_8390_hdr)
-/* use 0 for production, 1 for verification, >2 for debug */
-#ifndef ei_debug
-int ei_debug = 1;
-#endif
-
/* Index to functions. */
static void ei_tx_intr(struct net_device *dev);
static void ei_tx_err(struct net_device *dev);
diff --git a/drivers/net/ethernet/8390/lib8390.c b/drivers/net/ethernet/8390/lib8390.c
index b329f5c..889d1fd 100644
--- a/drivers/net/ethernet/8390/lib8390.c
+++ b/drivers/net/ethernet/8390/lib8390.c
@@ -100,8 +100,12 @@
#define ei_get_8390_hdr (ei_local->get_8390_hdr)
/* use 0 for production, 1 for verification, >2 for debug */
-#ifndef ei_debug
-int ei_debug = 1;
+#if (defined EI_DEBUG && defined EIP_DEBUG)
+int eip_debug = EI_DEBUG;
+EXPORT_SYMBOL(eip_debug);
+#elif (defined EI_DEBUG && ! defined EIP_DEBUG)
+int ei_debug = EI_DEBUG;
+EXPORT_SYMBOL(ei_debug);
#endif
/* Index to functions. */
diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
index b2e8405..4136b31 100644
--- a/drivers/net/ethernet/8390/ne.c
+++ b/drivers/net/ethernet/8390/ne.c
@@ -54,6 +54,7 @@ static const char version2[] =
#include <linux/platform_device.h>
#include <asm/io.h>
+#define EIP_DEBUG 1
#include "8390.h"
--
1.7.2.5
^ permalink raw reply related
* Re: DomU's network interface will hung when Dom0 running 32bit
From: jianhai luan @ 2013-10-15 2:44 UTC (permalink / raw)
To: Wei Liu; +Cc: Ian Campbell, xen-devel, netdev
In-Reply-To: <20131014111958.GE11739@zion.uk.xensource.com>
On 2013-10-14 19:19, Wei Liu wrote:
> On Sat, Oct 12, 2013 at 04:53:18PM +0800, jianhai luan wrote:
>> Hi Ian,
>> I meet the DomU's network interface hung issue recently, and have
>> been working on the issue from that time. I find that DomU's network
>> interface, which send lesser package, will hung if Dom0 running
>> 32bit and DomU's up-time is very long. I think that one jiffies
>> overflow bug exist in the function tx_credit_exceeded().
>> I know the inline function time_after_eq(a,b) will process jiffies
>> overflow, but the function have one limit a should little that (b +
>> MAX_SIGNAL_LONG). If a large than the value, time_after_eq will
>> return false. The MAX_SINGNAL_LONG should be 0x7fffffff at 32-bit
>> machine.
>> If DomU's network interface send lesser package (<0.5k/s if
>> jiffies=250 and credit_bytes=ULONG_MAX), jiffies will beyond out
>> (credit_timeout.expires + MAX_SIGNAL_LONG) and time_after_eq(now,
>> next_credit) will failure (should be true). So one timer which will
>> not be trigger in short time, and later process will be aborted when
>> timer_pending(&vif->credit_timeout) is true. The result will be
>> DomU's network interface will be hung in long time (> 40days).
>> Please think about the below scenario:
>> Condition:
>> Dom0 running 32-bit and HZ = 1000
>> vif->credit_timeout->expire = 0xffffffff, vif->remaining_credit
>> = 0xffffffff, vif->credit_usec=0 jiffies=0
>> vif receive lesser package (DomU send lesser package). If the
>> value is litter than 2K/s, consume 4G(0xffffffff) will need 582.55
>> hours. jiffies will large than 0x7ffffff. we guess jiffies =
>> 0x800000ff, time_after_eq(0x800000ff, 0xffffffff) will failure, and
>> one time which expire is 0xfffffff will be pended into system. So
>> the interface will hung until jiffies recount 0xffffffff (that will
>> need very long time).
> If I'm not mistaken you meant time_after_eq(now, next_credit) in
> netback. How does next_credit become 0xffffffff?
I only assume the value is 0xfffffff, and the value of next_credit
isn't point. If the delta between now and next_credit larger than
ULONG_MAX, time_after_eq will do wrong judge.
>
> Wei.
>
>> If some error exist in above explain, please help me point it out.
>>
>> Thanks,
>> Jason
^ permalink raw reply
* [PATCH 3/3] ipvs: improved SH fallback strategy
From: Simon Horman @ 2013-10-15 2:01 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Alexander Frolkin, Simon Horman
In-Reply-To: <1381802507-7934-1-git-send-email-horms@verge.net.au>
From: Alexander Frolkin <avf@eldamar.org.uk>
Improve the SH fallback realserver selection strategy.
With sh and sh-fallback, if a realserver is down, this attempts to
distribute the traffic that would have gone to that server evenly
among the remaining servers.
Signed-off-by: Alexander Frolkin <avf@eldamar.org.uk>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_sh.c | 39 +++++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_sh.c b/net/netfilter/ipvs/ip_vs_sh.c
index 3588fae..cc65b2f 100644
--- a/net/netfilter/ipvs/ip_vs_sh.c
+++ b/net/netfilter/ipvs/ip_vs_sh.c
@@ -115,27 +115,46 @@ ip_vs_sh_get(struct ip_vs_service *svc, struct ip_vs_sh_state *s,
}
-/* As ip_vs_sh_get, but with fallback if selected server is unavailable */
+/* As ip_vs_sh_get, but with fallback if selected server is unavailable
+ *
+ * The fallback strategy loops around the table starting from a "random"
+ * point (in fact, it is chosen to be the original hash value to make the
+ * algorithm deterministic) to find a new server.
+ */
static inline struct ip_vs_dest *
ip_vs_sh_get_fallback(struct ip_vs_service *svc, struct ip_vs_sh_state *s,
const union nf_inet_addr *addr, __be16 port)
{
- unsigned int offset;
- unsigned int hash;
+ unsigned int offset, roffset;
+ unsigned int hash, ihash;
struct ip_vs_dest *dest;
+ /* first try the dest it's supposed to go to */
+ ihash = ip_vs_sh_hashkey(svc->af, addr, port, 0);
+ dest = rcu_dereference(s->buckets[ihash].dest);
+ if (!dest)
+ return NULL;
+ if (!is_unavailable(dest))
+ return dest;
+
+ IP_VS_DBG_BUF(6, "SH: selected unavailable server %s:%d, reselecting",
+ IP_VS_DBG_ADDR(svc->af, &dest->addr), ntohs(dest->port));
+
+ /* if the original dest is unavailable, loop around the table
+ * starting from ihash to find a new dest
+ */
for (offset = 0; offset < IP_VS_SH_TAB_SIZE; offset++) {
- hash = ip_vs_sh_hashkey(svc->af, addr, port, offset);
+ roffset = (offset + ihash) % IP_VS_SH_TAB_SIZE;
+ hash = ip_vs_sh_hashkey(svc->af, addr, port, roffset);
dest = rcu_dereference(s->buckets[hash].dest);
if (!dest)
break;
- if (is_unavailable(dest))
- IP_VS_DBG_BUF(6, "SH: selected unavailable server "
- "%s:%d (offset %d)",
- IP_VS_DBG_ADDR(svc->af, &dest->addr),
- ntohs(dest->port), offset);
- else
+ if (!is_unavailable(dest))
return dest;
+ IP_VS_DBG_BUF(6, "SH: selected unavailable "
+ "server %s:%d (offset %d), reselecting",
+ IP_VS_DBG_ADDR(svc->af, &dest->addr),
+ ntohs(dest->port), roffset);
}
return NULL;
--
1.8.4
^ permalink raw reply related
* [PATCH 1/3] ipvs: fix the IPVS_CMD_ATTR_MAX definition
From: Simon Horman @ 2013-10-15 2:01 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Simon Horman
In-Reply-To: <1381802507-7934-1-git-send-email-horms@verge.net.au>
From: Julian Anastasov <ja@ssi.bg>
It was wrong (bigger) but problem is harmless.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/uapi/linux/ip_vs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h
index 2945822..fbcffe8 100644
--- a/include/uapi/linux/ip_vs.h
+++ b/include/uapi/linux/ip_vs.h
@@ -334,7 +334,7 @@ enum {
__IPVS_CMD_ATTR_MAX,
};
-#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
+#define IPVS_CMD_ATTR_MAX (__IPVS_CMD_ATTR_MAX - 1)
/*
* Attributes used to describe a service
--
1.8.4
^ permalink raw reply related
* [PATCH 2/3] ipvs: avoid rcu_barrier during netns cleanup
From: Simon Horman @ 2013-10-15 2:01 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Simon Horman
In-Reply-To: <1381802507-7934-1-git-send-email-horms@verge.net.au>
From: Julian Anastasov <ja@ssi.bg>
commit 578bc3ef1e473a ("ipvs: reorganize dest trash") added
rcu_barrier() on cleanup to wait dest users and schedulers
like LBLC and LBLCR to put their last dest reference.
Using rcu_barrier with many namespaces is problematic.
Trying to fix it by freeing dest with kfree_rcu is not
a solution, RCU callbacks can run in parallel and execution
order is random.
Fix it by creating new function ip_vs_dest_put_and_free()
which is heavier than ip_vs_dest_put(). We will use it just
for schedulers like LBLC, LBLCR that can delay their dest
release.
By default, dests reference is above 0 if they are present in
service and it is 0 when deleted but still in trash list.
Change the dest trash code to use ip_vs_dest_put_and_free(),
so that refcnt -1 can be used for freeing. As result,
such checks remain in slow path and the rcu_barrier() from
netns cleanup can be removed.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 6 ++++++
net/netfilter/ipvs/ip_vs_ctl.c | 6 +-----
net/netfilter/ipvs/ip_vs_lblc.c | 2 +-
net/netfilter/ipvs/ip_vs_lblcr.c | 2 +-
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 1c2e1b9..cd7275f 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1442,6 +1442,12 @@ static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
atomic_dec(&dest->refcnt);
}
+static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
+{
+ if (atomic_dec_return(&dest->refcnt) < 0)
+ kfree(dest);
+}
+
/*
* IPVS sync daemon data and function prototypes
* (from ip_vs_sync.c)
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index a3df9bd..62786a4 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -704,7 +704,7 @@ static void ip_vs_dest_free(struct ip_vs_dest *dest)
__ip_vs_dst_cache_reset(dest);
__ip_vs_svc_put(svc, false);
free_percpu(dest->stats.cpustats);
- kfree(dest);
+ ip_vs_dest_put_and_free(dest);
}
/*
@@ -3820,10 +3820,6 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net)
{
struct netns_ipvs *ipvs = net_ipvs(net);
- /* Some dest can be in grace period even before cleanup, we have to
- * defer ip_vs_trash_cleanup until ip_vs_dest_wait_readers is called.
- */
- rcu_barrier();
ip_vs_trash_cleanup(net);
ip_vs_stop_estimator(net, &ipvs->tot_stats);
ip_vs_control_net_cleanup_sysctl(net);
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c
index eff13c9..ca056a3 100644
--- a/net/netfilter/ipvs/ip_vs_lblc.c
+++ b/net/netfilter/ipvs/ip_vs_lblc.c
@@ -136,7 +136,7 @@ static void ip_vs_lblc_rcu_free(struct rcu_head *head)
struct ip_vs_lblc_entry,
rcu_head);
- ip_vs_dest_put(en->dest);
+ ip_vs_dest_put_and_free(en->dest);
kfree(en);
}
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
index 0b85500..3f21a2f 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -130,7 +130,7 @@ static void ip_vs_lblcr_elem_rcu_free(struct rcu_head *head)
struct ip_vs_dest_set_elem *e;
e = container_of(head, struct ip_vs_dest_set_elem, rcu_head);
- ip_vs_dest_put(e->dest);
+ ip_vs_dest_put_and_free(e->dest);
kfree(e);
}
--
1.8.4
^ permalink raw reply related
* [GIT PULL] IPVS updates for v3.13
From: Simon Horman @ 2013-10-15 2:01 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Simon Horman
Hi Pablo,
please consider the following fixes for IPVS for v3.13.
This pull request is based on nf-next.
The following changes since commit 58308451e91974267e1f4a618346055342019e02:
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next (2013-10-10 15:29:44 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs-next.git tags/ipvs-for-v3.13
for you to fetch changes up to 1255ce5f10dbb4646c8d43b8d59faab48ae4a6b2:
ipvs: improved SH fallback strategy (2013-10-15 10:54:50 +0900)
----------------------------------------------------------------
IPVS updates for v3.13
* Improvements to SH fallback strategy
* Avoid rcu_barrier during netns cleanup
* Fix the IPVS_CMD_ATTR_MAX definition
----------------------------------------------------------------
Alexander Frolkin (1):
ipvs: improved SH fallback strategy
Julian Anastasov (2):
ipvs: fix the IPVS_CMD_ATTR_MAX definition
ipvs: avoid rcu_barrier during netns cleanup
include/net/ip_vs.h | 6 ++++++
include/uapi/linux/ip_vs.h | 2 +-
net/netfilter/ipvs/ip_vs_ctl.c | 6 +-----
net/netfilter/ipvs/ip_vs_lblc.c | 2 +-
net/netfilter/ipvs/ip_vs_lblcr.c | 2 +-
net/netfilter/ipvs/ip_vs_sh.c | 39 +++++++++++++++++++++++++++++----------
6 files changed, 39 insertions(+), 18 deletions(-)
^ permalink raw reply
* Re: [PATCHv2] ipvs: improved SH fallback strategy
From: Simon Horman @ 2013-10-15 1:55 UTC (permalink / raw)
To: Julian Anastasov
Cc: Alexander Frolkin, Sergei Shtylyov, lvs-devel, Wensong Zhang,
netdev, linux-kernel
In-Reply-To: <alpine.LFD.2.00.1309272218180.1725@ja.ssi.bg>
On Fri, Sep 27, 2013 at 10:20:42PM +0300, Julian Anastasov wrote:
>
> Hello,
>
> On Fri, 27 Sep 2013, Alexander Frolkin wrote:
>
> > Improve the SH fallback realserver selection strategy.
> >
> > With sh and sh-fallback, if a realserver is down, this attempts to
> > distribute the traffic that would have gone to that server evenly
> > among the remaining servers.
> >
> > Signed-off-by: Alexander Frolkin <avf@eldamar.org.uk>
>
> Thanks! Looks good to me.
>
> Acked-by: Julian Anastasov <ja@ssi.bg>
Sorry for letting this one slip.
I have queued it up.
^ permalink raw reply
* Re: [PATCH net-next] sctp: Namespacify checksum_disable
From: Fan Du @ 2013-10-15 1:38 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: nhorman, davem, netdev
In-Reply-To: <1170c5bd-54e0-4051-a280-ff6538a47614@email.android.com>
On 2013年10月14日 22:08, Vlad Yasevich wrote:
>
> Fan Du<fan.du@windriver.com> wrote:
>
>> >SCTP CRC32-C checksum computing and verifying should be
>> >namespace-sensible,
>> >as each, e.g. tenant instance might need different checksum
>> >configuration for
>> >its requirement. So this patch enhance SCTP with this feature.
>> >
>> >Signed-off-by: Fan Du<fan.du@windriver.com>
> NACK. We don't want that setting to be sysctl configurable. It is only useful in very limited circumstances and is not really for production/everyday use.
>
> In fact, I am going to send in a patch that makes this module parameter read only in /sys.
Thanks for the background explanation, Vlad.
--
浮沉随浪只记今朝笑
--fan
^ permalink raw reply
* Re: [PATCH net 1/2] virtio-net: don't respond to cpu hotplug notifier if we're not ready
From: Wanlong Gao @ 2013-10-15 0:18 UTC (permalink / raw)
To: Jason Wang; +Cc: mst, netdev, linux-kernel, virtualization
In-Reply-To: <1381744595-26881-1-git-send-email-jasowang@redhat.com>
On 10/14/2013 05:56 PM, Jason Wang wrote:
> We're trying to re-configure the affinity unconditionally in cpu hotplug
> callback. This may lead the issue during resuming from s3/s4 since
>
> - virt queues haven't been allocated at that time.
> - it's unnecessary since thaw method will re-configure the affinity.
>
> Fix this issue by checking the config_enable and do nothing is we're not ready.
>
> The bug were introduced by commit 8de4b2f3ae90c8fc0f17eeaab87d5a951b66ee17
> (virtio-net: reset virtqueue affinity when doing cpu hotplug).
>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Thank you.
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
> The patch is need for 3.8 and above.
> ---
> drivers/net/virtio_net.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index defec2b..c4bc1cc 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1116,6 +1116,11 @@ static int virtnet_cpu_callback(struct notifier_block *nfb,
> {
> struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb);
>
> + mutex_lock(&vi->config_lock);
> +
> + if (!vi->config_enable)
> + goto done;
> +
> switch(action & ~CPU_TASKS_FROZEN) {
> case CPU_ONLINE:
> case CPU_DOWN_FAILED:
> @@ -1128,6 +1133,9 @@ static int virtnet_cpu_callback(struct notifier_block *nfb,
> default:
> break;
> }
> +
> +done:
> + mutex_unlock(&vi->config_lock);
> return NOTIFY_OK;
> }
>
>
^ permalink raw reply
* [PATCH RFC 5/5] net: macb: Adjust tx_clk when link speed changes
From: Soren Brinkmann @ 2013-10-14 23:59 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: netdev, linux-kernel, Michal Simek, Soren Brinkmann
In-Reply-To: <1381795140-10792-1-git-send-email-soren.brinkmann@xilinx.com>
Adjust the ethernet clock according to the negotiated link speed.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
drivers/net/ethernet/cadence/macb.c | 66 +++++++++++++++++++++++++++++++++++++
drivers/net/ethernet/cadence/macb.h | 1 +
2 files changed, 67 insertions(+)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 603844b1d483..beb9fa863811 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -204,6 +204,49 @@ static int macb_mdio_reset(struct mii_bus *bus)
return 0;
}
+/**
+ * macb_set_tx_clk() - Set a clock to a new frequency
+ * @clk Pointer to the clock to change
+ * @rate New frequency in Hz
+ * @dev Pointer to the struct net_device
+ */
+static void macb_set_tx_clk(struct clk *clk, int speed, struct net_device *dev)
+{
+ long ferr;
+ long rate;
+ long rate_rounded;
+
+ switch (speed) {
+ case SPEED_10:
+ rate = 2500000;
+ break;
+ case SPEED_100:
+ rate = 25000000;
+ break;
+ case SPEED_1000:
+ rate = 125000000;
+ break;
+ default:
+ break;
+ }
+
+ rate_rounded = clk_round_rate(clk, rate);
+ if (rate_rounded < 0)
+ return;
+
+ /* RGMII allows 50 ppm frequency error. Test and warn if this limit
+ * are not satisfied.
+ */
+ ferr = abs(rate_rounded - rate);
+ ferr = DIV_ROUND_UP(ferr, rate / 100000);
+ if (ferr > 5)
+ netdev_warn(dev, "unable to generate target frequency: %ld Hz\n",
+ rate);
+
+ if (clk_set_rate(clk, rate_rounded))
+ netdev_err(dev, "adjusting tx_clk failed.\n");
+}
+
static void macb_handle_link_change(struct net_device *dev)
{
struct macb *bp = netdev_priv(dev);
@@ -251,6 +294,9 @@ static void macb_handle_link_change(struct net_device *dev)
spin_unlock_irqrestore(&bp->lock, flags);
+ if (!IS_ERR(bp->tx_clk))
+ macb_set_tx_clk(bp->tx_clk, phydev->speed, dev);
+
if (status_change) {
if (phydev->link) {
netif_carrier_on(dev);
@@ -1805,6 +1851,8 @@ static int __init macb_probe(struct platform_device *pdev)
goto err_out_free_dev;
}
+ bp->tx_clk = devm_clk_get(&pdev->dev, "tx_clk");
+
err = clk_prepare_enable(bp->pclk);
if (err) {
dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
@@ -1817,6 +1865,15 @@ static int __init macb_probe(struct platform_device *pdev)
goto err_out_disable_pclk;
}
+ if (!IS_ERR(bp->tx_clk)) {
+ err = clk_prepare_enable(bp->tx_clk);
+ if (err) {
+ dev_err(&pdev->dev, "failed to enable tx_clk (%u)\n",
+ err);
+ goto err_out_disable_hclk;
+ }
+ }
+
bp->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
if (!bp->regs) {
dev_err(&pdev->dev, "failed to map registers, aborting.\n");
@@ -1917,6 +1974,9 @@ static int __init macb_probe(struct platform_device *pdev)
err_out_unregister_netdev:
unregister_netdev(dev);
err_out_disable_clocks:
+ if (!IS_ERR(bp->tx_clk))
+ clk_disable_unprepare(bp->tx_clk);
+err_out_disable_hclk:
clk_disable_unprepare(bp->hclk);
err_out_disable_pclk:
clk_disable_unprepare(bp->pclk);
@@ -1941,6 +2001,8 @@ static int __exit macb_remove(struct platform_device *pdev)
kfree(bp->mii_bus->irq);
mdiobus_free(bp->mii_bus);
unregister_netdev(dev);
+ if (!IS_ERR(bp->tx_clk))
+ clk_disable_unprepare(bp->tx_clk);
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
free_netdev(dev);
@@ -1959,6 +2021,8 @@ static int macb_suspend(struct device *dev)
netif_carrier_off(netdev);
netif_device_detach(netdev);
+ if (!IS_ERR(bp->tx_clk))
+ clk_disable_unprepare(bp->tx_clk);
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
@@ -1973,6 +2037,8 @@ static int macb_resume(struct device *dev)
clk_prepare_enable(bp->pclk);
clk_prepare_enable(bp->hclk);
+ if (!IS_ERR(bp->tx_clk))
+ clk_prepare_enable(bp->tx_clk);
netif_device_attach(netdev);
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index f4076155bed7..51c02442160a 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -572,6 +572,7 @@ struct macb {
struct platform_device *pdev;
struct clk *pclk;
struct clk *hclk;
+ struct clk *tx_clk;
struct net_device *dev;
struct napi_struct napi;
struct work_struct tx_error_task;
--
1.8.4
^ permalink raw reply related
* [PATCH RFC 4/5] net: macb: Use devm_request_irq()
From: Soren Brinkmann @ 2013-10-14 23:58 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: netdev, linux-kernel, Michal Simek, Soren Brinkmann
In-Reply-To: <1381795140-10792-1-git-send-email-soren.brinkmann@xilinx.com>
Use the device managed interface to request the IRQ, simplifying error
paths.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
drivers/net/ethernet/cadence/macb.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 436aecc31732..603844b1d483 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1825,7 +1825,8 @@ static int __init macb_probe(struct platform_device *pdev)
}
dev->irq = platform_get_irq(pdev, 0);
- err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev);
+ err = devm_request_irq(&pdev->dev, dev->irq, macb_interrupt, 0,
+ dev->name, dev);
if (err) {
dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
dev->irq, err);
@@ -1892,7 +1893,7 @@ static int __init macb_probe(struct platform_device *pdev)
err = register_netdev(dev);
if (err) {
dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
- goto err_out_free_irq;
+ goto err_out_disable_clocks;
}
err = macb_mii_init(bp);
@@ -1915,8 +1916,6 @@ static int __init macb_probe(struct platform_device *pdev)
err_out_unregister_netdev:
unregister_netdev(dev);
-err_out_free_irq:
- free_irq(dev->irq, dev);
err_out_disable_clocks:
clk_disable_unprepare(bp->hclk);
err_out_disable_pclk:
@@ -1942,7 +1941,6 @@ static int __exit macb_remove(struct platform_device *pdev)
kfree(bp->mii_bus->irq);
mdiobus_free(bp->mii_bus);
unregister_netdev(dev);
- free_irq(dev->irq, dev);
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
free_netdev(dev);
--
1.8.4
^ permalink raw reply related
* [PATCH RFC 3/5] net: macb: Use devm_ioremap()
From: Soren Brinkmann @ 2013-10-14 23:58 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: netdev, linux-kernel, Michal Simek, Soren Brinkmann
In-Reply-To: <1381795140-10792-1-git-send-email-soren.brinkmann@xilinx.com>
Use the device managed version of ioremap to remap IO memory,
simplifying error paths.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
drivers/net/ethernet/cadence/macb.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 62aa136889a4..436aecc31732 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -17,6 +17,7 @@
#include <linux/circ_buf.h>
#include <linux/slab.h>
#include <linux/init.h>
+#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
@@ -1816,7 +1817,7 @@ static int __init macb_probe(struct platform_device *pdev)
goto err_out_disable_pclk;
}
- bp->regs = ioremap(regs->start, resource_size(regs));
+ bp->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
if (!bp->regs) {
dev_err(&pdev->dev, "failed to map registers, aborting.\n");
err = -ENOMEM;
@@ -1828,7 +1829,7 @@ static int __init macb_probe(struct platform_device *pdev)
if (err) {
dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
dev->irq, err);
- goto err_out_iounmap;
+ goto err_out_disable_clocks;
}
dev->netdev_ops = &macb_netdev_ops;
@@ -1916,8 +1917,6 @@ err_out_unregister_netdev:
unregister_netdev(dev);
err_out_free_irq:
free_irq(dev->irq, dev);
-err_out_iounmap:
- iounmap(bp->regs);
err_out_disable_clocks:
clk_disable_unprepare(bp->hclk);
err_out_disable_pclk:
@@ -1944,7 +1943,6 @@ static int __exit macb_remove(struct platform_device *pdev)
mdiobus_free(bp->mii_bus);
unregister_netdev(dev);
free_irq(dev->irq, dev);
- iounmap(bp->regs);
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
free_netdev(dev);
--
1.8.4
^ permalink raw reply related
* [PATCH RFC 2/5] net: macb: Migrate to devm clock interface
From: Soren Brinkmann @ 2013-10-14 23:58 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: netdev, linux-kernel, Michal Simek, Soren Brinkmann
In-Reply-To: <1381795140-10792-1-git-send-email-soren.brinkmann@xilinx.com>
Migrate to using the device managed intreface for clocks and clean up
the associated error paths.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
drivers/net/ethernet/cadence/macb.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 389ccf1362d5..62aa136889a4 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1790,19 +1790,31 @@ static int __init macb_probe(struct platform_device *pdev)
spin_lock_init(&bp->lock);
INIT_WORK(&bp->tx_error_task, macb_tx_error_task);
- bp->pclk = clk_get(&pdev->dev, "pclk");
+ bp->pclk = devm_clk_get(&pdev->dev, "pclk");
if (IS_ERR(bp->pclk)) {
- dev_err(&pdev->dev, "failed to get macb_clk\n");
+ err = PTR_ERR(bp->pclk);
+ dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
goto err_out_free_dev;
}
- clk_prepare_enable(bp->pclk);
- bp->hclk = clk_get(&pdev->dev, "hclk");
+ bp->hclk = devm_clk_get(&pdev->dev, "hclk");
if (IS_ERR(bp->hclk)) {
- dev_err(&pdev->dev, "failed to get hclk\n");
- goto err_out_put_pclk;
+ err = PTR_ERR(bp->hclk);
+ dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
+ goto err_out_free_dev;
+ }
+
+ err = clk_prepare_enable(bp->pclk);
+ if (err) {
+ dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
+ goto err_out_free_dev;
+ }
+
+ err = clk_prepare_enable(bp->hclk);
+ if (err) {
+ dev_err(&pdev->dev, "failed to enable hclk (%u)\n", err);
+ goto err_out_disable_pclk;
}
- clk_prepare_enable(bp->hclk);
bp->regs = ioremap(regs->start, resource_size(regs));
if (!bp->regs) {
@@ -1908,10 +1920,8 @@ err_out_iounmap:
iounmap(bp->regs);
err_out_disable_clocks:
clk_disable_unprepare(bp->hclk);
- clk_put(bp->hclk);
+err_out_disable_pclk:
clk_disable_unprepare(bp->pclk);
-err_out_put_pclk:
- clk_put(bp->pclk);
err_out_free_dev:
free_netdev(dev);
err_out:
@@ -1936,9 +1946,7 @@ static int __exit macb_remove(struct platform_device *pdev)
free_irq(dev->irq, dev);
iounmap(bp->regs);
clk_disable_unprepare(bp->hclk);
- clk_put(bp->hclk);
clk_disable_unprepare(bp->pclk);
- clk_put(bp->pclk);
free_netdev(dev);
}
--
1.8.4
^ permalink raw reply related
* [PATCH RFC 1/5] net: macb: Migrate to dev_pm_ops
From: Soren Brinkmann @ 2013-10-14 23:58 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: netdev, linux-kernel, Michal Simek, Soren Brinkmann
In-Reply-To: <1381795140-10792-1-git-send-email-soren.brinkmann@xilinx.com>
Migrate the suspend/resume functions to use the dev_pm_ops PM interface.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
drivers/net/ethernet/cadence/macb.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 92578690f6de..389ccf1362d5 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1946,8 +1946,9 @@ static int __exit macb_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM
-static int macb_suspend(struct platform_device *pdev, pm_message_t state)
+static int macb_suspend(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct net_device *netdev = platform_get_drvdata(pdev);
struct macb *bp = netdev_priv(netdev);
@@ -1960,8 +1961,9 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}
-static int macb_resume(struct platform_device *pdev)
+static int macb_resume(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct net_device *netdev = platform_get_drvdata(pdev);
struct macb *bp = netdev_priv(netdev);
@@ -1972,19 +1974,17 @@ static int macb_resume(struct platform_device *pdev)
return 0;
}
-#else
-#define macb_suspend NULL
-#define macb_resume NULL
#endif
+static SIMPLE_DEV_PM_OPS(macb_pm_ops, macb_suspend, macb_resume);
+
static struct platform_driver macb_driver = {
.remove = __exit_p(macb_remove),
- .suspend = macb_suspend,
- .resume = macb_resume,
.driver = {
.name = "macb",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(macb_dt_ids),
+ .pm = &macb_pm_ops,
},
};
--
1.8.4
^ permalink raw reply related
* [PATCH RFC 0/5] Ethernet support for Zynq
From: Soren Brinkmann @ 2013-10-14 23:58 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: netdev, linux-kernel, Michal Simek, Soren Brinkmann
Hi,
I am trying to make Ethernet work on Zynq, whose Ethernet core is a
cadence macb.
I came across two issues: The first is, that Ethernet does not work on
the Zedboard platform, but on zc702 and zc706. In both cases the probing
looks good as far as I can tell:
zc706:
[ 1.754502] libphy: MACB_mii_bus: probed
[ 2.775957] macb e000b000.ethernet eth0: Cadence GEM at 0xe000b000 irq 54 (00:0a:35:00:01:22)
[ 2.784638] macb e000b000.ethernet eth0: attached PHY driver [Marvell 88E1116R] (mii_bus:phy_addr=e000b000.etherne:07, irq=-1)
zed:
[ 1.755202] libphy: MACB_mii_bus: probed
[ 1.771422] macb e000b000.ethernet eth0: Cadence GEM at 0xe000b000 irq 54 (00:0a:35:00:01:22)
[ 1.780141] macb e000b000.ethernet eth0: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.etherne:00, irq=-1)
But on the Zed no actual connection can be established:
zc706:
# udhcpc
udhcpc (v1.21.1) started
grep: /etc/resolv.conf: No such file or directory
Sending discover...
Sending discover...
[ 50.769745] macb e000b000.ethernet eth0: link up (1000/Full)
Sending discover...
Sending select for 10.10.70.4...
Lease of 10.10.70.4 obtained, lease time 600
deleting routers
route: SIOCDELRT: No such process
adding dns 172.19.128.1
adding dns 172.19.129.1
# ping 10.10.70.101
PING 10.10.70.101 (10.10.70.101): 56 data bytes
64 bytes from 10.10.70.101: seq=0 ttl=64 time=0.848 ms
64 bytes from 10.10.70.101: seq=1 ttl=64 time=0.350 ms
On Zed this just loops indefinitely printing "Sending discover...
The main difference is the different phy used on the Zed. Does
anybody have an idea what might go wrong here?
And my second issue is related to the macb clocks:
Currently the macb driver expects two input clocks - pclk and hclk. At
the same time the actual Ethernet clock - tx_clk - is not handled in the
driver at all.
On Zynq's implementation of the macb, pclk and hclk are the same clock
and we provide a tx_clk separately and the driver needs to adjust it
according to the negotiated link speed (at least in some/most use-cases).
Handling this is sketched out in 5/5. But it does not really look nice.
- How do other SOCs handle tx_clk adjustments?
- the bindings do not really fit Zynq's implementation. How can we
ensure that clocks are mandatory or optional as required by the SOC
this core is implemented in?
The first four patches in this series are probably good to go.
Thanks,
Sören
Soren Brinkmann (5):
net: macb: Migrate to dev_pm_ops
net: macb: Migrate to devm clock interface
net: macb: Use devm_ioremap()
net: macb: Use devm_request_irq()
net: macb: Adjust tx_clk when link speed changes
drivers/net/ethernet/cadence/macb.c | 128 ++++++++++++++++++++++++++++--------
drivers/net/ethernet/cadence/macb.h | 1 +
2 files changed, 100 insertions(+), 29 deletions(-)
--
1.8.4
^ permalink raw reply
* [PATCH net] bridge: clean the nf_bridge status when forwarding the skb
From: Antonio Quartulli @ 2013-10-14 22:51 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Antonio Quartulli, Stephen Hemminger
From: Antonio Quartulli <antonio@open-mesh.com>
Even if it is forbidden to enslave a bridge interface into
another one, it is still possible to create a chain of
virtual interfaces including two distinct bridges.
In this case, the skb entering the second bridge could have
the nf_bridge field already set due to a previous operation
and consequently lead to wrong a processing of the packet
itself.
To prevent this behaviour release and set to NULL the
nf_bridge field of the skb when forwarding the packet.
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
I know that not using "extern" when declaring the prototype is not consistent
with the surrounding code, but checkpatch complaints about using "extern" in .h
file and I prefer to not do something "wrong" even if stylistically ugly.
Cheers,
net/bridge/br_forward.c | 2 ++
net/bridge/br_netfilter.c | 10 ++++++++++
net/bridge/br_private.h | 2 ++
3 files changed, 14 insertions(+)
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index 4b81b14..62955f3 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -49,6 +49,8 @@ int br_dev_queue_push_xmit(struct sk_buff *skb)
} else {
skb_push(skb, ETH_HLEN);
br_drop_fake_rtable(skb);
+ br_netfilter_skb_free(skb);
+
dev_queue_xmit(skb);
}
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index f877362..7cad3e2 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -1086,3 +1086,13 @@ void br_netfilter_fini(void)
#endif
dst_entries_destroy(&fake_dst_ops);
}
+
+/**
+ * br_netfilter_skb_free - clean the NF bridge data in an skb
+ * @skb: the skb which the data to free belongs to
+ */
+void br_netfilter_skb_free(struct sk_buff *skb)
+{
+ nf_bridge_put(skb->nf_bridge);
+ skb->nf_bridge = NULL;
+}
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index efb57d9..2a5f637 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -730,10 +730,12 @@ static inline u16 br_get_pvid(const struct net_port_vlans *v)
extern int br_netfilter_init(void);
extern void br_netfilter_fini(void);
extern void br_netfilter_rtable_init(struct net_bridge *);
+void br_netfilter_skb_free(struct sk_buff *skb);
#else
#define br_netfilter_init() (0)
#define br_netfilter_fini() do { } while(0)
#define br_netfilter_rtable_init(x)
+#define br_netfilter_skb_free(x)
#endif
/* br_stp.c */
--
1.8.3.2
^ permalink raw reply related
* [PATCH] libertas: move firmware lifetime handling to firmware.c
From: Dan Williams @ 2013-10-14 22:51 UTC (permalink / raw)
To: Dr. H. Nikolaus Schaller
Cc: libertas-dev, NeilBrown Brown, netdev, linux-wireless, Harro Haan,
John W. Linville, Belisko Marek, LKML
In-Reply-To: <47ACD120-9393-41EA-BF8A-4E5E316A0C79@goldelico.com>
Previously, each bus type was responsible for freeing the firmware
structure, but some did that badly. Move responsibility for freeing
firmware into firmware.c so that it's done once and correctly, instead
of happening in multiple places in bus-specific code.
This fixes a use-after-free bug found by Dr. H. Nikolaus Schaller where
the SDIO code forgot to NULL priv->helper_fw after freeing it.
Signed-off-by: Dan Williams <dcbw@redhat.com>
---
Tested firmware loading on USB (8388), CS (8385), and SDIO (8686).
diff --git a/drivers/net/wireless/libertas/firmware.c b/drivers/net/wireless/libertas/firmware.c
index c0f9e7e..51b92b5 100644
--- a/drivers/net/wireless/libertas/firmware.c
+++ b/drivers/net/wireless/libertas/firmware.c
@@ -49,14 +49,19 @@ static void main_firmware_cb(const struct firmware *firmware, void *context)
/* Failed to find firmware: try next table entry */
load_next_firmware_from_table(priv);
return;
}
/* Firmware found! */
lbs_fw_loaded(priv, 0, priv->helper_fw, firmware);
+ if (priv->helper_fw) {
+ release_firmware (priv->helper_fw);
+ priv->helper_fw = NULL;
+ }
+ release_firmware (firmware);
}
static void helper_firmware_cb(const struct firmware *firmware, void *context)
{
struct lbs_private *priv = context;
if (!firmware) {
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index c94dd68..ef8c98e 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -750,22 +750,22 @@ static void if_cs_prog_firmware(struct lbs_private *priv, int ret,
}
/* Load the firmware */
ret = if_cs_prog_helper(card, helper);
if (ret == 0 && (card->model != MODEL_8305))
ret = if_cs_prog_real(card, mainfw);
if (ret)
- goto out;
+ return;
/* Now actually get the IRQ */
ret = request_irq(card->p_dev->irq, if_cs_interrupt,
IRQF_SHARED, DRV_NAME, card);
if (ret) {
pr_err("error in request_irq\n");
- goto out;
+ return;
}
/*
* Clear any interrupt cause that happened while sending
* firmware/initializing card
*/
if_cs_write16(card, IF_CS_CARD_INT_CAUSE, IF_CS_BIT_MASK);
@@ -773,18 +773,14 @@ static void if_cs_prog_firmware(struct lbs_private *priv, int ret,
/* And finally bring the card up */
priv->fw_ready = 1;
if (lbs_start_card(priv) != 0) {
pr_err("could not activate card\n");
free_irq(card->p_dev->irq, card);
}
-
-out:
- release_firmware(helper);
- release_firmware(mainfw);
}
/********************************************************************/
/* Callback functions for libertas.ko */
/********************************************************************/
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 4557833..991238a 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -704,28 +704,24 @@ static void if_sdio_do_prog_firmware(struct lbs_private *priv, int ret,
if (ret) {
pr_err("failed to find firmware (%d)\n", ret);
return;
}
ret = if_sdio_prog_helper(card, helper);
if (ret)
- goto out;
+ return;
lbs_deb_sdio("Helper firmware loaded\n");
ret = if_sdio_prog_real(card, mainfw);
if (ret)
- goto out;
+ return;
lbs_deb_sdio("Firmware loaded\n");
if_sdio_finish_power_on(card);
-
-out:
- release_firmware(helper);
- release_firmware(mainfw);
}
static int if_sdio_prog_firmware(struct if_sdio_card *card)
{
int ret;
u16 scratch;
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 4bb6574..87ff0ca 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1090,19 +1090,15 @@ static int if_spi_init_card(struct if_spi_card *card)
}
err = spu_set_interrupt_mode(card, 0, 1);
if (err)
goto out;
out:
- release_firmware(helper);
- release_firmware(mainfw);
-
lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err);
-
return err;
}
static void if_spi_resume_worker(struct work_struct *work)
{
struct if_spi_card *card;
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 2798077..dff08a2 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -840,15 +840,15 @@ static void if_usb_prog_firmware(struct lbs_private *priv, int ret,
pr_err("failed to find firmware (%d)\n", ret);
goto done;
}
cardp->fw = fw;
if (check_fwfile_format(cardp->fw->data, cardp->fw->size)) {
ret = -EINVAL;
- goto release_fw;
+ goto done;
}
/* Cancel any pending usb business */
usb_kill_urb(cardp->rx_urb);
usb_kill_urb(cardp->tx_urb);
cardp->fwlastblksent = 0;
@@ -857,15 +857,15 @@ static void if_usb_prog_firmware(struct lbs_private *priv, int ret,
cardp->fwfinalblk = 0;
cardp->bootcmdresp = 0;
restart:
if (if_usb_submit_rx_urb_fwload(cardp) < 0) {
lbs_deb_usbd(&cardp->udev->dev, "URB submission is failed\n");
ret = -EIO;
- goto release_fw;
+ goto done;
}
cardp->bootcmdresp = 0;
do {
int j = 0;
i++;
if_usb_issue_boot_command(cardp, BOOT_CMD_FW_BY_USB);
@@ -879,22 +879,22 @@ restart:
if (cardp->bootcmdresp == BOOT_CMD_RESP_NOT_SUPPORTED) {
/* Return to normal operation */
ret = -EOPNOTSUPP;
usb_kill_urb(cardp->rx_urb);
usb_kill_urb(cardp->tx_urb);
if (if_usb_submit_rx_urb(cardp) < 0)
ret = -EIO;
- goto release_fw;
+ goto done;
} else if (cardp->bootcmdresp <= 0) {
if (--reset_count >= 0) {
if_usb_reset_device(cardp);
goto restart;
}
ret = -EIO;
- goto release_fw;
+ goto done;
}
i = 0;
cardp->totalbytes = 0;
cardp->fwlastblksent = 0;
cardp->CRC_OK = 1;
@@ -917,37 +917,34 @@ restart:
if (--reset_count >= 0) {
if_usb_reset_device(cardp);
goto restart;
}
pr_info("FW download failure, time = %d ms\n", i * 100);
ret = -EIO;
- goto release_fw;
+ goto done;
}
cardp->priv->fw_ready = 1;
if_usb_submit_rx_urb(cardp);
if (lbs_start_card(priv))
- goto release_fw;
+ goto done;
if_usb_setup_firmware(priv);
/*
* EHS_REMOVE_WAKEUP is not supported on all versions of the firmware.
*/
priv->wol_criteria = EHS_REMOVE_WAKEUP;
if (lbs_host_sleep_cfg(priv, priv->wol_criteria, NULL))
priv->ehs_remove_supported = false;
- release_fw:
- release_firmware(cardp->fw);
- cardp->fw = NULL;
-
done:
+ cardp->fw = NULL;
lbs_deb_leave(LBS_DEB_USB);
}
#ifdef CONFIG_PM
static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
{
^ permalink raw reply related
* Re: [RFC net] bridge: clean the nf_bridge status when forwarding the skb
From: Antonio Quartulli @ 2013-10-14 22:35 UTC (permalink / raw)
To: Stephen Hemminger
Cc: David S. Miller, bridge@lists.linux-foundation.org,
netdev@vger.kernel.org
In-Reply-To: <20131014152756.7b83dcc0@nehalam.linuxnetplumber.net>
[-- Attachment #1: Type: text/plain, Size: 410 bytes --]
On Mon, Oct 14, 2013 at 03:27:56PM -0700, Stephen Hemminger wrote:
> The patch content is fine, but it needs necessary ifdef's.
> I would also prefer to have the clean done as a function that can be stubbed out
> like the other bridge netfilter stuff.
>
Ok, I will apply those changes and I will send it as PATCH.
Thank you very much for your feedback!
Regards,
--
Antonio Quartulli
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH 02/07] r8169: Support for byte queue limits
From: Francois Romieu @ 2013-10-14 22:28 UTC (permalink / raw)
To: Tino Reichardt; +Cc: netdev, Realtek linux nic maintainers, Igor Maravic
In-Reply-To: <1381775183-24866-3-git-send-email-milky-kernel@mcmilk.de>
Tino Reichardt <milky-kernel@mcmilk.de> :
[...]
> I have tested this patch on a small server in home use and it's working with
> no problems for about two weeks now. (kernel 3.10.10 and fq_codel enabled)
>
> Original-Patch-By: Igor Maravic <igorm@etf.rs>
> Signed-off-by: Tino Reichardt <milky-kernel@mcmilk.de>
It seems fine. Please include 'net-next' in the Subject field.
--
Ueimor
^ permalink raw reply
* Re: [RFC net] bridge: clean the nf_bridge status when forwarding the skb
From: Stephen Hemminger @ 2013-10-14 22:27 UTC (permalink / raw)
To: Antonio Quartulli
Cc: David S. Miller, bridge@lists.linux-foundation.org,
netdev@vger.kernel.org
In-Reply-To: <20131014222010.GB3873@neomailbox.net>
On Tue, 15 Oct 2013 00:20:10 +0200
Antonio Quartulli <antonio@meshcoding.com> wrote:
> On Fri, Sep 27, 2013 at 12:01:43AM +0200, Antonio Quartulli wrote:
> > On Thu, Sep 26, 2013 at 02:32:48PM -0700, Stephen Hemminger wrote:
> > > > > > diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
> > > > > > index 4b81b14..65864bc 100644
> > > > > > --- a/net/bridge/br_forward.c
> > > > > > +++ b/net/bridge/br_forward.c
> > > > > > @@ -49,6 +49,11 @@ int br_dev_queue_push_xmit(struct sk_buff *skb)
> > > > > > } else {
> > > > > > skb_push(skb, ETH_HLEN);
> > > > > > br_drop_fake_rtable(skb);
> > > > > > +
> > > > > > + /* clean the NF bridge data */
> > > > > > + nf_bridge_put(skb->nf_bridge);
> > > > > > + skb->nf_bridge = NULL;
> > > > > > +
> > > > > > dev_queue_xmit(skb);
> > > > > > }
> > > > > >
> > > >
> > > > Regarding CONFIG_BRIDGE_NETFILTER you are right, thanks.
> > > >
> > > > >
> > > > > I think the header will also be garbage if bridge on bridge with netfilter is used.
> > > > > See nf_bridge_save_header.
> > > >
> > > > What header are you referring to? nf_bridge_save_header() saves the header in
> > > > skb->nf_bridge->data, which is freed during nf_bridge_put() (assuming
> > > > ->use reached 0).
> > > >
> > > >
> > >
> > > If bridge is stacked the original ether header will get overwritten by the second
> > > call to save_header.
> >
> > Sorry, but I am not getting what you mean (I am new to the code and it is late here..):
> > save_header() will store the Ethernet header in nf_bridge->data for
> > later recover (if needed).
> >
> > By freeing nf_bridge I also destroy this header copy.
> >
> > When the skb enters the second bridge, save_header() will save again the header
> > in nf_bridge->data. But I don't see how this can create a problem.
> >
> > The problem I had before this patch comes from the fact that
> > nf_bridge_copy_header() is invoked in the second bridge with the nf_bridge state
> > of the first. This was overwriting my the packet Ethernet header with what the
> > first invocation of save_header() stored in nf_bridge->data.
> >
> > But by unsetting nf_bridge I think I am preventing this from happening again.
> > no?
>
> Hello Stephen,
>
> do you have other comments about this patch? I know it is rather difficult that
> a generic user hits this issue, but I'd like to see it fixed because other
> people using batman-adv may incur in this problem.
>
> Cheers,
>
>
The patch content is fine, but it needs necessary ifdef's.
I would also prefer to have the clean done as a function that can be stubbed out
like the other bridge netfilter stuff.
^ permalink raw reply
* Re: [RFC net] bridge: clean the nf_bridge status when forwarding the skb
From: Antonio Quartulli @ 2013-10-14 22:20 UTC (permalink / raw)
To: Stephen Hemminger
Cc: David S. Miller, bridge@lists.linux-foundation.org,
netdev@vger.kernel.org
In-Reply-To: <20130926220143.GC1228@open-mesh.com>
[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]
On Fri, Sep 27, 2013 at 12:01:43AM +0200, Antonio Quartulli wrote:
> On Thu, Sep 26, 2013 at 02:32:48PM -0700, Stephen Hemminger wrote:
> > > > > diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
> > > > > index 4b81b14..65864bc 100644
> > > > > --- a/net/bridge/br_forward.c
> > > > > +++ b/net/bridge/br_forward.c
> > > > > @@ -49,6 +49,11 @@ int br_dev_queue_push_xmit(struct sk_buff *skb)
> > > > > } else {
> > > > > skb_push(skb, ETH_HLEN);
> > > > > br_drop_fake_rtable(skb);
> > > > > +
> > > > > + /* clean the NF bridge data */
> > > > > + nf_bridge_put(skb->nf_bridge);
> > > > > + skb->nf_bridge = NULL;
> > > > > +
> > > > > dev_queue_xmit(skb);
> > > > > }
> > > > >
> > >
> > > Regarding CONFIG_BRIDGE_NETFILTER you are right, thanks.
> > >
> > > >
> > > > I think the header will also be garbage if bridge on bridge with netfilter is used.
> > > > See nf_bridge_save_header.
> > >
> > > What header are you referring to? nf_bridge_save_header() saves the header in
> > > skb->nf_bridge->data, which is freed during nf_bridge_put() (assuming
> > > ->use reached 0).
> > >
> > >
> >
> > If bridge is stacked the original ether header will get overwritten by the second
> > call to save_header.
>
> Sorry, but I am not getting what you mean (I am new to the code and it is late here..):
> save_header() will store the Ethernet header in nf_bridge->data for
> later recover (if needed).
>
> By freeing nf_bridge I also destroy this header copy.
>
> When the skb enters the second bridge, save_header() will save again the header
> in nf_bridge->data. But I don't see how this can create a problem.
>
> The problem I had before this patch comes from the fact that
> nf_bridge_copy_header() is invoked in the second bridge with the nf_bridge state
> of the first. This was overwriting my the packet Ethernet header with what the
> first invocation of save_header() stored in nf_bridge->data.
>
> But by unsetting nf_bridge I think I am preventing this from happening again.
> no?
Hello Stephen,
do you have other comments about this patch? I know it is rather difficult that
a generic user hits this issue, but I'd like to see it fixed because other
people using batman-adv may incur in this problem.
Cheers,
--
Antonio Quartulli
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCH] iproute2 - Fix tc stats when using -batch mode
From: Nigel Kukard @ 2013-10-14 22:16 UTC (permalink / raw)
To: netdev
[-- Attachment #1.1: Type: text/plain, Size: 528 bytes --]
Hi,
There are two global variables in tc/tc_class.c:
__u32 filter_qdisc;
__u32 filter_classid;
These are not re-initialized for each line received in -batch mode:
# tc -force -batch -
class show dev eth0 parent 1: classid 1:1
class show dev eth0 parent 1: classid 1:1
Error: duplicate "classid": "1:1" is the second value.
This patch fixes the issue by initializing the two globals when we
enter print_class().
Attached a patch which fixes this by initializing them when
print_class() is called.
-N
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: batchfix.patch --]
[-- Type: text/x-patch; name="batchfix.patch", Size: 986 bytes --]
commit d04acab5a8c0267610e9ea21f8a42e54ed4585dc
Author: Nigel Kukard <nkukard@lbsd.net>
Date: Mon Oct 14 22:10:16 2013 +0000
Fix tc stats when using -batch mode
There are two global variables in tc/tc_class.c:
__u32 filter_qdisc;
__u32 filter_classid;
These are not re-initialized for each line received in -batch mode:
class show dev eth0 parent 1: classid 1:1
class show dev eth0 parent 1: classid 1:1
Error: duplicate "classid": "1:1" is the second value.
This patch fixes the issue by initializing the two globals when we
enter print_class().
diff --git a/tc/tc_class.c b/tc/tc_class.c
index 9d4eea5..8043448 100644
--- a/tc/tc_class.c
+++ b/tc/tc_class.c
@@ -241,6 +241,9 @@ int tc_class_list(int argc, char **argv)
t.tcm_family = AF_UNSPEC;
memset(d, 0, sizeof(d));
+ filter_qdisc = 0;
+ filter_classid = 0;
+
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4052 bytes --]
^ permalink raw reply related
* Re: kernel policy routing table src ip not respected since 2.6.37 and commit 9fc3bbb4a752
From: Vincent Li @ 2013-10-14 22:12 UTC (permalink / raw)
To: netdev@vger.kernel.org; +Cc: Joel Sing
In-Reply-To: <CAK3+h2zGFnbC-hpPB8fPX7TC3rKCWbPYVY4WW4HDYbN+LXNXXw@mail.gmail.com>
here is the actual test output
[root@centos64-vm linux]# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
link/ether 52:54:00:c4:bd:08 brd ff:ff:ff:ff:ff:ff
inet 10.1.1.1/24 scope global eth0 <======
inet 10.1.1.2/24 scope global secondary eth0 <======
inet6 fe80::5054:ff:fec4:bd08/64 scope link
valid_lft forever preferred_lft forever
[root@centos64-vm linux]# ip rule list
0: from all lookup local
245: from all lookup 245
32766: from all lookup main
32767: from all lookup default
[root@centos64-vm linux]# ip route list table 245
10.1.1.0/24 dev eth0 proto kernel scope link src 10.1.1.2 <====use
src 10.1.1.2
[root@centos64-vm linux]# ping 10.1.1.9
PING 10.1.1.9 (10.1.1.9) 56(84) bytes of data.
>From 10.1.1.1 icmp_seq=2 Destination Host Unreachable <==expecting
10.1.1.2 as before 2.6.37, but see 10.1.1.1
>From 10.1.1.1 icmp_seq=3 Destination Host Unreachable
Vincent
On Mon, Oct 14, 2013 at 9:13 AM, Vincent Li <vincent.mc.li@gmail.com> wrote:
> I had a simple bash script to test if the policy routing table src ip
> is respected or not, git bisect found the commit 9fc3bbb4a752 to
> change the policy routing table source ip behavior.
>
> commit 9fc3bbb4a752f108cf096d96640f3b548bbbce6c
> Author: Joel Sing <jsing@google.com>
> Date: Mon Jan 3 20:24:20 2011 +0000
>
> ipv4/route.c: respect prefsrc for local routes
>
> The preferred source address is currently ignored for local routes,
> which results in all local connections having a src address that is the
> same as the local dst address. Fix this by respecting the preferred source
> address when it is provided for local routes.
>
> test script:
>
> #!/bin/bash
> ip addr add 10.1.1.1/24 dev eth0
> ip addr add 10.1.1.2/24 dev eth0
> ip rule add priority 245 table 245
> ip route add 10.1.1.0/24 dev eth0 proto kernel scope link src
> 10.1.1.2 table 245 <===source ip 10.1.1.2 to be preferred
>
> ip addr show dev eth0
> ip route list table main
> ip route list table 245
>
>
> tcpdump -nn -i eth0 host 10.1.1.9 and icmp &
>
> ping 10.1.1.9
>
>
>
> --before commit 9fc3bbb4a752
>
> the source is from ip 10.1.1.2 as expected
>
> --after commit 9fc3bbb4a752
>
> the source is from ip 10.1.1.1 which not expected since I have high
> priority table 245 with source ip 10.1.1.2
>
> is this regression of commit 9fc3bbb4a752 ?
>
> Vincent
^ permalink raw reply
* iproute2/tc and major/minor limits
From: Nigel Kukard @ 2013-10-14 21:45 UTC (permalink / raw)
To: netdev
Hi guys,
I'm just curious if there is any specific reason why 32-bit integers are
used with tc imposing the limit of 0xfff maximum major and minor numbers
for classes? (more specifically architectural or algorithmic reasons)
-N
^ permalink raw reply
* Re: [RFC] bridge and friends: reduce TheLinuxWay(tm)
From: Stephen Hemminger @ 2013-10-14 21:41 UTC (permalink / raw)
To: Jamal Hadi Salim; +Cc: Stephen Hemminger, Vlad Yasevich, netdev@vger.kernel.org
In-Reply-To: <525C62D5.3090004@mojatatu.com>
On Mon, 14 Oct 2013 17:32:05 -0400
Jamal Hadi Salim <jhs@mojatatu.com> wrote:
> IOW, TheCutNpasteTrain.
>
> There's a lot of clutter on the netlink interface used
> by bridge and vxlan.
> 1) A lot of things which are boolean on/off end up using a uchar.
> Example:
> IFLA_BRPORT_MODE, IFLA_BRPORT_GUARD, IFLA_BRPORT_PROTECT,
> IFLA_BRPORT_LEARNING, IFLA_BRPORT_UNICAST_FLOOD, BRIDGE_VLAN_INFO_PVID,
> BRIDGE_VLAN_INFO_UNTAGGED, BRIDGE_MODE_VEPA,
> IFLA_VXLAN_PROXY,IFLA_VXLAN_RSC, etc
>
> 2) There's a few fields which are basically intended to project the
> same message to the kernel but are redefined a few times:
> Example:
> BRIDGE_VLAN_INFO_MASTER vs NTF_MASTER vs BRIDGE_FLAGS_MASTER
>
> Also i am not sure why multicast snooping needs its own subheader.
>
> Is it too late to make changes? git logs shows some of these feature
> have only been on the last 2-3 months.
> One approach to resolve this is introduce a new BRIDGE_FLAGS TLV
> which will work like the ifi_flags/change and put all these flags in
> one spot. New iproute will use these and the old one will continue using
> the old approach. It would require to EOL the old interface at some
> point.
Unfortunately, by now this is all set in ABI.
It was a side effect of the per-feature evolutionary style of development.
^ 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