* Re: linux-next: Tree for Nov 29 (netlabel)
From: Paul Moore @ 2012-11-30 15:31 UTC (permalink / raw)
To: Randy Dunlap
Cc: Stephen Rothwell, linux-next, linux-kernel,
netdev@vger.kernel.org
In-Reply-To: <3694027.VYznNcdp7C@sifl>
On Friday, November 30, 2012 10:19:16 AM Paul Moore wrote:
> On Thursday, November 29, 2012 04:05:26 PM Randy Dunlap wrote:
> > On 11/28/2012 10:40 PM, Stephen Rothwell wrote:
> > > Hi all,
> >
> > > Changes since 20121128:
> > (on i386:)
>
> If I had to guess it looks like CONFIG_NETLABEL needs to be dependent on
> CONFIG_INET. While the net/ Kconfig only pulls in the net/netlabel Kconfig
> if CONFIG_INET is defined, I'm guessing that without the explicit
> dependency there is nothing preventing someone from arriving at a bad
> configuration as we see here.
>
> Let me test this out to make sure my reasoning is right and if it is I'll
> post a patch to netdev later today.
>
> Thanks for catching this.
Hmmm. The existing logic in net/Kconfig seems to disable CONFIG_NETLABEL at
build time whenever CONFIG_INET is disabled in my .config file. The only way
I can recreate what you are seeing here is if I move the NetLabel include
outside of the INET conditional in net/Kconfig.
Regardless, adding an explicit dependency on INET to NETLABEL shouldn't hurt
anything so I'll go ahead and post the patch to netdev. Hopefully someone who
understands Kconfig better than I do can help shed some light on this.
> > net/built-in.o: In function `netlbl_cfg_cipsov4_add':
> > (.text+0x61757): undefined reference to `cipso_v4_doi_add'
> > net/built-in.o: In function `netlbl_cfg_cipsov4_del':
> > (.text+0x6177d): undefined reference to `cipso_v4_doi_remove'
> > net/built-in.o: In function `netlbl_cfg_cipsov4_map_add':
> > (.text+0x617ae): undefined reference to `cipso_v4_doi_getdef'
> > net/built-in.o: In function `netlbl_cfg_cipsov4_map_add':
> > (.text+0x61a49): undefined reference to `cipso_v4_doi_putdef'
> > net/built-in.o: In function `netlbl_sock_setattr':
> > (.text+0x6218c): undefined reference to `cipso_v4_sock_setattr'
> > net/built-in.o: In function `netlbl_sock_delattr':
> > (.text+0x6220b): undefined reference to `cipso_v4_sock_delattr'
> > net/built-in.o: In function `netlbl_sock_getattr':
> > (.text+0x62238): undefined reference to `cipso_v4_sock_getattr'
> > net/built-in.o: In function `netlbl_conn_setattr':
> > (.text+0x622de): undefined reference to `cipso_v4_sock_setattr'
> > net/built-in.o: In function `netlbl_conn_setattr':
> > (.text+0x62303): undefined reference to `cipso_v4_sock_delattr'
> > net/built-in.o: In function `netlbl_req_setattr':
> > (.text+0x62429): undefined reference to `cipso_v4_req_setattr'
> > net/built-in.o: In function `netlbl_req_setattr':
> > (.text+0x6244e): undefined reference to `cipso_v4_req_delattr'
> > net/built-in.o: In function `netlbl_req_delattr':
> > (.text+0x624ba): undefined reference to `cipso_v4_req_delattr'
> > net/built-in.o: In function `netlbl_skbuff_setattr':
> > (.text+0x62551): undefined reference to `cipso_v4_skbuff_setattr'
> > net/built-in.o: In function `netlbl_skbuff_setattr':
> > (.text+0x62576): undefined reference to `cipso_v4_skbuff_delattr'
> > net/built-in.o: In function `netlbl_skbuff_getattr':
> > (.text+0x62619): undefined reference to `cipso_v4_skbuff_getattr'
> > net/built-in.o: In function `netlbl_skbuff_err':
> > (.text+0x62685): undefined reference to `cipso_v4_error'
> > net/built-in.o: In function `netlbl_cache_invalidate':
> > (.text+0x626ab): undefined reference to `cipso_v4_cache_invalidate'
> > net/built-in.o: In function `netlbl_cache_add':
> > (.text+0x626ec): undefined reference to `cipso_v4_cache_add'
> > net/built-in.o: In function `netlbl_domhsh_remove_entry':
> > (.text+0x63294): undefined reference to `cipso_v4_doi_putdef'
> > net/built-in.o: In function `netlbl_domhsh_remove_entry':
> > (.text+0x632eb): undefined reference to `cipso_v4_doi_putdef'
> > net/built-in.o: In function `netlbl_domhsh_remove_af4':
> > (.text+0x6349b): undefined reference to `cipso_v4_doi_putdef'
> > net/built-in.o: In function `netlbl_mgmt_add_common.clone.1':
> > netlabel_mgmt.c:(.text+0x64a87): undefined reference to
> > `cipso_v4_doi_getdef' netlabel_mgmt.c:(.text+0x64c83): undefined reference
> > to `cipso_v4_doi_putdef' net/built-in.o: In function
> > `netlbl_cipsov4_listall':
> > netlabel_cipso_v4.c:(.text+0x66e52): undefined reference to
> > `cipso_v4_doi_walk' net/built-in.o: In function `netlbl_cipsov4_list':
> > netlabel_cipso_v4.c:(.text+0x67199): undefined reference to
> > `cipso_v4_doi_getdef' net/built-in.o: In function `netlbl_cipsov4_remove':
> > netlabel_cipso_v4.c:(.text+0x6771b): undefined reference to
> > `cipso_v4_doi_remove' net/built-in.o: In function
> > `netlbl_cipsov4_add_pass':
> > netlabel_cipso_v4.c:(.text+0x67a4b): undefined reference to
> > `cipso_v4_doi_add' netlabel_cipso_v4.c:(.text+0x67a76): undefined
> > reference
> > to `cipso_v4_doi_free' net/built-in.o: In function
> > `netlbl_cipsov4_add_local':
> > netlabel_cipso_v4.c:(.text+0x67b9a): undefined reference to
> > `cipso_v4_doi_add' netlabel_cipso_v4.c:(.text+0x67bc5): undefined
> > reference
> > to `cipso_v4_doi_free' net/built-in.o: In function
> > `netlbl_cipsov4_add_std':
> > netlabel_cipso_v4.c:(.text+0x68535): undefined reference to
> > `cipso_v4_doi_add' netlabel_cipso_v4.c:(.text+0x68575): undefined
> > reference
> > to `cipso_v4_doi_free'
> >
> >
> > Full randconfig file is attached.
--
paul moore
www.paul-moore.com
^ permalink raw reply
* [PATCH] net: make CONFIG_NETLABEL explicitly dependent on CONFIG_INET
From: Paul Moore @ 2012-11-30 15:35 UTC (permalink / raw)
To: netdev; +Cc: rdunlap
This should resolve an issue found during testing with random
configuration files.
net/built-in.o: In function `netlbl_cfg_cipsov4_add':
(.text+0x61757): undefined reference to `cipso_v4_doi_add'
net/built-in.o: In function `netlbl_cfg_cipsov4_del':
(.text+0x6177d): undefined reference to `cipso_v4_doi_remove'
[... and so on ...]
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Paul Moore <pmoore@redhat.com>
---
net/netlabel/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netlabel/Kconfig b/net/netlabel/Kconfig
index 56958c8..f272826 100644
--- a/net/netlabel/Kconfig
+++ b/net/netlabel/Kconfig
@@ -4,7 +4,7 @@
config NETLABEL
bool "NetLabel subsystem support"
- depends on SECURITY
+ depends on SECURITY && INET
default n
---help---
NetLabel provides support for explicit network packet labeling
^ permalink raw reply related
* Re: [net-next PATCH V2 1/9] net: frag evictor, avoid killing warm frag queues
From: Jesper Dangaard Brouer @ 2012-11-30 15:45 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, fw, netdev, pablo, tgraf, amwang, kaber, paulmck,
herbert
In-Reply-To: <1354287134.3299.67.camel@edumazet-glaptop>
On Fri, 2012-11-30 at 06:52 -0800, Eric Dumazet wrote:
> On Fri, 2012-11-30 at 11:04 +0100, Jesper Dangaard Brouer wrote:
> > So, let me instead show, with tests, that the evictor strategy is
> > broken, while keeping the original default thresh settings:
> >
> > # grep . /proc/sys/net/ipv4/ipfrag_*_thresh
> > /proc/sys/net/ipv4/ipfrag_high_thresh:262144
> > /proc/sys/net/ipv4/ipfrag_low_thresh:196608
> >
> > Test purpose, I will on a single 10G link demonstrate, that starting
> > several "N" netperf UDP fragmentation flows, will hurt performance, and
> > then claim this is caused by the bad evictor strategy.
> >
> > Test setup:
> > - Disable Ethernet flow control
> > - netperf packet size 65507
> > - Run netserver on one NUMA node
> > - Start netperf clients against a NIC on the other NUMA node
> > - (The NUMA imbalance helps the effect occur at lower N)
> >
> > Result: N=1 8040 Mbit/s
> > Result: N=2 9584 Mbit/s (4739+4845)
> > Result: N=3 4055 Mbit/s (1436+1371+1248)
> > Result: N=4 2247 Mbit/s (1538+29+54+626)
> > Result: N=5 879 Mbit/s (78+152+226+125+298)
> > Result: N=6 293 Mbit/s (85+55+32+57+46+18)
> > Result: N=7 354 Mbit/s (70+47+33+80+20+72+32)
> >
> > Can we, now, agree that the current evictor strategy is broken?!?
>
> Your setup is broken for sure.
No, its not.
> I dont know how you expect that many
> datagrams being correctly reassembled with ipfrag_high_thresh=262144
That's my point... I'm showing that its not possible, with out current
implementation!
> No matter strategy is implemented, an attacker knows it and can send
> frags so that regular workload is denied. Kernel cant decide which
> packets are more likely to be completed.
Our current evictor implementation will allow the attacker to kill ALL
frag traffic to the machine (and cause high CPU load, with CPUs
spinning).
My implementation will guarantee that some fragments will be, allowed to
finish and complete. A far better choice, than our current situation.
> BTW, install fq_codel at the sender side, so that frags are nicely
> interleaved. Because on real networks, frags of an UDP datagram rarely
> come to destination in a single train with no alien packets inside the
> train.
You are arguing in my favor. I have taken great care that my test will
interleave UDP datagrams (by CPU pinning netperf clients on the sender
side). If I just naively start all netperf client on one CPU on the
sender, then I will have packet trains... and the result will be:
Packet trains result N=5 8884 Mbit/s (1775+1775+1790+1789+1755)
That test would be "broken for sure".
^ permalink raw reply
* Re: [PATCH net-next v1 1/2] bridge: export port_no and port_id via IFA_INFO_DATA
From: Stephen Hemminger @ 2012-11-30 15:52 UTC (permalink / raw)
To: Cong Wang
Cc: netdev, bridge, Herbert Xu, David S. Miller, Thomas Graf,
Jesper Dangaard Brouer
In-Reply-To: <1354269514-1863-1-git-send-email-amwang@redhat.com>
On Fri, 30 Nov 2012 17:58:32 +0800
Cong Wang <amwang@redhat.com> wrote:
> port_no will be used to get ifindex of a port in user-space,
> export it togather with port_id.
>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Stephen Hemminger <shemminger@vyatta.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Thomas Graf <tgraf@suug.ch>
> Cc: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Cong Wang <amwang@redhat.com>
> Acked-by: Thomas Graf <tgraf@suug.ch>
> Signed-off-by: Cong Wang <amwang@redhat.com>
> ---
> include/uapi/linux/if_link.h | 2 ++
> net/bridge/br_netlink.c | 8 +++++++-
> 2 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> index bb58aeb..9cd91a9 100644
> --- a/include/uapi/linux/if_link.h
> +++ b/include/uapi/linux/if_link.h
> @@ -218,6 +218,8 @@ enum {
> IFLA_BRPORT_MODE, /* mode (hairpin) */
> IFLA_BRPORT_GUARD, /* bpdu guard */
> IFLA_BRPORT_PROTECT, /* root port protection */
> + IFLA_BRPORT_NO, /* port no */
> + IFLA_BRPORT_ID, /* port id */
> __IFLA_BRPORT_MAX
> };
> #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index 65429b9..7b7414e 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -28,6 +28,8 @@ static inline size_t br_port_info_size(void)
> + nla_total_size(1) /* IFLA_BRPORT_MODE */
> + nla_total_size(1) /* IFLA_BRPORT_GUARD */
> + nla_total_size(1) /* IFLA_BRPORT_PROTECT */
> + + nla_total_size(2) /* IFLA_BRPORT_NO */
> + + nla_total_size(2) /* IFLA_BRPORT_ID */
> + 0;
> }
>
> @@ -53,7 +55,9 @@ static int br_port_fill_attrs(struct sk_buff *skb,
> nla_put_u32(skb, IFLA_BRPORT_COST, p->path_cost) ||
> nla_put_u8(skb, IFLA_BRPORT_MODE, mode) ||
> nla_put_u8(skb, IFLA_BRPORT_GUARD, !!(p->flags & BR_BPDU_GUARD)) ||
> - nla_put_u8(skb, IFLA_BRPORT_PROTECT, !!(p->flags & BR_ROOT_BLOCK)))
> + nla_put_u8(skb, IFLA_BRPORT_PROTECT, !!(p->flags & BR_ROOT_BLOCK)) ||
> + nla_put_u16(skb, IFLA_BRPORT_NO, p->port_no) ||
> + nla_put_u16(skb, IFLA_BRPORT_ID, p->port_id))
> return -EMSGSIZE;
>
> return 0;
> @@ -168,6 +172,8 @@ static const struct nla_policy ifla_brport_policy[IFLA_BRPORT_MAX + 1] = {
> [IFLA_BRPORT_MODE] = { .type = NLA_U8 },
> [IFLA_BRPORT_GUARD] = { .type = NLA_U8 },
> [IFLA_BRPORT_PROTECT] = { .type = NLA_U8 },
> + [IFLA_BRPORT_NO] = { .type = NLA_U16 },
> + [IFLA_BRPORT_ID] = { .type = NLA_U16 },
> };
>
> /* Change the state of the port and notify spanning tree */
I don't think these are necessary. The device is already available and the relationship
can be determined from other messages. This is what RSTP daemon does.
^ permalink raw reply
* [PATCH 0/5] smsc95xx enhancements
From: Steve Glendinning @ 2012-11-30 15:55 UTC (permalink / raw)
To: netdev; +Cc: Steve Glendinning
This patchset is a resubmission of several patches plus two new
patches, including the expansion of cpp macros at the request of
davem.
Steve Glendinning (5):
smsc95xx: fix suspend buffer overflow
smsc95xx: fix error handling in suspend failure case
smsc95xx: don't enable remote wakeup directly
smsc95xx: fix smsc_crc return type
smsc95xx: expand check_ macros
drivers/net/usb/smsc95xx.c | 566 ++++++++++++++++++++++++++++++++------------
1 file changed, 415 insertions(+), 151 deletions(-)
--
1.7.10.4
^ permalink raw reply
* [PATCH 1/5] smsc95xx: fix suspend buffer overflow
From: Steve Glendinning @ 2012-11-30 15:55 UTC (permalink / raw)
To: netdev; +Cc: Steve Glendinning, Bjorn Mork, Joe Perches
In-Reply-To: <1354290952-27109-1-git-send-email-steve.glendinning@shawell.net>
This patch fixes a buffer overflow introduced by bbd9f9e, where
the filter_mask array is accessed beyond its bounds.
Updated to also add a check for kzalloc failure, as reported by
Bjorn Mork and Joe Perches.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
Cc: Bjorn Mork <bjorn@mork.no>
Cc: Joe Perches <joe@perches.com>
---
drivers/net/usb/smsc95xx.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 79d495d..c397b3a 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1281,7 +1281,7 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
}
if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) {
- u32 *filter_mask = kzalloc(32, GFP_KERNEL);
+ u32 *filter_mask = kzalloc(sizeof(u32) * 32, GFP_KERNEL);
u32 command[2];
u32 offset[2];
u32 crc[4];
@@ -1290,6 +1290,11 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
LAN9500A_WUFF_NUM : LAN9500_WUFF_NUM;
int i, filter = 0;
+ if (!filter_mask) {
+ netdev_warn(dev->net, "Unable to allocate filter_mask\n");
+ return -ENOMEM;
+ }
+
memset(command, 0, sizeof(command));
memset(offset, 0, sizeof(offset));
memset(crc, 0, sizeof(crc));
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/5] smsc95xx: fix error handling in suspend failure case
From: Steve Glendinning @ 2012-11-30 15:55 UTC (permalink / raw)
To: netdev; +Cc: Steve Glendinning
In-Reply-To: <1354290952-27109-1-git-send-email-steve.glendinning@shawell.net>
This patch ensures that if we fail to suspend the LAN9500 device
we call usbnet_resume before returning failure, instead of
leaving the usbnet driver in an unusable state.
Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
---
drivers/net/usb/smsc95xx.c | 50 +++++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 21 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index c397b3a..ffeaf13 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1248,35 +1248,37 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
/* disable energy detect (link up) & wake up events */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
- check_warn_return(ret, "Error reading WUCSR\n");
+ check_warn_goto_done(ret, "Error reading WUCSR\n");
val &= ~(WUCSR_MPEN_ | WUCSR_WAKE_EN_);
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
- check_warn_return(ret, "Error writing WUCSR\n");
+ check_warn_goto_done(ret, "Error writing WUCSR\n");
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
- check_warn_return(ret, "Error reading PM_CTRL\n");
+ check_warn_goto_done(ret, "Error reading PM_CTRL\n");
val &= ~(PM_CTL_ED_EN_ | PM_CTL_WOL_EN_);
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_return(ret, "Error writing PM_CTRL\n");
+ check_warn_goto_done(ret, "Error writing PM_CTRL\n");
- return smsc95xx_enter_suspend2(dev);
+ ret = smsc95xx_enter_suspend2(dev);
+ goto done;
}
if (pdata->wolopts & WAKE_PHY) {
ret = smsc95xx_enable_phy_wakeup_interrupts(dev,
(PHY_INT_MASK_ANEG_COMP_ | PHY_INT_MASK_LINK_DOWN_));
- check_warn_return(ret, "error enabling PHY wakeup ints\n");
+ check_warn_goto_done(ret, "error enabling PHY wakeup ints\n");
/* if link is down then configure EDPD and enter SUSPEND1,
* otherwise enter SUSPEND0 below
*/
if (!link_up) {
netdev_info(dev->net, "entering SUSPEND1 mode\n");
- return smsc95xx_enter_suspend1(dev);
+ ret = smsc95xx_enter_suspend1(dev);
+ goto done;
}
}
@@ -1292,7 +1294,8 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
if (!filter_mask) {
netdev_warn(dev->net, "Unable to allocate filter_mask\n");
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto done;
}
memset(command, 0, sizeof(command));
@@ -1354,49 +1357,49 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
ret = smsc95xx_write_reg_nopm(dev, WUFF, filter_mask[i]);
if (ret < 0)
kfree(filter_mask);
- check_warn_return(ret, "Error writing WUFF\n");
+ check_warn_goto_done(ret, "Error writing WUFF\n");
}
kfree(filter_mask);
for (i = 0; i < (wuff_filter_count / 4); i++) {
ret = smsc95xx_write_reg_nopm(dev, WUFF, command[i]);
- check_warn_return(ret, "Error writing WUFF\n");
+ check_warn_goto_done(ret, "Error writing WUFF\n");
}
for (i = 0; i < (wuff_filter_count / 4); i++) {
ret = smsc95xx_write_reg_nopm(dev, WUFF, offset[i]);
- check_warn_return(ret, "Error writing WUFF\n");
+ check_warn_goto_done(ret, "Error writing WUFF\n");
}
for (i = 0; i < (wuff_filter_count / 2); i++) {
ret = smsc95xx_write_reg_nopm(dev, WUFF, crc[i]);
- check_warn_return(ret, "Error writing WUFF\n");
+ check_warn_goto_done(ret, "Error writing WUFF\n");
}
/* clear any pending pattern match packet status */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
- check_warn_return(ret, "Error reading WUCSR\n");
+ check_warn_goto_done(ret, "Error reading WUCSR\n");
val |= WUCSR_WUFR_;
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
- check_warn_return(ret, "Error writing WUCSR\n");
+ check_warn_goto_done(ret, "Error writing WUCSR\n");
}
if (pdata->wolopts & WAKE_MAGIC) {
/* clear any pending magic packet status */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
- check_warn_return(ret, "Error reading WUCSR\n");
+ check_warn_goto_done(ret, "Error reading WUCSR\n");
val |= WUCSR_MPR_;
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
- check_warn_return(ret, "Error writing WUCSR\n");
+ check_warn_goto_done(ret, "Error writing WUCSR\n");
}
/* enable/disable wakeup sources */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
- check_warn_return(ret, "Error reading WUCSR\n");
+ check_warn_goto_done(ret, "Error reading WUCSR\n");
if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) {
netdev_info(dev->net, "enabling pattern match wakeup\n");
@@ -1415,11 +1418,11 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
}
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
- check_warn_return(ret, "Error writing WUCSR\n");
+ check_warn_goto_done(ret, "Error writing WUCSR\n");
/* enable wol wakeup source */
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
- check_warn_return(ret, "Error reading PM_CTRL\n");
+ check_warn_goto_done(ret, "Error reading PM_CTRL\n");
val |= PM_CTL_WOL_EN_;
@@ -1428,14 +1431,19 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
val |= PM_CTL_ED_EN_;
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_return(ret, "Error writing PM_CTRL\n");
+ check_warn_goto_done(ret, "Error writing PM_CTRL\n");
/* enable receiver to enable frame reception */
smsc95xx_start_rx_path(dev, 1);
/* some wol options are enabled, so enter SUSPEND0 */
netdev_info(dev->net, "entering SUSPEND0 mode\n");
- return smsc95xx_enter_suspend0(dev);
+ ret = smsc95xx_enter_suspend0(dev);
+
+done:
+ if (ret)
+ usbnet_resume(intf);
+ return ret;
}
static int smsc95xx_resume(struct usb_interface *intf)
--
1.7.10.4
^ permalink raw reply related
* [PATCH 3/5] smsc95xx: don't enable remote wakeup directly
From: Steve Glendinning @ 2012-11-30 15:55 UTC (permalink / raw)
To: netdev; +Cc: Steve Glendinning, Bjorn Mork
In-Reply-To: <1354290952-27109-1-git-send-email-steve.glendinning@shawell.net>
As pointed out by Bjorn Mork, the generic "usb" driver sets this
for us so no need to directly set it in this driver.
Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
Cc: Bjorn Mork <bjorn@mork.no>
---
drivers/net/usb/smsc95xx.c | 30 +++++-------------------------
1 file changed, 5 insertions(+), 25 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index ffeaf13..064df1a 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -154,25 +154,6 @@ static int __must_check smsc95xx_write_reg(struct usbnet *dev, u32 index,
{
return __smsc95xx_write_reg(dev, index, data, 0);
}
-static int smsc95xx_set_feature(struct usbnet *dev, u32 feature)
-{
- if (WARN_ON_ONCE(!dev))
- return -EINVAL;
-
- return usbnet_write_cmd_nopm(dev, USB_REQ_SET_FEATURE,
- USB_RECIP_DEVICE, feature, 0,
- NULL, 0);
-}
-
-static int smsc95xx_clear_feature(struct usbnet *dev, u32 feature)
-{
- if (WARN_ON_ONCE(!dev))
- return -EINVAL;
-
- return usbnet_write_cmd_nopm(dev, USB_REQ_CLEAR_FEATURE,
- USB_RECIP_DEVICE, feature,
- 0, NULL, 0);
-}
/* Loop until the read is completed with timeout
* called with phy_mutex held */
@@ -685,8 +666,13 @@ static int smsc95xx_ethtool_set_wol(struct net_device *net,
{
struct usbnet *dev = netdev_priv(net);
struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
+ int ret;
pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
+
+ ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
+ check_warn_return(ret, "device_set_wakeup_enable error %d\n", ret);
+
return 0;
}
@@ -1160,8 +1146,6 @@ static int smsc95xx_enter_suspend0(struct usbnet *dev)
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
check_warn_return(ret, "Error reading PM_CTRL\n");
- smsc95xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
-
return 0;
}
@@ -1204,8 +1188,6 @@ static int smsc95xx_enter_suspend1(struct usbnet *dev)
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
check_warn_return(ret, "Error writing PM_CTRL\n");
- smsc95xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
-
return 0;
}
@@ -1456,8 +1438,6 @@ static int smsc95xx_resume(struct usb_interface *intf)
BUG_ON(!dev);
if (pdata->wolopts) {
- smsc95xx_clear_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
-
/* clear wake-up sources */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
check_warn_return(ret, "Error reading WUCSR\n");
--
1.7.10.4
^ permalink raw reply related
* [PATCH 4/5] smsc95xx: fix smsc_crc return type
From: Steve Glendinning @ 2012-11-30 15:55 UTC (permalink / raw)
To: netdev; +Cc: Steve Glendinning, Joe Perches
In-Reply-To: <1354290952-27109-1-git-send-email-steve.glendinning@shawell.net>
This patch fixes a bug introduced in bbd9f9e which could prevent
some wakeups from working correctly if multiple wol options were
selected.
This helper function calculates a 16-bit crc and shifts it into
either the high or low 16 bits of a u32 so the caller can or it
directly into place. The function previously had a u16 return
type so would always have returned zero when filter was odd.
Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
Reported-by: Bjorn Mork <bjorn@mork.no>
Cc: Joe Perches <joe@perches.com>
---
drivers/net/usb/smsc95xx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 064df1a..b9eb490 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1074,9 +1074,10 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
}
}
-static u16 smsc_crc(const u8 *buffer, size_t len, int filter)
+static u32 smsc_crc(const u8 *buffer, size_t len, int filter)
{
- return bitrev16(crc16(0xFFFF, buffer, len)) << ((filter % 2) * 16);
+ u32 crc = bitrev16(crc16(0xFFFF, buffer, len));
+ return crc << ((filter % 2) * 16);
}
static int smsc95xx_enable_phy_wakeup_interrupts(struct usbnet *dev, u16 mask)
--
1.7.10.4
^ permalink raw reply related
* [PATCH 5/5] smsc95xx: expand check_ macros
From: Steve Glendinning @ 2012-11-30 15:55 UTC (permalink / raw)
To: netdev; +Cc: Steve Glendinning
In-Reply-To: <1354290952-27109-1-git-send-email-steve.glendinning@shawell.net>
These macros, while reducing the amount of code, hide flow control
and make the code more confusing to follow and review. This patch
expands them. It should have no functional effect on the driver.
Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
---
drivers/net/usb/smsc95xx.c | 512 +++++++++++++++++++++++++++++++++-----------
1 file changed, 391 insertions(+), 121 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index b9eb490..f7e1e18 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -55,15 +55,6 @@
#define FEATURE_PHY_NLP_CROSSOVER (0x02)
#define FEATURE_AUTOSUSPEND (0x04)
-#define check_warn(ret, fmt, args...) \
- ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); })
-
-#define check_warn_return(ret, fmt, args...) \
- ({ if (ret < 0) { netdev_warn(dev->net, fmt, ##args); return ret; } })
-
-#define check_warn_goto_done(ret, fmt, args...) \
- ({ if (ret < 0) { netdev_warn(dev->net, fmt, ##args); goto done; } })
-
struct smsc95xx_priv {
u32 mac_cr;
u32 hash_hi;
@@ -166,7 +157,11 @@ static int __must_check __smsc95xx_phy_wait_not_busy(struct usbnet *dev,
do {
ret = __smsc95xx_read_reg(dev, MII_ADDR, &val, in_pm);
- check_warn_return(ret, "Error reading MII_ACCESS\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading MII_ACCESS\n");
+ return ret;
+ }
+
if (!(val & MII_BUSY_))
return 0;
} while (!time_after(jiffies, start_time + HZ));
@@ -185,20 +180,32 @@ static int __smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx,
/* confirm MII not busy */
ret = __smsc95xx_phy_wait_not_busy(dev, in_pm);
- check_warn_goto_done(ret, "MII is busy in smsc95xx_mdio_read\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "MII is busy in smsc95xx_mdio_read\n");
+ goto done;
+ }
/* set the address, index & direction (read from PHY) */
phy_id &= dev->mii.phy_id_mask;
idx &= dev->mii.reg_num_mask;
addr = (phy_id << 11) | (idx << 6) | MII_READ_ | MII_BUSY_;
ret = __smsc95xx_write_reg(dev, MII_ADDR, addr, in_pm);
- check_warn_goto_done(ret, "Error writing MII_ADDR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing MII_ADDR\n");
+ goto done;
+ }
ret = __smsc95xx_phy_wait_not_busy(dev, in_pm);
- check_warn_goto_done(ret, "Timed out reading MII reg %02X\n", idx);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Timed out reading MII reg %02X\n", idx);
+ goto done;
+ }
ret = __smsc95xx_read_reg(dev, MII_DATA, &val, in_pm);
- check_warn_goto_done(ret, "Error reading MII_DATA\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading MII_DATA\n");
+ goto done;
+ }
ret = (u16)(val & 0xFFFF);
@@ -218,21 +225,33 @@ static void __smsc95xx_mdio_write(struct net_device *netdev, int phy_id,
/* confirm MII not busy */
ret = __smsc95xx_phy_wait_not_busy(dev, in_pm);
- check_warn_goto_done(ret, "MII is busy in smsc95xx_mdio_write\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "MII is busy in smsc95xx_mdio_write\n");
+ goto done;
+ }
val = regval;
ret = __smsc95xx_write_reg(dev, MII_DATA, val, in_pm);
- check_warn_goto_done(ret, "Error writing MII_DATA\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing MII_DATA\n");
+ goto done;
+ }
/* set the address, index & direction (write to PHY) */
phy_id &= dev->mii.phy_id_mask;
idx &= dev->mii.reg_num_mask;
addr = (phy_id << 11) | (idx << 6) | MII_WRITE_ | MII_BUSY_;
ret = __smsc95xx_write_reg(dev, MII_ADDR, addr, in_pm);
- check_warn_goto_done(ret, "Error writing MII_ADDR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing MII_ADDR\n");
+ goto done;
+ }
ret = __smsc95xx_phy_wait_not_busy(dev, in_pm);
- check_warn_goto_done(ret, "Timed out writing MII reg %02X\n", idx);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Timed out writing MII reg %02X\n", idx);
+ goto done;
+ }
done:
mutex_unlock(&dev->phy_mutex);
@@ -269,7 +288,11 @@ static int __must_check smsc95xx_wait_eeprom(struct usbnet *dev)
do {
ret = smsc95xx_read_reg(dev, E2P_CMD, &val);
- check_warn_return(ret, "Error reading E2P_CMD\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading E2P_CMD\n");
+ return ret;
+ }
+
if (!(val & E2P_CMD_BUSY_) || (val & E2P_CMD_TIMEOUT_))
break;
udelay(40);
@@ -291,7 +314,10 @@ static int __must_check smsc95xx_eeprom_confirm_not_busy(struct usbnet *dev)
do {
ret = smsc95xx_read_reg(dev, E2P_CMD, &val);
- check_warn_return(ret, "Error reading E2P_CMD\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading E2P_CMD\n");
+ return ret;
+ }
if (!(val & E2P_CMD_BUSY_))
return 0;
@@ -319,14 +345,20 @@ static int smsc95xx_read_eeprom(struct usbnet *dev, u32 offset, u32 length,
for (i = 0; i < length; i++) {
val = E2P_CMD_BUSY_ | E2P_CMD_READ_ | (offset & E2P_CMD_ADDR_);
ret = smsc95xx_write_reg(dev, E2P_CMD, val);
- check_warn_return(ret, "Error writing E2P_CMD\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing E2P_CMD\n");
+ return ret;
+ }
ret = smsc95xx_wait_eeprom(dev);
if (ret < 0)
return ret;
ret = smsc95xx_read_reg(dev, E2P_DATA, &val);
- check_warn_return(ret, "Error reading E2P_DATA\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading E2P_DATA\n");
+ return ret;
+ }
data[i] = val & 0xFF;
offset++;
@@ -351,7 +383,10 @@ static int smsc95xx_write_eeprom(struct usbnet *dev, u32 offset, u32 length,
/* Issue write/erase enable command */
val = E2P_CMD_BUSY_ | E2P_CMD_EWEN_;
ret = smsc95xx_write_reg(dev, E2P_CMD, val);
- check_warn_return(ret, "Error writing E2P_DATA\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing E2P_DATA\n");
+ return ret;
+ }
ret = smsc95xx_wait_eeprom(dev);
if (ret < 0)
@@ -362,12 +397,18 @@ static int smsc95xx_write_eeprom(struct usbnet *dev, u32 offset, u32 length,
/* Fill data register */
val = data[i];
ret = smsc95xx_write_reg(dev, E2P_DATA, val);
- check_warn_return(ret, "Error writing E2P_DATA\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing E2P_DATA\n");
+ return ret;
+ }
/* Send "write" command */
val = E2P_CMD_BUSY_ | E2P_CMD_WRITE_ | (offset & E2P_CMD_ADDR_);
ret = smsc95xx_write_reg(dev, E2P_CMD, val);
- check_warn_return(ret, "Error writing E2P_CMD\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing E2P_CMD\n");
+ return ret;
+ }
ret = smsc95xx_wait_eeprom(dev);
if (ret < 0)
@@ -450,13 +491,16 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
/* Initiate async writes, as we can't wait for completion here */
ret = smsc95xx_write_reg_async(dev, HASHH, &pdata->hash_hi);
- check_warn(ret, "failed to initiate async write to HASHH\n");
+ if (ret < 0)
+ netdev_warn(dev->net, "failed to initiate async write to HASHH\n");
ret = smsc95xx_write_reg_async(dev, HASHL, &pdata->hash_lo);
- check_warn(ret, "failed to initiate async write to HASHL\n");
+ if (ret < 0)
+ netdev_warn(dev->net, "failed to initiate async write to HASHL\n");
ret = smsc95xx_write_reg_async(dev, MAC_CR, &pdata->mac_cr);
- check_warn(ret, "failed to initiate async write to MAC_CR\n");
+ if (ret < 0)
+ netdev_warn(dev->net, "failed to initiate async write to MAC_CR\n");
}
static int smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
@@ -465,7 +509,10 @@ static int smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
u32 flow, afc_cfg = 0;
int ret = smsc95xx_read_reg(dev, AFC_CFG, &afc_cfg);
- check_warn_return(ret, "Error reading AFC_CFG\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading AFC_CFG\n");
+ return ret;
+ }
if (duplex == DUPLEX_FULL) {
u8 cap = mii_resolve_flowctrl_fdx(lcladv, rmtadv);
@@ -490,12 +537,16 @@ static int smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
}
ret = smsc95xx_write_reg(dev, FLOW, flow);
- check_warn_return(ret, "Error writing FLOW\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing FLOW\n");
+ return ret;
+ }
ret = smsc95xx_write_reg(dev, AFC_CFG, afc_cfg);
- check_warn_return(ret, "Error writing AFC_CFG\n");
+ if (ret < 0)
+ netdev_warn(dev->net, "Error writing AFC_CFG\n");
- return 0;
+ return ret;
}
static int smsc95xx_link_reset(struct usbnet *dev)
@@ -509,10 +560,16 @@ static int smsc95xx_link_reset(struct usbnet *dev)
/* clear interrupt status */
ret = smsc95xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC);
- check_warn_return(ret, "Error reading PHY_INT_SRC\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PHY_INT_SRC\n");
+ return ret;
+ }
ret = smsc95xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL_);
- check_warn_return(ret, "Error writing INT_STS\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing INT_STS\n");
+ return ret;
+ }
mii_check_media(mii, 1, 1);
mii_ethtool_gset(&dev->mii, &ecmd);
@@ -534,12 +591,16 @@ static int smsc95xx_link_reset(struct usbnet *dev)
spin_unlock_irqrestore(&pdata->mac_cr_lock, flags);
ret = smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr);
- check_warn_return(ret, "Error writing MAC_CR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing MAC_CR\n");
+ return ret;
+ }
ret = smsc95xx_phy_update_flowcontrol(dev, ecmd.duplex, lcladv, rmtadv);
- check_warn_return(ret, "Error updating PHY flow control\n");
+ if (ret < 0)
+ netdev_warn(dev->net, "Error updating PHY flow control\n");
- return 0;
+ return ret;
}
static void smsc95xx_status(struct usbnet *dev, struct urb *urb)
@@ -573,7 +634,10 @@ static int smsc95xx_set_features(struct net_device *netdev,
int ret;
ret = smsc95xx_read_reg(dev, COE_CR, &read_buf);
- check_warn_return(ret, "Failed to read COE_CR: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read COE_CR: %d\n", ret);
+ return ret;
+ }
if (features & NETIF_F_HW_CSUM)
read_buf |= Tx_COE_EN_;
@@ -586,7 +650,10 @@ static int smsc95xx_set_features(struct net_device *netdev,
read_buf &= ~Rx_COE_EN_;
ret = smsc95xx_write_reg(dev, COE_CR, read_buf);
- check_warn_return(ret, "Failed to write COE_CR: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write COE_CR: %d\n", ret);
+ return ret;
+ }
netif_dbg(dev, hw, dev->net, "COE_CR = 0x%08x\n", read_buf);
return 0;
@@ -671,9 +738,10 @@ static int smsc95xx_ethtool_set_wol(struct net_device *net,
pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
- check_warn_return(ret, "device_set_wakeup_enable error %d\n", ret);
+ if (ret < 0)
+ netdev_warn(dev->net, "device_set_wakeup_enable error %d\n", ret);
- return 0;
+ return ret;
}
static const struct ethtool_ops smsc95xx_ethtool_ops = {
@@ -728,12 +796,16 @@ static int smsc95xx_set_mac_address(struct usbnet *dev)
int ret;
ret = smsc95xx_write_reg(dev, ADDRL, addr_lo);
- check_warn_return(ret, "Failed to write ADDRL: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write ADDRL: %d\n", ret);
+ return ret;
+ }
ret = smsc95xx_write_reg(dev, ADDRH, addr_hi);
- check_warn_return(ret, "Failed to write ADDRH: %d\n", ret);
+ if (ret < 0)
+ netdev_warn(dev->net, "Failed to write ADDRH: %d\n", ret);
- return 0;
+ return ret;
}
/* starts the TX path */
@@ -749,13 +821,17 @@ static int smsc95xx_start_tx_path(struct usbnet *dev)
spin_unlock_irqrestore(&pdata->mac_cr_lock, flags);
ret = smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr);
- check_warn_return(ret, "Failed to write MAC_CR: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write MAC_CR: %d\n", ret);
+ return ret;
+ }
/* Enable Tx at SCSRs */
ret = smsc95xx_write_reg(dev, TX_CFG, TX_CFG_ON_);
- check_warn_return(ret, "Failed to write TX_CFG: %d\n", ret);
+ if (ret < 0)
+ netdev_warn(dev->net, "Failed to write TX_CFG: %d\n", ret);
- return 0;
+ return ret;
}
/* Starts the Receive path */
@@ -770,9 +846,10 @@ static int smsc95xx_start_rx_path(struct usbnet *dev, int in_pm)
spin_unlock_irqrestore(&pdata->mac_cr_lock, flags);
ret = __smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr, in_pm);
- check_warn_return(ret, "Failed to write MAC_CR: %d\n", ret);
+ if (ret < 0)
+ netdev_warn(dev->net, "Failed to write MAC_CR: %d\n", ret);
- return 0;
+ return ret;
}
static int smsc95xx_phy_initialize(struct usbnet *dev)
@@ -807,7 +884,10 @@ static int smsc95xx_phy_initialize(struct usbnet *dev)
/* read to clear */
ret = smsc95xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC);
- check_warn_return(ret, "Failed to read PHY_INT_SRC during init\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read PHY_INT_SRC during init\n");
+ return ret;
+ }
smsc95xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK,
PHY_INT_MASK_DEFAULT_);
@@ -826,13 +906,19 @@ static int smsc95xx_reset(struct usbnet *dev)
netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n");
ret = smsc95xx_write_reg(dev, HW_CFG, HW_CFG_LRST_);
- check_warn_return(ret, "Failed to write HW_CFG_LRST_ bit in HW_CFG\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write HW_CFG_LRST_ bit in HW_CFG\n");
+ return ret;
+ }
timeout = 0;
do {
msleep(10);
ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
- check_warn_return(ret, "Failed to read HW_CFG: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
+ return ret;
+ }
timeout++;
} while ((read_buf & HW_CFG_LRST_) && (timeout < 100));
@@ -842,13 +928,19 @@ static int smsc95xx_reset(struct usbnet *dev)
}
ret = smsc95xx_write_reg(dev, PM_CTRL, PM_CTL_PHY_RST_);
- check_warn_return(ret, "Failed to write PM_CTRL: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write PM_CTRL: %d\n", ret);
+ return ret;
+ }
timeout = 0;
do {
msleep(10);
ret = smsc95xx_read_reg(dev, PM_CTRL, &read_buf);
- check_warn_return(ret, "Failed to read PM_CTRL: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read PM_CTRL: %d\n", ret);
+ return ret;
+ }
timeout++;
} while ((read_buf & PM_CTL_PHY_RST_) && (timeout < 100));
@@ -865,7 +957,10 @@ static int smsc95xx_reset(struct usbnet *dev)
dev->net->dev_addr);
ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
- check_warn_return(ret, "Failed to read HW_CFG: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
+ return ret;
+ }
netif_dbg(dev, ifup, dev->net, "Read Value from HW_CFG : 0x%08x\n",
read_buf);
@@ -873,10 +968,17 @@ static int smsc95xx_reset(struct usbnet *dev)
read_buf |= HW_CFG_BIR_;
ret = smsc95xx_write_reg(dev, HW_CFG, read_buf);
- check_warn_return(ret, "Failed to write HW_CFG_BIR_ bit in HW_CFG\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write HW_CFG_BIR_ bit in HW_CFG\n");
+ return ret;
+ }
ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
- check_warn_return(ret, "Failed to read HW_CFG: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
+ return ret;
+ }
+
netif_dbg(dev, ifup, dev->net,
"Read Value from HW_CFG after writing HW_CFG_BIR_: 0x%08x\n",
read_buf);
@@ -896,27 +998,42 @@ static int smsc95xx_reset(struct usbnet *dev)
(ulong)dev->rx_urb_size);
ret = smsc95xx_write_reg(dev, BURST_CAP, burst_cap);
- check_warn_return(ret, "Failed to write BURST_CAP: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write BURST_CAP: %d\n", ret);
+ return ret;
+ }
ret = smsc95xx_read_reg(dev, BURST_CAP, &read_buf);
- check_warn_return(ret, "Failed to read BURST_CAP: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read BURST_CAP: %d\n", ret);
+ return ret;
+ }
netif_dbg(dev, ifup, dev->net,
"Read Value from BURST_CAP after writing: 0x%08x\n",
read_buf);
ret = smsc95xx_write_reg(dev, BULK_IN_DLY, DEFAULT_BULK_IN_DELAY);
- check_warn_return(ret, "Failed to write BULK_IN_DLY: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write BULK_IN_DLY: %d\n", ret);
+ return ret;
+ }
ret = smsc95xx_read_reg(dev, BULK_IN_DLY, &read_buf);
- check_warn_return(ret, "Failed to read BULK_IN_DLY: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read BULK_IN_DLY: %d\n", ret);
+ return ret;
+ }
netif_dbg(dev, ifup, dev->net,
"Read Value from BULK_IN_DLY after writing: 0x%08x\n",
read_buf);
ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
- check_warn_return(ret, "Failed to read HW_CFG: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
+ return ret;
+ }
netif_dbg(dev, ifup, dev->net, "Read Value from HW_CFG: 0x%08x\n",
read_buf);
@@ -930,66 +1047,111 @@ static int smsc95xx_reset(struct usbnet *dev)
read_buf |= NET_IP_ALIGN << 9;
ret = smsc95xx_write_reg(dev, HW_CFG, read_buf);
- check_warn_return(ret, "Failed to write HW_CFG: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write HW_CFG: %d\n", ret);
+ return ret;
+ }
ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
- check_warn_return(ret, "Failed to read HW_CFG: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
+ return ret;
+ }
netif_dbg(dev, ifup, dev->net,
"Read Value from HW_CFG after writing: 0x%08x\n", read_buf);
ret = smsc95xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL_);
- check_warn_return(ret, "Failed to write INT_STS: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write INT_STS: %d\n", ret);
+ return ret;
+ }
ret = smsc95xx_read_reg(dev, ID_REV, &read_buf);
- check_warn_return(ret, "Failed to read ID_REV: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read ID_REV: %d\n", ret);
+ return ret;
+ }
netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x\n", read_buf);
/* Configure GPIO pins as LED outputs */
write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
LED_GPIO_CFG_FDX_LED;
ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf);
- check_warn_return(ret, "Failed to write LED_GPIO_CFG: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write LED_GPIO_CFG: %d\n", ret);
+ return ret;
+ }
/* Init Tx */
ret = smsc95xx_write_reg(dev, FLOW, 0);
- check_warn_return(ret, "Failed to write FLOW: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write FLOW: %d\n", ret);
+ return ret;
+ }
ret = smsc95xx_write_reg(dev, AFC_CFG, AFC_CFG_DEFAULT);
- check_warn_return(ret, "Failed to write AFC_CFG: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write AFC_CFG: %d\n", ret);
+ return ret;
+ }
/* Don't need mac_cr_lock during initialisation */
ret = smsc95xx_read_reg(dev, MAC_CR, &pdata->mac_cr);
- check_warn_return(ret, "Failed to read MAC_CR: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read MAC_CR: %d\n", ret);
+ return ret;
+ }
/* Init Rx */
/* Set Vlan */
ret = smsc95xx_write_reg(dev, VLAN1, (u32)ETH_P_8021Q);
- check_warn_return(ret, "Failed to write VLAN1: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write VLAN1: %d\n", ret);
+ return ret;
+ }
/* Enable or disable checksum offload engines */
ret = smsc95xx_set_features(dev->net, dev->net->features);
- check_warn_return(ret, "Failed to set checksum offload features\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to set checksum offload features\n");
+ return ret;
+ }
smsc95xx_set_multicast(dev->net);
ret = smsc95xx_phy_initialize(dev);
- check_warn_return(ret, "Failed to init PHY\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to init PHY\n");
+ return ret;
+ }
ret = smsc95xx_read_reg(dev, INT_EP_CTL, &read_buf);
- check_warn_return(ret, "Failed to read INT_EP_CTL: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read INT_EP_CTL: %d\n", ret);
+ return ret;
+ }
/* enable PHY interrupts */
read_buf |= INT_EP_CTL_PHY_INT_;
ret = smsc95xx_write_reg(dev, INT_EP_CTL, read_buf);
- check_warn_return(ret, "Failed to write INT_EP_CTL: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to write INT_EP_CTL: %d\n", ret);
+ return ret;
+ }
ret = smsc95xx_start_tx_path(dev);
- check_warn_return(ret, "Failed to start TX path\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to start TX path\n");
+ return ret;
+ }
ret = smsc95xx_start_rx_path(dev, 0);
- check_warn_return(ret, "Failed to start RX path\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to start RX path\n");
+ return ret;
+ }
netif_dbg(dev, ifup, dev->net, "smsc95xx_reset, return 0\n");
return 0;
@@ -1017,7 +1179,10 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
printk(KERN_INFO SMSC_CHIPNAME " v" SMSC_DRIVER_VERSION "\n");
ret = usbnet_get_endpoints(dev, intf);
- check_warn_return(ret, "usbnet_get_endpoints failed: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "usbnet_get_endpoints failed: %d\n", ret);
+ return ret;
+ }
dev->data[0] = (unsigned long)kzalloc(sizeof(struct smsc95xx_priv),
GFP_KERNEL);
@@ -1044,7 +1209,10 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
/* detect device revision as different features may be available */
ret = smsc95xx_read_reg(dev, ID_REV, &val);
- check_warn_return(ret, "Failed to read ID_REV: %d\n", ret);
+ if (ret < 0) {
+ netdev_warn(dev->net, "Failed to read ID_REV: %d\n", ret);
+ return ret;
+ }
val >>= 16;
if ((val == ID_REV_CHIP_ID_9500A_) || (val == ID_REV_CHIP_ID_9530_) ||
@@ -1089,11 +1257,17 @@ static int smsc95xx_enable_phy_wakeup_interrupts(struct usbnet *dev, u16 mask)
/* read to clear */
ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id, PHY_INT_SRC);
- check_warn_return(ret, "Error reading PHY_INT_SRC\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PHY_INT_SRC\n");
+ return ret;
+ }
/* enable interrupt source */
ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id, PHY_INT_MASK);
- check_warn_return(ret, "Error reading PHY_INT_MASK\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PHY_INT_MASK\n");
+ return ret;
+ }
ret |= mask;
@@ -1109,10 +1283,16 @@ static int smsc95xx_link_ok_nopm(struct usbnet *dev)
/* first, a dummy read, needed to latch some MII phys */
ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id, MII_BMSR);
- check_warn_return(ret, "Error reading MII_BMSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading MII_BMSR\n");
+ return ret;
+ }
ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id, MII_BMSR);
- check_warn_return(ret, "Error reading MII_BMSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading MII_BMSR\n");
+ return ret;
+ }
return !!(ret & BMSR_LSTATUS);
}
@@ -1124,13 +1304,19 @@ static int smsc95xx_enter_suspend0(struct usbnet *dev)
int ret;
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
- check_warn_return(ret, "Error reading PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PM_CTRL\n");
+ return ret;
+ }
val &= (~(PM_CTL_SUS_MODE_ | PM_CTL_WUPS_ | PM_CTL_PHY_RST_));
val |= PM_CTL_SUS_MODE_0;
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_return(ret, "Error writing PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing PM_CTRL\n");
+ return ret;
+ }
/* clear wol status */
val &= ~PM_CTL_WUPS_;
@@ -1141,13 +1327,17 @@ static int smsc95xx_enter_suspend0(struct usbnet *dev)
val |= PM_CTL_WUPS_ED_;
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_return(ret, "Error writing PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing PM_CTRL\n");
+ return ret;
+ }
/* read back PM_CTRL */
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
- check_warn_return(ret, "Error reading PM_CTRL\n");
+ if (ret < 0)
+ netdev_warn(dev->net, "Error reading PM_CTRL\n");
- return 0;
+ return ret;
}
static int smsc95xx_enter_suspend1(struct usbnet *dev)
@@ -1166,7 +1356,10 @@ static int smsc95xx_enter_suspend1(struct usbnet *dev)
/* enable energy detect power-down mode */
ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id, PHY_MODE_CTRL_STS);
- check_warn_return(ret, "Error reading PHY_MODE_CTRL_STS\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PHY_MODE_CTRL_STS\n");
+ return ret;
+ }
ret |= MODE_CTRL_STS_EDPWRDOWN_;
@@ -1174,22 +1367,29 @@ static int smsc95xx_enter_suspend1(struct usbnet *dev)
/* enter SUSPEND1 mode */
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
- check_warn_return(ret, "Error reading PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PM_CTRL\n");
+ return ret;
+ }
val &= ~(PM_CTL_SUS_MODE_ | PM_CTL_WUPS_ | PM_CTL_PHY_RST_);
val |= PM_CTL_SUS_MODE_1;
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_return(ret, "Error writing PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing PM_CTRL\n");
+ return ret;
+ }
/* clear wol status, enable energy detection */
val &= ~PM_CTL_WUPS_;
val |= (PM_CTL_WUPS_ED_ | PM_CTL_ED_EN_);
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_return(ret, "Error writing PM_CTRL\n");
+ if (ret < 0)
+ netdev_warn(dev->net, "Error writing PM_CTRL\n");
- return 0;
+ return ret;
}
static int smsc95xx_enter_suspend2(struct usbnet *dev)
@@ -1198,15 +1398,19 @@ static int smsc95xx_enter_suspend2(struct usbnet *dev)
int ret;
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
- check_warn_return(ret, "Error reading PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PM_CTRL\n");
+ return ret;
+ }
val &= ~(PM_CTL_SUS_MODE_ | PM_CTL_WUPS_ | PM_CTL_PHY_RST_);
val |= PM_CTL_SUS_MODE_2;
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_return(ret, "Error writing PM_CTRL\n");
+ if (ret < 0)
+ netdev_warn(dev->net, "Error writing PM_CTRL\n");
- return 0;
+ return ret;
}
static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
@@ -1217,7 +1421,10 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
int ret;
ret = usbnet_suspend(intf, message);
- check_warn_return(ret, "usbnet_suspend error\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "usbnet_suspend error\n");
+ return ret;
+ }
/* determine if link is up using only _nopm functions */
link_up = smsc95xx_link_ok_nopm(dev);
@@ -1231,20 +1438,32 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
/* disable energy detect (link up) & wake up events */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
- check_warn_goto_done(ret, "Error reading WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading WUCSR\n");
+ goto done;
+ }
val &= ~(WUCSR_MPEN_ | WUCSR_WAKE_EN_);
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
- check_warn_goto_done(ret, "Error writing WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing WUCSR\n");
+ goto done;
+ }
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
- check_warn_goto_done(ret, "Error reading PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PM_CTRL\n");
+ goto done;
+ }
val &= ~(PM_CTL_ED_EN_ | PM_CTL_WOL_EN_);
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_goto_done(ret, "Error writing PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing PM_CTRL\n");
+ goto done;
+ }
ret = smsc95xx_enter_suspend2(dev);
goto done;
@@ -1253,7 +1472,10 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
if (pdata->wolopts & WAKE_PHY) {
ret = smsc95xx_enable_phy_wakeup_interrupts(dev,
(PHY_INT_MASK_ANEG_COMP_ | PHY_INT_MASK_LINK_DOWN_));
- check_warn_goto_done(ret, "error enabling PHY wakeup ints\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "error enabling PHY wakeup ints\n");
+ goto done;
+ }
/* if link is down then configure EDPD and enter SUSPEND1,
* otherwise enter SUSPEND0 below
@@ -1338,51 +1560,77 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
for (i = 0; i < (wuff_filter_count * 4); i++) {
ret = smsc95xx_write_reg_nopm(dev, WUFF, filter_mask[i]);
- if (ret < 0)
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing WUFF\n");
kfree(filter_mask);
- check_warn_goto_done(ret, "Error writing WUFF\n");
+ goto done;
+ }
}
kfree(filter_mask);
for (i = 0; i < (wuff_filter_count / 4); i++) {
ret = smsc95xx_write_reg_nopm(dev, WUFF, command[i]);
- check_warn_goto_done(ret, "Error writing WUFF\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing WUFF\n");
+ goto done;
+ }
}
for (i = 0; i < (wuff_filter_count / 4); i++) {
ret = smsc95xx_write_reg_nopm(dev, WUFF, offset[i]);
- check_warn_goto_done(ret, "Error writing WUFF\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing WUFF\n");
+ goto done;
+ }
}
for (i = 0; i < (wuff_filter_count / 2); i++) {
ret = smsc95xx_write_reg_nopm(dev, WUFF, crc[i]);
- check_warn_goto_done(ret, "Error writing WUFF\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing WUFF\n");
+ goto done;
+ }
}
/* clear any pending pattern match packet status */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
- check_warn_goto_done(ret, "Error reading WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading WUCSR\n");
+ goto done;
+ }
val |= WUCSR_WUFR_;
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
- check_warn_goto_done(ret, "Error writing WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing WUCSR\n");
+ goto done;
+ }
}
if (pdata->wolopts & WAKE_MAGIC) {
/* clear any pending magic packet status */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
- check_warn_goto_done(ret, "Error reading WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading WUCSR\n");
+ goto done;
+ }
val |= WUCSR_MPR_;
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
- check_warn_goto_done(ret, "Error writing WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing WUCSR\n");
+ goto done;
+ }
}
/* enable/disable wakeup sources */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
- check_warn_goto_done(ret, "Error reading WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading WUCSR\n");
+ goto done;
+ }
if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) {
netdev_info(dev->net, "enabling pattern match wakeup\n");
@@ -1401,11 +1649,17 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
}
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
- check_warn_goto_done(ret, "Error writing WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing WUCSR\n");
+ goto done;
+ }
/* enable wol wakeup source */
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
- check_warn_goto_done(ret, "Error reading PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PM_CTRL\n");
+ goto done;
+ }
val |= PM_CTL_WOL_EN_;
@@ -1414,7 +1668,10 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
val |= PM_CTL_ED_EN_;
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_goto_done(ret, "Error writing PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing PM_CTRL\n");
+ goto done;
+ }
/* enable receiver to enable frame reception */
smsc95xx_start_rx_path(dev, 1);
@@ -1441,28 +1698,41 @@ static int smsc95xx_resume(struct usb_interface *intf)
if (pdata->wolopts) {
/* clear wake-up sources */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
- check_warn_return(ret, "Error reading WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading WUCSR\n");
+ return ret;
+ }
val &= ~(WUCSR_WAKE_EN_ | WUCSR_MPEN_);
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
- check_warn_return(ret, "Error writing WUCSR\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing WUCSR\n");
+ return ret;
+ }
/* clear wake-up status */
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
- check_warn_return(ret, "Error reading PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error reading PM_CTRL\n");
+ return ret;
+ }
val &= ~PM_CTL_WOL_EN_;
val |= PM_CTL_WUPS_;
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
- check_warn_return(ret, "Error writing PM_CTRL\n");
+ if (ret < 0) {
+ netdev_warn(dev->net, "Error writing PM_CTRL\n");
+ return ret;
+ }
}
ret = usbnet_resume(intf);
- check_warn_return(ret, "usbnet_resume error\n");
+ if (ret < 0)
+ netdev_warn(dev->net, "usbnet_resume error\n");
- return 0;
+ return ret;
}
static void smsc95xx_rx_csum_offload(struct sk_buff *skb)
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH 4/5] smsc95xx: fix smsc_crc return type
From: Joe Perches @ 2012-11-30 15:59 UTC (permalink / raw)
To: Steve Glendinning; +Cc: netdev
In-Reply-To: <1354290952-27109-5-git-send-email-steve.glendinning@shawell.net>
On Fri, 2012-11-30 at 15:55 +0000, Steve Glendinning wrote:
> This patch fixes a bug introduced in bbd9f9e which could prevent
> some wakeups from working correctly if multiple wol options were
> selected.
>
> This helper function calculates a 16-bit crc and shifts it into
> either the high or low 16 bits of a u32 so the caller can or it
> directly into place. The function previously had a u16 return
> type so would always have returned zero when filter was odd.
>
> Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
> Reported-by: Bjorn Mork <bjorn@mork.no>
> Cc: Joe Perches <joe@perches.com>
> ---
> drivers/net/usb/smsc95xx.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> index 064df1a..b9eb490 100644
> --- a/drivers/net/usb/smsc95xx.c
> +++ b/drivers/net/usb/smsc95xx.c
> @@ -1074,9 +1074,10 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
> }
> }
>
> -static u16 smsc_crc(const u8 *buffer, size_t len, int filter)
> +static u32 smsc_crc(const u8 *buffer, size_t len, int filter)
> {
> - return bitrev16(crc16(0xFFFF, buffer, len)) << ((filter % 2) * 16);
> + u32 crc = bitrev16(crc16(0xFFFF, buffer, len));
> + return crc << ((filter % 2) * 16);
> }
>
> static int smsc95xx_enable_phy_wakeup_interrupts(struct usbnet *dev, u16 mask)
Having filter as an argument to this function really
just confuses things.
The shift should be done when the result is or'd onto the
control variable.
^ permalink raw reply
* Re: [PATCH] sctp: verify length provided in heartbeat information parameter
From: Neil Horman @ 2012-11-30 16:01 UTC (permalink / raw)
To: Thomas Graf; +Cc: davem, netdev, linux-sctp
In-Reply-To: <20121130121627.GG30697@casper.infradead.org>
On Fri, Nov 30, 2012 at 12:16:27PM +0000, Thomas Graf wrote:
> If the variable parameter length provided in the mandatory
> heartbeat information parameter exceeds the calculated payload
> length the packet has been corrupted. Reply with a parameter
> length protocol violation message.
>
> Signed-off-by: Thomas Graf <tgraf@suug.ch>
> ---
> net/sctp/sm_statefuns.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index b6adef8..e92079d 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -1055,6 +1055,7 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
> void *arg,
> sctp_cmd_seq_t *commands)
> {
> + sctp_paramhdr_t *param_hdr;
> struct sctp_chunk *chunk = arg;
> struct sctp_chunk *reply;
> size_t paylen = 0;
> @@ -1072,12 +1073,17 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
> * Information field copied from the received HEARTBEAT chunk.
> */
> chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data;
> + param_hdr = (sctp_paramhdr_t *) chunk->subh.hb_hdr;
> paylen = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t);
> +
> + if (ntohs(param_hdr->length) > paylen)
> + return sctp_sf_violation_paramlen(net, ep, asoc, type, arg,
> + param_hdr, commands);
> +
> if (!pskb_pull(chunk->skb, paylen))
> goto nomem;
>
> - reply = sctp_make_heartbeat_ack(asoc, chunk,
> - chunk->subh.hb_hdr, paylen);
> + reply = sctp_make_heartbeat_ack(asoc, chunk, param_hdr, paylen);
> if (!reply)
> goto nomem;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Looks good, thanks Thomas.
Acked-by: Neil Horman <nhorman@tuxdriver.com>
^ permalink raw reply
* Re: [PATCH 1/5] smsc95xx: fix suspend buffer overflow
From: Joe Perches @ 2012-11-30 16:03 UTC (permalink / raw)
To: Steve Glendinning; +Cc: netdev, Bjorn Mork
In-Reply-To: <1354290952-27109-2-git-send-email-steve.glendinning@shawell.net>
On Fri, 2012-11-30 at 15:55 +0000, Steve Glendinning wrote:
> This patch fixes a buffer overflow introduced by bbd9f9e, where
> the filter_mask array is accessed beyond its bounds.
[]
> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
[]
> @@ -1281,7 +1281,7 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
> }
>
> if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) {
> - u32 *filter_mask = kzalloc(32, GFP_KERNEL);
> + u32 *filter_mask = kzalloc(sizeof(u32) * 32, GFP_KERNEL);
Just get rid of the alloc and use 32 u8's on stack.
It's small enough
No filter value is > FF and the compiler with expand
the u8 to u32 when writing to the card.
^ permalink raw reply
* Re: [PATCH v2 3/3] pppoatm: protect against freeing of vcc
From: David Woodhouse @ 2012-11-30 16:23 UTC (permalink / raw)
To: Krzysztof Mazur
Cc: Chas Williams (CONTRACTOR), David Laight, davem, netdev,
linux-kernel, nathan
In-Reply-To: <1354277415.21562.284.camel@shinybook.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 5095 bytes --]
On Fri, 2012-11-30 at 12:10 +0000, David Woodhouse wrote:
> In that case I think we're fine. I'll just do the same thing in
> br2684_push(), fix up the comment you just corrected, and we're all
> good.
OK, here's an update to me my patch 8/17 'br2684: don't send frames on
not-ready vcc'. It takes the socket lock and does fairly much the same
thing as your pppoatm version. It returns NETDEV_TX_BUSY and stops the
queue if the socket is locked, and it gets woken from the ->release_cb
callback.
I've dropped your Acked-By: since it's mostly new, but feel free to give
me a fresh one. With this I think we're done.
Unless Chas has any objections, I'll ask Dave to pull it...
From 47d5ad4c98452bcddfd00da1c659dac85202f213 Mon Sep 17 00:00:00 2001
From: David Woodhouse <dwmw2@infradead.org>
Date: Tue, 27 Nov 2012 23:28:36 +0000
Subject: [PATCH] br2684: don't send frames on not-ready vcc
Avoid submitting packets to a vcc which is being closed. Things go badly
wrong when the ->pop method gets later called after everything's been
torn down.
Use the ATM socket lock for synchronisation with vcc_destroy_socket(),
which clears the ATM_VF_READY bit under the same lock. Otherwise, we
could end up submitting a packet to the device driver even after its
->ops->close method has been called. And it could call the vcc's ->pop
method after the protocol has been shut down. Which leads to a panic.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
net/atm/br2684.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 45 insertions(+), 3 deletions(-)
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 8eb6fbe..5ff145f 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -68,6 +68,7 @@ struct br2684_vcc {
/* keep old push, pop functions for chaining */
void (*old_push)(struct atm_vcc *vcc, struct sk_buff *skb);
void (*old_pop)(struct atm_vcc *vcc, struct sk_buff *skb);
+ void (*old_release_cb)(struct atm_vcc *vcc);
enum br2684_encaps encaps;
struct list_head brvccs;
#ifdef CONFIG_ATM_BR2684_IPFILTER
@@ -269,6 +270,22 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev,
return !atmvcc->send(atmvcc, skb);
}
+static void br2684_release_cb(struct atm_vcc *atmvcc)
+{
+ struct br2684_vcc *brvcc = BR2684_VCC(atmvcc);
+
+ /*
+ * A race with br2684_xmit_vcc() might cause a spurious wakeup just
+ * after that function *stops* the queue, and qspace might actually
+ * go negative before the queue stops again. We cope with that.
+ */
+ if (atomic_read(&brvcc->qspace) > 0)
+ netif_wake_queue(brvcc->device);
+
+ if (brvcc->old_release_cb)
+ brvcc->old_release_cb(atmvcc);
+}
+
static inline struct br2684_vcc *pick_outgoing_vcc(const struct sk_buff *skb,
const struct br2684_dev *brdev)
{
@@ -280,6 +297,8 @@ static netdev_tx_t br2684_start_xmit(struct sk_buff *skb,
{
struct br2684_dev *brdev = BRPRIV(dev);
struct br2684_vcc *brvcc;
+ struct atm_vcc *atmvcc;
+ netdev_tx_t ret = NETDEV_TX_OK;
pr_debug("skb_dst(skb)=%p\n", skb_dst(skb));
read_lock(&devs_lock);
@@ -290,9 +309,26 @@ static netdev_tx_t br2684_start_xmit(struct sk_buff *skb,
dev->stats.tx_carrier_errors++;
/* netif_stop_queue(dev); */
dev_kfree_skb(skb);
- read_unlock(&devs_lock);
- return NETDEV_TX_OK;
+ goto out_devs;
+ }
+ atmvcc = brvcc->atmvcc;
+
+ bh_lock_sock(sk_atm(atmvcc));
+
+ if (test_bit(ATM_VF_RELEASED, &atmvcc->flags) ||
+ test_bit(ATM_VF_CLOSE, &atmvcc->flags) ||
+ !test_bit(ATM_VF_READY, &atmvcc->flags)) {
+ dev->stats.tx_dropped++;
+ dev_kfree_skb(skb);
+ goto out;
}
+
+ if (sock_owned_by_user(sk_atm(atmvcc))) {
+ netif_stop_queue(brvcc->device);
+ ret = NETDEV_TX_BUSY;
+ goto out;
+ }
+
if (!br2684_xmit_vcc(skb, dev, brvcc)) {
/*
* We should probably use netif_*_queue() here, but that
@@ -304,8 +340,11 @@ static netdev_tx_t br2684_start_xmit(struct sk_buff *skb,
dev->stats.tx_errors++;
dev->stats.tx_fifo_errors++;
}
+ out:
+ bh_unlock_sock(sk_atm(atmvcc));
+ out_devs:
read_unlock(&devs_lock);
- return NETDEV_TX_OK;
+ return ret;
}
/*
@@ -378,6 +417,7 @@ static void br2684_close_vcc(struct br2684_vcc *brvcc)
list_del(&brvcc->brvccs);
write_unlock_irq(&devs_lock);
brvcc->atmvcc->user_back = NULL; /* what about vcc->recvq ??? */
+ brvcc->atmvcc->release_cb = brvcc->old_release_cb;
brvcc->old_push(brvcc->atmvcc, NULL); /* pass on the bad news */
kfree(brvcc);
module_put(THIS_MODULE);
@@ -554,9 +594,11 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
brvcc->encaps = (enum br2684_encaps)be.encaps;
brvcc->old_push = atmvcc->push;
brvcc->old_pop = atmvcc->pop;
+ brvcc->old_release_cb = atmvcc->release_cb;
barrier();
atmvcc->push = br2684_push;
atmvcc->pop = br2684_pop;
+ atmvcc->release_cb = br2684_release_cb;
/* initialize netdev carrier state */
if (atmvcc->dev->signal == ATM_PHY_SIG_LOST)
--
1.8.0
--
dwmw2
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]
^ permalink raw reply related
* Re: [net-next PATCH V2 1/9] net: frag evictor, avoid killing warm frag queues
From: Eric Dumazet @ 2012-11-30 16:37 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: David Miller, fw, netdev, pablo, tgraf, amwang, kaber, paulmck,
herbert
In-Reply-To: <1354290335.11754.447.camel@localhost>
On Fri, 2012-11-30 at 16:45 +0100, Jesper Dangaard Brouer wrote:
> On Fri, 2012-11-30 at 06:52 -0800, Eric Dumazet wrote:
>
> > I dont know how you expect that many
> > datagrams being correctly reassembled with ipfrag_high_thresh=262144
>
> That's my point... I'm showing that its not possible, with out current
> implementation!
What I was saying is that the limits are too small, and we should
increase them for this particular need.
This has little to do with the underlying algo.
Assuming we have a hash table size of 1024 buckets, you could
easily add the following :
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 448e685..bc1bdf9 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -849,13 +849,13 @@ static inline void ip4_frags_ctl_register(void)
static int __net_init ipv4_frags_init_net(struct net *net)
{
/*
- * Fragment cache limits. We will commit 256K at one time. Should we
- * cross that limit we will prune down to 192K. This should cope with
+ * Fragment cache limits. We will commit 4M at one time. Should we
+ * cross that limit we will prune down to 3M. This should cope with
* even the most extreme cases without allowing an attacker to
* measurably harm machine performance.
*/
- net->ipv4.frags.high_thresh = 256 * 1024;
- net->ipv4.frags.low_thresh = 192 * 1024;
+ net->ipv4.frags.high_thresh = 4 << 20;
+ net->ipv4.frags.low_thresh = 3 << 20;
/*
* Important NOTE! Fragment queue must be destroyed before MSL expires.
* RFC791 is wrong proposing to prolongate timer each fragment arrival
^ permalink raw reply related
* Re: linux-next: Tree for Nov 29 (netlabel)
From: Randy Dunlap @ 2012-11-30 16:55 UTC (permalink / raw)
To: Paul Moore
Cc: Stephen Rothwell, linux-next, linux-kernel,
netdev@vger.kernel.org, Casey Schaufler, linux-security-module
In-Reply-To: <2664553.2TRaVqlkGg@sifl>
On 11/30/2012 07:31 AM, Paul Moore wrote:
> On Friday, November 30, 2012 10:19:16 AM Paul Moore wrote:
>> On Thursday, November 29, 2012 04:05:26 PM Randy Dunlap wrote:
>>> On 11/28/2012 10:40 PM, Stephen Rothwell wrote:
>>>> Hi all,
>>>
>>>> Changes since 20121128:
>>> (on i386:)
>>
>> If I had to guess it looks like CONFIG_NETLABEL needs to be dependent on
>> CONFIG_INET. While the net/ Kconfig only pulls in the net/netlabel Kconfig
>> if CONFIG_INET is defined, I'm guessing that without the explicit
>> dependency there is nothing preventing someone from arriving at a bad
>> configuration as we see here.
>>
>> Let me test this out to make sure my reasoning is right and if it is I'll
>> post a patch to netdev later today.
>>
>> Thanks for catching this.
>
> Hmmm. The existing logic in net/Kconfig seems to disable CONFIG_NETLABEL at
> build time whenever CONFIG_INET is disabled in my .config file. The only way
> I can recreate what you are seeing here is if I move the NetLabel include
> outside of the INET conditional in net/Kconfig.
>
> Regardless, adding an explicit dependency on INET to NETLABEL shouldn't hurt
> anything so I'll go ahead and post the patch to netdev. Hopefully someone who
> understands Kconfig better than I do can help shed some light on this.
Sorry, this patch doesn't help.
I just checked the kernel .config again. SECURITY_SMACK
selects NETLABEL even when INET is not enabled. Bad SMACK.
I added Casey and mailing list to the cc:
>>> net/built-in.o: In function `netlbl_cfg_cipsov4_add':
>>> (.text+0x61757): undefined reference to `cipso_v4_doi_add'
>>> net/built-in.o: In function `netlbl_cfg_cipsov4_del':
>>> (.text+0x6177d): undefined reference to `cipso_v4_doi_remove'
>>> net/built-in.o: In function `netlbl_cfg_cipsov4_map_add':
>>> (.text+0x617ae): undefined reference to `cipso_v4_doi_getdef'
>>> net/built-in.o: In function `netlbl_cfg_cipsov4_map_add':
>>> (.text+0x61a49): undefined reference to `cipso_v4_doi_putdef'
>>> net/built-in.o: In function `netlbl_sock_setattr':
>>> (.text+0x6218c): undefined reference to `cipso_v4_sock_setattr'
>>> net/built-in.o: In function `netlbl_sock_delattr':
>>> (.text+0x6220b): undefined reference to `cipso_v4_sock_delattr'
>>> net/built-in.o: In function `netlbl_sock_getattr':
>>> (.text+0x62238): undefined reference to `cipso_v4_sock_getattr'
>>> net/built-in.o: In function `netlbl_conn_setattr':
>>> (.text+0x622de): undefined reference to `cipso_v4_sock_setattr'
>>> net/built-in.o: In function `netlbl_conn_setattr':
>>> (.text+0x62303): undefined reference to `cipso_v4_sock_delattr'
>>> net/built-in.o: In function `netlbl_req_setattr':
>>> (.text+0x62429): undefined reference to `cipso_v4_req_setattr'
>>> net/built-in.o: In function `netlbl_req_setattr':
>>> (.text+0x6244e): undefined reference to `cipso_v4_req_delattr'
>>> net/built-in.o: In function `netlbl_req_delattr':
>>> (.text+0x624ba): undefined reference to `cipso_v4_req_delattr'
>>> net/built-in.o: In function `netlbl_skbuff_setattr':
>>> (.text+0x62551): undefined reference to `cipso_v4_skbuff_setattr'
>>> net/built-in.o: In function `netlbl_skbuff_setattr':
>>> (.text+0x62576): undefined reference to `cipso_v4_skbuff_delattr'
>>> net/built-in.o: In function `netlbl_skbuff_getattr':
>>> (.text+0x62619): undefined reference to `cipso_v4_skbuff_getattr'
>>> net/built-in.o: In function `netlbl_skbuff_err':
>>> (.text+0x62685): undefined reference to `cipso_v4_error'
>>> net/built-in.o: In function `netlbl_cache_invalidate':
>>> (.text+0x626ab): undefined reference to `cipso_v4_cache_invalidate'
>>> net/built-in.o: In function `netlbl_cache_add':
>>> (.text+0x626ec): undefined reference to `cipso_v4_cache_add'
>>> net/built-in.o: In function `netlbl_domhsh_remove_entry':
>>> (.text+0x63294): undefined reference to `cipso_v4_doi_putdef'
>>> net/built-in.o: In function `netlbl_domhsh_remove_entry':
>>> (.text+0x632eb): undefined reference to `cipso_v4_doi_putdef'
>>> net/built-in.o: In function `netlbl_domhsh_remove_af4':
>>> (.text+0x6349b): undefined reference to `cipso_v4_doi_putdef'
>>> net/built-in.o: In function `netlbl_mgmt_add_common.clone.1':
>>> netlabel_mgmt.c:(.text+0x64a87): undefined reference to
>>> `cipso_v4_doi_getdef' netlabel_mgmt.c:(.text+0x64c83): undefined reference
>>> to `cipso_v4_doi_putdef' net/built-in.o: In function
>>> `netlbl_cipsov4_listall':
>>> netlabel_cipso_v4.c:(.text+0x66e52): undefined reference to
>>> `cipso_v4_doi_walk' net/built-in.o: In function `netlbl_cipsov4_list':
>>> netlabel_cipso_v4.c:(.text+0x67199): undefined reference to
>>> `cipso_v4_doi_getdef' net/built-in.o: In function `netlbl_cipsov4_remove':
>>> netlabel_cipso_v4.c:(.text+0x6771b): undefined reference to
>>> `cipso_v4_doi_remove' net/built-in.o: In function
>>> `netlbl_cipsov4_add_pass':
>>> netlabel_cipso_v4.c:(.text+0x67a4b): undefined reference to
>>> `cipso_v4_doi_add' netlabel_cipso_v4.c:(.text+0x67a76): undefined
>>> reference
>>> to `cipso_v4_doi_free' net/built-in.o: In function
>>> `netlbl_cipsov4_add_local':
>>> netlabel_cipso_v4.c:(.text+0x67b9a): undefined reference to
>>> `cipso_v4_doi_add' netlabel_cipso_v4.c:(.text+0x67bc5): undefined
>>> reference
>>> to `cipso_v4_doi_free' net/built-in.o: In function
>>> `netlbl_cipsov4_add_std':
>>> netlabel_cipso_v4.c:(.text+0x68535): undefined reference to
>>> `cipso_v4_doi_add' netlabel_cipso_v4.c:(.text+0x68575): undefined
>>> reference
>>> to `cipso_v4_doi_free'
>>>
>>>
>>> Full randconfig file is attached.
--
~Randy
^ permalink raw reply
* Re: [PATCH V2 1/5] cxgb4: Add T4 filter support
From: David Miller @ 2012-11-30 16:56 UTC (permalink / raw)
To: vipul-ut6Up61K2wZBDgjK7y7TUQ
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
roland-BHEL68pLQRGGvPXPguhicg, divy-ut6Up61K2wZBDgjK7y7TUQ,
dm-ut6Up61K2wZBDgjK7y7TUQ, kumaras-ut6Up61K2wZBDgjK7y7TUQ,
swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
abhishek-ut6Up61K2wZBDgjK7y7TUQ
In-Reply-To: <1354277370-8727-1-git-send-email-vipul-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
I really don't understand how we're supposed to review your patches
when you only post some parts of the patch series to netdev, and
others not.
Please do not do this.
--
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: [PATCH v2 3/3] pppoatm: protect against freeing of vcc
From: Krzysztof Mazur @ 2012-11-30 17:00 UTC (permalink / raw)
To: David Woodhouse
Cc: Chas Williams (CONTRACTOR), David Laight, davem, netdev,
linux-kernel, nathan
In-Reply-To: <1354292626.21562.298.camel@shinybook.infradead.org>
On Fri, Nov 30, 2012 at 04:23:46PM +0000, David Woodhouse wrote:
>
> +static void br2684_release_cb(struct atm_vcc *atmvcc)
> +{
> + struct br2684_vcc *brvcc = BR2684_VCC(atmvcc);
> +
> + /*
> + * A race with br2684_xmit_vcc() might cause a spurious wakeup just
> + * after that function *stops* the queue, and qspace might actually
> + * go negative before the queue stops again. We cope with that.
> + */
We cannot race with br2684_xmit_vcc() because both br2684_xmit_vcc()
and br2684_release_cb() are called with locked sk->sk_lock.slock.
> + if (atomic_read(&brvcc->qspace) > 0)
> + netif_wake_queue(brvcc->device);
> +
> + if (brvcc->old_release_cb)
> + brvcc->old_release_cb(atmvcc);
> +}
Except that comment, the patch looks good:
Acked-by: Krzysztof Mazur <krzysiek@podlesie.net>
Krzysiek
^ permalink raw reply
* Re: "tuntap: multiqueue support" causes udev fork bombs
From: Jiri Slaby @ 2012-11-30 17:01 UTC (permalink / raw)
To: Jason Wang
Cc: David S. Miller, ML netdev, LKML, rmilasan, Jiri Slaby, maxk,
vtun
In-Reply-To: <4146845.d5imC0scLB@jason-thinkpad-t430s>
On 11/29/2012 06:47 AM, Jason Wang wrote:
> On Wednesday, November 28, 2012 11:25:41 AM Jiri Slaby wrote:
>> Hi,
>>
>> with this commit:
>> commit c8d68e6be1c3b242f1c598595830890b65cea64a
>> Author: Jason Wang <jasowang@redhat.com>
>> Date: Wed Oct 31 19:46:00 2012 +0000
>>
>> tuntap: multiqueue support
>>
>>
>> I see fork bombs from udev. It is trying to create 2048 processes. 1024
>> for tx, 1024 for rx. OOM killer indeed steps in and kills everything.
>
> Hi, thanks for the reporting, could you pls try the following patch?
Hi, it is gone with this patch.
> ---
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index b44d7b7..cc3f878 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -492,9 +492,6 @@ static int tun_attach(struct tun_struct *tun, struct file *file)
>
> tun_set_real_num_queues(tun);
>
> - if (tun->numqueues == 1)
> - netif_carrier_on(tun->dev);
> -
> /* device is allowed to go away first, so no need to hold extra
> * refcnt.
> */
> @@ -1611,6 +1608,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
> TUN_USER_FEATURES;
> dev->features = dev->hw_features;
>
> + err = tun_attach(tun, file);
> + if (err < 0)
> + goto err_free_dev;
> +
> err = register_netdevice(tun->dev);
> if (err < 0)
> goto err_free_dev;
> @@ -1620,9 +1621,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
> device_create_file(&tun->dev->dev, &dev_attr_group))
> pr_err("Failed to create tun sysfs files\n");
>
> - err = tun_attach(tun, file);
> - if (err < 0)
> - goto err_free_dev;
> + netif_carrier_on(tun->dev);
> }
>
> tun_debug(KERN_INFO, tun, "tun_set_iff\n");
>
--
js
suse labs
^ permalink raw reply
* Re: [GIT net-next] Open vSwitch
From: David Miller @ 2012-11-30 17:03 UTC (permalink / raw)
To: jesse; +Cc: netdev, dev
In-Reply-To: <1354214149-33651-1-git-send-email-jesse@nicira.com>
From: Jesse Gross <jesse@nicira.com>
Date: Thu, 29 Nov 2012 10:35:42 -0800
> This series of improvements for 3.8/net-next contains four components:
> * Support for modifying IPv6 headers
> * Support for matching and setting skb->mark for better integration with
> things like iptables
> * Ability to recognize the EtherType for RARP packets
> * Two small performance enhancements
>
> The movement of ipv6_find_hdr() into exthdrs_core.c causes two small merge
> conflicts. I left it as is but can do the merge if you want. The conflicts
> are:
> * ipv6_find_hdr() and ipv6_find_tlv() were both moved to the bottom of
> exthdrs_core.c. Both should stay.
> * A new use of ipv6_find_hdr() was added to net/netfilter/ipvs/ip_vs_core.c
> after this patch. The IPVS user has two instances of the old constant
> name IP6T_FH_F_FRAG which has been renamed to IP6_FH_F_FRAG.
Pulled, thanks Jesse.
The merge conflict directions were particularly helpful.
If you ever do the merge yourself (I'm ambivalent about where you or I
do it), make sure you force the merge commit message to have a
description of the conflict resolution similarly to what you provided
here.
Thanks again.
^ permalink raw reply
* [PATCH] MAINTAINERS: fix bouncing tun/tap entries
From: Jiri Slaby @ 2012-11-30 17:05 UTC (permalink / raw)
To: maxk; +Cc: netdev, jirislaby, linux-kernel
Delivery to the following recipient failed permanently:
vtun@office.satix.net
Technical details of permanent failure:
DNS Error: Domain name not found
Of course:
$ host office.satix.net
Host office.satix.net not found: 3(NXDOMAIN)
===========
And "Change of Email Address Notification":
Old Address New Address Email Subject
------------------------------------------------------
maxk@qualcomm.com maxk@qti.qualcomm.com "tuntap: multiqueue...
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Maxim Krasnyansky <maxk@qti.qualcomm.com>
---
MAINTAINERS | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 61b2e14..75d3b88 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7696,8 +7696,7 @@ S: Maintained
F: drivers/net/ethernet/dec/tulip/
TUN/TAP driver
-M: Maxim Krasnyansky <maxk@qualcomm.com>
-L: vtun@office.satix.net
+M: Maxim Krasnyansky <maxk@qti.qualcomm.com>
W: http://vtun.sourceforge.net/tun
S: Maintained
F: Documentation/networking/tuntap.txt
--
1.8.0.1
^ permalink raw reply related
* Re: [PATCH] bonding: rlb mode of bond should not alter ARP originating via bridge
From: David Miller @ 2012-11-30 17:08 UTC (permalink / raw)
To: fubar; +Cc: zheng.x.li, netdev, andy, linux-kernel, joe.jin
In-Reply-To: <15005.1354213705@death.nxdomain>
From: Jay Vosburgh <fubar@us.ibm.com>
Date: Thu, 29 Nov 2012 10:28:25 -0800
> Zheng Li <zheng.x.li@oracle.com> wrote:
>
>>Do not modify or load balance ARP packets passing through balance-alb
>>mode (wherein the ARP did not originate locally, and arrived via a bridge).
>>
>>Modifying pass-through ARP replies causes an incorrect MAC address
>>to be placed into the ARP packet, rendering peers unable to communicate
>>with the actual destination from which the ARP reply originated.
>>
>>Load balancing pass-through ARP requests causes an entry to be
>>created for the peer in the rlb table, and bond_alb_monitor will
>>occasionally issue ARP updates to all peers in the table instrucing them
>>as to which MAC address they should communicate with; this occurs when
>>some event sets rx_ntt. In the bridged case, however, the MAC address
>>used for the update would be the MAC of the slave, not the actual source
>>MAC of the originating destination. This would render peers unable to
>>communicate with the destinations beyond the bridge.
>>
>>Signed-off-by: Zheng Li <zheng.x.li@oracle.com>
>>Cc: Jay Vosburgh <fubar@us.ibm.com>
>>Cc: Andy Gospodarek <andy@greyhouse.net>
>>Cc: "David S. Miller" <davem@davemloft.net>
>
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Applied.
^ permalink raw reply
* Re: [PATCH][RESEND] bonding: delete migrated IP addresses from the rlb hash table
From: David Miller @ 2012-11-30 17:08 UTC (permalink / raw)
To: fubar; +Cc: jbohac, andy, netdev
In-Reply-To: <18712.1354223407@death.nxdomain>
From: Jay Vosburgh <fubar@us.ibm.com>
Date: Thu, 29 Nov 2012 13:10:07 -0800
> Jiri Bohac <jbohac@suse.cz> wrote:
>
>>Signed-off-by: Jiri Bohac <jbohac@suse.cz>
>
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Applied.
^ permalink raw reply
* Re: [net-next PATCH v1] 8021q: fix vlan device to inherit the unicast filtering capability flag
From: David Miller @ 2012-11-30 17:09 UTC (permalink / raw)
To: yi.zou; +Cc: netdev, devel
In-Reply-To: <20121128234520.6615.41220.stg.yi.zou@intel.com>
From: Yi Zou <yi.zou@intel.com>
Date: Wed, 28 Nov 2012 15:45:24 -0800
> This bug is observed on running FCoE over a VLAN device associated w/
> a real device that has IFF_UNICAST_FLT set since FCoE would add unicast
> address such as FLOGI MAC to the VLAN interface that FCoE is on. Since
> currently, VLAN device is not inheriting the IFF_UNICAST_FLT flag from the
> parent real device even though the real device is capable of doing unicast
> filtering. This forces the VLAN device and its real device go to promiscuous
> mode unnecessarily even the added address is actually being added to the
> available unicast filter table in real device.
>
> Signed-off-by: Yi Zou <yi.zou@intel.com>
Applied.
^ permalink raw reply
* Re: [PATCH] ipv6: unify logic evaluating inet6_dev's accept_ra property
From: David Miller @ 2012-11-30 17:09 UTC (permalink / raw)
To: shmulik.ladkani; +Cc: netdev, yoshfuji, tgraf, tore
In-Reply-To: <1354181179-16294-1-git-send-email-shmulik.ladkani@gmail.com>
From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Date: Thu, 29 Nov 2012 11:26:19 +0200
> + /*
> + * If forwarding is enabled, RA are not accepted unless the special
> + * hybrid mode (accept_ra=2) is enabled.
> + */
Please format this comment correctly, in the networking we use
the style:
/* That looks
* like this.
*/
/*
* Not
* like this.
*/
Thanks.
^ 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